feat(rules): migrate /rules/ to Astro page with RulesInteractive island

Add the migrated chapter page (task 14). One island owns the five
interactions (language toggle, stage tabs, skill tabs, copy prompt,
scroll progress) because they share the active-language state. Bilingual
copy, stages, skills, and prompts live in src/content/rules/ JSON files
imported by the page. Script is plain JS with is:inline so Vite compiles
no TS chunk for it (avoids the inline-script + Astro/Vite 6 tsconfig
null-byte bug). Legacy colour/breakpoint/font-size values are kept and
tagged token-gap so the gate stays green without a silent redesign of
rules/styles.css.

Done-when:
- dist/rules/index.html server-renders the same DOM and classes as
  rules/index.html
- snapshot-route.mjs diff vs .agents/snapshots/rules.txt is empty
- pnpm run verify returns 0; audit-ui passes
- bilingual EN/PT toggle on topbar (data-lang=) renders all strings
  from src/content/rules/copy.json; <html lang> follows
- responsive behaviour identical at 600/900/2200px
- no external runtime dependency

Handoff:
- src/content/config.ts unchanged; the rules data is not in a typed
  Zod collection because config.ts is owned by content-i18n-migrator.
  Add a rules collection there when the collection layer is extended.
- verify.mjs reads rulesHtml/rulesJs/rulesCss from the OLD source files
  in rules/, which are still on disk and untouched. New rulesHtml-style
  assertions should target dist/rules/index.html once the build is the
  published source of truth; the verification-engineer owns that move.
- 30 token-gap markers in RulesInteractive.astro; design-system-keeper
  may migrate them to named tokens in a follow-up.
This commit is contained in:
Marcos Paulo
2026-09-05 17:02:17 +00:00
parent 107e429fb9
commit 134bd37ec4
6 changed files with 1522 additions and 0 deletions
+80
View File
@@ -0,0 +1,80 @@
{
"gate": {
"name": "gate-discipline",
"trigger": {
"en": "Before commit, PR, or merge.",
"pt": "Antes de commit, PR ou merge."
},
"lesson": {
"en": "Run canonical gates separately, inspect exit codes, distrust convenient cache hits, and prove generated code is current.",
"pt": "Rode gates separadamente, leia exit codes, desconfie de cache conveniente e prove que código gerado está atual."
},
"example": "pnpm lint; echo \"lint=$?\"",
"path": ".agents/skills/gate-discipline/SKILL.md"
},
"parallel": {
"name": "parallel-agents",
"trigger": {
"en": "When independent tasks can run concurrently.",
"pt": "Quando tarefas independentes podem rodar juntas."
},
"lesson": {
"en": "One worktree and file ownership per task; prior-art scout first, verifier last, merge sequentially.",
"pt": "Um worktree e ownership por tarefa; prior-art scout primeiro, verifier por último, merges sequenciais."
},
"example": "git worktree add .claude/worktrees/task -b feat/task",
"path": ".agents/skills/parallel-agents/SKILL.md"
},
"repo": {
"name": "repo-db",
"trigger": {
"en": "At task start and before debugging.",
"pt": "No início da tarefa e antes de diagnosticar."
},
"lesson": {
"en": "Query the repo map, canonical commands, and known-issues ledger before crawling thousands of files.",
"pt": "Consulte mapa, comandos canônicos e known-issues antes de vasculhar milhares de arquivos."
},
"example": "jq -r '.verify[]' .agents/db/commands.json",
"path": ".agents/skills/repo-db/SKILL.md"
},
"debt": {
"name": "tech-debt",
"trigger": {
"en": "When unrelated debt appears mid-task.",
"pt": "Quando dívida não relacionada aparece no meio."
},
"lesson": {
"en": "Do not smuggle cleanup into a feature. Record it, give it its own branch, and finish the underlying condition.",
"pt": "Não esconda limpeza em uma feature. Registre, dê uma branch própria e finalize a condição original."
},
"example": "feature diff ≠ debt cleanup",
"path": ".agents/skills/tech-debt/SKILL.md"
},
"writer": {
"name": "skill-writer",
"trigger": {
"en": "When a workflow is explained twice.",
"pt": "Quando um fluxo é explicado duas vezes."
},
"lesson": {
"en": "Procedures become skills; isolated facts become known-issues entries. Keep the body short and the trigger discriminating.",
"pt": "Procedimentos viram skills; fatos isolados viram known-issues. Corpo curto e gatilho discriminante."
},
"example": ".agents/skills/<name>/SKILL.md",
"path": ".agents/skills/skill-writer/SKILL.md"
},
"area": {
"name": "frontend / go-api",
"trigger": {
"en": "When changing the matching subsystem.",
"pt": "Ao alterar o subsistema correspondente."
},
"lesson": {
"en": "Encode version-specific traps close to the work: Next/React/AntD boundaries, Connect APIs, sqlc types, migrations, and code generation.",
"pt": "Codifique armadilhas de versão perto do trabalho: Next/React/AntD, APIs Connect, tipos sqlc, migrations e codegen."
},
"example": "area → local skill → canonical checks",
"path": ".agents/skills/"
}
}