contract-driven-delivery 2.0.19 → 2.0.21

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/CHANGELOG.md CHANGED
@@ -1,5 +1,74 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.0.21] - 2026-05-25
4
+
5
+ Kit review fixes plus large-project capability improvements. All additions are
6
+ opt-in and non-breaking; normal runs are byte-for-byte unchanged.
7
+
8
+ ### Added
9
+
10
+ - **`cdd-kit code-map --surface <subpath>`**: scopes the scan to a monorepo
11
+ subtree and names the map `.cdd/code-map.<slug>.yml`, queryable with
12
+ `cdd-kit index query <term> --map .cdd/code-map.<slug>.yml`, instead of forcing
13
+ one giant whole-repo map. A missing surface path now errors instead of
14
+ silently emitting an empty map.
15
+ - **`cdd-kit code-map --workers [n]`** (default off): parallelizes JS/TS/Vue
16
+ scanning across child processes. Output is deterministic regardless of chunk
17
+ distribution, and any worker failure falls back to in-process scanning, so
18
+ enabling workers can never make a run fail that would otherwise succeed.
19
+ - **Model class in dispatch badges**: `/cdd-new` and `/cdd-resume` now render
20
+ each agent badge as `[role · model]`, resolved at dispatch time from
21
+ `.cdd/model-policy.json`. Narration only — runtime model selection is unchanged.
22
+
23
+ ### Changed
24
+
25
+ - **JSON sidecar for `index query` / `index impact`**: `cdd-kit code-map` now
26
+ writes a parsed `.cdd/code-map.index.json` next to the map so queries skip the
27
+ slow `yaml.load` on large maps. The sidecar is a derived local cache —
28
+ gitignored, digest-validated against the map header, regenerated on every map
29
+ run, stripped from the published package, and never required (queries fall back
30
+ to the authoritative `.cdd/code-map.yml` on any absence or mismatch).
31
+ - **`typecheck` script** (`tsc --noEmit`) added and wired into `prepublishOnly`
32
+ so type errors cannot regress.
33
+ - Deduplicated `ensureGitignoreEntry` into `src/utils/gitignore.ts` as the single
34
+ source of truth.
35
+
36
+ ### Fixed
37
+
38
+ - **`cdd-kit doctor` no longer false-flags every agent**: doctor kept its own
39
+ divergent agent-lint check hard-coded to the old `### Required artifacts`
40
+ heading and flagged all agents after the heading was renamed to
41
+ `### Suggested artifacts`, while `cdd-kit lint-agents` reported clean. Both now
42
+ share `lintAgentContent` / `collectAgentViolations` so they cannot drift apart.
43
+ - **`cdd-kit doctor` now warns instead of silently passing** when `.claude/agents`
44
+ exists but cannot be read (permission/IO error), rather than reporting a clean
45
+ pass on an unscanned directory.
46
+ - **Python scanning is chunked** (`CDD_CODE_MAP_BATCH_SIZE`, default 400) so a
47
+ single subprocess timeout or buffer overflow on a large Python repo no longer
48
+ drops the structure of every `.py` file; completed chunks are preserved.
49
+ - Cleared pre-existing `tsc --noEmit` errors in `include-exclude.ts`,
50
+ `scanners/javascript.ts`, and `refresh.ts`.
51
+
52
+ ### Security
53
+
54
+ - The `--workers` / Python batch-list temp files are now created with
55
+ `crypto.randomBytes` names and mode `0600` to avoid predictable-name
56
+ symlink/race attacks in the shared tmp dir (CWE-377), and the scan worker spawn
57
+ is constrained by a language allowlist with an explicit no-shell invocation.
58
+
59
+ ## [2.0.20] - 2026-05-15
60
+
61
+ Patch release for UTF-8 BOM handling in Claude agent metadata files.
62
+
63
+ ### Fixed
64
+
65
+ - Removed UTF-8 BOM bytes from packaged Claude agent and skill sources so YAML
66
+ frontmatter starts at `---` and Claude Code can mount subagents reliably.
67
+ - `cdd-kit lint-agents` now rejects agent files that start with `U+FEFF`, since
68
+ frontmatter parsers may otherwise treat the first key as invalid.
69
+ - Added package-source and generated-assets regression coverage to prevent BOM
70
+ bytes from being shipped again.
71
+
3
72
  ## [2.0.19] - 2026-05-15
