@base44-preview/cli 0.0.56-pr.547.a0144b8 → 0.0.56-pr.547.db4783d

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
@@ -16349,7 +16349,7 @@ var require_front_matter = __commonJS((exports, module) => {
16349
16349
  var optionalByteOrderMark = "\\ufeff?";
16350
16350
  var platform5 = typeof process !== "undefined" ? process.platform : "";
16351
16351
  var pattern = "^(" + optionalByteOrderMark + "(= yaml =|---)" + "$([\\s\\S]*?)" + "^(?:\\2|\\.\\.\\.)\\s*" + "$" + (platform5 === "win32" ? "\\r?" : "") + "(?:\\n)?)";
16352
- var regex = new RegExp(pattern, "m");
16352
+ var regex2 = new RegExp(pattern, "m");
16353
16353
  module.exports = extractor;
16354
16354
  module.exports.test = test;
16355
16355
  function extractor(string4, options) {
@@ -16384,7 +16384,7 @@ var require_front_matter = __commonJS((exports, module) => {
16384
16384
  return line;
16385
16385
  }
16386
16386
  function parse10(string4, allowUnsafe) {
16387
- var match = regex.exec(string4);
16387
+ var match = regex2.exec(string4);
16388
16388
  if (!match) {
16389
16389
  return {
16390
16390
  attributes: {},
@@ -16406,7 +16406,7 @@ var require_front_matter = __commonJS((exports, module) => {
16406
16406
  }
16407
16407
  function test(string4) {
16408
16408
  string4 = string4 || "";
16409
- return regex.test(string4);
16409
+ return regex2.test(string4);
16410
16410
  }
16411
16411
  });
16412
16412
 
@@ -121034,9 +121034,9 @@ function getMessage2(key2, parameters, self2) {
121034
121034
  assert22.ok(message.length <= parameters.length, `Code: ${key2}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`);
121035
121035
  return Reflect.apply(message, self2, parameters);
121036
121036
  }
121037
- const regex = /%[dfijoOs]/g;
121037
+ const regex2 = /%[dfijoOs]/g;
121038
121038
  let expectedLength = 0;
121039
- while (regex.exec(message) !== null)
121039
+ while (regex2.exec(message) !== null)
121040
121040
  expectedLength++;
121041
121041
  assert22.ok(expectedLength === parameters.length, `Code: ${key2}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`);
121042
121042
  if (parameters.length === 0)
@@ -121937,9 +121937,9 @@ function convertEndOfLineOptionToCharacter2(endOfLineOption) {
121937
121937
  return endOfLineOption === OPTION_CR2 ? CHARACTER_CR2 : endOfLineOption === OPTION_CRLF2 ? CHARACTER_CRLF2 : DEFAULT_EOL2;
121938
121938
  }
121939
121939
  function countEndOfLineCharacters(text, endOfLineCharacter) {
121940
- const regex = regexps.get(endOfLineCharacter);
121940
+ const regex2 = regexps.get(endOfLineCharacter);
121941
121941
  if (false) {}
121942
- return text.match(regex)?.length ?? 0;
121942
+ return text.match(regex2)?.length ?? 0;
121943
121943
  }
121944
121944
  function normalizeEndOfLine(text) {
121945
121945
  return method_replace_all_default2(0, text, END_OF_LINE_REGEXP, CHARACTER_LF2);
@@ -124141,8 +124141,8 @@ function legacyIsNextLineEmpty(text, node, locEnd) {
124141
124141
  }
124142
124142
  function makeString(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
124143
124143
  const otherQuote = enclosingQuote === '"' ? "'" : '"';
124144
- const regex = /\\(.)|(["'])/gsu;
124145
- const raw2 = method_replace_all_default2(0, rawText, regex, (match, escaped, quote) => {
124144
+ const regex2 = /\\(.)|(["'])/gsu;
124145
+ const raw2 = method_replace_all_default2(0, rawText, regex2, (match, escaped, quote) => {
124146
124146
  if (escaped === otherQuote) {
124147
124147
  return escaped;
124148
124148
  }
@@ -127563,17 +127563,17 @@ var init_prettier = __esm(() => {
127563
127563
  }
127564
127564
  const opts = options8 || {};
127565
127565
  const posix = utils3.isWindows(options8);
127566
- const regex = isState ? picomatch.compileRe(glob, options8) : picomatch.makeRe(glob, options8, false, true);
127567
- const state = regex.state;
127568
- delete regex.state;
127566
+ const regex2 = isState ? picomatch.compileRe(glob, options8) : picomatch.makeRe(glob, options8, false, true);
127567
+ const state = regex2.state;
127568
+ delete regex2.state;
127569
127569
  let isIgnored2 = () => false;
127570
127570
  if (opts.ignore) {
127571
127571
  const ignoreOpts = { ...options8, ignore: null, onMatch: null, onResult: null };
127572
127572
  isIgnored2 = picomatch(opts.ignore, ignoreOpts, returnState);
127573
127573
  }
127574
127574
  const matcher = (input, returnObject = false) => {
127575
- const { isMatch, match, output } = picomatch.test(input, regex, options8, { glob, posix });
127576
- const result = { glob, state, regex, posix, input, output, match, isMatch };
127575
+ const { isMatch, match, output } = picomatch.test(input, regex2, options8, { glob, posix });
127576
+ const result = { glob, state, regex: regex2, posix, input, output, match, isMatch };
127577
127577
  if (typeof opts.onResult === "function") {
127578
127578
  opts.onResult(result);
127579
127579
  }
@@ -127598,7 +127598,7 @@ var init_prettier = __esm(() => {
127598
127598
  }
127599
127599
  return matcher;
127600
127600
  };
127601
- picomatch.test = (input, regex, options8, { glob, posix } = {}) => {
127601
+ picomatch.test = (input, regex2, options8, { glob, posix } = {}) => {
127602
127602
  if (typeof input !== "string") {
127603
127603
  throw new TypeError("Expected input to be a string");
127604
127604
  }
@@ -127615,16 +127615,16 @@ var init_prettier = __esm(() => {
127615
127615
  }
127616
127616
  if (match === false || opts.capture === true) {
127617
127617
  if (opts.matchBase === true || opts.basename === true) {
127618
- match = picomatch.matchBase(input, regex, options8, posix);
127618
+ match = picomatch.matchBase(input, regex2, options8, posix);
127619
127619
  } else {
127620
- match = regex.exec(output);
127620
+ match = regex2.exec(output);
127621
127621
  }
127622
127622
  }
127623
127623
  return { isMatch: Boolean(match), match, output };
127624
127624
  };
127625
127625
  picomatch.matchBase = (input, glob, options8, posix = utils3.isWindows(options8)) => {
127626
- const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options8);
127627
- return regex.test(path152.basename(input));
127626
+ const regex2 = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options8);
127627
+ return regex2.test(path152.basename(input));
127628
127628
  };
127629
127629
  picomatch.isMatch = (str, patterns, options8) => picomatch(patterns, options8)(str);
127630
127630
  picomatch.parse = (pattern, options8) => {
@@ -127644,11 +127644,11 @@ var init_prettier = __esm(() => {
127644
127644
  if (state && state.negated === true) {
127645
127645
  source2 = `^(?!${source2}).*$`;
127646
127646
  }
127647
- const regex = picomatch.toRegex(source2, options8);
127647
+ const regex2 = picomatch.toRegex(source2, options8);
127648
127648
  if (returnState === true) {
127649
- regex.state = state;
127649
+ regex2.state = state;
127650
127650
  }
127651
- return regex;
127651
+ return regex2;
127652
127652
  };
127653
127653
  picomatch.makeRe = (input, options8 = {}, returnOutput = false, returnState = false) => {
127654
127654
  if (!input || typeof input !== "string") {
@@ -127812,8 +127812,8 @@ var init_prettier = __esm(() => {
127812
127812
  };
127813
127813
  micromatch2.capture = (glob, input, options8) => {
127814
127814
  let posix = utils3.isWindows(options8);
127815
- let regex = picomatch.makeRe(String(glob), { ...options8, capture: true });
127816
- let match = regex.exec(posix ? utils3.toPosixSlashes(input) : input);
127815
+ let regex2 = picomatch.makeRe(String(glob), { ...options8, capture: true });
127816
+ let match = regex2.exec(posix ? utils3.toPosixSlashes(input) : input);
127817
127817
  if (match) {
127818
127818
  return match.slice(1).map((v10) => v10 === undefined ? "" : v10);
127819
127819
  }
@@ -132252,7 +132252,7 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
132252
132252
  };
132253
132253
  Object.defineProperty(exports, "__esModule", { value: true });
132254
132254
  var fs42 = __importStar(__require2("fs"));
132255
- var regex = {
132255
+ var regex2 = {
132256
132256
  section: /^\s*\[(([^#;]|\\#|\\;)+)\]\s*([#;].*)?$/,
132257
132257
  param: /^\s*([\w\.\-\_]+)\s*[=:]\s*(.*?)\s*([#;].*)?$/,
132258
132258
  comment: /^\s*[#;].*$/
@@ -132284,14 +132284,14 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
132284
132284
  var lines = data.split(/\r\n|\r|\n/);
132285
132285
  lines.forEach(function(line3) {
132286
132286
  var match;
132287
- if (regex.comment.test(line3)) {
132287
+ if (regex2.comment.test(line3)) {
132288
132288
  return;
132289
132289
  }
132290
- if (regex.param.test(line3)) {
132291
- match = line3.match(regex.param);
132290
+ if (regex2.param.test(line3)) {
132291
+ match = line3.match(regex2.param);
132292
132292
  sectionBody[match[1]] = match[2];
132293
- } else if (regex.section.test(line3)) {
132294
- match = line3.match(regex.section);
132293
+ } else if (regex2.section.test(line3)) {
132294
+ match = line3.match(regex2.section);
132295
132295
  sectionName = match[1];
132296
132296
  sectionBody = {};
132297
132297
  value.push([sectionName, sectionBody]);
@@ -133377,8 +133377,8 @@ globstar while`, file2, fr10, pattern, pr8, swallowee);
133377
133377
  }
133378
133378
  _make(mode, key2) {
133379
133379
  const str = this.regexPrefix.replace(REGEX_REPLACE_TRAILING_WILDCARD, TRAILING_WILD_CARD_REPLACERS[mode]);
133380
- const regex = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
133381
- return define2(this, key2, regex);
133380
+ const regex2 = this.ignoreCase ? new RegExp(str, "i") : new RegExp(str);
133381
+ return define2(this, key2, regex2);
133382
133382
  }
133383
133383
  };
133384
133384
  var createRule = ({
@@ -138174,8 +138174,8 @@ var require_prettier = __commonJS((exports, module) => {
138174
138174
  }
138175
138175
  function makeString2(rawText, enclosingQuote, unescapeUnnecessaryEscapes) {
138176
138176
  const otherQuote = enclosingQuote === '"' ? "'" : '"';
138177
- const regex = /\\(.)|(["'])/gsu;
138178
- const raw2 = method_replace_all_default3(0, rawText, regex, (match, escaped, quote) => {
138177
+ const regex2 = /\\(.)|(["'])/gsu;
138178
+ const raw2 = method_replace_all_default3(0, rawText, regex2, (match, escaped, quote) => {
138179
138179
  if (escaped === otherQuote) {
138180
138180
  return escaped;
138181
138181
  }
@@ -164333,12 +164333,12 @@ var require_ipaddr = __commonJS((exports, module) => {
164333
164333
  return this.toNormalizedString().replace(/((^|:)(0(:|$))+)/, "::");
164334
164334
  };
164335
164335
  IPv6.prototype.toRFC5952String = function() {
164336
- var bestMatchIndex, bestMatchLength, match, regex, string4;
164337
- regex = /((^|:)(0(:|$)){2,})/g;
164336
+ var bestMatchIndex, bestMatchLength, match, regex2, string4;
164337
+ regex2 = /((^|:)(0(:|$)){2,})/g;
164338
164338
  string4 = this.toNormalizedString();
164339
164339
  bestMatchIndex = 0;
164340
164340
  bestMatchLength = -1;
164341
- while (match = regex.exec(string4)) {
164341
+ while (match = regex2.exec(string4)) {
164342
164342
  if (match[0].length > bestMatchLength) {
164343
164343
  bestMatchIndex = match.index;
164344
164344
  bestMatchLength = match[0].length;
@@ -169656,10 +169656,10 @@ var require_follow_redirects = __commonJS((exports, module) => {
169656
169656
  spread.path = spread.search ? spread.pathname + spread.search : spread.pathname;
169657
169657
  return spread;
169658
169658
  }
169659
- function removeMatchingHeaders(regex, headers) {
169659
+ function removeMatchingHeaders(regex2, headers) {
169660
169660
  var lastValue;
169661
169661
  for (var header2 in headers) {
169662
- if (regex.test(header2)) {
169662
+ if (regex2.test(header2)) {
169663
169663
  lastValue = headers[header2];
169664
169664
  delete headers[header2];
169665
169665
  }
@@ -201219,9 +201219,9 @@ var require_dist4 = __commonJS((exports, module) => {
201219
201219
  name2 = "/" + name2;
201220
201220
  let nsp = this._nsps.get(name2);
201221
201221
  if (!nsp) {
201222
- for (const [regex, parentNamespace] of this.parentNamespacesFromRegExp) {
201223
- if (regex.test(name2)) {
201224
- debug("attaching namespace %s to parent namespace %s", name2, regex);
201222
+ for (const [regex2, parentNamespace] of this.parentNamespacesFromRegExp) {
201223
+ if (regex2.test(name2)) {
201224
+ debug("attaching namespace %s to parent namespace %s", name2, regex2);
201225
201225
  return parentNamespace.createChild(name2);
201226
201226
  }
201227
201227
  }
@@ -235840,6 +235840,24 @@ var BANNER_LINES = [
235840
235840
  async function printBanner() {
235841
235841
  await printAnimatedLines(BANNER_LINES);
235842
235842
  }
235843
+ // ../../node_modules/ansi-regex/index.js
235844
+ function ansiRegex({ onlyFirst = false } = {}) {
235845
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
235846
+ const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
235847
+ const csi = "[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";
235848
+ const pattern = `${osc}|${csi}`;
235849
+ return new RegExp(pattern, onlyFirst ? undefined : "g");
235850
+ }
235851
+
235852
+ // ../../node_modules/strip-ansi/index.js
235853
+ var regex = ansiRegex();
235854
+ function stripAnsi(string4) {
235855
+ if (typeof string4 !== "string") {
235856
+ throw new TypeError(`Expected a \`string\`, got \`${typeof string4}\``);
235857
+ }
235858
+ return string4.replace(regex, "");
235859
+ }
235860
+
235843
235861
  // ../../node_modules/p-wait-for/index.js
235844
235862
  var resolveValue = Symbol("resolveValue");
235845
235863
  var sleep2 = (ms, signal) => new Promise((resolve, reject) => {
@@ -243426,7 +243444,7 @@ var ListFunctionsResponseSchema = exports_external.object({
243426
243444
  var LogLevelSchema = exports_external.enum(["info", "warning", "error", "debug"]);
243427
243445
  var FunctionLogEntrySchema = exports_external.object({
243428
243446
  time: exports_external.string(),
243429
- level: LogLevelSchema,
243447
+ level: exports_external.preprocess((v) => v === "warn" ? "warning" : !v || v === "log" ? "info" : v, LogLevelSchema),
243430
243448
  message: exports_external.string()
243431
243449
  });
243432
243450
  var FunctionLogsResponseSchema = exports_external.array(FunctionLogEntrySchema);
@@ -251091,6 +251109,35 @@ function showPlainError(error48) {
251091
251109
  }
251092
251110
 
251093
251111
  // src/cli/utils/command/Base44Command.ts
251112
+ function writeJsonSuccess(result) {
251113
+ if (result.stdout) {
251114
+ if (result.outroMessage) {
251115
+ process.stderr.write(`${result.outroMessage}
251116
+ `);
251117
+ }
251118
+ process.stdout.write(result.stdout);
251119
+ return;
251120
+ }
251121
+ process.stdout.write(`${JSON.stringify({ output: stripAnsi(result.outroMessage ?? "") })}
251122
+ `);
251123
+ }
251124
+ function writeJsonError(error48) {
251125
+ const envelope = {
251126
+ error: error48 instanceof Error ? error48.message : String(error48)
251127
+ };
251128
+ if (isCLIError(error48)) {
251129
+ envelope.code = error48.code;
251130
+ if (error48.details.length > 0) {
251131
+ envelope.details = error48.details;
251132
+ }
251133
+ if (error48.hints.length > 0) {
251134
+ envelope.hints = error48.hints;
251135
+ }
251136
+ }
251137
+ process.stdout.write(`${JSON.stringify(envelope)}
251138
+ `);
251139
+ }
251140
+
251094
251141
  class Base44Command extends Command {
251095
251142
  _context;
251096
251143
  _commandOptions;
@@ -251113,7 +251160,8 @@ class Base44Command extends Command {
251113
251160
  }
251114
251161
  action(fn) {
251115
251162
  return super.action(async (...args) => {
251116
- const quiet = this.context.isNonInteractive;
251163
+ const jsonMode = this.context.jsonMode;
251164
+ const quiet = this.context.isNonInteractive || jsonMode;
251117
251165
  if (!quiet) {
251118
251166
  await showCommandStart(this._commandOptions.fullBanner);
251119
251167
  }
@@ -251129,6 +251177,13 @@ class Base44Command extends Command {
251129
251177
  const result = await fn(this.context, ...args) ?? {};
251130
251178
  if (!quiet) {
251131
251179
  await showCommandEnd(result, upgradeCheckPromise, this.context.distribution);
251180
+ } else if (jsonMode) {
251181
+ writeJsonSuccess(result);
251182
+ const upgradeInfo = await upgradeCheckPromise;
251183
+ if (upgradeInfo) {
251184
+ process.stderr.write(`${formatPlainUpgradeMessage(upgradeInfo, this.context.distribution)}
251185
+ `);
251186
+ }
251132
251187
  } else {
251133
251188
  if (result.outroMessage) {
251134
251189
  process.stdout.write(`${result.outroMessage}
@@ -251144,7 +251199,9 @@ class Base44Command extends Command {
251144
251199
  }
251145
251200
  }
251146
251201
  } catch (error48) {
251147
- if (quiet) {
251202
+ if (jsonMode) {
251203
+ writeJsonError(error48);
251204
+ } else if (quiet) {
251148
251205
  showPlainError(error48);
251149
251206
  } else {
251150
251207
  showThemedError(error48, this.context);
@@ -252537,7 +252594,7 @@ function parseScopes(scopes) {
252537
252594
  return (scopes ?? []).flatMap((s) => s.split(",")).map((s) => s.trim()).filter(Boolean);
252538
252595
  }
252539
252596
  async function initiateAction(ctx, options) {
252540
- const { log, runTask: runTask2, isNonInteractive } = ctx;
252597
+ const { log, runTask: runTask2, isNonInteractive, jsonMode } = ctx;
252541
252598
  const integrationType = parseIntegrationType(options.integrationType);
252542
252599
  const scopes = parseScopes(options.scopes);
252543
252600
  const response = await runTask2(`Initiating ${integrationType} connector`, () => setConnector(integrationType, scopes), {
@@ -252548,6 +252605,18 @@ async function initiateAction(ctx, options) {
252548
252605
  const detail = response.error === "different_user" && response.otherUserEmail ? ` (already authorized by ${response.otherUserEmail})` : response.errorMessage ? ` (${response.errorMessage})` : "";
252549
252606
  throw new InvalidInputError(`Could not initiate ${integrationType}: ${response.error}${detail}`);
252550
252607
  }
252608
+ if (jsonMode) {
252609
+ return {
252610
+ outroMessage: response.alreadyAuthorized ? `${integrationType} already authorized` : `${integrationType} initialized`,
252611
+ stdout: `${JSON.stringify({
252612
+ integrationType,
252613
+ alreadyAuthorized: response.alreadyAuthorized,
252614
+ redirectUrl: response.redirectUrl,
252615
+ connectionId: response.connectionId
252616
+ }, null, 2)}
252617
+ `
252618
+ };
252619
+ }
252551
252620
  if (response.alreadyAuthorized || !response.redirectUrl) {
252552
252621
  return {
252553
252622
  outroMessage: `${integrationType} is already authorized. Run 'base44 connectors pull' to fetch its config.`
@@ -252582,7 +252651,8 @@ Examples:
252582
252651
  // src/cli/commands/connectors/list-available.ts
252583
252652
  async function listAvailableAction({
252584
252653
  log,
252585
- runTask: runTask2
252654
+ runTask: runTask2,
252655
+ jsonMode
252586
252656
  }) {
252587
252657
  const { integrations } = await runTask2("Fetching available integrations from Base44", async () => {
252588
252658
  return await listAvailableIntegrations();
@@ -252590,6 +252660,13 @@ async function listAvailableAction({
252590
252660
  successMessage: "Available integrations fetched successfully",
252591
252661
  errorMessage: "Failed to fetch available integrations"
252592
252662
  });
252663
+ if (jsonMode) {
252664
+ return {
252665
+ outroMessage: `Found ${integrations.length} available integrations.`,
252666
+ stdout: `${JSON.stringify({ integrations }, null, 2)}
252667
+ `
252668
+ };
252669
+ }
252593
252670
  if (integrations.length === 0) {
252594
252671
  return { outroMessage: "No available integrations found." };
252595
252672
  }
@@ -252617,7 +252694,7 @@ async function resolveConnectorsDir(options) {
252617
252694
  const { project: project2 } = await readProjectConfig();
252618
252695
  return join19(dirname15(project2.configPath), project2.connectorsDir);
252619
252696
  }
252620
- async function pullConnectorsAction({ log, runTask: runTask2 }, options) {
252697
+ async function pullConnectorsAction({ log, runTask: runTask2, jsonMode }, options) {
252621
252698
  const connectorsDir = await resolveConnectorsDir(options);
252622
252699
  const remoteConnectors = await runTask2("Fetching connectors from Base44", async () => {
252623
252700
  return await pullAllConnectors();
@@ -252631,6 +252708,13 @@ async function pullConnectorsAction({ log, runTask: runTask2 }, options) {
252631
252708
  successMessage: "Connector files synced successfully",
252632
252709
  errorMessage: "Failed to sync connector files"
252633
252710
  });
252711
+ if (jsonMode) {
252712
+ return {
252713
+ outroMessage: `Pulled ${remoteConnectors.length} connectors to ${connectorsDir}`,
252714
+ stdout: `${JSON.stringify({ connectorsDir, pulled: remoteConnectors.length, written, deleted }, null, 2)}
252715
+ `
252716
+ };
252717
+ }
252634
252718
  if (written.length > 0) {
252635
252719
  log.success(`Written: ${written.join(", ")}`);
252636
252720
  }
@@ -252719,13 +252803,15 @@ function printSummary(results, oauthOutcomes, log) {
252719
252803
  log.error(`Failed: ${r.type} - ${r.error}`);
252720
252804
  }
252721
252805
  }
252722
- async function pushConnectorsAction({ isNonInteractive, log, runTask: runTask2 }, options) {
252806
+ async function pushConnectorsAction({ isNonInteractive, log, runTask: runTask2, jsonMode }, options) {
252723
252807
  const connectors = await readConnectorsToPush(options);
252724
- if (connectors.length === 0) {
252725
- log.info("No local connectors found - checking for remote connectors to remove");
252726
- } else {
252727
- const connectorNames = connectors.map((c3) => c3.type).join(", ");
252728
- log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
252808
+ if (!jsonMode) {
252809
+ if (connectors.length === 0) {
252810
+ log.info("No local connectors found - checking for remote connectors to remove");
252811
+ } else {
252812
+ const connectorNames = connectors.map((c3) => c3.type).join(", ");
252813
+ log.info(`Found ${connectors.length} connectors to push: ${connectorNames}`);
252814
+ }
252729
252815
  }
252730
252816
  const { results } = await runTask2("Pushing connectors to Base44", async () => {
252731
252817
  return await pushConnectors(connectors);
@@ -252739,6 +252825,13 @@ async function pushConnectorsAction({ isNonInteractive, log, runTask: runTask2 }
252739
252825
  if (needsOAuth.length > 0 && !allAuthorized) {
252740
252826
  outroMessage = isNonInteractive ? "Skipped OAuth in non-interactive mode. Run 'base44 connectors push' locally or open the links above to authorize." : "Some connectors still require authorization. Run 'base44 connectors push' or open the links above to authorize.";
252741
252827
  }
252828
+ if (jsonMode) {
252829
+ return {
252830
+ outroMessage,
252831
+ stdout: `${JSON.stringify({ results, oauth: Object.fromEntries(oauthOutcomes) }, null, 2)}
252832
+ `
252833
+ };
252834
+ }
252742
252835
  printSummary(results, oauthOutcomes, log);
252743
252836
  return { outroMessage };
252744
252837
  }
@@ -253803,17 +253896,26 @@ var RunCommandResponseSchema = exports_external.object({
253803
253896
  truncated: data.truncated,
253804
253897
  durationMs: data.duration_ms
253805
253898
  }));
253806
- var ReleaseResponseSchema = exports_external.object({
253807
- app_id: exports_external.string(),
253808
- released: exports_external.boolean()
253899
+ var CreateCheckpointResponseSchema = exports_external.object({
253900
+ checkpoint_id: exports_external.string(),
253901
+ name: exports_external.string().nullable(),
253902
+ git_commit_hash: exports_external.string().nullable()
253809
253903
  }).transform((data) => ({
253810
- appId: data.app_id,
253811
- released: data.released
253904
+ checkpointId: data.checkpoint_id,
253905
+ name: data.name,
253906
+ gitCommitHash: data.git_commit_hash
253812
253907
  }));
253813
253908
 
253814
253909
  // src/core/resources/sandbox/api.ts
253910
+ function isMissingSandboxScope(error48) {
253911
+ if (error48.statusCode !== 401 && error48.statusCode !== 403) {
253912
+ return false;
253913
+ }
253914
+ const text = `${error48.message} ${JSON.stringify(error48.responseBody ?? "")}`;
253915
+ return /sandbox:write/i.test(text) || /granting sandbox access/i.test(text);
253916
+ }
253815
253917
  function withSandboxAuthHint(error48) {
253816
- if (error48.statusCode !== 403) {
253918
+ if (!isMissingSandboxScope(error48)) {
253817
253919
  return error48;
253818
253920
  }
253819
253921
  return new ApiError(error48.message, {
@@ -253827,7 +253929,7 @@ function withSandboxAuthHint(error48) {
253827
253929
  hints: [
253828
253930
  ...error48.hints,
253829
253931
  {
253830
- message: "If you have admin access to this app, your login may predate sandbox support — run 'base44 login' again to grant sandbox access.",
253932
+ message: "Run 'base44 login' again to grant sandbox access (the sandbox:write scope is only granted at login).",
253831
253933
  command: "base44 login"
253832
253934
  }
253833
253935
  ],
@@ -253866,8 +253968,8 @@ function grep(appId, params) {
253866
253968
  function runCommand(appId, params) {
253867
253969
  return callTool(appId, "run_command", { ...params }, RunCommandResponseSchema, "running command", false);
253868
253970
  }
253869
- function releaseSession(appId) {
253870
- return callTool(appId, "release", {}, ReleaseResponseSchema, "releasing sandbox session");
253971
+ function createCheckpoint(appId, params) {
253972
+ return callTool(appId, "create_checkpoint", { ...params }, CreateCheckpointResponseSchema, "creating checkpoint");
253871
253973
  }
253872
253974
 
253873
253975
  // src/cli/commands/sandbox/shared.ts
@@ -253895,6 +253997,19 @@ function parsePositiveInt(value, flagName) {
253895
253997
  return n2;
253896
253998
  }
253897
253999
 
254000
+ // src/cli/commands/sandbox/checkpoint.ts
254001
+ async function checkpointAction({ runTask: runTask2 }, options) {
254002
+ const { id: appId } = getAppContext();
254003
+ const result = await runTask2("Creating checkpoint", () => createCheckpoint(appId, { name: options.name }));
254004
+ return { outroMessage: "Created checkpoint", stdout: toJsonStdout(result) };
254005
+ }
254006
+ function getSandboxCheckpointCommand() {
254007
+ 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", `
254008
+ Examples:
254009
+ $ base44 sandbox checkpoint
254010
+ $ base44 sandbox checkpoint --name "before refactor"`).action(checkpointAction);
254011
+ }
254012
+
253898
254013
  // src/cli/commands/sandbox/edit-file.ts
253899
254014
  var EditsInputSchema = exports_external.array(exports_external.object({
253900
254015
  old_text: exports_external.string().min(1),
@@ -253925,12 +254040,12 @@ async function editFileAction({ runTask: runTask2 }, path17, options) {
253925
254040
  };
253926
254041
  }
253927
254042
  function getSandboxEditFileCommand() {
253928
- return new Base44Command("edit-file").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", `
254043
+ 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", `
253929
254044
  Each edit is { "old_text": "...", "new_text": "...", "replace_all"?: true }.
253930
254045
 
253931
254046
  Examples:
253932
- $ echo '[{"old_text":"foo","new_text":"bar"}]' | base44 sandbox edit-file src/x.ts
253933
- $ base44 sandbox edit-file src/x.ts --dry-run --edits-json '[{"old_text":"a","new_text":"b","replace_all":true}]'`).action(editFileAction);
254047
+ $ echo '[{"old_text":"foo","new_text":"bar"}]' | base44 sandbox edit src/x.ts
254048
+ $ base44 sandbox edit src/x.ts --dry-run --edits-json '[{"old_text":"a","new_text":"b","replace_all":true}]'`).action(editFileAction);
253934
254049
  }
253935
254050
 
253936
254051
  // src/cli/commands/sandbox/grep.ts
@@ -253964,7 +254079,7 @@ async function listDirectoryAction({ runTask: runTask2 }, path17, options) {
253964
254079
  return { outroMessage: "Listed directory", stdout: toJsonStdout(result) };
253965
254080
  }
253966
254081
  function getSandboxListDirectoryCommand() {
253967
- return new Base44Command("list-directory").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);
254082
+ 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);
253968
254083
  }
253969
254084
 
253970
254085
  // src/cli/commands/sandbox/read-file.ts
@@ -253976,22 +254091,7 @@ async function readFileAction({ runTask: runTask2 }, paths, options) {
253976
254091
  return { outroMessage: "Read file", stdout: toJsonStdout(result) };
253977
254092
  }
253978
254093
  function getSandboxReadFileCommand() {
253979
- return new Base44Command("read-file").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);
253980
- }
253981
-
253982
- // src/cli/commands/sandbox/release.ts
253983
- async function releaseAction({
253984
- runTask: runTask2
253985
- }) {
253986
- const { id: appId } = getAppContext();
253987
- const result = await runTask2("Releasing sandbox session", () => releaseSession(appId));
253988
- return {
253989
- outroMessage: "Released sandbox session",
253990
- stdout: toJsonStdout(result)
253991
- };
253992
- }
253993
- function getSandboxReleaseCommand() {
253994
- return new Base44Command("release").description("Release the external-agent session so the in-app builder can resume").action(releaseAction);
254094
+ 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);
253995
254095
  }
253996
254096
 
253997
254097
  // src/cli/commands/sandbox/run-command.ts
@@ -254003,10 +254103,10 @@ async function runCommandAction({ runTask: runTask2 }, commandParts, options) {
254003
254103
  return { outroMessage: "Ran command", stdout: toJsonStdout(result) };
254004
254104
  }
254005
254105
  function getSandboxRunCommandCommand() {
254006
- return new Base44Command("run-command").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", `
254106
+ 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", `
254007
254107
  Examples:
254008
- $ base44 sandbox run-command "npm test"
254009
- $ base44 sandbox run-command ls -la --cwd src`).action(runCommandAction);
254108
+ $ base44 sandbox run "npm test"
254109
+ $ base44 sandbox run ls -la --cwd src`).action(runCommandAction);
254010
254110
  }
254011
254111
 
254012
254112
  // src/cli/commands/sandbox/write-file.ts
@@ -254017,15 +254117,15 @@ async function writeFileAction({ runTask: runTask2 }, path17, options) {
254017
254117
  return { outroMessage: "Wrote file", stdout: toJsonStdout(result) };
254018
254118
  }
254019
254119
  function getSandboxWriteFileCommand() {
254020
- return new Base44Command("write-file").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", `
254120
+ 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", `
254021
254121
  Examples:
254022
- $ echo "hello" | base44 sandbox write-file notes.txt
254023
- $ base44 sandbox write-file notes.txt --content "hello" --overwrite`).action(writeFileAction);
254122
+ $ echo "hello" | base44 sandbox write notes.txt
254123
+ $ base44 sandbox write notes.txt --content "hello" --overwrite`).action(writeFileAction);
254024
254124
  }
254025
254125
 
254026
254126
  // src/cli/commands/sandbox/index.ts
254027
254127
  function getSandboxCommand() {
254028
- return new Command("sandbox").description("Develop an app remotely via its server-side sandbox").addCommand(getSandboxListDirectoryCommand()).addCommand(getSandboxReadFileCommand()).addCommand(getSandboxWriteFileCommand()).addCommand(getSandboxEditFileCommand()).addCommand(getSandboxGrepCommand()).addCommand(getSandboxRunCommandCommand()).addCommand(getSandboxReleaseCommand());
254128
+ return new Command("sandbox").description("Develop an app remotely via its server-side sandbox").addCommand(getSandboxListDirectoryCommand()).addCommand(getSandboxReadFileCommand()).addCommand(getSandboxWriteFileCommand()).addCommand(getSandboxEditFileCommand()).addCommand(getSandboxGrepCommand()).addCommand(getSandboxRunCommandCommand()).addCommand(getSandboxCheckpointCommand());
254029
254129
  }
254030
254130
 
254031
254131
  // src/cli/commands/secrets/delete.ts
@@ -258073,7 +258173,7 @@ function getEjectCommand() {
258073
258173
  // src/cli/program.ts
258074
258174
  function createProgram(context) {
258075
258175
  const program2 = new Command;
258076
- program2.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(package_default.version).addOption(new Option("--app-id <id>", "Base44 app ID to use").env(BASE44_APP_ID_ENV_VAR));
258176
+ program2.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(package_default.version).addOption(new Option("--app-id <id>", "Base44 app ID to use").env(BASE44_APP_ID_ENV_VAR)).addOption(new Option("--json", "Output machine-readable JSON to stdout (status/logs go to stderr)"));
258077
258177
  program2.configureHelp({
258078
258178
  sortSubcommands: true
258079
258179
  });
@@ -261324,9 +261424,9 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
261324
261424
  throw new InconclusiveMatchError("can't match cohort without a given cohort property value");
261325
261425
  return propertyGroupType === "AND";
261326
261426
  }
261327
- function isValidRegex(regex) {
261427
+ function isValidRegex(regex2) {
261328
261428
  try {
261329
- new RegExp(regex);
261429
+ new RegExp(regex2);
261330
261430
  return true;
261331
261431
  } catch (err) {
261332
261432
  return false;
@@ -261344,8 +261444,8 @@ function convertToDateTime(value) {
261344
261444
  throw new InconclusiveMatchError(`The date provided ${value} must be a string, number, or date object`);
261345
261445
  }
261346
261446
  function relativeDateParseForFeatureFlagMatching(value) {
261347
- const regex = /^-?(?<number>[0-9]+)(?<interval>[a-z])$/;
261348
- const match = value.match(regex);
261447
+ const regex2 = /^-?(?<number>[0-9]+)(?<interval>[a-z])$/;
261448
+ const match = value.match(regex2);
261349
261449
  const parsedDt = new Date(new Date().toISOString());
261350
261450
  if (!match)
261351
261451
  return null;
@@ -262314,12 +262414,14 @@ async function runCLI(options8) {
262314
262414
  ensureNpmAssets(join28(__dirname4, "../assets"));
262315
262415
  const errorReporter = new ErrorReporter;
262316
262416
  errorReporter.registerProcessErrorHandlers();
262317
- const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
262417
+ const jsonMode = process.argv.includes("--json");
262418
+ const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY || jsonMode;
262318
262419
  const log = isNonInteractive ? new SimpleLogger : new ClackLogger;
262319
262420
  const runTask2 = isNonInteractive ? createSimpleRunTask(log) : createInteractiveRunTask();
262320
262421
  const context = {
262321
262422
  errorReporter,
262322
262423
  isNonInteractive,
262424
+ jsonMode,
262323
262425
  distribution: options8?.distribution ?? "npm",
262324
262426
  log,
262325
262427
  runTask: runTask2
@@ -262348,4 +262450,4 @@ export {
262348
262450
  CLIExitError
262349
262451
  };
262350
262452
 
262351
- //# debugId=99691B3EA78ED95C64756E2164756E21
262453
+ //# debugId=C107ED30593A378964756E2164756E21