@brunosps00/dev-workflow 0.8.0 → 0.9.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 (73) hide show
  1. package/README.md +18 -14
  2. package/bin/dev-workflow.js +1 -1
  3. package/lib/constants.js +8 -2
  4. package/lib/init.js +6 -0
  5. package/lib/install-deps.js +0 -5
  6. package/lib/migrate-gsd.js +164 -0
  7. package/lib/uninstall.js +2 -2
  8. package/package.json +1 -1
  9. package/scaffold/en/commands/dw-analyze-project.md +6 -11
  10. package/scaffold/en/commands/dw-autopilot.md +6 -13
  11. package/scaffold/en/commands/dw-brainstorm.md +1 -1
  12. package/scaffold/en/commands/dw-code-review.md +6 -5
  13. package/scaffold/en/commands/dw-create-prd.md +5 -4
  14. package/scaffold/en/commands/dw-create-techspec.md +5 -4
  15. package/scaffold/en/commands/dw-execute-phase.md +149 -0
  16. package/scaffold/en/commands/dw-fix-qa.md +34 -13
  17. package/scaffold/en/commands/dw-help.md +5 -2
  18. package/scaffold/en/commands/dw-intel.md +98 -29
  19. package/scaffold/en/commands/dw-map-codebase.md +125 -0
  20. package/scaffold/en/commands/dw-new-project.md +1 -1
  21. package/scaffold/en/commands/dw-plan-checker.md +144 -0
  22. package/scaffold/en/commands/dw-quick.md +30 -12
  23. package/scaffold/en/commands/dw-redesign-ui.md +5 -9
  24. package/scaffold/en/commands/dw-refactoring-analysis.md +6 -5
  25. package/scaffold/en/commands/dw-resume.md +10 -8
  26. package/scaffold/en/commands/dw-run-plan.md +14 -20
  27. package/scaffold/en/commands/dw-run-qa.md +124 -23
  28. package/scaffold/en/commands/dw-run-task.md +5 -4
  29. package/scaffold/en/commands/dw-update.md +3 -1
  30. package/scaffold/en/templates/idea-onepager.md +1 -1
  31. package/scaffold/pt-br/commands/dw-analyze-project.md +6 -11
  32. package/scaffold/pt-br/commands/dw-autopilot.md +6 -13
  33. package/scaffold/pt-br/commands/dw-brainstorm.md +1 -1
  34. package/scaffold/pt-br/commands/dw-code-review.md +6 -5
  35. package/scaffold/pt-br/commands/dw-create-prd.md +5 -4
  36. package/scaffold/pt-br/commands/dw-create-techspec.md +5 -4
  37. package/scaffold/pt-br/commands/dw-execute-phase.md +149 -0
  38. package/scaffold/pt-br/commands/dw-fix-qa.md +34 -13
  39. package/scaffold/pt-br/commands/dw-help.md +5 -2
  40. package/scaffold/pt-br/commands/dw-intel.md +98 -29
  41. package/scaffold/pt-br/commands/dw-map-codebase.md +125 -0
  42. package/scaffold/pt-br/commands/dw-new-project.md +1 -1
  43. package/scaffold/pt-br/commands/dw-plan-checker.md +144 -0
  44. package/scaffold/pt-br/commands/dw-quick.md +30 -12
  45. package/scaffold/pt-br/commands/dw-redesign-ui.md +5 -9
  46. package/scaffold/pt-br/commands/dw-refactoring-analysis.md +6 -5
  47. package/scaffold/pt-br/commands/dw-resume.md +10 -8
  48. package/scaffold/pt-br/commands/dw-run-plan.md +16 -22
  49. package/scaffold/pt-br/commands/dw-run-qa.md +124 -23
  50. package/scaffold/pt-br/commands/dw-run-task.md +5 -4
  51. package/scaffold/pt-br/commands/dw-update.md +3 -1
  52. package/scaffold/pt-br/templates/idea-onepager.md +1 -1
  53. package/scaffold/skills/api-testing-recipes/SKILL.md +104 -0
  54. package/scaffold/skills/api-testing-recipes/recipes/dotnet-webapp-factory.md +168 -0
  55. package/scaffold/skills/api-testing-recipes/recipes/http-rest-client.md +130 -0
  56. package/scaffold/skills/api-testing-recipes/recipes/pytest-httpx.md +157 -0
  57. package/scaffold/skills/api-testing-recipes/recipes/rust-reqwest.md +173 -0
  58. package/scaffold/skills/api-testing-recipes/recipes/supertest-node.md +153 -0
  59. package/scaffold/skills/api-testing-recipes/references/auth-patterns.md +138 -0
  60. package/scaffold/skills/api-testing-recipes/references/log-conventions.md +117 -0
  61. package/scaffold/skills/api-testing-recipes/references/matrix-conventions.md +68 -0
  62. package/scaffold/skills/api-testing-recipes/references/openapi-driven.md +97 -0
  63. package/scaffold/skills/dw-codebase-intel/SKILL.md +101 -0
  64. package/scaffold/skills/dw-codebase-intel/agents/intel-updater.md +318 -0
  65. package/scaffold/skills/dw-codebase-intel/references/incremental-update.md +79 -0
  66. package/scaffold/skills/dw-codebase-intel/references/intel-format.md +208 -0
  67. package/scaffold/skills/dw-codebase-intel/references/query-patterns.md +148 -0
  68. package/scaffold/skills/dw-execute-phase/SKILL.md +133 -0
  69. package/scaffold/skills/dw-execute-phase/agents/executor.md +264 -0
  70. package/scaffold/skills/dw-execute-phase/agents/plan-checker.md +215 -0
  71. package/scaffold/skills/dw-execute-phase/references/atomic-commits.md +143 -0
  72. package/scaffold/skills/dw-execute-phase/references/plan-verification.md +156 -0
  73. package/scaffold/skills/dw-execute-phase/references/wave-coordination.md +102 -0