4
73
 
5
74
  Design ownership patch for the implementation-planning flow.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Contract-Driven Delivery Kit
1
+ # Contract-Driven Delivery Kit
2
2
 
3
3
  **cdd-kit** is a contract-driven delivery kit for AI coding agents. It started with Claude Code skills and now keeps the core workflow provider-neutral: contracts-first, test-first, spec-first. Every change goes through classification, contract review, TDD, implementation, and gate verification, with deterministic context indexes to keep agent work targeted.
4
4
 
@@ -671,6 +671,48 @@ surface: user-management
671
671
 
672
672
  The classifier should read these two files before proposing `context-manifest.md` allowed paths.
673
673
 
674
+ ### `cdd-kit code-map`
675
+
676
+ Scans source files into a deterministic structural index so agents read symbols
677
+ and line ranges instead of whole files.
678
+
679
+ ```bash
680
+ cdd-kit code-map # whole repo -> .cdd/code-map.yml
681
+ cdd-kit code-map --check # exit 1 if regenerating would change the map
682
+ cdd-kit code-map --surface packages/web # monorepo: scope + auto-name the map
683
+ cdd-kit code-map --workers # parallelize JS/TS/Vue scanning (default off)
684
+ ```
685
+
686
+ `--workers [n]` (default off; `n` defaults to CPU count − 1, capped at 16)
687
+ parallelizes the synchronous JS/TS/Vue parsing across child processes for large
688
+ repos. Output is byte-identical to a single-process run, and any worker failure
689
+ falls back to in-process scanning, so it can never make a run worse. Python is
690
+ already scanned in its own subprocess.
691
+
692
+ A JSON sidecar (`.cdd/code-map.<...>.index.json`) is written next to each map and
693
+ gitignored automatically; `cdd-kit index` reads it to skip re-parsing the YAML on
694
+ large maps, and falls back to the YAML whenever the sidecar is absent or stale.
695
+
696
+ Large Python repos are scanned in chunks (`CDD_CODE_MAP_BATCH_SIZE`, default 400)
697
+ so one slow batch cannot drop the whole language. Raise
698
+ `CDD_CODE_MAP_TIMEOUT_MS` (default 30000) if a single batch still times out.
699
+
700
+ #### Monorepos: per-surface maps
701
+
702
+ `--surface <subpath>` scopes the scan to one package and names the map after it
703
+ (`packages/web` → `.cdd/code-map.packages-web.yml`). Paths inside that map are
704
+ relative to the surface root. Query a specific surface map with `--map`:
705
+
706
+ ```bash
707
+ cdd-kit code-map --surface packages/web
708
+ cdd-kit code-map --surface packages/api
709
+ cdd-kit index query OrderService --map .cdd/code-map.packages-api.yml
710
+ cdd-kit context-scan --surface packages/web # scope the project-map tree too
711
+ ```
712
+
713
+ This keeps each package's index small and token-cheap instead of indexing the
714
+ entire monorepo into one giant map.
715
+
674
716
  ---
675
717
 
676
718
  ## Migrating an Older Production Repo
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: backend-engineer
3
3
  description: Implement backend changes only after specs, contracts, tests, and CI gates are defined; maintain thin controllers, service boundaries, validation, and error handling.
4
4
  tools: Read, Grep, Glob, Edit, MultiEdit, Bash
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: change-classifier
3
3
  description: Classify incoming requests into change types and decide required artifacts, contracts, tests, and review gates before implementation.
