@base44-preview/cli 0.1.14-pr.621.b7a8af7 → 0.1.14-pr.622.a1a2672

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -23331,7 +23331,7 @@ var require_ejs = __commonJS(function(exports) {
23331
23331
  }
23332
23332
  });
23333
23333
 
23334
- // ../../node_modules/cross-spawn/node_modules/which/node_modules/isexe/windows.js
23334
+ // ../../node_modules/isexe/windows.js
23335
23335
  var require_windows = __commonJS(function(exports, module) {
23336
23336
  module.exports = isexe;
23337
23337
  isexe.sync = sync;
@@ -23369,7 +23369,7 @@ var require_windows = __commonJS(function(exports, module) {
23369
23369
  }
23370
23370
  });
23371
23371
 
23372
- // ../../node_modules/cross-spawn/node_modules/which/node_modules/isexe/mode.js
23372
+ // ../../node_modules/isexe/mode.js
23373
23373
  var require_mode = __commonJS(function(exports, module) {
23374
23374
  module.exports = isexe;
23375
23375
  isexe.sync = sync;
@@ -23400,7 +23400,7 @@ var require_mode = __commonJS(function(exports, module) {
23400
23400
  }
23401
23401
  });
23402
23402
 
23403
- // ../../node_modules/cross-spawn/node_modules/which/node_modules/isexe/index.js
23403
+ // ../../node_modules/isexe/index.js
23404
23404
  var require_isexe = __commonJS(function(exports, module) {
23405
23405
  var fs = __require("fs");
23406
23406
  var core;
@@ -23453,7 +23453,7 @@ var require_isexe = __commonJS(function(exports, module) {
23453
23453
  }
23454
23454
  });
23455
23455
 
23456
- // ../../node_modules/cross-spawn/node_modules/which/which.js
23456
+ // ../../node_modules/which/which.js
23457
23457
  var require_which = __commonJS(function(exports, module) {
23458
23458
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
23459
23459
  var path = __require("path");
@@ -223739,7 +223739,7 @@ var createInstance = (defaults) => {
223739
223739
  var ky = createInstance();
223740
223740
  var distribution_default = ky;
223741
223741
 
223742
- // node_modules/zod/v4/core/core.js
223742
+ // ../../node_modules/zod/v4/core/core.js
223743
223743
  var NEVER = Object.freeze({
223744
223744
  status: "aborted"
223745
223745
  });
@@ -223815,7 +223815,7 @@ function config(newConfig) {
223815
223815
  Object.assign(globalConfig, newConfig);
223816
223816
  return globalConfig;
223817
223817
  }
223818
- // node_modules/zod/v4/core/util.js
223818
+ // ../../node_modules/zod/v4/core/util.js
223819
223819
  function getEnumValues(entries) {
223820
223820
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
223821
223821
  const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
@@ -224238,7 +224238,7 @@ function issue(...args) {
224238
224238
  return { ...iss };
224239
224239
  }
224240
224240
 
224241
- // node_modules/zod/v4/core/errors.js
224241
+ // ../../node_modules/zod/v4/core/errors.js
224242
224242
  var initializer = (inst, def) => {
224243
224243
  inst.name = "$ZodError";
224244
224244
  Object.defineProperty(inst, "_zod", {
@@ -224333,7 +224333,7 @@ function prettifyError(error) {
224333
224333
  `);
224334
224334
  }
224335
224335
 
224336
- // node_modules/zod/v4/core/parse.js
224336
+ // ../../node_modules/zod/v4/core/parse.js
224337
224337
  var _parse = (_Err) => (schema, value, _ctx, _params) => {
224338
224338
  const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
224339
224339
  const result = schema._zod.run({ value, issues: [] }, ctx);
@@ -224410,7 +224410,7 @@ var _safeEncodeAsync = (_Err) => async (schema, value, _ctx) => {
224410
224410
  var _safeDecodeAsync = (_Err) => async (schema, value, _ctx) => {
224411
224411
  return _safeParseAsync(_Err)(schema, value, _ctx);
224412
224412
  };
224413
- // node_modules/zod/v4/core/regexes.js
224413
+ // ../../node_modules/zod/v4/core/regexes.js
224414
224414
  var cuid = /^[cC][^\s-]{8,}$/;
224415
224415
  var cuid2 = /^[0-9a-z]+$/;
224416
224416
  var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
@@ -224467,7 +224467,7 @@ var _null = /^null$/i;
224467
224467
  var lowercase = /^[^A-Z]*$/;
224468
224468
  var uppercase = /^[^a-z]*$/;
224469
224469
 
224470
- // node_modules/zod/v4/core/checks.js
224470
+ // ../../node_modules/zod/v4/core/checks.js
224471
224471
  var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
224472
224472
  var _a;
224473
224473
  inst._zod ?? (inst._zod = {});
@@ -224856,7 +224856,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
224856
224856
  };
224857
224857
  });
224858
224858
 
224859
- // node_modules/zod/v4/core/doc.js
224859
+ // ../../node_modules/zod/v4/core/doc.js
224860
224860
  class Doc {
224861
224861
  constructor(args = []) {
224862
224862
  this.content = [];
@@ -224894,14 +224894,14 @@ class Doc {
224894
224894
  }
224895
224895
  }
224896
224896
 
224897
- // node_modules/zod/v4/core/versions.js
224897
+ // ../../node_modules/zod/v4/core/versions.js
224898
224898
  var version = {
224899
224899
  major: 4,
224900
224900
  minor: 3,
224901
224901
  patch: 6
224902
224902
  };
224903
224903
 
224904
- // node_modules/zod/v4/core/schemas.js
224904
+ // ../../node_modules/zod/v4/core/schemas.js
224905
224905
  var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
224906
224906
  var _a;
224907
224907
  inst ?? (inst = {});
@@ -226298,7 +226298,7 @@ function handleRefineResult(result, payload, input, inst) {
226298
226298
  payload.issues.push(issue(_iss));
226299
226299
  }
226300
226300
  }
226301
- // node_modules/zod/v4/locales/en.js
226301
+ // ../../node_modules/zod/v4/locales/en.js
226302
226302
  var error = () => {
226303
226303
  const Sizable = {
226304
226304
  string: { unit: "characters", verb: "to have" },
@@ -226404,7 +226404,7 @@ function en_default() {
226404
226404
  localeError: error()
226405
226405
  };
226406
226406
  }
226407
- // node_modules/zod/v4/core/registries.js
226407
+ // ../../node_modules/zod/v4/core/registries.js
226408
226408
  var _a;
226409
226409
  var $output = Symbol("ZodOutput");
226410
226410
  var $input = Symbol("ZodInput");
@@ -226454,7 +226454,7 @@ function registry() {
226454
226454
  }
226455
226455
  (_a = globalThis).__zod_globalRegistry ?? (_a.__zod_globalRegistry = registry());
226456
226456
  var globalRegistry = globalThis.__zod_globalRegistry;
226457
- // node_modules/zod/v4/core/api.js
226457
+ // ../../node_modules/zod/v4/core/api.js
226458
226458
  function _string(Class, params) {
226459
226459
  return new Class({
226460
226460
  type: "string",
@@ -226909,7 +226909,7 @@ function _check(fn, params) {
226909
226909
  ch._zod.check = fn;
226910
226910
  return ch;
226911
226911
  }
226912
- // node_modules/zod/v4/core/to-json-schema.js
226912
+ // ../../node_modules/zod/v4/core/to-json-schema.js
226913
226913
  function initializeContext(params) {
226914
226914
  let target = params?.target ?? "draft-2020-12";
226915
226915
  if (target === "draft-4")
@@ -227254,7 +227254,7 @@ var createStandardJSONSchemaMethod = (schema, io, processors = {}) => (params) =
227254
227254
  extractDefs(ctx, schema);
227255
227255
  return finalize(ctx, schema);
227256
227256
  };
227257
- // node_modules/zod/v4/core/json-schema-processors.js
227257
+ // ../../node_modules/zod/v4/core/json-schema-processors.js
227258
227258
  var formatMap = {
227259
227259
  guid: "uuid",
227260
227260
  url: "uri",
@@ -227595,7 +227595,7 @@ var lazyProcessor = (schema, ctx, _json, params) => {
227595
227595
  const seen = ctx.seen.get(schema);
227596
227596
  seen.ref = innerType;
227597
227597
  };
227598
- // node_modules/zod/v4/classic/iso.js
227598
+ // ../../node_modules/zod/v4/classic/iso.js
227599
227599
  var ZodISODateTime = /* @__PURE__ */ $constructor("ZodISODateTime", (inst, def) => {
227600
227600
  $ZodISODateTime.init(inst, def);
227601
227601
  ZodStringFormat.init(inst, def);
@@ -227625,7 +227625,7 @@ function duration2(params) {
227625
227625
  return _isoDuration(ZodISODuration, params);
227626
227626
  }
227627
227627
 
227628
- // node_modules/zod/v4/classic/errors.js
227628
+ // ../../node_modules/zod/v4/classic/errors.js
227629
227629
  var initializer2 = (inst, issues) => {
227630
227630
  $ZodError.init(inst, issues);
227631
227631
  inst.name = "ZodError";
@@ -227660,7 +227660,7 @@ var ZodRealError = $constructor("ZodError", initializer2, {
227660
227660
  Parent: Error
227661
227661
  });
227662
227662
 
227663
- // node_modules/zod/v4/classic/parse.js
227663
+ // ../../node_modules/zod/v4/classic/parse.js
227664
227664
  var parse3 = /* @__PURE__ */ _parse(ZodRealError);
227665
227665
  var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
227666
227666
  var safeParse2 = /* @__PURE__ */ _safeParse(ZodRealError);
@@ -227674,7 +227674,7 @@ var safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
227674
227674
  var safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
227675
227675
  var safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
227676
227676
 
227677
- // node_modules/zod/v4/classic/schemas.js
227677
+ // ../../node_modules/zod/v4/classic/schemas.js
227678
227678
  var ZodType = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
227679
227679
  $ZodType.init(inst, def);
227680
227680
  Object.assign(inst["~standard"], {
@@ -228328,7 +228328,7 @@ function superRefine(fn) {
228328
228328
  function preprocess(fn, schema) {
228329
228329
  return pipe(transform(fn), schema);
228330
228330
  }
228331
- // node_modules/zod/v4/classic/external.js
228331
+ // ../../node_modules/zod/v4/classic/external.js
228332
228332
  config(en_default());
228333
228333
  // src/core/clients/schemas.ts
228334
228334
  var ApiErrorResponseSchema = looseObject({
@@ -246959,6 +246959,39 @@ function showPlainError(error) {
246959
246959
  }
246960
246960
  }
246961
246961
 
246962
+ // src/core/resources/branch/api.ts
246963
+ var BranchesSchema = array(object({
246964
+ id: string2().min(1),
246965
+ branch_name: string2(),
246966
+ status: _enum(["active", "merged", "deleted"])
246967
+ }));
246968
+ async function listBranches() {
246969
+ let response;
246970
+ try {
246971
+ response = await getAppClient().get("branches", { timeout: 30000 });
246972
+ } catch (error) {
246973
+ throw await ApiError.fromHttpError(error, "listing branches");
246974
+ }
246975
+ const result = BranchesSchema.safeParse(await response.json());
246976
+ if (!result.success) {
246977
+ throw new SchemaValidationError("Invalid branches response from server", result.error);
246978
+ }
246979
+ return result.data.filter((branch) => branch.status === "active");
246980
+ }
246981
+ async function resolveBranchName(name) {
246982
+ if (name === "main")
246983
+ return;
246984
+ const branches = await listBranches();
246985
+ const matches = branches.filter((branch) => branch.branch_name === name);
246986
+ if (matches.length === 0) {
246987
+ throw new InvalidInputError(`Branch "${name}" was not found in this app.`);
246988
+ }
246989
+ if (matches.length > 1) {
246990
+ throw new InvalidInputError(`Branch name "${name}" is ambiguous. Give the branches unique names before retrying.`);
246991
+ }
246992
+ return matches[0].id;
246993
+ }
246994
+
246962
246995
  // src/cli/utils/command/Base44Command.ts
246963
246996
  function writeJsonSuccess(result) {
246964
246997
  if (result.stdout) {
@@ -247005,7 +247038,8 @@ class Base44Command extends Command2 {
247005
247038
  this._commandOptions = {
247006
247039
  requireAuth: options?.requireAuth ?? true,
247007
247040
  requireAppContext: options?.requireAppContext ?? true,
247008
- fullBanner: options?.fullBanner ?? false
247041
+ fullBanner: options?.fullBanner ?? false,
247042
+ supportsBranch: options?.supportsBranch ?? false
247009
247043
  };
247010
247044
  }
247011
247045
  setContext(context) {
@@ -247026,6 +247060,13 @@ class Base44Command extends Command2 {
247026
247060
  }
247027
247061
  const upgradeCheckPromise = startUpgradeCheck();
247028
247062
  try {
247063
+ const { branch } = this.optsWithGlobals();
247064
+ if (branch !== undefined && !this._commandOptions.supportsBranch) {
247065
+ throw new InvalidInputError("--branch is not supported by this command. Use sandbox commands to read or edit branch files; no app changes were made.");
247066
+ }
247067
+ if (branch !== undefined && !branch.trim()) {
247068
+ throw new InvalidInputError("--branch must not be empty.");
247069
+ }
247029
247070
  if (this._commandOptions.requireAuth) {
247030
247071
  await ensureAuth(this.context);
247031
247072
  }
@@ -247033,7 +247074,8 @@ class Base44Command extends Command2 {
247033
247074
  const { appId } = this.optsWithGlobals();
247034
247075
  await ensureAppContext(this.context, { appId });
247035
247076
  }
247036
- const result = await fn(this.context, ...args) ?? {};
247077
+ const resolvedBranchId = branch !== undefined ? await resolveBranchName(branch) : undefined;
247078
+ const result = await fn({ ...this.context, branchId: resolvedBranchId }, ...args) ?? {};
247037
247079
  if (!quiet) {
247038
247080
  await showCommandEnd(result, upgradeCheckPromise, this.context.distribution);
247039
247081
  } else if (jsonMode) {
@@ -247881,6 +247923,31 @@ function getWhoamiCommand() {
247881
247923
  return new Base44Command("whoami", { requireAppContext: false }).description("Display current authenticated user").action(whoami);
247882
247924
  }
247883
247925
 
247926
+ // src/cli/commands/branches/index.ts
247927
+ async function listBranchesAction({
247928
+ log,
247929
+ runTask,
247930
+ jsonMode
247931
+ }) {
247932
+ const remote = await runTask("Fetching branches", () => listBranches());
247933
+ const branches = [
247934
+ { name: "main", status: "active" },
247935
+ ...remote.map((branch) => ({
247936
+ name: branch.branch_name,
247937
+ status: branch.status
247938
+ }))
247939
+ ];
247940
+ if (jsonMode)
247941
+ return { stdout: `${JSON.stringify({ branches })}
247942
+ ` };
247943
+ for (const branch of branches)
247944
+ log.message(`${branch.name} (${branch.status})`);
247945
+ return { outroMessage: `${branches.length} branches` };
247946
+ }
247947
+ function getBranchesCommand() {
247948
+ return new Command2("branches").description("Discover an app's branches").addCommand(new Base44Command("list").description("List main and active branch names for use with --branch").action(listBranchesAction));
247949
+ }
247950
+
247884
247951
  // ../../node_modules/open/index.js
247885
247952
  import process20 from "node:process";
247886
247953
  import path16 from "node:path";
@@ -250294,13 +250361,16 @@ function parsePositiveInt(value, flagName) {
250294
250361
  }
250295
250362
 
250296
250363
  // src/cli/commands/sandbox/checkpoint.ts
250297
- async function checkpointAction({ runTask }, options) {
250364
+ async function checkpointAction({ runTask, branchId }, options) {
250298
250365
  const { id: appId } = getAppContext();
250299
- const result = await runTask("Creating checkpoint", () => createCheckpoint(appId, { name: options.name }));
250366
+ const result = await runTask("Creating checkpoint", () => createCheckpoint(appId, {
250367
+ name: options.name,
250368
+ branch_id: branchId
250369
+ }));
250300
250370
  return { outroMessage: "Created checkpoint", stdout: toJsonStdout(result) };
250301
250371
  }
250302
250372
  function getSandboxCheckpointCommand() {
250303
- return new Base44Command("checkpoint").description("Create a restore-point checkpoint of an app's remote sandbox").option("--name <name>", "Optional message/title for the checkpoint (defaults to an auto-generated title)").addHelpText("after", `
250373
+ return new Base44Command("checkpoint", { supportsBranch: true }).description("Create a restore-point checkpoint of an app's remote sandbox").option("--name <name>", "Optional message/title for the checkpoint (defaults to an auto-generated title)").addHelpText("after", `
250304
250374
  Examples:
250305
250375
  $ base44 sandbox checkpoint
250306
250376
  $ base44 sandbox checkpoint --name "before refactor"`).action(checkpointAction);
@@ -250325,18 +250395,23 @@ function parseEdits(raw) {
250325
250395
  }
250326
250396
  return result.data;
250327
250397
  }
250328
- async function editFileAction({ runTask }, path, options) {
250398
+ async function editFileAction({ runTask, branchId }, path, options) {
250329
250399
  const { id: appId } = getAppContext();
250330
250400
  const raw = await resolveFlagOrStdin(options.editsJson, "--edits-json");
250331
250401
  const edits = parseEdits(raw);
250332
- const result = await runTask(options.dryRun ? "Previewing edit" : "Editing file", () => editFile(appId, { path, edits, dry_run: options.dryRun }));
250402
+ const result = await runTask(options.dryRun ? "Previewing edit" : "Editing file", () => editFile(appId, {
250403
+ path,
250404
+ edits,
250405
+ dry_run: options.dryRun,
250406
+ branch_id: branchId
250407
+ }));
250333
250408
  return {
250334
250409
  outroMessage: options.dryRun ? "Previewed edit" : "Edited file",
250335
250410
  stdout: toJsonStdout(result)
250336
250411
  };
250337
250412
  }
250338
250413
  function getSandboxEditFileCommand() {
250339
- return new Base44Command("edit").description("Apply exact old→new string edits to a file in the sandbox").argument("<path>", "File path relative to the app root").option("--edits-json <json>", "JSON array of edits (if omitted, read from stdin)").option("--dry-run", "Return the unified diff without writing").addHelpText("after", `
250414
+ return new Base44Command("edit", { supportsBranch: true }).description("Apply exact old→new string edits to a file in the sandbox").argument("<path>", "File path relative to the app root").option("--edits-json <json>", "JSON array of edits (if omitted, read from stdin)").option("--dry-run", "Return the unified diff without writing").addHelpText("after", `
250340
250415
  Each edit is { "old_text": "...", "new_text": "...", "replace_all"?: true }.
250341
250416
 
250342
250417
  Examples:
@@ -250345,7 +250420,7 @@ Examples:
250345
250420
  }
250346
250421
 
250347
250422
  // src/cli/commands/sandbox/grep.ts
250348
- async function grepAction({ runTask }, pattern, options) {
250423
+ async function grepAction({ runTask, branchId }, pattern, options) {
250349
250424
  const { id: appId } = getAppContext();
250350
250425
  const maxResults = parsePositiveInt(options.maxResults, "--max-results");
250351
250426
  const result = await runTask("Searching files", () => grep(appId, {
@@ -250354,20 +250429,22 @@ async function grepAction({ runTask }, pattern, options) {
250354
250429
  is_regex: options.regex,
250355
250430
  case_sensitive: options.caseSensitive,
250356
250431
  glob: options.glob,
250357
- max_results: maxResults
250432
+ max_results: maxResults,
250433
+ branch_id: branchId
250358
250434
  }));
250359
250435
  return { outroMessage: "Searched files", stdout: toJsonStdout(result) };
250360
250436
  }
250361
250437
  function getSandboxGrepCommand() {
250362
- return new Base44Command("grep").description("Search files for a pattern in an app's remote sandbox").argument("<pattern>", "Search pattern").option("--path <path>", "Subtree to search, relative to the app root").option("--no-regex", "Treat the pattern as a literal string, not a regex").option("--case-sensitive", "Case-sensitive match").option("--glob <glob>", 'File glob filter, e.g. "*.tsx"').option("--max-results <n>", "Maximum number of match lines to return").action(grepAction);
250438
+ return new Base44Command("grep", { supportsBranch: true }).description("Search files for a pattern in an app's remote sandbox").argument("<pattern>", "Search pattern").option("--path <path>", "Subtree to search, relative to the app root").option("--no-regex", "Treat the pattern as a literal string, not a regex").option("--case-sensitive", "Case-sensitive match").option("--glob <glob>", 'File glob filter, e.g. "*.tsx"').option("--max-results <n>", "Maximum number of match lines to return").action(grepAction);
250363
250439
  }
250364
250440
 
250365
250441
  // src/cli/commands/sandbox/list-directory.ts
250366
- async function listDirectoryAction({ runTask }, path, options) {
250442
+ async function listDirectoryAction({ runTask, branchId }, path, options) {
250367
250443
  const { id: appId } = getAppContext();
250368
250444
  const maxDepth = parsePositiveInt(options.maxDepth, "--max-depth");
250369
250445
  const result = await runTask("Listing directory", () => listDirectory(appId, {
250370
250446
  path,
250447
+ branch_id: branchId,
250371
250448
  recursive: options.recursive,
250372
250449
  max_depth: maxDepth,
250373
250450
  include_hidden: options.includeHidden
@@ -250375,45 +250452,55 @@ async function listDirectoryAction({ runTask }, path, options) {
250375
250452
  return { outroMessage: "Listed directory", stdout: toJsonStdout(result) };
250376
250453
  }
250377
250454
  function getSandboxListDirectoryCommand() {
250378
- return new Base44Command("ls").description("List directory entries in an app's remote sandbox").argument("[path]", "Directory relative to the app root (default: app root)").option("--recursive", "List nested entries").option("--max-depth <n>", "Max depth when recursive (1-10, default 3)").option("--include-hidden", "Include dotfiles").action(listDirectoryAction);
250455
+ return new Base44Command("ls", { supportsBranch: true }).description("List directory entries in an app's remote sandbox").argument("[path]", "Directory relative to the app root (default: app root)").option("--recursive", "List nested entries").option("--max-depth <n>", "Max depth when recursive (1-10, default 3)").option("--include-hidden", "Include dotfiles").action(listDirectoryAction);
250379
250456
  }
250380
250457
 
250381
250458
  // src/cli/commands/sandbox/read-file.ts
250382
- async function readFileAction({ runTask }, paths, options) {
250459
+ async function readFileAction({ runTask, branchId }, paths, options) {
250383
250460
  const { id: appId } = getAppContext();
250384
250461
  const offset = parsePositiveInt(options.offset, "--offset");
250385
250462
  const limit = parsePositiveInt(options.limit, "--limit");
250386
- const result = await runTask("Reading file", () => readFile4(appId, { paths, offset, limit }));
250463
+ const result = await runTask("Reading file", () => readFile4(appId, { paths, offset, limit, branch_id: branchId }));
250387
250464
  return { outroMessage: "Read file", stdout: toJsonStdout(result) };
250388
250465
  }
250389
250466
  function getSandboxReadFileCommand() {
250390
- return new Base44Command("read").description("Read file contents from an app's remote sandbox").argument("<paths...>", "One or more file paths relative to the app root").option("--offset <n>", "1-based start line").option("--limit <n>", "Max lines to return from offset").action(readFileAction);
250467
+ return new Base44Command("read", { supportsBranch: true }).description("Read file contents from an app's remote sandbox").argument("<paths...>", "One or more file paths relative to the app root").option("--offset <n>", "1-based start line").option("--limit <n>", "Max lines to return from offset").action(readFileAction);
250391
250468
  }
250392
250469
 
250393
250470
  // src/cli/commands/sandbox/run-command.ts
250394
- async function runCommandAction({ runTask }, commandParts, options) {
250471
+ async function runCommandAction({ runTask, branchId }, commandParts, options) {
250395
250472
  const { id: appId } = getAppContext();
250396
250473
  const timeoutMs = parsePositiveInt(options.timeoutMs, "--timeout-ms");
250397
250474
  const command = commandParts.join(" ");
250398
- const result = await runTask("Running command", () => runCommand(appId, { command, cwd: options.cwd, timeout_ms: timeoutMs }));
250475
+ const result = await runTask("Running command", () => runCommand(appId, {
250476
+ command,
250477
+ cwd: options.cwd,
250478
+ timeout_ms: timeoutMs,
250479
+ branch_id: branchId
250480
+ }));
250399
250481
  return { outroMessage: "Ran command", stdout: toJsonStdout(result) };
250400
250482
  }
250401
250483
  function getSandboxRunCommandCommand() {
250402
- return new Base44Command("run").description("Run a shell command in an app's remote sandbox").argument("<command...>", "Shell command to execute (quote to keep as one)").option("--cwd <path>", "Working directory relative to the app root").option("--timeout-ms <n>", "Timeout in milliseconds (default 120000, max 600000)").addHelpText("after", `
250484
+ return new Base44Command("run", { supportsBranch: true }).description("Run a shell command in an app's remote sandbox").argument("<command...>", "Shell command to execute (quote to keep as one)").option("--cwd <path>", "Working directory relative to the app root").option("--timeout-ms <n>", "Timeout in milliseconds (default 120000, max 600000)").addHelpText("after", `
250403
250485
  Examples:
250404
250486
  $ base44 sandbox run "npm test"
250405
250487
  $ base44 sandbox run ls -la --cwd src`).action(runCommandAction);
250406
250488
  }
250407
250489
 
250408
250490
  // src/cli/commands/sandbox/write-file.ts
250409
- async function writeFileAction({ runTask }, path, options) {
250491
+ async function writeFileAction({ runTask, branchId }, path, options) {
250410
250492
  const { id: appId } = getAppContext();
250411
250493
  const content = await resolveFlagOrStdin(options.content, "--content");
250412
- const result = await runTask("Writing file", () => writeFile2(appId, { path, content, overwrite: options.overwrite }));
250494
+ const result = await runTask("Writing file", () => writeFile2(appId, {
250495
+ path,
250496
+ content,
250497
+ overwrite: options.overwrite,
250498
+ branch_id: branchId
250499
+ }));
250413
250500
  return { outroMessage: "Wrote file", stdout: toJsonStdout(result) };
250414
250501
  }
250415
250502
  function getSandboxWriteFileCommand() {
250416
- return new Base44Command("write").description("Create or overwrite a file in an app's remote sandbox").argument("<path>", "File path relative to the app root").option("--content <content>", "File content (if omitted, read from stdin)").option("--overwrite", "Overwrite the file if it already exists").addHelpText("after", `
250503
+ return new Base44Command("write", { supportsBranch: true }).description("Create or overwrite a file in an app's remote sandbox").argument("<path>", "File path relative to the app root").option("--content <content>", "File content (if omitted, read from stdin)").option("--overwrite", "Overwrite the file if it already exists").addHelpText("after", `
250417
250504
  Examples:
250418
250505
  $ echo "hello" | base44 sandbox write notes.txt
250419
250506
  $ base44 sandbox write notes.txt --content "hello" --overwrite`).action(writeFileAction);
@@ -255407,7 +255494,7 @@ function getEjectCommand() {
255407
255494
  // src/cli/program.ts
255408
255495
  function createProgram(context) {
255409
255496
  const program = new Command2;
255410
- program.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(package_default.version).addOption(new Option2("--app-id <id>", "Base44 app ID to use").env(BASE44_APP_ID_ENV_VAR)).addOption(new Option2("--json", "Output machine-readable JSON to stdout (status/logs go to stderr)"));
255497
+ program.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(package_default.version).option("--branch <name>", "Target an app branch by exact name (sandbox commands only)").addOption(new Option2("--app-id <id>", "Base44 app ID to use").env(BASE44_APP_ID_ENV_VAR)).addOption(new Option2("--json", "Output machine-readable JSON to stdout (status/logs go to stderr)"));
255411
255498
  program.configureHelp({
255412
255499
  sortSubcommands: true
255413
255500
  });
@@ -255436,6 +255523,7 @@ function createProgram(context) {
255436
255523
  program.addCommand(getWorkflowsCommand());
255437
255524
  program.addCommand(getSecretsCommand());
255438
255525
  program.addCommand(getSandboxCommand());
255526
+ program.addCommand(getBranchesCommand());
255439
255527
  program.addCommand(getAuthCommand());
255440
255528
  program.addCommand(getSiteCommand());
255441
255529
  program.addCommand(getTypesCommand());
@@ -259489,4 +259577,4 @@ export {
259489
259577
  runCLI
259490
259578
  };
259491
259579
 
259492
- //# debugId=08F7780409C3464664756E2164756E21
259580
+ //# debugId=526C630AD971165F64756E2164756E21