@agentskillkit/agent-skills 3.2.1 → 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.
- package/.agent/skills/mobile-design/scripts/mobile_audit.js +333 -0
- package/.agent/skills/typescript-expert/scripts/ts_diagnostic.js +227 -0
- package/README.md +197 -720
- package/package.json +4 -4
- package/packages/cli/lib/audit.js +2 -2
- package/packages/cli/lib/auto-learn.js +8 -8
- package/packages/cli/lib/eslint-fix.js +1 -1
- package/packages/cli/lib/fix.js +5 -5
- package/packages/cli/lib/hooks/install-hooks.js +4 -4
- package/packages/cli/lib/hooks/lint-learn.js +4 -4
- package/packages/cli/lib/knowledge-index.js +4 -4
- package/packages/cli/lib/knowledge-metrics.js +2 -2
- package/packages/cli/lib/knowledge-retention.js +3 -3
- package/packages/cli/lib/knowledge-validator.js +3 -3
- package/packages/cli/lib/learn.js +10 -10
- package/packages/cli/lib/recall.js +1 -1
- package/packages/cli/lib/skill-learn.js +2 -2
- package/packages/cli/lib/stats.js +3 -3
- package/packages/cli/lib/ui/dashboard-ui.js +222 -0
- package/packages/cli/lib/ui/help-ui.js +41 -18
- package/packages/cli/lib/ui/index.js +57 -5
- package/packages/cli/lib/ui/settings-ui.js +292 -14
- package/packages/cli/lib/ui/stats-ui.js +93 -43
- package/packages/cli/lib/watcher.js +2 -2
- package/packages/kit/kit.js +89 -0
- package/packages/kit/lib/agents.js +208 -0
- package/packages/kit/lib/commands/analyze.js +70 -0
- package/packages/kit/lib/commands/cache.js +65 -0
- package/packages/kit/lib/commands/doctor.js +75 -0
- package/packages/kit/lib/commands/help.js +155 -0
- package/packages/kit/lib/commands/info.js +38 -0
- package/packages/kit/lib/commands/init.js +39 -0
- package/packages/kit/lib/commands/install.js +803 -0
- package/packages/kit/lib/commands/list.js +43 -0
- package/packages/kit/lib/commands/lock.js +57 -0
- package/packages/kit/lib/commands/uninstall.js +307 -0
- package/packages/kit/lib/commands/update.js +55 -0
- package/packages/kit/lib/commands/validate.js +69 -0
- package/packages/kit/lib/commands/verify.js +56 -0
- package/packages/kit/lib/config.js +81 -0
- package/packages/kit/lib/helpers.js +196 -0
- package/packages/kit/lib/helpers.test.js +60 -0
- package/packages/kit/lib/installer.js +164 -0
- package/packages/kit/lib/skills.js +119 -0
- package/packages/kit/lib/skills.test.js +109 -0
- package/packages/kit/lib/types.js +82 -0
- package/packages/kit/lib/ui.js +329 -0
- package/.agent/skills/mobile-design/scripts/mobile_audit.py +0 -670
- package/.agent/skills/requirements-python.txt +0 -25
- package/.agent/skills/requirements.txt +0 -96
- package/.agent/skills/typescript-expert/scripts/ts_diagnostic.py +0 -203
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentskillkit/agent-skills",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.5",
|
|
4
4
|
"description": "The Agent Skills Kit for Enterprise",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"LICENSE"
|
|
22
22
|
],
|
|
23
23
|
"bin": {
|
|
24
|
-
"agent
|
|
25
|
-
"
|
|
24
|
+
"agent": "./packages/cli/bin/agent.js",
|
|
25
|
+
"kit": "./packages/kit/kit.js"
|
|
26
26
|
},
|
|
27
27
|
"type": "module",
|
|
28
28
|
"scripts": {
|
|
@@ -79,4 +79,4 @@
|
|
|
79
79
|
"js-yaml": "^4.1.1",
|
|
80
80
|
"picocolors": "^1.1.1"
|
|
81
81
|
}
|
|
82
|
-
}
|
|
82
|
+
}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* 2. Constitution Checks (Governance)
|
|
8
8
|
* 3. Real-time Analysis
|
|
9
9
|
*
|
|
10
|
-
* Usage:
|
|
10
|
+
* Usage: agent audit [directory]
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import fs from "fs";
|
|
@@ -143,7 +143,7 @@ if (args.includes("--help")) {
|
|
|
143
143
|
⚖️ Smart Audit - Compliance Checker
|
|
144
144
|
|
|
145
145
|
Usage:
|
|
146
|
-
|
|
146
|
+
agent audit [directory]
|
|
147
147
|
|
|
148
148
|
Options:
|
|
149
149
|
--help Show this help
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
* 3. TypeScript errors (runs tsc and parses)
|
|
9
9
|
*
|
|
10
10
|
* Usage:
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* agent auto-learn # Run all
|
|
12
|
+
* agent auto-learn --eslint # ESLint only
|
|
13
|
+
* agent auto-learn --test # Test failures only
|
|
14
|
+
* agent auto-learn --typescript # TypeScript only
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import fs from "fs";
|
|
@@ -297,10 +297,10 @@ if (args.includes("--help")) {
|
|
|
297
297
|
🧠 Smart Auto-Learn - True Self-Learning Engine
|
|
298
298
|
|
|
299
299
|
Usage:
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
300
|
+
agent auto-learn Run all analyzers
|
|
301
|
+
agent auto-learn --eslint ESLint only
|
|
302
|
+
agent auto-learn --typescript TypeScript only
|
|
303
|
+
agent auto-learn --test Test failures only
|
|
304
304
|
|
|
305
305
|
The engine automatically:
|
|
306
306
|
1. Runs ESLint and learns from violations
|
package/packages/cli/lib/fix.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - Remove violations (aggressive mode)
|
|
10
10
|
* - Replace patterns (custom fix rules)
|
|
11
11
|
*
|
|
12
|
-
* Usage:
|
|
12
|
+
* Usage: agent fix <file|directory> [--mode safe|aggressive]
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import fs from "fs";
|
|
@@ -249,7 +249,7 @@ async function main() {
|
|
|
249
249
|
🔧 Smart Fix v${VERSION} - Auto-fix Violations
|
|
250
250
|
|
|
251
251
|
Usage:
|
|
252
|
-
|
|
252
|
+
agent fix <file|directory> [options]
|
|
253
253
|
|
|
254
254
|
Options:
|
|
255
255
|
--mode safe Comment out violations (default)
|
|
@@ -259,9 +259,9 @@ Options:
|
|
|
259
259
|
--help Show this help
|
|
260
260
|
|
|
261
261
|
Examples:
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
262
|
+
agent fix src/
|
|
263
|
+
agent fix app.js --mode aggressive
|
|
264
|
+
agent fix src/ --eslint
|
|
265
265
|
`);
|
|
266
266
|
process.exit(0);
|
|
267
267
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Installs pre-commit hook that runs recall on staged files.
|
|
6
6
|
*
|
|
7
|
-
* Usage:
|
|
7
|
+
* Usage: agent install-hooks
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import fs from "fs";
|
|
@@ -26,7 +26,7 @@ if [ -z "$STAGED_FILES" ]; then
|
|
|
26
26
|
fi
|
|
27
27
|
|
|
28
28
|
# Run recall (Clack handles all output)
|
|
29
|
-
npx
|
|
29
|
+
npx agent recall . 2>/dev/null
|
|
30
30
|
exit $?
|
|
31
31
|
`;
|
|
32
32
|
|
|
@@ -136,8 +136,8 @@ if (args.includes("--help")) {
|
|
|
136
136
|
🔧 Agent Skill Kit Hooks Installer
|
|
137
137
|
|
|
138
138
|
Usage:
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
agent install-hooks Install git hooks
|
|
140
|
+
agent install-hooks --remove Remove installed hooks
|
|
141
141
|
|
|
142
142
|
The pre-commit hook checks staged files against learned
|
|
143
143
|
patterns before each commit.
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* Parses ESLint JSON output and creates lessons automatically.
|
|
6
6
|
*
|
|
7
7
|
* Usage:
|
|
8
|
-
* npx eslint . --format json |
|
|
9
|
-
* npx eslint . --format json > output.json &&
|
|
8
|
+
* npx eslint . --format json | agent lint-learn
|
|
9
|
+
* npx eslint . --format json > output.json && agent lint-learn output.json
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import fs from "fs";
|
|
@@ -86,8 +86,8 @@ async function main() {
|
|
|
86
86
|
🔧 Lint Learn - Auto-Learn from ESLint
|
|
87
87
|
|
|
88
88
|
Usage:
|
|
89
|
-
npx eslint . --format json |
|
|
90
|
-
|
|
89
|
+
npx eslint . --format json | agent lint-learn
|
|
90
|
+
agent lint-learn eslint-output.json
|
|
91
91
|
|
|
92
92
|
Creates lessons from ESLint violations automatically.
|
|
93
93
|
`);
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* Regenerates on-demand when knowledge files change.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* agent index --rebuild # Force rebuild index
|
|
10
|
+
* agent index --status # Check index freshness
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import fs from 'fs';
|
|
@@ -300,8 +300,8 @@ function main() {
|
|
|
300
300
|
📇 Knowledge Index Manager
|
|
301
301
|
|
|
302
302
|
Usage:
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
agent index --rebuild Rebuild index from knowledge files
|
|
304
|
+
agent index --status Check if index is fresh or stale
|
|
305
305
|
|
|
306
306
|
The index provides O(1) lookup for:
|
|
307
307
|
- Pattern matching (by keyword)
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* Metrics are collected on-demand or on scan completion.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* agent metrics # Show dashboard
|
|
10
|
+
* agent metrics --json # JSON output for CI
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import fs from 'fs';
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* Archives or soft-deletes stale lessons based on policy rules.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* agent retention --dry-run # Preview what would be cleaned
|
|
10
|
+
* agent retention --apply # Execute cleanup (with confirmation)
|
|
11
|
+
* agent retention --status # Show retention policy status
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import fs from 'fs';
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* Ensures data integrity and prevents corruption.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* agent validate # Validate all knowledge files
|
|
10
|
+
* agent validate --fix # Auto-fix minor issues
|
|
11
|
+
* agent validate --json # JSON output for CI
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import fs from 'fs';
|
|
@@ -10,9 +10,9 @@
|
|
|
10
10
|
* - Source tracking (manual, eslint, test-failure)
|
|
11
11
|
*
|
|
12
12
|
* Usage:
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* agent learn --add --pattern "regex" --message "why bad"
|
|
14
|
+
* agent learn --list
|
|
15
|
+
* agent learn --remove <id>
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import fs from "fs";
|
|
@@ -147,7 +147,7 @@ function listLessons(category = null) {
|
|
|
147
147
|
|
|
148
148
|
if (!db.lessons || db.lessons.length === 0) {
|
|
149
149
|
console.log("\nℹ️ No lessons learned yet.");
|
|
150
|
-
console.log(" Use:
|
|
150
|
+
console.log(" Use: agent learn --add --pattern \"pat\" --message \"msg\"\n");
|
|
151
151
|
return;
|
|
152
152
|
}
|
|
153
153
|
|
|
@@ -180,9 +180,9 @@ function printHelp() {
|
|
|
180
180
|
🎓 Smart Learning Tool v${VERSION}
|
|
181
181
|
|
|
182
182
|
USAGE:
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
agent learn --add --pattern "..." --message "..."
|
|
184
|
+
agent learn --list [--category <cat>]
|
|
185
|
+
agent learn --remove <ID>
|
|
186
186
|
|
|
187
187
|
OPTIONS:
|
|
188
188
|
--add Add a new lesson
|
|
@@ -195,9 +195,9 @@ OPTIONS:
|
|
|
195
195
|
--help Show this help
|
|
196
196
|
|
|
197
197
|
EXAMPLES:
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
198
|
+
agent learn --add --pattern "console\\.log" --message "No console.log in production" --severity ERROR
|
|
199
|
+
agent learn --list
|
|
200
|
+
agent learn --remove LEARN-001
|
|
201
201
|
`);
|
|
202
202
|
}
|
|
203
203
|
|
|
@@ -471,7 +471,7 @@ Options:
|
|
|
471
471
|
const db = loadKnowledge();
|
|
472
472
|
|
|
473
473
|
if (!db.lessons || db.lessons.length === 0) {
|
|
474
|
-
console.log("ℹ️ No lessons learned yet. Use '
|
|
474
|
+
console.log("ℹ️ No lessons learned yet. Use 'agent learn' to add patterns.");
|
|
475
475
|
process.exit(0);
|
|
476
476
|
}
|
|
477
477
|
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This makes the Self-Learning Engine truly "self-learning"!
|
|
9
9
|
*
|
|
10
|
-
* Usage:
|
|
10
|
+
* Usage: agent sync-skills
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import fs from "fs";
|
|
@@ -280,7 +280,7 @@ if (args.includes("--help")) {
|
|
|
280
280
|
🔄 Skill Sync - Auto-update SKILL.md
|
|
281
281
|
|
|
282
282
|
Usage:
|
|
283
|
-
|
|
283
|
+
agent sync-skills
|
|
284
284
|
|
|
285
285
|
When patterns reach ${SYNC_THRESHOLD}+ violations, they are automatically
|
|
286
286
|
added to the relevant SKILL.md file as learned rules.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - Most triggered patterns
|
|
8
8
|
* - Violation trends
|
|
9
9
|
*
|
|
10
|
-
* Usage:
|
|
10
|
+
* Usage: agent stats
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { loadKnowledge } from "./recall.js";
|
|
@@ -25,7 +25,7 @@ function displayStats() {
|
|
|
25
25
|
p.intro(pc.cyan(`📊 Agent Skill Kit Knowledge Base v${VERSION}`));
|
|
26
26
|
|
|
27
27
|
if (!db.lessons || db.lessons.length === 0) {
|
|
28
|
-
p.note("No lessons learned yet.\nUse '
|
|
28
|
+
p.note("No lessons learned yet.\nUse 'agent learn' to add patterns.", pc.dim("Empty"));
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -118,7 +118,7 @@ if (args.includes("--help")) {
|
|
|
118
118
|
📊 Smart Stats - Knowledge Base Statistics
|
|
119
119
|
|
|
120
120
|
Usage:
|
|
121
|
-
|
|
121
|
+
agent stats
|
|
122
122
|
|
|
123
123
|
Shows:
|
|
124
124
|
- Total lessons and violations
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dashboard UI - Launch Auto-Learn Dashboard in browser
|
|
3
|
+
*/
|
|
4
|
+
import * as p from "@clack/prompts";
|
|
5
|
+
import { spawn, exec } from "child_process";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import fs from "fs";
|
|
8
|
+
import http from "http";
|
|
9
|
+
|
|
10
|
+
// Track running server globally
|
|
11
|
+
let runningServer = null;
|
|
12
|
+
let runningPort = null;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Check if a port is already in use by our dashboard
|
|
16
|
+
* Uses /api/summary to verify it's actually our dashboard server
|
|
17
|
+
*/
|
|
18
|
+
async function checkPortInUse(port) {
|
|
19
|
+
return new Promise((resolve) => {
|
|
20
|
+
const req = http.get(`http://localhost:${port}/api/summary`, (res) => {
|
|
21
|
+
// If we get 200 response from /api/summary, it's our dashboard
|
|
22
|
+
if (res.statusCode === 200) {
|
|
23
|
+
resolve(true);
|
|
24
|
+
} else {
|
|
25
|
+
resolve(false);
|
|
26
|
+
}
|
|
27
|
+
req.destroy();
|
|
28
|
+
});
|
|
29
|
+
req.on('error', () => {
|
|
30
|
+
resolve(false);
|
|
31
|
+
});
|
|
32
|
+
// Faster timeout - 500ms is enough for localhost
|
|
33
|
+
req.setTimeout(500, () => {
|
|
34
|
+
req.destroy();
|
|
35
|
+
resolve(false);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Find existing dashboard server on ports 3030-3040
|
|
42
|
+
*/
|
|
43
|
+
async function findExistingServer() {
|
|
44
|
+
// Check ports in parallel for faster detection
|
|
45
|
+
const portChecks = [];
|
|
46
|
+
for (let port = 3030; port <= 3040; port++) {
|
|
47
|
+
portChecks.push(checkPortInUse(port).then(inUse => inUse ? port : null));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const results = await Promise.all(portChecks);
|
|
51
|
+
const existingPort = results.find(port => port !== null);
|
|
52
|
+
return existingPort || null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Find an available port
|
|
57
|
+
*/
|
|
58
|
+
async function findAvailablePort(startPort = 3030) {
|
|
59
|
+
return new Promise((resolve) => {
|
|
60
|
+
const server = http.createServer();
|
|
61
|
+
server.listen(startPort, () => {
|
|
62
|
+
server.close(() => resolve(startPort));
|
|
63
|
+
});
|
|
64
|
+
server.on("error", () => {
|
|
65
|
+
resolve(findAvailablePort(startPort + 1));
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Find dashboard server script
|
|
72
|
+
*/
|
|
73
|
+
function findDashboardScript() {
|
|
74
|
+
// Get the directory where this module is located
|
|
75
|
+
const moduleDir = path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Z]:)/i, '$1'));
|
|
76
|
+
const cliRoot = path.resolve(moduleDir, '..', '..');
|
|
77
|
+
|
|
78
|
+
// User home directory
|
|
79
|
+
const homeDir = process.env.USERPROFILE || process.env.HOME || '';
|
|
80
|
+
|
|
81
|
+
const possiblePaths = [
|
|
82
|
+
// PRIORITY 1: Bundled with CLI package (always available)
|
|
83
|
+
path.join(cliRoot, "dashboard", "dashboard_server.js"),
|
|
84
|
+
// PRIORITY 2: Current project paths
|
|
85
|
+
path.join(process.cwd(), ".agent", "skills", "auto-learner", "scripts", "dashboard_server.js"),
|
|
86
|
+
path.join(process.cwd(), ".agent", "agentskillskit", ".agent", "skills", "auto-learner", "scripts", "dashboard_server.js"),
|
|
87
|
+
// PRIORITY 3: Fallback user paths (Windows Desktop)
|
|
88
|
+
path.join(homeDir, "Desktop", "agent-skill-kit", ".agent", "skills", "auto-learner", "scripts", "dashboard_server.js"),
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
for (const searchPath of possiblePaths) {
|
|
92
|
+
if (fs.existsSync(searchPath)) {
|
|
93
|
+
return searchPath;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Open URL in default browser
|
|
101
|
+
*/
|
|
102
|
+
function openBrowser(url) {
|
|
103
|
+
const platform = process.platform;
|
|
104
|
+
let command;
|
|
105
|
+
|
|
106
|
+
if (platform === "win32") {
|
|
107
|
+
command = `start "" "${url}"`;
|
|
108
|
+
} else if (platform === "darwin") {
|
|
109
|
+
command = `open "${url}"`;
|
|
110
|
+
} else {
|
|
111
|
+
command = `xdg-open "${url}"`;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
exec(command, (err) => {
|
|
115
|
+
if (err) {
|
|
116
|
+
p.log.warn(`Could not open browser automatically. Visit: ${url}`);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Run Dashboard UI
|
|
123
|
+
*/
|
|
124
|
+
export async function runDashboardUI() {
|
|
125
|
+
const spinner = p.spinner();
|
|
126
|
+
|
|
127
|
+
// Check if there's already a server running
|
|
128
|
+
spinner.start("Checking for existing dashboard server...");
|
|
129
|
+
const existingPort = await findExistingServer();
|
|
130
|
+
|
|
131
|
+
if (existingPort) {
|
|
132
|
+
spinner.stop(`Found existing server on port ${existingPort}`);
|
|
133
|
+
const url = `http://localhost:${existingPort}`;
|
|
134
|
+
|
|
135
|
+
p.log.success(`Dashboard already running at: ${url}`);
|
|
136
|
+
openBrowser(url);
|
|
137
|
+
|
|
138
|
+
p.note(`Server running on port ${existingPort}\nUsing existing server`, "📊 Auto-Learn Dashboard");
|
|
139
|
+
|
|
140
|
+
const action = await p.select({
|
|
141
|
+
message: "Dashboard is running. What would you like to do?",
|
|
142
|
+
options: [
|
|
143
|
+
{ value: "keep", label: "🏠 Back to menu", hint: "Keep server running" },
|
|
144
|
+
{ value: "stop", label: "🛑 Stop server", hint: "Shutdown dashboard" }
|
|
145
|
+
]
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
if (action === "stop") {
|
|
149
|
+
// Kill all node processes on that port
|
|
150
|
+
p.log.info("Stopping existing server...");
|
|
151
|
+
if (process.platform === "win32") {
|
|
152
|
+
exec(`for /f "tokens=5" %a in ('netstat -aon ^| findstr :${existingPort}') do taskkill /F /PID %a`, () => { });
|
|
153
|
+
} else {
|
|
154
|
+
exec(`lsof -ti:${existingPort} | xargs kill -9`, () => { });
|
|
155
|
+
}
|
|
156
|
+
await new Promise(r => setTimeout(r, 1000));
|
|
157
|
+
p.log.success("Dashboard server stopped");
|
|
158
|
+
}
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
spinner.stop("No existing server found");
|
|
163
|
+
|
|
164
|
+
// Find dashboard script
|
|
165
|
+
const scriptPath = findDashboardScript();
|
|
166
|
+
|
|
167
|
+
if (!scriptPath) {
|
|
168
|
+
p.log.error("Dashboard script not found!");
|
|
169
|
+
p.log.info("Install auto-learner skill first or check .agent/skills/auto-learner/scripts/");
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Find available port
|
|
174
|
+
spinner.start("Finding available port...");
|
|
175
|
+
const port = await findAvailablePort(3030);
|
|
176
|
+
runningPort = port;
|
|
177
|
+
spinner.stop(`Using port ${port}`);
|
|
178
|
+
|
|
179
|
+
// Start dashboard server
|
|
180
|
+
spinner.start("Starting dashboard server...");
|
|
181
|
+
|
|
182
|
+
const child = spawn("node", [scriptPath, "--port", String(port)], {
|
|
183
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
184
|
+
detached: false
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
runningServer = child;
|
|
188
|
+
|
|
189
|
+
// Wait for server to start
|
|
190
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
191
|
+
|
|
192
|
+
spinner.stop("Dashboard server started!");
|
|
193
|
+
|
|
194
|
+
const url = `http://localhost:${port}`;
|
|
195
|
+
|
|
196
|
+
// Open browser
|
|
197
|
+
p.log.success(`Dashboard running at: ${url}`);
|
|
198
|
+
openBrowser(url);
|
|
199
|
+
|
|
200
|
+
p.log.info("Dashboard opened in browser");
|
|
201
|
+
p.note(`Server running on port ${port}\nPress Ctrl+C in terminal to stop`, "📊 Auto-Learn Dashboard");
|
|
202
|
+
|
|
203
|
+
// Keep server running and wait for user
|
|
204
|
+
const action = await p.select({
|
|
205
|
+
message: "Dashboard is running. What would you like to do?",
|
|
206
|
+
options: [
|
|
207
|
+
{ value: "keep", label: "🏠 Back to menu", hint: "Keep server running" },
|
|
208
|
+
{ value: "stop", label: "🛑 Stop server", hint: "Shutdown dashboard" }
|
|
209
|
+
]
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
if (action === "stop" || p.isCancel(action)) {
|
|
213
|
+
child.kill();
|
|
214
|
+
runningServer = null;
|
|
215
|
+
runningPort = null;
|
|
216
|
+
p.log.info("Dashboard server stopped");
|
|
217
|
+
} else {
|
|
218
|
+
p.log.info(`Dashboard still running at ${url}`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export default runDashboardUI;
|
|
@@ -1,26 +1,49 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Help/Guide UI -
|
|
2
|
+
* Help/Guide UI - Compact Visual Guide
|
|
3
3
|
*/
|
|
4
4
|
import * as p from "@clack/prompts";
|
|
5
5
|
import pc from "picocolors";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Show compact visual guide (fits in one screen)
|
|
9
|
+
*/
|
|
7
10
|
export async function runHelpUI() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
// Clear terminal và reset cursor về top-left
|
|
12
|
+
process.stdout.write('\x1Bc'); // Full terminal reset
|
|
13
|
+
|
|
14
|
+
p.intro(pc.cyan("📖 Agent Skill Kit - Quick Guide"));
|
|
15
|
+
|
|
16
|
+
console.log(`
|
|
17
|
+
${pc.bold(pc.yellow("🎯 HOW IT WORKS"))}
|
|
18
|
+
${pc.green("Write Code")} → ${pc.yellow("Agent Scans")} → ${pc.blue("Learns Patterns")} → ${pc.magenta("Auto Warns")}
|
|
19
|
+
|
|
20
|
+
${pc.bold(pc.yellow("🔧 MENU OPTIONS"))}
|
|
21
|
+
${pc.cyan("🔎 Scan All")} - Check violations + option to auto-fix
|
|
22
|
+
${pc.cyan("📝 Learn")} - Teach agent new patterns (manual mode only)
|
|
23
|
+
${pc.cyan("📚 Knowledge")} - View lessons & review pending patterns
|
|
24
|
+
${pc.cyan("📊 Stats")} - Project metrics & insights
|
|
25
|
+
${pc.cyan("⚙️ Settings")} - Configure auto-learning, API keys
|
|
26
|
+
${pc.cyan("💾 Backup")} - Manage knowledge backups
|
|
27
|
+
|
|
28
|
+
${pc.bold(pc.yellow("🚀 QUICK START"))}
|
|
29
|
+
${pc.bold("1.")} ${pc.cyan("Scan All")} ${pc.dim("→ See current violations")}
|
|
30
|
+
${pc.bold("2.")} ${pc.cyan("Fix All")} ${pc.dim("→ Auto-fix simple issues")}
|
|
31
|
+
${pc.bold("3.")} ${pc.cyan("Knowledge")} ${pc.dim("→ Review what agent learned")}
|
|
32
|
+
|
|
33
|
+
${pc.green("✓")} Agent learns from your code automatically
|
|
34
|
+
${pc.green("✓")} All fixes are backed up safely
|
|
35
|
+
${pc.green("✓")} The more you use it, the smarter it gets!
|
|
36
|
+
`);
|
|
37
|
+
|
|
38
|
+
// User selects next action
|
|
39
|
+
const action = await p.select({
|
|
40
|
+
message: "What's next?",
|
|
41
|
+
options: [
|
|
42
|
+
{ value: "back", label: "← Back to Main Menu" }
|
|
43
|
+
]
|
|
25
44
|
});
|
|
45
|
+
|
|
46
|
+
if (!p.isCancel(action)) {
|
|
47
|
+
p.outro(pc.cyan("👋 Returning to menu"));
|
|
48
|
+
}
|
|
26
49
|
}
|