mancode 0.5.6 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -114,7 +114,7 @@ import {
114
114
  workflowMetadataDigest,
115
115
  writeOperationReservation,
116
116
  writeProjectFacts
117
- } from "./chunk-M5CWWECP.js";
117
+ } from "./chunk-LXRKJBSG.js";
118
118
  import {
119
119
  DEFAULT_MANCODE_END_MARKER,
120
120
  DEFAULT_MANCODE_START_MARKER,
@@ -139,7 +139,7 @@ import {
139
139
  stageV3AdapterUpgradeFiles,
140
140
  v3AdapterTargetPath,
141
141
  v3AdapterVersionsFromStatuses
142
- } from "./chunk-AWOIP2LC.js";
142
+ } from "./chunk-PBXSV352.js";
143
143
 
144
144
  // src/cli.ts
145
145
  import { realpathSync } from "fs";
@@ -9485,7 +9485,8 @@ var MANAGED_ADAPTERS = [
9485
9485
  "copilot",
9486
9486
  "zcode",
9487
9487
  "kimi-code",
9488
- "qoder"
9488
+ "qoder",
9489
+ "dsh"
9489
9490
  ];
9490
9491
  var DIGEST_PATTERN5 = /^sha256:[a-f0-9]{64}$/;
9491
9492
  var STAGE_STATES = /* @__PURE__ */ new Set([
@@ -9676,7 +9677,7 @@ async function activateLegacyMigration(input) {
9676
9677
  if (session === null || session.status !== "active") {
9677
9678
  throw new Error("MANCODE_SESSION_NOT_FOUND");
9678
9679
  }
9679
- const store = new (await import("./store-Z53OE53A.js")).V3ContextStore(root);
9680
+ const store = new (await import("./store-XJX424E3.js")).V3ContextStore(root);
9680
9681
  const project = await store.readProjectSnapshot();
9681
9682
  const stage = await readMigrationStage(root, input.stageId);
9682
9683
  if (stage.state !== "staged" || stage.revision !== input.expectedStageRevision) {
@@ -9939,7 +9940,7 @@ async function activateLegacyMigration(input) {
9939
9940
  for (const action of payload.actions.filter(
9940
9941
  (action2) => action2.kind === "v3_adapter_file"
9941
9942
  )) {
9942
- const { applyV3AdapterFilePlan: applyV3AdapterFilePlan2 } = await import("./v3-adapter-TCEFETAG.js");
9943
+ const { applyV3AdapterFilePlan: applyV3AdapterFilePlan2 } = await import("./v3-adapter-TPXL336I.js");
9943
9944
  await applyV3AdapterFilePlan2(root, action);
9944
9945
  }
9945
9946
  journal = await completeActivationStep(
@@ -13795,7 +13796,7 @@ async function upgradeV3Adapters(input) {
13795
13796
  if (unfinished.length > 0) {
13796
13797
  throw new Error("MANCODE_ADAPTER_UPGRADE_OPERATION_PENDING");
13797
13798
  }
13798
- const actualVersions = await import("./v3-adapter-TCEFETAG.js").then(
13799
+ const actualVersions = await import("./v3-adapter-TPXL336I.js").then(
13799
13800
  ({ inspectV3AdapterVersions: inspectV3AdapterVersions2 }) => inspectV3AdapterVersions2(
13800
13801
  root,
13801
13802
  managedAdapterNames(project.manifest.managedAdapters)
@@ -16344,6 +16345,8 @@ var LEGACY_MODE_NAMES = ["mamba", "man8"];
16344
16345
  var CODEX_SKILL_MANAGED_MARKER = "<!-- Managed by mancode:codex-skill. Do not edit this file manually. -->";
16345
16346
  var ZCODE_SKILL_MANAGED_MARKER = "<!-- Managed by mancode:zcode-skill. Do not edit this file manually. -->";
16346
16347
  var KIMI_SKILL_MANAGED_MARKER = "<!-- Managed by mancode:kimi-skill. Do not edit this file manually. -->";
16348
+ var DSH_SKILL_MANAGED_MARKER = "<!-- Managed by mancode:dsh-skill. Do not edit this file manually. -->";
16349
+ var MANCODE_DSH_SKILL_MARKERS = [DSH_SKILL_MANAGED_MARKER];
16347
16350
  var MODE_FILE_MANAGED_MARKER = "<!-- Managed by mancode:mode-file. Do not edit this file manually. -->";
16348
16351
  var MANCODE_AGENT_SKILL_MARKERS = [
16349
16352
  CODEX_SKILL_MANAGED_MARKER,
@@ -16484,6 +16487,39 @@ async function installKimiSkills(projectRoot, minimal) {
16484
16487
  }
16485
16488
  await removeLegacyManagedSkills(skillsDir, MANCODE_AGENT_SKILL_MARKERS);
16486
16489
  }
16490
+ async function installDshSkills(projectRoot, minimal) {
16491
+ if (minimal) {
16492
+ await removeDshSkills(projectRoot);
16493
+ return;
16494
+ }
16495
+ const skillsDir = path27.join(projectRoot, ".dsh", "skills");
16496
+ for (const mode of MODE_NAMES) {
16497
+ const modeDir = path27.join(skillsDir, mode);
16498
+ await mkdir23(modeDir, { recursive: true });
16499
+ const meta = MODE_META[mode];
16500
+ const content = [
16501
+ "---",
16502
+ `name: ${mode}`,
16503
+ `description: ${JSON.stringify(meta.description)}`,
16504
+ "disable-model-invocation: true",
16505
+ "user-invocable: true",
16506
+ "---",
16507
+ "",
16508
+ DSH_SKILL_MANAGED_MARKER,
16509
+ "",
16510
+ renderModeSkill(mode, "/"),
16511
+ ""
16512
+ ].join("\n");
16513
+ await writeManagedSkill(
16514
+ path27.join(modeDir, "SKILL.md"),
16515
+ content,
16516
+ DSH_SKILL_MANAGED_MARKER,
16517
+ "DeepSeek Harness",
16518
+ MANCODE_DSH_SKILL_MARKERS
16519
+ );
16520
+ }
16521
+ await removeLegacyManagedSkills(skillsDir, MANCODE_DSH_SKILL_MARKERS);
16522
+ }
16487
16523
  async function installCursorCommands(projectRoot, minimal) {
16488
16524
  if (minimal) {
16489
16525
  await removeCursorCommands(projectRoot);
@@ -16628,6 +16664,12 @@ async function removeKimiSkills(projectRoot) {
16628
16664
  );
16629
16665
  }
16630
16666
  }
16667
+ async function removeDshSkills(projectRoot) {
16668
+ await cleanManagedSkills(
16669
+ path27.join(projectRoot, ".dsh", "skills"),
16670
+ MANCODE_DSH_SKILL_MARKERS
16671
+ );
16672
+ }
16631
16673
  async function removeQoderCommands(projectRoot) {
16632
16674
  for (const mode of MODE_NAMES) {
16633
16675
  const filePath = path27.join(projectRoot, ".qoder", "commands", `${mode}.md`);
@@ -16976,6 +17018,8 @@ function renderModes(options) {
16976
17018
  commandLabel = "Invoke mode skills with `/skill:man`, `/skill:manba`, `/skill:manteam`, `/skill:manps`, `/skill:mansolo`.";
16977
17019
  } else if (options.platform === "qoder") {
16978
17020
  commandLabel = "Invoke mode commands with `/man`, `/manba`, `/manteam`, `/manps`, `/mansolo`.";
17021
+ } else if (options.platform === "dsh") {
17022
+ commandLabel = "Invoke user-only mode skills with `/man`, `/manba`, `/manteam`, `/manps`, `/mansolo`.";
16979
17023
  } else if (options.capabilities.skills === "agents-skills") {
16980
17024
  commandLabel = "Invoke mode skills with `$man`, `$manba`, `$manteam`, `$manps`, `$mansolo`.";
16981
17025
  } else if (options.capabilities.slashCommands === "native") {
@@ -17361,14 +17405,124 @@ function renderManpsRule() {
17361
17405
  return renderModeSkill("manps", "/");
17362
17406
  }
17363
17407
 
17364
- // src/installers/kimi-code.ts
17365
- import { writeFile as writeFile29 } from "fs/promises";
17408
+ // src/installers/dsh.ts
17409
+ import { lstat as lstat11, rename as rename9, rm as rm13, writeFile as writeFile29 } from "fs/promises";
17366
17410
  import path32 from "path";
17411
+ var DSH_MANCODE_START_MARKER = "<!-- mancode:dsh:start -->";
17412
+ var DSH_MANCODE_END_MARKER = "<!-- mancode:dsh:end -->";
17413
+ var DSH_MODE_PATH_NAMES = [
17414
+ "manba",
17415
+ "man",
17416
+ "manteam",
17417
+ "manps",
17418
+ "mansolo",
17419
+ "mamba",
17420
+ "man8"
17421
+ ];
17422
+ async function installDsh(projectRoot, options) {
17423
+ const root = path32.resolve(projectRoot);
17424
+ await assertDshAdapterPathsSafe(root);
17425
+ await installMancodeCore(root);
17426
+ const agentsPath = path32.join(root, "AGENTS.md");
17427
+ const existing = await readTextIfExists(agentsPath);
17428
+ const sharedContent = await generateSharedContent(root, {
17429
+ platform: "dsh",
17430
+ displayName: "DeepSeek Harness",
17431
+ capabilities: {
17432
+ slashCommands: "partial",
17433
+ subagents: true,
17434
+ hooks: false,
17435
+ skills: "dsh-skills"
17436
+ },
17437
+ minimal: options.minimal,
17438
+ techStack: options.techStack,
17439
+ uiLibrary: options.uiLibrary,
17440
+ projectProfile: options.projectProfile
17441
+ });
17442
+ const block = [
17443
+ DSH_MANCODE_START_MARKER,
17444
+ "<!-- Managed by mancode. Do not edit this block manually. -->",
17445
+ "",
17446
+ "# mancode Configuration",
17447
+ "",
17448
+ sharedContent.trim(),
17449
+ DSH_MANCODE_END_MARKER
17450
+ ].join("\n");
17451
+ await writeDshAgentsFile(
17452
+ root,
17453
+ replaceManagedBlock(
17454
+ existing,
17455
+ block,
17456
+ DSH_MANCODE_START_MARKER,
17457
+ DSH_MANCODE_END_MARKER
17458
+ )
17459
+ );
17460
+ await assertDshAdapterPathsSafe(root);
17461
+ await installDshSkills(root, options.minimal ?? false);
17462
+ }
17463
+ async function assertDshAdapterPathsSafe(projectRoot) {
17464
+ const root = path32.resolve(projectRoot);
17465
+ const targets = [
17466
+ path32.join(root, "AGENTS.md"),
17467
+ ...DSH_MODE_PATH_NAMES.map(
17468
+ (mode) => path32.join(root, ".dsh", "skills", mode, "SKILL.md")
17469
+ )
17470
+ ];
17471
+ for (const target of targets) {
17472
+ await assertDshArtifactPathSafe(root, target);
17473
+ }
17474
+ }
17475
+ async function writeDshAgentsFile(projectRoot, content) {
17476
+ const root = path32.resolve(projectRoot);
17477
+ const agentsPath = path32.join(root, "AGENTS.md");
17478
+ await assertDshArtifactPathSafe(root, agentsPath);
17479
+ const temporary = path32.join(
17480
+ root,
17481
+ `.AGENTS.md.${process.pid}.${Date.now()}.tmp`
17482
+ );
17483
+ try {
17484
+ await writeFile29(temporary, content, { encoding: "utf-8", flag: "wx" });
17485
+ await rename9(temporary, agentsPath);
17486
+ } finally {
17487
+ await rm13(temporary, { force: true }).catch(() => void 0);
17488
+ }
17489
+ }
17490
+ async function assertDshArtifactPathSafe(root, target) {
17491
+ const relative = path32.relative(root, target);
17492
+ if (!relative || relative.startsWith("..") || path32.isAbsolute(relative)) {
17493
+ throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
17494
+ }
17495
+ const rootEntry = await lstat11(root);
17496
+ if (!rootEntry.isDirectory() || rootEntry.isSymbolicLink()) {
17497
+ throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
17498
+ }
17499
+ const segments = relative.split(path32.sep);
17500
+ let current = root;
17501
+ for (let index = 0; index < segments.length; index += 1) {
17502
+ current = path32.join(current, segments[index] ?? "");
17503
+ try {
17504
+ const entry = await lstat11(current);
17505
+ if (entry.isSymbolicLink() || index < segments.length - 1 && !entry.isDirectory() || index === segments.length - 1 && !entry.isFile()) {
17506
+ throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
17507
+ }
17508
+ } catch (error) {
17509
+ if (isNodeError6(error) && error.code === "ENOENT") return;
17510
+ throw error;
17511
+ }
17512
+ }
17513
+ }
17514
+ function isNodeError6(error) {
17515
+ return error instanceof Error && "code" in error;
17516
+ }
17517
+
17518
+ // src/installers/kimi-code.ts
17519
+ import { writeFile as writeFile30 } from "fs/promises";
17520
+ import path33 from "path";
17367
17521
  var KIMI_MANCODE_START_MARKER = "<!-- mancode:kimi-code:start -->";
17368
17522
  var KIMI_MANCODE_END_MARKER = "<!-- mancode:kimi-code:end -->";
17369
17523
  async function installKimiCode(projectRoot, options) {
17370
17524
  await installMancodeCore(projectRoot);
17371
- const agentsPath = path32.join(projectRoot, "AGENTS.md");
17525
+ const agentsPath = path33.join(projectRoot, "AGENTS.md");
17372
17526
  const existing = await readTextIfExists(agentsPath);
17373
17527
  const sharedContent = await generateSharedContent(projectRoot, {
17374
17528
  platform: "kimi-code",
@@ -17393,7 +17547,7 @@ async function installKimiCode(projectRoot, options) {
17393
17547
  sharedContent.trim(),
17394
17548
  KIMI_MANCODE_END_MARKER
17395
17549
  ].join("\n");
17396
- await writeFile29(
17550
+ await writeFile30(
17397
17551
  agentsPath,
17398
17552
  replaceManagedBlock(
17399
17553
  existing,
@@ -17407,13 +17561,13 @@ async function installKimiCode(projectRoot, options) {
17407
17561
  }
17408
17562
 
17409
17563
  // src/installers/qoder.ts
17410
- import { writeFile as writeFile30 } from "fs/promises";
17411
- import path33 from "path";
17564
+ import { writeFile as writeFile31 } from "fs/promises";
17565
+ import path34 from "path";
17412
17566
  var QODER_MANCODE_START_MARKER = "<!-- mancode:qoder:start -->";
17413
17567
  var QODER_MANCODE_END_MARKER = "<!-- mancode:qoder:end -->";
17414
17568
  async function installQoder(projectRoot, options) {
17415
17569
  await installMancodeCore(projectRoot);
17416
- const agentsPath = path33.join(projectRoot, "AGENTS.md");
17570
+ const agentsPath = path34.join(projectRoot, "AGENTS.md");
17417
17571
  const existing = await readTextIfExists(agentsPath);
17418
17572
  const sharedContent = await generateSharedContent(projectRoot, {
17419
17573
  platform: "qoder",
@@ -17438,7 +17592,7 @@ async function installQoder(projectRoot, options) {
17438
17592
  sharedContent.trim(),
17439
17593
  QODER_MANCODE_END_MARKER
17440
17594
  ].join("\n");
17441
- await writeFile30(
17595
+ await writeFile31(
17442
17596
  agentsPath,
17443
17597
  replaceManagedBlock(
17444
17598
  existing,
@@ -17452,13 +17606,13 @@ async function installQoder(projectRoot, options) {
17452
17606
  }
17453
17607
 
17454
17608
  // src/installers/zcode.ts
17455
- import { writeFile as writeFile31 } from "fs/promises";
17456
- import path34 from "path";
17609
+ import { writeFile as writeFile32 } from "fs/promises";
17610
+ import path35 from "path";
17457
17611
  var ZCODE_MANCODE_START_MARKER = "<!-- mancode:zcode:start -->";
17458
17612
  var ZCODE_MANCODE_END_MARKER = "<!-- mancode:zcode:end -->";
17459
17613
  async function installZcode(projectRoot, options) {
17460
17614
  await installMancodeCore(projectRoot);
17461
- const agentsPath = path34.join(projectRoot, "AGENTS.md");
17615
+ const agentsPath = path35.join(projectRoot, "AGENTS.md");
17462
17616
  const existing = await readTextIfExists(agentsPath);
17463
17617
  const sharedContent = await generateSharedContent(projectRoot, {
17464
17618
  platform: "zcode",
@@ -17483,7 +17637,7 @@ async function installZcode(projectRoot, options) {
17483
17637
  sharedContent.trim(),
17484
17638
  ZCODE_MANCODE_END_MARKER
17485
17639
  ].join("\n");
17486
- await writeFile31(
17640
+ await writeFile32(
17487
17641
  agentsPath,
17488
17642
  replaceManagedBlock(
17489
17643
  existing,
@@ -17574,6 +17728,17 @@ var PLATFORM_INSTALLERS = {
17574
17728
  skills: "rules"
17575
17729
  },
17576
17730
  install: installQoder
17731
+ },
17732
+ dsh: {
17733
+ name: "dsh",
17734
+ displayName: "DeepSeek Harness",
17735
+ capabilities: {
17736
+ slashCommands: "partial",
17737
+ subagents: true,
17738
+ hooks: false,
17739
+ skills: "dsh-skills"
17740
+ },
17741
+ install: installDsh
17577
17742
  }
17578
17743
  };
17579
17744
  function getPlatformInstaller(platform) {
@@ -17591,11 +17756,11 @@ function isPlatformName(platform) {
17591
17756
  }
17592
17757
 
17593
17758
  // src/commands/v3-support.ts
17594
- import path36 from "path";
17759
+ import path37 from "path";
17595
17760
 
17596
17761
  // src/runtime/platform-spike-store.ts
17597
- import { lstat as lstat11, mkdir as mkdir26, readFile as readFile29, rm as rm13, writeFile as writeFile32 } from "fs/promises";
17598
- import path35 from "path";
17762
+ import { lstat as lstat12, mkdir as mkdir26, readFile as readFile29, rm as rm14, writeFile as writeFile33 } from "fs/promises";
17763
+ import path36 from "path";
17599
17764
 
17600
17765
  // src/runtime/platform-spike.ts
17601
17766
  var SESSION_SPIKE_PLATFORMS = [
@@ -17605,7 +17770,8 @@ var SESSION_SPIKE_PLATFORMS = [
17605
17770
  "copilot",
17606
17771
  "zcode",
17607
17772
  "kimi-code",
17608
- "qoder"
17773
+ "qoder",
17774
+ "dsh"
17609
17775
  ];
17610
17776
  function createPlatformSessionSpike(input) {
17611
17777
  assertSessionSpikePlatform(input.platform);
@@ -17977,7 +18143,7 @@ async function readPlatformSessionSpike(projectRoot, platform) {
17977
18143
  if (directory === null) return null;
17978
18144
  try {
17979
18145
  const raw = await readSafeRegularFile(
17980
- path35.join(directory, `${platform}.json`)
18146
+ path36.join(directory, `${platform}.json`)
17981
18147
  );
17982
18148
  return parsePlatformSessionSpike(JSON.parse(raw));
17983
18149
  } catch (error) {
@@ -18007,13 +18173,13 @@ async function writePlatformSessionSpike(projectRoot, spike) {
18007
18173
  if (directory === null) {
18008
18174
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
18009
18175
  }
18010
- const target = path35.join(directory, `${parsed.platform}.json`);
18176
+ const target = path36.join(directory, `${parsed.platform}.json`);
18011
18177
  await assertSafeReplacementTarget(target);
18012
- const temporary = path35.join(
18178
+ const temporary = path36.join(
18013
18179
  directory,
18014
18180
  `.${parsed.platform}.${process.pid}.${Date.now()}.tmp`
18015
18181
  );
18016
- await writeFile32(temporary, `${JSON.stringify(parsed, null, 2)}
18182
+ await writeFile33(temporary, `${JSON.stringify(parsed, null, 2)}
18017
18183
  `, {
18018
18184
  encoding: "utf8",
18019
18185
  flag: "wx"
@@ -18022,15 +18188,15 @@ async function writePlatformSessionSpike(projectRoot, spike) {
18022
18188
  await replaceFileAtomically(temporary, target);
18023
18189
  await assertSafeReplacementTarget(target);
18024
18190
  } catch (error) {
18025
- await rm13(temporary, { force: true });
18191
+ await rm14(temporary, { force: true });
18026
18192
  throw error;
18027
18193
  }
18028
18194
  return parsed;
18029
18195
  }
18030
18196
  async function safeEvidenceDirectory(projectRoot, create) {
18031
- let current = path35.resolve(projectRoot);
18197
+ let current = path36.resolve(projectRoot);
18032
18198
  for (const segment of EVIDENCE_DIRECTORY_SEGMENTS) {
18033
- const target = path35.join(current, segment);
18199
+ const target = path36.join(current, segment);
18034
18200
  try {
18035
18201
  await assertSafeDirectory2(target);
18036
18202
  } catch (error) {
@@ -18048,14 +18214,14 @@ async function safeEvidenceDirectory(projectRoot, create) {
18048
18214
  return current;
18049
18215
  }
18050
18216
  async function assertSafeDirectory2(target) {
18051
- const entry = await lstat11(target);
18217
+ const entry = await lstat12(target);
18052
18218
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
18053
18219
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
18054
18220
  }
18055
18221
  }
18056
18222
  async function assertSafeReplacementTarget(target) {
18057
18223
  try {
18058
- const entry = await lstat11(target);
18224
+ const entry = await lstat12(target);
18059
18225
  if (!entry.isFile() || entry.isSymbolicLink()) {
18060
18226
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
18061
18227
  }
@@ -18065,12 +18231,12 @@ async function assertSafeReplacementTarget(target) {
18065
18231
  }
18066
18232
  }
18067
18233
  async function readSafeRegularFile(target) {
18068
- const before = await lstat11(target);
18234
+ const before = await lstat12(target);
18069
18235
  if (!before.isFile() || before.isSymbolicLink()) {
18070
18236
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
18071
18237
  }
18072
18238
  const content = await readFile29(target, "utf8");
18073
- const after = await lstat11(target);
18239
+ const after = await lstat12(target);
18074
18240
  if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
18075
18241
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
18076
18242
  }
@@ -18173,7 +18339,7 @@ var EXIT_V3_OK = 0;
18173
18339
  var EXIT_V3_INVALID_ARGUMENT = 2;
18174
18340
  var EXIT_V3_BLOCKED = 3;
18175
18341
  async function readV3CommandProject(projectRoot) {
18176
- const root = path36.resolve(projectRoot);
18342
+ const root = path37.resolve(projectRoot);
18177
18343
  const runtime = await readProjectRuntimeContext(root);
18178
18344
  const store = new V3ContextStore(root);
18179
18345
  return {
@@ -18226,7 +18392,7 @@ async function resolveV3SessionCandidate(project, input, client) {
18226
18392
  });
18227
18393
  }
18228
18394
  function platformForClient(client) {
18229
- return client === "claude-code" || client === "codex" || client === "cursor" || client === "copilot" || client === "zcode" || client === "kimi-code" || client === "qoder" ? client : null;
18395
+ return client === "claude-code" || client === "codex" || client === "cursor" || client === "copilot" || client === "zcode" || client === "kimi-code" || client === "qoder" || client === "dsh" ? client : null;
18230
18396
  }
18231
18397
  function commandClient(value) {
18232
18398
  const client = value ?? "mancode-cli";
@@ -18351,8 +18517,8 @@ function selectUpgradePlatforms(options) {
18351
18517
  }
18352
18518
 
18353
18519
  // src/context/glossary.ts
18354
- import { mkdir as mkdir27, readFile as readFile30, rename as rename9, rm as rm14, writeFile as writeFile33 } from "fs/promises";
18355
- import path37 from "path";
18520
+ import { mkdir as mkdir27, readFile as readFile30, rename as rename10, rm as rm15, writeFile as writeFile34 } from "fs/promises";
18521
+ import path38 from "path";
18356
18522
  var GLOSSARY_TERM_MAX_LENGTH = 64;
18357
18523
  var GLOSSARY_DEFINITION_MAX_LENGTH = 500;
18358
18524
  var GLOSSARY_MAX_ENTRIES = 200;
@@ -18428,8 +18594,8 @@ function parseGlossaryEntry(value) {
18428
18594
  };
18429
18595
  }
18430
18596
  function projectGlossaryPath(projectRoot) {
18431
- return path37.join(
18432
- path37.resolve(projectRoot),
18597
+ return path38.join(
18598
+ path38.resolve(projectRoot),
18433
18599
  ".mancode",
18434
18600
  "shared",
18435
18601
  "context",
@@ -18556,20 +18722,20 @@ async function mutateProjectGlossary(projectRoot, store, expectedRevision, mutat
18556
18722
  }
18557
18723
  async function writeGlossaryFile(projectRoot, glossary) {
18558
18724
  const target = projectGlossaryPath(projectRoot);
18559
- await mkdir27(path37.dirname(target), { recursive: true });
18560
- const temporary = path37.join(
18561
- path37.dirname(target),
18562
- `.${path37.basename(target)}.${process.pid}.${Date.now()}.tmp`
18725
+ await mkdir27(path38.dirname(target), { recursive: true });
18726
+ const temporary = path38.join(
18727
+ path38.dirname(target),
18728
+ `.${path38.basename(target)}.${process.pid}.${Date.now()}.tmp`
18563
18729
  );
18564
18730
  try {
18565
- await writeFile33(temporary, `${JSON.stringify(glossary, null, 2)}
18731
+ await writeFile34(temporary, `${JSON.stringify(glossary, null, 2)}
18566
18732
  `, {
18567
18733
  encoding: "utf8",
18568
18734
  flag: "wx"
18569
18735
  });
18570
- await rename9(temporary, target);
18736
+ await rename10(temporary, target);
18571
18737
  } finally {
18572
- await rm14(temporary, { force: true }).catch(() => void 0);
18738
+ await rm15(temporary, { force: true }).catch(() => void 0);
18573
18739
  }
18574
18740
  }
18575
18741
  function assertGlobalTermUniqueness(entries) {
@@ -18605,8 +18771,8 @@ function isNotFound20(error) {
18605
18771
  }
18606
18772
 
18607
18773
  // src/context/publish-promote.ts
18608
- import { lstat as lstat12, mkdir as mkdir28, rename as rename10, rm as rm15, writeFile as writeFile34 } from "fs/promises";
18609
- import path38 from "path";
18774
+ import { lstat as lstat13, mkdir as mkdir28, rename as rename11, rm as rm16, writeFile as writeFile35 } from "fs/promises";
18775
+ import path39 from "path";
18610
18776
 
18611
18777
  // src/context/task-mutation.ts
18612
18778
  function markTaskReviewStale(previous, operationId, updatedAt) {
@@ -19338,7 +19504,7 @@ async function stageDestinationAuthority(projectRoot, destinationTaskRef, operat
19338
19504
  const target = taskRootPath(projectRoot, destinationTaskRef);
19339
19505
  const parent = await ensureSafeTaskParent2(projectRoot, destinationTaskRef);
19340
19506
  await assertPathAbsent(target, "MANCODE_PROMOTION_DESTINATION_EXISTS");
19341
- const staging = path38.join(
19507
+ const staging = path39.join(
19342
19508
  parent,
19343
19509
  `.${destinationTaskRef.taskId}.${operationId}.staging`
19344
19510
  );
@@ -19346,7 +19512,7 @@ async function stageDestinationAuthority(projectRoot, destinationTaskRef, operat
19346
19512
  await mkdir28(staging);
19347
19513
  try {
19348
19514
  for (const [fileName, content] of Object.entries(contents)) {
19349
- await writeFile34(path38.join(staging, fileName), content, {
19515
+ await writeFile35(path39.join(staging, fileName), content, {
19350
19516
  encoding: "utf8",
19351
19517
  flag: "wx"
19352
19518
  });
@@ -19354,7 +19520,7 @@ async function stageDestinationAuthority(projectRoot, destinationTaskRef, operat
19354
19520
  await assertSafeDirectory3(staging);
19355
19521
  return staging;
19356
19522
  } catch (error) {
19357
- await rm15(staging, { recursive: true, force: true });
19523
+ await rm16(staging, { recursive: true, force: true });
19358
19524
  throw error;
19359
19525
  }
19360
19526
  }
@@ -19362,7 +19528,7 @@ async function ensureSafeTaskParent2(projectRoot, taskRef) {
19362
19528
  await assertSafeDirectory3(projectRoot);
19363
19529
  let current = projectRoot;
19364
19530
  for (const segment of [".mancode", taskRef.namespace, "workflows"]) {
19365
- current = path38.join(current, segment);
19531
+ current = path39.join(current, segment);
19366
19532
  const existing = await lstatOrNull2(current);
19367
19533
  if (existing === null) {
19368
19534
  try {
@@ -19372,7 +19538,7 @@ async function ensureSafeTaskParent2(projectRoot, taskRef) {
19372
19538
  if (!isAlreadyExists16(error)) throw error;
19373
19539
  }
19374
19540
  }
19375
- const checked = existing ?? await lstat12(current);
19541
+ const checked = existing ?? await lstat13(current);
19376
19542
  if (!checked.isDirectory() || checked.isSymbolicLink()) {
19377
19543
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
19378
19544
  }
@@ -19383,7 +19549,7 @@ async function publishStagedDestination(projectRoot, destinationTaskRef, staging
19383
19549
  const target = taskRootPath(projectRoot, destinationTaskRef);
19384
19550
  await assertSafeDirectory3(staging);
19385
19551
  await assertPathAbsent(target, "MANCODE_PROMOTION_DESTINATION_EXISTS");
19386
- await rename10(staging, target);
19552
+ await rename11(staging, target);
19387
19553
  await assertSafeDirectory3(target);
19388
19554
  }
19389
19555
  async function assertDestinationAbsent(projectRoot, destinationHomeStore, destinationTaskRef) {
@@ -19538,7 +19704,7 @@ async function handlePromotionFailure(source, primaryStore, journal, stagingDire
19538
19704
  } catch {
19539
19705
  } finally {
19540
19706
  if (stagingDirectory !== null) {
19541
- await rm15(stagingDirectory, { recursive: true, force: true });
19707
+ await rm16(stagingDirectory, { recursive: true, force: true });
19542
19708
  }
19543
19709
  }
19544
19710
  }
@@ -19547,41 +19713,41 @@ async function renewPromotionLocks(source) {
19547
19713
  }
19548
19714
  async function writePromotionQuarantine(projectRoot, operationId, candidate, contents) {
19549
19715
  const directory = publishStagingDirectory(projectRoot, operationId);
19550
- const parent = path38.dirname(directory);
19716
+ const parent = path39.dirname(directory);
19551
19717
  await mkdir28(parent, { recursive: true });
19552
19718
  await assertSafeDirectory3(parent);
19553
19719
  await assertPathAbsent(directory, "MANCODE_PROMOTION_QUARANTINE_CONFLICT");
19554
19720
  await mkdir28(directory);
19555
19721
  try {
19556
- await writeFile34(
19557
- path38.join(directory, "candidate.json"),
19722
+ await writeFile35(
19723
+ path39.join(directory, "candidate.json"),
19558
19724
  serializeTaskAuthority(candidate),
19559
19725
  { encoding: "utf8", flag: "wx" }
19560
19726
  );
19561
19727
  for (const [fileName, content] of Object.entries(contents)) {
19562
- await writeFile34(path38.join(directory, fileName), content, {
19728
+ await writeFile35(path39.join(directory, fileName), content, {
19563
19729
  encoding: "utf8",
19564
19730
  flag: "wx"
19565
19731
  });
19566
19732
  }
19567
19733
  } catch (error) {
19568
- await rm15(directory, { recursive: true, force: true });
19734
+ await rm16(directory, { recursive: true, force: true });
19569
19735
  throw error;
19570
19736
  }
19571
19737
  }
19572
19738
  async function rewritePromotionQuarantine(projectRoot, operationId, candidate) {
19573
19739
  const directory = publishStagingDirectory(projectRoot, operationId);
19574
19740
  await assertSafeDirectory3(directory);
19575
- const target = path38.join(directory, "candidate.json");
19576
- const temporary = path38.join(
19741
+ const target = path39.join(directory, "candidate.json");
19742
+ const temporary = path39.join(
19577
19743
  directory,
19578
19744
  `.candidate.${process.pid}.${Date.now()}.tmp`
19579
19745
  );
19580
- await writeFile34(temporary, serializeTaskAuthority(candidate), {
19746
+ await writeFile35(temporary, serializeTaskAuthority(candidate), {
19581
19747
  encoding: "utf8",
19582
19748
  flag: "wx"
19583
19749
  });
19584
- await rename10(temporary, target);
19750
+ await rename11(temporary, target);
19585
19751
  }
19586
19752
  function completeOperationStep2(steps, stepId) {
19587
19753
  const index = steps.findIndex((step) => step.id === stepId);
@@ -19614,14 +19780,14 @@ async function assertPathAbsent(target, code) {
19614
19780
  throw new Error(code);
19615
19781
  }
19616
19782
  async function assertSafeDirectory3(target) {
19617
- const entry = await lstat12(target);
19783
+ const entry = await lstat13(target);
19618
19784
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
19619
19785
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
19620
19786
  }
19621
19787
  }
19622
19788
  async function lstatOrNull2(target) {
19623
19789
  try {
19624
- return await lstat12(target);
19790
+ return await lstat13(target);
19625
19791
  } catch (error) {
19626
19792
  if (isNotFound21(error)) return null;
19627
19793
  throw error;
@@ -20395,7 +20561,7 @@ function compareUtf89(left, right) {
20395
20561
 
20396
20562
  // src/context/task-head-reconcile.ts
20397
20563
  import { execFile as execFileCallback4 } from "child_process";
20398
- import path40 from "path";
20564
+ import path41 from "path";
20399
20565
  import { promisify as promisify4 } from "util";
20400
20566
 
20401
20567
  // src/team/conflicts.ts
@@ -20595,9 +20761,9 @@ function unique(values) {
20595
20761
 
20596
20762
  // src/team/git-ref-transport.ts
20597
20763
  import { execFile as execFileCallback3 } from "child_process";
20598
- import { mkdtemp, rm as rm16, writeFile as writeFile35 } from "fs/promises";
20764
+ import { mkdtemp, rm as rm17, writeFile as writeFile36 } from "fs/promises";
20599
20765
  import { tmpdir } from "os";
20600
- import path39 from "path";
20766
+ import path40 from "path";
20601
20767
  import { promisify as promisify3 } from "util";
20602
20768
  var execFile3 = promisify3(execFileCallback3);
20603
20769
  var TEAM_REF = "refs/mancode/team";
@@ -20620,7 +20786,7 @@ async function resolveGitRefRemoteIdentityHash(projectRoot, remote) {
20620
20786
  }
20621
20787
  let configured = remote;
20622
20788
  try {
20623
- const output = await runGit2(path39.resolve(projectRoot), [
20789
+ const output = await runGit2(path40.resolve(projectRoot), [
20624
20790
  "remote",
20625
20791
  "get-url",
20626
20792
  "--all",
@@ -20670,7 +20836,7 @@ var GitRefTeamManifestStore = class {
20670
20836
  "git-ref configRevision"
20671
20837
  );
20672
20838
  parseOptionalDigest(options.configDigest, "git-ref configDigest");
20673
- this.projectRoot = path39.resolve(options.projectRoot);
20839
+ this.projectRoot = path40.resolve(options.projectRoot);
20674
20840
  this.remote = options.remote;
20675
20841
  this.workspaceId = options.workspaceId;
20676
20842
  this.expectedHeader = {
@@ -22376,17 +22542,17 @@ function upsertActorProfile(profiles, profile) {
22376
22542
  }
22377
22543
  async function writeManifestCommit(projectRoot, parent, manifest, now) {
22378
22544
  const temporaryDirectory = await mkdtemp(
22379
- path39.join(tmpdir(), "mancode-git-ref-")
22545
+ path40.join(tmpdir(), "mancode-git-ref-")
22380
22546
  );
22381
- const manifestPath = path39.join(temporaryDirectory, "manifest.json");
22382
- const indexPath = path39.join(temporaryDirectory, "index");
22547
+ const manifestPath = path40.join(temporaryDirectory, "manifest.json");
22548
+ const indexPath = path40.join(temporaryDirectory, "index");
22383
22549
  try {
22384
22550
  const serialized = `${JSON.stringify(manifest, null, 2)}
22385
22551
  `;
22386
22552
  if (Buffer.byteLength(serialized, "utf8") > MAX_MANIFEST_BYTES) {
22387
22553
  throw new Error("MANCODE_TRANSPORT_MANIFEST_TOO_LARGE");
22388
22554
  }
22389
- await writeFile35(manifestPath, serialized);
22555
+ await writeFile36(manifestPath, serialized);
22390
22556
  const blob = (await runGit2(projectRoot, ["hash-object", "-w", manifestPath])).trim();
22391
22557
  const environment = { ...process.env, GIT_INDEX_FILE: indexPath };
22392
22558
  await runGit2(projectRoot, ["read-tree", "--empty"], environment);
@@ -22418,7 +22584,7 @@ async function writeManifestCommit(projectRoot, parent, manifest, now) {
22418
22584
  commitEnvironment
22419
22585
  )).trim();
22420
22586
  } finally {
22421
- await rm16(temporaryDirectory, { recursive: true, force: true });
22587
+ await rm17(temporaryDirectory, { recursive: true, force: true });
22422
22588
  }
22423
22589
  }
22424
22590
  async function pushWithLease(projectRoot, remote, expectedCommit, commit3) {
@@ -22500,7 +22666,7 @@ function normalizeRemoteIdentity(projectRoot, value) {
22500
22666
  url.pathname = url.pathname.replace(/\/+$/g, "");
22501
22667
  return url.toString();
22502
22668
  } catch {
22503
- return path39.resolve(projectRoot, value).replaceAll("\\", "/");
22669
+ return path40.resolve(projectRoot, value).replaceAll("\\", "/");
22504
22670
  }
22505
22671
  }
22506
22672
  function parseBundleCodeRef(value) {
@@ -22874,8 +23040,8 @@ function injectAfterReconcileStep(stepId) {
22874
23040
  throwIfOperationCrashInjected("task_head_reconcile", stepId);
22875
23041
  }
22876
23042
  async function assertGitSourcedTaskAggregate(projectRoot, taskRoot2) {
22877
- const relativeTaskRoot = path40.relative(projectRoot, taskRoot2);
22878
- if (!relativeTaskRoot || path40.isAbsolute(relativeTaskRoot) || relativeTaskRoot.split(path40.sep).some((part) => part === "..")) {
23043
+ const relativeTaskRoot = path41.relative(projectRoot, taskRoot2);
23044
+ if (!relativeTaskRoot || path41.isAbsolute(relativeTaskRoot) || relativeTaskRoot.split(path41.sep).some((part) => part === "..")) {
22879
23045
  throw new Error("MANCODE_TASK_UNAVAILABLE");
22880
23046
  }
22881
23047
  const authorityFiles = [
@@ -22883,7 +23049,7 @@ async function assertGitSourcedTaskAggregate(projectRoot, taskRoot2) {
22883
23049
  "requirements.json",
22884
23050
  "review-ledger.json",
22885
23051
  "verification-ledger.json"
22886
- ].map((file) => path40.join(relativeTaskRoot, file));
23052
+ ].map((file) => path41.join(relativeTaskRoot, file));
22887
23053
  try {
22888
23054
  await execFile4("git", ["rev-parse", "--verify", "HEAD^{commit}"], {
22889
23055
  cwd: projectRoot,
@@ -23103,16 +23269,17 @@ var BETA_PLATFORMS = [
23103
23269
  "copilot",
23104
23270
  "zcode",
23105
23271
  "kimi-code",
23106
- "qoder"
23272
+ "qoder",
23273
+ "dsh"
23107
23274
  ];
23108
23275
 
23109
23276
  // src/runtime/retention.ts
23110
- import { lstat as lstat13, readFile as readFile31, readdir as readdir14, rm as rm17 } from "fs/promises";
23111
- import path41 from "path";
23277
+ import { lstat as lstat14, readFile as readFile31, readdir as readdir14, rm as rm18 } from "fs/promises";
23278
+ import path42 from "path";
23112
23279
  var TERMINAL_JOURNAL_RETENTION_DAYS = 30;
23113
23280
  var RETAINED_NON_MILESTONE_CHECKPOINTS = 10;
23114
23281
  async function planContextCompaction(input) {
23115
- const root = path41.resolve(input.projectRoot);
23282
+ const root = path42.resolve(input.projectRoot);
23116
23283
  const now = input.now ?? /* @__PURE__ */ new Date();
23117
23284
  const store = new V3ContextStore(root);
23118
23285
  const [project, runtime] = await Promise.all([
@@ -23172,7 +23339,7 @@ async function planContextCompaction(input) {
23172
23339
  }
23173
23340
  async function planLocalCacheRetention(root, localCacheDays, now) {
23174
23341
  const threshold = now.getTime() - localCacheDays * 864e5;
23175
- const directory = path41.join(root, ".mancode", "local", "cache");
23342
+ const directory = path42.join(root, ".mancode", "local", "cache");
23176
23343
  const candidates = [];
23177
23344
  for (const target of await listRegularFilesRecursively(directory)) {
23178
23345
  const metadata = await regularFileMetadataOrNull(target);
@@ -23235,7 +23402,7 @@ async function planCheckpointCompaction(store, coordinationStore, taskRefs, prot
23235
23402
  }
23236
23403
  candidates.push({
23237
23404
  kind: "checkpoint",
23238
- target: path41.join(
23405
+ target: path42.join(
23239
23406
  task.location.taskRoot,
23240
23407
  "checkpoints",
23241
23408
  `${checkpoint.checkpointId}.json`
@@ -23249,13 +23416,13 @@ async function planCheckpointCompaction(store, coordinationStore, taskRefs, prot
23249
23416
  return { candidates, skippedReferencedCheckpoints };
23250
23417
  }
23251
23418
  async function planCompletedSessionRetention(root, completedSessionDays, now, protectedSessionIds) {
23252
- const directory = path41.join(root, ".mancode", "local", "sessions");
23419
+ const directory = path42.join(root, ".mancode", "local", "sessions");
23253
23420
  const entries = await readDirectoryOrEmpty(directory);
23254
23421
  const threshold = now.getTime() - completedSessionDays * 864e5;
23255
23422
  const candidates = [];
23256
23423
  for (const entry of entries) {
23257
23424
  if (!entry.endsWith(".json")) continue;
23258
- const target = path41.join(directory, entry);
23425
+ const target = path42.join(directory, entry);
23259
23426
  const session = parseSessionState(
23260
23427
  JSON.parse(await readRegularFile(target))
23261
23428
  );
@@ -23281,7 +23448,7 @@ async function planOperationRetention(stores, now) {
23281
23448
  const entries = await readDirectoryOrEmpty(directory);
23282
23449
  for (const entry of entries) {
23283
23450
  if (!entry.endsWith(".json")) continue;
23284
- const target = path41.join(directory, entry);
23451
+ const target = path42.join(directory, entry);
23285
23452
  const journal = parseOperationJournal(
23286
23453
  JSON.parse(await readRegularFile(target))
23287
23454
  );
@@ -23357,7 +23524,7 @@ function taskRefKeyFromEntityKey(entityKey) {
23357
23524
  async function listTaskRefs(root) {
23358
23525
  const refs = [];
23359
23526
  for (const namespace of ["local", "shared"]) {
23360
- const directory = path41.join(root, ".mancode", namespace, "workflows");
23527
+ const directory = path42.join(root, ".mancode", namespace, "workflows");
23361
23528
  for (const entry of await readDirectoryOrEmpty(directory)) {
23362
23529
  if (!/^[0-9A-HJKMNP-TV-Z]{26}$/.test(entry)) continue;
23363
23530
  refs.push({ namespace, taskId: entry });
@@ -23370,12 +23537,12 @@ async function listTaskRefs(root) {
23370
23537
  );
23371
23538
  }
23372
23539
  async function listTaskCheckpoints(taskRoot2, taskRef) {
23373
- const directory = path41.join(taskRoot2, "checkpoints");
23540
+ const directory = path42.join(taskRoot2, "checkpoints");
23374
23541
  const checkpoints = [];
23375
23542
  for (const entry of await readDirectoryOrEmpty(directory)) {
23376
23543
  if (!entry.endsWith(".json")) continue;
23377
23544
  const checkpoint = parseCheckpoint(
23378
- JSON.parse(await readRegularFile(path41.join(directory, entry)))
23545
+ JSON.parse(await readRegularFile(path42.join(directory, entry)))
23379
23546
  );
23380
23547
  if (!sameTaskRef(checkpoint.taskRef, taskRef) || entry !== `${checkpoint.checkpointId}.json`) {
23381
23548
  throw new Error("MANCODE_RETENTION_CHECKPOINT_CORRUPT");
@@ -23399,7 +23566,7 @@ function uniqueStores(stores) {
23399
23566
  }
23400
23567
  async function readDirectoryOrEmpty(directory) {
23401
23568
  try {
23402
- const entry = await lstat13(directory);
23569
+ const entry = await lstat14(directory);
23403
23570
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
23404
23571
  throw new Error("MANCODE_RETENTION_PATH_UNSAFE");
23405
23572
  }
@@ -23414,7 +23581,7 @@ async function readDirectoryOrEmpty(directory) {
23414
23581
  async function listRegularFilesRecursively(directory) {
23415
23582
  const files = [];
23416
23583
  for (const entry of await readDirectoryOrEmpty(directory)) {
23417
- const target = path41.join(directory, entry);
23584
+ const target = path42.join(directory, entry);
23418
23585
  const metadata = await lstatOrNull3(target);
23419
23586
  if (metadata === null) continue;
23420
23587
  if (metadata.isSymbolicLink()) {
@@ -23433,12 +23600,12 @@ async function listRegularFilesRecursively(directory) {
23433
23600
  return files;
23434
23601
  }
23435
23602
  async function readRegularFile(target) {
23436
- const before = await lstat13(target);
23603
+ const before = await lstat14(target);
23437
23604
  if (!before.isFile() || before.isSymbolicLink()) {
23438
23605
  throw new Error("MANCODE_RETENTION_PATH_UNSAFE");
23439
23606
  }
23440
23607
  const content = await readFile31(target, "utf8");
23441
- const after = await lstat13(target);
23608
+ const after = await lstat14(target);
23442
23609
  if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
23443
23610
  throw new Error("MANCODE_RETENTION_PATH_UNSAFE");
23444
23611
  }
@@ -23446,7 +23613,7 @@ async function readRegularFile(target) {
23446
23613
  }
23447
23614
  async function removeRegularFile(target) {
23448
23615
  await readRegularFile(target);
23449
- await rm17(target);
23616
+ await rm18(target);
23450
23617
  }
23451
23618
  async function regularFileExists(target) {
23452
23619
  try {
@@ -23467,7 +23634,7 @@ async function regularFileMetadataOrNull(target) {
23467
23634
  }
23468
23635
  async function lstatOrNull3(target) {
23469
23636
  try {
23470
- return await lstat13(target);
23637
+ return await lstat14(target);
23471
23638
  } catch (error) {
23472
23639
  if (isNotFound22(error)) return null;
23473
23640
  throw error;
@@ -23478,8 +23645,8 @@ function isNotFound22(error) {
23478
23645
  }
23479
23646
 
23480
23647
  // src/team/git-ref-cache.ts
23481
- import { lstat as lstat14, mkdir as mkdir29, readFile as readFile32, writeFile as writeFile36 } from "fs/promises";
23482
- import path42 from "path";
23648
+ import { lstat as lstat15, mkdir as mkdir29, readFile as readFile32, writeFile as writeFile37 } from "fs/promises";
23649
+ import path43 from "path";
23483
23650
  var DEFAULT_GIT_REF_FRESHNESS_TTL_MS = 5 * 60 * 1e3;
23484
23651
  async function writeGitRefTeamCache(projectRoot, config, snapshot) {
23485
23652
  const remote = gitRefRemote(config);
@@ -23495,11 +23662,11 @@ async function writeGitRefTeamCache(projectRoot, config, snapshot) {
23495
23662
  });
23496
23663
  const directory = await ensureSafeCacheDirectory(projectRoot);
23497
23664
  const target = gitRefCachePath(projectRoot);
23498
- const temporary = path42.join(
23665
+ const temporary = path43.join(
23499
23666
  directory,
23500
23667
  `.snapshot.${process.pid}.${Date.now()}.tmp`
23501
23668
  );
23502
- await writeFile36(temporary, `${JSON.stringify(cache, null, 2)}
23669
+ await writeFile37(temporary, `${JSON.stringify(cache, null, 2)}
23503
23670
  `, {
23504
23671
  encoding: "utf8",
23505
23672
  flag: "wx"
@@ -23512,14 +23679,14 @@ async function readGitRefTeamCache(projectRoot, config) {
23512
23679
  const target = gitRefCachePath(projectRoot);
23513
23680
  try {
23514
23681
  await assertSafeCacheDirectory(projectRoot);
23515
- const before = await lstat14(target);
23682
+ const before = await lstat15(target);
23516
23683
  if (!before.isFile() || before.isSymbolicLink()) {
23517
23684
  throw new Error("MANCODE_TRANSPORT_CACHE_UNSAFE");
23518
23685
  }
23519
23686
  const cache = parseGitRefTeamCache(
23520
23687
  JSON.parse(await readFile32(target, "utf8"))
23521
23688
  );
23522
- const after = await lstat14(target);
23689
+ const after = await lstat15(target);
23523
23690
  if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
23524
23691
  throw new Error("MANCODE_TRANSPORT_CACHE_CHANGED_DURING_READ");
23525
23692
  }
@@ -23611,11 +23778,11 @@ function parseGitRefTeamCache(value) {
23611
23778
  };
23612
23779
  }
23613
23780
  function gitRefCachePath(projectRoot) {
23614
- return path42.join(gitRefCacheDirectory(projectRoot), "snapshot.json");
23781
+ return path43.join(gitRefCacheDirectory(projectRoot), "snapshot.json");
23615
23782
  }
23616
23783
  function gitRefCacheDirectory(projectRoot) {
23617
- return path42.join(
23618
- path42.resolve(projectRoot),
23784
+ return path43.join(
23785
+ path43.resolve(projectRoot),
23619
23786
  ".mancode",
23620
23787
  "local",
23621
23788
  "cache",
@@ -23661,10 +23828,10 @@ function parseReceiptOrNull(value) {
23661
23828
  return value;
23662
23829
  }
23663
23830
  async function ensureSafeCacheDirectory(projectRoot) {
23664
- const root = path42.resolve(projectRoot);
23831
+ const root = path43.resolve(projectRoot);
23665
23832
  let current = root;
23666
23833
  for (const segment of [".mancode", "local", "cache", "git-ref"]) {
23667
- current = path42.join(current, segment);
23834
+ current = path43.join(current, segment);
23668
23835
  try {
23669
23836
  await mkdir29(current);
23670
23837
  } catch (error) {
@@ -23675,14 +23842,14 @@ async function ensureSafeCacheDirectory(projectRoot) {
23675
23842
  return current;
23676
23843
  }
23677
23844
  async function assertSafeCacheDirectory(projectRoot) {
23678
- let current = path42.resolve(projectRoot);
23845
+ let current = path43.resolve(projectRoot);
23679
23846
  for (const segment of [".mancode", "local", "cache", "git-ref"]) {
23680
- current = path42.join(current, segment);
23847
+ current = path43.join(current, segment);
23681
23848
  await assertDirectoryNotLinked(current);
23682
23849
  }
23683
23850
  }
23684
23851
  async function assertDirectoryNotLinked(directory) {
23685
- const entry = await lstat14(directory);
23852
+ const entry = await lstat15(directory);
23686
23853
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
23687
23854
  throw new Error("MANCODE_TRANSPORT_CACHE_UNSAFE");
23688
23855
  }
@@ -23695,24 +23862,24 @@ function isAlreadyExists17(error) {
23695
23862
  }
23696
23863
 
23697
23864
  // src/team/git-ref-workflow-repair.ts
23698
- import { lstat as lstat18, mkdir as mkdir33, readFile as readFile36, readdir as readdir17, writeFile as writeFile40 } from "fs/promises";
23699
- import path46 from "path";
23865
+ import { lstat as lstat19, mkdir as mkdir33, readFile as readFile36, readdir as readdir17, writeFile as writeFile41 } from "fs/promises";
23866
+ import path47 from "path";
23700
23867
 
23701
23868
  // src/team/git-ref-materialization.ts
23702
23869
  import {
23703
- lstat as lstat17,
23870
+ lstat as lstat18,
23704
23871
  mkdir as mkdir32,
23705
23872
  readFile as readFile35,
23706
23873
  readdir as readdir16,
23707
23874
  unlink as unlink2,
23708
- writeFile as writeFile39
23875
+ writeFile as writeFile40
23709
23876
  } from "fs/promises";
23710
- import path45 from "path";
23877
+ import path46 from "path";
23711
23878
 
23712
23879
  // src/team/git-ref-bundle.ts
23713
23880
  import { execFile as execFileCallback5 } from "child_process";
23714
- import { lstat as lstat15, mkdir as mkdir30, readFile as readFile33, readdir as readdir15, writeFile as writeFile37 } from "fs/promises";
23715
- import path43 from "path";
23881
+ import { lstat as lstat16, mkdir as mkdir30, readFile as readFile33, readdir as readdir15, writeFile as writeFile38 } from "fs/promises";
23882
+ import path44 from "path";
23716
23883
  import { promisify as promisify5 } from "util";
23717
23884
  var execFile5 = promisify5(execFileCallback5);
23718
23885
  function createGitRefTaskBundle(input) {
@@ -23775,7 +23942,7 @@ async function assertGitRefBundleCodeReachable(projectRoot, bundle) {
23775
23942
  "git",
23776
23943
  ["cat-file", "-e", `${parsed.codeRef.head}^{commit}`],
23777
23944
  {
23778
- cwd: path43.resolve(projectRoot),
23945
+ cwd: path44.resolve(projectRoot),
23779
23946
  windowsHide: true
23780
23947
  }
23781
23948
  );
@@ -23788,8 +23955,8 @@ async function quarantineGitRefTaskBundle(projectRoot, remoteRevision, bundle) {
23788
23955
  throw new Error("MANCODE_TRANSPORT_REVISION_INVALID");
23789
23956
  }
23790
23957
  const parsed = parseGitRefTaskBundle(bundle);
23791
- const directory = path43.join(
23792
- path43.resolve(projectRoot),
23958
+ const directory = path44.join(
23959
+ path44.resolve(projectRoot),
23793
23960
  ".mancode",
23794
23961
  "local",
23795
23962
  "quarantine",
@@ -23805,9 +23972,9 @@ async function quarantineGitRefTaskBundle(projectRoot, remoteRevision, bundle) {
23805
23972
  parsed.taskRef.taskId,
23806
23973
  String(remoteRevision)
23807
23974
  ]);
23808
- const target = path43.join(directory, `${parsed.bundleDigest.slice(7)}.json`);
23975
+ const target = path44.join(directory, `${parsed.bundleDigest.slice(7)}.json`);
23809
23976
  try {
23810
- await writeFile37(target, `${JSON.stringify(parsed, null, 2)}
23977
+ await writeFile38(target, `${JSON.stringify(parsed, null, 2)}
23811
23978
  `, {
23812
23979
  encoding: "utf8",
23813
23980
  flag: "wx"
@@ -23822,8 +23989,8 @@ async function readQuarantinedGitRefTaskBundle(projectRoot, remoteRevision, task
23822
23989
  throw new Error("MANCODE_TRANSPORT_REVISION_INVALID");
23823
23990
  }
23824
23991
  const parsedTaskRef = parseTaskRefValue(taskRef);
23825
- const directory = path43.join(
23826
- path43.resolve(projectRoot),
23992
+ const directory = path44.join(
23993
+ path44.resolve(projectRoot),
23827
23994
  ".mancode",
23828
23995
  "local",
23829
23996
  "quarantine",
@@ -23849,15 +24016,15 @@ async function readQuarantinedGitRefTaskBundle(projectRoot, remoteRevision, task
23849
24016
  const matches = [];
23850
24017
  for (const entry of entries.sort()) {
23851
24018
  if (!/^[a-f0-9]{64}\.json$/.test(entry)) continue;
23852
- const target = path43.join(directory, entry);
23853
- const before = await lstat15(target);
24019
+ const target = path44.join(directory, entry);
24020
+ const before = await lstat16(target);
23854
24021
  if (!before.isFile() || before.isSymbolicLink()) {
23855
24022
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
23856
24023
  }
23857
24024
  const bundle = parseGitRefTaskBundle(
23858
24025
  JSON.parse(await readFile33(target, "utf8"))
23859
24026
  );
23860
- const after = await lstat15(target);
24027
+ const after = await lstat16(target);
23861
24028
  if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
23862
24029
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
23863
24030
  }
@@ -23886,25 +24053,25 @@ function parseCodeRef(value) {
23886
24053
  return { branch: value.branch, head: value.head };
23887
24054
  }
23888
24055
  async function ensureFixedDirectory(projectRoot, segments) {
23889
- let current = path43.resolve(projectRoot);
24056
+ let current = path44.resolve(projectRoot);
23890
24057
  for (const segment of segments) {
23891
- current = path43.join(current, segment);
24058
+ current = path44.join(current, segment);
23892
24059
  try {
23893
24060
  await mkdir30(current);
23894
24061
  } catch (error) {
23895
24062
  if (!isAlreadyExists18(error)) throw error;
23896
24063
  }
23897
- const entry = await lstat15(current);
24064
+ const entry = await lstat16(current);
23898
24065
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
23899
24066
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
23900
24067
  }
23901
24068
  }
23902
24069
  }
23903
24070
  async function assertFixedDirectory(projectRoot, segments) {
23904
- let current = path43.resolve(projectRoot);
24071
+ let current = path44.resolve(projectRoot);
23905
24072
  for (const segment of segments) {
23906
- current = path43.join(current, segment);
23907
- const entry = await lstat15(current);
24073
+ current = path44.join(current, segment);
24074
+ const entry = await lstat16(current);
23908
24075
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
23909
24076
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
23910
24077
  }
@@ -23918,22 +24085,22 @@ function isNotFound24(error) {
23918
24085
  }
23919
24086
 
23920
24087
  // src/team/git-ref-task-base.ts
23921
- import { lstat as lstat16, mkdir as mkdir31, readFile as readFile34, writeFile as writeFile38 } from "fs/promises";
23922
- import path44 from "path";
24088
+ import { lstat as lstat17, mkdir as mkdir31, readFile as readFile34, writeFile as writeFile39 } from "fs/promises";
24089
+ import path45 from "path";
23923
24090
  async function readGitRefTaskRemoteBase(projectRoot, taskRef) {
23924
24091
  const parsedTaskRef = parseTaskRefValue(taskRef);
23925
24092
  const runtime = await readProjectRuntimeContext(projectRoot);
23926
24093
  const target = remoteBasePath(projectRoot, parsedTaskRef);
23927
24094
  try {
23928
24095
  await assertRemoteBaseDirectory(projectRoot);
23929
- const before = await lstat16(target);
24096
+ const before = await lstat17(target);
23930
24097
  if (!before.isFile() || before.isSymbolicLink()) {
23931
24098
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
23932
24099
  }
23933
24100
  const state = parseGitRefTaskRemoteBase(
23934
24101
  JSON.parse(await readFile34(target, "utf8"))
23935
24102
  );
23936
- const after = await lstat16(target);
24103
+ const after = await lstat17(target);
23937
24104
  if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
23938
24105
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
23939
24106
  }
@@ -23962,11 +24129,11 @@ async function recordGitRefTaskRemoteBase(projectRoot, remoteRevision, bundle) {
23962
24129
  });
23963
24130
  const directory = await ensureRemoteBaseDirectory(projectRoot);
23964
24131
  const target = remoteBasePath(projectRoot, parsedBundle.taskRef);
23965
- const temporary = path44.join(
24132
+ const temporary = path45.join(
23966
24133
  directory,
23967
24134
  `.${parsedBundle.taskRef.taskId}.${process.pid}.${Date.now()}.tmp`
23968
24135
  );
23969
- await writeFile38(temporary, `${JSON.stringify(state, null, 2)}
24136
+ await writeFile39(temporary, `${JSON.stringify(state, null, 2)}
23970
24137
  `, {
23971
24138
  encoding: "utf8",
23972
24139
  flag: "wx"
@@ -23999,7 +24166,7 @@ function parseGitRefTaskRemoteBase(value) {
23999
24166
  };
24000
24167
  }
24001
24168
  async function ensureRemoteBaseDirectory(projectRoot) {
24002
- let current = path44.resolve(projectRoot);
24169
+ let current = path45.resolve(projectRoot);
24003
24170
  for (const segment of [
24004
24171
  ".mancode",
24005
24172
  "local",
@@ -24007,13 +24174,13 @@ async function ensureRemoteBaseDirectory(projectRoot) {
24007
24174
  "git-ref",
24008
24175
  "remote-bases"
24009
24176
  ]) {
24010
- current = path44.join(current, segment);
24177
+ current = path45.join(current, segment);
24011
24178
  try {
24012
24179
  await mkdir31(current);
24013
24180
  } catch (error) {
24014
24181
  if (!isAlreadyExists19(error)) throw error;
24015
24182
  }
24016
- const entry = await lstat16(current);
24183
+ const entry = await lstat17(current);
24017
24184
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
24018
24185
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
24019
24186
  }
@@ -24021,7 +24188,7 @@ async function ensureRemoteBaseDirectory(projectRoot) {
24021
24188
  return current;
24022
24189
  }
24023
24190
  async function assertRemoteBaseDirectory(projectRoot) {
24024
- let current = path44.resolve(projectRoot);
24191
+ let current = path45.resolve(projectRoot);
24025
24192
  for (const segment of [
24026
24193
  ".mancode",
24027
24194
  "local",
@@ -24029,8 +24196,8 @@ async function assertRemoteBaseDirectory(projectRoot) {
24029
24196
  "git-ref",
24030
24197
  "remote-bases"
24031
24198
  ]) {
24032
- current = path44.join(current, segment);
24033
- const entry = await lstat16(current);
24199
+ current = path45.join(current, segment);
24200
+ const entry = await lstat17(current);
24034
24201
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
24035
24202
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
24036
24203
  }
@@ -24038,8 +24205,8 @@ async function assertRemoteBaseDirectory(projectRoot) {
24038
24205
  }
24039
24206
  function remoteBasePath(projectRoot, taskRef) {
24040
24207
  const parsed = parseTaskRefValue(taskRef);
24041
- return path44.join(
24042
- path44.resolve(projectRoot),
24208
+ return path45.join(
24209
+ path45.resolve(projectRoot),
24043
24210
  ".mancode",
24044
24211
  "local",
24045
24212
  "cache",
@@ -24063,7 +24230,7 @@ function isNotFound25(error) {
24063
24230
 
24064
24231
  // src/team/git-ref-materialization.ts
24065
24232
  async function materializeGitRefTaskBundle(input) {
24066
- const projectRoot = path45.resolve(input.projectRoot);
24233
+ const projectRoot = path46.resolve(input.projectRoot);
24067
24234
  const remoteRevision = positiveInteger3(
24068
24235
  input.remoteRevision,
24069
24236
  "git-ref materialization remoteRevision"
@@ -24369,7 +24536,7 @@ async function replaceVerifiedFile(taskRoot2, relativePath2, targetContent, pred
24369
24536
  const target = safeTaskPath(taskRoot2, relativePath2);
24370
24537
  await ensureSafeDirectory(
24371
24538
  taskRoot2,
24372
- path45.dirname(relativePath2).split(path45.sep)
24539
+ path46.dirname(relativePath2).split(path46.sep)
24373
24540
  );
24374
24541
  const current = await readSafeFileOrNull(target);
24375
24542
  if (contentMatches(relativePath2, current, targetContent)) return;
@@ -24379,11 +24546,11 @@ async function replaceVerifiedFile(taskRoot2, relativePath2, targetContent, pred
24379
24546
  if (current === null && (predecessorContent !== null || alternatePredecessorContent !== null) && relativePath2 !== "summary.md") {
24380
24547
  throw new Error("MANCODE_SPLIT_BRAIN");
24381
24548
  }
24382
- const temporary = path45.join(
24383
- path45.dirname(target),
24384
- `.${path45.basename(target)}.${process.pid}.${Date.now()}.tmp`
24549
+ const temporary = path46.join(
24550
+ path46.dirname(target),
24551
+ `.${path46.basename(target)}.${process.pid}.${Date.now()}.tmp`
24385
24552
  );
24386
- await writeFile39(temporary, targetContent, { encoding: "utf8", flag: "wx" });
24553
+ await writeFile40(temporary, targetContent, { encoding: "utf8", flag: "wx" });
24387
24554
  await replaceFileAtomically(temporary, target);
24388
24555
  }
24389
24556
  function contentMatches(relativePath2, current, expected) {
@@ -24433,12 +24600,12 @@ async function removeVerifiedFile(taskRoot2, relativePath2, predecessorContent)
24433
24600
  }
24434
24601
  async function readSafeFileOrNull(target) {
24435
24602
  try {
24436
- const before = await lstat17(target);
24603
+ const before = await lstat18(target);
24437
24604
  if (!before.isFile() || before.isSymbolicLink()) {
24438
24605
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
24439
24606
  }
24440
24607
  const content = await readFile35(target, "utf8");
24441
- const after = await lstat17(target);
24608
+ const after = await lstat18(target);
24442
24609
  if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
24443
24610
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
24444
24611
  }
@@ -24449,28 +24616,28 @@ async function readSafeFileOrNull(target) {
24449
24616
  }
24450
24617
  }
24451
24618
  async function ensureSafeDirectory(root, segments) {
24452
- let current = path45.resolve(root);
24619
+ let current = path46.resolve(root);
24453
24620
  for (const segment of segments) {
24454
24621
  if (!segment || segment === ".") continue;
24455
24622
  if (segment === ".." || segment.includes("/") || segment.includes("\\")) {
24456
24623
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
24457
24624
  }
24458
- current = path45.join(current, segment);
24625
+ current = path46.join(current, segment);
24459
24626
  try {
24460
24627
  await mkdir32(current);
24461
24628
  } catch (error) {
24462
24629
  if (!isAlreadyExists20(error)) throw error;
24463
24630
  }
24464
- const entry = await lstat17(current);
24631
+ const entry = await lstat18(current);
24465
24632
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
24466
24633
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
24467
24634
  }
24468
24635
  }
24469
24636
  }
24470
24637
  function safeTaskPath(taskRoot2, relativePath2) {
24471
- const target = path45.resolve(taskRoot2, relativePath2);
24472
- const relative = path45.relative(taskRoot2, target);
24473
- if (!relative || relative.startsWith("..") || path45.isAbsolute(relative)) {
24638
+ const target = path46.resolve(taskRoot2, relativePath2);
24639
+ const relative = path46.relative(taskRoot2, target);
24640
+ if (!relative || relative.startsWith("..") || path46.isAbsolute(relative)) {
24474
24641
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
24475
24642
  }
24476
24643
  return target;
@@ -24482,7 +24649,7 @@ async function createJournal(projectRoot, journal) {
24482
24649
  "journals",
24483
24650
  "git-ref-materialize"
24484
24651
  ]);
24485
- await writeFile39(
24652
+ await writeFile40(
24486
24653
  journalPath(projectRoot, journal.operationId),
24487
24654
  serialize11(journal),
24488
24655
  {
@@ -24493,11 +24660,11 @@ async function createJournal(projectRoot, journal) {
24493
24660
  }
24494
24661
  async function replaceJournal(projectRoot, journal) {
24495
24662
  const target = journalPath(projectRoot, journal.operationId);
24496
- const temporary = path45.join(
24497
- path45.dirname(target),
24663
+ const temporary = path46.join(
24664
+ path46.dirname(target),
24498
24665
  `.${journal.operationId}.${process.pid}.${Date.now()}.tmp`
24499
24666
  );
24500
- await writeFile39(temporary, serialize11(journal), {
24667
+ await writeFile40(temporary, serialize11(journal), {
24501
24668
  encoding: "utf8",
24502
24669
  flag: "wx"
24503
24670
  });
@@ -24526,7 +24693,7 @@ async function listJournals(projectRoot) {
24526
24693
  const journals = [];
24527
24694
  for (const entry of entries.sort()) {
24528
24695
  if (!entry.endsWith(".json")) continue;
24529
- journals.push(await readJournal(path45.join(directory, entry)));
24696
+ journals.push(await readJournal(path46.join(directory, entry)));
24530
24697
  }
24531
24698
  return journals;
24532
24699
  }
@@ -24592,8 +24759,8 @@ function result(status2, bundle, localJournalPath, taskHeadFence) {
24592
24759
  };
24593
24760
  }
24594
24761
  function journalDirectory(projectRoot) {
24595
- return path45.join(
24596
- path45.resolve(projectRoot),
24762
+ return path46.join(
24763
+ path46.resolve(projectRoot),
24597
24764
  ".mancode",
24598
24765
  "local",
24599
24766
  "journals",
@@ -24602,7 +24769,7 @@ function journalDirectory(projectRoot) {
24602
24769
  }
24603
24770
  function journalPath(projectRoot, operationId) {
24604
24771
  assertUlid(operationId, "git-ref materialization operationId");
24605
- return path45.join(journalDirectory(projectRoot), `${operationId}.json`);
24772
+ return path46.join(journalDirectory(projectRoot), `${operationId}.json`);
24606
24773
  }
24607
24774
  function serialize11(value) {
24608
24775
  return `${JSON.stringify(value, null, 2)}
@@ -24622,7 +24789,7 @@ function timestamp2(value) {
24622
24789
  }
24623
24790
  async function pathExists3(target) {
24624
24791
  try {
24625
- await lstat17(target);
24792
+ await lstat18(target);
24626
24793
  return true;
24627
24794
  } catch (error) {
24628
24795
  if (isNotFound26(error)) return false;
@@ -24638,7 +24805,7 @@ function isNotFound26(error) {
24638
24805
 
24639
24806
  // src/team/git-ref-workflow-repair.ts
24640
24807
  async function prepareGitRefWorkflowRepair(input) {
24641
- const root = path46.resolve(input.projectRoot);
24808
+ const root = path47.resolve(input.projectRoot);
24642
24809
  const prepared2 = parsePrepared(input.prepared);
24643
24810
  const pendingMetadata = parseWorkflowMetadata(input.pendingMetadata);
24644
24811
  assertPendingMetadata2(prepared2, pendingMetadata);
@@ -24673,7 +24840,7 @@ async function prepareGitRefWorkflowRepair(input) {
24673
24840
  }
24674
24841
  async function recoverGitRefWorkflowRepair(projectRoot, operationId, transportReceipt = null, options = {}) {
24675
24842
  assertUlid(operationId, "git-ref workflow repair operationId");
24676
- const root = path46.resolve(projectRoot);
24843
+ const root = path47.resolve(projectRoot);
24677
24844
  let journal = await requireJournal(root, operationId);
24678
24845
  await assertRecoveryAuthorized(root, journal, options);
24679
24846
  if (journal.state === "committed" || journal.state === "aborted") {
@@ -25040,7 +25207,7 @@ async function createJournal2(projectRoot, journal) {
25040
25207
  await ensureJournalDirectory(projectRoot);
25041
25208
  const target = gitRefWorkflowRepairJournalPath(projectRoot, journal.operationId);
25042
25209
  try {
25043
- await writeFile40(target, serialize12(journal), {
25210
+ await writeFile41(target, serialize12(journal), {
25044
25211
  encoding: "utf8",
25045
25212
  flag: "wx"
25046
25213
  });
@@ -25080,38 +25247,38 @@ function metadataFromBundle(bundle) {
25080
25247
  return parseWorkflowMetadata(artifact2.content);
25081
25248
  }
25082
25249
  function metadataPath2(projectRoot, taskRef) {
25083
- return path46.join(taskRootPath(projectRoot, taskRef), "metadata.json");
25250
+ return path47.join(taskRootPath(projectRoot, taskRef), "metadata.json");
25084
25251
  }
25085
25252
  async function readSafeFile(target) {
25086
- const before = await lstat18(target);
25253
+ const before = await lstat19(target);
25087
25254
  if (!before.isFile() || before.isSymbolicLink()) {
25088
25255
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
25089
25256
  }
25090
25257
  const content = await readFile36(target, "utf8");
25091
- const after = await lstat18(target);
25258
+ const after = await lstat19(target);
25092
25259
  if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
25093
25260
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
25094
25261
  }
25095
25262
  return content;
25096
25263
  }
25097
25264
  async function atomicWrite(target, content) {
25098
- const temporary = path46.join(
25099
- path46.dirname(target),
25100
- `.${path46.basename(target)}.${process.pid}.${Date.now()}.tmp`
25265
+ const temporary = path47.join(
25266
+ path47.dirname(target),
25267
+ `.${path47.basename(target)}.${process.pid}.${Date.now()}.tmp`
25101
25268
  );
25102
- await writeFile40(temporary, content, { encoding: "utf8", flag: "wx" });
25269
+ await writeFile41(temporary, content, { encoding: "utf8", flag: "wx" });
25103
25270
  await replaceFileAtomically(temporary, target);
25104
25271
  }
25105
25272
  async function ensureJournalDirectory(projectRoot) {
25106
- let current = path46.resolve(projectRoot);
25273
+ let current = path47.resolve(projectRoot);
25107
25274
  for (const segment of [".mancode", "local", "journals", "git-ref-workflow"]) {
25108
- current = path46.join(current, segment);
25275
+ current = path47.join(current, segment);
25109
25276
  try {
25110
25277
  await mkdir33(current);
25111
25278
  } catch (error) {
25112
25279
  if (!isAlreadyExists21(error)) throw error;
25113
25280
  }
25114
- const entry = await lstat18(current);
25281
+ const entry = await lstat19(current);
25115
25282
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
25116
25283
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
25117
25284
  }
@@ -25950,19 +26117,19 @@ function parseExpectedRevision2(value) {
25950
26117
 
25951
26118
  // src/commands/design.ts
25952
26119
  import { readFile as readFile38, stat as stat4 } from "fs/promises";
25953
- import path48 from "path";
26120
+ import path49 from "path";
25954
26121
  import process2 from "process";
25955
26122
 
25956
26123
  // src/context/design-policy.ts
25957
26124
  import {
25958
- lstat as lstat19,
26125
+ lstat as lstat20,
25959
26126
  mkdir as mkdir34,
25960
26127
  readFile as readFile37,
25961
26128
  realpath as realpath2,
25962
- rm as rm18,
25963
- writeFile as writeFile41
26129
+ rm as rm19,
26130
+ writeFile as writeFile42
25964
26131
  } from "fs/promises";
25965
- import path47 from "path";
26132
+ import path48 from "path";
25966
26133
  var DEFAULT_DESIGN_POLICY = {
25967
26134
  schemaVersion: 1,
25968
26135
  revision: 0,
@@ -25976,8 +26143,8 @@ var DEFAULT_DESIGN_POLICY = {
25976
26143
  updatedAt: "1970-01-01T00:00:00.000Z"
25977
26144
  };
25978
26145
  function designPolicyPath(projectRoot) {
25979
- return path47.join(
25980
- path47.resolve(projectRoot),
26146
+ return path48.join(
26147
+ path48.resolve(projectRoot),
25981
26148
  ".mancode",
25982
26149
  "shared",
25983
26150
  "context",
@@ -26065,7 +26232,7 @@ async function configureDesignPolicy(input) {
26065
26232
  const operationId = input.operationId ?? createUlid();
26066
26233
  assertUlid(operationId, "design policy operationId");
26067
26234
  const now = input.now ?? /* @__PURE__ */ new Date();
26068
- const root = path47.resolve(input.projectRoot);
26235
+ const root = path48.resolve(input.projectRoot);
26069
26236
  const runtime = await readProjectRuntimeContext(root);
26070
26237
  const store = resolveCoordinationEntityHomeStore(
26071
26238
  runtime.entityHomeStoreContext
@@ -26121,12 +26288,12 @@ function isDesignBrowserValidation(value) {
26121
26288
  }
26122
26289
  async function writeDesignPolicy(projectRoot, policy) {
26123
26290
  const target = designPolicyPath(projectRoot);
26124
- await mkdir34(path47.dirname(target), { recursive: true });
26125
- const temporary = path47.join(
26126
- path47.dirname(target),
26127
- `.${path47.basename(target)}.${process.pid}.${Date.now()}.tmp`
26291
+ await mkdir34(path48.dirname(target), { recursive: true });
26292
+ const temporary = path48.join(
26293
+ path48.dirname(target),
26294
+ `.${path48.basename(target)}.${process.pid}.${Date.now()}.tmp`
26128
26295
  );
26129
- await writeFile41(temporary, `${JSON.stringify(policy, null, 2)}
26296
+ await writeFile42(temporary, `${JSON.stringify(policy, null, 2)}
26130
26297
  `, {
26131
26298
  encoding: "utf8",
26132
26299
  flag: "wx"
@@ -26134,20 +26301,20 @@ async function writeDesignPolicy(projectRoot, policy) {
26134
26301
  try {
26135
26302
  await replaceFileAtomically(temporary, target);
26136
26303
  } finally {
26137
- await rm18(temporary, { force: true }).catch(() => void 0);
26304
+ await rm19(temporary, { force: true }).catch(() => void 0);
26138
26305
  }
26139
26306
  }
26140
26307
  async function assertDesignPolicyPathSafe(projectRoot) {
26141
- const root = path47.resolve(projectRoot);
26308
+ const root = path48.resolve(projectRoot);
26142
26309
  const policyPath = designPolicyPath(root);
26143
- const contextDir = path47.dirname(policyPath);
26310
+ const contextDir = path48.dirname(policyPath);
26144
26311
  try {
26145
26312
  for (const directory of [
26146
- path47.join(root, ".mancode"),
26147
- path47.join(root, ".mancode", "shared"),
26313
+ path48.join(root, ".mancode"),
26314
+ path48.join(root, ".mancode", "shared"),
26148
26315
  contextDir
26149
26316
  ]) {
26150
- const info = await lstat19(directory);
26317
+ const info = await lstat20(directory);
26151
26318
  if (info.isSymbolicLink() || !info.isDirectory()) {
26152
26319
  throw new Error("MANCODE_DESIGN_POLICY_PATH_UNSAFE");
26153
26320
  }
@@ -26156,12 +26323,12 @@ async function assertDesignPolicyPathSafe(projectRoot) {
26156
26323
  realpath2(root),
26157
26324
  realpath2(contextDir)
26158
26325
  ]);
26159
- const relative = path47.relative(resolvedRoot, resolvedContextDir);
26160
- if (path47.isAbsolute(relative) || relative === ".." || relative.startsWith(`..${path47.sep}`)) {
26326
+ const relative = path48.relative(resolvedRoot, resolvedContextDir);
26327
+ if (path48.isAbsolute(relative) || relative === ".." || relative.startsWith(`..${path48.sep}`)) {
26161
26328
  throw new Error("MANCODE_DESIGN_POLICY_PATH_UNSAFE");
26162
26329
  }
26163
26330
  try {
26164
- const info = await lstat19(policyPath);
26331
+ const info = await lstat20(policyPath);
26165
26332
  if (info.isSymbolicLink() || !info.isFile()) {
26166
26333
  throw new Error("MANCODE_DESIGN_POLICY_PATH_UNSAFE");
26167
26334
  }
@@ -26412,7 +26579,7 @@ async function readProfile(rootDir, kind) {
26412
26579
  try {
26413
26580
  return JSON.parse(
26414
26581
  await readFile38(
26415
- path48.join(rootDir, ".mancode", "project-profile.json"),
26582
+ path49.join(rootDir, ".mancode", "project-profile.json"),
26416
26583
  "utf8"
26417
26584
  )
26418
26585
  );
@@ -26421,7 +26588,7 @@ async function readProfile(rootDir, kind) {
26421
26588
  }
26422
26589
  }
26423
26590
  async function readStyleSummary(rootDir, kind) {
26424
- const cachePath = kind === "continuity" ? path48.join(rootDir, ".mancode", "local", "cache", "style-tokens.json") : path48.join(rootDir, ".mancode", "aesthetics", "style-tokens.json");
26591
+ const cachePath = kind === "continuity" ? path49.join(rootDir, ".mancode", "local", "cache", "style-tokens.json") : path49.join(rootDir, ".mancode", "aesthetics", "style-tokens.json");
26425
26592
  try {
26426
26593
  const raw = JSON.parse(await readFile38(cachePath, "utf8"));
26427
26594
  return sanitizeStyleSummary(rootDir, raw);
@@ -26462,7 +26629,7 @@ async function styleFreshness(rootDir, scopeRoot, lastScanned, sourceFiles) {
26462
26629
  const scannedAt = Date.parse(lastScanned);
26463
26630
  for (const file of sourceFiles) {
26464
26631
  try {
26465
- const info = await stat4(path48.resolve(rootDir, scopeRoot, file));
26632
+ const info = await stat4(path49.resolve(rootDir, scopeRoot, file));
26466
26633
  if (info.mtimeMs > scannedAt) return "stale";
26467
26634
  } catch {
26468
26635
  return "stale";
@@ -26539,10 +26706,10 @@ function emptyStyleSummary() {
26539
26706
  };
26540
26707
  }
26541
26708
  async function initializedKind(rootDir) {
26542
- if (await exists(path48.join(rootDir, ".mancode", "schema.json"))) {
26709
+ if (await exists(path49.join(rootDir, ".mancode", "schema.json"))) {
26543
26710
  return "continuity";
26544
26711
  }
26545
- if (await exists(path48.join(rootDir, ".mancode", "state.json")))
26712
+ if (await exists(path49.join(rootDir, ".mancode", "state.json")))
26546
26713
  return "legacy";
26547
26714
  return null;
26548
26715
  }
@@ -26607,7 +26774,7 @@ function safeShortText(value) {
26607
26774
  return typeof value === "string" && value.length <= 100 && /^[A-Za-z0-9@/_. -]+$/.test(value) ? value : null;
26608
26775
  }
26609
26776
  function isSafeRelativeFile(value) {
26610
- return value.length <= 240 && !path48.isAbsolute(value) && !value.includes("\0") && value.split(/[\\/]/).every((part) => part !== "" && part !== "." && part !== "..");
26777
+ return value.length <= 240 && !path49.isAbsolute(value) && !value.includes("\0") && value.split(/[\\/]/).every((part) => part !== "" && part !== "." && part !== "..");
26611
26778
  }
26612
26779
  function parseNonNegativeInteger2(value) {
26613
26780
  if (value === void 0 || !/^\d+$/.test(value)) return null;
@@ -26615,7 +26782,7 @@ function parseNonNegativeInteger2(value) {
26615
26782
  return Number.isSafeInteger(parsed) ? parsed : null;
26616
26783
  }
26617
26784
  function relativePath(rootDir, target) {
26618
- return path48.relative(path48.resolve(rootDir), target).split(path48.sep).join("/");
26785
+ return path49.relative(path49.resolve(rootDir), target).split(path49.sep).join("/");
26619
26786
  }
26620
26787
  function isRecord6(value) {
26621
26788
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -26647,12 +26814,12 @@ function errorCode3(error, fallback) {
26647
26814
  // src/commands/init.ts
26648
26815
  import { promises as fs4 } from "fs";
26649
26816
  import os from "os";
26650
- import path54 from "path";
26817
+ import path55 from "path";
26651
26818
  import process6 from "process";
26652
26819
 
26653
26820
  // src/installers/platform-status.ts
26654
26821
  import { promises as fs } from "fs";
26655
- import path49 from "path";
26822
+ import path50 from "path";
26656
26823
  async function checkPlatformStatus(rootDir, platform, installed) {
26657
26824
  const readiness = await checkPlatformReadiness(rootDir, platform);
26658
26825
  return {
@@ -26669,13 +26836,13 @@ async function checkPlatformReadiness(rootDir, platform) {
26669
26836
  if (platform === "claude-code") {
26670
26837
  const [hasSoloSkill, registered, hasHookFiles] = await Promise.all([
26671
26838
  fileMatches(
26672
- path49.join(rootDir, ".claude", "skills", "solo", "SKILL.md"),
26839
+ path50.join(rootDir, ".claude", "skills", "solo", "SKILL.md"),
26673
26840
  (content) => isGeneratedClaudeSkill(content, "solo")
26674
26841
  ),
26675
26842
  claudeHooksRegistered(rootDir),
26676
26843
  pathsExist([
26677
- path49.join(rootDir, ".mancode", "hooks", "session-start.mjs"),
26678
- path49.join(rootDir, ".mancode", "hooks", "user-prompt-submit.mjs")
26844
+ path50.join(rootDir, ".mancode", "hooks", "session-start.mjs"),
26845
+ path50.join(rootDir, ".mancode", "hooks", "user-prompt-submit.mjs")
26679
26846
  ])
26680
26847
  ]);
26681
26848
  const present = hasSoloSkill && registered && hasHookFiles;
@@ -26691,7 +26858,7 @@ async function checkPlatformReadiness(rootDir, platform) {
26691
26858
  if (platform === "cursor") {
26692
26859
  const hasCoreRules = await allManagedSkills(
26693
26860
  MANCODE_CURSOR_CORE_RULE_FILES.map(
26694
- (file) => path49.join(rootDir, ".cursor", "rules", file)
26861
+ (file) => path50.join(rootDir, ".cursor", "rules", file)
26695
26862
  ),
26696
26863
  [CURSOR_RULE_MANAGED_MARKER]
26697
26864
  );
@@ -26706,13 +26873,13 @@ async function checkPlatformReadiness(rootDir, platform) {
26706
26873
  const [hasRules, hasCommands] = await Promise.all([
26707
26874
  allManagedSkills(
26708
26875
  MANCODE_CURSOR_RULE_FILES.map(
26709
- (file) => path49.join(rootDir, ".cursor", "rules", file)
26876
+ (file) => path50.join(rootDir, ".cursor", "rules", file)
26710
26877
  ),
26711
26878
  [CURSOR_RULE_MANAGED_MARKER]
26712
26879
  ),
26713
26880
  allManagedSkills(
26714
26881
  MODE_NAMES.map(
26715
- (mode) => path49.join(rootDir, ".cursor", "commands", `${mode}.md`)
26882
+ (mode) => path50.join(rootDir, ".cursor", "commands", `${mode}.md`)
26716
26883
  ),
26717
26884
  [MODE_FILE_MANAGED_MARKER]
26718
26885
  )
@@ -26725,7 +26892,7 @@ async function checkPlatformReadiness(rootDir, platform) {
26725
26892
  };
26726
26893
  }
26727
26894
  if (platform === "codex") {
26728
- const hasBlock2 = await fileHasManagedBlock(path49.join(rootDir, "AGENTS.md"));
26895
+ const hasBlock2 = await fileHasManagedBlock(path50.join(rootDir, "AGENTS.md"));
26729
26896
  if (!hasBlock2) {
26730
26897
  return {
26731
26898
  present: false,
@@ -26742,9 +26909,9 @@ async function checkPlatformReadiness(rootDir, platform) {
26742
26909
  readyDetail: "managed block present"
26743
26910
  };
26744
26911
  }
26745
- const skillsDir = path49.join(rootDir, ".agents", "skills");
26912
+ const skillsDir = path50.join(rootDir, ".agents", "skills");
26746
26913
  const hasSkills = await allManagedSkills(
26747
- MODE_NAMES.map((mode) => path49.join(skillsDir, mode, "SKILL.md")),
26914
+ MODE_NAMES.map((mode) => path50.join(skillsDir, mode, "SKILL.md")),
26748
26915
  MANCODE_AGENT_SKILL_MARKERS
26749
26916
  );
26750
26917
  return {
@@ -26756,7 +26923,7 @@ async function checkPlatformReadiness(rootDir, platform) {
26756
26923
  }
26757
26924
  if (platform === "zcode") {
26758
26925
  const hasBlock2 = await fileHasManagedBlock(
26759
- path49.join(rootDir, "AGENTS.md"),
26926
+ path50.join(rootDir, "AGENTS.md"),
26760
26927
  ZCODE_MANCODE_START_MARKER,
26761
26928
  ZCODE_MANCODE_END_MARKER
26762
26929
  );
@@ -26776,9 +26943,9 @@ async function checkPlatformReadiness(rootDir, platform) {
26776
26943
  readyDetail: "managed block present"
26777
26944
  };
26778
26945
  }
26779
- const skillsDir = path49.join(rootDir, ".agents", "skills");
26946
+ const skillsDir = path50.join(rootDir, ".agents", "skills");
26780
26947
  const hasSkills = await allManagedSkills(
26781
- MODE_NAMES.map((mode) => path49.join(skillsDir, mode, "SKILL.md")),
26948
+ MODE_NAMES.map((mode) => path50.join(skillsDir, mode, "SKILL.md")),
26782
26949
  MANCODE_AGENT_SKILL_MARKERS
26783
26950
  );
26784
26951
  return {
@@ -26790,7 +26957,7 @@ async function checkPlatformReadiness(rootDir, platform) {
26790
26957
  }
26791
26958
  if (platform === "kimi-code") {
26792
26959
  const hasBlock2 = await fileHasManagedBlock(
26793
- path49.join(rootDir, "AGENTS.md"),
26960
+ path50.join(rootDir, "AGENTS.md"),
26794
26961
  KIMI_MANCODE_START_MARKER,
26795
26962
  KIMI_MANCODE_END_MARKER
26796
26963
  );
@@ -26810,9 +26977,9 @@ async function checkPlatformReadiness(rootDir, platform) {
26810
26977
  readyDetail: "managed block present"
26811
26978
  };
26812
26979
  }
26813
- const skillsDir = path49.join(rootDir, ".agents", "skills");
26980
+ const skillsDir = path50.join(rootDir, ".agents", "skills");
26814
26981
  const hasSkills = await allManagedSkills(
26815
- MODE_NAMES.map((mode) => path49.join(skillsDir, mode, "SKILL.md")),
26982
+ MODE_NAMES.map((mode) => path50.join(skillsDir, mode, "SKILL.md")),
26816
26983
  MANCODE_AGENT_SKILL_MARKERS
26817
26984
  );
26818
26985
  return {
@@ -26824,7 +26991,7 @@ async function checkPlatformReadiness(rootDir, platform) {
26824
26991
  }
26825
26992
  if (platform === "qoder") {
26826
26993
  const hasBlock2 = await fileHasManagedBlock(
26827
- path49.join(rootDir, "AGENTS.md"),
26994
+ path50.join(rootDir, "AGENTS.md"),
26828
26995
  QODER_MANCODE_START_MARKER,
26829
26996
  QODER_MANCODE_END_MARKER
26830
26997
  );
@@ -26844,9 +27011,9 @@ async function checkPlatformReadiness(rootDir, platform) {
26844
27011
  readyDetail: "managed block present"
26845
27012
  };
26846
27013
  }
26847
- const commandsDir = path49.join(rootDir, ".qoder", "commands");
27014
+ const commandsDir = path50.join(rootDir, ".qoder", "commands");
26848
27015
  const hasCommands = await allManagedSkills(
26849
- MODE_NAMES.map((mode) => path49.join(commandsDir, `${mode}.md`)),
27016
+ MODE_NAMES.map((mode) => path50.join(commandsDir, `${mode}.md`)),
26850
27017
  [MODE_FILE_MANAGED_MARKER]
26851
27018
  );
26852
27019
  return {
@@ -26856,8 +27023,42 @@ async function checkPlatformReadiness(rootDir, platform) {
26856
27023
  readyDetail: hasCommands ? "managed block and commands present" : "mode commands are missing, incomplete, or user-authored"
26857
27024
  };
26858
27025
  }
27026
+ if (platform === "dsh") {
27027
+ const hasBlock2 = await fileHasManagedBlock(
27028
+ path50.join(rootDir, "AGENTS.md"),
27029
+ DSH_MANCODE_START_MARKER,
27030
+ DSH_MANCODE_END_MARKER
27031
+ );
27032
+ if (!hasBlock2) {
27033
+ return {
27034
+ present: false,
27035
+ ready: false,
27036
+ target: "AGENTS.md",
27037
+ readyDetail: "managed block missing"
27038
+ };
27039
+ }
27040
+ if (await isPlatformMinimal(rootDir, "dsh")) {
27041
+ return {
27042
+ present: true,
27043
+ ready: true,
27044
+ target: "AGENTS.md",
27045
+ readyDetail: "managed block present"
27046
+ };
27047
+ }
27048
+ const skillsDir = path50.join(rootDir, ".dsh", "skills");
27049
+ const hasSkills = await allManagedSkills(
27050
+ MODE_NAMES.map((mode) => path50.join(skillsDir, mode, "SKILL.md")),
27051
+ MANCODE_DSH_SKILL_MARKERS
27052
+ );
27053
+ return {
27054
+ present: true,
27055
+ ready: hasSkills,
27056
+ target: "AGENTS.md + .dsh/skills/",
27057
+ readyDetail: hasSkills ? "managed block and skills present" : "mode skills are missing, incomplete, or user-authored"
27058
+ };
27059
+ }
26859
27060
  const hasBlock = await fileHasManagedBlock(
26860
- path49.join(rootDir, ".github", "copilot-instructions.md")
27061
+ path50.join(rootDir, ".github", "copilot-instructions.md")
26861
27062
  );
26862
27063
  if (!hasBlock) {
26863
27064
  return {
@@ -26868,9 +27069,9 @@ async function checkPlatformReadiness(rootDir, platform) {
26868
27069
  };
26869
27070
  }
26870
27071
  if (!await isPlatformMinimal(rootDir, "copilot")) {
26871
- const promptsDir = path49.join(rootDir, ".github", "prompts");
27072
+ const promptsDir = path50.join(rootDir, ".github", "prompts");
26872
27073
  const hasPrompts = await allManagedSkills(
26873
- MODE_NAMES.map((mode) => path49.join(promptsDir, `${mode}.prompt.md`)),
27074
+ MODE_NAMES.map((mode) => path50.join(promptsDir, `${mode}.prompt.md`)),
26874
27075
  [MODE_FILE_MANAGED_MARKER]
26875
27076
  );
26876
27077
  return {
@@ -26903,13 +27104,13 @@ async function allManagedSkills(paths, markers) {
26903
27104
  async function claudeFullContentReady(rootDir) {
26904
27105
  const skillChecks = MVP2_SKILLS.map(
26905
27106
  (skill) => fileMatches(
26906
- path49.join(rootDir, ".claude", "skills", skill.name, "SKILL.md"),
27107
+ path50.join(rootDir, ".claude", "skills", skill.name, "SKILL.md"),
26907
27108
  (content) => isGeneratedClaudeSkill(content, skill.name)
26908
27109
  )
26909
27110
  );
26910
27111
  const agentChecks = ALL_AGENTS.map(
26911
27112
  (agent) => fileMatches(
26912
- path49.join(rootDir, ".claude", "agents", `${agent.name}.md`),
27113
+ path50.join(rootDir, ".claude", "agents", `${agent.name}.md`),
26913
27114
  (content) => isGeneratedClaudeAgent(content, agent.name)
26914
27115
  )
26915
27116
  );
@@ -26937,7 +27138,7 @@ async function fileHasAnyMarker(filePath, needles) {
26937
27138
  async function isPlatformMinimal(rootDir, platform) {
26938
27139
  try {
26939
27140
  const raw = await fs.readFile(
26940
- path49.join(rootDir, ".mancode", "config.json"),
27141
+ path50.join(rootDir, ".mancode", "config.json"),
26941
27142
  "utf-8"
26942
27143
  );
26943
27144
  const config = JSON.parse(raw);
@@ -26959,7 +27160,7 @@ async function fileHasManagedBlock(filePath, startMarker = DEFAULT_MANCODE_START
26959
27160
  async function claudeHooksRegistered(rootDir) {
26960
27161
  try {
26961
27162
  const raw = await fs.readFile(
26962
- path49.join(rootDir, ".claude", "settings.json"),
27163
+ path50.join(rootDir, ".claude", "settings.json"),
26963
27164
  "utf-8"
26964
27165
  );
26965
27166
  const settings = JSON.parse(raw);
@@ -27002,7 +27203,7 @@ function isRecord7(value) {
27002
27203
  // src/system/detect-team.ts
27003
27204
  import { execFile as execFile6 } from "child_process";
27004
27205
  import { access as access2 } from "fs/promises";
27005
- import path50 from "path";
27206
+ import path51 from "path";
27006
27207
  import process3 from "process";
27007
27208
  import { promisify as promisify6 } from "util";
27008
27209
  var execFileAsync = promisify6(execFile6);
@@ -27112,7 +27313,7 @@ async function anyPathExists(projectRoot, candidates) {
27112
27313
  const results = await Promise.all(
27113
27314
  candidates.map(async (candidate) => {
27114
27315
  try {
27115
- await access2(path50.join(projectRoot, candidate));
27316
+ await access2(path51.join(projectRoot, candidate));
27116
27317
  return true;
27117
27318
  } catch {
27118
27319
  return false;
@@ -27153,7 +27354,7 @@ async function detectSystemDeps(env = process4.env) {
27153
27354
  // src/system/init-onboarding.ts
27154
27355
  import { execFileSync } from "child_process";
27155
27356
  import { promises as fs2 } from "fs";
27156
- import path51 from "path";
27357
+ import path52 from "path";
27157
27358
  import process5 from "process";
27158
27359
  import { stdin, stdout } from "process";
27159
27360
  import { createInterface } from "readline/promises";
@@ -27256,9 +27457,10 @@ async function detectPlatformHints(rootDir, environment = process5.env) {
27256
27457
  if (environment.CURSOR_TRACE_ID) hints.add("cursor");
27257
27458
  if (environment.COPILOT_AGENT || environment.GITHUB_COPILOT)
27258
27459
  hints.add("copilot");
27460
+ if (environment.DSH_SHELL === "1") hints.add("dsh");
27259
27461
  const exists2 = async (relative) => {
27260
27462
  try {
27261
- await fs2.access(path51.join(rootDir, relative));
27463
+ await fs2.access(path52.join(rootDir, relative));
27262
27464
  return true;
27263
27465
  } catch {
27264
27466
  return false;
@@ -27268,6 +27470,7 @@ async function detectPlatformHints(rootDir, environment = process5.env) {
27268
27470
  if (await exists2(".cursor")) hints.add("cursor");
27269
27471
  if (await exists2(".github/copilot-instructions.md")) hints.add("copilot");
27270
27472
  if (await exists2(".qoder")) hints.add("qoder");
27473
+ if (await exists2(".dsh")) hints.add("dsh");
27271
27474
  return ALL_PLATFORMS.filter((platform) => hints.has(platform));
27272
27475
  }
27273
27476
  function createTerminalPrompter() {
@@ -27335,7 +27538,7 @@ function createTerminalPrompter() {
27335
27538
 
27336
27539
  // src/system/scan-aesthetics.ts
27337
27540
  import { promises as fs3 } from "fs";
27338
- import path52 from "path";
27541
+ import path53 from "path";
27339
27542
  var MAX_COMPONENT_SCAN_DEPTH = 12;
27340
27543
  var MAX_COMPONENT_FILES = 2e3;
27341
27544
  async function scanAesthetics(projectRoot, uiLibrary = null, scopeRoot = ".") {
@@ -27371,7 +27574,7 @@ async function scanAesthetics(projectRoot, uiLibrary = null, scopeRoot = ".") {
27371
27574
  } else if (await hasTailwindDep(projectRoot) || uiLibrary) {
27372
27575
  matchLevel = "low";
27373
27576
  }
27374
- if (uiLibrary && await pathExists5(path52.join(projectRoot, "package.json"))) {
27577
+ if (uiLibrary && await pathExists5(path53.join(projectRoot, "package.json"))) {
27375
27578
  sourceFiles.push("package.json");
27376
27579
  }
27377
27580
  sourceFiles.push(...cssScan.sourceFiles);
@@ -27397,7 +27600,7 @@ async function findTailwindConfig(projectRoot) {
27397
27600
  "tailwind.config.mjs"
27398
27601
  ];
27399
27602
  for (const name of candidates) {
27400
- const absPath = path52.join(projectRoot, name);
27603
+ const absPath = path53.join(projectRoot, name);
27401
27604
  if (await pathExists5(absPath)) {
27402
27605
  return { absPath, relPath: name };
27403
27606
  }
@@ -27624,7 +27827,7 @@ async function scanComponents(projectRoot) {
27624
27827
  const names = /* @__PURE__ */ new Set();
27625
27828
  let visitedFiles = 0;
27626
27829
  for (const relRoot of roots) {
27627
- const absRoot = path52.join(projectRoot, relRoot);
27830
+ const absRoot = path53.join(projectRoot, relRoot);
27628
27831
  if (!await pathExists5(absRoot)) continue;
27629
27832
  visitedFiles = await collectComponentNames(absRoot, names, 0, visitedFiles);
27630
27833
  if (visitedFiles >= MAX_COMPONENT_FILES) break;
@@ -27644,7 +27847,7 @@ async function collectComponentNames(dir, names, depth, visitedFiles) {
27644
27847
  }
27645
27848
  for (const entry of entries) {
27646
27849
  if (fileCount >= MAX_COMPONENT_FILES) return fileCount;
27647
- const abs = path52.join(dir, entry);
27850
+ const abs = path53.join(dir, entry);
27648
27851
  let info;
27649
27852
  try {
27650
27853
  info = await fs3.lstat(abs);
@@ -27665,7 +27868,7 @@ async function collectComponentNames(dir, names, depth, visitedFiles) {
27665
27868
  ""
27666
27869
  );
27667
27870
  if (base === "index") {
27668
- base = path52.basename(dir);
27871
+ base = path53.basename(dir);
27669
27872
  }
27670
27873
  if (base.startsWith(".")) continue;
27671
27874
  const componentName = toPascalCase(base);
@@ -27687,7 +27890,7 @@ async function scanCssVariables(projectRoot) {
27687
27890
  const variables = {};
27688
27891
  const sourceFiles = [];
27689
27892
  for (const relPath of candidates) {
27690
- const absPath = path52.join(projectRoot, relPath);
27893
+ const absPath = path53.join(projectRoot, relPath);
27691
27894
  if (!await pathExists5(absPath)) continue;
27692
27895
  const content = await fs3.readFile(absPath, "utf-8");
27693
27896
  const found = extractCssVariables(content);
@@ -27733,7 +27936,7 @@ function toPascalCase(value) {
27733
27936
  async function hasTailwindDep(projectRoot) {
27734
27937
  try {
27735
27938
  const raw = await fs3.readFile(
27736
- path52.join(projectRoot, "package.json"),
27939
+ path53.join(projectRoot, "package.json"),
27737
27940
  "utf-8"
27738
27941
  );
27739
27942
  const pkg = JSON.parse(raw);
@@ -27758,15 +27961,15 @@ async function pathExists5(p) {
27758
27961
 
27759
27962
  // src/context/greenfield-init.ts
27760
27963
  import {
27761
- lstat as lstat20,
27964
+ lstat as lstat21,
27762
27965
  mkdir as mkdir35,
27763
27966
  readFile as readFile39,
27764
- rename as rename11,
27765
- rm as rm19,
27766
- writeFile as writeFile42
27967
+ rename as rename12,
27968
+ rm as rm20,
27969
+ writeFile as writeFile43
27767
27970
  } from "fs/promises";
27768
- import path53 from "path";
27769
- var JOURNAL_RELATIVE_DIRECTORY = path53.join(
27971
+ import path54 from "path";
27972
+ var JOURNAL_RELATIVE_DIRECTORY = path54.join(
27770
27973
  "local",
27771
27974
  "runtime",
27772
27975
  "initialization"
@@ -27815,7 +28018,7 @@ async function stageGreenfieldInitialization(input) {
27815
28018
  operationId: normalized.operationId,
27816
28019
  workspaceId: normalized.workspaceId,
27817
28020
  state: "staged",
27818
- stagingDirectoryName: path53.basename(stagingRoot),
28021
+ stagingDirectoryName: path54.basename(stagingRoot),
27819
28022
  targetDirectoryName: ".mancode",
27820
28023
  manifestDigest: digestCanonicalJson(manifest),
27821
28024
  configDigest: digestCanonicalJson(config),
@@ -27846,7 +28049,7 @@ async function stageGreenfieldInitialization(input) {
27846
28049
  return journal;
27847
28050
  }
27848
28051
  async function publishGreenfieldInitialization(input) {
27849
- const root = path53.resolve(input.projectRoot);
28052
+ const root = path54.resolve(input.projectRoot);
27850
28053
  assertUlid(input.operationId, "greenfield operationId");
27851
28054
  const stagingRoot = greenfieldStagingPath(root, input.operationId);
27852
28055
  const targetRoot = greenfieldTargetPath(root);
@@ -27864,7 +28067,7 @@ async function publishGreenfieldInitialization(input) {
27864
28067
  if (await lstatOrNull4(targetRoot) !== null) {
27865
28068
  throw new Error("MANCODE_V3_TARGET_EXISTS");
27866
28069
  }
27867
- await rename11(stagingRoot, targetRoot);
28070
+ await rename12(stagingRoot, targetRoot);
27868
28071
  throwIfOperationCrashInjected("greenfield_initialize", "publish-v3-root");
27869
28072
  return finishPublishedInitialization(
27870
28073
  { ...input, projectRoot: root },
@@ -27881,10 +28084,10 @@ async function initializeGreenfield(input, publication) {
27881
28084
  }
27882
28085
  function greenfieldStagingPath(projectRoot, operationId) {
27883
28086
  assertUlid(operationId, "greenfield operationId");
27884
- return path53.join(path53.resolve(projectRoot), `.mancode.init-${operationId}`);
28087
+ return path54.join(path54.resolve(projectRoot), `.mancode.init-${operationId}`);
27885
28088
  }
27886
28089
  function greenfieldTargetPath(projectRoot) {
27887
- return path53.join(path53.resolve(projectRoot), ".mancode");
28090
+ return path54.join(path54.resolve(projectRoot), ".mancode");
27888
28091
  }
27889
28092
  function parseGreenfieldInitializationJournal(value) {
27890
28093
  assertRecord(value, "greenfield initialization journal");
@@ -28020,7 +28223,7 @@ async function finishPublishedInitialization(input, stagedJournal) {
28020
28223
  activatedAt: (input.now ?? /* @__PURE__ */ new Date()).toISOString()
28021
28224
  };
28022
28225
  assertSchemaManifestTransition(manifest, activeManifest);
28023
- await writeJson(path53.join(targetRoot, "schema.json"), activeManifest);
28226
+ await writeJson(path54.join(targetRoot, "schema.json"), activeManifest);
28024
28227
  throwIfOperationCrashInjected(
28025
28228
  "greenfield_initialize",
28026
28229
  "activate-v3-manifest"
@@ -28036,45 +28239,45 @@ async function finishPublishedInitialization(input, stagedJournal) {
28036
28239
  }
28037
28240
  async function writeGreenfieldLayout(stagingRoot, manifest, config, policy, projectFacts, journal) {
28038
28241
  await Promise.all([
28039
- mkdir35(path53.join(stagingRoot, "shared", "context"), { recursive: true }),
28040
- mkdir35(path53.join(stagingRoot, "shared", "memory", "decisions"), {
28242
+ mkdir35(path54.join(stagingRoot, "shared", "context"), { recursive: true }),
28243
+ mkdir35(path54.join(stagingRoot, "shared", "memory", "decisions"), {
28041
28244
  recursive: true
28042
28245
  }),
28043
- mkdir35(path53.join(stagingRoot, "shared", "team", "actors"), {
28246
+ mkdir35(path54.join(stagingRoot, "shared", "team", "actors"), {
28044
28247
  recursive: true
28045
28248
  }),
28046
- mkdir35(path53.join(stagingRoot, "shared", "team", "handoffs"), {
28249
+ mkdir35(path54.join(stagingRoot, "shared", "team", "handoffs"), {
28047
28250
  recursive: true
28048
28251
  }),
28049
- mkdir35(path53.join(stagingRoot, "shared", "team", "events"), {
28252
+ mkdir35(path54.join(stagingRoot, "shared", "team", "events"), {
28050
28253
  recursive: true
28051
28254
  }),
28052
- mkdir35(path53.join(stagingRoot, "shared", "team", "transport"), {
28255
+ mkdir35(path54.join(stagingRoot, "shared", "team", "transport"), {
28053
28256
  recursive: true
28054
28257
  }),
28055
- mkdir35(path53.join(stagingRoot, "local", "sessions"), { recursive: true }),
28056
- mkdir35(path53.join(stagingRoot, JOURNAL_RELATIVE_DIRECTORY), {
28258
+ mkdir35(path54.join(stagingRoot, "local", "sessions"), { recursive: true }),
28259
+ mkdir35(path54.join(stagingRoot, JOURNAL_RELATIVE_DIRECTORY), {
28057
28260
  recursive: true
28058
28261
  }),
28059
- mkdir35(path53.join(stagingRoot, "local", "workflows"), { recursive: true }),
28060
- mkdir35(path53.join(stagingRoot, "local", "quarantine"), { recursive: true }),
28061
- mkdir35(path53.join(stagingRoot, "local", "publish"), { recursive: true }),
28062
- mkdir35(path53.join(stagingRoot, "local", "cache"), { recursive: true }),
28063
- mkdir35(path53.join(stagingRoot, "runtime", "non-git", journal.workspaceId), {
28262
+ mkdir35(path54.join(stagingRoot, "local", "workflows"), { recursive: true }),
28263
+ mkdir35(path54.join(stagingRoot, "local", "quarantine"), { recursive: true }),
28264
+ mkdir35(path54.join(stagingRoot, "local", "publish"), { recursive: true }),
28265
+ mkdir35(path54.join(stagingRoot, "local", "cache"), { recursive: true }),
28266
+ mkdir35(path54.join(stagingRoot, "runtime", "non-git", journal.workspaceId), {
28064
28267
  recursive: true
28065
28268
  })
28066
28269
  ]);
28067
28270
  await Promise.all([
28068
- writeJson(path53.join(stagingRoot, "schema.json"), manifest),
28069
- writeJson(path53.join(stagingRoot, "shared", "config.json"), config),
28070
- writeJson(path53.join(stagingRoot, "shared", "team", "policy.json"), policy),
28271
+ writeJson(path54.join(stagingRoot, "schema.json"), manifest),
28272
+ writeJson(path54.join(stagingRoot, "shared", "config.json"), config),
28273
+ writeJson(path54.join(stagingRoot, "shared", "team", "policy.json"), policy),
28071
28274
  writeJson(
28072
- path53.join(stagingRoot, "shared", "context", "project.json"),
28275
+ path54.join(stagingRoot, "shared", "context", "project.json"),
28073
28276
  projectFacts
28074
28277
  ),
28075
28278
  writeJson(journalPath2(stagingRoot, journal.operationId), journal),
28076
- writeFile42(
28077
- path53.join(stagingRoot, ".gitignore"),
28279
+ writeFile43(
28280
+ path54.join(stagingRoot, ".gitignore"),
28078
28281
  `${V3_IGNORE.join("\n")}
28079
28282
  `,
28080
28283
  { encoding: "utf8", flag: "wx" }
@@ -28099,7 +28302,7 @@ async function readGreenfieldJournal(root, operationId) {
28099
28302
  async function readManifest(root) {
28100
28303
  try {
28101
28304
  return parseSchemaManifest(
28102
- JSON.parse(await readFile39(path53.join(root, "schema.json"), "utf8"))
28305
+ JSON.parse(await readFile39(path54.join(root, "schema.json"), "utf8"))
28103
28306
  );
28104
28307
  } catch (error) {
28105
28308
  if (error instanceof SyntaxError || isNotFound29(error)) {
@@ -28137,7 +28340,7 @@ async function readConfig(root) {
28137
28340
  try {
28138
28341
  config = parseProjectConfig(
28139
28342
  JSON.parse(
28140
- await readFile39(path53.join(root, "shared", "config.json"), "utf8")
28343
+ await readFile39(path54.join(root, "shared", "config.json"), "utf8")
28141
28344
  )
28142
28345
  );
28143
28346
  } catch (error) {
@@ -28154,7 +28357,7 @@ async function readPolicy(root) {
28154
28357
  policy = parseTeamPolicy(
28155
28358
  JSON.parse(
28156
28359
  await readFile39(
28157
- path53.join(root, "shared", "team", "policy.json"),
28360
+ path54.join(root, "shared", "team", "policy.json"),
28158
28361
  "utf8"
28159
28362
  )
28160
28363
  )
@@ -28172,7 +28375,7 @@ async function readProjectFactsAt(root) {
28172
28375
  return parseProjectFacts(
28173
28376
  JSON.parse(
28174
28377
  await readFile39(
28175
- path53.join(root, "shared", "context", "project.json"),
28378
+ path54.join(root, "shared", "context", "project.json"),
28176
28379
  "utf8"
28177
28380
  )
28178
28381
  )
@@ -28211,7 +28414,7 @@ function normalizeInput(input) {
28211
28414
  parseSchemaManifest(manifest);
28212
28415
  return {
28213
28416
  ...input,
28214
- projectRoot: path53.resolve(input.projectRoot),
28417
+ projectRoot: path54.resolve(input.projectRoot),
28215
28418
  projectConfig: config,
28216
28419
  teamPolicy: policy,
28217
28420
  projectFacts: input.projectFacts === void 0 ? void 0 : parseProjectFacts(input.projectFacts)
@@ -28309,21 +28512,21 @@ function initializationProjectFacts(input, now) {
28309
28512
  }
28310
28513
  function journalPath2(root, operationId) {
28311
28514
  assertUlid(operationId, "greenfield operationId");
28312
- return path53.join(root, JOURNAL_RELATIVE_DIRECTORY, `${operationId}.json`);
28515
+ return path54.join(root, JOURNAL_RELATIVE_DIRECTORY, `${operationId}.json`);
28313
28516
  }
28314
28517
  async function writeJson(target, value) {
28315
- const directory = path53.dirname(target);
28518
+ const directory = path54.dirname(target);
28316
28519
  await mkdir35(directory, { recursive: true });
28317
- const temporary = path53.join(
28520
+ const temporary = path54.join(
28318
28521
  directory,
28319
- `.${path53.basename(target)}.${process.pid}.${Date.now()}.tmp`
28522
+ `.${path54.basename(target)}.${process.pid}.${Date.now()}.tmp`
28320
28523
  );
28321
- await writeFile42(temporary, `${JSON.stringify(value, null, 2)}
28524
+ await writeFile43(temporary, `${JSON.stringify(value, null, 2)}
28322
28525
  `, {
28323
28526
  encoding: "utf8",
28324
28527
  flag: "wx"
28325
28528
  });
28326
- await rename11(temporary, target);
28529
+ await rename12(temporary, target);
28327
28530
  }
28328
28531
  function parseDigest6(value, label) {
28329
28532
  if (typeof value !== "string" || !/^sha256:[a-f0-9]{64}$/.test(value)) {
@@ -28342,7 +28545,7 @@ function isState(value) {
28342
28545
  }
28343
28546
  async function lstatOrNull4(target) {
28344
28547
  try {
28345
- return await lstat20(target);
28548
+ return await lstat21(target);
28346
28549
  } catch (error) {
28347
28550
  if (isNotFound29(error)) return null;
28348
28551
  throw error;
@@ -28436,9 +28639,9 @@ async function init(rootDir = process6.cwd(), options = {}) {
28436
28639
  return EXIT_INIT_FAILED;
28437
28640
  }
28438
28641
  const authority = resolveInitAuthority(options);
28439
- const mancodeDir = path54.join(rootDir, ".mancode");
28440
- const stateFile = path54.join(mancodeDir, "state.json");
28441
- const v3SchemaFile = path54.join(mancodeDir, "schema.json");
28642
+ const mancodeDir = path55.join(rootDir, ".mancode");
28643
+ const stateFile = path55.join(mancodeDir, "state.json");
28644
+ const v3SchemaFile = path55.join(mancodeDir, "schema.json");
28442
28645
  const wasInitialized = await pathExists6(stateFile);
28443
28646
  let mutationSnapshots = [];
28444
28647
  let directorySnapshots = [];
@@ -28506,7 +28709,7 @@ async function init(rootDir = process6.cwd(), options = {}) {
28506
28709
  }
28507
28710
  return initializeV3(rootDir, options);
28508
28711
  }
28509
- const isGitRepo = await pathExists6(path54.join(rootDir, ".git"));
28712
+ const isGitRepo = await pathExists6(path55.join(rootDir, ".git"));
28510
28713
  const hasManifest = await hasProjectManifest(rootDir);
28511
28714
  let isGenericProject = false;
28512
28715
  if (!isGitRepo && !hasManifest) {
@@ -28624,8 +28827,8 @@ async function init(rootDir = process6.cwd(), options = {}) {
28624
28827
  const managedFiles = getInitManagedFilePaths(rootDir, selectedPlatforms);
28625
28828
  mutationSnapshots = await snapshotFiles(managedFiles);
28626
28829
  directorySnapshots = await snapshotDirectories(managedFiles, [
28627
- path54.join(mancodeDir, "workflows"),
28628
- path54.join(mancodeDir, "preseason-reports")
28830
+ path55.join(mancodeDir, "workflows"),
28831
+ path55.join(mancodeDir, "preseason-reports")
28629
28832
  ]);
28630
28833
  const team = await detectTeamStatus(rootDir);
28631
28834
  const platformMinimal = Object.fromEntries(
@@ -28686,7 +28889,7 @@ async function init(rootDir = process6.cwd(), options = {}) {
28686
28889
  `;
28687
28890
  await fs4.writeFile(stateFile, stateContent, "utf-8");
28688
28891
  await fs4.writeFile(
28689
- path54.join(mancodeDir, "project-profile.json"),
28892
+ path55.join(mancodeDir, "project-profile.json"),
28690
28893
  `${JSON.stringify(profile, null, 2)}
28691
28894
  `,
28692
28895
  "utf-8"
@@ -28723,7 +28926,7 @@ async function init(rootDir = process6.cwd(), options = {}) {
28723
28926
  )
28724
28927
  );
28725
28928
  const tokens = await scanAesthetics(rootDir, uiLibrary);
28726
- const tokensPath = path54.join(
28929
+ const tokensPath = path55.join(
28727
28930
  mancodeDir,
28728
28931
  "aesthetics",
28729
28932
  "style-tokens.json"
@@ -28887,7 +29090,7 @@ async function initializeV3(rootDir, options) {
28887
29090
  );
28888
29091
  return EXIT_INIT_FAILED;
28889
29092
  }
28890
- const schemaPath = path54.join(rootDir, ".mancode", "schema.json");
29093
+ const schemaPath = path55.join(rootDir, ".mancode", "schema.json");
28891
29094
  let existingV3 = false;
28892
29095
  let registeredAdapters = /* @__PURE__ */ new Set();
28893
29096
  if (await pathExists6(schemaPath)) {
@@ -28990,7 +29193,7 @@ function printV3InitError(error) {
28990
29193
  }
28991
29194
  }
28992
29195
  async function updateConfigOptions(mancodeDir, patch, preserveInstalledPlatforms) {
28993
- const configPath = path54.join(mancodeDir, "config.json");
29196
+ const configPath = path55.join(mancodeDir, "config.json");
28994
29197
  let config = {};
28995
29198
  try {
28996
29199
  config = JSON.parse(await fs4.readFile(configPath, "utf-8"));
@@ -29023,7 +29226,7 @@ async function updateConfigOptions(mancodeDir, patch, preserveInstalledPlatforms
29023
29226
  async function readExistingInitPreferences(mancodeDir) {
29024
29227
  try {
29025
29228
  const config = JSON.parse(
29026
- await fs4.readFile(path54.join(mancodeDir, "config.json"), "utf-8")
29229
+ await fs4.readFile(path55.join(mancodeDir, "config.json"), "utf-8")
29027
29230
  );
29028
29231
  const preferences = {
29029
29232
  platforms: Array.isArray(config.platforms) ? config.platforms.filter(
@@ -29089,13 +29292,13 @@ async function selectInitPlatforms(input) {
29089
29292
  }
29090
29293
  async function hasProjectManifest(rootDir) {
29091
29294
  for (const name of PROJECT_MANIFESTS) {
29092
- if (await pathExists6(path54.join(rootDir, name))) return true;
29295
+ if (await pathExists6(path55.join(rootDir, name))) return true;
29093
29296
  }
29094
29297
  return false;
29095
29298
  }
29096
29299
  async function canInitializeGenericProject(rootDir) {
29097
- const resolved = path54.resolve(rootDir);
29098
- if (resolved === path54.parse(resolved).root || resolved === path54.resolve(os.homedir())) {
29300
+ const resolved = path55.resolve(rootDir);
29301
+ if (resolved === path55.parse(resolved).root || resolved === path55.resolve(os.homedir())) {
29099
29302
  return { ok: false, reason: "unsafe" };
29100
29303
  }
29101
29304
  try {
@@ -29109,11 +29312,11 @@ async function canInitializeGenericProject(rootDir) {
29109
29312
  }
29110
29313
  }
29111
29314
  async function validateV3CliProjectBoundary(rootDir, options, locale, legacyInitialized) {
29112
- const isGitRepo = await pathExists6(path54.join(rootDir, ".git"));
29315
+ const isGitRepo = await pathExists6(path55.join(rootDir, ".git"));
29113
29316
  const hasManifest = await hasProjectManifest(rootDir);
29114
29317
  if (isGitRepo || hasManifest) return null;
29115
29318
  const v3Initialized = await pathExists6(
29116
- path54.join(rootDir, ".mancode", "schema.json")
29319
+ path55.join(rootDir, ".mancode", "schema.json")
29117
29320
  );
29118
29321
  const legacyAuthorityPresent = legacyInitialized || (await scanLegacyAuthority(rootDir)).authorityPresent;
29119
29322
  const genericSafety = await canInitializeGenericProject(rootDir);
@@ -29238,6 +29441,12 @@ function getInitManagedFilePaths(rootDir, platforms) {
29238
29441
  files.push(`.qoder/commands/${mode}.md`);
29239
29442
  }
29240
29443
  }
29444
+ if (platforms.includes("dsh")) {
29445
+ files.push("AGENTS.md");
29446
+ for (const mode of MODE_NAMES) {
29447
+ files.push(`.dsh/skills/${mode}/SKILL.md`);
29448
+ }
29449
+ }
29241
29450
  if (platforms.includes("copilot")) {
29242
29451
  files.push(
29243
29452
  ".github/copilot-instructions.md",
@@ -29248,7 +29457,7 @@ function getInitManagedFilePaths(rootDir, platforms) {
29248
29457
  files.push(`.github/prompts/${mode}.prompt.md`);
29249
29458
  }
29250
29459
  }
29251
- return [...new Set(files.map((file) => path54.join(rootDir, file)))];
29460
+ return [...new Set(files.map((file) => path55.join(rootDir, file)))];
29252
29461
  }
29253
29462
  async function snapshotFiles(filePaths) {
29254
29463
  return Promise.all(
@@ -29256,7 +29465,7 @@ async function snapshotFiles(filePaths) {
29256
29465
  try {
29257
29466
  return { filePath, content: await fs4.readFile(filePath, "utf-8") };
29258
29467
  } catch (error) {
29259
- if (isNodeError6(error) && error.code === "ENOENT") {
29468
+ if (isNodeError7(error) && error.code === "ENOENT") {
29260
29469
  return { filePath, content: null };
29261
29470
  }
29262
29471
  throw error;
@@ -29267,10 +29476,10 @@ async function snapshotFiles(filePaths) {
29267
29476
  async function snapshotDirectories(filePaths, additionalDirectories = []) {
29268
29477
  const directories = new Set(additionalDirectories);
29269
29478
  for (const filePath of filePaths) {
29270
- let current = path54.dirname(filePath);
29271
- while (current !== path54.dirname(current)) {
29479
+ let current = path55.dirname(filePath);
29480
+ while (current !== path55.dirname(current)) {
29272
29481
  directories.add(current);
29273
- current = path54.dirname(current);
29482
+ current = path55.dirname(current);
29274
29483
  }
29275
29484
  }
29276
29485
  return Promise.all(
@@ -29286,7 +29495,7 @@ async function restoreFiles(snapshots) {
29286
29495
  await fs4.rm(snapshot.filePath, { force: true });
29287
29496
  continue;
29288
29497
  }
29289
- await fs4.mkdir(path54.dirname(snapshot.filePath), { recursive: true });
29498
+ await fs4.mkdir(path55.dirname(snapshot.filePath), { recursive: true });
29290
29499
  await fs4.writeFile(snapshot.filePath, snapshot.content, "utf-8");
29291
29500
  }
29292
29501
  }
@@ -29302,7 +29511,7 @@ async function removeNewEmptyDirectories(snapshots) {
29302
29511
  function isRecord8(value) {
29303
29512
  return typeof value === "object" && value !== null && !Array.isArray(value);
29304
29513
  }
29305
- function isNodeError6(error) {
29514
+ function isNodeError7(error) {
29306
29515
  return error instanceof Error && "code" in error;
29307
29516
  }
29308
29517
  function printPlatformCreatedFiles(platform, locale) {
@@ -29347,6 +29556,13 @@ function printPlatformCreatedFiles(platform, locale) {
29347
29556
  console.log(" .qoder/commands/ # Qoder mode commands");
29348
29557
  return;
29349
29558
  }
29559
+ if (platform === "dsh") {
29560
+ console.log(
29561
+ " AGENTS.md # DeepSeek Harness managed block"
29562
+ );
29563
+ console.log(" .dsh/skills/ # DeepSeek Harness mode skills");
29564
+ return;
29565
+ }
29350
29566
  console.log(" .github/copilot-instructions.md # Copilot instructions");
29351
29567
  }
29352
29568
  function localize(locale, chinese, english) {
@@ -29363,15 +29579,15 @@ async function pathExists6(p) {
29363
29579
 
29364
29580
  // src/commands/install.ts
29365
29581
  import { promises as fs5 } from "fs";
29366
- import path55 from "path";
29582
+ import path56 from "path";
29367
29583
  import process7 from "process";
29368
29584
  var EXIT_OK3 = 0;
29369
29585
  var EXIT_NOT_INITIALIZED2 = 1;
29370
29586
  var EXIT_UNSUPPORTED_PLATFORM = 2;
29371
29587
  var EXIT_INSTALL_FAILED = 3;
29372
29588
  async function install(rootDir = process7.cwd(), platform = "claude-code", options = {}) {
29373
- const stateFile = path55.join(rootDir, ".mancode", "state.json");
29374
- const v3SchemaFile = path55.join(rootDir, ".mancode", "schema.json");
29589
+ const stateFile = path56.join(rootDir, ".mancode", "state.json");
29590
+ const v3SchemaFile = path56.join(rootDir, ".mancode", "schema.json");
29375
29591
  if (await pathExists7(v3SchemaFile)) {
29376
29592
  return installV3(rootDir, platform, options);
29377
29593
  }
@@ -29532,22 +29748,22 @@ function printUnsupportedPlatform(platform) {
29532
29748
  }
29533
29749
  }
29534
29750
  async function readConfig2(rootDir) {
29535
- const configPath = path55.join(rootDir, ".mancode", "config.json");
29751
+ const configPath = path56.join(rootDir, ".mancode", "config.json");
29536
29752
  try {
29537
29753
  const raw = await fs5.readFile(configPath, "utf-8");
29538
29754
  return { config: JSON.parse(raw), valid: true };
29539
29755
  } catch (err) {
29540
- if (isNodeError7(err) && err.code === "ENOENT") {
29756
+ if (isNodeError8(err) && err.code === "ENOENT") {
29541
29757
  return { config: {}, valid: false };
29542
29758
  }
29543
29759
  throw err;
29544
29760
  }
29545
29761
  }
29546
- function isNodeError7(err) {
29762
+ function isNodeError8(err) {
29547
29763
  return err instanceof Error && "code" in err;
29548
29764
  }
29549
29765
  async function updateConfig(rootDir, config) {
29550
- const configPath = path55.join(rootDir, ".mancode", "config.json");
29766
+ const configPath = path56.join(rootDir, ".mancode", "config.json");
29551
29767
  const content = `${JSON.stringify(config, null, 2)}
29552
29768
  `;
29553
29769
  await fs5.writeFile(configPath, content, "utf-8");
@@ -29583,7 +29799,7 @@ function readConfiguredMinimal(value, platform) {
29583
29799
  async function readStatePlatform(rootDir) {
29584
29800
  try {
29585
29801
  const raw = await fs5.readFile(
29586
- path55.join(rootDir, ".mancode", "state.json"),
29802
+ path56.join(rootDir, ".mancode", "state.json"),
29587
29803
  "utf-8"
29588
29804
  );
29589
29805
  const state = JSON.parse(raw);
@@ -29606,11 +29822,11 @@ function isRecord9(value) {
29606
29822
 
29607
29823
  // src/commands/list-platforms.ts
29608
29824
  import { promises as fs6 } from "fs";
29609
- import path56 from "path";
29825
+ import path57 from "path";
29610
29826
  import process8 from "process";
29611
29827
  var EXIT_OK4 = 0;
29612
29828
  async function listPlatforms(rootDir = process8.cwd()) {
29613
- if (await pathExists8(path56.join(rootDir, ".mancode", "schema.json"))) {
29829
+ if (await pathExists8(path57.join(rootDir, ".mancode", "schema.json"))) {
29614
29830
  return listV3Platforms(rootDir);
29615
29831
  }
29616
29832
  const installed = new Set(await readInstalledPlatforms(rootDir));
@@ -29646,7 +29862,7 @@ async function listV3Platforms(rootDir) {
29646
29862
  async function readInstalledPlatforms(rootDir) {
29647
29863
  try {
29648
29864
  const raw = await fs6.readFile(
29649
- path56.join(rootDir, ".mancode", "config.json"),
29865
+ path57.join(rootDir, ".mancode", "config.json"),
29650
29866
  "utf-8"
29651
29867
  );
29652
29868
  const config = JSON.parse(raw);
@@ -29679,7 +29895,7 @@ function describePlatform(platform) {
29679
29895
 
29680
29896
  // src/commands/manps.ts
29681
29897
  import { access as access4, readFile as readFile41 } from "fs/promises";
29682
- import path58 from "path";
29898
+ import path59 from "path";
29683
29899
  import { createInterface as createInterface2 } from "readline/promises";
29684
29900
 
29685
29901
  // src/system/preseason.ts
@@ -29688,14 +29904,14 @@ import { createHash as createHash8 } from "crypto";
29688
29904
  import { existsSync, readFileSync } from "fs";
29689
29905
  import {
29690
29906
  access as access3,
29691
- lstat as lstat21,
29907
+ lstat as lstat22,
29692
29908
  mkdir as mkdir36,
29693
29909
  readFile as readFile40,
29694
29910
  readdir as readdir18,
29695
- rename as rename12,
29696
- writeFile as writeFile43
29911
+ rename as rename13,
29912
+ writeFile as writeFile44
29697
29913
  } from "fs/promises";
29698
- import path57 from "path";
29914
+ import path58 from "path";
29699
29915
  var PRESEASON_AREAS = [
29700
29916
  "all",
29701
29917
  "deps",
@@ -29775,10 +29991,10 @@ async function runPreseasonScan(projectRoot, area = "all", options = {}) {
29775
29991
  const needsFiles = normalizedArea === "all" || normalizedArea === "dead-code" || normalizedArea === "config";
29776
29992
  const files = needsFiles ? await listProjectFiles(projectRoot) : [];
29777
29993
  const issues = (await scanArea(projectRoot, normalizedArea, pkg, files)).slice(0, 20);
29778
- const storageRoot = options.storageRoot ?? path57.join(projectRoot, ".mancode");
29779
- const reportDir = path57.join(storageRoot, "preseason-reports");
29994
+ const storageRoot = options.storageRoot ?? path58.join(projectRoot, ".mancode");
29995
+ const reportDir = path58.join(storageRoot, "preseason-reports");
29780
29996
  await mkdir36(reportDir, { recursive: true });
29781
- const issueDbPath = path57.join(storageRoot, "preseason-issues.json");
29997
+ const issueDbPath = path58.join(storageRoot, "preseason-issues.json");
29782
29998
  const reportPath = await allocateReportPath(
29783
29999
  reportDir,
29784
30000
  `${generatedAt.replace(/[:.]/g, "-")}-${normalizedArea}`
@@ -29792,9 +30008,9 @@ async function runPreseasonScan(projectRoot, area = "all", options = {}) {
29792
30008
  issueDbPath
29793
30009
  };
29794
30010
  const database = await buildIssueDatabase(projectRoot, report);
29795
- await writeFile43(reportPath, renderPreseasonReport(report), "utf-8");
29796
- await writeFile43(
29797
- path57.join(storageRoot, "preseason-report.md"),
30011
+ await writeFile44(reportPath, renderPreseasonReport(report), "utf-8");
30012
+ await writeFile44(
30013
+ path58.join(storageRoot, "preseason-report.md"),
29798
30014
  renderPreseasonReport(report),
29799
30015
  "utf-8"
29800
30016
  );
@@ -29802,7 +30018,7 @@ async function runPreseasonScan(projectRoot, area = "all", options = {}) {
29802
30018
  return report;
29803
30019
  }
29804
30020
  async function runPreseasonRemediation(projectRoot, issues, options = {}) {
29805
- const issueDbPath = options.issueDbPath ?? path57.join(projectRoot, ".mancode", "preseason-issues.json");
30021
+ const issueDbPath = options.issueDbPath ?? path58.join(projectRoot, ".mancode", "preseason-issues.json");
29806
30022
  const database = await readIssueDatabase(issueDbPath);
29807
30023
  const keys = new Set(issues.map((issue) => issueKey(issue)));
29808
30024
  const targets = database.issues.filter(
@@ -29880,7 +30096,7 @@ async function runPreseasonRemediation(projectRoot, issues, options = {}) {
29880
30096
  write2(" Decision: skipped.");
29881
30097
  }
29882
30098
  database.updatedAt = now;
29883
- await writeFile43(
30099
+ await writeFile44(
29884
30100
  issueDbPath,
29885
30101
  `${JSON.stringify(database, null, 2)}
29886
30102
  `,
@@ -29912,7 +30128,7 @@ async function scanArea(projectRoot, area, pkg, files) {
29912
30128
  async function allocateReportPath(reportDir, baseName) {
29913
30129
  for (let attempt = 0; attempt < 1e3; attempt++) {
29914
30130
  const suffix = attempt === 0 ? "" : `-${attempt + 1}`;
29915
- const candidate = path57.join(reportDir, `${baseName}${suffix}.md`);
30131
+ const candidate = path58.join(reportDir, `${baseName}${suffix}.md`);
29916
30132
  if (!existsSync(candidate)) return candidate;
29917
30133
  }
29918
30134
  throw new Error(`unable to allocate preseason report path: ${baseName}`);
@@ -29961,18 +30177,18 @@ async function walk(root, current, results, depth) {
29961
30177
  }
29962
30178
  for (const entry of entries) {
29963
30179
  if (IGNORE_DIRS.has(entry)) continue;
29964
- const abs = path57.join(current, entry);
29965
- const rel = path57.relative(root, abs);
30180
+ const abs = path58.join(current, entry);
30181
+ const rel = path58.relative(root, abs);
29966
30182
  let info;
29967
30183
  try {
29968
- info = await lstat21(abs);
30184
+ info = await lstat22(abs);
29969
30185
  } catch {
29970
30186
  continue;
29971
30187
  }
29972
30188
  if (info.isSymbolicLink()) continue;
29973
30189
  if (info.isDirectory()) {
29974
30190
  await walk(root, abs, results, depth + 1);
29975
- } else if (SOURCE_EXTENSIONS.has(path57.extname(entry)) || entry === "package.json") {
30191
+ } else if (SOURCE_EXTENSIONS.has(path58.extname(entry)) || entry === "package.json") {
29976
30192
  results.push(rel);
29977
30193
  if (results.length >= MAX_PROJECT_FILES) return;
29978
30194
  }
@@ -29980,7 +30196,7 @@ async function walk(root, current, results, depth) {
29980
30196
  }
29981
30197
  async function readPackageJson(projectRoot) {
29982
30198
  try {
29983
- const raw = await readFile40(path57.join(projectRoot, "package.json"), "utf-8");
30199
+ const raw = await readFile40(path58.join(projectRoot, "package.json"), "utf-8");
29984
30200
  return JSON.parse(raw);
29985
30201
  } catch {
29986
30202
  return null;
@@ -30073,7 +30289,7 @@ function scanTodos(projectRoot, files) {
30073
30289
  const matches = [];
30074
30290
  for (const file of files) {
30075
30291
  if (matches.length >= 7) break;
30076
- const abs = path57.join(projectRoot, file);
30292
+ const abs = path58.join(projectRoot, file);
30077
30293
  matches.push(...readTodoIssues(abs, file, matches.length));
30078
30294
  }
30079
30295
  return matches.slice(0, 7);
@@ -30114,7 +30330,7 @@ function scanTestGaps(files) {
30114
30330
  if (sourceFiles.length === 0) return [];
30115
30331
  const tests = new Set(files.filter((file) => file.startsWith("tests/")));
30116
30332
  const missing = sourceFiles.filter((file) => {
30117
- const base = path57.basename(file).replace(/\.(ts|tsx|js|jsx)$/, "");
30333
+ const base = path58.basename(file).replace(/\.(ts|tsx|js|jsx)$/, "");
30118
30334
  return !Array.from(tests).some((test) => test.includes(base));
30119
30335
  }).slice(0, 4);
30120
30336
  return missing.map((file, index) => ({
@@ -30123,13 +30339,13 @@ function scanTestGaps(files) {
30123
30339
  type: "tests",
30124
30340
  title: "Core source file has no obvious test",
30125
30341
  file,
30126
- detail: `No matching test file was found for ${path57.basename(file)}.`,
30342
+ detail: `No matching test file was found for ${path58.basename(file)}.`,
30127
30343
  recommendation: "Add focused coverage for the public behavior or document why this module is exercised indirectly."
30128
30344
  }));
30129
30345
  }
30130
30346
  function scanConfig(projectRoot, files) {
30131
30347
  const issues = [];
30132
- if (!files.includes(".gitignore") && !pathExistsSync(path57.join(projectRoot, ".gitignore"))) {
30348
+ if (!files.includes(".gitignore") && !pathExistsSync(path58.join(projectRoot, ".gitignore"))) {
30133
30349
  issues.push({
30134
30350
  id: "config-gitignore",
30135
30351
  severity: "P1",
@@ -30140,7 +30356,7 @@ function scanConfig(projectRoot, files) {
30140
30356
  recommendation: "Add a .gitignore that excludes dependencies, build output, coverage, and local env files."
30141
30357
  });
30142
30358
  }
30143
- if (!files.includes(".editorconfig") && !pathExistsSync(path57.join(projectRoot, ".editorconfig"))) {
30359
+ if (!files.includes(".editorconfig") && !pathExistsSync(path58.join(projectRoot, ".editorconfig"))) {
30144
30360
  issues.push({
30145
30361
  id: "config-editorconfig",
30146
30362
  severity: "P2",
@@ -30159,7 +30375,7 @@ function scanAestheticDrift(projectRoot, files, pkg) {
30159
30375
  for (const file of frontendFiles) {
30160
30376
  let content;
30161
30377
  try {
30162
- content = readFileSyncSafe(path57.join(projectRoot, file));
30378
+ content = readFileSyncSafe(path58.join(projectRoot, file));
30163
30379
  } catch {
30164
30380
  continue;
30165
30381
  }
@@ -30210,7 +30426,7 @@ function detectedIconSystems(pkg) {
30210
30426
  return systems.filter(([, pattern]) => packages.some((name) => pattern.test(name))).map(([name]) => name);
30211
30427
  }
30212
30428
  async function scanArchitecture(projectRoot) {
30213
- const localBinary = path57.join(
30429
+ const localBinary = path58.join(
30214
30430
  projectRoot,
30215
30431
  "node_modules",
30216
30432
  ".bin",
@@ -30258,7 +30474,7 @@ async function hasDependencyCruiserConfig(projectRoot) {
30258
30474
  "dependency-cruiser.config.mjs"
30259
30475
  ];
30260
30476
  const results = await Promise.all(
30261
- files.map((file) => pathExists9(path57.join(projectRoot, file)))
30477
+ files.map((file) => pathExists9(path58.join(projectRoot, file)))
30262
30478
  );
30263
30479
  return results.some(Boolean);
30264
30480
  }
@@ -30364,9 +30580,9 @@ function inferCommands(pkg) {
30364
30580
  return ["lint", "test", "build"].filter((name) => scripts[name]).map((name) => `npm run ${name}`);
30365
30581
  }
30366
30582
  async function buildIssueDatabase(projectRoot, report) {
30367
- const reportRef = path57.relative(projectRoot, report.reportPath);
30583
+ const reportRef = path58.relative(projectRoot, report.reportPath);
30368
30584
  const run = {
30369
- id: path57.basename(report.reportPath, ".md"),
30585
+ id: path58.basename(report.reportPath, ".md"),
30370
30586
  generatedAt: report.generatedAt,
30371
30587
  area: report.area,
30372
30588
  reportPath: reportRef,
@@ -30410,7 +30626,7 @@ async function readIssueDatabase(issueDbPath) {
30410
30626
  try {
30411
30627
  raw = await readFile40(issueDbPath, "utf-8");
30412
30628
  } catch (err) {
30413
- if (isNodeError8(err) && err.code === "ENOENT") {
30629
+ if (isNodeError9(err) && err.code === "ENOENT") {
30414
30630
  return emptyIssueDatabase();
30415
30631
  }
30416
30632
  throw err;
@@ -30429,9 +30645,9 @@ async function readIssueDatabase(issueDbPath) {
30429
30645
  }
30430
30646
  async function writeJsonAtomic3(file, value) {
30431
30647
  const tmp = `${file}.tmp-${Date.now()}-${Math.random().toString(36).slice(2)}`;
30432
- await writeFile43(tmp, `${JSON.stringify(value, null, 2)}
30648
+ await writeFile44(tmp, `${JSON.stringify(value, null, 2)}
30433
30649
  `, "utf-8");
30434
- await rename12(tmp, file);
30650
+ await rename13(tmp, file);
30435
30651
  }
30436
30652
  function emptyIssueDatabase() {
30437
30653
  return {
@@ -30472,20 +30688,20 @@ function compareIssueRecords(a, b) {
30472
30688
  }
30473
30689
  async function applySafeRemediation(projectRoot, issue) {
30474
30690
  if (issue.id === "config-gitignore" && issue.file === ".gitignore") {
30475
- const gitignorePath = path57.join(projectRoot, ".gitignore");
30691
+ const gitignorePath = path58.join(projectRoot, ".gitignore");
30476
30692
  if (pathExistsSync(gitignorePath)) {
30477
30693
  return { applied: false };
30478
30694
  }
30479
- await writeFile43(gitignorePath, `${DEFAULT_GITIGNORE}
30695
+ await writeFile44(gitignorePath, `${DEFAULT_GITIGNORE}
30480
30696
  `, "utf-8");
30481
30697
  return { applied: true, action: "created .gitignore" };
30482
30698
  }
30483
30699
  if (issue.id === "config-editorconfig" && issue.file === ".editorconfig") {
30484
- const editorconfigPath = path57.join(projectRoot, ".editorconfig");
30700
+ const editorconfigPath = path58.join(projectRoot, ".editorconfig");
30485
30701
  if (pathExistsSync(editorconfigPath)) {
30486
30702
  return { applied: false };
30487
30703
  }
30488
- await writeFile43(editorconfigPath, `${DEFAULT_EDITORCONFIG}
30704
+ await writeFile44(editorconfigPath, `${DEFAULT_EDITORCONFIG}
30489
30705
  `, "utf-8");
30490
30706
  return { applied: true, action: "created .editorconfig" };
30491
30707
  }
@@ -30521,7 +30737,7 @@ async function inferSafePackageScript(projectRoot, scriptName) {
30521
30737
  }
30522
30738
  }
30523
30739
  async function addPackageScript(projectRoot, scriptName, script) {
30524
- const packagePath = path57.join(projectRoot, "package.json");
30740
+ const packagePath = path58.join(projectRoot, "package.json");
30525
30741
  let pkg;
30526
30742
  try {
30527
30743
  pkg = JSON.parse(await readFile40(packagePath, "utf-8"));
@@ -30534,7 +30750,7 @@ async function addPackageScript(projectRoot, scriptName, script) {
30534
30750
  ...scripts,
30535
30751
  [scriptName]: script
30536
30752
  };
30537
- await writeFile43(packagePath, `${JSON.stringify(pkg, null, 2)}
30753
+ await writeFile44(packagePath, `${JSON.stringify(pkg, null, 2)}
30538
30754
  `, "utf-8");
30539
30755
  return true;
30540
30756
  }
@@ -30621,7 +30837,7 @@ async function pathExists9(file) {
30621
30837
  return false;
30622
30838
  }
30623
30839
  }
30624
- function isNodeError8(err) {
30840
+ function isNodeError9(err) {
30625
30841
  return err instanceof Error && "code" in err;
30626
30842
  }
30627
30843
  function isRecord10(value) {
@@ -30634,7 +30850,7 @@ var EXIT_NOT_INITIALIZED3 = 1;
30634
30850
  var EXIT_SCAN_FAILED = 2;
30635
30851
  var EXIT_INVALID_ARG = 3;
30636
30852
  async function manps(rootDir, area = "all", options = {}) {
30637
- const v3SchemaPath = path58.join(rootDir, ".mancode", "schema.json");
30853
+ const v3SchemaPath = path59.join(rootDir, ".mancode", "schema.json");
30638
30854
  const v3Activation = await readV3ActivationState(v3SchemaPath);
30639
30855
  if (v3Activation !== null && v3Activation !== "v3_active" && v3Activation !== "dual_read") {
30640
30856
  const message = `manps is unavailable while mancode activation is ${v3Activation}`;
@@ -30647,7 +30863,7 @@ async function manps(rootDir, area = "all", options = {}) {
30647
30863
  return EXIT_SCAN_FAILED;
30648
30864
  }
30649
30865
  const v3Initialized = v3Activation === "v3_active";
30650
- const initialized = v3Initialized || await pathExists10(path58.join(rootDir, ".mancode", "state.json"));
30866
+ const initialized = v3Initialized || await pathExists10(path59.join(rootDir, ".mancode", "state.json"));
30651
30867
  if (!initialized) {
30652
30868
  if (options.json) {
30653
30869
  console.log(JSON.stringify({ error: "not initialized" }, null, 2));
@@ -30660,7 +30876,7 @@ async function manps(rootDir, area = "all", options = {}) {
30660
30876
  let report;
30661
30877
  try {
30662
30878
  report = await runPreseasonScan(rootDir, area, {
30663
- storageRoot: v3Initialized ? path58.join(rootDir, ".mancode", "local") : void 0
30879
+ storageRoot: v3Initialized ? path59.join(rootDir, ".mancode", "local") : void 0
30664
30880
  });
30665
30881
  } catch (err) {
30666
30882
  const message = err instanceof Error ? err.message : String(err);
@@ -30729,8 +30945,8 @@ async function manps(rootDir, area = "all", options = {}) {
30729
30945
  console.log(
30730
30946
  `Issues: ${report.issues.length} total (P0 ${p0}, P1 ${p1}, P2 ${p2})`
30731
30947
  );
30732
- console.log(`Report: ${path58.relative(rootDir, report.reportPath)}`);
30733
- console.log(`Issue DB: ${path58.relative(rootDir, report.issueDbPath)}`);
30948
+ console.log(`Report: ${path59.relative(rootDir, report.reportPath)}`);
30949
+ console.log(`Issue DB: ${path59.relative(rootDir, report.issueDbPath)}`);
30734
30950
  if (report.issues.length > 0) {
30735
30951
  console.log("");
30736
30952
  for (const issue of report.issues.slice(0, 7)) {
@@ -30746,7 +30962,7 @@ async function manps(rootDir, area = "all", options = {}) {
30746
30962
  console.log(` Skipped: ${remediation.skipped}`);
30747
30963
  console.log(` Fixed: ${remediation.fixed}`);
30748
30964
  console.log(
30749
- ` Issue DB: ${path58.relative(rootDir, remediation.issueDbPath)}`
30965
+ ` Issue DB: ${path59.relative(rootDir, remediation.issueDbPath)}`
30750
30966
  );
30751
30967
  }
30752
30968
  return EXIT_OK5;
@@ -30817,7 +31033,7 @@ async function readV3ActivationState(schemaPath) {
30817
31033
 
30818
31034
  // src/commands/migrate.ts
30819
31035
  import { readFile as readFile42 } from "fs/promises";
30820
- import path59 from "path";
31036
+ import path60 from "path";
30821
31037
  var EXIT_OK6 = 0;
30822
31038
  var EXIT_INVALID_ARG2 = 2;
30823
31039
  var EXIT_MIGRATION_BLOCKED = 3;
@@ -30943,9 +31159,9 @@ async function readScopeFile(rootDir, file) {
30943
31159
  if (!file.trim() || file.includes("\0")) {
30944
31160
  throw new Error("MANCODE_MIGRATION_SCOPE_FILE_INVALID");
30945
31161
  }
30946
- const resolved = path59.resolve(rootDir, file);
30947
- const relative = path59.relative(path59.resolve(rootDir), resolved);
30948
- if (relative === ".." || relative.startsWith(`..${path59.sep}`) || path59.isAbsolute(relative)) {
31162
+ const resolved = path60.resolve(rootDir, file);
31163
+ const relative = path60.relative(path60.resolve(rootDir), resolved);
31164
+ if (relative === ".." || relative.startsWith(`..${path60.sep}`) || path60.isAbsolute(relative)) {
30949
31165
  throw new Error("MANCODE_MIGRATION_SCOPE_FILE_INVALID");
30950
31166
  }
30951
31167
  try {
@@ -31050,12 +31266,12 @@ async function runOperationMutation(rootDir, operationId, options, mode) {
31050
31266
  }
31051
31267
 
31052
31268
  // src/context/project-policy-upgrade.ts
31053
- import { lstat as lstat22, mkdir as mkdir37, readFile as readFile43, rm as rm20, writeFile as writeFile44 } from "fs/promises";
31054
- import path60 from "path";
31269
+ import { lstat as lstat23, mkdir as mkdir37, readFile as readFile43, rm as rm21, writeFile as writeFile45 } from "fs/promises";
31270
+ import path61 from "path";
31055
31271
  var UPGRADE_OPERATION = "project_policy_upgrade";
31056
31272
  async function dryRunProjectPolicyUpgrade(input) {
31057
31273
  assertPolicyVersion(input.policyVersion);
31058
- const root = path60.resolve(input.projectRoot);
31274
+ const root = path61.resolve(input.projectRoot);
31059
31275
  const project = await new V3ContextStore(root).readProjectSnapshot();
31060
31276
  const beforeDigest = digestManifest(project.manifest);
31061
31277
  const now = input.now ?? /* @__PURE__ */ new Date();
@@ -31099,7 +31315,7 @@ async function dryRunProjectPolicyUpgrade(input) {
31099
31315
  async function upgradeProjectPolicy(input) {
31100
31316
  assertPolicyVersion(input.policyVersion);
31101
31317
  assertUlid(input.sessionId, "project policy upgrade sessionId");
31102
- const root = path60.resolve(input.projectRoot);
31318
+ const root = path61.resolve(input.projectRoot);
31103
31319
  const now = input.now ?? /* @__PURE__ */ new Date();
31104
31320
  const operationId = input.operationId;
31105
31321
  if (operationId === void 0) {
@@ -31353,24 +31569,24 @@ function buildV2Manifest(manifest, operationId) {
31353
31569
  return candidate;
31354
31570
  }
31355
31571
  async function readSchemaContent(root) {
31356
- return readFile43(path60.join(root, ".mancode", "schema.json"), "utf8");
31572
+ return readFile43(path61.join(root, ".mancode", "schema.json"), "utf8");
31357
31573
  }
31358
31574
  async function writeSchemaContent(root, operationId, content) {
31359
- const directory = path60.join(root, ".mancode");
31360
- const target = path60.join(directory, "schema.json");
31361
- const stat5 = await lstat22(target);
31575
+ const directory = path61.join(root, ".mancode");
31576
+ const target = path61.join(directory, "schema.json");
31577
+ const stat5 = await lstat23(target);
31362
31578
  if (!stat5.isFile() || stat5.isSymbolicLink()) {
31363
31579
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
31364
31580
  }
31365
- const temporary = path60.join(
31581
+ const temporary = path61.join(
31366
31582
  directory,
31367
31583
  `.schema.json.${operationId}.${process.pid}.tmp`
31368
31584
  );
31369
- await writeFile44(temporary, content, { encoding: "utf8", flag: "wx" });
31585
+ await writeFile45(temporary, content, { encoding: "utf8", flag: "wx" });
31370
31586
  try {
31371
31587
  await replaceFileAtomically(temporary, target);
31372
31588
  } catch (error) {
31373
- await rm20(temporary, { force: true });
31589
+ await rm21(temporary, { force: true });
31374
31590
  throw error;
31375
31591
  }
31376
31592
  }
@@ -31438,13 +31654,13 @@ async function releaseLocks3(locks) {
31438
31654
  await Promise.allSettled([...locks].reverse().map((lock) => lock.release()));
31439
31655
  }
31440
31656
  function projectUpgradePreviewRoot(root, operationId) {
31441
- return path60.join(root, ".mancode", "staging", "project-upgrade", operationId);
31657
+ return path61.join(root, ".mancode", "staging", "project-upgrade", operationId);
31442
31658
  }
31443
31659
  async function stageProjectPolicyUpgrade(root, receipt, manifestContent) {
31444
31660
  const directory = projectUpgradePreviewRoot(root, receipt.operationId);
31445
- const receiptPath = path60.join(directory, "preview.json");
31446
- const manifestPath = path60.join(directory, "schema.json");
31447
- await mkdir37(path60.dirname(directory), { recursive: true });
31661
+ const receiptPath = path61.join(directory, "preview.json");
31662
+ const manifestPath = path61.join(directory, "schema.json");
31663
+ await mkdir37(path61.dirname(directory), { recursive: true });
31448
31664
  try {
31449
31665
  await mkdir37(directory);
31450
31666
  } catch (error) {
@@ -31454,25 +31670,25 @@ async function stageProjectPolicyUpgrade(root, receipt, manifestContent) {
31454
31670
  throw error;
31455
31671
  }
31456
31672
  try {
31457
- await writeFile44(receiptPath, `${JSON.stringify(receipt, null, 2)}
31673
+ await writeFile45(receiptPath, `${JSON.stringify(receipt, null, 2)}
31458
31674
  `, {
31459
31675
  encoding: "utf8",
31460
31676
  flag: "wx"
31461
31677
  });
31462
- await writeFile44(manifestPath, manifestContent, {
31678
+ await writeFile45(manifestPath, manifestContent, {
31463
31679
  encoding: "utf8",
31464
31680
  flag: "wx"
31465
31681
  });
31466
31682
  } catch (error) {
31467
- await rm20(directory, { recursive: true, force: true });
31683
+ await rm21(directory, { recursive: true, force: true });
31468
31684
  throw error;
31469
31685
  }
31470
31686
  }
31471
31687
  async function assertProjectPolicyUpgradePreview(root, operationId, project) {
31472
31688
  const directory = projectUpgradePreviewRoot(root, operationId);
31473
31689
  const [receiptContent, manifestContent] = await Promise.all([
31474
- readSafePreviewFile(path60.join(directory, "preview.json")),
31475
- readSafePreviewFile(path60.join(directory, "schema.json"))
31690
+ readSafePreviewFile(path61.join(directory, "preview.json")),
31691
+ readSafePreviewFile(path61.join(directory, "schema.json"))
31476
31692
  ]);
31477
31693
  let receipt;
31478
31694
  try {
@@ -31495,7 +31711,7 @@ async function assertProjectPolicyUpgradePreview(root, operationId, project) {
31495
31711
  }
31496
31712
  async function readSafePreviewFile(target) {
31497
31713
  try {
31498
- const stat5 = await lstat22(target);
31714
+ const stat5 = await lstat23(target);
31499
31715
  if (!stat5.isFile() || stat5.isSymbolicLink()) {
31500
31716
  throw new Error("MANCODE_PROJECT_UPGRADE_PREVIEW_INVALID");
31501
31717
  }
@@ -31588,16 +31804,16 @@ async function projectUpgrade(rootDir, options) {
31588
31804
  // src/commands/refresh-project.ts
31589
31805
  import { randomUUID } from "crypto";
31590
31806
  import { promises as fs7 } from "fs";
31591
- import path61 from "path";
31807
+ import path62 from "path";
31592
31808
  import process9 from "process";
31593
31809
  var EXIT_OK7 = 0;
31594
31810
  var EXIT_NOT_INITIALIZED4 = 1;
31595
31811
  var EXIT_CORRUPT_STATE = 2;
31596
31812
  var EXIT_REFRESH_FAILED = 3;
31597
31813
  async function refreshProject(rootDir = process9.cwd()) {
31598
- const mancodeDir = path61.join(rootDir, ".mancode");
31599
- const statePath = path61.join(mancodeDir, "state.json");
31600
- if (await pathExists11(path61.join(mancodeDir, "schema.json"))) {
31814
+ const mancodeDir = path62.join(rootDir, ".mancode");
31815
+ const statePath = path62.join(mancodeDir, "state.json");
31816
+ if (await pathExists11(path62.join(mancodeDir, "schema.json"))) {
31601
31817
  return refreshV3Project(rootDir);
31602
31818
  }
31603
31819
  if (!await pathExists11(statePath)) {
@@ -31616,12 +31832,12 @@ async function refreshProject(rootDir = process9.cwd()) {
31616
31832
  const [profile, team, hasGit, hasManifest] = await Promise.all([
31617
31833
  detectProjectProfile(rootDir),
31618
31834
  detectTeamStatus(rootDir),
31619
- pathExists11(path61.join(rootDir, ".git")),
31835
+ pathExists11(path62.join(rootDir, ".git")),
31620
31836
  hasProjectManifest2(rootDir)
31621
31837
  ]);
31622
31838
  const uiLibrary = primaryUiLibrary(profile);
31623
31839
  const stack = [...profile.languages, ...profile.frameworks];
31624
- const config = await readJson2(path61.join(mancodeDir, "config.json"));
31840
+ const config = await readJson2(path62.join(mancodeDir, "config.json"));
31625
31841
  const configuredTeam = config.forceTeamMode === true ? true : config.teamMode === "on" ? true : config.teamMode === "off" ? false : team.isTeam;
31626
31842
  const nextState = {
31627
31843
  ...state,
@@ -31633,7 +31849,7 @@ async function refreshProject(rootDir = process9.cwd()) {
31633
31849
  };
31634
31850
  await writeProjectFacts2(
31635
31851
  statePath,
31636
- path61.join(mancodeDir, "project-profile.json"),
31852
+ path62.join(mancodeDir, "project-profile.json"),
31637
31853
  `${JSON.stringify(nextState, null, 2)}
31638
31854
  `,
31639
31855
  `${JSON.stringify(profile, null, 2)}
@@ -31700,7 +31916,7 @@ async function refreshV3Project(rootDir) {
31700
31916
  }
31701
31917
  async function hasProjectManifest2(rootDir) {
31702
31918
  for (const manifest of PROJECT_MANIFESTS) {
31703
- if (await pathExists11(path61.join(rootDir, manifest))) return true;
31919
+ if (await pathExists11(path62.join(rootDir, manifest))) return true;
31704
31920
  }
31705
31921
  return false;
31706
31922
  }
@@ -31744,7 +31960,7 @@ async function ensureReplaceableFile(filePath) {
31744
31960
  throw new Error(`cannot replace non-file path: ${filePath}`);
31745
31961
  }
31746
31962
  } catch (error) {
31747
- if (isNodeError9(error) && error.code === "ENOENT") return;
31963
+ if (isNodeError10(error) && error.code === "ENOENT") return;
31748
31964
  throw error;
31749
31965
  }
31750
31966
  }
@@ -31761,14 +31977,14 @@ async function readOptionalText(filePath) {
31761
31977
  try {
31762
31978
  return await fs7.readFile(filePath, "utf-8");
31763
31979
  } catch (error) {
31764
- if (isNodeError9(error) && error.code === "ENOENT") return null;
31980
+ if (isNodeError10(error) && error.code === "ENOENT") return null;
31765
31981
  throw error;
31766
31982
  }
31767
31983
  }
31768
31984
  function temporaryPath(filePath) {
31769
- return path61.join(
31770
- path61.dirname(filePath),
31771
- `.${path61.basename(filePath)}.${process9.pid}.${randomUUID()}.tmp`
31985
+ return path62.join(
31986
+ path62.dirname(filePath),
31987
+ `.${path62.basename(filePath)}.${process9.pid}.${randomUUID()}.tmp`
31772
31988
  );
31773
31989
  }
31774
31990
  async function refreshStaticPlatforms(rootDir, config, fallbackPlatform, stack, uiLibrary, profile) {
@@ -31824,7 +32040,7 @@ async function readRequiredState(filePath) {
31824
32040
  function isRecord11(value) {
31825
32041
  return typeof value === "object" && value !== null && !Array.isArray(value);
31826
32042
  }
31827
- function isNodeError9(error) {
32043
+ function isNodeError10(error) {
31828
32044
  return error instanceof Error && "code" in error;
31829
32045
  }
31830
32046
  async function pathExists11(filePath) {
@@ -31838,7 +32054,7 @@ async function pathExists11(filePath) {
31838
32054
 
31839
32055
  // src/commands/refresh-style.ts
31840
32056
  import { promises as fs8 } from "fs";
31841
- import path62 from "path";
32057
+ import path63 from "path";
31842
32058
  import process10 from "process";
31843
32059
  var EXIT_OK8 = 0;
31844
32060
  var EXIT_NOT_INITIALIZED5 = 1;
@@ -31849,8 +32065,8 @@ async function refreshStyle(rootDir = process10.cwd(), options = {}) {
31849
32065
  console.error("\u2717 style scan root must stay inside the project root.");
31850
32066
  return EXIT_V3_REFRESH_FAILED;
31851
32067
  }
31852
- const stateFile = path62.join(rootDir, ".mancode", "state.json");
31853
- if (await pathExists12(path62.join(rootDir, ".mancode", "schema.json"))) {
32068
+ const stateFile = path63.join(rootDir, ".mancode", "state.json");
32069
+ if (await pathExists12(path63.join(rootDir, ".mancode", "schema.json"))) {
31854
32070
  return refreshV3Style(rootDir, scanTarget.root, scanTarget.scopeRoot);
31855
32071
  }
31856
32072
  if (!await pathExists12(stateFile)) {
@@ -31860,7 +32076,7 @@ async function refreshStyle(rootDir = process10.cwd(), options = {}) {
31860
32076
  }
31861
32077
  console.log("\u2713 \u5237\u65B0\u9879\u76EE profile...");
31862
32078
  const profile = await detectProjectProfile(rootDir);
31863
- const profilePath = path62.join(rootDir, ".mancode", "project-profile.json");
32079
+ const profilePath = path63.join(rootDir, ".mancode", "project-profile.json");
31864
32080
  await fs8.writeFile(
31865
32081
  profilePath,
31866
32082
  `${JSON.stringify(profile, null, 2)}
@@ -31887,13 +32103,13 @@ async function refreshStyle(rootDir = process10.cwd(), options = {}) {
31887
32103
  uiLibraryHint,
31888
32104
  scanTarget.scopeRoot
31889
32105
  );
31890
- const tokensPath = path62.join(
32106
+ const tokensPath = path63.join(
31891
32107
  rootDir,
31892
32108
  ".mancode",
31893
32109
  "aesthetics",
31894
32110
  "style-tokens.json"
31895
32111
  );
31896
- await fs8.mkdir(path62.dirname(tokensPath), { recursive: true });
32112
+ await fs8.mkdir(path63.dirname(tokensPath), { recursive: true });
31897
32113
  await fs8.writeFile(
31898
32114
  tokensPath,
31899
32115
  `${JSON.stringify(tokens, null, 2)}
@@ -31966,7 +32182,7 @@ async function refreshV3Style(rootDir, scanRoot, scopeRoot) {
31966
32182
  console.log(
31967
32183
  ` \u7C7B\u578B: ${profile.projectKind} | UI: ${profile.uiAssets} | \u6D4F\u89C8\u5668: ${profile.browserAutomation}`
31968
32184
  );
31969
- const tokensPath = path62.join(
32185
+ const tokensPath = path63.join(
31970
32186
  rootDir,
31971
32187
  ".mancode",
31972
32188
  "local",
@@ -31983,7 +32199,7 @@ async function refreshV3Style(rootDir, scanRoot, scopeRoot) {
31983
32199
  }
31984
32200
  console.log("\u2713 \u626B\u63CF\u9879\u76EE\u8BBE\u8BA1 token...");
31985
32201
  const tokens = await scanAesthetics(scanRoot, uiLibraryHint, scopeRoot);
31986
- await fs8.mkdir(path62.dirname(tokensPath), { recursive: true });
32202
+ await fs8.mkdir(path63.dirname(tokensPath), { recursive: true });
31987
32203
  await fs8.writeFile(
31988
32204
  tokensPath,
31989
32205
  `${JSON.stringify(tokens, null, 2)}
@@ -32017,7 +32233,7 @@ async function printStaticPlatformRefreshHint(rootDir) {
32017
32233
  );
32018
32234
  }
32019
32235
  async function refreshLegacyStateContext(rootDir, profile, uiLibrary) {
32020
- const statePath = path62.join(rootDir, ".mancode", "state.json");
32236
+ const statePath = path63.join(rootDir, ".mancode", "state.json");
32021
32237
  try {
32022
32238
  const state = JSON.parse(await fs8.readFile(statePath, "utf-8"));
32023
32239
  const stack = [...profile.languages, ...profile.frameworks];
@@ -32041,7 +32257,7 @@ async function refreshLegacyStateContext(rootDir, profile, uiLibrary) {
32041
32257
  async function readInstalledPlatforms2(rootDir) {
32042
32258
  try {
32043
32259
  const raw = await fs8.readFile(
32044
- path62.join(rootDir, ".mancode", "config.json"),
32260
+ path63.join(rootDir, ".mancode", "config.json"),
32045
32261
  "utf-8"
32046
32262
  );
32047
32263
  const config = JSON.parse(raw);
@@ -32061,30 +32277,30 @@ async function pathExists12(p) {
32061
32277
  }
32062
32278
  }
32063
32279
  async function resolveScanTarget(rootDir, requestedRoot) {
32064
- const projectRoot = await fs8.realpath(path62.resolve(rootDir)).catch(() => null);
32280
+ const projectRoot = await fs8.realpath(path63.resolve(rootDir)).catch(() => null);
32065
32281
  if (projectRoot === null) return null;
32066
32282
  if (requestedRoot === void 0 || requestedRoot === ".") {
32067
32283
  return { root: projectRoot, scopeRoot: "." };
32068
32284
  }
32069
- if (path62.isAbsolute(requestedRoot) || requestedRoot.includes("\0") || requestedRoot.split(/[\\/]/).some((segment) => segment === "" || segment === "." || segment === "..")) {
32285
+ if (path63.isAbsolute(requestedRoot) || requestedRoot.includes("\0") || requestedRoot.split(/[\\/]/).some((segment) => segment === "" || segment === "." || segment === "..")) {
32070
32286
  return null;
32071
32287
  }
32072
- const candidate = await fs8.realpath(path62.resolve(projectRoot, requestedRoot)).catch(() => null);
32288
+ const candidate = await fs8.realpath(path63.resolve(projectRoot, requestedRoot)).catch(() => null);
32073
32289
  if (candidate === null) return null;
32074
- const relative = path62.relative(projectRoot, candidate);
32075
- if (relative.startsWith(`..${path62.sep}`) || relative === ".." || path62.isAbsolute(relative)) {
32290
+ const relative = path63.relative(projectRoot, candidate);
32291
+ if (relative.startsWith(`..${path63.sep}`) || relative === ".." || path63.isAbsolute(relative)) {
32076
32292
  return null;
32077
32293
  }
32078
32294
  return {
32079
32295
  root: candidate,
32080
- scopeRoot: relative.split(path62.sep).join("/") || "."
32296
+ scopeRoot: relative.split(path63.sep).join("/") || "."
32081
32297
  };
32082
32298
  }
32083
32299
 
32084
32300
  // src/commands/status.ts
32085
32301
  import { spawn } from "child_process";
32086
32302
  import { promises as fs9 } from "fs";
32087
- import path63 from "path";
32303
+ import path64 from "path";
32088
32304
  import process11 from "process";
32089
32305
 
32090
32306
  // src/team/assessment.ts
@@ -32240,8 +32456,8 @@ var EXIT_OK9 = 0;
32240
32456
  var EXIT_NOT_INITIALIZED6 = 1;
32241
32457
  var EXIT_CORRUPT_STATE2 = 2;
32242
32458
  async function status(rootDir = process11.cwd(), options = {}) {
32243
- const stateFile = path63.join(rootDir, ".mancode", "state.json");
32244
- const v3SchemaFile = path63.join(rootDir, ".mancode", "schema.json");
32459
+ const stateFile = path64.join(rootDir, ".mancode", "state.json");
32460
+ const v3SchemaFile = path64.join(rootDir, ".mancode", "schema.json");
32245
32461
  if (await pathExists13(v3SchemaFile)) {
32246
32462
  return statusV3(rootDir, options);
32247
32463
  }
@@ -32486,10 +32702,10 @@ async function readV3StatusSession(rootDir) {
32486
32702
  }
32487
32703
  async function shouldRefreshProject(rootDir, state) {
32488
32704
  if (state.projectMode !== "generic") return false;
32489
- const hasGit = await pathExists13(path63.join(rootDir, ".git"));
32705
+ const hasGit = await pathExists13(path64.join(rootDir, ".git"));
32490
32706
  if (hasGit) return true;
32491
32707
  for (const manifest of PROJECT_MANIFESTS) {
32492
- if (await pathExists13(path63.join(rootDir, manifest))) return true;
32708
+ if (await pathExists13(path64.join(rootDir, manifest))) return true;
32493
32709
  }
32494
32710
  return false;
32495
32711
  }
@@ -32533,19 +32749,19 @@ async function getCurrentWorkflow(rootDir, taskId) {
32533
32749
  }
32534
32750
  async function getProjectName(rootDir) {
32535
32751
  try {
32536
- const raw = await fs9.readFile(path63.join(rootDir, "package.json"), "utf-8");
32752
+ const raw = await fs9.readFile(path64.join(rootDir, "package.json"), "utf-8");
32537
32753
  const pkg = JSON.parse(raw);
32538
32754
  if (pkg.name && typeof pkg.name === "string") {
32539
32755
  return pkg.name;
32540
32756
  }
32541
32757
  } catch {
32542
32758
  }
32543
- return path63.basename(rootDir);
32759
+ return path64.basename(rootDir);
32544
32760
  }
32545
32761
  async function readConfig3(rootDir) {
32546
32762
  try {
32547
32763
  const raw = await fs9.readFile(
32548
- path63.join(rootDir, ".mancode", "config.json"),
32764
+ path64.join(rootDir, ".mancode", "config.json"),
32549
32765
  "utf-8"
32550
32766
  );
32551
32767
  return JSON.parse(raw);
@@ -32573,9 +32789,9 @@ function getEffectiveTeamStatus(state, config, detected) {
32573
32789
  }
32574
32790
  async function checkHooks(rootDir) {
32575
32791
  const [sessionStart, userPromptSubmit, registered] = await Promise.all([
32576
- pathExists13(path63.join(rootDir, ".mancode", "hooks", "session-start.mjs")),
32792
+ pathExists13(path64.join(rootDir, ".mancode", "hooks", "session-start.mjs")),
32577
32793
  pathExists13(
32578
- path63.join(rootDir, ".mancode", "hooks", "user-prompt-submit.mjs")
32794
+ path64.join(rootDir, ".mancode", "hooks", "user-prompt-submit.mjs")
32579
32795
  ),
32580
32796
  isRegistered(rootDir)
32581
32797
  ]);
@@ -32584,7 +32800,7 @@ async function checkHooks(rootDir) {
32584
32800
  async function isRegistered(rootDir) {
32585
32801
  try {
32586
32802
  const raw = await fs9.readFile(
32587
- path63.join(rootDir, ".claude", "settings.json"),
32803
+ path64.join(rootDir, ".claude", "settings.json"),
32588
32804
  "utf-8"
32589
32805
  );
32590
32806
  const settings = JSON.parse(raw);
@@ -32613,7 +32829,7 @@ function hasHookCommand2(value, needle) {
32613
32829
  });
32614
32830
  }
32615
32831
  async function estimateHookInjection(rootDir) {
32616
- const hookPath = path63.join(
32832
+ const hookPath = path64.join(
32617
32833
  rootDir,
32618
32834
  ".mancode",
32619
32835
  "hooks",
@@ -34110,8 +34326,8 @@ function assertPositiveRevision2(value, label) {
34110
34326
  }
34111
34327
 
34112
34328
  // src/team/git-ref-handoff-repair.ts
34113
- import { lstat as lstat23, mkdir as mkdir38, readFile as readFile44, readdir as readdir19, writeFile as writeFile45 } from "fs/promises";
34114
- import path64 from "path";
34329
+ import { lstat as lstat24, mkdir as mkdir38, readFile as readFile44, readdir as readdir19, writeFile as writeFile46 } from "fs/promises";
34330
+ import path65 from "path";
34115
34331
 
34116
34332
  // src/team/git-ref-operation.ts
34117
34333
  import { execFile as execFileCallback6 } from "child_process";
@@ -36689,7 +36905,7 @@ async function recoverGitRefHandoffRepairs(projectRoot) {
36689
36905
  }
36690
36906
  async function recoverGitRefHandoffRepair(projectRoot, operationId, transportReceipt) {
36691
36907
  assertUlid(operationId, "git-ref handoff repair operationId");
36692
- const root = path64.resolve(projectRoot);
36908
+ const root = path65.resolve(projectRoot);
36693
36909
  let journal = await requireJournal2(root, operationId);
36694
36910
  if (journal.state === "committed" || journal.state === "aborted") {
36695
36911
  return recoveryResult2(journal);
@@ -36768,7 +36984,7 @@ async function recoverGitRefHandoffRepair(projectRoot, operationId, transportRec
36768
36984
  }
36769
36985
  }
36770
36986
  async function prepareHandoffRepairWhileTaskLocked(projectRoot, rawPrepared) {
36771
- const root = path64.resolve(projectRoot);
36987
+ const root = path65.resolve(projectRoot);
36772
36988
  const prepared2 = parsePrepared2(rawPrepared);
36773
36989
  const runtime = await readProjectRuntimeContext(root);
36774
36990
  const previousMetadata = bundleMetadata2(prepared2.predecessorBundle);
@@ -36831,7 +37047,7 @@ async function restorePredecessorMetadata2(projectRoot, journal) {
36831
37047
  );
36832
37048
  }
36833
37049
  async function replaceMetadataVerified(projectRoot, expected, targetMetadata, alternateExpected) {
36834
- const target = path64.join(
37050
+ const target = path65.join(
36835
37051
  taskRootPath(projectRoot, targetMetadata.taskRef),
36836
37052
  "metadata.json"
36837
37053
  );
@@ -36957,7 +37173,7 @@ async function createJournal3(projectRoot, journal) {
36957
37173
  await ensureJournalDirectory2(projectRoot);
36958
37174
  const target = journalPath3(projectRoot, journal.operationId);
36959
37175
  try {
36960
- await writeFile45(target, serialize13(journal), {
37176
+ await writeFile46(target, serialize13(journal), {
36961
37177
  encoding: "utf8",
36962
37178
  flag: "wx"
36963
37179
  });
@@ -37000,7 +37216,7 @@ async function listJournals2(projectRoot) {
37000
37216
  parseJournal3(
37001
37217
  JSON.parse(
37002
37218
  await readFile44(
37003
- path64.join(journalDirectory2(projectRoot), entry),
37219
+ path65.join(journalDirectory2(projectRoot), entry),
37004
37220
  "utf8"
37005
37221
  )
37006
37222
  )
@@ -37010,43 +37226,43 @@ async function listJournals2(projectRoot) {
37010
37226
  return journals;
37011
37227
  }
37012
37228
  async function readSafeFile2(target) {
37013
- const before = await lstat23(target);
37229
+ const before = await lstat24(target);
37014
37230
  if (!before.isFile() || before.isSymbolicLink()) {
37015
37231
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
37016
37232
  }
37017
37233
  const content = await readFile44(target, "utf8");
37018
- const after = await lstat23(target);
37234
+ const after = await lstat24(target);
37019
37235
  if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
37020
37236
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
37021
37237
  }
37022
37238
  return content;
37023
37239
  }
37024
37240
  async function atomicWrite2(target, content) {
37025
- const temporary = path64.join(
37026
- path64.dirname(target),
37027
- `.${path64.basename(target)}.${process.pid}.${Date.now()}.tmp`
37241
+ const temporary = path65.join(
37242
+ path65.dirname(target),
37243
+ `.${path65.basename(target)}.${process.pid}.${Date.now()}.tmp`
37028
37244
  );
37029
- await writeFile45(temporary, content, { encoding: "utf8", flag: "wx" });
37245
+ await writeFile46(temporary, content, { encoding: "utf8", flag: "wx" });
37030
37246
  await replaceFileAtomically(temporary, target);
37031
37247
  }
37032
37248
  async function ensureJournalDirectory2(projectRoot) {
37033
- let current = path64.resolve(projectRoot);
37249
+ let current = path65.resolve(projectRoot);
37034
37250
  for (const segment of [".mancode", "local", "journals", "git-ref-handoff"]) {
37035
- current = path64.join(current, segment);
37251
+ current = path65.join(current, segment);
37036
37252
  try {
37037
37253
  await mkdir38(current);
37038
37254
  } catch (error) {
37039
37255
  if (!isAlreadyExists24(error)) throw error;
37040
37256
  }
37041
- const entry = await lstat23(current);
37257
+ const entry = await lstat24(current);
37042
37258
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
37043
37259
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
37044
37260
  }
37045
37261
  }
37046
37262
  }
37047
37263
  function journalDirectory2(projectRoot) {
37048
- return path64.join(
37049
- path64.resolve(projectRoot),
37264
+ return path65.join(
37265
+ path65.resolve(projectRoot),
37050
37266
  ".mancode",
37051
37267
  "local",
37052
37268
  "journals",
@@ -37055,7 +37271,7 @@ function journalDirectory2(projectRoot) {
37055
37271
  }
37056
37272
  function journalPath3(projectRoot, operationId) {
37057
37273
  assertUlid(operationId, "git-ref handoff repair operationId");
37058
- return path64.join(journalDirectory2(projectRoot), `${operationId}.json`);
37274
+ return path65.join(journalDirectory2(projectRoot), `${operationId}.json`);
37059
37275
  }
37060
37276
  function serialize13(value) {
37061
37277
  return `${JSON.stringify(value, null, 2)}
@@ -37154,8 +37370,8 @@ function parseReceipt(value) {
37154
37370
  }
37155
37371
 
37156
37372
  // src/team/policy-operation.ts
37157
- import { lstat as lstat24, mkdir as mkdir39, readdir as readdir20, unlink as unlink3, writeFile as writeFile46 } from "fs/promises";
37158
- import path65 from "path";
37373
+ import { lstat as lstat25, mkdir as mkdir39, readdir as readdir20, unlink as unlink3, writeFile as writeFile47 } from "fs/promises";
37374
+ import path66 from "path";
37159
37375
  async function updateTeamPolicy(input) {
37160
37376
  const operationId = input.operationId ?? createUlid();
37161
37377
  const eventId = createUlid();
@@ -37166,7 +37382,7 @@ async function updateTeamPolicy(input) {
37166
37382
  throw new Error("MANCODE_TEAM_POLICY_INVALID");
37167
37383
  }
37168
37384
  const now = input.now ?? /* @__PURE__ */ new Date();
37169
- const root = path65.resolve(input.projectRoot);
37385
+ const root = path66.resolve(input.projectRoot);
37170
37386
  const runtime = await readProjectRuntimeContext(root);
37171
37387
  const store = resolveCoordinationEntityHomeStore(
37172
37388
  runtime.entityHomeStoreContext
@@ -37247,7 +37463,7 @@ async function applyTeamTransportSet(input, write2) {
37247
37463
  }
37248
37464
  const remote = transportRemote(input.mode, input.remote);
37249
37465
  const now = input.now ?? /* @__PURE__ */ new Date();
37250
- const root = path65.resolve(input.projectRoot);
37466
+ const root = path66.resolve(input.projectRoot);
37251
37467
  const runtime = await readProjectRuntimeContext(root);
37252
37468
  const store = resolveCoordinationEntityHomeStore(
37253
37469
  runtime.entityHomeStoreContext
@@ -37380,9 +37596,9 @@ async function assertTransportAuthorityEmpty(projectRoot, store) {
37380
37596
  listClaims(store),
37381
37597
  listHandoffs(store),
37382
37598
  directoryHasEntries(taskHeadDirectory(store)),
37383
- directoryHasEntries(path65.join(store.root, "transport-migrations")),
37599
+ directoryHasEntries(path66.join(store.root, "transport-migrations")),
37384
37600
  directoryHasEntries(
37385
- path65.join(projectRoot, ".mancode", "shared", "team", "transport")
37601
+ path66.join(projectRoot, ".mancode", "shared", "team", "transport")
37386
37602
  ),
37387
37603
  pathExists14(gitRefCachePath(projectRoot))
37388
37604
  ]);
@@ -37412,21 +37628,21 @@ function assertPositiveRevision5(value, label) {
37412
37628
  }
37413
37629
  }
37414
37630
  function teamPolicyPath(projectRoot) {
37415
- return path65.join(projectRoot, ".mancode", "shared", "team", "policy.json");
37631
+ return path66.join(projectRoot, ".mancode", "shared", "team", "policy.json");
37416
37632
  }
37417
37633
  function projectConfigPath(projectRoot) {
37418
- return path65.join(projectRoot, ".mancode", "shared", "config.json");
37634
+ return path66.join(projectRoot, ".mancode", "shared", "config.json");
37419
37635
  }
37420
37636
  async function writeJsonAtomic4(target, value) {
37421
- await mkdir39(path65.dirname(target), { recursive: true });
37422
- await assertPlainDirectory(path65.dirname(target));
37637
+ await mkdir39(path66.dirname(target), { recursive: true });
37638
+ await assertPlainDirectory(path66.dirname(target));
37423
37639
  await assertPlainFileOrMissing(target);
37424
- const temporary = path65.join(
37425
- path65.dirname(target),
37426
- `.${path65.basename(target)}.${process.pid}.${createUlid()}.tmp`
37640
+ const temporary = path66.join(
37641
+ path66.dirname(target),
37642
+ `.${path66.basename(target)}.${process.pid}.${createUlid()}.tmp`
37427
37643
  );
37428
37644
  try {
37429
- await writeFile46(temporary, `${JSON.stringify(value, null, 2)}
37645
+ await writeFile47(temporary, `${JSON.stringify(value, null, 2)}
37430
37646
  `, {
37431
37647
  encoding: "utf8",
37432
37648
  flag: "wx"
@@ -37438,14 +37654,14 @@ async function writeJsonAtomic4(target, value) {
37438
37654
  }
37439
37655
  }
37440
37656
  async function assertPlainDirectory(target) {
37441
- const entry = await lstat24(target);
37657
+ const entry = await lstat25(target);
37442
37658
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
37443
37659
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
37444
37660
  }
37445
37661
  }
37446
37662
  async function assertPlainFileOrMissing(target) {
37447
37663
  try {
37448
- const entry = await lstat24(target);
37664
+ const entry = await lstat25(target);
37449
37665
  if (!entry.isFile() || entry.isSymbolicLink()) {
37450
37666
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
37451
37667
  }
@@ -37456,7 +37672,7 @@ async function assertPlainFileOrMissing(target) {
37456
37672
  }
37457
37673
  async function directoryHasEntries(target) {
37458
37674
  try {
37459
- const entry = await lstat24(target);
37675
+ const entry = await lstat25(target);
37460
37676
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
37461
37677
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
37462
37678
  }
@@ -37468,7 +37684,7 @@ async function directoryHasEntries(target) {
37468
37684
  }
37469
37685
  async function pathExists14(target) {
37470
37686
  try {
37471
- await lstat24(target);
37687
+ await lstat25(target);
37472
37688
  return true;
37473
37689
  } catch (error) {
37474
37690
  if (isNotFound32(error)) return false;
@@ -37484,15 +37700,15 @@ function isNotFound32(error) {
37484
37700
 
37485
37701
  // src/team/transport-migration-adapters.ts
37486
37702
  import {
37487
- lstat as lstat25,
37703
+ lstat as lstat26,
37488
37704
  mkdir as mkdir40,
37489
37705
  readFile as readFile45,
37490
37706
  readdir as readdir21,
37491
- rename as rename13,
37707
+ rename as rename14,
37492
37708
  unlink as unlink4,
37493
- writeFile as writeFile47
37709
+ writeFile as writeFile48
37494
37710
  } from "fs/promises";
37495
- import path66 from "path";
37711
+ import path67 from "path";
37496
37712
 
37497
37713
  // src/team/transport-migration.ts
37498
37714
  var DIGEST_PATTERN7 = /^sha256:[a-f0-9]{64}$/;
@@ -38564,7 +38780,7 @@ function compareUtf813(left, right) {
38564
38780
  var STAGE_DIRECTORY = "transport-migrations";
38565
38781
  var COLLECTIONS = ["claims", "handoffs", "task-heads"];
38566
38782
  async function createTransportMigrationFileAdapters(input) {
38567
- const projectRoot = path66.resolve(input.projectRoot);
38783
+ const projectRoot = path67.resolve(input.projectRoot);
38568
38784
  assertUlid(input.actorId, "transport migration adapter actorId");
38569
38785
  if (input.operationId !== void 0) {
38570
38786
  assertUlid(input.operationId, "transport migration adapter operationId");
@@ -38616,7 +38832,7 @@ async function createTransportMigrationFileAdapters(input) {
38616
38832
  var FileSystemTransportMigrationConfigAdapter = class {
38617
38833
  constructor(projectRoot, coordinationStore) {
38618
38834
  this.coordinationStore = coordinationStore;
38619
- this.projectRoot = path66.resolve(projectRoot);
38835
+ this.projectRoot = path67.resolve(projectRoot);
38620
38836
  }
38621
38837
  projectRoot;
38622
38838
  async read() {
@@ -39469,7 +39685,7 @@ async function publishMigrationActorProfiles(projectRoot, profiles) {
39469
39685
  }
39470
39686
  }
39471
39687
  async function archiveLocalCoordinationCollections(store, operationId) {
39472
- const archiveRoot = path66.join(
39688
+ const archiveRoot = path67.join(
39473
39689
  store.root,
39474
39690
  STAGE_DIRECTORY,
39475
39691
  "archive",
@@ -39482,20 +39698,20 @@ async function archiveLocalCoordinationCollections(store, operationId) {
39482
39698
  "task-heads": taskHeadDirectory(store)
39483
39699
  };
39484
39700
  for (const name of COLLECTIONS) {
39485
- const archived = path66.join(archiveRoot, name);
39486
- const absent = path66.join(archiveRoot, `${name}.absent`);
39701
+ const archived = path67.join(archiveRoot, name);
39702
+ const absent = path67.join(archiveRoot, `${name}.absent`);
39487
39703
  if (await pathKind(archived) === "directory" || await pathKind(absent) === "file") {
39488
39704
  continue;
39489
39705
  }
39490
39706
  const sourceKind = await pathKind(directories[name]);
39491
39707
  if (sourceKind === null) {
39492
- await writeFile47(absent, "\n", { encoding: "utf8", flag: "wx" });
39708
+ await writeFile48(absent, "\n", { encoding: "utf8", flag: "wx" });
39493
39709
  continue;
39494
39710
  }
39495
39711
  if (sourceKind !== "directory") {
39496
39712
  throw new Error("MANCODE_TRANSPORT_MIGRATION_LOCAL_AUTHORITY_UNSAFE");
39497
39713
  }
39498
- await rename13(directories[name], archived);
39714
+ await rename14(directories[name], archived);
39499
39715
  }
39500
39716
  }
39501
39717
  async function listActorProfiles(projectRoot) {
@@ -39521,7 +39737,7 @@ async function listActorProfiles(projectRoot) {
39521
39737
  return profiles;
39522
39738
  }
39523
39739
  async function listSharedTaskRefs(projectRoot) {
39524
- const directory = path66.join(projectRoot, ".mancode", "shared", "workflows");
39740
+ const directory = path67.join(projectRoot, ".mancode", "shared", "workflows");
39525
39741
  let entries;
39526
39742
  try {
39527
39743
  entries = await readdir21(directory);
@@ -39532,7 +39748,7 @@ async function listSharedTaskRefs(projectRoot) {
39532
39748
  const refs = [];
39533
39749
  for (const taskId of entries.sort(compareUtf814)) {
39534
39750
  assertUlid(taskId, "shared workflow directory");
39535
- const stat5 = await lstat25(path66.join(directory, taskId));
39751
+ const stat5 = await lstat26(path67.join(directory, taskId));
39536
39752
  if (!stat5.isDirectory() || stat5.isSymbolicLink()) {
39537
39753
  throw new Error("MANCODE_CONTEXT_PATH_UNSAFE");
39538
39754
  }
@@ -39606,7 +39822,7 @@ async function readStagedRecord(store, operationId) {
39606
39822
  );
39607
39823
  }
39608
39824
  function stagedPath(store, operationId) {
39609
- return path66.join(
39825
+ return path67.join(
39610
39826
  store.root,
39611
39827
  STAGE_DIRECTORY,
39612
39828
  "staged",
@@ -39614,7 +39830,7 @@ function stagedPath(store, operationId) {
39614
39830
  );
39615
39831
  }
39616
39832
  function establishedPath(store, operationId) {
39617
- return path66.join(
39833
+ return path67.join(
39618
39834
  store.root,
39619
39835
  STAGE_DIRECTORY,
39620
39836
  "established",
@@ -39622,7 +39838,7 @@ function establishedPath(store, operationId) {
39622
39838
  );
39623
39839
  }
39624
39840
  function projectConfigPath2(projectRoot) {
39625
- return path66.join(projectRoot, ".mancode", "shared", "config.json");
39841
+ return path67.join(projectRoot, ".mancode", "shared", "config.json");
39626
39842
  }
39627
39843
  async function readProjectConfigFile(projectRoot) {
39628
39844
  try {
@@ -39637,14 +39853,14 @@ async function readProjectConfigFile(projectRoot) {
39637
39853
  }
39638
39854
  }
39639
39855
  async function writeJsonAtomic5(target, value) {
39640
- await mkdir40(path66.dirname(target), { recursive: true });
39641
- await assertPlainDirectory2(path66.dirname(target));
39642
- const temporary = path66.join(
39643
- path66.dirname(target),
39644
- `.${path66.basename(target)}.${process.pid}.${createUlid()}.tmp`
39856
+ await mkdir40(path67.dirname(target), { recursive: true });
39857
+ await assertPlainDirectory2(path67.dirname(target));
39858
+ const temporary = path67.join(
39859
+ path67.dirname(target),
39860
+ `.${path67.basename(target)}.${process.pid}.${createUlid()}.tmp`
39645
39861
  );
39646
39862
  try {
39647
- await writeFile47(temporary, serialize14(value), {
39863
+ await writeFile48(temporary, serialize14(value), {
39648
39864
  encoding: "utf8",
39649
39865
  flag: "wx"
39650
39866
  });
@@ -39655,10 +39871,10 @@ async function writeJsonAtomic5(target, value) {
39655
39871
  }
39656
39872
  }
39657
39873
  async function writeJsonExclusiveOrEqual(target, value, parser, conflictCode) {
39658
- await mkdir40(path66.dirname(target), { recursive: true });
39659
- await assertPlainDirectory2(path66.dirname(target));
39874
+ await mkdir40(path67.dirname(target), { recursive: true });
39875
+ await assertPlainDirectory2(path67.dirname(target));
39660
39876
  try {
39661
- await writeFile47(target, serialize14(value), { encoding: "utf8", flag: "wx" });
39877
+ await writeFile48(target, serialize14(value), { encoding: "utf8", flag: "wx" });
39662
39878
  } catch (error) {
39663
39879
  if (!isAlreadyExists25(error)) throw error;
39664
39880
  const existing = await readJsonOrNull5(target, parser, conflictCode);
@@ -39670,12 +39886,12 @@ async function writeJsonExclusiveOrEqual(target, value, parser, conflictCode) {
39670
39886
  }
39671
39887
  async function readJsonOrNull5(target, parser, corruptCode) {
39672
39888
  try {
39673
- const before = await lstat25(target);
39889
+ const before = await lstat26(target);
39674
39890
  if (!before.isFile() || before.isSymbolicLink()) {
39675
39891
  throw new Error("MANCODE_TRANSPORT_MIGRATION_STAGE_UNSAFE");
39676
39892
  }
39677
39893
  const parsed = parser(JSON.parse(await readFile45(target, "utf8")));
39678
- const after = await lstat25(target);
39894
+ const after = await lstat26(target);
39679
39895
  if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
39680
39896
  throw new Error("MANCODE_TRANSPORT_MIGRATION_STAGE_UNSAFE");
39681
39897
  }
@@ -39733,7 +39949,7 @@ function requireRemote(value) {
39733
39949
  }
39734
39950
  async function pathKind(target) {
39735
39951
  try {
39736
- const stat5 = await lstat25(target);
39952
+ const stat5 = await lstat26(target);
39737
39953
  if (stat5.isSymbolicLink()) return "other";
39738
39954
  if (stat5.isFile()) return "file";
39739
39955
  if (stat5.isDirectory()) return "directory";
@@ -39744,7 +39960,7 @@ async function pathKind(target) {
39744
39960
  }
39745
39961
  }
39746
39962
  async function assertPlainDirectory2(target) {
39747
- const stat5 = await lstat25(target);
39963
+ const stat5 = await lstat26(target);
39748
39964
  if (!stat5.isDirectory() || stat5.isSymbolicLink()) {
39749
39965
  throw new Error("MANCODE_TRANSPORT_MIGRATION_STAGE_UNSAFE");
39750
39966
  }
@@ -41206,16 +41422,16 @@ function parsePositiveInteger6(value) {
41206
41422
  }
41207
41423
 
41208
41424
  // src/commands/uninstall.ts
41209
- import { access as access5, readFile as readFile46, rm as rm21, writeFile as writeFile48 } from "fs/promises";
41210
- import path67 from "path";
41425
+ import { access as access5, readFile as readFile46, rm as rm22, writeFile as writeFile49 } from "fs/promises";
41426
+ import path68 from "path";
41211
41427
  import process12 from "process";
41212
41428
  var EXIT_OK10 = 0;
41213
41429
  var EXIT_NOT_INITIALIZED7 = 1;
41214
41430
  var EXIT_UNSUPPORTED_PLATFORM2 = 2;
41215
41431
  var EXIT_V3_AUTHORITY_PROTECTED = 3;
41216
41432
  async function uninstall(rootDir = process12.cwd(), platform, options = {}) {
41217
- const stateFile = path67.join(rootDir, ".mancode", "state.json");
41218
- const v3SchemaFile = path67.join(rootDir, ".mancode", "schema.json");
41433
+ const stateFile = path68.join(rootDir, ".mancode", "state.json");
41434
+ const v3SchemaFile = path68.join(rootDir, ".mancode", "schema.json");
41219
41435
  if (await pathExists15(v3SchemaFile)) {
41220
41436
  return uninstallV3(rootDir, platform, options);
41221
41437
  }
@@ -41301,6 +41517,8 @@ async function uninstallPlatform(rootDir, platform) {
41301
41517
  await uninstallKimiCode(rootDir);
41302
41518
  } else if (platform === "qoder") {
41303
41519
  await uninstallQoder(rootDir);
41520
+ } else if (platform === "dsh") {
41521
+ await uninstallDsh(rootDir);
41304
41522
  }
41305
41523
  await removeFromConfig(rootDir, platform);
41306
41524
  }
@@ -41310,7 +41528,7 @@ async function uninstallAll(rootDir) {
41310
41528
  await uninstallPlatform(rootDir, p);
41311
41529
  }
41312
41530
  console.log("\u2713 Removing .mancode/ directory...");
41313
- await rm21(path67.join(rootDir, ".mancode"), {
41531
+ await rm22(path68.join(rootDir, ".mancode"), {
41314
41532
  recursive: true,
41315
41533
  force: true
41316
41534
  });
@@ -41320,7 +41538,7 @@ async function uninstallClaudeCode(rootDir) {
41320
41538
  await cleanClaudeSettings(rootDir);
41321
41539
  }
41322
41540
  async function cleanClaudeSettings(rootDir) {
41323
- const settingsPath = path67.join(rootDir, ".claude", "settings.json");
41541
+ const settingsPath = path68.join(rootDir, ".claude", "settings.json");
41324
41542
  let content;
41325
41543
  try {
41326
41544
  content = await readFile46(settingsPath, "utf-8");
@@ -41349,7 +41567,7 @@ async function cleanClaudeSettings(rootDir) {
41349
41567
  );
41350
41568
  settings.skills = Object.keys(retainedSkills).length > 0 ? retainedSkills : void 0;
41351
41569
  }
41352
- await writeFile48(
41570
+ await writeFile49(
41353
41571
  settingsPath,
41354
41572
  `${JSON.stringify(settings, null, 2)}
41355
41573
  `,
@@ -41398,22 +41616,22 @@ async function uninstallCursor(rootDir) {
41398
41616
  await removeCursorCommands(rootDir);
41399
41617
  }
41400
41618
  async function uninstallCodex(rootDir) {
41401
- const agentsPath = path67.join(rootDir, "AGENTS.md");
41619
+ const agentsPath = path68.join(rootDir, "AGENTS.md");
41402
41620
  try {
41403
41621
  const content = await readFile46(agentsPath, "utf-8");
41404
41622
  const cleaned = removeManagedBlock(content);
41405
41623
  if (cleaned.trim()) {
41406
- await writeFile48(agentsPath, `${cleaned}
41624
+ await writeFile49(agentsPath, `${cleaned}
41407
41625
  `, "utf-8");
41408
41626
  } else {
41409
- await rm21(agentsPath, { force: true });
41627
+ await rm22(agentsPath, { force: true });
41410
41628
  }
41411
41629
  } catch {
41412
41630
  }
41413
41631
  await removeCodexSkills(rootDir);
41414
41632
  }
41415
41633
  async function uninstallCopilot(rootDir) {
41416
- const instructionsPath = path67.join(
41634
+ const instructionsPath = path68.join(
41417
41635
  rootDir,
41418
41636
  ".github",
41419
41637
  "copilot-instructions.md"
@@ -41422,17 +41640,17 @@ async function uninstallCopilot(rootDir) {
41422
41640
  const content = await readFile46(instructionsPath, "utf-8");
41423
41641
  const cleaned = removeManagedBlock(content);
41424
41642
  if (cleaned.trim()) {
41425
- await writeFile48(instructionsPath, `${cleaned}
41643
+ await writeFile49(instructionsPath, `${cleaned}
41426
41644
  `, "utf-8");
41427
41645
  } else {
41428
- await rm21(instructionsPath, { force: true });
41646
+ await rm22(instructionsPath, { force: true });
41429
41647
  }
41430
41648
  } catch {
41431
41649
  }
41432
41650
  await removeCopilotPrompts(rootDir);
41433
41651
  }
41434
41652
  async function uninstallZcode(rootDir) {
41435
- const agentsPath = path67.join(rootDir, "AGENTS.md");
41653
+ const agentsPath = path68.join(rootDir, "AGENTS.md");
41436
41654
  try {
41437
41655
  const content = await readFile46(agentsPath, "utf-8");
41438
41656
  const cleaned = removeManagedBlock(
@@ -41441,17 +41659,17 @@ async function uninstallZcode(rootDir) {
41441
41659
  ZCODE_MANCODE_END_MARKER
41442
41660
  );
41443
41661
  if (cleaned.trim()) {
41444
- await writeFile48(agentsPath, `${cleaned}
41662
+ await writeFile49(agentsPath, `${cleaned}
41445
41663
  `, "utf-8");
41446
41664
  } else {
41447
- await rm21(agentsPath, { force: true });
41665
+ await rm22(agentsPath, { force: true });
41448
41666
  }
41449
41667
  } catch {
41450
41668
  }
41451
41669
  await removeZcodeSkills(rootDir);
41452
41670
  }
41453
41671
  async function uninstallKimiCode(rootDir) {
41454
- const agentsPath = path67.join(rootDir, "AGENTS.md");
41672
+ const agentsPath = path68.join(rootDir, "AGENTS.md");
41455
41673
  try {
41456
41674
  const content = await readFile46(agentsPath, "utf-8");
41457
41675
  const cleaned = removeManagedBlock(
@@ -41460,17 +41678,17 @@ async function uninstallKimiCode(rootDir) {
41460
41678
  KIMI_MANCODE_END_MARKER
41461
41679
  );
41462
41680
  if (cleaned.trim()) {
41463
- await writeFile48(agentsPath, `${cleaned}
41681
+ await writeFile49(agentsPath, `${cleaned}
41464
41682
  `, "utf-8");
41465
41683
  } else {
41466
- await rm21(agentsPath, { force: true });
41684
+ await rm22(agentsPath, { force: true });
41467
41685
  }
41468
41686
  } catch {
41469
41687
  }
41470
41688
  await removeKimiSkills(rootDir);
41471
41689
  }
41472
41690
  async function uninstallQoder(rootDir) {
41473
- const agentsPath = path67.join(rootDir, "AGENTS.md");
41691
+ const agentsPath = path68.join(rootDir, "AGENTS.md");
41474
41692
  try {
41475
41693
  const content = await readFile46(agentsPath, "utf-8");
41476
41694
  const cleaned = removeManagedBlock(
@@ -41479,17 +41697,38 @@ async function uninstallQoder(rootDir) {
41479
41697
  QODER_MANCODE_END_MARKER
41480
41698
  );
41481
41699
  if (cleaned.trim()) {
41482
- await writeFile48(agentsPath, `${cleaned}
41700
+ await writeFile49(agentsPath, `${cleaned}
41483
41701
  `, "utf-8");
41484
41702
  } else {
41485
- await rm21(agentsPath, { force: true });
41703
+ await rm22(agentsPath, { force: true });
41486
41704
  }
41487
41705
  } catch {
41488
41706
  }
41489
41707
  await removeQoderCommands(rootDir);
41490
41708
  }
41709
+ async function uninstallDsh(rootDir) {
41710
+ await assertDshAdapterPathsSafe(rootDir);
41711
+ const agentsPath = path68.join(rootDir, "AGENTS.md");
41712
+ try {
41713
+ const content = await readFile46(agentsPath, "utf-8");
41714
+ const cleaned = removeManagedBlock(
41715
+ content,
41716
+ DSH_MANCODE_START_MARKER,
41717
+ DSH_MANCODE_END_MARKER
41718
+ );
41719
+ if (cleaned.trim()) {
41720
+ await writeDshAgentsFile(rootDir, `${cleaned}
41721
+ `);
41722
+ } else {
41723
+ await rm22(agentsPath, { force: true });
41724
+ }
41725
+ } catch {
41726
+ }
41727
+ await assertDshAdapterPathsSafe(rootDir);
41728
+ await removeDshSkills(rootDir);
41729
+ }
41491
41730
  async function removeFromConfig(rootDir, platform) {
41492
- const configPath = path67.join(rootDir, ".mancode", "config.json");
41731
+ const configPath = path68.join(rootDir, ".mancode", "config.json");
41493
41732
  try {
41494
41733
  const raw = await readFile46(configPath, "utf-8");
41495
41734
  const config = JSON.parse(raw);
@@ -41503,7 +41742,7 @@ async function removeFromConfig(rootDir, platform) {
41503
41742
  );
41504
41743
  config.platformOptions = Object.keys(platformOptions).length > 0 ? platformOptions : void 0;
41505
41744
  }
41506
- await writeFile48(
41745
+ await writeFile49(
41507
41746
  configPath,
41508
41747
  `${JSON.stringify(config, null, 2)}
41509
41748
  `,
@@ -41560,8 +41799,8 @@ var WORKFLOW_SUBCOMMAND_SET = new Set(
41560
41799
  var CONTINUITY_COMPATIBILITY_SUBCOMMANDS = /* @__PURE__ */ new Set(["clean"]);
41561
41800
 
41562
41801
  // src/commands/workflow.ts
41563
- import { access as access6, readFile as readFile48, rm as rm23, writeFile as writeFile50 } from "fs/promises";
41564
- import path69 from "path";
41802
+ import { access as access6, readFile as readFile48, rm as rm24, writeFile as writeFile51 } from "fs/promises";
41803
+ import path70 from "path";
41565
41804
 
41566
41805
  // src/context/child-result-merge.ts
41567
41806
  async function mergeV3ChildResult(input) {
@@ -44753,14 +44992,14 @@ function updateMetadata4(previous, verification, operationId, updatedAt) {
44753
44992
 
44754
44993
  // src/context/workflow-create.ts
44755
44994
  import {
44756
- lstat as lstat26,
44995
+ lstat as lstat27,
44757
44996
  mkdir as mkdir41,
44758
44997
  readFile as readFile47,
44759
- rename as rename14,
44760
- rm as rm22,
44761
- writeFile as writeFile49
44998
+ rename as rename15,
44999
+ rm as rm23,
45000
+ writeFile as writeFile50
44762
45001
  } from "fs/promises";
44763
- import path68 from "path";
45002
+ import path69 from "path";
44764
45003
 
44765
45004
  // src/context/creation-resolution.ts
44766
45005
  function resolveWorkflowCreation(request) {
@@ -44870,7 +45109,7 @@ function rejectConflict(provided, expected, label) {
44870
45109
 
44871
45110
  // src/context/workflow-create.ts
44872
45111
  async function createV3Workflow(input) {
44873
- const projectRoot = path68.resolve(requireProjectRoot2(input.projectRoot));
45112
+ const projectRoot = path69.resolve(requireProjectRoot2(input.projectRoot));
44874
45113
  const task = requireText2(input.task, "workflow task");
44875
45114
  const client = requireText2(input.client, "workflow client");
44876
45115
  const now = input.now ?? /* @__PURE__ */ new Date();
@@ -45055,8 +45294,8 @@ async function createV3Workflow(input) {
45055
45294
  throw new Error("MANCODE_REVISION_CONFLICT");
45056
45295
  }
45057
45296
  const taskParent = await ensureSafeTaskParent3(projectRoot, taskRef);
45058
- const targetDirectory = path68.join(taskParent, taskRef.taskId);
45059
- stagingDirectory = path68.join(
45297
+ const targetDirectory = path69.join(taskParent, taskRef.taskId);
45298
+ stagingDirectory = path69.join(
45060
45299
  taskParent,
45061
45300
  `.${taskRef.taskId}.${operationId}.staging`
45062
45301
  );
@@ -45514,7 +45753,7 @@ async function ensureSafeTaskParent3(projectRoot, taskRef) {
45514
45753
  const segments = [".mancode", taskRef.namespace, "workflows"];
45515
45754
  let current = projectRoot;
45516
45755
  for (const segment of segments) {
45517
- current = path68.join(current, segment);
45756
+ current = path69.join(current, segment);
45518
45757
  const existing = await lstatOrNull5(current);
45519
45758
  if (existing === null) {
45520
45759
  await mkdir41(current);
@@ -45550,13 +45789,13 @@ async function writeStagedEntities(stagingDirectory, entities) {
45550
45789
  }
45551
45790
  async function writeStagedJson(stagingDirectory, fileName, value) {
45552
45791
  await assertDirectory(stagingDirectory);
45553
- const target = path68.join(stagingDirectory, fileName);
45554
- await writeFile49(target, `${JSON.stringify(value, null, 2)}
45792
+ const target = path69.join(stagingDirectory, fileName);
45793
+ await writeFile50(target, `${JSON.stringify(value, null, 2)}
45555
45794
  `, {
45556
45795
  encoding: "utf8",
45557
45796
  flag: "wx"
45558
45797
  });
45559
- const entry = await lstat26(target);
45798
+ const entry = await lstat27(target);
45560
45799
  if (!entry.isFile() || entry.isSymbolicLink()) {
45561
45800
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
45562
45801
  }
@@ -45588,13 +45827,13 @@ async function validateStagedEntities(stagingDirectory) {
45588
45827
  });
45589
45828
  }
45590
45829
  async function readStagedJson(stagingDirectory, fileName, parser) {
45591
- const target = path68.join(stagingDirectory, fileName);
45592
- const before = await lstat26(target);
45830
+ const target = path69.join(stagingDirectory, fileName);
45831
+ const before = await lstat27(target);
45593
45832
  if (!before.isFile() || before.isSymbolicLink()) {
45594
45833
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
45595
45834
  }
45596
45835
  const parsed = parser(JSON.parse(await readFile47(target, "utf8")));
45597
- const after = await lstat26(target);
45836
+ const after = await lstat27(target);
45598
45837
  if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
45599
45838
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
45600
45839
  }
@@ -45607,7 +45846,7 @@ async function publishStagedTask(stagingDirectory, targetDirectory) {
45607
45846
  targetDirectory,
45608
45847
  "MANCODE_WORKFLOW_ALREADY_EXISTS"
45609
45848
  );
45610
- await rename14(stagingDirectory, targetDirectory);
45849
+ await rename15(stagingDirectory, targetDirectory);
45611
45850
  await assertDirectory(targetDirectory);
45612
45851
  }
45613
45852
  async function advanceJournal(store, previous, stepId, now, canAbort) {
@@ -45685,18 +45924,18 @@ async function abortPreparedCreate(store, journal, stagingDirectory, now) {
45685
45924
  { canAbort: true }
45686
45925
  );
45687
45926
  } finally {
45688
- await rm22(stagingDirectory, { recursive: true, force: true });
45927
+ await rm23(stagingDirectory, { recursive: true, force: true });
45689
45928
  }
45690
45929
  }
45691
45930
  async function assertDirectory(target) {
45692
- const entry = await lstat26(target);
45931
+ const entry = await lstat27(target);
45693
45932
  if (!entry.isDirectory() || entry.isSymbolicLink()) {
45694
45933
  throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
45695
45934
  }
45696
45935
  }
45697
45936
  async function lstatOrNull5(target) {
45698
45937
  try {
45699
- return await lstat26(target);
45938
+ return await lstat27(target);
45700
45939
  } catch (error) {
45701
45940
  if (isNotFound34(error)) return null;
45702
45941
  throw error;
@@ -46721,7 +46960,7 @@ async function workflow(rootDir, subcommand, args = [], options = {}) {
46721
46960
  if (v3Activation === "v3_active") {
46722
46961
  return workflowV3(rootDir, subcommand, args, options);
46723
46962
  }
46724
- if (!await pathExists16(path69.join(rootDir, ".mancode", "state.json"))) {
46963
+ if (!await pathExists16(path70.join(rootDir, ".mancode", "state.json"))) {
46725
46964
  if (v3Activation !== null) {
46726
46965
  return printV3Error(
46727
46966
  options.json,
@@ -47804,7 +48043,7 @@ function parseV3ParticipantActorIds(values) {
47804
48043
  return values;
47805
48044
  }
47806
48045
  async function readWorkflowInputFile(projectRoot, value) {
47807
- const inputPath = path69.isAbsolute(value) ? value : path69.resolve(projectRoot, value);
48046
+ const inputPath = path70.isAbsolute(value) ? value : path70.resolve(projectRoot, value);
47808
48047
  return readFile48(inputPath, "utf8");
47809
48048
  }
47810
48049
  async function readWorkflowJsonInputFile(projectRoot, value) {
@@ -47878,12 +48117,12 @@ async function readV3ActivationState2(rootDir) {
47878
48117
  try {
47879
48118
  const manifest = parseSchemaManifest(
47880
48119
  JSON.parse(
47881
- await readFile48(path69.join(rootDir, ".mancode", "schema.json"), "utf8")
48120
+ await readFile48(path70.join(rootDir, ".mancode", "schema.json"), "utf8")
47882
48121
  )
47883
48122
  );
47884
48123
  return manifest.activationState === "v3_active" ? "v3_active" : "other";
47885
48124
  } catch (error) {
47886
- if (isNodeError10(error) && error.code === "ENOENT") return null;
48125
+ if (isNodeError11(error) && error.code === "ENOENT") return null;
47887
48126
  throw error;
47888
48127
  }
47889
48128
  }
@@ -47923,15 +48162,15 @@ async function workflowRequirements(rootDir, args, options) {
47923
48162
  "requirements can only be finalized for an in-progress man or manteam workflow at step 1 or 2"
47924
48163
  );
47925
48164
  }
47926
- const workflowPath = path69.join(rootDir, ".mancode", "workflows", taskId);
47927
- const jsonPath = path69.join(workflowPath, "requirements.json");
47928
- const markdownPath = path69.join(workflowPath, "requirements.md");
47929
- const metadataPath3 = path69.join(workflowPath, "metadata.json");
48165
+ const workflowPath = path70.join(rootDir, ".mancode", "workflows", taskId);
48166
+ const jsonPath = path70.join(workflowPath, "requirements.json");
48167
+ const markdownPath = path70.join(workflowPath, "requirements.md");
48168
+ const metadataPath3 = path70.join(workflowPath, "metadata.json");
47930
48169
  let originalJson;
47931
48170
  let originalMarkdown;
47932
48171
  let originalMetadata;
47933
48172
  try {
47934
- const inputPath = path69.isAbsolute(options.file) ? options.file : path69.resolve(rootDir, options.file);
48173
+ const inputPath = path70.isAbsolute(options.file) ? options.file : path70.resolve(rootDir, options.file);
47935
48174
  const input = await readFile48(inputPath, "utf-8");
47936
48175
  const requirements = parseRequirementsLedger2(input);
47937
48176
  assertRequirementsScopeConsistent2(requirements);
@@ -47968,7 +48207,7 @@ async function workflowRequirements(rootDir, args, options) {
47968
48207
  const rollback = await Promise.allSettled([
47969
48208
  restoreOptionalText(jsonPath, originalJson),
47970
48209
  restoreOptionalText(markdownPath, originalMarkdown),
47971
- writeFile50(metadataPath3, originalMetadata, "utf-8")
48210
+ writeFile51(metadataPath3, originalMetadata, "utf-8")
47972
48211
  ]);
47973
48212
  rollbackIncomplete = rollback.some(
47974
48213
  (result2) => result2.status === "rejected"
@@ -48056,7 +48295,7 @@ async function workflowVerify(rootDir, args, options) {
48056
48295
  );
48057
48296
  }
48058
48297
  if (options.evidenceFile) {
48059
- const evidencePath = path69.isAbsolute(options.evidenceFile) ? options.evidenceFile : path69.resolve(rootDir, options.evidenceFile);
48298
+ const evidencePath = path70.isAbsolute(options.evidenceFile) ? options.evidenceFile : path70.resolve(rootDir, options.evidenceFile);
48060
48299
  if (!await pathExists16(evidencePath)) {
48061
48300
  return invalidArg(
48062
48301
  options,
@@ -48116,14 +48355,14 @@ async function workflowVerify(rootDir, args, options) {
48116
48355
  }
48117
48356
  async function commitVerificationTransition(rootDir, meta, ledger) {
48118
48357
  const ledgerPath = verificationLedgerPath(rootDir, meta.taskId);
48119
- const metadataPath3 = path69.join(
48358
+ const metadataPath3 = path70.join(
48120
48359
  rootDir,
48121
48360
  ".mancode",
48122
48361
  "workflows",
48123
48362
  meta.taskId,
48124
48363
  "metadata.json"
48125
48364
  );
48126
- const specPath = path69.join(rootDir, ".mancode", "memory", "spec.md");
48365
+ const specPath = path70.join(rootDir, ".mancode", "memory", "spec.md");
48127
48366
  const [originalLedger, originalMetadata, originalSpec] = await Promise.all([
48128
48367
  readOptionalText2(ledgerPath),
48129
48368
  readFile48(metadataPath3, "utf-8"),
@@ -48155,7 +48394,7 @@ async function commitVerificationTransition(rootDir, meta, ledger) {
48155
48394
  } catch (error) {
48156
48395
  const rollback = await Promise.allSettled([
48157
48396
  restoreOptionalText(ledgerPath, originalLedger),
48158
- writeFile50(metadataPath3, originalMetadata, "utf-8"),
48397
+ writeFile51(metadataPath3, originalMetadata, "utf-8"),
48159
48398
  restoreOptionalText(specPath, originalSpec)
48160
48399
  ]);
48161
48400
  const message = error instanceof Error ? error.message : "verification transition failed";
@@ -48287,7 +48526,7 @@ async function workflowReview(rootDir, args, options) {
48287
48526
  }
48288
48527
  async function commitReviewSkip(rootDir, meta, reason) {
48289
48528
  const ledgerPath = reviewLedgerPath(rootDir, meta.taskId);
48290
- const metadataPath3 = path69.join(
48529
+ const metadataPath3 = path70.join(
48291
48530
  rootDir,
48292
48531
  ".mancode",
48293
48532
  "workflows",
@@ -48307,7 +48546,7 @@ async function commitReviewSkip(rootDir, meta, reason) {
48307
48546
  } catch (error) {
48308
48547
  const rollback = await Promise.allSettled([
48309
48548
  restoreOptionalText(ledgerPath, originalLedger),
48310
- writeFile50(metadataPath3, originalMetadata, "utf-8")
48549
+ writeFile51(metadataPath3, originalMetadata, "utf-8")
48311
48550
  ]);
48312
48551
  const message = error instanceof Error ? error.message : "review skip failed";
48313
48552
  return rollback.some((result2) => result2.status === "rejected") ? `${message}; rollback was incomplete` : message;
@@ -48527,14 +48766,14 @@ async function workflowHandoff(rootDir, taskId, options) {
48527
48766
  "solo handoff requires an undecided in-progress workflow at step 4 with ready requirements"
48528
48767
  );
48529
48768
  }
48530
- const workflowPath = path69.join(rootDir, ".mancode", "workflows", taskId);
48531
- if (!await pathExists16(path69.join(workflowPath, "requirements.md")) || !await pathExists16(path69.join(workflowPath, "plan.md"))) {
48769
+ const workflowPath = path70.join(rootDir, ".mancode", "workflows", taskId);
48770
+ if (!await pathExists16(path70.join(workflowPath, "requirements.md")) || !await pathExists16(path70.join(workflowPath, "plan.md"))) {
48532
48771
  return invalidArg(
48533
48772
  options,
48534
48773
  "solo handoff requires requirements.md and plan.md"
48535
48774
  );
48536
48775
  }
48537
- const statePath = path69.join(rootDir, ".mancode", "state.json");
48776
+ const statePath = path70.join(rootDir, ".mancode", "state.json");
48538
48777
  let originalState;
48539
48778
  let state;
48540
48779
  try {
@@ -48609,7 +48848,7 @@ async function workflowCompleteHandoff(rootDir, taskId, options) {
48609
48848
  `workflow is not an active solo handoff: ${taskId}`
48610
48849
  );
48611
48850
  }
48612
- const statePath = path69.join(rootDir, ".mancode", "state.json");
48851
+ const statePath = path70.join(rootDir, ".mancode", "state.json");
48613
48852
  let originalState;
48614
48853
  let state;
48615
48854
  try {
@@ -48676,14 +48915,14 @@ async function workflowDecide(rootDir, taskId, options) {
48676
48915
  `workflow is not ready for a plan-only decision: ${taskId}`
48677
48916
  );
48678
48917
  }
48679
- const workflowPath = path69.join(rootDir, ".mancode", "workflows", taskId);
48680
- if (!await pathExists16(path69.join(workflowPath, "requirements.md")) || !await pathExists16(path69.join(workflowPath, "plan.md"))) {
48918
+ const workflowPath = path70.join(rootDir, ".mancode", "workflows", taskId);
48919
+ if (!await pathExists16(path70.join(workflowPath, "requirements.md")) || !await pathExists16(path70.join(workflowPath, "plan.md"))) {
48681
48920
  return invalidArg(
48682
48921
  options,
48683
48922
  "plan-only requires requirements.md and plan.md"
48684
48923
  );
48685
48924
  }
48686
- const statePath = path69.join(rootDir, ".mancode", "state.json");
48925
+ const statePath = path70.join(rootDir, ".mancode", "state.json");
48687
48926
  let originalState;
48688
48927
  let state;
48689
48928
  try {
@@ -48739,14 +48978,14 @@ async function workflowDecide(rootDir, taskId, options) {
48739
48978
  return EXIT_OK11;
48740
48979
  }
48741
48980
  async function commitPlanningTransition(args) {
48742
- const metadataPath3 = path69.join(
48981
+ const metadataPath3 = path70.join(
48743
48982
  args.rootDir,
48744
48983
  ".mancode",
48745
48984
  "workflows",
48746
48985
  args.taskId,
48747
48986
  "metadata.json"
48748
48987
  );
48749
- const specPath = path69.join(args.rootDir, ".mancode", "memory", "spec.md");
48988
+ const specPath = path70.join(args.rootDir, ".mancode", "memory", "spec.md");
48750
48989
  let originalMetadata;
48751
48990
  let originalSpec;
48752
48991
  try {
@@ -48757,7 +48996,7 @@ async function commitPlanningTransition(args) {
48757
48996
  }
48758
48997
  try {
48759
48998
  await updateWorkflow(args.rootDir, args.taskId, args.workflowPatch);
48760
- await writeFile50(
48999
+ await writeFile51(
48761
49000
  args.statePath,
48762
49001
  `${JSON.stringify(args.nextState, null, 2)}
48763
49002
  `,
@@ -48771,9 +49010,9 @@ async function commitPlanningTransition(args) {
48771
49010
  return null;
48772
49011
  } catch (error) {
48773
49012
  const rollback = await Promise.allSettled([
48774
- writeFile50(metadataPath3, originalMetadata, "utf-8"),
48775
- writeFile50(args.statePath, args.originalState, "utf-8"),
48776
- originalSpec === null ? rm23(specPath, { force: true }) : writeFile50(specPath, originalSpec, "utf-8")
49013
+ writeFile51(metadataPath3, originalMetadata, "utf-8"),
49014
+ writeFile51(args.statePath, args.originalState, "utf-8"),
49015
+ originalSpec === null ? rm24(specPath, { force: true }) : writeFile51(specPath, originalSpec, "utf-8")
48777
49016
  ]);
48778
49017
  const message = error instanceof Error ? error.message : "planning transition failed";
48779
49018
  return rollback.some((result2) => result2.status === "rejected") ? `${message}; rollback was incomplete` : message;
@@ -48783,16 +49022,16 @@ async function readOptionalText2(filePath) {
48783
49022
  try {
48784
49023
  return await readFile48(filePath, "utf-8");
48785
49024
  } catch (error) {
48786
- if (isNodeError10(error) && error.code === "ENOENT") return null;
49025
+ if (isNodeError11(error) && error.code === "ENOENT") return null;
48787
49026
  throw error;
48788
49027
  }
48789
49028
  }
48790
49029
  async function restoreOptionalText(filePath, content) {
48791
49030
  if (content === null) {
48792
- await rm23(filePath, { force: true });
49031
+ await rm24(filePath, { force: true });
48793
49032
  return;
48794
49033
  }
48795
- await writeFile50(filePath, content, "utf-8");
49034
+ await writeFile51(filePath, content, "utf-8");
48796
49035
  }
48797
49036
  function readActiveSoloPlan(value) {
48798
49037
  if (!value || typeof value !== "object") return null;
@@ -48802,7 +49041,7 @@ function readActiveSoloPlan(value) {
48802
49041
  }
48803
49042
  return { taskId: plan.taskId, planVersion: plan.planVersion };
48804
49043
  }
48805
- function isNodeError10(error) {
49044
+ function isNodeError11(error) {
48806
49045
  return error instanceof Error && "code" in error;
48807
49046
  }
48808
49047
  async function workflowList(rootDir, options) {
@@ -49060,7 +49299,7 @@ function createCliProgram() {
49060
49299
  process.exitCode = code;
49061
49300
  });
49062
49301
  program.command("install [platform]").description(
49063
- "Install platform adapter (claude-code, cursor, codex, copilot, zcode, kimi-code, qoder)"
49302
+ "Install platform adapter (claude-code, cursor, codex, copilot, zcode, kimi-code, qoder, dsh)"
49064
49303
  ).option("--force", "Reinstall even if already installed").option(
49065
49304
  "--minimal",
49066
49305
  "Retained for legacy compatibility; Continuity bootstrap is already minimal"
@@ -49179,7 +49418,7 @@ Public Continuity subcommands:
49179
49418
  "Record real-host session evidence without persisting host keys"
49180
49419
  ).requiredOption(
49181
49420
  "--platform <platform>",
49182
- "claude-code, codex, cursor, copilot, zcode, kimi-code, or qoder"
49421
+ "claude-code, codex, cursor, copilot, zcode, kimi-code, qoder, or dsh"
49183
49422
  ).requiredOption("--session-mode <mode>", "Evidence path: host or explicit").requiredOption(
49184
49423
  "--host-session-source <source>",
49185
49424
  "hook_stdin, environment, api, or none for explicit sessions"