@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
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Install Agent Skill CLI
|
|
4
|
+
* @description Package manager for AI Agent Skills
|
|
5
|
+
*/
|
|
6
|
+
import { c, brandedIntro } from "./lib/ui.js";
|
|
7
|
+
import { command, params, VERSION } from "./lib/config.js";
|
|
8
|
+
|
|
9
|
+
// --- Command Registry ---
|
|
10
|
+
const COMMANDS = {
|
|
11
|
+
// Installation
|
|
12
|
+
install: { module: "./lib/commands/install.js", hasParam: true, aliases: ["add", "i"] },
|
|
13
|
+
uninstall: { module: "./lib/commands/uninstall.js", hasParam: true, aliases: ["remove", "rm"] },
|
|
14
|
+
update: { module: "./lib/commands/update.js", hasParam: true },
|
|
15
|
+
|
|
16
|
+
// Workspace
|
|
17
|
+
init: { module: "./lib/commands/init.js", aliases: ["list", "ls"] },
|
|
18
|
+
lock: { module: "./lib/commands/lock.js" },
|
|
19
|
+
cache: { module: "./lib/commands/cache.js", hasParam: true },
|
|
20
|
+
|
|
21
|
+
// Validation
|
|
22
|
+
verify: { module: "./lib/commands/verify.js" },
|
|
23
|
+
doctor: { module: "./lib/commands/doctor.js" },
|
|
24
|
+
validate: { module: "./lib/commands/validate.js", hasParam: true, aliases: ["check"] },
|
|
25
|
+
analyze: { module: "./lib/commands/analyze.js", hasParam: true },
|
|
26
|
+
|
|
27
|
+
// Info
|
|
28
|
+
info: { module: "./lib/commands/info.js", hasParam: true, aliases: ["show"] },
|
|
29
|
+
help: { module: "./lib/commands/help.js", aliases: ["--help", "-h"] }
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Find command config by name or alias
|
|
34
|
+
* @param {string} cmd - Command name or alias
|
|
35
|
+
* @returns {{ name: string, config: object } | null}
|
|
36
|
+
*/
|
|
37
|
+
function findCommand(cmd) {
|
|
38
|
+
// Direct match
|
|
39
|
+
if (COMMANDS[cmd]) {
|
|
40
|
+
return { name: cmd, config: COMMANDS[cmd] };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Alias match
|
|
44
|
+
for (const [name, config] of Object.entries(COMMANDS)) {
|
|
45
|
+
if (config.aliases?.includes(cmd)) {
|
|
46
|
+
return { name, config };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// --- MAIN ---
|
|
54
|
+
async function main() {
|
|
55
|
+
brandedIntro(VERSION);
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
// Handle version flag
|
|
59
|
+
if (command === "--version" || command === "-V") {
|
|
60
|
+
console.log(VERSION);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Find command
|
|
65
|
+
const found = findCommand(command);
|
|
66
|
+
|
|
67
|
+
if (found) {
|
|
68
|
+
const cmdModule = await import(found.config.module);
|
|
69
|
+
await cmdModule.run(found.config.hasParam ? params[0] : undefined);
|
|
70
|
+
} else if (command.includes("/")) {
|
|
71
|
+
// Direct install via org/repo syntax
|
|
72
|
+
const cmdModule = await import("./lib/commands/install.js");
|
|
73
|
+
await cmdModule.run(command);
|
|
74
|
+
} else {
|
|
75
|
+
console.log(`Unknown command: ${command}`);
|
|
76
|
+
const cmdModule = await import("./lib/commands/help.js");
|
|
77
|
+
await cmdModule.run();
|
|
78
|
+
}
|
|
79
|
+
} catch (err) {
|
|
80
|
+
console.error(c.red("\nError: " + err.message));
|
|
81
|
+
if (process.env.DEBUG) console.error(err.stack);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
main().catch(err => {
|
|
87
|
+
console.error(c.red("\nFatal Error: " + err.message));
|
|
88
|
+
process.exit(1);
|
|
89
|
+
});
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Agent definitions and detection
|
|
3
|
+
* Based on Vercel's agent-skills CLI structure
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { existsSync } from "fs";
|
|
7
|
+
import { homedir } from "os";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
|
|
10
|
+
const home = homedir();
|
|
11
|
+
|
|
12
|
+
// Environment-based paths
|
|
13
|
+
const codexHome = process.env.CODEX_HOME?.trim() || join(home, ".codex");
|
|
14
|
+
const claudeHome = process.env.CLAUDE_CONFIG_DIR?.trim() || join(home, ".claude");
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {Object} AgentConfig
|
|
18
|
+
* @property {string} name - Internal agent ID
|
|
19
|
+
* @property {string} displayName - Display name for UI
|
|
20
|
+
* @property {string} skillsDir - Project-level skills directory
|
|
21
|
+
* @property {string} globalSkillsDir - Global skills directory
|
|
22
|
+
* @property {() => boolean} detect - Detection function
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* All supported agents with detection logic
|
|
27
|
+
* @type {Record<string, AgentConfig>}
|
|
28
|
+
*/
|
|
29
|
+
export const AGENTS = {
|
|
30
|
+
antigravity: {
|
|
31
|
+
name: "antigravity",
|
|
32
|
+
displayName: "Antigravity",
|
|
33
|
+
skillsDir: ".agent/skills",
|
|
34
|
+
globalSkillsDir: join(home, ".gemini/antigravity/global_skills"),
|
|
35
|
+
detect: () => existsSync(join(process.cwd(), ".agent")) || existsSync(join(home, ".gemini/antigravity"))
|
|
36
|
+
},
|
|
37
|
+
"claude-code": {
|
|
38
|
+
name: "claude-code",
|
|
39
|
+
displayName: "Claude Code",
|
|
40
|
+
skillsDir: ".claude/skills",
|
|
41
|
+
globalSkillsDir: join(claudeHome, "skills"),
|
|
42
|
+
detect: () => existsSync(claudeHome)
|
|
43
|
+
},
|
|
44
|
+
codex: {
|
|
45
|
+
name: "codex",
|
|
46
|
+
displayName: "Codex",
|
|
47
|
+
skillsDir: ".codex/skills",
|
|
48
|
+
globalSkillsDir: join(codexHome, "skills"),
|
|
49
|
+
detect: () => existsSync(codexHome) || existsSync("/etc/codex")
|
|
50
|
+
},
|
|
51
|
+
"gemini-cli": {
|
|
52
|
+
name: "gemini-cli",
|
|
53
|
+
displayName: "Gemini CLI",
|
|
54
|
+
skillsDir: ".gemini/skills",
|
|
55
|
+
globalSkillsDir: join(home, ".gemini/skills"),
|
|
56
|
+
detect: () => existsSync(join(home, ".gemini"))
|
|
57
|
+
},
|
|
58
|
+
"github-copilot": {
|
|
59
|
+
name: "github-copilot",
|
|
60
|
+
displayName: "GitHub Copilot",
|
|
61
|
+
skillsDir: ".github/skills",
|
|
62
|
+
globalSkillsDir: join(home, ".copilot/skills"),
|
|
63
|
+
detect: () => existsSync(join(process.cwd(), ".github")) || existsSync(join(home, ".copilot"))
|
|
64
|
+
},
|
|
65
|
+
windsurf: {
|
|
66
|
+
name: "windsurf",
|
|
67
|
+
displayName: "Windsurf",
|
|
68
|
+
skillsDir: ".windsurf/skills",
|
|
69
|
+
globalSkillsDir: join(home, ".codeium/windsurf/skills"),
|
|
70
|
+
detect: () => existsSync(join(home, ".codeium/windsurf"))
|
|
71
|
+
},
|
|
72
|
+
cursor: {
|
|
73
|
+
name: "cursor",
|
|
74
|
+
displayName: "Cursor",
|
|
75
|
+
skillsDir: ".cursor/skills",
|
|
76
|
+
globalSkillsDir: join(home, ".cursor/skills"),
|
|
77
|
+
detect: () => existsSync(join(home, ".cursor"))
|
|
78
|
+
},
|
|
79
|
+
cline: {
|
|
80
|
+
name: "cline",
|
|
81
|
+
displayName: "Cline",
|
|
82
|
+
skillsDir: ".cline/skills",
|
|
83
|
+
globalSkillsDir: join(home, ".cline/skills"),
|
|
84
|
+
detect: () => existsSync(join(home, ".cline"))
|
|
85
|
+
},
|
|
86
|
+
roo: {
|
|
87
|
+
name: "roo",
|
|
88
|
+
displayName: "Roo Code",
|
|
89
|
+
skillsDir: ".roo/skills",
|
|
90
|
+
globalSkillsDir: join(home, ".roo/skills"),
|
|
91
|
+
detect: () => existsSync(join(home, ".roo"))
|
|
92
|
+
},
|
|
93
|
+
continue: {
|
|
94
|
+
name: "continue",
|
|
95
|
+
displayName: "Continue",
|
|
96
|
+
skillsDir: ".continue/skills",
|
|
97
|
+
globalSkillsDir: join(home, ".continue/skills"),
|
|
98
|
+
detect: () => existsSync(join(process.cwd(), ".continue")) || existsSync(join(home, ".continue"))
|
|
99
|
+
},
|
|
100
|
+
goose: {
|
|
101
|
+
name: "goose",
|
|
102
|
+
displayName: "Goose",
|
|
103
|
+
skillsDir: ".goose/skills",
|
|
104
|
+
globalSkillsDir: join(home, ".config/goose/skills"),
|
|
105
|
+
detect: () => existsSync(join(home, ".config/goose"))
|
|
106
|
+
},
|
|
107
|
+
trae: {
|
|
108
|
+
name: "trae",
|
|
109
|
+
displayName: "Trae",
|
|
110
|
+
skillsDir: ".trae/skills",
|
|
111
|
+
globalSkillsDir: join(home, ".trae/skills"),
|
|
112
|
+
detect: () => existsSync(join(home, ".trae"))
|
|
113
|
+
},
|
|
114
|
+
kilo: {
|
|
115
|
+
name: "kilo",
|
|
116
|
+
displayName: "Kilo Code",
|
|
117
|
+
skillsDir: ".kilocode/skills",
|
|
118
|
+
globalSkillsDir: join(home, ".kilocode/skills"),
|
|
119
|
+
detect: () => existsSync(join(home, ".kilocode"))
|
|
120
|
+
},
|
|
121
|
+
opencode: {
|
|
122
|
+
name: "opencode",
|
|
123
|
+
displayName: "OpenCode",
|
|
124
|
+
skillsDir: ".opencode/skills",
|
|
125
|
+
globalSkillsDir: join(home, ".config/opencode/skills"),
|
|
126
|
+
detect: () => existsSync(join(home, ".config/opencode"))
|
|
127
|
+
},
|
|
128
|
+
amp: {
|
|
129
|
+
name: "amp",
|
|
130
|
+
displayName: "Amp",
|
|
131
|
+
skillsDir: ".agents/skills",
|
|
132
|
+
globalSkillsDir: join(home, ".config/agents/skills"),
|
|
133
|
+
detect: () => existsSync(join(home, ".config/amp"))
|
|
134
|
+
},
|
|
135
|
+
junie: {
|
|
136
|
+
name: "junie",
|
|
137
|
+
displayName: "Junie",
|
|
138
|
+
skillsDir: ".junie/skills",
|
|
139
|
+
globalSkillsDir: join(home, ".junie/skills"),
|
|
140
|
+
detect: () => existsSync(join(home, ".junie"))
|
|
141
|
+
},
|
|
142
|
+
"kiro-cli": {
|
|
143
|
+
name: "kiro-cli",
|
|
144
|
+
displayName: "Kiro CLI",
|
|
145
|
+
skillsDir: ".kiro/skills",
|
|
146
|
+
globalSkillsDir: join(home, ".kiro/skills"),
|
|
147
|
+
detect: () => existsSync(join(home, ".kiro"))
|
|
148
|
+
},
|
|
149
|
+
zencoder: {
|
|
150
|
+
name: "zencoder",
|
|
151
|
+
displayName: "Zencoder",
|
|
152
|
+
skillsDir: ".zencoder/skills",
|
|
153
|
+
globalSkillsDir: join(home, ".zencoder/skills"),
|
|
154
|
+
detect: () => existsSync(join(home, ".zencoder"))
|
|
155
|
+
},
|
|
156
|
+
openhands: {
|
|
157
|
+
name: "openhands",
|
|
158
|
+
displayName: "OpenHands",
|
|
159
|
+
skillsDir: ".openhands/skills",
|
|
160
|
+
globalSkillsDir: join(home, ".openhands/skills"),
|
|
161
|
+
detect: () => existsSync(join(home, ".openhands"))
|
|
162
|
+
},
|
|
163
|
+
"qwen-code": {
|
|
164
|
+
name: "qwen-code",
|
|
165
|
+
displayName: "Qwen Code",
|
|
166
|
+
skillsDir: ".qwen/skills",
|
|
167
|
+
globalSkillsDir: join(home, ".qwen/skills"),
|
|
168
|
+
detect: () => existsSync(join(home, ".qwen"))
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Detect all installed agents on the system
|
|
174
|
+
* @returns {Array<{name: string, displayName: string, skillsDir: string, globalSkillsDir: string}>}
|
|
175
|
+
*/
|
|
176
|
+
export function detectInstalledAgents() {
|
|
177
|
+
const detected = [];
|
|
178
|
+
|
|
179
|
+
for (const [key, config] of Object.entries(AGENTS)) {
|
|
180
|
+
if (config.detect()) {
|
|
181
|
+
detected.push({
|
|
182
|
+
name: config.name,
|
|
183
|
+
displayName: config.displayName,
|
|
184
|
+
skillsDir: config.skillsDir,
|
|
185
|
+
globalSkillsDir: config.globalSkillsDir
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
return detected;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Get agent config by name
|
|
195
|
+
* @param {string} name - Agent name
|
|
196
|
+
* @returns {AgentConfig | undefined}
|
|
197
|
+
*/
|
|
198
|
+
export function getAgentConfig(name) {
|
|
199
|
+
return AGENTS[name];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Get all agent names
|
|
204
|
+
* @returns {string[]}
|
|
205
|
+
*/
|
|
206
|
+
export function getAllAgentNames() {
|
|
207
|
+
return Object.keys(AGENTS);
|
|
208
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Analyze command - Skill structure analysis
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import { resolveScope, getDirSize } from "../helpers.js";
|
|
8
|
+
import { parseSkillMdFrontmatter, detectSkillStructure } from "../skills.js";
|
|
9
|
+
import { step, stepLine, S, c, fatal } from "../ui.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Analyze skill structure
|
|
13
|
+
* @param {string} skillName - Skill to analyze
|
|
14
|
+
*/
|
|
15
|
+
export async function run(skillName) {
|
|
16
|
+
if (!skillName) fatal("Missing skill name");
|
|
17
|
+
|
|
18
|
+
const scope = resolveScope();
|
|
19
|
+
const skillDir = path.join(scope, skillName);
|
|
20
|
+
|
|
21
|
+
if (!fs.existsSync(skillDir)) fatal(`Skill not found: ${skillName}`);
|
|
22
|
+
|
|
23
|
+
stepLine();
|
|
24
|
+
step(c.bold(`Skill Analysis: ${skillName}`), S.diamondFilled, "cyan");
|
|
25
|
+
console.log(`${c.gray(S.branch)} ${c.dim("Path: " + skillDir)}`);
|
|
26
|
+
stepLine();
|
|
27
|
+
|
|
28
|
+
// SKILL.md frontmatter
|
|
29
|
+
const smp = path.join(skillDir, "SKILL.md");
|
|
30
|
+
if (fs.existsSync(smp)) {
|
|
31
|
+
const m = parseSkillMdFrontmatter(smp);
|
|
32
|
+
console.log(`${c.gray(S.branch)} ${c.cyan("SKILL.md Frontmatter:")}`);
|
|
33
|
+
console.log(`${c.gray(S.branch)} Name: ${m.name || c.dim("(not set)")}`);
|
|
34
|
+
console.log(`${c.gray(S.branch)} Description: ${m.description ? m.description.substring(0, 60) : c.red("(MISSING)")}`);
|
|
35
|
+
if (m.tags) console.log(`${c.gray(S.branch)} Tags: ${m.tags.join(", ")}`);
|
|
36
|
+
stepLine();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Structure
|
|
40
|
+
const structure = detectSkillStructure(skillDir);
|
|
41
|
+
console.log(`${c.gray(S.branch)} ${c.cyan("Structure:")}`);
|
|
42
|
+
|
|
43
|
+
const items = [
|
|
44
|
+
["resources", structure.hasResources],
|
|
45
|
+
["examples", structure.hasExamples],
|
|
46
|
+
["scripts", structure.hasScripts],
|
|
47
|
+
["constitution", structure.hasConstitution],
|
|
48
|
+
["doctrines", structure.hasDoctrines]
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
items.forEach(([n, has]) => {
|
|
52
|
+
console.log(`${c.gray(S.branch)} ${has ? c.green(S.check) : c.dim("○")} ${has ? c.bold(n) : c.dim(n)}`);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
stepLine();
|
|
56
|
+
|
|
57
|
+
// Antigravity Score
|
|
58
|
+
let score = 0;
|
|
59
|
+
if (fs.existsSync(smp)) score += 20;
|
|
60
|
+
const m = parseSkillMdFrontmatter(smp);
|
|
61
|
+
if (m.description) score += 25;
|
|
62
|
+
if (m.tags && m.tags.length > 0) score += 10;
|
|
63
|
+
if (structure.hasResources || structure.hasExamples || structure.hasScripts) score += 20;
|
|
64
|
+
if (fs.existsSync(path.join(skillDir, ".skill-source.json"))) score += 10;
|
|
65
|
+
if (structure.hasConstitution || structure.hasDoctrines) score += 15;
|
|
66
|
+
|
|
67
|
+
const scoreColor = score >= 80 ? c.green : score >= 50 ? c.yellow : c.red;
|
|
68
|
+
console.log(`${c.gray(S.branch)} ${c.cyan("Antigravity Score:")} ${scoreColor(score + "/100")}`);
|
|
69
|
+
stepLine();
|
|
70
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Cache command
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import { step, stepLine, S, c, fatal, success } from "../ui.js";
|
|
7
|
+
import { getDirSize, formatBytes, listBackups } from "../helpers.js";
|
|
8
|
+
import { CACHE_ROOT, REGISTRY_CACHE, BACKUP_DIR, DRY } from "../config.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Manage cache
|
|
12
|
+
* @param {string} [sub] - Subcommand: info, clear, backups
|
|
13
|
+
*/
|
|
14
|
+
export async function run(sub) {
|
|
15
|
+
stepLine();
|
|
16
|
+
|
|
17
|
+
if (sub === "clear") {
|
|
18
|
+
if (DRY) {
|
|
19
|
+
step(`Would clear: ${CACHE_ROOT}`, S.diamond);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (fs.existsSync(CACHE_ROOT)) {
|
|
23
|
+
const size = getDirSize(CACHE_ROOT);
|
|
24
|
+
fs.rmSync(CACHE_ROOT, { recursive: true, force: true });
|
|
25
|
+
success(`Cache cleared (${formatBytes(size)})`);
|
|
26
|
+
} else {
|
|
27
|
+
step("Cache already empty", S.diamond);
|
|
28
|
+
}
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (sub === "info" || !sub) {
|
|
33
|
+
if (!fs.existsSync(CACHE_ROOT)) {
|
|
34
|
+
step("Cache is empty", S.diamond);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const rs = fs.existsSync(REGISTRY_CACHE) ? getDirSize(REGISTRY_CACHE) : 0;
|
|
39
|
+
const bs = fs.existsSync(BACKUP_DIR) ? getDirSize(BACKUP_DIR) : 0;
|
|
40
|
+
|
|
41
|
+
step(c.bold("Cache Info"), S.diamondFilled, "cyan");
|
|
42
|
+
console.log(`${c.gray(S.branch)} Location: ${CACHE_ROOT}`);
|
|
43
|
+
console.log(`${c.gray(S.branch)} Registries: ${formatBytes(rs)}`);
|
|
44
|
+
console.log(`${c.gray(S.branch)} Backups: ${formatBytes(bs)}`);
|
|
45
|
+
console.log(`${c.gray(S.branch)} Total: ${formatBytes(getDirSize(CACHE_ROOT))}`);
|
|
46
|
+
stepLine();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (sub === "backups") {
|
|
51
|
+
const backups = listBackups();
|
|
52
|
+
if (backups.length === 0) {
|
|
53
|
+
step("No backups found", S.diamond);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
step(c.bold("Backups"), S.diamondFilled, "cyan");
|
|
58
|
+
stepLine();
|
|
59
|
+
backups.forEach(b => console.log(`${c.gray(S.branch)} ${b.name} (${formatBytes(b.size)})`));
|
|
60
|
+
stepLine();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
fatal(`Unknown cache subcommand: ${sub}`);
|
|
65
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Doctor command - Health check
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import { resolveScope, merkleHash, loadSkillLock } from "../helpers.js";
|
|
8
|
+
import { step, stepLine, S, c } from "../ui.js";
|
|
9
|
+
import { STRICT, FIX, DRY, cwd } from "../config.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Run health check on installed skills
|
|
13
|
+
*/
|
|
14
|
+
export async function run() {
|
|
15
|
+
const scope = resolveScope();
|
|
16
|
+
|
|
17
|
+
if (!fs.existsSync(scope)) {
|
|
18
|
+
stepLine();
|
|
19
|
+
step("No skills directory found", S.diamond);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
stepLine();
|
|
24
|
+
step(c.bold("Health Check"), S.diamondFilled, "cyan");
|
|
25
|
+
stepLine();
|
|
26
|
+
|
|
27
|
+
let errors = 0, warnings = 0;
|
|
28
|
+
const lock = fs.existsSync(path.join(cwd, ".agent", "skill-lock.json")) ? loadSkillLock() : null;
|
|
29
|
+
|
|
30
|
+
for (const name of fs.readdirSync(scope)) {
|
|
31
|
+
const dir = path.join(scope, name);
|
|
32
|
+
if (!fs.statSync(dir).isDirectory()) continue;
|
|
33
|
+
|
|
34
|
+
// Check SKILL.md
|
|
35
|
+
if (!fs.existsSync(path.join(dir, "SKILL.md"))) {
|
|
36
|
+
step(`${name}: ${c.red("missing SKILL.md")}`, S.cross, "red");
|
|
37
|
+
errors++;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Check metadata
|
|
42
|
+
const mf = path.join(dir, ".skill-source.json");
|
|
43
|
+
if (!fs.existsSync(mf)) {
|
|
44
|
+
step(`${name}: ${c.red("missing metadata")}`, S.cross, "red");
|
|
45
|
+
errors++;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const m = JSON.parse(fs.readFileSync(mf, "utf-8"));
|
|
50
|
+
const actual = merkleHash(dir);
|
|
51
|
+
|
|
52
|
+
// Check checksum
|
|
53
|
+
if (actual !== m.checksum) {
|
|
54
|
+
if (FIX && !DRY) {
|
|
55
|
+
m.checksum = actual;
|
|
56
|
+
fs.writeFileSync(mf, JSON.stringify(m, null, 2));
|
|
57
|
+
step(`${name}: ${c.yellow("checksum fixed")}`, S.diamond, "yellow");
|
|
58
|
+
} else {
|
|
59
|
+
step(`${name}: ${c.yellow("checksum drift")}`, S.diamond, "yellow");
|
|
60
|
+
STRICT ? errors++ : warnings++;
|
|
61
|
+
}
|
|
62
|
+
} else if (lock && !lock.skills[name]) {
|
|
63
|
+
step(`${name}: ${c.yellow("not in lock")}`, S.diamond, "yellow");
|
|
64
|
+
STRICT ? errors++ : warnings++;
|
|
65
|
+
} else {
|
|
66
|
+
step(`${name}: ${c.green("healthy")}`, S.check, "green");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
stepLine();
|
|
71
|
+
console.log(`${c.gray(S.branch)} Errors: ${errors}, Warnings: ${warnings}`);
|
|
72
|
+
stepLine();
|
|
73
|
+
|
|
74
|
+
if (STRICT && errors) process.exit(1);
|
|
75
|
+
}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Help command
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { step, stepLine, S, c, select, isCancel, cancel } from "../ui.js";
|
|
6
|
+
import { VERSION } from "../config.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Show interactive help menu
|
|
10
|
+
*/
|
|
11
|
+
export async function run() {
|
|
12
|
+
let running = true;
|
|
13
|
+
|
|
14
|
+
while (running) {
|
|
15
|
+
|
|
16
|
+
const choice = await select({
|
|
17
|
+
message: "Select a topic",
|
|
18
|
+
options: [
|
|
19
|
+
{ value: "commands", label: "Commands", hint: "View all available commands" },
|
|
20
|
+
{ value: "options", label: "Options", hint: "View all flags and options" },
|
|
21
|
+
{ value: "quickstart", label: "Quick Start", hint: "Get started quickly" },
|
|
22
|
+
{ value: "exit", label: "Exit", hint: "Close help" }
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
if (isCancel(choice) || choice === "exit") {
|
|
27
|
+
stepLine();
|
|
28
|
+
step("Goodbye!");
|
|
29
|
+
stepLine();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
stepLine();
|
|
34
|
+
|
|
35
|
+
switch (choice) {
|
|
36
|
+
case "commands":
|
|
37
|
+
await showCommands();
|
|
38
|
+
break;
|
|
39
|
+
case "options":
|
|
40
|
+
showOptions();
|
|
41
|
+
break;
|
|
42
|
+
case "quickstart":
|
|
43
|
+
showQuickStart();
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
stepLine();
|
|
48
|
+
|
|
49
|
+
// Ask what to do next
|
|
50
|
+
const next = await select({
|
|
51
|
+
message: "What's next?",
|
|
52
|
+
options: [
|
|
53
|
+
{ value: "back", label: "Back to menu", hint: "See other topics" },
|
|
54
|
+
{ value: "exit", label: "Exit", hint: "Close help" }
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (isCancel(next) || next === "exit") {
|
|
59
|
+
stepLine();
|
|
60
|
+
step("Goodbye!");
|
|
61
|
+
stepLine();
|
|
62
|
+
running = false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async function showCommands() {
|
|
68
|
+
step(c.bold("Available Commands"), S.diamondFilled, "cyan");
|
|
69
|
+
stepLine();
|
|
70
|
+
|
|
71
|
+
step(c.cyan("<org/repo>") + c.dim(" Install all skills from repository"));
|
|
72
|
+
step(c.dim("Example: kit agentskillkit/agent-skills"));
|
|
73
|
+
stepLine();
|
|
74
|
+
|
|
75
|
+
step(c.cyan("<org/repo#skill>") + c.dim(" Install specific skill"));
|
|
76
|
+
step(c.dim("Example: kit agentskillkit/agent-skills#react-patterns"));
|
|
77
|
+
stepLine();
|
|
78
|
+
|
|
79
|
+
step(c.cyan("list") + c.dim(" List installed skills"));
|
|
80
|
+
step(c.cyan("uninstall") + c.dim(" Remove skill(s) (interactive)"));
|
|
81
|
+
step(c.cyan("uninstall all") + c.dim(" Remove everything (automatic)"));
|
|
82
|
+
step(c.cyan("update <skill>") + c.dim(" Update a skill"));
|
|
83
|
+
step(c.cyan("verify") + c.dim(" Verify checksums"));
|
|
84
|
+
step(c.cyan("doctor") + c.dim(" Check health"));
|
|
85
|
+
step(c.cyan("lock") + c.dim(" Generate skill-lock.json"));
|
|
86
|
+
step(c.cyan("init") + c.dim(" Initialize skills directory"));
|
|
87
|
+
step(c.cyan("validate [skill]") + c.dim(" Validate against Antigravity spec"));
|
|
88
|
+
step(c.cyan("analyze <skill>") + c.dim(" Analyze skill structure"));
|
|
89
|
+
step(c.cyan("cache [info|clear]") + c.dim(" Manage cache"));
|
|
90
|
+
step(c.cyan("info <skill>") + c.dim(" Show skill info"));
|
|
91
|
+
|
|
92
|
+
stepLine();
|
|
93
|
+
|
|
94
|
+
// Interactive command selection
|
|
95
|
+
const executeCmd = await select({
|
|
96
|
+
message: "Execute a command?",
|
|
97
|
+
options: [
|
|
98
|
+
{ value: "list", label: "list", hint: "List installed skills" },
|
|
99
|
+
{ value: "doctor", label: "doctor", hint: "Check health" },
|
|
100
|
+
{ value: "verify", label: "verify", hint: "Verify checksums" },
|
|
101
|
+
{ value: "uninstall", label: "uninstall", hint: "Interactive removal" },
|
|
102
|
+
{ value: "lock", label: "lock", hint: "Generate lockfile" },
|
|
103
|
+
{ value: "init", label: "init", hint: "Initialize directory" },
|
|
104
|
+
{ value: "none", label: "← Back", hint: "Return to topics" }
|
|
105
|
+
]
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
if (!isCancel(executeCmd) && executeCmd !== "none") {
|
|
109
|
+
stepLine();
|
|
110
|
+
step(c.cyan(`Running: kit ${executeCmd}`));
|
|
111
|
+
stepLine();
|
|
112
|
+
|
|
113
|
+
// Dynamic import and execute command
|
|
114
|
+
try {
|
|
115
|
+
const commandModule = await import(`./${executeCmd}.js`);
|
|
116
|
+
await commandModule.run();
|
|
117
|
+
} catch (err) {
|
|
118
|
+
step(c.red(`Command not yet implemented: ${executeCmd}`));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function showOptions() {
|
|
124
|
+
step(c.bold("Available Options"), S.diamondFilled, "cyan");
|
|
125
|
+
stepLine();
|
|
126
|
+
|
|
127
|
+
step(c.cyan("--global, -g") + c.dim(" Use global scope (~/.gemini)"));
|
|
128
|
+
step(c.cyan("--force, -f") + c.dim(" Force operation without confirmation"));
|
|
129
|
+
step(c.cyan("--strict") + c.dim(" Fail on any violations"));
|
|
130
|
+
step(c.cyan("--fix") + c.dim(" Auto-fix issues (e.g., checksums)"));
|
|
131
|
+
step(c.cyan("--dry-run") + c.dim(" Preview changes without executing"));
|
|
132
|
+
step(c.cyan("--verbose, -v") + c.dim(" Show detailed output"));
|
|
133
|
+
step(c.cyan("--json") + c.dim(" Output in JSON format"));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function showQuickStart() {
|
|
137
|
+
step(c.bold("Quick Start Guide"), S.diamondFilled, "cyan");
|
|
138
|
+
stepLine();
|
|
139
|
+
|
|
140
|
+
step(c.bold("1. Install skills"));
|
|
141
|
+
step(" " + c.cyan("kit agentskillkit/agent-skills"));
|
|
142
|
+
stepLine();
|
|
143
|
+
|
|
144
|
+
step(c.bold("2. Choose scope"));
|
|
145
|
+
step(" " + c.dim("→ Current Project (local .agent/)"));
|
|
146
|
+
step(" " + c.dim("→ Global System (available everywhere)"));
|
|
147
|
+
stepLine();
|
|
148
|
+
|
|
149
|
+
step(c.bold("3. Check installation"));
|
|
150
|
+
step(" " + c.cyan("kit doctor"));
|
|
151
|
+
stepLine();
|
|
152
|
+
|
|
153
|
+
step(c.bold("4. Use in your AI"));
|
|
154
|
+
step(" " + c.dim("Skills are now available in .agent/skills/"));
|
|
155
|
+
}
|