Skip to content

feat(extract-ts): implement all metadata extraction rules - #181

Merged
NTCoding merged 6 commits into
mainfrom
issue-165-m2-implement-all-metadata-extr
Jan 27, 2026
Merged

NTCoding merged 6 commits into
mainfrom
issue-165-m2-implement-all-metadata-extr

Conversation

@NTCoding

@NTCoding NTCoding commented Jan 15, 2026 •

Copy link
Copy Markdown
Owner

Closes #165

Summary

  • Implement all 15 extraction rules for Phase 11 metadata extraction
  • Add 6 transform functions (stripSuffix, stripPrefix, toLowerCase, toUpperCase, kebabToPascal, pascalToKebab)
  • Add literal detection with proper error handling for non-literal values
  • Fix edge cases: out-of-bounds parameter position throws ExtractionError, pascalToKebab handles non-PascalCase

Test plan

  • 175 unit tests covering all extraction rules
  • 100% code coverage verified
  • Edge cases from task specification all covered
  • Verify gate passes (lint, typecheck, test)

Closes #165

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added TypeScript extraction capabilities for class/method/constructor/parameter/generic/decorator/property/file-path metadata and string transformation utilities.
  • Documentation

    • Fixed typo in Zod guidance.
    • Added guidance on using discriminated unions for mixed primitive return types.
  • Tests

    • Added comprehensive test coverage for extraction logic and transformation utilities.

✏️ Tip: You can customize this high-level summary in your review settings.

NTCoding and others added 2 commits January 15, 2026 22:04
Add 15 extraction rules + 6 transforms for Phase 11 metadata extraction:
- Transforms: stripSuffix, stripPrefix, toLowerCase, toUpperCase, kebabToPascal, pascalToKebab
- Literal detection: extractLiteralValue, isLiteralValue with error handling
- Rules: literal, fromClassName, fromMethodName, fromFilePath, fromProperty
- Rules: fromDecoratorArg (positional/named), fromDecoratorName (with mapping)
- Rules: fromGenericArg, fromMethodSignature, fromConstructorParams, fromParameterType

172 tests, 100% coverage across all rule implementations.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Throw ExtractionError when fromParameterType position is out of bounds
  (previously returned 'unknown' silently, inconsistent with other rules)
- Fix pascalToKebab to handle non-PascalCase input gracefully
  (only slice leading hyphen if present, prevents corrupting camelCase)
- Add tests for both edge cases

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Jan 15, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@NTCoding has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 39 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 451b3dd and c099b08.

📒 Files selected for processing (2)
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds a complete extraction-rules implementation and test coverage: literal detection, property/method/class/decorator/generic extraction, string transforms, error types, and public re-exports for the riviere-extract-ts package. (No public API removals.)

Changes

