@brunosps00/dev-workflow 1.1.2 → 1.2.0

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 (65) hide show
  1. package/README.md +22 -15
  2. package/bin/dev-workflow.js +1 -1
  3. package/lib/constants.js +6 -2
  4. package/lib/doctor.js +3 -1
  5. package/lib/install-deps.js +3 -3
  6. package/lib/setup-wsl-browser.js +10 -50
  7. package/lib/skill-registry.js +41 -0
  8. package/package.json +1 -1
  9. package/scaffold/en/agent-instructions.md +5 -2
  10. package/scaffold/en/commands/dw-analyze-project.md +1 -1
  11. package/scaffold/en/commands/dw-brainstorm.md +4 -1
  12. package/scaffold/en/commands/dw-functional-doc.md +3 -3
  13. package/scaffold/en/commands/dw-harness-audit.md +4 -2
  14. package/scaffold/en/commands/dw-help.md +12 -7
  15. package/scaffold/en/commands/dw-opportunities.md +131 -0
  16. package/scaffold/en/commands/dw-refactor.md +54 -0
  17. package/scaffold/en/commands/dw-review.md +1 -1
  18. package/scaffold/en/commands/dw-skill-health.md +11 -3
  19. package/scaffold/en/references/refactoring-catalog.md +1 -1
  20. package/scaffold/en/templates/constitution-template.md +1 -1
  21. package/scaffold/pt-br/agent-instructions.md +5 -2
  22. package/scaffold/pt-br/commands/dw-analyze-project.md +1 -1
  23. package/scaffold/pt-br/commands/dw-brainstorm.md +4 -1
  24. package/scaffold/pt-br/commands/dw-functional-doc.md +3 -3
  25. package/scaffold/pt-br/commands/dw-harness-audit.md +4 -2
  26. package/scaffold/pt-br/commands/dw-help.md +14 -7
  27. package/scaffold/pt-br/commands/dw-opportunities.md +131 -0
  28. package/scaffold/pt-br/commands/dw-refactor.md +54 -0
  29. package/scaffold/pt-br/commands/dw-review.md +1 -1
  30. package/scaffold/pt-br/commands/dw-skill-health.md +11 -3
  31. package/scaffold/pt-br/references/refactoring-catalog.md +1 -1
  32. package/scaffold/pt-br/templates/constitution-template.md +1 -1
  33. package/scaffold/scripts/cdp-relay/Cargo.toml +1 -1
  34. package/scaffold/scripts/cdp-relay/bin/cdp-relay.exe +0 -0
  35. package/scaffold/scripts/cdp-relay/src/main.rs +120 -23
  36. package/scaffold/scripts/functional-doc/run-playwright-flow.mjs +55 -24
  37. package/scaffold/scripts/lib/capture-screenshots.mjs +56 -17
  38. package/scaffold/scripts/lib/resolve-browser.mjs +314 -82
  39. package/scaffold/skill-registry.json +1 -1
  40. package/scaffold/skills/api-testing-recipes/SKILL.md +12 -0
  41. package/scaffold/skills/docker-compose-recipes/SKILL.md +12 -0
  42. package/scaffold/skills/dw-codebase-intel/SKILL.md +13 -1
  43. package/scaffold/skills/dw-context-budget/SKILL.md +12 -0
  44. package/scaffold/skills/dw-council/SKILL.md +12 -0
  45. package/scaffold/skills/dw-debug-protocol/SKILL.md +12 -0
  46. package/scaffold/skills/dw-execute-phase/SKILL.md +12 -0
  47. package/scaffold/skills/dw-git-discipline/SKILL.md +12 -0
  48. package/scaffold/skills/dw-incident-response/SKILL.md +12 -0
  49. package/scaffold/skills/dw-llm-eval/SKILL.md +12 -0
  50. package/scaffold/skills/dw-memory/SKILL.md +12 -0
  51. package/scaffold/skills/dw-review-rigor/SKILL.md +14 -2
  52. package/scaffold/skills/dw-search-first/SKILL.md +12 -0
  53. package/scaffold/skills/dw-silent-failure/SKILL.md +12 -0
  54. package/scaffold/skills/dw-simplification/SKILL.md +18 -6
  55. package/scaffold/skills/dw-simplification/references/deep-modules.md +1 -1
  56. package/scaffold/skills/dw-source-grounding/SKILL.md +12 -0
  57. package/scaffold/skills/dw-testing-discipline/SKILL.md +12 -0
  58. package/scaffold/skills/dw-testing-discipline/references/playwright-recipes.md +18 -19
  59. package/scaffold/skills/dw-ui-discipline/SKILL.md +12 -0
  60. package/scaffold/skills/dw-verify/SKILL.md +10 -0
  61. package/scaffold/skills/humanizer/SKILL.md +12 -0
  62. package/scaffold/skills/remotion-best-practices/SKILL.md +12 -0
  63. package/scaffold/skills/security-review/SKILL.md +12 -0
  64. package/scaffold/skills/vercel-react-best-practices/SKILL.md +12 -0
  65. package/scaffold/skills/vercel-react-best-practices/references/perf-discipline.md +1 -1
package/README.md CHANGED
@@ -26,7 +26,7 @@ npx @brunosps00/dev-workflow install-deps
26
26
 
27
27
  ## Commands
28
28
 
29
- dev-workflow v1.1.2 ships **31 commands** organized into four tiers. Most users only invoke Tier 1 + Tier 2.
29
+ dev-workflow v1.1.4 ships **33 commands** organized into four tiers. Most users only invoke Tier 1 + Tier 2.
30
30
 
31
31
  ### Tier 1 — Gateway (3)
32
32
 
@@ -36,13 +36,14 @@ dev-workflow v1.1.2 ships **31 commands** organized into four tiers. Most users
36
36
  | **`/dw-bugfix "description"`** | A bug report or pasted error. Triages bug-vs-feature-vs-scope, surgical fix or routes to a PRD. |
37
37
  | **`/dw-help [keyword]`** | Discover commands. Pass a keyword for shortcuts; `--advanced` reveals internal commands. |
38
38
 
39
- ### Tier 2 — Pipeline granular (9)
39
+ ### Tier 2 — Pipeline granular (10)
40
40
 
41
41
  Use these when you want step-by-step control instead of `/dw-autopilot`.
42
42
 
43
43
  | Command | What |
44
44
  |---------|------|
45
- | **`/dw-brainstorm "idea"`** | Refine an idea before PRD. Flags: `--onepager` (durable artifact), `--council` (multi-advisor debate), `--research` (multi-source cited research), `--refactor` (Fowler code-smell catalog). |
45
+ | **`/dw-opportunities [focus]`** | Scan the installed project, especially `/dw-analyze-project` outputs (`.dw/rules/`, `.dw/intel/`, concerns, constitution, `DESIGN.md`), for product, UX, automation, refactor, and security opportunities. `--research` adds cited external context when needed. |
46
+ | **`/dw-brainstorm "idea"`** | Refine a concrete idea before PRD. Flags: `--onepager` (durable artifact), `--council` (multi-advisor debate), `--research` (multi-source cited research). |
46
47
  | **`/dw-plan "feature"`** | PRD → TechSpec → Tasks sequentially with checkpoints. Stages: `prd`, `techspec`, `tasks`. Mandatory clarification questions, source-grounding, constitution gate, final consistency check. |
47
48
  | **`/dw-run [task-id]`** | Execute tasks. Default: all pending in dependency order with wave-based parallel dispatch. Single-task: pass an ID. `--resume` continues an interrupted plan. |
48
49
  | **`/dw-review`** | Level 2 (PRD coverage mapping) + Level 3 (code quality). Hard gates on dw-verify PASS, secure-audit, constitution violations. Flags: `--coverage-only`, `--code-only`, `--bugfix <slug>` (review a bugfix at `.dw/bugfixes/<slug>/`). |
