@brunosps00/dev-workflow 2.0.0 → 2.1.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.
- package/.claude-plugin/marketplace.json +1 -0
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +104 -0
- package/README.md +6 -4
- package/lib/build-plugin.js +4 -1
- package/lib/constants.js +4 -2
- package/lib/validate.js +21 -0
- package/package.json +1 -1
- package/scaffold/en/commands/dw-brainstorm.md +12 -8
- package/scaffold/en/commands/dw-bugfix.md +4 -2
- package/scaffold/en/commands/dw-plan.md +2 -2
- package/scaffold/en/commands/dw-refactor.md +1 -0
- package/scaffold/en/commands/dw-review.md +33 -2
- package/scaffold/en/commands/dw-run.md +1 -0
- package/scaffold/en/commands/dw-triage.md +220 -0
- package/scaffold/en/templates/idea-onepager.md +28 -0
- package/scaffold/en/templates/task-template.md +1 -0
- package/scaffold/en/templates/tasks-template.md +9 -8
- package/scaffold/en/templates/triage-needs-info-template.md +23 -0
- package/scaffold/en/templates/triage-out-of-scope-template.md +36 -0
- package/scaffold/en/templates/triage-record-template.md +88 -0
- package/scaffold/pt-br/commands/dw-autopilot.md +81 -81
- package/scaffold/pt-br/commands/dw-brainstorm.md +12 -9
- package/scaffold/pt-br/commands/dw-bugfix.md +4 -2
- package/scaffold/pt-br/commands/dw-claude-run.md +19 -19
- package/scaffold/pt-br/commands/dw-codex-run.md +19 -19
- package/scaffold/pt-br/commands/dw-context-budget.md +10 -10
- package/scaffold/pt-br/commands/dw-copilot-run.md +20 -20
- package/scaffold/pt-br/commands/dw-dockerize.md +102 -102
- package/scaffold/pt-br/commands/dw-find-skills.md +52 -52
- package/scaffold/pt-br/commands/dw-goal.md +41 -41
- package/scaffold/pt-br/commands/dw-harness-audit.md +11 -11
- package/scaffold/pt-br/commands/dw-intel.md +70 -70
- package/scaffold/pt-br/commands/dw-learn.md +24 -24
- package/scaffold/pt-br/commands/dw-new-project.md +88 -88
- package/scaffold/pt-br/commands/dw-open-design.md +53 -53
- package/scaffold/pt-br/commands/dw-opportunities.md +45 -45
- package/scaffold/pt-br/commands/dw-pause.md +39 -39
- package/scaffold/pt-br/commands/dw-plan.md +2 -2
- package/scaffold/pt-br/commands/dw-refactor.md +31 -30
- package/scaffold/pt-br/commands/dw-resume.md +22 -22
- package/scaffold/pt-br/commands/dw-review.md +33 -2
- package/scaffold/pt-br/commands/dw-run.md +1 -0
- package/scaffold/pt-br/commands/dw-skill-health.md +10 -10
- package/scaffold/pt-br/commands/dw-subtask-complete.md +4 -4
- package/scaffold/pt-br/commands/dw-subtask-start.md +4 -4
- package/scaffold/pt-br/commands/dw-triage.md +220 -0
- package/scaffold/pt-br/templates/bugfix-summary-template.md +20 -20
- package/scaffold/pt-br/templates/concerns-template.md +20 -20
- package/scaffold/pt-br/templates/idea-onepager.md +28 -0
- package/scaffold/pt-br/templates/project-onepager.md +32 -32
- package/scaffold/pt-br/templates/state-template.md +13 -13
- package/scaffold/pt-br/templates/task-template.md +1 -0
- package/scaffold/pt-br/templates/tasks-template.md +9 -8
- package/scaffold/pt-br/templates/triage-needs-info-template.md +23 -0
- package/scaffold/pt-br/templates/triage-out-of-scope-template.md +36 -0
- package/scaffold/pt-br/templates/triage-record-template.md +88 -0
- package/scaffold/scripts/hooks/git-guardrails.mjs +41 -24
- package/scaffold/skills/dw-debug-protocol/SKILL.md +2 -0
- package/scaffold/skills/dw-debug-protocol/references/six-step-triage.md +60 -1
- package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +14 -14
- package/scaffold/skills/dw-grilling/SKILL.md +17 -7
- package/scaffold/skills/dw-grilling/references/decision-tree.md +30 -7
- package/scaffold/skills/dw-simplification/references/deep-modules.md +50 -0
- package/scaffold/skills/dw-testing-discipline/SKILL.md +3 -1
- package/scaffold/skills/dw-testing-discipline/references/tdd-loop.md +83 -0
|
@@ -91,6 +91,56 @@ The combined verdict:
|
|
|
91
91
|
|
|
92
92
|
A flat "this is too long, extract method" recommendation is shallow analysis. Combining Fowler + deep-modules surfaces when the smell is actually a feature.
|
|
93
93
|
|
|
94
|
+
## Dependency categories decide seam tests
|
|
95
|
+
|
|
96
|
+
When a finding is about a seam, classify the dependency that seam isolates before choosing the test strategy. The category drives the test plan; do not reflexively mock everything or run every dependency for every test.
|
|
97
|
+
|
|
98
|
+
This follows `dw-testing-discipline`: tests should sit at the lowest layer that can expose the defect, mocks isolate boundaries, and real systems validate before merge. If this section appears to conflict with `dw-testing-discipline`, prefer `dw-testing-discipline`.
|
|
99
|
+
|
|
100
|
+
| Category | What it means | Test strategy |
|
|
101
|
+
|----------|---------------|---------------|
|
|
102
|
+
| **In-process** | Same process and memory space: pure functions, formatters, policy objects, parser modules, local caches. | Prefer unit or characterization tests with real collaborators. Mocking here usually tests the mock or hides a shallow interface. |
|
|
103
|
+
| **Local-substitutable** | Real dependency can run locally with equivalent behavior: database, queue, object store emulator, search index, containerized service. | Use integration tests against the real local substitute for the merge gate. Unit tests may fake it for branch coverage, but at least one path must prove the real wiring. |
|
|
104
|
+
| **Remote owned** | A service the team/company owns across the network. | Use adapter unit tests for failure mapping, consumer/producer contract tests for the API shape, and staging/sandbox smoke checks for real network behavior before merge. |
|
|
105
|
+
| **True external** | Third-party service the team does not control: payments, email, identity provider, vendor API. | Keep a narrow adapter seam. Unit-test mapping and error policy with fixtures/fakes; validate contracts against provider sandbox or recorded contract fixtures where available. Do not make routine CI depend on a third-party public site being reachable. |
|
|
106
|
+
|
|
107
|
+
The output for a seam-related finding adds:
|
|
108
|
+
|
|
109
|
+
```markdown
|
|
110
|
+
**Dependency category:** <in-process | local-substitutable | remote owned | true external>
|
|
111
|
+
**Seam test strategy:** <lowest layer that catches the defect + real-system gate, if applicable>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Design It Twice for interface findings
|
|
115
|
+
|
|
116
|
+
When the surviving finding is **shallow interface**, **interface leak**, or **seam in the wrong place**, do not accept the first interface that works. Generate at least three radically different public-interface proposals for the same module before recommending one.
|
|
117
|
+
|
|
118
|
+
Each proposal must have a distinct constraint, for example:
|
|
119
|
+
|
|
120
|
+
- **Caller-minimal:** expose the fewest concepts to the caller, even if implementation grows.
|
|
121
|
+
- **Domain-language-first:** public methods use product/domain vocabulary and hide vendor or storage terms.
|
|
122
|
+
- **Test-boundary-first:** interface places the seam at the dependency category boundary and makes the real-system gate practical.
|
|
123
|
+
- **Migration-first:** supports incremental caller migration without a broad flag day.
|
|
124
|
+
|
|
125
|
+
Compare each proposal on:
|
|
126
|
+
|
|
127
|
+
- **Depth:** how much implementation complexity it hides per public concept exposed.
|
|
128
|
+
- **Locality:** whether inputs and outputs are explicit, with no hidden globals or ambient state.
|
|
129
|
+
- **Seam placement:** whether the boundary lands at the dependency category boundary, not halfway through a workflow.
|
|
130
|
+
- **Test cost:** which tests prove behavior without relying on mocks that can drift.
|
|
131
|
+
|
|
132
|
+
Use a local loop inside this analysis, not `dw-council`, by default. `dw-council` is for high-stakes product or architecture trade-offs with multiple stakeholder priorities; an interface-depth comparison is usually a scoped refactor design exercise. Escalate to `dw-council` only when the interface choice also changes product behavior, ownership boundaries, security posture, or a hard-to-reverse architecture decision.
|
|
133
|
+
|
|
134
|
+
The output for an interface finding adds:
|
|
135
|
+
|
|
136
|
+
```markdown
|
|
137
|
+
**Interface alternatives considered:**
|
|
138
|
+
1. <proposal + constraint + depth/locality/seam/test notes>
|
|
139
|
+
2. <proposal + constraint + depth/locality/seam/test notes>
|
|
140
|
+
3. <proposal + constraint + depth/locality/seam/test notes>
|
|
141
|
+
**Recommended interface:** <choice and why>
|
|
142
|
+
```
|
|
143
|
+
|
|
94
144
|
## Output for refactor-audit findings
|
|
95
145
|
|
|
96
146
|
When the audit flags a module as a shallow-wrapper or god-module candidate, the finding entry adds a `Deep-modules: <verdict>` line:
|
|
@@ -34,6 +34,7 @@ Each rule has nuance read `references/core-rules.md` for the long version with e
|
|
|
34
34
|
- Reviewing a PR diff under test paths.
|
|
35
35
|
- Debugging a flaky test (or considering retry-as-fix — read `references/flaky-discipline.md` first).
|
|
36
36
|
- Generating tests via an AI agent → invokes `references/agent-guardrails.md` automatically.
|
|
37
|
+
- Explicit test-first requests ("TDD", "test first", "red-green-refactor") → use `references/tdd-loop.md` as an on-demand operating mode, not the default workflow.
|
|
37
38
|
- Browser-based E2E with Playwright → recipes in `references/playwright-recipes.md`.
|
|
38
39
|
- Verifying browser-side trust boundaries (auth, CSRF, headers) → `references/security-boundary.md`.
|
|
39
40
|
- Picking which test workflow applies (UI / network / perf) → `references/three-workflow-patterns.md`.
|
|
@@ -61,6 +62,7 @@ Do not assume `npm test`. The package manager and the test runner are different
|
|
|
61
62
|
|------------|------|
|
|
62
63
|
| Placing a new test (which layer?) | `references/core-rules.md` (Rule 2 deep-dive) |
|
|
63
64
|
| Writing new tests | `references/patterns.md` |
|
|
65
|
+
| Explicit test-first / TDD loop | `references/tdd-loop.md` |
|
|
64
66
|
| Reviewing tests / spotting smells | `references/anti-patterns.md` |
|
|
65
67
|
| Agent-generated tests | `references/agent-guardrails.md` + `references/anti-patterns.md` |
|
|
66
68
|
| Flaky tests | `references/flaky-discipline.md` |
|
|
@@ -180,7 +182,7 @@ Any of these in a PR is enough to REJECT a verdict:
|
|
|
180
182
|
## Integration with dev-workflow commands
|
|
181
183
|
|
|
182
184
|
- `/dw-plan tasks` applies the placement doctrine — each test-adding task names the invariant.
|
|
183
|
-
- `/dw-run` runs the 6 agent guardrails when generating tests during implementation.
|
|
185
|
+
- `/dw-run` runs the 6 agent guardrails when generating tests during implementation. When the task or user explicitly requests test-first work, `/dw-run` switches to `references/tdd-loop.md` for that task only.
|
|
184
186
|
- `/dw-review --code-only` runs the anti-pattern checks on diff hunks under test paths.
|
|
185
187
|
- `/dw-qa --fix` applies the flaky-discipline taxonomy in retest cycles.
|
|
186
188
|
- `/dw-qa` (UI mode) references `playwright-recipes.md` for concrete recipes.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Test-first red-green loop
|
|
2
|
+
|
|
3
|
+
Use this procedure only when the user or task explicitly asks for test-first work: "TDD", "test first", "red-green-refactor", or equivalent wording. It operates inside the six core rules from `dw-testing-discipline`; it does not replace or weaken them.
|
|
4
|
+
|
|
5
|
+
## 0. Confirm the public seam
|
|
6
|
+
|
|
7
|
+
Before writing the first test, identify the public boundary that should own the behavior:
|
|
8
|
+
|
|
9
|
+
- API route, CLI command, exported function, component behavior, contract test, browser flow, or other public seam.
|
|
10
|
+
- The invariant the user cares about, in one sentence.
|
|
11
|
+
- The lowest layer that can detect the defect or missing behavior.
|
|
12
|
+
|
|
13
|
+
Ask the user to confirm the seam before writing any code:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
I plan to test this at `<public seam>` because it is the lowest public boundary that proves `<invariant>`.
|
|
17
|
+
Confirm this seam, or point me at the boundary you want covered.
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
If the user rejects the seam, revise it and ask again. Do not test private helpers or internals just to make the first test easier.
|
|
21
|
+
|
|
22
|
+
## 1. Write one red test
|
|
23
|
+
|
|
24
|
+
Write exactly one test for the next vertical slice of behavior.
|
|
25
|
+
|
|
26
|
+
- The test must assert observable behavior through the confirmed public seam.
|
|
27
|
+
- The test must not be tautological: removing or breaking the production behavior should make it fail.
|
|
28
|
+
- The test must not couple to implementation details, private methods, internal call order, or mock shape.
|
|
29
|
+
- Mocks are allowed only at system boundaries you do not control.
|
|
30
|
+
|
|
31
|
+
Do not write a batch of future tests before the first implementation. A vertical slice is one failing test, one minimal implementation, one green run.
|
|
32
|
+
|
|
33
|
+
## 2. Run and observe red
|
|
34
|
+
|
|
35
|
+
Run the narrowest test command that exercises the new test and capture the actual failure.
|
|
36
|
+
|
|
37
|
+
The red state is valid only when the observed failure is the expected failure:
|
|
38
|
+
|
|
39
|
+
- The test fails because the behavior is missing or wrong.
|
|
40
|
+
- The test does not fail because of syntax, import, fixture, selector, clock, network, or mock setup problems.
|
|
41
|
+
- The failure message points at the invariant under test.
|
|
42
|
+
|
|
43
|
+
If the failure is not the expected red, fix the test setup or seam choice before touching production code.
|
|
44
|
+
|
|
45
|
+
## 3. Implement the minimum green
|
|
46
|
+
|
|
47
|
+
Change production code only as much as needed to satisfy the one failing test while preserving existing behavior.
|
|
48
|
+
|
|
49
|
+
- Prefer the existing codebase patterns.
|
|
50
|
+
- Do not add test-only branches, flags, exports, or helper methods to production.
|
|
51
|
+
- Do not broaden the solution for future slices that do not yet have a red test.
|
|
52
|
+
|
|
53
|
+
## 4. Run and observe green
|
|
54
|
+
|
|
55
|
+
Run the same narrow command first. If it passes, run the relevant broader project test command before moving to the next slice.
|
|
56
|
+
|
|
57
|
+
Record the command and outcome. A presumed green is not enough.
|
|
58
|
+
|
|
59
|
+
## 5. Continue vertically
|
|
60
|
+
|
|
61
|
+
Only after the current slice is green:
|
|
62
|
+
|
|
63
|
+
1. Choose the next behavior slice.
|
|
64
|
+
2. Write one new red test.
|
|
65
|
+
3. Run and observe red.
|
|
66
|
+
4. Implement the minimum green.
|
|
67
|
+
5. Run and observe green.
|
|
68
|
+
|
|
69
|
+
Stop when the requested behavior is covered at the public seam and the relevant project gate is green.
|
|
70
|
+
|
|
71
|
+
## Refactor happens after the loop
|
|
72
|
+
|
|
73
|
+
Refactoring is not part of the red-green cycle. After the behavior slices are green, run a separate review pass. If simplification is warranted, delegate that pass to `dw-simplification` and keep the tests green throughout.
|
|
74
|
+
|
|
75
|
+
## Hard stops
|
|
76
|
+
|
|
77
|
+
Stop and ask for clarification when:
|
|
78
|
+
|
|
79
|
+
- No public seam is identifiable.
|
|
80
|
+
- The user will not confirm the seam.
|
|
81
|
+
- The only test you can write is tautological or coupled to internals.
|
|
82
|
+
- The required mock would replace behavior owned by this codebase.
|
|
83
|
+
- The next slice is unclear enough that the invariant cannot be stated in one sentence.
|