Skip to content

feat: add file-backed data repo and CLI#223

Merged
duncanleo merged 14 commits into
mainfrom
codex/file-backed-repo-cli
May 14, 2026
Merged

feat: add file-backed data repo and CLI#223
duncanleo merged 14 commits into
mainfrom
codex/file-backed-repo-cli

Conversation

@duncanleo
Copy link
Copy Markdown
Member

@duncanleo duncanleo commented May 12, 2026

Summary

Adds the next data-overhaul slice after @mrtdown/core:

  • adds @mrtdown/fs with file-backed target-layout readers, writers, manifest generation, Pages index rendering, issue ID helpers, and validation
  • adds @mrtdown/cli with validate, list, show, create, id issue, manifest, and pages-index commands
  • adds a small deterministic fixtures/data target-layout dataset for package and CLI tests
  • wires the new package builds, tests, fixture validation, Docker install manifests, CI, and docs

Impact

This does not migrate production data or wire the legacy runtime to the new packages. It gives later migration PRs a reviewed filesystem API and CLI surface to validate and inspect target-layout data before generated data lands.

Validation

  • npm run check
  • npm run typecheck
  • npm test -- --run
  • npm run build:core
  • npm run build:fs
  • npm run build:cli
  • npm run test:fs
  • npm run test:cli
  • npm run data:validate

Did not run legacy npm run build because it still triggers the existing postbuild Sentry sourcemap upload path.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a command-line interface for validating data, listing entities, displaying records, and creating new issues.
    • Added filesystem utilities for managing and validating data files.
    • Expanded build and test infrastructure to support multiple modular packages.
  • Tests

    • Added comprehensive test coverage for CLI operations and filesystem functionality.
  • Documentation

    • Updated development guides with expanded build and test commands.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 12, 2026

Warning

Rate limit exceeded

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

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ 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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e236e591-e9c9-427a-848d-5e7af8a4df3e

📥 Commits

Reviewing files that changed from the base of the PR and between 57c127c and 599bbe8.

📒 Files selected for processing (5)
  • fixtures/data/issue/2026/02/2026-02-07-tgl-maintenance/impact.ndjson
  • fixtures/data/service/SLL_MAIN_N.json
  • fixtures/data/service/SLL_MAIN_S.json
  • fixtures/data/service/TGL_MAIN_E.json
  • fixtures/data/service/TGL_MAIN_W.json
📝 Walkthrough

Walkthrough

This PR expands the monorepo by introducing two new npm packages—@mrtdown/fs (filesystem I/O, manifest building, validation) and @mrtdown/cli (command-line interface)—alongside fixture data and schema improvements. The core IssueIdSchema is updated to validate real calendar dates. Integration into the workspace includes updated CI workflows, Docker context, and documentation.

Changes

Monorepo Package Expansion

