@deepwissen/preflight 0.0.0-stage → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +103 -2
- package/dist/bin.js +4 -0
- package/dist/bin.js.map +1 -0
- package/dist/bundle.js +97 -0
- package/dist/bundle.js.map +1 -0
- package/dist/cli.js +454 -0
- package/dist/cli.js.map +1 -0
- package/dist/collisions.js +97 -0
- package/dist/collisions.js.map +1 -0
- package/dist/discover.js +115 -0
- package/dist/discover.js.map +1 -0
- package/dist/health.js +47 -0
- package/dist/health.js.map +1 -0
- package/dist/hooks.js +296 -0
- package/dist/hooks.js.map +1 -0
- package/dist/install.js +159 -0
- package/dist/install.js.map +1 -0
- package/dist/manifest.js +174 -0
- package/dist/manifest.js.map +1 -0
- package/dist/plugins.js +106 -0
- package/dist/plugins.js.map +1 -0
- package/dist/render.js +377 -0
- package/dist/render.js.map +1 -0
- package/dist/sarif.js +40 -0
- package/dist/sarif.js.map +1 -0
- package/dist/scan.js +175 -0
- package/dist/scan.js.map +1 -0
- package/dist/scopes.js +93 -0
- package/dist/scopes.js.map +1 -0
- package/package.json +45 -4
package/dist/render.js
ADDED
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { flatFindings } from "./manifest.js";
|
|
2
|
+
import { detectCollisions, detectAmbiguities, analyzeConflicts } from "./collisions.js";
|
|
3
|
+
import { skillHealth } from "./health.js";
|
|
4
|
+
function hmark(s) {
|
|
5
|
+
return s === "ok" ? "✓" : s === "warn" ? "⚠" : "✗";
|
|
6
|
+
}
|
|
7
|
+
/** A numbered, choose-by-number list of skills found in a source — each with its
|
|
8
|
+
* risk and per-prompt cost, so the user picks informed (e.g. "1,4,6"). */
|
|
9
|
+
export function renderPickList(items, label) {
|
|
10
|
+
const nameW = Math.max(4, ...items.map((i) => i.name.length));
|
|
11
|
+
const scopeW = Math.max(10, ...items.map((i) => i.row.scopeLabel.length));
|
|
12
|
+
const L = [`Skills in ${label} (${items.length} found):`, ""];
|
|
13
|
+
items.forEach((it, i) => {
|
|
14
|
+
const r = it.row;
|
|
15
|
+
const check = r.errorCount ? `✗ ${r.errorCount}` : r.warnCount ? `⚠ ${r.warnCount}` : "✓";
|
|
16
|
+
L.push(` ${String(i + 1).padStart(3)} ${pad(it.name, nameW)} ${pad(r.scopeLabel, scopeW)} ${pad(check, 5)} ${tok(r.alwaysTokens)}t/prompt`);
|
|
17
|
+
});
|
|
18
|
+
return L.join("\n");
|
|
19
|
+
}
|
|
20
|
+
function tok(n) {
|
|
21
|
+
return n >= 1000 ? `${(n / 1000).toFixed(1)}k` : `${n}`;
|
|
22
|
+
}
|
|
23
|
+
function bytes(n) {
|
|
24
|
+
return n >= 1024 ? `${(n / 1024).toFixed(1)} kB` : `${n} B`;
|
|
25
|
+
}
|
|
26
|
+
function pad(s, w) {
|
|
27
|
+
return s.length >= w ? s.slice(0, w) : s + " ".repeat(w - s.length);
|
|
28
|
+
}
|
|
29
|
+
// Unified per-skill status vocabulary used everywhere: ✓ clean · ⚠ N · ✗ N.
|
|
30
|
+
function checkLabel(r) {
|
|
31
|
+
const total = r.errorCount + r.warnCount;
|
|
32
|
+
if (r.errorCount)
|
|
33
|
+
return `✗ ${total} issue${total > 1 ? "s" : ""}`;
|
|
34
|
+
if (r.warnCount)
|
|
35
|
+
return `⚠ ${total} issue${total > 1 ? "s" : ""}`;
|
|
36
|
+
return "✓ clean";
|
|
37
|
+
}
|
|
38
|
+
/** One-line, answer-first summary for list/manifest: mark + counts + per-prompt cost. */
|
|
39
|
+
export function summaryLine(report) {
|
|
40
|
+
const rows = report.rows;
|
|
41
|
+
const cfgErr = report.settingsRisks.filter((h) => h.severity === "error").length;
|
|
42
|
+
const cfgWarn = report.settingsRisks.filter((h) => h.severity === "warning").length;
|
|
43
|
+
const cfgIssues = cfgErr + cfgWarn;
|
|
44
|
+
const ctxErr = report.contextFiles.reduce((n, c) => n + c.errorCount, 0);
|
|
45
|
+
const ctxIssues = report.contextFiles.reduce((n, c) => n + c.errorCount + c.warnCount, 0);
|
|
46
|
+
if (rows.length === 0 && cfgIssues === 0 && ctxIssues === 0)
|
|
47
|
+
return "✓ no skills";
|
|
48
|
+
const need = rows.filter((r) => flatFindings(r).length > 0).length;
|
|
49
|
+
const conflicts = detectCollisions(rows).length + detectAmbiguities(rows).length;
|
|
50
|
+
const anyErr = rows.some((r) => r.errorCount > 0) || cfgErr > 0 || ctxErr > 0;
|
|
51
|
+
const mark = anyErr ? "✗" : need || conflicts || cfgIssues || ctxIssues ? "⚠" : "✓";
|
|
52
|
+
const parts = [`${rows.length} skill${rows.length === 1 ? "" : "s"}`];
|
|
53
|
+
if (need)
|
|
54
|
+
parts.push(`${need} need${need === 1 ? "s" : ""} attention`);
|
|
55
|
+
else if (!conflicts && !cfgIssues && !ctxIssues)
|
|
56
|
+
parts.push("all clean");
|
|
57
|
+
if (conflicts)
|
|
58
|
+
parts.push(`${conflicts} conflict${conflicts === 1 ? "" : "s"}`);
|
|
59
|
+
if (cfgIssues)
|
|
60
|
+
parts.push(`${cfgIssues} config issue${cfgIssues === 1 ? "" : "s"}`);
|
|
61
|
+
if (ctxIssues)
|
|
62
|
+
parts.push(`${ctxIssues} context issue${ctxIssues === 1 ? "" : "s"}`);
|
|
63
|
+
parts.push(`~${tok(report.alwaysTotal)}t/prompt`);
|
|
64
|
+
return `${mark} ${parts.join(" · ")}`;
|
|
65
|
+
}
|
|
66
|
+
/** The "ALWAYS-ON CONTEXT" block — CLAUDE.md + .claude/rules/*.md the agent reads
|
|
67
|
+
* every session. Shows each file's token cost (the visibility) and any injection
|
|
68
|
+
* findings. Clean files are listed too — the cost itself is the point. */
|
|
69
|
+
function contextSection(report) {
|
|
70
|
+
if (report.contextFiles.length === 0)
|
|
71
|
+
return [];
|
|
72
|
+
const flagged = report.contextFiles.filter((c) => c.errorCount || c.warnCount).length;
|
|
73
|
+
const total = report.contextFiles.reduce((n, c) => n + c.alwaysTokens, 0);
|
|
74
|
+
const L = [
|
|
75
|
+
"",
|
|
76
|
+
`ALWAYS-ON CONTEXT — files your agent reads every session (~${tok(total)}t${flagged ? `, ${flagged} flagged` : ""})`,
|
|
77
|
+
];
|
|
78
|
+
for (const c of report.contextFiles) {
|
|
79
|
+
const worst = c.errorCount ? "✗" : c.warnCount ? "⚠" : c.findings.length ? "ℹ" : "·";
|
|
80
|
+
L.push("", ` ${worst} ${c.path} ~${tok(c.alwaysTokens)}t (${c.kind})`);
|
|
81
|
+
for (const f of c.findings)
|
|
82
|
+
L.push(` • [${f.severity}] ${f.message}${f.line ? ` (line ${f.line})` : ""}`);
|
|
83
|
+
}
|
|
84
|
+
return L;
|
|
85
|
+
}
|
|
86
|
+
/** The "CONFIG & HOOKS" block — settings.json things your agent loads automatically
|
|
87
|
+
* (hooks, apiKeyHelper, env, permissions, marketplaces). Grouped by file, worst-
|
|
88
|
+
* severity marker per file. Empty when no settings risks found. */
|
|
89
|
+
function configSection(report) {
|
|
90
|
+
if (report.settingsRisks.length === 0)
|
|
91
|
+
return [];
|
|
92
|
+
const byFile = new Map();
|
|
93
|
+
for (const h of report.settingsRisks) {
|
|
94
|
+
const list = byFile.get(h.file) ?? [];
|
|
95
|
+
list.push(h);
|
|
96
|
+
byFile.set(h.file, list);
|
|
97
|
+
}
|
|
98
|
+
const risky = report.settingsRisks.filter((h) => h.severity !== "info").length;
|
|
99
|
+
const L = ["", `CONFIG & HOOKS — settings your agent loads automatically${risky ? ` (${risky} risky)` : ""}`];
|
|
100
|
+
for (const [file, fs] of byFile) {
|
|
101
|
+
const worst = fs.some((f) => f.severity === "error") ? "✗" : fs.some((f) => f.severity === "warning") ? "⚠" : "ℹ";
|
|
102
|
+
L.push("", ` ${worst} ${file}`);
|
|
103
|
+
for (const f of fs)
|
|
104
|
+
L.push(` • [${f.severity}] ${f.message}${f.line ? ` (line ${f.line})` : ""}`);
|
|
105
|
+
}
|
|
106
|
+
return L;
|
|
107
|
+
}
|
|
108
|
+
/** Render the agent-skill manifest as the human "loadout" screen. */
|
|
109
|
+
export function renderManifest(report) {
|
|
110
|
+
const { rows } = report;
|
|
111
|
+
if (rows.length === 0 && report.settingsRisks.length === 0 && report.contextFiles.length === 0) {
|
|
112
|
+
return `Preflight · manifest\n${report.root}\n\nNo agent skills found (.claude/skills, commands, agents, or SKILL.md).`;
|
|
113
|
+
}
|
|
114
|
+
if (rows.length === 0) {
|
|
115
|
+
// No skills, but context/settings risks are present — still worth surfacing.
|
|
116
|
+
return [`preflight · ${summaryLine(report)}`, report.root, ...contextSection(report), ...configSection(report), ""].join("\n");
|
|
117
|
+
}
|
|
118
|
+
const nameW = Math.max(6, ...rows.map((r) => (r.name ?? r.path).length));
|
|
119
|
+
const scopeW = Math.max(14, ...rows.map((r) => r.scopeLabel.length));
|
|
120
|
+
const showWhere = rows.some((r) => r.origin);
|
|
121
|
+
const whereHdr = showWhere ? `${pad("WHERE", 8)} ` : "";
|
|
122
|
+
const L = [];
|
|
123
|
+
L.push(`preflight · ${summaryLine(report)}`);
|
|
124
|
+
L.push(report.root);
|
|
125
|
+
L.push("");
|
|
126
|
+
L.push("AGENT LOADOUT — what your agent is carrying");
|
|
127
|
+
L.push(` ${pad("SKILL", nameW)} ${pad("SCOPE", scopeW)} ${whereHdr}${pad("ALWAYS", 7)} ${pad("ON-DEMAND", 9)} CHECK`);
|
|
128
|
+
L.push(` ${"─".repeat(nameW + scopeW + (showWhere ? 10 : 0) + 7 + 9 + 6 + 12)}`);
|
|
129
|
+
for (const r of rows) {
|
|
130
|
+
const flag = r.errorCount ? " ⚠" : " ";
|
|
131
|
+
const where = showWhere ? `${pad(r.origin ?? "", 8)} ` : "";
|
|
132
|
+
L.push(` ${pad((r.name ?? r.path) + flag, nameW + 2)}${pad(r.scopeLabel, scopeW)} ${where}${pad(tok(r.alwaysTokens) + "t", 7)} ${pad(tok(r.onDemandTokens) + "t", 9)} ${checkLabel(r)}`);
|
|
133
|
+
}
|
|
134
|
+
L.push("");
|
|
135
|
+
L.push(` always-on footprint ~${tok(report.alwaysTotal)}t every prompt (${rows.length} skill description${rows.length > 1 ? "s" : ""})`);
|
|
136
|
+
L.push(` full-load footprint ~${tok(report.onDemandTotal)}t if every body loads`);
|
|
137
|
+
const flagged = rows.filter((r) => flatFindings(r).length > 0);
|
|
138
|
+
if (flagged.length) {
|
|
139
|
+
L.push("");
|
|
140
|
+
L.push(`NEEDS ATTENTION (${flagged.length})`);
|
|
141
|
+
for (const r of flagged) {
|
|
142
|
+
L.push("");
|
|
143
|
+
L.push(` ${r.errorCount ? "✗" : "⚠"} ${r.name ?? r.path} ${r.path}`);
|
|
144
|
+
for (const { file, finding: f } of flatFindings(r)) {
|
|
145
|
+
const where = file !== r.path ? `${file}: ` : "";
|
|
146
|
+
L.push(` • [${f.severity}] ${where}${f.message}${f.line ? ` (line ${f.line})` : ""}`);
|
|
147
|
+
}
|
|
148
|
+
L.push(` → preflight check ${r.name ?? r.path}`);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const clean = rows.filter((r) => flatFindings(r).length === 0).map((r) => r.name ?? r.path);
|
|
152
|
+
if (clean.length) {
|
|
153
|
+
L.push("");
|
|
154
|
+
L.push(`CLEAN (${clean.length}) ${clean.join(" · ")}`);
|
|
155
|
+
}
|
|
156
|
+
const collisions = detectCollisions(rows);
|
|
157
|
+
const ambiguities = detectAmbiguities(rows);
|
|
158
|
+
if (collisions.length || ambiguities.length) {
|
|
159
|
+
L.push("");
|
|
160
|
+
L.push(`CONFLICTS (${collisions.length + ambiguities.length})`);
|
|
161
|
+
for (const c of collisions) {
|
|
162
|
+
L.push("");
|
|
163
|
+
if (c.sameScope) {
|
|
164
|
+
L.push(` ⚠ ${c.shadowed.length} skills named "${c.name}" in the same scope — resolution is unspecified`);
|
|
165
|
+
for (const s of c.shadowed)
|
|
166
|
+
L.push(` ${s.path}`);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
const losers = c.shadowed.map((s) => s.origin).join("/");
|
|
170
|
+
L.push(` ⚠ name "${c.name}" — ${c.winner.origin} shadows ${losers} (only the ${c.winner.origin} one runs)`);
|
|
171
|
+
L.push(` wins: ${c.winner.path} (${c.winner.origin})`);
|
|
172
|
+
for (const s of c.shadowed)
|
|
173
|
+
L.push(` shadowed: ${s.path} (${s.origin})`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
for (const a of ambiguities) {
|
|
177
|
+
L.push("");
|
|
178
|
+
L.push(` ⚠ "${a.a.name}" ↔ "${a.b.name}" — overlapping descriptions (${Math.round(a.similarity * 100)}%); the agent may pick either`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
L.push(...contextSection(report));
|
|
182
|
+
L.push(...configSection(report));
|
|
183
|
+
L.push("");
|
|
184
|
+
L.push("─".repeat(78));
|
|
185
|
+
L.push("Footprint is static (descriptions load always, bodies on demand — not every");
|
|
186
|
+
L.push("prompt). Scope is what each skill DECLARES; prose can instruct more. Checks find");
|
|
187
|
+
L.push("known-bad patterns — they don't certify a skill safe.");
|
|
188
|
+
return L.join("\n");
|
|
189
|
+
}
|
|
190
|
+
/** Render the installed-plugin audit. */
|
|
191
|
+
export function renderPlugins(plugins) {
|
|
192
|
+
if (plugins.length === 0)
|
|
193
|
+
return "No installed plugins found (~/.claude/plugins).";
|
|
194
|
+
const need = plugins.filter((p) => p.errorCount || p.warnCount).length;
|
|
195
|
+
const mark = plugins.some((p) => p.errorCount) ? "✗" : need ? "⚠" : "✓";
|
|
196
|
+
const markets = [...new Set(plugins.map((p) => p.marketplace))];
|
|
197
|
+
const L = [
|
|
198
|
+
`preflight · ${mark} ${plugins.length} plugin${plugins.length === 1 ? "" : "s"} · ${need ? `${need} need${need === 1 ? "s" : ""} attention` : "all clean"} · ${markets.length} marketplace${markets.length === 1 ? "" : "s"}`,
|
|
199
|
+
"",
|
|
200
|
+
];
|
|
201
|
+
const nameW = Math.max(6, ...plugins.map((p) => p.name.length));
|
|
202
|
+
const srcW = Math.max(8, ...plugins.map((p) => p.source.length));
|
|
203
|
+
L.push("INSTALLED PLUGINS");
|
|
204
|
+
for (const p of plugins) {
|
|
205
|
+
const bundles = [
|
|
206
|
+
p.skills ? `${p.skills} skill${p.skills === 1 ? "" : "s"}` : "",
|
|
207
|
+
p.commands ? `${p.commands} cmd` : "",
|
|
208
|
+
p.hasMcp ? "MCP" : "",
|
|
209
|
+
p.hasHooks ? "hooks" : "",
|
|
210
|
+
]
|
|
211
|
+
.filter(Boolean)
|
|
212
|
+
.join(" · ");
|
|
213
|
+
const check = p.errorCount
|
|
214
|
+
? `✗ ${p.errorCount + p.warnCount}`
|
|
215
|
+
: p.warnCount
|
|
216
|
+
? `⚠ ${p.warnCount}`
|
|
217
|
+
: "✓ clean";
|
|
218
|
+
L.push(` ${pad(p.name, nameW)} ${pad(p.source, srcW)} ${pad(bundles, 22)} ${check}`);
|
|
219
|
+
}
|
|
220
|
+
const flagged = plugins.filter((p) => p.errorCount || p.warnCount);
|
|
221
|
+
if (flagged.length) {
|
|
222
|
+
L.push("");
|
|
223
|
+
L.push(`NEEDS ATTENTION (${flagged.length})`);
|
|
224
|
+
for (const p of flagged) {
|
|
225
|
+
L.push("");
|
|
226
|
+
L.push(` ${p.errorCount ? "✗" : "⚠"} ${p.name} (${p.source})`);
|
|
227
|
+
// show the real findings, not the info-level "runs hooks on …" transparency line
|
|
228
|
+
for (const { file, finding: f } of p.findings.filter((x) => x.finding.severity !== "info")) {
|
|
229
|
+
L.push(` • [${f.severity}] ${file}: ${f.message}${f.line ? ` (line ${f.line})` : ""}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
L.push("");
|
|
234
|
+
L.push("─".repeat(78));
|
|
235
|
+
L.push("Audits bundled skills, MCP configs, and hooks (incl. the scripts hooks invoke).");
|
|
236
|
+
L.push("Loose scripts not reached by a skill or hook may be unscanned; a clean scan means");
|
|
237
|
+
L.push("no known-bad patterns were found — not a guarantee the plugin is safe.");
|
|
238
|
+
return L.join("\n");
|
|
239
|
+
}
|
|
240
|
+
/** Compact one-line-per-skill listing of what's installed. */
|
|
241
|
+
export function renderList(report) {
|
|
242
|
+
const { rows } = report;
|
|
243
|
+
if (rows.length === 0)
|
|
244
|
+
return "No agent skills installed.";
|
|
245
|
+
const nameW = Math.max(4, ...rows.map((r) => (r.name ?? r.path).length));
|
|
246
|
+
const scopeW = Math.max(10, ...rows.map((r) => r.scopeLabel.length));
|
|
247
|
+
const showWhere = rows.some((r) => r.origin);
|
|
248
|
+
const lines = [`preflight · ${summaryLine(report)}`, ""];
|
|
249
|
+
for (const r of rows) {
|
|
250
|
+
const where = showWhere ? `${pad(r.origin ?? "", 8)} ` : "";
|
|
251
|
+
lines.push(` ${pad(r.name ?? r.path, nameW)} ${pad(r.scopeLabel, scopeW)} ${where}${checkLabel(r)}`);
|
|
252
|
+
}
|
|
253
|
+
const nConflict = detectCollisions(rows).length + detectAmbiguities(rows).length;
|
|
254
|
+
if (nConflict) {
|
|
255
|
+
lines.push("", ` ⚠ ${nConflict} conflict(s) — run \`preflight manifest${showWhere ? " --all" : ""}\` for details`);
|
|
256
|
+
}
|
|
257
|
+
return lines.join("\n");
|
|
258
|
+
}
|
|
259
|
+
/** Render a single skill's detailed check view (the manifest drill-in). */
|
|
260
|
+
export function renderCheck(row) {
|
|
261
|
+
const s = row.scope;
|
|
262
|
+
const L = [];
|
|
263
|
+
L.push(`Preflight · check — ${row.name ?? row.path}`);
|
|
264
|
+
L.push(row.path);
|
|
265
|
+
L.push("");
|
|
266
|
+
L.push(` ${row.name ?? row.path}${s.description ? ` — ${s.description}` : ""}`);
|
|
267
|
+
const health = skillHealth(row);
|
|
268
|
+
const vmark = health.verdict === "healthy" ? "✓" : health.verdict === "needs attention" ? "⚠" : "✗";
|
|
269
|
+
L.push("");
|
|
270
|
+
L.push(`HEALTH: ${vmark} ${health.verdict}`);
|
|
271
|
+
for (const d of health.dims) {
|
|
272
|
+
L.push(` ${hmark(d.status)} ${pad(d.key, 9)} ${d.note}`);
|
|
273
|
+
}
|
|
274
|
+
L.push("");
|
|
275
|
+
L.push("SCOPE (declared)");
|
|
276
|
+
if (!s.declaredTools) {
|
|
277
|
+
L.push(" (no allowed-tools — may inherit the session's full tool access)");
|
|
278
|
+
}
|
|
279
|
+
else {
|
|
280
|
+
L.push(` tools: ${s.tools.map((t) => t.raw).join(", ") || "(none)"}`);
|
|
281
|
+
if (s.broad) {
|
|
282
|
+
L.push(` ⚠ broad: ${s.broadGrants.join(", ")} — unrestricted; can act beyond this skill's job`);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
if (s.mcpServers.length)
|
|
286
|
+
L.push(` MCP: ${s.mcpServers.join(", ")}`);
|
|
287
|
+
if (s.referencedScripts.length) {
|
|
288
|
+
L.push(` scripts: ${s.referencedScripts.join(", ")} (runs bundled code — review it)`);
|
|
289
|
+
}
|
|
290
|
+
L.push("");
|
|
291
|
+
L.push("FOOTPRINT");
|
|
292
|
+
L.push(` ~${tok(row.alwaysTokens)}t always name + description, loaded every prompt`);
|
|
293
|
+
L.push(` ~${tok(row.onDemandTokens)}t on demand full body, loaded when the skill is invoked`);
|
|
294
|
+
const b = row.bundle;
|
|
295
|
+
if (b.scripts.length || b.otherFiles) {
|
|
296
|
+
L.push("");
|
|
297
|
+
const other = b.otherFiles ? `, ${b.otherFiles} other file${b.otherFiles > 1 ? "s" : ""}` : "";
|
|
298
|
+
L.push(`BUNDLED FILES (${b.scripts.length} scanned${other})`);
|
|
299
|
+
for (const sc of b.scripts) {
|
|
300
|
+
const errs = sc.findings.filter((f) => f.severity === "error").length;
|
|
301
|
+
const st = errs
|
|
302
|
+
? `✗ ${sc.findings.length} issue${sc.findings.length > 1 ? "s" : ""}`
|
|
303
|
+
: sc.findings.length
|
|
304
|
+
? `⚠ ${sc.findings.length} issue${sc.findings.length > 1 ? "s" : ""}`
|
|
305
|
+
: "✓ clean";
|
|
306
|
+
L.push(` ${pad(sc.path, 30)}${pad(bytes(sc.bytes), 9)} ${st}`);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
const flat = flatFindings(row);
|
|
310
|
+
L.push("");
|
|
311
|
+
if (flat.length === 0) {
|
|
312
|
+
L.push("FINDINGS (0)");
|
|
313
|
+
L.push(" ✓ nothing flagged — but a clean scan means nothing was found, not that");
|
|
314
|
+
L.push(" nothing is there; scope above is declared-only.");
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
L.push(`FINDINGS (${flat.length})`);
|
|
318
|
+
for (const { file, finding: f } of flat) {
|
|
319
|
+
const mark = f.severity === "error" ? "✗" : f.severity === "warning" ? "⚠" : "ℹ";
|
|
320
|
+
const where = file !== row.path ? ` in ${file}` : "";
|
|
321
|
+
L.push("");
|
|
322
|
+
L.push(` ${mark} [${f.severity}] ${f.rule}${f.line ? ` (line ${f.line})` : ""}${where}`);
|
|
323
|
+
L.push(` ${f.message}`);
|
|
324
|
+
if (f.suggestion)
|
|
325
|
+
L.push(` → ${f.suggestion}`);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return L.join("\n");
|
|
329
|
+
}
|
|
330
|
+
/** Machine-readable single-skill check. */
|
|
331
|
+
export function renderCheckJson(row) {
|
|
332
|
+
return JSON.stringify({
|
|
333
|
+
path: row.path,
|
|
334
|
+
name: row.name,
|
|
335
|
+
health: skillHealth(row),
|
|
336
|
+
scope: {
|
|
337
|
+
label: row.scopeLabel,
|
|
338
|
+
declaredTools: row.scope.declaredTools,
|
|
339
|
+
tools: row.scope.tools.map((t) => t.raw),
|
|
340
|
+
broad: row.scope.broad,
|
|
341
|
+
broadGrants: row.scope.broadGrants,
|
|
342
|
+
mcpServers: row.scope.mcpServers,
|
|
343
|
+
referencedScripts: row.scope.referencedScripts,
|
|
344
|
+
},
|
|
345
|
+
alwaysTokens: row.alwaysTokens,
|
|
346
|
+
onDemandTokens: row.onDemandTokens,
|
|
347
|
+
findings: row.findings,
|
|
348
|
+
bundle: row.bundle,
|
|
349
|
+
}, null, 2);
|
|
350
|
+
}
|
|
351
|
+
/** Machine-readable manifest. */
|
|
352
|
+
export function renderJson(report) {
|
|
353
|
+
return JSON.stringify({
|
|
354
|
+
root: report.root,
|
|
355
|
+
alwaysTotal: report.alwaysTotal,
|
|
356
|
+
onDemandTotal: report.onDemandTotal,
|
|
357
|
+
conflicts: analyzeConflicts(report.rows),
|
|
358
|
+
skills: report.rows.map((r) => ({
|
|
359
|
+
path: r.path,
|
|
360
|
+
name: r.name,
|
|
361
|
+
scope: {
|
|
362
|
+
label: r.scopeLabel,
|
|
363
|
+
declaredTools: r.scope.declaredTools,
|
|
364
|
+
tools: r.scope.tools.map((t) => t.raw),
|
|
365
|
+
broad: r.scope.broad,
|
|
366
|
+
broadGrants: r.scope.broadGrants,
|
|
367
|
+
mcpServers: r.scope.mcpServers,
|
|
368
|
+
referencedScripts: r.scope.referencedScripts,
|
|
369
|
+
},
|
|
370
|
+
alwaysTokens: r.alwaysTokens,
|
|
371
|
+
onDemandTokens: r.onDemandTokens,
|
|
372
|
+
findings: r.findings,
|
|
373
|
+
bundle: r.bundle,
|
|
374
|
+
})),
|
|
375
|
+
}, null, 2);
|
|
376
|
+
}
|
|
377
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../src/render.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA2D,MAAM,eAAe,CAAC;AACtG,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACxF,OAAO,EAAE,WAAW,EAAqB,MAAM,aAAa,CAAC;AAG7D,SAAS,KAAK,CAAC,CAAe;IAC5B,OAAO,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;AACrD,CAAC;AAED;2EAC2E;AAC3E,MAAM,UAAU,cAAc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,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC9B,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,KAAK,EAAE;gBACL,KAAK,EAAE,CAAC,CAAC,UAAU;gBACnB,aAAa,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa;gBACpC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;gBACtC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK;gBACpB,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW;gBAChC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,UAAU;gBAC9B,iBAAiB,EAAE,CAAC,CAAC,KAAK,CAAC,iBAAiB;aAC7C;YACD,YAAY,EAAE,CAAC,CAAC,YAAY;YAC5B,cAAc,EAAE,CAAC,CAAC,cAAc;YAChC,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,MAAM,EAAE,CAAC,CAAC,MAAM;SACjB,CAAC,CAAC;KACJ,EACD,IAAI,EACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/sarif.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { reportFindings } from "./manifest.js";
|
|
2
|
+
function level(s) {
|
|
3
|
+
return s === "error" ? "error" : s === "warning" ? "warning" : "note";
|
|
4
|
+
}
|
|
5
|
+
/** Minimal SARIF 2.1.0 — consumable by GitHub code scanning for inline PR
|
|
6
|
+
* annotations. Mirrors vet's shape so both tools upload the same way. */
|
|
7
|
+
export function renderManifestSarif(report) {
|
|
8
|
+
const findings = reportFindings(report);
|
|
9
|
+
const ruleIds = [...new Set(findings.map((f) => f.rule))];
|
|
10
|
+
const sarif = {
|
|
11
|
+
$schema: "https://json.schemastore.org/sarif-2.1.0.json",
|
|
12
|
+
version: "2.1.0",
|
|
13
|
+
runs: [
|
|
14
|
+
{
|
|
15
|
+
tool: {
|
|
16
|
+
driver: {
|
|
17
|
+
name: "preflight",
|
|
18
|
+
informationUri: "https://github.com/deepwissen/preflight",
|
|
19
|
+
rules: ruleIds.map((id) => ({ id })),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
results: findings.map((f) => ({
|
|
23
|
+
ruleId: f.rule,
|
|
24
|
+
level: level(f.severity),
|
|
25
|
+
message: { text: f.message },
|
|
26
|
+
locations: [
|
|
27
|
+
{
|
|
28
|
+
physicalLocation: {
|
|
29
|
+
artifactLocation: { uri: f.file },
|
|
30
|
+
...(f.line ? { region: { startLine: f.line } } : {}),
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
})),
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
return JSON.stringify(sarif, null, 2);
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=sarif.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sarif.js","sourceRoot":"","sources":["../src/sarif.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA4C,MAAM,eAAe,CAAC;AAEzF,SAAS,KAAK,CAAC,CAA6B;IAC1C,OAAO,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AACxE,CAAC;AAED;0EAC0E;AAC1E,MAAM,UAAU,mBAAmB,CAAC,MAAsB;IACxD,MAAM,QAAQ,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1D,MAAM,KAAK,GAAG;QACZ,OAAO,EAAE,+CAA+C;QACxD,OAAO,EAAE,OAAO;QAChB,IAAI,EAAE;YACJ;gBACE,IAAI,EAAE;oBACJ,MAAM,EAAE;wBACN,IAAI,EAAE,WAAW;wBACjB,cAAc,EAAE,yCAAyC;wBACzD,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;qBACrC;iBACF;gBACD,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC5B,MAAM,EAAE,CAAC,CAAC,IAAI;oBACd,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;oBACxB,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE;oBAC5B,SAAS,EAAE;wBACT;4BACE,gBAAgB,EAAE;gCAChB,gBAAgB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE;gCACjC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;6BACrD;yBACF;qBACF;iBACF,CAAC,CAAC;aACJ;SACF;KACF,CAAC;IACF,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
package/dist/scan.js
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { scanSecrets, scanInstructionIntegrity, scanSkillScope, scanAgentConfig, scanMcpConfigs, detectTraps, } from "@deepwissen/preflight-core";
|
|
2
|
+
function emptySnapshot() {
|
|
3
|
+
return {
|
|
4
|
+
timestamp: 0,
|
|
5
|
+
activeFile: null,
|
|
6
|
+
selection: null,
|
|
7
|
+
openTabs: [],
|
|
8
|
+
aiInstructionFiles: [],
|
|
9
|
+
mcpConfigFiles: [],
|
|
10
|
+
toolProfile: null,
|
|
11
|
+
ignoreFiles: [],
|
|
12
|
+
referencedFiles: [],
|
|
13
|
+
terminalContent: null,
|
|
14
|
+
clipboardSize: null,
|
|
15
|
+
chatHistoryLength: 0,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function fileInfo(path, content, languageId = "markdown") {
|
|
19
|
+
return {
|
|
20
|
+
path,
|
|
21
|
+
languageId,
|
|
22
|
+
lineCount: content.split("\n").length,
|
|
23
|
+
charCount: content.length,
|
|
24
|
+
isActive: true,
|
|
25
|
+
isDirty: false,
|
|
26
|
+
commentLineCount: 0,
|
|
27
|
+
hasConflictMarkers: false,
|
|
28
|
+
content,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Scan a single skill file for the risks relevant to agent skills: embedded
|
|
33
|
+
* secrets, instruction-integrity (prompt injection, hidden unicode, role-tag
|
|
34
|
+
* spoofing), and over-broad declared tool scope. All detection is the engine's.
|
|
35
|
+
*/
|
|
36
|
+
export function scanSkill(path, content) {
|
|
37
|
+
const snap = emptySnapshot();
|
|
38
|
+
snap.activeFile = fileInfo(path, content);
|
|
39
|
+
snap.aiInstructionFiles = [
|
|
40
|
+
{ path, lineCount: content.split("\n").length, toolId: null, content },
|
|
41
|
+
];
|
|
42
|
+
const out = [];
|
|
43
|
+
for (const f of scanSecrets(snap, {}).secretFindings ?? []) {
|
|
44
|
+
out.push({
|
|
45
|
+
severity: f.severity,
|
|
46
|
+
rule: f.ruleId,
|
|
47
|
+
message: f.description,
|
|
48
|
+
line: f.lineNumber,
|
|
49
|
+
suggestion: f.suggestion,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
for (const i of scanInstructionIntegrity(snap, {}).instructionFileIssues ?? []) {
|
|
53
|
+
out.push({
|
|
54
|
+
severity: i.severity ?? "warning",
|
|
55
|
+
rule: i.issue,
|
|
56
|
+
message: i.description,
|
|
57
|
+
line: i.lineNumber,
|
|
58
|
+
suggestion: i.suggestion,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
for (const i of scanSkillScope(path, content)) {
|
|
62
|
+
out.push({
|
|
63
|
+
severity: i.severity ?? "error",
|
|
64
|
+
rule: i.issue,
|
|
65
|
+
message: i.description,
|
|
66
|
+
line: i.lineNumber,
|
|
67
|
+
suggestion: i.suggestion,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Scan an always-on instruction/context file — CLAUDE.md or a .claude/rules/*.md —
|
|
74
|
+
* for the risks that matter there: embedded secrets and instruction-integrity
|
|
75
|
+
* (prompt injection, hidden unicode, role-tag spoofing). No tool-scope check: these
|
|
76
|
+
* files carry instructions, not tool grants. This is the surface the "rules-file
|
|
77
|
+
* backdoor" hides in — a repo's CLAUDE.md or rule steering the agent on every turn.
|
|
78
|
+
*/
|
|
79
|
+
export function scanInstruction(path, content) {
|
|
80
|
+
const snap = emptySnapshot();
|
|
81
|
+
snap.activeFile = fileInfo(path, content);
|
|
82
|
+
snap.aiInstructionFiles = [{ path, lineCount: content.split("\n").length, toolId: null, content }];
|
|
83
|
+
const out = [];
|
|
84
|
+
for (const f of scanSecrets(snap, {}).secretFindings ?? []) {
|
|
85
|
+
out.push({ severity: f.severity, rule: f.ruleId, message: f.description, line: f.lineNumber, suggestion: f.suggestion });
|
|
86
|
+
}
|
|
87
|
+
for (const i of scanInstructionIntegrity(snap, {}).instructionFileIssues ?? []) {
|
|
88
|
+
out.push({ severity: i.severity ?? "warning", rule: i.issue, message: i.description, line: i.lineNumber, suggestion: i.suggestion });
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
function lineFrom(text) {
|
|
93
|
+
const m = text.match(/\bline (\d+)\b/);
|
|
94
|
+
return m ? Number(m[1]) : undefined;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Scan a bundled script a skill ships (not prose) — hardcoded secrets and
|
|
98
|
+
* trap-file patterns (unsafe deserialization etc.). Instruction-integrity and
|
|
99
|
+
* scope checks do NOT apply: this is code, not an instruction surface.
|
|
100
|
+
*/
|
|
101
|
+
export function scanCode(path, content, languageId) {
|
|
102
|
+
const snap = emptySnapshot();
|
|
103
|
+
snap.activeFile = fileInfo(path, content, languageId);
|
|
104
|
+
const out = [];
|
|
105
|
+
for (const f of scanSecrets(snap, {}).secretFindings ?? []) {
|
|
106
|
+
out.push({
|
|
107
|
+
severity: f.severity,
|
|
108
|
+
rule: f.ruleId,
|
|
109
|
+
message: f.description,
|
|
110
|
+
line: f.lineNumber,
|
|
111
|
+
suggestion: f.suggestion,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
for (const w of detectTraps(snap, {}).wastePatterns ?? []) {
|
|
115
|
+
out.push({
|
|
116
|
+
severity: w.severity === "warning" ? "warning" : "info",
|
|
117
|
+
rule: w.ruleId,
|
|
118
|
+
message: w.description,
|
|
119
|
+
line: lineFrom(w.description),
|
|
120
|
+
suggestion: w.suggestion,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return out;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Scan a settings.json for agent-autonomy risk using the ENGINE's agent-config
|
|
127
|
+
* scanner — the shared source of truth (same detector vet and the extension use).
|
|
128
|
+
* Covers the canonical cases: unrestricted allow (Bash(*)/*), skip-permissions
|
|
129
|
+
* (bypassPermissions), auto-approve edits (acceptEdits), enable-all-MCP. preflight's
|
|
130
|
+
* own scanSettings adds only what the engine doesn't yet cover (apiKeyHelper, env
|
|
131
|
+
* base-URL, marketplaces, deep hook analysis) — no overlap, no double-reporting.
|
|
132
|
+
*/
|
|
133
|
+
export function scanAgentConfigFile(path, content) {
|
|
134
|
+
const snap = emptySnapshot();
|
|
135
|
+
snap.activeFile = fileInfo(path, content, "json");
|
|
136
|
+
// The engine appends " (<path>)" to each description; preflight groups findings by
|
|
137
|
+
// file already, so strip that redundant suffix for a clean message.
|
|
138
|
+
const suffix = ` (${path})`;
|
|
139
|
+
const out = [];
|
|
140
|
+
for (const i of scanAgentConfig(snap, {}).instructionFileIssues ?? []) {
|
|
141
|
+
const message = i.description.endsWith(suffix) ? i.description.slice(0, -suffix.length) : i.description;
|
|
142
|
+
out.push({ severity: i.severity ?? "warning", rule: i.issue, message, line: i.lineNumber, suggestion: i.suggestion });
|
|
143
|
+
}
|
|
144
|
+
return out;
|
|
145
|
+
}
|
|
146
|
+
/** A bundled MCP config file (by name, or any JSON declaring servers). */
|
|
147
|
+
export function looksMcpConfig(path, content) {
|
|
148
|
+
const base = (path.split("/").pop() ?? path).toLowerCase();
|
|
149
|
+
if (/^(\.mcp\.json|mcp\.json|claude_desktop_config\.json)$/.test(base))
|
|
150
|
+
return true;
|
|
151
|
+
return base.endsWith(".json") && (content.includes('"mcpServers"') || content.includes('"servers"'));
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Scan a bundled MCP config for MCP-specific risk (embedded secrets, unpinned
|
|
155
|
+
* servers, injected tool descriptions) plus hardcoded secrets and hidden-unicode
|
|
156
|
+
* payloads in tool descriptions. A skill can ship one of these to wire the agent
|
|
157
|
+
* up to a server — a supply-chain surface the SKILL.md prose hides.
|
|
158
|
+
*/
|
|
159
|
+
export function scanMcpConfig(path, content) {
|
|
160
|
+
const snap = emptySnapshot();
|
|
161
|
+
snap.activeFile = fileInfo(path, content, "json");
|
|
162
|
+
snap.mcpConfigFiles = [{ path, content }];
|
|
163
|
+
const out = [];
|
|
164
|
+
for (const f of scanSecrets(snap, {}).secretFindings ?? []) {
|
|
165
|
+
out.push({ severity: f.severity, rule: f.ruleId, message: f.description, line: f.lineNumber, suggestion: f.suggestion });
|
|
166
|
+
}
|
|
167
|
+
for (const i of scanMcpConfigs(snap, {}).instructionFileIssues ?? []) {
|
|
168
|
+
out.push({ severity: i.severity ?? "warning", rule: i.issue, message: i.description, line: i.lineNumber, suggestion: i.suggestion });
|
|
169
|
+
}
|
|
170
|
+
for (const i of scanInstructionIntegrity(snap, {}).instructionFileIssues ?? []) {
|
|
171
|
+
out.push({ severity: i.severity ?? "warning", rule: i.issue, message: i.description, line: i.lineNumber, suggestion: i.suggestion });
|
|
172
|
+
}
|
|
173
|
+
return out;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=scan.js.map
|
package/dist/scan.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scan.js","sourceRoot":"","sources":["../src/scan.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,cAAc,EACd,eAAe,EACf,cAAc,EACd,WAAW,GAGZ,MAAM,4BAA4B,CAAC;AAUpC,SAAS,aAAa;IACpB,OAAO;QACL,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,EAAE;QACZ,kBAAkB,EAAE,EAAE;QACtB,cAAc,EAAE,EAAE;QAClB,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,EAAE;QACf,eAAe,EAAE,EAAE;QACnB,eAAe,EAAE,IAAI;QACrB,aAAa,EAAE,IAAI;QACnB,iBAAiB,EAAE,CAAC;KACrB,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,OAAe,EAAE,UAAU,GAAG,UAAU;IACtE,OAAO;QACL,IAAI;QACJ,UAAU;QACV,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM;QACrC,SAAS,EAAE,OAAO,CAAC,MAAM;QACzB,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,KAAK;QACd,gBAAgB,EAAE,CAAC;QACnB,kBAAkB,EAAE,KAAK;QACzB,OAAO;KACR,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,OAAe;IACrD,MAAM,IAAI,GAAG,aAAa,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