@base44-preview/cli 0.0.55-pr.540.1e017a6 → 0.0.55-pr.540.69b8bca

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
@@ -218285,7 +218285,6 @@ var PROJECT_CONFIG_PATTERNS = [
218285
218285
  `${PROJECT_SUBDIR}/config.${CONFIG_FILE_EXTENSION_GLOB}`,
218286
218286
  `config.${CONFIG_FILE_EXTENSION_GLOB}`
218287
218287
  ];
218288
- var BASE44_APP_ID_ENV_VAR = "BASE44_APP_ID";
218289
218288
  var TYPES_OUTPUT_SUBDIR = ".types";
218290
218289
  var TYPES_FILENAME = "types.d.ts";
218291
218290
  var AUTH_CLIENT_ID = "base44_cli";
@@ -233981,7 +233980,7 @@ async function parseEnvFile(filePath) {
233981
233980
  }
233982
233981
  var STRIPE_ENV_PREFIX = "BASE44_PROJECTS_";
233983
233982
  var BASE44_ENV_KEYS = [
233984
- BASE44_APP_ID_ENV_VAR,
233983
+ "BASE44_APP_ID",
233985
233984
  "BASE44_ACCESS_TOKEN",
233986
233985
  "BASE44_REFRESH_TOKEN",
233987
233986
  "BASE44_API_URL"
@@ -235750,12 +235749,11 @@ var theme = {
235750
235749
  if (hints.length === 0) {
235751
235750
  return null;
235752
235751
  }
235753
- const hintLines = hints.flatMap((hint) => {
235754
- const lines = [` ${hint.message}`];
235752
+ const hintLines = hints.map((hint) => {
235755
235753
  if (hint.command) {
235756
- lines.push(` Run: ${hint.command}`);
235754
+ return ` Run: ${hint.command}`;
235757
235755
  }
235758
- return lines;
235756
+ return ` ${hint.message}`;
235759
235757
  });
235760
235758
  return ["[Agent Hints]", ...hintLines].join(`
235761
235759
  `);
@@ -241696,35 +241694,18 @@ function loadFromTestOverrides() {
241696
241694
  }
241697
241695
  return null;
241698
241696
  }
241699
- async function initAppContext(options = {}) {
241697
+ async function initAppContext() {
241700
241698
  const testConfig = loadFromTestOverrides();
241701
241699
  if (testConfig) {
241702
241700
  cache2 = testConfig;
241703
241701
  return cache2;
241704
241702
  }
241705
- const projectRoot = findProjectRoot();
241706
- if (options.appId !== undefined) {
241707
- const id = options.appId.trim();
241708
- if (!id) {
241709
- throw new InvalidInputError("App id cannot be empty.");
241710
- }
241711
- cache2 = { id, projectRoot: projectRoot?.root };
241712
- return cache2;
241713
- }
241714
241703
  if (cache2) {
241715
241704
  return cache2;
241716
241705
  }
241706
+ const projectRoot = findProjectRoot();
241717
241707
  if (!projectRoot) {
241718
- throw new ConfigNotFoundError(`No Base44 app ID found. Pass --app-id, set ${BASE44_APP_ID_ENV_VAR}, or run this command from a linked project with base44/.app.jsonc.`, {
241719
- hints: [
241720
- { message: "Pass an app ID explicitly with --app-id <id>" },
241721
- { message: `Set ${BASE44_APP_ID_ENV_VAR} in your environment` },
241722
- {
241723
- message: "Run from a linked Base44 project with base44/.app.jsonc, or run 'base44 link'",
241724
- command: "base44 link"
241725
- }
241726
- ]
241727
- });
241708
+ throw new ConfigNotFoundError("No Base44 project found. Run this command from a project directory with a config.jsonc file.");
241728
241709
  }
241729
241710
  const config3 = await readAppConfig(projectRoot.root);
241730
241711
  const appConfigPath = await findAppConfigPath(projectRoot.root);
@@ -241862,8 +241843,8 @@ async function getAppUserToken() {
241862
241843
  throw await ApiError.fromHttpError(error48, "exchanging platform token for app user token");
241863
241844
  }
241864
241845
  }
241865
- async function getSiteUrl(projectId) {
241866
- const id = projectId ?? getAppContext().id;
241846
+ async function getSiteUrl() {
241847
+ const id = getAppContext().id;
241867
241848
  let response;
241868
241849
  try {
241869
241850
  response = await base44Client.get(`api/apps/platform/${id}/published-url`);
@@ -244452,8 +244433,8 @@ async function ensureAuth(ctx) {
244452
244433
  });
244453
244434
  } catch {}
244454
244435
  }
244455
- async function ensureAppContext(ctx, options = {}) {
244456
- const appContext = await initAppContext(options);
244436
+ async function ensureAppContext(ctx) {
244437
+ const appContext = await initAppContext();
244457
244438
  ctx.app = appContext;
244458
244439
  ctx.errorReporter.setContext({ appId: appContext.id });
244459
244440
  }
@@ -251119,8 +251100,7 @@ class Base44Command extends Command {
251119
251100
  await ensureAuth(this.context);
251120
251101
  }
251121
251102
  if (this._commandOptions.requireAppContext) {
251122
- const { appId } = this.optsWithGlobals();
251123
- await ensureAppContext(this.context, { appId });
251103
+ await ensureAppContext(this.context);
251124
251104
  }
251125
251105
  const result = await fn(this.context, ...args) ?? {};
251126
251106
  if (!quiet) {
@@ -253089,11 +253069,7 @@ function printProjectSummary({ name: name2, dashboardUrl, appUrl }, log) {
253089
253069
  }
253090
253070
 
253091
253071
  // src/cli/commands/project/create.ts
253092
- function validateCreateOptions(command2) {
253093
- const { appId } = command2.optsWithGlobals();
253094
- if (appId !== undefined) {
253095
- command2.error(`base44 create cannot be used with --app-id or ${BASE44_APP_ID_ENV_VAR}.`);
253096
- }
253072
+ function validateNonInteractiveFlags(command2) {
253097
253073
  const { path: path17 } = command2.opts();
253098
253074
  if (path17 && !command2.args.length) {
253099
253075
  command2.error("--path requires a project name argument. Usage: base44 create <name> --path <path>");
@@ -253210,7 +253186,7 @@ function getCreateCommand() {
253210
253186
  Examples:
253211
253187
  $ base44 create my-app Creates a base44 project at ./my-app
253212
253188
  $ base44 create my-todo-app --template backend-and-client Creates a base44 backend-and-client project at ./my-todo-app
253213
- $ base44 create my-app --path ./projects/my-app --deploy Creates a base44 project at ./project/my-app and deploys it`).hook("preAction", validateCreateOptions).action(createAction);
253189
+ $ base44 create my-app --path ./projects/my-app --deploy Creates a base44 project at ./project/my-app and deploys it`).hook("preAction", validateNonInteractiveFlags).action(createAction);
253214
253190
  }
253215
253191
 
253216
253192
  // src/cli/commands/project/deploy.ts
@@ -253306,32 +253282,11 @@ function printStripeResult(r, log) {
253306
253282
  log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
253307
253283
  }
253308
253284
 
253309
- // src/cli/commands/project/app-id-options.ts
253310
- function readExplicitAppId(command2) {
253311
- const { appId } = command2.optsWithGlobals();
253312
- const { projectId } = command2.opts();
253313
- const explicitAppId = command2.getOptionValueSourceWithGlobals("appId") === "cli" ? appId : undefined;
253314
- const legacyProjectId = command2.getOptionValueSource("projectId") === "cli" ? projectId : undefined;
253315
- return {
253316
- appId: explicitAppId,
253317
- legacyProjectId,
253318
- value: explicitAppId ?? legacyProjectId
253319
- };
253320
- }
253321
-
253322
253285
  // src/cli/commands/project/link.ts
253323
- function validateNonInteractiveFlags(command2) {
253324
- const { create: create4, name: name2 } = command2.opts();
253325
- const {
253326
- appId,
253327
- legacyProjectId,
253328
- value: selectedAppId
253329
- } = readExplicitAppId(command2);
253330
- if (appId && legacyProjectId) {
253331
- command2.error("--app-id and --project-id cannot be used together");
253332
- }
253333
- if (create4 && selectedAppId) {
253334
- command2.error("--create and --app-id cannot be used together");
253286
+ function validateNonInteractiveFlags2(command2) {
253287
+ const { create: create4, name: name2, projectId } = command2.opts();
253288
+ if (create4 && projectId) {
253289
+ command2.error("--create and --projectId cannot be used together");
253335
253290
  }
253336
253291
  if (create4 && !name2) {
253337
253292
  command2.error("--name is required when using --create");
@@ -253400,12 +253355,11 @@ async function promptForExistingProject(linkableProjects) {
253400
253355
  }
253401
253356
  return selectedProject;
253402
253357
  }
253403
- async function link(ctx, options, command2) {
253358
+ async function link(ctx, options) {
253404
253359
  const { log, runTask: runTask2, isNonInteractive } = ctx;
253405
- const appId = readExplicitAppId(command2).value;
253406
- const skipPrompts = !!options.create || !!appId;
253360
+ const skipPrompts = !!options.create || !!options.projectId;
253407
253361
  if (!skipPrompts && isNonInteractive) {
253408
- throw new InvalidInputError("--create with --name, or --app-id, is required in non-interactive mode");
253362
+ throw new InvalidInputError("--create with --name, or --projectId, is required in non-interactive mode");
253409
253363
  }
253410
253364
  const projectRoot = findProjectRoot();
253411
253365
  if (!projectRoot) {
@@ -253420,8 +253374,8 @@ async function link(ctx, options, command2) {
253420
253374
  ]
253421
253375
  });
253422
253376
  }
253423
- let finalAppId;
253424
- const action = appId ? "choose" : options.create ? "create" : await promptForLinkAction();
253377
+ let finalProjectId;
253378
+ const action = options.projectId ? "choose" : options.create ? "create" : await promptForLinkAction();
253425
253379
  if (action === "choose") {
253426
253380
  const projects = await runTask2("Fetching projects...", async () => listProjects(), {
253427
253381
  successMessage: "Projects fetched",
@@ -253431,32 +253385,32 @@ async function link(ctx, options, command2) {
253431
253385
  if (!linkableProjects.length) {
253432
253386
  return { outroMessage: "No projects available for linking" };
253433
253387
  }
253434
- let linkedAppId;
253435
- if (appId) {
253436
- const project2 = linkableProjects.find((p) => p.id === appId);
253388
+ let projectId;
253389
+ if (options.projectId) {
253390
+ const project2 = linkableProjects.find((p) => p.id === options.projectId);
253437
253391
  if (!project2) {
253438
- throw new InvalidInputError(`App with ID "${appId}" not found or not available for linking.`, {
253392
+ throw new InvalidInputError(`Project with ID "${options.projectId}" not found or not available for linking.`, {
253439
253393
  hints: [
253440
- { message: "Check the app ID is correct" },
253394
+ { message: "Check the project ID is correct" },
253441
253395
  {
253442
- message: "Use 'base44 link' without --app-id to see available projects"
253396
+ message: "Use 'base44 link' without --projectId to see available projects"
253443
253397
  }
253444
253398
  ]
253445
253399
  });
253446
253400
  }
253447
- linkedAppId = appId;
253401
+ projectId = options.projectId;
253448
253402
  } else {
253449
253403
  const selectedProject = await promptForExistingProject(linkableProjects);
253450
- linkedAppId = selectedProject.id;
253404
+ projectId = selectedProject.id;
253451
253405
  }
253452
253406
  await runTask2("Linking project...", async () => {
253453
- await writeAppConfig(projectRoot.root, linkedAppId);
253454
- setAppContext({ id: linkedAppId, projectRoot: projectRoot.root });
253407
+ await writeAppConfig(projectRoot.root, projectId);
253408
+ setAppContext({ id: projectId, projectRoot: projectRoot.root });
253455
253409
  }, {
253456
253410
  successMessage: "Project linked successfully",
253457
253411
  errorMessage: "Failed to link project"
253458
253412
  });
253459
- finalAppId = linkedAppId;
253413
+ finalProjectId = projectId;
253460
253414
  }
253461
253415
  if (action === "create") {
253462
253416
  const { name: name2, description } = options.create ? { name: options.name.trim(), description: options.description?.trim() } : await promptForNewProjectDetails();
@@ -253468,15 +253422,13 @@ async function link(ctx, options, command2) {
253468
253422
  });
253469
253423
  await writeAppConfig(projectRoot.root, projectId);
253470
253424
  setAppContext({ id: projectId, projectRoot: projectRoot.root });
253471
- finalAppId = projectId;
253425
+ finalProjectId = projectId;
253472
253426
  }
253473
- log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(finalAppId))}`);
253427
+ log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(finalProjectId))}`);
253474
253428
  return { outroMessage: "Project linked" };
253475
253429
  }
253476
253430
  function getLinkCommand() {
253477
- return new Base44Command("link", {
253478
- requireAppContext: false
253479
- }).description("Link a local project to a Base44 project (create new or link existing)").configureHelp({ showGlobalOptions: true }).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").addOption(new Option("-p, --project-id <id>", "Project ID to link to an existing project").hideHelp()).addOption(new Option("--projectId <id>", "Project ID to link to an existing project").hideHelp()).hook("preAction", validateNonInteractiveFlags).action(link);
253431
+ return new Base44Command("link", { requireAppContext: false }).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(link);
253480
253432
  }
253481
253433
 
253482
253434
  // src/cli/commands/project/logs.ts
@@ -253570,20 +253522,6 @@ async function getAllFunctionNames() {
253570
253522
  const { functions } = await readProjectConfig();
253571
253523
  return functions.map((fn) => fn.name);
253572
253524
  }
253573
- async function getProjectFunctionNamesIfAvailable() {
253574
- try {
253575
- return await getAllFunctionNames();
253576
- } catch (error48) {
253577
- if (error48 instanceof ConfigNotFoundError) {
253578
- return null;
253579
- }
253580
- throw error48;
253581
- }
253582
- }
253583
- async function getRemoteFunctionNames() {
253584
- const { functions } = await listDeployedFunctions();
253585
- return functions.map((fn) => fn.name);
253586
- }
253587
253525
  function validateLimit(limit) {
253588
253526
  if (limit === undefined)
253589
253527
  return;
@@ -253595,14 +253533,12 @@ function validateLimit(limit) {
253595
253533
  async function logsAction(_ctx, options) {
253596
253534
  validateLimit(options.limit);
253597
253535
  const specifiedFunctions = parseFunctionNames(options.function);
253598
- const allProjectFunctions = specifiedFunctions.length > 0 ? await getProjectFunctionNamesIfAvailable() ?? [] : await getProjectFunctionNamesIfAvailable();
253599
- const functionNames = specifiedFunctions.length > 0 ? specifiedFunctions : allProjectFunctions ?? await getRemoteFunctionNames();
253536
+ const allProjectFunctions = await getAllFunctionNames();
253537
+ const functionNames = specifiedFunctions.length > 0 ? specifiedFunctions : allProjectFunctions;
253600
253538
  if (functionNames.length === 0) {
253601
- return {
253602
- outroMessage: allProjectFunctions ? "No functions found in this project." : "No functions found in this app."
253603
- };
253539
+ return { outroMessage: "No functions found in this project." };
253604
253540
  }
253605
- let entries = await fetchLogsForFunctions(functionNames, options, allProjectFunctions ?? functionNames);
253541
+ let entries = await fetchLogsForFunctions(functionNames, options, allProjectFunctions);
253606
253542
  const limit = options.limit ? Number.parseInt(options.limit, 10) : undefined;
253607
253543
  if (limit !== undefined && entries.length > limit) {
253608
253544
  entries = entries.slice(0, limit);
@@ -253618,20 +253554,17 @@ function getLogsCommand() {
253618
253554
  // src/cli/commands/project/scaffold.ts
253619
253555
  import { basename as basename5, resolve as resolve6 } from "node:path";
253620
253556
  function resolveAppId(options) {
253621
- const appId = options.appId;
253557
+ const appId = options.appId ?? process.env.BASE44_APP_ID;
253622
253558
  if (!appId) {
253623
253559
  throw new InvalidInputError("No app ID found. `base44 scaffold` sets up a local project for an existing Base44 app.", {
253624
- hints: [
253625
- { message: "Pass it explicitly with --app-id <id>" },
253626
- { message: `Set ${BASE44_APP_ID_ENV_VAR} in your environment` }
253627
- ]
253560
+ hints: [{ message: "Pass it explicitly with --app-id <id>" }]
253628
253561
  });
253629
253562
  }
253630
253563
  return appId;
253631
253564
  }
253632
- async function scaffoldAction(ctx, name2, options, command2) {
253565
+ async function scaffoldAction(ctx, name2, options) {
253633
253566
  const { log, runTask: runTask2 } = ctx;
253634
- const appId = resolveAppId(command2.optsWithGlobals());
253567
+ const appId = resolveAppId(options);
253635
253568
  const resolvedPath = resolve6("./");
253636
253569
  const projectName = (name2 ?? basename5(resolvedPath)).trim();
253637
253570
  const template2 = await getTemplateById("backend-only");
@@ -253663,7 +253596,7 @@ function getScaffoldCommand() {
253663
253596
  return new Base44Command("scaffold", {
253664
253597
  requireAppContext: false,
253665
253598
  fullBanner: true
253666
- }).description("Scaffold a local project for an existing Base44 app").addArgument(new Argument("name", "Project name").argOptional()).option("--no-skills", "Skip AI agent skills installation").addHelpText("after", `
253599
+ }).description("Scaffold a local project for an existing Base44 app").addArgument(new Argument("name", "Project name").argOptional()).option("--app-id <id>", "Existing Base44 app ID").option("--no-skills", "Skip AI agent skills installation").addHelpText("after", `
253667
253600
  Examples:
253668
253601
  $ base44 scaffold --app-id app_123 Scaffolds the current dir for the given app
253669
253602
  $ base44 scaffold my-app --app-id app_123 Scaffolds the current dir, named "my-app"`).action(scaffoldAction);
@@ -257419,10 +257352,7 @@ function readStdin2() {
257419
257352
  process.stdin.on("error", reject);
257420
257353
  });
257421
257354
  }
257422
- async function execAction({
257423
- app,
257424
- isNonInteractive
257425
- }) {
257355
+ async function execAction(isNonInteractive) {
257426
257356
  const noInputError = new InvalidInputError("No input provided. Pipe a script to stdin.", {
257427
257357
  hints: [
257428
257358
  { message: "File: cat ./script.ts | base44 exec" },
@@ -257438,7 +257368,7 @@ async function execAction({
257438
257368
  if (!code2.trim()) {
257439
257369
  throw noInputError;
257440
257370
  }
257441
- const { exitCode } = await runScript({ appId: app.id, code: code2 });
257371
+ const { exitCode } = await runScript({ appId: getAppContext().id, code: code2 });
257442
257372
  if (exitCode !== 0) {
257443
257373
  process.exitCode = exitCode;
257444
257374
  }
@@ -257451,26 +257381,18 @@ Examples:
257451
257381
  $ cat ./script.ts | base44 exec
257452
257382
 
257453
257383
  Inline script:
257454
- $ echo "const users = await base44.entities.User.list()" | base44 exec`).action(async (ctx) => {
257455
- return await execAction(ctx);
257384
+ $ echo "const users = await base44.entities.User.list()" | base44 exec`).action(async ({ isNonInteractive }) => {
257385
+ return await execAction(isNonInteractive);
257456
257386
  });
257457
257387
  }
257458
257388
 
257459
257389
  // src/cli/commands/project/eject.ts
257460
257390
  import { resolve as resolve12 } from "node:path";
257461
257391
  var import_kebabCase2 = __toESM(require_kebabCase(), 1);
257462
- async function eject(ctx, options8, command2) {
257392
+ async function eject(ctx, options8) {
257463
257393
  const { log, runTask: runTask2, isNonInteractive } = ctx;
257464
- const {
257465
- appId,
257466
- legacyProjectId,
257467
- value: selectedAppId
257468
- } = readExplicitAppId(command2);
257469
- if (appId && legacyProjectId) {
257470
- throw new InvalidInputError("--app-id and --project-id cannot be used together");
257471
- }
257472
- if (isNonInteractive && !selectedAppId) {
257473
- throw new InvalidInputError("--app-id is required in non-interactive mode");
257394
+ if (isNonInteractive && !options8.projectId) {
257395
+ throw new InvalidInputError("--project-id is required in non-interactive mode");
257474
257396
  }
257475
257397
  if (isNonInteractive && !options8.path) {
257476
257398
  throw new InvalidInputError("--path is required in non-interactive mode");
@@ -257478,13 +257400,13 @@ async function eject(ctx, options8, command2) {
257478
257400
  const projects = await listProjects();
257479
257401
  const ejectableProjects = projects.filter((p4) => p4.isManagedSourceCode !== false);
257480
257402
  let selectedProject;
257481
- if (selectedAppId) {
257482
- const foundProject = ejectableProjects.find((p4) => p4.id === selectedAppId);
257403
+ if (options8.projectId) {
257404
+ const foundProject = ejectableProjects.find((p4) => p4.id === options8.projectId);
257483
257405
  if (!foundProject) {
257484
- throw new InvalidInputError(`App with ID "${selectedAppId}" not found or not ejectable`, {
257406
+ throw new InvalidInputError(`Project with ID "${options8.projectId}" not found or not ejectable`, {
257485
257407
  hints: [
257486
257408
  {
257487
- message: "Run 'base44 eject' without --app-id to see available projects"
257409
+ message: "Run 'base44 eject' without --project-id to see available projects"
257488
257410
  }
257489
257411
  ]
257490
257412
  });
@@ -257560,15 +257482,13 @@ async function eject(ctx, options8, command2) {
257560
257482
  return { outroMessage: "Your new project is set and ready to use" };
257561
257483
  }
257562
257484
  function getEjectCommand() {
257563
- return new Base44Command("eject", {
257564
- requireAppContext: false
257565
- }).description("Download the code for an existing Base44 project").configureHelp({ showGlobalOptions: true }).option("-p, --path <path>", "Path where to write the project").option("-y, --yes", "Skip confirmation prompts").addOption(new Option("--project-id <id>", "Project ID to eject (skips interactive selection)").hideHelp()).action(eject);
257485
+ return new Base44Command("eject", { requireAppContext: false }).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(eject);
257566
257486
  }
257567
257487
 
257568
257488
  // src/cli/program.ts
257569
257489
  function createProgram(context) {
257570
257490
  const program2 = new Command;
257571
- 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));
257491
+ program2.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(package_default.version);
257572
257492
  program2.configureHelp({
257573
257493
  sortSubcommands: true
257574
257494
  });
@@ -261842,4 +261762,4 @@ export {
261842
261762
  CLIExitError
261843
261763
  };
261844
261764
 
261845
- //# debugId=51EFACBA13CCECB164756E2164756E21
261765
+ //# debugId=A648AA5C0FFA5F4264756E2164756E21