Skip to content

feat(extract): add CLI flags for extraction modes and enrichment orchestrator - #227

Merged
NTCoding merged 10 commits into
mainfrom
issue-166-m2-d2-6-add-cli-flags-for-extr
Jan 30, 2026
Merged

NTCoding merged 10 commits into
mainfrom
issue-166-m2-d2-6-add-cli-flags-for-extr

Conversation

@NTCoding

@NTCoding NTCoding commented Jan 30, 2026 •

Copy link
Copy Markdown
Owner

Closes #166

Deliverable: CLI flags for strict/lenient modes, two-pass workflow, and output control

Context

PRD: docs/project/PRD/active/PRD-phase-11-metadata-extraction.md — Milestone 2, Deliverable D2.6

The extraction CLI needs flags to control strictness (fail vs warn on missing fields), enable two-pass workflows (components-only then enrich), and manage output.

Traceability

  • PRD Section: M2-D2.6 (CLI flags and modes)
  • Success Criteria: SC-5 (riviere extract --pr command available)

Acceptance Criteria

  • --allow-incomplete flag: warn and continue, output includes _missing arrays
  • --components-only flag: skip metadata extraction (Phase 10 behavior)
  • --enrich <file> flag: read draft components from file, apply extraction rules
  • --dry-run flag: validate config, report what would be extracted, no output file
  • -o <file> flag: output to file instead of stdout
  • Exit codes implemented: 0 (success), 1 (extraction failure), 2 (config validation), 3 (runtime error)
  • Error messages follow format: Error: [CATEGORY] CODE\n Description.\n Location: file:line\n Suggestion: how to fix
  • Categories: CONFIG_VALIDATION, EXTRACTION_FAILURE, GIT_ERROR, RUNTIME_ERROR
  • All flags documented in --help output

Edge Case Scenarios

  • --allow-incomplete with all fields present → no _missing array, exit 0
  • --allow-incomplete with missing fields → _missing array populated, warnings printed, exit 0
  • Default (strict) with missing fields → exit 1 with error listing missing fields
  • --enrich with invalid JSON → exit 3 (runtime error)
  • --enrich with file not found → exit 3 (runtime error)
  • --dry-run with invalid config → exit 2 (config validation)
  • -o to read-only path → exit 3 (runtime error)
  • Combined --components-only --enrich → error (mutually exclusive)

Implementation Guidelines

  • Location: packages/riviere-cli/src/commands/extract/extract.ts
  • Use Commander.js (already in use for CLI)
  • Follow existing flag patterns in CLI
  • Lenient mode adds _missing: string[] to component output
  • Output format matches PRD Section 3.2 (version, extractedAt, config, components, warnings)
  • Error formatting should be consistent across all error types

Embedded Reasoning

Why: Different workflows need different strictness. CI wants strict (fail fast). Incremental adoption wants lenient. Two-pass enables AI-assisted completion.
What: 5 new flags controlling extraction behavior and output.
How: Commander.js options, conditional logic in extract command, structured error handling.

Testing Strategy

  • Unit: Flag parsing and validation
  • Integration: CLI invocation with each flag combination
  • Edge Cases: All scenarios from Edge Case Scenarios section
  • Error Handling: Verify exit codes and error message format

Dependencies

Depends on #165

Verification

pnpm nx build riviere-cli
# Check help output
./packages/riviere-cli/dist/bin.js extract --help | grep -E '(allow-incomplete|components-only|enrich|dry-run)'

Amendment

Amendment: The acceptance criteria for error message format and categories should reflect the existing JSON output pattern used by the CLI (formatError/formatSuccess in output.ts). The codebase uses structured JSON output ({success, error: {code, message, suggestions}}) rather than human-readable text. The CliErrorCode enum already defines error categories (ConfigNotFound, ValidationError). The --help output is auto-generated by Commander.js from option definitions and requires no separate implementation.

