@base44-preview/cli 0.0.55-pr.540.9ace9fe → 0.0.55-pr.540.e661f33

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
@@ -253566,12 +253518,8 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
253566
253518
  }
253567
253519
  return allEntries;
253568
253520
  }
253569
- async function getProjectFunctionNames(projectRoot) {
253570
- const { functions } = await readProjectConfig(projectRoot);
253571
- return functions.map((fn) => fn.name);
253572
- }
253573
- async function getRemoteFunctionNames() {
253574
- const { functions } = await listDeployedFunctions();
253521
+ async function getAllFunctionNames() {
253522
+ const { functions } = await readProjectConfig();
253575
253523
  return functions.map((fn) => fn.name);
253576
253524
  }
253577
253525
  function validateLimit(limit) {
@@ -253582,18 +253530,15 @@ function validateLimit(limit) {
253582
253530
  throw new InvalidInputError(`Invalid limit: "${limit}". Must be a number between 1 and 1000.`);
253583
253531
  }
253584
253532
  }
253585
- async function logsAction(ctx, options) {
253533
+ async function logsAction(_ctx, options) {
253586
253534
  validateLimit(options.limit);
253587
253535
  const specifiedFunctions = parseFunctionNames(options.function);
253588
- const localProjectRoot = ctx.app?.projectRoot;
253589
- const availableFunctionNames = localProjectRoot ? await getProjectFunctionNames(localProjectRoot) : await getRemoteFunctionNames();
253590
- const functionNames = specifiedFunctions.length > 0 ? specifiedFunctions : availableFunctionNames;
253536
+ const allProjectFunctions = await getAllFunctionNames();
253537
+ const functionNames = specifiedFunctions.length > 0 ? specifiedFunctions : allProjectFunctions;
253591
253538
  if (functionNames.length === 0) {
253592
- return {
253593
- outroMessage: localProjectRoot ? "No functions found in this project." : "No functions found in this app."
253594
- };
253539
+ return { outroMessage: "No functions found in this project." };
253595
253540
  }
253596
- let entries = await fetchLogsForFunctions(functionNames, options, availableFunctionNames);
253541
+ let entries = await fetchLogsForFunctions(functionNames, options, allProjectFunctions);
253597
253542
  const limit = options.limit ? Number.parseInt(options.limit, 10) : undefined;
253598
253543
  if (limit !== undefined && entries.length > limit) {
253599
253544
  entries = entries.slice(0, limit);
@@ -253609,20 +253554,17 @@ function getLogsCommand() {
253609
253554
  // src/cli/commands/project/scaffold.ts
253610
253555
  import { basename as basename5, resolve as resolve6 } from "node:path";
253611
253556
  function resolveAppId(options) {
253612
- const appId = options.appId;
253557
+ const appId = options.appId ?? process.env.BASE44_APP_ID;
253613
253558
  if (!appId) {
253614
253559
  throw new InvalidInputError("No app ID found. `base44 scaffold` sets up a local project for an existing Base44 app.", {
253615
- hints: [
253616
- { message: "Pass it explicitly with --app-id <id>" },
253617
- { message: `Set ${BASE44_APP_ID_ENV_VAR} in your environment` }
253618
- ]
253560
+ hints: [{ message: "Pass it explicitly with --app-id <id>" }]
253619
253561
  });
253620
253562
  }
253621
253563
  return appId;
253622
253564
  }
253623
- async function scaffoldAction(ctx, name2, options, command2) {
253565
+ async function scaffoldAction(ctx, name2, options) {
253624
253566
  const { log, runTask: runTask2 } = ctx;
253625
- const appId = resolveAppId(command2.optsWithGlobals());
253567
+ const appId = resolveAppId(options);
253626
253568
  const resolvedPath = resolve6("./");
253627
253569
  const projectName = (name2 ?? basename5(resolvedPath)).trim();
253628
253570
  const template2 = await getTemplateById("backend-only");
@@ -253654,7 +253596,7 @@ function getScaffoldCommand() {
253654
253596
  return new Base44Command("scaffold", {
253655
253597
  requireAppContext: false,
253656
253598
  fullBanner: true
253657
- }).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", `
253658
253600
  Examples:
253659
253601
  $ base44 scaffold --app-id app_123 Scaffolds the current dir for the given app
253660
253602
  $ base44 scaffold my-app --app-id app_123 Scaffolds the current dir, named "my-app"`).action(scaffoldAction);
@@ -257410,10 +257352,7 @@ function readStdin2() {
257410
257352
  process.stdin.on("error", reject);
257411
257353
  });
257412
257354
  }
257413
- async function execAction({
257414
- app,
257415
- isNonInteractive
257416
- }) {
257355
+ async function execAction(isNonInteractive) {
257417
257356
  const noInputError = new InvalidInputError("No input provided. Pipe a script to stdin.", {
257418
257357
  hints: [
257419
257358
  { message: "File: cat ./script.ts | base44 exec" },
@@ -257429,7 +257368,7 @@ async function execAction({
257429
257368
  if (!code2.trim()) {
257430
257369
  throw noInputError;
257431
257370
  }
257432
- const { exitCode } = await runScript({ appId: app.id, code: code2 });
257371
+ const { exitCode } = await runScript({ appId: getAppContext().id, code: code2 });
257433
257372
  if (exitCode !== 0) {
257434
257373
  process.exitCode = exitCode;
257435
257374
  }
@@ -257442,26 +257381,18 @@ Examples:
257442
257381
  $ cat ./script.ts | base44 exec
257443
257382
 
257444
257383
  Inline script:
257445
- $ echo "const users = await base44.entities.User.list()" | base44 exec`).action(async (ctx) => {
257446
- return await execAction(ctx);
257384
+ $ echo "const users = await base44.entities.User.list()" | base44 exec`).action(async ({ isNonInteractive }) => {
257385
+ return await execAction(isNonInteractive);
257447
257386
  });
257448
257387
  }
257449
257388
 
257450
257389
  // src/cli/commands/project/eject.ts
257451
257390
  import { resolve as resolve12 } from "node:path";
257452
257391
  var import_kebabCase2 = __toESM(require_kebabCase(), 1);
257453
- async function eject(ctx, options8, command2) {
257392
+ async function eject(ctx, options8) {
257454
257393
  const { log, runTask: runTask2, isNonInteractive } = ctx;
257455
- const {
257456
- appId,
257457
- legacyProjectId,
257458
- value: selectedAppId
257459
- } = readExplicitAppId(command2);
257460
- if (appId && legacyProjectId) {
257461
- throw new InvalidInputError("--app-id and --project-id cannot be used together");
257462
- }
257463
- if (isNonInteractive && !selectedAppId) {
257464
- 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");
257465
257396
  }
257466
257397
  if (isNonInteractive && !options8.path) {
257467
257398
  throw new InvalidInputError("--path is required in non-interactive mode");
@@ -257469,13 +257400,13 @@ async function eject(ctx, options8, command2) {
257469
257400
  const projects = await listProjects();
257470
257401
  const ejectableProjects = projects.filter((p4) => p4.isManagedSourceCode !== false);
257471
257402
  let selectedProject;
257472
- if (selectedAppId) {
257473
- const foundProject = ejectableProjects.find((p4) => p4.id === selectedAppId);
257403
+ if (options8.projectId) {
257404
+ const foundProject = ejectableProjects.find((p4) => p4.id === options8.projectId);
257474
257405
  if (!foundProject) {
257475
- 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`, {
257476
257407
  hints: [
257477
257408
  {
257478
- message: "Run 'base44 eject' without --app-id to see available projects"
257409
+ message: "Run 'base44 eject' without --project-id to see available projects"
257479
257410
  }
257480
257411
  ]
257481
257412
  });
@@ -257551,15 +257482,13 @@ async function eject(ctx, options8, command2) {
257551
257482
  return { outroMessage: "Your new project is set and ready to use" };
257552
257483
  }
257553
257484
  function getEjectCommand() {
257554
- return new Base44Command("eject", {
257555
- requireAppContext: false
257556
- }).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);
257557
257486
  }
257558
257487
 
257559
257488
  // src/cli/program.ts
257560
257489
  function createProgram(context) {
257561
257490
  const program2 = new Command;
257562
- 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);
257563
257492
  program2.configureHelp({
257564
257493
  sortSubcommands: true
257565
257494
  });
@@ -261833,4 +261762,4 @@ export {
261833
261762
  CLIExitError
261834
261763
  };
261835
261764
 
261836
- //# debugId=1AFC96DD14EFBB4A64756E2164756E21
261765
+ //# debugId=A648AA5C0FFA5F4264756E2164756E21