add-skill-kit 3.2.7 → 3.2.8
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/bin/kit.js +89 -89
- package/bin/lib/agents.js +208 -208
- package/bin/lib/commands/analyze.js +70 -70
- package/bin/lib/commands/cache.js +65 -65
- package/bin/lib/commands/doctor.js +75 -75
- package/bin/lib/commands/help.js +155 -155
- package/bin/lib/commands/info.js +38 -38
- package/bin/lib/commands/init.js +39 -39
- package/bin/lib/commands/install.js +803 -803
- package/bin/lib/commands/list.js +43 -43
- package/bin/lib/commands/lock.js +57 -57
- package/bin/lib/commands/uninstall.js +307 -307
- package/bin/lib/commands/update.js +55 -55
- package/bin/lib/commands/validate.js +69 -69
- package/bin/lib/commands/verify.js +56 -56
- package/bin/lib/config.js +81 -81
- package/bin/lib/helpers.js +196 -196
- package/bin/lib/helpers.test.js +60 -60
- package/bin/lib/installer.js +164 -164
- package/bin/lib/skills.js +119 -119
- package/bin/lib/skills.test.js +109 -109
- package/bin/lib/types.js +82 -82
- package/bin/lib/ui.js +329 -329
- package/package.json +1 -1
package/bin/lib/commands/help.js
CHANGED
|
@@ -1,155 +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: "
|
|
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("
|
|
146
|
-
step(" " + c.dim("
|
|
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
|
-
}
|
|
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
|
+
}
|
package/bin/lib/commands/info.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Info command
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import fs from "fs";
|
|
6
|
-
import path from "path";
|
|
7
|
-
import { resolveScope, formatDate } from "../helpers.js";
|
|
8
|
-
import { step, stepLine, S, c, fatal } from "../ui.js";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Show skill info
|
|
12
|
-
* @param {string} name
|
|
13
|
-
*/
|
|
14
|
-
export async function run(name) {
|
|
15
|
-
if (!name) fatal("Missing skill name");
|
|
16
|
-
|
|
17
|
-
const scope = resolveScope();
|
|
18
|
-
const localDir = path.join(scope, name);
|
|
19
|
-
|
|
20
|
-
stepLine();
|
|
21
|
-
|
|
22
|
-
if (fs.existsSync(localDir)) {
|
|
23
|
-
step(`${c.bold(name)} ${c.green("(installed)")}`, S.diamondFilled, "cyan");
|
|
24
|
-
console.log(`${c.gray(S.branch)} ${c.dim("Path: " + localDir)}`);
|
|
25
|
-
|
|
26
|
-
const mf = path.join(localDir, ".skill-source.json");
|
|
27
|
-
if (fs.existsSync(mf)) {
|
|
28
|
-
const m = JSON.parse(fs.readFileSync(mf, "utf-8"));
|
|
29
|
-
console.log(`${c.gray(S.branch)} Repo: ${m.repo || "local"}`);
|
|
30
|
-
console.log(`${c.gray(S.branch)} Installed: ${formatDate(m.installedAt)}`);
|
|
31
|
-
}
|
|
32
|
-
stepLine();
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
step(`Skill not installed: ${name}`, S.diamond, "yellow");
|
|
37
|
-
stepLine();
|
|
38
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Info command
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import { resolveScope, formatDate } from "../helpers.js";
|
|
8
|
+
import { step, stepLine, S, c, fatal } from "../ui.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Show skill info
|
|
12
|
+
* @param {string} name
|
|
13
|
+
*/
|
|
14
|
+
export async function run(name) {
|
|
15
|
+
if (!name) fatal("Missing skill name");
|
|
16
|
+
|
|
17
|
+
const scope = resolveScope();
|
|
18
|
+
const localDir = path.join(scope, name);
|
|
19
|
+
|
|
20
|
+
stepLine();
|
|
21
|
+
|
|
22
|
+
if (fs.existsSync(localDir)) {
|
|
23
|
+
step(`${c.bold(name)} ${c.green("(installed)")}`, S.diamondFilled, "cyan");
|
|
24
|
+
console.log(`${c.gray(S.branch)} ${c.dim("Path: " + localDir)}`);
|
|
25
|
+
|
|
26
|
+
const mf = path.join(localDir, ".skill-source.json");
|
|
27
|
+
if (fs.existsSync(mf)) {
|
|
28
|
+
const m = JSON.parse(fs.readFileSync(mf, "utf-8"));
|
|
29
|
+
console.log(`${c.gray(S.branch)} Repo: ${m.repo || "local"}`);
|
|
30
|
+
console.log(`${c.gray(S.branch)} Installed: ${formatDate(m.installedAt)}`);
|
|
31
|
+
}
|
|
32
|
+
stepLine();
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
step(`Skill not installed: ${name}`, S.diamond, "yellow");
|
|
37
|
+
stepLine();
|
|
38
|
+
}
|
package/bin/lib/commands/init.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Init command
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import fs from "fs";
|
|
6
|
-
import { step, stepLine, S, success } from "../ui.js";
|
|
7
|
-
import { GLOBAL, GLOBAL_DIR, WORKSPACE, DRY, cwd } from "../config.js";
|
|
8
|
-
import path from "path";
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Initialize skills directory
|
|
12
|
-
*/
|
|
13
|
-
export async function run() {
|
|
14
|
-
stepLine();
|
|
15
|
-
|
|
16
|
-
const targetDir = GLOBAL ? GLOBAL_DIR : WORKSPACE;
|
|
17
|
-
|
|
18
|
-
if (fs.existsSync(targetDir)) {
|
|
19
|
-
step(`Skills directory already exists: ${targetDir}`, S.check, "green");
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
if (DRY) {
|
|
24
|
-
step(`Would create: ${targetDir}`, S.diamond);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
fs.mkdirSync(targetDir, { recursive: true });
|
|
29
|
-
|
|
30
|
-
// Create .gitignore if workspace
|
|
31
|
-
if (!GLOBAL) {
|
|
32
|
-
const gi = path.join(cwd, ".agent", ".gitignore");
|
|
33
|
-
if (!fs.existsSync(gi)) {
|
|
34
|
-
fs.writeFileSync(gi, "# Skill caches\nskills/*/.skill-source.json\n");
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
success(`Initialized: ${targetDir}`);
|
|
39
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Init command
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import { step, stepLine, S, success } from "../ui.js";
|
|
7
|
+
import { GLOBAL, GLOBAL_DIR, WORKSPACE, DRY, cwd } from "../config.js";
|
|
8
|
+
import path from "path";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Initialize skills directory
|
|
12
|
+
*/
|
|
13
|
+
export async function run() {
|
|
14
|
+
stepLine();
|
|
15
|
+
|
|
16
|
+
const targetDir = GLOBAL ? GLOBAL_DIR : WORKSPACE;
|
|
17
|
+
|
|
18
|
+
if (fs.existsSync(targetDir)) {
|
|
19
|
+
step(`Skills directory already exists: ${targetDir}`, S.check, "green");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (DRY) {
|
|
24
|
+
step(`Would create: ${targetDir}`, S.diamond);
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
29
|
+
|
|
30
|
+
// Create .gitignore if workspace
|
|
31
|
+
if (!GLOBAL) {
|
|
32
|
+
const gi = path.join(cwd, ".agent", ".gitignore");
|
|
33
|
+
if (!fs.existsSync(gi)) {
|
|
34
|
+
fs.writeFileSync(gi, "# Skill caches\nskills/*/.skill-source.json\n");
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
success(`Initialized: ${targetDir}`);
|
|
39
|
+
}
|