@cleocode/cleo 2026.4.132 → 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 +461 -73
- 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;
|
|
@@ -29626,8 +29710,31 @@ var init_sentient = __esm({
|
|
|
29626
29710
|
}
|
|
29627
29711
|
/**
|
|
29628
29712
|
* Enable or disable Tier-2 proposal generation.
|
|
29713
|
+
*
|
|
29714
|
+
* When `enabled=true`, enforces the M7 gate (T-COUNCIL-RECONCILIATION-2026-04-24):
|
|
29715
|
+
* `cleo memory doctor --assert-clean` must pass before Tier-2 is activated.
|
|
29716
|
+
* Returns `E_M7_GATE_FAILED` if the brain corpus is not clean.
|
|
29717
|
+
*
|
|
29718
|
+
* @task T1148 W8-7
|
|
29629
29719
|
*/
|
|
29630
29720
|
async setTier2Enabled(projectRoot, enabled) {
|
|
29721
|
+
if (enabled) {
|
|
29722
|
+
try {
|
|
29723
|
+
const { scanBrainNoise } = await import("@cleocode/core/memory/brain-doctor.js");
|
|
29724
|
+
const doctorResult = await scanBrainNoise(projectRoot);
|
|
29725
|
+
if (!doctorResult.isClean) {
|
|
29726
|
+
return {
|
|
29727
|
+
success: false,
|
|
29728
|
+
error: {
|
|
29729
|
+
code: "E_M7_GATE_FAILED",
|
|
29730
|
+
message: `M7 gate blocked: brain corpus has ${doctorResult.findings.length} noise pattern(s) across ${doctorResult.totalScanned} entries. Run \`cleo memory doctor\` for details, then \`cleo memory sweep --approve\` to clean before enabling Sentient v1.`,
|
|
29731
|
+
details: { findings: doctorResult.findings, totalScanned: doctorResult.totalScanned }
|
|
29732
|
+
}
|
|
29733
|
+
};
|
|
29734
|
+
}
|
|
29735
|
+
} catch {
|
|
29736
|
+
}
|
|
29737
|
+
}
|
|
29631
29738
|
const { patchSentientState: patchSentientState2 } = await import("@cleocode/core/sentient/state.js");
|
|
29632
29739
|
const { SENTIENT_STATE_FILE: SENTIENT_STATE_FILE2 } = await import("@cleocode/core/sentient/daemon.js");
|
|
29633
29740
|
const statePath = join6(projectRoot, SENTIENT_STATE_FILE2);
|
|
@@ -32605,11 +32712,11 @@ var init_security = __esm({
|
|
|
32605
32712
|
});
|
|
32606
32713
|
|
|
32607
32714
|
// packages/cleo/src/dispatch/middleware/sanitizer.ts
|
|
32608
|
-
function createSanitizer(
|
|
32715
|
+
function createSanitizer(getProjectRoot31) {
|
|
32609
32716
|
return async (req, next) => {
|
|
32610
32717
|
if (req.params) {
|
|
32611
32718
|
try {
|
|
32612
|
-
const root =
|
|
32719
|
+
const root = getProjectRoot31 ? getProjectRoot31() : void 0;
|
|
32613
32720
|
req.params = sanitizeParams(req.params, root, {
|
|
32614
32721
|
domain: req.domain,
|
|
32615
32722
|
operation: req.operation
|
|
@@ -32981,7 +33088,7 @@ import {
|
|
|
32981
33088
|
ensureGlobalSignaldockDb as ensureGlobalSignaldockDb2,
|
|
32982
33089
|
getGlobalSalt,
|
|
32983
33090
|
getLogger as getLogger18,
|
|
32984
|
-
getProjectRoot as
|
|
33091
|
+
getProjectRoot as getProjectRoot30,
|
|
32985
33092
|
migrateSignaldockToConduit,
|
|
32986
33093
|
needsSignaldockToConduitMigration,
|
|
32987
33094
|
validateGlobalSalt
|
|
@@ -33584,6 +33691,42 @@ function createCustomShowUsage(version, subCommands2, aliasMap2) {
|
|
|
33584
33691
|
};
|
|
33585
33692
|
}
|
|
33586
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
|
+
|
|
33587
33730
|
// packages/cleo/src/cli/middleware/output-format.ts
|
|
33588
33731
|
import { resolveOutputFormat } from "@cleocode/lafs";
|
|
33589
33732
|
function resolveFormat(opts, defaults) {
|
|
@@ -33734,7 +33877,49 @@ var adapterCommand = defineCommand({
|
|
|
33734
33877
|
});
|
|
33735
33878
|
|
|
33736
33879
|
// packages/cleo/src/cli/commands/add.ts
|
|
33880
|
+
import { getProjectRoot as getProjectRoot18 } from "@cleocode/core";
|
|
33737
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
|
|
33738
33923
|
init_renderers();
|
|
33739
33924
|
var addCommand = defineCommand({
|
|
33740
33925
|
meta: {
|
|
@@ -33793,6 +33978,10 @@ var addCommand = defineCommand({
|
|
|
33793
33978
|
type: "string",
|
|
33794
33979
|
description: "Comma-separated file paths"
|
|
33795
33980
|
},
|
|
33981
|
+
"files-infer": {
|
|
33982
|
+
type: "boolean",
|
|
33983
|
+
description: "Infer touched files from task title and description using GitNexus"
|
|
33984
|
+
},
|
|
33796
33985
|
acceptance: {
|
|
33797
33986
|
type: "string",
|
|
33798
33987
|
description: 'Pipe-separated acceptance criteria (e.g. "AC1|AC2|AC3")'
|
|
@@ -33877,7 +34066,18 @@ var addCommand = defineCommand({
|
|
|
33877
34066
|
params["description"] = args.desc;
|
|
33878
34067
|
}
|
|
33879
34068
|
if (args.labels) params["labels"] = args.labels.split(",").map((s) => s.trim());
|
|
33880
|
-
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
|
+
}
|
|
33881
34081
|
if (args.acceptance) {
|
|
33882
34082
|
const raw = args.acceptance;
|
|
33883
34083
|
if (raw.trimStart().startsWith("[")) {
|
|
@@ -33901,6 +34101,21 @@ var addCommand = defineCommand({
|
|
|
33901
34101
|
if (args.kind !== void 0) params["kind"] = args.kind;
|
|
33902
34102
|
if (args.scope !== void 0) params["scope"] = args.scope;
|
|
33903
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
|
+
}
|
|
33904
34119
|
const response = await dispatchRaw("mutate", "tasks", "add", params);
|
|
33905
34120
|
if (!response.success) {
|
|
33906
34121
|
handleRawError(response, { command: "add", operation: "tasks.add" });
|
|
@@ -36225,11 +36440,11 @@ var installCommand = defineCommand({
|
|
|
36225
36440
|
if (stat2.isFile() && ext === ".cant") {
|
|
36226
36441
|
cantPath = resolvedPath;
|
|
36227
36442
|
} else if (stat2.isFile() && ext === ".cantz") {
|
|
36228
|
-
const { execFileSync:
|
|
36443
|
+
const { execFileSync: execFileSync7 } = await import("node:child_process");
|
|
36229
36444
|
tempDir = join23(tmpdir(), `cleo-agent-install-${Date.now()}`);
|
|
36230
36445
|
mkdirSync5(tempDir, { recursive: true });
|
|
36231
36446
|
try {
|
|
36232
|
-
|
|
36447
|
+
execFileSync7("unzip", ["-o", "-q", resolvedPath, "-d", tempDir], {
|
|
36233
36448
|
encoding: "utf-8",
|
|
36234
36449
|
timeout: 3e4
|
|
36235
36450
|
});
|
|
@@ -36430,7 +36645,7 @@ var packCommand = defineCommand({
|
|
|
36430
36645
|
try {
|
|
36431
36646
|
const { existsSync: existsSync12, statSync } = await import("node:fs");
|
|
36432
36647
|
const { resolve: resolve5, basename: basename2, dirname: dirname11 } = await import("node:path");
|
|
36433
|
-
const { execFileSync:
|
|
36648
|
+
const { execFileSync: execFileSync7 } = await import("node:child_process");
|
|
36434
36649
|
const resolvedDir = resolve5(args.dir);
|
|
36435
36650
|
if (!existsSync12(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
|
|
36436
36651
|
cliOutput(
|
|
@@ -36467,7 +36682,7 @@ var packCommand = defineCommand({
|
|
|
36467
36682
|
const archivePath = resolve5(archiveName);
|
|
36468
36683
|
const parentDir = dirname11(resolvedDir);
|
|
36469
36684
|
try {
|
|
36470
|
-
|
|
36685
|
+
execFileSync7("zip", ["-r", archivePath, agentName], {
|
|
36471
36686
|
cwd: parentDir,
|
|
36472
36687
|
encoding: "utf-8",
|
|
36473
36688
|
timeout: 3e4
|
|
@@ -37470,8 +37685,113 @@ var archiveStatsCommand = defineCommand({
|
|
|
37470
37685
|
}
|
|
37471
37686
|
});
|
|
37472
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
|
+
|
|
37473
37793
|
// packages/cleo/src/cli/commands/backfill.ts
|
|
37474
|
-
import { backfillTasks, getProjectRoot as
|
|
37794
|
+
import { backfillTasks, getProjectRoot as getProjectRoot20, populateEmbeddings } from "@cleocode/core/internal";
|
|
37475
37795
|
init_renderers();
|
|
37476
37796
|
var backfillCommand = defineCommand({
|
|
37477
37797
|
meta: {
|
|
@@ -37500,7 +37820,7 @@ var backfillCommand = defineCommand({
|
|
|
37500
37820
|
}
|
|
37501
37821
|
},
|
|
37502
37822
|
async run({ args }) {
|
|
37503
|
-
const root =
|
|
37823
|
+
const root = getProjectRoot20();
|
|
37504
37824
|
if (args.embeddings) {
|
|
37505
37825
|
try {
|
|
37506
37826
|
let lastLine = "";
|
|
@@ -37989,9 +38309,9 @@ var exportCommand = defineCommand({
|
|
|
37989
38309
|
},
|
|
37990
38310
|
async run({ args }) {
|
|
37991
38311
|
const scope = args.scope;
|
|
37992
|
-
const { packBundle, getProjectRoot:
|
|
38312
|
+
const { packBundle, getProjectRoot: getProjectRoot31 } = await import("@cleocode/core/internal");
|
|
37993
38313
|
const includesProject = scope === "project" || scope === "all";
|
|
37994
|
-
const projectRoot = includesProject ?
|
|
38314
|
+
const projectRoot = includesProject ? getProjectRoot31() : void 0;
|
|
37995
38315
|
let passphrase;
|
|
37996
38316
|
if (args.encrypt === true) {
|
|
37997
38317
|
passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
|
|
@@ -38319,7 +38639,7 @@ import {
|
|
|
38319
38639
|
exportBrainAsJson,
|
|
38320
38640
|
getMemoryQualityReport,
|
|
38321
38641
|
getPlasticityStats,
|
|
38322
|
-
getProjectRoot as
|
|
38642
|
+
getProjectRoot as getProjectRoot21,
|
|
38323
38643
|
purgeBrainNoise,
|
|
38324
38644
|
runBrainMaintenance
|
|
38325
38645
|
} from "@cleocode/core/internal";
|
|
@@ -38352,7 +38672,7 @@ var maintenanceCommand = defineCommand({
|
|
|
38352
38672
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38353
38673
|
},
|
|
38354
38674
|
async run({ args }) {
|
|
38355
|
-
const root =
|
|
38675
|
+
const root = getProjectRoot21();
|
|
38356
38676
|
const isJson = !!args.json;
|
|
38357
38677
|
if (!isJson) {
|
|
38358
38678
|
console.log("Running brain maintenance...");
|
|
@@ -38432,7 +38752,7 @@ var backfillCommand2 = defineCommand({
|
|
|
38432
38752
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38433
38753
|
},
|
|
38434
38754
|
async run({ args }) {
|
|
38435
|
-
const root =
|
|
38755
|
+
const root = getProjectRoot21();
|
|
38436
38756
|
const isJson = !!args.json;
|
|
38437
38757
|
if (!isJson) {
|
|
38438
38758
|
console.log("Running brain graph back-fill...");
|
|
@@ -38487,7 +38807,7 @@ var purgeCommand = defineCommand({
|
|
|
38487
38807
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38488
38808
|
},
|
|
38489
38809
|
async run({ args }) {
|
|
38490
|
-
const root =
|
|
38810
|
+
const root = getProjectRoot21();
|
|
38491
38811
|
const isJson = !!args.json;
|
|
38492
38812
|
if (!isJson) {
|
|
38493
38813
|
console.log("Running brain noise purge...");
|
|
@@ -38545,7 +38865,7 @@ var plasticityStatsCommand = defineCommand({
|
|
|
38545
38865
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38546
38866
|
},
|
|
38547
38867
|
async run({ args }) {
|
|
38548
|
-
const root =
|
|
38868
|
+
const root = getProjectRoot21();
|
|
38549
38869
|
const isJson = !!args.json;
|
|
38550
38870
|
const limit = Number.parseInt(args.limit, 10) || 20;
|
|
38551
38871
|
try {
|
|
@@ -38618,7 +38938,7 @@ var qualityCommand = defineCommand({
|
|
|
38618
38938
|
json: { type: "boolean", description: "Output results as JSON" }
|
|
38619
38939
|
},
|
|
38620
38940
|
async run({ args }) {
|
|
38621
|
-
const root =
|
|
38941
|
+
const root = getProjectRoot21();
|
|
38622
38942
|
const isJson = !!args.json;
|
|
38623
38943
|
try {
|
|
38624
38944
|
const report = await getMemoryQualityReport(root);
|
|
@@ -38695,7 +39015,7 @@ var exportCommand2 = defineCommand({
|
|
|
38695
39015
|
}
|
|
38696
39016
|
},
|
|
38697
39017
|
async run({ args }) {
|
|
38698
|
-
const root =
|
|
39018
|
+
const root = getProjectRoot21();
|
|
38699
39019
|
const format = args.format ?? "gexf";
|
|
38700
39020
|
if (format !== "gexf" && format !== "json") {
|
|
38701
39021
|
console.error(`Invalid format: ${format}. Use 'gexf' or 'json'.`);
|
|
@@ -40003,7 +40323,7 @@ var trendCommand = defineCommand({
|
|
|
40003
40323
|
);
|
|
40004
40324
|
}
|
|
40005
40325
|
});
|
|
40006
|
-
var
|
|
40326
|
+
var auditCommand2 = defineCommand({
|
|
40007
40327
|
meta: {
|
|
40008
40328
|
name: "audit",
|
|
40009
40329
|
description: "Check compliance for a specific task and its subtasks"
|
|
@@ -40155,7 +40475,7 @@ var complianceCommand = defineCommand({
|
|
|
40155
40475
|
summary: summaryCommand,
|
|
40156
40476
|
violations: violationsCommand,
|
|
40157
40477
|
trend: trendCommand,
|
|
40158
|
-
audit:
|
|
40478
|
+
audit: auditCommand2,
|
|
40159
40479
|
sync: syncCommand2,
|
|
40160
40480
|
skills: skillsCommand,
|
|
40161
40481
|
value: valueCommand,
|
|
@@ -41888,7 +42208,7 @@ import {
|
|
|
41888
42208
|
exportDocument,
|
|
41889
42209
|
formatError as formatError5,
|
|
41890
42210
|
getAgentOutputsAbsolute,
|
|
41891
|
-
getProjectRoot as
|
|
42211
|
+
getProjectRoot as getProjectRoot22,
|
|
41892
42212
|
listDocVersions,
|
|
41893
42213
|
mergeDocs,
|
|
41894
42214
|
publishDocs,
|
|
@@ -42177,7 +42497,7 @@ var exportCommand4 = defineCommand({
|
|
|
42177
42497
|
const taskId = String(args.task);
|
|
42178
42498
|
const includeAttachments = args["include-attachments"] !== false;
|
|
42179
42499
|
const includeMemoryRefs = args["include-memory-refs"] === true;
|
|
42180
|
-
const projectRoot =
|
|
42500
|
+
const projectRoot = getProjectRoot22();
|
|
42181
42501
|
try {
|
|
42182
42502
|
const result = await exportDocument({
|
|
42183
42503
|
taskId,
|
|
@@ -42241,7 +42561,7 @@ var searchCommand = defineCommand({
|
|
|
42241
42561
|
}
|
|
42242
42562
|
},
|
|
42243
42563
|
async run({ args }) {
|
|
42244
|
-
const projectRoot =
|
|
42564
|
+
const projectRoot = getProjectRoot22();
|
|
42245
42565
|
try {
|
|
42246
42566
|
const result = await searchDocs(String(args.query), {
|
|
42247
42567
|
ownerId: args.owner ?? void 0,
|
|
@@ -42293,7 +42613,7 @@ var mergeCommand = defineCommand({
|
|
|
42293
42613
|
}
|
|
42294
42614
|
},
|
|
42295
42615
|
async run({ args }) {
|
|
42296
|
-
const projectRoot =
|
|
42616
|
+
const projectRoot = getProjectRoot22();
|
|
42297
42617
|
const rawStrategy = args.strategy ?? "three-way";
|
|
42298
42618
|
const strategy = rawStrategy === "cherry-pick" || rawStrategy === "multi-diff" ? rawStrategy : "three-way";
|
|
42299
42619
|
try {
|
|
@@ -42344,7 +42664,7 @@ var graphCommand = defineCommand({
|
|
|
42344
42664
|
}
|
|
42345
42665
|
},
|
|
42346
42666
|
async run({ args }) {
|
|
42347
|
-
const projectRoot =
|
|
42667
|
+
const projectRoot = getProjectRoot22();
|
|
42348
42668
|
const fmt = args.format ?? "mermaid";
|
|
42349
42669
|
try {
|
|
42350
42670
|
const result = await buildDocsGraph({ ownerId: String(args.for), projectRoot });
|
|
@@ -42415,7 +42735,7 @@ var rankCommand = defineCommand({
|
|
|
42415
42735
|
}
|
|
42416
42736
|
},
|
|
42417
42737
|
async run({ args }) {
|
|
42418
|
-
const projectRoot =
|
|
42738
|
+
const projectRoot = getProjectRoot22();
|
|
42419
42739
|
try {
|
|
42420
42740
|
const result = await rankDocs({
|
|
42421
42741
|
ownerId: String(args.for),
|
|
@@ -42454,7 +42774,7 @@ var versionsCommand = defineCommand({
|
|
|
42454
42774
|
}
|
|
42455
42775
|
},
|
|
42456
42776
|
async run({ args }) {
|
|
42457
|
-
const projectRoot =
|
|
42777
|
+
const projectRoot = getProjectRoot22();
|
|
42458
42778
|
try {
|
|
42459
42779
|
const result = await listDocVersions({
|
|
42460
42780
|
ownerId: String(args.for),
|
|
@@ -42498,7 +42818,7 @@ var publishCommand2 = defineCommand({
|
|
|
42498
42818
|
}
|
|
42499
42819
|
},
|
|
42500
42820
|
async run({ args }) {
|
|
42501
|
-
const projectRoot =
|
|
42821
|
+
const projectRoot = getProjectRoot22();
|
|
42502
42822
|
try {
|
|
42503
42823
|
const result = await publishDocs({
|
|
42504
42824
|
ownerId: String(args.for),
|
|
@@ -43445,10 +43765,10 @@ var gcCommand = defineCommand({
|
|
|
43445
43765
|
|
|
43446
43766
|
// packages/cleo/src/cli/commands/generate-changelog.ts
|
|
43447
43767
|
init_src();
|
|
43448
|
-
import { execFileSync as
|
|
43768
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
43449
43769
|
import { existsSync as existsSync10, mkdirSync as mkdirSync3, readFileSync as readFileSync12, writeFileSync as writeFileSync3 } from "node:fs";
|
|
43450
43770
|
import { dirname as dirname9, join as join16 } from "node:path";
|
|
43451
|
-
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";
|
|
43452
43772
|
init_renderers();
|
|
43453
43773
|
function getChangelogSource(cwd) {
|
|
43454
43774
|
const configPath = getConfigPath2(cwd);
|
|
@@ -43480,9 +43800,9 @@ function getDefaultOutputPath(platform) {
|
|
|
43480
43800
|
}
|
|
43481
43801
|
}
|
|
43482
43802
|
function getGitHubRepoSlug(cwd) {
|
|
43483
|
-
const projectRoot =
|
|
43803
|
+
const projectRoot = getProjectRoot23(cwd);
|
|
43484
43804
|
try {
|
|
43485
|
-
const remoteUrl =
|
|
43805
|
+
const remoteUrl = execFileSync4("git", ["remote", "get-url", "origin"], {
|
|
43486
43806
|
cwd: projectRoot,
|
|
43487
43807
|
encoding: "utf-8",
|
|
43488
43808
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -43606,7 +43926,7 @@ var generateChangelogCommand = defineCommand({
|
|
|
43606
43926
|
const targetPlatform = args.platform;
|
|
43607
43927
|
const dryRun = args["dry-run"] === true;
|
|
43608
43928
|
const sourceFile = getChangelogSource();
|
|
43609
|
-
const sourcePath = join16(
|
|
43929
|
+
const sourcePath = join16(getProjectRoot23(), sourceFile);
|
|
43610
43930
|
if (!existsSync10(sourcePath)) {
|
|
43611
43931
|
throw new CleoError4(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
|
|
43612
43932
|
}
|
|
@@ -43619,7 +43939,7 @@ var generateChangelogCommand = defineCommand({
|
|
|
43619
43939
|
const outputPath = platformConfig?.path ?? getDefaultOutputPath(targetPlatform);
|
|
43620
43940
|
const content = generateForPlatform(targetPlatform, sourceContent, repoSlug, limit);
|
|
43621
43941
|
if (!dryRun) {
|
|
43622
|
-
const fullPath = join16(
|
|
43942
|
+
const fullPath = join16(getProjectRoot23(), outputPath);
|
|
43623
43943
|
mkdirSync3(dirname9(fullPath), { recursive: true });
|
|
43624
43944
|
writeFileSync3(fullPath, content, "utf-8");
|
|
43625
43945
|
}
|
|
@@ -43640,7 +43960,7 @@ var generateChangelogCommand = defineCommand({
|
|
|
43640
43960
|
limit
|
|
43641
43961
|
);
|
|
43642
43962
|
if (!dryRun) {
|
|
43643
|
-
const fullPath = join16(
|
|
43963
|
+
const fullPath = join16(getProjectRoot23(), platformConfig.path);
|
|
43644
43964
|
mkdirSync3(dirname9(fullPath), { recursive: true });
|
|
43645
43965
|
writeFileSync3(fullPath, content, "utf-8");
|
|
43646
43966
|
}
|
|
@@ -44230,7 +44550,7 @@ var intelligenceCommand = defineCommand({
|
|
|
44230
44550
|
});
|
|
44231
44551
|
|
|
44232
44552
|
// packages/cleo/src/cli/commands/issue.ts
|
|
44233
|
-
import { execFileSync as
|
|
44553
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
44234
44554
|
import { addIssue, BUILD_CONFIG } from "@cleocode/core/internal";
|
|
44235
44555
|
init_cli();
|
|
44236
44556
|
init_renderers();
|
|
@@ -44254,7 +44574,7 @@ async function handleIssueType(issueType, opts) {
|
|
|
44254
44574
|
if (opts["open"] && typeof result.url === "string" && result.url.startsWith("https://")) {
|
|
44255
44575
|
const issueNumber = result.url.match(/(\d+)$/)?.[1] ?? "unknown";
|
|
44256
44576
|
try {
|
|
44257
|
-
|
|
44577
|
+
execFileSync5("gh", ["issue", "view", issueNumber, "--repo", CLEO_REPO, "--web"], {
|
|
44258
44578
|
stdio: ["pipe", "pipe", "pipe"]
|
|
44259
44579
|
});
|
|
44260
44580
|
} catch {
|
|
@@ -45056,7 +45376,7 @@ import { join as join17 } from "node:path";
|
|
|
45056
45376
|
import {
|
|
45057
45377
|
getBrainDb as getBrainDb2,
|
|
45058
45378
|
getBrainNativeDb as getBrainNativeDb3,
|
|
45059
|
-
getProjectRoot as
|
|
45379
|
+
getProjectRoot as getProjectRoot24,
|
|
45060
45380
|
runConsolidation,
|
|
45061
45381
|
triggerManualDream
|
|
45062
45382
|
} from "@cleocode/core/internal";
|
|
@@ -45965,7 +46285,7 @@ var consolidateCommand = defineCommand({
|
|
|
45965
46285
|
}
|
|
45966
46286
|
},
|
|
45967
46287
|
async run({ args }) {
|
|
45968
|
-
const root =
|
|
46288
|
+
const root = getProjectRoot24();
|
|
45969
46289
|
const isJson = !!args.json;
|
|
45970
46290
|
if (!isJson) {
|
|
45971
46291
|
console.log("Running memory consolidation (including tier promotion)...");
|
|
@@ -46030,7 +46350,7 @@ var dreamCommand = defineCommand({
|
|
|
46030
46350
|
}
|
|
46031
46351
|
},
|
|
46032
46352
|
async run({ args }) {
|
|
46033
|
-
const root =
|
|
46353
|
+
const root = getProjectRoot24();
|
|
46034
46354
|
const isJson = !!args.json;
|
|
46035
46355
|
if (!isJson) {
|
|
46036
46356
|
console.log("Triggering dream cycle (full consolidation including STDP plasticity)...");
|
|
@@ -46108,7 +46428,7 @@ var reflectCommand = defineCommand({
|
|
|
46108
46428
|
}
|
|
46109
46429
|
},
|
|
46110
46430
|
async run({ args }) {
|
|
46111
|
-
const root =
|
|
46431
|
+
const root = getProjectRoot24();
|
|
46112
46432
|
const isJson = !!args.json;
|
|
46113
46433
|
if (!isJson) {
|
|
46114
46434
|
console.log("Running Observer + Reflector pipeline...");
|
|
@@ -46193,7 +46513,7 @@ var dedupScanCommand = defineCommand({
|
|
|
46193
46513
|
}
|
|
46194
46514
|
},
|
|
46195
46515
|
async run({ args }) {
|
|
46196
|
-
const root =
|
|
46516
|
+
const root = getProjectRoot24();
|
|
46197
46517
|
const isJson = !!args.json;
|
|
46198
46518
|
if (!isJson) {
|
|
46199
46519
|
console.log("Scanning brain.db for duplicate entries...");
|
|
@@ -46353,7 +46673,7 @@ var importCommand3 = defineCommand({
|
|
|
46353
46673
|
const sourceDir = args.from ?? join17(homedir4(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
|
|
46354
46674
|
const isDryRun = !!args["dry-run"];
|
|
46355
46675
|
const isJson = !!args.json;
|
|
46356
|
-
const projectRoot =
|
|
46676
|
+
const projectRoot = getProjectRoot24();
|
|
46357
46677
|
const stateFile = join17(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
|
|
46358
46678
|
if (!existsSync11(sourceDir)) {
|
|
46359
46679
|
const msg = `Source directory not found: ${sourceDir}`;
|
|
@@ -46606,7 +46926,7 @@ var tierStatsCommand = defineCommand({
|
|
|
46606
46926
|
}
|
|
46607
46927
|
},
|
|
46608
46928
|
async run({ args }) {
|
|
46609
|
-
const root =
|
|
46929
|
+
const root = getProjectRoot24();
|
|
46610
46930
|
const isJson = !!args.json;
|
|
46611
46931
|
try {
|
|
46612
46932
|
await getBrainDb2(root);
|
|
@@ -46750,7 +47070,7 @@ var tierPromoteCommand = defineCommand({
|
|
|
46750
47070
|
}
|
|
46751
47071
|
},
|
|
46752
47072
|
async run({ args }) {
|
|
46753
|
-
const root =
|
|
47073
|
+
const root = getProjectRoot24();
|
|
46754
47074
|
const isJson = !!args.json;
|
|
46755
47075
|
const targetTier = args.to;
|
|
46756
47076
|
const reason = args.reason;
|
|
@@ -46896,7 +47216,7 @@ var tierDemoteCommand = defineCommand({
|
|
|
46896
47216
|
}
|
|
46897
47217
|
},
|
|
46898
47218
|
async run({ args }) {
|
|
46899
|
-
const root =
|
|
47219
|
+
const root = getProjectRoot24();
|
|
46900
47220
|
const isJson = !!args.json;
|
|
46901
47221
|
const targetTier = args.to;
|
|
46902
47222
|
const reason = args.reason;
|
|
@@ -47332,6 +47652,51 @@ var tierCommand = defineCommand({
|
|
|
47332
47652
|
demote: tierDemoteCommand
|
|
47333
47653
|
}
|
|
47334
47654
|
});
|
|
47655
|
+
var sweepCommand = defineCommand({
|
|
47656
|
+
meta: {
|
|
47657
|
+
name: "sweep",
|
|
47658
|
+
description: "T1147 W7 BRAIN noise sweep. --dry-run: detect noise candidates. --approve <runId>: apply to live tables. --status: list runs. --rollback <runId>: discard staged run."
|
|
47659
|
+
},
|
|
47660
|
+
args: {
|
|
47661
|
+
"dry-run": {
|
|
47662
|
+
type: "boolean",
|
|
47663
|
+
description: "Detect noise candidates without staging DB writes."
|
|
47664
|
+
},
|
|
47665
|
+
approve: {
|
|
47666
|
+
type: "string",
|
|
47667
|
+
description: "Run ID to approve and apply to live tables."
|
|
47668
|
+
},
|
|
47669
|
+
status: {
|
|
47670
|
+
type: "boolean",
|
|
47671
|
+
description: "List recent noise-sweep-2440 runs."
|
|
47672
|
+
},
|
|
47673
|
+
rollback: {
|
|
47674
|
+
type: "string",
|
|
47675
|
+
description: "Run ID to roll back without applying changes."
|
|
47676
|
+
},
|
|
47677
|
+
json: {
|
|
47678
|
+
type: "boolean",
|
|
47679
|
+
description: "Output as JSON"
|
|
47680
|
+
}
|
|
47681
|
+
},
|
|
47682
|
+
async run({
|
|
47683
|
+
args
|
|
47684
|
+
}) {
|
|
47685
|
+
const gateway = args.approve || args.rollback ? "mutate" : "query";
|
|
47686
|
+
await dispatchFromCli(
|
|
47687
|
+
gateway,
|
|
47688
|
+
"memory",
|
|
47689
|
+
"sweep",
|
|
47690
|
+
{
|
|
47691
|
+
"dry-run": args["dry-run"],
|
|
47692
|
+
approve: args.approve,
|
|
47693
|
+
status: args.status,
|
|
47694
|
+
rollback: args.rollback
|
|
47695
|
+
},
|
|
47696
|
+
{ command: "memory-sweep", operation: "memory.sweep" }
|
|
47697
|
+
);
|
|
47698
|
+
}
|
|
47699
|
+
});
|
|
47335
47700
|
var memoryCommand = defineCommand({
|
|
47336
47701
|
meta: { name: "memory", description: "BRAIN memory operations (patterns, learnings)" },
|
|
47337
47702
|
subCommands: {
|
|
@@ -47375,7 +47740,9 @@ var memoryCommand = defineCommand({
|
|
|
47375
47740
|
digest: digestCommand,
|
|
47376
47741
|
recent: recentCommand,
|
|
47377
47742
|
diary: diaryCommand,
|
|
47378
|
-
watch: watchCommand2
|
|
47743
|
+
watch: watchCommand2,
|
|
47744
|
+
// T1147 W7 — BRAIN noise sweep
|
|
47745
|
+
sweep: sweepCommand
|
|
47379
47746
|
},
|
|
47380
47747
|
async run({ cmd, rawArgs }) {
|
|
47381
47748
|
const firstArg = rawArgs?.find((a) => !a.startsWith("-"));
|
|
@@ -47385,7 +47752,7 @@ var memoryCommand = defineCommand({
|
|
|
47385
47752
|
});
|
|
47386
47753
|
|
|
47387
47754
|
// packages/cleo/src/cli/commands/migrate-claude-mem.ts
|
|
47388
|
-
import { getProjectRoot as
|
|
47755
|
+
import { getProjectRoot as getProjectRoot25, migrateClaudeMem } from "@cleocode/core/internal";
|
|
47389
47756
|
import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
|
|
47390
47757
|
import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
|
|
47391
47758
|
init_cli();
|
|
@@ -47442,7 +47809,7 @@ var claudeMemCommand = defineCommand({
|
|
|
47442
47809
|
}
|
|
47443
47810
|
},
|
|
47444
47811
|
async run({ args }) {
|
|
47445
|
-
const root =
|
|
47812
|
+
const root = getProjectRoot25();
|
|
47446
47813
|
try {
|
|
47447
47814
|
const result = await migrateClaudeMem(root, {
|
|
47448
47815
|
sourcePath: args.source,
|
|
@@ -47491,7 +47858,7 @@ var manifestIngestCommand = defineCommand({
|
|
|
47491
47858
|
}
|
|
47492
47859
|
},
|
|
47493
47860
|
async run({ args }) {
|
|
47494
|
-
const projectRoot =
|
|
47861
|
+
const projectRoot = getProjectRoot25();
|
|
47495
47862
|
try {
|
|
47496
47863
|
const db = await getDb2(projectRoot);
|
|
47497
47864
|
const rcasdFlag = Boolean(args.rcasd);
|
|
@@ -49225,7 +49592,7 @@ var analyzeCommand3 = defineCommand({
|
|
|
49225
49592
|
);
|
|
49226
49593
|
}
|
|
49227
49594
|
try {
|
|
49228
|
-
const [{ getNexusDb: getNexusDb2, nexusSchema }, { runPipeline }, { getProjectRoot:
|
|
49595
|
+
const [{ getNexusDb: getNexusDb2, nexusSchema }, { runPipeline }, { getProjectRoot: getProjectRoot31 }, { eq: eq2 }] = await Promise.all([
|
|
49229
49596
|
import("@cleocode/core/store/nexus-sqlite"),
|
|
49230
49597
|
import("@cleocode/nexus/pipeline"),
|
|
49231
49598
|
import("@cleocode/core/internal"),
|
|
@@ -49331,7 +49698,7 @@ var analyzeCommand3 = defineCommand({
|
|
|
49331
49698
|
`
|
|
49332
49699
|
);
|
|
49333
49700
|
}
|
|
49334
|
-
void
|
|
49701
|
+
void getProjectRoot31;
|
|
49335
49702
|
} catch (err) {
|
|
49336
49703
|
const msg = err instanceof Error ? err.message : String(err);
|
|
49337
49704
|
if (jsonOutput) {
|
|
@@ -53836,14 +54203,14 @@ var reasonCommand = defineCommand({
|
|
|
53836
54203
|
});
|
|
53837
54204
|
|
|
53838
54205
|
// packages/cleo/src/cli/commands/refresh-memory.ts
|
|
53839
|
-
import { getProjectRoot as
|
|
54206
|
+
import { getProjectRoot as getProjectRoot26 } from "@cleocode/core";
|
|
53840
54207
|
var refreshMemoryCommand = defineCommand({
|
|
53841
54208
|
meta: {
|
|
53842
54209
|
name: "refresh-memory",
|
|
53843
54210
|
description: "Regenerate .cleo/memory-bridge.md from brain.db"
|
|
53844
54211
|
},
|
|
53845
54212
|
async run() {
|
|
53846
|
-
const projectDir =
|
|
54213
|
+
const projectDir = getProjectRoot26();
|
|
53847
54214
|
const { writeMemoryBridge } = await import("@cleocode/core/internal");
|
|
53848
54215
|
const result = await writeMemoryBridge(projectDir);
|
|
53849
54216
|
if (result.written) {
|
|
@@ -54948,7 +55315,7 @@ init_src();
|
|
|
54948
55315
|
import fs3 from "node:fs";
|
|
54949
55316
|
import path4 from "node:path";
|
|
54950
55317
|
import { CleoError as CleoError8, formatError as formatError10, getAccessor as getAccessor9 } from "@cleocode/core";
|
|
54951
|
-
import { getProjectRoot as
|
|
55318
|
+
import { getProjectRoot as getProjectRoot27 } from "@cleocode/core/internal";
|
|
54952
55319
|
init_cli();
|
|
54953
55320
|
init_paths();
|
|
54954
55321
|
init_renderers();
|
|
@@ -55062,7 +55429,7 @@ var finalizeCommand = defineCommand({
|
|
|
55062
55429
|
description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
|
|
55063
55430
|
},
|
|
55064
55431
|
async run() {
|
|
55065
|
-
const projectRoot =
|
|
55432
|
+
const projectRoot = getProjectRoot27();
|
|
55066
55433
|
const reportPath = path4.join(projectRoot, CLEO_DIR_NAME, RESTORE_CONFLICTS_MD);
|
|
55067
55434
|
if (!fs3.existsSync(reportPath)) {
|
|
55068
55435
|
console.log("No pending restore conflicts. Nothing to finalize.");
|
|
@@ -56773,7 +57140,7 @@ var sentientCommand = defineCommand({
|
|
|
56773
57140
|
});
|
|
56774
57141
|
|
|
56775
57142
|
// packages/cleo/src/cli/commands/sequence.ts
|
|
56776
|
-
import { getProjectRoot as
|
|
57143
|
+
import { getProjectRoot as getProjectRoot28 } from "@cleocode/core/internal";
|
|
56777
57144
|
init_cli();
|
|
56778
57145
|
init_renderers();
|
|
56779
57146
|
var showCommand12 = defineCommand({
|
|
@@ -56804,7 +57171,7 @@ var repairCommand = defineCommand({
|
|
|
56804
57171
|
meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
|
|
56805
57172
|
async run() {
|
|
56806
57173
|
const { systemSequenceRepair: systemSequenceRepair2 } = await Promise.resolve().then(() => (init_system_engine(), system_engine_exports));
|
|
56807
|
-
const projectRoot =
|
|
57174
|
+
const projectRoot = getProjectRoot28();
|
|
56808
57175
|
const result = await systemSequenceRepair2(projectRoot);
|
|
56809
57176
|
cliOutput(result, { command: "sequence", operation: "admin.sequence.repair" });
|
|
56810
57177
|
}
|
|
@@ -58631,7 +58998,7 @@ var tokenCommand = defineCommand({
|
|
|
58631
58998
|
// packages/cleo/src/cli/commands/transcript.ts
|
|
58632
58999
|
import { homedir as homedir5 } from "node:os";
|
|
58633
59000
|
import { join as join20 } from "node:path";
|
|
58634
|
-
import { getProjectRoot as
|
|
59001
|
+
import { getProjectRoot as getProjectRoot29 } from "@cleocode/core";
|
|
58635
59002
|
import {
|
|
58636
59003
|
parseDurationMs,
|
|
58637
59004
|
pruneTranscripts,
|
|
@@ -58659,7 +59026,7 @@ var scanCommand = defineCommand({
|
|
|
58659
59026
|
async run({ args }) {
|
|
58660
59027
|
if (args.pending) {
|
|
58661
59028
|
try {
|
|
58662
|
-
const projectRoot =
|
|
59029
|
+
const projectRoot = getProjectRoot29();
|
|
58663
59030
|
const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
58664
59031
|
const pending = await scanPendingTranscripts(projectRoot);
|
|
58665
59032
|
const envelope = { success: true, data: { count: pending.length, pending } };
|
|
@@ -58792,7 +59159,7 @@ var extractCommand = defineCommand({
|
|
|
58792
59159
|
async run({ args }) {
|
|
58793
59160
|
const tier = args.tier ?? "warm";
|
|
58794
59161
|
const dryRun = args["dry-run"] ?? false;
|
|
58795
|
-
const projectRoot =
|
|
59162
|
+
const projectRoot = getProjectRoot29();
|
|
58796
59163
|
try {
|
|
58797
59164
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
58798
59165
|
const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -58923,7 +59290,7 @@ var migrateCommand2 = defineCommand({
|
|
|
58923
59290
|
const dryRun = args["dry-run"] ?? false;
|
|
58924
59291
|
const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
|
|
58925
59292
|
const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
|
|
58926
|
-
const projectRoot =
|
|
59293
|
+
const projectRoot = getProjectRoot29();
|
|
58927
59294
|
try {
|
|
58928
59295
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
58929
59296
|
const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -59497,7 +59864,7 @@ var verifyCommand2 = defineCommand({
|
|
|
59497
59864
|
|
|
59498
59865
|
// packages/cleo/src/cli/commands/web.ts
|
|
59499
59866
|
init_src();
|
|
59500
|
-
import { execFileSync as
|
|
59867
|
+
import { execFileSync as execFileSync6, spawn } from "node:child_process";
|
|
59501
59868
|
import { mkdir as mkdir4, open, readFile as readFile5, rm, stat, writeFile as writeFile2 } from "node:fs/promises";
|
|
59502
59869
|
import { join as join21 } from "node:path";
|
|
59503
59870
|
import { CleoError as CleoError12, formatError as formatError14, getCleoHome as getCleoHome3 } from "@cleocode/core";
|
|
@@ -59564,7 +59931,7 @@ async function startWebServer(port, host) {
|
|
|
59564
59931
|
await stat(webIndexPath);
|
|
59565
59932
|
} catch {
|
|
59566
59933
|
try {
|
|
59567
|
-
|
|
59934
|
+
execFileSync6("pnpm", ["--filter", "@cleocode/studio", "run", "build"], {
|
|
59568
59935
|
cwd: projectRoot,
|
|
59569
59936
|
stdio: "ignore"
|
|
59570
59937
|
});
|
|
@@ -59858,6 +60225,7 @@ subCommands["admin"] = adminCommand;
|
|
|
59858
60225
|
subCommands["adr"] = adrCommand;
|
|
59859
60226
|
subCommands["agent"] = agentCommand;
|
|
59860
60227
|
subCommands["analyze"] = analyzeCommand;
|
|
60228
|
+
subCommands["audit"] = auditCommand;
|
|
59861
60229
|
subCommands["archive"] = archiveCommand;
|
|
59862
60230
|
subCommands["archive-stats"] = archiveStatsCommand;
|
|
59863
60231
|
subCommands["backfill"] = backfillCommand;
|
|
@@ -59991,12 +60359,12 @@ subCommands["pipeline"] = phaseCommand;
|
|
|
59991
60359
|
} catch {
|
|
59992
60360
|
}
|
|
59993
60361
|
try {
|
|
59994
|
-
detectAndRemoveStrayProjectNexus(
|
|
60362
|
+
detectAndRemoveStrayProjectNexus(getProjectRoot30());
|
|
59995
60363
|
} catch {
|
|
59996
60364
|
}
|
|
59997
60365
|
const _startupLog = getLogger18("cli-startup");
|
|
59998
60366
|
try {
|
|
59999
|
-
const _projectRootForMigration =
|
|
60367
|
+
const _projectRootForMigration = getProjectRoot30();
|
|
60000
60368
|
if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
|
|
60001
60369
|
const migrationResult = migrateSignaldockToConduit(_projectRootForMigration);
|
|
60002
60370
|
if (migrationResult.status === "failed") {
|
|
@@ -60016,7 +60384,7 @@ subCommands["pipeline"] = phaseCommand;
|
|
|
60016
60384
|
}
|
|
60017
60385
|
}
|
|
60018
60386
|
try {
|
|
60019
|
-
ensureConduitDb(
|
|
60387
|
+
ensureConduitDb(getProjectRoot30());
|
|
60020
60388
|
} catch {
|
|
60021
60389
|
}
|
|
60022
60390
|
try {
|
|
@@ -60054,6 +60422,26 @@ var main = defineCommand({
|
|
|
60054
60422
|
});
|
|
60055
60423
|
var aliasMap = buildAliasMap(subCommands);
|
|
60056
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
|
+
}
|
|
60057
60445
|
runMain(main, { showUsage: customShowUsage });
|
|
60058
60446
|
/*! Bundled license information:
|
|
60059
60447
|
|