Summary by CodeRabbit

  • New Features

    • File output for extraction (-o/--output), components-only view, draft enrichment (--enrich), and allow-partial-success (--allow-incomplete)
    • Programmatic enrichment API exposed
    • Workflow timing capture and optional timings.md output
  • Bug Fixes

    • Standardized CLI exit codes and structured JSON error reporting
    • Improved handling of unwritable output paths and CI polling behavior
  • Tests

    • Expanded suites for extraction, enrichment, draft loading, file I/O, timing, and edge cases
  • Documentation

    • Reorganized conventions and workflow docs with standardized rule identifiers

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

@cloudflare-workers-and-pages

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

Copy link
Copy Markdown

Deploying living-architecture with  Cloudflare Pages  Cloudflare Pages

Latest commit: 39f974b
Status: ✅  Deploy successful!
Preview URL: https://92cb404d.living-architecture.pages.dev
Branch Preview URL: https://issue-166-m2-d2-6-add-cli-fl.living-architecture.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Jan 30, 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 3 minutes and 28 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.

📝 Walkthrough

Walkthrough

Adds a rule-driven enrichment engine and integrates it into the CLI: new enrichComponents API and types, CLI flags (--enrich, --components-only, --allow-incomplete, --dry-run, -o/--output), file-output support, distinct exit codes, draft-file loader, and tests for enrichment and CLI flows.

Changes

