Repository navigation
fix(resource-shipping): close LOW follow-ups #2543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -170,10 +170,18 @@ export function checkResourceLine(line: string): ResourceViolation[] { | |||||
| } | ||||||
|
|
||||||
| // (b) Repo-only lint invocation without the SAME-LINE package.json guard. | ||||||
| // A split-line guard (probe on the previous line) does not count — the probe | ||||||
| // must sit on the same line as the command it protects. | ||||||
| if (/\bbun run (?:wishes|skills):lint\b/.test(line) && !line.includes('package.json')) { | ||||||
| violations.push({ rule: 'unguarded-repo-lint', snippet }); | ||||||
| // The guard must be a package.json probe that short-circuits (`&&`) INTO the | ||||||
| // command, e.g. `grep -q '"wishes:lint"' package.json 2>/dev/null && bun run | ||||||
| // wishes:lint` or `test -f package.json && bun run skills:lint`. A bare | ||||||
| // mention of package.json elsewhere on the line — a trailing comment, an echo | ||||||
| // arg, or a reference AFTER the command — does not gate the run, so it must | ||||||
| // NOT exempt it. A split-line guard (probe on the previous line) also fails: | ||||||
| // the probe must sit on the same line, ahead of the command it protects. | ||||||
| const lintMatch = /\bbun run (?:wishes|skills):lint\b/.exec(line); | ||||||
| if (lintMatch) { | ||||||
| const guard = line.slice(0, lintMatch.index); | ||||||
| const guarded = /\bpackage\.json\b[^&|;]*&&/.test(guard); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a skill command line mentions Useful? React with 👍 / 👎.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The current regex For example, if a line contains: The To prevent such false exemptions, we should ensure that the
Suggested change
|
||||||
| if (!guarded) violations.push({ rule: 'unguarded-repo-lint', snippet }); | ||||||
| } | ||||||
|
|
||||||
| // (c) Imperative execution of a repo-root script — scripts/*.ts is repo-only. | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To ensure that broken short-circuit chains (e.g., due to trailing semicolons or other command separators) are correctly flagged as unguarded, we should add a test case covering this scenario.