@cleocode/cleo 2026.5.57 → 2026.5.58
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 +495 -277
- package/dist/cli/index.js.map +3 -3
- package/package.json +10 -10
package/dist/cli/index.js
CHANGED
|
@@ -24010,16 +24010,16 @@ async function orchestrateRejectOp(params) {
|
|
|
24010
24010
|
async function orchestrateClassify(request, context, projectRoot) {
|
|
24011
24011
|
try {
|
|
24012
24012
|
const { getCleoCantWorkflowsDir } = await import("@cleocode/core/internal");
|
|
24013
|
-
const { readFileSync: readFileSync16, readdirSync: readdirSync4, existsSync:
|
|
24014
|
-
const { join:
|
|
24013
|
+
const { readFileSync: readFileSync16, readdirSync: readdirSync4, existsSync: existsSync15 } = await import("node:fs");
|
|
24014
|
+
const { join: join25 } = await import("node:path");
|
|
24015
24015
|
const workflowsDir = getCleoCantWorkflowsDir();
|
|
24016
24016
|
const combined = `${request} ${context ?? ""}`.toLowerCase();
|
|
24017
24017
|
const matches = [];
|
|
24018
|
-
if (
|
|
24018
|
+
if (existsSync15(workflowsDir)) {
|
|
24019
24019
|
const files = readdirSync4(workflowsDir).filter((f) => f.endsWith(".cant"));
|
|
24020
24020
|
for (const file of files) {
|
|
24021
24021
|
try {
|
|
24022
|
-
const src = readFileSync16(
|
|
24022
|
+
const src = readFileSync16(join25(workflowsDir, file), "utf-8");
|
|
24023
24023
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
24024
24024
|
if (!teamMatch) continue;
|
|
24025
24025
|
const teamName = teamMatch[1];
|
|
@@ -24034,12 +24034,12 @@ async function orchestrateClassify(request, context, projectRoot) {
|
|
|
24034
24034
|
}
|
|
24035
24035
|
}
|
|
24036
24036
|
}
|
|
24037
|
-
const localCantDir =
|
|
24038
|
-
if (
|
|
24037
|
+
const localCantDir = join25(projectRoot, CLEO_DIR_NAME, WORKFLOWS_SUBDIR);
|
|
24038
|
+
if (existsSync15(localCantDir)) {
|
|
24039
24039
|
const files = readdirSync4(localCantDir).filter((f) => f.endsWith(".cant"));
|
|
24040
24040
|
for (const file of files) {
|
|
24041
24041
|
try {
|
|
24042
|
-
const src = readFileSync16(
|
|
24042
|
+
const src = readFileSync16(join25(localCantDir, file), "utf-8");
|
|
24043
24043
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
24044
24044
|
if (!teamMatch) continue;
|
|
24045
24045
|
const teamName = teamMatch[1];
|
|
@@ -29981,6 +29981,87 @@ var init_adr = __esm({
|
|
|
29981
29981
|
}
|
|
29982
29982
|
});
|
|
29983
29983
|
|
|
29984
|
+
// packages/cleo/src/cli/commands/agent-outputs.ts
|
|
29985
|
+
var agent_outputs_exports = {};
|
|
29986
|
+
__export(agent_outputs_exports, {
|
|
29987
|
+
agentOutputsCommand: () => agentOutputsCommand
|
|
29988
|
+
});
|
|
29989
|
+
import { searchDocs } from "@cleocode/core/internal";
|
|
29990
|
+
var findCommand2, agentOutputsCommand;
|
|
29991
|
+
var init_agent_outputs = __esm({
|
|
29992
|
+
"packages/cleo/src/cli/commands/agent-outputs.ts"() {
|
|
29993
|
+
"use strict";
|
|
29994
|
+
init_src2();
|
|
29995
|
+
init_dist();
|
|
29996
|
+
init_renderers();
|
|
29997
|
+
findCommand2 = defineCommand({
|
|
29998
|
+
meta: {
|
|
29999
|
+
name: "find",
|
|
30000
|
+
description: "Search agent output documents by query (routed via DocsAccessor.searchDocs)"
|
|
30001
|
+
},
|
|
30002
|
+
args: {
|
|
30003
|
+
query: {
|
|
30004
|
+
type: "positional",
|
|
30005
|
+
description: "Free-text search query to match against agent output documents",
|
|
30006
|
+
required: true
|
|
30007
|
+
},
|
|
30008
|
+
limit: {
|
|
30009
|
+
type: "string",
|
|
30010
|
+
description: "Maximum number of results to return (default: 10)",
|
|
30011
|
+
default: "10"
|
|
30012
|
+
},
|
|
30013
|
+
json: {
|
|
30014
|
+
type: "boolean",
|
|
30015
|
+
description: "Emit raw JSON envelope instead of human-readable table",
|
|
30016
|
+
default: false
|
|
30017
|
+
}
|
|
30018
|
+
},
|
|
30019
|
+
async run({ args }) {
|
|
30020
|
+
try {
|
|
30021
|
+
const limit = parseInt(String(args.limit), 10);
|
|
30022
|
+
const query = String(args.query);
|
|
30023
|
+
const result = await searchDocs(query, { limit: Number.isNaN(limit) ? 10 : limit });
|
|
30024
|
+
if (args.json) {
|
|
30025
|
+
cliOutput(result, {
|
|
30026
|
+
command: "agent-outputs find",
|
|
30027
|
+
operation: "docs.agent-outputs.find"
|
|
30028
|
+
});
|
|
30029
|
+
return;
|
|
30030
|
+
}
|
|
30031
|
+
if (result.hits.length === 0) {
|
|
30032
|
+
console.log(`No agent output documents found matching "${query}".`);
|
|
30033
|
+
return;
|
|
30034
|
+
}
|
|
30035
|
+
console.log(`Found ${result.hits.length} result(s) for "${query}":
|
|
30036
|
+
`);
|
|
30037
|
+
for (const hit of result.hits) {
|
|
30038
|
+
const score = typeof hit.score === "number" ? ` (score: ${hit.score.toFixed(3)})` : "";
|
|
30039
|
+
console.log(` ${hit.name ?? hit.id}${score}`);
|
|
30040
|
+
}
|
|
30041
|
+
} catch (err) {
|
|
30042
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
30043
|
+
cliError(`agent-outputs find failed: ${message}`, 1 /* GENERAL_ERROR */);
|
|
30044
|
+
}
|
|
30045
|
+
}
|
|
30046
|
+
});
|
|
30047
|
+
agentOutputsCommand = defineCommand({
|
|
30048
|
+
meta: {
|
|
30049
|
+
name: "agent-outputs",
|
|
30050
|
+
description: "Agent output document management \u2014 find/search via DocsAccessor (find subcommand)"
|
|
30051
|
+
},
|
|
30052
|
+
subCommands: {
|
|
30053
|
+
find: findCommand2
|
|
30054
|
+
},
|
|
30055
|
+
run({ rawArgs }) {
|
|
30056
|
+
const sub = rawArgs?.find((a) => !a.startsWith("-"));
|
|
30057
|
+
if (!sub) {
|
|
30058
|
+
showUsage(agentOutputsCommand);
|
|
30059
|
+
}
|
|
30060
|
+
}
|
|
30061
|
+
});
|
|
30062
|
+
}
|
|
30063
|
+
});
|
|
30064
|
+
|
|
29984
30065
|
// packages/cleo/src/cli/commands/agent-profile-status.ts
|
|
29985
30066
|
function computeProfileStatus(profile, validation) {
|
|
29986
30067
|
if (profile === null) return "none";
|
|
@@ -30000,7 +30081,6 @@ __export(agent_exports, {
|
|
|
30000
30081
|
agentCommand: () => agentCommand
|
|
30001
30082
|
});
|
|
30002
30083
|
import {
|
|
30003
|
-
applyPerfPragmas,
|
|
30004
30084
|
checkAgentHealth,
|
|
30005
30085
|
detectCrashedAgents,
|
|
30006
30086
|
detectStaleAgents,
|
|
@@ -30408,12 +30488,12 @@ var init_agent = __esm({
|
|
|
30408
30488
|
transportConfig: {},
|
|
30409
30489
|
isActive: true
|
|
30410
30490
|
});
|
|
30411
|
-
const { existsSync:
|
|
30412
|
-
const { join:
|
|
30413
|
-
const cantDir =
|
|
30414
|
-
const cantPath =
|
|
30491
|
+
const { existsSync: existsSync15, mkdirSync: mkdirSync6, writeFileSync: writeFileSync5 } = await import("node:fs");
|
|
30492
|
+
const { join: join25 } = await import("node:path");
|
|
30493
|
+
const cantDir = join25(CLEO_DIR_NAME, AGENTS_SUBDIR);
|
|
30494
|
+
const cantPath = join25(cantDir, `${agentId}.cant`);
|
|
30415
30495
|
let cantScaffolded = false;
|
|
30416
|
-
if (!
|
|
30496
|
+
if (!existsSync15(cantPath)) {
|
|
30417
30497
|
mkdirSync6(cantDir, { recursive: true });
|
|
30418
30498
|
const role = classification ?? "specialist";
|
|
30419
30499
|
const cantContent = `---
|
|
@@ -30473,7 +30553,7 @@ agent ${agentId}:
|
|
|
30473
30553
|
data: {
|
|
30474
30554
|
agentId: credential.agentId,
|
|
30475
30555
|
displayName: credential.displayName,
|
|
30476
|
-
cantFile: cantScaffolded ? cantPath :
|
|
30556
|
+
cantFile: cantScaffolded ? cantPath : existsSync15(cantPath) ? cantPath : null,
|
|
30477
30557
|
cantScaffolded
|
|
30478
30558
|
}
|
|
30479
30559
|
},
|
|
@@ -30592,8 +30672,8 @@ agent ${agentId}:
|
|
|
30592
30672
|
try {
|
|
30593
30673
|
const { AgentRegistryAccessor, getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
30594
30674
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
30595
|
-
const { existsSync:
|
|
30596
|
-
const { join:
|
|
30675
|
+
const { existsSync: existsSync15, readFileSync: readFileSync16 } = await import("node:fs");
|
|
30676
|
+
const { join: join25 } = await import("node:path");
|
|
30597
30677
|
await getDb3();
|
|
30598
30678
|
const registry = new AgentRegistryAccessor(process.cwd());
|
|
30599
30679
|
const credential = await registry.get(args.agentId);
|
|
@@ -30613,8 +30693,8 @@ agent ${agentId}:
|
|
|
30613
30693
|
}
|
|
30614
30694
|
let profile = null;
|
|
30615
30695
|
let cantValidation = null;
|
|
30616
|
-
const cantPath = args.cant ??
|
|
30617
|
-
if (
|
|
30696
|
+
const cantPath = args.cant ?? join25(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
30697
|
+
if (existsSync15(cantPath)) {
|
|
30618
30698
|
profile = readFileSync16(cantPath, "utf-8");
|
|
30619
30699
|
try {
|
|
30620
30700
|
const cantModule = await import("@cleocode/cant");
|
|
@@ -31138,8 +31218,8 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
31138
31218
|
try {
|
|
31139
31219
|
const { AgentRegistryAccessor, getDb: getDb3 } = await import("@cleocode/core/internal");
|
|
31140
31220
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
31141
|
-
const { existsSync:
|
|
31142
|
-
const { join:
|
|
31221
|
+
const { existsSync: existsSync15 } = await import("node:fs");
|
|
31222
|
+
const { join: join25 } = await import("node:path");
|
|
31143
31223
|
const { execFile: execFile2 } = await import("node:child_process");
|
|
31144
31224
|
const { promisify: promisify2 } = await import("node:util");
|
|
31145
31225
|
const execFileAsync = promisify2(execFile2);
|
|
@@ -31159,8 +31239,8 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
31159
31239
|
}
|
|
31160
31240
|
await registry.update(args.agentId, { isActive: true });
|
|
31161
31241
|
await registry.markUsed(args.agentId);
|
|
31162
|
-
const cantPath =
|
|
31163
|
-
const hasProfile =
|
|
31242
|
+
const cantPath = join25(CLEO_DIR_NAME, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
31243
|
+
const hasProfile = existsSync15(cantPath);
|
|
31164
31244
|
const runtime = await createRuntime(registry, {
|
|
31165
31245
|
agentId: args.agentId,
|
|
31166
31246
|
pollIntervalMs: 5e3,
|
|
@@ -32008,11 +32088,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32008
32088
|
async run({ args }) {
|
|
32009
32089
|
let tempDir = null;
|
|
32010
32090
|
try {
|
|
32011
|
-
const { existsSync:
|
|
32012
|
-
const { join:
|
|
32091
|
+
const { existsSync: existsSync15, mkdirSync: mkdirSync6, statSync, readdirSync: readdirSync4, copyFileSync } = await import("node:fs");
|
|
32092
|
+
const { join: join25, basename, resolve: resolve7, extname } = await import("node:path");
|
|
32013
32093
|
const { tmpdir: tmpdir2 } = await import("node:os");
|
|
32014
|
-
const resolvedPath =
|
|
32015
|
-
if (!
|
|
32094
|
+
const resolvedPath = resolve7(args.path);
|
|
32095
|
+
if (!existsSync15(resolvedPath)) {
|
|
32016
32096
|
cliOutput(
|
|
32017
32097
|
{
|
|
32018
32098
|
success: false,
|
|
@@ -32033,7 +32113,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32033
32113
|
cantPath = resolvedPath;
|
|
32034
32114
|
} else if (stat2.isFile() && ext === ".cantz") {
|
|
32035
32115
|
const { execFileSync: execFileSync5 } = await import("node:child_process");
|
|
32036
|
-
tempDir =
|
|
32116
|
+
tempDir = join25(tmpdir2(), `cleo-agent-install-${Date.now()}`);
|
|
32037
32117
|
mkdirSync6(tempDir, { recursive: true });
|
|
32038
32118
|
try {
|
|
32039
32119
|
execFileSync5("unzip", ["-o", "-q", resolvedPath, "-d", tempDir], {
|
|
@@ -32055,7 +32135,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32055
32135
|
return;
|
|
32056
32136
|
}
|
|
32057
32137
|
const topLevel = readdirSync4(tempDir).filter(
|
|
32058
|
-
(entry) => statSync(
|
|
32138
|
+
(entry) => statSync(join25(tempDir, entry)).isDirectory()
|
|
32059
32139
|
);
|
|
32060
32140
|
if (topLevel.length !== 1) {
|
|
32061
32141
|
cliOutput(
|
|
@@ -32072,8 +32152,8 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32072
32152
|
return;
|
|
32073
32153
|
}
|
|
32074
32154
|
const agentName = topLevel[0];
|
|
32075
|
-
const personaPath =
|
|
32076
|
-
if (!
|
|
32155
|
+
const personaPath = join25(tempDir, agentName, "persona.cant");
|
|
32156
|
+
if (!existsSync15(personaPath)) {
|
|
32077
32157
|
cliOutput(
|
|
32078
32158
|
{
|
|
32079
32159
|
success: false,
|
|
@@ -32087,12 +32167,12 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32087
32167
|
process.exitCode = 6;
|
|
32088
32168
|
return;
|
|
32089
32169
|
}
|
|
32090
|
-
cantPath =
|
|
32170
|
+
cantPath = join25(tempDir, `${agentName}.cant`);
|
|
32091
32171
|
copyFileSync(personaPath, cantPath);
|
|
32092
32172
|
} else if (stat2.isDirectory()) {
|
|
32093
32173
|
const agentName = basename(resolvedPath);
|
|
32094
|
-
const personaPath =
|
|
32095
|
-
if (!
|
|
32174
|
+
const personaPath = join25(resolvedPath, "persona.cant");
|
|
32175
|
+
if (!existsSync15(personaPath)) {
|
|
32096
32176
|
cliOutput(
|
|
32097
32177
|
{
|
|
32098
32178
|
success: false,
|
|
@@ -32106,9 +32186,9 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32106
32186
|
process.exitCode = 6;
|
|
32107
32187
|
return;
|
|
32108
32188
|
}
|
|
32109
|
-
tempDir =
|
|
32189
|
+
tempDir = join25(tmpdir2(), `cleo-agent-install-${Date.now()}`);
|
|
32110
32190
|
mkdirSync6(tempDir, { recursive: true });
|
|
32111
|
-
cantPath =
|
|
32191
|
+
cantPath = join25(tempDir, `${agentName}.cant`);
|
|
32112
32192
|
copyFileSync(personaPath, cantPath);
|
|
32113
32193
|
} else {
|
|
32114
32194
|
cliOutput(
|
|
@@ -32124,17 +32204,10 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32124
32204
|
process.exitCode = 6;
|
|
32125
32205
|
return;
|
|
32126
32206
|
}
|
|
32127
|
-
const {
|
|
32128
|
-
|
|
32129
|
-
|
|
32130
|
-
|
|
32131
|
-
attachAgentToProject
|
|
32132
|
-
} = await import("@cleocode/core/internal");
|
|
32133
|
-
const { DatabaseSync: DatabaseSync2 } = await import("node:sqlite");
|
|
32134
|
-
ensureGlobalSignaldockDb2();
|
|
32135
|
-
const dbPath = getGlobalSignaldockDbPath2();
|
|
32136
|
-
const db = new DatabaseSync2(dbPath);
|
|
32137
|
-
applyPerfPragmas(db);
|
|
32207
|
+
const { installAgentFromCant: installAgentFromCant2, attachAgentToProject } = await import("@cleocode/core/internal");
|
|
32208
|
+
const { openCleoDb: openCleoDb2 } = await import("@cleocode/core/store/open-cleo-db");
|
|
32209
|
+
const { db: _sdDb } = await openCleoDb2("signaldock");
|
|
32210
|
+
const db = _sdDb;
|
|
32138
32211
|
const isGlobal = args.global === true;
|
|
32139
32212
|
const targetTier = isGlobal ? "global" : "project";
|
|
32140
32213
|
const projectRoot = process.cwd();
|
|
@@ -32234,11 +32307,11 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32234
32307
|
},
|
|
32235
32308
|
async run({ args }) {
|
|
32236
32309
|
try {
|
|
32237
|
-
const { existsSync:
|
|
32238
|
-
const { resolve:
|
|
32310
|
+
const { existsSync: existsSync15, statSync } = await import("node:fs");
|
|
32311
|
+
const { resolve: resolve7, basename, dirname: dirname9 } = await import("node:path");
|
|
32239
32312
|
const { execFileSync: execFileSync5 } = await import("node:child_process");
|
|
32240
|
-
const resolvedDir =
|
|
32241
|
-
if (!
|
|
32313
|
+
const resolvedDir = resolve7(args.dir);
|
|
32314
|
+
if (!existsSync15(resolvedDir) || !statSync(resolvedDir).isDirectory()) {
|
|
32242
32315
|
cliOutput(
|
|
32243
32316
|
{
|
|
32244
32317
|
success: false,
|
|
@@ -32252,9 +32325,9 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32252
32325
|
process.exitCode = 4;
|
|
32253
32326
|
return;
|
|
32254
32327
|
}
|
|
32255
|
-
const { join:
|
|
32256
|
-
const personaPath =
|
|
32257
|
-
if (!
|
|
32328
|
+
const { join: join25 } = await import("node:path");
|
|
32329
|
+
const personaPath = join25(resolvedDir, "persona.cant");
|
|
32330
|
+
if (!existsSync15(personaPath)) {
|
|
32258
32331
|
cliOutput(
|
|
32259
32332
|
{
|
|
32260
32333
|
success: false,
|
|
@@ -32270,7 +32343,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32270
32343
|
}
|
|
32271
32344
|
const agentName = basename(resolvedDir);
|
|
32272
32345
|
const archiveName = `${agentName}.cantz`;
|
|
32273
|
-
const archivePath =
|
|
32346
|
+
const archivePath = resolve7(archiveName);
|
|
32274
32347
|
const parentDir = dirname9(resolvedDir);
|
|
32275
32348
|
try {
|
|
32276
32349
|
execFileSync5("zip", ["-r", archivePath, agentName], {
|
|
@@ -32301,7 +32374,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32301
32374
|
if (entry.isFile()) {
|
|
32302
32375
|
fileCount++;
|
|
32303
32376
|
} else if (entry.isDirectory()) {
|
|
32304
|
-
countFiles(
|
|
32377
|
+
countFiles(join25(dirPath, entry.name));
|
|
32305
32378
|
}
|
|
32306
32379
|
}
|
|
32307
32380
|
};
|
|
@@ -32370,8 +32443,8 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32370
32443
|
},
|
|
32371
32444
|
async run({ args }) {
|
|
32372
32445
|
try {
|
|
32373
|
-
const { existsSync:
|
|
32374
|
-
const { join:
|
|
32446
|
+
const { existsSync: existsSync15, mkdirSync: mkdirSync6, writeFileSync: writeFileSync5 } = await import("node:fs");
|
|
32447
|
+
const { join: join25 } = await import("node:path");
|
|
32375
32448
|
const { homedir: homedir7 } = await import("node:os");
|
|
32376
32449
|
const name = args.name;
|
|
32377
32450
|
const role = args.role;
|
|
@@ -32431,13 +32504,13 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32431
32504
|
let targetRoot;
|
|
32432
32505
|
if (isGlobal) {
|
|
32433
32506
|
const home = homedir7();
|
|
32434
|
-
const xdgData = process.env["XDG_DATA_HOME"] ??
|
|
32435
|
-
targetRoot =
|
|
32507
|
+
const xdgData = process.env["XDG_DATA_HOME"] ?? join25(home, ".local", "share");
|
|
32508
|
+
targetRoot = join25(xdgData, "cleo", "cant", "agents");
|
|
32436
32509
|
} else {
|
|
32437
|
-
targetRoot =
|
|
32510
|
+
targetRoot = join25(process.cwd(), CLEO_DIR_NAME, CANT_AGENTS_SUBDIR);
|
|
32438
32511
|
}
|
|
32439
|
-
const agentDir =
|
|
32440
|
-
if (
|
|
32512
|
+
const agentDir = join25(targetRoot, name);
|
|
32513
|
+
if (existsSync15(agentDir)) {
|
|
32441
32514
|
cliOutput(
|
|
32442
32515
|
{
|
|
32443
32516
|
success: false,
|
|
@@ -32461,29 +32534,29 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32461
32534
|
domain,
|
|
32462
32535
|
parent
|
|
32463
32536
|
});
|
|
32464
|
-
writeFileSync5(
|
|
32537
|
+
writeFileSync5(join25(agentDir, "persona.cant"), personaContent, "utf-8");
|
|
32465
32538
|
const manifest = generateManifest({ name, role, tier, domain });
|
|
32466
32539
|
writeFileSync5(
|
|
32467
|
-
|
|
32540
|
+
join25(agentDir, "manifest.json"),
|
|
32468
32541
|
`${JSON.stringify(manifest, null, 2)}
|
|
32469
32542
|
`,
|
|
32470
32543
|
"utf-8"
|
|
32471
32544
|
);
|
|
32472
32545
|
const createdFiles = [
|
|
32473
|
-
|
|
32474
|
-
|
|
32546
|
+
join25(agentDir, "persona.cant"),
|
|
32547
|
+
join25(agentDir, "manifest.json")
|
|
32475
32548
|
];
|
|
32476
32549
|
if (team) {
|
|
32477
32550
|
const teamConfigContent = generateTeamConfig(name, role, team);
|
|
32478
|
-
writeFileSync5(
|
|
32479
|
-
createdFiles.push(
|
|
32551
|
+
writeFileSync5(join25(agentDir, "team-config.cant"), teamConfigContent, "utf-8");
|
|
32552
|
+
createdFiles.push(join25(agentDir, "team-config.cant"));
|
|
32480
32553
|
}
|
|
32481
32554
|
if (seedBrain) {
|
|
32482
|
-
const expertiseDir =
|
|
32555
|
+
const expertiseDir = join25(agentDir, "expertise");
|
|
32483
32556
|
mkdirSync6(expertiseDir, { recursive: true });
|
|
32484
32557
|
const seedContent = generateMentalModelSeed(name, role, domain);
|
|
32485
|
-
writeFileSync5(
|
|
32486
|
-
createdFiles.push(
|
|
32558
|
+
writeFileSync5(join25(expertiseDir, "mental-model-seed.md"), seedContent, "utf-8");
|
|
32559
|
+
createdFiles.push(join25(expertiseDir, "mental-model-seed.md"));
|
|
32487
32560
|
try {
|
|
32488
32561
|
const { execFile: execFile2 } = await import("node:child_process");
|
|
32489
32562
|
const { promisify: promisify2 } = await import("node:util");
|
|
@@ -32581,10 +32654,10 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32581
32654
|
},
|
|
32582
32655
|
async run({ args }) {
|
|
32583
32656
|
try {
|
|
32584
|
-
const { existsSync:
|
|
32585
|
-
const { resolve:
|
|
32586
|
-
const specPath =
|
|
32587
|
-
if (!
|
|
32657
|
+
const { existsSync: existsSync15, readFileSync: readFileSync16, mkdirSync: mkdirSync6 } = await import("node:fs");
|
|
32658
|
+
const { resolve: resolve7, join: join25 } = await import("node:path");
|
|
32659
|
+
const specPath = resolve7(args.spec);
|
|
32660
|
+
if (!existsSync15(specPath)) {
|
|
32588
32661
|
if (args.json) {
|
|
32589
32662
|
const errEnv = {
|
|
32590
32663
|
success: false,
|
|
@@ -32600,7 +32673,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32600
32673
|
}
|
|
32601
32674
|
const specContent = readFileSync16(specPath, "utf-8");
|
|
32602
32675
|
const projectRoot = process.cwd();
|
|
32603
|
-
const outputDir = args["output-dir"] ?
|
|
32676
|
+
const outputDir = args["output-dir"] ? resolve7(args["output-dir"]) : join25(projectRoot, ".cleo", "cant", "agents");
|
|
32604
32677
|
mkdirSync6(outputDir, { recursive: true });
|
|
32605
32678
|
if (args["dry-run"]) {
|
|
32606
32679
|
const preview = {
|
|
@@ -32679,19 +32752,10 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32679
32752
|
},
|
|
32680
32753
|
async run({ args }) {
|
|
32681
32754
|
try {
|
|
32682
|
-
const {
|
|
32683
|
-
|
|
32684
|
-
|
|
32685
|
-
|
|
32686
|
-
getGlobalSignaldockDbPath: getGlobalSignaldockDbPath2
|
|
32687
|
-
} = await import("@cleocode/core/internal");
|
|
32688
|
-
const { createRequire: createRequire2 } = await import("node:module");
|
|
32689
|
-
const { DatabaseSync: DatabaseSync2 } = createRequire2(import.meta.url)(
|
|
32690
|
-
"node:sqlite"
|
|
32691
|
-
);
|
|
32692
|
-
await ensureGlobalSignaldockDb2();
|
|
32693
|
-
const db = new DatabaseSync2(getGlobalSignaldockDbPath2());
|
|
32694
|
-
applyPerfPragmas(db);
|
|
32755
|
+
const { buildDoctorReport, reconcileDoctor } = await import("@cleocode/core/internal");
|
|
32756
|
+
const { openCleoDb: openCleoDb2 } = await import("@cleocode/core/store/open-cleo-db");
|
|
32757
|
+
const { db: _sdDb2 } = await openCleoDb2("signaldock");
|
|
32758
|
+
const db = _sdDb2;
|
|
32695
32759
|
try {
|
|
32696
32760
|
const report = await buildDoctorReport(db, {});
|
|
32697
32761
|
const d002 = report.findings.filter((f) => f.code === "D-002");
|
|
@@ -32754,21 +32818,10 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
32754
32818
|
},
|
|
32755
32819
|
async run({ args }) {
|
|
32756
32820
|
try {
|
|
32757
|
-
const {
|
|
32758
|
-
|
|
32759
|
-
|
|
32760
|
-
|
|
32761
|
-
getGlobalSignaldockDbPath: getGlobalSignaldockDbPath2
|
|
32762
|
-
} = await import("@cleocode/core/internal");
|
|
32763
|
-
const { createRequire: createRequire2 } = await import("node:module");
|
|
32764
|
-
const nodeSqlite = createRequire2(import.meta.url)(
|
|
32765
|
-
"node:sqlite"
|
|
32766
|
-
);
|
|
32767
|
-
const { DatabaseSync: DatabaseSync2 } = nodeSqlite;
|
|
32768
|
-
await ensureGlobalSignaldockDb2();
|
|
32769
|
-
const dbPath = getGlobalSignaldockDbPath2();
|
|
32770
|
-
const db = new DatabaseSync2(dbPath);
|
|
32771
|
-
applyPerfPragmas(db);
|
|
32821
|
+
const { buildDoctorReport, reconcileDoctor } = await import("@cleocode/core/internal");
|
|
32822
|
+
const { openCleoDb: openCleoDb2 } = await import("@cleocode/core/store/open-cleo-db");
|
|
32823
|
+
const { db: _sdDb3 } = await openCleoDb2("signaldock");
|
|
32824
|
+
const db = _sdDb3;
|
|
32772
32825
|
try {
|
|
32773
32826
|
const report = await buildDoctorReport(db, { projectRoot: process.cwd() });
|
|
32774
32827
|
const repairFlag = args.repair === true;
|
|
@@ -33038,8 +33091,24 @@ var audit_exports = {};
|
|
|
33038
33091
|
__export(audit_exports, {
|
|
33039
33092
|
auditCommand: () => auditCommand
|
|
33040
33093
|
});
|
|
33094
|
+
import { spawnSync } from "node:child_process";
|
|
33095
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
33096
|
+
import { join as join7, resolve as resolve3 } from "node:path";
|
|
33041
33097
|
import { getProjectRoot as getProjectRoot19, reconstructLineage } from "@cleocode/core/internal";
|
|
33042
|
-
|
|
33098
|
+
function resolveVerifierScript(taskId, projectRoot) {
|
|
33099
|
+
const id = taskId.toLowerCase();
|
|
33100
|
+
const candidates = [
|
|
33101
|
+
join7(projectRoot, "scripts", `verify-${taskId}-fu.mjs`),
|
|
33102
|
+
join7(projectRoot, "scripts", `verify-${taskId}.mjs`),
|
|
33103
|
+
join7(projectRoot, "scripts", `verify-${id}-fu.mjs`),
|
|
33104
|
+
join7(projectRoot, "scripts", `verify-${id}.mjs`)
|
|
33105
|
+
];
|
|
33106
|
+
for (const candidate of candidates) {
|
|
33107
|
+
if (existsSync6(candidate)) return candidate;
|
|
33108
|
+
}
|
|
33109
|
+
return null;
|
|
33110
|
+
}
|
|
33111
|
+
var reconstructCommand, verifierCommand, auditCommand;
|
|
33043
33112
|
var init_audit2 = __esm({
|
|
33044
33113
|
"packages/cleo/src/cli/commands/audit.ts"() {
|
|
33045
33114
|
"use strict";
|
|
@@ -33095,13 +33164,87 @@ var init_audit2 = __esm({
|
|
|
33095
33164
|
});
|
|
33096
33165
|
}
|
|
33097
33166
|
});
|
|
33167
|
+
verifierCommand = defineCommand({
|
|
33168
|
+
meta: {
|
|
33169
|
+
name: "verifier",
|
|
33170
|
+
description: "Independent acceptance verifier re-run (ADR-070 auditor-loop). Resolves scripts/verify-<taskId>-fu.mjs and runs it independently. Does NOT trust prior Implementer claims. Exits non-zero if verifier fails."
|
|
33171
|
+
},
|
|
33172
|
+
args: {
|
|
33173
|
+
taskId: {
|
|
33174
|
+
type: "positional",
|
|
33175
|
+
description: "Task ID whose acceptance verifier script to run independently (e.g. T9188)",
|
|
33176
|
+
required: true
|
|
33177
|
+
},
|
|
33178
|
+
script: {
|
|
33179
|
+
type: "string",
|
|
33180
|
+
description: "Explicit path to the verifier script (overrides auto-resolution)"
|
|
33181
|
+
}
|
|
33182
|
+
},
|
|
33183
|
+
async run({ args }) {
|
|
33184
|
+
const taskId = String(args.taskId);
|
|
33185
|
+
let projectRoot;
|
|
33186
|
+
try {
|
|
33187
|
+
projectRoot = getProjectRoot19(process.cwd()) ?? resolve3(process.cwd());
|
|
33188
|
+
} catch {
|
|
33189
|
+
projectRoot = resolve3(process.cwd());
|
|
33190
|
+
}
|
|
33191
|
+
let verifierPath;
|
|
33192
|
+
if (args.script) {
|
|
33193
|
+
const explicit = resolve3(projectRoot, String(args.script));
|
|
33194
|
+
verifierPath = existsSync6(explicit) ? explicit : null;
|
|
33195
|
+
if (!verifierPath) {
|
|
33196
|
+
cliError(`Verifier script not found: ${explicit}`, 1, { name: "E_NOT_FOUND" });
|
|
33197
|
+
process.exitCode = 1;
|
|
33198
|
+
return;
|
|
33199
|
+
}
|
|
33200
|
+
} else {
|
|
33201
|
+
verifierPath = resolveVerifierScript(taskId, projectRoot);
|
|
33202
|
+
}
|
|
33203
|
+
if (!verifierPath) {
|
|
33204
|
+
cliError(
|
|
33205
|
+
`No verifier script found for ${taskId}.
|
|
33206
|
+
Looked for: scripts/verify-${taskId}-fu.mjs, scripts/verify-${taskId}.mjs
|
|
33207
|
+
Create the verifier script per ADR-070 before running the auditor.`,
|
|
33208
|
+
1,
|
|
33209
|
+
{ name: "E_NOT_FOUND" }
|
|
33210
|
+
);
|
|
33211
|
+
process.exitCode = 1;
|
|
33212
|
+
return;
|
|
33213
|
+
}
|
|
33214
|
+
process.stdout.write(`[AUDITOR] Independent verifier run for ${taskId}
|
|
33215
|
+
`);
|
|
33216
|
+
process.stdout.write(`[AUDITOR] Script: ${verifierPath}
|
|
33217
|
+
`);
|
|
33218
|
+
process.stdout.write(`[AUDITOR] Note: Does NOT trust any prior Implementer claims.
|
|
33219
|
+
|
|
33220
|
+
`);
|
|
33221
|
+
const result = spawnSync("node", [verifierPath], { encoding: "utf8", stdio: "inherit" });
|
|
33222
|
+
const exitCode = result.status ?? 1;
|
|
33223
|
+
if (exitCode === 0) {
|
|
33224
|
+
process.stdout.write(
|
|
33225
|
+
`
|
|
33226
|
+
[AUDITOR] Audit pass. Verifier exit-code 0. Task ${taskId} acceptance verified.
|
|
33227
|
+
`
|
|
33228
|
+
);
|
|
33229
|
+
} else {
|
|
33230
|
+
process.stderr.write(
|
|
33231
|
+
`
|
|
33232
|
+
[AUDITOR] Audit fail. Verifier exit-code ${exitCode}. Task ${taskId} NOT verified.
|
|
33233
|
+
E_ACCEPTANCE_VERIFIER_FAILED. Implementation must be re-worked. (ADR-070)
|
|
33234
|
+
`
|
|
33235
|
+
);
|
|
33236
|
+
process.exitCode = exitCode;
|
|
33237
|
+
}
|
|
33238
|
+
}
|
|
33239
|
+
});
|
|
33098
33240
|
auditCommand = defineCommand({
|
|
33099
33241
|
meta: {
|
|
33100
33242
|
name: "audit",
|
|
33101
|
-
description: "Git-backed audit tooling (lineage reconstruction, integrity checks)"
|
|
33243
|
+
description: "Git-backed audit tooling (lineage reconstruction, integrity checks). Also provides independent acceptance verifier re-runs for the ADR-070 auditor-loop pattern (verifier subcommand \u2014 does not trust Implementer claims, runs script independently)."
|
|
33102
33244
|
},
|
|
33103
33245
|
subCommands: {
|
|
33104
|
-
reconstruct: reconstructCommand
|
|
33246
|
+
reconstruct: reconstructCommand,
|
|
33247
|
+
verifier: verifierCommand
|
|
33105
33248
|
},
|
|
33106
33249
|
async run({ args: _args }) {
|
|
33107
33250
|
await showUsage(auditCommand);
|
|
@@ -33528,12 +33671,12 @@ async function promptPassphrase() {
|
|
|
33528
33671
|
"Cannot prompt for passphrase: stdin is not a TTY. Set the CLEO_BACKUP_PASSPHRASE environment variable for non-interactive use."
|
|
33529
33672
|
);
|
|
33530
33673
|
}
|
|
33531
|
-
return new Promise((
|
|
33674
|
+
return new Promise((resolve7) => {
|
|
33532
33675
|
process.stdout.write("Passphrase: ");
|
|
33533
33676
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
33534
33677
|
rl.question("", (answer) => {
|
|
33535
33678
|
rl.close();
|
|
33536
|
-
|
|
33679
|
+
resolve7(answer.trim());
|
|
33537
33680
|
});
|
|
33538
33681
|
});
|
|
33539
33682
|
}
|
|
@@ -34512,7 +34655,7 @@ __export(caamp_exports, {
|
|
|
34512
34655
|
caampCommand: () => caampCommand
|
|
34513
34656
|
});
|
|
34514
34657
|
import { homedir as homedir2 } from "node:os";
|
|
34515
|
-
import { join as
|
|
34658
|
+
import { join as join8 } from "node:path";
|
|
34516
34659
|
var dedupeCommand, caampCommand;
|
|
34517
34660
|
var init_caamp = __esm({
|
|
34518
34661
|
"packages/cleo/src/cli/commands/caamp.ts"() {
|
|
@@ -34549,18 +34692,18 @@ var init_caamp = __esm({
|
|
|
34549
34692
|
} else {
|
|
34550
34693
|
const home = homedir2();
|
|
34551
34694
|
filePaths = [
|
|
34552
|
-
|
|
34695
|
+
join8(home, ".agents", "AGENTS.md"),
|
|
34553
34696
|
// project-level AGENTS.md in cwd
|
|
34554
|
-
|
|
34697
|
+
join8(process.cwd(), "AGENTS.md")
|
|
34555
34698
|
];
|
|
34556
34699
|
}
|
|
34557
34700
|
if (args["dry-run"]) {
|
|
34558
34701
|
const { parseCaampBlocks } = await import("@cleocode/caamp");
|
|
34559
|
-
const { existsSync:
|
|
34702
|
+
const { existsSync: existsSync15 } = await import("node:fs");
|
|
34560
34703
|
const { readFile: readFile6 } = await import("node:fs/promises");
|
|
34561
34704
|
const dryResults = [];
|
|
34562
34705
|
for (const filePath of filePaths) {
|
|
34563
|
-
if (!
|
|
34706
|
+
if (!existsSync15(filePath)) {
|
|
34564
34707
|
dryResults.push({ filePath, exists: false, blockCount: 0, wouldRemove: 0 });
|
|
34565
34708
|
continue;
|
|
34566
34709
|
}
|
|
@@ -34694,13 +34837,13 @@ var cant_exports = {};
|
|
|
34694
34837
|
__export(cant_exports, {
|
|
34695
34838
|
cantCommand: () => cantCommand
|
|
34696
34839
|
});
|
|
34697
|
-
import { existsSync as
|
|
34698
|
-
import { dirname as dirname4, isAbsolute, join as
|
|
34840
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync2, readFileSync as readFileSync7, writeFileSync as writeFileSync2 } from "node:fs";
|
|
34841
|
+
import { dirname as dirname4, isAbsolute, join as join9, resolve as resolve4 } from "node:path";
|
|
34699
34842
|
function resolveFilePath(file) {
|
|
34700
|
-
return isAbsolute(file) ? file :
|
|
34843
|
+
return isAbsolute(file) ? file : resolve4(process.cwd(), file);
|
|
34701
34844
|
}
|
|
34702
34845
|
function ensureExists(filePath, operation) {
|
|
34703
|
-
if (
|
|
34846
|
+
if (existsSync7(filePath)) return true;
|
|
34704
34847
|
cliError(`File not found: ${filePath}`, "E_FILE_READ");
|
|
34705
34848
|
process.exitCode = 3;
|
|
34706
34849
|
if (process.env["CLEO_DEBUG"]) humanWarn(`(operation: ${operation})`);
|
|
@@ -34860,7 +35003,7 @@ var init_cant = __esm({
|
|
|
34860
35003
|
const projectRoot = process.cwd();
|
|
34861
35004
|
let written = 0;
|
|
34862
35005
|
for (const outputFile of result.outputFiles) {
|
|
34863
|
-
const outputPath = isAbsolute(outputFile.path) ? outputFile.path :
|
|
35006
|
+
const outputPath = isAbsolute(outputFile.path) ? outputFile.path : join9(projectRoot, outputFile.path);
|
|
34864
35007
|
mkdirSync2(dirname4(outputPath), { recursive: true });
|
|
34865
35008
|
writeFileSync2(outputPath, outputFile.content, "utf-8");
|
|
34866
35009
|
written++;
|
|
@@ -35534,9 +35677,9 @@ var init_code = __esm({
|
|
|
35534
35677
|
async run({ args }) {
|
|
35535
35678
|
await requireTreeSitter();
|
|
35536
35679
|
const { smartOutline } = await import("@cleocode/core/internal");
|
|
35537
|
-
const { join:
|
|
35680
|
+
const { join: join25 } = await import("node:path");
|
|
35538
35681
|
const root = process.cwd();
|
|
35539
|
-
const absPath = args.file.startsWith("/") ? args.file :
|
|
35682
|
+
const absPath = args.file.startsWith("/") ? args.file : join25(root, args.file);
|
|
35540
35683
|
const result = smartOutline(absPath, root);
|
|
35541
35684
|
if (result.errors.length > 0 && result.symbols.length === 0) {
|
|
35542
35685
|
cliError(result.errors.join(", "), 1, { name: "E_OUTLINE_FAILED" });
|
|
@@ -35627,9 +35770,9 @@ var init_code = __esm({
|
|
|
35627
35770
|
async run({ args }) {
|
|
35628
35771
|
await requireTreeSitter();
|
|
35629
35772
|
const { smartUnfold } = await import("@cleocode/core/internal");
|
|
35630
|
-
const { join:
|
|
35773
|
+
const { join: join25 } = await import("node:path");
|
|
35631
35774
|
const root = process.cwd();
|
|
35632
|
-
const absPath = args.file.startsWith("/") ? args.file :
|
|
35775
|
+
const absPath = args.file.startsWith("/") ? args.file : join25(root, args.file);
|
|
35633
35776
|
const result = smartUnfold(absPath, args.symbol, root);
|
|
35634
35777
|
if (!result.found) {
|
|
35635
35778
|
const errs = result.errors.length > 0 ? `: ${result.errors.join(", ")}` : "";
|
|
@@ -36771,9 +36914,9 @@ var daemon_exports = {};
|
|
|
36771
36914
|
__export(daemon_exports, {
|
|
36772
36915
|
daemonCommand: () => daemonCommand
|
|
36773
36916
|
});
|
|
36774
|
-
import { existsSync as
|
|
36917
|
+
import { existsSync as existsSync8 } from "node:fs";
|
|
36775
36918
|
import { homedir as homedir3 } from "node:os";
|
|
36776
|
-
import { join as
|
|
36919
|
+
import { join as join10 } from "node:path";
|
|
36777
36920
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
36778
36921
|
import { getGCDaemonStatus, spawnGCDaemon, stopGCDaemon } from "@cleocode/core/gc/daemon.js";
|
|
36779
36922
|
import {
|
|
@@ -36838,9 +36981,9 @@ async function showDaemonStatus(cleoDir, projectRoot) {
|
|
|
36838
36981
|
}
|
|
36839
36982
|
function resolveDaemonInstallerScript() {
|
|
36840
36983
|
const filePath = fileURLToPath3(import.meta.url);
|
|
36841
|
-
const candidate1 =
|
|
36842
|
-
if (
|
|
36843
|
-
const candidate2 =
|
|
36984
|
+
const candidate1 = join10(filePath, "..", "..", "..", "scripts", "install-daemon-service.mjs");
|
|
36985
|
+
if (existsSync8(candidate1)) return candidate1;
|
|
36986
|
+
const candidate2 = join10(
|
|
36844
36987
|
filePath,
|
|
36845
36988
|
"..",
|
|
36846
36989
|
"..",
|
|
@@ -36875,7 +37018,7 @@ var init_daemon = __esm({
|
|
|
36875
37018
|
}
|
|
36876
37019
|
},
|
|
36877
37020
|
async run({ args }) {
|
|
36878
|
-
const cleoDir = args["cleo-dir"] ??
|
|
37021
|
+
const cleoDir = args["cleo-dir"] ?? join10(homedir3(), ".cleo");
|
|
36879
37022
|
const foreground = args.foreground ?? false;
|
|
36880
37023
|
if (foreground) {
|
|
36881
37024
|
const projectRoot = process.cwd();
|
|
@@ -36912,13 +37055,13 @@ var init_daemon = __esm({
|
|
|
36912
37055
|
{
|
|
36913
37056
|
pid,
|
|
36914
37057
|
cleoDir,
|
|
36915
|
-
logs:
|
|
37058
|
+
logs: join10(cleoDir, "logs", "gc.log"),
|
|
36916
37059
|
message: `GC daemon started (PID ${pid})`
|
|
36917
37060
|
},
|
|
36918
37061
|
{
|
|
36919
37062
|
command: "daemon",
|
|
36920
37063
|
operation: "daemon.start",
|
|
36921
|
-
message: `GC daemon started (PID ${pid}) \u2014 Logs: ${
|
|
37064
|
+
message: `GC daemon started (PID ${pid}) \u2014 Logs: ${join10(cleoDir, "logs", "gc.log")}`
|
|
36922
37065
|
}
|
|
36923
37066
|
);
|
|
36924
37067
|
} catch (err) {
|
|
@@ -36948,7 +37091,7 @@ var init_daemon = __esm({
|
|
|
36948
37091
|
}
|
|
36949
37092
|
},
|
|
36950
37093
|
async run({ args }) {
|
|
36951
|
-
const cleoDir = args["cleo-dir"] ??
|
|
37094
|
+
const cleoDir = args["cleo-dir"] ?? join10(homedir3(), ".cleo");
|
|
36952
37095
|
try {
|
|
36953
37096
|
const stopResult = await stopGCDaemon(cleoDir);
|
|
36954
37097
|
cliOutput(stopResult, {
|
|
@@ -36986,7 +37129,7 @@ var init_daemon = __esm({
|
|
|
36986
37129
|
}
|
|
36987
37130
|
},
|
|
36988
37131
|
async run({ args }) {
|
|
36989
|
-
const cleoDir = args["cleo-dir"] ??
|
|
37132
|
+
const cleoDir = args["cleo-dir"] ?? join10(homedir3(), ".cleo");
|
|
36990
37133
|
await showDaemonStatus(cleoDir, process.cwd());
|
|
36991
37134
|
}
|
|
36992
37135
|
});
|
|
@@ -37084,7 +37227,7 @@ var init_daemon = __esm({
|
|
|
37084
37227
|
},
|
|
37085
37228
|
async run({ args, cmd, rawArgs }) {
|
|
37086
37229
|
if (isSubCommandDispatch(rawArgs, cmd.subCommands)) return;
|
|
37087
|
-
const cleoDir = args["cleo-dir"] ??
|
|
37230
|
+
const cleoDir = args["cleo-dir"] ?? join10(homedir3(), ".cleo");
|
|
37088
37231
|
await showDaemonStatus(cleoDir, process.cwd());
|
|
37089
37232
|
}
|
|
37090
37233
|
});
|
|
@@ -37547,12 +37690,12 @@ var detect_drift_exports = {};
|
|
|
37547
37690
|
__export(detect_drift_exports, {
|
|
37548
37691
|
detectDriftCommand: () => detectDriftCommand
|
|
37549
37692
|
});
|
|
37550
|
-
import { existsSync as
|
|
37551
|
-
import { dirname as dirname5, join as
|
|
37693
|
+
import { existsSync as existsSync9, readdirSync, readFileSync as readFileSync9 } from "node:fs";
|
|
37694
|
+
import { dirname as dirname5, join as join11 } from "node:path";
|
|
37552
37695
|
function findProjectRoot() {
|
|
37553
37696
|
let currentDir = process.cwd();
|
|
37554
37697
|
while (currentDir !== "/") {
|
|
37555
|
-
if (
|
|
37698
|
+
if (existsSync9(join11(currentDir, "package.json"))) {
|
|
37556
37699
|
return currentDir;
|
|
37557
37700
|
}
|
|
37558
37701
|
const parent = dirname5(currentDir);
|
|
@@ -37576,8 +37719,8 @@ var init_detect_drift = __esm({
|
|
|
37576
37719
|
},
|
|
37577
37720
|
async run() {
|
|
37578
37721
|
const projectRoot = findProjectRoot();
|
|
37579
|
-
const isCleoRepo =
|
|
37580
|
-
const cleoSrcRoot = isCleoRepo ?
|
|
37722
|
+
const isCleoRepo = existsSync9(join11(projectRoot, "packages", "cleo", "src"));
|
|
37723
|
+
const cleoSrcRoot = isCleoRepo ? join11(projectRoot, "packages", "cleo", "src") : join11(projectRoot, "src");
|
|
37581
37724
|
const safeRead = (filePath) => {
|
|
37582
37725
|
try {
|
|
37583
37726
|
return readFileSync9(filePath, "utf-8");
|
|
@@ -37591,8 +37734,8 @@ var init_detect_drift = __esm({
|
|
|
37591
37734
|
checks: [],
|
|
37592
37735
|
recommendations: []
|
|
37593
37736
|
};
|
|
37594
|
-
const injPath =
|
|
37595
|
-
if (
|
|
37737
|
+
const injPath = join11(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
|
|
37738
|
+
if (existsSync9(injPath)) {
|
|
37596
37739
|
const content = safeRead(injPath);
|
|
37597
37740
|
userResult.checks.push({
|
|
37598
37741
|
name: "Agent injection",
|
|
@@ -37643,10 +37786,10 @@ var init_detect_drift = __esm({
|
|
|
37643
37786
|
}
|
|
37644
37787
|
};
|
|
37645
37788
|
try {
|
|
37646
|
-
const specPath =
|
|
37647
|
-
const registryPath =
|
|
37648
|
-
const dispatchDomainsDir =
|
|
37649
|
-
if (!
|
|
37789
|
+
const specPath = join11(projectRoot, "docs", "specs", "CLEO-OPERATION-CONSTITUTION.md");
|
|
37790
|
+
const registryPath = join11(cleoSrcRoot, "dispatch", "registry.ts");
|
|
37791
|
+
const dispatchDomainsDir = join11(cleoSrcRoot, "dispatch", "domains");
|
|
37792
|
+
if (!existsSync9(specPath)) {
|
|
37650
37793
|
addCheck("Gateway-to-spec sync", "fail", "CLEO-OPERATION-CONSTITUTION.md missing", [
|
|
37651
37794
|
{
|
|
37652
37795
|
severity: "error",
|
|
@@ -37656,7 +37799,7 @@ var init_detect_drift = __esm({
|
|
|
37656
37799
|
recommendation: "Create docs/specs/CLEO-OPERATION-CONSTITUTION.md with canonical operation definitions"
|
|
37657
37800
|
}
|
|
37658
37801
|
]);
|
|
37659
|
-
} else if (!
|
|
37802
|
+
} else if (!existsSync9(registryPath) || !existsSync9(dispatchDomainsDir)) {
|
|
37660
37803
|
addCheck("Gateway-to-spec sync", "fail", "Dispatch registry or domains missing", [
|
|
37661
37804
|
{
|
|
37662
37805
|
severity: "error",
|
|
@@ -37714,9 +37857,9 @@ var init_detect_drift = __esm({
|
|
|
37714
37857
|
]);
|
|
37715
37858
|
}
|
|
37716
37859
|
try {
|
|
37717
|
-
const cliDir =
|
|
37718
|
-
const coreDir = isCleoRepo ?
|
|
37719
|
-
if (!
|
|
37860
|
+
const cliDir = join11(cleoSrcRoot, "cli", "commands");
|
|
37861
|
+
const coreDir = isCleoRepo ? join11(projectRoot, "packages", "core", "src") : join11(projectRoot, "src", "core");
|
|
37862
|
+
if (!existsSync9(cliDir)) {
|
|
37720
37863
|
addCheck("CLI-to-core sync", "fail", "CLI commands directory missing", [
|
|
37721
37864
|
{
|
|
37722
37865
|
severity: "error",
|
|
@@ -37725,7 +37868,7 @@ var init_detect_drift = __esm({
|
|
|
37725
37868
|
recommendation: "Verify TypeScript source structure is intact"
|
|
37726
37869
|
}
|
|
37727
37870
|
]);
|
|
37728
|
-
} else if (!
|
|
37871
|
+
} else if (!existsSync9(coreDir)) {
|
|
37729
37872
|
addCheck("CLI-to-core sync", "fail", "Core directory missing", [
|
|
37730
37873
|
{
|
|
37731
37874
|
severity: "error",
|
|
@@ -37742,8 +37885,8 @@ var init_detect_drift = __esm({
|
|
|
37742
37885
|
addCheck("CLI-to-core sync", "fail", `Error: ${getErrorMessage(e)}`);
|
|
37743
37886
|
}
|
|
37744
37887
|
try {
|
|
37745
|
-
const domainsDir =
|
|
37746
|
-
if (!
|
|
37888
|
+
const domainsDir = join11(cleoSrcRoot, "dispatch", "domains");
|
|
37889
|
+
if (!existsSync9(domainsDir)) {
|
|
37747
37890
|
addCheck("Domain handler coverage", "fail", "Dispatch domains directory missing", [
|
|
37748
37891
|
{
|
|
37749
37892
|
severity: "error",
|
|
@@ -37760,8 +37903,8 @@ var init_detect_drift = __esm({
|
|
|
37760
37903
|
addCheck("Domain handler coverage", "fail", `Error: ${getErrorMessage(e)}`);
|
|
37761
37904
|
}
|
|
37762
37905
|
try {
|
|
37763
|
-
const matrixPath =
|
|
37764
|
-
if (!
|
|
37906
|
+
const matrixPath = join11(cleoSrcRoot, "dispatch", "lib", "capability-matrix.ts");
|
|
37907
|
+
if (!existsSync9(matrixPath)) {
|
|
37765
37908
|
addCheck("Capability matrix", "fail", "Capability matrix missing", [
|
|
37766
37909
|
{
|
|
37767
37910
|
severity: "error",
|
|
@@ -37777,8 +37920,8 @@ var init_detect_drift = __esm({
|
|
|
37777
37920
|
addCheck("Capability matrix", "fail", `Error: ${getErrorMessage(e)}`);
|
|
37778
37921
|
}
|
|
37779
37922
|
try {
|
|
37780
|
-
const schemaPath =
|
|
37781
|
-
if (!
|
|
37923
|
+
const schemaPath = join11(projectRoot, "src", "store", "schema.ts");
|
|
37924
|
+
if (!existsSync9(schemaPath)) {
|
|
37782
37925
|
addCheck("Schema validation", "fail", "Schema definition missing", [
|
|
37783
37926
|
{
|
|
37784
37927
|
severity: "error",
|
|
@@ -37812,10 +37955,10 @@ var init_detect_drift = __esm({
|
|
|
37812
37955
|
addCheck("Schema validation", "fail", `Error: ${getErrorMessage(e)}`);
|
|
37813
37956
|
}
|
|
37814
37957
|
try {
|
|
37815
|
-
const visionPath =
|
|
37816
|
-
const specPath =
|
|
37958
|
+
const visionPath = join11(projectRoot, "docs", "concepts", "CLEO-VISION.md");
|
|
37959
|
+
const specPath = join11(projectRoot, "docs", "specs", "CLEO-PORTABLE-PROJECT-BRAIN-SPEC.md");
|
|
37817
37960
|
const issues = [];
|
|
37818
|
-
if (!
|
|
37961
|
+
if (!existsSync9(visionPath)) {
|
|
37819
37962
|
issues.push({
|
|
37820
37963
|
severity: "error",
|
|
37821
37964
|
category: "vision",
|
|
@@ -37824,7 +37967,7 @@ var init_detect_drift = __esm({
|
|
|
37824
37967
|
recommendation: "Create docs/concepts/CLEO-VISION.md with project vision"
|
|
37825
37968
|
});
|
|
37826
37969
|
}
|
|
37827
|
-
if (!
|
|
37970
|
+
if (!existsSync9(specPath)) {
|
|
37828
37971
|
issues.push({
|
|
37829
37972
|
severity: "error",
|
|
37830
37973
|
category: "spec",
|
|
@@ -37868,8 +38011,8 @@ var init_detect_drift = __esm({
|
|
|
37868
38011
|
addCheck("Canonical identity", "fail", `Error: ${getErrorMessage(e)}`);
|
|
37869
38012
|
}
|
|
37870
38013
|
try {
|
|
37871
|
-
const injectionPath =
|
|
37872
|
-
if (!
|
|
38014
|
+
const injectionPath = join11(projectRoot, CLEO_DIR_NAME, TEMPLATES_SUBDIR, CLEO_INJECTION_MD);
|
|
38015
|
+
if (!existsSync9(injectionPath)) {
|
|
37873
38016
|
addCheck("Agent injection", "fail", "Agent injection template missing", [
|
|
37874
38017
|
{
|
|
37875
38018
|
severity: "error",
|
|
@@ -37898,8 +38041,8 @@ var init_detect_drift = __esm({
|
|
|
37898
38041
|
addCheck("Agent injection", "fail", `Error: ${getErrorMessage(e)}`);
|
|
37899
38042
|
}
|
|
37900
38043
|
try {
|
|
37901
|
-
const exitCodesPath =
|
|
37902
|
-
if (!
|
|
38044
|
+
const exitCodesPath = join11(cleoSrcRoot, "dispatch", "lib", "exit-codes.ts");
|
|
38045
|
+
if (!existsSync9(exitCodesPath)) {
|
|
37903
38046
|
addCheck("Exit codes", "fail", "Exit codes definition missing", [
|
|
37904
38047
|
{
|
|
37905
38048
|
severity: "error",
|
|
@@ -38073,7 +38216,7 @@ __export(docs_exports, {
|
|
|
38073
38216
|
docsCommand: () => docsCommand
|
|
38074
38217
|
});
|
|
38075
38218
|
import { mkdir, readdir, readFile as readFile2, writeFile } from "node:fs/promises";
|
|
38076
|
-
import { dirname as dirname6, isAbsolute as isAbsolute2, join as
|
|
38219
|
+
import { dirname as dirname6, isAbsolute as isAbsolute2, join as join12, resolve as resolve5 } from "node:path";
|
|
38077
38220
|
import {
|
|
38078
38221
|
buildDocsGraph,
|
|
38079
38222
|
CleoError as CleoError3,
|
|
@@ -38086,10 +38229,10 @@ import {
|
|
|
38086
38229
|
publishDocs,
|
|
38087
38230
|
rankDocs,
|
|
38088
38231
|
readJson,
|
|
38089
|
-
searchDocs
|
|
38232
|
+
searchDocs as searchDocs2
|
|
38090
38233
|
} from "@cleocode/core/internal";
|
|
38091
38234
|
async function getScriptNames(projectRoot) {
|
|
38092
|
-
const scriptsDir =
|
|
38235
|
+
const scriptsDir = join12(projectRoot, "scripts");
|
|
38093
38236
|
try {
|
|
38094
38237
|
const files = await readdir(scriptsDir);
|
|
38095
38238
|
return files.filter((f) => f.endsWith(".sh")).map((f) => f.replace(".sh", "")).sort();
|
|
@@ -38098,7 +38241,7 @@ async function getScriptNames(projectRoot) {
|
|
|
38098
38241
|
}
|
|
38099
38242
|
}
|
|
38100
38243
|
async function getIndexedCommands(projectRoot) {
|
|
38101
|
-
const indexPath =
|
|
38244
|
+
const indexPath = join12(projectRoot, "docs", "commands", "COMMANDS-INDEX.json");
|
|
38102
38245
|
const index = await readJson(indexPath);
|
|
38103
38246
|
if (!index) return [];
|
|
38104
38247
|
return index.commands.map((c) => c.name).sort();
|
|
@@ -38131,7 +38274,7 @@ async function runGapCheck(_projectRoot, filterId) {
|
|
|
38131
38274
|
const reviewFiles = files.filter((f) => f.endsWith(".md"));
|
|
38132
38275
|
for (const file of reviewFiles) {
|
|
38133
38276
|
if (filterId && !file.includes(filterId)) continue;
|
|
38134
|
-
const filePath =
|
|
38277
|
+
const filePath = join12(reviewDir, file);
|
|
38135
38278
|
const content = await readFile2(filePath, "utf-8");
|
|
38136
38279
|
const taskMatch = file.match(/^(T\d+)/);
|
|
38137
38280
|
const taskId = taskMatch ? taskMatch[1] : "UNKNOWN";
|
|
@@ -38386,7 +38529,7 @@ var init_docs3 = __esm({
|
|
|
38386
38529
|
});
|
|
38387
38530
|
let writtenPath;
|
|
38388
38531
|
if (typeof args.out === "string" && args.out.length > 0) {
|
|
38389
|
-
const outPath = isAbsolute2(args.out) ? args.out :
|
|
38532
|
+
const outPath = isAbsolute2(args.out) ? args.out : resolve5(projectRoot, args.out);
|
|
38390
38533
|
await mkdir(dirname6(outPath), { recursive: true });
|
|
38391
38534
|
await writeFile(outPath, result.markdown, "utf8");
|
|
38392
38535
|
writtenPath = outPath;
|
|
@@ -38441,7 +38584,7 @@ var init_docs3 = __esm({
|
|
|
38441
38584
|
async run({ args }) {
|
|
38442
38585
|
const projectRoot = getProjectRoot22();
|
|
38443
38586
|
try {
|
|
38444
|
-
const result = await
|
|
38587
|
+
const result = await searchDocs2(String(args.query), {
|
|
38445
38588
|
ownerId: args.owner ?? void 0,
|
|
38446
38589
|
limit: args.limit ? Number.parseInt(String(args.limit), 10) : 10,
|
|
38447
38590
|
projectRoot
|
|
@@ -38500,7 +38643,7 @@ var init_docs3 = __esm({
|
|
|
38500
38643
|
base: args.base ?? void 0
|
|
38501
38644
|
});
|
|
38502
38645
|
if (typeof args.out === "string" && args.out.length > 0) {
|
|
38503
|
-
const outPath = isAbsolute2(args.out) ? args.out :
|
|
38646
|
+
const outPath = isAbsolute2(args.out) ? args.out : resolve5(projectRoot, args.out);
|
|
38504
38647
|
await mkdir(dirname6(outPath), { recursive: true });
|
|
38505
38648
|
await writeFile(outPath, result.merged, "utf8");
|
|
38506
38649
|
humanInfo(`Wrote merged content to ${outPath}`);
|
|
@@ -38571,7 +38714,7 @@ var init_docs3 = __esm({
|
|
|
38571
38714
|
output = lines.join("\n");
|
|
38572
38715
|
}
|
|
38573
38716
|
if (typeof args.out === "string" && args.out.length > 0) {
|
|
38574
|
-
const outPath = isAbsolute2(args.out) ? args.out :
|
|
38717
|
+
const outPath = isAbsolute2(args.out) ? args.out : resolve5(projectRoot, args.out);
|
|
38575
38718
|
await mkdir(dirname6(outPath), { recursive: true });
|
|
38576
38719
|
await writeFile(outPath, output, "utf8");
|
|
38577
38720
|
humanInfo(`Wrote graph to ${outPath}`);
|
|
@@ -39095,16 +39238,10 @@ __export(migrate_agents_v2_exports, {
|
|
|
39095
39238
|
walkAgentsDir: () => walkAgentsDir
|
|
39096
39239
|
});
|
|
39097
39240
|
import { createHash as createHash2 } from "node:crypto";
|
|
39098
|
-
import { appendFileSync as appendFileSync2, existsSync as
|
|
39099
|
-
import { join as
|
|
39100
|
-
import {
|
|
39101
|
-
import {
|
|
39102
|
-
applyPerfPragmas as applyPerfPragmas2,
|
|
39103
|
-
ensureGlobalSignaldockDb,
|
|
39104
|
-
getGlobalSignaldockDbPath,
|
|
39105
|
-
getProjectRoot as getProjectRoot23,
|
|
39106
|
-
installAgentFromCant
|
|
39107
|
-
} from "@cleocode/core/internal";
|
|
39241
|
+
import { appendFileSync as appendFileSync2, existsSync as existsSync10, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync10 } from "node:fs";
|
|
39242
|
+
import { join as join13 } from "node:path";
|
|
39243
|
+
import { getProjectRoot as getProjectRoot23, installAgentFromCant } from "@cleocode/core/internal";
|
|
39244
|
+
import { openCleoDb } from "@cleocode/core/store/open-cleo-db";
|
|
39108
39245
|
function sha256Hex(bytes) {
|
|
39109
39246
|
return createHash2("sha256").update(bytes).digest("hex");
|
|
39110
39247
|
}
|
|
@@ -39122,15 +39259,15 @@ function extractAgentName(source) {
|
|
|
39122
39259
|
return headerMatch[1] ?? null;
|
|
39123
39260
|
}
|
|
39124
39261
|
function appendAuditLog(projectRoot, entry) {
|
|
39125
|
-
const auditPath =
|
|
39126
|
-
const auditDir =
|
|
39127
|
-
if (!
|
|
39262
|
+
const auditPath = join13(projectRoot, AUDIT_LOG_RELATIVE);
|
|
39263
|
+
const auditDir = join13(auditPath, "..");
|
|
39264
|
+
if (!existsSync10(auditDir)) {
|
|
39128
39265
|
mkdirSync3(auditDir, { recursive: true });
|
|
39129
39266
|
}
|
|
39130
39267
|
appendFileSync2(auditPath, JSON.stringify(entry) + "\n", "utf8");
|
|
39131
39268
|
}
|
|
39132
39269
|
function walkAgentsDir(db, scanDir, projectRoot, summary, verbose) {
|
|
39133
|
-
if (!
|
|
39270
|
+
if (!existsSync10(scanDir)) return;
|
|
39134
39271
|
let files;
|
|
39135
39272
|
try {
|
|
39136
39273
|
files = readdirSync2(scanDir).filter((f) => f.endsWith(".cant"));
|
|
@@ -39141,7 +39278,7 @@ function walkAgentsDir(db, scanDir, projectRoot, summary, verbose) {
|
|
|
39141
39278
|
return;
|
|
39142
39279
|
}
|
|
39143
39280
|
for (const filename of files) {
|
|
39144
|
-
const cantPath =
|
|
39281
|
+
const cantPath = join13(scanDir, filename);
|
|
39145
39282
|
const relPath = cantPath.replace(`${projectRoot}/`, "");
|
|
39146
39283
|
let sourceBytes;
|
|
39147
39284
|
let sourceText;
|
|
@@ -39235,13 +39372,12 @@ function walkAgentsDir(db, scanDir, projectRoot, summary, verbose) {
|
|
|
39235
39372
|
}
|
|
39236
39373
|
async function runMigrateAgentsV2(projectRoot, verbose = true) {
|
|
39237
39374
|
const summary = { registered: 0, skipped: 0, conflicts: 0, errors: 0 };
|
|
39238
|
-
await
|
|
39239
|
-
const db =
|
|
39240
|
-
applyPerfPragmas2(db);
|
|
39375
|
+
const { db: _sdDb } = await openCleoDb("signaldock");
|
|
39376
|
+
const db = _sdDb;
|
|
39241
39377
|
try {
|
|
39242
|
-
const canonicalDir =
|
|
39378
|
+
const canonicalDir = join13(projectRoot, ".cleo", "cant", "agents");
|
|
39243
39379
|
walkAgentsDir(db, canonicalDir, projectRoot, summary, verbose);
|
|
39244
|
-
const legacyDir =
|
|
39380
|
+
const legacyDir = join13(projectRoot, ".cleo", "agents");
|
|
39245
39381
|
walkAgentsDir(db, legacyDir, projectRoot, summary, verbose);
|
|
39246
39382
|
} finally {
|
|
39247
39383
|
db.close();
|
|
@@ -39249,8 +39385,8 @@ async function runMigrateAgentsV2(projectRoot, verbose = true) {
|
|
|
39249
39385
|
return summary;
|
|
39250
39386
|
}
|
|
39251
39387
|
function readMigrationConflicts(projectRoot) {
|
|
39252
|
-
const auditPath =
|
|
39253
|
-
if (!
|
|
39388
|
+
const auditPath = join13(projectRoot, AUDIT_LOG_RELATIVE);
|
|
39389
|
+
if (!existsSync10(auditPath)) return [];
|
|
39254
39390
|
let raw;
|
|
39255
39391
|
try {
|
|
39256
39392
|
raw = readFileSync10(auditPath, "utf8");
|
|
@@ -40014,10 +40150,10 @@ var init_export = __esm({
|
|
|
40014
40150
|
// packages/cleo/src/cli/commands/find.ts
|
|
40015
40151
|
var find_exports = {};
|
|
40016
40152
|
__export(find_exports, {
|
|
40017
|
-
findCommand: () =>
|
|
40153
|
+
findCommand: () => findCommand3
|
|
40018
40154
|
});
|
|
40019
40155
|
import { createPage } from "@cleocode/core";
|
|
40020
|
-
var
|
|
40156
|
+
var findCommand3;
|
|
40021
40157
|
var init_find = __esm({
|
|
40022
40158
|
"packages/cleo/src/cli/commands/find.ts"() {
|
|
40023
40159
|
"use strict";
|
|
@@ -40025,7 +40161,7 @@ var init_find = __esm({
|
|
|
40025
40161
|
init_dist();
|
|
40026
40162
|
init_cli();
|
|
40027
40163
|
init_renderers();
|
|
40028
|
-
|
|
40164
|
+
findCommand3 = defineCommand({
|
|
40029
40165
|
meta: { name: "find", description: "Fuzzy search tasks by title/description" },
|
|
40030
40166
|
args: {
|
|
40031
40167
|
query: {
|
|
@@ -40099,7 +40235,7 @@ __export(gc_exports, {
|
|
|
40099
40235
|
gcCommand: () => gcCommand
|
|
40100
40236
|
});
|
|
40101
40237
|
import { homedir as homedir4, tmpdir } from "node:os";
|
|
40102
|
-
import { join as
|
|
40238
|
+
import { join as join14 } from "node:path";
|
|
40103
40239
|
import { pruneOrphanTempDirs, pruneOrphanWorktrees } from "@cleocode/core/gc/cleanup.js";
|
|
40104
40240
|
import { runGC } from "@cleocode/core/gc/runner.js";
|
|
40105
40241
|
import { readGCState } from "@cleocode/core/gc/state.js";
|
|
@@ -40138,7 +40274,7 @@ var init_gc = __esm({
|
|
|
40138
40274
|
}
|
|
40139
40275
|
},
|
|
40140
40276
|
async run({ args }) {
|
|
40141
|
-
const cleoDir = args["cleo-dir"] ??
|
|
40277
|
+
const cleoDir = args["cleo-dir"] ?? join14(homedir4(), ".cleo");
|
|
40142
40278
|
const dryRun = args["dry-run"];
|
|
40143
40279
|
try {
|
|
40144
40280
|
const gcResult = await runGC({ cleoDir, dryRun });
|
|
@@ -40180,8 +40316,8 @@ var init_gc = __esm({
|
|
|
40180
40316
|
}
|
|
40181
40317
|
},
|
|
40182
40318
|
async run({ args }) {
|
|
40183
|
-
const cleoDir = args["cleo-dir"] ??
|
|
40184
|
-
const statePath =
|
|
40319
|
+
const cleoDir = args["cleo-dir"] ?? join14(homedir4(), ".cleo");
|
|
40320
|
+
const statePath = join14(cleoDir, "gc-state.json");
|
|
40185
40321
|
try {
|
|
40186
40322
|
const state = await readGCState(statePath);
|
|
40187
40323
|
const diskStr = state.lastDiskUsedPct !== null ? `${state.lastDiskUsedPct.toFixed(1)}%` : "unknown";
|
|
@@ -40234,8 +40370,8 @@ var init_gc = __esm({
|
|
|
40234
40370
|
}
|
|
40235
40371
|
},
|
|
40236
40372
|
async run({ args }) {
|
|
40237
|
-
const xdgData = process.env["XDG_DATA_HOME"] ??
|
|
40238
|
-
const worktreesRoot = args["worktrees-root"] ??
|
|
40373
|
+
const xdgData = process.env["XDG_DATA_HOME"] ?? join14(homedir4(), ".local", "share");
|
|
40374
|
+
const worktreesRoot = args["worktrees-root"] ?? join14(xdgData, "cleo", "worktrees");
|
|
40239
40375
|
const projectHash = args["project-hash"];
|
|
40240
40376
|
const dryRun = args["dry-run"];
|
|
40241
40377
|
const preserveRaw = args["preserve-tasks"];
|
|
@@ -40345,8 +40481,8 @@ __export(generate_changelog_exports, {
|
|
|
40345
40481
|
generateChangelogCommand: () => generateChangelogCommand
|
|
40346
40482
|
});
|
|
40347
40483
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
40348
|
-
import { existsSync as
|
|
40349
|
-
import { dirname as dirname7, join as
|
|
40484
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync11, writeFileSync as writeFileSync3 } from "node:fs";
|
|
40485
|
+
import { dirname as dirname7, join as join15 } from "node:path";
|
|
40350
40486
|
import { CleoError as CleoError4, formatError as formatError6, getConfigPath, getProjectRoot as getProjectRoot25 } from "@cleocode/core";
|
|
40351
40487
|
function getChangelogSource(cwd) {
|
|
40352
40488
|
const configPath = getConfigPath(cwd);
|
|
@@ -40511,8 +40647,8 @@ var init_generate_changelog = __esm({
|
|
|
40511
40647
|
const targetPlatform = args.platform;
|
|
40512
40648
|
const dryRun = args["dry-run"] === true;
|
|
40513
40649
|
const sourceFile = getChangelogSource();
|
|
40514
|
-
const sourcePath =
|
|
40515
|
-
if (!
|
|
40650
|
+
const sourcePath = join15(getProjectRoot25(), sourceFile);
|
|
40651
|
+
if (!existsSync11(sourcePath)) {
|
|
40516
40652
|
throw new CleoError4(4 /* NOT_FOUND */, `Changelog source not found: ${sourcePath}`);
|
|
40517
40653
|
}
|
|
40518
40654
|
const sourceContent = readFileSync11(sourcePath, "utf-8");
|
|
@@ -40524,7 +40660,7 @@ var init_generate_changelog = __esm({
|
|
|
40524
40660
|
const outputPath = platformConfig?.path ?? getDefaultOutputPath(targetPlatform);
|
|
40525
40661
|
const content = generateForPlatform(targetPlatform, sourceContent, repoSlug, limit);
|
|
40526
40662
|
if (!dryRun) {
|
|
40527
|
-
const fullPath =
|
|
40663
|
+
const fullPath = join15(getProjectRoot25(), outputPath);
|
|
40528
40664
|
mkdirSync4(dirname7(fullPath), { recursive: true });
|
|
40529
40665
|
writeFileSync3(fullPath, content, "utf-8");
|
|
40530
40666
|
}
|
|
@@ -40545,7 +40681,7 @@ var init_generate_changelog = __esm({
|
|
|
40545
40681
|
limit
|
|
40546
40682
|
);
|
|
40547
40683
|
if (!dryRun) {
|
|
40548
|
-
const fullPath =
|
|
40684
|
+
const fullPath = join15(getProjectRoot25(), platformConfig.path);
|
|
40549
40685
|
mkdirSync4(dirname7(fullPath), { recursive: true });
|
|
40550
40686
|
writeFileSync3(fullPath, content, "utf-8");
|
|
40551
40687
|
}
|
|
@@ -40842,18 +40978,18 @@ __export(init_exports, {
|
|
|
40842
40978
|
getGitignoreTemplate: () => getGitignoreTemplate,
|
|
40843
40979
|
initCommand: () => initCommand
|
|
40844
40980
|
});
|
|
40845
|
-
import { existsSync as
|
|
40846
|
-
import { join as
|
|
40981
|
+
import { existsSync as existsSync12, readFileSync as readFileSync12 } from "node:fs";
|
|
40982
|
+
import { join as join16 } from "node:path";
|
|
40847
40983
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
40848
40984
|
import { CleoError as CleoError5, formatError as formatError7, initProject as initProject2 } from "@cleocode/core";
|
|
40849
40985
|
function getGitignoreTemplate() {
|
|
40850
40986
|
try {
|
|
40851
40987
|
const thisFile = fileURLToPath4(import.meta.url);
|
|
40852
|
-
const packageRoot =
|
|
40853
|
-
const localTemplatePath =
|
|
40854
|
-
const monorepoTemplatePath =
|
|
40855
|
-
const templatePath =
|
|
40856
|
-
if (
|
|
40988
|
+
const packageRoot = join16(thisFile, "..", "..", "..", "..");
|
|
40989
|
+
const localTemplatePath = join16(packageRoot, "templates", "cleo-gitignore");
|
|
40990
|
+
const monorepoTemplatePath = join16(packageRoot, "..", "..", "templates", "cleo-gitignore");
|
|
40991
|
+
const templatePath = existsSync12(localTemplatePath) ? localTemplatePath : monorepoTemplatePath;
|
|
40992
|
+
if (existsSync12(templatePath)) {
|
|
40857
40993
|
return readFileSync12(templatePath, "utf-8");
|
|
40858
40994
|
}
|
|
40859
40995
|
} catch {
|
|
@@ -41801,19 +41937,19 @@ async function readStdin() {
|
|
|
41801
41937
|
if (process.stdin.isTTY) {
|
|
41802
41938
|
return "";
|
|
41803
41939
|
}
|
|
41804
|
-
return new Promise((
|
|
41940
|
+
return new Promise((resolve7, reject) => {
|
|
41805
41941
|
let data = "";
|
|
41806
41942
|
process.stdin.setEncoding("utf-8");
|
|
41807
41943
|
process.stdin.on("data", (chunk) => {
|
|
41808
41944
|
data += chunk;
|
|
41809
41945
|
});
|
|
41810
41946
|
process.stdin.on("end", () => {
|
|
41811
|
-
|
|
41947
|
+
resolve7(data.trim());
|
|
41812
41948
|
});
|
|
41813
41949
|
process.stdin.on("error", reject);
|
|
41814
41950
|
});
|
|
41815
41951
|
}
|
|
41816
|
-
var showCommand7, listCommand10,
|
|
41952
|
+
var showCommand7, listCommand10, findCommand4, statsCommand3, appendCommand, archiveCommand2, manifestCommand;
|
|
41817
41953
|
var init_manifest = __esm({
|
|
41818
41954
|
"packages/cleo/src/cli/commands/manifest.ts"() {
|
|
41819
41955
|
"use strict";
|
|
@@ -41899,7 +42035,7 @@ var init_manifest = __esm({
|
|
|
41899
42035
|
);
|
|
41900
42036
|
}
|
|
41901
42037
|
});
|
|
41902
|
-
|
|
42038
|
+
findCommand4 = defineCommand({
|
|
41903
42039
|
meta: {
|
|
41904
42040
|
name: "find",
|
|
41905
42041
|
description: "Full-text search manifest entries"
|
|
@@ -42108,7 +42244,7 @@ var init_manifest = __esm({
|
|
|
42108
42244
|
subCommands: {
|
|
42109
42245
|
show: showCommand7,
|
|
42110
42246
|
list: listCommand10,
|
|
42111
|
-
find:
|
|
42247
|
+
find: findCommand4,
|
|
42112
42248
|
stats: statsCommand3,
|
|
42113
42249
|
append: appendCommand,
|
|
42114
42250
|
archive: archiveCommand2
|
|
@@ -42160,9 +42296,9 @@ __export(memory_exports, {
|
|
|
42160
42296
|
memoryCommand: () => memoryCommand
|
|
42161
42297
|
});
|
|
42162
42298
|
import { createHash as createHash3 } from "node:crypto";
|
|
42163
|
-
import { existsSync as
|
|
42299
|
+
import { existsSync as existsSync13, mkdirSync as mkdirSync5, readdirSync as readdirSync3, readFileSync as readFileSync13, writeFileSync as writeFileSync4 } from "node:fs";
|
|
42164
42300
|
import { homedir as homedir5 } from "node:os";
|
|
42165
|
-
import { join as
|
|
42301
|
+
import { join as join17 } from "node:path";
|
|
42166
42302
|
import {
|
|
42167
42303
|
getBrainDb as getBrainDb2,
|
|
42168
42304
|
getBrainNativeDb as getBrainNativeDb3,
|
|
@@ -42202,7 +42338,7 @@ ${body}`).digest("hex").slice(0, 16);
|
|
|
42202
42338
|
}
|
|
42203
42339
|
function loadImportHashes(stateFile) {
|
|
42204
42340
|
try {
|
|
42205
|
-
if (!
|
|
42341
|
+
if (!existsSync13(stateFile)) return /* @__PURE__ */ new Set();
|
|
42206
42342
|
const raw = readFileSync13(stateFile, "utf-8");
|
|
42207
42343
|
const parsed = JSON.parse(raw);
|
|
42208
42344
|
return new Set(parsed.hashes);
|
|
@@ -42212,7 +42348,7 @@ function loadImportHashes(stateFile) {
|
|
|
42212
42348
|
}
|
|
42213
42349
|
function saveImportHashes(stateFile, hashes) {
|
|
42214
42350
|
const dir = stateFile.slice(0, stateFile.lastIndexOf("/"));
|
|
42215
|
-
if (!
|
|
42351
|
+
if (!existsSync13(dir)) mkdirSync5(dir, { recursive: true });
|
|
42216
42352
|
writeFileSync4(stateFile, JSON.stringify({ hashes: [...hashes] }, null, 2), "utf-8");
|
|
42217
42353
|
}
|
|
42218
42354
|
function makeMemorySubcommand(opts) {
|
|
@@ -42232,7 +42368,7 @@ function makeMemorySubcommand(opts) {
|
|
|
42232
42368
|
}
|
|
42233
42369
|
});
|
|
42234
42370
|
}
|
|
42235
|
-
var storeCommand,
|
|
42371
|
+
var storeCommand, findCommand5, statsCommand4, observeCommand, timelineCommand, fetchCommand2, decisionFindCommand, decisionStoreCommand, linkCommand, traceCommand, relatedCommand, contextCommand2, graphStatsCommand, graphShowCommand, graphNeighborsCommand, graphAddCommand, graphRemoveCommand, reasonWhyCommand, reasonSimilarCommand, searchHybridCommand, codeLinksCommand, codeAutoLinkCommand, codeMemoriesForCodeCommand, codeForMemoryCommand, consolidateCommand, dreamCommand, reflectCommand, dedupScanCommand, importCommand3, doctorCommand3, llmStatusCommand, verifyCommand, pendingVerifyCommand, tierStatsCommand, tierPromoteCommand, tierDemoteCommand, precompactFlushCommand, backfillRunCommand, backfillApproveCommand, backfillRollbackCommand, backfillCommand2, digestCommand, recentCommand, diaryReadCommand, diaryWriteCommand, diaryCommand, watchCommand2, tierCommand, sweepCommand, memoryCommand;
|
|
42236
42372
|
var init_memory3 = __esm({
|
|
42237
42373
|
"packages/cleo/src/cli/commands/memory.ts"() {
|
|
42238
42374
|
"use strict";
|
|
@@ -42324,7 +42460,7 @@ var init_memory3 = __esm({
|
|
|
42324
42460
|
}
|
|
42325
42461
|
}
|
|
42326
42462
|
});
|
|
42327
|
-
|
|
42463
|
+
findCommand5 = defineCommand({
|
|
42328
42464
|
meta: {
|
|
42329
42465
|
name: "find",
|
|
42330
42466
|
description: "Search BRAIN memory (all tables, or filter by --type pattern|learning)"
|
|
@@ -43304,16 +43440,16 @@ var init_memory3 = __esm({
|
|
|
43304
43440
|
}
|
|
43305
43441
|
},
|
|
43306
43442
|
async run({ args }) {
|
|
43307
|
-
const sourceDir = args.from ??
|
|
43443
|
+
const sourceDir = args.from ?? join17(homedir5(), ".claude", "projects", "-mnt-projects-cleocode", "memory");
|
|
43308
43444
|
const isDryRun = !!args["dry-run"];
|
|
43309
43445
|
const projectRoot = getProjectRoot26();
|
|
43310
|
-
const stateFile =
|
|
43311
|
-
if (!
|
|
43446
|
+
const stateFile = join17(projectRoot, CLEO_DIR_NAME, MIGRATE_MEMORY_HASHES_JSON);
|
|
43447
|
+
if (!existsSync13(sourceDir)) {
|
|
43312
43448
|
cliError(`Source directory not found: ${sourceDir}`, "E_NOT_FOUND", { name: "E_NOT_FOUND" });
|
|
43313
43449
|
process.exit(1);
|
|
43314
43450
|
return;
|
|
43315
43451
|
}
|
|
43316
|
-
const files = readdirSync3(sourceDir).filter((f) => f.endsWith(".md") && f !== "MEMORY.md").map((f) =>
|
|
43452
|
+
const files = readdirSync3(sourceDir).filter((f) => f.endsWith(".md") && f !== "MEMORY.md").map((f) => join17(sourceDir, f));
|
|
43317
43453
|
const importedHashes = isDryRun ? /* @__PURE__ */ new Set() : loadImportHashes(stateFile);
|
|
43318
43454
|
const stats = { total: files.length, imported: 0, skipped: 0, errors: 0 };
|
|
43319
43455
|
const importedEntries = [];
|
|
@@ -44109,8 +44245,8 @@ data: ${JSON.stringify(event)}
|
|
|
44109
44245
|
cursor = data.nextCursor;
|
|
44110
44246
|
}
|
|
44111
44247
|
if (!running) break;
|
|
44112
|
-
await new Promise((
|
|
44113
|
-
const timer = setTimeout(
|
|
44248
|
+
await new Promise((resolve7) => {
|
|
44249
|
+
const timer = setTimeout(resolve7, intervalMs);
|
|
44114
44250
|
timer.unref?.();
|
|
44115
44251
|
});
|
|
44116
44252
|
}
|
|
@@ -44179,7 +44315,7 @@ data: ${JSON.stringify({ ts: (/* @__PURE__ */ new Date()).toISOString() })}
|
|
|
44179
44315
|
meta: { name: "memory", description: "BRAIN memory operations (patterns, learnings)" },
|
|
44180
44316
|
subCommands: {
|
|
44181
44317
|
store: storeCommand,
|
|
44182
|
-
find:
|
|
44318
|
+
find: findCommand5,
|
|
44183
44319
|
stats: statsCommand4,
|
|
44184
44320
|
observe: observeCommand,
|
|
44185
44321
|
timeline: timelineCommand,
|
|
@@ -45677,13 +45813,13 @@ var init_nexus4 = __esm({
|
|
|
45677
45813
|
if (!skipPrompt) {
|
|
45678
45814
|
const { createInterface: createInterface2 } = await import("node:readline");
|
|
45679
45815
|
const rl = createInterface2({ input: process.stdin, output: process.stdout });
|
|
45680
|
-
const confirmed = await new Promise((
|
|
45816
|
+
const confirmed = await new Promise((resolve7) => {
|
|
45681
45817
|
rl.question(
|
|
45682
45818
|
`
|
|
45683
45819
|
[nexus] Delete ${matchCount} project(s) from the registry? [y/N] `,
|
|
45684
45820
|
(answer) => {
|
|
45685
45821
|
rl.close();
|
|
45686
|
-
|
|
45822
|
+
resolve7(answer.trim().toLowerCase() === "y");
|
|
45687
45823
|
}
|
|
45688
45824
|
);
|
|
45689
45825
|
});
|
|
@@ -50758,7 +50894,7 @@ __export(revert_exports, {
|
|
|
50758
50894
|
revertCommand: () => revertCommand
|
|
50759
50895
|
});
|
|
50760
50896
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
50761
|
-
import { join as
|
|
50897
|
+
import { join as join18 } from "node:path";
|
|
50762
50898
|
import { cwd as processCwd } from "node:process";
|
|
50763
50899
|
import { E_RECEIPT_NOT_FOUND } from "@cleocode/core/sentient/chain-walker.js";
|
|
50764
50900
|
import { SENTIENT_STATE_FILE } from "@cleocode/core/sentient/daemon.js";
|
|
@@ -50823,7 +50959,7 @@ async function loadOwnerAttestation(attestationFilePath) {
|
|
|
50823
50959
|
return obj;
|
|
50824
50960
|
}
|
|
50825
50961
|
async function loadOwnerPubkeys(projectRoot) {
|
|
50826
|
-
const path5 =
|
|
50962
|
+
const path5 = join18(projectRoot, OWNER_PUBKEYS_FILE);
|
|
50827
50963
|
try {
|
|
50828
50964
|
const raw = await readFile3(path5, "utf-8");
|
|
50829
50965
|
const parsed = JSON.parse(raw);
|
|
@@ -50906,7 +51042,7 @@ var init_revert = __esm({
|
|
|
50906
51042
|
if (attestation && allowedPubkeys.size > 0 && !allowedPubkeys.has(attestation.ownerPubkey)) {
|
|
50907
51043
|
emitFailure2(
|
|
50908
51044
|
E_OWNER_ATTESTATION_REQUIRED,
|
|
50909
|
-
`Attestation pubkey "${attestation.ownerPubkey}" is not in the owner allowlist at ${
|
|
51045
|
+
`Attestation pubkey "${attestation.ownerPubkey}" is not in the owner allowlist at ${join18(projectRoot, OWNER_PUBKEYS_FILE)}`,
|
|
50910
51046
|
jsonMode
|
|
50911
51047
|
);
|
|
50912
51048
|
}
|
|
@@ -50959,7 +51095,7 @@ ${lines}`
|
|
|
50959
51095
|
identity,
|
|
50960
51096
|
includeHuman
|
|
50961
51097
|
});
|
|
50962
|
-
const statePath =
|
|
51098
|
+
const statePath = join18(projectRoot, SENTIENT_STATE_FILE);
|
|
50963
51099
|
const state = await readSentientState(statePath);
|
|
50964
51100
|
emitSuccess(
|
|
50965
51101
|
{
|
|
@@ -51194,7 +51330,7 @@ __export(self_update_exports, {
|
|
|
51194
51330
|
});
|
|
51195
51331
|
import { execFile } from "node:child_process";
|
|
51196
51332
|
import { readFile as readFile4 } from "node:fs/promises";
|
|
51197
|
-
import { join as
|
|
51333
|
+
import { join as join19 } from "node:path";
|
|
51198
51334
|
import * as readline2 from "node:readline";
|
|
51199
51335
|
import { promisify } from "node:util";
|
|
51200
51336
|
import {
|
|
@@ -51209,7 +51345,7 @@ import {
|
|
|
51209
51345
|
async function getCurrentVersion() {
|
|
51210
51346
|
const cleoHome = getCleoHome();
|
|
51211
51347
|
try {
|
|
51212
|
-
const content = await readFile4(
|
|
51348
|
+
const content = await readFile4(join19(cleoHome, "VERSION"), "utf-8");
|
|
51213
51349
|
return (content.split("\n")[0] ?? "unknown").trim();
|
|
51214
51350
|
} catch {
|
|
51215
51351
|
return "unknown";
|
|
@@ -51263,7 +51399,7 @@ async function writeRuntimeVersionMetadata(mode, source, version) {
|
|
|
51263
51399
|
];
|
|
51264
51400
|
await import("node:fs/promises").then(
|
|
51265
51401
|
({ writeFile: writeFile3, mkdir: mkdir3 }) => mkdir3(cleoHome, { recursive: true }).then(
|
|
51266
|
-
() => writeFile3(
|
|
51402
|
+
() => writeFile3(join19(cleoHome, "VERSION"), `${lines.join("\n")}
|
|
51267
51403
|
`, "utf-8")
|
|
51268
51404
|
)
|
|
51269
51405
|
);
|
|
@@ -51301,11 +51437,11 @@ async function runPostUpdateDiagnostics(opts) {
|
|
|
51301
51437
|
input: process.stdin,
|
|
51302
51438
|
output: process.stdout
|
|
51303
51439
|
});
|
|
51304
|
-
shouldMigrate = await new Promise((
|
|
51440
|
+
shouldMigrate = await new Promise((resolve7) => {
|
|
51305
51441
|
rl.question(" Do you want to run the upgrade now? [Y/n] ", (answer) => {
|
|
51306
51442
|
rl.close();
|
|
51307
51443
|
const clean = answer.trim().toLowerCase();
|
|
51308
|
-
|
|
51444
|
+
resolve7(clean === "" || clean === "y" || clean === "yes");
|
|
51309
51445
|
});
|
|
51310
51446
|
});
|
|
51311
51447
|
}
|
|
@@ -51674,7 +51810,7 @@ var sentient_exports = {};
|
|
|
51674
51810
|
__export(sentient_exports, {
|
|
51675
51811
|
sentientCommand: () => sentientCommand
|
|
51676
51812
|
});
|
|
51677
|
-
import { join as
|
|
51813
|
+
import { join as join20 } from "node:path";
|
|
51678
51814
|
import { cwd as processCwd2 } from "node:process";
|
|
51679
51815
|
import {
|
|
51680
51816
|
getSentientDaemonStatus as getSentientDaemonStatus2,
|
|
@@ -51740,7 +51876,7 @@ var init_sentient3 = __esm({
|
|
|
51740
51876
|
return;
|
|
51741
51877
|
}
|
|
51742
51878
|
if (dryRun) {
|
|
51743
|
-
const statePath2 =
|
|
51879
|
+
const statePath2 = join20(projectRoot, SENTIENT_STATE_FILE2);
|
|
51744
51880
|
const outcome = await safeRunTick({ projectRoot, statePath: statePath2, dryRun: true });
|
|
51745
51881
|
emitSuccess2(
|
|
51746
51882
|
{ dryRun: true, outcome },
|
|
@@ -51856,7 +51992,7 @@ Logs: ${logPath}`
|
|
|
51856
51992
|
const jsonMode = args.json === true;
|
|
51857
51993
|
const dryRun = args["dry-run"] === true;
|
|
51858
51994
|
try {
|
|
51859
|
-
const statePath =
|
|
51995
|
+
const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
|
|
51860
51996
|
const outcome = await safeRunTick({ projectRoot, statePath, dryRun });
|
|
51861
51997
|
emitSuccess2(
|
|
51862
51998
|
{ outcome, dryRun },
|
|
@@ -51925,7 +52061,7 @@ Logs: ${logPath}`
|
|
|
51925
52061
|
return;
|
|
51926
52062
|
}
|
|
51927
52063
|
await db.update(tasks).set({ status: "pending", updatedAt: now }).where(eq2(tasks.id, id)).run();
|
|
51928
|
-
const statePath =
|
|
52064
|
+
const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
|
|
51929
52065
|
const state = await readSentientState2(statePath);
|
|
51930
52066
|
await patchSentientState(statePath, {
|
|
51931
52067
|
tier2Stats: {
|
|
@@ -51977,7 +52113,7 @@ Logs: ${logPath}`
|
|
|
51977
52113
|
return;
|
|
51978
52114
|
}
|
|
51979
52115
|
await db.update(tasks).set({ status: "cancelled", cancellationReason: reason, cancelledAt: now, updatedAt: now }).where(eq2(tasks.id, id)).run();
|
|
51980
|
-
const statePath =
|
|
52116
|
+
const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
|
|
51981
52117
|
const state = await readSentientState2(statePath);
|
|
51982
52118
|
await patchSentientState(statePath, {
|
|
51983
52119
|
tier2Stats: {
|
|
@@ -52022,7 +52158,7 @@ Logs: ${logPath}`
|
|
|
52022
52158
|
const projectRoot = resolveProjectRoot5(args.project);
|
|
52023
52159
|
const jsonMode = args.json === true;
|
|
52024
52160
|
try {
|
|
52025
|
-
const statePath =
|
|
52161
|
+
const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
|
|
52026
52162
|
const outcome = await safeRunProposeTick({ projectRoot, statePath });
|
|
52027
52163
|
emitSuccess2(
|
|
52028
52164
|
{ outcome },
|
|
@@ -52042,7 +52178,7 @@ Logs: ${logPath}`
|
|
|
52042
52178
|
const projectRoot = resolveProjectRoot5(args.project);
|
|
52043
52179
|
const jsonMode = args.json === true;
|
|
52044
52180
|
try {
|
|
52045
|
-
const statePath =
|
|
52181
|
+
const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
|
|
52046
52182
|
const updated = await patchSentientState(statePath, { tier2Enabled: true });
|
|
52047
52183
|
emitSuccess2({ tier2Enabled: updated.tier2Enabled }, jsonMode, "Tier-2 proposals enabled");
|
|
52048
52184
|
} catch (err) {
|
|
@@ -52061,7 +52197,7 @@ Logs: ${logPath}`
|
|
|
52061
52197
|
const projectRoot = resolveProjectRoot5(args.project);
|
|
52062
52198
|
const jsonMode = args.json === true;
|
|
52063
52199
|
try {
|
|
52064
|
-
const statePath =
|
|
52200
|
+
const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
|
|
52065
52201
|
const updated = await patchSentientState(statePath, { tier2Enabled: false });
|
|
52066
52202
|
emitSuccess2({ tier2Enabled: updated.tier2Enabled }, jsonMode, "Tier-2 proposals disabled");
|
|
52067
52203
|
} catch (err) {
|
|
@@ -52092,7 +52228,7 @@ Logs: ${logPath}`
|
|
|
52092
52228
|
const projectRoot = resolveProjectRoot5(args.project);
|
|
52093
52229
|
const jsonMode = args.json === true;
|
|
52094
52230
|
try {
|
|
52095
|
-
const statePath =
|
|
52231
|
+
const statePath = join20(projectRoot, SENTIENT_STATE_FILE2);
|
|
52096
52232
|
const state = await readSentientState2(statePath);
|
|
52097
52233
|
emitSuccess2(
|
|
52098
52234
|
{
|
|
@@ -52404,7 +52540,7 @@ async function promptOwnerAuthPassword(sessionName) {
|
|
|
52404
52540
|
terminal: true
|
|
52405
52541
|
});
|
|
52406
52542
|
process.stderr.write(`[cleo] Enter owner-auth password for session "${sessionName}": `);
|
|
52407
|
-
const password = await new Promise((
|
|
52543
|
+
const password = await new Promise((resolve7) => {
|
|
52408
52544
|
if (process.stdin.setRawMode) {
|
|
52409
52545
|
process.stdin.setRawMode(
|
|
52410
52546
|
true
|
|
@@ -52422,10 +52558,10 @@ async function promptOwnerAuthPassword(sessionName) {
|
|
|
52422
52558
|
);
|
|
52423
52559
|
}
|
|
52424
52560
|
process.stderr.write("\n");
|
|
52425
|
-
|
|
52561
|
+
resolve7(pw);
|
|
52426
52562
|
} else if (ch === "") {
|
|
52427
52563
|
process.stderr.write("\n[cleo] Cancelled.\n");
|
|
52428
|
-
|
|
52564
|
+
resolve7("");
|
|
52429
52565
|
} else if (ch === "\x7F" || ch === "\b") {
|
|
52430
52566
|
pw = pw.slice(0, -1);
|
|
52431
52567
|
} else {
|
|
@@ -52439,7 +52575,7 @@ async function promptOwnerAuthPassword(sessionName) {
|
|
|
52439
52575
|
const token = deriveOwnerAuthToken(sessionName, password);
|
|
52440
52576
|
return token;
|
|
52441
52577
|
}
|
|
52442
|
-
var startCommand8, endCommand, handoffCommand2, statusCommand11, resumeCommand2,
|
|
52578
|
+
var startCommand8, endCommand, handoffCommand2, statusCommand11, resumeCommand2, findCommand6, listCommand19, gcCommand2, showCommand13, driftCommand, contextDriftCommand, suspendCommand, recordAssumptionCommand, recordDecisionCommand, decisionLogCommand, sessionCommand;
|
|
52443
52579
|
var init_session4 = __esm({
|
|
52444
52580
|
"packages/cleo/src/cli/commands/session.ts"() {
|
|
52445
52581
|
"use strict";
|
|
@@ -52667,7 +52803,7 @@ var init_session4 = __esm({
|
|
|
52667
52803
|
);
|
|
52668
52804
|
}
|
|
52669
52805
|
});
|
|
52670
|
-
|
|
52806
|
+
findCommand6 = defineCommand({
|
|
52671
52807
|
meta: {
|
|
52672
52808
|
name: "find",
|
|
52673
52809
|
description: "Find sessions (lightweight discovery \u2014 minimal fields, low context cost)"
|
|
@@ -52969,7 +53105,7 @@ var init_session4 = __esm({
|
|
|
52969
53105
|
handoff: handoffCommand2,
|
|
52970
53106
|
status: statusCommand11,
|
|
52971
53107
|
resume: resumeCommand2,
|
|
52972
|
-
find:
|
|
53108
|
+
find: findCommand6,
|
|
52973
53109
|
list: listCommand19,
|
|
52974
53110
|
gc: gcCommand2,
|
|
52975
53111
|
show: showCommand13,
|
|
@@ -54390,7 +54526,7 @@ __export(transcript_exports, {
|
|
|
54390
54526
|
transcriptCommand: () => transcriptCommand
|
|
54391
54527
|
});
|
|
54392
54528
|
import { homedir as homedir6 } from "node:os";
|
|
54393
|
-
import { join as
|
|
54529
|
+
import { join as join21 } from "node:path";
|
|
54394
54530
|
import { getProjectRoot as getProjectRoot32 } from "@cleocode/core";
|
|
54395
54531
|
import {
|
|
54396
54532
|
parseDurationMs,
|
|
@@ -54444,7 +54580,7 @@ var init_transcript = __esm({
|
|
|
54444
54580
|
}
|
|
54445
54581
|
return;
|
|
54446
54582
|
}
|
|
54447
|
-
const projectsDir = args["projects-dir"] ??
|
|
54583
|
+
const projectsDir = args["projects-dir"] ?? join21(homedir6(), ".claude", "projects");
|
|
54448
54584
|
try {
|
|
54449
54585
|
const result = await scanTranscripts(projectsDir);
|
|
54450
54586
|
cliOutput(
|
|
@@ -54750,7 +54886,7 @@ var init_transcript = __esm({
|
|
|
54750
54886
|
process.exit(2);
|
|
54751
54887
|
return;
|
|
54752
54888
|
}
|
|
54753
|
-
const projectsDir = args["projects-dir"] ??
|
|
54889
|
+
const projectsDir = args["projects-dir"] ?? join21(homedir6(), ".claude", "projects");
|
|
54754
54890
|
try {
|
|
54755
54891
|
const pruneResult = await pruneTranscripts({
|
|
54756
54892
|
olderThanMs,
|
|
@@ -55209,6 +55345,30 @@ var verify_exports = {};
|
|
|
55209
55345
|
__export(verify_exports, {
|
|
55210
55346
|
verifyCommand: () => verifyCommand3
|
|
55211
55347
|
});
|
|
55348
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
55349
|
+
import { existsSync as existsSync14 } from "node:fs";
|
|
55350
|
+
import { join as join22, resolve as resolve6 } from "node:path";
|
|
55351
|
+
function resolveVerifierScript2(taskId, projectRoot) {
|
|
55352
|
+
const id = taskId.toLowerCase();
|
|
55353
|
+
const candidates = [
|
|
55354
|
+
join22(projectRoot, "scripts", `verify-${taskId}-fu.mjs`),
|
|
55355
|
+
join22(projectRoot, "scripts", `verify-${taskId}.mjs`),
|
|
55356
|
+
join22(projectRoot, "scripts", `verify-${id}-fu.mjs`),
|
|
55357
|
+
join22(projectRoot, "scripts", `verify-${id}.mjs`)
|
|
55358
|
+
];
|
|
55359
|
+
for (const candidate of candidates) {
|
|
55360
|
+
if (existsSync14(candidate)) return candidate;
|
|
55361
|
+
}
|
|
55362
|
+
return null;
|
|
55363
|
+
}
|
|
55364
|
+
function runVerifier(verifierPath) {
|
|
55365
|
+
const result = spawnSync2("node", [verifierPath], { encoding: "utf8" });
|
|
55366
|
+
return {
|
|
55367
|
+
exitCode: result.status ?? 1,
|
|
55368
|
+
stdout: result.stdout ?? "",
|
|
55369
|
+
stderr: result.stderr ?? ""
|
|
55370
|
+
};
|
|
55371
|
+
}
|
|
55212
55372
|
var verifyCommand3;
|
|
55213
55373
|
var init_verify = __esm({
|
|
55214
55374
|
"packages/cleo/src/cli/commands/verify.ts"() {
|
|
@@ -55255,6 +55415,11 @@ var init_verify = __esm({
|
|
|
55255
55415
|
"shared-evidence": {
|
|
55256
55416
|
type: "boolean",
|
|
55257
55417
|
description: "Acknowledge that the same evidence atom is applied to >3 distinct tasks in this session (T1502 / ADR-059). Without this flag, such reuse triggers a warning; in strict mode (CLEO_STRICT_EVIDENCE=1) it is a hard reject."
|
|
55418
|
+
},
|
|
55419
|
+
"acceptance-check": {
|
|
55420
|
+
type: "string",
|
|
55421
|
+
description: "Run the task acceptance verifier before any gate write. Resolves scripts/verify-<taskId>-fu.mjs (or pass an explicit path). Blocks if verifier exits non-zero. (T9192 / ADR-070)",
|
|
55422
|
+
required: false
|
|
55258
55423
|
}
|
|
55259
55424
|
},
|
|
55260
55425
|
async run({ args, cmd }) {
|
|
@@ -55262,6 +55427,53 @@ var init_verify = __esm({
|
|
|
55262
55427
|
await showUsage(cmd);
|
|
55263
55428
|
return;
|
|
55264
55429
|
}
|
|
55430
|
+
const acceptanceCheckRaw = args["acceptance-check"];
|
|
55431
|
+
const shouldRunAcceptanceCheck = acceptanceCheckRaw !== void 0 && acceptanceCheckRaw !== false;
|
|
55432
|
+
if (shouldRunAcceptanceCheck) {
|
|
55433
|
+
const projectRoot = resolve6(process.cwd());
|
|
55434
|
+
let verifierPath = null;
|
|
55435
|
+
if (typeof acceptanceCheckRaw === "string" && acceptanceCheckRaw.length > 0) {
|
|
55436
|
+
const explicit = resolve6(projectRoot, acceptanceCheckRaw);
|
|
55437
|
+
verifierPath = existsSync14(explicit) ? explicit : null;
|
|
55438
|
+
if (!verifierPath) {
|
|
55439
|
+
process.stderr.write(
|
|
55440
|
+
`Error: --acceptance-check path not found: ${explicit}
|
|
55441
|
+
T9192 / ADR-070: verifier script must exist before gate writes are allowed.
|
|
55442
|
+
`
|
|
55443
|
+
);
|
|
55444
|
+
process.exitCode = 1;
|
|
55445
|
+
return;
|
|
55446
|
+
}
|
|
55447
|
+
} else {
|
|
55448
|
+
verifierPath = resolveVerifierScript2(String(args.taskId), projectRoot);
|
|
55449
|
+
}
|
|
55450
|
+
if (!verifierPath) {
|
|
55451
|
+
process.stderr.write(
|
|
55452
|
+
`Error: --acceptance-check: no verifier script found for ${args.taskId}.
|
|
55453
|
+
Looked for: scripts/verify-${args.taskId}-fu.mjs, scripts/verify-${args.taskId}.mjs
|
|
55454
|
+
T9192 / ADR-070: create the verifier script before using --acceptance-check.
|
|
55455
|
+
`
|
|
55456
|
+
);
|
|
55457
|
+
process.exitCode = 1;
|
|
55458
|
+
return;
|
|
55459
|
+
}
|
|
55460
|
+
const { exitCode, stdout, stderr: stderr2 } = runVerifier(verifierPath);
|
|
55461
|
+
process.stdout.write(stdout);
|
|
55462
|
+
if (stderr2) process.stderr.write(stderr2);
|
|
55463
|
+
if (exitCode !== 0) {
|
|
55464
|
+
process.stderr.write(
|
|
55465
|
+
`
|
|
55466
|
+
E_ACCEPTANCE_VERIFIER_FAILED: verifier exited ${exitCode}.
|
|
55467
|
+
Verifier: ${verifierPath}
|
|
55468
|
+
Gate writes blocked until verifier exits 0. (T9192 / ADR-070)
|
|
55469
|
+
`
|
|
55470
|
+
);
|
|
55471
|
+
process.exitCode = exitCode;
|
|
55472
|
+
return;
|
|
55473
|
+
}
|
|
55474
|
+
process.stdout.write(`Verifier passed (exit 0). Proceeding with gate operation.
|
|
55475
|
+
`);
|
|
55476
|
+
}
|
|
55265
55477
|
const isWrite = !!(args.gate || args.all || args.reset);
|
|
55266
55478
|
const useExplain = !isWrite && args.explain === true;
|
|
55267
55479
|
const operation = isWrite ? "gate.set" : useExplain ? "verify.explain" : "gate.status";
|
|
@@ -55293,15 +55505,15 @@ __export(web_exports, {
|
|
|
55293
55505
|
});
|
|
55294
55506
|
import { execFileSync as execFileSync4, spawn } from "node:child_process";
|
|
55295
55507
|
import { mkdir as mkdir2, open, readFile as readFile5, rm, stat, writeFile as writeFile2 } from "node:fs/promises";
|
|
55296
|
-
import { join as
|
|
55508
|
+
import { join as join23 } from "node:path";
|
|
55297
55509
|
import { CleoError as CleoError12, formatError as formatError9, getCleoHome as getCleoHome2 } from "@cleocode/core";
|
|
55298
55510
|
function getWebPaths() {
|
|
55299
55511
|
const cleoHome = getCleoHome2();
|
|
55300
55512
|
return {
|
|
55301
|
-
pidFile:
|
|
55302
|
-
configFile:
|
|
55303
|
-
logDir:
|
|
55304
|
-
logFile:
|
|
55513
|
+
pidFile: join23(cleoHome, "web-server.pid"),
|
|
55514
|
+
configFile: join23(cleoHome, "web-server.json"),
|
|
55515
|
+
logDir: join23(cleoHome, "logs"),
|
|
55516
|
+
logFile: join23(cleoHome, "logs", "web-server.log")
|
|
55305
55517
|
};
|
|
55306
55518
|
}
|
|
55307
55519
|
function isProcessRunning(pid) {
|
|
@@ -55340,7 +55552,7 @@ async function startWebServer(port, host) {
|
|
|
55340
55552
|
throw new CleoError12(1 /* GENERAL_ERROR */, `Server already running (PID: ${status.pid})`);
|
|
55341
55553
|
}
|
|
55342
55554
|
const projectRoot = process.env["CLEO_ROOT"] ?? process.cwd();
|
|
55343
|
-
const studioDir = process.env["CLEO_STUDIO_DIR"] ??
|
|
55555
|
+
const studioDir = process.env["CLEO_STUDIO_DIR"] ?? join23(projectRoot, "packages", "studio", "build");
|
|
55344
55556
|
await mkdir2(logDir, { recursive: true });
|
|
55345
55557
|
await writeFile2(
|
|
55346
55558
|
configFile,
|
|
@@ -55350,7 +55562,7 @@ async function startWebServer(port, host) {
|
|
|
55350
55562
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
55351
55563
|
})
|
|
55352
55564
|
);
|
|
55353
|
-
const webIndexPath =
|
|
55565
|
+
const webIndexPath = join23(studioDir, "index.js");
|
|
55354
55566
|
try {
|
|
55355
55567
|
await stat(webIndexPath);
|
|
55356
55568
|
} catch {
|
|
@@ -55398,7 +55610,7 @@ Logs: ${logFile}`
|
|
|
55398
55610
|
}
|
|
55399
55611
|
} catch {
|
|
55400
55612
|
}
|
|
55401
|
-
await new Promise((
|
|
55613
|
+
await new Promise((resolve7) => setTimeout(resolve7, 500));
|
|
55402
55614
|
}
|
|
55403
55615
|
if (!started) {
|
|
55404
55616
|
try {
|
|
@@ -55475,7 +55687,7 @@ var init_web = __esm({
|
|
|
55475
55687
|
}
|
|
55476
55688
|
for (let i = 0; i < 60; i++) {
|
|
55477
55689
|
if (!isProcessRunning(status.pid)) break;
|
|
55478
|
-
await new Promise((
|
|
55690
|
+
await new Promise((resolve7) => setTimeout(resolve7, 500));
|
|
55479
55691
|
}
|
|
55480
55692
|
if (isProcessRunning(status.pid)) {
|
|
55481
55693
|
try {
|
|
@@ -55527,7 +55739,7 @@ var init_web = __esm({
|
|
|
55527
55739
|
}
|
|
55528
55740
|
for (let i = 0; i < 60; i++) {
|
|
55529
55741
|
if (!isProcessRunning(status.pid)) break;
|
|
55530
|
-
await new Promise((
|
|
55742
|
+
await new Promise((resolve7) => setTimeout(resolve7, 500));
|
|
55531
55743
|
}
|
|
55532
55744
|
if (isProcessRunning(status.pid)) {
|
|
55533
55745
|
try {
|
|
@@ -55622,7 +55834,7 @@ init_dist();
|
|
|
55622
55834
|
init_field_context();
|
|
55623
55835
|
init_format_context();
|
|
55624
55836
|
import { readFileSync as readFileSync15 } from "node:fs";
|
|
55625
|
-
import { dirname as dirname8, join as
|
|
55837
|
+
import { dirname as dirname8, join as join24 } from "node:path";
|
|
55626
55838
|
import { fileURLToPath as fileURLToPath5 } from "node:url";
|
|
55627
55839
|
|
|
55628
55840
|
// packages/cleo/src/cli/generated/command-manifest.ts
|
|
@@ -55657,6 +55869,12 @@ var COMMAND_MANIFEST = [
|
|
|
55657
55869
|
description: "Manage and validate Architecture Decision Records in .cleo/adrs/",
|
|
55658
55870
|
load: async () => (await Promise.resolve().then(() => (init_adr(), adr_exports))).adrCommand
|
|
55659
55871
|
},
|
|
55872
|
+
{
|
|
55873
|
+
exportName: "agentOutputsCommand",
|
|
55874
|
+
name: "agent-outputs",
|
|
55875
|
+
description: "Agent output document management \u2014 find/search via DocsAccessor (find subcommand)",
|
|
55876
|
+
load: async () => (await Promise.resolve().then(() => (init_agent_outputs(), agent_outputs_exports))).agentOutputsCommand
|
|
55877
|
+
},
|
|
55660
55878
|
{
|
|
55661
55879
|
exportName: "agentCommand",
|
|
55662
55880
|
name: "agent",
|
|
@@ -55684,7 +55902,7 @@ var COMMAND_MANIFEST = [
|
|
|
55684
55902
|
{
|
|
55685
55903
|
exportName: "auditCommand",
|
|
55686
55904
|
name: "audit",
|
|
55687
|
-
description: "Git-backed audit tooling (lineage reconstruction, integrity checks)",
|
|
55905
|
+
description: "Git-backed audit tooling (lineage reconstruction, integrity checks). ",
|
|
55688
55906
|
load: async () => (await Promise.resolve().then(() => (init_audit2(), audit_exports))).auditCommand
|
|
55689
55907
|
},
|
|
55690
55908
|
{
|
|
@@ -56681,7 +56899,7 @@ Or via NodeSource: https://github.com/nodesource/distributions
|
|
|
56681
56899
|
}
|
|
56682
56900
|
}
|
|
56683
56901
|
function getPackageVersion() {
|
|
56684
|
-
const pkgPath =
|
|
56902
|
+
const pkgPath = join24(dirname8(fileURLToPath5(import.meta.url)), "../../package.json");
|
|
56685
56903
|
const pkg = JSON.parse(readFileSync15(pkgPath, "utf-8"));
|
|
56686
56904
|
return pkg.version;
|
|
56687
56905
|
}
|