@cleocode/cleo 2026.4.67 → 2026.4.69
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 +641 -220
- package/dist/cli/index.js.map +4 -4
- package/migrations/drizzle-brain/20260321000001_t033-brain-indexes/migration.sql +12 -0
- package/migrations/drizzle-brain/20260321000001_t033-brain-indexes/snapshot.json +1232 -0
- package/migrations/drizzle-brain/20260408000001_t417-agent-field/migration.sql +13 -0
- package/migrations/drizzle-brain/20260408000001_t417-agent-field/snapshot.json +28 -0
- package/migrations/drizzle-brain/20260411000001_t528-graph-schema-expansion/migration.sql +47 -0
- package/migrations/drizzle-brain/20260412000001_t531-quality-score-typed-tables/migration.sql +23 -0
- package/migrations/drizzle-brain/20260413000001_t549-tiered-typed-memory/migration.sql +195 -0
- package/migrations/drizzle-brain/20260415000001_t626-normalize-co-retrieved-edge-type/migration.sql +14 -0
- package/migrations/drizzle-brain/20260416000001_t673-retrieval-log-plasticity-columns/migration.sql +57 -0
- package/migrations/drizzle-brain/20260416000002_t673-plasticity-events-expand/migration.sql +44 -0
- package/migrations/drizzle-brain/20260416000003_t673-page-edges-plasticity-columns/migration.sql +44 -0
- package/migrations/drizzle-brain/20260416000004_t673-new-plasticity-tables/migration.sql +73 -0
- package/migrations/drizzle-brain/20260416000005_t726-dedup-tier-columns/migration.sql +77 -0
- package/migrations/drizzle-nexus/20260412000001_t529-nexus-graph-tables/migration.sql +49 -0
- package/migrations/drizzle-nexus/20260415000001_t622-project-registry-paths/migration.sql +12 -0
- package/migrations/drizzle-tasks/20260320013731_wave0-schema-hardening/migration.sql +84 -0
- package/migrations/drizzle-tasks/20260320013731_wave0-schema-hardening/snapshot.json +4060 -0
- package/migrations/drizzle-tasks/20260320020000_agent-dimension/migration.sql +35 -0
- package/migrations/drizzle-tasks/20260320020000_agent-dimension/snapshot.json +4312 -0
- package/migrations/drizzle-tasks/20260321000000_t033-connection-health/migration.sql +518 -0
- package/migrations/drizzle-tasks/20260321000000_t033-connection-health/snapshot.json +4312 -0
- package/migrations/drizzle-tasks/20260321000002_t060-pipeline-stage-binding/migration.sql +82 -0
- package/migrations/drizzle-tasks/20260321000002_t060-pipeline-stage-binding/snapshot.json +9 -0
- package/migrations/drizzle-tasks/20260324000000_assignee-column/migration.sql +6 -0
- package/migrations/drizzle-tasks/20260324000000_assignee-column/snapshot.json +9 -0
- package/migrations/drizzle-tasks/20260327000000_agent-credentials/migration.sql +23 -0
- package/package.json +8 -8
package/dist/cli/index.js
CHANGED
|
@@ -1931,7 +1931,7 @@ var init_sql = __esm({
|
|
|
1931
1931
|
return new SQL([new StringChunk(str)]);
|
|
1932
1932
|
}
|
|
1933
1933
|
_sql.raw = raw;
|
|
1934
|
-
function
|
|
1934
|
+
function join146(chunks, separator) {
|
|
1935
1935
|
const result = [];
|
|
1936
1936
|
for (const [i, chunk] of chunks.entries()) {
|
|
1937
1937
|
if (i > 0 && separator !== void 0) result.push(separator);
|
|
@@ -1939,7 +1939,7 @@ var init_sql = __esm({
|
|
|
1939
1939
|
}
|
|
1940
1940
|
return new SQL(result);
|
|
1941
1941
|
}
|
|
1942
|
-
_sql.join =
|
|
1942
|
+
_sql.join = join146;
|
|
1943
1943
|
function identifier(value) {
|
|
1944
1944
|
return new Name(value);
|
|
1945
1945
|
}
|
|
@@ -6713,7 +6713,7 @@ var init_select2 = __esm({
|
|
|
6713
6713
|
const baseTableName = this.tableName;
|
|
6714
6714
|
const tableName = getTableLikeName(table);
|
|
6715
6715
|
for (const item of extractUsedTable(table)) this.usedTables.add(item);
|
|
6716
|
-
if (typeof tableName === "string" && this.config.joins?.some((
|
|
6716
|
+
if (typeof tableName === "string" && this.config.joins?.some((join146) => join146.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
6717
6717
|
if (!this.isPartialSelect) {
|
|
6718
6718
|
if (Object.keys(this.joinsNotNullableMap).length === 1 && typeof baseTableName === "string") this.config.fields = { [baseTableName]: this.config.fields };
|
|
6719
6719
|
if (typeof tableName === "string" && !is(table, SQL)) {
|
|
@@ -7998,7 +7998,7 @@ var init_dialect = __esm({
|
|
|
7998
7998
|
if (!joins2) return;
|
|
7999
7999
|
const withEntries = Object.entries(joins2).filter(([_2, v2]) => v2);
|
|
8000
8000
|
if (!withEntries.length) return;
|
|
8001
|
-
return sql.join(withEntries.map(([k2,
|
|
8001
|
+
return sql.join(withEntries.map(([k2, join146]) => {
|
|
8002
8002
|
const relation = tableConfig.relations[k2];
|
|
8003
8003
|
const isSingle2 = is(relation, One3);
|
|
8004
8004
|
const targetTable = aliasedTable(relation.targetTable, `d${currentDepth + 1}`);
|
|
@@ -8009,7 +8009,7 @@ var init_dialect = __esm({
|
|
|
8009
8009
|
table: targetTable,
|
|
8010
8010
|
mode: isSingle2 ? "first" : "many",
|
|
8011
8011
|
schema,
|
|
8012
|
-
queryConfig:
|
|
8012
|
+
queryConfig: join146,
|
|
8013
8013
|
tableConfig: schema[relation.targetTableName],
|
|
8014
8014
|
relationWhere: filter,
|
|
8015
8015
|
isNested: true,
|
|
@@ -8023,7 +8023,7 @@ var init_dialect = __esm({
|
|
|
8023
8023
|
key: k2,
|
|
8024
8024
|
selection: innerQuery.selection,
|
|
8025
8025
|
isArray: !isSingle2,
|
|
8026
|
-
isOptional: (relation.optional ?? false) ||
|
|
8026
|
+
isOptional: (relation.optional ?? false) || join146 !== true && !!join146.where
|
|
8027
8027
|
});
|
|
8028
8028
|
const jsonColumns = sql.join(innerQuery.selection.map((s3) => {
|
|
8029
8029
|
return sql`${sql.raw(this.escapeString(s3.key))}, ${s3.selection ? sql`${jsonb2}(${sql.identifier(s3.key)})` : sql.identifier(s3.key)}`;
|
|
@@ -8422,7 +8422,7 @@ var init_update = __esm({
|
|
|
8422
8422
|
createJoin(joinType) {
|
|
8423
8423
|
return ((table, on) => {
|
|
8424
8424
|
const tableName = getTableLikeName(table);
|
|
8425
|
-
if (typeof tableName === "string" && this.config.joins.some((
|
|
8425
|
+
if (typeof tableName === "string" && this.config.joins.some((join146) => join146.alias === tableName)) throw new Error(`Alias "${tableName}" is already used in this query`);
|
|
8426
8426
|
if (typeof on === "function") {
|
|
8427
8427
|
const from = this.config.from ? is(table, SQLiteTable) ? table[Table.Symbol.Columns] : is(table, Subquery) ? table._.selectedFields : is(table, SQLiteViewBase) ? table[ViewBaseConfig].selectedFields : void 0 : void 0;
|
|
8428
8428
|
on = on(new Proxy(this.config.table[Table.Symbol.Columns], new SelectionProxyHandler({
|
|
@@ -15396,6 +15396,7 @@ function runBrainMigrations(nativeDb, db) {
|
|
|
15396
15396
|
reconcileJournal(nativeDb, migrationsFolder, "brain_decisions", "brain");
|
|
15397
15397
|
migrateWithRetry(db, migrationsFolder, nativeDb, "brain_decisions", "brain");
|
|
15398
15398
|
if (tableExists(nativeDb, "brain_page_edges")) {
|
|
15399
|
+
ensureColumns(nativeDb, "brain_page_edges", [{ name: "provenance", ddl: "text" }], "brain");
|
|
15399
15400
|
nativeDb.prepare(
|
|
15400
15401
|
`UPDATE brain_page_edges
|
|
15401
15402
|
SET edge_type = 'co_retrieved'
|
|
@@ -66796,10 +66797,10 @@ async function readProjectMeta(projectPath) {
|
|
|
66796
66797
|
}
|
|
66797
66798
|
async function readProjectId(projectPath) {
|
|
66798
66799
|
try {
|
|
66799
|
-
const { readFileSync:
|
|
66800
|
+
const { readFileSync: readFileSync110, existsSync: existsSync137 } = await import("node:fs");
|
|
66800
66801
|
const infoPath = join65(projectPath, ".cleo", "project-info.json");
|
|
66801
|
-
if (!
|
|
66802
|
-
const data = JSON.parse(
|
|
66802
|
+
if (!existsSync137(infoPath)) return "";
|
|
66803
|
+
const data = JSON.parse(readFileSync110(infoPath, "utf-8"));
|
|
66803
66804
|
return typeof data.projectId === "string" ? data.projectId : "";
|
|
66804
66805
|
} catch {
|
|
66805
66806
|
return "";
|
|
@@ -78436,8 +78437,8 @@ async function initializeSpawnAdapters(manifests) {
|
|
|
78436
78437
|
if (!manifest.capabilities?.supportsSpawn) continue;
|
|
78437
78438
|
if (spawnRegistry.hasAdapterForProvider(manifest.provider)) continue;
|
|
78438
78439
|
try {
|
|
78439
|
-
const { join:
|
|
78440
|
-
const modulePath =
|
|
78440
|
+
const { join: join146 } = await import("node:path");
|
|
78441
|
+
const modulePath = join146(manifest.packagePath, manifest.entryPoint);
|
|
78441
78442
|
const adapterModule = await import(modulePath);
|
|
78442
78443
|
let SpawnProviderClass;
|
|
78443
78444
|
for (const [exportName, exportValue] of Object.entries(adapterModule)) {
|
|
@@ -90272,6 +90273,7 @@ var init_cleo = __esm({
|
|
|
90272
90273
|
// packages/core/src/index.ts
|
|
90273
90274
|
var init_src3 = __esm({
|
|
90274
90275
|
"packages/core/src/index.ts"() {
|
|
90276
|
+
"use strict";
|
|
90275
90277
|
init_src();
|
|
90276
90278
|
init_adapters();
|
|
90277
90279
|
init_admin();
|
|
@@ -118807,6 +118809,17 @@ var init_registry5 = __esm({
|
|
|
118807
118809
|
sessionRequired: false,
|
|
118808
118810
|
requiredParams: ["chain"]
|
|
118809
118811
|
},
|
|
118812
|
+
// T646: Canon drift detection — CI gate
|
|
118813
|
+
{
|
|
118814
|
+
gateway: "query",
|
|
118815
|
+
domain: "check",
|
|
118816
|
+
operation: "canon",
|
|
118817
|
+
description: "check.canon (query) \u2014 CI gate: detects canon drift between docs and live code (CANONICAL_DOMAINS count, forbidden phrases, required assertions)",
|
|
118818
|
+
tier: 1,
|
|
118819
|
+
idempotent: true,
|
|
118820
|
+
sessionRequired: false,
|
|
118821
|
+
requiredParams: []
|
|
118822
|
+
},
|
|
118810
118823
|
// T065: Agent workflow compliance telemetry
|
|
118811
118824
|
{
|
|
118812
118825
|
gateway: "query",
|
|
@@ -120539,6 +120552,24 @@ var init_registry5 = __esm({
|
|
|
120539
120552
|
sessionRequired: false,
|
|
120540
120553
|
requiredParams: []
|
|
120541
120554
|
},
|
|
120555
|
+
{
|
|
120556
|
+
gateway: "query",
|
|
120557
|
+
domain: "admin",
|
|
120558
|
+
operation: "smoke.provider",
|
|
120559
|
+
description: "admin.smoke.provider (query) \u2014 ADR-049 harness sovereignty probe: verify adapter shape, DB locality, hooks, spawn, and agent folder for a named provider",
|
|
120560
|
+
tier: 1,
|
|
120561
|
+
idempotent: true,
|
|
120562
|
+
sessionRequired: false,
|
|
120563
|
+
requiredParams: ["provider"],
|
|
120564
|
+
params: [
|
|
120565
|
+
{
|
|
120566
|
+
name: "provider",
|
|
120567
|
+
type: "string",
|
|
120568
|
+
required: true,
|
|
120569
|
+
description: "Provider ID to probe (claude-code | claude-sdk | codex | cursor | gemini-cli | kimi | openai-sdk | opencode | pi)"
|
|
120570
|
+
}
|
|
120571
|
+
]
|
|
120572
|
+
},
|
|
120542
120573
|
{
|
|
120543
120574
|
gateway: "query",
|
|
120544
120575
|
domain: "admin",
|
|
@@ -124045,10 +124076,10 @@ async function systemLog(projectRoot, filters) {
|
|
|
124045
124076
|
}
|
|
124046
124077
|
async function queryAuditLogSqlite(projectRoot, filters) {
|
|
124047
124078
|
try {
|
|
124048
|
-
const { join:
|
|
124049
|
-
const { existsSync:
|
|
124050
|
-
const dbPath =
|
|
124051
|
-
if (!
|
|
124079
|
+
const { join: join146 } = await import("node:path");
|
|
124080
|
+
const { existsSync: existsSync137 } = await import("node:fs");
|
|
124081
|
+
const dbPath = join146(projectRoot, ".cleo", "tasks.db");
|
|
124082
|
+
if (!existsSync137(dbPath)) {
|
|
124052
124083
|
const offset = filters?.offset ?? 0;
|
|
124053
124084
|
const limit = filters?.limit ?? 20;
|
|
124054
124085
|
return {
|
|
@@ -126160,6 +126191,210 @@ var init_job_manager_accessor = __esm({
|
|
|
126160
126191
|
}
|
|
126161
126192
|
});
|
|
126162
126193
|
|
|
126194
|
+
// packages/cleo/src/dispatch/domains/admin/smoke-provider.ts
|
|
126195
|
+
var smoke_provider_exports = {};
|
|
126196
|
+
__export(smoke_provider_exports, {
|
|
126197
|
+
smokeProvider: () => smokeProvider
|
|
126198
|
+
});
|
|
126199
|
+
import { existsSync as existsSync129, readFileSync as readFileSync99 } from "node:fs";
|
|
126200
|
+
import { join as join126 } from "node:path";
|
|
126201
|
+
function isLocal(dbPath, projectCleoDir, cleoHome) {
|
|
126202
|
+
return dbPath.startsWith(projectCleoDir) || dbPath.startsWith(cleoHome);
|
|
126203
|
+
}
|
|
126204
|
+
function classifySpawn(spawnSrcPath) {
|
|
126205
|
+
if (!existsSync129(spawnSrcPath)) return "no";
|
|
126206
|
+
let src;
|
|
126207
|
+
try {
|
|
126208
|
+
src = readFileSync99(spawnSrcPath, "utf-8");
|
|
126209
|
+
} catch {
|
|
126210
|
+
return "no";
|
|
126211
|
+
}
|
|
126212
|
+
const hasImpl = /\bspawn\b|\bexec\b|\bfork\b|\bchild_process\b|\bspawnSync\b/.test(src);
|
|
126213
|
+
if (!hasImpl && /\bthrow\b/.test(src)) return "stub";
|
|
126214
|
+
return "yes";
|
|
126215
|
+
}
|
|
126216
|
+
function countHookEvents(hooksSrcPath, canonicalEvents) {
|
|
126217
|
+
if (!existsSync129(hooksSrcPath)) return 0;
|
|
126218
|
+
let src;
|
|
126219
|
+
try {
|
|
126220
|
+
src = readFileSync99(hooksSrcPath, "utf-8");
|
|
126221
|
+
} catch {
|
|
126222
|
+
return 0;
|
|
126223
|
+
}
|
|
126224
|
+
let count5 = 0;
|
|
126225
|
+
for (const event of canonicalEvents) {
|
|
126226
|
+
if (src.includes(event)) count5++;
|
|
126227
|
+
}
|
|
126228
|
+
return count5;
|
|
126229
|
+
}
|
|
126230
|
+
function buildReport(partial2) {
|
|
126231
|
+
const sep3 = "\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550";
|
|
126232
|
+
const lines = [
|
|
126233
|
+
`CLEO Smoke Probe \u2014 provider: ${partial2.providerId}`,
|
|
126234
|
+
sep3,
|
|
126235
|
+
` Adapter loaded: ${partial2.adapterLoaded ? "yes" : "no"}`
|
|
126236
|
+
];
|
|
126237
|
+
for (const db of partial2.dbChecks) {
|
|
126238
|
+
const label = ` ${db.name} local:`.padEnd(24);
|
|
126239
|
+
lines.push(`${label}${db.local ? "yes" : "NO"} (${db.path})`);
|
|
126240
|
+
}
|
|
126241
|
+
lines.push(` Hooks declared: ${partial2.hooksDeclared}`);
|
|
126242
|
+
lines.push(` Spawn implementation: ${partial2.spawnStatus}`);
|
|
126243
|
+
lines.push(` Agent folder: ${partial2.agentFolder ?? "(none \u2014 unknown provider)"}`);
|
|
126244
|
+
lines.push("");
|
|
126245
|
+
lines.push(
|
|
126246
|
+
partial2.passed ? "Result: PASS" : `Result: FAIL (${partial2.failureReason ?? "invariant violated"})`
|
|
126247
|
+
);
|
|
126248
|
+
return lines.join("\n");
|
|
126249
|
+
}
|
|
126250
|
+
async function smokeProvider(providerId) {
|
|
126251
|
+
if (!VALID_PROVIDER_IDS.includes(providerId)) {
|
|
126252
|
+
return engineError(
|
|
126253
|
+
"E_INVALID_INPUT",
|
|
126254
|
+
`Unknown provider ID: "${providerId}". Valid IDs: ${VALID_PROVIDER_IDS.join(", ")}`
|
|
126255
|
+
);
|
|
126256
|
+
}
|
|
126257
|
+
const coreInternal = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
126258
|
+
const projectRoot = (() => {
|
|
126259
|
+
try {
|
|
126260
|
+
return coreInternal.getProjectRoot();
|
|
126261
|
+
} catch {
|
|
126262
|
+
return process.env["CLEO_ROOT"] ?? process.cwd();
|
|
126263
|
+
}
|
|
126264
|
+
})();
|
|
126265
|
+
const monorepoRoot = projectRoot;
|
|
126266
|
+
const adapterDistPath = join126(
|
|
126267
|
+
monorepoRoot,
|
|
126268
|
+
"packages",
|
|
126269
|
+
"adapters",
|
|
126270
|
+
"dist",
|
|
126271
|
+
"providers",
|
|
126272
|
+
providerId,
|
|
126273
|
+
"index.js"
|
|
126274
|
+
);
|
|
126275
|
+
let adapterLoaded = false;
|
|
126276
|
+
if (existsSync129(adapterDistPath)) {
|
|
126277
|
+
try {
|
|
126278
|
+
const mod = await import(adapterDistPath);
|
|
126279
|
+
const defaultExport = mod["default"];
|
|
126280
|
+
if (typeof defaultExport === "function") {
|
|
126281
|
+
const ctor = defaultExport;
|
|
126282
|
+
try {
|
|
126283
|
+
const instance = new ctor();
|
|
126284
|
+
adapterLoaded = typeof instance.id === "string" && typeof instance.name === "string" && typeof instance.version === "string";
|
|
126285
|
+
} catch {
|
|
126286
|
+
adapterLoaded = existsSync129(adapterDistPath);
|
|
126287
|
+
}
|
|
126288
|
+
} else {
|
|
126289
|
+
adapterLoaded = typeof mod["id"] === "string" && typeof mod["name"] === "string";
|
|
126290
|
+
}
|
|
126291
|
+
} catch {
|
|
126292
|
+
adapterLoaded = false;
|
|
126293
|
+
}
|
|
126294
|
+
}
|
|
126295
|
+
const cleoHome = coreInternal.getCleoHome();
|
|
126296
|
+
const projectCleoDir = join126(projectRoot, ".cleo");
|
|
126297
|
+
const taskDbPath = coreInternal.getTaskPath(projectRoot);
|
|
126298
|
+
const brainPath = join126(projectCleoDir, "brain.db");
|
|
126299
|
+
const conduitDbPath = coreInternal.getConduitDbPath(projectRoot);
|
|
126300
|
+
const nexusDbPath = coreInternal.getNexusDbPath();
|
|
126301
|
+
const dbChecks = [
|
|
126302
|
+
{ name: "brain.db", local: isLocal(brainPath, projectCleoDir, cleoHome), path: brainPath },
|
|
126303
|
+
{ name: "nexus.db", local: isLocal(nexusDbPath, projectCleoDir, cleoHome), path: nexusDbPath },
|
|
126304
|
+
{
|
|
126305
|
+
name: "conduit.db",
|
|
126306
|
+
local: isLocal(conduitDbPath, projectCleoDir, cleoHome),
|
|
126307
|
+
path: conduitDbPath
|
|
126308
|
+
},
|
|
126309
|
+
{ name: "tasks.db", local: isLocal(taskDbPath, projectCleoDir, cleoHome), path: taskDbPath }
|
|
126310
|
+
];
|
|
126311
|
+
let canonicalEvents = [];
|
|
126312
|
+
try {
|
|
126313
|
+
const caamp = await import("@cleocode/caamp");
|
|
126314
|
+
canonicalEvents = caamp.CANONICAL_HOOK_EVENTS;
|
|
126315
|
+
} catch {
|
|
126316
|
+
canonicalEvents = [];
|
|
126317
|
+
}
|
|
126318
|
+
const hooksSrcPath = join126(
|
|
126319
|
+
monorepoRoot,
|
|
126320
|
+
"packages",
|
|
126321
|
+
"adapters",
|
|
126322
|
+
"src",
|
|
126323
|
+
"providers",
|
|
126324
|
+
providerId,
|
|
126325
|
+
"hooks.ts"
|
|
126326
|
+
);
|
|
126327
|
+
const hooksDeclared = countHookEvents(hooksSrcPath, canonicalEvents);
|
|
126328
|
+
const spawnSrcPath = join126(
|
|
126329
|
+
monorepoRoot,
|
|
126330
|
+
"packages",
|
|
126331
|
+
"adapters",
|
|
126332
|
+
"src",
|
|
126333
|
+
"providers",
|
|
126334
|
+
providerId,
|
|
126335
|
+
"spawn.ts"
|
|
126336
|
+
);
|
|
126337
|
+
const spawnStatus = classifySpawn(spawnSrcPath);
|
|
126338
|
+
let agentFolder = null;
|
|
126339
|
+
try {
|
|
126340
|
+
const { getProviderAgentFolder } = await import("@cleocode/caamp");
|
|
126341
|
+
agentFolder = getProviderAgentFolder(providerId);
|
|
126342
|
+
} catch {
|
|
126343
|
+
agentFolder = null;
|
|
126344
|
+
}
|
|
126345
|
+
const dbsLocal = dbChecks.every((c) => c.local);
|
|
126346
|
+
const failReasons = [];
|
|
126347
|
+
if (!adapterLoaded) failReasons.push("adapter did not load or missing id/name/version");
|
|
126348
|
+
if (!dbsLocal) {
|
|
126349
|
+
const nonLocal = dbChecks.filter((c) => !c.local).map((c) => c.name).join(", ");
|
|
126350
|
+
failReasons.push(`non-local DB paths: ${nonLocal}`);
|
|
126351
|
+
}
|
|
126352
|
+
if (agentFolder === null) failReasons.push("agent folder unresolvable (unknown provider)");
|
|
126353
|
+
const passed = failReasons.length === 0;
|
|
126354
|
+
const partial2 = {
|
|
126355
|
+
providerId,
|
|
126356
|
+
adapterLoaded,
|
|
126357
|
+
dbChecks,
|
|
126358
|
+
hooksDeclared,
|
|
126359
|
+
spawnStatus,
|
|
126360
|
+
agentFolder,
|
|
126361
|
+
passed,
|
|
126362
|
+
...passed ? {} : { failureReason: failReasons.join("; ") }
|
|
126363
|
+
};
|
|
126364
|
+
const report = buildReport(partial2);
|
|
126365
|
+
const result = { ...partial2, report };
|
|
126366
|
+
if (!passed) {
|
|
126367
|
+
return {
|
|
126368
|
+
success: false,
|
|
126369
|
+
data: result,
|
|
126370
|
+
error: {
|
|
126371
|
+
code: "E_SMOKE_PROVIDER_FAIL",
|
|
126372
|
+
message: `ADR-049 probe FAILED for provider "${providerId}": ${partial2.failureReason}`,
|
|
126373
|
+
exitCode: 1
|
|
126374
|
+
}
|
|
126375
|
+
};
|
|
126376
|
+
}
|
|
126377
|
+
return engineSuccess(result);
|
|
126378
|
+
}
|
|
126379
|
+
var VALID_PROVIDER_IDS;
|
|
126380
|
+
var init_smoke_provider = __esm({
|
|
126381
|
+
"packages/cleo/src/dispatch/domains/admin/smoke-provider.ts"() {
|
|
126382
|
+
"use strict";
|
|
126383
|
+
init_error3();
|
|
126384
|
+
VALID_PROVIDER_IDS = [
|
|
126385
|
+
"claude-code",
|
|
126386
|
+
"claude-sdk",
|
|
126387
|
+
"codex",
|
|
126388
|
+
"cursor",
|
|
126389
|
+
"gemini-cli",
|
|
126390
|
+
"kimi",
|
|
126391
|
+
"openai-sdk",
|
|
126392
|
+
"opencode",
|
|
126393
|
+
"pi"
|
|
126394
|
+
];
|
|
126395
|
+
}
|
|
126396
|
+
});
|
|
126397
|
+
|
|
126163
126398
|
// packages/cleo/src/dispatch/domains/admin.ts
|
|
126164
126399
|
var AdminHandler;
|
|
126165
126400
|
var init_admin2 = __esm({
|
|
@@ -126655,6 +126890,22 @@ var init_admin2 = __esm({
|
|
|
126655
126890
|
const result = await systemSmoke();
|
|
126656
126891
|
return wrapResult(result, "query", "admin", operation, startTime);
|
|
126657
126892
|
}
|
|
126893
|
+
case "smoke.provider": {
|
|
126894
|
+
const providerIdParam = params?.provider;
|
|
126895
|
+
if (!providerIdParam || typeof providerIdParam !== "string") {
|
|
126896
|
+
return errorResult(
|
|
126897
|
+
"query",
|
|
126898
|
+
"admin",
|
|
126899
|
+
operation,
|
|
126900
|
+
"E_INVALID_INPUT",
|
|
126901
|
+
"provider is required (e.g. claude-code, pi, opencode)",
|
|
126902
|
+
startTime
|
|
126903
|
+
);
|
|
126904
|
+
}
|
|
126905
|
+
const { smokeProvider: smokeProvider2 } = await Promise.resolve().then(() => (init_smoke_provider(), smoke_provider_exports));
|
|
126906
|
+
const result = await smokeProvider2(providerIdParam);
|
|
126907
|
+
return wrapResult(result, "query", "admin", operation, startTime);
|
|
126908
|
+
}
|
|
126658
126909
|
case "hooks.matrix": {
|
|
126659
126910
|
const result = await systemHooksMatrix({
|
|
126660
126911
|
providerIds: params?.providerIds,
|
|
@@ -127161,6 +127412,7 @@ var init_admin2 = __esm({
|
|
|
127161
127412
|
"map",
|
|
127162
127413
|
"roadmap",
|
|
127163
127414
|
"smoke",
|
|
127415
|
+
"smoke.provider",
|
|
127164
127416
|
"hooks.matrix"
|
|
127165
127417
|
],
|
|
127166
127418
|
mutate: [
|
|
@@ -127189,6 +127441,139 @@ var init_admin2 = __esm({
|
|
|
127189
127441
|
}
|
|
127190
127442
|
});
|
|
127191
127443
|
|
|
127444
|
+
// packages/cleo/src/dispatch/domains/check/canon.ts
|
|
127445
|
+
var canon_exports = {};
|
|
127446
|
+
__export(canon_exports, {
|
|
127447
|
+
runCanonCheck: () => runCanonCheck
|
|
127448
|
+
});
|
|
127449
|
+
import { readFileSync as readFileSync100 } from "node:fs";
|
|
127450
|
+
import { join as join127 } from "node:path";
|
|
127451
|
+
function readLines(filePath) {
|
|
127452
|
+
try {
|
|
127453
|
+
return readFileSync100(filePath, "utf8").split("\n");
|
|
127454
|
+
} catch {
|
|
127455
|
+
return [];
|
|
127456
|
+
}
|
|
127457
|
+
}
|
|
127458
|
+
function scanForbiddenPhrases(filePath, lines) {
|
|
127459
|
+
const results = [];
|
|
127460
|
+
for (let i = 0; i < lines.length; i++) {
|
|
127461
|
+
const line2 = lines[i];
|
|
127462
|
+
for (const phrase of FORBIDDEN_PHRASES) {
|
|
127463
|
+
if (line2.includes(phrase)) {
|
|
127464
|
+
results.push({ file: filePath, line: i + 1, phrase });
|
|
127465
|
+
}
|
|
127466
|
+
}
|
|
127467
|
+
}
|
|
127468
|
+
return results;
|
|
127469
|
+
}
|
|
127470
|
+
function countCanonicalDomains(typesFilePath) {
|
|
127471
|
+
const lines = readLines(typesFilePath);
|
|
127472
|
+
let inArray8 = false;
|
|
127473
|
+
let count5 = 0;
|
|
127474
|
+
for (const line2 of lines) {
|
|
127475
|
+
if (!inArray8) {
|
|
127476
|
+
if (line2.includes("CANONICAL_DOMAINS") && line2.includes("[")) {
|
|
127477
|
+
inArray8 = true;
|
|
127478
|
+
}
|
|
127479
|
+
continue;
|
|
127480
|
+
}
|
|
127481
|
+
if (line2.includes("] as const")) {
|
|
127482
|
+
break;
|
|
127483
|
+
}
|
|
127484
|
+
const trimmed = line2.trim();
|
|
127485
|
+
if (trimmed.startsWith("'") && trimmed.includes("'")) {
|
|
127486
|
+
count5++;
|
|
127487
|
+
}
|
|
127488
|
+
}
|
|
127489
|
+
return count5;
|
|
127490
|
+
}
|
|
127491
|
+
function countOperations(registryFilePath) {
|
|
127492
|
+
const lines = readLines(registryFilePath);
|
|
127493
|
+
let count5 = 0;
|
|
127494
|
+
for (const line2 of lines) {
|
|
127495
|
+
if (/^\s*gateway:/.test(line2)) {
|
|
127496
|
+
count5++;
|
|
127497
|
+
}
|
|
127498
|
+
}
|
|
127499
|
+
return count5;
|
|
127500
|
+
}
|
|
127501
|
+
function runCanonCheck(params) {
|
|
127502
|
+
const { projectRoot } = params;
|
|
127503
|
+
const typesFile = join127(projectRoot, "packages/cleo/src/dispatch/types.ts");
|
|
127504
|
+
const registryFile = join127(projectRoot, "packages/cleo/src/dispatch/registry.ts");
|
|
127505
|
+
const archGuide = join127(projectRoot, "docs/concepts/CLEO-ARCHITECTURE-GUIDE.md");
|
|
127506
|
+
const visionDoc = join127(projectRoot, "docs/concepts/CLEO-VISION.md");
|
|
127507
|
+
const constitution = join127(projectRoot, "docs/specs/CLEO-OPERATION-CONSTITUTION.md");
|
|
127508
|
+
const domainsInCode = countCanonicalDomains(typesFile);
|
|
127509
|
+
const operationsInCode = countOperations(registryFile);
|
|
127510
|
+
const excludedSet = new Set(EXCLUDED_FILENAMES);
|
|
127511
|
+
const auditedDocs = [archGuide, visionDoc, constitution].filter((f2) => {
|
|
127512
|
+
const basename19 = f2.split("/").pop() ?? "";
|
|
127513
|
+
return !excludedSet.has(basename19);
|
|
127514
|
+
});
|
|
127515
|
+
const allViolations = [];
|
|
127516
|
+
for (const docPath of auditedDocs) {
|
|
127517
|
+
const lines = readLines(docPath);
|
|
127518
|
+
allViolations.push(...scanForbiddenPhrases(docPath, lines));
|
|
127519
|
+
}
|
|
127520
|
+
const assertions = [];
|
|
127521
|
+
const archLines = readLines(archGuide);
|
|
127522
|
+
const archText = archLines.join("\n");
|
|
127523
|
+
assertions.push({
|
|
127524
|
+
file: archGuide,
|
|
127525
|
+
assertion: 'Contains "Six Great Systems"',
|
|
127526
|
+
passed: archText.includes("Six Great Systems")
|
|
127527
|
+
});
|
|
127528
|
+
assertions.push({
|
|
127529
|
+
file: archGuide,
|
|
127530
|
+
assertion: 'Contains "Circle of Eleven"',
|
|
127531
|
+
passed: archText.includes("Circle of Eleven")
|
|
127532
|
+
});
|
|
127533
|
+
const visionLines = readLines(visionDoc);
|
|
127534
|
+
const visionText = visionLines.join("\n");
|
|
127535
|
+
assertions.push({
|
|
127536
|
+
file: visionDoc,
|
|
127537
|
+
assertion: "Contains reference to six systems",
|
|
127538
|
+
passed: visionText.includes("six systems") || visionText.includes("Six systems") || visionText.includes("6 systems") || visionText.includes("six canonical systems")
|
|
127539
|
+
});
|
|
127540
|
+
const constLines = readLines(constitution);
|
|
127541
|
+
const constText = constLines.join("\n");
|
|
127542
|
+
assertions.push({
|
|
127543
|
+
file: constitution,
|
|
127544
|
+
assertion: 'Contains "11 canonical domains"',
|
|
127545
|
+
passed: constText.includes("11 canonical domains") || constText.includes("eleven canonical domains")
|
|
127546
|
+
});
|
|
127547
|
+
const allAssertionsPassed = assertions.every((a) => a.passed);
|
|
127548
|
+
const passed = allViolations.length === 0 && allAssertionsPassed;
|
|
127549
|
+
return {
|
|
127550
|
+
domainsInCode,
|
|
127551
|
+
operationsInCode,
|
|
127552
|
+
violations: allViolations,
|
|
127553
|
+
assertions,
|
|
127554
|
+
passed
|
|
127555
|
+
};
|
|
127556
|
+
}
|
|
127557
|
+
var FORBIDDEN_PHRASES, EXCLUDED_FILENAMES;
|
|
127558
|
+
var init_canon = __esm({
|
|
127559
|
+
"packages/cleo/src/dispatch/domains/check/canon.ts"() {
|
|
127560
|
+
"use strict";
|
|
127561
|
+
FORBIDDEN_PHRASES = [
|
|
127562
|
+
"Four Great Systems",
|
|
127563
|
+
"Four systems",
|
|
127564
|
+
"Circle of Ten",
|
|
127565
|
+
"exactly 10 domains",
|
|
127566
|
+
"exactly ten domains"
|
|
127567
|
+
];
|
|
127568
|
+
EXCLUDED_FILENAMES = [
|
|
127569
|
+
"CLEO-CANT.md",
|
|
127570
|
+
"CLEO-AWAKENING-STORY.md",
|
|
127571
|
+
"CLEO-FOUNDING-STORY.md",
|
|
127572
|
+
"CLEO-MANIFESTO.md"
|
|
127573
|
+
];
|
|
127574
|
+
}
|
|
127575
|
+
});
|
|
127576
|
+
|
|
127192
127577
|
// packages/cleo/src/dispatch/domains/check.ts
|
|
127193
127578
|
var CheckHandler;
|
|
127194
127579
|
var init_check = __esm({
|
|
@@ -127538,6 +127923,22 @@ var init_check = __esm({
|
|
|
127538
127923
|
page: page.page
|
|
127539
127924
|
};
|
|
127540
127925
|
}
|
|
127926
|
+
// T646: Canon drift detection — compares docs to live code
|
|
127927
|
+
case "canon": {
|
|
127928
|
+
const { runCanonCheck: runCanonCheck2 } = await Promise.resolve().then(() => (init_canon(), canon_exports));
|
|
127929
|
+
const result = runCanonCheck2({ projectRoot });
|
|
127930
|
+
return {
|
|
127931
|
+
meta: dispatchMeta("query", "check", operation, startTime),
|
|
127932
|
+
success: result.passed,
|
|
127933
|
+
data: result,
|
|
127934
|
+
...!result.passed ? {
|
|
127935
|
+
error: {
|
|
127936
|
+
code: "E_CANON_DRIFT",
|
|
127937
|
+
message: `Canon drift detected: ${result.violations.length} forbidden phrase(s), ${result.assertions.filter((a) => !a.passed).length} failed assertion(s)`
|
|
127938
|
+
}
|
|
127939
|
+
} : {}
|
|
127940
|
+
};
|
|
127941
|
+
}
|
|
127541
127942
|
// T065: Workflow compliance telemetry — WF-001 through WF-005
|
|
127542
127943
|
case "workflow.compliance": {
|
|
127543
127944
|
const since = params?.since;
|
|
@@ -127666,7 +128067,8 @@ var init_check = __esm({
|
|
|
127666
128067
|
"archive.stats",
|
|
127667
128068
|
"grade",
|
|
127668
128069
|
"grade.list",
|
|
127669
|
-
"chain.validate"
|
|
128070
|
+
"chain.validate",
|
|
128071
|
+
"canon"
|
|
127670
128072
|
],
|
|
127671
128073
|
mutate: ["compliance.record", "compliance.sync", "test.run", "gate.set"]
|
|
127672
128074
|
};
|
|
@@ -129654,16 +130056,16 @@ var init_nexus2 = __esm({
|
|
|
129654
130056
|
async function orchestrateClassify(request, context, projectRoot) {
|
|
129655
130057
|
try {
|
|
129656
130058
|
const { getCleoCantWorkflowsDir: getCleoCantWorkflowsDir2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
129657
|
-
const { readFileSync:
|
|
129658
|
-
const { join:
|
|
130059
|
+
const { readFileSync: readFileSync110, readdirSync: readdirSync43, existsSync: existsSync137 } = await import("node:fs");
|
|
130060
|
+
const { join: join146 } = await import("node:path");
|
|
129659
130061
|
const workflowsDir = getCleoCantWorkflowsDir2();
|
|
129660
130062
|
const combined = `${request} ${context ?? ""}`.toLowerCase();
|
|
129661
130063
|
const matches = [];
|
|
129662
|
-
if (
|
|
130064
|
+
if (existsSync137(workflowsDir)) {
|
|
129663
130065
|
const files = readdirSync43(workflowsDir).filter((f2) => f2.endsWith(".cant"));
|
|
129664
130066
|
for (const file2 of files) {
|
|
129665
130067
|
try {
|
|
129666
|
-
const src =
|
|
130068
|
+
const src = readFileSync110(join146(workflowsDir, file2), "utf-8");
|
|
129667
130069
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
129668
130070
|
if (!teamMatch) continue;
|
|
129669
130071
|
const teamName = teamMatch[1];
|
|
@@ -129678,12 +130080,12 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
129678
130080
|
}
|
|
129679
130081
|
}
|
|
129680
130082
|
}
|
|
129681
|
-
const localCantDir =
|
|
129682
|
-
if (
|
|
130083
|
+
const localCantDir = join146(projectRoot, ".cleo", "workflows");
|
|
130084
|
+
if (existsSync137(localCantDir)) {
|
|
129683
130085
|
const files = readdirSync43(localCantDir).filter((f2) => f2.endsWith(".cant"));
|
|
129684
130086
|
for (const file2 of files) {
|
|
129685
130087
|
try {
|
|
129686
|
-
const src =
|
|
130088
|
+
const src = readFileSync110(join146(localCantDir, file2), "utf-8");
|
|
129687
130089
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
129688
130090
|
if (!teamMatch) continue;
|
|
129689
130091
|
const teamName = teamMatch[1];
|
|
@@ -132391,7 +132793,7 @@ var init_tasks4 = __esm({
|
|
|
132391
132793
|
});
|
|
132392
132794
|
|
|
132393
132795
|
// packages/cleo/src/dispatch/engines/code-engine.ts
|
|
132394
|
-
import { join as
|
|
132796
|
+
import { join as join128 } from "node:path";
|
|
132395
132797
|
async function codeOutline(params) {
|
|
132396
132798
|
const { smartOutline: smartOutline2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
132397
132799
|
const filePath = params?.file;
|
|
@@ -132401,7 +132803,7 @@ async function codeOutline(params) {
|
|
|
132401
132803
|
error: { code: "E_INVALID_INPUT", message: "file parameter required" }
|
|
132402
132804
|
};
|
|
132403
132805
|
const root = getProjectRoot();
|
|
132404
|
-
const absPath = filePath.startsWith("/") ? filePath :
|
|
132806
|
+
const absPath = filePath.startsWith("/") ? filePath : join128(root, filePath);
|
|
132405
132807
|
return { success: true, data: smartOutline2(absPath, root) };
|
|
132406
132808
|
}
|
|
132407
132809
|
async function codeSearch(params) {
|
|
@@ -132433,7 +132835,7 @@ async function codeUnfold(params) {
|
|
|
132433
132835
|
error: { code: "E_INVALID_INPUT", message: "file and symbol parameters required" }
|
|
132434
132836
|
};
|
|
132435
132837
|
const root = getProjectRoot();
|
|
132436
|
-
const absPath = filePath.startsWith("/") ? filePath :
|
|
132838
|
+
const absPath = filePath.startsWith("/") ? filePath : join128(root, filePath);
|
|
132437
132839
|
return { success: true, data: smartUnfold2(absPath, symbol2, root) };
|
|
132438
132840
|
}
|
|
132439
132841
|
async function codeParse(params) {
|
|
@@ -132445,7 +132847,7 @@ async function codeParse(params) {
|
|
|
132445
132847
|
error: { code: "E_INVALID_INPUT", message: "file parameter required" }
|
|
132446
132848
|
};
|
|
132447
132849
|
const root = getProjectRoot();
|
|
132448
|
-
const absPath = filePath.startsWith("/") ? filePath :
|
|
132850
|
+
const absPath = filePath.startsWith("/") ? filePath : join128(root, filePath);
|
|
132449
132851
|
return { success: true, data: parseFile3(absPath, root) };
|
|
132450
132852
|
}
|
|
132451
132853
|
var init_code_engine = __esm({
|
|
@@ -133608,8 +134010,8 @@ var init_defaults = __esm({
|
|
|
133608
134010
|
});
|
|
133609
134011
|
|
|
133610
134012
|
// packages/cleo/src/dispatch/lib/config-loader.ts
|
|
133611
|
-
import { existsSync as
|
|
133612
|
-
import { join as
|
|
134013
|
+
import { existsSync as existsSync130, readFileSync as readFileSync101 } from "fs";
|
|
134014
|
+
import { join as join129 } from "path";
|
|
133613
134015
|
function loadFromEnv(key) {
|
|
133614
134016
|
const envKey = `${ENV_PREFIX}${key.toUpperCase()}`;
|
|
133615
134017
|
return process.env[envKey];
|
|
@@ -133630,12 +134032,12 @@ function parseEnvValue2(key, value) {
|
|
|
133630
134032
|
}
|
|
133631
134033
|
function loadFromFile(projectRoot) {
|
|
133632
134034
|
const root = projectRoot || process.cwd();
|
|
133633
|
-
const configPath =
|
|
133634
|
-
if (!
|
|
134035
|
+
const configPath = join129(root, ".cleo", "config.json");
|
|
134036
|
+
if (!existsSync130(configPath)) {
|
|
133635
134037
|
return {};
|
|
133636
134038
|
}
|
|
133637
134039
|
try {
|
|
133638
|
-
const content =
|
|
134040
|
+
const content = readFileSync101(configPath, "utf-8");
|
|
133639
134041
|
const config2 = JSON.parse(content);
|
|
133640
134042
|
const result = {};
|
|
133641
134043
|
if (config2.lifecycleEnforcement) {
|
|
@@ -134085,9 +134487,9 @@ __export(cli_exports, {
|
|
|
134085
134487
|
resetCliDispatcher: () => resetCliDispatcher
|
|
134086
134488
|
});
|
|
134087
134489
|
import { randomUUID as randomUUID14 } from "node:crypto";
|
|
134088
|
-
import { existsSync as
|
|
134490
|
+
import { existsSync as existsSync131 } from "node:fs";
|
|
134089
134491
|
import { createRequire as createRequire19 } from "node:module";
|
|
134090
|
-
import { dirname as dirname27, join as
|
|
134492
|
+
import { dirname as dirname27, join as join130 } from "node:path";
|
|
134091
134493
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
134092
134494
|
import { catalog as catalog4, registerSkillLibraryFromPath } from "@cleocode/caamp";
|
|
134093
134495
|
function ensureCaampLibrary() {
|
|
@@ -134098,16 +134500,16 @@ function ensureCaampLibrary() {
|
|
|
134098
134500
|
const req = createRequire19(import.meta.url);
|
|
134099
134501
|
const skillsPkgJson = req.resolve("@cleocode/skills/package.json");
|
|
134100
134502
|
const candidate = dirname27(skillsPkgJson);
|
|
134101
|
-
if (
|
|
134503
|
+
if (existsSync131(join130(candidate, "skills.json"))) {
|
|
134102
134504
|
skillsRoot = candidate;
|
|
134103
134505
|
}
|
|
134104
134506
|
} catch {
|
|
134105
134507
|
}
|
|
134106
134508
|
if (!skillsRoot) {
|
|
134107
134509
|
const thisFile = fileURLToPath7(import.meta.url);
|
|
134108
|
-
const packageRoot =
|
|
134109
|
-
const candidate =
|
|
134110
|
-
if (
|
|
134510
|
+
const packageRoot = join130(dirname27(thisFile), "..", "..", "..", "..", "..");
|
|
134511
|
+
const candidate = join130(packageRoot, "packages", "skills");
|
|
134512
|
+
if (existsSync131(join130(candidate, "skills.json"))) {
|
|
134111
134513
|
skillsRoot = candidate;
|
|
134112
134514
|
}
|
|
134113
134515
|
}
|
|
@@ -134328,8 +134730,8 @@ var init_cli = __esm({
|
|
|
134328
134730
|
|
|
134329
134731
|
// packages/cleo/src/cli/index.ts
|
|
134330
134732
|
init_internal();
|
|
134331
|
-
import { readFileSync as
|
|
134332
|
-
import { dirname as dirname32, join as
|
|
134733
|
+
import { readFileSync as readFileSync109 } from "node:fs";
|
|
134734
|
+
import { dirname as dirname32, join as join145 } from "node:path";
|
|
134333
134735
|
import { fileURLToPath as fileURLToPath9 } from "node:url";
|
|
134334
134736
|
|
|
134335
134737
|
// node_modules/.pnpm/citty@0.2.1/node_modules/citty/dist/_chunks/libs/scule.mjs
|
|
@@ -135486,7 +135888,7 @@ function registerAddCommand(program) {
|
|
|
135486
135888
|
// packages/cleo/src/cli/commands/add-batch.ts
|
|
135487
135889
|
init_cli();
|
|
135488
135890
|
init_renderers();
|
|
135489
|
-
import { existsSync as
|
|
135891
|
+
import { existsSync as existsSync132, readFileSync as readFileSync102 } from "node:fs";
|
|
135490
135892
|
function registerAddBatchCommand(program) {
|
|
135491
135893
|
program.command("add-batch").description("Create multiple tasks atomically from a JSON file").option("--file <path>", "Path to JSON file (array of task objects). Use - for stdin.").option("--parent <parentId>", "Default parent for all tasks (overridden by per-task parent)").option("--dry-run", "Preview what would be created without making changes").action(async (opts) => {
|
|
135492
135894
|
const filePath = opts["file"];
|
|
@@ -135513,7 +135915,7 @@ function registerAddBatchCommand(program) {
|
|
|
135513
135915
|
return;
|
|
135514
135916
|
}
|
|
135515
135917
|
} else {
|
|
135516
|
-
if (!
|
|
135918
|
+
if (!existsSync132(filePath)) {
|
|
135517
135919
|
cliError(
|
|
135518
135920
|
`File not found: ${filePath}`,
|
|
135519
135921
|
"E_NOT_FOUND",
|
|
@@ -135526,7 +135928,7 @@ function registerAddBatchCommand(program) {
|
|
|
135526
135928
|
process.exit(2);
|
|
135527
135929
|
return;
|
|
135528
135930
|
}
|
|
135529
|
-
raw =
|
|
135931
|
+
raw = readFileSync102(filePath, "utf-8");
|
|
135530
135932
|
}
|
|
135531
135933
|
let tasks2;
|
|
135532
135934
|
try {
|
|
@@ -135646,8 +136048,24 @@ function registerAdminCommand(program) {
|
|
|
135646
136048
|
{ command: "admin" }
|
|
135647
136049
|
);
|
|
135648
136050
|
});
|
|
135649
|
-
admin.command("smoke").description(
|
|
135650
|
-
|
|
136051
|
+
admin.command("smoke").description(
|
|
136052
|
+
"Run operational smoke tests across all domains, or probe ADR-049 invariants for a named provider (--provider)"
|
|
136053
|
+
).option(
|
|
136054
|
+
"--provider <id>",
|
|
136055
|
+
"Probe harness sovereignty invariants for a specific provider adapter (ADR-049)"
|
|
136056
|
+
).action(async (opts) => {
|
|
136057
|
+
const provider = opts["provider"];
|
|
136058
|
+
if (provider) {
|
|
136059
|
+
await dispatchFromCli(
|
|
136060
|
+
"query",
|
|
136061
|
+
"admin",
|
|
136062
|
+
"smoke.provider",
|
|
136063
|
+
{ provider },
|
|
136064
|
+
{ command: "admin smoke", operation: "admin.smoke.provider" }
|
|
136065
|
+
);
|
|
136066
|
+
} else {
|
|
136067
|
+
await dispatchFromCli("query", "admin", "smoke", {}, { command: "admin" });
|
|
136068
|
+
}
|
|
135651
136069
|
});
|
|
135652
136070
|
admin.command("paths").description("Report all CleoOS paths (project + global hub) and scaffolding status").action(async () => {
|
|
135653
136071
|
await dispatchFromCli("query", "admin", "paths", {}, { command: "admin" });
|
|
@@ -135831,12 +136249,12 @@ function registerAgentCommand(program) {
|
|
|
135831
136249
|
transportConfig: {},
|
|
135832
136250
|
isActive: true
|
|
135833
136251
|
});
|
|
135834
|
-
const { existsSync:
|
|
135835
|
-
const { join:
|
|
135836
|
-
const cantDir =
|
|
135837
|
-
const cantPath =
|
|
136252
|
+
const { existsSync: existsSync137, mkdirSync: mkdirSync36, writeFileSync: writeFileSync27 } = await import("node:fs");
|
|
136253
|
+
const { join: join146 } = await import("node:path");
|
|
136254
|
+
const cantDir = join146(".cleo", "agents");
|
|
136255
|
+
const cantPath = join146(cantDir, `${agentId}.cant`);
|
|
135838
136256
|
let cantScaffolded = false;
|
|
135839
|
-
if (!
|
|
136257
|
+
if (!existsSync137(cantPath)) {
|
|
135840
136258
|
mkdirSync36(cantDir, { recursive: true });
|
|
135841
136259
|
const role = classification ?? "specialist";
|
|
135842
136260
|
const cantContent = `---
|
|
@@ -135896,7 +136314,7 @@ agent ${agentId}:
|
|
|
135896
136314
|
data: {
|
|
135897
136315
|
agentId: credential.agentId,
|
|
135898
136316
|
displayName: credential.displayName,
|
|
135899
|
-
cantFile: cantScaffolded ? cantPath :
|
|
136317
|
+
cantFile: cantScaffolded ? cantPath : existsSync137(cantPath) ? cantPath : null,
|
|
135900
136318
|
cantScaffolded
|
|
135901
136319
|
}
|
|
135902
136320
|
},
|
|
@@ -135976,8 +136394,8 @@ agent ${agentId}:
|
|
|
135976
136394
|
try {
|
|
135977
136395
|
const { AgentRegistryAccessor: AgentRegistryAccessor2, getDb: getDb4 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
135978
136396
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
135979
|
-
const { existsSync:
|
|
135980
|
-
const { join:
|
|
136397
|
+
const { existsSync: existsSync137, readFileSync: readFileSync110 } = await import("node:fs");
|
|
136398
|
+
const { join: join146 } = await import("node:path");
|
|
135981
136399
|
await getDb4();
|
|
135982
136400
|
const registry2 = new AgentRegistryAccessor2(process.cwd());
|
|
135983
136401
|
const credential = await registry2.get(agentId);
|
|
@@ -135997,9 +136415,9 @@ agent ${agentId}:
|
|
|
135997
136415
|
}
|
|
135998
136416
|
let profile = null;
|
|
135999
136417
|
let cantValidation = null;
|
|
136000
|
-
const cantPath = opts["cant"] ??
|
|
136001
|
-
if (
|
|
136002
|
-
profile =
|
|
136418
|
+
const cantPath = opts["cant"] ?? join146(".cleo", "agents", `${agentId}.cant`);
|
|
136419
|
+
if (existsSync137(cantPath)) {
|
|
136420
|
+
profile = readFileSync110(cantPath, "utf-8");
|
|
136003
136421
|
try {
|
|
136004
136422
|
const cantModule = await import("@cleocode/cant");
|
|
136005
136423
|
const validate = "validate" in cantModule ? cantModule.validate : null;
|
|
@@ -136394,8 +136812,8 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
136394
136812
|
try {
|
|
136395
136813
|
const { AgentRegistryAccessor: AgentRegistryAccessor2, getDb: getDb4 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
136396
136814
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
136397
|
-
const { existsSync:
|
|
136398
|
-
const { join:
|
|
136815
|
+
const { existsSync: existsSync137 } = await import("node:fs");
|
|
136816
|
+
const { join: join146 } = await import("node:path");
|
|
136399
136817
|
const { execFile: execFile9 } = await import("node:child_process");
|
|
136400
136818
|
const { promisify: promisify9 } = await import("node:util");
|
|
136401
136819
|
const execFileAsync6 = promisify9(execFile9);
|
|
@@ -136415,8 +136833,8 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
136415
136833
|
}
|
|
136416
136834
|
await registry2.update(agentId, { isActive: true });
|
|
136417
136835
|
await registry2.markUsed(agentId);
|
|
136418
|
-
const cantPath =
|
|
136419
|
-
const hasProfile =
|
|
136836
|
+
const cantPath = join146(".cleo", "agents", `${agentId}.cant`);
|
|
136837
|
+
const hasProfile = existsSync137(cantPath);
|
|
136420
136838
|
const runtime = await createRuntime(registry2, {
|
|
136421
136839
|
agentId,
|
|
136422
136840
|
pollIntervalMs: 5e3,
|
|
@@ -137039,12 +137457,12 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137039
137457
|
});
|
|
137040
137458
|
agent.command("install <path>").description("Install an agent from a .cantz archive or agent directory").option("--global", "Install to global tier (~/.local/share/cleo/cant/agents/)").action(async (sourcePath, opts) => {
|
|
137041
137459
|
try {
|
|
137042
|
-
const { existsSync:
|
|
137043
|
-
const { join:
|
|
137460
|
+
const { existsSync: existsSync137, mkdirSync: mkdirSync36, cpSync, readFileSync: readFileSync110, rmSync: rmSync2, statSync: statSync22 } = await import("node:fs");
|
|
137461
|
+
const { join: join146, basename: basename19, resolve: resolve17 } = await import("node:path");
|
|
137044
137462
|
const { homedir: homedir15 } = await import("node:os");
|
|
137045
137463
|
const { tmpdir: tmpdir2 } = await import("node:os");
|
|
137046
137464
|
const resolvedPath = resolve17(sourcePath);
|
|
137047
|
-
if (!
|
|
137465
|
+
if (!existsSync137(resolvedPath)) {
|
|
137048
137466
|
cliOutput(
|
|
137049
137467
|
{
|
|
137050
137468
|
success: false,
|
|
@@ -137064,7 +137482,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137064
137482
|
const isCantzArchive = resolvedPath.endsWith(".cantz") && statSync22(resolvedPath).isFile();
|
|
137065
137483
|
if (isCantzArchive) {
|
|
137066
137484
|
const { execFileSync: execFileSync19 } = await import("node:child_process");
|
|
137067
|
-
tempDir =
|
|
137485
|
+
tempDir = join146(tmpdir2(), `cleo-agent-install-${Date.now()}`);
|
|
137068
137486
|
mkdirSync36(tempDir, { recursive: true });
|
|
137069
137487
|
try {
|
|
137070
137488
|
execFileSync19("unzip", ["-o", "-q", resolvedPath, "-d", tempDir], {
|
|
@@ -137088,7 +137506,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137088
137506
|
}
|
|
137089
137507
|
const { readdirSync: readdirSync43 } = await import("node:fs");
|
|
137090
137508
|
const topLevel = readdirSync43(tempDir).filter((entry) => {
|
|
137091
|
-
const entryPath =
|
|
137509
|
+
const entryPath = join146(tempDir, entry);
|
|
137092
137510
|
return statSync22(entryPath).isDirectory();
|
|
137093
137511
|
});
|
|
137094
137512
|
if (topLevel.length !== 1) {
|
|
@@ -137107,7 +137525,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137107
137525
|
return;
|
|
137108
137526
|
}
|
|
137109
137527
|
agentName = topLevel[0];
|
|
137110
|
-
agentDir =
|
|
137528
|
+
agentDir = join146(tempDir, agentName);
|
|
137111
137529
|
} else if (statSync22(resolvedPath).isDirectory()) {
|
|
137112
137530
|
agentDir = resolvedPath;
|
|
137113
137531
|
agentName = basename19(resolvedPath);
|
|
@@ -137125,8 +137543,8 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137125
137543
|
process.exitCode = 6;
|
|
137126
137544
|
return;
|
|
137127
137545
|
}
|
|
137128
|
-
const personaPath =
|
|
137129
|
-
if (!
|
|
137546
|
+
const personaPath = join146(agentDir, "persona.cant");
|
|
137547
|
+
if (!existsSync137(personaPath)) {
|
|
137130
137548
|
if (tempDir) rmSync2(tempDir, { recursive: true, force: true });
|
|
137131
137549
|
cliOutput(
|
|
137132
137550
|
{
|
|
@@ -137145,12 +137563,12 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137145
137563
|
let targetRoot;
|
|
137146
137564
|
if (isGlobal) {
|
|
137147
137565
|
const home = homedir15();
|
|
137148
|
-
const xdgData = process.env["XDG_DATA_HOME"] ??
|
|
137149
|
-
targetRoot =
|
|
137566
|
+
const xdgData = process.env["XDG_DATA_HOME"] ?? join146(home, ".local", "share");
|
|
137567
|
+
targetRoot = join146(xdgData, "cleo", "cant", "agents");
|
|
137150
137568
|
} else {
|
|
137151
|
-
targetRoot =
|
|
137569
|
+
targetRoot = join146(process.cwd(), ".cleo", "cant", "agents");
|
|
137152
137570
|
}
|
|
137153
|
-
const targetDir =
|
|
137571
|
+
const targetDir = join146(targetRoot, agentName);
|
|
137154
137572
|
mkdirSync36(targetRoot, { recursive: true });
|
|
137155
137573
|
cpSync(agentDir, targetDir, { recursive: true, force: true });
|
|
137156
137574
|
if (tempDir) {
|
|
@@ -137158,7 +137576,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137158
137576
|
}
|
|
137159
137577
|
let registered = false;
|
|
137160
137578
|
try {
|
|
137161
|
-
const persona =
|
|
137579
|
+
const persona = readFileSync110(join146(targetDir, "persona.cant"), "utf-8");
|
|
137162
137580
|
const descMatch = persona.match(/description:\s*"([^"]+)"/);
|
|
137163
137581
|
const displayName = descMatch?.[1] ?? agentName;
|
|
137164
137582
|
const { AgentRegistryAccessor: AgentRegistryAccessor2, getDb: getDb4 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
@@ -137205,11 +137623,11 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137205
137623
|
});
|
|
137206
137624
|
agent.command("pack <dir>").description("Package an agent directory as a .cantz archive").action(async (dir) => {
|
|
137207
137625
|
try {
|
|
137208
|
-
const { existsSync:
|
|
137626
|
+
const { existsSync: existsSync137, statSync: statSync22 } = await import("node:fs");
|
|
137209
137627
|
const { resolve: resolve17, basename: basename19, dirname: dirname33 } = await import("node:path");
|
|
137210
137628
|
const { execFileSync: execFileSync19 } = await import("node:child_process");
|
|
137211
137629
|
const resolvedDir = resolve17(dir);
|
|
137212
|
-
if (!
|
|
137630
|
+
if (!existsSync137(resolvedDir) || !statSync22(resolvedDir).isDirectory()) {
|
|
137213
137631
|
cliOutput(
|
|
137214
137632
|
{
|
|
137215
137633
|
success: false,
|
|
@@ -137223,9 +137641,9 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137223
137641
|
process.exitCode = 4;
|
|
137224
137642
|
return;
|
|
137225
137643
|
}
|
|
137226
|
-
const { join:
|
|
137227
|
-
const personaPath =
|
|
137228
|
-
if (!
|
|
137644
|
+
const { join: join146 } = await import("node:path");
|
|
137645
|
+
const personaPath = join146(resolvedDir, "persona.cant");
|
|
137646
|
+
if (!existsSync137(personaPath)) {
|
|
137229
137647
|
cliOutput(
|
|
137230
137648
|
{
|
|
137231
137649
|
success: false,
|
|
@@ -137272,7 +137690,7 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137272
137690
|
if (entry.isFile()) {
|
|
137273
137691
|
fileCount++;
|
|
137274
137692
|
} else if (entry.isDirectory()) {
|
|
137275
|
-
countFiles2(
|
|
137693
|
+
countFiles2(join146(dirPath, entry.name));
|
|
137276
137694
|
}
|
|
137277
137695
|
}
|
|
137278
137696
|
};
|
|
@@ -137299,8 +137717,8 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137299
137717
|
});
|
|
137300
137718
|
agent.command("create").description("Scaffold a new agent package with persona.cant and manifest.json").requiredOption("--name <name>", "Agent name (kebab-case)").requiredOption("--role <role>", "Agent role: orchestrator, lead, worker, or docs-worker").option("--tier <tier>", "Agent tier: low, mid, or high (defaults based on role)").option("--team <teamName>", "Team this agent belongs to").option("--domain <description>", "Domain description for file permissions and context").option("--global", "Create in global tier (~/.local/share/cleo/cant/agents/)").option("--seed-brain", "Create expertise/mental-model-seed.md and seed a BRAIN observation").option("--parent <parentAgent>", "Parent agent name in the hierarchy").action(async (opts) => {
|
|
137301
137719
|
try {
|
|
137302
|
-
const { existsSync:
|
|
137303
|
-
const { join:
|
|
137720
|
+
const { existsSync: existsSync137, mkdirSync: mkdirSync36, writeFileSync: writeFileSync27 } = await import("node:fs");
|
|
137721
|
+
const { join: join146 } = await import("node:path");
|
|
137304
137722
|
const { homedir: homedir15 } = await import("node:os");
|
|
137305
137723
|
const name2 = opts["name"];
|
|
137306
137724
|
const role = opts["role"];
|
|
@@ -137360,13 +137778,13 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137360
137778
|
let targetRoot;
|
|
137361
137779
|
if (isGlobal) {
|
|
137362
137780
|
const home = homedir15();
|
|
137363
|
-
const xdgData = process.env["XDG_DATA_HOME"] ??
|
|
137364
|
-
targetRoot =
|
|
137781
|
+
const xdgData = process.env["XDG_DATA_HOME"] ?? join146(home, ".local", "share");
|
|
137782
|
+
targetRoot = join146(xdgData, "cleo", "cant", "agents");
|
|
137365
137783
|
} else {
|
|
137366
|
-
targetRoot =
|
|
137784
|
+
targetRoot = join146(process.cwd(), ".cleo", "cant", "agents");
|
|
137367
137785
|
}
|
|
137368
|
-
const agentDir =
|
|
137369
|
-
if (
|
|
137786
|
+
const agentDir = join146(targetRoot, name2);
|
|
137787
|
+
if (existsSync137(agentDir)) {
|
|
137370
137788
|
cliOutput(
|
|
137371
137789
|
{
|
|
137372
137790
|
success: false,
|
|
@@ -137390,29 +137808,29 @@ Task ${taskId} reassigned to you by ${active.agentId}. Run: cleo show ${taskId}
|
|
|
137390
137808
|
domain: domain2,
|
|
137391
137809
|
parent
|
|
137392
137810
|
});
|
|
137393
|
-
writeFileSync27(
|
|
137811
|
+
writeFileSync27(join146(agentDir, "persona.cant"), personaContent, "utf-8");
|
|
137394
137812
|
const manifest = generateManifest2({ name: name2, role, tier, domain: domain2 });
|
|
137395
137813
|
writeFileSync27(
|
|
137396
|
-
|
|
137814
|
+
join146(agentDir, "manifest.json"),
|
|
137397
137815
|
`${JSON.stringify(manifest, null, 2)}
|
|
137398
137816
|
`,
|
|
137399
137817
|
"utf-8"
|
|
137400
137818
|
);
|
|
137401
137819
|
const createdFiles = [
|
|
137402
|
-
|
|
137403
|
-
|
|
137820
|
+
join146(agentDir, "persona.cant"),
|
|
137821
|
+
join146(agentDir, "manifest.json")
|
|
137404
137822
|
];
|
|
137405
137823
|
if (team) {
|
|
137406
137824
|
const teamConfigContent = generateTeamConfig(name2, role, team);
|
|
137407
|
-
writeFileSync27(
|
|
137408
|
-
createdFiles.push(
|
|
137825
|
+
writeFileSync27(join146(agentDir, "team-config.cant"), teamConfigContent, "utf-8");
|
|
137826
|
+
createdFiles.push(join146(agentDir, "team-config.cant"));
|
|
137409
137827
|
}
|
|
137410
137828
|
if (seedBrain) {
|
|
137411
|
-
const expertiseDir =
|
|
137829
|
+
const expertiseDir = join146(agentDir, "expertise");
|
|
137412
137830
|
mkdirSync36(expertiseDir, { recursive: true });
|
|
137413
137831
|
const seedContent = generateMentalModelSeed(name2, role, domain2);
|
|
137414
|
-
writeFileSync27(
|
|
137415
|
-
createdFiles.push(
|
|
137832
|
+
writeFileSync27(join146(expertiseDir, "mental-model-seed.md"), seedContent, "utf-8");
|
|
137833
|
+
createdFiles.push(join146(expertiseDir, "mental-model-seed.md"));
|
|
137416
137834
|
try {
|
|
137417
137835
|
const { execFile: execFile9 } = await import("node:child_process");
|
|
137418
137836
|
const { promisify: promisify9 } = await import("node:util");
|
|
@@ -139042,8 +139460,8 @@ function registerCancelCommand(program) {
|
|
|
139042
139460
|
|
|
139043
139461
|
// packages/cleo/src/cli/commands/cant.ts
|
|
139044
139462
|
init_renderers();
|
|
139045
|
-
import { existsSync as
|
|
139046
|
-
import { dirname as dirname28, isAbsolute as isAbsolute3, join as
|
|
139463
|
+
import { existsSync as existsSync133, mkdirSync as mkdirSync33, readFileSync as readFileSync103, writeFileSync as writeFileSync24 } from "node:fs";
|
|
139464
|
+
import { dirname as dirname28, isAbsolute as isAbsolute3, join as join131, resolve as resolve16 } from "node:path";
|
|
139047
139465
|
function registerCantCommand(program) {
|
|
139048
139466
|
const cant = program.command("cant").description("CANT DSL tooling");
|
|
139049
139467
|
cant.command("parse <file>").description("Parse a .cant file and emit the AST").action(async (file2) => {
|
|
@@ -139111,7 +139529,7 @@ function registerCantCommand(program) {
|
|
|
139111
139529
|
if (!ensureExists(filePath, "cant.migrate")) return;
|
|
139112
139530
|
try {
|
|
139113
139531
|
const mod = await loadMigrateEngine();
|
|
139114
|
-
const content =
|
|
139532
|
+
const content = readFileSync103(filePath, "utf-8");
|
|
139115
139533
|
const result = mod.migrateMarkdown(content, filePath, {
|
|
139116
139534
|
write: isWrite,
|
|
139117
139535
|
verbose: isVerbose,
|
|
@@ -139121,7 +139539,7 @@ function registerCantCommand(program) {
|
|
|
139121
139539
|
const projectRoot = process.cwd();
|
|
139122
139540
|
let written = 0;
|
|
139123
139541
|
for (const outputFile of result.outputFiles) {
|
|
139124
|
-
const outputPath = isAbsolute3(outputFile.path) ? outputFile.path :
|
|
139542
|
+
const outputPath = isAbsolute3(outputFile.path) ? outputFile.path : join131(projectRoot, outputFile.path);
|
|
139125
139543
|
mkdirSync33(dirname28(outputPath), { recursive: true });
|
|
139126
139544
|
writeFileSync24(outputPath, outputFile.content, "utf-8");
|
|
139127
139545
|
written++;
|
|
@@ -139162,7 +139580,7 @@ function resolveFilePath(file2) {
|
|
|
139162
139580
|
return isAbsolute3(file2) ? file2 : resolve16(process.cwd(), file2);
|
|
139163
139581
|
}
|
|
139164
139582
|
function ensureExists(filePath, operation) {
|
|
139165
|
-
if (
|
|
139583
|
+
if (existsSync133(filePath)) return true;
|
|
139166
139584
|
cliError(`File not found: ${filePath}`, "E_FILE_READ");
|
|
139167
139585
|
process.exitCode = 3;
|
|
139168
139586
|
if (process.env["CLEO_DEBUG"]) {
|
|
@@ -139204,7 +139622,7 @@ async function loadMigrateEngine() {
|
|
|
139204
139622
|
|
|
139205
139623
|
// packages/cleo/src/cli/commands/chain.ts
|
|
139206
139624
|
init_cli();
|
|
139207
|
-
import { readFileSync as
|
|
139625
|
+
import { readFileSync as readFileSync104 } from "node:fs";
|
|
139208
139626
|
function registerChainCommand(program) {
|
|
139209
139627
|
const chain = program.command("chain").description("WarpChain pipeline management (tier-2 orchestrator)");
|
|
139210
139628
|
chain.command("show <chainId>").description("Show details for a WarpChain definition").action(async (chainId) => {
|
|
@@ -139214,7 +139632,7 @@ function registerChainCommand(program) {
|
|
|
139214
139632
|
await dispatchFromCli("query", "pipeline", "chain.list", {}, { command: "chain" });
|
|
139215
139633
|
});
|
|
139216
139634
|
chain.command("add <file>").description("Add a new WarpChain definition from a JSON file").action(async (file2) => {
|
|
139217
|
-
const chainJson = JSON.parse(
|
|
139635
|
+
const chainJson = JSON.parse(readFileSync104(file2, "utf-8"));
|
|
139218
139636
|
await dispatchFromCli(
|
|
139219
139637
|
"mutate",
|
|
139220
139638
|
"pipeline",
|
|
@@ -139283,10 +139701,10 @@ function registerCheckCommand(program) {
|
|
|
139283
139701
|
);
|
|
139284
139702
|
});
|
|
139285
139703
|
check2.command("chain-validate <file>").description("Validate a WarpChain definition from a JSON file").action(async (file2) => {
|
|
139286
|
-
const { readFileSync:
|
|
139704
|
+
const { readFileSync: readFileSync110 } = await import("node:fs");
|
|
139287
139705
|
let chain;
|
|
139288
139706
|
try {
|
|
139289
|
-
chain = JSON.parse(
|
|
139707
|
+
chain = JSON.parse(readFileSync110(file2, "utf8"));
|
|
139290
139708
|
} catch (err) {
|
|
139291
139709
|
const message = err instanceof Error ? err.message : String(err);
|
|
139292
139710
|
console.error(`Failed to read or parse chain file: ${message}`);
|
|
@@ -139300,6 +139718,9 @@ function registerCheckCommand(program) {
|
|
|
139300
139718
|
{ command: "check", operation: "check.chain.validate" }
|
|
139301
139719
|
);
|
|
139302
139720
|
});
|
|
139721
|
+
check2.command("canon").description("CI gate: detect canon drift between docs and live code").action(async () => {
|
|
139722
|
+
await dispatchFromCli("query", "check", "canon", {}, { command: "check" });
|
|
139723
|
+
});
|
|
139303
139724
|
check2.command("protocol <protocolType>").description(
|
|
139304
139725
|
`Validate any of the 12 RCASD-IVTR+C protocols: ${SUPPORTED_PROTOCOL_TYPES.join(", ")}`
|
|
139305
139726
|
).option("--task-id <id>", "Task ID to validate (mode=task, default)").option("--manifest-file <file>", "Manifest file to validate (mode=manifest)").option("--strict", "Exit with error code on violations").option("--voting-matrix-file <file>", "consensus: voting matrix JSON file").option("--epic-id <id>", "decomposition: parent epic ID").option("--sibling-count <n>", "decomposition: actual sibling count", Number).option("--max-siblings <n>", "decomposition: configured max siblings", Number).option("--spec-file <file>", "specification: path to spec markdown").option("--has-code-changes", "research: code changes detected (forbidden)").option("--has-task-tags", "implementation: @task tags present in code").option("--has-contribution-tags", "contribution: @contribution tags present").option("--version <v>", "release: target version (semver/calver)").option("--has-changelog", "release: changelog updated").option(
|
|
@@ -139805,20 +140226,20 @@ function registerCurrentCommand(program) {
|
|
|
139805
140226
|
|
|
139806
140227
|
// packages/cleo/src/cli/commands/daemon.ts
|
|
139807
140228
|
import { homedir as homedir10 } from "node:os";
|
|
139808
|
-
import { join as
|
|
140229
|
+
import { join as join135 } from "node:path";
|
|
139809
140230
|
|
|
139810
140231
|
// packages/cleo/src/gc/daemon.ts
|
|
139811
140232
|
import { spawn as spawn2 } from "node:child_process";
|
|
139812
140233
|
import { createWriteStream as createWriteStream2 } from "node:fs";
|
|
139813
140234
|
import { mkdir as mkdir20 } from "node:fs/promises";
|
|
139814
|
-
import { join as
|
|
140235
|
+
import { join as join134 } from "node:path";
|
|
139815
140236
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
139816
140237
|
import cron from "node-cron";
|
|
139817
140238
|
|
|
139818
140239
|
// packages/cleo/src/gc/runner.ts
|
|
139819
140240
|
import { lstat as lstat2, readdir as readdir4, rm as rm3, stat as stat4 } from "node:fs/promises";
|
|
139820
140241
|
import { homedir as homedir9 } from "node:os";
|
|
139821
|
-
import { join as
|
|
140242
|
+
import { join as join133 } from "node:path";
|
|
139822
140243
|
|
|
139823
140244
|
// node_modules/.pnpm/check-disk-space@3.4.0/node_modules/check-disk-space/dist/check-disk-space.mjs
|
|
139824
140245
|
import { execFile as execFile7 } from "node:child_process";
|
|
@@ -139957,7 +140378,7 @@ function checkDiskSpace(directoryPath, dependencies = {
|
|
|
139957
140378
|
|
|
139958
140379
|
// packages/cleo/src/gc/state.ts
|
|
139959
140380
|
import { mkdir as mkdir19, readFile as readFile22, rename as rename2, writeFile as writeFile14 } from "node:fs/promises";
|
|
139960
|
-
import { dirname as dirname29, join as
|
|
140381
|
+
import { dirname as dirname29, join as join132 } from "node:path";
|
|
139961
140382
|
var GC_STATE_SCHEMA_VERSION = "1.0";
|
|
139962
140383
|
var DEFAULT_GC_STATE = {
|
|
139963
140384
|
schemaVersion: GC_STATE_SCHEMA_VERSION,
|
|
@@ -139985,7 +140406,7 @@ async function readGCState(statePath) {
|
|
|
139985
140406
|
async function writeGCState(statePath, state) {
|
|
139986
140407
|
const dir = dirname29(statePath);
|
|
139987
140408
|
await mkdir19(dir, { recursive: true });
|
|
139988
|
-
const tmpPath =
|
|
140409
|
+
const tmpPath = join132(dir, `.gc-state-${process.pid}.tmp`);
|
|
139989
140410
|
const json3 = JSON.stringify(state, null, 2);
|
|
139990
140411
|
await writeFile14(tmpPath, json3, "utf-8");
|
|
139991
140412
|
await rename2(tmpPath, statePath);
|
|
@@ -140034,7 +140455,7 @@ async function getPathBytes(targetPath) {
|
|
|
140034
140455
|
const entries = await readdir4(targetPath, { withFileTypes: true });
|
|
140035
140456
|
let total = 0;
|
|
140036
140457
|
for (const entry of entries) {
|
|
140037
|
-
total += await getPathBytes(
|
|
140458
|
+
total += await getPathBytes(join133(targetPath, entry.name));
|
|
140038
140459
|
}
|
|
140039
140460
|
return total;
|
|
140040
140461
|
} catch {
|
|
@@ -140051,7 +140472,7 @@ async function idempotentRm(targetPath) {
|
|
|
140051
140472
|
}
|
|
140052
140473
|
}
|
|
140053
140474
|
async function gatherPruneCandidates(maxAgeMs, projectsDir) {
|
|
140054
|
-
const resolvedProjectsDir = projectsDir ??
|
|
140475
|
+
const resolvedProjectsDir = projectsDir ?? join133(homedir9(), ".claude", "projects");
|
|
140055
140476
|
const candidates = [];
|
|
140056
140477
|
const now2 = Date.now();
|
|
140057
140478
|
let projectSlugs;
|
|
@@ -140062,7 +140483,7 @@ async function gatherPruneCandidates(maxAgeMs, projectsDir) {
|
|
|
140062
140483
|
return candidates;
|
|
140063
140484
|
}
|
|
140064
140485
|
for (const slug of projectSlugs) {
|
|
140065
|
-
const slugDir =
|
|
140486
|
+
const slugDir = join133(resolvedProjectsDir, slug);
|
|
140066
140487
|
let slugEntries;
|
|
140067
140488
|
try {
|
|
140068
140489
|
slugEntries = await readdir4(slugDir, { withFileTypes: true });
|
|
@@ -140070,7 +140491,7 @@ async function gatherPruneCandidates(maxAgeMs, projectsDir) {
|
|
|
140070
140491
|
continue;
|
|
140071
140492
|
}
|
|
140072
140493
|
for (const entry of slugEntries) {
|
|
140073
|
-
const entryPath =
|
|
140494
|
+
const entryPath = join133(slugDir, entry.name);
|
|
140074
140495
|
if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
140075
140496
|
try {
|
|
140076
140497
|
const info = await stat4(entryPath);
|
|
@@ -140095,8 +140516,8 @@ async function gatherPruneCandidates(maxAgeMs, projectsDir) {
|
|
|
140095
140516
|
return candidates;
|
|
140096
140517
|
}
|
|
140097
140518
|
async function runGC(opts = {}) {
|
|
140098
|
-
const cleoDir = opts.cleoDir ??
|
|
140099
|
-
const statePath =
|
|
140519
|
+
const cleoDir = opts.cleoDir ?? join133(homedir9(), ".cleo");
|
|
140520
|
+
const statePath = join133(cleoDir, "gc-state.json");
|
|
140100
140521
|
const dryRun = opts.dryRun ?? false;
|
|
140101
140522
|
const projectsDir = opts.projectsDir;
|
|
140102
140523
|
const initialState = await readGCState(statePath);
|
|
@@ -140169,13 +140590,13 @@ async function runGC(opts = {}) {
|
|
|
140169
140590
|
// packages/cleo/src/gc/daemon.ts
|
|
140170
140591
|
var GC_INTERVAL_MS = 24 * 60 * 60 * 1e3;
|
|
140171
140592
|
async function spawnGCDaemon(cleoDir) {
|
|
140172
|
-
const logsDir =
|
|
140593
|
+
const logsDir = join134(cleoDir, "logs");
|
|
140173
140594
|
await mkdir20(logsDir, { recursive: true });
|
|
140174
|
-
const logPath =
|
|
140175
|
-
const errPath =
|
|
140595
|
+
const logPath = join134(logsDir, "gc.log");
|
|
140596
|
+
const errPath = join134(logsDir, "gc.err");
|
|
140176
140597
|
const outStream = createWriteStream2(logPath, { flags: "a" });
|
|
140177
140598
|
const errStream = createWriteStream2(errPath, { flags: "a" });
|
|
140178
|
-
const daemonEntry =
|
|
140599
|
+
const daemonEntry = join134(fileURLToPath8(import.meta.url), "..", "daemon-entry.js");
|
|
140179
140600
|
const child = spawn2(process.execPath, [daemonEntry, cleoDir], {
|
|
140180
140601
|
detached: true,
|
|
140181
140602
|
stdio: ["ignore", outStream, errStream],
|
|
@@ -140183,14 +140604,14 @@ async function spawnGCDaemon(cleoDir) {
|
|
|
140183
140604
|
});
|
|
140184
140605
|
child.unref();
|
|
140185
140606
|
const pid = child.pid ?? 0;
|
|
140186
|
-
await patchGCState(
|
|
140607
|
+
await patchGCState(join134(cleoDir, "gc-state.json"), {
|
|
140187
140608
|
daemonPid: pid,
|
|
140188
140609
|
daemonStartedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
140189
140610
|
});
|
|
140190
140611
|
return pid;
|
|
140191
140612
|
}
|
|
140192
140613
|
async function stopGCDaemon(cleoDir) {
|
|
140193
|
-
const statePath =
|
|
140614
|
+
const statePath = join134(cleoDir, "gc-state.json");
|
|
140194
140615
|
const state = await readGCState(statePath);
|
|
140195
140616
|
const pid = state.daemonPid;
|
|
140196
140617
|
if (!pid) {
|
|
@@ -140216,7 +140637,7 @@ async function stopGCDaemon(cleoDir) {
|
|
|
140216
140637
|
}
|
|
140217
140638
|
}
|
|
140218
140639
|
async function getGCDaemonStatus(cleoDir) {
|
|
140219
|
-
const state = await readGCState(
|
|
140640
|
+
const state = await readGCState(join134(cleoDir, "gc-state.json"));
|
|
140220
140641
|
const pid = state.daemonPid;
|
|
140221
140642
|
let running = false;
|
|
140222
140643
|
if (pid) {
|
|
@@ -140241,7 +140662,7 @@ async function getGCDaemonStatus(cleoDir) {
|
|
|
140241
140662
|
function registerDaemonCommand(program) {
|
|
140242
140663
|
const daemon = program.command("daemon").description("Manage the CLEO GC sidecar daemon for autonomous transcript cleanup");
|
|
140243
140664
|
daemon.command("start").description("Spawn the GC daemon as a detached background process").option("--cleo-dir <path>", "Override .cleo/ directory path").option("--json", "Output result as JSON").action(async (opts) => {
|
|
140244
|
-
const cleoDir = opts.cleoDir ??
|
|
140665
|
+
const cleoDir = opts.cleoDir ?? join135(homedir10(), ".cleo");
|
|
140245
140666
|
try {
|
|
140246
140667
|
const status = await getGCDaemonStatus(cleoDir);
|
|
140247
140668
|
if (status.running && status.pid) {
|
|
@@ -140271,7 +140692,7 @@ function registerDaemonCommand(program) {
|
|
|
140271
140692
|
} else {
|
|
140272
140693
|
process.stdout.write(`GC daemon started (PID ${pid})
|
|
140273
140694
|
`);
|
|
140274
|
-
process.stdout.write(`Logs: ${
|
|
140695
|
+
process.stdout.write(`Logs: ${join135(cleoDir, "logs", "gc.log")}
|
|
140275
140696
|
`);
|
|
140276
140697
|
}
|
|
140277
140698
|
} catch (err) {
|
|
@@ -140287,7 +140708,7 @@ function registerDaemonCommand(program) {
|
|
|
140287
140708
|
}
|
|
140288
140709
|
});
|
|
140289
140710
|
daemon.command("stop").description("Stop the GC daemon by sending SIGTERM to its PID").option("--cleo-dir <path>", "Override .cleo/ directory path").option("--json", "Output result as JSON").action(async (opts) => {
|
|
140290
|
-
const cleoDir = opts.cleoDir ??
|
|
140711
|
+
const cleoDir = opts.cleoDir ?? join135(homedir10(), ".cleo");
|
|
140291
140712
|
try {
|
|
140292
140713
|
const stopResult = await stopGCDaemon(cleoDir);
|
|
140293
140714
|
const result = {
|
|
@@ -140316,11 +140737,11 @@ function registerDaemonCommand(program) {
|
|
|
140316
140737
|
}
|
|
140317
140738
|
});
|
|
140318
140739
|
daemon.command("status").description("Show daemon running state, PID, last GC run, and disk usage").option("--cleo-dir <path>", "Override .cleo/ directory path").option("--json", "Output result as JSON").action(async (opts) => {
|
|
140319
|
-
const cleoDir = opts.cleoDir ??
|
|
140740
|
+
const cleoDir = opts.cleoDir ?? join135(homedir10(), ".cleo");
|
|
140320
140741
|
await showDaemonStatus(cleoDir, opts.json ?? false);
|
|
140321
140742
|
});
|
|
140322
140743
|
daemon.action(async (opts) => {
|
|
140323
|
-
const cleoDir = opts.cleoDir ??
|
|
140744
|
+
const cleoDir = opts.cleoDir ?? join135(homedir10(), ".cleo");
|
|
140324
140745
|
await showDaemonStatus(cleoDir, opts.json ?? false);
|
|
140325
140746
|
});
|
|
140326
140747
|
}
|
|
@@ -140510,12 +140931,12 @@ function registerDetectCommand(program) {
|
|
|
140510
140931
|
// packages/cleo/src/cli/commands/detect-drift.ts
|
|
140511
140932
|
init_src();
|
|
140512
140933
|
init_renderers();
|
|
140513
|
-
import { existsSync as
|
|
140514
|
-
import { dirname as dirname30, join as
|
|
140934
|
+
import { existsSync as existsSync134, readdirSync as readdirSync41, readFileSync as readFileSync105 } from "node:fs";
|
|
140935
|
+
import { dirname as dirname30, join as join136 } from "node:path";
|
|
140515
140936
|
function findProjectRoot() {
|
|
140516
140937
|
let currentDir = process.cwd();
|
|
140517
140938
|
while (currentDir !== "/") {
|
|
140518
|
-
if (
|
|
140939
|
+
if (existsSync134(join136(currentDir, "package.json"))) {
|
|
140519
140940
|
return currentDir;
|
|
140520
140941
|
}
|
|
140521
140942
|
const parent = dirname30(currentDir);
|
|
@@ -140527,11 +140948,11 @@ function findProjectRoot() {
|
|
|
140527
140948
|
function registerDetectDriftCommand(program) {
|
|
140528
140949
|
program.command("detect-drift").description("Detect documentation drift against TypeScript source of truth").action(async () => {
|
|
140529
140950
|
const projectRoot = findProjectRoot();
|
|
140530
|
-
const isCleoRepo =
|
|
140531
|
-
const cleoSrcRoot = isCleoRepo ?
|
|
140951
|
+
const isCleoRepo = existsSync134(join136(projectRoot, "packages", "cleo", "src"));
|
|
140952
|
+
const cleoSrcRoot = isCleoRepo ? join136(projectRoot, "packages", "cleo", "src") : join136(projectRoot, "src");
|
|
140532
140953
|
const safeRead = (filePath) => {
|
|
140533
140954
|
try {
|
|
140534
|
-
return
|
|
140955
|
+
return readFileSync105(filePath, "utf-8");
|
|
140535
140956
|
} catch {
|
|
140536
140957
|
return "";
|
|
140537
140958
|
}
|
|
@@ -140542,8 +140963,8 @@ function registerDetectDriftCommand(program) {
|
|
|
140542
140963
|
checks: [],
|
|
140543
140964
|
recommendations: []
|
|
140544
140965
|
};
|
|
140545
|
-
const injPath =
|
|
140546
|
-
if (
|
|
140966
|
+
const injPath = join136(projectRoot, ".cleo", "templates", "CLEO-INJECTION.md");
|
|
140967
|
+
if (existsSync134(injPath)) {
|
|
140547
140968
|
const content = safeRead(injPath);
|
|
140548
140969
|
userResult.checks.push({
|
|
140549
140970
|
name: "Agent injection",
|
|
@@ -140594,10 +141015,10 @@ function registerDetectDriftCommand(program) {
|
|
|
140594
141015
|
}
|
|
140595
141016
|
};
|
|
140596
141017
|
try {
|
|
140597
|
-
const specPath =
|
|
140598
|
-
const registryPath =
|
|
140599
|
-
const dispatchDomainsDir =
|
|
140600
|
-
if (!
|
|
141018
|
+
const specPath = join136(projectRoot, "docs", "specs", "CLEO-OPERATION-CONSTITUTION.md");
|
|
141019
|
+
const registryPath = join136(cleoSrcRoot, "dispatch", "registry.ts");
|
|
141020
|
+
const dispatchDomainsDir = join136(cleoSrcRoot, "dispatch", "domains");
|
|
141021
|
+
if (!existsSync134(specPath)) {
|
|
140601
141022
|
addCheck("Gateway-to-spec sync", "fail", "CLEO-OPERATION-CONSTITUTION.md missing", [
|
|
140602
141023
|
{
|
|
140603
141024
|
severity: "error",
|
|
@@ -140607,7 +141028,7 @@ function registerDetectDriftCommand(program) {
|
|
|
140607
141028
|
recommendation: "Create docs/specs/CLEO-OPERATION-CONSTITUTION.md with canonical operation definitions"
|
|
140608
141029
|
}
|
|
140609
141030
|
]);
|
|
140610
|
-
} else if (!
|
|
141031
|
+
} else if (!existsSync134(registryPath) || !existsSync134(dispatchDomainsDir)) {
|
|
140611
141032
|
addCheck("Gateway-to-spec sync", "fail", "Dispatch registry or domains missing", [
|
|
140612
141033
|
{
|
|
140613
141034
|
severity: "error",
|
|
@@ -140671,9 +141092,9 @@ function registerDetectDriftCommand(program) {
|
|
|
140671
141092
|
]);
|
|
140672
141093
|
}
|
|
140673
141094
|
try {
|
|
140674
|
-
const cliDir =
|
|
140675
|
-
const coreDir = isCleoRepo ?
|
|
140676
|
-
if (!
|
|
141095
|
+
const cliDir = join136(cleoSrcRoot, "cli", "commands");
|
|
141096
|
+
const coreDir = isCleoRepo ? join136(projectRoot, "packages", "core", "src") : join136(projectRoot, "src", "core");
|
|
141097
|
+
if (!existsSync134(cliDir)) {
|
|
140677
141098
|
addCheck("CLI-to-core sync", "fail", "CLI commands directory missing", [
|
|
140678
141099
|
{
|
|
140679
141100
|
severity: "error",
|
|
@@ -140682,7 +141103,7 @@ function registerDetectDriftCommand(program) {
|
|
|
140682
141103
|
recommendation: "Verify TypeScript source structure is intact"
|
|
140683
141104
|
}
|
|
140684
141105
|
]);
|
|
140685
|
-
} else if (!
|
|
141106
|
+
} else if (!existsSync134(coreDir)) {
|
|
140686
141107
|
addCheck("CLI-to-core sync", "fail", "Core directory missing", [
|
|
140687
141108
|
{
|
|
140688
141109
|
severity: "error",
|
|
@@ -140701,8 +141122,8 @@ function registerDetectDriftCommand(program) {
|
|
|
140701
141122
|
addCheck("CLI-to-core sync", "fail", `Error: ${getErrorMessage(e)}`);
|
|
140702
141123
|
}
|
|
140703
141124
|
try {
|
|
140704
|
-
const domainsDir =
|
|
140705
|
-
if (!
|
|
141125
|
+
const domainsDir = join136(cleoSrcRoot, "dispatch", "domains");
|
|
141126
|
+
if (!existsSync134(domainsDir)) {
|
|
140706
141127
|
addCheck("Domain handler coverage", "fail", "Dispatch domains directory missing", [
|
|
140707
141128
|
{
|
|
140708
141129
|
severity: "error",
|
|
@@ -140719,8 +141140,8 @@ function registerDetectDriftCommand(program) {
|
|
|
140719
141140
|
addCheck("Domain handler coverage", "fail", `Error: ${getErrorMessage(e)}`);
|
|
140720
141141
|
}
|
|
140721
141142
|
try {
|
|
140722
|
-
const matrixPath =
|
|
140723
|
-
if (!
|
|
141143
|
+
const matrixPath = join136(cleoSrcRoot, "dispatch", "lib", "capability-matrix.ts");
|
|
141144
|
+
if (!existsSync134(matrixPath)) {
|
|
140724
141145
|
addCheck("Capability matrix", "fail", "Capability matrix missing", [
|
|
140725
141146
|
{
|
|
140726
141147
|
severity: "error",
|
|
@@ -140736,8 +141157,8 @@ function registerDetectDriftCommand(program) {
|
|
|
140736
141157
|
addCheck("Capability matrix", "fail", `Error: ${getErrorMessage(e)}`);
|
|
140737
141158
|
}
|
|
140738
141159
|
try {
|
|
140739
|
-
const schemaPath =
|
|
140740
|
-
if (!
|
|
141160
|
+
const schemaPath = join136(projectRoot, "src", "store", "schema.ts");
|
|
141161
|
+
if (!existsSync134(schemaPath)) {
|
|
140741
141162
|
addCheck("Schema validation", "fail", "Schema definition missing", [
|
|
140742
141163
|
{
|
|
140743
141164
|
severity: "error",
|
|
@@ -140771,10 +141192,10 @@ function registerDetectDriftCommand(program) {
|
|
|
140771
141192
|
addCheck("Schema validation", "fail", `Error: ${getErrorMessage(e)}`);
|
|
140772
141193
|
}
|
|
140773
141194
|
try {
|
|
140774
|
-
const visionPath =
|
|
140775
|
-
const specPath =
|
|
141195
|
+
const visionPath = join136(projectRoot, "docs", "concepts", "CLEO-VISION.md");
|
|
141196
|
+
const specPath = join136(projectRoot, "docs", "specs", "CLEO-PORTABLE-PROJECT-BRAIN-SPEC.md");
|
|
140776
141197
|
const issues = [];
|
|
140777
|
-
if (!
|
|
141198
|
+
if (!existsSync134(visionPath)) {
|
|
140778
141199
|
issues.push({
|
|
140779
141200
|
severity: "error",
|
|
140780
141201
|
category: "vision",
|
|
@@ -140783,7 +141204,7 @@ function registerDetectDriftCommand(program) {
|
|
|
140783
141204
|
recommendation: "Create docs/concepts/CLEO-VISION.md with project vision"
|
|
140784
141205
|
});
|
|
140785
141206
|
}
|
|
140786
|
-
if (!
|
|
141207
|
+
if (!existsSync134(specPath)) {
|
|
140787
141208
|
issues.push({
|
|
140788
141209
|
severity: "error",
|
|
140789
141210
|
category: "spec",
|
|
@@ -140827,8 +141248,8 @@ function registerDetectDriftCommand(program) {
|
|
|
140827
141248
|
addCheck("Canonical identity", "fail", `Error: ${getErrorMessage(e)}`);
|
|
140828
141249
|
}
|
|
140829
141250
|
try {
|
|
140830
|
-
const injectionPath =
|
|
140831
|
-
if (!
|
|
141251
|
+
const injectionPath = join136(projectRoot, ".cleo", "templates", "CLEO-INJECTION.md");
|
|
141252
|
+
if (!existsSync134(injectionPath)) {
|
|
140832
141253
|
addCheck("Agent injection", "fail", "Agent injection template missing", [
|
|
140833
141254
|
{
|
|
140834
141255
|
severity: "error",
|
|
@@ -140857,8 +141278,8 @@ function registerDetectDriftCommand(program) {
|
|
|
140857
141278
|
addCheck("Agent injection", "fail", `Error: ${getErrorMessage(e)}`);
|
|
140858
141279
|
}
|
|
140859
141280
|
try {
|
|
140860
|
-
const exitCodesPath =
|
|
140861
|
-
if (!
|
|
141281
|
+
const exitCodesPath = join136(cleoSrcRoot, "dispatch", "lib", "exit-codes.ts");
|
|
141282
|
+
if (!existsSync134(exitCodesPath)) {
|
|
140862
141283
|
addCheck("Exit codes", "fail", "Exit codes definition missing", [
|
|
140863
141284
|
{
|
|
140864
141285
|
severity: "error",
|
|
@@ -140935,9 +141356,9 @@ function registerDiagnosticsCommand(program) {
|
|
|
140935
141356
|
init_internal();
|
|
140936
141357
|
init_renderers();
|
|
140937
141358
|
import { readdir as readdir5, readFile as readFile23 } from "node:fs/promises";
|
|
140938
|
-
import { join as
|
|
141359
|
+
import { join as join137 } from "node:path";
|
|
140939
141360
|
async function getScriptNames(projectRoot) {
|
|
140940
|
-
const scriptsDir =
|
|
141361
|
+
const scriptsDir = join137(projectRoot, "scripts");
|
|
140941
141362
|
try {
|
|
140942
141363
|
const files = await readdir5(scriptsDir);
|
|
140943
141364
|
return files.filter((f2) => f2.endsWith(".sh")).map((f2) => f2.replace(".sh", "")).sort();
|
|
@@ -140946,7 +141367,7 @@ async function getScriptNames(projectRoot) {
|
|
|
140946
141367
|
}
|
|
140947
141368
|
}
|
|
140948
141369
|
async function getIndexedCommands(projectRoot) {
|
|
140949
|
-
const indexPath =
|
|
141370
|
+
const indexPath = join137(projectRoot, "docs", "commands", "COMMANDS-INDEX.json");
|
|
140950
141371
|
const index2 = await readJson(indexPath);
|
|
140951
141372
|
if (!index2) return [];
|
|
140952
141373
|
return index2.commands.map((c) => c.name).sort();
|
|
@@ -140979,7 +141400,7 @@ async function runGapCheck(_projectRoot, filterId) {
|
|
|
140979
141400
|
const reviewFiles = files.filter((f2) => f2.endsWith(".md"));
|
|
140980
141401
|
for (const file2 of reviewFiles) {
|
|
140981
141402
|
if (filterId && !file2.includes(filterId)) continue;
|
|
140982
|
-
const filePath =
|
|
141403
|
+
const filePath = join137(reviewDir, file2);
|
|
140983
141404
|
const content = await readFile23(filePath, "utf-8");
|
|
140984
141405
|
const taskMatch = file2.match(/^(T\d+)/);
|
|
140985
141406
|
const taskId = taskMatch ? taskMatch[1] : "UNKNOWN";
|
|
@@ -141528,11 +141949,11 @@ function registerFindCommand(program) {
|
|
|
141528
141949
|
|
|
141529
141950
|
// packages/cleo/src/cli/commands/gc.ts
|
|
141530
141951
|
import { homedir as homedir11 } from "node:os";
|
|
141531
|
-
import { join as
|
|
141952
|
+
import { join as join138 } from "node:path";
|
|
141532
141953
|
function registerGCCommand(program) {
|
|
141533
141954
|
const gc = program.command("gc").description("Transcript garbage collection: manual trigger and status");
|
|
141534
141955
|
gc.command("run").description("Run GC immediately (blocking). Prunes old transcripts based on disk pressure.").option("--cleo-dir <path>", "Override .cleo/ directory path").option("--dry-run", "Report what would be pruned without deleting anything").option("--json", "Output result as JSON").action(async (opts) => {
|
|
141535
|
-
const cleoDir = opts.cleoDir ??
|
|
141956
|
+
const cleoDir = opts.cleoDir ?? join138(homedir11(), ".cleo");
|
|
141536
141957
|
const dryRun = opts.dryRun ?? false;
|
|
141537
141958
|
try {
|
|
141538
141959
|
const gcResult = await runGC({ cleoDir, dryRun });
|
|
@@ -141570,8 +141991,8 @@ WARNING: ${gcResult.escalationReason}
|
|
|
141570
141991
|
}
|
|
141571
141992
|
});
|
|
141572
141993
|
gc.command("status").description("Show last GC run stats, disk usage, and escalation state").option("--cleo-dir <path>", "Override .cleo/ directory path").option("--json", "Output result as JSON").action(async (opts) => {
|
|
141573
|
-
const cleoDir = opts.cleoDir ??
|
|
141574
|
-
const statePath =
|
|
141994
|
+
const cleoDir = opts.cleoDir ?? join138(homedir11(), ".cleo");
|
|
141995
|
+
const statePath = join138(cleoDir, "gc-state.json");
|
|
141575
141996
|
try {
|
|
141576
141997
|
const state = await readGCState(statePath);
|
|
141577
141998
|
const result = { success: true, data: state };
|
|
@@ -141624,12 +142045,12 @@ init_src();
|
|
|
141624
142045
|
init_src3();
|
|
141625
142046
|
init_renderers();
|
|
141626
142047
|
import { execFileSync as execFileSync16 } from "node:child_process";
|
|
141627
|
-
import { existsSync as
|
|
141628
|
-
import { dirname as dirname31, join as
|
|
142048
|
+
import { existsSync as existsSync135, mkdirSync as mkdirSync34, readFileSync as readFileSync106, writeFileSync as writeFileSync25 } from "node:fs";
|
|
142049
|
+
import { dirname as dirname31, join as join139 } from "node:path";
|
|
141629
142050
|
function getChangelogSource(cwd) {
|
|
141630
142051
|
const configPath = getConfigPath(cwd);
|
|
141631
142052
|
try {
|
|
141632
|
-
const config2 = JSON.parse(
|
|
142053
|
+
const config2 = JSON.parse(readFileSync106(configPath, "utf-8"));
|
|
141633
142054
|
return config2?.release?.changelog?.source ?? "CHANGELOG.md";
|
|
141634
142055
|
} catch {
|
|
141635
142056
|
return "CHANGELOG.md";
|
|
@@ -141638,7 +142059,7 @@ function getChangelogSource(cwd) {
|
|
|
141638
142059
|
function getEnabledPlatforms(cwd) {
|
|
141639
142060
|
const configPath = getConfigPath(cwd);
|
|
141640
142061
|
try {
|
|
141641
|
-
const config2 = JSON.parse(
|
|
142062
|
+
const config2 = JSON.parse(readFileSync106(configPath, "utf-8"));
|
|
141642
142063
|
const outputs = config2?.release?.changelog?.outputs ?? [];
|
|
141643
142064
|
return outputs.filter((o) => o.enabled);
|
|
141644
142065
|
} catch {
|
|
@@ -141763,11 +142184,11 @@ function registerGenerateChangelogCommand(program) {
|
|
|
141763
142184
|
const targetPlatform = opts["platform"];
|
|
141764
142185
|
const dryRun = !!opts["dryRun"];
|
|
141765
142186
|
const sourceFile = getChangelogSource();
|
|
141766
|
-
const sourcePath =
|
|
141767
|
-
if (!
|
|
142187
|
+
const sourcePath = join139(getProjectRoot(), sourceFile);
|
|
142188
|
+
if (!existsSync135(sourcePath)) {
|
|
141768
142189
|
throw new CleoError(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
|
|
141769
142190
|
}
|
|
141770
|
-
const sourceContent =
|
|
142191
|
+
const sourceContent = readFileSync106(sourcePath, "utf-8");
|
|
141771
142192
|
const repoSlug = getGitHubRepoSlug();
|
|
141772
142193
|
const results = [];
|
|
141773
142194
|
if (targetPlatform) {
|
|
@@ -141776,7 +142197,7 @@ function registerGenerateChangelogCommand(program) {
|
|
|
141776
142197
|
const outputPath = platformConfig?.path ?? getDefaultOutputPath(targetPlatform);
|
|
141777
142198
|
const content = generateForPlatform(targetPlatform, sourceContent, repoSlug, limit);
|
|
141778
142199
|
if (!dryRun) {
|
|
141779
|
-
const fullPath =
|
|
142200
|
+
const fullPath = join139(getProjectRoot(), outputPath);
|
|
141780
142201
|
mkdirSync34(dirname31(fullPath), { recursive: true });
|
|
141781
142202
|
writeFileSync25(fullPath, content, "utf-8");
|
|
141782
142203
|
}
|
|
@@ -141797,7 +142218,7 @@ function registerGenerateChangelogCommand(program) {
|
|
|
141797
142218
|
limit
|
|
141798
142219
|
);
|
|
141799
142220
|
if (!dryRun) {
|
|
141800
|
-
const fullPath =
|
|
142221
|
+
const fullPath = join139(getProjectRoot(), platformConfig.path);
|
|
141801
142222
|
mkdirSync34(dirname31(fullPath), { recursive: true });
|
|
141802
142223
|
writeFileSync25(fullPath, content, "utf-8");
|
|
141803
142224
|
}
|
|
@@ -142384,9 +142805,9 @@ init_internal();
|
|
|
142384
142805
|
init_cli();
|
|
142385
142806
|
init_renderers();
|
|
142386
142807
|
import { createHash as createHash20 } from "node:crypto";
|
|
142387
|
-
import { existsSync as
|
|
142808
|
+
import { existsSync as existsSync136, mkdirSync as mkdirSync35, readdirSync as readdirSync42, readFileSync as readFileSync107, writeFileSync as writeFileSync26 } from "node:fs";
|
|
142388
142809
|
import { homedir as homedir12 } from "node:os";
|
|
142389
|
-
import { join as
|
|
142810
|
+
import { join as join140 } from "node:path";
|
|
142390
142811
|
function parseMemoryFileFrontmatter(raw) {
|
|
142391
142812
|
const lines = raw.split("\n");
|
|
142392
142813
|
if (!lines[0]?.trim().startsWith("---")) {
|
|
@@ -142419,8 +142840,8 @@ ${body}`).digest("hex").slice(0, 16);
|
|
|
142419
142840
|
}
|
|
142420
142841
|
function loadImportHashes(stateFile) {
|
|
142421
142842
|
try {
|
|
142422
|
-
if (!
|
|
142423
|
-
const raw =
|
|
142843
|
+
if (!existsSync136(stateFile)) return /* @__PURE__ */ new Set();
|
|
142844
|
+
const raw = readFileSync107(stateFile, "utf-8");
|
|
142424
142845
|
const parsed = JSON.parse(raw);
|
|
142425
142846
|
return new Set(parsed.hashes);
|
|
142426
142847
|
} catch {
|
|
@@ -142429,7 +142850,7 @@ function loadImportHashes(stateFile) {
|
|
|
142429
142850
|
}
|
|
142430
142851
|
function saveImportHashes(stateFile, hashes) {
|
|
142431
142852
|
const dir = stateFile.slice(0, stateFile.lastIndexOf("/"));
|
|
142432
|
-
if (!
|
|
142853
|
+
if (!existsSync136(dir)) mkdirSync35(dir, { recursive: true });
|
|
142433
142854
|
writeFileSync26(stateFile, JSON.stringify({ hashes: [...hashes] }, null, 2), "utf-8");
|
|
142434
142855
|
}
|
|
142435
142856
|
function registerMemoryBrainCommand(program) {
|
|
@@ -143128,12 +143549,12 @@ Found ${totalDups} duplicate rows across ${groups.length} groups:`);
|
|
|
143128
143549
|
"--from <dir>",
|
|
143129
143550
|
"Source directory containing *.md memory files (default: ~/.claude/projects/-mnt-projects-cleocode/memory)"
|
|
143130
143551
|
).option("--dry-run", "Print what would be imported without writing to brain.db").option("--json", "Output results as JSON").action(async (opts) => {
|
|
143131
|
-
const sourceDir = opts.from ??
|
|
143552
|
+
const sourceDir = opts.from ?? join140(homedir12(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
|
|
143132
143553
|
const isDryRun = !!opts.dryRun;
|
|
143133
143554
|
const isJson = !!opts.json;
|
|
143134
143555
|
const projectRoot = getProjectRoot();
|
|
143135
|
-
const stateFile =
|
|
143136
|
-
if (!
|
|
143556
|
+
const stateFile = join140(projectRoot, ".cleo", "migrate-memory-hashes.json");
|
|
143557
|
+
if (!existsSync136(sourceDir)) {
|
|
143137
143558
|
const msg = `Source directory not found: ${sourceDir}`;
|
|
143138
143559
|
if (isJson) {
|
|
143139
143560
|
console.log(JSON.stringify({ success: false, error: msg }));
|
|
@@ -143142,7 +143563,7 @@ Found ${totalDups} duplicate rows across ${groups.length} groups:`);
|
|
|
143142
143563
|
}
|
|
143143
143564
|
process.exit(1);
|
|
143144
143565
|
}
|
|
143145
|
-
const files = readdirSync42(sourceDir).filter((f2) => f2.endsWith(".md") && f2 !== "MEMORY.md").map((f2) =>
|
|
143566
|
+
const files = readdirSync42(sourceDir).filter((f2) => f2.endsWith(".md") && f2 !== "MEMORY.md").map((f2) => join140(sourceDir, f2));
|
|
143146
143567
|
const importedHashes = isDryRun ? /* @__PURE__ */ new Set() : loadImportHashes(stateFile);
|
|
143147
143568
|
const stats2 = { total: files.length, imported: 0, skipped: 0, errors: 0 };
|
|
143148
143569
|
const importedEntries = [];
|
|
@@ -143157,7 +143578,7 @@ Found ${totalDups} duplicate rows across ${groups.length} groups:`);
|
|
|
143157
143578
|
for (const filePath of files) {
|
|
143158
143579
|
const fileName = filePath.split("/").pop() ?? filePath;
|
|
143159
143580
|
try {
|
|
143160
|
-
const raw =
|
|
143581
|
+
const raw = readFileSync107(filePath, "utf-8");
|
|
143161
143582
|
if (!raw.trim()) {
|
|
143162
143583
|
stats2.skipped++;
|
|
143163
143584
|
skippedEntries.push({ file: fileName, reason: "empty file" });
|
|
@@ -145097,11 +145518,11 @@ function registerNexusCommand(program) {
|
|
|
145097
145518
|
const rawRoots = typeof opts["roots"] === "string" && opts["roots"].trim().length > 0 ? opts["roots"].split(",").map((r) => r.trim()).filter((r) => r.length > 0).map(
|
|
145098
145519
|
(r) => r.startsWith("~") ? path10.join(home, r.slice(1)) : path10.resolve(r)
|
|
145099
145520
|
) : defaultRoots;
|
|
145100
|
-
const { existsSync:
|
|
145521
|
+
const { existsSync: existsSync137, readdirSync: readdirSync43, statSync: statSync22 } = await import("node:fs");
|
|
145101
145522
|
const { Dirent } = await import("node:fs");
|
|
145102
145523
|
const roots = rawRoots.filter((r) => {
|
|
145103
145524
|
try {
|
|
145104
|
-
return
|
|
145525
|
+
return existsSync137(r) && statSync22(r).isDirectory();
|
|
145105
145526
|
} catch {
|
|
145106
145527
|
return false;
|
|
145107
145528
|
}
|
|
@@ -147518,7 +147939,7 @@ init_src();
|
|
|
147518
147939
|
init_internal();
|
|
147519
147940
|
import { execFile as execFile8 } from "node:child_process";
|
|
147520
147941
|
import { readFile as readFile24 } from "node:fs/promises";
|
|
147521
|
-
import { join as
|
|
147942
|
+
import { join as join141 } from "node:path";
|
|
147522
147943
|
import * as readline2 from "node:readline";
|
|
147523
147944
|
import { promisify as promisify8 } from "node:util";
|
|
147524
147945
|
init_renderers();
|
|
@@ -147527,7 +147948,7 @@ var GITHUB_REPO = BUILD_CONFIG.repository.fullName;
|
|
|
147527
147948
|
async function getCurrentVersion() {
|
|
147528
147949
|
const cleoHome = getCleoHome();
|
|
147529
147950
|
try {
|
|
147530
|
-
const content = await readFile24(
|
|
147951
|
+
const content = await readFile24(join141(cleoHome, "VERSION"), "utf-8");
|
|
147531
147952
|
return (content.split("\n")[0] ?? "unknown").trim();
|
|
147532
147953
|
} catch {
|
|
147533
147954
|
return "unknown";
|
|
@@ -147581,7 +148002,7 @@ async function writeRuntimeVersionMetadata(mode, source, version2) {
|
|
|
147581
148002
|
];
|
|
147582
148003
|
await import("node:fs/promises").then(
|
|
147583
148004
|
({ writeFile: writeFile16, mkdir: mkdir22 }) => mkdir22(cleoHome, { recursive: true }).then(
|
|
147584
|
-
() => writeFile16(
|
|
148005
|
+
() => writeFile16(join141(cleoHome, "VERSION"), `${lines.join("\n")}
|
|
147585
148006
|
`, "utf-8")
|
|
147586
148007
|
)
|
|
147587
148008
|
);
|
|
@@ -148634,10 +149055,10 @@ function registerSyncCommand(program) {
|
|
|
148634
149055
|
"How to resolve conflicts: keep-cleo, keep-external, or newest (default: keep-cleo)",
|
|
148635
149056
|
"keep-cleo"
|
|
148636
149057
|
).action(async (file2, opts) => {
|
|
148637
|
-
const { readFileSync:
|
|
149058
|
+
const { readFileSync: readFileSync110 } = await import("node:fs");
|
|
148638
149059
|
let externalTasks;
|
|
148639
149060
|
try {
|
|
148640
|
-
externalTasks = JSON.parse(
|
|
149061
|
+
externalTasks = JSON.parse(readFileSync110(file2, "utf8"));
|
|
148641
149062
|
} catch (err) {
|
|
148642
149063
|
const message = err instanceof Error ? err.message : String(err);
|
|
148643
149064
|
console.error(`Failed to read or parse external tasks file: ${message}`);
|
|
@@ -148733,11 +149154,11 @@ function registerTestingCommand(program) {
|
|
|
148733
149154
|
init_internal();
|
|
148734
149155
|
init_cli();
|
|
148735
149156
|
init_renderers();
|
|
148736
|
-
import { readFileSync as
|
|
149157
|
+
import { readFileSync as readFileSync108 } from "node:fs";
|
|
148737
149158
|
function readPayload(opts, textKey, fileKey) {
|
|
148738
149159
|
const text3 = opts[textKey];
|
|
148739
149160
|
const file2 = opts[fileKey];
|
|
148740
|
-
if (file2) return
|
|
149161
|
+
if (file2) return readFileSync108(file2, "utf-8");
|
|
148741
149162
|
return text3;
|
|
148742
149163
|
}
|
|
148743
149164
|
function registerTokenCommand(program) {
|
|
@@ -148839,12 +149260,12 @@ function registerTokenCommand(program) {
|
|
|
148839
149260
|
// packages/cleo/src/cli/commands/transcript.ts
|
|
148840
149261
|
init_src3();
|
|
148841
149262
|
import { homedir as homedir14 } from "node:os";
|
|
148842
|
-
import { join as
|
|
149263
|
+
import { join as join143 } from "node:path";
|
|
148843
149264
|
|
|
148844
149265
|
// packages/cleo/src/gc/transcript.ts
|
|
148845
149266
|
import { lstat as lstat3, readdir as readdir6, stat as stat5 } from "node:fs/promises";
|
|
148846
149267
|
import { homedir as homedir13 } from "node:os";
|
|
148847
|
-
import { join as
|
|
149268
|
+
import { join as join142 } from "node:path";
|
|
148848
149269
|
var HOT_MAX_MS = 24 * 60 * 60 * 1e3;
|
|
148849
149270
|
var WARM_MAX_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
148850
149271
|
function classifyTranscriptTier(ageMs) {
|
|
@@ -148856,7 +149277,7 @@ function parseSessionId(filename) {
|
|
|
148856
149277
|
return filename.replace(/\.jsonl$/, "");
|
|
148857
149278
|
}
|
|
148858
149279
|
async function scanTranscripts(projectsDir) {
|
|
148859
|
-
const resolvedProjectsDir = projectsDir ??
|
|
149280
|
+
const resolvedProjectsDir = projectsDir ?? join142(homedir13(), ".claude", "projects");
|
|
148860
149281
|
const now2 = Date.now();
|
|
148861
149282
|
const hot = [];
|
|
148862
149283
|
const warm = [];
|
|
@@ -148869,7 +149290,7 @@ async function scanTranscripts(projectsDir) {
|
|
|
148869
149290
|
return { totalSessions: 0, hot, warm, totalBytes, projectsDir: resolvedProjectsDir };
|
|
148870
149291
|
}
|
|
148871
149292
|
for (const slug of slugs) {
|
|
148872
|
-
const slugDir =
|
|
149293
|
+
const slugDir = join142(resolvedProjectsDir, slug);
|
|
148873
149294
|
let entries;
|
|
148874
149295
|
try {
|
|
148875
149296
|
entries = await readdir6(slugDir, { withFileTypes: true });
|
|
@@ -148878,7 +149299,7 @@ async function scanTranscripts(projectsDir) {
|
|
|
148878
149299
|
}
|
|
148879
149300
|
for (const entry of entries) {
|
|
148880
149301
|
if (!entry.isFile() || !entry.name.endsWith(".jsonl")) continue;
|
|
148881
|
-
const jsonlPath =
|
|
149302
|
+
const jsonlPath = join142(slugDir, entry.name);
|
|
148882
149303
|
const sessionId = parseSessionId(entry.name);
|
|
148883
149304
|
let fileInfo;
|
|
148884
149305
|
try {
|
|
@@ -148890,7 +149311,7 @@ async function scanTranscripts(projectsDir) {
|
|
|
148890
149311
|
const ageMs = now2 - mtimeMs;
|
|
148891
149312
|
const tier = classifyTranscriptTier(ageMs);
|
|
148892
149313
|
const bytes = fileInfo.size;
|
|
148893
|
-
const candidateSessionDir =
|
|
149314
|
+
const candidateSessionDir = join142(slugDir, sessionId);
|
|
148894
149315
|
let sessionDir = null;
|
|
148895
149316
|
let sessionDirBytes = 0;
|
|
148896
149317
|
try {
|
|
@@ -148932,7 +149353,7 @@ async function pruneTranscripts(opts) {
|
|
|
148932
149353
|
const deletedPaths = [];
|
|
148933
149354
|
let bytesFreed = 0;
|
|
148934
149355
|
let pruned = 0;
|
|
148935
|
-
const resolvedProjectsDir = projectsDir ??
|
|
149356
|
+
const resolvedProjectsDir = projectsDir ?? join142(homedir13(), ".claude", "projects");
|
|
148936
149357
|
let slugs;
|
|
148937
149358
|
try {
|
|
148938
149359
|
const entries = await readdir6(resolvedProjectsDir, { withFileTypes: true });
|
|
@@ -148941,7 +149362,7 @@ async function pruneTranscripts(opts) {
|
|
|
148941
149362
|
return { pruned: 0, bytesFreed: 0, deletedPaths: [], dryRun };
|
|
148942
149363
|
}
|
|
148943
149364
|
for (const slug of slugs) {
|
|
148944
|
-
const slugDir =
|
|
149365
|
+
const slugDir = join142(resolvedProjectsDir, slug);
|
|
148945
149366
|
let entries;
|
|
148946
149367
|
try {
|
|
148947
149368
|
entries = await readdir6(slugDir, { withFileTypes: true });
|
|
@@ -148950,7 +149371,7 @@ async function pruneTranscripts(opts) {
|
|
|
148950
149371
|
}
|
|
148951
149372
|
for (const entry of entries) {
|
|
148952
149373
|
if (!entry.isFile() || !entry.name.endsWith(".jsonl")) continue;
|
|
148953
|
-
const jsonlPath =
|
|
149374
|
+
const jsonlPath = join142(slugDir, entry.name);
|
|
148954
149375
|
let fileInfo;
|
|
148955
149376
|
try {
|
|
148956
149377
|
fileInfo = await stat5(jsonlPath);
|
|
@@ -148960,7 +149381,7 @@ async function pruneTranscripts(opts) {
|
|
|
148960
149381
|
const ageMs = now2 - fileInfo.mtimeMs;
|
|
148961
149382
|
if (ageMs <= effectiveMaxAgeMs) continue;
|
|
148962
149383
|
const sessionId = parseSessionId(entry.name);
|
|
148963
|
-
const sessionDir =
|
|
149384
|
+
const sessionDir = join142(slugDir, sessionId);
|
|
148964
149385
|
const jsonlBytes = fileInfo.size;
|
|
148965
149386
|
let sessionDirBytes = 0;
|
|
148966
149387
|
try {
|
|
@@ -149049,7 +149470,7 @@ function registerTranscriptCommand(program) {
|
|
|
149049
149470
|
}
|
|
149050
149471
|
return;
|
|
149051
149472
|
}
|
|
149052
|
-
const projectsDir = opts.projectsDir ??
|
|
149473
|
+
const projectsDir = opts.projectsDir ?? join143(homedir14(), ".claude", "projects");
|
|
149053
149474
|
try {
|
|
149054
149475
|
const result = await scanTranscripts(projectsDir);
|
|
149055
149476
|
const envelope = {
|
|
@@ -149356,7 +149777,7 @@ Tier breakdown:
|
|
|
149356
149777
|
process.exit(2);
|
|
149357
149778
|
return;
|
|
149358
149779
|
}
|
|
149359
|
-
const projectsDir = opts.projectsDir ??
|
|
149780
|
+
const projectsDir = opts.projectsDir ?? join143(homedir14(), ".claude", "projects");
|
|
149360
149781
|
try {
|
|
149361
149782
|
const pruneResult = await pruneTranscripts({
|
|
149362
149783
|
olderThanMs,
|
|
@@ -149567,16 +149988,16 @@ init_src3();
|
|
|
149567
149988
|
init_renderers();
|
|
149568
149989
|
import { execFileSync as execFileSync18, spawn as spawn3 } from "node:child_process";
|
|
149569
149990
|
import { mkdir as mkdir21, open, readFile as readFile25, rm as rm4, stat as stat6, writeFile as writeFile15 } from "node:fs/promises";
|
|
149570
|
-
import { join as
|
|
149991
|
+
import { join as join144 } from "node:path";
|
|
149571
149992
|
var DEFAULT_PORT = 3456;
|
|
149572
149993
|
var DEFAULT_HOST = "127.0.0.1";
|
|
149573
149994
|
function getWebPaths() {
|
|
149574
149995
|
const cleoHome = getCleoHome();
|
|
149575
149996
|
return {
|
|
149576
|
-
pidFile:
|
|
149577
|
-
configFile:
|
|
149578
|
-
logDir:
|
|
149579
|
-
logFile:
|
|
149997
|
+
pidFile: join144(cleoHome, "web-server.pid"),
|
|
149998
|
+
configFile: join144(cleoHome, "web-server.json"),
|
|
149999
|
+
logDir: join144(cleoHome, "logs"),
|
|
150000
|
+
logFile: join144(cleoHome, "logs", "web-server.log")
|
|
149580
150001
|
};
|
|
149581
150002
|
}
|
|
149582
150003
|
function isProcessRunning(pid) {
|
|
@@ -149615,7 +150036,7 @@ async function startWebServer(port, host) {
|
|
|
149615
150036
|
throw new CleoError(1 /* GENERAL_ERROR */, `Server already running (PID: ${status.pid})`);
|
|
149616
150037
|
}
|
|
149617
150038
|
const projectRoot = process.env["CLEO_ROOT"] ?? process.cwd();
|
|
149618
|
-
const studioDir = process.env["CLEO_STUDIO_DIR"] ??
|
|
150039
|
+
const studioDir = process.env["CLEO_STUDIO_DIR"] ?? join144(projectRoot, "packages", "studio", "build");
|
|
149619
150040
|
await mkdir21(logDir, { recursive: true });
|
|
149620
150041
|
await writeFile15(
|
|
149621
150042
|
configFile,
|
|
@@ -149625,7 +150046,7 @@ async function startWebServer(port, host) {
|
|
|
149625
150046
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
149626
150047
|
})
|
|
149627
150048
|
);
|
|
149628
|
-
const webIndexPath =
|
|
150049
|
+
const webIndexPath = join144(studioDir, "index.js");
|
|
149629
150050
|
try {
|
|
149630
150051
|
await stat6(webIndexPath);
|
|
149631
150052
|
} catch {
|
|
@@ -149855,9 +150276,9 @@ var codeCommand = defineCommand({
|
|
|
149855
150276
|
async run({ args }) {
|
|
149856
150277
|
await requireTreeSitter();
|
|
149857
150278
|
const { smartOutline: smartOutline2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
149858
|
-
const { join:
|
|
150279
|
+
const { join: join146 } = await import("node:path");
|
|
149859
150280
|
const root = process.cwd();
|
|
149860
|
-
const absPath = args.file.startsWith("/") ? args.file :
|
|
150281
|
+
const absPath = args.file.startsWith("/") ? args.file : join146(root, args.file);
|
|
149861
150282
|
const result = smartOutline2(absPath, root);
|
|
149862
150283
|
if (result.errors.length > 0 && result.symbols.length === 0) {
|
|
149863
150284
|
console.error(`Error: ${result.errors.join(", ")}`);
|
|
@@ -149923,9 +150344,9 @@ var codeCommand = defineCommand({
|
|
|
149923
150344
|
async run({ args }) {
|
|
149924
150345
|
await requireTreeSitter();
|
|
149925
150346
|
const { smartUnfold: smartUnfold2 } = await Promise.resolve().then(() => (init_internal(), internal_exports));
|
|
149926
|
-
const { join:
|
|
150347
|
+
const { join: join146 } = await import("node:path");
|
|
149927
150348
|
const root = process.cwd();
|
|
149928
|
-
const absPath = args.file.startsWith("/") ? args.file :
|
|
150349
|
+
const absPath = args.file.startsWith("/") ? args.file : join146(root, args.file);
|
|
149929
150350
|
const result = smartUnfold2(absPath, args.symbol, root);
|
|
149930
150351
|
if (!result.found) {
|
|
149931
150352
|
console.error(`Symbol "${args.symbol}" not found in ${args.file}`);
|
|
@@ -149944,8 +150365,8 @@ var codeCommand = defineCommand({
|
|
|
149944
150365
|
|
|
149945
150366
|
// packages/cleo/src/cli/index.ts
|
|
149946
150367
|
function getPackageVersion() {
|
|
149947
|
-
const pkgPath =
|
|
149948
|
-
const pkg = JSON.parse(
|
|
150368
|
+
const pkgPath = join145(dirname32(fileURLToPath9(import.meta.url)), "../../package.json");
|
|
150369
|
+
const pkg = JSON.parse(readFileSync109(pkgPath, "utf-8"));
|
|
149949
150370
|
return pkg.version;
|
|
149950
150371
|
}
|
|
149951
150372
|
var CLI_VERSION = getPackageVersion();
|