@haus-tech/haus-workflow 7.1.0 → 7.2.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cli.js +395 -233
  3. package/package.json +1 -1
  4. package/packages/agents/qa-fixer.md +66 -0
  5. package/packages/agents/qa-inventory.md +36 -0
  6. package/packages/agents/qa-reviewer.md +32 -0
  7. package/packages/agents/qa-tester.md +85 -0
  8. package/packages/packages.yaml +8 -0
  9. package/packages/skills/fixing-weak-tests/SKILL.md +89 -0
  10. package/packages/skills/fixing-weak-tests/references/audit-brief.md +57 -0
  11. package/packages/skills/fixing-weak-tests/references/fix-brief.md +55 -0
  12. package/packages/skills/optimizing-test-suites/SKILL.md +157 -0
  13. package/packages/skills/optimizing-test-suites/references/affected-tests.md +46 -0
  14. package/packages/skills/optimizing-test-suites/references/levers.md +79 -0
  15. package/packages/skills/optimizing-test-suites/scripts/slowest.mjs +78 -0
  16. package/packages/skills/qa-genomklickning/SKILL.md +179 -0
  17. package/packages/skills/qa-genomklickning/drivers.md +159 -0
  18. package/packages/skills/qa-genomklickning/report.md +23 -0
  19. package/packages/skills/qa-genomklickning/scripts/android-setup.sh +26 -0
  20. package/packages/skills/qa-genomklickning/scripts/android.sh +62 -0
  21. package/packages/skills/qa-genomklickning/scripts/chrome-tab-guard.py +55 -0
  22. package/packages/skills/qa-genomklickning/scripts/env-check.sh +32 -0
  23. package/packages/skills/qa-genomklickning/scripts/ios-sim.sh +49 -0
  24. package/packages/skills/request/SKILL.md +3 -2
  25. package/packages/skills/request/scripts/compare-scores.mjs +23 -11
  26. package/packages/skills/testsammanfattning/SKILL.md +134 -0
  27. package/packages/skills/testsammanfattning/references/konfiguration.md +110 -0
  28. package/packages/skills/testsammanfattning/scripts/test-log.mjs +218 -0
  29. package/packages/skills/testsammanfattning/scripts/test-summary.mjs +495 -0
  30. package/packages/templates/agentic-workflow-standard.md +1 -1
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/cli.ts
4
4
  import { readFileSync as readFileSync5 } from "node:fs";
5
- import path139 from "node:path";
5
+ import path140 from "node:path";
6
6
  import { Command, Option } from "commander";
7
7
 
8
8
  // src/commands/apply.ts
@@ -259,6 +259,16 @@ async function exists(abs) {
259
259
  if (await fs.pathExists(abs)) return true;
260
260
  return isSymlink(abs);
261
261
  }