4
4
  tools: Read, Grep, Glob
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: ci-cd-gatekeeper
3
3
  description: Enforce CI/CD as a required delivery artifact; design and implement required, informational, nightly, weekly, and manual gates with promotion policy.
4
4
  tools: Read, Grep, Glob, Edit, MultiEdit, Bash
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: contract-reviewer
3
3
  description: Review and maintain API, CSS/UI, env, data-shape, business-rule, and CI/CD contracts for every change. Dependency and migration contracts are recorded here at contract level only; the active audit lives in dependency-security-reviewer.
4
4
  tools: Read, Grep, Glob
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: dependency-security-reviewer
3
3
  description: Reviews dependency CVE risk, license compliance (GPL/AGPL copyleft vs proprietary), lockfile changes, and database migrations whenever lockfiles, dependency manifests, or database migrations are touched.
4
4
  tools: Read, Grep, Glob, Bash
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: e2e-resilience-engineer
3
3
  description: Design and implement E2E, browser-behavior, failure-injection, data-boundary, and resilience tests for production-like user journeys.
4
4
  tools: Read, Grep, Glob, Edit, MultiEdit, Bash
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: frontend-engineer
3
3
  description: Implement frontend changes under API, CSS, UI/UX, accessibility, E2E, and visual review contracts.
4
4
  tools: Read, Grep, Glob, Edit, MultiEdit, Bash
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: monkey-test-engineer
3
3
  description: Design preventive specs and structured exploratory tests for invalid user operations, adversarial inputs, malformed data, rapid UI actions, and production misuse. Not random fuzzing -- every monkey scenario is mapped to a known failure mode or hardening goal.
4
4
  tools: Read, Grep, Glob, Edit, MultiEdit, Bash
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: qa-reviewer
3
3
  description: Execute quality gates, verify evidence, route failures back to the correct agent, and decide release readiness.
4
4
  tools: Read, Grep, Glob, Bash
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: repo-context-scanner
3
3
  description: Scan a repository and summarize its project profile, commands, contracts, tests, CI/CD, and missing standardization surfaces.
4
4
  tools: Read, Grep, Glob, Bash
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: spec-architect
3
3
  description: Evaluate architectural impact, compatibility, data flow, module boundaries, and whether a change requires ADR-like design decisions. Author ADRs when required.
4
4
  tools: Read, Grep, Glob, Edit, MultiEdit
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: spec-drift-auditor
3
3
  description: Audit drift between live contracts, implementation code, tests, and CI gates. Does NOT read historical specs/changes ??contracts/ is the single source of truth.
4
4
  tools: Read, Grep, Glob, Bash
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: stress-soak-engineer
3
3
  description: Design stress, load, soak, and long-running stability tests for reporting systems, queues, caches, auto-refresh, and data-heavy features.
4
4
  tools: Read, Grep, Glob, Edit, MultiEdit, Bash
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: test-strategist
3
3
  description: Convert specs and acceptance criteria into TDD-oriented test plans covering unit, contract, integration, E2E, resilience, monkey, stress, and soak tests.
4
4
  tools: Read, Grep, Glob, Edit, Write
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: ui-ux-reviewer
3
3
  description: Review interaction design, information hierarchy, copy, accessibility, empty/error/loading state semantics, and user journey quality. Does not cover pixel-level visuals or CSS -- those go to visual-reviewer.
4
4
  tools: Read, Grep, Glob
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: visual-reviewer
3
3
  description: Review pixel-level visual output, layout, responsive viewport behavior, screenshot diffs, CSS contract compliance, and component visual state coverage. Does not cover interaction or copy -- those go to ui-ux-reviewer.
4
4
  tools: Read, Grep, Glob, Bash
@@ -1,4 +1,4 @@
1
- ---
1
+ ---
2
2
  name: cdd-new
3
3
  description: Start a new tracked change. Scaffolds all required artifacts, classifies the change by risk tier, commissions the right agents in order, and runs cdd-kit gate. Args: <change description in natural language>
4
4
  ---
