@thebattlearena/corner 0.10.0 → 0.10.1-beta.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -123,28 +123,28 @@ El detalle (esquema, íconos y colores válidos) está en «Monitores del repo»
123
123
  Con la fuente Battle Arena Icons instalada (la pone `install`), estos símbolos se dibujan con sus
124
124
  glifos; sin ella, con el carácter de la tabla.
125
125
 
126
- | Ícono | Dónde | Significa |
127
- | --- | --- | --- |
128
- | ✓ | punto, banda | entregado |
129
- | ↻ | punto, banda | en curso: tiene tiempo hoy |
130
- | ↷ | punto, banda | desplazado por un emergente |
131
- | ○ | punto, banda | por hacer: sin tiempo todavía |
132
- | ● | punto, en el cierre | avanzó pero no se entregó |
133
- | ⚠ | banda, riesgos | riesgo abierto; en una ficha, «va con avisos» |
134
- | ✗ | ficha | un paso falló |
135
- | ✎ | emergente, banda | falta responder el motivo |
136
- | ✋ | riesgo | levantar la mano: avisa a tu líder |
137
- | 👍 👎 | riesgo | si el aviso de riesgo acertó o no (ajusta la detección) |
138
- | 📅 | punto | reunión ligada |
139
- | 💡 | punto, complemento | tiempo en cabina |
140
- | 🧪 | punto, complemento | sesión de Tape |
141
- | ▸ ▾ ▴ | filas | desplegar, contraer, cerrar el detalle |
142
- | ↗ | ligas | abrir en la web |
143
- | ♪ ▶ ⏸ ▲ | radio | la canción, escuchar, dejar de escuchar, votar |
144
- | spinner | ring | alguien del combate está trabajando |
145
- | ■ (ámbar) | ring | te toca decidir |
146
- | 👊N (rojo) | ring | Copilot dejó N hilos |
147
- | ◣ | ficha de Copilot | en la esquina: Copilot está revisando |
126
+ | Ícono | Dónde | Significa |
127
+ | ---------- | ------------------- | ------------------------------------------------------- |
128
+ | ✓ | punto, banda | entregado |
129
+ | ↻ | punto, banda | en curso: tiene tiempo hoy |
130
+ | ↷ | punto, banda | desplazado por un emergente |
131
+ | ○ | punto, banda | por hacer: sin tiempo todavía |
132
+ | ● | punto, en el cierre | avanzó pero no se entregó |
133
+ | ⚠ | banda, riesgos | riesgo abierto; en una ficha, «va con avisos» |
134
+ | ✗ | ficha | un paso falló |
135
+ | ✎ | emergente, banda | falta responder el motivo |
136
+ | ✋ | riesgo | levantar la mano: avisa a tu líder |
137
+ | 👍 👎 | riesgo | si el aviso de riesgo acertó o no (ajusta la detección) |
138
+ | 📅 | punto | reunión ligada |
139
+ | 💡 | punto, complemento | tiempo en cabina |
140
+ | 🧪 | punto, complemento | sesión de Tape |
141
+ | ▸ ▾ ▴ | filas | desplegar, contraer, cerrar el detalle |
142
+ | ↗ | ligas | abrir en la web |
143
+ | ♪ ▶ ⏸ ▲ | radio | la canción, escuchar, dejar de escuchar, votar |
144
+ | spinner | ring | alguien del combate está trabajando |
145
+ | ■ (ámbar) | ring | te toca decidir |
146
+ | 👊N (rojo) | ring | Copilot dejó N hilos |
147
+ | ◣ | ficha de Copilot | en la esquina: Copilot está revisando |
148
148
 
149
149
  Las fichas del ring son el **árbitro**, el **luchador**, el **esquinero**, la **campana** (round-bell),
150
150
  **Copilot** y el **juez** (tú). Su borde dice el estado: gris quieta, azul trabajando, morada en la
