@brunosps00/dev-workflow 1.0.1 → 1.0.4

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.
Files changed (43) hide show
  1. package/README.md +33 -16
  2. package/bin/dev-workflow.js +24 -7
  3. package/lib/aws-categories.js +80 -0
  4. package/lib/azure-categories.js +168 -0
  5. package/lib/constants.js +14 -6
  6. package/lib/init.js +28 -0
  7. package/lib/install-aws-skills.js +345 -0
  8. package/lib/install-azure-skills.js +231 -0
  9. package/lib/mcp.js +32 -21
  10. package/lib/prompts.js +38 -1
  11. package/package.json +1 -1
  12. package/scaffold/en/agent-instructions.md +23 -0
  13. package/scaffold/en/commands/dw-analyze-project.md +64 -0
  14. package/scaffold/en/commands/dw-autopilot.md +64 -5
  15. package/scaffold/en/commands/dw-bugfix.md +124 -26
  16. package/scaffold/en/commands/dw-install-aws-skills.md +166 -0
  17. package/scaffold/en/commands/dw-install-azure-skills.md +138 -0
  18. package/scaffold/en/commands/dw-intel.md +30 -3
  19. package/scaffold/en/commands/dw-pause.md +92 -0
  20. package/scaffold/en/commands/dw-qa.md +87 -11
  21. package/scaffold/en/commands/dw-resume.md +90 -0
  22. package/scaffold/en/commands/dw-review.md +22 -12
  23. package/scaffold/en/templates/bugfix-summary-template.md +66 -0
  24. package/scaffold/en/templates/concerns-template.md +59 -0
  25. package/scaffold/en/templates/state-template.md +59 -0
  26. package/scaffold/pt-br/agent-instructions.md +23 -0
  27. package/scaffold/pt-br/commands/dw-analyze-project.md +64 -0
  28. package/scaffold/pt-br/commands/dw-autopilot.md +64 -5
  29. package/scaffold/pt-br/commands/dw-bugfix.md +134 -18
  30. package/scaffold/pt-br/commands/dw-install-aws-skills.md +166 -0
  31. package/scaffold/pt-br/commands/dw-install-azure-skills.md +138 -0
  32. package/scaffold/pt-br/commands/dw-intel.md +30 -3
  33. package/scaffold/pt-br/commands/dw-pause.md +92 -0
  34. package/scaffold/pt-br/commands/dw-qa.md +87 -11
  35. package/scaffold/pt-br/commands/dw-resume.md +90 -0
  36. package/scaffold/pt-br/commands/dw-review.md +22 -12
  37. package/scaffold/pt-br/templates/bugfix-summary-template.md +66 -0
  38. package/scaffold/pt-br/templates/concerns-template.md +59 -0
  39. package/scaffold/pt-br/templates/state-template.md +59 -0
  40. package/scaffold/skills/dw-codebase-intel/SKILL.md +9 -5
  41. package/scaffold/skills/dw-codebase-intel/references/query-patterns.md +52 -0
  42. package/scaffold/skills/dw-memory/SKILL.md +26 -1
  43. package/scaffold/skills/dw-memory/references/context-budget.md +63 -0
