@triedotdev/mcp 1.0.166 → 1.0.168
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 +333 -805
- package/dist/chunk-2HF65EHQ.js +311 -0
- package/dist/chunk-2HF65EHQ.js.map +1 -0
- package/dist/{chunk-JNUOW2JS.js → chunk-4MXH2ZPT.js} +12 -12
- package/dist/chunk-4MXH2ZPT.js.map +1 -0
- package/dist/{chunk-LR5M4RTN.js → chunk-575YT2SD.js} +1 -1
- package/dist/chunk-575YT2SD.js.map +1 -0
- package/dist/{chunk-ZKKKLRZZ.js → chunk-5BRRRTN6.js} +4 -4
- package/dist/{chunk-TQOO6A4G.js → chunk-7WITSO22.js} +3 -3
- package/dist/{chunk-ACU2RJUJ.js → chunk-F6WFNUAY.js} +2 -2
- package/dist/{chunk-VR4VWXXU.js → chunk-G2TGF6TR.js} +9 -2
- package/dist/chunk-G2TGF6TR.js.map +1 -0
- package/dist/{chunk-ZBXW244P.js → chunk-HVCDY3AK.js} +3 -3
- package/dist/chunk-HVCDY3AK.js.map +1 -0
- package/dist/{chunk-HOGKPDZA.js → chunk-LQIMKE3P.js} +678 -151
- package/dist/chunk-LQIMKE3P.js.map +1 -0
- package/dist/{chunk-2Z3TQNNK.js → chunk-MRHKX5M5.js} +3 -3
- package/dist/{chunk-OLNZJ3XV.js → chunk-Q63FFI6D.js} +2 -2
- package/dist/{chunk-S36IO3EE.js → chunk-XE6KQRKZ.js} +9 -8
- package/dist/chunk-XE6KQRKZ.js.map +1 -0
- package/dist/{chunk-GDWA3CH3.js → chunk-XPZZFPBZ.js} +30 -6
- package/dist/chunk-XPZZFPBZ.js.map +1 -0
- package/dist/{chunk-JEZ7XJQN.js → chunk-XTFWT2XM.js} +2 -2
- package/dist/{chunk-UXRW2YSP.js → chunk-YDHUCDHM.js} +18 -112
- package/dist/chunk-YDHUCDHM.js.map +1 -0
- package/dist/{chunk-LG5CBK6A.js → chunk-YZ6Y2H3P.js} +21 -196
- package/dist/chunk-YZ6Y2H3P.js.map +1 -0
- package/dist/{chunk-MVVPJ73K.js → chunk-ZJF5FTBX.js} +126 -358
- package/dist/chunk-ZJF5FTBX.js.map +1 -0
- package/dist/cli/create-agent.js +1 -1
- package/dist/cli/create-agent.js.map +1 -1
- package/dist/cli/main.js +194 -849
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/yolo-daemon.js +15 -14
- package/dist/cli/yolo-daemon.js.map +1 -1
- package/dist/{fast-analyzer-NJQO3TFD.js → fast-analyzer-XXYMOXRK.js} +3 -3
- package/dist/git-EO5SRFMN.js +28 -0
- package/dist/{github-ingester-TFBDUDIY.js → github-ingester-ZOKK6GRS.js} +3 -3
- package/dist/{goal-manager-DVX24UPZ.js → goal-manager-YOB7VWK7.js} +5 -4
- package/dist/{goal-validator-6Y5CDEMJ.js → goal-validator-ULKIBDPX.js} +5 -4
- package/dist/{hypothesis-UKPGOYY2.js → hypothesis-7BFFT5JY.js} +5 -4
- package/dist/index.js +19 -18
- package/dist/index.js.map +1 -1
- package/dist/{issue-store-UZAPI5DU.js → issue-store-ZIRP23EP.js} +4 -3
- package/dist/{ledger-CNFCJKHX.js → ledger-TWZTGDFA.js} +3 -2
- package/dist/{linear-ingester-PLES2BRS.js → linear-ingester-XXPAZZRW.js} +3 -3
- package/dist/{output-manager-JNMEAXFO.js → output-manager-RVJ37XKA.js} +2 -2
- package/dist/server/mcp-server.js +19 -18
- package/dist/{tiered-storage-OP74NPJY.js → tiered-storage-Z3YCR465.js} +2 -2
- package/dist/{trie-agent-6SWUHCVO.js → trie-agent-3YDPEGHJ.js} +9 -8
- package/dist/trie-agent-3YDPEGHJ.js.map +1 -0
- package/package.json +3 -2
- package/dist/chunk-GDWA3CH3.js.map +0 -1
- package/dist/chunk-HOGKPDZA.js.map +0 -1
- package/dist/chunk-JNUOW2JS.js.map +0 -1
- package/dist/chunk-LG5CBK6A.js.map +0 -1
- package/dist/chunk-LR5M4RTN.js.map +0 -1
- package/dist/chunk-MVVPJ73K.js.map +0 -1
- package/dist/chunk-S36IO3EE.js.map +0 -1
- package/dist/chunk-UXRW2YSP.js.map +0 -1
- package/dist/chunk-VR4VWXXU.js.map +0 -1
- package/dist/chunk-ZBXW244P.js.map +0 -1
- /package/dist/{chunk-ZKKKLRZZ.js.map → chunk-5BRRRTN6.js.map} +0 -0
- /package/dist/{chunk-TQOO6A4G.js.map → chunk-7WITSO22.js.map} +0 -0
- /package/dist/{chunk-ACU2RJUJ.js.map → chunk-F6WFNUAY.js.map} +0 -0
- /package/dist/{chunk-2Z3TQNNK.js.map → chunk-MRHKX5M5.js.map} +0 -0
- /package/dist/{chunk-OLNZJ3XV.js.map → chunk-Q63FFI6D.js.map} +0 -0
- /package/dist/{chunk-JEZ7XJQN.js.map → chunk-XTFWT2XM.js.map} +0 -0
- /package/dist/{fast-analyzer-NJQO3TFD.js.map → fast-analyzer-XXYMOXRK.js.map} +0 -0
- /package/dist/{github-ingester-TFBDUDIY.js.map → git-EO5SRFMN.js.map} +0 -0
- /package/dist/{goal-manager-DVX24UPZ.js.map → github-ingester-ZOKK6GRS.js.map} +0 -0
- /package/dist/{goal-validator-6Y5CDEMJ.js.map → goal-manager-YOB7VWK7.js.map} +0 -0
- /package/dist/{hypothesis-UKPGOYY2.js.map → goal-validator-ULKIBDPX.js.map} +0 -0
- /package/dist/{issue-store-UZAPI5DU.js.map → hypothesis-7BFFT5JY.js.map} +0 -0
- /package/dist/{ledger-CNFCJKHX.js.map → issue-store-ZIRP23EP.js.map} +0 -0
- /package/dist/{linear-ingester-PLES2BRS.js.map → ledger-TWZTGDFA.js.map} +0 -0
- /package/dist/{output-manager-JNMEAXFO.js.map → linear-ingester-XXPAZZRW.js.map} +0 -0
- /package/dist/{tiered-storage-OP74NPJY.js.map → output-manager-RVJ37XKA.js.map} +0 -0
- /package/dist/{trie-agent-6SWUHCVO.js.map → tiered-storage-Z3YCR465.js.map} +0 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
// src/agent/git.ts
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
|
|
5
|
+
// src/utils/command-runner.ts
|
|
6
|
+
import { exec, execFile, execSync } from "child_process";
|
|
7
|
+
import { promisify } from "util";
|
|
8
|
+
|
|
9
|
+
// src/utils/audit-logger.ts
|
|
10
|
+
function createAuditEntry(skillName, skillSource, triggeredBy, targetPath) {
|
|
11
|
+
return {
|
|
12
|
+
skillName,
|
|
13
|
+
skillSource,
|
|
14
|
+
triggeredBy,
|
|
15
|
+
targetPath,
|
|
16
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
17
|
+
commands: []
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function completeAuditEntry(entry, success, error) {
|
|
21
|
+
const result = {
|
|
22
|
+
...entry,
|
|
23
|
+
completedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
24
|
+
success
|
|
25
|
+
};
|
|
26
|
+
if (error !== void 0) {
|
|
27
|
+
result.error = error;
|
|
28
|
+
}
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
async function logSkillExecution(_execution) {
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/utils/command-runner.ts
|
|
35
|
+
var execAsync = promisify(exec);
|
|
36
|
+
var execFileAsync = promisify(execFile);
|
|
37
|
+
function redact(text) {
|
|
38
|
+
return text.replace(/\b(AWS|ANTHROPIC|OPENAI|GITHUB)_[A-Z0-9_]*\s*=\s*([^\s"'`]+)/gi, "$1_<REDACTED>=<REDACTED>").replace(/\bBearer\s+[A-Za-z0-9\-._~+/]+=*\b/g, "Bearer <REDACTED>").replace(/\bghp_[A-Za-z0-9]{20,}\b/g, "ghp_<REDACTED>").replace(/\b(?:xox[baprs]-)[A-Za-z0-9-]{10,}\b/g, "<REDACTED_SLACK_TOKEN>").replace(/\bAKIA[0-9A-Z]{16}\b/g, "AKIA<REDACTED>");
|
|
39
|
+
}
|
|
40
|
+
function clampOutput(text, maxChars) {
|
|
41
|
+
if (text.length <= maxChars) return text;
|
|
42
|
+
return text.slice(0, maxChars) + `
|
|
43
|
+
\u2026(truncated ${text.length - maxChars} chars)`;
|
|
44
|
+
}
|
|
45
|
+
function buildCommandRecord(command) {
|
|
46
|
+
return {
|
|
47
|
+
command,
|
|
48
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
async function finalizeAndWrite(entry, cmd, outcome, options) {
|
|
52
|
+
const duration = Date.now() - outcome.startedAt;
|
|
53
|
+
cmd.duration = duration;
|
|
54
|
+
if (outcome.exitCode !== void 0) {
|
|
55
|
+
cmd.exitCode = outcome.exitCode;
|
|
56
|
+
}
|
|
57
|
+
const captureOutput = options?.captureOutput ?? false;
|
|
58
|
+
const redactOutput = options?.redactOutput ?? true;
|
|
59
|
+
const maxOutputChars = options?.maxOutputChars ?? 2e3;
|
|
60
|
+
if (captureOutput) {
|
|
61
|
+
const out = outcome.stdout ?? "";
|
|
62
|
+
const err = outcome.stderr ?? "";
|
|
63
|
+
cmd.stdout = redactOutput ? redact(clampOutput(out, maxOutputChars)) : clampOutput(out, maxOutputChars);
|
|
64
|
+
cmd.stderr = redactOutput ? redact(clampOutput(err, maxOutputChars)) : clampOutput(err, maxOutputChars);
|
|
65
|
+
}
|
|
66
|
+
const completed = completeAuditEntry(entry, outcome.success, outcome.error);
|
|
67
|
+
await logSkillExecution(completed);
|
|
68
|
+
}
|
|
69
|
+
function runShellCommandSync(command, audit, options) {
|
|
70
|
+
const startedAt = Date.now();
|
|
71
|
+
const entry = createAuditEntry(audit.actor, audit.source ?? "trie", audit.triggeredBy, audit.targetPath);
|
|
72
|
+
const cmd = buildCommandRecord(command);
|
|
73
|
+
entry.commands?.push(cmd);
|
|
74
|
+
try {
|
|
75
|
+
const stdout = execSync(command, {
|
|
76
|
+
cwd: options?.cwd,
|
|
77
|
+
timeout: options?.timeoutMs,
|
|
78
|
+
maxBuffer: options?.maxBuffer,
|
|
79
|
+
encoding: "utf-8",
|
|
80
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
81
|
+
});
|
|
82
|
+
void finalizeAndWrite(entry, cmd, { success: true, exitCode: 0, stdout, stderr: "", startedAt }, options);
|
|
83
|
+
return { stdout: stdout ?? "", exitCode: 0 };
|
|
84
|
+
} catch (e) {
|
|
85
|
+
const err = e;
|
|
86
|
+
const stdout = typeof err.stdout === "string" ? err.stdout : "";
|
|
87
|
+
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
88
|
+
const exitCode = typeof err.status === "number" ? err.status : 1;
|
|
89
|
+
void finalizeAndWrite(
|
|
90
|
+
entry,
|
|
91
|
+
cmd,
|
|
92
|
+
{ success: false, exitCode, stdout, stderr, error: err.message, startedAt },
|
|
93
|
+
{ ...options, captureOutput: options?.captureOutput ?? true }
|
|
94
|
+
);
|
|
95
|
+
return { stdout, exitCode };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async function runExecFile(file, args, audit, options) {
|
|
99
|
+
const startedAt = Date.now();
|
|
100
|
+
const command = [file, ...args].join(" ");
|
|
101
|
+
const entry = createAuditEntry(audit.actor, audit.source ?? "trie", audit.triggeredBy, audit.targetPath);
|
|
102
|
+
const cmd = buildCommandRecord(command);
|
|
103
|
+
entry.commands?.push(cmd);
|
|
104
|
+
try {
|
|
105
|
+
const { stdout, stderr } = await execFileAsync(file, args, {
|
|
106
|
+
cwd: options?.cwd,
|
|
107
|
+
timeout: options?.timeoutMs,
|
|
108
|
+
maxBuffer: options?.maxBuffer
|
|
109
|
+
});
|
|
110
|
+
await finalizeAndWrite(entry, cmd, { success: true, exitCode: 0, stdout: String(stdout ?? ""), stderr: String(stderr ?? ""), startedAt }, options);
|
|
111
|
+
return { stdout: String(stdout ?? ""), stderr: String(stderr ?? ""), exitCode: 0 };
|
|
112
|
+
} catch (e) {
|
|
113
|
+
const err = e;
|
|
114
|
+
const stdout = typeof err.stdout === "string" ? err.stdout : "";
|
|
115
|
+
const stderr = typeof err.stderr === "string" ? err.stderr : "";
|
|
116
|
+
const exitCode = typeof err.code === "number" ? err.code : 1;
|
|
117
|
+
await finalizeAndWrite(
|
|
118
|
+
entry,
|
|
119
|
+
cmd,
|
|
120
|
+
{ success: false, exitCode, stdout, stderr, error: err.message, startedAt },
|
|
121
|
+
{ ...options, captureOutput: options?.captureOutput ?? true }
|
|
122
|
+
);
|
|
123
|
+
return { stdout, stderr, exitCode };
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// src/agent/git.ts
|
|
128
|
+
async function execGit(args, cwd) {
|
|
129
|
+
try {
|
|
130
|
+
const { stdout } = await runExecFile(
|
|
131
|
+
"git",
|
|
132
|
+
["-C", cwd, ...args],
|
|
133
|
+
{ actor: "internal:git", triggeredBy: "manual", targetPath: cwd },
|
|
134
|
+
{ maxBuffer: 10 * 1024 * 1024, captureOutput: false }
|
|
135
|
+
);
|
|
136
|
+
return stdout.trim();
|
|
137
|
+
} catch (error) {
|
|
138
|
+
const stderr = error?.stderr?.toString();
|
|
139
|
+
if (stderr?.includes("not a git repository") || stderr?.includes("does not have any commits")) {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
async function ensureRepo(projectPath) {
|
|
146
|
+
const result = await execGit(["rev-parse", "--is-inside-work-tree"], projectPath);
|
|
147
|
+
return result === "true";
|
|
148
|
+
}
|
|
149
|
+
function parseNameStatus(output) {
|
|
150
|
+
return output.split("\n").map((line) => line.trim()).filter(Boolean).map((line) => {
|
|
151
|
+
const parts = line.split(" ");
|
|
152
|
+
const status = parts[0] ?? "";
|
|
153
|
+
const filePath = parts[1] ?? "";
|
|
154
|
+
const oldPath = parts[2];
|
|
155
|
+
const change = { status, path: filePath };
|
|
156
|
+
if (oldPath) change.oldPath = oldPath;
|
|
157
|
+
return change;
|
|
158
|
+
}).filter((entry) => entry.path.length > 0);
|
|
159
|
+
}
|
|
160
|
+
async function getRecentCommits(projectPath, limit) {
|
|
161
|
+
const isRepo = await ensureRepo(projectPath);
|
|
162
|
+
if (!isRepo) return [];
|
|
163
|
+
const output = await execGit(
|
|
164
|
+
["log", `-n`, String(limit), "--pretty=format:%H%x09%an%x09%ad%x09%s", "--date=iso"],
|
|
165
|
+
projectPath
|
|
166
|
+
);
|
|
167
|
+
if (!output) return [];
|
|
168
|
+
return output.split("\n").map((line) => {
|
|
169
|
+
const [hash, author, date, message] = line.split(" ");
|
|
170
|
+
return { hash, author, date, message };
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
async function getLastCommit(projectPath) {
|
|
174
|
+
const commits = await getRecentCommits(projectPath, 1);
|
|
175
|
+
return commits[0] ?? null;
|
|
176
|
+
}
|
|
177
|
+
async function getStagedChanges(projectPath) {
|
|
178
|
+
const isRepo = await ensureRepo(projectPath);
|
|
179
|
+
if (!isRepo) return [];
|
|
180
|
+
const output = await execGit(["diff", "--cached", "--name-status"], projectPath);
|
|
181
|
+
if (!output) return [];
|
|
182
|
+
return parseNameStatus(output);
|
|
183
|
+
}
|
|
184
|
+
async function getUncommittedChanges(projectPath) {
|
|
185
|
+
const isRepo = await ensureRepo(projectPath);
|
|
186
|
+
if (!isRepo) return [];
|
|
187
|
+
const changes = [];
|
|
188
|
+
const unstaged = await execGit(["diff", "--name-status"], projectPath);
|
|
189
|
+
if (unstaged) {
|
|
190
|
+
changes.push(...parseNameStatus(unstaged));
|
|
191
|
+
}
|
|
192
|
+
const untracked = await execGit(["ls-files", "--others", "--exclude-standard"], projectPath);
|
|
193
|
+
if (untracked) {
|
|
194
|
+
changes.push(
|
|
195
|
+
...untracked.split("\n").map((p) => p.trim()).filter(Boolean).map((p) => ({ status: "??", path: p }))
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
return changes;
|
|
199
|
+
}
|
|
200
|
+
async function getGitChangedFiles(projectPath) {
|
|
201
|
+
const isRepo = await ensureRepo(projectPath);
|
|
202
|
+
if (!isRepo) return null;
|
|
203
|
+
const [staged, uncommitted] = await Promise.all([
|
|
204
|
+
getStagedChanges(projectPath).catch(() => []),
|
|
205
|
+
getUncommittedChanges(projectPath).catch(() => [])
|
|
206
|
+
]);
|
|
207
|
+
const paths = /* @__PURE__ */ new Set();
|
|
208
|
+
for (const change of [...staged, ...uncommitted]) {
|
|
209
|
+
if (change.path) paths.add(change.path);
|
|
210
|
+
if (change.oldPath) paths.add(change.oldPath);
|
|
211
|
+
}
|
|
212
|
+
return [...paths];
|
|
213
|
+
}
|
|
214
|
+
async function getDiff(projectPath, commitHash) {
|
|
215
|
+
const isRepo = await ensureRepo(projectPath);
|
|
216
|
+
if (!isRepo) return "";
|
|
217
|
+
const diff = await execGit(["show", commitHash, "--unified=3", "--no-color"], projectPath);
|
|
218
|
+
return diff ?? "";
|
|
219
|
+
}
|
|
220
|
+
async function getWorkingTreeDiff(projectPath, stagedOnly = false) {
|
|
221
|
+
const isRepo = await ensureRepo(projectPath);
|
|
222
|
+
if (!isRepo) return "";
|
|
223
|
+
const args = stagedOnly ? ["diff", "--cached", "--unified=3", "--no-color"] : ["diff", "--unified=3", "--no-color"];
|
|
224
|
+
const diff = await execGit(args, projectPath);
|
|
225
|
+
return diff ?? "";
|
|
226
|
+
}
|
|
227
|
+
async function getUnpushedCommits(projectPath) {
|
|
228
|
+
const isRepo = await ensureRepo(projectPath);
|
|
229
|
+
if (!isRepo) return [];
|
|
230
|
+
const upstream = await execGit(["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"], projectPath);
|
|
231
|
+
if (!upstream) {
|
|
232
|
+
return getRecentCommits(projectPath, 10);
|
|
233
|
+
}
|
|
234
|
+
const output = await execGit(["log", `${upstream}..HEAD`, "--pretty=format:%H%x09%an%x09%ad%x09%s", "--date=iso"], projectPath);
|
|
235
|
+
if (!output) return [];
|
|
236
|
+
return output.split("\n").filter(Boolean).map((line) => {
|
|
237
|
+
const [hash, author, date, message] = line.split(" ");
|
|
238
|
+
return { hash, author, date, message };
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function resolveRepoPath(projectPath) {
|
|
242
|
+
const gitDir = path.join(projectPath, ".git");
|
|
243
|
+
if (existsSync(gitDir)) return projectPath;
|
|
244
|
+
return projectPath;
|
|
245
|
+
}
|
|
246
|
+
async function isGitRepo(projectPath) {
|
|
247
|
+
const result = await execGit(["rev-parse", "--is-inside-work-tree"], projectPath);
|
|
248
|
+
return result === "true";
|
|
249
|
+
}
|
|
250
|
+
async function getChangedFilesSinceTimestamp(projectPath, timestamp) {
|
|
251
|
+
const isRepo = await isGitRepo(projectPath);
|
|
252
|
+
if (!isRepo) return null;
|
|
253
|
+
try {
|
|
254
|
+
const sinceDate = new Date(timestamp).toISOString();
|
|
255
|
+
const GIT_TIMEOUT_MS = 5e3;
|
|
256
|
+
const startTime = Date.now();
|
|
257
|
+
const committedChangesPromise = execGit(
|
|
258
|
+
["log", `--since=${sinceDate}`, "--name-only", "--pretty=format:"],
|
|
259
|
+
projectPath
|
|
260
|
+
);
|
|
261
|
+
const committedChangesTimeout = new Promise((resolve) => {
|
|
262
|
+
setTimeout(() => resolve(null), GIT_TIMEOUT_MS);
|
|
263
|
+
});
|
|
264
|
+
const committedChanges = await Promise.race([committedChangesPromise, committedChangesTimeout]);
|
|
265
|
+
if (Date.now() - startTime > GIT_TIMEOUT_MS) {
|
|
266
|
+
return null;
|
|
267
|
+
}
|
|
268
|
+
const stagedPromise = execGit(["diff", "--cached", "--name-only"], projectPath);
|
|
269
|
+
const unstagedPromise = execGit(["diff", "--name-only"], projectPath);
|
|
270
|
+
const untrackedPromise = execGit(
|
|
271
|
+
["ls-files", "--others", "--exclude-standard"],
|
|
272
|
+
projectPath
|
|
273
|
+
);
|
|
274
|
+
const timeoutPromise = new Promise((resolve) => {
|
|
275
|
+
setTimeout(() => resolve(null), Math.max(0, GIT_TIMEOUT_MS - (Date.now() - startTime)));
|
|
276
|
+
});
|
|
277
|
+
const [stagedChanges, unstagedChanges, untrackedFiles] = await Promise.race([
|
|
278
|
+
Promise.all([stagedPromise, unstagedPromise, untrackedPromise]),
|
|
279
|
+
timeoutPromise.then(() => [null, null, null])
|
|
280
|
+
]);
|
|
281
|
+
const changedFiles = /* @__PURE__ */ new Set();
|
|
282
|
+
const addFiles = (output) => {
|
|
283
|
+
if (output) {
|
|
284
|
+
output.split("\n").map((f) => f.trim()).filter(Boolean).forEach((f) => changedFiles.add(path.join(projectPath, f)));
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
addFiles(committedChanges);
|
|
288
|
+
addFiles(stagedChanges);
|
|
289
|
+
addFiles(unstagedChanges);
|
|
290
|
+
addFiles(untrackedFiles);
|
|
291
|
+
return Array.from(changedFiles);
|
|
292
|
+
} catch {
|
|
293
|
+
return null;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export {
|
|
298
|
+
runShellCommandSync,
|
|
299
|
+
getRecentCommits,
|
|
300
|
+
getLastCommit,
|
|
301
|
+
getStagedChanges,
|
|
302
|
+
getUncommittedChanges,
|
|
303
|
+
getGitChangedFiles,
|
|
304
|
+
getDiff,
|
|
305
|
+
getWorkingTreeDiff,
|
|
306
|
+
getUnpushedCommits,
|
|
307
|
+
resolveRepoPath,
|
|
308
|
+
isGitRepo,
|
|
309
|
+
getChangedFilesSinceTimestamp
|
|
310
|
+
};
|
|
311
|
+
//# sourceMappingURL=chunk-2HF65EHQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/agent/git.ts","../src/utils/command-runner.ts","../src/utils/audit-logger.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport path from 'node:path';\nimport { runExecFile } from '../utils/command-runner.js';\n\nexport interface Commit {\n hash: string;\n author: string;\n date: string;\n message: string;\n}\n\nexport interface Change {\n path: string;\n status: string;\n oldPath?: string;\n}\n\nasync function execGit(args: string[], cwd: string): Promise<string | null> {\n try {\n const { stdout } = await runExecFile(\n 'git',\n ['-C', cwd, ...args],\n { actor: 'internal:git', triggeredBy: 'manual', targetPath: cwd },\n { maxBuffer: 10 * 1024 * 1024, captureOutput: false }\n );\n return stdout.trim();\n } catch (error: any) {\n const stderr: string | undefined = error?.stderr?.toString();\n // Gracefully handle non-git directories and repos with no commits\n if (stderr?.includes('not a git repository') || stderr?.includes('does not have any commits')) {\n return null;\n }\n throw error;\n }\n}\n\nasync function ensureRepo(projectPath: string): Promise<boolean> {\n const result = await execGit(['rev-parse', '--is-inside-work-tree'], projectPath);\n return result === 'true';\n}\n\nfunction parseNameStatus(output: string): Change[] {\n return output\n .split('\\n')\n .map((line) => line.trim())\n .filter(Boolean)\n .map((line) => {\n const parts = line.split('\\t');\n const status = parts[0] ?? '';\n const filePath = parts[1] ?? '';\n const oldPath = parts[2];\n const change: Change = { status, path: filePath };\n if (oldPath) change.oldPath = oldPath;\n return change;\n })\n .filter((entry) => entry.path.length > 0);\n}\n\nexport async function getRecentCommits(projectPath: string, limit: number): Promise<Commit[]> {\n const isRepo = await ensureRepo(projectPath);\n if (!isRepo) return [];\n\n const output = await execGit(\n ['log', `-n`, String(limit), '--pretty=format:%H%x09%an%x09%ad%x09%s', '--date=iso'],\n projectPath\n );\n\n if (!output) return [];\n\n return output.split('\\n').map((line) => {\n const [hash, author, date, message] = line.split('\\t');\n return { hash, author, date, message } as Commit;\n });\n}\n\nexport async function getLastCommit(projectPath: string): Promise<Commit | null> {\n const commits = await getRecentCommits(projectPath, 1);\n return commits[0] ?? null;\n}\n\nexport async function getStagedChanges(projectPath: string): Promise<Change[]> {\n const isRepo = await ensureRepo(projectPath);\n if (!isRepo) return [];\n\n const output = await execGit(['diff', '--cached', '--name-status'], projectPath);\n if (!output) return [];\n return parseNameStatus(output);\n}\n\nexport async function getUncommittedChanges(projectPath: string): Promise<Change[]> {\n const isRepo = await ensureRepo(projectPath);\n if (!isRepo) return [];\n\n const changes: Change[] = [];\n\n const unstaged = await execGit(['diff', '--name-status'], projectPath);\n if (unstaged) {\n changes.push(...parseNameStatus(unstaged));\n }\n\n const untracked = await execGit(['ls-files', '--others', '--exclude-standard'], projectPath);\n if (untracked) {\n changes.push(\n ...untracked\n .split('\\n')\n .map((p) => p.trim())\n .filter(Boolean)\n .map((p) => ({ status: '??', path: p }))\n );\n }\n\n return changes;\n}\n\n/**\n * Get a flat list of changed file paths in the working tree.\n * Convenience helper used by tooling (e.g. cache invalidation).\n *\n * Returns null if not a git repository.\n */\nexport async function getGitChangedFiles(projectPath: string): Promise<string[] | null> {\n const isRepo = await ensureRepo(projectPath);\n if (!isRepo) return null;\n\n const [staged, uncommitted] = await Promise.all([\n getStagedChanges(projectPath).catch(() => []),\n getUncommittedChanges(projectPath).catch(() => []),\n ]);\n\n const paths = new Set<string>();\n for (const change of [...staged, ...uncommitted]) {\n if (change.path) paths.add(change.path);\n if (change.oldPath) paths.add(change.oldPath);\n }\n\n return [...paths];\n}\n\nexport async function getDiff(projectPath: string, commitHash: string): Promise<string> {\n const isRepo = await ensureRepo(projectPath);\n if (!isRepo) return '';\n\n const diff = await execGit(['show', commitHash, '--unified=3', '--no-color'], projectPath);\n return diff ?? '';\n}\n\nexport async function getWorkingTreeDiff(projectPath: string, stagedOnly = false): Promise<string> {\n const isRepo = await ensureRepo(projectPath);\n if (!isRepo) return '';\n\n const args = stagedOnly ? ['diff', '--cached', '--unified=3', '--no-color'] : ['diff', '--unified=3', '--no-color'];\n const diff = await execGit(args, projectPath);\n return diff ?? '';\n}\n\nexport async function getUnpushedCommits(projectPath: string): Promise<Commit[]> {\n const isRepo = await ensureRepo(projectPath);\n if (!isRepo) return [];\n\n // Handles detached HEAD by falling back to HEAD if upstream missing\n const upstream = await execGit(['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}'], projectPath);\n if (!upstream) {\n return getRecentCommits(projectPath, 10);\n }\n\n const output = await execGit(['log', `${upstream}..HEAD`, '--pretty=format:%H%x09%an%x09%ad%x09%s', '--date=iso'], projectPath);\n if (!output) return [];\n\n return output.split('\\n').filter(Boolean).map((line) => {\n const [hash, author, date, message] = line.split('\\t');\n return { hash, author, date, message } as Commit;\n });\n}\n\nexport function resolveRepoPath(projectPath: string): string {\n const gitDir = path.join(projectPath, '.git');\n if (existsSync(gitDir)) return projectPath;\n return projectPath;\n}\n\n/**\n * Check if the given path is inside a git repository\n */\nexport async function isGitRepo(projectPath: string): Promise<boolean> {\n const result = await execGit(['rev-parse', '--is-inside-work-tree'], projectPath);\n return result === 'true';\n}\n\n/**\n * Get files changed since a given timestamp\n * Uses git log to find commits after timestamp, then gets affected files\n * Returns null if not a git repo or on error\n */\nexport async function getChangedFilesSinceTimestamp(\n projectPath: string,\n timestamp: number\n): Promise<string[] | null> {\n const isRepo = await isGitRepo(projectPath);\n if (!isRepo) return null;\n\n try {\n // Convert timestamp to ISO date for git\n const sinceDate = new Date(timestamp).toISOString();\n \n // Set timeout for git operations (5 seconds total)\n const GIT_TIMEOUT_MS = 5000;\n const startTime = Date.now();\n \n // Get all files that changed in commits since the timestamp\n // Use Promise.race to timeout if git operations take too long\n const committedChangesPromise = execGit(\n ['log', `--since=${sinceDate}`, '--name-only', '--pretty=format:'],\n projectPath\n );\n const committedChangesTimeout = new Promise<string | null>((resolve) => {\n setTimeout(() => resolve(null), GIT_TIMEOUT_MS);\n });\n const committedChanges = await Promise.race([committedChangesPromise, committedChangesTimeout]);\n\n // Check if we've exceeded timeout\n if (Date.now() - startTime > GIT_TIMEOUT_MS) {\n return null;\n }\n\n // Get currently modified files (staged + unstaged) - run in parallel with timeout\n const stagedPromise = execGit(['diff', '--cached', '--name-only'], projectPath);\n const unstagedPromise = execGit(['diff', '--name-only'], projectPath);\n const untrackedPromise = execGit(\n ['ls-files', '--others', '--exclude-standard'],\n projectPath\n );\n \n const timeoutPromise = new Promise<null>((resolve) => {\n setTimeout(() => resolve(null), Math.max(0, GIT_TIMEOUT_MS - (Date.now() - startTime)));\n });\n \n const [stagedChanges, unstagedChanges, untrackedFiles] = await Promise.race([\n Promise.all([stagedPromise, unstagedPromise, untrackedPromise]),\n timeoutPromise.then(() => [null, null, null] as const)\n ]);\n\n // Combine all changed files\n const changedFiles = new Set<string>();\n \n const addFiles = (output: string | null) => {\n if (output) {\n output.split('\\n')\n .map(f => f.trim())\n .filter(Boolean)\n .forEach(f => changedFiles.add(path.join(projectPath, f)));\n }\n };\n\n addFiles(committedChanges);\n addFiles(stagedChanges);\n addFiles(unstagedChanges);\n addFiles(untrackedFiles);\n\n return Array.from(changedFiles);\n } catch {\n return null;\n }\n}\n","/**\n * Command Runner (with audit logging)\n *\n * Goal: Whenever Trie runs a shell command, record:\n * - command string\n * - exit code\n * - duration\n * - optional (redacted) stdout/stderr\n */\nimport { exec, execFile, execSync, type ExecException } from 'node:child_process';\nimport { promisify } from 'node:util';\n\nimport {\n createAuditEntry,\n completeAuditEntry,\n logSkillExecution,\n type ExecutedCommand,\n type SkillExecution,\n} from './audit-logger.js';\n\nconst execAsync = promisify(exec);\nconst execFileAsync = promisify(execFile);\n\nexport type { ExecutedCommand, SkillExecution };\nexport type AuditTriggeredBy = SkillExecution['triggeredBy'];\n\nexport interface CommandAuditContext {\n /** Shown as `skillName` in audit logs; use something like `tool:pr-review` */\n actor: string;\n /** Where this came from in the product flow */\n triggeredBy: AuditTriggeredBy;\n /** Usually the working directory / repo path */\n targetPath: string;\n /** Optional string for `skillSource` */\n source?: string;\n}\n\nexport interface RunCommandOptions {\n cwd?: string;\n timeoutMs?: number;\n maxBuffer?: number;\n\n /** Capture stdout/stderr in the audit log */\n captureOutput?: boolean;\n /** Redact obvious secrets from captured output */\n redactOutput?: boolean;\n /** Max chars to keep per output stream */\n maxOutputChars?: number;\n}\n\nfunction redact(text: string): string {\n // Keep this conservative to avoid false redaction and avoid expensive processing.\n return text\n // Common key=value secrets\n .replace(/\\b(AWS|ANTHROPIC|OPENAI|GITHUB)_[A-Z0-9_]*\\s*=\\s*([^\\s\"'`]+)/gi, '$1_<REDACTED>=<REDACTED>')\n // Bearer tokens\n .replace(/\\bBearer\\s+[A-Za-z0-9\\-._~+/]+=*\\b/g, 'Bearer <REDACTED>')\n // GitHub tokens / generic tokens\n .replace(/\\bghp_[A-Za-z0-9]{20,}\\b/g, 'ghp_<REDACTED>')\n .replace(/\\b(?:xox[baprs]-)[A-Za-z0-9-]{10,}\\b/g, '<REDACTED_SLACK_TOKEN>')\n // AWS access key id (best-effort)\n .replace(/\\bAKIA[0-9A-Z]{16}\\b/g, 'AKIA<REDACTED>');\n}\n\nfunction clampOutput(text: string, maxChars: number): string {\n if (text.length <= maxChars) return text;\n return text.slice(0, maxChars) + `\\n…(truncated ${text.length - maxChars} chars)`;\n}\n\nfunction buildCommandRecord(command: string): ExecutedCommand {\n return {\n command,\n timestamp: new Date().toISOString(),\n };\n}\n\nasync function finalizeAndWrite(\n entry: SkillExecution,\n cmd: ExecutedCommand,\n outcome: { success: boolean; exitCode?: number; stdout?: string; stderr?: string; error?: string; startedAt: number },\n options?: Pick<RunCommandOptions, 'captureOutput' | 'redactOutput' | 'maxOutputChars'>\n): Promise<void> {\n const duration = Date.now() - outcome.startedAt;\n cmd.duration = duration;\n if (outcome.exitCode !== undefined) {\n cmd.exitCode = outcome.exitCode;\n }\n\n const captureOutput = options?.captureOutput ?? false;\n const redactOutput = options?.redactOutput ?? true;\n const maxOutputChars = options?.maxOutputChars ?? 2000;\n\n if (captureOutput) {\n const out = outcome.stdout ?? '';\n const err = outcome.stderr ?? '';\n cmd.stdout = redactOutput ? redact(clampOutput(out, maxOutputChars)) : clampOutput(out, maxOutputChars);\n cmd.stderr = redactOutput ? redact(clampOutput(err, maxOutputChars)) : clampOutput(err, maxOutputChars);\n }\n\n const completed = completeAuditEntry(entry, outcome.success, outcome.error);\n await logSkillExecution(completed);\n}\n\nexport async function runShellCommand(\n command: string,\n audit: CommandAuditContext,\n options?: RunCommandOptions\n): Promise<{ stdout: string; stderr: string; exitCode: number }> {\n const startedAt = Date.now();\n const entry = createAuditEntry(audit.actor, audit.source ?? 'trie', audit.triggeredBy, audit.targetPath);\n const cmd = buildCommandRecord(command);\n entry.commands?.push(cmd);\n\n try {\n const { stdout, stderr } = await execAsync(command, {\n cwd: options?.cwd,\n timeout: options?.timeoutMs,\n maxBuffer: options?.maxBuffer,\n });\n\n await finalizeAndWrite(entry, cmd, { success: true, exitCode: 0, stdout, stderr, startedAt }, options);\n return { stdout: stdout ?? '', stderr: stderr ?? '', exitCode: 0 };\n } catch (e) {\n const err = e as ExecException & { stdout?: unknown; stderr?: unknown; code?: unknown };\n const stdout = typeof err.stdout === 'string' ? err.stdout : '';\n const stderr = typeof err.stderr === 'string' ? err.stderr : '';\n const exitCode = typeof err.code === 'number' ? err.code : 1;\n\n await finalizeAndWrite(\n entry,\n cmd,\n { success: false, exitCode, stdout, stderr, error: err.message, startedAt },\n // Capture output for failures by default (so audits are useful)\n { ...options, captureOutput: options?.captureOutput ?? true }\n );\n\n return { stdout, stderr, exitCode };\n }\n}\n\nexport function runShellCommandSync(\n command: string,\n audit: CommandAuditContext,\n options?: Omit<RunCommandOptions, 'timeoutMs'> & { timeoutMs?: number }\n): { stdout: string; exitCode: number } {\n const startedAt = Date.now();\n const entry = createAuditEntry(audit.actor, audit.source ?? 'trie', audit.triggeredBy, audit.targetPath);\n const cmd = buildCommandRecord(command);\n entry.commands?.push(cmd);\n\n try {\n const stdout = execSync(command, {\n cwd: options?.cwd,\n timeout: options?.timeoutMs,\n maxBuffer: options?.maxBuffer,\n encoding: 'utf-8',\n stdio: ['pipe', 'pipe', 'pipe'],\n });\n\n // Fire-and-forget write; sync APIs can’t await.\n void finalizeAndWrite(entry, cmd, { success: true, exitCode: 0, stdout, stderr: '', startedAt }, options);\n return { stdout: stdout ?? '', exitCode: 0 };\n } catch (e) {\n const err = e as ExecException & { stdout?: unknown; stderr?: unknown; status?: unknown };\n const stdout = typeof err.stdout === 'string' ? err.stdout : '';\n const stderr = typeof err.stderr === 'string' ? err.stderr : '';\n const exitCode = typeof err.status === 'number' ? err.status : 1;\n\n void finalizeAndWrite(\n entry,\n cmd,\n { success: false, exitCode, stdout, stderr, error: err.message, startedAt },\n { ...options, captureOutput: options?.captureOutput ?? true }\n );\n\n return { stdout, exitCode };\n }\n}\n\nexport async function runExecFile(\n file: string,\n args: string[],\n audit: CommandAuditContext,\n options?: Omit<RunCommandOptions, 'timeoutMs'> & { timeoutMs?: number }\n): Promise<{ stdout: string; stderr: string; exitCode: number }> {\n const startedAt = Date.now();\n const command = [file, ...args].join(' ');\n const entry = createAuditEntry(audit.actor, audit.source ?? 'trie', audit.triggeredBy, audit.targetPath);\n const cmd = buildCommandRecord(command);\n entry.commands?.push(cmd);\n\n try {\n const { stdout, stderr } = await execFileAsync(file, args, {\n cwd: options?.cwd,\n timeout: options?.timeoutMs,\n maxBuffer: options?.maxBuffer,\n });\n\n await finalizeAndWrite(entry, cmd, { success: true, exitCode: 0, stdout: String(stdout ?? ''), stderr: String(stderr ?? ''), startedAt }, options);\n return { stdout: String(stdout ?? ''), stderr: String(stderr ?? ''), exitCode: 0 };\n } catch (e) {\n const err = e as ExecException & { stdout?: unknown; stderr?: unknown; code?: unknown };\n const stdout = typeof err.stdout === 'string' ? err.stdout : '';\n const stderr = typeof err.stderr === 'string' ? err.stderr : '';\n const exitCode = typeof err.code === 'number' ? err.code : 1;\n\n await finalizeAndWrite(\n entry,\n cmd,\n { success: false, exitCode, stdout, stderr, error: err.message, startedAt },\n { ...options, captureOutput: options?.captureOutput ?? true }\n );\n return { stdout, stderr, exitCode };\n }\n}\n\n","/**\n * Audit logger stub\n *\n * Audit functionality has been integrated into the decision ledger.\n * This module exists to keep legacy CLI/tooling paths working without the old skills system.\n */\n\nexport interface AuditStatistics {\n totalScans: number;\n totalIssues: number;\n criticalCount: number;\n seriousCount: number;\n moderateCount: number;\n lowCount: number;\n totalExecutions: number;\n successfulExecutions: number;\n failedExecutions: number;\n uniqueSkills: number;\n totalCommands: number;\n blockedCommands: number;\n totalNetworkCalls: number;\n blockedNetworkCalls: number;\n}\n\nexport interface AuditEntry {\n id: string;\n timestamp: string;\n command: string;\n status: string;\n commands?: ExecutedCommand[];\n}\n\nexport interface ExecutedCommand {\n command: string;\n timestamp: string;\n exitCode?: number;\n duration?: number;\n stdout?: string;\n stderr?: string;\n}\n\nexport interface SkillExecution {\n skillName: string;\n skillSource: string;\n triggeredBy: 'scan' | 'mcp' | 'cli' | 'watch' | 'manual';\n targetPath: string;\n startedAt: string;\n completedAt?: string;\n success?: boolean;\n error?: string;\n commands?: ExecutedCommand[];\n}\n\nexport function formatAuditLog(_entry: AuditEntry): string {\n return 'Audit logging has been integrated into the decision ledger';\n}\n\nexport function getAuditStatistics(): AuditStatistics {\n return {\n totalScans: 0,\n totalIssues: 0,\n criticalCount: 0,\n seriousCount: 0,\n moderateCount: 0,\n lowCount: 0,\n totalExecutions: 0,\n successfulExecutions: 0,\n failedExecutions: 0,\n uniqueSkills: 0,\n totalCommands: 0,\n blockedCommands: 0,\n totalNetworkCalls: 0,\n blockedNetworkCalls: 0,\n };\n}\n\nexport function createAuditEntry(\n skillName: string,\n skillSource: string,\n triggeredBy: SkillExecution['triggeredBy'],\n targetPath: string\n): SkillExecution {\n return {\n skillName,\n skillSource,\n triggeredBy,\n targetPath,\n startedAt: new Date().toISOString(),\n commands: [],\n };\n}\n\nexport function completeAuditEntry(\n entry: SkillExecution,\n success: boolean,\n error?: string\n): SkillExecution {\n const result: SkillExecution = {\n ...entry,\n completedAt: new Date().toISOString(),\n success,\n };\n if (error !== undefined) {\n result.error = error;\n }\n return result;\n}\n\nexport async function logSkillExecution(_execution: SkillExecution): Promise<void> {\n // Stub - no-op\n}\n\nexport async function getRecentAuditLogs(_limit: number = 10): Promise<AuditEntry[]> {\n return [];\n}\n\nexport async function getSkillAuditLogs(_skillName: string): Promise<AuditEntry[]> {\n return [];\n}\n\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,OAAO,UAAU;;;ACQjB,SAAS,MAAM,UAAU,gBAAoC;AAC7D,SAAS,iBAAiB;;;AC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;AAAA,MAC7C;AAAA,IACF;AAEA,UAAM,iBAAiB,IAAI,QAAc,CAAC,YAAY;AACpD,iBAAW,MAAM,QAAQ,IAAI,GAAG,KAAK,IAAI,GAAG,kBAAkB,KAAK,IAAI,IAAI,UAAU,CAAC;AAAA,IACxF,CAAC;AAED,UAAM,CAAC,eAAe,iBAAiB,cAAc,IAAI,MAAM,QAAQ,KAAK;AAAA,MAC1E,QAAQ,IAAI,CAAC,eAAe,iBAAiB,gBAAgB,CAAC;AAAA,MAC9D,eAAe,KAAK,MAAM,CAAC,MAAM,MAAM,IAAI,CAAU;AAAA,IACvD,CAAC;AAGD,UAAM,eAAe,oBAAI,IAAY;AAErC,UAAM,WAAW,CAAC,WAA0B;AAC1C,UAAI,QAAQ;AACV,eAAO,MAAM,IAAI,EACd,IAAI,OAAK,EAAE,KAAK,CAAC,EACjB,OAAO,OAAO,EACd,QAAQ,OAAK,aAAa,IAAI,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC;AAAA,MAC7D;AAAA,IACF;AAEA,aAAS,gBAAgB;AACzB,aAAS,aAAa;AACtB,aAAS,eAAe;AACxB,aAAS,cAAc;AAEvB,WAAO,MAAM,KAAK,YAAY;AAAA,EAChC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getGoalManager
|
|
3
|
-
} from "./chunk-2Z3TQNNK.js";
|
|
4
1
|
import {
|
|
5
2
|
getHypothesisEngine
|
|
6
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XTFWT2XM.js";
|
|
4
|
+
import {
|
|
5
|
+
getGoalManager
|
|
6
|
+
} from "./chunk-MRHKX5M5.js";
|
|
7
7
|
import {
|
|
8
8
|
getInsightStore
|
|
9
9
|
} from "./chunk-T63OHG4Q.js";
|
|
@@ -12,13 +12,13 @@ import {
|
|
|
12
12
|
SlackIntegration,
|
|
13
13
|
findCrossProjectPatterns,
|
|
14
14
|
recordToGlobalMemory
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-7WITSO22.js";
|
|
16
16
|
import {
|
|
17
17
|
ContextGraph
|
|
18
18
|
} from "./chunk-VUL52BQL.js";
|
|
19
19
|
import {
|
|
20
20
|
getStorage
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-575YT2SD.js";
|
|
22
22
|
import {
|
|
23
23
|
isAIAvailable,
|
|
24
24
|
runAIAnalysis
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
getIssueHash,
|
|
30
30
|
searchIssues,
|
|
31
31
|
storeIssues
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-XE6KQRKZ.js";
|
|
33
33
|
import {
|
|
34
34
|
getProjectState
|
|
35
35
|
} from "./chunk-GTKYBOXL.js";
|
|
@@ -1120,7 +1120,7 @@ var TrieAgent = class {
|
|
|
1120
1120
|
await this.addInsight(this.createInsight({
|
|
1121
1121
|
type: "observation",
|
|
1122
1122
|
message: `${this.pick(PERSONALITY.greetings)} Issue count has been trending up. Might be worth a focused cleanup session.`,
|
|
1123
|
-
suggestedAction: "Run `trie
|
|
1123
|
+
suggestedAction: "Run `trie watch` to monitor and address issues",
|
|
1124
1124
|
priority: 5,
|
|
1125
1125
|
category: "quality"
|
|
1126
1126
|
}));
|
|
@@ -1220,7 +1220,7 @@ var TrieAgent = class {
|
|
|
1220
1220
|
type: "warning",
|
|
1221
1221
|
message: `Found ${securityIssues.length} security issue${securityIssues.length > 1 ? "s" : ""} that could expose your app.`,
|
|
1222
1222
|
suggestedAction: `Review ${affectedFiles.length} file${affectedFiles.length > 1 ? "s" : ""} immediately`,
|
|
1223
|
-
actionCommand: "trie
|
|
1223
|
+
actionCommand: "trie check",
|
|
1224
1224
|
priority: 10,
|
|
1225
1225
|
category: "security",
|
|
1226
1226
|
relatedIssues: securityIssues.map((i) => i.id),
|
|
@@ -1581,13 +1581,13 @@ var TrieAgent = class {
|
|
|
1581
1581
|
await this.projectState.recordScan();
|
|
1582
1582
|
try {
|
|
1583
1583
|
const riskLevel = issues.filter((i) => i.severity === "critical").length > 0 ? "critical" : issues.filter((i) => i.severity === "serious").length >= 3 ? "high" : issues.length > 10 ? "medium" : "low";
|
|
1584
|
-
const { calculateAdaptiveScanFrequency } = await import("./goal-manager-
|
|
1584
|
+
const { calculateAdaptiveScanFrequency } = await import("./goal-manager-YOB7VWK7.js");
|
|
1585
1585
|
const result = await calculateAdaptiveScanFrequency(riskLevel);
|
|
1586
1586
|
await this.projectState.setScanFrequency(result.frequencyMs);
|
|
1587
1587
|
} catch {
|
|
1588
1588
|
}
|
|
1589
1589
|
try {
|
|
1590
|
-
const { getStorage: getStorage2 } = await import("./tiered-storage-
|
|
1590
|
+
const { getStorage: getStorage2 } = await import("./tiered-storage-Z3YCR465.js");
|
|
1591
1591
|
const storage = getStorage2(this.projectPath);
|
|
1592
1592
|
const resolvedIssueIds = [...this.lastIssueHashes].filter((h) => !currentHashes.has(h)).map((h) => {
|
|
1593
1593
|
return h.split(":").join("-");
|
|
@@ -1824,4 +1824,4 @@ export {
|
|
|
1824
1824
|
TrieAgent,
|
|
1825
1825
|
getTrieAgent
|
|
1826
1826
|
};
|
|
1827
|
-
//# sourceMappingURL=chunk-
|
|
1827
|
+
//# sourceMappingURL=chunk-4MXH2ZPT.js.map
|