mancode 0.3.11 → 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/README.en.md +166 -192
- package/README.md +144 -160
- package/dist/chunk-L3TKSX6R.js +1324 -0
- package/dist/chunk-L3TKSX6R.js.map +1 -0
- package/dist/cli.js +414 -171
- package/dist/cli.js.map +1 -1
- package/dist/{v3-adapter-HA7VR5VL.js → v3-adapter-CPZNFTJR.js} +18 -4
- package/package.json +1 -1
- package/dist/chunk-WAH4E2N2.js +0 -601
- package/dist/chunk-WAH4E2N2.js.map +0 -1
- /package/dist/{v3-adapter-HA7VR5VL.js.map → v3-adapter-CPZNFTJR.js.map} +0 -0
package/dist/cli.js
CHANGED
|
@@ -2,6 +2,25 @@
|
|
|
2
2
|
import {
|
|
3
3
|
VERSION
|
|
4
4
|
} from "./chunk-57PJQDQ3.js";
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_MANCODE_END_MARKER,
|
|
7
|
+
DEFAULT_MANCODE_START_MARKER,
|
|
8
|
+
V3_ADAPTER_FILE_TARGETS,
|
|
9
|
+
V3_ADAPTER_VERSION,
|
|
10
|
+
applyV3AdapterFilePlan,
|
|
11
|
+
assertV3AdapterInstallable,
|
|
12
|
+
assertV3AdapterTargetSafe,
|
|
13
|
+
hasManagedBlock,
|
|
14
|
+
inspectV3Adapter,
|
|
15
|
+
inspectV3AdapterVersions,
|
|
16
|
+
installV3Adapter,
|
|
17
|
+
planV3AdapterFiles,
|
|
18
|
+
removeManagedBlock,
|
|
19
|
+
removeV3Adapter,
|
|
20
|
+
replaceManagedBlock,
|
|
21
|
+
stageV3Adapter,
|
|
22
|
+
v3AdapterTargetPath
|
|
23
|
+
} from "./chunk-L3TKSX6R.js";
|
|
5
24
|
import {
|
|
6
25
|
PROJECT_MANIFESTS,
|
|
7
26
|
V3ContextStore,
|
|
@@ -105,25 +124,9 @@ import {
|
|
|
105
124
|
writeOperationReservation,
|
|
106
125
|
writeProjectFacts
|
|
107
126
|
} from "./chunk-O3QAKAPJ.js";
|
|
108
|
-
import {
|
|
109
|
-
DEFAULT_MANCODE_END_MARKER,
|
|
110
|
-
DEFAULT_MANCODE_START_MARKER,
|
|
111
|
-
V3_ADAPTER_VERSION,
|
|
112
|
-
applyV3AdapterFilePlan,
|
|
113
|
-
hasManagedBlock,
|
|
114
|
-
inspectV3Adapter,
|
|
115
|
-
inspectV3AdapterVersions,
|
|
116
|
-
installV3Adapter,
|
|
117
|
-
planV3AdapterFiles,
|
|
118
|
-
removeManagedBlock,
|
|
119
|
-
removeV3Adapter,
|
|
120
|
-
replaceManagedBlock,
|
|
121
|
-
stageV3Adapter,
|
|
122
|
-
v3AdapterTargetPath
|
|
123
|
-
} from "./chunk-WAH4E2N2.js";
|
|
124
127
|
|
|
125
128
|
// src/cli.ts
|
|
126
|
-
import { program } from "commander";
|
|
129
|
+
import { Option, program } from "commander";
|
|
127
130
|
|
|
128
131
|
// src/context/publish-promote.ts
|
|
129
132
|
import { lstat as lstat5, mkdir as mkdir11, rename as rename5, rm as rm5, writeFile as writeFile11 } from "fs/promises";
|
|
@@ -1442,12 +1445,9 @@ function parseMigrationStageFileAction(value) {
|
|
|
1442
1445
|
targetContent
|
|
1443
1446
|
};
|
|
1444
1447
|
}
|
|
1445
|
-
var V3_ADAPTER_TARGETS =
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
"agents",
|
|
1449
|
-
"copilot-instructions"
|
|
1450
|
-
]);
|
|
1448
|
+
var V3_ADAPTER_TARGETS = new Set(
|
|
1449
|
+
V3_ADAPTER_FILE_TARGETS
|
|
1450
|
+
);
|
|
1451
1451
|
function parseV3AdapterFileAction(value) {
|
|
1452
1452
|
assertKnownKeys(
|
|
1453
1453
|
value,
|
|
@@ -1459,23 +1459,27 @@ function parseV3AdapterFileAction(value) {
|
|
|
1459
1459
|
"beforeContent",
|
|
1460
1460
|
"targetContent"
|
|
1461
1461
|
],
|
|
1462
|
-
"operation recovery
|
|
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
|
|
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, "
|
|
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(
|
|
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
|
-
"
|
|
1477
|
+
"mancode adapter targetContent"
|
|
1476
1478
|
);
|
|
1477
1479
|
if (!targetContent.trim()) {
|
|
1478
|
-
throw new Error(
|
|
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
|
|
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-
|
|
11506
|
+
const { applyV3AdapterFilePlan: applyV3AdapterFilePlan2 } = await import("./v3-adapter-CPZNFTJR.js");
|
|
11503
11507
|
await applyV3AdapterFilePlan2(root, action);
|
|
11504
11508
|
}
|
|
11505
11509
|
journal = await completeActivationStep(
|
|
@@ -11645,6 +11649,7 @@ async function rollbackLegacyMigration(input) {
|
|
|
11645
11649
|
);
|
|
11646
11650
|
await rm7(target, { force: false });
|
|
11647
11651
|
} else if (action.kind === "v3_adapter_file") {
|
|
11652
|
+
await assertV3AdapterTargetSafe(root, action.target);
|
|
11648
11653
|
const target = v3AdapterTargetPath(root, action.target);
|
|
11649
11654
|
if (action.beforeContent === null) {
|
|
11650
11655
|
await rm7(target, { force: false });
|
|
@@ -11942,6 +11947,7 @@ async function assertActivationRollbackProof(projectRoot, localStore, coordinati
|
|
|
11942
11947
|
throw new Error("MANCODE_MIGRATION_ROLLBACK_FORBIDDEN");
|
|
11943
11948
|
}
|
|
11944
11949
|
} else if (action.kind === "v3_adapter_file") {
|
|
11950
|
+
await assertV3AdapterTargetSafe(projectRoot, action.target);
|
|
11945
11951
|
const current = await readTextOrNull(
|
|
11946
11952
|
v3AdapterTargetPath(projectRoot, action.target)
|
|
11947
11953
|
);
|
|
@@ -14214,6 +14220,7 @@ async function readMigrationStageFile(projectRoot, stageId) {
|
|
|
14214
14220
|
]);
|
|
14215
14221
|
}
|
|
14216
14222
|
async function readAdapterFile(projectRoot, target) {
|
|
14223
|
+
await assertV3AdapterTargetSafe(projectRoot, target);
|
|
14217
14224
|
const filePath = v3AdapterTargetPath(projectRoot, target);
|
|
14218
14225
|
try {
|
|
14219
14226
|
const entry = await lstat9(filePath);
|
|
@@ -19832,7 +19839,7 @@ async function contextBeta(rootDir, options) {
|
|
|
19832
19839
|
return printV3Error(
|
|
19833
19840
|
options.json,
|
|
19834
19841
|
v3ErrorCode(error, "MANCODE_BETA_GATE_FAILED"),
|
|
19835
|
-
error instanceof Error ? error.message : "Unable to evaluate
|
|
19842
|
+
error instanceof Error ? error.message : "Unable to evaluate release readiness."
|
|
19836
19843
|
);
|
|
19837
19844
|
}
|
|
19838
19845
|
}
|
|
@@ -19950,7 +19957,7 @@ async function contextWorktreeRegister(rootDir, options) {
|
|
|
19950
19957
|
return printV3Error(
|
|
19951
19958
|
options.json,
|
|
19952
19959
|
v3ErrorCode(error, "MANCODE_WORKTREE_REGISTER_FAILED"),
|
|
19953
|
-
error instanceof Error ? error.message : "Unable to register this worktree for
|
|
19960
|
+
error instanceof Error ? error.message : "Unable to register this worktree for mancode coordination."
|
|
19954
19961
|
);
|
|
19955
19962
|
}
|
|
19956
19963
|
}
|
|
@@ -20095,7 +20102,7 @@ async function contextCompact(rootDir, options) {
|
|
|
20095
20102
|
return printV3Error(
|
|
20096
20103
|
options.json,
|
|
20097
20104
|
v3ErrorCode(error, "MANCODE_CONTEXT_COMPACT_FAILED"),
|
|
20098
|
-
error instanceof Error ? error.message : "Unable to compact
|
|
20105
|
+
error instanceof Error ? error.message : "Unable to compact mancode context."
|
|
20099
20106
|
);
|
|
20100
20107
|
}
|
|
20101
20108
|
}
|
|
@@ -20148,7 +20155,7 @@ async function contextPublish(rootDir, task, options) {
|
|
|
20148
20155
|
return printV3Error(
|
|
20149
20156
|
options.json,
|
|
20150
20157
|
v3ErrorCode(error, "MANCODE_CONTEXT_PUBLISH_FAILED"),
|
|
20151
|
-
error instanceof Error ? error.message : "Unable to preview the local
|
|
20158
|
+
error instanceof Error ? error.message : "Unable to preview the local mancode task publish."
|
|
20152
20159
|
);
|
|
20153
20160
|
}
|
|
20154
20161
|
}
|
|
@@ -20178,7 +20185,7 @@ async function contextPublish(rootDir, task, options) {
|
|
|
20178
20185
|
return printV3Error(
|
|
20179
20186
|
options.json,
|
|
20180
20187
|
v3ErrorCode(error, "MANCODE_CONTEXT_PUBLISH_FAILED"),
|
|
20181
|
-
error instanceof Error ? error.message : "Unable to publish the local
|
|
20188
|
+
error instanceof Error ? error.message : "Unable to publish the local mancode task."
|
|
20182
20189
|
);
|
|
20183
20190
|
}
|
|
20184
20191
|
}
|
|
@@ -20248,7 +20255,7 @@ async function contextReconcileTaskHead(rootDir, task, options) {
|
|
|
20248
20255
|
return printV3Error(
|
|
20249
20256
|
options.json,
|
|
20250
20257
|
v3ErrorCode(error, "MANCODE_CONTEXT_RECONCILE_TASK_HEAD_FAILED"),
|
|
20251
|
-
error instanceof Error ? error.message : "Unable to reconcile the
|
|
20258
|
+
error instanceof Error ? error.message : "Unable to reconcile the mancode task head."
|
|
20252
20259
|
);
|
|
20253
20260
|
}
|
|
20254
20261
|
}
|
|
@@ -24762,9 +24769,20 @@ var EXIT_NOT_A_PROJECT_DIR = 2;
|
|
|
24762
24769
|
var EXIT_USER_CANCEL = 3;
|
|
24763
24770
|
var EXIT_INIT_FAILED = 5;
|
|
24764
24771
|
var DEFAULT_INIT_PLATFORM = "claude-code";
|
|
24772
|
+
function resolveInitAuthority(options) {
|
|
24773
|
+
if (options.legacy) return "legacy";
|
|
24774
|
+
if (options.v3 || options.fromCli) return "v3";
|
|
24775
|
+
return "legacy";
|
|
24776
|
+
}
|
|
24765
24777
|
async function init(rootDir = process5.cwd(), options = {}) {
|
|
24778
|
+
if (options.v3 && options.legacy) {
|
|
24779
|
+
console.error("\u2717 --v3 and --legacy cannot be used together.");
|
|
24780
|
+
return EXIT_INIT_FAILED;
|
|
24781
|
+
}
|
|
24782
|
+
const authority = resolveInitAuthority(options);
|
|
24766
24783
|
const mancodeDir = path46.join(rootDir, ".mancode");
|
|
24767
24784
|
const stateFile = path46.join(mancodeDir, "state.json");
|
|
24785
|
+
const v3SchemaFile = path46.join(mancodeDir, "schema.json");
|
|
24768
24786
|
const wasInitialized = await pathExists6(stateFile);
|
|
24769
24787
|
let mutationSnapshots = [];
|
|
24770
24788
|
let directorySnapshots = [];
|
|
@@ -24774,7 +24792,16 @@ async function init(rootDir = process5.cwd(), options = {}) {
|
|
|
24774
24792
|
console.error(" Supported values: zh-CN, en");
|
|
24775
24793
|
return EXIT_INIT_FAILED;
|
|
24776
24794
|
}
|
|
24777
|
-
if (
|
|
24795
|
+
if (authority === "legacy" && await pathExists6(v3SchemaFile)) {
|
|
24796
|
+
console.error(
|
|
24797
|
+
"\u2717 mancode authority is already present; refusing to create legacy state.json."
|
|
24798
|
+
);
|
|
24799
|
+
console.error(
|
|
24800
|
+
" Use `mancode status` or `mancode install <platform>` to inspect or repair this project."
|
|
24801
|
+
);
|
|
24802
|
+
return EXIT_INIT_FAILED;
|
|
24803
|
+
}
|
|
24804
|
+
if (wasInitialized && authority === "legacy") {
|
|
24778
24805
|
if (!options.force) {
|
|
24779
24806
|
console.log(
|
|
24780
24807
|
localize(
|
|
@@ -24811,7 +24838,16 @@ async function init(rootDir = process5.cwd(), options = {}) {
|
|
|
24811
24838
|
);
|
|
24812
24839
|
return EXIT_NOT_A_PROJECT_DIR;
|
|
24813
24840
|
}
|
|
24814
|
-
if (
|
|
24841
|
+
if (authority === "v3") {
|
|
24842
|
+
if (options.fromCli) {
|
|
24843
|
+
const projectBoundaryExit = await validateV3CliProjectBoundary(
|
|
24844
|
+
rootDir,
|
|
24845
|
+
options,
|
|
24846
|
+
locale,
|
|
24847
|
+
wasInitialized
|
|
24848
|
+
);
|
|
24849
|
+
if (projectBoundaryExit !== null) return projectBoundaryExit;
|
|
24850
|
+
}
|
|
24815
24851
|
return initializeV3(rootDir, options);
|
|
24816
24852
|
}
|
|
24817
24853
|
const isGitRepo = await pathExists6(path46.join(rootDir, ".git"));
|
|
@@ -25184,17 +25220,73 @@ async function init(rootDir = process5.cwd(), options = {}) {
|
|
|
25184
25220
|
async function initializeV3(rootDir, options) {
|
|
25185
25221
|
if (options.force) {
|
|
25186
25222
|
console.error(
|
|
25187
|
-
"\u2717 --force is not supported for journaled
|
|
25223
|
+
"\u2717 --force is not supported for journaled mancode initialization."
|
|
25188
25224
|
);
|
|
25189
25225
|
return EXIT_INIT_FAILED;
|
|
25190
25226
|
}
|
|
25191
|
-
|
|
25227
|
+
if (options.style !== void 0) {
|
|
25228
|
+
console.error("\u2717 --style is only supported by `mancode init --legacy`.");
|
|
25229
|
+
console.error(
|
|
25230
|
+
" mancode detects project facts; run `mancode refresh-style` after initialization to refresh local style tokens."
|
|
25231
|
+
);
|
|
25232
|
+
return EXIT_INIT_FAILED;
|
|
25233
|
+
}
|
|
25234
|
+
const schemaPath = path46.join(rootDir, ".mancode", "schema.json");
|
|
25235
|
+
let existingV3 = false;
|
|
25236
|
+
if (await pathExists6(schemaPath)) {
|
|
25237
|
+
try {
|
|
25238
|
+
const manifest = parseSchemaManifest(
|
|
25239
|
+
JSON.parse(await fs4.readFile(schemaPath, "utf8"))
|
|
25240
|
+
);
|
|
25241
|
+
if (manifest.activationState !== "v3_active") {
|
|
25242
|
+
throw new Error(
|
|
25243
|
+
`MANCODE_V3_INIT_UNAVAILABLE_DURING_${manifest.activationState.toUpperCase()}`
|
|
25244
|
+
);
|
|
25245
|
+
}
|
|
25246
|
+
existingV3 = true;
|
|
25247
|
+
if (options.platform === void 0) {
|
|
25248
|
+
console.log("\u2139\uFE0F mancode is already initialized.");
|
|
25249
|
+
return EXIT_ALREADY_INITIALIZED;
|
|
25250
|
+
}
|
|
25251
|
+
} catch (error) {
|
|
25252
|
+
printV3InitError(error);
|
|
25253
|
+
return EXIT_INIT_FAILED;
|
|
25254
|
+
}
|
|
25255
|
+
} else if ((await scanLegacyAuthority(rootDir)).authorityPresent) {
|
|
25256
|
+
printV3InitError(new Error("MANCODE_LEGACY_AUTHORITY_PRESENT"));
|
|
25257
|
+
return EXIT_INIT_FAILED;
|
|
25258
|
+
}
|
|
25259
|
+
const selectedPlatforms = options.platform !== void 0 ? parsePlatformSelection(options.platform) : options.fromCli ? await selectInitPlatforms({
|
|
25260
|
+
existingPlatform: null,
|
|
25261
|
+
hints: await detectPlatformHints(rootDir),
|
|
25262
|
+
interactive: options.interactive,
|
|
25263
|
+
prompter: options.prompter,
|
|
25264
|
+
locale: detectInitLocale(options.lang) ?? "en",
|
|
25265
|
+
yes: options.yes
|
|
25266
|
+
}) : [];
|
|
25192
25267
|
if (selectedPlatforms === null) {
|
|
25193
|
-
console.error(
|
|
25268
|
+
console.error(
|
|
25269
|
+
options.platform === void 0 ? "\u2717 No platform selected. Choose one interactively or pass --platform <name>." : `\u2717 Unsupported platform selection: ${options.platform}`
|
|
25270
|
+
);
|
|
25194
25271
|
console.error(" Use one or more supported platform names, or all.");
|
|
25195
25272
|
return EXIT_INIT_FAILED;
|
|
25196
25273
|
}
|
|
25197
25274
|
try {
|
|
25275
|
+
for (const platform of selectedPlatforms) {
|
|
25276
|
+
await assertV3AdapterInstallable(rootDir, platform);
|
|
25277
|
+
}
|
|
25278
|
+
if (existingV3) {
|
|
25279
|
+
for (const platform of selectedPlatforms) {
|
|
25280
|
+
await installV3Adapter(rootDir, platform);
|
|
25281
|
+
}
|
|
25282
|
+
console.log("\u2139\uFE0F mancode is already initialized.");
|
|
25283
|
+
if (selectedPlatforms.length > 0) {
|
|
25284
|
+
console.log(
|
|
25285
|
+
` mancode bootstrap repaired: ${selectedPlatforms.join(", ")}`
|
|
25286
|
+
);
|
|
25287
|
+
}
|
|
25288
|
+
return EXIT_ALREADY_INITIALIZED;
|
|
25289
|
+
}
|
|
25198
25290
|
const result2 = await initializeV3Project({
|
|
25199
25291
|
projectRoot: rootDir,
|
|
25200
25292
|
teamPolicy: options.team === void 0 ? "auto" : options.team ? "on" : "off"
|
|
@@ -25202,7 +25294,7 @@ async function initializeV3(rootDir, options) {
|
|
|
25202
25294
|
for (const platform of selectedPlatforms) {
|
|
25203
25295
|
await installV3Adapter(rootDir, platform);
|
|
25204
25296
|
}
|
|
25205
|
-
console.log("\u2713 Initialized mancode
|
|
25297
|
+
console.log("\u2713 Initialized mancode project.");
|
|
25206
25298
|
console.log(` workspace: ${result2.runtime.workspaceId}`);
|
|
25207
25299
|
console.log(` operation: ${result2.journal.operationId}`);
|
|
25208
25300
|
if (options.team !== void 0) {
|
|
@@ -25215,18 +25307,21 @@ async function initializeV3(rootDir, options) {
|
|
|
25215
25307
|
" No platform bootstrap selected. Run `mancode install <platform>`."
|
|
25216
25308
|
);
|
|
25217
25309
|
} else {
|
|
25218
|
-
console.log(`
|
|
25310
|
+
console.log(` mancode bootstrap: ${selectedPlatforms.join(", ")}`);
|
|
25219
25311
|
}
|
|
25220
25312
|
return EXIT_OK;
|
|
25221
25313
|
} catch (error) {
|
|
25222
|
-
|
|
25223
|
-
console.error(`\u2717 ${message}`);
|
|
25224
|
-
if (message === "MANCODE_LEGACY_AUTHORITY_PRESENT") {
|
|
25225
|
-
console.error(" Run `mancode migrate context --dry-run` instead.");
|
|
25226
|
-
}
|
|
25314
|
+
printV3InitError(error);
|
|
25227
25315
|
return EXIT_INIT_FAILED;
|
|
25228
25316
|
}
|
|
25229
25317
|
}
|
|
25318
|
+
function printV3InitError(error) {
|
|
25319
|
+
const message = error instanceof Error ? error.message : "mancode initialization failed";
|
|
25320
|
+
console.error(`\u2717 ${message}`);
|
|
25321
|
+
if (message === "MANCODE_LEGACY_AUTHORITY_PRESENT") {
|
|
25322
|
+
console.error(" Run `mancode migrate context --dry-run` instead.");
|
|
25323
|
+
}
|
|
25324
|
+
}
|
|
25230
25325
|
async function updateConfigOptions(mancodeDir, patch, preserveInstalledPlatforms) {
|
|
25231
25326
|
const configPath = path46.join(mancodeDir, "config.json");
|
|
25232
25327
|
let config = {};
|
|
@@ -25346,6 +25441,28 @@ async function canInitializeGenericProject(rootDir) {
|
|
|
25346
25441
|
return { ok: false, reason: "unsafe" };
|
|
25347
25442
|
}
|
|
25348
25443
|
}
|
|
25444
|
+
async function validateV3CliProjectBoundary(rootDir, options, locale, legacyInitialized) {
|
|
25445
|
+
const isGitRepo = await pathExists6(path46.join(rootDir, ".git"));
|
|
25446
|
+
const hasManifest = await hasProjectManifest(rootDir);
|
|
25447
|
+
if (isGitRepo || hasManifest) return null;
|
|
25448
|
+
const v3Initialized = await pathExists6(
|
|
25449
|
+
path46.join(rootDir, ".mancode", "schema.json")
|
|
25450
|
+
);
|
|
25451
|
+
const legacyAuthorityPresent = legacyInitialized || (await scanLegacyAuthority(rootDir)).authorityPresent;
|
|
25452
|
+
const genericSafety = await canInitializeGenericProject(rootDir);
|
|
25453
|
+
if (!genericSafety.ok && !((legacyAuthorityPresent || v3Initialized) && genericSafety.reason === "nonempty")) {
|
|
25454
|
+
printNotProjectDirectory(rootDir, locale, genericSafety.reason);
|
|
25455
|
+
return EXIT_NOT_A_PROJECT_DIR;
|
|
25456
|
+
}
|
|
25457
|
+
if (legacyAuthorityPresent || v3Initialized) return null;
|
|
25458
|
+
const prompter = options.prompter ?? (options.interactive ? createTerminalPrompter() : null);
|
|
25459
|
+
const confirmed = options.empty || options.yes ? true : prompter ? await prompter.confirmGenericProject({ rootDir, locale }) : false;
|
|
25460
|
+
if (!confirmed) {
|
|
25461
|
+
printNotProjectDirectory(rootDir, locale, "empty");
|
|
25462
|
+
return EXIT_NOT_A_PROJECT_DIR;
|
|
25463
|
+
}
|
|
25464
|
+
return null;
|
|
25465
|
+
}
|
|
25349
25466
|
function printNotProjectDirectory(rootDir, locale, reason) {
|
|
25350
25467
|
if (locale === "zh-CN") {
|
|
25351
25468
|
console.error(`\u2717 \u5F53\u524D\u76EE\u5F55\u4E0D\u662F\u53EF\u521D\u59CB\u5316\u7684\u9879\u76EE\u76EE\u5F55\uFF1A${rootDir}`);
|
|
@@ -25577,7 +25694,9 @@ async function install(rootDir = process6.cwd(), platform = "claude-code", optio
|
|
|
25577
25694
|
}
|
|
25578
25695
|
if (options.shadow) {
|
|
25579
25696
|
console.error("\u2717 MANCODE_V3_ADAPTER_SHADOW_REQUIRES_V3");
|
|
25580
|
-
console.error(
|
|
25697
|
+
console.error(
|
|
25698
|
+
" Adapter shadow staging requires a mancode dual-read project."
|
|
25699
|
+
);
|
|
25581
25700
|
return EXIT_INSTALL_FAILED;
|
|
25582
25701
|
}
|
|
25583
25702
|
if (!await pathExists7(stateFile)) {
|
|
@@ -25674,9 +25793,12 @@ async function installV3(rootDir, platform, options) {
|
|
|
25674
25793
|
}
|
|
25675
25794
|
const staged = await stageV3Adapter(rootDir, installer.name);
|
|
25676
25795
|
console.log(
|
|
25677
|
-
`\u2713 ${formatPlatformName(platform)}
|
|
25796
|
+
`\u2713 ${formatPlatformName(platform)} mancode bootstrap and original mode entries staged for shadow comparison.`
|
|
25678
25797
|
);
|
|
25679
25798
|
console.log(` ${staged.stagingTarget}`);
|
|
25799
|
+
for (const entry of staged.modeEntries) {
|
|
25800
|
+
console.log(` ${entry.stagingTarget}`);
|
|
25801
|
+
}
|
|
25680
25802
|
return EXIT_OK2;
|
|
25681
25803
|
}
|
|
25682
25804
|
if (project.manifest.activationState !== "v3_active") {
|
|
@@ -25684,17 +25806,19 @@ async function installV3(rootDir, platform, options) {
|
|
|
25684
25806
|
}
|
|
25685
25807
|
if (options.minimal) {
|
|
25686
25808
|
console.log(
|
|
25687
|
-
"\u2139\uFE0F
|
|
25809
|
+
"\u2139\uFE0F mancode adapters are already bootstrap-only; --minimal has no additional effect."
|
|
25688
25810
|
);
|
|
25689
25811
|
}
|
|
25690
25812
|
const installed = await installV3Adapter(rootDir, installer.name);
|
|
25691
|
-
console.log(
|
|
25813
|
+
console.log(
|
|
25814
|
+
`\u2713 ${formatPlatformName(platform)} mancode bootstrap installed.`
|
|
25815
|
+
);
|
|
25692
25816
|
console.log(` ${installed.target}`);
|
|
25693
25817
|
return EXIT_OK2;
|
|
25694
25818
|
} catch (err) {
|
|
25695
25819
|
const message = err instanceof Error ? err.message : String(err);
|
|
25696
25820
|
console.error(
|
|
25697
|
-
`\u2717 ${formatPlatformName(platform)}
|
|
25821
|
+
`\u2717 ${formatPlatformName(platform)} mancode adapter install failed: ${message}`
|
|
25698
25822
|
);
|
|
25699
25823
|
return EXIT_INSTALL_FAILED;
|
|
25700
25824
|
}
|
|
@@ -25804,7 +25928,7 @@ async function listV3Platforms(rootDir) {
|
|
|
25804
25928
|
platforms.map((platform) => inspectV3Adapter(rootDir, platform.name))
|
|
25805
25929
|
);
|
|
25806
25930
|
console.log("");
|
|
25807
|
-
console.log("Available platforms (
|
|
25931
|
+
console.log("Available platforms (mancode bootstrap):");
|
|
25808
25932
|
for (const [index, platform] of platforms.entries()) {
|
|
25809
25933
|
const status2 = statuses[index];
|
|
25810
25934
|
if (status2 === void 0) {
|
|
@@ -25812,7 +25936,7 @@ async function listV3Platforms(rootDir) {
|
|
|
25812
25936
|
}
|
|
25813
25937
|
const marker = status2.installed ? "\u2713" : "\u25CB";
|
|
25814
25938
|
console.log(
|
|
25815
|
-
` ${marker} ${platform.name.padEnd(12)} ${platform.displayName.padEnd(16)}
|
|
25939
|
+
` ${marker} ${platform.name.padEnd(12)} ${platform.displayName.padEnd(16)} mancode bootstrap; explicit session identity`
|
|
25816
25940
|
);
|
|
25817
25941
|
}
|
|
25818
25942
|
console.log("");
|
|
@@ -25853,7 +25977,7 @@ function describePlatform(platform) {
|
|
|
25853
25977
|
}
|
|
25854
25978
|
|
|
25855
25979
|
// src/commands/manps.ts
|
|
25856
|
-
import { access as access4 } from "fs/promises";
|
|
25980
|
+
import { access as access4, readFile as readFile35 } from "fs/promises";
|
|
25857
25981
|
import path50 from "path";
|
|
25858
25982
|
import { createInterface as createInterface2 } from "readline/promises";
|
|
25859
25983
|
|
|
@@ -25943,20 +26067,17 @@ var SCANNERS = [
|
|
|
25943
26067
|
scan: ({ projectRoot }) => scanArchitecture(projectRoot)
|
|
25944
26068
|
}
|
|
25945
26069
|
];
|
|
25946
|
-
async function runPreseasonScan(projectRoot, area = "all") {
|
|
26070
|
+
async function runPreseasonScan(projectRoot, area = "all", options = {}) {
|
|
25947
26071
|
const generatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
25948
26072
|
const normalizedArea = normalizeArea(area);
|
|
25949
26073
|
const pkg = await readPackageJson(projectRoot);
|
|
25950
26074
|
const needsFiles = normalizedArea === "all" || normalizedArea === "dead-code" || normalizedArea === "config";
|
|
25951
26075
|
const files = needsFiles ? await listProjectFiles(projectRoot) : [];
|
|
25952
26076
|
const issues = (await scanArea(projectRoot, normalizedArea, pkg, files)).slice(0, 20);
|
|
25953
|
-
const
|
|
26077
|
+
const storageRoot = options.storageRoot ?? path49.join(projectRoot, ".mancode");
|
|
26078
|
+
const reportDir = path49.join(storageRoot, "preseason-reports");
|
|
25954
26079
|
await mkdir31(reportDir, { recursive: true });
|
|
25955
|
-
const issueDbPath = path49.join(
|
|
25956
|
-
projectRoot,
|
|
25957
|
-
".mancode",
|
|
25958
|
-
"preseason-issues.json"
|
|
25959
|
-
);
|
|
26080
|
+
const issueDbPath = path49.join(storageRoot, "preseason-issues.json");
|
|
25960
26081
|
const reportPath = await allocateReportPath(
|
|
25961
26082
|
reportDir,
|
|
25962
26083
|
`${generatedAt.replace(/[:.]/g, "-")}-${normalizedArea}`
|
|
@@ -25972,7 +26093,7 @@ async function runPreseasonScan(projectRoot, area = "all") {
|
|
|
25972
26093
|
const database = await buildIssueDatabase(projectRoot, report);
|
|
25973
26094
|
await writeFile36(reportPath, renderPreseasonReport(report), "utf-8");
|
|
25974
26095
|
await writeFile36(
|
|
25975
|
-
path49.join(
|
|
26096
|
+
path49.join(storageRoot, "preseason-report.md"),
|
|
25976
26097
|
renderPreseasonReport(report),
|
|
25977
26098
|
"utf-8"
|
|
25978
26099
|
);
|
|
@@ -25980,11 +26101,7 @@ async function runPreseasonScan(projectRoot, area = "all") {
|
|
|
25980
26101
|
return report;
|
|
25981
26102
|
}
|
|
25982
26103
|
async function runPreseasonRemediation(projectRoot, issues, options = {}) {
|
|
25983
|
-
const issueDbPath = path49.join(
|
|
25984
|
-
projectRoot,
|
|
25985
|
-
".mancode",
|
|
25986
|
-
"preseason-issues.json"
|
|
25987
|
-
);
|
|
26104
|
+
const issueDbPath = options.issueDbPath ?? path49.join(projectRoot, ".mancode", "preseason-issues.json");
|
|
25988
26105
|
const database = await readIssueDatabase(issueDbPath);
|
|
25989
26106
|
const keys = new Set(issues.map((issue) => issueKey(issue)));
|
|
25990
26107
|
const targets = database.issues.filter(
|
|
@@ -26266,9 +26383,7 @@ function readTodoIssues(abs, rel, offset) {
|
|
|
26266
26383
|
const lines = content.split("\n");
|
|
26267
26384
|
const issues = [];
|
|
26268
26385
|
for (let i = 0; i < lines.length && issues.length < 2; i++) {
|
|
26269
|
-
if (
|
|
26270
|
-
lines[i] ?? ""
|
|
26271
|
-
)) {
|
|
26386
|
+
if (isMaintenanceMarker(lines[i] ?? "")) {
|
|
26272
26387
|
issues.push({
|
|
26273
26388
|
id: `todo-${offset + issues.length + 1}`,
|
|
26274
26389
|
severity: "P2",
|
|
@@ -26285,6 +26400,12 @@ function readTodoIssues(abs, rel, offset) {
|
|
|
26285
26400
|
return [];
|
|
26286
26401
|
}
|
|
26287
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
|
+
}
|
|
26288
26409
|
function scanTestGaps(files) {
|
|
26289
26410
|
const sourceFiles = files.filter(
|
|
26290
26411
|
(file) => file.startsWith("src/") && /\.(ts|tsx|js|jsx)$/.test(file) && !file.endsWith(".d.ts") && !file.includes("/templates/")
|
|
@@ -26781,7 +26902,21 @@ var EXIT_NOT_INITIALIZED2 = 1;
|
|
|
26781
26902
|
var EXIT_SCAN_FAILED = 2;
|
|
26782
26903
|
var EXIT_INVALID_ARG = 3;
|
|
26783
26904
|
async function manps(rootDir, area = "all", options = {}) {
|
|
26784
|
-
|
|
26905
|
+
const v3SchemaPath = path50.join(rootDir, ".mancode", "schema.json");
|
|
26906
|
+
const v3Activation = await readV3ActivationState(v3SchemaPath);
|
|
26907
|
+
if (v3Activation !== null && v3Activation !== "v3_active" && v3Activation !== "dual_read") {
|
|
26908
|
+
const message = `manps is unavailable while mancode activation is ${v3Activation}`;
|
|
26909
|
+
if (options.json) {
|
|
26910
|
+
console.log(JSON.stringify({ error: "scan failed", message }, null, 2));
|
|
26911
|
+
} else {
|
|
26912
|
+
console.error("\u2717 mancode preseason scan is temporarily unavailable.");
|
|
26913
|
+
console.error(` ${message}`);
|
|
26914
|
+
}
|
|
26915
|
+
return EXIT_SCAN_FAILED;
|
|
26916
|
+
}
|
|
26917
|
+
const v3Initialized = v3Activation === "v3_active";
|
|
26918
|
+
const initialized = v3Initialized || await pathExists10(path50.join(rootDir, ".mancode", "state.json"));
|
|
26919
|
+
if (!initialized) {
|
|
26785
26920
|
if (options.json) {
|
|
26786
26921
|
console.log(JSON.stringify({ error: "not initialized" }, null, 2));
|
|
26787
26922
|
} else {
|
|
@@ -26792,7 +26927,9 @@ async function manps(rootDir, area = "all", options = {}) {
|
|
|
26792
26927
|
}
|
|
26793
26928
|
let report;
|
|
26794
26929
|
try {
|
|
26795
|
-
report = await runPreseasonScan(rootDir, area
|
|
26930
|
+
report = await runPreseasonScan(rootDir, area, {
|
|
26931
|
+
storageRoot: v3Initialized ? path50.join(rootDir, ".mancode", "local") : void 0
|
|
26932
|
+
});
|
|
26796
26933
|
} catch (err) {
|
|
26797
26934
|
const message = err instanceof Error ? err.message : String(err);
|
|
26798
26935
|
const invalidArg2 = message.startsWith("invalid area:");
|
|
@@ -26888,7 +27025,8 @@ async function runRemediation(rootDir, report, options, silent = false) {
|
|
|
26888
27025
|
if (options.answers) {
|
|
26889
27026
|
return runPreseasonRemediation(rootDir, report.issues, {
|
|
26890
27027
|
answers: options.answers,
|
|
26891
|
-
write: write2
|
|
27028
|
+
write: write2,
|
|
27029
|
+
issueDbPath: report.issueDbPath
|
|
26892
27030
|
});
|
|
26893
27031
|
}
|
|
26894
27032
|
if (!process.stdin.isTTY) {
|
|
@@ -26900,7 +27038,8 @@ async function runRemediation(rootDir, report, options, silent = false) {
|
|
|
26900
27038
|
}
|
|
26901
27039
|
return runPreseasonRemediation(rootDir, report.issues, {
|
|
26902
27040
|
answers,
|
|
26903
|
-
write: write2
|
|
27041
|
+
write: write2,
|
|
27042
|
+
issueDbPath: report.issueDbPath
|
|
26904
27043
|
});
|
|
26905
27044
|
}
|
|
26906
27045
|
const rl = createInterface2({
|
|
@@ -26910,7 +27049,8 @@ async function runRemediation(rootDir, report, options, silent = false) {
|
|
|
26910
27049
|
try {
|
|
26911
27050
|
return await runPreseasonRemediation(rootDir, report.issues, {
|
|
26912
27051
|
ask: (question) => rl.question(question),
|
|
26913
|
-
write: write2
|
|
27052
|
+
write: write2,
|
|
27053
|
+
issueDbPath: report.issueDbPath
|
|
26914
27054
|
});
|
|
26915
27055
|
} finally {
|
|
26916
27056
|
rl.close();
|
|
@@ -26931,9 +27071,20 @@ async function pathExists10(p) {
|
|
|
26931
27071
|
return false;
|
|
26932
27072
|
}
|
|
26933
27073
|
}
|
|
27074
|
+
async function readV3ActivationState(schemaPath) {
|
|
27075
|
+
if (!await pathExists10(schemaPath)) return null;
|
|
27076
|
+
try {
|
|
27077
|
+
const manifest = parseSchemaManifest(
|
|
27078
|
+
JSON.parse(await readFile35(schemaPath, "utf8"))
|
|
27079
|
+
);
|
|
27080
|
+
return manifest.activationState;
|
|
27081
|
+
} catch {
|
|
27082
|
+
return "invalid";
|
|
27083
|
+
}
|
|
27084
|
+
}
|
|
26934
27085
|
|
|
26935
27086
|
// src/commands/migrate.ts
|
|
26936
|
-
import { readFile as
|
|
27087
|
+
import { readFile as readFile36 } from "fs/promises";
|
|
26937
27088
|
import path51 from "path";
|
|
26938
27089
|
var EXIT_OK5 = 0;
|
|
26939
27090
|
var EXIT_INVALID_ARG2 = 2;
|
|
@@ -27067,7 +27218,7 @@ async function readScopeFile(rootDir, file) {
|
|
|
27067
27218
|
}
|
|
27068
27219
|
try {
|
|
27069
27220
|
return JSON.parse(
|
|
27070
|
-
await
|
|
27221
|
+
await readFile36(resolved, "utf8")
|
|
27071
27222
|
);
|
|
27072
27223
|
} catch (error) {
|
|
27073
27224
|
if (error instanceof SyntaxError) {
|
|
@@ -27265,17 +27416,17 @@ async function refreshV3Project(rootDir) {
|
|
|
27265
27416
|
revision: (project.projectFacts?.revision ?? 0) + 1
|
|
27266
27417
|
});
|
|
27267
27418
|
await writeProjectFacts(rootDir, facts);
|
|
27268
|
-
console.log("\u2713
|
|
27419
|
+
console.log("\u2713 mancode project facts refreshed.");
|
|
27269
27420
|
console.log(
|
|
27270
27421
|
` Kind: ${facts.profile.projectKind} | Stack: ${[...facts.profile.languages, ...facts.profile.frameworks].join(" + ") || "unknown"}`
|
|
27271
27422
|
);
|
|
27272
27423
|
console.log(
|
|
27273
|
-
"
|
|
27424
|
+
" mancode adapters remain unchanged because their bootstrap is static."
|
|
27274
27425
|
);
|
|
27275
27426
|
return EXIT_OK6;
|
|
27276
27427
|
} catch (error) {
|
|
27277
27428
|
const message = error instanceof Error ? error.message : String(error);
|
|
27278
|
-
console.error(`\u2717
|
|
27429
|
+
console.error(`\u2717 mancode project facts refresh failed: ${message}`);
|
|
27279
27430
|
return EXIT_REFRESH_FAILED;
|
|
27280
27431
|
}
|
|
27281
27432
|
}
|
|
@@ -27524,7 +27675,7 @@ async function refreshV3Style(rootDir) {
|
|
|
27524
27675
|
if (project.manifest.activationState !== "v3_active") {
|
|
27525
27676
|
throw new Error("MANCODE_V3_REFRESH_REQUIRES_ACTIVE");
|
|
27526
27677
|
}
|
|
27527
|
-
console.log("\u2713 \u5237\u65B0
|
|
27678
|
+
console.log("\u2713 \u5237\u65B0 mancode \u9879\u76EE profile...");
|
|
27528
27679
|
const profile = await detectProjectProfile(rootDir);
|
|
27529
27680
|
const uiLibraryHint = primaryUiLibrary(profile);
|
|
27530
27681
|
await writeProjectFacts(
|
|
@@ -27548,7 +27699,7 @@ async function refreshV3Style(rootDir) {
|
|
|
27548
27699
|
console.log(
|
|
27549
27700
|
"\u2139\uFE0F No UI assets detected in project profile. Skipping style scan."
|
|
27550
27701
|
);
|
|
27551
|
-
console.log(" Updated
|
|
27702
|
+
console.log(" Updated mancode project facts.");
|
|
27552
27703
|
return EXIT_OK7;
|
|
27553
27704
|
}
|
|
27554
27705
|
console.log("\u2713 \u626B\u63CF\u9879\u76EE\u8BBE\u8BA1 token...");
|
|
@@ -27568,7 +27719,7 @@ async function refreshV3Style(rootDir) {
|
|
|
27568
27719
|
return EXIT_OK7;
|
|
27569
27720
|
} catch (error) {
|
|
27570
27721
|
const message = error instanceof Error ? error.message : String(error);
|
|
27571
|
-
console.error(`\u2717
|
|
27722
|
+
console.error(`\u2717 mancode style refresh failed: ${message}`);
|
|
27572
27723
|
return EXIT_V3_REFRESH_FAILED;
|
|
27573
27724
|
}
|
|
27574
27725
|
}
|
|
@@ -28259,11 +28410,11 @@ function printText(r) {
|
|
|
28259
28410
|
}
|
|
28260
28411
|
function printV3Text(result2) {
|
|
28261
28412
|
console.log("");
|
|
28262
|
-
console.log(`mancode v${result2.version}
|
|
28413
|
+
console.log(`mancode v${result2.version}`);
|
|
28263
28414
|
console.log("");
|
|
28264
28415
|
console.log(`Project: ${result2.project}`);
|
|
28265
28416
|
console.log(
|
|
28266
|
-
`Activation: ${result2.activation.state} (epoch ${result2.activation.epoch})`
|
|
28417
|
+
`Activation: ${formatActivationState(result2.activation.state)} (epoch ${result2.activation.epoch})`
|
|
28267
28418
|
);
|
|
28268
28419
|
console.log(
|
|
28269
28420
|
`Runtime: ${result2.runtime.binding}${result2.runtime.error ? ` (${result2.runtime.error})` : ""}`
|
|
@@ -28293,11 +28444,11 @@ function printV3Text(result2) {
|
|
|
28293
28444
|
}
|
|
28294
28445
|
if (result2.legacyAuthorityPresent) {
|
|
28295
28446
|
console.log(
|
|
28296
|
-
"Legacy: legacy authority detected;
|
|
28447
|
+
"Legacy: legacy authority detected; mancode writes may be blocked."
|
|
28297
28448
|
);
|
|
28298
28449
|
}
|
|
28299
28450
|
console.log("");
|
|
28300
|
-
console.log("
|
|
28451
|
+
console.log("mancode adapter status:");
|
|
28301
28452
|
for (const platform of getPlatformInstallers()) {
|
|
28302
28453
|
const adapter = result2.adapters[platform.name];
|
|
28303
28454
|
const marker = adapter.installed ? "\u2713" : "\u25CB";
|
|
@@ -28309,11 +28460,14 @@ function printV3Text(result2) {
|
|
|
28309
28460
|
if (result2.runtime.binding !== "ready") {
|
|
28310
28461
|
console.log("");
|
|
28311
28462
|
console.log(
|
|
28312
|
-
"Run `mancode context worktree register` in this checkout before
|
|
28463
|
+
"Run `mancode context worktree register` in this checkout before mancode mutations."
|
|
28313
28464
|
);
|
|
28314
28465
|
}
|
|
28315
28466
|
console.log("");
|
|
28316
28467
|
}
|
|
28468
|
+
function formatActivationState(state) {
|
|
28469
|
+
return state.replace(/^v3_/, "").replaceAll("_", " ");
|
|
28470
|
+
}
|
|
28317
28471
|
function formatTeamStatus(team) {
|
|
28318
28472
|
if (team.forced) return `forced (${team.contributors} contributors)`;
|
|
28319
28473
|
if (team.isTeam) return `detected (${team.contributors} contributors)`;
|
|
@@ -29742,7 +29896,7 @@ function isAlreadyExists21(error) {
|
|
|
29742
29896
|
}
|
|
29743
29897
|
|
|
29744
29898
|
// src/team/git-ref-handoff-repair.ts
|
|
29745
|
-
import { lstat as lstat19, mkdir as mkdir33, readFile as
|
|
29899
|
+
import { lstat as lstat19, mkdir as mkdir33, readFile as readFile37, readdir as readdir17, writeFile as writeFile38 } from "fs/promises";
|
|
29746
29900
|
import path56 from "path";
|
|
29747
29901
|
|
|
29748
29902
|
// src/team/git-ref-operation.ts
|
|
@@ -32474,7 +32628,7 @@ async function replaceJournal3(projectRoot, journal) {
|
|
|
32474
32628
|
async function requireJournal2(projectRoot, operationId) {
|
|
32475
32629
|
try {
|
|
32476
32630
|
return parseJournal3(
|
|
32477
|
-
JSON.parse(await
|
|
32631
|
+
JSON.parse(await readFile37(journalPath3(projectRoot, operationId), "utf8"))
|
|
32478
32632
|
);
|
|
32479
32633
|
} catch (error) {
|
|
32480
32634
|
if (error instanceof SyntaxError || isNotFound25(error)) {
|
|
@@ -32497,7 +32651,7 @@ async function listJournals2(projectRoot) {
|
|
|
32497
32651
|
journals.push(
|
|
32498
32652
|
parseJournal3(
|
|
32499
32653
|
JSON.parse(
|
|
32500
|
-
await
|
|
32654
|
+
await readFile37(
|
|
32501
32655
|
path56.join(journalDirectory2(projectRoot), entry),
|
|
32502
32656
|
"utf8"
|
|
32503
32657
|
)
|
|
@@ -32512,7 +32666,7 @@ async function readSafeFile2(target) {
|
|
|
32512
32666
|
if (!before.isFile() || before.isSymbolicLink()) {
|
|
32513
32667
|
throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
|
|
32514
32668
|
}
|
|
32515
|
-
const content = await
|
|
32669
|
+
const content = await readFile37(target, "utf8");
|
|
32516
32670
|
const after = await lstat19(target);
|
|
32517
32671
|
if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
|
|
32518
32672
|
throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
|
|
@@ -32984,7 +33138,7 @@ function isNotFound26(error) {
|
|
|
32984
33138
|
import {
|
|
32985
33139
|
lstat as lstat21,
|
|
32986
33140
|
mkdir as mkdir35,
|
|
32987
|
-
readFile as
|
|
33141
|
+
readFile as readFile38,
|
|
32988
33142
|
readdir as readdir19,
|
|
32989
33143
|
rename as rename10,
|
|
32990
33144
|
unlink as unlink4,
|
|
@@ -35135,7 +35289,7 @@ function projectConfigPath2(projectRoot) {
|
|
|
35135
35289
|
async function readProjectConfigFile(projectRoot) {
|
|
35136
35290
|
try {
|
|
35137
35291
|
return parseProjectConfig(
|
|
35138
|
-
JSON.parse(await
|
|
35292
|
+
JSON.parse(await readFile38(projectConfigPath2(projectRoot), "utf8"))
|
|
35139
35293
|
);
|
|
35140
35294
|
} catch (error) {
|
|
35141
35295
|
if (error instanceof SyntaxError) {
|
|
@@ -35182,7 +35336,7 @@ async function readJsonOrNull5(target, parser, corruptCode) {
|
|
|
35182
35336
|
if (!before.isFile() || before.isSymbolicLink()) {
|
|
35183
35337
|
throw new Error("MANCODE_TRANSPORT_MIGRATION_STAGE_UNSAFE");
|
|
35184
35338
|
}
|
|
35185
|
-
const parsed = parser(JSON.parse(await
|
|
35339
|
+
const parsed = parser(JSON.parse(await readFile38(target, "utf8")));
|
|
35186
35340
|
const after = await lstat21(target);
|
|
35187
35341
|
if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
|
|
35188
35342
|
throw new Error("MANCODE_TRANSPORT_MIGRATION_STAGE_UNSAFE");
|
|
@@ -36714,7 +36868,7 @@ function parsePositiveInteger5(value) {
|
|
|
36714
36868
|
}
|
|
36715
36869
|
|
|
36716
36870
|
// src/commands/uninstall.ts
|
|
36717
|
-
import { access as access5, readFile as
|
|
36871
|
+
import { access as access5, readFile as readFile39, rm as rm17, writeFile as writeFile41 } from "fs/promises";
|
|
36718
36872
|
import path59 from "path";
|
|
36719
36873
|
import process11 from "process";
|
|
36720
36874
|
var EXIT_OK9 = 0;
|
|
@@ -36759,9 +36913,9 @@ async function uninstall(rootDir = process11.cwd(), platform, options = {}) {
|
|
|
36759
36913
|
}
|
|
36760
36914
|
async function uninstallV3(rootDir, platform, options) {
|
|
36761
36915
|
if (!platform || options.all) {
|
|
36762
|
-
console.error("\u2717
|
|
36916
|
+
console.error("\u2717 mancode authority is protected from bulk uninstall.");
|
|
36763
36917
|
console.error(
|
|
36764
|
-
" Remove a single bootstrap with `mancode uninstall <platform>`, or complete an explicit
|
|
36918
|
+
" Remove a single bootstrap with `mancode uninstall <platform>`, or complete an explicit mancode archive/migration workflow first."
|
|
36765
36919
|
);
|
|
36766
36920
|
return EXIT_V3_AUTHORITY_PROTECTED;
|
|
36767
36921
|
}
|
|
@@ -36775,17 +36929,21 @@ async function uninstallV3(rootDir, platform, options) {
|
|
|
36775
36929
|
}
|
|
36776
36930
|
if (!options.force) {
|
|
36777
36931
|
console.log(
|
|
36778
|
-
`\u2139\uFE0F This will remove only the ${formatPlatformName(platform)}
|
|
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."
|
|
36779
36936
|
);
|
|
36780
|
-
console.log(" V3 task, session, and shared authority are preserved.");
|
|
36781
36937
|
}
|
|
36782
36938
|
try {
|
|
36783
36939
|
await removeV3Adapter(rootDir, installer.name);
|
|
36784
|
-
console.log(
|
|
36940
|
+
console.log(
|
|
36941
|
+
`\u2713 Removed ${formatPlatformName(platform)} mancode bootstrap.`
|
|
36942
|
+
);
|
|
36785
36943
|
return EXIT_OK9;
|
|
36786
36944
|
} catch (error) {
|
|
36787
36945
|
const message = error instanceof Error ? error.message : String(error);
|
|
36788
|
-
console.error(`\u2717
|
|
36946
|
+
console.error(`\u2717 mancode bootstrap removal failed: ${message}`);
|
|
36789
36947
|
return EXIT_V3_AUTHORITY_PROTECTED;
|
|
36790
36948
|
}
|
|
36791
36949
|
}
|
|
@@ -36823,7 +36981,7 @@ async function cleanClaudeSettings(rootDir) {
|
|
|
36823
36981
|
const settingsPath = path59.join(rootDir, ".claude", "settings.json");
|
|
36824
36982
|
let content;
|
|
36825
36983
|
try {
|
|
36826
|
-
content = await
|
|
36984
|
+
content = await readFile39(settingsPath, "utf-8");
|
|
36827
36985
|
} catch {
|
|
36828
36986
|
return;
|
|
36829
36987
|
}
|
|
@@ -36900,7 +37058,7 @@ async function uninstallCursor(rootDir) {
|
|
|
36900
37058
|
async function uninstallCodex(rootDir) {
|
|
36901
37059
|
const agentsPath = path59.join(rootDir, "AGENTS.md");
|
|
36902
37060
|
try {
|
|
36903
|
-
const content = await
|
|
37061
|
+
const content = await readFile39(agentsPath, "utf-8");
|
|
36904
37062
|
const cleaned = removeManagedBlock(content);
|
|
36905
37063
|
if (cleaned.trim()) {
|
|
36906
37064
|
await writeFile41(agentsPath, `${cleaned}
|
|
@@ -36919,7 +37077,7 @@ async function uninstallCopilot(rootDir) {
|
|
|
36919
37077
|
"copilot-instructions.md"
|
|
36920
37078
|
);
|
|
36921
37079
|
try {
|
|
36922
|
-
const content = await
|
|
37080
|
+
const content = await readFile39(instructionsPath, "utf-8");
|
|
36923
37081
|
const cleaned = removeManagedBlock(content);
|
|
36924
37082
|
if (cleaned.trim()) {
|
|
36925
37083
|
await writeFile41(instructionsPath, `${cleaned}
|
|
@@ -36934,7 +37092,7 @@ async function uninstallCopilot(rootDir) {
|
|
|
36934
37092
|
async function uninstallZcode(rootDir) {
|
|
36935
37093
|
const agentsPath = path59.join(rootDir, "AGENTS.md");
|
|
36936
37094
|
try {
|
|
36937
|
-
const content = await
|
|
37095
|
+
const content = await readFile39(agentsPath, "utf-8");
|
|
36938
37096
|
const cleaned = removeManagedBlock(
|
|
36939
37097
|
content,
|
|
36940
37098
|
ZCODE_MANCODE_START_MARKER,
|
|
@@ -36953,7 +37111,7 @@ async function uninstallZcode(rootDir) {
|
|
|
36953
37111
|
async function removeFromConfig(rootDir, platform) {
|
|
36954
37112
|
const configPath = path59.join(rootDir, ".mancode", "config.json");
|
|
36955
37113
|
try {
|
|
36956
|
-
const raw = await
|
|
37114
|
+
const raw = await readFile39(configPath, "utf-8");
|
|
36957
37115
|
const config = JSON.parse(raw);
|
|
36958
37116
|
if (Array.isArray(config.platforms)) {
|
|
36959
37117
|
config.platforms = config.platforms.filter((p) => p !== platform);
|
|
@@ -36998,7 +37156,7 @@ function version() {
|
|
|
36998
37156
|
}
|
|
36999
37157
|
|
|
37000
37158
|
// src/commands/workflow.ts
|
|
37001
|
-
import { access as access6, readFile as
|
|
37159
|
+
import { access as access6, readFile as readFile41, rm as rm19, writeFile as writeFile43 } from "fs/promises";
|
|
37002
37160
|
import path61 from "path";
|
|
37003
37161
|
|
|
37004
37162
|
// src/context/child-result-merge.ts
|
|
@@ -39456,7 +39614,7 @@ function updateMetadata4(previous, verification, operationId, updatedAt) {
|
|
|
39456
39614
|
import {
|
|
39457
39615
|
lstat as lstat22,
|
|
39458
39616
|
mkdir as mkdir36,
|
|
39459
|
-
readFile as
|
|
39617
|
+
readFile as readFile40,
|
|
39460
39618
|
rename as rename11,
|
|
39461
39619
|
rm as rm18,
|
|
39462
39620
|
writeFile as writeFile42
|
|
@@ -40241,7 +40399,7 @@ async function readStagedJson(stagingDirectory, fileName, parser) {
|
|
|
40241
40399
|
if (!before.isFile() || before.isSymbolicLink()) {
|
|
40242
40400
|
throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
|
|
40243
40401
|
}
|
|
40244
|
-
const parsed = parser(JSON.parse(await
|
|
40402
|
+
const parsed = parser(JSON.parse(await readFile40(target, "utf8")));
|
|
40245
40403
|
const after = await lstat22(target);
|
|
40246
40404
|
if (!after.isFile() || after.isSymbolicLink() || before.dev !== after.dev || before.ino !== after.ino) {
|
|
40247
40405
|
throw new Error("MANCODE_ARTIFACT_PATH_UNSAFE");
|
|
@@ -41225,12 +41383,86 @@ function compareUtf816(left, right) {
|
|
|
41225
41383
|
return Buffer.from(left, "utf8").compare(Buffer.from(right, "utf8"));
|
|
41226
41384
|
}
|
|
41227
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
|
+
|
|
41228
41460
|
// src/commands/workflow.ts
|
|
41229
41461
|
var EXIT_OK10 = 0;
|
|
41230
41462
|
var EXIT_NOT_INITIALIZED7 = 1;
|
|
41231
41463
|
var EXIT_INVALID_ARG3 = 2;
|
|
41232
41464
|
async function workflow(rootDir, subcommand, args = [], options = {}) {
|
|
41233
|
-
const v3Activation = await
|
|
41465
|
+
const v3Activation = await readV3ActivationState2(rootDir);
|
|
41234
41466
|
if (v3Activation === "v3_active") {
|
|
41235
41467
|
return workflowV3(rootDir, subcommand, args, options);
|
|
41236
41468
|
}
|
|
@@ -41239,7 +41471,7 @@ async function workflow(rootDir, subcommand, args = [], options = {}) {
|
|
|
41239
41471
|
return printV3Error(
|
|
41240
41472
|
options.json,
|
|
41241
41473
|
"MANCODE_V3_WRITE_REQUIRES_ACTIVATION",
|
|
41242
|
-
"This project has staged
|
|
41474
|
+
"This project has staged mancode context but remains in dual-read migration. Use legacy workflows until activation."
|
|
41243
41475
|
);
|
|
41244
41476
|
}
|
|
41245
41477
|
if (options.json) {
|
|
@@ -41326,7 +41558,7 @@ async function workflowV3(rootDir, subcommand, args, options) {
|
|
|
41326
41558
|
return printV3Error(
|
|
41327
41559
|
options.json,
|
|
41328
41560
|
"MANCODE_V3_OPERATION_NOT_IMPLEMENTED",
|
|
41329
|
-
`workflow ${subcommand} is not yet implemented for
|
|
41561
|
+
`workflow ${subcommand} is not yet implemented for mancode authority.`
|
|
41330
41562
|
);
|
|
41331
41563
|
}
|
|
41332
41564
|
async function workflowUpdateV3(rootDir, args, options) {
|
|
@@ -41343,7 +41575,7 @@ async function workflowUpdateV3(rootDir, args, options) {
|
|
|
41343
41575
|
return printV3Error(
|
|
41344
41576
|
options.json,
|
|
41345
41577
|
"MANCODE_WORKFLOW_UPDATE_EMPTY",
|
|
41346
|
-
"
|
|
41578
|
+
"Workflow update requires --status or --blocking-reason.",
|
|
41347
41579
|
EXIT_INVALID_ARG3
|
|
41348
41580
|
);
|
|
41349
41581
|
}
|
|
@@ -41351,7 +41583,7 @@ async function workflowUpdateV3(rootDir, args, options) {
|
|
|
41351
41583
|
return printV3Error(
|
|
41352
41584
|
options.json,
|
|
41353
41585
|
"MANCODE_V3_WORKFLOW_UPDATE_FIELD_UNSUPPORTED",
|
|
41354
|
-
"
|
|
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.",
|
|
41355
41587
|
EXIT_INVALID_ARG3
|
|
41356
41588
|
);
|
|
41357
41589
|
}
|
|
@@ -41360,7 +41592,7 @@ async function workflowUpdateV3(rootDir, args, options) {
|
|
|
41360
41592
|
return printV3Error(
|
|
41361
41593
|
options.json,
|
|
41362
41594
|
"MANCODE_EXPECTED_REVISION_REQUIRED",
|
|
41363
|
-
"
|
|
41595
|
+
"Workflow update requires --expected-revision <positive integer>.",
|
|
41364
41596
|
EXIT_INVALID_ARG3
|
|
41365
41597
|
);
|
|
41366
41598
|
}
|
|
@@ -41415,7 +41647,7 @@ async function workflowUpdateV3(rootDir, args, options) {
|
|
|
41415
41647
|
return printV3Error(
|
|
41416
41648
|
options.json,
|
|
41417
41649
|
v3ErrorCode(error, "MANCODE_V3_WORKFLOW_UPDATE_FAILED"),
|
|
41418
|
-
error instanceof Error ? error.message : "Unable to update the
|
|
41650
|
+
error instanceof Error ? error.message : "Unable to update the mancode workflow lifecycle."
|
|
41419
41651
|
);
|
|
41420
41652
|
}
|
|
41421
41653
|
}
|
|
@@ -41467,7 +41699,7 @@ async function workflowChildResultMergeV3(rootDir, args, options) {
|
|
|
41467
41699
|
return printV3Error(
|
|
41468
41700
|
options.json,
|
|
41469
41701
|
v3ErrorCode(error, "MANCODE_V3_CHILD_RESULT_MERGE_FAILED"),
|
|
41470
|
-
error instanceof Error ? error.message : "Unable to merge the
|
|
41702
|
+
error instanceof Error ? error.message : "Unable to merge the mancode child diagnostic result."
|
|
41471
41703
|
);
|
|
41472
41704
|
}
|
|
41473
41705
|
}
|
|
@@ -41524,7 +41756,7 @@ async function workflowSoloHandoffV3(rootDir, args, options) {
|
|
|
41524
41756
|
return printV3Error(
|
|
41525
41757
|
options.json,
|
|
41526
41758
|
v3ErrorCode(error, "MANCODE_V3_SOLO_HANDOFF_FAILED"),
|
|
41527
|
-
error instanceof Error ? error.message : "Unable to run the
|
|
41759
|
+
error instanceof Error ? error.message : "Unable to run the mancode solo handoff."
|
|
41528
41760
|
);
|
|
41529
41761
|
}
|
|
41530
41762
|
}
|
|
@@ -41584,7 +41816,7 @@ async function workflowPromoteV3(rootDir, args, options) {
|
|
|
41584
41816
|
return printV3Error(
|
|
41585
41817
|
options.json,
|
|
41586
41818
|
v3ErrorCode(error, "MANCODE_V3_WORKFLOW_PROMOTE_FAILED"),
|
|
41587
|
-
error instanceof Error ? error.message : "Unable to preview the
|
|
41819
|
+
error instanceof Error ? error.message : "Unable to preview the mancode workflow promotion."
|
|
41588
41820
|
);
|
|
41589
41821
|
}
|
|
41590
41822
|
}
|
|
@@ -41614,7 +41846,7 @@ async function workflowPromoteV3(rootDir, args, options) {
|
|
|
41614
41846
|
return printV3Error(
|
|
41615
41847
|
options.json,
|
|
41616
41848
|
v3ErrorCode(error, "MANCODE_V3_WORKFLOW_PROMOTE_FAILED"),
|
|
41617
|
-
error instanceof Error ? error.message : "Unable to promote the local
|
|
41849
|
+
error instanceof Error ? error.message : "Unable to promote the local mancode workflow."
|
|
41618
41850
|
);
|
|
41619
41851
|
}
|
|
41620
41852
|
}
|
|
@@ -41696,7 +41928,7 @@ async function workflowScopeChangeV3(rootDir, args, options) {
|
|
|
41696
41928
|
return printV3Error(
|
|
41697
41929
|
options.json,
|
|
41698
41930
|
v3ErrorCode(error, "MANCODE_V3_SCOPE_CHANGE_FAILED"),
|
|
41699
|
-
error instanceof Error ? error.message : "Unable to change the
|
|
41931
|
+
error instanceof Error ? error.message : "Unable to change the mancode workflow scope."
|
|
41700
41932
|
);
|
|
41701
41933
|
}
|
|
41702
41934
|
}
|
|
@@ -41769,7 +42001,7 @@ async function workflowCompleteV3(rootDir, args, options) {
|
|
|
41769
42001
|
return printV3Error(
|
|
41770
42002
|
options.json,
|
|
41771
42003
|
v3ErrorCode(error, "MANCODE_V3_TASK_COMPLETE_FAILED"),
|
|
41772
|
-
error instanceof Error ? error.message : "Unable to complete the
|
|
42004
|
+
error instanceof Error ? error.message : "Unable to complete the mancode task."
|
|
41773
42005
|
);
|
|
41774
42006
|
}
|
|
41775
42007
|
}
|
|
@@ -41819,7 +42051,7 @@ async function workflowVerifyV3(rootDir, args, options) {
|
|
|
41819
42051
|
return printV3Error(
|
|
41820
42052
|
options.json,
|
|
41821
42053
|
v3ErrorCode(error, "MANCODE_V3_VERIFICATION_RECORD_FAILED"),
|
|
41822
|
-
error instanceof Error ? error.message : "Unable to record
|
|
42054
|
+
error instanceof Error ? error.message : "Unable to record mancode verification."
|
|
41823
42055
|
);
|
|
41824
42056
|
}
|
|
41825
42057
|
}
|
|
@@ -41870,7 +42102,7 @@ async function workflowReviewV3(rootDir, args, options) {
|
|
|
41870
42102
|
return printV3Error(
|
|
41871
42103
|
options.json,
|
|
41872
42104
|
v3ErrorCode(error, "MANCODE_V3_REVIEW_APPLY_FAILED"),
|
|
41873
|
-
error instanceof Error ? error.message : "Unable to apply the
|
|
42105
|
+
error instanceof Error ? error.message : "Unable to apply the mancode review."
|
|
41874
42106
|
);
|
|
41875
42107
|
}
|
|
41876
42108
|
}
|
|
@@ -41944,7 +42176,7 @@ async function workflowPlanV3(rootDir, args, options) {
|
|
|
41944
42176
|
return printV3Error(
|
|
41945
42177
|
options.json,
|
|
41946
42178
|
v3ErrorCode(error, "MANCODE_V3_PLAN_REVISION_FAILED"),
|
|
41947
|
-
error instanceof Error ? error.message : "Unable to revise the
|
|
42179
|
+
error instanceof Error ? error.message : "Unable to revise the mancode plan."
|
|
41948
42180
|
);
|
|
41949
42181
|
}
|
|
41950
42182
|
}
|
|
@@ -41971,13 +42203,15 @@ async function workflowRequirementsV3(rootDir, args, options) {
|
|
|
41971
42203
|
try {
|
|
41972
42204
|
const project = await readV3CommandProject(rootDir);
|
|
41973
42205
|
const session = await resolveV3CommandSession(project, options);
|
|
41974
|
-
const
|
|
42206
|
+
const taskRef = parseTaskRef(task);
|
|
42207
|
+
const requirementsInput = await readWorkflowJsonInputFile(
|
|
41975
42208
|
project.projectRoot,
|
|
41976
42209
|
options.file
|
|
41977
42210
|
);
|
|
42211
|
+
const requirements = normalizeRequirementsInput(requirementsInput, taskRef);
|
|
41978
42212
|
const result2 = await finalizeV3Requirements({
|
|
41979
42213
|
projectRoot: project.projectRoot,
|
|
41980
|
-
taskRef
|
|
42214
|
+
taskRef,
|
|
41981
42215
|
sessionId: session.sessionId,
|
|
41982
42216
|
expectedTaskRevision,
|
|
41983
42217
|
requirements
|
|
@@ -41997,7 +42231,7 @@ async function workflowRequirementsV3(rootDir, args, options) {
|
|
|
41997
42231
|
return printV3Error(
|
|
41998
42232
|
options.json,
|
|
41999
42233
|
v3ErrorCode(error, "MANCODE_V3_REQUIREMENTS_FINALIZE_FAILED"),
|
|
42000
|
-
error instanceof Error ? error.message : "Unable to finalize
|
|
42234
|
+
error instanceof Error ? error.message : "Unable to finalize mancode requirements."
|
|
42001
42235
|
);
|
|
42002
42236
|
}
|
|
42003
42237
|
}
|
|
@@ -42032,7 +42266,7 @@ function parseV3ParticipantActorIds(values) {
|
|
|
42032
42266
|
}
|
|
42033
42267
|
async function readWorkflowInputFile(projectRoot, value) {
|
|
42034
42268
|
const inputPath = path61.isAbsolute(value) ? value : path61.resolve(projectRoot, value);
|
|
42035
|
-
return
|
|
42269
|
+
return readFile41(inputPath, "utf8");
|
|
42036
42270
|
}
|
|
42037
42271
|
async function readWorkflowJsonInputFile(projectRoot, value) {
|
|
42038
42272
|
return JSON.parse(await readWorkflowInputFile(projectRoot, value));
|
|
@@ -42091,15 +42325,15 @@ async function workflowCreateV3(rootDir, args, options) {
|
|
|
42091
42325
|
return printV3Error(
|
|
42092
42326
|
options.json,
|
|
42093
42327
|
v3ErrorCode(error, "MANCODE_V3_WORKFLOW_CREATE_FAILED"),
|
|
42094
|
-
error instanceof Error ? error.message : "Unable to create
|
|
42328
|
+
error instanceof Error ? error.message : "Unable to create mancode workflow."
|
|
42095
42329
|
);
|
|
42096
42330
|
}
|
|
42097
42331
|
}
|
|
42098
|
-
async function
|
|
42332
|
+
async function readV3ActivationState2(rootDir) {
|
|
42099
42333
|
try {
|
|
42100
42334
|
const manifest = parseSchemaManifest(
|
|
42101
42335
|
JSON.parse(
|
|
42102
|
-
await
|
|
42336
|
+
await readFile41(path61.join(rootDir, ".mancode", "schema.json"), "utf8")
|
|
42103
42337
|
)
|
|
42104
42338
|
);
|
|
42105
42339
|
return manifest.activationState === "v3_active" ? "v3_active" : "other";
|
|
@@ -42153,12 +42387,12 @@ async function workflowRequirements(rootDir, args, options) {
|
|
|
42153
42387
|
let originalMetadata;
|
|
42154
42388
|
try {
|
|
42155
42389
|
const inputPath = path61.isAbsolute(options.file) ? options.file : path61.resolve(rootDir, options.file);
|
|
42156
|
-
const input = await
|
|
42390
|
+
const input = await readFile41(inputPath, "utf-8");
|
|
42157
42391
|
const requirements = parseRequirementsLedger2(input);
|
|
42158
42392
|
[originalJson, originalMarkdown, originalMetadata] = await Promise.all([
|
|
42159
42393
|
readOptionalText2(jsonPath),
|
|
42160
42394
|
readOptionalText2(markdownPath),
|
|
42161
|
-
|
|
42395
|
+
readFile41(metadataPath3, "utf-8")
|
|
42162
42396
|
]);
|
|
42163
42397
|
await writeRequirementsArtifacts(rootDir, taskId, requirements);
|
|
42164
42398
|
await updateWorkflow(rootDir, taskId, {
|
|
@@ -42346,7 +42580,7 @@ async function commitVerificationTransition(rootDir, meta, ledger) {
|
|
|
42346
42580
|
const specPath = path61.join(rootDir, ".mancode", "memory", "spec.md");
|
|
42347
42581
|
const [originalLedger, originalMetadata, originalSpec] = await Promise.all([
|
|
42348
42582
|
readOptionalText2(ledgerPath),
|
|
42349
|
-
|
|
42583
|
+
readFile41(metadataPath3, "utf-8"),
|
|
42350
42584
|
readOptionalText2(specPath)
|
|
42351
42585
|
]);
|
|
42352
42586
|
const wasVerificationBlocked = meta.status === "blocked" && meta.blockingReason?.startsWith("[verification]");
|
|
@@ -42516,7 +42750,7 @@ async function commitReviewSkip(rootDir, meta, reason) {
|
|
|
42516
42750
|
);
|
|
42517
42751
|
const [originalLedger, originalMetadata] = await Promise.all([
|
|
42518
42752
|
readOptionalText2(ledgerPath),
|
|
42519
|
-
|
|
42753
|
+
readFile41(metadataPath3, "utf-8")
|
|
42520
42754
|
]);
|
|
42521
42755
|
try {
|
|
42522
42756
|
await initializeSkippedReview(rootDir, meta.taskId, reason);
|
|
@@ -42758,7 +42992,7 @@ async function workflowHandoff(rootDir, taskId, options) {
|
|
|
42758
42992
|
let originalState;
|
|
42759
42993
|
let state;
|
|
42760
42994
|
try {
|
|
42761
|
-
originalState = await
|
|
42995
|
+
originalState = await readFile41(statePath, "utf-8");
|
|
42762
42996
|
state = JSON.parse(originalState);
|
|
42763
42997
|
} catch {
|
|
42764
42998
|
return invalidArg(
|
|
@@ -42833,7 +43067,7 @@ async function workflowCompleteHandoff(rootDir, taskId, options) {
|
|
|
42833
43067
|
let originalState;
|
|
42834
43068
|
let state;
|
|
42835
43069
|
try {
|
|
42836
|
-
originalState = await
|
|
43070
|
+
originalState = await readFile41(statePath, "utf-8");
|
|
42837
43071
|
state = JSON.parse(originalState);
|
|
42838
43072
|
} catch {
|
|
42839
43073
|
return invalidArg(
|
|
@@ -42907,7 +43141,7 @@ async function workflowDecide(rootDir, taskId, options) {
|
|
|
42907
43141
|
let originalState;
|
|
42908
43142
|
let state;
|
|
42909
43143
|
try {
|
|
42910
|
-
originalState = await
|
|
43144
|
+
originalState = await readFile41(statePath, "utf-8");
|
|
42911
43145
|
state = JSON.parse(originalState);
|
|
42912
43146
|
} catch {
|
|
42913
43147
|
return invalidArg(
|
|
@@ -42970,7 +43204,7 @@ async function commitPlanningTransition(args) {
|
|
|
42970
43204
|
let originalMetadata;
|
|
42971
43205
|
let originalSpec;
|
|
42972
43206
|
try {
|
|
42973
|
-
originalMetadata = await
|
|
43207
|
+
originalMetadata = await readFile41(metadataPath3, "utf-8");
|
|
42974
43208
|
originalSpec = await readOptionalText2(specPath);
|
|
42975
43209
|
} catch (error) {
|
|
42976
43210
|
return error instanceof Error ? `unable to prepare planning transition: ${error.message}` : "unable to prepare planning transition";
|
|
@@ -43001,7 +43235,7 @@ async function commitPlanningTransition(args) {
|
|
|
43001
43235
|
}
|
|
43002
43236
|
async function readOptionalText2(filePath) {
|
|
43003
43237
|
try {
|
|
43004
|
-
return await
|
|
43238
|
+
return await readFile41(filePath, "utf-8");
|
|
43005
43239
|
} catch (error) {
|
|
43006
43240
|
if (isNodeError10(error) && error.code === "ENOENT") return null;
|
|
43007
43241
|
throw error;
|
|
@@ -43266,9 +43500,10 @@ async function pathExists16(p) {
|
|
|
43266
43500
|
program.name("mancode").description(
|
|
43267
43501
|
"AI coding agent harness. Modes: solo, man, manba, manteam, manps."
|
|
43268
43502
|
).version(VERSION);
|
|
43269
|
-
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").
|
|
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) => {
|
|
43270
43504
|
const code = await init(process.cwd(), {
|
|
43271
43505
|
...options,
|
|
43506
|
+
fromCli: true,
|
|
43272
43507
|
interactive: Boolean(process.stdin.isTTY && process.stdout.isTTY)
|
|
43273
43508
|
});
|
|
43274
43509
|
process.exitCode = code;
|
|
@@ -43277,7 +43512,7 @@ program.command("install [platform]").description(
|
|
|
43277
43512
|
"Install platform adapter (claude-code, cursor, codex, copilot, zcode)"
|
|
43278
43513
|
).option("--force", "Reinstall even if already installed").option("--minimal", "Minimal install (MVP-2)").option(
|
|
43279
43514
|
"--shadow",
|
|
43280
|
-
"Stage a
|
|
43515
|
+
"Stage a mancode bootstrap candidate without changing live files"
|
|
43281
43516
|
).action(async (platform, options) => {
|
|
43282
43517
|
const code = await install(
|
|
43283
43518
|
process.cwd(),
|
|
@@ -43301,15 +43536,15 @@ program.command("uninstall [platform]").description("Remove platform adapter or
|
|
|
43301
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(
|
|
43302
43537
|
"--parent-task <taskId>",
|
|
43303
43538
|
"Parent /man or /manteam workflow for manba"
|
|
43304
|
-
).option("--parent <namespace:id>", "
|
|
43539
|
+
).option("--parent <namespace:id>", "Parent TaskRef for a manba child").option(
|
|
43305
43540
|
"--participant <actorId>",
|
|
43306
43541
|
"Invite a joined team participant",
|
|
43307
43542
|
collectOption,
|
|
43308
43543
|
[]
|
|
43309
|
-
).option("--visibility <visibility>", "
|
|
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(
|
|
43310
43545
|
"--confirm-shared",
|
|
43311
|
-
"Confirm that task metadata may enter shared
|
|
43312
|
-
).option("--blocking-reason <reason>", "Explain why a workflow is blocked").option("--outcome <outcome>", "Set manba outcome when completing a
|
|
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(
|
|
43313
43548
|
"--requirements-status <status>",
|
|
43314
43549
|
"Planning readiness: ready or needs_clarification"
|
|
43315
43550
|
).option(
|
|
@@ -43324,21 +43559,24 @@ program.command("workflow <subcommand> [args...]").description("Manage mancode w
|
|
|
43324
43559
|
).option("--blockers <ids>", "Comma-separated blocker ids found by a review").option(
|
|
43325
43560
|
"--resolved <ids>",
|
|
43326
43561
|
"Comma-separated blocker ids resolved in remediation"
|
|
43327
|
-
).option(
|
|
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) => {
|
|
43328
43566
|
const code = await workflow(process.cwd(), subcommand, args ?? [], {
|
|
43329
43567
|
...options,
|
|
43330
43568
|
participants: options.participant.length === 0 ? void 0 : options.participant
|
|
43331
43569
|
});
|
|
43332
43570
|
process.exitCode = code;
|
|
43333
43571
|
});
|
|
43334
|
-
var contextProgram = program.command("context").description("Resolve
|
|
43335
|
-
contextProgram.command("show").description("Resolve one
|
|
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(
|
|
43336
43574
|
"--purpose <purpose>",
|
|
43337
43575
|
"orient, plan, implement, review, verify, or handoff"
|
|
43338
43576
|
).option("--json", "Output as JSON (for scripts)").action(async (options) => {
|
|
43339
43577
|
process.exitCode = await contextShow(process.cwd(), options);
|
|
43340
43578
|
});
|
|
43341
|
-
var contextSessionProgram = contextProgram.command("session").description("Manage
|
|
43579
|
+
var contextSessionProgram = contextProgram.command("session").description("Manage mancode session identities");
|
|
43342
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) => {
|
|
43343
43581
|
process.exitCode = await contextSessionNew(process.cwd(), options);
|
|
43344
43582
|
});
|
|
@@ -43369,13 +43607,13 @@ contextSessionProgram.command("spike").description("Record real-host session evi
|
|
|
43369
43607
|
).option("--json", "Output as JSON (for scripts)").action(async (options) => {
|
|
43370
43608
|
process.exitCode = await contextSessionSpike(process.cwd(), options);
|
|
43371
43609
|
});
|
|
43372
|
-
contextProgram.command("resume <namespace:id>").description("Validate and bind the current session to a
|
|
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) => {
|
|
43373
43611
|
process.exitCode = await contextResume(process.cwd(), task, options);
|
|
43374
43612
|
});
|
|
43375
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) => {
|
|
43376
43614
|
process.exitCode = await contextClose(process.cwd(), options);
|
|
43377
43615
|
});
|
|
43378
|
-
contextProgram.command("doctor").description("Inspect unfinished
|
|
43616
|
+
contextProgram.command("doctor").description("Inspect unfinished mancode operations or repair one explicitly").option(
|
|
43379
43617
|
"--repair <operationId>",
|
|
43380
43618
|
"Repair this operation with its original session"
|
|
43381
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) => {
|
|
@@ -43384,10 +43622,10 @@ contextProgram.command("doctor").description("Inspect unfinished V3 operations o
|
|
|
43384
43622
|
contextProgram.command("diagnostics [action]").description("Show or configure local aggregate diagnostics").option("--json", "Output as JSON (for scripts)").action(async (action, options) => {
|
|
43385
43623
|
process.exitCode = await contextDiagnostics(process.cwd(), action, options);
|
|
43386
43624
|
});
|
|
43387
|
-
contextProgram.command("compact").description("List and remove eligible
|
|
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) => {
|
|
43388
43626
|
process.exitCode = await contextCompact(process.cwd(), options);
|
|
43389
43627
|
});
|
|
43390
|
-
contextProgram.command("beta").description("Evaluate
|
|
43628
|
+
contextProgram.command("beta", { hidden: true }).description("Evaluate internal release-evidence gates").requiredOption(
|
|
43391
43629
|
"--release-candidate <id>",
|
|
43392
43630
|
"Release candidate that must match every platform evidence record"
|
|
43393
43631
|
).option("--json", "Output as JSON (for scripts)").action(async (options) => {
|
|
@@ -43414,11 +43652,13 @@ contextProgram.command("reconcile-task-head <shared:id>").description(
|
|
|
43414
43652
|
options
|
|
43415
43653
|
);
|
|
43416
43654
|
});
|
|
43417
|
-
var contextWorktreeProgram = contextProgram.command("worktree").description("Register and inspect the current
|
|
43418
|
-
contextWorktreeProgram.command("register").description(
|
|
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) => {
|
|
43419
43659
|
process.exitCode = await contextWorktreeRegister(process.cwd(), options);
|
|
43420
43660
|
});
|
|
43421
|
-
var operationProgram = program.command("operation").description("Inspect and recover durable
|
|
43661
|
+
var operationProgram = program.command("operation").description("Inspect and recover durable mancode operations");
|
|
43422
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) => {
|
|
43423
43663
|
process.exitCode = await operationShow(process.cwd(), operationId, options);
|
|
43424
43664
|
});
|
|
@@ -43438,11 +43678,11 @@ operationProgram.command("abort <operationId>").description(
|
|
|
43438
43678
|
options
|
|
43439
43679
|
);
|
|
43440
43680
|
});
|
|
43441
|
-
var teamProgram = program.command("team").description("Manage
|
|
43442
|
-
teamProgram.command("status").description("Show
|
|
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) => {
|
|
43443
43683
|
process.exitCode = await teamStatus(process.cwd(), options);
|
|
43444
43684
|
});
|
|
43445
|
-
teamProgram.command("policy <mode>").description("Set the
|
|
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) => {
|
|
43446
43686
|
process.exitCode = await teamPolicy(process.cwd(), {
|
|
43447
43687
|
...options,
|
|
43448
43688
|
policy
|
|
@@ -43516,7 +43756,7 @@ teamProgram.command("join").description(
|
|
|
43516
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) => {
|
|
43517
43757
|
process.exitCode = await teamJoin(process.cwd(), options);
|
|
43518
43758
|
});
|
|
43519
|
-
teamProgram.command("checkpoint <namespace:id>").description("Create a journaled immutable checkpoint for a shared
|
|
43759
|
+
teamProgram.command("checkpoint <namespace:id>").description("Create a journaled immutable checkpoint for a shared task").requiredOption(
|
|
43520
43760
|
"--expected-task-revision <n>",
|
|
43521
43761
|
"Current shared task revision"
|
|
43522
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) => {
|
|
@@ -43525,7 +43765,7 @@ teamProgram.command("checkpoint <namespace:id>").description("Create a journaled
|
|
|
43525
43765
|
task
|
|
43526
43766
|
});
|
|
43527
43767
|
});
|
|
43528
|
-
teamProgram.command("claim <namespace:id>").description("Acquire a scoped claim for a shared
|
|
43768
|
+
teamProgram.command("claim <namespace:id>").description("Acquire a scoped claim for a shared task").requiredOption(
|
|
43529
43769
|
"--expected-task-revision <n>",
|
|
43530
43770
|
"Current shared task revision"
|
|
43531
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) => {
|
|
@@ -43602,18 +43842,21 @@ teamHandoffProgram.command("cancel <handoffId>").description("Cancel a draft or
|
|
|
43602
43842
|
handoffId
|
|
43603
43843
|
});
|
|
43604
43844
|
});
|
|
43605
|
-
var migrateProgram = program.command("migrate").description("Inspect and migrate legacy
|
|
43606
|
-
var migrateContextProgram = migrateProgram.command("context").description("Manage the isolated legacy-to-
|
|
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(
|
|
43607
43850
|
"--expected-stage-revision <n>",
|
|
43608
43851
|
"Expected stage revision for activation"
|
|
43609
|
-
).option("--session <id>", "Active session required for activation").option("--confirm", "Explicitly confirm the
|
|
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) => {
|
|
43610
43853
|
const code = await migrateContext(process.cwd(), options);
|
|
43611
43854
|
process.exitCode = code;
|
|
43612
43855
|
});
|
|
43613
43856
|
migrateContextProgram.command("resolve <legacyTaskId>").description("Resolve missing owner or implementation scope in one stage").requiredOption(
|
|
43614
43857
|
"--expected-stage-revision <n>",
|
|
43615
43858
|
"Expected local migration stage revision"
|
|
43616
|
-
).option("--stage-id <id>", "Migration stage ID (required if more than one)").option("--owner <actorId>", "Explicit
|
|
43859
|
+
).option("--stage-id <id>", "Migration stage ID (required if more than one)").option("--owner <actorId>", "Explicit owner actor ID").option(
|
|
43617
43860
|
"--scope-file <path>",
|
|
43618
43861
|
"JSON implementation scope {include,exclude,modules}"
|
|
43619
43862
|
).option("--json", "Output as JSON (for scripts)").action(async (legacyTaskId, options) => {
|