@base44-preview/cli 0.0.13-pr.87.2565e16 → 0.0.14-pr.90.1ad236c

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.
Files changed (2) hide show
  1. package/dist/cli/index.js +46 -188
  2. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -7867,14 +7867,10 @@ var AuthValidationError = class extends Error {
7867
7867
  //#endregion
7868
7868
  //#region src/core/consts.ts
7869
7869
  const PROJECT_SUBDIR = "base44";
7870
- const FUNCTION_CONFIG_FILE = "function.jsonc";
7870
+ const CONFIG_FILE_EXTENSION_GLOB = "{json,jsonc}";
7871
+ const FUNCTION_CONFIG_FILE = `function.${CONFIG_FILE_EXTENSION_GLOB}`;
7871
7872
  function getProjectConfigPatterns() {
7872
- return [
7873
- `${PROJECT_SUBDIR}/config.jsonc`,
7874
- `${PROJECT_SUBDIR}/config.json`,
7875
- "config.jsonc",
7876
- "config.json"
7877
- ];
7873
+ return [`${PROJECT_SUBDIR}/config.${CONFIG_FILE_EXTENSION_GLOB}`, `config.${CONFIG_FILE_EXTENSION_GLOB}`];
7878
7874
  }
7879
7875
  const AUTH_CLIENT_ID = "base44_cli";
7880
7876
 
@@ -16732,7 +16728,7 @@ async function readEntityFile(entityPath) {
16732
16728
  }
16733
16729
  async function readAllEntities(entitiesDir) {
16734
16730
  if (!await pathExists(entitiesDir)) return [];
16735
- const files = await globby("*.{json,jsonc}", {
16731
+ const files = await globby(`*.${CONFIG_FILE_EXTENSION_GLOB}`, {
16736
16732
  cwd: entitiesDir,
16737
16733
  absolute: true
16738
16734
  });
@@ -16959,7 +16955,7 @@ async function createProject(projectName, description) {
16959
16955
  const response = await base44Client.post("api/apps", { json: {
16960
16956
  name: projectName,
16961
16957
  user_description: description ?? `Backend for '${projectName}'`,
16962
- app_type: "baas",
16958
+ is_managed_source_code: false,
16963
16959
  public_settings: "public_without_login"
16964
16960
  } });
16965
16961
  return { projectId: CreateProjectResponseSchema.parse(await response.json()).id };
@@ -26329,58 +26325,6 @@ async function printBanner() {
26329
26325
  else console.log(theme.colors.base44Orange(BANNER_LINES.join("\n")));
26330
26326
  }
26331
26327
 
26332
- //#endregion
26333
- //#region src/cli/utils/json.ts
26334
- /**
26335
- * JSON output utilities for CLI commands.
26336
- *
26337
- * These utilities support the `--json` flag which outputs machine-readable JSON
26338
- * instead of human-friendly formatted output.
26339
- */
26340
- let jsonModeEnabled = false;
26341
- /**
26342
- * Enable JSON output mode. Called by runCommand when --json flag is detected.
26343
- */
26344
- function setJsonMode(enabled) {
26345
- jsonModeEnabled = enabled;
26346
- }
26347
- /**
26348
- * Check if JSON output mode is currently active.
26349
- */
26350
- function isJsonMode() {
26351
- return jsonModeEnabled;
26352
- }
26353
- /**
26354
- * Output a success JSON response to stdout.
26355
- * Only outputs if JSON mode is enabled.
26356
- */
26357
- function outputJson(data) {
26358
- if (!jsonModeEnabled) return;
26359
- const response = {
26360
- success: true,
26361
- data
26362
- };
26363
- console.log(JSON.stringify(response, null, 2));
26364
- }
26365
- /**
26366
- * Output an error JSON response to stderr.
26367
- * Only outputs if JSON mode is enabled.
26368
- *
26369
- * @param error - The error to output
26370
- * @param code - Optional error code
26371
- */
26372
- function outputJsonError(error, code$1) {
26373
- if (!jsonModeEnabled) return;
26374
- const response = {
26375
- success: false,
26376
- error: {
26377
- message: error instanceof Error ? error.message : error,
26378
- ...code$1 && { code: code$1 }
26379
- }
26380
- };
26381
- console.error(JSON.stringify(response, null, 2));
26382
- }
26383
-
26384
26328
  //#endregion
26385
26329
  //#region src/cli/utils/runCommand.ts
26386
26330
  /**
@@ -26422,35 +26366,25 @@ function outputJsonError(error, code$1) {
26422
26366
  * });
26423
26367
  */
26424
26368
  async function runCommand(commandFn, options) {
26425
- const jsonMode = isJsonMode();
26426
- if (!jsonMode) {
26427
- console.log();
26428
- if (options?.fullBanner) {
26429
- await printBanner();
26430
- Ie("");
26431
- } else Ie(theme.colors.base44OrangeBackground(" Base 44 "));
26432
- }
26369
+ console.log();
26370
+ if (options?.fullBanner) {
26371
+ await printBanner();
26372
+ Ie("");
26373
+ } else Ie(theme.colors.base44OrangeBackground(" Base 44 "));
26433
26374
  await loadProjectEnv();
26434
26375
  try {
26435
26376
  if (options?.requireAuth) {
26436
26377
  if (!await isLoggedIn()) {
26437
- if (jsonMode) throw new Error("Authentication required. Please run 'base44 login' first.");
26438
26378
  M.info("You need to login first to continue.");
26439
26379
  await login();
26440
26380
  }
26441
26381
  }
26442
- const { outroMessage, data } = await commandFn();
26443
- if (jsonMode) outputJson(data ?? {});
26444
- else Se(outroMessage || "");
26382
+ const { outroMessage } = await commandFn();
26383
+ Se(outroMessage || "");
26445
26384
  } catch (e$1) {
26446
- if (jsonMode) {
26447
- outputJsonError(e$1 instanceof Error ? e$1 : String(e$1));
26448
- process.exit(1);
26449
- } else {
26450
- if (e$1 instanceof Error) M.error(e$1.stack ?? e$1.message);
26451
- else M.error(String(e$1));
26452
- process.exit(1);
26453
- }
26385
+ if (e$1 instanceof Error) M.error(e$1.stack ?? e$1.message);
26386
+ else M.error(String(e$1));
26387
+ process.exit(1);
26454
26388
  }
26455
26389
  }
26456
26390
 
@@ -26460,8 +26394,6 @@ async function runCommand(commandFn, options) {
26460
26394
  * Wraps an async operation with automatic spinner management.
26461
26395
  * The spinner is automatically started, and stopped on both success and error.
26462
26396
  *
26463
- * In JSON mode, the spinner is suppressed and the operation runs silently.
26464
- *
26465
26397
  * @param startMessage - Message to show when spinner starts
26466
26398
  * @param operation - The async operation to execute. Receives an updateMessage function
26467
26399
  * to update the spinner text during long-running operations.
@@ -26497,10 +26429,6 @@ async function runCommand(commandFn, options) {
26497
26429
  * );
26498
26430
  */
26499
26431
  async function runTask(startMessage, operation, options) {
26500
- if (isJsonMode()) {
26501
- const noopUpdateMessage = () => {};
26502
- return await operation(noopUpdateMessage);
26503
- }
26504
26432
  const s = Y();
26505
26433
  s.start(startMessage);
26506
26434
  const updateMessage = (message) => s.message(message);
@@ -26527,10 +26455,6 @@ const onPromptCancel = () => {
26527
26455
 
26528
26456
  //#endregion
26529
26457
  //#region src/cli/commands/auth/login.ts
26530
- /**
26531
- * Login command does not support --json output.
26532
- * It requires interactive browser authentication via device code flow.
26533
- */
26534
26458
  async function generateAndDisplayDeviceCode() {
26535
26459
  const deviceCodeResponse = await runTask("Generating device code...", async () => {
26536
26460
  return await generateDeviceCode();
@@ -26592,13 +26516,7 @@ const loginCommand = new Command("login").description("Authenticate with Base44"
26592
26516
  //#region src/cli/commands/auth/whoami.ts
26593
26517
  async function whoami() {
26594
26518
  const auth = await readAuth();
26595
- return {
26596
- outroMessage: `Logged in as: ${theme.styles.bold(auth.email)}`,
26597
- data: {
26598
- email: auth.email,
26599
- name: auth.name
26600
- }
26601
- };
26519
+ return { outroMessage: `Logged in as: ${theme.styles.bold(auth.email)}` };
26602
26520
  }
26603
26521
  const whoamiCommand = new Command("whoami").description("Display current authenticated user").action(async () => {
26604
26522
  await runCommand(whoami, { requireAuth: true });
@@ -26606,10 +26524,6 @@ const whoamiCommand = new Command("whoami").description("Display current authent
26606
26524
 
26607
26525
  //#endregion
26608
26526
  //#region src/cli/commands/auth/logout.ts
26609
- /**
26610
- * Logout command does not support --json output.
26611
- * It is a user-facing auth command that is rarely scripted.
26612
- */
26613
26527
  async function logout() {
26614
26528
  await deleteAuth();
26615
26529
  return { outroMessage: "Logged out successfully" };
@@ -31605,31 +31519,18 @@ async function createArchive(pathToArchive, targetArchivePath) {
31605
31519
  //#region src/cli/commands/entities/push.ts
31606
31520
  async function pushEntitiesAction() {
31607
31521
  const { entities } = await readProjectConfig();
31608
- if (entities.length === 0) return {
31609
- outroMessage: "No entities found in project",
31610
- data: {
31611
- created: [],
31612
- updated: [],
31613
- deleted: []
31614
- }
31615
- };
31616
- if (!isJsonMode()) M.info(`Found ${entities.length} entities to push`);
31522
+ if (entities.length === 0) return { outroMessage: "No entities found in project" };
31523
+ M.info(`Found ${entities.length} entities to push`);
31617
31524
  const result = await runTask("Pushing entities to Base44", async () => {
31618
31525
  return await pushEntities(entities);
31619
31526
  }, {
31620
31527
  successMessage: "Entities pushed successfully",
31621
31528
  errorMessage: "Failed to push entities"
31622
31529
  });
31623
- if (!isJsonMode()) {
31624
- if (result.created.length > 0) M.success(`Created: ${result.created.join(", ")}`);
31625
- if (result.updated.length > 0) M.success(`Updated: ${result.updated.join(", ")}`);
31626
- if (result.deleted.length > 0) M.warn(`Deleted: ${result.deleted.join(", ")}`);
31627
- }
31628
- return { data: {
31629
- created: result.created,
31630
- updated: result.updated,
31631
- deleted: result.deleted
31632
- } };
31530
+ if (result.created.length > 0) M.success(`Created: ${result.created.join(", ")}`);
31531
+ if (result.updated.length > 0) M.success(`Updated: ${result.updated.join(", ")}`);
31532
+ if (result.deleted.length > 0) M.warn(`Deleted: ${result.deleted.join(", ")}`);
31533
+ return {};
31633
31534
  }
31634
31535
  const entitiesPushCommand = new Command("entities").description("Manage project entities").addCommand(new Command("push").description("Push local entities to Base44").action(async () => {
31635
31536
  await runCommand(pushEntitiesAction, { requireAuth: true });
@@ -31639,32 +31540,21 @@ const entitiesPushCommand = new Command("entities").description("Manage project
31639
31540
  //#region src/cli/commands/functions/deploy.ts
31640
31541
  async function deployFunctionsAction() {
31641
31542
  const { functions } = await readProjectConfig();
31642
- if (functions.length === 0) return {
31643
- outroMessage: "No functions found. Create functions in the 'functions' directory.",
31644
- data: {
31645
- deployed: [],
31646
- deleted: []
31647
- }
31648
- };
31649
- if (!isJsonMode()) M.info(`Found ${functions.length} ${functions.length === 1 ? "function" : "functions"} to deploy`);
31543
+ if (functions.length === 0) return { outroMessage: "No functions found. Create functions in the 'functions' directory." };
31544
+ M.info(`Found ${functions.length} ${functions.length === 1 ? "function" : "functions"} to deploy`);
31650
31545
  const result = await runTask("Deploying functions to Base44", async () => {
31651
31546
  return await pushFunctions(functions);
31652
31547
  }, {
31653
31548
  successMessage: "Functions deployed successfully",
31654
31549
  errorMessage: "Failed to deploy functions"
31655
31550
  });
31656
- if (!isJsonMode()) {
31657
- if (result.deployed.length > 0) M.success(`Deployed: ${result.deployed.join(", ")}`);
31658
- if (result.deleted.length > 0) M.warn(`Deleted: ${result.deleted.join(", ")}`);
31659
- }
31551
+ if (result.deployed.length > 0) M.success(`Deployed: ${result.deployed.join(", ")}`);
31552
+ if (result.deleted.length > 0) M.warn(`Deleted: ${result.deleted.join(", ")}`);
31660
31553
  if (result.errors && result.errors.length > 0) {
31661
31554
  const errorMessages = result.errors.map((e$1) => `'${e$1.name}' function: ${e$1.message}`).join("\n");
31662
31555
  throw new Error(`Function deployment errors:\n${errorMessages}`);
31663
31556
  }
31664
- return { data: {
31665
- deployed: result.deployed,
31666
- deleted: result.deleted
31667
- } };
31557
+ return {};
31668
31558
  }
31669
31559
  const functionsDeployCommand = new Command("functions").description("Manage project functions").addCommand(new Command("deploy").description("Deploy local functions to Base44").action(async () => {
31670
31560
  await runCommand(deployFunctionsAction, { requireAuth: true });
@@ -38345,9 +38235,8 @@ async function getDefaultTemplate() {
38345
38235
  return template;
38346
38236
  }
38347
38237
  function validateNonInteractiveFlags$1(command) {
38348
- const { name: name$1, path: path$17, json } = command.optsWithGlobals();
38238
+ const { name: name$1, path: path$17 } = command.opts();
38349
38239
  const providedCount = [name$1, path$17].filter(Boolean).length;
38350
- if (json && providedCount < 2) command.error("JSON mode requires all flags: --name, --path");
38351
38240
  if (providedCount > 0 && providedCount < 2) command.error("Non-interactive mode requires all flags: --name, --path");
38352
38241
  }
38353
38242
  async function chooseCreate(options) {
@@ -38465,20 +38354,10 @@ async function executeCreate({ template, name: rawName, description, projectPath
38465
38354
  }
38466
38355
  }
38467
38356
  const dashboardUrl = `${getBase44ApiUrl()}/apps/${projectId}/editor/preview`;
38468
- if (!isJsonMode()) {
38469
- M.message(`${theme.styles.header("Project")}: ${theme.colors.base44Orange(name$1)}`);
38470
- M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(dashboardUrl)}`);
38471
- if (finalAppUrl) M.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
38472
- }
38473
- return {
38474
- outroMessage: "Your project is set up and ready to use",
38475
- data: {
38476
- projectId,
38477
- path: resolvedPath,
38478
- dashboardUrl,
38479
- ...finalAppUrl && { appUrl: finalAppUrl }
38480
- }
38481
- };
38357
+ M.message(`${theme.styles.header("Project")}: ${theme.colors.base44Orange(name$1)}`);
38358
+ M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(dashboardUrl)}`);
38359
+ if (finalAppUrl) M.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
38360
+ return { outroMessage: "Your project is set up and ready to use" };
38482
38361
  }
38483
38362
  const createCommand = new Command("create").description("Create a new Base44 project").option("-n, --name <name>", "Project name").option("-d, --description <description>", "Project description").option("-p, --path <path>", "Path where to create the project").option("--deploy", "Build and deploy the site").hook("preAction", validateNonInteractiveFlags$1).action(async (options) => {
38484
38363
  await chooseCreate(options);
@@ -39025,27 +38904,22 @@ var open_default = open;
39025
38904
 
39026
38905
  //#endregion
39027
38906
  //#region src/cli/commands/project/dashboard.ts
39028
- async function openDashboard(options) {
38907
+ async function openDashboard() {
39029
38908
  await loadProjectEnv();
39030
38909
  const projectId = getBase44ClientId();
39031
38910
  if (!projectId) throw new Error("App not configured. BASE44_CLIENT_ID environment variable is required. Set it in your .env.local file.");
39032
38911
  const dashboardUrl = `${getBase44ApiUrl()}/apps/${projectId}/editor/workspace/overview`;
39033
- const shouldOpen = !isJsonMode() && !options.noOpen;
39034
- if (shouldOpen) await open_default(dashboardUrl);
39035
- return {
39036
- outroMessage: shouldOpen ? `Dashboard opened at ${dashboardUrl}` : `Dashboard URL: ${dashboardUrl}`,
39037
- data: { dashboardUrl }
39038
- };
38912
+ await open_default(dashboardUrl);
38913
+ return { outroMessage: `Dashboard opened at ${dashboardUrl}` };
39039
38914
  }
39040
- const dashboardCommand = new Command("dashboard").description("Open the app dashboard in your browser").option("--no-open", "Print the URL without opening the browser").action(async (options) => {
39041
- await runCommand(() => openDashboard(options), { requireAuth: true });
38915
+ const dashboardCommand = new Command("dashboard").description("Open the app dashboard in your browser").action(async () => {
38916
+ await runCommand(openDashboard, { requireAuth: true });
39042
38917
  });
39043
38918
 
39044
38919
  //#endregion
39045
38920
  //#region src/cli/commands/project/link.ts
39046
38921
  function validateNonInteractiveFlags(command) {
39047
- const { create: create$1, name: name$1, json } = command.optsWithGlobals();
39048
- if (json && (!create$1 || !name$1)) command.error("JSON mode requires flags: --create, --name");
38922
+ const { create: create$1, name: name$1 } = command.opts();
39049
38923
  if (create$1 && !name$1) command.error("--name is required when using --create");
39050
38924
  }
39051
38925
  async function promptForProjectDetails() {
@@ -39094,14 +38968,8 @@ async function link(options) {
39094
38968
  });
39095
38969
  await writeEnvLocal(projectRoot.root, projectId);
39096
38970
  const dashboardUrl = `${getBase44ApiUrl()}/apps/${projectId}/editor/workspace/overview`;
39097
- if (!isJsonMode()) M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(dashboardUrl)}`);
39098
- return {
39099
- outroMessage: "Project linked",
39100
- data: {
39101
- projectId,
39102
- dashboardUrl
39103
- }
39104
- };
38971
+ M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(dashboardUrl)}`);
38972
+ return { outroMessage: "Project linked" };
39105
38973
  }
39106
38974
  const linkCommand = new Command("link").description("Link a local project to a Base44 project").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").hook("preAction", validateNonInteractiveFlags).action(async (options) => {
39107
38975
  await runCommand(() => link(options), { requireAuth: true });
@@ -39113,23 +38981,16 @@ async function deployAction(options) {
39113
38981
  const { project } = await readProjectConfig();
39114
38982
  if (!project.site?.outputDirectory) throw new Error("No site configuration found. Please add 'site.outputDirectory' to your config.jsonc");
39115
38983
  const outputDir = resolve(project.root, project.site.outputDirectory);
39116
- if (!options.yes && !isJsonMode()) {
38984
+ if (!options.yes) {
39117
38985
  const shouldDeploy = await ye({ message: `Deploy site from ${project.site.outputDirectory}?` });
39118
- if (pD(shouldDeploy) || !shouldDeploy) return {
39119
- outroMessage: "Deployment cancelled",
39120
- data: { cancelled: true }
39121
- };
38986
+ if (pD(shouldDeploy) || !shouldDeploy) return { outroMessage: "Deployment cancelled" };
39122
38987
  }
39123
- const result = await runTask("Creating archive and deploying site...", async () => {
38988
+ return { outroMessage: `Visit your site at: ${(await runTask("Creating archive and deploying site...", async () => {
39124
38989
  return await deploySite(outputDir);
39125
38990
  }, {
39126
38991
  successMessage: "Site deployed successfully",
39127
38992
  errorMessage: "Deployment failed"
39128
- });
39129
- return {
39130
- outroMessage: `Visit your site at: ${result.appUrl}`,
39131
- data: { appUrl: result.appUrl }
39132
- };
38993
+ })).appUrl}` };
39133
38994
  }
39134
38995
  const siteDeployCommand = new Command("site").description("Manage site deployments").addCommand(new Command("deploy").description("Deploy built site files to Base44 hosting").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
39135
38996
  await runCommand(() => deployAction(options), { requireAuth: true });
@@ -39137,15 +38998,12 @@ const siteDeployCommand = new Command("site").description("Manage site deploymen
39137
38998
 
39138
38999
  //#endregion
39139
39000
  //#region package.json
39140
- var version = "0.0.13";
39001
+ var version = "0.0.14";
39141
39002
 
39142
39003
  //#endregion
39143
39004
  //#region src/cli/index.ts
39144
39005
  const program = new Command();
39145
- program.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(version).option("--json", "Output results as JSON (for scripting)");
39146
- program.hook("preAction", (thisCommand) => {
39147
- if (thisCommand.optsWithGlobals().json) setJsonMode(true);
39148
- });
39006
+ program.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(version);
39149
39007
  program.configureHelp({ sortSubcommands: true });
39150
39008
  program.addCommand(loginCommand);
39151
39009
  program.addCommand(whoamiCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/cli",
3
- "version": "0.0.13-pr.87.2565e16",
3
+ "version": "0.0.14-pr.90.1ad236c",
4
4
  "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
5
  "type": "module",
6
6
  "main": "./dist/cli/index.js",