Support sandbox branch targeting by name - #622
Merged
Merged
Conversation
Contributor
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/cli@0.1.14-pr.622.a1a2672Prefer not to change any import paths? Install using npm alias so your code still imports npm i "base44@npm:@base44-preview/cli@0.1.14-pr.622.a1a2672"Or add it to your {
"dependencies": {
"base44": "npm:@base44-preview/cli@0.1.14-pr.622.a1a2672"
}
}
Preview published to npm registry — try new features instantly! |
netanelgilad
approved these changes
Sep 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Description
Adds branch targeting to the CLI so agents working outside Builder can read and edit files on a specific app branch. A new global
--branch <name>flag resolves an exact branch name to its internal branch ID and forwards it to the sandbox bridge, whilebase44 branches listexposes the names available for that app. Commands that cannot honor branch scope reject the flag explicitly instead of silently operating on main.Related Issue
None (pairs with base44-dev/apper#23840; supersedes #616)
Type of Change
Changes Made
core/resources/branch/api.tswithlistBranches()(Zod-validatedGET branches, filtered toactive) andresolveBranchName(), which mapsmaintoundefinedand fails on missing or ambiguous names.base44 branches listcommand that prints main plus active branch names, emitting{ "branches": [...] }under--json.--branch <name>option registered on the program;Base44Commandgains asupportsBranchoption, validates the flag before auth (rejecting unsupported commands and empty/whitespace values viaInvalidInputError), resolves the name, and passesbranchIdthroughCLIContext.ls,read,write,edit,grep,run,checkpoint) opt in withsupportsBranch: trueand forwardbranch_idin their payloads.SandboxScopeParamsinterface carrying the optionalbranch_id.docs/commands.md(including how to opt a command in) and twoCHANGELOG.mdentries.Testing
npm test)Checklist
docs/(AGENTS.md) if I made architectural changesAdditional Notes
Branch IDs stay internal — names are the only public selector, and no checkout state is persisted, so every invocation is explicit. Omitting the flag (or passing
--branch main) preserves existing behavior and skips the branch lookup entirely. New tests cover name resolution, not-found/ambiguous/invalid-schema rejection, pre-auth validation, per-commandbranch_idforwarding, andbranches listJSON output including the access-denied failure case. Validated with build, typecheck, lint, Knip, and mocked-HTTP CLI tests; no live E2E run.🤖 Generated by Claude | 2026-09-14 07:35 UTC | a1a2672