harnessed 4.32.6 → 4.32.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -38,7 +38,7 @@ var init_package = __esm({
38
38
  "package.json"() {
39
39
  package_default = {
40
40
  name: "harnessed",
41
- version: "4.32.6",
41
+ version: "4.32.8",
42
42
  description: "AI coding harness package manager + composition orchestrator",
43
43
  type: "module",
44
44
  license: "Apache-2.0",
@@ -5359,13 +5359,13 @@ async function runCheckpointStart(sub, opts, deps = defaultRunDeps) {
5359
5359
  const { activatePhase: activatePhase2 } = await Promise.resolve().then(() => (init_engineHook(), engineHook_exports));
5360
5360
  try {
5361
5361
  const { stat: statFs } = await import('fs/promises');
5362
- const { resolve: resolvePath } = await import('path');
5363
- const planningDir = resolvePath(process.cwd(), ".planning");
5362
+ const { resolve: resolvePath2 } = await import('path');
5363
+ const planningDir = resolvePath2(process.cwd(), ".planning");
5364
5364
  const hasPlanning = await statFs(planningDir).then((s) => s.isDirectory()).catch(() => false);
5365
5365
  if (hasPlanning) {
5366
5366
  const missing = [];
5367
5367
  for (const f of ["STATE.md", "ROADMAP.md"]) {
5368
- const ok = await statFs(resolvePath(planningDir, f)).then((s) => s.isFile()).catch(() => false);
5368
+ const ok = await statFs(resolvePath2(planningDir, f)).then((s) => s.isFile()).catch(() => false);
5369
5369
  if (!ok) missing.push(`.planning/${f}`);
5370
5370
  }
5371
5371
  if (missing.length > 0) {
@@ -6930,45 +6930,152 @@ var init_check_install_channels = __esm({
6930
6930
  init_assetsRoot();
6931
6931
  }
6932
6932
  });
6933
-
6934
- // src/installers/lib/harnessedHookTeardown.ts
6935
- function harnessedHookIdentity(raw) {
6936
- for (const id of IDS) {
6937
- if (new RegExp(`harnessed-${id}\\.mjs(?:["']|\\s|$)`).test(raw)) return id;
6938
- if (new RegExp(`harnessed(?:\\.exe)?["']?\\s+${id}(?:\\s|$)`).test(raw)) return id;
6933
+ function isRelativeFileToken(token) {
6934
+ if (!/[\\/]/.test(token)) return false;
6935
+ if (ABSOLUTE_RE.test(token)) return false;
6936
+ if (/[*?$`]/.test(token)) return false;
6937
+ return true;
6938
+ }
6939
+ function stripQuotes(token) {
6940
+ const m = token.match(/^"(.*)"$/);
6941
+ if (m?.[1] !== void 0) return { bare: m[1], quoted: true };
6942
+ return { bare: token, quoted: false };
6943
+ }
6944
+ function resolveHookCommand(raw, deps) {
6945
+ const marker = deps.compiledExecPath ? hookScriptMarker(raw) : null;
6946
+ if (deps.compiledExecPath && marker && COMPILED_HOOK_IDENTITIES.includes(marker)) {
6947
+ const exe = deps.compiledExecPath();
6948
+ if (exe) return `"${exe.replace(/\\/g, "/")}" ${marker}`;
6939
6949
  }
6940
- return null;
6950
+ let root = null;
6951
+ const tokens = raw.split(/\s+/).filter((t2) => t2.length > 0);
6952
+ const out = tokens.map((token) => {
6953
+ const { bare: bare2 } = stripQuotes(token);
6954
+ if (!isRelativeFileToken(bare2)) return token;
6955
+ root = root ?? deps.assetsRoot();
6956
+ const abs = join(root, bare2);
6957
+ if (!deps.exists(abs)) return token;
6958
+ return `"${abs.replace(/\\/g, "/")}"`;
6959
+ });
6960
+ return out.join(" ");
6941
6961
  }
6942
- function harnessedHookScriptPath(raw) {
6943
- const mjs = raw.match(/["']?([^"'\s]*harnessed-(?:inject-state|stop-hook)\.mjs)["']?/);
6944
- if (mjs?.[1]) return mjs[1];
6945
- const quotedBin = raw.match(/["']([^"']*harnessed(?:\.exe)?)["']\s+(?:inject-state|stop-hook)\b/);
6946
- if (quotedBin?.[1]) return quotedBin[1];
6947
- const bareBin = raw.match(/(?:^|\s)(harnessed(?:\.exe)?)\s+(?:inject-state|stop-hook)\b/);
6948
- if (bareBin?.[1]) return bareBin[1];
6962
+ function hookScriptMarker(raw) {
6963
+ for (const token of raw.split(/\s+/)) {
6964
+ const { bare: bare2 } = stripQuotes(token);
6965
+ if (isRelativeFileToken(bare2)) {
6966
+ const seg = bare2.split(/[\\/]/);
6967
+ const base = seg[seg.length - 1] ?? null;
6968
+ const id = COMPILED_HOOK_IDENTITIES.find((k) => base?.includes(k));
6969
+ if (id) return id;
6970
+ return base;
6971
+ }
6972
+ }
6973
+ for (const token of raw.split(/\s+/)) {
6974
+ const { bare: bare2 } = stripQuotes(token);
6975
+ if (COMPILED_HOOK_IDENTITIES.includes(bare2)) return bare2;
6976
+ }
6949
6977
  return null;
6950
6978
  }
6951
6979
  function entryCommands(entry) {
6980
+ if (!entry || typeof entry !== "object") return [];
6952
6981
  const cmds = [];
6953
6982
  if (typeof entry.command === "string") cmds.push(entry.command);
6954
6983
  if (Array.isArray(entry.hooks)) {
6955
- for (const h of entry.hooks) if (h && typeof h.command === "string") cmds.push(h.command);
6984
+ for (const h of entry.hooks) {
6985
+ if (h && typeof h.command === "string") cmds.push(h.command);
6986
+ }
6956
6987
  }
6957
6988
  return cmds;
6958
6989
  }
6959
- function entryIsHarnessed(entry) {
6960
- return entryCommands(entry).some((c) => harnessedHookIdentity(c) !== null);
6990
+ function entryMatchesRegistration(entry, raw, resolved, marker) {
6991
+ const cmds = entryCommands(entry);
6992
+ if (cmds.length === 0) return false;
6993
+ if (marker) return cmds.some((c) => c.includes(marker));
6994
+ return cmds.some((c) => c === raw || c === resolved);
6995
+ }
6996
+ function desiredHookEntry(matcher, resolvedCmd) {
6997
+ return {
6998
+ ...matcher !== void 0 ? { matcher } : {},
6999
+ hooks: [{ type: "command", command: resolvedCmd }]
7000
+ };
7001
+ }
7002
+ function isDesiredHookEntry(entry, matcher, resolvedCmd) {
7003
+ if (typeof entry.command === "string") return false;
7004
+ if (entry.matcher !== matcher) return false;
7005
+ if (!Array.isArray(entry.hooks) || entry.hooks.length !== 1) return false;
7006
+ const h = entry.hooks[0];
7007
+ return !!h && h.type === "command" && h.command === resolvedCmd;
7008
+ }
7009
+ function detectCcHookInstalled(settingsRaw, ev, raw, matcher, deps) {
7010
+ if (settingsRaw === null) return false;
7011
+ let parsed;
7012
+ try {
7013
+ parsed = JSON.parse(settingsRaw);
7014
+ } catch {
7015
+ return false;
7016
+ }
7017
+ const arr = parsed.hooks?.[ev];
7018
+ if (!Array.isArray(arr)) return false;
7019
+ const resolved = resolveHookCommand(raw, deps);
7020
+ const marker = hookScriptMarker(raw);
7021
+ const matching = arr.filter((e) => entryMatchesRegistration(e, raw, resolved, marker));
7022
+ return matching.length === 1 && isDesiredHookEntry(matching[0] ?? {}, matcher, resolved);
7023
+ }
7024
+ var COMPILED_HOOK_IDENTITIES, ABSOLUTE_RE;
7025
+ var init_hookEntry = __esm({
7026
+ "src/installers/lib/hookEntry.ts"() {
7027
+ COMPILED_HOOK_IDENTITIES = ["inject-state", "stop-hook"];
7028
+ ABSOLUTE_RE = /^([A-Za-z]:[\\/]|[\\/])/;
7029
+ }
7030
+ });
7031
+
7032
+ // src/installers/lib/harnessedHookTeardown.ts
7033
+ function harnessedHookIdentity(raw) {
7034
+ for (const id of COMPILED_HOOK_IDENTITIES) {
7035
+ if (new RegExp(`${LEFT}harnessed-${id}\\.mjs(?:["']|\\s|$)`).test(raw)) return id;
7036
+ if (new RegExp(`${LEFT}harnessed(?:\\.exe)?["']?\\s+${id}(?:\\s|$)`).test(raw)) return id;
7037
+ }
7038
+ return null;
7039
+ }
7040
+ function harnessedHookScriptPath(raw) {
7041
+ const qMjs = raw.match(new RegExp(`"([^"]*harnessed-(?:${ID_ALT})\\.mjs)"`)) ?? raw.match(new RegExp(`'([^']*harnessed-(?:${ID_ALT})\\.mjs)'`));
7042
+ if (qMjs?.[1]) return qMjs[1];
7043
+ const uMjs = raw.match(new RegExp(`(?:^|\\s)([^\\s"']*harnessed-(?:${ID_ALT})\\.mjs)`));
7044
+ if (uMjs?.[1]) return uMjs[1];
7045
+ const qBin = raw.match(new RegExp(`"([^"]*harnessed(?:\\.exe)?)"\\s+(?:${ID_ALT})\\b`)) ?? raw.match(new RegExp(`'([^']*harnessed(?:\\.exe)?)'\\s+(?:${ID_ALT})\\b`));
7046
+ if (qBin?.[1]) return qBin[1];
7047
+ const bBin = raw.match(new RegExp(`(?:^|\\s)(harnessed(?:\\.exe)?)\\s+(?:${ID_ALT})\\b`));
7048
+ if (bBin?.[1]) return bBin[1];
7049
+ return null;
7050
+ }
7051
+ function isHarnessedCmd(cmd) {
7052
+ return harnessedHookIdentity(cmd) !== null;
6961
7053
  }
6962
7054
  function stripHarnessedHooks(hooks) {
6963
7055
  let removed = 0;
6964
7056
  for (const ev of Object.keys(hooks)) {
6965
7057
  const arr = hooks[ev];
6966
7058
  if (!Array.isArray(arr)) continue;
6967
- const kept = arr.filter((entry) => {
6968
- const owned = entryIsHarnessed(entry);
6969
- if (owned) removed++;
6970
- return !owned;
6971
- });
7059
+ const kept = [];
7060
+ for (const entry of arr) {
7061
+ if (!entry || typeof entry !== "object") {
7062
+ kept.push(entry);
7063
+ continue;
7064
+ }
7065
+ if (typeof entry.command === "string" && isHarnessedCmd(entry.command)) {
7066
+ removed++;
7067
+ continue;
7068
+ }
7069
+ if (Array.isArray(entry.hooks)) {
7070
+ const before = entry.hooks.length;
7071
+ entry.hooks = entry.hooks.filter(
7072
+ (h) => !(h && typeof h.command === "string" && isHarnessedCmd(h.command))
7073
+ );
7074
+ removed += before - entry.hooks.length;
7075
+ if (entry.hooks.length === 0 && typeof entry.command !== "string") continue;
7076
+ }
7077
+ kept.push(entry);
7078
+ }
6972
7079
  if (kept.length === 0) delete hooks[ev];
6973
7080
  else hooks[ev] = kept;
6974
7081
  }
@@ -6978,7 +7085,7 @@ function countHarnessedHooks(hooks) {
6978
7085
  let n = 0;
6979
7086
  for (const arr of Object.values(hooks)) {
6980
7087
  if (!Array.isArray(arr)) continue;
6981
- for (const entry of arr) if (entryIsHarnessed(entry)) n++;
7088
+ for (const entry of arr) n += entryCommands(entry).filter(isHarnessedCmd).length;
6982
7089
  }
6983
7090
  return n;
6984
7091
  }
@@ -6990,17 +7097,24 @@ function harnessedStaleHookPaths(hooks, exists) {
6990
7097
  for (const cmd of entryCommands(entry)) {
6991
7098
  if (harnessedHookIdentity(cmd) === null) continue;
6992
7099
  const path = harnessedHookScriptPath(cmd);
6993
- if (path && ABSOLUTE_RE.test(path) && !exists(path)) out.push({ event, path });
7100
+ if (!path) continue;
7101
+ if (ABSOLUTE_RE2.test(path)) {
7102
+ if (!exists(path)) out.push({ event, path });
7103
+ } else if (/\.mjs$/.test(path)) {
7104
+ out.push({ event, path });
7105
+ }
6994
7106
  }
6995
7107
  }
6996
7108
  }
6997
7109
  return out;
6998
7110
  }
6999
- var IDS, ABSOLUTE_RE;
7111
+ var ID_ALT, LEFT, ABSOLUTE_RE2;
7000
7112
  var init_harnessedHookTeardown = __esm({
7001
7113
  "src/installers/lib/harnessedHookTeardown.ts"() {
7002
- IDS = ["inject-state", "stop-hook"];
7003
- ABSOLUTE_RE = /^([A-Za-z]:[\\/]|[\\/])/;
7114
+ init_hookEntry();
7115
+ ID_ALT = COMPILED_HOOK_IDENTITIES.join("|");
7116
+ LEFT = `(?:^|[\\s"'=/\\\\])`;
7117
+ ABSOLUTE_RE2 = /^([A-Za-z]:[\\/]|[\\/])/;
7004
7118
  }
7005
7119
  });
7006
7120
 
@@ -7031,7 +7145,12 @@ function checkStaleHooks(deps) {
7031
7145
  if (!hooks || typeof hooks !== "object") {
7032
7146
  return { name: NAME, status: "pass", message: "no hooks registered" };
7033
7147
  }
7034
- const stale = harnessedStaleHookPaths(hooks, exists);
7148
+ let stale;
7149
+ try {
7150
+ stale = harnessedStaleHookPaths(hooks, exists);
7151
+ } catch {
7152
+ return { name: NAME, status: "pass", message: "hooks unreadable \u2014 skipped" };
7153
+ }
7035
7154
  if (stale.length === 0) {
7036
7155
  return { name: NAME, status: "pass", message: "no orphaned harnessed hooks" };
7037
7156
  }
@@ -7039,7 +7158,7 @@ function checkStaleHooks(deps) {
7039
7158
  return {
7040
7159
  name: NAME,
7041
7160
  status: "warn",
7042
- message: `${stale.length} harnessed hook(s) point at a deleted script \u2014 Claude Code errors MODULE_NOT_FOUND every prompt (${list})`,
7161
+ message: `${stale.length} harnessed hook(s) point at a missing/unresolvable script \u2014 Claude Code errors MODULE_NOT_FOUND every prompt (${list})`,
7043
7162
  fix: `run 'harnessed uninstall' to strip them, or delete the matching Stop/UserPromptSubmit entries from ${settingsPath}`
7044
7163
  };
7045
7164
  }
@@ -7561,103 +7680,6 @@ var init_err = __esm({
7561
7680
  "src/installers/lib/err.ts"() {
7562
7681
  }
7563
7682
  });
7564
- function isRelativeFileToken(token) {
7565
- if (!/[\\/]/.test(token)) return false;
7566
- if (ABSOLUTE_RE2.test(token)) return false;
7567
- if (/[*?$`]/.test(token)) return false;
7568
- return true;
7569
- }
7570
- function stripQuotes(token) {
7571
- const m = token.match(/^"(.*)"$/);
7572
- if (m?.[1] !== void 0) return { bare: m[1], quoted: true };
7573
- return { bare: token, quoted: false };
7574
- }
7575
- function resolveHookCommand(raw, deps) {
7576
- const marker = deps.compiledExecPath ? hookScriptMarker(raw) : null;
7577
- if (deps.compiledExecPath && marker && COMPILED_HOOK_IDENTITIES.includes(marker)) {
7578
- const exe = deps.compiledExecPath();
7579
- if (exe) return `"${exe.replace(/\\/g, "/")}" ${marker}`;
7580
- }
7581
- let root = null;
7582
- const tokens = raw.split(/\s+/).filter((t2) => t2.length > 0);
7583
- const out = tokens.map((token) => {
7584
- const { bare: bare2 } = stripQuotes(token);
7585
- if (!isRelativeFileToken(bare2)) return token;
7586
- root = root ?? deps.assetsRoot();
7587
- const abs = join(root, bare2);
7588
- if (!deps.exists(abs)) return token;
7589
- return `"${abs.replace(/\\/g, "/")}"`;
7590
- });
7591
- return out.join(" ");
7592
- }
7593
- function hookScriptMarker(raw) {
7594
- for (const token of raw.split(/\s+/)) {
7595
- const { bare: bare2 } = stripQuotes(token);
7596
- if (isRelativeFileToken(bare2)) {
7597
- const seg = bare2.split(/[\\/]/);
7598
- const base = seg[seg.length - 1] ?? null;
7599
- const id = COMPILED_HOOK_IDENTITIES.find((k) => base?.includes(k));
7600
- if (id) return id;
7601
- return base;
7602
- }
7603
- }
7604
- for (const token of raw.split(/\s+/)) {
7605
- const { bare: bare2 } = stripQuotes(token);
7606
- if (COMPILED_HOOK_IDENTITIES.includes(bare2)) return bare2;
7607
- }
7608
- return null;
7609
- }
7610
- function entryCommands2(entry) {
7611
- const cmds = [];
7612
- if (typeof entry.command === "string") cmds.push(entry.command);
7613
- if (Array.isArray(entry.hooks)) {
7614
- for (const h of entry.hooks) {
7615
- if (h && typeof h.command === "string") cmds.push(h.command);
7616
- }
7617
- }
7618
- return cmds;
7619
- }
7620
- function entryMatchesRegistration(entry, raw, resolved, marker) {
7621
- const cmds = entryCommands2(entry);
7622
- if (cmds.length === 0) return false;
7623
- if (marker) return cmds.some((c) => c.includes(marker));
7624
- return cmds.some((c) => c === raw || c === resolved);
7625
- }
7626
- function desiredHookEntry(matcher, resolvedCmd) {
7627
- return {
7628
- ...matcher !== void 0 ? { matcher } : {},
7629
- hooks: [{ type: "command", command: resolvedCmd }]
7630
- };
7631
- }
7632
- function isDesiredHookEntry(entry, matcher, resolvedCmd) {
7633
- if (typeof entry.command === "string") return false;
7634
- if (entry.matcher !== matcher) return false;
7635
- if (!Array.isArray(entry.hooks) || entry.hooks.length !== 1) return false;
7636
- const h = entry.hooks[0];
7637
- return !!h && h.type === "command" && h.command === resolvedCmd;
7638
- }
7639
- function detectCcHookInstalled(settingsRaw, ev, raw, matcher, deps) {
7640
- if (settingsRaw === null) return false;
7641
- let parsed;
7642
- try {
7643
- parsed = JSON.parse(settingsRaw);
7644
- } catch {
7645
- return false;
7646
- }
7647
- const arr = parsed.hooks?.[ev];
7648
- if (!Array.isArray(arr)) return false;
7649
- const resolved = resolveHookCommand(raw, deps);
7650
- const marker = hookScriptMarker(raw);
7651
- const matching = arr.filter((e) => entryMatchesRegistration(e, raw, resolved, marker));
7652
- return matching.length === 1 && isDesiredHookEntry(matching[0] ?? {}, matcher, resolved);
7653
- }
7654
- var COMPILED_HOOK_IDENTITIES, ABSOLUTE_RE2;
7655
- var init_hookEntry = __esm({
7656
- "src/installers/lib/hookEntry.ts"() {
7657
- COMPILED_HOOK_IDENTITIES = ["inject-state", "stop-hook"];
7658
- ABSOLUTE_RE2 = /^([A-Za-z]:[\\/]|[\\/])/;
7659
- }
7660
- });
7661
7683
 
7662
7684
  // src/installers/lib/preflight.ts
7663
7685
  function preflight(ctx) {
@@ -10961,9 +10983,9 @@ function redactRecord(r) {
10961
10983
  }
10962
10984
  function renderHumanTable(records) {
10963
10985
  const header = `${"ts".padEnd(19)} | ${"phase".padEnd(6)} | ${"category".padEnd(11)} | ${"matched_rule_id".padEnd(20)} | outcome`;
10964
- const sep2 = `${"-".repeat(19)}-+-${"-".repeat(6)}-+-${"-".repeat(11)}-+-${"-".repeat(20)}-+--------`;
10986
+ const sep3 = `${"-".repeat(19)}-+-${"-".repeat(6)}-+-${"-".repeat(11)}-+-${"-".repeat(20)}-+--------`;
10965
10987
  console.log(header);
10966
- console.log(sep2);
10988
+ console.log(sep3);
10967
10989
  for (const r of records) {
10968
10990
  const ts = r.ts.slice(0, 19);
10969
10991
  const phase = r.phase.padEnd(6);
@@ -13667,6 +13689,77 @@ var uninstallGitCloneWithSetup = async (ctx) => {
13667
13689
  return { ok: true, removedPaths: [cloneTarget] };
13668
13690
  };
13669
13691
 
13692
+ // src/uninstallers/lib/declaredTeardown.ts
13693
+ init_spawn();
13694
+ init_path_guard();
13695
+ function hasDeclaredUninstall(ctx) {
13696
+ return ctx.manifest.spec.uninstall != null;
13697
+ }
13698
+ function expandTilde(p7) {
13699
+ if (p7 === "~") return homedir();
13700
+ if (p7.startsWith("~/") || p7.startsWith("~\\")) return homedir() + p7.slice(1);
13701
+ return p7;
13702
+ }
13703
+ function confineCleanupPath(raw) {
13704
+ checkPathSafe(raw);
13705
+ const expanded = expandTilde(raw);
13706
+ const abs = isAbsolute(expanded) ? resolve(expanded) : resolve(homedir(), expanded);
13707
+ const home = resolve(homedir());
13708
+ if (abs === home) return null;
13709
+ if (!abs.startsWith(home + sep)) return null;
13710
+ return abs;
13711
+ }
13712
+ async function runDeclaredTeardown(ctx) {
13713
+ const u = ctx.manifest.spec.uninstall;
13714
+ if (!u) return { ok: false, phase: "preflight", error: "no declared uninstall contract" };
13715
+ const abort = dryRunGate(ctx);
13716
+ if (abort) return abort;
13717
+ const confined = [];
13718
+ for (const raw of u.cleanup_paths ?? []) {
13719
+ let abs;
13720
+ try {
13721
+ abs = confineCleanupPath(raw);
13722
+ } catch {
13723
+ return {
13724
+ ok: false,
13725
+ phase: "preflight",
13726
+ error: `refusing to remove cleanup_path (path traversal): ${raw}`
13727
+ };
13728
+ }
13729
+ if (abs === null) {
13730
+ return {
13731
+ ok: false,
13732
+ phase: "preflight",
13733
+ error: `refusing to remove cleanup_path outside $HOME: ${raw}`
13734
+ };
13735
+ }
13736
+ confined.push(abs);
13737
+ }
13738
+ const spawnCtx = {
13739
+ manifest: ctx.manifest,
13740
+ cwd: ctx.cwd};
13741
+ const spawnRes = await spawnCmd(spawnCtx, u.cmd, [], DEFAULT_INSTALL_TIMEOUT_MS, {
13742
+ posixShell: true
13743
+ });
13744
+ const name = ctx.manifest.metadata.name;
13745
+ if (!("exitCode" in spawnRes)) {
13746
+ const msg = "error" in spawnRes ? spawnRes.error.message : "unknown spawn failure";
13747
+ console.warn(
13748
+ `declared uninstall cmd for '${name}' could not run (${msg}); continuing to cleanup_paths (best-effort teardown).`
13749
+ );
13750
+ } else if (spawnRes.exitCode !== 0) {
13751
+ console.warn(
13752
+ `declared uninstall cmd for '${name}' exited ${spawnRes.exitCode} (best-effort teardown; continuing to cleanup_paths): ` + (spawnRes.stderr || spawnRes.stdout || "(no output)").slice(0, 200)
13753
+ );
13754
+ }
13755
+ const removedPaths = [];
13756
+ for (const abs of confined) {
13757
+ await rm(abs, { recursive: true, force: true, maxRetries: 3 });
13758
+ removedPaths.push(abs);
13759
+ }
13760
+ return { ok: true, removedPaths };
13761
+ }
13762
+
13670
13763
  // src/uninstallers/mcpHttpAdd.ts
13671
13764
  init_platform();
13672
13765
  init_runClaudeArgs();
@@ -13785,9 +13878,19 @@ var uninstallers = {
13785
13878
  "npx-skill-installer": uninstallNpxSkillInstaller,
13786
13879
  "cc-hook-add": uninstallCcHookAdd
13787
13880
  };
13881
+ var DECLARED_TEARDOWN_METHODS = /* @__PURE__ */ new Set([
13882
+ "npm-cli",
13883
+ "git-clone-with-setup",
13884
+ "npx-skill-installer"
13885
+ ]);
13788
13886
  async function runUninstall(manifest, opts) {
13789
- const uninstaller = uninstallers[manifest.spec.install.method];
13790
- return uninstaller({ manifest, opts, cwd: process.cwd() });
13887
+ const ctx = { manifest, opts, cwd: process.cwd() };
13888
+ const method = manifest.spec.install.method;
13889
+ if (DECLARED_TEARDOWN_METHODS.has(method) && hasDeclaredUninstall(ctx)) {
13890
+ return runDeclaredTeardown(ctx);
13891
+ }
13892
+ const uninstaller = uninstallers[method];
13893
+ return uninstaller(ctx);
13791
13894
  }
13792
13895
 
13793
13896
  // src/cli/uninstall.ts