262
+ async function identicalPlainFiles(fromAbs, toAbs) {
263
+ try {
264
+ const [from, to] = await Promise.all([fs.lstat(fromAbs), fs.lstat(toAbs)]);
265
+ if (!from.isFile() || !to.isFile() || from.size !== to.size) return false;
266
+ const [a, b] = await Promise.all([fs.readFile(fromAbs), fs.readFile(toAbs)]);
267
+ return a.equals(b);
268
+ } catch {
269
+ return false;
270
+ }
271
+ }
262
272
  async function trackedUnder(root, rel) {
263
273
  try {
264
274
  const result = await runGit(["ls-files", "--", rel], { cwd: root, timeout: 5e3 });
@@ -356,6 +366,33 @@ async function migrateRequestState(root, dryRun, notify) {
356
366
  );
357
367
  continue;
358
368
  }
369
+ if (await identicalPlainFiles(fromAbs, toAbs)) {
370
+ moved.push(move);
371
+ if (dryRun) {
372
+ notify(
373
+ `Would remove ${move.from}: ${move.to} already holds an identical copy, so nothing is lost.`
374
+ );
375
+ await reconcileIndex(root, move, true, notify);
376
+ continue;
377
+ }
378
+ const trackedBefore2 = await trackedUnder(root, move.from);
379
+ try {
380
+ await fs.remove(fromAbs);
381
+ } catch (error2) {
382
+ moved.pop();
383
+ const message = error2 instanceof Error ? error2.message : String(error2);
384
+ failures.push({ ...move, message });
385
+ notify(
386
+ `Could not remove ${move.from}, an identical copy of ${move.to}: ${message}. Delete it by hand, then re-run \`haus apply --write\`.`
387
+ );
388
+ continue;
389
+ }
390
+ notify(
391
+ `Removed ${move.from}: ${move.to} already held an identical copy, so request state now lives under \`${HAUS_DIR}/\` only.`
392
+ );
393
+ if (trackedBefore2.length > 0) await reconcileIndex(root, move, false, notify);
394
+ continue;
395
+ }
359
396
  if (await exists(toAbs)) {
360
397
  conflicts.push({ ...move, reason: "destination-exists" });
361
398
  notify(
@@ -501,11 +538,11 @@ async function lexists(file) {
501
538
  }
502
539
  }
503
540
  var LinkedTargetError = class extends Error {
504
- constructor(path140, target) {
541
+ constructor(path141, target) {
505
542
  super(
506
- `refused ${path140}: it is a symbolic link to ${target}, which haus does not replace with a file. Replace the link with a regular file, or edit ${target} directly, then run again.`
543
+ `refused ${path141}: it is a symbolic link to ${target}, which haus does not replace with a file. Replace the link with a regular file, or edit ${target} directly, then run again.`
507
544
  );
508
- this.path = path140;
545
+ this.path = path141;
509
546
  this.target = target;
510
547
  }
511
548
  path;
@@ -3824,8 +3861,8 @@ function buildDenyRules() {
3824
3861
  if (RUNTIME_ONLY_DENY_COMMANDS.includes(command)) continue;
3825
3862
  rules.push(`Bash(${command}:*)`);
3826
3863
  }
3827
- for (const path140 of DENY_PATHS) {
3828
- const pattern = DENY_DIRS.has(path140) ? `${path140}/**` : path140;
3864
+ for (const path141 of DENY_PATHS) {
3865
+ const pattern = DENY_DIRS.has(path141) ? `${path141}/**` : path141;
3829
3866
  for (const tool of FILE_TOOLS) {
3830
3867
  rules.push(`${tool}(${pattern})`);
3831
3868
  }
@@ -4498,7 +4535,14 @@ var decisions_triggers_default = {
4498
4535
  pathRegex: ["(^|/)src/.*/auth/", "(^|/)middleware/", "\\.env\\.example$"],
4499
4536
  minFilesChanged: 8,
4500
4537
  minLinesChanged: 200,
4501
- exemptGlobs: ["docs/**", "tests/**", "**/*.md", ".haus-workflow/**"],
4538
+ exemptGlobs: [
4539
+ "docs/**",
4540
+ "tests/**",
4541
+ "**/*.md",
4542
+ ".haus-workflow/**",
4543
+ ".claude/skills/**",
4544
+ ".claude/agents/**"
4545
+ ],
4502
4546
  requiredSections: ["## Context", "## Decision", "## Consequences"],
4503
4547
  recommendedSections: ["## Motivation (why)", "## Alternatives considered"],
4504
4548
  decisionFilePattern: "^\\d{4}-.+\\.md$"
@@ -9171,7 +9215,7 @@ async function retireLock(root, result) {
9171
9215
  result.lockRemoved = true;
9172
9216
  note(`Removed ${LOCK_FILE}: this project is on haus sync now.`);
9173
9217
  note(
9174
- `The old user-level haus setup is not used by haus sync. To remove it, run: ${USER_LEVEL_CLEANUP.join(", then ")}`
9218
+ `The old user-level haus setup is not used by haus sync, but a project still on ${LOCK_FILE} gets superpowers only from it. To remove it once every project you work in is on haus sync, run: ${USER_LEVEL_CLEANUP.join(", then ")}`
9175
9219
  );
9176
9220
  return result;
9177
9221
  }
@@ -10283,6 +10327,21 @@ async function resolveDecisionsDir(root) {
10283
10327
  function relativeDecisionPath(decisionsDir, root) {
10284
10328
  return path54.relative(root, decisionsDir).replace(/\\/g, "/");
10285
10329
  }
10330
+ async function keepsDecisionsLog(root, baseRef) {
10331
+ const dirs = [
10332
+ DECISIONS_TRIGGERS.decisionsDir,
10333
+ DECISIONS_TRIGGERS.legacyDecisionsDir ?? "docs/adr"
10334
+ ];
10335
+ for (const rel of dirs) {
10336
+ if (await fs24.pathExists(path54.join(root, rel))) return true;
10337
+ }
10338
+ if (!baseRef) return false;
10339
+ for (const rel of dirs) {
10340
+ const probe = await runGit(["cat-file", "-e", `${baseRef}:${rel}`], { cwd: root });
10341
+ if (probe.exitCode === 0) return true;
10342
+ }
10343
+ return false;
10344
+ }
10286
10345
 
10287
10346
  // src/decisions/validate.ts
10288
10347
  import path55 from "node:path";
@@ -11976,6 +12035,11 @@ var SUPERPOWERS_PATH = ".claude/skills/superpowers";
11976
12035
  function oldLockNotice(onSync) {
11977
12036
  return onSync ? { line: OLD_LOCK_LINE, fix: OLD_LOCK_FIX } : { line: LOCK_PROJECT_LINE, fix: LOCK_PROJECT_FIX };
11978
12037
  }
12038
+ var SUPERPOWERS_FROM_SYNC_NOTE = "superpowers (brainstorming, writing-plans and its other skills) comes from haus sync, so until then it loads only from an old user-level superpowers plugin";
12039
+ var SUPERPOWERS_MISSING_NOTE = "superpowers is not available here until then";
12040
+ async function superpowersPresent(root) {
12041
+ return lexists(path65.join(root, SUPERPOWERS_PATH));
12042
+ }
11979
12043
  async function oldLockPresent(root) {
11980
12044
  return lexists(path65.join(root, LOCK_FILE));
11981
12045
  }
@@ -12538,9 +12602,13 @@ async function runDoctor(options, deps = {}) {
12538
12602
  const lockNotice = oldLockNotice(onSync);
12539
12603
  if (!onSync) {
12540
12604
  if (await oldLockPresent(root)) {
12605
+ const superpowersMissing = pluginState.available && !await superpowersPresent(root) && !pluginState.installed.some(
12606
+ (plugin) => plugin.id.startsWith("superpowers@") && plugin.enabled !== false
12607
+ );
12608
+ const gap = superpowersMissing ? `; ${SUPERPOWERS_MISSING_NOTE}` : "";
12541
12609
  suggest(
12542
- `- LOCK: ${lockNotice.line}`,
12543
- "This project still uses haus.lock.json from before haus sync",
12610
+ `- LOCK: ${lockNotice.line}${gap}`,
12611
+ `This project still uses haus.lock.json from before haus sync${superpowersMissing ? `, and ${SUPERPOWERS_MISSING_NOTE}` : ""}`,
12544
12612
  lockNotice.fix
12545
12613
  );
12546
12614
  } else {
@@ -13264,7 +13332,10 @@ async function runFromHookCheck(root) {
13264
13332
  try {
13265
13333
  const sync = await resolveProjectSync(root);
13266
13334
  if (onHausSync(sync)) await syncFromHookCheck(root, sync);
13267
- else if (await oldLockPresent(root)) emitSessionStartContext(`${oldLockNotice(false).line}.`);
13335
+ else if (await oldLockPresent(root)) {
13336
+ const gap = await superpowersPresent(root) ? "" : `; ${SUPERPOWERS_FROM_SYNC_NOTE}`;
13337
+ emitSessionStartContext(`${oldLockNotice(false).line}${gap}.`);
13338
+ }
13268
13339
  } catch {
13269
13340
  }
13270
13341
  }
@@ -14428,16 +14499,16 @@ var WRITES_ONLY_WHERE_SENT = /* @__PURE__ */ new Set([
14428
14499
  "tee",
14429
14500
  "wc"
14430
14501
  ]);
14431
- function plainPath(path140) {
14432
- return path140.replace(/^(?:\.\/+)+/, "");
14502
+ function plainPath(path141) {
14503
+ return path141.replace(/^(?:\.\/+)+/, "");
14433
14504
  }
14434
- function folded(path140) {
14435
- return path140.normalize("NFKC").toLowerCase();
14505
+ function folded(path141) {
14506
+ return path141.normalize("NFKC").toLowerCase();
14436
14507
  }
14437
14508
  var NOT_PRINTABLE_ASCII = /[^ -~]/;
14438
- function mayBeControlFile(path140) {
14439
- const plain2 = folded(path140);
14440
- return NOT_PRINTABLE_ASCII.test(path140) || GIT_CONTROL_FILE.test(plain2) || GH_CONTROL_FILE.test(plain2);
14509
+ function mayBeControlFile(path141) {
14510
+ const plain2 = folded(path141);
14511
+ return NOT_PRINTABLE_ASCII.test(path141) || GIT_CONTROL_FILE.test(plain2) || GH_CONTROL_FILE.test(plain2);
14441
14512
  }
14442
14513
  var NOTE_EXTENSION = /\.(?:md|markdown|txt)$/;
14443
14514
  function everyWrittenFile(segment) {
@@ -15189,6 +15260,7 @@ async function runDecisionsGuard(options = {}) {
15189
15260
  async function guardRepository(root) {
15190
15261
  const baseRef = await resolveBaseRef(root);
15191
15262
  if (!baseRef) return false;
15263
+ if (!await keepsDecisionsLog(root, baseRef)) return false;
15192
15264
  const range = `${baseRef}...HEAD`;
15193
15265
  const commitMessages = await readCommitMessages(root, range);
15194
15266
  const result = await runDecisionsCheck(root, { range, commitMessages });
@@ -16091,7 +16163,9 @@ async function writeReceipt(receipt, dir = verifyDir()) {
16091
16163
  async function patchIdOfDiff(git, cwd, diff) {
16092
16164
  if (diff.trim() === "") return void 0;
16093
16165
  try {
16094
- const result = await git(["patch-id", "--verbatim"], { cwd, input: diff });
16166
+ const input2 = diff.endsWith("\n") ? diff : `${diff}
16167
+ `;
16168
+ const result = await git(["patch-id", "--verbatim"], { cwd, input: input2 });
16095
16169
  if (result.exitCode !== 0) return void 0;
16096
16170
  const id = result.stdout.split("\n")[0]?.trim().split(/\s+/)[0];
16097
16171
  return id && HEX_ID.test(id) ? id.toLowerCase() : void 0;
@@ -16886,6 +16960,22 @@ function hausUnfreeze(words, base) {
16886
16960
  return { kind: "unfreeze", ...base, repo: operands[2] };
16887
16961
  }
16888
16962
  var DEPLOY_SET_VALUE_FLAGS = /* @__PURE__ */ new Set(["--surface", "--local-check"]);
16963
+ var DEPLOY_SET_BOOLEAN_FLAGS = /* @__PURE__ */ new Set(["--lower", "--json", "-h", "--help"]);
16964
+ function asksForHelp(args, valueFlags, booleanFlags) {
16965
+ for (let i = 0; i < args.length; i += 1) {
16966
+ const word = args[i];
16967
+ if (word === "--") return false;
16968
+ if (word === "-h" || word === "--help") return true;
16969
+ if (!word.startsWith("-")) continue;
16970
+ const name = word.includes("=") ? word.slice(0, word.indexOf("=")) : word;
16971
+ if (valueFlags.has(name)) {
16972
+ if (!word.includes("=")) i += 1;
16973
+ } else if (!booleanFlags.has(name)) {
16974
+ return false;
16975
+ }
16976
+ }
16977
+ return false;
16978
+ }
16889
16979
  function hausDeploySet(words, base) {
16890
16980
  const args = hausCliArgs(words);
16891
16981
  if (!args) return void 0;
@@ -16898,6 +16988,7 @@ function hausDeploySet(words, base) {
16898
16988
  else if (!word.startsWith("-")) operands.push(word);
16899
16989
  }
16900
16990
  if (operands[0] !== "deploy" || operands[1] !== "set") return void 0;
16991
+ if (asksForHelp(args, DEPLOY_SET_VALUE_FLAGS, DEPLOY_SET_BOOLEAN_FLAGS)) return void 0;
16901
16992
  return { kind: "deploy-set", ...base, branch: operands[2], deploys: operands[3], lower };
16902
16993
  }
16903
16994
  var RELEASE_VALUE_FLAGS = /* @__PURE__ */ new Set([
@@ -16934,6 +17025,7 @@ function releaseSubcommands(args) {
16934
17025
  function hausReleaseActions(words, base) {
16935
17026
  const args = hausCliArgs(words);
16936
17027
  if (!args) return [];
17028
+ if (asksForHelp(args, RELEASE_VALUE_FLAGS, RELEASE_BOOLEAN_FLAGS)) return [];
16937
17029
  return releaseSubcommands(args).map((shape) => {
16938
17030
  if (shape === "tag") return { kind: "release-tag", ...base };
16939
17031
  if (shape === "init") return { kind: "release-init", ...base, lower: args.includes("--lower") };
@@ -21639,11 +21731,34 @@ function releaseBranchName(date) {
21639
21731
  if (!valid) throw new Error(`Release date must be a real YYYY-MM-DD date, got "${date}"`);
21640
21732
  return `release/${date}`;
21641
21733
  }
21734
+ function releaseNumber(branch) {
21735
+ const match = /^release[/-](\d+)$/.exec(branch);
21736
+ return match ? Number(match[1]) : null;
21737
+ }
21738
+ function nextNumberedReleaseBranch(branches) {
21739
+ let highest = 0;
21740
+ for (const branch of branches) {
21741
+ const n = releaseNumber(branch);
21742
+ if (n !== null) highest = Math.max(highest, n);
21743
+ }
21744
+ return `release/${highest + 1}`;
21745
+ }
21746
+ function compareReleaseBranches(a, b) {
21747
+ const rank = (name) => {
21748
+ if (/^release\/\d+$/.test(name)) return 2;
21749
+ if (/^release\/\d{4}-\d{2}-\d{2}$/.test(name)) return 1;
21750
+ return 0;
21751
+ };
21752
+ const byRank = rank(a) - rank(b);
21753
+ if (byRank !== 0) return byRank;
21754
+ if (rank(a) === 2) return (releaseNumber(a) ?? 0) - (releaseNumber(b) ?? 0);
21755
+ return a < b ? -1 : a > b ? 1 : 0;
21756
+ }
21642
21757
  async function openReleaseBranch(git, cwd, remote = "origin") {
21643
21758
  const prefix = `refs/remotes/${remote}/`;
21644
21759
  const result = await git(["for-each-ref", "--format=%(refname)", `${prefix}release/`], { cwd });
21645
21760
  if (result.exitCode !== 0) return null;
21646
- const names5 = result.stdout.split("\n").map((line2) => line2.trim()).filter((line2) => line2.startsWith(`${prefix}release/`)).map((line2) => line2.slice(prefix.length)).sort();
21761
+ const names5 = result.stdout.split("\n").map((line2) => line2.trim()).filter((line2) => line2.startsWith(`${prefix}release/`)).map((line2) => line2.slice(prefix.length)).sort(compareReleaseBranches);
21647
21762
  return names5.length > 0 ? names5[names5.length - 1] : null;
21648
21763
  }
21649
21764
  function nextReleaseTag(existing, now) {
@@ -25757,12 +25872,19 @@ async function fetchRemote(deps, remote) {
25757
25872
  function failedWith(what, err) {
25758
25873
  return `${what}: ${firstLine3(err instanceof Error ? err.message : String(err), "unknown error")}`;
25759
25874
  }
25760
- async function releaseStart(date, deps) {
25761
- let branch;
25762
- try {
25763
- branch = releaseBranchName(date);
25764
- } catch (err) {
25765
- return { ok: false, refused: err.message };
25875
+ async function remoteBranches(deps, remote) {
25876
+ const listed = await gitOut2(deps, ["ls-remote", "--heads", remote]);
25877
+ if (listed === void 0) return void 0;
25878
+ return listed.split("\n").map((line2) => line2.trim().split(/\s+/)[1] ?? "").filter((ref) => ref.startsWith("refs/heads/")).map((ref) => ref.slice("refs/heads/".length));
25879
+ }
25880
+ async function releaseStart(opts, deps) {
25881
+ let dated;
25882
+ if (opts.date !== void 0) {
25883
+ try {
25884
+ dated = releaseBranchName(opts.date);
25885
+ } catch (err) {
25886
+ return { ok: false, refused: err.message };
25887
+ }
25766
25888
  }
25767
25889
  const ctx = await repoContext(deps.cwd, deps.git);
25768
25890
  if (!ctx) return { ok: false, refused: `not a git repository: ${deps.cwd}` };
@@ -25776,11 +25898,13 @@ async function releaseStart(date, deps) {
25776
25898
  "--quiet",
25777
25899
  `refs/remotes/${remote}/${from}^{commit}`
25778
25900
  ]);
25779
- if (!sha2) return { ok: false, refused: `no ${remote}/${from} to cut ${branch} from` };
25780
- const listed = await gitOut2(deps, ["ls-remote", "--heads", remote, `refs/heads/${branch}`]);
25781
- if (listed === void 0)
25901
+ const branches = await remoteBranches(deps, remote);
25902
+ if (branches === void 0)
25782
25903
  return { ok: false, refused: `could not list the branches of ${remote}` };
25783
- if (listed !== "") return { ok: false, refused: `${branch} already exists on ${remote}` };
25904
+ const branch = dated ?? nextNumberedReleaseBranch(branches);
25905
+ if (!sha2) return { ok: false, refused: `no ${remote}/${from} to cut ${branch} from` };
25906
+ if (branches.includes(branch))
25907
+ return { ok: false, refused: `${branch} already exists on ${remote}` };
25784
25908
  const loaded = await loadDeployConfig(ctx, {
25785
25909
  git: deps.git,
25786
25910
  gh: deps.gh,
@@ -25795,6 +25919,7 @@ async function releaseStart(date, deps) {
25795
25919
  refused: `${held}. haus release start pushes ${branch} inside haus, where the guard cannot judge it; push it by hand (git push ${remote} ${from}:refs/heads/${branch}) so the guard can.`
25796
25920
  };
25797
25921
  }
25922
+ if (opts.dryRun) return { ok: true, dryRun: true, branch, sha: sha2, from };
25798
25923
  const pushed = await deps.git(["push", "--quiet", remote, `${sha2}:refs/heads/${branch}`], {
25799
25924
  cwd: deps.cwd,
25800
25925
  timeoutMs: PUSH_TIMEOUT_MS
@@ -26436,7 +26561,7 @@ async function releaseShip(deps) {
26436
26561
  mergeCommand: mergeCommandFor(number2)
26437
26562
  };
26438
26563
  }
26439
- const date = release2.slice("release/".length);
26564
+ const name = release2.slice("release/".length);
26440
26565
  const created = await withBodyFile(
26441
26566
  body,
26442
26567
  (bodyFile) => deps.gh(
@@ -26450,7 +26575,7 @@ async function releaseShip(deps) {
26450
26575
  "--head",
26451
26576
  release2,
26452
26577
  "--title",
26453
- `release: ${date}`,
26578
+ `release: ${name}`,
26454
26579
  "--body-file",
26455
26580
  bodyFile
26456
26581
  ],
@@ -26668,10 +26793,12 @@ async function releaseDeployTag(tag, deps, say) {
26668
26793
 
26669
26794
  // src/commands/release.ts
26670
26795
  async function runReleaseStart(date, opts, deps = realDeps()) {
26671
- const result = await releaseStart(date ?? today(), deps);
26796
+ const dated = date ?? (opts.date ? today() : void 0);
26797
+ const result = await releaseStart({ date: dated, dryRun: opts.dryRun }, deps);
26672
26798
  if (opts.json) log(JSON.stringify(result, null, 2));
26673
26799
  else if (result.ok) {
26674
- log(`Pushed ${result.branch} at ${result.sha.slice(0, 7)}, cut from ${result.from}.`);
26800
+ const verb = result.dryRun ? "Would push" : "Pushed";
26801
+ log(`${verb} ${result.branch} at ${result.sha.slice(0, 7)}, cut from ${result.from}.`);
26675
26802
  } else error(`haus release start: ${result.refused}`);
26676
26803
  if (!result.ok) process.exitCode = 1;
26677
26804
  }
@@ -26937,17 +27064,21 @@ var DEFAULT_SESSION_LABELS = {
26937
27064
  WEBB: "\u{1F7E6}",
26938
27065
  CELL: "\u{1F7E9}",
26939
27066
  DATA: "\u{1F7E5}",
26940
- HEMD: "\u{1F7E8}",
27067
+ HEMD: "\u{1F366}",
26941
27068
  BADD: "\u{1F7E7}",
26942
- VAFA: "\u{1F7E2}",
27069
+ VAFA: "\u267B\uFE0F",
26943
27070
  REV\u00C4: "\u{1F7EA}",
26944
27071
  FIBD: "\u{1F535}",
26945
27072
  M2AB: "\u{1F7EB}",
26946
27073
  FAST: "\u{1F7E0}",
26947
- THIN: "\u{1F7E3}",
27074
+ THIN: "\u{1F455}",
26948
27075
  INPE: "\u{1F534}",
26949
27076
  RIKS: "\u{1F7E1}",
26950
27077
  CARE: "\u2B1C"
27078
+ },
27079
+ folderColors: {
27080
+ TimTracker: "\u{1F550}",
27081
+ Brain: "\u{1F9E0}"
26951
27082
  }
26952
27083
  };
26953
27084
 
@@ -26976,7 +27107,8 @@ async function loadSessionLabelsConfig(claudeDir) {
26976
27107
  fallbackColor: text(user.fallbackColor, DEFAULT_SESSION_LABELS.fallbackColor),
26977
27108
  repos: { ...DEFAULT_SESSION_LABELS.repos, ...stringMap(user.repos, true) },
26978
27109
  folders: { ...DEFAULT_SESSION_LABELS.folders, ...stringMap(user.folders) },
26979
- colors: { ...DEFAULT_SESSION_LABELS.colors, ...stringMap(user.colors) }
27110
+ colors: { ...DEFAULT_SESSION_LABELS.colors, ...stringMap(user.colors) },
27111
+ folderColors: { ...DEFAULT_SESSION_LABELS.folderColors, ...stringMap(user.folderColors) }
26980
27112
  };
26981
27113
  }
26982
27114
  function repoKeyFromRemote(url) {
@@ -27007,18 +27139,16 @@ function labelFor(cwd, config, remote = originRemote, home = os14.homedir()) {
27007
27139
  const repo = url ? repoKeyFromRemote(url) : void 0;
27008
27140
  let code2;
27009
27141
  let source = "default";
27142
+ const folder = projectFolder(cwd, home);
27010
27143
  if (repo && config.repos[repo]) {
27011
27144
  code2 = config.repos[repo];
27012
27145
  source = "repo";
27013
- } else {
27014
- const folder = projectFolder(cwd, home);
27015
- if (folder && config.folders[folder]) {
27016
- code2 = config.folders[folder];
27017
- source = "folder";
27018
- }
27146
+ } else if (folder && config.folders[folder]) {
27147
+ code2 = config.folders[folder];
27148
+ source = "folder";
27019
27149
  }
27020
27150
  code2 ??= config.default;
27021
- const color = config.colors[code2] ?? config.fallbackColor;
27151
+ const color = config.folderColors[folder] ?? config.colors[code2] ?? config.fallbackColor;
27022
27152
  return { label: `${color} ${code2}`, code: code2, source };
27023
27153
  }
27024
27154
  function desktopContext(label, title) {
@@ -27144,7 +27274,9 @@ async function syncMember(dir, opts, rootProfile, deps) {
27144
27274
  message: "no haus.json in this project"
27145
27275
  };
27146
27276
  }
27147
- if (!await lexists(dir)) return skip(`${dir} does not exist; clone it, then run haus sync`);
27277
+ if (!await lexists(dir)) {
27278
+ return { ...skip(`${dir} does not exist; clone it, then run haus sync`), missing: true };
27279
+ }
27148
27280
  if (!await isOwnRepo(dir)) return skip(`${dir} is not a git repo of its own, so it was skipped`);
27149
27281
  const synced = await runSync(dir, opts, deps);
27150
27282
  if (synced.status !== "synced" && synced.status !== "up-to-date") return synced;
@@ -27248,6 +27380,7 @@ async function runSyncCommand(opts = {}, io = processIo) {
27248
27380
  `);
27249
27381
  let out;
27250
27382
  let workspace2;
27383
+ let linkedWorktree = false;
27251
27384
  try {
27252
27385
  let start = opts.cwd;
27253
27386
  if (start === void 0 && sessionHook) {
@@ -27256,6 +27389,7 @@ async function runSyncCommand(opts = {}, io = processIo) {
27256
27389
  }
27257
27390
  start ??= process.cwd();
27258
27391
  const roots = await resolveRoots(start);
27392
+ linkedWorktree = roots.isLinkedWorktree;
27259
27393
  if (!roots.isGitRepo) {
27260
27394
  if (hook) return 0;
27261
27395
  if (opts.json === true) return jsonFail("not a git repository");
@@ -27333,7 +27467,14 @@ async function runSyncCommand(opts = {}, io = processIo) {
27333
27467
  `);
27334
27468
  return code2;
27335
27469
  }
27470
+ const missing = rows2.filter(([where, o]) => where !== "" && o.missing === true);
27471
+ if (missing.length > 1) {
27472
+ const names5 = missing.map(([where]) => where).join(", ");
27473
+ const way = linkedWorktree ? "run haus workspace worktree hydrate --materialize to check them out here, then haus sync" : "clone them, then run haus sync";
27474
+ say(`haus sync: skipped, ${missing.length} member folders do not exist (${names5}); ${way}`);
27475
+ }
27336
27476
  for (const [where, o] of rows2) {
27477
+ if (missing.length > 1 && where !== "" && o.missing === true) continue;
27337
27478
  printMigration(o, where);
27338
27479
  printSyncNotes(o, where);
27339
27480
  const text = failureText(o);
@@ -27931,7 +28072,9 @@ async function runUninstallCommand(options) {
27931
28072
  }
27932
28073
 
27933
28074
  // src/deploy/verify-local.ts
28075
+ import path111 from "node:path";
27934
28076
  import { execa as execa4 } from "execa";
28077
+ import fs55 from "fs-extra";
27935
28078
  var TAIL_LINES = 40;
27936
28079
  function verificationSection(lines) {
27937
28080
  const headings = LOCAL_VERIFICATION_HEADINGS.map((h) => h.toLowerCase());
@@ -28004,6 +28147,15 @@ async function readPullRequest(gh, cwd, pr2) {
28004
28147
  return `gh pr view returned something other than JSON for PR #${pr2}`;
28005
28148
  }
28006
28149
  }
28150
+ async function hasDeployFile(git, context, baseRef) {
28151
+ for (const root of /* @__PURE__ */ new Set([context.root, context.mainRoot])) {
28152
+ if (await fs55.pathExists(path111.join(root, DEPLOY_CONFIG_REL))) return true;
28153
+ }
28154
+ const shown = await git(["cat-file", "-e", `${baseRef}:${DEPLOY_CONFIG_REL}`], {
28155
+ cwd: context.root
28156
+ });
28157
+ return shown.exitCode === 0;
28158
+ }
28007
28159
  async function verifyLocal(options) {
28008
28160
  const now = options.now ?? (() => /* @__PURE__ */ new Date());
28009
28161
  const context = await repoContext(options.cwd, options.git);
@@ -28034,6 +28186,12 @@ async function verifyLocal(options) {
28034
28186
  const patchId = await patchIdOf(options.git, context.root, baseRef, head);
28035
28187
  const loaded = await loadDeployConfig(context, { git: options.git, branch });
28036
28188
  const command = branchEntry(loaded.config, branch)?.entry.localCheck?.trim();
28189
+ if (!command && !await hasDeployFile(options.git, context, `${context.remote}/${branch}`)) {
28190
+ return {
28191
+ ok: false,
28192
+ refused: `no .haus-workflow/deploy.json in this repository, so ${branch} has no localCheck: run haus apply --write (it writes the file from detection), then haus deploy set ${branch} none --local-check "<the command that exercises the change, for example yarn build && yarn test>" (use the class ${branch} deploys if it deploys anything), commit .haus-workflow/deploy.json, then run this again`
28193
+ };
28194
+ }
28037
28195
  if (!command) {
28038
28196
  return {
28039
28197
  ok: false,
@@ -28147,8 +28305,8 @@ async function runVerifyLocal(options) {
28147
28305
 
28148
28306
  // src/commands/workspace/env.ts
28149
28307
  import { existsSync as existsSync12 } from "node:fs";
28150
- import fs55 from "node:fs/promises";
28151
- import path111 from "node:path";
28308
+ import fs56 from "node:fs/promises";
28309
+ import path112 from "node:path";
28152
28310
 
28153
28311
  // src/workspace/env/gc.ts
28154
28312
  import { existsSync as existsSync11 } from "node:fs";
@@ -28749,12 +28907,12 @@ async function handlePatchWpConfig(opts) {
28749
28907
  if (site.config?.kind !== "wp-config-override") {
28750
28908
  return fail3(opts, `Site "${opts.name}" has no config of kind wp-config-override.`);
28751
28909
  }
28752
- const docroot = path111.resolve(ctx.workspaceRoot, site.root);
28910
+ const docroot = path112.resolve(ctx.workspaceRoot, site.root);
28753
28911
  const keys = Object.keys(site.config.defines);
28754
28912
  if (opts.dryRun) {
28755
- const file = path111.join(docroot, WP_CONFIG_FILE);
28913
+ const file = path112.join(docroot, WP_CONFIG_FILE);
28756
28914
  if (!existsSync12(file)) return fail3(opts, `${file} does not exist.`);
28757
- const p = patchWpConfigSource(await fs55.readFile(file, "utf8"), keys);
28915
+ const p = patchWpConfigSource(await fs56.readFile(file, "utf8"), keys);
28758
28916
  const doc = {
28759
28917
  ok: true,
28760
28918
  dryRun: true,
@@ -28829,17 +28987,17 @@ async function runEnv(action, opts = {}) {
28829
28987
  }
28830
28988
 
28831
28989
  // src/workspace/worktree/add.ts
28832
- import path118 from "node:path";
28833
- import fs59 from "fs-extra";
28990
+ import path119 from "node:path";
28991
+ import fs60 from "fs-extra";
28834
28992
 
28835
28993
  // src/workspace/worktree/git-worktree.ts
28836
- import path112 from "node:path";
28994
+ import path113 from "node:path";
28837
28995
  var REPO_LOCK_TIMEOUT_MS = 5 * 60 * 1e3;
28838
28996
  async function withRepoWorktreeLock(cwd, fn) {
28839
28997
  const common = await runGit(["rev-parse", "--git-common-dir"], { cwd });
28840
28998
  if (common.exitCode !== 0 || !common.stdout.trim()) return fn();
28841
- const dir = path112.resolve(cwd, common.stdout.trim());
28842
- return withPortsLock(path112.join(dir, "haus-worktree"), fn, {
28999
+ const dir = path113.resolve(cwd, common.stdout.trim());
29000
+ return withPortsLock(path113.join(dir, "haus-worktree"), fn, {
28843
29001
  label: `git worktrees in ${cwd}`,
28844
29002
  lockTimeoutMs: REPO_LOCK_TIMEOUT_MS,
28845
29003
  staleMs: Infinity
@@ -28968,12 +29126,12 @@ async function hasUnpushedWork(cwd) {
28968
29126
  }
28969
29127
 
28970
29128
  // src/workspace/worktree/hydrate.ts
28971
- import path115 from "node:path";
28972
- import fs57 from "fs-extra";
29129
+ import path116 from "node:path";
29130
+ import fs58 from "fs-extra";
28973
29131
 
28974
29132
  // src/workspace/worktree/cow-copy.ts
28975
- import path113 from "node:path";
28976
- import fs56 from "fs-extra";
29133
+ import path114 from "node:path";
29134
+ import fs57 from "fs-extra";
28977
29135
  async function getMacFilesystemType(dir) {
28978
29136
  const df = await runCommand("df", ["-P", dir]);
28979
29137
  if (df.exitCode !== 0) return void 0;
@@ -29004,14 +29162,14 @@ async function detectCowStrategy(dir) {
29004
29162
  return "unknown-platform";
29005
29163
  }
29006
29164
  async function cowCopyDir(src, dest) {
29007
- const srcExists = await fs56.pathExists(src);
29165
+ const srcExists = await fs57.pathExists(src);
29008
29166
  if (!srcExists)
29009
29167
  return { strategy: "unsupported", attempted: false, ok: false, error: "source missing" };
29010
- const strategy = await detectCowStrategy(path113.dirname(dest));
29168
+ const strategy = await detectCowStrategy(path114.dirname(dest));
29011
29169
  if (strategy === "unsupported" || strategy === "unknown-platform") {
29012
29170
  return { strategy, attempted: false, ok: false };
29013
29171
  }
29014
- await fs56.ensureDir(path113.dirname(dest));
29172
+ await fs57.ensureDir(path114.dirname(dest));
29015
29173
  const args = strategy === "darwin-clonefile" ? ["-c", "-R", src, dest] : ["-a", "--reflink=always", src, dest];
29016
29174
  const result = await runCommand("cp", args);
29017
29175
  return {
@@ -29024,7 +29182,7 @@ async function cowCopyDir(src, dest) {
29024
29182
 
29025
29183
  // src/workspace/worktree/install.ts
29026
29184
  import { existsSync as existsSync13, readFileSync as readFileSync4 } from "node:fs";
29027
- import path114 from "node:path";
29185
+ import path115 from "node:path";
29028
29186
  import fg6 from "fast-glob";
29029
29187
  function detectInstallPlan(signals) {
29030
29188
  const js = pickJsManager(signals);
@@ -29088,19 +29246,19 @@ function detectExtraInstallPlans(signals, primary) {
29088
29246
  }
29089
29247
  var JS_MANAGERS = ["yarn", "pnpm", "npm"];
29090
29248
  function nodeModulesInstalledWith(dir) {
29091
- const nm = path114.join(dir, "node_modules");
29249
+ const nm = path115.join(dir, "node_modules");
29092
29250
  const found = [];
29093
- if (existsSync13(path114.join(nm, ".yarn-integrity")) || existsSync13(path114.join(nm, ".yarn-state.yml")))
29251
+ if (existsSync13(path115.join(nm, ".yarn-integrity")) || existsSync13(path115.join(nm, ".yarn-state.yml")))
29094
29252
  found.push("yarn");
29095
- if (existsSync13(path114.join(nm, ".modules.yaml"))) found.push("pnpm");
29096
- if (existsSync13(path114.join(nm, ".package-lock.json"))) found.push("npm");
29253
+ if (existsSync13(path115.join(nm, ".modules.yaml"))) found.push("pnpm");
29254
+ if (existsSync13(path115.join(nm, ".package-lock.json"))) found.push("npm");
29097
29255
  return found.length === 1 ? found[0] : void 0;
29098
29256
  }
29099
29257
  async function computeLockfileSignals(dir, opts = {}) {
29100
- const hasYarnLock = existsSync13(path114.join(dir, "yarn.lock"));
29101
- const hasPnpmLock = existsSync13(path114.join(dir, "pnpm-lock.yaml"));
29102
- const hasPackageLock = existsSync13(path114.join(dir, "package-lock.json"));
29103
- const hasComposerLock = existsSync13(path114.join(dir, "composer.lock"));
29258
+ const hasYarnLock = existsSync13(path115.join(dir, "yarn.lock"));
29259
+ const hasPnpmLock = existsSync13(path115.join(dir, "pnpm-lock.yaml"));
29260
+ const hasPackageLock = existsSync13(path115.join(dir, "package-lock.json"));
29261
+ const hasComposerLock = existsSync13(path115.join(dir, "composer.lock"));
29104
29262
  const dotnetFiles = await fg6(["**/*.csproj", "**/*.sln"], {
29105
29263
  cwd: dir,
29106
29264
  onlyFiles: true,
@@ -29115,7 +29273,7 @@ async function computeLockfileSignals(dir, opts = {}) {
29115
29273
  const hasDotnetProject = dotnetFiles.length > 0;
29116
29274
  let hasPackageManagerField = false;
29117
29275
  let packageManagerName;
29118
- const pkgPath = path114.join(dir, "package.json");
29276
+ const pkgPath = path115.join(dir, "package.json");
29119
29277
  if (existsSync13(pkgPath)) {
29120
29278
  try {
29121
29279
  const pkg = JSON.parse(readFileSync4(pkgPath, "utf8"));
@@ -29138,8 +29296,8 @@ async function computeLockfileSignals(dir, opts = {}) {
29138
29296
  dotnetProjects: [...dotnetFiles].sort(),
29139
29297
  ...packageManagerName ? { packageManagerName } : {},
29140
29298
  ...installedWith ? { installedWith } : {},
29141
- hasComposerJson: existsSync13(path114.join(dir, "composer.json")),
29142
- hasVendorDir: existsSync13(path114.join(dir, "vendor"))
29299
+ hasComposerJson: existsSync13(path115.join(dir, "composer.json")),
29300
+ hasVendorDir: existsSync13(path115.join(dir, "vendor"))
29143
29301
  };
29144
29302
  }
29145
29303
  var INSTALL_OUTPUT_CAP = 8192;
@@ -29168,7 +29326,7 @@ function missingYarnrcEnvVars(content2, env) {
29168
29326
  return findRequiredYarnrcEnvVars(content2).filter((name) => env[name] === void 0);
29169
29327
  }
29170
29328
  function missingYarnrcEnvVarsInDir(dir, env) {
29171
- const yarnrcPath = path114.join(dir, ".yarnrc.yml");
29329
+ const yarnrcPath = path115.join(dir, ".yarnrc.yml");
29172
29330
  if (!existsSync13(yarnrcPath)) return [];
29173
29331
  try {
29174
29332
  return missingYarnrcEnvVars(readFileSync4(yarnrcPath, "utf8"), env);
@@ -29301,10 +29459,10 @@ async function hydrateMember(mainMemberPath, worktreeMemberPath, opts = {}) {
29301
29459
  const targets = [];
29302
29460
  const refusedTargets = [];
29303
29461
  for (const target of HYDRATION_TARGETS) {
29304
- const src = path115.join(mainMemberPath, target);
29305
- const dest = path115.join(worktreeMemberPath, target);
29306
- if (!await fs57.pathExists(src)) continue;
29307
- const destExists = await fs57.pathExists(dest);
29462
+ const src = path116.join(mainMemberPath, target);
29463
+ const dest = path116.join(worktreeMemberPath, target);
29464
+ if (!await fs58.pathExists(src)) continue;
29465
+ const destExists = await fs58.pathExists(dest);
29308
29466
  if (!opts.force && destExists) continue;
29309
29467
  if (opts.force && destExists) {
29310
29468
  const refusal2 = await replaceRefusal(worktreeMemberPath, target);
@@ -29312,7 +29470,7 @@ async function hydrateMember(mainMemberPath, worktreeMemberPath, opts = {}) {
29312
29470
  refusedTargets.push({ target, path: dest, reason: refusal2 });
29313
29471
  continue;
29314
29472
  }
29315
- await fs57.remove(dest);
29473
+ await fs58.remove(dest);
29316
29474
  }
29317
29475
  const copy = await cowCopyDir(src, dest);
29318
29476
  targets.push({ target, copy });
@@ -29352,11 +29510,11 @@ async function hydrateMember(mainMemberPath, worktreeMemberPath, opts = {}) {
29352
29510
  }
29353
29511
 
29354
29512
  // src/workspace/worktree/local-files.ts
29355
- import path116 from "node:path";
29356
- import fs58 from "fs-extra";
29513
+ import path117 from "node:path";
29514
+ import fs59 from "fs-extra";
29357
29515
  var MACHINE_LOCAL_FILES = [
29358
29516
  "docker-compose.local.yml",
29359
- path116.join(".claude", "settings.local.json")
29517
+ path117.join(".claude", "settings.local.json")
29360
29518
  ];
29361
29519
  async function isTracked(repoRoot, relFile) {
29362
29520
  const gitPath = relFile.replace(/\\/g, "/");
@@ -29372,7 +29530,7 @@ async function copyLocalFiles(mainMemberPath, worktreeMemberPath, relPaths, opts
29372
29530
  result.skipped.push({ path: rel, reason: "outside-repo" });
29373
29531
  continue;
29374
29532
  }
29375
- if (!await fs58.pathExists(src)) {
29533
+ if (!await fs59.pathExists(src)) {
29376
29534
  result.skipped.push({ path: rel, reason: "missing" });
29377
29535
  continue;
29378
29536
  }
@@ -29380,9 +29538,9 @@ async function copyLocalFiles(mainMemberPath, worktreeMemberPath, relPaths, opts
29380
29538
  result.skipped.push({ path: rel, reason: "tracked" });
29381
29539
  continue;
29382
29540
  }
29383
- await fs58.ensureDir(path116.dirname(dest));
29384
- await fs58.copy(src, dest, { overwrite: true });
29385
- if (opts.mode !== void 0) await fs58.chmod(dest, opts.mode);
29541
+ await fs59.ensureDir(path117.dirname(dest));
29542
+ await fs59.copy(src, dest, { overwrite: true });
29543
+ if (opts.mode !== void 0) await fs59.chmod(dest, opts.mode);
29386
29544
  result.copied.push(rel);
29387
29545
  }
29388
29546
  return result;
@@ -29406,10 +29564,10 @@ function selectMembers(members, only) {
29406
29564
  }
29407
29565
 
29408
29566
  // src/workspace/worktree/sync.ts
29409
- import path117 from "node:path";
29567
+ import path118 from "node:path";
29410
29568
  async function syncWorktree(wtPath, members, net2 = {}) {
29411
29569
  const lists = await Promise.all(
29412
- [wtPath, ...members.map((m) => path117.join(wtPath, m.folder))].map(hausJsonPresent)
29570
+ [wtPath, ...members.map((m) => path118.join(wtPath, m.folder))].map(hausJsonPresent)
29413
29571
  );
29414
29572
  if (!lists.some(Boolean)) return void 0;
29415
29573
  let ws;
@@ -29482,7 +29640,7 @@ async function runAdd(opts) {
29482
29640
  }
29483
29641
  const branch = opts.branch ?? opts.slug;
29484
29642
  const wsWorktreePath = worktreePath(workspaceRoot, opts.slug);
29485
- if (await fs59.pathExists(wsWorktreePath)) {
29643
+ if (await fs60.pathExists(wsWorktreePath)) {
29486
29644
  return {
29487
29645
  ok: false,
29488
29646
  error: `Workspace worktree already exists at ${wsWorktreePath}. Run \`haus workspace worktree hydrate --materialize\` from inside it to check out any missing members (e.g. a worktree created by plain \`git worktree add\`), or \`remove\` first to start over.`
@@ -29501,7 +29659,7 @@ async function runAdd(opts) {
29501
29659
  const memberResults = [];
29502
29660
  for (const member of selected2) {
29503
29661
  const start = Date.now();
29504
- const memberWorktreePath = path118.join(wsWorktreePath, member.folder);
29662
+ const memberWorktreePath = path119.join(wsWorktreePath, member.folder);
29505
29663
  const outcome2 = await addWorktree2(member.absPath, memberWorktreePath, branch, {
29506
29664
  preferDefaultBranchFrom: true
29507
29665
  });
@@ -29531,7 +29689,7 @@ async function runAdd(opts) {
29531
29689
  await mapWithConcurrency(okResults, async (result) => {
29532
29690
  const member = selected2.find((m) => m.id === result.member);
29533
29691
  if (!member) return;
29534
- const memberWorktreePath = path118.join(wsWorktreePath, member.folder);
29692
+ const memberWorktreePath = path119.join(wsWorktreePath, member.folder);
29535
29693
  const hydrationStart = Date.now();
29536
29694
  if (opts.hydrate !== false) {
29537
29695
  result.hydration = await hydrateMember(member.absPath, memberWorktreePath);
@@ -29604,15 +29762,15 @@ async function runDryRun(args) {
29604
29762
  // src/workspace/worktree/autohydrate.ts
29605
29763
  import { spawn as spawn4 } from "node:child_process";
29606
29764
  import fsSync from "node:fs";
29607
- import path124 from "node:path";
29608
- import fs60 from "fs-extra";
29765
+ import path125 from "node:path";
29766
+ import fs61 from "fs-extra";
29609
29767
 
29610
29768
  // src/workspace/worktree/doctor.ts
29611
29769
  import { existsSync as existsSync15 } from "node:fs";
29612
- import path121 from "node:path";
29770
+ import path122 from "node:path";
29613
29771
 
29614
29772
  // src/workspace/worktree/hydrate-lock.ts
29615
- import path119 from "node:path";
29773
+ import path120 from "node:path";
29616
29774
  function locksDir(mainRoot) {
29617
29775
  return hausPath(mainRoot, "locks");
29618
29776
  }
@@ -29631,10 +29789,10 @@ function lockName(slug) {
29631
29789
  return `hydrate-${assertSlug(slug)}`;
29632
29790
  }
29633
29791
  function hydrateLogPath(mainRoot, slug) {
29634
- return path119.join(logsDir(mainRoot), `hydrate-${assertSlug(slug)}.log`);
29792
+ return path120.join(logsDir(mainRoot), `hydrate-${assertSlug(slug)}.log`);
29635
29793
  }
29636
29794
  function hydrateLastRunPath(mainRoot, slug) {
29637
- return path119.join(logsDir(mainRoot), `hydrate-${assertSlug(slug)}.last.json`);
29795
+ return path120.join(logsDir(mainRoot), `hydrate-${assertSlug(slug)}.last.json`);
29638
29796
  }
29639
29797
  async function acquireHydrateLock(mainRoot, slug, deps = {}) {
29640
29798
  return acquireNamedLock(locksDir(mainRoot), lockName(slug), deps);
@@ -29651,7 +29809,7 @@ async function readHydrateLock(mainRoot, slug) {
29651
29809
 
29652
29810
  // src/workspace/worktree/orphans.ts
29653
29811
  import { existsSync as existsSync14, realpathSync as realpathSync2 } from "node:fs";
29654
- import path120 from "node:path";
29812
+ import path121 from "node:path";
29655
29813
  var WORKSPACE_REPO_ID = "(workspace)";
29656
29814
  async function findOrphanedRegistrations(repos, wsWorktreesDir) {
29657
29815
  const prefixes = worktreesDirPrefixes(wsWorktreesDir);
@@ -29659,9 +29817,9 @@ async function findOrphanedRegistrations(repos, wsWorktreesDir) {
29659
29817
  for (const repo of repos) {
29660
29818
  const entries = await listWorktrees(repo.absPath);
29661
29819
  for (const entry of entries) {
29662
- const slug = slugUnder(prefixes, path120.normalize(entry.path));
29820
+ const slug = slugUnder(prefixes, path121.normalize(entry.path));
29663
29821
  if (slug === void 0) continue;
29664
- if (existsSync14(path120.join(wsWorktreesDir, slug))) continue;
29822
+ if (existsSync14(path121.join(wsWorktreesDir, slug))) continue;
29665
29823
  orphans.push({
29666
29824
  repoId: repo.id,
29667
29825
  ownerRepo: repo.absPath,
@@ -29673,21 +29831,21 @@ async function findOrphanedRegistrations(repos, wsWorktreesDir) {
29673
29831
  return orphans;
29674
29832
  }
29675
29833
  function worktreesDirPrefixes(wsWorktreesDir) {
29676
- const raw = path120.normalize(wsWorktreesDir);
29677
- return Array.from(/* @__PURE__ */ new Set([raw, resolvedForm(raw)]), (dir) => `${dir}${path120.sep}`);
29834
+ const raw = path121.normalize(wsWorktreesDir);
29835
+ return Array.from(/* @__PURE__ */ new Set([raw, resolvedForm(raw)]), (dir) => `${dir}${path121.sep}`);
29678
29836
  }
29679
29837
  function resolvedForm(p) {
29680
29838
  try {
29681
29839
  return realpathSync2(p);
29682
29840
  } catch {
29683
- const parent = path120.dirname(p);
29684
- return parent === p ? p : path120.join(resolvedForm(parent), path120.basename(p));
29841
+ const parent = path121.dirname(p);
29842
+ return parent === p ? p : path121.join(resolvedForm(parent), path121.basename(p));
29685
29843
  }
29686
29844
  }
29687
29845
  function slugUnder(prefixes, entryPath) {
29688
29846
  for (const prefix of prefixes) {
29689
29847
  if (!entryPath.startsWith(prefix)) continue;
29690
- const slug = entryPath.slice(prefix.length).split(path120.sep)[0];
29848
+ const slug = entryPath.slice(prefix.length).split(path121.sep)[0];
29691
29849
  return slug ? slug : void 0;
29692
29850
  }
29693
29851
  return void 0;
@@ -29707,7 +29865,7 @@ function environmentLine(state) {
29707
29865
  }
29708
29866
  var HYDRATION_MARKERS = ["node_modules", "vendor", "obj", "bin"];
29709
29867
  function looksHydrated(memberPath2) {
29710
- return HYDRATION_MARKERS.some((marker) => existsSync15(path121.join(memberPath2, marker)));
29868
+ return HYDRATION_MARKERS.some((marker) => existsSync15(path122.join(memberPath2, marker)));
29711
29869
  }
29712
29870
  async function runDoctor2() {
29713
29871
  const rootInfo = await resolveRoots();
@@ -29724,7 +29882,7 @@ async function runDoctor2() {
29724
29882
  };
29725
29883
  }
29726
29884
  const workspaceRoot = rootInfo.mainRoot;
29727
- const isWorkspace = existsSync15(path121.join(workspaceRoot, WORKSPACE_FILE)) || existsSync15(path121.join(workspaceRoot, REPOS_MANIFEST_FILE));
29885
+ const isWorkspace = existsSync15(path122.join(workspaceRoot, WORKSPACE_FILE)) || existsSync15(path122.join(workspaceRoot, REPOS_MANIFEST_FILE));
29728
29886
  if (!isWorkspace) {
29729
29887
  return {
29730
29888
  isWorkspace: false,
@@ -29740,7 +29898,7 @@ async function runDoctor2() {
29740
29898
  };
29741
29899
  }
29742
29900
  const wsWorktreesDir = worktreesDir(workspaceRoot);
29743
- const underWorktreesDir = rootInfo.repoRoot.startsWith(`${wsWorktreesDir}${path121.sep}`);
29901
+ const underWorktreesDir = rootInfo.repoRoot.startsWith(`${wsWorktreesDir}${path122.sep}`);
29744
29902
  const inWorkspaceWorktree = rootInfo.isLinkedWorktree && underWorktreesDir;
29745
29903
  const workspaceConfig = await readWorkspaceConfig(workspaceRoot);
29746
29904
  const autoHydrate = workspaceConfig?.worktree?.autoHydrate === true;
@@ -29754,10 +29912,10 @@ async function runDoctor2() {
29754
29912
  let environment;
29755
29913
  if (inWorkspaceWorktree) {
29756
29914
  const wtPath = rootInfo.repoRoot;
29757
- slug = rootInfo.worktreeName ?? path121.basename(wtPath);
29915
+ slug = rootInfo.worktreeName ?? path122.basename(wtPath);
29758
29916
  const state = await readWorktreeState(wtPath);
29759
29917
  for (const member of members) {
29760
- const memberPath2 = path121.join(wtPath, member.folder);
29918
+ const memberPath2 = path122.join(wtPath, member.folder);
29761
29919
  const materialized = existsSync15(memberPath2);
29762
29920
  const expectedBranch = state?.members.find((m) => m.folder === member.folder)?.branch ?? state?.branch;
29763
29921
  const actualBranch = materialized ? await currentBranch(memberPath2) : void 0;
@@ -29804,7 +29962,7 @@ async function runDoctor2() {
29804
29962
  wsWorktreesDir
29805
29963
  );
29806
29964
  const orphans = orphanScan.map(
29807
- (o) => `${o.repoId}: worktree registered at ${o.registeredPath} but ${path121.join(wsWorktreesDir, o.slug)} no longer exists.`
29965
+ (o) => `${o.repoId}: worktree registered at ${o.registeredPath} but ${path122.join(wsWorktreesDir, o.slug)} no longer exists.`
29808
29966
  );
29809
29967
  if (orphans.length > 0) {
29810
29968
  problems.push(...orphans);
@@ -29827,7 +29985,7 @@ async function runDoctor2() {
29827
29985
 
29828
29986
  // src/workspace/worktree/hydrate-command.ts
29829
29987
  import { existsSync as existsSync16 } from "node:fs";
29830
- import path122 from "node:path";
29988
+ import path123 from "node:path";
29831
29989
  async function runHydrateWorktree(opts) {
29832
29990
  const rootInfo = await resolveRoots();
29833
29991
  if (!rootInfo.isGitRepo || !rootInfo.isLinkedWorktree) {
@@ -29838,7 +29996,7 @@ async function runHydrateWorktree(opts) {
29838
29996
  }
29839
29997
  const workspaceRoot = rootInfo.mainRoot;
29840
29998
  const wtPath = rootInfo.repoRoot;
29841
- if (!wtPath.startsWith(`${worktreesDir(workspaceRoot)}${path122.sep}`)) {
29999
+ if (!wtPath.startsWith(`${worktreesDir(workspaceRoot)}${path123.sep}`)) {
29842
30000
  return {
29843
30001
  ok: false,
29844
30002
  error: "Current worktree is not one of this workspace's .claude/worktrees/<slug> checkouts."
@@ -29850,13 +30008,13 @@ async function runHydrateWorktree(opts) {
29850
30008
  return { ok: false, error: `Unknown --only repo(s): ${unknown.join(", ")}` };
29851
30009
  }
29852
30010
  const state = await readWorktreeState(wtPath);
29853
- const slug = state?.slug ?? path122.basename(wtPath);
30011
+ const slug = state?.slug ?? path123.basename(wtPath);
29854
30012
  const detectedBranch = await currentBranch(wtPath);
29855
30013
  const targetBranch = state?.branch ?? (detectedBranch !== "HEAD" ? detectedBranch : void 0) ?? slug;
29856
30014
  if (opts.dryRun) {
29857
30015
  const results2 = await Promise.all(
29858
30016
  selected2.map(async (member) => {
29859
- const memberPath2 = path122.join(wtPath, member.folder);
30017
+ const memberPath2 = path123.join(wtPath, member.folder);
29860
30018
  if (existsSync16(memberPath2)) {
29861
30019
  return { member: member.id, folder: member.folder, status: "planned" };
29862
30020
  }
@@ -29877,7 +30035,7 @@ async function runHydrateWorktree(opts) {
29877
30035
  const results = await mapWithConcurrency(
29878
30036
  selected2,
29879
30037
  async (member) => {
29880
- const memberPath2 = path122.join(wtPath, member.folder);
30038
+ const memberPath2 = path123.join(wtPath, member.folder);
29881
30039
  let branchAction;
29882
30040
  if (!existsSync16(memberPath2)) {
29883
30041
  if (!opts.materialize) {
@@ -29953,7 +30111,7 @@ async function runHydrateWorktree(opts) {
29953
30111
  }
29954
30112
 
29955
30113
  // src/workspace/worktree/prune.ts
29956
- import path123 from "node:path";
30114
+ import path124 from "node:path";
29957
30115
  var STILL_REGISTERED_ERROR = "registration still present (locked or directory exists)";
29958
30116
  async function pruneEnvironments(dryRun, deps) {
29959
30117
  const resolved = await resolveEnvContext();
@@ -30003,7 +30161,7 @@ async function runPrune2(opts, deps = {}) {
30003
30161
  };
30004
30162
  }
30005
30163
  async function registeredPaths(ownerRepo) {
30006
- return new Set((await listWorktrees(ownerRepo)).map((e) => path123.normalize(e.path)));
30164
+ return new Set((await listWorktrees(ownerRepo)).map((e) => path124.normalize(e.path)));
30007
30165
  }
30008
30166
  async function pruneRepo(repo, ownerRepo, orphans) {
30009
30167
  const paths = orphans.map((o) => o.registeredPath);
@@ -30011,8 +30169,8 @@ async function pruneRepo(repo, ownerRepo, orphans) {
30011
30169
  const outcome2 = await pruneWorktrees(ownerRepo);
30012
30170
  const after = await registeredPaths(ownerRepo);
30013
30171
  const verified = before.size > 0 && after.size > 0;
30014
- const remaining = verified ? paths.filter((p) => after.has(path123.normalize(p))) : paths;
30015
- const removed = verified ? paths.filter((p) => before.has(path123.normalize(p)) && !after.has(path123.normalize(p))) : [];
30172
+ const remaining = verified ? paths.filter((p) => after.has(path124.normalize(p))) : paths;
30173
+ const removed = verified ? paths.filter((p) => before.has(path124.normalize(p)) && !after.has(path124.normalize(p))) : [];
30016
30174
  const pruned = removed.length === paths.length;
30017
30175
  const error2 = pruneError(outcome2, verified, pruned);
30018
30176
  return { repo, orphans: paths, pruned, removed, remaining, error: error2 };
@@ -30047,7 +30205,7 @@ function defaultSpawnDetached(spec) {
30047
30205
  }
30048
30206
  function appendLog(logPath, line2) {
30049
30207
  try {
30050
- fsSync.mkdirSync(path124.dirname(logPath), { recursive: true });
30208
+ fsSync.mkdirSync(path125.dirname(logPath), { recursive: true });
30051
30209
  const size = fsSync.statSync(logPath, { throwIfNoEntry: false })?.size ?? 0;
30052
30210
  if (size > LOG_SIZE_CAP_BYTES) {
30053
30211
  fsSync.writeFileSync(logPath, `--- log rotated (exceeded ${LOG_SIZE_CAP_BYTES} bytes) ---
@@ -30062,11 +30220,11 @@ async function consumeLastRunFailure(mainRoot, slug) {
30062
30220
  const file = hydrateLastRunPath(mainRoot, slug);
30063
30221
  let parsed;
30064
30222
  try {
30065
- parsed = JSON.parse(await fs60.readFile(file, "utf8"));
30223
+ parsed = JSON.parse(await fs61.readFile(file, "utf8"));
30066
30224
  } catch {
30067
30225
  return void 0;
30068
30226
  }
30069
- await fs60.remove(file).catch(() => void 0);
30227
+ await fs61.remove(file).catch(() => void 0);
30070
30228
  if (parsed && parsed.ok === false) return parsed;
30071
30229
  return void 0;
30072
30230
  }
@@ -30138,7 +30296,7 @@ async function runAutoHydrate(opts = {}, deps = {}) {
30138
30296
  reason: "could not determine the haus CLI entry point to re-invoke"
30139
30297
  };
30140
30298
  }
30141
- await fs60.ensureDir(logsDir(mainRoot));
30299
+ await fs61.ensureDir(logsDir(mainRoot));
30142
30300
  appendLog(
30143
30301
  logPath,
30144
30302
  `autohydrate: forking hydrate --materialize for "${slug}" (${missingMembers.join(", ")})`
@@ -30217,22 +30375,22 @@ async function runDetachedHydration(deps = {}) {
30217
30375
  async function writeLastRun(mainRoot, slug, ok2, failures) {
30218
30376
  const file = hydrateLastRunPath(mainRoot, slug);
30219
30377
  if (ok2) {
30220
- await fs60.remove(file).catch(() => void 0);
30378
+ await fs61.remove(file).catch(() => void 0);
30221
30379
  return;
30222
30380
  }
30223
30381
  const record = { slug, finishedAt: (/* @__PURE__ */ new Date()).toISOString(), ok: ok2, failures };
30224
- await fs60.ensureDir(path124.dirname(file));
30225
- await fs60.writeJson(file, record, { spaces: 2 }).catch(() => void 0);
30382
+ await fs61.ensureDir(path125.dirname(file));
30383
+ await fs61.writeJson(file, record, { spaces: 2 }).catch(() => void 0);
30226
30384
  }
30227
30385
 
30228
30386
  // src/workspace/worktree/dematerialize.ts
30229
30387
  import { existsSync as existsSync18 } from "node:fs";
30230
- import path128 from "node:path";
30231
- import fs64 from "fs-extra";
30388
+ import path129 from "node:path";
30389
+ import fs65 from "fs-extra";
30232
30390
 
30233
30391
  // src/workspace/worktree/member-targets.ts
30234
- import path125 from "node:path";
30235
- import fs61 from "fs-extra";
30392
+ import path126 from "node:path";
30393
+ import fs62 from "fs-extra";
30236
30394
  function normalizeStateMembers(state, allMembers) {
30237
30395
  return state?.members.map((m) => ({ id: m.id, folder: m.folder, absPath: m.absPath })) ?? allMembers.map((m) => ({ id: m.id, folder: m.folder, absPath: m.absPath }));
30238
30396
  }
@@ -30249,7 +30407,7 @@ function resolveMemberTargets(wsWorktreePath, stateMembers, allMembers) {
30249
30407
  targets.push({
30250
30408
  repo: configMember?.id ?? stateMember.id,
30251
30409
  ownerRepo,
30252
- path: path125.join(wsWorktreePath, stateMember.folder)
30410
+ path: path126.join(wsWorktreePath, stateMember.folder)
30253
30411
  });
30254
30412
  }
30255
30413
  return { targets, unresolvedDroppedMembers };
@@ -30257,7 +30415,7 @@ function resolveMemberTargets(wsWorktreePath, stateMembers, allMembers) {
30257
30415
  async function filterExistingTargets(targets) {
30258
30416
  const existing = [];
30259
30417
  for (const target of targets) {
30260
- if (await fs61.pathExists(target.path)) existing.push(target);
30418
+ if (await fs62.pathExists(target.path)) existing.push(target);
30261
30419
  }
30262
30420
  return existing;
30263
30421
  }
@@ -30288,13 +30446,13 @@ async function findWorkBlockers(targets, ignorePathsFor = () => [], envLinksFor
30288
30446
 
30289
30447
  // src/workspace/worktree/remove.ts
30290
30448
  import { existsSync as existsSync17 } from "node:fs";
30291
- import path127 from "node:path";
30292
- import fs63 from "fs-extra";
30449
+ import path128 from "node:path";
30450
+ import fs64 from "fs-extra";
30293
30451
 
30294
30452
  // src/workspace/worktree/snapshot.ts
30295
30453
  import { realpathSync as realpathSync3 } from "node:fs";
30296
- import path126 from "node:path";
30297
- import fs62 from "fs-extra";
30454
+ import path127 from "node:path";
30455
+ import fs63 from "fs-extra";
30298
30456
  function pathspec(ignore) {
30299
30457
  return ignore.length > 0 ? ["--", ".", ...ignore.map((p) => `:!${p}`)] : [];
30300
30458
  }
@@ -30306,7 +30464,7 @@ function samePath(a, b) {
30306
30464
  }
30307
30465
  }
30308
30466
  async function probeDirty(target) {
30309
- if (!await fs62.pathExists(target.path)) return { state: "not-a-worktree" };
30467
+ if (!await fs63.pathExists(target.path)) return { state: "not-a-worktree" };
30310
30468
  const notOwnWorktree = (cause) => target.skipIfNotWorktree ? { state: "not-a-worktree" } : { state: "unknown", cause };
30311
30469
  const top = await runGit(["rev-parse", "--show-toplevel"], { cwd: target.path });
30312
30470
  if (top.exitCode !== 0) {
@@ -30363,25 +30521,25 @@ async function writeOne(target, dest) {
30363
30521
  const branch = (await gitOrThrow(["rev-parse", "--abbrev-ref", "HEAD"], target.path)).trim();
30364
30522
  const commit = (await gitOrThrow(["rev-parse", "HEAD"], target.path)).trim();
30365
30523
  const untracked = (await gitOrThrow(["ls-files", "--others", "--exclude-standard", "-z", ...spec], target.path)).split("\0").filter((entry) => entry.length > 0);
30366
- await fs62.ensureDir(dest);
30367
- await fs62.writeFile(path126.join(dest, "changes.patch"), patch);
30368
- await fs62.writeFile(
30369
- path126.join(dest, "HEAD.txt"),
30524
+ await fs63.ensureDir(dest);
30525
+ await fs63.writeFile(path127.join(dest, "changes.patch"), patch);
30526
+ await fs63.writeFile(
30527
+ path127.join(dest, "HEAD.txt"),
30370
30528
  `branch: ${branch}
30371
30529
  commit: ${commit}
30372
30530
  worktree: ${target.path}
30373
30531
  `
30374
30532
  );
30375
30533
  for (const rel of untracked) {
30376
- const to = path126.join(dest, "untracked", rel);
30377
- await fs62.ensureDir(path126.dirname(to));
30378
- await fs62.copy(path126.join(target.path, rel), to, { dereference: false });
30534
+ const to = path127.join(dest, "untracked", rel);
30535
+ await fs63.ensureDir(path127.dirname(to));
30536
+ await fs63.copy(path127.join(target.path, rel), to, { dereference: false });
30379
30537
  }
30380
- if (!(await fs62.readFile(path126.join(dest, "changes.patch"))).equals(patch)) {
30538
+ if (!(await fs63.readFile(path127.join(dest, "changes.patch"))).equals(patch)) {
30381
30539
  throw new Error("changes.patch does not read back as written");
30382
30540
  }
30383
30541
  for (const rel of untracked) {
30384
- const copied = await fs62.lstat(path126.join(dest, "untracked", rel)).catch(() => void 0);
30542
+ const copied = await fs63.lstat(path127.join(dest, "untracked", rel)).catch(() => void 0);
30385
30543
  if (!copied) throw new Error(`untracked/${rel} is missing from the snapshot`);
30386
30544
  }
30387
30545
  }
@@ -30391,12 +30549,12 @@ async function snapshotDirtyWorktrees(workspaceRoot, targets) {
30391
30549
  if (found.dirty.length === 0) return { ok: true };
30392
30550
  const name = dirBackupDirName("worktree", newBackupStamp());
30393
30551
  const abs = hausPath(workspaceRoot, "backups", name);
30394
- const dir = `${path126.relative(workspaceRoot, abs).split(path126.sep).join("/")}/`;
30552
+ const dir = `${path127.relative(workspaceRoot, abs).split(path127.sep).join("/")}/`;
30395
30553
  for (const target of found.dirty) {
30396
30554
  try {
30397
- await writeOne(target, path126.join(abs, target.label));
30555
+ await writeOne(target, path127.join(abs, target.label));
30398
30556
  } catch (err) {
30399
- await fs62.remove(abs).catch(() => {
30557
+ await fs63.remove(abs).catch(() => {
30400
30558
  });
30401
30559
  const message = err instanceof Error ? err.message : String(err);
30402
30560
  const fix = err instanceof GitStepError ? "fix that git error in the worktree and run again" : `fix the backup location (${dir}) and run again`;
@@ -30419,7 +30577,7 @@ function wouldSnapshotLine(labels) {
30419
30577
  // src/workspace/worktree/remove.ts
30420
30578
  async function envIgnorePaths(wsWorktreePath) {
30421
30579
  const state = await readEnvState(wsWorktreePath);
30422
- const roots = Object.values(state?.sites ?? {}).map((s) => path127.relative(wsWorktreePath, s.root)).filter((rel) => rel && !rel.startsWith("..") && !path127.isAbsolute(rel));
30580
+ const roots = Object.values(state?.sites ?? {}).map((s) => path128.relative(wsWorktreePath, s.root)).filter((rel) => rel && !rel.startsWith("..") && !path128.isAbsolute(rel));
30423
30581
  return [ENV_STATE_FILE, ENV_STATE_DIR, ...roots];
30424
30582
  }
30425
30583
  async function envMemberLinks(wsWorktreePath) {
@@ -30427,13 +30585,13 @@ async function envMemberLinks(wsWorktreePath) {
30427
30585
  const links = Object.values(state?.sites ?? {}).flatMap(
30428
30586
  (s) => siteLinksInWorktree(wsWorktreePath, s.root, void 0, s)
30429
30587
  );
30430
- return (target) => links.map((link) => path127.relative(target.path, link)).filter((rel) => rel && !rel.startsWith("..") && !path127.isAbsolute(rel));
30588
+ return (target) => links.map((link) => path128.relative(target.path, link)).filter((rel) => rel && !rel.startsWith("..") && !path128.isAbsolute(rel));
30431
30589
  }
30432
30590
  function envTeardownRefusal(verb, r) {
30433
30591
  return `Could not destroy this worktree's environment first (${describeDownFailure(r)}). Nothing was ${verb}. Fix the cause and retry, or re-run with --force to go ahead; what remains of the environment is then left for \`haus workspace worktree env gc --write\`.`;
30434
30592
  }
30435
30593
  function snapshotTargets(wsWorktreePath, targets, dropped, ignoreFor, envLinksFor) {
30436
- const label = (target) => target.repo === "(workspace)" ? "(workspace)" : path127.relative(wsWorktreePath, target.path);
30594
+ const label = (target) => target.repo === "(workspace)" ? "(workspace)" : path128.relative(wsWorktreePath, target.path);
30437
30595
  return [
30438
30596
  ...targets.map((target) => {
30439
30597
  const links = envLinksFor(target);
@@ -30447,7 +30605,7 @@ function snapshotTargets(wsWorktreePath, targets, dropped, ignoreFor, envLinksFo
30447
30605
  }),
30448
30606
  ...dropped.map((folder) => ({
30449
30607
  label: folder,
30450
- path: path127.join(wsWorktreePath, folder),
30608
+ path: path128.join(wsWorktreePath, folder),
30451
30609
  ignore: []
30452
30610
  }))
30453
30611
  ];
@@ -30457,7 +30615,7 @@ async function runRemove2(opts, deps = {}) {
30457
30615
  if (!resolved.ok) return { ok: false, error: resolved.reason };
30458
30616
  const { rootInfo, workspaceRoot } = resolved;
30459
30617
  const wsWorktreePath = worktreePath(workspaceRoot, opts.slug);
30460
- if (!await fs63.pathExists(wsWorktreePath)) {
30618
+ if (!await fs64.pathExists(wsWorktreePath)) {
30461
30619
  return { ok: false, error: `No workspace worktree found at ${wsWorktreePath}.` };
30462
30620
  }
30463
30621
  const state = await readWorktreeState(wsWorktreePath);
@@ -30475,7 +30633,7 @@ async function runRemove2(opts, deps = {}) {
30475
30633
  const existingTargets = await filterExistingTargets(targets);
30476
30634
  const envIgnored = await envIgnorePaths(wsWorktreePath);
30477
30635
  const envLinks = await envMemberLinks(wsWorktreePath);
30478
- const hasEnv = existsSync17(path127.join(wsWorktreePath, ENV_STATE_FILE));
30636
+ const hasEnv = existsSync17(path128.join(wsWorktreePath, ENV_STATE_FILE));
30479
30637
  const notWork = (target) => target.repo === "(workspace)" ? [WORKTREE_STATE_FILE, ...envIgnored, ...stateMembers.map((m) => m.folder)] : [];
30480
30638
  const memberLinks = (target) => target.repo === "(workspace)" ? [] : envLinks(target);
30481
30639
  if (!opts.force) {
@@ -30537,8 +30695,8 @@ async function runRemove2(opts, deps = {}) {
30537
30695
  }
30538
30696
  await pruneWorktrees(workspaceRoot);
30539
30697
  }
30540
- if (wsRemoveOk && await fs63.pathExists(wsWorktreePath)) {
30541
- await fs63.remove(wsWorktreePath);
30698
+ if (wsRemoveOk && await fs64.pathExists(wsWorktreePath)) {
30699
+ await fs64.remove(wsWorktreePath);
30542
30700
  }
30543
30701
  return {
30544
30702
  ok: failed3.length === 0,
@@ -30573,7 +30731,7 @@ async function runDematerialize(opts, deps = {}) {
30573
30731
  } catch (err) {
30574
30732
  return { ok: false, error: err instanceof Error ? err.message : String(err) };
30575
30733
  }
30576
- if (!await fs64.pathExists(wsWorktreePath)) {
30734
+ if (!await fs65.pathExists(wsWorktreePath)) {
30577
30735
  return { ok: false, error: `No workspace worktree found at ${wsWorktreePath}.` };
30578
30736
  }
30579
30737
  const lock = await readHydrateLock(workspaceRoot, slug);
@@ -30608,7 +30766,7 @@ async function runDematerialize(opts, deps = {}) {
30608
30766
  () => [],
30609
30767
  envLinks
30610
30768
  );
30611
- const hasEnv = existsSync18(path128.join(wsWorktreePath, ENV_STATE_FILE));
30769
+ const hasEnv = existsSync18(path129.join(wsWorktreePath, ENV_STATE_FILE));
30612
30770
  if (opts.dryRun) {
30613
30771
  const dirty = await findDirtyWorktrees(toSnapshot);
30614
30772
  if (!dirty.ok) return { ok: false, error: dirty.error };
@@ -30632,9 +30790,9 @@ async function runDematerialize(opts, deps = {}) {
30632
30790
  failed3.push({ repo: "(environment)", error: describeDownFailure(environment) });
30633
30791
  }
30634
30792
  for (const folder of unresolvedDroppedMembers) {
30635
- const droppedPath = path128.join(wsWorktreePath, folder);
30636
- if (await fs64.pathExists(droppedPath)) {
30637
- await fs64.remove(droppedPath);
30793
+ const droppedPath = path129.join(wsWorktreePath, folder);
30794
+ if (await fs65.pathExists(droppedPath)) {
30795
+ await fs65.remove(droppedPath);
30638
30796
  failed3.push({ repo: folder, error: unresolvedDroppedFailureReason() });
30639
30797
  }
30640
30798
  }
@@ -30656,26 +30814,26 @@ async function runDematerialize(opts, deps = {}) {
30656
30814
  }
30657
30815
 
30658
30816
  // src/workspace/worktree/list.ts
30659
- import path129 from "node:path";
30660
- import fs65 from "fs-extra";
30817
+ import path130 from "node:path";
30818
+ import fs66 from "fs-extra";
30661
30819
  async function runList2() {
30662
30820
  const resolved = await resolveWorkspaceForWorktree();
30663
30821
  if (!resolved.ok) return { ok: false, error: resolved.reason };
30664
30822
  const { rootInfo, workspaceRoot } = resolved;
30665
30823
  const dir = worktreesDir(workspaceRoot);
30666
- if (!await fs65.pathExists(dir)) return { ok: true, workspaceRoot, worktrees: [] };
30667
- const entries = await fs65.readdir(dir, { withFileTypes: true });
30824
+ if (!await fs66.pathExists(dir)) return { ok: true, workspaceRoot, worktrees: [] };
30825
+ const entries = await fs66.readdir(dir, { withFileTypes: true });
30668
30826
  const slugs = entries.filter((e) => e.isDirectory()).map((e) => e.name);
30669
30827
  const configuredMembers = await readMembers(rootInfo);
30670
30828
  const worktrees = [];
30671
30829
  for (const slug of slugs) {
30672
- const wtPath = path129.join(dir, slug);
30830
+ const wtPath = path130.join(dir, slug);
30673
30831
  const state = await readWorktreeState(wtPath);
30674
30832
  const members = [];
30675
30833
  const source = state?.members ?? configuredMembers.map((m) => ({ id: m.id, folder: m.folder }));
30676
30834
  for (const m of source) {
30677
- const memberPath2 = path129.join(wtPath, m.folder);
30678
- const materialized = await fs65.pathExists(memberPath2);
30835
+ const memberPath2 = path130.join(wtPath, m.folder);
30836
+ const materialized = await fs66.pathExists(memberPath2);
30679
30837
  const actualBranch = materialized ? await currentBranch(memberPath2) : void 0;
30680
30838
  members.push({
30681
30839
  id: m.id,
@@ -30697,23 +30855,23 @@ async function runList2() {
30697
30855
 
30698
30856
  // src/workspace/worktree/reclaim.ts
30699
30857
  import { existsSync as existsSync19 } from "node:fs";
30700
- import path130 from "node:path";
30701
- import fs66 from "fs-extra";
30858
+ import path131 from "node:path";
30859
+ import fs67 from "fs-extra";
30702
30860
  var MS_PER_DAY = 24 * 60 * 60 * 1e3;
30703
30861
  async function lastTouchedMs(worktreeRoot) {
30704
- const candidates = [worktreeRoot, path130.join(worktreeRoot, ".haus-worktree.json")];
30862
+ const candidates = [worktreeRoot, path131.join(worktreeRoot, ".haus-worktree.json")];
30705
30863
  try {
30706
- const dotGit = await fs66.readFile(path130.join(worktreeRoot, ".git"), "utf8");
30864
+ const dotGit = await fs67.readFile(path131.join(worktreeRoot, ".git"), "utf8");
30707
30865
  const match = /^gitdir:\s*(.+)$/m.exec(dotGit);
30708
30866
  if (match?.[1]) {
30709
30867
  const gitdir = match[1].trim();
30710
- candidates.push(path130.join(gitdir, "HEAD"), path130.join(gitdir, "index"));
30868
+ candidates.push(path131.join(gitdir, "HEAD"), path131.join(gitdir, "index"));
30711
30869
  }
30712
30870
  } catch {
30713
30871
  }
30714
30872
  let newest = 0;
30715
30873
  for (const candidate of candidates) {
30716
- const stat3 = await fs66.stat(candidate).catch(() => void 0);
30874
+ const stat3 = await fs67.stat(candidate).catch(() => void 0);
30717
30875
  if (stat3 && stat3.mtimeMs > newest) newest = stat3.mtimeMs;
30718
30876
  }
30719
30877
  return newest;
@@ -30740,7 +30898,7 @@ async function runReclaim(opts = {}, deps = {}) {
30740
30898
  if (!existsSync19(dir)) {
30741
30899
  return { ok: true, dryRun: !opts.write, olderThanDays, candidates: [], reclaimed: 0 };
30742
30900
  }
30743
- const allEntries = (await fs66.readdir(dir, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name).sort();
30901
+ const allEntries = (await fs67.readdir(dir, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name).sort();
30744
30902
  const entries = allEntries.filter((name) => isValidWorktreeSlug(name));
30745
30903
  const unaddressable = allEntries.filter((name) => !isValidWorktreeSlug(name));
30746
30904
  const members = await readMembers(rootInfo);
@@ -30750,19 +30908,19 @@ async function runReclaim(opts = {}, deps = {}) {
30750
30908
  for (const name of unaddressable) {
30751
30909
  candidates.push({
30752
30910
  slug: name,
30753
- ageDays: (Date.now() - await lastTouchedMs(path130.join(dir, name))) / MS_PER_DAY,
30911
+ ageDays: (Date.now() - await lastTouchedMs(path131.join(dir, name))) / MS_PER_DAY,
30754
30912
  materializedMembers: 0,
30755
30913
  action: "skip",
30756
30914
  reason: "directory name is not a valid worktree slug: no haus worktree command can address it; remove it by hand if it is debris"
30757
30915
  });
30758
30916
  }
30759
30917
  for (const slug of entries) {
30760
- const wtPath = path130.join(dir, slug);
30918
+ const wtPath = path131.join(dir, slug);
30761
30919
  const state = await readWorktreeState(wtPath);
30762
30920
  const stateMembers = normalizeStateMembers(state, members);
30763
- const materialized = stateMembers.filter((m) => existsSync19(path130.join(wtPath, m.folder)));
30921
+ const materialized = stateMembers.filter((m) => existsSync19(path131.join(wtPath, m.folder)));
30764
30922
  const ageDays = (Date.now() - await lastTouchedMs(wtPath)) / MS_PER_DAY;
30765
- const hasEnv = existsSync19(path130.join(wtPath, ENV_STATE_FILE));
30923
+ const hasEnv = existsSync19(path131.join(wtPath, ENV_STATE_FILE));
30766
30924
  const base = {
30767
30925
  slug,
30768
30926
  ageDays,
@@ -31341,10 +31499,10 @@ async function runWorktree(action, opts = {}) {
31341
31499
 
31342
31500
  // src/commands/workspace.ts
31343
31501
  import { existsSync as existsSync23, lstatSync as lstatSync2, statSync as statSync3 } from "node:fs";
31344
- import path138 from "node:path";
31502
+ import path139 from "node:path";
31345
31503
 
31346
31504
  // src/commands/workspace/aggregate.ts
31347
- import path131 from "node:path";
31505
+ import path132 from "node:path";
31348
31506
  async function writeWorkspaceArtifacts(workspaceRoot, repos, relationships = []) {
31349
31507
  const summaries = repos.map((repo) => ({
31350
31508
  name: repo.name,
@@ -31374,7 +31532,7 @@ async function writeWorkspaceArtifacts(workspaceRoot, repos, relationships = [])
31374
31532
  written.push(file);
31375
31533
  } catch (err) {
31376
31534
  if (!(err instanceof LinkedTargetError)) throw err;
31377
- warn(linkedTargetLine(recordedRel(path131.relative(workspaceRoot, file)), err.target));
31535
+ warn(linkedTargetLine(recordedRel(path132.relative(workspaceRoot, file)), err.target));
31378
31536
  exitCode = 1;
31379
31537
  }
31380
31538
  };
@@ -31418,10 +31576,10 @@ ${summaries.map(
31418
31576
 
31419
31577
  // src/commands/workspace/doctor.ts
31420
31578
  import { existsSync as existsSync20 } from "node:fs";
31421
- import path134 from "node:path";
31579
+ import path135 from "node:path";
31422
31580
 
31423
31581
  // src/claude/write-workspace-claude-md.ts
31424
- import path132 from "node:path";
31582
+ import path133 from "node:path";
31425
31583
  var WORKSPACE_SENTINELS = { begin: WORKSPACE_BLOCK_BEGIN, end: WORKSPACE_BLOCK_END };
31426
31584
  var WORKSPACE_DOC_ID = "workspace.doc";
31427
31585
  var WORKSPACE_DOC_FILE = ".haus-workflow/WORKSPACE.md";
@@ -31505,7 +31663,7 @@ async function writeWorkspaceDoc(workspaceRoot, opts) {
31505
31663
  item: headerFileItem(result)
31506
31664
  };
31507
31665
  }
31508
- const filePath = path132.join(workspaceRoot, ROOT_CLAUDE_MD_FILE);
31666
+ const filePath = path133.join(workspaceRoot, ROOT_CLAUDE_MD_FILE);
31509
31667
  const say = quiet ? () => {
31510
31668
  } : log;
31511
31669
  const found = await readTextDetailed(filePath);
@@ -31554,16 +31712,16 @@ async function writeWorkspaceDoc(workspaceRoot, opts) {
31554
31712
 
31555
31713
  // src/workspace/link-context/copy-record.ts
31556
31714
  import os16 from "node:os";
31557
- import path133 from "node:path";
31558
- import fs67 from "fs-extra";
31715
+ import path134 from "node:path";
31716
+ import fs68 from "fs-extra";
31559
31717
  async function copyWithoutLinks(source, dest) {
31560
- await fs67.copy(source, dest, {
31718
+ await fs68.copy(source, dest, {
31561
31719
  overwrite: true,
31562
31720
  errorOnExist: false,
31563
31721
  dereference: false,
31564
31722
  filter: (s) => {
31565
31723
  try {
31566
- return !fs67.lstatSync(s).isSymbolicLink();
31724
+ return !fs68.lstatSync(s).isSymbolicLink();
31567
31725
  } catch {
31568
31726
  return false;
31569
31727
  }
@@ -31571,11 +31729,11 @@ async function copyWithoutLinks(source, dest) {
31571
31729
  });
31572
31730
  }
31573
31731
  async function withStage(fn) {
31574
- const stage = await fs67.mkdtemp(path133.join(os16.tmpdir(), "haus-staged-link-"));
31732
+ const stage = await fs68.mkdtemp(path134.join(os16.tmpdir(), "haus-staged-link-"));
31575
31733
  try {
31576
31734
  return await fn(stage);
31577
31735
  } finally {
31578
- await fs67.remove(stage);
31736
+ await fs68.remove(stage);
31579
31737
  }
31580
31738
  }
31581
31739
  async function recordedCopyHash(workspaceRoot, entry) {
@@ -31585,13 +31743,13 @@ async function recordedCopyHash(workspaceRoot, entry) {
31585
31743
  }
31586
31744
  const rel = recordedRel(entry.path);
31587
31745
  if (await unsafeTrackedPath(workspaceRoot, rel) !== null) return void 0;
31588
- const copyAbs = path133.resolve(workspaceRoot, rel);
31589
- if (!await fs67.pathExists(copyAbs)) return void 0;
31746
+ const copyAbs = path134.resolve(workspaceRoot, rel);
31747
+ if (!await fs68.pathExists(copyAbs)) return void 0;
31590
31748
  if (!await holdsOnlyPlainFiles(copyAbs)) return void 0;
31591
31749
  const sourceRel = entry.sourceRelPath.replace(/\\/g, "/");
31592
31750
  const staged = await withStage(async (stage) => {
31593
31751
  if (resolveContainedPath(stage, sourceRel) === null) return void 0;
31594
- await copyWithoutLinks(copyAbs, path133.join(stage, sourceRel));
31752
+ await copyWithoutLinks(copyAbs, path134.join(stage, sourceRel));
31595
31753
  return hashInstalledPaths(stage, [sourceRel], { followSymlinks: false });
31596
31754
  });
31597
31755
  if (staged !== entry.sourceHash) return void 0;
@@ -31736,9 +31894,9 @@ async function runWorkspaceDoctor(workspaceRoot, opts = {}) {
31736
31894
  return report2();
31737
31895
  }
31738
31896
  const rootIsMember = config.repos.some(
31739
- (repo) => path134.resolve(workspaceRoot, repo.path) === path134.resolve(workspaceRoot)
31897
+ (repo) => path135.resolve(workspaceRoot, repo.path) === path135.resolve(workspaceRoot)
31740
31898
  );
31741
- const workspaceClaudeMd = rootIsMember ? void 0 : await readText(path134.join(workspaceRoot, ROOT_CLAUDE_MD_FILE));
31899
+ const workspaceClaudeMd = rootIsMember ? void 0 : await readText(path135.join(workspaceRoot, ROOT_CLAUDE_MD_FILE));
31742
31900
  if (workspaceClaudeMd !== void 0 && refusesWorkspaceClaudeMd(workspaceClaudeMd)) {
31743
31901
  suggest(
31744
31902
  `- ${ROOT_CLAUDE_MD_FILE}: haus-workspace-imports block is not closed (a HAUS:BEGIN marker has no HAUS:END). haus refuses the file, so workspace setup cannot repair it`,
@@ -31772,7 +31930,7 @@ async function runWorkspaceDoctor(workspaceRoot, opts = {}) {
31772
31930
  }
31773
31931
  const manifestByName = new Map(manifest.repos.map((r) => [r.name, r]));
31774
31932
  for (const repo of config.repos) {
31775
- const repoRoot = path134.resolve(workspaceRoot, repo.path);
31933
+ const repoRoot = path135.resolve(workspaceRoot, repo.path);
31776
31934
  const entry = manifestByName.get(repo.name);
31777
31935
  if (!entry) {
31778
31936
  flag({
@@ -31822,7 +31980,7 @@ async function runWorkspaceDoctor(workspaceRoot, opts = {}) {
31822
31980
  flag({
31823
31981
  repo: entry.repo,
31824
31982
  kind: "linked-context-copy",
31825
- detail: existsSync20(path134.join(workspaceRoot, recordedRel(entry.path))) ? `${linked} is a copy an older haus linked into the workspace root, which haus sync replaces. Run \`${WORKSPACE_SETUP_WRITE}\` to remove it (backed up first).` : `${linked} is recorded in the manifest but no longer at the workspace root. Run \`${WORKSPACE_SETUP_WRITE}\` to drop its entry.`
31983
+ detail: existsSync20(path135.join(workspaceRoot, recordedRel(entry.path))) ? `${linked} is a copy an older haus linked into the workspace root, which haus sync replaces. Run \`${WORKSPACE_SETUP_WRITE}\` to remove it (backed up first).` : `${linked} is recorded in the manifest but no longer at the workspace root. Run \`${WORKSPACE_SETUP_WRITE}\` to drop its entry.`
31826
31984
  });
31827
31985
  }
31828
31986
  return report2();
@@ -31921,10 +32079,10 @@ function emit(args) {
31921
32079
 
31922
32080
  // src/commands/workspace/setup.ts
31923
32081
  import { existsSync as existsSync21, statSync } from "node:fs";
31924
- import path136 from "node:path";
32082
+ import path137 from "node:path";
31925
32083
 
31926
32084
  // src/workspace/link-context/remove-copies.ts
31927
- import path135 from "node:path";
32085
+ import path136 from "node:path";
31928
32086
  var LINKED_COPY_FORCE = "haus workspace setup --write --force";
31929
32087
  var EDITED_COPY_REASON = {
31930
32088
  "no-hash": "has no copy hash",
@@ -32011,8 +32169,8 @@ async function removeLinkedCopies(workspaceRoot, entries, opts, say) {
32011
32169
  "unlink"
32012
32170
  );
32013
32171
  if (dir === null) return;
32014
- result.backupDirs.push(path135.basename(dir));
32015
- for (const id of ids) backupOf.set(id, path135.basename(dir));
32172
+ result.backupDirs.push(path136.basename(dir));
32173
+ for (const id of ids) backupOf.set(id, path136.basename(dir));
32016
32174
  };
32017
32175
  if (going.length > 1) {
32018
32176
  try {
@@ -32070,11 +32228,11 @@ function appliedOutcomes(res) {
32070
32228
  };
32071
32229
  }
32072
32230
  function resolveWorkspaceRoot(start = process.cwd()) {
32073
- let dir = path136.resolve(start);
32231
+ let dir = path137.resolve(start);
32074
32232
  for (; ; ) {
32075
- if (existsSync21(path136.join(dir, WORKSPACE_FILE))) return dir;
32076
- const parent = path136.dirname(dir);
32077
- if (parent === dir) return path136.resolve(start);
32233
+ if (existsSync21(path137.join(dir, WORKSPACE_FILE))) return dir;
32234
+ const parent = path137.dirname(dir);
32235
+ if (parent === dir) return path137.resolve(start);
32078
32236
  dir = parent;
32079
32237
  }
32080
32238
  }
@@ -32099,11 +32257,11 @@ async function writeWorkspaceRootHausJson(root, opts) {
32099
32257
  return written.status === "written" ? "planned" : "none";
32100
32258
  }
32101
32259
  function isRootRepo(workspaceRoot, repoPath) {
32102
- return path136.resolve(workspaceRoot, repoPath) === path136.resolve(workspaceRoot);
32260
+ return path137.resolve(workspaceRoot, repoPath) === path137.resolve(workspaceRoot);
32103
32261
  }
32104
32262
  async function runWorkspaceSetup(workspaceRoot, options = {}) {
32105
32263
  const apply = options.write ?? false;
32106
- const configText = await readText(path136.join(workspaceRoot, WORKSPACE_FILE));
32264
+ const configText = await readText(path137.join(workspaceRoot, WORKSPACE_FILE));
32107
32265
  if (!configText) {
32108
32266
  error(`Missing ${WORKSPACE_FILE}. Run \`haus workspace discover\` or \`init\` first.`);
32109
32267
  process.exitCode = 1;
@@ -32133,7 +32291,7 @@ async function runWorkspaceSetup(workspaceRoot, options = {}) {
32133
32291
  const rootList = await writeWorkspaceRootHausJson(workspaceRoot, {
32134
32292
  preview: !apply || options.dryRun === true,
32135
32293
  quiet: options.json === true,
32136
- members: repos.map((repo) => path136.resolve(workspaceRoot, repo.path))
32294
+ members: repos.map((repo) => path137.resolve(workspaceRoot, repo.path))
32137
32295
  });
32138
32296
  if (rootList === "refused") {
32139
32297
  const result2 = { workspaceRoot, statuses, written: [], items: [] };
@@ -32141,7 +32299,7 @@ async function runWorkspaceSetup(workspaceRoot, options = {}) {
32141
32299
  return result2;
32142
32300
  }
32143
32301
  for (const repo of repos) {
32144
- const repoRoot = path136.resolve(workspaceRoot, repo.path);
32302
+ const repoRoot = path137.resolve(workspaceRoot, repo.path);
32145
32303
  heading(`
32146
32304
  \u2192 ${repo.name} (${repo.path})`);
32147
32305
  let res;
@@ -32243,7 +32401,7 @@ async function runWorkspaceSetup(workspaceRoot, options = {}) {
32243
32401
  "cross-repo-summary.md",
32244
32402
  "workspace-context-map.json"
32245
32403
  ]) {
32246
- const target = await linkTargetAt(path136.join(workspaceRoot, ".haus-workflow", rel));
32404
+ const target = await linkTargetAt(path137.join(workspaceRoot, ".haus-workflow", rel));
32247
32405
  if (target === null) {
32248
32406
  sayAggregate(`[dry-run] would write .haus-workflow/${rel}`);
32249
32407
  } else {
@@ -32417,8 +32575,8 @@ async function retireLinkedCopiesStep(workspaceRoot, force, written, say) {
32417
32575
 
32418
32576
  // src/commands/workspace/undo.ts
32419
32577
  import { existsSync as existsSync22, statSync as statSync2 } from "node:fs";
32420
- import path137 from "node:path";
32421
- import fs68 from "fs-extra";
32578
+ import path138 from "node:path";
32579
+ import fs69 from "fs-extra";
32422
32580
  var WORKSPACE_AGGREGATE_FILES = [
32423
32581
  "workspace-summary.json",
32424
32582
  "dependency-ownership-map.json",
@@ -32449,7 +32607,7 @@ function planWorkspaceClaudeMd(content2) {
32449
32607
  return { kind: "strip", remaining: edit.text, legacy };
32450
32608
  }
32451
32609
  async function planClaudeMd(workspaceRoot) {
32452
- const found = await readTextDetailed(path137.join(workspaceRoot, ROOT_CLAUDE_MD_FILE));
32610
+ const found = await readTextDetailed(path138.join(workspaceRoot, ROOT_CLAUDE_MD_FILE));
32453
32611
  if (found.status === "missing") return { kind: "none" };
32454
32612
  if (found.status === "unreadable") {
32455
32613
  return { kind: "unreadable", line: unreadableLine(ROOT_CLAUDE_MD_FILE, messageOf(found.error)) };
@@ -32495,7 +32653,7 @@ async function planWorkspaceRoot(workspaceRoot, config) {
32495
32653
  const aggregates = [];
32496
32654
  for (const name of WORKSPACE_AGGREGATE_FILES) {
32497
32655
  const abs = hausPath(workspaceRoot, name);
32498
- if (await fs68.pathExists(abs)) aggregates.push({ abs, rel: `.haus-workflow/${name}` });
32656
+ if (await fs69.pathExists(abs)) aggregates.push({ abs, rel: `.haus-workflow/${name}` });
32499
32657
  }
32500
32658
  if (manifestRead.status === "refused") {
32501
32659
  return {
@@ -32568,7 +32726,7 @@ async function settleManifest(workspaceRoot, kept, dryRun) {
32568
32726
  log(`[dry-run] would remove ${WORKSPACE_MANIFEST_FILE}`);
32569
32727
  return false;
32570
32728
  }
32571
- await fs68.remove(manifestPath(workspaceRoot));
32729
+ await fs69.remove(manifestPath(workspaceRoot));
32572
32730
  log(`Removed ${WORKSPACE_MANIFEST_FILE}`);
32573
32731
  return false;
32574
32732
  }
@@ -32626,7 +32784,7 @@ async function undoWorkspaceRoot(plan, workspaceRoot, force) {
32626
32784
  rel: WORKSPACE_DOC_FILE
32627
32785
  };
32628
32786
  const claudeMd = {
32629
- abs: path137.join(workspaceRoot, ROOT_CLAUDE_MD_FILE),
32787
+ abs: path138.join(workspaceRoot, ROOT_CLAUDE_MD_FILE),
32630
32788
  rel: ROOT_CLAUDE_MD_FILE
32631
32789
  };
32632
32790
  const strip = plan.claudeMd.kind === "strip" ? plan.claudeMd : null;
@@ -32654,11 +32812,11 @@ async function undoWorkspaceRoot(plan, workspaceRoot, force) {
32654
32812
  );
32655
32813
  if (removal.exitCode === 1) owesExit = true;
32656
32814
  for (const { abs, rel } of plan.aggregates) {
32657
- await fs68.remove(abs);
32815
+ await fs69.remove(abs);
32658
32816
  log(`Removed ${rel}`);
32659
32817
  }
32660
32818
  if (docGoes) {
32661
- await fs68.remove(docFile.abs);
32819
+ await fs69.remove(docFile.abs);
32662
32820
  log(
32663
32821
  doc.kind === "kept" ? `Removed ${WORKSPACE_DOC_FILE} (${doc.reason}; removed with --force)` : `Removed ${WORKSPACE_DOC_FILE}`
32664
32822
  );
@@ -32666,10 +32824,10 @@ async function undoWorkspaceRoot(plan, workspaceRoot, force) {
32666
32824
  if (strip !== null) {
32667
32825
  const what = strip.legacy ? "pre-upgrade workspace haus import block" : "workspace haus import block";
32668
32826
  if (strip.remaining.length === 0) {
32669
- await fs68.remove(claudeMd.abs);
32827
+ await fs69.remove(claudeMd.abs);
32670
32828
  log(`Removed CLAUDE.md (only contained the ${what}).`);
32671
32829
  } else {
32672
- await fs68.writeFile(claudeMd.abs, strip.remaining, "utf8");
32830
+ await fs69.writeFile(claudeMd.abs, strip.remaining, "utf8");
32673
32831
  log(
32674
32832
  strip.legacy ? "Removed pre-upgrade workspace haus import block from CLAUDE.md (user content preserved)." : "Removed haus import block from CLAUDE.md (user content preserved)."
32675
32833
  );
@@ -32694,7 +32852,7 @@ async function runWorkspaceUndo(workspaceRoot, options = {}) {
32694
32852
  }
32695
32853
  if (options.dryRun) {
32696
32854
  for (const repo of config.repos) {
32697
- const repoRoot = path137.resolve(workspaceRoot, repo.path);
32855
+ const repoRoot = path138.resolve(workspaceRoot, repo.path);
32698
32856
  log(`
32699
32857
  \u2192 ${repo.name} (${repo.path})`);
32700
32858
  try {
@@ -32723,7 +32881,7 @@ async function runWorkspaceUndo(workspaceRoot, options = {}) {
32723
32881
  }
32724
32882
  let anyRepoFailed = false;
32725
32883
  for (const repo of config.repos) {
32726
- const repoRoot = path137.resolve(workspaceRoot, repo.path);
32884
+ const repoRoot = path138.resolve(workspaceRoot, repo.path);
32727
32885
  log(`
32728
32886
  \u2192 ${repo.name} (${repo.path})`);
32729
32887
  try {
@@ -32812,7 +32970,7 @@ relationships: []
32812
32970
  log("Workspace initialized.");
32813
32971
  }
32814
32972
  async function scanWorkspace(workspaceRoot, opts) {
32815
- const configText = await readText(path138.join(workspaceRoot, WORKSPACE_FILE));
32973
+ const configText = await readText(path139.join(workspaceRoot, WORKSPACE_FILE));
32816
32974
  if (!configText) {
32817
32975
  error(`Missing ${WORKSPACE_FILE}. Run \`haus workspace discover\` or \`init\` first.`);
32818
32976
  process.exitCode = 1;
@@ -32834,7 +32992,7 @@ async function scanWorkspace(workspaceRoot, opts) {
32834
32992
  const inputs = [];
32835
32993
  const failures = [];
32836
32994
  for (const repo of config.repos) {
32837
- const repoRoot = path138.resolve(workspaceRoot, repo.path);
32995
+ const repoRoot = path139.resolve(workspaceRoot, repo.path);
32838
32996
  try {
32839
32997
  if (!existsSync23(repoRoot) || !statSync3(repoRoot).isDirectory()) {
32840
32998
  throw new Error("path is not a directory");
@@ -32903,7 +33061,7 @@ async function runWorkspace(action, options = {}) {
32903
33061
  // src/cli.ts
32904
33062
  function cliVersion() {
32905
33063
  try {
32906
- const pkgPath = path139.join(packageRoot(), "package.json");
33064
+ const pkgPath = path140.join(packageRoot(), "package.json");
32907
33065
  const pkg = JSON.parse(readFileSync5(pkgPath, "utf8"));
32908
33066
  return pkg.version ?? "0.0.0";
32909
33067
  } catch {
@@ -32913,7 +33071,7 @@ function cliVersion() {
32913
33071
  var program = new Command();
32914
33072
  function validateRuntimeNodeVersion() {
32915
33073
  try {
32916
- const pkgPath = path139.join(packageRoot(), "package.json");
33074
+ const pkgPath = path140.join(packageRoot(), "package.json");
32917
33075
  const pkg = JSON.parse(readFileSync5(pkgPath, "utf8"));
32918
33076
  const requiredRange = pkg.engines?.node;
32919
33077
  if (requiredRange && !satisfiesVersion(process.version, requiredRange)) {
@@ -33049,8 +33207,12 @@ deploy.command("set <branch> <class>").description(
33049
33207
  ).option("--surface <url>", "Where the deploy lands, shown in the guard prompts").option("--local-check <command>", "The command haus verify local runs before a merge").option("--lower", "Allow recording a lower class than the file has").option("--json", "Emit the result as one JSON document").action(
33050
33208
  (branch, deploys, opts) => runDeploySet(branch, deploys, opts)
33051
33209
  );
33052
- var release = program.command("release").description("Ship tickets through dated release branches (ADR-0192)");
33053
- release.command("start [date]").description("Push release/<date> (YYYY-MM-DD, default today) cut from the default branch").option("--json", "Emit the result as one JSON document").action((date, opts) => runReleaseStart(date, opts));
33210
+ var release = program.command("release").description("Ship tickets through numbered release branches (ADR-0192, ADR-0194)");
33211
+ release.command("start [date]").description(
33212
+ "Push the next release/<n> (one past the highest release/<n> or release-<n>) cut from the default branch; a YYYY-MM-DD date or --date cuts release/<date> instead"
33213
+ ).option("--date", "Cut a dated release/YYYY-MM-DD branch for today instead of a numbered one").option("--dry-run", "Name the branch it would cut and from which commit, without pushing").option("--json", "Emit the result as one JSON document").action(
33214
+ (date, opts) => runReleaseStart(date, opts)
33215
+ );
33054
33216
  release.command("merge").description(
33055
33217
  "Open a PR from the ticket branch into the open release branch, squash-merge it and start the full suite in the background"
33056
33218
  ).option(