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