@cleocode/cleo 2026.5.69 → 2026.5.71
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/index.js +242 -593
- package/dist/cli/index.js.map +3 -3
- package/package.json +10 -10
package/dist/cli/index.js
CHANGED
|
@@ -16796,8 +16796,7 @@ import {
|
|
|
16796
16796
|
getBrainDb,
|
|
16797
16797
|
getBrainNativeDb,
|
|
16798
16798
|
OAUTH_STATUS_PROVIDERS,
|
|
16799
|
-
|
|
16800
|
-
resolveAnthropicApiKeySource,
|
|
16799
|
+
resolveCredentials,
|
|
16801
16800
|
resolveProviderStatus,
|
|
16802
16801
|
typedAll
|
|
16803
16802
|
} from "@cleocode/core/internal";
|
|
@@ -17289,8 +17288,21 @@ var init_memory2 = __esm({
|
|
|
17289
17288
|
}
|
|
17290
17289
|
// T791 — LLM extraction backend status
|
|
17291
17290
|
case "llm-status": {
|
|
17292
|
-
const
|
|
17293
|
-
const extractionEnabled =
|
|
17291
|
+
const _anthropicCred = resolveCredentials("anthropic");
|
|
17292
|
+
const extractionEnabled = _anthropicCred.apiKey !== null;
|
|
17293
|
+
const resolvedSource = (() => {
|
|
17294
|
+
switch (_anthropicCred.source) {
|
|
17295
|
+
case "env":
|
|
17296
|
+
return "env";
|
|
17297
|
+
case "claude-creds":
|
|
17298
|
+
return "oauth";
|
|
17299
|
+
case "global-config":
|
|
17300
|
+
case "project-config":
|
|
17301
|
+
return "config";
|
|
17302
|
+
default:
|
|
17303
|
+
return "none";
|
|
17304
|
+
}
|
|
17305
|
+
})();
|
|
17294
17306
|
const providers = OAUTH_STATUS_PROVIDERS.map(resolveProviderStatus);
|
|
17295
17307
|
let lastExtractionRun = null;
|
|
17296
17308
|
try {
|
|
@@ -24299,8 +24311,8 @@ async function loadPlaybookByName(name) {
|
|
|
24299
24311
|
return null;
|
|
24300
24312
|
}
|
|
24301
24313
|
try {
|
|
24302
|
-
const { getProjectRoot:
|
|
24303
|
-
const projectRoot = __playbookRuntimeOverrides.projectRoot ??
|
|
24314
|
+
const { getProjectRoot: getProjectRoot33 } = await import("@cleocode/core/internal");
|
|
24315
|
+
const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot33();
|
|
24304
24316
|
const resolved = resolvePlaybook(name, {
|
|
24305
24317
|
projectRoot,
|
|
24306
24318
|
globalPlaybooksDir: __playbookRuntimeOverrides.globalPlaybooksDir,
|
|
@@ -24344,8 +24356,8 @@ async function acquireDb() {
|
|
|
24344
24356
|
async function buildDefaultDispatcher() {
|
|
24345
24357
|
if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
|
|
24346
24358
|
const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await Promise.resolve().then(() => (init_engine(), engine_exports));
|
|
24347
|
-
const { getProjectRoot:
|
|
24348
|
-
const projectRoot =
|
|
24359
|
+
const { getProjectRoot: getProjectRoot33 } = await import("@cleocode/core/internal");
|
|
24360
|
+
const projectRoot = getProjectRoot33();
|
|
24349
24361
|
return {
|
|
24350
24362
|
async dispatch(input) {
|
|
24351
24363
|
try {
|
|
@@ -24535,8 +24547,8 @@ var init_playbook2 = __esm({
|
|
|
24535
24547
|
projectRoot = __playbookRuntimeOverrides.projectRoot;
|
|
24536
24548
|
} else {
|
|
24537
24549
|
try {
|
|
24538
|
-
const { getProjectRoot:
|
|
24539
|
-
projectRoot =
|
|
24550
|
+
const { getProjectRoot: getProjectRoot33 } = await import("@cleocode/core/internal");
|
|
24551
|
+
projectRoot = getProjectRoot33();
|
|
24540
24552
|
} catch {
|
|
24541
24553
|
projectRoot = void 0;
|
|
24542
24554
|
}
|
|
@@ -24600,14 +24612,14 @@ var init_playbook2 = __esm({
|
|
|
24600
24612
|
const dispatcher = await buildDefaultDispatcher();
|
|
24601
24613
|
let result;
|
|
24602
24614
|
try {
|
|
24603
|
-
const { getProjectRoot:
|
|
24615
|
+
const { getProjectRoot: getProjectRoot33 } = await import("@cleocode/core/internal");
|
|
24604
24616
|
const opts = {
|
|
24605
24617
|
db,
|
|
24606
24618
|
playbook: parsed.definition,
|
|
24607
24619
|
playbookHash: parsed.sourceHash,
|
|
24608
24620
|
initialContext,
|
|
24609
24621
|
dispatcher,
|
|
24610
|
-
projectRoot:
|
|
24622
|
+
projectRoot: getProjectRoot33()
|
|
24611
24623
|
};
|
|
24612
24624
|
if (__playbookRuntimeOverrides.approvalSecret !== void 0) {
|
|
24613
24625
|
opts.approvalSecret = __playbookRuntimeOverrides.approvalSecret;
|
|
@@ -24969,12 +24981,12 @@ async function orchestrateRejectOp(params) {
|
|
|
24969
24981
|
async function orchestrateClassify(request, context, projectRoot) {
|
|
24970
24982
|
try {
|
|
24971
24983
|
const { getCleoCantWorkflowsDir } = await import("@cleocode/core/internal");
|
|
24972
|
-
const { readFileSync: readFileSync17, readdirSync: readdirSync4, existsSync:
|
|
24984
|
+
const { readFileSync: readFileSync17, readdirSync: readdirSync4, existsSync: existsSync14 } = await import("node:fs");
|
|
24973
24985
|
const { join: join26 } = await import("node:path");
|
|
24974
24986
|
const workflowsDir = getCleoCantWorkflowsDir();
|
|
24975
24987
|
const combined = `${request} ${context ?? ""}`.toLowerCase();
|
|
24976
24988
|
const matches = [];
|
|
24977
|
-
if (
|
|
24989
|
+
if (existsSync14(workflowsDir)) {
|
|
24978
24990
|
const files = readdirSync4(workflowsDir).filter((f) => f.endsWith(".cant"));
|
|
24979
24991
|
for (const file of files) {
|
|
24980
24992
|
try {
|
|
@@ -24994,7 +25006,7 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
24994
25006
|
}
|
|
24995
25007
|
}
|
|
24996
25008
|
const localCantDir = join26(projectRoot, CLEO_DIR_NAME, WORKFLOWS_SUBDIR);
|
|
24997
|
-
if (
|
|
25009
|
+
if (existsSync14(localCantDir)) {
|
|
24998
25010
|
const files = readdirSync4(localCantDir).filter((f) => f.endsWith(".cant"));
|
|
24999
25011
|
for (const file of files) {
|
|
25000
25012
|
try {
|
|
@@ -28122,9 +28134,7 @@ var init_tasks3 = __esm({
|
|
|
28122
28134
|
scope: params.scope,
|
|
28123
28135
|
severity: params.severity,
|
|
28124
28136
|
// T1633: BRAIN duplicate-bypass flag
|
|
28125
|
-
forceDuplicate: params.forceDuplicate
|
|
28126
|
-
// T9218 / ADR-070: mandatory verifier for high-consequence tasks
|
|
28127
|
-
verifier: params.verifier
|
|
28137
|
+
forceDuplicate: params.forceDuplicate
|
|
28128
28138
|
}),
|
|
28129
28139
|
"add"
|
|
28130
28140
|
);
|
|
@@ -28163,7 +28173,11 @@ var init_tasks3 = __esm({
|
|
|
28163
28173
|
// T1590: AC-immutability override reason
|
|
28164
28174
|
reason: params.reason,
|
|
28165
28175
|
// T9241: clear the free-text blockedBy reason
|
|
28166
|
-
clearBlockedBy: params.clearBlockedBy
|
|
28176
|
+
clearBlockedBy: params.clearBlockedBy,
|
|
28177
|
+
// T9327: relates mutations
|
|
28178
|
+
relates: params.relates,
|
|
28179
|
+
addRelates: params.addRelates,
|
|
28180
|
+
removeRelates: params.removeRelates
|
|
28167
28181
|
}),
|
|
28168
28182
|
"update"
|
|
28169
28183
|
);
|
|
@@ -29516,11 +29530,11 @@ var init_security = __esm({
|
|
|
29516
29530
|
});
|
|
29517
29531
|
|
|
29518
29532
|
// packages/cleo/src/dispatch/middleware/sanitizer.ts
|
|
29519
|
-
function createSanitizer(
|
|
29533
|
+
function createSanitizer(getProjectRoot33) {
|
|
29520
29534
|
return async (req, next) => {
|
|
29521
29535
|
if (req.params) {
|
|
29522
29536
|
try {
|
|
29523
|
-
const root =
|
|
29537
|
+
const root = getProjectRoot33 ? getProjectRoot33() : void 0;
|
|
29524
29538
|
req.params = sanitizeParams(req.params, root, {
|
|
29525
29539
|
domain: req.domain,
|
|
29526
29540
|
operation: req.operation
|
|
@@ -30377,17 +30391,13 @@ var init_add = __esm({
|
|
|
30377
30391
|
description: "Justification for creating a critical-priority task without --depends (T1856). Records waiver in task metadata."
|
|
30378
30392
|
},
|
|
30379
30393
|
/**
|
|
30380
|
-
*
|
|
30381
|
-
*
|
|
30382
|
-
*
|
|
30383
|
-
* type=epic. The path must point to an existing .mjs file. Omitting
|
|
30384
|
-
* this on high-consequence tasks causes rejection with E_VERIFIER_REQUIRED.
|
|
30385
|
-
*
|
|
30386
|
-
* Use `cleo verify backfill <taskId>` to generate a stub after creation.
|
|
30394
|
+
* Related tasks — semantic relationships (non-dependency).
|
|
30395
|
+
* Comma-separated task IDs with optional type suffix (e.g. "T001:blocks,T002:related").
|
|
30396
|
+
* Default type is 'related'.
|
|
30387
30397
|
*/
|
|
30388
|
-
|
|
30398
|
+
relates: {
|
|
30389
30399
|
type: "string",
|
|
30390
|
-
description:
|
|
30400
|
+
description: 'Comma-separated related task IDs with optional type suffix (e.g. "T001:blocks,T002")'
|
|
30391
30401
|
}
|
|
30392
30402
|
},
|
|
30393
30403
|
async run({ args, cmd }) {
|
|
@@ -30411,6 +30421,12 @@ var init_add = __esm({
|
|
|
30411
30421
|
}
|
|
30412
30422
|
if (args.labels) params["labels"] = args.labels.split(",").map((s) => s.trim());
|
|
30413
30423
|
if (args.depends) params["depends"] = args.depends.split(",").map((s) => s.trim());
|
|
30424
|
+
if (args.relates) {
|
|
30425
|
+
params["relates"] = args.relates.split(",").map((s) => {
|
|
30426
|
+
const [taskId, relType = "related"] = s.trim().split(":");
|
|
30427
|
+
return { taskId: taskId.trim(), type: relType.trim() };
|
|
30428
|
+
});
|
|
30429
|
+
}
|
|
30414
30430
|
if (args.notes !== void 0) params["notes"] = args.notes;
|
|
30415
30431
|
if (args.note !== void 0) params["notes"] = params["notes"] ?? args.note;
|
|
30416
30432
|
if (args.position !== void 0)
|
|
@@ -30421,7 +30437,6 @@ var init_add = __esm({
|
|
|
30421
30437
|
if (args.scope !== void 0) params["scope"] = args.scope;
|
|
30422
30438
|
if (args.severity !== void 0) params["severity"] = args.severity;
|
|
30423
30439
|
if (args["force-duplicate"] !== void 0) params["forceDuplicate"] = args["force-duplicate"];
|
|
30424
|
-
if (args.verifier !== void 0) params["verifier"] = args.verifier;
|
|
30425
30440
|
if (args.priority === "critical" && !args.depends && args["depends-waiver"] === void 0) {
|
|
30426
30441
|
cliError(
|
|
30427
30442
|
'Critical-priority tasks must declare at least one dependency (--depends) or provide a waiver (--depends-waiver "<reason>").',
|
|
@@ -31468,12 +31483,12 @@ var init_agent = __esm({
|
|
|
31468
31483
|
transportConfig: {},
|
|
31469
31484
|
isActive: true
|
|
31470
31485
|
});
|
|
31471
|
-
const { existsSync:
|
|
31486
|
+
const { existsSync: existsSync14, mkdirSync: mkdirSync7, writeFileSync: writeFileSync6 } = await import("node:fs");
|
|
31472
31487
|
const { join: join26 } = await import("node:path");
|
|
31473
31488
|
const cantDir = join26(CLEO_DIR_NAME, AGENTS_SUBDIR);
|
|
31474
31489
|
const cantPath = join26(cantDir, `${agentId}.cant`);
|
|
31475
31490
|
let cantScaffolded = false;
|
|
31476
|
-
if (!
|
|
31491
|
+
if (!existsSync14(cantPath)) {
|
|
31477
31492
|
mkdirSync7(cantDir, { recursive: true });
|
|
31478
31493
|
const role = classification ?? "specialist";
|
|
31479
31494
|
const cantContent = `---
|
|
@@ -31533,7 +31548,7 @@ agent ${agentId}:
|
|
|
31533
31548
|
data: {
|
|
31534
31549
|
agentId: credential.agentId,
|
|
31535
31550
|
displayName: credential.displayName,
|
|
31536
|
-
cantFile: cantScaffolded ? cantPath :
|
|
31551
|
+
cantFile: cantScaffolded ? cantPath : existsSync14(cantPath) ? cantPath : null,
|
|
31537
31552
|
cantScaffolded
|
|
31538
31553
|
}
|
|
31539
31554
|
},
|
|
@@ -31652,7 +31667,7 @@ agent ${agentId}:
|
|
|
31652
31667
|
try {
|
|
31653
31668
|
const { AgentRegistryAccessor, getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
31654
31669
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
31655
|
-
const { existsSync:
|
|
31670
|
+
const { existsSync: existsSync14, readFileSync: readFileSync17 } = await import("node:fs");
|
|
31656
31671
|
const { join: join26 } = await import("node:path");
|
|
31657
31672
|
await getDb3();
|
|
31658
31673
|
const registry = new AgentRegistryAccessor(process.cwd());
|
|
@@ -31674,7 +31689,7 @@ agent ${agentId}:
|
|
|
31674
31689
|
let profile = null;
|
|
31675
31690
|
let cantValidation = null;
|
|
31676
31691
|
const cantPath = args.cant ?? join26(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
31677
|
-
if (
|
|
31692
|
+
if (existsSync14(cantPath)) {
|
|
31678
31693
|
profile = readFileSync17(cantPath, "utf-8");
|
|
31679
31694
|
try {
|
|
31680
31695
|
const cantModule = await import("@cleocode/cant");
|
|
@@ -32198,7 +32213,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32198
32213
|
try {
|
|
32199
32214
|
const { AgentRegistryAccessor, getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
32200
32215
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
32201
|
-
const { existsSync:
|
|
32216
|
+
const { existsSync: existsSync14 } = await import("node:fs");
|
|
32202
32217
|
const { join: join26 } = await import("node:path");
|
|
32203
32218
|
const { execFile: execFile2 } = await import("node:child_process");
|
|
32204
32219
|
const { promisify: promisify2 } = await import("node:util");
|
|
@@ -32220,7 +32235,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32220
32235
|
await registry.update(args.agentId, { isActive: true });
|
|
32221
32236
|
await registry.markUsed(args.agentId);
|
|
32222
32237
|
const cantPath = join26(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
32223
|
-
const hasProfile =
|
|
32238
|
+
const hasProfile = existsSync14(cantPath);
|
|
32224
32239
|
const runtime = await createRuntime(registry, {
|
|
32225
32240
|
agentId: args.agentId,
|
|
32226
32241
|
pollIntervalMs: 5e3,
|
|
@@ -33068,11 +33083,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33068
33083
|
async run({ args }) {
|
|
33069
33084
|
let tempDir = null;
|
|
33070
33085
|
try {
|
|
33071
|
-
const { existsSync:
|
|
33072
|
-
const { join: join26, basename, resolve:
|
|
33086
|
+
const { existsSync: existsSync14, mkdirSync: mkdirSync7, statSync, readdirSync: readdirSync4, copyFileSync } = await import("node:fs");
|
|
33087
|
+
const { join: join26, basename, resolve: resolve5, extname } = await import("node:path");
|
|
33073
33088
|
const { tmpdir: tmpdir2 } = await import("node:os");
|
|
33074
|
-
const resolvedPath =
|
|
33075
|
-
if (!
|
|
33089
|
+
const resolvedPath = resolve5(args.path);
|
|
33090
|
+
if (!existsSync14(resolvedPath)) {
|
|
33076
33091
|
cliOutput(
|
|
33077
33092
|
{
|
|
33078
33093
|
success: false,
|
|
@@ -33133,7 +33148,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33133
33148
|
}
|
|
33134
33149
|
const agentName = topLevel[0];
|
|
33135
33150
|
const personaPath = join26(tempDir, agentName, "persona.cant");
|
|
33136
|
-
if (!
|
|
33151
|
+
if (!existsSync14(personaPath)) {
|
|
33137
33152
|
cliOutput(
|
|
33138
33153
|
{
|
|
33139
33154
|
success: false,
|
|
@@ -33152,7 +33167,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33152
33167
|
} else if (stat2.isDirectory()) {
|
|
33153
33168
|
const agentName = basename(resolvedPath);
|
|
33154
33169
|
const personaPath = join26(resolvedPath, "persona.cant");
|
|
33155
|
-
if (!
|
|
33170
|
+
if (!existsSync14(personaPath)) {
|
|
33156
33171
|
cliOutput(
|
|
33157
33172
|
{
|
|
33158
33173
|
success: false,
|
|
@@ -33287,11 +33302,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33287
33302
|
},
|
|
33288
33303
|
async run({ args }) {
|
|
33289
33304
|
try {
|
|
33290
|
-
const { existsSync:
|
|
33291
|
-
const { resolve:
|
|
33305
|
+
const { existsSync: existsSync14, statSync } = await import("node:fs");
|
|
33306
|
+
const { resolve: resolve5, basename, dirname: dirname9 } = await import("node:path");
|
|
33292
33307
|
const { execFileSync: execFileSync5 } = await import("node:child_process");
|
|
33293
|
-
const resolvedDir =
|
|
33294
|
-
if (!
|
|
33308
|
+
const resolvedDir = resolve5(args.dir);
|
|
33309
|
+
if (!existsSync14(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
|
|
33295
33310
|
cliOutput(
|
|
33296
33311
|
{
|
|
33297
33312
|
success: false,
|
|
@@ -33307,7 +33322,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33307
33322
|
}
|
|
33308
33323
|
const { join: join26 } = await import("node:path");
|
|
33309
33324
|
const personaPath = join26(resolvedDir, "persona.cant");
|
|
33310
|
-
if (!
|
|
33325
|
+
if (!existsSync14(personaPath)) {
|
|
33311
33326
|
cliOutput(
|
|
33312
33327
|
{
|
|
33313
33328
|
success: false,
|
|
@@ -33323,7 +33338,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33323
33338
|
}
|
|
33324
33339
|
const agentName = basename(resolvedDir);
|
|
33325
33340
|
const archiveName = `${agentName}.cantz`;
|
|
33326
|
-
const archivePath =
|
|
33341
|
+
const archivePath = resolve5(archiveName);
|
|
33327
33342
|
const parentDir = dirname9(resolvedDir);
|
|
33328
33343
|
try {
|
|
33329
33344
|
execFileSync5("zip", ["-r", archivePath, agentName], {
|
|
@@ -33423,7 +33438,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33423
33438
|
},
|
|
33424
33439
|
async run({ args }) {
|
|
33425
33440
|
try {
|
|
33426
|
-
const { existsSync:
|
|
33441
|
+
const { existsSync: existsSync14, mkdirSync: mkdirSync7, writeFileSync: writeFileSync6 } = await import("node:fs");
|
|
33427
33442
|
const { join: join26 } = await import("node:path");
|
|
33428
33443
|
const { homedir: homedir9 } = await import("node:os");
|
|
33429
33444
|
const name = args.name;
|
|
@@ -33490,7 +33505,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33490
33505
|
targetRoot = join26(process.cwd(), CLEO_DIR_NAME, CANT_AGENTS_SUBDIR);
|
|
33491
33506
|
}
|
|
33492
33507
|
const agentDir = join26(targetRoot, name);
|
|
33493
|
-
if (
|
|
33508
|
+
if (existsSync14(agentDir)) {
|
|
33494
33509
|
cliOutput(
|
|
33495
33510
|
{
|
|
33496
33511
|
success: false,
|
|
@@ -33634,17 +33649,17 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
33634
33649
|
},
|
|
33635
33650
|
async run({ args }) {
|
|
33636
33651
|
try {
|
|
33637
|
-
const { existsSync:
|
|
33638
|
-
const { resolve:
|
|
33639
|
-
const specPath =
|
|
33640
|
-
if (!
|
|
33652
|
+
const { existsSync: existsSync14, readFileSync: readFileSync17, mkdirSync: mkdirSync7 } = await import("node:fs");
|
|
33653
|
+
const { resolve: resolve5, join: join26 } = await import("node:path");
|
|
33654
|
+
const specPath = resolve5(args.spec);
|
|
33655
|
+
if (!existsSync14(specPath)) {
|
|
33641
33656
|
cliError(`spec file not found: ${specPath}`, 4, { name: "E_NOT_FOUND" });
|
|
33642
33657
|
process.exitCode = 4;
|
|
33643
33658
|
return;
|
|
33644
33659
|
}
|
|
33645
33660
|
const specContent = readFileSync17(specPath, "utf-8");
|
|
33646
33661
|
const projectRoot = process.cwd();
|
|
33647
|
-
const outputDir = args["output-dir"] ?
|
|
33662
|
+
const outputDir = args["output-dir"] ? resolve5(args["output-dir"]) : join26(projectRoot, ".cleo", "cant", "agents");
|
|
33648
33663
|
mkdirSync7(outputDir, { recursive: true });
|
|
33649
33664
|
if (args["dry-run"]) {
|
|
33650
33665
|
cliOutput(
|
|
@@ -34042,11 +34057,8 @@ var audit_exports = {};
|
|
|
34042
34057
|
__export(audit_exports, {
|
|
34043
34058
|
auditCommand: () => auditCommand
|
|
34044
34059
|
});
|
|
34045
|
-
import {
|
|
34046
|
-
|
|
34047
|
-
import { resolve as resolve3 } from "node:path";
|
|
34048
|
-
import { getProjectRoot as getProjectRoot19, reconstructLineage, resolveVerifierScript } from "@cleocode/core/internal";
|
|
34049
|
-
var reconstructCommand, verifierCommand, auditCommand;
|
|
34060
|
+
import { getProjectRoot as getProjectRoot19, reconstructLineage } from "@cleocode/core/internal";
|
|
34061
|
+
var reconstructCommand, auditCommand;
|
|
34050
34062
|
var init_audit2 = __esm({
|
|
34051
34063
|
"packages/cleo/src/cli/commands/audit.ts"() {
|
|
34052
34064
|
"use strict";
|
|
@@ -34102,82 +34114,13 @@ var init_audit2 = __esm({
|
|
|
34102
34114
|
});
|
|
34103
34115
|
}
|
|
34104
34116
|
});
|
|
34105
|
-
verifierCommand = defineCommand({
|
|
34106
|
-
meta: {
|
|
34107
|
-
name: "verifier",
|
|
34108
|
-
description: "Independent acceptance verifier re-run (ADR-070 auditor-loop). Resolves scripts/verify-<taskId>-fu.mjs and runs it independently. Does NOT trust prior Implementer claims. Exits non-zero if verifier fails."
|
|
34109
|
-
},
|
|
34110
|
-
args: {
|
|
34111
|
-
taskId: {
|
|
34112
|
-
type: "positional",
|
|
34113
|
-
description: "Task ID whose acceptance verifier script to run independently (e.g. T9188)",
|
|
34114
|
-
required: true
|
|
34115
|
-
},
|
|
34116
|
-
script: {
|
|
34117
|
-
type: "string",
|
|
34118
|
-
description: "Explicit path to the verifier script (overrides auto-resolution)"
|
|
34119
|
-
}
|
|
34120
|
-
},
|
|
34121
|
-
async run({ args }) {
|
|
34122
|
-
const taskId = String(args.taskId);
|
|
34123
|
-
let projectRoot;
|
|
34124
|
-
try {
|
|
34125
|
-
projectRoot = getProjectRoot19(process.cwd()) ?? resolve3(process.cwd());
|
|
34126
|
-
} catch {
|
|
34127
|
-
projectRoot = resolve3(process.cwd());
|
|
34128
|
-
}
|
|
34129
|
-
let verifierPath;
|
|
34130
|
-
if (args.script) {
|
|
34131
|
-
const explicit = resolve3(projectRoot, String(args.script));
|
|
34132
|
-
verifierPath = existsSync6(explicit) ? explicit : null;
|
|
34133
|
-
if (!verifierPath) {
|
|
34134
|
-
cliError(`Verifier script not found: ${explicit}`, 1, { name: "E_NOT_FOUND" });
|
|
34135
|
-
process.exitCode = 1;
|
|
34136
|
-
return;
|
|
34137
|
-
}
|
|
34138
|
-
} else {
|
|
34139
|
-
verifierPath = resolveVerifierScript(taskId, projectRoot);
|
|
34140
|
-
}
|
|
34141
|
-
if (!verifierPath) {
|
|
34142
|
-
cliError(
|
|
34143
|
-
`No verifier script found for ${taskId}.
|
|
34144
|
-
Looked for: scripts/verify-${taskId}-fu.mjs, scripts/verify-${taskId}.mjs
|
|
34145
|
-
Create the verifier script per ADR-070 before running the auditor.`,
|
|
34146
|
-
1,
|
|
34147
|
-
{ name: "E_NOT_FOUND" }
|
|
34148
|
-
);
|
|
34149
|
-
process.exitCode = 1;
|
|
34150
|
-
return;
|
|
34151
|
-
}
|
|
34152
|
-
humanLine(`[AUDITOR] Independent verifier run for ${taskId}`);
|
|
34153
|
-
humanLine(`[AUDITOR] Script: ${verifierPath}`);
|
|
34154
|
-
humanLine("[AUDITOR] Note: Does NOT trust any prior Implementer claims.\n");
|
|
34155
|
-
const result = spawnSync("node", [verifierPath], { encoding: "utf8", stdio: "inherit" });
|
|
34156
|
-
const exitCode = result.status ?? 1;
|
|
34157
|
-
if (exitCode === 0) {
|
|
34158
|
-
humanLine(
|
|
34159
|
-
`
|
|
34160
|
-
[AUDITOR] Audit pass. Verifier exit-code 0. Task ${taskId} acceptance verified.`
|
|
34161
|
-
);
|
|
34162
|
-
} else {
|
|
34163
|
-
process.stderr.write(
|
|
34164
|
-
`
|
|
34165
|
-
[AUDITOR] Audit fail. Verifier exit-code ${exitCode}. Task ${taskId} NOT verified.
|
|
34166
|
-
E_ACCEPTANCE_VERIFIER_FAILED. Implementation must be re-worked. (ADR-070)
|
|
34167
|
-
`
|
|
34168
|
-
);
|
|
34169
|
-
process.exitCode = exitCode;
|
|
34170
|
-
}
|
|
34171
|
-
}
|
|
34172
|
-
});
|
|
34173
34117
|
auditCommand = defineCommand({
|
|
34174
34118
|
meta: {
|
|
34175
34119
|
name: "audit",
|
|
34176
|
-
description: "Git-backed audit tooling (lineage reconstruction, integrity checks).
|
|
34120
|
+
description: "Git-backed audit tooling (lineage reconstruction, integrity checks). Independent re-verification of task completion claims is handled by `cleo verify <taskId> --explain` which re-validates ADR-051 evidence atoms."
|
|
34177
34121
|
},
|
|
34178
34122
|
subCommands: {
|
|
34179
|
-
reconstruct: reconstructCommand
|
|
34180
|
-
verifier: verifierCommand
|
|
34123
|
+
reconstruct: reconstructCommand
|
|
34181
34124
|
},
|
|
34182
34125
|
async run({ args: _args }) {
|
|
34183
34126
|
await showUsage(auditCommand);
|
|
@@ -34186,144 +34129,6 @@ var init_audit2 = __esm({
|
|
|
34186
34129
|
}
|
|
34187
34130
|
});
|
|
34188
34131
|
|
|
34189
|
-
// packages/cleo/src/cli/commands/backfill.ts
|
|
34190
|
-
var backfill_exports = {};
|
|
34191
|
-
__export(backfill_exports, {
|
|
34192
|
-
backfillCommand: () => backfillCommand
|
|
34193
|
-
});
|
|
34194
|
-
import { backfillTasks, getProjectRoot as getProjectRoot20, populateEmbeddings } from "@cleocode/core/internal";
|
|
34195
|
-
var backfillCommand;
|
|
34196
|
-
var init_backfill = __esm({
|
|
34197
|
-
"packages/cleo/src/cli/commands/backfill.ts"() {
|
|
34198
|
-
"use strict";
|
|
34199
|
-
init_dist();
|
|
34200
|
-
init_renderers();
|
|
34201
|
-
backfillCommand = defineCommand({
|
|
34202
|
-
meta: {
|
|
34203
|
-
name: "backfill",
|
|
34204
|
-
description: "Retroactively add acceptance criteria and verification metadata to existing tasks"
|
|
34205
|
-
},
|
|
34206
|
-
args: {
|
|
34207
|
-
"dry-run": {
|
|
34208
|
-
type: "boolean",
|
|
34209
|
-
description: "Show what would be changed without modifying any tasks",
|
|
34210
|
-
default: false
|
|
34211
|
-
},
|
|
34212
|
-
rollback: {
|
|
34213
|
-
type: "boolean",
|
|
34214
|
-
description: "Revert a previous backfill (clear auto-generated AC and verification)",
|
|
34215
|
-
default: false
|
|
34216
|
-
},
|
|
34217
|
-
tasks: {
|
|
34218
|
-
type: "string",
|
|
34219
|
-
description: "Comma-separated list of task IDs to restrict backfill to (e.g. T001,T002)"
|
|
34220
|
-
},
|
|
34221
|
-
embeddings: {
|
|
34222
|
-
type: "boolean",
|
|
34223
|
-
description: "Retroactively generate embeddings for brain observations that lack them",
|
|
34224
|
-
default: false
|
|
34225
|
-
}
|
|
34226
|
-
},
|
|
34227
|
-
async run({ args }) {
|
|
34228
|
-
const root = getProjectRoot20();
|
|
34229
|
-
if (args.embeddings) {
|
|
34230
|
-
try {
|
|
34231
|
-
let lastLine = "";
|
|
34232
|
-
const result = await populateEmbeddings(root, {
|
|
34233
|
-
onProgress: (current, total) => {
|
|
34234
|
-
if (process.stdout.isTTY) {
|
|
34235
|
-
humanProgress(`\rEmbedding ${current}/${total}...`);
|
|
34236
|
-
} else {
|
|
34237
|
-
const line = `Embedding ${current}/${total}...`;
|
|
34238
|
-
if (line !== lastLine) {
|
|
34239
|
-
humanLine(line);
|
|
34240
|
-
lastLine = line;
|
|
34241
|
-
}
|
|
34242
|
-
}
|
|
34243
|
-
}
|
|
34244
|
-
});
|
|
34245
|
-
if (process.stdout.isTTY && result.processed + result.skipped + result.errors > 0) {
|
|
34246
|
-
humanProgress("\n");
|
|
34247
|
-
}
|
|
34248
|
-
if (result.processed === 0 && result.skipped === 0 && result.errors === 0) {
|
|
34249
|
-
cliOutput(
|
|
34250
|
-
{
|
|
34251
|
-
processed: 0,
|
|
34252
|
-
skipped: 0,
|
|
34253
|
-
errors: 0,
|
|
34254
|
-
message: "No observations to embed (provider unavailable or nothing to backfill)."
|
|
34255
|
-
},
|
|
34256
|
-
{ command: "backfill", operation: "admin.backfill", message: "Nothing to embed" }
|
|
34257
|
-
);
|
|
34258
|
-
return;
|
|
34259
|
-
}
|
|
34260
|
-
cliOutput(
|
|
34261
|
-
{ processed: result.processed, skipped: result.skipped, errors: result.errors },
|
|
34262
|
-
{
|
|
34263
|
-
command: "backfill",
|
|
34264
|
-
operation: "admin.backfill",
|
|
34265
|
-
message: `Processed ${result.processed}, skipped ${result.skipped}, errors ${result.errors}`
|
|
34266
|
-
}
|
|
34267
|
-
);
|
|
34268
|
-
} catch (err) {
|
|
34269
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
34270
|
-
cliError(
|
|
34271
|
-
`Embedding backfill failed: ${message}`,
|
|
34272
|
-
"E_INTERNAL",
|
|
34273
|
-
{
|
|
34274
|
-
name: "E_INTERNAL"
|
|
34275
|
-
},
|
|
34276
|
-
{ operation: "admin.backfill" }
|
|
34277
|
-
);
|
|
34278
|
-
process.exit(1);
|
|
34279
|
-
}
|
|
34280
|
-
return;
|
|
34281
|
-
}
|
|
34282
|
-
const dryRun = !!args["dry-run"];
|
|
34283
|
-
const rollback = !!args.rollback;
|
|
34284
|
-
const taskIds = args.tasks?.trim() ? args.tasks.split(",").map((s) => s.trim()).filter(Boolean) : void 0;
|
|
34285
|
-
if (!dryRun && !rollback && !process.env["CLEO_NONINTERACTIVE"]) {
|
|
34286
|
-
humanWarn(
|
|
34287
|
-
"Warning: Backfill will modify tasks in-place. Run with --dry-run first to preview changes.\n Set CLEO_NONINTERACTIVE=1 or pass --dry-run to suppress this warning.\n"
|
|
34288
|
-
);
|
|
34289
|
-
}
|
|
34290
|
-
try {
|
|
34291
|
-
const result = await backfillTasks(root, { dryRun, rollback, taskIds });
|
|
34292
|
-
const output = {
|
|
34293
|
-
dryRun,
|
|
34294
|
-
rollback,
|
|
34295
|
-
tasksScanned: result.tasksScanned,
|
|
34296
|
-
tasksChanged: result.tasksChanged,
|
|
34297
|
-
changes: result.changes
|
|
34298
|
-
};
|
|
34299
|
-
if (!rollback) {
|
|
34300
|
-
output["acAdded"] = result.acAdded;
|
|
34301
|
-
output["verificationAdded"] = result.verificationAdded;
|
|
34302
|
-
}
|
|
34303
|
-
const messagePrefix = dryRun ? "[dry run] " : rollback ? "[rollback] " : "";
|
|
34304
|
-
const messageSuffix = result.changes.length === 0 ? "Nothing to do \u2014 all tasks already have AC and verification metadata." : `Scanned ${result.tasksScanned}, changed ${result.tasksChanged} task(s).`;
|
|
34305
|
-
cliOutput(output, {
|
|
34306
|
-
command: "backfill",
|
|
34307
|
-
operation: "admin.backfill",
|
|
34308
|
-
message: `${messagePrefix}${messageSuffix}`
|
|
34309
|
-
});
|
|
34310
|
-
} catch (err) {
|
|
34311
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
34312
|
-
cliError(
|
|
34313
|
-
`Backfill failed: ${message}`,
|
|
34314
|
-
"E_INTERNAL",
|
|
34315
|
-
{
|
|
34316
|
-
name: "E_INTERNAL"
|
|
34317
|
-
},
|
|
34318
|
-
{ operation: "admin.backfill" }
|
|
34319
|
-
);
|
|
34320
|
-
process.exit(1);
|
|
34321
|
-
}
|
|
34322
|
-
}
|
|
34323
|
-
});
|
|
34324
|
-
}
|
|
34325
|
-
});
|
|
34326
|
-
|
|
34327
34132
|
// packages/cleo/src/cli/commands/backup-inspect.ts
|
|
34328
34133
|
var backup_inspect_exports = {};
|
|
34329
34134
|
__export(backup_inspect_exports, {
|
|
@@ -34604,12 +34409,12 @@ async function promptPassphrase() {
|
|
|
34604
34409
|
"Cannot prompt for passphrase: stdin is not a TTY. Set the CLEO_BACKUP_PASSPHRASE environment variable for non-interactive use."
|
|
34605
34410
|
);
|
|
34606
34411
|
}
|
|
34607
|
-
return new Promise((
|
|
34412
|
+
return new Promise((resolve5) => {
|
|
34608
34413
|
process.stdout.write("Passphrase: ");
|
|
34609
34414
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
34610
34415
|
rl.question("", (answer) => {
|
|
34611
34416
|
rl.close();
|
|
34612
|
-
|
|
34417
|
+
resolve5(answer.trim());
|
|
34613
34418
|
});
|
|
34614
34419
|
});
|
|
34615
34420
|
}
|
|
@@ -34742,9 +34547,9 @@ var init_backup = __esm({
|
|
|
34742
34547
|
},
|
|
34743
34548
|
async run({ args }) {
|
|
34744
34549
|
const scope = args.scope;
|
|
34745
|
-
const { packBundle, getProjectRoot:
|
|
34550
|
+
const { packBundle, getProjectRoot: getProjectRoot33 } = await import("@cleocode/core/internal");
|
|
34746
34551
|
const includesProject = scope === "project" || scope === "all";
|
|
34747
|
-
const projectRoot = includesProject ?
|
|
34552
|
+
const projectRoot = includesProject ? getProjectRoot33() : void 0;
|
|
34748
34553
|
let passphrase;
|
|
34749
34554
|
if (args.encrypt === true) {
|
|
34750
34555
|
passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
|
|
@@ -35045,7 +34850,7 @@ import {
|
|
|
35045
34850
|
exportBrainAsJson,
|
|
35046
34851
|
getMemoryQualityReport,
|
|
35047
34852
|
getPlasticityStats,
|
|
35048
|
-
getProjectRoot as
|
|
34853
|
+
getProjectRoot as getProjectRoot20,
|
|
35049
34854
|
purgeBrainNoise,
|
|
35050
34855
|
runBrainMaintenance
|
|
35051
34856
|
} from "@cleocode/core/internal";
|
|
@@ -35084,7 +34889,7 @@ var init_brain2 = __esm({
|
|
|
35084
34889
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
35085
34890
|
},
|
|
35086
34891
|
async run({ args }) {
|
|
35087
|
-
const root =
|
|
34892
|
+
const root = getProjectRoot20();
|
|
35088
34893
|
try {
|
|
35089
34894
|
const result = await runBrainMaintenance(root, {
|
|
35090
34895
|
skipDecay: !!args["skip-decay"],
|
|
@@ -35155,7 +34960,7 @@ var init_brain2 = __esm({
|
|
|
35155
34960
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
35156
34961
|
},
|
|
35157
34962
|
async run({ args: _args }) {
|
|
35158
|
-
const root =
|
|
34963
|
+
const root = getProjectRoot20();
|
|
35159
34964
|
try {
|
|
35160
34965
|
const result = await backfillBrainGraph(root);
|
|
35161
34966
|
cliOutput(
|
|
@@ -35196,7 +35001,7 @@ var init_brain2 = __esm({
|
|
|
35196
35001
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
35197
35002
|
},
|
|
35198
35003
|
async run({ args: _args }) {
|
|
35199
|
-
const root =
|
|
35004
|
+
const root = getProjectRoot20();
|
|
35200
35005
|
try {
|
|
35201
35006
|
const result = await purgeBrainNoise(root);
|
|
35202
35007
|
cliOutput(
|
|
@@ -35242,7 +35047,7 @@ var init_brain2 = __esm({
|
|
|
35242
35047
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
35243
35048
|
},
|
|
35244
35049
|
async run({ args }) {
|
|
35245
|
-
const root =
|
|
35050
|
+
const root = getProjectRoot20();
|
|
35246
35051
|
const limit = Number.parseInt(args.limit, 10) || 20;
|
|
35247
35052
|
try {
|
|
35248
35053
|
const stats = await getPlasticityStats(root, limit);
|
|
@@ -35292,7 +35097,7 @@ var init_brain2 = __esm({
|
|
|
35292
35097
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
35293
35098
|
},
|
|
35294
35099
|
async run({ args: _args }) {
|
|
35295
|
-
const root =
|
|
35100
|
+
const root = getProjectRoot20();
|
|
35296
35101
|
try {
|
|
35297
35102
|
const report = await getMemoryQualityReport(root);
|
|
35298
35103
|
cliOutput(
|
|
@@ -35341,7 +35146,7 @@ var init_brain2 = __esm({
|
|
|
35341
35146
|
}
|
|
35342
35147
|
},
|
|
35343
35148
|
async run({ args }) {
|
|
35344
|
-
const root =
|
|
35149
|
+
const root = getProjectRoot20();
|
|
35345
35150
|
const format = args.format ?? "gexf";
|
|
35346
35151
|
if (format !== "gexf" && format !== "json") {
|
|
35347
35152
|
cliError(`Invalid format: ${format}. Use 'gexf' or 'json'.`, "E_VALIDATION", {
|
|
@@ -35421,7 +35226,7 @@ var briefing_exports = {};
|
|
|
35421
35226
|
__export(briefing_exports, {
|
|
35422
35227
|
briefingCommand: () => briefingCommand
|
|
35423
35228
|
});
|
|
35424
|
-
import { existsSync as
|
|
35229
|
+
import { existsSync as existsSync6, readFileSync as readFileSync7 } from "node:fs";
|
|
35425
35230
|
import { homedir as homedir2 } from "node:os";
|
|
35426
35231
|
import { join as join7 } from "node:path";
|
|
35427
35232
|
function resolveInjectionTemplatePath() {
|
|
@@ -35453,7 +35258,7 @@ function renderForAdapter(sectionName, content, format) {
|
|
|
35453
35258
|
}
|
|
35454
35259
|
async function runBriefingInject(sectionName, formatStr) {
|
|
35455
35260
|
const templatePath = resolveInjectionTemplatePath();
|
|
35456
|
-
if (!
|
|
35261
|
+
if (!existsSync6(templatePath)) {
|
|
35457
35262
|
process.stderr.write(`[briefing inject] CLEO-INJECTION.md not found at ${templatePath}
|
|
35458
35263
|
`);
|
|
35459
35264
|
process.exitCode = 1;
|
|
@@ -35646,11 +35451,11 @@ var init_caamp = __esm({
|
|
|
35646
35451
|
}
|
|
35647
35452
|
if (args["dry-run"]) {
|
|
35648
35453
|
const { parseCaampBlocks } = await import("@cleocode/caamp");
|
|
35649
|
-
const { existsSync:
|
|
35454
|
+
const { existsSync: existsSync14 } = await import("node:fs");
|
|
35650
35455
|
const { readFile: readFile6 } = await import("node:fs/promises");
|
|
35651
35456
|
const dryResults = [];
|
|
35652
35457
|
for (const filePath of filePaths) {
|
|
35653
|
-
if (!
|
|
35458
|
+
if (!existsSync14(filePath)) {
|
|
35654
35459
|
dryResults.push({ filePath, exists: false, blockCount: 0, wouldRemove: 0 });
|
|
35655
35460
|
continue;
|
|
35656
35461
|
}
|
|
@@ -35748,13 +35553,13 @@ var cant_exports = {};
|
|
|
35748
35553
|
__export(cant_exports, {
|
|
35749
35554
|
cantCommand: () => cantCommand
|
|
35750
35555
|
});
|
|
35751
|
-
import { existsSync as
|
|
35752
|
-
import { dirname as dirname4, isAbsolute, join as join9, resolve as
|
|
35556
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync8, writeFileSync as writeFileSync2 } from "node:fs";
|
|
35557
|
+
import { dirname as dirname4, isAbsolute, join as join9, resolve as resolve3 } from "node:path";
|
|
35753
35558
|
function resolveFilePath(file) {
|
|
35754
|
-
return isAbsolute(file) ? file :
|
|
35559
|
+
return isAbsolute(file) ? file : resolve3(process.cwd(), file);
|
|
35755
35560
|
}
|
|
35756
35561
|
function ensureExists(filePath, operation) {
|
|
35757
|
-
if (
|
|
35562
|
+
if (existsSync7(filePath)) return true;
|
|
35758
35563
|
cliError(`File not found: ${filePath}`, "E_FILE_READ");
|
|
35759
35564
|
process.exitCode = 3;
|
|
35760
35565
|
if (process.env["CLEO_DEBUG"]) humanWarn(`(operation: ${operation})`);
|
|
@@ -37909,7 +37714,7 @@ var daemon_exports = {};
|
|
|
37909
37714
|
__export(daemon_exports, {
|
|
37910
37715
|
daemonCommand: () => daemonCommand
|
|
37911
37716
|
});
|
|
37912
|
-
import { existsSync as
|
|
37717
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
37913
37718
|
import { homedir as homedir4 } from "node:os";
|
|
37914
37719
|
import { join as join10 } from "node:path";
|
|
37915
37720
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
@@ -37977,7 +37782,7 @@ async function showDaemonStatus(cleoDir, projectRoot) {
|
|
|
37977
37782
|
function resolveDaemonInstallerScript() {
|
|
37978
37783
|
const filePath = fileURLToPath3(import.meta.url);
|
|
37979
37784
|
const candidate1 = join10(filePath, "..", "..", "..", "scripts", "install-daemon-service.mjs");
|
|
37980
|
-
if (
|
|
37785
|
+
if (existsSync8(candidate1)) return candidate1;
|
|
37981
37786
|
const candidate2 = join10(
|
|
37982
37787
|
filePath,
|
|
37983
37788
|
"..",
|
|
@@ -38685,12 +38490,12 @@ var detect_drift_exports = {};
|
|
|
38685
38490
|
__export(detect_drift_exports, {
|
|
38686
38491
|
detectDriftCommand: () => detectDriftCommand
|
|
38687
38492
|
});
|
|
38688
|
-
import { existsSync as
|
|
38493
|
+
import { existsSync as existsSync9, readdirSync, readFileSync as readFileSync10 } from "node:fs";
|
|
38689
38494
|
import { dirname as dirname5, join as join11 } from "node:path";
|
|
38690
38495
|
function findProjectRoot() {
|
|
38691
38496
|
let currentDir = process.cwd();
|
|
38692
38497
|
while (currentDir !== "/") {
|
|
38693
|
-
if (
|
|
38498
|
+
if (existsSync9(join11(currentDir, "package.json"))) {
|
|
38694
38499
|
return currentDir;
|
|
38695
38500
|
}
|
|
38696
38501
|
const parent = dirname5(currentDir);
|
|
@@ -38714,7 +38519,7 @@ var init_detect_drift = __esm({
|
|
|
38714
38519
|
},
|
|
38715
38520
|
async run() {
|
|
38716
38521
|
const projectRoot = findProjectRoot();
|
|
38717
|
-
const isCleoRepo =
|
|
38522
|
+
const isCleoRepo = existsSync9(join11(projectRoot, "packages", "cleo", "src"));
|
|
38718
38523
|
const cleoSrcRoot = isCleoRepo ? join11(projectRoot, "packages", "cleo", "src") : join11(projectRoot, "src");
|
|
38719
38524
|
const safeRead = (filePath) => {
|
|
38720
38525
|
try {
|
|
@@ -38730,7 +38535,7 @@ var init_detect_drift = __esm({
|
|
|
38730
38535
|
recommendations: []
|
|
38731
38536
|
};
|
|
38732
38537
|
const injPath = join11(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
|
|
38733
|
-
if (
|
|
38538
|
+
if (existsSync9(injPath)) {
|
|
38734
38539
|
const content = safeRead(injPath);
|
|
38735
38540
|
userResult.checks.push({
|
|
38736
38541
|
name: "Agent injection",
|
|
@@ -38784,7 +38589,7 @@ var init_detect_drift = __esm({
|
|
|
38784
38589
|
const specPath = join11(projectRoot, "docs", "specs", "CLEO-OPERATION-CONSTITUTION.md");
|
|
38785
38590
|
const registryPath = join11(cleoSrcRoot, "dispatch", "registry.ts");
|
|
38786
38591
|
const dispatchDomainsDir = join11(cleoSrcRoot, "dispatch", "domains");
|
|
38787
|
-
if (!
|
|
38592
|
+
if (!existsSync9(specPath)) {
|
|
38788
38593
|
addCheck("Gateway-to-spec sync", "fail", "CLEO-OPERATION-CONSTITUTION.md missing", [
|
|
38789
38594
|
{
|
|
38790
38595
|
severity: "error",
|
|
@@ -38794,7 +38599,7 @@ var init_detect_drift = __esm({
|
|
|
38794
38599
|
recommendation: "Create docs/specs/CLEO-OPERATION-CONSTITUTION.md with canonical operation definitions"
|
|
38795
38600
|
}
|
|
38796
38601
|
]);
|
|
38797
|
-
} else if (!
|
|
38602
|
+
} else if (!existsSync9(registryPath) || !existsSync9(dispatchDomainsDir)) {
|
|
38798
38603
|
addCheck("Gateway-to-spec sync", "fail", "Dispatch registry or domains missing", [
|
|
38799
38604
|
{
|
|
38800
38605
|
severity: "error",
|
|
@@ -38854,7 +38659,7 @@ var init_detect_drift = __esm({
|
|
|
38854
38659
|
try {
|
|
38855
38660
|
const cliDir = join11(cleoSrcRoot, "cli", "commands");
|
|
38856
38661
|
const coreDir = isCleoRepo ? join11(projectRoot, "packages", "core", "src") : join11(projectRoot, "src", "core");
|
|
38857
|
-
if (!
|
|
38662
|
+
if (!existsSync9(cliDir)) {
|
|
38858
38663
|
addCheck("CLI-to-core sync", "fail", "CLI commands directory missing", [
|
|
38859
38664
|
{
|
|
38860
38665
|
severity: "error",
|
|
@@ -38863,7 +38668,7 @@ var init_detect_drift = __esm({
|
|
|
38863
38668
|
recommendation: "Verify TypeScript source structure is intact"
|
|
38864
38669
|
}
|
|
38865
38670
|
]);
|
|
38866
|
-
} else if (!
|
|
38671
|
+
} else if (!existsSync9(coreDir)) {
|
|
38867
38672
|
addCheck("CLI-to-core sync", "fail", "Core directory missing", [
|
|
38868
38673
|
{
|
|
38869
38674
|
severity: "error",
|
|
@@ -38881,7 +38686,7 @@ var init_detect_drift = __esm({
|
|
|
38881
38686
|
}
|
|
38882
38687
|
try {
|
|
38883
38688
|
const domainsDir = join11(cleoSrcRoot, "dispatch", "domains");
|
|
38884
|
-
if (!
|
|
38689
|
+
if (!existsSync9(domainsDir)) {
|
|
38885
38690
|
addCheck("Domain handler coverage", "fail", "Dispatch domains directory missing", [
|
|
38886
38691
|
{
|
|
38887
38692
|
severity: "error",
|
|
@@ -38899,7 +38704,7 @@ var init_detect_drift = __esm({
|
|
|
38899
38704
|
}
|
|
38900
38705
|
try {
|
|
38901
38706
|
const matrixPath = join11(cleoSrcRoot, "dispatch", "lib", "capability-matrix.ts");
|
|
38902
|
-
if (!
|
|
38707
|
+
if (!existsSync9(matrixPath)) {
|
|
38903
38708
|
addCheck("Capability matrix", "fail", "Capability matrix missing", [
|
|
38904
38709
|
{
|
|
38905
38710
|
severity: "error",
|
|
@@ -38916,7 +38721,7 @@ var init_detect_drift = __esm({
|
|
|
38916
38721
|
}
|
|
38917
38722
|
try {
|
|
38918
38723
|
const schemaPath = join11(projectRoot, "src", "store", "schema.ts");
|
|
38919
|
-
if (!
|
|
38724
|
+
if (!existsSync9(schemaPath)) {
|
|
38920
38725
|
addCheck("Schema validation", "fail", "Schema definition missing", [
|
|
38921
38726
|
{
|
|
38922
38727
|
severity: "error",
|
|
@@ -38953,7 +38758,7 @@ var init_detect_drift = __esm({
|
|
|
38953
38758
|
const visionPath = join11(projectRoot, "docs", "concepts", "CLEO-VISION.md");
|
|
38954
38759
|
const specPath = join11(projectRoot, "docs", "specs", "CLEO-PORTABLE-PROJECT-BRAIN-SPEC.md");
|
|
38955
38760
|
const issues = [];
|
|
38956
|
-
if (!
|
|
38761
|
+
if (!existsSync9(visionPath)) {
|
|
38957
38762
|
issues.push({
|
|
38958
38763
|
severity: "error",
|
|
38959
38764
|
category: "vision",
|
|
@@ -38962,7 +38767,7 @@ var init_detect_drift = __esm({
|
|
|
38962
38767
|
recommendation: "Create docs/concepts/CLEO-VISION.md with project vision"
|
|
38963
38768
|
});
|
|
38964
38769
|
}
|
|
38965
|
-
if (!
|
|
38770
|
+
if (!existsSync9(specPath)) {
|
|
38966
38771
|
issues.push({
|
|
38967
38772
|
severity: "error",
|
|
38968
38773
|
category: "spec",
|
|
@@ -39007,7 +38812,7 @@ var init_detect_drift = __esm({
|
|
|
39007
38812
|
}
|
|
39008
38813
|
try {
|
|
39009
38814
|
const injectionPath = join11(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
|
|
39010
|
-
if (!
|
|
38815
|
+
if (!existsSync9(injectionPath)) {
|
|
39011
38816
|
addCheck("Agent injection", "fail", "Agent injection template missing", [
|
|
39012
38817
|
{
|
|
39013
38818
|
severity: "error",
|
|
@@ -39037,7 +38842,7 @@ var init_detect_drift = __esm({
|
|
|
39037
38842
|
}
|
|
39038
38843
|
try {
|
|
39039
38844
|
const exitCodesPath = join11(cleoSrcRoot, "dispatch", "lib", "exit-codes.ts");
|
|
39040
|
-
if (!
|
|
38845
|
+
if (!existsSync9(exitCodesPath)) {
|
|
39041
38846
|
addCheck("Exit codes", "fail", "Exit codes definition missing", [
|
|
39042
38847
|
{
|
|
39043
38848
|
severity: "error",
|
|
@@ -39211,14 +39016,14 @@ __export(docs_exports, {
|
|
|
39211
39016
|
docsCommand: () => docsCommand
|
|
39212
39017
|
});
|
|
39213
39018
|
import { mkdir, readdir, readFile as readFile2, writeFile } from "node:fs/promises";
|
|
39214
|
-
import { dirname as dirname6, isAbsolute as isAbsolute2, join as join12, resolve as
|
|
39019
|
+
import { dirname as dirname6, isAbsolute as isAbsolute2, join as join12, resolve as resolve4 } from "node:path";
|
|
39215
39020
|
import {
|
|
39216
39021
|
buildDocsGraph,
|
|
39217
39022
|
CleoError as CleoError3,
|
|
39218
39023
|
exportDocument,
|
|
39219
39024
|
formatError as formatError5,
|
|
39220
39025
|
getAgentOutputsAbsolute,
|
|
39221
|
-
getProjectRoot as
|
|
39026
|
+
getProjectRoot as getProjectRoot21,
|
|
39222
39027
|
listDocVersions,
|
|
39223
39028
|
mergeDocs,
|
|
39224
39029
|
publishDocs,
|
|
@@ -39514,7 +39319,7 @@ var init_docs3 = __esm({
|
|
|
39514
39319
|
const taskId = String(args.task);
|
|
39515
39320
|
const includeAttachments = args["include-attachments"] !== false;
|
|
39516
39321
|
const includeMemoryRefs = args["include-memory-refs"] === true;
|
|
39517
|
-
const projectRoot =
|
|
39322
|
+
const projectRoot = getProjectRoot21();
|
|
39518
39323
|
try {
|
|
39519
39324
|
const result = await exportDocument({
|
|
39520
39325
|
taskId,
|
|
@@ -39524,7 +39329,7 @@ var init_docs3 = __esm({
|
|
|
39524
39329
|
});
|
|
39525
39330
|
let writtenPath;
|
|
39526
39331
|
if (typeof args.out === "string" && args.out.length > 0) {
|
|
39527
|
-
const outPath = isAbsolute2(args.out) ? args.out :
|
|
39332
|
+
const outPath = isAbsolute2(args.out) ? args.out : resolve4(projectRoot, args.out);
|
|
39528
39333
|
await mkdir(dirname6(outPath), { recursive: true });
|
|
39529
39334
|
await writeFile(outPath, result.markdown, "utf8");
|
|
39530
39335
|
writtenPath = outPath;
|
|
@@ -39577,7 +39382,7 @@ var init_docs3 = __esm({
|
|
|
39577
39382
|
}
|
|
39578
39383
|
},
|
|
39579
39384
|
async run({ args }) {
|
|
39580
|
-
const projectRoot =
|
|
39385
|
+
const projectRoot = getProjectRoot21();
|
|
39581
39386
|
try {
|
|
39582
39387
|
const result = await searchDocs2(String(args.query), {
|
|
39583
39388
|
ownerId: args.owner ?? void 0,
|
|
@@ -39629,7 +39434,7 @@ var init_docs3 = __esm({
|
|
|
39629
39434
|
}
|
|
39630
39435
|
},
|
|
39631
39436
|
async run({ args }) {
|
|
39632
|
-
const projectRoot =
|
|
39437
|
+
const projectRoot = getProjectRoot21();
|
|
39633
39438
|
const rawStrategy = args.strategy ?? "three-way";
|
|
39634
39439
|
const strategy = rawStrategy === "cherry-pick" || rawStrategy === "multi-diff" ? rawStrategy : "three-way";
|
|
39635
39440
|
try {
|
|
@@ -39638,7 +39443,7 @@ var init_docs3 = __esm({
|
|
|
39638
39443
|
base: args.base ?? void 0
|
|
39639
39444
|
});
|
|
39640
39445
|
if (typeof args.out === "string" && args.out.length > 0) {
|
|
39641
|
-
const outPath = isAbsolute2(args.out) ? args.out :
|
|
39446
|
+
const outPath = isAbsolute2(args.out) ? args.out : resolve4(projectRoot, args.out);
|
|
39642
39447
|
await mkdir(dirname6(outPath), { recursive: true });
|
|
39643
39448
|
await writeFile(outPath, result.merged, "utf8");
|
|
39644
39449
|
humanInfo(`Wrote merged content to ${outPath}`);
|
|
@@ -39679,7 +39484,7 @@ var init_docs3 = __esm({
|
|
|
39679
39484
|
}
|
|
39680
39485
|
},
|
|
39681
39486
|
async run({ args }) {
|
|
39682
|
-
const projectRoot =
|
|
39487
|
+
const projectRoot = getProjectRoot21();
|
|
39683
39488
|
const fmt = args.format ?? "mermaid";
|
|
39684
39489
|
try {
|
|
39685
39490
|
const result = await buildDocsGraph({ ownerId: String(args.for), projectRoot });
|
|
@@ -39709,7 +39514,7 @@ var init_docs3 = __esm({
|
|
|
39709
39514
|
output = lines.join("\n");
|
|
39710
39515
|
}
|
|
39711
39516
|
if (typeof args.out === "string" && args.out.length > 0) {
|
|
39712
|
-
const outPath = isAbsolute2(args.out) ? args.out :
|
|
39517
|
+
const outPath = isAbsolute2(args.out) ? args.out : resolve4(projectRoot, args.out);
|
|
39713
39518
|
await mkdir(dirname6(outPath), { recursive: true });
|
|
39714
39519
|
await writeFile(outPath, output, "utf8");
|
|
39715
39520
|
humanInfo(`Wrote graph to ${outPath}`);
|
|
@@ -39749,7 +39554,7 @@ var init_docs3 = __esm({
|
|
|
39749
39554
|
}
|
|
39750
39555
|
},
|
|
39751
39556
|
async run({ args }) {
|
|
39752
|
-
const projectRoot =
|
|
39557
|
+
const projectRoot = getProjectRoot21();
|
|
39753
39558
|
try {
|
|
39754
39559
|
const result = await rankDocs({
|
|
39755
39560
|
ownerId: String(args.for),
|
|
@@ -39788,7 +39593,7 @@ var init_docs3 = __esm({
|
|
|
39788
39593
|
}
|
|
39789
39594
|
},
|
|
39790
39595
|
async run({ args }) {
|
|
39791
|
-
const projectRoot =
|
|
39596
|
+
const projectRoot = getProjectRoot21();
|
|
39792
39597
|
try {
|
|
39793
39598
|
const result = await listDocVersions({
|
|
39794
39599
|
ownerId: String(args.for),
|
|
@@ -39832,7 +39637,7 @@ var init_docs3 = __esm({
|
|
|
39832
39637
|
}
|
|
39833
39638
|
},
|
|
39834
39639
|
async run({ args }) {
|
|
39835
|
-
const projectRoot =
|
|
39640
|
+
const projectRoot = getProjectRoot21();
|
|
39836
39641
|
try {
|
|
39837
39642
|
const result = await publishDocs({
|
|
39838
39643
|
ownerId: String(args.for),
|
|
@@ -40235,9 +40040,9 @@ __export(migrate_agents_v2_exports, {
|
|
|
40235
40040
|
walkAgentsDir: () => walkAgentsDir
|
|
40236
40041
|
});
|
|
40237
40042
|
import { createHash as createHash2 } from "node:crypto";
|
|
40238
|
-
import { appendFileSync as appendFileSync2, existsSync as
|
|
40043
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync10, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync11 } from "node:fs";
|
|
40239
40044
|
import { join as join13 } from "node:path";
|
|
40240
|
-
import { getProjectRoot as
|
|
40045
|
+
import { getProjectRoot as getProjectRoot22, installAgentFromCant } from "@cleocode/core/internal";
|
|
40241
40046
|
import { openCleoDb } from "@cleocode/core/store/open-cleo-db";
|
|
40242
40047
|
function sha256Hex(bytes) {
|
|
40243
40048
|
return createHash2("sha256").update(bytes).digest("hex");
|
|
@@ -40258,13 +40063,13 @@ function extractAgentName(source) {
|
|
|
40258
40063
|
function appendAuditLog(projectRoot, entry) {
|
|
40259
40064
|
const auditPath = join13(projectRoot, AUDIT_LOG_RELATIVE);
|
|
40260
40065
|
const auditDir = join13(auditPath, "..");
|
|
40261
|
-
if (!
|
|
40066
|
+
if (!existsSync10(auditDir)) {
|
|
40262
40067
|
mkdirSync3(auditDir, { recursive: true });
|
|
40263
40068
|
}
|
|
40264
40069
|
appendFileSync2(auditPath, JSON.stringify(entry) + "\n", "utf8");
|
|
40265
40070
|
}
|
|
40266
40071
|
function walkAgentsDir(db, scanDir, projectRoot, summary, verbose) {
|
|
40267
|
-
if (!
|
|
40072
|
+
if (!existsSync10(scanDir)) return;
|
|
40268
40073
|
let files;
|
|
40269
40074
|
try {
|
|
40270
40075
|
files = readdirSync2(scanDir).filter((f) => f.endsWith(".cant"));
|
|
@@ -40383,7 +40188,7 @@ async function runMigrateAgentsV2(projectRoot, verbose = true) {
|
|
|
40383
40188
|
}
|
|
40384
40189
|
function readMigrationConflicts(projectRoot) {
|
|
40385
40190
|
const auditPath = join13(projectRoot, AUDIT_LOG_RELATIVE);
|
|
40386
|
-
if (!
|
|
40191
|
+
if (!existsSync10(auditPath)) return [];
|
|
40387
40192
|
let raw;
|
|
40388
40193
|
try {
|
|
40389
40194
|
raw = readFileSync11(auditPath, "utf8");
|
|
@@ -40424,7 +40229,7 @@ var init_migrate_agents_v2 = __esm({
|
|
|
40424
40229
|
}
|
|
40425
40230
|
},
|
|
40426
40231
|
async run({ args }) {
|
|
40427
|
-
const projectRoot =
|
|
40232
|
+
const projectRoot = getProjectRoot22();
|
|
40428
40233
|
const verbose = args.quiet !== true;
|
|
40429
40234
|
if (verbose) {
|
|
40430
40235
|
humanInfo("Scanning .cleo/cant/agents/ and .cleo/agents/ for unregistered agents...");
|
|
@@ -40468,7 +40273,7 @@ __export(doctor_exports, {
|
|
|
40468
40273
|
});
|
|
40469
40274
|
import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
40470
40275
|
import { join as join14 } from "node:path";
|
|
40471
|
-
import { getProjectRoot as
|
|
40276
|
+
import { getProjectRoot as getProjectRoot23, quarantineRogueCleoDir, scanRogueCleoDirs } from "@cleocode/core/internal";
|
|
40472
40277
|
async function scanTestFixturesInProd(projectRoot) {
|
|
40473
40278
|
const { getDb: getDb3, getNativeDb } = await import("@cleocode/core/internal");
|
|
40474
40279
|
await getDb3(projectRoot);
|
|
@@ -40690,7 +40495,7 @@ var init_doctor = __esm({
|
|
|
40690
40495
|
try {
|
|
40691
40496
|
if (args.brain) {
|
|
40692
40497
|
const { computeBrainHealthDashboard } = await import("@cleocode/core/internal");
|
|
40693
|
-
const projectRoot =
|
|
40498
|
+
const projectRoot = getProjectRoot23();
|
|
40694
40499
|
const dashboard = await computeBrainHealthDashboard(projectRoot);
|
|
40695
40500
|
cliOutput(dashboard, { command: "doctor", operation: "doctor.brain" });
|
|
40696
40501
|
if (dashboard.hasP0Failure) {
|
|
@@ -40699,7 +40504,7 @@ var init_doctor = __esm({
|
|
|
40699
40504
|
return;
|
|
40700
40505
|
}
|
|
40701
40506
|
if (args["scan-test-fixtures-in-prod"]) {
|
|
40702
|
-
const projectRoot =
|
|
40507
|
+
const projectRoot = getProjectRoot23();
|
|
40703
40508
|
const matches = await scanTestFixturesInProd(projectRoot);
|
|
40704
40509
|
const dryRun = args["dry-run"] !== false && args.quarantine !== true;
|
|
40705
40510
|
const quarantined = !dryRun && matches.length > 0 ? await quarantineTestFixtures(projectRoot, matches) : void 0;
|
|
@@ -40787,7 +40592,7 @@ var init_doctor = __esm({
|
|
|
40787
40592
|
progress.complete("Comprehensive diagnostics complete");
|
|
40788
40593
|
} else if (args["scan-rogue-cleo-dirs"]) {
|
|
40789
40594
|
progress.step(0, "Scanning for rogue .cleo/ directories");
|
|
40790
|
-
const projectRoot =
|
|
40595
|
+
const projectRoot = getProjectRoot23();
|
|
40791
40596
|
const reports = scanRogueCleoDirs(projectRoot);
|
|
40792
40597
|
progress.complete(
|
|
40793
40598
|
`Found ${reports.length} rogue .cleo/ director${reports.length === 1 ? "y" : "ies"}`
|
|
@@ -40796,7 +40601,7 @@ var init_doctor = __esm({
|
|
|
40796
40601
|
} else if (args["quarantine-rogue-cleo-dirs"]) {
|
|
40797
40602
|
const isDryRun = args["dry-run"] === true;
|
|
40798
40603
|
progress.step(0, `${isDryRun ? "[DRY RUN] " : ""}Scanning for rogue .cleo/ directories`);
|
|
40799
|
-
const projectRoot =
|
|
40604
|
+
const projectRoot = getProjectRoot23();
|
|
40800
40605
|
const reports = scanRogueCleoDirs(projectRoot);
|
|
40801
40606
|
if (reports.length === 0) {
|
|
40802
40607
|
progress.complete("No rogue .cleo/ directories found \u2014 nothing to quarantine");
|
|
@@ -40850,7 +40655,7 @@ var init_doctor = __esm({
|
|
|
40850
40655
|
const { detectAndRemoveLegacyGlobalFiles, detectAndRemoveStrayProjectNexus } = await import("@cleocode/core/internal");
|
|
40851
40656
|
const { getCleoHome: getCleoHome3 } = await import("@cleocode/core/internal");
|
|
40852
40657
|
const cleoHome = getCleoHome3();
|
|
40853
|
-
const projectRoot =
|
|
40658
|
+
const projectRoot = getProjectRoot23();
|
|
40854
40659
|
const legacyResult = detectAndRemoveLegacyGlobalFiles(cleoHome);
|
|
40855
40660
|
const strayResult = detectAndRemoveStrayProjectNexus(projectRoot);
|
|
40856
40661
|
const isDryRun = args["dry-run"] === true;
|
|
@@ -40899,7 +40704,7 @@ var init_doctor = __esm({
|
|
|
40899
40704
|
{ command: "doctor", operation: "admin.health" }
|
|
40900
40705
|
);
|
|
40901
40706
|
try {
|
|
40902
|
-
const projectRoot =
|
|
40707
|
+
const projectRoot = getProjectRoot23();
|
|
40903
40708
|
const conflicts = readMigrationConflicts(projectRoot);
|
|
40904
40709
|
if (conflicts.length > 0) {
|
|
40905
40710
|
progress.complete(
|
|
@@ -41842,9 +41647,9 @@ __export(generate_changelog_exports, {
|
|
|
41842
41647
|
generateChangelogCommand: () => generateChangelogCommand
|
|
41843
41648
|
});
|
|
41844
41649
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
41845
|
-
import { existsSync as
|
|
41650
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync5, readFileSync as readFileSync12, writeFileSync as writeFileSync4 } from "node:fs";
|
|
41846
41651
|
import { dirname as dirname7, join as join17 } from "node:path";
|
|
41847
|
-
import { CleoError as CleoError4, formatError as formatError6, getConfigPath, getProjectRoot as
|
|
41652
|
+
import { CleoError as CleoError4, formatError as formatError6, getConfigPath, getProjectRoot as getProjectRoot24 } from "@cleocode/core";
|
|
41848
41653
|
function getChangelogSource(cwd) {
|
|
41849
41654
|
const configPath = getConfigPath(cwd);
|
|
41850
41655
|
try {
|
|
@@ -41875,7 +41680,7 @@ function getDefaultOutputPath(platform) {
|
|
|
41875
41680
|
}
|
|
41876
41681
|
}
|
|
41877
41682
|
function getGitHubRepoSlug(cwd) {
|
|
41878
|
-
const projectRoot =
|
|
41683
|
+
const projectRoot = getProjectRoot24(cwd);
|
|
41879
41684
|
try {
|
|
41880
41685
|
const remoteUrl = execFileSync2("git", ["remote", "get-url", "origin"], {
|
|
41881
41686
|
cwd: projectRoot,
|
|
@@ -42008,8 +41813,8 @@ var init_generate_changelog = __esm({
|
|
|
42008
41813
|
const targetPlatform = args.platform;
|
|
42009
41814
|
const dryRun = args["dry-run"] === true;
|
|
42010
41815
|
const sourceFile = getChangelogSource();
|
|
42011
|
-
const sourcePath = join17(
|
|
42012
|
-
if (!
|
|
41816
|
+
const sourcePath = join17(getProjectRoot24(), sourceFile);
|
|
41817
|
+
if (!existsSync11(sourcePath)) {
|
|
42013
41818
|
throw new CleoError4(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
|
|
42014
41819
|
}
|
|
42015
41820
|
const sourceContent = readFileSync12(sourcePath, "utf-8");
|
|
@@ -42021,7 +41826,7 @@ var init_generate_changelog = __esm({
|
|
|
42021
41826
|
const outputPath = platformConfig?.path ?? getDefaultOutputPath(targetPlatform);
|
|
42022
41827
|
const content = generateForPlatform(targetPlatform, sourceContent, repoSlug, limit);
|
|
42023
41828
|
if (!dryRun) {
|
|
42024
|
-
const fullPath = join17(
|
|
41829
|
+
const fullPath = join17(getProjectRoot24(), outputPath);
|
|
42025
41830
|
mkdirSync5(dirname7(fullPath), { recursive: true });
|
|
42026
41831
|
writeFileSync4(fullPath, content, "utf-8");
|
|
42027
41832
|
}
|
|
@@ -42042,7 +41847,7 @@ var init_generate_changelog = __esm({
|
|
|
42042
41847
|
limit
|
|
42043
41848
|
);
|
|
42044
41849
|
if (!dryRun) {
|
|
42045
|
-
const fullPath = join17(
|
|
41850
|
+
const fullPath = join17(getProjectRoot24(), platformConfig.path);
|
|
42046
41851
|
mkdirSync5(dirname7(fullPath), { recursive: true });
|
|
42047
41852
|
writeFileSync4(fullPath, content, "utf-8");
|
|
42048
41853
|
}
|
|
@@ -43181,7 +42986,7 @@ __export(init_exports, {
|
|
|
43181
42986
|
getGitignoreTemplate: () => getGitignoreTemplate,
|
|
43182
42987
|
initCommand: () => initCommand2
|
|
43183
42988
|
});
|
|
43184
|
-
import { existsSync as
|
|
42989
|
+
import { existsSync as existsSync12, readFileSync as readFileSync13 } from "node:fs";
|
|
43185
42990
|
import { join as join18 } from "node:path";
|
|
43186
42991
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
43187
42992
|
import { CleoError as CleoError5, formatError as formatError7, initProject as initProject2 } from "@cleocode/core";
|
|
@@ -43191,8 +42996,8 @@ function getGitignoreTemplate() {
|
|
|
43191
42996
|
const packageRoot = join18(thisFile, "..", "..", "..", "..");
|
|
43192
42997
|
const localTemplatePath = join18(packageRoot, "templates", "cleo-gitignore");
|
|
43193
42998
|
const monorepoTemplatePath = join18(packageRoot, "..", "..", "templates", "cleo-gitignore");
|
|
43194
|
-
const templatePath =
|
|
43195
|
-
if (
|
|
42999
|
+
const templatePath = existsSync12(localTemplatePath) ? localTemplatePath : monorepoTemplatePath;
|
|
43000
|
+
if (existsSync12(templatePath)) {
|
|
43196
43001
|
return readFileSync13(templatePath, "utf-8");
|
|
43197
43002
|
}
|
|
43198
43003
|
} catch {
|
|
@@ -44079,7 +43884,7 @@ var llm_cost_exports = {};
|
|
|
44079
43884
|
__export(llm_cost_exports, {
|
|
44080
43885
|
costCommand: () => costCommand
|
|
44081
43886
|
});
|
|
44082
|
-
import { getProjectRoot as
|
|
43887
|
+
import { getProjectRoot as getProjectRoot25 } from "@cleocode/core/internal";
|
|
44083
43888
|
import { computeCost } from "@cleocode/core/llm/usage-pricing";
|
|
44084
43889
|
function resolveSessionId(raw) {
|
|
44085
43890
|
if (raw === "current") {
|
|
@@ -44152,7 +43957,7 @@ var init_llm_cost = __esm({
|
|
|
44152
43957
|
process.exit(6);
|
|
44153
43958
|
}
|
|
44154
43959
|
const sessionId = resolveSessionId(rawSessionId);
|
|
44155
|
-
const projectRoot =
|
|
43960
|
+
const projectRoot = getProjectRoot25(process.cwd());
|
|
44156
43961
|
let breakdown;
|
|
44157
43962
|
try {
|
|
44158
43963
|
breakdown = await loadSessionCostBreakdown(projectRoot, sessionId);
|
|
@@ -44315,7 +44120,7 @@ async function _headlessPkceFlow(provider, authUrl) {
|
|
|
44315
44120
|
` After approving, paste the full redirect URL (http://localhost?code=\u2026&state=\u2026):
|
|
44316
44121
|
`
|
|
44317
44122
|
);
|
|
44318
|
-
return new Promise((
|
|
44123
|
+
return new Promise((resolve5, reject) => {
|
|
44319
44124
|
let buf = "";
|
|
44320
44125
|
process.stdin.setEncoding("utf8");
|
|
44321
44126
|
process.stdin.once("data", (chunk) => {
|
|
@@ -44327,7 +44132,7 @@ async function _headlessPkceFlow(provider, authUrl) {
|
|
|
44327
44132
|
reject(new Error('Redirect URL is missing the "code" parameter'));
|
|
44328
44133
|
return;
|
|
44329
44134
|
}
|
|
44330
|
-
|
|
44135
|
+
resolve5(code);
|
|
44331
44136
|
} catch {
|
|
44332
44137
|
reject(new Error(`Invalid redirect URL: ${buf}`));
|
|
44333
44138
|
}
|
|
@@ -44335,7 +44140,7 @@ async function _headlessPkceFlow(provider, authUrl) {
|
|
|
44335
44140
|
});
|
|
44336
44141
|
}
|
|
44337
44142
|
async function _localCallbackPkceFlow(provider, authUrl, expectedState, port) {
|
|
44338
|
-
return new Promise((
|
|
44143
|
+
return new Promise((resolve5) => {
|
|
44339
44144
|
const server = createServer((req, res) => {
|
|
44340
44145
|
const url = new URL(req.url ?? "/", `http://localhost:${port}`);
|
|
44341
44146
|
const code = url.searchParams.get("code");
|
|
@@ -44345,7 +44150,7 @@ async function _localCallbackPkceFlow(provider, authUrl, expectedState, port) {
|
|
|
44345
44150
|
if (error) {
|
|
44346
44151
|
res.end(`<h1>Authorization failed</h1><p>${error}</p><p>You may close this tab.</p>`);
|
|
44347
44152
|
server.close();
|
|
44348
|
-
|
|
44153
|
+
resolve5({
|
|
44349
44154
|
error: {
|
|
44350
44155
|
code: "E_PKCE_AUTH_DENIED",
|
|
44351
44156
|
codeName: "E_PKCE_AUTH_DENIED",
|
|
@@ -44357,7 +44162,7 @@ async function _localCallbackPkceFlow(provider, authUrl, expectedState, port) {
|
|
|
44357
44162
|
if (!code || state !== expectedState) {
|
|
44358
44163
|
res.end("<h1>Invalid callback</h1><p>You may close this tab.</p>");
|
|
44359
44164
|
server.close();
|
|
44360
|
-
|
|
44165
|
+
resolve5({
|
|
44361
44166
|
error: {
|
|
44362
44167
|
code: "E_PKCE_INVALID_CALLBACK",
|
|
44363
44168
|
codeName: "E_PKCE_INVALID_CALLBACK",
|
|
@@ -44368,7 +44173,7 @@ async function _localCallbackPkceFlow(provider, authUrl, expectedState, port) {
|
|
|
44368
44173
|
}
|
|
44369
44174
|
res.end("<h1>Authorized</h1><p>You may close this tab and return to your terminal.</p>");
|
|
44370
44175
|
server.close();
|
|
44371
|
-
|
|
44176
|
+
resolve5({ code });
|
|
44372
44177
|
});
|
|
44373
44178
|
server.listen(port, "localhost", () => {
|
|
44374
44179
|
process.stderr.write("\n");
|
|
@@ -44501,7 +44306,7 @@ function _generateState() {
|
|
|
44501
44306
|
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
44502
44307
|
}
|
|
44503
44308
|
function _findFreePort() {
|
|
44504
|
-
return new Promise((
|
|
44309
|
+
return new Promise((resolve5, reject) => {
|
|
44505
44310
|
const srv = createServer();
|
|
44506
44311
|
srv.listen(0, "localhost", () => {
|
|
44507
44312
|
const addr = srv.address();
|
|
@@ -44511,7 +44316,7 @@ function _findFreePort() {
|
|
|
44511
44316
|
return;
|
|
44512
44317
|
}
|
|
44513
44318
|
const port = addr.port;
|
|
44514
|
-
srv.close(() =>
|
|
44319
|
+
srv.close(() => resolve5(port));
|
|
44515
44320
|
});
|
|
44516
44321
|
srv.on("error", reject);
|
|
44517
44322
|
});
|
|
@@ -44978,14 +44783,14 @@ async function readStdin() {
|
|
|
44978
44783
|
if (process.stdin.isTTY) {
|
|
44979
44784
|
return "";
|
|
44980
44785
|
}
|
|
44981
|
-
return new Promise((
|
|
44786
|
+
return new Promise((resolve5, reject) => {
|
|
44982
44787
|
let data = "";
|
|
44983
44788
|
process.stdin.setEncoding("utf-8");
|
|
44984
44789
|
process.stdin.on("data", (chunk) => {
|
|
44985
44790
|
data += chunk;
|
|
44986
44791
|
});
|
|
44987
44792
|
process.stdin.on("end", () => {
|
|
44988
|
-
|
|
44793
|
+
resolve5(data.trim());
|
|
44989
44794
|
});
|
|
44990
44795
|
process.stdin.on("error", reject);
|
|
44991
44796
|
});
|
|
@@ -45337,14 +45142,14 @@ __export(memory_exports, {
|
|
|
45337
45142
|
memoryCommand: () => memoryCommand
|
|
45338
45143
|
});
|
|
45339
45144
|
import { createHash as createHash3 } from "node:crypto";
|
|
45340
|
-
import { existsSync as
|
|
45145
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync6, readdirSync as readdirSync3, readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "node:fs";
|
|
45341
45146
|
import { homedir as homedir6 } from "node:os";
|
|
45342
45147
|
import { join as join19 } from "node:path";
|
|
45343
45148
|
import {
|
|
45344
45149
|
getBrainDb as getBrainDb2,
|
|
45345
45150
|
getBrainNativeDb as getBrainNativeDb3,
|
|
45346
45151
|
getDreamStatus,
|
|
45347
|
-
getProjectRoot as
|
|
45152
|
+
getProjectRoot as getProjectRoot26,
|
|
45348
45153
|
runConsolidation,
|
|
45349
45154
|
triggerManualDream
|
|
45350
45155
|
} from "@cleocode/core/internal";
|
|
@@ -45380,7 +45185,7 @@ ${body}`).digest("hex").slice(0, 16);
|
|
|
45380
45185
|
}
|
|
45381
45186
|
function loadImportHashes(stateFile) {
|
|
45382
45187
|
try {
|
|
45383
|
-
if (!
|
|
45188
|
+
if (!existsSync13(stateFile)) return /* @__PURE__ */ new Set();
|
|
45384
45189
|
const raw = readFileSync14(stateFile, "utf-8");
|
|
45385
45190
|
const parsed = JSON.parse(raw);
|
|
45386
45191
|
return new Set(parsed.hashes);
|
|
@@ -45390,7 +45195,7 @@ function loadImportHashes(stateFile) {
|
|
|
45390
45195
|
}
|
|
45391
45196
|
function saveImportHashes(stateFile, hashes) {
|
|
45392
45197
|
const dir = stateFile.slice(0, stateFile.lastIndexOf("/"));
|
|
45393
|
-
if (!
|
|
45198
|
+
if (!existsSync13(dir)) mkdirSync6(dir, { recursive: true });
|
|
45394
45199
|
writeFileSync5(stateFile, JSON.stringify({ hashes: [...hashes] }, null, 2), "utf-8");
|
|
45395
45200
|
}
|
|
45396
45201
|
function makeMemorySubcommand(opts) {
|
|
@@ -45410,7 +45215,7 @@ function makeMemorySubcommand(opts) {
|
|
|
45410
45215
|
}
|
|
45411
45216
|
});
|
|
45412
45217
|
}
|
|
45413
|
-
var storeCommand, findCommand5, statsCommand4, observeCommand, timelineCommand, fetchCommand2, decisionFindCommand, decisionStoreCommand, linkCommand, traceCommand, relatedCommand, contextCommand3, graphStatsCommand, graphShowCommand, graphNeighborsCommand, graphAddCommand, graphRemoveCommand, reasonWhyCommand, reasonSimilarCommand, searchHybridCommand, codeLinksCommand, codeAutoLinkCommand, codeMemoriesForCodeCommand, codeForMemoryCommand, consolidateCommand, dreamCommand, reflectCommand, dedupScanCommand, importCommand3, doctorCommand3, llmStatusCommand, verifyCommand, pendingVerifyCommand, tierStatsCommand, tierPromoteCommand, tierDemoteCommand, precompactFlushCommand, backfillRunCommand, backfillApproveCommand, backfillRollbackCommand,
|
|
45218
|
+
var storeCommand, findCommand5, statsCommand4, observeCommand, timelineCommand, fetchCommand2, decisionFindCommand, decisionStoreCommand, linkCommand, traceCommand, relatedCommand, contextCommand3, graphStatsCommand, graphShowCommand, graphNeighborsCommand, graphAddCommand, graphRemoveCommand, reasonWhyCommand, reasonSimilarCommand, searchHybridCommand, codeLinksCommand, codeAutoLinkCommand, codeMemoriesForCodeCommand, codeForMemoryCommand, consolidateCommand, dreamCommand, reflectCommand, dedupScanCommand, importCommand3, doctorCommand3, llmStatusCommand, verifyCommand, pendingVerifyCommand, tierStatsCommand, tierPromoteCommand, tierDemoteCommand, precompactFlushCommand, backfillRunCommand, backfillApproveCommand, backfillRollbackCommand, backfillCommand, digestCommand, recentCommand, diaryReadCommand, diaryWriteCommand, diaryCommand, watchCommand2, tierCommand, sweepCommand, memoryCommand;
|
|
45414
45219
|
var init_memory3 = __esm({
|
|
45415
45220
|
"packages/cleo/src/cli/commands/memory.ts"() {
|
|
45416
45221
|
"use strict";
|
|
@@ -46305,7 +46110,7 @@ var init_memory3 = __esm({
|
|
|
46305
46110
|
},
|
|
46306
46111
|
args: {},
|
|
46307
46112
|
async run() {
|
|
46308
|
-
const root =
|
|
46113
|
+
const root = getProjectRoot26();
|
|
46309
46114
|
try {
|
|
46310
46115
|
const result = await runConsolidation(root);
|
|
46311
46116
|
cliOutput(result, { command: "memory-consolidate", operation: "memory.consolidate" });
|
|
@@ -46329,7 +46134,7 @@ var init_memory3 = __esm({
|
|
|
46329
46134
|
}
|
|
46330
46135
|
},
|
|
46331
46136
|
async run({ args }) {
|
|
46332
|
-
const root =
|
|
46137
|
+
const root = getProjectRoot26();
|
|
46333
46138
|
if (args.status) {
|
|
46334
46139
|
try {
|
|
46335
46140
|
const status = await getDreamStatus(root);
|
|
@@ -46366,7 +46171,7 @@ var init_memory3 = __esm({
|
|
|
46366
46171
|
}
|
|
46367
46172
|
},
|
|
46368
46173
|
async run({ args }) {
|
|
46369
|
-
const root =
|
|
46174
|
+
const root = getProjectRoot26();
|
|
46370
46175
|
try {
|
|
46371
46176
|
const { runObserver, runReflector } = await import("@cleocode/core/internal");
|
|
46372
46177
|
const observerResult = await runObserver(root, args.session, {
|
|
@@ -46406,7 +46211,7 @@ var init_memory3 = __esm({
|
|
|
46406
46211
|
}
|
|
46407
46212
|
},
|
|
46408
46213
|
async run({ args }) {
|
|
46409
|
-
const root =
|
|
46214
|
+
const root = getProjectRoot26();
|
|
46410
46215
|
try {
|
|
46411
46216
|
const { getBrainDb: getBrainDbInner, getBrainNativeDb: getBrainNativeDbInner } = await import("@cleocode/core/internal");
|
|
46412
46217
|
await getBrainDbInner(root);
|
|
@@ -46504,9 +46309,9 @@ var init_memory3 = __esm({
|
|
|
46504
46309
|
async run({ args }) {
|
|
46505
46310
|
const sourceDir = args.from ?? join19(homedir6(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
|
|
46506
46311
|
const isDryRun = !!args["dry-run"];
|
|
46507
|
-
const projectRoot =
|
|
46312
|
+
const projectRoot = getProjectRoot26();
|
|
46508
46313
|
const stateFile = join19(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
|
|
46509
|
-
if (!
|
|
46314
|
+
if (!existsSync13(sourceDir)) {
|
|
46510
46315
|
cliError(`Source directory not found: ${sourceDir}`, "E_NOT_FOUND", { name: "E_NOT_FOUND" });
|
|
46511
46316
|
process.exit(1);
|
|
46512
46317
|
return;
|
|
@@ -46717,7 +46522,7 @@ var init_memory3 = __esm({
|
|
|
46717
46522
|
},
|
|
46718
46523
|
args: {},
|
|
46719
46524
|
async run() {
|
|
46720
|
-
const root =
|
|
46525
|
+
const root = getProjectRoot26();
|
|
46721
46526
|
try {
|
|
46722
46527
|
await getBrainDb2(root);
|
|
46723
46528
|
const nativeDb = getBrainNativeDb3();
|
|
@@ -46816,7 +46621,7 @@ var init_memory3 = __esm({
|
|
|
46816
46621
|
}
|
|
46817
46622
|
},
|
|
46818
46623
|
async run({ args }) {
|
|
46819
|
-
const root =
|
|
46624
|
+
const root = getProjectRoot26();
|
|
46820
46625
|
const targetTier = args.to;
|
|
46821
46626
|
const reason = args.reason;
|
|
46822
46627
|
const validTiers = ["medium", "long"];
|
|
@@ -46920,7 +46725,7 @@ var init_memory3 = __esm({
|
|
|
46920
46725
|
}
|
|
46921
46726
|
},
|
|
46922
46727
|
async run({ args }) {
|
|
46923
|
-
const root =
|
|
46728
|
+
const root = getProjectRoot26();
|
|
46924
46729
|
const targetTier = args.to;
|
|
46925
46730
|
const reason = args.reason;
|
|
46926
46731
|
const validTiers = ["short", "medium"];
|
|
@@ -47079,7 +46884,7 @@ var init_memory3 = __esm({
|
|
|
47079
46884
|
runId: args["runId"]
|
|
47080
46885
|
})
|
|
47081
46886
|
});
|
|
47082
|
-
|
|
46887
|
+
backfillCommand = defineCommand({
|
|
47083
46888
|
meta: {
|
|
47084
46889
|
name: "backfill",
|
|
47085
46890
|
description: "Staged brain-graph backfill operations: run, approve, rollback (T1003)."
|
|
@@ -47307,8 +47112,8 @@ data: ${JSON.stringify(event)}
|
|
|
47307
47112
|
cursor = data.nextCursor;
|
|
47308
47113
|
}
|
|
47309
47114
|
if (!running) break;
|
|
47310
|
-
await new Promise((
|
|
47311
|
-
const timer = setTimeout(
|
|
47115
|
+
await new Promise((resolve5) => {
|
|
47116
|
+
const timer = setTimeout(resolve5, intervalMs);
|
|
47312
47117
|
timer.unref?.();
|
|
47313
47118
|
});
|
|
47314
47119
|
}
|
|
@@ -47412,7 +47217,7 @@ data: ${JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString() })}
|
|
|
47412
47217
|
tier: tierCommand,
|
|
47413
47218
|
// T1013 — new memory subcommands
|
|
47414
47219
|
"precompact-flush": precompactFlushCommand,
|
|
47415
|
-
backfill:
|
|
47220
|
+
backfill: backfillCommand,
|
|
47416
47221
|
digest: digestCommand,
|
|
47417
47222
|
recent: recentCommand,
|
|
47418
47223
|
diary: diaryCommand,
|
|
@@ -47434,7 +47239,7 @@ var migrate_claude_mem_exports = {};
|
|
|
47434
47239
|
__export(migrate_claude_mem_exports, {
|
|
47435
47240
|
migrateClaudeMemCommand: () => migrateClaudeMemCommand
|
|
47436
47241
|
});
|
|
47437
|
-
import { getProjectRoot as
|
|
47242
|
+
import { getProjectRoot as getProjectRoot27, migrateClaudeMem } from "@cleocode/core/internal";
|
|
47438
47243
|
import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
|
|
47439
47244
|
import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
|
|
47440
47245
|
var storageCommand, claudeMemCommand, manifestIngestCommand, migrateClaudeMemCommand;
|
|
@@ -47497,7 +47302,7 @@ var init_migrate_claude_mem = __esm({
|
|
|
47497
47302
|
}
|
|
47498
47303
|
},
|
|
47499
47304
|
async run({ args }) {
|
|
47500
|
-
const root =
|
|
47305
|
+
const root = getProjectRoot27();
|
|
47501
47306
|
try {
|
|
47502
47307
|
const result = await migrateClaudeMem(root, {
|
|
47503
47308
|
sourcePath: args.source,
|
|
@@ -47546,7 +47351,7 @@ var init_migrate_claude_mem = __esm({
|
|
|
47546
47351
|
}
|
|
47547
47352
|
},
|
|
47548
47353
|
async run({ args }) {
|
|
47549
|
-
const projectRoot =
|
|
47354
|
+
const projectRoot = getProjectRoot27();
|
|
47550
47355
|
try {
|
|
47551
47356
|
const db = await getDb2(projectRoot);
|
|
47552
47357
|
const rcasdFlag = Boolean(args.rcasd);
|
|
@@ -48491,7 +48296,7 @@ var init_nexus4 = __esm({
|
|
|
48491
48296
|
const repoPath = args.path ? path4.resolve(args.path) : process.cwd();
|
|
48492
48297
|
humanInfo(`[nexus] Analyzing: ${repoPath}${isIncremental ? " (incremental)" : ""}`);
|
|
48493
48298
|
try {
|
|
48494
|
-
const [{ getNexusDb, nexusSchema }, { runPipeline }, { getProjectRoot:
|
|
48299
|
+
const [{ getNexusDb, nexusSchema }, { runPipeline }, { getProjectRoot: getProjectRoot33 }, { eq: eq2 }] = await Promise.all([
|
|
48495
48300
|
import("@cleocode/core/store/nexus-sqlite"),
|
|
48496
48301
|
import("@cleocode/nexus/pipeline"),
|
|
48497
48302
|
import("@cleocode/core/internal"),
|
|
@@ -48571,7 +48376,7 @@ var init_nexus4 = __esm({
|
|
|
48571
48376
|
extensions: { duration_ms: durationMs }
|
|
48572
48377
|
}
|
|
48573
48378
|
);
|
|
48574
|
-
void
|
|
48379
|
+
void getProjectRoot33;
|
|
48575
48380
|
} catch (err) {
|
|
48576
48381
|
const msg = err instanceof Error ? err.message : String(err);
|
|
48577
48382
|
cliError(
|
|
@@ -48889,13 +48694,13 @@ var init_nexus4 = __esm({
|
|
|
48889
48694
|
if (!skipPrompt) {
|
|
48890
48695
|
const { createInterface: createInterface2 } = await import("node:readline");
|
|
48891
48696
|
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
48892
|
-
const confirmed = await new Promise((
|
|
48697
|
+
const confirmed = await new Promise((resolve5) => {
|
|
48893
48698
|
rl.question(
|
|
48894
48699
|
`
|
|
48895
48700
|
[nexus] Delete ${matchCount} project(s) from the registry? [y/N] `,
|
|
48896
48701
|
(answer) => {
|
|
48897
48702
|
rl.close();
|
|
48898
|
-
|
|
48703
|
+
resolve5(answer.trim().toLowerCase() === "y");
|
|
48899
48704
|
}
|
|
48900
48705
|
);
|
|
48901
48706
|
});
|
|
@@ -52173,7 +51978,7 @@ var refresh_memory_exports = {};
|
|
|
52173
51978
|
__export(refresh_memory_exports, {
|
|
52174
51979
|
refreshMemoryCommand: () => refreshMemoryCommand
|
|
52175
51980
|
});
|
|
52176
|
-
import { getProjectRoot as
|
|
51981
|
+
import { getProjectRoot as getProjectRoot28 } from "@cleocode/core";
|
|
52177
51982
|
var refreshMemoryCommand;
|
|
52178
51983
|
var init_refresh_memory = __esm({
|
|
52179
51984
|
"packages/cleo/src/cli/commands/refresh-memory.ts"() {
|
|
@@ -52186,7 +51991,7 @@ var init_refresh_memory = __esm({
|
|
|
52186
51991
|
description: "Regenerate .cleo/memory-bridge.md from brain.db"
|
|
52187
51992
|
},
|
|
52188
51993
|
async run() {
|
|
52189
|
-
const projectDir =
|
|
51994
|
+
const projectDir = getProjectRoot28();
|
|
52190
51995
|
const { writeMemoryBridge } = await import("@cleocode/core/internal");
|
|
52191
51996
|
const result = await writeMemoryBridge(projectDir);
|
|
52192
51997
|
if (result.written) {
|
|
@@ -53496,7 +53301,7 @@ __export(restore_exports, {
|
|
|
53496
53301
|
import fs3 from "node:fs";
|
|
53497
53302
|
import path5 from "node:path";
|
|
53498
53303
|
import { CleoError as CleoError8, getTaskAccessor as getTaskAccessor3 } from "@cleocode/core";
|
|
53499
|
-
import { getProjectRoot as
|
|
53304
|
+
import { getProjectRoot as getProjectRoot29 } from "@cleocode/core/internal";
|
|
53500
53305
|
function parseMarkdownValue(raw) {
|
|
53501
53306
|
const trimmed = raw.trim();
|
|
53502
53307
|
if (trimmed === "_(not present)_" || trimmed === "") return void 0;
|
|
@@ -53616,7 +53421,7 @@ var init_restore = __esm({
|
|
|
53616
53421
|
description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
|
|
53617
53422
|
},
|
|
53618
53423
|
async run() {
|
|
53619
|
-
const projectRoot =
|
|
53424
|
+
const projectRoot = getProjectRoot29();
|
|
53620
53425
|
const reportPath = path5.join(projectRoot, CLEO_DIR_NAME, RESTORE_CONFLICTS_MD);
|
|
53621
53426
|
if (!fs3.existsSync(reportPath)) {
|
|
53622
53427
|
humanLine("No pending restore conflicts. Nothing to finalize.");
|
|
@@ -54514,11 +54319,11 @@ async function runPostUpdateDiagnostics(opts) {
|
|
|
54514
54319
|
input: process.stdin,
|
|
54515
54320
|
output: process.stdout
|
|
54516
54321
|
});
|
|
54517
|
-
shouldMigrate = await new Promise((
|
|
54322
|
+
shouldMigrate = await new Promise((resolve5) => {
|
|
54518
54323
|
rl.question(" Do you want to run the upgrade now? [Y/n] ", (answer) => {
|
|
54519
54324
|
rl.close();
|
|
54520
54325
|
const clean = answer.trim().toLowerCase();
|
|
54521
|
-
|
|
54326
|
+
resolve5(clean === "" || clean === "y" || clean === "yes");
|
|
54522
54327
|
});
|
|
54523
54328
|
});
|
|
54524
54329
|
}
|
|
@@ -55591,7 +55396,7 @@ var sequence_exports = {};
|
|
|
55591
55396
|
__export(sequence_exports, {
|
|
55592
55397
|
sequenceCommand: () => sequenceCommand
|
|
55593
55398
|
});
|
|
55594
|
-
import { getProjectRoot as
|
|
55399
|
+
import { getProjectRoot as getProjectRoot30 } from "@cleocode/core/internal";
|
|
55595
55400
|
var showCommand12, checkCommand6, repairCommand, sequenceCommand;
|
|
55596
55401
|
var init_sequence = __esm({
|
|
55597
55402
|
"packages/cleo/src/cli/commands/sequence.ts"() {
|
|
@@ -55627,7 +55432,7 @@ var init_sequence = __esm({
|
|
|
55627
55432
|
meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
|
|
55628
55433
|
async run() {
|
|
55629
55434
|
const { repairSequence } = await import("@cleocode/core/internal");
|
|
55630
|
-
const projectRoot =
|
|
55435
|
+
const projectRoot = getProjectRoot30();
|
|
55631
55436
|
const repair = await repairSequence(projectRoot);
|
|
55632
55437
|
const result = {
|
|
55633
55438
|
repaired: repair.repaired,
|
|
@@ -55681,7 +55486,7 @@ async function promptOwnerAuthPassword(sessionName) {
|
|
|
55681
55486
|
terminal: true
|
|
55682
55487
|
});
|
|
55683
55488
|
process.stderr.write(`[cleo] Enter owner-auth password for session "${sessionName}": `);
|
|
55684
|
-
const password = await new Promise((
|
|
55489
|
+
const password = await new Promise((resolve5) => {
|
|
55685
55490
|
if (process.stdin.setRawMode) {
|
|
55686
55491
|
process.stdin.setRawMode(
|
|
55687
55492
|
true
|
|
@@ -55699,10 +55504,10 @@ async function promptOwnerAuthPassword(sessionName) {
|
|
|
55699
55504
|
);
|
|
55700
55505
|
}
|
|
55701
55506
|
process.stderr.write("\n");
|
|
55702
|
-
|
|
55507
|
+
resolve5(pw);
|
|
55703
55508
|
} else if (ch === "") {
|
|
55704
55509
|
process.stderr.write("\n[cleo] Cancelled.\n");
|
|
55705
|
-
|
|
55510
|
+
resolve5("");
|
|
55706
55511
|
} else if (ch === "\x7F" || ch === "\b") {
|
|
55707
55512
|
pw = pw.slice(0, -1);
|
|
55708
55513
|
} else {
|
|
@@ -56070,8 +55875,8 @@ var init_session4 = __esm({
|
|
|
56070
55875
|
"audit-scope": { type: "string", description: "Audit log scope (global|local)" }
|
|
56071
55876
|
},
|
|
56072
55877
|
async run({ args }) {
|
|
56073
|
-
const { detectSessionDrift, getProjectRoot:
|
|
56074
|
-
const projectRoot = await
|
|
55878
|
+
const { detectSessionDrift, getProjectRoot: getProjectRoot33 } = await import("@cleocode/core");
|
|
55879
|
+
const projectRoot = await getProjectRoot33();
|
|
56075
55880
|
const scope = args["audit-scope"] === "local" ? "local" : "global";
|
|
56076
55881
|
const report = await detectSessionDrift({ projectRoot, auditScope: scope });
|
|
56077
55882
|
cliOutput(report, { command: "session drift", operation: "session.drift" });
|
|
@@ -57579,7 +57384,7 @@ __export(token_exports, {
|
|
|
57579
57384
|
tokenCommand: () => tokenCommand
|
|
57580
57385
|
});
|
|
57581
57386
|
import { readFileSync as readFileSync15 } from "node:fs";
|
|
57582
|
-
import { getProjectRoot as
|
|
57387
|
+
import { getProjectRoot as getProjectRoot31, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
|
|
57583
57388
|
function readPayload(args, textKey, fileKey) {
|
|
57584
57389
|
const text = args[textKey];
|
|
57585
57390
|
const file = args[fileKey];
|
|
@@ -57743,7 +57548,7 @@ var init_token = __esm({
|
|
|
57743
57548
|
domain: args.domain,
|
|
57744
57549
|
operation: args.operation
|
|
57745
57550
|
};
|
|
57746
|
-
const result = args.record ? await recordTokenExchange2(
|
|
57551
|
+
const result = args.record ? await recordTokenExchange2(getProjectRoot31(), input) : await measureTokenExchange(input);
|
|
57747
57552
|
cliOutput(result, {
|
|
57748
57553
|
command: "token",
|
|
57749
57554
|
operation: args.record ? "admin.token.record" : "token.estimate"
|
|
@@ -57779,7 +57584,7 @@ __export(transcript_exports, {
|
|
|
57779
57584
|
});
|
|
57780
57585
|
import { homedir as homedir8 } from "node:os";
|
|
57781
57586
|
import { join as join23 } from "node:path";
|
|
57782
|
-
import { getProjectRoot as
|
|
57587
|
+
import { getProjectRoot as getProjectRoot32 } from "@cleocode/core";
|
|
57783
57588
|
import {
|
|
57784
57589
|
parseDurationMs,
|
|
57785
57590
|
pruneTranscripts,
|
|
@@ -57809,7 +57614,7 @@ var init_transcript = __esm({
|
|
|
57809
57614
|
async run({ args }) {
|
|
57810
57615
|
if (args.pending) {
|
|
57811
57616
|
try {
|
|
57812
|
-
const projectRoot =
|
|
57617
|
+
const projectRoot = getProjectRoot32();
|
|
57813
57618
|
const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
57814
57619
|
const pending = await scanPendingTranscripts(projectRoot);
|
|
57815
57620
|
cliOutput(
|
|
@@ -57906,7 +57711,7 @@ var init_transcript = __esm({
|
|
|
57906
57711
|
async run({ args }) {
|
|
57907
57712
|
const tier = args.tier ?? "warm";
|
|
57908
57713
|
const dryRun = args["dry-run"] ?? false;
|
|
57909
|
-
const projectRoot =
|
|
57714
|
+
const projectRoot = getProjectRoot32();
|
|
57910
57715
|
try {
|
|
57911
57716
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
57912
57717
|
const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -58018,7 +57823,7 @@ var init_transcript = __esm({
|
|
|
58018
57823
|
const dryRun = args["dry-run"] ?? false;
|
|
58019
57824
|
const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
|
|
58020
57825
|
const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
|
|
58021
|
-
const projectRoot =
|
|
57826
|
+
const projectRoot = getProjectRoot32();
|
|
58022
57827
|
try {
|
|
58023
57828
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
58024
57829
|
const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -58376,6 +58181,23 @@ var init_update = __esm({
|
|
|
58376
58181
|
"depends-waiver": {
|
|
58377
58182
|
type: "string",
|
|
58378
58183
|
description: "Justification for promoting a task to critical priority without --depends (T1856). Records waiver in task metadata."
|
|
58184
|
+
},
|
|
58185
|
+
/**
|
|
58186
|
+
* Related tasks — semantic relationships (non-dependency).
|
|
58187
|
+
* Comma-separated task IDs with optional type suffix (e.g. "T001:blocks,T002").
|
|
58188
|
+
* Default type is 'related'. Replaces existing relates list.
|
|
58189
|
+
*/
|
|
58190
|
+
relates: {
|
|
58191
|
+
type: "string",
|
|
58192
|
+
description: 'Set related tasks (comma-separated, optional type suffix: "T001:blocks,T002")'
|
|
58193
|
+
},
|
|
58194
|
+
"add-relates": {
|
|
58195
|
+
type: "string",
|
|
58196
|
+
description: "Add related tasks without overwriting existing (comma-separated, optional type suffix)"
|
|
58197
|
+
},
|
|
58198
|
+
"remove-relates": {
|
|
58199
|
+
type: "string",
|
|
58200
|
+
description: "Remove related tasks by taskId (comma-separated)"
|
|
58379
58201
|
}
|
|
58380
58202
|
},
|
|
58381
58203
|
async run({ args, cmd }) {
|
|
@@ -58401,6 +58223,21 @@ var init_update = __esm({
|
|
|
58401
58223
|
params["addDepends"] = args["add-depends"].split(",").map((s) => s.trim());
|
|
58402
58224
|
if (args["remove-depends"])
|
|
58403
58225
|
params["removeDepends"] = args["remove-depends"].split(",").map((s) => s.trim());
|
|
58226
|
+
if (args.relates) {
|
|
58227
|
+
params["relates"] = args.relates.split(",").map((s) => {
|
|
58228
|
+
const [taskId, relType = "related"] = s.trim().split(":");
|
|
58229
|
+
return { taskId: taskId.trim(), type: relType.trim() };
|
|
58230
|
+
});
|
|
58231
|
+
}
|
|
58232
|
+
if (args["add-relates"]) {
|
|
58233
|
+
params["addRelates"] = args["add-relates"].split(",").map((s) => {
|
|
58234
|
+
const [taskId, relType = "related"] = s.trim().split(":");
|
|
58235
|
+
return { taskId: taskId.trim(), type: relType.trim() };
|
|
58236
|
+
});
|
|
58237
|
+
}
|
|
58238
|
+
if (args["remove-relates"]) {
|
|
58239
|
+
params["removeRelates"] = args["remove-relates"].split(",").map((s) => s.trim());
|
|
58240
|
+
}
|
|
58404
58241
|
if (args.notes !== void 0) params["notes"] = args.notes;
|
|
58405
58242
|
if (args.note !== void 0) params["notes"] = params["notes"] ?? args.note;
|
|
58406
58243
|
if (args.acceptance)
|
|
@@ -58612,124 +58449,14 @@ var init_upgrade = __esm({
|
|
|
58612
58449
|
// packages/cleo/src/cli/commands/verify.ts
|
|
58613
58450
|
var verify_exports = {};
|
|
58614
58451
|
__export(verify_exports, {
|
|
58615
|
-
backfillCommand: () => backfillCommand3,
|
|
58616
58452
|
verifyCommand: () => verifyCommand3
|
|
58617
58453
|
});
|
|
58618
|
-
|
|
58619
|
-
import { resolve as resolve6 } from "node:path";
|
|
58620
|
-
import {
|
|
58621
|
-
backfillAllPendingVerifiers,
|
|
58622
|
-
backfillVerifier,
|
|
58623
|
-
getProjectRoot as getProjectRoot34,
|
|
58624
|
-
resolveVerifierScript as resolveVerifierScript2,
|
|
58625
|
-
runVerifier
|
|
58626
|
-
} from "@cleocode/core";
|
|
58627
|
-
async function runBackfillSingle(taskId, projectRoot, force) {
|
|
58628
|
-
const response = await dispatchRaw("query", "tasks", "show", { taskId });
|
|
58629
|
-
if (!response.success) {
|
|
58630
|
-
process.stderr.write(
|
|
58631
|
-
`Error: could not fetch task ${taskId}: ${response.error?.message ?? "unknown error"}
|
|
58632
|
-
`
|
|
58633
|
-
);
|
|
58634
|
-
process.exitCode = 1;
|
|
58635
|
-
return;
|
|
58636
|
-
}
|
|
58637
|
-
const task = response.data?.task;
|
|
58638
|
-
if (!task) {
|
|
58639
|
-
process.stderr.write(`Error: task ${taskId} not found.
|
|
58640
|
-
`);
|
|
58641
|
-
process.exitCode = 1;
|
|
58642
|
-
return;
|
|
58643
|
-
}
|
|
58644
|
-
const result = backfillVerifier(task, projectRoot, force);
|
|
58645
|
-
if (result.status === "generated") {
|
|
58646
|
-
cliOutput(result, { command: "verify", operation: "verify.scaffold" });
|
|
58647
|
-
} else if (result.status === "skipped") {
|
|
58648
|
-
process.stderr.write(
|
|
58649
|
-
`Error: verifier already exists: ${result.path}
|
|
58650
|
-
Use --force to overwrite. (T9218 idempotency guard)
|
|
58651
|
-
`
|
|
58652
|
-
);
|
|
58653
|
-
process.exitCode = 1;
|
|
58654
|
-
} else {
|
|
58655
|
-
process.stderr.write(`Error generating verifier for ${taskId}: ${result.error}
|
|
58656
|
-
`);
|
|
58657
|
-
process.exitCode = 1;
|
|
58658
|
-
}
|
|
58659
|
-
}
|
|
58660
|
-
async function runBackfillAll(projectRoot, force) {
|
|
58661
|
-
const seen = /* @__PURE__ */ new Set();
|
|
58662
|
-
const pending = [];
|
|
58663
|
-
const queries = [
|
|
58664
|
-
dispatchRaw("query", "tasks", "list", { priority: "critical", limit: 200 }),
|
|
58665
|
-
dispatchRaw("query", "tasks", "list", { size: "large", limit: 200 }),
|
|
58666
|
-
dispatchRaw("query", "tasks", "list", { type: "epic", limit: 200 })
|
|
58667
|
-
];
|
|
58668
|
-
const results = await Promise.all(queries);
|
|
58669
|
-
for (const response of results) {
|
|
58670
|
-
if (!response.success) continue;
|
|
58671
|
-
const tasks = response.data?.tasks ?? [];
|
|
58672
|
-
for (const t of tasks) {
|
|
58673
|
-
const id = String(t.id ?? "");
|
|
58674
|
-
if (!id || seen.has(id)) continue;
|
|
58675
|
-
seen.add(id);
|
|
58676
|
-
pending.push(t);
|
|
58677
|
-
}
|
|
58678
|
-
}
|
|
58679
|
-
const summary = backfillAllPendingVerifiers(pending, projectRoot, force);
|
|
58680
|
-
if (summary.succeeded === 0 && summary.failed === 0 && summary.skipped === 0) {
|
|
58681
|
-
cliOutput(
|
|
58682
|
-
{ message: "All critical/large/epic tasks already have verifier scripts. Nothing to do." },
|
|
58683
|
-
{ command: "verify", operation: "verify.scaffold-all" }
|
|
58684
|
-
);
|
|
58685
|
-
return;
|
|
58686
|
-
}
|
|
58687
|
-
cliOutput(summary, { command: "verify", operation: "verify.scaffold-all" });
|
|
58688
|
-
if (summary.failed > 0) {
|
|
58689
|
-
process.exitCode = 1;
|
|
58690
|
-
}
|
|
58691
|
-
}
|
|
58692
|
-
var backfillCommand3, verifyCommand3;
|
|
58454
|
+
var verifyCommand3;
|
|
58693
58455
|
var init_verify = __esm({
|
|
58694
58456
|
"packages/cleo/src/cli/commands/verify.ts"() {
|
|
58695
58457
|
"use strict";
|
|
58696
58458
|
init_dist();
|
|
58697
58459
|
init_cli();
|
|
58698
|
-
init_renderers();
|
|
58699
|
-
backfillCommand3 = defineCommand({
|
|
58700
|
-
meta: {
|
|
58701
|
-
name: "backfill",
|
|
58702
|
-
description: "Auto-generate a verifier stub from AC text for a task lacking one (T9218 / ADR-070)"
|
|
58703
|
-
},
|
|
58704
|
-
args: {
|
|
58705
|
-
taskId: {
|
|
58706
|
-
type: "positional",
|
|
58707
|
-
description: "Task ID to generate a verifier stub for (e.g. T9213). Omit when using --all-pending.",
|
|
58708
|
-
required: false
|
|
58709
|
-
},
|
|
58710
|
-
"all-pending": {
|
|
58711
|
-
type: "boolean",
|
|
58712
|
-
description: "Process all critical/large/epic tasks that lack a verifier script (T9218)"
|
|
58713
|
-
},
|
|
58714
|
-
force: {
|
|
58715
|
-
type: "boolean",
|
|
58716
|
-
description: "Overwrite an existing verifier without error (idempotency override)"
|
|
58717
|
-
}
|
|
58718
|
-
},
|
|
58719
|
-
async run({ args, cmd }) {
|
|
58720
|
-
const projectRoot = getProjectRoot34();
|
|
58721
|
-
const force = !!args.force;
|
|
58722
|
-
if (args["all-pending"]) {
|
|
58723
|
-
await runBackfillAll(projectRoot, force);
|
|
58724
|
-
return;
|
|
58725
|
-
}
|
|
58726
|
-
if (!args.taskId) {
|
|
58727
|
-
await showUsage(cmd);
|
|
58728
|
-
return;
|
|
58729
|
-
}
|
|
58730
|
-
await runBackfillSingle(String(args.taskId), projectRoot, force);
|
|
58731
|
-
}
|
|
58732
|
-
});
|
|
58733
58460
|
verifyCommand3 = defineCommand({
|
|
58734
58461
|
meta: { name: "verify", description: "View or modify verification gates for a task" },
|
|
58735
58462
|
args: {
|
|
@@ -58770,11 +58497,6 @@ var init_verify = __esm({
|
|
|
58770
58497
|
"shared-evidence": {
|
|
58771
58498
|
type: "boolean",
|
|
58772
58499
|
description: "Acknowledge that the same evidence atom is applied to >3 distinct tasks in this session (T1502 / ADR-059). Without this flag, such reuse triggers a warning; in strict mode (CLEO_STRICT_EVIDENCE=1) it is a hard reject."
|
|
58773
|
-
},
|
|
58774
|
-
"acceptance-check": {
|
|
58775
|
-
type: "string",
|
|
58776
|
-
description: "Run the task acceptance verifier before any gate write. Resolves scripts/verify-<taskId>-fu.mjs (or pass an explicit path). Blocks if verifier exits non-zero. (T9192 / ADR-070)",
|
|
58777
|
-
required: false
|
|
58778
58500
|
}
|
|
58779
58501
|
},
|
|
58780
58502
|
async run({ args, cmd }) {
|
|
@@ -58782,67 +58504,6 @@ var init_verify = __esm({
|
|
|
58782
58504
|
await showUsage(cmd);
|
|
58783
58505
|
return;
|
|
58784
58506
|
}
|
|
58785
|
-
if (args.taskId === "backfill") {
|
|
58786
|
-
const remainingArgs = process.argv.slice(process.argv.indexOf("backfill") + 1);
|
|
58787
|
-
const taskIdArg = remainingArgs.find((a) => !a.startsWith("-"));
|
|
58788
|
-
const allPending = remainingArgs.includes("--all-pending");
|
|
58789
|
-
const force = remainingArgs.includes("--force");
|
|
58790
|
-
const projectRoot = getProjectRoot34();
|
|
58791
|
-
if (allPending) {
|
|
58792
|
-
await runBackfillAll(projectRoot, force);
|
|
58793
|
-
} else if (taskIdArg) {
|
|
58794
|
-
await runBackfillSingle(taskIdArg, projectRoot, force);
|
|
58795
|
-
} else {
|
|
58796
|
-
await showUsage(cmd);
|
|
58797
|
-
}
|
|
58798
|
-
return;
|
|
58799
|
-
}
|
|
58800
|
-
const acceptanceCheckRaw = args["acceptance-check"];
|
|
58801
|
-
const shouldRunAcceptanceCheck = acceptanceCheckRaw !== void 0 && acceptanceCheckRaw !== false;
|
|
58802
|
-
if (shouldRunAcceptanceCheck) {
|
|
58803
|
-
const projectRoot = resolve6(process.cwd());
|
|
58804
|
-
let verifierPath = null;
|
|
58805
|
-
if (typeof acceptanceCheckRaw === "string" && acceptanceCheckRaw.length > 0) {
|
|
58806
|
-
const explicit = resolve6(projectRoot, acceptanceCheckRaw);
|
|
58807
|
-
verifierPath = existsSync15(explicit) ? explicit : null;
|
|
58808
|
-
if (!verifierPath) {
|
|
58809
|
-
process.stderr.write(
|
|
58810
|
-
`Error: --acceptance-check path not found: ${explicit}
|
|
58811
|
-
T9192 / ADR-070: verifier script must exist before gate writes are allowed.
|
|
58812
|
-
`
|
|
58813
|
-
);
|
|
58814
|
-
process.exitCode = 1;
|
|
58815
|
-
return;
|
|
58816
|
-
}
|
|
58817
|
-
} else {
|
|
58818
|
-
verifierPath = resolveVerifierScript2(String(args.taskId), projectRoot);
|
|
58819
|
-
}
|
|
58820
|
-
if (!verifierPath) {
|
|
58821
|
-
process.stderr.write(
|
|
58822
|
-
`Error: --acceptance-check: no verifier script found for ${args.taskId}.
|
|
58823
|
-
Looked for: scripts/verify-${args.taskId}-fu.mjs, scripts/verify-${args.taskId}.mjs
|
|
58824
|
-
T9192 / ADR-070: create the verifier script before using --acceptance-check.
|
|
58825
|
-
`
|
|
58826
|
-
);
|
|
58827
|
-
process.exitCode = 1;
|
|
58828
|
-
return;
|
|
58829
|
-
}
|
|
58830
|
-
const { exitCode, stdout, stderr: stderr2 } = runVerifier(verifierPath);
|
|
58831
|
-
process.stdout.write(stdout);
|
|
58832
|
-
if (stderr2) process.stderr.write(stderr2);
|
|
58833
|
-
if (exitCode !== 0) {
|
|
58834
|
-
process.stderr.write(
|
|
58835
|
-
`
|
|
58836
|
-
E_ACCEPTANCE_VERIFIER_FAILED: verifier exited ${exitCode}.
|
|
58837
|
-
Verifier: ${verifierPath}
|
|
58838
|
-
Gate writes blocked until verifier exits 0. (T9192 / ADR-070)
|
|
58839
|
-
`
|
|
58840
|
-
);
|
|
58841
|
-
process.exitCode = exitCode;
|
|
58842
|
-
return;
|
|
58843
|
-
}
|
|
58844
|
-
humanLine("Verifier passed (exit 0). Proceeding with gate operation.");
|
|
58845
|
-
}
|
|
58846
58507
|
const isWrite = !!(args.gate || args.all || args.reset);
|
|
58847
58508
|
const useExplain = !isWrite && args.explain === true;
|
|
58848
58509
|
const operation = isWrite ? "gate.set" : useExplain ? "verify.explain" : "gate.status";
|
|
@@ -58979,7 +58640,7 @@ Logs: ${logFile}`
|
|
|
58979
58640
|
}
|
|
58980
58641
|
} catch {
|
|
58981
58642
|
}
|
|
58982
|
-
await new Promise((
|
|
58643
|
+
await new Promise((resolve5) => setTimeout(resolve5, 500));
|
|
58983
58644
|
}
|
|
58984
58645
|
if (!started) {
|
|
58985
58646
|
try {
|
|
@@ -59056,7 +58717,7 @@ var init_web = __esm({
|
|
|
59056
58717
|
}
|
|
59057
58718
|
for (let i = 0; i < 60; i++) {
|
|
59058
58719
|
if (!isProcessRunning(status.pid)) break;
|
|
59059
|
-
await new Promise((
|
|
58720
|
+
await new Promise((resolve5) => setTimeout(resolve5, 500));
|
|
59060
58721
|
}
|
|
59061
58722
|
if (isProcessRunning(status.pid)) {
|
|
59062
58723
|
try {
|
|
@@ -59108,7 +58769,7 @@ var init_web = __esm({
|
|
|
59108
58769
|
}
|
|
59109
58770
|
for (let i = 0; i < 60; i++) {
|
|
59110
58771
|
if (!isProcessRunning(status.pid)) break;
|
|
59111
|
-
await new Promise((
|
|
58772
|
+
await new Promise((resolve5) => setTimeout(resolve5, 500));
|
|
59112
58773
|
}
|
|
59113
58774
|
if (isProcessRunning(status.pid)) {
|
|
59114
58775
|
try {
|
|
@@ -59274,12 +58935,6 @@ var COMMAND_MANIFEST = [
|
|
|
59274
58935
|
description: "Git-backed audit tooling (lineage reconstruction, integrity checks). ",
|
|
59275
58936
|
load: async () => (await Promise.resolve().then(() => (init_audit2(), audit_exports))).auditCommand
|
|
59276
58937
|
},
|
|
59277
|
-
{
|
|
59278
|
-
exportName: "backfillCommand",
|
|
59279
|
-
name: "backfill",
|
|
59280
|
-
description: "Retroactively add acceptance criteria and verification metadata to existing tasks",
|
|
59281
|
-
load: async () => (await Promise.resolve().then(() => (init_backfill(), backfill_exports))).backfillCommand
|
|
59282
|
-
},
|
|
59283
58938
|
{
|
|
59284
58939
|
exportName: "backupInspectSubCommand",
|
|
59285
58940
|
name: "inspect",
|
|
@@ -59946,12 +59601,6 @@ var COMMAND_MANIFEST = [
|
|
|
59946
59601
|
description: "Unified project maintenance (storage migration, schema repair, structural fixes, doc refresh)",
|
|
59947
59602
|
load: async () => (await Promise.resolve().then(() => (init_upgrade(), upgrade_exports))).upgradeCommand
|
|
59948
59603
|
},
|
|
59949
|
-
{
|
|
59950
|
-
exportName: "backfillCommand",
|
|
59951
|
-
name: "backfill",
|
|
59952
|
-
description: "Auto-generate a verifier stub from AC text for a task lacking one (T9218 / ADR-070)",
|
|
59953
|
-
load: async () => (await Promise.resolve().then(() => (init_verify(), verify_exports))).backfillCommand
|
|
59954
|
-
},
|
|
59955
59604
|
{
|
|
59956
59605
|
exportName: "verifyCommand",
|
|
59957
59606
|
name: "verify",
|
|
@@ -60401,7 +60050,7 @@ async function runStartupMaintenance() {
|
|
|
60401
60050
|
detectAndRemoveStrayProjectNexus,
|
|
60402
60051
|
getGlobalSalt,
|
|
60403
60052
|
getLogger: getLogger17,
|
|
60404
|
-
getProjectRoot:
|
|
60053
|
+
getProjectRoot: getProjectRoot33,
|
|
60405
60054
|
isCleanupMarkerSet,
|
|
60406
60055
|
migrateSignaldockToConduit,
|
|
60407
60056
|
needsSignaldockToConduitMigration,
|
|
@@ -60410,7 +60059,7 @@ async function runStartupMaintenance() {
|
|
|
60410
60059
|
} = await import("@cleocode/core/internal");
|
|
60411
60060
|
let projectRootForCleanup = "";
|
|
60412
60061
|
try {
|
|
60413
|
-
projectRootForCleanup =
|
|
60062
|
+
projectRootForCleanup = getProjectRoot33();
|
|
60414
60063
|
} catch {
|
|
60415
60064
|
}
|
|
60416
60065
|
if (!isCleanupMarkerSet(CLI_VERSION, projectRootForCleanup)) {
|
|
@@ -60430,7 +60079,7 @@ async function runStartupMaintenance() {
|
|
|
60430
60079
|
const isInitInvocation = process.argv.slice(2).some((a) => a === "init");
|
|
60431
60080
|
if (!isInitInvocation) {
|
|
60432
60081
|
try {
|
|
60433
|
-
const _projectRootForMigration =
|
|
60082
|
+
const _projectRootForMigration = getProjectRoot33();
|
|
60434
60083
|
if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
|
|
60435
60084
|
const migrationResult = migrateSignaldockToConduit(_projectRootForMigration);
|
|
60436
60085
|
if (migrationResult.status === "failed") {
|