@bbcsoftwarefactory/cli 0.1.1 → 1.1.3
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/dist/audit-ledger.d.ts +2 -0
- package/dist/audit-ledger.js +71 -0
- package/dist/bbc-install.d.ts +2 -0
- package/dist/bbc-install.js +1278 -0
- package/dist/bbc.js +87 -3
- package/dist/bundle/commands/daily/SKILL.md +112 -0
- package/dist/bundle/commands/daily/adapters/command.md +17 -0
- package/dist/bundle/commands/daily/adapters/gemini.toml +17 -0
- package/dist/bundle/commands/issue-clean-and-close/SKILL.md +85 -0
- package/dist/bundle/commands/issue-clean-and-close/adapters/command.md +17 -0
- package/dist/bundle/commands/issue-clean-and-close/adapters/gemini.toml +17 -0
- package/dist/bundle/commands/issue-clean-and-close/references/policy.md +87 -0
- package/dist/bundle/commands/recap/SKILL.md +84 -0
- package/dist/bundle/commands/recap/adapters/command.md +17 -0
- package/dist/bundle/commands/recap/adapters/gemini.toml +17 -0
- package/dist/bundle/installer/clients.json +103 -0
- package/dist/bundle/skills/code-quality-gate/SKILL.md +58 -0
- package/dist/bundle/skills/code-quality-gate/references/gate-bigo.md +31 -0
- package/dist/bundle/skills/code-quality-gate/references/gate-earlyreturn.md +73 -0
- package/dist/bundle/skills/code-quality-gate/references/gate-typesafe.md +32 -0
- package/dist/bundle/skills/code-quality-gate/references/output-schema.yml +40 -0
- package/dist/bundle/skills/delivery-coordinator/SKILL.md +80 -0
- package/dist/bundle/skills/delivery-coordinator/references/hud-output.md +55 -0
- package/dist/bundle/skills/delivery-coordinator/references/intake.md +86 -0
- package/dist/bundle/skills/delivery-coordinator/references/issue-claim.md +143 -0
- package/dist/bundle/skills/delivery-coordinator/references/issue-dedup.md +38 -0
- package/dist/bundle/skills/delivery-coordinator/references/sleuth-regression-exercise.md +60 -0
- package/dist/bundle/skills/delivery-coordinator/references/visual-reference.md +45 -0
- package/dist/bundle/skills/delivery-coordinator/references/worktree-isolation.md +19 -0
- package/dist/bundle/skills/documentation-steward/SKILL.md +43 -0
- package/dist/bundle/skills/documentation-steward/references/discovery.md +17 -0
- package/dist/bundle/skills/documentation-steward/references/handoff.md +15 -0
- package/dist/bundle/skills/greptile-review-loop/SKILL.md +56 -0
- package/dist/bundle/skills/greptile-review-loop/references/review-protocol.md +37 -0
- package/dist/bundle/skills/issue-reviewer/SKILL.md +84 -0
- package/dist/bundle/skills/issue-reviewer/references/review-format.md +100 -0
- package/dist/bundle/skills/issue-reviewer/references/triage.md +105 -0
- package/dist/bundle/skills/question-gate/SKILL.md +64 -0
- package/dist/bundle/skills/question-gate/references/client-hooks.md +111 -0
- package/dist/bundle/skills/question-gate/references/diagram-routing.md +58 -0
- package/dist/bundle/skills/question-gate/tests/fixtures/question-corpus.json +481 -0
- package/dist/bundle/skills/regression-testing/SKILL.md +49 -0
- package/dist/bundle/skills/regression-testing/references/evidence-record.md +35 -0
- package/dist/bundle/skills/requirements-spec/SKILL.md +59 -0
- package/dist/bundle/skills/risk-scout/SKILL.md +53 -0
- package/dist/bundle/skills/risk-scout/references/risk-matrix.md +49 -0
- package/dist/bundle/skills/skill-clean-architecture/SKILL.md +53 -0
- package/dist/bundle/skills/skill-clean-architecture/references/layer-rules.md +22 -0
- package/dist/bundle/skills/skill-clean-architecture/references/source-headers.md +30 -0
- package/dist/bundle/skills/skill-clean-architecture/tests/fixtures/bigo/bad-utf8.js +1 -0
- package/dist/bundle/skills/skill-clean-architecture/tests/fixtures/bigo/edge-crlf.ts +6 -0
- package/dist/bundle/skills/skill-clean-architecture/tests/fixtures/bigo/edge-mixed.ts +15 -0
- package/dist/bundle/skills/skill-clean-architecture/tests/fixtures/bigo/empty.js +0 -0
- package/dist/bundle/skills/skill-clean-architecture/tests/fixtures/bigo/no-newline.js +1 -0
- package/dist/bundle/skills/skill-clean-architecture/tests/fixtures/bigo.expected.yml +95 -0
- package/dist/bundle/skills/tool-depot/SKILL.md +47 -0
- package/dist/bundle/skills/tool-depot/references/checkout.md +29 -0
- package/dist/bundle/skills/tool-depot/references/loki-read.md +41 -0
- package/dist/bundle/skills/tool-depot/references/readonly-access.md +84 -0
- package/dist/bundle/skills/tool-depot/references/tool-catalog.json +47 -0
- package/dist/bundle/skills/tool-depot/scripts/loki-runtime-logs.py +305 -0
- package/dist/bundle/skills/tool-depot/tests/loki-runtime-logs.test.sh +101 -0
- package/dist/bundle/skills/watcher-observability/SKILL.md +72 -0
- package/dist/bundle/skills/watcher-observability/references/batch-protocol.md +44 -0
- package/dist/bundle/skills/watcher-observability/references/configuration.md +31 -0
- package/dist/bundle/skills/watcher-observability/references/error-scan.md +102 -0
- package/dist/bundle/skills/watcher-observability/references/live-protocol.md +49 -0
- package/dist/bundle/skills/watcher-observability/references/server-account.md +72 -0
- package/dist/bundle/skills/watcher-observability/server/watcher-gate.sh +51 -0
- package/dist/bundle/skills/watcher-observability/tests/watcher-gate.test.sh +113 -0
- package/dist/bundle/skills/watcher-observability/watcher.json +1 -0
- package/dist/bundle/skills/workflow-auditor/SKILL.md +53 -0
- package/dist/bundle/skills/workflow-auditor/references/audit-protocol.md +49 -0
- package/dist/bundle/skills/workflow-auditor/references/ledger.md +122 -0
- package/dist/change-lane/classification.js +3 -1
- package/dist/check-issue-claim.d.ts +2 -0
- package/dist/check-issue-claim.js +146 -0
- package/dist/check-worktree-guard.d.ts +2 -0
- package/dist/check-worktree-guard.js +114 -0
- package/dist/error-scan.d.ts +3 -0
- package/dist/error-scan.js +216 -0
- package/dist/export-public.d.ts +9 -0
- package/dist/export-public.js +274 -0
- package/dist/fetch-issue-attachments.d.ts +22 -0
- package/dist/fetch-issue-attachments.js +325 -0
- package/dist/issue-claim/evaluation.d.ts +66 -0
- package/dist/issue-claim/evaluation.js +259 -0
- package/dist/issue-claim/loaders.d.ts +5 -0
- package/dist/issue-claim/loaders.js +116 -0
- package/dist/list-zed-commands.d.ts +7 -0
- package/dist/list-zed-commands.js +288 -0
- package/dist/plan-issue-triage.d.ts +3 -0
- package/dist/plan-issue-triage.js +404 -0
- package/dist/question-gate/ledger.d.ts +5 -0
- package/dist/question-gate/ledger.js +115 -0
- package/dist/question-gate/rules.d.ts +40 -0
- package/dist/question-gate/rules.js +483 -0
- package/dist/recap/board.d.ts +5 -0
- package/dist/recap/board.js +384 -0
- package/dist/recap/git-and-github.d.ts +11 -0
- package/dist/recap/git-and-github.js +620 -0
- package/dist/recap/report-and-hud.d.ts +2 -0
- package/dist/recap/report-and-hud.js +294 -0
- package/dist/recap/time-and-refs.d.ts +27 -0
- package/dist/recap/time-and-refs.js +148 -0
- package/dist/recap.d.ts +2 -0
- package/dist/recap.js +217 -0
- package/dist/render-workflow.js +12 -14
- package/dist/resolve-containers.d.ts +2 -0
- package/dist/resolve-containers.js +96 -0
- package/dist/review-loop.d.ts +7 -0
- package/dist/review-loop.js +622 -0
- package/dist/save-counts.d.ts +2 -0
- package/dist/save-counts.js +191 -0
- package/dist/summarize-logs.d.ts +2 -0
- package/dist/summarize-logs.js +41 -0
- package/dist/sweep-github.d.ts +10 -0
- package/dist/sweep-github.js +453 -0
- package/dist/sweep-issues.d.ts +56 -0
- package/dist/sweep-issues.js +650 -0
- package/dist/sweep.d.ts +2 -0
- package/dist/sweep.js +301 -0
- package/dist/triage-question.d.ts +2 -0
- package/dist/triage-question.js +189 -0
- package/dist/validate-skills.d.ts +2 -0
- package/dist/validate-skills.js +48 -0
- package/dist/watch-live.d.ts +7 -0
- package/dist/watch-live.js +83 -0
- package/dist/watcher/config.d.ts +11 -0
- package/dist/watcher/config.js +265 -0
- package/dist/watcher/live-classifier.d.ts +52 -0
- package/dist/watcher/live-classifier.js +510 -0
- package/dist/watcher/safe-fs.d.ts +9 -0
- package/dist/watcher/safe-fs.js +159 -0
- package/dist/watcher/stream.d.ts +27 -0
- package/dist/watcher/stream.js +340 -0
- package/dist/watcher/summarizer.d.ts +19 -0
- package/dist/watcher/summarizer.js +121 -0
- package/dist/wave3/process.d.ts +14 -0
- package/dist/wave3/process.js +84 -0
- package/dist/wave4/process.d.ts +14 -0
- package/dist/wave4/process.js +128 -0
- package/dist/workflow/render.d.ts +1 -1
- package/dist/workflow/render.js +1 -1
- package/dist/workflow-auditor/audit.d.ts +27 -0
- package/dist/workflow-auditor/audit.js +583 -0
- package/dist/workflow-auditor/ledger-io.d.ts +5 -0
- package/dist/workflow-auditor/ledger-io.js +99 -0
- package/dist/workflow-auditor/skills-validator.d.ts +10 -0
- package/dist/workflow-auditor/skills-validator.js +533 -0
- package/dist/worktree-guard/evaluation.d.ts +19 -0
- package/dist/worktree-guard/evaluation.js +84 -0
- package/dist/worktree-guard/git.d.ts +3 -0
- package/dist/worktree-guard/git.js +61 -0
- package/package.json +32 -33
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Issue review template and attachment rules
|
|
2
|
+
|
|
3
|
+
## Resolving private GitHub attachments
|
|
4
|
+
|
|
5
|
+
Raw `gh issue view` returns `https://github.com/user-attachments/assets/<uuid>`, which returns `404` to unauthenticated `curl` on private repositories.
|
|
6
|
+
|
|
7
|
+
Always resolve attachments via `Accept: application/vnd.github.full+json` (`body_html`), which returns short-lived signed `https://private-user-images.githubusercontent.com/...` URLs:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx -y @bbcsoftwarefactory/cli fetch-issue-attachments --repo <owner/repo> --issue <number>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
After running the script:
|
|
14
|
+
1. Open every `local_path` image with the client's image/file reader.
|
|
15
|
+
2. Describe **only what is visibly present** (screen/route, highlighted UI elements, arrows/circles, error text).
|
|
16
|
+
3. Keep any remaining ambiguity as an explicit `🟡` note so Product/Engineering can confirm before coding.
|
|
17
|
+
4. Keep the original `body` attachment markup (`<img ... />` or ``) intact under `## Evidencia` when rewriting the issue.
|
|
18
|
+
5. `## Evidencia` always holds at least one image. If the issue has none, add a sanitized capture following the [visual reference rule](../../delivery-coordinator/references/visual-reference.md), or a `🟡 GAP visual: <reason>` line when no safe image exists.
|
|
19
|
+
|
|
20
|
+
## Title conventions
|
|
21
|
+
|
|
22
|
+
- Bug: `fix(<area>): <concise observable mismatch>` (e.g., `fix(flows-ui): dim edit action button while response drawer is open`)
|
|
23
|
+
- Enhancement / Feature: `feat(<area>): <concise user capability>`
|
|
24
|
+
- Keep titles <= 75 characters, specific, and in the issue's language (`es` / `en` / `pt`).
|
|
25
|
+
|
|
26
|
+
## Body structure (match `.github/ISSUE_TEMPLATE/` when available)
|
|
27
|
+
|
|
28
|
+
For `bug_report.md` in BuilderBot repositories:
|
|
29
|
+
|
|
30
|
+
```markdown
|
|
31
|
+
## Qué pasa
|
|
32
|
+
<!-- 1–3 frases claras del comportamiento actual observado -->
|
|
33
|
+
|
|
34
|
+
## Qué esperabas
|
|
35
|
+
<!-- Comportamiento correcto esperado -->
|
|
36
|
+
|
|
37
|
+
## Explicación visual (según captura/adjunto)
|
|
38
|
+
<!-- Qué muestra exactamente la pantalla, flechas o resaltados del adjunto -->
|
|
39
|
+
|
|
40
|
+
## Cómo reproducirlo
|
|
41
|
+
1. ...
|
|
42
|
+
2. ...
|
|
43
|
+
|
|
44
|
+
## Alcance
|
|
45
|
+
- Afecta a: ...
|
|
46
|
+
- ¿Se puede reproducir siempre?: sí / no / a confirmar
|
|
47
|
+
|
|
48
|
+
## Evidencia
|
|
49
|
+
<!-- Conservar aquí los <img> / enlaces originales del issue sin eliminarlos. Siempre al menos una imagen sanitizada, o una línea "🟡 GAP visual: <motivo>". -->
|
|
50
|
+
|
|
51
|
+
## Área
|
|
52
|
+
- [x] ...
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
For `feature_request.md`, map to `Qué quieres poder hacer`, `Por qué`, `Cómo lo imaginas`, `Criterio de aceptación`, `Evidencia` (if attachments exist), and `Área`.
|
|
56
|
+
|
|
57
|
+
## Evidence verdict & Depot/Watcher log validation
|
|
58
|
+
|
|
59
|
+
When reviewing a bug or incident claim, validate both codebase/PR state and runtime logs (via `tool-depot` -> `watcher-observability` or an existing sanitized `tmp_logs/*/report.json`):
|
|
60
|
+
|
|
61
|
+
| Verdict | Meaning | Required evidence |
|
|
62
|
+
|---|---|---|
|
|
63
|
+
| `🟢 CONFIRMADO` | Real issue supported by facts | Code/UI reproduces or allows the failure **and** attachments and/or sanitized Watcher logs corroborate the symptom |
|
|
64
|
+
| `🟡 SIN CONFIRMAR EN LOGS (GAP)` | Plausible in code, but logs did not settle it | Missing SSH authorization/target, no `report.json`, or bounded/incomplete Watcher capture without matching events (absence in a bounded sample never proves non-occurrence) |
|
|
65
|
+
| `🟠 YA RESUELTO / EN CURSO` | Already fixed or covered elsewhere | Merged PR, active PR, or current code in the base branch already addresses the issue (cite PR/commit) |
|
|
66
|
+
| `🔴 POSIBLE FALSA ALARMA` | Contradicted by positive evidence | Current code structurally prevents the reported path, or sanitized logs/traces prove a different cause/component or non-occurrence under the exact traced flow |
|
|
67
|
+
|
|
68
|
+
### Sanitization rules for `## Evidencia`
|
|
69
|
+
- Summarize only Watcher mode, coverage limits (`cap`, `partial`, `deadline`), aggregate severity/category counts, and redacted exception/code/frame kinds (`TypeError`, `HTTP_5xx`, `line N`).
|
|
70
|
+
- Never paste raw logs, exact SSH aliases, container names/IDs, credentials, or unredacted messages into GitHub issues or chat.
|
|
71
|
+
|
|
72
|
+
## Chat HUD Output
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
🎮 QUEST ACTUAL ─ Revisar Issue #<number> (<owner/repo>)
|
|
76
|
+
│ 📍 Checkpoint: Borrador listo (sin editar remoto aún)
|
|
77
|
+
│
|
|
78
|
+
├── 📎 Adjuntos ································ 🟢 <N>/<N> inspeccionados | 🟡 <gap>
|
|
79
|
+
├── 🖼️ Referencia visual ······················ 🟢 <N> imagen(es) en el borrador | 🟡 GAP visual: <motivo>
|
|
80
|
+
├── 🔎 PRs / Código ··························· 🟢 vigente | 🟠 cubierto por #<pr>
|
|
81
|
+
├── 📜 Logs (Depot/Watcher) ··················· 🟢 validado | 🟡 gap/sin auth | 🔴 contradice
|
|
82
|
+
├── 📋 Plantilla ······························· 🟢 <bug_report.md | feature_request.md>
|
|
83
|
+
├── 🔍 Ambigüedades ···························· 🟢 ninguna | 🟡 <pregunta breve>
|
|
84
|
+
├── 👤 Asignación ······························ 🟢 @<autor> (autor del issue) | ⚪ ya asignado | 🟡 TR2 bot / TR3 sin acceso
|
|
85
|
+
├── 🏷️ Etiquetas / Prioridad ·················· 🟢 +<label> −<label> · P<n> (<nivel>) | 🟡 TR4 / TR8 <gap>
|
|
86
|
+
└── ⚖️ Veredicto ······························ 🟢 CONFIRMADO | 🟡 SIN CONFIRMAR | 🟠 YA RESUELTO | 🔴 POSIBLE FALSA ALARMA
|
|
87
|
+
|
|
88
|
+
🟡 BOSS GATE ─ Product Manager / Issue Author
|
|
89
|
+
│
|
|
90
|
+
├── ❓ ¿Aplico este título y descripción mejorados y el triage (asignar a @<autor>, etiquetas y P<n>) en el issue #<number>? (o ¿comento y cierro como falsa alarma / ya resuelto?)
|
|
91
|
+
│
|
|
92
|
+
├── 👉 Recomendado: [A]
|
|
93
|
+
│ └── Conserva los adjuntos originales, deja al autor como responsable de confirmar y prioriza con evidencia (o documenta el descarte)
|
|
94
|
+
│
|
|
95
|
+
└── ⚡ Opciones
|
|
96
|
+
├── [A] Actualizar issue #<number> en GitHub, aplicar el triage y comentarlo (o comentar/cerrar si es falsa alarma/resuelto)
|
|
97
|
+
└── [B] Ajustar el borrador o el triage primero (o capturar logs con Watcher vía Tool Depot)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
The triage plan, its rules, and the comment that states it are in [triage.md](triage.md).
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Triage: assign the author, label, and prioritize
|
|
2
|
+
|
|
3
|
+
Every issue review ends with a triage plan: the issue author is assigned, the labels are reviewed against what the issue actually is, and the issue gets one priority. The reviewer (an LLM) judges type, area, and priority from the evidence; `bbc plan-issue-triage` turns that judgment into the only GitHub writes allowed. The triage is applied only after the person approves the exact plan at the Boss Gate, and a comment on the issue always states what was done and why.
|
|
4
|
+
|
|
5
|
+
Every rule below has an ID. The CLI command decides the `TR*` rules; `workflow-auditor` checks `I1`–`I2` in the ledger. When an LLM reading this file and the CLI disagree, the CLI's verdict stands and the difference is reported.
|
|
6
|
+
|
|
7
|
+
## Why the author is assigned
|
|
8
|
+
|
|
9
|
+
The author reported what they saw, so they own confirming it: answering questions, validating the fix, and closing the loop. The assignment is a **reporter assignment**, not a claim to build the fix. Without the claim label (`status:in-progress`), [`bbc check-issue-claim`](../../delivery-coordinator/references/issue-claim.md#reporter-assignment) does not treat the author as holding the issue, so a developer can still claim it.
|
|
10
|
+
|
|
11
|
+
## 1. Read (Tool Depot `github-read` / `check-issue-triage`)
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
gh api repos/<owner>/<repo>/issues/<n> > issue.json
|
|
15
|
+
gh api --paginate --slurp "repos/<owner>/<repo>/labels?per_page=100" > labels.json
|
|
16
|
+
gh api -i repos/<owner>/<repo>/assignees/<author> # status 204: yes, 404: no
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Any other result of the assignability call (network error, 403) is `unknown`.
|
|
20
|
+
|
|
21
|
+
## 2. Judge (LLM)
|
|
22
|
+
|
|
23
|
+
Decide from the evidence already gathered in the review (text, attachments, code, PRs, sanitized logs), never from the title alone. Write the proposal to `proposal.json`:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{"priority": "P1", "add": ["bug", "area:flows"], "remove": ["enhancement"],
|
|
27
|
+
"rationale": "Saving any flow fails for every bot in production (screenshot + 42 HTTP_5xx in Watcher); no workaround."}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
| Decision | How to judge |
|
|
31
|
+
|---|---|
|
|
32
|
+
| Type | `bug` when current behavior contradicts what the product promises; `enhancement` / `feature` for a new capability; `documentation` or `question` when nothing is broken. Remove a type label the review contradicts. |
|
|
33
|
+
| Area | The component or route the review identified (`area:*` or the repository's equivalent). Only areas with evidence; ambiguity stays a `🟡` note. |
|
|
34
|
+
| Verdict labels | `🔴 POSIBLE FALSA ALARMA` → `invalid` or `needs-info` if they exist; `🟠 YA RESUELTO` → `duplicate` if another issue covers it; `🟡 SIN CONFIRMAR` → `needs-info` when the author must supply proof. |
|
|
35
|
+
| Priority | The rubric below. Pick the lowest level the evidence supports; a hypothesis never raises the level. |
|
|
36
|
+
|
|
37
|
+
| Level | Meaning | Typical evidence |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| `P0` Crítica | Production down, data loss or corruption, security exposure, or payments blocked; no workaround. | Many customers or all bots affected; confirmed in logs or code. |
|
|
40
|
+
| `P1` Alta | A core feature is broken or wrong for many users, or the workaround is costly. | Confirmed, reproducible, recurring. |
|
|
41
|
+
| `P2` Media | A secondary feature fails, or a core one with a reasonable workaround. | Limited scope or intermittent. |
|
|
42
|
+
| `P3` Baja | Cosmetic, copy, minor UX, or a nice-to-have improvement. | No functional impact. |
|
|
43
|
+
|
|
44
|
+
The `rationale` names the facts behind the level (who is affected, how often, workaround, evidence) in the issue's language. It is pasted into the comment, so it must be sanitized.
|
|
45
|
+
|
|
46
|
+
## 3. Plan (`plan-issue-triage`)
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx -y @bbcsoftwarefactory/cli plan-issue-triage --repo <owner>/<repo> \
|
|
50
|
+
--issue-json issue.json --labels-json labels.json --proposal-json proposal.json \
|
|
51
|
+
--author-assignable yes|no|unknown [--claim-label status:in-progress]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The command resolves label names to the repository's exact spelling, derives the priority label from the level when the proposal names none, replaces any other priority label on the issue, and prints the exact `commands`.
|
|
55
|
+
|
|
56
|
+
| Verdict | Exit | Next |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| `ready` | 0 | Show the plan at the Boss Gate. |
|
|
59
|
+
| `ready-with-gaps` | 0 | Show the plan and each gap; the comment states them. |
|
|
60
|
+
| `invalid-proposal` | 1 | Fix the proposal and rerun; no commands are printed. |
|
|
61
|
+
| `unusable` | 2 | Report what is missing; do not triage from memory. |
|
|
62
|
+
|
|
63
|
+
| Rule | Condition | Effect |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| `TR1` | An input is missing or malformed, the issue is not open, the priority is not `P0`–`P3`, the rationale is empty, or a label is both added and removed. | `unusable` |
|
|
66
|
+
| `TR2` | The author is a bot (`user.type` `Bot` or a `[bot]` login). | Gap: nobody is assigned. |
|
|
67
|
+
| `TR3` | The author cannot be assigned (`no`) or that was not verified (`unknown`). | Gap: nobody is assigned. |
|
|
68
|
+
| `TR4` | A proposed label does not exist in the repository. | Gap: the label is dropped; the workflow never creates labels. |
|
|
69
|
+
| `TR5` | The proposal adds or removes a `status:*` label or the claim label. | `invalid-proposal`: those belong to the delivery workflow. |
|
|
70
|
+
| `TR6` | More than one priority label would be added. | `invalid-proposal` |
|
|
71
|
+
| `TR7` | The priority label does not match the level, or several repository labels mean that level and none was named. | `invalid-proposal` |
|
|
72
|
+
| `TR8` | The repository has no label for the level. | Gap: the priority goes in the comment only; a maintainer may create the label. |
|
|
73
|
+
|
|
74
|
+
Priority labels are recognized by name: `priority:*`, `prioridad:*`, `prio:*`, or `P0`–`P3`, with level words `critical`/`crítica`/`urgent`, `high`/`alta`, `medium`/`media`, `low`/`baja`.
|
|
75
|
+
|
|
76
|
+
## 4. Boss Gate, apply, and say it (Tool Depot `github-write` / `triage-approved-issue`)
|
|
77
|
+
|
|
78
|
+
Show the plan (assignee, `+`/`−` labels, priority with rationale, gaps) at the issue-reviewer Boss Gate together with the refined draft. The person's approval of that exact plan covers the `commands` and the comment that states them; any change to the plan needs a new approval.
|
|
79
|
+
|
|
80
|
+
Run the `commands` exactly as printed: add the author (never remove or add anyone else), add labels, remove labels. Then post one comment (`comment-approved-issue`) in the issue's language, after the triage, with a visual reference ([rule](../../delivery-coordinator/references/visual-reference.md)); reusing the issue's own attachment is enough. When the body was also refined, this one comment covers both.
|
|
81
|
+
|
|
82
|
+
```markdown
|
|
83
|
+
## 🏷️ Triage
|
|
84
|
+
- **Asignado a:** @<author> — quien abrió el issue; queda como responsable de confirmar el comportamiento, responder dudas y validar la solución.
|
|
85
|
+
- **Etiquetas:** +`bug` +`area:flows` −`enhancement`
|
|
86
|
+
- **Prioridad:** P1 (Alta) — <rationale>
|
|
87
|
+
- 🟡 <one line per gap: bot or non-assignable author, dropped label, missing priority label>
|
|
88
|
+
|
|
89
|
+

|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Ledger record and rules checked by `workflow-auditor`
|
|
93
|
+
|
|
94
|
+
When a delivery ledger exists, record the read, the triage write, and the comment as Tool Depot requests and uses on the same target (`owner/repo#n`):
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{"id": "TD-4", "requester": "issue-reviewer", "tool": "github-write", "purpose": "triage-approved-issue",
|
|
98
|
+
"target": "example/repo#7", "operation": "assign carla; +bug +priority:high -priority:low",
|
|
99
|
+
"disposition": "eligible", "authorization": "AUTH-2"}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
| Rule | Violation |
|
|
103
|
+
|---|---|
|
|
104
|
+
| `I1` | A `triage-approved-issue` use with no earlier eligible `check-issue-triage` use on the same issue. |
|
|
105
|
+
| `I2` | A `triage-approved-issue` use with no later `comment-approved-issue` use on the same issue. |
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: question-gate
|
|
3
|
+
description: "Trigger: before stopping, before asking the user, Question Gate, should I ask, next step question. Run before finishing a turn or asking the user a question: route delegable questions to the owning diagram skill and surface only genuine human approval gates."
|
|
4
|
+
license: Apache-2.0
|
|
5
|
+
compatibility: Requires Node.js 22.18+ for the bundled @bbcsoftwarefactory/cli triage command.
|
|
6
|
+
metadata:
|
|
7
|
+
author: bbc-skill-internals
|
|
8
|
+
version: "1.1"
|
|
9
|
+
pre_hook: "AGENTS.md -> npx -y @bbcsoftwarefactory/cli triage-question --question"
|
|
10
|
+
post_hook: "stop / AfterAgent / experimental.idle -> npx -y @bbcsoftwarefactory/cli triage-question --stdin --format <client>"
|
|
11
|
+
post_install: "configure client stop hook JSON per references/client-hooks.md"
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Activation Contract
|
|
15
|
+
|
|
16
|
+
Run before finishing a turn with a question or pausing to ask the user what to do next, across Cursor, Claude, Claude Code, Codex, Gemini CLI, OpenCode, and Pi. Answers one question: *"Do I really need to ask the user this, or can a skill in the workflow diagram resolve it (or is it already authorized)?"*
|
|
17
|
+
|
|
18
|
+
**Company role:** Workflow Gatekeeper. It routes delegable work back to the skill that owns it in the diagram; it never grants approvals on a person's behalf.
|
|
19
|
+
|
|
20
|
+
## Hard Rules
|
|
21
|
+
|
|
22
|
+
- **Never offload agent work to the user.** Questions like *"¿prefieres probarlo primero en local?"*, *"should I run the tests?"*, *"does this affect docs?"*, *"is there a duplicate issue?"*, or *"what should we do next?"* belong to skills in the diagram (`regression-testing`, `code-quality-gate`, `documentation-steward`, `risk-scout`, `greptile-review-loop`, `workflow-auditor`, `tool-depot`, `delivery-coordinator`), never to the user.
|
|
23
|
+
- **Never bundle a delegable task with a human approval.** Split compound questions first: resolve every delegable clause through its owning skill, verify prerequisites, and check whether any human decision actually remains.
|
|
24
|
+
- **Check existing authorizations before asking.** Read `bbc-delivery-ledger.json` (when present) and the session instructions. If a person already authorized `implement` or `commit_pr`, do not ask again. Never invent an authorization (`A2`).
|
|
25
|
+
- **Escalate only genuine human gates.** Only people decide `Product Manager` open product trade-offs, `Tech Lead` change authorization, `Commit & PR` / `publish-approved-issue` when not yet authorized, `Code Owner` merge, `Release Owner` deployment, and `Tool Depot` `needs-approval` targets. Keep each remaining human question to one focused decision with a clear recommendation and why.
|
|
26
|
+
|
|
27
|
+
## Decision Gates
|
|
28
|
+
|
|
29
|
+
| Verdict from `triage-question` | Action |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `no_question` | Safe to finish the turn. |
|
|
32
|
+
| `allow_question` | Genuine human gate only (`human_approval_required`). Present the single focused decision with your recommendation and wait for the person. |
|
|
33
|
+
| `block_question` (`do_not_ask`) | Do **not** ask the blocked clause. Execute the named `resolved_by` diagram skill(s) (or proceed directly if `already_authorized`), then rerun the gate if a separate human approval still remains. |
|
|
34
|
+
| `block_question` with a `needs_classification` clause | No skill or human rule recognised the clause. Route it to its owning skill, or, if a person must decide, declare the owner with a `🟡 BOSS GATE ─ <Role>` header (`PM`, `Tech Lead`, `Commit & PR`, `Code Owner`, `Release Owner`) and rerun the gate: a valid declared role turns it into `allow_question` for that role. An invented role stays blocked. |
|
|
35
|
+
| `block_format` | Reformat the human decision or choice prompt using the Quest-Tree HUD + `🟡 BOSS GATE` (`❓`, `👉 Recomendado: [A]`, `⚡ Opciones` with `[A]`/`[B]`) before stopping. |
|
|
36
|
+
| `unusable` | Fix invalid CLI arguments or malformed ledger JSON before proceeding. |
|
|
37
|
+
|
|
38
|
+
## Execution Steps
|
|
39
|
+
|
|
40
|
+
1. Before sending any final message that asks the user a question (or pauses for next steps), run:
|
|
41
|
+
```bash
|
|
42
|
+
npx -y @bbcsoftwarefactory/cli triage-question --question "<draft question>"
|
|
43
|
+
```
|
|
44
|
+
(From a delivery worktree, it automatically reads `bbc-delivery-ledger.json` unless `--ledger` or `--no-ledger` is passed.)
|
|
45
|
+
2. Inspect `verdict`, `clauses`, `resolved_by`, and `rewrite_suggestion` in the JSON output.
|
|
46
|
+
3. For every clause marked `delegate_to_skill`, invoke that diagram skill (or run the verification/check using the repository's tools) instead of asking the user.
|
|
47
|
+
4. For any clause marked `already_authorized`, proceed directly with that authorized stage (`Commit & PR`, etc.).
|
|
48
|
+
5. Only if a `human_approval_required` clause remains after prerequisites pass, ask the user that isolated decision using the [diagram routing table](references/diagram-routing.md).
|
|
49
|
+
|
|
50
|
+
## Companion Handoffs
|
|
51
|
+
|
|
52
|
+
Route each blocked clause to the skill named by `resolved_by`: `regression-testing`, `code-quality-gate`, `skill-clean-architecture`, `documentation-steward`, `risk-scout`, `greptile-review-loop`, `workflow-auditor`, `watcher-observability`, `tool-depot`, `requirements-spec`, or `delivery-coordinator`.
|
|
53
|
+
|
|
54
|
+
Check the active skill catalog for the named companion before relying on it; if a companion is missing, perform the equivalent check with the host repository's tools when authorized rather than pushing the work onto the user.
|
|
55
|
+
|
|
56
|
+
## Output Contract
|
|
57
|
+
|
|
58
|
+
- **Machine / hook mode (`triage-question`):** return `verdict`, `resolved_by`, `human_gates`, and `rewrite_suggestion` (if any) without leaking secrets, tokens, or raw logs.
|
|
59
|
+
- **Human-facing chat mode (`allow_question`):** format the single isolated `human_approval_required` gate as a compact **Quest-Tree Boss Gate** (`🟡 BOSS GATE ─ <Role>`, `❓` 1-line question, `👉 Recomendado: [A]`, `⚡ Opciones: [A] / [B]`), matching the user's language for fast decisions. See [diagram-routing.md](references/diagram-routing.md#agile-decision-card).
|
|
60
|
+
|
|
61
|
+
## References
|
|
62
|
+
|
|
63
|
+
- [Diagram routing table and examples](references/diagram-routing.md)
|
|
64
|
+
- [Pre-exit hook setup for Cursor, Claude Code, Codex, and CLI clients](references/client-hooks.md)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Client integration for Question Gate
|
|
2
|
+
|
|
3
|
+
Run `bbc triage-question` both **preventively** (via `AGENTS.md` / rules before drafting a question) and **deterministically** (via each client's native turn-end / stop hook).
|
|
4
|
+
|
|
5
|
+
## Universal command (every client)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx -y @bbcsoftwarefactory/cli triage-question --question "<draft question>"
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
- Exit `0`: `no_question` or `allow_question` (genuine human approval gate only).
|
|
12
|
+
- Exit `1`: `block_question` — at least one clause can be resolved by a skill in the diagram (`delegate_to_skill`) or is `already_authorized` in the delivery ledger — or `block_format` when `--require-hud` is set and a human gate / choice offer lacks the `🟡 BOSS GATE` format.
|
|
13
|
+
- Exit `2`: `unusable` input or malformed ledger.
|
|
14
|
+
|
|
15
|
+
In client hook modes (`--format cursor-hook`, `claude-hook`, `codex-hook`, `gemini-hook`), `triage-question` enforces the `🟡 BOSS GATE` format automatically for any genuine human decision or numbered choice offer (`Si quieres: 1. ... 2. ...`) unless `--no-hud` is passed.
|
|
16
|
+
|
|
17
|
+
## Cursor (`.cursor/hooks.json` or `~/.cursor/hooks.json`)
|
|
18
|
+
|
|
19
|
+
Cursor's `stop` hook receives `status`, `loop_count`, and `transcript_path` (`.jsonl`), and returns `{"followup_message": "..."}` to continue the turn automatically. When `status != "completed"` or `loop_count >= 2`, `triage-question` returns `{}` so user aborts or loop limits never spin.
|
|
20
|
+
|
|
21
|
+
Project-level `.cursor/hooks.json`:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"version": 1,
|
|
26
|
+
"hooks": {
|
|
27
|
+
"stop": [
|
|
28
|
+
{
|
|
29
|
+
"command": "npx -y @bbcsoftwarefactory/cli triage-question --stdin --format cursor-hook",
|
|
30
|
+
"loop_limit": 2
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
(Cursor also reads Claude Code `.claude/settings.json` `Stop` hooks automatically when Third-Party Imports is enabled.)
|
|
38
|
+
|
|
39
|
+
## Claude Code (`.claude/settings.json` or `~/.claude/settings.json`)
|
|
40
|
+
|
|
41
|
+
Claude Code's `Stop` hook receives `last_assistant_message` and `stop_hook_active`, and returns `{"decision": "block", "reason": "..."}`. When `stop_hook_active` is `true`, `triage-question` returns `{}` to prevent infinite loops.
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"hooks": {
|
|
46
|
+
"Stop": [
|
|
47
|
+
{
|
|
48
|
+
"hooks": [
|
|
49
|
+
{
|
|
50
|
+
"type": "command",
|
|
51
|
+
"command": "npx -y @bbcsoftwarefactory/cli triage-question --stdin --format claude-hook"
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## OpenAI Codex CLI (`.codex/hooks.json` or `~/.codex/hooks.json`)
|
|
61
|
+
|
|
62
|
+
Codex CLI supports `Stop` hooks with `last_assistant_message` and `stop_hook_active`, returning `{"decision": "block", "reason": "..."}`. Review and trust non-managed hooks with `/hooks` in the CLI.
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"hooks": {
|
|
67
|
+
"Stop": [
|
|
68
|
+
{
|
|
69
|
+
"hooks": [
|
|
70
|
+
{
|
|
71
|
+
"type": "command",
|
|
72
|
+
"command": "npx -y @bbcsoftwarefactory/cli triage-question --stdin --format codex-hook",
|
|
73
|
+
"timeout": 10
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Also place the preventive rule in `~/.codex/AGENTS.md` (user-wide) or the repository's `AGENTS.md`.
|
|
83
|
+
|
|
84
|
+
## Gemini CLI (`.gemini/settings.json` or `~/.gemini/settings.json`)
|
|
85
|
+
|
|
86
|
+
Gemini CLI uses the `AfterAgent` hook, which passes `prompt_response` and `stop_hook_active` and retries when the hook returns `{"decision": "deny", "reason": "..."}` with exit code `0` (`continue: false` would halt the session, so `--format gemini-hook` uses `decision: "deny"`).
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"hooks": {
|
|
91
|
+
"AfterAgent": [
|
|
92
|
+
{
|
|
93
|
+
"matcher": "*",
|
|
94
|
+
"hooks": [
|
|
95
|
+
{
|
|
96
|
+
"name": "question-gate",
|
|
97
|
+
"type": "command",
|
|
98
|
+
"command": "npx -y @bbcsoftwarefactory/cli triage-question --stdin --format gemini-hook"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## OpenCode v2, Pi, and Claude (desktop/web)
|
|
108
|
+
|
|
109
|
+
- **OpenCode v2**: loads `~/.config/opencode/AGENTS.md` and workspace `AGENTS.md` automatically; plugin authors can also wire `triage-question` into the `experimental.idle` session hook before the session goes idle.
|
|
110
|
+
- **Pi**: loads `AGENTS.md` + `.agents/skills/question-gate/`.
|
|
111
|
+
- **Claude (desktop/web)**: upload `question-gate` as a Skill `.zip`; in web/sandboxed environments without shell hooks, apply [diagram-routing.md](diagram-routing.md) before emitting any question.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Diagram routing for questions before stopping
|
|
2
|
+
|
|
3
|
+
Every box in the BuilderBot workflow diagram owns a class of decisions or checks. Before asking the user a question, map each clause to the diagram owner.
|
|
4
|
+
|
|
5
|
+
## Canonical example
|
|
6
|
+
|
|
7
|
+
Draft question:
|
|
8
|
+
|
|
9
|
+
> "¿Quieres que haga el commit, cree la issue y abra el PR en el repositorio o prefieres probarlo primero en local?"
|
|
10
|
+
|
|
11
|
+
Split into clauses:
|
|
12
|
+
|
|
13
|
+
1. `"prefieres probarlo primero en local"`
|
|
14
|
+
- **Diagram owner:** `regression-testing` (QA Engineer) + `code-quality-gate` (Software Engineer self-check).
|
|
15
|
+
- **Disposition:** `delegate_to_skill` (**do not ask**). Run focused tests, typecheck, lint, quality gate, or local smoke checks yourself and report the evidence. Never ask the user to act as QA.
|
|
16
|
+
2. `"Quieres que haga el commit, cree la issue y abra el PR"`
|
|
17
|
+
- **Diagram owner:** `delivery-coordinator` checks `authorizations` -> `👤 Authorization to commit and publish`.
|
|
18
|
+
- **Disposition:**
|
|
19
|
+
- If `verify` or `quality` is still missing in the delivery ledger -> `delegate_to_skill` (finish verification and quality gate first).
|
|
20
|
+
- If `commit_pr` is already covered by a `person` authorization in the ledger (or explicitly requested in the session) -> `already_authorized` (proceed to Commit & PR, then `greptile-review-loop` and `workflow-auditor`).
|
|
21
|
+
- Otherwise -> `human_approval_required`: ask **only** the isolated publication decision with a recommendation, with zero QA fallback attached.
|
|
22
|
+
|
|
23
|
+
## Routing table
|
|
24
|
+
|
|
25
|
+
| Question / pause intent | Diagram owner | Disposition | Action |
|
|
26
|
+
|---|---|---|---|
|
|
27
|
+
| Test locally, run tests, reproduce bug, verify fix | `regression-testing` | `delegate_to_skill` | Run or rerun the focused test suite and report RED/GREEN evidence. |
|
|
28
|
+
| Check types, lint, BigO, early return, code quality | `code-quality-gate` | `delegate_to_skill` | Run `bbc extract-diff-scope` + typechecker and fix any `block`. |
|
|
29
|
+
| Check layer boundaries, DDD placement, file headers | `skill-clean-architecture` | `delegate_to_skill` | Inspect touched layers and run `bbc measure-bigo`. |
|
|
30
|
+
| Audit or update local docs / README | `documentation-steward` | `delegate_to_skill` | Audit the exact diff in `audit` mode; update only if authorized. |
|
|
31
|
+
| Assess failure modes, rollout or operational risk | `risk-scout` | `delegate_to_skill` | Build the 5 scenarios and risk matrix before asking. |
|
|
32
|
+
| Check Greptile score, review threads, or 5/5 loop | `greptile-review-loop` | `delegate_to_skill` | Run the bounded review loop on the current PR head. |
|
|
33
|
+
| Verify workflow order, ledger, or Tool Depot usage | `workflow-auditor` | `delegate_to_skill` | Run `bbc audit-ledger` and the semantic pass. |
|
|
34
|
+
| Inspect container logs or incident timeline | `watcher-observability` | `delegate_to_skill` | Check existing `report.json` or request bounded Watcher read via `tool-depot`. |
|
|
35
|
+
| Search duplicate issues, read PR, or check public docs | `tool-depot` (`github-read` / `public-web`) | `delegate_to_skill` | Submit a Tool Depot checkout request and execute if `eligible`. |
|
|
36
|
+
| Decide next workflow step or which skill runs next | `delivery-coordinator` | `delegate_to_skill` | Follow the earliest unmet stage in the handoff contracts. |
|
|
37
|
+
| Commit, push, publish issue, or open PR | `delivery-coordinator` + `👤 Person` | `already_authorized` or `human_approval_required` | Execute if `commit_pr` is already authorized and prerequisites are GREEN; otherwise ask only for that authorization. |
|
|
38
|
+
| Ambiguous product behavior or UX trade-off | `requirements-spec` -> `👤 Product Manager` | `human_approval_required` | Check existing issue/PRD first; if open, ask using `Open Decision Question Format`. |
|
|
39
|
+
| Merge PR / approve Code Owner review | `👤 Code Owner` | `human_approval_required` | Hand off PR, criteria, verification, Greptile score, and `workflow-auditor` verdict. |
|
|
40
|
+
| Deploy / release to production | `👤 Release Owner` | `human_approval_required` | Hand off readiness conditions and residual risks. |
|
|
41
|
+
| Approve SSH target or unauthorized `github-write` | `tool-depot` -> `👤 Person` | `human_approval_required` | Ask for the exact missing authorization (`needs-approval`). |
|
|
42
|
+
|
|
43
|
+
## Agile Decision Card
|
|
44
|
+
|
|
45
|
+
When `verdict` is `allow_question`, present the remaining `human_approval_required` gate as a compact **Quest-Tree Boss Gate** so the person can decide fast:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
🟡 BOSS GATE ─ <Role>
|
|
49
|
+
│
|
|
50
|
+
├── ❓ <1-line question?>
|
|
51
|
+
│
|
|
52
|
+
├── 👉 Recomendado: [A]
|
|
53
|
+
│ └── <1-line reason>
|
|
54
|
+
│
|
|
55
|
+
└── ⚡ Opciones
|
|
56
|
+
├── [A] <action>
|
|
57
|
+
└── [B] <action>
|
|
58
|
+
```
|