@a-company/paradigm 3.28.0 → 3.43.0
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/{accept-orchestration-6EM5EHXA.js → accept-orchestration-ZUWQUHSK.js} +6 -6
- package/dist/add-VSPZ6FM4.js +81 -0
- package/dist/{aggregate-M5WMUI6B.js → aggregate-SV3VGEIL.js} +2 -2
- package/dist/assess-UHBDYIK7.js +68 -0
- package/dist/{beacon-XL2ALH5O.js → beacon-3SJV4DAP.js} +2 -2
- package/dist/calibration-WWHK73WU.js +135 -0
- package/dist/{chunk-C5ZE6WEX.js → chunk-2SKXFXIT.js} +91 -1
- package/dist/{chunk-AK5M6KJB.js → chunk-36TKPM5Z.js} +20 -2
- package/dist/{chunk-W4VFKZVF.js → chunk-7COU5S2Z.js} +3 -3
- package/dist/{chunk-3BAMPB6I.js → chunk-7WEKMZ46.js} +2 -147
- package/dist/{chunk-SCC77UUP.js → chunk-AKIMFN6I.js} +3 -3
- package/dist/{chunk-3DYYXGDC.js → chunk-CDMAMDSG.js} +33 -0
- package/dist/{chunk-7IJ5JVKT.js → chunk-CZEIK3Y2.js} +913 -40
- package/dist/{chunk-MRENOFTR.js → chunk-EDOAWN7J.js} +6 -1
- package/dist/chunk-F3BCHPYT.js +143 -0
- package/dist/chunk-GT5QGC2H.js +253 -0
- package/dist/{chunk-N6RNYCZD.js → chunk-HIKKOCXY.js} +1 -1
- package/dist/{chunk-J26YQVAK.js → chunk-J4E6K5MG.js} +1 -1
- package/dist/chunk-L27I3CPZ.js +357 -0
- package/dist/{chunk-KWDTBXP2.js → chunk-LHLIAYQ3.js} +1 -1
- package/dist/{chunk-OXG5GVDJ.js → chunk-P7XSBJE3.js} +1 -1
- package/dist/{chunk-Z7W7HNRG.js → chunk-QDXI2DHR.js} +1 -1
- package/dist/{chunk-BRILIG7Z.js → chunk-QIOCFXDQ.js} +42 -0
- package/dist/{chunk-ZOH24ZPF.js → chunk-QWA26UNO.js} +7 -7
- package/dist/{lore-server-ILPHKWLK.js → chunk-RAB5IKPR.js} +77 -112
- package/dist/{chunk-BKMNLROM.js → chunk-RGFANZ4Q.js} +448 -147
- package/dist/{chunk-R2SGQ22F.js → chunk-YW5OCVKB.js} +448 -2
- package/dist/{chunk-6P4IFIK2.js → chunk-ZGUAAVMA.js} +53 -4
- package/dist/{commands-6ZVTD74M.js → commands-LEPFD7S5.js} +452 -1
- package/dist/config-schema-3YNIFJCJ.js +152 -0
- package/dist/{constellation-NXU6Q2HM.js → constellation-FAGT45TU.js} +2 -2
- package/dist/{context-audit-RI4R2WRH.js → context-audit-557EO6PK.js} +138 -8
- package/dist/{cost-CTGSLSOC.js → cost-UD3WPEKZ.js} +1 -1
- package/dist/{cursorrules-XBWFX66V.js → cursorrules-3TKZ4E4R.js} +2 -2
- package/dist/{delete-YTASL4SM.js → delete-RRK4RL6Y.js} +1 -1
- package/dist/{diff-AH7L4PRQ.js → diff-IP5CIARP.js} +6 -6
- package/dist/{dist-AG5JNIZU-HW2FWNTZ.js → dist-5QE2BB2B-X6DYVSUL.js} +59 -5
- package/dist/{dist-KY5HGDDL.js → dist-OGTSAZ55.js} +58 -4
- package/dist/{dist-IKBGY7FQ.js → dist-RVKYUCRU.js} +3 -1
- package/dist/{dist-7U64HDSC.js → dist-UXWV4OKX.js} +8 -2
- package/dist/{dist-RMAIFRTW.js → dist-Y7I3CFY5.js} +5 -3
- package/dist/{doctor-INBOLZC7.js → doctor-GKZJU7QG.js} +1 -1
- package/dist/{edit-S7NZD7H7.js → edit-4CLNN5JG.js} +1 -1
- package/dist/{graph-ERNQQQ7C.js → graph-YYUXI3F7.js} +1 -1
- package/dist/graph-server-ZPXRSGCW.js +116 -0
- package/dist/{habits-7BORPC2F.js → habits-O37HTUKE.js} +2 -2
- package/dist/index.js +207 -89
- package/dist/integrity-MK2OP5TA.js +194 -0
- package/dist/integrity-checker-J7YXRTBT.js +11 -0
- package/dist/{lint-53GPXKKI.js → lint-HYWGS3JJ.js} +1 -1
- package/dist/{list-QTFWN35D.js → list-BTLFHSRC.js} +1 -1
- package/dist/list-IUCYPGMK.js +57 -0
- package/dist/{lore-loader-S5BXMH27.js → lore-loader-VTEEZDX3.js} +3 -1
- package/dist/lore-server-NOOAHKJX.js +118 -0
- package/dist/mcp.js +2616 -112
- package/dist/migrate-FQVGQNXZ.js +889 -0
- package/dist/{migrate-assessments-FPR6C35Z.js → migrate-assessments-JP6Q5KME.js} +1 -1
- package/dist/{orchestrate-HMSQ2CED.js → orchestrate-A226N6FC.js} +6 -6
- package/dist/platform-server-KK4OCRTV.js +891 -0
- package/dist/{probe-SN4BNXOC.js → probe-7JK7IDNI.js} +5 -5
- package/dist/{providers-YW3FG6DA.js → providers-YNFSL6HK.js} +1 -1
- package/dist/quiz-I75NU2QQ.js +99 -0
- package/dist/{record-UGN75GTB.js → record-46CLR4OG.js} +11 -2
- package/dist/{reindex-YG3KIXAK.js → reindex-NZQRGKPN.js} +3 -2
- package/dist/{remember-IEBQHXHZ.js → remember-4EUZKIIB.js} +1 -1
- package/dist/{retag-URLJLMSK.js → retag-KC4JVRLE.js} +1 -1
- package/dist/{review-725ZKA7U.js → review-Q7M4CRB5.js} +1 -1
- package/dist/{ripple-DFMXLFWI.js → ripple-RI3LOT6R.js} +2 -2
- package/dist/{sentinel-FUR3QKCJ.js → sentinel-BKYTBT7M.js} +1 -1
- package/dist/sentinel-bridge-IZTXYS5M.js +109 -0
- package/dist/sentinel-ui/assets/{index-Zh1YM0C9.css → index-CJ1Wx083.css} +1 -1
- package/dist/sentinel-ui/assets/index-S1VJ67dT.js +62 -0
- package/dist/sentinel-ui/assets/index-S1VJ67dT.js.map +1 -0
- package/dist/sentinel-ui/index.html +2 -2
- package/dist/sentinel.js +6 -6
- package/dist/{serve-DIALBCTU.js → serve-22A4XOIG.js} +1 -1
- package/dist/{university-A66BMZ4Z.js → serve-2YJ6D2Y6.js} +9 -8
- package/dist/serve-3V2WXLGM.js +33 -0
- package/dist/{server-2VICPDUR.js → server-OFEJ2HJP.js} +25 -2
- package/dist/{server-OWBK2WFS.js → server-RDLQ3DK7.js} +49 -4
- package/dist/{setup-HOI52TN3.js → setup-M2ZKLKNN.js} +4 -4
- package/dist/{shift-DRF5M3G6.js → shift-LNMKFYLR.js} +73 -14
- package/dist/{show-GEVVQWWG.js → show-P7GYO43X.js} +1 -1
- package/dist/show-PKZMYKRN.js +82 -0
- package/dist/{snapshot-XHINQBZS.js → snapshot-Y3COXK4T.js} +2 -2
- package/dist/{spawn-DIY7T4QW.js → spawn-SSXZX45U.js} +2 -2
- package/dist/status-KLHALGW4.js +71 -0
- package/dist/{summary-NV7SBV5O.js → summary-5NQNOD3F.js} +2 -2
- package/dist/{sweep-5POCF2E4.js → sweep-EZU3GU6S.js} +1 -1
- package/dist/symphony-ROEKK7VD.js +999 -0
- package/dist/{team-YOGT2Q2X.js → team-HGLJXWQG.js} +7 -7
- package/dist/{timeline-RKXNRMKF.js → timeline-ANC7LVDL.js} +1 -1
- package/dist/{triage-GJ6GK647.js → triage-POXJ2TIX.js} +2 -2
- package/dist/university-content/courses/.purpose +7 -1
- package/dist/university-content/courses/para-101.json +53 -0
- package/dist/university-content/courses/para-501.json +166 -0
- package/dist/university-content/plsat/.purpose +6 -0
- package/dist/university-content/plsat/v3.0.json +400 -1
- package/dist/university-content/reference.json +48 -0
- package/dist/university-ui/assets/{index-TcsCEBMo.js → index-tfi5xN4Q.js} +2 -2
- package/dist/university-ui/assets/{index-TcsCEBMo.js.map → index-tfi5xN4Q.js.map} +1 -1
- package/dist/university-ui/index.html +1 -1
- package/dist/{upgrade-65QOQXRC.js → upgrade-ANX3LVSA.js} +1 -0
- package/dist/validate-GD5XWILV.js +134 -0
- package/dist/{validate-TKKRGJKC.js → validate-ZVPNN4FL.js} +1 -1
- package/dist/{workspace-L27RR5MF.js → workspace-UIUTHZTD.js} +6 -6
- package/package.json +4 -2
- package/platform-ui/dist/assets/GitSection-C-GQWHcu.css +1 -0
- package/platform-ui/dist/assets/GitSection-DvyJBF_-.js +4 -0
- package/platform-ui/dist/assets/GraphSection-BiQrXqfs.js +8 -0
- package/platform-ui/dist/assets/GraphSection-BlgXTl53.css +1 -0
- package/platform-ui/dist/assets/LoreSection-BaH1FaRb.js +1 -0
- package/platform-ui/dist/assets/LoreSection-C3EixkjW.css +1 -0
- package/platform-ui/dist/assets/SentinelSection-BI-aIYKL.css +1 -0
- package/platform-ui/dist/assets/SentinelSection-DemAznjI.js +1 -0
- package/platform-ui/dist/assets/index-CfpZFjea.css +1 -0
- package/platform-ui/dist/assets/index-DDKhCt-w.js +57 -0
- package/platform-ui/dist/index.html +14 -0
- package/dist/graph-server-BZ73HTAT.js +0 -251
- package/dist/sentinel-ui/assets/index-C_Wstm64.js +0 -62
- package/dist/sentinel-ui/assets/index-C_Wstm64.js.map +0 -1
- /package/dist/{chunk-5SXMV4SP.js → chunk-FS3WTUHY.js} +0 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// ../paradigm-mcp/src/utils/integrity-checker.ts
|
|
4
|
+
import * as fs from "fs";
|
|
5
|
+
import * as path from "path";
|
|
6
|
+
function checkIntegrity(aggregation, rootDir) {
|
|
7
|
+
const symbols = aggregation.symbols;
|
|
8
|
+
return {
|
|
9
|
+
brokenReferences: findBrokenReferences(symbols),
|
|
10
|
+
duplicateSymbols: findDuplicateSymbols(symbols),
|
|
11
|
+
orphanedSymbols: findOrphanedSymbols(symbols),
|
|
12
|
+
missingAnchorFiles: findMissingAnchors(symbols, rootDir),
|
|
13
|
+
anchorOutOfBounds: findAnchorOutOfBounds(symbols, rootDir),
|
|
14
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function findBrokenReferences(symbols) {
|
|
18
|
+
const broken = [];
|
|
19
|
+
const definedIds = new Set(symbols.map((s) => s.symbol));
|
|
20
|
+
for (const sym of symbols) {
|
|
21
|
+
if (sym.parentSymbol) {
|
|
22
|
+
const parentRef = normalizeSymbolRef(sym.parentSymbol);
|
|
23
|
+
if (parentRef && !definedIds.has(parentRef)) {
|
|
24
|
+
broken.push({
|
|
25
|
+
from: sym.symbol,
|
|
26
|
+
to: parentRef,
|
|
27
|
+
file: sym.filePath,
|
|
28
|
+
refType: "parent"
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const data = sym.data;
|
|
33
|
+
if (data && typeof data === "object") {
|
|
34
|
+
if (sym.type === "flow") {
|
|
35
|
+
const steps = data.steps || [];
|
|
36
|
+
for (const step of steps) {
|
|
37
|
+
const ref = step.symbol || step.component;
|
|
38
|
+
if (ref) {
|
|
39
|
+
const normalized = normalizeSymbolRef(ref);
|
|
40
|
+
if (normalized && !definedIds.has(normalized)) {
|
|
41
|
+
broken.push({
|
|
42
|
+
from: sym.symbol,
|
|
43
|
+
to: normalized,
|
|
44
|
+
file: sym.filePath,
|
|
45
|
+
refType: "flow"
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const gates = data.gates || [];
|
|
51
|
+
for (const gate of gates) {
|
|
52
|
+
const normalized = normalizeSymbolRef(gate);
|
|
53
|
+
if (normalized && !definedIds.has(normalized)) {
|
|
54
|
+
broken.push({
|
|
55
|
+
from: sym.symbol,
|
|
56
|
+
to: normalized,
|
|
57
|
+
file: sym.filePath,
|
|
58
|
+
refType: "gate"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
const signals = data.signals || [];
|
|
63
|
+
for (const signal of signals) {
|
|
64
|
+
const normalized = normalizeSymbolRef(signal);
|
|
65
|
+
if (normalized && !definedIds.has(normalized)) {
|
|
66
|
+
broken.push({
|
|
67
|
+
from: sym.symbol,
|
|
68
|
+
to: normalized,
|
|
69
|
+
file: sym.filePath,
|
|
70
|
+
refType: "signal"
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const components = data.components || [];
|
|
75
|
+
for (const comp of components) {
|
|
76
|
+
const normalized = normalizeSymbolRef(comp);
|
|
77
|
+
if (normalized && !definedIds.has(normalized)) {
|
|
78
|
+
broken.push({
|
|
79
|
+
from: sym.symbol,
|
|
80
|
+
to: normalized,
|
|
81
|
+
file: sym.filePath,
|
|
82
|
+
refType: "component"
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const seen = /* @__PURE__ */ new Set();
|
|
90
|
+
return broken.filter((b) => {
|
|
91
|
+
const key = `${b.from}->${b.to}@${b.file}`;
|
|
92
|
+
if (seen.has(key)) return false;
|
|
93
|
+
seen.add(key);
|
|
94
|
+
return true;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
function normalizeSymbolRef(ref) {
|
|
98
|
+
if (!ref || typeof ref !== "string") return null;
|
|
99
|
+
const trimmed = ref.trim();
|
|
100
|
+
if (!trimmed) return null;
|
|
101
|
+
if (/^[#$^!~@%?&]/.test(trimmed)) {
|
|
102
|
+
return trimmed;
|
|
103
|
+
}
|
|
104
|
+
return `#${trimmed}`;
|
|
105
|
+
}
|
|
106
|
+
function findDuplicateSymbols(symbols) {
|
|
107
|
+
const bySymbol = /* @__PURE__ */ new Map();
|
|
108
|
+
for (const sym of symbols) {
|
|
109
|
+
const entries = bySymbol.get(sym.symbol) || [];
|
|
110
|
+
const existing = entries.find((e) => e.file === sym.filePath);
|
|
111
|
+
if (!existing) {
|
|
112
|
+
entries.push({ file: sym.filePath, source: sym.source });
|
|
113
|
+
}
|
|
114
|
+
bySymbol.set(sym.symbol, entries);
|
|
115
|
+
}
|
|
116
|
+
const duplicates = [];
|
|
117
|
+
for (const [symbol, entries] of bySymbol) {
|
|
118
|
+
if (entries.length <= 1) continue;
|
|
119
|
+
if (entries.length === 2) {
|
|
120
|
+
const sources = entries.map((e) => e.source).sort();
|
|
121
|
+
if (sources[0] === "portal" && sources[1] === "purpose") continue;
|
|
122
|
+
}
|
|
123
|
+
duplicates.push({ symbol, files: entries.map((e) => e.file) });
|
|
124
|
+
}
|
|
125
|
+
return duplicates;
|
|
126
|
+
}
|
|
127
|
+
function findOrphanedSymbols(symbols) {
|
|
128
|
+
const orphaned = [];
|
|
129
|
+
for (const sym of symbols) {
|
|
130
|
+
if (sym.referencedBy.length === 0 && sym.references.length === 0) {
|
|
131
|
+
orphaned.push({
|
|
132
|
+
symbol: sym.symbol,
|
|
133
|
+
file: sym.filePath,
|
|
134
|
+
referenceCount: 0
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return orphaned;
|
|
139
|
+
}
|
|
140
|
+
function findMissingAnchors(symbols, rootDir) {
|
|
141
|
+
const missing = [];
|
|
142
|
+
for (const sym of symbols) {
|
|
143
|
+
if (!sym.anchors || sym.anchors.length === 0) continue;
|
|
144
|
+
for (const anchor of sym.anchors) {
|
|
145
|
+
const filePath = resolveAnchorPath(anchor.path, rootDir, sym.filePath);
|
|
146
|
+
if (!fs.existsSync(filePath)) {
|
|
147
|
+
missing.push({
|
|
148
|
+
symbol: sym.symbol,
|
|
149
|
+
anchor: anchor.raw
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return missing;
|
|
155
|
+
}
|
|
156
|
+
function findAnchorOutOfBounds(symbols, rootDir) {
|
|
157
|
+
const outOfBounds = [];
|
|
158
|
+
for (const sym of symbols) {
|
|
159
|
+
if (!sym.anchors || sym.anchors.length === 0) continue;
|
|
160
|
+
for (const anchor of sym.anchors) {
|
|
161
|
+
const filePath = resolveAnchorPath(anchor.path, rootDir, sym.filePath);
|
|
162
|
+
if (!fs.existsSync(filePath)) continue;
|
|
163
|
+
const maxLine = getMaxLine(anchor);
|
|
164
|
+
if (maxLine <= 0) continue;
|
|
165
|
+
try {
|
|
166
|
+
const content = fs.readFileSync(filePath, "utf8");
|
|
167
|
+
const lineCount = content.split("\n").length;
|
|
168
|
+
if (maxLine > lineCount) {
|
|
169
|
+
outOfBounds.push({
|
|
170
|
+
symbol: sym.symbol,
|
|
171
|
+
anchor: anchor.raw,
|
|
172
|
+
fileLines: lineCount
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
} catch {
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return outOfBounds;
|
|
180
|
+
}
|
|
181
|
+
function checkComponentAnchors(symbols, rootDir) {
|
|
182
|
+
const report = {
|
|
183
|
+
valid: 0,
|
|
184
|
+
missing: 0,
|
|
185
|
+
outOfBounds: 0,
|
|
186
|
+
issues: []
|
|
187
|
+
};
|
|
188
|
+
for (const sym of symbols) {
|
|
189
|
+
if (!sym.anchors || sym.anchors.length === 0) continue;
|
|
190
|
+
for (const anchor of sym.anchors) {
|
|
191
|
+
const filePath = resolveAnchorPath(anchor.path, rootDir, sym.filePath);
|
|
192
|
+
if (!fs.existsSync(filePath)) {
|
|
193
|
+
report.missing++;
|
|
194
|
+
report.issues.push({
|
|
195
|
+
symbol: sym.symbol,
|
|
196
|
+
anchor: anchor.raw,
|
|
197
|
+
status: "missing"
|
|
198
|
+
});
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
const maxLine = getMaxLine(anchor);
|
|
202
|
+
if (maxLine > 0) {
|
|
203
|
+
try {
|
|
204
|
+
const content = fs.readFileSync(filePath, "utf8");
|
|
205
|
+
const lineCount = content.split("\n").length;
|
|
206
|
+
if (maxLine > lineCount) {
|
|
207
|
+
report.outOfBounds++;
|
|
208
|
+
report.issues.push({
|
|
209
|
+
symbol: sym.symbol,
|
|
210
|
+
anchor: anchor.raw,
|
|
211
|
+
status: "out-of-bounds"
|
|
212
|
+
});
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
} catch {
|
|
216
|
+
report.missing++;
|
|
217
|
+
report.issues.push({
|
|
218
|
+
symbol: sym.symbol,
|
|
219
|
+
anchor: anchor.raw,
|
|
220
|
+
status: "missing"
|
|
221
|
+
});
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
report.valid++;
|
|
226
|
+
report.issues.push({
|
|
227
|
+
symbol: sym.symbol,
|
|
228
|
+
anchor: anchor.raw,
|
|
229
|
+
status: "ok"
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
return report;
|
|
234
|
+
}
|
|
235
|
+
var SKIP_DIRS = /* @__PURE__ */ new Set([
|
|
236
|
+
"node_modules",
|
|
237
|
+
"dist",
|
|
238
|
+
".git",
|
|
239
|
+
".paradigm",
|
|
240
|
+
"coverage",
|
|
241
|
+
"build",
|
|
242
|
+
"__pycache__",
|
|
243
|
+
"target",
|
|
244
|
+
".next",
|
|
245
|
+
".nuxt"
|
|
246
|
+
]);
|
|
247
|
+
var SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
248
|
+
".ts",
|
|
249
|
+
".js",
|
|
250
|
+
".tsx",
|
|
251
|
+
".jsx",
|
|
252
|
+
".py",
|
|
253
|
+
".rs",
|
|
254
|
+
".go",
|
|
255
|
+
".swift"
|
|
256
|
+
]);
|
|
257
|
+
function checkPurposeHealth(purposeFiles, rootDir) {
|
|
258
|
+
const oversized = [];
|
|
259
|
+
const stale = [];
|
|
260
|
+
for (const filePath of purposeFiles) {
|
|
261
|
+
const absPath = path.isAbsolute(filePath) ? filePath : path.join(rootDir, filePath);
|
|
262
|
+
if (!fs.existsSync(absPath)) continue;
|
|
263
|
+
let content;
|
|
264
|
+
try {
|
|
265
|
+
content = fs.readFileSync(absPath, "utf8");
|
|
266
|
+
} catch {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
const lines = content.split("\n").length;
|
|
270
|
+
const symbolMatches = content.match(/^ [A-Za-z][A-Za-z0-9_-]*:/gm) || [];
|
|
271
|
+
const symbolCount = symbolMatches.length;
|
|
272
|
+
if (lines > 500) {
|
|
273
|
+
const severity = lines > 1e3 ? "strongly recommend" : "consider";
|
|
274
|
+
let suggestion;
|
|
275
|
+
if (symbolCount >= 10) {
|
|
276
|
+
suggestion = `${severity} splitting: ${symbolCount} top-level symbols across ${lines} lines. Split by component type or subdirectory.`;
|
|
277
|
+
} else {
|
|
278
|
+
suggestion = `${severity} splitting: ${lines} lines. Reduce descriptions or extract sub-components.`;
|
|
279
|
+
}
|
|
280
|
+
oversized.push({
|
|
281
|
+
file: path.relative(rootDir, absPath),
|
|
282
|
+
lines,
|
|
283
|
+
symbolCount,
|
|
284
|
+
suggestion
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
try {
|
|
288
|
+
const purposeStat = fs.statSync(absPath);
|
|
289
|
+
const purposeDir = path.dirname(absPath);
|
|
290
|
+
const newestSource = findNewestSourceFile(purposeDir, rootDir);
|
|
291
|
+
if (newestSource) {
|
|
292
|
+
const sourceStat = fs.statSync(newestSource.path);
|
|
293
|
+
const daysDiff = Math.floor(
|
|
294
|
+
(sourceStat.mtime.getTime() - purposeStat.mtime.getTime()) / (1e3 * 60 * 60 * 24)
|
|
295
|
+
);
|
|
296
|
+
if (daysDiff >= 7) {
|
|
297
|
+
stale.push({
|
|
298
|
+
file: path.relative(rootDir, absPath),
|
|
299
|
+
lastModified: purposeStat.mtime.toISOString(),
|
|
300
|
+
daysSinceUpdate: daysDiff,
|
|
301
|
+
newestSourceFile: path.relative(rootDir, newestSource.path)
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
} catch {
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
const score = Math.max(0, 100 - oversized.length * 10 - stale.length * 5);
|
|
309
|
+
return { oversized, stale, healthScore: score };
|
|
310
|
+
}
|
|
311
|
+
function resolveAnchorPath(anchorPath, rootDir, purposeFilePath) {
|
|
312
|
+
if (path.isAbsolute(anchorPath)) return anchorPath;
|
|
313
|
+
if (purposeFilePath) {
|
|
314
|
+
const purposeDir = path.dirname(purposeFilePath);
|
|
315
|
+
const relativePath = path.join(purposeDir, anchorPath);
|
|
316
|
+
if (fs.existsSync(relativePath)) return relativePath;
|
|
317
|
+
}
|
|
318
|
+
return path.join(rootDir, anchorPath);
|
|
319
|
+
}
|
|
320
|
+
function getMaxLine(anchor) {
|
|
321
|
+
if (typeof anchor.lines === "number") {
|
|
322
|
+
return anchor.lines;
|
|
323
|
+
}
|
|
324
|
+
if (Array.isArray(anchor.lines)) {
|
|
325
|
+
return Math.max(...anchor.lines);
|
|
326
|
+
}
|
|
327
|
+
return 0;
|
|
328
|
+
}
|
|
329
|
+
function findNewestSourceFile(dir, _rootDir) {
|
|
330
|
+
let newest = null;
|
|
331
|
+
try {
|
|
332
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
333
|
+
for (const entry of entries) {
|
|
334
|
+
if (!entry.isFile()) continue;
|
|
335
|
+
if (SKIP_DIRS.has(entry.name)) continue;
|
|
336
|
+
const ext = path.extname(entry.name);
|
|
337
|
+
if (!SOURCE_EXTENSIONS.has(ext)) continue;
|
|
338
|
+
const fullPath = path.join(dir, entry.name);
|
|
339
|
+
try {
|
|
340
|
+
const stat = fs.statSync(fullPath);
|
|
341
|
+
if (!newest || stat.mtime.getTime() > newest.mtime) {
|
|
342
|
+
newest = { path: fullPath, mtime: stat.mtime.getTime() };
|
|
343
|
+
}
|
|
344
|
+
} catch {
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
} catch {
|
|
349
|
+
}
|
|
350
|
+
return newest;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export {
|
|
354
|
+
checkIntegrity,
|
|
355
|
+
checkComponentAnchors,
|
|
356
|
+
checkPurposeHealth
|
|
357
|
+
};
|
|
@@ -10,7 +10,7 @@ async function graphCommand(path, options) {
|
|
|
10
10
|
const shouldOpen = options.open !== false;
|
|
11
11
|
console.log(chalk.cyan("\nStarting Symbol Graph...\n"));
|
|
12
12
|
try {
|
|
13
|
-
const { startGraphServer } = await import("./graph-server-
|
|
13
|
+
const { startGraphServer } = await import("./graph-server-ZPXRSGCW.js");
|
|
14
14
|
console.log(chalk.gray(`Project: ${projectDir}`));
|
|
15
15
|
console.log(chalk.gray(`Port: ${port}`));
|
|
16
16
|
console.log();
|
|
@@ -120,6 +120,16 @@ function applyLoreFilter(entries, filter) {
|
|
|
120
120
|
(e) => filter.hasReview ? e.review != null : e.review == null
|
|
121
121
|
);
|
|
122
122
|
}
|
|
123
|
+
if (filter.hasConfidence !== void 0) {
|
|
124
|
+
result = result.filter(
|
|
125
|
+
(e) => filter.hasConfidence ? e.confidence != null : e.confidence == null
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
if (filter.hasAssessment !== void 0) {
|
|
129
|
+
result = result.filter(
|
|
130
|
+
(e) => filter.hasAssessment ? e.assessment != null : e.assessment == null
|
|
131
|
+
);
|
|
132
|
+
}
|
|
123
133
|
if (filter.minCompleteness !== void 0) {
|
|
124
134
|
result = result.filter(
|
|
125
135
|
(e) => e.review != null && e.review.completeness >= filter.minCompleteness
|
|
@@ -332,6 +342,34 @@ async function addReview(rootDir, entryId, review) {
|
|
|
332
342
|
fs.writeFileSync(entryPath, yaml.dump(entry, { lineWidth: -1, noRefs: true }));
|
|
333
343
|
return true;
|
|
334
344
|
}
|
|
345
|
+
function verdictToScore(verdict) {
|
|
346
|
+
switch (verdict) {
|
|
347
|
+
case "correct":
|
|
348
|
+
return 1;
|
|
349
|
+
case "partial":
|
|
350
|
+
return 0.5;
|
|
351
|
+
case "incorrect":
|
|
352
|
+
return 0;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
async function addAssessment(rootDir, entryId, assessment) {
|
|
356
|
+
const entries = await loadLoreEntries(rootDir);
|
|
357
|
+
const entry = entries.find((e) => e.id === entryId);
|
|
358
|
+
if (!entry) {
|
|
359
|
+
return false;
|
|
360
|
+
}
|
|
361
|
+
const dateStr = entry.timestamp.slice(0, 10);
|
|
362
|
+
const entryPath = resolveEntryPath(rootDir, dateStr, entryId);
|
|
363
|
+
if (!entryPath) {
|
|
364
|
+
return false;
|
|
365
|
+
}
|
|
366
|
+
entry.assessment = assessment;
|
|
367
|
+
if (entry.confidence != null) {
|
|
368
|
+
entry.assessment_delta = verdictToScore(assessment.verdict) - entry.confidence;
|
|
369
|
+
}
|
|
370
|
+
fs.writeFileSync(entryPath, yaml.dump(entry, { lineWidth: -1, noRefs: true }));
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
335
373
|
async function loadLoreEntry(rootDir, entryId) {
|
|
336
374
|
const dateMatch = entryId.match(/^L-(\d{4}-\d{2}-\d{2})-/);
|
|
337
375
|
if (dateMatch) {
|
|
@@ -376,6 +414,9 @@ async function updateLoreEntry(rootDir, entryId, partial) {
|
|
|
376
414
|
if (partial.linked_lore !== void 0) entry.linked_lore = partial.linked_lore;
|
|
377
415
|
if (partial.linked_tasks !== void 0) entry.linked_tasks = partial.linked_tasks;
|
|
378
416
|
if (partial.linked_commits !== void 0) entry.linked_commits = partial.linked_commits;
|
|
417
|
+
if (partial.confidence !== void 0) entry.confidence = partial.confidence;
|
|
418
|
+
if (partial.assessment !== void 0) entry.assessment = partial.assessment;
|
|
419
|
+
if (partial.assessment_delta !== void 0) entry.assessment_delta = partial.assessment_delta;
|
|
379
420
|
fs.writeFileSync(entryPath, yaml.dump(entry, { lineWidth: -1, noRefs: true }));
|
|
380
421
|
await rebuildTimeline(rootDir);
|
|
381
422
|
return true;
|
|
@@ -477,6 +518,7 @@ export {
|
|
|
477
518
|
recordLore,
|
|
478
519
|
loadLoreEntries,
|
|
479
520
|
addReview,
|
|
521
|
+
addAssessment,
|
|
480
522
|
loadLoreEntry,
|
|
481
523
|
updateLoreEntry,
|
|
482
524
|
deleteLoreEntry
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
suggestAgentsForTask
|
|
4
|
-
} from "./chunk-6QC3YGB6.js";
|
|
5
2
|
import {
|
|
6
3
|
AgentSpawner,
|
|
7
4
|
extractSymbols
|
|
8
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-J4E6K5MG.js";
|
|
9
6
|
import {
|
|
10
7
|
AuditLogger
|
|
11
8
|
} from "./chunk-PBHIFAL4.js";
|
|
9
|
+
import {
|
|
10
|
+
suggestAgentsForTask
|
|
11
|
+
} from "./chunk-6QC3YGB6.js";
|
|
12
12
|
import {
|
|
13
13
|
loadAgentsManifest
|
|
14
14
|
} from "./chunk-PMXRGPRQ.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
buildSymbolIndex,
|
|
24
24
|
getReferencesTo,
|
|
25
25
|
searchSymbols
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ZGUAAVMA.js";
|
|
27
27
|
|
|
28
28
|
// src/core/orchestrator.ts
|
|
29
29
|
import { minimatch } from "minimatch";
|
|
@@ -566,7 +566,7 @@ var Orchestrator = class {
|
|
|
566
566
|
let preflightResult;
|
|
567
567
|
if (options.pmGovernance?.enabled) {
|
|
568
568
|
try {
|
|
569
|
-
const { aggregateFromDirectory } = await import("./dist-
|
|
569
|
+
const { aggregateFromDirectory } = await import("./dist-UXWV4OKX.js");
|
|
570
570
|
const aggregation = await aggregateFromDirectory(this.rootDir);
|
|
571
571
|
const index = buildSymbolIndex(aggregation);
|
|
572
572
|
preflightResult = runPreflight(task, this.rootDir, index);
|
|
@@ -593,7 +593,7 @@ var Orchestrator = class {
|
|
|
593
593
|
}
|
|
594
594
|
if (options.pmGovernance?.enabled && preflightResult) {
|
|
595
595
|
try {
|
|
596
|
-
const { aggregateFromDirectory } = await import("./dist-
|
|
596
|
+
const { aggregateFromDirectory } = await import("./dist-UXWV4OKX.js");
|
|
597
597
|
const aggregation = await aggregateFromDirectory(this.rootDir);
|
|
598
598
|
const index = buildSymbolIndex(aggregation);
|
|
599
599
|
const filesModified = [];
|