Repository navigation
Move the custom rule stub into a template file, and test that it loads in Oxlint - #542
Conversation
7a1bf91 to
98241a5
Compare
There was a problem hiding this comment.
No new issues found.
Reviewed changes Reviewed the custom rule template, its build-time macro, and the new Oxlint test.
- Stub template: The rule moves from a template literal to a separate file. The macro embeds it during the build, and
toCustomRuleStubfills the rule name without changing the generated content. - Oxlint test: The new test loads the generated stub through
custom()and checks that it reports a debugger statement. - Verification:
pnpm run testpassed with 602 tests passed and one Bun test skipped.pnpm run build:verify,pnpm run check, andpnpm run analyzepassed. The built CLI also wrote the expected rule with the supplied name.
gpt-6.1-sol | 𝕏
98241a5 to
0111323
Compare
0111323 to
b80ba69
Compare
The stub that `adamantite rule add` writes lives in custom-rules/stub.ts.template, and a build-time macro inlines it into the bundle, as the Doctor repair prompt does. The template is not a `.ts` file, because its `adamantite/rules` import resolves only after a build. A new Oxlint test loads and runs the stub, so a broken stub fails the tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b80ba69 to
b55cb0d
Compare
|
@codex review |
|
@cursor review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b55cb0d. Configure here.
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |

Stack
AGENTS.md, and point to the skill for authoring guidanceThe rule stub that
adamantite rule addwrites was a template literal intoCustomRuleStub. Its backticks were escaped, and it was hard to read as the file that the user gets. Now the stub lives insrc/lib/workspace/custom-rules/stub.ts.template, and a build-time macro inlines it into the bundle, as the Doctor repair prompt does (#538).toCustomRuleStubfills the one slot,{{name}}.The template is not a
.tsfile, so the type check and the lint do not read it. Itsadamantite/rulesimport resolves to thedisttypes, so a.tstemplate would fail the type check on a clean checkout. To make up for this, a new test insrc/__tests__/presets/custom.test.tsloads the real stub in an Oxlint run and asserts that it reports. Before this PR, only a test that comparedtoCustomRuleStubwith itself covered the stub.Evidence
adamantite rule add no-windowwrites a file that is byte-identical to the stub frommain(cmp). The skill'ssourceslist now includes the template.project(no-debugger-here):error.pnpm run test(620 tests),fix,format,check,analyze, andbuildpass.dist/index.jscontains the template text.No changeset: the stub does not change.
Merge danger
rule addstub. A broken template fails the new Oxlint test.Made with Claude Opus 5.5 in Claude Code, running in T3 Code.
🤖 Generated with Claude Code
Note
Low Risk
Scoped to the
rule addstub path and build-time inlining; behavior is intended to stay byte-identical, with a new Oxlint test as the guardrail.Overview
Moves the
adamantite rule addstub out of an inline template literal intoCustomRuleStubintostub.ts.template, with{{name}}as the only substitution slot. A build-time macro (stub.macro.ts) inlines that file into the bundle so the CLI does not read the template from disk at runtime—same approach as Doctor repair prompts.toCustomRuleStubnow doesstubTemplate.replaceAll("{{name}}", name). The Adamantite skillsourceslist includes the new template.Adds an integration test that writes the real stub (via
toCustomRuleStub) into.adamantite/rulesand asserts Oxlint reportsproject(no-debugger-here):error, so the generated file is exercised end-to-end instead of only being compared to itself.Reviewed by Cursor Bugbot for commit b55cb0d. Configure here.