mancode 0.3.12 → 0.3.13

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
@@ -20,7 +20,7 @@ import {
20
20
  replaceManagedBlock,
21
21
  stageV3Adapter,
22
22
  v3AdapterTargetPath
23
- } from "./chunk-CFC3HBNA.js";
23
+ } from "./chunk-L3TKSX6R.js";
24
24
  import {
25
25
  PROJECT_MANIFESTS,
26
26
  V3ContextStore,
@@ -126,7 +126,7 @@ import {
126
126
  } from "./chunk-O3QAKAPJ.js";
127
127
 
128
128
  // src/cli.ts
129
- import { program } from "commander";
129
+ import { Option, program } from "commander";
130
130
 
131
131
  // src/context/publish-promote.ts
132
132
  import { lstat as lstat5, mkdir as mkdir11, rename as rename5, rm as rm5, writeFile as writeFile11 } from "fs/promises";
@@ -1459,23 +1459,27 @@ function parseV3AdapterFileAction(value) {
1459
1459
  "beforeContent",
1460
1460
  "targetContent"
1461
1461
  ],
1462
- "operation recovery V3 adapter action"
1462
+ "operation recovery mancode adapter action"
1463
1463
  );
1464
1464
  if (value.kind !== "v3_adapter_file" || !V3_ADAPTER_TARGETS.has(value.target)) {
1465
- throw new Error("operation recovery V3 adapter action is invalid");
1465
+ throw new Error("operation recovery mancode adapter action is invalid");
1466
1466
  }
1467
1467
  const target = value.target;
1468
- const beforeContent = value.beforeContent === null ? null : parseText(value.beforeContent, "V3 adapter beforeContent");
1468
+ const beforeContent = value.beforeContent === null ? null : parseText(value.beforeContent, "mancode adapter beforeContent");
1469
1469
  const beforeDigest = parseDigestOrNull(value.beforeDigest, "beforeDigest");
1470
1470
  if (beforeDigest !== adapterFileContentDigest(target, beforeContent)) {
1471
- throw new Error("operation recovery V3 adapter before digest is invalid");
1471
+ throw new Error(
1472
+ "operation recovery mancode adapter before digest is invalid"
1473
+ );
1472
1474
  }
1473
1475
  const targetContent = parseText(
1474
1476
  value.targetContent,
1475
- "V3 adapter targetContent"
1477
+ "mancode adapter targetContent"
1476
1478
  );
1477
1479
  if (!targetContent.trim()) {
1478
- throw new Error("operation recovery V3 adapter target content is invalid");
1480
+ throw new Error(
1481
+ "operation recovery mancode adapter target content is invalid"
1482
+ );
1479
1483
  }
1480
1484
  adapterFileContentDigest(target, targetContent);
1481
1485
  return {
@@ -5168,7 +5172,7 @@ function parseQuarantineCandidate(value) {
5168
5172
  function assertSourcePlacement(purpose, sourceTaskRef, candidateTaskRef) {
5169
5173
  if (purpose === "legacy_migration" && sourceTaskRef !== null) {
5170
5174
  throw new Error(
5171
- "legacy migration quarantine cannot claim a V3 source TaskRef"
5175
+ "legacy migration quarantine cannot claim a current mancode source TaskRef"
5172
5176
  );
5173
5177
  }
5174
5178
  if (purpose === "publish_promote") {
@@ -11499,7 +11503,7 @@ async function activateLegacyMigration(input) {
11499
11503
  for (const action of payload.actions.filter(
11500
11504
  (action2) => action2.kind === "v3_adapter_file"
11501
11505
  )) {
11502
- const { applyV3AdapterFilePlan: applyV3AdapterFilePlan2 } = await import("./v3-adapter-DDZB3Y6S.js");
11506
+ const { applyV3AdapterFilePlan: applyV3AdapterFilePlan2 } = await import("./v3-adapter-CPZNFTJR.js");
11503
11507
  await applyV3AdapterFilePlan2(root, action);
11504
11508
  }
11505
11509
  journal = await completeActivationStep(
@@ -19835,7 +19839,7 @@ async function contextBeta(rootDir, options) {
19835
19839
  return printV3Error(
19836
19840
  options.json,
19837
19841
  v3ErrorCode(error, "MANCODE_BETA_GATE_FAILED"),
19838
- error instanceof Error ? error.message : "Unable to evaluate Beta readiness."
19842
+ error instanceof Error ? error.message : "Unable to evaluate release readiness."
19839
19843
  );
19840
19844
  }
19841
19845
  }
@@ -19953,7 +19957,7 @@ async function contextWorktreeRegister(rootDir, options) {
19953
19957
  return printV3Error(
19954
19958
  options.json,
19955
19959
  v3ErrorCode(error, "MANCODE_WORKTREE_REGISTER_FAILED"),
19956
- error instanceof Error ? error.message : "Unable to register this worktree for V3 coordination."
19960
+ error instanceof Error ? error.message : "Unable to register this worktree for mancode coordination."
19957
19961
  );
19958
19962
  }
19959
19963
  }
@@ -20098,7 +20102,7 @@ async function contextCompact(rootDir, options) {
20098
20102
  return printV3Error(
20099
20103
  options.json,
20100
20104
  v3ErrorCode(error, "MANCODE_CONTEXT_COMPACT_FAILED"),
20101
- error instanceof Error ? error.message : "Unable to compact V3 context."
20105
+ error instanceof Error ? error.message : "Unable to compact mancode context."
20102
20106
  );
20103
20107
  }
20104
20108
  }
@@ -20151,7 +20155,7 @@ async function contextPublish(rootDir, task, options) {
20151
20155
  return printV3Error(
20152
20156
  options.json,
20153
20157
  v3ErrorCode(error, "MANCODE_CONTEXT_PUBLISH_FAILED"),
20154
- error instanceof Error ? error.message : "Unable to preview the local V3 task publish."
20158
+ error instanceof Error ? error.message : "Unable to preview the local mancode task publish."
20155
20159
  );
20156
20160
  }
20157
20161
  }
@@ -20181,7 +20185,7 @@ async function contextPublish(rootDir, task, options) {
20181
20185
  return printV3Error(
20182
20186
  options.json,
20183
20187
  v3ErrorCode(error, "MANCODE_CONTEXT_PUBLISH_FAILED"),
20184
- error instanceof Error ? error.message : "Unable to publish the local V3 task."
20188
+ error instanceof Error ? error.message : "Unable to publish the local mancode task."
20185
20189
  );
20186
20190
  }
20187
20191
  }
@@ -20251,7 +20255,7 @@ async function contextReconcileTaskHead(rootDir, task, options) {
20251
20255
  return printV3Error(
20252
20256
  options.json,
20253
20257
  v3ErrorCode(error, "MANCODE_CONTEXT_RECONCILE_TASK_HEAD_FAILED"),
20254
- error instanceof Error ? error.message : "Unable to reconcile the V3 task head."
20258
+ error instanceof Error ? error.message : "Unable to reconcile the mancode task head."
20255
20259
  );
20256
20260
  }
20257
20261
  }
@@ -24790,7 +24794,7 @@ async function init(rootDir = process5.cwd(), options = {}) {
24790
24794
  }
