@triedotdev/mcp 1.0.169 β 1.0.171
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/README.md +62 -540
- package/dist/chunk-2YXOBNKW.js +619 -0
- package/dist/chunk-2YXOBNKW.js.map +1 -0
- package/dist/chunk-QR64Y5TI.js +363 -0
- package/dist/chunk-QR64Y5TI.js.map +1 -0
- package/dist/cli/main.d.ts +0 -15
- package/dist/cli/main.js +356 -3098
- package/dist/cli/main.js.map +1 -1
- package/dist/index.js +2 -34
- package/dist/index.js.map +1 -1
- package/dist/server/mcp-server.js +2 -34
- package/package.json +8 -31
- package/dist/autonomy-config-FSERX3O3.js +0 -30
- package/dist/autonomy-config-FSERX3O3.js.map +0 -1
- package/dist/chat-store-JNGNTDSN.js +0 -15
- package/dist/chat-store-JNGNTDSN.js.map +0 -1
- package/dist/chunk-2HF65EHQ.js +0 -311
- package/dist/chunk-2HF65EHQ.js.map +0 -1
- package/dist/chunk-3XR6WVAW.js +0 -4011
- package/dist/chunk-3XR6WVAW.js.map +0 -1
- package/dist/chunk-43X6JBEM.js +0 -36
- package/dist/chunk-43X6JBEM.js.map +0 -1
- package/dist/chunk-6NLHFIYA.js +0 -344
- package/dist/chunk-6NLHFIYA.js.map +0 -1
- package/dist/chunk-7IO4YUI3.js +0 -1827
- package/dist/chunk-7IO4YUI3.js.map +0 -1
- package/dist/chunk-AHD2CBQ7.js +0 -846
- package/dist/chunk-AHD2CBQ7.js.map +0 -1
- package/dist/chunk-BUTOP5EB.js +0 -931
- package/dist/chunk-BUTOP5EB.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -11
- package/dist/chunk-DGUM43GV.js.map +0 -1
- package/dist/chunk-EFWVF6TI.js +0 -267
- package/dist/chunk-EFWVF6TI.js.map +0 -1
- package/dist/chunk-F6WFNUAY.js +0 -216
- package/dist/chunk-F6WFNUAY.js.map +0 -1
- package/dist/chunk-FBNURWRY.js +0 -662
- package/dist/chunk-FBNURWRY.js.map +0 -1
- package/dist/chunk-FQ45QP5A.js +0 -361
- package/dist/chunk-FQ45QP5A.js.map +0 -1
- package/dist/chunk-FVRO5RN3.js +0 -1306
- package/dist/chunk-FVRO5RN3.js.map +0 -1
- package/dist/chunk-G2TGF6TR.js +0 -573
- package/dist/chunk-G2TGF6TR.js.map +0 -1
- package/dist/chunk-G3I7SZLW.js +0 -354
- package/dist/chunk-G3I7SZLW.js.map +0 -1
- package/dist/chunk-GTKYBOXL.js +0 -700
- package/dist/chunk-GTKYBOXL.js.map +0 -1
- package/dist/chunk-HVCDY3AK.js +0 -850
- package/dist/chunk-HVCDY3AK.js.map +0 -1
- package/dist/chunk-I2O5OYQT.js +0 -727
- package/dist/chunk-I2O5OYQT.js.map +0 -1
- package/dist/chunk-JVMBCWKS.js +0 -348
- package/dist/chunk-JVMBCWKS.js.map +0 -1
- package/dist/chunk-KCUOWRPX.js +0 -816
- package/dist/chunk-KCUOWRPX.js.map +0 -1
- package/dist/chunk-KDHN2ZQE.js +0 -313
- package/dist/chunk-KDHN2ZQE.js.map +0 -1
- package/dist/chunk-ME2OERF5.js +0 -345
- package/dist/chunk-ME2OERF5.js.map +0 -1
- package/dist/chunk-OBQ74FOU.js +0 -27
- package/dist/chunk-OBQ74FOU.js.map +0 -1
- package/dist/chunk-Q5EKA5YA.js +0 -254
- package/dist/chunk-Q5EKA5YA.js.map +0 -1
- package/dist/chunk-Q63FFI6D.js +0 -132
- package/dist/chunk-Q63FFI6D.js.map +0 -1
- package/dist/chunk-SASNMSB5.js +0 -12597
- package/dist/chunk-SASNMSB5.js.map +0 -1
- package/dist/chunk-T63OHG4Q.js +0 -440
- package/dist/chunk-T63OHG4Q.js.map +0 -1
- package/dist/chunk-TN5WEKWI.js +0 -173
- package/dist/chunk-TN5WEKWI.js.map +0 -1
- package/dist/chunk-VUL52BQL.js +0 -402
- package/dist/chunk-VUL52BQL.js.map +0 -1
- package/dist/chunk-VVITXIHN.js +0 -189
- package/dist/chunk-VVITXIHN.js.map +0 -1
- package/dist/chunk-WCN7S3EI.js +0 -14
- package/dist/chunk-WCN7S3EI.js.map +0 -1
- package/dist/chunk-XPZZFPBZ.js +0 -491
- package/dist/chunk-XPZZFPBZ.js.map +0 -1
- package/dist/chunk-ZJF5FTBX.js +0 -1396
- package/dist/chunk-ZJF5FTBX.js.map +0 -1
- package/dist/chunk-ZV2K6M7T.js +0 -74
- package/dist/chunk-ZV2K6M7T.js.map +0 -1
- package/dist/cli/create-agent.d.ts +0 -1
- package/dist/cli/create-agent.js +0 -1050
- package/dist/cli/create-agent.js.map +0 -1
- package/dist/cli/yolo-daemon.d.ts +0 -1
- package/dist/cli/yolo-daemon.js +0 -421
- package/dist/cli/yolo-daemon.js.map +0 -1
- package/dist/client-NJPZE5JT.js +0 -28
- package/dist/client-NJPZE5JT.js.map +0 -1
- package/dist/codebase-index-VAPF32XX.js +0 -12
- package/dist/codebase-index-VAPF32XX.js.map +0 -1
- package/dist/fast-analyzer-3GCCZMLK.js +0 -216
- package/dist/fast-analyzer-3GCCZMLK.js.map +0 -1
- package/dist/git-EO5SRFMN.js +0 -28
- package/dist/git-EO5SRFMN.js.map +0 -1
- package/dist/github-ingester-ZOKK6GRS.js +0 -11
- package/dist/github-ingester-ZOKK6GRS.js.map +0 -1
- package/dist/goal-manager-QUKX2W6C.js +0 -25
- package/dist/goal-manager-QUKX2W6C.js.map +0 -1
- package/dist/goal-validator-2SFSKKVU.js +0 -24
- package/dist/goal-validator-2SFSKKVU.js.map +0 -1
- package/dist/graph-B3NA4S7I.js +0 -10
- package/dist/graph-B3NA4S7I.js.map +0 -1
- package/dist/hypothesis-KCPBR652.js +0 -23
- package/dist/hypothesis-KCPBR652.js.map +0 -1
- package/dist/incident-index-EFNUSGWL.js +0 -11
- package/dist/incident-index-EFNUSGWL.js.map +0 -1
- package/dist/insight-store-EC4PLSAW.js +0 -22
- package/dist/insight-store-EC4PLSAW.js.map +0 -1
- package/dist/issue-store-YAXTNRRY.js +0 -36
- package/dist/issue-store-YAXTNRRY.js.map +0 -1
- package/dist/ledger-TWZTGDFA.js +0 -58
- package/dist/ledger-TWZTGDFA.js.map +0 -1
- package/dist/linear-ingester-XXPAZZRW.js +0 -11
- package/dist/linear-ingester-XXPAZZRW.js.map +0 -1
- package/dist/output-manager-RVJ37XKA.js +0 -13
- package/dist/output-manager-RVJ37XKA.js.map +0 -1
- package/dist/parse-goal-violation-SACGFG3C.js +0 -8
- package/dist/parse-goal-violation-SACGFG3C.js.map +0 -1
- package/dist/pattern-discovery-F7LU5K6E.js +0 -8
- package/dist/pattern-discovery-F7LU5K6E.js.map +0 -1
- package/dist/progress-SRQ2V3BP.js +0 -18
- package/dist/progress-SRQ2V3BP.js.map +0 -1
- package/dist/project-state-AHPA77SM.js +0 -28
- package/dist/project-state-AHPA77SM.js.map +0 -1
- package/dist/sync-M2FSWPBC.js +0 -12
- package/dist/sync-M2FSWPBC.js.map +0 -1
- package/dist/terminal-spawn-5YXDMUCF.js +0 -157
- package/dist/terminal-spawn-5YXDMUCF.js.map +0 -1
- package/dist/tiered-storage-DYNC5CQ6.js +0 -13
- package/dist/tiered-storage-DYNC5CQ6.js.map +0 -1
- package/dist/trie-agent-I3HAHY2G.js +0 -26
- package/dist/trie-agent-I3HAHY2G.js.map +0 -1
- package/dist/ui/chat.html +0 -1014
- package/dist/ui/goals.html +0 -967
- package/dist/ui/hypotheses.html +0 -1011
- package/dist/ui/ledger.html +0 -954
- package/dist/ui/nudges.html +0 -995
- package/dist/vibe-code-signatures-5ZULYP3D.js +0 -987
- package/dist/vibe-code-signatures-5ZULYP3D.js.map +0 -1
- package/dist/vulnerability-signatures-2URZSXAQ.js +0 -983
- package/dist/vulnerability-signatures-2URZSXAQ.js.map +0 -1
package/dist/chunk-G3I7SZLW.js
DELETED
|
@@ -1,354 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
searchIssues
|
|
3
|
-
} from "./chunk-KCUOWRPX.js";
|
|
4
|
-
import {
|
|
5
|
-
getProjectState
|
|
6
|
-
} from "./chunk-GTKYBOXL.js";
|
|
7
|
-
|
|
8
|
-
// src/agent/goal-validator.ts
|
|
9
|
-
async function getActiveGoals(projectPath) {
|
|
10
|
-
const projectState = getProjectState(projectPath);
|
|
11
|
-
await projectState.load();
|
|
12
|
-
return projectState.getAllGoals().filter((g) => g.status === "active");
|
|
13
|
-
}
|
|
14
|
-
async function recordGoalViolationCaught(goal, file, projectPath) {
|
|
15
|
-
const projectState = getProjectState(projectPath);
|
|
16
|
-
await projectState.load();
|
|
17
|
-
const metadata = goal.metadata || {};
|
|
18
|
-
const caughtCount = (metadata.caughtCount || 0) + 1;
|
|
19
|
-
await projectState.updateGoal(goal.id, {
|
|
20
|
-
metadata: {
|
|
21
|
-
...metadata,
|
|
22
|
-
caughtCount,
|
|
23
|
-
lastCaught: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24
|
-
lastCaughtFile: file
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
async function recordGoalViolationFixed(goal, file, projectPath) {
|
|
29
|
-
const projectState = getProjectState(projectPath);
|
|
30
|
-
await projectState.load();
|
|
31
|
-
const metadata = goal.metadata || {};
|
|
32
|
-
const fixedCount = (metadata.fixedCount || 0) + 1;
|
|
33
|
-
await projectState.updateGoal(goal.id, {
|
|
34
|
-
metadata: {
|
|
35
|
-
...metadata,
|
|
36
|
-
fixedCount,
|
|
37
|
-
lastFixed: (/* @__PURE__ */ new Date()).toISOString(),
|
|
38
|
-
lastFixedFile: file
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
const { resolveGoalViolation } = await import("./issue-store-YAXTNRRY.js");
|
|
42
|
-
await resolveGoalViolation(file, goal.description, projectPath);
|
|
43
|
-
const { getGoalManager } = await import("./goal-manager-QUKX2W6C.js");
|
|
44
|
-
const goalManager = getGoalManager(projectPath);
|
|
45
|
-
await goalManager.updateGoalProgress();
|
|
46
|
-
}
|
|
47
|
-
async function measureInitialGoalValue(description, projectPath) {
|
|
48
|
-
try {
|
|
49
|
-
const issues = await searchIssues("", {
|
|
50
|
-
workDir: projectPath,
|
|
51
|
-
limit: 1e3,
|
|
52
|
-
includeResolved: false
|
|
53
|
-
});
|
|
54
|
-
if (issues.length === 0) {
|
|
55
|
-
return 0;
|
|
56
|
-
}
|
|
57
|
-
const desc = description.toLowerCase();
|
|
58
|
-
const goalViolations = issues.filter(
|
|
59
|
-
(r) => r.issue.agent === "goal-violation" && r.issue.issue.toLowerCase().includes(desc.slice(0, 30))
|
|
60
|
-
);
|
|
61
|
-
if (goalViolations.length > 0) {
|
|
62
|
-
return goalViolations.length;
|
|
63
|
-
}
|
|
64
|
-
if (desc.includes("security") || desc.includes("vulnerab")) {
|
|
65
|
-
return issues.filter(
|
|
66
|
-
(r) => r.issue.agent === "security" || r.issue.severity === "critical"
|
|
67
|
-
).length;
|
|
68
|
-
}
|
|
69
|
-
if (desc.includes("type") || desc.includes("typescript") || desc.includes("any type")) {
|
|
70
|
-
return issues.filter(
|
|
71
|
-
(r) => r.issue.agent === "typecheck" || r.issue.issue.toLowerCase().includes("type")
|
|
72
|
-
).length;
|
|
73
|
-
}
|
|
74
|
-
if (desc.includes("bug") || desc.includes("error")) {
|
|
75
|
-
return issues.filter(
|
|
76
|
-
(r) => r.issue.agent === "bug-finding" || r.issue.severity === "critical" || r.issue.severity === "serious"
|
|
77
|
-
).length;
|
|
78
|
-
}
|
|
79
|
-
if (desc.includes("dead code") || desc.includes("unused")) {
|
|
80
|
-
return issues.filter((r) => {
|
|
81
|
-
const msg = r.issue.issue.toLowerCase();
|
|
82
|
-
return msg.includes("unused") || msg.includes("dead code") || msg.includes("never used");
|
|
83
|
-
}).length;
|
|
84
|
-
}
|
|
85
|
-
return 0;
|
|
86
|
-
} catch {
|
|
87
|
-
return 0;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
async function checkFilesForGoalViolations(goals, projectPath, filesToCheck, onProgress, signal) {
|
|
91
|
-
const { isAIAvailable, runAIAnalysis } = await import("./client-NJPZE5JT.js");
|
|
92
|
-
const { CodebaseIndex } = await import("./codebase-index-VAPF32XX.js");
|
|
93
|
-
if (!isAIAvailable()) {
|
|
94
|
-
throw new Error("AI not available - ANTHROPIC_API_KEY not set");
|
|
95
|
-
}
|
|
96
|
-
const codebaseIndex = new CodebaseIndex(projectPath);
|
|
97
|
-
if (codebaseIndex.isEmpty()) {
|
|
98
|
-
onProgress?.("Building codebase index (first-time, may take a minute)...");
|
|
99
|
-
const { glob } = await import("glob");
|
|
100
|
-
const { stat } = await import("fs/promises");
|
|
101
|
-
const indexPattern = `${projectPath}/**/*.{ts,tsx,js,jsx,mjs,vue,svelte,astro,py,go,rs,java,c,cpp,h,hpp,cs,rb,php,css,scss,html}`;
|
|
102
|
-
const indexFiles = await glob(indexPattern, {
|
|
103
|
-
ignore: ["**/node_modules/**", "**/dist/**", "**/build/**", "**/.git/**", "**/.trie/**", "**/coverage/**"],
|
|
104
|
-
nodir: true
|
|
105
|
-
});
|
|
106
|
-
const withStats = await Promise.all(
|
|
107
|
-
indexFiles.map(async (f) => {
|
|
108
|
-
try {
|
|
109
|
-
const stats = await stat(f);
|
|
110
|
-
return { file: f, mtime: stats.mtime.getTime() };
|
|
111
|
-
} catch {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
})
|
|
115
|
-
);
|
|
116
|
-
const toIndex = withStats.filter((f) => f !== null).sort((a, b) => b.mtime - a.mtime).slice(0, 500).map((f) => f.file);
|
|
117
|
-
let indexed = 0;
|
|
118
|
-
for (const filePath of toIndex) {
|
|
119
|
-
if (signal?.aborted) {
|
|
120
|
-
throw new DOMException("Scan cancelled", "AbortError");
|
|
121
|
-
}
|
|
122
|
-
let relativePath = filePath;
|
|
123
|
-
if (filePath.toLowerCase().startsWith(projectPath.toLowerCase() + "/")) {
|
|
124
|
-
relativePath = filePath.slice(projectPath.length + 1);
|
|
125
|
-
}
|
|
126
|
-
const result = await codebaseIndex.indexFile(relativePath);
|
|
127
|
-
if (result) indexed++;
|
|
128
|
-
if (indexed % 50 === 0) {
|
|
129
|
-
onProgress?.(`Indexing files (${indexed}/${toIndex.length})...`);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
await codebaseIndex.save();
|
|
133
|
-
}
|
|
134
|
-
let files = [];
|
|
135
|
-
if (filesToCheck && filesToCheck.length > 0) {
|
|
136
|
-
files = filesToCheck;
|
|
137
|
-
} else {
|
|
138
|
-
const { glob } = await import("glob");
|
|
139
|
-
const pattern = `${projectPath}/**/*.{ts,tsx,js,jsx,py,go,rs,java,c,cpp,h,hpp,cs,rb,php,css,scss,html,vue,svelte}`;
|
|
140
|
-
const allFiles = await glob(pattern, {
|
|
141
|
-
ignore: ["**/node_modules/**", "**/dist/**", "**/build/**", "**/.git/**", "**/.trie/**", "**/coverage/**"],
|
|
142
|
-
nodir: true
|
|
143
|
-
});
|
|
144
|
-
const { stat } = await import("fs/promises");
|
|
145
|
-
const withStats = await Promise.all(
|
|
146
|
-
allFiles.map(async (f) => {
|
|
147
|
-
try {
|
|
148
|
-
const stats = await stat(f);
|
|
149
|
-
return { file: f, mtime: stats.mtime.getTime() };
|
|
150
|
-
} catch {
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
})
|
|
154
|
-
);
|
|
155
|
-
files = withStats.filter((f) => f !== null).sort((a, b) => b.mtime - a.mtime).slice(0, 100).map((f) => f.file);
|
|
156
|
-
}
|
|
157
|
-
if (files.length === 0) {
|
|
158
|
-
throw new Error("No files found to check");
|
|
159
|
-
}
|
|
160
|
-
for (const filePath of files) {
|
|
161
|
-
let rel = filePath;
|
|
162
|
-
if (filePath.toLowerCase().startsWith(projectPath.toLowerCase() + "/")) {
|
|
163
|
-
rel = filePath.slice(projectPath.length + 1);
|
|
164
|
-
} else if (filePath.startsWith("/") && !filePath.toLowerCase().startsWith(projectPath.toLowerCase())) {
|
|
165
|
-
continue;
|
|
166
|
-
}
|
|
167
|
-
await codebaseIndex.indexFile(rel);
|
|
168
|
-
}
|
|
169
|
-
const filesToScan = [];
|
|
170
|
-
const cachedViolations = [];
|
|
171
|
-
for (const filePath of files) {
|
|
172
|
-
let relativePath = filePath;
|
|
173
|
-
if (filePath.toLowerCase().startsWith(projectPath.toLowerCase() + "/")) {
|
|
174
|
-
relativePath = filePath.slice(projectPath.length + 1);
|
|
175
|
-
} else if (filePath.startsWith("/")) {
|
|
176
|
-
continue;
|
|
177
|
-
}
|
|
178
|
-
const hasChanged = await codebaseIndex.hasChanged(relativePath);
|
|
179
|
-
if (hasChanged) {
|
|
180
|
-
const indexed = await codebaseIndex.indexFile(relativePath);
|
|
181
|
-
if (indexed) {
|
|
182
|
-
filesToScan.push(filePath);
|
|
183
|
-
}
|
|
184
|
-
} else {
|
|
185
|
-
for (const goal of goals) {
|
|
186
|
-
const cached = codebaseIndex.getCachedViolations(relativePath, goal.id);
|
|
187
|
-
if (cached && cached.length > 0) {
|
|
188
|
-
const violation = cached[0];
|
|
189
|
-
if (violation && violation.found) {
|
|
190
|
-
cachedViolations.push({
|
|
191
|
-
file: relativePath,
|
|
192
|
-
message: `Goal "${goal.description}" violated in ${relativePath}: ${violation.details || "Violation found"} [${violation.confidence || 90}% confidence] (cached)`,
|
|
193
|
-
severity: "warning"
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
} else {
|
|
197
|
-
if (!filesToScan.includes(filePath)) {
|
|
198
|
-
filesToScan.push(filePath);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
onProgress?.(`Checking ${filesToScan.length} files for violations...`);
|
|
205
|
-
const allViolations = [...cachedViolations];
|
|
206
|
-
if (filesToScan.length === 0) {
|
|
207
|
-
await codebaseIndex.save();
|
|
208
|
-
return allViolations;
|
|
209
|
-
}
|
|
210
|
-
const BATCH_SIZE = 25;
|
|
211
|
-
const totalBatches = Math.ceil(filesToScan.length / BATCH_SIZE);
|
|
212
|
-
for (let batchStart = 0; batchStart < filesToScan.length; batchStart += BATCH_SIZE) {
|
|
213
|
-
const batchNum = Math.floor(batchStart / BATCH_SIZE) + 1;
|
|
214
|
-
onProgress?.(`Analyzing files (batch ${batchNum}/${totalBatches})...`);
|
|
215
|
-
const batchFiles = filesToScan.slice(batchStart, batchStart + BATCH_SIZE);
|
|
216
|
-
const { readFile } = await import("fs/promises");
|
|
217
|
-
const fileContents = await Promise.all(
|
|
218
|
-
batchFiles.map(async (filePath) => {
|
|
219
|
-
try {
|
|
220
|
-
const content = await readFile(filePath, "utf-8");
|
|
221
|
-
const relativePath = filePath.replace(projectPath + "/", "");
|
|
222
|
-
return {
|
|
223
|
-
path: relativePath,
|
|
224
|
-
content
|
|
225
|
-
// Never truncate text in Trie Watch
|
|
226
|
-
};
|
|
227
|
-
} catch {
|
|
228
|
-
return null;
|
|
229
|
-
}
|
|
230
|
-
})
|
|
231
|
-
);
|
|
232
|
-
const validFiles = fileContents.filter((f) => f !== null);
|
|
233
|
-
if (validFiles.length === 0) continue;
|
|
234
|
-
const filesBlock = validFiles.map((f) => `--- ${f.path} ---
|
|
235
|
-
${f.content}`).join("\n\n");
|
|
236
|
-
const goalsSection = `
|
|
237
|
-
USER-DEFINED GOALS (check EVERY file against ALL goals):
|
|
238
|
-
${goals.map((g, i) => ` ${i + 1}. "${g.description}"`).join("\n")}
|
|
239
|
-
|
|
240
|
-
This is a MANUAL CHECK requested by the user. Report ALL goal violations you find.
|
|
241
|
-
For emoji detection, look for Unicode emoji characters.
|
|
242
|
-
`;
|
|
243
|
-
const result = await runAIAnalysis({
|
|
244
|
-
...signal && { signal },
|
|
245
|
-
systemPrompt: `You are checking code for GOAL VIOLATIONS ONLY.
|
|
246
|
-
${goalsSection}
|
|
247
|
-
Reply ONLY with a JSON array. Each element must have:
|
|
248
|
-
- "file": relative file path
|
|
249
|
-
- "severity": "critical" | "major" | "minor"
|
|
250
|
-
- "description": 1-sentence description of the goal violation with specific examples
|
|
251
|
-
- "confidence": number 0-100, how confident you are this is a violation
|
|
252
|
-
- "isGoalViolation": true (always true for this scan)
|
|
253
|
-
- "goalIndex": 0-based index of the violated goal
|
|
254
|
-
|
|
255
|
-
CRITICAL DETECTION RULES:
|
|
256
|
-
|
|
257
|
-
**EMOJIS**: Any Unicode emoji characters including but not limited to:
|
|
258
|
-
- Emoticons: \u{1F600}\u{1F603}\u{1F604}\u{1F60A}\u{1F642}\u{1F643}\u{1F609}\u{1F607}\u{1F970}\u{1F60D}\u{1F929}\u{1F618}\u{1F617}\u263A\uFE0F\u{1F61A}\u{1F619}\u{1F972}
|
|
259
|
-
- Symbols: \u26A1\uFE0F\u26A0\uFE0F\u2705\u274C\u279C\u2192\u2190\u2191\u2193\u25BA\u25C4\u25B2\u25BC\u2605\u2606\u25CF\u25CB\u25C6\u25C7\u25A0\u25A1\u25AA\uFE0F\u25AB\uFE0F
|
|
260
|
-
- Objects: \u{1F4CA}\u{1F4C8}\u{1F4C9}\u{1F4BB}\u{1F5A5}\uFE0F\u{1F4F1}\u2328\uFE0F\u{1F5B1}\uFE0F\u{1F4BE}\u{1F4BF}\u{1F4C0}\u{1F527}\u{1F528}\u2699\uFE0F\u{1F6E0}\uFE0F
|
|
261
|
-
- Actions: \u{1F525}\u{1F4AA}\u{1F44D}\u{1F44E}\u{1F44F}\u{1F64C}\u{1F91D}\u270A\u{1F44A}\u{1F3AF}\u{1F389}\u{1F38A}\u{1F680}
|
|
262
|
-
- Weather: \u2600\uFE0F\u{1F324}\uFE0F\u26C5\u2601\uFE0F\u{1F326}\uFE0F\u{1F327}\uFE0F\u26C8\uFE0F\u{1F329}\uFE0F\u{1F328}\uFE0F\u2744\uFE0F
|
|
263
|
-
- ALL OTHER Unicode emoji in ranges U+1F300-U+1F9FF, U+2600-U+27BF, U+2B00-U+2BFF
|
|
264
|
-
|
|
265
|
-
**COLORS**: For "purple" or "gradient" goals, check:
|
|
266
|
-
- CSS: purple, #purple, hsl(purple), rgb(purple), violet, #8B00FF, #9B59D6, etc.
|
|
267
|
-
- Gradients: linear-gradient, radial-gradient, conic-gradient, background-image with gradients
|
|
268
|
-
- Tailwind: purple-*, violet-*, bg-gradient-*
|
|
269
|
-
- Styled components or CSS-in-JS with purple/violet/gradient
|
|
270
|
-
|
|
271
|
-
Be EXTREMELY thorough. Check:
|
|
272
|
-
1. String literals and template literals
|
|
273
|
-
2. JSX/HTML content
|
|
274
|
-
3. CSS files and style blocks
|
|
275
|
-
4. Comments (emojis in comments still violate "no emojis")
|
|
276
|
-
5. console.log statements
|
|
277
|
-
6. Component names, variable names (if they contain emojis)
|
|
278
|
-
|
|
279
|
-
If a goal says "no emojis" and you see ANY emoji ANYWHERE in the file, report it.
|
|
280
|
-
If a goal says "no console.log" and you see console.log ANYWHERE, report it.
|
|
281
|
-
If a goal says "no purple/gradient" and you see ANY purple color or gradient, report it.
|
|
282
|
-
|
|
283
|
-
If no violations found, reply with: []
|
|
284
|
-
Output ONLY the JSON array, no markdown fences, no commentary.`,
|
|
285
|
-
userPrompt: `Check these ${validFiles.length} files for goal violations:
|
|
286
|
-
|
|
287
|
-
${filesBlock}`,
|
|
288
|
-
maxTokens: 8192,
|
|
289
|
-
// Increased for larger codebases
|
|
290
|
-
temperature: 0.1
|
|
291
|
-
});
|
|
292
|
-
let issues = [];
|
|
293
|
-
try {
|
|
294
|
-
const cleaned = result.content.replace(/```json?\n?|\n?```/g, "").trim();
|
|
295
|
-
issues = JSON.parse(cleaned);
|
|
296
|
-
if (!Array.isArray(issues)) issues = [];
|
|
297
|
-
} catch (err) {
|
|
298
|
-
console.debug("[Goal Check] Batch parse failed:", err);
|
|
299
|
-
continue;
|
|
300
|
-
}
|
|
301
|
-
for (const issue of issues) {
|
|
302
|
-
if (!issue.isGoalViolation || issue.confidence < 50) continue;
|
|
303
|
-
if (issue.goalIndex == null || issue.goalIndex < 0 || issue.goalIndex >= goals.length) continue;
|
|
304
|
-
const goal = goals[issue.goalIndex];
|
|
305
|
-
if (!goal) continue;
|
|
306
|
-
const severity = issue.severity === "critical" ? "critical" : "warning";
|
|
307
|
-
const message = `Goal "${goal.description}" violated in ${issue.file}: ${issue.description} [${issue.confidence}% confidence]`;
|
|
308
|
-
allViolations.push({
|
|
309
|
-
file: issue.file,
|
|
310
|
-
message,
|
|
311
|
-
severity
|
|
312
|
-
});
|
|
313
|
-
codebaseIndex.recordViolation(
|
|
314
|
-
issue.file,
|
|
315
|
-
goal.id,
|
|
316
|
-
goal.description,
|
|
317
|
-
true,
|
|
318
|
-
// found
|
|
319
|
-
issue.description,
|
|
320
|
-
issue.confidence
|
|
321
|
-
);
|
|
322
|
-
await recordGoalViolationCaught(goal, issue.file, projectPath);
|
|
323
|
-
}
|
|
324
|
-
for (const file of validFiles) {
|
|
325
|
-
for (let goalIdx = 0; goalIdx < goals.length; goalIdx++) {
|
|
326
|
-
const goal = goals[goalIdx];
|
|
327
|
-
if (!goal) continue;
|
|
328
|
-
const hasViolation = issues.some((i) => i.file === file.path && i.goalIndex === goalIdx);
|
|
329
|
-
if (!hasViolation) {
|
|
330
|
-
codebaseIndex.recordViolation(
|
|
331
|
-
file.path,
|
|
332
|
-
goal.id,
|
|
333
|
-
goal.description,
|
|
334
|
-
false,
|
|
335
|
-
// not found
|
|
336
|
-
void 0,
|
|
337
|
-
100
|
|
338
|
-
);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
await codebaseIndex.save();
|
|
344
|
-
return allViolations;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
export {
|
|
348
|
-
getActiveGoals,
|
|
349
|
-
recordGoalViolationCaught,
|
|
350
|
-
recordGoalViolationFixed,
|
|
351
|
-
measureInitialGoalValue,
|
|
352
|
-
checkFilesForGoalViolations
|
|
353
|
-
};
|
|
354
|
-
//# sourceMappingURL=chunk-G3I7SZLW.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/agent/goal-validator.ts"],"sourcesContent":["/**\n * Goal Validator - Helpers for goal tracking\n * \n * Goal detection is handled entirely by the AI watcher in watch.ts.\n * The AI (Anthropic) checks every changed file against user-defined goals,\n * using the Trie's priority scoring for cost control.\n * \n * This module provides:\n * - getActiveGoals: loads active goals for the AI prompt\n * - recordGoalViolationCaught: tracks when a violation is detected\n * - recordGoalViolationFixed: tracks when a violation is auto-fixed\n * - measureInitialGoalValue: measures current state for new goals\n */\n\nimport type { Goal } from './project-state.js';\nimport { getProjectState } from './project-state.js';\nimport { searchIssues } from '../memory/issue-store.js';\n\n/**\n * Get active goals for a project (used by the AI watcher)\n */\nexport async function getActiveGoals(projectPath: string): Promise<Goal[]> {\n const projectState = getProjectState(projectPath);\n await projectState.load();\n return projectState.getAllGoals().filter(g => g.status === 'active');\n}\n\nexport async function recordGoalViolationCaught(\n goal: Goal,\n file: string,\n projectPath: string\n): Promise<void> {\n const projectState = getProjectState(projectPath);\n await projectState.load();\n \n const metadata = goal.metadata || {};\n const caughtCount = (metadata.caughtCount || 0) + 1;\n \n await projectState.updateGoal(goal.id, {\n metadata: {\n ...metadata,\n caughtCount,\n lastCaught: new Date().toISOString(),\n lastCaughtFile: file,\n },\n });\n}\n\nexport async function recordGoalViolationFixed(\n goal: Goal,\n file: string,\n projectPath: string\n): Promise<void> {\n const projectState = getProjectState(projectPath);\n await projectState.load();\n \n const metadata = goal.metadata || {};\n const fixedCount = (metadata.fixedCount || 0) + 1;\n \n await projectState.updateGoal(goal.id, {\n metadata: {\n ...metadata,\n fixedCount,\n lastFixed: new Date().toISOString(),\n lastFixedFile: file,\n },\n });\n \n // Resolve the goal-violation issue in the issue store\n // This is the source of truth - measureGoalMetric() will query from here\n const { resolveGoalViolation } = await import('../memory/issue-store.js');\n await resolveGoalViolation(file, goal.description, projectPath);\n \n // Trigger immediate progress update so UI reflects the fix\n const { getGoalManager } = await import('./goal-manager.js');\n const goalManager = getGoalManager(projectPath);\n await goalManager.updateGoalProgress();\n}\n\n/**\n * Measure the initial value for a new goal based on existing issues.\n * This sets a proper baseline so progress calculation works correctly.\n * \n * For reduction goals (like \"no emojis\"), we count current violations.\n * For other goals, we use semantic matching against existing issues.\n * \n * Returns the count to use as both startValue and currentValue.\n */\nexport async function measureInitialGoalValue(\n description: string,\n projectPath: string\n): Promise<number> {\n try {\n const issues = await searchIssues('', {\n workDir: projectPath,\n limit: 1000,\n includeResolved: false,\n });\n \n if (issues.length === 0) {\n return 0;\n }\n \n const desc = description.toLowerCase();\n \n // Check for goal-violation issues that might already exist for similar goals\n const goalViolations = issues.filter(r => \n r.issue.agent === 'goal-violation' &&\n r.issue.issue.toLowerCase().includes(desc.slice(0, 30))\n );\n if (goalViolations.length > 0) {\n return goalViolations.length;\n }\n \n // Security goals\n if (desc.includes('security') || desc.includes('vulnerab')) {\n return issues.filter(r => \n r.issue.agent === 'security' || r.issue.severity === 'critical'\n ).length;\n }\n \n // Type safety goals\n if (desc.includes('type') || desc.includes('typescript') || desc.includes('any type')) {\n return issues.filter(r => \n r.issue.agent === 'typecheck' ||\n r.issue.issue.toLowerCase().includes('type')\n ).length;\n }\n \n // Bug-related goals\n if (desc.includes('bug') || desc.includes('error')) {\n return issues.filter(r => \n r.issue.agent === 'bug-finding' ||\n r.issue.severity === 'critical' ||\n r.issue.severity === 'serious'\n ).length;\n }\n \n // Dead code / unused code goals\n if (desc.includes('dead code') || desc.includes('unused')) {\n return issues.filter(r => {\n const msg = r.issue.issue.toLowerCase();\n return msg.includes('unused') || msg.includes('dead code') || msg.includes('never used');\n }).length;\n }\n \n // For custom goals like \"no emojis\", we start at 0 and let the AI scanner find violations\n // This is correct because we don't know the count until a scan runs\n return 0;\n } catch {\n return 0;\n }\n}\n\n/**\n * Manually check files against goals\n * Returns violations found\n * \n * NOW WITH CACHING: Uses CodebaseIndex to avoid re-scanning unchanged files\n */\nexport async function checkFilesForGoalViolations(\n goals: Goal[],\n projectPath: string,\n filesToCheck?: string[],\n onProgress?: (message: string) => void,\n signal?: AbortSignal\n): Promise<Array<{ file: string; message: string; severity: 'critical' | 'warning' | 'info' }>> {\n // Import AI client and codebase index\n const { isAIAvailable, runAIAnalysis } = await import('../ai/client.js');\n const { CodebaseIndex } = await import('../context/codebase-index.js');\n \n if (!isAIAvailable()) {\n throw new Error('AI not available - ANTHROPIC_API_KEY not set');\n }\n \n // Initialize codebase index for caching\n const codebaseIndex = new CodebaseIndex(projectPath);\n \n // Check if index needs to be built\n if (codebaseIndex.isEmpty()) {\n onProgress?.('Building codebase index (first-time, may take a minute)...');\n \n // Auto-index using same file selection as checks (most recently modified) so cache overlaps\n const { glob } = await import('glob');\n const { stat } = await import('fs/promises');\n const indexPattern = `${projectPath}/**/*.{ts,tsx,js,jsx,mjs,vue,svelte,astro,py,go,rs,java,c,cpp,h,hpp,cs,rb,php,css,scss,html}`;\n const indexFiles = await glob(indexPattern, {\n ignore: ['**/node_modules/**', '**/dist/**', '**/build/**', '**/.git/**', '**/.trie/**', '**/coverage/**'],\n nodir: true,\n });\n \n const withStats = await Promise.all(\n indexFiles.map(async (f) => {\n try {\n const stats = await stat(f);\n return { file: f, mtime: stats.mtime.getTime() };\n } catch {\n return null;\n }\n })\n );\n const toIndex = withStats\n .filter((f): f is { file: string; mtime: number } => f !== null)\n .sort((a, b) => b.mtime - a.mtime)\n .slice(0, 500)\n .map((f) => f.file);\n \n let indexed = 0;\n for (const filePath of toIndex) {\n if (signal?.aborted) {\n throw new DOMException('Scan cancelled', 'AbortError');\n }\n let relativePath = filePath;\n if (filePath.toLowerCase().startsWith(projectPath.toLowerCase() + '/')) {\n relativePath = filePath.slice(projectPath.length + 1);\n }\n const result = await codebaseIndex.indexFile(relativePath);\n if (result) indexed++;\n if (indexed % 50 === 0) {\n onProgress?.(`Indexing files (${indexed}/${toIndex.length})...`);\n }\n }\n \n await codebaseIndex.save();\n }\n \n // Get files to check\n let files: string[] = [];\n if (filesToCheck && filesToCheck.length > 0) {\n files = filesToCheck;\n } else {\n // MANUAL CHECK MODE: Scan ALL relevant files, not just recently modified\n const { glob } = await import('glob');\n \n const pattern = `${projectPath}/**/*.{ts,tsx,js,jsx,py,go,rs,java,c,cpp,h,hpp,cs,rb,php,css,scss,html,vue,svelte}`;\n const allFiles = await glob(pattern, {\n ignore: ['**/node_modules/**', '**/dist/**', '**/build/**', '**/.git/**', '**/.trie/**', '**/coverage/**'],\n nodir: true,\n });\n \n // For manual checks, use more files but still reasonable limit\n // Sort by modification time to prioritize recently modified\n const { stat } = await import('fs/promises');\n const withStats = await Promise.all(\n allFiles.map(async (f) => {\n try {\n const stats = await stat(f);\n return { file: f, mtime: stats.mtime.getTime() };\n } catch {\n return null;\n }\n })\n );\n \n files = withStats\n .filter((f): f is { file: string; mtime: number } => f !== null)\n .sort((a, b) => b.mtime - a.mtime)\n .slice(0, 100) // Check up to 100 files for manual scans\n .map(f => f.file);\n }\n \n if (files.length === 0) {\n throw new Error('No files found to check');\n }\n\n // Pre-index the files we're about to check so cache lookups work.\n // The initial index may have indexed different files (first 500 from glob), while we check\n // the 100 most recently modified - these can have zero overlap, causing every run to scan.\n for (const filePath of files) {\n let rel = filePath;\n if (filePath.toLowerCase().startsWith(projectPath.toLowerCase() + '/')) {\n rel = filePath.slice(projectPath.length + 1);\n } else if (filePath.startsWith('/') && !filePath.toLowerCase().startsWith(projectPath.toLowerCase())) {\n continue;\n }\n await codebaseIndex.indexFile(rel);\n }\n \n // Check which files need scanning vs can use cached results\n const filesToScan: string[] = [];\n const cachedViolations: Array<{ file: string; message: string; severity: 'critical' | 'warning' | 'info' }> = [];\n \n for (const filePath of files) {\n // Handle case-insensitive filesystems (macOS) and ensure we get a proper relative path\n let relativePath = filePath;\n if (filePath.toLowerCase().startsWith(projectPath.toLowerCase() + '/')) {\n relativePath = filePath.slice(projectPath.length + 1);\n } else if (filePath.startsWith('/')) {\n // Already absolute but doesn't match projectPath - skip this file\n // This can happen with stale cache entries from different projects\n continue;\n }\n const hasChanged = await codebaseIndex.hasChanged(relativePath);\n \n if (hasChanged) {\n // File changed or not indexed - needs scanning\n // Try to index the file first; skip if it doesn't exist\n const indexed = await codebaseIndex.indexFile(relativePath);\n if (indexed) {\n filesToScan.push(filePath);\n }\n // If indexFile returns null, file doesn't exist - skip it silently\n } else {\n // File unchanged - check cache for each goal\n for (const goal of goals) {\n const cached = codebaseIndex.getCachedViolations(relativePath, goal.id);\n if (cached && cached.length > 0) {\n const violation = cached[0];\n if (violation && violation.found) {\n cachedViolations.push({\n file: relativePath,\n message: `Goal \"${goal.description}\" violated in ${relativePath}: ${violation.details || 'Violation found'} [${violation.confidence || 90}% confidence] (cached)`,\n severity: 'warning',\n });\n }\n } else {\n // No cache for this goal - needs scanning\n if (!filesToScan.includes(filePath)) {\n filesToScan.push(filePath);\n }\n }\n }\n }\n }\n \n onProgress?.(`Checking ${filesToScan.length} files for violations...`);\n \n // Process files that need scanning in batches\n const allViolations: Array<{ file: string; message: string; severity: 'critical' | 'warning' | 'info' }> = [...cachedViolations];\n \n if (filesToScan.length === 0) {\n // All results from cache!\n await codebaseIndex.save();\n return allViolations;\n }\n \n // For large file sets, process in batches to avoid token limits\n const BATCH_SIZE = 25; // Process 25 files at a time\n \n const totalBatches = Math.ceil(filesToScan.length / BATCH_SIZE);\n for (let batchStart = 0; batchStart < filesToScan.length; batchStart += BATCH_SIZE) {\n const batchNum = Math.floor(batchStart / BATCH_SIZE) + 1;\n onProgress?.(`Analyzing files (batch ${batchNum}/${totalBatches})...`);\n const batchFiles = filesToScan.slice(batchStart, batchStart + BATCH_SIZE);\n \n // Read file contents for this batch\n const { readFile } = await import('fs/promises');\n const fileContents = await Promise.all(\n batchFiles.map(async (filePath) => {\n try {\n const content = await readFile(filePath, 'utf-8');\n const relativePath = filePath.replace(projectPath + '/', '');\n return {\n path: relativePath,\n content: content, // Never truncate text in Trie Watch\n };\n } catch {\n return null;\n }\n })\n );\n \n const validFiles = fileContents.filter((f): f is { path: string; content: string } => f !== null);\n \n if (validFiles.length === 0) continue;\n \n // Build files block for AI\n const filesBlock = validFiles\n .map(f => `--- ${f.path} ---\\n${f.content}`)\n .join('\\n\\n');\n \n // Build goals section\n const goalsSection = `\nUSER-DEFINED GOALS (check EVERY file against ALL goals):\n${goals.map((g, i) => ` ${i + 1}. \"${g.description}\"`).join('\\n')}\n\nThis is a MANUAL CHECK requested by the user. Report ALL goal violations you find.\nFor emoji detection, look for Unicode emoji characters.\n`;\n \n // Run AI analysis\n const result = await runAIAnalysis({\n ...(signal && { signal }),\n systemPrompt: `You are checking code for GOAL VIOLATIONS ONLY.\n${goalsSection}\nReply ONLY with a JSON array. Each element must have:\n- \"file\": relative file path\n- \"severity\": \"critical\" | \"major\" | \"minor\"\n- \"description\": 1-sentence description of the goal violation with specific examples\n- \"confidence\": number 0-100, how confident you are this is a violation\n- \"isGoalViolation\": true (always true for this scan)\n- \"goalIndex\": 0-based index of the violated goal\n\nCRITICAL DETECTION RULES:\n\n**EMOJIS**: Any Unicode emoji characters including but not limited to:\n- Emoticons: πππππππππ₯°ππ€©ππβΊοΈπππ₯²\n- Symbols: β‘οΈβ οΈβ
βββββββΊββ²βΌβ
ββββββ β‘βͺοΈβ«οΈ\n- Objects: ππππ»π₯οΈπ±β¨οΈπ±οΈπΎπΏππ§π¨βοΈπ οΈ\n- Actions: π₯πͺπππππ€βππ―πππ\n- Weather: βοΈπ€οΈβ
βοΈπ¦οΈπ§οΈβοΈπ©οΈπ¨οΈβοΈ\n- ALL OTHER Unicode emoji in ranges U+1F300-U+1F9FF, U+2600-U+27BF, U+2B00-U+2BFF\n\n**COLORS**: For \"purple\" or \"gradient\" goals, check:\n- CSS: purple, #purple, hsl(purple), rgb(purple), violet, #8B00FF, #9B59D6, etc.\n- Gradients: linear-gradient, radial-gradient, conic-gradient, background-image with gradients\n- Tailwind: purple-*, violet-*, bg-gradient-*\n- Styled components or CSS-in-JS with purple/violet/gradient\n\nBe EXTREMELY thorough. Check:\n1. String literals and template literals\n2. JSX/HTML content\n3. CSS files and style blocks\n4. Comments (emojis in comments still violate \"no emojis\")\n5. console.log statements\n6. Component names, variable names (if they contain emojis)\n\nIf a goal says \"no emojis\" and you see ANY emoji ANYWHERE in the file, report it.\nIf a goal says \"no console.log\" and you see console.log ANYWHERE, report it.\nIf a goal says \"no purple/gradient\" and you see ANY purple color or gradient, report it.\n\nIf no violations found, reply with: []\nOutput ONLY the JSON array, no markdown fences, no commentary.`,\n userPrompt: `Check these ${validFiles.length} files for goal violations:\\n\\n${filesBlock}`,\n maxTokens: 8192, // Increased for larger codebases\n temperature: 0.1,\n });\n \n // Parse response\n let issues: Array<{\n file: string;\n severity: 'critical' | 'major' | 'minor';\n description: string;\n confidence: number;\n isGoalViolation: boolean;\n goalIndex?: number;\n }> = [];\n \n try {\n const cleaned = result.content.replace(/```json?\\n?|\\n?```/g, '').trim();\n issues = JSON.parse(cleaned);\n if (!Array.isArray(issues)) issues = [];\n } catch (err) {\n // Parse failed - continue to next batch\n console.debug('[Goal Check] Batch parse failed:', err);\n continue;\n }\n \n // Convert to violation format and record\n for (const issue of issues) {\n if (!issue.isGoalViolation || issue.confidence < 50) continue;\n if (issue.goalIndex == null || issue.goalIndex < 0 || issue.goalIndex >= goals.length) continue;\n \n const goal = goals[issue.goalIndex];\n if (!goal) continue; // Defensive check\n const severity = issue.severity === 'critical' ? 'critical' : 'warning';\n const message = `Goal \"${goal.description}\" violated in ${issue.file}: ${issue.description} [${issue.confidence}% confidence]`;\n \n allViolations.push({\n file: issue.file,\n message,\n severity,\n });\n \n // Cache the result in codebase index\n codebaseIndex.recordViolation(\n issue.file,\n goal.id,\n goal.description,\n true, // found\n issue.description,\n issue.confidence\n );\n \n // Record violation\n await recordGoalViolationCaught(goal, issue.file, projectPath);\n }\n \n // Also record \"no violation\" for scanned files\n for (const file of validFiles) {\n for (let goalIdx = 0; goalIdx < goals.length; goalIdx++) {\n const goal = goals[goalIdx];\n if (!goal) continue;\n const hasViolation = issues.some(i => i.file === file.path && i.goalIndex === goalIdx);\n if (!hasViolation) {\n codebaseIndex.recordViolation(\n file.path,\n goal.id,\n goal.description,\n false, // not found\n undefined,\n 100\n );\n }\n }\n }\n }\n \n // Save updated index\n await codebaseIndex.save();\n \n return allViolations;\n}\n"],"mappings":";;;;;;;;AAqBA,eAAsB,eAAe,aAAsC;AACzE,QAAM,eAAe,gBAAgB,WAAW;AAChD,QAAM,aAAa,KAAK;AACxB,SAAO,aAAa,YAAY,EAAE,OAAO,OAAK,EAAE,WAAW,QAAQ;AACrE;AAEA,eAAsB,0BACpB,MACA,MACA,aACe;AACf,QAAM,eAAe,gBAAgB,WAAW;AAChD,QAAM,aAAa,KAAK;AAExB,QAAM,WAAW,KAAK,YAAY,CAAC;AACnC,QAAM,eAAe,SAAS,eAAe,KAAK;AAElD,QAAM,aAAa,WAAW,KAAK,IAAI;AAAA,IACrC,UAAU;AAAA,MACR,GAAG;AAAA,MACH;AAAA,MACA,aAAY,oBAAI,KAAK,GAAE,YAAY;AAAA,MACnC,gBAAgB;AAAA,IAClB;AAAA,EACF,CAAC;AACH;AAEA,eAAsB,yBACpB,MACA,MACA,aACe;AACf,QAAM,eAAe,gBAAgB,WAAW;AAChD,QAAM,aAAa,KAAK;AAExB,QAAM,WAAW,KAAK,YAAY,CAAC;AACnC,QAAM,cAAc,SAAS,cAAc,KAAK;AAEhD,QAAM,aAAa,WAAW,KAAK,IAAI;AAAA,IACrC,UAAU;AAAA,MACR,GAAG;AAAA,MACH;AAAA,MACA,YAAW,oBAAI,KAAK,GAAE,YAAY;AAAA,MAClC,eAAe;AAAA,IACjB;AAAA,EACF,CAAC;AAID,QAAM,EAAE,qBAAqB,IAAI,MAAM,OAAO,2BAA0B;AACxE,QAAM,qBAAqB,MAAM,KAAK,aAAa,WAAW;AAG9D,QAAM,EAAE,eAAe,IAAI,MAAM,OAAO,4BAAmB;AAC3D,QAAM,cAAc,eAAe,WAAW;AAC9C,QAAM,YAAY,mBAAmB;AACvC;AAWA,eAAsB,wBACpB,aACA,aACiB;AACjB,MAAI;AACF,UAAM,SAAS,MAAM,aAAa,IAAI;AAAA,MACpC,SAAS;A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