rmnr
DocsTourSlicesBest PracticeAgentsInstall

Command Palette

Search for a command to run...

New
  • Best Practice
  • Audit Chain

Operator

Audit Chain

Four CI guards enforce rr conventions across the catalog. All run locally via npm run slices:check and gate every commit + push via .githooks/pre-commit and .githooks/pre-push.

Run all

terminalbash
# Full chain locally
npm run slices:check

# Individual guards
npm run audit:slices
npm run audit:templates
npm run audit:file-size
npm run audit:convex-features
npm run audit:docs-primitives
npm run validate:manifests
npm run validate:contracts:check

# Hooks (auto on commit + push)
.githooks/pre-commit   # typecheck + contracts + 3 audit gates (~15s)
.githooks/pre-push     # 3 audit gates (~5s)

audit:slices

30/30 slices

scripts/validation/audit-slice.mjs

  • Metadata pair: slice.json (with an embedded contract block) + slice.manifest.json both exist
  • Naming: folder name === slice.json slug === config.ts slug
  • Imports: slice files only resolve via @/components/ui/*, @/shared/*, @/features/<own-slug>/*, @convex/*, or relative-within-slice
  • Schema clash: no two slices declare the same Convex table name
  • Config agreement: config.ts slug + title + category match slice.json

All violations are errors. CI blocks.

audit:templates

367 files / 35 templates / cookbook + preview slices / 7 website-template Pages CRUD surfaces

scripts/validation/audit-templates.mjs

  • shadcn primitives only — no raw <button>, <dialog>, <input type=date|file>
  • Hardcoded /preview/<slug> tokens only in rewriter-handled files (robots.ts, sitemap.ts, site-config.ts, nav-config.ts)
  • Template-literal aware: <button> inside CodeBlock string templates is skipped
  • Every website-template MUST wire Pages CRUD: admin/pages/page.tsx + admin/pages/[id]/page.tsx + public/[...slug]/page.tsx (P-wave 2026-05-18)

Error in components/templates/* + cookbook/layouts/* + missing Pages CRUD on website-templates; warning in single-page block demos.

audit:file-size

970 files scanned

scripts/validation/audit-file-size.mjs

  • Max 200 lines per source file
  • Exempt: pure-data files (lib/content/*, theme presets, per-template seed.ts, _generated/)
  • Grandfather list at scripts/validation/audit-file-size.grandfather.json — must shrink, never grow

New violations are errors. Grandfathered files emit warnings.

validate:manifests

30/30 slice manifests

scripts/validation/validate-manifests.mjs

  • Validates each slice.manifest.json against docs/slice.manifest.schema.json
  • Schema is `oneOf [SchemaA, SchemaB]` — both modern + legacy shapes valid
  • Schema A: { slug, version, tier, distribution, files: [paths], imports }
  • Schema B: { name, deps, files: { include, exclude }, env, ... }

Errors fail validation. Run with --check to fail CI on errors.

audit:convex-features

19/19 convex/features/* folders

scripts/validation/audit-convex-features.mjs

  • Canon files (top-level only): _schema.ts (REQUIRED), query.ts, mutation.ts, action.ts, http.ts, index.ts, README.md (warned), slice metadata (slice.json + slice.manifest.json)
  • BANNED: schema.ts (no underscore), mutations.ts/queries.ts/actions.ts (plural)
  • Private helpers/types: underscore-prefix (e.g. _helpers.ts, _types.ts)
  • _schema.ts should export `<slug>Tables` for root-schema composition (warning)
  • Subfolders (e.g. payment/actions/<provider>.ts) allowed — canon applies to top-level only

BANNED files + missing _schema.ts are errors. Naming + missing tables export are warnings.

audit:docs-primitives

app/(docs) .tsx

scripts/validation/audit-docs-primitives.mjs

  • Flags raw `<div … rounded-lg border bg-card …>` panels — prefer <DocCard> (components/site/doc-primitives) so panel chrome has one restyle source
  • Narrow by design: only <div> openers (Link / <details> panels keep the chrome inline), only app/(docs) (DocCard is docs-site-internal)

Advisory only — always exits 0, never blocks. A DRY nudge, not a gate.

Adding a new guard

  1. Write the scanner at scripts/validation/<name>.mjs — keep main file ≤200 LOC (extract helpers to <name>-helpers.mjs).
  2. Exit codes: 0 = clean, 1 = errors. Warnings print but don't fail.
  3. Wire into package.json scripts (audit:<name>) and the slices:check chain.
  4. Add to .githooks/pre-push (or pre-commit if fast enough).
  5. Add this page entry above.