- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation
🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
71 lines
1.8 KiB
JavaScript
71 lines
1.8 KiB
JavaScript
import { logger } from '../utils/logger.js';
|
|
import path from 'path';
|
|
import fs from 'fs-extra';
|
|
|
|
export async function initSkills() {
|
|
const skills = [];
|
|
|
|
// Load built-in skills
|
|
const skillsDir = path.join(process.cwd(), 'skills');
|
|
|
|
if (await fs.pathExists(skillsDir)) {
|
|
const skillFiles = await fs.readdir(skillsDir);
|
|
|
|
for (const file of skillFiles) {
|
|
if (file.endsWith('.js') || file.endsWith('.json')) {
|
|
try {
|
|
const skillPath = path.join(skillsDir, file);
|
|
const skill = await fs.readJson(skillPath);
|
|
|
|
skills.push({
|
|
name: skill.name || file.replace(/\.(js|json)$/, ''),
|
|
description: skill.description || '',
|
|
version: skill.version || '1.0.0',
|
|
category: skill.category || 'general',
|
|
});
|
|
|
|
logger.info(`✓ Loaded skill: ${skill.name}`);
|
|
} catch (error) {
|
|
logger.error(`✗ Failed to load skill ${file}:`, error.message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Add built-in skills
|
|
skills.push(
|
|
{
|
|
name: 'code_review',
|
|
description: 'Review code for bugs and improvements',
|
|
version: '1.0.0',
|
|
category: 'development',
|
|
},
|
|
{
|
|
name: 'bug_fix',
|
|
description: 'Fix identified bugs in code',
|
|
version: '1.0.0',
|
|
category: 'development',
|
|
},
|
|
{
|
|
name: 'refactor',
|
|
description: 'Refactor code for better quality',
|
|
version: '1.0.0',
|
|
category: 'development',
|
|
},
|
|
{
|
|
name: 'documentation',
|
|
description: 'Generate and update documentation',
|
|
version: '1.0.0',
|
|
category: 'documentation',
|
|
},
|
|
{
|
|
name: 'testing',
|
|
description: 'Write tests for code',
|
|
version: '1.0.0',
|
|
category: 'testing',
|
|
}
|
|
);
|
|
|
|
return skills;
|
|
}
|