24791
24795
  if (authority === "legacy" && await pathExists6(v3SchemaFile)) {
24792
24796
  console.error(
24793
- "\u2717 V3 authority is already present; refusing to create legacy state.json."
24797
+ "\u2717 mancode authority is already present; refusing to create legacy state.json."
24794
24798
  );
24795
24799
  console.error(
24796
24800
  " Use `mancode status` or `mancode install <platform>` to inspect or repair this project."
@@ -25216,14 +25220,14 @@ async function init(rootDir = process5.cwd(), options = {}) {
25216
25220
  async function initializeV3(rootDir, options) {
25217
25221
  if (options.force) {
25218
25222
  console.error(
25219
- "\u2717 --force is not supported for journaled V3 initialization."
25223
+ "\u2717 --force is not supported for journaled mancode initialization."
25220
25224
  );
25221
25225
  return EXIT_INIT_FAILED;
25222
25226
  }
25223
25227
  if (options.style !== void 0) {
25224
25228
  console.error("\u2717 --style is only supported by `mancode init --legacy`.");
25225
25229
  console.error(
25226
- " V3 detects project facts; run `mancode refresh-style` after initialization to refresh local style tokens."
25230
+ " mancode detects project facts; run `mancode refresh-style` after initialization to refresh local style tokens."
25227
25231
  );
25228
25232
  return EXIT_INIT_FAILED;
25229
25233
  }
@@ -25241,7 +25245,7 @@ async function initializeV3(rootDir, options) {
25241
25245
  }
25242
25246
  existingV3 = true;
25243
25247
  if (options.platform === void 0) {
25244
- console.log("\u2139\uFE0F mancode V3 is already initialized.");
25248
+ console.log("\u2139\uFE0F mancode is already initialized.");
25245
25249
  return EXIT_ALREADY_INITIALIZED;
25246
25250
  }
25247
25251
  } catch (error) {
@@ -25275,10 +25279,10 @@ async function initializeV3(rootDir, options) {
25275
25279
  for (const platform of selectedPlatforms) {
25276
25280
  await installV3Adapter(rootDir, platform);
25277
25281
  }
25278
- console.log("\u2139\uFE0F mancode V3 is already initialized.");
25282
+ console.log("\u2139\uFE0F mancode is already initialized.");
25279
25283
  if (selectedPlatforms.length > 0) {
25280
25284
  console.log(
25281
- ` V3 bootstrap repaired: ${selectedPlatforms.join(", ")}`
25285
+ ` mancode bootstrap repaired: ${selectedPlatforms.join(", ")}`
25282
25286
  );
25283
25287
  }
25284
25288
  return EXIT_ALREADY_INITIALIZED;
@@ -25290,7 +25294,7 @@ async function initializeV3(rootDir, options) {
25290
25294
  for (const platform of selectedPlatforms) {
25291
25295
  await installV3Adapter(rootDir, platform);
25292
25296
  }
25293
- console.log("\u2713 Initialized mancode V3 greenfield project.");
25297
+ console.log("\u2713 Initialized mancode project.");
25294
25298
  console.log(` workspace: ${result2.runtime.workspaceId}`);
25295
25299
  console.log(` operation: ${result2.journal.operationId}`);
25296
25300
  if (options.team !== void 0) {
@@ -25303,7 +25307,7 @@ async function initializeV3(rootDir, options) {
25303
25307
  " No platform bootstrap selected. Run `mancode install <platform>`."
25304
25308
  );
25305
25309
  } else {
25306
- console.log(` V3 bootstrap: ${selectedPlatforms.join(", ")}`);
25310
+ console.log(` mancode bootstrap: ${selectedPlatforms.join(", ")}`);
25307
25311
  }
25308
25312
  return EXIT_OK;
25309
25313
  } catch (error) {
@@ -25312,7 +25316,7 @@ async function initializeV3(rootDir, options) {
25312
25316
  }
25313
25317
  }
25314
25318
  function printV3InitError(error) {
25315
- const message = error instanceof Error ? error.message : "V3 initialization failed";
25319
+ const message = error instanceof Error ? error.message : "mancode initialization failed";
25316
25320
  console.error(`\u2717 ${message}`);
25317
25321
  if (message === "MANCODE_LEGACY_AUTHORITY_PRESENT") {
25318
25322
  console.error(" Run `mancode migrate context --dry-run` instead.");
@@ -25690,7 +25694,9 @@ async function install(rootDir = process6.cwd(), platform = "claude-code", optio
25690
25694
  }
25691
25695
  if (options.shadow) {
25692
25696
  console.error("\u2717 MANCODE_V3_ADAPTER_SHADOW_REQUIRES_V3");
25693
- console.error(" Adapter shadow staging requires a V3 dual-read project.");
25697
+ console.error(
25698
+ " Adapter shadow staging requires a mancode dual-read project."
25699
+ );
25694
25700
  return EXIT_INSTALL_FAILED;
25695
25701
  }
25696
25702
  if (!await pathExists7(stateFile)) {
@@ -25787,7 +25793,7 @@ async function installV3(rootDir, platform, options) {
25787
25793
  }
25788
25794
  const staged = await stageV3Adapter(rootDir, installer.name);
25789
25795
  console.log(
25790
- `\u2713 ${formatPlatformName(platform)} V3 bootstrap and original mode entries staged for shadow comparison.`
25796
+ `\u2713 ${formatPlatformName(platform)} mancode bootstrap and original mode entries staged for shadow comparison.`
25791
25797
  );
25792
25798
  console.log(` ${staged.stagingTarget}`);
25793
25799
  for (const entry of staged.modeEntries) {
@@ -25800,17 +25806,19 @@ async function installV3(rootDir, platform, options) {
25800
25806
  }
25801
25807
  if (options.minimal) {
25802
25808
  console.log(
25803
- "\u2139\uFE0F V3 adapters are already bootstrap-only; --minimal has no additional effect."
25809
+ "\u2139\uFE0F mancode adapters are already bootstrap-only; --minimal has no additional effect."
25804
25810
  );
25805
25811
  }
25806
25812
  const installed = await installV3Adapter(rootDir, installer.name);
25807
- console.log(`\u2713 ${formatPlatformName(platform)} V3 bootstrap installed.`);
25813
+ console.log(
25814
+ `\u2713 ${formatPlatformName(platform)} mancode bootstrap installed.`
25815
+ );
25808
25816
  console.log(` ${installed.target}`);
25809
25817
  return EXIT_OK2;
25810
25818
  } catch (err) {
25811
25819
  const message = err instanceof Error ? err.message : String(err);
25812
25820
  console.error(
25813
- `\u2717 ${formatPlatformName(platform)} V3 adapter install failed: ${message}`
25821
+ `\u2717 ${formatPlatformName(platform)} mancode adapter install failed: ${message}`
25814
25822
  );
25815
25823
  return EXIT_INSTALL_FAILED;
25816
25824
  }
@@ -25920,7 +25928,7 @@ async function listV3Platforms(rootDir) {
25920
25928
  platforms.map((platform) => inspectV3Adapter(rootDir, platform.name))
25921
25929
  );
25922
25930
  console.log("");
25923
- console.log("Available platforms (V3 bootstrap):");
25931
+ console.log("Available platforms (mancode bootstrap):");
25924
25932
  for (const [index, platform] of platforms.entries()) {
25925
25933
  const status2 = statuses[index];
25926
25934
  if (status2 === void 0) {
@@ -25928,7 +25936,7 @@ async function listV3Platforms(rootDir) {
25928
25936
  }
25929
25937
  const marker = status2.installed ? "\u2713" : "\u25CB";
25930
25938
  console.log(
25931
- ` ${marker} ${platform.name.padEnd(12)} ${platform.displayName.padEnd(16)} V3 bootstrap; explicit session identity`
25939
+ ` ${marker} ${platform.name.padEnd(12)} ${platform.displayName.padEnd(16)} mancode bootstrap; explicit session identity`
25932
25940
  );
25933
25941
  }
25934
25942
  console.log("");
@@ -26375,9 +26383,7 @@ function readTodoIssues(abs, rel, offset) {
26375
26383
  const lines = content.split("\n");
26376
26384
  const issues = [];
26377
26385
  for (let i = 0; i < lines.length && issues.length < 2; i++) {
26378
- if (/\b(TODO|FIXME|HACK|XXX|deprecated|legacy|temporary|workaround)\b/i.test(
26379
- lines[i] ?? ""
26380
- )) {
26386
+ if (isMaintenanceMarker(lines[i] ?? "")) {
26381
26387
  issues.push({
26382
26388
  id: `todo-${offset + issues.length + 1}`,
26383
26389
  severity: "P2",
@@ -26394,6 +26400,12 @@ function readTodoIssues(abs, rel, offset) {
26394
26400
  return [];
26395
26401
  }
26396
26402
  }
26403
+ function isMaintenanceMarker(line) {
26404
+ const trimmed = line.trim();
26405
+ return /(?:^|\s)(?:\/\/|#|\/\*|\*|<!--)\s*(?:TODO|FIXME|HACK|XXX)\b/i.test(
26406
+ trimmed
26407
+ );
26408
+ }
26397
26409
  function scanTestGaps(files) {
26398
26410
  const sourceFiles = files.filter(
26399
26411
  (file) => file.startsWith("src/") && /\.(ts|tsx|js|jsx)$/.test(file) && !file.endsWith(".d.ts") && !file.includes("/templates/")
@@ -26893,7 +26905,7 @@ async function manps(rootDir, area = "all", options = {}) {
26893
26905
  const v3SchemaPath = path50.join(rootDir, ".mancode", "schema.json");
26894
26906
  const v3Activation = await readV3ActivationState(v3SchemaPath);
26895
26907
  if (v3Activation !== null && v3Activation !== "v3_active" && v3Activation !== "dual_read") {
26896
- const message = `manps is unavailable while V3 activation is ${v3Activation}`;
26908
+ const message = `manps is unavailable while mancode activation is ${v3Activation}`;
26897
26909
  if (options.json) {
26898
26910
  console.log(JSON.stringify({ error: "scan failed", message }, null, 2));
26899
26911
  } else {
@@ -27404,17 +27416,17 @@ async function refreshV3Project(rootDir) {
27404
27416
  revision: (project.projectFacts?.revision ?? 0) + 1
27405
27417
  });
27406
27418
  await writeProjectFacts(rootDir, facts);
27407
- console.log("\u2713 V3 project facts refreshed.");
27419
+ console.log("\u2713 mancode project facts refreshed.");
27408
27420
  console.log(
27409
27421
  ` Kind: ${facts.profile.projectKind} | Stack: ${[...facts.profile.languages, ...facts.profile.frameworks].join(" + ") || "unknown"}`
27410
27422
  );
27411
27423
  console.log(
27412
- " V3 adapters remain unchanged because their bootstrap is static."
27424
+ " mancode adapters remain unchanged because their bootstrap is static."
27413
27425
  );
27414
27426
  return EXIT_OK6;
27415
27427
  } catch (error) {
27416
27428
  const message = error instanceof Error ? error.message : String(error);
27417
- console.error(`\u2717 V3 project facts refresh failed: ${message}`);
27429
+ console.error(`\u2717 mancode project facts refresh failed: ${message}`);
27418
27430
  return EXIT_REFRESH_FAILED;
27419
27431
  }
27420
27432
  }
@@ -27663,7 +27675,7 @@ async function refreshV3Style(rootDir) {
27663
27675
  if (project.manifest.activationState !== "v3_active") {
27664
27676
  throw new Error("MANCODE_V3_REFRESH_REQUIRES_ACTIVE");
27665
27677
  }
27666
- console.log("\u2713 \u5237\u65B0 V3 \u9879\u76EE profile...");
27678
+ console.log("\u2713 \u5237\u65B0 mancode \u9879\u76EE profile...");
27667
27679
  const profile = await detectProjectProfile(rootDir);
27668
27680
  const uiLibraryHint = primaryUiLibrary(profile);
27669
27681
  await writeProjectFacts(
@@ -27687,7 +27699,7 @@ async function refreshV3Style(rootDir) {
27687
27699
  console.log(
27688
27700
  "\u2139\uFE0F No UI assets detected in project profile. Skipping style scan."
27689
27701
  );
27690
- console.log(" Updated V3 project facts.");
27702
+ console.log(" Updated mancode project facts.");
27691
27703
  return EXIT_OK7;
27692
27704
  }
27693
27705
  console.log("\u2713 \u626B\u63CF\u9879\u76EE\u8BBE\u8BA1 token...");
@@ -27707,7 +27719,7 @@ async function refreshV3Style(rootDir) {
27707
27719
  return EXIT_OK7;
27708
27720
  } catch (error) {
27709
27721
  const message = error instanceof Error ? error.message : String(error);
27710
- console.error(`\u2717 V3 style refresh failed: ${message}`);
27722
+ console.error(`\u2717 mancode style refresh failed: ${message}`);
27711
27723
  return EXIT_V3_REFRESH_FAILED;
27712
27724
  }
27713
27725
  }
@@ -28398,11 +28410,11 @@ function printText(r) {
28398
28410
  }
28399
28411
  function printV3Text(result2) {
28400
28412
  console.log("");
28401
- console.log(`mancode v${result2.version} (V3 authority)`);
28413
+ console.log(`mancode v${result2.version}`);
28402
28414
  console.log("");
28403
28415
  console.log(`Project: ${result2.project}`);
28404
28416
  console.log(
28405
- `Activation: ${result2.activation.state} (epoch ${result2.activation.epoch})`
28417
+ `Activation: ${formatActivationState(result2.activation.state)} (epoch ${result2.activation.epoch})`
28406
28418
  );
28407
28419
  console.log(
28408
28420
  `Runtime: ${result2.runtime.binding}${result2.runtime.error ? ` (${result2.runtime.error})` : ""}`
@@ -28432,11 +28444,11 @@ function printV3Text(result2) {
28432
28444
  }
28433
28445
  if (result2.legacyAuthorityPresent) {
28434
28446
  console.log(
28435
- "Legacy: legacy authority detected; V3 writes may be blocked."
28447
+ "Legacy: legacy authority detected; mancode writes may be blocked."
28436
28448
  );
28437
28449
  }
28438
28450
  console.log("");
28439
- console.log("V3 adapter status:");
28451
+ console.log("mancode adapter status:");
28440
28452
  for (const platform of getPlatformInstallers()) {
28441
28453
  const adapter = result2.adapters[platform.name];
28442
28454
  const marker = adapter.installed ? "\u2713" : "\u25CB";
@@ -28448,11 +28460,14 @@ function printV3Text(result2) {
28448
28460
  if (result2.runtime.binding !== "ready") {
28449
28461
  console.log("");
28450
28462
  console.log(
28451
- "Run `mancode context worktree register` in this checkout before V3 mutations."
28463
+ "Run `mancode context worktree register` in this checkout before mancode mutations."
28452
28464
  );
28453
28465
  }
28454
28466
  console.log("");
28455
28467
  }
28468
+ function formatActivationState(state) {
28469
+ return state.replace(/^v3_/, "").replaceAll("_", " ");
28470
+ }
28456
28471
  function formatTeamStatus(team) {
28457
28472
  if (team.forced) return `forced (${team.contributors} contributors)`;
28458
28473
  if (team.isTeam) return `detected (${team.contributors} contributors)`;
@@ -36898,9 +36913,9 @@ async function uninstall(rootDir = process11.cwd(), platform, options = {}) {
36898
36913
  }
36899
36914
  async function uninstallV3(rootDir, platform, options) {
36900
36915
  if (!platform || options.all) {
36901
- console.error("\u2717 V3 authority is protected from bulk uninstall.");
36916
+ console.error("\u2717 mancode authority is protected from bulk uninstall.");
36902
36917
  console.error(
36903
- " Remove a single bootstrap with `mancode uninstall <platform>`, or complete an explicit V3 archive/migration workflow first."
36918
+ " Remove a single bootstrap with `mancode uninstall <platform>`, or complete an explicit mancode archive/migration workflow first."
36904
36919
  );
36905
36920
  return EXIT_V3_AUTHORITY_PROTECTED;
36906
36921
  }
@@ -36914,17 +36929,21 @@ async function uninstallV3(rootDir, platform, options) {
36914
36929
  }
36915
36930
  if (!options.force) {
36916
36931
  console.log(
36917
- `\u2139\uFE0F This will remove only the ${formatPlatformName(platform)} V3 bootstrap.`
36932
+ `\u2139\uFE0F This will remove only the ${formatPlatformName(platform)} mancode bootstrap.`
36933
+ );
36934
+ console.log(
36935
+ " mancode task, session, and shared authority are preserved."
36918
36936
  );
36919
- console.log(" V3 task, session, and shared authority are preserved.");
36920
36937
  }
36921
36938
  try {
36922
36939
  await removeV3Adapter(rootDir, installer.name);
36923
- console.log(`\u2713 Removed ${formatPlatformName(platform)} V3 bootstrap.`);
36940
+ console.log(
36941
+ `\u2713 Removed ${formatPlatformName(platform)} mancode bootstrap.`
36942
+ );
36924
36943
  return EXIT_OK9;
36925
36944
  } catch (error) {
36926
36945
  const message = error instanceof Error ? error.message : String(error);
36927
- console.error(`\u2717 V3 bootstrap removal failed: ${message}`);
36946
+ console.error(`\u2717 mancode bootstrap removal failed: ${message}`);
36928
36947
  return EXIT_V3_AUTHORITY_PROTECTED;
36929
36948
  }
36930
36949
  }
@@ -41364,6 +41383,80 @@ function compareUtf816(left, right) {
41364
41383
  return Buffer.from(left, "utf8").compare(Buffer.from(right, "utf8"));
41365
41384
  }
41366
41385
 
41386
+ // src/commands/requirements-input.ts
41387
+ function normalizeRequirementsInput(value, requestedTaskRef, now = /* @__PURE__ */ new Date()) {
41388
+ if (isRecord13(value) && "schemaVersion" in value) {
41389
+ return parseRequirementsLedger(value);
41390
+ }
41391
+ const serialized = JSON.stringify(value);
41392
+ if (serialized === void 0) {
41393
+ throw new Error("requirements input must be valid JSON");
41394
+ }
41395
+ const semantic = parseRequirementsLedger2(serialized);
41396
+ return buildCanonicalRequirements(semantic, requestedTaskRef, now);
41397
+ }
41398
+ function buildCanonicalRequirements(semantic, requestedTaskRef, now) {
41399
+ const taskRef = parseTaskRefValue(requestedTaskRef);
41400
+ let allocatedIds = 0;
41401
+ const allocateId = () => createUlid(now.getTime() + allocatedIds++);
41402
+ const draft = {
41403
+ schemaVersion: 1,
41404
+ canonicalizationVersion: "mancode-jcs-v1",
41405
+ taskRef,
41406
+ revision: 1,
41407
+ status: semantic.blockingUnknowns.length === 0 ? "confirmed" : "draft",
41408
+ goal: semantic.goal,
41409
+ functionalScope: {
41410
+ inScope: semantic.confirmedScope,
41411
+ outOfScope: semantic.excludedScope
41412
+ },
41413
+ technicalDecisions: semantic.technicalDecisions.map((statement, index) => ({
41414
+ displayId: `TD-${index + 1}`,
41415
+ legacyId: null,
41416
+ decisionId: allocateId(),
41417
+ statement
41418
+ })),
41419
+ defaults: semantic.defaults.map((statement, index) => ({
41420
+ displayId: `D-${index + 1}`,
41421
+ legacyId: null,
41422
+ defaultId: allocateId(),
41423
+ statement
41424
+ })),
41425
+ coverage: semantic.coverage.map((item) => ({
41426
+ coverageId: allocateId(),
41427
+ ...item
41428
+ })),
41429
+ requirements: [],
41430
+ acceptanceCriteria: semantic.acceptanceCriteria.map((item) => ({
41431
+ displayId: item.id,
41432
+ legacyId: item.id,
41433
+ criterionId: allocateId(),
41434
+ requirementIds: [],
41435
+ statement: item.description,
41436
+ required: item.required,
41437
+ verificationRequirement: item.method
41438
+ })),
41439
+ blockingUnknowns: semantic.blockingUnknowns.map((statement, index) => ({
41440
+ displayId: `U-${index + 1}`,
41441
+ legacyId: null,
41442
+ unknownId: allocateId(),
41443
+ statement,
41444
+ status: "open"
41445
+ })),
41446
+ legacySource: null,
41447
+ contentDigest: "",
41448
+ lastOperationId: null,
41449
+ updatedAt: now.toISOString()
41450
+ };
41451
+ return parseRequirementsLedger({
41452
+ ...draft,
41453
+ contentDigest: requirementsLedgerDigest(draft)
41454
+ });
41455
+ }
41456
+ function isRecord13(value) {
41457
+ return typeof value === "object" && value !== null && !Array.isArray(value);
41458
+ }
41459
+
41367
41460
  // src/commands/workflow.ts
41368
41461
  var EXIT_OK10 = 0;
41369
41462
  var EXIT_NOT_INITIALIZED7 = 1;
@@ -41378,7 +41471,7 @@ async function workflow(rootDir, subcommand, args = [], options = {}) {
41378
41471
  return printV3Error(
41379
41472
  options.json,
41380
41473
  "MANCODE_V3_WRITE_REQUIRES_ACTIVATION",
41381
- "This project has staged V3 context but remains in dual-read migration. Use legacy workflows until activation."
41474
+ "This project has staged mancode context but remains in dual-read migration. Use legacy workflows until activation."
41382
41475
  );
41383
41476
  }
41384
41477
  if (options.json) {
@@ -41465,7 +41558,7 @@ async function workflowV3(rootDir, subcommand, args, options) {
41465
41558
  return printV3Error(
41466
41559
  options.json,
41467
41560
  "MANCODE_V3_OPERATION_NOT_IMPLEMENTED",
41468
- `workflow ${subcommand} is not yet implemented for V3 authority.`
41561
+ `workflow ${subcommand} is not yet implemented for mancode authority.`
41469
41562
  );
41470
41563
  }
41471
41564
  async function workflowUpdateV3(rootDir, args, options) {
@@ -41482,7 +41575,7 @@ async function workflowUpdateV3(rootDir, args, options) {
41482
41575
  return printV3Error(
41483
41576
  options.json,
41484
41577
  "MANCODE_WORKFLOW_UPDATE_EMPTY",
41485
- "V3 workflow update requires --status or --blocking-reason.",
41578
+ "Workflow update requires --status or --blocking-reason.",
41486
41579
  EXIT_INVALID_ARG3
41487
41580
  );
41488
41581
  }
@@ -41490,7 +41583,7 @@ async function workflowUpdateV3(rootDir, args, options) {
41490
41583
  return printV3Error(
41491
41584
  options.json,
41492
41585
  "MANCODE_V3_WORKFLOW_UPDATE_FIELD_UNSUPPORTED",
41493
- "V3 workflow update only changes lifecycle status and a blocked reason. Use the dedicated requirements, plan, review, verification, scope, complete, or promote command for governed fields.",
41586
+ "Workflow update only changes lifecycle status and a blocked reason. Use the dedicated requirements, plan, review, verification, scope, complete, or promote command for governed fields.",
41494
41587
  EXIT_INVALID_ARG3
41495
41588
  );
41496
41589
  }
@@ -41499,7 +41592,7 @@ async function workflowUpdateV3(rootDir, args, options) {
41499
41592
  return printV3Error(
41500
41593
  options.json,
41501
41594
  "MANCODE_EXPECTED_REVISION_REQUIRED",
41502
- "V3 workflow update requires --expected-revision <positive integer>.",
41595
+ "Workflow update requires --expected-revision <positive integer>.",
41503
41596
  EXIT_INVALID_ARG3
41504
41597
  );
41505
41598
  }
@@ -41554,7 +41647,7 @@ async function workflowUpdateV3(rootDir, args, options) {
41554
41647
  return printV3Error(
41555
41648
  options.json,
41556
41649
  v3ErrorCode(error, "MANCODE_V3_WORKFLOW_UPDATE_FAILED"),
41557
- error instanceof Error ? error.message : "Unable to update the V3 workflow lifecycle."
41650
+ error instanceof Error ? error.message : "Unable to update the mancode workflow lifecycle."
41558
41651
  );
41559
41652
  }
41560
41653
  }
@@ -41606,7 +41699,7 @@ async function workflowChildResultMergeV3(rootDir, args, options) {
41606
41699
  return printV3Error(
41607
41700
  options.json,
41608
41701
  v3ErrorCode(error, "MANCODE_V3_CHILD_RESULT_MERGE_FAILED"),
41609
- error instanceof Error ? error.message : "Unable to merge the V3 child diagnostic result."
41702
+ error instanceof Error ? error.message : "Unable to merge the mancode child diagnostic result."
41610
41703
  );
41611
41704
  }
41612
41705
  }
@@ -41663,7 +41756,7 @@ async function workflowSoloHandoffV3(rootDir, args, options) {
41663
41756
  return printV3Error(
41664
41757
  options.json,
41665
41758
  v3ErrorCode(error, "MANCODE_V3_SOLO_HANDOFF_FAILED"),
41666
- error instanceof Error ? error.message : "Unable to run the V3 solo handoff."
41759
+ error instanceof Error ? error.message : "Unable to run the mancode solo handoff."
41667
41760
  );
41668
41761
  }
41669
41762
  }
@@ -41723,7 +41816,7 @@ async function workflowPromoteV3(rootDir, args, options) {
41723
41816
  return printV3Error(
41724
41817
  options.json,
41725
41818
  v3ErrorCode(error, "MANCODE_V3_WORKFLOW_PROMOTE_FAILED"),
41726
- error instanceof Error ? error.message : "Unable to preview the V3 workflow promotion."
41819
+ error instanceof Error ? error.message : "Unable to preview the mancode workflow promotion."
41727
41820
  );
41728
41821
  }
41729
41822
  }
@@ -41753,7 +41846,7 @@ async function workflowPromoteV3(rootDir, args, options) {
41753
41846
  return printV3Error(
41754
41847
  options.json,
41755
41848
  v3ErrorCode(error, "MANCODE_V3_WORKFLOW_PROMOTE_FAILED"),
41756
- error instanceof Error ? error.message : "Unable to promote the local V3 workflow."
41849
+ error instanceof Error ? error.message : "Unable to promote the local mancode workflow."
41757
41850
  );
41758
41851
  }
41759
41852
  }
@@ -41835,7 +41928,7 @@ async function workflowScopeChangeV3(rootDir, args, options) {
41835
41928
  return printV3Error(
41836
41929
  options.json,
41837
41930
  v3ErrorCode(error, "MANCODE_V3_SCOPE_CHANGE_FAILED"),
41838
- error instanceof Error ? error.message : "Unable to change the V3 workflow scope."
41931
+ error instanceof Error ? error.message : "Unable to change the mancode workflow scope."
41839
41932
  );
41840
41933
  }
41841
41934
  }
@@ -41908,7 +42001,7 @@ async function workflowCompleteV3(rootDir, args, options) {
41908
42001
  return printV3Error(
41909
42002
  options.json,
41910
42003
  v3ErrorCode(error, "MANCODE_V3_TASK_COMPLETE_FAILED"),
41911
- error instanceof Error ? error.message : "Unable to complete the V3 task."
42004
+ error instanceof Error ? error.message : "Unable to complete the mancode task."
41912
42005
  );
41913
42006
  }
41914
42007
  }
@@ -41958,7 +42051,7 @@ async function workflowVerifyV3(rootDir, args, options) {
41958
42051
  return printV3Error(
41959
42052
  options.json,
41960
42053
  v3ErrorCode(error, "MANCODE_V3_VERIFICATION_RECORD_FAILED"),
41961
- error instanceof Error ? error.message : "Unable to record V3 verification."
42054
+ error instanceof Error ? error.message : "Unable to record mancode verification."
41962
42055
  );
41963
42056
  }
41964
42057
  }
@@ -42009,7 +42102,7 @@ async function workflowReviewV3(rootDir, args, options) {
42009
42102
  return printV3Error(
42010
42103
  options.json,
42011
42104
  v3ErrorCode(error, "MANCODE_V3_REVIEW_APPLY_FAILED"),
42012
- error instanceof Error ? error.message : "Unable to apply the V3 review."
42105
+ error instanceof Error ? error.message : "Unable to apply the mancode review."
42013
42106
  );
42014
42107
  }
42015
42108
  }
@@ -42083,7 +42176,7 @@ async function workflowPlanV3(rootDir, args, options) {
42083
42176
  return printV3Error(
42084
42177
  options.json,
42085
42178
  v3ErrorCode(error, "MANCODE_V3_PLAN_REVISION_FAILED"),
42086
- error instanceof Error ? error.message : "Unable to revise the V3 plan."
42179
+ error instanceof Error ? error.message : "Unable to revise the mancode plan."
42087
42180
  );
42088
42181
  }
42089
42182
  }
@@ -42110,13 +42203,15 @@ async function workflowRequirementsV3(rootDir, args, options) {
42110
42203
  try {
42111
42204
  const project = await readV3CommandProject(rootDir);
42112
42205
  const session = await resolveV3CommandSession(project, options);
42113
- const requirements = await readWorkflowJsonInputFile(
42206
+ const taskRef = parseTaskRef(task);
42207
+ const requirementsInput = await readWorkflowJsonInputFile(
42114
42208
  project.projectRoot,
42115
42209
  options.file
42116
42210
  );
42211
+ const requirements = normalizeRequirementsInput(requirementsInput, taskRef);
42117
42212
  const result2 = await finalizeV3Requirements({
42118
42213
  projectRoot: project.projectRoot,
42119
- taskRef: parseTaskRef(task),
42214
+ taskRef,
42120
42215
  sessionId: session.sessionId,
42121
42216
  expectedTaskRevision,
42122
42217
  requirements
@@ -42136,7 +42231,7 @@ async function workflowRequirementsV3(rootDir, args, options) {
42136
42231
  return printV3Error(
42137
42232
  options.json,
42138
42233
  v3ErrorCode(error, "MANCODE_V3_REQUIREMENTS_FINALIZE_FAILED"),
42139
- error instanceof Error ? error.message : "Unable to finalize V3 requirements."
42234
+ error instanceof Error ? error.message : "Unable to finalize mancode requirements."
42140
42235
  );
42141
42236
  }
42142
42237
  }
@@ -42230,7 +42325,7 @@ async function workflowCreateV3(rootDir, args, options) {
42230
42325
  return printV3Error(
42231
42326
  options.json,
42232
42327
  v3ErrorCode(error, "MANCODE_V3_WORKFLOW_CREATE_FAILED"),
42233
- error instanceof Error ? error.message : "Unable to create V3 workflow."
42328
+ error instanceof Error ? error.message : "Unable to create mancode workflow."
42234
42329
  );
42235
42330
  }
42236
42331
  }
@@ -43405,7 +43500,7 @@ async function pathExists16(p) {
43405
43500
  program.name("mancode").description(
43406
43501
  "AI coding agent harness. Modes: solo, man, manba, manteam, manps."
43407
43502
  ).version(VERSION);
43408
- program.command("init").description("Initialize mancode in the current project").option("--force", "Reinstall even if already initialized").option("--yes", "Skip all confirmations (CI mode)").option("--team", "Force enable team mode (MVP-2)").option("--no-team", "Force disable team mode (MVP-2)").option("--style <name>", "Specify aesthetic style (MVP-2)").option("--platform <platforms>", "Adapters: comma-separated names or all").option("--empty", "Initialize a safe empty directory as a generic project").option("--v3", "Use V3 authority explicitly (the CLI default)").option("--legacy", "Use the legacy state.json initializer").option("--lang <locale>", "Initialization language: zh-CN or en").action(async (options) => {
43503
+ program.command("init").description("Initialize mancode in the current project").option("--force", "Reinstall even if already initialized").option("--yes", "Skip all confirmations (CI mode)").option("--team", "Force enable team mode (MVP-2)").option("--no-team", "Force disable team mode (MVP-2)").option("--style <name>", "Specify aesthetic style (MVP-2)").option("--platform <platforms>", "Adapters: comma-separated names or all").option("--empty", "Initialize a safe empty directory as a generic project").addOption(new Option("--v3").hideHelp()).option("--legacy", "Use the legacy state.json initializer").option("--lang <locale>", "Initialization language: zh-CN or en").action(async (options) => {
43409
43504
  const code = await init(process.cwd(), {
43410
43505
  ...options,
43411
43506
  fromCli: true,
@@ -43417,7 +43512,7 @@ program.command("install [platform]").description(
43417
43512
  "Install platform adapter (claude-code, cursor, codex, copilot, zcode)"
43418
43513
  ).option("--force", "Reinstall even if already installed").option("--minimal", "Minimal install (MVP-2)").option(
43419
43514
  "--shadow",
43420
- "Stage a V3 bootstrap candidate without changing live files"
43515
+ "Stage a mancode bootstrap candidate without changing live files"
43421
43516
  ).action(async (platform, options) => {
43422
43517
  const code = await install(
43423
43518
  process.cwd(),
@@ -43441,15 +43536,15 @@ program.command("uninstall [platform]").description("Remove platform adapter or
43441
43536
  program.command("workflow <subcommand> [args...]").description("Manage mancode workflows").option("--dry-run", "Preview clean without deleting").option("--older-than <duration>", "Clean workflows older than (e.g. 30d)").option("--step <n>", "Update workflow current step").option("--status <status>", "Update workflow status").option(
43442
43537
  "--parent-task <taskId>",
43443
43538
  "Parent /man or /manteam workflow for manba"
43444
- ).option("--parent <namespace:id>", "V3 parent TaskRef for a manba child").option(
43539
+ ).option("--parent <namespace:id>", "Parent TaskRef for a manba child").option(
43445
43540
  "--participant <actorId>",
43446
43541
  "Invite a joined team participant",
43447
43542
  collectOption,
43448
43543
  []
43449
- ).option("--visibility <visibility>", "V3: local or shared").option("--coordination <coordination>", "V3: single or team").option("--session <id>", "V3 session ID (otherwise MANCODE_SESSION_ID)").option("--client <name>", "V3 client identity (default: mancode-cli)").option("--expected-revision <n>", "V3 expected task revision for mutations").option("--child-revision <n>", "V3 expected child task revision for merge").option("--summary <text>", "Privacy-screened child result summary").option("--next-action <text>", "Next parent action after a child merge").option("--sync", "Publish shared V3 mutations through git-ref transport").option(
43544
+ ).option("--visibility <visibility>", "Task visibility: local or shared").option("--coordination <coordination>", "Task coordination: single or team").option("--session <id>", "mancode session ID (otherwise MANCODE_SESSION_ID)").option("--client <name>", "Client identity (default: mancode-cli)").option("--expected-revision <n>", "Expected task revision for mutations").option("--child-revision <n>", "Expected child task revision for merge").option("--summary <text>", "Privacy-screened child result summary").option("--next-action <text>", "Next parent action after a child merge").option("--sync", "Publish shared mutations through git-ref transport").option(
43450
43545
  "--confirm-shared",
43451
- "Confirm that task metadata may enter shared V3 authority"
43452
- ).option("--blocking-reason <reason>", "Explain why a workflow is blocked").option("--outcome <outcome>", "Set manba outcome when completing a V3 task").option("--plan-version <n>", "Set the next man/manteam plan revision").option(
43546
+ "Confirm that task metadata may enter shared mancode authority"
43547
+ ).option("--blocking-reason <reason>", "Explain why a workflow is blocked").option("--outcome <outcome>", "Set manba outcome when completing a task").option("--plan-version <n>", "Set the next man/manteam plan revision").option(
43453
43548
  "--requirements-status <status>",
43454
43549
  "Planning readiness: ready or needs_clarification"
43455
43550
  ).option(
@@ -43464,21 +43559,24 @@ program.command("workflow <subcommand> [args...]").description("Manage mancode w
43464
43559
  ).option("--blockers <ids>", "Comma-separated blocker ids found by a review").option(
43465
43560
  "--resolved <ids>",
43466
43561
  "Comma-separated blocker ids resolved in remediation"
43467
- ).option("--file <path>", "Structured requirements JSON input file").option("--acceptance <id>", "Acceptance criterion id (for example AC-1)").option("--method <method>", "Verification method: automated or manual").option("--result <result>", "Verification result").option("--evidence <text>", "Verification evidence or user confirmation").option("--command <command>", "Command used for automated verification").option("--exit-code <code>", "Exit code from automated verification").option("--evidence-file <path>", "Existing verification report or artifact").option("--reason <reason>", "Reason for an explicit review skip").option("--json", "Output as JSON (for scripts)").action(async (subcommand, args, options) => {
43562
+ ).option(
43563
+ "--file <path>",
43564
+ "Semantic or canonical structured requirements JSON input file"
43565
+ ).option("--acceptance <id>", "Acceptance criterion id (for example AC-1)").option("--method <method>", "Verification method: automated or manual").option("--result <result>", "Verification result").option("--evidence <text>", "Verification evidence or user confirmation").option("--command <command>", "Command used for automated verification").option("--exit-code <code>", "Exit code from automated verification").option("--evidence-file <path>", "Existing verification report or artifact").option("--reason <reason>", "Reason for an explicit review skip").option("--json", "Output as JSON (for scripts)").action(async (subcommand, args, options) => {
43468
43566
  const code = await workflow(process.cwd(), subcommand, args ?? [], {
43469
43567
  ...options,
43470
43568
  participants: options.participant.length === 0 ? void 0 : options.participant
43471
43569
  });
43472
43570
  process.exitCode = code;
43473
43571
  });
43474
- var contextProgram = program.command("context").description("Resolve V3 task context and manage explicit sessions");
43475
- contextProgram.command("show").description("Resolve one V3 Context Pack").option("--task <namespace:id>", "Explicit TaskRef").option("--session <id>", "Session ID (otherwise MANCODE_SESSION_ID)").option("--client <name>", "Client identity (default: mancode-cli)").option("--level <level>", "bootstrap, task, or full").option(
43572
+ var contextProgram = program.command("context").description("Resolve mancode task context and manage explicit sessions");
43573
+ contextProgram.command("show").description("Resolve one mancode Context Pack").option("--task <namespace:id>", "Explicit TaskRef").option("--session <id>", "Session ID (otherwise MANCODE_SESSION_ID)").option("--client <name>", "Client identity (default: mancode-cli)").option("--level <level>", "bootstrap, task, or full").option(
43476
43574
  "--purpose <purpose>",
43477
43575
  "orient, plan, implement, review, verify, or handoff"
43478
43576
  ).option("--json", "Output as JSON (for scripts)").action(async (options) => {
43479
43577
  process.exitCode = await contextShow(process.cwd(), options);
43480
43578
  });
43481
- var contextSessionProgram = contextProgram.command("session").description("Manage V3 session identities");
43579
+ var contextSessionProgram = contextProgram.command("session").description("Manage mancode session identities");
43482
43580
  contextSessionProgram.command("new").description("Create an explicit bootstrap session").requiredOption("--client <name>", "Client identity").option("--json", "Output as JSON (for scripts)").action(async (options) => {
43483
43581
  process.exitCode = await contextSessionNew(process.cwd(), options);
43484
43582
  });
@@ -43509,13 +43607,13 @@ contextSessionProgram.command("spike").description("Record real-host session evi
43509
43607
  ).option("--json", "Output as JSON (for scripts)").action(async (options) => {
43510
43608
  process.exitCode = await contextSessionSpike(process.cwd(), options);
43511
43609
  });
43512
- contextProgram.command("resume <namespace:id>").description("Validate and bind the current session to a V3 TaskRef").option("--session <id>", "Session ID (otherwise MANCODE_SESSION_ID)").option("--client <name>", "Client identity (default: mancode-cli)").option("--sync", "Publish shared V3 mutations through git-ref transport").option("--json", "Output as JSON (for scripts)").action(async (task, options) => {
43610
+ contextProgram.command("resume <namespace:id>").description("Validate and bind the current session to a mancode TaskRef").option("--session <id>", "Session ID (otherwise MANCODE_SESSION_ID)").option("--client <name>", "Client identity (default: mancode-cli)").option("--sync", "Publish shared mutations through git-ref transport").option("--json", "Output as JSON (for scripts)").action(async (task, options) => {
43513
43611
  process.exitCode = await contextResume(process.cwd(), task, options);
43514
43612
  });
43515
43613
  contextProgram.command("close").description("Close one explicit session without affecting other sessions").requiredOption("--session <id>", "Session ID").option("--json", "Output as JSON (for scripts)").action(async (options) => {
43516
43614
  process.exitCode = await contextClose(process.cwd(), options);
43517
43615
  });
43518
- contextProgram.command("doctor").description("Inspect unfinished V3 operations or repair one explicitly").option(
43616
+ contextProgram.command("doctor").description("Inspect unfinished mancode operations or repair one explicitly").option(
43519
43617
  "--repair <operationId>",
43520
43618
  "Repair this operation with its original session"
43521
43619
  ).option("--session <id>", "Session ID (otherwise MANCODE_SESSION_ID)").option("--client <name>", "Client identity (default: mancode-cli)").option("--json", "Output as JSON (for scripts)").action(async (options) => {
@@ -43524,10 +43622,10 @@ contextProgram.command("doctor").description("Inspect unfinished V3 operations o
43524
43622
  contextProgram.command("diagnostics [action]").description("Show or configure local aggregate diagnostics").option("--json", "Output as JSON (for scripts)").action(async (action, options) => {
43525
43623
  process.exitCode = await contextDiagnostics(process.cwd(), action, options);
43526
43624
  });
43527
- contextProgram.command("compact").description("List and remove eligible V3 runtime retention candidates").option("--task <namespace:id>", "Compact checkpoints for one completed task").option("--dry-run", "Show the deletion list without changing files").option("--apply-shared", "Permit deletion for shared completed tasks").option("--json", "Output as JSON (for scripts)").action(async (options) => {
43625
+ contextProgram.command("compact").description("List and remove eligible mancode runtime retention candidates").option("--task <namespace:id>", "Compact checkpoints for one completed task").option("--dry-run", "Show the deletion list without changing files").option("--apply-shared", "Permit deletion for shared completed tasks").option("--json", "Output as JSON (for scripts)").action(async (options) => {
43528
43626
  process.exitCode = await contextCompact(process.cwd(), options);
43529
43627
  });
43530
- contextProgram.command("beta").description("Evaluate hard V3 Beta readiness gates").requiredOption(
43628
+ contextProgram.command("beta", { hidden: true }).description("Evaluate internal release-evidence gates").requiredOption(
43531
43629
  "--release-candidate <id>",
43532
43630
  "Release candidate that must match every platform evidence record"
43533
43631
  ).option("--json", "Output as JSON (for scripts)").action(async (options) => {
@@ -43554,11 +43652,13 @@ contextProgram.command("reconcile-task-head <shared:id>").description(
43554
43652
  options
43555
43653
  );
43556
43654
  });
43557
- var contextWorktreeProgram = contextProgram.command("worktree").description("Register and inspect the current V3 checkout binding");
43558
- contextWorktreeProgram.command("register").description("Register this linked worktree before using V3 coordination").option("--json", "Output as JSON (for scripts)").action(async (options) => {
43655
+ var contextWorktreeProgram = contextProgram.command("worktree").description("Register and inspect the current mancode checkout binding");
43656
+ contextWorktreeProgram.command("register").description(
43657
+ "Register this linked worktree before using mancode coordination"
43658
+ ).option("--json", "Output as JSON (for scripts)").action(async (options) => {
43559
43659
  process.exitCode = await contextWorktreeRegister(process.cwd(), options);
43560
43660
  });
43561
- var operationProgram = program.command("operation").description("Inspect and recover durable V3 operations");
43661
+ var operationProgram = program.command("operation").description("Inspect and recover durable mancode operations");
43562
43662
  operationProgram.command("show <operationId>").description("Show one operation journal and its recovery disposition").option("--json", "Output as JSON (for scripts)").action(async (operationId, options) => {
43563
43663
  process.exitCode = await operationShow(process.cwd(), operationId, options);
43564
43664
  });
@@ -43578,11 +43678,11 @@ operationProgram.command("abort <operationId>").description(
43578
43678
  options
43579
43679
  );
43580
43680
  });
43581
- var teamProgram = program.command("team").description("Manage V3 local identity and local-team membership");
43582
- teamProgram.command("status").description("Show V3 team policy, transport, and local identity state").option("--json", "Output as JSON (for scripts)").action(async (options) => {
43681
+ var teamProgram = program.command("team").description("Manage mancode local identity and local-team membership");
43682
+ teamProgram.command("status").description("Show mancode team policy, transport, and local identity state").option("--json", "Output as JSON (for scripts)").action(async (options) => {
43583
43683
  process.exitCode = await teamStatus(process.cwd(), options);
43584
43684
  });
43585
- teamProgram.command("policy <mode>").description("Set the V3 team recommendation policy with a revision CAS").requiredOption("--expected-revision <n>", "Current team policy revision").option("--session <id>", "Session ID (otherwise MANCODE_SESSION_ID)").option("--client <name>", "Client identity (default: mancode-cli)").option("--json", "Output as JSON (for scripts)").action(async (policy, options) => {
43685
+ teamProgram.command("policy <mode>").description("Set the mancode team recommendation policy with a revision CAS").requiredOption("--expected-revision <n>", "Current team policy revision").option("--session <id>", "Session ID (otherwise MANCODE_SESSION_ID)").option("--client <name>", "Client identity (default: mancode-cli)").option("--json", "Output as JSON (for scripts)").action(async (policy, options) => {
43586
43686
  process.exitCode = await teamPolicy(process.cwd(), {
43587
43687
  ...options,
43588
43688
  policy
@@ -43656,7 +43756,7 @@ teamProgram.command("join").description(
43656
43756
  ).requiredOption("--name <displayName>", "Must match the local actor identity").option("--session <id>", "Session ID (otherwise MANCODE_SESSION_ID)").option("--client <name>", "Client identity (default: mancode-cli)").option("--sync", "Request explicit remote sync when transport supports it").option("--json", "Output as JSON (for scripts)").action(async (options) => {
43657
43757
  process.exitCode = await teamJoin(process.cwd(), options);
43658
43758
  });
43659
- teamProgram.command("checkpoint <namespace:id>").description("Create a journaled immutable checkpoint for a shared V3 task").requiredOption(
43759
+ teamProgram.command("checkpoint <namespace:id>").description("Create a journaled immutable checkpoint for a shared task").requiredOption(
43660
43760
  "--expected-task-revision <n>",
43661
43761
  "Current shared task revision"
43662
43762
  ).requiredOption("--kind <kind>", "Checkpoint kind").requiredOption("--summary <text>", "Privacy-safe checkpoint summary").option("--next-action <text>", "Next action for the receiving workflow").option("--session <id>", "Session ID (otherwise MANCODE_SESSION_ID)").option("--client <name>", "Client identity (default: mancode-cli)").option("--json", "Output as JSON (for scripts)").action(async (task, options) => {
@@ -43665,7 +43765,7 @@ teamProgram.command("checkpoint <namespace:id>").description("Create a journaled
43665
43765
  task
43666
43766
  });
43667
43767
  });
43668
- teamProgram.command("claim <namespace:id>").description("Acquire a scoped claim for a shared V3 task").requiredOption(
43768
+ teamProgram.command("claim <namespace:id>").description("Acquire a scoped claim for a shared task").requiredOption(
43669
43769
  "--expected-task-revision <n>",
43670
43770
  "Current shared task revision"
43671
43771
  ).option("--path <glob>", "Repository-relative path glob", collectOption, []).option("--module <name>", "Implementation module", collectOption, []).option("--api <name>", "Public API boundary", collectOption, []).option("--schema <name>", "Shared schema boundary", collectOption, []).option("--session <id>", "Session ID (otherwise MANCODE_SESSION_ID)").option("--client <name>", "Client identity (default: mancode-cli)").option("--sync", "Publish through the active git-ref authority").option("--json", "Output as JSON (for scripts)").action(async (task, options) => {
@@ -43742,18 +43842,21 @@ teamHandoffProgram.command("cancel <handoffId>").description("Cancel a draft or
43742
43842
  handoffId
43743
43843
  });
43744
43844
  });
43745
- var migrateProgram = program.command("migrate").description("Inspect and migrate legacy mancode context into V3 staging");
43746
- var migrateContextProgram = migrateProgram.command("context").description("Manage the isolated legacy-to-V3 context migration stage").option("--dry-run", "Inspect legacy authority without writing files").option("--stage", "Create or refresh an isolated local migration stage").option("--status", "Show local migration stages").option("--activate", "Attempt the journaled V3 activation").option("--rollback <operationId>", "Roll back an untouched V3 activation").option("--stage-id <id>", "Migration stage ID (required if more than one)").option(
43845
+ var migrateProgram = program.command("migrate").description("Inspect and migrate legacy context into mancode staging");
43846
+ var migrateContextProgram = migrateProgram.command("context").description("Manage the isolated legacy-to-mancode context migration stage").option("--dry-run", "Inspect legacy authority without writing files").option("--stage", "Create or refresh an isolated local migration stage").option("--status", "Show local migration stages").option("--activate", "Attempt the journaled mancode activation").option(
43847
+ "--rollback <operationId>",
43848
+ "Roll back an untouched mancode activation"
43849
+ ).option("--stage-id <id>", "Migration stage ID (required if more than one)").option(
43747
43850
  "--expected-stage-revision <n>",
43748
43851
  "Expected stage revision for activation"
43749
- ).option("--session <id>", "Active session required for activation").option("--confirm", "Explicitly confirm the V3 cutover").option("--confirm-shared", "Confirm promotion of staged shared authority").option("--json", "Output as JSON (for scripts)").action(async (options) => {
43852
+ ).option("--session <id>", "Active session required for activation").option("--confirm", "Explicitly confirm the mancode cutover").option("--confirm-shared", "Confirm promotion of staged shared authority").option("--json", "Output as JSON (for scripts)").action(async (options) => {
43750
43853
  const code = await migrateContext(process.cwd(), options);
43751
43854
  process.exitCode = code;
43752
43855
  });
43753
43856
  migrateContextProgram.command("resolve <legacyTaskId>").description("Resolve missing owner or implementation scope in one stage").requiredOption(
43754
43857
  "--expected-stage-revision <n>",
43755
43858
  "Expected local migration stage revision"
43756
- ).option("--stage-id <id>", "Migration stage ID (required if more than one)").option("--owner <actorId>", "Explicit V3 owner actor ID").option(
43859
+ ).option("--stage-id <id>", "Migration stage ID (required if more than one)").option("--owner <actorId>", "Explicit owner actor ID").option(
43757
43860
  "--scope-file <path>",
43758
43861
  "JSON implementation scope {include,exclude,modules}"
43759
43862
  ).option("--json", "Output as JSON (for scripts)").action(async (legacyTaskId, options) => {