@@ -315,11 +315,19 @@ agent:
315
315
  ### Agent stage badges (UI v1)
316
316
 
317
317
  When you announce that you are about to invoke an agent, prefix the
318
- announcement with the matching emoji + role tag from the table below. This
319
- helps a non-engineer scanning the chat stream tell what stage they are in
318
+ announcement with the matching emoji + role tag from the table below, and
319
+ include the model class that agent runs on. This helps a non-engineer scanning
320
+ the chat stream tell what stage they are in AND which model is doing the work,
320
321
  without reading the full prompt. Use the badges only in your own narration to
321
322
  the user; do not put them inside the prompt sent to the agent.
322
323
 
324
+ The model class is not something you guess from the color. Read it at dispatch
325
+ time from `.cdd/model-policy.json` (`roles.<agent-name>`), which is the
326
+ authoritative source and is kept in sync with each agent's `model:` frontmatter
327
+ by `cdd-kit doctor`. Show that value (e.g. `opus`, `sonnet`, `haiku`) in the
328
+ badge so the user always sees the actual model, even after a project overrides
329
+ the defaults.
330
+
323
331
  | Stage | Agent | Badge |
324
332
  |---|---|---|
325
333
  | Decision | `change-classifier` | ? `[classifier]` |
@@ -348,8 +356,12 @@ Color semantics:
348
356
  - ? green: reviewing what was done (no code writes; just verdicts)
349
357
  - ??neutral: audits and scans (read-only background work)
350
358
 
351
- Format: emoji is followed by a single space, then the bracket-tag, then the
352
- human-readable narration.
359
+ Format: emoji is followed by a single space, then the bracket-tag with the
360
+ model class appended as `[role · model]`, then a single space, then the
361
+ human-readable narration. Resolve `model` from `.cdd/model-policy.json`
362
+ `roles.<agent-name>` (defaults: classifier / architect / plan / qa / drift =
363
+ `opus`; backend / frontend / ci-cd / test-plan / e2e / monkey / stress /
364
+ ui-ux / deps-sec = `sonnet`; visual / repo-scan = `haiku`).
353
365
 
354
366
  Examples:
355
367
 
@@ -360,9 +372,19 @@ Examples:
360
372
  ?? [stress] Tier 1 high-risk change ??running soak test for 30 min.
361
373
  ```
362
374
 
375
+ Model-labeled examples (the model class sits inside the bracket tag):
376
+
377
+ ```
378
+ 🟣 [classifier · opus] Reading the request and project map.
379
+ 🔵 [backend · sonnet] Implementing the JWT issuance endpoint, failing tests first.
380
+ ⚫ [repo-scan · haiku] Indexing the repository structure. (read-only)
381
+ ```
382
+
363
383
  These badges are pure narration. They MUST NOT be sent inside the agent's
364
384
  prompt; the agent's behavior is defined by the agent prompt files in
365
- `.claude/agents/<name>.md`, not by this badge.
385
+ `.claude/agents/<name>.md`, not by this badge. The model label is for the
386
+ user's visibility only — it does not change which model the runtime selects
387
+ (that is governed by the agent's `model:` frontmatter).
366
388
 
367
389
  ---
368
390
 
@@ -93,7 +93,7 @@ Ask the user: "Continue from <next-agent>? (yes/no)"
93
93
 
94
94
  ## Step 3: Continue the flow
95
95
 
96
- If user confirms, resume from the next agent in the Tier sequence (refer to `/cdd-new` Step 3 for the agent order, and `/cdd-new` "Agent stage badges" for the colored badges to use in your narration).
96
+ If user confirms, resume from the next agent in the Tier sequence (refer to `/cdd-new` Step 3 for the agent order, and `/cdd-new` "Agent stage badges" for the colored badges — including the per-agent model class read from `.cdd/model-policy.json` — to use in your narration).
97
97
 
98
98
  **Critical**: Inject this block at the start of every agent prompt:
99
99