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.
Files changed (126) hide show
  1. package/README.md +1 -1
  2. package/bin/lib/commands/help.js +0 -4
  3. package/bin/lib/commands/install.js +90 -9
  4. package/bin/lib/ui.js +1 -1
  5. package/lib/agent-cli/__tests__/adaptive_engine.test.js +190 -0
  6. package/lib/agent-cli/__tests__/integration/cross_script.test.js +222 -0
  7. package/lib/agent-cli/__tests__/integration/full_cycle.test.js +230 -0
  8. package/lib/agent-cli/__tests__/pattern_analyzer.test.js +173 -0
  9. package/lib/agent-cli/__tests__/pre_execution_check.test.js +167 -0
  10. package/lib/agent-cli/__tests__/skill_injector.test.js +191 -0
  11. package/lib/agent-cli/bin/agent.js +191 -0
  12. package/lib/agent-cli/dashboard/dashboard_server.js +340 -0
  13. package/lib/agent-cli/dashboard/index.html +538 -0
  14. package/lib/agent-cli/lib/audit.js +154 -0
  15. package/lib/agent-cli/lib/audit.test.js +100 -0
  16. package/lib/agent-cli/lib/auto-learn.js +319 -0
  17. package/lib/agent-cli/lib/auto_preview.py +148 -0
  18. package/lib/agent-cli/lib/backup.js +138 -0
  19. package/lib/agent-cli/lib/backup.test.js +78 -0
  20. package/lib/agent-cli/lib/checklist.py +222 -0
  21. package/lib/agent-cli/lib/cognitive-lesson.js +476 -0
  22. package/lib/agent-cli/lib/completion.js +149 -0
  23. package/lib/agent-cli/lib/config.js +35 -0
  24. package/lib/agent-cli/lib/eslint-fix.js +238 -0
  25. package/lib/agent-cli/lib/evolution-signal.js +215 -0
  26. package/lib/agent-cli/lib/export.js +86 -0
  27. package/lib/agent-cli/lib/export.test.js +65 -0
  28. package/lib/agent-cli/lib/fix.js +337 -0
  29. package/lib/agent-cli/lib/fix.test.js +80 -0
  30. package/lib/agent-cli/lib/gemini-export.js +83 -0
  31. package/lib/agent-cli/lib/generate-registry.js +42 -0
  32. package/lib/agent-cli/lib/hooks/install-hooks.js +152 -0
  33. package/lib/agent-cli/lib/hooks/lint-learn.js +172 -0
  34. package/lib/agent-cli/lib/ignore.js +116 -0
  35. package/lib/agent-cli/lib/ignore.test.js +58 -0
  36. package/lib/agent-cli/lib/init.js +124 -0
  37. package/lib/agent-cli/lib/learn.js +255 -0
  38. package/lib/agent-cli/lib/learn.test.js +70 -0
  39. package/lib/agent-cli/lib/migrate-to-v4.js +322 -0
  40. package/lib/agent-cli/lib/proposals.js +199 -0
  41. package/lib/agent-cli/lib/proposals.test.js +56 -0
  42. package/lib/agent-cli/lib/recall.js +820 -0
  43. package/lib/agent-cli/lib/recall.test.js +107 -0
  44. package/lib/agent-cli/lib/selfevolution-bridge.js +167 -0
  45. package/lib/agent-cli/lib/session_manager.py +120 -0
  46. package/lib/agent-cli/lib/settings.js +227 -0
  47. package/lib/agent-cli/lib/skill-learn.js +296 -0
  48. package/lib/agent-cli/lib/stats.js +132 -0
  49. package/lib/agent-cli/lib/stats.test.js +94 -0
  50. package/lib/agent-cli/lib/types.js +33 -0
  51. package/lib/agent-cli/lib/ui/audit-ui.js +146 -0
  52. package/lib/agent-cli/lib/ui/backup-ui.js +107 -0
  53. package/lib/agent-cli/lib/ui/clack-helpers.js +317 -0
  54. package/lib/agent-cli/lib/ui/common.js +83 -0
  55. package/lib/agent-cli/lib/ui/completion-ui.js +126 -0
  56. package/lib/agent-cli/lib/ui/custom-select.js +69 -0
  57. package/lib/agent-cli/lib/ui/dashboard-ui.js +222 -0
  58. package/lib/agent-cli/lib/ui/evolution-signals-ui.js +107 -0
  59. package/lib/agent-cli/lib/ui/export-ui.js +94 -0
  60. package/lib/agent-cli/lib/ui/fix-all-ui.js +191 -0
  61. package/lib/agent-cli/lib/ui/help-ui.js +49 -0
  62. package/lib/agent-cli/lib/ui/index.js +199 -0
  63. package/lib/agent-cli/lib/ui/init-ui.js +56 -0
  64. package/lib/agent-cli/lib/ui/knowledge-ui.js +55 -0
  65. package/lib/agent-cli/lib/ui/learn-ui.js +706 -0
  66. package/lib/agent-cli/lib/ui/lessons-ui.js +148 -0
  67. package/lib/agent-cli/lib/ui/pretty.js +145 -0
  68. package/lib/agent-cli/lib/ui/proposals-ui.js +99 -0
  69. package/lib/agent-cli/lib/ui/recall-ui.js +342 -0
  70. package/lib/agent-cli/lib/ui/routing-demo.js +79 -0
  71. package/lib/agent-cli/lib/ui/routing-ui.js +325 -0
  72. package/lib/agent-cli/lib/ui/settings-ui.js +381 -0
  73. package/lib/agent-cli/lib/ui/stats-ui.js +123 -0
  74. package/lib/agent-cli/lib/ui/watch-ui.js +236 -0
  75. package/lib/agent-cli/lib/verify_all.py +327 -0
  76. package/lib/agent-cli/lib/watcher.js +181 -0
  77. package/lib/agent-cli/lib/watcher.test.js +85 -0
  78. package/lib/agent-cli/package.json +51 -0
  79. package/lib/agent-cli/scripts/adaptive_engine.js +381 -0
  80. package/lib/agent-cli/scripts/dashboard_server.js +224 -0
  81. package/lib/agent-cli/scripts/error_sensor.js +565 -0
  82. package/lib/agent-cli/scripts/learn_from_failure.js +225 -0
  83. package/lib/agent-cli/scripts/pattern_analyzer.js +781 -0
  84. package/lib/agent-cli/scripts/pre_execution_check.js +623 -0
  85. package/lib/agent-cli/scripts/rule_sharing.js +374 -0
  86. package/lib/agent-cli/scripts/skill_injector.js +387 -0
  87. package/lib/agent-cli/scripts/success_sensor.js +500 -0
  88. package/lib/agent-cli/scripts/user_correction_sensor.js +426 -0
  89. package/lib/agent-cli/services/auto-learn-service.js +247 -0
  90. package/lib/agent-cli/src/MIGRATION.md +418 -0
  91. package/lib/agent-cli/src/README.md +367 -0
  92. package/lib/agent-cli/src/core/evolution/evolution-signal.js +42 -0
  93. package/lib/agent-cli/src/core/evolution/index.js +17 -0
  94. package/lib/agent-cli/src/core/evolution/review-gate.js +40 -0
  95. package/lib/agent-cli/src/core/evolution/signal-detector.js +137 -0
  96. package/lib/agent-cli/src/core/evolution/signal-queue.js +79 -0
  97. package/lib/agent-cli/src/core/evolution/threshold-checker.js +79 -0
  98. package/lib/agent-cli/src/core/index.js +15 -0
  99. package/lib/agent-cli/src/core/learning/cognitive-enhancer.js +282 -0
  100. package/lib/agent-cli/src/core/learning/index.js +12 -0
  101. package/lib/agent-cli/src/core/learning/lesson-synthesizer.js +83 -0
  102. package/lib/agent-cli/src/core/scanning/index.js +14 -0
  103. package/lib/agent-cli/src/data/index.js +13 -0
  104. package/lib/agent-cli/src/data/repositories/index.js +8 -0
  105. package/lib/agent-cli/src/data/repositories/lesson-repository.js +130 -0
  106. package/lib/agent-cli/src/data/repositories/signal-repository.js +119 -0
  107. package/lib/agent-cli/src/data/storage/index.js +8 -0
  108. package/lib/agent-cli/src/data/storage/json-storage.js +64 -0
  109. package/lib/agent-cli/src/data/storage/yaml-storage.js +66 -0
  110. package/lib/agent-cli/src/infrastructure/index.js +13 -0
  111. package/lib/agent-cli/src/presentation/formatters/skill-formatter.js +232 -0
  112. package/lib/agent-cli/src/services/export-service.js +162 -0
  113. package/lib/agent-cli/src/services/index.js +13 -0
  114. package/lib/agent-cli/src/services/learning-service.js +99 -0
  115. package/lib/agent-cli/types/index.d.ts +343 -0
  116. package/lib/agent-cli/utils/benchmark.js +269 -0
  117. package/lib/agent-cli/utils/logger.js +303 -0
  118. package/lib/agent-cli/utils/ml_patterns.js +300 -0
  119. package/lib/agent-cli/utils/recovery.js +312 -0
  120. package/lib/agent-cli/utils/telemetry.js +290 -0
  121. package/lib/agentskillskit-cli/README.md +21 -0
  122. package/{node_modules/agentskillskit-cli/bin → lib/agentskillskit-cli}/ag-smart.js +15 -15
  123. package/lib/agentskillskit-cli/package.json +51 -0
  124. package/package.json +19 -9
  125. /package/bin/{cli.js → kit.js} +0 -0
  126. /package/{node_modules/agentskillskit-cli → lib/agent-cli}/README.md +0 -0