Cohort / File(s) Summary
Documentation
docs/conventions/standard-patterns.md
Typo fix ("brnaded" → "branded") and new section "Discriminated Unions for Mixed Return Types" with examples and rationale.
Core evaluator
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
New evaluators for literal, class name, method name, file path, property, decorator-arg and decorator-name rules; defines ExtractionContext/ExtractionValue/ExtractionResult and error reporting with file/line.
Generic & decorator evaluators
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts, packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
New generic-arg evaluator extracting concrete generic type arguments (including unions, inherited interfaces, position checks) and expanded decorator-arg/name tests.
Method-related evaluators
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts, .../evaluate-extraction-rule-method.spec.ts
Implementations and tests for method signature extraction, constructor params, and parameter-type extraction (with transforms and bounds checks).
Literal detection
packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts, .../literal-detection.spec.ts
New ExtractionError/TestFixtureError, isLiteralValue, extractLiteralValue; rejects non-literals with location-aware errors and tests covering enums, templates, calls, etc.
Transforms
packages/riviere-extract-ts/src/extraction-rules/transforms.ts, .../transforms.spec.ts
New string transforms (stripPrefix/suffix, case conversions, kebab↔pascal) and applyTransforms orchestrator with ordered composition; tests for each transform and combinations.
Re-exports / public API
packages/riviere-extract-ts/src/extraction-rules/index.ts, packages/riviere-extract-ts/src/index.ts
Aggregate exports added for all evaluators, transform utilities, error types, and new types (ExtractionContext, ExtractionResult, ParameterInfo, MethodSignature).
Test coverage
packages/riviere-extract-ts/src/extraction-rules/*.spec.ts
Extensive unit tests added across evaluators, literal detection, and transforms (multiple new spec files covering positive and error paths).

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰
I hopped through ASTs, twitching my nose,
Pulled out types where metadata grows.
Decorators bowed, generics unfurled,
Transforms danced and trimmed the world.
Tiny rabbit, big extraction—hooray I chose!

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(extract-ts): implement all metadata extraction rules' directly and clearly summarizes the main change—implementing all 15 metadata extraction rules for the riviere-extract-ts package.
Linked Issues check ✅ Passed All 15 metadata extraction rules from issue #165 are implemented (literal, fromClassName, fromMethodName, fromFilePath, fromProperty, fromDecoratorArg, fromDecoratorName, fromGenericArg, fromMethodSignature, fromConstructorParams, fromParameterType), all 6 transforms are provided (stripSuffix, stripPrefix, toLowerCase, toUpperCase, kebabToPascal, pascalToKebab), non-literal detection with error handling is included, property inheritance is resolved, generic arguments extract as arrays, and comprehensive test coverage is demonstrated.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the 15 metadata extraction rules and supporting infrastructure. One minor documentation fix (typographical error in standard-patterns.md) is tangentially related but not core to the extraction rules feature.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

165 - Partially compliant

Compliant requirements:

  • Property rules: fromProperty (static/instance), fromClassName, fromMethodName, literal
  • Decorator rules: fromDecoratorArg (positional/named), fromDecoratorName (with mapping)
  • Type rules: fromMethodSignature, fromConstructorParams, fromParameterType, fromGenericArg
  • Path rules: fromFilePath with regex capture groups
  • Transforms: stripSuffix, stripPrefix, toLowerCase, toUpperCase, kebabToPascal, pascalToKebab
  • Non-literal values fail extraction with a clear message including location (via ExtractionError)
  • Property inheritance chains resolved (static property lookup through base class)
  • Generic arguments extract as arrays (union types become multiple entries)
  • Extensive unit tests added for rules and transforms

Non-compliant requirements:

  • Config validation at extraction time: missing required fields → exit 1
  • 100% test coverage on all rules

Requires further human verification:

  • Transforms execute top-to-bottom in YAML order (needs verification that YAML parsing preserves key insertion order all the way into runtime objects)
  • Multiple decorators match rule → first decorator (top-to-bottom in source) wins (not assessable from shown diffs; depends on caller selection logic)
  • Property rules missing property → strict fail vs lenient _missing behavior (only strict-fail is visible here; verify intended mode support exists elsewhere)
  • 100% test coverage verified (requires running coverage tooling / CI artifacts)
  • Integration: extract from sample TypeScript files (not shown in diff)
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Validation

evaluateFromDecoratorArgRule falls back to extractNamedArg when position is undefined, passing name ?? ''. This means a rule missing both position and name will produce a generic “Property '' not found…” style error rather than a clear config validation error (“neither position nor name provided”). Add an explicit guard that throws ExtractionError when both are missing to match the ticket’s fail-fast/clear-message requirement.

export function evaluateFromDecoratorArgRule(
  rule: FromDecoratorArgExtractionRule,
  decorator: Decorator,
): ExtractionResult {
  const {
    position, name, transform 
  } = rule.fromDecoratorArg

  const value =
    position === undefined
      ? extractNamedArg(decorator, name ?? '')
      : extractPositionalArg(decorator, position)
Spec Risk

applyTransforms claims “top-to-bottom in YAML order”, but runtime ordering relies on JS object key insertion order. Ensure transform order is explicitly represented (e.g., array of operations) or proven stable through the YAML parsing/validation pipeline; otherwise transform application order may differ from the YAML authoring order.

export function applyTransforms(value: string, transform: Transform): string {
  const transformers: TransformFn[] = []

  if (transform.stripSuffix !== undefined) {
    const suffix = transform.stripSuffix
    transformers.push((v) => stripSuffix(v, suffix))
  }
  if (transform.stripPrefix !== undefined) {
    const prefix = transform.stripPrefix
    transformers.push((v) => stripPrefix(v, prefix))
  }
  if (transform.toLowerCase === true) {
    transformers.push(toLowerCase)
  }
  if (transform.toUpperCase === true) {
    transformers.push(toUpperCase)
  }
  if (transform.kebabToPascal === true) {
    transformers.push(kebabToPascal)
  }
  if (transform.pascalToKebab === true) {
    transformers.push(pascalToKebab)
  }

  return transformers.reduce((acc, fn) => fn(acc), value)
}
Correctness

extractPositionalArg and extractNamedArg only accept SyntaxKind.StringLiteral. In TS AST, string-like values can also appear as NoSubstitutionTemplateLiteral (e.g., `foo` without interpolations). If those should be treated as “non-literal” per requirements, current behavior is OK but the error message may be misleading; if they should be allowed as literals, support should be added consistently with extractLiteralValue.

function extractPositionalArg(decorator: Decorator, position: number): string {
  const args = decorator.getArguments()
  const location = getDecoratorLocation(decorator)

  if (args.length === 0) {
    throw new ExtractionError(
      `Decorator '@${decorator.getName()}' has no arguments`,
      location.filePath,
      location.line,
    )
  }

  const arg = args[position]
  if (arg === undefined) {
    throw new ExtractionError(
      `Argument position ${position} out of bounds. Decorator has ${args.length} argument(s)`,
      location.filePath,
      location.line,
    )
  }

  if (arg.getKind() !== SyntaxKind.StringLiteral) {
    throw new ExtractionError(
      `Expected string literal at position ${position}, got ${arg.getKindName()}`,
      location.filePath,
      location.line,
    )
  }

  const text = arg.getText()
  return text.slice(1, -1)
}

function throwNoArguments(decorator: Decorator, location: DecoratorLocation): never {
  throw new ExtractionError(
    `Decorator '@${decorator.getName()}' has no arguments`,
    location.filePath,
    location.line,
  )
}

function getFirstArgument(
  decorator: Decorator,
  location: DecoratorLocation,
): import('ts-morph').Node {
  const args = decorator.getArguments()
  const firstArg = args[0]
  if (firstArg === undefined) {
    throwNoArguments(decorator, location)
  }
  return firstArg
}

function extractNamedArg(decorator: Decorator, name: string): string {
  const location = getDecoratorLocation(decorator)
  const firstArg = getFirstArgument(decorator, location)

  if (firstArg.getKind() !== SyntaxKind.ObjectLiteralExpression) {
    throw new ExtractionError(
      `Expected object literal argument, got ${firstArg.getKindName()}`,
      location.filePath,
      location.line,
    )
  }

  const objectLiteral = firstArg.asKindOrThrow(SyntaxKind.ObjectLiteralExpression)
  const property = objectLiteral.getProperty(name)

  if (property === undefined) {
    throw new ExtractionError(
      `Property '${name}' not found in decorator argument`,
      location.filePath,
      location.line,
    )
  }

  if (!('getInitializer' in property)) {
    throw new ExtractionError(
      `Property '${name}' has no initializer`,
      location.filePath,
      location.line,
    )
  }

  const initializer = property.getInitializer()
  if (initializer?.getKind() !== SyntaxKind.StringLiteral) {
    throw new ExtractionError(
      `Expected string literal for property '${name}'`,
      location.filePath,
      location.line,
    )
  }

  const text = initializer.getText()
  return text.slice(1, -1)
}

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jan 15, 2026 •

Copy link
Copy Markdown

Deploying living-architecture with  Cloudflare Pages  Cloudflare Pages

Latest commit: c099b08
Status: ✅  Deploy successful!
Preview URL: https://3207eb86.living-architecture.pages.dev
Branch Preview URL: https://issue-165-m2-implement-all-m.living-architecture.pages.dev

View logs

Comment thread packages/riviere-extract-ts/src/extraction-rules/transforms.ts
NTCoding and others added 2 commits January 15, 2026 22:13
Export all extraction rule functions and types from the package's
public API. Remove internal utilities from public exports.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
- Use getLiteralValue() instead of manual string slicing for proper
  handling of escape sequences in string literals
- Add base class search for interface type arguments (inheritance chain)
- Add test for interface inheritance scenario

Co-Authored-By: Claude Opus 4.5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🤖 Fix all issues with AI agents
In `@docs/conventions/standard-patterns.md`:
- Line 7: Update the phrase "battle tested" to the hyphenated compound adjective
"battle-tested" in the documentation text (search for the exact string "battle
tested" in docs/conventions/standard-patterns.md) so the wording follows the
compound-adjective convention; ensure you only change the wording and preserve
surrounding punctuation and formatting.

In
`@packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts`:
- Around line 59-131: Update the three tests that currently only assert the
error type to also assert the error message: in the test titled "throws
ExtractionError when interface not found" (which calls
evaluateFromGenericArgRule with interface: 'IEventHandler') change the
expectation to check the thrown message mentions the missing interface (e.g.,
.toThrow(/IEventHandler/)); in "throws ExtractionError when position out of
bounds" assert the message indicates the position is out of bounds (e.g.,
.toThrow(/position|out of bounds/i|Position/)); and in "throws ExtractionError
when generic arg is type parameter T" assert the message indicates the generic
argument is a type parameter (e.g., .toThrow(/type parameter|generic arg/i/)).
Keep using evaluateFromGenericArgRule and ExtractionError as the thrown type
while adding the message regex/assertion to each expect.

In
`@packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts`:
- Around line 144-181: Add a test inside the
describe('evaluateFromConstructorParamsRule') block that creates a classDecl
with a constructor parameter lacking a type annotation (use
createClassDeclaration with "constructor(orderId) {}"), call
evaluateFromConstructorParamsRule({ fromConstructorParams: true }, classDecl),
and assert result.value equals [{ name: 'orderId', type: 'unknown' }]; this
mirrors the evaluateFromMethodSignatureRule behavior and verifies
evaluateFromConstructorParamsRule returns 'unknown' for untyped parameters.
- Around line 253-259: The test calls evaluateFromParameterTypeRule twice to
assert the thrown type and message; instead, call evaluateFromParameterTypeRule
once (e.g., capture the thrown error via try/catch or using expect(() =>
...).toThrowError(...) that returns the error) and then assert both that the
error is an instance of ExtractionError and that its message equals "Parameter
position 5 out of bounds. Method has 1 parameter(s)"; update the assertions
around evaluateFromParameterTypeRule and ExtractionError so the function is
invoked only once and both properties (instance and message) are checked on the
single captured error.

In
`@packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts`:
- Around line 49-60: The local variable named "constructor" in
evaluateFromConstructorParamsRule shadows the global constructor; rename it
(e.g., to ctor or classConstructor) and update all uses (the declaration and
subsequent checks/getParameters call) so the function still retrieves the first
element from classDecl.getConstructors() and returns the mapped parameters via
extractParameterInfo unchanged.

In
`@packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts`:
- Around line 154-180: Update these tests to assert both the ExtractionError
type and its message by replacing the current toThrow(ExtractionError)
assertions with assertions that include the expected message text (e.g., use
expect(() => evaluateFromFilePathRule(...)).toThrowError(new ExtractionError("No
match for pattern 'nonexistent/(.*)'")) for the no-match case and
toThrowError(new ExtractionError("Capture group index 5 out of bounds for
pattern 'src/(.*)/api'")) for the out-of-bounds case), and apply the same
pattern to the other test blocks mentioned; reference evaluateFromFilePathRule
and the ExtractionError class to ensure the asserted message exactly matches the
message produced by the implementation.

In `@packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts`:
- Around line 182-207: Replace the try/catch helper captureExtractionError and
its usage with Jest's expect(...).toThrow assertion: call
extractLiteralValue(initializer, 'src/api/controller.ts', 42) inside
expect(...).toThrow and then assert that the thrown error's message includes the
file and line (e.g., contains 'src/api/controller.ts' and '42' or the exact
embedded location string). Remove the captureExtractionError function and any
manual error-return logic, and keep references to getPropertyInitializer and
extractLiteralValue so the test validates the error via expect(...).toThrow and
message content instead of manual try/catch and instanceof ExtractionError
checks.

In `@packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts`:
- Around line 15-111: Add unit tests covering string edge cases for stripSuffix,
stripPrefix, toLowerCase, toUpperCase, kebabToPascal, pascalToKebab, and
applyTransforms: include assertions that an empty string input returns an empty
string; a whitespace-only string is preserved (and case transforms do not alter
whitespace); Unicode/emojis and non-alphanumeric/special characters are
preserved by case transforms and pass through kebab/pascal conversions where no
alphabetic change applies (e.g., "😊-test" -> "😊Test" for kebabToPascal); and
verify applyTransforms composes correctly on these edge inputs (e.g., empty,
whitespace, emoji-containing strings) using the same Transform shapes used
elsewhere in the spec. Ensure each new test references the exact function names
(stripSuffix, stripPrefix, toLowerCase, toUpperCase, kebabToPascal,
pascalToKebab, applyTransforms) so they integrate into the existing describe
blocks.

In `@packages/riviere-extract-ts/src/extraction-rules/transforms.ts`:
- Around line 63-87: applyTransforms currently builds a fixed sequence of
transformers by checking specific fields, which ignores the order defined in the
YAML; change applyTransforms to iterate Object.entries(transform) in insertion
order and for each entry push the corresponding TransformFn (e.g., for key
"stripSuffix" use stripSuffix with the provided value, "stripPrefix" with its
value, "toLowerCase", "toUpperCase", "kebabToPascal", "pascalToKebab" for
boolean true) into the transformers array and then reduce over them; ensure you
look up keys by name inside applyTransforms, handle parameterized transforms
(stripPrefix/stripSuffix) using the entry value, skip unknown keys, and keep the
final reduce behavior unchanged so transforms run in the YAML-specified order.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4c5e619 and 4ed91c8.

📒 Files selected for processing (13)
  • docs/conventions/standard-patterns.md
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
🧰 Additional context used
📓 Path-based instructions (4)
packages/riviere-extract-ts/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/riviere-extract-ts/CLAUDE.md)

packages/riviere-extract-ts/**/*.{ts,tsx}: Use ts-morph for TypeScript AST parsing instead of other parsers
Implement extraction logic as pure functions with no side effects
Compose detection rules via and/or logic for predicates
Reject invalid extraction configs at load time, not during extraction phase
Use glob pattern matching for module-based organization of extraction rules