Cohort / File(s) Summary
CLI: Extract Entrypoint
packages/riviere-cli/src/features/extract/entrypoint/extract.ts
Rewrote extract command flow: config load/validate, resolve source files, new flags -o/--output, --enrich, --components-only, --allow-incomplete, --dry-run; added draft JSON loading, centralized outputResult, and structured JSON error exits with distinct exit codes.
CLI Tests & Enrichment CLI Specs
packages/riviere-cli/src/features/extract/entrypoint/extract.spec.ts, packages/riviere-cli/src/features/extract/entrypoint/extract.enrichment.spec.ts
Added and refactored end-to-end tests and fixtures: output-to-file, unreadable-path handling, components-only behavior, mutual-exclusion validation, allow-incomplete semantics, enrich-file parsing, and enrichment verification.
Draft Component Loader
packages/riviere-cli/src/features/extract/commands/draft-component-loader.ts, packages/riviere-cli/src/features/extract/commands/draft-component-loader.spec.ts
New loader module and tests: loadDraftComponentsFromFile with existence check, JSON parse, structural validation, and DraftComponentLoadError for invalid or missing inputs.
Enrichment Core & Tests
packages/riviere-extract-ts/src/domain/value-extraction/enrich-components.ts, packages/riviere-extract-ts/src/domain/value-extraction/enrich-components.spec.ts
New enrichment engine: enrichComponents plus types (EnrichedComponent, EnrichmentFailure, EnrichmentResult); resolves detection rules (literal, fromFilePath, fromClassName, fromProperty), module matching, per-field failure aggregation, _missing tracking, and comprehensive unit tests.
Public Re-exports
packages/riviere-extract-ts/src/shell/index.ts
Re-exported enrichComponents and related types to shell API surface.
CLI Presentation: Exit Codes & Tests
packages/riviere-cli/src/platform/infra/cli-presentation/error-codes.ts, .../error-codes.spec.ts
Added exported ExitCode enum (ExtractionFailure=1, ConfigValidation=2, RuntimeError=3) and tests validating mappings; used by CLI exit paths.
Workflow Timing & Dev Tools
tools/dev-workflow/..., tools/dev-workflow/features/complete-task/...
Added timing collection/formatting, timings file write support, tests; changed code-review verdict parsing window and agent model; dependency bump and doc/test adjustments.
Docs & Conventions
docs/**, .claude/**, CLAUDE.md
Extensive documentation relabeling and agent instruction updates (SD/TS/CR/AP codes); documentation-only changes and test doc updates.

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as rgba(52,122,183,0.5)
    participant Config as rgba(46,204,113,0.5)
    participant FS as rgba(231,76,60,0.5)
    participant Enricher as rgba(155,89,182,0.5)
    participant Matcher as rgba(241,196,15,0.5)

    User->>CLI: run extract --enrich drafts.json -o out.json
    CLI->>Config: loadAndValidateConfig()
    Config->>FS: read extract.yaml
    FS-->>Config: config
    Config-->>CLI: resolved config

    CLI->>FS: readFile(drafts.json)
    FS-->>CLI: drafts JSON
    CLI->>Enricher: enrichComponents(drafts, config, project, globMatcher, configDir)
    Enricher->>Matcher: findMatchingModule / findDetectionRule
    loop per draft component
      Enricher->>Enricher: evaluateRule(s) (literal, fromFilePath, fromClassName, fromProperty)
      Enricher-->>Enricher: accumulate metadata / failures / _missing
    end
    Enricher-->>CLI: EnrichmentResult {components, failures}
    alt failures && not --allow-incomplete
      CLI->>CLI: exit ExitCode.ExtractionFailure (1)
    else
      CLI->>FS: writeFileSync(out.json, results) or stdout
      FS-->>User: out.json / stdout
      CLI-->>User: exit 0
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐇 I hopped through YAML, code, and test,
I chased each draft and did my best,
Flags in my paws, outputs in store,
I noted _missing, then searched for more.
Hooray — enriched components, now polished and blessed!

🚥 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 PR title clearly identifies the primary change: adding CLI flags for extraction modes (--allow-incomplete, --components-only, --enrich, --dry-run, -o) and the enrichment orchestrator implementation.
Linked Issues check ✅ Passed The implementation satisfies all coding requirements from issue #166: CLI flags (--allow-incomplete, --components-only, --enrich, --dry-run, -o), exit codes (0,1,2,3), enrichment orchestration, draft component loading, and comprehensive test coverage for all scenarios.
Out of Scope Changes check ✅ Passed Changes are focused on extraction features and supporting infrastructure. Documentation updates to convention files and bug-scanner are organizational/formatting only and do not alter executable logic.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-166-m2-d2-6-add-cli-flags-for-extr

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@qodo-code-review

Copy link
Copy Markdown
Contributor
ⓘ Your approaching your monthly quota for Qodo. Upgrade your plan

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

165 - Partially compliant

Compliant requirements:

  • (None assessed in this PR)

Non-compliant requirements:

  • Implement all 15 metadata extraction rules in packages/riviere-extract-ts/src/extraction-rules/.
  • Execute transforms top-to-bottom in YAML order.
  • Reject non-literal values with clear message including file:line.
  • Resolve property inheritance chains.
  • Extract generic args as arrays (union types become multiple entries).
  • Config validation at extraction time; missing required fields => exit 1.
  • 100% unit test coverage on all rules + edge cases + integration tests.

Requires further human verification:

  • (None)

166 - Partially compliant

Compliant requirements:

  • --allow-incomplete flag supported; _missing is produced on failures and command succeeds.
  • --components-only flag supported.
  • --enrich <file> flag supported, including not-found and invalid JSON paths.
  • --dry-run behavior preserved (config validation happens first).
  • -o <file> supported to write JSON to file instead of stdout.
  • Exit codes introduced and exercised in tests (1/2/3).
  • --components-only --enrich mutual exclusion validated with exit code 2.
  • Flags appear in generated CLI reference doc.

Non-compliant requirements:

  • --allow-incomplete should emit warnings when fields are missing (tests cover _missing, but warnings output is not validated and may not exist).
  • Structured error categories/codes for runtime vs config vs extraction failure should be consistent (currently several errors are emitted with CliErrorCode.ValidationError even when exit code indicates runtime/extraction failure).

Requires further human verification:

  • Verify riviere extract --help output includes all flags exactly as intended (Commander auto-generation, but needs a quick manual run).
  • Verify --allow-incomplete prints warnings (not just _missing) and the warnings format matches the CLI’s JSON output conventions.
⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Error Coding

Several failure paths emit CliErrorCode.ValidationError even when the situation is a runtime error (e.g., invalid JSON / file missing for --enrich) or an extraction failure (missing extracted fields). This makes structured JSON output ambiguous and may violate the CLI error-code conventions implied by the ticket amendment.

function outputResult<T>(data: SuccessOutput<T>, options: ExtractOptions): void {
  if (options.output !== undefined) {
    try {
      writeFileSync(options.output, JSON.stringify(data))
    } catch {
      console.log(
        JSON.stringify(
          formatError(
            CliErrorCode.ValidationError,
            'Failed to write output file: ' + options.output,
          ),
        ),
      )
      process.exit(ExitCode.RuntimeError)
    }
    return
  }

  console.log(JSON.stringify(data))
}

function isDraftComponentArray(value: unknown): value is DraftComponent[] {
  if (!Array.isArray(value)) return false
  return value.every(
    (item) =>
      typeof item === 'object' &&
      item !== null &&
      'type' in item &&
      'name' in item &&
      'domain' in item &&
      'location' in item,
  )
}

function exitWithRuntimeError(message: string): never {
  console.log(JSON.stringify(formatError(CliErrorCode.ValidationError, message)))
  process.exit(ExitCode.RuntimeError)
}

function exitWithConfigValidation(code: CliErrorCode, message: string): never {
  console.log(JSON.stringify(formatError(code, message)))
  process.exit(ExitCode.ConfigValidation)
}

function exitWithExtractionFailure(fieldNames: string[]): never {
  const uniqueFields = [...new Set(fieldNames)]
  console.log(
    JSON.stringify(
      formatError(
        CliErrorCode.ValidationError,
        `Extraction failed for fields: ${uniqueFields.join(', ')}`,
      ),
    ),
  )
  process.exit(ExitCode.ExtractionFailure)
}
Wrong Category

outputResult treats file write failures as CliErrorCode.ValidationError and exits with runtime error. The exit code is correct, but the error code/category likely should reflect a runtime/IO failure rather than validation. Align error code with failure type for consistent tooling behavior.

function outputResult<T>(data: SuccessOutput<T>, options: ExtractOptions): void {
  if (options.output !== undefined) {
    try {
      writeFileSync(options.output, JSON.stringify(data))
    } catch {
      console.log(
        JSON.stringify(
          formatError(
            CliErrorCode.ValidationError,
            'Failed to write output file: ' + options.output,
          ),
        ),
      )
      process.exit(ExitCode.RuntimeError)
    }
    return
  }

  console.log(JSON.stringify(data))
}
Draft Validation

isDraftComponentArray only checks presence of keys (type, name, domain, location) but not their shapes/types (e.g., location.file string and location.line number). This can allow malformed drafts through and later crash enrichment or produce confusing errors.

function isDraftComponentArray(value: unknown): value is DraftComponent[] {
  if (!Array.isArray(value)) return false
  return value.every(
    (item) =>
      typeof item === 'object' &&
      item !== null &&
      'type' in item &&
      'name' in item &&
      'domain' in item &&
      'location' in item,
  )
}

Comment thread packages/riviere-cli/src/features/extract/entrypoint/extract.ts
Comment thread packages/riviere-cli/src/features/extract/entrypoint/extract.ts
Comment thread packages/riviere-cli/src/features/extract/entrypoint/extract.ts
Comment thread packages/riviere-cli/src/features/extract/entrypoint/extract.ts Outdated

@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-cli/src/features/extract/entrypoint/extract.enrichment.spec.ts`:
- Around line 145-294: Add a test to the existing "enrich flag" suite that
verifies the CLI rejects providing both --components-only and --enrich together:
create configWithLiteralExtract and a draftPath JSON file, call
createProgram().parseAsync with args including '--components-only' and
'--enrich' plus the draftPath, assert the promise rejects with an exitCode
indicating validation error (e.g. 2), then use
parseErrorOutput(ctx.consoleOutput) to assert the error message contains
"mutually exclusive"; place this test near the other enrich flag tests so it
uses the same TestContext and helpers (createProgram, parseErrorOutput,
configWithLiteralExtract, draftPath).
- Around line 22-27: Replace the local DraftComponent interface with an import
from `@living-architecture/riviere-extract-ts`: remove the locally declared
"interface DraftComponent { type: string; name: string; domain: string;
location: ComponentLocation }" and add an import for DraftComponent (and
ComponentLocation if not already imported) from the package so tests use the
canonical type; mirror the pattern used in the sibling test
extract.dry-run.spec.ts to locate the correct import name and update any
references to DraftComponent in the file accordingly.
- Around line 162-166: Update the test's expected location so the enrichment
finds the class declaration: in the location object inside
extract.enrichment.spec.ts (the entry that uses join(srcDir,
'order-service.ts')), change the line property from 2 to 3 so it points at the
actual class declaration line (`export class PlaceOrder {`) rather than the
JSDoc line.

In `@packages/riviere-cli/src/features/extract/entrypoint/extract.ts`:
- Around line 211-217: The catch in parseJsonFile swallows the JSON parse error;
update parseJsonFile to capture the thrown error (e.g., catch (err)) and pass
the error message/details into exitWithRuntimeError so the runtime error
includes the original JSON parse error and the file path, making debugging
easier; reference the parseJsonFile function and the exitWithRuntimeError call
when implementing this change.

Comment thread packages/riviere-cli/src/features/extract/entrypoint/extract.ts Outdated
NTCoding and others added 2 commits January 30, 2026 21:09
Convention rules now have unique IDs (SD, AP, SP, TS, CS, CR, BS prefixes)
enabling per-rule audit trails in code reviews. Review agents produce
structured verdicts with evidence for every rule instead of category
checkboxes. PR feedback rejection rules added to prevent blanket dismissals.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
.claude/agents/bug-scanner.md (1)

8-216: ⚠️ Potential issue | 🟠 Major

Over-constrained, machine-parsed output format violates agent prompt guidance.

This file is in .claude/agents/, and the new PASS/FAIL first-line requirement plus strict template/table mandates enforce a rigid, machine-parsed format. That conflicts with the guidance to keep these prompts flexible and not deterministically parsed. Please relax these requirements (e.g., make them “preferred/encouraged” with examples rather than mandatory).

As per coding guidelines, “In the .claude/agents/ directory, for all LLM agent prompt files (e.g., bug-scanner.md, code-review.md), do not enforce rigid, machine-parsed output format specifications. These prompts are consumed by LLMs that can handle flexible formats, and over-constraining the expected output provides no benefit since the output is not parsed deterministically by code.”

.claude/agents/code-review.md (1)

111-124: 🧹 Nitpick | 🔵 Trivial

Redundant reminders: PASS/FAIL requirement repeated 4 times.

The requirement for "PASS" or "FAIL" on the first line is stated at:

  • Line 8 (CRITICAL instruction)
  • Line 40 (Verdict section)
  • Line 114 (Pre-response checklist)
  • Line 122 (REMINDER section)

While emphasis is valuable, this level of repetition adds noise and maintenance burden. Consider consolidating to 2 mentions: once in the main instructions (line 8-10) and once in the pre-response checklist (line 114).

🤖 Fix all issues with AI agents
In @.claude/agents/code-review.md:
- Around line 8-10: There is a contradiction between the hard requirement line
"CRITICAL: Your very first output line MUST be exactly `PASS` or `FAIL`." and
the learning statement that says not to enforce rigid, machine-parsed output
formats; resolve by choosing one approach and updating the doc: either
remove/soften the "CRITICAL: Your very first output line MUST be exactly `PASS`
or `FAIL`." clause (or make it optional/annotated with why an orchestrator needs
it), or update the learning statement to acknowledge the orchestrator
requirement; ensure you change the exact quoted rule text and the learning
sentence so both are consistent and include brief rationale for the chosen
design.
- Around line 58-78: The "Full Audit Trail" requirement forces every PR to
include verdict rows for all 54 rules (SD-001..SD-021, AP-001..AP-006,
SP-001..SP-002, TS-001..TS-011, CS-001..CS-008, CR-001..CR-006), creating
excessive noise; change this to a scoped-audit policy that evaluates only
applicable rule sets based on changed files: detect file types/paths in the PR
and map them to rule groups (e.g., docs → CR-only, tests → TS + relevant SD/AP,
production code → full audit), generate verdict rows only for rules in the
selected groups, and mark other groups as intentionally out-of-scope (no
per-rule N/A rows) while keeping at least a summary line stating which rule sets
were evaluated; update the "Full Audit Trail" section and any code that renders
the audit table to implement this mapping and selection logic.

In `@docs/conventions/software-design.md`:
- Line 7: The document contains a duplicate "SD-001" heading which creates
conflicting anchors/TOC links; locate the second "SD-001" heading and either
rename it to a distinct title (suggestion: "SD-001: Fail-Fast Error Handling
(Details)") or convert it into a subheading beneath the primary SD-001 section,
then update any internal links/TOC references that point to the old duplicate
anchor so they reference the new unique heading.
- Line 365: The heading "SD-021: YAGNI - You Aren't Gonna Need It" uses informal
wording; update the title and any occurrences of "gonna" in the SD-021 section
to the formal phrase "going to" (e.g., change "You Aren't Gonna Need It" to "You
Aren't Going to Need It" or "You Are Not Going to Need It") to match the
conventions document tone and ensure consistency across the SD-021 section.

Comment thread .claude/agents/code-review.md
Comment thread .claude/agents/code-review.md
Comment thread docs/conventions/software-design.md
Comment thread docs/conventions/software-design.md
Sonnet was hardcoded but fails to comply with strict audit output format.
Opus is more reliable at following verdict-first output constraints.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
NTCoding and others added 3 commits January 30, 2026 21:32
Agents narrate before outputting PASS/FAIL. Scan first 5 lines for
verdict instead of requiring it on line 1 exactly.

Co-Authored-By: Claude Opus 4.5 <[email protected]>
watchCI returned success immediately when check_runs was empty,
treating it as "no CI configured". In practice, checks take time
to register after push. Now polls until checks appear.

Also fixes pre-existing test failure: missing GITHUB_TOKEN in
watchCI test setup.

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

Moves validation logic (file loading, JSON parsing, format checking) from
extract.ts into draft-component-loader.ts with DraftComponentLoadError.
Replaces 4 slow integration tests with fast unit tests.

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tools/dev-workflow/platform/infra/external-clients/github-rest-client.spec.ts (1)

303-318: ⚠️ Potential issue | 🟡 Minor

Restore the original GITHUB_TOKEN after tests.

Deleting unconditionally can erase a pre-set token and affect other suites. Restore to the prior value instead.

🔧 Suggested fix
 describe('github.watchCI', () => {
+  const originalToken = process.env.GITHUB_TOKEN
   beforeEach(() => {
     vi.clearAllMocks()
     process.env.GITHUB_TOKEN = 'test-token'
@@
   })
 
   afterEach(() => {
-    delete process.env.GITHUB_TOKEN
+    if (originalToken === undefined) {
+      delete process.env.GITHUB_TOKEN
+    } else {
+      process.env.GITHUB_TOKEN = originalToken
+    }
   })

Write per-step and total duration to reviews/{branch}/timings.md
after each workflow execution. Timing data collected in the generic
workflow runner, written to file by run-workflow.

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: 2

🤖 Fix all issues with AI agents
In `@docs/conventions/software-design.md`:
- Line 299: Locate the run-on sentence in the documentation section flagged by
the reviewer (the sentence that joins two independent clauses without proper
punctuation) and fix it by either adding a coordinating conjunction with a comma
(e.g., ", and" or ", but") between the clauses or by splitting it into two
separate sentences; ensure the second clause is capitalized and punctuation/verb
agreement remains correct after the change.

In `@tools/dev-workflow/platform/domain/workflow-execution/run-workflow.ts`:
- Around line 14-23: The exported function runWorkflow references non-exported
types WorkflowOptions, ContextBuilder, and ResultFormatter which causes
declaration emit errors; fix this by exporting those type declarations (add the
export keyword to the WorkflowOptions interface and to the ContextBuilder and
ResultFormatter type/interface declarations or re-export them from this module)
so the public signature only uses exported symbols, and update any
imports/exports if those types live in another file.

Comment thread docs/conventions/software-design.md
Comment thread tools/dev-workflow/platform/domain/workflow-execution/run-workflow.ts Outdated
…emit

ContextBuilder, ResultFormatter, and WorkflowOptions were not exported,
preventing TypeScript from emitting declarations for exported runWorkflow.

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

Copy link
Copy Markdown

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-D2.6] Add CLI flags for extraction modes

1 participant