@@ -167,8 +167,8 @@ Se invocan escribiendo el comando o pidiéndolo con tus palabras («arma mi plan
167
167
 
168
168
  ### Comandos
169
169
 
170
- | Comando | Para qué sirve |
171
- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
170
+ | Comando | Para qué sirve |
171
+ | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
172
172
  | `/ringside` | Abre **Ringside**: la pelea de tu día junto al chat. Tu plan con el avance y el tiempo de cada punto contra lo comprometido (semáforo verde · amarillo · rojo), los emergentes (clic para ver su motivo), los riesgos siempre visibles con ✋ Levantar la mano y 👍/👎, y el pie con Plan · Reuniones · Fuera · Total. Pestaña **Semana** con tus hábitos. Sin datos, te dice el **siguiente paso** (instalar, armar el plan, entrar a la daily). `/scorecard`, su nombre anterior, lo sigue abriendo con un aviso. |
173
173
 
174
174
  Arriba del prompt sale además una **banda** compacta de Ringside (`LER-640 ✓ 1 ↻ 1 ↷ 1 ⚠ 1 Abrir`, cada contador con su color).
@@ -374,8 +374,84 @@ rama. El contrato para el proyecto está en `ring/skills/sparring/references/hos
374
374
  **Config del repo** (`.claude/ring.json`, opcional): `gates` (typecheck, tests por ruta con
375
375
  `{paths}`, lint), `validateCommand`, `rulebook` (por defecto el genérico del plugin),
376
376
  `protectedBranches`, `forbidAiTrailers` (por defecto `true`), `heavyCommands`, `delegation`,
377
- `precedents` y `monitors` (ver «Monitores del repo»). Sin el archivo, `ring` usa los gates que detecta en `package.json`, `pyproject.toml`,
378
- `go.mod` y el `Makefile`.
377
+ `precedents`, `monitors` (ver «Monitores del repo»), `briefGuard` (`warn`, `block` u `off`), `layers`, `layersIgnore`, `layersRequired` y `findingsNeedJudge` (ver «Gate de arquitectura»), `relayEvery`, `engramUrl` y `engramProject` (ver «Memoria entre peleas»), y `agents` (modelo y esfuerzo por rol; por
378
+ defecto el luchador y el rudo en `sonnet` con esfuerzo `high` y el esquinero en `opus` con `high`,
379
+ p. ej. `"agents": { "wrestler": { "model": "opus" } }`). Sin el archivo, `ring` usa los gates que
380
+ detecta en `package.json`, `pyproject.toml`, `go.mod` y el `Makefile`.
381
+
382
+ **Briefs generados, no escritos**: el árbitro no le escribe a mano las instrucciones al luchador
383
+ ni al esquinero. `ring/scripts/brief.mjs` las arma desde los templates con el reglamento y los
384
+ precedentes embebidos completos (abriendo con un checklist de arquitectura: lo que más se escapa en
385
+ una revisión línea por línea), las decisiones que importan (todas las faltas, las de esos archivos
386
+ y las últimas 20) y los commits del rango; las sella y las registra en
387
+ `<combate>/briefs/index.jsonl`. El árbitro sólo pone sus valores (el encargo, las invariantes…).
388
+ Todo hallazgo de un esquinero o de una revisión tuya cita una regla del reglamento
389
+ (`<archivo:línea> — R11 — …`): `findings.mjs add` rechaza el que no la trae, y uno que ninguna regla
390
+ cubre lleva `X0` y queda como propuesta para el reglamento.
391
+ El árbitro lanza al luchador y al esquinero con `prompt: "ring-brief: <archivo>"`: el hook
392
+ `brief-guard` revisa el sello (generado por `brief.mjs`, sin editar, con las reglas de hoy, de este
393
+ combate y de ese rol), pone el texto del archivo como instrucción y el modelo y esfuerzo del rol.
394
+ Con `briefGuard: "warn"` (el default en `.claude/ring.json`) un brief que no cumple pasa y el árbitro
395
+ recibe el aviso; con `"block"` se rechaza con el comando que lo genera; `"off"` lo apaga. Cada
396
+ decisión queda en `<combate>/brief-guard.jsonl`. Y cuando la sesión del árbitro se compacta, el hook
397
+ `compact-hook` le devuelve (en menos de 10 000 caracteres) el combate, el checklist, sus faltas y el
398
+ «cómo reanudar» de la tarjeta.
399
+
400
+ **Gate de arquitectura**: `ring/scripts/arch-gate.mjs check <worktree> --range A..B` revisa los
401
+ imports que el rango **agrega** contra las capas del repo y, si el repo tiene dependency-cruiser
402
+ (`.dependency-cruiser.cjs` y el paquete instalado), también lo corre, con su lista de violaciones
403
+ conocidas cuando la tiene. Cada violación es un hallazgo que cita P14. El esquinero lo corre en cada
404
+ modo y `mask-guard` en cada push a la rama del PR; la deuda que ya estaba no bloquea. Las capas van
405
+ en `.claude/ring.json`:
406
+
407
+ ```json
408
+ "layers": [
409
+ { "name": "domain", "paths": ["packages/contexts/*/domain/**"], "mayImport": [],
410
+ "forbid": ["^@nestjs/", "^typeorm$"] },
411
+ { "name": "application", "paths": ["apps/public-api/src/**/application/**"],
412
+ "mayImport": ["domain"] },
413
+ { "name": "infrastructure",
414
+ "paths": ["apps/public-api/src/**/typeorm/**", "apps/public-api/src/**/controllers/**"],
415
+ "mayImport": ["application", "domain"] }
416
+ ]
417
+ ```
418
+
419
+ Cuenta la **primera** capa cuya ruta coincide: van primero las más específicas (una
420
+ `infrastructure/` anidada dentro de una `application/` es infraestructura). Con `layersRequired`
421
+ (globs, p. ej. `["apps/public-api/src/**"]`) todo archivo **nuevo** bajo esas rutas tiene que caer en
422
+ alguna capa: el que no, es hallazgo, porque ninguna regla de dependencias lo alcanza. Si el worktree
423
+ de la pelea no tiene `.claude/ring.json` (un repo que lo guarda sin versionar), el gate usa el del
424
+ checkout principal del mismo repo. Los globs usan `**` y `*` (sin llaves `{a,b}`: una ruta por entrada). Las pruebas (`*.spec.*`, `*.test.*`, `__tests__/`, `test/`) quedan fuera por default: pueden armar un adaptador a propósito (`layersIgnore` cambia la lista). Los alias de `tsconfig.json` (`@arena/*`) se resuelven solos. Un repo sin capas ni dependency-cruiser
425
+ recibe un aviso al abrir la pelea (`judges-card open`). Y un hallazgo que cita una regla de
426
+ `findingsNeedJudge` (por defecto `["P14"]`; una pelea de limpieza agrega R6, R11, R12, R19 y R22) no
427
+ se manda a ticket ni se descarta sin `--judge "<lo que dijo el humano>"`.
428
+
429
+ **Un luchador nuevo por concepto, y el relevo del árbitro**: cuando el esquinero aprueba un
430
+ concepto, `judges-card.mjs concept <pr> "<concepto>" --range A..B` lo registra y retira a los
431
+ luchadores que lo cargaron; el siguiente concepto va a uno nuevo (`brief.mjs wrestler <pr> --mode
432
+ resume`), y `brief-guard` avisa (o bloquea) un `SendMessage` a uno retirado. Cada `relayEvery`
433
+ conceptos (4 por default, `null` lo apaga) el árbitro reescribe el «cómo reanudar» de la tarjeta, que
434
+ tiene que nombrar el último concepto, y corre `judges-card.mjs relay <pr>`; hasta entonces
435
+ `brief.mjs` no le arma instrucciones al siguiente luchador. Eso es lo que la sesión recupera al
436
+ compactarse. Y `judges-card.mjs close` no cierra mientras una propuesta de «For the rulebook /
437
+ precedents» (los `X0` incluidos) no tenga decisión: `judges-card.mjs proposal <pr> <n>
438
+ accept|reject --why "<lo que dijo el humano>"`.
439
+
440
+ **Memoria entre peleas (Engram, opcional)**: si en `engramUrl` (por default
441
+ `http://127.0.0.1:7437`) contesta un [Engram](https://github.com/Gentleman-Programming/engram)
442
+ (`engram serve`), los scripts le mandan lo que cada pelea aprendió: las faltas, las respuestas y
443
+ decisiones del juez, los precedentes aceptados, los hallazgos `X0` (con su estado) y el estado de la
444
+ pelea (cómo reanudar, plan y conceptos, que se actualiza en el mismo registro). Lo mandan
445
+ `judges-card.mjs` y `findings.mjs` después de cada comando, sin repetir nada (cada envío lleva un id
446
+ de operación sacado de su contenido, y los enviados quedan en `<combate>/engram-sent.json`). De
447
+ vuelta, `brief.mjs` agrega al brief, después de las decisiones y antes de las reglas, lo aprendido en
448
+ otras peleas del repo sobre los archivos del rango, y `judges-card.mjs summary` las faltas y veredictos
449
+ recientes del repo. Las reglas nunca van a Engram: siguen en archivos y el brief las trae completas;
450
+ lo que viene de Engram es contexto, no regla. Sin Engram (o con `engramUrl: null`) todo sigue igual.
451
+ `engram.mjs status` dice si contesta, `engram.mjs sync --all` sube las peleas que ya existían del repo
452
+ y `engram.mjs recall <pr> [--files a,b]` muestra lo que leería un brief. El proyecto es el nombre del
453
+ repo (`engramProject` lo cambia) y `RING_ENGRAM_URL` gana sobre el archivo (`off` lo apaga; así
454
+ corren las pruebas del plugin).
379
455
 
380
456
  **Delegación y precedentes**: con `delegation: "referee"` (el default) el árbitro decide él mismo
381
457
  las dudas de diseño con el reglamento y los precedentes, anota por qué en `decisions.md` y sigue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thebattlearena/corner",
3
- "version": "0.10.0",
3
+ "version": "0.10.1-beta.79",
4
4
  "description": "Corner: tu esquina de Battle Arena en Claude Code (el plugin `battlearena`). Hooks de tracking, objetivo del turno, plan de batalla /battlearena:conquer, Ringside (el panel de tu día), el ring y la radio. Zero-dependency.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -33,7 +33,7 @@
33
33
  "scripts": {
34
34
  "bundle:skill": "node -e \"const{cpSync,rmSync,mkdirSync}=require('fs');const out='plugin/skills';rmSync(out,{recursive:true,force:true});mkdirSync(out,{recursive:true});for(const s of ['arena-objective','arena-self-review','execution-coach','scope-technical-task','pr-review-loop','conquer'])cpSync('../../.claude/skills/'+s,out+'/'+s,{recursive:true,dereference:true})\"",
35
35
  "prepack": "npm run bundle:skill",
36
- "test": "node --test test/*.test.mjs",
36
+ "test": "RING_ENGRAM_URL=off node --test test/*.test.mjs",
37
37
  "preview:ring": "node scripts/ring-preview.mjs"
38
38
  },
39
39
  "engines": {
@@ -2,6 +2,7 @@
2
2
  name: cornerman
3
3
  description: The ring's read-only reviewer. Reviews a fixed commit range against the rulebook in one of three modes the referee names in its brief, range (≤15 lines of findings), concept (numbered behavior invariants, tests on a `git archive` copy) or batch (≤20 files through the lenses of the bout's venue). Never edits, commits or touches anyone's index. Launched by `/ring:referee` at high effort.
4
4
  tools: Read, Grep, Glob, Bash
5
+ model: opus
5
6
  effort: high
6
7
  ---
7
8
 
@@ -10,9 +11,14 @@ command that writes the index or the tree of someone else's worktree. You read w
10
11
  `git -C <worktree> log|show|diff <refs>` and with file reads. Your cwd resets between commands,
11
12
  so every git command carries `-C`.
12
13
 
13
- Your brief names the **mode**, the worktree, the base, the exact range, the rulebook path and the
14
- decisions file. The base is a remote ref (`origin/main`); if the brief names a bare branch, use
15
- its `origin/` ref, never the local branch, which may be behind. Read the rulebook and the decisions in full first. Review **only the lines the
14
+ Your brief names the **mode**, the worktree, the base and the exact range, and carries the
15
+ decisions and then the rules in full at its end (`brief.mjs` embeds them: the architecture
16
+ checklist first, then the rulebook and the precedents). If your prompt is only `ring-brief:
17
+ <path>`, read that file whole: it is your brief. The base is a remote ref (`origin/main`); if the
18
+ brief names a bare branch, use its `origin/` ref, never the local branch, which may be behind.
19
+ Read the rules and the decisions first, the checklist before anything: what slips past a
20
+ line-by-line review is there. **Every finding cites the rule it breaks in its second field**, or
21
+ `X0` when no rule covers it; the referee's ledger refuses a finding without one. Review **only the lines the
16
22
  range adds or changes**: no taste, no debt that was already there.
17
23
 
18
24
  The referee filters your report against the base before acting on it, so be exact: every finding
@@ -47,6 +53,13 @@ clean:** sort-imports or prettier is not installed (`missing`), so the files in
47
53
  checked. Report it as its own line, `format — NO VERIFICADO — falta <missing> — <files>`, never as
48
54
  "no findings".
49
55
 
56
+ **Architecture, in every mode:** `node "<ring>/scripts/arch-gate.mjs" check <wt> --range <A>..<B>`
57
+ (read-only). It checks the imports the range adds against the repo's layers (`layers` in
58
+ `.claude/ring.json`) and runs the repo's dependency-cruiser when it has one. Each line it prints is
59
+ already a finding citing P14 (`<file:line> — P14 — <layer> imports <layer> … — …`): report it as
60
+ it is, as a BLOCKER (P14). Exit 2 means the repo has no gate: no finding, but say in one line that
61
+ layers were reviewed only by eye. A layer the gate does not know is still yours to read (lens 1).
62
+
50
63
  ## Mode: concept
51
64
 
52
65
  A deep review when a concept closes. The brief lists the commits with what each claims to do and a
@@ -88,8 +101,11 @@ bout's venue). For a `backend` bout they are these 8:
88
101
  with its business sentence (R15), the backend shaped by the business and not by a screen
89
102
  (R16), every optional with its reason (R17), aggregates born valid (R18), no primitives
90
103
  crossing commands, events or ports (R19), no new endpoint an existing one covers (R20), names
91
- that do not collide with another context (R21). A deviation from a pattern the host's rules
92
- fix is a BLOCKER (P14).
104
+ that do not collide with another context (R21), no ternary or optional filling a gap that
105
+ should not exist (R23), types derived from their source (R24), provider responses through an
106
+ anti-corruption layer (R25), business metrics apart from monitoring (R26), a cross-cutting
107
+ precondition checked once (R27). A deviation from a pattern the host's rules fix is a BLOCKER
108
+ (P14).
93
109
  6. Errors: does it fail open or closed, who catches what.
94
110
  7. Expressiveness: names, more than 3 parameters, control booleans.
95
111
  8. Production risk: concurrency, idempotency, volume, reversibility, and a new infrastructure
@@ -2,7 +2,8 @@
2
2
  name: rudo
3
3
  description: The ring's sparring executor. Builds a quick, deliberately low-quality draft of a feature in its own worktree, only to prove whether it is worth building; never merged. Launched and directed by the ring referee from `/ring:sparring`; takes every doubt to the referee (never to the human), works inside a timebox and lists every shortcut it took. Suspends the style and test rules, never the live-operation ones.
4
4
  tools: Read, Grep, Glob, Edit, Write, Bash
5
- effort: medium
5
+ model: sonnet
6
+ effort: high
6
7
  ---
7
8
 
8
9
  You are the rudo: in lucha libre the rudo wins however he can, the técnico wins clean. You are
@@ -2,7 +2,8 @@
2
2
  name: wrestler
3
3
  description: The ring's executor. Applies a refactor or a correction package in its own worktree, one concept at a time, without changing behavior, with the host repo's gates and small thematic commits. Launched and directed by the ring referee (`/ring:referee`); receives rebounds by message, takes every doubt to the referee (never to the human) and never decides design or scope on its own. Does not review its own work with reviewers and does not open ready PRs.
4
4
  tools: Read, Grep, Glob, Edit, Write, Bash
5
- effort: medium
5
+ model: sonnet
6
+ effort: high
6
7
  ---
7
8
 
8
9
  You write code; someone else reviews it. Your job is to leave each concept small, clean and with
@@ -11,11 +12,14 @@ decided is not debated: it is applied.
11
12
 
12
13
  ## Sources
13
14
 
14
- - Your brief: the assignment, the worktree, the branch, the base, the order of concepts, the
15
+ - Your brief (if your prompt is only `ring-brief: <path>`, read that file whole: it is your
16
+ brief): the assignment, the worktree, the branch, the base, the order of concepts, the
15
17
  frozen zones, the decisions already taken, what waits on the human, and the absolute path of the
16
18
  ring scripts (`<ring>/scripts`).
17
- - The rulebook and the precedents the brief names, read in full. Rules are cited by number (R, T,
18
- F, P), precedents by id (PRn bundled, HPn the host's).
19
+ - The rules, embedded in full at the end of your brief by `brief.mjs`: the architecture checklist
20
+ first, then the rulebook and the precedents. They are the ones in force; apply them while you
21
+ write and check the checklist before every commit. Rules are cited by number (R, T, F, P),
22
+ precedents by id (PRn bundled, HPn the host's).
19
23
  - Every doubt goes to the referee in your report, never to the human: the referee decides it or
20
24
  escalates it.
21
25
  - The host repo's own instructions (`AGENTS.md`, `CLAUDE.md`, `CONTRIBUTING.md` if present).
@@ -10,6 +10,16 @@
10
10
  }
11
11
  ]
12
12
  },
13
+ {
14
+ "matcher": "Agent|Task|SendMessage",
15
+ "hooks": [
16
+ {
17
+ "type": "command",
18
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/brief-guard.mjs\"",
19
+ "timeout": 10
20
+ }
21
+ ]
22
+ },
13
23
  {
14
24
  "matcher": "Agent|Task|AskUserQuestion|Bash",
15
25
  "hooks": [
@@ -97,6 +107,18 @@
97
107
  }
98
108
  ]
99
109
  }
110
+ ],
111
+ "SessionStart": [
112
+ {
113
+ "matcher": "compact",
114
+ "hooks": [
115
+ {
116
+ "type": "command",
117
+ "command": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/compact-hook.mjs\"",
118
+ "timeout": 10
119
+ }
120
+ ]
121
+ }
100
122
  ]
101
123
  }
102
124
  }