@base44-preview/cli 0.0.36-pr.342.fee5fdf → 0.0.36-pr.344.34fe324

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
@@ -4,25 +4,43 @@ var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
32
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
33
+ var __returnValue = (v) => v;
34
+ function __exportSetter(name, newValue) {
35
+ this[name] = __returnValue.bind(null, newValue);
36
+ }
19
37
  var __export = (target, all) => {
20
38
  for (var name in all)
21
39
  __defProp(target, name, {
22
40
  get: all[name],
23
41
  enumerable: true,
24
42
  configurable: true,
25
- set: (newValue) => all[name] = () => newValue
43
+ set: __exportSetter.bind(all, name)
26
44
  });
27
45
  };
28
46
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
@@ -208798,21 +208816,6 @@ class UserError extends CLIError {
208798
208816
 
208799
208817
  class SystemError extends CLIError {
208800
208818
  }
208801
-
208802
- class AuthRequiredError extends UserError {
208803
- code = "AUTH_REQUIRED";
208804
- constructor(message = "Authentication required", options) {
208805
- super(message, {
208806
- hints: options?.hints ?? [
208807
- {
208808
- message: "Run 'base44 login' to authenticate",
208809
- command: "base44 login"
208810
- }
208811
- ],
208812
- cause: options?.cause
208813
- });
208814
- }
208815
- }
208816
208819
  class ConfigNotFoundError extends UserError {
208817
208820
  code = "CONFIG_NOT_FOUND";
208818
208821
  constructor(message = "No Base44 project found in this directory", options) {
@@ -224511,29 +224514,17 @@ async function printUpgradeNotificationIfAvailable() {
224511
224514
 
224512
224515
  // src/cli/utils/runCommand.ts
224513
224516
  async function runCommand(commandFn, options, context) {
224514
- const json2 = context.isJsonMode;
224515
- let savedStdoutWrite;
224517
+ if (options?.fullBanner) {
224518
+ await printBanner(context.isNonInteractive);
224519
+ We("");
224520
+ } else {
224521
+ We(theme.colors.base44OrangeBackground(" Base 44 "));
224522
+ }
224523
+ await printUpgradeNotificationIfAvailable();
224516
224524
  try {
224517
- if (json2) {
224518
- if (options?.interactive) {
224519
- throw new InvalidInputError("This command requires interactive input and cannot be used with --json");
224520
- }
224521
- savedStdoutWrite = process.stdout.write.bind(process.stdout);
224522
- process.stdout.write = () => true;
224523
- }
224524
- if (options?.fullBanner) {
224525
- await printBanner(context.isNonInteractive);
224526
- We("");
224527
- } else {
224528
- We(theme.colors.base44OrangeBackground(" Base 44 "));
224529
- }
224530
- await printUpgradeNotificationIfAvailable();
224531
224525
  if (options?.requireAuth) {
224532
224526
  const loggedIn = await isLoggedIn();
224533
224527
  if (!loggedIn) {
224534
- if (json2) {
224535
- throw new AuthRequiredError("Authentication required. Run: base44 login");
224536
- }
224537
224528
  R2.info("You need to login first to continue.");
224538
224529
  await login();
224539
224530
  }
@@ -224549,54 +224540,25 @@ async function runCommand(commandFn, options, context) {
224549
224540
  context.errorReporter.setContext({ appId: appConfig.id });
224550
224541
  }
224551
224542
  const result = await commandFn();
224552
- if (json2) {
224553
- const output = result.data ?? {
224554
- message: result.outroMessage ?? "Done"
224555
- };
224556
- savedStdoutWrite(`${JSON.stringify(output, null, 2)}
224557
- `);
224558
- } else {
224559
- Le(result.outroMessage || "");
224560
- if (result.stdout) {
224561
- process.stdout.write(result.stdout);
224562
- }
224543
+ Le(result.outroMessage || "");
224544
+ if (result.stdout) {
224545
+ process.stdout.write(result.stdout);
224563
224546
  }
224564
224547
  } catch (error48) {
224565
- if (json2) {
224566
- const errorContext = context.errorReporter.getErrorContext();
224567
- const jsonError = {
224568
- error: true,
224569
- message: error48 instanceof Error ? error48.message : String(error48),
224570
- context: errorContext
224571
- };
224572
- if (isCLIError(error48)) {
224573
- jsonError.code = error48.code;
224574
- if (error48.hints.length > 0) {
224575
- jsonError.hints = error48.hints;
224576
- }
224577
- }
224578
- process.stderr.write(`${JSON.stringify(jsonError, null, 2)}
224579
- `);
224580
- } else {
224581
- const errorMessage = error48 instanceof Error ? error48.message : String(error48);
224582
- R2.error(errorMessage);
224583
- if (process.env.DEBUG === "1" && error48 instanceof Error && error48.stack) {
224584
- R2.error(theme.styles.dim(error48.stack));
224585
- }
224586
- if (isCLIError(error48)) {
224587
- const hints = theme.format.agentHints(error48.hints);
224588
- if (hints) {
224589
- R2.error(hints);
224590
- }
224548
+ const errorMessage = error48 instanceof Error ? error48.message : String(error48);
224549
+ R2.error(errorMessage);
224550
+ if (process.env.DEBUG === "1" && error48 instanceof Error && error48.stack) {
224551
+ R2.error(theme.styles.dim(error48.stack));
224552
+ }
224553
+ if (isCLIError(error48)) {
224554
+ const hints = theme.format.agentHints(error48.hints);
224555
+ if (hints) {
224556
+ R2.error(hints);
224591
224557
  }
224592
- const errorContext = context.errorReporter.getErrorContext();
224593
- Le(theme.format.errorContext(errorContext));
224594
224558
  }
224559
+ const errorContext = context.errorReporter.getErrorContext();
224560
+ Le(theme.format.errorContext(errorContext));
224595
224561
  throw error48;
224596
- } finally {
224597
- if (savedStdoutWrite) {
224598
- process.stdout.write = savedStdoutWrite;
224599
- }
224600
224562
  }
224601
224563
  }
224602
224564
  // src/cli/utils/runTask.ts
@@ -225780,12 +225742,7 @@ function getCreateCommand(context) {
225780
225742
  if (isNonInteractive) {
225781
225743
  await runCommand(() => createNonInteractive({ name: options.name ?? name2, ...options }), { requireAuth: true, requireAppConfig: false }, context);
225782
225744
  } else {
225783
- await runCommand(() => createInteractive({ name: name2, ...options }), {
225784
- fullBanner: true,
225785
- requireAuth: true,
225786
- requireAppConfig: false,
225787
- interactive: true
225788
- }, context);
225745
+ await runCommand(() => createInteractive({ name: name2, ...options }), { fullBanner: true, requireAuth: true, requireAppConfig: false }, context);
225789
225746
  }
225790
225747
  });
225791
225748
  }
@@ -226003,7 +225960,7 @@ async function link(options) {
226003
225960
  }
226004
225961
  function getLinkCommand(context) {
226005
225962
  return new Command("link").description("Link a local project to a Base44 project (create new or link existing)").option("-c, --create", "Create a new project (skip selection prompt)").option("-n, --name <name>", "Project name (required when --create is used)").option("-d, --description <description>", "Project description").option("-p, --projectId <id>", "Project ID to link to an existing project (skips selection prompt)").hook("preAction", validateNonInteractiveFlags2).action(async (options) => {
226006
- await runCommand(() => link(options), { requireAuth: true, requireAppConfig: false, interactive: true }, context);
225963
+ await runCommand(() => link(options), { requireAuth: true, requireAppConfig: false }, context);
226007
225964
  });
226008
225965
  }
226009
225966
 
@@ -226110,11 +226067,9 @@ async function logsAction(options) {
226110
226067
  if (limit !== undefined && entries.length > limit) {
226111
226068
  entries = entries.slice(0, limit);
226112
226069
  }
226113
- return {
226114
- outroMessage: "Fetched logs",
226115
- stdout: formatLogs(entries),
226116
- data: { logs: entries }
226117
- };
226070
+ const logsOutput = options.json ? `${JSON.stringify(entries, null, 2)}
226071
+ ` : formatLogs(entries);
226072
+ return { outroMessage: "Fetched logs", stdout: logsOutput };
226118
226073
  }
226119
226074
  function getLogsCommand(context) {
226120
226075
  return new Command("logs").description("Fetch function logs for this app").option("--function <names>", "Filter by function name(s), comma-separated. If omitted, fetches logs for all project functions").option("--since <datetime>", "Show logs from this time (ISO format)", normalizeDatetime).option("--until <datetime>", "Show logs until this time (ISO format)", normalizeDatetime).addOption(new Option("--level <level>", "Filter by log level").choices([...LogLevelSchema.options]).hideHelp()).option("-n, --limit <n>", "Results per page (1-1000, default: 50)", (v) => {
@@ -226269,7 +226224,7 @@ function getSiteDeployCommand(context) {
226269
226224
  await runCommand(() => deployAction2({
226270
226225
  ...options,
226271
226226
  isNonInteractive: context.isNonInteractive
226272
- }), { requireAuth: true, interactive: !options.yes }, context);
226227
+ }), { requireAuth: true }, context);
226273
226228
  });
226274
226229
  }
226275
226230
 
@@ -227242,7 +227197,7 @@ async function eject(options8) {
227242
227197
  }
227243
227198
  function getEjectCommand(context) {
227244
227199
  return new Command("eject").description("Download the code for an existing Base44 project").option("-p, --path <path>", "Path where to write the project").option("--project-id <id>", "Project ID to eject (skips interactive selection)").option("-y, --yes", "Skip confirmation prompts").action(async (options8) => {
227245
- await runCommand(() => eject({ ...options8, isNonInteractive: context.isNonInteractive }), { requireAuth: true, requireAppConfig: false, interactive: true }, context);
227200
+ await runCommand(() => eject({ ...options8, isNonInteractive: context.isNonInteractive }), { requireAuth: true, requireAppConfig: false }, context);
227246
227201
  });
227247
227202
  }
227248
227203
 
@@ -227250,12 +227205,6 @@ function getEjectCommand(context) {
227250
227205
  function createProgram(context) {
227251
227206
  const program2 = new Command;
227252
227207
  program2.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(package_default.version);
227253
- program2.option("--json", "Output results as JSON instead of human-readable text");
227254
- program2.hook("preAction", (thisCommand) => {
227255
- if (thisCommand.opts().json) {
227256
- context.isJsonMode = true;
227257
- }
227258
- });
227259
227208
  program2.configureHelp({
227260
227209
  sortSubcommands: true
227261
227210
  });
@@ -231485,11 +231434,7 @@ async function runCLI() {
231485
231434
  const errorReporter = new ErrorReporter;
231486
231435
  errorReporter.registerProcessErrorHandlers();
231487
231436
  const isNonInteractive = !process.stdin.isTTY || !process.stdout.isTTY;
231488
- const context = {
231489
- errorReporter,
231490
- isNonInteractive,
231491
- isJsonMode: false
231492
- };
231437
+ const context = { errorReporter, isNonInteractive };
231493
231438
  const program2 = createProgram(context);
231494
231439
  try {
231495
231440
  const userInfo = await readAuth();
@@ -231514,4 +231459,4 @@ export {
231514
231459
  CLIExitError
231515
231460
  };
231516
231461
 
231517
- //# debugId=0508D45B9716256264756E2164756E21
231462
+ //# debugId=F081B92DADB2C53064756E2164756E21