pikakit 2.0.0 → 3.0.0

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 (92) hide show
  1. package/README.md +8 -8
  2. package/lib/agent-cli/bin/agent.js +187 -0
  3. package/lib/agent-cli/lib/audit.js +154 -0
  4. package/lib/agent-cli/lib/audit.test.js +100 -0
  5. package/lib/agent-cli/lib/auto-learn.js +319 -0
  6. package/lib/agent-cli/lib/backup.js +138 -0
  7. package/lib/agent-cli/lib/backup.test.js +78 -0
  8. package/lib/agent-cli/lib/cognitive-lesson.js +476 -0
  9. package/lib/agent-cli/lib/completion.js +149 -0
  10. package/lib/agent-cli/lib/config.js +35 -0
  11. package/lib/agent-cli/lib/eslint-fix.js +238 -0
  12. package/lib/agent-cli/lib/evolution-signal.js +215 -0
  13. package/lib/agent-cli/lib/export.js +86 -0
  14. package/lib/agent-cli/lib/export.test.js +65 -0
  15. package/lib/agent-cli/lib/fix.js +337 -0
  16. package/lib/agent-cli/lib/fix.test.js +80 -0
  17. package/lib/agent-cli/lib/gemini-export.js +83 -0
  18. package/lib/agent-cli/lib/generate-registry.js +42 -0
  19. package/lib/agent-cli/lib/hooks/install-hooks.js +152 -0
  20. package/lib/agent-cli/lib/hooks/lint-learn.js +172 -0
  21. package/lib/agent-cli/lib/icons.js +93 -0
  22. package/lib/agent-cli/lib/ignore.js +116 -0
  23. package/lib/agent-cli/lib/ignore.test.js +58 -0
  24. package/lib/agent-cli/lib/init.js +124 -0
  25. package/lib/agent-cli/lib/knowledge-index.js +326 -0
  26. package/lib/agent-cli/lib/knowledge-metrics.js +335 -0
  27. package/lib/agent-cli/lib/knowledge-retention.js +398 -0
  28. package/lib/agent-cli/lib/knowledge-validator.js +312 -0
  29. package/lib/agent-cli/lib/learn.js +255 -0
  30. package/lib/agent-cli/lib/learn.test.js +70 -0
  31. package/lib/agent-cli/lib/proposals.js +199 -0
  32. package/lib/agent-cli/lib/proposals.test.js +56 -0
  33. package/lib/agent-cli/lib/recall.js +826 -0
  34. package/lib/agent-cli/lib/recall.test.js +107 -0
  35. package/lib/agent-cli/lib/selfevolution-bridge.js +167 -0
  36. package/lib/agent-cli/lib/settings.js +203 -0
  37. package/lib/agent-cli/lib/skill-learn.js +296 -0
  38. package/lib/agent-cli/lib/stats.js +132 -0
  39. package/lib/agent-cli/lib/stats.test.js +94 -0
  40. package/lib/agent-cli/lib/types.js +33 -0
  41. package/lib/agent-cli/lib/ui/audit-ui.js +146 -0
  42. package/lib/agent-cli/lib/ui/backup-ui.js +107 -0
  43. package/lib/agent-cli/lib/ui/clack-helpers.js +317 -0
  44. package/lib/agent-cli/lib/ui/common.js +83 -0
  45. package/lib/agent-cli/lib/ui/completion-ui.js +126 -0
  46. package/lib/agent-cli/lib/ui/custom-select.js +69 -0
  47. package/lib/agent-cli/lib/ui/dashboard-ui.js +222 -0
  48. package/lib/agent-cli/lib/ui/evolution-signals-ui.js +107 -0
  49. package/lib/agent-cli/lib/ui/export-ui.js +94 -0
  50. package/lib/agent-cli/lib/ui/fix-all-ui.js +191 -0
  51. package/lib/agent-cli/lib/ui/help-ui.js +49 -0
  52. package/lib/agent-cli/lib/ui/index.js +199 -0
  53. package/lib/agent-cli/lib/ui/init-ui.js +56 -0
  54. package/lib/agent-cli/lib/ui/knowledge-ui.js +55 -0
  55. package/lib/agent-cli/lib/ui/learn-ui.js +706 -0
  56. package/lib/agent-cli/lib/ui/lessons-ui.js +148 -0
  57. package/lib/agent-cli/lib/ui/pretty.js +145 -0
  58. package/lib/agent-cli/lib/ui/proposals-ui.js +99 -0
  59. package/lib/agent-cli/lib/ui/recall-ui.js +342 -0
  60. package/lib/agent-cli/lib/ui/routing-demo.js +79 -0
  61. package/lib/agent-cli/lib/ui/routing-ui.js +325 -0
  62. package/lib/agent-cli/lib/ui/settings-ui.js +381 -0
  63. package/lib/agent-cli/lib/ui/stats-ui.js +123 -0
  64. package/lib/agent-cli/lib/ui/watch-ui.js +236 -0
  65. package/lib/agent-cli/lib/watcher.js +181 -0
  66. package/lib/agent-cli/lib/watcher.test.js +85 -0
  67. package/lib/agent-cli/src/MIGRATION.md +418 -0
  68. package/lib/agent-cli/src/README.md +367 -0
  69. package/lib/agent-cli/src/core/evolution/evolution-signal.js +42 -0
  70. package/lib/agent-cli/src/core/evolution/index.js +17 -0
  71. package/lib/agent-cli/src/core/evolution/review-gate.js +40 -0
  72. package/lib/agent-cli/src/core/evolution/signal-detector.js +137 -0
  73. package/lib/agent-cli/src/core/evolution/signal-queue.js +79 -0
  74. package/lib/agent-cli/src/core/evolution/threshold-checker.js +79 -0
  75. package/lib/agent-cli/src/core/index.js +15 -0
  76. package/lib/agent-cli/src/core/learning/cognitive-enhancer.js +282 -0
  77. package/lib/agent-cli/src/core/learning/index.js +12 -0
  78. package/lib/agent-cli/src/core/learning/lesson-synthesizer.js +83 -0
  79. package/lib/agent-cli/src/core/scanning/index.js +14 -0
  80. package/lib/agent-cli/src/data/index.js +13 -0
  81. package/lib/agent-cli/src/data/repositories/index.js +8 -0
  82. package/lib/agent-cli/src/data/repositories/lesson-repository.js +130 -0
  83. package/lib/agent-cli/src/data/repositories/signal-repository.js +119 -0
  84. package/lib/agent-cli/src/data/storage/index.js +8 -0
  85. package/lib/agent-cli/src/data/storage/json-storage.js +64 -0
  86. package/lib/agent-cli/src/data/storage/yaml-storage.js +66 -0
  87. package/lib/agent-cli/src/infrastructure/index.js +13 -0
  88. package/lib/agent-cli/src/presentation/formatters/skill-formatter.js +232 -0
  89. package/lib/agent-cli/src/services/export-service.js +162 -0
  90. package/lib/agent-cli/src/services/index.js +13 -0
  91. package/lib/agent-cli/src/services/learning-service.js +99 -0
  92. package/package.json +5 -3
