@triedotdev/mcp 1.0.116 → 1.0.118
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/{chunk-2764RZVV.js → chunk-OZGDXRLD.js} +372 -12
- package/dist/chunk-OZGDXRLD.js.map +1 -0
- package/dist/{chunk-SRQ4DNOP.js → chunk-PPZYVTUO.js} +67 -1
- package/dist/{chunk-SRQ4DNOP.js.map → chunk-PPZYVTUO.js.map} +1 -1
- package/dist/cli/main.js +1 -1
- package/dist/cli/yolo-daemon.js +2 -2
- package/dist/index.js +152 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2764RZVV.js.map +0 -1
package/dist/cli/main.js
CHANGED
package/dist/cli/yolo-daemon.js
CHANGED
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
InteractiveDashboard,
|
|
4
4
|
StreamingManager,
|
|
5
5
|
TrieScanTool
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-OZGDXRLD.js";
|
|
7
7
|
import "../chunk-OMCEUJ5I.js";
|
|
8
8
|
import "../chunk-IQBHPTV7.js";
|
|
9
9
|
import "../chunk-I7XKF5XD.js";
|
|
10
10
|
import "../chunk-Y52SNUW5.js";
|
|
11
11
|
import {
|
|
12
12
|
isTrieInitialized
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-PPZYVTUO.js";
|
|
14
14
|
import "../chunk-FNW7Z7ZS.js";
|
|
15
15
|
import "../chunk-WRGSH5RT.js";
|
|
16
16
|
import "../chunk-PRFHN2X6.js";
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
getPrompt,
|
|
39
39
|
getSystemPrompt,
|
|
40
40
|
handleCheckpointTool
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-OZGDXRLD.js";
|
|
42
42
|
import "./chunk-OMCEUJ5I.js";
|
|
43
43
|
import "./chunk-IQBHPTV7.js";
|
|
44
44
|
import "./chunk-I7XKF5XD.js";
|
|
@@ -46,10 +46,12 @@ import "./chunk-Y52SNUW5.js";
|
|
|
46
46
|
import {
|
|
47
47
|
exportToJson,
|
|
48
48
|
formatFriendlyError,
|
|
49
|
+
getChangedFilesSinceTimestamp,
|
|
50
|
+
getGitChangedFiles,
|
|
49
51
|
importFromJson,
|
|
50
52
|
isTrieInitialized,
|
|
51
53
|
runShellCommandSync
|
|
52
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-PPZYVTUO.js";
|
|
53
55
|
import {
|
|
54
56
|
findCrossProjectPatterns,
|
|
55
57
|
getGlobalMemoryStats,
|
|
@@ -1247,6 +1249,7 @@ var TrieWatchTool = class _TrieWatchTool {
|
|
|
1247
1249
|
debounceMs
|
|
1248
1250
|
});
|
|
1249
1251
|
}
|
|
1252
|
+
void this.initialGoalComplianceScan();
|
|
1250
1253
|
return {
|
|
1251
1254
|
content: [{
|
|
1252
1255
|
type: "text",
|
|
@@ -1823,6 +1826,153 @@ ${filesBlock}`,
|
|
|
1823
1826
|
this.state.autoScanInProgress = false;
|
|
1824
1827
|
}
|
|
1825
1828
|
}
|
|
1829
|
+
/**
|
|
1830
|
+
* Initial goal compliance scan when watch starts.
|
|
1831
|
+
*
|
|
1832
|
+
* This checks recently modified files against active goals so the user
|
|
1833
|
+
* gets immediate feedback about goal violations without waiting for files
|
|
1834
|
+
* to be changed.
|
|
1835
|
+
*
|
|
1836
|
+
* Strategy:
|
|
1837
|
+
* 1. Check if there are any active goals - if not, skip
|
|
1838
|
+
* 2. Find recently modified files (last 24 hours OR uncommitted changes)
|
|
1839
|
+
* 3. Filter to watched file types
|
|
1840
|
+
* 4. Run a quick AI scan focused only on goal violations
|
|
1841
|
+
* 5. Nudge the user about any violations found
|
|
1842
|
+
*/
|
|
1843
|
+
async initialGoalComplianceScan() {
|
|
1844
|
+
if (!isAIAvailable()) return;
|
|
1845
|
+
const projectPath = this.watchedDirectory || getWorkingDirectory(void 0, true);
|
|
1846
|
+
try {
|
|
1847
|
+
const { getActiveGoals, recordGoalViolationCaught } = await import("./goal-validator-YSNN23D4.js");
|
|
1848
|
+
const activeGoals = await getActiveGoals(projectPath);
|
|
1849
|
+
if (activeGoals.length === 0) return;
|
|
1850
|
+
if (!isInteractiveMode()) {
|
|
1851
|
+
console.error("[*] Checking recent files against active goals...");
|
|
1852
|
+
}
|
|
1853
|
+
const recentFiles = /* @__PURE__ */ new Set();
|
|
1854
|
+
const uncommittedFiles = await getGitChangedFiles(projectPath);
|
|
1855
|
+
if (uncommittedFiles) {
|
|
1856
|
+
uncommittedFiles.forEach((f) => recentFiles.add(join2(projectPath, f)));
|
|
1857
|
+
}
|
|
1858
|
+
const oneDayAgo = Date.now() - 24 * 60 * 60 * 1e3;
|
|
1859
|
+
const recentChanges = await getChangedFilesSinceTimestamp(projectPath, oneDayAgo);
|
|
1860
|
+
if (recentChanges) {
|
|
1861
|
+
recentChanges.forEach((f) => recentFiles.add(f));
|
|
1862
|
+
}
|
|
1863
|
+
const filesToCheck = Array.from(recentFiles).filter((file) => {
|
|
1864
|
+
const ext = extname3(file).toLowerCase();
|
|
1865
|
+
return WATCH_EXTENSIONS.has(ext) && existsSync3(file);
|
|
1866
|
+
});
|
|
1867
|
+
if (filesToCheck.length === 0) return;
|
|
1868
|
+
const maxInitialFiles = 10;
|
|
1869
|
+
const filesToScan = filesToCheck.slice(0, maxInitialFiles);
|
|
1870
|
+
if (!isInteractiveMode()) {
|
|
1871
|
+
console.error(` Scanning ${filesToScan.length} recent file(s) against ${activeGoals.length} goal(s)...`);
|
|
1872
|
+
}
|
|
1873
|
+
const maxCharsPerFile = 3e3;
|
|
1874
|
+
const fileContents = await Promise.all(
|
|
1875
|
+
filesToScan.map(async (file) => {
|
|
1876
|
+
try {
|
|
1877
|
+
const content = await readFile3(file, "utf-8");
|
|
1878
|
+
const relativePath = file.replace(projectPath + "/", "");
|
|
1879
|
+
return { path: relativePath, content: content.slice(0, maxCharsPerFile) };
|
|
1880
|
+
} catch {
|
|
1881
|
+
return null;
|
|
1882
|
+
}
|
|
1883
|
+
})
|
|
1884
|
+
);
|
|
1885
|
+
const valid = fileContents.filter(Boolean);
|
|
1886
|
+
if (valid.length === 0) return;
|
|
1887
|
+
const filesBlock = valid.map(
|
|
1888
|
+
(f) => `### ${f.path}
|
|
1889
|
+
\`\`\`
|
|
1890
|
+
${f.content}
|
|
1891
|
+
\`\`\``
|
|
1892
|
+
).join("\n\n");
|
|
1893
|
+
const goalsSection = `
|
|
1894
|
+
USER-DEFINED GOALS (check EVERY file against ALL goals):
|
|
1895
|
+
${activeGoals.map((g, i) => ` ${i + 1}. "${g.description}"`).join("\n")}
|
|
1896
|
+
|
|
1897
|
+
This is an INITIAL SCAN at watch startup. Report ALL goal violations you find.
|
|
1898
|
+
`;
|
|
1899
|
+
const result = await runAIAnalysis({
|
|
1900
|
+
systemPrompt: `You are checking code for GOAL VIOLATIONS ONLY.
|
|
1901
|
+
${goalsSection}
|
|
1902
|
+
Reply ONLY with a JSON array. Each element must have:
|
|
1903
|
+
- "file": relative file path
|
|
1904
|
+
- "severity": "critical" | "major" | "minor"
|
|
1905
|
+
- "description": 1-sentence description of the goal violation
|
|
1906
|
+
- "confidence": number 0-100, how confident you are this is a violation
|
|
1907
|
+
- "suggestedFix": 1-sentence description of what should change
|
|
1908
|
+
- "isGoalViolation": true (always true for this scan)
|
|
1909
|
+
- "goalIndex": 0-based index of the violated goal
|
|
1910
|
+
|
|
1911
|
+
Be thorough. If a goal says "no emojis" and you see ANY emoji in the file, report it. If a goal says "no console.log" and you see console.log, report it.
|
|
1912
|
+
|
|
1913
|
+
If no violations found, reply with: []
|
|
1914
|
+
Output ONLY the JSON array, no markdown fences, no commentary.`,
|
|
1915
|
+
userPrompt: `Check these files for goal violations:
|
|
1916
|
+
|
|
1917
|
+
${filesBlock}`,
|
|
1918
|
+
maxTokens: 2048,
|
|
1919
|
+
temperature: 0.1
|
|
1920
|
+
});
|
|
1921
|
+
if (result.tokensUsed) {
|
|
1922
|
+
this.recordTokenUsage(result.tokensUsed.input + result.tokensUsed.output);
|
|
1923
|
+
}
|
|
1924
|
+
if (!result.success || !result.content.trim()) return;
|
|
1925
|
+
let issues = [];
|
|
1926
|
+
try {
|
|
1927
|
+
const parsed = JSON.parse(result.content.trim());
|
|
1928
|
+
issues = Array.isArray(parsed) ? parsed : [];
|
|
1929
|
+
} catch {
|
|
1930
|
+
return;
|
|
1931
|
+
}
|
|
1932
|
+
const { appendIssuesToLedger } = await import("./ledger-JMPGJGLB.js");
|
|
1933
|
+
const issuesForLedger = [];
|
|
1934
|
+
let violationsFound = 0;
|
|
1935
|
+
for (const issue of issues) {
|
|
1936
|
+
if (!issue.isGoalViolation || issue.confidence < 40) continue;
|
|
1937
|
+
violationsFound++;
|
|
1938
|
+
issuesForLedger.push({
|
|
1939
|
+
file: issue.file,
|
|
1940
|
+
message: issue.description,
|
|
1941
|
+
severity: issue.severity,
|
|
1942
|
+
confidence: issue.confidence,
|
|
1943
|
+
category: "goal-violation",
|
|
1944
|
+
suggestedFix: issue.suggestedFix
|
|
1945
|
+
});
|
|
1946
|
+
if (issue.goalIndex != null && issue.goalIndex >= 0 && issue.goalIndex < activeGoals.length) {
|
|
1947
|
+
const goal = activeGoals[issue.goalIndex];
|
|
1948
|
+
await recordGoalViolationCaught(goal, issue.file, projectPath);
|
|
1949
|
+
const confidenceStr = issue.confidence >= 80 ? "high" : issue.confidence >= 60 ? "medium" : "low";
|
|
1950
|
+
const nudgeMsg = `Goal "${goal.description}" violated in ${issue.file}: ${issue.description} [${confidenceStr} confidence]`;
|
|
1951
|
+
getOutputManager().nudge(nudgeMsg, "warning", issue.file);
|
|
1952
|
+
this.state.nudges.push({
|
|
1953
|
+
file: basename2(issue.file),
|
|
1954
|
+
message: nudgeMsg,
|
|
1955
|
+
severity: "high",
|
|
1956
|
+
timestamp: (/* @__PURE__ */ new Date()).toLocaleTimeString("en-US", { hour12: false })
|
|
1957
|
+
});
|
|
1958
|
+
}
|
|
1959
|
+
}
|
|
1960
|
+
if (issuesForLedger.length > 0) {
|
|
1961
|
+
await appendIssuesToLedger(issuesForLedger, projectPath);
|
|
1962
|
+
}
|
|
1963
|
+
if (!isInteractiveMode()) {
|
|
1964
|
+
if (violationsFound > 0) {
|
|
1965
|
+
console.error(` [!] Found ${violationsFound} goal violation(s) in recent files`);
|
|
1966
|
+
} else {
|
|
1967
|
+
console.error(` [\u2713] No goal violations found in recent files`);
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
} catch (error) {
|
|
1971
|
+
if (!isInteractiveMode()) {
|
|
1972
|
+
console.error(` [!] Initial goal scan error: ${error}`);
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1826
1976
|
stopWatching() {
|
|
1827
1977
|
if (!this.state.isRunning) {
|
|
1828
1978
|
return {
|