@iceinvein/agent-skills 0.25.0 → 0.26.0
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 +2 -2
- package/dist/cli/index.js +775 -236
- package/package.json +2 -1
- package/skills/index.json +2 -2
- package/skills/magpie/SKILL.md +35 -18
- package/skills/magpie/bin/magpie.ts +28 -0
- package/skills/magpie/package.json +1 -1
- package/skills/magpie/references/critic.md +2 -2
- package/skills/magpie/references/peer-review.md +7 -7
- package/skills/magpie/references/proof.md +2 -2
- package/skills/magpie/scripts/__tests__/peer-run.test.ts +231 -0
- package/skills/magpie/scripts/__tests__/preflight.test.ts +22 -1
- package/skills/magpie/scripts/__tests__/setup-cmd.test.ts +14 -0
- package/skills/magpie/scripts/__tests__/skill-lint.test.ts +45 -4
- package/skills/magpie/scripts/peer-run.ts +146 -0
- package/skills/magpie/scripts/preflight.ts +20 -20
- package/skills/magpie/scripts/setup-cmd.ts +7 -1
- package/skills/magpie/skill.json +1 -1
- package/skills/sluice/SKILL.md +21 -6
- package/skills/sluice/references/deep-channel.md +35 -25
- package/skills/sluice/references/finish.md +2 -2
- package/skills/sluice/references/intent.md +1 -1
- package/skills/sluice/references/status.md +10 -4
- package/skills/sluice/references/test-first.md +12 -0
- package/skills/sluice/scripts/board-index.sh +59 -37
- package/skills/sluice/scripts/board.sh +72 -40
- package/skills/sluice/scripts/host.sh +60 -0
- package/skills/sluice/scripts/run-stats.sh +41 -3
- package/skills/sluice/scripts/session-start.sh +75 -17
- package/skills/sluice/scripts/status.sh +9 -5
- package/skills/sluice/scripts/stop-guard.sh +101 -37
- package/skills/sluice/scripts/transcript.sh +221 -0
- package/skills/sluice/skill.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -203,7 +203,8 @@ var TOOL_MARKERS = {
|
|
|
203
203
|
claude: (cwd) => existsSync(join(cwd, ".claude")),
|
|
204
204
|
cursor: (cwd) => existsSync(join(cwd, ".cursor")),
|
|
205
205
|
codex: (cwd) => existsSync(join(cwd, "AGENTS.md")),
|
|
206
|
-
gemini: (cwd) => existsSync(join(cwd, ".gemini"))
|
|
206
|
+
gemini: (cwd) => existsSync(join(cwd, ".gemini")),
|
|
207
|
+
antigravity: () => false
|
|
207
208
|
};
|
|
208
209
|
async function detectTools(cwd) {
|
|
209
210
|
const detected = [];
|
|
@@ -216,9 +217,20 @@ async function detectTools(cwd) {
|
|
|
216
217
|
}
|
|
217
218
|
|
|
218
219
|
// src/cli/types.ts
|
|
219
|
-
var TOOL_NAMES = ["claude", "cursor", "codex", "gemini"];
|
|
220
|
+
var TOOL_NAMES = ["claude", "cursor", "codex", "gemini", "antigravity"];
|
|
220
221
|
var SKILL_TYPES = ["prompt", "code", "hybrid"];
|
|
221
222
|
var ACTIVATION_MODES = ["session", "global"];
|
|
223
|
+
var HOST_HOOK_KEYS = ["sessionStart", "stop", "statusline"];
|
|
224
|
+
function resolveInstallConfig(config, isGlobal) {
|
|
225
|
+
if (!isGlobal || config.global === undefined)
|
|
226
|
+
return config;
|
|
227
|
+
const { global, ...resolved } = config;
|
|
228
|
+
if (global.prompt !== undefined)
|
|
229
|
+
resolved.prompt = global.prompt;
|
|
230
|
+
if (global.bundleRoot !== undefined)
|
|
231
|
+
resolved.bundleRoot = global.bundleRoot;
|
|
232
|
+
return resolved;
|
|
233
|
+
}
|
|
222
234
|
function validateManifest(data) {
|
|
223
235
|
if (typeof data !== "object" || data === null) {
|
|
224
236
|
return { ok: false, error: "Manifest must be an object" };
|
|
@@ -242,14 +254,36 @@ function validateManifest(data) {
|
|
|
242
254
|
if (!Array.isArray(d.tools) || d.tools.length === 0) {
|
|
243
255
|
return { ok: false, error: "Missing or empty 'tools' array" };
|
|
244
256
|
}
|
|
257
|
+
const tools = [];
|
|
245
258
|
for (const tool of d.tools) {
|
|
246
|
-
if (
|
|
247
|
-
|
|
259
|
+
if (TOOL_NAMES.includes(tool)) {
|
|
260
|
+
tools.push(tool);
|
|
261
|
+
} else {
|
|
262
|
+
console.warn(`Ignoring unsupported tool '${tool}' in 'tools'`);
|
|
248
263
|
}
|
|
249
264
|
}
|
|
265
|
+
if (tools.length === 0) {
|
|
266
|
+
return { ok: false, error: `No supported tools in 'tools': must include one of ${TOOL_NAMES.join(", ")}` };
|
|
267
|
+
}
|
|
250
268
|
if (typeof d.install !== "object" || d.install === null) {
|
|
251
269
|
return { ok: false, error: "Missing 'install' configuration" };
|
|
252
270
|
}
|
|
271
|
+
for (const [tool, block] of Object.entries(d.install)) {
|
|
272
|
+
if (typeof block !== "object" || block === null)
|
|
273
|
+
continue;
|
|
274
|
+
const global = block.global;
|
|
275
|
+
if (global === undefined)
|
|
276
|
+
continue;
|
|
277
|
+
if (typeof global !== "object" || global === null || Array.isArray(global)) {
|
|
278
|
+
return { ok: false, error: `'install.${tool}.global' must be an object` };
|
|
279
|
+
}
|
|
280
|
+
for (const field of ["prompt", "bundleRoot"]) {
|
|
281
|
+
const value = global[field];
|
|
282
|
+
if (value !== undefined && typeof value !== "string") {
|
|
283
|
+
return { ok: false, error: `'install.${tool}.global.${field}' must be a string` };
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
253
287
|
if (d.bundle !== undefined) {
|
|
254
288
|
if (typeof d.bundle !== "object" || d.bundle === null) {
|
|
255
289
|
return { ok: false, error: "'bundle' must be an object" };
|
|
@@ -274,6 +308,7 @@ function validateManifest(data) {
|
|
|
274
308
|
}
|
|
275
309
|
}
|
|
276
310
|
}
|
|
311
|
+
let hostHooks;
|
|
277
312
|
if (d.activation !== undefined) {
|
|
278
313
|
if (typeof d.activation !== "object" || d.activation === null) {
|
|
279
314
|
return { ok: false, error: "'activation' must be an object" };
|
|
@@ -316,8 +351,31 @@ function validateManifest(data) {
|
|
|
316
351
|
}
|
|
317
352
|
}
|
|
318
353
|
}
|
|
354
|
+
if (a.hooks !== undefined) {
|
|
355
|
+
if (typeof a.hooks !== "object" || a.hooks === null || Array.isArray(a.hooks)) {
|
|
356
|
+
return { ok: false, error: "'activation.hooks' must be an object" };
|
|
357
|
+
}
|
|
358
|
+
hostHooks = {};
|
|
359
|
+
for (const [key, value] of Object.entries(a.hooks)) {
|
|
360
|
+
if (!HOST_HOOK_KEYS.includes(key)) {
|
|
361
|
+
console.warn(`Ignoring unknown key 'activation.hooks.${key}'`);
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
if (typeof value !== "string") {
|
|
365
|
+
return { ok: false, error: `'activation.hooks.${key}' must be a string` };
|
|
366
|
+
}
|
|
367
|
+
hostHooks[key] = value;
|
|
368
|
+
}
|
|
369
|
+
const hostHasBundleRoot = Object.entries(d.install).some(([tool, config]) => tool !== "claude" && config?.bundleRoot !== undefined);
|
|
370
|
+
if (!hostHasBundleRoot) {
|
|
371
|
+
return { ok: false, error: "'activation.hooks' is resolved against a tool's 'bundleRoot', and none is set" };
|
|
372
|
+
}
|
|
373
|
+
}
|
|
319
374
|
}
|
|
320
|
-
|
|
375
|
+
const manifest = { ...d, tools };
|
|
376
|
+
if (hostHooks !== undefined)
|
|
377
|
+
manifest.activation = { ...manifest.activation, hooks: hostHooks };
|
|
378
|
+
return { ok: true, manifest };
|
|
321
379
|
}
|
|
322
380
|
|
|
323
381
|
// src/cli/github.ts
|
|
@@ -424,8 +482,12 @@ function resolveBundlePaths(entries, bundle) {
|
|
|
424
482
|
}
|
|
425
483
|
|
|
426
484
|
// src/cli/adapters/claude.ts
|
|
427
|
-
import {
|
|
485
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2 } from "node:fs";
|
|
428
486
|
import { homedir } from "node:os";
|
|
487
|
+
import { dirname as dirname2, join as join3 } from "node:path";
|
|
488
|
+
|
|
489
|
+
// src/cli/adapters/bundle.ts
|
|
490
|
+
import { chmodSync, existsSync as existsSync2, mkdirSync, rmSync, rmdirSync, statSync, unlinkSync } from "node:fs";
|
|
429
491
|
import { dirname, join as join2 } from "node:path";
|
|
430
492
|
function shouldBeExecutable(relPath, content) {
|
|
431
493
|
if (relPath.endsWith(".sh"))
|
|
@@ -446,6 +508,50 @@ function runScript(scriptPath, cwd) {
|
|
|
446
508
|
});
|
|
447
509
|
return { ok: result.exitCode === 0, code: result.exitCode ?? 1 };
|
|
448
510
|
}
|
|
511
|
+
async function writeBundle(cwd, bundleRoot, files, skip) {
|
|
512
|
+
const written = [];
|
|
513
|
+
for (const [relPath, content] of files) {
|
|
514
|
+
if (skip.has(relPath))
|
|
515
|
+
continue;
|
|
516
|
+
const targetRel = join2(bundleRoot, relPath);
|
|
517
|
+
const targetPath = join2(cwd, targetRel);
|
|
518
|
+
mkdirSync(dirname(targetPath), { recursive: true });
|
|
519
|
+
await Bun.write(targetPath, content);
|
|
520
|
+
if (shouldBeExecutable(relPath, content)) {
|
|
521
|
+
chmodSync(targetPath, 493);
|
|
522
|
+
}
|
|
523
|
+
written.push(targetRel);
|
|
524
|
+
}
|
|
525
|
+
return written;
|
|
526
|
+
}
|
|
527
|
+
function removeInstalledFiles(cwd, files, stops, keep) {
|
|
528
|
+
for (const file of files) {
|
|
529
|
+
if (keep.has(file))
|
|
530
|
+
continue;
|
|
531
|
+
const fullPath = join2(cwd, file);
|
|
532
|
+
if (!existsSync2(fullPath))
|
|
533
|
+
continue;
|
|
534
|
+
try {
|
|
535
|
+
const stat = statSync(fullPath);
|
|
536
|
+
if (stat.isDirectory()) {
|
|
537
|
+
rmSync(fullPath, { recursive: true, force: true });
|
|
538
|
+
} else {
|
|
539
|
+
unlinkSync(fullPath);
|
|
540
|
+
}
|
|
541
|
+
} catch {}
|
|
542
|
+
let dir = dirname(fullPath);
|
|
543
|
+
while (!stops.includes(dir) && dir.startsWith(`${cwd}/`)) {
|
|
544
|
+
try {
|
|
545
|
+
rmdirSync(dir);
|
|
546
|
+
} catch {
|
|
547
|
+
break;
|
|
548
|
+
}
|
|
549
|
+
dir = dirname(dir);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// src/cli/adapters/claude.ts
|
|
449
555
|
function shq(s) {
|
|
450
556
|
return "'" + s.replace(/'/g, "'\\''") + "'";
|
|
451
557
|
}
|
|
@@ -458,13 +564,13 @@ function matchesSkillDirective(hook, skillName, directive) {
|
|
|
458
564
|
}
|
|
459
565
|
function commandRunsScript(command, scriptPath, settingsPath) {
|
|
460
566
|
const home = homedir();
|
|
461
|
-
const config =
|
|
567
|
+
const config = dirname2(settingsPath);
|
|
462
568
|
const expanded = command.replaceAll("${CLAUDE_CONFIG_DIR:-$HOME/.claude}", config).replaceAll("${CLAUDE_CONFIG_DIR:-${HOME}/.claude}", config).replaceAll("${CLAUDE_CONFIG_DIR}", config).replaceAll("$CLAUDE_CONFIG_DIR", config).replaceAll("${HOME}", home).replaceAll("$HOME", home).replaceAll("~/", `${home}/`);
|
|
463
569
|
return expanded.includes(scriptPath);
|
|
464
570
|
}
|
|
465
571
|
async function wireSessionStartHook(settingsPath, skillName, directive, scriptPath) {
|
|
466
572
|
let settings = {};
|
|
467
|
-
if (
|
|
573
|
+
if (existsSync3(settingsPath)) {
|
|
468
574
|
settings = await Bun.file(settingsPath).json();
|
|
469
575
|
}
|
|
470
576
|
if (!settings.hooks)
|
|
@@ -514,7 +620,7 @@ async function wireSessionStartHook(settingsPath, skillName, directive, scriptPa
|
|
|
514
620
|
console.warn(`${skillName}: a hand-edited SessionStart hook already carries its directive, so it was left as is and ${scriptPath} was not wired; add it to that entry yourself if you want it.`);
|
|
515
621
|
}
|
|
516
622
|
if (changed) {
|
|
517
|
-
|
|
623
|
+
mkdirSync2(dirname2(settingsPath), { recursive: true });
|
|
518
624
|
await Bun.write(settingsPath, JSON.stringify(settings, null, 2) + `
|
|
519
625
|
`);
|
|
520
626
|
}
|
|
@@ -523,12 +629,12 @@ async function wireSessionStartHook(settingsPath, skillName, directive, scriptPa
|
|
|
523
629
|
settings.hooks.SessionStart.push({
|
|
524
630
|
hooks: [{ type: "command", command, skill: skillName }]
|
|
525
631
|
});
|
|
526
|
-
|
|
632
|
+
mkdirSync2(dirname2(settingsPath), { recursive: true });
|
|
527
633
|
await Bun.write(settingsPath, JSON.stringify(settings, null, 2) + `
|
|
528
634
|
`);
|
|
529
635
|
}
|
|
530
636
|
async function unwireSessionStartHook(settingsPath, skillName, directive) {
|
|
531
|
-
if (!
|
|
637
|
+
if (!existsSync3(settingsPath))
|
|
532
638
|
return;
|
|
533
639
|
const settings = await Bun.file(settingsPath).json();
|
|
534
640
|
const sessionStart = settings.hooks?.SessionStart;
|
|
@@ -552,7 +658,7 @@ async function unwireSessionStartHook(settingsPath, skillName, directive) {
|
|
|
552
658
|
}
|
|
553
659
|
async function wireStopHook(settingsPath, skillName, scriptPath) {
|
|
554
660
|
let settings = {};
|
|
555
|
-
if (
|
|
661
|
+
if (existsSync3(settingsPath)) {
|
|
556
662
|
settings = await Bun.file(settingsPath).json();
|
|
557
663
|
}
|
|
558
664
|
if (!settings.hooks)
|
|
@@ -572,12 +678,12 @@ async function wireStopHook(settingsPath, skillName, scriptPath) {
|
|
|
572
678
|
if (!found) {
|
|
573
679
|
settings.hooks.Stop.push({ hooks: [{ type: "command", command, skill: skillName }] });
|
|
574
680
|
}
|
|
575
|
-
|
|
681
|
+
mkdirSync2(dirname2(settingsPath), { recursive: true });
|
|
576
682
|
await Bun.write(settingsPath, JSON.stringify(settings, null, 2) + `
|
|
577
683
|
`);
|
|
578
684
|
}
|
|
579
685
|
async function unwireStopHook(settingsPath, skillName) {
|
|
580
|
-
if (!
|
|
686
|
+
if (!existsSync3(settingsPath))
|
|
581
687
|
return;
|
|
582
688
|
const settings = await Bun.file(settingsPath).json();
|
|
583
689
|
const stop = settings.hooks?.Stop;
|
|
@@ -610,7 +716,7 @@ function ownsStatusLine(command, skillName, scriptPath) {
|
|
|
610
716
|
}
|
|
611
717
|
async function wireStatusLine(settingsPath, skillName, scriptPath) {
|
|
612
718
|
let settings = {};
|
|
613
|
-
if (
|
|
719
|
+
if (existsSync3(settingsPath)) {
|
|
614
720
|
settings = await Bun.file(settingsPath).json();
|
|
615
721
|
}
|
|
616
722
|
const existing = settings.statusLine;
|
|
@@ -622,12 +728,12 @@ async function wireStatusLine(settingsPath, skillName, scriptPath) {
|
|
|
622
728
|
if (existing?.type === "command" && existing?.command === command)
|
|
623
729
|
return;
|
|
624
730
|
settings.statusLine = { type: "command", command };
|
|
625
|
-
|
|
731
|
+
mkdirSync2(dirname2(settingsPath), { recursive: true });
|
|
626
732
|
await Bun.write(settingsPath, JSON.stringify(settings, null, 2) + `
|
|
627
733
|
`);
|
|
628
734
|
}
|
|
629
735
|
async function unwireStatusLine(settingsPath, skillName, scriptPath) {
|
|
630
|
-
if (!
|
|
736
|
+
if (!existsSync3(settingsPath))
|
|
631
737
|
return;
|
|
632
738
|
const settings = await Bun.file(settingsPath).json();
|
|
633
739
|
if (settings.statusLine === undefined || settings.statusLine === null)
|
|
@@ -646,42 +752,31 @@ var claudeAdapter = {
|
|
|
646
752
|
if (!config)
|
|
647
753
|
return installed;
|
|
648
754
|
if (config.prompt && files.has(manifest.files?.prompt ?? "")) {
|
|
649
|
-
const targetPath =
|
|
650
|
-
|
|
755
|
+
const targetPath = join3(cwd, config.prompt);
|
|
756
|
+
mkdirSync2(dirname2(targetPath), { recursive: true });
|
|
651
757
|
await Bun.write(targetPath, files.get(manifest.files.prompt));
|
|
652
758
|
installed.push(config.prompt);
|
|
653
759
|
}
|
|
654
760
|
if (config.supporting) {
|
|
655
761
|
for (const [sourceFile, targetRel] of Object.entries(config.supporting)) {
|
|
656
762
|
if (files.has(sourceFile)) {
|
|
657
|
-
const targetPath =
|
|
658
|
-
|
|
763
|
+
const targetPath = join3(cwd, targetRel);
|
|
764
|
+
mkdirSync2(dirname2(targetPath), { recursive: true });
|
|
659
765
|
await Bun.write(targetPath, files.get(sourceFile));
|
|
660
766
|
installed.push(targetRel);
|
|
661
767
|
}
|
|
662
768
|
}
|
|
663
769
|
}
|
|
664
770
|
if (config.bundleRoot && manifest.bundle) {
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
if (config.supporting && Object.hasOwn(config.supporting, relPath))
|
|
670
|
-
continue;
|
|
671
|
-
const targetRel = join2(config.bundleRoot, relPath);
|
|
672
|
-
const targetPath = join2(cwd, targetRel);
|
|
673
|
-
mkdirSync(dirname(targetPath), { recursive: true });
|
|
674
|
-
await Bun.write(targetPath, content);
|
|
675
|
-
if (shouldBeExecutable(relPath, content)) {
|
|
676
|
-
chmodSync(targetPath, 493);
|
|
677
|
-
}
|
|
678
|
-
installed.push(targetRel);
|
|
679
|
-
}
|
|
771
|
+
const skip = new Set(Object.keys(config.supporting ?? {}));
|
|
772
|
+
if (manifest.files?.prompt)
|
|
773
|
+
skip.add(manifest.files.prompt);
|
|
774
|
+
installed.push(...await writeBundle(cwd, config.bundleRoot, files, skip));
|
|
680
775
|
}
|
|
681
776
|
if (config.mcpServers) {
|
|
682
|
-
const settingsPath =
|
|
777
|
+
const settingsPath = join3(cwd, ".claude/settings.json");
|
|
683
778
|
let settings = {};
|
|
684
|
-
if (
|
|
779
|
+
if (existsSync3(settingsPath)) {
|
|
685
780
|
settings = await Bun.file(settingsPath).json();
|
|
686
781
|
}
|
|
687
782
|
if (!settings.mcpServers)
|
|
@@ -694,31 +789,31 @@ var claudeAdapter = {
|
|
|
694
789
|
installed.push(".claude/settings.json");
|
|
695
790
|
}
|
|
696
791
|
if (activation === "global" && manifest.activation?.claudeHookDirective) {
|
|
697
|
-
const settingsPath =
|
|
792
|
+
const settingsPath = join3(cwd, ".claude/settings.json");
|
|
698
793
|
const script = manifest.activation.claudeHookScript;
|
|
699
|
-
const scriptPath = script && config.bundleRoot ?
|
|
794
|
+
const scriptPath = script && config.bundleRoot ? join3(cwd, config.bundleRoot, script) : undefined;
|
|
700
795
|
await wireSessionStartHook(settingsPath, manifest.name, manifest.activation.claudeHookDirective, scriptPath);
|
|
701
796
|
if (!installed.includes(".claude/settings.json")) {
|
|
702
797
|
installed.push(".claude/settings.json");
|
|
703
798
|
}
|
|
704
799
|
}
|
|
705
800
|
if (activation === "global" && manifest.activation?.claudeStopScript && config.bundleRoot) {
|
|
706
|
-
const settingsPath =
|
|
707
|
-
await wireStopHook(settingsPath, manifest.name,
|
|
801
|
+
const settingsPath = join3(cwd, ".claude/settings.json");
|
|
802
|
+
await wireStopHook(settingsPath, manifest.name, join3(cwd, config.bundleRoot, manifest.activation.claudeStopScript));
|
|
708
803
|
if (!installed.includes(".claude/settings.json")) {
|
|
709
804
|
installed.push(".claude/settings.json");
|
|
710
805
|
}
|
|
711
806
|
}
|
|
712
807
|
if (activation === "global" && manifest.activation?.claudeStatuslineScript && config.bundleRoot) {
|
|
713
|
-
const settingsPath =
|
|
714
|
-
await wireStatusLine(settingsPath, manifest.name,
|
|
808
|
+
const settingsPath = join3(cwd, ".claude/settings.json");
|
|
809
|
+
await wireStatusLine(settingsPath, manifest.name, join3(cwd, config.bundleRoot, manifest.activation.claudeStatuslineScript));
|
|
715
810
|
if (!installed.includes(".claude/settings.json")) {
|
|
716
811
|
installed.push(".claude/settings.json");
|
|
717
812
|
}
|
|
718
813
|
}
|
|
719
814
|
if (config.postinstall && config.bundleRoot) {
|
|
720
|
-
const scriptPath =
|
|
721
|
-
const result = runScript(scriptPath,
|
|
815
|
+
const scriptPath = join3(cwd, config.bundleRoot, config.postinstall);
|
|
816
|
+
const result = runScript(scriptPath, join3(cwd, config.bundleRoot));
|
|
722
817
|
if (!result.ok) {
|
|
723
818
|
console.error(`postinstall script '${config.postinstall}' exited with code ${result.code}`);
|
|
724
819
|
}
|
|
@@ -730,42 +825,19 @@ var claudeAdapter = {
|
|
|
730
825
|
if (!config)
|
|
731
826
|
return;
|
|
732
827
|
if (config.postremove && config.bundleRoot) {
|
|
733
|
-
const scriptPath =
|
|
734
|
-
const result = runScript(scriptPath,
|
|
828
|
+
const scriptPath = join3(cwd, config.bundleRoot, config.postremove);
|
|
829
|
+
const result = runScript(scriptPath, join3(cwd, config.bundleRoot));
|
|
735
830
|
if (!result.ok) {
|
|
736
831
|
console.error(`postremove script '${config.postremove}' exited with code ${result.code}`);
|
|
737
832
|
}
|
|
738
833
|
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
if (existsSync2(fullPath)) {
|
|
744
|
-
try {
|
|
745
|
-
const stat = statSync(fullPath);
|
|
746
|
-
if (stat.isDirectory()) {
|
|
747
|
-
rmSync(fullPath, { recursive: true, force: true });
|
|
748
|
-
} else {
|
|
749
|
-
unlinkSync(fullPath);
|
|
750
|
-
}
|
|
751
|
-
} catch {}
|
|
752
|
-
const stops = [join2(cwd, ".claude"), cwd];
|
|
753
|
-
if (config.bundleRoot)
|
|
754
|
-
stops.push(join2(cwd, config.bundleRoot, ".."));
|
|
755
|
-
let dir = dirname(fullPath);
|
|
756
|
-
while (!stops.includes(dir) && dir.startsWith(`${cwd}/`)) {
|
|
757
|
-
try {
|
|
758
|
-
rmdirSync(dir);
|
|
759
|
-
} catch {
|
|
760
|
-
break;
|
|
761
|
-
}
|
|
762
|
-
dir = dirname(dir);
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
}
|
|
834
|
+
const stops = [join3(cwd, ".claude"), cwd];
|
|
835
|
+
if (config.bundleRoot)
|
|
836
|
+
stops.push(join3(cwd, config.bundleRoot, ".."));
|
|
837
|
+
removeInstalledFiles(cwd, installedFiles, stops, new Set([".claude/settings.json"]));
|
|
766
838
|
if (config.mcpServers) {
|
|
767
|
-
const settingsPath =
|
|
768
|
-
if (
|
|
839
|
+
const settingsPath = join3(cwd, ".claude/settings.json");
|
|
840
|
+
if (existsSync3(settingsPath)) {
|
|
769
841
|
const settings = await Bun.file(settingsPath).json();
|
|
770
842
|
if (settings.mcpServers) {
|
|
771
843
|
for (const name of Object.keys(config.mcpServers)) {
|
|
@@ -777,21 +849,21 @@ var claudeAdapter = {
|
|
|
777
849
|
}
|
|
778
850
|
}
|
|
779
851
|
if (manifest.activation?.claudeHookDirective) {
|
|
780
|
-
const settingsPath =
|
|
852
|
+
const settingsPath = join3(cwd, ".claude/settings.json");
|
|
781
853
|
await unwireSessionStartHook(settingsPath, manifest.name, manifest.activation.claudeHookDirective);
|
|
782
854
|
}
|
|
783
855
|
if (manifest.activation?.claudeStopScript) {
|
|
784
|
-
await unwireStopHook(
|
|
856
|
+
await unwireStopHook(join3(cwd, ".claude/settings.json"), manifest.name);
|
|
785
857
|
}
|
|
786
858
|
if (manifest.activation?.claudeStatuslineScript && config.bundleRoot) {
|
|
787
|
-
await unwireStatusLine(
|
|
859
|
+
await unwireStatusLine(join3(cwd, ".claude/settings.json"), manifest.name, join3(cwd, config.bundleRoot, manifest.activation.claudeStatuslineScript));
|
|
788
860
|
}
|
|
789
861
|
}
|
|
790
862
|
};
|
|
791
863
|
|
|
792
864
|
// src/cli/adapters/cursor.ts
|
|
793
|
-
import { existsSync as
|
|
794
|
-
import { dirname as
|
|
865
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync3, unlinkSync as unlinkSync2, rmdirSync as rmdirSync2 } from "node:fs";
|
|
866
|
+
import { dirname as dirname3, join as join4 } from "node:path";
|
|
795
867
|
var cursorAdapter = {
|
|
796
868
|
name: "cursor",
|
|
797
869
|
async install(cwd, manifest, files, _activation) {
|
|
@@ -800,25 +872,25 @@ var cursorAdapter = {
|
|
|
800
872
|
if (!config)
|
|
801
873
|
return installed;
|
|
802
874
|
if (config.prompt && files.has(manifest.files?.prompt ?? "")) {
|
|
803
|
-
const targetPath =
|
|
804
|
-
|
|
875
|
+
const targetPath = join4(cwd, config.prompt);
|
|
876
|
+
mkdirSync3(dirname3(targetPath), { recursive: true });
|
|
805
877
|
await Bun.write(targetPath, files.get(manifest.files.prompt));
|
|
806
878
|
installed.push(config.prompt);
|
|
807
879
|
}
|
|
808
880
|
if (config.supporting) {
|
|
809
881
|
for (const [sourceFile, targetRel] of Object.entries(config.supporting)) {
|
|
810
882
|
if (files.has(sourceFile)) {
|
|
811
|
-
const targetPath =
|
|
812
|
-
|
|
883
|
+
const targetPath = join4(cwd, targetRel);
|
|
884
|
+
mkdirSync3(dirname3(targetPath), { recursive: true });
|
|
813
885
|
await Bun.write(targetPath, files.get(sourceFile));
|
|
814
886
|
installed.push(targetRel);
|
|
815
887
|
}
|
|
816
888
|
}
|
|
817
889
|
}
|
|
818
890
|
if (config.mcpServers) {
|
|
819
|
-
const mcpPath =
|
|
891
|
+
const mcpPath = join4(cwd, ".cursor/mcp.json");
|
|
820
892
|
let mcpConfig = {};
|
|
821
|
-
if (
|
|
893
|
+
if (existsSync4(mcpPath)) {
|
|
822
894
|
mcpConfig = await Bun.file(mcpPath).json();
|
|
823
895
|
}
|
|
824
896
|
if (!mcpConfig.mcpServers)
|
|
@@ -839,17 +911,17 @@ var cursorAdapter = {
|
|
|
839
911
|
for (const file of installedFiles) {
|
|
840
912
|
if (file === ".cursor/mcp.json")
|
|
841
913
|
continue;
|
|
842
|
-
const fullPath =
|
|
843
|
-
if (
|
|
914
|
+
const fullPath = join4(cwd, file);
|
|
915
|
+
if (existsSync4(fullPath)) {
|
|
844
916
|
unlinkSync2(fullPath);
|
|
845
917
|
try {
|
|
846
|
-
rmdirSync2(
|
|
918
|
+
rmdirSync2(dirname3(fullPath));
|
|
847
919
|
} catch {}
|
|
848
920
|
}
|
|
849
921
|
}
|
|
850
922
|
if (config.mcpServers) {
|
|
851
|
-
const mcpPath =
|
|
852
|
-
if (
|
|
923
|
+
const mcpPath = join4(cwd, ".cursor/mcp.json");
|
|
924
|
+
if (existsSync4(mcpPath)) {
|
|
853
925
|
const mcpConfig = await Bun.file(mcpPath).json();
|
|
854
926
|
if (mcpConfig.mcpServers) {
|
|
855
927
|
for (const name of Object.keys(config.mcpServers)) {
|
|
@@ -864,11 +936,106 @@ var cursorAdapter = {
|
|
|
864
936
|
};
|
|
865
937
|
|
|
866
938
|
// src/cli/adapters/codex.ts
|
|
867
|
-
import { existsSync as
|
|
868
|
-
import { join as
|
|
939
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync4 } from "node:fs";
|
|
940
|
+
import { dirname as dirname4, join as join5 } from "node:path";
|
|
941
|
+
function shq2(s) {
|
|
942
|
+
return "'" + s.replace(/'/g, "'\\''") + "'";
|
|
943
|
+
}
|
|
944
|
+
function isOurs(hook, bundleDir) {
|
|
945
|
+
return (hook.command ?? "").includes(shq2(`${bundleDir}/`).slice(0, -1));
|
|
946
|
+
}
|
|
947
|
+
function codexHooksPath(cwd, isGlobal) {
|
|
948
|
+
const codexHome = process.env.CODEX_HOME;
|
|
949
|
+
return isGlobal && codexHome ? join5(codexHome, "hooks.json") : join5(cwd, ".codex/hooks.json");
|
|
950
|
+
}
|
|
951
|
+
function codexHooksPathsToUnwire(cwd, isGlobal) {
|
|
952
|
+
const projectPath = join5(cwd, ".codex/hooks.json");
|
|
953
|
+
const path = codexHooksPath(cwd, isGlobal);
|
|
954
|
+
return path === projectPath ? [path] : [path, projectPath];
|
|
955
|
+
}
|
|
956
|
+
async function wireCodexHooks(hooksPath, bundleDir, directive, hooks) {
|
|
957
|
+
const file = existsSync5(hooksPath) ? await Bun.file(hooksPath).json() : {};
|
|
958
|
+
if (!file.hooks)
|
|
959
|
+
file.hooks = {};
|
|
960
|
+
const commands = {};
|
|
961
|
+
if (hooks.sessionStart) {
|
|
962
|
+
const script = shq2(join5(bundleDir, hooks.sessionStart));
|
|
963
|
+
const run = `if [ -f ${script} ]; then bash ${script} --host codex; fi`;
|
|
964
|
+
commands.SessionStart = directive === undefined ? run : `echo ${shq2(directive)}; ${run}`;
|
|
965
|
+
}
|
|
966
|
+
if (hooks.stop) {
|
|
967
|
+
const script = shq2(join5(bundleDir, hooks.stop));
|
|
968
|
+
commands.Stop = `if [ -f ${script} ]; then bash ${script} --host codex; fi`;
|
|
969
|
+
}
|
|
970
|
+
const events = new Set([...Object.keys(file.hooks), ...Object.keys(commands)]);
|
|
971
|
+
for (const event of events) {
|
|
972
|
+
const command = commands[event];
|
|
973
|
+
const ourHook = { type: "command", command, timeout: 10 };
|
|
974
|
+
let placed = false;
|
|
975
|
+
const kept = [];
|
|
976
|
+
for (const group of file.hooks[event] ?? []) {
|
|
977
|
+
const groupHooks = group.hooks ?? [];
|
|
978
|
+
if (!groupHooks.some((h) => isOurs(h, bundleDir))) {
|
|
979
|
+
kept.push(group);
|
|
980
|
+
continue;
|
|
981
|
+
}
|
|
982
|
+
const next = [];
|
|
983
|
+
for (const hook of groupHooks) {
|
|
984
|
+
if (!isOurs(hook, bundleDir))
|
|
985
|
+
next.push(hook);
|
|
986
|
+
else if (command !== undefined && !placed) {
|
|
987
|
+
next.push(ourHook);
|
|
988
|
+
placed = true;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
if (next.length > 0)
|
|
992
|
+
kept.push({ ...group, hooks: next });
|
|
993
|
+
}
|
|
994
|
+
if (command !== undefined && !placed)
|
|
995
|
+
kept.push({ hooks: [ourHook] });
|
|
996
|
+
if (kept.length > 0)
|
|
997
|
+
file.hooks[event] = kept;
|
|
998
|
+
else if ((file.hooks[event] ?? []).length > 0)
|
|
999
|
+
delete file.hooks[event];
|
|
1000
|
+
}
|
|
1001
|
+
mkdirSync4(dirname4(hooksPath), { recursive: true });
|
|
1002
|
+
await Bun.write(hooksPath, JSON.stringify(file, null, 2) + `
|
|
1003
|
+
`);
|
|
1004
|
+
}
|
|
1005
|
+
async function unwireCodexHooks(hooksPath, bundleDir) {
|
|
1006
|
+
if (!existsSync5(hooksPath))
|
|
1007
|
+
return;
|
|
1008
|
+
const file = await Bun.file(hooksPath).json();
|
|
1009
|
+
if (!file.hooks)
|
|
1010
|
+
return;
|
|
1011
|
+
let changed = false;
|
|
1012
|
+
for (const [event, groups] of Object.entries(file.hooks)) {
|
|
1013
|
+
const kept = [];
|
|
1014
|
+
for (const group of groups) {
|
|
1015
|
+
const hooks = (group.hooks ?? []).filter((h) => !isOurs(h, bundleDir));
|
|
1016
|
+
if (hooks.length === (group.hooks ?? []).length) {
|
|
1017
|
+
kept.push(group);
|
|
1018
|
+
continue;
|
|
1019
|
+
}
|
|
1020
|
+
changed = true;
|
|
1021
|
+
if (hooks.length > 0)
|
|
1022
|
+
kept.push({ ...group, hooks });
|
|
1023
|
+
}
|
|
1024
|
+
if (kept.length === 0)
|
|
1025
|
+
delete file.hooks[event];
|
|
1026
|
+
else
|
|
1027
|
+
file.hooks[event] = kept;
|
|
1028
|
+
}
|
|
1029
|
+
if (!changed)
|
|
1030
|
+
return;
|
|
1031
|
+
if (Object.keys(file.hooks).length === 0)
|
|
1032
|
+
delete file.hooks;
|
|
1033
|
+
await Bun.write(hooksPath, JSON.stringify(file, null, 2) + `
|
|
1034
|
+
`);
|
|
1035
|
+
}
|
|
869
1036
|
var codexAdapter = {
|
|
870
1037
|
name: "codex",
|
|
871
|
-
async install(cwd, manifest, files,
|
|
1038
|
+
async install(cwd, manifest, files, activation, isGlobal) {
|
|
872
1039
|
const installed = [];
|
|
873
1040
|
const config = manifest.install.codex;
|
|
874
1041
|
if (!config)
|
|
@@ -878,9 +1045,9 @@ var codexAdapter = {
|
|
|
878
1045
|
return installed;
|
|
879
1046
|
}
|
|
880
1047
|
if (config.append && config.prompt && files.has(manifest.files?.prompt ?? "")) {
|
|
881
|
-
const agentsPath =
|
|
1048
|
+
const agentsPath = join5(cwd, config.prompt);
|
|
882
1049
|
let existing = "";
|
|
883
|
-
if (
|
|
1050
|
+
if (existsSync5(agentsPath)) {
|
|
884
1051
|
existing = await Bun.file(agentsPath).text();
|
|
885
1052
|
}
|
|
886
1053
|
const content = files.get(manifest.files.prompt);
|
|
@@ -895,15 +1062,36 @@ var codexAdapter = {
|
|
|
895
1062
|
await Bun.write(agentsPath, existing + section);
|
|
896
1063
|
installed.push("AGENTS.md");
|
|
897
1064
|
}
|
|
1065
|
+
if (!config.append && config.prompt && files.has(manifest.files?.prompt ?? "")) {
|
|
1066
|
+
const targetPath = join5(cwd, config.prompt);
|
|
1067
|
+
mkdirSync4(dirname4(targetPath), { recursive: true });
|
|
1068
|
+
await Bun.write(targetPath, files.get(manifest.files.prompt));
|
|
1069
|
+
installed.push(config.prompt);
|
|
1070
|
+
if (config.bundleRoot && manifest.bundle) {
|
|
1071
|
+
const skip = new Set([manifest.files.prompt]);
|
|
1072
|
+
installed.push(...await writeBundle(cwd, config.bundleRoot, files, skip));
|
|
1073
|
+
}
|
|
1074
|
+
if (config.postinstall && config.bundleRoot) {
|
|
1075
|
+
const scriptPath = join5(cwd, config.bundleRoot, config.postinstall);
|
|
1076
|
+
const result = runScript(scriptPath, join5(cwd, config.bundleRoot));
|
|
1077
|
+
if (!result.ok) {
|
|
1078
|
+
console.error(`postinstall script '${config.postinstall}' exited with code ${result.code}`);
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
if (activation === "global" && manifest.activation?.hooks && config.bundleRoot) {
|
|
1082
|
+
await wireCodexHooks(codexHooksPath(cwd, isGlobal), join5(cwd, config.bundleRoot), manifest.activation.claudeHookDirective, manifest.activation.hooks);
|
|
1083
|
+
console.log("Codex runs these hooks only after you trust them: open /hooks in Codex.");
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
898
1086
|
return installed;
|
|
899
1087
|
},
|
|
900
|
-
async remove(cwd, manifest,
|
|
1088
|
+
async remove(cwd, manifest, installedFiles, isGlobal) {
|
|
901
1089
|
const config = manifest.install.codex;
|
|
902
1090
|
if (!config)
|
|
903
1091
|
return;
|
|
904
1092
|
if (config.append && config.prompt) {
|
|
905
|
-
const agentsPath =
|
|
906
|
-
if (
|
|
1093
|
+
const agentsPath = join5(cwd, config.prompt);
|
|
1094
|
+
if (existsSync5(agentsPath)) {
|
|
907
1095
|
const content = await Bun.file(agentsPath).text();
|
|
908
1096
|
const startMarker = `<!-- agent-skills:start:${manifest.name} -->`;
|
|
909
1097
|
const endMarker = `<!-- agent-skills:end:${manifest.name} -->`;
|
|
@@ -916,12 +1104,32 @@ var codexAdapter = {
|
|
|
916
1104
|
}
|
|
917
1105
|
}
|
|
918
1106
|
}
|
|
1107
|
+
if (!config.append && config.prompt) {
|
|
1108
|
+
if (config.bundleRoot) {
|
|
1109
|
+
for (const hooksPath of codexHooksPathsToUnwire(cwd, isGlobal)) {
|
|
1110
|
+
await unwireCodexHooks(hooksPath, join5(cwd, config.bundleRoot));
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
if (config.postremove && config.bundleRoot) {
|
|
1114
|
+
const scriptPath = join5(cwd, config.bundleRoot, config.postremove);
|
|
1115
|
+
const result = runScript(scriptPath, join5(cwd, config.bundleRoot));
|
|
1116
|
+
if (!result.ok) {
|
|
1117
|
+
console.error(`postremove script '${config.postremove}' exited with code ${result.code}`);
|
|
1118
|
+
}
|
|
1119
|
+
}
|
|
1120
|
+
const stops = [cwd];
|
|
1121
|
+
if (config.bundleRoot)
|
|
1122
|
+
stops.push(join5(cwd, config.bundleRoot, ".."));
|
|
1123
|
+
else
|
|
1124
|
+
stops.push(join5(cwd, dirname4(config.prompt), ".."));
|
|
1125
|
+
removeInstalledFiles(cwd, installedFiles, stops, new Set);
|
|
1126
|
+
}
|
|
919
1127
|
}
|
|
920
1128
|
};
|
|
921
1129
|
|
|
922
1130
|
// src/cli/adapters/gemini.ts
|
|
923
|
-
import { existsSync as
|
|
924
|
-
import { dirname as
|
|
1131
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync5, unlinkSync as unlinkSync3, rmdirSync as rmdirSync3 } from "node:fs";
|
|
1132
|
+
import { dirname as dirname5, join as join6 } from "node:path";
|
|
925
1133
|
var geminiAdapter = {
|
|
926
1134
|
name: "gemini",
|
|
927
1135
|
async install(cwd, manifest, files, _activation) {
|
|
@@ -930,25 +1138,25 @@ var geminiAdapter = {
|
|
|
930
1138
|
if (!config)
|
|
931
1139
|
return installed;
|
|
932
1140
|
if (config.prompt && files.has(manifest.files?.prompt ?? "")) {
|
|
933
|
-
const targetPath =
|
|
934
|
-
|
|
1141
|
+
const targetPath = join6(cwd, config.prompt);
|
|
1142
|
+
mkdirSync5(dirname5(targetPath), { recursive: true });
|
|
935
1143
|
await Bun.write(targetPath, files.get(manifest.files.prompt));
|
|
936
1144
|
installed.push(config.prompt);
|
|
937
1145
|
}
|
|
938
1146
|
if (config.supporting) {
|
|
939
1147
|
for (const [sourceFile, targetRel] of Object.entries(config.supporting)) {
|
|
940
1148
|
if (files.has(sourceFile)) {
|
|
941
|
-
const targetPath =
|
|
942
|
-
|
|
1149
|
+
const targetPath = join6(cwd, targetRel);
|
|
1150
|
+
mkdirSync5(dirname5(targetPath), { recursive: true });
|
|
943
1151
|
await Bun.write(targetPath, files.get(sourceFile));
|
|
944
1152
|
installed.push(targetRel);
|
|
945
1153
|
}
|
|
946
1154
|
}
|
|
947
1155
|
}
|
|
948
1156
|
if (config.mcpServers) {
|
|
949
|
-
const settingsPath =
|
|
1157
|
+
const settingsPath = join6(cwd, ".gemini/settings.json");
|
|
950
1158
|
let settings = {};
|
|
951
|
-
if (
|
|
1159
|
+
if (existsSync6(settingsPath)) {
|
|
952
1160
|
settings = await Bun.file(settingsPath).json();
|
|
953
1161
|
}
|
|
954
1162
|
if (!settings.mcpServers)
|
|
@@ -969,17 +1177,17 @@ var geminiAdapter = {
|
|
|
969
1177
|
for (const file of installedFiles) {
|
|
970
1178
|
if (file === ".gemini/settings.json")
|
|
971
1179
|
continue;
|
|
972
|
-
const fullPath =
|
|
973
|
-
if (
|
|
1180
|
+
const fullPath = join6(cwd, file);
|
|
1181
|
+
if (existsSync6(fullPath)) {
|
|
974
1182
|
unlinkSync3(fullPath);
|
|
975
1183
|
try {
|
|
976
|
-
rmdirSync3(
|
|
1184
|
+
rmdirSync3(dirname5(fullPath));
|
|
977
1185
|
} catch {}
|
|
978
1186
|
}
|
|
979
1187
|
}
|
|
980
1188
|
if (config.mcpServers) {
|
|
981
|
-
const settingsPath =
|
|
982
|
-
if (
|
|
1189
|
+
const settingsPath = join6(cwd, ".gemini/settings.json");
|
|
1190
|
+
if (existsSync6(settingsPath)) {
|
|
983
1191
|
const settings = await Bun.file(settingsPath).json();
|
|
984
1192
|
if (settings.mcpServers) {
|
|
985
1193
|
for (const name of Object.keys(config.mcpServers)) {
|
|
@@ -993,36 +1201,217 @@ var geminiAdapter = {
|
|
|
993
1201
|
}
|
|
994
1202
|
};
|
|
995
1203
|
|
|
1204
|
+
// src/cli/adapters/antigravity.ts
|
|
1205
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync6 } from "node:fs";
|
|
1206
|
+
import { dirname as dirname6, join as join7 } from "node:path";
|
|
1207
|
+
function shq3(s) {
|
|
1208
|
+
return "'" + s.replace(/'/g, "'\\''") + "'";
|
|
1209
|
+
}
|
|
1210
|
+
async function wireAntigravityHooks(hooksPath, groupName, bundleDir, directive, hooks) {
|
|
1211
|
+
let file = {};
|
|
1212
|
+
if (existsSync7(hooksPath)) {
|
|
1213
|
+
file = await Bun.file(hooksPath).json();
|
|
1214
|
+
}
|
|
1215
|
+
const group = {};
|
|
1216
|
+
if (hooks.sessionStart) {
|
|
1217
|
+
const script = shq3(join7(bundleDir, hooks.sessionStart));
|
|
1218
|
+
let args = "--host antigravity";
|
|
1219
|
+
if (directive !== undefined)
|
|
1220
|
+
args += ` --directive ${shq3(directive)}`;
|
|
1221
|
+
const command = `if [ -f ${script} ]; then bash ${script} ${args}; fi`;
|
|
1222
|
+
group.SessionStart = [{ type: "command", command, timeout: 10 }];
|
|
1223
|
+
}
|
|
1224
|
+
if (hooks.stop) {
|
|
1225
|
+
const script = shq3(join7(bundleDir, hooks.stop));
|
|
1226
|
+
const command = `if [ -f ${script} ]; then bash ${script} --host antigravity; fi`;
|
|
1227
|
+
group.Stop = [{ type: "command", command, timeout: 10 }];
|
|
1228
|
+
}
|
|
1229
|
+
if (Object.keys(group).length === 0) {
|
|
1230
|
+
if (!(groupName in file))
|
|
1231
|
+
return;
|
|
1232
|
+
delete file[groupName];
|
|
1233
|
+
} else {
|
|
1234
|
+
file[groupName] = group;
|
|
1235
|
+
}
|
|
1236
|
+
mkdirSync6(dirname6(hooksPath), { recursive: true });
|
|
1237
|
+
await Bun.write(hooksPath, JSON.stringify(file, null, 2) + `
|
|
1238
|
+
`);
|
|
1239
|
+
}
|
|
1240
|
+
async function unwireAntigravityHooks(hooksPath, groupName) {
|
|
1241
|
+
if (!existsSync7(hooksPath))
|
|
1242
|
+
return;
|
|
1243
|
+
const file = await Bun.file(hooksPath).json();
|
|
1244
|
+
if (!(groupName in file))
|
|
1245
|
+
return;
|
|
1246
|
+
delete file[groupName];
|
|
1247
|
+
await Bun.write(hooksPath, JSON.stringify(file, null, 2) + `
|
|
1248
|
+
`);
|
|
1249
|
+
}
|
|
1250
|
+
async function wireAntigravityStatusLine(settingsPath, command) {
|
|
1251
|
+
let settings = {};
|
|
1252
|
+
if (existsSync7(settingsPath)) {
|
|
1253
|
+
settings = await Bun.file(settingsPath).json();
|
|
1254
|
+
}
|
|
1255
|
+
if (settings.statusLine !== undefined && settings.statusLine !== null)
|
|
1256
|
+
return false;
|
|
1257
|
+
settings.statusLine = { type: "command", command };
|
|
1258
|
+
mkdirSync6(dirname6(settingsPath), { recursive: true });
|
|
1259
|
+
await Bun.write(settingsPath, JSON.stringify(settings, null, 2) + `
|
|
1260
|
+
`);
|
|
1261
|
+
return true;
|
|
1262
|
+
}
|
|
1263
|
+
async function unwireAntigravityStatusLine(settingsPath, bundleDir) {
|
|
1264
|
+
if (!existsSync7(settingsPath))
|
|
1265
|
+
return;
|
|
1266
|
+
const settings = await Bun.file(settingsPath).json();
|
|
1267
|
+
const statusLine = settings.statusLine;
|
|
1268
|
+
const command = typeof statusLine === "object" && statusLine !== null && "command" in statusLine ? statusLine.command : undefined;
|
|
1269
|
+
if (typeof command !== "string" || !command.includes(`${bundleDir}/`))
|
|
1270
|
+
return;
|
|
1271
|
+
delete settings.statusLine;
|
|
1272
|
+
await Bun.write(settingsPath, JSON.stringify(settings, null, 2) + `
|
|
1273
|
+
`);
|
|
1274
|
+
}
|
|
1275
|
+
function isGlobalInstall(bundleRoot) {
|
|
1276
|
+
return bundleRoot.startsWith(".gemini/");
|
|
1277
|
+
}
|
|
1278
|
+
function hooksPathFor(cwd, bundleRoot) {
|
|
1279
|
+
return isGlobalInstall(bundleRoot) ? join7(cwd, ".gemini/config/hooks.json") : join7(cwd, ".agents/hooks.json");
|
|
1280
|
+
}
|
|
1281
|
+
var SETTINGS_PATH = ".gemini/antigravity-cli/settings.json";
|
|
1282
|
+
var antigravityAdapter = {
|
|
1283
|
+
name: "antigravity",
|
|
1284
|
+
async install(cwd, manifest, files, activation) {
|
|
1285
|
+
const installed = [];
|
|
1286
|
+
const config = manifest.install.antigravity;
|
|
1287
|
+
if (!config)
|
|
1288
|
+
return installed;
|
|
1289
|
+
if (config.mcpServers) {
|
|
1290
|
+
throw new Error(`Antigravity install of '${manifest.name}' does not support mcpServers`);
|
|
1291
|
+
}
|
|
1292
|
+
if (config.append) {
|
|
1293
|
+
throw new Error(`Antigravity install of '${manifest.name}' does not support append`);
|
|
1294
|
+
}
|
|
1295
|
+
if (config.prompt && files.has(manifest.files?.prompt ?? "")) {
|
|
1296
|
+
const targetPath = join7(cwd, config.prompt);
|
|
1297
|
+
mkdirSync6(dirname6(targetPath), { recursive: true });
|
|
1298
|
+
await Bun.write(targetPath, files.get(manifest.files.prompt));
|
|
1299
|
+
installed.push(config.prompt);
|
|
1300
|
+
}
|
|
1301
|
+
if (config.bundleRoot && manifest.bundle) {
|
|
1302
|
+
const skip = new Set([manifest.files?.prompt ?? ""]);
|
|
1303
|
+
installed.push(...await writeBundle(cwd, config.bundleRoot, files, skip));
|
|
1304
|
+
}
|
|
1305
|
+
if (config.postinstall && config.bundleRoot) {
|
|
1306
|
+
const scriptPath = join7(cwd, config.bundleRoot, config.postinstall);
|
|
1307
|
+
const result = runScript(scriptPath, join7(cwd, config.bundleRoot));
|
|
1308
|
+
if (!result.ok) {
|
|
1309
|
+
console.error(`postinstall script '${config.postinstall}' exited with code ${result.code}`);
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
const hooks = manifest.activation?.hooks;
|
|
1313
|
+
if (activation === "global" && hooks && config.bundleRoot) {
|
|
1314
|
+
const bundleDir = join7(cwd, config.bundleRoot);
|
|
1315
|
+
await wireAntigravityHooks(hooksPathFor(cwd, config.bundleRoot), manifest.name, bundleDir, manifest.activation?.claudeHookDirective, hooks);
|
|
1316
|
+
if (hooks.statusline && isGlobalInstall(config.bundleRoot)) {
|
|
1317
|
+
const script = shq3(join7(bundleDir, hooks.statusline));
|
|
1318
|
+
const command = `if [ -f ${script} ]; then bash ${script}; fi`;
|
|
1319
|
+
await wireAntigravityStatusLine(join7(cwd, SETTINGS_PATH), command);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
return installed;
|
|
1323
|
+
},
|
|
1324
|
+
async remove(cwd, manifest, installedFiles) {
|
|
1325
|
+
const config = manifest.install.antigravity;
|
|
1326
|
+
if (!config)
|
|
1327
|
+
return;
|
|
1328
|
+
if (config.postremove && config.bundleRoot) {
|
|
1329
|
+
const scriptPath = join7(cwd, config.bundleRoot, config.postremove);
|
|
1330
|
+
const result = runScript(scriptPath, join7(cwd, config.bundleRoot));
|
|
1331
|
+
if (!result.ok) {
|
|
1332
|
+
console.error(`postremove script '${config.postremove}' exited with code ${result.code}`);
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
if (config.bundleRoot) {
|
|
1336
|
+
const bundleDir = join7(cwd, config.bundleRoot);
|
|
1337
|
+
await unwireAntigravityHooks(hooksPathFor(cwd, config.bundleRoot), manifest.name);
|
|
1338
|
+
if (isGlobalInstall(config.bundleRoot)) {
|
|
1339
|
+
await unwireAntigravityStatusLine(join7(cwd, SETTINGS_PATH), bundleDir);
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
const stops = [cwd];
|
|
1343
|
+
if (config.bundleRoot)
|
|
1344
|
+
stops.push(join7(cwd, config.bundleRoot, ".."));
|
|
1345
|
+
else if (config.prompt)
|
|
1346
|
+
stops.push(join7(cwd, dirname6(config.prompt), ".."));
|
|
1347
|
+
removeInstalledFiles(cwd, installedFiles, stops, new Set);
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
|
|
996
1351
|
// src/cli/adapters/index.ts
|
|
997
1352
|
var adapters = {
|
|
998
1353
|
claude: claudeAdapter,
|
|
999
1354
|
cursor: cursorAdapter,
|
|
1000
1355
|
codex: codexAdapter,
|
|
1001
|
-
gemini: geminiAdapter
|
|
1356
|
+
gemini: geminiAdapter,
|
|
1357
|
+
antigravity: antigravityAdapter
|
|
1002
1358
|
};
|
|
1003
1359
|
function getAdapter(tool) {
|
|
1004
1360
|
return adapters[tool];
|
|
1005
1361
|
}
|
|
1006
1362
|
|
|
1007
1363
|
// src/cli/lockfile.ts
|
|
1008
|
-
import { join as
|
|
1364
|
+
import { join as join8 } from "node:path";
|
|
1009
1365
|
var LOCKFILE_NAME = ".agent-skills.lock";
|
|
1366
|
+
function fromPreChangeEntry(entry) {
|
|
1367
|
+
const record = {
|
|
1368
|
+
version: entry.version,
|
|
1369
|
+
files: entry.files,
|
|
1370
|
+
...entry.activation !== undefined ? { activation: entry.activation } : {}
|
|
1371
|
+
};
|
|
1372
|
+
const tools = {};
|
|
1373
|
+
for (const tool of entry.tools)
|
|
1374
|
+
tools[tool] = record;
|
|
1375
|
+
return { installedAt: entry.installedAt, tools };
|
|
1376
|
+
}
|
|
1377
|
+
function compareVersions(a, b) {
|
|
1378
|
+
const left = a.split(".").map(Number);
|
|
1379
|
+
const right = b.split(".").map(Number);
|
|
1380
|
+
for (let i = 0;i < Math.max(left.length, right.length); i++) {
|
|
1381
|
+
const diff = (left[i] ?? 0) - (right[i] ?? 0);
|
|
1382
|
+
if (diff !== 0)
|
|
1383
|
+
return diff;
|
|
1384
|
+
}
|
|
1385
|
+
return 0;
|
|
1386
|
+
}
|
|
1387
|
+
function lowestInstalledVersion(entry) {
|
|
1388
|
+
const versions = Object.values(entry.tools).map((record) => record.version);
|
|
1389
|
+
return versions.reduce((lowest, version) => compareVersions(version, lowest) < 0 ? version : lowest);
|
|
1390
|
+
}
|
|
1010
1391
|
async function readLockfile(cwd) {
|
|
1011
|
-
const path =
|
|
1392
|
+
const path = join8(cwd, LOCKFILE_NAME);
|
|
1012
1393
|
const file = Bun.file(path);
|
|
1013
1394
|
if (!await file.exists()) {
|
|
1014
1395
|
return { skills: {} };
|
|
1015
1396
|
}
|
|
1016
|
-
|
|
1397
|
+
const lockfile = await file.json();
|
|
1398
|
+
for (const [name, entry] of Object.entries(lockfile.skills)) {
|
|
1399
|
+
if (Array.isArray(entry.tools)) {
|
|
1400
|
+
lockfile.skills[name] = fromPreChangeEntry(entry);
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
return lockfile;
|
|
1017
1404
|
}
|
|
1018
1405
|
async function writeLockfile(cwd, lockfile) {
|
|
1019
|
-
const path =
|
|
1406
|
+
const path = join8(cwd, LOCKFILE_NAME);
|
|
1020
1407
|
await Bun.write(path, JSON.stringify(lockfile, null, 2) + `
|
|
1021
1408
|
`);
|
|
1022
1409
|
}
|
|
1023
|
-
async function addSkillToLockfile(cwd, skillName,
|
|
1410
|
+
async function addSkillToLockfile(cwd, skillName, tool, record) {
|
|
1024
1411
|
const lockfile = await readLockfile(cwd);
|
|
1025
|
-
lockfile.skills[skillName]
|
|
1412
|
+
const tools = lockfile.skills[skillName]?.tools ?? {};
|
|
1413
|
+
tools[tool] = record;
|
|
1414
|
+
lockfile.skills[skillName] = { installedAt: new Date().toISOString(), tools };
|
|
1026
1415
|
await writeLockfile(cwd, lockfile);
|
|
1027
1416
|
}
|
|
1028
1417
|
async function removeSkillFromLockfile(cwd, skillName) {
|
|
@@ -1032,7 +1421,7 @@ async function removeSkillFromLockfile(cwd, skillName) {
|
|
|
1032
1421
|
}
|
|
1033
1422
|
|
|
1034
1423
|
// src/cli/commands/install.ts
|
|
1035
|
-
async function installSkill(cwd, manifest, files, targetTools, activation) {
|
|
1424
|
+
async function installSkill(cwd, manifest, files, targetTools, activation, isGlobal) {
|
|
1036
1425
|
const compatibleTools = targetTools.filter((t) => manifest.tools.includes(t));
|
|
1037
1426
|
const skipped = targetTools.filter((t) => !manifest.tools.includes(t));
|
|
1038
1427
|
if (compatibleTools.length === 0) {
|
|
@@ -1042,26 +1431,24 @@ async function installSkill(cwd, manifest, files, targetTools, activation) {
|
|
|
1042
1431
|
};
|
|
1043
1432
|
}
|
|
1044
1433
|
const installed = {};
|
|
1045
|
-
const allFiles = [];
|
|
1046
1434
|
for (const tool of compatibleTools) {
|
|
1047
1435
|
const adapter = getAdapter(tool);
|
|
1048
|
-
const
|
|
1436
|
+
const config = manifest.install[tool];
|
|
1437
|
+
const resolved = config ? { ...manifest, install: { ...manifest.install, [tool]: resolveInstallConfig(config, isGlobal) } } : manifest;
|
|
1438
|
+
const toolFiles = await adapter.install(cwd, resolved, files, activation, isGlobal);
|
|
1049
1439
|
installed[tool] = toolFiles;
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
files: allFiles,
|
|
1057
|
-
...activation !== undefined ? { activation } : {}
|
|
1058
|
-
});
|
|
1440
|
+
await addSkillToLockfile(cwd, manifest.name, tool, {
|
|
1441
|
+
version: manifest.version,
|
|
1442
|
+
files: toolFiles,
|
|
1443
|
+
...activation !== undefined ? { activation } : {}
|
|
1444
|
+
});
|
|
1445
|
+
}
|
|
1059
1446
|
return { ok: true, installed, skipped };
|
|
1060
1447
|
}
|
|
1061
1448
|
|
|
1062
1449
|
// src/cli/commands/remove.ts
|
|
1063
|
-
import { existsSync as
|
|
1064
|
-
import { basename, join as
|
|
1450
|
+
import { existsSync as existsSync8, statSync as statSync2, unlinkSync as unlinkSync4, rmSync as rmSync2 } from "node:fs";
|
|
1451
|
+
import { basename, dirname as dirname7, join as join9 } from "node:path";
|
|
1065
1452
|
|
|
1066
1453
|
// src/cli/github.ts
|
|
1067
1454
|
var REPO2 = "iceinvein/agent-skills";
|
|
@@ -1171,7 +1558,11 @@ var SHARED_CONFIG_FILES = new Set([
|
|
|
1171
1558
|
".claude/settings.json",
|
|
1172
1559
|
".claude/settings.local.json",
|
|
1173
1560
|
".cursor/mcp.json",
|
|
1174
|
-
".gemini/settings.json"
|
|
1561
|
+
".gemini/settings.json",
|
|
1562
|
+
".codex/hooks.json",
|
|
1563
|
+
".agents/hooks.json",
|
|
1564
|
+
".gemini/config/hooks.json",
|
|
1565
|
+
"AGENTS.md"
|
|
1175
1566
|
]);
|
|
1176
1567
|
function isSharedConfigFile(relPath) {
|
|
1177
1568
|
if (SHARED_CONFIG_FILES.has(relPath))
|
|
@@ -1189,20 +1580,82 @@ function removeFileOrDir(fullPath) {
|
|
|
1189
1580
|
unlinkSync4(fullPath);
|
|
1190
1581
|
}
|
|
1191
1582
|
}
|
|
1192
|
-
async function
|
|
1583
|
+
async function cutAgentsSection(agentsPath, skillName) {
|
|
1584
|
+
if (!existsSync8(agentsPath))
|
|
1585
|
+
return;
|
|
1586
|
+
const content = await Bun.file(agentsPath).text();
|
|
1587
|
+
const startMarker = `<!-- agent-skills:start:${skillName} -->`;
|
|
1588
|
+
const endMarker = `<!-- agent-skills:end:${skillName} -->`;
|
|
1589
|
+
const startIdx = content.indexOf(startMarker);
|
|
1590
|
+
const endIdx = content.indexOf(endMarker);
|
|
1591
|
+
if (startIdx === -1 || endIdx === -1)
|
|
1592
|
+
return;
|
|
1593
|
+
const before = content.slice(0, startIdx).replace(/\n$/, "");
|
|
1594
|
+
const after = content.slice(endIdx + endMarker.length).replace(/^\n/, "");
|
|
1595
|
+
await Bun.write(agentsPath, before + after);
|
|
1596
|
+
}
|
|
1597
|
+
async function removeWithoutManifest(cwd, skillName, tools, reason, isGlobal) {
|
|
1598
|
+
const removed = [];
|
|
1599
|
+
const warnings = [];
|
|
1600
|
+
const skillDirs = (record) => record.files.filter((f) => f.endsWith("SKILL.md")).map((f) => join9(cwd, dirname7(f)));
|
|
1601
|
+
if (tools.codex) {
|
|
1602
|
+
for (const bundleDir of skillDirs(tools.codex)) {
|
|
1603
|
+
for (const hooksPath of codexHooksPathsToUnwire(cwd, isGlobal)) {
|
|
1604
|
+
await unwireCodexHooks(hooksPath, bundleDir);
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
if (tools.antigravity) {
|
|
1609
|
+
await unwireAntigravityHooks(join9(cwd, ".gemini/config/hooks.json"), skillName);
|
|
1610
|
+
await unwireAntigravityHooks(join9(cwd, ".agents/hooks.json"), skillName);
|
|
1611
|
+
for (const bundleDir of skillDirs(tools.antigravity)) {
|
|
1612
|
+
await unwireAntigravityStatusLine(join9(cwd, ".gemini/antigravity-cli/settings.json"), bundleDir);
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
const files = [...new Set(Object.values(tools).flatMap((record) => record.files))];
|
|
1616
|
+
for (const file of files) {
|
|
1617
|
+
if (file === "AGENTS.md") {
|
|
1618
|
+
await cutAgentsSection(join9(cwd, file), skillName);
|
|
1619
|
+
continue;
|
|
1620
|
+
}
|
|
1621
|
+
if (isSharedConfigFile(file)) {
|
|
1622
|
+
const fullPath = join9(cwd, file);
|
|
1623
|
+
if (existsSync8(fullPath)) {
|
|
1624
|
+
await unwireSessionStartHook(fullPath, skillName);
|
|
1625
|
+
await unwireStatusLine(fullPath, skillName);
|
|
1626
|
+
}
|
|
1627
|
+
warnings.push(`${reason}. Left '${file}' in place, removing '${skillName}'s SessionStart hook and status line from it; any MCP server entries it owns were not touched.`);
|
|
1628
|
+
continue;
|
|
1629
|
+
}
|
|
1630
|
+
const fullPath = join9(cwd, file);
|
|
1631
|
+
if (!existsSync8(fullPath))
|
|
1632
|
+
continue;
|
|
1633
|
+
removeFileOrDir(fullPath);
|
|
1634
|
+
removed.push(file);
|
|
1635
|
+
}
|
|
1636
|
+
return { removed, warnings };
|
|
1637
|
+
}
|
|
1638
|
+
async function removeSkill(cwd, skillName, isGlobal, manifest) {
|
|
1193
1639
|
const lockfile = await readLockfile(cwd);
|
|
1194
1640
|
const entry = lockfile.skills[skillName];
|
|
1195
1641
|
if (!entry) {
|
|
1196
1642
|
return { ok: false, error: `Skill '${skillName}' is not installed` };
|
|
1197
1643
|
}
|
|
1198
|
-
const
|
|
1644
|
+
const records = Object.entries(entry.tools);
|
|
1645
|
+
const allFiles = [...new Set(records.flatMap(([, record]) => record.files))];
|
|
1646
|
+
const manifestResult = manifest ? { ok: true, manifest } : await fetchSkillManifest2(skillName);
|
|
1199
1647
|
if (manifestResult.ok) {
|
|
1200
|
-
|
|
1648
|
+
const dropped = {};
|
|
1649
|
+
for (const [tool, record] of records) {
|
|
1201
1650
|
const adapter = getAdapter(tool);
|
|
1202
|
-
const
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1651
|
+
const manifest = manifestResult.manifest;
|
|
1652
|
+
const rawConfig = manifest.install[tool];
|
|
1653
|
+
if (!rawConfig) {
|
|
1654
|
+
dropped[tool] = record;
|
|
1655
|
+
continue;
|
|
1656
|
+
}
|
|
1657
|
+
const config = resolveInstallConfig(rawConfig, isGlobal);
|
|
1658
|
+
const toolFiles = record.files.filter((f) => {
|
|
1206
1659
|
if (config.prompt && f === config.prompt)
|
|
1207
1660
|
return true;
|
|
1208
1661
|
if (config.supporting && Object.values(config.supporting).includes(f))
|
|
@@ -1213,29 +1666,17 @@ async function removeSkill(cwd, skillName) {
|
|
|
1213
1666
|
return true;
|
|
1214
1667
|
return false;
|
|
1215
1668
|
});
|
|
1216
|
-
|
|
1669
|
+
const resolved = { ...manifest, install: { ...manifest.install, [tool]: config } };
|
|
1670
|
+
await adapter.remove(cwd, resolved, toolFiles, isGlobal);
|
|
1217
1671
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
const removed = [];
|
|
1222
|
-
const warnings = [];
|
|
1223
|
-
for (const file of entry.files) {
|
|
1224
|
-
if (isSharedConfigFile(file)) {
|
|
1225
|
-
const fullPath = join7(cwd, file);
|
|
1226
|
-
if (existsSync6(fullPath)) {
|
|
1227
|
-
await unwireSessionStartHook(fullPath, skillName);
|
|
1228
|
-
await unwireStatusLine(fullPath, skillName);
|
|
1229
|
-
}
|
|
1230
|
-
warnings.push(`Manifest unavailable (${manifestResult.error}). Left '${file}' in place, removing '${skillName}'s SessionStart hook and status line from it; any MCP server entries it owns were not touched.`);
|
|
1231
|
-
continue;
|
|
1672
|
+
let warnings = [];
|
|
1673
|
+
if (Object.keys(dropped).length > 0) {
|
|
1674
|
+
({ warnings } = await removeWithoutManifest(cwd, skillName, dropped, `The manifest no longer lists ${Object.keys(dropped).join(", ")}`, isGlobal));
|
|
1232
1675
|
}
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
continue;
|
|
1236
|
-
removeFileOrDir(fullPath);
|
|
1237
|
-
removed.push(file);
|
|
1676
|
+
await removeSkillFromLockfile(cwd, skillName);
|
|
1677
|
+
return { ok: true, removed: allFiles, ...warnings.length > 0 ? { warnings } : {} };
|
|
1238
1678
|
}
|
|
1679
|
+
const { removed, warnings } = await removeWithoutManifest(cwd, skillName, entry.tools, `Manifest unavailable (${manifestResult.error})`, isGlobal);
|
|
1239
1680
|
await removeSkillFromLockfile(cwd, skillName);
|
|
1240
1681
|
return { ok: true, removed, ...warnings.length > 0 ? { warnings } : {} };
|
|
1241
1682
|
}
|
|
@@ -1258,14 +1699,21 @@ async function infoSkill(skillName) {
|
|
|
1258
1699
|
return fetchSkillManifest2(skillName);
|
|
1259
1700
|
}
|
|
1260
1701
|
|
|
1702
|
+
// src/cli/commands/update.ts
|
|
1703
|
+
import { homedir as homedir2 } from "node:os";
|
|
1704
|
+
|
|
1261
1705
|
// src/cli/commands/remove.ts
|
|
1262
|
-
import { existsSync as
|
|
1263
|
-
import { basename as basename2, join as
|
|
1706
|
+
import { existsSync as existsSync9, statSync as statSync3, unlinkSync as unlinkSync5, rmSync as rmSync3 } from "node:fs";
|
|
1707
|
+
import { basename as basename2, dirname as dirname8, join as join10 } from "node:path";
|
|
1264
1708
|
var SHARED_CONFIG_FILES2 = new Set([
|
|
1265
1709
|
".claude/settings.json",
|
|
1266
1710
|
".claude/settings.local.json",
|
|
1267
1711
|
".cursor/mcp.json",
|
|
1268
|
-
".gemini/settings.json"
|
|
1712
|
+
".gemini/settings.json",
|
|
1713
|
+
".codex/hooks.json",
|
|
1714
|
+
".agents/hooks.json",
|
|
1715
|
+
".gemini/config/hooks.json",
|
|
1716
|
+
"AGENTS.md"
|
|
1269
1717
|
]);
|
|
1270
1718
|
function isSharedConfigFile2(relPath) {
|
|
1271
1719
|
if (SHARED_CONFIG_FILES2.has(relPath))
|
|
@@ -1283,20 +1731,82 @@ function removeFileOrDir2(fullPath) {
|
|
|
1283
1731
|
unlinkSync5(fullPath);
|
|
1284
1732
|
}
|
|
1285
1733
|
}
|
|
1286
|
-
async function
|
|
1734
|
+
async function cutAgentsSection2(agentsPath, skillName) {
|
|
1735
|
+
if (!existsSync9(agentsPath))
|
|
1736
|
+
return;
|
|
1737
|
+
const content = await Bun.file(agentsPath).text();
|
|
1738
|
+
const startMarker = `<!-- agent-skills:start:${skillName} -->`;
|
|
1739
|
+
const endMarker = `<!-- agent-skills:end:${skillName} -->`;
|
|
1740
|
+
const startIdx = content.indexOf(startMarker);
|
|
1741
|
+
const endIdx = content.indexOf(endMarker);
|
|
1742
|
+
if (startIdx === -1 || endIdx === -1)
|
|
1743
|
+
return;
|
|
1744
|
+
const before = content.slice(0, startIdx).replace(/\n$/, "");
|
|
1745
|
+
const after = content.slice(endIdx + endMarker.length).replace(/^\n/, "");
|
|
1746
|
+
await Bun.write(agentsPath, before + after);
|
|
1747
|
+
}
|
|
1748
|
+
async function removeWithoutManifest2(cwd, skillName, tools, reason, isGlobal) {
|
|
1749
|
+
const removed = [];
|
|
1750
|
+
const warnings = [];
|
|
1751
|
+
const skillDirs = (record) => record.files.filter((f) => f.endsWith("SKILL.md")).map((f) => join10(cwd, dirname8(f)));
|
|
1752
|
+
if (tools.codex) {
|
|
1753
|
+
for (const bundleDir of skillDirs(tools.codex)) {
|
|
1754
|
+
for (const hooksPath of codexHooksPathsToUnwire(cwd, isGlobal)) {
|
|
1755
|
+
await unwireCodexHooks(hooksPath, bundleDir);
|
|
1756
|
+
}
|
|
1757
|
+
}
|
|
1758
|
+
}
|
|
1759
|
+
if (tools.antigravity) {
|
|
1760
|
+
await unwireAntigravityHooks(join10(cwd, ".gemini/config/hooks.json"), skillName);
|
|
1761
|
+
await unwireAntigravityHooks(join10(cwd, ".agents/hooks.json"), skillName);
|
|
1762
|
+
for (const bundleDir of skillDirs(tools.antigravity)) {
|
|
1763
|
+
await unwireAntigravityStatusLine(join10(cwd, ".gemini/antigravity-cli/settings.json"), bundleDir);
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
const files = [...new Set(Object.values(tools).flatMap((record) => record.files))];
|
|
1767
|
+
for (const file of files) {
|
|
1768
|
+
if (file === "AGENTS.md") {
|
|
1769
|
+
await cutAgentsSection2(join10(cwd, file), skillName);
|
|
1770
|
+
continue;
|
|
1771
|
+
}
|
|
1772
|
+
if (isSharedConfigFile2(file)) {
|
|
1773
|
+
const fullPath = join10(cwd, file);
|
|
1774
|
+
if (existsSync9(fullPath)) {
|
|
1775
|
+
await unwireSessionStartHook(fullPath, skillName);
|
|
1776
|
+
await unwireStatusLine(fullPath, skillName);
|
|
1777
|
+
}
|
|
1778
|
+
warnings.push(`${reason}. Left '${file}' in place, removing '${skillName}'s SessionStart hook and status line from it; any MCP server entries it owns were not touched.`);
|
|
1779
|
+
continue;
|
|
1780
|
+
}
|
|
1781
|
+
const fullPath = join10(cwd, file);
|
|
1782
|
+
if (!existsSync9(fullPath))
|
|
1783
|
+
continue;
|
|
1784
|
+
removeFileOrDir2(fullPath);
|
|
1785
|
+
removed.push(file);
|
|
1786
|
+
}
|
|
1787
|
+
return { removed, warnings };
|
|
1788
|
+
}
|
|
1789
|
+
async function removeSkill2(cwd, skillName, isGlobal, manifest) {
|
|
1287
1790
|
const lockfile = await readLockfile(cwd);
|
|
1288
1791
|
const entry = lockfile.skills[skillName];
|
|
1289
1792
|
if (!entry) {
|
|
1290
1793
|
return { ok: false, error: `Skill '${skillName}' is not installed` };
|
|
1291
1794
|
}
|
|
1292
|
-
const
|
|
1795
|
+
const records = Object.entries(entry.tools);
|
|
1796
|
+
const allFiles = [...new Set(records.flatMap(([, record]) => record.files))];
|
|
1797
|
+
const manifestResult = manifest ? { ok: true, manifest } : await fetchSkillManifest2(skillName);
|
|
1293
1798
|
if (manifestResult.ok) {
|
|
1294
|
-
|
|
1799
|
+
const dropped = {};
|
|
1800
|
+
for (const [tool, record] of records) {
|
|
1295
1801
|
const adapter = getAdapter(tool);
|
|
1296
|
-
const
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1802
|
+
const manifest = manifestResult.manifest;
|
|
1803
|
+
const rawConfig = manifest.install[tool];
|
|
1804
|
+
if (!rawConfig) {
|
|
1805
|
+
dropped[tool] = record;
|
|
1806
|
+
continue;
|
|
1807
|
+
}
|
|
1808
|
+
const config = resolveInstallConfig(rawConfig, isGlobal);
|
|
1809
|
+
const toolFiles = record.files.filter((f) => {
|
|
1300
1810
|
if (config.prompt && f === config.prompt)
|
|
1301
1811
|
return true;
|
|
1302
1812
|
if (config.supporting && Object.values(config.supporting).includes(f))
|
|
@@ -1307,35 +1817,23 @@ async function removeSkill2(cwd, skillName) {
|
|
|
1307
1817
|
return true;
|
|
1308
1818
|
return false;
|
|
1309
1819
|
});
|
|
1310
|
-
|
|
1820
|
+
const resolved = { ...manifest, install: { ...manifest.install, [tool]: config } };
|
|
1821
|
+
await adapter.remove(cwd, resolved, toolFiles, isGlobal);
|
|
1311
1822
|
}
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
const removed = [];
|
|
1316
|
-
const warnings = [];
|
|
1317
|
-
for (const file of entry.files) {
|
|
1318
|
-
if (isSharedConfigFile2(file)) {
|
|
1319
|
-
const fullPath = join8(cwd, file);
|
|
1320
|
-
if (existsSync7(fullPath)) {
|
|
1321
|
-
await unwireSessionStartHook(fullPath, skillName);
|
|
1322
|
-
await unwireStatusLine(fullPath, skillName);
|
|
1323
|
-
}
|
|
1324
|
-
warnings.push(`Manifest unavailable (${manifestResult.error}). Left '${file}' in place, removing '${skillName}'s SessionStart hook and status line from it; any MCP server entries it owns were not touched.`);
|
|
1325
|
-
continue;
|
|
1823
|
+
let warnings = [];
|
|
1824
|
+
if (Object.keys(dropped).length > 0) {
|
|
1825
|
+
({ warnings } = await removeWithoutManifest2(cwd, skillName, dropped, `The manifest no longer lists ${Object.keys(dropped).join(", ")}`, isGlobal));
|
|
1326
1826
|
}
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
continue;
|
|
1330
|
-
removeFileOrDir2(fullPath);
|
|
1331
|
-
removed.push(file);
|
|
1827
|
+
await removeSkillFromLockfile(cwd, skillName);
|
|
1828
|
+
return { ok: true, removed: allFiles, ...warnings.length > 0 ? { warnings } : {} };
|
|
1332
1829
|
}
|
|
1830
|
+
const { removed, warnings } = await removeWithoutManifest2(cwd, skillName, entry.tools, `Manifest unavailable (${manifestResult.error})`, isGlobal);
|
|
1333
1831
|
await removeSkillFromLockfile(cwd, skillName);
|
|
1334
1832
|
return { ok: true, removed, ...warnings.length > 0 ? { warnings } : {} };
|
|
1335
1833
|
}
|
|
1336
1834
|
|
|
1337
1835
|
// src/cli/commands/install.ts
|
|
1338
|
-
async function installSkill2(cwd, manifest, files, targetTools, activation) {
|
|
1836
|
+
async function installSkill2(cwd, manifest, files, targetTools, activation, isGlobal) {
|
|
1339
1837
|
const compatibleTools = targetTools.filter((t) => manifest.tools.includes(t));
|
|
1340
1838
|
const skipped = targetTools.filter((t) => !manifest.tools.includes(t));
|
|
1341
1839
|
if (compatibleTools.length === 0) {
|
|
@@ -1345,20 +1843,18 @@ async function installSkill2(cwd, manifest, files, targetTools, activation) {
|
|
|
1345
1843
|
};
|
|
1346
1844
|
}
|
|
1347
1845
|
const installed = {};
|
|
1348
|
-
const allFiles = [];
|
|
1349
1846
|
for (const tool of compatibleTools) {
|
|
1350
1847
|
const adapter = getAdapter(tool);
|
|
1351
|
-
const
|
|
1848
|
+
const config = manifest.install[tool];
|
|
1849
|
+
const resolved = config ? { ...manifest, install: { ...manifest.install, [tool]: resolveInstallConfig(config, isGlobal) } } : manifest;
|
|
1850
|
+
const toolFiles = await adapter.install(cwd, resolved, files, activation, isGlobal);
|
|
1352
1851
|
installed[tool] = toolFiles;
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
files: allFiles,
|
|
1360
|
-
...activation !== undefined ? { activation } : {}
|
|
1361
|
-
});
|
|
1852
|
+
await addSkillToLockfile(cwd, manifest.name, tool, {
|
|
1853
|
+
version: manifest.version,
|
|
1854
|
+
files: toolFiles,
|
|
1855
|
+
...activation !== undefined ? { activation } : {}
|
|
1856
|
+
});
|
|
1857
|
+
}
|
|
1362
1858
|
return { ok: true, installed, skipped };
|
|
1363
1859
|
}
|
|
1364
1860
|
|
|
@@ -1369,9 +1865,9 @@ async function updateSkill(cwd, skillName) {
|
|
|
1369
1865
|
if (!entry) {
|
|
1370
1866
|
return { ok: false, error: `Skill '${skillName}' is not installed` };
|
|
1371
1867
|
}
|
|
1372
|
-
const
|
|
1373
|
-
const
|
|
1374
|
-
const
|
|
1868
|
+
const records = Object.entries(entry.tools);
|
|
1869
|
+
const oldVersion = lowestInstalledVersion(entry);
|
|
1870
|
+
const isGlobal = cwd === homedir2();
|
|
1375
1871
|
const manifestResult = await fetchSkillManifest2(skillName);
|
|
1376
1872
|
if (!manifestResult.ok) {
|
|
1377
1873
|
return { ok: false, error: manifestResult.error };
|
|
@@ -1380,12 +1876,23 @@ async function updateSkill(cwd, skillName) {
|
|
|
1380
1876
|
if ("error" in filesResult) {
|
|
1381
1877
|
return { ok: false, error: filesResult.error };
|
|
1382
1878
|
}
|
|
1383
|
-
|
|
1384
|
-
const
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1879
|
+
const manifest = manifestResult.manifest;
|
|
1880
|
+
const kept = records.filter(([tool]) => manifest.tools.includes(tool));
|
|
1881
|
+
const skipped = records.filter(([tool]) => !manifest.tools.includes(tool)).map(([tool]) => tool);
|
|
1882
|
+
const removeResult = await removeSkill2(cwd, skillName, isGlobal, manifest);
|
|
1883
|
+
if (!removeResult.ok) {
|
|
1884
|
+
return { ok: false, error: removeResult.error };
|
|
1885
|
+
}
|
|
1886
|
+
const failures = [];
|
|
1887
|
+
for (const [tool, record] of kept) {
|
|
1888
|
+
const installResult = await installSkill2(cwd, manifest, filesResult, [tool], record.activation, isGlobal);
|
|
1889
|
+
if (!installResult.ok)
|
|
1890
|
+
failures.push(installResult.error);
|
|
1891
|
+
}
|
|
1892
|
+
if (failures.length > 0) {
|
|
1893
|
+
return { ok: false, error: failures.join("; ") };
|
|
1894
|
+
}
|
|
1895
|
+
return { ok: true, from: oldVersion, to: manifest.version, skipped, warnings: removeResult.warnings ?? [] };
|
|
1389
1896
|
}
|
|
1390
1897
|
async function updateAllSkills(cwd) {
|
|
1391
1898
|
const lockfile = await readLockfile(cwd);
|
|
@@ -1401,7 +1908,7 @@ async function updateAllSkills(cwd) {
|
|
|
1401
1908
|
}
|
|
1402
1909
|
|
|
1403
1910
|
// src/cli/commands/bump.ts
|
|
1404
|
-
import { join as
|
|
1911
|
+
import { join as join11 } from "node:path";
|
|
1405
1912
|
|
|
1406
1913
|
// src/cli/semver.ts
|
|
1407
1914
|
function bumpVersion(current, level) {
|
|
@@ -1422,7 +1929,7 @@ function bumpVersion(current, level) {
|
|
|
1422
1929
|
|
|
1423
1930
|
// src/cli/commands/bump.ts
|
|
1424
1931
|
async function bumpSkill(repoRoot, skillName, level) {
|
|
1425
|
-
const manifestPath =
|
|
1932
|
+
const manifestPath = join11(repoRoot, "skills", skillName, "skill.json");
|
|
1426
1933
|
const file = Bun.file(manifestPath);
|
|
1427
1934
|
if (!await file.exists()) {
|
|
1428
1935
|
return { ok: false, error: `Skill '${skillName}' not found at skills/${skillName}/skill.json` };
|
|
@@ -1493,7 +2000,7 @@ async function bumpAllChanged(repoRoot, level, dryRun) {
|
|
|
1493
2000
|
if (skillVersionChanged(repoRoot, skillName, tag))
|
|
1494
2001
|
continue;
|
|
1495
2002
|
if (dryRun) {
|
|
1496
|
-
const manifestPath =
|
|
2003
|
+
const manifestPath = join11(repoRoot, "skills", skillName, "skill.json");
|
|
1497
2004
|
const file = Bun.file(manifestPath);
|
|
1498
2005
|
if (!await file.exists())
|
|
1499
2006
|
continue;
|
|
@@ -1531,8 +2038,9 @@ async function checkForUpdates(cwd) {
|
|
|
1531
2038
|
const result = await fetchSkillManifest2(name);
|
|
1532
2039
|
if (!result.ok)
|
|
1533
2040
|
return null;
|
|
1534
|
-
const
|
|
1535
|
-
|
|
2041
|
+
const records = Object.values(lockfile.skills[name].tools);
|
|
2042
|
+
const installed = lowestInstalledVersion(lockfile.skills[name]);
|
|
2043
|
+
if (records.some((record) => record.version !== result.manifest.version)) {
|
|
1536
2044
|
return { name, installed, latest: result.manifest.version };
|
|
1537
2045
|
}
|
|
1538
2046
|
return null;
|
|
@@ -1549,19 +2057,36 @@ async function checkForUpdates(cwd) {
|
|
|
1549
2057
|
}
|
|
1550
2058
|
|
|
1551
2059
|
// src/cli/lockfile.ts
|
|
1552
|
-
import { join as
|
|
2060
|
+
import { join as join12 } from "node:path";
|
|
1553
2061
|
var LOCKFILE_NAME2 = ".agent-skills.lock";
|
|
2062
|
+
function fromPreChangeEntry2(entry) {
|
|
2063
|
+
const record = {
|
|
2064
|
+
version: entry.version,
|
|
2065
|
+
files: entry.files,
|
|
2066
|
+
...entry.activation !== undefined ? { activation: entry.activation } : {}
|
|
2067
|
+
};
|
|
2068
|
+
const tools = {};
|
|
2069
|
+
for (const tool of entry.tools)
|
|
2070
|
+
tools[tool] = record;
|
|
2071
|
+
return { installedAt: entry.installedAt, tools };
|
|
2072
|
+
}
|
|
1554
2073
|
async function readLockfile2(cwd) {
|
|
1555
|
-
const path =
|
|
2074
|
+
const path = join12(cwd, LOCKFILE_NAME2);
|
|
1556
2075
|
const file = Bun.file(path);
|
|
1557
2076
|
if (!await file.exists()) {
|
|
1558
2077
|
return { skills: {} };
|
|
1559
2078
|
}
|
|
1560
|
-
|
|
2079
|
+
const lockfile = await file.json();
|
|
2080
|
+
for (const [name, entry] of Object.entries(lockfile.skills)) {
|
|
2081
|
+
if (Array.isArray(entry.tools)) {
|
|
2082
|
+
lockfile.skills[name] = fromPreChangeEntry2(entry);
|
|
2083
|
+
}
|
|
2084
|
+
}
|
|
2085
|
+
return lockfile;
|
|
1561
2086
|
}
|
|
1562
2087
|
|
|
1563
2088
|
// src/cli/types.ts
|
|
1564
|
-
var TOOL_NAMES2 = ["claude", "cursor", "codex", "gemini"];
|
|
2089
|
+
var TOOL_NAMES2 = ["claude", "cursor", "codex", "gemini", "antigravity"];
|
|
1565
2090
|
|
|
1566
2091
|
// node_modules/@inquirer/core/dist/lib/key.js
|
|
1567
2092
|
var isUpKey = (key, keybindings = []) => key.name === "up" || keybindings.includes("vim") && key.name === "k" || keybindings.includes("emacs") && key.ctrl && key.name === "p";
|
|
@@ -3373,7 +3898,8 @@ var TOOL_LABELS = {
|
|
|
3373
3898
|
claude: "Claude Code",
|
|
3374
3899
|
cursor: "Cursor",
|
|
3375
3900
|
codex: "Codex",
|
|
3376
|
-
gemini: "Gemini CLI"
|
|
3901
|
+
gemini: "Gemini CLI",
|
|
3902
|
+
antigravity: "Antigravity"
|
|
3377
3903
|
};
|
|
3378
3904
|
function formatChoice(skill) {
|
|
3379
3905
|
const tag = TYPE_TAGS[skill.type] ?? "[other] ";
|
|
@@ -3431,11 +3957,11 @@ async function pickActivation(skillName, modes) {
|
|
|
3431
3957
|
}
|
|
3432
3958
|
|
|
3433
3959
|
// src/cli/index.ts
|
|
3434
|
-
import { mkdirSync as
|
|
3435
|
-
import { join as
|
|
3436
|
-
import { homedir as
|
|
3960
|
+
import { mkdirSync as mkdirSync7 } from "fs";
|
|
3961
|
+
import { join as join13 } from "path";
|
|
3962
|
+
import { homedir as homedir3 } from "os";
|
|
3437
3963
|
async function otherScopeSkillCount(currentDir) {
|
|
3438
|
-
const home =
|
|
3964
|
+
const home = homedir3();
|
|
3439
3965
|
const otherDir = currentDir === home ? process.cwd() : home;
|
|
3440
3966
|
if (otherDir === currentDir)
|
|
3441
3967
|
return { scope: "global", count: 0 };
|
|
@@ -3447,7 +3973,7 @@ async function otherScopeSkillCount(currentDir) {
|
|
|
3447
3973
|
}
|
|
3448
3974
|
function resolveInstallDir(flags) {
|
|
3449
3975
|
if (flags.global !== undefined || flags.g !== undefined) {
|
|
3450
|
-
return
|
|
3976
|
+
return homedir3();
|
|
3451
3977
|
}
|
|
3452
3978
|
return process.cwd();
|
|
3453
3979
|
}
|
|
@@ -3513,7 +4039,8 @@ function printInstalled(result, skipped) {
|
|
|
3513
4039
|
var TOOL_DIRS = {
|
|
3514
4040
|
claude: ".claude",
|
|
3515
4041
|
cursor: ".cursor",
|
|
3516
|
-
gemini: ".gemini"
|
|
4042
|
+
gemini: ".gemini",
|
|
4043
|
+
antigravity: ".agents"
|
|
3517
4044
|
};
|
|
3518
4045
|
async function resolveTargetTools(installDir, isGlobal, flags) {
|
|
3519
4046
|
if (flags.tool) {
|
|
@@ -3529,14 +4056,14 @@ async function resolveTargetTools(installDir, isGlobal, flags) {
|
|
|
3529
4056
|
return detected;
|
|
3530
4057
|
}
|
|
3531
4058
|
if (!process.stdin.isTTY) {
|
|
3532
|
-
console.error("Error: no tools detected and no TTY for prompting. Pass --tool <claude|cursor|codex|gemini>.");
|
|
4059
|
+
console.error("Error: no tools detected and no TTY for prompting. Pass --tool <claude|cursor|codex|gemini|antigravity>.");
|
|
3533
4060
|
return null;
|
|
3534
4061
|
}
|
|
3535
4062
|
const picked = await pickTools(isGlobal ? "Which tools do you use?" : "No tools detected in this directory. Which tools do you use?");
|
|
3536
4063
|
for (const tool of picked) {
|
|
3537
4064
|
const dir = TOOL_DIRS[tool];
|
|
3538
4065
|
if (dir)
|
|
3539
|
-
|
|
4066
|
+
mkdirSync7(join13(installDir, dir), { recursive: true });
|
|
3540
4067
|
}
|
|
3541
4068
|
return picked;
|
|
3542
4069
|
}
|
|
@@ -3568,7 +4095,7 @@ async function installOne(skillName, installDir, isGlobal, targetTools, flags) {
|
|
|
3568
4095
|
activation = manifest.activation.default;
|
|
3569
4096
|
}
|
|
3570
4097
|
}
|
|
3571
|
-
const result = await installSkill(installDir, manifest, filesResult, targetTools, activation);
|
|
4098
|
+
const result = await installSkill(installDir, manifest, filesResult, targetTools, activation, isGlobal);
|
|
3572
4099
|
if (!result.ok) {
|
|
3573
4100
|
console.error(`Error: ${result.error}`);
|
|
3574
4101
|
return false;
|
|
@@ -3584,7 +4111,7 @@ async function main() {
|
|
|
3584
4111
|
case "install":
|
|
3585
4112
|
case "browse": {
|
|
3586
4113
|
const installDir = resolveInstallDir(flags);
|
|
3587
|
-
const isGlobal = installDir ===
|
|
4114
|
+
const isGlobal = installDir === homedir3();
|
|
3588
4115
|
let names = args;
|
|
3589
4116
|
if (names.length === 0 || command === "browse") {
|
|
3590
4117
|
if (!process.stdin.isTTY) {
|
|
@@ -3635,7 +4162,7 @@ Installing ${names.length} skills...
|
|
|
3635
4162
|
process.exit(1);
|
|
3636
4163
|
}
|
|
3637
4164
|
const removeDir = resolveInstallDir(flags);
|
|
3638
|
-
const result = await removeSkill(removeDir, skillName);
|
|
4165
|
+
const result = await removeSkill(removeDir, skillName, removeDir === homedir3());
|
|
3639
4166
|
if (!result.ok) {
|
|
3640
4167
|
console.error(`Error: ${result.error}`);
|
|
3641
4168
|
process.exit(1);
|
|
@@ -3665,6 +4192,13 @@ Installing ${names.length} skills...
|
|
|
3665
4192
|
} else {
|
|
3666
4193
|
console.log(` \u2713 ${r.name} v${r.from} \u2192 v${r.to}`);
|
|
3667
4194
|
}
|
|
4195
|
+
if (r.ok && r.skipped.length > 0) {
|
|
4196
|
+
console.log(` \u2298 removed from ${r.skipped.join(", ")}, which v${r.to} no longer supports`);
|
|
4197
|
+
}
|
|
4198
|
+
if (r.ok) {
|
|
4199
|
+
for (const warning of r.warnings)
|
|
4200
|
+
console.warn(` \u26A0 ${warning}`);
|
|
4201
|
+
}
|
|
3668
4202
|
}
|
|
3669
4203
|
}
|
|
3670
4204
|
const other = await otherScopeSkillCount(updateDir);
|
|
@@ -3692,6 +4226,11 @@ Note: ${other.count} ${noun} installed in the ${other.scope} scope. Run \`${comm
|
|
|
3692
4226
|
} else {
|
|
3693
4227
|
console.log(`\u2713 Updated '${skillName}' from v${result.from} to v${result.to}`);
|
|
3694
4228
|
}
|
|
4229
|
+
if (result.skipped.length > 0) {
|
|
4230
|
+
console.log(`\u2298 Removed from ${result.skipped.join(", ")}, which v${result.to} no longer supports`);
|
|
4231
|
+
}
|
|
4232
|
+
for (const warning of result.warnings)
|
|
4233
|
+
console.warn(`\u26A0 ${warning}`);
|
|
3695
4234
|
break;
|
|
3696
4235
|
}
|
|
3697
4236
|
case "list": {
|
|
@@ -3785,7 +4324,7 @@ ${m.name} v${m.version}`);
|
|
|
3785
4324
|
break;
|
|
3786
4325
|
}
|
|
3787
4326
|
if (command !== "update") {
|
|
3788
|
-
const checkDir = flags.global !== undefined || flags.g !== undefined ?
|
|
4327
|
+
const checkDir = flags.global !== undefined || flags.g !== undefined ? homedir3() : process.cwd();
|
|
3789
4328
|
const outdated = await checkForUpdates(checkDir);
|
|
3790
4329
|
if (outdated.length > 0) {
|
|
3791
4330
|
const list = outdated.map((s) => `${s.name} (v${s.installed} \u2192 v${s.latest})`).join(", ");
|