@brunosps00/dev-workflow 0.0.8 → 0.1.2

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/lib/constants.js CHANGED
@@ -103,7 +103,7 @@ const MCP_SERVERS = {
103
103
  },
104
104
  playwright: {
105
105
  command: 'npx',
106
- args: ['-y', '@anthropic-ai/mcp-server-playwright'],
106
+ args: ['-y', '@playwright/mcp@latest'],
107
107
  },
108
108
  };
109
109
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brunosps00/dev-workflow",
3
- "version": "0.0.8",
3
+ "version": "0.1.2",
4
4
  "description": "AI-driven development workflow commands for any project. Scaffolds a complete PRD-to-PR pipeline with multi-platform AI assistant support.",
5
5
  "bin": {
6
6
  "dev-workflow": "./bin/dev-workflow.js"
@@ -37,6 +37,12 @@ Works best with project analyzed by `/dw-analyze-project`
37
37
  <critical>Header and footer of human videos must not compete for useful area with the browser stage. When they exist, they must be outside the browser stage, in a larger composition, preserving the real application viewport intact.</critical>
38
38
  <critical>When the goal is a human tour with centered browser, keep the application in a central stage without fixed side columns, preserving header and footer at full width outside the browser area.</critical>
39
39
  <critical>Browser visual quality is a mandatory requirement. Do not deliver a human tour with viewport or recording downscaled relative to the final resolution. The runner must align viewport and video capture to the final resolution or record an explicit blocker.</critical>
40
+ <critical>Hardcoded subtitles over the product screen are not an acceptable standard when the environment supports a dedicated shell. The preferred and mandatory standard is: `header` at the top with the tour title, `stage` centered for the intact browser, and `footer` at the bottom exclusively for the narrative caption.</critical>
41
+ <critical>Even when the human video is assembled from screenshots rather than recorded navigation, the final composition must maintain the same shell layout: header and footer outside the application area. Do not deliver a fullscreen slideshow with subtitles burned directly over the product content.</critical>
42
+ <critical>In the main human video artifact, the caption must be visible inside the shell's `footer`. A sidecar `.srt` file and an embedded subtitle track may exist as support, but they do not replace the obligation for the main narrative to already appear correctly positioned in the footer of the final composition.</critical>
43
+ <critical>It is invalid to deliver as the main version an MP4 whose caption depends on the player for positioning (`mov_text`, `tx3g`, or similar subtitle track) when this causes the text to appear outside the shell's footer. If there is an auxiliary embedded track, visually validate that the main version remains correct even without the player rendering subtitles.</critical>
44
+ <critical>When the request involves human video with captions, always generate two video artifacts: a `clean` version without captions rendered in the frame, for use with player + sidecar `.srt`; and a `captioned` version with the narrative already burned correctly in the shell's `footer`.</critical>
45
+ <critical>If a previous flow in the workspace already has a better-resolved human recording shell, reuse that visual and structural pattern before improvising a new composition. This reuse is preferable to a simplified solution with captions embedded over the viewport.</critical>
40
46
 
41
47
  ### Video Pacing Requirements
42
48
  <critical>Before and after main actions, insert intentional pauses. As an operational rule: maintain 2 to 3 seconds of permanence on relevant loaded states and at least 1.5 seconds after the visible outcome of each main action before proceeding.</critical>
@@ -118,6 +124,9 @@ If there is execution:
118
124
  If there is a final human video:
119
125
  - save in `evidence/videos/` with a name that clearly differentiates the final tour from the raw capture
120
126
  - when `ffmpeg` is available, also save the `mp4` version of the final human tour
127
+ - when captions are involved, save two explicit variants:
128
+ - a `clean` version without captions drawn in the frame
129
+ - a `captioned` version with captions drawn in the shell's `footer`
121
130
  - record in `manifest.json` which files are `raw` and which are `human_final`
122
131
 
123
132
  ## Required Flow
@@ -223,6 +232,11 @@ Generate `e2e-runbook.md` in detailed operational style:
223
232
  - when there is a title and caption, reserve header and footer outside the browser stage
224
233
  - when the composition calls for a centered browser, keep the application in a central stage without fixed side columns and without sacrificing full-width header and footer
225
234
  - avoid any artificial reduction of the app viewport to fit overlays
235
+ - avoid burned subtitles directly inside the product viewport when there is a possibility of using an external shell
236
+ - burn the main narrative in the shell's `footer` of the final video; use sidecar `.srt` and embedded track only as complementary artifacts
237
+ - for each final tour with captions, produce:
238
+ - `clean`: no captions in the frame, with separate `.srt` for the player to decide
239
+ - `captioned`: captions already positioned in the shell's `footer`
226
240
  - align video capture to final resolution to avoid sharpness loss in the browser
227
241
  - keep each relevant state on screen long enough for visual reading, especially lists, dialogs, badges, validations, messages, and final results
228
242
  - keep captions on screen long enough for comfortable reading, without switching text before the corresponding step is visually understood
@@ -245,6 +259,28 @@ When producing or reviewing the final tour, apply these rules as baseline:
245
259
  - when comparing before and after states, clearly show both moments
246
260
  - if the recording is too fast for human reading, consider the execution inadequate even if technically correct
247
261
  - if `ffmpeg` is installed, consider incomplete any delivery that leaves only `webm` or another raw format without generating `mp4`
262
+ - consider inadequate any video that uses only overlaid captions on the browser when the project supports a shell with dedicated header/footer
263
+ - consider inadequate any video whose main caption depends on the player's renderer and therefore appears outside the shell's intended `footer`
264
+ - consider incomplete any delivery that provides only one of the variants (`clean` or `captioned`) when the flow requires video with captions
265
+
266
+ ## Mandatory Visual Shell Standard
267
+
268
+ When there is a final human video, adopt as minimum visual standard:
269
+
270
+ - `header` fixed outside the browser with the module or flow name
271
+ - `main` centering a single browser `stage`
272
+ - `footer` fixed outside the browser, reserved for narrative caption or short context
273
+ - `stage` with its own border, radius, and shadow, without cropping the application viewport
274
+ - `stage` width and height explicitly defined and proportional to the final resolution
275
+
276
+ Baseline recommended for `1920x1080` when no better standard exists in the flow itself:
277
+
278
+ - `header`: ~`64px`
279
+ - `footer`: ~`112px`
280
+ - `stage`: ~`1600x900`
281
+
282
+ If a previous flow in the workspace already has a working shell script (e.g., `record-human-tour.cjs`), reuse it as reference. If choosing a different layout, justify explicitly in `manifest.json`.
283
+
248
284
  - Update `manifest.json` with final status, artifacts, and blockers, distinguishing:
249
285
  - MCP evidence
250
286
  - raw execution capture
@@ -7,7 +7,7 @@ You are a specialized implementation reviewer that compares documented requireme
7
7
  - Do NOT use when requirements have not been finalized yet
8
8
 
9
9
  ## Pipeline Position
10
- **Predecessor:** `/dw-run-plan` (auto) or `/dw-run-task` (manual) | **Successor:** `/dw-code-review`
10
+ **Predecessor:** `/dw-run-plan` (auto) or `/dw-run-task` (manual) | **Successor:** `/dw-code-review` (auto-fixes gaps before completing)
11
11
 
12
12
  Called by: `/dw-run-plan` at end of all tasks
13
13
 
@@ -175,35 +175,82 @@ Check if the implementation follows project patterns:
175
175
  2. [secondary action]
176
176
  ```
177
177
 
178
- ### 8. Post-Report Decision (Required)
178
+ ### 8. Gap Resolution Loop (Required)
179
179
 
180
- After generating the final report, evaluate the result:
180
+ <critical>Review does NOT end at the first report. If gaps are found, enter an automatic fix-review loop until 100% compliance or explicit BLOCK.</critical>
181
+
182
+ After generating the report, evaluate:
181
183
 
182
- **If there are NO gaps (0 pending, 0 partial, 100% implemented):**
183
- - Present the report to the user
184
- - **DO NOT enter planning mode (EnterPlanMode)**
185
- - **DO NOT dispatch execution agents (Task)**
186
- - **DO NOT create tasks (TaskCreate)**
187
- - **DO NOT propose implementing anything**
188
- - Simply conclude with: "Implementation 100% compliant. No action needed."
189
- - END the review immediately
190
-
191
- **If there ARE gaps (pending > 0 OR partial > 0):**
192
- - Present the report with gaps and recommendations
193
- - List actions needed to resolve each gap
194
- - Wait for user instructions on how to proceed
195
- - **DO NOT enter planning mode automatically**
196
- - **DO NOT execute fixes without explicit user instruction**
197
-
198
- **Compliance Check Decision Flow:**
199
184
  ```dot
200
- digraph compliance {
201
- "Analysis Complete" -> "0 gaps AND 0 partial?";
202
- "0 gaps AND 0 partial?" -> "Report + EXIT" [label="yes"];
203
- "0 gaps AND 0 partial?" -> "Report + List Actions\nWAIT for user" [label="no"];
185
+ digraph review_loop {
186
+ rankdir=TB;
187
+ "Generate Review Report" -> "Gaps found?";
188
+ "Gaps found?" -> "100% Compliant\nExit" [label="no"];
189
+ "Gaps found?" -> "Fix gaps\n(implement missing code)" [label="yes"];
190
+ "Fix gaps\n(implement missing code)" -> "Re-review\nimplementation";
191
+ "Re-review\nimplementation" -> "Still gaps?";
192
+ "Still gaps?" -> "100% Compliant\nExit" [label="no"];
193
+ "Still gaps?" -> "Max cycles\nreached?" [label="yes"];
194
+ "Max cycles\nreached?" -> "Fix gaps\n(implement missing code)" [label="no"];
195
+ "Max cycles\nreached?" -> "BLOCKED\nReport residual gaps" [label="yes (3 cycles)"];
204
196
  }
205
197
  ```
206
198
 
199
+ **Loop rules:**
200
+ 1. After the initial report, if there are gaps (❌ not implemented or ⚠️ partial), enter the loop automatically
201
+ 2. For each cycle:
202
+ a. Fix all identified gaps: implement missing code, complete partial implementations
203
+ b. Follow project patterns from `.dw/rules/` during fixes
204
+ c. Run tests after fixes (`pnpm test` or equivalent)
205
+ d. Re-read the changed files and re-compare against PRD requirements
206
+ e. Update the review report with cycle results
207
+ f. If 100% compliance → exit loop, present final report
208
+ g. If gaps remain → continue next cycle
209
+ 3. **Maximum 3 fix-review cycles.** After 3 cycles, mark review as **BLOCKED** with residual gaps documented
210
+ 4. Each cycle must append a section to the report showing what was fixed and the new compliance status
211
+ 5. Commit fixes after each cycle: `fix(review): implement [requirement] from PRD`
212
+
213
+ **What to fix automatically:**
214
+ - ❌ Requirements not implemented → implement them
215
+ - ⚠️ Requirements partially implemented → complete them
216
+ - 📝 Tasks marked complete but actually incomplete → finish them
217
+
218
+ **What NOT to fix (stop and ask user):**
219
+ - Requirements that contradict each other in the PRD
220
+ - Requirements that need architectural decisions not covered in TechSpec
221
+ - Requirements that depend on external services not available
222
+ - If a fix would take more than the scope of a single task
223
+
224
+ **Cycle report format (append to review report):**
225
+ ```markdown
226
+ ## Fix Cycle [N] — [YYYY-MM-DD]
227
+
228
+ ### Gaps Resolved
229
+ | RF | Description | Action Taken | Status |
230
+ |----|-------------|-------------|--------|
231
+ | RF-XX | [requirement] | [what was implemented] | ✅ |
232
+
233
+ ### Tests
234
+ - `pnpm test`: PASS/FAIL
235
+ - Files changed: [list]
236
+
237
+ ### Remaining Gaps
238
+ - [list or "None"]
239
+
240
+ ### Cycle Result: CONTINUE / COMPLIANT / BLOCKED
241
+ ```
242
+
243
+ **If 100% compliant after any cycle:**
244
+ - Present the final report
245
+ - **DO NOT enter planning mode (EnterPlanMode)**
246
+ - **DO NOT create tasks (TaskCreate)**
247
+ - Conclude with: "Implementation 100% compliant after [N] fix cycles. No further action needed."
248
+
249
+ **If BLOCKED after 3 cycles:**
250
+ - Present the report with residual gaps
251
+ - List what could not be resolved and why
252
+ - Wait for user instructions
253
+
207
254
  ## Status Levels
208
255
 
209
256
  | Icon | Meaning |
@@ -255,4 +302,5 @@ git diff <commit> -- path/to/file
255
302
  <critical>DO NOT APPROVE requirements without concrete evidence in the code</critical>
256
303
  <critical>ANALYZE the actual code, do not trust only the checkboxes in tasks.md</critical>
257
304
  <critical>If 100% of requirements were implemented and there are NO gaps: DO NOT enter plan mode, DO NOT create tasks, DO NOT dispatch agents. Just present the report and END.</critical>
305
+ <critical>If gaps are found, enter the fix-review loop automatically. Do NOT wait for user instructions to fix gaps. Maximum 3 cycles before marking as BLOCKED.</critical>
258
306
  </system_instructions>
@@ -7,7 +7,7 @@ You are an AI assistant specialized in Quality Assurance. Your task is to valida
7
7
  - Do NOT use when requirements have not been defined yet (create PRD first)
8
8
 
9
9
  ## Pipeline Position
10
- **Predecessor:** `/dw-run-plan` or `/dw-run-task` | **Successor:** `/dw-fix-qa` (if bugs) or `/dw-code-review`
10
+ **Predecessor:** `/dw-run-plan` or `/dw-run-task` | **Successor:** `/dw-code-review` (auto-fixes bugs internally before completing)
11
11
 
12
12
  <critical>Use the Playwright MCP to execute all E2E tests</critical>
13
13
  <critical>Verify ALL requirements from the PRD and TechSpec before approving</critical>
@@ -271,6 +271,62 @@ Generate report in `{{PRD_PATH}}/QA/qa-report.md`:
271
271
  [Final QA assessment]
272
272
  ```
273
273
 
274
+ ### 9. QA Fix-Retest Loop (Automatic)
275
+
276
+ <critical>QA does NOT end at the first report. If bugs are found, enter an automatic fix-retest loop until QA is APPROVED or explicitly BLOCKED.</critical>
277
+
278
+ After generating the initial QA report:
279
+
280
+ ```dot
281
+ digraph qa_loop {
282
+ rankdir=TB;
283
+ "Generate QA Report" -> "Bugs found?";
284
+ "Bugs found?" -> "QA APPROVED\nExit" [label="no"];
285
+ "Bugs found?" -> "Fix bugs\n(follow dw-fix-qa rules)" [label="yes"];
286
+ "Fix bugs\n(follow dw-fix-qa rules)" -> "Retest ALL\nfixed bugs";
287
+ "Retest ALL\nfixed bugs" -> "New/reopened\nbugs?";
288
+ "New/reopened\nbugs?" -> "QA APPROVED\nExit" [label="no"];
289
+ "New/reopened\nbugs?" -> "Max cycles\nreached?" [label="yes"];
290
+ "Max cycles\nreached?" -> "Fix bugs\n(follow dw-fix-qa rules)" [label="no"];
291
+ "Max cycles\nreached?" -> "QA BLOCKED\nReport residual bugs" [label="yes (5 cycles)"];
292
+ }
293
+ ```
294
+
295
+ **Loop rules:**
296
+ 1. After the initial report, if `QA/bugs.md` has bugs with `Status: Open`, enter the loop automatically
297
+ 2. For each cycle:
298
+ a. Fix all open bugs surgically (same rules as `/dw-fix-qa`: no scope creep, minimal impact)
299
+ b. Retest ALL fixed bugs via Playwright MCP with evidence capture
300
+ c. Check for regressions introduced by the fixes
301
+ d. Update `QA/bugs.md` and `QA/qa-report.md` with the cycle results
302
+ e. If all critical/high bugs are closed → **QA APPROVED**, exit loop
303
+ f. If new bugs appeared or fixes failed → continue next cycle
304
+ 3. **Maximum 5 fix-retest cycles.** After 5 cycles, mark QA as **BLOCKED** with residual bugs documented
305
+ 4. Each cycle must update the QA report with a "Cycle N" section showing what was fixed, retested, and the result
306
+ 5. Commit fixes after each successful cycle: `fix(qa): resolve BUG-NN [description]`
307
+
308
+ **Cycle report format (append to qa-report.md):**
309
+ ```markdown
310
+ ## Fix-Retest Cycle [N] — [YYYY-MM-DD]
311
+
312
+ ### Bugs Fixed
313
+ | Bug | Fix Description | Retest | Evidence |
314
+ |-----|----------------|--------|----------|
315
+ | BUG-01 | [what was changed] | PASS/FAIL | `QA/screenshots/BUG-01-cycle-N.png` |
316
+
317
+ ### Regressions Checked
318
+ - [list of related flows retested]
319
+
320
+ ### Cycle Result
321
+ - **Bugs remaining:** [count]
322
+ - **Status:** CONTINUE / APPROVED / BLOCKED
323
+ ```
324
+
325
+ **Red flags — STOP the loop:**
326
+ - Fix requires a new feature (not a bug) → stop, recommend `/dw-create-prd`
327
+ - Fix requires major refactoring → stop, recommend `/dw-refactoring-analysis`
328
+ - Same bug keeps reappearing after 2+ fix attempts → mark as BLOCKED with root cause analysis
329
+
274
330
  ## Quality Checklist
275
331
 
276
332
  - [ ] PRD analyzed and requirements extracted
@@ -37,6 +37,12 @@ Funciona melhor com projeto analisado por `/dw-analyze-project`
37
37
  <critical>Header e footer de vídeos humanos não podem disputar área útil com a tela do browser. Quando eles existirem, devem ficar fora do stage do browser, em uma composição maior, preservando intacta a viewport real da aplicação.</critical>
38
38
  <critical>Quando o objetivo for um tour humano com browser centralizado, mantenha a aplicação em um palco central sem colunas laterais fixas, preservando header e footer em largura total fora da área do browser.</critical>
39
39
  <critical>Qualidade visual do browser é requisito obrigatório. Não entregue tour humano com viewport ou gravação reescalada para baixo em relação à resolução final. O runner deve alinhar viewport e captura de vídeo à resolução final ou registrar bloqueio explícito.</critical>
40
+ <critical>Legenda hardcoded sobre a tela do produto não é padrão aceitável quando o ambiente permitir shell dedicada. O padrão preferencial e obrigatório é: `header` superior com título do tour, `stage` centralizado para o browser intacto e `footer` inferior exclusivo para a legenda narrativa.</critical>
41
+ <critical>Mesmo quando o vídeo humano for montado a partir de screenshots e não de navegação gravada, a composição final deve manter o mesmo layout de shell: cabeçalho e rodapé fora da área útil da aplicação. Não entregar slideshow fullscreen com subtitles queimadas diretamente sobre o conteúdo do produto.</critical>
42
+ <critical>No artefato principal de vídeo humano, a legenda precisa estar visível dentro do `footer` da shell. Arquivo `.srt` sidecar e faixa de subtitle embutida podem existir como apoio, mas não substituem a obrigação de a narrativa principal já aparecer posicionada corretamente no rodapé da composição final.</critical>
43
+ <critical>É inválido entregar como versão principal um MP4 cuja legenda dependa do player para posicionamento (`mov_text`, `tx3g`, subtitle track similar) quando isso fizer o texto sair do footer da shell. Se houver faixa embutida auxiliar, validar visualmente que a versão principal continua correta mesmo sem o player renderizar subtitles.</critical>
44
+ <critical>Quando o pedido envolver vídeo humano com legenda, gerar sempre dois artefatos de vídeo: um `clean` sem legenda renderizada no quadro, para uso com player + `.srt` sidecar; e um `captioned` com a narrativa já queimada corretamente no `footer` da shell.</critical>
45
+ <critical>Se já existir no workspace um flow anterior com shell de gravação humana melhor resolvida, reutilize esse padrão visual e estrutural antes de improvisar nova composição. Esse reaproveitamento é preferível a uma solução simplificada com legendas embutidas sobre a viewport.</critical>
40
46
 
41
47
  ### Requisitos de Cadência do Vídeo
42
48
  <critical>Antes e depois de ações principais, inserir pausas intencionais. Como regra operacional: manter de 2 a 3 segundos de permanência em estados relevantes já carregados e pelo menos 1,5 segundo após o desfecho visível de cada ação principal antes de seguir.</critical>
@@ -118,6 +124,9 @@ Se houver execução:
118
124
  Se houver vídeo humano final:
119
125
  - salvar em `evidence/videos/` com nome que diferencie claramente o tour final da captura bruta
120
126
  - quando `ffmpeg` estiver disponível, salvar também a versão `mp4` do tour humano final
127
+ - quando houver legendas, salvar também duas variantes explícitas:
128
+ - uma versão `clean` sem legenda desenhada no frame
129
+ - uma versão `captioned` com legenda desenhada no `footer` da shell
121
130
  - registrar no `manifest.json` quais arquivos são `raw` e quais são `human_final`
122
131
 
123
132
  ## Fluxo obrigatório
@@ -223,6 +232,11 @@ Gerar `e2e-runbook.md` no estilo operacional detalhado:
223
232
  - quando houver título e legenda, reservar cabeçalho e rodapé próprios fora do stage do browser
224
233
  - quando a composição pedir browser centralizado, manter a aplicação em um palco central sem colunas laterais fixas e sem sacrificar a largura total do cabeçalho e do rodapé
225
234
  - evitar qualquer redução artificial da viewport do app para encaixar overlays
235
+ - evitar subtitles queimadas diretamente dentro da viewport do produto quando houver possibilidade de usar shell externa
236
+ - queimar a narrativa principal no `footer` da shell do vídeo final; usar `.srt` sidecar e faixa embutida apenas como artefatos complementares
237
+ - para cada tour final com legenda, produzir:
238
+ - `clean`: sem legenda no frame, com `.srt` separado para o player decidir
239
+ - `captioned`: legenda já posicionada no `footer` da shell
226
240
  - alinhar a captura de vídeo à resolução final para evitar perda de nitidez no browser
227
241
  - manter em tela cada estado relevante por tempo suficiente para leitura visual, em especial listas, diálogos, badges, validações, mensagens e resultados finais
228
242
  - manter as legendas tempo suficiente para leitura confortável, sem trocar texto antes de a etapa correspondente ser compreendida visualmente
@@ -245,6 +259,28 @@ Quando produzir ou revisar o tour final, aplicar estas regras como baseline:
245
259
  - quando houver comparação entre estado anterior e posterior, mostrar claramente os dois momentos
246
260
  - se a gravação ficar rápida demais para leitura humana, considerar a execução inadequada mesmo que tecnicamente correta
247
261
  - se `ffmpeg` estiver instalado, considerar incompleta a entrega que deixar apenas `webm` ou outro bruto sem gerar `mp4`
262
+ - considerar inadequado o vídeo que use apenas captions sobrepostas ao browser quando o projeto permitir shell com header/footer dedicados
263
+ - considerar inadequado o vídeo cuja legenda principal dependa do renderer do player e por isso apareça fora do `footer` previsto na shell
264
+ - considerar incompleta a entrega que disponibilize só uma das variantes (`clean` ou `captioned`) quando o fluxo exigir vídeo com legenda
265
+
266
+ ## Padrão visual obrigatório da shell
267
+
268
+ Quando houver vídeo humano final, adotar como padrão visual mínimo:
269
+
270
+ - `header` fixo fora do browser com o nome do módulo ou fluxo
271
+ - `main` centralizando um `stage` único do browser
272
+ - `footer` fixo fora do browser, reservado para legenda narrativa ou contexto curto
273
+ - `stage` com borda, raio e sombra próprios, sem cortar a viewport da aplicação
274
+ - largura e altura do `stage` definidas explicitamente e proporcionais à resolução final
275
+
276
+ Baseline recomendada para `1920x1080` quando não houver padrão melhor no próprio flow:
277
+
278
+ - `header`: ~`64px`
279
+ - `footer`: ~`112px`
280
+ - `stage`: ~`1600x900`
281
+
282
+ Se já existir no workspace um script de shell funcional (ex: `record-human-tour.cjs`), reutilize-o como referência. Se optar por outro layout, justifique explicitamente no `manifest.json`.
283
+
248
284
  - Atualizar `manifest.json` com status final, artefatos e bloqueios, distinguindo:
249
285
  - evidências MCP
250
286
  - captura bruta de execução
@@ -7,7 +7,7 @@
7
7
  - NÃO use quando os requisitos ainda não foram finalizados
8
8
 
9
9
  ## Posição no Pipeline
10
- **Antecessor:** `/dw-run-plan` (auto) ou `/dw-run-task` (manual) | **Sucessor:** `/dw-code-review`
10
+ **Antecessor:** `/dw-run-plan` (auto) ou `/dw-run-task` (manual) | **Sucessor:** `/dw-code-review` (auto-fixes gaps before completing)
11
11
 
12
12
  Chamado por: `/dw-run-plan` ao final de todas as tasks
13
13
 
@@ -170,31 +170,82 @@
170
170
  2. [ação secundária]
171
171
  ```
172
172
 
173
- ### 8. Decisão Pós-Relatório (Obrigatório)
173
+ ### 8. Loop de Resolução de Gaps (Obrigatório)
174
174
 
175
- **Se NÃO gaps (0 pendentes, 0 parciais, 100% implementado):**
176
- - Apresente o relatório ao usuário
177
- - **NÃO entre em modo de planejamento**
178
- - **NÃO crie tasks adicionais**
179
- - **NÃO proponha implementar nada**
180
- - Simplesmente conclua com: "Implementação 100% conforme. Nenhuma ação necessária."
181
- - ENCERRE a revisão imediatamente
175
+ <critical>A revisão NÃO termina no primeiro relatório. Se gaps forem encontrados, entre em um loop automático de fix-review até 100% de conformidade ou BLOCK explícito.</critical>
182
176
 
183
- **Se gaps (pendentes > 0 OU parciais > 0):**
184
- - Apresente o relatório com gaps e recomendações
185
- - Liste ações necessárias para resolver cada gap
186
- - Aguarde instruções do usuário sobre como proceder
187
- - **NÃO execute correções sem instrução explícita do usuário**
177
+ Após gerar o relatório, avalie:
188
178
 
189
- **Fluxo de Decisão de Verificação de Conformidade:**
190
179
  ```dot
191
- digraph compliance {
192
- "Analysis Complete" -> "0 gaps AND 0 partial?";
193
- "0 gaps AND 0 partial?" -> "Report + EXIT" [label="yes"];
194
- "0 gaps AND 0 partial?" -> "Report + List Actions\nWAIT for user" [label="no"];
180
+ digraph review_loop {
181
+ rankdir=TB;
182
+ "Generate Review Report" -> "Gaps found?";
183
+ "Gaps found?" -> "100% Compliant\nExit" [label="no"];
184
+ "Gaps found?" -> "Fix gaps\n(implement missing code)" [label="yes"];
185
+ "Fix gaps\n(implement missing code)" -> "Re-review\nimplementation";
186
+ "Re-review\nimplementation" -> "Still gaps?";
187
+ "Still gaps?" -> "100% Compliant\nExit" [label="no"];
188
+ "Still gaps?" -> "Max cycles\nreached?" [label="yes"];
189
+ "Max cycles\nreached?" -> "Fix gaps\n(implement missing code)" [label="no"];
190
+ "Max cycles\nreached?" -> "BLOCKED\nReport residual gaps" [label="yes (3 cycles)"];
195
191
  }
196
192
  ```
197
193
 
194
+ **Regras do loop:**
195
+ 1. Após o relatório inicial, se houver gaps (❌ não implementado ou ⚠️ parcial), entre no loop automaticamente
196
+ 2. Para cada ciclo:
197
+ a. Corrija todos os gaps identificados: implemente código faltante, complete implementações parciais
198
+ b. Siga os padrões do projeto em `.dw/rules/` durante as correções
199
+ c. Execute testes após as correções (`pnpm test` ou equivalente)
200
+ d. Releia os arquivos alterados e recompare com os requisitos do PRD
201
+ e. Atualize o relatório de revisão com os resultados do ciclo
202
+ f. Se 100% conforme → saia do loop, apresente o relatório final
203
+ g. Se gaps permanecerem → continue para o próximo ciclo
204
+ 3. **Máximo de 3 ciclos de fix-review.** Após 3 ciclos, marque a revisão como **BLOCKED** com gaps residuais documentados
205
+ 4. Cada ciclo deve adicionar uma seção ao relatório mostrando o que foi corrigido e o novo status de conformidade
206
+ 5. Commite correções após cada ciclo: `fix(review): implement [requirement] from PRD`
207
+
208
+ **O que corrigir automaticamente:**
209
+ - ❌ Requisitos não implementados → implemente-os
210
+ - ⚠️ Requisitos parcialmente implementados → complete-os
211
+ - 📝 Tasks marcadas como concluídas mas incompletas → finalize-as
212
+
213
+ **O que NÃO corrigir (parar e perguntar ao usuário):**
214
+ - Requisitos que contradizem uns aos outros no PRD
215
+ - Requisitos que precisam de decisões arquiteturais não cobertas na TechSpec
216
+ - Requisitos que dependem de serviços externos não disponíveis
217
+ - Se uma correção ultrapassar o escopo de uma única task
218
+
219
+ **Formato do relatório por ciclo (adicionar ao relatório de revisão):**
220
+ ```markdown
221
+ ## Fix Cycle [N] — [YYYY-MM-DD]
222
+
223
+ ### Gaps Resolved
224
+ | RF | Description | Action Taken | Status |
225
+ |----|-------------|-------------|--------|
226
+ | RF-XX | [requirement] | [what was implemented] | ✅ |
227
+
228
+ ### Tests
229
+ - `pnpm test`: PASS/FAIL
230
+ - Files changed: [list]
231
+
232
+ ### Remaining Gaps
233
+ - [list or "None"]
234
+
235
+ ### Cycle Result: CONTINUE / COMPLIANT / BLOCKED
236
+ ```
237
+
238
+ **Se 100% conforme após qualquer ciclo:**
239
+ - Apresente o relatório final
240
+ - **NÃO entre em modo de planejamento (EnterPlanMode)**
241
+ - **NÃO crie tasks (TaskCreate)**
242
+ - Conclua com: "Implementação 100% conforme após [N] ciclos de fix. Nenhuma ação adicional necessária."
243
+
244
+ **Se BLOCKED após 3 ciclos:**
245
+ - Apresente o relatório com gaps residuais
246
+ - Liste o que não pôde ser resolvido e por quê
247
+ - Aguarde instruções do usuário
248
+
198
249
  ## Níveis de Status
199
250
 
200
251
  | Ícone | Significado |
@@ -246,4 +297,5 @@
246
297
  <critical>NÃO APROVE requisitos sem evidência concreta no código</critical>
247
298
  <critical>ANALISE o código real, não confie apenas nos checkboxes do tasks.md</critical>
248
299
  <critical>Se 100% dos requisitos foram implementados e NÃO há gaps: NÃO entre em plan mode, NÃO crie tasks. Apenas apresente o relatório e ENCERRE.</critical>
300
+ <critical>Se gaps forem encontrados, entre no loop de fix-review automaticamente. NÃO aguarde instruções do usuário para corrigir gaps. Máximo de 3 ciclos antes de marcar como BLOCKED.</critical>
249
301
  </system_instructions>
@@ -7,7 +7,7 @@ Você é um assistente IA especializado em Quality Assurance. Sua tarefa é vali
7
7
  - NÃO use quando os requisitos ainda não foram definidos (crie o PRD primeiro)
8
8
 
9
9
  ## Posição no Pipeline
10
- **Antecessor:** `/dw-run-plan` ou `/dw-run-task` | **Sucessor:** `/dw-fix-qa` (se bugs) ou `/dw-code-review`
10
+ **Antecessor:** `/dw-run-plan` ou `/dw-run-task` | **Sucessor:** `/dw-code-review` (auto-fixes bugs internally before completing)
11
11
 
12
12
  <critical>Utilize o Playwright MCP para executar todos os testes E2E</critical>
13
13
  <critical>Verifique TODOS os requisitos do PRD e TechSpec antes de aprovar</critical>
@@ -269,6 +269,62 @@ Gerar relatório em `{{PRD_PATH}}/QA/qa-report.md`:
269
269
  [Parecer final do QA]
270
270
  ```
271
271
 
272
+ ### 9. Loop QA Fix-Retest (Automático)
273
+
274
+ <critical>O QA NÃO termina no primeiro relatório. Se bugs forem encontrados, entre em um loop automático de fix-retest até que o QA seja APROVADO ou explicitamente BLOQUEADO.</critical>
275
+
276
+ Após gerar o relatório inicial de QA:
277
+
278
+ ```dot
279
+ digraph qa_loop {
280
+ rankdir=TB;
281
+ "Generate QA Report" -> "Bugs found?";
282
+ "Bugs found?" -> "QA APPROVED\nExit" [label="no"];
283
+ "Bugs found?" -> "Fix bugs\n(follow dw-fix-qa rules)" [label="yes"];
284
+ "Fix bugs\n(follow dw-fix-qa rules)" -> "Retest ALL\nfixed bugs";
285
+ "Retest ALL\nfixed bugs" -> "New/reopened\nbugs?";
286
+ "New/reopened\nbugs?" -> "QA APPROVED\nExit" [label="no"];
287
+ "New/reopened\nbugs?" -> "Max cycles\nreached?" [label="yes"];
288
+ "Max cycles\nreached?" -> "Fix bugs\n(follow dw-fix-qa rules)" [label="no"];
289
+ "Max cycles\nreached?" -> "QA BLOCKED\nReport residual bugs" [label="yes (5 cycles)"];
290
+ }
291
+ ```
292
+
293
+ **Regras do loop:**
294
+ 1. Após o relatório inicial, se `QA/bugs.md` tiver bugs com `Status: Open`, entre no loop automaticamente
295
+ 2. Para cada ciclo:
296
+ a. Corrija todos os bugs abertos cirurgicamente (mesmas regras do `/dw-fix-qa`: sem scope creep, impacto mínimo)
297
+ b. Reteste TODOS os bugs corrigidos via Playwright MCP com captura de evidências
298
+ c. Verifique regressões introduzidas pelas correções
299
+ d. Atualize `QA/bugs.md` e `QA/qa-report.md` com os resultados do ciclo
300
+ e. Se todos os bugs críticos/altos estiverem fechados → **QA APPROVED**, saia do loop
301
+ f. Se novos bugs apareceram ou correções falharam → continue para o próximo ciclo
302
+ 3. **Máximo de 5 ciclos de fix-retest.** Após 5 ciclos, marque o QA como **BLOCKED** com bugs residuais documentados
303
+ 4. Cada ciclo deve atualizar o relatório de QA com uma seção "Cycle N" mostrando o que foi corrigido, retestado e o resultado
304
+ 5. Faça commit das correções após cada ciclo bem-sucedido: `fix(qa): resolve BUG-NN [description]`
305
+
306
+ **Formato do relatório por ciclo (adicionar ao qa-report.md):**
307
+ ```markdown
308
+ ## Fix-Retest Cycle [N] — [YYYY-MM-DD]
309
+
310
+ ### Bugs Fixed
311
+ | Bug | Fix Description | Retest | Evidence |
312
+ |-----|----------------|--------|----------|
313
+ | BUG-01 | [what was changed] | PASS/FAIL | `QA/screenshots/BUG-01-cycle-N.png` |
314
+
315
+ ### Regressions Checked
316
+ - [list of related flows retested]
317
+
318
+ ### Cycle Result
319
+ - **Bugs remaining:** [count]
320
+ - **Status:** CONTINUE / APPROVED / BLOCKED
321
+ ```
322
+
323
+ **Red flags — PARE o loop:**
324
+ - Correção requer uma nova feature (não é bug) → pare, recomende `/dw-create-prd`
325
+ - Correção requer refatoração significativa → pare, recomende `/dw-refactoring-analysis`
326
+ - Mesmo bug reaparece após 2+ tentativas de correção → marque como BLOCKED com análise de causa raiz
327
+
272
328
  ## Checklist de Qualidade
273
329
 
274
330
  - [ ] PRD analisado e requisitos extraídos