@cleocode/cleo 2026.4.129 → 2026.4.130
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 +272 -201
- package/dist/cli/index.js.map +4 -4
- package/package.json +9 -9
package/dist/cli/index.js
CHANGED
|
@@ -758,6 +758,66 @@ var init_session2 = __esm({
|
|
|
758
758
|
}
|
|
759
759
|
});
|
|
760
760
|
|
|
761
|
+
// packages/contracts/src/session-journal.ts
|
|
762
|
+
import { z as z4 } from "zod";
|
|
763
|
+
var SESSION_JOURNAL_SCHEMA_VERSION, sessionJournalDoctorSummarySchema, sessionJournalDebriefSummarySchema, sessionJournalEntrySchema;
|
|
764
|
+
var init_session_journal = __esm({
|
|
765
|
+
"packages/contracts/src/session-journal.ts"() {
|
|
766
|
+
"use strict";
|
|
767
|
+
SESSION_JOURNAL_SCHEMA_VERSION = "1.0";
|
|
768
|
+
sessionJournalDoctorSummarySchema = z4.object({
|
|
769
|
+
/** `true` when zero noise patterns were detected. */
|
|
770
|
+
isClean: z4.boolean(),
|
|
771
|
+
/** Total number of noise findings across all patterns. */
|
|
772
|
+
findingsCount: z4.number().int().nonnegative(),
|
|
773
|
+
/** Pattern names that were detected (empty when isClean). */
|
|
774
|
+
patterns: z4.array(z4.string()),
|
|
775
|
+
/** Total brain entries scanned. `0` = empty or unavailable. */
|
|
776
|
+
totalScanned: z4.number().int().nonnegative()
|
|
777
|
+
});
|
|
778
|
+
sessionJournalDebriefSummarySchema = z4.object({
|
|
779
|
+
/** First 200 characters of the session end note (if provided). */
|
|
780
|
+
noteExcerpt: z4.string().max(200).optional(),
|
|
781
|
+
/** Number of tasks completed during the session. */
|
|
782
|
+
tasksCompletedCount: z4.number().int().nonnegative(),
|
|
783
|
+
/** Up to 5 task IDs (not titles) that were the focus of the session. */
|
|
784
|
+
tasksFocused: z4.array(z4.string()).max(5).optional()
|
|
785
|
+
});
|
|
786
|
+
sessionJournalEntrySchema = z4.object({
|
|
787
|
+
// Identity
|
|
788
|
+
/** Schema version for forward-compatibility. Always `'1.0'` in this release. */
|
|
789
|
+
schemaVersion: z4.literal(SESSION_JOURNAL_SCHEMA_VERSION),
|
|
790
|
+
/** ISO 8601 timestamp when the entry was written. */
|
|
791
|
+
timestamp: z4.string(),
|
|
792
|
+
/** CLEO session ID (e.g. `ses_20260424055456_ede571`). */
|
|
793
|
+
sessionId: z4.string(),
|
|
794
|
+
/** Event type that triggered this journal entry. */
|
|
795
|
+
eventType: z4.enum(["session_start", "session_end", "observation", "decision", "error"]),
|
|
796
|
+
// Session metadata (set on session_start / session_end)
|
|
797
|
+
/** Agent identifier (e.g. `cleo-prime`, `claude-code`). */
|
|
798
|
+
agentIdentifier: z4.string().optional(),
|
|
799
|
+
/** Provider adapter ID active for this session. */
|
|
800
|
+
providerId: z4.string().optional(),
|
|
801
|
+
/** Session scope string (e.g. `'global'` or `'epic:T1263'`). */
|
|
802
|
+
scope: z4.string().optional(),
|
|
803
|
+
// Session-end fields
|
|
804
|
+
/** Duration of the session in seconds (session_end only). */
|
|
805
|
+
duration: z4.number().int().nonnegative().optional(),
|
|
806
|
+
/** Task IDs (not titles) completed during the session. */
|
|
807
|
+
tasksCompleted: z4.array(z4.string()).optional(),
|
|
808
|
+
// Doctor summary (T1262 absorbed)
|
|
809
|
+
/** Compact result of `scanBrainNoise` run at session-end. */
|
|
810
|
+
doctorSummary: sessionJournalDoctorSummarySchema.optional(),
|
|
811
|
+
// Debrief summary
|
|
812
|
+
/** Compact excerpt from session debrief data. */
|
|
813
|
+
debriefSummary: sessionJournalDebriefSummarySchema.optional(),
|
|
814
|
+
// Optional hash chain
|
|
815
|
+
/** SHA-256 hex of the previous entry's raw JSON string (for integrity chain). */
|
|
816
|
+
prevEntryHash: z4.string().optional()
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
});
|
|
820
|
+
|
|
761
821
|
// packages/contracts/src/status-registry.ts
|
|
762
822
|
var TASK_STATUS_SYMBOLS_UNICODE, TASK_STATUS_SYMBOLS_ASCII;
|
|
763
823
|
var init_status_registry = __esm({
|
|
@@ -792,52 +852,52 @@ var init_status_registry = __esm({
|
|
|
792
852
|
});
|
|
793
853
|
|
|
794
854
|
// packages/contracts/src/task-evidence.ts
|
|
795
|
-
import { z as
|
|
855
|
+
import { z as z5 } from "zod";
|
|
796
856
|
var fileEvidenceSchema, logEvidenceSchema, screenshotEvidenceSchema, testOutputEvidenceSchema, commandOutputEvidenceSchema, taskEvidenceSchema;
|
|
797
857
|
var init_task_evidence = __esm({
|
|
798
858
|
"packages/contracts/src/task-evidence.ts"() {
|
|
799
859
|
"use strict";
|
|
800
|
-
fileEvidenceSchema =
|
|
801
|
-
kind:
|
|
802
|
-
sha256:
|
|
803
|
-
timestamp:
|
|
804
|
-
path:
|
|
805
|
-
mime:
|
|
806
|
-
description:
|
|
860
|
+
fileEvidenceSchema = z5.object({
|
|
861
|
+
kind: z5.literal("file"),
|
|
862
|
+
sha256: z5.string().length(64),
|
|
863
|
+
timestamp: z5.string().datetime(),
|
|
864
|
+
path: z5.string().min(1),
|
|
865
|
+
mime: z5.string().optional(),
|
|
866
|
+
description: z5.string().optional()
|
|
807
867
|
});
|
|
808
|
-
logEvidenceSchema =
|
|
809
|
-
kind:
|
|
810
|
-
sha256:
|
|
811
|
-
timestamp:
|
|
812
|
-
source:
|
|
813
|
-
description:
|
|
868
|
+
logEvidenceSchema = z5.object({
|
|
869
|
+
kind: z5.literal("log"),
|
|
870
|
+
sha256: z5.string().length(64),
|
|
871
|
+
timestamp: z5.string().datetime(),
|
|
872
|
+
source: z5.string().min(1),
|
|
873
|
+
description: z5.string().optional()
|
|
814
874
|
});
|
|
815
|
-
screenshotEvidenceSchema =
|
|
816
|
-
kind:
|
|
817
|
-
sha256:
|
|
818
|
-
timestamp:
|
|
819
|
-
mime:
|
|
820
|
-
description:
|
|
875
|
+
screenshotEvidenceSchema = z5.object({
|
|
876
|
+
kind: z5.literal("screenshot"),
|
|
877
|
+
sha256: z5.string().length(64),
|
|
878
|
+
timestamp: z5.string().datetime(),
|
|
879
|
+
mime: z5.enum(["image/png", "image/jpeg", "image/webp"]).optional(),
|
|
880
|
+
description: z5.string().optional()
|
|
821
881
|
});
|
|
822
|
-
testOutputEvidenceSchema =
|
|
823
|
-
kind:
|
|
824
|
-
sha256:
|
|
825
|
-
timestamp:
|
|
826
|
-
passed:
|
|
827
|
-
failed:
|
|
828
|
-
skipped:
|
|
829
|
-
exitCode:
|
|
830
|
-
description:
|
|
882
|
+
testOutputEvidenceSchema = z5.object({
|
|
883
|
+
kind: z5.literal("test-output"),
|
|
884
|
+
sha256: z5.string().length(64),
|
|
885
|
+
timestamp: z5.string().datetime(),
|
|
886
|
+
passed: z5.number().int().nonnegative(),
|
|
887
|
+
failed: z5.number().int().nonnegative(),
|
|
888
|
+
skipped: z5.number().int().nonnegative(),
|
|
889
|
+
exitCode: z5.number().int(),
|
|
890
|
+
description: z5.string().optional()
|
|
831
891
|
});
|
|
832
|
-
commandOutputEvidenceSchema =
|
|
833
|
-
kind:
|
|
834
|
-
sha256:
|
|
835
|
-
timestamp:
|
|
836
|
-
cmd:
|
|
837
|
-
exitCode:
|
|
838
|
-
description:
|
|
892
|
+
commandOutputEvidenceSchema = z5.object({
|
|
893
|
+
kind: z5.literal("command-output"),
|
|
894
|
+
sha256: z5.string().length(64),
|
|
895
|
+
timestamp: z5.string().datetime(),
|
|
896
|
+
cmd: z5.string().min(1),
|
|
897
|
+
exitCode: z5.number().int(),
|
|
898
|
+
description: z5.string().optional()
|
|
839
899
|
});
|
|
840
|
-
taskEvidenceSchema =
|
|
900
|
+
taskEvidenceSchema = z5.discriminatedUnion("kind", [
|
|
841
901
|
fileEvidenceSchema,
|
|
842
902
|
logEvidenceSchema,
|
|
843
903
|
screenshotEvidenceSchema,
|
|
@@ -862,6 +922,7 @@ var init_src = __esm({
|
|
|
862
922
|
init_params();
|
|
863
923
|
init_peer();
|
|
864
924
|
init_session2();
|
|
925
|
+
init_session_journal();
|
|
865
926
|
init_status_registry();
|
|
866
927
|
init_task_evidence();
|
|
867
928
|
}
|
|
@@ -9155,6 +9216,11 @@ async function sessionGc(projectRoot, maxAgeDays = 1) {
|
|
|
9155
9216
|
await accessor.removeSingleSession(s.id);
|
|
9156
9217
|
}
|
|
9157
9218
|
}
|
|
9219
|
+
try {
|
|
9220
|
+
const { rotateSessionJournals } = await import("@cleocode/core/sessions/session-journal.js");
|
|
9221
|
+
await rotateSessionJournals(projectRoot);
|
|
9222
|
+
} catch {
|
|
9223
|
+
}
|
|
9158
9224
|
return { success: true, data: { orphaned, removed } };
|
|
9159
9225
|
} catch {
|
|
9160
9226
|
return engineError("E_NOT_INITIALIZED", "Task database not initialized");
|
|
@@ -11740,9 +11806,9 @@ async function systemLog(projectRoot, filters) {
|
|
|
11740
11806
|
}
|
|
11741
11807
|
async function queryAuditLogSqlite(projectRoot, filters) {
|
|
11742
11808
|
try {
|
|
11743
|
-
const { join:
|
|
11809
|
+
const { join: join23 } = await import("node:path");
|
|
11744
11810
|
const { existsSync: existsSync12 } = await import("node:fs");
|
|
11745
|
-
const dbPath =
|
|
11811
|
+
const dbPath = join23(projectRoot, CLEO_DIR_NAME, TASKS_DB_FILENAME);
|
|
11746
11812
|
if (!existsSync12(dbPath)) {
|
|
11747
11813
|
const offset = filters?.offset ?? 0;
|
|
11748
11814
|
const limit = filters?.limit ?? 20;
|
|
@@ -25339,6 +25405,8 @@ var init_state = __esm({
|
|
|
25339
25405
|
});
|
|
25340
25406
|
|
|
25341
25407
|
// packages/playbooks/src/runtime.ts
|
|
25408
|
+
import { appendFileSync, mkdirSync } from "node:fs";
|
|
25409
|
+
import { dirname as dirname2, join as join4 } from "node:path";
|
|
25342
25410
|
function buildEdgeIndex(def) {
|
|
25343
25411
|
const outgoing = /* @__PURE__ */ new Map();
|
|
25344
25412
|
const incoming = /* @__PURE__ */ new Map();
|
|
@@ -25506,16 +25574,19 @@ function resolveEdge(fromId, toId, edges) {
|
|
|
25506
25574
|
function auditContractViolation(projectRoot, runId, nodeId, field, key, playbookName) {
|
|
25507
25575
|
if (!projectRoot) return;
|
|
25508
25576
|
try {
|
|
25509
|
-
|
|
25510
|
-
|
|
25511
|
-
|
|
25512
|
-
|
|
25513
|
-
|
|
25514
|
-
|
|
25515
|
-
|
|
25516
|
-
|
|
25517
|
-
}
|
|
25577
|
+
const filePath = join4(projectRoot, ".cleo", "audit", "contract-violations.jsonl");
|
|
25578
|
+
mkdirSync(dirname2(filePath), { recursive: true });
|
|
25579
|
+
const entry = JSON.stringify({
|
|
25580
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
25581
|
+
runId,
|
|
25582
|
+
nodeId,
|
|
25583
|
+
field,
|
|
25584
|
+
key,
|
|
25585
|
+
message: `contract_violation: ${field}['${key}'] check failed on node '${nodeId}'`,
|
|
25586
|
+
playbookName
|
|
25518
25587
|
});
|
|
25588
|
+
appendFileSync(filePath, `${entry}
|
|
25589
|
+
`, { encoding: "utf-8" });
|
|
25519
25590
|
} catch {
|
|
25520
25591
|
}
|
|
25521
25592
|
}
|
|
@@ -25960,7 +26031,7 @@ var init_src2 = __esm({
|
|
|
25960
26031
|
// packages/cleo/src/dispatch/domains/playbook.ts
|
|
25961
26032
|
import { existsSync as existsSync3, readFileSync as readFileSync6 } from "node:fs";
|
|
25962
26033
|
import { homedir } from "node:os";
|
|
25963
|
-
import { dirname as
|
|
26034
|
+
import { dirname as dirname3, join as join5, resolve as resolvePath2 } from "node:path";
|
|
25964
26035
|
import { fileURLToPath } from "node:url";
|
|
25965
26036
|
function normalizeListStatus(raw) {
|
|
25966
26037
|
if (typeof raw !== "string" || raw.length === 0) return void 0;
|
|
@@ -25988,8 +26059,8 @@ function resolvePlaybookDirs() {
|
|
|
25988
26059
|
if (__playbookRuntimeOverrides.playbookBaseDirs) {
|
|
25989
26060
|
return __playbookRuntimeOverrides.playbookBaseDirs;
|
|
25990
26061
|
}
|
|
25991
|
-
const globalDir =
|
|
25992
|
-
const here =
|
|
26062
|
+
const globalDir = join5(homedir(), ".local", "share", "cleo", "playbooks");
|
|
26063
|
+
const here = dirname3(fileURLToPath(import.meta.url));
|
|
25993
26064
|
const sourceStarter = resolvePath2(here, "..", "..", "..", "..", "playbooks", "starter");
|
|
25994
26065
|
const bundledStarter = resolvePath2(here, "..", "..", "..", "playbooks", "starter");
|
|
25995
26066
|
return [globalDir, sourceStarter, bundledStarter];
|
|
@@ -25998,7 +26069,7 @@ function loadPlaybookByName(name) {
|
|
|
25998
26069
|
const candidates = resolvePlaybookDirs();
|
|
25999
26070
|
const fileName = name.endsWith(".cantbook") ? name : `${name}.cantbook`;
|
|
26000
26071
|
for (const dir of candidates) {
|
|
26001
|
-
const full =
|
|
26072
|
+
const full = join5(dir, fileName);
|
|
26002
26073
|
if (existsSync3(full)) {
|
|
26003
26074
|
return { sourcePath: full, source: readFileSync6(full, "utf8") };
|
|
26004
26075
|
}
|
|
@@ -26562,7 +26633,7 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
26562
26633
|
try {
|
|
26563
26634
|
const { getCleoCantWorkflowsDir: getCleoCantWorkflowsDir2 } = await import("@cleocode/core/internal");
|
|
26564
26635
|
const { readFileSync: readFileSync16, readdirSync: readdirSync4, existsSync: existsSync12 } = await import("node:fs");
|
|
26565
|
-
const { join:
|
|
26636
|
+
const { join: join23 } = await import("node:path");
|
|
26566
26637
|
const workflowsDir = getCleoCantWorkflowsDir2();
|
|
26567
26638
|
const combined = `${request} ${context ?? ""}`.toLowerCase();
|
|
26568
26639
|
const matches = [];
|
|
@@ -26570,7 +26641,7 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
26570
26641
|
const files = readdirSync4(workflowsDir).filter((f) => f.endsWith(".cant"));
|
|
26571
26642
|
for (const file of files) {
|
|
26572
26643
|
try {
|
|
26573
|
-
const src = readFileSync16(
|
|
26644
|
+
const src = readFileSync16(join23(workflowsDir, file), "utf-8");
|
|
26574
26645
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
26575
26646
|
if (!teamMatch) continue;
|
|
26576
26647
|
const teamName = teamMatch[1];
|
|
@@ -26585,12 +26656,12 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
26585
26656
|
}
|
|
26586
26657
|
}
|
|
26587
26658
|
}
|
|
26588
|
-
const localCantDir =
|
|
26659
|
+
const localCantDir = join23(projectRoot, CLEO_DIR_NAME, WORKFLOWS_SUBDIR);
|
|
26589
26660
|
if (existsSync12(localCantDir)) {
|
|
26590
26661
|
const files = readdirSync4(localCantDir).filter((f) => f.endsWith(".cant"));
|
|
26591
26662
|
for (const file of files) {
|
|
26592
26663
|
try {
|
|
26593
|
-
const src = readFileSync16(
|
|
26664
|
+
const src = readFileSync16(join23(localCantDir, file), "utf-8");
|
|
26594
26665
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
26595
26666
|
if (!teamMatch) continue;
|
|
26596
26667
|
const teamName = teamMatch[1];
|
|
@@ -28568,7 +28639,7 @@ var init_pipeline2 = __esm({
|
|
|
28568
28639
|
});
|
|
28569
28640
|
|
|
28570
28641
|
// packages/cleo/src/dispatch/domains/sentient.ts
|
|
28571
|
-
import { join as
|
|
28642
|
+
import { join as join6 } from "node:path";
|
|
28572
28643
|
import { getProjectRoot as getProjectRoot11 } from "@cleocode/core";
|
|
28573
28644
|
function safeParseJsonArray(json2) {
|
|
28574
28645
|
if (!json2) return [];
|
|
@@ -28597,7 +28668,7 @@ async function incrementTier2Stat(projectRoot, field) {
|
|
|
28597
28668
|
try {
|
|
28598
28669
|
const { patchSentientState: patchSentientState2, readSentientState: readSentientState2 } = await import("@cleocode/core/sentient/state.js");
|
|
28599
28670
|
const { SENTIENT_STATE_FILE: SENTIENT_STATE_FILE2 } = await import("@cleocode/core/sentient/daemon.js");
|
|
28600
|
-
const statePath =
|
|
28671
|
+
const statePath = join6(projectRoot, SENTIENT_STATE_FILE2);
|
|
28601
28672
|
const state = await readSentientState2(statePath);
|
|
28602
28673
|
await patchSentientState2(statePath, {
|
|
28603
28674
|
tier2Stats: {
|
|
@@ -28874,7 +28945,7 @@ var init_sentient = __esm({
|
|
|
28874
28945
|
async runProposeTick(projectRoot, params) {
|
|
28875
28946
|
const { safeRunProposeTick: safeRunProposeTick2 } = await import("@cleocode/core/sentient/propose-tick.js");
|
|
28876
28947
|
const { SENTIENT_STATE_FILE: SENTIENT_STATE_FILE2 } = await import("@cleocode/core/sentient/daemon.js");
|
|
28877
|
-
const statePath =
|
|
28948
|
+
const statePath = join6(projectRoot, SENTIENT_STATE_FILE2);
|
|
28878
28949
|
const outcome = await safeRunProposeTick2({ projectRoot, statePath });
|
|
28879
28950
|
const _ = params;
|
|
28880
28951
|
void _;
|
|
@@ -28922,7 +28993,7 @@ var init_sentient = __esm({
|
|
|
28922
28993
|
async setTier2Enabled(projectRoot, enabled) {
|
|
28923
28994
|
const { patchSentientState: patchSentientState2 } = await import("@cleocode/core/sentient/state.js");
|
|
28924
28995
|
const { SENTIENT_STATE_FILE: SENTIENT_STATE_FILE2 } = await import("@cleocode/core/sentient/daemon.js");
|
|
28925
|
-
const statePath =
|
|
28996
|
+
const statePath = join6(projectRoot, SENTIENT_STATE_FILE2);
|
|
28926
28997
|
const updated = await patchSentientState2(statePath, { tier2Enabled: enabled });
|
|
28927
28998
|
return {
|
|
28928
28999
|
success: true,
|
|
@@ -30303,7 +30374,7 @@ var init_tasks3 = __esm({
|
|
|
30303
30374
|
});
|
|
30304
30375
|
|
|
30305
30376
|
// packages/cleo/src/dispatch/engines/code-engine.ts
|
|
30306
|
-
import { join as
|
|
30377
|
+
import { join as join7 } from "node:path";
|
|
30307
30378
|
import { getProjectRoot as getProjectRoot15 } from "@cleocode/core";
|
|
30308
30379
|
async function codeOutline(params) {
|
|
30309
30380
|
const { smartOutline } = await import("@cleocode/core/internal");
|
|
@@ -30314,7 +30385,7 @@ async function codeOutline(params) {
|
|
|
30314
30385
|
error: { code: "E_INVALID_INPUT", message: "file parameter required" }
|
|
30315
30386
|
};
|
|
30316
30387
|
const root = getProjectRoot15();
|
|
30317
|
-
const absPath = filePath.startsWith("/") ? filePath :
|
|
30388
|
+
const absPath = filePath.startsWith("/") ? filePath : join7(root, filePath);
|
|
30318
30389
|
return { success: true, data: smartOutline(absPath, root) };
|
|
30319
30390
|
}
|
|
30320
30391
|
async function codeSearch(params) {
|
|
@@ -30346,7 +30417,7 @@ async function codeUnfold(params) {
|
|
|
30346
30417
|
error: { code: "E_INVALID_INPUT", message: "file and symbol parameters required" }
|
|
30347
30418
|
};
|
|
30348
30419
|
const root = getProjectRoot15();
|
|
30349
|
-
const absPath = filePath.startsWith("/") ? filePath :
|
|
30420
|
+
const absPath = filePath.startsWith("/") ? filePath : join7(root, filePath);
|
|
30350
30421
|
return { success: true, data: smartUnfold(absPath, symbol, root) };
|
|
30351
30422
|
}
|
|
30352
30423
|
async function codeParse(params) {
|
|
@@ -30358,7 +30429,7 @@ async function codeParse(params) {
|
|
|
30358
30429
|
error: { code: "E_INVALID_INPUT", message: "file parameter required" }
|
|
30359
30430
|
};
|
|
30360
30431
|
const root = getProjectRoot15();
|
|
30361
|
-
const absPath = filePath.startsWith("/") ? filePath :
|
|
30432
|
+
const absPath = filePath.startsWith("/") ? filePath : join7(root, filePath);
|
|
30362
30433
|
return { success: true, data: parseFile(absPath, root) };
|
|
30363
30434
|
}
|
|
30364
30435
|
var init_code_engine = __esm({
|
|
@@ -31528,7 +31599,7 @@ var init_defaults = __esm({
|
|
|
31528
31599
|
|
|
31529
31600
|
// packages/cleo/src/dispatch/lib/config-loader.ts
|
|
31530
31601
|
import { existsSync as existsSync4, readFileSync as readFileSync7 } from "fs";
|
|
31531
|
-
import { join as
|
|
31602
|
+
import { join as join8 } from "path";
|
|
31532
31603
|
function loadFromEnv(key) {
|
|
31533
31604
|
const envKey = `${ENV_PREFIX}${key.toUpperCase()}`;
|
|
31534
31605
|
return process.env[envKey];
|
|
@@ -31549,7 +31620,7 @@ function parseEnvValue(key, value) {
|
|
|
31549
31620
|
}
|
|
31550
31621
|
function loadFromFile(projectRoot) {
|
|
31551
31622
|
const root = projectRoot || process.cwd();
|
|
31552
|
-
const configPath =
|
|
31623
|
+
const configPath = join8(root, CLEO_DIR_NAME, CONFIG_JSON);
|
|
31553
31624
|
if (!existsSync4(configPath)) {
|
|
31554
31625
|
return {};
|
|
31555
31626
|
}
|
|
@@ -32023,7 +32094,7 @@ __export(cli_exports, {
|
|
|
32023
32094
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
32024
32095
|
import { existsSync as existsSync5 } from "node:fs";
|
|
32025
32096
|
import { createRequire as createRequire2 } from "node:module";
|
|
32026
|
-
import { dirname as
|
|
32097
|
+
import { dirname as dirname4, join as join9 } from "node:path";
|
|
32027
32098
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
32028
32099
|
import { catalog as catalog2, registerSkillLibraryFromPath } from "@cleocode/caamp";
|
|
32029
32100
|
import { autoRecordDispatchTokenUsage, getProjectRoot as getProjectRoot17, hooks } from "@cleocode/core/internal";
|
|
@@ -32034,17 +32105,17 @@ function ensureCaampLibrary() {
|
|
|
32034
32105
|
try {
|
|
32035
32106
|
const req = createRequire2(import.meta.url);
|
|
32036
32107
|
const skillsPkgJson = req.resolve("@cleocode/skills/package.json");
|
|
32037
|
-
const candidate =
|
|
32038
|
-
if (existsSync5(
|
|
32108
|
+
const candidate = dirname4(skillsPkgJson);
|
|
32109
|
+
if (existsSync5(join9(candidate, "skills.json"))) {
|
|
32039
32110
|
skillsRoot = candidate;
|
|
32040
32111
|
}
|
|
32041
32112
|
} catch {
|
|
32042
32113
|
}
|
|
32043
32114
|
if (!skillsRoot) {
|
|
32044
32115
|
const thisFile = fileURLToPath2(import.meta.url);
|
|
32045
|
-
const packageRoot =
|
|
32046
|
-
const candidate =
|
|
32047
|
-
if (existsSync5(
|
|
32116
|
+
const packageRoot = join9(dirname4(thisFile), "..", "..", "..", "..", "..");
|
|
32117
|
+
const candidate = join9(packageRoot, "packages", "skills");
|
|
32118
|
+
if (existsSync5(join9(candidate, "skills.json"))) {
|
|
32048
32119
|
skillsRoot = candidate;
|
|
32049
32120
|
}
|
|
32050
32121
|
}
|
|
@@ -32264,7 +32335,7 @@ var init_cli = __esm({
|
|
|
32264
32335
|
|
|
32265
32336
|
// packages/cleo/src/cli/index.ts
|
|
32266
32337
|
import { readFileSync as readFileSync15 } from "node:fs";
|
|
32267
|
-
import { dirname as
|
|
32338
|
+
import { dirname as dirname10, join as join22 } from "node:path";
|
|
32268
32339
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
32269
32340
|
import {
|
|
32270
32341
|
detectAndRemoveLegacyGlobalFiles,
|
|
@@ -33891,13 +33962,13 @@ var registerCommand = defineCommand({
|
|
|
33891
33962
|
transportConfig: {},
|
|
33892
33963
|
isActive: true
|
|
33893
33964
|
});
|
|
33894
|
-
const { existsSync: existsSync12, mkdirSync:
|
|
33895
|
-
const { join:
|
|
33896
|
-
const cantDir =
|
|
33897
|
-
const cantPath =
|
|
33965
|
+
const { existsSync: existsSync12, mkdirSync: mkdirSync5, writeFileSync: writeFileSync5 } = await import("node:fs");
|
|
33966
|
+
const { join: join23 } = await import("node:path");
|
|
33967
|
+
const cantDir = join23(CLEO_DIR_NAME, AGENTS_SUBDIR);
|
|
33968
|
+
const cantPath = join23(cantDir, `${agentId}.cant`);
|
|
33898
33969
|
let cantScaffolded = false;
|
|
33899
33970
|
if (!existsSync12(cantPath)) {
|
|
33900
|
-
|
|
33971
|
+
mkdirSync5(cantDir, { recursive: true });
|
|
33901
33972
|
const role = classification ?? "specialist";
|
|
33902
33973
|
const cantContent = `---
|
|
33903
33974
|
kind: agent
|
|
@@ -34076,7 +34147,7 @@ var startCommand = defineCommand({
|
|
|
34076
34147
|
const { AgentRegistryAccessor, getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
34077
34148
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
34078
34149
|
const { existsSync: existsSync12, readFileSync: readFileSync16 } = await import("node:fs");
|
|
34079
|
-
const { join:
|
|
34150
|
+
const { join: join23 } = await import("node:path");
|
|
34080
34151
|
await getDb3();
|
|
34081
34152
|
const registry = new AgentRegistryAccessor(process.cwd());
|
|
34082
34153
|
const credential = await registry.get(args.agentId);
|
|
@@ -34096,7 +34167,7 @@ var startCommand = defineCommand({
|
|
|
34096
34167
|
}
|
|
34097
34168
|
let profile = null;
|
|
34098
34169
|
let cantValidation = null;
|
|
34099
|
-
const cantPath = args.cant ??
|
|
34170
|
+
const cantPath = args.cant ?? join23(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
34100
34171
|
if (existsSync12(cantPath)) {
|
|
34101
34172
|
profile = readFileSync16(cantPath, "utf-8");
|
|
34102
34173
|
try {
|
|
@@ -34622,7 +34693,7 @@ var workCommand = defineCommand({
|
|
|
34622
34693
|
const { AgentRegistryAccessor, getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
34623
34694
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
34624
34695
|
const { existsSync: existsSync12 } = await import("node:fs");
|
|
34625
|
-
const { join:
|
|
34696
|
+
const { join: join23 } = await import("node:path");
|
|
34626
34697
|
const { execFile: execFile2 } = await import("node:child_process");
|
|
34627
34698
|
const { promisify: promisify2 } = await import("node:util");
|
|
34628
34699
|
const execFileAsync = promisify2(execFile2);
|
|
@@ -34642,7 +34713,7 @@ var workCommand = defineCommand({
|
|
|
34642
34713
|
}
|
|
34643
34714
|
await registry.update(args.agentId, { isActive: true });
|
|
34644
34715
|
await registry.markUsed(args.agentId);
|
|
34645
|
-
const cantPath =
|
|
34716
|
+
const cantPath = join23(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
34646
34717
|
const hasProfile = existsSync12(cantPath);
|
|
34647
34718
|
const runtime = await createRuntime(registry, {
|
|
34648
34719
|
agentId: args.agentId,
|
|
@@ -35493,8 +35564,8 @@ var installCommand = defineCommand({
|
|
|
35493
35564
|
async run({ args }) {
|
|
35494
35565
|
let tempDir = null;
|
|
35495
35566
|
try {
|
|
35496
|
-
const { existsSync: existsSync12, mkdirSync:
|
|
35497
|
-
const { join:
|
|
35567
|
+
const { existsSync: existsSync12, mkdirSync: mkdirSync5, statSync, readdirSync: readdirSync4, copyFileSync } = await import("node:fs");
|
|
35568
|
+
const { join: join23, basename: basename2, resolve: resolve5, extname } = await import("node:path");
|
|
35498
35569
|
const { tmpdir } = await import("node:os");
|
|
35499
35570
|
const resolvedPath = resolve5(args.path);
|
|
35500
35571
|
if (!existsSync12(resolvedPath)) {
|
|
@@ -35518,8 +35589,8 @@ var installCommand = defineCommand({
|
|
|
35518
35589
|
cantPath = resolvedPath;
|
|
35519
35590
|
} else if (stat2.isFile() && ext === ".cantz") {
|
|
35520
35591
|
const { execFileSync: execFileSync6 } = await import("node:child_process");
|
|
35521
|
-
tempDir =
|
|
35522
|
-
|
|
35592
|
+
tempDir = join23(tmpdir(), `cleo-agent-install-${Date.now()}`);
|
|
35593
|
+
mkdirSync5(tempDir, { recursive: true });
|
|
35523
35594
|
try {
|
|
35524
35595
|
execFileSync6("unzip", ["-o", "-q", resolvedPath, "-d", tempDir], {
|
|
35525
35596
|
encoding: "utf-8",
|
|
@@ -35540,7 +35611,7 @@ var installCommand = defineCommand({
|
|
|
35540
35611
|
return;
|
|
35541
35612
|
}
|
|
35542
35613
|
const topLevel = readdirSync4(tempDir).filter(
|
|
35543
|
-
(entry) => statSync(
|
|
35614
|
+
(entry) => statSync(join23(tempDir, entry)).isDirectory()
|
|
35544
35615
|
);
|
|
35545
35616
|
if (topLevel.length !== 1) {
|
|
35546
35617
|
cliOutput(
|
|
@@ -35557,7 +35628,7 @@ var installCommand = defineCommand({
|
|
|
35557
35628
|
return;
|
|
35558
35629
|
}
|
|
35559
35630
|
const agentName = topLevel[0];
|
|
35560
|
-
const personaPath =
|
|
35631
|
+
const personaPath = join23(tempDir, agentName, "persona.cant");
|
|
35561
35632
|
if (!existsSync12(personaPath)) {
|
|
35562
35633
|
cliOutput(
|
|
35563
35634
|
{
|
|
@@ -35572,11 +35643,11 @@ var installCommand = defineCommand({
|
|
|
35572
35643
|
process.exitCode = 6;
|
|
35573
35644
|
return;
|
|
35574
35645
|
}
|
|
35575
|
-
cantPath =
|
|
35646
|
+
cantPath = join23(tempDir, `${agentName}.cant`);
|
|
35576
35647
|
copyFileSync(personaPath, cantPath);
|
|
35577
35648
|
} else if (stat2.isDirectory()) {
|
|
35578
35649
|
const agentName = basename2(resolvedPath);
|
|
35579
|
-
const personaPath =
|
|
35650
|
+
const personaPath = join23(resolvedPath, "persona.cant");
|
|
35580
35651
|
if (!existsSync12(personaPath)) {
|
|
35581
35652
|
cliOutput(
|
|
35582
35653
|
{
|
|
@@ -35591,9 +35662,9 @@ var installCommand = defineCommand({
|
|
|
35591
35662
|
process.exitCode = 6;
|
|
35592
35663
|
return;
|
|
35593
35664
|
}
|
|
35594
|
-
tempDir =
|
|
35595
|
-
|
|
35596
|
-
cantPath =
|
|
35665
|
+
tempDir = join23(tmpdir(), `cleo-agent-install-${Date.now()}`);
|
|
35666
|
+
mkdirSync5(tempDir, { recursive: true });
|
|
35667
|
+
cantPath = join23(tempDir, `${agentName}.cant`);
|
|
35597
35668
|
copyFileSync(personaPath, cantPath);
|
|
35598
35669
|
} else {
|
|
35599
35670
|
cliOutput(
|
|
@@ -35721,7 +35792,7 @@ var packCommand = defineCommand({
|
|
|
35721
35792
|
async run({ args }) {
|
|
35722
35793
|
try {
|
|
35723
35794
|
const { existsSync: existsSync12, statSync } = await import("node:fs");
|
|
35724
|
-
const { resolve: resolve5, basename: basename2, dirname:
|
|
35795
|
+
const { resolve: resolve5, basename: basename2, dirname: dirname11 } = await import("node:path");
|
|
35725
35796
|
const { execFileSync: execFileSync6 } = await import("node:child_process");
|
|
35726
35797
|
const resolvedDir = resolve5(args.dir);
|
|
35727
35798
|
if (!existsSync12(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
|
|
@@ -35738,8 +35809,8 @@ var packCommand = defineCommand({
|
|
|
35738
35809
|
process.exitCode = 4;
|
|
35739
35810
|
return;
|
|
35740
35811
|
}
|
|
35741
|
-
const { join:
|
|
35742
|
-
const personaPath =
|
|
35812
|
+
const { join: join23 } = await import("node:path");
|
|
35813
|
+
const personaPath = join23(resolvedDir, "persona.cant");
|
|
35743
35814
|
if (!existsSync12(personaPath)) {
|
|
35744
35815
|
cliOutput(
|
|
35745
35816
|
{
|
|
@@ -35757,7 +35828,7 @@ var packCommand = defineCommand({
|
|
|
35757
35828
|
const agentName = basename2(resolvedDir);
|
|
35758
35829
|
const archiveName = `${agentName}.cantz`;
|
|
35759
35830
|
const archivePath = resolve5(archiveName);
|
|
35760
|
-
const parentDir =
|
|
35831
|
+
const parentDir = dirname11(resolvedDir);
|
|
35761
35832
|
try {
|
|
35762
35833
|
execFileSync6("zip", ["-r", archivePath, agentName], {
|
|
35763
35834
|
cwd: parentDir,
|
|
@@ -35787,7 +35858,7 @@ var packCommand = defineCommand({
|
|
|
35787
35858
|
if (entry.isFile()) {
|
|
35788
35859
|
fileCount++;
|
|
35789
35860
|
} else if (entry.isDirectory()) {
|
|
35790
|
-
countFiles(
|
|
35861
|
+
countFiles(join23(dirPath, entry.name));
|
|
35791
35862
|
}
|
|
35792
35863
|
}
|
|
35793
35864
|
};
|
|
@@ -35856,8 +35927,8 @@ var createCommand = defineCommand({
|
|
|
35856
35927
|
},
|
|
35857
35928
|
async run({ args }) {
|
|
35858
35929
|
try {
|
|
35859
|
-
const { existsSync: existsSync12, mkdirSync:
|
|
35860
|
-
const { join:
|
|
35930
|
+
const { existsSync: existsSync12, mkdirSync: mkdirSync5, writeFileSync: writeFileSync5 } = await import("node:fs");
|
|
35931
|
+
const { join: join23 } = await import("node:path");
|
|
35861
35932
|
const { homedir: homedir6 } = await import("node:os");
|
|
35862
35933
|
const name = args.name;
|
|
35863
35934
|
const role = args.role;
|
|
@@ -35917,12 +35988,12 @@ var createCommand = defineCommand({
|
|
|
35917
35988
|
let targetRoot;
|
|
35918
35989
|
if (isGlobal) {
|
|
35919
35990
|
const home = homedir6();
|
|
35920
|
-
const xdgData = process.env["XDG_DATA_HOME"] ??
|
|
35921
|
-
targetRoot =
|
|
35991
|
+
const xdgData = process.env["XDG_DATA_HOME"] ?? join23(home, ".local", "share");
|
|
35992
|
+
targetRoot = join23(xdgData, "cleo", "cant", "agents");
|
|
35922
35993
|
} else {
|
|
35923
|
-
targetRoot =
|
|
35994
|
+
targetRoot = join23(process.cwd(), CLEO_DIR_NAME, CANT_AGENTS_SUBDIR);
|
|
35924
35995
|
}
|
|
35925
|
-
const agentDir =
|
|
35996
|
+
const agentDir = join23(targetRoot, name);
|
|
35926
35997
|
if (existsSync12(agentDir)) {
|
|
35927
35998
|
cliOutput(
|
|
35928
35999
|
{
|
|
@@ -35938,7 +36009,7 @@ var createCommand = defineCommand({
|
|
|
35938
36009
|
process.exitCode = 6;
|
|
35939
36010
|
return;
|
|
35940
36011
|
}
|
|
35941
|
-
|
|
36012
|
+
mkdirSync5(agentDir, { recursive: true });
|
|
35942
36013
|
const personaContent = generatePersonaCant({
|
|
35943
36014
|
name,
|
|
35944
36015
|
role,
|
|
@@ -35947,29 +36018,29 @@ var createCommand = defineCommand({
|
|
|
35947
36018
|
domain,
|
|
35948
36019
|
parent
|
|
35949
36020
|
});
|
|
35950
|
-
writeFileSync5(
|
|
36021
|
+
writeFileSync5(join23(agentDir, "persona.cant"), personaContent, "utf-8");
|
|
35951
36022
|
const manifest = generateManifest({ name, role, tier, domain });
|
|
35952
36023
|
writeFileSync5(
|
|
35953
|
-
|
|
36024
|
+
join23(agentDir, "manifest.json"),
|
|
35954
36025
|
`${JSON.stringify(manifest, null, 2)}
|
|
35955
36026
|
`,
|
|
35956
36027
|
"utf-8"
|
|
35957
36028
|
);
|
|
35958
36029
|
const createdFiles = [
|
|
35959
|
-
|
|
35960
|
-
|
|
36030
|
+
join23(agentDir, "persona.cant"),
|
|
36031
|
+
join23(agentDir, "manifest.json")
|
|
35961
36032
|
];
|
|
35962
36033
|
if (team) {
|
|
35963
36034
|
const teamConfigContent = generateTeamConfig(name, role, team);
|
|
35964
|
-
writeFileSync5(
|
|
35965
|
-
createdFiles.push(
|
|
36035
|
+
writeFileSync5(join23(agentDir, "team-config.cant"), teamConfigContent, "utf-8");
|
|
36036
|
+
createdFiles.push(join23(agentDir, "team-config.cant"));
|
|
35966
36037
|
}
|
|
35967
36038
|
if (seedBrain) {
|
|
35968
|
-
const expertiseDir =
|
|
35969
|
-
|
|
36039
|
+
const expertiseDir = join23(agentDir, "expertise");
|
|
36040
|
+
mkdirSync5(expertiseDir, { recursive: true });
|
|
35970
36041
|
const seedContent = generateMentalModelSeed(name, role, domain);
|
|
35971
|
-
writeFileSync5(
|
|
35972
|
-
createdFiles.push(
|
|
36042
|
+
writeFileSync5(join23(expertiseDir, "mental-model-seed.md"), seedContent, "utf-8");
|
|
36043
|
+
createdFiles.push(join23(expertiseDir, "mental-model-seed.md"));
|
|
35973
36044
|
try {
|
|
35974
36045
|
const { execFile: execFile2 } = await import("node:child_process");
|
|
35975
36046
|
const { promisify: promisify2 } = await import("node:util");
|
|
@@ -36067,8 +36138,8 @@ var mintCommand = defineCommand({
|
|
|
36067
36138
|
},
|
|
36068
36139
|
async run({ args }) {
|
|
36069
36140
|
try {
|
|
36070
|
-
const { existsSync: existsSync12, readFileSync: readFileSync16, mkdirSync:
|
|
36071
|
-
const { resolve: resolve5, join:
|
|
36141
|
+
const { existsSync: existsSync12, readFileSync: readFileSync16, mkdirSync: mkdirSync5 } = await import("node:fs");
|
|
36142
|
+
const { resolve: resolve5, join: join23 } = await import("node:path");
|
|
36072
36143
|
const specPath = resolve5(args.spec);
|
|
36073
36144
|
if (!existsSync12(specPath)) {
|
|
36074
36145
|
const errEnv = {
|
|
@@ -36087,8 +36158,8 @@ var mintCommand = defineCommand({
|
|
|
36087
36158
|
}
|
|
36088
36159
|
const specContent = readFileSync16(specPath, "utf-8");
|
|
36089
36160
|
const projectRoot = process.cwd();
|
|
36090
|
-
const outputDir = args["output-dir"] ? resolve5(args["output-dir"]) :
|
|
36091
|
-
|
|
36161
|
+
const outputDir = args["output-dir"] ? resolve5(args["output-dir"]) : join23(projectRoot, ".cleo", "cant", "agents");
|
|
36162
|
+
mkdirSync5(outputDir, { recursive: true });
|
|
36092
36163
|
if (args["dry-run"]) {
|
|
36093
36164
|
const preview = {
|
|
36094
36165
|
success: true,
|
|
@@ -38095,7 +38166,7 @@ var briefingCommand = defineCommand({
|
|
|
38095
38166
|
// packages/cleo/src/cli/commands/bug.ts
|
|
38096
38167
|
import { existsSync as existsSync7 } from "node:fs";
|
|
38097
38168
|
import { appendFile as appendFile2, mkdir as mkdir2, readFile as readFile2 } from "node:fs/promises";
|
|
38098
|
-
import { dirname as
|
|
38169
|
+
import { dirname as dirname5, join as join10 } from "node:path";
|
|
38099
38170
|
import { getCleoDirAbsolute as getCleoDirAbsolute2, getCleoIdentity, getConfigPath, signAuditLine } from "@cleocode/core";
|
|
38100
38171
|
init_cli();
|
|
38101
38172
|
var SEVERITY_MAP = {
|
|
@@ -38148,8 +38219,8 @@ async function appendSignedBugSeverity(record) {
|
|
|
38148
38219
|
const sig = await signAuditLine(id, canonical);
|
|
38149
38220
|
const line = `${JSON.stringify({ ...full, _sig: sig })}
|
|
38150
38221
|
`;
|
|
38151
|
-
const auditPath =
|
|
38152
|
-
await mkdir2(
|
|
38222
|
+
const auditPath = join10(getCleoDirAbsolute2(), "audit", "bug-severity.jsonl");
|
|
38223
|
+
await mkdir2(dirname5(auditPath), { recursive: true });
|
|
38153
38224
|
await appendFile2(auditPath, line, { encoding: "utf-8" });
|
|
38154
38225
|
}
|
|
38155
38226
|
var bugCommand = defineCommand({
|
|
@@ -38261,8 +38332,8 @@ var cancelCommand = defineCommand({
|
|
|
38261
38332
|
});
|
|
38262
38333
|
|
|
38263
38334
|
// packages/cleo/src/cli/commands/cant.ts
|
|
38264
|
-
import { existsSync as existsSync8, mkdirSync, readFileSync as readFileSync9, writeFileSync as writeFileSync2 } from "node:fs";
|
|
38265
|
-
import { dirname as
|
|
38335
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync2, readFileSync as readFileSync9, writeFileSync as writeFileSync2 } from "node:fs";
|
|
38336
|
+
import { dirname as dirname6, isAbsolute, join as join11, resolve as resolve3 } from "node:path";
|
|
38266
38337
|
init_renderers();
|
|
38267
38338
|
function resolveFilePath(file) {
|
|
38268
38339
|
return isAbsolute(file) ? file : resolve3(process.cwd(), file);
|
|
@@ -38422,8 +38493,8 @@ var cantMigrateCommand = defineCommand({
|
|
|
38422
38493
|
const projectRoot = process.cwd();
|
|
38423
38494
|
let written = 0;
|
|
38424
38495
|
for (const outputFile of result.outputFiles) {
|
|
38425
|
-
const outputPath = isAbsolute(outputFile.path) ? outputFile.path :
|
|
38426
|
-
|
|
38496
|
+
const outputPath = isAbsolute(outputFile.path) ? outputFile.path : join11(projectRoot, outputFile.path);
|
|
38497
|
+
mkdirSync2(dirname6(outputPath), { recursive: true });
|
|
38427
38498
|
writeFileSync2(outputPath, outputFile.content, "utf-8");
|
|
38428
38499
|
written++;
|
|
38429
38500
|
}
|
|
@@ -39021,9 +39092,9 @@ var codeCommand = defineCommand({
|
|
|
39021
39092
|
async run({ args }) {
|
|
39022
39093
|
await requireTreeSitter();
|
|
39023
39094
|
const { smartOutline } = await import("@cleocode/core/internal");
|
|
39024
|
-
const { join:
|
|
39095
|
+
const { join: join23 } = await import("node:path");
|
|
39025
39096
|
const root = process.cwd();
|
|
39026
|
-
const absPath = args.file.startsWith("/") ? args.file :
|
|
39097
|
+
const absPath = args.file.startsWith("/") ? args.file : join23(root, args.file);
|
|
39027
39098
|
const result = smartOutline(absPath, root);
|
|
39028
39099
|
if (result.errors.length > 0 && result.symbols.length === 0) {
|
|
39029
39100
|
console.error(`Error: ${result.errors.join(", ")}`);
|
|
@@ -39114,9 +39185,9 @@ var codeCommand = defineCommand({
|
|
|
39114
39185
|
async run({ args }) {
|
|
39115
39186
|
await requireTreeSitter();
|
|
39116
39187
|
const { smartUnfold } = await import("@cleocode/core/internal");
|
|
39117
|
-
const { join:
|
|
39188
|
+
const { join: join23 } = await import("node:path");
|
|
39118
39189
|
const root = process.cwd();
|
|
39119
|
-
const absPath = args.file.startsWith("/") ? args.file :
|
|
39190
|
+
const absPath = args.file.startsWith("/") ? args.file : join23(root, args.file);
|
|
39120
39191
|
const result = smartUnfold(absPath, args.symbol, root);
|
|
39121
39192
|
if (!result.found) {
|
|
39122
39193
|
console.error(`Symbol "${args.symbol}" not found in ${args.file}`);
|
|
@@ -40159,7 +40230,7 @@ var currentCommand = defineCommand({
|
|
|
40159
40230
|
|
|
40160
40231
|
// packages/cleo/src/cli/commands/daemon.ts
|
|
40161
40232
|
import { homedir as homedir2 } from "node:os";
|
|
40162
|
-
import { join as
|
|
40233
|
+
import { join as join12 } from "node:path";
|
|
40163
40234
|
import { getGCDaemonStatus, spawnGCDaemon, stopGCDaemon } from "@cleocode/core/gc/daemon.js";
|
|
40164
40235
|
async function showDaemonStatus(cleoDir, json2) {
|
|
40165
40236
|
try {
|
|
@@ -40212,7 +40283,7 @@ var startCommand3 = defineCommand({
|
|
|
40212
40283
|
}
|
|
40213
40284
|
},
|
|
40214
40285
|
async run({ args }) {
|
|
40215
|
-
const cleoDir = args["cleo-dir"] ??
|
|
40286
|
+
const cleoDir = args["cleo-dir"] ?? join12(homedir2(), ".cleo");
|
|
40216
40287
|
const jsonMode = args.json ?? false;
|
|
40217
40288
|
try {
|
|
40218
40289
|
const status = await getGCDaemonStatus(cleoDir);
|
|
@@ -40243,7 +40314,7 @@ var startCommand3 = defineCommand({
|
|
|
40243
40314
|
} else {
|
|
40244
40315
|
process.stdout.write(`GC daemon started (PID ${pid})
|
|
40245
40316
|
`);
|
|
40246
|
-
process.stdout.write(`Logs: ${
|
|
40317
|
+
process.stdout.write(`Logs: ${join12(cleoDir, "logs", "gc.log")}
|
|
40247
40318
|
`);
|
|
40248
40319
|
}
|
|
40249
40320
|
} catch (err) {
|
|
@@ -40272,7 +40343,7 @@ var stopCommand3 = defineCommand({
|
|
|
40272
40343
|
}
|
|
40273
40344
|
},
|
|
40274
40345
|
async run({ args }) {
|
|
40275
|
-
const cleoDir = args["cleo-dir"] ??
|
|
40346
|
+
const cleoDir = args["cleo-dir"] ?? join12(homedir2(), ".cleo");
|
|
40276
40347
|
const jsonMode = args.json ?? false;
|
|
40277
40348
|
try {
|
|
40278
40349
|
const stopResult = await stopGCDaemon(cleoDir);
|
|
@@ -40318,7 +40389,7 @@ var statusCommand4 = defineCommand({
|
|
|
40318
40389
|
}
|
|
40319
40390
|
},
|
|
40320
40391
|
async run({ args }) {
|
|
40321
|
-
const cleoDir = args["cleo-dir"] ??
|
|
40392
|
+
const cleoDir = args["cleo-dir"] ?? join12(homedir2(), ".cleo");
|
|
40322
40393
|
await showDaemonStatus(cleoDir, args.json ?? false);
|
|
40323
40394
|
}
|
|
40324
40395
|
});
|
|
@@ -40344,7 +40415,7 @@ var daemonCommand = defineCommand({
|
|
|
40344
40415
|
},
|
|
40345
40416
|
async run({ args, cmd, rawArgs }) {
|
|
40346
40417
|
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
40347
|
-
const cleoDir = args["cleo-dir"] ??
|
|
40418
|
+
const cleoDir = args["cleo-dir"] ?? join12(homedir2(), ".cleo");
|
|
40348
40419
|
await showDaemonStatus(cleoDir, args.json ?? false);
|
|
40349
40420
|
}
|
|
40350
40421
|
});
|
|
@@ -40696,16 +40767,16 @@ var detectCommand2 = defineCommand({
|
|
|
40696
40767
|
// packages/cleo/src/cli/commands/detect-drift.ts
|
|
40697
40768
|
init_src();
|
|
40698
40769
|
import { existsSync as existsSync9, readdirSync as readdirSync2, readFileSync as readFileSync11 } from "node:fs";
|
|
40699
|
-
import { dirname as
|
|
40770
|
+
import { dirname as dirname7, join as join13 } from "node:path";
|
|
40700
40771
|
init_paths();
|
|
40701
40772
|
init_renderers();
|
|
40702
40773
|
function findProjectRoot() {
|
|
40703
40774
|
let currentDir = process.cwd();
|
|
40704
40775
|
while (currentDir !== "/") {
|
|
40705
|
-
if (existsSync9(
|
|
40776
|
+
if (existsSync9(join13(currentDir, "package.json"))) {
|
|
40706
40777
|
return currentDir;
|
|
40707
40778
|
}
|
|
40708
|
-
const parent =
|
|
40779
|
+
const parent = dirname7(currentDir);
|
|
40709
40780
|
if (parent === currentDir) break;
|
|
40710
40781
|
currentDir = parent;
|
|
40711
40782
|
}
|
|
@@ -40718,8 +40789,8 @@ var detectDriftCommand = defineCommand({
|
|
|
40718
40789
|
},
|
|
40719
40790
|
async run() {
|
|
40720
40791
|
const projectRoot = findProjectRoot();
|
|
40721
|
-
const isCleoRepo = existsSync9(
|
|
40722
|
-
const cleoSrcRoot = isCleoRepo ?
|
|
40792
|
+
const isCleoRepo = existsSync9(join13(projectRoot, "packages", "cleo", "src"));
|
|
40793
|
+
const cleoSrcRoot = isCleoRepo ? join13(projectRoot, "packages", "cleo", "src") : join13(projectRoot, "src");
|
|
40723
40794
|
const safeRead = (filePath) => {
|
|
40724
40795
|
try {
|
|
40725
40796
|
return readFileSync11(filePath, "utf-8");
|
|
@@ -40733,7 +40804,7 @@ var detectDriftCommand = defineCommand({
|
|
|
40733
40804
|
checks: [],
|
|
40734
40805
|
recommendations: []
|
|
40735
40806
|
};
|
|
40736
|
-
const injPath =
|
|
40807
|
+
const injPath = join13(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
|
|
40737
40808
|
if (existsSync9(injPath)) {
|
|
40738
40809
|
const content = safeRead(injPath);
|
|
40739
40810
|
userResult.checks.push({
|
|
@@ -40785,9 +40856,9 @@ var detectDriftCommand = defineCommand({
|
|
|
40785
40856
|
}
|
|
40786
40857
|
};
|
|
40787
40858
|
try {
|
|
40788
|
-
const specPath =
|
|
40789
|
-
const registryPath =
|
|
40790
|
-
const dispatchDomainsDir =
|
|
40859
|
+
const specPath = join13(projectRoot, "docs", "specs", "CLEO-OPERATION-CONSTITUTION.md");
|
|
40860
|
+
const registryPath = join13(cleoSrcRoot, "dispatch", "registry.ts");
|
|
40861
|
+
const dispatchDomainsDir = join13(cleoSrcRoot, "dispatch", "domains");
|
|
40791
40862
|
if (!existsSync9(specPath)) {
|
|
40792
40863
|
addCheck("Gateway-to-spec sync", "fail", "CLEO-OPERATION-CONSTITUTION.md missing", [
|
|
40793
40864
|
{
|
|
@@ -40856,8 +40927,8 @@ var detectDriftCommand = defineCommand({
|
|
|
40856
40927
|
]);
|
|
40857
40928
|
}
|
|
40858
40929
|
try {
|
|
40859
|
-
const cliDir =
|
|
40860
|
-
const coreDir = isCleoRepo ?
|
|
40930
|
+
const cliDir = join13(cleoSrcRoot, "cli", "commands");
|
|
40931
|
+
const coreDir = isCleoRepo ? join13(projectRoot, "packages", "core", "src") : join13(projectRoot, "src", "core");
|
|
40861
40932
|
if (!existsSync9(cliDir)) {
|
|
40862
40933
|
addCheck("CLI-to-core sync", "fail", "CLI commands directory missing", [
|
|
40863
40934
|
{
|
|
@@ -40884,7 +40955,7 @@ var detectDriftCommand = defineCommand({
|
|
|
40884
40955
|
addCheck("CLI-to-core sync", "fail", `Error: ${getErrorMessage(e)}`);
|
|
40885
40956
|
}
|
|
40886
40957
|
try {
|
|
40887
|
-
const domainsDir =
|
|
40958
|
+
const domainsDir = join13(cleoSrcRoot, "dispatch", "domains");
|
|
40888
40959
|
if (!existsSync9(domainsDir)) {
|
|
40889
40960
|
addCheck("Domain handler coverage", "fail", "Dispatch domains directory missing", [
|
|
40890
40961
|
{
|
|
@@ -40902,7 +40973,7 @@ var detectDriftCommand = defineCommand({
|
|
|
40902
40973
|
addCheck("Domain handler coverage", "fail", `Error: ${getErrorMessage(e)}`);
|
|
40903
40974
|
}
|
|
40904
40975
|
try {
|
|
40905
|
-
const matrixPath =
|
|
40976
|
+
const matrixPath = join13(cleoSrcRoot, "dispatch", "lib", "capability-matrix.ts");
|
|
40906
40977
|
if (!existsSync9(matrixPath)) {
|
|
40907
40978
|
addCheck("Capability matrix", "fail", "Capability matrix missing", [
|
|
40908
40979
|
{
|
|
@@ -40919,7 +40990,7 @@ var detectDriftCommand = defineCommand({
|
|
|
40919
40990
|
addCheck("Capability matrix", "fail", `Error: ${getErrorMessage(e)}`);
|
|
40920
40991
|
}
|
|
40921
40992
|
try {
|
|
40922
|
-
const schemaPath =
|
|
40993
|
+
const schemaPath = join13(projectRoot, "src", "store", "schema.ts");
|
|
40923
40994
|
if (!existsSync9(schemaPath)) {
|
|
40924
40995
|
addCheck("Schema validation", "fail", "Schema definition missing", [
|
|
40925
40996
|
{
|
|
@@ -40954,8 +41025,8 @@ var detectDriftCommand = defineCommand({
|
|
|
40954
41025
|
addCheck("Schema validation", "fail", `Error: ${getErrorMessage(e)}`);
|
|
40955
41026
|
}
|
|
40956
41027
|
try {
|
|
40957
|
-
const visionPath =
|
|
40958
|
-
const specPath =
|
|
41028
|
+
const visionPath = join13(projectRoot, "docs", "concepts", "CLEO-VISION.md");
|
|
41029
|
+
const specPath = join13(projectRoot, "docs", "specs", "CLEO-PORTABLE-PROJECT-BRAIN-SPEC.md");
|
|
40959
41030
|
const issues = [];
|
|
40960
41031
|
if (!existsSync9(visionPath)) {
|
|
40961
41032
|
issues.push({
|
|
@@ -41010,7 +41081,7 @@ var detectDriftCommand = defineCommand({
|
|
|
41010
41081
|
addCheck("Canonical identity", "fail", `Error: ${getErrorMessage(e)}`);
|
|
41011
41082
|
}
|
|
41012
41083
|
try {
|
|
41013
|
-
const injectionPath =
|
|
41084
|
+
const injectionPath = join13(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
|
|
41014
41085
|
if (!existsSync9(injectionPath)) {
|
|
41015
41086
|
addCheck("Agent injection", "fail", "Agent injection template missing", [
|
|
41016
41087
|
{
|
|
@@ -41040,7 +41111,7 @@ var detectDriftCommand = defineCommand({
|
|
|
41040
41111
|
addCheck("Agent injection", "fail", `Error: ${getErrorMessage(e)}`);
|
|
41041
41112
|
}
|
|
41042
41113
|
try {
|
|
41043
|
-
const exitCodesPath =
|
|
41114
|
+
const exitCodesPath = join13(cleoSrcRoot, "dispatch", "lib", "exit-codes.ts");
|
|
41044
41115
|
if (!existsSync9(exitCodesPath)) {
|
|
41045
41116
|
addCheck("Exit codes", "fail", "Exit codes definition missing", [
|
|
41046
41117
|
{
|
|
@@ -41173,7 +41244,7 @@ var diagnosticsCommand = defineCommand({
|
|
|
41173
41244
|
// packages/cleo/src/cli/commands/docs.ts
|
|
41174
41245
|
init_src();
|
|
41175
41246
|
import { mkdir as mkdir3, readdir, readFile as readFile3, writeFile } from "node:fs/promises";
|
|
41176
|
-
import { dirname as
|
|
41247
|
+
import { dirname as dirname8, isAbsolute as isAbsolute2, join as join14, resolve as resolve4 } from "node:path";
|
|
41177
41248
|
import {
|
|
41178
41249
|
buildDocsGraph,
|
|
41179
41250
|
CleoError as CleoError3,
|
|
@@ -41191,7 +41262,7 @@ import {
|
|
|
41191
41262
|
init_cli();
|
|
41192
41263
|
init_renderers();
|
|
41193
41264
|
async function getScriptNames(projectRoot) {
|
|
41194
|
-
const scriptsDir =
|
|
41265
|
+
const scriptsDir = join14(projectRoot, "scripts");
|
|
41195
41266
|
try {
|
|
41196
41267
|
const files = await readdir(scriptsDir);
|
|
41197
41268
|
return files.filter((f) => f.endsWith(".sh")).map((f) => f.replace(".sh", "")).sort();
|
|
@@ -41200,7 +41271,7 @@ async function getScriptNames(projectRoot) {
|
|
|
41200
41271
|
}
|
|
41201
41272
|
}
|
|
41202
41273
|
async function getIndexedCommands(projectRoot) {
|
|
41203
|
-
const indexPath =
|
|
41274
|
+
const indexPath = join14(projectRoot, "docs", "commands", "COMMANDS-INDEX.json");
|
|
41204
41275
|
const index = await readJson(indexPath);
|
|
41205
41276
|
if (!index) return [];
|
|
41206
41277
|
return index.commands.map((c) => c.name).sort();
|
|
@@ -41233,7 +41304,7 @@ async function runGapCheck(_projectRoot, filterId) {
|
|
|
41233
41304
|
const reviewFiles = files.filter((f) => f.endsWith(".md"));
|
|
41234
41305
|
for (const file of reviewFiles) {
|
|
41235
41306
|
if (filterId && !file.includes(filterId)) continue;
|
|
41236
|
-
const filePath =
|
|
41307
|
+
const filePath = join14(reviewDir, file);
|
|
41237
41308
|
const content = await readFile3(filePath, "utf-8");
|
|
41238
41309
|
const taskMatch = file.match(/^(T\d+)/);
|
|
41239
41310
|
const taskId = taskMatch ? taskMatch[1] : "UNKNOWN";
|
|
@@ -41480,7 +41551,7 @@ var exportCommand4 = defineCommand({
|
|
|
41480
41551
|
let writtenPath;
|
|
41481
41552
|
if (typeof args.out === "string" && args.out.length > 0) {
|
|
41482
41553
|
const outPath = isAbsolute2(args.out) ? args.out : resolve4(projectRoot, args.out);
|
|
41483
|
-
await mkdir3(
|
|
41554
|
+
await mkdir3(dirname8(outPath), { recursive: true });
|
|
41484
41555
|
await writeFile(outPath, result.markdown, "utf8");
|
|
41485
41556
|
writtenPath = outPath;
|
|
41486
41557
|
}
|
|
@@ -41595,7 +41666,7 @@ var mergeCommand = defineCommand({
|
|
|
41595
41666
|
});
|
|
41596
41667
|
if (typeof args.out === "string" && args.out.length > 0) {
|
|
41597
41668
|
const outPath = isAbsolute2(args.out) ? args.out : resolve4(projectRoot, args.out);
|
|
41598
|
-
await mkdir3(
|
|
41669
|
+
await mkdir3(dirname8(outPath), { recursive: true });
|
|
41599
41670
|
await writeFile(outPath, result.merged, "utf8");
|
|
41600
41671
|
process.stderr.write(`Wrote merged content to ${outPath}
|
|
41601
41672
|
`);
|
|
@@ -41667,7 +41738,7 @@ var graphCommand = defineCommand({
|
|
|
41667
41738
|
}
|
|
41668
41739
|
if (typeof args.out === "string" && args.out.length > 0) {
|
|
41669
41740
|
const outPath = isAbsolute2(args.out) ? args.out : resolve4(projectRoot, args.out);
|
|
41670
|
-
await mkdir3(
|
|
41741
|
+
await mkdir3(dirname8(outPath), { recursive: true });
|
|
41671
41742
|
await writeFile(outPath, output, "utf8");
|
|
41672
41743
|
process.stderr.write(`Wrote graph to ${outPath}
|
|
41673
41744
|
`);
|
|
@@ -42591,7 +42662,7 @@ var findCommand2 = defineCommand({
|
|
|
42591
42662
|
|
|
42592
42663
|
// packages/cleo/src/cli/commands/gc.ts
|
|
42593
42664
|
import { homedir as homedir3 } from "node:os";
|
|
42594
|
-
import { join as
|
|
42665
|
+
import { join as join15 } from "node:path";
|
|
42595
42666
|
import { runGC } from "@cleocode/core/gc/runner.js";
|
|
42596
42667
|
import { readGCState } from "@cleocode/core/gc/state.js";
|
|
42597
42668
|
function formatBytes(bytes) {
|
|
@@ -42623,7 +42694,7 @@ var runCommand2 = defineCommand({
|
|
|
42623
42694
|
}
|
|
42624
42695
|
},
|
|
42625
42696
|
async run({ args }) {
|
|
42626
|
-
const cleoDir = args["cleo-dir"] ??
|
|
42697
|
+
const cleoDir = args["cleo-dir"] ?? join15(homedir3(), ".cleo");
|
|
42627
42698
|
const dryRun = args["dry-run"];
|
|
42628
42699
|
try {
|
|
42629
42700
|
const gcResult = await runGC({ cleoDir, dryRun });
|
|
@@ -42678,8 +42749,8 @@ var statusCommand6 = defineCommand({
|
|
|
42678
42749
|
}
|
|
42679
42750
|
},
|
|
42680
42751
|
async run({ args }) {
|
|
42681
|
-
const cleoDir = args["cleo-dir"] ??
|
|
42682
|
-
const statePath =
|
|
42752
|
+
const cleoDir = args["cleo-dir"] ?? join15(homedir3(), ".cleo");
|
|
42753
|
+
const statePath = join15(cleoDir, "gc-state.json");
|
|
42683
42754
|
try {
|
|
42684
42755
|
const state = await readGCState(statePath);
|
|
42685
42756
|
const result = { success: true, data: state };
|
|
@@ -42738,8 +42809,8 @@ var gcCommand = defineCommand({
|
|
|
42738
42809
|
// packages/cleo/src/cli/commands/generate-changelog.ts
|
|
42739
42810
|
init_src();
|
|
42740
42811
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
42741
|
-
import { existsSync as existsSync10, mkdirSync as
|
|
42742
|
-
import { dirname as
|
|
42812
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync3, readFileSync as readFileSync12, writeFileSync as writeFileSync3 } from "node:fs";
|
|
42813
|
+
import { dirname as dirname9, join as join16 } from "node:path";
|
|
42743
42814
|
import { CleoError as CleoError4, formatError as formatError6, getConfigPath as getConfigPath2, getProjectRoot as getProjectRoot21 } from "@cleocode/core";
|
|
42744
42815
|
init_renderers();
|
|
42745
42816
|
function getChangelogSource(cwd) {
|
|
@@ -42898,7 +42969,7 @@ var generateChangelogCommand = defineCommand({
|
|
|
42898
42969
|
const targetPlatform = args.platform;
|
|
42899
42970
|
const dryRun = args["dry-run"] === true;
|
|
42900
42971
|
const sourceFile = getChangelogSource();
|
|
42901
|
-
const sourcePath =
|
|
42972
|
+
const sourcePath = join16(getProjectRoot21(), sourceFile);
|
|
42902
42973
|
if (!existsSync10(sourcePath)) {
|
|
42903
42974
|
throw new CleoError4(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
|
|
42904
42975
|
}
|
|
@@ -42911,8 +42982,8 @@ var generateChangelogCommand = defineCommand({
|
|
|
42911
42982
|
const outputPath = platformConfig?.path ?? getDefaultOutputPath(targetPlatform);
|
|
42912
42983
|
const content = generateForPlatform(targetPlatform, sourceContent, repoSlug, limit);
|
|
42913
42984
|
if (!dryRun) {
|
|
42914
|
-
const fullPath =
|
|
42915
|
-
|
|
42985
|
+
const fullPath = join16(getProjectRoot21(), outputPath);
|
|
42986
|
+
mkdirSync3(dirname9(fullPath), { recursive: true });
|
|
42916
42987
|
writeFileSync3(fullPath, content, "utf-8");
|
|
42917
42988
|
}
|
|
42918
42989
|
results.push({ platform: targetPlatform, path: outputPath, written: !dryRun });
|
|
@@ -42932,8 +43003,8 @@ var generateChangelogCommand = defineCommand({
|
|
|
42932
43003
|
limit
|
|
42933
43004
|
);
|
|
42934
43005
|
if (!dryRun) {
|
|
42935
|
-
const fullPath =
|
|
42936
|
-
|
|
43006
|
+
const fullPath = join16(getProjectRoot21(), platformConfig.path);
|
|
43007
|
+
mkdirSync3(dirname9(fullPath), { recursive: true });
|
|
42937
43008
|
writeFileSync3(fullPath, content, "utf-8");
|
|
42938
43009
|
}
|
|
42939
43010
|
results.push({
|
|
@@ -44342,9 +44413,9 @@ var mapCommand = defineCommand({
|
|
|
44342
44413
|
|
|
44343
44414
|
// packages/cleo/src/cli/commands/memory.ts
|
|
44344
44415
|
import { createHash as createHash3 } from "node:crypto";
|
|
44345
|
-
import { existsSync as existsSync11, mkdirSync as
|
|
44416
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readdirSync as readdirSync3, readFileSync as readFileSync13, writeFileSync as writeFileSync4 } from "node:fs";
|
|
44346
44417
|
import { homedir as homedir4 } from "node:os";
|
|
44347
|
-
import { join as
|
|
44418
|
+
import { join as join17 } from "node:path";
|
|
44348
44419
|
import {
|
|
44349
44420
|
getBrainDb as getBrainDb2,
|
|
44350
44421
|
getBrainNativeDb as getBrainNativeDb3,
|
|
@@ -44397,7 +44468,7 @@ function loadImportHashes(stateFile) {
|
|
|
44397
44468
|
}
|
|
44398
44469
|
function saveImportHashes(stateFile, hashes) {
|
|
44399
44470
|
const dir = stateFile.slice(0, stateFile.lastIndexOf("/"));
|
|
44400
|
-
if (!existsSync11(dir))
|
|
44471
|
+
if (!existsSync11(dir)) mkdirSync4(dir, { recursive: true });
|
|
44401
44472
|
writeFileSync4(stateFile, JSON.stringify({ hashes: [...hashes] }, null, 2), "utf-8");
|
|
44402
44473
|
}
|
|
44403
44474
|
var storeCommand = defineCommand({
|
|
@@ -45642,11 +45713,11 @@ var importCommand3 = defineCommand({
|
|
|
45642
45713
|
}
|
|
45643
45714
|
},
|
|
45644
45715
|
async run({ args }) {
|
|
45645
|
-
const sourceDir = args.from ??
|
|
45716
|
+
const sourceDir = args.from ?? join17(homedir4(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
|
|
45646
45717
|
const isDryRun = !!args["dry-run"];
|
|
45647
45718
|
const isJson = !!args.json;
|
|
45648
45719
|
const projectRoot = getProjectRoot22();
|
|
45649
|
-
const stateFile =
|
|
45720
|
+
const stateFile = join17(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
|
|
45650
45721
|
if (!existsSync11(sourceDir)) {
|
|
45651
45722
|
const msg = `Source directory not found: ${sourceDir}`;
|
|
45652
45723
|
if (isJson) {
|
|
@@ -45656,7 +45727,7 @@ var importCommand3 = defineCommand({
|
|
|
45656
45727
|
}
|
|
45657
45728
|
process.exit(1);
|
|
45658
45729
|
}
|
|
45659
|
-
const files = readdirSync3(sourceDir).filter((f) => f.endsWith(".md") && f !== "MEMORY.md").map((f) =>
|
|
45730
|
+
const files = readdirSync3(sourceDir).filter((f) => f.endsWith(".md") && f !== "MEMORY.md").map((f) => join17(sourceDir, f));
|
|
45660
45731
|
const importedHashes = isDryRun ? /* @__PURE__ */ new Set() : loadImportHashes(stateFile);
|
|
45661
45732
|
const stats = { total: files.length, imported: 0, skipped: 0, errors: 0 };
|
|
45662
45733
|
const importedEntries = [];
|
|
@@ -54932,7 +55003,7 @@ var schemaCommand = defineCommand({
|
|
|
54932
55003
|
init_src();
|
|
54933
55004
|
import { execFile } from "node:child_process";
|
|
54934
55005
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
54935
|
-
import { join as
|
|
55006
|
+
import { join as join18 } from "node:path";
|
|
54936
55007
|
import * as readline2 from "node:readline";
|
|
54937
55008
|
import { promisify } from "node:util";
|
|
54938
55009
|
import {
|
|
@@ -54951,7 +55022,7 @@ var GITHUB_REPO = BUILD_CONFIG2.repository.fullName;
|
|
|
54951
55022
|
async function getCurrentVersion() {
|
|
54952
55023
|
const cleoHome = getCleoHome2();
|
|
54953
55024
|
try {
|
|
54954
|
-
const content = await readFile4(
|
|
55025
|
+
const content = await readFile4(join18(cleoHome, "VERSION"), "utf-8");
|
|
54955
55026
|
return (content.split("\n")[0] ?? "unknown").trim();
|
|
54956
55027
|
} catch {
|
|
54957
55028
|
return "unknown";
|
|
@@ -55005,7 +55076,7 @@ async function writeRuntimeVersionMetadata(mode, source, version) {
|
|
|
55005
55076
|
];
|
|
55006
55077
|
await import("node:fs/promises").then(
|
|
55007
55078
|
({ writeFile: writeFile3, mkdir: mkdir5 }) => mkdir5(cleoHome, { recursive: true }).then(
|
|
55008
|
-
() => writeFile3(
|
|
55079
|
+
() => writeFile3(join18(cleoHome, "VERSION"), `${lines.join("\n")}
|
|
55009
55080
|
`, "utf-8")
|
|
55010
55081
|
)
|
|
55011
55082
|
);
|
|
@@ -55406,7 +55477,7 @@ async function runPostUpdateDiagnostics(opts) {
|
|
|
55406
55477
|
}
|
|
55407
55478
|
|
|
55408
55479
|
// packages/cleo/src/cli/commands/sentient.ts
|
|
55409
|
-
import { join as
|
|
55480
|
+
import { join as join19 } from "node:path";
|
|
55410
55481
|
import { cwd as processCwd } from "node:process";
|
|
55411
55482
|
import {
|
|
55412
55483
|
getSentientDaemonStatus,
|
|
@@ -55477,7 +55548,7 @@ var startSub = defineCommand({
|
|
|
55477
55548
|
return;
|
|
55478
55549
|
}
|
|
55479
55550
|
if (dryRun) {
|
|
55480
|
-
const statePath2 =
|
|
55551
|
+
const statePath2 = join19(projectRoot, SENTIENT_STATE_FILE);
|
|
55481
55552
|
const outcome = await safeRunTick({ projectRoot, statePath: statePath2, dryRun: true });
|
|
55482
55553
|
emitSuccess(
|
|
55483
55554
|
{ dryRun: true, outcome },
|
|
@@ -55611,7 +55682,7 @@ var tickSub = defineCommand({
|
|
|
55611
55682
|
const jsonMode = args.json === true;
|
|
55612
55683
|
const dryRun = args["dry-run"] === true;
|
|
55613
55684
|
try {
|
|
55614
|
-
const statePath =
|
|
55685
|
+
const statePath = join19(projectRoot, SENTIENT_STATE_FILE);
|
|
55615
55686
|
const outcome = await safeRunTick({ projectRoot, statePath, dryRun });
|
|
55616
55687
|
emitSuccess(
|
|
55617
55688
|
{ outcome, dryRun },
|
|
@@ -55680,7 +55751,7 @@ var proposeAcceptSub = defineCommand({
|
|
|
55680
55751
|
return;
|
|
55681
55752
|
}
|
|
55682
55753
|
await db.update(tasks).set({ status: "pending", updatedAt: now }).where(eq2(tasks.id, id)).run();
|
|
55683
|
-
const statePath =
|
|
55754
|
+
const statePath = join19(projectRoot, SENTIENT_STATE_FILE);
|
|
55684
55755
|
const state = await readSentientState(statePath);
|
|
55685
55756
|
await patchSentientState(statePath, {
|
|
55686
55757
|
tier2Stats: {
|
|
@@ -55732,7 +55803,7 @@ var proposeRejectSub = defineCommand({
|
|
|
55732
55803
|
return;
|
|
55733
55804
|
}
|
|
55734
55805
|
await db.update(tasks).set({ status: "cancelled", cancellationReason: reason, cancelledAt: now, updatedAt: now }).where(eq2(tasks.id, id)).run();
|
|
55735
|
-
const statePath =
|
|
55806
|
+
const statePath = join19(projectRoot, SENTIENT_STATE_FILE);
|
|
55736
55807
|
const state = await readSentientState(statePath);
|
|
55737
55808
|
await patchSentientState(statePath, {
|
|
55738
55809
|
tier2Stats: {
|
|
@@ -55777,7 +55848,7 @@ var proposeRunSub = defineCommand({
|
|
|
55777
55848
|
const projectRoot = resolveProjectRoot7(args.project);
|
|
55778
55849
|
const jsonMode = args.json === true;
|
|
55779
55850
|
try {
|
|
55780
|
-
const statePath =
|
|
55851
|
+
const statePath = join19(projectRoot, SENTIENT_STATE_FILE);
|
|
55781
55852
|
const outcome = await safeRunProposeTick({ projectRoot, statePath });
|
|
55782
55853
|
emitSuccess(
|
|
55783
55854
|
{ outcome },
|
|
@@ -55797,7 +55868,7 @@ var proposeEnableSub = defineCommand({
|
|
|
55797
55868
|
const projectRoot = resolveProjectRoot7(args.project);
|
|
55798
55869
|
const jsonMode = args.json === true;
|
|
55799
55870
|
try {
|
|
55800
|
-
const statePath =
|
|
55871
|
+
const statePath = join19(projectRoot, SENTIENT_STATE_FILE);
|
|
55801
55872
|
const updated = await patchSentientState(statePath, { tier2Enabled: true });
|
|
55802
55873
|
emitSuccess({ tier2Enabled: updated.tier2Enabled }, jsonMode, "Tier-2 proposals enabled");
|
|
55803
55874
|
} catch (err) {
|
|
@@ -55816,7 +55887,7 @@ var proposeDisableSub = defineCommand({
|
|
|
55816
55887
|
const projectRoot = resolveProjectRoot7(args.project);
|
|
55817
55888
|
const jsonMode = args.json === true;
|
|
55818
55889
|
try {
|
|
55819
|
-
const statePath =
|
|
55890
|
+
const statePath = join19(projectRoot, SENTIENT_STATE_FILE);
|
|
55820
55891
|
const updated = await patchSentientState(statePath, { tier2Enabled: false });
|
|
55821
55892
|
emitSuccess({ tier2Enabled: updated.tier2Enabled }, jsonMode, "Tier-2 proposals disabled");
|
|
55822
55893
|
} catch (err) {
|
|
@@ -55847,7 +55918,7 @@ var proposeSub = defineCommand({
|
|
|
55847
55918
|
const projectRoot = resolveProjectRoot7(args.project);
|
|
55848
55919
|
const jsonMode = args.json === true;
|
|
55849
55920
|
try {
|
|
55850
|
-
const statePath =
|
|
55921
|
+
const statePath = join19(projectRoot, SENTIENT_STATE_FILE);
|
|
55851
55922
|
const state = await readSentientState(statePath);
|
|
55852
55923
|
emitSuccess(
|
|
55853
55924
|
{
|
|
@@ -57922,7 +57993,7 @@ var tokenCommand = defineCommand({
|
|
|
57922
57993
|
|
|
57923
57994
|
// packages/cleo/src/cli/commands/transcript.ts
|
|
57924
57995
|
import { homedir as homedir5 } from "node:os";
|
|
57925
|
-
import { join as
|
|
57996
|
+
import { join as join20 } from "node:path";
|
|
57926
57997
|
import { getProjectRoot as getProjectRoot27 } from "@cleocode/core";
|
|
57927
57998
|
import {
|
|
57928
57999
|
parseDurationMs,
|
|
@@ -57980,7 +58051,7 @@ var scanCommand = defineCommand({
|
|
|
57980
58051
|
}
|
|
57981
58052
|
return;
|
|
57982
58053
|
}
|
|
57983
|
-
const projectsDir = args["projects-dir"] ??
|
|
58054
|
+
const projectsDir = args["projects-dir"] ?? join20(homedir5(), ".claude", "projects");
|
|
57984
58055
|
try {
|
|
57985
58056
|
const result = await scanTranscripts(projectsDir);
|
|
57986
58057
|
const envelope = {
|
|
@@ -58365,7 +58436,7 @@ var pruneCommand = defineCommand({
|
|
|
58365
58436
|
process.exit(2);
|
|
58366
58437
|
return;
|
|
58367
58438
|
}
|
|
58368
|
-
const projectsDir = args["projects-dir"] ??
|
|
58439
|
+
const projectsDir = args["projects-dir"] ?? join20(homedir5(), ".claude", "projects");
|
|
58369
58440
|
try {
|
|
58370
58441
|
const pruneResult = await pruneTranscripts({
|
|
58371
58442
|
olderThanMs,
|
|
@@ -58791,7 +58862,7 @@ var verifyCommand2 = defineCommand({
|
|
|
58791
58862
|
init_src();
|
|
58792
58863
|
import { execFileSync as execFileSync5, spawn } from "node:child_process";
|
|
58793
58864
|
import { mkdir as mkdir4, open, readFile as readFile5, rm, stat, writeFile as writeFile2 } from "node:fs/promises";
|
|
58794
|
-
import { join as
|
|
58865
|
+
import { join as join21 } from "node:path";
|
|
58795
58866
|
import { CleoError as CleoError12, formatError as formatError14, getCleoHome as getCleoHome3 } from "@cleocode/core";
|
|
58796
58867
|
init_renderers();
|
|
58797
58868
|
var DEFAULT_PORT = 3456;
|
|
@@ -58799,10 +58870,10 @@ var DEFAULT_HOST = "127.0.0.1";
|
|
|
58799
58870
|
function getWebPaths() {
|
|
58800
58871
|
const cleoHome = getCleoHome3();
|
|
58801
58872
|
return {
|
|
58802
|
-
pidFile:
|
|
58803
|
-
configFile:
|
|
58804
|
-
logDir:
|
|
58805
|
-
logFile:
|
|
58873
|
+
pidFile: join21(cleoHome, "web-server.pid"),
|
|
58874
|
+
configFile: join21(cleoHome, "web-server.json"),
|
|
58875
|
+
logDir: join21(cleoHome, "logs"),
|
|
58876
|
+
logFile: join21(cleoHome, "logs", "web-server.log")
|
|
58806
58877
|
};
|
|
58807
58878
|
}
|
|
58808
58879
|
function isProcessRunning(pid) {
|
|
@@ -58841,7 +58912,7 @@ async function startWebServer(port, host) {
|
|
|
58841
58912
|
throw new CleoError12(1 /* GENERAL_ERROR */, `Server already running (PID: ${status.pid})`);
|
|
58842
58913
|
}
|
|
58843
58914
|
const projectRoot = process.env["CLEO_ROOT"] ?? process.cwd();
|
|
58844
|
-
const studioDir = process.env["CLEO_STUDIO_DIR"] ??
|
|
58915
|
+
const studioDir = process.env["CLEO_STUDIO_DIR"] ?? join21(projectRoot, "packages", "studio", "build");
|
|
58845
58916
|
await mkdir4(logDir, { recursive: true });
|
|
58846
58917
|
await writeFile2(
|
|
58847
58918
|
configFile,
|
|
@@ -58851,7 +58922,7 @@ async function startWebServer(port, host) {
|
|
|
58851
58922
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
58852
58923
|
})
|
|
58853
58924
|
);
|
|
58854
|
-
const webIndexPath =
|
|
58925
|
+
const webIndexPath = join21(studioDir, "index.js");
|
|
58855
58926
|
try {
|
|
58856
58927
|
await stat(webIndexPath);
|
|
58857
58928
|
} catch {
|
|
@@ -59130,7 +59201,7 @@ Or via NodeSource: https://github.com/nodesource/distributions
|
|
|
59130
59201
|
}
|
|
59131
59202
|
}
|
|
59132
59203
|
function getPackageVersion() {
|
|
59133
|
-
const pkgPath =
|
|
59204
|
+
const pkgPath = join22(dirname10(fileURLToPath3(import.meta.url)), "../../package.json");
|
|
59134
59205
|
const pkg = JSON.parse(readFileSync15(pkgPath, "utf-8"));
|
|
59135
59206
|
return pkg.version;
|
|
59136
59207
|
}
|