Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
5044306
Consolidate validator onto MasterDataset read model (ADR-006)
darko-mijic Feb 20, 2026
2d209d3
Complete ValidatorReadModelConsolidation (active→completed)
darko-mijic Feb 20, 2026
6dc7786
Refine ProcessAPILayeredExtraction deliverables (DD-5, DD-6)
darko-mijic Feb 20, 2026
c3acfc3
Transition ProcessAPILayeredExtraction to active (roadmap→active)
darko-mijic Feb 20, 2026
0393221
Complete ProcessAPILayeredExtraction (active→completed)
darko-mijic Feb 20, 2026
b1ab45b
Fix pipeline factory: wire exclude option and clean up review findings
darko-mijic Feb 20, 2026
ac2440b
Surface pipeline warnings instead of silently swallowing Gherkin scan…
darko-mijic Feb 20, 2026
34ba4b7
Update docs/ for Single Read Model Architecture (ADR-006)
darko-mijic Feb 20, 2026
5aea746
Fix validate:all failures: DoD terminal statuses, threshold tuning, a…
darko-mijic Feb 20, 2026
19efdc8
Migrate orchestrator pipeline to shared factory (roadmap→active)
darko-mijic Feb 20, 2026
49b1466
Complete OrchestratorPipelineFactoryMigration (active→completed)
darko-mijic Feb 20, 2026
9793aca
Update dist
darko-mijic Feb 20, 2026
6e27a0f
Address code review findings: stale metadata, type safety, and missin…
darko-mijic Feb 20, 2026
91320a9
Suppress non-actionable INFO messages from validate:patterns default …
darko-mijic Feb 20, 2026
e9e300e
Address valid PR #28 review comments (5 of 6)
darko-mijic Feb 20, 2026
071b070
Update dist and regenerate docs
darko-mijic Feb 20, 2026
1de99c0
Update CLAUDE.md modules for ADR-006 Single Read Model and API-dynami…
darko-mijic Feb 20, 2026
ba149db
Remove most of generated docs from doc:all
darko-mijic Feb 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
90 changes: 58 additions & 32 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ Session types: `planning` (minimal), `design` (full: stubs + deps + deliverables
| `list --status roadmap` | Find available patterns to work on |
| `arch blocking` | Find patterns stuck on incomplete dependencies |
| `stubs --unresolved` | Find design stubs missing implementations |
| `rules` | Business rules and invariants from Gherkin `Rule:` blocks |
| `files <pattern>` | File reading list with implementation paths — replaces manual path discovery |
| `decisions <pattern>` | Design decisions (AD-N) from stub descriptions |
| `pdr <number>` | Cross-reference patterns mentioning a PDR number |
| `handoff --pattern` | Capture session-end state for multi-session work |

#### Annotation Exploration
Expand All @@ -167,6 +171,18 @@ Run these **before** making annotation changes — they prevent debugging cycles

**Lesson learned:** `unannotated --path src/types` would have immediately caught missing `@libar-docs` annotations on `result.ts` and `errors.ts` — saving ~30 minutes of debugging why shapes weren't appearing in generated docs.

#### Architecture Queries

Query architectural structure directly — avoids explore agents for structural questions:

| Command | When to Use |
| --------------------- | ---------------------------------------------------- |
| `arch coverage` | Annotation completeness across the project |
| `arch context [name]` | Patterns in bounded context (list all if no name) |
| `arch layer [name]` | Patterns in architecture layer (list all if no name) |
| `arch dangling` | Broken references — pattern names that don't resolve |
| `arch orphans` | Isolated patterns with no relationships |

#### Tips

- `pattern <name>` returns ~66KB for completed patterns — prefer `context --session` for interactive sessions.
Expand Down Expand Up @@ -196,21 +212,26 @@ CONFIG → SCANNER → EXTRACTOR → TRANSFORMER → CODEC
- **Schema-First**: Zod schemas in `src/validation-schemas/` define types with runtime validation
- **Registry Pattern**: Tag registry (`src/taxonomy/`) defines categories, status values, and tag formats
- **Codec-Based Rendering**: Generators in `src/generators/` use codecs to transform data to markdown
- **Pipeline Factory**: Shared `buildMasterDataset()` in `src/generators/pipeline/build-pipeline.ts` — all consumers (orchestrator, process-api, validate-patterns) call this instead of wiring inline pipelines. Per-consumer behavior via `PipelineOptions`.
- **Single Read Model** (ADR-006): MasterDataset is the sole read model. No consumer re-derives data from raw scanner/extractor output. Anti-patterns: Parallel Pipeline, Lossy Local Type, Re-derived Relationship.

### Module Structure

| Module | Purpose |
| ------------------------- | ---------------------------------------------------------------- |
| `src/config/` | Configuration factory, presets (generic, ddd-es-cqrs) |
| `src/taxonomy/` | Tag definitions - categories, status values, format types |
| `src/scanner/` | TypeScript and Gherkin file scanning |
| `src/extractor/` | Pattern extraction from AST/Gherkin |
| `src/generators/` | Document generators and orchestrator |
| `src/renderable/` | Markdown codec system |
| `src/validation/` | FSM validation, DoD checks, anti-patterns |
| `src/lint/` | Pattern linting and process guard |
| `src/api/` | Query layer powering the Data API CLI |
| `delivery-process/stubs/` | Design session code stubs (outside src/ for TS/ESLint isolation) |
| Module | Purpose |
| -------------------------- | -------------------------------------------------------------------- |
| `src/config/` | Configuration factory, presets (generic, ddd-es-cqrs) |
| `src/taxonomy/` | Tag definitions - categories, status values, format types |
| `src/scanner/` | TypeScript and Gherkin file scanning |
| `src/extractor/` | Pattern extraction from AST/Gherkin |
| `src/generators/` | Document generators, orchestrator, and pipeline factory |
| `src/generators/pipeline/` | `buildMasterDataset()` factory, `mergePatterns()`, dataset transform |
| `src/renderable/` | Markdown codec system |
| `src/validation/` | FSM validation, DoD checks, anti-patterns |
| `src/lint/` | Pattern linting and process guard |
| `src/api/` | Query layer: Data API CLI, business rules query (`rules-query.ts`) |
| `delivery-process/stubs/` | Design session code stubs (outside src/ for TS/ESLint isolation) |

**Live inventory:** `pnpm process:query -- arch context` and `pnpm process:query -- arch layer` reflect the actual annotated codebase structure.

### Three Presets

Expand All @@ -230,8 +251,11 @@ Tests use Vitest with BDD/Gherkin integration:
- **Step definitions**: `tests/steps/**/*.steps.ts`
- **Fixtures**: `tests/fixtures/` - test data and factory functions
- **Support**: `tests/support/` - test helpers and setup utilities
- **Shared state helpers**: `tests/support/helpers/` - reusable state management for split test suites

Large test files are split into focused domain files with shared state extracted to helpers (e.g., `ast-parser-state.ts`, `process-api-state.ts`).

Run a single test file: `pnpm test tests/steps/scanner.steps.ts`
Run a single test file: `pnpm test tests/steps/scanner/file-discovery.steps.ts`

### Gherkin-Only Testing Policy

Expand Down Expand Up @@ -464,6 +488,8 @@ Deliverable status is enforced by `z.enum()` at schema level. The 6 canonical va

**NEVER** use freeform status strings. The Zod schema rejects non-canonical values at parse time.

**Terminal statuses:** `complete`, `n/a`, and `superseded` are terminal per `isDeliverableStatusTerminal()`. Used by DoD validation — `deferred` is NOT terminal.

### Efficient Debugging Strategy

- **Don't** try to debug by running the full test suite repeatedly.
Expand Down Expand Up @@ -608,6 +634,8 @@ pnpm process:query -- stubs <SpecName>
| `completed` | Hard-locked | No | Yes |
| `deferred` | None | Yes | No |

**Live query:** `pnpm process:query -- query getProtectionInfo <status>` and `query getValidTransitionsFrom <status>` return current FSM rules from code.

**Valid FSM Transitions:**

```
Expand Down Expand Up @@ -639,27 +667,15 @@ deferred ──→ roadmap

### Handoff Documentation

For multi-session work, capture state at session boundaries:

```markdown
## Session State

- **Last completed:** Phase 1 - Core types
- **In progress:** Phase 2 - Validation
- **Blockers:** None
For multi-session work, generate handoff state from the API:

### Files Modified

- `src/types.ts` - Added core types
- `src/validate.ts` - Started validation (incomplete)

## Next Session

1. **FIRST:** Complete validation in `src/validate.ts`
2. Add integration tests
3. Update deliverable statuses
```bash
pnpm process:query -- handoff --pattern <PatternName>
# Options: --git (include recent commits), --session <id>
```

Generates: deliverable statuses, blockers, modification date, and next steps — always reflects actual annotation state.

---

## Validation
Expand Down Expand Up @@ -735,11 +751,21 @@ Enforces dual-source architecture ownership between TypeScript and Gherkin files
| `@libar-docs-quarter` | Feature files | TypeScript | Gherkin owns timeline metadata |
| `@libar-docs-team` | Feature files | TypeScript | Gherkin owns ownership metadata |

#### Single Read Model Anti-Patterns (ADR-006)

| Anti-Pattern | Signal |
| ----------------------- | ----------------------------------------------------------------------------------- |
| Parallel Pipeline | Consumer imports from `scanner/` or `extractor/` instead of consuming MasterDataset |
| Lossy Local Type | Local interface with subset of `ExtractedPattern` fields |
| Re-derived Relationship | Building `Map`/`Set` from raw `implements`/`uses` arrays in consumer code |

**Exception:** `lint-patterns.ts` is a stage-1 consumer (validates annotation syntax, no cross-source resolution).

#### DoD Validation

For patterns with `completed` status, validates:

- All deliverables marked complete (checkmark, "Done", "Complete")
- All deliverables have terminal status (`complete`, `n/a`, or `superseded`) per `isDeliverableStatusTerminal()` — `deferred` is NOT terminal
- At least one `@acceptance-criteria` scenario exists in the spec

#### Running Validation
Expand Down
16 changes: 16 additions & 0 deletions _claude-md/api/data-api-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Session types: `planning` (minimal), `design` (full: stubs + deps + deliverables
| `list --status roadmap` | Find available patterns to work on |
| `arch blocking` | Find patterns stuck on incomplete dependencies |
| `stubs --unresolved` | Find design stubs missing implementations |
| `rules` | Business rules and invariants from Gherkin `Rule:` blocks |
| `files <pattern>` | File reading list with implementation paths — replaces manual path discovery |
| `decisions <pattern>` | Design decisions (AD-N) from stub descriptions |
| `pdr <number>` | Cross-reference patterns mentioning a PDR number |
| `handoff --pattern` | Capture session-end state for multi-session work |

#### Annotation Exploration
Expand All @@ -37,6 +41,18 @@ Run these **before** making annotation changes — they prevent debugging cycles

**Lesson learned:** `unannotated --path src/types` would have immediately caught missing `@libar-docs` annotations on `result.ts` and `errors.ts` — saving ~30 minutes of debugging why shapes weren't appearing in generated docs.

#### Architecture Queries

Query architectural structure directly — avoids explore agents for structural questions:

| Command | When to Use |
| --------------------- | ---------------------------------------------------- |
| `arch coverage` | Annotation completeness across the project |
| `arch context [name]` | Patterns in bounded context (list all if no name) |
| `arch layer [name]` | Patterns in architecture layer (list all if no name) |
| `arch dangling` | Broken references — pattern names that don't resolve |
| `arch orphans` | Isolated patterns with no relationships |

#### Tips

- `pattern <name>` returns ~66KB for completed patterns — prefer `context --session` for interactive sessions.
Expand Down
2 changes: 2 additions & 0 deletions _claude-md/api/dual-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ When pattern exists in both TypeScript AND feature file:
| Description | TypeScript markdown description |

**Warning:** If TypeScript file is missing `@libar-docs-status`, the pattern data is **ignored** and not merged with feature file.

**Implementation:** `mergePatterns()` in `src/generators/pipeline/merge-patterns.ts`. Conflict strategy is per-consumer: `fatal` (orchestrator/process-api) or `concatenate` (validator).
29 changes: 17 additions & 12 deletions _claude-md/core/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,26 @@ CONFIG → SCANNER → EXTRACTOR → TRANSFORMER → CODEC
- **Schema-First**: Zod schemas in `src/validation-schemas/` define types with runtime validation
- **Registry Pattern**: Tag registry (`src/taxonomy/`) defines categories, status values, and tag formats
- **Codec-Based Rendering**: Generators in `src/generators/` use codecs to transform data to markdown
- **Pipeline Factory**: Shared `buildMasterDataset()` in `src/generators/pipeline/build-pipeline.ts` — all consumers (orchestrator, process-api, validate-patterns) call this instead of wiring inline pipelines. Per-consumer behavior via `PipelineOptions`.
- **Single Read Model** (ADR-006): MasterDataset is the sole read model. No consumer re-derives data from raw scanner/extractor output. Anti-patterns: Parallel Pipeline, Lossy Local Type, Re-derived Relationship.

### Module Structure

| Module | Purpose |
| ------------------------- | ---------------------------------------------------------------- |
| `src/config/` | Configuration factory, presets (generic, ddd-es-cqrs) |
| `src/taxonomy/` | Tag definitions - categories, status values, format types |
| `src/scanner/` | TypeScript and Gherkin file scanning |
| `src/extractor/` | Pattern extraction from AST/Gherkin |
| `src/generators/` | Document generators and orchestrator |
| `src/renderable/` | Markdown codec system |
| `src/validation/` | FSM validation, DoD checks, anti-patterns |
| `src/lint/` | Pattern linting and process guard |
| `src/api/` | Query layer powering the Data API CLI |
| `delivery-process/stubs/` | Design session code stubs (outside src/ for TS/ESLint isolation) |
| Module | Purpose |
| -------------------------- | -------------------------------------------------------------------- |
| `src/config/` | Configuration factory, presets (generic, ddd-es-cqrs) |
| `src/taxonomy/` | Tag definitions - categories, status values, format types |
| `src/scanner/` | TypeScript and Gherkin file scanning |
| `src/extractor/` | Pattern extraction from AST/Gherkin |
| `src/generators/` | Document generators, orchestrator, and pipeline factory |
| `src/generators/pipeline/` | `buildMasterDataset()` factory, `mergePatterns()`, dataset transform |
| `src/renderable/` | Markdown codec system |
| `src/validation/` | FSM validation, DoD checks, anti-patterns |
| `src/lint/` | Pattern linting and process guard |
| `src/api/` | Query layer: Data API CLI, business rules query (`rules-query.ts`) |
| `delivery-process/stubs/` | Design session code stubs (outside src/ for TS/ESLint isolation) |

**Live inventory:** `pnpm process:query -- arch context` and `pnpm process:query -- arch layer` reflect the actual annotated codebase structure.

### Three Presets

Expand Down
2 changes: 2 additions & 0 deletions _claude-md/testing/test-implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Deliverable status is enforced by `z.enum()` at schema level. The 6 canonical va

**NEVER** use freeform status strings. The Zod schema rejects non-canonical values at parse time.

**Terminal statuses:** `complete`, `n/a`, and `superseded` are terminal per `isDeliverableStatusTerminal()`. Used by DoD validation — `deferred` is NOT terminal.

### Efficient Debugging Strategy

- **Don't** try to debug by running the full test suite repeatedly.
Expand Down
5 changes: 4 additions & 1 deletion _claude-md/testing/testing-policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ Tests use Vitest with BDD/Gherkin integration:
- **Step definitions**: `tests/steps/**/*.steps.ts`
- **Fixtures**: `tests/fixtures/` - test data and factory functions
- **Support**: `tests/support/` - test helpers and setup utilities
- **Shared state helpers**: `tests/support/helpers/` - reusable state management for split test suites

Run a single test file: `pnpm test tests/steps/scanner.steps.ts`
Large test files are split into focused domain files with shared state extracted to helpers (e.g., `ast-parser-state.ts`, `process-api-state.ts`).

Run a single test file: `pnpm test tests/steps/scanner/file-discovery.steps.ts`

### Gherkin-Only Testing Policy

Expand Down
12 changes: 11 additions & 1 deletion _claude-md/validation/anti-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,21 @@ Enforces dual-source architecture ownership between TypeScript and Gherkin files
| `@libar-docs-quarter` | Feature files | TypeScript | Gherkin owns timeline metadata |
| `@libar-docs-team` | Feature files | TypeScript | Gherkin owns ownership metadata |

#### Single Read Model Anti-Patterns (ADR-006)

| Anti-Pattern | Signal |
| ----------------------- | ----------------------------------------------------------------------------------- |
| Parallel Pipeline | Consumer imports from `scanner/` or `extractor/` instead of consuming MasterDataset |
| Lossy Local Type | Local interface with subset of `ExtractedPattern` fields |
| Re-derived Relationship | Building `Map`/`Set` from raw `implements`/`uses` arrays in consumer code |

**Exception:** `lint-patterns.ts` is a stage-1 consumer (validates annotation syntax, no cross-source resolution).

#### DoD Validation

For patterns with `completed` status, validates:

- All deliverables marked complete (checkmark, "Done", "Complete")
- All deliverables have terminal status (`complete`, `n/a`, or `superseded`) per `isDeliverableStatusTerminal()` — `deferred` is NOT terminal
- At least one `@acceptance-criteria` scenario exists in the spec

#### Running Validation
Expand Down
26 changes: 8 additions & 18 deletions _claude-md/workflow/fsm-handoff.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
| `completed` | Hard-locked | No | Yes |
| `deferred` | None | Yes | No |

**Live query:** `pnpm process:query -- query getProtectionInfo <status>` and `query getValidTransitionsFrom <status>` return current FSM rules from code.

**Valid FSM Transitions:**

```
Expand Down Expand Up @@ -38,23 +40,11 @@ deferred ──→ roadmap

### Handoff Documentation

For multi-session work, capture state at session boundaries:

```markdown
## Session State

- **Last completed:** Phase 1 - Core types
- **In progress:** Phase 2 - Validation
- **Blockers:** None

### Files Modified
For multi-session work, generate handoff state from the API:

- `src/types.ts` - Added core types
- `src/validate.ts` - Started validation (incomplete)

## Next Session

1. **FIRST:** Complete validation in `src/validate.ts`
2. Add integration tests
3. Update deliverable statuses
```bash
pnpm process:query -- handoff --pattern <PatternName>
# Options: --git (include recent commits), --session <id>
```

Generates: deliverable statuses, blockers, modification date, and next steps — always reflects actual annotation state.
Loading
Loading