harnessed 4.15.2 → 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 CHANGED
@@ -38,7 +38,7 @@ var init_package = __esm({
38
38
  "package.json"() {
39
39
  package_default = {
40
40
  name: "harnessed",
41
- version: "4.15.2",
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",
@@ -4512,6 +4512,11 @@ function sanitizeOutputTail(raw, cap = 160) {
4512
4512
  const printable = firstNonEmpty.replace(/[^\x20-\x7E]/g, "").trim();
4513
4513
  return printable.length > 0 ? printable.slice(0, cap) : "(unreadable output)";
4514
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
+ }
4515
4520
  function formatVerifyFail(cmd, exitCode, expected, stdout2, stderr) {
4516
4521
  const cmdPart = cmd.length > 80 ? `${cmd.slice(0, 80)}\u2026` : cmd;
4517
4522
  const rawTail = stderr.trim() || stdout2.trim();
@@ -5014,7 +5019,7 @@ async function checkMattpocockSkills() {
5014
5019
  } catch {
5015
5020
  }
5016
5021
  }
5017
- const indicators = ["diagnose", "tdd", "zoom-out"];
5022
+ const indicators = ["tdd", "diagnosing-bugs", "grill-with-docs", "diagnose"];
5018
5023
  for (const skillsDir of harnessSkillsDirs()) {
5019
5024
  for (const ind of indicators) {
5020
5025
  try {
@@ -5040,7 +5045,7 @@ var REMEDIATION2;
5040
5045
  var init_check_mattpocock_skills = __esm({
5041
5046
  "src/cli/lib/check-mattpocock-skills.ts"() {
5042
5047
  init_platform();
5043
- 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 /zoom-out etc. SlashCommand acceleration";
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";
5044
5049
  }
5045
5050
  });
5046
5051
  function getUserClaudeJsonPath() {
@@ -5956,7 +5961,7 @@ var init_idempotent = __esm({
5956
5961
  IDEMPOTENT_CHECK_TIMEOUT_MS = 1e4;
5957
5962
  INSTALLED_INDICATORS = {
5958
5963
  gsd: ["gsd-progress", "gsd-plan-phase"],
5959
- "mattpocock-skills": ["diagnose", "tdd", "zoom-out"]
5964
+ "mattpocock-skills": ["tdd", "diagnosing-bugs", "grill-with-docs", "diagnose"]
5960
5965
  };
5961
5966
  }
5962
5967
  });
@@ -6032,6 +6037,7 @@ var init_ccPluginMarketplace2 = __esm({
6032
6037
  init_runClaudeArgs();
6033
6038
  init_safeCwd();
6034
6039
  init_state2();
6040
+ init_verifyMessage();
6035
6041
  installCcPluginMarketplace = async (ctx) => {
6036
6042
  const install = ctx.manifest.spec.install;
6037
6043
  if (install.method !== "cc-plugin-marketplace") {
@@ -6145,7 +6151,8 @@ ${newEntry}
6145
6151
  error: err(
6146
6152
  ctx,
6147
6153
  "/spec/install/cmd",
6148
- `${bin} plugin ${bin === "codex" ? "add" : "install"} exited ${r2.exitCode}: ${r2.stderr.slice(0, 200)}${stepOneStderr ? ` | marketplace-add stderr: ${stepOneStderr.slice(0, 100)}` : ""}`,
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)}` : ""}`,
6149
6156
  "install-failed"
6150
6157
  )
6151
6158
  };
@@ -6323,37 +6330,35 @@ var init_gitCloneWithSetup2 = __esm({
6323
6330
  error: err(
6324
6331
  ctx,
6325
6332
  "/spec/install/cmd",
6326
- `git-clone-with-setup cmd exited ${sp.exitCode}: ${sp.stderr.slice(0, 200)}`,
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),
6327
6335
  "install-failed"
6328
6336
  )
6329
6337
  };
6330
6338
  }
6331
6339
  const rp = await gitRevParseHead(cloneTarget);
6332
6340
  if (rp.exit !== 0 || !rp.sha) {
6333
- return {
6334
- ok: false,
6335
- phase: "verify",
6336
- backupId: bk.backupId,
6337
- error: err(
6338
- ctx,
6339
- "/spec/install/git_ref",
6340
- `git rev-parse HEAD failed in ${cloneTarget} (exit ${rp.exit}); cannot verify SHA pin '${install.git_ref}'`,
6341
- "sha-mismatch"
6342
- )
6343
- };
6344
- }
6345
- if (!rp.sha.startsWith(install.git_ref)) {
6346
- return {
6347
- ok: false,
6348
- phase: "verify",
6349
- backupId: bk.backupId,
6350
- error: err(
6351
- ctx,
6352
- "/spec/install/git_ref",
6353
- `git_ref SHA mismatch: manifest pinned '${install.git_ref}' but HEAD is '${rp.sha}' in ${cloneTarget}`,
6354
- "sha-mismatch"
6355
- )
6356
- };
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
+ }
6357
6362
  }
6358
6363
  const verifyTimeoutMs = ctx.manifest.spec.verify.timeout_ms ?? DEFAULT_VERIFY_TIMEOUT_MS;
6359
6364
  const vr = await spawnCmd(ctx, ctx.manifest.spec.verify.cmd, [], verifyTimeoutMs, {
@@ -6818,7 +6823,8 @@ var init_npmCli2 = __esm({
6818
6823
  error: err(
6819
6824
  ctx,
6820
6825
  "/spec/install/cmd",
6821
- `install cmd exited ${sp.exitCode}: ${sp.stderr.slice(0, 200)}`,
6826
+ // v4.16.0 T5 — shared spawn-fail format (stderr → stdout fallback).
6827
+ formatSpawnFail("install cmd", sp.exitCode, sp.stdout, sp.stderr),
6822
6828
  "install-failed"
6823
6829
  )
6824
6830
  };
@@ -6848,7 +6854,7 @@ var init_npmCli2 = __esm({
6848
6854
  };
6849
6855
  }
6850
6856
  });
6851
- var installNpxSkillInstaller;
6857
+ var HARD_CRASH_EXITS, HARD_CRASH_RETRY_DELAY_MS, installNpxSkillInstaller;
6852
6858
  var init_npxSkillInstaller2 = __esm({
6853
6859
  "src/installers/npxSkillInstaller.ts"() {
6854
6860
  init_backup();
@@ -6861,6 +6867,8 @@ var init_npxSkillInstaller2 = __esm({
6861
6867
  init_spawn();
6862
6868
  init_state2();
6863
6869
  init_verifyMessage();
6870
+ HARD_CRASH_EXITS = /* @__PURE__ */ new Set([3221226505, 3221225477]);
6871
+ HARD_CRASH_RETRY_DELAY_MS = 500;
6864
6872
  installNpxSkillInstaller = async (ctx) => {
6865
6873
  const install = ctx.manifest.spec.install;
6866
6874
  if (install.method !== "npx-skill-installer") {
@@ -6932,8 +6940,13 @@ var init_npxSkillInstaller2 = __esm({
6932
6940
  if (ctx.opts.dryRun) return { aborted: true, reason: "user-cancel" };
6933
6941
  const bk = await backup(plan, ctx);
6934
6942
  if (!bk.ok) return { ok: false, phase: "preflight", error: bk.error };
6935
- const sp = await spawnCmd(ctx, effectiveCmd, [], DEFAULT_INSTALL_TIMEOUT_MS);
6943
+ let sp = await spawnCmd(ctx, effectiveCmd, [], DEFAULT_INSTALL_TIMEOUT_MS);
6936
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
+ }
6937
6950
  if (sp.exitCode !== 0) {
6938
6951
  return {
6939
6952
  ok: false,
@@ -6942,7 +6955,8 @@ var init_npxSkillInstaller2 = __esm({
6942
6955
  error: err(
6943
6956
  ctx,
6944
6957
  "/spec/install/cmd",
6945
- `npx skills add exited ${sp.exitCode}: ${sp.stderr.slice(0, 200)}`,
6958
+ // v4.16.0 T5 — shared spawn-fail format (stderr → stdout fallback).
6959
+ formatSpawnFail("npx skills add", sp.exitCode, sp.stdout, sp.stderr),
6946
6960
  "install-failed"
6947
6961
  )
6948
6962
  };
@@ -9834,7 +9848,7 @@ function printGrouped(b, prefix = "") {
9834
9848
  };
9835
9849
  for (const n of b.failed) {
9836
9850
  const m = n.match(/^([^:]+):\s*(.*)$/s);
9837
- 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] });
9838
9852
  }
9839
9853
  for (const n of b.installed) push(groupOf(n), { status: "installed", name: n });
9840
9854
  for (const s of b.skipped)
@@ -9845,7 +9859,8 @@ function printGrouped(b, prefix = "") {
9845
9859
  push(groupOf(k.name), {
9846
9860
  status: "kept-existing",
9847
9861
  name: k.name,
9848
- note: `${why} \u2014 prior version retained`
9862
+ note: `${why} \u2014 prior version retained`,
9863
+ full: k.reason
9849
9864
  });
9850
9865
  }
9851
9866
  for (const g of GROUP_ORDER) {
@@ -9866,6 +9881,13 @@ function printGrouped(b, prefix = "") {
9866
9881
  else if (r.status === "kept-existing") console.warn(r.line);
9867
9882
  else console.log(r.line);
9868
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
+ }
9869
9891
  }
9870
9892
  }
9871
9893
  function registerSetup(program2) {