@@ -0,0 +1,199 @@
1
+ /**
2
+ * Main Menu UI - Interactive CLI interface
3
+ */
4
+ import { showIntro, showActionMenu, theme } from "./clack-helpers.js";
5
+ import { loadSettings } from "../settings.js";
6
+
7
+ import { fileURLToPath } from "url";
8
+ import { dirname, join } from "path";
9
+
10
+ // Import UI modules
11
+ import { runLearnUI } from "./learn-ui.js";
12
+ import { runStatsUI } from "./stats-ui.js";
13
+ import { runRecallUI } from "./recall-ui.js";
14
+ import { runFixAllUI } from "./fix-all-ui.js";
15
+ import { runSettingsUI } from "./settings-ui.js";
16
+ import { runBackupUI } from "./backup-ui.js";
17
+ import { runExportUI } from "./export-ui.js";
18
+ import { runProposalsUI } from "./proposals-ui.js";
19
+ import { runCompletionUI } from "./completion-ui.js";
20
+ import { runInitUI } from "./init-ui.js";
21
+ // Removed: audit-ui and watch-ui (audit redundant with recall, watch kept as CLI-only)
22
+ import { runLessonsUI } from "./lessons-ui.js";
23
+ import { runEvolutionSignalsUI } from "./evolution-signals-ui.js";
24
+ import { runKnowledgeUI } from "./knowledge-ui.js";
25
+ import { runHelpUI } from "./help-ui.js";
26
+ import { runDashboardUI } from "./dashboard-ui.js";
27
+ import routingUI from "./routing-ui.js";
28
+ import * as p from "@clack/prompts";
29
+ import { VERSION } from "../config.js";
30
+ import gradient from 'gradient-string';
31
+
32
+ // ============================================================================
33
+ // ASCII BANNER
34
+ // ============================================================================
35
+
36
+ const AGENT_BANNER = `
37
+ _ _
38
+ / \\ __ _ ___ _ __ | |_
39
+ / _ \\ / _\` |/ _ \\ '_ \\| __|
40
+ / ___ \\ (_| | __/ | | | |_
41
+ /_/ \\_\\__, |\\___|_| |_|\\__|
42
+ |___/
43
+ `;
44
+
45
+ // Custom gradient: white → gray (like PikaKit style)
46
+ const agentGradient = gradient(['#ffffff', '#bbbbbb', '#888888', '#555555']);
47
+
48
+ function showAgentBanner() {
49
+ // Extra clear to remove Clack prompt residuals
50
+ process.stdout.write('\x1B[2J\x1B[0f');
51
+ console.clear();
52
+ console.log(''); // Extra space at top
53
+ const lines = AGENT_BANNER.split('\n').filter(l => l.trim() !== '');
54
+
55
+ // Print all lines except last with gradient
56
+ for (let i = 0; i < lines.length - 1; i++) {
57
+ console.log(agentGradient(lines[i]));
58
+ }
59
+
60
+ // Last line + version (aligned like PikaKit)
61
+ console.log(agentGradient(lines[lines.length - 1]) + theme.dim(` v${VERSION}`));
62
+ console.log(''); // Empty line to break vertical connector
63
+ }
64
+
65
+ // ============================================================================
66
+ // MAIN MENU
67
+ // ============================================================================
68
+
69
+ /**
70
+ * Show main interactive menu
71
+ */
72
+ export async function showMainMenu() {
73
+ while (true) {
74
+ showAgentBanner();
75
+
76
+ // Load settings to check auto-learning status
77
+ const settings = loadSettings();
78
+ const autoLearningEnabled = settings.autoLearn !== false; // Default to true
79
+
80
+ // Build menu options dynamically
81
+ const menuOptions = [
82
+ // ═════════════════════════════════════════════
83
+ // 🔍 SCANNING & ACTIONS
84
+ // ═════════════════════════════════════════════
85
+ { value: "scanall", label: "🔎 Scan All", hint: "Check & fix violations" },
86
+
87
+ // ═════════════════════════════════════════════
88
+ // 📚 LEARNING & KNOWLEDGE
89
+ // ═════════════════════════════════════════════
90
+ ];
91
+
92
+ // Only show Learn if auto-learning is OFF
93
+ if (!autoLearningEnabled) {
94
+ menuOptions.push({ value: "learn", label: "📝 Learn", hint: "Teach new pattern" });
95
+ }
96
+
97
+ menuOptions.push(
98
+ { value: "lessons", label: "📚 Lessons", hint: "View & manage" },
99
+
100
+ // ═════════════════════════════════════════════
101
+ // 📊 ANALYTICS
102
+ // ═════════════════════════════════════════════
103
+ { value: "stats", label: "💡 Insights", hint: "Stats & signals" },
104
+
105
+ // ═════════════════════════════════════════════
106
+ // ⚙️ SETTINGS & MANAGEMENT
107
+ // ═════════════════════════════════════════════
108
+ { value: "settings", label: "⚙️ Settings", hint: "Configure behavior" },
109
+ { value: "backup", label: "💾 Backup", hint: "Data management" },
110
+
111
+ // ═════════════════════════════════════════════
112
+ // 📊 DASHBOARD
113
+ // ═════════════════════════════════════════════
114
+ { value: "dashboard", label: "📊 Dashboard", hint: "Web UI & Help" },
115
+
116
+ { value: "exit", label: "👋 Exit" }
117
+ );
118
+
119
+ const action = await p.select({
120
+ message: "What would you like to do?",
121
+ options: menuOptions
122
+ });
123
+
124
+ if (p.isCancel(action) || action === "exit") {
125
+ p.outro("Goodbye! 👋");
126
+ process.exit(0);
127
+ }
128
+
129
+ // Execute action directly (no submenus)
130
+ switch (action) {
131
+ case "learn":
132
+ await runLearnUI();
133
+ break;
134
+ case "lessons":
135
+ await runLessonsUI();
136
+ break;
137
+ case "scanall":
138
+ await runRecallUI(true); // Auto-scan mode with fix option
139
+ break;
140
+ case "stats":
141
+ await runStatsUI(); // Now includes signals
142
+ break;
143
+ case "settings":
144
+ await runSettingsUI();
145
+ break;
146
+ case "backup":
147
+ await runBackupUI();
148
+ break;
149
+ case "dashboard":
150
+ await runDashboardUI();
151
+ break;
152
+ }
153
+
154
+ // After action completes, loop back to main menu
155
+ }
156
+ }
157
+
158
+ // ============================================================================
159
+ // ROUTING UI
160
+ // ============================================================================
161
+
162
+ async function runRoutingUI() {
163
+ const request = await p.text({
164
+ message: "Enter a request to test agent routing:",
165
+ placeholder: "e.g., Fix the login authentication bug",
166
+ validate: (value) => {
167
+ if (!value || value.trim().length === 0) {
168
+ return "Please enter a request";
169
+ }
170
+ }
171
+ });
172
+
173
+ if (p.isCancel(request)) {
174
+ p.cancel("Cancelled");
175
+ return;
176
+ }
177
+
178
+ // Use routing-ui to analyze and show routing
179
+ routingUI.analyzeAndShowRouting(request);
180
+
181
+ // Wait for user to see result
182
+ await p.text({
183
+ message: "Press Enter to continue...",
184
+ placeholder: "",
185
+ initialValue: ""
186
+ });
187
+ }
188
+
189
+
190
+ // ============================================================================
191
+ // CLI ENTRY
192
+ // ============================================================================
193
+
194
+ // Run if executed directly
195
+ if (process.argv[1].includes("index.js") || process.argv[1].includes("ui")) {
196
+ showMainMenu().catch(console.error);
197
+ }
198
+
199
+ export default showMainMenu;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Init UI - Project initialization wizard
3
+ */
4
+ import * as p from "@clack/prompts";
5
+ import pc from "picocolors";
6
+ import { detectProjectType, initProject, getDefaultIgnorePatterns } from "../init.js";
7
+
8
+ /**
9
+ * Interactive init wizard
10
+ */
11
+ export async function runInitUI() {
12
+ const projectType = detectProjectType();
13
+
14
+ p.intro(`Project Initialization`);
15
+ p.note(`Detected project type: ${pc.cyan(projectType)}`, "Detection");
16
+
17
+ const confirm = await p.confirm({
18
+ message: `Initialize Agent Skill Kit for this ${projectType} project?`
19
+ });
20
+
21
+ if (p.isCancel(confirm) || !confirm) {
22
+ p.cancel("Initialization cancelled.");
23
+ return;
24
+ }
25
+
26
+ const s = p.spinner();
27
+ s.start("Initializing...");
28
+
29
+ try {
30
+ const result = initProject();
31
+ s.stop("Done!");
32
+
33
+ if (result.success) {
34
+ const patterns = getDefaultIgnorePatterns(projectType);
35
+
36
+ p.note(
37
+ `Created files:\n` +
38
+ `• ${pc.cyan(".agent/knowledge/lessons-learned.yaml")}\n` +
39
+ `• ${pc.cyan(".agentignore")} (${patterns.length} patterns)\n\n` +
40
+ `Next steps:\n` +
41
+ `1. Run ${pc.green("agent learn")} to teach patterns\n` +
42
+ `2. Run ${pc.green("agent recall .")} to scan code\n` +
43
+ `3. Add ${pc.yellow("agent-hook")} to pre-commit (optional)`,
44
+ pc.green(result.message)
45
+ );
46
+ } else {
47
+ p.note(result.message, pc.yellow("Skipped"));
48
+ }
49
+
50
+ } catch (e) {
51
+ s.stop("Failed!");
52
+ p.note(`Error: ${e.message}`, pc.red("Error"));
53
+ }
54
+ }
55
+
56
+ export default runInitUI;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Knowledge UI - Unified Lessons + Signals Manager
3
+ */
4
+ import * as p from "@clack/prompts";
5
+ import pc from "picocolors";
6
+ import { runLessonsUI } from "./lessons-ui.js";
7
+ import { runEvolutionSignalsUI } from "./evolution-signals-ui.js";
8
+
9
+ /**
10
+ * Show unified Knowledge management interface
11
+ */
12
+ export async function runKnowledgeUI() {
13
+ // Clear terminal và reset cursor
14
+ process.stdout.write('\x1Bc');
15
+
16
+ p.intro(pc.cyan("📚 Knowledge Manager"));
17
+
18
+ while (true) {
19
+ const action = await p.select({
20
+ message: "What would you like to do?",
21
+ options: [
22
+ {
23
+ value: "lessons",
24
+ label: "📖 Learned Patterns",
25
+ hint: "View & manage lessons"
26
+ },
27
+ {
28
+ value: "signals",
29
+ label: "📡 Pending Review",
30
+ hint: "Evolution signals queue"
31
+ },
32
+ {
33
+ value: "back",
34
+ label: "← Back",
35
+ hint: "Return to main menu"
36
+ }
37
+ ]
38
+ });
39
+
40
+ if (p.isCancel(action) || action === "back") {
41
+ return;
42
+ }
43
+
44
+ switch (action) {
45
+ case "lessons":
46
+ await runLessonsUI();
47
+ break;
48
+ case "signals":
49
+ await runEvolutionSignalsUI();
50
+ break;
51
+ }
52
+ }
53
+ }
54
+
55
+ export default runKnowledgeUI;