@base44-preview/cli 0.0.36-pr.356.36d8c62 → 0.0.37-pr.357.8ea004a

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
@@ -210244,7 +210244,7 @@ var require_dist5 = __commonJS((exports, module) => {
210244
210244
  });
210245
210245
  module.exports = __toCommonJS(src_exports);
210246
210246
  var import_promises19 = __require("node:fs/promises");
210247
- var import_node_fs19 = __require("node:fs");
210247
+ var import_node_fs20 = __require("node:fs");
210248
210248
  var DEVIN_LOCAL_PATH = "/opt/.devin";
210249
210249
  var CURSOR2 = "cursor";
210250
210250
  var CURSOR_CLI = "cursor-cli";
@@ -210301,7 +210301,7 @@ var require_dist5 = __commonJS((exports, module) => {
210301
210301
  return { isAgent: true, agent: { name: REPLIT } };
210302
210302
  }
210303
210303
  try {
210304
- await (0, import_promises19.access)(DEVIN_LOCAL_PATH, import_node_fs19.constants.F_OK);
210304
+ await (0, import_promises19.access)(DEVIN_LOCAL_PATH, import_node_fs20.constants.F_OK);
210305
210305
  return { isAgent: true, agent: { name: DEVIN } };
210306
210306
  } catch (error48) {}
210307
210307
  return { isAgent: false, agent: undefined };
@@ -241534,7 +241534,7 @@ var {
241534
241534
  // package.json
241535
241535
  var package_default = {
241536
241536
  name: "base44",
241537
- version: "0.0.36",
241537
+ version: "0.0.37",
241538
241538
  description: "Base44 CLI - Unified interface for managing Base44 applications",
241539
241539
  type: "module",
241540
241540
  bin: {
@@ -244352,8 +244352,111 @@ function getDevCommand(context) {
244352
244352
  });
244353
244353
  }
244354
244354
 
244355
+ // src/cli/commands/exec.ts
244356
+ import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
244357
+ import { unlinkSync, writeFileSync as writeFileSync2 } from "node:fs";
244358
+ import { tmpdir as tmpdir2 } from "node:os";
244359
+ import { dirname as dirname12, join as join16, resolve as resolve6 } from "node:path";
244360
+ import { fileURLToPath as fileURLToPath8 } from "node:url";
244361
+ var __dirname6 = dirname12(fileURLToPath8(import.meta.url));
244362
+ var EXEC_WRAPPER_PATH = join16(__dirname6, "../deno-runtime/exec.js");
244363
+ function verifyDenoIsInstalled() {
244364
+ const result = spawnSync3("deno", ["--version"]);
244365
+ if (result.error) {
244366
+ throw new DependencyNotFoundError("Deno is required to run scripts with exec", {
244367
+ hints: [
244368
+ {
244369
+ message: "Install Deno: https://docs.deno.com/runtime/getting-started/installation/"
244370
+ }
244371
+ ]
244372
+ });
244373
+ }
244374
+ }
244375
+ function readStdin() {
244376
+ return new Promise((resolve7, reject) => {
244377
+ let data = "";
244378
+ process.stdin.setEncoding("utf-8");
244379
+ process.stdin.on("data", (chunk) => {
244380
+ data += chunk;
244381
+ });
244382
+ process.stdin.on("end", () => resolve7(data));
244383
+ process.stdin.on("error", reject);
244384
+ });
244385
+ }
244386
+ async function execAction(scriptArg, options8, extraArgs) {
244387
+ verifyDenoIsInstalled();
244388
+ let scriptPath;
244389
+ let tempFile = null;
244390
+ const hasFile = scriptArg !== undefined;
244391
+ const hasEval = options8.eval !== undefined;
244392
+ const isStdinPipe = !hasFile && !hasEval && !process.stdin.isTTY;
244393
+ if (hasFile && hasEval) {
244394
+ throw new InvalidInputError("Cannot use both a file path and -e flag. Provide only one input mode.");
244395
+ }
244396
+ if (!hasFile && !hasEval && !isStdinPipe) {
244397
+ throw new InvalidInputError("No script provided. Pass a file path, use -e for inline code, or pipe from stdin.", {
244398
+ hints: [
244399
+ { message: "File: base44 exec ./script.ts" },
244400
+ { message: 'Eval: base44 exec -e "console.log(1)"' },
244401
+ { message: "Stdin: echo 'code' | base44 exec" }
244402
+ ]
244403
+ });
244404
+ }
244405
+ if (hasFile) {
244406
+ scriptPath = `file://${resolve6(scriptArg)}`;
244407
+ } else {
244408
+ const code2 = hasEval ? options8.eval : await readStdin();
244409
+ tempFile = join16(tmpdir2(), `base44-exec-${Date.now()}.ts`);
244410
+ writeFileSync2(tempFile, code2, "utf-8");
244411
+ scriptPath = `file://${tempFile}`;
244412
+ }
244413
+ const appConfig = getAppConfig();
244414
+ let appUserToken;
244415
+ try {
244416
+ const response = await getAppClient().get("auth/token").json();
244417
+ appUserToken = response.token;
244418
+ } catch (error48) {
244419
+ throw await ApiError.fromHttpError(error48, "exchanging platform token for app user token");
244420
+ }
244421
+ try {
244422
+ const exitCode = await new Promise((resolvePromise) => {
244423
+ const child = spawn3("deno", ["run", "--allow-all", "--node-modules-dir=auto", EXEC_WRAPPER_PATH, ...extraArgs], {
244424
+ env: {
244425
+ ...process.env,
244426
+ SCRIPT_PATH: scriptPath,
244427
+ BASE44_APP_ID: appConfig.id,
244428
+ BASE44_ACCESS_TOKEN: appUserToken,
244429
+ BASE44_API_URL: getBase44ApiUrl()
244430
+ },
244431
+ stdio: "inherit"
244432
+ });
244433
+ child.on("close", (code2) => {
244434
+ resolvePromise(code2 ?? 1);
244435
+ });
244436
+ });
244437
+ if (exitCode !== 0) {
244438
+ process.exitCode = exitCode;
244439
+ }
244440
+ } finally {
244441
+ if (tempFile) {
244442
+ try {
244443
+ unlinkSync(tempFile);
244444
+ } catch {}
244445
+ }
244446
+ }
244447
+ return {};
244448
+ }
244449
+ function getExecCommand(context) {
244450
+ const cmd = new Command("exec").description("Run a script with the Base44 SDK pre-authenticated as the current user").argument("[script]", "Path to a .ts or .js script file").option("-e, --eval <code>", "Evaluate inline code").allowUnknownOption(true).action(async (script, options8) => {
244451
+ const dashIndex = process.argv.indexOf("--");
244452
+ const extraArgs = dashIndex !== -1 ? process.argv.slice(dashIndex + 1) : [];
244453
+ await runCommand(() => execAction(script, options8, extraArgs), { requireAuth: true }, context);
244454
+ });
244455
+ return cmd;
244456
+ }
244457
+
244355
244458
  // src/cli/commands/project/eject.ts
244356
- import { resolve as resolve6 } from "node:path";
244459
+ import { resolve as resolve7 } from "node:path";
244357
244460
  var import_lodash2 = __toESM(require_lodash(), 1);
244358
244461
  async function eject(options8) {
244359
244462
  const projects = await listProjects();
@@ -244402,7 +244505,7 @@ async function eject(options8) {
244402
244505
  Ne("Operation cancelled.");
244403
244506
  throw new CLIExitError(0);
244404
244507
  }
244405
- const resolvedPath = resolve6(selectedPath);
244508
+ const resolvedPath = resolve7(selectedPath);
244406
244509
  await runTask("Downloading your project's code...", async (updateMessage) => {
244407
244510
  await createProjectFilesForExistingProject({
244408
244511
  projectId,
@@ -244468,6 +244571,7 @@ function createProgram(context) {
244468
244571
  program2.addCommand(getSecretsCommand(context));
244469
244572
  program2.addCommand(getSiteCommand(context));
244470
244573
  program2.addCommand(getTypesCommand(context));
244574
+ program2.addCommand(getExecCommand(context));
244471
244575
  program2.addCommand(getDevCommand(context), { hidden: true });
244472
244576
  program2.addCommand(getLogsCommand(context), { hidden: true });
244473
244577
  return program2;
@@ -244478,7 +244582,7 @@ var import_detect_agent = __toESM(require_dist5(), 1);
244478
244582
  import { release, type } from "node:os";
244479
244583
 
244480
244584
  // node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
244481
- import { dirname as dirname12, posix, sep } from "path";
244585
+ import { dirname as dirname13, posix, sep } from "path";
244482
244586
  function createModulerModifier() {
244483
244587
  const getModuleFromFileName = createGetModuleFromFilename();
244484
244588
  return async (frames) => {
@@ -244487,7 +244591,7 @@ function createModulerModifier() {
244487
244591
  return frames;
244488
244592
  };
244489
244593
  }
244490
- function createGetModuleFromFilename(basePath = process.argv[1] ? dirname12(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
244594
+ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname13(process.argv[1]) : process.cwd(), isWindows4 = sep === "\\") {
244491
244595
  const normalizedBase = isWindows4 ? normalizeWindowsPath2(basePath) : basePath;
244492
244596
  return (filename) => {
244493
244597
  if (!filename)
@@ -246765,14 +246869,14 @@ async function addSourceContext(frames) {
246765
246869
  return frames;
246766
246870
  }
246767
246871
  function getContextLinesFromFile(path19, ranges, output) {
246768
- return new Promise((resolve7) => {
246872
+ return new Promise((resolve8) => {
246769
246873
  const stream = createReadStream2(path19);
246770
246874
  const lineReaded = createInterface2({
246771
246875
  input: stream
246772
246876
  });
246773
246877
  function destroyStreamAndResolve() {
246774
246878
  stream.destroy();
246775
- resolve7();
246879
+ resolve8();
246776
246880
  }
246777
246881
  let lineNumber = 0;
246778
246882
  let currentRangeIndex = 0;
@@ -247884,15 +247988,15 @@ class PostHogBackendClient extends PostHogCoreStateless {
247884
247988
  return true;
247885
247989
  if (this.featureFlagsPoller === undefined)
247886
247990
  return false;
247887
- return new Promise((resolve7) => {
247991
+ return new Promise((resolve8) => {
247888
247992
  const timeout3 = setTimeout(() => {
247889
247993
  cleanup();
247890
- resolve7(false);
247994
+ resolve8(false);
247891
247995
  }, timeoutMs);
247892
247996
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
247893
247997
  clearTimeout(timeout3);
247894
247998
  cleanup();
247895
- resolve7(count2 > 0);
247999
+ resolve8(count2 > 0);
247896
248000
  });
247897
248001
  });
247898
248002
  }
@@ -248705,4 +248809,4 @@ export {
248705
248809
  CLIExitError
248706
248810
  };
248707
248811
 
248708
- //# debugId=3A2721A692CF8F1564756E2164756E21
248812
+ //# debugId=8D11C7597C91089364756E2164756E21