add-skill-kit 3.2.3 → 3.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/lib/commands/help.js +0 -4
- package/bin/lib/commands/install.js +90 -9
- package/bin/lib/ui.js +1 -1
- package/lib/agent-cli/__tests__/adaptive_engine.test.js +190 -0
- package/lib/agent-cli/__tests__/integration/cross_script.test.js +222 -0
- package/lib/agent-cli/__tests__/integration/full_cycle.test.js +230 -0
- package/lib/agent-cli/__tests__/pattern_analyzer.test.js +173 -0
- package/lib/agent-cli/__tests__/pre_execution_check.test.js +167 -0
- package/lib/agent-cli/__tests__/skill_injector.test.js +191 -0
- package/lib/agent-cli/bin/agent.js +191 -0
- package/lib/agent-cli/dashboard/dashboard_server.js +340 -0
- package/lib/agent-cli/dashboard/index.html +538 -0
- package/lib/agent-cli/lib/audit.js +154 -0
- package/lib/agent-cli/lib/audit.test.js +100 -0
- package/lib/agent-cli/lib/auto-learn.js +319 -0
- package/lib/agent-cli/lib/auto_preview.py +148 -0
- package/lib/agent-cli/lib/backup.js +138 -0
- package/lib/agent-cli/lib/backup.test.js +78 -0
- package/lib/agent-cli/lib/checklist.py +222 -0
- package/lib/agent-cli/lib/cognitive-lesson.js +476 -0
- package/lib/agent-cli/lib/completion.js +149 -0
- package/lib/agent-cli/lib/config.js +35 -0
- package/lib/agent-cli/lib/eslint-fix.js +238 -0
- package/lib/agent-cli/lib/evolution-signal.js +215 -0
- package/lib/agent-cli/lib/export.js +86 -0
- package/lib/agent-cli/lib/export.test.js +65 -0
- package/lib/agent-cli/lib/fix.js +337 -0
- package/lib/agent-cli/lib/fix.test.js +80 -0
- package/lib/agent-cli/lib/gemini-export.js +83 -0
- package/lib/agent-cli/lib/generate-registry.js +42 -0
- package/lib/agent-cli/lib/hooks/install-hooks.js +152 -0
- package/lib/agent-cli/lib/hooks/lint-learn.js +172 -0
- package/lib/agent-cli/lib/ignore.js +116 -0
- package/lib/agent-cli/lib/ignore.test.js +58 -0
- package/lib/agent-cli/lib/init.js +124 -0
- package/lib/agent-cli/lib/learn.js +255 -0
- package/lib/agent-cli/lib/learn.test.js +70 -0
- package/lib/agent-cli/lib/migrate-to-v4.js +322 -0
- package/lib/agent-cli/lib/proposals.js +199 -0
- package/lib/agent-cli/lib/proposals.test.js +56 -0
- package/lib/agent-cli/lib/recall.js +820 -0
- package/lib/agent-cli/lib/recall.test.js +107 -0
- package/lib/agent-cli/lib/selfevolution-bridge.js +167 -0
- package/lib/agent-cli/lib/session_manager.py +120 -0
- package/lib/agent-cli/lib/settings.js +227 -0
- package/lib/agent-cli/lib/skill-learn.js +296 -0
- package/lib/agent-cli/lib/stats.js +132 -0
- package/lib/agent-cli/lib/stats.test.js +94 -0
- package/lib/agent-cli/lib/types.js +33 -0
- package/lib/agent-cli/lib/ui/audit-ui.js +146 -0
- package/lib/agent-cli/lib/ui/backup-ui.js +107 -0
- package/lib/agent-cli/lib/ui/clack-helpers.js +317 -0
- package/lib/agent-cli/lib/ui/common.js +83 -0
- package/lib/agent-cli/lib/ui/completion-ui.js +126 -0
- package/lib/agent-cli/lib/ui/custom-select.js +69 -0
- package/lib/agent-cli/lib/ui/dashboard-ui.js +222 -0
- package/lib/agent-cli/lib/ui/evolution-signals-ui.js +107 -0
- package/lib/agent-cli/lib/ui/export-ui.js +94 -0
- package/lib/agent-cli/lib/ui/fix-all-ui.js +191 -0
- package/lib/agent-cli/lib/ui/help-ui.js +49 -0
- package/lib/agent-cli/lib/ui/index.js +199 -0
- package/lib/agent-cli/lib/ui/init-ui.js +56 -0
- package/lib/agent-cli/lib/ui/knowledge-ui.js +55 -0
- package/lib/agent-cli/lib/ui/learn-ui.js +706 -0
- package/lib/agent-cli/lib/ui/lessons-ui.js +148 -0
- package/lib/agent-cli/lib/ui/pretty.js +145 -0
- package/lib/agent-cli/lib/ui/proposals-ui.js +99 -0
- package/lib/agent-cli/lib/ui/recall-ui.js +342 -0
- package/lib/agent-cli/lib/ui/routing-demo.js +79 -0
- package/lib/agent-cli/lib/ui/routing-ui.js +325 -0
- package/lib/agent-cli/lib/ui/settings-ui.js +381 -0
- package/lib/agent-cli/lib/ui/stats-ui.js +123 -0
- package/lib/agent-cli/lib/ui/watch-ui.js +236 -0
- package/lib/agent-cli/lib/verify_all.py +327 -0
- package/lib/agent-cli/lib/watcher.js +181 -0
- package/lib/agent-cli/lib/watcher.test.js +85 -0
- package/lib/agent-cli/package.json +51 -0
- package/lib/agent-cli/scripts/adaptive_engine.js +381 -0
- package/lib/agent-cli/scripts/dashboard_server.js +224 -0
- package/lib/agent-cli/scripts/error_sensor.js +565 -0
- package/lib/agent-cli/scripts/learn_from_failure.js +225 -0
- package/lib/agent-cli/scripts/pattern_analyzer.js +781 -0
- package/lib/agent-cli/scripts/pre_execution_check.js +623 -0
- package/lib/agent-cli/scripts/rule_sharing.js +374 -0
- package/lib/agent-cli/scripts/skill_injector.js +387 -0
- package/lib/agent-cli/scripts/success_sensor.js +500 -0
- package/lib/agent-cli/scripts/user_correction_sensor.js +426 -0
- package/lib/agent-cli/services/auto-learn-service.js +247 -0
- package/lib/agent-cli/src/MIGRATION.md +418 -0
- package/lib/agent-cli/src/README.md +367 -0
- package/lib/agent-cli/src/core/evolution/evolution-signal.js +42 -0
- package/lib/agent-cli/src/core/evolution/index.js +17 -0
- package/lib/agent-cli/src/core/evolution/review-gate.js +40 -0
- package/lib/agent-cli/src/core/evolution/signal-detector.js +137 -0
- package/lib/agent-cli/src/core/evolution/signal-queue.js +79 -0
- package/lib/agent-cli/src/core/evolution/threshold-checker.js +79 -0
- package/lib/agent-cli/src/core/index.js +15 -0
- package/lib/agent-cli/src/core/learning/cognitive-enhancer.js +282 -0
- package/lib/agent-cli/src/core/learning/index.js +12 -0
- package/lib/agent-cli/src/core/learning/lesson-synthesizer.js +83 -0
- package/lib/agent-cli/src/core/scanning/index.js +14 -0
- package/lib/agent-cli/src/data/index.js +13 -0
- package/lib/agent-cli/src/data/repositories/index.js +8 -0
- package/lib/agent-cli/src/data/repositories/lesson-repository.js +130 -0
- package/lib/agent-cli/src/data/repositories/signal-repository.js +119 -0
- package/lib/agent-cli/src/data/storage/index.js +8 -0
- package/lib/agent-cli/src/data/storage/json-storage.js +64 -0
- package/lib/agent-cli/src/data/storage/yaml-storage.js +66 -0
- package/lib/agent-cli/src/infrastructure/index.js +13 -0
- package/lib/agent-cli/src/presentation/formatters/skill-formatter.js +232 -0
- package/lib/agent-cli/src/services/export-service.js +162 -0
- package/lib/agent-cli/src/services/index.js +13 -0
- package/lib/agent-cli/src/services/learning-service.js +99 -0
- package/lib/agent-cli/types/index.d.ts +343 -0
- package/lib/agent-cli/utils/benchmark.js +269 -0
- package/lib/agent-cli/utils/logger.js +303 -0
- package/lib/agent-cli/utils/ml_patterns.js +300 -0
- package/lib/agent-cli/utils/recovery.js +312 -0
- package/lib/agent-cli/utils/telemetry.js +290 -0
- package/lib/agentskillskit-cli/README.md +21 -0
- package/{node_modules/agentskillskit-cli/bin → lib/agentskillskit-cli}/ag-smart.js +15 -15
- package/lib/agentskillskit-cli/package.json +51 -0
- package/package.json +19 -9
- /package/bin/{cli.js → kit.js} +0 -0
- /package/{node_modules/agentskillskit-cli → lib/agent-cli}/README.md +0 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit Tests for skill_injector.js
|
|
3
|
+
*
|
|
4
|
+
* Tests:
|
|
5
|
+
* - analyzeLessons
|
|
6
|
+
* - getSkillCandidates
|
|
7
|
+
* - generateSkillContent
|
|
8
|
+
* - generateSkills
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
12
|
+
|
|
13
|
+
// Mock fs module
|
|
14
|
+
vi.mock('fs', async () => {
|
|
15
|
+
const actual = await vi.importActual('fs');
|
|
16
|
+
return {
|
|
17
|
+
...actual,
|
|
18
|
+
default: {
|
|
19
|
+
...actual,
|
|
20
|
+
existsSync: vi.fn(() => false),
|
|
21
|
+
readFileSync: vi.fn(() => '{}'),
|
|
22
|
+
writeFileSync: vi.fn(),
|
|
23
|
+
mkdirSync: vi.fn(),
|
|
24
|
+
readdirSync: vi.fn(() => [])
|
|
25
|
+
},
|
|
26
|
+
existsSync: vi.fn(() => false),
|
|
27
|
+
readFileSync: vi.fn(() => '{}'),
|
|
28
|
+
writeFileSync: vi.fn(),
|
|
29
|
+
mkdirSync: vi.fn(),
|
|
30
|
+
readdirSync: vi.fn(() => [])
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Category config constant
|
|
35
|
+
const CATEGORY_CONFIG = {
|
|
36
|
+
'SAFE': { name: 'safety-rules', description: 'Auto-learned safety rules' },
|
|
37
|
+
'CODE': { name: 'code-patterns', description: 'Auto-learned code patterns' },
|
|
38
|
+
'FLOW': { name: 'workflow-rules', description: 'Auto-learned workflow rules' },
|
|
39
|
+
'INT': { name: 'integration-rules', description: 'Auto-learned integration rules' },
|
|
40
|
+
'PERF': { name: 'performance-rules', description: 'Auto-learned performance rules' },
|
|
41
|
+
'TEST': { name: 'testing-rules', description: 'Auto-learned testing rules' },
|
|
42
|
+
'LEARN': { name: 'general-lessons', description: 'General lessons learned' }
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
describe('Skill Injector', () => {
|
|
46
|
+
describe('analyzeLessons', () => {
|
|
47
|
+
it('should group lessons by category', () => {
|
|
48
|
+
const lessons = [
|
|
49
|
+
{ id: 'SAFE-001', pattern: 'delete check' },
|
|
50
|
+
{ id: 'SAFE-002', pattern: 'file backup' },
|
|
51
|
+
{ id: 'CODE-001', pattern: 'typescript' },
|
|
52
|
+
{ id: 'TEST-001', pattern: 'unit test' }
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
const categories = {};
|
|
56
|
+
|
|
57
|
+
for (const lesson of lessons) {
|
|
58
|
+
const category = lesson.id?.split('-')[0] || 'LEARN';
|
|
59
|
+
if (!categories[category]) {
|
|
60
|
+
categories[category] = [];
|
|
61
|
+
}
|
|
62
|
+
categories[category].push(lesson);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
expect(categories['SAFE'].length).toBe(2);
|
|
66
|
+
expect(categories['CODE'].length).toBe(1);
|
|
67
|
+
expect(categories['TEST'].length).toBe(1);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should default to LEARN for unknown categories', () => {
|
|
71
|
+
const lessons = [{ id: 'UNKNOWN-001', pattern: 'something' }];
|
|
72
|
+
|
|
73
|
+
const categories = {};
|
|
74
|
+
for (const lesson of lessons) {
|
|
75
|
+
const category = lesson.id?.split('-')[0] || 'LEARN';
|
|
76
|
+
if (!categories[category]) {
|
|
77
|
+
categories[category] = [];
|
|
78
|
+
}
|
|
79
|
+
categories[category].push(lesson);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
expect(categories['UNKNOWN'].length).toBe(1);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe('getSkillCandidates', () => {
|
|
87
|
+
it('should require minimum 3 lessons for skill generation', () => {
|
|
88
|
+
const categories = {
|
|
89
|
+
'SAFE': [{ id: 1 }, { id: 2 }, { id: 3 }], // 3 - eligible
|
|
90
|
+
'CODE': [{ id: 1 }, { id: 2 }], // 2 - not eligible
|
|
91
|
+
'TEST': [{ id: 1 }, { id: 2 }, { id: 3 }, { id: 4 }] // 4 - eligible
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const candidates = [];
|
|
95
|
+
for (const [category, lessons] of Object.entries(categories)) {
|
|
96
|
+
if (lessons.length >= 3) {
|
|
97
|
+
candidates.push({
|
|
98
|
+
category,
|
|
99
|
+
count: lessons.length,
|
|
100
|
+
config: CATEGORY_CONFIG[category] || {
|
|
101
|
+
name: `${category.toLowerCase()}-rules`,
|
|
102
|
+
description: `Auto-learned ${category.toLowerCase()} rules`
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
expect(candidates.length).toBe(2);
|
|
109
|
+
expect(candidates.find(c => c.category === 'SAFE')).toBeDefined();
|
|
110
|
+
expect(candidates.find(c => c.category === 'TEST')).toBeDefined();
|
|
111
|
+
expect(candidates.find(c => c.category === 'CODE')).toBeUndefined();
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
describe('generateSkillContent', () => {
|
|
116
|
+
it('should generate valid SKILL.md content', () => {
|
|
117
|
+
const category = 'SAFE';
|
|
118
|
+
const lessons = [
|
|
119
|
+
{ id: 'SAFE-001', pattern: 'delete check', severity: 'CRITICAL', message: 'Check before delete' },
|
|
120
|
+
{ id: 'SAFE-002', pattern: 'backup first', severity: 'HIGH', message: 'Backup before modify' }
|
|
121
|
+
];
|
|
122
|
+
const config = CATEGORY_CONFIG['SAFE'];
|
|
123
|
+
|
|
124
|
+
// Generate YAML frontmatter
|
|
125
|
+
const content = `---
|
|
126
|
+
name: ${config.name}
|
|
127
|
+
description: ${config.description}
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
# ${config.name}
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
expect(content).toContain('name: safety-rules');
|
|
134
|
+
expect(content).toContain('Auto-learned safety rules');
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('should include severity icons', () => {
|
|
138
|
+
const severityIcons = {
|
|
139
|
+
'CRITICAL': '🔴',
|
|
140
|
+
'HIGH': '🟠',
|
|
141
|
+
'MEDIUM': '🟡',
|
|
142
|
+
'LOW': '🟢'
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
expect(severityIcons['CRITICAL']).toBe('🔴');
|
|
146
|
+
expect(severityIcons['HIGH']).toBe('🟠');
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
describe('generateSkills', () => {
|
|
151
|
+
it('should generate skills for eligible categories', () => {
|
|
152
|
+
const candidates = [
|
|
153
|
+
{ category: 'SAFE', count: 5, config: CATEGORY_CONFIG['SAFE'] },
|
|
154
|
+
{ category: 'CODE', count: 3, config: CATEGORY_CONFIG['CODE'] }
|
|
155
|
+
];
|
|
156
|
+
|
|
157
|
+
const generated = candidates.map(c => ({
|
|
158
|
+
category: c.category,
|
|
159
|
+
name: c.config.name,
|
|
160
|
+
lessonCount: c.count
|
|
161
|
+
}));
|
|
162
|
+
|
|
163
|
+
expect(generated.length).toBe(2);
|
|
164
|
+
expect(generated[0].name).toBe('safety-rules');
|
|
165
|
+
expect(generated[1].name).toBe('code-patterns');
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('should support dry-run mode', () => {
|
|
169
|
+
const dryRun = true;
|
|
170
|
+
const writeOperations = [];
|
|
171
|
+
|
|
172
|
+
if (!dryRun) {
|
|
173
|
+
writeOperations.push('write');
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
expect(writeOperations.length).toBe(0);
|
|
177
|
+
});
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
describe('Category Mapping', () => {
|
|
181
|
+
it('should have all standard categories', () => {
|
|
182
|
+
expect(CATEGORY_CONFIG['SAFE']).toBeDefined();
|
|
183
|
+
expect(CATEGORY_CONFIG['CODE']).toBeDefined();
|
|
184
|
+
expect(CATEGORY_CONFIG['FLOW']).toBeDefined();
|
|
185
|
+
expect(CATEGORY_CONFIG['INT']).toBeDefined();
|
|
186
|
+
expect(CATEGORY_CONFIG['PERF']).toBeDefined();
|
|
187
|
+
expect(CATEGORY_CONFIG['TEST']).toBeDefined();
|
|
188
|
+
expect(CATEGORY_CONFIG['LEARN']).toBeDefined();
|
|
189
|
+
});
|
|
190
|
+
});
|
|
191
|
+
});
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Smart Agent CLI - ESM Version (Production-Ready)
|
|
4
|
+
*
|
|
5
|
+
* The main interface for humans to interact with the Smart Agent Skills system.
|
|
6
|
+
*
|
|
7
|
+
* Commands:
|
|
8
|
+
* learn Add new lessons to memory
|
|
9
|
+
* recall Check files against memory
|
|
10
|
+
* audit Full compliance audit
|
|
11
|
+
* watch Real-time file monitoring
|
|
12
|
+
* stats Knowledge base statistics
|
|
13
|
+
* install-hooks Install git pre-commit hook
|
|
14
|
+
* lint-learn Auto-learn from ESLint output
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { spawn } from "child_process";
|
|
18
|
+
import path from "path";
|
|
19
|
+
import { fileURLToPath } from "url";
|
|
20
|
+
import { VERSION } from "../lib/config.js";
|
|
21
|
+
|
|
22
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
const ARGS = process.argv.slice(2);
|
|
24
|
+
const COMMAND = ARGS[0];
|
|
25
|
+
const SCRIPTS_DIR = path.join(__dirname, "..", "lib");
|
|
26
|
+
const HOOKS_DIR = path.join(SCRIPTS_DIR, "hooks");
|
|
27
|
+
const DASHBOARD_DIR = path.join(__dirname, "..", "dashboard");
|
|
28
|
+
const AUTO_LEARN_DIR = path.join(__dirname, "..", "scripts");
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Run a script with given arguments
|
|
32
|
+
* @param {string} script - Script filename (relative to lib/)
|
|
33
|
+
* @param {string[]} args - Arguments to pass
|
|
34
|
+
* @param {string} baseDir - Base directory for script
|
|
35
|
+
*/
|
|
36
|
+
function run(script, args = [], baseDir = SCRIPTS_DIR) {
|
|
37
|
+
const scriptPath = path.join(baseDir, script);
|
|
38
|
+
const child = spawn("node", [scriptPath, ...args], {
|
|
39
|
+
stdio: "inherit",
|
|
40
|
+
shell: true
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
child.on("close", (code) => {
|
|
44
|
+
process.exit(code || 0);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
child.on("error", (err) => {
|
|
48
|
+
console.error(`❌ Failed to run ${script}:`, err.message);
|
|
49
|
+
process.exit(1);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function printHelp() {
|
|
54
|
+
console.log(`
|
|
55
|
+
🤖 Agent Skill Kit CLI v${VERSION}
|
|
56
|
+
|
|
57
|
+
Usage: agent <command> [options]
|
|
58
|
+
|
|
59
|
+
${"─".repeat(50)}
|
|
60
|
+
|
|
61
|
+
📚 CORE COMMANDS:
|
|
62
|
+
|
|
63
|
+
learn Teach a new lesson to the memory
|
|
64
|
+
agent learn --add --pattern "var " --message "Use let/const"
|
|
65
|
+
agent learn --list
|
|
66
|
+
agent learn --remove LEARN-001
|
|
67
|
+
|
|
68
|
+
recall Check file(s) against learned patterns
|
|
69
|
+
agent recall src/app.js
|
|
70
|
+
agent recall ./src
|
|
71
|
+
|
|
72
|
+
audit Run full compliance audit
|
|
73
|
+
agent audit [directory]
|
|
74
|
+
|
|
75
|
+
${"─".repeat(50)}
|
|
76
|
+
|
|
77
|
+
🚀 PRODUCTION FEATURES:
|
|
78
|
+
|
|
79
|
+
watch Real-time file monitoring
|
|
80
|
+
agent watch [directory]
|
|
81
|
+
|
|
82
|
+
stats Knowledge base statistics
|
|
83
|
+
agent stats
|
|
84
|
+
|
|
85
|
+
install-hooks Install git pre-commit hook
|
|
86
|
+
agent install-hooks
|
|
87
|
+
agent install-hooks --remove
|
|
88
|
+
|
|
89
|
+
lint-learn Auto-learn from ESLint JSON output
|
|
90
|
+
npx eslint . --format json | agent lint-learn
|
|
91
|
+
|
|
92
|
+
fix 🆕 Auto-fix violations
|
|
93
|
+
agent fix <file|dir> [--mode safe|aggressive]
|
|
94
|
+
|
|
95
|
+
sync-skills 🆕 Sync hot patterns to SKILL.md
|
|
96
|
+
agent sync-skills
|
|
97
|
+
|
|
98
|
+
dashboard 🆕 Start Auto-Learn dashboard
|
|
99
|
+
agent dashboard
|
|
100
|
+
|
|
101
|
+
auto-learn 🆕 Run auto-learn scripts
|
|
102
|
+
agent auto-learn --scan
|
|
103
|
+
agent auto-learn --analyze
|
|
104
|
+
agent auto-learn --check "intent"
|
|
105
|
+
|
|
106
|
+
${"─".repeat(50)}
|
|
107
|
+
|
|
108
|
+
📖 HELP:
|
|
109
|
+
|
|
110
|
+
help, --help Show this help message
|
|
111
|
+
--version Show version number
|
|
112
|
+
|
|
113
|
+
💡 Docs: https://github.com/agentskillkit/agent-skills
|
|
114
|
+
`);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Command routing
|
|
118
|
+
switch (COMMAND) {
|
|
119
|
+
// Core commands (v2 versions)
|
|
120
|
+
case "learn":
|
|
121
|
+
run("learn.js", ARGS.slice(1));
|
|
122
|
+
break;
|
|
123
|
+
case "recall":
|
|
124
|
+
run("recall.js", ARGS.slice(1));
|
|
125
|
+
break;
|
|
126
|
+
case "audit":
|
|
127
|
+
run("audit.js", ARGS.slice(1));
|
|
128
|
+
break;
|
|
129
|
+
|
|
130
|
+
// Production features
|
|
131
|
+
case "watch":
|
|
132
|
+
run("watcher.js", ARGS.slice(1));
|
|
133
|
+
break;
|
|
134
|
+
case "stats":
|
|
135
|
+
run("stats.js", ARGS.slice(1));
|
|
136
|
+
break;
|
|
137
|
+
case "install-hooks":
|
|
138
|
+
run("install-hooks.js", ARGS.slice(1), HOOKS_DIR);
|
|
139
|
+
break;
|
|
140
|
+
case "lint-learn":
|
|
141
|
+
run("lint-learn.js", ARGS.slice(1), HOOKS_DIR);
|
|
142
|
+
break;
|
|
143
|
+
case "fix":
|
|
144
|
+
run("fix.js", ARGS.slice(1));
|
|
145
|
+
break;
|
|
146
|
+
case "sync-skills":
|
|
147
|
+
run("skill-learn.js", ARGS.slice(1));
|
|
148
|
+
break;
|
|
149
|
+
|
|
150
|
+
// Auto-Learn features
|
|
151
|
+
case "dashboard":
|
|
152
|
+
run("dashboard_server.js", ARGS.slice(1), DASHBOARD_DIR);
|
|
153
|
+
break;
|
|
154
|
+
case "auto-learn":
|
|
155
|
+
const subCmd = ARGS[1];
|
|
156
|
+
if (subCmd === "--scan" || subCmd === "-s") {
|
|
157
|
+
run("error_sensor.js", ARGS.slice(2), AUTO_LEARN_DIR);
|
|
158
|
+
} else if (subCmd === "--success") {
|
|
159
|
+
run("success_sensor.js", ARGS.slice(2), AUTO_LEARN_DIR);
|
|
160
|
+
} else if (subCmd === "--analyze" || subCmd === "-a") {
|
|
161
|
+
run("pattern_analyzer.js", ARGS.slice(2), AUTO_LEARN_DIR);
|
|
162
|
+
} else if (subCmd === "--check" || subCmd === "-c") {
|
|
163
|
+
run("pre_execution_check.js", ARGS.slice(2), AUTO_LEARN_DIR);
|
|
164
|
+
} else if (subCmd === "--adapt") {
|
|
165
|
+
run("adaptive_engine.js", ARGS.slice(2), AUTO_LEARN_DIR);
|
|
166
|
+
} else if (subCmd === "--inject") {
|
|
167
|
+
run("skill_injector.js", ARGS.slice(2), AUTO_LEARN_DIR);
|
|
168
|
+
} else {
|
|
169
|
+
console.log("Usage: agent auto-learn [--scan|--success|--analyze|--check|--adapt|--inject]");
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
|
|
173
|
+
// Meta
|
|
174
|
+
case "--version":
|
|
175
|
+
case "-v":
|
|
176
|
+
console.log(VERSION);
|
|
177
|
+
break;
|
|
178
|
+
case "help":
|
|
179
|
+
case "--help":
|
|
180
|
+
case "-h":
|
|
181
|
+
printHelp();
|
|
182
|
+
break;
|
|
183
|
+
case undefined:
|
|
184
|
+
// No command = show interactive Clack menu
|
|
185
|
+
import("../lib/ui/index.js").then(m => m.showMainMenu()).catch(console.error);
|
|
186
|
+
break;
|
|
187
|
+
default:
|
|
188
|
+
console.log(`❌ Unknown command: ${COMMAND}`);
|
|
189
|
+
console.log(" Run 'agent help' for available commands.\n");
|
|
190
|
+
process.exit(1);
|
|
191
|
+
}
|