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,78 @@
1
+ /**
2
+ * @fileoverview Tests for backup module
3
+ */
4
+
5
+ import { describe, it, expect, beforeEach, afterEach } from "vitest";
6
+ import fs from "fs";
7
+ import path from "path";
8
+ import os from "os";
9
+
10
+ describe("backup", () => {
11
+ const testDir = path.join(os.tmpdir(), "test-backup-" + Date.now());
12
+
13
+ beforeEach(() => {
14
+ fs.mkdirSync(testDir, { recursive: true });
15
+ });
16
+
17
+ afterEach(() => {
18
+ if (fs.existsSync(testDir)) {
19
+ fs.rmSync(testDir, { recursive: true, force: true });
20
+ }
21
+ });
22
+
23
+ describe("backup file format", () => {
24
+ it("creates timestamped filename", () => {
25
+ const timestamp = new Date().toISOString().replace(/[:.]/g, "-");
26
+ const filename = `backup-${timestamp}.yaml`;
27
+
28
+ expect(filename).toMatch(/^backup-\d{4}-\d{2}-\d{2}/);
29
+ });
30
+
31
+ it("backup contains valid YAML", () => {
32
+ const backupContent = `lessons:\n - id: TEST\n pattern: "x"`;
33
+ const backupPath = path.join(testDir, "backup.yaml");
34
+ fs.writeFileSync(backupPath, backupContent);
35
+
36
+ expect(fs.existsSync(backupPath)).toBe(true);
37
+ expect(fs.readFileSync(backupPath, "utf8")).toContain("lessons:");
38
+ });
39
+ });
40
+
41
+ describe("listBackups", () => {
42
+ it("returns empty array when no backups", () => {
43
+ const backupDir = path.join(testDir, "backups");
44
+ fs.mkdirSync(backupDir, { recursive: true });
45
+
46
+ const files = fs.readdirSync(backupDir);
47
+ expect(files).toHaveLength(0);
48
+ });
49
+
50
+ it("lists backup files", () => {
51
+ const backupDir = path.join(testDir, "backups");
52
+ fs.mkdirSync(backupDir, { recursive: true });
53
+ fs.writeFileSync(path.join(backupDir, "backup-2024.yaml"), "test");
54
+
55
+ const files = fs.readdirSync(backupDir);
56
+ expect(files).toHaveLength(1);
57
+ });
58
+ });
59
+
60
+ describe("pruneBackups", () => {
61
+ it("keeps specified number of backups", () => {
62
+ const backupDir = path.join(testDir, "backups");
63
+ fs.mkdirSync(backupDir, { recursive: true });
64
+
65
+ // Create 5 backups
66
+ for (let i = 1; i <= 5; i++) {
67
+ fs.writeFileSync(path.join(backupDir, `backup-${i}.yaml`), "test");
68
+ }
69
+
70
+ // Simulate pruning to keep 2
71
+ const files = fs.readdirSync(backupDir).sort().reverse();
72
+ const toDelete = files.slice(2);
73
+ toDelete.forEach(f => fs.unlinkSync(path.join(backupDir, f)));
74
+
75
+ expect(fs.readdirSync(backupDir)).toHaveLength(2);
76
+ });
77
+ });
78
+ });
@@ -0,0 +1,222 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Master Checklist Runner - Agent Skill Kit
4
+ ==========================================
5
+
6
+ Orchestrates all validation scripts in priority order.
7
+ Use this for incremental validation during development.
8
+
9
+ Usage:
10
+ python scripts/checklist.py . # Run core checks
11
+ python scripts/checklist.py . --url <URL> # Include performance checks
12
+
13
+ Priority Order:
14
+ P0: Security Scan (vulnerabilities, secrets)
15
+ P1: Lint & Type Check (code quality)
16
+ P2: Schema Validation (if database exists)
17
+ P3: Test Runner (unit/integration tests)
18
+ P4: UX Audit (psychology laws, accessibility)
19
+ P5: SEO Check (meta tags, structure)
20
+ P6: Performance (lighthouse - requires URL)
21
+ """
22
+
23
+ import sys
24
+ import subprocess
25
+ import argparse
26
+ from pathlib import Path
27
+ from typing import List, Tuple, Optional
28
+
29
+ # ANSI colors for terminal output
30
+ class Colors:
31
+ HEADER = '\033[95m'
32
+ BLUE = '\033[94m'
33
+ CYAN = '\033[96m'
34
+ GREEN = '\033[92m'
35
+ YELLOW = '\033[93m'
36
+ RED = '\033[91m'
37
+ ENDC = '\033[0m'
38
+ BOLD = '\033[1m'
39
+
40
+ def print_header(text: str):
41
+ print(f"\n{Colors.BOLD}{Colors.CYAN}{'='*60}{Colors.ENDC}")
42
+ print(f"{Colors.BOLD}{Colors.CYAN}{text.center(60)}{Colors.ENDC}")
43
+ print(f"{Colors.BOLD}{Colors.CYAN}{'='*60}{Colors.ENDC}\n")
44
+
45
+ def print_step(text: str):
46
+ print(f"{Colors.BOLD}{Colors.BLUE}🔄 {text}{Colors.ENDC}")
47
+
48
+ def print_success(text: str):
49
+ print(f"{Colors.GREEN}✅ {text}{Colors.ENDC}")
50
+
51
+ def print_warning(text: str):
52
+ print(f"{Colors.YELLOW}⚠️ {text}{Colors.ENDC}")
53
+
54
+ def print_error(text: str):
55
+ print(f"{Colors.RED}❌ {text}{Colors.ENDC}")
56
+
57
+ # Define priority-ordered checks
58
+ CORE_CHECKS = [
59
+ ("Security Scan", ".agent/skills/vulnerability-scanner/scripts/security_scan.py", True),
60
+ ("Smart Audit", ".agent/scripts/audit.js", True),
61
+ ("Lint Check", ".agent/skills/lint-and-validate/scripts/lint_runner.py", True),
62
+ ("Schema Validation", ".agent/skills/database-design/scripts/schema_validator.py", False),
63
+ ("Test Runner", ".agent/skills/testing-patterns/scripts/test_runner.py", False),
64
+ ("UX Audit", ".agent/skills/frontend-design/scripts/ux_audit.py", False),
65
+ ("SEO Check", ".agent/skills/seo-fundamentals/scripts/seo_checker.py", False),
66
+ ]
67
+
68
+ PERFORMANCE_CHECKS = [
69
+ ("Lighthouse Audit", ".agent/skills/performance-profiling/scripts/lighthouse_audit.py", True),
70
+ ("Playwright E2E", ".agent/skills/webapp-testing/scripts/playwright_runner.py", False),
71
+ ]
72
+
73
+ def check_script_exists(script_path: Path) -> bool:
74
+ """Check if script file exists"""
75
+ return script_path.exists() and script_path.is_file()
76
+
77
+ def run_script(name: str, script_path: Path, project_path: str, url: Optional[str] = None) -> dict:
78
+ """
79
+ Run a validation script and capture results
80
+
81
+ Returns:
82
+ dict with keys: name, passed, output, skipped
83
+ """
84
+ if not check_script_exists(script_path):
85
+ print_warning(f"{name}: Script not found, skipping")
86
+ return {"name": name, "passed": True, "output": "", "skipped": True}
87
+
88
+ print_step(f"Running: {name}")
89
+
90
+ # Build command
91
+ if str(script_path).endswith('.js'):
92
+ cmd = ["node", str(script_path), project_path]
93
+ else:
94
+ cmd = ["python", str(script_path), project_path]
95
+
96
+ if url and ("lighthouse" in script_path.name.lower() or "playwright" in script_path.name.lower()):
97
+ cmd.append(url)
98
+
99
+ # Run script
100
+ try:
101
+ result = subprocess.run(
102
+ cmd,
103
+ capture_output=True,
104
+ text=True,
105
+ timeout=300 # 5 minute timeout
106
+ )
107
+
108
+ passed = result.returncode == 0
109
+
110
+ if passed:
111
+ print_success(f"{name}: PASSED")
112
+ else:
113
+ print_error(f"{name}: FAILED")
114
+ if result.stderr:
115
+ print(f" Error: {result.stderr[:200]}")
116
+
117
+ return {
118
+ "name": name,
119
+ "passed": passed,
120
+ "output": result.stdout,
121
+ "error": result.stderr,
122
+ "skipped": False
123
+ }
124
+
125
+ except subprocess.TimeoutExpired:
126
+ print_error(f"{name}: TIMEOUT (>5 minutes)")
127
+ return {"name": name, "passed": False, "output": "", "error": "Timeout", "skipped": False}
128
+
129
+ except Exception as e:
130
+ print_error(f"{name}: ERROR - {str(e)}")
131
+ return {"name": name, "passed": False, "output": "", "error": str(e), "skipped": False}
132
+
133
+ def print_summary(results: List[dict]):
134
+ """Print final summary report"""
135
+ print_header("📊 CHECKLIST SUMMARY")
136
+
137
+ passed_count = sum(1 for r in results if r["passed"] and not r.get("skipped"))
138
+ failed_count = sum(1 for r in results if not r["passed"] and not r.get("skipped"))
139
+ skipped_count = sum(1 for r in results if r.get("skipped"))
140
+
141
+ print(f"Total Checks: {len(results)}")
142
+ print(f"{Colors.GREEN}✅ Passed: {passed_count}{Colors.ENDC}")
143
+ print(f"{Colors.RED}❌ Failed: {failed_count}{Colors.ENDC}")
144
+ print(f"{Colors.YELLOW}⏭️ Skipped: {skipped_count}{Colors.ENDC}")
145
+ print()
146
+
147
+ # Detailed results
148
+ for r in results:
149
+ if r.get("skipped"):
150
+ status = f"{Colors.YELLOW}⏭️ {Colors.ENDC}"
151
+ elif r["passed"]:
152
+ status = f"{Colors.GREEN}✅{Colors.ENDC}"
153
+ else:
154
+ status = f"{Colors.RED}❌{Colors.ENDC}"
155
+
156
+ print(f"{status} {r['name']}")
157
+
158
+ print()
159
+
160
+ if failed_count > 0:
161
+ print_error(f"{failed_count} check(s) FAILED - Please fix before proceeding")
162
+ return False
163
+ else:
164
+ print_success("All checks PASSED ✨")
165
+ return True
166
+
167
+ def main():
168
+ parser = argparse.ArgumentParser(
169
+ description="Run Agent Skill Kit validation checklist",
170
+ formatter_class=argparse.RawDescriptionHelpFormatter,
171
+ epilog="""
172
+ Examples:
173
+ python scripts/checklist.py . # Core checks only
174
+ python scripts/checklist.py . --url http://localhost:3000 # Include performance
175
+ """
176
+ )
177
+ parser.add_argument("project", help="Project path to validate")
178
+ parser.add_argument("--url", help="URL for performance checks (lighthouse, playwright)")
179
+ parser.add_argument("--skip-performance", action="store_true", help="Skip performance checks even if URL provided")
180
+
181
+ args = parser.parse_args()
182
+
183
+ project_path = Path(args.project).resolve()
184
+
185
+ if not project_path.exists():
186
+ print_error(f"Project path does not exist: {project_path}")
187
+ sys.exit(1)
188
+
189
+ print_header("🚀 AGENT SKILLS KIT - MASTER CHECKLIST")
190
+ print(f"Project: {project_path}")
191
+ print(f"URL: {args.url if args.url else 'Not provided (performance checks skipped)'}")
192
+
193
+ results = []
194
+
195
+ # Run core checks
196
+ print_header("📋 CORE CHECKS")
197
+ for name, script_path, required in CORE_CHECKS:
198
+ script = project_path / script_path
199
+ result = run_script(name, script, str(project_path))
200
+ results.append(result)
201
+
202
+ # If required check fails, stop
203
+ if required and not result["passed"] and not result.get("skipped"):
204
+ print_error(f"CRITICAL: {name} failed. Stopping checklist.")
205
+ print_summary(results)
206
+ sys.exit(1)
207
+
208
+ # Run performance checks if URL provided
209
+ if args.url and not args.skip_performance:
210
+ print_header("⚡ PERFORMANCE CHECKS")
211
+ for name, script_path, required in PERFORMANCE_CHECKS:
212
+ script = project_path / script_path
213
+ result = run_script(name, script, str(project_path), args.url)
214
+ results.append(result)
215
+
216
+ # Print summary
217
+ all_passed = print_summary(results)
218
+
219
+ sys.exit(0 if all_passed else 1)
220
+
221
+ if __name__ == "__main__":
222
+ main()