Skip to content

feat: add --config flag for chronicle.yaml path#26

Open
rsbh wants to merge 3 commits intomainfrom
feat_config_file_arg
Open

feat: add --config flag for chronicle.yaml path#26
rsbh wants to merge 3 commits intomainfrom
feat_config_file_arg

Conversation

@rsbh
Copy link
Copy Markdown
Member

@rsbh rsbh commented Mar 31, 2026

Summary

  • Add --config <path> flag to dev, build, and serve commands to specify chronicle.yaml location
  • Remove -c short arg from --content across all commands to avoid future conflicts
  • Config resolution: --config flag takes priority over cwd lookup; removed content dir fallback

Test plan

  • Build CLI successfully
  • Verified --help shows --config option
  • Tested --config flag from different cwd — dev server starts with correct config

🤖 Generated with Claude Code

rsbh and others added 2 commits March 31, 2026 08:39
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8cf23ba7-7c0a-49de-bedb-21825cd6fd1b

📥 Commits

Reviewing files that changed from the base of the PR and between f0d6038 and 3a9d126.

📒 Files selected for processing (1)
  • packages/chronicle/src/server/vite-config.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/chronicle/src/server/vite-config.ts

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added a --config option to build, dev, and serve to specify a custom chronicle.yaml path.
  • Breaking Changes

    • Removed the -c shorthand for --content; use --content (long form only).
    • Config lookup behavior changed: when --config is provided it uses that file; otherwise it no longer falls back to the content directory and checks the project/cwd location.

Walkthrough

CLI commands drop the -c shorthand for --content, add a new --config <path> option, and propagate a resolved configPath through CLI utilities into Vite config creation; config resolution logic now prefers an explicit config flag and removes content-directory fallbacks.

Changes

Cohort / File(s) Summary
CLI Commands
packages/chronicle/src/cli/commands/build.ts, packages/chronicle/src/cli/commands/dev.ts, packages/chronicle/src/cli/commands/serve.ts, packages/chronicle/src/cli/commands/start.ts
Removed -c short alias for --content (now long-only); added --config <path> to build/dev/serve; updated command actions to resolve configPath and pass it into createViteConfig where applicable.
Config Utilities
packages/chronicle/src/cli/utils/config.ts
Exported and changed resolveConfigPath to accept an optional configFlag?: string (no longer derives from contentDir); updated loadCLIConfig to accept configFlag and rely on the new resolution behavior; removed contentDir-based fallback lookup and adjusted error messages.
Vite Configuration
packages/chronicle/src/server/vite-config.ts
Added optional configPath?: string to ViteConfigOptions; updated createViteConfig/config reading to accept an explicit configPath, read that file when provided, and otherwise fall back to projectRoot-only lookup (removed contentDir fallback).

Sequence Diagram(s)

mermaid
sequenceDiagram
participant CLI as CLI Command
participant Resolver as resolveConfigPath
participant Loader as loadCLIConfig
participant Vite as createViteConfig
participant FS as Filesystem

CLI->>Resolver: pass options.config (optional)
Resolver->>FS: read provided config path or check projectRoot/chronicle.yaml
Resolver-->>CLI: return configPath or null
CLI->>Loader: call loadCLIConfig(contentDir, configPath)
Loader->>Vite: pass configPath into createViteConfig
Vite->>FS: read chronicle.yaml using configPath or projectRoot
Vite-->>CLI: return resolved Vite config

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • rohilsurana
  • rohanchkrabrty
🚥 Pre-merge checks | ✅ 2 | ❌ 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 (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main feature being added: the --config flag for specifying chronicle.yaml path.
Description check ✅ Passed The description directly addresses the changeset, outlining the new --config flag addition, -c shorthand removal, and config resolution behavior changes with verification steps.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat_config_file_arg

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.

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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/chronicle/src/server/vite-config.ts`:
- Around line 26-33: The readChronicleConfig function currently swallows read
errors when a user supplies a configPath; change the behavior so that when
configPath is provided and fs.readFile fails you do not return null but instead
surface the error (either rethrow the caught error or throw a new Error that
includes the provided configPath and the original error message) so callers know
the explicit config is unreadable; update the try/catch around fs.readFile in
readChronicleConfig to include the configPath in the error context and propagate
the failure rather than silently returning null.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ef651e45-ab60-45d5-a7e2-de5ae51da3dc

📥 Commits

Reviewing files that changed from the base of the PR and between 8c3b2b6 and f0d6038.

📒 Files selected for processing (6)
  • packages/chronicle/src/cli/commands/build.ts
  • packages/chronicle/src/cli/commands/dev.ts
  • packages/chronicle/src/cli/commands/serve.ts
  • packages/chronicle/src/cli/commands/start.ts
  • packages/chronicle/src/cli/utils/config.ts
  • packages/chronicle/src/server/vite-config.ts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@rsbh rsbh requested a review from rohanchkrabrty March 31, 2026 03:30
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