Repository navigation
feat(cli): add dry-run mode to extract command - #123
Conversation
Add --dry-run flag to riviere extract that shows component counts by domain and type without writing files. Output format: "domain: Type(count), Type(count)". Co-Authored-By: Claude Opus 4.5 <[email protected]>
…dry-run-mode-to-ex
📝 WalkthroughWalkthroughAdds a --dry-run mode to the extract command that aggregates extracted DraftComponent items by domain and type and prints a concise domain/type count summary instead of the full JSON extraction output. Includes implementation and tests covering multiple domains and types. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
|||||||||||||||||||||||||||||||
Deploying living-architecture with
|
| Latest commit: |
2f3b05f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://97dfd413.living-architecture.pages.dev |
| Branch Preview URL: | https://issue-45-m4-d4-2-add-dry-run.living-architecture.pages.dev |
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||||
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @packages/riviere-cli/src/commands/extract/extract.spec.ts:
- Around line 370-444: The test "produces counts matching full extraction
component array length" uses an uncommon array clear pattern by assigning
ctx.consoleOutput.length = 0; change this to a more idiomatic clear (e.g.,
ctx.consoleOutput = [] or ctx.consoleOutput.splice(0)) in that spec to improve
clarity; additionally add a new unit test (e.g., "handles empty extraction
results") that sets up a config/path which yields zero components, runs
createProgram().parseAsync([... '--dry-run']), and asserts that
ctx.consoleOutput is empty or contains the expected "no results" message to
cover the edge case.
In @packages/riviere-cli/src/commands/extract/extract.ts:
- Around line 39-60: formatDryRunOutput builds countsByDomain as a Map but
iterates it in insertion order, causing non-deterministic domain output; to fix,
when producing lines iterate over the domains in sorted order (e.g., use
[...countsByDomain.entries()].sort(([domainA], [domainB]) =>
domainA.localeCompare(domainB)) or Array.from(countsByDomain.keys()).sort()) so
that the for-loop that currently reads "for (const [domain, typeCounts] of
countsByDomain)" instead processes domains alphabetically before formatting
typeStrings.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
packages/riviere-cli/docs/generated/cli-reference.mdis excluded by!**/generated/**
📒 Files selected for processing (2)
packages/riviere-cli/src/commands/extract/extract.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Follow eslint configuration rules defined in
eslint.config.mjsfor all linting
Files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
**/*.{ts,tsx,js,jsx,css,scss,html}
📄 CodeRabbit inference engine (CLAUDE.md)
All UI and UX design must conform to global brand guidelines in
/docs/brand/(logo, colors, typography, icons)
Files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx}: Do not log sensitive data (passwords, tokens, PII) in any code
Validate and sanitize all external input
Files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use cross-project imports with package names (e.g.,
import { X } from '@living-architecture/[pkg-name]') rather than relative paths
Files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
🧠 Learnings (22)
📓 Common learnings
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.ts:109-114
Timestamp: 2026-01-09T20:08:44.180Z
Learning: Applies to packages/riviere-cli/src/commands/extract/**/*.{ts,tsx} : CLI extraction commands should only catch and format expected validation errors as structured JSON. System-level exceptions (disk I/O failures, OOM, AST parse errors) should fail loudly with stack traces for debugging rather than being wrapped in try-catch and converted to JSON errors. This follows the fail-fast principle: validate inputs explicitly, then let unexpected failures surface clearly.
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Implement extraction logic as pure functions with no side effects
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement unit tests for each predicate type in isolation with positive and negative cases
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-09T20:08:44.180Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.ts:109-114
Timestamp: 2026-01-09T20:08:44.180Z
Learning: In packages/riviere-cli/src/commands/extract/**/*.{ts,tsx}, CLI extraction commands should only catch and format expected validation errors as structured JSON. Do not wrap or convert system-level exceptions (e.g., disk I/O failures, OOM, AST parse errors) into JSON errors; instead, fail loudly with stack traces to aid debugging. Follow fail-fast principles: validate inputs explicitly, and surface unexpected failures clearly.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Implement extraction logic as pure functions with no side effects
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Import and use the default extraction config from `living-architecture/riviere-extract-conventions/default-config` in extraction tooling to detect all 6 component types
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use the Rivière Builder Node.js library to programmatically construct the schema graph when implementing custom extraction code
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use glob pattern matching for module-based organization of extraction rules
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Reject invalid extraction configs at load time, not during extraction phase
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Applies to packages/riviere-extract-config/**/*.ts : Extraction config schema is the source of truth for valid structures. TypeScript types must mirror the schema definition to maintain consistency
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: All extraction rules should come from validated ExtractionConfig provided by riviere-extract-config
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement unit tests for each predicate type in isolation with positive and negative cases
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Use ts-morph's in-memory file system (`useInMemoryFileSystem: true`) for fast isolated tests
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T06:46:00.609Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 66
File: packages/riviere-extract-conventions/src/eslint/require-component-decorator.spec.ts:19-21
Timestamp: 2026-01-08T06:46:00.609Z
Learning: In test files using typescript-eslint/rule-tester's RuleTester.run(), ensure there is an explicit it() block with at least one expect() assertion (e.g., expect(rule).toBeDefined()) to satisfy sonarjs/no-empty-test-file and sonarjs/assertions-in-tests lint rules, which don’t recognize RuleTester's internal test blocks. Apply this pattern to all spec.ts test files to maintain consistency and pass lint checks.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : Test edge cases for collections: empty collections, single elements, duplicates, nested structures, circular references, large collections, and mixed types
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : Test domain-specific edge cases: valid email formats, URL protocols/ports, international phone numbers, Unicode addresses, currency rounding, percentages over 100%
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : One concept per test. Each test verifies one behavior. If you need 'and' in your test name, split it into separate tests
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : Test violated domain constraints: uniqueness violations, missing relationships, ordering violations, range breaches, state inconsistencies, format mismatches, and temporal ordering
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : Test edge cases for dates/times: leap years, daylight saving transitions, timezone boundaries, midnight, end of day, year boundaries, invalid dates, and epoch edge cases
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T08:54:09.466Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 96
File: apps/docs/.vitepress/theme/eclairLinkHandler.spec.ts:229-249
Timestamp: 2026-01-10T08:54:09.466Z
Learning: In jsdom test environments, window.location.assign cannot be spied on due to TypeError: Cannot redefine property. Use Object.defineProperty to mock the entire window.location object, replacing it with a controlled mock, and restore the original in afterEach. Ensure to clean up the mock after each test to avoid side effects.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-09T20:08:30.350Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.spec.ts:33-38
Timestamp: 2026-01-09T20:08:30.350Z
Learning: In test files, keep type guard implementations like isExtractionOutput(value: unknown): value is ExtractionOutput focused on narrowing types for TypeScript. Do not perform comprehensive runtime shape validation in type guards; rely on explicit test assertions (e.g., expect(result).toMatchObject(...)) for shape checks. This keeps type guards simple and rely on assertion-based tests for thorough validation.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
🧬 Code graph analysis (1)
packages/riviere-cli/src/commands/extract/extract.spec.ts (2)
packages/riviere-cli/src/command-test-fixtures.ts (3)
TestContext(62-66)createTestContext(68-74)setupCommandTest(76-93)packages/riviere-cli/src/cli.ts (1)
createProgram(44-78)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: main
- GitHub Check: Cloudflare Pages
🔇 Additional comments (8)
packages/riviere-cli/src/commands/extract/extract.spec.ts (4)
11-14: LGTM! Import addition supports test assertions.The
assertDefinedhelper is appropriately used in the count parity test to guard against undefined values during regex matching and dry-run output validation.
193-237: LGTM! Test validates single domain/single type dry-run output.The test correctly verifies the basic dry-run functionality: extracting a single useCase component and asserting the output format matches "orders: useCase(1)".
239-297: LGTM! Test validates multiple component types in dry-run output.The test correctly verifies alphabetical sorting of component types in the output format: "orders: api(1), useCase(2)".
299-368: LGTM! Test validates multi-domain dry-run output.The test correctly verifies separate breakdown per domain. Using
toContainfor each domain appropriately allows flexible ordering.packages/riviere-cli/src/commands/extract/extract.ts (4)
16-18: LGTM! Import additions support dry-run functionality.Adding
extractComponentsand theDraftComponenttype is necessary for the dry-run formatting logic. Follows the coding guideline to use cross-project imports with package names.
24-27: LGTM! Interface extension matches CLI option.The
dryRunoptional property appropriately captures the new--dry-runflag state.
82-82: LGTM! CLI option clearly describes dry-run behavior.The option description accurately conveys the dry-run mode's purpose: showing counts without full output.
143-149: LGTM! Early return prevents full JSON output in dry-run mode.The conditional logic correctly short-circuits to output only the dry-run summary when the flag is provided, aligning with the PR's acceptance criteria.
- Sort domains alphabetically in formatDryRunOutput for deterministic output - Use splice(0) instead of length = 0 for array clearing Addresses CodeRabbit feedback on PR #123 Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In @packages/riviere-cli/src/commands/extract/extract.spec.ts:
- Around line 189-445: Add a new test in the "dry-run mode" suite that creates
an empty src (or a module config that matches no files) and asserts the expected
dry-run behavior (decide and assert whether ctx.consoleOutput contains nothing
or a line like "domain: ... (0)" per project convention), referencing the same
test helpers (createProgram(), ctx.consoleOutput, setupCommandTest(ctx)) so it
runs with the other cases; and in the parity test that computes dryRunCount (the
test that uses parseExtractionOutput(), assertDefined(), and regex
match(/\((\d+)\)/g)), tighten the parsing by validating each parsed numeric
string converts to a finite number (e.g., check Number.isFinite(num) after
Number(num)) before summing and throw/assert if any parse yields NaN/Infinity to
avoid silently summing invalid values.
In @packages/riviere-cli/src/commands/extract/extract.ts:
- Around line 39-61: formatDryRunOutput uses localeCompare() which can vary by
environment; replace both uses (the domain sort at sortedDomains and the type
sort when building typeStrings) with a deterministic code-point comparator such
as (a, b) => (a < b ? -1 : a > b ? 1 : 0) so sorting is stable and
environment-independent — update the two .sort calls that currently use ([a],
[b]) => a.localeCompare(b) to use the code-point comparator instead.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
packages/riviere-cli/src/commands/extract/extract.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Follow eslint configuration rules defined in
eslint.config.mjsfor all linting
Files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
**/*.{ts,tsx,js,jsx,css,scss,html}
📄 CodeRabbit inference engine (CLAUDE.md)
All UI and UX design must conform to global brand guidelines in
/docs/brand/(logo, colors, typography, icons)
Files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx}: Do not log sensitive data (passwords, tokens, PII) in any code
Validate and sanitize all external input
Files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use cross-project imports with package names (e.g.,
import { X } from '@living-architecture/[pkg-name]') rather than relative paths
Files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
🧠 Learnings (28)
📓 Common learnings
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.ts:109-114
Timestamp: 2026-01-09T20:08:44.180Z
Learning: Applies to packages/riviere-cli/src/commands/extract/**/*.{ts,tsx} : CLI extraction commands should only catch and format expected validation errors as structured JSON. System-level exceptions (disk I/O failures, OOM, AST parse errors) should fail loudly with stack traces for debugging rather than being wrapped in try-catch and converted to JSON errors. This follows the fail-fast principle: validate inputs explicitly, then let unexpected failures surface clearly.
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Implement extraction logic as pure functions with no side effects
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement unit tests for each predicate type in isolation with positive and negative cases
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-09T20:08:44.180Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.ts:109-114
Timestamp: 2026-01-09T20:08:44.180Z
Learning: In packages/riviere-cli/src/commands/extract/**/*.{ts,tsx}, CLI extraction commands should only catch and format expected validation errors as structured JSON. Do not wrap or convert system-level exceptions (e.g., disk I/O failures, OOM, AST parse errors) into JSON errors; instead, fail loudly with stack traces to aid debugging. Follow fail-fast principles: validate inputs explicitly, and surface unexpected failures clearly.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Implement extraction logic as pure functions with no side effects
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Import and use the default extraction config from `living-architecture/riviere-extract-conventions/default-config` in extraction tooling to detect all 6 component types
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use glob pattern matching for module-based organization of extraction rules
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use the Rivière Builder Node.js library to programmatically construct the schema graph when implementing custom extraction code
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Reject invalid extraction configs at load time, not during extraction phase
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Applies to packages/riviere-extract-config/**/*.ts : Extraction config schema is the source of truth for valid structures. TypeScript types must mirror the schema definition to maintain consistency
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-07T08:54:48.071Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/workflow/code-review.md:0-0
Timestamp: 2026-01-07T08:54:48.071Z
Learning: Applies to docs/workflow/**/*.{ts,tsx,js,jsx} : Review usage of `/* v8 ignore next -- preserve */` coverage skip directives. This is only acceptable for unreachable code needed to satisfy the compiler. Most cases should be solved by extracting code or writing tests to mock behavior.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : Test domain-specific edge cases: valid email formats, URL protocols/ports, international phone numbers, Unicode addresses, currency rounding, percentages over 100%
Applied to files:
packages/riviere-cli/src/commands/extract/extract.tspackages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-07T08:54:48.071Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/workflow/code-review.md:0-0
Timestamp: 2026-01-07T08:54:48.071Z
Learning: Applies to docs/workflow/**/*.{ts,tsx,js,jsx,!(**/*.test.ts,**/*.test.tsx,**/*.test.js,**/*.spec.ts,**/*.spec.tsx,**/*.spec.js)} : All production code (not test files) must align with architecture boundaries and layering requirements as defined in @/docs/architecture/overview.md and @/docs/conventions/codebase-structure.md
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: All extraction rules should come from validated ExtractionConfig provided by riviere-extract-config
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement unit tests for each predicate type in isolation with positive and negative cases
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Use ts-morph's in-memory file system (`useInMemoryFileSystem: true`) for fast isolated tests
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : Test edge cases for collections: empty collections, single elements, duplicates, nested structures, circular references, large collections, and mixed types
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : Test edge cases for strings: empty string, whitespace only, very long strings, Unicode/emojis, special characters, SQL/HTML injection patterns, and case sensitivity
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-09T20:08:30.350Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.spec.ts:33-38
Timestamp: 2026-01-09T20:08:30.350Z
Learning: In test files, keep type guard implementations like isExtractionOutput(value: unknown): value is ExtractionOutput focused on narrowing types for TypeScript. Do not perform comprehensive runtime shape validation in type guards; rely on explicit test assertions (e.g., expect(result).toMatchObject(...)) for shape checks. This keeps type guards simple and rely on assertion-based tests for thorough validation.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : Test edge cases for null and undefined: null input, undefined input, missing optional properties, and explicit undefined vs missing key
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-07T23:24:27.966Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/anti-patterns.md:0-0
Timestamp: 2026-01-07T23:24:27.966Z
Learning: Never sacrifice readability to satisfy linting rules or file length limits. When hitting max-lines limits, refactor by extracting duplicated code into shared modules, extracting test fixtures into shared fixtures, using `it.each` or `describe.each` for parameterized tests, or splitting into multiple focused files
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/vitest.config.mts : Enforce 100% code coverage using Vitest with v8 coverage and thresholds configured in vitest.config.mts
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T12:57:19.167Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 67
File: packages/riviere-extract-ts/tsconfig.spec.json:5-22
Timestamp: 2026-01-08T12:57:19.167Z
Learning: In tsconfig.spec.json files, use expanded types array ["vitest/globals", "vitest/importMeta", "vite/client", "node", "vitest"] for complete test type coverage. Include patterns should cover .test and .spec files, config files (vitest.config.ts/mts, vite.config.ts/mts), multiple extensions (.ts, .tsx, .js, .jsx), and .d.ts files to ensure proper TypeScript coverage across the testing environment.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-08T06:46:00.609Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 66
File: packages/riviere-extract-conventions/src/eslint/require-component-decorator.spec.ts:19-21
Timestamp: 2026-01-08T06:46:00.609Z
Learning: In test files using typescript-eslint/rule-tester's RuleTester.run(), ensure there is an explicit it() block with at least one expect() assertion (e.g., expect(rule).toBeDefined()) to satisfy sonarjs/no-empty-test-file and sonarjs/assertions-in-tests lint rules, which don’t recognize RuleTester's internal test blocks. Apply this pattern to all spec.ts test files to maintain consistency and pass lint checks.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : One concept per test. Each test verifies one behavior. If you need 'and' in your test name, split it into separate tests
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : Test violated domain constraints: uniqueness violations, missing relationships, ordering violations, range breaches, state inconsistencies, format mismatches, and temporal ordering
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
📚 Learning: 2026-01-10T08:54:09.466Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 96
File: apps/docs/.vitepress/theme/eclairLinkHandler.spec.ts:229-249
Timestamp: 2026-01-10T08:54:09.466Z
Learning: In jsdom test environments, window.location.assign cannot be spied on due to TypeError: Cannot redefine property. Use Object.defineProperty to mock the entire window.location object, replacing it with a controlled mock, and restore the original in afterEach. Ensure to clean up the mock after each test to avoid side effects.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.spec.ts
🧬 Code graph analysis (1)
packages/riviere-cli/src/commands/extract/extract.spec.ts (1)
packages/riviere-cli/src/command-test-fixtures.ts (3)
TestContext(62-66)createTestContext(68-74)setupCommandTest(76-93)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (5)
packages/riviere-cli/src/commands/extract/extract.spec.ts (1)
11-15: Good addition:assertDefinedreduces null/undefined noise in tests.packages/riviere-cli/src/commands/extract/extract.ts (4)
24-27:ExtractOptions.dryRun?: booleanis the right shape for Commander.
83-83: CLI option wiring for--dry-runis clear and discoverable.
144-150: Dry-run short-circuit preserves fail-fast behavior for unexpected exceptions.
You’re not wrapping the extraction path in broad try/catch, so disk/AST/system failures still surface loudly with stack traces (aligned with CLI learnings). Based on learnings, packages/riviere-cli/src/commands/extract/extract.ts:109-114.
16-18: No action needed.DraftComponentis properly exported from@living-architecture/riviere-extract-ts(defined inextractor.tsline 17, re-exported inindex.tslines 2-3) and the CLI import is correct. Both the export and import were added together in this change set, ensuring consistency.
Move dry-run mode tests to dedicated test file to keep each file under the 400-line limit. Add empty extraction edge case test. Co-Authored-By: Claude Opus 4.5 <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts:
- Around line 322-354: Replace the locally redefined DraftComponent with the
exported type from the extract package: remove the local DraftComponent
interface and add an import for it from
'@living-architecture/riviere-extract-ts' (use "import { type DraftComponent }
from '@living-architecture/riviere-extract-ts'"); keep the test-local
ExtractionOutput, and ensure isExtractionOutput and parseExtractionOutput still
reference DraftComponent via the imported type so type guards and parsing
behavior remain unchanged.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Follow eslint configuration rules defined in
eslint.config.mjsfor all linting
Files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
**/*.{ts,tsx,js,jsx,css,scss,html}
📄 CodeRabbit inference engine (CLAUDE.md)
All UI and UX design must conform to global brand guidelines in
/docs/brand/(logo, colors, typography, icons)
Files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx}: Do not log sensitive data (passwords, tokens, PII) in any code
Validate and sanitize all external input
Files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use cross-project imports with package names (e.g.,
import { X } from '@living-architecture/[pkg-name]') rather than relative paths
Files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.ts:109-114
Timestamp: 2026-01-09T20:08:44.180Z
Learning: Applies to packages/riviere-cli/src/commands/extract/**/*.{ts,tsx} : CLI extraction commands should only catch and format expected validation errors as structured JSON. System-level exceptions (disk I/O failures, OOM, AST parse errors) should fail loudly with stack traces for debugging rather than being wrapped in try-catch and converted to JSON errors. This follows the fail-fast principle: validate inputs explicitly, then let unexpected failures surface clearly.
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Implement extraction logic as pure functions with no side effects
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement unit tests for each predicate type in isolation with positive and negative cases
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement unit tests for each predicate type in isolation with positive and negative cases
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Use ts-morph's in-memory file system (`useInMemoryFileSystem: true`) for fast isolated tests
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-09T20:08:44.180Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.ts:109-114
Timestamp: 2026-01-09T20:08:44.180Z
Learning: In packages/riviere-cli/src/commands/extract/**/*.{ts,tsx}, CLI extraction commands should only catch and format expected validation errors as structured JSON. Do not wrap or convert system-level exceptions (e.g., disk I/O failures, OOM, AST parse errors) into JSON errors; instead, fail loudly with stack traces to aid debugging. Follow fail-fast principles: validate inputs explicitly, and surface unexpected failures clearly.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Implement extraction logic as pure functions with no side effects
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use glob pattern matching for module-based organization of extraction rules
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Applies to packages/riviere-extract-config/**/*.ts : Extraction config schema is the source of truth for valid structures. TypeScript types must mirror the schema definition to maintain consistency
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Reject invalid extraction configs at load time, not during extraction phase
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-09T20:08:30.350Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.spec.ts:33-38
Timestamp: 2026-01-09T20:08:30.350Z
Learning: In test files, keep type guard implementations like isExtractionOutput(value: unknown): value is ExtractionOutput focused on narrowing types for TypeScript. Do not perform comprehensive runtime shape validation in type guards; rely on explicit test assertions (e.g., expect(result).toMatchObject(...)) for shape checks. This keeps type guards simple and rely on assertion-based tests for thorough validation.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T06:46:00.609Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 66
File: packages/riviere-extract-conventions/src/eslint/require-component-decorator.spec.ts:19-21
Timestamp: 2026-01-08T06:46:00.609Z
Learning: In test files using typescript-eslint/rule-tester's RuleTester.run(), ensure there is an explicit it() block with at least one expect() assertion (e.g., expect(rule).toBeDefined()) to satisfy sonarjs/no-empty-test-file and sonarjs/assertions-in-tests lint rules, which don’t recognize RuleTester's internal test blocks. Apply this pattern to all spec.ts test files to maintain consistency and pass lint checks.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-10T08:54:09.466Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 96
File: apps/docs/.vitepress/theme/eclairLinkHandler.spec.ts:229-249
Timestamp: 2026-01-10T08:54:09.466Z
Learning: In jsdom test environments, window.location.assign cannot be spied on due to TypeError: Cannot redefine property. Use Object.defineProperty to mock the entire window.location object, replacing it with a controlled mock, and restore the original in afterEach. Ensure to clean up the mock after each test to avoid side effects.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: main
- GitHub Check: Cloudflare Pages
🔇 Additional comments (3)
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts (3)
1-12: LGTM!The imports are well-organized and follow Node.js conventions with the
node:protocol.
195-269: Verify test isolation with console output mutation.This test clears
ctx.consoleOutputbetween extraction runs (line 247) to isolate the two command invocations. Ensure the test fixture properly resets state between tests to avoid cross-test contamination.The count aggregation logic is sound and effectively validates that dry-run counts match full extraction.
18-193: LGTM!The test cases comprehensively cover the dry-run functionality across various scenarios: single/multiple types, single/multiple domains, and empty extraction. The test structure is consistent and assertions are clear.
Also applies to: 271-319
- Replace localeCompare() with code-point comparator for deterministic sorting - Import DraftComponent from riviere-extract-ts instead of redefining locally Co-Authored-By: Claude Opus 4.5 <[email protected]>
…dry-run-mode-to-ex
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In @packages/riviere-cli/src/commands/extract/extract.ts:
- Around line 47-69: The nested Map initialization in formatDryRunOutput can be
simplified: instead of separately getting existingTypeCounts, creating
typeCounts, and conditionally setting it, ensure countsByDomain has a Map for
component.domain by using a single lookup-or-create pattern (e.g., retrieve
countsByDomain.get(component.domain) and if falsy create and set a new Map) and
then operate on that Map; update the loop that builds countsByDomain in
formatDryRunOutput to use this simplified initialization so typeCounts is always
a Map when incrementing the count for component.type.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{js,ts,jsx,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Follow eslint configuration rules defined in
eslint.config.mjsfor all linting
Files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
**/*.{ts,tsx,js,jsx,css,scss,html}
📄 CodeRabbit inference engine (CLAUDE.md)
All UI and UX design must conform to global brand guidelines in
/docs/brand/(logo, colors, typography, icons)
Files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx,js,jsx}: Do not log sensitive data (passwords, tokens, PII) in any code
Validate and sanitize all external input
Files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
Use cross-project imports with package names (e.g.,
import { X } from '@living-architecture/[pkg-name]') rather than relative paths
Files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
🧠 Learnings (25)
📓 Common learnings
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.ts:109-114
Timestamp: 2026-01-09T20:08:44.180Z
Learning: Applies to packages/riviere-cli/src/commands/extract/**/*.{ts,tsx} : CLI extraction commands should only catch and format expected validation errors as structured JSON. System-level exceptions (disk I/O failures, OOM, AST parse errors) should fail loudly with stack traces for debugging rather than being wrapped in try-catch and converted to JSON errors. This follows the fail-fast principle: validate inputs explicitly, then let unexpected failures surface clearly.
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Implement extraction logic as pure functions with no side effects
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement unit tests for each predicate type in isolation with positive and negative cases
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use glob pattern matching for module-based organization of extraction rules
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Use ts-morph's in-memory file system (`useInMemoryFileSystem: true`) for fast isolated tests
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement integration tests for end-to-end extraction from TypeScript code to JSON output
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Implement unit tests for each predicate type in isolation with positive and negative cases
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.test.{ts,tsx} : Use ts-morph's in-memory file system (`useInMemoryFileSystem: true`) for fast isolated tests
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-09T20:08:44.180Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.ts:109-114
Timestamp: 2026-01-09T20:08:44.180Z
Learning: In packages/riviere-cli/src/commands/extract/**/*.{ts,tsx}, CLI extraction commands should only catch and format expected validation errors as structured JSON. Do not wrap or convert system-level exceptions (e.g., disk I/O failures, OOM, AST parse errors) into JSON errors; instead, fail loudly with stack traces to aid debugging. Follow fail-fast principles: validate inputs explicitly, and surface unexpected failures clearly.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Implement extraction logic as pure functions with no side effects
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use `living-architecture/riviere-extract-ts` TypeScript extractor with ts-morph for AST parsing when implementing TypeScript extraction for architecture schema components
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Reject invalid extraction configs at load time, not during extraction phase
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: Applies to packages/riviere-extract-ts/**/*.{ts,tsx} : Use glob pattern matching for module-based organization of extraction rules
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.{json,ts} : Define extraction configuration using the JSON Schema from `living-architecture/riviere-extract-config` DSL
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-06T23:01:34.751Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-config/CLAUDE.md:0-0
Timestamp: 2026-01-06T23:01:34.751Z
Learning: Applies to packages/riviere-extract-config/**/*.ts : Extraction config schema is the source of truth for valid structures. TypeScript types must mirror the schema definition to maintain consistency
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.tspackages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Applies to packages/riviere-extract-conventions/**/*.ts : Use `Custom(type)` decorator to annotate components with custom types not covered by standard decorators
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T19:36:17.306Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/codebase-structure.md:0-0
Timestamp: 2026-01-08T19:36:17.306Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Use living-architecture/[pkg-name] for imports from other workspace projects, not relative paths like ../../packages/[pkg-name].
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*.{ts,tsx} : Apply decorators from `living-architecture/riviere-extract-conventions` to mark all classes as architectural components
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-09T20:08:30.350Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 88
File: packages/riviere-cli/src/commands/extract/extract.spec.ts:33-38
Timestamp: 2026-01-09T20:08:30.350Z
Learning: In test files, keep type guard implementations like isExtractionOutput(value: unknown): value is ExtractionOutput focused on narrowing types for TypeScript. Do not perform comprehensive runtime shape validation in type guards; rely on explicit test assertions (e.g., expect(result).toMatchObject(...)) for shape checks. This keeps type guards simple and rely on assertion-based tests for thorough validation.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T06:46:00.609Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 66
File: packages/riviere-extract-conventions/src/eslint/require-component-decorator.spec.ts:19-21
Timestamp: 2026-01-08T06:46:00.609Z
Learning: In test files using typescript-eslint/rule-tester's RuleTester.run(), ensure there is an explicit it() block with at least one expect() assertion (e.g., expect(rule).toBeDefined()) to satisfy sonarjs/no-empty-test-file and sonarjs/assertions-in-tests lint rules, which don’t recognize RuleTester's internal test blocks. Apply this pattern to all spec.ts test files to maintain consistency and pass lint checks.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-10T08:54:09.466Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 96
File: apps/docs/.vitepress/theme/eclairLinkHandler.spec.ts:229-249
Timestamp: 2026-01-10T08:54:09.466Z
Learning: In jsdom test environments, window.location.assign cannot be spied on due to TypeError: Cannot redefine property. Use Object.defineProperty to mock the entire window.location object, replacing it with a controlled mock, and restore the original in afterEach. Ensure to clean up the mock after each test to avoid side effects.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts
📚 Learning: 2026-01-08T07:05:01.766Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-conventions/CLAUDE.md:0-0
Timestamp: 2026-01-08T07:05:01.766Z
Learning: Import and use the default extraction config from `living-architecture/riviere-extract-conventions/default-config` in extraction tooling to detect all 6 component types
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T22:20:13.250Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/architecture/overview.md:0-0
Timestamp: 2026-01-08T22:20:13.250Z
Learning: Applies to docs/architecture/**/*extract*.ts : Use the Rivière Builder Node.js library to programmatically construct the schema graph when implementing custom extraction code
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-07T08:54:48.071Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/workflow/code-review.md:0-0
Timestamp: 2026-01-07T08:54:48.071Z
Learning: Applies to docs/workflow/**/*.{ts,tsx,js,jsx,!(**/*.test.ts,**/*.test.tsx,**/*.test.js,**/*.spec.ts,**/*.spec.tsx,**/*.spec.js)} : All production code (not test files) must align with architecture boundaries and layering requirements as defined in @/docs/architecture/overview.md and @/docs/conventions/codebase-structure.md
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-07T08:54:48.071Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/workflow/code-review.md:0-0
Timestamp: 2026-01-07T08:54:48.071Z
Learning: Applies to docs/workflow/**/*.{ts,tsx,js,jsx} : Review usage of `/* v8 ignore next -- preserve */` coverage skip directives. This is only acceptable for unreachable code needed to satisfy the compiler. Most cases should be solved by extracting code or writing tests to mock behavior.
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : Test domain-specific edge cases: valid email formats, URL protocols/ports, international phone numbers, Unicode addresses, currency rounding, percentages over 100%
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : Test violated domain constraints: uniqueness violations, missing relationships, ordering violations, range breaches, state inconsistencies, format mismatches, and temporal ordering
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-10T10:14:32.627Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-10T10:14:32.627Z
Learning: Applies to docs/conventions/**/*.{spec,test}.{ts,tsx,js,jsx} : Test edge cases for dates/times: leap years, daylight saving transitions, timezone boundaries, midnight, end of day, year boundaries, invalid dates, and epoch edge cases
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
📚 Learning: 2026-01-08T17:19:17.148Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: packages/riviere-extract-ts/CLAUDE.md:0-0
Timestamp: 2026-01-08T17:19:17.148Z
Learning: All extraction rules should come from validated ExtractionConfig provided by riviere-extract-config
Applied to files:
packages/riviere-cli/src/commands/extract/extract.ts
🧬 Code graph analysis (1)
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts (2)
packages/riviere-cli/src/command-test-fixtures.ts (3)
TestContext(62-66)createTestContext(68-74)setupCommandTest(76-93)packages/riviere-cli/src/cli.ts (1)
createProgram(44-78)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: main
- GitHub Check: Cloudflare Pages
🔇 Additional comments (12)
packages/riviere-cli/src/commands/extract/extract.ts (5)
16-18: LGTM!The import correctly adds
DraftComponenttype following the cross-project import guidelines.
24-27: LGTM!The optional
dryRunfield properly extends the interface to support the new flag.
39-45: LGTM!The code-point comparator ensures deterministic sorting, addressing the requirement for deterministic dry-run output. The v8 ignore directive is appropriate for this trivial comparison utility.
91-91: LGTM!The CLI option is properly documented and follows Commander.js conventions.
152-158: LGTM!The conditional dry-run path correctly short-circuits to emit formatted summary output instead of full JSON, meeting the acceptance criteria. The early return prevents any unintended side effects.
packages/riviere-cli/src/commands/extract/extract.dry-run.spec.ts (7)
1-14: LGTM!Imports are clean and follow cross-project import guidelines. The test setup properly uses the shared test fixtures.
19-63: LGTM!This test correctly validates the basic dry-run output format for a single domain and component type. The test setup, execution, and assertion are clear and focused.
65-123: LGTM!This test properly verifies that multiple component types within a single domain are aggregated and formatted correctly, with types sorted as expected (
api(1), useCase(2)).
125-194: LGTM!This test effectively validates that multiple domains produce separate output lines, meeting the multi-domain acceptance criterion.
196-270: Excellent verification of count parity.This test cleverly validates the critical acceptance criterion that "dry-run counts must match counts from full extraction" by:
- Running full extraction and counting components
- Running dry-run and parsing count patterns
- Asserting the totals match
This ensures the dry-run summary is accurate and not just cosmetic.
272-320: LGTM!This test properly verifies the edge case where no components are extracted, ensuring no output is produced. This prevents confusing empty domain lines.
323-345: LGTM!The helper functions follow the established learning to keep type guards minimal and focused on type narrowing rather than comprehensive validation. The
parseExtractionOutputfunction provides clear error messages for debugging.Based on learnings: Type guards are kept simple and focused on type narrowing, with validation delegated to test assertions.



User description
Closes #45
Summary
--dry-runflag toriviere extractcommandformatDryRunOutputfunction that aggregates extracted components by domain and typedomain: Type(count), Type(count)(e.g.,orders: api(1), useCase(2))Test plan
🤖 Generated with Claude Code
PR Type
Enhancement, Tests
Description
Added
--dry-runflag toriviere extractcommand for preview modeImplemented
formatDryRunOutputfunction aggregating components by domain and typeOutput format displays domain with component counts:
domain: Type(count), Type(count)Added 4 comprehensive tests covering single/multiple domains and type combinations
Updated CLI documentation with new
--dry-runoptionDiagram Walkthrough
File Walkthrough
extract.ts
Implement dry-run mode with component count aggregationpackages/riviere-cli/src/commands/extract/extract.ts
dryRunoptional property toExtractOptionsinterfaceformatDryRunOutputfunction that aggregates extractedcomponents by domain and type, returning formatted strings
--dry-runoption to command definitionprovided, bypassing normal JSON output
DraftComponenttype from extraction libraryextract.spec.ts
Add comprehensive dry-run mode test coveragepackages/riviere-cli/src/commands/extract/extract.spec.ts
assertDefinedimport to test fixturesdomains, and count verification
parseExtractionOutputfor parsing fullextraction output
cli-reference.md
Document dry-run flag in CLI referencepackages/riviere-cli/docs/generated/cli-reference.md
--dry-runflag with description "Show component counts perdomain without full output"
Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.