feat: support loading config from explicit path#78
Conversation
Deploying rstack-cli with
|
| Latest commit: |
61f31bd
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://32a9c880.rstack-cli.pages.dev |
| Branch Preview URL: | https://chenjiahan-feat-load-explici.rstack-cli.pages.dev |
|
Warning Review limit reached
Next review available in: 43 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthrough
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/rstack/src/config.ts`:
- Around line 29-32: The documentation comment for configFilePath should
describe the actual fallback precedence: when the option is omitted, use the
CLI-provided state.configPath first, and perform default config-file discovery
only when that state path is unset. Update the wording near configFilePath
without changing implementation behavior.
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 9ddd99ad-9c1d-46fb-be19-d0f8a14022ba
📒 Files selected for processing (5)
packages/rstack/src/config.tspackages/rstack/tests/config/load-state/explicit-dependency.tspackages/rstack/tests/config/load-state/explicit.config.tspackages/rstack/tests/config/load-state/fresh.config.tspackages/rstack/tests/config/load-state/index.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f83b47e3da
ℹ️ 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".
| fresh: true, | ||
| ...(state.configPath !== undefined | ||
| ? { path: state.configPath } | ||
| fresh, |
There was a problem hiding this comment.
Preserve configs when cache reuse is requested
When the same file is loaded more than once with fresh: false, the native loader reuses the already evaluated module, so its define.* calls do not run again. Because loadRstackConfig clears state.configs before every load and again in finally, the second call returns an empty configs object rather than the cached configuration. This makes repeated calls—the primary scenario for disabling cache bypass—incorrect; either cache the collected configs alongside the module or avoid exposing fresh: false for this side-effect-based loader.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dad79428e9
ℹ️ 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".
| export const loadRstackConfig = async ({ | ||
| configFilePath, | ||
| }: LoadRstackConfigOptions = {}): Promise<LoadedRstackConfig> => { |
There was a problem hiding this comment.
Expose the explicit-path loader
Published consumers cannot use this option: packages/rstack/src/index.ts exports only define and runCLI, the package export map has no ./config entry, and no production caller invokes loadRstackConfig with configFilePath. Consequently, the new explicit-path behavior is reachable only from source-level tests and adds no usable package capability; export a supported loader API or wire the option into an existing public consumer.
Useful? React with 👍 / 👎.
Summary
Rstack config consumers need to load a known
rstack.config.*file without relying on CLI-global state. This PR adds aconfigFilePathoption toloadRstackConfig, resolves explicit relative paths from the current working directory, and preserves the existing CLI-state and default-discovery fallbacks. It also covers explicit-path precedence, dependency reporting, missing files, and state cleanup.