@@ -52,12 +53,13 @@ Use these when you want step-by-step control instead of `/dw-autopilot`.
52
53
  | **`/dw-commit`** | Atomic Conventional Commits for pending changes. Applies `dw-git-discipline` (one intent per commit, lint+tests+build green before). |
53
54
  | **`/dw-generate-pr [target]`** | Push the branch, draft a PR body with summary + test plan, open the browser. Hard gates: dw-verify PASS + secure-audit. |
54
55
 
55
- ### Tier 3 — Specialty (10)
56
+ ### Tier 3 — Specialty (11)
56
57
 
57
58
  | Command | What |
58
59
  |---------|------|
59
60
  | **`/dw-analyze-project`** | Scans the repo, writes `.dw/rules/` (per-module conventions, anti-patterns, naming). Step 8 offers `.dw/constitution.md`; Step 9 writes `.dw/rules/concerns.md`; Step 10 can synthesize a frontend `DESIGN.md` from existing tokens. Run once per project; refresh after major refactors. |
60
61
  | **`/dw-redesign-ui "target"`** | Audits a frontend page, runs the `dw-ui-discipline` 4-question grounding, proposes 2-3 design directions, ships the redesign. WCAG 2.2 AA accessibility floor is non-negotiable; UI diffs can also run the deterministic impeccable slop detector. |
62
+ | **`/dw-refactor "target"`** | Audits a target for refactor opportunities using Fowler smells, `dw-simplification`, deep-modules analysis, and behavior-preserving test gates. This is the explicit route for code-health and tech-debt work. |
61
63
  | **`/dw-functional-doc`** | Maps screens + user flows into a functional doc, validated end-to-end with Playwright. Uses the WSL-resilient browser resolver and can capture guided functional video evidence. |
62
64
  | **`/dw-context-budget`** | Audits context overhead from commands, skills, agents, instruction files, and MCPs. |
63
65
  | **`/dw-harness-audit`** | Deterministic health scorecard for the dev-workflow install, agents, wrappers, MCPs, and gates. |
@@ -90,7 +92,7 @@ These are auto-invoked by Tier 1-3 commands. Available standalone via `/dw-help
90
92
  /dw-autopilot ------> Second invocation: /dw-goal → Security Gate → Commit → PR
91
93
  --- OR step-by-step ---
92
94
 
93
- /dw-brainstorm --> /dw-plan --> .dw/spec/prd-{name}/{prd,techspec,tasks}.md
95
+ /dw-opportunities --> /dw-brainstorm --> /dw-plan --> .dw/spec/prd-{name}/{prd,techspec,tasks}.md
94
96
  |
95
97
  /dw-goal --> /dw-run → /dw-review → /dw-qa → /dw-review → /dw-secure-audit
96
98
  |
@@ -101,7 +103,9 @@ Manual alternative after /dw-plan:
101
103
 
102
104
  Shortcuts:
103
105
  /dw-intel "question" Query codebase intelligence
106
+ /dw-opportunities [focus] Suggest next product, UX, automation, refactor, and security opportunities
104
107
  /dw-redesign-ui "target" Visual redesign of a page or component
108
+ /dw-refactor "target" Refactor opportunity audit for a module or code area
105
109
  ```
106
110
 
107
111
  ## Constitution
@@ -261,12 +265,12 @@ These are not slash commands — they are primitives other commands call to enfo
261
265
  |-------|-------------|------------|-------------|
