@cleocode/cleo 2026.4.142 → 2026.4.143
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 +653 -36
- package/dist/cli/index.js.map +3 -3
- package/package.json +9 -9
package/dist/cli/index.js
CHANGED
|
@@ -8556,10 +8556,11 @@ async function typedDispatch(handler, op, rawParams) {
|
|
|
8556
8556
|
function defineTypedHandler(domain, operations) {
|
|
8557
8557
|
return { domain, operations };
|
|
8558
8558
|
}
|
|
8559
|
-
function lafsSuccess(data, _operation) {
|
|
8559
|
+
function lafsSuccess(data, _operation, extra) {
|
|
8560
8560
|
return {
|
|
8561
8561
|
success: true,
|
|
8562
|
-
data
|
|
8562
|
+
data,
|
|
8563
|
+
...extra?.page ? { page: extra.page } : {}
|
|
8563
8564
|
};
|
|
8564
8565
|
}
|
|
8565
8566
|
function lafsError(code, message, _operation, fix) {
|
|
@@ -10127,6 +10128,7 @@ import {
|
|
|
10127
10128
|
resolveAgent,
|
|
10128
10129
|
resolveEffectiveTier,
|
|
10129
10130
|
resolveProjectRoot,
|
|
10131
|
+
selectHarnessSpawnProvider,
|
|
10130
10132
|
startParallelExecution,
|
|
10131
10133
|
validateSpawnReadiness
|
|
10132
10134
|
} from "@cleocode/core/internal";
|
|
@@ -17019,7 +17021,7 @@ var init_check = __esm({
|
|
|
17019
17021
|
},
|
|
17020
17022
|
"compliance.summary": async (params) => {
|
|
17021
17023
|
const projectRoot = getProjectRoot3();
|
|
17022
|
-
if (params
|
|
17024
|
+
if (params?.detail) {
|
|
17023
17025
|
const result2 = validateComplianceViolations(params.limit, projectRoot);
|
|
17024
17026
|
if (!result2.success) {
|
|
17025
17027
|
return lafsError(
|
|
@@ -17050,7 +17052,7 @@ var init_check = __esm({
|
|
|
17050
17052
|
},
|
|
17051
17053
|
test: async (params) => {
|
|
17052
17054
|
const projectRoot = getProjectRoot3();
|
|
17053
|
-
if (params
|
|
17055
|
+
if (params?.format === "coverage") {
|
|
17054
17056
|
const result2 = validateTestCoverage(projectRoot);
|
|
17055
17057
|
if (!result2.success) {
|
|
17056
17058
|
return lafsError(
|
|
@@ -17496,10 +17498,10 @@ var init_check = __esm({
|
|
|
17496
17498
|
"archive.stats": async (params) => {
|
|
17497
17499
|
const projectRoot = getProjectRoot3();
|
|
17498
17500
|
const result = await systemArchiveStats(projectRoot, {
|
|
17499
|
-
period: params
|
|
17500
|
-
report: params
|
|
17501
|
-
since: params
|
|
17502
|
-
until: params
|
|
17501
|
+
period: params?.period,
|
|
17502
|
+
report: params?.report,
|
|
17503
|
+
since: params?.since,
|
|
17504
|
+
until: params?.until
|
|
17503
17505
|
});
|
|
17504
17506
|
if (!result.success) {
|
|
17505
17507
|
return lafsError(
|
|
@@ -17650,7 +17652,7 @@ var init_check = __esm({
|
|
|
17650
17652
|
async query(operation, params) {
|
|
17651
17653
|
const startTime = Date.now();
|
|
17652
17654
|
try {
|
|
17653
|
-
const envelope = await typedDispatch(_checkTypedHandler, operation, params);
|
|
17655
|
+
const envelope = await typedDispatch(_checkTypedHandler, operation, params ?? {});
|
|
17654
17656
|
return {
|
|
17655
17657
|
meta: dispatchMeta("query", "check", operation, startTime),
|
|
17656
17658
|
success: envelope.success,
|
|
@@ -17668,7 +17670,7 @@ var init_check = __esm({
|
|
|
17668
17670
|
async mutate(operation, params) {
|
|
17669
17671
|
const startTime = Date.now();
|
|
17670
17672
|
try {
|
|
17671
|
-
const envelope = await typedDispatch(_checkTypedHandler, operation, params);
|
|
17673
|
+
const envelope = await typedDispatch(_checkTypedHandler, operation, params ?? {});
|
|
17672
17674
|
return {
|
|
17673
17675
|
meta: dispatchMeta("mutate", "check", operation, startTime),
|
|
17674
17676
|
success: envelope.success,
|
|
@@ -20878,8 +20880,10 @@ import {
|
|
|
20878
20880
|
exportSnapshot as exportSnapshot2,
|
|
20879
20881
|
exportUserProfile,
|
|
20880
20882
|
formatAugmentResults,
|
|
20883
|
+
getBrainNativeDb as getBrainNativeDb2,
|
|
20881
20884
|
getDefaultSnapshotPath as getDefaultSnapshotPath2,
|
|
20882
20885
|
getNexusDb,
|
|
20886
|
+
getNexusNativeDb,
|
|
20883
20887
|
getSharingStatus,
|
|
20884
20888
|
getUserProfileTrait,
|
|
20885
20889
|
importSnapshot as importSnapshot2,
|
|
@@ -20992,6 +20996,227 @@ async function nexusCriticalPath() {
|
|
|
20992
20996
|
return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
|
|
20993
20997
|
}
|
|
20994
20998
|
}
|
|
20999
|
+
async function nexusImpact(symbol, projectId, why) {
|
|
21000
|
+
try {
|
|
21001
|
+
await getNexusDb();
|
|
21002
|
+
const db = getNexusNativeDb();
|
|
21003
|
+
if (!db) {
|
|
21004
|
+
return engineSuccess({
|
|
21005
|
+
targetNodeId: null,
|
|
21006
|
+
why: why ?? false,
|
|
21007
|
+
affected: [],
|
|
21008
|
+
riskLevel: "NONE"
|
|
21009
|
+
});
|
|
21010
|
+
}
|
|
21011
|
+
const allNodes = db.prepare(
|
|
21012
|
+
`SELECT id, label, kind, file_path, name, project_id
|
|
21013
|
+
FROM nexus_nodes
|
|
21014
|
+
WHERE project_id = ?
|
|
21015
|
+
AND kind NOT IN ('community','process','file','folder')`
|
|
21016
|
+
).all(projectId || "");
|
|
21017
|
+
const lowerSymbol = symbol.toLowerCase();
|
|
21018
|
+
const candidates = allNodes.filter((n) => {
|
|
21019
|
+
const haystack = (n.name ?? n.label ?? "").toLowerCase();
|
|
21020
|
+
return haystack.length > 0 && haystack.includes(lowerSymbol);
|
|
21021
|
+
});
|
|
21022
|
+
candidates.sort((a, b) => {
|
|
21023
|
+
const an = (a.name ?? a.label ?? "").toLowerCase();
|
|
21024
|
+
const bn = (b.name ?? b.label ?? "").toLowerCase();
|
|
21025
|
+
const exactA = an === lowerSymbol ? 0 : 1;
|
|
21026
|
+
const exactB = bn === lowerSymbol ? 0 : 1;
|
|
21027
|
+
if (exactA !== exactB) return exactA - exactB;
|
|
21028
|
+
return an.length - bn.length;
|
|
21029
|
+
});
|
|
21030
|
+
const target = candidates[0];
|
|
21031
|
+
if (!target) {
|
|
21032
|
+
return engineSuccess({
|
|
21033
|
+
targetNodeId: null,
|
|
21034
|
+
why: why ?? false,
|
|
21035
|
+
affected: [],
|
|
21036
|
+
riskLevel: "NONE"
|
|
21037
|
+
});
|
|
21038
|
+
}
|
|
21039
|
+
const allRelations = db.prepare(
|
|
21040
|
+
`SELECT source_id, target_id, type, weight
|
|
21041
|
+
FROM nexus_relations
|
|
21042
|
+
WHERE project_id = ?
|
|
21043
|
+
AND type IN ('calls','imports','accesses')`
|
|
21044
|
+
).all(projectId || "");
|
|
21045
|
+
const reverseAdj = /* @__PURE__ */ new Map();
|
|
21046
|
+
for (const rel of allRelations) {
|
|
21047
|
+
const list = reverseAdj.get(rel.target_id);
|
|
21048
|
+
if (list) {
|
|
21049
|
+
list.push(rel);
|
|
21050
|
+
} else {
|
|
21051
|
+
reverseAdj.set(rel.target_id, [rel]);
|
|
21052
|
+
}
|
|
21053
|
+
}
|
|
21054
|
+
const incomingCount = /* @__PURE__ */ new Map();
|
|
21055
|
+
for (const rel of allRelations) {
|
|
21056
|
+
incomingCount.set(rel.target_id, (incomingCount.get(rel.target_id) ?? 0) + 1);
|
|
21057
|
+
}
|
|
21058
|
+
const nodeById = /* @__PURE__ */ new Map();
|
|
21059
|
+
for (const n of allNodes) {
|
|
21060
|
+
nodeById.set(n.id, n);
|
|
21061
|
+
}
|
|
21062
|
+
const visited = /* @__PURE__ */ new Set([target.id]);
|
|
21063
|
+
const queue = [{ id: target.id, depth: 0 }];
|
|
21064
|
+
const affected = [];
|
|
21065
|
+
while (queue.length > 0) {
|
|
21066
|
+
const item = queue.shift();
|
|
21067
|
+
if (!item) break;
|
|
21068
|
+
if (item.depth >= 3) continue;
|
|
21069
|
+
const callers = reverseAdj.get(item.id) ?? [];
|
|
21070
|
+
for (const edge of callers) {
|
|
21071
|
+
if (visited.has(edge.source_id)) continue;
|
|
21072
|
+
visited.add(edge.source_id);
|
|
21073
|
+
const depth = item.depth + 1;
|
|
21074
|
+
const callerNode = nodeById.get(edge.source_id);
|
|
21075
|
+
const reasons = [];
|
|
21076
|
+
if (why) {
|
|
21077
|
+
const calls = incomingCount.get(edge.source_id) ?? 0;
|
|
21078
|
+
if (calls > 0) {
|
|
21079
|
+
reasons.push(`called by ${calls} place${calls === 1 ? "" : "s"}`);
|
|
21080
|
+
}
|
|
21081
|
+
if (edge.weight != null && edge.weight > 0) {
|
|
21082
|
+
reasons.push(`strength=${edge.weight.toFixed(3)} via ${edge.type}`);
|
|
21083
|
+
} else {
|
|
21084
|
+
reasons.push(`edge type ${edge.type} (weight=0 \u2014 no plasticity yet)`);
|
|
21085
|
+
}
|
|
21086
|
+
reasons.push(`depth=${depth} hop from target ${target.label ?? target.id}`);
|
|
21087
|
+
}
|
|
21088
|
+
affected.push({
|
|
21089
|
+
nodeId: edge.source_id,
|
|
21090
|
+
label: callerNode?.label ?? edge.source_id,
|
|
21091
|
+
kind: callerNode?.kind ?? "unknown",
|
|
21092
|
+
reasons
|
|
21093
|
+
});
|
|
21094
|
+
queue.push({ id: edge.source_id, depth });
|
|
21095
|
+
}
|
|
21096
|
+
}
|
|
21097
|
+
let riskLevel = "NONE";
|
|
21098
|
+
if (affected.length > 0) {
|
|
21099
|
+
if (affected.length > 10) {
|
|
21100
|
+
riskLevel = "CRITICAL";
|
|
21101
|
+
} else if (affected.length > 5) {
|
|
21102
|
+
riskLevel = "HIGH";
|
|
21103
|
+
} else if (affected.length > 2) {
|
|
21104
|
+
riskLevel = "MEDIUM";
|
|
21105
|
+
} else {
|
|
21106
|
+
riskLevel = "LOW";
|
|
21107
|
+
}
|
|
21108
|
+
}
|
|
21109
|
+
return engineSuccess({
|
|
21110
|
+
targetNodeId: target.id,
|
|
21111
|
+
why: why ?? false,
|
|
21112
|
+
affected,
|
|
21113
|
+
riskLevel
|
|
21114
|
+
});
|
|
21115
|
+
} catch (error) {
|
|
21116
|
+
return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
|
|
21117
|
+
}
|
|
21118
|
+
}
|
|
21119
|
+
async function nexusTopEntries(params) {
|
|
21120
|
+
try {
|
|
21121
|
+
const limit = typeof params?.limit === "number" && Number.isFinite(params.limit) && params.limit > 0 ? Math.floor(params.limit) : 20;
|
|
21122
|
+
const brainDb = getBrainNativeDb2();
|
|
21123
|
+
if (brainDb !== null && brainDb !== void 0) {
|
|
21124
|
+
try {
|
|
21125
|
+
const nodeType = params?.nodeType ? String(params.nodeType) : null;
|
|
21126
|
+
const sql = nodeType === null ? `SELECT id, node_type, label, quality_score, last_activity_at, metadata_json
|
|
21127
|
+
FROM brain_page_nodes
|
|
21128
|
+
ORDER BY quality_score DESC
|
|
21129
|
+
LIMIT ?` : `SELECT id, node_type, label, quality_score, last_activity_at, metadata_json
|
|
21130
|
+
FROM brain_page_nodes
|
|
21131
|
+
WHERE node_type = ?
|
|
21132
|
+
ORDER BY quality_score DESC
|
|
21133
|
+
LIMIT ?`;
|
|
21134
|
+
const bindArgs = nodeType === null ? [limit] : [nodeType, limit];
|
|
21135
|
+
const rows = brainDb.prepare(sql).all(...bindArgs);
|
|
21136
|
+
const entries = rows.map((r) => ({
|
|
21137
|
+
id: r.id,
|
|
21138
|
+
node_type: r.node_type ?? "unknown",
|
|
21139
|
+
label: r.label ?? r.id,
|
|
21140
|
+
quality_score: r.quality_score ?? 0,
|
|
21141
|
+
last_activity_at: r.last_activity_at ?? "",
|
|
21142
|
+
metadata_json: r.metadata_json ?? null
|
|
21143
|
+
}));
|
|
21144
|
+
return engineSuccess({
|
|
21145
|
+
entries,
|
|
21146
|
+
count: entries.length,
|
|
21147
|
+
limit,
|
|
21148
|
+
nodeType
|
|
21149
|
+
});
|
|
21150
|
+
} catch {
|
|
21151
|
+
}
|
|
21152
|
+
}
|
|
21153
|
+
const nexusDb = getNexusNativeDb();
|
|
21154
|
+
if (!nexusDb) {
|
|
21155
|
+
return engineSuccess({
|
|
21156
|
+
entries: [],
|
|
21157
|
+
count: 0,
|
|
21158
|
+
limit,
|
|
21159
|
+
kind: params?.kind ? String(params.kind) : null,
|
|
21160
|
+
note: 'Neither brain.db nor nexus.db is available. Run "cleo nexus init" to initialize.'
|
|
21161
|
+
});
|
|
21162
|
+
}
|
|
21163
|
+
try {
|
|
21164
|
+
const kind = params?.kind ? String(params.kind) : null;
|
|
21165
|
+
const sql = kind === null ? `SELECT r.source_id,
|
|
21166
|
+
SUM(COALESCE(r.weight, 0)) AS totalWeight,
|
|
21167
|
+
COUNT(*) AS edgeCount,
|
|
21168
|
+
n.label,
|
|
21169
|
+
n.kind,
|
|
21170
|
+
n.file_path
|
|
21171
|
+
FROM nexus_relations r
|
|
21172
|
+
LEFT JOIN nexus_nodes n ON n.id = r.source_id
|
|
21173
|
+
GROUP BY r.source_id
|
|
21174
|
+
ORDER BY totalWeight DESC, edgeCount DESC
|
|
21175
|
+
LIMIT ?` : `SELECT r.source_id,
|
|
21176
|
+
SUM(COALESCE(r.weight, 0)) AS totalWeight,
|
|
21177
|
+
COUNT(*) AS edgeCount,
|
|
21178
|
+
n.label,
|
|
21179
|
+
n.kind,
|
|
21180
|
+
n.file_path
|
|
21181
|
+
FROM nexus_relations r
|
|
21182
|
+
LEFT JOIN nexus_nodes n ON n.id = r.source_id
|
|
21183
|
+
WHERE n.kind = ?
|
|
21184
|
+
GROUP BY r.source_id
|
|
21185
|
+
ORDER BY totalWeight DESC, edgeCount DESC
|
|
21186
|
+
LIMIT ?`;
|
|
21187
|
+
const bindArgs = kind === null ? [limit] : [kind, limit];
|
|
21188
|
+
const rows = nexusDb.prepare(sql).all(...bindArgs);
|
|
21189
|
+
const entries = rows.map((r) => ({
|
|
21190
|
+
nodeId: r.source_id,
|
|
21191
|
+
label: r.label ?? r.source_id,
|
|
21192
|
+
kind: r.kind ?? "unknown",
|
|
21193
|
+
filePath: r.file_path ?? null,
|
|
21194
|
+
totalWeight: r.totalWeight,
|
|
21195
|
+
edgeCount: r.edgeCount
|
|
21196
|
+
}));
|
|
21197
|
+
const result = {
|
|
21198
|
+
entries,
|
|
21199
|
+
count: entries.length,
|
|
21200
|
+
limit,
|
|
21201
|
+
kind
|
|
21202
|
+
};
|
|
21203
|
+
if (entries.length === 0) {
|
|
21204
|
+
result.note = "No high-impact sources detected yet. Code plasticity will accumulate as the system indexes and analyzes dependencies.";
|
|
21205
|
+
}
|
|
21206
|
+
return engineSuccess(result);
|
|
21207
|
+
} catch {
|
|
21208
|
+
return engineSuccess({
|
|
21209
|
+
entries: [],
|
|
21210
|
+
count: 0,
|
|
21211
|
+
limit,
|
|
21212
|
+
kind: params?.kind ? String(params.kind) : null,
|
|
21213
|
+
note: 'Nexus registry not yet initialized. Run "cleo nexus init" to start.'
|
|
21214
|
+
});
|
|
21215
|
+
}
|
|
21216
|
+
} catch (error) {
|
|
21217
|
+
return engineError("E_INTERNAL", error instanceof Error ? error.message : String(error));
|
|
21218
|
+
}
|
|
21219
|
+
}
|
|
20995
21220
|
async function nexusBlockers(query) {
|
|
20996
21221
|
try {
|
|
20997
21222
|
const analysis = await blockingAnalysis(query);
|
|
@@ -21449,8 +21674,359 @@ var init_nexus_engine = __esm({
|
|
|
21449
21674
|
});
|
|
21450
21675
|
|
|
21451
21676
|
// packages/cleo/src/dispatch/domains/nexus.ts
|
|
21452
|
-
import {
|
|
21453
|
-
|
|
21677
|
+
import {
|
|
21678
|
+
getBrainNativeDb as getBrainNativeDb3,
|
|
21679
|
+
getLogger as getLogger9,
|
|
21680
|
+
getNexusNativeDb as getNexusNativeDb2,
|
|
21681
|
+
getProjectRoot as getProjectRoot7
|
|
21682
|
+
} from "@cleocode/core/internal";
|
|
21683
|
+
async function handleTopEntries(operation, params, startTime) {
|
|
21684
|
+
const rawLimit = params?.limit;
|
|
21685
|
+
const limit = typeof rawLimit === "number" && Number.isFinite(rawLimit) && rawLimit > 0 ? Math.floor(rawLimit) : 20;
|
|
21686
|
+
const brainDb = getBrainNativeDb3();
|
|
21687
|
+
if (brainDb !== null && brainDb !== void 0) {
|
|
21688
|
+
return handleTopEntriesFromBrain(
|
|
21689
|
+
operation,
|
|
21690
|
+
params,
|
|
21691
|
+
startTime,
|
|
21692
|
+
brainDb,
|
|
21693
|
+
limit
|
|
21694
|
+
);
|
|
21695
|
+
}
|
|
21696
|
+
try {
|
|
21697
|
+
const nexusDb = getNexusNativeDb2();
|
|
21698
|
+
if (!nexusDb) {
|
|
21699
|
+
const emptyData = {
|
|
21700
|
+
entries: [],
|
|
21701
|
+
count: 0,
|
|
21702
|
+
limit,
|
|
21703
|
+
kind: params?.kind ?? null,
|
|
21704
|
+
note: 'Neither brain.db nor nexus.db is available. Run "cleo nexus init" to initialize.'
|
|
21705
|
+
};
|
|
21706
|
+
return wrapResult({ success: true, data: emptyData }, "query", "nexus", operation, startTime);
|
|
21707
|
+
}
|
|
21708
|
+
return handleTopEntriesFromNexus(
|
|
21709
|
+
operation,
|
|
21710
|
+
params,
|
|
21711
|
+
startTime,
|
|
21712
|
+
nexusDb,
|
|
21713
|
+
limit
|
|
21714
|
+
);
|
|
21715
|
+
} catch (dbErr) {
|
|
21716
|
+
return handleErrorResult("query", "nexus", operation, dbErr, startTime);
|
|
21717
|
+
}
|
|
21718
|
+
}
|
|
21719
|
+
function handleTopEntriesFromBrain(operation, params, startTime, db, limit) {
|
|
21720
|
+
const rawNodeType = params?.nodeType;
|
|
21721
|
+
const nodeType = typeof rawNodeType === "string" && rawNodeType.length > 0 ? rawNodeType : null;
|
|
21722
|
+
let rows = [];
|
|
21723
|
+
try {
|
|
21724
|
+
const sql = nodeType === null ? `SELECT id, node_type, label, quality_score, last_activity_at, metadata_json
|
|
21725
|
+
FROM brain_page_nodes
|
|
21726
|
+
ORDER BY quality_score DESC
|
|
21727
|
+
LIMIT ?` : `SELECT id, node_type, label, quality_score, last_activity_at, metadata_json
|
|
21728
|
+
FROM brain_page_nodes
|
|
21729
|
+
WHERE node_type = ?
|
|
21730
|
+
ORDER BY quality_score DESC
|
|
21731
|
+
LIMIT ?`;
|
|
21732
|
+
const bindArgs = nodeType === null ? [limit] : [nodeType, limit];
|
|
21733
|
+
const rawRows = db.prepare(sql).all(...bindArgs);
|
|
21734
|
+
rows = rawRows.map((raw) => {
|
|
21735
|
+
const r = raw;
|
|
21736
|
+
return {
|
|
21737
|
+
id: String(r["id"] ?? ""),
|
|
21738
|
+
node_type: r["node_type"] != null ? String(r["node_type"]) : null,
|
|
21739
|
+
label: r["label"] != null ? String(r["label"]) : null,
|
|
21740
|
+
quality_score: r["quality_score"] != null ? Number(r["quality_score"]) : null,
|
|
21741
|
+
last_activity_at: r["last_activity_at"] != null ? String(r["last_activity_at"]) : null,
|
|
21742
|
+
metadata_json: r["metadata_json"] != null ? String(r["metadata_json"]) : null
|
|
21743
|
+
};
|
|
21744
|
+
});
|
|
21745
|
+
} catch {
|
|
21746
|
+
rows = [];
|
|
21747
|
+
}
|
|
21748
|
+
const entries = rows.map((r) => ({
|
|
21749
|
+
id: r.id,
|
|
21750
|
+
node_type: r.node_type ?? "unknown",
|
|
21751
|
+
label: r.label ?? r.id,
|
|
21752
|
+
quality_score: r.quality_score ?? 0,
|
|
21753
|
+
last_activity_at: r.last_activity_at ?? "",
|
|
21754
|
+
metadata_json: r.metadata_json ?? null
|
|
21755
|
+
}));
|
|
21756
|
+
const data = {
|
|
21757
|
+
entries,
|
|
21758
|
+
count: entries.length,
|
|
21759
|
+
limit,
|
|
21760
|
+
nodeType
|
|
21761
|
+
};
|
|
21762
|
+
return wrapResult({ success: true, data }, "query", "nexus", operation, startTime);
|
|
21763
|
+
}
|
|
21764
|
+
function handleTopEntriesFromNexus(operation, params, startTime, db, limit) {
|
|
21765
|
+
const rawKind = params?.kind;
|
|
21766
|
+
const kind = typeof rawKind === "string" && rawKind.length > 0 ? rawKind : null;
|
|
21767
|
+
let rows = [];
|
|
21768
|
+
try {
|
|
21769
|
+
const sql = kind === null ? `SELECT r.source_id,
|
|
21770
|
+
SUM(COALESCE(r.weight, 0)) AS totalWeight,
|
|
21771
|
+
COUNT(*) AS edgeCount,
|
|
21772
|
+
n.label,
|
|
21773
|
+
n.kind,
|
|
21774
|
+
n.file_path
|
|
21775
|
+
FROM nexus_relations r
|
|
21776
|
+
LEFT JOIN nexus_nodes n ON n.id = r.source_id
|
|
21777
|
+
GROUP BY r.source_id
|
|
21778
|
+
ORDER BY totalWeight DESC, edgeCount DESC
|
|
21779
|
+
LIMIT ?` : `SELECT r.source_id,
|
|
21780
|
+
SUM(COALESCE(r.weight, 0)) AS totalWeight,
|
|
21781
|
+
COUNT(*) AS edgeCount,
|
|
21782
|
+
n.label,
|
|
21783
|
+
n.kind,
|
|
21784
|
+
n.file_path
|
|
21785
|
+
FROM nexus_relations r
|
|
21786
|
+
LEFT JOIN nexus_nodes n ON n.id = r.source_id
|
|
21787
|
+
WHERE n.kind = ?
|
|
21788
|
+
GROUP BY r.source_id
|
|
21789
|
+
ORDER BY totalWeight DESC, edgeCount DESC
|
|
21790
|
+
LIMIT ?`;
|
|
21791
|
+
const bindArgs = kind === null ? [limit] : [kind, limit];
|
|
21792
|
+
const rawRows = db.prepare(sql).all(...bindArgs);
|
|
21793
|
+
rows = rawRows.map((raw) => {
|
|
21794
|
+
const r = raw;
|
|
21795
|
+
return {
|
|
21796
|
+
source_id: String(r["source_id"] ?? ""),
|
|
21797
|
+
totalWeight: Number(r["totalWeight"] ?? 0),
|
|
21798
|
+
edgeCount: Number(r["edgeCount"] ?? 0),
|
|
21799
|
+
label: r["label"] != null ? String(r["label"]) : null,
|
|
21800
|
+
kind: r["kind"] != null ? String(r["kind"]) : null,
|
|
21801
|
+
file_path: r["file_path"] != null ? String(r["file_path"]) : null
|
|
21802
|
+
};
|
|
21803
|
+
});
|
|
21804
|
+
} catch {
|
|
21805
|
+
rows = [];
|
|
21806
|
+
}
|
|
21807
|
+
const entries = rows.map((r) => ({
|
|
21808
|
+
nodeId: r.source_id,
|
|
21809
|
+
label: r.label ?? r.source_id,
|
|
21810
|
+
kind: r.kind ?? "unknown",
|
|
21811
|
+
filePath: r.file_path ?? null,
|
|
21812
|
+
totalWeight: r.totalWeight,
|
|
21813
|
+
edgeCount: r.edgeCount
|
|
21814
|
+
}));
|
|
21815
|
+
const allZero = entries.length === 0 || entries.every((e) => e.totalWeight === 0);
|
|
21816
|
+
const note = allZero ? "No Hebbian weights accumulated yet. Run a dream cycle or wait for plasticity updates." : void 0;
|
|
21817
|
+
const data = {
|
|
21818
|
+
entries,
|
|
21819
|
+
count: entries.length,
|
|
21820
|
+
limit,
|
|
21821
|
+
kind,
|
|
21822
|
+
...note !== void 0 ? { note } : {}
|
|
21823
|
+
};
|
|
21824
|
+
return wrapResult({ success: true, data }, "query", "nexus", operation, startTime);
|
|
21825
|
+
}
|
|
21826
|
+
function riskLevelFor(totalImpact) {
|
|
21827
|
+
if (totalImpact === 0) return "NONE";
|
|
21828
|
+
if (totalImpact <= 3) return "LOW";
|
|
21829
|
+
if (totalImpact <= 10) return "MEDIUM";
|
|
21830
|
+
if (totalImpact <= 25) return "HIGH";
|
|
21831
|
+
return "CRITICAL";
|
|
21832
|
+
}
|
|
21833
|
+
async function handleImpact(operation, params, startTime) {
|
|
21834
|
+
const symbolName = params?.symbol;
|
|
21835
|
+
if (!symbolName) {
|
|
21836
|
+
return errorResult(
|
|
21837
|
+
"query",
|
|
21838
|
+
"nexus",
|
|
21839
|
+
operation,
|
|
21840
|
+
"E_INVALID_INPUT",
|
|
21841
|
+
"symbol is required",
|
|
21842
|
+
startTime
|
|
21843
|
+
);
|
|
21844
|
+
}
|
|
21845
|
+
const why = params?.why === true;
|
|
21846
|
+
const rawDepth = params?.depth;
|
|
21847
|
+
const maxDepth = Math.min(
|
|
21848
|
+
typeof rawDepth === "number" && Number.isFinite(rawDepth) && rawDepth > 0 ? rawDepth : 3,
|
|
21849
|
+
5
|
|
21850
|
+
);
|
|
21851
|
+
const projectIdParam = params?.projectId;
|
|
21852
|
+
const projectId = projectIdParam ?? Buffer.from(process.cwd()).toString("base64url").slice(0, 32);
|
|
21853
|
+
try {
|
|
21854
|
+
const { getNexusDb: getNexusDb2 } = await import("@cleocode/core/store/nexus-sqlite");
|
|
21855
|
+
await getNexusDb2();
|
|
21856
|
+
const db = getNexusNativeDb2();
|
|
21857
|
+
if (!db) {
|
|
21858
|
+
return wrapResult(
|
|
21859
|
+
{
|
|
21860
|
+
success: true,
|
|
21861
|
+
data: {
|
|
21862
|
+
query: symbolName,
|
|
21863
|
+
projectId,
|
|
21864
|
+
targetNodeId: null,
|
|
21865
|
+
targetLabel: null,
|
|
21866
|
+
why,
|
|
21867
|
+
riskLevel: "NONE",
|
|
21868
|
+
totalImpact: 0,
|
|
21869
|
+
maxDepth,
|
|
21870
|
+
affected: []
|
|
21871
|
+
}
|
|
21872
|
+
},
|
|
21873
|
+
"query",
|
|
21874
|
+
"nexus",
|
|
21875
|
+
operation,
|
|
21876
|
+
startTime
|
|
21877
|
+
);
|
|
21878
|
+
}
|
|
21879
|
+
let allNodes = [];
|
|
21880
|
+
try {
|
|
21881
|
+
const rawRows = db.prepare(
|
|
21882
|
+
`SELECT id, label, kind, file_path, name, project_id
|
|
21883
|
+
FROM nexus_nodes
|
|
21884
|
+
WHERE project_id = ?
|
|
21885
|
+
AND kind NOT IN ('community','process','file','folder')`
|
|
21886
|
+
).all(projectId);
|
|
21887
|
+
allNodes = rawRows.map((raw) => {
|
|
21888
|
+
const r = raw;
|
|
21889
|
+
return {
|
|
21890
|
+
id: String(r["id"] ?? ""),
|
|
21891
|
+
label: r["label"] != null ? String(r["label"]) : null,
|
|
21892
|
+
kind: r["kind"] != null ? String(r["kind"]) : null,
|
|
21893
|
+
file_path: r["file_path"] != null ? String(r["file_path"]) : null,
|
|
21894
|
+
name: r["name"] != null ? String(r["name"]) : null,
|
|
21895
|
+
project_id: String(r["project_id"] ?? "")
|
|
21896
|
+
};
|
|
21897
|
+
});
|
|
21898
|
+
} catch {
|
|
21899
|
+
allNodes = [];
|
|
21900
|
+
}
|
|
21901
|
+
const lowerSymbol = symbolName.toLowerCase();
|
|
21902
|
+
const candidates = allNodes.filter((n) => {
|
|
21903
|
+
const haystack = (n.name ?? n.label ?? "").toLowerCase();
|
|
21904
|
+
return haystack.length > 0 && haystack.includes(lowerSymbol);
|
|
21905
|
+
});
|
|
21906
|
+
candidates.sort((a, b) => {
|
|
21907
|
+
const an = (a.name ?? a.label ?? "").toLowerCase();
|
|
21908
|
+
const bn = (b.name ?? b.label ?? "").toLowerCase();
|
|
21909
|
+
const exactA = an === lowerSymbol ? 0 : 1;
|
|
21910
|
+
const exactB = bn === lowerSymbol ? 0 : 1;
|
|
21911
|
+
if (exactA !== exactB) return exactA - exactB;
|
|
21912
|
+
return an.length - bn.length;
|
|
21913
|
+
});
|
|
21914
|
+
const target = candidates[0];
|
|
21915
|
+
if (!target) {
|
|
21916
|
+
return wrapResult(
|
|
21917
|
+
{
|
|
21918
|
+
success: true,
|
|
21919
|
+
data: {
|
|
21920
|
+
query: symbolName,
|
|
21921
|
+
projectId,
|
|
21922
|
+
targetNodeId: null,
|
|
21923
|
+
targetLabel: null,
|
|
21924
|
+
why,
|
|
21925
|
+
riskLevel: "NONE",
|
|
21926
|
+
totalImpact: 0,
|
|
21927
|
+
maxDepth,
|
|
21928
|
+
affected: []
|
|
21929
|
+
}
|
|
21930
|
+
},
|
|
21931
|
+
"query",
|
|
21932
|
+
"nexus",
|
|
21933
|
+
operation,
|
|
21934
|
+
startTime
|
|
21935
|
+
);
|
|
21936
|
+
}
|
|
21937
|
+
let allRelations = [];
|
|
21938
|
+
try {
|
|
21939
|
+
const rawRows = db.prepare(
|
|
21940
|
+
`SELECT source_id, target_id, type, weight
|
|
21941
|
+
FROM nexus_relations
|
|
21942
|
+
WHERE project_id = ?
|
|
21943
|
+
AND type IN ('calls','imports','accesses')`
|
|
21944
|
+
).all(projectId);
|
|
21945
|
+
allRelations = rawRows.map((raw) => {
|
|
21946
|
+
const r = raw;
|
|
21947
|
+
return {
|
|
21948
|
+
source_id: String(r["source_id"] ?? ""),
|
|
21949
|
+
target_id: String(r["target_id"] ?? ""),
|
|
21950
|
+
type: String(r["type"] ?? ""),
|
|
21951
|
+
weight: r["weight"] != null ? Number(r["weight"]) : null
|
|
21952
|
+
};
|
|
21953
|
+
});
|
|
21954
|
+
} catch {
|
|
21955
|
+
allRelations = [];
|
|
21956
|
+
}
|
|
21957
|
+
const reverseAdj = /* @__PURE__ */ new Map();
|
|
21958
|
+
for (const rel of allRelations) {
|
|
21959
|
+
if (!IMPACT_REVERSE_TYPES.has(rel.type)) continue;
|
|
21960
|
+
const list = reverseAdj.get(rel.target_id);
|
|
21961
|
+
if (list) {
|
|
21962
|
+
list.push(rel);
|
|
21963
|
+
} else {
|
|
21964
|
+
reverseAdj.set(rel.target_id, [rel]);
|
|
21965
|
+
}
|
|
21966
|
+
}
|
|
21967
|
+
const incomingCount = /* @__PURE__ */ new Map();
|
|
21968
|
+
for (const rel of allRelations) {
|
|
21969
|
+
if (!IMPACT_REVERSE_TYPES.has(rel.type)) continue;
|
|
21970
|
+
incomingCount.set(rel.target_id, (incomingCount.get(rel.target_id) ?? 0) + 1);
|
|
21971
|
+
}
|
|
21972
|
+
const nodeById = /* @__PURE__ */ new Map();
|
|
21973
|
+
for (const n of allNodes) nodeById.set(n.id, n);
|
|
21974
|
+
const targetId = target.id;
|
|
21975
|
+
const visited = /* @__PURE__ */ new Set([targetId]);
|
|
21976
|
+
const queue = [{ id: targetId, depth: 0 }];
|
|
21977
|
+
const affected = [];
|
|
21978
|
+
while (queue.length > 0) {
|
|
21979
|
+
const item = queue.shift();
|
|
21980
|
+
if (!item) break;
|
|
21981
|
+
if (item.depth >= maxDepth) continue;
|
|
21982
|
+
const callers = reverseAdj.get(item.id) ?? [];
|
|
21983
|
+
for (const edge of callers) {
|
|
21984
|
+
if (visited.has(edge.source_id)) continue;
|
|
21985
|
+
visited.add(edge.source_id);
|
|
21986
|
+
const depth = item.depth + 1;
|
|
21987
|
+
const callerNode = nodeById.get(edge.source_id);
|
|
21988
|
+
const reasons = [];
|
|
21989
|
+
if (why) {
|
|
21990
|
+
const calls = incomingCount.get(edge.source_id) ?? 0;
|
|
21991
|
+
if (calls > 0) {
|
|
21992
|
+
reasons.push(`called by ${calls} place${calls === 1 ? "" : "s"}`);
|
|
21993
|
+
}
|
|
21994
|
+
if (edge.weight != null && edge.weight > 0) {
|
|
21995
|
+
reasons.push(`strength=${edge.weight.toFixed(3)} via ${edge.type}`);
|
|
21996
|
+
} else {
|
|
21997
|
+
reasons.push(`edge type ${edge.type} (weight=0 \u2014 no plasticity yet)`);
|
|
21998
|
+
}
|
|
21999
|
+
reasons.push(`depth=${depth} hop from target ${target.label ?? target.id}`);
|
|
22000
|
+
}
|
|
22001
|
+
affected.push({
|
|
22002
|
+
nodeId: edge.source_id,
|
|
22003
|
+
label: callerNode?.label ?? edge.source_id,
|
|
22004
|
+
kind: callerNode?.kind ?? "unknown",
|
|
22005
|
+
filePath: callerNode?.file_path ?? null,
|
|
22006
|
+
depth,
|
|
22007
|
+
reasons
|
|
22008
|
+
});
|
|
22009
|
+
queue.push({ id: edge.source_id, depth });
|
|
22010
|
+
}
|
|
22011
|
+
}
|
|
22012
|
+
const totalImpact = affected.length;
|
|
22013
|
+
const data = {
|
|
22014
|
+
query: symbolName,
|
|
22015
|
+
projectId,
|
|
22016
|
+
targetNodeId: target.id,
|
|
22017
|
+
targetLabel: target.label ?? target.name ?? target.id,
|
|
22018
|
+
why,
|
|
22019
|
+
riskLevel: riskLevelFor(totalImpact),
|
|
22020
|
+
totalImpact,
|
|
22021
|
+
maxDepth,
|
|
22022
|
+
affected
|
|
22023
|
+
};
|
|
22024
|
+
return wrapResult({ success: true, data }, "query", "nexus", operation, startTime);
|
|
22025
|
+
} catch (dbErr) {
|
|
22026
|
+
return handleErrorResult("query", "nexus", operation, dbErr, startTime);
|
|
22027
|
+
}
|
|
22028
|
+
}
|
|
22029
|
+
var _nexusTypedHandler, QUERY_OPS3, MUTATE_OPS3, NexusHandler, IMPACT_REVERSE_TYPES;
|
|
21454
22030
|
var init_nexus2 = __esm({
|
|
21455
22031
|
"packages/cleo/src/dispatch/domains/nexus.ts"() {
|
|
21456
22032
|
"use strict";
|
|
@@ -21481,7 +22057,12 @@ var init_nexus2 = __esm({
|
|
|
21481
22057
|
"list"
|
|
21482
22058
|
);
|
|
21483
22059
|
}
|
|
21484
|
-
|
|
22060
|
+
const data = result.data;
|
|
22061
|
+
return lafsSuccess(
|
|
22062
|
+
{ projects: data.projects, count: data.count, total: data.total, filtered: data.filtered },
|
|
22063
|
+
"list",
|
|
22064
|
+
{ page: data.page ?? result.page }
|
|
22065
|
+
);
|
|
21485
22066
|
},
|
|
21486
22067
|
show: async (params) => {
|
|
21487
22068
|
if (!params.name) {
|
|
@@ -21571,7 +22152,12 @@ var init_nexus2 = __esm({
|
|
|
21571
22152
|
"orphans.list"
|
|
21572
22153
|
);
|
|
21573
22154
|
}
|
|
21574
|
-
|
|
22155
|
+
const data = result.data;
|
|
22156
|
+
return lafsSuccess(
|
|
22157
|
+
{ orphans: data.orphans, count: data.count, total: data.total, filtered: data.filtered },
|
|
22158
|
+
"orphans.list",
|
|
22159
|
+
{ page: data.page ?? result.page }
|
|
22160
|
+
);
|
|
21575
22161
|
},
|
|
21576
22162
|
discover: async (params) => {
|
|
21577
22163
|
if (!params.query) {
|
|
@@ -21655,8 +22241,12 @@ var init_nexus2 = __esm({
|
|
|
21655
22241
|
}
|
|
21656
22242
|
return lafsSuccess(result.data, "transfer.preview");
|
|
21657
22243
|
},
|
|
21658
|
-
"top-entries": async (
|
|
21659
|
-
const result = await
|
|
22244
|
+
"top-entries": async (params) => {
|
|
22245
|
+
const result = await nexusTopEntries({
|
|
22246
|
+
limit: params?.limit,
|
|
22247
|
+
kind: params?.kind,
|
|
22248
|
+
nodeType: params?.nodeType
|
|
22249
|
+
});
|
|
21660
22250
|
if (!result.success) {
|
|
21661
22251
|
return lafsError(
|
|
21662
22252
|
String(result.error?.code ?? "E_INTERNAL"),
|
|
@@ -21670,8 +22260,7 @@ var init_nexus2 = __esm({
|
|
|
21670
22260
|
if (!params.symbol) {
|
|
21671
22261
|
return lafsError("E_INVALID_INPUT", "symbol is required", "impact");
|
|
21672
22262
|
}
|
|
21673
|
-
const
|
|
21674
|
-
const result = await nexusImpactFull(params.symbol, projectRoot);
|
|
22263
|
+
const result = await nexusImpact(params.symbol, params.projectId, params.why);
|
|
21675
22264
|
if (!result.success) {
|
|
21676
22265
|
return lafsError(
|
|
21677
22266
|
String(result.error?.code ?? "E_INTERNAL"),
|
|
@@ -21803,7 +22392,7 @@ var init_nexus2 = __esm({
|
|
|
21803
22392
|
wiki: async (params) => {
|
|
21804
22393
|
const projectRoot = getProjectRoot7();
|
|
21805
22394
|
const outputDir = params.outputDir ?? `${projectRoot}/.cleo/wiki`;
|
|
21806
|
-
const result = await nexusWiki(
|
|
22395
|
+
const result = await nexusWiki(outputDir, projectRoot, {
|
|
21807
22396
|
communityFilter: params.communityFilter,
|
|
21808
22397
|
incremental: params.incremental
|
|
21809
22398
|
});
|
|
@@ -22149,6 +22738,7 @@ var init_nexus2 = __esm({
|
|
|
22149
22738
|
}
|
|
22150
22739
|
});
|
|
22151
22740
|
QUERY_OPS3 = /* @__PURE__ */ new Set([
|
|
22741
|
+
"share.status",
|
|
22152
22742
|
"status",
|
|
22153
22743
|
"list",
|
|
22154
22744
|
"show",
|
|
@@ -22161,7 +22751,6 @@ var init_nexus2 = __esm({
|
|
|
22161
22751
|
"discover",
|
|
22162
22752
|
"search",
|
|
22163
22753
|
"augment",
|
|
22164
|
-
"share.status",
|
|
22165
22754
|
"transfer.preview",
|
|
22166
22755
|
"top-entries",
|
|
22167
22756
|
"impact",
|
|
@@ -22181,14 +22770,14 @@ var init_nexus2 = __esm({
|
|
|
22181
22770
|
"sigil.list"
|
|
22182
22771
|
]);
|
|
22183
22772
|
MUTATE_OPS3 = /* @__PURE__ */ new Set([
|
|
22773
|
+
"share.snapshot.export",
|
|
22774
|
+
"share.snapshot.import",
|
|
22184
22775
|
"init",
|
|
22185
22776
|
"register",
|
|
22186
22777
|
"unregister",
|
|
22187
22778
|
"sync",
|
|
22188
22779
|
"permission.set",
|
|
22189
22780
|
"reconcile",
|
|
22190
|
-
"share.snapshot.export",
|
|
22191
|
-
"share.snapshot.import",
|
|
22192
22781
|
"transfer",
|
|
22193
22782
|
"contracts-sync",
|
|
22194
22783
|
"contracts-link-tasks",
|
|
@@ -22212,17 +22801,35 @@ var init_nexus2 = __esm({
|
|
|
22212
22801
|
if (!QUERY_OPS3.has(operation)) {
|
|
22213
22802
|
return unsupportedOp("query", "nexus", operation, startTime);
|
|
22214
22803
|
}
|
|
22804
|
+
if (operation === "top-entries") {
|
|
22805
|
+
return handleTopEntries(operation, params, startTime);
|
|
22806
|
+
}
|
|
22807
|
+
if (operation === "impact") {
|
|
22808
|
+
return handleImpact(operation, params, startTime);
|
|
22809
|
+
}
|
|
22215
22810
|
try {
|
|
22216
22811
|
const envelope = await typedDispatch(
|
|
22217
22812
|
_nexusTypedHandler,
|
|
22218
22813
|
operation,
|
|
22219
22814
|
params ?? {}
|
|
22220
22815
|
);
|
|
22816
|
+
const env = envelope;
|
|
22817
|
+
let pageMetadata = env.page;
|
|
22818
|
+
let resultData = env.data;
|
|
22819
|
+
if (!pageMetadata && env.success && resultData && typeof resultData === "object") {
|
|
22820
|
+
const dataObj = resultData;
|
|
22821
|
+
if ("page" in dataObj && dataObj.page) {
|
|
22822
|
+
pageMetadata = dataObj.page;
|
|
22823
|
+
const { page: _removed, ...cleanData } = dataObj;
|
|
22824
|
+
resultData = cleanData;
|
|
22825
|
+
}
|
|
22826
|
+
}
|
|
22221
22827
|
return wrapResult(
|
|
22222
22828
|
{
|
|
22223
|
-
success:
|
|
22224
|
-
data:
|
|
22225
|
-
|
|
22829
|
+
success: env.success,
|
|
22830
|
+
data: resultData,
|
|
22831
|
+
page: pageMetadata,
|
|
22832
|
+
error: env.error ? { code: String(env.error.code), message: env.error.message } : void 0
|
|
22226
22833
|
},
|
|
22227
22834
|
"query",
|
|
22228
22835
|
"nexus",
|
|
@@ -22254,11 +22861,12 @@ var init_nexus2 = __esm({
|
|
|
22254
22861
|
operation,
|
|
22255
22862
|
params ?? {}
|
|
22256
22863
|
);
|
|
22864
|
+
const env = envelope;
|
|
22257
22865
|
return wrapResult(
|
|
22258
22866
|
{
|
|
22259
|
-
success:
|
|
22260
|
-
data:
|
|
22261
|
-
error:
|
|
22867
|
+
success: env.success,
|
|
22868
|
+
data: env.data,
|
|
22869
|
+
error: env.error ? { code: String(env.error.code), message: env.error.message } : void 0
|
|
22262
22870
|
},
|
|
22263
22871
|
"mutate",
|
|
22264
22872
|
"nexus",
|
|
@@ -22276,11 +22884,12 @@ var init_nexus2 = __esm({
|
|
|
22276
22884
|
/** Declared operations for introspection and validation. */
|
|
22277
22885
|
getSupportedOperations() {
|
|
22278
22886
|
return {
|
|
22279
|
-
query: Array.from(QUERY_OPS3)
|
|
22280
|
-
mutate: Array.from(MUTATE_OPS3)
|
|
22887
|
+
query: Array.from(QUERY_OPS3),
|
|
22888
|
+
mutate: Array.from(MUTATE_OPS3)
|
|
22281
22889
|
};
|
|
22282
22890
|
}
|
|
22283
22891
|
};
|
|
22892
|
+
IMPACT_REVERSE_TYPES = /* @__PURE__ */ new Set(["calls", "imports", "accesses"]);
|
|
22284
22893
|
}
|
|
22285
22894
|
});
|
|
22286
22895
|
|
|
@@ -31097,7 +31706,7 @@ var init_sticky = __esm({
|
|
|
31097
31706
|
import { getLogger as getLogger16, getProjectRoot as getProjectRoot15 } from "@cleocode/core";
|
|
31098
31707
|
function envelopeToEngineResult5(envelope) {
|
|
31099
31708
|
if (envelope.success) {
|
|
31100
|
-
return { success: true, data: envelope.data };
|
|
31709
|
+
return { success: true, data: envelope.data, page: envelope.page };
|
|
31101
31710
|
}
|
|
31102
31711
|
return {
|
|
31103
31712
|
success: false,
|
|
@@ -31173,7 +31782,15 @@ var init_tasks3 = __esm({
|
|
|
31173
31782
|
"list"
|
|
31174
31783
|
);
|
|
31175
31784
|
}
|
|
31176
|
-
|
|
31785
|
+
const envelope = lafsSuccess(result.data, "list");
|
|
31786
|
+
if (result.page) {
|
|
31787
|
+
return {
|
|
31788
|
+
success: true,
|
|
31789
|
+
data: result.data,
|
|
31790
|
+
page: result.page
|
|
31791
|
+
};
|
|
31792
|
+
}
|
|
31793
|
+
return envelope;
|
|
31177
31794
|
},
|
|
31178
31795
|
find: async (params) => {
|
|
31179
31796
|
const projectRoot = getProjectRoot15();
|
|
@@ -46121,7 +46738,7 @@ import { homedir as homedir4 } from "node:os";
|
|
|
46121
46738
|
import { join as join17 } from "node:path";
|
|
46122
46739
|
import {
|
|
46123
46740
|
getBrainDb as getBrainDb2,
|
|
46124
|
-
getBrainNativeDb as
|
|
46741
|
+
getBrainNativeDb as getBrainNativeDb4,
|
|
46125
46742
|
getProjectRoot as getProjectRoot25,
|
|
46126
46743
|
runConsolidation,
|
|
46127
46744
|
triggerManualDream
|
|
@@ -47676,7 +48293,7 @@ var tierStatsCommand = defineCommand({
|
|
|
47676
48293
|
const isJson = !!args.json;
|
|
47677
48294
|
try {
|
|
47678
48295
|
await getBrainDb2(root);
|
|
47679
|
-
const nativeDb =
|
|
48296
|
+
const nativeDb = getBrainNativeDb4();
|
|
47680
48297
|
if (!nativeDb) {
|
|
47681
48298
|
const msg = "brain.db not available";
|
|
47682
48299
|
if (isJson) {
|
|
@@ -47832,7 +48449,7 @@ var tierPromoteCommand = defineCommand({
|
|
|
47832
48449
|
}
|
|
47833
48450
|
try {
|
|
47834
48451
|
await getBrainDb2(root);
|
|
47835
|
-
const nativeDb =
|
|
48452
|
+
const nativeDb = getBrainNativeDb4();
|
|
47836
48453
|
if (!nativeDb) {
|
|
47837
48454
|
const msg = "brain.db not available";
|
|
47838
48455
|
if (isJson) {
|
|
@@ -47978,7 +48595,7 @@ var tierDemoteCommand = defineCommand({
|
|
|
47978
48595
|
}
|
|
47979
48596
|
try {
|
|
47980
48597
|
await getBrainDb2(root);
|
|
47981
|
-
const nativeDb =
|
|
48598
|
+
const nativeDb = getBrainNativeDb4();
|
|
47982
48599
|
if (!nativeDb) {
|
|
47983
48600
|
const msg = "brain.db not available";
|
|
47984
48601
|
if (isJson) {
|