Layer / File(s) Summary
Workspace integration and CI/Docker updates
.github/workflows/validate.yml, package.json, Dockerfile, AGENTS.md, README.md
Root scripts, CI workflow, and Docker build context updated to include workspace build/test commands for core/fs/cli packages and a new npm run data:validate command. Documentation reflects new package split.
Core schema: IssueIdSchema calendar date validation
packages/core/src/schema/issue/id.ts, packages/core/src/schema/issue/id.test.ts
IssueIdSchema reworked to validate real calendar dates using Luxon and exports IssueIdPattern. Distinct error messages for format vs. invalid date.
packages/fs: package setup and constants
packages/fs/package.json, packages/fs/biome.json, packages/fs/tsconfig.json, packages/fs/src/constants.ts
Introduces @mrtdown/fs package manifest, TypeScript/Biome configs, and exports entity collection names, directories, and issue filenames.
packages/fs: path normalization and JSON/NDJSON I/O
packages/fs/src/paths.ts, packages/fs/src/json.ts
Implements toDataPath for forward-slash normalization, readJsonFile/writeJsonFile, readNdjsonFile/writeNdjsonFile with Zod validation and line-number error reporting.
packages/fs: entity persistence
packages/fs/src/entities.ts
Defines EntityRecord, implements entityPath, listEntityIds, readEntity, listEntities, writeEntity, writeUnknownEntity with ID safety and safe-filename validation.
packages/fs: issue ID and bundle handling
packages/fs/src/id.ts, packages/fs/src/issues.ts
Issue ID slugification, YYYY-MM-DD-slug building/validation, issue bundle I/O (read/list/create with NDJSON evidence/impact), existence checks, and NewIssueInput type.
packages/fs: manifest, pages index, and validation
packages/fs/src/manifest.ts, packages/fs/src/pagesIndex.ts, packages/fs/src/validate.ts, packages/fs/src/index.ts
buildManifest construction from entities and issues, renderPagesIndex HTML generation, validateDataRoot scope-based validation, and barrel export.
packages/fs: integration tests
packages/fs/src/index.test.ts
Comprehensive tests for entity I/O, issue creation, manifest building, path normalization, ID validation, concurrency, NDJSON parsing, and fixture validation.
packages/cli: setup and build
packages/cli/package.json, packages/cli/biome.json, packages/cli/tsconfig.json, packages/cli/scripts/ensure-shebang.mjs
Defines @mrtdown/cli package manifest with mrtdown bin entry, TypeScript/Biome configs, and ensure-shebang build helper for executable permissions.
packages/cli: implementation
packages/cli/src/index.ts
CLI dispatcher (runCli), argument parsing (global --data-dir), and handlers for validate, list, show, create, id, manifest, and pages-index commands with CliIO output routing.
packages/cli: tests
packages/cli/src/index.test.ts
Vitest suite with I/O capture for stdout/stderr, tests for validate, list, show, and create (issue/station/from-file) commands with path resolution verification.
Fixture test data
fixtures/README.md, fixtures/data/line/*, fixtures/data/service/*, fixtures/data/station/*, fixtures/data/issue/*/...
Adds complete fixture data: TGL and SLL lines, four services, 17 stations, and two issue bundles with evidence and impact NDJSON records.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • foldaway/mrtdown-data#222: Both PRs update .github/workflows/validate.yml to add build and test steps (npm run build:core, db:generate, npm run test:core), with this PR stacking additional fs/cli build/test commands on top.

🐰 Two packages rise from the digital sod,
Filesystem helpers and CLI rod,
Fixtures bloom with stations, lines in test,
The monorepo grows, put to the best!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ 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: add file-backed data repo and CLI' accurately summarizes the main changes: it introduces two new packages (@mrtdown/fs for file-backed data operations and @mrtdown/cli for command-line interface) plus supporting infrastructure.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/file-backed-repo-cli

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.

@duncanleo duncanleo marked this pull request as ready for review May 12, 2026 16:12
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (6)
packages/fs/src/paths.ts (1)

1-3: ⚡ Quick win

Consider using Node.js path.posix for more robust path normalization.

The current implementation uses a simple regex replacement to convert backslashes to forward slashes. While this works for basic cases, it doesn't handle edge cases like:

  • Mixed path separators
  • UNC paths on Windows
  • Path traversal sequences (.., .)
  • Duplicate separators

Consider using Node.js built-in path.posix.normalize() for more robust cross-platform path handling, or at minimum document the function's limitations if the simple approach is intentional for this specific use case.

