@base44-preview/cli 0.0.56-pr.547.3f355ee → 0.0.56-pr.547.491311d

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) => {
@@ -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
  }
@@ -253812,13 +253905,42 @@ var ReleaseResponseSchema = exports_external.object({
253812
253905
  }));
253813
253906
 
253814
253907
  // src/core/resources/sandbox/api.ts
253908
+ function isMissingSandboxScope(error48) {
253909
+ if (error48.statusCode !== 401 && error48.statusCode !== 403) {
253910
+ return false;
253911
+ }
253912
+ const text = `${error48.message} ${JSON.stringify(error48.responseBody ?? "")}`;
253913
+ return /sandbox:write/i.test(text) || /granting sandbox access/i.test(text);
253914
+ }
253915
+ function withSandboxAuthHint(error48) {
253916
+ if (!isMissingSandboxScope(error48)) {
253917
+ return error48;
253918
+ }
253919
+ return new ApiError(error48.message, {
253920
+ statusCode: error48.statusCode,
253921
+ requestUrl: error48.requestUrl,
253922
+ requestMethod: error48.requestMethod,
253923
+ requestBody: error48.requestBody,
253924
+ responseBody: error48.responseBody,
253925
+ requestId: error48.requestId,
253926
+ details: error48.details,
253927
+ hints: [
253928
+ ...error48.hints,
253929
+ {
253930
+ message: "Run 'base44 login' again to grant sandbox access (the sandbox:write scope is only granted at login).",
253931
+ command: "base44 login"
253932
+ }
253933
+ ],
253934
+ cause: error48
253935
+ });
253936
+ }
253815
253937
  async function callTool(appId, tool, payload, schema10, context, timeout2 = 60000) {
253816
253938
  const client = getSandboxClient(appId);
253817
253939
  let response;
253818
253940
  try {
253819
253941
  response = await client.post(tool, { json: payload, timeout: timeout2 });
253820
253942
  } catch (error48) {
253821
- throw await ApiError.fromHttpError(error48, context);
253943
+ throw withSandboxAuthHint(await ApiError.fromHttpError(error48, context));
253822
253944
  }
253823
253945
  const result = schema10.safeParse(await response.json());
253824
253946
  if (!result.success) {
@@ -258051,7 +258173,7 @@ function getEjectCommand() {
258051
258173
  // src/cli/program.ts
258052
258174
  function createProgram(context) {
258053
258175
  const program2 = new Command;
258054
- 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)"));
258055
258177
  program2.configureHelp({
258056
258178
  sortSubcommands: true
258057
258179
  });
@@ -261302,9 +261424,9 @@ function matchPropertyGroup(propertyGroup, propertyValues, cohortProperties, deb
261302
261424
  throw new InconclusiveMatchError("can't match cohort without a given cohort property value");
261303
261425
  return propertyGroupType === "AND";
261304
261426
  }
261305
- function isValidRegex(regex) {
261427
+ function isValidRegex(regex2) {
261306
261428
  try {
261307
- new RegExp(regex);
261429
+ new RegExp(regex2);
261308
261430
  return true;
261309
261431
  } catch (err) {
261310
261432
  return false;
@@ -261322,8 +261444,8 @@ function convertToDateTime(value) {
261322
261444
  throw new InconclusiveMatchError(`The date provided ${value} must be a string, number, or date object`);
261323
261445
  }
261324
261446
  function relativeDateParseForFeatureFlagMatching(value) {
261325
- const regex = /^-?(?<number>[0-9]+)(?<interval>[a-z])$/;
261326
- const match = value.match(regex);
261447
+ const regex2 = /^-?(?<number>[0-9]+)(?<interval>[a-z])$/;
261448
+ const match = value.match(regex2);
261327
261449
  const parsedDt = new Date(new Date().toISOString());
261328
261450
  if (!match)
261329
261451
  return null;
@@ -262292,12 +262414,14 @@ async function runCLI(options8) {
262292
262414
  ensureNpmAssets(join28(__dirname4, "../assets"));
262293
262415
  const errorReporter = new ErrorReporter;
262294
262416
  errorReporter.registerProcessErrorHandlers();
262295
- 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;
262296
262419
  const log = isNonInteractive ? new SimpleLogger : new ClackLogger;
262297
262420
  const runTask2 = isNonInteractive ? createSimpleRunTask(log) : createInteractiveRunTask();
262298
262421
  const context = {
262299
262422
  errorReporter,
262300
262423
  isNonInteractive,
262424
+ jsonMode,
262301
262425
  distribution: options8?.distribution ?? "npm",
262302
262426
  log,
262303
262427
  runTask: runTask2
@@ -262326,4 +262450,4 @@ export {
262326
262450
  CLIExitError
262327
262451
  };
262328
262452
 
262329
- //# debugId=B2E0831B71D1CE9764756E2164756E21
262453
+ //# debugId=AF2F482BE60A660F64756E2164756E21