Files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
**/*.{js,mjs,ts,tsx,json}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use nx commands for build, test, lint operations. Do not run npm/pnpm directly in project folders

Files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Use cross-project imports with package names (e.g., import { X } from '@living-architecture/[pkg-name]'), not relative paths
When adding dependencies between projects, add "@living-architecture/[pkg-name]": "workspace:*" to the consuming project's package.json
Follow docs/conventions/software-design.md when writing, editing, refactoring, or reviewing code
Look for and follow standard implementation patterns defined in docs/conventions/standard-patterns.md
Avoid anti-patterns documented in @docs/conventions/anti-patterns.md
Follow docs/conventions/testing.md when writing tests. 100% test coverage is mandatory and enforced

Files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Never commit secrets, API keys, or credentials. Use environment variables for sensitive configuration
Do not log sensitive data (passwords, tokens, PII). Validate and sanitize all external input

Files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
🧠 Learnings (51)
📓 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: 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*.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} : 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/**/*.{ts,tsx} : Reject invalid extraction configs at load time, not during extraction phase
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: 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 ts-morph for TypeScript AST parsing instead of other parsers
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} : Compose detection rules via and/or logic for predicates
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
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: All extraction rules should come from validated ExtractionConfig provided by riviere-extract-config
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
📚 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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
📚 Learning: 2026-01-14T00:09:27.486Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 156
File: packages/riviere-extract-config/src/types.ts:71-75
Timestamp: 2026-01-14T00:09:27.486Z
Learning: In packages/riviere-extract-config/src/types.ts, the ExtractionConfig interface represents the post-expansion state where all $ref module references have been resolved to ModuleConfig entries. The extraction-config.schema.json allows both ModuleConfig and ModuleRef in the modules array because it validates raw input before expandModuleRefs runs, but after expansion, modules are always ModuleConfig[], so the TypeScript type correctly models this expanded state.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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 ts-morph for TypeScript AST parsing instead of other parsers

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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} : Compose detection rules via and/or logic for predicates

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
📚 Learning: 2026-01-11T14:38:35.637Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: packages/riviere-cli/src/commands/extract/config-loader.ts:31-39
Timestamp: 2026-01-11T14:38:35.637Z
Learning: In packages/riviere-cli/src/commands/extract/config-loader.ts, the isExtendedConfig type guard intentionally performs minimal validation (checks for non-null object and validates modules is an array if present) because comprehensive validation is handled downstream by the schema validator. The type guard's purpose is basic type narrowing to support both module-array and top-level-rules formats, not comprehensive validation. This follows the layered validation pattern where type guards are minimal and schema validation occurs at system boundaries.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
📚 Learning: 2026-01-08T22:39:00.431Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 84
File: packages/riviere-extract-ts/src/extractor.ts:168-187
Timestamp: 2026-01-08T22:39:00.431Z
Learning: In ts-morph usage within the riviere-extract-ts package, MethodDeclaration.getName() always returns a string (never undefined) because methods cannot be anonymous in TypeScript. Only ClassDeclaration.getName() and FunctionDeclaration.getName() can return undefined. Therefore, remove undefined guards for MethodDeclaration when implementing createMethodComponent, and only keep guards for components that can actually be undefined (class/function components). Apply this guidance to all .ts files under packages/riviere-extract-ts/ (i.e., **/packages/riviere-extract-ts/**/*.ts).

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
📚 Learning: 2026-01-11T18:47:09.232Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: apps/eclair/src/components/SchemaModal/SchemaModal.cssModule.spec.ts:13-19
Timestamp: 2026-01-11T18:47:09.232Z
Learning: Encourage using const for declarations by default in TypeScript/JavaScript files and only use let when a variable must be reassigned. Do not rely on var. This improves immutability and clarity. If a variable needs mutation (e.g., counters in loops, reassigned values), use let, but prefer const whenever possible and refactor reassigned logic to avoid mutations where feasible.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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 `Ignore` decorator to exclude classes or methods from architectural extraction analysis

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.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: Configure ESLint to enforce component decorators on classes using the `require-component-decorator` rule from `living-architecture/riviere-extract-conventions/eslint-plugin`

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
📚 Learning: 2026-01-11T18:47:09.232Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: apps/eclair/src/components/SchemaModal/SchemaModal.cssModule.spec.ts:13-19
Timestamp: 2026-01-11T18:47:09.232Z
Learning: In test files matching *.spec.ts or *.test.ts, avoid using try/catch blocks for testing error conditions. Prefer assertion library matchers like expect(...).toThrow() or expect(...).rejects.toThrow() to assert errors.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Systematically test edge cases for numbers: zero, negative numbers, very large/small numbers, decimal precision (0.1 + 0.2), NaN, Infinity/-Infinity, and boundary values.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Systematically test edge cases for strings: empty string, whitespace only, very long strings, Unicode/emojis, special characters, SQL/HTML injection patterns, and leading/trailing whitespace.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : When testing errors, test both error type and message in a single test—they represent one error condition. For example: expect(() => loadConfig('nonexistent.json')).toThrow(ConfigurationError) and expect(() => loadConfig('nonexistent.json')).toThrow('Config file not found')

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
📚 Learning: 2026-01-13T11:37:59.334Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-13T11:37:59.334Z
Learning: Applies to vitest.config.ts : Add vitest.config.ts if tests are needed with 100% coverage as the default

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
📚 Learning: 2026-01-06T08:11:15.403Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 53
File: packages/riviere-extract-config/vitest.config.mts:20-20
Timestamp: 2026-01-06T08:11:15.403Z
Learning: In packages/riviere-extract-config/vitest.config.mts, the explicit tuple type assertion for the reporter configuration (`as ['text', ['lcov', { projectRoot: string }]]`) is necessary because vitest's CoverageReporter type requires the exact tuple shape; neither inference nor 'as const' produces a compatible type.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts
📚 Learning: 2026-01-02T17:46:32.292Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/standard-patterns.md:0-0
Timestamp: 2026-01-02T17:46:32.292Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Use Zod for creating branded types

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-08T23:16:02.639Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Make illegal states unrepresentable. Use discriminated unions, not optional fields. If a state combination shouldn't exist, make the type system forbid it.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-08T23:16:02.639Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Use Zod for runtime validation. In TypeScript, use Zod schemas for parsing external data, API responses, and user input. Type inference from schemas keeps types and validation in sync.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-08T23:16:02.639Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Parse, don't validate. Use Zod schemas at system boundaries to parse external data once. Don't scatter `isX(unknown): x is T` type guards throughout the codebase.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-08T23:16:02.639Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Strive for maximum type-safety. No `any`. No `as` (except `as const` which is allowed). Type escape hatches defeat TypeScript's purpose.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-08T23:16:02.639Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Wrap all primitives and strings. Create value objects, encapsulate validation logic, and make domain concepts explicit.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-13T11:37:59.334Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-13T11:37:59.334Z
Learning: Applies to **/*.{ts,tsx} : Follow `docs/conventions/software-design.md` when writing, editing, refactoring, or reviewing code

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-13T11:37:59.334Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-13T11:37:59.334Z
Learning: Applies to **/*.{ts,tsx} : Avoid anti-patterns documented in `docs/conventions/anti-patterns.md`

