add-skill-kit 3.2.3 → 3.2.4
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/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 +203 -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 +123 -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 +169 -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/agentskillskit-cli/README.md +21 -0
- package/lib/agentskillskit-cli/ag-smart.js +158 -0
- package/lib/agentskillskit-cli/package.json +51 -0
- package/package.json +10 -6
- /package/{node_modules/agentskillskit-cli → lib/agent-cli}/README.md +0 -0
- /package/{node_modules/agentskillskit-cli → lib/agent-cli}/bin/ag-smart.js +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stats UI - Knowledge base statistics display
|
|
3
|
+
*/
|
|
4
|
+
import { ICONS, getKnowledge, line, VERSION } from "./common.js";
|
|
5
|
+
import { showIntro, showInfoNote, showSuccessNote, createSpinner, theme } from "./clack-helpers.js";
|
|
6
|
+
import { signalQueue, getEvolutionStats } from "../evolution-signal.js";
|
|
7
|
+
import * as p from "@clack/prompts";
|
|
8
|
+
import pc from "picocolors";
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// STATS DISPLAY
|
|
12
|
+
// ============================================================================
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Stats UI - Show knowledge base statistics with cognitive insights
|
|
16
|
+
*/
|
|
17
|
+
export async function runStatsUI() {
|
|
18
|
+
// Clear terminal và reset cursor về top-left
|
|
19
|
+
process.stdout.write('\x1Bc'); // Full terminal reset
|
|
20
|
+
|
|
21
|
+
showIntro("📊 Knowledge Base Stats");
|
|
22
|
+
|
|
23
|
+
const spinner = createSpinner("Loading statistics...");
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
const db = getKnowledge();
|
|
27
|
+
const lessons = db.lessons || [];
|
|
28
|
+
|
|
29
|
+
// Calculate statistics with cognitive awareness
|
|
30
|
+
const totalLessons = lessons.length;
|
|
31
|
+
const mistakes = lessons.filter(l => l.type === 'mistake');
|
|
32
|
+
const improvements = lessons.filter(l => l.type === 'improvement');
|
|
33
|
+
|
|
34
|
+
// Cognitive grouping - Intent
|
|
35
|
+
const byIntent = lessons.reduce((acc, l) => {
|
|
36
|
+
const intent = l.intent || 'unknown';
|
|
37
|
+
acc[intent] = (acc[intent] || 0) + 1;
|
|
38
|
+
return acc;
|
|
39
|
+
}, {});
|
|
40
|
+
|
|
41
|
+
// Cognitive grouping - Pattern Type
|
|
42
|
+
const byPatternType = lessons.reduce((acc, l) => {
|
|
43
|
+
const type = l.patternType || 'general';
|
|
44
|
+
acc[type] = (acc[type] || 0) + 1;
|
|
45
|
+
return acc;
|
|
46
|
+
}, {});
|
|
47
|
+
|
|
48
|
+
// Cognitive grouping - Maturity
|
|
49
|
+
const byMaturity = lessons.reduce((acc, l) => {
|
|
50
|
+
const maturity = l.cognitive?.maturity || 'learning';
|
|
51
|
+
acc[maturity] = (acc[maturity] || 0) + 1;
|
|
52
|
+
return acc;
|
|
53
|
+
}, {});
|
|
54
|
+
|
|
55
|
+
// Top 5 by hit count
|
|
56
|
+
const topHits = lessons
|
|
57
|
+
.filter(p => p.hitCount && p.hitCount > 0)
|
|
58
|
+
.sort((a, b) => b.hitCount - a.hitCount)
|
|
59
|
+
.slice(0, 5);
|
|
60
|
+
|
|
61
|
+
spinner.stopSuccess("Stats loaded");
|
|
62
|
+
|
|
63
|
+
// Compact single-line display
|
|
64
|
+
console.log(`\n${pc.bold('📊 Knowledge Stats')} ${pc.dim(`(${totalLessons} lessons)`)}\n`);
|
|
65
|
+
|
|
66
|
+
console.log(
|
|
67
|
+
`${pc.red('●')} ${mistakes.length} Mistakes ` +
|
|
68
|
+
`${pc.green('●')} ${improvements.length} Improvements ` +
|
|
69
|
+
`${pc.dim('│')} ` +
|
|
70
|
+
`${pc.red('🛡️')} ${byIntent.prevent || 0} Prevent ` +
|
|
71
|
+
`${pc.yellow('⚠️')} ${byIntent.warn || 0} Warn ` +
|
|
72
|
+
`${pc.green('⚡')} ${byIntent.optimize || 0} Optimize\n`
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
console.log(
|
|
76
|
+
`${pc.dim('Types:')} ` +
|
|
77
|
+
`${byPatternType.security ? `🔒${byPatternType.security} ` : ''}` +
|
|
78
|
+
`${byPatternType.dependency ? `📦${byPatternType.dependency} ` : ''}` +
|
|
79
|
+
`${byPatternType.structure ? `🏗️${byPatternType.structure} ` : ''}` +
|
|
80
|
+
`${byPatternType.quality ? `✨${byPatternType.quality} ` : ''}` +
|
|
81
|
+
`${byPatternType.performance ? `⚡${byPatternType.performance} ` : ''}` +
|
|
82
|
+
`${byPatternType.general ? pc.dim(`📝${byPatternType.general}`) : ''}\n`
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
console.log(
|
|
86
|
+
`${pc.dim('Maturity:')} ` +
|
|
87
|
+
`${pc.green('✓')} ${byMaturity.stable || 0} Stable ` +
|
|
88
|
+
`${pc.cyan('📚')} ${byMaturity.learning || 0} Learning\n`
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
// Show top 3 hits in compact format
|
|
92
|
+
if (topHits.length > 0) {
|
|
93
|
+
console.log(`${pc.bold('🔥 Top Patterns')}`);
|
|
94
|
+
topHits.slice(0, 3).forEach((p, i) => {
|
|
95
|
+
console.log(` ${i + 1}. ${pc.dim(p.id)} ${pc.bold(p.hitCount)}×`);
|
|
96
|
+
});
|
|
97
|
+
console.log('');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Show signal queue summary
|
|
101
|
+
const signalStats = getEvolutionStats();
|
|
102
|
+
const pending = signalQueue.getPending();
|
|
103
|
+
|
|
104
|
+
console.log(`${pc.bold('📡 Signal Queue')}`);
|
|
105
|
+
console.log(
|
|
106
|
+
` ${pc.yellow('⏳')} ${signalStats.pending} Pending ` +
|
|
107
|
+
`${pc.green('✓')} ${signalStats.approved} Approved ` +
|
|
108
|
+
`${pc.red('✗')} ${signalStats.rejected} Rejected\n`
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
// User can choose next action
|
|
112
|
+
await p.select({
|
|
113
|
+
message: "What's next?",
|
|
114
|
+
options: [
|
|
115
|
+
{ value: "back", label: "← Back to Main Menu" }
|
|
116
|
+
]
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
} catch (error) {
|
|
120
|
+
spinner.stopError("Failed to load stats");
|
|
121
|
+
console.error(error);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Watch UI - Real-Time File Monitoring with Clack UI
|
|
3
|
+
*
|
|
4
|
+
* Watches for file changes and runs recall automatically.
|
|
5
|
+
* Uses @clack/prompts for consistent terminal UI.
|
|
6
|
+
*/
|
|
7
|
+
import * as p from "@clack/prompts";
|
|
8
|
+
import pc from "picocolors";
|
|
9
|
+
import fs from "fs";
|
|
10
|
+
import path from "path";
|
|
11
|
+
import { fileURLToPath } from "url";
|
|
12
|
+
import { dirname } from "path";
|
|
13
|
+
import { scanFile, loadKnowledge, saveKnowledge } from "../recall.js";
|
|
14
|
+
import { VERSION } from "../config.js";
|
|
15
|
+
|
|
16
|
+
// ============================================================================
|
|
17
|
+
// CONFIGURATION
|
|
18
|
+
// ============================================================================
|
|
19
|
+
|
|
20
|
+
const WATCH_EXTENSIONS = [".js", ".ts", ".tsx", ".jsx", ".mjs"];
|
|
21
|
+
const DEBOUNCE_MS = 300;
|
|
22
|
+
const SKIP_DIRS = ["node_modules", ".git", "dist", "build", ".next", "coverage"];
|
|
23
|
+
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// WATCHER CLASS
|
|
26
|
+
// ============================================================================
|
|
27
|
+
|
|
28
|
+
class SmartWatcher {
|
|
29
|
+
constructor(rootDir) {
|
|
30
|
+
this.rootDir = path.resolve(rootDir);
|
|
31
|
+
this.db = loadKnowledge();
|
|
32
|
+
this.debounceTimers = new Map();
|
|
33
|
+
this.watchers = [];
|
|
34
|
+
this.isRunning = false;
|
|
35
|
+
this.sessionStats = {
|
|
36
|
+
filesChecked: 0,
|
|
37
|
+
violationsFound: 0,
|
|
38
|
+
startTime: Date.now()
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Start watching
|
|
44
|
+
*/
|
|
45
|
+
start() {
|
|
46
|
+
this.isRunning = true;
|
|
47
|
+
this.watch(this.rootDir);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Stop watching
|
|
52
|
+
*/
|
|
53
|
+
stop() {
|
|
54
|
+
this.isRunning = false;
|
|
55
|
+
// Close all watchers
|
|
56
|
+
this.watchers.forEach(w => {
|
|
57
|
+
try { w.close(); } catch (e) { }
|
|
58
|
+
});
|
|
59
|
+
this.watchers = [];
|
|
60
|
+
// Clear debounce timers
|
|
61
|
+
this.debounceTimers.forEach(timer => clearTimeout(timer));
|
|
62
|
+
this.debounceTimers.clear();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Recursively watch directories
|
|
67
|
+
*/
|
|
68
|
+
watch(dir) {
|
|
69
|
+
try {
|
|
70
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
71
|
+
|
|
72
|
+
// Watch current directory
|
|
73
|
+
const watcher = fs.watch(dir, { persistent: true }, (eventType, filename) => {
|
|
74
|
+
if (filename && eventType === "change" && this.isRunning) {
|
|
75
|
+
this.handleChange(path.join(dir, filename));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
this.watchers.push(watcher);
|
|
79
|
+
|
|
80
|
+
// Recurse into subdirs
|
|
81
|
+
for (const entry of entries) {
|
|
82
|
+
if (entry.isDirectory() && !SKIP_DIRS.includes(entry.name)) {
|
|
83
|
+
this.watch(path.join(dir, entry.name));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
} catch (error) {
|
|
87
|
+
// Ignore permission errors
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Handle file change with debouncing
|
|
93
|
+
*/
|
|
94
|
+
handleChange(filePath) {
|
|
95
|
+
const ext = path.extname(filePath);
|
|
96
|
+
if (!WATCH_EXTENSIONS.includes(ext)) return;
|
|
97
|
+
if (!fs.existsSync(filePath)) return;
|
|
98
|
+
|
|
99
|
+
// Debounce
|
|
100
|
+
if (this.debounceTimers.has(filePath)) {
|
|
101
|
+
clearTimeout(this.debounceTimers.get(filePath));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
this.debounceTimers.set(filePath, setTimeout(() => {
|
|
105
|
+
const result = this.checkFile(filePath);
|
|
106
|
+
this.debounceTimers.delete(filePath);
|
|
107
|
+
|
|
108
|
+
// Emit event for UI
|
|
109
|
+
if (this.onFileChange) {
|
|
110
|
+
this.onFileChange(result);
|
|
111
|
+
}
|
|
112
|
+
}, DEBOUNCE_MS));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Check a file against memory
|
|
117
|
+
*/
|
|
118
|
+
checkFile(filePath) {
|
|
119
|
+
const relativePath = path.relative(this.rootDir, filePath);
|
|
120
|
+
const result = scanFile(filePath, this.db, true);
|
|
121
|
+
|
|
122
|
+
this.sessionStats.filesChecked++;
|
|
123
|
+
|
|
124
|
+
if (result.violations.length > 0) {
|
|
125
|
+
this.sessionStats.violationsFound += result.violations.reduce((sum, v) => sum + v.matches.length, 0);
|
|
126
|
+
saveKnowledge(this.db);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
path: relativePath,
|
|
131
|
+
violations: result.violations,
|
|
132
|
+
hasViolations: result.violations.length > 0
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Get session summary
|
|
138
|
+
*/
|
|
139
|
+
getSummary() {
|
|
140
|
+
const duration = Math.round((Date.now() - this.sessionStats.startTime) / 1000);
|
|
141
|
+
return {
|
|
142
|
+
duration,
|
|
143
|
+
filesChecked: this.sessionStats.filesChecked,
|
|
144
|
+
violationsFound: this.sessionStats.violationsFound
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ============================================================================
|
|
150
|
+
// WATCH UI
|
|
151
|
+
// ============================================================================
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Run Watch UI with Clack
|
|
155
|
+
* @param {string} targetDir - Directory to watch
|
|
156
|
+
*/
|
|
157
|
+
export async function runWatchUI(targetDir = process.cwd()) {
|
|
158
|
+
const watcher = new SmartWatcher(targetDir);
|
|
159
|
+
|
|
160
|
+
// Show intro
|
|
161
|
+
p.intro(pc.cyan(`Smart Watcher v${VERSION}`));
|
|
162
|
+
|
|
163
|
+
// Show info
|
|
164
|
+
p.note(
|
|
165
|
+
`${pc.dim("Directory:")} ${watcher.rootDir}\n` +
|
|
166
|
+
`${pc.dim("Patterns:")} ${watcher.db.lessons.length} loaded\n` +
|
|
167
|
+
`${pc.dim("Extensions:")} ${WATCH_EXTENSIONS.join(", ")}`,
|
|
168
|
+
"Watch Configuration"
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
// Spinner for starting
|
|
172
|
+
const s = p.spinner();
|
|
173
|
+
s.start("Starting file watcher...");
|
|
174
|
+
|
|
175
|
+
// Start watcher
|
|
176
|
+
watcher.start();
|
|
177
|
+
|
|
178
|
+
s.stop(pc.green("✓") + " Watching for changes");
|
|
179
|
+
|
|
180
|
+
// Setup file change handler
|
|
181
|
+
watcher.onFileChange = (result) => {
|
|
182
|
+
if (result.hasViolations) {
|
|
183
|
+
console.log("");
|
|
184
|
+
p.log.warn(pc.yellow(result.path));
|
|
185
|
+
result.violations.forEach(({ lesson, matches }) => {
|
|
186
|
+
const icon = lesson.severity === "ERROR" ? pc.red("✖") : pc.yellow("⚠");
|
|
187
|
+
console.log(` ${icon} ${pc.dim(`[${lesson.id}]`)} ${lesson.message}`);
|
|
188
|
+
matches.slice(0, 2).forEach(m => {
|
|
189
|
+
console.log(` ${pc.dim(`L${m.line}:`)} ${pc.dim(m.content.substring(0, 60))}`);
|
|
190
|
+
});
|
|
191
|
+
if (matches.length > 2) {
|
|
192
|
+
console.log(` ${pc.dim(`... +${matches.length - 2} more`)}`);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
} else {
|
|
196
|
+
p.log.success(pc.green("✓ ") + pc.dim(result.path));
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
// Wait for user to press Enter or Ctrl+C
|
|
201
|
+
console.log("");
|
|
202
|
+
console.log(pc.dim(" Watching for file changes..."));
|
|
203
|
+
console.log(pc.dim(" Press Enter to stop\n"));
|
|
204
|
+
|
|
205
|
+
// Wait for Enter key
|
|
206
|
+
await new Promise((resolve) => {
|
|
207
|
+
const handler = (data) => {
|
|
208
|
+
if (data.toString().includes("\n") || data.toString().includes("\r")) {
|
|
209
|
+
process.stdin.removeListener("data", handler);
|
|
210
|
+
process.stdin.setRawMode?.(false);
|
|
211
|
+
resolve();
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
process.stdin.setRawMode?.(true);
|
|
216
|
+
process.stdin.resume();
|
|
217
|
+
process.stdin.on("data", handler);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// Stop watcher
|
|
221
|
+
watcher.stop();
|
|
222
|
+
|
|
223
|
+
// Show summary
|
|
224
|
+
const summary = watcher.getSummary();
|
|
225
|
+
|
|
226
|
+
p.note(
|
|
227
|
+
`${pc.dim("Duration:")} ${summary.duration}s\n` +
|
|
228
|
+
`${pc.dim("Files:")} ${summary.filesChecked} checked\n` +
|
|
229
|
+
`${pc.dim("Violations:")} ${summary.violationsFound} found`,
|
|
230
|
+
"Session Summary"
|
|
231
|
+
);
|
|
232
|
+
|
|
233
|
+
p.outro(pc.green("Watch session ended"));
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export default runWatchUI;
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Full Verification Suite - Agent Skill Kit
|
|
4
|
+
==========================================
|
|
5
|
+
|
|
6
|
+
Runs COMPLETE validation including all checks + performance + E2E.
|
|
7
|
+
Use this before deployment or major releases.
|
|
8
|
+
|
|
9
|
+
Usage:
|
|
10
|
+
python scripts/verify_all.py . --url <URL>
|
|
11
|
+
|
|
12
|
+
Includes ALL checks:
|
|
13
|
+
✅ Security Scan (OWASP, secrets, dependencies)
|
|
14
|
+
✅ Lint & Type Coverage
|
|
15
|
+
✅ Schema Validation
|
|
16
|
+
✅ Test Suite (unit + integration)
|
|
17
|
+
✅ UX Audit (psychology, accessibility)
|
|
18
|
+
✅ SEO Check
|
|
19
|
+
✅ Lighthouse (Core Web Vitals)
|
|
20
|
+
✅ Playwright E2E
|
|
21
|
+
✅ Bundle Analysis (if applicable)
|
|
22
|
+
✅ Mobile Audit (if applicable)
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
import sys
|
|
26
|
+
import subprocess
|
|
27
|
+
import argparse
|
|
28
|
+
from pathlib import Path
|
|
29
|
+
from typing import List, Dict, Optional
|
|
30
|
+
from datetime import datetime
|
|
31
|
+
|
|
32
|
+
# ANSI colors
|
|
33
|
+
class Colors:
|
|
34
|
+
HEADER = '\033[95m'
|
|
35
|
+
BLUE = '\033[94m'
|
|
36
|
+
CYAN = '\033[96m'
|
|
37
|
+
GREEN = '\033[92m'
|
|
38
|
+
YELLOW = '\033[93m'
|
|
39
|
+
RED = '\033[91m'
|
|
40
|
+
ENDC = '\033[0m'
|
|
41
|
+
BOLD = '\033[1m'
|
|
42
|
+
|
|
43
|
+
def print_header(text: str):
|
|
44
|
+
print(f"\n{Colors.BOLD}{Colors.CYAN}{'='*70}{Colors.ENDC}")
|
|
45
|
+
print(f"{Colors.BOLD}{Colors.CYAN}{text.center(70)}{Colors.ENDC}")
|
|
46
|
+
print(f"{Colors.BOLD}{Colors.CYAN}{'='*70}{Colors.ENDC}\n")
|
|
47
|
+
|
|
48
|
+
def print_step(text: str):
|
|
49
|
+
print(f"{Colors.BOLD}{Colors.BLUE}🔄 {text}{Colors.ENDC}")
|
|
50
|
+
|
|
51
|
+
def print_success(text: str):
|
|
52
|
+
print(f"{Colors.GREEN}✅ {text}{Colors.ENDC}")
|
|
53
|
+
|
|
54
|
+
def print_warning(text: str):
|
|
55
|
+
print(f"{Colors.YELLOW}⚠️ {text}{Colors.ENDC}")
|
|
56
|
+
|
|
57
|
+
def print_error(text: str):
|
|
58
|
+
print(f"{Colors.RED}❌ {text}{Colors.ENDC}")
|
|
59
|
+
|
|
60
|
+
# Complete verification suite
|
|
61
|
+
VERIFICATION_SUITE = [
|
|
62
|
+
# P0: Security (CRITICAL)
|
|
63
|
+
{
|
|
64
|
+
"category": "Security",
|
|
65
|
+
"checks": [
|
|
66
|
+
("Security Scan", ".agent/skills/vulnerability-scanner/scripts/security_scan.py", True),
|
|
67
|
+
("Dependency Analysis", ".agent/skills/vulnerability-scanner/scripts/dependency_analyzer.py", False),
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
# P1: Code Quality (CRITICAL)
|
|
72
|
+
{
|
|
73
|
+
"category": "Code Quality",
|
|
74
|
+
"checks": [
|
|
75
|
+
("Lint Check", ".agent/skills/lint-and-validate/scripts/lint_runner.py", True),
|
|
76
|
+
("Type Coverage", ".agent/skills/lint-and-validate/scripts/type_coverage.py", False),
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
# P2: Data Layer
|
|
81
|
+
{
|
|
82
|
+
"category": "Data Layer",
|
|
83
|
+
"checks": [
|
|
84
|
+
("Schema Validation", ".agent/skills/database-design/scripts/schema_validator.py", False),
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
|
|
88
|
+
# P3: Testing
|
|
89
|
+
{
|
|
90
|
+
"category": "Testing",
|
|
91
|
+
"checks": [
|
|
92
|
+
("Test Suite", ".agent/skills/testing-patterns/scripts/test_runner.py", False),
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
# P4: UX & Accessibility
|
|
97
|
+
{
|
|
98
|
+
"category": "UX & Accessibility",
|
|
99
|
+
"checks": [
|
|
100
|
+
("UX Audit", ".agent/skills/frontend-design/scripts/ux_audit.py", False),
|
|
101
|
+
("Accessibility Check", ".agent/skills/frontend-design/scripts/accessibility_checker.py", False),
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
# P5: SEO & Content
|
|
106
|
+
{
|
|
107
|
+
"category": "SEO & Content",
|
|
108
|
+
"checks": [
|
|
109
|
+
("SEO Check", ".agent/skills/seo-fundamentals/scripts/seo_checker.py", False),
|
|
110
|
+
("GEO Check", ".agent/skills/geo-fundamentals/scripts/geo_checker.py", False),
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
# P6: Performance (requires URL)
|
|
115
|
+
{
|
|
116
|
+
"category": "Performance",
|
|
117
|
+
"requires_url": True,
|
|
118
|
+
"checks": [
|
|
119
|
+
("Lighthouse Audit", ".agent/skills/performance-profiling/scripts/lighthouse_audit.py", True),
|
|
120
|
+
("Bundle Analysis", ".agent/skills/performance-profiling/scripts/bundle_analyzer.py", False),
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
|
|
124
|
+
# P7: E2E Testing (requires URL)
|
|
125
|
+
{
|
|
126
|
+
"category": "E2E Testing",
|
|
127
|
+
"requires_url": True,
|
|
128
|
+
"checks": [
|
|
129
|
+
("Playwright E2E", ".agent/skills/webapp-testing/scripts/playwright_runner.py", False),
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
|
|
133
|
+
# P8: Mobile (if applicable)
|
|
134
|
+
{
|
|
135
|
+
"category": "Mobile",
|
|
136
|
+
"checks": [
|
|
137
|
+
("Mobile Audit", ".agent/skills/mobile-design/scripts/mobile_audit.py", False),
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
# P9: Internationalization
|
|
142
|
+
{
|
|
143
|
+
"category": "Internationalization",
|
|
144
|
+
"checks": [
|
|
145
|
+
("i18n Check", ".agent/skills/i18n-localization/scripts/i18n_checker.py", False),
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
]
|
|
149
|
+
|
|
150
|
+
def run_script(name: str, script_path: Path, project_path: str, url: Optional[str] = None) -> dict:
|
|
151
|
+
"""Run validation script"""
|
|
152
|
+
if not script_path.exists():
|
|
153
|
+
print_warning(f"{name}: Script not found, skipping")
|
|
154
|
+
return {"name": name, "passed": True, "skipped": True, "duration": 0}
|
|
155
|
+
|
|
156
|
+
print_step(f"Running: {name}")
|
|
157
|
+
start_time = datetime.now()
|
|
158
|
+
|
|
159
|
+
# Build command
|
|
160
|
+
cmd = ["python", str(script_path), project_path]
|
|
161
|
+
if url and ("lighthouse" in script_path.name.lower() or "playwright" in script_path.name.lower()):
|
|
162
|
+
cmd.append(url)
|
|
163
|
+
|
|
164
|
+
# Run
|
|
165
|
+
try:
|
|
166
|
+
result = subprocess.run(
|
|
167
|
+
cmd,
|
|
168
|
+
capture_output=True,
|
|
169
|
+
text=True,
|
|
170
|
+
timeout=600 # 10 minute timeout for slow checks
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
duration = (datetime.now() - start_time).total_seconds()
|
|
174
|
+
passed = result.returncode == 0
|
|
175
|
+
|
|
176
|
+
if passed:
|
|
177
|
+
print_success(f"{name}: PASSED ({duration:.1f}s)")
|
|
178
|
+
else:
|
|
179
|
+
print_error(f"{name}: FAILED ({duration:.1f}s)")
|
|
180
|
+
if result.stderr:
|
|
181
|
+
print(f" {result.stderr[:300]}")
|
|
182
|
+
|
|
183
|
+
return {
|
|
184
|
+
"name": name,
|
|
185
|
+
"passed": passed,
|
|
186
|
+
"output": result.stdout,
|
|
187
|
+
"error": result.stderr,
|
|
188
|
+
"skipped": False,
|
|
189
|
+
"duration": duration
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
except subprocess.TimeoutExpired:
|
|
193
|
+
duration = (datetime.now() - start_time).total_seconds()
|
|
194
|
+
print_error(f"{name}: TIMEOUT (>{duration:.0f}s)")
|
|
195
|
+
return {"name": name, "passed": False, "skipped": False, "duration": duration, "error": "Timeout"}
|
|
196
|
+
|
|
197
|
+
except Exception as e:
|
|
198
|
+
duration = (datetime.now() - start_time).total_seconds()
|
|
199
|
+
print_error(f"{name}: ERROR - {str(e)}")
|
|
200
|
+
return {"name": name, "passed": False, "skipped": False, "duration": duration, "error": str(e)}
|
|
201
|
+
|
|
202
|
+
def print_final_report(results: List[dict], start_time: datetime):
|
|
203
|
+
"""Print comprehensive final report"""
|
|
204
|
+
total_duration = (datetime.now() - start_time).total_seconds()
|
|
205
|
+
|
|
206
|
+
print_header("📊 FULL VERIFICATION REPORT")
|
|
207
|
+
|
|
208
|
+
# Statistics
|
|
209
|
+
total = len(results)
|
|
210
|
+
passed = sum(1 for r in results if r["passed"] and not r.get("skipped"))
|
|
211
|
+
failed = sum(1 for r in results if not r["passed"] and not r.get("skipped"))
|
|
212
|
+
skipped = sum(1 for r in results if r.get("skipped"))
|
|
213
|
+
|
|
214
|
+
print(f"Total Duration: {total_duration:.1f}s")
|
|
215
|
+
print(f"Total Checks: {total}")
|
|
216
|
+
print(f"{Colors.GREEN}✅ Passed: {passed}{Colors.ENDC}")
|
|
217
|
+
print(f"{Colors.RED}❌ Failed: {failed}{Colors.ENDC}")
|
|
218
|
+
print(f"{Colors.YELLOW}⏭️ Skipped: {skipped}{Colors.ENDC}")
|
|
219
|
+
print()
|
|
220
|
+
|
|
221
|
+
# Category breakdown
|
|
222
|
+
print(f"{Colors.BOLD}Results by Category:{Colors.ENDC}")
|
|
223
|
+
current_category = None
|
|
224
|
+
for r in results:
|
|
225
|
+
# Print category header if changed
|
|
226
|
+
if r.get("category") and r["category"] != current_category:
|
|
227
|
+
current_category = r["category"]
|
|
228
|
+
print(f"\n{Colors.BOLD}{Colors.CYAN}{current_category}:{Colors.ENDC}")
|
|
229
|
+
|
|
230
|
+
# Print result
|
|
231
|
+
if r.get("skipped"):
|
|
232
|
+
status = f"{Colors.YELLOW}⏭️ {Colors.ENDC}"
|
|
233
|
+
elif r["passed"]:
|
|
234
|
+
status = f"{Colors.GREEN}✅{Colors.ENDC}"
|
|
235
|
+
else:
|
|
236
|
+
status = f"{Colors.RED}❌{Colors.ENDC}"
|
|
237
|
+
|
|
238
|
+
duration_str = f"({r.get('duration', 0):.1f}s)" if not r.get("skipped") else ""
|
|
239
|
+
print(f" {status} {r['name']} {duration_str}")
|
|
240
|
+
|
|
241
|
+
print()
|
|
242
|
+
|
|
243
|
+
# Failed checks detail
|
|
244
|
+
if failed > 0:
|
|
245
|
+
print(f"{Colors.BOLD}{Colors.RED}❌ FAILED CHECKS:{Colors.ENDC}")
|
|
246
|
+
for r in results:
|
|
247
|
+
if not r["passed"] and not r.get("skipped"):
|
|
248
|
+
print(f"\n{Colors.RED}✗ {r['name']}{Colors.ENDC}")
|
|
249
|
+
if r.get("error"):
|
|
250
|
+
error_preview = r["error"][:200]
|
|
251
|
+
print(f" Error: {error_preview}")
|
|
252
|
+
print()
|
|
253
|
+
|
|
254
|
+
# Final verdict
|
|
255
|
+
if failed > 0:
|
|
256
|
+
print_error(f"VERIFICATION FAILED - {failed} check(s) need attention")
|
|
257
|
+
print(f"\n{Colors.YELLOW}💡 Tip: Fix critical (security, lint) issues first{Colors.ENDC}")
|
|
258
|
+
return False
|
|
259
|
+
else:
|
|
260
|
+
print_success("✨ ALL CHECKS PASSED - Ready for deployment! ✨")
|
|
261
|
+
return True
|
|
262
|
+
|
|
263
|
+
def main():
|
|
264
|
+
parser = argparse.ArgumentParser(
|
|
265
|
+
description="Run complete Agent Skill Kit verification suite",
|
|
266
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
267
|
+
epilog="""
|
|
268
|
+
Examples:
|
|
269
|
+
python scripts/verify_all.py . --url http://localhost:3000
|
|
270
|
+
python scripts/verify_all.py . --url https://staging.example.com --no-e2e
|
|
271
|
+
"""
|
|
272
|
+
)
|
|
273
|
+
parser.add_argument("project", help="Project path to validate")
|
|
274
|
+
parser.add_argument("--url", required=True, help="URL for performance & E2E checks")
|
|
275
|
+
parser.add_argument("--no-e2e", action="store_true", help="Skip E2E tests")
|
|
276
|
+
parser.add_argument("--stop-on-fail", action="store_true", help="Stop on first failure")
|
|
277
|
+
|
|
278
|
+
args = parser.parse_args()
|
|
279
|
+
|
|
280
|
+
project_path = Path(args.project).resolve()
|
|
281
|
+
|
|
282
|
+
if not project_path.exists():
|
|
283
|
+
print_error(f"Project path does not exist: {project_path}")
|
|
284
|
+
sys.exit(1)
|
|
285
|
+
|
|
286
|
+
print_header("🚀 AGENT SKILLS KIT - FULL VERIFICATION SUITE")
|
|
287
|
+
print(f"Project: {project_path}")
|
|
288
|
+
print(f"URL: {args.url}")
|
|
289
|
+
print(f"Started: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
|
290
|
+
|
|
291
|
+
start_time = datetime.now()
|
|
292
|
+
results = []
|
|
293
|
+
|
|
294
|
+
# Run all verification categories
|
|
295
|
+
for suite in VERIFICATION_SUITE:
|
|
296
|
+
category = suite["category"]
|
|
297
|
+
requires_url = suite.get("requires_url", False)
|
|
298
|
+
|
|
299
|
+
# Skip if requires URL and not provided
|
|
300
|
+
if requires_url and not args.url:
|
|
301
|
+
continue
|
|
302
|
+
|
|
303
|
+
# Skip E2E if flag set
|
|
304
|
+
if args.no_e2e and category == "E2E Testing":
|
|
305
|
+
continue
|
|
306
|
+
|
|
307
|
+
print_header(f"📋 {category.upper()}")
|
|
308
|
+
|
|
309
|
+
for name, script_path, required in suite["checks"]:
|
|
310
|
+
script = project_path / script_path
|
|
311
|
+
result = run_script(name, script, str(project_path), args.url)
|
|
312
|
+
result["category"] = category
|
|
313
|
+
results.append(result)
|
|
314
|
+
|
|
315
|
+
# Stop on critical failure if flag set
|
|
316
|
+
if args.stop_on_fail and required and not result["passed"] and not result.get("skipped"):
|
|
317
|
+
print_error(f"CRITICAL: {name} failed. Stopping verification.")
|
|
318
|
+
print_final_report(results, start_time)
|
|
319
|
+
sys.exit(1)
|
|
320
|
+
|
|
321
|
+
# Print final report
|
|
322
|
+
all_passed = print_final_report(results, start_time)
|
|
323
|
+
|
|
324
|
+
sys.exit(0 if all_passed else 1)
|
|
325
|
+
|
|
326
|
+
if __name__ == "__main__":
|
|
327
|
+
main()
|