@base44-preview/cli 0.0.17-pr.19.1b258d9 → 0.0.17-pr.19.537d5c2

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/README.md CHANGED
@@ -1,109 +1,193 @@
1
1
  # Base44 CLI
2
2
 
3
- Command-line interface for building applications with [Base44's backend service](https://docs.base44.com/developers/backend/overview/introduction).
3
+ A unified command-line interface for managing Base44 applications, entities, functions, deployments, and related services.
4
4
 
5
- Base44's backend service provides a managed backend for your applications, including data storage with entities, serverless functions, authentication, and hosting. The CLI lets you:
6
-
7
- - **Create projects** from templates.
8
- - **Sync** resources defined in local code with your Base44 backend.
9
- - **Deploy sites** to Base44's hosting platform.
10
-
11
- To get started, see the full list of commands below or check out the [documentation](https://docs.base44.com/developers/references/cli/get-started/overview).
5
+ **Zero dependencies** - installs in seconds with no dependency resolution.
12
6
 
13
7
  ## Installation
14
8
 
15
9
  ```bash
10
+ # Using npm (globally)
16
11
  npm install -g base44
17
- ```
18
12
 
19
- Or run commands directly with npx:
20
-
21
- ```bash
13
+ # Or run directly with npx
22
14
  npx base44 <command>
23
15
  ```
24
16
 
25
- Requires Node.js 20.19.0 or higher.
26
-
27
- ## Quick start
17
+ ## Quick Start
28
18
 
29
19
  ```bash
30
- # Authenticate
20
+ # 1. Login to Base44
31
21
  base44 login
32
22
 
33
- # Create a project
23
+ # 2. Create a new project
34
24
  base44 create
25
+
26
+ # 3. Deploy everything (entities, functions, and site)
27
+ npm run build
28
+ base44 deploy
35
29
  ```
36
30
 
37
- The CLI will guide you through project setup. For step-by-step tutorials, see the quickstart guides:
31
+ ## Commands
38
32
 
39
- - [Backend only](https://docs.base44.com/developers/backend/quickstart/quickstart-backend-only) — for headless apps or custom frontends
40
- - [React](https://docs.base44.com/developers/backend/quickstart/quickstart-with-react) — full-stack with Vite + React
33
+ ### Authentication
41
34
 
42
- ## Commands
35
+ | Command | Description |
36
+ |---------|-------------|
37
+ | `base44 login` | Authenticate with Base44 using device code flow |
38
+ | `base44 whoami` | Display current authenticated user |
39
+ | `base44 logout` | Logout from current device |
40
+
41
+ ### Project Management
43
42
 
44
43
  | Command | Description |
45
- | ------- | ----------- |
46
- | [`create`](https://docs.base44.com/developers/references/cli/commands/create) | Create a new Base44 project from a template |
47
- | [`deploy`](https://docs.base44.com/developers/references/cli/commands/deploy) | Deploy resources and site to Base44 |
48
- | [`link`](https://docs.base44.com/developers/references/cli/commands/link) | Link a local project to a project on Base44 |
49
- | [`dashboard`](https://docs.base44.com/developers/references/cli/commands/dashboard) | Open the app dashboard in your browser |
50
- | [`login`](https://docs.base44.com/developers/references/cli/commands/login) | Authenticate with Base44 |
51
- | [`logout`](https://docs.base44.com/developers/references/cli/commands/logout) | Sign out and clear stored credentials |
52
- | [`whoami`](https://docs.base44.com/developers/references/cli/commands/whoami) | Display the current authenticated user |
53
- | [`entities push`](https://docs.base44.com/developers/references/cli/commands/entities-push) | Push local entity schemas to Base44 |
54
- | [`functions deploy`](https://docs.base44.com/developers/references/cli/commands/functions-deploy) | Deploy local functions to Base44 |
55
- | [`site deploy`](https://docs.base44.com/developers/references/cli/commands/site-deploy) | Deploy built site files to Base44 hosting |
44
+ |---------|-------------|
45
+ | `base44 create` | Create a new Base44 project from a template |
46
+ | `base44 link` | Link a local project to Base44 (create new or link existing) |
47
+ | `base44 dashboard` | Open the app dashboard in your browser |
56
48
 
49
+ #### Link Command Options
57
50
 
58
- <!--| [`eject`](https://docs.base44.com/developers/references/cli/commands/eject) | Create a Base44 backend project from an existing Base44 app | -->
51
+ The `link` command supports both creating new projects and linking to existing ones:
59
52
 
60
- ## AI Agent Skills
53
+ ```bash
54
+ # Interactive mode - choose to create new or link existing
55
+ base44 link
61
56
 
62
- When creating a project, you'll be prompted to install AI agent skills for your preferred coding assistants:
57
+ # Create a new project (non-interactive)
58
+ base44 link --create --name "my-app" --description "My app description"
63
59
 
64
- ```
65
- ◆ Add AI agent skills? (Select agents to configure)
66
- │ ◼ Cursor
67
- │ ◼ Claude Code
68
-
60
+ # Link to an existing project by ID (non-interactive)
61
+ base44 link --projectId <app-id>
69
62
  ```
70
63
 
71
- This installs [base44/skills](https://github.com/base44/skills) which helps AI agents understand how to work with Base44 projects.
64
+ | Option | Description |
65
+ |--------|-------------|
66
+ | `-c, --create` | Create a new project (skip selection prompt) |
67
+ | `-n, --name <name>` | Project name (required with --create) |
68
+ | `-d, --description <desc>` | Project description (optional) |
69
+ | `-p, --projectId <id>` | Link to an existing project by ID (skips selection prompt) |
72
70
 
73
- **Non-interactive mode:**
71
+ ### Deployment
74
72
 
75
- ```bash
76
- # Install skills for all supported agents
77
- base44 create --name my-app --path ./my-app --skills
73
+ | Command | Description |
74
+ |---------|-------------|
75
+ | `base44 deploy` | Deploy all resources (entities, functions, and site) |
76
+
77
+ ### Entities
78
+
79
+ | Command | Description |
80
+ |---------|-------------|
81
+ | `base44 entities push` | Push local entity schemas to Base44 |
82
+
83
+ ### Functions
84
+
85
+ | Command | Description |
86
+ |---------|-------------|
87
+ | `base44 functions deploy` | Deploy local functions to Base44 |
88
+
89
+ ### Site
78
90
 
79
- # Skip skills installation
80
- base44 create --name my-app --path ./my-app
91
+ | Command | Description |
92
+ |---------|-------------|
93
+ | `base44 site deploy` | Deploy built site files to Base44 hosting |
94
+
95
+ ## Configuration
96
+
97
+ ### Project Configuration
98
+
99
+ Base44 projects are configured via a `config.jsonc` (or `config.json`) file in the `base44/` subdirectory:
100
+
101
+ ```jsonc
102
+ // base44/config.jsonc
103
+ {
104
+ "name": "My Project",
105
+ "entitiesDir": "./entities", // Default: ./entities
106
+ "functionsDir": "./functions", // Default: ./functions
107
+ "site": {
108
+ "outputDirectory": "../dist" // Path to built site files
109
+ }
110
+ }
81
111
  ```
82
112
 
83
- **Manual installation:**
113
+ ### App Configuration
84
114
 
85
- ```bash
86
- npx add-skill base44/skills
115
+ Your app ID is stored in a `.app.jsonc` file in the `base44/` directory. This file is created automatically when you run `base44 create` or `base44 link`:
116
+
117
+ ```jsonc
118
+ // base44/.app.jsonc
119
+ {
120
+ "id": "your-app-id"
121
+ }
87
122
  ```
88
123
 
89
- ## Help
124
+ ## Project Structure
125
+
126
+ A typical Base44 project has this structure:
127
+
128
+ ```
129
+ my-project/
130
+ ├── base44/
131
+ │ ├── config.jsonc # Project configuration
132
+ │ ├── .app.jsonc # App ID (git-ignored)
133
+ │ ├── entities/ # Entity schema files
134
+ │ │ ├── user.jsonc
135
+ │ │ └── product.jsonc
136
+ │ └── functions/ # Backend functions
137
+ │ └── my-function/
138
+ │ ├── config.jsonc
139
+ │ └── index.js
140
+ ├── src/ # Your frontend code
141
+ ├── dist/ # Built site files (for deployment)
142
+ └── package.json
143
+ ```
144
+
145
+ ## Development
146
+
147
+ ### Prerequisites
148
+
149
+ - Node.js >= 20.19.0
150
+ - npm
151
+
152
+ ### Setup
90
153
 
91
154
  ```bash
92
- base44 --help
93
- base44 <command> --help
155
+ # Clone the repository
156
+ git clone https://github.com/base44/cli.git
157
+ cd cli
158
+
159
+ # Install dependencies
160
+ npm install
161
+
162
+ # Build
163
+ npm run build
164
+
165
+ # Run in development mode
166
+ npm run dev -- <command>
94
167
  ```
95
168
 
96
- ## Version
169
+ ### Available Scripts
97
170
 
98
171
  ```bash
99
- base44 --version
172
+ npm run build # Build with tsdown
173
+ npm run typecheck # Type check with tsc
174
+ npm run dev # Run in development mode with tsx
175
+ npm run lint # Lint with ESLint
176
+ npm test # Run tests with Vitest
100
177
  ```
101
178
 
102
- ## Alpha
179
+ ### Running the Built CLI
103
180
 
104
- The CLI and Base44 backend service are currently in alpha. We're actively improving them based on user feedback. Share your thoughts and feature requests on our [GitHub Discussions](https://github.com/orgs/base44/discussions).
181
+ ```bash
182
+ # After building
183
+ npm start -- <command>
184
+
185
+ # Or directly
186
+ ./dist/cli/index.js <command>
187
+ ```
188
+ ## Contributing
105
189
 
106
- Found a bug? [Open an issue](https://github.com/base44/cli/issues).
190
+ See [AGENTS.md](./AGENTS.md) for development guidelines and architecture documentation.
107
191
 
108
192
  ## License
109
193
 
package/bin/dev.js CHANGED
@@ -1,12 +1,20 @@
1
1
  #!/usr/bin/env tsx
2
- import { program, CLIExitError } from "../src/cli/index.ts";
2
+ import { program, CLIExitError } from '../src/cli/program.ts';
3
3
 
4
4
  try {
5
5
  await program.parseAsync();
6
- } catch (error) {
7
- if (error instanceof CLIExitError) {
8
- process.exit(error.code);
6
+ } catch (e) {
7
+ if (e instanceof CLIExitError) {
8
+ process.exit(e.code); // Clean exit, no stack trace
9
9
  }
10
- console.error(error);
10
+ // Commander throws for --help and --version with exitCode 0
11
+ if (e?.code === 'commander.helpDisplayed' || e?.code === 'commander.version') {
12
+ process.exit(0);
13
+ }
14
+ // For other Commander errors, exit with the provided code
15
+ if (e?.exitCode !== undefined) {
16
+ process.exit(e.exitCode);
17
+ }
18
+ console.error(e);
11
19
  process.exit(1);
12
20
  }
package/bin/run.js CHANGED
@@ -1,12 +1,20 @@
1
1
  #!/usr/bin/env node
2
- import { program, CLIExitError } from "../dist/index.js";
2
+ import { program, CLIExitError } from '../dist/program.js';
3
3
 
4
4
  try {
5
5
  await program.parseAsync();
6
- } catch (error) {
7
- if (error instanceof CLIExitError) {
8
- process.exit(error.code);
6
+ } catch (e) {
7
+ if (e instanceof CLIExitError) {
8
+ process.exit(e.code); // Clean exit, no stack trace
9
9
  }
10
- console.error(error);
10
+ // Commander throws for --help and --version with exitCode 0
11
+ if (e?.code === 'commander.helpDisplayed' || e?.code === 'commander.version') {
12
+ process.exit(0);
13
+ }
14
+ // For other Commander errors, exit with the provided code
15
+ if (e?.exitCode !== undefined) {
16
+ process.exit(e.exitCode);
17
+ }
18
+ console.error(e);
11
19
  process.exit(1);
12
20
  }
@@ -30605,21 +30605,6 @@ async function getUserInfo(accessToken) {
30605
30605
  return result.data;
30606
30606
  }
30607
30607
 
30608
- //#endregion
30609
- //#region src/cli/errors.ts
30610
- /**
30611
- * Error thrown to signal a controlled CLI exit with a specific exit code.
30612
- * This allows proper error propagation without calling process.exit() directly,
30613
- * making the code more testable and maintaining a single exit point.
30614
- */
30615
- var CLIExitError = class extends Error {
30616
- constructor(code$1) {
30617
- super(`CLI exited with code ${code$1}`);
30618
- this.code = code$1;
30619
- this.name = "CLIExitError";
30620
- }
30621
- };
30622
-
30623
30608
  //#endregion
30624
30609
  //#region node_modules/chalk/source/vendor/ansi-styles/index.js
30625
30610
  const ANSI_BACKGROUND_OFFSET = 10;
@@ -38066,13 +38051,6 @@ var require_lodash = /* @__PURE__ */ __commonJSMin(((exports, module) => {
38066
38051
  //#region src/cli/commands/project/create.ts
38067
38052
  var import_lodash = /* @__PURE__ */ __toESM(require_lodash(), 1);
38068
38053
  const DEFAULT_TEMPLATE_ID = "backend-only";
38069
- const SUPPORTED_AGENTS = [{
38070
- value: "cursor",
38071
- label: "Cursor"
38072
- }, {
38073
- value: "claude-code",
38074
- label: "Claude Code"
38075
- }];
38076
38054
  async function getTemplateById(templateId) {
38077
38055
  const templates = await listTemplates();
38078
38056
  const template = templates.find((t) => t.id === templateId);
@@ -38135,7 +38113,6 @@ async function createInteractive(options) {
38135
38113
  description: result.description || void 0,
38136
38114
  projectPath: result.projectPath,
38137
38115
  deploy: options.deploy,
38138
- skills: options.skills,
38139
38116
  isInteractive: true
38140
38117
  });
38141
38118
  }
@@ -38146,11 +38123,10 @@ async function createNonInteractive(options) {
38146
38123
  description: options.description,
38147
38124
  projectPath: options.path,
38148
38125
  deploy: options.deploy,
38149
- skills: options.skills,
38150
38126
  isInteractive: false
38151
38127
  });
38152
38128
  }
38153
- async function executeCreate({ template, name: rawName, description, projectPath, deploy, skills, isInteractive }) {
38129
+ async function executeCreate({ template, name: rawName, description, projectPath, deploy, isInteractive }) {
38154
38130
  const name$1 = rawName.trim();
38155
38131
  const resolvedPath = resolve(projectPath);
38156
38132
  const { projectId } = await runTask("Setting up your project...", async () => {
@@ -38210,45 +38186,12 @@ async function executeCreate({ template, name: rawName, description, projectPath
38210
38186
  finalAppUrl = appUrl;
38211
38187
  }
38212
38188
  }
38213
- let selectedAgents = [];
38214
- if (isInteractive) {
38215
- const result = await fe({
38216
- message: "Add AI agent skills? (Select agents to configure)",
38217
- options: SUPPORTED_AGENTS,
38218
- initialValues: SUPPORTED_AGENTS.map((agent) => agent.value),
38219
- required: false
38220
- });
38221
- if (!pD(result)) selectedAgents = result;
38222
- } else if (skills) selectedAgents = SUPPORTED_AGENTS.map((agent) => agent.value);
38223
- if (selectedAgents.length > 0) {
38224
- const agentArgs = selectedAgents.flatMap((agent) => ["-a", agent]);
38225
- M.step(`Installing skills for: ${selectedAgents.join(", ")}`);
38226
- await runTask(`Installing skills for: ${selectedAgents.join(", ")}`, async () => {
38227
- await execa("npx", [
38228
- "-y",
38229
- "add-skill",
38230
- "base44/skills",
38231
- "-y",
38232
- "-s",
38233
- "base44-cli",
38234
- "-s",
38235
- "base44-sdk",
38236
- ...agentArgs
38237
- ], {
38238
- cwd: resolvedPath,
38239
- stdio: "inherit"
38240
- });
38241
- }, {
38242
- successMessage: theme.colors.base44Orange("AI agent skills added successfully"),
38243
- errorMessage: "Failed to add AI agent skills - you can add them later with: npx add-skill base44/skills"
38244
- });
38245
- }
38246
38189
  M.message(`${theme.styles.header("Project")}: ${theme.colors.base44Orange(name$1)}`);
38247
38190
  M.message(`${theme.styles.header("Dashboard")}: ${theme.colors.links(getDashboardUrl(projectId))}`);
38248
38191
  if (finalAppUrl) M.message(`${theme.styles.header("Site")}: ${theme.colors.links(finalAppUrl)}`);
38249
38192
  return { outroMessage: "Your project is set up and ready to use" };
38250
38193
  }
38251
- 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) => {
38194
+ 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").hook("preAction", validateNonInteractiveFlags$1).action(async (options) => {
38252
38195
  await chooseCreate(options);
38253
38196
  });
38254
38197
 
@@ -38978,19 +38921,46 @@ var version = "0.0.17";
38978
38921
 
38979
38922
  //#endregion
38980
38923
  //#region src/cli/program.ts
38981
- const program = new Command();
38982
- program.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(version);
38983
- program.configureHelp({ sortSubcommands: true });
38984
- program.addCommand(loginCommand);
38985
- program.addCommand(whoamiCommand);
38986
- program.addCommand(logoutCommand);
38987
- program.addCommand(createCommand);
38988
- program.addCommand(dashboardCommand);
38989
- program.addCommand(deployCommand);
38990
- program.addCommand(linkCommand);
38991
- program.addCommand(entitiesPushCommand);
38992
- program.addCommand(functionsDeployCommand);
38993
- program.addCommand(siteDeployCommand);
38994
-
38995
- //#endregion
38996
- export { CLIExitError, program };
38924
+ /**
38925
+ * Custom error class for CLI exit codes.
38926
+ * Thrown instead of calling process.exit() directly to allow testing.
38927
+ * The bin/run.js entry point catches this and calls process.exit().
38928
+ */
38929
+ var CLIExitError = class extends Error {
38930
+ constructor(code$1) {
38931
+ super(`CLI exited with code ${code$1}`);
38932
+ this.code = code$1;
38933
+ this.name = "CLIExitError";
38934
+ }
38935
+ };
38936
+ /**
38937
+ * Creates a new Commander program instance with all commands registered.
38938
+ * Use this factory for testing to get a fresh program instance per test.
38939
+ */
38940
+ function createProgram() {
38941
+ const program$2 = new Command();
38942
+ program$2.name("base44").description("Base44 CLI - Unified interface for managing Base44 applications").version(version);
38943
+ program$2.configureHelp({ sortSubcommands: true });
38944
+ program$2.exitOverride((err) => {
38945
+ throw err;
38946
+ });
38947
+ program$2.configureOutput({
38948
+ writeOut: (str) => process.stdout.write(str),
38949
+ writeErr: (str) => process.stderr.write(str)
38950
+ });
38951
+ program$2.addCommand(loginCommand);
38952
+ program$2.addCommand(whoamiCommand);
38953
+ program$2.addCommand(logoutCommand);
38954
+ program$2.addCommand(createCommand);
38955
+ program$2.addCommand(dashboardCommand);
38956
+ program$2.addCommand(deployCommand);
38957
+ program$2.addCommand(linkCommand);
38958
+ program$2.addCommand(entitiesPushCommand);
38959
+ program$2.addCommand(functionsDeployCommand);
38960
+ program$2.addCommand(siteDeployCommand);
38961
+ return program$2;
38962
+ }
38963
+ const program = createProgram();
38964
+
38965
+ //#endregion
38966
+ export { CLIExitError, createProgram, program };
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@base44-preview/cli",
3
- "version": "0.0.17-pr.19.1b258d9",
3
+ "version": "0.0.17-pr.19.537d5c2",
4
4
  "description": "Base44 CLI - Unified interface for managing Base44 applications",
5
5
  "type": "module",
6
+ "main": "./dist/program.js",
6
7
  "bin": {
7
8
  "base44": "./bin/run.js"
8
9
  },
10
+ "exports": {
11
+ ".": "./dist/program.js"
12
+ },
9
13
  "files": [
10
14
  "dist",
11
15
  "bin"