Applied to files:

  • docs/conventions/standard-patterns.md
📚 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)} : Organize code by usage (vertical slice organization), not by type. Avoid folders/files named: types/, models/, validators/, assertions/, schemas/, interfaces/, or files like types.ts, models.ts, validators.ts. Group items by what uses them together, not by category.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-11T22:42:12.408Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/anti-patterns.md:0-0
Timestamp: 2026-01-11T22:42:12.408Z
Learning: Applies to docs/conventions/**/*.{js,ts,jsx,tsx} : Never parse error message strings to determine error types or extract information. Use typed error classes instead with error codes/types that can be checked with `instanceof` or error code properties.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 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-extract-ts/src/extraction-rules/transforms.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Systematically test edge cases for collections: empty collections, single element, duplicates, nested structures, circular references, large collections, sparse arrays, and mixed types.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Use Arrange-Act-Assert structure in tests: Set up test data, execute behavior, then verify outcomes.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Test names should describe outcomes, not actions. Use pattern: '[outcome] when [condition]'. For example: 'returns empty array when input is null' not 'test null input'.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Write one concept per test. Each test should verify one behavior. If you need 'and' in your test name, split it into multiple tests.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Systematically test edge cases for dates and times: leap years (Feb 29), daylight saving transitions, timezone boundaries, midnight/end of day, year boundaries, invalid dates, Unix epoch edges, and far future/past dates.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/transforms.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.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: 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.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.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 (*.spec.ts, *.test.ts), type guards like `isExtractionOutput(value: unknown): value is ExtractionOutput` should focus on narrowing types for TypeScript rather than comprehensive validation. Actual shape validation is handled through explicit test assertions (e.g., `expect(result).toMatchObject(...)`). This keeps type guards simple while maintaining thorough validation through assertion-based testing.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
🧬 Code graph analysis (8)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts (3)
packages/riviere-extract-config/src/types.ts (1)
  • FromGenericArgExtractionRule (116-122)
packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts (1)
  • ExtractionError (5-19)
packages/riviere-extract-ts/src/extraction-rules/transforms.ts (1)
  • applyTransforms (63-88)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-decorator.spec.ts (2)
packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts (2)
  • TestFixtureError (22-27)
  • ExtractionError (5-19)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts (2)
  • evaluateFromDecoratorArgRule (292-310)
  • evaluateFromDecoratorNameRule (312-333)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.spec.ts (2)
packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts (2)
  • TestFixtureError (22-27)
  • ExtractionError (5-19)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts (3)
  • evaluateFromMethodSignatureRule (34-47)
  • evaluateFromConstructorParamsRule (49-60)
  • evaluateFromParameterTypeRule (62-88)
packages/riviere-extract-ts/src/extraction-rules/literal-detection.spec.ts (1)
packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts (4)
  • TestFixtureError (22-27)
  • isLiteralValue (33-45)
  • extractLiteralValue (116-131)
  • ExtractionError (5-19)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts (2)
packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts (2)
  • TestFixtureError (22-27)
  • ExtractionError (5-19)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts (1)
  • evaluateFromGenericArgRule (33-89)
packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts (2)
packages/riviere-extract-ts/src/extraction-rules/transforms.ts (7)
  • stripSuffix (6-11)
  • stripPrefix (16-21)
  • toLowerCase (26-28)
  • toUpperCase (33-35)
  • kebabToPascal (41-46)
  • pascalToKebab (52-55)
  • applyTransforms (63-88)
packages/riviere-extract-config/src/types.ts (1)
  • Transform (60-67)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.spec.ts (1)
packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts (2)
  • TestFixtureError (22-27)
  • ExtractionError (5-19)
packages/riviere-extract-ts/src/extraction-rules/transforms.ts (2)
packages/riviere-extract-ts/src/extraction-rules/index.ts (1)
  • applyTransforms (19-19)
packages/riviere-extract-config/src/types.ts (1)
  • Transform (60-67)
🪛 ast-grep (0.40.5)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts

[warning] 85-85: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(pattern)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🪛 Biome (2.1.2)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts

[error] 53-53: Do not shadow the global "constructor" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

🪛 GitHub Check: Semgrep OSS
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts

[warning] 86-86: Semgrep Finding: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp
RegExp() called with a rule function argument, this might allow an attacker to cause a Regular Expression Denial-of-Service (ReDoS) within your application as RegExP blocks the main thread. For this reason, it is recommended to use hardcoded regexes instead. If your regex is run on user-controlled input, consider performing input validation or use a regex checking/sanitization library such as https://www.npmjs.com/package/recheck to verify that the regex does not appear vulnerable to ReDoS.

🪛 LanguageTool
docs/conventions/standard-patterns.md