262
266
  | **dw-verify** | Enforces fresh verification evidence before any completion, commit, or PR claim — with Iron Law, gate function, and Verification Report template | `/dw-run`, `/dw-goal`, `/dw-qa --fix`, `/dw-bugfix`, `/dw-review`, `/dw-generate-pr` | [Compozy](https://github.com/compozy/compozy) `cy-final-verify` |
263
267
  | **dw-memory** | Two-tier workflow memory (shared `MEMORY.md` + per-task `<N>_memory.md`) with promotion test and compaction rules, so cross-task context persists cleanly | `/dw-run`, `/dw-goal`, `/dw-autopilot`, `/dw-pause`, `/dw-resume` | [Compozy](https://github.com/compozy/compozy) `cy-workflow-memory` |
264
- | **dw-review-rigor** | Review discipline: de-duplication, severity ordering, verify-intent-before-flagging, skip-linter-issues, signal-over-volume | `/dw-review`, `/dw-brainstorm --refactor` | [Compozy](https://github.com/compozy/compozy) `cy-review-round` |
268
+ | **dw-review-rigor** | Review discipline: de-duplication, severity ordering, verify-intent-before-flagging, skip-linter-issues, signal-over-volume | `/dw-review`, `/dw-refactor`, `/dw-brainstorm --mode=refactor-audit` | [Compozy](https://github.com/compozy/compozy) `cy-review-round` |
265
269
  | **dw-council** | Multi-advisor debate (3-5 archetypes) with steel-manning, concession tracking, and dissent-preserving synthesis. Opt-in only. | `/dw-brainstorm --council`, `/dw-plan techspec --council` | [Compozy](https://github.com/compozy/compozy) `cy-idea-factory` |
266
270
  | **dw-codebase-intel** | Codebase intelligence (`stack.json`, `files.json`, `apis.json`, `deps.json`, `arch.md`) with incremental updates and query patterns. Cross-cutting reference: `api-design-discipline` (Hyrum's Law, contract-first, error semantics) used when techspecs design API endpoints. | `/dw-intel`, `/dw-intel --build`, `/dw-plan techspec` | [`get-shit-done-cc`](https://github.com/gsd-build/get-shit-done) (MIT) + [`addyosmani/agent-skills`](https://github.com/addyosmani/agent-skills) (MIT) |
267
271
  | **dw-execute-phase** | Goal-backward 6-dimension plan verification (`plan-checker`) and wave-based parallel task execution (`executor`) with atomic commit, deviation handling, and checkpoint recovery | `/dw-run`, `/dw-goal`, `/dw-autopilot` | [`get-shit-done-cc`](https://github.com/gsd-build/get-shit-done) (MIT) |
268
- | **dw-source-grounding** | Detect → Fetch → Implement → Cite protocol with `[source: <url>, version: X.Y, retrieved: YYYY-MM-DD]` citations. Strict source-priority hierarchy (Tier 1 official docs > Tier 2 maintainer blogs > Tier 3 Stack Overflow as discovery only). | `/dw-plan techspec`, `/dw-secure-audit --plan`, `/dw-brainstorm --research` | [`addyosmani/agent-skills`](https://github.com/addyosmani/agent-skills) (MIT) |
269
- | **dw-simplification** | Chesterton's Fence (understand WHY before changing), behavior-preserving refactor protocol (test gate before/after), complexity metrics (cyclomatic, cognitive, depth, fan-out), Rule of 500 for large refactors | `/dw-review`, `/dw-brainstorm --refactor` | [`addyosmani/agent-skills`](https://github.com/addyosmani/agent-skills) (MIT) |
272
+ | **dw-source-grounding** | Detect → Fetch → Implement → Cite protocol with `[source: <url>, version: X.Y, retrieved: YYYY-MM-DD]` citations. Strict source-priority hierarchy (Tier 1 official docs > Tier 2 maintainer blogs > Tier 3 Stack Overflow as discovery only). | `/dw-plan techspec`, `/dw-secure-audit --plan`, `/dw-opportunities --research`, `/dw-brainstorm --research` | [`addyosmani/agent-skills`](https://github.com/addyosmani/agent-skills) (MIT) |
273
+ | **dw-simplification** | Chesterton's Fence (understand WHY before changing), behavior-preserving refactor protocol (test gate before/after), complexity metrics (cyclomatic, cognitive, depth, fan-out), Rule of 500 for large refactors | `/dw-review`, `/dw-refactor`, `/dw-brainstorm --mode=refactor-audit` | [`addyosmani/agent-skills`](https://github.com/addyosmani/agent-skills) (MIT) |
270
274
  | **dw-debug-protocol** | Stop-the-line discipline plus six-step triage (Reproduce → Localize → Reduce → Fix Root Cause → Guard → Verify End-to-End). Error categorization matrix; instrument-first non-reproducible-bug strategy. | `/dw-bugfix`, `/dw-qa --fix` | [`addyosmani/agent-skills`](https://github.com/addyosmani/agent-skills) (MIT) |
271
275
  | **dw-git-discipline** | Trunk-based pattern (1-3 day branches, daily rebase, feature flags), atomic commit discipline (one intent per commit; refactor separate from feature), Conventional Commits, branch hygiene | `dw-commit`, `dw-generate-pr` | [`addyosmani/agent-skills`](https://github.com/addyosmani/agent-skills) (MIT) |
272
276
 
@@ -310,7 +314,7 @@ npx @brunosps00/dev-workflow list-installed # Show managed instal
310
314
  npx @brunosps00/dev-workflow doctor # Check wrappers, agents, skills, MCPs, gates
311
315
  npx @brunosps00/dev-workflow repair # Reconcile managed files from recorded install state
312
316
  npx @brunosps00/dev-workflow install-deps # Install Playwright, react-doctor; check security scanners + Docker
313
- npx @brunosps00/dev-workflow setup-wsl-browser # WSL NAT: install prebuilt CDP relay + add Hyper-V firewall rule
317
+ npx @brunosps00/dev-workflow setup-wsl-browser # WSL NAT: install optional user-level CDP fallback relay (no admin)
314
318
  npx @brunosps00/dev-workflow install-azure-skills # Opt-in: Azure skills + Microsoft Learn MCP
315
319
  npx @brunosps00/dev-workflow install-azure-skills --products=azure-aks,azure-openai # Subset override
316
320
  npx @brunosps00/dev-workflow install-aws-skills # Opt-in: AWS skills + AWS MCP Server (needs uv + aws cli + creds)
@@ -324,10 +328,11 @@ npx @brunosps00/dev-workflow help # Show help
324
328
  After running `npx @brunosps00/dev-workflow init`:
325
329
 
326
330
  1. **Run `/dw-analyze-project`** in your AI assistant to generate project rules
327
- 2. **Run `/dw-brainstorm`** to start planning a new feature
328
- 3. **Run `/dw-help`** to see all available commands and workflows
329
- 4. **(Optional) Run `npx @brunosps00/dev-workflow install-deps`** to install Playwright + react-doctor and check Trivy/Semgrep/gitleaks/syft + Docker
330
- 5. **Run `/dw-intel --build`** once your project has source files to build the queryable index in `.dw/intel/`
331
+ 2. **Run `/dw-opportunities`** when you want the project to suggest what to improve next
332
+ 3. **Run `/dw-brainstorm`** when you already have an idea and want to refine it
333
+ 4. **Run `/dw-help`** to see all available commands and workflows
334
+ 5. **(Optional) Run `npx @brunosps00/dev-workflow install-deps`** to install Playwright + react-doctor and check Trivy/Semgrep/gitleaks/syft + Docker
335
+ 6. **Run `/dw-intel --build`** once your project has source files to build the queryable index in `.dw/intel/`
331
336
 
332
337
  ## Acknowledgements
333
338
 
@@ -351,6 +356,8 @@ Session continuity and adaptive routing patterns adapted from [`tech-leads-club/
351
356
 
352
357
  Four patterns from [`mattpocock/skills`](https://github.com/mattpocock/skills) by Matt Pocock (MIT) were integrated **without adding new commands or skills** — instead they fold into the existing surface as internal modes and inline guidance: (1) **grill-with-docs** → `/dw-brainstorm` `grill` mode (interview discipline that stress-tests plan vocabulary against `.dw/rules/`); (2) **prototype** → `/dw-brainstorm` `prototype` mode (LOGIC terminal app or UI variant dispatch); (3) **improve-codebase-architecture** → `dw-simplification/references/deep-modules.md` (deletion test, locality, leverage, seam, adapter diagnostic invoked by the `refactor-audit` mode); (4) **zoom-out** → one-paragraph guidance in `agent-instructions.md`. The same release also collapses `/dw-brainstorm`'s six legacy flags into a single full-flow entry point that auto-dispatches modes based on project signals.
353
358
 
359
+ Opportunity discovery and the explicit `/dw-refactor` surface were inspired by patterns observed in [`pedronauck/skills`](https://github.com/pedronauck/skills), especially `game-changing-features` (10x opportunity framing) and `refactoring-analysis` (Fowler-smell prioritization). dev-workflow does not install or depend on that repository at runtime, and the command text here is a clean-room adaptation of the workflow shape rather than copied skill content.
360
+
354
361
  ## Migration from v0.x (1.0.0 is a consolidation release)
355
362
 
356
363
  v1.0.0 consolidated the legacy command surface into the current `dw-*` pipeline. **The `dev-workflow init`, `update`, and `repair` flows auto-remove obsolete wrappers and known removed command sources**; no manual action required.
@@ -372,7 +379,7 @@ v1.0.0 consolidated the legacy command surface into the current `dw-*` pipeline.
372
379
  | `/dw-deps-audit` | `/dw-secure-audit --plan` |
373
380
  | `/dw-map-codebase` | `/dw-intel --build` |
374
381
  | `/dw-deep-research` | `/dw-brainstorm --research` |
375
- | `/dw-refactoring-analysis` | `/dw-brainstorm --refactor` |
382
+ | `/dw-refactoring-analysis` | `/dw-refactor` |
376
383
 
377
384
  ### Removed (1)
378
385
 
@@ -394,7 +401,7 @@ On the next `npx @brunosps00/dev-workflow update`, the following happens automat
394
401
 
395
402
  ### Backwards compatibility
396
403
 
397
- **There is none** — v1.0.0 is a clean cut per design. There are no aliases. Calling `/dw-create-prd` will not work; use `/dw-plan prd`. Update your team's runbooks and AI-agent instructions (CLAUDE.md / AGENTS.md) accordingly; the auto-trigger map in `agent-instructions.md` is already updated.
404
+ **There is none for the v0.x removed command names** — v1.0.0 was a clean cut per design. Calling `/dw-create-prd` will not work; use `/dw-plan prd`. `/dw-refactor` is a new explicit command surface for the current refactor-audit protocol; it does not restore the old `/dw-refactoring-analysis` name. Update your team's runbooks and AI-agent instructions (CLAUDE.md / AGENTS.md) accordingly; the auto-trigger map in `agent-instructions.md` is already updated.
398
405
 
399
406
  ### CLAUDE.md / AGENTS.md updates
400
407
 
@@ -47,7 +47,7 @@ const HELP_TEXT = `
47
47
  repair Reconcile managed files using the recorded install state
48
48
  subtask Create, complete, consume, and list local subagent handoffs
49
49
  install-deps Install system dependencies (Playwright browsers, MCP servers)
50
- setup-wsl-browser (WSL) Install the prebuilt CDP relay + add the Hyper-V firewall rule so flows can drive the real Windows browser
50
+ setup-wsl-browser (WSL) Install the optional user-level CDP fallback relay for the real Windows browser without admin
51
51
  install-azure-skills Opt-in: clone curated Azure skills from MicrosoftDocs/Agent-Skills
52
52
  into .agents/skills/azure/ and register the Microsoft Learn MCP
53
53
  server (HTTP, no-auth). Interactive category selection.
package/lib/constants.js CHANGED
@@ -3,7 +3,7 @@ const COMMANDS = {
3
3
  { name: 'dw-adr', description: 'Records an architectural decision and the trade-offs accepted, before they get lost.' },
4
4
  { name: 'dw-analyze-project', description: 'Scans the repo to learn its stack and conventions, then writes the rules other commands rely on.' },
5
5
  { name: 'dw-autopilot', description: 'Trigger when user asks to implement, build, create, or add a feature non-trivially. First invocation plans and stops; second invocation resumes via dw-goal, then commit and PR.' },
6
- { name: 'dw-brainstorm', description: 'Refine an idea against the product\'s existing features. Modes: default ideation, --research (multi-source cited research), --refactor (Fowler code-smell catalog), --onepager, --council.' },
6
+ { name: 'dw-brainstorm', description: 'Refine a concrete idea against the product\'s existing features. Modes: ideation, --research, --onepager, --council. Use dw-opportunities before you have an idea and dw-refactor for code-health audits.' },
7
7
  { name: 'dw-bugfix', description: 'Trigger when user reports a bug, pastes an error, or describes broken behavior. Triages with three questions, then fixes or routes to PRD.' },
8
8
  { name: 'dw-commit', description: 'Trigger when implementation is complete and pending changes need to be committed. Atomic commits with Conventional Commits messages.' },
9
9
  { name: 'dw-dockerize', description: 'Reads a project, detects the stack and runtime deps, then proposes Dockerfile and docker-compose for dev and prod with explicit trade-offs.' },
@@ -18,10 +18,12 @@ const COMMANDS = {
18
18
  { name: 'dw-install-azure-skills', description: 'Trigger when user asks to install Azure expertise, setup Microsoft docs MCP, or add Azure agent skills. Opt-in: clones curated skills from MicrosoftDocs/Agent-Skills into .agents/skills/azure/ and registers the Microsoft Learn MCP server.' },
19
19
  { name: 'dw-intel', description: 'Codebase intelligence: query mode (default) answers questions citing .dw/intel/ + .dw/rules/; --build mode (re)builds the index.' },
20
20
  { name: 'dw-new-project', description: 'Interviews you about stack and infra, then scaffolds a working monorepo with docker-compose for dev, .env, scripts, CI, and seeded rules.' },
21
+ { name: 'dw-opportunities', description: 'Scans the installed project for product, UX, automation, refactor, and security opportunities, then routes each idea to the right next dw-* command.' },
21
22
  { name: 'dw-pause', description: 'Trigger when user says "pause work", "end session", or "save where we are". Consolidates open loops, decisions, blockers, and todos into .dw/STATE.md so the next session can resume.' },
22
23
  { name: 'dw-plan', description: 'Trigger when user has a feature idea and needs spec + architecture + tasks. Runs PRD → TechSpec → Tasks sequentially. Stages: prd / techspec / tasks; --from techspec; --council.' },
23
24
  { name: 'dw-qa', description: 'Trigger when user wants to validate behavior beyond unit tests. Mode-aware (UI / API / --ai / --uat). --fix enters the iterative QA + fix-retest loop. --bugfix <slug> targets a .dw/bugfixes/ entry.' },
24
25
  { name: 'dw-redesign-ui', description: 'Audits a frontend page, proposes design directions you choose from, then ships the redesign.' },
26
+ { name: 'dw-refactor', description: 'Audits a target for refactor opportunities using the refactor-audit protocol, Fowler smells, deep-modules analysis, and behavior-preserving test gates.' },
25
27
  { name: 'dw-resume', description: 'Trigger when user says "resume work", "where did we stop?", or starts a session in a project with an existing .dw/STATE.md. Reads STATE.md, presents a TLDR, and suggests the next dw-* command.' },
26
28
  { name: 'dw-review', description: 'Trigger when user asks to review code, check quality, or verify PR readiness. Default runs L2 (PRD coverage) + L3 (code quality). Flags --coverage-only / --code-only / --bugfix <slug>.' },
27
29
  { name: 'dw-run', description: 'Trigger when user wants to execute tasks. Default runs all pending in dependency order; \'run <task-id>\' runs one; \'run --resume\' continues an interrupted plan.' },
@@ -36,7 +38,7 @@ const COMMANDS = {
36
38
  { name: 'dw-adr', description: 'Registra uma decisao arquitetural e os trade-offs aceitos, antes que se percam.' },
37
39
  { name: 'dw-analyze-project', description: 'Escaneia o repo para aprender stack e convencoes, e escreve as regras que os outros commands usam.' },
38
40
  { name: 'dw-autopilot', description: 'Trigger quando usuario pede pra implementar, criar ou adicionar uma feature nao-trivial. Primeira invocacao planeja e para; segunda retoma via dw-goal, depois commit e PR.' },
39
- { name: 'dw-brainstorm', description: 'Refina uma ideia contra features existentes do produto. Modos: ideacao default, --research (research multi-fonte citada), --refactor (catalogo de code smells Fowler), --onepager, --council.' },
41
+ { name: 'dw-brainstorm', description: 'Refina uma ideia concreta contra features existentes do produto. Modos: ideacao, --research, --onepager, --council. Use dw-opportunities antes de ter uma ideia e dw-refactor para auditoria de code health.' },
40
42
  { name: 'dw-bugfix', description: 'Trigger quando usuario reporta bug, cola erro ou descreve comportamento quebrado. Tria com tres perguntas, depois corrige ou roteia pra PRD.' },
41
43
  { name: 'dw-commit', description: 'Trigger quando implementacao esta completa e ha mudancas pendentes pra commit. Commits atomicos com mensagens Conventional Commits.' },
42
44
  { name: 'dw-dockerize', description: 'Le um projeto, detecta stack e deps de runtime, e propoe Dockerfile e docker-compose para dev e prod com trade-offs explicitos.' },
@@ -51,10 +53,12 @@ const COMMANDS = {
51
53
  { name: 'dw-install-azure-skills', description: 'Trigger quando usuario pede pra instalar expertise Azure, configurar MCP do Microsoft docs, ou adicionar agent skills Azure. Opt-in: clona skills curadas de MicrosoftDocs/Agent-Skills para .agents/skills/azure/ e registra o Microsoft Learn MCP server.' },
52
54
  { name: 'dw-intel', description: 'Inteligencia do codebase: modo query (default) responde citando .dw/intel/ + .dw/rules/; modo --build (re)constroi indice.' },
53
55
  { name: 'dw-new-project', description: 'Entrevista voce sobre stack e infra, depois faz scaffold de um monorepo com docker-compose para dev, .env, scripts, CI e rules seed.' },
56
+ { name: 'dw-opportunities', description: 'Escaneia o projeto instalado por oportunidades de produto, UX, automacao, refactor e seguranca, e roteia cada ideia para o proximo comando dw-* correto.' },
54
57
  { name: 'dw-pause', description: 'Trigger quando usuario diz "pausa o trabalho", "encerra a sessao" ou "salva onde paramos". Consolida pontas soltas, decisoes, bloqueios e todos em .dw/STATE.md para a proxima sessao retomar.' },
55
58
  { name: 'dw-plan', description: 'Trigger quando usuario tem ideia de feature e precisa spec + arquitetura + tasks. Roda PRD → TechSpec → Tasks sequencial. Stages: prd / techspec / tasks; --from techspec; --council.' },
56
59
  { name: 'dw-qa', description: 'Trigger quando usuario quer validar comportamento alem de unit tests. Mode-aware (UI / API / --ai / --uat). --fix entra no loop iterativo QA + fix-retest. --bugfix <slug> aponta para uma entrada em .dw/bugfixes/.' },
57
60
  { name: 'dw-redesign-ui', description: 'Audita uma pagina frontend, propoe direcoes de design que voce escolhe, e entrega o redesign.' },
61
+ { name: 'dw-refactor', description: 'Audita um target por oportunidades de refactor usando o protocolo refactor-audit, smells Fowler, deep-modules e gates de teste preservando comportamento.' },
58
62
  { name: 'dw-resume', description: 'Trigger quando usuario diz "retoma", "onde paramos?" ou comeca sessao num projeto com .dw/STATE.md existente. Le STATE.md, apresenta TLDR e sugere proximo comando dw-*.' },
59
63
  { name: 'dw-review', description: 'Trigger quando usuario pede pra revisar codigo, checar qualidade ou validar prontidao pra PR. Default roda L2 (cobertura PRD) + L3 (qualidade). Flags --coverage-only / --code-only / --bugfix <slug>.' },
60
64
  { name: 'dw-run', description: 'Trigger quando usuario quer executar tasks. Default roda todas pendentes em ordem de dependencia; \'run <task-id>\' roda uma; \'run --resume\' continua plan interrompido.' },
package/lib/doctor.js CHANGED
@@ -9,7 +9,7 @@ const {
9
9
  AGENT_TARGETS,
10
10
  } = require('./agents');
11
11
  const { readInstallState, STATE_RELATIVE_PATH } = require('./install-state');
12
- const { validateSkillRegistry, readSkillRegistry } = require('./skill-registry');
12
+ const { validateSkillRegistry, readSkillRegistry, validateSkillStructuredReturn } = require('./skill-registry');
13
13
  const removedCommands = require('./removed-commands');
14
14
 
15
15
  function run() {
@@ -178,6 +178,8 @@ function checkSkillRegistry(projectRoot, issues, warnings) {
178
178
  const skillPath = path.join(projectRoot, '.agents', 'skills', entry.name, 'SKILL.md');
179
179
  if (!fs.existsSync(skillPath)) {
180
180
  issues.push(`Missing bundled skill: ${path.relative(projectRoot, skillPath)}`);
181
+ } else {
182
+ validateSkillStructuredReturn(entry.name, skillPath, issues, `Installed bundled skill ${entry.name}`);
181
183
  }
182
184
  }
183
185
  }
@@ -167,14 +167,14 @@ function printBrowserGuidance() {
167
167
  const mirrored = require('fs').existsSync('/sys/class/net/loopback0');
168
168
  console.log(' Browser automation on WSL (dw-qa / dw-functional-doc / dw-redesign-ui):');
169
169
  console.log(' Default: full headless Chromium (desktop-faithful, no WSLg) — works out of the box.');
170
- console.log(' To drive the real Windows browser, set BROWSER_TEST to its exe path, e.g.');
170
+ console.log(' Optional CDP fallback: set BROWSER_TEST to a Windows browser exe path, e.g.');
171
171
  console.log(' BROWSER_TEST="/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe".');
172
172
  if (mirrored) {
173
173
  console.log(' Mirrored networking detected — connects to the Windows browser on 127.0.0.1 directly.');
174
174
  } else {
175
175
  console.log(' NAT networking — run `npx @brunosps00/dev-workflow setup-wsl-browser` once to install the');
176
- console.log(' bundled cdp-relay.exe and add the Hyper-V firewall rule. Otherwise flows');
177
- console.log(' fall back to the local headless Chromium (faithful video, no Windows browser).');
176
+ console.log(' bundled user-level cdp-relay.exe. No admin prompt or firewall rule is required. Playwright');
177
+ console.log(' Chromium remains the primary browser; CDP is only used if that launch fails.');
178
178
  }
179
179
  console.log(' Details: .dw/skills/dw-testing-discipline/references/playwright-recipes.md ("Browser on WSL").');
180
180
  console.log();
@@ -2,17 +2,13 @@ const { execSync } = require('child_process');
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
 
5
- // Installs the prebuilt CDP relay (cdp-relay.exe) on Windows and adds the one-time
6
- // Hyper-V firewall rule so WSL (NAT networking) can drive the real Windows browser over CDP.
7
- // Idempotent.
5
+ // Installs the prebuilt CDP relay (cdp-relay.exe) in the Windows user profile. Idempotent.
8
6
  //
9
- // Why: Chromium binds its debug port to Windows loopback only, and the WSL Hyper-V firewall
10
- // defaults inbound to Block. A fixed-port relay + one Hyper-V allow rule bridges WSL -> browser.
7
+ // Why: Chromium binds its debug port to Windows loopback only. On WSL NAT, dev-workflow uses
8
+ // a reverse relay where the Windows-side .exe connects outbound to a WSL broker, so no admin
9
+ // prompt, firewall rule, Rust, Node, or Python runtime is required on the Windows target.
11
10
  // The relay is a tiny prebuilt .exe — no Rust/Node/Python runtime dependency on the Windows target.
12
11
 
13
- const RELAY_PORT = 39222;
14
- const WSL_VM_CREATOR_ID = '{40E0AC32-46A5-438A-A0B2-2B479E8F2E90}'; // standard WSL VM creator id
15
- const RULE_NAME = 'dw-cdp-relay';
16
12
  const RELAY_EXE_SRC = path.join(__dirname, '..', 'scaffold', 'scripts', 'cdp-relay', 'bin', 'cdp-relay.exe');
17
13
 
18
14
  function isWsl() {
@@ -50,7 +46,7 @@ function run() {
50
46
  const destWin = `${localAppData}\\dev-workflow`;
51
47
  const destWsl = execSync(`wslpath -u "${destWin}"`, { stdio: 'pipe' }).toString().trim();
52
48
 
53
- // 1) Install the prebuilt Windows relay bundled in the npm package.
49
+ // Install the prebuilt Windows relay bundled in the npm package.
54
50
  if (!fs.existsSync(RELAY_EXE_SRC)) {
55
51
  console.log(` \x1b[31m✗\x1b[0m Prebuilt relay not found at ${RELAY_EXE_SRC}`);
56
52
  console.log(' The dev-workflow package is incomplete. Reinstall or update @brunosps00/dev-workflow.');
@@ -69,48 +65,12 @@ function run() {
69
65
  return;
70
66
  }
71
67
 
72
- // 2) Add the Hyper-V firewall inbound rule (one-time, elevated -> UAC prompt).
73
- console.log(`\n Adding Hyper-V firewall rule for TCP ${RELAY_PORT} (a UAC prompt will appear — accept it)...`);
74
- const inner = [
75
- `Remove-NetFirewallHyperVRule -Name '${RULE_NAME}' -ErrorAction SilentlyContinue;`,
76
- `New-NetFirewallHyperVRule -Name '${RULE_NAME}' -DisplayName 'dev-workflow cdp-relay'`,
77
- `-Direction Inbound -Action Allow -VMCreatorId '${WSL_VM_CREATOR_ID}' -Protocol TCP -LocalPorts ${RELAY_PORT}`,
78
- ].join(' ');
79
- try {
80
- execSync(
81
- `powershell.exe -NoProfile -Command "Start-Process powershell -Verb RunAs -WindowStyle Hidden -ArgumentList '-NoProfile','-Command',\\"${inner}\\""`,
82
- { stdio: 'pipe', timeout: 60000 },
83
- );
84
- } catch {
85
- // Start-Process returns before the elevated process finishes; verify below regardless.
86
- }
87
-
88
- // 3) Verify.
89
- let ok = false;
90
- for (let i = 0; i < 10 && !ok; i += 1) {
91
- try {
92
- const out = execSync(
93
- `powershell.exe -NoProfile -c "Get-NetFirewallHyperVRule -Name '${RULE_NAME}' -ErrorAction SilentlyContinue | Select-Object -Expand Action"`,
94
- { stdio: 'pipe', timeout: 15000 },
95
- ).toString();
96
- ok = /Allow/i.test(out);
97
- } catch {
98
- ok = false;
99
- }
100
- if (!ok) execSync('sleep 1');
101
- }
102
-
103
68
  console.log(` ${'='.repeat(40)}`);
104
- if (ok) {
105
- console.log(' \x1b[32m✓ Done.\x1b[0m The Windows browser is reachable from WSL over CDP.');
106
- console.log(` Set BROWSER_TEST to a Windows browser exe to use it, e.g.`);
107
- console.log(' BROWSER_TEST="/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"');
108
- } else {
109
- console.log(' \x1b[33m⚠ Hyper-V firewall rule not confirmed.\x1b[0m UAC may have been declined, or this Windows lacks');
110
- console.log(' Hyper-V firewall cmdlets. Flows will fall back to the local headless Chromium (faithful video, no');
111
- console.log(' Windows browser). You can also enable mirrored networking instead. Re-run to retry.');
112
- }
69
+ console.log(' \x1b[32m✓ Done.\x1b[0m The optional CDP fallback relay is installed in the Windows user profile.');
70
+ console.log(' No admin prompt, firewall rule, or Windows Rust toolchain is required.');
71
+ console.log(` Set BROWSER_TEST to a Windows browser exe to make it available as fallback, e.g.`);
72
+ console.log(' BROWSER_TEST="/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"');
113
73
  console.log();
114
74
  }
115
75
 
116
- module.exports = { run, RELAY_PORT };
76
+ module.exports = { run };
@@ -8,6 +8,16 @@ const SKILLS_DIR = path.join(SCAFFOLD_DIR, 'skills');
8
8
 
9
9
  const VALID_KINDS = new Set(['protocol', 'domain-pack', 'recipe-pack', 'asset-pack']);
10
10
  const VALID_LOAD_POLICIES = new Set(['always-small', 'lazy-references', 'opt-in-runtime']);
11
+ const REQUIRED_STRUCTURED_RETURN_FIELDS = [
12
+ '**Status:**',
13
+ '**Scope:**',
14
+ '**Evidence:**',
15
+ '**Artifacts:**',
16
+ '**Decisions:**',
17
+ '**Risks:**',
18
+ '**Next Step:**',
19
+ ];
20
+ const REQUIRED_STRUCTURED_RETURN_STATUSES = ['`PASS`', '`FINDINGS`', '`BLOCKED`', '`NOT_APPLICABLE`'];
11
21
 
12
22
  function readSkillRegistry() {
13
23
  const registry = readJson(REGISTRY_PATH, null);
@@ -56,6 +66,8 @@ function validateSkillRegistry() {
56
66
  warnings.push(`Skill ${entry.name} SKILL.md is ${size} bytes; registry limit is ${entry.context_limit}`);
57
67
  }
58
68
 
69
+ validateSkillStructuredReturn(entry.name, skillPath, issues, `Scaffold skill ${entry.name}`);
70
+
59
71
  if (entry.load_policy === 'always-small' && size > 8000) {
60
72
  warnings.push(`Skill ${entry.name} is marked always-small but SKILL.md is ${size} bytes`);
61
73
  }
@@ -90,6 +102,34 @@ function validateEntry(entry, issues) {
90
102
  }
91
103
  }
92
104
 
105
+ function validateSkillStructuredReturn(skillName, skillPath, issues, label = `Skill ${skillName}`) {
106
+ let content;
107
+ try {
108
+ content = fs.readFileSync(skillPath, 'utf-8');
109
+ } catch {
110
+ issues.push(`${label} cannot be read: ${path.relative(process.cwd(), skillPath)}`);
111
+ return;
112
+ }
113
+
114
+ if (!content.includes('## Structured Return')) {
115
+ issues.push(`${label} missing Structured Return contract: ${path.relative(process.cwd(), skillPath)}`);
116
+ return;
117
+ }
118
+
119
+ for (const field of REQUIRED_STRUCTURED_RETURN_FIELDS) {
120
+ if (!content.includes(field)) {
121
+ issues.push(`${label} Structured Return missing ${field}`);
122
+ }
123
+ }
124
+
125
+ const statusLine = content.split(/\r?\n/).find((line) => line.includes('**Status:**')) || '';
126
+ for (const status of REQUIRED_STRUCTURED_RETURN_STATUSES) {
127
+ if (!statusLine.includes(status)) {
128
+ issues.push(`${label} Structured Return status vocabulary missing ${status}`);
129
+ }
130
+ }
131
+ }
132
+
93
133
  function listInstalledSkillNames(projectRoot) {
94
134
  const installedDir = path.join(projectRoot, '.agents', 'skills');
95
135
  if (!fs.existsSync(installedDir)) return [];
@@ -104,6 +144,7 @@ module.exports = {
104
144
  REGISTRY_PATH,
105
145
  readSkillRegistry,
106
146
  validateSkillRegistry,
147
+ validateSkillStructuredReturn,
107
148
  listScaffoldSkillNames,
108
149
  listInstalledSkillNames,
109
150
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brunosps00/dev-workflow",
3
- "version": "1.1.2",
3
+ "version": "1.2.0",
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"
@@ -14,7 +14,7 @@ Before picking a command from the Trigger Map, gauge the change's actual scope.
14
14
  | **Small** | ≤3 files, no migration, no new endpoint, can be summarized in one sentence. Examples: typo, log message, single-line config, dependency bump, version pin. | Just do it inline. No `dw-*` command. |
15
15
  | **Medium** | Clear feature or bug, <10 numbered tasks expected, single component or single service, no architectural decisions. Examples: add a form field with validation, fix a regression in a known module, wire a new API endpoint into an existing handler. | `/dw-bugfix` (for bugs) or `/dw-plan` (for features) — straight, not via `/dw-autopilot`. |
16
16
  | **Large** | Multi-component feature, ≥10 tasks expected, touches multiple modules, has user-visible UX surface AND backend. Examples: add a new entity end-to-end (model + migration + API + UI), introduce a third-party integration, redesign a flow. | `/dw-autopilot "<wish>"` — first invocation plans and stops; second invocation resumes via `/dw-goal` for Run → Review → QA/Fix → Review, then Commit → PR. |
17
- | **Complex** | New domain, ambiguous requirements, architectural decision required, regulatory or compliance surface, or scope that spans multiple PRDs. Examples: introduce event sourcing, rebuild auth, multi-tenancy, a new product line. | `/dw-brainstorm "<idea>"` first (auto-dispatches research/council modes), then `/dw-plan --council` so the techspec stage runs the multi-advisor debate. |
17
+ | **Complex** | New domain, ambiguous requirements, architectural decision required, regulatory or compliance surface, or scope that spans multiple PRDs. Examples: introduce event sourcing, rebuild auth, multi-tenancy, a new product line. | `/dw-opportunities` first if the idea is not yet known; otherwise `/dw-brainstorm "<idea>"` (auto-dispatches research/council modes), then `/dw-plan --council` so the techspec stage runs the multi-advisor debate. |
18
18
 
19
19
  **Safety valve:** if you start in Small or Medium but the work reveals it's actually Large (the inline listing exceeds 5 steps, or `/dw-bugfix` triggers its `Step 5.0` valve), STOP and escalate. There is no flag to bypass. Escalation is the correct outcome.
20
20
 
@@ -49,7 +49,10 @@ Before picking a command from the Trigger Map, gauge the change's actual scope.
49
49
  | "Just the code quality review" | `/dw-review --code-only` |
50
50
  | "Time to commit" / changes are validated and ready | `/dw-commit` |
51
51
  | "Open a PR" / "Ship this" | `/dw-generate-pr` |
52
- | "Brainstorm X" / "Explore ideas" / "Research X" / "Code-health audit" / "Find tech debt" | `/dw-brainstorm "X"` (auto-dispatches grill / prototype / council / research / refactor-audit / onepager based on signals) |
52
+ | "Suggest new ideas" / "What should we build next?" / "Find opportunities" / "Roadmap ideas" | `/dw-opportunities` |
53
+ | "What security improvements should we consider?" / "Find security opportunities" | `/dw-opportunities "security"` |
54
+ | "Brainstorm X" / "Explore this idea" / "Research X" | `/dw-brainstorm "X"` (auto-dispatches grill / prototype / council / research / onepager based on signals) |
55
+ | "Code-health audit" / "Find tech debt" / "Refactor opportunities" / "Smells in X" | `/dw-refactor "X"` |
53
56
  | "Where is X?" / "What uses Y?" / "How is Z structured?" | `/dw-intel "<question>"` |
54
57
  | "Rebuild the codebase index" / "Refresh intel" | `/dw-intel --build` |
55
58
  | "Context is heavy" / "Audit token usage" / "Why is the agent slow?" | `/dw-context-budget` |
@@ -26,7 +26,7 @@ You are a project analysis specialist. Your task is to scan the current reposito
26
26
  The rules generated by this command are consumed by:
27
27
  - `/dw-run` -- reads rules for implementation patterns
28
28
  - `/dw-review --code-only` -- reads rules for conformance checks
29
- - `/dw-brainstorm --refactor` -- reads rules for project context
29
+ - `/dw-refactor` -- reads rules for project context
30
30
  - `/dw-plan techspec` -- reads rules for architecture decisions
31
31
 
32
32
  <critical>This command ONLY generates documentation. Do NOT modify any project source code.</critical>
@@ -7,6 +7,7 @@ You are a brainstorming facilitator for the current workspace. This command exis
7
7
  ## When to Use
8
8
  - Use when exploring ideas before committing to a PRD, comparing architectural directions, or unblocking vague requirements
9
9
  - Do NOT use when you already have clear requirements ready for a PRD, or when you need to implement code
10
+ - For standalone code-health or tech-debt audits, prefer `/dw-refactor`; this command only reaches `refactor-audit` when refactor signals appear during broader ideation.
10
11
 
11
12
  ## Pipeline Position
12
13
  **Predecessor:** (user idea) | **Successor:** `/dw-plan prd`
@@ -38,7 +39,7 @@ Power users who already know what they want can pass `--mode=`. Everyone else ge
38
39
 
39
40
  ### Migration note (transitional)
40
41
 
41
- Old flag invocations (`--onepager`, `--council`, `--research`, `--refactor`, `--grill`, `--prototype`) remain accepted for one minor cycle and map to the equivalent `--mode=` value. New code should use `--mode=` or rely on auto-dispatch.
42
+ Old flag invocations (`--onepager`, `--council`, `--research`, `--refactor`, `--grill`, `--prototype`) remain accepted for one minor cycle and map to the equivalent `--mode=` value. New code should use `/dw-refactor` for standalone refactor audits, `--mode=refactor-audit` only for explicit compatibility, or rely on auto-dispatch.
42
43
 
43
44
  ## Decision Flowchart: Brainstorm vs Direct PRD
44
45
 
@@ -149,6 +150,8 @@ Before producing any output, **read the situation**:
149
150
  - `/dw-plan techspec`
150
151
  - `/dw-plan tasks`
151
152
  - `/dw-bugfix`
153
+ - `/dw-refactor` (if the useful next move is a dedicated code-health audit)
154
+ - `/dw-secure-audit` (if the useful next move is security hardening or dependency remediation)
152
155
 
153
156
  ## Heuristics
154
157
 
@@ -294,11 +294,11 @@ Use the workspace utilities when appropriate:
294
294
  - `node .dw/scripts/functional-doc/generate-dossier.mjs --target <URL> [--lang en|pt-br] [--project <name>] [--base-url <url>]`
295
295
  - `node .dw/scripts/functional-doc/run-playwright-flow.mjs --flow-dir <path> [--video-resolution fullhd|1920x1080] [--list-only]`
296
296
 
297
- The runner drives Playwright via the Node API and records video with `page.screencast` (the only
298
- mechanism that works over CDP). It generates `scripts/<slug>.flow.mjs` — a plain ESM module exporting
297
+ The runner drives Playwright via the Node API and records video with `page.screencast` (works with
298
+ the primary launched Chromium and the CDP fallback). It generates `scripts/<slug>.flow.mjs` — a plain ESM module exporting
299
299
  `async function flow({ page, context, expect, baseURL, step, shot })` — not a `@playwright/test` spec,
300
300
  so it needs no project `playwright.config.*`. The browser is chosen by `.dw/scripts/lib/resolve-browser.mjs`
301
- (WSL-resilient: full headless Chromium by default; set `BROWSER_TEST` to a Windows browser exe to drive it over CDP — in NAT run `npx @brunosps00/dev-workflow setup-wsl-browser` once to install the prebuilt cdp-relay.exe + Hyper-V rule, mirrored networking works directly);
301
+ (WSL-resilient: full headless Chromium by default; set `BROWSER_TEST` to a Windows browser exe only as CDP fallback — in NAT run `npx @brunosps00/dev-workflow setup-wsl-browser` once to install the optional user-level reverse cdp-relay.exe, mirrored networking works directly);
302
302
  see the "Browser on WSL" section of `dw-testing-discipline/references/playwright-recipes.md`. Chromium
303
303
  only — `screencast`/CDP do not support Firefox/WebKit.
304
304
 
@@ -15,14 +15,16 @@ You are the dev-workflow harness auditor.
15
15
  - Agent registry
16
16
  - Provider compatibility
17
17
  - Handoff discipline
18
+ - Structured skill returns
18
19
  - Tool permissions
19
20
  - Parallel-safety coverage
20
21
  - MCP configuration
21
22
  - Verification gates
22
23
  - Security gates
23
24
  - Context discipline
24
- 3. Cite missing paths and broken references.
25
- 4. Recommend the top 3 fixes.
25
+ 3. For structured skill returns, inspect bundled skill `SKILL.md` files and require a `## Structured Return` contract with `Status`, `Evidence`, `Artifacts`, and `Next Step`.
26
+ 4. Cite missing paths, broken references, stale managed files, and skills without a structured return.
27
+ 5. Recommend the top 3 fixes.
26
28
 
27
29
  ## Output
28
30
  Return a scorecard and do not mutate files. Tell the user to run `dev-workflow repair` for managed-file drift.
@@ -23,11 +23,12 @@ Use `/dw-autopilot "wish"` as the gateway for most feature work. The granular co
23
23
  | `/dw-bugfix "description"` | A bug or error report. Surgical fix or PRD route. |
24
24
  | `/dw-help [keyword]` | This screen. Pass a keyword for shortcuts. `--advanced` reveals internal commands. |
25
25
 
26
- ## Tier 2 — Pipeline granular (9)
26
+ ## Tier 2 — Pipeline granular (10)
27
27
 
28
28
  | Command | What |
29
29
  |---------|------|
30
- | `/dw-brainstorm "idea"` | Refine an idea before PRD. Flags: `--onepager`, `--council`, `--research`, `--refactor`. |
30
+ | `/dw-opportunities [focus]` | Suggest project-specific product, UX, automation, refactor, and security opportunities before you have a concrete idea. Flag: `--research`. |
31
+ | `/dw-brainstorm "idea"` | Refine a concrete idea before PRD. Flags: `--onepager`, `--council`, `--research`. |
31
32
  | `/dw-plan "feature"` | PRD → TechSpec → Tasks sequentially with checkpoints. Stages: `prd`, `techspec`, `tasks`. |
32
33
  | `/dw-run [task-id]` | Execute all pending tasks or a single one. Flag `--resume`. |
33
34
  | `/dw-review` | Level 2 (PRD coverage) + Level 3 (code quality/security). Flags: `--coverage-only`, `--code-only`, `--bugfix <slug>`. |
@@ -37,12 +38,13 @@ Use `/dw-autopilot "wish"` as the gateway for most feature work. The granular co
37
38
  | `/dw-commit` | Atomic Conventional Commits for pending work. |
38
39
  | `/dw-generate-pr [target]` | Push branch, draft PR body, open browser. |
39
40
 
40
- ## Tier 3 — Specialty (10)
41
+ ## Tier 3 — Specialty (11)
41
42
 
42
43
  | Command | What |
43
44
  |---------|------|
44
45
  | `/dw-analyze-project` | Scan the repo, write `.dw/rules/`, offer `.dw/constitution.md`, generate `.dw/rules/concerns.md`, and synthesize frontend `DESIGN.md` when tokens exist. |
45
46
  | `/dw-redesign-ui "target"` | Audit, propose 2-3 design directions, ship. Enforces UI grounding + WCAG; can run the deterministic impeccable slop detector. |
47
+ | `/dw-refactor "target"` | Audit code-health and tech debt with Fowler smells, deep-modules analysis, and behavior-preserving test gates. |
46
48
  | `/dw-functional-doc` | Map screens + flows into a functional doc validated with Playwright; uses WSL-resilient browser resolution. |
47
49
  | `/dw-context-budget` | Audit context overhead from commands, skills, agents, instructions, and MCPs. |
48
50
  | `/dw-harness-audit` | Score dev-workflow install health: wrappers, agents, MCPs, gates. |
@@ -57,7 +59,7 @@ Use `/dw-autopilot "wish"` as the gateway for most feature work. The granular co
57
59
  `/dw-autopilot "wish"` runs planning first and stops. Reinvoke it to resume through `/dw-goal`, Security Gate, commit, and PR. Step-by-step:
58
60
 
59
61
  ```
60
- /dw-brainstorm → /dw-plan → /dw-goal → /dw-secure-audit → /dw-commit → /dw-generate-pr
62
+ /dw-opportunities → /dw-brainstorm → /dw-plan → /dw-goal → /dw-secure-audit → /dw-commit → /dw-generate-pr
61
63
  ```
62
64
 
63
65
  ## Advanced / internal commands
@@ -106,8 +108,9 @@ Match the keyword and suggest:
106
108
  | `commit`, `git` | `/dw-commit` |
107
109
  | `pr`, `pull request`, `merge` | `/dw-generate-pr` |
108
110
  | `idea`, `brainstorm`, `explore` | `/dw-brainstorm` |
111
+ | `opportunities`, `what next`, `roadmap`, `new ideas`, `features` | `/dw-opportunities` |
109
112
  | `research`, `compare`, `state of the art` | `/dw-brainstorm --research` |
110
- | `refactor`, `smell`, `code health` | `/dw-brainstorm --refactor` |
113
+ | `refactor`, `smell`, `code health`, `tech debt` | `/dw-refactor` |
111
114
  | `ui`, `design`, `redesign` | `/dw-redesign-ui` |
112
115
  | `intel`, `where is`, `what uses` | `/dw-intel` (or `--build` to (re)create the index) |
113
116
  | `context`, `tokens`, `slow agent` | `/dw-context-budget` |
@@ -118,13 +121,14 @@ Match the keyword and suggest:
118
121
  | `skills`, `skill health`, `bloat` | `/dw-skill-health` |
119
122
  | `analyze`, `rules`, `conventions` | `/dw-analyze-project` |
120
123
  | `constitution`, `principles` | `/dw-analyze-project` (Step 8 generates the constitution) |
124
+ | `security opportunities`, `hardening ideas`, `improve security` | `/dw-opportunities "security"` |
121
125
  | `security`, `vulnerabilities`, `cve`, `deps`, `audit deps` | `/dw-secure-audit` |
122
126
  | `secret`, `sast`, `semgrep`, `gitleaks`, `trivy` | `/dw-secure-audit` |
123
127
  | `adr`, `decision` | `/dw-adr` (also auto-invoked from `/dw-plan --council`) |
124
128
  | `docker`, `compose`, `container` | `/dw-dockerize` |
125
129
  | `new project`, `bootstrap`, `scaffold` | `/dw-new-project` |
126
130
  | `functional doc`, `screen map`, `e2e doc` | `/dw-functional-doc` |
127
- | `wsl`, `browser`, `playwright browser`, `cdp` | `npx @brunosps00/dev-workflow setup-wsl-browser` installs the prebuilt relay when WSL NAT must drive the real Windows browser |
131
+ | `wsl`, `browser`, `playwright browser`, `cdp` | `npx @brunosps00/dev-workflow setup-wsl-browser` installs the optional user-level reverse relay for CDP fallback on WSL NAT |
128
132
  | `azure`, `microsoft learn`, `azure skills` | `/dw-install-azure-skills` |
129
133
  | `aws`, `aws mcp`, `aws skills` | `/dw-install-aws-skills` |
130
134
  | `incident`, `outage`, `postmortem`, `sev-1`, `sev-2` | (Skill `dw-incident-response` auto-invoked from `/dw-bugfix` for prod-critical) |
@@ -150,6 +154,7 @@ If no keyword matches, show the default surface and a note: "Keyword `<word>` no
150
154
  - `/dw-review` auto-invokes `/dw-secure-audit` for supported stacks; `/dw-autopilot` treats it as the named gate before commit/PR; `/dw-generate-pr` enforces the latest approved summary.
151
155
 
152
156
  **Q: How do I get more flow recommendations during ideation?**
157
+ - `/dw-opportunities` scans the installed project and suggests product, UX, automation, refactor, and security opportunities.
153
158
  - `/dw-brainstorm "idea" --council` adds a multi-advisor stress-test debate.
154
159
  - `/dw-brainstorm "topic" --research` runs a deep multi-source citation pipeline.
155
160
 
@@ -157,6 +162,6 @@ If no keyword matches, show the default surface and a note: "Keyword `<word>` no
157
162
  - The `dw-llm-eval` skill is auto-invoked from `/dw-plan tasks` (eval-plan subtask), `/dw-review` (AI feature gate), and `/dw-qa --ai` (run reference dataset).
158
163
 
159
164
  **Q: What happened to all the other commands?**
160
- - v1.0.0 consolidated the old command surface. Mergers: create-prd/techspec/tasks → `/dw-plan`; run-task/run-plan → `/dw-run`; code-review/review-implementation → `/dw-review`; run-qa/fix-qa → `/dw-qa`; security-check/deps-audit → `/dw-secure-audit`; map-codebase → `/dw-intel --build`; deep-research and refactoring-analysis → `/dw-brainstorm --research/--refactor`. Removed: revert-task (use `git revert` directly).
165
+ - v1.0.0 consolidated the old command surface. Mergers: create-prd/techspec/tasks → `/dw-plan`; run-task/run-plan → `/dw-run`; code-review/review-implementation → `/dw-review`; run-qa/fix-qa → `/dw-qa`; security-check/deps-audit → `/dw-secure-audit`; map-codebase → `/dw-intel --build`; deep-research → `/dw-brainstorm --research`; refactoring-analysis now routes to `/dw-refactor`. Removed: revert-task (use `git revert` directly).
161
166
 
162
167
  </system_instructions>