@base44-preview/cli 0.0.55-pr.540.6a4c0e6 → 0.0.55-pr.540.d15d29c

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"
@@ -241696,35 +241695,18 @@ function loadFromTestOverrides() {
241696
241695
  }
241697
241696
  return null;
241698
241697
  }
241699
- async function initAppContext(options = {}) {
241698
+ async function initAppContext() {
241700
241699
  const testConfig = loadFromTestOverrides();
241701
241700
  if (testConfig) {
241702
241701
  cache2 = testConfig;
241703
241702
  return cache2;
241704
241703
  }
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
241704
  if (cache2) {
241715
241705
  return cache2;
241716
241706
  }
241707
+ const projectRoot = findProjectRoot();
241717
241708
  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
- });
241709
+ throw new ConfigNotFoundError("No Base44 project found. Run this command from a project directory with a config.jsonc file.");
241728
241710
  }
241729
241711
  const config3 = await readAppConfig(projectRoot.root);
241730
241712
  const appConfigPath = await findAppConfigPath(projectRoot.root);
@@ -244452,8 +244434,8 @@ async function ensureAuth(ctx) {
244452
244434
  });
244453
244435
  } catch {}
244454
244436
  }
244455
- async function ensureAppContext(ctx, options = {}) {
244456
- const appContext = await initAppContext(options);
244437
+ async function ensureAppContext(ctx) {
244438
+ const appContext = await initAppContext();
244457
244439
  ctx.app = appContext;
244458
244440
  ctx.errorReporter.setContext({ appId: appContext.id });
244459
244441
  }
@@ -251119,8 +251101,7 @@ class Base44Command extends Command {
251119
251101
  await ensureAuth(this.context);
251120
251102
  }
251121
251103
  if (this._commandOptions.requireAppContext) {
251122
- const { appId } = this.optsWithGlobals();
251123
- await ensureAppContext(this.context, { appId });
251104
+ await ensureAppContext(this.context);
251124
251105
  }
251125
251106
  const result = await fn(this.context, ...args) ?? {};
251126
251107
  if (!quiet) {
@@ -253089,11 +253070,7 @@ function printProjectSummary({ name: name2, dashboardUrl, appUrl }, log) {
253089
253070
  }
253090
253071
 
253091
253072
  // 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
- }
253073
+ function validateNonInteractiveFlags(command2) {
253097
253074
  const { path: path17 } = command2.opts();
253098
253075
  if (path17 && !command2.args.length) {
253099
253076
  command2.error("--path requires a project name argument. Usage: base44 create <name> --path <path>");
@@ -253210,7 +253187,7 @@ function getCreateCommand() {
253210
253187
  Examples:
253211
253188
  $ base44 create my-app Creates a base44 project at ./my-app
253212
253189
  $ 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);
253190
+ $ 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
253191
  }
253215
253192
 
253216
253193
  // src/cli/commands/project/deploy.ts
@@ -253306,32 +253283,11 @@ function printStripeResult(r, log) {
253306
253283
  log.info(` Connectors dashboard: ${theme.colors.links(getConnectorsUrl())}`);
253307
253284
  }
253308
253285
 
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
253286
  // 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");
253287
+ function validateNonInteractiveFlags2(command2) {
253288
+ const { create: create4, name: name2, projectId } = command2.opts();
253289
+ if (create4 && projectId) {
253290
+ command2.error("--create and --projectId cannot be used together");
253335
253291
  }
253336
253292
  if (create4 && !name2) {
253337
253293
  command2.error("--name is required when using --create");
@@ -253400,12 +253356,11 @@ async function promptForExistingProject(linkableProjects) {
253400
253356
  }
253401
253357
  return selectedProject;
253402
253358
  }
253403
- async function link(ctx, options, command2) {
253359
+ async function link(ctx, options) {
253404
253360
  const { log, runTask: runTask2, isNonInteractive } = ctx;
253405
- const appId = readExplicitAppId(command2).value;
253406
- const skipPrompts = !!options.create || !!appId;
253361
+ const skipPrompts = !!options.create || !!options.projectId;
253407
253362
  if (!skipPrompts && isNonInteractive) {
253408
- throw new InvalidInputError("--create with --name, or --app-id, is required in non-interactive mode");
253363
+ throw new InvalidInputError("--create with --name, or --projectId, is required in non-interactive mode");
253409
253364
  }
253410
253365
  const projectRoot = findProjectRoot();
253411
253366
  if (!projectRoot) {
@@ -253420,8 +253375,8 @@ async function link(ctx, options, command2) {
253420
253375
  ]
253421
253376
  });
253422
253377
  }
253423
- let finalAppId;
253424
- const action = appId ? "choose" : options.create ? "create" : await promptForLinkAction();
253378
+ let finalProjectId;
253379
+ const action = options.projectId ? "choose" : options.create ? "create" : await promptForLinkAction();
253425
253380
  if (action === "choose") {
253426
253381
  const projects = await runTask2("Fetching projects...", async () => listProjects(), {
253427
253382
  successMessage: "Projects fetched",
@@ -253431,32 +253386,32 @@ async function link(ctx, options, command2) {
253431
253386
  if (!linkableProjects.length) {
253432
253387
  return { outroMessage: "No projects available for linking" };
253433
253388
  }
253434
- let linkedAppId;
253435
- if (appId) {
253436
- const project2 = linkableProjects.find((p) => p.id === appId);
253389
+ let projectId;
253390
+ if (options.projectId) {
253391
+ const project2 = linkableProjects.find((p) => p.id === options.projectId);
253437
253392
  if (!project2) {
253438
- throw new InvalidInputError(`App with ID "${appId}" not found or not available for linking.`, {
253393
+ throw new InvalidInputError(`Project with ID "${options.projectId}" not found or not available for linking.`, {
253439
253394
  hints: [
253440
- { message: "Check the app ID is correct" },
253395
+ { message: "Check the project ID is correct" },
253441
253396
  {
253442
- message: "Use 'base44 link' without --app-id to see available projects"
253397
+ message: "Use 'base44 link' without --projectId to see available projects"
253443
253398
  }
253444
253399
  ]
253445
253400
  });
253446
253401
  }
253447
- linkedAppId = appId;
253402
+ projectId = options.projectId;
253448
253403
  } else {
253449
253404
  const selectedProject = await promptForExistingProject(linkableProjects);
253450
- linkedAppId = selectedProject.id;
253405
+ projectId = selectedProject.id;
253451
253406
  }
253452
253407
  await runTask2("Linking project...", async () => {
253453
- await writeAppConfig(projectRoot.root, linkedAppId);
253454
- setAppContext({ id: linkedAppId, projectRoot: projectRoot.root });
253408
+ await writeAppConfig(projectRoot.root, projectId);
253409
+ setAppContext({ id: projectId, projectRoot: projectRoot.root });
253455
253410
  }, {
253456
253411
  successMessage: "Project linked successfully",
253457
253412
  errorMessage: "Failed to link project"
253458
253413
  });
253459
- finalAppId = linkedAppId;
253414
+ finalProjectId = projectId;
253460
253415
  }
253461
253416
  if (action === "create") {
253462
253417
  const { name: name2, description } = options.create ? { name: options.name.trim(), description: options.description?.trim() } : await promptForNewProjectDetails();
@@ -253468,15 +253423,13 @@ async function link(ctx, options, command2) {
253468
253423
  });
253469
253424
  await writeAppConfig(projectRoot.root, projectId);
253470
253425
  setAppContext({ id: projectId, projectRoot: projectRoot.root });
253471
- finalAppId = projectId;
253426
+ finalProjectId = projectId;
253472
253427
  }
253473
- log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(finalAppId))}`);
253428
+ log.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(finalProjectId))}`);
253474
253429
  return { outroMessage: "Project linked" };
253475
253430
  }
253476
253431
  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);
253432
+ 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
253433
  }
253481
253434
 
253482
253435
  // src/cli/commands/project/logs.ts
@@ -253566,12 +253519,8 @@ async function fetchLogsForFunctions(functionNames, options, availableFunctionNa
253566
253519
  }
253567
253520
  return allEntries;
253568
253521
  }
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();
253522
+ async function getAllFunctionNames() {
253523
+ const { functions } = await readProjectConfig();
253575
253524
  return functions.map((fn) => fn.name);
253576
253525
  }
253577
253526
  function validateLimit(limit) {
@@ -253582,18 +253531,15 @@ function validateLimit(limit) {
253582
253531
  throw new InvalidInputError(`Invalid limit: "${limit}". Must be a number between 1 and 1000.`);
253583
253532
  }
253584
253533
  }
253585
- async function logsAction(ctx, options) {
253534
+ async function logsAction(_ctx, options) {
253586
253535
  validateLimit(options.limit);
253587
253536
  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;
253537
+ const allProjectFunctions = await getAllFunctionNames();
253538
+ const functionNames = specifiedFunctions.length > 0 ? specifiedFunctions : allProjectFunctions;
253591
253539
  if (functionNames.length === 0) {
253592
- return {
253593
- outroMessage: localProjectRoot ? "No functions found in this project." : "No functions found in this app."
253594
- };
253540
+ return { outroMessage: "No functions found in this project." };
253595
253541
  }
253596
- let entries = await fetchLogsForFunctions(functionNames, options, availableFunctionNames);
253542
+ let entries = await fetchLogsForFunctions(functionNames, options, allProjectFunctions);
253597
253543
  const limit = options.limit ? Number.parseInt(options.limit, 10) : undefined;
253598
253544
  if (limit !== undefined && entries.length > limit) {
253599
253545
  entries = entries.slice(0, limit);
@@ -253609,20 +253555,17 @@ function getLogsCommand() {
253609
253555
  // src/cli/commands/project/scaffold.ts
253610
253556
  import { basename as basename5, resolve as resolve6 } from "node:path";
253611
253557
  function resolveAppId(options) {
253612
- const appId = options.appId;
253558
+ const appId = options.appId ?? process.env.BASE44_APP_ID;
253613
253559
  if (!appId) {
253614
253560
  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
- ]
253561
+ hints: [{ message: "Pass it explicitly with --app-id <id>" }]
253619
253562
  });
253620
253563
  }
253621
253564
  return appId;
253622
253565
  }
253623
- async function scaffoldAction(ctx, name2, options, command2) {
253566
+ async function scaffoldAction(ctx, name2, options) {
253624
253567
  const { log, runTask: runTask2 } = ctx;
253625
- const appId = resolveAppId(command2.optsWithGlobals());
253568
+ const appId = resolveAppId(options);
253626
253569
  const resolvedPath = resolve6("./");
253627
253570
  const projectName = (name2 ?? basename5(resolvedPath)).trim();
253628
253571
  const template2 = await getTemplateById("backend-only");
@@ -253654,7 +253597,7 @@ function getScaffoldCommand() {
253654
253597
  return new Base44Command("scaffold", {
253655
253598
  requireAppContext: false,
253656
253599
  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", `
253600
+ }).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
253601
  Examples:
253659
253602
  $ base44 scaffold --app-id app_123 Scaffolds the current dir for the given app
253660
253603
  $ base44 scaffold my-app --app-id app_123 Scaffolds the current dir, named "my-app"`).action(scaffoldAction);
@@ -257410,10 +257353,7 @@ function readStdin2() {
257410
257353
  process.stdin.on("error", reject);
257411
257354
  });
257412
257355
  }
257413
- async function execAction({
257414
- app,
257415
- isNonInteractive
257416
- }) {
257356
+ async function execAction(isNonInteractive) {
257417
257357
  const noInputError = new InvalidInputError("No input provided. Pipe a script to stdin.", {
257418
257358
  hints: [
257419
257359
  { message: "File: cat ./script.ts | base44 exec" },
@@ -257429,7 +257369,7 @@ async function execAction({
257429
257369
  if (!code2.trim()) {
257430
257370
  throw noInputError;
257431
257371
  }
257432
- const { exitCode } = await runScript({ appId: app.id, code: code2 });
257372
+ const { exitCode } = await runScript({ appId: getAppContext().id, code: code2 });
257433
257373
  if (exitCode !== 0) {
257434
257374
  process.exitCode = exitCode;
257435
257375
  }
@@ -257442,26 +257382,18 @@ Examples:
257442
257382
  $ cat ./script.ts | base44 exec
257443
257383
 
257444
257384
  Inline script:
257445
- $ echo "const users = await base44.entities.User.list()" | base44 exec`).action(async (ctx) => {
257446
- return await execAction(ctx);
257385
+ $ echo "const users = await base44.entities.User.list()" | base44 exec`).action(async ({ isNonInteractive }) => {
257386
+ return await execAction(isNonInteractive);
257447
257387
  });
257448
257388
  }
257449
257389
 
257450
257390
  // src/cli/commands/project/eject.ts
257451
257391
  import { resolve as resolve12 } from "node:path";
257452
257392
  var import_kebabCase2 = __toESM(require_kebabCase(), 1);
257453
- async function eject(ctx, options8, command2) {
257393
+ async function eject(ctx, options8) {
257454
257394
  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");
257395
+ if (isNonInteractive && !options8.projectId) {
257396
+ throw new InvalidInputError("--project-id is required in non-interactive mode");
257465
257397
  }
257466
257398
  if (isNonInteractive && !options8.path) {
257467
257399
  throw new InvalidInputError("--path is required in non-interactive mode");
@@ -257469,13 +257401,13 @@ async function eject(ctx, options8, command2) {
257469
257401
  const projects = await listProjects();
257470
257402
  const ejectableProjects = projects.filter((p4) => p4.isManagedSourceCode !== false);
257471
257403
  let selectedProject;
257472
- if (selectedAppId) {
257473
- const foundProject = ejectableProjects.find((p4) => p4.id === selectedAppId);
257404
+ if (options8.projectId) {
257405
+ const foundProject = ejectableProjects.find((p4) => p4.id === options8.projectId);
257474
257406
  if (!foundProject) {
257475
- throw new InvalidInputError(`App with ID "${selectedAppId}" not found or not ejectable`, {
257407
+ throw new InvalidInputError(`Project with ID "${options8.projectId}" not found or not ejectable`, {
257476
257408
  hints: [
257477
257409
  {
257478
- message: "Run 'base44 eject' without --app-id to see available projects"
257410
+ message: "Run 'base44 eject' without --project-id to see available projects"
257479
257411
  }
257480
257412
  ]
257481
257413
  });
@@ -257551,15 +257483,13 @@ async function eject(ctx, options8, command2) {
257551
257483
  return { outroMessage: "Your new project is set and ready to use" };
257552
257484
  }
257553
257485
  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);
257486
+ 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
257487
  }
257558
257488
 
257559
257489
  // src/cli/program.ts
257560
257490
  function createProgram(context) {
257561
257491
  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));
257492
+ program2.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(package_default.version);
257563
257493
  program2.configureHelp({
257564
257494
  sortSubcommands: true
257565
257495
  });
@@ -261833,4 +261763,4 @@ export {
261833
261763
  CLIExitError
261834
261764
  };
261835
261765
 
261836
- //# debugId=1AFC96DD14EFBB4A64756E2164756E21
261766
+ //# debugId=3970718286C2C0E164756E2164756E21