[grammar] ~7-~7: Use a hyphen to join words.
Context: ... use Zod. Why: standard library, battle tested, clean API, codebase consistency,...

(QB_NEW_EN_HYPHEN)

⏰ 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). (3)
  • GitHub Check: main
  • GitHub Check: browser-tests (webkit)
  • GitHub Check: Cloudflare Pages

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread docs/conventions/standard-patterns.md Outdated
Comment thread packages/riviere-extract-ts/src/extraction-rules/transforms.spec.ts
Comment thread packages/riviere-extract-ts/src/extraction-rules/transforms.ts
- Improve error message in throwNonLiteralValue to include expression kind
- Rename `constructor` variable to `ctor` to avoid shadowing global
- Fix "battle tested" to "battle-tested" in docs

Co-Authored-By: Claude Opus 4.5 <[email protected]>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In
`@packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts`:
- Around line 70-87: The current check only handles direct TypeReference nodes
and misses type parameters nested inside unions or inside type arguments (e.g.,
T | X or Result<T>); implement a recursive validator (e.g., assertConcreteType)
that walks a type node (typeArg) and: if node is a TypeReference check its type
arguments recursively; if node is a UnionType iterate each constituent and
validate; if node is a TypeParameter or identifier matching any name in
classDecl.getTypeParameters() throw the existing ExtractionError with the same
message/metadata; call this validator before extractTypeNames to ensure no
nested or unioned type parameters leak through.

In
`@packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts`:
- Around line 26-32: Replace the inline type import in extractParameterInfo with
a top-level import: add ParameterDeclaration to the existing ts-morph import and
change the function signature from extractParameterInfo(param:
import('ts-morph').ParameterDeclaration) to use the imported
ParameterDeclaration type; update any references inside extractParameterInfo as
needed (function name: extractParameterInfo, type: ParameterDeclaration) to keep
types consistent and idiomatic.

In
`@packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts`:
- Around line 83-111: The current evaluateFromFilePathRule code constructs
RegExp directly from rule.fromFilePath.pattern, enabling ReDoS; update the
semantic validation path in validateAllExtractionRules to run a regex-safety
check (e.g., using safe-regex or recheck) against every
rule.fromFilePath.pattern and reject/raise a validation error for any pattern
flagged unsafe, and additionally add a defensive try/catch around the RegExp
construction in evaluateFromFilePathRule (or the function that contains the
shown snippet) to surface a clear ExtractionError for invalid patterns;
reference validateAllExtractionRules and evaluateFromFilePathRule (and
rule.fromFilePath.pattern) when making these changes.

In `@packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts`:
- Around line 61-64: The extractString function currently slices
expression.getText() which mishandles escaped characters; update extractString
to cast the Expression to a StringLiteral and return its getLiteralValue()
instead of slicing the text (use the StringLiteral API on the expression passed
to extractString). Ensure you import or reference SyntaxKind/StringLiteral types
if needed to identify or cast the node (or narrow the type) so getLiteralValue()
is available on the node.
♻️ Duplicate comments (3)
packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts (1)

103-109: Error message improvement already applied.

The current implementation includes both getKindName() and getText() in the error message, which provides excellent context for debugging non-literal value errors.

packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts (1)

49-60: Variable shadowing fix applied.

The rename from constructor to ctor correctly addresses the global shadowing issue flagged by static analysis.

packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts (1)

59-74: Add error message assertions for complete error validation.

Per testing guidelines, error tests should check both type and message. Lines 73, 110, and 130 only assert ExtractionError type. Add message assertions to verify the specific failure reason.

🧪 Suggested message assertions
 // Line 73 - interface not found
-    ).toThrow(ExtractionError)
+    ).toThrow(ExtractionError)
+    expect(() =>
+      evaluateFromGenericArgRule(/* same args */),
+    ).toThrow(/IEventHandler/)

 // Line 110 - position out of bounds  
-    ).toThrow(ExtractionError)
+    ).toThrow(ExtractionError)
+    expect(() =>
+      evaluateFromGenericArgRule(/* same args */),
+    ).toThrow(/position.*out of bounds|out of bounds/i)

 // Line 130 - type parameter
-    ).toThrow(ExtractionError)
+    ).toThrow(ExtractionError)
+    expect(() =>
+      evaluateFromGenericArgRule(/* same args */),
+    ).toThrow(/type parameter|concrete/i)

Or combine type and message in single assertions:

expect(() => /* ... */).toThrow(expect.objectContaining({
  name: 'ExtractionError',
  message: expect.stringMatching(/IEventHandler/)
}))

Also applies to: 93-111, 113-131

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ed91c8 and 451b3dd.

📒 Files selected for processing (8)
  • docs/conventions/standard-patterns.md
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
  • packages/riviere-extract-ts/src/index.ts
🧰 Additional context used
📓 Path-based instructions (4)
packages/riviere-extract-ts/**/*.{ts,tsx}

📄 CodeRabbit inference engine (packages/riviere-extract-ts/CLAUDE.md)

packages/riviere-extract-ts/**/*.{ts,tsx}: Use ts-morph for TypeScript AST parsing instead of other parsers
Implement extraction logic as pure functions with no side effects
Compose detection rules via and/or logic for predicates
Reject invalid extraction configs at load time, not during extraction phase
Use glob pattern matching for module-based organization of extraction rules