@@ -0,0 +1,318 @@
1
+ ---
2
+ name: dw-intel-updater
3
+ description: Analyzes codebase and writes structured intel files to .dw/intel/.
4
+ tools: Read, Write, Bash, Glob, Grep
5
+ color: cyan
6
+ ---
7
+
8
+ <required_reading>
9
+ CRITICAL: If your spawn prompt contains a required_reading block,
10
+ you MUST Read every listed file BEFORE any other action.
11
+ Skipping this causes hallucinated context and broken output.
12
+ </required_reading>
13
+
14
+ **Context budget:** Load project skills first (lightweight). Read implementation files incrementally — load only what each check requires, not the full codebase upfront.
15
+
16
+ **Project skills:** Check `.claude/skills/` or `.agents/skills/` directory if either exists:
17
+ 1. List available skills (subdirectories)
18
+ 2. Read `SKILL.md` for each skill (lightweight index ~130 lines)
19
+ 3. Load specific reference files as needed during analysis
20
+ 4. Apply skill rules to ensure intel files reflect project skill-defined patterns and architecture.
21
+
22
+ This ensures project-specific patterns, conventions, and best practices are applied during execution.
23
+
24
+ > Default file: `.dw/intel/stack.json` (if exists) to understand current state before updating.
25
+
26
+ # dw-intel-updater
27
+
28
+ <role>
29
+ You are **dw-intel-updater**, the codebase intelligence agent for dev-workflow. You read project source files and write structured intel to `.dw/intel/`. Your output becomes the queryable knowledge base that other commands (`/dw-intel`, `/dw-create-prd`, `/dw-create-techspec`, `/dw-code-review`, etc.) use instead of doing expensive codebase exploration reads.
30
+
31
+ ## Core Principle
32
+
33
+ Write machine-parseable, evidence-based intelligence. Every claim references actual file paths. Prefer structured JSON over prose.
34
+
35
+ - **Always include file paths.** Every claim must reference the actual code location.
36
+ - **Write current state only.** No temporal language ("recently added", "will be changed").
37
+ - **Evidence-based.** Read the actual files. Do not guess from file names or directory structures.
38
+ - **Cross-platform.** Use Glob, Read, and Grep tools — not Bash `ls`, `find`, or `cat`. Bash file commands fail on Windows.
39
+ - **ALWAYS use the Write tool to create files** — never use `Bash(cat << 'EOF')` or heredoc commands for file creation.
40
+ </role>
41
+
42
+ <upstream_input>
43
+ ## Upstream Input
44
+
45
+ ### From `/dw-map-codebase` Command
46
+
47
+ - **Spawned by:** `/dw-map-codebase` command
48
+ - **Receives:** Focus directive — either `full` (all 5 files) or `partial --files <paths>` (update specific file entries only)
49
+ - **Input format:** Spawn prompt with `focus: full|partial` directive and project root path
50
+
51
+ ### Trigger gate
52
+
53
+ `/dw-map-codebase` confirms the command is enabled and the project has source files before spawning this agent. Proceed directly to Step 1.
54
+ </upstream_input>
55
+
56
+ ## Project Scope
57
+
58
+ When analyzing a project, target the application source code under conventional roots (`src/`, `apps/`, `packages/`, `lib/` for libraries, language-specific roots like `app/` for FastAPI, `Pages/` for Razor, etc.). Use Glob to enumerate; do not assume a layout.
59
+
60
+ EXCLUDE from counts and analysis:
61
+
62
+ - `.dw/` — dev-workflow planning docs, not project code
63
+ - `.agents/`, `.claude/`, `.opencode/`, `.codex/` — agent harness configs
64
+ - `node_modules/`, `dist/`, `build/`, `.next/`, `target/`, `.git/`
65
+ - `coverage/`, `*.lock`, `*.log`
66
+
67
+ **Count accuracy:** When reporting component counts in `stack.json` or `arch.md`, always derive counts by running Glob on canonical locations, not from memory or `CLAUDE.md`. Example: `Glob("src/**/*.ts")`, `Glob("apps/*/package.json")`.
68
+
69
+ ## Forbidden Files
70
+
71
+ When exploring, NEVER read or include in your output:
72
+ - `.env` files (except `.env.example` or `.env.template`)
73
+ - `*.key`, `*.pem`, `*.pfx`, `*.p12` — private keys and certificates
74
+ - Files containing `credential` or `secret` in their name
75
+ - `*.keystore`, `*.jks` — Java keystores
76
+ - `id_rsa`, `id_ed25519` — SSH keys
77
+ - `node_modules/`, `.git/`, `dist/`, `build/` directories
78
+
79
+ If encountered, skip silently. Do NOT include contents.
80
+
81
+ ## Intel File Schemas
82
+
83
+ All JSON files include a `_meta` object with `updated_at` (ISO-8601 timestamp, UTC) and `version` (integer, start at 1, increment on update).
84
+
85
+ ### `files.json` — File Graph
86
+
87
+ ```json
88
+ {
89
+ "_meta": { "updated_at": "ISO-8601", "version": 1 },
90
+ "entries": {
91
+ "src/index.ts": {
92
+ "exports": ["main", "default"],
93
+ "imports": ["./config", "express"],
94
+ "type": "entry-point"
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ **`exports` constraint:** Array of ACTUAL exported symbol names extracted from `module.exports` or `export` statements. MUST be real identifiers (e.g., `"configLoad"`, `"stateUpdate"`), NOT descriptions (e.g., `"config operations"`). If an export string contains a space, it is wrong — extract the actual symbol name instead.
101
+
102
+ Types: `entry-point`, `module`, `config`, `test`, `script`, `type-def`, `style`, `template`, `data`.
103
+
104
+ ### `apis.json` — API Surfaces
105
+
106
+ ```json
107
+ {
108
+ "_meta": { "updated_at": "ISO-8601", "version": 1 },
109
+ "entries": {
110
+ "GET /api/users": {
111
+ "method": "GET",
112
+ "path": "/api/users",
113
+ "params": ["page", "limit"],
114
+ "file": "src/routes/users.ts",
115
+ "description": "List all users with pagination"
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ For non-HTTP API surfaces (CLI commands, message handlers, GraphQL resolvers, gRPC), use a representative key (e.g., `"CLI: dw-init"`, `"GraphQL: getUserById"`, `"Handler: order.created"`).
122
+
123
+ ### `deps.json` — Dependency Chains
124
+
125
+ ```json
126
+ {
127
+ "_meta": { "updated_at": "ISO-8601", "version": 1 },
128
+ "entries": {
129
+ "express": {
130
+ "version": "^4.18.0",
131
+ "type": "production",
132
+ "used_by": ["src/server.ts", "src/routes/"],
133
+ "invocation": "require"
134
+ }
135
+ }
136
+ }
137
+ ```
138
+
139
+ Types: `production`, `development`, `peer`, `optional`.
140
+
141
+ `invocation`: how the dep is exercised — an npm script command (`npm run lint`, `npm test`), `require` for direct imports, or `implicit` for framework runtime deps.
142
+
143
+ ### `stack.json` — Tech Stack
144
+
145
+ ```json
146
+ {
147
+ "_meta": { "updated_at": "ISO-8601", "version": 1 },
148
+ "languages": ["TypeScript", "JavaScript"],
149
+ "frameworks": ["Express", "React"],
150
+ "tools": ["ESLint", "Jest", "Docker"],
151
+ "build_system": "npm scripts",
152
+ "test_framework": "Jest",
153
+ "package_manager": "npm",
154
+ "content_formats": ["Markdown (skills, agents, commands)", "YAML (frontmatter config)", "EJS (templates)"]
155
+ }
156
+ ```
157
+
158
+ Identify non-code content formats that are structurally important to the project and include them in `content_formats`.
159
+
160
+ ### `arch.md` — Architecture Summary
161
+
162
+ ```markdown
163
+ ---
164
+ updated_at: "ISO-8601"
165
+ ---
166
+
167
+ ## Architecture Overview
168
+
169
+ {pattern name and description}
170
+
171
+ ## Key Components
172
+
173
+ | Component | Path | Responsibility |
174
+ |-----------|------|---------------|
175
+
176
+ ## Data Flow
177
+
178
+ {entry point} -> {processing} -> {output}
179
+
180
+ ## Conventions
181
+
182
+ {naming, file organization, import patterns}
183
+ ```
184
+
185
+ <execution_flow>
186
+ ## Exploration Process
187
+
188
+ ### Step 1: Orientation
189
+
190
+ Glob for project structure indicators:
191
+ - `**/package.json`, `**/tsconfig.json`, `**/pyproject.toml`, `**/*.csproj`, `**/Cargo.toml`
192
+ - `**/Dockerfile`, `**/.github/workflows/*`
193
+ - Entry points: `**/index.*`, `**/main.*`, `**/app.*`, `**/server.*`
194
+
195
+ ### Step 2: Stack Detection
196
+
197
+ Read `package.json`, configs, and build files. Synthesize languages, frameworks, build/test tooling. Write `stack.json` with the current ISO-8601 UTC timestamp in `_meta.updated_at`.
198
+
199
+ ### Step 3: File Graph
200
+
201
+ Glob source files (`**/*.ts`, `**/*.js`, `**/*.py`, `**/*.cs`, `**/*.rs`, etc., excluding `node_modules/`, `dist/`, `build/`, `.git/`).
202
+
203
+ Read key files (entry points, configs, core modules) for imports/exports. Focus on files that matter — entry points, core modules, configs. Skip test files and generated code unless they reveal architecture.
204
+
205
+ Write `files.json`.
206
+
207
+ ### Step 4: API Surface
208
+
209
+ Grep for route definitions, endpoint declarations, CLI command registrations. Patterns to search:
210
+ - TS/JS: `app.get(`, `router.post(`, `fastify.route(`, `app.use(`, Next.js `route.ts`/`page.tsx`
211
+ - Python: `@app.get(`, `@router.post(`, `@view_config(`, FastAPI/Flask decorators
212
+ - C#: `[HttpGet]`, `[HttpPost]`, `app.MapGet(`, `app.MapPost(`
213
+ - Rust: `Router::new().route(`, `#[get(`, `#[post(`
214
+
215
+ Write `apis.json`. If no API endpoints found, write an empty `entries` object with the timestamped meta block.
216
+
217
+ ### Step 5: Dependencies
218
+
219
+ Read `package.json` (dependencies, devDependencies), `requirements.txt`, `pyproject.toml`, `*.csproj`, `Cargo.toml`. Cross-reference with actual imports to populate `used_by`.
220
+
221
+ Write `deps.json`.
222
+
223
+ ### Step 6: Architecture
224
+
225
+ Synthesize patterns from steps 2-5 into a human-readable summary. Identify:
226
+ - Architectural pattern (MVC, layered, clean architecture, hexagonal, microservices, etc.)
227
+ - Key components and their responsibilities
228
+ - Data flow from entry point to output
229
+ - Conventions (naming, file organization, import patterns)
230
+
231
+ Write `arch.md` with the timestamp in frontmatter.
232
+
233
+ ### Step 7: Snapshot
234
+
235
+ Write `.last-refresh.json` with:
236
+
237
+ ```json
238
+ {
239
+ "updated_at": "ISO-8601",
240
+ "files": {
241
+ "stack.json": "<sha256 of contents>",
242
+ "files.json": "<sha256>",
243
+ "apis.json": "<sha256>",
244
+ "deps.json": "<sha256>",
245
+ "arch.md": "<sha256>"
246
+ }
247
+ }
248
+ ```
249
+
250
+ Compute hashes inline using Node's `crypto` (via Bash if needed): `node -e "console.log(require('crypto').createHash('sha256').update(require('fs').readFileSync('.dw/intel/stack.json')).digest('hex'))"`.
251
+ </execution_flow>
252
+
253
+ ## Partial Updates
254
+
255
+ When `focus: partial --files <paths>` is specified:
256
+
257
+ 1. Only update entries in `files.json`/`apis.json`/`deps.json` that reference the given paths.
258
+ 2. Do NOT rewrite `stack.json` or `arch.md` (these need full context).
259
+ 3. Preserve existing entries not related to the specified paths.
260
+ 4. Read existing intel files first, merge updates, write back.
261
+ 5. Bump `_meta.version` by 1 and update `_meta.updated_at`.
262
+
263
+ ## Output Budget
264
+
265
+ | File | Target | Hard Limit |
266
+ |------|--------|------------|
267
+ | `files.json` | ≤2000 tokens | 3000 tokens |
268
+ | `apis.json` | ≤1500 tokens | 2500 tokens |
269
+ | `deps.json` | ≤1000 tokens | 1500 tokens |
270
+ | `stack.json` | ≤500 tokens | 800 tokens |
271
+ | `arch.md` | ≤1500 tokens | 2000 tokens |
272
+
273
+ For large codebases, prioritize coverage of key files over exhaustive listing. Include the most important 50-100 source files in `files.json` rather than attempting to list every file.
274
+
275
+ <success_criteria>
276
+ - [ ] All 5 intel files written to `.dw/intel/`
277
+ - [ ] All JSON files are valid, parseable JSON
278
+ - [ ] All entries reference actual file paths verified by Glob/Read
279
+ - [ ] `.last-refresh.json` written with hashes
280
+ - [ ] Completion marker returned
281
+ </success_criteria>
282
+
283
+ <structured_returns>
284
+ ## Completion Protocol
285
+
286
+ CRITICAL: Your final output MUST end with exactly one completion marker. Orchestrators pattern-match on these markers to route results. Omitting causes silent failures.
287
+
288
+ - `## INTEL UPDATE COMPLETE` — all intel files written successfully
289
+ - `## INTEL UPDATE FAILED` — could not complete analysis (disabled, empty project, errors)
290
+ </structured_returns>
291
+
292
+ <critical_rules>
293
+
294
+ ### Context Quality Tiers
295
+
296
+ | Budget Used | Tier | Behavior |
297
+ |-------------|------|----------|
298
+ | 0-30% | PEAK | Explore freely, read broadly |
299
+ | 30-50% | GOOD | Be selective with reads |
300
+ | 50-70% | DEGRADING | Write incrementally, skip non-essential |
301
+ | 70%+ | POOR | Finish current file and return immediately |
302
+
303
+ </critical_rules>
304
+
305
+ <anti_patterns>
306
+
307
+ ## Anti-Patterns
308
+
309
+ 1. DO NOT guess or assume — read actual files for evidence
310
+ 2. DO NOT use Bash for file listing — use Glob tool
311
+ 3. DO NOT read files in `node_modules`, `.git`, `dist`, or `build` directories
312
+ 4. DO NOT include secrets or credentials in intel output
313
+ 5. DO NOT write placeholder data — every entry must be verified
314
+ 6. DO NOT exceed output budget — prioritize key files over exhaustive listing
315
+ 7. DO NOT commit the output — the orchestrator handles commits
316
+ 8. DO NOT consume more than 50% context before producing output — write incrementally
317
+
318
+ </anti_patterns>
@@ -0,0 +1,79 @@
1
+ # Incremental update — keeping `.dw/intel/` fresh without re-scanning everything
2
+
3
+ A full scan of a 50K-line repo takes minutes and burns context. Incremental updates target only what changed, in seconds.
4
+
5
+ ## When to run a full update
6
+
7
+ - First analysis (no `.dw/intel/` yet)
8
+ - After major restructuring (migration, framework change, large refactor)
9
+ - After 30+ days since last refresh (file structure has likely drifted)
10
+ - When `/dw-intel` queries return obviously stale results
11
+
12
+ Trigger via `/dw-map-codebase` (no flag) or `/dw-map-codebase --full`.
13
+
14
+ ## When to run a partial update
15
+
16
+ - A single PR / feature branch touched 1-20 files
17
+ - After `/dw-run-task` completes (touched files are known via git)
18
+ - After `dw-deps-audit --execute` updates dependencies (only `deps.json` needs refresh)
19
+
20
+ Trigger via `/dw-map-codebase --files src/foo.ts src/bar.ts` (explicit list) or `/dw-map-codebase --since HEAD~5` (from git diff).
21
+
22
+ ## Partial update protocol
23
+
24
+ The `intel-updater` agent receives `focus: partial --files <paths>` and:
25
+
26
+ 1. **Read** the existing `.dw/intel/{files,apis,deps}.json`. Parse and keep entries for files NOT in the input list.
27
+ 2. **For each file in the input list**:
28
+ - If the file no longer exists on disk → remove its entry from `files.json` and any references in `apis.json`.
29
+ - Otherwise → re-read the file, recompute imports/exports/type, replace the entry.
30
+ - For `apis.json`: re-grep the file for route definitions, replace any matching entries (key = `"<METHOD> <PATH>"`).
31
+ - For `deps.json`: re-cross-reference the file's imports. Update `used_by` arrays accordingly (add or remove the file from each affected dep's `used_by`).
32
+ 3. **Skip** `stack.json` and `arch.md` — these need full context and are NOT updated by partial runs. They become stale until the next full run.
33
+ 4. **Bump** `_meta.version` by 1, set `_meta.updated_at` to now.
34
+ 5. **Update** `.last-refresh.json` with the new hashes for `files.json`, `apis.json`, `deps.json` (the three that were touched).
35
+
36
+ If you run a partial update on a project where `.dw/intel/` doesn't exist, abort with: `"No .dw/intel/ found. Run /dw-map-codebase first for a full scan."`
37
+
38
+ ## How `intel-updater` knows what's "key" in a partial
39
+
40
+ The `--files` list is authoritative for `files.json`. For `apis.json`, the agent must broaden by 1 hop:
41
+
42
+ - If `src/routes/users.ts` was in `--files`, also re-grep `src/routes/index.ts` (because it likely re-exports the user routes).
43
+ - If `src/server.ts` was in `--files`, re-scan all `src/routes/**/*.ts` (because the route registration list may have changed).
44
+
45
+ Concretely: after re-reading the explicit files, re-grep the project for `app.use(`/`router.use(`/`@Module(`/etc. and re-extract the API map from those entry points. This catches indirect changes without doing a full scan.
46
+
47
+ For `deps.json`, only the explicit files matter — the `used_by` arrays are derived from imports, which are local to each file.
48
+
49
+ ## Detecting drift before updating
50
+
51
+ Use `.last-refresh.json` to detect whether files changed since the last refresh:
52
+
53
+ ```bash
54
+ node -e "
55
+ const cur = require('crypto').createHash('sha256')
56
+ .update(require('fs').readFileSync('.dw/intel/stack.json'))
57
+ .digest('hex');
58
+ const last = require('./.dw/intel/.last-refresh.json').files['stack.json'];
59
+ console.log(cur === last ? 'unchanged' : 'changed');
60
+ "
61
+ ```
62
+
63
+ If everything matches `.last-refresh.json` AND no source file's mtime is newer than `_meta.updated_at`, the index is fully fresh and the update can be a no-op.
64
+
65
+ ## Conflict resolution (full update overlapping with partial)
66
+
67
+ If a full update is triggered while a partial update is in flight (rare but possible in CI), the FULL update wins:
68
+
69
+ - The partial agent's writes are overwritten when the full agent finishes.
70
+ - Both agents use atomic write (write to `.dw/intel/<file>.json.tmp` then rename) to avoid leaving the index in a torn state.
71
+
72
+ ## What incremental updates do NOT cover
73
+
74
+ - New `package.json` (e.g., user added `express` to deps but no source file imports it yet) — `deps.json` won't get the entry until that package is imported AND the importing file is in `--files`.
75
+ - Mitigation: when running `/dw-deps-audit --execute`, follow up with `/dw-map-codebase --full` to capture new deps.
76
+ - New file with a brand-new API route, when neither the new file nor any registration site was in `--files`.
77
+ - Mitigation: include `src/routes/index.ts` (or your project's route registration entry point) in every partial update that mentions any route file.
78
+ - Architectural changes (the kind that would update `arch.md`) — partial updates leave `arch.md` stale.
79
+ - Mitigation: run a full update after merging large architectural PRs.
@@ -0,0 +1,208 @@
1
+ # Intel format — schemas of `.dw/intel/` files
2
+
3
+ Every command that reads `.dw/intel/` depends on these schemas. Treat this file as the contract.
4
+
5
+ ## Layout
6
+
7
+ ```
8
+ .dw/intel/
9
+ ├── stack.json # languages, frameworks, build/test tooling
10
+ ├── files.json # per-file imports/exports/type
11
+ ├── apis.json # routes, endpoints, CLI commands
12
+ ├── deps.json # third-party dependencies + usage
13
+ ├── arch.md # architectural overview (markdown)
14
+ └── .last-refresh.json # change detection (timestamps + sha256 hashes)
15
+ ```
16
+
17
+ ## Common `_meta` block (all JSON files)
18
+
19
+ ```json
20
+ {
21
+ "_meta": {
22
+ "updated_at": "2026-05-06T12:34:56.789Z",
23
+ "version": 3
24
+ }
25
+ }
26
+ ```
27
+
28
+ - `updated_at`: ISO-8601 UTC timestamp, set on every write
29
+ - `version`: integer, starts at 1, increments on every update (full or partial)
30
+
31
+ ## `stack.json`
32
+
33
+ ```json
34
+ {
35
+ "_meta": { "updated_at": "...", "version": 1 },
36
+ "languages": ["TypeScript", "JavaScript"],
37
+ "frameworks": ["Express", "React"],
38
+ "tools": ["ESLint", "Jest", "Docker"],
39
+ "build_system": "npm scripts",
40
+ "test_framework": "Jest",
41
+ "package_manager": "npm",
42
+ "content_formats": ["Markdown", "YAML", "EJS"]
43
+ }
44
+ ```
45
+
46
+ Field rules:
47
+ - `languages`: ordered by line count (most-prevalent first)
48
+ - `frameworks`: full names (no abbreviations) — `"Next.js"` not `"next"`
49
+ - `tools`: dev tooling that affects code shape (linter, formatter, bundler, container runtime)
50
+ - `build_system`: detected from manifest (`npm scripts`, `Vite`, `webpack`, `esbuild`, `dotnet`, `cargo`, etc.)
51
+ - `test_framework`: detected from manifest (`Jest`, `Vitest`, `Pytest`, `xUnit`, `cargo test`, etc.); `"none"` if no test setup detected
52
+ - `package_manager`: from lockfile (`npm`, `pnpm`, `yarn`, `poetry`, `uv`, `dotnet`, `cargo`)
53
+ - `content_formats`: non-code formats with structural significance (markdown for docs/skills, YAML for configs, JSON Schema, OpenAPI, Protobuf, etc.)
54
+
55
+ ## `files.json`
56
+
57
+ ```json
58
+ {
59
+ "_meta": { "updated_at": "...", "version": 1 },
60
+ "entries": {
61
+ "src/server.ts": {
62
+ "exports": ["createServer", "default"],
63
+ "imports": ["./config", "express", "./routes/users"],
64
+ "type": "entry-point"
65
+ },
66
+ "src/routes/users.ts": {
67
+ "exports": ["userRouter"],
68
+ "imports": ["express", "../db", "../schemas/user"],
69
+ "type": "module"
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
75
+ Field rules:
76
+ - Key: file path relative to project root, forward slashes
77
+ - `exports`: array of ACTUAL exported symbol names. NOT descriptions. `["createServer", "default"]` is correct; `["server creation"]` is wrong.
78
+ - `imports`: array of import specifiers (relative paths or package names) — preserve as the source code writes them
79
+ - `type`: one of `entry-point`, `module`, `config`, `test`, `script`, `type-def`, `style`, `template`, `data`
80
+
81
+ Coverage: target the most important 50-100 files. Skip generated code, test files (unless they reveal architecture), `node_modules/dist/build`.
82
+
83
+ ## `apis.json`
84
+
85
+ ```json
86
+ {
87
+ "_meta": { "updated_at": "...", "version": 1 },
88
+ "entries": {
89
+ "GET /api/users": {
90
+ "method": "GET",
91
+ "path": "/api/users",
92
+ "params": ["page", "limit"],
93
+ "file": "src/routes/users.ts",
94
+ "description": "List users with pagination"
95
+ },
96
+ "CLI: dw-init": {
97
+ "method": "CLI",
98
+ "path": "dev-workflow init",
99
+ "params": ["--lang", "--force"],
100
+ "file": "bin/dev-workflow.js",
101
+ "description": "Scaffold .dw/ structure into a project"
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ Field rules:
108
+ - Key format: `"<METHOD> <PATH>"` for HTTP, `"CLI: <command>"` for CLI, `"GraphQL: <operation>"`, `"Handler: <event>"`, etc.
109
+ - `method`: HTTP verb, or `"CLI"`, `"GraphQL"`, `"gRPC"`, `"Event"`, `"Subscription"`
110
+ - `path`: the route/command/operation name
111
+ - `params`: query/body/CLI flag names — array of strings
112
+ - `file`: source path
113
+ - `description`: one-line summary derived from the handler's first comment or function name
114
+
115
+ If no API surfaces detected, write `{ "_meta": {...}, "entries": {} }` — never omit the file.
116
+
117
+ ## `deps.json`
118
+
119
+ ```json
120
+ {
121
+ "_meta": { "updated_at": "...", "version": 1 },
122
+ "entries": {
123
+ "express": {
124
+ "version": "^4.18.0",
125
+ "type": "production",
126
+ "used_by": ["src/server.ts", "src/routes/users.ts"],
127
+ "invocation": "require"
128
+ },
129
+ "vitest": {
130
+ "version": "^2.0.0",
131
+ "type": "development",
132
+ "used_by": ["package.json#test"],
133
+ "invocation": "npm test"
134
+ }
135
+ }
136
+ }
137
+ ```
138
+
139
+ Field rules:
140
+ - Key: package name (npm), distribution name (PyPI), package id (NuGet), crate name (crates.io)
141
+ - `version`: semver range from manifest
142
+ - `type`: `production` | `development` | `peer` | `optional`
143
+ - `used_by`: array of file paths that import the dep (verified by Grep) OR npm-script keys for tooling deps
144
+ - `invocation`:
145
+ - `require` if directly imported in code
146
+ - npm script command (`npm run lint`, `npm test`) if exercised via script
147
+ - `implicit` if a runtime/framework dep that's not directly imported (e.g., `react-dom` in a Next.js project)
148
+
149
+ ## `arch.md`
150
+
151
+ ```markdown
152
+ ---
153
+ updated_at: "2026-05-06T12:34:56.789Z"
154
+ ---
155
+
156
+ ## Architecture Overview
157
+
158
+ The project follows a layered architecture: HTTP routes → application services → repository layer → ORM → database.
159
+
160
+ ## Key Components
161
+
162
+ | Component | Path | Responsibility |
163
+ |-----------|------|----------------|
164
+ | Server bootstrap | `src/server.ts` | Express app initialization + middleware wiring |
165
+ | Route handlers | `src/routes/` | HTTP request validation and response shaping |
166
+ | Application services | `src/services/` | Business logic, orchestration |
167
+ | Repositories | `src/repositories/` | Data access via Prisma |
168
+ | Schemas | `src/schemas/` | Zod validation schemas, shared with frontend |
169
+
170
+ ## Data Flow
171
+
172
+ `HTTP request` → `route handler (validates with Zod)` → `service` → `repository (Prisma)` → `Postgres` → response
173
+
174
+ ## Conventions
175
+
176
+ - File naming: kebab-case (`user-routes.ts`, `order-service.ts`)
177
+ - Function naming: camelCase, verb-first (`createOrder`, `findUserById`)
178
+ - Tests: co-located, `.test.ts` suffix
179
+ - Imports: absolute via `@/` alias for cross-module, relative for sibling files
180
+ ```
181
+
182
+ ## `.last-refresh.json`
183
+
184
+ ```json
185
+ {
186
+ "updated_at": "2026-05-06T12:34:56.789Z",
187
+ "files": {
188
+ "stack.json": "a3c8b1...",
189
+ "files.json": "f9e2d7...",
190
+ "apis.json": "1b4f8a...",
191
+ "deps.json": "5c2e6b...",
192
+ "arch.md": "9d7c3e..."
193
+ }
194
+ }
195
+ ```
196
+
197
+ Hashes are SHA-256 of file contents at the moment of refresh. Used by `/dw-map-codebase` to detect drift on the next run and decide whether a partial update is enough.
198
+
199
+ ## Validation rules
200
+
201
+ When `intel-updater` finishes, all 5 files MUST satisfy:
202
+
203
+ 1. Valid JSON (parseable)
204
+ 2. `_meta.updated_at` is ISO-8601
205
+ 3. `_meta.version` is a positive integer
206
+ 4. All file paths in `files.json`, `apis.json`, `deps.json` exist on disk (or were excluded for known reasons)
207
+ 5. `exports` arrays contain only actual symbols (no descriptions, no spaces in entries)
208
+ 6. No secrets/credentials/tokens in any file