♻️ Alternative implementation using path.posix
+import { posix } from 'node:path';
+
 export function toDataPath(path: string): string {
-  return path.replace(/\\/g, '/');
+  return posix.normalize(path.replace(/\\/g, '/'));
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/fs/src/paths.ts` around lines 1 - 3, The toDataPath function
currently does a simple backslash-to-slash replacement which misses edge cases;
update to use Node's path.posix.normalize to robustly normalize separators,
collapse duplicate slashes and resolve '.'/'..' segments (or explicitly document
the limitations if you must keep the simple replace). Locate the function
toDataPath in packages/fs/src/paths.ts and replace the regex approach with
path.posix.normalize-based normalization (importing path from 'path') or add a
clear comment explaining that the implementation intentionally only replaces
backslashes and does not handle UNC paths, traversal, or duplicate separators.
packages/fs/tsconfig.json (1)

14-16: ⚡ Quick win

Exclude test files from the TypeScript build.

The pattern "src/**/*.ts" includes test files like index.test.ts in compilation. With declaration: true and outDir: "./dist", this generates unnecessary .d.ts files for tests in the published package. Add an exclude pattern to keep the build clean.

Proposed tsconfig adjustment
 {
   "compilerOptions": {
     "target": "es2022",
     "module": "es2022",
     "moduleResolution": "bundler",
     "declaration": true,
     "sourceMap": true,
     "outDir": "./dist",
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
     "strict": true,
     "skipLibCheck": true
   },
   "include": [
     "src/**/*.ts"
-  ]
+  ],
+  "exclude": [
+    "src/**/*.test.ts",
+    "src/**/*.spec.ts"
+  ]
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/fs/tsconfig.json` around lines 14 - 16, The tsconfig currently uses
the include pattern "src/**/*.ts" which pulls test files (e.g., index.test.ts)
into the build and produces unwanted declaration files; add an "exclude" array
to the same tsconfig.json to filter out test files and test directories (for
example patterns like "**/*.test.ts", "**/*.spec.ts", and "**/__tests__/**") so
that when declaration: true and outDir: "./dist" are used the test files are not
compiled or emitted; update the tsconfig.json to include this exclude entry
alongside the existing include.
packages/cli/tsconfig.json (1)

14-16: ⚡ Quick win

Consider excluding test files from TypeScript compilation.

Test files are currently included in the build output via the src/**/*.ts pattern. While published artifacts are already gated by the "files": ["dist"] field in package.json, it's cleaner to explicitly exclude test files from compilation to avoid unnecessary emit and follow TypeScript best practices.

Proposed tsconfig adjustment
 {
   "compilerOptions": {
     "target": "es2022",
     "module": "es2022",
     "moduleResolution": "bundler",
     "declaration": true,
     "sourceMap": true,
     "outDir": "./dist",
     "esModuleInterop": true,
     "forceConsistentCasingInFileNames": true,
     "strict": true,
     "skipLibCheck": true
   },
   "include": [
-    "src/**/*.ts"
+    "src/**/*.ts"
   ],
+  "exclude": [
+    "src/**/*.test.ts",
+    "src/**/*.spec.ts"
+  ]
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/tsconfig.json` around lines 14 - 16, The tsconfig currently
includes "src/**/*.ts" which pulls test files into compilation; update the
tsconfig.json to explicitly exclude test files (e.g. patterns like
"**/*.test.ts", "**/*.spec.ts", and test directories such as
"src/**/__tests__/**") so TypeScript does not emit test sources—add an "exclude"
array with these patterns alongside the existing "include" entry to prevent
tests from being compiled.
packages/fs/src/validate.ts (1)

18-28: 💤 Low value

Consider deriving scope list from constants to prevent drift.

The hardcoded scope list could become out of sync if entity collections are added or removed elsewhere.

🔧 Suggested refactor
+import type { ValidationScope } from './validate.js';
+
 function emptyChecked(): Record<ValidationScope, number> {
-  return {
-    landmark: 0,
-    line: 0,
-    operator: 0,
-    service: 0,
-    station: 0,
-    town: 0,
-    issue: 0,
-  };
+  const checked: Record<ValidationScope, number> = {} as Record<ValidationScope, number>;
+  for (const collection of entityCollections) {
+    checked[collection] = 0;
+  }
+  checked.issue = 0;
+  return checked;
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/fs/src/validate.ts` around lines 18 - 28, The hardcoded scope map in
emptyChecked() can drift from the canonical scope definitions; change
emptyChecked to dynamically build and return a Record<ValidationScope, number>
by iterating over the authoritative scope source (for example the
ValidationScope enum or a VALIDATION_SCOPES/validationScopes constant) and
setting each key's value to 0. Replace the hardcoded object in emptyChecked()
with a reducer or Object.fromEntries over that canonical list so new/removed
scopes are automatically included and types remain ValidationScope.
packages/fs/src/issues.ts (1)

36-42: ⚡ Quick win

Clarify expected ID format in error message.

The error message on Line 39 indicates the ID is invalid but doesn't specify the expected format, making it harder for developers to debug.

💬 Suggested improvement
 export function issuePathFromId(dataDir: string, id: string): string {
   const [year, month] = id.split('-');
   if (!year || !month) {
-    throw new Error(`Invalid issue id: ${id}`);
+    throw new Error(`Invalid issue id: ${id} (expected format: YYYY-MM-...)`);
   }
   return join(dataDir, issueDirectory, year, month, id);
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/fs/src/issues.ts` around lines 36 - 42, The error thrown in
issuePathFromId when id.split('-') doesn't yield a year and month should be more
descriptive: update the thrown Error in function issuePathFromId to include the
expected ID pattern (e.g. "expected format 'YYYY-MM-<suffix>'" or a concrete
example like "2023-05-123") so callers know the required format; locate the
check that throws new Error(`Invalid issue id: ${id}`) and replace the message
with one that includes the expected pattern and an example, referencing
issuePathFromId, the id parameter, and issueDirectory/join usage so the intent
is clear.
packages/fs/src/json.ts (1)

22-31: ⚡ Quick win

Consider wrapping validation errors with line number context.

When schema validation fails on Line 30, the error won't indicate which NDJSON line failed, making debugging harder for malformed data files.

💡 Suggested enhancement to add line context
 export async function readNdjsonFile<T>(
   path: string,
   schema: z.ZodType<T>,
 ): Promise<T[]> {
   const text = await readFile(path, 'utf8');
-  return text
+  const lines = text
     .split('\n')
-    .filter((line) => line.trim().length > 0)
-    .map((line) => schema.parse(JSON.parse(line) as unknown));
+    .filter((line) => line.trim().length > 0);
+  return lines.map((line, index) => {
+    try {
+      return schema.parse(JSON.parse(line) as unknown);
+    } catch (error) {
+      throw new Error(`Line ${index + 1}: ${error instanceof Error ? error.message : String(error)}`);
+    }
+  });
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/fs/src/json.ts` around lines 22 - 31, The readNdjsonFile function
currently maps over lines without associating validation failures to their
NDJSON line number; modify readNdjsonFile to iterate with index (forEach or for
loop), and for each line wrap JSON.parse and schema.parse in a try/catch that,
on error, rethrows a new Error (or zod error with .cause) that includes the
NDJSON line index (1-based), the original error message (or error as cause), and
optionally the offending line content; reference readNdjsonFile, JSON.parse, and
schema.parse when adding the try/catch and enriched error message so callers can
see which NDJSON line failed validation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/cli/package.json`:
- Around line 17-19: The CLI package's compiled entrypoint (dist/index.js) loses
the Node shebang from src/index.ts, breaking the mrtdown bin; add a post-build
step in packages/cli/package.json (e.g., "postbuild") that restores the shebang
on dist/index.js (or configure the bundler) — run a small command after build to
prepend "#!/usr/bin/env node" to dist/index.js so the "bin":
{"mrtdown":"dist/index.js"} entry works when installed.

---

Nitpick comments:
In `@packages/cli/tsconfig.json`:
- Around line 14-16: The tsconfig currently includes "src/**/*.ts" which pulls
test files into compilation; update the tsconfig.json to explicitly exclude test
files (e.g. patterns like "**/*.test.ts", "**/*.spec.ts", and test directories
such as "src/**/__tests__/**") so TypeScript does not emit test sources—add an
"exclude" array with these patterns alongside the existing "include" entry to
prevent tests from being compiled.

In `@packages/fs/src/issues.ts`:
- Around line 36-42: The error thrown in issuePathFromId when id.split('-')
doesn't yield a year and month should be more descriptive: update the thrown
Error in function issuePathFromId to include the expected ID pattern (e.g.
"expected format 'YYYY-MM-<suffix>'" or a concrete example like "2023-05-123")
so callers know the required format; locate the check that throws new
Error(`Invalid issue id: ${id}`) and replace the message with one that includes
the expected pattern and an example, referencing issuePathFromId, the id
parameter, and issueDirectory/join usage so the intent is clear.

In `@packages/fs/src/json.ts`:
- Around line 22-31: The readNdjsonFile function currently maps over lines
without associating validation failures to their NDJSON line number; modify
readNdjsonFile to iterate with index (forEach or for loop), and for each line
wrap JSON.parse and schema.parse in a try/catch that, on error, rethrows a new
Error (or zod error with .cause) that includes the NDJSON line index (1-based),
the original error message (or error as cause), and optionally the offending
line content; reference readNdjsonFile, JSON.parse, and schema.parse when adding
the try/catch and enriched error message so callers can see which NDJSON line
failed validation.

In `@packages/fs/src/paths.ts`:
- Around line 1-3: The toDataPath function currently does a simple
backslash-to-slash replacement which misses edge cases; update to use Node's
path.posix.normalize to robustly normalize separators, collapse duplicate
slashes and resolve '.'/'..' segments (or explicitly document the limitations if
you must keep the simple replace). Locate the function toDataPath in
packages/fs/src/paths.ts and replace the regex approach with
path.posix.normalize-based normalization (importing path from 'path') or add a
clear comment explaining that the implementation intentionally only replaces
backslashes and does not handle UNC paths, traversal, or duplicate separators.

In `@packages/fs/src/validate.ts`:
- Around line 18-28: The hardcoded scope map in emptyChecked() can drift from
the canonical scope definitions; change emptyChecked to dynamically build and
return a Record<ValidationScope, number> by iterating over the authoritative
scope source (for example the ValidationScope enum or a
VALIDATION_SCOPES/validationScopes constant) and setting each key's value to 0.
Replace the hardcoded object in emptyChecked() with a reducer or
Object.fromEntries over that canonical list so new/removed scopes are
automatically included and types remain ValidationScope.

In `@packages/fs/tsconfig.json`:
- Around line 14-16: The tsconfig currently uses the include pattern
"src/**/*.ts" which pulls test files (e.g., index.test.ts) into the build and
produces unwanted declaration files; add an "exclude" array to the same
tsconfig.json to filter out test files and test directories (for example
patterns like "**/*.test.ts", "**/*.spec.ts", and "**/__tests__/**") so that
when declaration: true and outDir: "./dist" are used the test files are not
compiled or emitted; update the tsconfig.json to include this exclude entry
alongside the existing include.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ef39f0d9-919b-4093-b02f-a762903efd92

📥 Commits

Reviewing files that changed from the base of the PR and between cb60202 and aa31d7d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (33)
  • .github/workflows/validate.yml
  • AGENTS.md
  • Dockerfile
  • README.md
  • fixtures/data/issue/2024/01/2024-01-15-circle-line-delay/evidence.ndjson
  • fixtures/data/issue/2024/01/2024-01-15-circle-line-delay/impact.ndjson
  • fixtures/data/issue/2024/01/2024-01-15-circle-line-delay/issue.json
  • fixtures/data/landmark/millenia-walk.json
  • fixtures/data/line/ccl.json
  • fixtures/data/operator/smrt-trains.json
  • fixtures/data/service/ccl-main.json
  • fixtures/data/station/promenade.json
  • fixtures/data/town/downtown-core.json
  • package.json
  • packages/cli/biome.json
  • packages/cli/package.json
  • packages/cli/src/index.test.ts
  • packages/cli/src/index.ts
  • packages/cli/tsconfig.json
  • packages/fs/biome.json
  • packages/fs/package.json
  • packages/fs/src/constants.ts
  • packages/fs/src/entities.ts
  • packages/fs/src/id.ts
  • packages/fs/src/index.test.ts
  • packages/fs/src/index.ts
  • packages/fs/src/issues.ts
  • packages/fs/src/json.ts
  • packages/fs/src/manifest.ts
  • packages/fs/src/pagesIndex.ts
  • packages/fs/src/paths.ts
  • packages/fs/src/validate.ts
  • packages/fs/tsconfig.json

Comment thread packages/cli/package.json
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/fs/src/issues.ts`:
- Around line 139-147: Replace the non-atomic check-then-create pattern: remove
the call to issueExists(dataDir, issue.id) and instead create the parent path(s)
with mkdir(parentDir, { recursive: true }) and then atomically claim the leaf
directory by calling mkdir(issueDir) without { recursive: true }; if that second
mkdir throws EEXIST (or returns that it already exists) throw the "Issue already
exists: ${issue.id}" error. After successfully claiming the leaf directory,
proceed to writeJsonFile(join(issueDir, issueFileName), issue) and
writeNdjsonFile for evidenceFileName and impactFileName as before; reference
functions/vars: issuePathFromId, mkdir, writeJsonFile, writeNdjsonFile,
issueFileName, evidenceFileName, impactFileName.

In `@packages/fs/src/json.ts`:
- Around line 38-42: The throw site using the unsupported overload "throw new
Error(..., { cause: error })" should be changed to construct a plain Error,
assign the cause property explicitly, and then throw it; locate the throw of
Error in packages/fs/src/json.ts that uses "throw new Error(..., { cause: error
})", replace it with code that creates an Error instance with the same message,
set error.cause = error (or via a narrow type cast) to preserve the original
cause, and then throw that Error object so TypeScript compiles without requiring
ErrorOptions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 777bf005-b8ca-4c83-ab40-db72e04ead0e

📥 Commits

Reviewing files that changed from the base of the PR and between aa31d7d and 2f3ea78.

📒 Files selected for processing (9)
  • packages/cli/package.json
  • packages/cli/scripts/ensure-shebang.mjs
  • packages/cli/tsconfig.json
  • packages/fs/src/index.test.ts
  • packages/fs/src/issues.ts
  • packages/fs/src/json.ts
  • packages/fs/src/paths.ts
  • packages/fs/src/validate.ts
  • packages/fs/tsconfig.json
✅ Files skipped from review due to trivial changes (2)
  • packages/cli/package.json
  • packages/cli/tsconfig.json
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/fs/tsconfig.json
  • packages/fs/src/paths.ts
  • packages/fs/src/validate.ts

Comment thread packages/fs/src/issues.ts Outdated
Comment thread packages/fs/src/json.ts Outdated
@duncanleo duncanleo changed the title [codex] add file-backed data repo and CLI feat: add file-backed data repo and CLI May 13, 2026
@duncanleo
Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@foldaway foldaway deleted a comment from chatgpt-codex-connector Bot May 13, 2026
@foldaway foldaway deleted a comment from chatgpt-codex-connector Bot May 13, 2026
@duncanleo
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2efadf292

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/fs/src/entities.ts
Comment thread packages/cli/src/index.ts Outdated
@duncanleo
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ddc3b82a2e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/fs/src/manifest.ts Outdated
Comment thread packages/fs/src/id.ts
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@fixtures/data/issue/2026/02/2026-02-07-tgl-maintenance/impact.ndjson`:
- Around line 3-4: The service_scopes entries for events with ids ie_3 and ie_4
contain duplicate identical scopes; update the JSON so each "serviceScopes"
array contains a single {"type":"service.whole"} element instead of two
duplicates (i.e., modify the objects with "id": "ie_3" and "id": "ie_4" to have
"serviceScopes": [{"type":"service.whole"}]) to remove redundancy while
preserving all other fields like "entity", "ts", and "basis".

In `@fixtures/data/service/SLL_MAIN_N.json`:
- Around line 18-24: The service revision contains duplicate displayCode "SL9"
for two stops (stationId "HBF" and "GSW") which creates ambiguous stop codes;
update the revision in SLL_MAIN_N.json so each stopId has a unique displayCode
within this revision path—locate the entries with stationId "HBF" and "GSW" and
change one of the "displayCode" values to the correct unique code (or
remove/rename per the canonical stop code mapping used by your system) and run
any relevant validation to ensure no other duplicates remain.

In `@fixtures/data/service/TGL_MAIN_E.json`:
- Around line 38-44: The eastbound stops array contains a duplicated stop object
with "stationId": "BMC" and "displayCode": "TG6" (the consecutive entries shown
in the diff); remove the duplicate entry from the eastbound path so the route
order only contains a single {"stationId":"BMC","displayCode":"TG6"} object,
ensuring the JSON array remains valid (commas adjusted if needed) and the route
ordering is preserved.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 0a58a792-26de-48f0-b8b2-4b5a629c8219

📥 Commits

Reviewing files that changed from the base of the PR and between 2f3ea78 and 57c127c.

📒 Files selected for processing (39)
  • fixtures/README.md
  • fixtures/data/issue/2026/01/2026-01-01-tgl-train-fault/evidence.ndjson
  • fixtures/data/issue/2026/01/2026-01-01-tgl-train-fault/impact.ndjson
  • fixtures/data/issue/2026/01/2026-01-01-tgl-train-fault/issue.json
  • fixtures/data/issue/2026/02/2026-02-07-tgl-maintenance/evidence.ndjson
  • fixtures/data/issue/2026/02/2026-02-07-tgl-maintenance/impact.ndjson
  • fixtures/data/issue/2026/02/2026-02-07-tgl-maintenance/issue.json
  • fixtures/data/line/SLL.json
  • fixtures/data/line/TGL.json
  • fixtures/data/service/SLL_MAIN_N.json
  • fixtures/data/service/SLL_MAIN_S.json
  • fixtures/data/service/TGL_MAIN_E.json
  • fixtures/data/service/TGL_MAIN_W.json
  • fixtures/data/station/BBT.json
  • fixtures/data/station/BKB.json
  • fixtures/data/station/BMC.json
  • fixtures/data/station/BTW.json
  • fixtures/data/station/FNV.json
  • fixtures/data/station/GSW.json
  • fixtures/data/station/HBF.json
  • fixtures/data/station/OTP.json
  • fixtures/data/station/QSW.json
  • fixtures/data/station/SER.json
  • fixtures/data/station/SKG.json
  • fixtures/data/station/SLA.json
  • fixtures/data/station/SLT.json
  • fixtures/data/station/TBW.json
  • fixtures/data/station/TGH.json
  • fixtures/data/station/TLH.json
  • fixtures/data/station/UTS.json
  • packages/cli/src/index.test.ts
  • packages/cli/src/index.ts
  • packages/core/src/schema/issue/id.test.ts
  • packages/core/src/schema/issue/id.ts
  • packages/fs/src/entities.ts
  • packages/fs/src/index.test.ts
  • packages/fs/src/issues.ts
  • packages/fs/src/json.ts
  • packages/fs/src/manifest.ts
✅ Files skipped from review due to trivial changes (15)
  • fixtures/README.md
  • fixtures/data/station/SLT.json
  • fixtures/data/issue/2026/02/2026-02-07-tgl-maintenance/issue.json
  • fixtures/data/issue/2026/01/2026-01-01-tgl-train-fault/evidence.ndjson
  • fixtures/data/line/TGL.json
  • fixtures/data/station/TLH.json
  • fixtures/data/station/OTP.json
  • fixtures/data/station/BBT.json
  • fixtures/data/station/TGH.json
  • fixtures/data/service/TGL_MAIN_W.json
  • fixtures/data/issue/2026/02/2026-02-07-tgl-maintenance/evidence.ndjson
  • fixtures/data/service/SLL_MAIN_S.json
  • fixtures/data/issue/2026/01/2026-01-01-tgl-train-fault/issue.json
  • fixtures/data/station/HBF.json
  • fixtures/data/station/TBW.json
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/fs/src/entities.ts
  • packages/cli/src/index.ts

Comment thread fixtures/data/issue/2026/02/2026-02-07-tgl-maintenance/impact.ndjson Outdated
Comment thread fixtures/data/service/SLL_MAIN_N.json
Comment thread fixtures/data/service/TGL_MAIN_E.json Outdated
@duncanleo duncanleo merged commit 9cb1083 into main May 14, 2026
2 checks passed
@duncanleo duncanleo deleted the codex/file-backed-repo-cli branch May 14, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant