@brunosps00/dev-workflow 1.4.0 → 1.5.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/plugin.json +1 -1
- package/README.md +5 -4
- package/lib/constants.js +2 -0
- package/lib/hooks.js +53 -11
- package/lib/init.js +49 -1
- package/package.json +1 -1
- package/scaffold/config/stack-mappings.json +40 -0
- package/scaffold/en/commands/dw-analyze-project.md +5 -1
- package/scaffold/en/commands/dw-context-budget.md +9 -0
- package/scaffold/en/commands/dw-harness-audit.md +3 -0
- package/scaffold/en/commands/dw-learn.md +41 -0
- package/scaffold/en/commands/dw-plan.md +2 -0
- package/scaffold/en/commands/dw-review.md +1 -0
- package/scaffold/en/commands/dw-run.md +1 -0
- package/scaffold/pt-br/commands/dw-analyze-project.md +5 -1
- package/scaffold/pt-br/commands/dw-context-budget.md +9 -0
- package/scaffold/pt-br/commands/dw-harness-audit.md +3 -0
- package/scaffold/pt-br/commands/dw-learn.md +41 -0
- package/scaffold/pt-br/commands/dw-plan.md +2 -0
- package/scaffold/pt-br/commands/dw-review.md +1 -0
- package/scaffold/pt-br/commands/dw-run.md +1 -0
- package/scaffold/rules/README.md +22 -0
- package/scaffold/rules/common.md +29 -0
- package/scaffold/rules/csharp.md +18 -0
- package/scaffold/rules/python.md +18 -0
- package/scaffold/rules/react.md +18 -0
- package/scaffold/rules/rust.md +18 -0
- package/scaffold/rules/typescript.md +23 -0
- package/scaffold/rules-readme.md +8 -0
- package/scaffold/scripts/hooks/session-cost.mjs +126 -0
- package/scaffold/scripts/hooks/statusline.mjs +31 -0
- package/scaffold/scripts/lib/model-prices.json +12 -0
- package/scaffold/skills/dw-cli-run/SKILL.md +3 -1
- package/scaffold/skills/dw-codebase-intel/SKILL.md +3 -1
- package/scaffold/skills/dw-debug-protocol/SKILL.md +4 -0
- package/scaffold/skills/dw-debug-protocol/references/agent-degradation.md +30 -0
- package/scaffold/skills/dw-execute-phase/SKILL.md +13 -0
- package/scaffold/skills/dw-git-discipline/SKILL.md +1 -0
- package/scaffold/skills/dw-llm-eval/SKILL.md +12 -0
- package/scaffold/skills/dw-memory/SKILL.md +12 -1
- package/scaffold/skills/dw-memory/references/instincts.md +45 -0
- package/scaffold/skills/dw-review-rigor/SKILL.md +12 -0
- package/scaffold/skills/dw-review-rigor/references/false-positives.md +21 -0
- package/scaffold/skills/dw-review-rigor/references/self-eval-rubric.md +38 -0
- package/scaffold/skills/dw-silent-failure/SKILL.md +4 -2
- package/scaffold/skills/dw-simplification/SKILL.md +13 -0
- package/scaffold/skills/dw-simplification/references/dead-code-tools.md +23 -0
- package/scaffold/skills/dw-testing-discipline/SKILL.md +17 -0
- package/scaffold/skills/dw-ui-discipline/SKILL.md +1 -1
- package/scaffold/skills/dw-verify/SKILL.md +1 -1
- package/scaffold/skills/dw-verify/references/pre-check-and-status.md +28 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Dead-code detection tools (find candidates; then apply Chesterton's Fence)
|
|
2
|
+
|
|
3
|
+
Detection tools surface **candidates** — they do not know about reflection, dynamic imports, framework
|
|
4
|
+
entry points, or external consumers of a public API. Every hit is a SAFE-tier candidate to verify, not an
|
|
5
|
+
automatic deletion. Run the gate (lint + tests + build) after each batch.
|
|
6
|
+
|
|
7
|
+
## JavaScript / TypeScript
|
|
8
|
+
- `npx knip` — unused files, exports, and dependencies in one pass (the broadest single tool).
|
|
9
|
+
- `npx depcheck` — unused and missing npm dependencies.
|
|
10
|
+
- `npx ts-prune` — unused TypeScript exports.
|
|
11
|
+
- `npx eslint . --report-unused-disable-directives` — stale `eslint-disable` comments.
|
|
12
|
+
|
|
13
|
+
## Other ecosystems
|
|
14
|
+
- **Python:** `vulture`, `ruff` (`F401` unused imports), `deptry` (unused dependencies).
|
|
15
|
+
- **Go:** `deadcode` (golang.org/x/tools/cmd/deadcode), `staticcheck` (`U1000`).
|
|
16
|
+
- **Rust:** `cargo +nightly udeps` (unused deps), the compiler's own `dead_code` warnings.
|
|
17
|
+
- **C# / .NET:** Roslyn analyzers (`IDE0051` unused private member, `IDE0059` unnecessary assignment).
|
|
18
|
+
|
|
19
|
+
## Discipline
|
|
20
|
+
1. Run the tool; treat every result as a **SAFE-tier candidate**, not a confirmed removal.
|
|
21
|
+
2. For each candidate, apply Chesterton's Fence (Rule 1) — dynamic/reflective/plugin use won't appear in static analysis.
|
|
22
|
+
3. Remove in batches by category (deps → exports → files); run the gate after each batch; commit per batch.
|
|
23
|
+
4. Anything the tool flags that turns out to be load-bearing → add a comment explaining why, so the next pass doesn't re-flag it.
|
|
@@ -38,6 +38,23 @@ Each rule has nuance read `references/core-rules.md` for the long version with e
|
|
|
38
38
|
- Verifying browser-side trust boundaries (auth, CSRF, headers) → `references/security-boundary.md`.
|
|
39
39
|
- Picking which test workflow applies (UI / network / perf) → `references/three-workflow-patterns.md`.
|
|
40
40
|
|
|
41
|
+
## Step 0 — detect the runner before writing any test
|
|
42
|
+
|
|
43
|
+
Do not assume `npm test`. The package manager and the test runner are different things — confirm both:
|
|
44
|
+
|
|
45
|
+
1. Read `package.json` `scripts.test` (plus `test:watch` / `test:coverage`), or the language equivalent (`pyproject.toml`/`tox.ini`, `Cargo.toml`, `*.csproj`, `go.mod`).
|
|
46
|
+
2. Identify the actual runner: jest / vitest / mocha / `node:test` / `bun:test` / pytest / `go test` / `cargo test` / `dotnet test`.
|
|
47
|
+
3. Invoke it through the project's package manager, not a hardcoded `npm`:
|
|
48
|
+
|
|
49
|
+
| Manager | test | watch | coverage |
|
|
50
|
+
|---|---|---|---|
|
|
51
|
+
| npm | `npm test` | `npm test -- --watch` | `npm run test:coverage` |
|
|
52
|
+
| pnpm | `pnpm test` | `pnpm test --watch` | `pnpm test:coverage` |
|
|
53
|
+
| yarn | `yarn test` | `yarn test --watch` | `yarn coverage` |
|
|
54
|
+
| bun (native) | `bun test` | `bun test --watch` | `bun test --coverage` |
|
|
55
|
+
|
|
56
|
+
**Bun gotcha:** `bun test` runs Bun's native runner (`bun:test`); `bun run test` runs whatever `scripts.test` is (often jest/vitest). They are not interchangeable — use the one the project actually configures. When unsure, confirm with `<runner> --help`.
|
|
57
|
+
|
|
41
58
|
## Reference router
|
|
42
59
|
|
|
43
60
|
| Doing what | Read |
|
|
@@ -34,7 +34,7 @@ Find the project's design source-of-truth in this order:
|
|
|
34
34
|
4. Component library config — `components.json` for shadcn, theme exports.
|
|
35
35
|
5. Storybook stories (implicit canonical components).
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
**Stop at the first match** in this list — that source is the authority; defer to it and do not override it with a lower rung or a training-data default. If a needed token is missing (e.g., a danger-secondary color), propose adding it to the authority FIRST, not inline.
|
|
38
38
|
|
|
39
39
|
If **none exists**: read `references/curated-defaults.md` and pick one of the 10 neutral palettes + one of the 10 font pairings shipped there. Mark the choice in the techspec/PR description: "Design source: no project authority found; using curated default `<name>`; recommend establishing `DESIGN.md`."
|
|
40
40
|
|
|
@@ -160,7 +160,7 @@ Verification failure is information, not a dead end. Protocol:
|
|
|
160
160
|
|
|
161
161
|
Discover the project gate before claiming success. Prefer documented gates in `.dw/rules/`, then package scripts such as `verify`, `check`, `ci`, or `test`, then Makefile/just/pyproject equivalents. If no verification command exists, state that explicitly in the Verification Report and avoid completion language.
|
|
162
162
|
|
|
163
|
-
Load `references/verification-discovery-and-attribution.md`
|
|
163
|
+
Load `references/verification-discovery-and-attribution.md` for the discovery checklist and attribution notes, or `references/pre-check-and-status.md` for the cheap diff-hygiene grep and the compact polling status line.
|
|
164
164
|
|
|
165
165
|
## Structured Return
|
|
166
166
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Cheap pre-check + compact status
|
|
2
|
+
|
|
3
|
+
Two lightweight companions to the full verification gate. Neither replaces the Verification Report — they
|
|
4
|
+
run *around* it.
|
|
5
|
+
|
|
6
|
+
## Diff hygiene (cheap pre-commit grep)
|
|
7
|
+
|
|
8
|
+
Before running the full pipeline, one fast grep over the staged diff catches the most common "left it in"
|
|
9
|
+
mistakes:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
git diff --cached | grep -nE 'console\.(log|debug)|debugger|TODO: *remove|sk-[A-Za-z0-9]|api[_-]?key|password *='
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Hits are a smell to clear, not a gate by themselves. This is **not** the security gate — `/dw-secure-audit`
|
|
16
|
+
(gitleaks + Trivy + Semgrep) remains the authoritative secret/vuln check before commit/PR. Use this grep as a
|
|
17
|
+
2-second sanity pass, then run the real pipeline.
|
|
18
|
+
|
|
19
|
+
## Compact status (for real-time polling)
|
|
20
|
+
|
|
21
|
+
When a runner (e.g. `dw-cli-run`) polls progress *between* full reports, a one-line form is enough:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Build: PASS | Lint: PASS | Tests: 42/42 | Verdict: READY
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The compact line never replaces the full report — the final completion claim still requires the Verification
|
|
28
|
+
Report Template with cited command output. Use the compact line for progress, the full template for the claim.
|