diff --git a/CLI_VERSION b/CLI_VERSION index fad30c5..f0cfd3b 100644 --- a/CLI_VERSION +++ b/CLI_VERSION @@ -1 +1 @@ -v0.1.7 +v0.2.2 diff --git a/skills/base44-cli/SKILL.md b/skills/base44-cli/SKILL.md index 7300207..117d38d 100644 --- a/skills/base44-cli/SKILL.md +++ b/skills/base44-cli/SKILL.md @@ -4,7 +4,7 @@ description: "The base44 CLI is used for EVERYTHING related to base44 projects: metadata: sourcePackage: name: base44 - version: 0.1.7 + version: 0.2.2 --- # Base44 CLI @@ -232,6 +232,14 @@ Do **not** use `--app-id` for commands that need local project files: - `base44 dev` runs from a linked local project, so it rejects `--app-id` - `base44 deploy` still requires a local project directory because it reads local resources +## Global `--branch` Option + +`--branch ` targets a sandbox command (`sandbox read/write/edit/grep/ls/run/checkpoint`) at one of the app's branches by exact name, instead of `main`. Every other command rejects it outright — it is not a general way to read another branch's data. Run `npx base44 branches list --app-id --json` to discover the names a given app has (`main` plus any active branch). Sandbox commands are documented in the base44-sandbox skill; this skill only owns `branches list`. + +| Command | Description | Reference | +|---------|-------------|-----------| +| `base44 branches list` | List main and active branch names for use with `--branch` | [branches-list.md](references/branches-list.md) | + ## Global `--json` Option The CLI has a global `--json` option that makes commands emit a machine-readable JSON document on stdout instead of human-oriented output. It also forces non-interactive mode (spinners/status messages/logs move to stderr), so stdout stays pure JSON — safe to pipe into `jq` or another program. @@ -552,13 +560,17 @@ Run one-off scripts against your app with the Base44 SDK pre-authenticated. Use ### Site Management -| Command | Description | Reference | -| -------------------- | ----------------------------------------- | ------------------------------------------- | -| `base44 site deploy` | Deploy built site files to Base44 hosting | [site-deploy.md](references/site-deploy.md) | -| `base44 site open` | Open the deployed site in your browser | [site-open.md](references/site-open.md) | +| Command | Description | Reference | +| --------------------- | ------------------------------------------------------------------------- | ---------------------------------------------- | +| `base44 site deploy` | Deploy built site files to Base44 hosting | [site-deploy.md](references/site-deploy.md) | +| `base44 site install` | Install the site's dependencies with its configured command, nothing else | [site-install.md](references/site-install.md) | +| `base44 site dev` | Run only the site's dev server, with no local backend | [site-dev.md](references/site-dev.md) | +| `base44 site open` | Open the deployed site in your browser | [site-open.md](references/site-open.md) | **SPA only**: Base44 hosting supports Single Page Applications with a single `index.html` entry point. All routes are served from `index.html` (client-side routing). +`site install` and `site dev` are local-only (no login, no app id) — the shape a hosted build/dev sandbox needs. Use plain `base44 dev` for ordinary local development (it also runs the backend); use `site dev` only when something else is already serving the backend and you need the frontend alone. + ### Any Other API Operation For a Base44 platform task with no dedicated command above (custom domains, URL redirects, SEO settings, app users, collaborators and ownership, analytics, security scans, workspace members and groups, CSV imports, and more), find and call the public API endpoint directly with `base44 api`. It covers the Apps API and Workspace API with your CLI login, through the server's OpenAPI spec. diff --git a/skills/base44-cli/references/branches-list.md b/skills/base44-cli/references/branches-list.md new file mode 100644 index 0000000..40fca1a --- /dev/null +++ b/skills/base44-cli/references/branches-list.md @@ -0,0 +1,62 @@ +# base44 branches list + +List an app's main and active branch names, for use with the global `--branch` option. + +## Syntax + +```bash +npx base44 branches list [options] +``` + +## Options + +This command takes no command-specific options. It accepts the global `--app-id ` and `--json` options. + +## Authentication + +**Required**: Yes. If not authenticated, you'll be prompted to login first. + +## What It Does + +1. Fetches the app's active branches from the server +2. Prepends `main` (always present, always listed first) to the fetched branches +3. Prints each branch's name and status + +## Examples + +```bash +# List branches for the linked local project +npx base44 branches list + +# List branches for a specific app without a local checkout +npx base44 branches list --app-id app_123 --json +``` + +## Output + +Human-readable: +```bash +$ npx base44 branches list +main (active) +feature-x (active) +└ 2 branches +``` + +With `--json`: +```json +{"branches":[{"name":"main","status":"active"},{"name":"feature-x","status":"active"}]} +``` + +## Notes + +- This is a read-only, discovery-only command — it does not create, delete, or switch branches +- The names it returns are exactly what the global `--branch ` option accepts; `--branch` resolves names within the selected app, and an unknown or ambiguous name fails +- `--branch` only targets sandbox commands (`sandbox read/write/edit/grep/ls/run/checkpoint`) — every other command rejects it. Omitting `--branch`, or passing `--branch main`, targets `main` +- `--app-id app_123 --json` is the shape an agent working outside the Builder UI uses to resolve branch names for a given app before targeting one with `--branch` + +## Related Commands + +| Command | Description | +|---------|-------------| +| `base44 sandbox read` | Read a file from the sandbox (or a branch, with `--branch`) | +| `base44 sandbox write` | Write a file in the sandbox (or a branch, with `--branch`) | diff --git a/skills/base44-cli/references/deploy.md b/skills/base44-cli/references/deploy.md index ff46072..adbd70a 100644 --- a/skills/base44-cli/references/deploy.md +++ b/skills/base44-cli/references/deploy.md @@ -13,6 +13,9 @@ npx base44 deploy [options] | Option | Description | |--------|-------------| | `-y, --yes` | Skip confirmation prompt | +| `--build` | Build the site first (skips the interactive "build first?" prompt) | +| `--no-build` | Deploy without building (skips the prompt) | +| `--git-hash ` | Deploy the site by the commit the build came from, through the deployments API (advanced — see [Deploying by Commit](site-deploy.md#deploying-by-commit---git-hash)) | ## What It Deploys @@ -56,7 +59,8 @@ npx base44 deploy -y 2. Detects available resources (entities, functions, actors, agents, agent skills, connectors, site) 3. Shows a summary of what will be deployed 4. Asks for confirmation (unless `-y` flag is used) -5. Deploys all resources in sequence: +5. If the project has a `site.buildCommand`, asks whether to build first (interactive), or builds/skips immediately per `--build`/`--no-build` (non-interactive-safe) +6. Deploys all resources in sequence: - Sets app visibility (if configured) - Pushes entity schemas - Deploys functions @@ -66,8 +70,8 @@ npx base44 deploy -y - Pushes auth configuration - Pushes connector configurations - Uploads site files -6. Handles OAuth authorization for any new connectors that require it -7. Displays the dashboard URL and app URL (if site was deployed) +7. Handles OAuth authorization for any new connectors that require it +8. Displays the dashboard URL and app URL (if site was deployed) ## Connector OAuth Flow @@ -81,7 +85,7 @@ Some connectors still require authorization. Run 'base44 connectors push' or ope - Must be run from a linked Base44 project directory - Must be authenticated (run `npx base44 login` first) -- For site deployment, must run `npm run build` first +- For site deployment, either build first (`npm run build`, or let `deploy` build for you via the prompt / `--build`) or pass `--no-build` to deploy whatever is already in the output directory ## Output @@ -93,7 +97,8 @@ After successful deployment: - If no resources are found, the command exits with a message - Use individual commands (`entities push`, `functions deploy`, `actors deploy`, `agents push`, `agent-skills push`, `connectors push`, `site deploy`) if you only want to deploy specific resources -- The site must be built before deployment - this command does not run `npm run build` for you +- When the project has a `site.buildCommand`, interactive runs ask whether to build first; `--build`/`--no-build` pre-answer that prompt so it's safe to script +- `--git-hash ` is an advanced flag: it ships the site through the deployments API (the same lane `base44 site deploy --git-hash` uses) and publishes it, addressed by that commit. Without it, the site deploys through the archive upload and goes live as before — a full-stack build (one with a Cloudflare Worker) **requires** `--git-hash`, since the archive upload can't carry its worker ## Related Commands diff --git a/skills/base44-cli/references/dev.md b/skills/base44-cli/references/dev.md index 1a09c9f..00002c0 100644 --- a/skills/base44-cli/references/dev.md +++ b/skills/base44-cli/references/dev.md @@ -61,6 +61,8 @@ If `site.serveCommand` is missing, `base44 dev` still works, but it only starts wired to your app's **production** backend — every read and write hits live data. Use it to develop the UI against real content; default to plain `base44 dev` otherwise. +`--port` applies to the local backend, which `--remote` does not start — combining them fails with an error. Fails outright (no fallback) if the project has no `site.serveCommand`, since there'd be nothing to run. + ## Examples ```bash diff --git a/skills/base44-cli/references/eject.md b/skills/base44-cli/references/eject.md index 78e2e78..fd27b39 100644 --- a/skills/base44-cli/references/eject.md +++ b/skills/base44-cli/references/eject.md @@ -50,7 +50,7 @@ When you run `eject`: 3. **Download**: The project code is downloaded to the specified path 4. **New Project Creation**: A copy of the project is created in Base44 (e.g., "My App Copy") 5. **Linking**: The local code is linked to the new project -6. **Optional Deployment**: If the project has build commands configured, you'll be asked if you want to deploy +6. **Optional Deployment**: If the project has a `site` block configured, you'll be asked if you want to deploy (both the install and build commands default to the conventions `base44 create` scaffolds, so a partial `site` block — e.g. only `outputDirectory` set — still offers this) - Runs the install command (e.g., `npm install`) - Runs the build command (e.g., `npm run build`) - Deploys all resources with `base44 deploy` diff --git a/skills/base44-cli/references/exec.md b/skills/base44-cli/references/exec.md index 6f89a46..1ab5fbd 100644 --- a/skills/base44-cli/references/exec.md +++ b/skills/base44-cli/references/exec.md @@ -15,8 +15,8 @@ echo "" | npx base44 exec [options] |--------|-------------|----------|---------| | `--local` | Run against the local `base44 dev` server instead of the deployed app | No | `false` | | `--port ` | Port the local dev server is on. Only valid with `--local` | No | `4400` | -| `--privileged` | Run with admin privileges (bypass RLS). Requires app owner/editor role | No | `false` | -| `--data-env ` | Data environment to run against (e.g. `dev`, `prod`) | No | - | +| `--privileged` | Run with admin privileges (bypass RLS). Requires app owner/editor role. Env: `BASE44_PRIVILEGED` | No | `false` | +| `--data-env ` | Data environment to run against (e.g. `dev`, `prod`). Env: `BASE44_DATA_ENV` | No | - | ## How It Works @@ -24,6 +24,8 @@ The `exec` command reads a script from stdin and runs it server-side with the Ba By default the script runs against your deployed app. Pass `--local` to run it against a `base44 dev` server running on your machine instead — useful for testing scripts before they touch production data. +`exec` loads an SDK version released within the last 24 hours, rather than holding back on Deno's default minimum-dependency-age window the way other imported npm packages do — so a script always gets a current SDK. Pin an exact version with `BASE44_EXEC_SDK_VERSION` (e.g. `0.8.52`) if you need reproducibility. + ## 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. @@ -81,6 +83,10 @@ echo "..." | npx base44 exec --data-env prod - Defaults to port `4400` (the same default `base44 dev` binds to); pass `--port` if you started `base44 dev` on a different port - `base44 dev` must already be running in another terminal — `exec --local` does not start it for you +## Environment-Supplied Target (Advanced) + +Setting both `BASE44_EXEC_ACCESS_TOKEN` and `BASE44_EXEC_SERVER_URL` points `exec` at that server with that token directly, skipping the platform login entirely (`BASE44_EXEC_SERVICE_TOKEN` is forwarded alongside, if set). This is for a host that already has credentials of its own to hand the script — e.g. a platform-managed sandbox — not something to set for ordinary interactive use. The two required vars must be set together; setting only one is an error. This target cannot be combined with `--local`. + ## Notes - The script runs with the Base44 SDK pre-authenticated — you can use `base44.entities`, `base44.functions`, etc. directly diff --git a/skills/base44-cli/references/link.md b/skills/base44-cli/references/link.md index 9755b2e..5bd2710 100644 --- a/skills/base44-cli/references/link.md +++ b/skills/base44-cli/references/link.md @@ -73,7 +73,7 @@ npx base44 link --create --name my-app --workspace 507f1f77bcf86cd799439011 - Links to an existing app (with `--app-id` or interactive selection) 4. Writes the app ID to `base44/.app.jsonc` -The interactive selection (and `--app-id`) lists **all** of your existing Base44 apps, including ones originally built in the Base44 editor — not just apps previously created via the CLI. +The interactive selection lists **all** of your existing Base44 apps, including ones originally built in the Base44 editor — not just apps previously created via the CLI. `--app-id` skips that listing entirely and links directly — the first request made is one that addresses the app by that ID, so a wrong ID fails immediately rather than after fetching a list. This also means `--app-id` works with a workspace API key (`BASE44_API_KEY`), which cannot list apps at all and would otherwise fail `link` in CI. ## Requirements diff --git a/skills/base44-cli/references/site-deploy.md b/skills/base44-cli/references/site-deploy.md index 929d302..307e04f 100644 --- a/skills/base44-cli/references/site-deploy.md +++ b/skills/base44-cli/references/site-deploy.md @@ -8,6 +8,7 @@ Deploy built site files to Base44 hosting. - [Authentication](#authentication) - [Prerequisites](#prerequisites) - [How It Works](#how-it-works) +- [Deploying by Commit (`--git-hash`)](#deploying-by-commit---git-hash) - [Interactive Flow](#interactive-flow) - [Typical Workflow](#typical-workflow) - [Configuration](#configuration) @@ -23,9 +24,14 @@ npx base44 site deploy [options] ## Options -| Option | Description | -| ------------ | ------------------------- | -| `-y, --yes` | Skip confirmation prompt | +| Option | Description | +|--------|-------------| +| `-y, --yes` | Skip confirmation prompt | +| `--build` | Build the site first (skips the interactive "build first?" prompt) | +| `--no-build` | Deploy without building (skips the prompt) | +| `--git-hash ` | Deploy by the commit the build came from, through the deployments API (see [Deploying by Commit](#deploying-by-commit---git-hash)) | +| `--concurrency ` | Parallel asset uploads when using `--git-hash` (default varies by build; whole number) | +| `--publish` | Serve this build in production once it is deployed. Only meaningful with `--git-hash` | Use `-y` flag for non-interactive/automated deployments: @@ -40,18 +46,34 @@ npx base44 site deploy -y ## Prerequisites - Must be run from a Base44 project directory -- Project must have `site.outputDirectory` configured in project config -- Site must be built before deploying (run your build command first) -- **SPA only**: Base44 hosting supports Single Page Applications with a single `index.html` entry point. All routes are served from `index.html` (client-side routing). +- Site must be built before deploying — either run your build command first, let this command build for you (prompt, or `--build`), or pass `--no-build` to deploy the current output directory as-is +- **SPA only**: Base44 hosting supports Single Page Applications with a single `index.html` entry point. All routes are served from `index.html` (client-side routing) — this applies to the default archive-upload lane; a `--git-hash` full-stack deploy is served by its own Worker instead ## How It Works -1. Reads project configuration -2. Validates that site configuration exists +There are two deploy lanes, chosen by whether `--git-hash` is passed: + +**Without `--git-hash` (default, archive upload):** +1. Reads project configuration (`site.outputDirectory` defaults to the convention `base44 create` scaffolds if not set) +2. Offers to build first (prompt, or `--build`/`--no-build`) 3. Prompts for deployment confirmation showing the output directory -4. Creates an archive of site files from the output directory -5. Deploys to Base44 hosting -6. Returns the app URL +4. Creates an archive of site files from the output directory and deploys it +5. Goes live immediately and returns the app URL + +**With `--git-hash ` (deployments API):** see [Deploying by Commit](#deploying-by-commit---git-hash) below. A full-stack build (one that produced a Cloudflare Worker) cannot use the archive lane at all — this command detects it and requires `--git-hash`. + +This command is no longer gated behind `BASE44_DEPLOYMENTS_API`; `--git-hash` and `--concurrency` are always available, and setting that env var does nothing anymore. + +## Deploying by Commit (`--git-hash`) + +```bash +npx base44 site deploy --git-hash +``` + +- The build is deployed **by that commit** but is **not published** — production keeps serving its previous build. Pass `--publish` to also make it live, or run `base44 site deploy --publish` again (or use `base44 deploy --git-hash`, which always publishes). +- This is the same lane the platform's own build step uses for Builder-managed apps, which are published from the Builder — so this command deliberately leaves production alone unless you ask with `--publish`. +- `--concurrency ` controls how many asset uploads run in parallel. +- If `--publish` succeeds in deploying but the app's URL can't be looked up afterward (e.g. with a workspace API key), the command still reports the deploy; it just omits the URL rather than failing. ## Interactive Flow @@ -77,6 +99,9 @@ npm run build # 2. Deploy to Base44 npx base44 site deploy + +# Or let the command build for you +npx base44 site deploy --build -y ``` ## Configuration @@ -88,13 +113,9 @@ The `site.outputDirectory` in your project configuration should point to where y - Create React App: typically `./build` - Custom: whatever your build tool outputs to -## Error Handling +`site.installCommand` and `site.buildCommand` default to the conventions `base44 create` scaffolds (`npm install` / `npm run build`) when a `site` block is present but doesn't name them. `serveCommand` and `outputDirectory` are deliberately **not** defaulted — their absence means "no frontend to run" / "nothing built to upload". -If site configuration is missing: -```bash -$ npx base44 site deploy -Error: No site configuration found in project -``` +## Error Handling If you cancel the deployment: ```bash @@ -102,17 +123,29 @@ Deploy site from ./dist? (yes/no) no Deployment cancelled ``` +If a full-stack build (with a Cloudflare Worker) is deployed without `--git-hash`, the command fails asking for the flag — the archive upload cannot carry a worker, so this previously shipped incompletely and now refuses up front instead. + ## Use Cases - Deploy your site after making changes - Push new versions of your application - Deploy after updating content or functionality - Part of your CI/CD pipeline +- `--git-hash` / `--publish`: deploy a specific commit's build without immediately making it production (e.g. a preview, or a platform-driven build step) ## Notes -- Always build your site before deploying -- The command deploys whatever is in your output directory +- Always build your site before deploying (or let this command build it — see [Options](#options)) +- The archive lane deploys whatever is in your output directory; the `--git-hash` lane deploys a build addressed by its commit - Make sure your build completed successfully before deploying - Previous deployments are preserved (versioned) in Base44 -- Deployment is immediate and updates your live site +- Without `--git-hash`, deployment is immediate and updates your live site. With `--git-hash` and no `--publish`, it is not + +## Related Commands + +| Command | Description | +|---------|-------------| +| `base44 deploy` | Deploy all project resources, including the site | +| `base44 build` | Build the site with its app id injected | +| `base44 site dev` | Run only the site's dev server | +| `base44 site install` | Install the site's dependencies | diff --git a/skills/base44-cli/references/site-dev.md b/skills/base44-cli/references/site-dev.md new file mode 100644 index 0000000..7753b57 --- /dev/null +++ b/skills/base44-cli/references/site-dev.md @@ -0,0 +1,68 @@ +# base44 site dev + +Run the site's dev server exactly as written, with **no local backend**. The frontend reaches its backend same-origin — the shape a hosted sandbox needs. + +## Syntax + +```bash +npx base44 site dev [args...] +``` + +## Options + +| Option | Description | Required | +|--------|-------------|----------| +| `[args...]` | Arguments appended to the `serveCommand`, after `--` | No | + +## Authentication + +**Not required** for the command itself. It still needs a linked local project (`base44/.app.jsonc`) to know the app id. + +## What It Does + +1. Requires a linked local project — fails if `base44/.app.jsonc` is missing +2. Reads `site.serveCommand` from `base44/config.jsonc` (defaults to `npm run dev` when the project has no `site` block, or the block doesn't name one) +3. Runs it exactly as written — it starts no local backend of its own +4. Anything passed after `--` is appended to the command as given, with no extra `--` inserted. A `serveCommand` that itself needs `--` to reach its own script's args needs a **second** one: `base44 site dev -- -- --config wrapper.mjs` +5. Where the dev server binds is the `serveCommand`'s own business — in a hosted sandbox, `@base44/vite-plugin` binds Base44 apps to `0.0.0.0:5173`; a custom `serveCommand` must bind whatever address the sandbox exposes itself + +## `site dev` vs `dev` vs `dev --remote` + +| Command | Backend | Use when | +|---------|---------|----------| +| `base44 dev` | Local | Ordinary developer-machine full-stack development | +| `base44 dev --remote` | Production (remote) | Developer machine, frontend against live data, no local backend | +| `base44 site dev` | None — frontend reaches its backend same-origin | A hosted sandbox that serves the backend itself and only needs the frontend process | + +`site dev` is the one case that starts **no** backend at all — not local, not pointed at production. Use plain `base44 dev` for normal local development. + +## Examples + +```bash +# Run the site's own dev server +npx base44 site dev + +# Forward extra args to the serveCommand +npx base44 site dev -- --host + +# serveCommand itself needs `--` to reach its script's own args +npx base44 site dev -- -- --config wrapper.mjs +``` + +## Requirements + +- Must be run from a linked local Base44 project (`base44/.app.jsonc` must exist) + +## Notes + +- Reads only `base44/config.jsonc`'s `site` block — invalid resource files elsewhere in the project do not block it +- Shuts down when the serve command's process exits, or on `SIGINT`/`SIGTERM` +- `serveCommand` defaults to `npm run dev` here specifically because this command's whole job is serving the frontend; `base44 dev` and `base44 deploy` leave an absent `serveCommand` undefaulted, since there it means "no frontend to run" + +## Related Commands + +| Command | Description | +|---------|-------------| +| `base44 dev` | Run the local backend, and the frontend too if configured | +| `base44 dev --remote` | Frontend only, against the production backend | +| `base44 site install` | Install the site's dependencies | diff --git a/skills/base44-cli/references/site-install.md b/skills/base44-cli/references/site-install.md new file mode 100644 index 0000000..4ef96c3 --- /dev/null +++ b/skills/base44-cli/references/site-install.md @@ -0,0 +1,49 @@ +# base44 site install + +Install the site's dependencies with its configured install command, and nothing else. + +## Syntax + +```bash +npx base44 site install +``` + +## Options + +This command takes no options. + +## Authentication + +**Not required.** Local only: no login and no app id are needed. + +## What It Does + +1. Reads `site.installCommand` from `base44/config.jsonc` (defaults to `npm install` when the project has no `site` block, or the block doesn't name one) +2. Runs it in the project root +3. Reports success or failure + +## Examples + +```bash +# Install the site's dependencies +npx base44 site install +``` + +## Use Cases + +- A machine that only needs a project's dependencies installed, without going through `create`, `scaffold`, or `eject` first — e.g. a CI step or a hosted build/dev sandbox that only has the checked-out repo +- Installing dependencies before running `base44 site dev` or `base44 build` + +## Notes + +- Reads no app context and calls no API — it works before `base44 login` and before the project is linked to an app +- Does not read entities, functions, or any other resource files — an invalid `base44/config.jsonc` resource section does not block it +- `installCommand` defaults to the convention `base44 create` scaffolds (`npm install`); set `site.installCommand` in `base44/config.jsonc` to override it + +## Related Commands + +| Command | Description | +|---------|-------------| +| `base44 site dev` | Run only the site's dev server | +| `base44 build` | Build the site with the app id injected | +| `base44 dev` | Run the local backend, and the frontend too if configured | diff --git a/skills/base44-troubleshooter/references/project-logs.md b/skills/base44-troubleshooter/references/project-logs.md index fb3c69b..6ce79af 100644 --- a/skills/base44-troubleshooter/references/project-logs.md +++ b/skills/base44-troubleshooter/references/project-logs.md @@ -14,19 +14,19 @@ This command can run from a linked project, or outside a project when you pass ` | Option | Description | Required | |--------|-------------|----------| -| `--function ` | Filter by function name(s), comma-separated. If omitted, fetches logs for all functions in the current app | No | +| `--function ` | Filter by function name(s), comma-separated. If omitted, fetches logs for all **deployed** functions in the app (not local-only, undeployed ones) | No | | `--since ` | Show logs from this time. ISO datetime or relative shorthand (e.g. `1h`, `30m`, `2d`). Cannot be combined with `--follow` | No | | `--until ` | Show logs until this time. ISO datetime or relative shorthand (e.g. `1h`, `30m`, `2d`). Cannot be combined with `--follow` | No | | `--level ` | Filter by log level: `info`, `warning`, `error`, `debug` | No | | `-n, --limit ` | Number of results to return. **No default** — the CLI sends a limit only when you pass one, and a value above 500 is clamped down to 500 | No | | `--order ` | Sort order: `asc` or `desc`. Only affects a **multi-function** fetch (it orders the client-side merge); ignored when reading a single function. Cannot be combined with `--follow` | No | -| `--env ` | Which deployment to read logs from: `preview` (current draft) or `prod` (published). Default: `preview` | No | +| `--env ` | Which deployment to read logs from: `preview` (current draft) or `prod` (published). Omit to read **both** | No | | `-f, --follow` | Stream new logs as they arrive instead of a one-shot fetch. Realtime (sub-second) where the stream is available; where it cannot be opened the CLI polls instead (~20-30s lag). Cannot be combined with `--since`, `--until` or `--order` | No | ## Examples ```bash -# Fetch logs for all project functions +# Fetch logs for all deployed functions npx base44 logs # Fetch logs for a specific app without a local checkout @@ -71,12 +71,12 @@ npx base44 logs --follow --function my-function - **Authentication required.** You must be logged in before fetching logs. - **App context required.** Run from a linked project, or pass `--app-id` / set `BASE44_APP_ID`. - When multiple functions are specified, logs are merged and sorted by timestamp. -- If `--function` is omitted, logs are fetched for **all functions** in the current app. +- If `--function` is omitted, logs are fetched for **all deployed functions** in the app — this always queries the remote app, even when run from a linked local project, so a function defined locally but never deployed is not included. - The `--limit` applies after merging logs from all specified functions. - There is **no default page size**. The CLI sends a limit only when you pass one, and a `--limit` above 500 is clamped down to 500 — so do not plan on paging further back by raising the number. What you get when you omit it is not a fixed number: the runtime decides, and it may cap you at 500 anyway. Pass `--limit` when the count matters to you. - `--order` is only honored for the client-side merge of several functions. The server does not read it, so it is inert on a single-function fetch — the entries come back newest-first regardless. - The `--since` and `--until` values accept an ISO datetime, or a relative shorthand (e.g. `1h`, `30m`, `2d`) measured back from now. ISO values without a timezone are normalized to UTC (appends `Z`). -- `--env` defaults to `preview`. If `prod` returns no logs, the app may not have been published yet — try `--env preview` to see draft logs. +- `--env` has no default — omitting it reads logs from **both** preview and prod. Pass `--env prod` or `--env preview` to narrow to one. If `--env prod` returns no logs, the app may not have been published yet — try `--env preview` to see draft logs. - **`No logs found matching the filters.` is ambiguous.** It means one of: the run has not been ingested yet (~20-30s; wait and re-run — *do not* change flags), there is no function by that name, or a `--function` filter dropped unstamped rows from a legacy per-function deployment. It never means "the app is healthy". - `--follow` streams logs indefinitely (oldest to newest) instead of a single fetch; it's incompatible with `--since`, `--until` and `--order`. A stream that is lost and cannot be re-established ends the command with an error rather than dropping to polling. See [Following logs live](#following-logs-live). - Pass the global `--json` flag to emit each log entry as JSON instead of the human-readable format.