Files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
**/*.{js,mjs,ts,tsx,json}

📄 CodeRabbit inference engine (CLAUDE.md)

Always use nx commands for build, test, lint operations. Do not run npm/pnpm directly in project folders

Files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx}: Use cross-project imports with package names (e.g., import { X } from '@living-architecture/[pkg-name]'), not relative paths
When adding dependencies between projects, add "@living-architecture/[pkg-name]": "workspace:*" to the consuming project's package.json
Follow docs/conventions/software-design.md when writing, editing, refactoring, or reviewing code
Look for and follow standard implementation patterns defined in docs/conventions/standard-patterns.md
Avoid anti-patterns documented in @docs/conventions/anti-patterns.md
Follow docs/conventions/testing.md when writing tests. 100% test coverage is mandatory and enforced

Files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Never commit secrets, API keys, or credentials. Use environment variables for sensitive configuration
Do not log sensitive data (passwords, tokens, PII). Validate and sanitize all external input

Files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
🧠 Learnings (46)
📓 Common learnings
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 integration tests for end-to-end extraction from TypeScript code to JSON output
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/**/*.{ts,tsx} : Reject invalid extraction configs at load time, not during extraction phase
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
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} : Compose detection rules via and/or logic for predicates
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 ts-morph for TypeScript AST parsing instead of other parsers
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
📚 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-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.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 ts-morph for TypeScript AST parsing instead of other parsers

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
📚 Learning: 2026-01-08T22:39:00.431Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 84
File: packages/riviere-extract-ts/src/extractor.ts:168-187
Timestamp: 2026-01-08T22:39:00.431Z
Learning: In ts-morph usage within the riviere-extract-ts package, MethodDeclaration.getName() always returns a string (never undefined) because methods cannot be anonymous in TypeScript. Only ClassDeclaration.getName() and FunctionDeclaration.getName() can return undefined. Therefore, remove undefined guards for MethodDeclaration when implementing createMethodComponent, and only keep guards for components that can actually be undefined (class/function components). Apply this guidance to all .ts files under packages/riviere-extract-ts/ (i.e., **/packages/riviere-extract-ts/**/*.ts).

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
📚 Learning: 2026-01-14T00:09:27.486Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 156
File: packages/riviere-extract-config/src/types.ts:71-75
Timestamp: 2026-01-14T00:09:27.486Z
Learning: In packages/riviere-extract-config/src/types.ts, the ExtractionConfig interface represents the post-expansion state where all $ref module references have been resolved to ModuleConfig entries. The extraction-config.schema.json allows both ModuleConfig and ModuleRef in the modules array because it validates raw input before expandModuleRefs runs, but after expansion, modules are always ModuleConfig[], so the TypeScript type correctly models this expanded state.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.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 `Ignore` decorator to exclude classes or methods from architectural extraction analysis

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/index.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.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} : Compose detection rules via and/or logic for predicates

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
📚 Learning: 2026-01-11T18:47:09.232Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: apps/eclair/src/components/SchemaModal/SchemaModal.cssModule.spec.ts:13-19
Timestamp: 2026-01-11T18:47:09.232Z
Learning: Encourage using const for declarations by default in TypeScript/JavaScript files and only use let when a variable must be reassigned. Do not rely on var. This improves immutability and clarity. If a variable needs mutation (e.g., counters in loops, reassigned values), use let, but prefer const whenever possible and refactor reassigned logic to avoid mutations where feasible.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.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-extract-ts/src/extraction-rules/evaluate-extraction-rule.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: Configure ESLint to enforce component decorators on classes using the `require-component-decorator` rule from `living-architecture/riviere-extract-conventions/eslint-plugin`

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts
  • packages/riviere-extract-ts/src/index.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts
  • packages/riviere-extract-ts/src/extraction-rules/index.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Avoid implementation coupling in tests. Test behavior outcomes, not internal implementation details. For example, assert on result values rather than mock method call signatures.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Assert specific values, not types. Use expect(result).toEqual(['First.', ' Second.']) not expect(result).toBeDefined(). Specific assertions catch specific bugs.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Assertions must match test titles. If the test claims to verify 'different IDs', assert on the actual ID values—not just count or existence.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : When testing errors, test both error type and message in a single test—they represent one error condition. For example: expect(() => loadConfig('nonexistent.json')).toThrow(ConfigurationError) and expect(() => loadConfig('nonexistent.json')).toThrow('Config file not found')

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.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: 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.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
📚 Learning: 2026-01-11T18:47:09.232Z
Learnt from: NTCoding
Repo: NTCoding/living-architecture PR: 129
File: apps/eclair/src/components/SchemaModal/SchemaModal.cssModule.spec.ts:13-19
Timestamp: 2026-01-11T18:47:09.232Z
Learning: In test files matching *.spec.ts or *.test.ts, avoid using try/catch blocks for testing error conditions. Prefer assertion library matchers like expect(...).toThrow() or expect(...).rejects.toThrow() to assert errors.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
📚 Learning: 2026-01-11T22:42:36.650Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/testing.md:0-0
Timestamp: 2026-01-11T22:42:36.650Z
Learning: Applies to docs/conventions/**/*.spec.{ts,tsx,js,jsx} : Systematically test edge cases for collections: empty collections, single element, duplicates, nested structures, circular references, large collections, sparse arrays, and mixed types.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.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-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts
📚 Learning: 2026-01-02T17:46:32.292Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/standard-patterns.md:0-0
Timestamp: 2026-01-02T17:46:32.292Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Use Zod for creating branded types

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-08T23:16:02.639Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Make illegal states unrepresentable. Use discriminated unions, not optional fields. If a state combination shouldn't exist, make the type system forbid it.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-08T23:16:02.639Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Use Zod for runtime validation. In TypeScript, use Zod schemas for parsing external data, API responses, and user input. Type inference from schemas keeps types and validation in sync.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-08T23:16:02.639Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Parse, don't validate. Use Zod schemas at system boundaries to parse external data once. Don't scatter `isX(unknown): x is T` type guards throughout the codebase.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-08T23:16:02.639Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Strive for maximum type-safety. No `any`. No `as` (except `as const` which is allowed). Type escape hatches defeat TypeScript's purpose.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-13T11:37:59.334Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-13T11:37:59.334Z
Learning: Applies to **/*.{ts,tsx} : Follow `docs/conventions/software-design.md` when writing, editing, refactoring, or reviewing code

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-08T23:16:02.639Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx} : Wrap all primitives and strings. Create value objects, encapsulate validation logic, and make domain concepts explicit.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-13T11:37:59.334Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-13T11:37:59.334Z
Learning: Applies to **/*.{ts,tsx} : Avoid anti-patterns documented in `docs/conventions/anti-patterns.md`

Applied to files:

  • docs/conventions/standard-patterns.md
