diff --git a/CLI_VERSION b/CLI_VERSION index 5fe386d..5bc7386 100644 --- a/CLI_VERSION +++ b/CLI_VERSION @@ -1 +1 @@ -v0.0.45 +v0.0.46 diff --git a/README.md b/README.md index c804e16..a2ae2bf 100644 --- a/README.md +++ b/README.md @@ -39,8 +39,8 @@ npx skills add base44/skills -g | Skill | Description | |-------|-------------| -| [`base44-cli`](skills/base44-cli/SKILL.md) | Create and manage Base44 projects using the CLI. Handles initialization, deployment, entity schema management, and authentication. | -| [`base44-sdk`](skills/base44-sdk/SKILL.md) | Build apps using the Base44 JavaScript SDK. Covers entities, auth, agents, functions, integrations, and connectors. | +| [`base44-cli`](skills/base44-cli/SKILL.md) | Create and manage Base44 projects using the CLI. Handles resource configuration (entities, backend functions, AI agents), initialization, and deployment. | +| [`base44-sdk`](skills/base44-sdk/SKILL.md) | Build apps using the Base44 JavaScript SDK. Communicate with remote resources like entities, backend functions, and AI agents. | | [`base44-troubleshooter`](skills/base44-troubleshooter/SKILL.md) | Troubleshoot production issues using backend function logs. Use when investigating app errors or diagnosing production problems. | ## About Agent Skills diff --git a/skills/base44-cli/SKILL.md b/skills/base44-cli/SKILL.md index ac07484..b5a75ec 100644 --- a/skills/base44-cli/SKILL.md +++ b/skills/base44-cli/SKILL.md @@ -360,6 +360,14 @@ Manage project secrets (environment variables stored securely in Base44). These | `base44 secrets set` | Set one or more secrets (KEY=VALUE or --env-file) | [secrets-set.md](references/secrets-set.md) | | `base44 secrets delete ` | Delete a secret by name | [secrets-delete.md](references/secrets-delete.md) | +### Script Execution + +Run one-off scripts against your app with the Base44 SDK pre-authenticated. Use it to perform CRUD operations on entities (`base44.entities.MyEntity.list/create/update/delete`), call backend functions (`base44.functions.invoke("myFunction", args)`), invoke agents, or access any other resource exposed by the SDK — without deploying a full function. Useful for data migrations, bulk operations, debugging, and automation scripts. + +| Command | Description | Reference | +|---------|-------------|-----------| +| `base44 exec` | Run a script (via stdin) with the Base44 SDK pre-authenticated | [exec.md](references/exec.md) | + ### Type Generation | Command | Description | Reference | diff --git a/skills/base44-cli/references/exec.md b/skills/base44-cli/references/exec.md new file mode 100644 index 0000000..68b477f --- /dev/null +++ b/skills/base44-cli/references/exec.md @@ -0,0 +1,47 @@ +# base44 exec + +Run a script with the Base44 SDK pre-authenticated as the current user. Reads the script from stdin. + +## Syntax + +```bash +cat ./script.ts | npx base44 exec +echo "" | npx base44 exec +``` + +## How It Works + +The `exec` command reads a script from stdin and runs it server-side with the Base44 SDK pre-authenticated as the currently logged-in user. This allows you to run one-off scripts against your app's data without writing a full function. + +## Available Globals + +> **`base44`** — a preinitialized SDK client, available as a global variable in every exec script. You do not need to import or configure it — it is ready to use immediately. + +Use it to interact with your app's resources: + +- `base44.entities.` — CRUD operations on entities (`.list()`, `.get(id)`, `.create(data)`, `.update(id, data)`, `.delete(id)`) +- `base44.functions.invoke(name, data?)` — call a backend function +- `base44.agents.` — invoke AI agents +- For more available resources and methods, see the [Base44 SDK reference](../../base44-sdk/SKILL.md) + +## Examples + +```bash +# Run a script file +cat ./script.ts | npx base44 exec + +# Inline script +echo "const users = await base44.entities.User.list(); console.log(users)" | npx base44 exec +``` + +## Requirements + +- Must be authenticated (`npx base44 login`) +- Must be run from a linked Base44 project directory +- Script must be piped via stdin (non-interactive mode) + +## Notes + +- The script runs with the Base44 SDK pre-authenticated — you can use `base44.entities`, `base44.functions`, etc. directly +- Exit code from the script is forwarded as the CLI process exit code +- This command requires stdin to be piped (it does not accept input in interactive TTY mode)