@minhluudev/ai-tools 1.0.21 → 1.0.25
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/README.md +5 -31
- package/dist/src/bin/ai-tools.js +1 -2
- package/dist/src/cli.js +1 -221
- package/dist/src/lib/agent-selection.js +60 -0
- package/dist/src/lib/catalog.js +4 -1
- package/dist/src/lib/config.js +0 -2
- package/dist/src/lib/install.js +45 -79
- package/dist/src/lib/selection-catalog.js +6 -2
- package/dist/src/lib/tui-entry-menu.js +0 -24
- package/dist/src/lib/tui-skills.js +4 -2
- package/dist/src/lib/tui-wizard.js +14 -24
- package/package.json +7 -7
- package/selection-catalog.json +31 -66
- package/dist/src/lib/ai-libs.js +0 -417
- package/dist/src/lib/mcp.js +0 -665
- package/dist/src/lib/plugins.js +0 -155
- package/dist/src/lib/project-docs-catalog.js +0 -45
- package/dist/src/lib/tui-ai-libs.js +0 -539
- package/dist/src/lib/tui-mcp.js +0 -514
- package/dist/src/lib/tui-plugins.js +0 -408
- package/dist/src/lib/tui-project-docs.js +0 -303
- package/project-docs-catalog.json +0 -19
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ai-tools
|
|
2
2
|
|
|
3
|
-
`@minhluudev/ai-tools` is a personal CLI for installing
|
|
3
|
+
`@minhluudev/ai-tools` is a personal CLI for installing AI tools and agent skills that I use in my own workflow.
|
|
4
4
|
|
|
5
5
|
## Install
|
|
6
6
|
|
|
@@ -17,11 +17,8 @@ ai-tools
|
|
|
17
17
|
Main menu:
|
|
18
18
|
|
|
19
19
|
1. `Install agent skills`
|
|
20
|
-
2. `
|
|
21
|
-
3. `
|
|
22
|
-
4. `Install plugin`
|
|
23
|
-
5. `Install mcp`
|
|
24
|
-
6. `Cancel`
|
|
20
|
+
2. `Manage skills`
|
|
21
|
+
3. `Cancel`
|
|
25
22
|
|
|
26
23
|
Controls:
|
|
27
24
|
|
|
@@ -31,28 +28,5 @@ Controls:
|
|
|
31
28
|
- `q` or `esc` cancel
|
|
32
29
|
|
|
33
30
|
`Install agent skills`
|
|
34
|
-
- installs selected skills into `~/.codex`, `~/.claude`,
|
|
35
|
-
|
|
36
|
-
`Install project docs`
|
|
37
|
-
- copies the contents inside the selected docs folder into the current working directory
|
|
38
|
-
|
|
39
|
-
`Install libs for AI`
|
|
40
|
-
- opens a guided workflow with tabs for `Libraries`, `Agents`, `OS`, `Scope`, `Mode`, and `Review`
|
|
41
|
-
- supports `rtk-ai/rtk`, `rtk-ai/icm`, and `affaan-m/ECC`
|
|
42
|
-
- runs the current upstream install flow for each selected library and prints safety notes when an upstream flow is broader than the selected agent or scope
|
|
43
|
-
- for `ECC`, clones the upstream repo into a temporary directory and runs the documented repo-based setup flow for the selected agent, with warnings about the documented Claude plugin overlap
|
|
44
|
-
|
|
45
|
-
`Install plugin`
|
|
46
|
-
- opens a guided workflow with tabs for `Plugins`, `Agents`, `Mode`, and `Review`
|
|
47
|
-
- currently supports `Lumin`
|
|
48
|
-
- loads the plugin bundle from the repository `plugins` branch at runtime, so the main branch CLI can install it without vendoring the plugin files into `main`
|
|
49
|
-
- supports `Install` and `Uninstall`
|
|
50
|
-
- installs plugins in global mode only
|
|
51
|
-
|
|
52
|
-
`Install mcp`
|
|
53
|
-
- opens a guided workflow with tabs for `Select MCP`, `Agent`, `Mode`, and `Review`
|
|
54
|
-
- supports `Ant Design`, `GitLab`, `GitHub`, `Figma`, and `Shadcn`
|
|
55
|
-
- supports selecting `Codex`, `Claude`, or both in the same run
|
|
56
|
-
- supports `Install` and `Uninstall`
|
|
57
|
-
- builds commands from current official MCP setup docs, executes the selected plan, and prints any extra configuration still required after install
|
|
58
|
-
- in `Uninstall`, runs a safety preflight so removals target only the expected scope/config and warn when similarly named entries exist elsewhere
|
|
31
|
+
- installs selected skills into `~/.codex`, `~/.claude`, or `~/.pi/agent` globally
|
|
32
|
+
- installs project-local skills into `./.codex`, `./.claude`, or `./.pi`
|
package/dist/src/bin/ai-tools.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { runCli } from "../cli.js";
|
|
3
3
|
function isCancellationMessage(message) {
|
|
4
4
|
return message === "Installation cancelled."
|
|
5
|
-
|| message === "Installation cancelled because existing targets would be overwritten."
|
|
6
|
-
|| message === "MCP workflow cancelled.";
|
|
5
|
+
|| message === "Installation cancelled because existing targets would be overwritten.";
|
|
7
6
|
}
|
|
8
7
|
runCli().catch((error) => {
|
|
9
8
|
const message = error instanceof Error ? error.message : String(error);
|
package/dist/src/cli.js
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
import * as process from "node:process";
|
|
2
2
|
import { rm } from "node:fs/promises";
|
|
3
|
-
import { buildLibInstallPlan, executeLibInstallPlan } from "./lib/ai-libs.js";
|
|
4
3
|
import { loadPackageConfig } from "./lib/config.js";
|
|
5
4
|
import { createGitHubClient } from "./lib/github.js";
|
|
6
|
-
import { detectExistingTargets, installPlannedItems,
|
|
7
|
-
import { loadProjectDocsCatalog } from "./lib/project-docs-catalog.js";
|
|
5
|
+
import { detectExistingTargets, installPlannedItems, planInstallations, resolveInstallRoot } from "./lib/install.js";
|
|
8
6
|
import { loadSelectionCatalog, resolveSelectionItems } from "./lib/selection-catalog.js";
|
|
9
|
-
import { buildMcpInstallPlan, createMcpUninstallBackups, executeMcpInstallPlan, inspectMcpUninstallSafety, verifyMcpUninstallExecutionSafety } from "./lib/mcp.js";
|
|
10
|
-
import { buildPluginInstallPlan, executePluginInstallPlan } from "./lib/plugins.js";
|
|
11
7
|
import { blessedConfirm } from "./lib/tui-utils.js";
|
|
12
8
|
import { runSkillsWizard, resolveSkillsDir } from "./lib/tui-skills.js";
|
|
13
|
-
import { runAiLibsWizard } from "./lib/tui-ai-libs.js";
|
|
14
9
|
import { runEntryMenu } from "./lib/tui-entry-menu.js";
|
|
15
|
-
import { runMcpWizard } from "./lib/tui-mcp.js";
|
|
16
|
-
import { runPluginWizard } from "./lib/tui-plugins.js";
|
|
17
|
-
import { runProjectDocsWizard } from "./lib/tui-project-docs.js";
|
|
18
10
|
import { runTabbedWizard } from "./lib/tui-wizard.js";
|
|
19
11
|
const ANSI = {
|
|
20
12
|
reset: "\u001B[0m",
|
|
@@ -135,224 +127,12 @@ function printSkillSelectionSummary(input) {
|
|
|
135
127
|
rows.push(["Locations", input.locations.length ? input.locations.join(", ") : "none"], ["Agents", input.agents.length ? input.agents.join(", ") : "none"]);
|
|
136
128
|
printLabeledRows("Selected items", rows);
|
|
137
129
|
}
|
|
138
|
-
function printProjectDocsSelectionSummary(input) {
|
|
139
|
-
printLabeledRows("Selected items", [
|
|
140
|
-
["Skills", input.selectedSkills.map((skill) => skill.label).join(", ")],
|
|
141
|
-
["Install root", resolveProjectDocsRoot(input.cwd)]
|
|
142
|
-
]);
|
|
143
|
-
}
|
|
144
|
-
function printLibInstallSelectionSummary(plan) {
|
|
145
|
-
printLabeledRows("Selected items", [
|
|
146
|
-
["Mode", plan.mode],
|
|
147
|
-
["Libraries", plan.libraries.length ? plan.libraries.join(", ") : "none"],
|
|
148
|
-
["Agents", plan.agents.length ? plan.agents.join(", ") : "none"],
|
|
149
|
-
["OS", plan.os],
|
|
150
|
-
["Scope", plan.scope],
|
|
151
|
-
["Host OS", plan.hostOs ?? "unsupported"]
|
|
152
|
-
]);
|
|
153
|
-
}
|
|
154
|
-
function printMcpInstallSelectionSummary(plan) {
|
|
155
|
-
printLabeledRows("Selected items", [
|
|
156
|
-
["Mode", plan.mode],
|
|
157
|
-
["Agents", plan.agents.length ? plan.agents.join(", ") : "none"],
|
|
158
|
-
["MCPs", plan.servers.length ? plan.servers.join(", ") : "none"],
|
|
159
|
-
["OS", plan.os === "mac" ? "MacOS" : "Linux"]
|
|
160
|
-
]);
|
|
161
|
-
}
|
|
162
|
-
function printPluginInstallSelectionSummary(plan) {
|
|
163
|
-
printLabeledRows("Selected items", [
|
|
164
|
-
["Mode", plan.mode],
|
|
165
|
-
["Plugins", plan.plugins.length ? plan.plugins.join(", ") : "none"],
|
|
166
|
-
["Agents", plan.agents.length ? plan.agents.join(", ") : "none"],
|
|
167
|
-
["Source branch", plan.sourceBranch]
|
|
168
|
-
]);
|
|
169
|
-
}
|
|
170
130
|
export async function runCli() {
|
|
171
131
|
while (true) {
|
|
172
132
|
const entryAction = await runEntryMenu();
|
|
173
133
|
if (entryAction === "cancel") {
|
|
174
134
|
return;
|
|
175
135
|
}
|
|
176
|
-
if (entryAction === "install-libs") {
|
|
177
|
-
const libsResult = await runAiLibsWizard();
|
|
178
|
-
if ("backToMenu" in libsResult) {
|
|
179
|
-
continue;
|
|
180
|
-
}
|
|
181
|
-
const plan = buildLibInstallPlan({
|
|
182
|
-
mode: libsResult.mode,
|
|
183
|
-
os: libsResult.os,
|
|
184
|
-
scope: libsResult.scope,
|
|
185
|
-
agents: libsResult.agents,
|
|
186
|
-
libraries: libsResult.libraries
|
|
187
|
-
});
|
|
188
|
-
printSectionHeader("Install libs for AI", libsResult.mode === "install"
|
|
189
|
-
? "Preparing upstream RTK, ICM, and ECC installers."
|
|
190
|
-
: "Preparing safe RTK, ICM, and ECC removal steps.");
|
|
191
|
-
printLibInstallSelectionSummary(plan);
|
|
192
|
-
if (plan.notes.length > 0) {
|
|
193
|
-
printBulletPanel("Notes", plan.notes, "warning");
|
|
194
|
-
}
|
|
195
|
-
printBulletPanel(`Execution plan (${plan.steps.length})`, plan.steps.map((step) => `${step.title}: ${step.command}`), "muted");
|
|
196
|
-
printStatusLine(plan.mode === "install" ? "install" : "uninstall", plan.mode === "install"
|
|
197
|
-
? "Running selected library installers and setup commands..."
|
|
198
|
-
: "Running selected library cleanup and uninstall commands...");
|
|
199
|
-
await executeLibInstallPlan({
|
|
200
|
-
cwd: process.cwd(),
|
|
201
|
-
plan,
|
|
202
|
-
onProgress(step) {
|
|
203
|
-
printStatusLine("run", `${step.title} -> ${step.command}`, "muted");
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
printBulletPanel(`Install complete (${plan.steps.length})`, plan.steps.map((step) => step.title), "success");
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
if (entryAction === "install-plugin") {
|
|
210
|
-
const config = await loadPackageConfig();
|
|
211
|
-
const pluginResult = await runPluginWizard();
|
|
212
|
-
if ("backToMenu" in pluginResult) {
|
|
213
|
-
continue;
|
|
214
|
-
}
|
|
215
|
-
const plan = buildPluginInstallPlan({
|
|
216
|
-
mode: pluginResult.mode,
|
|
217
|
-
agents: pluginResult.agents,
|
|
218
|
-
plugins: pluginResult.plugins,
|
|
219
|
-
sourceBranch: config.github.pluginsBranch
|
|
220
|
-
});
|
|
221
|
-
printSectionHeader("Install plugin", pluginResult.mode === "install"
|
|
222
|
-
? "Preparing plugin bundle from the dedicated plugins branch."
|
|
223
|
-
: "Preparing plugin removal using the dedicated plugins branch.");
|
|
224
|
-
printPluginInstallSelectionSummary(plan);
|
|
225
|
-
if (plan.notes.length > 0) {
|
|
226
|
-
printBulletPanel("Notes", plan.notes, "warning");
|
|
227
|
-
}
|
|
228
|
-
printBulletPanel(`Execution plan (${plan.steps.length})`, plan.steps.map((step) => `${step.title}: ${step.command}`), "muted");
|
|
229
|
-
const client = createGitHubClient(config.github);
|
|
230
|
-
printStatusLine(plan.mode === "install" ? "install" : "uninstall", plan.mode === "install"
|
|
231
|
-
? "Running selected plugin installers..."
|
|
232
|
-
: "Running selected plugin uninstallers...");
|
|
233
|
-
await executePluginInstallPlan({
|
|
234
|
-
cwd: process.cwd(),
|
|
235
|
-
client,
|
|
236
|
-
plan,
|
|
237
|
-
onProgress(step) {
|
|
238
|
-
printStatusLine("run", `${step.title} -> ${step.command}`, "muted");
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
printBulletPanel(`${plan.mode === "install" ? "Install" : "Uninstall"} complete (${plan.steps.length})`, plan.steps.map((step) => step.title), "success");
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
if (entryAction === "install-mcp") {
|
|
245
|
-
const mcpResult = await runMcpWizard();
|
|
246
|
-
if ("backToMenu" in mcpResult) {
|
|
247
|
-
continue;
|
|
248
|
-
}
|
|
249
|
-
const plan = buildMcpInstallPlan({
|
|
250
|
-
mode: mcpResult.mode,
|
|
251
|
-
agents: mcpResult.agents,
|
|
252
|
-
servers: mcpResult.servers,
|
|
253
|
-
os: mcpResult.os
|
|
254
|
-
});
|
|
255
|
-
const uninstallSafety = plan.mode === "uninstall"
|
|
256
|
-
? await inspectMcpUninstallSafety({
|
|
257
|
-
cwd: process.cwd(),
|
|
258
|
-
plan
|
|
259
|
-
})
|
|
260
|
-
: null;
|
|
261
|
-
const effectiveServers = uninstallSafety
|
|
262
|
-
? [...new Set(uninstallSafety.effectiveSteps.map((s) => s.server))]
|
|
263
|
-
: plan.servers;
|
|
264
|
-
const effectivePlan = uninstallSafety
|
|
265
|
-
? {
|
|
266
|
-
...buildMcpInstallPlan({
|
|
267
|
-
mode: plan.mode,
|
|
268
|
-
agents: plan.agents,
|
|
269
|
-
servers: effectiveServers,
|
|
270
|
-
os: plan.os
|
|
271
|
-
}),
|
|
272
|
-
steps: uninstallSafety.effectiveSteps
|
|
273
|
-
}
|
|
274
|
-
: plan;
|
|
275
|
-
printSectionHeader("Install mcp", plan.mode === "install"
|
|
276
|
-
? "Preparing MCP registration commands from current official setup docs."
|
|
277
|
-
: "Preparing MCP removal commands from current official setup docs.");
|
|
278
|
-
printMcpInstallSelectionSummary(effectivePlan);
|
|
279
|
-
if (effectivePlan.notes.length > 0) {
|
|
280
|
-
printBulletPanel("Notes", effectivePlan.notes, "warning");
|
|
281
|
-
}
|
|
282
|
-
if (effectivePlan.postInstallConfig.length > 0) {
|
|
283
|
-
printBulletPanel("Required configuration after install", effectivePlan.postInstallConfig, "warning");
|
|
284
|
-
}
|
|
285
|
-
if (uninstallSafety?.safeNotes.length) {
|
|
286
|
-
printBulletPanel("Uninstall safety check", uninstallSafety.safeNotes, "warning");
|
|
287
|
-
}
|
|
288
|
-
if (uninstallSafety?.skippedSteps.length) {
|
|
289
|
-
printBulletPanel("Skipped uninstall steps", uninstallSafety.skippedSteps.map((item) => item.reason), "warning");
|
|
290
|
-
}
|
|
291
|
-
printBulletPanel(`Execution plan (${effectivePlan.steps.length})`, effectivePlan.steps.map((step) => `${step.title}: ${step.command}`), "muted");
|
|
292
|
-
if (effectivePlan.sources.length > 0) {
|
|
293
|
-
printBulletPanel("Sources", effectivePlan.sources.map((source) => `${source.label}: ${source.url}`), "muted");
|
|
294
|
-
}
|
|
295
|
-
printStatusLine(effectivePlan.mode === "install" ? "install" : "uninstall", effectivePlan.mode === "install"
|
|
296
|
-
? "Running selected MCP setup commands..."
|
|
297
|
-
: "Running selected MCP removal commands...");
|
|
298
|
-
if (uninstallSafety?.effectiveSteps.length) {
|
|
299
|
-
const backupPaths = await createMcpUninstallBackups({
|
|
300
|
-
cwd: process.cwd(),
|
|
301
|
-
steps: uninstallSafety.effectiveSteps
|
|
302
|
-
});
|
|
303
|
-
if (backupPaths.length > 0) {
|
|
304
|
-
printBulletPanel("Config backups created", backupPaths, "warning");
|
|
305
|
-
}
|
|
306
|
-
await verifyMcpUninstallExecutionSafety({
|
|
307
|
-
cwd: process.cwd(),
|
|
308
|
-
originalPlan: plan,
|
|
309
|
-
expectedSteps: uninstallSafety.effectiveSteps
|
|
310
|
-
});
|
|
311
|
-
printStatusLine("verify", "Final uninstall verification passed.", "warning");
|
|
312
|
-
}
|
|
313
|
-
await executeMcpInstallPlan({
|
|
314
|
-
cwd: process.cwd(),
|
|
315
|
-
plan: effectivePlan,
|
|
316
|
-
onProgress(step) {
|
|
317
|
-
printStatusLine("run", `${step.title} -> ${step.command}`, "muted");
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
printBulletPanel(`${effectivePlan.mode === "install" ? "Install" : "Uninstall"} complete (${effectivePlan.steps.length})`, effectivePlan.steps.map((step) => step.title), "success");
|
|
321
|
-
if (effectivePlan.postInstallConfig.length > 0) {
|
|
322
|
-
printBulletPanel("Next configuration steps", effectivePlan.postInstallConfig, "warning");
|
|
323
|
-
}
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
if (entryAction === "install-project-docs") {
|
|
327
|
-
const config = await loadPackageConfig();
|
|
328
|
-
const projectDocsCatalog = await loadProjectDocsCatalog(config);
|
|
329
|
-
const projectDocsResult = await runProjectDocsWizard(projectDocsCatalog);
|
|
330
|
-
if ("backToMenu" in projectDocsResult) {
|
|
331
|
-
continue;
|
|
332
|
-
}
|
|
333
|
-
printSectionHeader("Install project docs", "Preparing selected project docs for resolution and installation.");
|
|
334
|
-
printProjectDocsSelectionSummary({
|
|
335
|
-
selectedSkills: projectDocsResult.selectedSkills,
|
|
336
|
-
cwd: process.cwd()
|
|
337
|
-
});
|
|
338
|
-
printStatusLine("resolve", "Resolving selected sources...");
|
|
339
|
-
const client = createGitHubClient(config.github);
|
|
340
|
-
const plannedItems = planProjectDocsInstallations({
|
|
341
|
-
skills: projectDocsResult.selectedSkills,
|
|
342
|
-
cwd: process.cwd()
|
|
343
|
-
});
|
|
344
|
-
printStatusLine("install", "Installing selected project docs...");
|
|
345
|
-
const results = await installProjectDocsItems({
|
|
346
|
-
plannedItems,
|
|
347
|
-
client,
|
|
348
|
-
overwriteExisting: false,
|
|
349
|
-
onProgress(item) {
|
|
350
|
-
printStatusLine("write", formatInstallProgressLine(item), "muted");
|
|
351
|
-
}
|
|
352
|
-
});
|
|
353
|
-
printBulletPanel(`Install complete (${results.length})`, results.map((result) => `${result.id} -> ${result.targetPath}`), "success");
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
136
|
if (entryAction === "manage-skills") {
|
|
357
137
|
const skillsResult = await runSkillsWizard();
|
|
358
138
|
if ("backToMenu" in skillsResult) {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export const AGENT_SELECTION_CHOICES = [
|
|
2
|
+
{
|
|
3
|
+
id: "codex",
|
|
4
|
+
label: "◇ Codex",
|
|
5
|
+
description: "Install as Codex skills."
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
id: "claude",
|
|
9
|
+
label: "◇ Claude",
|
|
10
|
+
description: "Install as Claude custom agents."
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: "pi",
|
|
14
|
+
label: "◇ Pi",
|
|
15
|
+
description: "Install as Pi skills."
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
id: "both",
|
|
19
|
+
label: "◇ Both (Codex + Claude)",
|
|
20
|
+
description: "Install for both Codex and Claude."
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
const BOTH_AGENTS = ["codex", "claude"];
|
|
24
|
+
const ALL_AGENTS = ["codex", "claude", "pi"];
|
|
25
|
+
export function isAgentOptionSelected(option, selectedAgents) {
|
|
26
|
+
if (option === "both") {
|
|
27
|
+
return BOTH_AGENTS.every((agent) => selectedAgents.has(agent));
|
|
28
|
+
}
|
|
29
|
+
return selectedAgents.has(option);
|
|
30
|
+
}
|
|
31
|
+
export function toggleAgentOption(selectedAgents, option) {
|
|
32
|
+
if (option === "both") {
|
|
33
|
+
if (BOTH_AGENTS.every((agent) => selectedAgents.has(agent))) {
|
|
34
|
+
for (const agent of BOTH_AGENTS) {
|
|
35
|
+
selectedAgents.delete(agent);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
for (const agent of BOTH_AGENTS) {
|
|
40
|
+
selectedAgents.add(agent);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (selectedAgents.has(option)) {
|
|
46
|
+
selectedAgents.delete(option);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
selectedAgents.add(option);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export function toggleAllAgents(selectedAgents) {
|
|
53
|
+
if (ALL_AGENTS.every((agent) => selectedAgents.has(agent))) {
|
|
54
|
+
selectedAgents.clear();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
for (const agent of ALL_AGENTS) {
|
|
58
|
+
selectedAgents.add(agent);
|
|
59
|
+
}
|
|
60
|
+
}
|
package/dist/src/lib/catalog.js
CHANGED
|
@@ -59,7 +59,10 @@ export function validateManifest(rawManifest, input) {
|
|
|
59
59
|
if (manifestItem.targets.claude) {
|
|
60
60
|
targets.claude = validateTarget(manifestItem.targets.claude, "claude", manifestItem.id);
|
|
61
61
|
}
|
|
62
|
-
if (
|
|
62
|
+
if (manifestItem.targets.pi) {
|
|
63
|
+
targets.pi = validateTarget(manifestItem.targets.pi, "pi", manifestItem.id);
|
|
64
|
+
}
|
|
65
|
+
if (!targets.codex && !targets.claude && !targets.pi) {
|
|
63
66
|
throw new Error(`Manifest item "${manifestItem.id}" in branch "${input.branch}" must support at least one agent.`);
|
|
64
67
|
}
|
|
65
68
|
return {
|
package/dist/src/lib/config.js
CHANGED
|
@@ -13,13 +13,11 @@ export async function loadPackageConfig() {
|
|
|
13
13
|
return {
|
|
14
14
|
packageRoot: PACKAGE_ROOT,
|
|
15
15
|
selectionCatalogPath: aiTools.selectionCatalogPath || "selection-catalog.json",
|
|
16
|
-
projectDocsCatalogPath: aiTools.projectDocsCatalogPath || "project-docs-catalog.json",
|
|
17
16
|
github: {
|
|
18
17
|
owner: aiTools.github.owner,
|
|
19
18
|
repo: aiTools.github.repo,
|
|
20
19
|
defaultBranch: aiTools.github.defaultBranch || "main",
|
|
21
20
|
skillsBranch: aiTools.github.skillsBranch || "skill-general",
|
|
22
|
-
pluginsBranch: aiTools.github.pluginsBranch || "plugins",
|
|
23
21
|
manifestPath: aiTools.github.manifestPath || "ai-tools.catalog.json",
|
|
24
22
|
excludeBranches: aiTools.github.excludeBranches || ["main", "master"]
|
|
25
23
|
}
|
package/dist/src/lib/install.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { access, cp, mkdir, mkdtemp, readdir, rm } from "node:fs/promises";
|
|
1
|
+
import { access, cp, lstat, mkdir, mkdtemp, readdir, rm } from "node:fs/promises";
|
|
2
2
|
import * as os from "node:os";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { normalizeManifestPath, resolveInsideRoot } from "./paths.js";
|
|
5
5
|
const AGENT_INSTALL_DIR = {
|
|
6
|
-
codex: ".codex",
|
|
7
|
-
claude: ".claude"
|
|
6
|
+
codex: { global: ".codex", local: ".codex" },
|
|
7
|
+
claude: { global: ".claude", local: ".claude" },
|
|
8
|
+
pi: { global: ".pi/agent", local: ".pi" }
|
|
8
9
|
};
|
|
9
10
|
export function resolveInstallRoot(input) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return path.join(os.homedir(), dir);
|
|
11
|
+
if (input.location !== "global" && input.location !== "local") {
|
|
12
|
+
throw new Error(`Unsupported install location "${input.location}".`);
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
throw new Error(`Unsupported install location "${input.location}".`);
|
|
18
|
-
}
|
|
19
|
-
export function resolveProjectDocsRoot(cwd) {
|
|
20
|
-
return cwd;
|
|
14
|
+
const basePath = input.location === "global" ? os.homedir() : input.cwd;
|
|
15
|
+
const dir = AGENT_INSTALL_DIR[input.agent][input.location];
|
|
16
|
+
return path.join(basePath, dir);
|
|
21
17
|
}
|
|
22
18
|
function defaultOutputPath(item) {
|
|
23
19
|
return path.posix.join("skills", item.id);
|
|
24
20
|
}
|
|
25
21
|
export function planInstallations(input) {
|
|
26
22
|
return input.items.flatMap((item) => {
|
|
27
|
-
const
|
|
23
|
+
const explicitTarget = item.targets[input.agent];
|
|
24
|
+
const piDirectoryFallback = input.agent === "pi" &&
|
|
25
|
+
!explicitTarget &&
|
|
26
|
+
Object.values(item.targets).some((existing) => existing?.type === "directory");
|
|
27
|
+
const target = explicitTarget ?? (piDirectoryFallback ? { type: "directory" } : undefined);
|
|
28
28
|
if (!target) {
|
|
29
29
|
return [];
|
|
30
30
|
}
|
|
@@ -35,7 +35,8 @@ export function planInstallations(input) {
|
|
|
35
35
|
agent: input.agent,
|
|
36
36
|
targetType: target.type,
|
|
37
37
|
outputPath,
|
|
38
|
-
targetPath: resolveInsideRoot(input.installRoot, outputPath)
|
|
38
|
+
targetPath: resolveInsideRoot(input.installRoot, outputPath),
|
|
39
|
+
...(piDirectoryFallback ? { piDirectoryFallback: true } : {})
|
|
39
40
|
}];
|
|
40
41
|
});
|
|
41
42
|
}
|
|
@@ -52,24 +53,33 @@ export async function detectExistingTargets(plannedItems) {
|
|
|
52
53
|
}
|
|
53
54
|
return existingItems;
|
|
54
55
|
}
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
56
|
+
async function validatePiFallbackSource(sourcePath, skillId) {
|
|
57
|
+
const invalidSourceMessage = `Cannot install "${skillId}" for Pi: source must be a directory with a regular SKILL.md and no symbolic links.`;
|
|
58
|
+
const sourceStat = await lstat(sourcePath);
|
|
59
|
+
let skillFileStat;
|
|
60
|
+
try {
|
|
61
|
+
skillFileStat = await lstat(path.join(sourcePath, "SKILL.md"));
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
throw new Error(invalidSourceMessage);
|
|
65
|
+
}
|
|
66
|
+
if (!sourceStat.isDirectory() || !skillFileStat.isFile()) {
|
|
67
|
+
throw new Error(invalidSourceMessage);
|
|
68
|
+
}
|
|
69
|
+
async function rejectSymbolicLinks(directory) {
|
|
70
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
71
|
+
for (const entry of entries) {
|
|
72
|
+
const entryPath = path.join(directory, entry.name);
|
|
73
|
+
const entryStat = await lstat(entryPath);
|
|
74
|
+
if (entryStat.isSymbolicLink()) {
|
|
75
|
+
throw new Error(invalidSourceMessage);
|
|
76
|
+
}
|
|
77
|
+
if (entryStat.isDirectory()) {
|
|
78
|
+
await rejectSymbolicLinks(entryPath);
|
|
79
|
+
}
|
|
63
80
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
label: skill.label,
|
|
67
|
-
description: skill.description,
|
|
68
|
-
sourceBranch: skill.sourceBranch,
|
|
69
|
-
sourcePath: skill.sourcePath,
|
|
70
|
-
targetPath: installRoot
|
|
71
|
-
};
|
|
72
|
-
});
|
|
81
|
+
}
|
|
82
|
+
await rejectSymbolicLinks(sourcePath);
|
|
73
83
|
}
|
|
74
84
|
async function copyToTarget(input) {
|
|
75
85
|
await mkdir(path.dirname(input.targetPath), { recursive: true });
|
|
@@ -83,22 +93,6 @@ async function copyToTarget(input) {
|
|
|
83
93
|
errorOnExist: !input.overwriteExisting
|
|
84
94
|
});
|
|
85
95
|
}
|
|
86
|
-
async function copyDirectoryContents(input) {
|
|
87
|
-
await mkdir(input.targetDir, { recursive: true });
|
|
88
|
-
const entries = await readdir(input.sourceDir, { withFileTypes: true });
|
|
89
|
-
for (const entry of entries) {
|
|
90
|
-
const sourcePath = path.join(input.sourceDir, entry.name);
|
|
91
|
-
const targetPath = path.join(input.targetDir, entry.name);
|
|
92
|
-
if (input.overwriteExisting) {
|
|
93
|
-
await rm(targetPath, { recursive: true, force: true });
|
|
94
|
-
}
|
|
95
|
-
await cp(sourcePath, targetPath, {
|
|
96
|
-
recursive: entry.isDirectory(),
|
|
97
|
-
force: input.overwriteExisting,
|
|
98
|
-
errorOnExist: !input.overwriteExisting
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
96
|
export async function installPlannedItems(input) {
|
|
103
97
|
const results = [];
|
|
104
98
|
const archiveCache = new Map();
|
|
@@ -118,6 +112,9 @@ export async function installPlannedItems(input) {
|
|
|
118
112
|
entryPath: item.sourcePath,
|
|
119
113
|
destinationDir: tempDir
|
|
120
114
|
});
|
|
115
|
+
if (item.piDirectoryFallback) {
|
|
116
|
+
await validatePiFallbackSource(extractedPath, item.id);
|
|
117
|
+
}
|
|
121
118
|
await copyToTarget({
|
|
122
119
|
sourcePath: extractedPath,
|
|
123
120
|
targetPath: item.targetPath,
|
|
@@ -131,34 +128,3 @@ export async function installPlannedItems(input) {
|
|
|
131
128
|
}
|
|
132
129
|
return results;
|
|
133
130
|
}
|
|
134
|
-
export async function installProjectDocsItems(input) {
|
|
135
|
-
const results = [];
|
|
136
|
-
const archiveCache = new Map();
|
|
137
|
-
for (const item of input.plannedItems) {
|
|
138
|
-
input.onProgress?.(item);
|
|
139
|
-
let archivePath = archiveCache.get(item.sourceBranch);
|
|
140
|
-
if (!archivePath) {
|
|
141
|
-
archivePath = await input.client.getArchive({
|
|
142
|
-
branch: item.sourceBranch,
|
|
143
|
-
sha: "latest"
|
|
144
|
-
});
|
|
145
|
-
archiveCache.set(item.sourceBranch, archivePath);
|
|
146
|
-
}
|
|
147
|
-
const tempDir = await mkdtemp(path.join(os.tmpdir(), "ai-tools-project-docs-"));
|
|
148
|
-
const extractedPath = await input.client.extractArchiveEntry({
|
|
149
|
-
archivePath,
|
|
150
|
-
entryPath: item.sourcePath,
|
|
151
|
-
destinationDir: tempDir
|
|
152
|
-
});
|
|
153
|
-
await copyDirectoryContents({
|
|
154
|
-
sourceDir: extractedPath,
|
|
155
|
-
targetDir: item.targetPath,
|
|
156
|
-
overwriteExisting: input.overwriteExisting
|
|
157
|
-
});
|
|
158
|
-
results.push({
|
|
159
|
-
id: item.id,
|
|
160
|
-
targetPath: item.targetPath
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
return results;
|
|
164
|
-
}
|
|
@@ -23,7 +23,7 @@ function validateSelectionEntry(rawEntry, kind, index) {
|
|
|
23
23
|
if (entry.targets && typeof entry.targets === "object" && !Array.isArray(entry.targets)) {
|
|
24
24
|
const rawTargets = entry.targets;
|
|
25
25
|
targets = {};
|
|
26
|
-
for (const agent of ["codex", "claude"]) {
|
|
26
|
+
for (const agent of ["codex", "claude", "pi"]) {
|
|
27
27
|
if (rawTargets[agent]) {
|
|
28
28
|
targets[agent] = validateTarget(rawTargets[agent], agent, entry.id.trim());
|
|
29
29
|
}
|
|
@@ -101,7 +101,11 @@ export async function resolveSelectionItems(input) {
|
|
|
101
101
|
description: selection.description,
|
|
102
102
|
sourceBranch,
|
|
103
103
|
sourcePath: selection.sourcePath,
|
|
104
|
-
targets: selection.targets ?? {
|
|
104
|
+
targets: selection.targets ?? {
|
|
105
|
+
codex: { type: "directory" },
|
|
106
|
+
claude: { type: "directory" },
|
|
107
|
+
pi: { type: "directory" }
|
|
108
|
+
}
|
|
105
109
|
});
|
|
106
110
|
continue;
|
|
107
111
|
}
|
|
@@ -7,30 +7,6 @@ const MENU_ITEMS = [
|
|
|
7
7
|
description: "Open the guided installer for Codex skills and Claude custom agents.",
|
|
8
8
|
meta: "Codex + Claude"
|
|
9
9
|
},
|
|
10
|
-
{
|
|
11
|
-
id: "install-project-docs",
|
|
12
|
-
label: "▤ Install project docs",
|
|
13
|
-
description: "Copy selected project docs and workflow templates into the current repository.",
|
|
14
|
-
meta: "Current repo"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
id: "install-libs",
|
|
18
|
-
label: "⬡ Install libs for AI",
|
|
19
|
-
description: "Install RTK, ICM, or ECC, then run the supported setup flow for Codex and Claude.",
|
|
20
|
-
meta: "Mac + Linux"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: "install-plugin",
|
|
24
|
-
label: "◉ Install plugin",
|
|
25
|
-
description: "Install or remove shared plugins such as Lumin for Codex and Claude.",
|
|
26
|
-
meta: "Codex + Claude"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
id: "install-mcp",
|
|
30
|
-
label: "◎ Install MCP",
|
|
31
|
-
description: "Add or remove Ant Design, GitLab, GitHub, and Figma MCP servers for Codex or Claude.",
|
|
32
|
-
meta: "Codex + Claude"
|
|
33
|
-
},
|
|
34
10
|
{
|
|
35
11
|
id: "manage-skills",
|
|
36
12
|
label: "⊘ Manage skills",
|
|
@@ -5,7 +5,8 @@ import { canRun, createTabbedLayout, DEBOUNCE_MOVE_MS, DEBOUNCE_SELECT_MS, rende
|
|
|
5
5
|
const TAB_ORDER = ["agent", "skills", "review"];
|
|
6
6
|
const AGENT_DIR = {
|
|
7
7
|
claude: ".claude",
|
|
8
|
-
codex: ".codex"
|
|
8
|
+
codex: ".codex",
|
|
9
|
+
pi: path.join(".pi", "agent")
|
|
9
10
|
};
|
|
10
11
|
export function resolveSkillsDir(agent) {
|
|
11
12
|
return path.join(os.homedir(), AGENT_DIR[agent], "skills");
|
|
@@ -35,7 +36,8 @@ function buildInitialState(availableSkills) {
|
|
|
35
36
|
function agentItems() {
|
|
36
37
|
return [
|
|
37
38
|
{ id: "claude", label: "◇ Claude" },
|
|
38
|
-
{ id: "codex", label: "◇ Codex" }
|
|
39
|
+
{ id: "codex", label: "◇ Codex" },
|
|
40
|
+
{ id: "pi", label: "◇ Pi" }
|
|
39
41
|
];
|
|
40
42
|
}
|
|
41
43
|
function reviewItems() {
|