harnessed 4.15.1 → 4.16.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 +158 -75
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/manifests/skill-packs/mattpocock-skills.yaml +8 -4
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync, mkdirSync, renameSync, writeFileSync, readFileSync, readdirSync, statSync } from 'fs';
|
|
3
3
|
import { homedir } from 'os';
|
|
4
|
-
import { join, dirname, resolve, sep, relative } from 'path';
|
|
4
|
+
import { join, dirname, resolve, sep, win32, relative } from 'path';
|
|
5
5
|
import { Type } from '@sinclair/typebox';
|
|
6
6
|
import { readFile, readdir, unlink, writeFile, stat, rm, cp, mkdir, rename, access, appendFile } from 'fs/promises';
|
|
7
7
|
import { Value } from '@sinclair/typebox/value';
|
|
@@ -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.16.0",
|
|
42
42
|
description: "AI coding harness package manager + composition orchestrator",
|
|
43
43
|
type: "module",
|
|
44
44
|
license: "Apache-2.0",
|
|
@@ -4411,6 +4411,16 @@ var init_breakLoop = __esm({
|
|
|
4411
4411
|
LOOP_THRESHOLD = 3;
|
|
4412
4412
|
}
|
|
4413
4413
|
});
|
|
4414
|
+
function realProbe(p6) {
|
|
4415
|
+
try {
|
|
4416
|
+
if (typeof spawnSync !== "function") return null;
|
|
4417
|
+
const r = spawnSync(p6, ["-c", "echo harnessed-bash-ok"], { encoding: "utf8", timeout: 5e3 });
|
|
4418
|
+
if (!r || r.error) return null;
|
|
4419
|
+
return r.status === 0;
|
|
4420
|
+
} catch {
|
|
4421
|
+
return null;
|
|
4422
|
+
}
|
|
4423
|
+
}
|
|
4414
4424
|
function realWhere(name) {
|
|
4415
4425
|
try {
|
|
4416
4426
|
if (typeof spawnSync !== "function") return [];
|
|
@@ -4433,7 +4443,8 @@ function defaultDeps() {
|
|
|
4433
4443
|
platform: process.platform,
|
|
4434
4444
|
env: process.env,
|
|
4435
4445
|
where: realWhere,
|
|
4436
|
-
exists: realExists
|
|
4446
|
+
exists: realExists,
|
|
4447
|
+
probe: realProbe
|
|
4437
4448
|
};
|
|
4438
4449
|
}
|
|
4439
4450
|
function resolveBash(deps) {
|
|
@@ -4452,45 +4463,70 @@ function compute(d) {
|
|
|
4452
4463
|
const pathLines = d.where("bash");
|
|
4453
4464
|
const first = pathLines[0];
|
|
4454
4465
|
const wslOnPath = first && WSL_STUB_RE.test(first) ? first : void 0;
|
|
4455
|
-
|
|
4466
|
+
const usable = (p6) => !WSL_STUB_RE.test(p6) && d.probe(p6) !== false;
|
|
4467
|
+
if (first && usable(first)) {
|
|
4456
4468
|
return { path: first, source: "path" };
|
|
4457
4469
|
}
|
|
4458
4470
|
const gitFirst = d.where("git")[0];
|
|
4459
4471
|
if (gitFirst && /git\.exe$/i.test(gitFirst)) {
|
|
4460
|
-
const root =
|
|
4461
|
-
for (const cand of [
|
|
4462
|
-
if (d.exists(cand)) return { path: cand, source: "git-derived", wslOnPath };
|
|
4472
|
+
const root = dirname8(dirname8(gitFirst));
|
|
4473
|
+
for (const cand of [join17(root, "bin", "bash.exe"), join17(root, "usr", "bin", "bash.exe")]) {
|
|
4474
|
+
if (d.exists(cand) && usable(cand)) return { path: cand, source: "git-derived", wslOnPath };
|
|
4463
4475
|
}
|
|
4464
4476
|
}
|
|
4465
4477
|
const bases = [
|
|
4466
4478
|
d.env.ProgramFiles,
|
|
4467
4479
|
d.env.ProgramW6432,
|
|
4468
4480
|
d.env["ProgramFiles(x86)"],
|
|
4469
|
-
d.env.LOCALAPPDATA ?
|
|
4481
|
+
d.env.LOCALAPPDATA ? join17(d.env.LOCALAPPDATA, "Programs") : void 0
|
|
4470
4482
|
];
|
|
4471
4483
|
for (const base of bases) {
|
|
4472
4484
|
if (!base) continue;
|
|
4473
4485
|
for (const cand of [
|
|
4474
|
-
|
|
4475
|
-
|
|
4486
|
+
join17(base, "Git", "bin", "bash.exe"),
|
|
4487
|
+
join17(base, "Git", "usr", "bin", "bash.exe")
|
|
4476
4488
|
]) {
|
|
4477
|
-
if (d.exists(cand)
|
|
4489
|
+
if (d.exists(cand) && usable(cand))
|
|
4490
|
+
return { path: cand, source: "standard-location", wslOnPath };
|
|
4478
4491
|
}
|
|
4479
4492
|
}
|
|
4480
|
-
const
|
|
4481
|
-
if (
|
|
4493
|
+
const laterUsable = pathLines.slice(1).find((l) => usable(l));
|
|
4494
|
+
if (laterUsable) return { path: laterUsable, source: "path", wslOnPath };
|
|
4482
4495
|
if (pathLines.length > 0) {
|
|
4483
|
-
return { path: null, source: "path", reason: "wsl-only", wslOnPath: first };
|
|
4496
|
+
return { path: null, source: "path", reason: "wsl-only", wslOnPath: wslOnPath ?? first };
|
|
4484
4497
|
}
|
|
4485
4498
|
return { path: "bash", source: "path-fallback" };
|
|
4486
4499
|
}
|
|
4487
|
-
var WSL_STUB_RE, cache2;
|
|
4500
|
+
var dirname8, join17, WSL_STUB_RE, cache2;
|
|
4488
4501
|
var init_resolveBash = __esm({
|
|
4489
4502
|
"src/installers/lib/resolveBash.ts"() {
|
|
4490
|
-
|
|
4503
|
+
({ dirname: dirname8, join: join17 } = win32);
|
|
4504
|
+
WSL_STUB_RE = /[\\/](windows[\\/](system32|sysnative|syswow64)|microsoft[\\/]windowsapps)[\\/]bash\.exe$/i;
|
|
4491
4505
|
cache2 = null;
|
|
4492
4506
|
}
|
|
4493
4507
|
});
|
|
4508
|
+
|
|
4509
|
+
// src/installers/lib/verifyMessage.ts
|
|
4510
|
+
function sanitizeOutputTail(raw, cap = 160) {
|
|
4511
|
+
const firstNonEmpty = raw.split(/\r?\n/).find((l) => l.trim().length > 0) ?? "";
|
|
4512
|
+
const printable = firstNonEmpty.replace(/[^\x20-\x7E]/g, "").trim();
|
|
4513
|
+
return printable.length > 0 ? printable.slice(0, cap) : "(unreadable output)";
|
|
4514
|
+
}
|
|
4515
|
+
function formatSpawnFail(label, exitCode, stdout2, stderr) {
|
|
4516
|
+
const rawTail = stderr.trim() || stdout2.trim();
|
|
4517
|
+
const tail = rawTail.length > 0 ? sanitizeOutputTail(rawTail) : "(no output)";
|
|
4518
|
+
return `${label} exited ${exitCode}: ${tail}`;
|
|
4519
|
+
}
|
|
4520
|
+
function formatVerifyFail(cmd, exitCode, expected, stdout2, stderr) {
|
|
4521
|
+
const cmdPart = cmd.length > 80 ? `${cmd.slice(0, 80)}\u2026` : cmd;
|
|
4522
|
+
const rawTail = stderr.trim() || stdout2.trim();
|
|
4523
|
+
const tail = rawTail.length > 0 ? sanitizeOutputTail(rawTail) : "(no output)";
|
|
4524
|
+
return `verify failed (exit ${exitCode} \u2260 expected ${expected}): \`${cmdPart}\` \u2014 ${tail}`;
|
|
4525
|
+
}
|
|
4526
|
+
var init_verifyMessage = __esm({
|
|
4527
|
+
"src/installers/lib/verifyMessage.ts"() {
|
|
4528
|
+
}
|
|
4529
|
+
});
|
|
4494
4530
|
function checkNodeVersion() {
|
|
4495
4531
|
const v = process.versions.node;
|
|
4496
4532
|
const major = Number.parseInt(v.split(".")[0] ?? "0", 10);
|
|
@@ -4547,12 +4583,17 @@ function checkJq() {
|
|
|
4547
4583
|
};
|
|
4548
4584
|
}
|
|
4549
4585
|
const fix = process.platform === "win32" ? "winget install jqlang.jq (or: scoop install jq)" : process.platform === "darwin" ? "brew install jq" : "apt-get install jq (or: dnf install jq)";
|
|
4550
|
-
|
|
4586
|
+
const installCmd = process.platform === "win32" ? "winget install jqlang.jq" : process.platform === "darwin" ? "brew install jq" : "apt-get install -y jq";
|
|
4587
|
+
return {
|
|
4588
|
+
name: "jq present",
|
|
4589
|
+
status: "warn",
|
|
4590
|
+
message: "jq not found in PATH (optional \u2014 needed by `harnessed audit-log --filter` and the ralph-loop plugin on Windows)",
|
|
4591
|
+
fix,
|
|
4592
|
+
install_commands: [installCmd]
|
|
4593
|
+
};
|
|
4551
4594
|
}
|
|
4552
4595
|
function sanitizeToolOutput(raw, cap = 60) {
|
|
4553
|
-
|
|
4554
|
-
const printable = first.replace(/[^\x20-\x7E]/g, "").trim();
|
|
4555
|
-
return printable.length > 0 ? printable.slice(0, cap) : "(unreadable output)";
|
|
4596
|
+
return sanitizeOutputTail(raw, cap);
|
|
4556
4597
|
}
|
|
4557
4598
|
function checkWinBash() {
|
|
4558
4599
|
if (process.platform !== "win32") {
|
|
@@ -4593,6 +4634,7 @@ var init_check_builtin = __esm({
|
|
|
4593
4634
|
"src/cli/lib/check-builtin.ts"() {
|
|
4594
4635
|
init_platform();
|
|
4595
4636
|
init_resolveBash();
|
|
4637
|
+
init_verifyMessage();
|
|
4596
4638
|
}
|
|
4597
4639
|
});
|
|
4598
4640
|
|
|
@@ -4977,7 +5019,7 @@ async function checkMattpocockSkills() {
|
|
|
4977
5019
|
} catch {
|
|
4978
5020
|
}
|
|
4979
5021
|
}
|
|
4980
|
-
const indicators = ["
|
|
5022
|
+
const indicators = ["tdd", "diagnosing-bugs", "grill-with-docs", "diagnose"];
|
|
4981
5023
|
for (const skillsDir of harnessSkillsDirs()) {
|
|
4982
5024
|
for (const ind of indicators) {
|
|
4983
5025
|
try {
|
|
@@ -5003,7 +5045,7 @@ var REMEDIATION2;
|
|
|
5003
5045
|
var init_check_mattpocock_skills = __esm({
|
|
5004
5046
|
"src/cli/lib/check-mattpocock-skills.ts"() {
|
|
5005
5047
|
init_platform();
|
|
5006
|
-
REMEDIATION2 = "install via `npx skills@latest add mattpocock/skills` (or git clone https://github.com/mattpocock/skills ~/.claude/skills/mattpocock-skills); methodology fallback already inline in role-prompts.yaml per v3.6.0 Phase 1 \u2014 install is optional but enables /grill-with-docs /
|
|
5048
|
+
REMEDIATION2 = "install via `npx skills@latest add mattpocock/skills` (or git clone https://github.com/mattpocock/skills ~/.claude/skills/mattpocock-skills); methodology fallback already inline in role-prompts.yaml per v3.6.0 Phase 1 \u2014 install is optional but enables /grill-with-docs /tdd /diagnosing-bugs etc. SlashCommand acceleration";
|
|
5007
5049
|
}
|
|
5008
5050
|
});
|
|
5009
5051
|
function getUserClaudeJsonPath() {
|
|
@@ -5637,6 +5679,11 @@ function expandTildeForWindows(cmd) {
|
|
|
5637
5679
|
const home = homedir().replace(/\\/g, "/");
|
|
5638
5680
|
return cmd.replace(/(^|[\s"'`(])~\//g, `$1${home}/`);
|
|
5639
5681
|
}
|
|
5682
|
+
function needsPosixShell(cmd) {
|
|
5683
|
+
if (POSIX_SYNTAX_RE.test(cmd)) return true;
|
|
5684
|
+
const firstToken = cmd.trim().split(/\s+/)[0]?.toLowerCase() ?? "";
|
|
5685
|
+
return POSIX_FIRST_TOKENS.has(firstToken);
|
|
5686
|
+
}
|
|
5640
5687
|
async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
5641
5688
|
const violation = checkCmdString(cmd);
|
|
5642
5689
|
if (violation) {
|
|
@@ -5666,7 +5713,7 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5666
5713
|
let triedBash = false;
|
|
5667
5714
|
const stdio = ["ignore", "pipe", "pipe"];
|
|
5668
5715
|
if (process.platform === "win32") {
|
|
5669
|
-
if (opts?.posixShell) {
|
|
5716
|
+
if (opts?.posixShell && needsPosixShell(joinedCmd)) {
|
|
5670
5717
|
const bash = resolveBash();
|
|
5671
5718
|
if (bash.path === null) {
|
|
5672
5719
|
return {
|
|
@@ -5716,8 +5763,9 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5716
5763
|
path: "/spec/install/cmd",
|
|
5717
5764
|
// v4.15.1 — fall back to stdout when stderr is empty (WSL stubs and
|
|
5718
5765
|
// some CLIs write their error text to stdout; a bare trailing colon
|
|
5719
|
-
// read as "no reason" in user dogfood).
|
|
5720
|
-
|
|
5766
|
+
// read as "no reason" in user dogfood). v4.15.2 — sanitized (CP936
|
|
5767
|
+
// mojibake was embedded verbatim in the ctx7 dogfood error).
|
|
5768
|
+
message: `spawn timed out after ${effectiveTimeoutMs}ms (cmd: ${cmd}); partial output: ${(stderr || stdout2).trim() ? sanitizeOutputTail(stderr || stdout2, 200) : "(no output)"}`,
|
|
5721
5769
|
line: null,
|
|
5722
5770
|
column: null,
|
|
5723
5771
|
keyword: "spawn-timeout"
|
|
@@ -5746,12 +5794,38 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5746
5794
|
});
|
|
5747
5795
|
});
|
|
5748
5796
|
}
|
|
5749
|
-
var DEFAULT_VERIFY_TIMEOUT_MS, DEFAULT_INSTALL_TIMEOUT_MS;
|
|
5797
|
+
var POSIX_SYNTAX_RE, POSIX_FIRST_TOKENS, DEFAULT_VERIFY_TIMEOUT_MS, DEFAULT_INSTALL_TIMEOUT_MS;
|
|
5750
5798
|
var init_spawn = __esm({
|
|
5751
5799
|
"src/installers/lib/spawn.ts"() {
|
|
5752
5800
|
init_security();
|
|
5753
5801
|
init_nativeTest();
|
|
5754
5802
|
init_resolveBash();
|
|
5803
|
+
init_verifyMessage();
|
|
5804
|
+
POSIX_SYNTAX_RE = /[|;<>`$~[\]{}()*?!]|&&/;
|
|
5805
|
+
POSIX_FIRST_TOKENS = /* @__PURE__ */ new Set([
|
|
5806
|
+
"test",
|
|
5807
|
+
"grep",
|
|
5808
|
+
"rm",
|
|
5809
|
+
"cp",
|
|
5810
|
+
"mv",
|
|
5811
|
+
"mkdir",
|
|
5812
|
+
"ls",
|
|
5813
|
+
"cat",
|
|
5814
|
+
"cd",
|
|
5815
|
+
"sh",
|
|
5816
|
+
"bash",
|
|
5817
|
+
"command",
|
|
5818
|
+
"find",
|
|
5819
|
+
"sed",
|
|
5820
|
+
"awk",
|
|
5821
|
+
"touch",
|
|
5822
|
+
"ln",
|
|
5823
|
+
"chmod",
|
|
5824
|
+
"head",
|
|
5825
|
+
"tail",
|
|
5826
|
+
"which",
|
|
5827
|
+
"echo"
|
|
5828
|
+
]);
|
|
5755
5829
|
DEFAULT_VERIFY_TIMEOUT_MS = 15e3;
|
|
5756
5830
|
DEFAULT_INSTALL_TIMEOUT_MS = 3e5;
|
|
5757
5831
|
}
|
|
@@ -5887,7 +5961,7 @@ var init_idempotent = __esm({
|
|
|
5887
5961
|
IDEMPOTENT_CHECK_TIMEOUT_MS = 1e4;
|
|
5888
5962
|
INSTALLED_INDICATORS = {
|
|
5889
5963
|
gsd: ["gsd-progress", "gsd-plan-phase"],
|
|
5890
|
-
"mattpocock-skills": ["
|
|
5964
|
+
"mattpocock-skills": ["tdd", "diagnosing-bugs", "grill-with-docs", "diagnose"]
|
|
5891
5965
|
};
|
|
5892
5966
|
}
|
|
5893
5967
|
});
|
|
@@ -5963,6 +6037,7 @@ var init_ccPluginMarketplace2 = __esm({
|
|
|
5963
6037
|
init_runClaudeArgs();
|
|
5964
6038
|
init_safeCwd();
|
|
5965
6039
|
init_state2();
|
|
6040
|
+
init_verifyMessage();
|
|
5966
6041
|
installCcPluginMarketplace = async (ctx) => {
|
|
5967
6042
|
const install = ctx.manifest.spec.install;
|
|
5968
6043
|
if (install.method !== "cc-plugin-marketplace") {
|
|
@@ -6076,7 +6151,8 @@ ${newEntry}
|
|
|
6076
6151
|
error: err(
|
|
6077
6152
|
ctx,
|
|
6078
6153
|
"/spec/install/cmd",
|
|
6079
|
-
|
|
6154
|
+
// v4.16.0 T5 — shared spawn-fail format (stderr → stdout fallback).
|
|
6155
|
+
`${formatSpawnFail(`${bin} plugin ${bin === "codex" ? "add" : "install"}`, r2.exitCode, r2.stdout, r2.stderr)}${stepOneStderr ? ` | marketplace-add stderr: ${stepOneStderr.slice(0, 100)}` : ""}`,
|
|
6080
6156
|
"install-failed"
|
|
6081
6157
|
)
|
|
6082
6158
|
};
|
|
@@ -6107,17 +6183,6 @@ ${newEntry}
|
|
|
6107
6183
|
};
|
|
6108
6184
|
}
|
|
6109
6185
|
});
|
|
6110
|
-
|
|
6111
|
-
// src/installers/lib/verifyMessage.ts
|
|
6112
|
-
function formatVerifyFail(cmd, exitCode, expected, stdout2, stderr) {
|
|
6113
|
-
const cmdPart = cmd.length > 80 ? `${cmd.slice(0, 80)}\u2026` : cmd;
|
|
6114
|
-
const tail = stderr.trim().slice(0, 160) || stdout2.trim().slice(0, 160) || "(no output)";
|
|
6115
|
-
return `verify failed (exit ${exitCode} \u2260 expected ${expected}): \`${cmdPart}\` \u2014 ${tail}`;
|
|
6116
|
-
}
|
|
6117
|
-
var init_verifyMessage = __esm({
|
|
6118
|
-
"src/installers/lib/verifyMessage.ts"() {
|
|
6119
|
-
}
|
|
6120
|
-
});
|
|
6121
6186
|
function gitRevParseHead(cwd, timeoutMs = 1e4) {
|
|
6122
6187
|
return new Promise((resolve17) => {
|
|
6123
6188
|
const isWin = process.platform === "win32";
|
|
@@ -6265,37 +6330,35 @@ var init_gitCloneWithSetup2 = __esm({
|
|
|
6265
6330
|
error: err(
|
|
6266
6331
|
ctx,
|
|
6267
6332
|
"/spec/install/cmd",
|
|
6268
|
-
|
|
6333
|
+
// v4.16.0 T5 — shared spawn-fail format (stderr → stdout fallback).
|
|
6334
|
+
formatSpawnFail("git-clone-with-setup cmd", sp.exitCode, sp.stdout, sp.stderr),
|
|
6269
6335
|
"install-failed"
|
|
6270
6336
|
)
|
|
6271
6337
|
};
|
|
6272
6338
|
}
|
|
6273
6339
|
const rp = await gitRevParseHead(cloneTarget);
|
|
6274
6340
|
if (rp.exit !== 0 || !rp.sha) {
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
"sha-mismatch"
|
|
6297
|
-
)
|
|
6298
|
-
};
|
|
6341
|
+
console.warn(
|
|
6342
|
+
` \u26A0 ${name}: git_ref SHA pin '${install.git_ref}' unverifiable \u2014 \`git rev-parse HEAD\` exit ${rp.exit} in ${cloneTarget} (the install cmd may remove its own clone dir); falling back to the manifest verify cmd as the install authority`
|
|
6343
|
+
);
|
|
6344
|
+
} else if (!rp.sha.startsWith(install.git_ref)) {
|
|
6345
|
+
if (ctx.opts.updateInstalled === true) {
|
|
6346
|
+
console.warn(
|
|
6347
|
+
` \u26A0 ${name}: upstream HEAD '${rp.sha}' no longer matches manifest git_ref pin '${install.git_ref}' (expected under force-update \u2014 the pin records install-time state); consider bumping git_ref in the manifest`
|
|
6348
|
+
);
|
|
6349
|
+
} else {
|
|
6350
|
+
return {
|
|
6351
|
+
ok: false,
|
|
6352
|
+
phase: "verify",
|
|
6353
|
+
backupId: bk.backupId,
|
|
6354
|
+
error: err(
|
|
6355
|
+
ctx,
|
|
6356
|
+
"/spec/install/git_ref",
|
|
6357
|
+
`git_ref SHA mismatch: manifest pinned '${install.git_ref}' but HEAD is '${rp.sha}' in ${cloneTarget}`,
|
|
6358
|
+
"sha-mismatch"
|
|
6359
|
+
)
|
|
6360
|
+
};
|
|
6361
|
+
}
|
|
6299
6362
|
}
|
|
6300
6363
|
const verifyTimeoutMs = ctx.manifest.spec.verify.timeout_ms ?? DEFAULT_VERIFY_TIMEOUT_MS;
|
|
6301
6364
|
const vr = await spawnCmd(ctx, ctx.manifest.spec.verify.cmd, [], verifyTimeoutMs, {
|
|
@@ -6760,7 +6823,8 @@ var init_npmCli2 = __esm({
|
|
|
6760
6823
|
error: err(
|
|
6761
6824
|
ctx,
|
|
6762
6825
|
"/spec/install/cmd",
|
|
6763
|
-
|
|
6826
|
+
// v4.16.0 T5 — shared spawn-fail format (stderr → stdout fallback).
|
|
6827
|
+
formatSpawnFail("install cmd", sp.exitCode, sp.stdout, sp.stderr),
|
|
6764
6828
|
"install-failed"
|
|
6765
6829
|
)
|
|
6766
6830
|
};
|
|
@@ -6790,7 +6854,7 @@ var init_npmCli2 = __esm({
|
|
|
6790
6854
|
};
|
|
6791
6855
|
}
|
|
6792
6856
|
});
|
|
6793
|
-
var installNpxSkillInstaller;
|
|
6857
|
+
var HARD_CRASH_EXITS, HARD_CRASH_RETRY_DELAY_MS, installNpxSkillInstaller;
|
|
6794
6858
|
var init_npxSkillInstaller2 = __esm({
|
|
6795
6859
|
"src/installers/npxSkillInstaller.ts"() {
|
|
6796
6860
|
init_backup();
|
|
@@ -6803,6 +6867,8 @@ var init_npxSkillInstaller2 = __esm({
|
|
|
6803
6867
|
init_spawn();
|
|
6804
6868
|
init_state2();
|
|
6805
6869
|
init_verifyMessage();
|
|
6870
|
+
HARD_CRASH_EXITS = /* @__PURE__ */ new Set([3221226505, 3221225477]);
|
|
6871
|
+
HARD_CRASH_RETRY_DELAY_MS = 500;
|
|
6806
6872
|
installNpxSkillInstaller = async (ctx) => {
|
|
6807
6873
|
const install = ctx.manifest.spec.install;
|
|
6808
6874
|
if (install.method !== "npx-skill-installer") {
|
|
@@ -6874,8 +6940,13 @@ var init_npxSkillInstaller2 = __esm({
|
|
|
6874
6940
|
if (ctx.opts.dryRun) return { aborted: true, reason: "user-cancel" };
|
|
6875
6941
|
const bk = await backup(plan, ctx);
|
|
6876
6942
|
if (!bk.ok) return { ok: false, phase: "preflight", error: bk.error };
|
|
6877
|
-
|
|
6943
|
+
let sp = await spawnCmd(ctx, effectiveCmd, [], DEFAULT_INSTALL_TIMEOUT_MS);
|
|
6878
6944
|
if (!("exitCode" in sp)) return { ...sp, backupId: bk.backupId };
|
|
6945
|
+
if (HARD_CRASH_EXITS.has(sp.exitCode)) {
|
|
6946
|
+
await new Promise((r) => setTimeout(r, HARD_CRASH_RETRY_DELAY_MS));
|
|
6947
|
+
sp = await spawnCmd(ctx, effectiveCmd, [], DEFAULT_INSTALL_TIMEOUT_MS);
|
|
6948
|
+
if (!("exitCode" in sp)) return { ...sp, backupId: bk.backupId };
|
|
6949
|
+
}
|
|
6879
6950
|
if (sp.exitCode !== 0) {
|
|
6880
6951
|
return {
|
|
6881
6952
|
ok: false,
|
|
@@ -6884,7 +6955,8 @@ var init_npxSkillInstaller2 = __esm({
|
|
|
6884
6955
|
error: err(
|
|
6885
6956
|
ctx,
|
|
6886
6957
|
"/spec/install/cmd",
|
|
6887
|
-
|
|
6958
|
+
// v4.16.0 T5 — shared spawn-fail format (stderr → stdout fallback).
|
|
6959
|
+
formatSpawnFail("npx skills add", sp.exitCode, sp.stdout, sp.stderr),
|
|
6888
6960
|
"install-failed"
|
|
6889
6961
|
)
|
|
6890
6962
|
};
|
|
@@ -9642,7 +9714,8 @@ async function reclassifyForceUpdateFailures(firstPass, forcePass, probe) {
|
|
|
9642
9714
|
const failed = [];
|
|
9643
9715
|
const keptExisting = [];
|
|
9644
9716
|
for (const entry of forcePass.failed) {
|
|
9645
|
-
const
|
|
9717
|
+
const m = entry.match(/^([^:]+):\s*(.*)$/s);
|
|
9718
|
+
const name = (m?.[1] ?? entry).trim();
|
|
9646
9719
|
if (priorlyInstalled.has(name)) {
|
|
9647
9720
|
let present = false;
|
|
9648
9721
|
try {
|
|
@@ -9651,7 +9724,7 @@ async function reclassifyForceUpdateFailures(firstPass, forcePass, probe) {
|
|
|
9651
9724
|
present = false;
|
|
9652
9725
|
}
|
|
9653
9726
|
if (present) {
|
|
9654
|
-
keptExisting.push(name);
|
|
9727
|
+
keptExisting.push({ name, reason: m?.[2]?.trim() ?? "" });
|
|
9655
9728
|
continue;
|
|
9656
9729
|
}
|
|
9657
9730
|
}
|
|
@@ -9775,18 +9848,21 @@ function printGrouped(b, prefix = "") {
|
|
|
9775
9848
|
};
|
|
9776
9849
|
for (const n of b.failed) {
|
|
9777
9850
|
const m = n.match(/^([^:]+):\s*(.*)$/s);
|
|
9778
|
-
push(groupOf(m?.[1] ?? n), { status: "failed", name: m?.[1] ?? n, note: m?.[2] });
|
|
9851
|
+
push(groupOf(m?.[1] ?? n), { status: "failed", name: m?.[1] ?? n, note: m?.[2], full: m?.[2] });
|
|
9779
9852
|
}
|
|
9780
9853
|
for (const n of b.installed) push(groupOf(n), { status: "installed", name: n });
|
|
9781
9854
|
for (const s of b.skipped)
|
|
9782
9855
|
push(groupOf(s.name), { status: "skipped", name: s.name, note: s.reason });
|
|
9783
9856
|
for (const n of b.alreadyInstalled) push(groupOf(n), { status: "already-installed", name: n });
|
|
9784
|
-
for (const
|
|
9785
|
-
|
|
9857
|
+
for (const k of b.keptExisting ?? []) {
|
|
9858
|
+
const why = k.reason ? `refresh failed: ${k.reason.slice(0, 90)}` : "refresh failed";
|
|
9859
|
+
push(groupOf(k.name), {
|
|
9786
9860
|
status: "kept-existing",
|
|
9787
|
-
name:
|
|
9788
|
-
note:
|
|
9861
|
+
name: k.name,
|
|
9862
|
+
note: `${why} \u2014 prior version retained`,
|
|
9863
|
+
full: k.reason
|
|
9789
9864
|
});
|
|
9865
|
+
}
|
|
9790
9866
|
for (const g of GROUP_ORDER) {
|
|
9791
9867
|
const entries = buckets[g];
|
|
9792
9868
|
if (!entries || entries.length === 0) continue;
|
|
@@ -9805,6 +9881,13 @@ function printGrouped(b, prefix = "") {
|
|
|
9805
9881
|
else if (r.status === "kept-existing") console.warn(r.line);
|
|
9806
9882
|
else console.log(r.line);
|
|
9807
9883
|
}
|
|
9884
|
+
for (const e of entries) {
|
|
9885
|
+
if (!e.full || e.full.length <= NOTE_MAX) continue;
|
|
9886
|
+
const full = e.full.length > 400 ? `${e.full.slice(0, 400)}\u2026` : e.full;
|
|
9887
|
+
const line = ` \u21B3 ${e.name}: ${full}`;
|
|
9888
|
+
if (e.status === "failed") console.error(line);
|
|
9889
|
+
else console.warn(line);
|
|
9890
|
+
}
|
|
9808
9891
|
}
|
|
9809
9892
|
}
|
|
9810
9893
|
function registerSetup(program2) {
|