@base44-preview/cli 0.0.24-pr.147.be1c0f9 → 0.0.25-pr.149.6f9dd41

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/index.js +56 -20
  2. package/package.json +8 -2
package/dist/index.js CHANGED
@@ -16730,7 +16730,10 @@ const FunctionConfigSchema = object({
16730
16730
  entry: string().min(1, "Entry point cannot be empty"),
16731
16731
  triggers: tuple([]).optional()
16732
16732
  });
16733
- const FunctionSchema = FunctionConfigSchema.extend({ codePath: string().min(1, "Code path cannot be empty") });
16733
+ const FunctionSchema = FunctionConfigSchema.extend({
16734
+ entryPath: string().min(1, "Entry path cannot be empty"),
16735
+ files: array(string()).min(1, "Files array cannot be empty")
16736
+ });
16734
16737
  const DeployFunctionsResponseSchema = object({
16735
16738
  deployed: array(string()),
16736
16739
  deleted: array(string()),
@@ -16750,11 +16753,17 @@ async function readFunctionConfig(configPath) {
16750
16753
  }
16751
16754
  async function readFunction(configPath) {
16752
16755
  const config$1 = await readFunctionConfig(configPath);
16753
- const codePath = join(dirname(configPath), config$1.entry);
16754
- if (!await pathExists(codePath)) throw new Error(`Function code file not found: ${codePath} (referenced in ${configPath})`);
16756
+ const functionDir = dirname(configPath);
16757
+ const entryPath = join(functionDir, config$1.entry);
16758
+ if (!await pathExists(entryPath)) throw new Error(`Function entry file not found: ${entryPath} (referenced in ${configPath})`);
16759
+ const files = await globby("*.{js,ts,json}", {
16760
+ cwd: functionDir,
16761
+ absolute: true
16762
+ });
16755
16763
  const functionData = {
16756
16764
  ...config$1,
16757
- codePath
16765
+ entryPath,
16766
+ files
16758
16767
  };
16759
16768
  const result = FunctionSchema.safeParse(functionData);
16760
16769
  if (!result.success) throw new Error(`Invalid function in ${configPath}: ${result.error.message}`);
@@ -16781,10 +16790,7 @@ function toDeployPayloadItem(fn) {
16781
16790
  return {
16782
16791
  name: fn.name,
16783
16792
  entry: fn.entry,
16784
- files: [{
16785
- path: fn.entry,
16786
- content: fn.code
16787
- }]
16793
+ files: fn.files
16788
16794
  };
16789
16795
  }
16790
16796
  async function deployFunctions(functions) {
@@ -16800,10 +16806,16 @@ async function deployFunctions(functions) {
16800
16806
  //#endregion
16801
16807
  //#region src/core/resources/function/deploy.ts
16802
16808
  async function loadFunctionCode(fn) {
16803
- const code$1 = await readTextFile(fn.codePath);
16809
+ const loadedFiles = await Promise.all(fn.files.map(async (filePath) => {
16810
+ const content = await readTextFile(filePath);
16811
+ return {
16812
+ path: basename(filePath),
16813
+ content
16814
+ };
16815
+ }));
16804
16816
  return {
16805
16817
  ...fn,
16806
- code: code$1
16818
+ files: loadedFiles
16807
16819
  };
16808
16820
  }
16809
16821
  async function pushFunctions(functions) {
@@ -30600,25 +30612,27 @@ async function createArchive(pathToArchive, targetArchivePath) {
30600
30612
  * Checks if there are any resources to deploy in the project.
30601
30613
  *
30602
30614
  * @param projectData - The project configuration and resources
30603
- * @returns true if there are entities, functions, or a configured site to deploy
30615
+ * @returns true if there are entities, functions, agents, or a configured site to deploy
30604
30616
  */
30605
30617
  function hasResourcesToDeploy(projectData) {
30606
- const { project, entities, functions } = projectData;
30618
+ const { project, entities, functions, agents } = projectData;
30607
30619
  const hasSite = Boolean(project.site?.outputDirectory);
30608
30620
  const hasEntities = entities.length > 0;
30609
30621
  const hasFunctions = functions.length > 0;
30610
- return hasEntities || hasFunctions || hasSite;
30622
+ const hasAgents = agents.length > 0;
30623
+ return hasEntities || hasFunctions || hasAgents || hasSite;
30611
30624
  }
30612
30625
  /**
30613
- * Deploys all project resources (entities, functions, and site) to Base44.
30626
+ * Deploys all project resources (entities, functions, agents, and site) to Base44.
30614
30627
  *
30615
30628
  * @param projectData - The project configuration and resources to deploy
30616
30629
  * @returns The deployment result including app URL if site was deployed
30617
30630
  */
30618
30631
  async function deployAll(projectData) {
30619
- const { project, entities, functions } = projectData;
30632
+ const { project, entities, functions, agents } = projectData;
30620
30633
  await entityResource.push(entities);
30621
30634
  await functionResource.push(functions);
30635
+ await agentResource.push(agents);
30622
30636
  if (project.site?.outputDirectory) {
30623
30637
  const { appUrl } = await deploySite(resolve(project.root, project.site.outputDirectory));
30624
30638
  return { appUrl };
@@ -30630,11 +30644,31 @@ async function deployAll(projectData) {
30630
30644
  //#region src/core/project/app-config.ts
30631
30645
  let cache = null;
30632
30646
  /**
30647
+ * Load app config from BASE44_CLI_TEST_OVERRIDES env var.
30648
+ * @returns true if override was applied, false otherwise
30649
+ */
30650
+ function loadFromTestOverrides() {
30651
+ const overrides = process.env.BASE44_CLI_TEST_OVERRIDES;
30652
+ if (!overrides) return false;
30653
+ try {
30654
+ const data = JSON.parse(overrides);
30655
+ if (data.appConfig?.id && data.appConfig?.projectRoot) {
30656
+ cache = {
30657
+ id: data.appConfig.id,
30658
+ projectRoot: data.appConfig.projectRoot
30659
+ };
30660
+ return true;
30661
+ }
30662
+ } catch {}
30663
+ return false;
30664
+ }
30665
+ /**
30633
30666
  * Initialize app config by reading from .app.jsonc.
30634
30667
  * Must be called before using getAppConfig().
30635
30668
  * @throws Error if no project found or .app.jsonc missing
30636
30669
  */
30637
30670
  async function initAppConfig() {
30671
+ if (loadFromTestOverrides()) return;
30638
30672
  if (cache) return;
30639
30673
  const projectRoot = await findProjectRoot();
30640
30674
  if (!projectRoot) throw new Error("No Base44 project found. Run this command from a project directory with a config.jsonc file.");
@@ -31583,7 +31617,8 @@ const logoutCommand = new Command("logout").description("Logout from current dev
31583
31617
  async function pushEntitiesAction() {
31584
31618
  const { entities } = await readProjectConfig();
31585
31619
  if (entities.length === 0) return { outroMessage: "No entities found in project" };
31586
- M.info(`Found ${entities.length} entities to push`);
31620
+ const entityNames = entities.map((e$1) => e$1.name).join(", ");
31621
+ M.info(`Found ${entities.length} entities to push: ${entityNames}`);
31587
31622
  const result = await runTask("Pushing entities to Base44", async () => {
31588
31623
  return await pushEntities(entities);
31589
31624
  }, {
@@ -39046,7 +39081,7 @@ var open_default = open;
39046
39081
  //#region src/cli/commands/project/dashboard.ts
39047
39082
  async function openDashboard() {
39048
39083
  const dashboardUrl = getDashboardUrl();
39049
- await open_default(dashboardUrl);
39084
+ if (!process.env.CI) await open_default(dashboardUrl);
39050
39085
  return { outroMessage: `Dashboard opened at ${dashboardUrl}` };
39051
39086
  }
39052
39087
  const dashboardCommand = new Command("dashboard").description("Open the app dashboard in your browser").action(async () => {
@@ -39058,10 +39093,11 @@ const dashboardCommand = new Command("dashboard").description("Open the app dash
39058
39093
  async function deployAction$1(options) {
39059
39094
  const projectData = await readProjectConfig();
39060
39095
  if (!hasResourcesToDeploy(projectData)) return { outroMessage: "No resources found to deploy" };
39061
- const { project, entities, functions } = projectData;
39096
+ const { project, entities, functions, agents } = projectData;
39062
39097
  const summaryLines = [];
39063
39098
  if (entities.length > 0) summaryLines.push(` - ${entities.length} ${entities.length === 1 ? "entity" : "entities"}`);
39064
39099
  if (functions.length > 0) summaryLines.push(` - ${functions.length} ${functions.length === 1 ? "function" : "functions"}`);
39100
+ if (agents.length > 0) summaryLines.push(` - ${agents.length} ${agents.length === 1 ? "agent" : "agents"}`);
39065
39101
  if (project.site?.outputDirectory) summaryLines.push(` - Site from ${project.site.outputDirectory}`);
39066
39102
  if (!options.yes) {
39067
39103
  M.warn(`This will update your Base44 app with:\n${summaryLines.join("\n")}`);
@@ -39078,7 +39114,7 @@ async function deployAction$1(options) {
39078
39114
  if (result.appUrl) M.message(`${theme.styles.header("App URL")}: ${theme.colors.links(result.appUrl)}`);
39079
39115
  return { outroMessage: "App deployed successfully" };
39080
39116
  }
39081
- const deployCommand = new Command("deploy").description("Deploy all project resources (entities, functions, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
39117
+ const deployCommand = new Command("deploy").description("Deploy all project resources (entities, functions, agents, and site)").option("-y, --yes", "Skip confirmation prompt").action(async (options) => {
39082
39118
  await runCommand(() => deployAction$1(options), { requireAuth: true });
39083
39119
  });
39084
39120
 
@@ -39225,7 +39261,7 @@ const siteDeployCommand = new Command("site").description("Manage site deploymen
39225
39261
 
39226
39262
  //#endregion
39227
39263
  //#region package.json
39228
- var version = "0.0.24";
39264
+ var version = "0.0.25";
39229
39265
 
39230
39266
  //#endregion
39231
39267
  //#region src/cli/program.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/cli",
3
- "version": "0.0.24-pr.147.be1c0f9",
3
+ "version": "0.0.25-pr.149.6f9dd41",
4
4
  "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
5
  "type": "module",
6
6
  "bin": {
@@ -16,7 +16,7 @@
16
16
  "dev": "./bin/dev.js",
17
17
  "start": "./bin/run.js",
18
18
  "clean": "rm -rf dist",
19
- "lint": "eslint src",
19
+ "lint": "eslint src tests",
20
20
  "test": "vitest run",
21
21
  "test:watch": "vitest"
22
22
  },
@@ -52,9 +52,12 @@
52
52
  "json5": "^2.2.3",
53
53
  "ky": "^1.14.2",
54
54
  "lodash.kebabcase": "^4.1.1",
55
+ "msw": "^2.12.7",
55
56
  "open": "^11.0.0",
56
57
  "p-wait-for": "^6.0.0",
58
+ "strip-ansi": "^7.1.2",
57
59
  "tar": "^7.5.4",
60
+ "tmp-promise": "^3.0.3",
58
61
  "tsdown": "^0.12.4",
59
62
  "tsx": "^4.19.2",
60
63
  "typescript": "^5.7.2",
@@ -64,5 +67,8 @@
64
67
  },
65
68
  "engines": {
66
69
  "node": ">=20.19.0"
70
+ },
71
+ "optionalDependencies": {
72
+ "@rollup/rollup-linux-x64-gnu": "^4.56.0"
67
73
  }
68
74
  }