📚 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)} : Organize code by usage (vertical slice organization), not by type. Avoid folders/files named: types/, models/, validators/, assertions/, schemas/, interfaces/, or files like types.ts, models.ts, validators.ts. Group items by what uses them together, not by category.

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-13T11:37:59.334Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-13T11:37:59.334Z
Learning: Applies to **/*.tsx : All UI and UX design must conform to global brand guidelines: `/docs/brand/` (logo, colors, typography, icons)

Applied to files:

  • docs/conventions/standard-patterns.md
📚 Learning: 2026-01-11T22:42:12.408Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/anti-patterns.md:0-0
Timestamp: 2026-01-11T22:42:12.408Z
Learning: Applies to docs/conventions/**/*.{js,ts,jsx,tsx} : Never parse error message strings to determine error types or extract information. Use typed error classes instead with error codes/types that can be checked with `instanceof` or error code properties.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
📚 Learning: 2026-01-08T23:16:02.639Z
Learnt from: CR
Repo: NTCoding/living-architecture PR: 0
File: docs/conventions/software-design.md:0-0
Timestamp: 2026-01-08T23:16:02.639Z
Learning: Applies to docs/conventions/**/*.{ts,tsx,js,jsx} : Fail-Fast Error Handling: Validate and throw clear errors instead of using fallback chains. Error format: `Expected [X]. Got [Y]. Context: [debugging info]`

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.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 (*.spec.ts, *.test.ts), type guards like `isExtractionOutput(value: unknown): value is ExtractionOutput` should focus on narrowing types for TypeScript rather than comprehensive validation. Actual shape validation is handled through explicit test assertions (e.g., `expect(result).toMatchObject(...)`). This keeps type guards simple while maintaining thorough validation through assertion-based testing.

Applied to files:

  • packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts
🧬 Code graph analysis (1)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts (5)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts (1)
  • evaluateFromGenericArgRule (19-19)
packages/riviere-extract-ts/src/extraction-rules/index.ts (3)
  • evaluateFromGenericArgRule (9-9)
  • ExtractionError (21-21)
  • applyTransforms (19-19)
packages/riviere-extract-config/src/types.ts (1)
  • FromGenericArgExtractionRule (116-122)
packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts (1)
  • ExtractionError (5-19)
packages/riviere-extract-ts/src/extraction-rules/transforms.ts (1)
  • applyTransforms (63-88)
🪛 ast-grep (0.40.5)
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts

[warning] 85-85: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(pattern)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🪛 GitHub Check: Semgrep OSS
packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts

[warning] 86-86: Semgrep Finding: javascript.lang.security.audit.detect-non-literal-regexp.detect-non-literal-regexp
RegExp() called with a rule function argument, this might allow an attacker to cause a Regular Expression Denial-of-Service (ReDoS) within your application as RegExP blocks the main thread. For this reason, it is recommended to use hardcoded regexes instead. If your regex is run on user-controlled input, consider performing input validation or use a regex checking/sanitization library such as https://www.npmjs.com/package/recheck to verify that the regex does not appear vulnerable to ReDoS.

⏰ 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 (14)
docs/conventions/standard-patterns.md (2)

5-5: Good typo fix.

The correction from "brnaded" to "branded" improves the documentation quality.


13-21: The SonarJS rule reference and behavior are accurate. Rule S3800 does flag functions returning different types across branches (like string | number | boolean), and the documentation correctly explains that discriminated unions solve this by ensuring all return statements have the same declared type structure. No corrections needed.

packages/riviere-extract-ts/src/extraction-rules/literal-detection.ts (2)

5-19: Well-structured error class with location tracking.

The ExtractionError class properly captures file and line information for debugging, following the fail-fast error handling pattern specified in the coding guidelines.


29-45: LGTM - Pure predicate function.

Clean implementation checking for extractable literal types. Based on learnings, extraction logic should be implemented as pure functions with no side effects, which this follows correctly.

packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-method.ts (1)

62-88: Solid implementation with proper error handling.

The function correctly validates parameter bounds, throws descriptive ExtractionError with file/line context, and applies optional transforms. This follows the fail-fast principle from the coding guidelines.

packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule.ts (4)

1-27: Clean module organization with re-exports.

Good separation of concerns by re-exporting method-related and generic-arg functions from their respective modules. This follows the glob pattern matching for module-based organization mentioned in learnings.


119-143: Well-implemented recursive property inheritance search.

The findPropertyInHierarchy function correctly traverses the class hierarchy to find properties, which satisfies the PR objective to "resolve property inheritance chains."


224-224: Good use of getLiteralValue() for positional args.

Using asKindOrThrow(SyntaxKind.StringLiteral).getLiteralValue() correctly handles escape sequences in string literals.


290-308: Schema validation already enforces that position or name must be provided—no runtime guard needed.

The extraction config schema (extraction-config.schema.json line 229) specifies "minProperties": 1 for fromDecoratorArg, which requires at least one of position or name to be present. This is validated at load time via the JSON schema validator, so the config will never reach this function with both undefined. The defensive fallback name ?? '' is acceptable and won't be triggered in practice due to the schema constraint.

packages/riviere-extract-ts/src/extraction-rules/index.ts (1)

1-21: Clean public API surface.

This barrel file properly consolidates and exposes all extraction rule evaluators, types, transforms, and error classes. This provides a single import point for consumers and aligns with good module organization practices.

packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.spec.ts (2)

10-18: Good test fixture helper with proper error handling.

Uses useInMemoryFileSystem: true for fast isolated tests per the learnings, and throws TestFixtureError for invalid test setups.


194-217: Excellent coverage of interface inheritance.

This test verifies that evaluateFromGenericArgRule correctly finds interfaces implemented by base classes, satisfying the PR objective for property inheritance chain resolution.

packages/riviere-extract-ts/src/extraction-rules/evaluate-extraction-rule-generic.ts (1)

9-28: Solid base-class traversal for interface lookup.
The recursive walk keeps inherited implementations covered without extra callers.

packages/riviere-extract-ts/src/index.ts (1)

11-29: Public re-exports are consistent with extraction-rules barrel.
Nice consolidation for consumer access.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

- Use getLiteralValue() in literal-detection.ts to handle escaped chars
- Move ParameterDeclaration to top-level import for consistency

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@NTCoding
NTCoding merged commit d18411d into main Jan 27, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[M2] Implement all metadata extraction rules

2 participants