feat(cli): support scoped monorepo init - #2684
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthrough
ChangesDynamic Capacitor config targeting
Estimated code review effort: 4 (Complex) | ~60 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
Comment |
Merging this PR will not alter performance
Comparing Footnotes
|
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_6af7b250-9c11-4924-93b2-fcc41a1cef37) |
There was a problem hiding this comment.
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 `@cli/src/init/command.ts`:
- Around line 4560-4575: Preserve the explicit package target through the resume
fallback: update the state flow around globalPathToPackageJson and
discardResumedState() so discarding stale resume data cannot clear the
user-provided package JSON path while the capacitor config, main file, and
config write target remain selected. Reapply or store the explicit target
separately after discardResumedState() before installation/versioning continues.
- Around line 122-129: Update resolveInitTargetPath to validate that the
resolved path is a regular file, not merely an existing path: use
statSync(resolved).isFile() alongside the existing existence check, and throw
the same labeled validation error when the target is missing or a directory.
- Around line 2559-2563: Update the main-file selection and injection flow
around mainFilePath so an explicit globalMainFilePath (--main-file) is honored
for Nuxt projects before the Nuxt-specific plugins/capacitorUpdater.client.*
path runs. Route the explicit target through the existing injection logic, or
explicitly reject the option for Nuxt; do not silently modify the default Nuxt
plugin when a target was provided.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: 6be38093-c690-4261-821e-78457ec44ec4
📒 Files selected for processing (6)
cli/package.jsoncli/src/config/index.tscli/src/index.tscli/src/init/command.tscli/test/test-init-monorepo-targeting.mjscli/webdocs/init.mdx
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
Cap-go/capacitor-updater(manual)
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_a60c902c-6685-445c-9049-c3041dd0d538) |
There was a problem hiding this comment.
Stale comment
Risk: low. Not approving because Cursor Bugbot did not complete successfully (usage limit reached), so automated review is incomplete. Human review is still needed; Dalanir and WcaleNieWolny are already assigned as reviewers.
Sent by Cursor Approval Agent: Pull Request Approver External
There was a problem hiding this comment.
Stale comment
Risk: medium. Not approving because Cursor Bugbot did not complete successfully (skipping/usage limit reached), so automated review remains incomplete. Human review is still needed; reviewers Dalanir and WcaleNieWolny are already assigned.
Sent by Cursor Approval Agent: Pull Request Approver
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_3d88ef05-24ae-406b-9b3b-2eaa940617b0) |
There was a problem hiding this comment.
Stale comment
Risk: medium. Not approving because Cursor Bugbot was present but skipped (usage limit reached), so automated review did not complete. Human review is still needed; Dalanir and WcaleNieWolny are already assigned as reviewers.
Sent by Cursor Approval Agent: Pull Request Approver External
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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/mcp/server.ts`:
- Around line 40-42: The startup failure boundary in startMcpServer must cover
all work after setConfigWriteTarget, including stdout setup, SDK initialization,
tool registration, onboarding registration, and server.connect. Add or reuse an
idempotent config-target restore helper, invoking it from both the server
onclose handler and catch, so every failure restores previousConfigWriteTarget
exactly once.
In `@cli/src/schemas/live-update-onboarding.ts`:
- Around line 4-6: Update liveUpdateStartSchema’s capacitorConfig validation to
reject empty strings while continuing to allow the field to be omitted. Use the
schema-level non-empty string constraint so the onboarding handler cannot
receive a value that resolves to undefined and clears the existing server
target.
In `@cli/webdocs/mcp.mdx`:
- Around line 29-40: The “Available tools exposed via MCP” section is
incomplete. Update the list to include capgo_probe, capgo_login, capgo_whoami,
capgo_logout, and the gated onboarding tools exposed by the MCP server, or
explicitly label the section as a subset if it is intentionally non-exhaustive.
- Around line 26-28: Remove the duplicated monorepo explanation in the MCP
documentation, retaining a single copy of the two sentences about the active
root config and live-update onboarding’s capacitorConfig 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: ASSERTIVE
Plan: Pro
Run ID: 807ba88f-f6c5-47c4-8c65-2c079be286a4
📒 Files selected for processing (18)
cli/package.jsoncli/skills/release-management/SKILL.mdcli/skills/usage/SKILL.mdcli/src/bundle/upload.tscli/src/config/index.tscli/src/index.tscli/src/init/command.tscli/src/init/mcp/live-update-tools.tscli/src/mcp/server.tscli/src/schemas/live-update-onboarding.tscli/test/test-capacitor-config-target.mjscli/test/test-mcp-live-update-onboarding.mjscli/webdocs/app.mdxcli/webdocs/bundle.mdxcli/webdocs/init.mdxcli/webdocs/key.mdxcli/webdocs/mcp.mdxcli/webdocs/notifications.mdx
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
Cap-go/capacitor-updater(manual)
304ee4c to
81d6944
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
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 `@cli/src/config/index.ts`:
- Around line 66-73: Update loadConfig so it always obtains the general read
configuration through the root loadConfigCap() flow, preserving dynamic
selectors, shared defaults, and root-level merging. Use a separate
target-snapshot loader only when preparing the write target returned in config,
rather than having getConfigWriteTarget cause direct loadConfigTarget evaluation
for ordinary reads.
In `@cli/src/init/command.ts`:
- Around line 149-177: Update resolveResumedInitTargets to reject stale resumes
when any persisted target cannot be restored: do not swallow failures from
resolveInitTargetPath, resolveCapacitorConfigTargetPath,
resolveInitDirectoryPath, or main-file validation, and signal that the saved
resume is invalid so onboarding restarts safely instead of returning partial
targets. Preserve successful restoration of all valid targets.
- Around line 4815-4822: Update discardResumedState to invalidate or recompute
all derived project state after clearing the resumed targets, including
selectedProjectDir, extConfig, localConfig, and the local appId. Prefer moving
resume rejection before these values are read; otherwise reload them from
initialTargets so later platform, build, and update steps use current project
data.
🪄 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: ASSERTIVE
Plan: Pro
Run ID: 41690505-4eee-4f4a-a422-95c2806d0c07
📒 Files selected for processing (17)
cli/README.mdcli/src/capacitor-cli.tscli/src/config/index.tscli/src/init/command.tscli/src/init/mcp/engine.tscli/src/init/mcp/live-update-tools.tscli/src/init/mcp/progress.tscli/src/init/mcp/session-state.tscli/src/key.tscli/src/mcp/server.tscli/src/schemas/live-update-onboarding.tscli/src/schemas/sdk.tscli/src/sdk.tscli/test/test-capacitor-config-target.mjscli/test/test-init-monorepo-targeting.mjscli/test/test-mcp-live-update-onboarding.mjscli/webdocs/mcp.mdx
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
Cap-go/capacitor-updater(manual)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 00a807f. Configure here.
There was a problem hiding this comment.
Stale comment
Risk: medium. Not approving because Cursor Bugbot completed as skipped (usage limit reached) and reported unresolved findings on the latest commit. Human review is still needed; Dalanir and WcaleNieWolny are already assigned as reviewers.
Sent by Cursor Approval Agent: Pull Request Approver
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_38715cbc-ffaa-482e-8489-452487411359) |
There was a problem hiding this comment.
Risk: medium. Not approving because Cursor Bugbot completed as skipped (usage limit reached) on the latest commit, and there is 1 unresolved Bugbot finding plus prior unresolved review signal. Human review is still needed; Dalanir and WcaleNieWolny are already assigned as reviewers.
Sent by Cursor Approval Agent: Pull Request Approver
|






Summary
--capacitor-configtargeting for every CLI command that writes Capacitor configCAP_APP) while writing only the selected app sourceTest plan
bun run cli:checkcapacitorConfigValidation
bun run cli:checkScreenshots
Not applicable — this is CLI/MCP behavior with no visual UI change.
Checklist
Summary by CodeRabbit
inittarget options:--package-json,--main-file, and--capacitor-config.--capacitor-config <path>to config-changing commands, includingbundle upload,app setting, key operations,notifications setup, and MCP tools/tooling.--capacitor-config.Note
Medium Risk
Touches config read/write paths used by init, uploads, keys, and MCP; mistakes could write the wrong app’s Capacitor config in monorepos, though path validation and scoped MCP writes reduce that risk.
Overview
Adds global
--capacitor-configso Capgo can read the active root Capacitor config (e.g. withCAP_APP) while writing only a chosen app-specificcapacitor.config.*source. Config mutations go throughloadConfigForWrite/getConfigForWrite, withAsyncLocalStoragescoping for concurrent MCP calls.initgains--package-json,--main-file, and--capacitor-config, plus safer resume when checkpoints belong to a different app in the same workspace.MCP / SDK: server startup keeps the config target for its lifetime; live-update onboarding tracks progress and session per config source; upload and encryption tools accept
capacitorConfig/autoSetBundle.Docs and skills describe dynamic-monorepo usage; new tests cover target resolution, init resume, and MCP isolation.
Reviewed by Cursor Bugbot for commit 000706d. Bugbot is set up for automated code reviews on this repo. Configure here.