@@ -0,0 +1,90 @@
1
+ <system_instructions>
2
+ You are a session-resumption agent. Your job is to read `.dw/STATE.md`, orient yourself and the user, and route to the most useful next step. This command is the inverse of `/dw-pause`.
3
+
4
+ ## When to Use
5
+ - Use when the user says "resume work", "continue", "where did we stop?", "pick up where we left off", or starts a new session in an existing project
6
+ - Use proactively at the start of any session that lands in a project with a non-empty `.dw/STATE.md` and the user hasn't yet stated an intent
7
+
8
+ ## Pipeline Position
9
+ **Predecessor:** `/dw-pause` (previous session) | **Successor:** depends on what's open (typically `/dw-run --resume`, `/dw-bugfix`, `/dw-plan`, `/dw-qa`, or `/dw-review`)
10
+
11
+ ## File Location
12
+ - Read-only target: `.dw/STATE.md`
13
+ - Cross-reference: `.dw/spec/` (list active PRDs), `.dw/bugfixes/` (list open bugfixes), `.dw/incidents/` (if any)
14
+
15
+ ## Workflow
16
+
17
+ ### 1. Read STATE.md
18
+ - If `.dw/STATE.md` is missing, report: "No paused state found — this looks like a fresh session. Run `/dw-help` for next steps." Stop here.
19
+ - If `STATE.md` exists but every section is `_none_`, report: "STATE.md is empty — nothing to resume. Tell me what you want to do."
20
+
21
+ ### 2. Cross-reference with disk
22
+ Verify that the state still matches the filesystem:
23
+
24
+ - For each Open Loop referencing a PRD path, run `ls` on `.dw/spec/<slug>/`. If missing, flag `[stale: PRD not found]` and ask if the user wants it removed.
25
+ - For each Open Loop referencing a bugfix slug, check `.dw/bugfixes/<NNN-slug>/`.
26
+ - For each Blocker referencing an external system, do not verify — just surface it.
27
+ - If `last_paused` in frontmatter is more than 14 days old, surface this prominently (state may be stale).
28
+
29
+ ### 3. Produce TLDR
30
+
31
+ Present a concise summary, **not the raw STATE.md**:
32
+
33
+ ```
34
+ ## Where you left off
35
+
36
+ Last paused: YYYY-MM-DD (Nd ago)
37
+
38
+ ### Open Loops (N)
39
+ - [path or label] — next: <one-line next action> [<status flag if stale>]
40
+ - ...
41
+
42
+ ### Blockers (N unresolved)
43
+ - [label] — waiting on <X>
44
+
45
+ ### Top Todos (up to 5)
46
+ - ...
47
+
48
+ [Decisions, Lessons, Preferences — only mention if relevant to active loops]
49
+ ```
50
+
51
+ Keep the TLDR under 30 lines. If STATE.md has more, summarize and offer `cat .dw/STATE.md` as a follow-up.
52
+
53
+ ### 4. Suggest the next step
54
+
55
+ Based on the TLDR, route to a concrete command. Use these heuristics:
56
+
57
+ | Strongest signal in STATE.md | Suggested command |
58
+ |------------------------------|-------------------|
59
+ | Open Loop on a PRD at `tasks/` stage | `/dw-run --resume` |
60
+ | Open Loop on a PRD at `techspec` stage | `/dw-plan techspec` |
61
+ | Open Loop on a PRD at `prd` stage | `/dw-plan tasks` (if PRD approved) or continue PRD |
62
+ | Open Loop on a bugfix slug | `/dw-bugfix --resume <slug>` or `/dw-qa --bugfix <slug>` |
63
+ | Blocker waiting on external input | Suggest the user resolve the blocker first |
64
+ | Only Todos and Decisions, no active work | Ask the user what they want to start |
65
+
66
+ Phrase the suggestion as a question, not an order:
67
+
68
+ ```
69
+ Want me to <suggested command>?
70
+ - yes → I'll run it
71
+ - no, <other intent> → tell me what instead
72
+ ```
73
+
74
+ ### 5. Update STATE.md frontmatter
75
+
76
+ Set `last_resumed` to today's date (YYYY-MM-DD). Do not modify section content — that's the user's call now that the session is back.
77
+
78
+ ## Required Behavior
79
+
80
+ <critical>NEVER auto-execute the suggested command. `/dw-resume` only proposes; the user confirms before any `/dw-run`, `/dw-plan`, or `/dw-bugfix` fires.</critical>
81
+
82
+ <critical>NEVER fabricate stale-detection results. If you didn't run `ls`, don't report the file exists or doesn't exist.</critical>
83
+
84
+ <critical>NEVER dump the full STATE.md into the chat. Summarize. Long state files mean compaction is needed — suggest `/dw-pause` to compact next time.</critical>
85
+
86
+ ## Inspired by
87
+
88
+ This command adapts the session-handoff pattern from [`tech-leads-club/agent-skills/tlc-spec-driven`](https://github.com/tech-leads-club/agent-skills/tree/main/packages/skills-catalog/skills/(development)/tlc-spec-driven) (CC-BY-4.0, Felipe Rodrigues). Adaptations: routing heuristics map STATE.md content to specific `dw-*` commands; cross-reference with `.dw/spec/` and `.dw/bugfixes/` to detect staleness; never auto-execute.
89
+
90
+ </system_instructions>
@@ -15,16 +15,28 @@ You are the review orchestrator. Runs both Level 2 (PRD compliance / coverage) a
15
15
 
16
16
  | Invocation | What runs |
17
17
  |------------|-----------|
18
- | `/dw-review` | **Default.** Level 2 (PRD coverage) + Level 3 (code quality) in sequence. Consolidated report saved to `.dw/spec/<prd>/QA/review-consolidated.md`. |
19
- | `/dw-review --coverage-only` | Only Level 2 — maps every PRD requirement to the code that delivers it. Skips code quality. |
20
- | `/dw-review --code-only` | Only Level 3 — code quality / convention / security checks. Skips PRD mapping. |
18
+ | `/dw-review` | **Default.** Level 2 (PRD coverage) + Level 3 (code quality) in sequence. Consolidated report saved to `<target>/QA/review-consolidated.md` (target resolves to PRD dir or bugfix dir; see Target Resolution). |
19
+ | `/dw-review --coverage-only` | Only Level 2 — maps every PRD requirement (or bugfix scope) to the code that delivers it. Skips code quality. |
20
+ | `/dw-review --code-only` | Only Level 3 — code quality / convention / security checks. Skips PRD/scope mapping. |
21
+ | `/dw-review --bugfix <NNN-slug>` | Targets a bugfix at `.dw/bugfixes/NNN-slug/` instead of a PRD. Level 2 maps the bugfix scope (TASK.md + fix-report.md + SUMMARY.md) to the code that delivers the fix; Level 3 checks the diff. Output: `.dw/bugfixes/NNN-slug/review/`. |
21
22
 
22
23
  ## Inputs
23
24
 
24
25
  | Variable | Description | Example |
25
26
  |----------|-------------|---------|
26
- | `{{PRD_PATH}}` | Path to PRD directory (auto-detect from active branch if omitted) | `.dw/spec/prd-invoice-export` |
27
- | `{{MODE}}` | `--coverage-only` / `--code-only` (optional; default = both) | |
27
+ | `{{PRD_PATH}}` | Path to PRD directory (auto-detect from active branch if omitted; ignored when `--bugfix` is used) | `.dw/spec/prd-invoice-export` |
28
+ | `{{BUGFIX_SLUG}}` | Bugfix slug when `--bugfix` flag is used | `001-login-not-working` |
29
+ | `{{MODE}}` | `--coverage-only` / `--code-only` / `--bugfix <slug>` (optional; default = both, target = PRD) | — |
30
+
31
+ ## Target Resolution
32
+
33
+ The review runs against one of two target kinds. Compute `<target>` ONCE at the start; substitute it wherever you see `<target>` below.
34
+
35
+ 1. **PRD target (default):** `<target>` = `{{PRD_PATH}}` (auto-detected from active branch when omitted). Artifacts read: `prd.md`, `techspec.md`, `tasks.md`, `tasks/<N>_task.md`, `tasks-validation.md`. Output written to `<target>/QA/`. Filenames: `review-coverage.md`, `dw-code-review.md`, `review-consolidated.md`.
36
+
37
+ 2. **Bugfix target (`--bugfix <slug>`):** `<target>` = `.dw/bugfixes/<slug>/`. Artifacts read: `TASK.md` (the fix plan with numbered tasks 1..≤5), `fix-report.md` (verify evidence), `SUMMARY.md` (one-page record). There are no FRs in the PRD sense — instead, each numbered task in `TASK.md` is the unit of coverage. Output written to `<target>/review/`. Filenames: `review-coverage.md`, `dw-code-review.md`, `review-consolidated.md`.
38
+
39
+ When the bugfix target is used, the Coverage mapping (Level 2) operates on the numbered tasks from `TASK.md` (not FR-N.M); a task is DELIVERED when (a) the files it claimed to touch are in the diff and (b) the regression test referenced in `fix-report.md` exists and runs. Orphan code in bugfix mode is anything in the diff that does not correspond to a numbered task — a strong signal the safety valve should have escalated to `/dw-plan`.
28
40
 
29
41
  ## Complementary Skills
30
42
 
@@ -59,10 +71,8 @@ When available under `./.agents/skills/`, these are invoked as analytical suppor
59
71
  ### Behavior
60
72
 
61
73
  1. **Load artifacts:**
62
- - `.dw/spec/<prd>/prd.md` → extract functional requirements.
63
- - `.dw/spec/<prd>/techspec.md` → extract architectural decisions.
64
- - `.dw/spec/<prd>/tasks.md` + per-task files → extract committed work.
65
- - `tasks-validation.md` → carry forward dimension status.
74
+ - **PRD target:** `<target>/prd.md` → extract functional requirements. `<target>/techspec.md` → extract architectural decisions. `<target>/tasks.md` + per-task files → extract committed work. `<target>/tasks-validation.md` → carry forward dimension status.
75
+ - **Bugfix target:** `<target>/TASK.md` → extract the numbered tasks (1..≤5) and their target files. `<target>/fix-report.md` → extract the verify evidence and the regression test reference. `<target>/SUMMARY.md` → extract Symptom, Root Cause, Files Touched, Verification.
66
76
 
67
77
  2. **Map each FR to code:**
68
78
  - For each `FR-N.M`, find code that delivers it (file path + line range + commit SHA).
@@ -78,7 +88,7 @@ When available under `./.agents/skills/`, these are invoked as analytical suppor
78
88
 
79
89
  ### Output
80
90
 
81
- Saved to `.dw/spec/<prd>/QA/review-coverage.md`:
91
+ Saved to `<target>/QA/review-coverage.md` (PRD target) or `<target>/review/review-coverage.md` (bugfix target):
82
92
 
83
93
  ```markdown
84
94
  # Coverage Review
@@ -145,14 +155,14 @@ If MISSING > 0, the verdict suggests revisiting `/dw-plan tasks` to scope or `/d
145
155
 
146
156
  ### Output
147
157
 
148
- Saved to `.dw/spec/<prd>/QA/dw-review --code-only.md`. The verdict line is one of:
158
+ Saved to `<target>/QA/dw-code-review.md` (PRD target) or `<target>/review/dw-code-review.md` (bugfix target). The verdict line is one of:
149
159
  - **APPROVED** — all gates green; ready for commit + PR.
150
160
  - **APPROVED WITH CAVEATS** — green but findings worth fixing in follow-up (filed with severities).
151
161
  - **REJECTED** — at least one hard gate failed. Specify which.
152
162
 
153
163
  ## Consolidated output (default mode)
154
164
 
155
- When both levels run, a consolidated report at `.dw/spec/<prd>/QA/review-consolidated.md`:
165
+ When both levels run, a consolidated report at `<target>/QA/review-consolidated.md` (PRD target) or `<target>/review/review-consolidated.md` (bugfix target):
156
166
 
157
167
  ```markdown
158
168
  # Consolidated Review
@@ -0,0 +1,66 @@
1
+ ---
2
+ schema_version: "1.0"
3
+ slug: ""
4
+ created: ""
5
+ status: "Fixed | In Review | QA Pending | Reverted"
6
+ severity: "Low | Medium | High"
7
+ related_concerns: []
8
+ ---
9
+
10
+ # Bugfix Summary — {{NNN}}-{{slug}}
11
+
12
+ One-page record of a bugfix. Sibling files in this directory:
13
+
14
+ - `TASK.md` — the original triage, clarification answers, and the fix plan that ran
15
+ - `fix-report.md` — verification evidence (`dw-verify` PASS output, reproduction proof, regression test run)
16
+ - `review/` — populated by `/dw-review --bugfix {{NNN}}-{{slug}}`
17
+ - `QA/` — populated by `/dw-qa --bugfix {{NNN}}-{{slug}}` (when applicable)
18
+
19
+ ## Symptom
20
+
21
+ What the user observed. Quote the original bug description verbatim; do not paraphrase.
22
+
23
+ > _"…"_
24
+
25
+ ## Root Cause
26
+
27
+ What was actually broken, in a single sentence. Not the symptom — the cause.
28
+
29
+ _…_
30
+
31
+ ## Resolution
32
+
33
+ What changed, in 2-4 bullets. File paths, not snippets.
34
+
35
+ - _change 1_
36
+ - _change 2_
37
+
38
+ ## Files Touched
39
+
40
+ Full list, including tests. ≤5 — if more, the safety valve should have escalated to `/dw-plan`.
41
+
42
+ | Path | Change |
43
+ |------|--------|
44
+ | `src/foo/bar.ts` | _surgical fix to X_ |
45
+ | `src/foo/bar.test.ts` | _regression test added_ |
46
+
47
+ ## Verification
48
+
49
+ How the fix was proven, beyond "tests pass".
50
+
51
+ - **Reproduction before fix:** _step that triggered the bug, captured_
52
+ - **Reproduction after fix:** _same step, now passes_
53
+ - **Regression test:** _name + path_
54
+ - **Verify report:** `fix-report.md`
55
+
56
+ ## Related
57
+
58
+ - **Concerns touched:** _refs from `.dw/rules/concerns.md` if the fix landed in a flagged area_
59
+ - **Adjacent bugfixes:** _slugs of prior fixes in the same module, if any_
60
+ - **PRD context:** _if the bug surfaced inside a feature in flight, link to its PRD path_
61
+
62
+ ## Followups
63
+
64
+ Open loops this fix surfaced but did not resolve. Add to `.dw/STATE.md` Open-Loops on close.
65
+
66
+ - _none_
@@ -0,0 +1,59 @@
1
+ ---
2
+ schema_version: "1.0"
3
+ generated_by: dw-analyze-project (Step 9)
4
+ last_refreshed: ""
5
+ ---
6
+
7
+ # Concerns — Risk Map
8
+
9
+ Risk map for this codebase. Not conventions ("how we do things" — that's `.dw/rules/`), not architecture ("how it's built" — that's `.dw/intel/arch.md`). This file answers a single question: **where is it dangerous to mess around?**
10
+
11
+ Loaded on-demand by `/dw-plan`, `/dw-run`, and `/dw-bugfix` when their target touches an entry below. Auto-installed by `/dw-analyze-project` Step 9; never blocks (absence = no flagged areas yet).
12
+
13
+ ## Hot Spots
14
+
15
+ Files or modules with high churn, frequent bug reports, or repeated "I touched this and broke something" history. Mention them in PRDs that touch the same area; add an extra reviewer or extra test pass.
16
+
17
+ | Path | Why it's hot | First flagged | Last incident |
18
+ |------|--------------|---------------|---------------|
19
+ | _e.g. `src/auth/session.ts`_ | _3 token-handling fixes in 60d_ | _YYYY-MM-DD_ | _YYYY-MM-DD_ |
20
+
21
+ ## Fragile Integrations
22
+
23
+ External systems (APIs, queues, vendors, legacy databases) that have a track record of silent failures, schema drift, rate-limit surprises, or undocumented behavior. New code touching them needs explicit retry/timeout/idempotency handling.
24
+
25
+ | Integration | Failure mode | Mitigation expected |
26
+ |-------------|--------------|---------------------|
27
+ | _e.g. legacy SAP export_ | _silent 200 OK with empty body when source is locked_ | _check body length; log and alert_ |
28
+
29
+ ## Hostile Code
30
+
31
+ Specific functions, regexes, parsers, or algorithms that are hard to reason about — anyone touching them should fully understand them first (or rewrite, not patch). Common offenders: hand-rolled regex, ad-hoc string parsers, custom serializers, race-prone async, manual transaction code.
32
+
33
+ | Path / function | Why it's hostile | Owner / context |
34
+ |-----------------|------------------|-----------------|
35
+ | _e.g. `src/billing/parseInvoice.ts:parseLine`_ | _900-char regex with 12 alternatives, no comments_ | _Bruno wrote it in 2024; rewrite if it breaks_ |
36
+
37
+ ## Known Bug History
38
+
39
+ Aggregated from `.dw/bugfixes/*/SUMMARY.md` by `/dw-intel --build`. Lists modules with ≥2 historical fixes. Read alongside Hot Spots when planning related work.
40
+
41
+ | Module | Bug count | Recent slugs |
42
+ |--------|-----------|--------------|
43
+ | _e.g. `src/payments/`_ | _4_ | _002-stripe-webhook-retry, 007-refund-rounding_ |
44
+
45
+ ## Tech Debt — Acknowledged
46
+
47
+ Pieces of debt the team has agreed exist. Not to be cleaned up opportunistically without coordination — they may be load-bearing in ways that aren't obvious.
48
+
49
+ | Area | Debt description | Why it stays | Cleanup trigger |
50
+ |------|------------------|--------------|-----------------|
51
+ | _e.g. `src/legacy/userMapper.ts`_ | _Two parallel field-mapping codepaths_ | _Awaiting v3 API migration_ | _Q3 2026 after vendor cutover_ |
52
+
53
+ ---
54
+
55
+ **How to maintain this file:**
56
+
57
+ - `/dw-analyze-project` rewrites this on each run. Hand-written entries between `<!-- preserved:start -->` and `<!-- preserved:end -->` markers are kept.
58
+ - When a bugfix surfaces a new dangerous area, add it manually under Hot Spots and let the next analyze rerun confirm it.
59
+ - Promote entries to `.dw/constitution.md` when they become non-negotiable rules ("never touch X without an ADR").
@@ -0,0 +1,59 @@
1
+ ---
2
+ schema_version: "1.0"
3
+ last_paused: ""
4
+ last_resumed: ""
5
+ ---
6
+
7
+ # Session State
8
+
9
+ Cross-session working memory. Lightweight index of what is in flight, what was decided, what is parked. Updated by `/dw-pause` (consolidates) and read by `/dw-resume` (orients).
10
+
11
+ Unlike per-PRD `MEMORY.md` (workflow memory for one feature) or ADRs (durable architectural records), this file lives at the project level and survives across PRDs, branches, and sessions. Edit it freely between pauses.
12
+
13
+ ## Open Loops
14
+
15
+ What is currently in flight — work started but not finished. Each entry: short label + path/target + next concrete action.
16
+
17
+ - _none_
18
+
19
+ ## Decisions
20
+
21
+ Cross-cutting decisions that haven't been promoted to an ADR yet (because they don't warrant one, or because the formalization is deferred). Format: `YYYY-MM-DD — decision — context (1 line)`.
22
+
23
+ - _none_
24
+
25
+ ## Blockers
26
+
27
+ What's preventing forward motion. External (waiting on someone), internal (knowledge gap), or technical (broken tooling). Each entry: short label + what's blocked + owner / unblock condition.
28
+
29
+ - _none_
30
+
31
+ ## Todos
32
+
33
+ Small follow-ups that don't justify a full PRD or task file. One line each. Cleared as they get done or migrated to a PRD.
34
+
35
+ - _none_
36
+
37
+ ## Deferred Ideas
38
+
39
+ Ideas you considered but parked. Capture so they aren't lost; revisit when scope changes. Each entry: idea + reason it was parked + revisit trigger (if known).
40
+
41
+ - _none_
42
+
43
+ ## Lessons
44
+
45
+ Small lessons learned during recent work — patterns that worked, gotchas, "next time I'll …". Not architectural (those go to ADRs); operational.
46
+
47
+ - _none_
48
+
49
+ ## Preferences
50
+
51
+ Conventions agreed during work that affect how the agent should behave going forward. Examples: "always run `pnpm typecheck` before commit", "prefer named exports over default exports for utils".
52
+
53
+ - _none_
54
+
55
+ ## Notes
56
+
57
+ Free-form scratchpad. Optional.
58
+
59
+ - _none_
@@ -5,11 +5,27 @@ Este projeto usa [`@brunosps00/dev-workflow`](https://www.npmjs.com/package/@bru
5
5
 
6
6
  **Objetivo deste arquivo:** quando o usuário expressar uma intenção que casa com a Trigger Map abaixo, rode o comando `dw-*` correspondente **sem pedir permissão** — exceto se a mudança for genuinamente trivial (veja Escape Hatches).
7
7
 
8
+ ## Matriz de Auto-Sizing
9
+
10
+ Antes de escolher um comando da Trigger Map, dimensione o escopo real da mudança. A mesma intenção ("conserta isso", "adiciona isso") pode significar quantidades muito diferentes de trabalho; a matriz nomeia quatro tamanhos e roteia cada um para uma entrada diferente. **Escolha o menor que cabe — sub-rotear desperdiça cerimônia, super-rotear esconde o escopo.**
11
+
12
+ | Tamanho | Como se parece | Rotear para |
13
+ |---------|----------------|-------------|
14
+ | **Pequeno** | ≤3 arquivos, sem migration, sem novo endpoint, descritível em uma frase. Exemplos: typo, log message, config de uma linha, bump de dependência, version pin. | Faça inline. Nenhum comando `dw-*`. |
15
+ | **Médio** | Feature ou bug claro, <10 tasks numeradas esperadas, único componente ou serviço, sem decisões arquiteturais. Exemplos: adicionar campo de form com validação, corrigir regressão em módulo conhecido, ligar novo endpoint num handler existente. | `/dw-bugfix` (bugs) ou `/dw-plan` (features) — direto, não via `/dw-autopilot`. |
16
+ | **Grande** | Feature multi-componente, ≥10 tasks esperadas, toca múltiplos módulos, tem superfície UX user-visible E backend. Exemplos: adicionar nova entidade end-to-end (model + migration + API + UI), introduzir integração de terceiro, redesenhar fluxo. | `/dw-autopilot "<wish>"` — pipeline completo PRD → TechSpec → Tasks → Run → QA → Review → Commit → PR com três gates. |
17
+ | **Complexo** | Domínio novo, requisitos ambíguos, decisão arquitetural exigida, superfície regulatória ou de compliance, ou escopo que cruza múltiplos PRDs. Exemplos: introduzir event sourcing, reconstruir auth, multi-tenancy, nova linha de produto. | `/dw-brainstorm "<ideia>"` primeiro (auto-dispatch de modos research/council), depois `/dw-plan --council` para a etapa de techspec rodar o debate multi-advisor. |
18
+
19
+ **Safety valve:** se você começou em Pequeno ou Médio mas o trabalho revela que é Grande de fato (a listagem inline passa de 5 passos, ou `/dw-bugfix` dispara seu `Step 5.0`), PARE e escale. Não existe flag para bypass. Escalar é o desfecho correto.
20
+
21
+ **Adaptado de** [`tech-leads-club/agent-skills/tlc-spec-driven`](https://github.com/tech-leads-club/agent-skills/tree/main/packages/skills-catalog/skills/(development)/tlc-spec-driven) (CC-BY-4.0). A matriz de quatro tamanhos é de lá; o mapeamento para comandos `dw-*` é específico do dev-workflow.
22
+
8
23
  ## Trigger Map
9
24
 
10
25
  | Intenção do usuário (literal ou parafraseada) | Auto-trigger |
11
26
  |------------------------------------------------|--------------|
12
27
  | "Implementa X" / "Cria Y" / "Adiciona feature Z" / "Preciso de..." | `/dw-autopilot "X"` |
28
+ | "Autopilota esse PRD" / "Leva esse PRD pra PR" / continua escalação de bugfix autonomamente | `/dw-autopilot --from-prd <slug>` (PRD existente em `.dw/spec/<slug>/`) |
13
29
  | Erro colado / "X está quebrado" / "Bug em Y" / screenshot de teste falhando | `/dw-bugfix "X"` |
14
30
  | "Planeja essa feature" / "Escreve PRD + techspec + tasks" | `/dw-plan "X"` |
15
31
  | "Escreve PRD pra X" / "Especifica Y" | `/dw-plan prd "X"` |
@@ -18,9 +34,14 @@ Este projeto usa [`@brunosps00/dev-workflow`](https://www.npmjs.com/package/@bru
18
34
  | "Roda essa task" (com ID da task) | `/dw-run <ID>` |
19
35
  | "Roda todas as tasks pendentes" / "Executa o plano" | `/dw-run` |
20
36
  | "Continue de onde parei" | `/dw-run --resume` |
37
+ | "Pausa o trabalho" / "Encerra a sessão" / "Salva onde paramos" | `/dw-pause` |
38
+ | "Retoma" / "Onde paramos?" / "Volta de onde parei" | `/dw-resume` |
21
39
  | "QA dessa feature" / "Roda o test plan" | `/dw-qa` |
22
40
  | "Corrige os bugs do QA" | `/dw-qa --fix` |
23
41
  | "Avalia a feature AI" / "Testa o RAG / classifier" | `/dw-qa --ai` |
42
+ | "Caminha comigo pela feature" / "UAT comigo" / "Vamos fazer um run-through manual" | `/dw-qa --uat` |
43
+ | "Revisa esse bugfix" / "Code-review do fix `<slug>`" | `/dw-review --bugfix <slug>` |
44
+ | "QA desse bugfix" / "Valida o fix `<slug>`" | `/dw-qa --bugfix <slug>` |
24
45
  | "Revisa meu PR" / "Checa qualidade" / "Tá pronto pra subir?" | `/dw-review` |
25
46
  | "Só checagem de cobertura PRD" | `/dw-review --coverage-only` |
26
47
  | "Só code review qualidade" | `/dw-review --code-only` |
@@ -36,6 +57,8 @@ Este projeto usa [`@brunosps00/dev-workflow`](https://www.npmjs.com/package/@bru
36
57
  | "Abre um novo projeto" / "Bootstrap de stack" | `/dw-new-project` |
37
58
  | "Dockeriza isso" / "Adiciona docker-compose" | `/dw-dockerize` |
38
59
  | "Functional doc" / "Mapeia screens e flows" | `/dw-functional-doc` |
60
+ | "Instala skills Azure" / "Configura MCP do Microsoft docs" / "Adiciona expertise Azure" / "Vou trabalhar com Azure" | `/dw-install-azure-skills` |
61
+ | "Instala skills AWS" / "Configura MCP da AWS" / "Adiciona expertise AWS" / "Vou trabalhar com AWS" | `/dw-install-aws-skills` |
39
62
 
40
63
  **Prioridade:** na dúvida entre dois comandos, `/dw-autopilot` é o default mais seguro pra qualquer pedido de feature não-trivial — ele compõe os demais.
41
64
 
@@ -706,6 +706,67 @@ Três opções:
706
706
  - Nunca escrever `.dw/constitution.md` sem aprovação explícita (opção A) ou escolha explícita (opções B/C).
707
707
  - Constitution é commitada ao repositório como qualquer outro artefato do projeto — nunca gitignored.
708
708
 
709
+ ### Step 9: Geração do Mapa de Concerns (Risk Map)
710
+
711
+ Depois do passo de constitution, gerar `.dw/rules/concerns.md` — o **mapa de riscos** do projeto. Enquanto `.dw/rules/` descreve como o código É e `.dw/constitution.md` descreve o que ele DEVE SER, o mapa de concerns responde uma terceira pergunta: **onde é perigoso mexer?**
712
+
713
+ **Diferença dos outros dois:**
714
+ - `.dw/rules/*.md` — analítico (padrões observados).
715
+ - `.dw/constitution.md` — declarativo (princípios comprometidos).
716
+ - `.dw/rules/concerns.md` — risco operacional (fragilidade load-bearing, hot spots, código hostil).
717
+
718
+ **Comportamento:**
719
+
720
+ Se `.dw/rules/concerns.md` já existir com entradas escritas a mão entre `<!-- preserved:start -->` e `<!-- preserved:end -->`, preserve essas entradas. Atualize as seções auto-geradas (dados de churn de Hot Spots, Histórico de Bugs Conhecidos a partir de `.dw/bugfixes/`).
721
+
722
+ Caso contrário (primeira execução), construa o arquivo do zero usando `.dw/templates/concerns-template.md` como base.
723
+
724
+ **Dados a coletar:**
725
+
726
+ 1. **Hot Spots — análise de churn.** Para cada módulo descoberto no Passo 5, compute a contagem de commits tocando arquivos do módulo nos últimos 90 dias (`git log --since="90 days ago" --name-only -- <module-path> | wc -l`). Módulos no top 20% por churn são candidatos. Cruze com `.dw/bugfixes/` (próximo item) — módulos que também aparecem lá são Hot Spots confirmados; o resto fica como "churn alto — verificar com o time."
727
+
728
+ 2. **Histórico de Bugs Conhecidos — agregação de bugfixes.** Se `.dw/bugfixes/` existir, escaneie todo `SUMMARY.md` dentro. Para cada um, parseie a tabela `Arquivos Tocados`; agregue paths de arquivos pelo módulo top-level (ex: `src/auth/session.ts` -> `src/auth/`). Qualquer módulo com `>= 2` fixes históricos entra na seção Histórico de Bugs Conhecidos com contagem e slugs recentes.
729
+
730
+ 3. **Integrações Frágeis.** Procure padrões delatores no código e config:
731
+ - Clientes SDK externos com scaffolding de retry/backoff (sugere falhas anteriores).
732
+ - Comentários como `// FIXME: vendor retorna 200 com body vazio às vezes`, `// HACK: workaround para API legada`, `// TODO: tratar edge case do vendor X`.
733
+ - Loops de retry artesanais ao redor de fetch/axios/HTTP clients.
734
+ - Diretório `.dw/incidents/` — todo postmortem de incidente que nomeie um sistema externo entra aqui.
735
+ Liste esses candidatos. Não fabrique — apenas o que você observar.
736
+
737
+ 4. **Código Hostil.** Heurísticas para código que precisa de entendimento completo antes de modificar:
738
+ - Regex literais com mais de 80 caracteres sem comentário explicativo.
739
+ - Funções acima de 100 linhas com complexidade ciclomática que resiste à leitura rápida (heurística aproximada: muitos `if`/`switch`/loops aninhados).
740
+ - Código manual de transação/locking fora da camada idiomática de um ORM.
741
+ - Serializadores/parsers custom (ex: JSON, CSV, formatos binários escritos a mão) sem arquivo de teste correspondente.
742
+ Sinalize candidatos e deixe o usuário confirmar.
743
+
744
+ 5. **Tech Debt — Reconhecida.** Escaneie README, CONTRIBUTING, docs/, e comentários no código por marcadores `TODO`, `FIXME`, `XXX`, `HACK`, `DEPRECATED` com mais de 90 dias (use `git blame` para datar). Agrupe por área. Apresente como candidatos; o usuário decide quais merecem reconhecimento (alguns são comentários velhos, alguns são debt real).
745
+
746
+ **Procedimento:**
747
+
748
+ 1. **Mostre os candidatos no chat primeiro** (NÃO escreva o arquivo ainda). Formate como tabela markdown por seção com contagem e a evidência mais forte para cada entrada. Limite cada seção a 10 entradas — se mais, liste "+N mais (peça expansão)" e deixe o usuário pedir.
749
+
750
+ 2. Pergunte: "Aprovar como está, descartar entradas específicas (passe os labels das linhas), ou pular esse passo inteiro?" Aguarde resposta explícita.
751
+
752
+ 3. Em caso de aprovação, escreva `.dw/rules/concerns.md` usando `.dw/templates/concerns-template.md`. Preencha:
753
+ - Frontmatter `last_refreshed: <data ISO de hoje>`.
754
+ - Tabela de Hot Spots.
755
+ - Tabela de Integrações Frágeis.
756
+ - Tabela de Código Hostil.
757
+ - Tabela de Histórico de Bugs Conhecidos.
758
+ - Tabela de Tech Debt — Reconhecida.
759
+
760
+ 4. Se existia um bloco `<!-- preserved:start --> ... <!-- preserved:end -->` numa versão anterior, anexe-o de volta ao final do arquivo (as entradas curadas a mão pelo time).
761
+
762
+ 5. Imprima: "Escrito `.dw/rules/concerns.md`. Carregado on-demand por `/dw-plan`, `/dw-run` e `/dw-bugfix` quando o alvo deles tocar uma área listada. Nunca bloqueia — informa, sinaliza e sugere ADR para desvios."
763
+
764
+ **Caso especial — nenhum sinal encontrado:**
765
+
766
+ Se após as heurísticas nada cruzar a barra (codebase pequeno, churn baixo, sem incidents, sem histórico de bugfix), escreva um `concerns.md` mínimo com todas as seções vazias (apenas headers) e uma nota: "Nenhum sinal de risco no momento. Re-execute depois que o projeto acumular mais histórico."
767
+
768
+ **Cadência de refresh:** usuários re-rodam `/dw-analyze-project` quando rules ficam desatualizadas. O Passo 9 atualiza seções auto mantendo entradas preservadas. Não existe comando separado só de refresh.
769
+
709
770
  ## Checklist de Qualidade
710
771
 
711
772
  - [ ] Estrutura do repositório escaneada
@@ -734,6 +795,9 @@ Três opções:
734
795
  - [ ] Exemplos de código reais incluídos
735
796
  - [ ] Nenhum secret exposto
736
797
  - [ ] Convenções de teste documentadas (framework, padrões, cobertura)
798
+ - [ ] Step 8 (constitution) oferecido e resolvido (A/B/C)
799
+ - [ ] Step 9 (mapa de concerns) apresentou candidatos, aguardou aprovação, escreveu `.dw/rules/concerns.md` (ou anotou que não há sinais)
800
+ - [ ] Blocos com marker preserved em concerns.md mantidos verbatim no refresh
737
801
 
738
802
  ## Exemplo de Uso
739
803
 
@@ -44,13 +44,22 @@ Uma etapa que invoca um comando `/dw-xxx` SO e considerada completa quando os ar
44
44
 
45
45
  | Variavel | Descricao | Exemplo |
46
46
  |----------|-----------|---------|
47
- | `{{WISH}}` | Descricao do que o usuario quer construir | "sistema de notificacoes push com preferencias por canal" |
47
+ | `{{WISH}}` | Descricao do que o usuario quer construir (modo padrao) | "sistema de notificacoes push com preferencias por canal" |
48
+ | `{{PRD_SLUG}}` | Slug do PRD existente para autopilotar a partir dele (quando `--from-prd` e usado) | `prd-bugfix-stripe-webhook-retry` |
49
+ | `{{MODE}}` | Flag opcional de invocacao | `--from-prd <slug>` |
50
+
51
+ ## Modos de Invocacao
52
+
53
+ | Invocacao | Comportamento |
54
+ |-----------|---------------|
55
+ | `/dw-autopilot "<wish>"` | **Padrao.** Pipeline completo do zero: Codebase Intelligence → Pesquisa → Brainstorm → PRD → TechSpec → Tasks → Run → QA → Review → Commit → PR. |
56
+ | `/dw-autopilot --from-prd <slug>` | **Modo retomada-a-partir-do-PRD.** Pula Etapas 1–4 (Intel, Pesquisa, Brainstorm, PRD). Comeca no GATE 1 (apresenta o PRD existente para aprovacao), depois segue por TechSpec → Tasks → Run → QA → Review → Commit → PR. Usado quando `/dw-bugfix` escalou via seu safety valve e escreveu um PRD em `.dw/spec/<slug>/`, ou quando o usuario redigiu um PRD a mao antes e quer o resto automatizado. |
48
57
 
49
58
  ## Gates de Aprovacao
50
59
 
51
60
  O autopilot para APENAS nestes 3 momentos:
52
61
 
53
- 1. **GATE 1 — PRD**: Apresenta o PRD gerado e aguarda aprovacao do usuario antes de gerar techspec/tasks
62
+ 1. **GATE 1 — PRD**: Apresenta o PRD gerado (modo padrao) ou o PRD existente (modo --from-prd) e aguarda aprovacao do usuario antes de gerar techspec/tasks
54
63
  2. **GATE 2 — Tasks**: Apresenta a lista de tasks e aguarda aprovacao antes de iniciar a execucao
55
64
  3. **GATE 3 — PR**: Apos commit automatico, pergunta se o usuario quer gerar o Pull Request
56
65
 
@@ -66,6 +75,22 @@ Se este comando for re-invocado no mesmo PRD apos interrupcao:
66
75
 
67
76
  ## Pipeline Completo
68
77
 
78
+ ### Etapa 0: Resolver modo de invocacao (PRIMEIRA acao obrigatoria)
79
+
80
+ Antes da Etapa 1, decida qual modo esta em efeito:
81
+
82
+ 1. **Se `--from-prd <slug>` aparece na invocacao:**
83
+ - Resolva `{{PRD_SLUG}}` para `.dw/spec/<slug>/`.
84
+ - Verifique que o diretorio existe e contem `prd.md`. Se algum faltar, PARE e reporte: `Alvo de --from-prd .dw/spec/<slug>/prd.md nao encontrado. Rode /dw-plan prd ou corrija o slug.`
85
+ - Cheque se algum `.dw/bugfixes/*/escalated.md` referencia esse slug. Se sim, anote no bloco de progresso: `Retomando de escalacao de bugfix: <NNN-bugfix-slug> → <slug>`.
86
+ - Defina `mode: "from-prd"` em `autopilot-state.json` e `skipped_steps: [1, 2, 3, 4]` com `skip_reason: "from-prd-mode"`.
87
+ - Pule direto para o **GATE 1** (aprovacao do PRD) usando o `prd.md` existente.
88
+
89
+ 2. **Caso contrario (modo padrao):**
90
+ - Defina `mode: "autopilot"` e prossiga para Etapa 1 normalmente.
91
+
92
+ <critical>Em modo `--from-prd`, as Etapas 1–4 DEVEM ser marcadas como `skipped_steps` com `skip_reason: "from-prd-mode"`. A auditoria de pre-commit (Etapa 14) DEVE honrar isso — etapa pulada nao e o mesmo que etapa faltando.</critical>
93
+
69
94
  ### Etapa 1: Inteligencia do Codebase
70
95
 
71
96
  <critical>Se `.dw/intel/` existir, a consulta via `/dw-intel` e OBRIGATORIA antes de iniciar. Cai para `.dw/rules/` e grep direto se ausente.</critical>
@@ -104,12 +129,15 @@ Execute `/dw-plan prd` usando os findings do brainstorm.
104
129
 
105
130
  ### ═══ GATE 1: Aprovacao do PRD ═══
106
131
 
132
+ **Em modo padrao:** o PRD acabou de ser escrito na Etapa 4.
133
+ **Em modo `--from-prd`:** o PRD ja existia em disco antes deste run de autopilot comecar (tipicamente redigido por `/dw-bugfix --analise` ou por uma escalacao via safety valve, ou editado a mao).
134
+
107
135
  Apresente ao usuario:
108
136
  - Resumo dos requisitos funcionais
109
- - Decisoes tomadas automaticamente
137
+ - Decisoes tomadas automaticamente (modo padrao) OU nota de origem: "PRD redigido por escalacao do /dw-bugfix em <data>" / "PRD ja existia em disco" (modo --from-prd)
110
138
  - Questoes em aberto (se houver)
111
139
 
112
- **Aguarde aprovacao explicita.** Se o usuario pedir mudancas, ajuste e reapresente.
140
+ **Aguarde aprovacao explicita.** Se o usuario pedir mudancas, ajuste e reapresente. Em modo `--from-prd`, edits vao direto para o `.dw/spec/<slug>/prd.md` existente — nao existe rascunho separado.
113
141
 
114
142
  ### Etapa 5: TechSpec (Interativo — 7+ Perguntas)
115
143
 
@@ -216,6 +244,34 @@ Execute `/dw-review --coverage-only` novamente para confirmar que as correcoes d
216
244
  Execute `/dw-review --code-only` (Level 3) para review formal.
217
245
  - Gere relatorio persistido
218
246
 
247
+ ### Etapa 13.5: Fechar o loop do bugfix (Condicional)
248
+
249
+ <critical>Esta etapa roda apenas quando `mode == "from-prd"` E o `prd_path` casa com `.dw/spec/prd-bugfix-*`. Caso contrário pule com `skip_reason: "nao e escalacao de bugfix"`.</critical>
250
+
251
+ Quando o autopilot está terminando um bugfix que foi escalado por `/dw-bugfix`, a entrada de índice em `.dw/bugfixes/NNN-<slug>/` ainda tem apenas `TASK.md` e `escalated.md` — nenhum `SUMMARY.md` foi escrito porque o fluxo cirúrgico do bugfix nunca chegou ao step 5.5 (o fluxo spec-driven fez o trabalho no lugar). Sem `SUMMARY.md`, o `/dw-intel --build` pula este bugfix para sempre, e queries `bugfix-history` nunca trazem a lição aprendida.
252
+
253
+ Esta etapa fecha esse loop **antes** da Etapa 14 (Commit) para o SUMMARY cair no mesmo commit do fix.
254
+
255
+ **Procedimento:**
256
+
257
+ 1. **Encontre a entrada de índice.** Glob em `.dw/bugfixes/*/escalated.md`. Para cada um, leia o conteúdo de uma linha e cheque se referencia o slug do PRD atual (ex: `→ see .dw/spec/prd-bugfix-stripe-webhook-retry/` casa com o PRD ativo `prd-bugfix-stripe-webhook-retry`). O match é o diretório-alvo `NNN-<slug>/`.
258
+ 2. **Se nenhum match for encontrado:** o índice de bugfix não espera write-back. Pule silenciosamente e continue para Etapa 14.
259
+ 3. **Se `SUMMARY.md` já existir no diretório:** não sobrescreva. Continue para Etapa 14 — humano ou run anterior já fechou o loop.
260
+ 4. **Caso contrário, escreva `SUMMARY.md`** usando `.dw/templates/bugfix-summary-template.md`. Origem dos campos:
261
+ - **Sintoma (verbatim):** seção `Sintoma` de `<prd_path>/prd.md`, ou o primeiro parágrafo do `TASK.md` original se o PRD não carregar.
262
+ - **Causa Raiz:** seção Causa Raiz do `TASK.md` original.
263
+ - **Resolução (2–4 bullets):** destilada das decisões em `<prd_path>/techspec.md` + resumo de `git diff <base>...HEAD --stat`.
264
+ - **Arquivos Tocados:** parseado de `git diff <base>...HEAD --name-only` (exclua paths em `.dw/`). Se >5 arquivos, é esperado para bugfix escalado — liste todos e adicione nota "escalado de bugfix por causa do escopo".
265
+ - **Verificação:** aponte para `<prd_path>/QA/qa-report.md` e o relatório verify referenciado na saída de sessão da Etapa 9.
266
+ - **Relacionado — Concerns tocados:** copie das entradas correspondentes em `.dw/rules/concerns.md` se alguma row referenciar módulos em Arquivos Tocados.
267
+ - **Frontmatter:** `slug: NNN-<slug>`, `created: <data ISO de hoje>`, `status: Fixed`, `severity: <inferida da prioridade do PRD ou Medium default>`, `related_concerns: [lista de cima]`.
268
+ 5. **Anexe uma linha final** ao `escalated.md`: `Closed by /dw-autopilot --from-prd on <YYYY-MM-DD>; SUMMARY.md written.` Preserve a linha original da escalação acima.
269
+ 6. **Registre o artefato** em `autopilot-state.json` `step_artifacts["13.5"] = [".dw/bugfixes/NNN-<slug>/SUMMARY.md", ".dw/bugfixes/NNN-<slug>/escalated.md"]`.
270
+
271
+ <critical>NUNCA fabrique evidência de verificação. Se o QA report estiver vazio ou o diff vazio, não invente arquivos em Arquivos Tocados. Escreva as seções do SUMMARY.md que tenham embasamento e marque o resto como `_(não disponível — veja <prd_path>/QA/ para detalhes)_`.</critical>
272
+
273
+ Após esta etapa, o bugfix se torna visível para `/dw-intel "bugfix history in <module>"` na próxima run de `/dw-intel --build`.
274
+
219
275
  ### Etapa 14: Commit
220
276
 
221
277
  <critical>AUDITORIA PRE-COMMIT OBRIGATORIA — execute ANTES de invocar `/dw-commit`:
@@ -230,7 +286,7 @@ Rode `ls` em cada caminho abaixo e confirme existencia. Se QUALQUER um faltar, N
230
286
  - Evidencia do ultimo `/dw-review --coverage-only` com matriz RF-by-RF (output da sessao ou referencia em `autopilot-state.json`)
231
287
 
232
288
  Verifique tambem `autopilot-state.json`:
233
- - Toda etapa de 1 a 13 que NAO esta em `skipped_steps` deve estar em `completed_steps`
289
+ - Toda etapa de 1 a 13 (e 13.5 quando em modo `--from-prd` contra um PRD `prd-bugfix-*`) que NAO esta em `skipped_steps` deve estar em `completed_steps`
234
290
  - Cada etapa completada deve ter seus artefatos listados em `step_artifacts`
235
291
 
236
292
  Se faltar qualquer artefato ou etapa: PARE imediatamente. Reporte ao usuario: `Etapa N nao produziu artefato X — re-executando /dw-[comando]`. Re-execute o comando. Verifique novamente. Soh entao prossiga para `/dw-commit`.
@@ -263,9 +319,11 @@ Salve o arquivo `.dw/spec/prd-[nome]/autopilot-state.json` com o seguinte format
263
319
  "mode": "autopilot",
264
320
  "wish": "descricao original do usuario",
265
321
  "prd_path": ".dw/spec/prd-[nome]",
322
+ "from_prd_slug": null,
266
323
  "current_step": 8,
267
324
  "completed_steps": [1, 2, 3, 4, 5, 6, 7],
268
325
  "skipped_steps": [2],
326
+ "skip_reasons": {"2": "dominio ja mapeado em .dw/rules/auth.md"},
269
327
  "gates_passed": ["prd", "tasks"],
270
328
  "step_artifacts": {
271
329
  "9": ["review-matrix-shown-in-session"],
@@ -288,6 +346,7 @@ Salve o arquivo `.dw/spec/prd-[nome]/autopilot-state.json` com o seguinte format
288
346
  - Uma etapa SO vai para `completed_steps` apos verificar que seus artefatos existem no disco
289
347
  - Se a sessao cair, re-invoque `/dw-autopilot` no mesmo PRD; o comando le `autopilot-state.json` e continua da etapa correta, revalidando artefatos antes de confiar em `completed_steps`
290
348
  - Ao finalizar o pipeline (apos commit ou PR), remova o arquivo ou marque `"status": "completed"`
349
+ - Em modo `--from-prd`, defina `from_prd_slug: "<slug>"`, `mode: "from-prd"` e inclua as etapas 1–4 em `skipped_steps` com `skip_reason: "from-prd-mode"` — e isso que a auditoria de pre-commit checa (Etapa 14 verifica que toda etapa NAO listada em `skipped_steps` esta em `completed_steps`)
291
350
 
292
351
  <critical>Apos CADA etapa completada, exiba o bloco de progresso atualizado ao usuario. Isso e OBRIGATORIO — o usuario DEVE ver o que foi feito e o que vem a seguir. Se uma etapa foi pulada, o motivo DEVE aparecer no bloco de progresso.</critical>
293
352