harnessed 4.19.0 → 4.21.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/dist/cli.mjs +190 -26
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
- package/workflows/auto/SKILL.md +2 -1
- package/workflows/auto/SKILL.zh-Hans.md +2 -1
- package/workflows/discuss/auto/SKILL.md +5 -1
- package/workflows/discuss/auto/SKILL.zh-Hans.md +5 -1
- package/workflows/role-prompts.yaml +5 -3
- package/workflows/role-prompts.zh-Hans.yaml +5 -3
- package/workflows/task/code/SKILL.md +1 -1
- package/workflows/task/code/SKILL.zh-Hans.md +1 -1
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.
|
|
41
|
+
version: "4.21.0",
|
|
42
42
|
description: "AI coding harness package manager + composition orchestrator",
|
|
43
43
|
type: "module",
|
|
44
44
|
license: "Apache-2.0",
|
|
@@ -106,7 +106,8 @@ var init_package = __esm({
|
|
|
106
106
|
bench: "vitest bench --run",
|
|
107
107
|
lint: "biome check .",
|
|
108
108
|
"lint:fix": "biome check --write .",
|
|
109
|
-
format: "biome format --write ."
|
|
109
|
+
format: "biome format --write .",
|
|
110
|
+
"build:binary": "bun scripts/build-binary.mjs"
|
|
110
111
|
},
|
|
111
112
|
dependencies: {
|
|
112
113
|
"@anthropic-ai/claude-agent-sdk": "0.3.142",
|
|
@@ -1857,9 +1858,19 @@ function safeIntlLocale() {
|
|
|
1857
1858
|
return void 0;
|
|
1858
1859
|
}
|
|
1859
1860
|
}
|
|
1861
|
+
function wireMessagesDir(provider) {
|
|
1862
|
+
wiredMessagesDirProvider = provider;
|
|
1863
|
+
}
|
|
1860
1864
|
function messagesDir() {
|
|
1861
1865
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
1862
|
-
const candidates = [
|
|
1866
|
+
const candidates = [];
|
|
1867
|
+
if (wiredMessagesDirProvider) {
|
|
1868
|
+
try {
|
|
1869
|
+
candidates.push(wiredMessagesDirProvider());
|
|
1870
|
+
} catch {
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
candidates.push(resolve(here, "..", "..", "messages"), resolve(here, "..", "messages"));
|
|
1863
1874
|
for (const c of candidates) {
|
|
1864
1875
|
try {
|
|
1865
1876
|
readFileSync(join(c, "en.json"), "utf8");
|
|
@@ -1903,13 +1914,14 @@ function t(key, params) {
|
|
|
1903
1914
|
return v === void 0 ? `{{${name}}}` : String(v);
|
|
1904
1915
|
});
|
|
1905
1916
|
}
|
|
1906
|
-
var SUPPORTED, currentLocale, cache;
|
|
1917
|
+
var SUPPORTED, currentLocale, cache, wiredMessagesDirProvider;
|
|
1907
1918
|
var init_i18n = __esm({
|
|
1908
1919
|
"src/i18n/index.ts"() {
|
|
1909
1920
|
init_en();
|
|
1910
1921
|
SUPPORTED = /* @__PURE__ */ new Set(["en", "zh-Hans"]);
|
|
1911
1922
|
currentLocale = null;
|
|
1912
1923
|
cache = {};
|
|
1924
|
+
wiredMessagesDirProvider = null;
|
|
1913
1925
|
}
|
|
1914
1926
|
});
|
|
1915
1927
|
function getBackupRoot() {
|
|
@@ -2483,13 +2495,17 @@ function buildInteractiveBody(name, prompt) {
|
|
|
2483
2495
|
``,
|
|
2484
2496
|
`Clarification requires real user dialogue. Spawned subagents cannot ask the user questions, so run this stage directly in this session \u2014 do NOT spawn it.`,
|
|
2485
2497
|
``,
|
|
2498
|
+
// v4.21.0 (KidsTetris dogfood) — bootstrap step + GSD-standard phase-dir
|
|
2499
|
+
// convention: the loose \`.planning/\` wording let agents invent their own
|
|
2500
|
+
// layout (phase-0-discuss/ etc.) on fresh projects with no ROADMAP.
|
|
2501
|
+
`0. New-project bootstrap \u2014 if \`.planning/ROADMAP.md\` does not exist: invoke \`/gsd-new-project\` when available; otherwise create a minimal \`ROADMAP.md\` (one table row per phase), \`STATE.md\` (digest, <100 lines), and \`REQUIREMENTS.md\` (numbered acceptance criteria) before continuing.`,
|
|
2486
2502
|
`1. Evaluate the clarification criteria for "$ARGUMENTS":`,
|
|
2487
2503
|
` - Strategic layer: new feature / new milestone / unclear business scope \u2192 run gstack \`/office-hours\` + \`/plan-ceo-review\``,
|
|
2488
2504
|
` - Phase layer: \u22652 open implementation decisions / unclear cross-phase API contract \u2192 run GSD \`/gsd-discuss-phase\``,
|
|
2489
2505
|
` - Subtask layer: \u22652 distinct approaches / core algorithm / API contract design / high error cost \u2192 run superpowers brainstorming`,
|
|
2490
2506
|
`2. For each layer that fires, hold the dialogue with the user (use AskUserQuestion for option-style decisions). Lock every open decision.`,
|
|
2491
2507
|
`3. Skip layers that don't fire \u2014 state which were skipped and why (transparent skip).`,
|
|
2492
|
-
`4. Persist locked decisions to \`.planning
|
|
2508
|
+
`4. Persist locked decisions to \`.planning/phases/<NN>-<slug>/\` via planning-with-files (\`findings.md\` / \`task_plan.md\`; NN = two-digit, one above the highest existing phase dir; slug = kebab-case short name).`,
|
|
2493
2509
|
``,
|
|
2494
2510
|
`Output: a locked spec the execution stages can consume without further user input. Then run \`/plan\` \u2192 \`/task\` \u2192 \`/verify\` with that spec.`,
|
|
2495
2511
|
``,
|
|
@@ -3852,6 +3868,7 @@ var init_packagePath = __esm({
|
|
|
3852
3868
|
// src/cli/lib/assetsRoot.ts
|
|
3853
3869
|
var assetsRoot_exports = {};
|
|
3854
3870
|
__export(assetsRoot_exports, {
|
|
3871
|
+
compiledAssetsDir: () => compiledAssetsDir,
|
|
3855
3872
|
computeAssetsRoot: () => computeAssetsRoot,
|
|
3856
3873
|
getAssetsRoot: () => getAssetsRoot,
|
|
3857
3874
|
isCompiledModuleUrl: () => isCompiledModuleUrl
|
|
@@ -3877,6 +3894,9 @@ function computeAssetsRoot(d) {
|
|
|
3877
3894
|
}
|
|
3878
3895
|
return { root: d.packageRoot, source: "package", compiledAssetsMissing: false };
|
|
3879
3896
|
}
|
|
3897
|
+
function compiledAssetsDir(version) {
|
|
3898
|
+
return join(detectPlatform().stateRoot, "assets", version);
|
|
3899
|
+
}
|
|
3880
3900
|
function realDeps() {
|
|
3881
3901
|
return {
|
|
3882
3902
|
env: process.env,
|
|
@@ -5654,6 +5674,90 @@ var init_err = __esm({
|
|
|
5654
5674
|
"src/installers/lib/err.ts"() {
|
|
5655
5675
|
}
|
|
5656
5676
|
});
|
|
5677
|
+
function isRelativeFileToken(token) {
|
|
5678
|
+
if (!/[\\/]/.test(token)) return false;
|
|
5679
|
+
if (ABSOLUTE_RE.test(token)) return false;
|
|
5680
|
+
if (/[*?$`]/.test(token)) return false;
|
|
5681
|
+
return true;
|
|
5682
|
+
}
|
|
5683
|
+
function stripQuotes(token) {
|
|
5684
|
+
const m = token.match(/^"(.*)"$/);
|
|
5685
|
+
if (m?.[1] !== void 0) return { bare: m[1], quoted: true };
|
|
5686
|
+
return { bare: token, quoted: false };
|
|
5687
|
+
}
|
|
5688
|
+
function resolveHookCommand(raw, deps) {
|
|
5689
|
+
let root = null;
|
|
5690
|
+
const tokens = raw.split(/\s+/).filter((t2) => t2.length > 0);
|
|
5691
|
+
const out = tokens.map((token) => {
|
|
5692
|
+
const { bare: bare2 } = stripQuotes(token);
|
|
5693
|
+
if (!isRelativeFileToken(bare2)) return token;
|
|
5694
|
+
root = root ?? deps.assetsRoot();
|
|
5695
|
+
const abs = join(root, bare2);
|
|
5696
|
+
if (!deps.exists(abs)) return token;
|
|
5697
|
+
return `"${abs.replace(/\\/g, "/")}"`;
|
|
5698
|
+
});
|
|
5699
|
+
return out.join(" ");
|
|
5700
|
+
}
|
|
5701
|
+
function hookScriptMarker(raw) {
|
|
5702
|
+
for (const token of raw.split(/\s+/)) {
|
|
5703
|
+
const { bare: bare2 } = stripQuotes(token);
|
|
5704
|
+
if (isRelativeFileToken(bare2)) {
|
|
5705
|
+
const seg = bare2.split(/[\\/]/);
|
|
5706
|
+
return seg[seg.length - 1] ?? null;
|
|
5707
|
+
}
|
|
5708
|
+
}
|
|
5709
|
+
return null;
|
|
5710
|
+
}
|
|
5711
|
+
function entryCommands(entry) {
|
|
5712
|
+
const cmds = [];
|
|
5713
|
+
if (typeof entry.command === "string") cmds.push(entry.command);
|
|
5714
|
+
if (Array.isArray(entry.hooks)) {
|
|
5715
|
+
for (const h of entry.hooks) {
|
|
5716
|
+
if (h && typeof h.command === "string") cmds.push(h.command);
|
|
5717
|
+
}
|
|
5718
|
+
}
|
|
5719
|
+
return cmds;
|
|
5720
|
+
}
|
|
5721
|
+
function entryMatchesRegistration(entry, raw, resolved, marker) {
|
|
5722
|
+
const cmds = entryCommands(entry);
|
|
5723
|
+
if (cmds.length === 0) return false;
|
|
5724
|
+
if (marker) return cmds.some((c) => c.includes(marker));
|
|
5725
|
+
return cmds.some((c) => c === raw || c === resolved);
|
|
5726
|
+
}
|
|
5727
|
+
function desiredHookEntry(matcher, resolvedCmd) {
|
|
5728
|
+
return {
|
|
5729
|
+
...matcher !== void 0 ? { matcher } : {},
|
|
5730
|
+
hooks: [{ type: "command", command: resolvedCmd }]
|
|
5731
|
+
};
|
|
5732
|
+
}
|
|
5733
|
+
function isDesiredHookEntry(entry, matcher, resolvedCmd) {
|
|
5734
|
+
if (typeof entry.command === "string") return false;
|
|
5735
|
+
if (entry.matcher !== matcher) return false;
|
|
5736
|
+
if (!Array.isArray(entry.hooks) || entry.hooks.length !== 1) return false;
|
|
5737
|
+
const h = entry.hooks[0];
|
|
5738
|
+
return !!h && h.type === "command" && h.command === resolvedCmd;
|
|
5739
|
+
}
|
|
5740
|
+
function detectCcHookInstalled(settingsRaw, ev, raw, matcher, deps) {
|
|
5741
|
+
if (settingsRaw === null) return false;
|
|
5742
|
+
let parsed;
|
|
5743
|
+
try {
|
|
5744
|
+
parsed = JSON.parse(settingsRaw);
|
|
5745
|
+
} catch {
|
|
5746
|
+
return false;
|
|
5747
|
+
}
|
|
5748
|
+
const arr = parsed.hooks?.[ev];
|
|
5749
|
+
if (!Array.isArray(arr)) return false;
|
|
5750
|
+
const resolved = resolveHookCommand(raw, deps);
|
|
5751
|
+
const marker = hookScriptMarker(raw);
|
|
5752
|
+
const matching = arr.filter((e) => entryMatchesRegistration(e, raw, resolved, marker));
|
|
5753
|
+
return matching.length === 1 && isDesiredHookEntry(matching[0] ?? {}, matcher, resolved);
|
|
5754
|
+
}
|
|
5755
|
+
var ABSOLUTE_RE;
|
|
5756
|
+
var init_hookEntry = __esm({
|
|
5757
|
+
"src/installers/lib/hookEntry.ts"() {
|
|
5758
|
+
ABSOLUTE_RE = /^([A-Za-z]:[\\/]|[\\/])/;
|
|
5759
|
+
}
|
|
5760
|
+
});
|
|
5657
5761
|
|
|
5658
5762
|
// src/installers/lib/preflight.ts
|
|
5659
5763
|
function preflight(ctx) {
|
|
@@ -5757,10 +5861,12 @@ var init_state2 = __esm({
|
|
|
5757
5861
|
var installCcHookAdd;
|
|
5758
5862
|
var init_ccHookAdd2 = __esm({
|
|
5759
5863
|
"src/installers/ccHookAdd.ts"() {
|
|
5864
|
+
init_assetsRoot();
|
|
5760
5865
|
init_backup();
|
|
5761
5866
|
init_confirm();
|
|
5762
5867
|
init_diff();
|
|
5763
5868
|
init_err();
|
|
5869
|
+
init_hookEntry();
|
|
5764
5870
|
init_platform();
|
|
5765
5871
|
init_preflight();
|
|
5766
5872
|
init_state2();
|
|
@@ -5811,11 +5917,16 @@ var init_ccHookAdd2 = __esm({
|
|
|
5811
5917
|
const ev = install.hook_event;
|
|
5812
5918
|
const matcher = install.hook_matcher;
|
|
5813
5919
|
const cmd = install.hook_command;
|
|
5814
|
-
|
|
5815
|
-
|
|
5920
|
+
const cmdDeps = { assetsRoot: getAssetsRoot, exists: existsSync };
|
|
5921
|
+
const resolvedCmd = resolveHookCommand(cmd, cmdDeps);
|
|
5922
|
+
const marker = hookScriptMarker(cmd);
|
|
5923
|
+
const arr = settings.hooks[ev] ?? [];
|
|
5924
|
+
const ours = arr.filter((e) => entryMatchesRegistration(e, cmd, resolvedCmd, marker));
|
|
5925
|
+
if (ours.length === 1 && isDesiredHookEntry(ours[0] ?? {}, matcher, resolvedCmd)) {
|
|
5816
5926
|
return { ok: true, backupId: "idempotent-skip", appliedFiles: [] };
|
|
5817
5927
|
}
|
|
5818
|
-
|
|
5928
|
+
const others = arr.filter((e) => !entryMatchesRegistration(e, cmd, resolvedCmd, marker));
|
|
5929
|
+
settings.hooks[ev] = [...others, desiredHookEntry(matcher, resolvedCmd)];
|
|
5819
5930
|
const newText = `${JSON.stringify(settings, null, 2)}
|
|
5820
5931
|
`;
|
|
5821
5932
|
const plan = {
|
|
@@ -5847,7 +5958,7 @@ var init_ccHookAdd2 = __esm({
|
|
|
5847
5958
|
)
|
|
5848
5959
|
};
|
|
5849
5960
|
}
|
|
5850
|
-
if (!verify.hooks?.[ev]?.some((
|
|
5961
|
+
if (!verify.hooks?.[ev]?.some((e) => isDesiredHookEntry(e, matcher, resolvedCmd))) {
|
|
5851
5962
|
return {
|
|
5852
5963
|
ok: false,
|
|
5853
5964
|
phase: "verify",
|
|
@@ -5855,7 +5966,7 @@ var init_ccHookAdd2 = __esm({
|
|
|
5855
5966
|
error: err(
|
|
5856
5967
|
ctx,
|
|
5857
5968
|
"/spec/install/hook_command",
|
|
5858
|
-
`hook '${
|
|
5969
|
+
`hook '${resolvedCmd.slice(0, 80)}' missing in hooks.${ev}[] after write`,
|
|
5859
5970
|
"verify-failed"
|
|
5860
5971
|
)
|
|
5861
5972
|
};
|
|
@@ -5966,6 +6077,29 @@ var init_nativeTest = __esm({
|
|
|
5966
6077
|
UNSAFE_PATH_RE = /[|&;<>()*?"'`$={}[\]]/;
|
|
5967
6078
|
}
|
|
5968
6079
|
});
|
|
6080
|
+
function getMcpSpawnCwd() {
|
|
6081
|
+
return homedir();
|
|
6082
|
+
}
|
|
6083
|
+
function getNeutralSpawnCwd() {
|
|
6084
|
+
const override = process.env.HARNESSED_SPAWN_CWD;
|
|
6085
|
+
if (override !== void 0 && override.trim().length > 0) return override.trim();
|
|
6086
|
+
try {
|
|
6087
|
+
const dir = join(detectPlatform().stateRoot, ".spawn");
|
|
6088
|
+
mkdirSync(dir, { recursive: true });
|
|
6089
|
+
const sentinel = join(dir, "package.json");
|
|
6090
|
+
if (!existsSync(sentinel)) writeFileSync(sentinel, NEUTRAL_SENTINEL, "utf8");
|
|
6091
|
+
return dir;
|
|
6092
|
+
} catch {
|
|
6093
|
+
return null;
|
|
6094
|
+
}
|
|
6095
|
+
}
|
|
6096
|
+
var NEUTRAL_SENTINEL;
|
|
6097
|
+
var init_safeCwd = __esm({
|
|
6098
|
+
"src/installers/lib/safeCwd.ts"() {
|
|
6099
|
+
init_platform();
|
|
6100
|
+
NEUTRAL_SENTINEL = '{\n "name": "harnessed-neutral-spawn",\n "private": true\n}\n';
|
|
6101
|
+
}
|
|
6102
|
+
});
|
|
5969
6103
|
function expandTildeForWindows(cmd) {
|
|
5970
6104
|
const home = homedir().replace(/\\/g, "/");
|
|
5971
6105
|
return cmd.replace(/(^|[\s"'`(])~\//g, `$1${home}/`);
|
|
@@ -5999,7 +6133,7 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5999
6133
|
const installCfg = ctx.manifest.spec.install;
|
|
6000
6134
|
const effectiveTimeoutMs = timeoutMs ?? DEFAULT_INSTALL_TIMEOUT_MS;
|
|
6001
6135
|
const env = { ...process.env, ...installCfg.env ?? {} };
|
|
6002
|
-
const cwd = installCfg.cwd ?? ctx.cwd;
|
|
6136
|
+
const cwd = installCfg.cwd ?? (opts?.neutralCwd ? getNeutralSpawnCwd() ?? ctx.cwd : ctx.cwd);
|
|
6003
6137
|
let child;
|
|
6004
6138
|
let triedBash = false;
|
|
6005
6139
|
const stdio = ["ignore", "pipe", "pipe"];
|
|
@@ -6092,6 +6226,7 @@ var init_spawn = __esm({
|
|
|
6092
6226
|
init_security();
|
|
6093
6227
|
init_nativeTest();
|
|
6094
6228
|
init_resolveBash();
|
|
6229
|
+
init_safeCwd();
|
|
6095
6230
|
init_verifyMessage();
|
|
6096
6231
|
POSIX_SYNTAX_RE = /[|;<>`$~[\]{}()*?!]|&&/;
|
|
6097
6232
|
POSIX_FIRST_TOKENS = /* @__PURE__ */ new Set([
|
|
@@ -6236,6 +6371,25 @@ async function isAlreadyInstalled(ctx, opts = {}) {
|
|
|
6236
6371
|
const honorUpdateFlag = opts.honorUpdateFlag !== false;
|
|
6237
6372
|
if (honorUpdateFlag && ctx.opts.updateInstalled === true) return false;
|
|
6238
6373
|
if (ctx.opts.dryRun) return false;
|
|
6374
|
+
const installCfg = ctx.manifest.spec.install;
|
|
6375
|
+
if (installCfg.method === "cc-hook-add") {
|
|
6376
|
+
let raw;
|
|
6377
|
+
try {
|
|
6378
|
+
raw = await readFile(getSettingsPath(), "utf8");
|
|
6379
|
+
} catch {
|
|
6380
|
+
raw = null;
|
|
6381
|
+
}
|
|
6382
|
+
return detectCcHookInstalled(
|
|
6383
|
+
raw,
|
|
6384
|
+
installCfg.hook_event,
|
|
6385
|
+
installCfg.hook_command,
|
|
6386
|
+
installCfg.hook_matcher,
|
|
6387
|
+
{
|
|
6388
|
+
assetsRoot: getAssetsRoot,
|
|
6389
|
+
exists: existsSync
|
|
6390
|
+
}
|
|
6391
|
+
);
|
|
6392
|
+
}
|
|
6239
6393
|
const native = await detectNative(ctx);
|
|
6240
6394
|
if (native) return true;
|
|
6241
6395
|
const idempotentCmd = ctx.manifest.spec.install.idempotent_check;
|
|
@@ -6249,7 +6403,9 @@ async function isAlreadyInstalled(ctx, opts = {}) {
|
|
|
6249
6403
|
var IDEMPOTENT_CHECK_TIMEOUT_MS, INSTALLED_INDICATORS;
|
|
6250
6404
|
var init_idempotent = __esm({
|
|
6251
6405
|
"src/installers/lib/idempotent.ts"() {
|
|
6406
|
+
init_assetsRoot();
|
|
6252
6407
|
init_binaryProbe();
|
|
6408
|
+
init_hookEntry();
|
|
6253
6409
|
init_platform();
|
|
6254
6410
|
init_readClaudeConfig();
|
|
6255
6411
|
init_spawn();
|
|
@@ -6296,13 +6452,6 @@ var init_runClaudeArgs = __esm({
|
|
|
6296
6452
|
"src/installers/lib/runClaudeArgs.ts"() {
|
|
6297
6453
|
}
|
|
6298
6454
|
});
|
|
6299
|
-
function getMcpSpawnCwd() {
|
|
6300
|
-
return homedir();
|
|
6301
|
-
}
|
|
6302
|
-
var init_safeCwd = __esm({
|
|
6303
|
-
"src/installers/lib/safeCwd.ts"() {
|
|
6304
|
-
}
|
|
6305
|
-
});
|
|
6306
6455
|
|
|
6307
6456
|
// src/installers/ccPluginMarketplace.ts
|
|
6308
6457
|
function parseCmd(cmd) {
|
|
@@ -7132,7 +7281,7 @@ var init_npmCli2 = __esm({
|
|
|
7132
7281
|
if (ctx.opts.dryRun) return { aborted: true, reason: "user-cancel" };
|
|
7133
7282
|
const bk = await backup(plan, ctx);
|
|
7134
7283
|
if (!bk.ok) return { ok: false, phase: "preflight", error: bk.error };
|
|
7135
|
-
const sp = await spawnCmd(ctx, cmd, [], DEFAULT_INSTALL_TIMEOUT_MS);
|
|
7284
|
+
const sp = await spawnCmd(ctx, cmd, [], DEFAULT_INSTALL_TIMEOUT_MS, { neutralCwd: true });
|
|
7136
7285
|
if (!("exitCode" in sp)) return { ...sp, backupId: bk.backupId };
|
|
7137
7286
|
if (sp.exitCode !== 0) {
|
|
7138
7287
|
return {
|
|
@@ -7150,7 +7299,8 @@ var init_npmCli2 = __esm({
|
|
|
7150
7299
|
}
|
|
7151
7300
|
const verifyTimeoutMs = ctx.manifest.spec.verify.timeout_ms ?? DEFAULT_VERIFY_TIMEOUT_MS;
|
|
7152
7301
|
const vr = await spawnCmd(ctx, ctx.manifest.spec.verify.cmd, [], verifyTimeoutMs, {
|
|
7153
|
-
posixShell: true
|
|
7302
|
+
posixShell: true,
|
|
7303
|
+
neutralCwd: true
|
|
7154
7304
|
});
|
|
7155
7305
|
if (!("exitCode" in vr)) return { ...vr, backupId: bk.backupId };
|
|
7156
7306
|
const expected = ctx.manifest.spec.verify.expected_exit_code ?? 0;
|
|
@@ -7259,11 +7409,11 @@ var init_npxSkillInstaller2 = __esm({
|
|
|
7259
7409
|
if (ctx.opts.dryRun) return { aborted: true, reason: "user-cancel" };
|
|
7260
7410
|
const bk = await backup(plan, ctx);
|
|
7261
7411
|
if (!bk.ok) return { ok: false, phase: "preflight", error: bk.error };
|
|
7262
|
-
let sp = await spawnCmd(ctx, effectiveCmd, [], DEFAULT_INSTALL_TIMEOUT_MS);
|
|
7412
|
+
let sp = await spawnCmd(ctx, effectiveCmd, [], DEFAULT_INSTALL_TIMEOUT_MS, { neutralCwd: true });
|
|
7263
7413
|
if (!("exitCode" in sp)) return { ...sp, backupId: bk.backupId };
|
|
7264
7414
|
if (HARD_CRASH_EXITS.has(sp.exitCode)) {
|
|
7265
7415
|
await new Promise((r) => setTimeout(r, HARD_CRASH_RETRY_DELAY_MS));
|
|
7266
|
-
sp = await spawnCmd(ctx, effectiveCmd, [], DEFAULT_INSTALL_TIMEOUT_MS);
|
|
7416
|
+
sp = await spawnCmd(ctx, effectiveCmd, [], DEFAULT_INSTALL_TIMEOUT_MS, { neutralCwd: true });
|
|
7267
7417
|
if (!("exitCode" in sp)) return { ...sp, backupId: bk.backupId };
|
|
7268
7418
|
}
|
|
7269
7419
|
if (sp.exitCode !== 0) {
|
|
@@ -7299,7 +7449,8 @@ var init_npxSkillInstaller2 = __esm({
|
|
|
7299
7449
|
}
|
|
7300
7450
|
const verifyTimeoutMs = ctx.manifest.spec.verify.timeout_ms ?? DEFAULT_VERIFY_TIMEOUT_MS;
|
|
7301
7451
|
const vr = await spawnCmd(ctx, ctx.manifest.spec.verify.cmd, [], verifyTimeoutMs, {
|
|
7302
|
-
posixShell: true
|
|
7452
|
+
posixShell: true,
|
|
7453
|
+
neutralCwd: true
|
|
7303
7454
|
});
|
|
7304
7455
|
if (!("exitCode" in vr)) return { ...vr, backupId: bk.backupId };
|
|
7305
7456
|
const expected = ctx.manifest.spec.verify.expected_exit_code ?? 0;
|
|
@@ -7994,7 +8145,12 @@ async function runAutoInstall(opts) {
|
|
|
7994
8145
|
// Windows needs shell for `.cmd` / `.bat` exes (npx.cmd / claude.cmd
|
|
7995
8146
|
// shims); Unix is fine either way. Pass-through to OS shell handles
|
|
7996
8147
|
// PATH resolution + extension lookup.
|
|
7997
|
-
shell: true
|
|
8148
|
+
shell: true,
|
|
8149
|
+
// v4.20.1 — neutral cwd: install commands are global-semantics; the
|
|
8150
|
+
// user's shell cwd may carry an ambient devEngines package.json that
|
|
8151
|
+
// kills every npx-based command (EBADDEVENGINES dogfood). Fail-open to
|
|
8152
|
+
// inherited cwd when neutral resolution is unavailable.
|
|
8153
|
+
cwd: getNeutralSpawnCwd() ?? void 0
|
|
7998
8154
|
});
|
|
7999
8155
|
if (r.status !== 0) {
|
|
8000
8156
|
const reason = r.error !== void 0 ? `spawn error on \`${cmd}\`: ${r.error.message}` : `exit ${r.status ?? "<unknown>"} on \`${cmd}\``;
|
|
@@ -8029,6 +8185,7 @@ Auto-install summary: ${out.installed.length} installed / ${out.skipped.length}
|
|
|
8029
8185
|
}
|
|
8030
8186
|
var init_auto_install = __esm({
|
|
8031
8187
|
"src/cli/lib/auto-install.ts"() {
|
|
8188
|
+
init_safeCwd();
|
|
8032
8189
|
init_doctor_registry();
|
|
8033
8190
|
}
|
|
8034
8191
|
});
|
|
@@ -8959,6 +9116,9 @@ function registerLearn(program2) {
|
|
|
8959
9116
|
});
|
|
8960
9117
|
}
|
|
8961
9118
|
|
|
9119
|
+
// src/cli.ts
|
|
9120
|
+
init_assetsRoot();
|
|
9121
|
+
|
|
8962
9122
|
// src/cli/lib/here.ts
|
|
8963
9123
|
init_nextStep();
|
|
8964
9124
|
init_i18n();
|
|
@@ -10547,6 +10707,8 @@ init_path_guard();
|
|
|
10547
10707
|
init_validate();
|
|
10548
10708
|
|
|
10549
10709
|
// src/uninstallers/ccHookAdd.ts
|
|
10710
|
+
init_assetsRoot();
|
|
10711
|
+
init_hookEntry();
|
|
10550
10712
|
init_platform();
|
|
10551
10713
|
|
|
10552
10714
|
// src/uninstallers/lib/runOrPreview.ts
|
|
@@ -10582,13 +10744,14 @@ var uninstallCcHookAdd = async (ctx) => {
|
|
|
10582
10744
|
}
|
|
10583
10745
|
const ev = install.hook_event;
|
|
10584
10746
|
const cmd = install.hook_command;
|
|
10585
|
-
const matcher = install.hook_matcher;
|
|
10586
10747
|
if (!settings.hooks?.[ev]) {
|
|
10587
10748
|
return { ok: true, removedPaths: [] };
|
|
10588
10749
|
}
|
|
10750
|
+
const resolved = resolveHookCommand(cmd, { assetsRoot: getAssetsRoot, exists: existsSync });
|
|
10751
|
+
const marker = hookScriptMarker(cmd);
|
|
10589
10752
|
const before = settings.hooks[ev].length;
|
|
10590
10753
|
settings.hooks[ev] = settings.hooks[ev].filter(
|
|
10591
|
-
(h) => !(h
|
|
10754
|
+
(h) => !entryMatchesRegistration(h, cmd, resolved, marker)
|
|
10592
10755
|
);
|
|
10593
10756
|
if (settings.hooks[ev].length === 0) delete settings.hooks[ev];
|
|
10594
10757
|
if (Object.keys(settings.hooks).length === 0) delete settings.hooks;
|
|
@@ -11137,6 +11300,7 @@ function registerWorkflows(program2) {
|
|
|
11137
11300
|
// src/cli.ts
|
|
11138
11301
|
init_i18n();
|
|
11139
11302
|
init_harnessedRoot();
|
|
11303
|
+
wireMessagesDir(() => join(getAssetsRoot(), "messages"));
|
|
11140
11304
|
migrateLegacyHarnessedRoot();
|
|
11141
11305
|
var argv = process.argv;
|
|
11142
11306
|
for (let i = 2; i < argv.length; i++) {
|