@agentvibes/guardrails 0.2.0 → 0.2.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/configs/biome.json +1 -1
- package/dist/jsxSuppress.d.ts +3 -0
- package/dist/jsxSuppress.js +75 -0
- package/dist/jsxSuppress.js.map +1 -0
- package/dist/jsxSuppressTest.d.ts +1 -0
- package/dist/jsxSuppressTest.js +89 -0
- package/dist/jsxSuppressTest.js.map +1 -0
- package/dist/verify.js +4 -1
- package/dist/verify.js.map +1 -1
- package/package.json +4 -3
package/configs/biome.json
CHANGED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { isAbsolute, join } from "node:path";
|
|
3
|
+
// JSX suppressions (found while migrating gramforge/gramforge, is-18ff62fb).
|
|
4
|
+
//
|
|
5
|
+
// ast-grep's own `// ast-grep-ignore: <rule> -- <why>` is a line comment on the
|
|
6
|
+
// preceding line. That works everywhere in `.ts`, and in the parts of a `.tsx`
|
|
7
|
+
// file that are ordinary code — but NOT inside JSX children, where `//` is not
|
|
8
|
+
// a comment at all. It is text, and it renders. The migration nearly shipped
|
|
9
|
+
//
|
|
10
|
+
// </head>
|
|
11
|
+
// // ast-grep-ignore: classname-not-composed -- ...
|
|
12
|
+
// <body className={...}>
|
|
13
|
+
//
|
|
14
|
+
// into a page, where the comment would have appeared on screen. The correct
|
|
15
|
+
// JSX form is `{/* ... */}`, and ast-grep does not recognise it: measured on a
|
|
16
|
+
// two-file fixture, `{/* ast-grep-ignore: classname-not-composed -- ... */}`
|
|
17
|
+
// suppressed nothing.
|
|
18
|
+
//
|
|
19
|
+
// So findings inside JSX had NO usable suppression at all. Every `.tsx` rule
|
|
20
|
+
// that fires on markup — classname-not-composed, inline-map-row,
|
|
21
|
+
// jsx-cond-and-ternary — was unsuppressable, which for an adopting repo means
|
|
22
|
+
// the gate cannot be made green except by changing code the migration was not
|
|
23
|
+
// supposed to touch.
|
|
24
|
+
//
|
|
25
|
+
// This closes that: guardrails drops a finding when the line above it carries
|
|
26
|
+
// the same directive written the way JSX requires. The `//` form is left
|
|
27
|
+
// entirely to ast-grep — this only ADDS the bracketed form, and only for the
|
|
28
|
+
// rule it names, so it can never suppress more than the line comment would.
|
|
29
|
+
/** `{/* ast-grep-ignore: <rule-id> -- <why> */}`, the JSX-legal spelling. */
|
|
30
|
+
const JSX_IGNORE = /^\s*\{\s*\/\*\s*ast-grep-ignore:\s*([A-Za-z0-9_-]+)\b([\s\S]*?)\*\/\s*\}\s*$/;
|
|
31
|
+
/**
|
|
32
|
+
* A reason is required, exactly as the line-comment form requires one: the
|
|
33
|
+
* directive exists to record WHY a rule does not apply, and a bare id is a
|
|
34
|
+
* silent exemption. Without `--` the suppression does not apply and the
|
|
35
|
+
* finding stands.
|
|
36
|
+
*/
|
|
37
|
+
function suppressesRule(line, rule) {
|
|
38
|
+
const m = JSX_IGNORE.exec(line);
|
|
39
|
+
if (m === null)
|
|
40
|
+
return false;
|
|
41
|
+
if (m[1] !== rule)
|
|
42
|
+
return false;
|
|
43
|
+
return /--\s*\S/.test(m[2] ?? "");
|
|
44
|
+
}
|
|
45
|
+
const cache = new Map();
|
|
46
|
+
function fileLines(path, cwd) {
|
|
47
|
+
const key = isAbsolute(path) ? path : join(cwd, path);
|
|
48
|
+
const hit = cache.get(key);
|
|
49
|
+
if (hit !== undefined)
|
|
50
|
+
return hit;
|
|
51
|
+
let lines;
|
|
52
|
+
try {
|
|
53
|
+
lines = readFileSync(key, "utf8").split("\n");
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
// ast-grep-ignore: catch-empty -- a finding whose file cannot be re-read (deleted between scan and filter, or a synthetic path) keeps the finding; treating unreadable as "suppressed" would drop real findings
|
|
57
|
+
lines = [];
|
|
58
|
+
}
|
|
59
|
+
cache.set(key, lines);
|
|
60
|
+
return lines;
|
|
61
|
+
}
|
|
62
|
+
/** Drop findings whose preceding line carries the JSX-form ignore for that rule. */
|
|
63
|
+
export function dropJsxSuppressed(findings, cwd) {
|
|
64
|
+
cache.clear();
|
|
65
|
+
return findings.filter((f) => {
|
|
66
|
+
if (!f.file.endsWith(".tsx") && !f.file.endsWith(".jsx"))
|
|
67
|
+
return true;
|
|
68
|
+
const lines = fileLines(f.file, cwd);
|
|
69
|
+
const above = lines[f.line - 2];
|
|
70
|
+
if (above === undefined)
|
|
71
|
+
return true;
|
|
72
|
+
return !suppressesRule(above, f.rule);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=jsxSuppress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsxSuppress.js","sourceRoot":"","sources":["../src/jsxSuppress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAG7C,6EAA6E;AAC7E,EAAE;AACF,gFAAgF;AAChF,+EAA+E;AAC/E,+EAA+E;AAC/E,6EAA6E;AAC7E,EAAE;AACF,YAAY;AACZ,sDAAsD;AACtD,2BAA2B;AAC3B,EAAE;AACF,4EAA4E;AAC5E,+EAA+E;AAC/E,6EAA6E;AAC7E,sBAAsB;AACtB,EAAE;AACF,6EAA6E;AAC7E,iEAAiE;AACjE,8EAA8E;AAC9E,8EAA8E;AAC9E,qBAAqB;AACrB,EAAE;AACF,8EAA8E;AAC9E,yEAAyE;AACzE,6EAA6E;AAC7E,4EAA4E;AAE5E,8EAA8E;AAC9E,MAAM,UAAU,GAAG,8EAA8E,CAAC;AAElG;;;;;GAKG;AACH,SAAS,cAAc,CAAC,IAAY,EAAE,IAAY;IAChD,MAAM,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC7B,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,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AG,CAAC,CAAC,CAAC;QAChC,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,IAAI,CAAC;QACrC,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { packageRoot } from "./packagePaths.js";
|
|
6
|
+
// `{/* ast-grep-ignore: <rule> -- <why> */}` (is-18ff62fb). Inside JSX children
|
|
7
|
+
// `//` is not a comment, it is text that renders, so ast-grep's own line-comment
|
|
8
|
+
// form cannot be used there — and ast-grep does not recognise the bracketed
|
|
9
|
+
// spelling. Findings on markup therefore had no suppression at all.
|
|
10
|
+
//
|
|
11
|
+
// Four directions, all executed, because a suppression that swallows too much
|
|
12
|
+
// is worse than none:
|
|
13
|
+
// 1. the bracketed form suppresses the rule it names
|
|
14
|
+
// 2. the same file without it still reports (the fixture is not inert)
|
|
15
|
+
// 3. it does NOT suppress a different rule on the same line
|
|
16
|
+
// 4. without a `-- <why>` reason it does not apply, exactly as the line form
|
|
17
|
+
const WITH = `export const A = ({ v }: { v: string }) => (
|
|
18
|
+
<div>
|
|
19
|
+
{/* ast-grep-ignore: classname-not-composed -- the fonts are CSS variables, not variants */}
|
|
20
|
+
<span className={\`base \${v}\`}>x</span>
|
|
21
|
+
</div>
|
|
22
|
+
);
|
|
23
|
+
`;
|
|
24
|
+
const WITHOUT = `export const B = ({ v }: { v: string }) => (
|
|
25
|
+
<div>
|
|
26
|
+
<span className={\`base \${v}\`}>x</span>
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
`;
|
|
30
|
+
const WRONG_RULE = `export const C = ({ v }: { v: string }) => (
|
|
31
|
+
<div>
|
|
32
|
+
{/* ast-grep-ignore: inline-map-row -- names a different rule than the one that fires */}
|
|
33
|
+
<span className={\`base \${v}\`}>x</span>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
`;
|
|
37
|
+
const NO_REASON = `export const D = ({ v }: { v: string }) => (
|
|
38
|
+
<div>
|
|
39
|
+
{/* ast-grep-ignore: classname-not-composed */}
|
|
40
|
+
<span className={\`base \${v}\`}>x</span>
|
|
41
|
+
</div>
|
|
42
|
+
);
|
|
43
|
+
`;
|
|
44
|
+
let failed = 0;
|
|
45
|
+
const fail = (m) => {
|
|
46
|
+
console.error(`FAIL jsx-suppress: ${m}`);
|
|
47
|
+
failed++;
|
|
48
|
+
};
|
|
49
|
+
function verify(dir) {
|
|
50
|
+
const r = spawnSync("node", [join(packageRoot, "dist", "cli.js"), "verify", "."], {
|
|
51
|
+
cwd: dir,
|
|
52
|
+
encoding: "utf8",
|
|
53
|
+
});
|
|
54
|
+
return `${r.stdout}${r.stderr}`;
|
|
55
|
+
}
|
|
56
|
+
function fixture(name, source) {
|
|
57
|
+
const root = mkdtempSync(join(tmpdir(), "guardrails-jsxsup-"));
|
|
58
|
+
mkdirSync(join(root, "src"), { recursive: true });
|
|
59
|
+
writeFileSync(join(root, "src", name), source);
|
|
60
|
+
return root;
|
|
61
|
+
}
|
|
62
|
+
const cases = [
|
|
63
|
+
["a.tsx", WITH, false, "the bracketed form suppresses the rule it names"],
|
|
64
|
+
["b.tsx", WITHOUT, true, "the same markup without it still reports"],
|
|
65
|
+
["c.tsx", WRONG_RULE, true, "a directive naming another rule suppresses nothing"],
|
|
66
|
+
["d.tsx", NO_REASON, true, "a directive with no `-- <why>` reason does not apply"],
|
|
67
|
+
];
|
|
68
|
+
for (const [name, source, expectReported, what] of cases) {
|
|
69
|
+
const root = fixture(name, source);
|
|
70
|
+
try {
|
|
71
|
+
const out = verify(root);
|
|
72
|
+
const reported = out.includes("classname-not-composed");
|
|
73
|
+
if (reported !== expectReported) {
|
|
74
|
+
fail(`${what} — expected ${expectReported ? "a finding" : "no finding"}, got the opposite:\n${out}`);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
console.log(` ok jsx-suppress: ${what}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
rmSync(root, { recursive: true, force: true });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (failed > 0) {
|
|
85
|
+
console.error(`jsx-suppress: ${failed} check(s) failed`);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
console.log("jsx-suppress: all checks passed");
|
|
89
|
+
//# sourceMappingURL=jsxSuppressTest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsxSuppressTest.js","sourceRoot":"","sources":["../src/jsxSuppressTest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,gFAAgF;AAChF,iFAAiF;AACjF,4EAA4E;AAC5E,oEAAoE;AACpE,EAAE;AACF,8EAA8E;AAC9E,sBAAsB;AACtB,uDAAuD;AACvD,yEAAyE;AACzE,8DAA8D;AAC9D,+EAA+E;AAE/E,MAAM,IAAI,GAAG;;;;;;CAMZ,CAAC;AACF,MAAM,OAAO,GAAG;;;;;CAKf,CAAC;AACF,MAAM,UAAU,GAAG;;;;;;CAMlB,CAAC;AACF,MAAM,SAAS,GAAG;;;;;;CAMjB,CAAC;AAEF,IAAI,MAAM,GAAG,CAAC,CAAC;AACf,M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GAAG,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACnC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QACzB,MAAM,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;QACxD,IAAI,QAAQ,KAAK,cAAc,EAAE,CAAC;YAChC,IAAI,CACF,GAAG,IAAI,eAAe,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,wBAAwB,GAAG,EAAE,CAC/F,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,EAAE,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;AACH,CAAC;AAED,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CAAC,iBAAiB,MAAM,kBAAkB,CAAC,CAAC;IACzD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AACD,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC"}
|
package/dist/verify.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AstGrepConfigError, scanFindings } from "./astGrep.js";
|
|
2
2
|
import { formatFinding, hasErrors } from "./findings.js";
|
|
3
|
+
import { dropJsxSuppressed } from "./jsxSuppress.js";
|
|
3
4
|
import { rulesConfig } from "./packagePaths.js";
|
|
4
5
|
import { driftMessage, presetDrift, presetEnforced } from "./presetDrift.js";
|
|
5
6
|
import { dedupeFindings, ruleConfigs } from "./repoRules.js";
|
|
@@ -20,7 +21,9 @@ export function collectVerifyFindings(targets, severityArgs = [], cwd = process.
|
|
|
20
21
|
// Applied HERE rather than in `runVerify`, so verify-diff and the hooks get
|
|
21
22
|
// the same scoping: a screen that is legal under `verify` must not be gated
|
|
22
23
|
// by `verify-diff` on the same line.
|
|
23
|
-
|
|
24
|
+
// JSX-form suppressions last: they are a per-line exemption like ast-grep's
|
|
25
|
+
// own, and must not change which rules a scope stands down.
|
|
26
|
+
return dropJsxSuppressed(dropScopeExempt(findings, scopePatterns(cwd), scopeExemptRuleIds()), cwd);
|
|
24
27
|
}
|
|
25
28
|
export function runVerify(targets, json) {
|
|
26
29
|
const paths = targets.length > 0 ? targets : ["."];
|
package/dist/verify.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../src/verify.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAgB,aAAa,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EACL,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,GACd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,UAAU,qBAAqB,CACnC,OAAiB,EACjB,eAAyB,EAAE,EAC3B,MAAc,OAAO,CAAC,GAAG,EAAE;IAE3B,sEAAsE;IACtE,2EAA2E;IAC3E,qEAAqE;IACrE,kBAAkB;IAClB,MAAM,QAAQ,GAAG,cAAc,CAAC;QAC9B,GAAG,WAAW,CAAC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CACT,0JAA0J,CAC3J,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentvibes/guardrails",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Verification toolkit that makes agents write simple code: ast-grep rule canon, diff ratchet, biome/tsconfig presets, one CLI.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"format": "biome check --write .",
|
|
36
36
|
"test:rules": "node dist/testRules.js",
|
|
37
37
|
"test:gate": "node dist/gateRed.js",
|
|
38
|
-
"check": "pnpm build && pnpm lint && pnpm test:rules && pnpm test:twins && pnpm test:repo-rules && pnpm test:preset && pnpm test:gate && pnpm test:sibling-clone && pnpm test:metrics && pnpm test:init && pnpm test:severity && pnpm test:screens && pnpm test:hooks && pnpm test:iterate && pnpm test:leaks && pnpm leaks",
|
|
38
|
+
"check": "pnpm build && pnpm lint && pnpm test:rules && pnpm test:twins && pnpm test:repo-rules && pnpm test:preset && pnpm test:gate && pnpm test:sibling-clone && pnpm test:metrics && pnpm test:init && pnpm test:severity && pnpm test:screens && pnpm test:jsx-suppress && pnpm test:hooks && pnpm test:iterate && pnpm test:leaks && pnpm leaks",
|
|
39
39
|
"test:metrics": "node dist/metricsCycle.js",
|
|
40
40
|
"leaks": "node dist/cli.js leaks .",
|
|
41
41
|
"test:leaks": "node dist/leaksRed.js",
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"test:twins": "node dist/twinCoverageTest.js",
|
|
48
48
|
"test:repo-rules": "node dist/repoRulesTest.js",
|
|
49
49
|
"test:preset": "node dist/presetDriftTest.js",
|
|
50
|
-
"test:sibling-clone": "node dist/siblingCloneTest.js"
|
|
50
|
+
"test:sibling-clone": "node dist/siblingCloneTest.js",
|
|
51
|
+
"test:jsx-suppress": "node dist/jsxSuppressTest.js"
|
|
51
52
|
},
|
|
52
53
|
"dependencies": {
|
|
53
54
|
"ts-pattern": "^5.6.2",
|