@cleocode/cleo 2026.9.16 → 2026.9.17
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 +744 -329
- package/package.json +13 -13
- package/studio-dist/client/_app/immutable/chunks/{VKKkkMOi.js → BrrM_eZ4.js} +1 -1
- package/studio-dist/client/_app/immutable/chunks/D5lyBNlR.js +3 -0
- package/studio-dist/client/_app/immutable/chunks/DaxTlMC9.js +1 -0
- package/studio-dist/client/_app/immutable/chunks/{1fCYH2a_.js → WVwgdaDC.js} +1 -1
- package/studio-dist/client/_app/immutable/entry/{app.DbhESOoe.js → app.ClYoWknk.js} +2 -2
- package/studio-dist/client/_app/immutable/entry/start.CZfJtQv0.js +1 -0
- package/studio-dist/client/_app/immutable/nodes/{0.DBuv3zxt.js → 0.DlsCVyQC.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{1.BOT1FWSE.js → 1.kuZW_Yfb.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{15.CUpJlGs8.js → 15.Bf2rZKAN.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{16.DaWaP5Nf.js → 16.CR_4uKSc.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{17.pbxraJ9_.js → 17.DbEq1vuq.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{18.-IINezS5.js → 18.CfBfiBli.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{20.qlA7fV1e.js → 20.Ca-7dacf.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{24.Cl_79R4f.js → 24.DtVXRpcA.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{25.D41oJ8Oj.js → 25.VL1TBuXZ.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{26.BJQqW7_R.js → 26.BK8UX5hQ.js} +1 -1
- package/studio-dist/client/_app/immutable/nodes/{3.C719XWWs.js → 3.CI43RoJY.js} +1 -1
- package/studio-dist/client/_app/version.json +1 -1
- package/studio-dist/server/chunks/{0-CjsTPYb4.js → 0-6ert3v2y.js} +3 -3
- package/studio-dist/server/chunks/1-BfikRa8t.js +9 -0
- package/studio-dist/server/chunks/{15-D68G_5g9.js → 15-BTfHtB4D.js} +3 -3
- package/studio-dist/server/chunks/{16-BY7vuqXM.js → 16-Cni7eH8K.js} +3 -3
- package/studio-dist/server/chunks/{17-CFJofXoq.js → 17-MAljRuOm.js} +3 -3
- package/studio-dist/server/chunks/{18-Ce_tTMTL.js → 18-BrjgrGIZ.js} +3 -3
- package/studio-dist/server/chunks/{20-C86mBBSO.js → 20-CqOgxz6W.js} +3 -3
- package/studio-dist/server/chunks/{24-DQyZxDmF.js → 24-BfD92f8S.js} +3 -3
- package/studio-dist/server/chunks/{25-DdY9WKSi.js → 25-BsnMsoge.js} +4 -4
- package/studio-dist/server/chunks/{26-BKXgHFYi.js → 26-D2TYbqHS.js} +3 -3
- package/studio-dist/server/chunks/{3-BfZFQmBt.js → 3-B_oAVMNw.js} +3 -3
- package/studio-dist/server/chunks/{_layout.svelte-BvaQph6n.js → _layout.svelte-CkW6Kdk5.js} +4 -4
- package/studio-dist/server/chunks/{_page.svelte-CXHH6QhA.js → _page.svelte-BDibiwAe.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-D4HZCZ4i.js → _page.svelte-BKBG-XSg.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-DY9RMYJz.js → _page.svelte-BMdYf1cg.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-BdnAGpfK.js → _page.svelte-BoQhYsVx.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-CilqoOTE.js → _page.svelte-D8he_1T7.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-aid14STT.js → _page.svelte-Da-3o8cX.js} +4 -4
- package/studio-dist/server/chunks/{_page.svelte-Bf5AeFvk.js → _page.svelte-FTPRZm1-.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-L6NQQsuJ.js → _page.svelte-NHyAngRc.js} +3 -3
- package/studio-dist/server/chunks/{_page.svelte-BmyHCbvx.js → _page.svelte-vnt0clrD.js} +5 -5
- package/studio-dist/server/chunks/{_server.ts-BcryvqpX.js → _server.ts-5ME0O0O5.js} +2 -2
- package/studio-dist/server/chunks/{_server.ts-CZ5GZRWX.js → _server.ts-857DZpFq.js} +3 -3
- package/studio-dist/server/chunks/{_server.ts-CPf8necd.js → _server.ts-BRiXaP9H.js} +3 -3
- package/studio-dist/server/chunks/{_server.ts-VQchZxXq.js → _server.ts-C0NSDBLN.js} +3 -3
- package/studio-dist/server/chunks/{_server.ts-BcsqAqXt.js → _server.ts-NTIieN0a.js} +3 -3
- package/studio-dist/server/chunks/{client-TY12rxMH.js → client-BU1wABCc.js} +2 -2
- package/studio-dist/server/chunks/{dist-BzgWhfUR.js → dist-COXvVhUI.js} +3 -3
- package/studio-dist/server/chunks/{error.svelte-BXKn0_t4.js → error.svelte--KhnOP40.js} +3 -3
- package/studio-dist/server/chunks/{http-DPU3HHl2.js → http-DppxZNjA.js} +2 -2
- package/studio-dist/server/chunks/{internal-BgzgX_Kf.js → internal-DI5OqAog.js} +2 -2
- package/studio-dist/server/chunks/{stores-C3eRvkOH.js → stores-BGkle30z.js} +2 -2
- package/studio-dist/server/index.js +1 -1
- package/studio-dist/server/manifest.js +17 -17
- package/studio-dist/client/_app/immutable/chunks/DXc5naiV.js +0 -1
- package/studio-dist/client/_app/immutable/chunks/Df85SMwa.js +0 -3
- package/studio-dist/client/_app/immutable/entry/start.7vsH8DZ0.js +0 -1
- package/studio-dist/server/chunks/1-CWoxWSMd.js +0 -9
package/dist/cli/index.js
CHANGED
|
@@ -12274,7 +12274,12 @@ var init_operations_registry = __esm({
|
|
|
12274
12274
|
required: false,
|
|
12275
12275
|
description: "JS regex matched against project_path"
|
|
12276
12276
|
},
|
|
12277
|
-
{
|
|
12277
|
+
{
|
|
12278
|
+
name: "includeTemp",
|
|
12279
|
+
type: "boolean",
|
|
12280
|
+
required: false,
|
|
12281
|
+
description: "Match .temp/ or OS temp-directory paths"
|
|
12282
|
+
},
|
|
12278
12283
|
{
|
|
12279
12284
|
name: "includeTests",
|
|
12280
12285
|
type: "boolean",
|
|
@@ -12309,7 +12314,7 @@ var init_operations_registry = __esm({
|
|
|
12309
12314
|
name: "vacuum",
|
|
12310
12315
|
type: "boolean",
|
|
12311
12316
|
required: false,
|
|
12312
|
-
description: "After delete,
|
|
12317
|
+
description: "After delete, VACUUM the global registry store (<cleoHome>/cleo.db) to reclaim space (T9117 \xB7 T12324)"
|
|
12313
12318
|
}
|
|
12314
12319
|
]
|
|
12315
12320
|
},
|
|
@@ -16375,7 +16380,8 @@ var init_errors = __esm({
|
|
|
16375
16380
|
constructor(details) {
|
|
16376
16381
|
const linePart = details.line !== null ? `:${details.line}` : "";
|
|
16377
16382
|
super(
|
|
16378
|
-
`E_CHANGESET_YAML_INVALID: ${details.file}${linePart} invalid YAML frontmatter: ${details.parserMessage}`
|
|
16383
|
+
`E_CHANGESET_YAML_INVALID: ${details.file}${linePart} invalid YAML frontmatter: ${details.parserMessage}` + (details.hint !== void 0 ? `
|
|
16384
|
+
hint: ${details.hint}` : "")
|
|
16379
16385
|
);
|
|
16380
16386
|
this.name = "ChangesetYamlInvalidError";
|
|
16381
16387
|
this.details = details;
|
|
@@ -19348,7 +19354,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19348
19354
|
scope: "project",
|
|
19349
19355
|
effect: "write",
|
|
19350
19356
|
stores: ["nexus-graph"],
|
|
19351
|
-
requiresProject: true
|
|
19357
|
+
requiresProject: true,
|
|
19358
|
+
indexSensitive: true
|
|
19352
19359
|
},
|
|
19353
19360
|
"share.status": {
|
|
19354
19361
|
op: "share.status",
|
|
@@ -19372,7 +19379,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19372
19379
|
scope: "project",
|
|
19373
19380
|
effect: "read",
|
|
19374
19381
|
stores: ["nexus-graph"],
|
|
19375
|
-
requiresProject: true
|
|
19382
|
+
requiresProject: true,
|
|
19383
|
+
indexSensitive: true
|
|
19376
19384
|
},
|
|
19377
19385
|
impact: {
|
|
19378
19386
|
op: "impact",
|
|
@@ -19389,7 +19397,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19389
19397
|
scope: "project",
|
|
19390
19398
|
effect: "read",
|
|
19391
19399
|
stores: ["nexus-graph"],
|
|
19392
|
-
requiresProject: true
|
|
19400
|
+
requiresProject: true,
|
|
19401
|
+
indexSensitive: true
|
|
19393
19402
|
},
|
|
19394
19403
|
"task-footprint": {
|
|
19395
19404
|
op: "task-footprint",
|
|
@@ -19397,7 +19406,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19397
19406
|
scope: "hybrid",
|
|
19398
19407
|
effect: "read",
|
|
19399
19408
|
stores: ["nexus-graph", "tasks"],
|
|
19400
|
-
requiresProject: true
|
|
19409
|
+
requiresProject: true,
|
|
19410
|
+
indexSensitive: true
|
|
19401
19411
|
},
|
|
19402
19412
|
"brain-anchors": {
|
|
19403
19413
|
op: "brain-anchors",
|
|
@@ -19405,7 +19415,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19405
19415
|
scope: "hybrid",
|
|
19406
19416
|
effect: "read",
|
|
19407
19417
|
stores: ["nexus-graph", "brain"],
|
|
19408
|
-
requiresProject: true
|
|
19418
|
+
requiresProject: true,
|
|
19419
|
+
indexSensitive: true
|
|
19409
19420
|
},
|
|
19410
19421
|
why: {
|
|
19411
19422
|
op: "why",
|
|
@@ -19413,7 +19424,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19413
19424
|
scope: "hybrid",
|
|
19414
19425
|
effect: "read",
|
|
19415
19426
|
stores: ["nexus-graph", "brain"],
|
|
19416
|
-
requiresProject: true
|
|
19427
|
+
requiresProject: true,
|
|
19428
|
+
indexSensitive: true
|
|
19417
19429
|
},
|
|
19418
19430
|
"impact-full": {
|
|
19419
19431
|
op: "impact-full",
|
|
@@ -19430,7 +19442,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19430
19442
|
scope: "project",
|
|
19431
19443
|
effect: "read",
|
|
19432
19444
|
stores: ["nexus-graph"],
|
|
19433
|
-
requiresProject: true
|
|
19445
|
+
requiresProject: true,
|
|
19446
|
+
indexSensitive: true
|
|
19434
19447
|
},
|
|
19435
19448
|
"shape-check": {
|
|
19436
19449
|
op: "shape-check",
|
|
@@ -19438,7 +19451,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19438
19451
|
scope: "project",
|
|
19439
19452
|
effect: "read",
|
|
19440
19453
|
stores: ["nexus-graph"],
|
|
19441
|
-
requiresProject: true
|
|
19454
|
+
requiresProject: true,
|
|
19455
|
+
indexSensitive: true
|
|
19442
19456
|
},
|
|
19443
19457
|
"search-code": {
|
|
19444
19458
|
op: "search-code",
|
|
@@ -19446,7 +19460,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19446
19460
|
scope: "project",
|
|
19447
19461
|
effect: "read",
|
|
19448
19462
|
stores: ["nexus-graph", "fs"],
|
|
19449
|
-
requiresProject: true
|
|
19463
|
+
requiresProject: true,
|
|
19464
|
+
indexSensitive: true
|
|
19450
19465
|
},
|
|
19451
19466
|
wiki: {
|
|
19452
19467
|
op: "wiki",
|
|
@@ -19470,7 +19485,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19470
19485
|
scope: "hybrid",
|
|
19471
19486
|
effect: "read",
|
|
19472
19487
|
stores: ["nexus-graph", "tasks"],
|
|
19473
|
-
requiresProject: true
|
|
19488
|
+
requiresProject: true,
|
|
19489
|
+
indexSensitive: true
|
|
19474
19490
|
},
|
|
19475
19491
|
// ── Profile ops ───────────────────────────────────────────────────────────
|
|
19476
19492
|
"profile.view": {
|
|
@@ -19650,7 +19666,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19650
19666
|
scope: "project",
|
|
19651
19667
|
effect: "read",
|
|
19652
19668
|
stores: ["nexus-graph"],
|
|
19653
|
-
requiresProject: true
|
|
19669
|
+
requiresProject: true,
|
|
19670
|
+
indexSensitive: true
|
|
19654
19671
|
},
|
|
19655
19672
|
flows: {
|
|
19656
19673
|
op: "flows",
|
|
@@ -19658,7 +19675,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19658
19675
|
scope: "project",
|
|
19659
19676
|
effect: "read",
|
|
19660
19677
|
stores: ["nexus-graph"],
|
|
19661
|
-
requiresProject: true
|
|
19678
|
+
requiresProject: true,
|
|
19679
|
+
indexSensitive: true
|
|
19662
19680
|
},
|
|
19663
19681
|
context: {
|
|
19664
19682
|
op: "context",
|
|
@@ -19732,7 +19750,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19732
19750
|
scope: "project",
|
|
19733
19751
|
effect: "read",
|
|
19734
19752
|
stores: ["nexus-graph"],
|
|
19735
|
-
requiresProject: true
|
|
19753
|
+
requiresProject: true,
|
|
19754
|
+
indexSensitive: true
|
|
19736
19755
|
},
|
|
19737
19756
|
"hot-paths": {
|
|
19738
19757
|
op: "hot-paths",
|
|
@@ -19740,7 +19759,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19740
19759
|
scope: "project",
|
|
19741
19760
|
effect: "read",
|
|
19742
19761
|
stores: ["nexus-graph"],
|
|
19743
|
-
requiresProject: true
|
|
19762
|
+
requiresProject: true,
|
|
19763
|
+
indexSensitive: true
|
|
19744
19764
|
},
|
|
19745
19765
|
"hot-nodes": {
|
|
19746
19766
|
op: "hot-nodes",
|
|
@@ -19748,7 +19768,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19748
19768
|
scope: "project",
|
|
19749
19769
|
effect: "read",
|
|
19750
19770
|
stores: ["nexus-graph"],
|
|
19751
|
-
requiresProject: true
|
|
19771
|
+
requiresProject: true,
|
|
19772
|
+
indexSensitive: true
|
|
19752
19773
|
},
|
|
19753
19774
|
"cold-symbols": {
|
|
19754
19775
|
op: "cold-symbols",
|
|
@@ -19756,7 +19777,8 @@ var init_nexus_scope_map = __esm({
|
|
|
19756
19777
|
scope: "project",
|
|
19757
19778
|
effect: "read",
|
|
19758
19779
|
stores: ["nexus-graph"],
|
|
19759
|
-
requiresProject: true
|
|
19780
|
+
requiresProject: true,
|
|
19781
|
+
indexSensitive: true
|
|
19760
19782
|
}
|
|
19761
19783
|
};
|
|
19762
19784
|
}
|
|
@@ -31466,10 +31488,13 @@ var init_memory2 = __esm({
|
|
|
31466
31488
|
|
|
31467
31489
|
// packages/cleo/src/dispatch/domains/nexus.ts
|
|
31468
31490
|
import {
|
|
31491
|
+
assessNexusFreshnessForQuery,
|
|
31492
|
+
discloseNexusFreshness,
|
|
31469
31493
|
getBrainNativeDb as getBrainNativeDb2,
|
|
31470
31494
|
getLogger as getLogger6,
|
|
31471
31495
|
getNexusNativeDb,
|
|
31472
31496
|
getProjectRoot as getProjectRoot9,
|
|
31497
|
+
judgeSymbolFiles,
|
|
31473
31498
|
nexusAugment,
|
|
31474
31499
|
nexusBlockers,
|
|
31475
31500
|
nexusBrainAnchors,
|
|
@@ -31531,7 +31556,9 @@ import {
|
|
|
31531
31556
|
nexusTransferPreview,
|
|
31532
31557
|
nexusUnregisterProject,
|
|
31533
31558
|
nexusWhy,
|
|
31534
|
-
nexusWiki
|
|
31559
|
+
nexusWiki,
|
|
31560
|
+
querySymbolFiles,
|
|
31561
|
+
withNexusFreshnessMeta
|
|
31535
31562
|
} from "@cleocode/core/internal";
|
|
31536
31563
|
import { stampNexusMeta } from "@cleocode/runtime/gateway";
|
|
31537
31564
|
function nexusQueryEnvelopeToResponse(envelope, operation, startTime) {
|
|
@@ -31573,6 +31600,21 @@ function nexusMutateEnvelopeToResponse(envelope, operation, startTime) {
|
|
|
31573
31600
|
startTime
|
|
31574
31601
|
);
|
|
31575
31602
|
}
|
|
31603
|
+
function isScopeMapOp(operation) {
|
|
31604
|
+
return operation in NEXUS_SCOPE_MAP;
|
|
31605
|
+
}
|
|
31606
|
+
function answersFromGraph(operation) {
|
|
31607
|
+
if (FRESHNESS_EXEMPT_OPS.has(operation) || !isScopeMapOp(operation)) return false;
|
|
31608
|
+
return getNexusDescriptor(operation).indexSensitive === true;
|
|
31609
|
+
}
|
|
31610
|
+
function withFreshness(response, operation, assessment) {
|
|
31611
|
+
const freshness = judgeSymbolFiles(assessment, querySymbolFiles(response.data));
|
|
31612
|
+
discloseNexusFreshness(`nexus ${operation}`, freshness);
|
|
31613
|
+
return {
|
|
31614
|
+
...response,
|
|
31615
|
+
meta: { ...response.meta, ...withNexusFreshnessMeta(response.meta, freshness) }
|
|
31616
|
+
};
|
|
31617
|
+
}
|
|
31576
31618
|
async function handleTopEntries(operation, params, startTime) {
|
|
31577
31619
|
const rawLimit = params?.limit;
|
|
31578
31620
|
const limit = typeof rawLimit === "number" && Number.isFinite(rawLimit) && rawLimit > 0 ? Math.floor(rawLimit) : 20;
|
|
@@ -31739,10 +31781,11 @@ async function handleImpact(operation, params, startTime) {
|
|
|
31739
31781
|
});
|
|
31740
31782
|
return wrapResult(result, "query", "nexus", operation, startTime);
|
|
31741
31783
|
}
|
|
31742
|
-
var _nexusTypedHandler, QUERY_OPS7, MUTATE_OPS6, NexusHandler;
|
|
31784
|
+
var _nexusTypedHandler, QUERY_OPS7, MUTATE_OPS6, FRESHNESS_EXEMPT_OPS, NexusHandler;
|
|
31743
31785
|
var init_nexus2 = __esm({
|
|
31744
31786
|
"packages/cleo/src/dispatch/domains/nexus.ts"() {
|
|
31745
31787
|
"use strict";
|
|
31788
|
+
init_src2();
|
|
31746
31789
|
init_typed();
|
|
31747
31790
|
init_base();
|
|
31748
31791
|
_nexusTypedHandler = defineTypedHandler("nexus", {
|
|
@@ -32229,6 +32272,7 @@ var init_nexus2 = __esm({
|
|
|
32229
32272
|
"projects.clean",
|
|
32230
32273
|
"refresh-bridge"
|
|
32231
32274
|
]);
|
|
32275
|
+
FRESHNESS_EXEMPT_OPS = /* @__PURE__ */ new Set(["diff"]);
|
|
32232
32276
|
NexusHandler = class {
|
|
32233
32277
|
/**
|
|
32234
32278
|
* Execute a read-only nexus query operation.
|
|
@@ -32241,6 +32285,14 @@ var init_nexus2 = __esm({
|
|
|
32241
32285
|
if (!QUERY_OPS7.has(operation)) {
|
|
32242
32286
|
return unsupportedOp("query", "nexus", operation, startTime);
|
|
32243
32287
|
}
|
|
32288
|
+
if (answersFromGraph(operation)) {
|
|
32289
|
+
const assessment = await assessNexusFreshnessForQuery(getProjectRoot9());
|
|
32290
|
+
return withFreshness(await this.answer(operation, params, startTime), operation, assessment);
|
|
32291
|
+
}
|
|
32292
|
+
return this.answer(operation, params, startTime);
|
|
32293
|
+
}
|
|
32294
|
+
/** Run one validated query op and stamp its `_nexus` scope metadata. */
|
|
32295
|
+
async answer(operation, params, startTime) {
|
|
32244
32296
|
if (operation === "top-entries") {
|
|
32245
32297
|
const r = await handleTopEntries(operation, params, startTime);
|
|
32246
32298
|
return stampNexusMeta(r, operation, params ?? {});
|
|
@@ -37120,8 +37172,8 @@ async function loadPlaybookByName(name) {
|
|
|
37120
37172
|
return null;
|
|
37121
37173
|
}
|
|
37122
37174
|
try {
|
|
37123
|
-
const { getProjectRoot:
|
|
37124
|
-
const projectRoot = __playbookRuntimeOverrides.projectRoot ??
|
|
37175
|
+
const { getProjectRoot: getProjectRoot69 } = await import("@cleocode/core/internal");
|
|
37176
|
+
const projectRoot = __playbookRuntimeOverrides.projectRoot ?? getProjectRoot69();
|
|
37125
37177
|
const resolved = resolvePlaybook(name, {
|
|
37126
37178
|
projectRoot,
|
|
37127
37179
|
globalPlaybooksDir: __playbookRuntimeOverrides.globalPlaybooksDir,
|
|
@@ -37166,7 +37218,7 @@ async function buildDefaultDispatcher() {
|
|
|
37166
37218
|
if (__playbookRuntimeOverrides.dispatcher) return __playbookRuntimeOverrides.dispatcher;
|
|
37167
37219
|
const { orchestrateSpawnExecute: orchestrateSpawnExecute2 } = await import("@cleocode/runtime/gateway");
|
|
37168
37220
|
const {
|
|
37169
|
-
getProjectRoot:
|
|
37221
|
+
getProjectRoot: getProjectRoot69,
|
|
37170
37222
|
createToolGuard,
|
|
37171
37223
|
runSkillNodeOrSpawn,
|
|
37172
37224
|
maybeCreatePiRunner,
|
|
@@ -37174,7 +37226,7 @@ async function buildDefaultDispatcher() {
|
|
|
37174
37226
|
hasCantbookProfilePin,
|
|
37175
37227
|
DEFAULT_DETERMINISTIC_DENIED_COMMANDS
|
|
37176
37228
|
} = await import("@cleocode/core/internal");
|
|
37177
|
-
const projectRoot =
|
|
37229
|
+
const projectRoot = getProjectRoot69();
|
|
37178
37230
|
const tools = createToolGuard({
|
|
37179
37231
|
allowedRoots: [projectRoot],
|
|
37180
37232
|
deniedCommands: DEFAULT_DETERMINISTIC_DENIED_COMMANDS,
|
|
@@ -37267,12 +37319,12 @@ async function buildDefaultDeterministicRunner() {
|
|
|
37267
37319
|
return void 0;
|
|
37268
37320
|
}
|
|
37269
37321
|
const {
|
|
37270
|
-
getProjectRoot:
|
|
37322
|
+
getProjectRoot: getProjectRoot69,
|
|
37271
37323
|
createToolGuard,
|
|
37272
37324
|
createGuardedDeterministicRunner,
|
|
37273
37325
|
DEFAULT_DETERMINISTIC_DENIED_COMMANDS
|
|
37274
37326
|
} = await import("@cleocode/core/internal");
|
|
37275
|
-
const projectRoot =
|
|
37327
|
+
const projectRoot = getProjectRoot69();
|
|
37276
37328
|
const tools = createToolGuard({
|
|
37277
37329
|
allowedRoots: [projectRoot],
|
|
37278
37330
|
deniedCommands: DEFAULT_DETERMINISTIC_DENIED_COMMANDS,
|
|
@@ -37430,8 +37482,8 @@ var init_playbook2 = __esm({
|
|
|
37430
37482
|
projectRoot = __playbookRuntimeOverrides.projectRoot;
|
|
37431
37483
|
} else {
|
|
37432
37484
|
try {
|
|
37433
|
-
const { getProjectRoot:
|
|
37434
|
-
projectRoot =
|
|
37485
|
+
const { getProjectRoot: getProjectRoot69 } = await import("@cleocode/core/internal");
|
|
37486
|
+
projectRoot = getProjectRoot69();
|
|
37435
37487
|
} catch {
|
|
37436
37488
|
projectRoot = void 0;
|
|
37437
37489
|
}
|
|
@@ -37496,14 +37548,14 @@ var init_playbook2 = __esm({
|
|
|
37496
37548
|
const deterministicRunner = await buildDefaultDeterministicRunner();
|
|
37497
37549
|
let result;
|
|
37498
37550
|
try {
|
|
37499
|
-
const { getProjectRoot:
|
|
37551
|
+
const { getProjectRoot: getProjectRoot69 } = await import("@cleocode/core/internal");
|
|
37500
37552
|
const opts = {
|
|
37501
37553
|
db,
|
|
37502
37554
|
playbook: parsed.definition,
|
|
37503
37555
|
playbookHash: parsed.sourceHash,
|
|
37504
37556
|
initialContext,
|
|
37505
37557
|
dispatcher,
|
|
37506
|
-
projectRoot:
|
|
37558
|
+
projectRoot: getProjectRoot69()
|
|
37507
37559
|
};
|
|
37508
37560
|
if (deterministicRunner !== void 0) opts.deterministicRunner = deterministicRunner;
|
|
37509
37561
|
if (__playbookRuntimeOverrides.approvalSecret !== void 0) {
|
|
@@ -37948,7 +38000,7 @@ async function orchestrateClassify(request, context, projectRoot, taskId) {
|
|
|
37948
38000
|
try {
|
|
37949
38001
|
const { getCleoCantWorkflowsDir } = await import("@cleocode/core/internal");
|
|
37950
38002
|
const { readFileSync: readFileSync23, readdirSync: readdirSync3, existsSync: existsSync24 } = await import("node:fs");
|
|
37951
|
-
const { join:
|
|
38003
|
+
const { join: join41 } = await import("node:path");
|
|
37952
38004
|
const workflowsDir = getCleoCantWorkflowsDir();
|
|
37953
38005
|
const combined = `${request} ${context ?? ""}`.toLowerCase();
|
|
37954
38006
|
const matches = [];
|
|
@@ -37956,7 +38008,7 @@ async function orchestrateClassify(request, context, projectRoot, taskId) {
|
|
|
37956
38008
|
const files = readdirSync3(workflowsDir).filter((f) => f.endsWith(".cant"));
|
|
37957
38009
|
for (const file of files) {
|
|
37958
38010
|
try {
|
|
37959
|
-
const src = readFileSync23(
|
|
38011
|
+
const src = readFileSync23(join41(workflowsDir, file), "utf-8");
|
|
37960
38012
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
37961
38013
|
if (!teamMatch) continue;
|
|
37962
38014
|
const teamName = teamMatch[1];
|
|
@@ -37971,12 +38023,12 @@ async function orchestrateClassify(request, context, projectRoot, taskId) {
|
|
|
37971
38023
|
}
|
|
37972
38024
|
}
|
|
37973
38025
|
}
|
|
37974
|
-
const localCantDir =
|
|
38026
|
+
const localCantDir = join41(projectRoot, CLEO_DIR_NAME2, WORKFLOWS_SUBDIR);
|
|
37975
38027
|
if (existsSync24(localCantDir)) {
|
|
37976
38028
|
const files = readdirSync3(localCantDir).filter((f) => f.endsWith(".cant"));
|
|
37977
38029
|
for (const file of files) {
|
|
37978
38030
|
try {
|
|
37979
|
-
const src = readFileSync23(
|
|
38031
|
+
const src = readFileSync23(join41(localCantDir, file), "utf-8");
|
|
37980
38032
|
const teamMatch = /^team\s+(\S+):/m.exec(src);
|
|
37981
38033
|
if (!teamMatch) continue;
|
|
37982
38034
|
const teamName = teamMatch[1];
|
|
@@ -44750,11 +44802,11 @@ var init_security = __esm({
|
|
|
44750
44802
|
});
|
|
44751
44803
|
|
|
44752
44804
|
// packages/cleo/src/dispatch/middleware/sanitizer.ts
|
|
44753
|
-
function createSanitizer(
|
|
44805
|
+
function createSanitizer(getProjectRoot69) {
|
|
44754
44806
|
return async (req, next) => {
|
|
44755
44807
|
if (req.params) {
|
|
44756
44808
|
try {
|
|
44757
|
-
const root =
|
|
44809
|
+
const root = getProjectRoot69 ? getProjectRoot69() : void 0;
|
|
44758
44810
|
req.params = sanitizeParams(req.params, root, {
|
|
44759
44811
|
domain: req.domain,
|
|
44760
44812
|
operation: req.operation
|
|
@@ -46630,10 +46682,10 @@ var init_agent = __esm({
|
|
|
46630
46682
|
transportConfig: {},
|
|
46631
46683
|
isActive: true
|
|
46632
46684
|
});
|
|
46633
|
-
const { existsSync: existsSync24, mkdirSync: mkdirSync7, writeFileSync:
|
|
46634
|
-
const { join:
|
|
46635
|
-
const cantDir =
|
|
46636
|
-
const cantPath =
|
|
46685
|
+
const { existsSync: existsSync24, mkdirSync: mkdirSync7, writeFileSync: writeFileSync8 } = await import("node:fs");
|
|
46686
|
+
const { join: join41 } = await import("node:path");
|
|
46687
|
+
const cantDir = join41(CLEO_DIR_NAME3, AGENTS_SUBDIR);
|
|
46688
|
+
const cantPath = join41(cantDir, `${agentId}.cant`);
|
|
46637
46689
|
let cantScaffolded = false;
|
|
46638
46690
|
if (!existsSync24(cantPath)) {
|
|
46639
46691
|
mkdirSync7(cantDir, { recursive: true });
|
|
@@ -46686,7 +46738,7 @@ agent ${agentId}:
|
|
|
46686
46738
|
enforcement:
|
|
46687
46739
|
1: TODO \u2014 what does this agent push back on?
|
|
46688
46740
|
`;
|
|
46689
|
-
|
|
46741
|
+
writeFileSync8(cantPath, cantContent, "utf-8");
|
|
46690
46742
|
cantScaffolded = true;
|
|
46691
46743
|
}
|
|
46692
46744
|
cliOutput(
|
|
@@ -46815,7 +46867,7 @@ agent ${agentId}:
|
|
|
46815
46867
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
46816
46868
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
46817
46869
|
const { existsSync: existsSync24, readFileSync: readFileSync23 } = await import("node:fs");
|
|
46818
|
-
const { join:
|
|
46870
|
+
const { join: join41 } = await import("node:path");
|
|
46819
46871
|
await openCleoDb("project");
|
|
46820
46872
|
const registry = new AgentRegistryAccessor(getProjectRoot25());
|
|
46821
46873
|
const credential = await registry.get(args.agentId);
|
|
@@ -46835,7 +46887,7 @@ agent ${agentId}:
|
|
|
46835
46887
|
}
|
|
46836
46888
|
let profile = null;
|
|
46837
46889
|
let cantValidation = null;
|
|
46838
|
-
const cantPath = args.cant ??
|
|
46890
|
+
const cantPath = args.cant ?? join41(CLEO_DIR_NAME3, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
46839
46891
|
if (existsSync24(cantPath)) {
|
|
46840
46892
|
profile = readFileSync23(cantPath, "utf-8");
|
|
46841
46893
|
try {
|
|
@@ -47361,7 +47413,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
47361
47413
|
const { AgentRegistryAccessor } = await import("@cleocode/core/agents");
|
|
47362
47414
|
const { createRuntime } = await import("@cleocode/runtime");
|
|
47363
47415
|
const { existsSync: existsSync24 } = await import("node:fs");
|
|
47364
|
-
const { join:
|
|
47416
|
+
const { join: join41 } = await import("node:path");
|
|
47365
47417
|
await openCleoDb("project");
|
|
47366
47418
|
const registry = new AgentRegistryAccessor(getProjectRoot25());
|
|
47367
47419
|
const credential = await registry.get(args.agentId);
|
|
@@ -47378,7 +47430,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
47378
47430
|
}
|
|
47379
47431
|
await registry.update(args.agentId, { isActive: true });
|
|
47380
47432
|
await registry.markUsed(args.agentId);
|
|
47381
|
-
const cantPath =
|
|
47433
|
+
const cantPath = join41(CLEO_DIR_NAME3, AGENTS_SUBDIR, `${args.agentId}.cant`);
|
|
47382
47434
|
const hasProfile = existsSync24(cantPath);
|
|
47383
47435
|
const runtime = await createRuntime(registry, {
|
|
47384
47436
|
agentId: args.agentId,
|
|
@@ -48329,8 +48381,8 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
48329
48381
|
process.exitCode = 4;
|
|
48330
48382
|
return;
|
|
48331
48383
|
}
|
|
48332
|
-
const { join:
|
|
48333
|
-
const personaPath =
|
|
48384
|
+
const { join: join41 } = await import("node:path");
|
|
48385
|
+
const personaPath = join41(resolvedDir, "persona.cant");
|
|
48334
48386
|
if (!existsSync24(personaPath)) {
|
|
48335
48387
|
cliOutput(
|
|
48336
48388
|
{
|
|
@@ -48378,7 +48430,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
48378
48430
|
if (entry.isFile()) {
|
|
48379
48431
|
fileCount++;
|
|
48380
48432
|
} else if (entry.isDirectory()) {
|
|
48381
|
-
countFiles(
|
|
48433
|
+
countFiles(join41(dirPath, entry.name));
|
|
48382
48434
|
}
|
|
48383
48435
|
}
|
|
48384
48436
|
};
|
|
@@ -48627,7 +48679,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
48627
48679
|
async run({ args }) {
|
|
48628
48680
|
try {
|
|
48629
48681
|
const { existsSync: existsSync24, readFileSync: readFileSync23, mkdirSync: mkdirSync7 } = await import("node:fs");
|
|
48630
|
-
const { resolve: resolve13, join:
|
|
48682
|
+
const { resolve: resolve13, join: join41 } = await import("node:path");
|
|
48631
48683
|
const specPath = resolve13(args.spec);
|
|
48632
48684
|
if (!existsSync24(specPath)) {
|
|
48633
48685
|
cliError(`spec file not found: ${specPath}`, 4, { name: "E_NOT_FOUND" });
|
|
@@ -48636,7 +48688,7 @@ Task ${args.taskId} reassigned to you by ${active.agentId}. Run: cleo show ${arg
|
|
|
48636
48688
|
}
|
|
48637
48689
|
const specContent = readFileSync23(specPath, "utf-8");
|
|
48638
48690
|
const projectRoot = getProjectRoot25();
|
|
48639
|
-
const outputDir = args["output-dir"] ? resolve13(args["output-dir"]) :
|
|
48691
|
+
const outputDir = args["output-dir"] ? resolve13(args["output-dir"]) : join41(projectRoot, ".cleo", "cant", "agents");
|
|
48640
48692
|
mkdirSync7(outputDir, { recursive: true });
|
|
48641
48693
|
if (args["dry-run"]) {
|
|
48642
48694
|
cliOutput(
|
|
@@ -51357,6 +51409,63 @@ async function promptPassphrase() {
|
|
|
51357
51409
|
});
|
|
51358
51410
|
});
|
|
51359
51411
|
}
|
|
51412
|
+
async function resolvePassphrase() {
|
|
51413
|
+
let passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
|
|
51414
|
+
if (!passphrase) {
|
|
51415
|
+
try {
|
|
51416
|
+
passphrase = await promptPassphrase();
|
|
51417
|
+
} catch (promptErr) {
|
|
51418
|
+
passphrase = void 0;
|
|
51419
|
+
cliError(promptErr instanceof Error ? promptErr.message : String(promptErr), 6, {
|
|
51420
|
+
name: "E_PASSPHRASE_REQUIRED"
|
|
51421
|
+
});
|
|
51422
|
+
}
|
|
51423
|
+
}
|
|
51424
|
+
if (!passphrase) {
|
|
51425
|
+
if (process.exitCode === void 0) cliError("a passphrase is required", 6);
|
|
51426
|
+
process.exitCode = 6;
|
|
51427
|
+
return void 0;
|
|
51428
|
+
}
|
|
51429
|
+
return passphrase;
|
|
51430
|
+
}
|
|
51431
|
+
function collectFlagValues(rawArgs, flag) {
|
|
51432
|
+
const values = [];
|
|
51433
|
+
for (let i = 0; i < rawArgs.length; i++) {
|
|
51434
|
+
const arg = rawArgs[i] ?? "";
|
|
51435
|
+
if (arg === `--${flag}` && i + 1 < rawArgs.length) values.push(rawArgs[++i] ?? "");
|
|
51436
|
+
else if (arg.startsWith(`--${flag}=`)) values.push(arg.slice(flag.length + 3));
|
|
51437
|
+
}
|
|
51438
|
+
return values;
|
|
51439
|
+
}
|
|
51440
|
+
async function portableImport(bundlePath, target, mapValues, force) {
|
|
51441
|
+
const core2 = await import("@cleocode/core/store/portable-bundle-import.js");
|
|
51442
|
+
const { PortableBundleError } = await import("@cleocode/core/store/portable-bundle.js");
|
|
51443
|
+
try {
|
|
51444
|
+
const needsPass = isBundleEncrypted(bundlePath);
|
|
51445
|
+
const passphrase = needsPass ? await resolvePassphrase() : void 0;
|
|
51446
|
+
if (needsPass && passphrase === void 0) return;
|
|
51447
|
+
const result = await core2.importPortableBundle({
|
|
51448
|
+
bundlePath,
|
|
51449
|
+
passphrase,
|
|
51450
|
+
target,
|
|
51451
|
+
maps: core2.parsePathMappings(mapValues),
|
|
51452
|
+
force: force === true,
|
|
51453
|
+
requireLossless: true,
|
|
51454
|
+
registerProject: core2.registerRelocatedProject
|
|
51455
|
+
});
|
|
51456
|
+
cliOutput(result, { command: "backup", operation: "backup.import" });
|
|
51457
|
+
} catch (err) {
|
|
51458
|
+
reportBundleError(err, err instanceof PortableBundleError ? err : null, "E_IMPORT_FAILED");
|
|
51459
|
+
}
|
|
51460
|
+
}
|
|
51461
|
+
function reportBundleError(err, bundleErr, fallbackName) {
|
|
51462
|
+
const exitCode = bundleErr?.exitCode ?? 1;
|
|
51463
|
+
cliError(err instanceof Error ? err.message : String(err), exitCode, {
|
|
51464
|
+
name: bundleErr?.code ?? fallbackName,
|
|
51465
|
+
...bundleErr?.details !== void 0 ? { details: bundleErr.details } : {}
|
|
51466
|
+
});
|
|
51467
|
+
process.exitCode = exitCode;
|
|
51468
|
+
}
|
|
51360
51469
|
function checkForExistingData(projectRoot, cleoHome) {
|
|
51361
51470
|
const projectFiles = CLI_PROJECT_BACKUP_FILES;
|
|
51362
51471
|
const globalFiles = CLI_GLOBAL_BACKUP_FILES;
|
|
@@ -51464,7 +51573,7 @@ var init_backup = __esm({
|
|
|
51464
51573
|
exportCommand = defineCommand({
|
|
51465
51574
|
meta: {
|
|
51466
51575
|
name: "export",
|
|
51467
|
-
description: "Export
|
|
51576
|
+
description: "Export CLEO state to a portable .cleobundle.tar.gz (scopes: project | global | all | machine)"
|
|
51468
51577
|
},
|
|
51469
51578
|
args: {
|
|
51470
51579
|
name: {
|
|
@@ -51474,12 +51583,12 @@ var init_backup = __esm({
|
|
|
51474
51583
|
},
|
|
51475
51584
|
scope: {
|
|
51476
51585
|
type: "string",
|
|
51477
|
-
description: "project | global | all",
|
|
51586
|
+
description: "project | global | all | machine",
|
|
51478
51587
|
default: "project"
|
|
51479
51588
|
},
|
|
51480
51589
|
encrypt: {
|
|
51481
51590
|
type: "boolean",
|
|
51482
|
-
description: "Encrypt bundle with passphrase (AES-256-GCM via scrypt)"
|
|
51591
|
+
description: "Encrypt bundle with passphrase (AES-256-GCM via scrypt); required to carry secrets"
|
|
51483
51592
|
},
|
|
51484
51593
|
out: {
|
|
51485
51594
|
type: "string",
|
|
@@ -51488,64 +51597,32 @@ var init_backup = __esm({
|
|
|
51488
51597
|
},
|
|
51489
51598
|
async run({ args }) {
|
|
51490
51599
|
const scope = args.scope;
|
|
51491
|
-
|
|
51492
|
-
|
|
51493
|
-
|
|
51494
|
-
|
|
51495
|
-
|
|
51496
|
-
|
|
51497
|
-
passphrase = process.env["CLEO_BACKUP_PASSPHRASE"];
|
|
51498
|
-
if (!passphrase) {
|
|
51499
|
-
try {
|
|
51500
|
-
passphrase = await promptPassphrase();
|
|
51501
|
-
} catch (promptErr) {
|
|
51502
|
-
const msg = promptErr instanceof Error ? promptErr.message : String(promptErr);
|
|
51503
|
-
process.stderr.write(
|
|
51504
|
-
JSON.stringify({ success: false, error: { code: 6, message: msg } }) + "\n"
|
|
51505
|
-
);
|
|
51506
|
-
process.exitCode = 6;
|
|
51507
|
-
return;
|
|
51508
|
-
}
|
|
51509
|
-
}
|
|
51510
|
-
if (!passphrase) {
|
|
51511
|
-
process.stderr.write(
|
|
51512
|
-
JSON.stringify({
|
|
51513
|
-
success: false,
|
|
51514
|
-
error: { code: 6, message: "--encrypt requires a passphrase" }
|
|
51515
|
-
}) + "\n"
|
|
51516
|
-
);
|
|
51517
|
-
process.exitCode = 6;
|
|
51518
|
-
return;
|
|
51519
|
-
}
|
|
51600
|
+
if (scope !== "project" && scope !== "global" && scope !== "all" && scope !== "machine") {
|
|
51601
|
+
cliError(`--scope must be project, global, all or machine (got "${scope}")`, 6, {
|
|
51602
|
+
name: "E_VALIDATION"
|
|
51603
|
+
});
|
|
51604
|
+
process.exitCode = 6;
|
|
51605
|
+
return;
|
|
51520
51606
|
}
|
|
51607
|
+
const { exportPortableBundle, PortableBundleError } = await import("@cleocode/core/store/portable-bundle.js");
|
|
51608
|
+
const { getProjectRoot: getProjectRoot69 } = await import("@cleocode/core");
|
|
51609
|
+
const passphrase = args.encrypt === true ? await resolvePassphrase() : void 0;
|
|
51610
|
+
if (args.encrypt === true && passphrase === void 0) return;
|
|
51521
51611
|
const encSuffix = args.encrypt === true ? "enc." : "";
|
|
51522
|
-
const outputPath = args.out ?? `./${args.name}.${encSuffix}cleobundle.tar.gz`;
|
|
51523
51612
|
try {
|
|
51524
|
-
const result = await
|
|
51613
|
+
const result = await exportPortableBundle({
|
|
51525
51614
|
scope,
|
|
51526
|
-
projectRoot,
|
|
51527
|
-
outputPath
|
|
51615
|
+
projectRoot: scope === "project" || scope === "all" ? getProjectRoot69() : void 0,
|
|
51616
|
+
outputPath: args.out ?? `./${args.name}.${encSuffix}cleobundle.tar.gz`,
|
|
51528
51617
|
encrypt: args.encrypt === true,
|
|
51529
51618
|
passphrase,
|
|
51530
|
-
|
|
51619
|
+
label: args.name
|
|
51531
51620
|
});
|
|
51532
|
-
cliOutput(
|
|
51533
|
-
|
|
51534
|
-
|
|
51535
|
-
size: result.size,
|
|
51536
|
-
fileCount: result.fileCount,
|
|
51537
|
-
scope,
|
|
51538
|
-
encrypted: args.encrypt === true
|
|
51539
|
-
},
|
|
51540
|
-
{ command: "backup", operation: "backup.add" }
|
|
51541
|
-
);
|
|
51542
|
-
humanInfo(
|
|
51543
|
-
`Bundle written to ${result.bundlePath} (${result.size} bytes, ${result.fileCount} files)`
|
|
51544
|
-
);
|
|
51621
|
+
cliOutput(result, { command: "backup", operation: "backup.export" });
|
|
51622
|
+
humanInfo(`Bundle written to ${result.bundlePath} (${result.size} bytes)`);
|
|
51623
|
+
humanInfo(result.memory.notice);
|
|
51545
51624
|
} catch (err) {
|
|
51546
|
-
|
|
51547
|
-
process.stderr.write(JSON.stringify({ success: false, error: { code: 1, message } }) + "\n");
|
|
51548
|
-
process.exitCode = 1;
|
|
51625
|
+
reportBundleError(err, err instanceof PortableBundleError ? err : null, "E_EXPORT_FAILED");
|
|
51549
51626
|
}
|
|
51550
51627
|
}
|
|
51551
51628
|
});
|
|
@@ -51563,18 +51640,31 @@ var init_backup = __esm({
|
|
|
51563
51640
|
force: {
|
|
51564
51641
|
type: "boolean",
|
|
51565
51642
|
description: "Overwrite existing live data at target without aborting"
|
|
51643
|
+
},
|
|
51644
|
+
target: {
|
|
51645
|
+
type: "string",
|
|
51646
|
+
description: "Portable bundles: place a single-project bundle at this project root (paths are relocated)"
|
|
51647
|
+
},
|
|
51648
|
+
map: {
|
|
51649
|
+
type: "string",
|
|
51650
|
+
description: "Portable bundles: rewrite project paths <oldPrefix>=<newPrefix> (repeatable; longest prefix wins)"
|
|
51566
51651
|
}
|
|
51567
51652
|
},
|
|
51568
|
-
async run({ args }) {
|
|
51653
|
+
async run({ args, rawArgs }) {
|
|
51569
51654
|
const bundlePath = args.bundle;
|
|
51570
|
-
const {
|
|
51655
|
+
const { detectBundleFormat } = await import("@cleocode/core/store/portable-bundle-import.js");
|
|
51656
|
+
if (await detectBundleFormat(bundlePath) === "v2") {
|
|
51657
|
+
await portableImport(bundlePath, args.target, collectFlagValues(rawArgs, "map"), args.force);
|
|
51658
|
+
return;
|
|
51659
|
+
}
|
|
51660
|
+
const { getProjectRoot: getProjectRoot69, getCleoHome: getCleoHome8, getCleoVersion } = await import("@cleocode/core");
|
|
51571
51661
|
const { BundleError, cleanupStaging, unpackBundle } = await import("@cleocode/core/store/backup-unpack.js");
|
|
51572
51662
|
const { regenerateConfigJson, regenerateProjectContextJson, regenerateProjectInfoJson } = await import("@cleocode/core/store/regenerators.js");
|
|
51573
51663
|
const { regenerateAndCompare } = await import("@cleocode/core/store/restore-json-merge.js");
|
|
51574
51664
|
const { buildConflictReport, writeConflictReport } = await import("@cleocode/core/store/restore-conflict-report.js");
|
|
51575
|
-
const projectRoot =
|
|
51665
|
+
const projectRoot = getProjectRoot69();
|
|
51576
51666
|
if (args.force !== true) {
|
|
51577
|
-
const existing = checkForExistingData(projectRoot,
|
|
51667
|
+
const existing = checkForExistingData(projectRoot, getCleoHome8());
|
|
51578
51668
|
if (existing.length > 0) {
|
|
51579
51669
|
process.stderr.write(
|
|
51580
51670
|
JSON.stringify({
|
|
@@ -51630,7 +51720,7 @@ var init_backup = __esm({
|
|
|
51630
51720
|
for (const dbEntry of manifest.databases) {
|
|
51631
51721
|
const src = path2.join(stagingDir, dbEntry.filename);
|
|
51632
51722
|
if (!fs2.existsSync(src)) continue;
|
|
51633
|
-
const dst = resolveDbTarget(projectRoot, dbEntry.name,
|
|
51723
|
+
const dst = resolveDbTarget(projectRoot, dbEntry.name, getCleoHome8());
|
|
51634
51724
|
fs2.mkdirSync(path2.dirname(dst), { recursive: true });
|
|
51635
51725
|
const tmpDst = `${dst}.import-tmp-${Date.now()}`;
|
|
51636
51726
|
fs2.copyFileSync(src, tmpDst);
|
|
@@ -51673,7 +51763,7 @@ var init_backup = __esm({
|
|
|
51673
51763
|
reports: jsonReports,
|
|
51674
51764
|
bundlePath,
|
|
51675
51765
|
sourceMachineFingerprint: manifest.backup.machineFingerprint,
|
|
51676
|
-
targetMachineFingerprint: sha256OfMachineKey(
|
|
51766
|
+
targetMachineFingerprint: sha256OfMachineKey(getCleoHome8()),
|
|
51677
51767
|
cleoVersion,
|
|
51678
51768
|
schemaWarnings: warnings.map((w) => ({
|
|
51679
51769
|
db: w.db,
|
|
@@ -53509,7 +53599,7 @@ var init_check3 = __esm({
|
|
|
53509
53599
|
async run({ args }) {
|
|
53510
53600
|
const { spawnSync: spawnSync2 } = await import("node:child_process");
|
|
53511
53601
|
const { existsSync: existsSync24 } = await import("node:fs");
|
|
53512
|
-
const { join:
|
|
53602
|
+
const { join: join41, resolve: resolve13 } = await import("node:path");
|
|
53513
53603
|
const strict = Boolean(args.strict);
|
|
53514
53604
|
const jsonOnly = Boolean(args.json);
|
|
53515
53605
|
const repoRoot = resolve13(process.cwd());
|
|
@@ -53701,7 +53791,7 @@ var init_check3 = __esm({
|
|
|
53701
53791
|
const results = [];
|
|
53702
53792
|
let anyFailed = false;
|
|
53703
53793
|
for (const gate of gates) {
|
|
53704
|
-
const scriptPath =
|
|
53794
|
+
const scriptPath = join41(repoRoot, gate.script);
|
|
53705
53795
|
if (!existsSync24(scriptPath)) {
|
|
53706
53796
|
results.push({
|
|
53707
53797
|
id: gate.id,
|
|
@@ -54153,9 +54243,9 @@ var init_code = __esm({
|
|
|
54153
54243
|
async run({ args }) {
|
|
54154
54244
|
await requireTreeSitter();
|
|
54155
54245
|
const { smartOutline } = await import("@cleocode/core/internal");
|
|
54156
|
-
const { join:
|
|
54246
|
+
const { join: join41 } = await import("node:path");
|
|
54157
54247
|
const root = process.cwd();
|
|
54158
|
-
const absPath = args.file.startsWith("/") ? args.file :
|
|
54248
|
+
const absPath = args.file.startsWith("/") ? args.file : join41(root, args.file);
|
|
54159
54249
|
const result = smartOutline(absPath, root);
|
|
54160
54250
|
if (result.errors.length > 0 && result.symbols.length === 0) {
|
|
54161
54251
|
cliError(result.errors.join(", "), 1, { name: "E_OUTLINE_FAILED" });
|
|
@@ -54246,9 +54336,9 @@ var init_code = __esm({
|
|
|
54246
54336
|
async run({ args }) {
|
|
54247
54337
|
await requireTreeSitter();
|
|
54248
54338
|
const { smartUnfold } = await import("@cleocode/core/internal");
|
|
54249
|
-
const { join:
|
|
54339
|
+
const { join: join41 } = await import("node:path");
|
|
54250
54340
|
const root = process.cwd();
|
|
54251
|
-
const absPath = args.file.startsWith("/") ? args.file :
|
|
54341
|
+
const absPath = args.file.startsWith("/") ? args.file : join41(root, args.file);
|
|
54252
54342
|
const result = smartUnfold(absPath, args.symbol, root);
|
|
54253
54343
|
if (!result.found) {
|
|
54254
54344
|
const errs = result.errors.length > 0 ? `: ${result.errors.join(", ")}` : "";
|
|
@@ -61277,12 +61367,74 @@ var init_doctor_acceptance_drift = __esm({
|
|
|
61277
61367
|
}
|
|
61278
61368
|
});
|
|
61279
61369
|
|
|
61370
|
+
// packages/cleo/src/cli/commands/doctor-credentials.ts
|
|
61371
|
+
var doctor_credentials_exports = {};
|
|
61372
|
+
__export(doctor_credentials_exports, {
|
|
61373
|
+
doctorCredentialsCommand: () => doctorCredentialsCommand
|
|
61374
|
+
});
|
|
61375
|
+
import { join as join23 } from "node:path";
|
|
61376
|
+
import { getCleoHome as getCleoHome5, getProjectRoot as getProjectRoot42 } from "@cleocode/core/paths.js";
|
|
61377
|
+
import {
|
|
61378
|
+
auditAgentRegistryKeys,
|
|
61379
|
+
migrateProjectCredentialsAtRoot
|
|
61380
|
+
} from "@cleocode/core/store/credential-transfer.js";
|
|
61381
|
+
var doctorCredentialsCommand;
|
|
61382
|
+
var init_doctor_credentials = __esm({
|
|
61383
|
+
"packages/cleo/src/cli/commands/doctor-credentials.ts"() {
|
|
61384
|
+
"use strict";
|
|
61385
|
+
init_define_cli_command();
|
|
61386
|
+
init_renderers();
|
|
61387
|
+
doctorCredentialsCommand = defineCommand({
|
|
61388
|
+
meta: {
|
|
61389
|
+
name: "credentials",
|
|
61390
|
+
description: "Report project credentials still encrypted under the legacy path-bound key (moving the project would strand them) and agent registry keys that are not recoverable. --fix re-keys project credentials to the project's identity in place and flags unrecoverable agent keys requires_reauth. Idempotent; never deletes. Unrecoverable credentials are listed with their re-entry command."
|
|
61391
|
+
},
|
|
61392
|
+
args: {
|
|
61393
|
+
fix: {
|
|
61394
|
+
type: "boolean",
|
|
61395
|
+
description: "Re-key path-bound credentials in place (default: report only)."
|
|
61396
|
+
},
|
|
61397
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
61398
|
+
human: { type: "boolean", description: "Force human-readable output" },
|
|
61399
|
+
quiet: { type: "boolean", description: "Suppress non-essential output" }
|
|
61400
|
+
},
|
|
61401
|
+
async run({ args }) {
|
|
61402
|
+
const dryRun = args.fix !== true;
|
|
61403
|
+
const result = await migrateProjectCredentialsAtRoot(getProjectRoot42(), { dryRun });
|
|
61404
|
+
const agents = await auditAgentRegistryKeys(join23(getCleoHome5(), "cleo.db"), { dryRun });
|
|
61405
|
+
cliOutput(
|
|
61406
|
+
{
|
|
61407
|
+
projectDbPath: result.projectDbPath,
|
|
61408
|
+
projectId: result.projectId,
|
|
61409
|
+
applied: !result.dryRun,
|
|
61410
|
+
[result.dryRun ? "wouldMigrate" : "migrated"]: result.migrated,
|
|
61411
|
+
current: result.current,
|
|
61412
|
+
requiresReentry: result.reentry,
|
|
61413
|
+
agentRegistry: {
|
|
61414
|
+
globalDbPath: agents.globalDbPath,
|
|
61415
|
+
current: agents.current,
|
|
61416
|
+
requiresReentry: agents.reentry,
|
|
61417
|
+
flaggedRequiresReauth: agents.flagged
|
|
61418
|
+
}
|
|
61419
|
+
},
|
|
61420
|
+
{ command: "doctor", operation: "doctor.credentials.run" }
|
|
61421
|
+
);
|
|
61422
|
+
const pending = result.dryRun && result.migrated.length > 0;
|
|
61423
|
+
const unrecoverable = result.reentry.length + agents.reentry.length;
|
|
61424
|
+
if ((pending || unrecoverable > 0) && (process.exitCode ?? 0) === 0) {
|
|
61425
|
+
process.exitCode = 1;
|
|
61426
|
+
}
|
|
61427
|
+
}
|
|
61428
|
+
});
|
|
61429
|
+
}
|
|
61430
|
+
});
|
|
61431
|
+
|
|
61280
61432
|
// packages/cleo/src/cli/commands/doctor-db-substrate.ts
|
|
61281
61433
|
var doctor_db_substrate_exports = {};
|
|
61282
61434
|
__export(doctor_db_substrate_exports, {
|
|
61283
61435
|
doctorDbSubstrateCommand: () => doctorDbSubstrateCommand
|
|
61284
61436
|
});
|
|
61285
|
-
import { getProjectRoot as
|
|
61437
|
+
import { getProjectRoot as getProjectRoot43, pushWarning as pushWarning4 } from "@cleocode/core";
|
|
61286
61438
|
import { surveyDbSubstrate, surveyFleetDbSubstrate } from "@cleocode/core/doctor/db-substrate.js";
|
|
61287
61439
|
function pushSubstrateWarnings(result) {
|
|
61288
61440
|
for (const warning of result.warnings) {
|
|
@@ -61415,7 +61567,7 @@ var init_doctor_db_substrate = __esm({
|
|
|
61415
61567
|
const result = isFleet ? surveyFleetDbSubstrate(
|
|
61416
61568
|
typeof args["fleet-root"] === "string" && args["fleet-root"].length > 0 ? args["fleet-root"] : DEFAULT_FLEET_ROOT,
|
|
61417
61569
|
options
|
|
61418
|
-
) : surveyDbSubstrate(
|
|
61570
|
+
) : surveyDbSubstrate(getProjectRoot43(), options);
|
|
61419
61571
|
pushSubstrateWarnings(result);
|
|
61420
61572
|
pushPerDbWarnings(result);
|
|
61421
61573
|
cliOutput(result, {
|
|
@@ -61679,7 +61831,7 @@ var doctor_legacy_backups_exports = {};
|
|
|
61679
61831
|
__export(doctor_legacy_backups_exports, {
|
|
61680
61832
|
doctorLegacyBackupsCommand: () => doctorLegacyBackupsCommand
|
|
61681
61833
|
});
|
|
61682
|
-
import { getProjectRoot as
|
|
61834
|
+
import { getProjectRoot as getProjectRoot44 } from "@cleocode/core";
|
|
61683
61835
|
import { pruneLegacyBackups, scanLegacyBackups } from "@cleocode/core/doctor/legacy-backups.js";
|
|
61684
61836
|
function parsePositiveInt(raw, fallback) {
|
|
61685
61837
|
if (raw === void 0 || raw === null) return fallback;
|
|
@@ -61723,7 +61875,7 @@ var init_doctor_legacy_backups = __esm({
|
|
|
61723
61875
|
async run({ args }) {
|
|
61724
61876
|
const softRetentionDays = parsePositiveInt(args["soft-retention-days"], 30);
|
|
61725
61877
|
const hardRetentionDays = parsePositiveInt(args["hard-retention-days"], 90);
|
|
61726
|
-
const projectRoot =
|
|
61878
|
+
const projectRoot = getProjectRoot44();
|
|
61727
61879
|
let result;
|
|
61728
61880
|
if (args.prune === true) {
|
|
61729
61881
|
const dryRun = args["dry-run"] !== false;
|
|
@@ -61789,7 +61941,7 @@ var doctor_malformed_ids_exports = {};
|
|
|
61789
61941
|
__export(doctor_malformed_ids_exports, {
|
|
61790
61942
|
doctorMalformedIdsCommand: () => doctorMalformedIdsCommand
|
|
61791
61943
|
});
|
|
61792
|
-
import { getProjectRoot as
|
|
61944
|
+
import { getProjectRoot as getProjectRoot45 } from "@cleocode/core";
|
|
61793
61945
|
import { scanMalformedTaskIds } from "@cleocode/core/doctor/malformed-task-ids.js";
|
|
61794
61946
|
var doctorMalformedIdsCommand;
|
|
61795
61947
|
var init_doctor_malformed_ids = __esm({
|
|
@@ -61812,7 +61964,7 @@ var init_doctor_malformed_ids = __esm({
|
|
|
61812
61964
|
quiet: { type: "boolean", description: "Suppress non-essential output" }
|
|
61813
61965
|
},
|
|
61814
61966
|
async run({ args }) {
|
|
61815
|
-
const report = await scanMalformedTaskIds(
|
|
61967
|
+
const report = await scanMalformedTaskIds(getProjectRoot45(), { fix: args.fix === true });
|
|
61816
61968
|
cliOutput(report, {
|
|
61817
61969
|
command: "doctor",
|
|
61818
61970
|
operation: "doctor.malformed-ids.run"
|
|
@@ -61895,7 +62047,7 @@ var doctor_nexus_residency_exports = {};
|
|
|
61895
62047
|
__export(doctor_nexus_residency_exports, {
|
|
61896
62048
|
doctorNexusResidencyCommand: () => doctorNexusResidencyCommand
|
|
61897
62049
|
});
|
|
61898
|
-
import { getCleoHome as
|
|
62050
|
+
import { getCleoHome as getCleoHome6, getProjectRoot as getProjectRoot46 } from "@cleocode/core";
|
|
61899
62051
|
import { scanNexusSchemaResidency } from "@cleocode/core/doctor/nexus-schema-residency.js";
|
|
61900
62052
|
var doctorNexusResidencyCommand;
|
|
61901
62053
|
var init_doctor_nexus_residency = __esm({
|
|
@@ -61914,7 +62066,7 @@ var init_doctor_nexus_residency = __esm({
|
|
|
61914
62066
|
quiet: { type: "boolean", description: "Suppress non-essential output" }
|
|
61915
62067
|
},
|
|
61916
62068
|
async run() {
|
|
61917
|
-
const result = scanNexusSchemaResidency(
|
|
62069
|
+
const result = scanNexusSchemaResidency(getProjectRoot46(), getCleoHome6());
|
|
61918
62070
|
cliOutput(result, {
|
|
61919
62071
|
command: "doctor",
|
|
61920
62072
|
operation: "doctor.nexus-residency.run"
|
|
@@ -61927,6 +62079,52 @@ var init_doctor_nexus_residency = __esm({
|
|
|
61927
62079
|
}
|
|
61928
62080
|
});
|
|
61929
62081
|
|
|
62082
|
+
// packages/cleo/src/cli/commands/doctor-project-identity.ts
|
|
62083
|
+
var doctor_project_identity_exports = {};
|
|
62084
|
+
__export(doctor_project_identity_exports, {
|
|
62085
|
+
doctorProjectIdentityCommand: () => doctorProjectIdentityCommand
|
|
62086
|
+
});
|
|
62087
|
+
import { getProjectRoot as getProjectRoot47 } from "@cleocode/core";
|
|
62088
|
+
import {
|
|
62089
|
+
inspectProjectIdentity,
|
|
62090
|
+
resolveProjectIdentity
|
|
62091
|
+
} from "@cleocode/core/doctor/project-identity.js";
|
|
62092
|
+
var doctorProjectIdentityCommand;
|
|
62093
|
+
var init_doctor_project_identity = __esm({
|
|
62094
|
+
"packages/cleo/src/cli/commands/doctor-project-identity.ts"() {
|
|
62095
|
+
"use strict";
|
|
62096
|
+
init_define_cli_command();
|
|
62097
|
+
init_renderers();
|
|
62098
|
+
doctorProjectIdentityCommand = defineCommand({
|
|
62099
|
+
meta: {
|
|
62100
|
+
name: "project-identity",
|
|
62101
|
+
description: "Check .cleo/project-id against project-info.json (missing / conflict / invalid / untracked) and print the exact remedy. --resolve applies it (a conflict is re-keyed to the tracked id through the alias table, losing no registry rows); add --dry-run to see the plan first."
|
|
62102
|
+
},
|
|
62103
|
+
args: {
|
|
62104
|
+
resolve: { type: "boolean", description: "Apply the remedy for the reported state" },
|
|
62105
|
+
"dry-run": { type: "boolean", description: "With --resolve: print the plan, write nothing" },
|
|
62106
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
62107
|
+
human: { type: "boolean", description: "Force human-readable output" },
|
|
62108
|
+
quiet: { type: "boolean", description: "Suppress non-essential output" }
|
|
62109
|
+
},
|
|
62110
|
+
async run({ args }) {
|
|
62111
|
+
const projectRoot = getProjectRoot47();
|
|
62112
|
+
if (!args.resolve) {
|
|
62113
|
+
const report = inspectProjectIdentity(projectRoot);
|
|
62114
|
+
cliOutput(report, { command: "doctor", operation: "doctor.project-identity.inspect" });
|
|
62115
|
+
if (report.state !== "ok" && (process.exitCode === void 0 || process.exitCode === 0))
|
|
62116
|
+
process.exitCode = 1;
|
|
62117
|
+
return;
|
|
62118
|
+
}
|
|
62119
|
+
const result = await resolveProjectIdentity(projectRoot, { dryRun: !!args["dry-run"] });
|
|
62120
|
+
cliOutput(result, { command: "doctor", operation: "doctor.project-identity.resolve" });
|
|
62121
|
+
if (result.refused && result.before.state !== "ok" && (process.exitCode ?? 0) === 0)
|
|
62122
|
+
process.exitCode = 1;
|
|
62123
|
+
}
|
|
62124
|
+
});
|
|
62125
|
+
}
|
|
62126
|
+
});
|
|
62127
|
+
|
|
61930
62128
|
// packages/cleo/src/cli/commands/doctor-projects.ts
|
|
61931
62129
|
var doctor_projects_exports = {};
|
|
61932
62130
|
__export(doctor_projects_exports, {
|
|
@@ -62076,7 +62274,7 @@ __export(doctor_release_readiness_exports, {
|
|
|
62076
62274
|
doctorReleaseReadinessCommand: () => doctorReleaseReadinessCommand
|
|
62077
62275
|
});
|
|
62078
62276
|
import { existsSync as existsSync14 } from "node:fs";
|
|
62079
|
-
import { join as
|
|
62277
|
+
import { join as join24, resolve as resolve7 } from "node:path";
|
|
62080
62278
|
async function runCheck(name, cmd, args, cwd) {
|
|
62081
62279
|
const { spawnSync: spawnSync2 } = await import("node:child_process");
|
|
62082
62280
|
const start = Date.now();
|
|
@@ -62117,7 +62315,7 @@ var init_doctor_release_readiness = __esm({
|
|
|
62117
62315
|
const repoRoot = resolve7(process.cwd());
|
|
62118
62316
|
const startTotal = Date.now();
|
|
62119
62317
|
const checks = [];
|
|
62120
|
-
const biomePath =
|
|
62318
|
+
const biomePath = join24(repoRoot, "node_modules", ".bin", "biome");
|
|
62121
62319
|
const biomeAvailable = existsSync14(biomePath);
|
|
62122
62320
|
if (biomeAvailable) {
|
|
62123
62321
|
checks.push(await runCheck("biome-lint", biomePath, ["ci", "."], repoRoot));
|
|
@@ -62131,7 +62329,7 @@ var init_doctor_release_readiness = __esm({
|
|
|
62131
62329
|
stderr: "biome not found in node_modules/.bin \u2014 skipping"
|
|
62132
62330
|
});
|
|
62133
62331
|
}
|
|
62134
|
-
const changesetLintScript =
|
|
62332
|
+
const changesetLintScript = join24(repoRoot, "scripts", "lint-changesets.mjs");
|
|
62135
62333
|
if (existsSync14(changesetLintScript)) {
|
|
62136
62334
|
checks.push(await runCheck("changeset-lint", "node", [changesetLintScript], repoRoot));
|
|
62137
62335
|
} else {
|
|
@@ -62144,7 +62342,7 @@ var init_doctor_release_readiness = __esm({
|
|
|
62144
62342
|
stderr: "scripts/lint-changesets.mjs not found \u2014 skipping"
|
|
62145
62343
|
});
|
|
62146
62344
|
}
|
|
62147
|
-
const changelogPath =
|
|
62345
|
+
const changelogPath = join24(repoRoot, "CHANGELOG.md");
|
|
62148
62346
|
const changelogExists = existsSync14(changelogPath);
|
|
62149
62347
|
const changelogCheck = {
|
|
62150
62348
|
name: "changelog-exists",
|
|
@@ -62155,7 +62353,7 @@ var init_doctor_release_readiness = __esm({
|
|
|
62155
62353
|
stderr: changelogExists ? "" : `CHANGELOG.md not found at ${changelogPath}`
|
|
62156
62354
|
};
|
|
62157
62355
|
checks.push(changelogCheck);
|
|
62158
|
-
const packageJsonPath =
|
|
62356
|
+
const packageJsonPath = join24(repoRoot, "package.json");
|
|
62159
62357
|
let oidcCheck;
|
|
62160
62358
|
if (existsSync14(packageJsonPath)) {
|
|
62161
62359
|
try {
|
|
@@ -62204,7 +62402,7 @@ var init_doctor_release_readiness = __esm({
|
|
|
62204
62402
|
};
|
|
62205
62403
|
}
|
|
62206
62404
|
checks.push(oidcCheck);
|
|
62207
|
-
const tagWorkflowPath =
|
|
62405
|
+
const tagWorkflowPath = join24(repoRoot, ".github", "workflows", "auto-tag-on-release-merge.yml");
|
|
62208
62406
|
const tagWorkflowExists = existsSync14(tagWorkflowPath);
|
|
62209
62407
|
let tagTriggerCheck;
|
|
62210
62408
|
if (tagWorkflowExists) {
|
|
@@ -62244,9 +62442,9 @@ var init_doctor_release_readiness = __esm({
|
|
|
62244
62442
|
};
|
|
62245
62443
|
}
|
|
62246
62444
|
checks.push(tagTriggerCheck);
|
|
62247
|
-
const tsconfigPath =
|
|
62445
|
+
const tsconfigPath = join24(repoRoot, "tsconfig.json");
|
|
62248
62446
|
if (existsSync14(tsconfigPath)) {
|
|
62249
|
-
const tscPath =
|
|
62447
|
+
const tscPath = join24(repoRoot, "node_modules", ".bin", "tsc");
|
|
62250
62448
|
if (existsSync14(tscPath)) {
|
|
62251
62449
|
checks.push(await runCheck("typecheck", tscPath, ["--noEmit"], repoRoot));
|
|
62252
62450
|
} else {
|
|
@@ -62275,7 +62473,7 @@ var init_doctor_release_readiness = __esm({
|
|
|
62275
62473
|
{ name: "json-stream-lint", script: "scripts/lint-json-stream-hygiene.mjs" }
|
|
62276
62474
|
];
|
|
62277
62475
|
for (const lint of fastLintScripts) {
|
|
62278
|
-
const scriptPath =
|
|
62476
|
+
const scriptPath = join24(repoRoot, lint.script);
|
|
62279
62477
|
if (existsSync14(scriptPath)) {
|
|
62280
62478
|
checks.push(await runCheck(lint.name, "node", [scriptPath], repoRoot));
|
|
62281
62479
|
} else {
|
|
@@ -62338,7 +62536,7 @@ var doctor_repair_exports = {};
|
|
|
62338
62536
|
__export(doctor_repair_exports, {
|
|
62339
62537
|
doctorRepairCommand: () => doctorRepairCommand
|
|
62340
62538
|
});
|
|
62341
|
-
import { getLogger as getLogger21, getProjectRoot as
|
|
62539
|
+
import { getLogger as getLogger21, getProjectRoot as getProjectRoot48 } from "@cleocode/core";
|
|
62342
62540
|
import { repairMalformedDbs } from "@cleocode/core/store/repair-malformed-dbs.js";
|
|
62343
62541
|
var doctorRepairCommand;
|
|
62344
62542
|
var init_doctor_repair = __esm({
|
|
@@ -62382,7 +62580,7 @@ var init_doctor_repair = __esm({
|
|
|
62382
62580
|
return;
|
|
62383
62581
|
}
|
|
62384
62582
|
const result = repairMalformedDbs({
|
|
62385
|
-
projectRoot:
|
|
62583
|
+
projectRoot: getProjectRoot48(),
|
|
62386
62584
|
roles: roleArg.length > 0 ? [roleArg] : void 0,
|
|
62387
62585
|
dryRun,
|
|
62388
62586
|
logger: getLogger21("doctor-repair")
|
|
@@ -62405,13 +62603,92 @@ var init_doctor_repair = __esm({
|
|
|
62405
62603
|
}
|
|
62406
62604
|
});
|
|
62407
62605
|
|
|
62606
|
+
// packages/cleo/src/cli/commands/doctor-split-brain.ts
|
|
62607
|
+
var doctor_split_brain_exports = {};
|
|
62608
|
+
__export(doctor_split_brain_exports, {
|
|
62609
|
+
doctorSplitBrainCommand: () => doctorSplitBrainCommand
|
|
62610
|
+
});
|
|
62611
|
+
import { writeFileSync as writeFileSync4 } from "node:fs";
|
|
62612
|
+
import {
|
|
62613
|
+
importSplitBrain,
|
|
62614
|
+
verifyPreexistingRows
|
|
62615
|
+
} from "@cleocode/core/store/split-brain-import.js";
|
|
62616
|
+
var doctorSplitBrainCommand;
|
|
62617
|
+
var init_doctor_split_brain = __esm({
|
|
62618
|
+
"packages/cleo/src/cli/commands/doctor-split-brain.ts"() {
|
|
62619
|
+
"use strict";
|
|
62620
|
+
init_define_cli_command();
|
|
62621
|
+
init_renderers();
|
|
62622
|
+
doctorSplitBrainCommand = defineCommand({
|
|
62623
|
+
meta: {
|
|
62624
|
+
name: "split-brain",
|
|
62625
|
+
description: "Import rows that exist only in a diverged copy of a store (--source) into another (--target) under new task ids, with provenance. Dry-run unless --apply; --verify-before <snapshot> proves no pre-existing target row changed."
|
|
62626
|
+
},
|
|
62627
|
+
args: {
|
|
62628
|
+
source: {
|
|
62629
|
+
type: "string",
|
|
62630
|
+
description: "Store with the extra rows (opened read-only)",
|
|
62631
|
+
required: true
|
|
62632
|
+
},
|
|
62633
|
+
target: { type: "string", description: "Store that receives them", required: true },
|
|
62634
|
+
apply: { type: "boolean", description: "Write the target (default: dry run)" },
|
|
62635
|
+
label: { type: "string", description: "Provenance label for the source (default: its path)" },
|
|
62636
|
+
"diverged-after": {
|
|
62637
|
+
type: "string",
|
|
62638
|
+
description: "Override the detected divergence point (ISO 8601)"
|
|
62639
|
+
},
|
|
62640
|
+
receipt: { type: "string", description: "Also write the receipt JSON to this file" },
|
|
62641
|
+
task: {
|
|
62642
|
+
type: "string",
|
|
62643
|
+
description: "Task that records provenance of imported non-task rows (required with --apply when there are any)"
|
|
62644
|
+
},
|
|
62645
|
+
"verify-before": {
|
|
62646
|
+
type: "string",
|
|
62647
|
+
description: "Pre-import snapshot of the target; verify every one of its rows is unchanged"
|
|
62648
|
+
},
|
|
62649
|
+
json: { type: "boolean", description: "Output as JSON" },
|
|
62650
|
+
human: { type: "boolean", description: "Force human-readable output" },
|
|
62651
|
+
quiet: { type: "boolean", description: "Suppress non-essential output" }
|
|
62652
|
+
},
|
|
62653
|
+
async run({ args }) {
|
|
62654
|
+
const report = importSplitBrain({
|
|
62655
|
+
sourcePath: String(args.source),
|
|
62656
|
+
targetPath: String(args.target),
|
|
62657
|
+
dryRun: !args.apply,
|
|
62658
|
+
sourceLabel: args.label ? String(args.label) : void 0,
|
|
62659
|
+
divergedAfter: args["diverged-after"] ? String(args["diverged-after"]) : void 0,
|
|
62660
|
+
provenanceTaskId: args.task ? String(args.task) : void 0
|
|
62661
|
+
});
|
|
62662
|
+
const verification = args["verify-before"] ? verifyPreexistingRows(String(args["verify-before"]), String(args.target)) : void 0;
|
|
62663
|
+
const changed = verification?.filter((check) => check.missingOrChanged > 0) ?? [];
|
|
62664
|
+
const result = {
|
|
62665
|
+
...report,
|
|
62666
|
+
...verification && {
|
|
62667
|
+
verification: {
|
|
62668
|
+
tablesChecked: verification.length,
|
|
62669
|
+
rowsBefore: verification.reduce((sum, check) => sum + check.before, 0),
|
|
62670
|
+
rowsAfter: verification.reduce((sum, check) => sum + check.after, 0),
|
|
62671
|
+
missingOrChanged: changed
|
|
62672
|
+
}
|
|
62673
|
+
}
|
|
62674
|
+
};
|
|
62675
|
+
if (args.receipt) writeFileSync4(String(args.receipt), `${JSON.stringify(result, null, 2)}
|
|
62676
|
+
`);
|
|
62677
|
+
cliOutput(result, { command: "doctor", operation: "doctor.split-brain.run" });
|
|
62678
|
+
if (changed.length > 0 && (process.exitCode ?? 0) === 0) process.exitCode = 1;
|
|
62679
|
+
}
|
|
62680
|
+
});
|
|
62681
|
+
}
|
|
62682
|
+
});
|
|
62683
|
+
|
|
62408
62684
|
// packages/cleo/src/cli/commands/doctor-superseded-store.ts
|
|
62409
62685
|
var doctor_superseded_store_exports = {};
|
|
62410
62686
|
__export(doctor_superseded_store_exports, {
|
|
62411
62687
|
doctorSupersededStoreCommand: () => doctorSupersededStoreCommand
|
|
62412
62688
|
});
|
|
62413
|
-
import { getProjectRoot as
|
|
62689
|
+
import { getProjectRoot as getProjectRoot49 } from "@cleocode/core";
|
|
62414
62690
|
import { scanSupersededStores } from "@cleocode/core/doctor/superseded-store.js";
|
|
62691
|
+
import { reconcileSupersededStores } from "@cleocode/core/store/exodus/index.js";
|
|
62415
62692
|
var doctorSupersededStoreCommand;
|
|
62416
62693
|
var init_doctor_superseded_store = __esm({
|
|
62417
62694
|
"packages/cleo/src/cli/commands/doctor-superseded-store.ts"() {
|
|
@@ -62424,12 +62701,47 @@ var init_doctor_superseded_store = __esm({
|
|
|
62424
62701
|
description: "Report pre-dual-scope store files (.cleo/tasks.db, .cleo/brain.db) still on disk under their old LIVE names after the cleo.db migration, proving which store holds the data. Read-only \u2014 deletes nothing."
|
|
62425
62702
|
},
|
|
62426
62703
|
args: {
|
|
62704
|
+
reconcile: {
|
|
62705
|
+
type: "boolean",
|
|
62706
|
+
description: "Copy rows the superseded files hold that are missing from cleo.db (additive, verified, reverted on mismatch; legacy files are never touched). Writes a receipt."
|
|
62707
|
+
},
|
|
62708
|
+
additive: {
|
|
62709
|
+
type: "boolean",
|
|
62710
|
+
description: "With --reconcile, for a project already running on cleo.db: copy only history rows whose keys are absent from live, never write the live task graph, and list every row left uncopied as a conflict in the receipt"
|
|
62711
|
+
},
|
|
62712
|
+
"dry-run": {
|
|
62713
|
+
type: "boolean",
|
|
62714
|
+
description: "With --reconcile: report per-table counts and what would be copied; write nothing"
|
|
62715
|
+
},
|
|
62427
62716
|
json: { type: "boolean", description: "Output as JSON" },
|
|
62428
62717
|
human: { type: "boolean", description: "Force human-readable output" },
|
|
62429
62718
|
quiet: { type: "boolean", description: "Suppress non-essential output" }
|
|
62430
62719
|
},
|
|
62431
|
-
async run() {
|
|
62432
|
-
|
|
62720
|
+
async run({ args }) {
|
|
62721
|
+
if (args.reconcile === true) {
|
|
62722
|
+
const receipt = await reconcileSupersededStores(getProjectRoot49(), {
|
|
62723
|
+
dryRun: args["dry-run"] === true,
|
|
62724
|
+
additive: args.additive === true
|
|
62725
|
+
});
|
|
62726
|
+
if (receipt.outcome === "refused") {
|
|
62727
|
+
cliError(receipt.reason, "E_RECONCILE_REFUSED", {
|
|
62728
|
+
details: receipt,
|
|
62729
|
+
fix: `Inspect ${receipt.receiptPath ?? "the receipt"}; the legacy files are unchanged, so it is safe to retry after fixing the cause.`
|
|
62730
|
+
});
|
|
62731
|
+
process.exitCode = 1;
|
|
62732
|
+
return;
|
|
62733
|
+
}
|
|
62734
|
+
cliOutput(
|
|
62735
|
+
{ kind: "generic", ...receipt },
|
|
62736
|
+
{
|
|
62737
|
+
command: "doctor",
|
|
62738
|
+
operation: "doctor.superseded-store.reconcile",
|
|
62739
|
+
message: receipt.reason
|
|
62740
|
+
}
|
|
62741
|
+
);
|
|
62742
|
+
return;
|
|
62743
|
+
}
|
|
62744
|
+
const result = scanSupersededStores(getProjectRoot49());
|
|
62433
62745
|
cliOutput(result, {
|
|
62434
62746
|
command: "doctor",
|
|
62435
62747
|
operation: "doctor.superseded-store.run"
|
|
@@ -62654,7 +62966,7 @@ import {
|
|
|
62654
62966
|
resumePreparedKnowledgeRepair,
|
|
62655
62967
|
runKnowledgeDoctor as runKnowledgeDoctor2
|
|
62656
62968
|
} from "@cleocode/core/doctor/knowledge.js";
|
|
62657
|
-
import { getProjectRoot as
|
|
62969
|
+
import { getProjectRoot as getProjectRoot50 } from "@cleocode/core/paths.js";
|
|
62658
62970
|
var doctorKnowledgeSubcommand;
|
|
62659
62971
|
var init_doctor_knowledge = __esm({
|
|
62660
62972
|
"packages/cleo/src/cli/commands/doctor-knowledge.ts"() {
|
|
@@ -62729,7 +63041,7 @@ var init_doctor_knowledge = __esm({
|
|
|
62729
63041
|
},
|
|
62730
63042
|
async run({ args }) {
|
|
62731
63043
|
const startedAt = Date.now();
|
|
62732
|
-
const root =
|
|
63044
|
+
const root = getProjectRoot50();
|
|
62733
63045
|
let context;
|
|
62734
63046
|
let pending;
|
|
62735
63047
|
try {
|
|
@@ -62893,11 +63205,11 @@ __export(migrate_agents_v2_exports, {
|
|
|
62893
63205
|
});
|
|
62894
63206
|
import { createHash as createHash2 } from "node:crypto";
|
|
62895
63207
|
import { appendFileSync as appendFileSync2, existsSync as existsSync15, mkdirSync as mkdirSync3, readdirSync as readdirSync2, readFileSync as readFileSync12 } from "node:fs";
|
|
62896
|
-
import { join as
|
|
63208
|
+
import { join as join25 } from "node:path";
|
|
62897
63209
|
import {
|
|
62898
63210
|
ensureGlobalAgentRegistryDb,
|
|
62899
63211
|
getGlobalAgentRegistryNativeDb,
|
|
62900
|
-
getProjectRoot as
|
|
63212
|
+
getProjectRoot as getProjectRoot51,
|
|
62901
63213
|
installAgentFromCant
|
|
62902
63214
|
} from "@cleocode/core/internal";
|
|
62903
63215
|
function sha256Hex(bytes) {
|
|
@@ -62917,8 +63229,8 @@ function extractAgentName(source) {
|
|
|
62917
63229
|
return headerMatch[1] ?? null;
|
|
62918
63230
|
}
|
|
62919
63231
|
function appendAuditLog(projectRoot, entry) {
|
|
62920
|
-
const auditPath =
|
|
62921
|
-
const auditDir =
|
|
63232
|
+
const auditPath = join25(projectRoot, AUDIT_LOG_RELATIVE);
|
|
63233
|
+
const auditDir = join25(auditPath, "..");
|
|
62922
63234
|
if (!existsSync15(auditDir)) {
|
|
62923
63235
|
mkdirSync3(auditDir, { recursive: true });
|
|
62924
63236
|
}
|
|
@@ -62936,7 +63248,7 @@ function walkAgentsDir(db, scanDir, projectRoot, summary, verbose) {
|
|
|
62936
63248
|
return;
|
|
62937
63249
|
}
|
|
62938
63250
|
for (const filename of files) {
|
|
62939
|
-
const cantPath =
|
|
63251
|
+
const cantPath = join25(scanDir, filename);
|
|
62940
63252
|
const relPath = cantPath.replace(`${projectRoot}/`, "");
|
|
62941
63253
|
let sourceBytes;
|
|
62942
63254
|
let sourceText;
|
|
@@ -63033,9 +63345,9 @@ async function runMigrateAgentsV2(projectRoot, verbose = true) {
|
|
|
63033
63345
|
await ensureGlobalAgentRegistryDb();
|
|
63034
63346
|
const db = getGlobalAgentRegistryNativeDb();
|
|
63035
63347
|
try {
|
|
63036
|
-
const canonicalDir =
|
|
63348
|
+
const canonicalDir = join25(projectRoot, ".cleo", "cant", "agents");
|
|
63037
63349
|
walkAgentsDir(db, canonicalDir, projectRoot, summary, verbose);
|
|
63038
|
-
const legacyDir =
|
|
63350
|
+
const legacyDir = join25(projectRoot, ".cleo", "agents");
|
|
63039
63351
|
walkAgentsDir(db, legacyDir, projectRoot, summary, verbose);
|
|
63040
63352
|
} finally {
|
|
63041
63353
|
db.close();
|
|
@@ -63043,7 +63355,7 @@ async function runMigrateAgentsV2(projectRoot, verbose = true) {
|
|
|
63043
63355
|
return summary;
|
|
63044
63356
|
}
|
|
63045
63357
|
function readMigrationConflicts(projectRoot) {
|
|
63046
|
-
const auditPath =
|
|
63358
|
+
const auditPath = join25(projectRoot, AUDIT_LOG_RELATIVE);
|
|
63047
63359
|
if (!existsSync15(auditPath)) return [];
|
|
63048
63360
|
let raw;
|
|
63049
63361
|
try {
|
|
@@ -63085,7 +63397,7 @@ var init_migrate_agents_v2 = __esm({
|
|
|
63085
63397
|
}
|
|
63086
63398
|
},
|
|
63087
63399
|
async run({ args }) {
|
|
63088
|
-
const projectRoot =
|
|
63400
|
+
const projectRoot = getProjectRoot51();
|
|
63089
63401
|
const verbose = args.quiet !== true;
|
|
63090
63402
|
if (verbose) {
|
|
63091
63403
|
humanInfo("Scanning .cleo/cant/agents/ and .cleo/agents/ for unregistered agents...");
|
|
@@ -63127,9 +63439,9 @@ var doctor_exports = {};
|
|
|
63127
63439
|
__export(doctor_exports, {
|
|
63128
63440
|
doctorCommand: () => doctorCommand2
|
|
63129
63441
|
});
|
|
63130
|
-
import { mkdirSync as mkdirSync4, writeFileSync as
|
|
63131
|
-
import { join as
|
|
63132
|
-
import { getProjectRoot as
|
|
63442
|
+
import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync5 } from "node:fs";
|
|
63443
|
+
import { join as join26 } from "node:path";
|
|
63444
|
+
import { getProjectRoot as getProjectRoot52, pushWarning as pushWarning5 } from "@cleocode/core";
|
|
63133
63445
|
import { renderInvariantAuditLines } from "@cleocode/core/doctor/invariant-audit-render.js";
|
|
63134
63446
|
import {
|
|
63135
63447
|
quarantineRogueCleoDir,
|
|
@@ -63168,16 +63480,16 @@ async function scanTestFixturesInProd(projectRoot) {
|
|
|
63168
63480
|
}
|
|
63169
63481
|
async function quarantineTestFixtures(projectRoot, matches) {
|
|
63170
63482
|
if (matches.length === 0) return 0;
|
|
63171
|
-
const cleoDir =
|
|
63172
|
-
const quarantineDir =
|
|
63483
|
+
const cleoDir = join26(projectRoot, ".cleo");
|
|
63484
|
+
const quarantineDir = join26(
|
|
63173
63485
|
cleoDir,
|
|
63174
63486
|
"quarantine",
|
|
63175
63487
|
`fixture-scan-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`
|
|
63176
63488
|
);
|
|
63177
63489
|
mkdirSync4(quarantineDir, { recursive: true });
|
|
63178
63490
|
const manifest = matches.map((m) => ({ ...m, quarantinedAt: (/* @__PURE__ */ new Date()).toISOString() }));
|
|
63179
|
-
|
|
63180
|
-
|
|
63491
|
+
writeFileSync5(
|
|
63492
|
+
join26(quarantineDir, "manifest.jsonl"),
|
|
63181
63493
|
manifest.map((m) => JSON.stringify(m)).join("\n") + "\n"
|
|
63182
63494
|
);
|
|
63183
63495
|
const { getNativeDb } = await import("@cleocode/core/store/sqlite.js");
|
|
@@ -63246,6 +63558,7 @@ var init_doctor = __esm({
|
|
|
63246
63558
|
init_progress();
|
|
63247
63559
|
init_renderers();
|
|
63248
63560
|
init_doctor_acceptance_drift();
|
|
63561
|
+
init_doctor_credentials();
|
|
63249
63562
|
init_doctor_db_substrate();
|
|
63250
63563
|
init_doctor_exodus();
|
|
63251
63564
|
init_doctor_exodus_residue();
|
|
@@ -63256,9 +63569,11 @@ var init_doctor = __esm({
|
|
|
63256
63569
|
init_doctor_malformed_ids();
|
|
63257
63570
|
init_doctor_memory_guard();
|
|
63258
63571
|
init_doctor_nexus_residency();
|
|
63572
|
+
init_doctor_project_identity();
|
|
63259
63573
|
init_doctor_projects();
|
|
63260
63574
|
init_doctor_release_readiness();
|
|
63261
63575
|
init_doctor_repair();
|
|
63576
|
+
init_doctor_split_brain();
|
|
63262
63577
|
init_doctor_superseded_store();
|
|
63263
63578
|
init_doctor_tool_locks();
|
|
63264
63579
|
init_migrate_agents_v2();
|
|
@@ -63285,12 +63600,18 @@ var init_doctor = __esm({
|
|
|
63285
63600
|
"superseded-store": doctorSupersededStoreCommand,
|
|
63286
63601
|
// T12097 — machine-wide guard for test runs started OUTSIDE cleo verify
|
|
63287
63602
|
"memory-guard": doctorMemoryGuardCommand,
|
|
63603
|
+
// T12353 — tracked .cleo/project-id vs project-info.json (+ --resolve re-key)
|
|
63604
|
+
"project-identity": doctorProjectIdentityCommand,
|
|
63605
|
+
// T12329 — import rows only a diverged store copy has, under new ids (dry-run first)
|
|
63606
|
+
"split-brain": doctorSplitBrainCommand,
|
|
63288
63607
|
// T12157 — the two acceptance stores (json column vs text+child rows) must agree
|
|
63289
63608
|
"acceptance-drift": doctorAcceptanceDriftCommand,
|
|
63290
63609
|
// T12158 — tables nexus resolves by bare name must actually live where it assumes
|
|
63291
63610
|
"nexus-residency": doctorNexusResidencyCommand,
|
|
63292
63611
|
// T12113 (gh#1222) — evidence-tool semaphore holders + orphan reaping
|
|
63293
63612
|
"tool-locks": doctorToolLocksCommand,
|
|
63613
|
+
// T12326 — project credentials still keyed by project PATH (+ --fix re-keys)
|
|
63614
|
+
credentials: doctorCredentialsCommand,
|
|
63294
63615
|
// T11777 / Saga T11242 / Epic T11249 — exodus stranded-residue check (+ --fix)
|
|
63295
63616
|
"exodus-residue": doctorExodusResidueCommand,
|
|
63296
63617
|
// T11837 / Saga T11242 / Epic T11833 — read-only exodus health report
|
|
@@ -63503,7 +63824,7 @@ var init_doctor = __esm({
|
|
|
63503
63824
|
const { join: pathJoin } = await import("node:path");
|
|
63504
63825
|
const { existsSync: existsSync24 } = await import("node:fs");
|
|
63505
63826
|
const { detectAndHealCoreWorktreeLeak } = await import("@cleocode/worktree");
|
|
63506
|
-
const projectRoot =
|
|
63827
|
+
const projectRoot = getProjectRoot52();
|
|
63507
63828
|
let gitRoot = projectRoot;
|
|
63508
63829
|
try {
|
|
63509
63830
|
gitRoot = execFile2("git", ["rev-parse", "--show-toplevel"], {
|
|
@@ -63555,7 +63876,7 @@ var init_doctor = __esm({
|
|
|
63555
63876
|
}
|
|
63556
63877
|
if (args.brain) {
|
|
63557
63878
|
const { computeBrainHealthDashboard } = await import("@cleocode/core/memory/brain-health-dashboard.js");
|
|
63558
|
-
const projectRoot =
|
|
63879
|
+
const projectRoot = getProjectRoot52();
|
|
63559
63880
|
const dashboard = await computeBrainHealthDashboard(projectRoot);
|
|
63560
63881
|
cliOutput(dashboard, { command: "doctor", operation: "doctor.brain" });
|
|
63561
63882
|
if (dashboard.hasP0Failure) {
|
|
@@ -63564,7 +63885,7 @@ var init_doctor = __esm({
|
|
|
63564
63885
|
return;
|
|
63565
63886
|
}
|
|
63566
63887
|
if (args["scan-test-fixtures-in-prod"]) {
|
|
63567
|
-
const projectRoot =
|
|
63888
|
+
const projectRoot = getProjectRoot52();
|
|
63568
63889
|
const matches = await scanTestFixturesInProd(projectRoot);
|
|
63569
63890
|
const dryRun = args["dry-run"] !== false && args.quarantine !== true;
|
|
63570
63891
|
const quarantined = !dryRun && matches.length > 0 ? await quarantineTestFixtures(projectRoot, matches) : void 0;
|
|
@@ -63652,7 +63973,7 @@ var init_doctor = __esm({
|
|
|
63652
63973
|
progress.complete("Comprehensive diagnostics complete");
|
|
63653
63974
|
} else if (args["scan-rogue-cleo-dirs"]) {
|
|
63654
63975
|
progress.step(0, "Scanning for rogue .cleo/ directories");
|
|
63655
|
-
const projectRoot =
|
|
63976
|
+
const projectRoot = getProjectRoot52();
|
|
63656
63977
|
const reports = scanRogueCleoDirs(projectRoot);
|
|
63657
63978
|
progress.complete(
|
|
63658
63979
|
`Found ${reports.length} rogue .cleo/ director${reports.length === 1 ? "y" : "ies"}`
|
|
@@ -63661,7 +63982,7 @@ var init_doctor = __esm({
|
|
|
63661
63982
|
} else if (args["quarantine-rogue-cleo-dirs"]) {
|
|
63662
63983
|
const isDryRun = args["dry-run"] === true;
|
|
63663
63984
|
progress.step(0, `${isDryRun ? "[DRY RUN] " : ""}Scanning for rogue .cleo/ directories`);
|
|
63664
|
-
const projectRoot =
|
|
63985
|
+
const projectRoot = getProjectRoot52();
|
|
63665
63986
|
const reports = scanRogueCleoDirs(projectRoot);
|
|
63666
63987
|
if (reports.length === 0) {
|
|
63667
63988
|
progress.complete("No rogue .cleo/ directories found \u2014 nothing to quarantine");
|
|
@@ -63713,9 +64034,9 @@ var init_doctor = __esm({
|
|
|
63713
64034
|
} else if (args["scan-stray-nexus-dbs"]) {
|
|
63714
64035
|
progress.step(0, "Scanning for stray nexus.db files");
|
|
63715
64036
|
const { detectAndRemoveLegacyGlobalFiles, detectAndRemoveStrayProjectNexus } = await import("@cleocode/core/store/cleanup-legacy.js");
|
|
63716
|
-
const { getCleoHome:
|
|
63717
|
-
const cleoHome =
|
|
63718
|
-
const projectRoot =
|
|
64037
|
+
const { getCleoHome: getCleoHome8 } = await import("@cleocode/core");
|
|
64038
|
+
const cleoHome = getCleoHome8();
|
|
64039
|
+
const projectRoot = getProjectRoot52();
|
|
63719
64040
|
const legacyResult = detectAndRemoveLegacyGlobalFiles(cleoHome);
|
|
63720
64041
|
const strayResult = detectAndRemoveStrayProjectNexus(projectRoot);
|
|
63721
64042
|
const isDryRun = args["dry-run"] === true;
|
|
@@ -63748,7 +64069,7 @@ var init_doctor = __esm({
|
|
|
63748
64069
|
} else if (args["audit-worktree-orphans"]) {
|
|
63749
64070
|
progress.step(0, "Comprehensive worktree anomaly audit (T9808 / council D009)");
|
|
63750
64071
|
const { auditWorktreeOrphansComprehensive, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
|
|
63751
|
-
const projectRoot =
|
|
64072
|
+
const projectRoot = getProjectRoot52();
|
|
63752
64073
|
const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
|
|
63753
64074
|
const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
|
|
63754
64075
|
const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
|
|
@@ -63805,7 +64126,7 @@ var init_doctor = __esm({
|
|
|
63805
64126
|
`${isDryRun ? "[DRY RUN] " : ""}Scanning + pruning worktree-orphan .cleo/ directories`
|
|
63806
64127
|
);
|
|
63807
64128
|
const { pruneWorktreeOrphans, scanWorktreeOrphansBudgeted } = await import("@cleocode/core/doctor/worktree-orphans.js");
|
|
63808
|
-
const projectRoot =
|
|
64129
|
+
const projectRoot = getProjectRoot52();
|
|
63809
64130
|
const timeoutSecs = args["timeout"] !== void 0 ? Number.parseInt(String(args["timeout"]), 10) : 30;
|
|
63810
64131
|
const timeoutMs = Number.isFinite(timeoutSecs) && timeoutSecs > 0 ? timeoutSecs * 1e3 : 3e4;
|
|
63811
64132
|
const maxEntriesPerLevel = args["max-entries-per-level"] !== void 0 ? Number.parseInt(String(args["max-entries-per-level"]), 10) : 500;
|
|
@@ -63853,8 +64174,8 @@ var init_doctor = __esm({
|
|
|
63853
64174
|
);
|
|
63854
64175
|
return;
|
|
63855
64176
|
}
|
|
63856
|
-
const archiveDir =
|
|
63857
|
-
const auditLogPath =
|
|
64177
|
+
const archiveDir = join26(projectRoot, ".cleo", "backups");
|
|
64178
|
+
const auditLogPath = join26(projectRoot, ".cleo", "audit", "worktree-prune.jsonl");
|
|
63858
64179
|
const result = await pruneWorktreeOrphans(orphans, {
|
|
63859
64180
|
archiveDir,
|
|
63860
64181
|
auditLogPath,
|
|
@@ -63884,7 +64205,7 @@ var init_doctor = __esm({
|
|
|
63884
64205
|
`${isDryRun ? "[DRY RUN] " : ""}Migrating .cleo/worktree-include \u2192 .worktreeinclude`
|
|
63885
64206
|
);
|
|
63886
64207
|
const { migrateWorktreeIncludeFile } = await import("@cleocode/core");
|
|
63887
|
-
const projectRoot =
|
|
64208
|
+
const projectRoot = getProjectRoot52();
|
|
63888
64209
|
const result = await migrateWorktreeIncludeFile(projectRoot, { dryRun: isDryRun });
|
|
63889
64210
|
progress.complete(`Migration ${result.action}`);
|
|
63890
64211
|
cliOutput(result, { command: "doctor", operation: "doctor.migrate-worktree-include" });
|
|
@@ -63903,7 +64224,7 @@ var init_doctor = __esm({
|
|
|
63903
64224
|
const stepLabel = isFocusedAlias ? "Auditing Saga hierarchy for ADR-073 invariants" : "Walking central INVARIANTS_REGISTRY";
|
|
63904
64225
|
progress.step(0, stepLabel);
|
|
63905
64226
|
const { auditInvariantRegistry } = await import("@cleocode/core/doctor/invariant-audit.js");
|
|
63906
|
-
const projectRoot =
|
|
64227
|
+
const projectRoot = getProjectRoot52();
|
|
63907
64228
|
const result = await auditInvariantRegistry(projectRoot, { adrFilter });
|
|
63908
64229
|
const operation = isFocusedAlias ? "doctor.audit-sagas" : "doctor.audit-invariants";
|
|
63909
64230
|
const summary = `Invariant audit complete \u2014 ${result.totalCount} entries walked, ${result.errorCount} error / ${result.warningCount} warning / ${result.infoCount} info violation(s), ${result.notApplicableCount} not-applicable, ${result.documentedCount} documented`;
|
|
@@ -63925,7 +64246,7 @@ var init_doctor = __esm({
|
|
|
63925
64246
|
{ command: "doctor", operation: "admin.health" }
|
|
63926
64247
|
);
|
|
63927
64248
|
try {
|
|
63928
|
-
const projectRoot =
|
|
64249
|
+
const projectRoot = getProjectRoot52();
|
|
63929
64250
|
const conflicts = readMigrationConflicts(projectRoot);
|
|
63930
64251
|
if (conflicts.length > 0) {
|
|
63931
64252
|
progress.complete(
|
|
@@ -63956,7 +64277,7 @@ var init_doctor = __esm({
|
|
|
63956
64277
|
progress.complete("Health check complete");
|
|
63957
64278
|
}
|
|
63958
64279
|
try {
|
|
63959
|
-
const projectRoot =
|
|
64280
|
+
const projectRoot = getProjectRoot52();
|
|
63960
64281
|
const { auditSagaHierarchy } = await import("@cleocode/core/doctor/saga-audit.js");
|
|
63961
64282
|
const sagaAudit = await auditSagaHierarchy(projectRoot);
|
|
63962
64283
|
if (sagaAudit.sagas.length === 0) {
|
|
@@ -64018,7 +64339,7 @@ __export(event_exports, {
|
|
|
64018
64339
|
orchestratorCommand: () => orchestratorCommand
|
|
64019
64340
|
});
|
|
64020
64341
|
import { readdir as readdir2 } from "node:fs/promises";
|
|
64021
|
-
import { join as
|
|
64342
|
+
import { join as join27 } from "node:path";
|
|
64022
64343
|
import { cwd as processCwd } from "node:process";
|
|
64023
64344
|
import { appendEvent } from "@cleocode/core/events/event-bus.js";
|
|
64024
64345
|
function resolveProjectRoot2(arg) {
|
|
@@ -64141,7 +64462,7 @@ var init_event = __esm({
|
|
|
64141
64462
|
const agentIdFilter = args.agent;
|
|
64142
64463
|
const showAll = args.all === true;
|
|
64143
64464
|
const lines = parseInt(args.lines ?? "20", 10);
|
|
64144
|
-
const eventsDir =
|
|
64465
|
+
const eventsDir = join27(projectRoot, ".cleo", "agent-events");
|
|
64145
64466
|
try {
|
|
64146
64467
|
let files = [];
|
|
64147
64468
|
try {
|
|
@@ -64179,7 +64500,7 @@ var init_event = __esm({
|
|
|
64179
64500
|
for (const file of filesToTail) {
|
|
64180
64501
|
const agentId = file.replace(".jsonl", "");
|
|
64181
64502
|
const { readFileSync: readFileSync23 } = await import("node:fs");
|
|
64182
|
-
const content = readFileSync23(
|
|
64503
|
+
const content = readFileSync23(join27(eventsDir, file), "utf-8");
|
|
64183
64504
|
const eventLines = content.trim().split("\n").filter(Boolean);
|
|
64184
64505
|
const tail = eventLines.slice(-lines);
|
|
64185
64506
|
if (jsonMode) {
|
|
@@ -64249,7 +64570,7 @@ var init_event = __esm({
|
|
|
64249
64570
|
const epicFilter = args.epic;
|
|
64250
64571
|
const follow = args.follow === true;
|
|
64251
64572
|
const lines = parseInt(args.lines ?? "50", 10);
|
|
64252
|
-
const eventsDir =
|
|
64573
|
+
const eventsDir = join27(projectRoot, ".cleo", "agent-events");
|
|
64253
64574
|
let files = [];
|
|
64254
64575
|
try {
|
|
64255
64576
|
const entries = await readdir2(eventsDir);
|
|
@@ -64275,7 +64596,7 @@ var init_event = __esm({
|
|
|
64275
64596
|
const agentId = file.replace(".jsonl", "");
|
|
64276
64597
|
try {
|
|
64277
64598
|
const { readFileSync: readFileSync23 } = await import("node:fs");
|
|
64278
|
-
const content = readFileSync23(
|
|
64599
|
+
const content = readFileSync23(join27(eventsDir, file), "utf-8");
|
|
64279
64600
|
const eventLines = content.trim().split("\n").filter(Boolean);
|
|
64280
64601
|
const tail = eventLines.slice(-lines);
|
|
64281
64602
|
if (jsonMode) {
|
|
@@ -65270,7 +65591,7 @@ __export(gateway_exports, {
|
|
|
65270
65591
|
gatewayOpenapiSubCommand: () => gatewayOpenapiSubCommand
|
|
65271
65592
|
});
|
|
65272
65593
|
import { resolve as resolve8 } from "node:path";
|
|
65273
|
-
import { generateOpenApi, getProjectRoot as
|
|
65594
|
+
import { generateOpenApi, getProjectRoot as getProjectRoot53 } from "@cleocode/core";
|
|
65274
65595
|
var gatewayOpenapiSubCommand, gatewayCommand;
|
|
65275
65596
|
var init_gateway = __esm({
|
|
65276
65597
|
"packages/cleo/src/cli/commands/gateway.ts"() {
|
|
@@ -65301,9 +65622,9 @@ var init_gateway = __esm({
|
|
|
65301
65622
|
`;
|
|
65302
65623
|
const pathCount = Object.keys(doc.paths).length;
|
|
65303
65624
|
if (typeof args.out === "string" && args.out.length > 0) {
|
|
65304
|
-
const { writeFileSync:
|
|
65305
|
-
const target = resolve8(
|
|
65306
|
-
|
|
65625
|
+
const { writeFileSync: writeFileSync8 } = await import("node:fs");
|
|
65626
|
+
const target = resolve8(getProjectRoot53(), args.out);
|
|
65627
|
+
writeFileSync8(target, json2, "utf8");
|
|
65307
65628
|
cliOutput(
|
|
65308
65629
|
{ out: target, pathCount, version: doc.info.version, openapi: doc.openapi },
|
|
65309
65630
|
{ command: "gateway", operation: "gateway.openapi" }
|
|
@@ -65383,7 +65704,7 @@ __export(gc_exports, {
|
|
|
65383
65704
|
gcCommand: () => gcCommand
|
|
65384
65705
|
});
|
|
65385
65706
|
import { homedir as homedir4, tmpdir } from "node:os";
|
|
65386
|
-
import { join as
|
|
65707
|
+
import { join as join28 } from "node:path";
|
|
65387
65708
|
import { pruneOrphanTempDirs, pruneOrphanWorktrees } from "@cleocode/core/gc/cleanup.js";
|
|
65388
65709
|
import { runGC } from "@cleocode/core/gc/runner.js";
|
|
65389
65710
|
import { readGCState } from "@cleocode/core/gc/state.js";
|
|
@@ -65460,7 +65781,7 @@ var init_gc = __esm({
|
|
|
65460
65781
|
},
|
|
65461
65782
|
async run({ args }) {
|
|
65462
65783
|
const cleoDir = resolveLegacyCleoDir3(args["cleo-dir"]);
|
|
65463
|
-
const statePath =
|
|
65784
|
+
const statePath = join28(cleoDir, "gc-state.json");
|
|
65464
65785
|
try {
|
|
65465
65786
|
const state = await readGCState(statePath);
|
|
65466
65787
|
const diskStr = state.lastDiskUsedPct !== null ? `${state.lastDiskUsedPct.toFixed(1)}%` : "unknown";
|
|
@@ -65513,8 +65834,8 @@ var init_gc = __esm({
|
|
|
65513
65834
|
}
|
|
65514
65835
|
},
|
|
65515
65836
|
async run({ args }) {
|
|
65516
|
-
const xdgData = process.env["XDG_DATA_HOME"] ??
|
|
65517
|
-
const worktreesRoot = args["worktrees-root"] ??
|
|
65837
|
+
const xdgData = process.env["XDG_DATA_HOME"] ?? join28(homedir4(), ".local", "share");
|
|
65838
|
+
const worktreesRoot = args["worktrees-root"] ?? join28(xdgData, "cleo", "worktrees");
|
|
65518
65839
|
const projectHash = args["project-hash"];
|
|
65519
65840
|
const dryRun = args["dry-run"];
|
|
65520
65841
|
const preserveRaw = args["preserve-tasks"];
|
|
@@ -65762,7 +66083,7 @@ var go_exports = {};
|
|
|
65762
66083
|
__export(go_exports, {
|
|
65763
66084
|
goCommand: () => goCommand
|
|
65764
66085
|
});
|
|
65765
|
-
import { getProjectRoot as
|
|
66086
|
+
import { getProjectRoot as getProjectRoot54, go } from "@cleocode/core";
|
|
65766
66087
|
var goCommand;
|
|
65767
66088
|
var init_go = __esm({
|
|
65768
66089
|
"packages/cleo/src/cli/commands/go.ts"() {
|
|
@@ -65788,7 +66109,7 @@ var init_go = __esm({
|
|
|
65788
66109
|
}
|
|
65789
66110
|
},
|
|
65790
66111
|
async run({ args }) {
|
|
65791
|
-
const projectRoot =
|
|
66112
|
+
const projectRoot = getProjectRoot54();
|
|
65792
66113
|
const { getCurrentSessionId, getActiveSession } = await import("@cleocode/core/internal");
|
|
65793
66114
|
let sessionId = getCurrentSessionId(projectRoot) ?? void 0;
|
|
65794
66115
|
if (sessionId === void 0) {
|
|
@@ -65817,7 +66138,7 @@ var goal_exports = {};
|
|
|
65817
66138
|
__export(goal_exports, {
|
|
65818
66139
|
goalCommand: () => goalCommand
|
|
65819
66140
|
});
|
|
65820
|
-
import { getProjectRoot as
|
|
66141
|
+
import { getProjectRoot as getProjectRoot55, goal } from "@cleocode/core";
|
|
65821
66142
|
function resolveGoalKind(task) {
|
|
65822
66143
|
if (typeof task === "string" && task.length > 0) {
|
|
65823
66144
|
if (!isValidGoalTargetTaskId(task)) {
|
|
@@ -65864,7 +66185,7 @@ var init_goal2 = __esm({
|
|
|
65864
66185
|
}
|
|
65865
66186
|
const record = await goal.createGoal(
|
|
65866
66187
|
{ goalKind: kindResult.kind, intent, turnBudget: resolveTurnBudget(args.turns) },
|
|
65867
|
-
|
|
66188
|
+
getProjectRoot55()
|
|
65868
66189
|
);
|
|
65869
66190
|
cliOutput(record, { command: "goal set", operation: "goal.set" });
|
|
65870
66191
|
}
|
|
@@ -65875,7 +66196,7 @@ var init_goal2 = __esm({
|
|
|
65875
66196
|
description: "Show the current agent's active goal (per-agent scoped)."
|
|
65876
66197
|
},
|
|
65877
66198
|
async run() {
|
|
65878
|
-
const record = await goal.getActiveGoal(
|
|
66199
|
+
const record = await goal.getActiveGoal(getProjectRoot55());
|
|
65879
66200
|
cliOutput(record ?? { active: null }, { command: "goal status", operation: "goal.status" });
|
|
65880
66201
|
}
|
|
65881
66202
|
});
|
|
@@ -65897,7 +66218,7 @@ var init_goal2 = __esm({
|
|
|
65897
66218
|
});
|
|
65898
66219
|
return;
|
|
65899
66220
|
}
|
|
65900
|
-
const cwd =
|
|
66221
|
+
const cwd = getProjectRoot55();
|
|
65901
66222
|
const parent = await goal.getActiveGoal(cwd);
|
|
65902
66223
|
if (!parent) {
|
|
65903
66224
|
cliError(
|
|
@@ -65945,7 +66266,7 @@ var init_goal2 = __esm({
|
|
|
65945
66266
|
});
|
|
65946
66267
|
return;
|
|
65947
66268
|
}
|
|
65948
|
-
const cwd =
|
|
66269
|
+
const cwd = getProjectRoot55();
|
|
65949
66270
|
const result = await goal.advanceGoalWithPersist(goalId, { cwd });
|
|
65950
66271
|
if (!result) {
|
|
65951
66272
|
cliError(`Goal '${goalId}' not found.`, 4 /* NOT_FOUND */, { name: "E_NOT_FOUND" });
|
|
@@ -65970,7 +66291,7 @@ var init_goal2 = __esm({
|
|
|
65970
66291
|
});
|
|
65971
66292
|
return;
|
|
65972
66293
|
}
|
|
65973
|
-
const cwd =
|
|
66294
|
+
const cwd = getProjectRoot55();
|
|
65974
66295
|
const active = await goal.getActiveGoal(cwd);
|
|
65975
66296
|
if (!active) {
|
|
65976
66297
|
cliError(
|
|
@@ -66968,7 +67289,7 @@ var hygiene_exports = {};
|
|
|
66968
67289
|
__export(hygiene_exports, {
|
|
66969
67290
|
hygieneCommand: () => hygieneCommand
|
|
66970
67291
|
});
|
|
66971
|
-
import { getProjectRoot as
|
|
67292
|
+
import { getProjectRoot as getProjectRoot56 } from "@cleocode/core";
|
|
66972
67293
|
import { runSpawnReadinessHygieneCli } from "@cleocode/core/hygiene/validate-spawn-readiness.js";
|
|
66973
67294
|
var hygieneCommand;
|
|
66974
67295
|
var init_hygiene = __esm({
|
|
@@ -66997,7 +67318,7 @@ var init_hygiene = __esm({
|
|
|
66997
67318
|
}
|
|
66998
67319
|
},
|
|
66999
67320
|
async run({ args }) {
|
|
67000
|
-
const projectRoot = args["project-root"] ||
|
|
67321
|
+
const projectRoot = args["project-root"] || getProjectRoot56() || process.cwd();
|
|
67001
67322
|
const worktreePath = args["worktree-path"];
|
|
67002
67323
|
await runSpawnReadinessHygieneCli(projectRoot, worktreePath);
|
|
67003
67324
|
}
|
|
@@ -67172,7 +67493,7 @@ __export(init_exports, {
|
|
|
67172
67493
|
maybeNudgeFirstRunLogin: () => maybeNudgeFirstRunLogin
|
|
67173
67494
|
});
|
|
67174
67495
|
import { existsSync as existsSync17, readFileSync as readFileSync13 } from "node:fs";
|
|
67175
|
-
import { join as
|
|
67496
|
+
import { join as join29 } from "node:path";
|
|
67176
67497
|
import { fileURLToPath as fileURLToPath6 } from "node:url";
|
|
67177
67498
|
import {
|
|
67178
67499
|
CleoError as CleoError7,
|
|
@@ -67186,9 +67507,9 @@ import { getTemplatesByKind } from "@cleocode/core/templates/registry";
|
|
|
67186
67507
|
function getGitignoreTemplate() {
|
|
67187
67508
|
try {
|
|
67188
67509
|
const thisFile = fileURLToPath6(import.meta.url);
|
|
67189
|
-
const packageRoot =
|
|
67190
|
-
const localTemplatePath =
|
|
67191
|
-
const monorepoTemplatePath =
|
|
67510
|
+
const packageRoot = join29(thisFile, "..", "..", "..", "..");
|
|
67511
|
+
const localTemplatePath = join29(packageRoot, "templates", "cleo-gitignore");
|
|
67512
|
+
const monorepoTemplatePath = join29(packageRoot, "..", "..", "templates", "cleo-gitignore");
|
|
67192
67513
|
const templatePath = existsSync17(localTemplatePath) ? localTemplatePath : monorepoTemplatePath;
|
|
67193
67514
|
if (existsSync17(templatePath)) {
|
|
67194
67515
|
return readFileSync13(templatePath, "utf-8");
|
|
@@ -67296,6 +67617,11 @@ var init_init = __esm({
|
|
|
67296
67617
|
type: "boolean",
|
|
67297
67618
|
description: "With --workflows: print the rendered YAML without writing.",
|
|
67298
67619
|
default: false
|
|
67620
|
+
},
|
|
67621
|
+
"new-identity": {
|
|
67622
|
+
type: "boolean",
|
|
67623
|
+
description: "Mint a new project identity instead of re-linking a registered one (T12325). Never rewrites an existing .cleo/project-id.",
|
|
67624
|
+
default: false
|
|
67299
67625
|
}
|
|
67300
67626
|
},
|
|
67301
67627
|
async run({ args }) {
|
|
@@ -67340,7 +67666,8 @@ var init_init = __esm({
|
|
|
67340
67666
|
force: !!args.force,
|
|
67341
67667
|
detect: !!args.detect,
|
|
67342
67668
|
mapCodebase: !!args["map-codebase"],
|
|
67343
|
-
installSeedAgents: !!args["install-seed-agents"]
|
|
67669
|
+
installSeedAgents: !!args["install-seed-agents"],
|
|
67670
|
+
newIdentity: !!args["new-identity"]
|
|
67344
67671
|
};
|
|
67345
67672
|
const result = await initProject2(initOpts);
|
|
67346
67673
|
const nextSteps = [...result.nextSteps ?? []];
|
|
@@ -68315,7 +68642,7 @@ var llm_cost_exports = {};
|
|
|
68315
68642
|
__export(llm_cost_exports, {
|
|
68316
68643
|
costCommand: () => costCommand
|
|
68317
68644
|
});
|
|
68318
|
-
import { getProjectRoot as
|
|
68645
|
+
import { getProjectRoot as getProjectRoot57 } from "@cleocode/core/internal";
|
|
68319
68646
|
import { computeCost } from "@cleocode/core/llm/usage-pricing";
|
|
68320
68647
|
function resolveSessionId(raw) {
|
|
68321
68648
|
if (raw === "current") {
|
|
@@ -68388,7 +68715,7 @@ var init_llm_cost = __esm({
|
|
|
68388
68715
|
process.exit(6);
|
|
68389
68716
|
}
|
|
68390
68717
|
const sessionId = resolveSessionId(rawSessionId);
|
|
68391
|
-
const projectRoot =
|
|
68718
|
+
const projectRoot = getProjectRoot57(process.cwd());
|
|
68392
68719
|
let breakdown;
|
|
68393
68720
|
try {
|
|
68394
68721
|
breakdown = await loadSessionCostBreakdown(projectRoot, sessionId);
|
|
@@ -69723,7 +70050,7 @@ var memory_exports = {};
|
|
|
69723
70050
|
__export(memory_exports, {
|
|
69724
70051
|
memoryCommand: () => memoryCommand
|
|
69725
70052
|
});
|
|
69726
|
-
import { getProjectRoot as
|
|
70053
|
+
import { getProjectRoot as getProjectRoot58 } from "@cleocode/core";
|
|
69727
70054
|
import {
|
|
69728
70055
|
getBrainDb as getBrainDb2,
|
|
69729
70056
|
getDreamStatus,
|
|
@@ -70681,7 +71008,7 @@ var init_memory3 = __esm({
|
|
|
70681
71008
|
},
|
|
70682
71009
|
args: {},
|
|
70683
71010
|
async run() {
|
|
70684
|
-
const root =
|
|
71011
|
+
const root = getProjectRoot58();
|
|
70685
71012
|
try {
|
|
70686
71013
|
const result = await runConsolidation(root);
|
|
70687
71014
|
cliOutput(result, { command: "memory-consolidate", operation: "memory.consolidate" });
|
|
@@ -70705,7 +71032,7 @@ var init_memory3 = __esm({
|
|
|
70705
71032
|
}
|
|
70706
71033
|
},
|
|
70707
71034
|
async run({ args }) {
|
|
70708
|
-
const root =
|
|
71035
|
+
const root = getProjectRoot58();
|
|
70709
71036
|
if (args.status) {
|
|
70710
71037
|
try {
|
|
70711
71038
|
const status = await getDreamStatus(root);
|
|
@@ -70742,7 +71069,7 @@ var init_memory3 = __esm({
|
|
|
70742
71069
|
}
|
|
70743
71070
|
},
|
|
70744
71071
|
async run({ args }) {
|
|
70745
|
-
const root =
|
|
71072
|
+
const root = getProjectRoot58();
|
|
70746
71073
|
try {
|
|
70747
71074
|
const { runObserver, runReflector } = await import("@cleocode/core/memory");
|
|
70748
71075
|
const observerResult = await runObserver(root, args.session, {
|
|
@@ -70782,7 +71109,7 @@ var init_memory3 = __esm({
|
|
|
70782
71109
|
}
|
|
70783
71110
|
},
|
|
70784
71111
|
async run({ args }) {
|
|
70785
|
-
const root =
|
|
71112
|
+
const root = getProjectRoot58();
|
|
70786
71113
|
await getBrainDb2(root);
|
|
70787
71114
|
const { getBrainNativeDb: getBrainNativeDb3 } = await import("@cleocode/core/internal");
|
|
70788
71115
|
const nativeDb = getBrainNativeDb3();
|
|
@@ -70807,7 +71134,7 @@ var init_memory3 = __esm({
|
|
|
70807
71134
|
}
|
|
70808
71135
|
},
|
|
70809
71136
|
async run({ args }) {
|
|
70810
|
-
const root =
|
|
71137
|
+
const root = getProjectRoot58();
|
|
70811
71138
|
try {
|
|
70812
71139
|
await getBrainDb2(root);
|
|
70813
71140
|
const { totalDuplicateRows, groups } = await scanDuplicateEntries();
|
|
@@ -70853,7 +71180,7 @@ var init_memory3 = __esm({
|
|
|
70853
71180
|
async run({ args }) {
|
|
70854
71181
|
const sourceDir = args.from;
|
|
70855
71182
|
const isDryRun = !!args["dry-run"];
|
|
70856
|
-
const projectRoot =
|
|
71183
|
+
const projectRoot = getProjectRoot58();
|
|
70857
71184
|
try {
|
|
70858
71185
|
const result = await importMemoryFiles({
|
|
70859
71186
|
sourceDir,
|
|
@@ -71004,7 +71331,7 @@ var init_memory3 = __esm({
|
|
|
71004
71331
|
},
|
|
71005
71332
|
args: {},
|
|
71006
71333
|
async run() {
|
|
71007
|
-
const root =
|
|
71334
|
+
const root = getProjectRoot58();
|
|
71008
71335
|
try {
|
|
71009
71336
|
await getBrainDb2(root);
|
|
71010
71337
|
const result = await getTierStats(root);
|
|
@@ -71047,7 +71374,7 @@ var init_memory3 = __esm({
|
|
|
71047
71374
|
}
|
|
71048
71375
|
},
|
|
71049
71376
|
async run({ args }) {
|
|
71050
|
-
const root =
|
|
71377
|
+
const root = getProjectRoot58();
|
|
71051
71378
|
const targetTier = args.to;
|
|
71052
71379
|
const reason = args.reason;
|
|
71053
71380
|
const validTiers = ["medium", "long"];
|
|
@@ -71113,7 +71440,7 @@ var init_memory3 = __esm({
|
|
|
71113
71440
|
}
|
|
71114
71441
|
},
|
|
71115
71442
|
async run({ args }) {
|
|
71116
|
-
const root =
|
|
71443
|
+
const root = getProjectRoot58();
|
|
71117
71444
|
const targetTier = args.to;
|
|
71118
71445
|
const reason = args.reason;
|
|
71119
71446
|
const validTiers = ["short", "medium"];
|
|
@@ -71584,7 +71911,7 @@ var migrate_claude_mem_exports = {};
|
|
|
71584
71911
|
__export(migrate_claude_mem_exports, {
|
|
71585
71912
|
migrateClaudeMemCommand: () => migrateClaudeMemCommand
|
|
71586
71913
|
});
|
|
71587
|
-
import { getProjectRoot as
|
|
71914
|
+
import { getProjectRoot as getProjectRoot59, migrateClaudeMem } from "@cleocode/core/internal";
|
|
71588
71915
|
import { ingestLooseAgentOutputs, ingestRcasdDirectories } from "@cleocode/core/memory";
|
|
71589
71916
|
import { getDb as getDb2 } from "@cleocode/core/store/sqlite";
|
|
71590
71917
|
var storageCommand, claudeMemCommand, manifestIngestCommand, migrateClaudeMemCommand;
|
|
@@ -71647,7 +71974,7 @@ var init_migrate_claude_mem = __esm({
|
|
|
71647
71974
|
}
|
|
71648
71975
|
},
|
|
71649
71976
|
async run({ args }) {
|
|
71650
|
-
const root =
|
|
71977
|
+
const root = getProjectRoot59();
|
|
71651
71978
|
try {
|
|
71652
71979
|
const result = await migrateClaudeMem(root, {
|
|
71653
71980
|
sourcePath: args.source,
|
|
@@ -71696,7 +72023,7 @@ var init_migrate_claude_mem = __esm({
|
|
|
71696
72023
|
}
|
|
71697
72024
|
},
|
|
71698
72025
|
async run({ args }) {
|
|
71699
|
-
const projectRoot =
|
|
72026
|
+
const projectRoot = getProjectRoot59();
|
|
71700
72027
|
try {
|
|
71701
72028
|
const db = await getDb2(projectRoot);
|
|
71702
72029
|
const rcasdFlag = Boolean(args.rcasd);
|
|
@@ -71815,10 +72142,18 @@ import { statSync as statSync2 } from "node:fs";
|
|
|
71815
72142
|
import { appendFile as appendFile2, mkdir as mkdir5 } from "node:fs/promises";
|
|
71816
72143
|
import { homedir as homedir5 } from "node:os";
|
|
71817
72144
|
import path4 from "node:path";
|
|
71818
|
-
import { getProjectRoot as
|
|
72145
|
+
import { getProjectRoot as getProjectRoot60 } from "@cleocode/core";
|
|
71819
72146
|
import { getSymbolImpact } from "@cleocode/core/nexus";
|
|
71820
72147
|
import { runNexusAnalysis } from "@cleocode/core/nexus/analyze-orchestrator.js";
|
|
71821
72148
|
import { exportNexusGraph } from "@cleocode/core/nexus/export.js";
|
|
72149
|
+
import {
|
|
72150
|
+
assessNexusFreshnessForQuery as assessNexusFreshnessForQuery2,
|
|
72151
|
+
assessNexusIndexFreshness,
|
|
72152
|
+
discloseNexusFreshness as discloseNexusFreshness2,
|
|
72153
|
+
judgeSymbolFiles as judgeSymbolFiles2,
|
|
72154
|
+
querySymbolFiles as querySymbolFiles2,
|
|
72155
|
+
withNexusFreshnessMeta as withNexusFreshnessMeta2
|
|
72156
|
+
} from "@cleocode/core/nexus/freshness.js";
|
|
71822
72157
|
import { KnowledgeSymbolAmbiguityError } from "@cleocode/core/nexus/knowledge.js";
|
|
71823
72158
|
import { runNexusWiki } from "@cleocode/core/nexus/wiki-orchestrator.js";
|
|
71824
72159
|
async function appendDeprecationTelemetry(op, replacement) {
|
|
@@ -71924,6 +72259,10 @@ var init_nexus3 = __esm({
|
|
|
71924
72259
|
type: "string",
|
|
71925
72260
|
description: "Override the project ID (default: auto-detected from path)"
|
|
71926
72261
|
},
|
|
72262
|
+
references: {
|
|
72263
|
+
type: "boolean",
|
|
72264
|
+
description: "Include every retained unresolved/unmodeled reference (large; the default reports referenceCount)"
|
|
72265
|
+
},
|
|
71927
72266
|
json: {
|
|
71928
72267
|
type: "boolean",
|
|
71929
72268
|
description: "Output as JSON (LAFS envelope format)"
|
|
@@ -71946,7 +72285,7 @@ var init_nexus3 = __esm({
|
|
|
71946
72285
|
async run({ args }) {
|
|
71947
72286
|
applyJsonFlag2(args.json);
|
|
71948
72287
|
const projectIdOverride = args["project-id"];
|
|
71949
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
72288
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot60();
|
|
71950
72289
|
const startTime = Date.now();
|
|
71951
72290
|
if (args.path) {
|
|
71952
72291
|
let isDir = false;
|
|
@@ -71985,7 +72324,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648), so the coun
|
|
|
71985
72324
|
process.exitCode = 2 /* INVALID_INPUT */;
|
|
71986
72325
|
return;
|
|
71987
72326
|
}
|
|
71988
|
-
const currentRoot =
|
|
72327
|
+
const currentRoot = getProjectRoot60();
|
|
71989
72328
|
if (args.path && path4.resolve(repoPath) !== path4.resolve(currentRoot)) {
|
|
71990
72329
|
cliError(
|
|
71991
72330
|
`nexus status cannot report on '${repoPath}' from this project.
|
|
@@ -72001,7 +72340,11 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
72001
72340
|
return;
|
|
72002
72341
|
}
|
|
72003
72342
|
try {
|
|
72004
|
-
const [
|
|
72343
|
+
const [
|
|
72344
|
+
{ getNexusDb, nexusSchema },
|
|
72345
|
+
{ getIndexStats },
|
|
72346
|
+
{ readKnowledgeIndexAssessment, readKnowledgeIndexReferences }
|
|
72347
|
+
] = await Promise.all([
|
|
72005
72348
|
import("@cleocode/core/store/nexus-sqlite"),
|
|
72006
72349
|
import("@cleocode/nexus/pipeline"),
|
|
72007
72350
|
import("@cleocode/core/nexus/knowledge")
|
|
@@ -72012,11 +72355,22 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
72012
72355
|
nexusNodes: nexusSchema.nexusNodes,
|
|
72013
72356
|
nexusRelations: nexusSchema.nexusRelations
|
|
72014
72357
|
};
|
|
72015
|
-
const
|
|
72016
|
-
const
|
|
72358
|
+
const freshness = await assessNexusIndexFreshness(currentRoot);
|
|
72359
|
+
const stats = await getIndexStats(projectId, repoPath, db, tables, {
|
|
72360
|
+
staleScan: freshness.status === "unknown"
|
|
72361
|
+
});
|
|
72362
|
+
const summary = await readKnowledgeIndexAssessment(currentRoot);
|
|
72363
|
+
const assessment = summary && args.references ? { ...summary, references: await readKnowledgeIndexReferences(currentRoot) } : summary;
|
|
72017
72364
|
const durationMs = Date.now() - startTime;
|
|
72018
72365
|
cliOutput(
|
|
72019
|
-
{
|
|
72366
|
+
{
|
|
72367
|
+
projectId,
|
|
72368
|
+
repoPath,
|
|
72369
|
+
...stats,
|
|
72370
|
+
...freshness.status === "unknown" ? {} : { staleFileCount: freshness.staleFileCount },
|
|
72371
|
+
freshness,
|
|
72372
|
+
assessment
|
|
72373
|
+
},
|
|
72020
72374
|
{
|
|
72021
72375
|
command: "nexus-status",
|
|
72022
72376
|
operation: "nexus.status",
|
|
@@ -72515,7 +72869,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
72515
72869
|
applyJsonFlag2(args.json);
|
|
72516
72870
|
const startTime = Date.now();
|
|
72517
72871
|
const projectIdOverride = args["project-id"];
|
|
72518
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
72872
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot60();
|
|
72519
72873
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
72520
72874
|
const response = await dispatchRaw("query", "nexus", "clusters", { projectId, repoPath });
|
|
72521
72875
|
const durationMs = Date.now() - startTime;
|
|
@@ -72559,7 +72913,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
72559
72913
|
applyJsonFlag2(args.json);
|
|
72560
72914
|
const startTime = Date.now();
|
|
72561
72915
|
const projectIdOverride = args["project-id"];
|
|
72562
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
72916
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot60();
|
|
72563
72917
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
72564
72918
|
const response = await dispatchRaw("query", "nexus", "flows", { projectId, repoPath });
|
|
72565
72919
|
const durationMs = Date.now() - startTime;
|
|
@@ -72602,7 +72956,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
72602
72956
|
void appendDeprecationTelemetry("nexus.context", "cleo graph context");
|
|
72603
72957
|
const startTime = Date.now();
|
|
72604
72958
|
const projectIdOverride = args["project-id"];
|
|
72605
|
-
const repoPath =
|
|
72959
|
+
const repoPath = getProjectRoot60();
|
|
72606
72960
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
72607
72961
|
const limit = parseInt(args.limit, 10);
|
|
72608
72962
|
const symbolName = args.symbol;
|
|
@@ -72665,23 +73019,29 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
72665
73019
|
const startTime = Date.now();
|
|
72666
73020
|
const whyFlag = !!args.why;
|
|
72667
73021
|
const projectIdOverride = args["project-id"];
|
|
72668
|
-
const repoPath =
|
|
73022
|
+
const repoPath = getProjectRoot60();
|
|
72669
73023
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
72670
73024
|
const maxDepth = Math.min(parseInt(args.depth, 10), 5);
|
|
72671
73025
|
const symbolName = args.symbol;
|
|
72672
73026
|
try {
|
|
73027
|
+
const assessment = await assessNexusFreshnessForQuery2(repoPath);
|
|
72673
73028
|
const result = await getSymbolImpact(symbolName, projectId, repoPath, {
|
|
72674
73029
|
maxDepth,
|
|
72675
73030
|
why: whyFlag
|
|
72676
73031
|
});
|
|
73032
|
+
const freshness = judgeSymbolFiles2(assessment, querySymbolFiles2(result));
|
|
73033
|
+
discloseNexusFreshness2("nexus impact", freshness);
|
|
72677
73034
|
const durationMs = Date.now() - startTime;
|
|
72678
73035
|
cliOutput({ ...result, _symbolName: symbolName, _why: whyFlag }, {
|
|
72679
73036
|
command: "nexus-impact",
|
|
72680
73037
|
operation: "nexus.impact",
|
|
72681
|
-
extensions:
|
|
72682
|
-
|
|
72683
|
-
|
|
72684
|
-
|
|
73038
|
+
extensions: withNexusFreshnessMeta2(
|
|
73039
|
+
{
|
|
73040
|
+
duration_ms: durationMs,
|
|
73041
|
+
...buildNexusMetaExtensions("impact", { symbol: symbolName, projectId })
|
|
73042
|
+
},
|
|
73043
|
+
freshness
|
|
73044
|
+
)
|
|
72685
73045
|
});
|
|
72686
73046
|
} catch (err) {
|
|
72687
73047
|
const code = err instanceof Error && "code" in err ? err.code : void 0;
|
|
@@ -72744,26 +73104,33 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
72744
73104
|
type: "string",
|
|
72745
73105
|
description: "Comma-separated relative nested repository/worktree paths explicitly included in this project index"
|
|
72746
73106
|
},
|
|
73107
|
+
full: {
|
|
73108
|
+
type: "boolean",
|
|
73109
|
+
description: "Parse every file instead of reusing unchanged files (default: incremental, falling back to full with a stated reason)"
|
|
73110
|
+
},
|
|
72747
73111
|
incremental: {
|
|
72748
73112
|
type: "boolean",
|
|
72749
|
-
description: "
|
|
73113
|
+
description: "Deprecated no-op: incremental analysis is now the default (use --full to rebuild)"
|
|
72750
73114
|
}
|
|
72751
73115
|
},
|
|
72752
73116
|
async run({ args }) {
|
|
72753
73117
|
applyJsonFlag2(args.json);
|
|
72754
73118
|
const startTime = Date.now();
|
|
72755
73119
|
const projectIdOverride = args["project-id"];
|
|
72756
|
-
const
|
|
73120
|
+
const full = !!args.full;
|
|
72757
73121
|
const ctx = getFormatContext();
|
|
72758
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
72759
|
-
|
|
72760
|
-
|
|
72761
|
-
|
|
73122
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot60();
|
|
73123
|
+
if (args.incremental)
|
|
73124
|
+
humanWarn(
|
|
73125
|
+
"[nexus] --incremental is deprecated and has no effect: incremental is the default."
|
|
73126
|
+
);
|
|
73127
|
+
humanInfo(`[nexus] Analyzing: ${repoPath}${full ? " (full rebuild)" : ""}`);
|
|
73128
|
+
humanInfo("[nexus] Staging replacement graph; current index remains available...");
|
|
72762
73129
|
try {
|
|
72763
73130
|
const result = await runNexusAnalysis({
|
|
72764
73131
|
repoPath,
|
|
72765
73132
|
projectIdOverride,
|
|
72766
|
-
|
|
73133
|
+
full,
|
|
72767
73134
|
includedRepositories: args["include-repositories"]?.split(",").map((entry) => entry.trim()).filter(Boolean),
|
|
72768
73135
|
onProgress: ctx.format === "json" ? void 0 : (current, total, filePath) => {
|
|
72769
73136
|
if (current % 50 === 0 || current === total) {
|
|
@@ -72774,11 +73141,17 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
72774
73141
|
});
|
|
72775
73142
|
humanInfo(`[nexus] nexus-bridge.md refreshed at ${repoPath}/.cleo/nexus-bridge.md`);
|
|
72776
73143
|
humanInfo("[nexus] Project registered/updated in multi-project registry.");
|
|
73144
|
+
humanInfo(
|
|
73145
|
+
`[nexus] Mode: ${result.summary.mode} \u2014 ${result.summary.reason} (parsed ${result.summary.parsedFiles}, reused ${result.summary.reusedFiles})`
|
|
73146
|
+
);
|
|
72777
73147
|
cliOutput(
|
|
72778
73148
|
{
|
|
72779
73149
|
projectId: result.projectId,
|
|
72780
73150
|
repoPath,
|
|
72781
|
-
incremental:
|
|
73151
|
+
incremental: result.incremental,
|
|
73152
|
+
mode: result.summary.mode,
|
|
73153
|
+
reason: result.summary.reason,
|
|
73154
|
+
summary: result.summary,
|
|
72782
73155
|
nodeCount: result.nodeCount,
|
|
72783
73156
|
relationCount: result.relationCount,
|
|
72784
73157
|
fileCount: result.fileCount,
|
|
@@ -72864,7 +73237,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
72864
73237
|
async run({ args }) {
|
|
72865
73238
|
applyJsonFlag2(args.json);
|
|
72866
73239
|
const startTime = Date.now();
|
|
72867
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
73240
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot60();
|
|
72868
73241
|
const name = args.name;
|
|
72869
73242
|
const response = await dispatchRaw("mutate", "nexus", "projects.register", {
|
|
72870
73243
|
path: repoPath,
|
|
@@ -73020,11 +73393,11 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
73020
73393
|
},
|
|
73021
73394
|
"include-temp": {
|
|
73022
73395
|
type: "boolean",
|
|
73023
|
-
description: "Preset: match paths containing a .temp/ segment"
|
|
73396
|
+
description: "Preset: match paths containing a .temp/ segment or under the OS temp directory"
|
|
73024
73397
|
},
|
|
73025
73398
|
"include-tests": {
|
|
73026
73399
|
type: "boolean",
|
|
73027
|
-
description: "Preset: match paths containing tmp/test/fixture/scratch/sandbox segments"
|
|
73400
|
+
description: "Preset: match paths containing tmp/test(s)/__tests__/fixture(s)/scratch/sandbox segments"
|
|
73028
73401
|
},
|
|
73029
73402
|
unhealthy: {
|
|
73030
73403
|
type: "boolean",
|
|
@@ -73044,7 +73417,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
73044
73417
|
},
|
|
73045
73418
|
vacuum: {
|
|
73046
73419
|
type: "boolean",
|
|
73047
|
-
description: "After delete,
|
|
73420
|
+
description: "After delete, VACUUM the global registry store (<cleoHome>/cleo.db) to reclaim space"
|
|
73048
73421
|
},
|
|
73049
73422
|
yes: {
|
|
73050
73423
|
type: "boolean",
|
|
@@ -73090,10 +73463,16 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
73090
73463
|
return;
|
|
73091
73464
|
}
|
|
73092
73465
|
const preview = previewResp.data;
|
|
73093
|
-
const {
|
|
73466
|
+
const {
|
|
73467
|
+
matched: matchCount,
|
|
73468
|
+
totalCount,
|
|
73469
|
+
sample: samplePaths,
|
|
73470
|
+
classification,
|
|
73471
|
+
matchedByReason
|
|
73472
|
+
} = preview;
|
|
73094
73473
|
if (ctx.format !== "json") {
|
|
73095
73474
|
cliOutput(
|
|
73096
|
-
{ matched: matchCount, totalCount, sample: samplePaths },
|
|
73475
|
+
{ matched: matchCount, totalCount, sample: samplePaths, classification },
|
|
73097
73476
|
{
|
|
73098
73477
|
command: "nexus-projects-clean-preview",
|
|
73099
73478
|
operation: "nexus.projects.clean",
|
|
@@ -73109,7 +73488,9 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
73109
73488
|
matched: matchCount,
|
|
73110
73489
|
purged: 0,
|
|
73111
73490
|
remaining: totalCount,
|
|
73112
|
-
sample: samplePaths
|
|
73491
|
+
sample: samplePaths,
|
|
73492
|
+
classification,
|
|
73493
|
+
matchedByReason
|
|
73113
73494
|
},
|
|
73114
73495
|
{
|
|
73115
73496
|
command: "nexus-projects-clean",
|
|
@@ -73169,7 +73550,10 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
73169
73550
|
sample: result.sample,
|
|
73170
73551
|
fsRemoved: result.fsRemoved,
|
|
73171
73552
|
fsFailed: result.fsFailed,
|
|
73172
|
-
vacuumBytesFreed: result.vacuumBytesFreed
|
|
73553
|
+
vacuumBytesFreed: result.vacuumBytesFreed,
|
|
73554
|
+
classification: result.classification,
|
|
73555
|
+
matchedByReason: result.matchedByReason,
|
|
73556
|
+
receipt: result.receipt
|
|
73173
73557
|
},
|
|
73174
73558
|
{
|
|
73175
73559
|
command: "nexus-projects-clean",
|
|
@@ -73225,7 +73609,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
73225
73609
|
applyJsonFlag2(args.json);
|
|
73226
73610
|
const startTime = Date.now();
|
|
73227
73611
|
const projectIdOverride = args["project-id"];
|
|
73228
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
73612
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot60();
|
|
73229
73613
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
73230
73614
|
const response = await dispatchRaw("mutate", "nexus", "refresh-bridge", {
|
|
73231
73615
|
repoPath,
|
|
@@ -73279,8 +73663,8 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
73279
73663
|
projectFilter
|
|
73280
73664
|
});
|
|
73281
73665
|
if (outputFile) {
|
|
73282
|
-
const { writeFileSync:
|
|
73283
|
-
|
|
73666
|
+
const { writeFileSync: writeFileSync8 } = await import("node:fs");
|
|
73667
|
+
writeFileSync8(outputFile, result.content, "utf-8");
|
|
73284
73668
|
const durationMs = Date.now() - startTime;
|
|
73285
73669
|
cliOutput(
|
|
73286
73670
|
{ outputFile, nodeCount: result.nodeCount, edgeCount: result.edgeCount },
|
|
@@ -73331,7 +73715,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
73331
73715
|
async run({ args }) {
|
|
73332
73716
|
applyJsonFlag2(args.json);
|
|
73333
73717
|
const startTime = Date.now();
|
|
73334
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
73718
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot60();
|
|
73335
73719
|
const projectIdOverride = args["project-id"];
|
|
73336
73720
|
const beforeRef = args.before ?? "HEAD~1";
|
|
73337
73721
|
const afterRef = args.after ?? "HEAD";
|
|
@@ -73449,7 +73833,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
73449
73833
|
applyJsonFlag2(args.json);
|
|
73450
73834
|
const startTime = Date.now();
|
|
73451
73835
|
const projectIdOverride = args["project-id"];
|
|
73452
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
73836
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot60();
|
|
73453
73837
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
73454
73838
|
const response = await dispatchRaw("query", "nexus", "route-map", { projectId });
|
|
73455
73839
|
const durationMs = Date.now() - startTime;
|
|
@@ -73505,7 +73889,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
73505
73889
|
const startTime = Date.now();
|
|
73506
73890
|
const routeSymbol = args.routeSymbol;
|
|
73507
73891
|
const projectIdOverride = args["project-id"];
|
|
73508
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
73892
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot60();
|
|
73509
73893
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
73510
73894
|
const response = await dispatchRaw("query", "nexus", "shape-check", { routeSymbol, projectId });
|
|
73511
73895
|
const durationMs = Date.now() - startTime;
|
|
@@ -73901,7 +74285,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
73901
74285
|
async run({ args }) {
|
|
73902
74286
|
applyJsonFlag2(args.json);
|
|
73903
74287
|
const startTime = Date.now();
|
|
73904
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
74288
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot60();
|
|
73905
74289
|
const projectIdOverride = args["project-id"];
|
|
73906
74290
|
const projectId = projectIdOverride ?? Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
73907
74291
|
const response = await dispatchRaw("mutate", "nexus", "contracts-sync", {
|
|
@@ -74011,7 +74395,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
74011
74395
|
async run({ args }) {
|
|
74012
74396
|
applyJsonFlag2(args.json);
|
|
74013
74397
|
const startTime = Date.now();
|
|
74014
|
-
const repoPath = args.path ? path4.resolve(args.path) :
|
|
74398
|
+
const repoPath = args.path ? path4.resolve(args.path) : getProjectRoot60();
|
|
74015
74399
|
const projectId = Buffer.from(repoPath).toString("base64url").slice(0, 32);
|
|
74016
74400
|
const response = await dispatchRaw("mutate", "nexus", "contracts-link-tasks", {
|
|
74017
74401
|
projectId,
|
|
@@ -74095,7 +74479,7 @@ The code-intelligence graph is project-scoped (ADR-090 \xB7 T11648): one store p
|
|
|
74095
74479
|
const isIncremental = !!args.incremental;
|
|
74096
74480
|
try {
|
|
74097
74481
|
const result = await runNexusWiki({
|
|
74098
|
-
projectRoot:
|
|
74482
|
+
projectRoot: getProjectRoot60(),
|
|
74099
74483
|
outputDir,
|
|
74100
74484
|
communityFilter,
|
|
74101
74485
|
incremental: isIncremental
|
|
@@ -74445,7 +74829,7 @@ __export(orchestrate_exports, {
|
|
|
74445
74829
|
});
|
|
74446
74830
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
74447
74831
|
import { orchestration } from "@cleocode/core";
|
|
74448
|
-
import { BUILD_CONFIG as BUILD_CONFIG2, getProjectRoot as
|
|
74832
|
+
import { BUILD_CONFIG as BUILD_CONFIG2, getProjectRoot as getProjectRoot61 } from "@cleocode/core/internal";
|
|
74449
74833
|
function formatRollupTable(rollup) {
|
|
74450
74834
|
const waves = "waves" in rollup ? rollup.waves : [rollup];
|
|
74451
74835
|
const lines = [];
|
|
@@ -74588,7 +74972,7 @@ var init_orchestrate3 = __esm({
|
|
|
74588
74972
|
},
|
|
74589
74973
|
async run({ args }) {
|
|
74590
74974
|
const rateWindowHours = args.window !== void 0 ? Number.parseFloat(String(args.window)) : void 0;
|
|
74591
|
-
const metrics = await orchestration.collectOrchestrateDashboard(
|
|
74975
|
+
const metrics = await orchestration.collectOrchestrateDashboard(getProjectRoot61(), {
|
|
74592
74976
|
...rateWindowHours !== void 0 && Number.isFinite(rateWindowHours) && rateWindowHours > 0 ? { rateWindowHours } : {}
|
|
74593
74977
|
});
|
|
74594
74978
|
cliOutput(metrics, {
|
|
@@ -76753,7 +77137,7 @@ var refresh_memory_exports = {};
|
|
|
76753
77137
|
__export(refresh_memory_exports, {
|
|
76754
77138
|
refreshMemoryCommand: () => refreshMemoryCommand
|
|
76755
77139
|
});
|
|
76756
|
-
import { getProjectRoot as
|
|
77140
|
+
import { getProjectRoot as getProjectRoot62 } from "@cleocode/core";
|
|
76757
77141
|
var refreshMemoryCommand;
|
|
76758
77142
|
var init_refresh_memory = __esm({
|
|
76759
77143
|
"packages/cleo/src/cli/commands/refresh-memory.ts"() {
|
|
@@ -76766,7 +77150,7 @@ var init_refresh_memory = __esm({
|
|
|
76766
77150
|
description: "Regenerate .cleo/memory-bridge.md from brain.db"
|
|
76767
77151
|
},
|
|
76768
77152
|
async run() {
|
|
76769
|
-
const projectDir =
|
|
77153
|
+
const projectDir = getProjectRoot62();
|
|
76770
77154
|
const { writeMemoryBridge } = await import("@cleocode/core/internal");
|
|
76771
77155
|
const result = await writeMemoryBridge(projectDir);
|
|
76772
77156
|
if (result.written) {
|
|
@@ -78350,7 +78734,7 @@ import fs3 from "node:fs";
|
|
|
78350
78734
|
import path5 from "node:path";
|
|
78351
78735
|
import {
|
|
78352
78736
|
CleoError as CleoError10,
|
|
78353
|
-
getProjectRoot as
|
|
78737
|
+
getProjectRoot as getProjectRoot63,
|
|
78354
78738
|
getTaskAccessor as getTaskAccessor3,
|
|
78355
78739
|
parseConflictReport,
|
|
78356
78740
|
setAtPath
|
|
@@ -78371,7 +78755,7 @@ var init_restore = __esm({
|
|
|
78371
78755
|
description: "Apply manually-resolved conflicts from .cleo/restore-conflicts.md"
|
|
78372
78756
|
},
|
|
78373
78757
|
async run() {
|
|
78374
|
-
const projectRoot =
|
|
78758
|
+
const projectRoot = getProjectRoot63();
|
|
78375
78759
|
const reportPath = path5.join(projectRoot, CLEO_DIR_NAME3, RESTORE_CONFLICTS_MD);
|
|
78376
78760
|
if (!fs3.existsSync(reportPath)) {
|
|
78377
78761
|
humanLine("No pending restore conflicts. Nothing to finalize.");
|
|
@@ -78737,7 +79121,7 @@ __export(revert_exports, {
|
|
|
78737
79121
|
revertCommand: () => revertCommand
|
|
78738
79122
|
});
|
|
78739
79123
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
78740
|
-
import { join as
|
|
79124
|
+
import { join as join30 } from "node:path";
|
|
78741
79125
|
import { cwd as processCwd2 } from "node:process";
|
|
78742
79126
|
import { E_RECEIPT_NOT_FOUND } from "@cleocode/core/sentient/chain-walker.js";
|
|
78743
79127
|
import { SENTIENT_STATE_FILE } from "@cleocode/core/sentient/daemon.js";
|
|
@@ -78790,7 +79174,7 @@ async function loadOwnerAttestation(attestationFilePath) {
|
|
|
78790
79174
|
return obj;
|
|
78791
79175
|
}
|
|
78792
79176
|
async function loadOwnerPubkeys(projectRoot) {
|
|
78793
|
-
const path6 =
|
|
79177
|
+
const path6 = join30(projectRoot, OWNER_PUBKEYS_FILE);
|
|
78794
79178
|
try {
|
|
78795
79179
|
const raw = await readFile8(path6, "utf-8");
|
|
78796
79180
|
const parsed = JSON.parse(raw);
|
|
@@ -78874,7 +79258,7 @@ var init_revert = __esm({
|
|
|
78874
79258
|
if (attestation && allowedPubkeys.size > 0 && !allowedPubkeys.has(attestation.ownerPubkey)) {
|
|
78875
79259
|
emitFailure2(
|
|
78876
79260
|
E_OWNER_ATTESTATION_REQUIRED,
|
|
78877
|
-
`Attestation pubkey "${attestation.ownerPubkey}" is not in the owner allowlist at ${
|
|
79261
|
+
`Attestation pubkey "${attestation.ownerPubkey}" is not in the owner allowlist at ${join30(projectRoot, OWNER_PUBKEYS_FILE)}`,
|
|
78878
79262
|
jsonMode
|
|
78879
79263
|
);
|
|
78880
79264
|
}
|
|
@@ -78927,7 +79311,7 @@ ${lines}`
|
|
|
78927
79311
|
identity,
|
|
78928
79312
|
includeHuman
|
|
78929
79313
|
});
|
|
78930
|
-
const statePath =
|
|
79314
|
+
const statePath = join30(projectRoot, SENTIENT_STATE_FILE);
|
|
78931
79315
|
const state = await readSentientState(statePath);
|
|
78932
79316
|
emitSuccess(
|
|
78933
79317
|
{
|
|
@@ -79293,8 +79677,8 @@ var init_saga = __esm({
|
|
|
79293
79677
|
}
|
|
79294
79678
|
},
|
|
79295
79679
|
async run({ args }) {
|
|
79296
|
-
const { sagas: sagas2, getProjectRoot:
|
|
79297
|
-
const projectRoot =
|
|
79680
|
+
const { sagas: sagas2, getProjectRoot: getProjectRoot69 } = await import("@cleocode/core");
|
|
79681
|
+
const projectRoot = getProjectRoot69();
|
|
79298
79682
|
const sagaId = typeof args.sagaId === "string" && args.sagaId.length > 0 ? args.sagaId : void 0;
|
|
79299
79683
|
const result = await sagas2.sagaNext(projectRoot, { sagaId });
|
|
79300
79684
|
cliOutput(result.success ? result.data : result, { command: "saga", operation: "saga.next" });
|
|
@@ -79508,7 +79892,7 @@ __export(self_update_exports, {
|
|
|
79508
79892
|
});
|
|
79509
79893
|
import { execFile } from "node:child_process";
|
|
79510
79894
|
import { readFile as readFile9 } from "node:fs/promises";
|
|
79511
|
-
import { join as
|
|
79895
|
+
import { join as join31 } from "node:path";
|
|
79512
79896
|
import * as readline3 from "node:readline";
|
|
79513
79897
|
import { promisify } from "node:util";
|
|
79514
79898
|
import {
|
|
@@ -79516,14 +79900,14 @@ import {
|
|
|
79516
79900
|
CleoError as CleoError11,
|
|
79517
79901
|
checkAllRegisteredProjects as checkAllRegisteredProjects2,
|
|
79518
79902
|
checkStorageMigration,
|
|
79519
|
-
getCleoHome as
|
|
79903
|
+
getCleoHome as getCleoHome7,
|
|
79520
79904
|
getRuntimeDiagnostics as getRuntimeDiagnostics2,
|
|
79521
79905
|
runUpgrade
|
|
79522
79906
|
} from "@cleocode/core/internal";
|
|
79523
79907
|
async function getCurrentVersion() {
|
|
79524
|
-
const cleoHome =
|
|
79908
|
+
const cleoHome = getCleoHome7();
|
|
79525
79909
|
try {
|
|
79526
|
-
const content = await readFile9(
|
|
79910
|
+
const content = await readFile9(join31(cleoHome, "VERSION"), "utf-8");
|
|
79527
79911
|
return (content.split("\n")[0] ?? "unknown").trim();
|
|
79528
79912
|
} catch {
|
|
79529
79913
|
return "unknown";
|
|
@@ -79568,7 +79952,7 @@ async function getDistTagVersion(tag) {
|
|
|
79568
79952
|
}
|
|
79569
79953
|
}
|
|
79570
79954
|
async function writeRuntimeVersionMetadata(mode, source, version) {
|
|
79571
|
-
const cleoHome =
|
|
79955
|
+
const cleoHome = getCleoHome7();
|
|
79572
79956
|
const lines = [
|
|
79573
79957
|
version,
|
|
79574
79958
|
`mode=${mode}`,
|
|
@@ -79577,7 +79961,7 @@ async function writeRuntimeVersionMetadata(mode, source, version) {
|
|
|
79577
79961
|
];
|
|
79578
79962
|
await import("node:fs/promises").then(
|
|
79579
79963
|
({ writeFile: writeFile4, mkdir: mkdir7 }) => mkdir7(cleoHome, { recursive: true }).then(
|
|
79580
|
-
() => writeFile4(
|
|
79964
|
+
() => writeFile4(join31(cleoHome, "VERSION"), `${lines.join("\n")}
|
|
79581
79965
|
`, "utf-8")
|
|
79582
79966
|
)
|
|
79583
79967
|
);
|
|
@@ -80057,7 +80441,7 @@ __export(sentient_exports, {
|
|
|
80057
80441
|
promptAcceptExecution: () => promptAcceptExecution,
|
|
80058
80442
|
sentientCommand: () => sentientCommand
|
|
80059
80443
|
});
|
|
80060
|
-
import { join as
|
|
80444
|
+
import { join as join32 } from "node:path";
|
|
80061
80445
|
import { cwd as processCwd3, stdin, stdout } from "node:process";
|
|
80062
80446
|
import { createInterface as createInterface4 } from "node:readline/promises";
|
|
80063
80447
|
import {
|
|
@@ -80146,7 +80530,7 @@ var init_sentient3 = __esm({
|
|
|
80146
80530
|
return;
|
|
80147
80531
|
}
|
|
80148
80532
|
if (dryRun) {
|
|
80149
|
-
const statePath2 =
|
|
80533
|
+
const statePath2 = join32(projectRoot, SENTIENT_STATE_FILE2);
|
|
80150
80534
|
const outcome = await safeRunTick({ projectRoot, statePath: statePath2, dryRun: true });
|
|
80151
80535
|
emitSuccess2(
|
|
80152
80536
|
{ dryRun: true, outcome },
|
|
@@ -80262,7 +80646,7 @@ Logs: ${logPath}`
|
|
|
80262
80646
|
const jsonMode = args.json === true;
|
|
80263
80647
|
const dryRun = args["dry-run"] === true;
|
|
80264
80648
|
try {
|
|
80265
|
-
const statePath =
|
|
80649
|
+
const statePath = join32(projectRoot, SENTIENT_STATE_FILE2);
|
|
80266
80650
|
const outcome = await safeRunTick({ projectRoot, statePath, dryRun });
|
|
80267
80651
|
emitSuccess2(
|
|
80268
80652
|
{ outcome, dryRun },
|
|
@@ -80354,7 +80738,7 @@ Logs: ${logPath}`
|
|
|
80354
80738
|
return;
|
|
80355
80739
|
}
|
|
80356
80740
|
await db.update(tasks).set({ status: "pending", updatedAt: now }).where(eq2(tasks.id, id)).run();
|
|
80357
|
-
const statePath =
|
|
80741
|
+
const statePath = join32(projectRoot, SENTIENT_STATE_FILE2);
|
|
80358
80742
|
const state = await readSentientState2(statePath);
|
|
80359
80743
|
await patchSentientState(statePath, {
|
|
80360
80744
|
tier2Stats: {
|
|
@@ -80450,7 +80834,7 @@ Logs: ${logPath}`
|
|
|
80450
80834
|
return;
|
|
80451
80835
|
}
|
|
80452
80836
|
await db.update(tasks).set({ status: "cancelled", cancellationReason: reason, cancelledAt: now, updatedAt: now }).where(eq2(tasks.id, id)).run();
|
|
80453
|
-
const statePath =
|
|
80837
|
+
const statePath = join32(projectRoot, SENTIENT_STATE_FILE2);
|
|
80454
80838
|
const state = await readSentientState2(statePath);
|
|
80455
80839
|
await patchSentientState(statePath, {
|
|
80456
80840
|
tier2Stats: {
|
|
@@ -80495,7 +80879,7 @@ Logs: ${logPath}`
|
|
|
80495
80879
|
const projectRoot = resolveProjectRoot5(args.project);
|
|
80496
80880
|
const jsonMode = args.json === true;
|
|
80497
80881
|
try {
|
|
80498
|
-
const statePath =
|
|
80882
|
+
const statePath = join32(projectRoot, SENTIENT_STATE_FILE2);
|
|
80499
80883
|
const outcome = await safeRunProposeTick({ projectRoot, statePath });
|
|
80500
80884
|
emitSuccess2(
|
|
80501
80885
|
{ outcome },
|
|
@@ -80515,7 +80899,7 @@ Logs: ${logPath}`
|
|
|
80515
80899
|
const projectRoot = resolveProjectRoot5(args.project);
|
|
80516
80900
|
const jsonMode = args.json === true;
|
|
80517
80901
|
try {
|
|
80518
|
-
const statePath =
|
|
80902
|
+
const statePath = join32(projectRoot, SENTIENT_STATE_FILE2);
|
|
80519
80903
|
const updated = await patchSentientState(statePath, { tier2Enabled: true });
|
|
80520
80904
|
emitSuccess2({ tier2Enabled: updated.tier2Enabled }, jsonMode, "Tier-2 proposals enabled");
|
|
80521
80905
|
} catch (err) {
|
|
@@ -80534,7 +80918,7 @@ Logs: ${logPath}`
|
|
|
80534
80918
|
const projectRoot = resolveProjectRoot5(args.project);
|
|
80535
80919
|
const jsonMode = args.json === true;
|
|
80536
80920
|
try {
|
|
80537
|
-
const statePath =
|
|
80921
|
+
const statePath = join32(projectRoot, SENTIENT_STATE_FILE2);
|
|
80538
80922
|
const updated = await patchSentientState(statePath, { tier2Enabled: false });
|
|
80539
80923
|
emitSuccess2({ tier2Enabled: updated.tier2Enabled }, jsonMode, "Tier-2 proposals disabled");
|
|
80540
80924
|
} catch (err) {
|
|
@@ -80565,7 +80949,7 @@ Logs: ${logPath}`
|
|
|
80565
80949
|
const projectRoot = resolveProjectRoot5(args.project);
|
|
80566
80950
|
const jsonMode = args.json === true;
|
|
80567
80951
|
try {
|
|
80568
|
-
const statePath =
|
|
80952
|
+
const statePath = join32(projectRoot, SENTIENT_STATE_FILE2);
|
|
80569
80953
|
const state = await readSentientState2(statePath);
|
|
80570
80954
|
emitSuccess2(
|
|
80571
80955
|
{
|
|
@@ -81123,7 +81507,7 @@ var sequence_exports = {};
|
|
|
81123
81507
|
__export(sequence_exports, {
|
|
81124
81508
|
sequenceCommand: () => sequenceCommand
|
|
81125
81509
|
});
|
|
81126
|
-
import { getProjectRoot as
|
|
81510
|
+
import { getProjectRoot as getProjectRoot64 } from "@cleocode/core/internal";
|
|
81127
81511
|
var showCommand12, checkCommand7, repairCommand3, sequenceCommand;
|
|
81128
81512
|
var init_sequence = __esm({
|
|
81129
81513
|
"packages/cleo/src/cli/commands/sequence.ts"() {
|
|
@@ -81159,7 +81543,7 @@ var init_sequence = __esm({
|
|
|
81159
81543
|
meta: { name: "repair", description: "Reset counter to max + 1 if behind" },
|
|
81160
81544
|
async run() {
|
|
81161
81545
|
const { repairSequence } = await import("@cleocode/core/internal");
|
|
81162
|
-
const projectRoot =
|
|
81546
|
+
const projectRoot = getProjectRoot64();
|
|
81163
81547
|
const repair = await repairSequence(projectRoot);
|
|
81164
81548
|
const result = {
|
|
81165
81549
|
repaired: repair.repaired,
|
|
@@ -81752,8 +82136,8 @@ var init_session4 = __esm({
|
|
|
81752
82136
|
"audit-scope": { type: "string", description: "Audit log scope (global|local)" }
|
|
81753
82137
|
},
|
|
81754
82138
|
async run({ args }) {
|
|
81755
|
-
const { detectSessionDrift, getProjectRoot:
|
|
81756
|
-
const projectRoot = await
|
|
82139
|
+
const { detectSessionDrift, getProjectRoot: getProjectRoot69 } = await import("@cleocode/core");
|
|
82140
|
+
const projectRoot = await getProjectRoot69();
|
|
81757
82141
|
const scope = args["audit-scope"] === "local" ? "local" : "global";
|
|
81758
82142
|
const report = await detectSessionDrift({ projectRoot, auditScope: scope });
|
|
81759
82143
|
cliOutput(report, { command: "session drift", operation: "session.drift" });
|
|
@@ -84342,13 +84726,13 @@ var init_telemetry2 = __esm({
|
|
|
84342
84726
|
// packages/cleo/src/cli/commands/templates/lib.ts
|
|
84343
84727
|
import { readFileSync as readFileSync14 } from "node:fs";
|
|
84344
84728
|
import { isAbsolute as isAbsolute3, resolve as resolve10 } from "node:path";
|
|
84345
|
-
import { getProjectRoot as
|
|
84729
|
+
import { getProjectRoot as getProjectRoot65 } from "@cleocode/core";
|
|
84346
84730
|
import { resolveSourcePathAbsolute } from "@cleocode/core/templates/registry";
|
|
84347
84731
|
function resolveProjectRoot6(raw) {
|
|
84348
84732
|
if (typeof raw === "string" && raw.length > 0) {
|
|
84349
84733
|
return isAbsolute3(raw) ? raw : resolve10(process.cwd(), raw);
|
|
84350
84734
|
}
|
|
84351
|
-
return
|
|
84735
|
+
return getProjectRoot65();
|
|
84352
84736
|
}
|
|
84353
84737
|
function readTemplateSource(entry) {
|
|
84354
84738
|
const sourceAbsolute = resolveSourcePathAbsolute(entry);
|
|
@@ -84368,7 +84752,7 @@ var init_lib = __esm({
|
|
|
84368
84752
|
|
|
84369
84753
|
// packages/cleo/src/cli/commands/templates/diff.ts
|
|
84370
84754
|
import { existsSync as existsSync19, readFileSync as readFileSync15 } from "node:fs";
|
|
84371
|
-
import { join as
|
|
84755
|
+
import { join as join33 } from "node:path";
|
|
84372
84756
|
import { getTemplateById } from "@cleocode/core/templates/registry";
|
|
84373
84757
|
function unifiedDiff(a, b) {
|
|
84374
84758
|
const aLines = a.length === 0 ? [] : a.split("\n");
|
|
@@ -84438,7 +84822,7 @@ var init_diff = __esm({
|
|
|
84438
84822
|
let rendered;
|
|
84439
84823
|
try {
|
|
84440
84824
|
projectRoot = resolveProjectRoot6(args["project"]);
|
|
84441
|
-
installPath =
|
|
84825
|
+
installPath = join33(projectRoot, entry.installPath);
|
|
84442
84826
|
const source = readTemplateSource(entry);
|
|
84443
84827
|
rendered = applySubstitution(entry, source).rendered;
|
|
84444
84828
|
} catch (err) {
|
|
@@ -84488,8 +84872,8 @@ ${unifiedDiff("", rendered)}`
|
|
|
84488
84872
|
});
|
|
84489
84873
|
|
|
84490
84874
|
// packages/cleo/src/cli/commands/templates/install.ts
|
|
84491
|
-
import { existsSync as existsSync20, mkdirSync as mkdirSync5, readFileSync as readFileSync16, writeFileSync as
|
|
84492
|
-
import { dirname as dirname10, join as
|
|
84875
|
+
import { existsSync as existsSync20, mkdirSync as mkdirSync5, readFileSync as readFileSync16, writeFileSync as writeFileSync6 } from "node:fs";
|
|
84876
|
+
import { dirname as dirname10, join as join34 } from "node:path";
|
|
84493
84877
|
import { getTemplateById as getTemplateById2 } from "@cleocode/core/templates/registry";
|
|
84494
84878
|
var templatesInstallCommand;
|
|
84495
84879
|
var init_install = __esm({
|
|
@@ -84543,7 +84927,7 @@ var init_install = __esm({
|
|
|
84543
84927
|
let substituted;
|
|
84544
84928
|
try {
|
|
84545
84929
|
projectRoot = resolveProjectRoot6(args["project"]);
|
|
84546
|
-
installPath =
|
|
84930
|
+
installPath = join34(projectRoot, entry.installPath);
|
|
84547
84931
|
const source = readTemplateSource(entry);
|
|
84548
84932
|
const sub = applySubstitution(entry, source);
|
|
84549
84933
|
rendered = sub.rendered;
|
|
@@ -84575,7 +84959,7 @@ var init_install = __esm({
|
|
|
84575
84959
|
}
|
|
84576
84960
|
try {
|
|
84577
84961
|
mkdirSync5(dirname10(installPath), { recursive: true });
|
|
84578
|
-
|
|
84962
|
+
writeFileSync6(installPath, rendered, "utf8");
|
|
84579
84963
|
} catch (err) {
|
|
84580
84964
|
const message = err instanceof Error ? err.message : String(err);
|
|
84581
84965
|
cliError(`templates install failed: ${message}`, 1 /* GENERAL_ERROR */, {
|
|
@@ -84705,8 +85089,8 @@ var init_show3 = __esm({
|
|
|
84705
85089
|
});
|
|
84706
85090
|
|
|
84707
85091
|
// packages/cleo/src/cli/commands/templates/upgrade.ts
|
|
84708
|
-
import { existsSync as existsSync21, mkdirSync as mkdirSync6, readFileSync as readFileSync17, writeFileSync as
|
|
84709
|
-
import { dirname as dirname11, join as
|
|
85092
|
+
import { existsSync as existsSync21, mkdirSync as mkdirSync6, readFileSync as readFileSync17, writeFileSync as writeFileSync7 } from "node:fs";
|
|
85093
|
+
import { dirname as dirname11, join as join35 } from "node:path";
|
|
84710
85094
|
import { getTemplateById as getTemplateById4 } from "@cleocode/core/templates/registry";
|
|
84711
85095
|
var templatesUpgradeCommand;
|
|
84712
85096
|
var init_upgrade2 = __esm({
|
|
@@ -84768,7 +85152,7 @@ var init_upgrade2 = __esm({
|
|
|
84768
85152
|
let rendered;
|
|
84769
85153
|
try {
|
|
84770
85154
|
projectRoot = resolveProjectRoot6(args["project"]);
|
|
84771
|
-
installPath =
|
|
85155
|
+
installPath = join35(projectRoot, entry.installPath);
|
|
84772
85156
|
const source = readTemplateSource(entry);
|
|
84773
85157
|
rendered = applySubstitution(entry, source).rendered;
|
|
84774
85158
|
} catch (err) {
|
|
@@ -84817,7 +85201,7 @@ var init_upgrade2 = __esm({
|
|
|
84817
85201
|
if (shouldWrite) {
|
|
84818
85202
|
try {
|
|
84819
85203
|
mkdirSync6(dirname11(installPath), { recursive: true });
|
|
84820
|
-
|
|
85204
|
+
writeFileSync7(installPath, rendered, "utf8");
|
|
84821
85205
|
} catch (err) {
|
|
84822
85206
|
const message = err instanceof Error ? err.message : String(err);
|
|
84823
85207
|
cliError(`templates upgrade failed: ${message}`, 1 /* GENERAL_ERROR */, {
|
|
@@ -85132,7 +85516,7 @@ __export(token_exports, {
|
|
|
85132
85516
|
tokenCommand: () => tokenCommand
|
|
85133
85517
|
});
|
|
85134
85518
|
import { readFileSync as readFileSync18 } from "node:fs";
|
|
85135
|
-
import { getProjectRoot as
|
|
85519
|
+
import { getProjectRoot as getProjectRoot66, measureTokenExchange, recordTokenExchange as recordTokenExchange2 } from "@cleocode/core/internal";
|
|
85136
85520
|
function readPayload(args, textKey, fileKey) {
|
|
85137
85521
|
const text = args[textKey];
|
|
85138
85522
|
const file = args[fileKey];
|
|
@@ -85296,7 +85680,7 @@ var init_token = __esm({
|
|
|
85296
85680
|
domain: args.domain,
|
|
85297
85681
|
operation: args.operation
|
|
85298
85682
|
};
|
|
85299
|
-
const result = args.record ? await recordTokenExchange2(
|
|
85683
|
+
const result = args.record ? await recordTokenExchange2(getProjectRoot66(), input2) : await measureTokenExchange(input2);
|
|
85300
85684
|
cliOutput(result, {
|
|
85301
85685
|
command: "token",
|
|
85302
85686
|
operation: args.record ? "admin.token.record" : "token.estimate"
|
|
@@ -85331,8 +85715,8 @@ __export(transcript_exports, {
|
|
|
85331
85715
|
transcriptCommand: () => transcriptCommand
|
|
85332
85716
|
});
|
|
85333
85717
|
import { homedir as homedir6 } from "node:os";
|
|
85334
|
-
import { join as
|
|
85335
|
-
import { getProjectRoot as
|
|
85718
|
+
import { join as join36 } from "node:path";
|
|
85719
|
+
import { getProjectRoot as getProjectRoot67 } from "@cleocode/core";
|
|
85336
85720
|
import {
|
|
85337
85721
|
parseDurationMs,
|
|
85338
85722
|
pruneTranscripts,
|
|
@@ -85362,7 +85746,7 @@ var init_transcript = __esm({
|
|
|
85362
85746
|
async run({ args }) {
|
|
85363
85747
|
if (args.pending) {
|
|
85364
85748
|
try {
|
|
85365
|
-
const projectRoot =
|
|
85749
|
+
const projectRoot = getProjectRoot67();
|
|
85366
85750
|
const { scanPendingTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
85367
85751
|
const pending = await scanPendingTranscripts(projectRoot);
|
|
85368
85752
|
cliOutput(
|
|
@@ -85385,7 +85769,7 @@ var init_transcript = __esm({
|
|
|
85385
85769
|
}
|
|
85386
85770
|
return;
|
|
85387
85771
|
}
|
|
85388
|
-
const projectsDir = args["projects-dir"] ??
|
|
85772
|
+
const projectsDir = args["projects-dir"] ?? join36(homedir6(), ".claude", "projects");
|
|
85389
85773
|
try {
|
|
85390
85774
|
const result = await scanTranscripts(projectsDir);
|
|
85391
85775
|
cliOutput(
|
|
@@ -85459,7 +85843,7 @@ var init_transcript = __esm({
|
|
|
85459
85843
|
async run({ args }) {
|
|
85460
85844
|
const tier = args.tier ?? "warm";
|
|
85461
85845
|
const dryRun = args["dry-run"] ?? false;
|
|
85462
|
-
const projectRoot =
|
|
85846
|
+
const projectRoot = getProjectRoot67();
|
|
85463
85847
|
try {
|
|
85464
85848
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
85465
85849
|
const { findSessionTranscriptPath, listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -85575,7 +85959,7 @@ var init_transcript = __esm({
|
|
|
85575
85959
|
const dryRun = args["dry-run"] ?? false;
|
|
85576
85960
|
const olderThanHours = args["older-than-hours"] ? Number.parseInt(args["older-than-hours"], 10) : 24;
|
|
85577
85961
|
const limit = args.limit ? Number.parseInt(args.limit, 10) : void 0;
|
|
85578
|
-
const projectRoot =
|
|
85962
|
+
const projectRoot = getProjectRoot67();
|
|
85579
85963
|
try {
|
|
85580
85964
|
const { extractTranscript } = await import("@cleocode/core/memory/transcript-extractor.js");
|
|
85581
85965
|
const { listAllTranscripts } = await import("@cleocode/core/memory/transcript-scanner.js");
|
|
@@ -85695,7 +86079,7 @@ var init_transcript = __esm({
|
|
|
85695
86079
|
process.exit(2);
|
|
85696
86080
|
return;
|
|
85697
86081
|
}
|
|
85698
|
-
const projectsDir = args["projects-dir"] ??
|
|
86082
|
+
const projectsDir = args["projects-dir"] ?? join36(homedir6(), ".claude", "projects");
|
|
85699
86083
|
try {
|
|
85700
86084
|
const pruneResult = await pruneTranscripts({
|
|
85701
86085
|
olderThanMs,
|
|
@@ -85765,7 +86149,7 @@ import { once } from "node:events";
|
|
|
85765
86149
|
import { createWriteStream, existsSync as existsSync22, readFileSync as readFileSync19, realpathSync } from "node:fs";
|
|
85766
86150
|
import { mkdir as mkdir6 } from "node:fs/promises";
|
|
85767
86151
|
import * as net from "node:net";
|
|
85768
|
-
import { dirname as dirname12, join as
|
|
86152
|
+
import { dirname as dirname12, join as join37 } from "node:path";
|
|
85769
86153
|
import { fileURLToPath as fileURLToPath7 } from "node:url";
|
|
85770
86154
|
import { spawnWrapped } from "@cleocode/core/resources/spawn-wrapper.js";
|
|
85771
86155
|
function shouldAutoStartGateway(config) {
|
|
@@ -85809,7 +86193,7 @@ function resolveCliEntryPath(startUrl = import.meta.url) {
|
|
|
85809
86193
|
const startFile = realpathSync(fileURLToPath7(startUrl));
|
|
85810
86194
|
let current = dirname12(startFile);
|
|
85811
86195
|
for (let i = 0; i < 20; i++) {
|
|
85812
|
-
const pkgJsonPath =
|
|
86196
|
+
const pkgJsonPath = join37(current, "package.json");
|
|
85813
86197
|
if (existsSync22(pkgJsonPath)) {
|
|
85814
86198
|
let pkgName;
|
|
85815
86199
|
try {
|
|
@@ -85819,7 +86203,7 @@ function resolveCliEntryPath(startUrl = import.meta.url) {
|
|
|
85819
86203
|
} catch {
|
|
85820
86204
|
}
|
|
85821
86205
|
if (pkgName === CLEO_PACKAGE_NAME) {
|
|
85822
|
-
const entry =
|
|
86206
|
+
const entry = join37(current, "dist", "cli", "index.js");
|
|
85823
86207
|
if (!existsSync22(entry)) {
|
|
85824
86208
|
throw new Error(
|
|
85825
86209
|
`@cleocode/cleo package root found at ${current} but dist/cli/index.js is missing \u2014 run \`pnpm --filter @cleocode/cleo run build\` to generate it`
|
|
@@ -85856,8 +86240,8 @@ async function spawnGatewayIfDown(opts = {}) {
|
|
|
85856
86240
|
const { getCleoLogDir } = await import("@cleocode/core");
|
|
85857
86241
|
const logDir = getCleoLogDir();
|
|
85858
86242
|
await mkdir6(logDir, { recursive: true });
|
|
85859
|
-
const outStream = createWriteStream(
|
|
85860
|
-
const errStream = createWriteStream(
|
|
86243
|
+
const outStream = createWriteStream(join37(logDir, "gateway.log"), { flags: "a" });
|
|
86244
|
+
const errStream = createWriteStream(join37(logDir, "gateway.err"), { flags: "a" });
|
|
85861
86245
|
await Promise.all([once(outStream, "open"), once(errStream, "open")]);
|
|
85862
86246
|
outFd = outStream;
|
|
85863
86247
|
errFd = errStream;
|
|
@@ -86317,7 +86701,7 @@ __export(cockpit_exports, {
|
|
|
86317
86701
|
runCockpit: () => runCockpit
|
|
86318
86702
|
});
|
|
86319
86703
|
import { readFileSync as readFileSync20 } from "node:fs";
|
|
86320
|
-
import { join as
|
|
86704
|
+
import { join as join38 } from "node:path";
|
|
86321
86705
|
import { createCleoClient as createCleoClient2 } from "@cleocode/core/gateway-client";
|
|
86322
86706
|
async function fetchTaskRows(baseUrl) {
|
|
86323
86707
|
const client = createCleoClient2({ baseUrl });
|
|
@@ -86434,7 +86818,7 @@ async function runCockpit(options = {}, sink = (line) => process.stdout.write(`$
|
|
|
86434
86818
|
}
|
|
86435
86819
|
try {
|
|
86436
86820
|
const { getCleoLogDir } = await import("@cleocode/core");
|
|
86437
|
-
const errPath =
|
|
86821
|
+
const errPath = join38(getCleoLogDir(), "gateway.err");
|
|
86438
86822
|
const errContent = readFileSync20(errPath, "utf8").trimEnd();
|
|
86439
86823
|
if (errContent.length > 0) {
|
|
86440
86824
|
const lastLine = errContent.split("\n").at(-1) ?? "";
|
|
@@ -87867,9 +88251,9 @@ var init_workgraph2 = __esm({
|
|
|
87867
88251
|
},
|
|
87868
88252
|
async run({ args }) {
|
|
87869
88253
|
const { generatePlanningDoc } = await import("@cleocode/core/workgraph");
|
|
87870
|
-
const { getProjectRoot:
|
|
88254
|
+
const { getProjectRoot: getProjectRoot69 } = await import("@cleocode/core");
|
|
87871
88255
|
const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
|
|
87872
|
-
const projectRoot =
|
|
88256
|
+
const projectRoot = getProjectRoot69();
|
|
87873
88257
|
const audience = String(args.audience) === "agent" ? "agent" : "maintainer";
|
|
87874
88258
|
const result = await generatePlanningDoc(projectRoot, {
|
|
87875
88259
|
sagaId: String(args.sagaId),
|
|
@@ -87886,9 +88270,9 @@ var init_workgraph2 = __esm({
|
|
|
87886
88270
|
async run() {
|
|
87887
88271
|
const { validateWorkGraphStructure } = await import("@cleocode/core/workgraph");
|
|
87888
88272
|
const { taskList: taskList2 } = await import("@cleocode/core/internal");
|
|
87889
|
-
const { getProjectRoot:
|
|
88273
|
+
const { getProjectRoot: getProjectRoot69 } = await import("@cleocode/core");
|
|
87890
88274
|
const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
|
|
87891
|
-
const projectRoot =
|
|
88275
|
+
const projectRoot = getProjectRoot69();
|
|
87892
88276
|
const listResult = await taskList2(projectRoot, { limit: 5e3 });
|
|
87893
88277
|
const tasks = listResult.success ? listResult.data?.tasks ?? [] : [];
|
|
87894
88278
|
const nodes = tasks.map((t) => ({
|
|
@@ -87907,9 +88291,9 @@ var init_workgraph2 = __esm({
|
|
|
87907
88291
|
description: "One-shot saga-to-saga workgraph dashboard (tracking checklist)"
|
|
87908
88292
|
},
|
|
87909
88293
|
async run() {
|
|
87910
|
-
const { sagas: sagas2, getProjectRoot:
|
|
88294
|
+
const { sagas: sagas2, getProjectRoot: getProjectRoot69 } = await import("@cleocode/core");
|
|
87911
88295
|
const { cliOutput: cliOutput2 } = await Promise.resolve().then(() => (init_renderers(), renderers_exports));
|
|
87912
|
-
const projectRoot =
|
|
88296
|
+
const projectRoot = getProjectRoot69();
|
|
87913
88297
|
const listResult = await sagas2.sagaList(projectRoot);
|
|
87914
88298
|
if (!listResult.success) {
|
|
87915
88299
|
cliOutput2(listResult, { command: "workgraph", operation: "workgraph.status" });
|
|
@@ -87975,7 +88359,7 @@ __export(worktree_exports, {
|
|
|
87975
88359
|
worktreeCommand: () => worktreeCommand
|
|
87976
88360
|
});
|
|
87977
88361
|
import readline4 from "node:readline";
|
|
87978
|
-
import { getProjectRoot as
|
|
88362
|
+
import { getProjectRoot as getProjectRoot68, listWorktrees as listWorktrees2 } from "@cleocode/core/internal";
|
|
87979
88363
|
async function promptYesNo2(question) {
|
|
87980
88364
|
return new Promise((resolve13) => {
|
|
87981
88365
|
const rl = readline4.createInterface({ input: process.stdin, output: process.stdout });
|
|
@@ -88080,7 +88464,7 @@ var init_worktree3 = __esm({
|
|
|
88080
88464
|
const staleDays = staleDaysRaw !== void 0 ? Number.parseInt(staleDaysRaw, 10) : void 0;
|
|
88081
88465
|
const idleDaysRaw = typeof args["idle-days"] === "string" ? args["idle-days"] : void 0;
|
|
88082
88466
|
const idleDays = idleDaysRaw !== void 0 ? Number.parseInt(idleDaysRaw, 10) : void 0;
|
|
88083
|
-
const projectRoot =
|
|
88467
|
+
const projectRoot = getProjectRoot68();
|
|
88084
88468
|
const listResult = await listWorktrees2({
|
|
88085
88469
|
projectRoot,
|
|
88086
88470
|
...staleDays !== void 0 && !Number.isNaN(staleDays) ? { staleDays } : {}
|
|
@@ -88320,7 +88704,7 @@ var init_worktree3 = __esm({
|
|
|
88320
88704
|
// packages/cleo/src/cli/index.ts
|
|
88321
88705
|
init_dist();
|
|
88322
88706
|
import { readFileSync as readFileSync22 } from "node:fs";
|
|
88323
|
-
import { dirname as dirname13, join as
|
|
88707
|
+
import { dirname as dirname13, join as join40 } from "node:path";
|
|
88324
88708
|
import { fileURLToPath as fileURLToPath8 } from "node:url";
|
|
88325
88709
|
import { enforceNodeVersion } from "@cleocode/paths";
|
|
88326
88710
|
|
|
@@ -88664,6 +89048,12 @@ var COMMAND_MANIFEST = [
|
|
|
88664
89048
|
description: "Report tasks whose acceptance criteria disagree between the JSON column and the typed rows ",
|
|
88665
89049
|
load: async () => (await Promise.resolve().then(() => (init_doctor_acceptance_drift(), doctor_acceptance_drift_exports))).doctorAcceptanceDriftCommand
|
|
88666
89050
|
},
|
|
89051
|
+
{
|
|
89052
|
+
exportName: "doctorCredentialsCommand",
|
|
89053
|
+
name: "credentials",
|
|
89054
|
+
description: "Report project credentials still encrypted under the legacy path-bound key (moving the project would strand them) and agent registry keys that are not recoverable. --fix re-keys project credentials to the project's identity in place and flags unrecoverable agent keys requires_reauth. Idempotent; never deletes. Unrecoverable credentials are listed with their re-entry command.",
|
|
89055
|
+
load: async () => (await Promise.resolve().then(() => (init_doctor_credentials(), doctor_credentials_exports))).doctorCredentialsCommand
|
|
89056
|
+
},
|
|
88667
89057
|
{
|
|
88668
89058
|
exportName: "doctorDbSubstrateCommand",
|
|
88669
89059
|
name: "db-substrate",
|
|
@@ -88718,6 +89108,12 @@ var COMMAND_MANIFEST = [
|
|
|
88718
89108
|
description: "Report nexus tables resident in the wrong store \u2014 graph tables orphaned in the global ",
|
|
88719
89109
|
load: async () => (await Promise.resolve().then(() => (init_doctor_nexus_residency(), doctor_nexus_residency_exports))).doctorNexusResidencyCommand
|
|
88720
89110
|
},
|
|
89111
|
+
{
|
|
89112
|
+
exportName: "doctorProjectIdentityCommand",
|
|
89113
|
+
name: "project-identity",
|
|
89114
|
+
description: "Check .cleo/project-id against project-info.json (missing / conflict / invalid / untracked) ",
|
|
89115
|
+
load: async () => (await Promise.resolve().then(() => (init_doctor_project_identity(), doctor_project_identity_exports))).doctorProjectIdentityCommand
|
|
89116
|
+
},
|
|
88721
89117
|
{
|
|
88722
89118
|
exportName: "doctorProjectsCommand",
|
|
88723
89119
|
name: "doctor-projects",
|
|
@@ -88736,6 +89132,12 @@ var COMMAND_MANIFEST = [
|
|
|
88736
89132
|
description: "Detect malformed CLEO databases (PRAGMA quick_check) and restore each from its ",
|
|
88737
89133
|
load: async () => (await Promise.resolve().then(() => (init_doctor_repair(), doctor_repair_exports))).doctorRepairCommand
|
|
88738
89134
|
},
|
|
89135
|
+
{
|
|
89136
|
+
exportName: "doctorSplitBrainCommand",
|
|
89137
|
+
name: "split-brain",
|
|
89138
|
+
description: "Import rows that exist only in a diverged copy of a store (--source) into another (--target) ",
|
|
89139
|
+
load: async () => (await Promise.resolve().then(() => (init_doctor_split_brain(), doctor_split_brain_exports))).doctorSplitBrainCommand
|
|
89140
|
+
},
|
|
88739
89141
|
{
|
|
88740
89142
|
exportName: "doctorSupersededStoreCommand",
|
|
88741
89143
|
name: "superseded-store",
|
|
@@ -89569,12 +89971,12 @@ init_did_you_mean();
|
|
|
89569
89971
|
|
|
89570
89972
|
// packages/cleo/src/cli/lib/first-run-detection.ts
|
|
89571
89973
|
import { existsSync as existsSync23 } from "node:fs";
|
|
89572
|
-
import { join as
|
|
89974
|
+
import { join as join39 } from "node:path";
|
|
89573
89975
|
async function detectFirstRun() {
|
|
89574
89976
|
const envKey = process.env["ANTHROPIC_API_KEY"];
|
|
89575
89977
|
if (typeof envKey === "string" && envKey.length > 0) return false;
|
|
89576
89978
|
const { getCleoPlatformPaths } = await import("@cleocode/paths");
|
|
89577
|
-
const configPath =
|
|
89979
|
+
const configPath = join39(getCleoPlatformPaths().config, "config.json");
|
|
89578
89980
|
if (existsSync23(configPath)) return false;
|
|
89579
89981
|
try {
|
|
89580
89982
|
const { getCredentialPool: getCredentialPool2 } = await import("@cleocode/core/llm/credential-pool.js");
|
|
@@ -89699,7 +90101,7 @@ async function resolveSubCommandForHelp(cmd, rawArgs) {
|
|
|
89699
90101
|
init_summary_context();
|
|
89700
90102
|
enforceNodeVersion();
|
|
89701
90103
|
function getPackageVersion() {
|
|
89702
|
-
const pkgPath =
|
|
90104
|
+
const pkgPath = join40(dirname13(fileURLToPath8(import.meta.url)), "../../package.json");
|
|
89703
90105
|
const pkg = JSON.parse(readFileSync22(pkgPath, "utf-8"));
|
|
89704
90106
|
return pkg.version;
|
|
89705
90107
|
}
|
|
@@ -89883,6 +90285,19 @@ async function runMainWithLafsEnvelope(cmd, rawArgs, showUsage2) {
|
|
|
89883
90285
|
const { WarningCollector, withWarningCollector } = await import("@cleocode/lafs");
|
|
89884
90286
|
const collector = new WarningCollector();
|
|
89885
90287
|
await withWarningCollector(collector, async () => {
|
|
90288
|
+
const { recordProjectEncounter } = await import("@cleocode/core/internal");
|
|
90289
|
+
try {
|
|
90290
|
+
const outcome = await recordProjectEncounter();
|
|
90291
|
+
if (process.env["CLEO_DEBUG"])
|
|
90292
|
+
process.stderr.write(`[cleo][debug] Project encounter: ${outcome}
|
|
90293
|
+
`);
|
|
90294
|
+
} catch (error) {
|
|
90295
|
+
if (process.env["CLEO_DEBUG"])
|
|
90296
|
+
process.stderr.write(
|
|
90297
|
+
`[cleo][debug] Project encounter not recorded: ${error instanceof Error ? error.message : String(error)}
|
|
90298
|
+
`
|
|
90299
|
+
);
|
|
90300
|
+
}
|
|
89886
90301
|
try {
|
|
89887
90302
|
await runCommand(cmd, { rawArgs });
|
|
89888
90303
|
} catch (err) {
|
|
@@ -89914,7 +90329,7 @@ async function runStartupMaintenance() {
|
|
|
89914
90329
|
detectAndRemoveStrayProjectNexus,
|
|
89915
90330
|
getGlobalSalt,
|
|
89916
90331
|
getLogger: getLogger22,
|
|
89917
|
-
getProjectRoot:
|
|
90332
|
+
getProjectRoot: getProjectRoot69,
|
|
89918
90333
|
isCleanupMarkerSet,
|
|
89919
90334
|
migrateSignaldockToConduit,
|
|
89920
90335
|
needsSignaldockToConduitMigration,
|
|
@@ -89923,7 +90338,7 @@ async function runStartupMaintenance() {
|
|
|
89923
90338
|
} = await import("@cleocode/core/internal");
|
|
89924
90339
|
let projectRootForCleanup = "";
|
|
89925
90340
|
try {
|
|
89926
|
-
projectRootForCleanup =
|
|
90341
|
+
projectRootForCleanup = getProjectRoot69();
|
|
89927
90342
|
} catch {
|
|
89928
90343
|
}
|
|
89929
90344
|
if (!isCleanupMarkerSet(CLI_VERSION, projectRootForCleanup)) {
|
|
@@ -89943,7 +90358,7 @@ async function runStartupMaintenance() {
|
|
|
89943
90358
|
const isInitInvocation = process.argv.slice(2).some((a) => a === "init");
|
|
89944
90359
|
if (!isInitInvocation) {
|
|
89945
90360
|
try {
|
|
89946
|
-
const _projectRootForMigration =
|
|
90361
|
+
const _projectRootForMigration = getProjectRoot69();
|
|
89947
90362
|
if (needsSignaldockToConduitMigration(_projectRootForMigration)) {
|
|
89948
90363
|
const migrationResult = await migrateSignaldockToConduit(_projectRootForMigration);
|
|
89949
90364
|
if (migrationResult.status === "failed") {
|