skill-autoroute 0.11.1 → 0.11.2
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 +2 -1
- package/package.json +1 -1
- package/src/flow.js +17 -4
package/README.md
CHANGED
|
@@ -168,7 +168,8 @@ The optional AI scan can make a result stricter. It can never clear a high findi
|
|
|
168
168
|
- A scan is marked **partial scan** when a file is unreadable or over 1 MB, a link points outside the folder, the skill
|
|
169
169
|
has `node_modules` or `.git` (never read), or the AI input is cut (about 60,000 characters).
|
|
170
170
|
- A security skill that quotes attack phrases as examples is still flagged. Turn it back on with
|
|
171
|
-
`set <skill> on`.
|
|
171
|
+
`set <skill> on`. That choice survives a rescan (`regenerate`, `install`) when the skill changes, as long as every
|
|
172
|
+
blocking finding is one you already saw (same rule in the same file). A new kind of finding turns it off again.
|
|
172
173
|
- AI steps send skill text to the provider behind your CLI. Triggers send names and descriptions. The deep scan sends
|
|
173
174
|
up to about 60 KB per skill. Skill text is wrapped as untrusted data.
|
|
174
175
|
- Claude runs with no tools. Codex runs read-only with its shell features off
|
package/package.json
CHANGED
package/src/flow.js
CHANGED
|
@@ -152,6 +152,13 @@ export async function runDedupe(skills, ctx, ui) {
|
|
|
152
152
|
return out;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
+
// Blocking findings as `rule:file` keys. Line numbers are left out: they move with every edit to the file.
|
|
156
|
+
const blockKeys = (scan) => [...new Set((scan?.findings ?? []).filter((f) => f.severity === 'high').map((f) => `${f.rule}:${f.file}`))];
|
|
157
|
+
// A blocked skill starts off, so an old entry that is on and blocked was turned on by the user. A rescan keeps that
|
|
158
|
+
// choice while every blocking finding is one the user already saw (same rule in the same file); a new one turns it off.
|
|
159
|
+
export const userAccepted = (was, scan) => Boolean(was?.enabled) && was.scan?.verdict === 'block' && scan?.verdict === 'block'
|
|
160
|
+
&& blockKeys(scan).every((k) => blockKeys(was.scan).includes(k));
|
|
161
|
+
|
|
155
162
|
export function buildRows(skills, scans, dupes = new Map()) {
|
|
156
163
|
return skills.map((skill) => {
|
|
157
164
|
const scan = scans.get(skill.skillPath);
|
|
@@ -311,11 +318,15 @@ export async function install(o, ui) {
|
|
|
311
318
|
if (o.dryRun) return dryRun(ctx, skills, ui);
|
|
312
319
|
preflight(scope, tools); // fail before spending AI calls
|
|
313
320
|
const scans = await runScans(skills, ctx, ui);
|
|
314
|
-
const
|
|
321
|
+
const before = readTable(routesPath(scope));
|
|
322
|
+
const prior = new Map((before?.skills ?? []).map((s) => [s.path, s]));
|
|
323
|
+
const rows = await pickRows(buildRows(skills, scans, await runDedupe(skills, ctx, ui)).map((r) => (
|
|
324
|
+
!r.enabled && !r.dup?.of && userAccepted(prior.get(keyOf(scope)(r.skill.skillPath)), r.scan)
|
|
325
|
+
? { ...r, enabled: true, text: `${r.text} · kept on (you turned it on with these findings)` } : r)), ui);
|
|
315
326
|
const gen = await generate(rows.filter((r) => r.enabled).map((r) => r.skill), ctx, ui);
|
|
316
327
|
const table = tableOf(ctx, rows.map((r) => entry(r, gen, scope)), roots.map(keyOf(scope)), o.log, ignored.map(keyOf(scope)));
|
|
317
|
-
keepWords(table,
|
|
318
|
-
keepEdited(table,
|
|
328
|
+
keepWords(table, before);
|
|
329
|
+
keepEdited(table, before, ui);
|
|
319
330
|
while (!ui.yes) {
|
|
320
331
|
const p = await ui.text('Preview: type a prompt to see its hints (empty to finish)');
|
|
321
332
|
if (!p) break;
|
|
@@ -355,9 +366,11 @@ export async function regenerate(o, ui) {
|
|
|
355
366
|
const rows = buildRows(fresh, await runScans(fresh, ctx, ui)).map((r) => {
|
|
356
367
|
const w = was(r.skill);
|
|
357
368
|
if (!w) return r;
|
|
358
|
-
const
|
|
369
|
+
const kept = userAccepted(w, r.scan);
|
|
370
|
+
const off = Boolean(w.enabled) && r.scan.verdict === 'block' && !kept; // Ruling R35, unless the user already accepted these findings
|
|
359
371
|
const n = show(r.skill.name);
|
|
360
372
|
if (off) ui.log(`${n} turned off: ${show(label(r.scan))}; run \`npx skill-autoroute set ${n} on\` to override`);
|
|
373
|
+
else if (kept) ui.log(`${n} stays on: you turned it on with the same findings before`);
|
|
361
374
|
return { ...r, enabled: Boolean(w.enabled) && !off, dup: w.duplicateOf ? { of: w.duplicateOf } : undefined };
|
|
362
375
|
});
|
|
363
376
|
const keep = (s) => !edited(was(s)); // rules the user edited are not rewritten
|