feat(cli): add build needed check#2208
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Rate limit exceeded
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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
📝 WalkthroughWalkthroughThis PR introduces a new ChangesBuild Needed Command Implementation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🧹 Nitpick comments (2)
cli/src/index.ts (1)
766-770: ⚡ Quick winReuse the shared
--verbosedescription here.This adds a one-off
--verbosehelp string even thoughoptionDescriptions.verbosealready exists. Keeping the shared text here avoids help and README drift for the same flag. As per coding guidelines "cli/src/index.ts: Reuse shared option descriptions fromsrc/index.tswhen an option already exists instead of introducing slightly different wording".🤖 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 `@cli/src/index.ts` around lines 766 - 770, Replace the inline help string for the --verbose CLI option with the shared description constant to avoid drift: locate the chain that registers the flag (the .option('--verbose', `Show package-level native dependency changes`) call) and swap the literal string for optionDescriptions.verbose so the flag uses the shared text; ensure you import/retain the optionDescriptions object in this scope if not already present.cli/webdocs/build.mdx (1)
27-27: ⚡ Quick winClarify exit code behavior for both cases.
The description currently states "exit 1 when local native dependency metadata requires a new native build" but doesn't explicitly mention the exit code when no build is needed. For CI/CD automation, users need to understand both scenarios clearly.
Consider revising to something like:
- "Print 'yes' and exit with code 1 if a native build is required, otherwise print 'no' and exit with code 0."
This makes the command's behavior unambiguous for pipeline integration.
🤖 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 `@cli/webdocs/build.mdx` at line 27, Update the single-line description so it explicitly states both outcomes: change the current sentence that mentions only "exit 1 when local native dependency metadata requires a new native build" to something like: "Print 'yes' and exit with code 1 if a native build is required; otherwise print 'no' and exit with code 0." Ensure the wording replaces the existing line that begins with the emoji and short description so CI/CD users can unambiguously detect both cases.
🤖 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 `@cli/src/build/needed.ts`:
- Around line 106-119: getPublicDefaultChannelName currently selects all rows
where public = true and then relies on selectDefaultChannelName to pick the
default; this fails when multiple public channels exist. Update the Supabase
query in getPublicDefaultChannelName to also filter by the actual
default-channel predicate (e.g., add .eq('is_default', true) or the real column
name used for default channels) so the query returns only the default public
channel before passing rows into selectDefaultChannelName (keep the table
'channels' and function names getPublicDefaultChannelName and
selectDefaultChannelName).
- Around line 302-318: The catch block in checkBuildNeeded currently rethrows
all errors which causes auth/network/config failures to produce the same exit
status as "build needed"; change the error path to set a distinct failure exit
code (e.g. process.exitCode = 2) and do not rethrow so callers can distinguish
command failure from build-needed semantics; update the catch in
checkBuildNeeded (which calls getBuildNeeded and uses getBuildNeededExitCode) to
log the error and set process.exitCode = 2 (and return) instead of throwing the
error.
- Around line 165-175: getNativeDiffLabel currently only considers a platform
changed if both local and remote checksums exist; update the change detection to
also treat checksum addition/removal as a change by computing iosChanged as
"(entry.localIosChecksum || entry.remoteIosChecksum) && entry.localIosChecksum
!== entry.remoteIosChecksum" and androidChanged similarly using
localAndroidChecksum/remoteAndroidChecksum, then keep the existing return logic
in getNativeDiffLabel to show 'iOS', 'Android', 'iOS + Android' or '-'
accordingly; reference the Compatibility type and the four fields
localIosChecksum, remoteIosChecksum, localAndroidChecksum, remoteAndroidChecksum
when making the change.
In `@cli/src/index.ts`:
- Line 748: The status message "⚠️ Native cloud build requests are currently in
PUBLIC BETA and cannot be used by anyone at this time." is contradictory; update
the CLI help string (currently containing that exact text) to either: 1) reflect
a gated beta by replacing "PUBLIC BETA and cannot be used by anyone at this
time" with "LIMITED/PRIVATE BETA — access is currently restricted" (if access is
gated), or 2) if it really is public, remove "and cannot be used by anyone at
this time" so it reads "⚠️ Native cloud build requests are currently in PUBLIC
BETA." Modify the string where it is defined in cli/src/index.ts accordingly
(the help/usage message that prints this warning).
---
Nitpick comments:
In `@cli/src/index.ts`:
- Around line 766-770: Replace the inline help string for the --verbose CLI
option with the shared description constant to avoid drift: locate the chain
that registers the flag (the .option('--verbose', `Show package-level native
dependency changes`) call) and swap the literal string for
optionDescriptions.verbose so the flag uses the shared text; ensure you
import/retain the optionDescriptions object in this scope if not already
present.
In `@cli/webdocs/build.mdx`:
- Line 27: Update the single-line description so it explicitly states both
outcomes: change the current sentence that mentions only "exit 1 when local
native dependency metadata requires a new native build" to something like:
"Print 'yes' and exit with code 1 if a native build is required; otherwise print
'no' and exit with code 0." Ensure the wording replaces the existing line that
begins with the emoji and short description so CI/CD users can unambiguously
detect both cases.
🪄 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
Run ID: 3a0fe302-6407-46e9-9caf-2e7928396f9e
📒 Files selected for processing (11)
AGENTS.mdcli/AGENTS.mdcli/README.mdcli/package.jsoncli/skills/native-builds/SKILL.mdcli/skills/usage/SKILL.mdcli/src/build/needed.tscli/src/index.tscli/src/schemas/build.tscli/test/test-build-needed.mjscli/webdocs/build.mdx
Merging this PR will not alter performance
Comparing Footnotes
|
b58d8fc to
3e00bd1
Compare
3e00bd1 to
7c3af4c
Compare
|



Summary (AI generated)
build neededto report whether local native dependency metadata requires a new native build.Motivation (AI generated)
Teams need a CI-friendly way to decide whether an OTA upload is enough or a native store build is required when native dependencies changed.
Business Impact (AI generated)
This reduces accidental OTA releases that cannot safely apply native dependency changes, while keeping automated release pipelines simple with yes/no output and exit codes.
Test Plan (AI generated)
bun run lintbun run buildbun run test:build-neededbun run test:mcpbun run test:bundlenode dist/index.js build needed --helpSummary by CodeRabbit
New Features
build neededcommand to check if native builds are required based on dependency compatibility and native package changes. Returns "yes" or "no" with appropriate exit codes for programmatic use.Documentation
build neededcommand with all supported options and usage examples.