@base44-preview/cli 0.0.17-pr.112.f3c3148 → 0.0.17-pr.114.064abd5

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 +21 -216
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -7903,7 +7903,6 @@ var AuthValidationError = class extends Error {
7903
7903
  //#endregion
7904
7904
  //#region src/core/consts.ts
7905
7905
  const PROJECT_SUBDIR = "base44";
7906
- const CONFIG_FILE_EXTENSION = "json";
7907
7906
  const CONFIG_FILE_EXTENSION_GLOB = "{json,jsonc}";
7908
7907
  const FUNCTION_CONFIG_FILE = `function.${CONFIG_FILE_EXTENSION_GLOB}`;
7909
7908
  const APP_CONFIG_PATTERN = `${PROJECT_SUBDIR}/.app.${CONFIG_FILE_EXTENSION_GLOB}`;
@@ -16682,125 +16681,6 @@ const functionResource = {
16682
16681
  push: pushFunctions
16683
16682
  };
16684
16683
 
16685
- //#endregion
16686
- //#region src/core/resources/agent/schema.ts
16687
- const EntityToolConfigSchema = object({
16688
- entity_name: string().min(1),
16689
- allowed_operations: array(_enum([
16690
- "read",
16691
- "create",
16692
- "update",
16693
- "delete"
16694
- ])).default([])
16695
- });
16696
- const BackendFunctionToolConfigSchema = object({
16697
- function_name: string().min(1),
16698
- description: string().default("agent backend function")
16699
- });
16700
- const ToolConfigSchema = union([EntityToolConfigSchema, BackendFunctionToolConfigSchema]);
16701
- const AgentConfigSchema = object({
16702
- name: string().regex(/^[a-z0-9_]+$/, "Agent name must be lowercase alphanumeric with underscores").min(1).max(100),
16703
- description: string().min(1, "Agent description cannot be empty"),
16704
- instructions: string().min(1, "Agent instructions cannot be empty"),
16705
- tool_configs: array(ToolConfigSchema).default([]),
16706
- whatsapp_greeting: string().nullable().optional()
16707
- });
16708
- const SyncAgentsResponseSchema = object({
16709
- created: array(string()),
16710
- updated: array(string()),
16711
- deleted: array(string())
16712
- });
16713
- const AgentConfigApiResponseSchema = object({
16714
- name: string(),
16715
- description: string(),
16716
- instructions: string(),
16717
- tool_configs: array(ToolConfigSchema).default([]),
16718
- whatsapp_greeting: string().nullable().optional()
16719
- });
16720
- const ListAgentsResponseSchema = object({
16721
- items: array(AgentConfigApiResponseSchema),
16722
- total: number()
16723
- });
16724
-
16725
- //#endregion
16726
- //#region src/core/resources/agent/config.ts
16727
- async function readAgentFile(agentPath) {
16728
- const parsed = await readJsonFile(agentPath);
16729
- const result = AgentConfigSchema.safeParse(parsed);
16730
- if (!result.success) throw new Error(`Invalid agent configuration in ${agentPath}: ${result.error.issues.map((e$1) => e$1.message).join(", ")}`);
16731
- return result.data;
16732
- }
16733
- async function readAllAgents(agentsDir) {
16734
- if (!await pathExists(agentsDir)) return [];
16735
- const files = await globby(`*.${CONFIG_FILE_EXTENSION_GLOB}`, {
16736
- cwd: agentsDir,
16737
- absolute: true
16738
- });
16739
- const agents = await Promise.all(files.map((filePath) => readAgentFile(filePath)));
16740
- const names = /* @__PURE__ */ new Set();
16741
- for (const agent of agents) {
16742
- if (names.has(agent.name)) throw new Error(`Duplicate agent name "${agent.name}"`);
16743
- names.add(agent.name);
16744
- }
16745
- return agents;
16746
- }
16747
- async function writeAgents(agentsDir, agents) {
16748
- const existingAgents = await readAllAgents(agentsDir);
16749
- const newNames = new Set(agents.map((a$1) => a$1.name));
16750
- const toDelete = existingAgents.filter((a$1) => !newNames.has(a$1.name));
16751
- for (const agent of toDelete) await deleteFile(join(agentsDir, `${agent.name}.${CONFIG_FILE_EXTENSION}`));
16752
- for (const agent of agents) await writeJsonFile(join(agentsDir, `${agent.name}.${CONFIG_FILE_EXTENSION}`), {
16753
- name: agent.name,
16754
- description: agent.description,
16755
- instructions: agent.instructions,
16756
- tool_configs: agent.tool_configs,
16757
- whatsapp_greeting: agent.whatsapp_greeting ?? null
16758
- });
16759
- return {
16760
- written: agents.map((a$1) => a$1.name),
16761
- deleted: toDelete.map((a$1) => a$1.name)
16762
- };
16763
- }
16764
-
16765
- //#endregion
16766
- //#region src/core/resources/agent/api.ts
16767
- async function pushAgents(agents) {
16768
- const appClient = getAppClient();
16769
- const payload = { configs: agents.map((agent) => ({
16770
- name: agent.name,
16771
- description: agent.description,
16772
- instructions: agent.instructions,
16773
- tool_configs: agent.tool_configs,
16774
- whatsapp_greeting: agent.whatsapp_greeting ?? null
16775
- })) };
16776
- const response = await appClient.put("agent-configs", {
16777
- json: payload,
16778
- throwHttpErrors: false
16779
- });
16780
- if (!response.ok) {
16781
- const errorJson = await response.json();
16782
- const errorMessage = errorJson.detail || errorJson.message || "Unknown error";
16783
- throw new Error(`Error occurred while syncing agents: ${errorMessage}`);
16784
- }
16785
- return SyncAgentsResponseSchema.parse(await response.json());
16786
- }
16787
- async function fetchAgents() {
16788
- const response = await getAppClient().get("agent-configs", { throwHttpErrors: false });
16789
- if (!response.ok) {
16790
- const errorJson = await response.json();
16791
- const errorMessage = errorJson.detail || errorJson.message || "Unknown error";
16792
- throw new Error(`Error occurred while fetching agents: ${errorMessage}`);
16793
- }
16794
- return ListAgentsResponseSchema.parse(await response.json());
16795
- }
16796
-
16797
- //#endregion
16798
- //#region src/core/resources/agent/resource.ts
16799
- const agentResource = {
16800
- readAll: readAllAgents,
16801
- push: pushAgents
16802
- };
16803
-
16804
16684
  //#endregion
16805
16685
  //#region src/core/project/schema.ts
16806
16686
  const TemplateSchema = object({
@@ -16821,8 +16701,7 @@ const ProjectConfigSchema = object({
16821
16701
  description: string().optional(),
16822
16702
  site: SiteConfigSchema.optional(),
16823
16703
  entitiesDir: string().optional().default("entities"),
16824
- functionsDir: string().optional().default("functions"),
16825
- agentsDir: string().optional().default("agents")
16704
+ functionsDir: string().optional().default("functions")
16826
16705
  });
16827
16706
  const AppConfigSchema = object({ id: string().min(1, "id cannot be empty") });
16828
16707
  const CreateProjectResponseSchema = looseObject({ id: string() });
@@ -16894,11 +16773,7 @@ async function readProjectConfig(projectRoot) {
16894
16773
  if (!result.success) throw new Error(`Invalid project configuration: ${result.error.message}`);
16895
16774
  const project = result.data;
16896
16775
  const configDir = dirname(configPath);
16897
- const [entities, functions, agents] = await Promise.all([
16898
- entityResource.readAll(join(configDir, project.entitiesDir)),
16899
- functionResource.readAll(join(configDir, project.functionsDir)),
16900
- agentResource.readAll(join(configDir, project.agentsDir))
16901
- ]);
16776
+ const [entities, functions] = await Promise.all([entityResource.readAll(join(configDir, project.entitiesDir)), functionResource.readAll(join(configDir, project.functionsDir))]);
16902
16777
  return {
16903
16778
  project: {
16904
16779
  ...project,
@@ -16906,8 +16781,7 @@ async function readProjectConfig(projectRoot) {
16906
16781
  configPath
16907
16782
  },
16908
16783
  entities,
16909
- functions,
16910
- agents
16784
+ functions
16911
16785
  };
16912
16786
  }
16913
16787
 
@@ -31478,53 +31352,6 @@ const entitiesPushCommand = new Command("entities").description("Manage project
31478
31352
  await runCommand(pushEntitiesAction, { requireAuth: true });
31479
31353
  }));
31480
31354
 
31481
- //#endregion
31482
- //#region src/cli/commands/agents/pull.ts
31483
- async function pullAgentsAction() {
31484
- const { project } = await readProjectConfig();
31485
- const agentsDir = join(dirname(project.configPath), project.agentsDir);
31486
- const response = await runTask("Fetching agents from Base44", async () => {
31487
- return await fetchAgents();
31488
- }, {
31489
- successMessage: "Agents fetched successfully",
31490
- errorMessage: "Failed to fetch agents"
31491
- });
31492
- if (response.items.length === 0) return { outroMessage: "No agents found on Base44" };
31493
- const { written, deleted } = await runTask("Writing agent files", async () => {
31494
- return await writeAgents(agentsDir, response.items);
31495
- }, {
31496
- successMessage: "Agent files written successfully",
31497
- errorMessage: "Failed to write agent files"
31498
- });
31499
- if (written.length > 0) M.success(`Written: ${written.join(", ")}`);
31500
- if (deleted.length > 0) M.warn(`Deleted: ${deleted.join(", ")}`);
31501
- return { outroMessage: `Pulled ${response.total} agents to ${agentsDir}` };
31502
- }
31503
- const agentsPullCommand = new Command("pull").description("Pull agents from Base44 to local files").action(async () => {
31504
- await runCommand(pullAgentsAction, { requireAuth: true });
31505
- });
31506
-
31507
- //#endregion
31508
- //#region src/cli/commands/agents/push.ts
31509
- async function pushAgentsAction() {
31510
- const { agents } = await readProjectConfig();
31511
- if (agents.length === 0) return { outroMessage: "No agents found in project" };
31512
- M.info(`Found ${agents.length} agents to push`);
31513
- const result = await runTask("Pushing agents to Base44", async () => {
31514
- return await pushAgents(agents);
31515
- }, {
31516
- successMessage: "Agents pushed successfully",
31517
- errorMessage: "Failed to push agents"
31518
- });
31519
- if (result.created.length > 0) M.success(`Created: ${result.created.join(", ")}`);
31520
- if (result.updated.length > 0) M.success(`Updated: ${result.updated.join(", ")}`);
31521
- if (result.deleted.length > 0) M.warn(`Deleted: ${result.deleted.join(", ")}`);
31522
- return {};
31523
- }
31524
- const agentsCommand = new Command("agents").description("Manage project agents").addCommand(new Command("push").description("Push local agents to Base44").action(async () => {
31525
- await runCommand(pushAgentsAction, { requireAuth: true });
31526
- })).addCommand(agentsPullCommand);
31527
-
31528
31355
  //#endregion
31529
31356
  //#region src/cli/commands/functions/deploy.ts
31530
31357
  async function deployFunctionsAction() {
@@ -38218,13 +38045,6 @@ var require_lodash = /* @__PURE__ */ __commonJSMin(((exports, module) => {
38218
38045
  //#region src/cli/commands/project/create.ts
38219
38046
  var import_lodash = /* @__PURE__ */ __toESM(require_lodash(), 1);
38220
38047
  const DEFAULT_TEMPLATE_ID = "backend-only";
38221
- const SUPPORTED_AGENTS = [{
38222
- value: "cursor",
38223
- label: "Cursor"
38224
- }, {
38225
- value: "claude-code",
38226
- label: "Claude Code"
38227
- }];
38228
38048
  async function getTemplateById(templateId) {
38229
38049
  const templates = await listTemplates();
38230
38050
  const template = templates.find((t) => t.id === templateId);
@@ -38362,45 +38182,31 @@ async function executeCreate({ template, name: rawName, description, projectPath
38362
38182
  finalAppUrl = appUrl;
38363
38183
  }
38364
38184
  }
38365
- let selectedAgents = [];
38185
+ let shouldAddSkills = false;
38366
38186
  if (isInteractive) {
38367
- const result = await fe({
38368
- message: "Add AI agent skills? (Select agents to configure)",
38369
- options: SUPPORTED_AGENTS,
38370
- initialValues: SUPPORTED_AGENTS.map((agent) => agent.value),
38371
- required: false
38372
- });
38373
- if (!pD(result)) selectedAgents = result;
38374
- } else if (skills) selectedAgents = SUPPORTED_AGENTS.map((agent) => agent.value);
38375
- if (selectedAgents.length > 0) {
38376
- const agentArgs = selectedAgents.flatMap((agent) => ["-a", agent]);
38377
- M.step(`Installing skills for: ${selectedAgents.join(", ")}`);
38378
- await runTask(`Installing skills for: ${selectedAgents.join(", ")}`, async () => {
38379
- await execa("npx", [
38380
- "-y",
38381
- "add-skill",
38382
- "base44/skills",
38383
- "-y",
38384
- "-s",
38385
- "base44-cli",
38386
- "-s",
38387
- "base44-sdk",
38388
- ...agentArgs
38389
- ], {
38390
- cwd: resolvedPath,
38391
- stdio: "inherit"
38392
- });
38393
- }, {
38394
- successMessage: theme.colors.base44Orange("AI agent skills added successfully"),
38395
- errorMessage: "Failed to add AI agent skills - you can add them later with: npx add-skill base44/skills"
38187
+ const result = await ye({ message: "Add AI agent skills?" });
38188
+ shouldAddSkills = !pD(result) && result;
38189
+ } else shouldAddSkills = !!skills;
38190
+ if (shouldAddSkills) await runTask("Installing AI agent skills...", async () => {
38191
+ await execa("npx", [
38192
+ "-y",
38193
+ "add-skill",
38194
+ "base44/skills",
38195
+ "-y"
38196
+ ], {
38197
+ cwd: resolvedPath,
38198
+ stdio: "inherit"
38396
38199
  });
38397
- }
38200
+ }, {
38201
+ successMessage: theme.colors.base44Orange("AI agent skills added successfully"),
38202
+ errorMessage: "Failed to add AI agent skills - you can add them later with: npx add-skill base44/skills"
38203
+ });
38398
38204
  M.message(`${theme.styles.header("Project")}: ${theme.colors.base44Orange(name$1)}`);
38399
38205
  M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
38400
38206
  if (finalAppUrl) M.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
38401
38207
  return { outroMessage: "Your project is set up and ready to use" };
38402
38208
  }
38403
- 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("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").option("--skills", "Add AI agent skills (Cursor, Claude Code)").hook("preAction", validateNonInteractiveFlags$1).action(async (options) => {
38209
+ 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("-t, --template <id>", "Template ID (e.g., backend-only, backend-and-client)").option("--deploy", "Build and deploy the site").option("--skills", "Add AI agent skills").hook("preAction", validateNonInteractiveFlags$1).action(async (options) => {
38404
38210
  await chooseCreate(options);
38405
38211
  });
38406
38212
 
@@ -39141,7 +38947,6 @@ program.addCommand(dashboardCommand);
39141
38947
  program.addCommand(deployCommand);
39142
38948
  program.addCommand(linkCommand);
39143
38949
  program.addCommand(entitiesPushCommand);
39144
- program.addCommand(agentsCommand);
39145
38950
  program.addCommand(functionsDeployCommand);
39146
38951
  program.addCommand(siteDeployCommand);
39147
38952
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/cli",
3
- "version": "0.0.17-pr.112.f3c3148",
3
+ "version": "0.0.17-pr.114.064abd5",
4
4
  "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
5
  "type": "module",
6
6
  "bin": {