@triedotdev/mcp 1.0.136 → 1.0.138
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 +6 -6
- package/dist/{autonomy-config-QA6ATWLJ.js → autonomy-config-TZ6HF4FA.js} +3 -3
- package/dist/{chat-store-HFOOWZYN.js → chat-store-OJLJCJFI.js} +3 -3
- package/dist/{chunk-DFPVUMVE.js → chunk-23RJT5WT.js} +5 -4
- package/dist/chunk-23RJT5WT.js.map +1 -0
- package/dist/{chunk-4YJ6KLGI.js → chunk-3MUCUZ46.js} +8 -8
- package/dist/chunk-3MUCUZ46.js.map +1 -0
- package/dist/{chunk-6VIMBFUZ.js → chunk-3RRXWX3V.js} +21 -17
- package/dist/chunk-3RRXWX3V.js.map +1 -0
- package/dist/{chunk-WHIQAGB7.js → chunk-4C67GV3O.js} +2 -2
- package/dist/{chunk-WS6OA7H6.js → chunk-4MJ52WBH.js} +2 -3
- package/dist/chunk-4MJ52WBH.js.map +1 -0
- package/dist/{chunk-AJ34GCMD.js → chunk-67GSG2ST.js} +41 -38
- package/dist/chunk-67GSG2ST.js.map +1 -0
- package/dist/{chunk-UHX4462X.js → chunk-6LLH3TBZ.js} +24 -25
- package/dist/chunk-6LLH3TBZ.js.map +1 -0
- package/dist/{chunk-DFHMB44X.js → chunk-D3AS5LY7.js} +6 -10
- package/dist/chunk-D3AS5LY7.js.map +1 -0
- package/dist/{chunk-6OUWNVLX.js → chunk-EDDT4ZIH.js} +8 -8
- package/dist/chunk-EDDT4ZIH.js.map +1 -0
- package/dist/{chunk-Z4DN527J.js → chunk-FG467PDD.js} +156 -39
- package/dist/chunk-FG467PDD.js.map +1 -0
- package/dist/{chunk-T4THB2OR.js → chunk-FOCXXIXY.js} +49 -28
- package/dist/chunk-FOCXXIXY.js.map +1 -0
- package/dist/{goal-validator-PDKYZSNP.js → chunk-GFFUDJMK.js} +97 -40
- package/dist/chunk-GFFUDJMK.js.map +1 -0
- package/dist/{chunk-ZEXMMTIQ.js → chunk-J5EMP4XW.js} +2 -2
- package/dist/{chunk-UHMMANC2.js → chunk-LT6VUZG2.js} +21 -18
- package/dist/chunk-LT6VUZG2.js.map +1 -0
- package/dist/{chunk-55CBWOEZ.js → chunk-QSWUPSLK.js} +2 -2
- package/dist/{chunk-45Y5TLQZ.js → chunk-SH7H3WRU.js} +3 -6
- package/dist/chunk-SH7H3WRU.js.map +1 -0
- package/dist/{chunk-VRLMTOB6.js → chunk-TIMIKBY2.js} +1 -1
- package/dist/chunk-TIMIKBY2.js.map +1 -0
- package/dist/{chunk-POHBQUG7.js → chunk-X3F5QDER.js} +1224 -448
- package/dist/chunk-X3F5QDER.js.map +1 -0
- package/dist/{chunk-O6OTJI3W.js → chunk-Y32FM3MR.js} +2 -2
- package/dist/{chunk-G5PRBQIQ.js → chunk-YOKQ25IW.js} +102 -82
- package/dist/chunk-YOKQ25IW.js.map +1 -0
- package/dist/{chunk-JAKMZI5S.js → chunk-Z2P4WST6.js} +291 -180
- package/dist/chunk-Z2P4WST6.js.map +1 -0
- package/dist/cli/create-agent.js +1 -1
- package/dist/cli/main.js +113 -86
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +19 -19
- package/dist/cli/yolo-daemon.js.map +1 -1
- package/dist/{client-BZHI675W.js → client-JTU5TRLB.js} +3 -3
- package/dist/{codebase-index-CR6Q2HEI.js → codebase-index-FNJ4GCBE.js} +3 -3
- package/dist/{goal-manager-FAK7H4RR.js → goal-manager-6BJQ36AH.js} +7 -8
- package/dist/goal-validator-GISXYANK.js +22 -0
- package/dist/{graph-PAUZ5EMP.js → graph-X2FMRQLG.js} +3 -3
- package/dist/{hypothesis-L5446W36.js → hypothesis-K3KQJOXJ.js} +7 -8
- package/dist/{incident-index-ZCDSJ42L.js → incident-index-BWW2UEY7.js} +3 -3
- package/dist/index.js +343 -288
- package/dist/index.js.map +1 -1
- package/dist/{insight-store-F5KDBY5Y.js → insight-store-A5XXMFD6.js} +6 -6
- package/dist/issue-store-BO5OWLJW.js +32 -0
- package/dist/{output-manager-BOTMXSND.js → output-manager-DZO5LGSG.js} +2 -2
- package/dist/{tiered-storage-QW2G7GSG.js → tiered-storage-VZL7KK64.js} +3 -3
- package/dist/trie-agent-XMSGMD7E.js +26 -0
- package/dist/trie-agent-XMSGMD7E.js.map +1 -0
- package/dist/ui/chat.html +260 -67
- package/dist/ui/goals.html +246 -3
- package/dist/ui/hypotheses.html +248 -5
- package/dist/ui/ledger.html +252 -9
- package/dist/ui/nudges.html +244 -1
- package/package.json +1 -1
- package/dist/chunk-45Y5TLQZ.js.map +0 -1
- package/dist/chunk-4YJ6KLGI.js.map +0 -1
- package/dist/chunk-6OUWNVLX.js.map +0 -1
- package/dist/chunk-6VIMBFUZ.js.map +0 -1
- package/dist/chunk-AJ34GCMD.js.map +0 -1
- package/dist/chunk-DFHMB44X.js.map +0 -1
- package/dist/chunk-DFPVUMVE.js.map +0 -1
- package/dist/chunk-G5PRBQIQ.js.map +0 -1
- package/dist/chunk-JAKMZI5S.js.map +0 -1
- package/dist/chunk-PEJEYWVR.js +0 -135
- package/dist/chunk-PEJEYWVR.js.map +0 -1
- package/dist/chunk-POHBQUG7.js.map +0 -1
- package/dist/chunk-T4THB2OR.js.map +0 -1
- package/dist/chunk-UHMMANC2.js.map +0 -1
- package/dist/chunk-UHX4462X.js.map +0 -1
- package/dist/chunk-VRLMTOB6.js.map +0 -1
- package/dist/chunk-WS6OA7H6.js.map +0 -1
- package/dist/chunk-Z4DN527J.js.map +0 -1
- package/dist/goal-validator-PDKYZSNP.js.map +0 -1
- package/dist/guardian-agent-4RHGIXUD.js +0 -27
- package/dist/ledger-WKVJWHBX.js +0 -17
- /package/dist/{autonomy-config-QA6ATWLJ.js.map → autonomy-config-TZ6HF4FA.js.map} +0 -0
- /package/dist/{chat-store-HFOOWZYN.js.map → chat-store-OJLJCJFI.js.map} +0 -0
- /package/dist/{chunk-WHIQAGB7.js.map → chunk-4C67GV3O.js.map} +0 -0
- /package/dist/{chunk-ZEXMMTIQ.js.map → chunk-J5EMP4XW.js.map} +0 -0
- /package/dist/{chunk-55CBWOEZ.js.map → chunk-QSWUPSLK.js.map} +0 -0
- /package/dist/{chunk-O6OTJI3W.js.map → chunk-Y32FM3MR.js.map} +0 -0
- /package/dist/{client-BZHI675W.js.map → client-JTU5TRLB.js.map} +0 -0
- /package/dist/{codebase-index-CR6Q2HEI.js.map → codebase-index-FNJ4GCBE.js.map} +0 -0
- /package/dist/{goal-manager-FAK7H4RR.js.map → goal-manager-6BJQ36AH.js.map} +0 -0
- /package/dist/{graph-PAUZ5EMP.js.map → goal-validator-GISXYANK.js.map} +0 -0
- /package/dist/{guardian-agent-4RHGIXUD.js.map → graph-X2FMRQLG.js.map} +0 -0
- /package/dist/{hypothesis-L5446W36.js.map → hypothesis-K3KQJOXJ.js.map} +0 -0
- /package/dist/{incident-index-ZCDSJ42L.js.map → incident-index-BWW2UEY7.js.map} +0 -0
- /package/dist/{insight-store-F5KDBY5Y.js.map → insight-store-A5XXMFD6.js.map} +0 -0
- /package/dist/{ledger-WKVJWHBX.js.map → issue-store-BO5OWLJW.js.map} +0 -0
- /package/dist/{output-manager-BOTMXSND.js.map → output-manager-DZO5LGSG.js.map} +0 -0
- /package/dist/{tiered-storage-QW2G7GSG.js.map → tiered-storage-VZL7KK64.js.map} +0 -0
package/dist/cli/main.js
CHANGED
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
needsBootstrap,
|
|
12
12
|
projectInfoExists,
|
|
13
13
|
saveConfig
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-D3AS5LY7.js";
|
|
15
15
|
import {
|
|
16
16
|
getAutonomyConfig,
|
|
17
17
|
recordBypass,
|
|
18
18
|
shouldAutoFix,
|
|
19
19
|
shouldBlockPush,
|
|
20
20
|
trackIssueOccurrence
|
|
21
|
-
} from "../chunk-
|
|
21
|
+
} from "../chunk-J5EMP4XW.js";
|
|
22
22
|
import {
|
|
23
23
|
LearningEngine,
|
|
24
24
|
exportToJson,
|
|
@@ -34,10 +34,10 @@ import {
|
|
|
34
34
|
isTrieInitialized,
|
|
35
35
|
perceiveCurrentChanges,
|
|
36
36
|
reasonAboutChangesHumanReadable
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-EDDT4ZIH.js";
|
|
38
38
|
import {
|
|
39
39
|
IncidentIndex
|
|
40
|
-
} from "../chunk-
|
|
40
|
+
} from "../chunk-4C67GV3O.js";
|
|
41
41
|
import "../chunk-ZV2K6M7T.js";
|
|
42
42
|
import {
|
|
43
43
|
GotchaPredictor,
|
|
@@ -46,33 +46,37 @@ import {
|
|
|
46
46
|
listTrackedProjects,
|
|
47
47
|
searchGlobalPatterns,
|
|
48
48
|
updateGlobalMemoryMd
|
|
49
|
-
} from "../chunk-
|
|
50
|
-
import "../chunk-O6OTJI3W.js";
|
|
49
|
+
} from "../chunk-6LLH3TBZ.js";
|
|
51
50
|
import {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
markIssueResolved,
|
|
56
|
-
purgeIssues,
|
|
57
|
-
searchIssues
|
|
58
|
-
} from "../chunk-JAKMZI5S.js";
|
|
51
|
+
measureInitialGoalValue
|
|
52
|
+
} from "../chunk-GFFUDJMK.js";
|
|
53
|
+
import "../chunk-Y32FM3MR.js";
|
|
59
54
|
import {
|
|
60
|
-
|
|
61
|
-
} from "../chunk-
|
|
62
|
-
import "../chunk-WS6OA7H6.js";
|
|
55
|
+
getProjectState
|
|
56
|
+
} from "../chunk-LT6VUZG2.js";
|
|
63
57
|
import "../chunk-F4NJ4CBP.js";
|
|
64
58
|
import "../chunk-IXO4G4D3.js";
|
|
65
59
|
import "../chunk-6NLHFIYA.js";
|
|
66
|
-
import
|
|
60
|
+
import {
|
|
61
|
+
getStorage
|
|
62
|
+
} from "../chunk-FG467PDD.js";
|
|
67
63
|
import {
|
|
68
64
|
ContextGraph
|
|
69
|
-
} from "../chunk-
|
|
70
|
-
import
|
|
65
|
+
} from "../chunk-QSWUPSLK.js";
|
|
66
|
+
import {
|
|
67
|
+
getDailyLogs,
|
|
68
|
+
getMemoryStats,
|
|
69
|
+
getRecentIssues,
|
|
70
|
+
markIssueResolved,
|
|
71
|
+
purgeIssues,
|
|
72
|
+
searchIssues
|
|
73
|
+
} from "../chunk-Z2P4WST6.js";
|
|
74
|
+
import "../chunk-4MJ52WBH.js";
|
|
71
75
|
import "../chunk-43X6JBEM.js";
|
|
72
76
|
import {
|
|
73
77
|
getTrieDirectory,
|
|
74
78
|
getWorkingDirectory
|
|
75
|
-
} from "../chunk-
|
|
79
|
+
} from "../chunk-SH7H3WRU.js";
|
|
76
80
|
import "../chunk-APMV77PU.js";
|
|
77
81
|
import {
|
|
78
82
|
__require
|
|
@@ -80,7 +84,7 @@ import {
|
|
|
80
84
|
|
|
81
85
|
// src/cli/main.ts
|
|
82
86
|
import { resolve, join as join3, dirname } from "path";
|
|
83
|
-
import { readFileSync } from "fs";
|
|
87
|
+
import { readFileSync, realpathSync } from "fs";
|
|
84
88
|
import { fileURLToPath } from "url";
|
|
85
89
|
import pc5 from "picocolors";
|
|
86
90
|
|
|
@@ -247,7 +251,7 @@ async function handleInitCommand(args) {
|
|
|
247
251
|
\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2551
|
|
248
252
|
\u2551 \u255A\u2550\u255D \u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u2551
|
|
249
253
|
\u2551 \u2551
|
|
250
|
-
\u2551 Your
|
|
254
|
+
\u2551 Your code quality agent and skills registry \u2551
|
|
251
255
|
\u2551 \u2551
|
|
252
256
|
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
253
257
|
|
|
@@ -311,10 +315,10 @@ async function handleInitCommand(args) {
|
|
|
311
315
|
console.log(`
|
|
312
316
|
Quick Start:
|
|
313
317
|
1. trie scan # Analyze your codebase now
|
|
314
|
-
2. trie watch # Start
|
|
318
|
+
2. trie watch # Start watching (nudges as you code)
|
|
315
319
|
3. trie tell "what broke" # Teach Trie about past incidents
|
|
316
320
|
|
|
317
|
-
|
|
321
|
+
Trie is now active via git hooks (pre-commit, pre-push).
|
|
318
322
|
For real-time nudges while coding, run "trie watch" in a terminal.
|
|
319
323
|
|
|
320
324
|
Customize Later:
|
|
@@ -542,10 +546,10 @@ async function handleGlobal(args) {
|
|
|
542
546
|
}
|
|
543
547
|
console.log(`Tracked Projects (${projects.length}):
|
|
544
548
|
`);
|
|
545
|
-
console.log("| Project | Last Scan |
|
|
546
|
-
console.log("
|
|
549
|
+
console.log("| Project | Last Scan | Issues |");
|
|
550
|
+
console.log("|---------|-----------|--------|");
|
|
547
551
|
for (const p of projects) {
|
|
548
|
-
console.log(`| ${p.name.slice(0, 20)} | ${p.lastScan.split("T")[0]} | ${p.
|
|
552
|
+
console.log(`| ${p.name.slice(0, 20)} | ${p.lastScan.split("T")[0]} | ${p.totalIssues} |`);
|
|
549
553
|
}
|
|
550
554
|
return;
|
|
551
555
|
}
|
|
@@ -1112,36 +1116,36 @@ async function handleAutoFixCommand(args, issues) {
|
|
|
1112
1116
|
import pc3 from "picocolors";
|
|
1113
1117
|
async function handleGoalCommand(args) {
|
|
1114
1118
|
const projectPath = getWorkingDirectory(void 0, true);
|
|
1115
|
-
const
|
|
1116
|
-
await
|
|
1119
|
+
const projectState = getProjectState(projectPath);
|
|
1120
|
+
await projectState.load();
|
|
1117
1121
|
const subcommand = args[0];
|
|
1118
1122
|
const restArgs = args.slice(1);
|
|
1119
1123
|
switch (subcommand) {
|
|
1120
1124
|
case "add":
|
|
1121
1125
|
case "create":
|
|
1122
|
-
await addGoal(
|
|
1126
|
+
await addGoal(projectState, restArgs);
|
|
1123
1127
|
break;
|
|
1124
1128
|
case "list":
|
|
1125
1129
|
case "ls":
|
|
1126
|
-
await listGoals(
|
|
1130
|
+
await listGoals(projectState);
|
|
1127
1131
|
break;
|
|
1128
1132
|
case "complete":
|
|
1129
1133
|
case "done":
|
|
1130
|
-
await completeGoal(
|
|
1134
|
+
await completeGoal(projectState, restArgs[0]);
|
|
1131
1135
|
break;
|
|
1132
1136
|
case "delete":
|
|
1133
1137
|
case "rm":
|
|
1134
|
-
await deleteGoal(
|
|
1138
|
+
await deleteGoal(projectState, restArgs[0]);
|
|
1135
1139
|
break;
|
|
1136
1140
|
default:
|
|
1137
1141
|
if (subcommand && !subcommand.startsWith("-")) {
|
|
1138
|
-
await addGoal(
|
|
1142
|
+
await addGoal(projectState, [subcommand, ...restArgs]);
|
|
1139
1143
|
} else {
|
|
1140
1144
|
printGoalHelp();
|
|
1141
1145
|
}
|
|
1142
1146
|
}
|
|
1143
1147
|
}
|
|
1144
|
-
async function addGoal(
|
|
1148
|
+
async function addGoal(projectState, args) {
|
|
1145
1149
|
const description = args.join(" ").replace(/^["']|["']$/g, "");
|
|
1146
1150
|
if (!description) {
|
|
1147
1151
|
console.error(pc3.red("Please provide a goal description."));
|
|
@@ -1182,14 +1186,16 @@ async function addGoal(guardianState, args) {
|
|
|
1182
1186
|
} else {
|
|
1183
1187
|
deadline.setDate(deadline.getDate() + 14);
|
|
1184
1188
|
}
|
|
1189
|
+
const workDir = getWorkingDirectory(void 0, true);
|
|
1190
|
+
const initialValue = await measureInitialGoalValue(cleanDesc, workDir);
|
|
1185
1191
|
const goal = {
|
|
1186
1192
|
id: `goal-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
1187
1193
|
description: cleanDesc,
|
|
1188
1194
|
type: goalType,
|
|
1189
1195
|
metric,
|
|
1190
1196
|
target,
|
|
1191
|
-
currentValue:
|
|
1192
|
-
startValue:
|
|
1197
|
+
currentValue: initialValue,
|
|
1198
|
+
startValue: initialValue,
|
|
1193
1199
|
status: "active",
|
|
1194
1200
|
autoGenerated: false,
|
|
1195
1201
|
// User-created
|
|
@@ -1198,19 +1204,22 @@ async function addGoal(guardianState, args) {
|
|
|
1198
1204
|
deadline: deadline.toISOString(),
|
|
1199
1205
|
category
|
|
1200
1206
|
};
|
|
1201
|
-
await
|
|
1207
|
+
await projectState.addGoal(goal);
|
|
1202
1208
|
console.error("");
|
|
1203
1209
|
console.error(pc3.green("\u2713 Goal created"));
|
|
1204
1210
|
console.error("");
|
|
1205
1211
|
console.error(pc3.bold(cleanDesc));
|
|
1206
1212
|
console.error(pc3.dim(`ID: ${goal.id}`));
|
|
1207
1213
|
console.error(pc3.dim(`Type: ${goalType} | Target: ${target} | Category: ${category}`));
|
|
1214
|
+
if (initialValue > 0) {
|
|
1215
|
+
console.error(pc3.dim(`Starting value: ${initialValue} issues found`));
|
|
1216
|
+
}
|
|
1208
1217
|
console.error(pc3.dim(`Deadline: ${deadline.toLocaleDateString()}`));
|
|
1209
1218
|
console.error("");
|
|
1210
|
-
console.error(pc3.cyan("
|
|
1219
|
+
console.error(pc3.cyan("Progress will be tracked and you'll be notified when you achieve it!"));
|
|
1211
1220
|
}
|
|
1212
|
-
async function listGoals(
|
|
1213
|
-
const goals =
|
|
1221
|
+
async function listGoals(projectState) {
|
|
1222
|
+
const goals = projectState.getAllGoals();
|
|
1214
1223
|
if (goals.length === 0) {
|
|
1215
1224
|
console.error(pc3.dim("No goals yet."));
|
|
1216
1225
|
console.error(pc3.dim('Create one: trie goal add "Reduce auth issues by 50%"'));
|
|
@@ -1248,19 +1257,19 @@ async function listGoals(guardianState) {
|
|
|
1248
1257
|
}
|
|
1249
1258
|
}
|
|
1250
1259
|
}
|
|
1251
|
-
async function completeGoal(
|
|
1260
|
+
async function completeGoal(projectState, goalId) {
|
|
1252
1261
|
if (!goalId) {
|
|
1253
1262
|
console.error(pc3.red("Please provide a goal ID."));
|
|
1254
1263
|
console.error(pc3.dim('Run "trie goal list" to see IDs.'));
|
|
1255
1264
|
return;
|
|
1256
1265
|
}
|
|
1257
|
-
const goals =
|
|
1258
|
-
const goal = goals.find((g) => g.id === goalId || g.id.
|
|
1266
|
+
const goals = projectState.getAllGoals();
|
|
1267
|
+
const goal = goals.find((g) => g.id === goalId || g.id.startsWith(goalId));
|
|
1259
1268
|
if (!goal) {
|
|
1260
1269
|
console.error(pc3.red(`Goal not found: ${goalId}`));
|
|
1261
1270
|
return;
|
|
1262
1271
|
}
|
|
1263
|
-
await
|
|
1272
|
+
await projectState.updateGoal(goal.id, {
|
|
1264
1273
|
status: "achieved",
|
|
1265
1274
|
currentValue: goal.target,
|
|
1266
1275
|
achievedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -1270,18 +1279,18 @@ async function completeGoal(guardianState, goalId) {
|
|
|
1270
1279
|
console.error(pc3.bold(goal.description));
|
|
1271
1280
|
console.error("");
|
|
1272
1281
|
}
|
|
1273
|
-
async function deleteGoal(
|
|
1282
|
+
async function deleteGoal(projectState, goalId) {
|
|
1274
1283
|
if (!goalId) {
|
|
1275
1284
|
console.error(pc3.red("Please provide a goal ID."));
|
|
1276
1285
|
return;
|
|
1277
1286
|
}
|
|
1278
|
-
const goals =
|
|
1279
|
-
const goal = goals.find((g) => g.id === goalId || g.id.
|
|
1287
|
+
const goals = projectState.getAllGoals();
|
|
1288
|
+
const goal = goals.find((g) => g.id === goalId || g.id.startsWith(goalId));
|
|
1280
1289
|
if (!goal) {
|
|
1281
1290
|
console.error(pc3.red(`Goal not found: ${goalId}`));
|
|
1282
1291
|
return;
|
|
1283
1292
|
}
|
|
1284
|
-
await
|
|
1293
|
+
await projectState.updateGoal(goal.id, { status: "rejected" });
|
|
1285
1294
|
console.error(pc3.dim(`Removed goal: ${goal.description}`));
|
|
1286
1295
|
}
|
|
1287
1296
|
function calculateGoalProgress(goal) {
|
|
@@ -1289,6 +1298,7 @@ function calculateGoalProgress(goal) {
|
|
|
1289
1298
|
const startValue = goal.startValue ?? goal.currentValue;
|
|
1290
1299
|
if (startValue > goal.target) {
|
|
1291
1300
|
const totalReduction = startValue - goal.target;
|
|
1301
|
+
if (totalReduction === 0) return 100;
|
|
1292
1302
|
const actualReduction = startValue - goal.currentValue;
|
|
1293
1303
|
return Math.round(actualReduction / totalReduction * 100);
|
|
1294
1304
|
}
|
|
@@ -1299,7 +1309,7 @@ function renderProgressBar(percent) {
|
|
|
1299
1309
|
const clamped = Math.max(0, Math.min(100, percent));
|
|
1300
1310
|
const filled = Math.round(clamped / 100 * width);
|
|
1301
1311
|
const empty = width - filled;
|
|
1302
|
-
return `[${pc3.green("\u2588".repeat(filled))}${pc3.
|
|
1312
|
+
return `[${pc3.green("\u2588".repeat(filled))}${pc3.gray("\u2591".repeat(empty))}]`;
|
|
1303
1313
|
}
|
|
1304
1314
|
function detectCategory(description) {
|
|
1305
1315
|
const lower = description.toLowerCase();
|
|
@@ -1332,38 +1342,38 @@ function printGoalHelp() {
|
|
|
1332
1342
|
}
|
|
1333
1343
|
async function handleHypothesisCommand(args) {
|
|
1334
1344
|
const projectPath = getWorkingDirectory(void 0, true);
|
|
1335
|
-
const
|
|
1336
|
-
await
|
|
1345
|
+
const projectState = getProjectState(projectPath);
|
|
1346
|
+
await projectState.load();
|
|
1337
1347
|
const subcommand = args[0];
|
|
1338
1348
|
const restArgs = args.slice(1);
|
|
1339
1349
|
switch (subcommand) {
|
|
1340
1350
|
case "add":
|
|
1341
1351
|
case "create":
|
|
1342
|
-
await addHypothesis(
|
|
1352
|
+
await addHypothesis(projectState, restArgs);
|
|
1343
1353
|
break;
|
|
1344
1354
|
case "list":
|
|
1345
1355
|
case "ls":
|
|
1346
|
-
await listHypotheses(
|
|
1356
|
+
await listHypotheses(projectState);
|
|
1347
1357
|
break;
|
|
1348
1358
|
case "validate":
|
|
1349
|
-
await validateHypothesis(
|
|
1359
|
+
await validateHypothesis(projectState, restArgs[0]);
|
|
1350
1360
|
break;
|
|
1351
1361
|
case "invalidate":
|
|
1352
|
-
await invalidateHypothesis(
|
|
1362
|
+
await invalidateHypothesis(projectState, restArgs[0]);
|
|
1353
1363
|
break;
|
|
1354
1364
|
case "delete":
|
|
1355
1365
|
case "rm":
|
|
1356
|
-
await deleteHypothesis(
|
|
1366
|
+
await deleteHypothesis(projectState, restArgs[0]);
|
|
1357
1367
|
break;
|
|
1358
1368
|
default:
|
|
1359
1369
|
if (subcommand && !subcommand.startsWith("-")) {
|
|
1360
|
-
await addHypothesis(
|
|
1370
|
+
await addHypothesis(projectState, [subcommand, ...restArgs]);
|
|
1361
1371
|
} else {
|
|
1362
1372
|
printHypothesisHelp();
|
|
1363
1373
|
}
|
|
1364
1374
|
}
|
|
1365
1375
|
}
|
|
1366
|
-
async function addHypothesis(
|
|
1376
|
+
async function addHypothesis(projectState, args) {
|
|
1367
1377
|
const statement = args.join(" ").replace(/^["']|["']$/g, "");
|
|
1368
1378
|
if (!statement) {
|
|
1369
1379
|
console.error(pc3.red("Please provide a hypothesis statement."));
|
|
@@ -1378,28 +1388,29 @@ async function addHypothesis(guardianState, args) {
|
|
|
1378
1388
|
const hypothesis = {
|
|
1379
1389
|
id: `hypo-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
|
|
1380
1390
|
statement: cleanStatement,
|
|
1381
|
-
confidence: 0
|
|
1382
|
-
//
|
|
1391
|
+
confidence: 0,
|
|
1392
|
+
// No evidence yet
|
|
1383
1393
|
status: "testing",
|
|
1384
1394
|
evidence: [],
|
|
1385
1395
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1386
1396
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1387
1397
|
testCriteria,
|
|
1388
|
-
category
|
|
1398
|
+
category,
|
|
1399
|
+
autoGenerated: false
|
|
1389
1400
|
};
|
|
1390
|
-
await
|
|
1401
|
+
await projectState.addHypothesis(hypothesis);
|
|
1391
1402
|
console.error("");
|
|
1392
1403
|
console.error(pc3.green("\u2713 Hypothesis created"));
|
|
1393
1404
|
console.error("");
|
|
1394
1405
|
console.error(pc3.bold(`"${cleanStatement}"`));
|
|
1395
1406
|
console.error(pc3.dim(`ID: ${hypothesis.id}`));
|
|
1396
|
-
console.error(pc3.dim(`Status: testing | Confidence:
|
|
1407
|
+
console.error(pc3.dim(`Status: testing | Confidence: untested | Category: ${category}`));
|
|
1397
1408
|
console.error("");
|
|
1398
|
-
console.error(pc3.cyan("The
|
|
1409
|
+
console.error(pc3.cyan("The agent will collect evidence and update confidence over time."));
|
|
1399
1410
|
console.error(pc3.dim(`Test criteria: ${testCriteria}`));
|
|
1400
1411
|
}
|
|
1401
|
-
async function listHypotheses(
|
|
1402
|
-
const hypotheses =
|
|
1412
|
+
async function listHypotheses(projectState) {
|
|
1413
|
+
const hypotheses = projectState.getAllHypotheses();
|
|
1403
1414
|
if (hypotheses.length === 0) {
|
|
1404
1415
|
console.error(pc3.dim("No hypotheses yet."));
|
|
1405
1416
|
console.error(pc3.dim('Create one: trie hypothesis add "Mondays have more bugs"'));
|
|
@@ -1435,53 +1446,53 @@ async function listHypotheses(guardianState) {
|
|
|
1435
1446
|
}
|
|
1436
1447
|
}
|
|
1437
1448
|
}
|
|
1438
|
-
async function validateHypothesis(
|
|
1449
|
+
async function validateHypothesis(projectState, hypoId) {
|
|
1439
1450
|
if (!hypoId) {
|
|
1440
1451
|
console.error(pc3.red("Please provide a hypothesis ID."));
|
|
1441
1452
|
return;
|
|
1442
1453
|
}
|
|
1443
|
-
const hypotheses =
|
|
1444
|
-
const hypo = hypotheses.find((h) => h.id === hypoId || h.id.
|
|
1454
|
+
const hypotheses = projectState.getAllHypotheses();
|
|
1455
|
+
const hypo = hypotheses.find((h) => h.id === hypoId || h.id.startsWith(hypoId));
|
|
1445
1456
|
if (!hypo) {
|
|
1446
1457
|
console.error(pc3.red(`Hypothesis not found: ${hypoId}`));
|
|
1447
1458
|
return;
|
|
1448
1459
|
}
|
|
1449
|
-
await
|
|
1460
|
+
await projectState.updateHypothesis(hypo.id, {
|
|
1450
1461
|
status: "validated",
|
|
1451
1462
|
confidence: 0.9,
|
|
1452
1463
|
validatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
1453
1464
|
});
|
|
1454
1465
|
console.error(pc3.green(`Hypothesis validated: "${hypo.statement}"`));
|
|
1455
1466
|
}
|
|
1456
|
-
async function invalidateHypothesis(
|
|
1467
|
+
async function invalidateHypothesis(projectState, hypoId) {
|
|
1457
1468
|
if (!hypoId) {
|
|
1458
1469
|
console.error(pc3.red("Please provide a hypothesis ID."));
|
|
1459
1470
|
return;
|
|
1460
1471
|
}
|
|
1461
|
-
const hypotheses =
|
|
1462
|
-
const hypo = hypotheses.find((h) => h.id === hypoId || h.id.
|
|
1472
|
+
const hypotheses = projectState.getAllHypotheses();
|
|
1473
|
+
const hypo = hypotheses.find((h) => h.id === hypoId || h.id.startsWith(hypoId));
|
|
1463
1474
|
if (!hypo) {
|
|
1464
1475
|
console.error(pc3.red(`Hypothesis not found: ${hypoId}`));
|
|
1465
1476
|
return;
|
|
1466
1477
|
}
|
|
1467
|
-
await
|
|
1478
|
+
await projectState.updateHypothesis(hypo.id, {
|
|
1468
1479
|
status: "invalidated",
|
|
1469
1480
|
confidence: 0.1
|
|
1470
1481
|
});
|
|
1471
1482
|
console.error(pc3.red(`Hypothesis invalidated: "${hypo.statement}"`));
|
|
1472
1483
|
}
|
|
1473
|
-
async function deleteHypothesis(
|
|
1484
|
+
async function deleteHypothesis(projectState, hypoId) {
|
|
1474
1485
|
if (!hypoId) {
|
|
1475
1486
|
console.error(pc3.red("Please provide a hypothesis ID."));
|
|
1476
1487
|
return;
|
|
1477
1488
|
}
|
|
1478
|
-
const hypotheses =
|
|
1479
|
-
const hypo = hypotheses.find((h) => h.id === hypoId || h.id.
|
|
1489
|
+
const hypotheses = projectState.getAllHypotheses();
|
|
1490
|
+
const hypo = hypotheses.find((h) => h.id === hypoId || h.id.startsWith(hypoId));
|
|
1480
1491
|
if (!hypo) {
|
|
1481
1492
|
console.error(pc3.red(`Hypothesis not found: ${hypoId}`));
|
|
1482
1493
|
return;
|
|
1483
1494
|
}
|
|
1484
|
-
await
|
|
1495
|
+
await projectState.updateHypothesis(hypo.id, { status: "retired" });
|
|
1485
1496
|
console.error(pc3.dim(`Removed hypothesis: "${hypo.statement}"`));
|
|
1486
1497
|
}
|
|
1487
1498
|
function detectHypothesisCategory(statement) {
|
|
@@ -1510,7 +1521,7 @@ function generateTestCriteria(statement) {
|
|
|
1510
1521
|
}
|
|
1511
1522
|
function printHypothesisHelp() {
|
|
1512
1523
|
console.error("");
|
|
1513
|
-
console.error(pc3.bold("trie hypothesis - Manage
|
|
1524
|
+
console.error(pc3.bold("trie hypothesis - Manage project hypotheses"));
|
|
1514
1525
|
console.error("");
|
|
1515
1526
|
console.error(pc3.cyan("Usage:"));
|
|
1516
1527
|
console.error(' trie hypothesis add "Mondays have more bugs than Fridays"');
|
|
@@ -1981,6 +1992,25 @@ async function handleGotchaCommand() {
|
|
|
1981
1992
|
console.log(picocolors.yellow(`
|
|
1982
1993
|
Found ${gotchas.length} potential "gotchas":
|
|
1983
1994
|
`));
|
|
1995
|
+
const storage = getStorage(workDir);
|
|
1996
|
+
await storage.initialize();
|
|
1997
|
+
const primaryFile = uniqueFiles[0];
|
|
1998
|
+
for (const gotcha of gotchas) {
|
|
1999
|
+
const ledgerGotcha = {
|
|
2000
|
+
id: gotcha.id,
|
|
2001
|
+
message: gotcha.message,
|
|
2002
|
+
confidence: gotcha.confidence,
|
|
2003
|
+
riskLevel: gotcha.riskLevel,
|
|
2004
|
+
recommendation: gotcha.recommendation,
|
|
2005
|
+
...primaryFile && { file: primaryFile },
|
|
2006
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2007
|
+
...gotcha.precedentId && { precedentId: gotcha.precedentId },
|
|
2008
|
+
tags: gotcha.evidence.matchingPatterns,
|
|
2009
|
+
evidence: gotcha.evidence,
|
|
2010
|
+
resolved: false
|
|
2011
|
+
};
|
|
2012
|
+
await storage.storeGotcha(ledgerGotcha);
|
|
2013
|
+
}
|
|
1984
2014
|
for (const gotcha of gotchas) {
|
|
1985
2015
|
const color = gotcha.riskLevel === "critical" ? picocolors.red : gotcha.riskLevel === "high" ? picocolors.yellow : picocolors.blue;
|
|
1986
2016
|
console.log(color(`[${gotcha.riskLevel.toUpperCase()}] ${gotcha.message}`));
|
|
@@ -1991,6 +2021,7 @@ Found ${gotchas.length} potential "gotchas":
|
|
|
1991
2021
|
console.log(picocolors.cyan(` \u{1F4A1} Recommendation: ${gotcha.recommendation}`));
|
|
1992
2022
|
console.log("");
|
|
1993
2023
|
}
|
|
2024
|
+
console.log(picocolors.dim(`Stored ${gotchas.length} gotcha(s) in Ledger. View in: trie watch \u2192 Ledger tab`));
|
|
1994
2025
|
} catch (error) {
|
|
1995
2026
|
const friendly = formatFriendlyError(error);
|
|
1996
2027
|
console.error(friendly.userMessage);
|
|
@@ -2407,7 +2438,7 @@ USAGE:
|
|
|
2407
2438
|
COMMANDS:
|
|
2408
2439
|
init Initialize Trie in your project
|
|
2409
2440
|
scan Scan codebase once and exit
|
|
2410
|
-
watch Start
|
|
2441
|
+
watch Start watching (nudges as you code)
|
|
2411
2442
|
Use screen/tmux to run in background
|
|
2412
2443
|
check Run risk check before pushing
|
|
2413
2444
|
|
|
@@ -2436,7 +2467,7 @@ COMMANDS:
|
|
|
2436
2467
|
|
|
2437
2468
|
EXAMPLES:
|
|
2438
2469
|
trie init # Initialize Trie in your project
|
|
2439
|
-
trie watch # Start
|
|
2470
|
+
trie watch # Start watching (nudges as you code)
|
|
2440
2471
|
trie watch # Run in background: screen -S trie-watch
|
|
2441
2472
|
trie scan # Scan your codebase now
|
|
2442
2473
|
|
|
@@ -2522,9 +2553,6 @@ async function handleStatusCommand() {
|
|
|
2522
2553
|
console.log("\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557");
|
|
2523
2554
|
console.log("\u2551 PROJECT STATUS \u2551");
|
|
2524
2555
|
console.log("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n");
|
|
2525
|
-
const healthIndicator = state.healthScore >= 80 ? "\u25CF" : state.healthScore >= 60 ? "\u25C9" : "\u25CB";
|
|
2526
|
-
const healthColor = state.healthScore >= 80 ? pc5.green(healthIndicator) : state.healthScore >= 60 ? pc5.yellow(healthIndicator) : pc5.red(healthIndicator);
|
|
2527
|
-
console.log(`${healthColor} Health Score: ${pc5.bold(state.healthScore + "%")}`);
|
|
2528
2556
|
if (state.lastScan) {
|
|
2529
2557
|
const lastScanDate = new Date(state.lastScan.timestamp);
|
|
2530
2558
|
const daysAgo = Math.floor((Date.now() - lastScanDate.getTime()) / (1e3 * 60 * 60 * 24));
|
|
@@ -2839,7 +2867,6 @@ var isEntryPoint = (() => {
|
|
|
2839
2867
|
const entry = process.argv[1];
|
|
2840
2868
|
if (!entry) return false;
|
|
2841
2869
|
try {
|
|
2842
|
-
const { realpathSync } = __require("fs");
|
|
2843
2870
|
const realEntry = realpathSync(entry);
|
|
2844
2871
|
const realThis = fileURLToPath(import.meta.url);
|
|
2845
2872
|
return realEntry === realThis;
|