@@ -0,0 +1,99 @@
1
+ /**
2
+ * LearningService - Application Service
3
+ *
4
+ * Orchestrates learning workflow:
5
+ * - Load raw data (mistakes, improvements)
6
+ * - Synthesize cognitive lessons
7
+ * - Manage lesson CRUD operations
8
+ */
9
+
10
+ import { LessonSynthesizer } from '../core/learning/lesson-synthesizer.js';
11
+
12
+ export class LearningService {
13
+ constructor(lessonRepository) {
14
+ this.lessonRepository = lessonRepository;
15
+ }
16
+
17
+ /**
18
+ * Get all cognitive lessons
19
+ * @returns {Promise<Array>}
20
+ */
21
+ async getCognitiveLessons() {
22
+ const mistakesDb = await this.lessonRepository.loadMistakes();
23
+ const improvementsDb = await this.lessonRepository.loadImprovements();
24
+
25
+ return LessonSynthesizer.synthesize(
26
+ mistakesDb.mistakes || [],
27
+ improvementsDb.improvements || []
28
+ );
29
+ }
30
+
31
+ /**
32
+ * Add a lesson to legacy format
33
+ * @param {string} pattern - Regex pattern
34
+ * @param {string} message - Explanation message
35
+ * @param {string} severity - WARNING or ERROR
36
+ * @param {string} category - Category tag
37
+ * @returns {Promise<object>}
38
+ */
39
+ async addLesson(pattern, message, severity = 'WARNING', category = 'general') {
40
+ // Validate Regex
41
+ try {
42
+ new RegExp(pattern);
43
+ } catch (e) {
44
+ throw new Error(`Invalid Regex pattern: ${e.message}`);
45
+ }
46
+
47
+ // Validate severity
48
+ if (!['WARNING', 'ERROR'].includes(severity.toUpperCase())) {
49
+ throw new Error('Invalid severity. Must be WARNING or ERROR');
50
+ }
51
+
52
+ // Check for duplicates
53
+ const db = await this.lessonRepository.loadLegacyLessons();
54
+ const exists = db.lessons.some(l => l.pattern === pattern);
55
+
56
+ if (exists) {
57
+ throw new Error('Pattern already exists in knowledge base');
58
+ }
59
+
60
+ const id = `LEARN-${String(db.lessons.length + 1).padStart(3, '0')}`;
61
+
62
+ const lesson = {
63
+ id,
64
+ pattern,
65
+ message,
66
+ severity: severity.toUpperCase(),
67
+ category,
68
+ source: 'manual',
69
+ hitCount: 0,
70
+ lastHit: null,
71
+ autoEscalated: false,
72
+ addedAt: new Date().toISOString()
73
+ };
74
+
75
+ return this.lessonRepository.addLegacyLesson(lesson);
76
+ }
77
+
78
+ /**
79
+ * Remove a lesson
80
+ * @param {string} lessonId
81
+ */
82
+ async removeLesson(lessonId) {
83
+ return this.lessonRepository.removeLegacyLesson(lessonId);
84
+ }
85
+
86
+ /**
87
+ * List all lessons
88
+ * @param {string} category - Optional category filter
89
+ */
90
+ async listLessons(category = null) {
91
+ const db = await this.lessonRepository.loadLegacyLessons();
92
+
93
+ if (category) {
94
+ return db.lessons.filter(l => l.category === category);
95
+ }
96
+
97
+ return db.lessons;
98
+ }
99
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pikakit",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Enterprise-grade Agent Skill Manager with Antigravity Skills support, Progressive Disclosure detection, and semantic routing validation",
5
5
  "license": "MIT",
6
6
  "author": "pikakit <pikakit@gmail.com>",
@@ -15,10 +15,12 @@
15
15
  "type": "module",
16
16
  "bin": {
17
17
  "pikakit": "bin/cli.mjs",
18
- "kit": "bin/kit.js"
18
+ "kit": "bin/kit.js",
19
+ "agent": "lib/agent-cli/bin/agent.js"
19
20
  },
20
21
  "files": [
21
22
  "bin/",
23
+ "lib/",
22
24
  "specs/",
23
25
  "README.md",
24
26
  "LICENSE"
@@ -72,4 +74,4 @@
72
74
  "prettier": "^3.2.5",
73
75
  "vitest": "^4.0.18"
74
76
  }
75
- }
77
+ }