fix(docs): correct the advertised rule count and gate it - #29
Conversation
Both READMEs still advertised 59 rules after 0.10.0 added the sixtieth. The count appears twice in each file — the header link and the scoring section — and no generator owns that prose, so it went stale silently. Gate it where the true count already lives: `docs:rules --check` now compares both READMEs against RULE_CATALOG.length and fails with the expected number. Verified by reverting a count and watching it fail. The counts in CHANGELOG.md and changelog/*.md are left alone. Those are records of what shipped at the time, and 59 was correct at 0.1.0. The release skill gains the surface sweep this missed, plus a correction about /stats: nothing on that page is edited by hand — every tile is pulled live from npm and GitHub and revalidates hourly — so it is a post-publish confirmation that the new version appears, not an update step. Also records the recurring missed Git tag.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe bundled ruleset count changes from 59 to 60. Catalog checks now detect stale README counts. Release instructions add documentation, version, generated-output, and published-site verification steps. ChangesRule Count Release Validation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/scripts/generate-rule-catalog.ts`:
- Around line 39-50: Update the README validation loop around
ADVERTISED_COUNT_READMES and ADVERTISED_COUNT_PATTERNS to use async/await with
try/catch, report readFile failures as stale validation findings, and report
each pattern that has no match instead of silently passing. Preserve the
existing advertised-count mismatch message and add tests covering unreadable or
missing READMEs and removed count phrases.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 3c685630-37fe-4c49-b4fa-72540bef092b
📒 Files selected for processing (4)
.claude/skills/shadscan-release/SKILL.mdREADME.mdpackages/cli/README.mdpackages/cli/scripts/generate-rule-catalog.ts
| for (const readme of ADVERTISED_COUNT_READMES) { | ||
| const content = await readFile(readme.path, "utf8").catch(() => ""); | ||
|
|
||
| for (const pattern of ADVERTISED_COUNT_PATTERNS) { | ||
| const match = content.match(pattern); | ||
|
|
||
| if (match && Number(match[1]) !== RULE_CATALOG.length) { | ||
| stale.push( | ||
| `${readme.label} advertises ${match[1]} rules, expected ${RULE_CATALOG.length}` | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Fail closed when README validation cannot complete.
readFile(readme.path, "utf8").catch(() => "") converts a missing or unreadable README into empty content. The loop adds a finding only when content.match(pattern) succeeds. A missing README or a removed count phrase therefore produces no stale-count finding, and --check can return success without checking that README. Report read failures and missing matches as validation failures. Add tests for both cases.
As per coding guidelines: “Await promises in async functions, prefer async/await over promise chains, handle async errors appropriately with try/catch.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/cli/scripts/generate-rule-catalog.ts` around lines 39 - 50, Update
the README validation loop around ADVERTISED_COUNT_READMES and
ADVERTISED_COUNT_PATTERNS to use async/await with try/catch, report readFile
failures as stale validation findings, and report each pattern that has no match
instead of silently passing. Preserve the existing advertised-count mismatch
message and add tests covering unreadable or missing READMEs and removed count
phrases.
Source: Coding guidelines
0.10.0 added the sixtieth rule, but both READMEs still advertised 59. The count appears twice in each file — the header badge link and the scoring section — and no generator owns that prose, so it went stale silently.
What was actually stale
README.md:19(header link)README.md:205(scoring section)packages/cli/README.md:19packages/cli/README.md:180Deliberately not touched: the counts in
CHANGELOG.mdandchangelog/0.1.0.md. Those are historical records — 59 was correct at 0.1.0, and rewriting them would falsify what shipped.Gated so it cannot recur
pnpm docs:rules --check(already indocs:check) now also compares both READMEs againstRULE_CATALOG.lengthand fails with the expected number. That's the one place that already knows the true count, so the check costs nothing.Verified it actually fires by reverting a count and re-running:
About /stats
Worth stating plainly, because it changes what the release skill should say: there is nothing on
/statsto update. Every tile —Latest,Versions,Downloads,Stars— is pulled live from the npm registry and the GitHub API at request time, withexport const revalidate = 3600. It still shows 0.9.0 only because 0.10.0 has not been published yet; it will pick the new version up within the hour of publishing, with no code change.So the skill now frames
/statsas a post-publish confirmation rather than an edit: if theLatesttile still shows the previous version after the revalidate window, the publish did not reach the registry, and that is a real signal worth investigating rather than something to paper over by editing the page.Release skill updates
BUNDLED_RULESET_VERSION, and the two hardcodedRULE_CATALOG.lengthassertions inpublic-api.test.tsandsmoke-package.mjs(the latter fails late, after a full build and npm pack, with a message that never mentions rule counts)./changelog,/stats(as above), and/rules, with what a wrong number on each actually indicates.check-release.mjsgained a gate for in21deb80.Verification
6 gates green (
check,docs:check,typecheck,cli:test,test:web,build). Self-audit 100/100 A.Docs and skill only — no rule logic, no ruleset bump, no schema change. Safe to land before or after the 0.10.0 publish.
Summary by CodeRabbit
Documentation
Quality Improvements