pikakit 3.0.4 → 3.7.1

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 (94) hide show
  1. package/README.md +1 -1
  2. package/bin/lib/commands/install.js +97 -242
  3. package/package.json +2 -3
  4. package/lib/agent-cli/bin/agent.js +0 -187
  5. package/lib/agent-cli/dashboard/dashboard_server.js +0 -312
  6. package/lib/agent-cli/lib/audit.js +0 -154
  7. package/lib/agent-cli/lib/audit.test.js +0 -100
  8. package/lib/agent-cli/lib/auto-learn.js +0 -319
  9. package/lib/agent-cli/lib/backup.js +0 -138
  10. package/lib/agent-cli/lib/backup.test.js +0 -78
  11. package/lib/agent-cli/lib/cognitive-lesson.js +0 -476
  12. package/lib/agent-cli/lib/completion.js +0 -149
  13. package/lib/agent-cli/lib/config.js +0 -35
  14. package/lib/agent-cli/lib/eslint-fix.js +0 -238
  15. package/lib/agent-cli/lib/evolution-signal.js +0 -215
  16. package/lib/agent-cli/lib/export.js +0 -86
  17. package/lib/agent-cli/lib/export.test.js +0 -65
  18. package/lib/agent-cli/lib/fix.js +0 -337
  19. package/lib/agent-cli/lib/fix.test.js +0 -80
  20. package/lib/agent-cli/lib/gemini-export.js +0 -83
  21. package/lib/agent-cli/lib/generate-registry.js +0 -42
  22. package/lib/agent-cli/lib/hooks/install-hooks.js +0 -152
  23. package/lib/agent-cli/lib/hooks/lint-learn.js +0 -172
  24. package/lib/agent-cli/lib/icons.js +0 -93
  25. package/lib/agent-cli/lib/ignore.js +0 -116
  26. package/lib/agent-cli/lib/ignore.test.js +0 -58
  27. package/lib/agent-cli/lib/init.js +0 -124
  28. package/lib/agent-cli/lib/knowledge-index.js +0 -326
  29. package/lib/agent-cli/lib/knowledge-metrics.js +0 -335
  30. package/lib/agent-cli/lib/knowledge-retention.js +0 -398
  31. package/lib/agent-cli/lib/knowledge-validator.js +0 -312
  32. package/lib/agent-cli/lib/learn.js +0 -255
  33. package/lib/agent-cli/lib/learn.test.js +0 -70
  34. package/lib/agent-cli/lib/proposals.js +0 -199
  35. package/lib/agent-cli/lib/proposals.test.js +0 -56
  36. package/lib/agent-cli/lib/recall.js +0 -835
  37. package/lib/agent-cli/lib/recall.test.js +0 -107
  38. package/lib/agent-cli/lib/selfevolution-bridge.js +0 -167
  39. package/lib/agent-cli/lib/settings.js +0 -203
  40. package/lib/agent-cli/lib/skill-learn.js +0 -296
  41. package/lib/agent-cli/lib/stats.js +0 -132
  42. package/lib/agent-cli/lib/stats.test.js +0 -94
  43. package/lib/agent-cli/lib/types.js +0 -33
  44. package/lib/agent-cli/lib/ui/audit-ui.js +0 -146
  45. package/lib/agent-cli/lib/ui/backup-ui.js +0 -107
  46. package/lib/agent-cli/lib/ui/clack-helpers.js +0 -317
  47. package/lib/agent-cli/lib/ui/common.js +0 -83
  48. package/lib/agent-cli/lib/ui/completion-ui.js +0 -126
  49. package/lib/agent-cli/lib/ui/custom-select.js +0 -69
  50. package/lib/agent-cli/lib/ui/dashboard-ui.js +0 -222
  51. package/lib/agent-cli/lib/ui/evolution-signals-ui.js +0 -107
  52. package/lib/agent-cli/lib/ui/export-ui.js +0 -94
  53. package/lib/agent-cli/lib/ui/fix-all-ui.js +0 -191
  54. package/lib/agent-cli/lib/ui/help-ui.js +0 -49
  55. package/lib/agent-cli/lib/ui/index.js +0 -199
  56. package/lib/agent-cli/lib/ui/init-ui.js +0 -56
  57. package/lib/agent-cli/lib/ui/knowledge-ui.js +0 -55
  58. package/lib/agent-cli/lib/ui/learn-ui.js +0 -706
  59. package/lib/agent-cli/lib/ui/lessons-ui.js +0 -148
  60. package/lib/agent-cli/lib/ui/pretty.js +0 -145
  61. package/lib/agent-cli/lib/ui/proposals-ui.js +0 -99
  62. package/lib/agent-cli/lib/ui/recall-ui.js +0 -342
  63. package/lib/agent-cli/lib/ui/routing-demo.js +0 -79
  64. package/lib/agent-cli/lib/ui/routing-ui.js +0 -325
  65. package/lib/agent-cli/lib/ui/settings-ui.js +0 -381
  66. package/lib/agent-cli/lib/ui/stats-ui.js +0 -123
  67. package/lib/agent-cli/lib/ui/watch-ui.js +0 -236
  68. package/lib/agent-cli/lib/watcher.js +0 -181
  69. package/lib/agent-cli/lib/watcher.test.js +0 -85
  70. package/lib/agent-cli/src/MIGRATION.md +0 -418
  71. package/lib/agent-cli/src/README.md +0 -367
  72. package/lib/agent-cli/src/core/evolution/evolution-signal.js +0 -42
  73. package/lib/agent-cli/src/core/evolution/index.js +0 -17
  74. package/lib/agent-cli/src/core/evolution/review-gate.js +0 -40
  75. package/lib/agent-cli/src/core/evolution/signal-detector.js +0 -137
  76. package/lib/agent-cli/src/core/evolution/signal-queue.js +0 -79
  77. package/lib/agent-cli/src/core/evolution/threshold-checker.js +0 -79
  78. package/lib/agent-cli/src/core/index.js +0 -15
  79. package/lib/agent-cli/src/core/learning/cognitive-enhancer.js +0 -282
  80. package/lib/agent-cli/src/core/learning/index.js +0 -12
  81. package/lib/agent-cli/src/core/learning/lesson-synthesizer.js +0 -83
  82. package/lib/agent-cli/src/core/scanning/index.js +0 -14
  83. package/lib/agent-cli/src/data/index.js +0 -13
  84. package/lib/agent-cli/src/data/repositories/index.js +0 -8
  85. package/lib/agent-cli/src/data/repositories/lesson-repository.js +0 -130
  86. package/lib/agent-cli/src/data/repositories/signal-repository.js +0 -119
  87. package/lib/agent-cli/src/data/storage/index.js +0 -8
  88. package/lib/agent-cli/src/data/storage/json-storage.js +0 -64
  89. package/lib/agent-cli/src/data/storage/yaml-storage.js +0 -66
  90. package/lib/agent-cli/src/infrastructure/index.js +0 -13
  91. package/lib/agent-cli/src/presentation/formatters/skill-formatter.js +0 -232
  92. package/lib/agent-cli/src/services/export-service.js +0 -162
  93. package/lib/agent-cli/src/services/index.js +0 -13
  94. package/lib/agent-cli/src/services/learning-service.js +0 -99
