@cleocode/cleo 2026.4.133 → 2026.4.138
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 +390 -72
- package/dist/cli/index.js.map +4 -4
- package/package.json +9 -9
package/dist/cli/index.js
CHANGED
|
@@ -587,7 +587,7 @@ function createSuccessResult() {
|
|
|
587
587
|
function isErrorResult(result) {
|
|
588
588
|
return !result.success;
|
|
589
589
|
}
|
|
590
|
-
var ThinAgentViolationError, LifecycleScopeDeniedError;
|
|
590
|
+
var ThinAgentViolationError, LifecycleScopeDeniedError, ClassifierUnregisteredAgentError;
|
|
591
591
|
var init_errors = __esm({
|
|
592
592
|
"packages/contracts/src/errors.ts"() {
|
|
593
593
|
"use strict";
|
|
@@ -635,6 +635,26 @@ var init_errors = __esm({
|
|
|
635
635
|
/** Numeric exit code aligned with {@link ExitCode.TASK_NOT_IN_SCOPE} (34). */
|
|
636
636
|
exitCode = 34 /* TASK_NOT_IN_SCOPE */;
|
|
637
637
|
};
|
|
638
|
+
ClassifierUnregisteredAgentError = class extends Error {
|
|
639
|
+
/**
|
|
640
|
+
* @param emittedAgentId - The agent ID the classifier tried to emit.
|
|
641
|
+
* @param registeredIds - The set of valid, registry-backed agent IDs.
|
|
642
|
+
*/
|
|
643
|
+
constructor(emittedAgentId, registeredIds) {
|
|
644
|
+
super(
|
|
645
|
+
`E_CLASSIFIER_UNREGISTERED_AGENT: classifier emitted '${emittedAgentId}' which is not in the registered agent vocabulary. Valid agent IDs: [${registeredIds.join(", ")}]. Add this agent to the registry or remove it from the classifier rules.`
|
|
646
|
+
);
|
|
647
|
+
this.emittedAgentId = emittedAgentId;
|
|
648
|
+
this.registeredIds = registeredIds;
|
|
649
|
+
this.name = "ClassifierUnregisteredAgentError";
|
|
650
|
+
}
|
|
651
|
+
emittedAgentId;
|
|
652
|
+
registeredIds;
|
|
653
|
+
/** Stable LAFS error code string for envelope emission. */
|
|
654
|
+
code = "E_CLASSIFIER_UNREGISTERED_AGENT";
|
|
655
|
+
/** Numeric exit code aligned with {@link ExitCode.SPAWN_VALIDATION_FAILED} (63). */
|
|
656
|
+
exitCode = 63 /* SPAWN_VALIDATION_FAILED */;
|
|
657
|
+
};
|
|
638
658
|
}
|
|
639
659
|
});
|
|
640
660
|
|
|
@@ -1263,6 +1283,7 @@ __export(src_exports, {
|
|
|
1263
1283
|
AGENT_TYPES: () => AGENT_TYPES,
|
|
1264
1284
|
BRAIN_OBSERVATION_TYPES: () => BRAIN_OBSERVATION_TYPES,
|
|
1265
1285
|
BRANCH_LOCK_ERROR_CODES: () => BRANCH_LOCK_ERROR_CODES,
|
|
1286
|
+
ClassifierUnregisteredAgentError: () => ClassifierUnregisteredAgentError,
|
|
1266
1287
|
ExitCode: () => ExitCode,
|
|
1267
1288
|
GATE_STATUSES: () => GATE_STATUSES,
|
|
1268
1289
|
LIFECYCLE_PIPELINE_STATUSES: () => LIFECYCLE_PIPELINE_STATUSES,
|
|
@@ -9257,6 +9278,38 @@ var init_memory_engine = __esm({
|
|
|
9257
9278
|
});
|
|
9258
9279
|
|
|
9259
9280
|
// packages/cleo/src/dispatch/engines/session-engine.ts
|
|
9281
|
+
var session_engine_exports = {};
|
|
9282
|
+
__export(session_engine_exports, {
|
|
9283
|
+
sessionArchive: () => sessionArchive,
|
|
9284
|
+
sessionBriefing: () => sessionBriefing,
|
|
9285
|
+
sessionChainShow: () => sessionChainShow,
|
|
9286
|
+
sessionCleanup: () => sessionCleanup,
|
|
9287
|
+
sessionComputeDebrief: () => sessionComputeDebrief,
|
|
9288
|
+
sessionComputeHandoff: () => sessionComputeHandoff,
|
|
9289
|
+
sessionContextDrift: () => sessionContextDrift,
|
|
9290
|
+
sessionContextInject: () => sessionContextInject,
|
|
9291
|
+
sessionDebriefShow: () => sessionDebriefShow,
|
|
9292
|
+
sessionDecisionLog: () => sessionDecisionLog,
|
|
9293
|
+
sessionEnd: () => sessionEnd,
|
|
9294
|
+
sessionFind: () => sessionFind,
|
|
9295
|
+
sessionGc: () => sessionGc,
|
|
9296
|
+
sessionHandoff: () => sessionHandoff,
|
|
9297
|
+
sessionHistory: () => sessionHistory,
|
|
9298
|
+
sessionList: () => sessionList,
|
|
9299
|
+
sessionRecordAssumption: () => sessionRecordAssumption,
|
|
9300
|
+
sessionRecordDecision: () => sessionRecordDecision,
|
|
9301
|
+
sessionResume: () => sessionResume,
|
|
9302
|
+
sessionShow: () => sessionShow,
|
|
9303
|
+
sessionStart: () => sessionStart,
|
|
9304
|
+
sessionStats: () => sessionStats,
|
|
9305
|
+
sessionStatus: () => sessionStatus,
|
|
9306
|
+
sessionSuspend: () => sessionSuspend,
|
|
9307
|
+
sessionSwitch: () => sessionSwitch,
|
|
9308
|
+
taskCurrentGet: () => taskCurrentGet,
|
|
9309
|
+
taskStart: () => taskStart,
|
|
9310
|
+
taskStop: () => taskStop,
|
|
9311
|
+
taskWorkHistory: () => taskWorkHistory
|
|
9312
|
+
});
|
|
9260
9313
|
import {
|
|
9261
9314
|
archiveSessions,
|
|
9262
9315
|
cleanupSessions,
|
|
@@ -10972,6 +11025,13 @@ async function orchestratePlan(input) {
|
|
|
10972
11025
|
if (resolved) {
|
|
10973
11026
|
persona = resolved.agentId;
|
|
10974
11027
|
orchLevel = resolved.orchLevel;
|
|
11028
|
+
if (resolved.resolverWarning) {
|
|
11029
|
+
warnings.push({
|
|
11030
|
+
taskId: task.id,
|
|
11031
|
+
code: "agent_fallback_universal_base",
|
|
11032
|
+
message: resolved.resolverWarning
|
|
11033
|
+
});
|
|
11034
|
+
}
|
|
10975
11035
|
} else {
|
|
10976
11036
|
persona = "cleo-subagent";
|
|
10977
11037
|
const fallback = resolveAgentGraceful(db, "cleo-subagent", preferTier);
|
|
@@ -13515,6 +13575,16 @@ async function taskComplete(projectRoot, taskId, notes) {
|
|
|
13515
13575
|
try {
|
|
13516
13576
|
const accessor = await getAccessor6(projectRoot);
|
|
13517
13577
|
const result = await coreCompleteTask({ taskId, notes }, projectRoot, accessor);
|
|
13578
|
+
try {
|
|
13579
|
+
const agentId = process.env["CLEO_AGENT_ID"] ?? "cleo";
|
|
13580
|
+
let sessionId = typeof process.env["CLEO_SESSION_ID"] === "string" && process.env["CLEO_SESSION_ID"].length > 0 ? process.env["CLEO_SESSION_ID"] : null;
|
|
13581
|
+
const activeSession = await getActiveSession2(projectRoot);
|
|
13582
|
+
if (activeSession?.id) {
|
|
13583
|
+
sessionId = activeSession.id;
|
|
13584
|
+
}
|
|
13585
|
+
await accessor.updateTaskFields(taskId, { modifiedBy: agentId, sessionId });
|
|
13586
|
+
} catch {
|
|
13587
|
+
}
|
|
13518
13588
|
return {
|
|
13519
13589
|
success: true,
|
|
13520
13590
|
data: {
|
|
@@ -13644,6 +13714,20 @@ async function taskCompleteStrict(projectRoot, taskId, notes) {
|
|
|
13644
13714
|
}
|
|
13645
13715
|
}
|
|
13646
13716
|
}
|
|
13717
|
+
if (lifecycleMode === "strict") {
|
|
13718
|
+
const accessor = await getAccessor6(projectRoot);
|
|
13719
|
+
const task = await accessor.loadSingleTask(taskId);
|
|
13720
|
+
if (task && task.type !== "epic" && !task.verification) {
|
|
13721
|
+
return engineError(
|
|
13722
|
+
"E_EVIDENCE_MISSING",
|
|
13723
|
+
`Task ${taskId} has no verification record (verification_json IS NULL). Run 'cleo verify' with programmatic evidence before completing. See ADR-051.`,
|
|
13724
|
+
{
|
|
13725
|
+
details: { taskId, verificationStatus: "null" },
|
|
13726
|
+
fix: `Initialize and populate verification gates: 'cleo verify ${taskId} --gate implemented --evidence "commit:<sha>;files:<list>"' and other required gates, then retry 'cleo complete ${taskId}'.`
|
|
13727
|
+
}
|
|
13728
|
+
);
|
|
13729
|
+
}
|
|
13730
|
+
}
|
|
13647
13731
|
return taskComplete(projectRoot, taskId, notes);
|
|
13648
13732
|
} catch (err) {
|
|
13649
13733
|
return cleoErrorToEngineError(err, "E_INTERNAL", "Failed to complete task (strict mode)");
|
|
@@ -26745,8 +26829,8 @@ async function acquireDb() {
|
|
|
26745
26829
|
async function buildDefaultDispatcher() {
|
|
26746
26830
|
if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
|
|
26747
26831
|
const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await Promise.resolve().then(() => (init_engine(), engine_exports));
|
|
26748
|
-
const { getProjectRoot:
|
|
26749
|
-
const projectRoot =
|
|
26832
|
+
const { getProjectRoot: getProjectRoot31 } = await import("@cleocode/core/internal");
|
|
26833
|
+
const projectRoot = getProjectRoot31();
|
|
26750
26834
|
return {
|
|
26751
26835
|
async dispatch(input) {
|
|
26752
26836
|
try {
|
|
@@ -27099,14 +27183,14 @@ var init_playbook = __esm({
|
|
|
27099
27183
|
const dispatcher = await buildDefaultDispatcher();
|
|
27100
27184
|
let result;
|
|
27101
27185
|
try {
|
|
27102
|
-
const { getProjectRoot:
|
|
27186
|
+
const { getProjectRoot: getProjectRoot31 } = await import("@cleocode/core/internal");
|
|
27103
27187
|
const opts = {
|
|
27104
27188
|
db,
|
|
27105
27189
|
playbook: parsed.definition,
|
|
27106
27190
|
playbookHash: parsed.sourceHash,
|
|
27107
27191
|
initialContext,
|
|
27108
27192
|
dispatcher,
|
|
27109
|
-
projectRoot:
|
|
27193
|
+
projectRoot: getProjectRoot31()
|
|
27110
27194
|
};
|
|
27111
27195
|
if (__playbookRuntimeOverrides.approvalSecret !== void 0) {
|
|
27112
27196
|
opts.approvalSecret = __playbookRuntimeOverrides.approvalSecret;
|
|
@@ -32628,11 +32712,11 @@ var init_security = __esm({
|
|
|
32628
32712
|
});
|
|
32629
32713
|
|
|
32630
32714
|
// packages/cleo/src/dispatch/middleware/sanitizer.ts
|
|
32631
|
-
function createSanitizer(
|
|
32715
|
+
function createSanitizer(getProjectRoot31) {
|
|
32632
32716
|
return async (req, next) => {
|
|
32633
32717
|
if (req.params) {
|
|
32634
32718
|
try {
|
|
32635
|
-
const root =
|
|
32719
|
+
const root = getProjectRoot31 ? getProjectRoot31() : void 0;
|
|
32636
32720
|
req.params = sanitizeParams(req.params, root, {
|
|
32637
32721
|
domain: req.domain,
|
|
32638
32722
|
operation: req.operation
|
|
@@ -33004,7 +33088,7 @@ import {
|
|
|
33004
33088
|
ensureGlobalSignaldockDb as ensureGlobalSignaldockDb2,
|
|
33005
33089
|
getGlobalSalt,
|
|
33006
33090
|
getLogger as getLogger18,
|
|
33007
|
-
getProjectRoot as
|
|
33091
|
+
getProjectRoot as getProjectRoot30,
|
|
33008
33092
|
migrateSignaldockToConduit,
|
|
33009
33093
|
needsSignaldockToConduitMigration,
|
|
33010
33094
|
validateGlobalSalt
|
|
@@ -33607,6 +33691,42 @@ function createCustomShowUsage(version, subCommands2, aliasMap2) {
|
|
|
33607
33691
|
};
|
|
33608
33692
|
}
|
|
33609
33693
|
|
|
33694
|
+
// packages/cleo/src/cli/lib/did-you-mean.ts
|
|
33695
|
+
function levenshteinDistance(input, candidate) {
|
|
33696
|
+
const inputLen = input.length;
|
|
33697
|
+
const candidateLen = candidate.length;
|
|
33698
|
+
const matrix = Array.from({ length: inputLen + 1 }, (_, i) => [i]);
|
|
33699
|
+
for (let j = 1; j <= candidateLen; j++) {
|
|
33700
|
+
matrix[0][j] = j;
|
|
33701
|
+
}
|
|
33702
|
+
for (let i = 1; i <= inputLen; i++) {
|
|
33703
|
+
for (let j = 1; j <= candidateLen; j++) {
|
|
33704
|
+
const cost = input[i - 1] === candidate[j - 1] ? 0 : 1;
|
|
33705
|
+
matrix[i][j] = Math.min(
|
|
33706
|
+
matrix[i - 1][j] + 1,
|
|
33707
|
+
// deletion
|
|
33708
|
+
matrix[i][j - 1] + 1,
|
|
33709
|
+
// insertion
|
|
33710
|
+
matrix[i - 1][j - 1] + cost
|
|
33711
|
+
// substitution
|
|
33712
|
+
);
|
|
33713
|
+
}
|
|
33714
|
+
}
|
|
33715
|
+
return matrix[inputLen][candidateLen];
|
|
33716
|
+
}
|
|
33717
|
+
function didYouMean(input, candidates, maxDistance = 2) {
|
|
33718
|
+
const suggestions = candidates.map((candidate) => ({
|
|
33719
|
+
command: candidate,
|
|
33720
|
+
distance: levenshteinDistance(input, candidate)
|
|
33721
|
+
})).filter((item) => item.distance <= maxDistance).sort((a, b) => {
|
|
33722
|
+
if (a.distance !== b.distance) {
|
|
33723
|
+
return a.distance - b.distance;
|
|
33724
|
+
}
|
|
33725
|
+
return a.command.localeCompare(b.command);
|
|
33726
|
+
}).map((item) => item.command);
|
|
33727
|
+
return suggestions;
|
|
33728
|
+
}
|
|
33729
|
+
|
|
33610
33730
|
// packages/cleo/src/cli/middleware/output-format.ts
|
|
33611
33731
|
import { resolveOutputFormat } from "@cleocode/lafs";
|
|
33612
33732
|
function resolveFormat(opts, defaults) {
|
|
@@ -33757,7 +33877,49 @@ var adapterCommand = defineCommand({
|
|
|
33757
33877
|
});
|
|
33758
33878
|
|
|
33759
33879
|
// packages/cleo/src/cli/commands/add.ts
|
|
33880
|
+
import { getProjectRoot as getProjectRoot18 } from "@cleocode/core";
|
|
33760
33881
|
init_cli();
|
|
33882
|
+
|
|
33883
|
+
// packages/cleo/src/cli/infer-files-via-gitnexus.ts
|
|
33884
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
33885
|
+
function inferFilesViaGitNexus(title, description) {
|
|
33886
|
+
const queryText = description ? `${title} ${description}` : title;
|
|
33887
|
+
try {
|
|
33888
|
+
const output = execFileSync3("gitnexus", ["query", "--json", "--limit", "5", queryText], {
|
|
33889
|
+
encoding: "utf-8",
|
|
33890
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
33891
|
+
// suppress stderr
|
|
33892
|
+
});
|
|
33893
|
+
const result = JSON.parse(output);
|
|
33894
|
+
const files = /* @__PURE__ */ new Set();
|
|
33895
|
+
if (Array.isArray(result)) {
|
|
33896
|
+
for (const process2 of result) {
|
|
33897
|
+
if (Array.isArray(process2.symbols)) {
|
|
33898
|
+
for (const symbol of process2.symbols) {
|
|
33899
|
+
if (symbol.location && typeof symbol.location === "string") {
|
|
33900
|
+
const match = symbol.location.match(/^([^:]+):/);
|
|
33901
|
+
if (match?.[1]) {
|
|
33902
|
+
files.add(match[1]);
|
|
33903
|
+
}
|
|
33904
|
+
}
|
|
33905
|
+
}
|
|
33906
|
+
}
|
|
33907
|
+
if (Array.isArray(process2.files)) {
|
|
33908
|
+
for (const file of process2.files) {
|
|
33909
|
+
if (typeof file === "string") {
|
|
33910
|
+
files.add(file);
|
|
33911
|
+
}
|
|
33912
|
+
}
|
|
33913
|
+
}
|
|
33914
|
+
}
|
|
33915
|
+
}
|
|
33916
|
+
return Array.from(files);
|
|
33917
|
+
} catch {
|
|
33918
|
+
return [];
|
|
33919
|
+
}
|
|
33920
|
+
}
|
|
33921
|
+
|
|
33922
|
+
// packages/cleo/src/cli/commands/add.ts
|
|
33761
33923
|
init_renderers();
|
|
33762
33924
|
var addCommand = defineCommand({
|
|
33763
33925
|
meta: {
|
|
@@ -33816,6 +33978,10 @@ var addCommand = defineCommand({
|
|
|
33816
33978
|
type: "string",
|
|
33817
33979
|
description: "Comma-separated file paths"
|
|
33818
33980
|
},
|
|
33981
|
+
"files-infer": {
|
|
33982
|
+
type: "boolean",
|
|
33983
|
+
description: "Infer touched files from task title and description using GitNexus"
|
|
33984
|
+
},
|
|
33819
33985
|
acceptance: {
|
|
33820
33986
|
type: "string",
|
|
33821
33987
|
description: 'Pipe-separated acceptance criteria (e.g. "AC1|AC2|AC3")'
|
|
@@ -33900,7 +34066,18 @@ var addCommand = defineCommand({
|
|
|
33900
34066
|
params["description"] = args.desc;
|
|
33901
34067
|
}
|
|
33902
34068
|
if (args.labels) params["labels"] = args.labels.split(",").map((s) => s.trim());
|
|
33903
|
-
if (args
|
|
34069
|
+
if (args["files-infer"] && !args.files) {
|
|
34070
|
+
const inferredFiles = inferFilesViaGitNexus(args.title, args.description ?? args.desc);
|
|
34071
|
+
if (inferredFiles.length > 0) {
|
|
34072
|
+
params["files"] = inferredFiles;
|
|
34073
|
+
} else {
|
|
34074
|
+
process.stderr.write(
|
|
34075
|
+
"\u26A0 No files inferred by GitNexus. Use --files to specify files explicitly, or leave empty for atomicity check at spawn time.\n"
|
|
34076
|
+
);
|
|
34077
|
+
}
|
|
34078
|
+
} else if (args.files) {
|
|
34079
|
+
params["files"] = args.files.split(",").map((s) => s.trim());
|
|
34080
|
+
}
|
|
33904
34081
|
if (args.acceptance) {
|
|
33905
34082
|
const raw = args.acceptance;
|
|
33906
34083
|
if (raw.trimStart().startsWith("[")) {
|
|
@@ -33924,6 +34101,21 @@ var addCommand = defineCommand({
|
|
|
33924
34101
|
if (args.kind !== void 0) params["kind"] = args.kind;
|
|
33925
34102
|
if (args.scope !== void 0) params["scope"] = args.scope;
|
|
33926
34103
|
if (args.severity !== void 0) params["severity"] = args.severity;
|
|
34104
|
+
if (!params["parent"] && params["type"] !== "epic") {
|
|
34105
|
+
try {
|
|
34106
|
+
const projectRoot = getProjectRoot18();
|
|
34107
|
+
const { taskCurrentGet: taskCurrentGet2 } = await Promise.resolve().then(() => (init_session_engine(), session_engine_exports));
|
|
34108
|
+
const currentResult = await taskCurrentGet2(projectRoot);
|
|
34109
|
+
if (currentResult.success && currentResult.data?.currentTask) {
|
|
34110
|
+
params["parent"] = currentResult.data.currentTask;
|
|
34111
|
+
process.stderr.write(
|
|
34112
|
+
`[cleo add] inferred --parent from current task: ${currentResult.data.currentTask}
|
|
34113
|
+
`
|
|
34114
|
+
);
|
|
34115
|
+
}
|
|
34116
|
+
} catch {
|
|
34117
|
+
}
|
|
34118
|
+
}
|
|
33927
34119
|
const response = await dispatchRaw("mutate", "tasks", "add", params);
|
|
33928
34120
|
if (!response.success) {
|
|
33929
34121
|
handleRawError(response, { command: "add", operation: "tasks.add" });
|
|
@@ -36248,11 +36440,11 @@ var installCommand = defineCommand({
|
|
|
36248
36440
|
if (stat2.isFile() && ext === ".cant") {
|
|
36249
36441
|
cantPath = resolvedPath;
|
|
36250
36442
|
} else if (stat2.isFile() && ext === ".cantz") {
|
|
36251
|
-
const { execFileSync:
|
|
36443
|
+
const { execFileSync: execFileSync7 } = await import("node:child_process");
|
|
36252
36444
|
tempDir = join23(tmpdir(), `cleo-agent-install-${Date.now()}`);
|
|
36253
36445
|
mkdirSync5(tempDir, { recursive: true });
|
|
36254
36446
|
try {
|
|
36255
|
-
|
|
36447
|
+
execFileSync7("unzip", ["-o", "-q", resolvedPath, "-d", tempDir], {
|
|
36256
36448
|
encoding: "utf-8",
|
|
36257
36449
|
timeout: 3e4
|
|
36258
36450
|
});
|
|
@@ -36453,7 +36645,7 @@ var packCommand = defineCommand({
|
|
|
36453
36645
|
try {
|
|
36454
36646
|
const { existsSync: existsSync12, statSync } = await import("node:fs");
|
|
36455
36647
|
const { resolve: resolve5, basename: basename2, dirname: dirname11 } = await import("node:path");
|
|
36456
|
-
const { execFileSync:
|
|
36648
|
+
const { execFileSync: execFileSync7 } = await import("node:child_process");
|
|
36457
36649
|
const resolvedDir = resolve5(args.dir);
|
|
36458
36650
|
if (!existsSync12(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
|
|
36459
36651
|
cliOutput(
|
|
@@ -36490,7 +36682,7 @@ var packCommand = defineCommand({
|
|
|
36490
36682
|
const archivePath = resolve5(archiveName);
|
|
36491
36683
|
const parentDir = dirname11(resolvedDir);
|
|
36492
36684
|
try {
|
|
36493
|
-
|
|
36685
|
+
execFileSync7("zip", ["-r", archivePath, agentName], {
|
|
36494
36686
|
cwd: parentDir,
|
|
36495
36687
|
encoding: "utf-8",
|
|
36496
36688
|
timeout: 3e4
|
|
@@ -37493,8 +37685,113 @@ var archiveStatsCommand = defineCommand({
|
|
|
37493
37685
|
}
|
|
37494
37686
|
});
|
|
37495
37687
|
|
|
37688
|
+
// packages/cleo/src/cli/commands/audit.ts
|
|
37689
|
+
import { getProjectRoot as getProjectRoot19, reconstructLineage } from "@cleocode/core/internal";
|
|
37690
|
+
var reconstructCommand = defineCommand({
|
|
37691
|
+
meta: {
|
|
37692
|
+
name: "reconstruct",
|
|
37693
|
+
description: "Reconstruct git-backed lineage (commits + release tags) for a task"
|
|
37694
|
+
},
|
|
37695
|
+
args: {
|
|
37696
|
+
taskId: {
|
|
37697
|
+
type: "positional",
|
|
37698
|
+
description: "Task ID to reconstruct (e.g. T991)",
|
|
37699
|
+
required: true
|
|
37700
|
+
},
|
|
37701
|
+
json: {
|
|
37702
|
+
type: "boolean",
|
|
37703
|
+
description: "Emit raw JSON output instead of formatted summary",
|
|
37704
|
+
default: false
|
|
37705
|
+
},
|
|
37706
|
+
"repo-root": {
|
|
37707
|
+
type: "string",
|
|
37708
|
+
description: "Path to the git repository root (defaults to current project root)"
|
|
37709
|
+
}
|
|
37710
|
+
},
|
|
37711
|
+
async run({ args }) {
|
|
37712
|
+
const taskId = args["taskId"];
|
|
37713
|
+
if (!taskId || !/^T\d+$/i.test(taskId)) {
|
|
37714
|
+
process.stderr.write(
|
|
37715
|
+
`Error: taskId must match /^T\\d+$/ (e.g. T991). Got: ${JSON.stringify(taskId)}
|
|
37716
|
+
`
|
|
37717
|
+
);
|
|
37718
|
+
process.exit(1);
|
|
37719
|
+
}
|
|
37720
|
+
let repoRoot;
|
|
37721
|
+
if (args["repo-root"]) {
|
|
37722
|
+
repoRoot = args["repo-root"];
|
|
37723
|
+
} else {
|
|
37724
|
+
try {
|
|
37725
|
+
repoRoot = getProjectRoot19(process.cwd()) ?? process.cwd();
|
|
37726
|
+
} catch {
|
|
37727
|
+
repoRoot = process.cwd();
|
|
37728
|
+
}
|
|
37729
|
+
}
|
|
37730
|
+
const result = await reconstructLineage(taskId, repoRoot);
|
|
37731
|
+
if (args["json"]) {
|
|
37732
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
37733
|
+
`);
|
|
37734
|
+
return;
|
|
37735
|
+
}
|
|
37736
|
+
const lines = [
|
|
37737
|
+
`Lineage for ${result.taskId}`,
|
|
37738
|
+
`${"=".repeat(40)}`,
|
|
37739
|
+
"",
|
|
37740
|
+
`Direct commits: ${result.directCommits.length}`
|
|
37741
|
+
];
|
|
37742
|
+
for (const c of result.directCommits) {
|
|
37743
|
+
lines.push(` ${c.sha.slice(0, 10)} ${c.subject}`);
|
|
37744
|
+
}
|
|
37745
|
+
lines.push("");
|
|
37746
|
+
if (result.childIdRange) {
|
|
37747
|
+
lines.push(
|
|
37748
|
+
`Inferred children: ${result.inferredChildren.join(", ")} (${result.childIdRange.min} \u2192 ${result.childIdRange.max})`
|
|
37749
|
+
);
|
|
37750
|
+
} else {
|
|
37751
|
+
lines.push("Inferred children: none");
|
|
37752
|
+
}
|
|
37753
|
+
const childEntries = Object.entries(result.childCommits);
|
|
37754
|
+
if (childEntries.length > 0) {
|
|
37755
|
+
lines.push("");
|
|
37756
|
+
lines.push("Child commits:");
|
|
37757
|
+
for (const [childId, commits] of childEntries) {
|
|
37758
|
+
lines.push(` ${childId}: ${commits.length} commit(s)`);
|
|
37759
|
+
for (const c of commits) {
|
|
37760
|
+
lines.push(` ${c.sha.slice(0, 10)} ${c.subject}`);
|
|
37761
|
+
}
|
|
37762
|
+
}
|
|
37763
|
+
}
|
|
37764
|
+
lines.push("");
|
|
37765
|
+
if (result.releaseTags.length > 0) {
|
|
37766
|
+
lines.push(`Release tags (${result.releaseTags.length}):`);
|
|
37767
|
+
for (const t of result.releaseTags) {
|
|
37768
|
+
lines.push(` ${t.tag} ${t.commitSha.slice(0, 10)} ${t.subject}`);
|
|
37769
|
+
}
|
|
37770
|
+
} else {
|
|
37771
|
+
lines.push("Release tags: none found");
|
|
37772
|
+
}
|
|
37773
|
+
lines.push("");
|
|
37774
|
+
lines.push(`First seen: ${result.firstSeenAt ?? "n/a"}`);
|
|
37775
|
+
lines.push(`Last seen: ${result.lastSeenAt ?? "n/a"}`);
|
|
37776
|
+
process.stdout.write(`${lines.join("\n")}
|
|
37777
|
+
`);
|
|
37778
|
+
}
|
|
37779
|
+
});
|
|
37780
|
+
var auditCommand = defineCommand({
|
|
37781
|
+
meta: {
|
|
37782
|
+
name: "audit",
|
|
37783
|
+
description: "Git-backed audit tooling (lineage reconstruction, integrity checks)"
|
|
37784
|
+
},
|
|
37785
|
+
subCommands: {
|
|
37786
|
+
reconstruct: reconstructCommand
|
|
37787
|
+
},
|
|
37788
|
+
async run({ args: _args }) {
|
|
37789
|
+
await showUsage(auditCommand);
|
|
37790
|
+
}
|
|
37791
|
+
});
|
|
37792
|
+
|
|
37496
37793
|
// packages/cleo/src/cli/commands/backfill.ts
|
|
37497
|
-
import { backfillTasks, getProjectRoot as
|
|
37794
|
+
import { backfillTasks, getProjectRoot as getProjectRoot20, populateEmbeddings } from "@cleocode/core/internal";
|
|
37498
37795
|
init_renderers();
|
|
37499
37796
|
var backfillCommand = defineCommand({
|
|
37500
37797
|
meta: {
|
|
@@ -37523,7 +37820,7 @@ var backfillCommand = defineCommand({
|
|
|
37523
37820
|
}
|
|
37524
37821
|
},
|
|
37525
37822
|
async run({ args }) {
|
|
37526
|
-
const root =
|
|
37823
|
+
const root = getProjectRoot20();
|
|
37527
37824
|
if (args.embeddings) {
|
|
37528
37825
|
try {
|
|
37529
37826
|
let lastLine = "";
|
|
@@ -38012,9 +38309,9 @@ var exportCommand = defineCommand({
|
|
|
38012
38309
|
},
|
|
38013
38310
|
async run({ args }) {
|
|
38014
38311
|
const scope = args.scope;
|
|
38015
|
-
const { packBundle, getProjectRoot:
|
|
38312
|
+
const { packBundle, getProjectRoot: getProjectRoot31 } = await import("@cleocode/core/internal");
|
|
38016
38313
|
const includesProject = scope === "project" || scope === "all";
|
|
38017
|
-
const projectRoot = includesProject ?
|
|
38314
|
+
const projectRoot = includesProject ? getProjectRoot31() : void 0;
|
|
38018
38315
|
let passphrase;
|
|
38019
38316
|
if (args.encrypt === true) {
|
|
38020
38317
|
passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
|
|
@@ -38342,7 +38639,7 @@ import {
|
|
|
38342
38639
|
exportBrainAsJson,
|
|
38343
38640
|
getMemoryQualityReport,
|
|
38344
38641
|
getPlasticityStats,
|
|
38345
|
-
getProjectRoot as
|
|
38642
|
+
getProjectRoot as getProjectRoot21,
|
|
38346
38643
|
purgeBrainNoise,
|
|
38347
38644
|
runBrainMaintenance
|
|
38348
38645
|
} from "@cleocode/core/internal";
|
|
@@ -38375,7 +38672,7 @@ var maintenanceCommand = defineCommand({
|
|
|
38375
38672
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38376
38673
|
},
|
|
38377
38674
|
async run({ args }) {
|
|
38378
|
-
const root =
|
|
38675
|
+
const root = getProjectRoot21();
|
|
38379
38676
|
const isJson = !!args.json;
|
|
38380
38677
|
if (!isJson) {
|
|
38381
38678
|
console.log("Running brain maintenance...");
|
|
@@ -38455,7 +38752,7 @@ var backfillCommand2 = defineCommand({
|
|
|
38455
38752
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38456
38753
|
},
|
|
38457
38754
|
async run({ args }) {
|
|
38458
|
-
const root =
|
|
38755
|
+
const root = getProjectRoot21();
|
|
38459
38756
|
const isJson = !!args.json;
|
|
38460
38757
|
if (!isJson) {
|
|
38461
38758
|
console.log("Running brain graph back-fill...");
|
|
@@ -38510,7 +38807,7 @@ var purgeCommand = defineCommand({
|
|
|
38510
38807
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38511
38808
|
},
|
|
38512
38809
|
async run({ args }) {
|
|
38513
|
-
const root =
|
|
38810
|
+
const root = getProjectRoot21();
|
|
38514
38811
|
const isJson = !!args.json;
|
|
38515
38812
|
if (!isJson) {
|
|
38516
38813
|
console.log("Running brain noise purge...");
|
|
@@ -38568,7 +38865,7 @@ var plasticityStatsCommand = defineCommand({
|
|
|
38568
38865
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38569
38866
|
},
|
|
38570
38867
|
async run({ args }) {
|
|
38571
|
-
const root =
|
|
38868
|
+
const root = getProjectRoot21();
|
|
38572
38869
|
const isJson = !!args.json;
|
|
38573
38870
|
const limit = Number.parseInt(args.limit, 10) || 20;
|
|
38574
38871
|
try {
|
|
@@ -38641,7 +38938,7 @@ var qualityCommand = defineCommand({
|
|
|
38641
38938
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38642
38939
|
},
|
|
38643
38940
|
async run({ args }) {
|
|
38644
|
-
const root =
|
|
38941
|
+
const root = getProjectRoot21();
|
|
38645
38942
|
const isJson = !!args.json;
|
|
38646
38943
|
try {
|
|
38647
38944
|
const report = await getMemoryQualityReport(root);
|
|
@@ -38718,7 +39015,7 @@ var exportCommand2 = defineCommand({
|
|
|
38718
39015
|
}
|
|
38719
39016
|
},
|
|
38720
39017
|
async run({ args }) {
|
|
38721
|
-
const root =
|
|
39018
|
+
const root = getProjectRoot21();
|
|
38722
39019
|
const format = args.format ?? "gexf";
|
|
38723
39020
|
if (format !== "gexf" && format !== "json") {
|
|
38724
39021
|
console.error(`Invalid format: ${format}. Use 'gexf' or 'json'.`);
|
|
@@ -40026,7 +40323,7 @@ var trendCommand = defineCommand({
|
|
|
40026
40323
|
);
|
|
40027
40324
|
}
|
|
40028
40325
|
});
|
|
40029
|
-
var
|
|
40326
|
+
var auditCommand2 = defineCommand({
|
|
40030
40327
|
meta: {
|
|
40031
40328
|
name: "audit",
|
|
40032
40329
|
description: "Check compliance for a specific task and its subtasks"
|
|
@@ -40178,7 +40475,7 @@ var complianceCommand = defineCommand({
|
|
|
40178
40475
|
summary: summaryCommand,
|
|
40179
40476
|
violations: violationsCommand,
|
|
40180
40477
|
trend: trendCommand,
|
|
40181
|
-
audit:
|
|
40478
|
+
audit: auditCommand2,
|
|
40182
40479
|
sync: syncCommand2,
|
|
40183
40480
|
skills: skillsCommand,
|
|
40184
40481
|
value: valueCommand,
|
|
@@ -41911,7 +42208,7 @@ import {
|
|
|
41911
42208
|
exportDocument,
|
|
41912
42209
|
formatError as formatError5,
|
|
41913
42210
|
getAgentOutputsAbsolute,
|
|
41914
|
-
getProjectRoot as
|
|
42211
|
+
getProjectRoot as getProjectRoot22,
|
|
41915
42212
|
listDocVersions,
|
|
41916
42213
|
mergeDocs,
|
|
41917
42214
|
publishDocs,
|
|
@@ -42200,7 +42497,7 @@ var exportCommand4 = defineCommand({
|
|
|
42200
42497
|
const taskId = String(args.task);
|
|
42201
42498
|
const includeAttachments = args["include-attachments"] !== false;
|
|
42202
42499
|
const includeMemoryRefs = args["include-memory-refs"] === true;
|
|
42203
|
-
const projectRoot =
|
|
42500
|
+
const projectRoot = getProjectRoot22();
|
|
42204
42501
|
try {
|
|
42205
42502
|
const result = await exportDocument({
|
|
42206
42503
|
taskId,
|
|
@@ -42264,7 +42561,7 @@ var searchCommand = defineCommand({
|
|
|
42264
42561
|
}
|
|
42265
42562
|
},
|
|
42266
42563
|
async run({ args }) {
|
|
42267
|
-
const projectRoot =
|
|
42564
|
+
const projectRoot = getProjectRoot22();
|
|
42268
42565
|
try {
|
|
42269
42566
|
const result = await searchDocs(String(args.query), {
|
|
42270
42567
|
ownerId: args.owner ?? void 0,
|
|
@@ -42316,7 +42613,7 @@ var mergeCommand = defineCommand({
|
|
|
42316
42613
|
}
|
|
42317
42614
|
},
|
|
42318
42615
|
async run({ args }) {
|
|
42319
|
-
const projectRoot =
|
|
42616
|
+
const projectRoot = getProjectRoot22();
|
|
42320
42617
|
const rawStrategy = args.strategy ?? "three-way";
|
|
42321
42618
|
const strategy = rawStrategy === "cherry-pick" || rawStrategy === "multi-diff" ? rawStrategy : "three-way";
|
|
42322
42619
|
try {
|
|
@@ -42367,7 +42664,7 @@ var graphCommand = defineCommand({
|
|
|
42367
42664
|
}
|
|
42368
42665
|
},
|
|
42369
42666
|
async run({ args }) {
|
|
42370
|
-
const projectRoot =
|
|
42667
|
+
const projectRoot = getProjectRoot22();
|
|
42371
42668
|
const fmt = args.format ?? "mermaid";
|
|
42372
42669
|
try {
|
|
42373
42670
|
const result = await buildDocsGraph({ ownerId: String(args.for), projectRoot });
|
|
@@ -42438,7 +42735,7 @@ var rankCommand = defineCommand({
|
|
|
42438
42735
|
}
|
|
42439
42736
|
},
|
|
42440
42737
|
async run({ args }) {
|
|
42441
|
-
const projectRoot =
|
|
42738
|
+
const projectRoot = getProjectRoot22();
|
|
42442
42739
|
try {
|
|
42443
42740
|
const result = await rankDocs({
|
|
42444
42741
|
ownerId: String(args.for),
|
|
@@ -42477,7 +42774,7 @@ var versionsCommand = defineCommand({
|
|
|
42477
42774
|
}
|
|
42478
42775
|
},
|
|
42479
42776
|
async run({ args }) {
|
|
42480
|
-
const projectRoot =
|
|
42777
|
+
const projectRoot = getProjectRoot22();
|
|
42481
42778
|
try {
|
|
42482
42779
|
const result = await listDocVersions({
|
|
42483
42780
|
ownerId: String(args.for),
|
|
@@ -42521,7 +42818,7 @@ var publishCommand2 = defineCommand({
|
|
|
42521
42818
|
}
|
|
42522
42819
|
},
|
|
42523
42820
|
async run({ args }) {
|
|
42524
|
-
const projectRoot =
|
|
42821
|
+
const projectRoot = getProjectRoot22();
|
|
42525
42822
|
try {
|
|
42526
42823
|
const result = await publishDocs({
|
|
42527
42824
|
ownerId: String(args.for),
|
|
@@ -43468,10 +43765,10 @@ var gcCommand = defineCommand({
|
|
|
43468
43765
|
|
|
43469
43766
|
// packages/cleo/src/cli/commands/generate-changelog.ts
|
|
43470
43767
|
init_src();
|
|
43471
|
-
import { execFileSync as
|
|
43768
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
43472
43769
|
import { existsSync as existsSync10, mkdirSync as mkdirSync3, readFileSync as readFileSync12, writeFileSync as writeFileSync3 } from "node:fs";
|
|
43473
43770
|
import { dirname as dirname9, join as join16 } from "node:path";
|
|
43474
|
-
import { CleoError as CleoError4, formatError as formatError6, getConfigPath as getConfigPath2, getProjectRoot as
|
|
43771
|
+
import { CleoError as CleoError4, formatError as formatError6, getConfigPath as getConfigPath2, getProjectRoot as getProjectRoot23 } from "@cleocode/core";
|
|
43475
43772
|
init_renderers();
|
|
43476
43773
|
function getChangelogSource(cwd) {
|
|
43477
43774
|
const configPath = getConfigPath2(cwd);
|
|
@@ -43503,9 +43800,9 @@ function getDefaultOutputPath(platform) {
|
|
|
43503
43800
|
}
|
|
43504
43801
|
}
|
|
43505
43802
|
function getGitHubRepoSlug(cwd) {
|
|
43506
|
-
const projectRoot =
|
|
43803
|
+
const projectRoot = getProjectRoot23(cwd);
|
|
43507
43804
|
try {
|
|
43508
|
-
const remoteUrl =
|
|
43805
|
+
const remoteUrl = execFileSync4("git", ["remote", "get-url", "origin"], {
|
|
43509
43806
|
cwd: projectRoot,
|
|
43510
43807
|
encoding: "utf-8",
|
|
43511
43808
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -43629,7 +43926,7 @@ var generateChangelogCommand = defineCommand({
|
|
|
43629
43926
|
const targetPlatform = args.platform;
|
|
43630
43927
|
const dryRun = args["dry-run"] === true;
|
|
43631
43928
|
const sourceFile = getChangelogSource();
|
|
43632
|
-
const sourcePath = join16(
|
|
43929
|
+
const sourcePath = join16(getProjectRoot23(), sourceFile);
|
|
43633
43930
|
if (!existsSync10(sourcePath)) {
|
|
43634
43931
|
throw new CleoError4(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
|
|
43635
43932
|
}
|
|
@@ -43642,7 +43939,7 @@ var generateChangelogCommand = defineCommand({
|
|
|
43642
43939
|
const outputPath = platformConfig?.path ?? getDefaultOutputPath(targetPlatform);
|
|
43643
43940
|
const content = generateForPlatform(targetPlatform, sourceContent, repoSlug, limit);
|
|
43644
43941
|
if (!dryRun) {
|
|
43645
|
-
const fullPath = join16(
|
|
43942
|
+
const fullPath = join16(getProjectRoot23(), outputPath);
|
|
43646
43943
|
mkdirSync3(dirname9(fullPath), { recursive: true });
|
|
43647
43944
|
writeFileSync3(fullPath, content, "utf-8");
|
|
43648
43945
|
}
|
|
@@ -43663,7 +43960,7 @@ var generateChangelogCommand = defineCommand({
|
|
|
43663
43960
|
limit
|
|
43664
43961
|
);
|
|
43665
43962
|
if (!dryRun) {
|
|
43666
|
-
const fullPath = join16(
|
|
43963
|
+
const fullPath = join16(getProjectRoot23(), platformConfig.path);
|
|
43667
43964
|
mkdirSync3(dirname9(fullPath), { recursive: true });
|
|
43668
43965
|
writeFileSync3(fullPath, content, "utf-8");
|
|
43669
43966
|
}
|
|
@@ -44253,7 +44550,7 @@ var intelligenceCommand = defineCommand({
|
|
|
44253
44550
|
});
|
|
44254
44551
|
|
|
44255
44552
|
// packages/cleo/src/cli/commands/issue.ts
|
|
44256
|
-
import { execFileSync as
|
|
44553
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
44257
44554
|
import { addIssue, BUILD_CONFIG } from "@cleocode/core/internal";
|
|
44258
44555
|
init_cli();
|
|
44259
44556
|
init_renderers();
|
|
@@ -44277,7 +44574,7 @@ async function handleIssueType(issueType, opts) {
|
|
|
44277
44574
|
if (opts["open"] && typeof result.url === "string" && result.url.startsWith("https://")) {
|
|
44278
44575
|
const issueNumber = result.url.match(/(\d+)$/)?.[1] ?? "unknown";
|
|
44279
44576
|
try {
|
|
44280
|
-
|
|
44577
|
+
execFileSync5("gh", ["issue", "view", issueNumber, "--repo", CLEO_REPO, "--web"], {
|
|
44281
44578
|
stdio: ["pipe", "pipe", "pipe"]
|
|
44282
44579
|
});
|
|
44283
44580
|
} catch {
|
|
@@ -45079,7 +45376,7 @@ import { join as join17 } from "node:path";
|
|
|
45079
45376
|
import {
|
|
45080
45377
|
getBrainDb as getBrainDb2,
|
|
45081
45378
|
getBrainNativeDb as getBrainNativeDb3,
|
|
45082
|
-
getProjectRoot as
|
|
45379
|
+
getProjectRoot as getProjectRoot24,
|
|
45083
45380
|
runConsolidation,
|
|
45084
45381
|
triggerManualDream
|
|
45085
45382
|
} from "@cleocode/core/internal";
|
|
@@ -45988,7 +46285,7 @@ var consolidateCommand = defineCommand({
|
|
|
45988
46285
|
}
|
|
45989
46286
|
},
|
|
45990
46287
|
async run({ args }) {
|
|
45991
|
-
const root =
|
|
46288
|
+
const root = getProjectRoot24();
|
|
45992
46289
|
const isJson = !!args.json;
|
|
45993
46290
|
if (!isJson) {
|
|
45994
46291
|
console.log("Running memory consolidation (including tier promotion)...");
|
|
@@ -46053,7 +46350,7 @@ var dreamCommand = defineCommand({
|
|
|
46053
46350
|
}
|
|
46054
46351
|
},
|
|
46055
46352
|
async run({ args }) {
|
|
46056
|
-
const root =
|
|
46353
|
+
const root = getProjectRoot24();
|
|
46057
46354
|
const isJson = !!args.json;
|
|
46058
46355
|
if (!isJson) {
|
|
46059
46356
|
console.log("Triggering dream cycle (full consolidation including STDP plasticity)...");
|
|
@@ -46131,7 +46428,7 @@ var reflectCommand = defineCommand({
|
|
|
46131
46428
|
}
|
|
46132
46429
|
},
|
|
46133
46430
|
async run({ args }) {
|
|
46134
|
-
const root =
|
|
46431
|
+
const root = getProjectRoot24();
|
|
46135
46432
|
const isJson = !!args.json;
|
|
46136
46433
|
if (!isJson) {
|
|
46137
46434
|
console.log("Running Observer + Reflector pipeline...");
|
|
@@ -46216,7 +46513,7 @@ var dedupScanCommand = defineCommand({
|
|
|
46216
46513
|
}
|
|
46217
46514
|
},
|
|
46218
46515
|
async run({ args }) {
|
|
46219
|
-
const root =
|
|
46516
|
+
const root = getProjectRoot24();
|
|
46220
46517
|
const isJson = !!args.json;
|
|
46221
46518
|
if (!isJson) {
|
|
46222
46519
|
console.log("Scanning brain.db for duplicate entries...");
|
|
@@ -46376,7 +46673,7 @@ var importCommand3 = defineCommand({
|
|
|
46376
46673
|
const sourceDir = args.from ?? join17(homedir4(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
|
|
46377
46674
|
const isDryRun = !!args["dry-run"];
|
|
46378
46675
|
const isJson = !!args.json;
|
|
46379
|
-
const projectRoot =
|
|
46676
|
+
const projectRoot = getProjectRoot24();
|
|
46380
46677
|
const stateFile = join17(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
|
|
46381
46678
|
if (!existsSync11(sourceDir)) {
|
|
46382
46679
|
const msg = `Source directory not found: ${sourceDir}`;
|
|
@@ -46629,7 +46926,7 @@ var tierStatsCommand = defineCommand({
|
|
|
46629
46926
|
}
|
|
46630
46927
|
},
|
|
46631
46928
|
async run({ args }) {
|
|
46632
|
-
const root =
|
|
46929
|
+
const root = getProjectRoot24();
|
|
46633
46930
|
const isJson = !!args.json;
|
|
46634
46931
|
try {
|
|
46635
46932
|
await getBrainDb2(root);
|
|
@@ -46773,7 +47070,7 @@ var tierPromoteCommand = defineCommand({
|
|
|
46773
47070
|
}
|
|
46774
47071
|
},
|
|
46775
47072
|
async run({ args }) {
|
|
46776
|
-
const root =
|
|
47073
|
+
const root = getProjectRoot24();
|
|
46777
47074
|
const isJson = !!args.json;
|
|
46778
47075
|
const targetTier = args.to;
|
|
46779
47076
|
const reason = args.reason;
|
|
@@ -46919,7 +47216,7 @@ var tierDemoteCommand = defineCommand({
|
|
|
46919
47216
|
}
|
|
46920
47217
|
},
|
|
46921
47218
|
async run({ args }) {
|
|
46922
|
-
const root =
|
|
47219
|
+
const root = getProjectRoot24();
|
|
46923
47220
|
const isJson = !!args.json;
|
|
46924
47221
|
const targetTier = args.to;
|
|
46925
47222
|
const reason = args.reason;
|
|
@@ -47455,7 +47752,7 @@ var memoryCommand = defineCommand({
|
|
|
47455
47752
|
});
|
|
47456
47753
|
|
|
47457
47754
|
// packages/cleo/src/cli/commands/migrate-claude-mem.ts
|
|
47458
|
-
import { getProjectRoot as
|
|
47755
|
+
import { getProjectRoot as getProjectRoot25, migrateClaudeMem } from "@cleocode/core/internal";
|
|
47459
47756
|
import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
|
|
47460
47757
|
import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
|
|
47461
47758
|
init_cli();
|
|
@@ -47512,7 +47809,7 @@ var claudeMemCommand = defineCommand({
|
|
|
47512
47809
|
}
|
|
47513
47810
|
},
|
|
47514
47811
|
async run({ args }) {
|
|
47515
|
-
const root =
|
|
47812
|
+
const root = getProjectRoot25();
|
|
47516
47813
|
try {
|
|
47517
47814
|
const result = await migrateClaudeMem(root, {
|
|
47518
47815
|
sourcePath: args.source,
|
|
@@ -47561,7 +47858,7 @@ var manifestIngestCommand = defineCommand({
|
|
|
47561
47858
|
}
|
|
47562
47859
|
},
|
|
47563
47860
|
async run({ args }) {
|
|
47564
|
-
const projectRoot =
|
|
47861
|
+
const projectRoot = getProjectRoot25();
|
|
47565
47862
|
try {
|
|
47566
47863
|
const db = await getDb2(projectRoot);
|
|
47567
47864
|
const rcasdFlag = Boolean(args.rcasd);
|
|
@@ -49295,7 +49592,7 @@ var analyzeCommand3 = defineCommand({
|
|
|
49295
49592
|
);
|
|
49296
49593
|
}
|
|
49297
49594
|
try {
|
|
49298
|
-
const [{ getNexusDb: getNexusDb2, nexusSchema }, { runPipeline }, { getProjectRoot:
|
|
49595
|
+
const [{ getNexusDb: getNexusDb2, nexusSchema }, { runPipeline }, { getProjectRoot: getProjectRoot31 }, { eq: eq2 }] = await Promise.all([
|
|
49299
49596
|
import("@cleocode/core/store/nexus-sqlite"),
|
|
49300
49597
|
import("@cleocode/nexus/pipeline"),
|
|
49301
49598
|
import("@cleocode/core/internal"),
|
|
@@ -49401,7 +49698,7 @@ var analyzeCommand3 = defineCommand({
|
|
|
49401
49698
|
`
|
|
49402
49699
|
);
|
|
49403
49700
|
}
|
|
49404
|
-
void
|
|
49701
|
+
void getProjectRoot31;
|
|
49405
49702
|
} catch (err) {
|
|
49406
49703
|
const msg = err instanceof Error ? err.message : String(err);
|
|
49407
49704
|
if (jsonOutput) {
|
|
@@ -53906,14 +54203,14 @@ var reasonCommand = defineCommand({
|
|
|
53906
54203
|
});
|
|
53907
54204
|
|
|
53908
54205
|
// packages/cleo/src/cli/commands/refresh-memory.ts
|
|
53909
|
-
import { getProjectRoot as
|
|
54206
|
+
import { getProjectRoot as getProjectRoot26 } from "@cleocode/core";
|
|
53910
54207
|
var refreshMemoryCommand = defineCommand({
|
|
53911
54208
|
meta: {
|
|
53912
54209
|
name: "refresh-memory",
|
|
53913
54210
|
description: "Regenerate .cleo/memory-bridge.md from brain.db"
|
|
53914
54211
|
},
|
|
53915
54212
|
async run() {
|
|
53916
|
-
const projectDir =
|
|
54213
|
+
const projectDir = getProjectRoot26();
|
|
53917
54214
|
const { writeMemoryBridge } = await import("@cleocode/core/internal");
|
|
53918
54215
|
const result = await writeMemoryBridge(projectDir);
|
|
53919
54216
|
if (result.written) {
|
|
@@ -55018,7 +55315,7 @@ init_src();
|
|
|
55018
55315
|
import fs3 from "node:fs";
|
|
55019
55316
|
import path4 from "node:path";
|
|
55020
55317
|
import { CleoError as CleoError8, formatError as formatError10, getAccessor as getAccessor9 } from "@cleocode/core";
|
|
55021
|
-
import { getProjectRoot as
|
|
55318
|
+
import { getProjectRoot as getProjectRoot27 } from "@cleocode/core/internal";
|
|
55022
55319
|
init_cli();
|
|
55023
55320
|
init_paths();
|
|
55024
55321
|
init_renderers();
|
|
@@ -55132,7 +55429,7 @@ var finalizeCommand = defineCommand({
|
|
|
55132
55429
|
description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
|
|
55133
55430
|
},
|
|
55134
55431
|
async run() {
|
|
55135
|
-
const projectRoot =
|
|
55432
|
+
const projectRoot = getProjectRoot27();
|
|
55136
55433
|
const reportPath = path4.join(projectRoot, CLEO_DIR_NAME, RESTORE_CONFLICTS_MD);
|
|
55137
55434
|
if (!fs3.existsSync(reportPath)) {
|
|
55138
55435
|
console.log("No pending restore conflicts. Nothing to finalize.");
|
|
@@ -56843,7 +57140,7 @@ var sentientCommand = defineCommand({
|
|
|
56843
57140
|
});
|
|
56844
57141
|
|
|
56845
57142
|
// packages/cleo/src/cli/commands/sequence.ts
|
|
56846
|
-
import { getProjectRoot as
|
|
57143
|
+
import { getProjectRoot as getProjectRoot28 } from "@cleocode/core/internal";
|
|
56847
57144
|
init_cli();
|
|
56848
57145
|
init_renderers();
|
|
56849
57146
|
var showCommand12 = defineCommand({
|
|
@@ -56874,7 +57171,7 @@ var repairCommand = defineCommand({
|
|
|
56874
57171
|
meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
|
|
56875
57172
|
async run() {
|
|
56876
57173
|
const { systemSequenceRepair: systemSequenceRepair2 } = await Promise.resolve().then(() => (init_system_engine(), system_engine_exports));
|
|
56877
|
-
const projectRoot =
|
|
57174
|
+
const projectRoot = getProjectRoot28();
|
|
56878
57175
|
const result = await systemSequenceRepair2(projectRoot);
|
|
56879
57176
|
cliOutput(result, { command: "sequence", operation: "admin.sequence.repair" });
|
|
56880
57177
|
}
|
|
@@ -58701,7 +58998,7 @@ var tokenCommand = defineCommand({
|
|
|
58701
58998
|
// packages/cleo/src/cli/commands/transcript.ts
|
|
58702
58999
|
import { homedir as homedir5 } from "node:os";
|
|
58703
59000
|
import { join as join20 } from "node:path";
|
|
58704
|
-
import { getProjectRoot as
|
|
59001
|
+
import { getProjectRoot as getProjectRoot29 } from "@cleocode/core";
|
|
58705
59002
|
import {
|
|
58706
59003
|
parseDurationMs,
|
|
58707
59004
|
pruneTranscripts,
|
|
@@ -58729,7 +59026,7 @@ var scanCommand = defineCommand({
|
|
|
58729
59026
|
async run({ args }) {
|
|
58730
59027
|
if (args.pending) {
|
|
58731
59028
|
try {
|
|
58732
|
-
const projectRoot =
|
|
59029
|
+
const projectRoot = getProjectRoot29();
|
|
58733
59030
|
const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
58734
59031
|
const pending = await scanPendingTranscripts(projectRoot);
|
|
58735
59032
|
const envelope = { success: true, data: { count: pending.length, pending } };
|
|
@@ -58862,7 +59159,7 @@ var extractCommand = defineCommand({
|
|
|
58862
59159
|
async run({ args }) {
|
|
58863
59160
|
const tier = args.tier ?? "warm";
|
|
58864
59161
|
const dryRun = args["dry-run"] ?? false;
|
|
58865
|
-
const projectRoot =
|
|
59162
|
+
const projectRoot = getProjectRoot29();
|
|
58866
59163
|
try {
|
|
58867
59164
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
58868
59165
|
const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -58993,7 +59290,7 @@ var migrateCommand2 = defineCommand({
|
|
|
58993
59290
|
const dryRun = args["dry-run"] ?? false;
|
|
58994
59291
|
const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
|
|
58995
59292
|
const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
|
|
58996
|
-
const projectRoot =
|
|
59293
|
+
const projectRoot = getProjectRoot29();
|
|
58997
59294
|
try {
|
|
58998
59295
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
58999
59296
|
const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -59567,7 +59864,7 @@ var verifyCommand2 = defineCommand({
|
|
|
59567
59864
|
|
|
59568
59865
|
// packages/cleo/src/cli/commands/web.ts
|
|
59569
59866
|
init_src();
|
|
59570
|
-
import { execFileSync as
|
|
59867
|
+
import { execFileSync as execFileSync6, spawn } from "node:child_process";
|
|
59571
59868
|
import { mkdir as mkdir4, open, readFile as readFile5, rm, stat, writeFile as writeFile2 } from "node:fs/promises";
|
|
59572
59869
|
import { join as join21 } from "node:path";
|
|
59573
59870
|
import { CleoError as CleoError12, formatError as formatError14, getCleoHome as getCleoHome3 } from "@cleocode/core";
|
|
@@ -59634,7 +59931,7 @@ async function startWebServer(port, host) {
|
|
|
59634
59931
|
await stat(webIndexPath);
|
|
59635
59932
|
} catch {
|
|
59636
59933
|
try {
|
|
59637
|
-
|
|
59934
|
+
execFileSync6("pnpm", ["--filter", "@cleocode/studio", "run", "build"], {
|
|
59638
59935
|
cwd: projectRoot,
|
|
59639
59936
|
stdio: "ignore"
|
|
59640
59937
|
});
|
|
@@ -59928,6 +60225,7 @@ subCommands["admin"] = adminCommand;
|
|
|
59928
60225
|
subCommands["adr"] = adrCommand;
|
|
59929
60226
|
subCommands["agent"] = agentCommand;
|
|
59930
60227
|
subCommands["analyze"] = analyzeCommand;
|
|
60228
|
+
subCommands["audit"] = auditCommand;
|
|
59931
60229
|
subCommands["archive"] = archiveCommand;
|
|
59932
60230
|
subCommands["archive-stats"] = archiveStatsCommand;
|
|
59933
60231
|
subCommands["backfill"] = backfillCommand;
|
|
@@ -60061,12 +60359,12 @@ subCommands["pipeline"] = phaseCommand;
|
|
|
60061
60359
|
} catch {
|
|
60062
60360
|
}
|
|
60063
60361
|
try {
|
|
60064
|
-
detectAndRemoveStrayProjectNexus(
|
|
60362
|
+
detectAndRemoveStrayProjectNexus(getProjectRoot30());
|
|
60065
60363
|
} catch {
|
|
60066
60364
|
}
|
|
60067
60365
|
const _startupLog = getLogger18("cli-startup");
|
|
60068
60366
|
try {
|
|
60069
|
-
const _projectRootForMigration =
|
|
60367
|
+
const _projectRootForMigration = getProjectRoot30();
|
|
60070
60368
|
if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
|
|
60071
60369
|
const migrationResult = migrateSignaldockToConduit(_projectRootForMigration);
|
|
60072
60370
|
if (migrationResult.status === "failed") {
|
|
@@ -60086,7 +60384,7 @@ subCommands["pipeline"] = phaseCommand;
|
|
|
60086
60384
|
}
|
|
60087
60385
|
}
|
|
60088
60386
|
try {
|
|
60089
|
-
ensureConduitDb(
|
|
60387
|
+
ensureConduitDb(getProjectRoot30());
|
|
60090
60388
|
} catch {
|
|
60091
60389
|
}
|
|
60092
60390
|
try {
|
|
@@ -60124,6 +60422,26 @@ var main = defineCommand({
|
|
|
60124
60422
|
});
|
|
60125
60423
|
var aliasMap = buildAliasMap(subCommands);
|
|
60126
60424
|
var customShowUsage = createCustomShowUsage(CLI_VERSION, subCommands, aliasMap);
|
|
60425
|
+
{
|
|
60426
|
+
const rawArgs = process.argv.slice(2);
|
|
60427
|
+
const firstArg = rawArgs[0];
|
|
60428
|
+
if (firstArg && !firstArg.startsWith("-") && firstArg !== "--help" && firstArg !== "-h" && firstArg !== "--version" && firstArg !== "-V") {
|
|
60429
|
+
const availableCommands = Object.keys(subCommands);
|
|
60430
|
+
if (!availableCommands.includes(firstArg)) {
|
|
60431
|
+
const suggestions = didYouMean(firstArg, availableCommands, 3);
|
|
60432
|
+
process.stderr.write(`Unknown command ${firstArg}
|
|
60433
|
+
`);
|
|
60434
|
+
if (suggestions.length > 0) {
|
|
60435
|
+
process.stderr.write("\nDid you mean one of:\n");
|
|
60436
|
+
for (const suggestion of suggestions) {
|
|
60437
|
+
process.stderr.write(` cleo ${suggestion}
|
|
60438
|
+
`);
|
|
60439
|
+
}
|
|
60440
|
+
}
|
|
60441
|
+
process.exit(127);
|
|
60442
|
+
}
|
|
60443
|
+
}
|
|
60444
|
+
}
|
|
60127
60445
|
runMain(main, { showUsage: customShowUsage });
|
|
60128
60446
|
/*! Bundled license information:
|
|
60129
60447
|
|