@@ -1,342 +0,0 @@
1
- /**
2
- * Recall UI - Scan files for violations
3
- */
4
- import {
5
- showIntro,
6
- textInput,
7
- createSpinner,
8
- showSuccessNote,
9
- showErrorNote,
10
- theme,
11
- } from "./clack-helpers.js";
12
- import { scanDirectory, loadKnowledge, saveKnowledge, scanDirectoryStructured, saveScanResult } from "../recall.js";
13
- import * as p from "@clack/prompts";
14
- import fs from "fs";
15
- import path from "path";
16
-
17
- // ============================================================================
18
- // GOVERNANCE CHECK
19
- // ============================================================================
20
-
21
- /**
22
- * Check if governance files exist
23
- * @param {string} projectRoot
24
- * @returns {{ passed: boolean, details: string[] }}
25
- */
26
- function checkGovernance(projectRoot) {
27
- const details = [];
28
- let passed = true;
29
-
30
- const governanceFiles = [
31
- { path: path.join(projectRoot, ".agent", "GEMINI.md"), name: "GEMINI.md" },
32
- { path: path.join(projectRoot, ".agent", "ARCHITECTURE.md"), name: "ARCHITECTURE.md" }
33
- ];
34
-
35
- governanceFiles.forEach(file => {
36
- if (fs.existsSync(file.path)) {
37
- details.push(`✓ ${file.name} found`);
38
- } else {
39
- details.push(`⚠ ${file.name} not found (optional)`);
40
- }
41
- });
42
-
43
- // Check for skills
44
- const skillsDir = path.join(projectRoot, ".agent", "skills");
45
- if (fs.existsSync(skillsDir)) {
46
- try {
47
- const skills = fs.readdirSync(skillsDir).filter(f =>
48
- fs.statSync(path.join(skillsDir, f)).isDirectory()
49
- );
50
- details.push(`✓ ${skills.length} skill(s) loaded`);
51
- } catch (e) {
52
- details.push(`○ Skills directory not accessible`);
53
- }
54
- }
55
-
56
- return { passed, details };
57
- }
58
-
59
- // ============================================================================
60
- // RECALL UI
61
- // ============================================================================
62
-
63
- /**
64
- * Show detailed violation breakdown after scan
65
- */
66
- async function showViolationDetails(scanResult) {
67
- console.log(`\n${'─'.repeat(60)}`);
68
- console.log(`${theme.primary('📋 Violation Details')}`);
69
- console.log(`${'─'.repeat(60)}\n`);
70
-
71
- // Group by severity
72
- const errors = scanResult.issues.filter(i => i.severity === 'ERROR');
73
- const warnings = scanResult.issues.filter(i => i.severity === 'WARNING');
74
-
75
- // Show summary
76
- console.log(theme.bold('Summary:'));
77
- console.log(` ${theme.error('✗')} ${errors.length} errors`);
78
- console.log(` ${theme.warning('⚠')} ${warnings.length} warnings`);
79
- console.log(` Total: ${scanResult.totalIssues} violations\n`);
80
-
81
- // Group by file
82
- const byFile = {};
83
- scanResult.issues.forEach(issue => {
84
- const file = path.relative(process.cwd(), issue.file);
85
- if (!byFile[file]) byFile[file] = [];
86
- byFile[file].push(issue);
87
- });
88
-
89
- const fileList = Object.entries(byFile).sort((a, b) => b[1].length - a[1].length);
90
-
91
- console.log(theme.bold('Top Files with Issues:'));
92
- fileList.slice(0, 10).forEach(([file, issues], i) => {
93
- const errorCount = issues.filter(i => i.severity === 'ERROR').length;
94
- const warnCount = issues.filter(i => i.severity === 'WARNING').length;
95
- console.log(` ${i + 1}. ${theme.primary(file)}`);
96
- console.log(` ${theme.error(`${errorCount} errors`)} • ${theme.warning(`${warnCount} warnings`)}`);
97
- });
98
-
99
- if (fileList.length > 10) {
100
- console.log(theme.dim(`\n ... and ${fileList.length - 10} more files`));
101
- }
102
-
103
- console.log(`\n${'─'.repeat(60)}\n`);
104
-
105
- // Wait for user
106
- await p.select({
107
- message: "What's next?",
108
- options: [
109
- { value: "back", label: "← Back to Main Menu" }
110
- ]
111
- });
112
- }
113
-
114
-
115
- export async function runRecallUI(autoScan = false) {
116
- showIntro("🔍 Recall - Scan Violations");
117
-
118
- let targetPath;
119
-
120
- // Scan All mode - skip directory selection
121
- if (autoScan) {
122
- targetPath = ".";
123
-
124
- const spinner = createSpinner('Scanning entire project...');
125
-
126
- try {
127
- const db = loadKnowledge();
128
-
129
- if (!db.lessons || db.lessons.length === 0) {
130
- spinner.stop("No patterns");
131
- showErrorNote("No lessons learned yet. Use the Learn command first.", "No Patterns");
132
- return;
133
- }
134
-
135
- // Use structured scan
136
- const scanResult = scanDirectoryStructured(targetPath, db);
137
-
138
- // Save to disk
139
- saveScanResult(scanResult);
140
-
141
- // Update hit counts
142
- saveKnowledge(db);
143
-
144
- spinner.stopSuccess("Scan complete");
145
-
146
- // Display summary
147
- if (scanResult.totalIssues === 0) {
148
- showSuccessNote(
149
- `Scanned ${theme.primary(scanResult.summary.filesScanned)} files\nNo violations found! 🎉`,
150
- "✓ All Clear"
151
- );
152
- } else {
153
- console.log('');
154
- showErrorNote(
155
- `${theme.error(scanResult.totalIssues)} violations found\n` +
156
- `${theme.error(`${scanResult.summary.errors} errors`)} • ${theme.warning(`${scanResult.summary.warnings} warnings`)}`,
157
- `✗ Scan Results`
158
- );
159
-
160
- p.note(
161
- `Scan ID: ${theme.primary(scanResult.scanId)}\n\n` +
162
- `Results saved to: .agent/scans/${scanResult.scanId}.json`,
163
- '📋 Scan Complete'
164
- );
165
-
166
- // Offer to fix violations immediately
167
- const fixAction = await p.select({
168
- message: `Found ${scanResult.totalIssues} violation(s). What would you like to do?`,
169
- options: [
170
- { value: "fix", label: "🔧 Fix All", hint: "Auto-fix violations now" },
171
- { value: "skip", label: "← Skip", hint: "Return to menu" }
172
- ]
173
- });
174
-
175
- if (!p.isCancel(fixAction) && fixAction === "fix") {
176
- // Import and run Fix All with current scan ID
177
- const { runFixAllUI } = await import('./fix-all-ui.js');
178
- await runFixAllUI(scanResult.scanId);
179
- }
180
- }
181
-
182
- } catch (error) {
183
- spinner.stopError("Scan failed");
184
- showErrorNote(error.message, "✗ Error");
185
- }
186
-
187
- return;
188
- }
189
-
190
- // Get file/directory path via select menu
191
- const pathChoice = await p.select({
192
- message: "Select directory to scan:",
193
- options: [
194
- { value: ".", label: "Current Directory", hint: "Scan entire project" },
195
- { value: "packages", label: "packages/", hint: "All monorepo packages" },
196
- { value: "packages/agent", label: "packages/agent/", hint: "CLI package only" },
197
- { value: "packages/agent/lib", label: "packages/agent/lib/", hint: "Library code" },
198
- { value: ".agent", label: ".agent/", hint: "Agent configuration" },
199
- { value: "custom", label: "Custom Path", hint: "Enter manually" }
200
- ]
201
- });
202
-
203
- if (p.isCancel(pathChoice)) {
204
- p.cancel("Cancelled");
205
- return;
206
- }
207
-
208
- targetPath = pathChoice;
209
-
210
- // If custom path, ask for input
211
- if (pathChoice === "custom") {
212
- targetPath = await textInput({
213
- message: "Enter custom path:",
214
- placeholder: "e.g., src/components",
215
- validate: (value) => {
216
- if (!value) return "Please enter a path";
217
- },
218
- });
219
-
220
- if (p.isCancel(targetPath)) {
221
- p.cancel("Cancelled");
222
- return;
223
- }
224
- }
225
-
226
- // Run scan
227
- const spinner = createSpinner(`Scanning ${targetPath}...`);
228
-
229
- try {
230
- const db = loadKnowledge();
231
-
232
- if (!db.lessons || db.lessons.length === 0) {
233
- spinner.stop("No patterns");
234
- showErrorNote("No lessons learned yet. Use the Learn command first.", "No Patterns");
235
- return;
236
- }
237
-
238
- const resolvedPath = path.resolve(targetPath);
239
- const { results } = scanDirectory(resolvedPath, db);
240
- spinner.stopSuccess("Scan complete");
241
-
242
- // Calculate stats
243
- let totalViolations = 0;
244
- let errorCount = 0;
245
- let warningCount = 0;
246
- const violationsByFile = [];
247
-
248
- results.forEach(result => {
249
- if (result.violations.length === 0) return;
250
-
251
- result.violations.forEach(({ lesson, matches }) => {
252
- totalViolations += matches.length;
253
- if (lesson.severity === "ERROR") {
254
- errorCount += matches.length;
255
- } else {
256
- warningCount += matches.length;
257
- }
258
- });
259
-
260
- violationsByFile.push(result);
261
- });
262
-
263
- // Display results
264
- if (totalViolations === 0) {
265
- showSuccessNote(
266
- `Scanned ${theme.primary(results.length)} files\nNo violations found! 🎉`,
267
- "✓ All Clear"
268
- );
269
- } else {
270
- // Simple summary
271
- console.log('');
272
- showErrorNote(
273
- `${theme.error(totalViolations)} violations found\n` +
274
- `${theme.error(`${errorCount} errors`)} • ${theme.warning(`${warningCount} warnings`)} across ${violationsByFile.length} files`,
275
- `✗ Scan Results`
276
- );
277
-
278
- // Show top 3 critical issues only
279
- const topIssues = [];
280
- violationsByFile.slice(0, 3).forEach(result => {
281
- const fileName = path.relative(process.cwd(), result.file);
282
- result.violations.forEach(({ lesson, matches }) => {
283
- if (lesson.severity === "ERROR" || topIssues.length < 3) {
284
- topIssues.push({
285
- file: fileName,
286
- message: lesson.message,
287
- line: matches[0].line,
288
- severity: lesson.severity
289
- });
290
- }
291
- });
292
- });
293
-
294
- // Display top issues
295
- if (topIssues.length > 0) {
296
- console.log(theme.dim('\nTop Issues:\n'));
297
- topIssues.slice(0, 3).forEach((issue, i) => {
298
- const icon = issue.severity === "ERROR" ? theme.error('✗') : theme.warning('⚠');
299
- console.log(`${i + 1}. ${icon} ${theme.primary(issue.file)}:${issue.line}`);
300
- console.log(` ${theme.dim(issue.message)}\n`);
301
- });
302
-
303
- if (violationsByFile.length > 3) {
304
- console.log(theme.dim(`... and ${violationsByFile.length - 3} more files with issues\n`));
305
- }
306
- }
307
-
308
- // Ask if user wants to auto-fix violations
309
- const fixAction = await p.select({
310
- message: `Found ${totalViolations} violation(s). What would you like to do?`,
311
- options: [
312
- { value: "fix", label: "🔧 Fix All", hint: "Auto-fix violations now" },
313
- { value: "skip", label: "← Skip", hint: "Return to menu" }
314
- ]
315
- });
316
-
317
- if (!p.isCancel(fixAction) && fixAction === "fix") {
318
- // Import and run Fix All
319
- const { runFixAllUI } = await import('./fix-all-ui.js');
320
- await runFixAllUI();
321
- }
322
-
323
- // Save updated hit counts
324
- saveKnowledge(db);
325
- }
326
-
327
- // Governance Check
328
- const govSpinner = createSpinner("Checking governance...");
329
- const govResult = checkGovernance(resolvedPath);
330
- govSpinner.stopSuccess("Governance checked");
331
-
332
- // Simple governance display
333
- const govStatus = govResult.details.filter(d => d.startsWith('✓')).length;
334
- console.log(`\n${theme.dim('Governance:')} ${govStatus}/${govResult.details.length} checks passed\n`);
335
-
336
- } catch (error) {
337
- spinner.stopError("Scan failed");
338
- showErrorNote(error.message, "✗ Error");
339
- }
340
- }
341
-
342
- export default runRecallUI;
@@ -1,79 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Demo: FAANG-level Agent Routing UI
4
- * Run: node packages/agent/lib/ui/routing-demo.js
5
- */
6
-
7
- import {
8
- showRoutingResult,
9
- showRoutingInline,
10
- showRoutingLog,
11
- showRoutingStep,
12
- analyzeAndShowRouting,
13
- showAgentIntro,
14
- showAgentOutro,
15
- showAgentThinking
16
- } from "./routing-ui.js";
17
- import * as p from "@clack/prompts";
18
- import pc from "picocolors";
19
-
20
- showAgentIntro("Agent Routing Demo");
21
-
22
- // Demo 1: Focused (Single specialist)
23
- p.log.step("1. Focused Mode — Single Specialist");
24
- showRoutingResult({
25
- selectedAgents: ["frontend-specialist"],
26
- domains: ["frontend"],
27
- complexity: "SIMPLE",
28
- reasoning: "Expert matched to your task"
29
- });
30
-
31
- // Demo 2: Collaborative (Multi-specialist)
32
- p.log.step("2. Collaborative Mode — Multi-specialist");
33
- showRoutingResult({
34
- selectedAgents: ["security-auditor", "backend-specialist"],
35
- domains: ["security", "backend"],
36
- complexity: "MODERATE",
37
- reasoning: "Cross-functional team assembled"
38
- });
39
-
40
- // Demo 3: Full Stack (Complete team)
41
- p.log.step("3. Full Stack Mode — Complete Team");
42
- showRoutingResult({
43
- selectedAgents: ["orchestrator", "frontend-specialist", "backend-specialist", "database-architect"],
44
- domains: ["frontend", "backend", "database"],
45
- complexity: "COMPLEX",
46
- reasoning: "Enterprise-grade orchestration"
47
- });
48
-
49
- // Demo 4: Inline engagement
50
- p.log.step("4. Inline Engagement");
51
- showRoutingInline(["orchestrator", "code-archaeologist"]);
52
- console.log(`${pc.gray("│")} ${pc.dim("Your response continues here...")}`);
53
- console.log("");
54
-
55
- // Demo 5: Log style
56
- p.log.step("5. Log Message Style");
57
- showRoutingLog({
58
- selectedAgents: ["debugger", "test-engineer"],
59
- complexity: "MODERATE"
60
- });
61
-
62
- // Demo 6: Multi-step flow
63
- p.log.step("6. Multi-step Agent Flow");
64
- console.log(`${pc.gray("│")}`);
65
- showRoutingStep("orchestrator", "complete");
66
- showRoutingStep("security-auditor", "active");
67
- showRoutingStep("backend-specialist", "pending");
68
- console.log(`${pc.gray("│")}`);
69
-
70
- // Demo 7: Agent thinking
71
- p.log.step("7. Agent Thinking Indicator");
72
- showAgentThinking("Processing your request");
73
- console.log(`${pc.gray("│")}`);
74
-
75
- // Demo 8: Auto-analysis
76
- p.log.step("8. Auto-analysis from Request");
77
- analyzeAndShowRouting("Implement secure OAuth2 login with React frontend and PostgreSQL database");
78
-
79
- showAgentOutro("Demo complete");