cli
AGENTS.md122 starsChanged 8 months agoMITView on GitHub
The Base44 CLI (base44 npm package) is a TypeScript command-line tool for creating, managing, and deploying Base44 apps from the terminal. The codebase has two layers with a clear separation of concerns: Near-zero-dependency npm package. Runtime dependencies are bundled into dist/index.js at build time and go in devDependencies — with one deliberate exception: the local workerd function runtime (miniflare, esbuild, @deno/loader) ships native binaries/WASM that cannot be bundled, so those three are real dependencies, marked external in the build, and…
- Pipes a download into a shell
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,700 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
The file
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 1 is distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 65
Bun for everything: - Use bun commands for install, test, build, run.
- Very specific: line 68
ES Modules: - Use .js extensions in all imports
- Very specific: line 69
Cross-platform: - Use path module utilities, never hardcode separators
- Very specific: line 70
Zero-dependency distribution: - All packages go in devDependencies.
- Very specific: line 72
consts.ts has no imports: - Keep consts.ts dependency-free to avoid circular deps
- Very specific: line 73
Keep docs updated: - Update files in docs/ when architecture changes
- Distinctive: line 78
Read these when working on the relevant area:
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Base44 CLI
The Base44 CLI (base44 npm package) is a TypeScript command-line tool for creating, managing, and deploying Base44 apps from the terminal.
Tech Stack
- Bun - Runtime, bundler, and package manager (use
bun, never npm/yarn) - Commander.js - CLI framework for command parsing
- @clack/prompts - Interactive user prompts, spinners, and logs
- Zod - Schema validation for all external data (API responses, config files, user input)
- JSON5 - Parsing JSONC/JSON5 config files (supports comments and trailing commas)
- TypeScript - Primary language, strict types
- Biome - Linting and formatting (replaces ESLint)
- Vitest - Test runner
Architecture
The codebase has two layers with a clear separation of concerns:
packages/cli/src/core/- SDK layer: pure business logic with no UI or CLI concerns. Handles resources, auth, API clients, project config, site deployment, error classes, and utilities.packages/cli/src/cli/- Presentation layer: CLI commands, user interaction, theming, telemetry, and wiring. Depends oncore/, never the reverse.packages/cli/bin/- Entry points:run.js(production, Node.js) anddev.ts(development, Bun runs TypeScript directly).packages/cli/templates/- Project scaffolding templates forbase44 create.packages/cli/tests/- CLI integration tests (cli/), core unit tests (core/), and test fixtures (fixtures/).packages/functions-compiler/-@base44/functions-compiler: the production compiler that turns backend-function sources into a single Cloudflare Workers module. Extracted from apper'sbase44-userapp-bundlerso the CLI and that HTTP service run one engine. Owns its ownbun run test/typecheck/build; see its README before editing — several files undersrc/are compile-time assets read as text, not modules, embedded as strings by itsbuild:shim(run on install) so it can be bundled.
packages/cli/src/
├── core/ # SDK: auth, clients, project, resources (entity/function/agent/connector), site, errors, utils
└── cli/ # UI: commands, telemetry, utils (runCommand, runTask, theme, banner)Distribution
Near-zero-dependency npm package. Runtime dependencies are bundled into dist/index.js at build time and go in devDependencies — with one deliberate exception: the local workerd function runtime (miniflare, esbuild, @deno/loader) ships native binaries/WASM that cannot be bundled, so those three are real dependencies, marked external in the build, and imported dynamically only when base44 dev runs functions or base44 publish compiles them. @base44/functions-compiler is bundled from its source (the CLI's tsconfig maps it to packages/functions-compiler/src), and itself imports esbuild and @deno/loader only on first use. Standalone binaries are also built for Homebrew / direct download via bun run build:binaries (see Binary distribution); they exclude the workerd runtime, so base44 dev falls back to the Deno runtime there and base44 publish refuses an app with functions.
Path Alias
@/* resolves to ./packages/cli/src/* (defined in packages/cli/tsconfig.json). Always use .js extensions in imports (ES Modules).
Development Commands
bun install # Install dependencies
bun run build # Bundle to dist/index.js + copy templates
bun run build:binaries # Compile standalone binaries (for binary test mode)
bun run typecheck # tsc --noEmit
bun run dev # Run bin/dev.ts (no build needed, Bun runs TS directly)
bun run start # Run bin/run.js (requires build first)
bun run test # Run tests in npm mode (default; use `bun run test`, not `bun test`)
bun run test:npm # Run tests against node bin/run.js (needs build)
bun run test:binary # Run tests against compiled binary (needs build + build:binaries)
bun run lint # Biome - lint and format check
bun run lint:fix # Biome - auto-fixPrerequisites: Bun (curl -fsSL https://bun.sh/install | bash), Node.js >= 20.19.0 (for npm publishing).
Debugging: DEBUG=1 base44 deploy shows full stack traces on errors.
Rules
These apply to every task. See topic guides below for domain-specific rules.
- Bun for everything - Use
buncommands for install, test, build, run.bunfig.tomlsets a 14-dayminimumReleaseAgesupply-chain cooldown onbun add/bun update, so a freshly published version cannot enterbun.lock. Never fetch tooling withbunxin a release path — it ignores the cooldown (oven-sh/bun#30748) - Zod validation - Required for all external data (API responses, config files)
- @clack/prompts only - For all user interaction (prompts, spinners, logs). No
console.log. Under the global--jsonflag the lifecycle runs silent (prompts and spinners suppressed, logs routed to stderr) — never assume a TTY - ES Modules - Use
.jsextensions in all imports - Cross-platform - Use
pathmodule utilities, never hardcode separators - Zero-dependency distribution - All packages go in
devDependencies; they get bundled. Sole exception: the workerd function-runtime packages (miniflare,esbuild,@deno/loader) are realdependencies— native binaries/WASM cannot bundle - No dynamic imports - Use static imports at top of file, avoid
await import(). Sole exception: the external workerd runtime packages are imported dynamically (seefunction-bundler.ts/function-runtime.ts/core/version/functions.ts) so they load only when dev runs functions or publish compiles them, and so the compiled binary can detect their absence - consts.ts has no imports - Keep
consts.tsdependency-free to avoid circular deps - Keep docs updated - Update files in
docs/when architecture changes - Respect the global
--jsonflag ---json(global, exposed asctx.jsonMode) makes stdout a single machine-readable JSON document and enables silent mode. Never write results withprocess.stdout.write/console.log; return them viaRunCommandResult.stdoutand put human status inoutroMessage/log(the lifecycle routes those to stderr under--json). New commands that produce data should emit it as JSONstdoutwhenctx.jsonModeis set (see thesandbox/connectorscommands);Base44Commandalready supplies a generic fallback ({ "output": "<status>" }) and a JSON error envelope, so any command stays parseable
Topic Guides
Read these when working on the relevant area:
- Adding or modifying CLI commands - Factory pattern,
runCommand(),runTask(),CLIContext, theming,chalkban - Making API calls - HTTP clients, Zod snake_case-to-camelCase transforms,
ApiError.fromHttpError() - Working with resources -
Resource<T>interface, adding new resources, site module, unified deploy - Deployments - Deploys addressed by commit, wrangler config, asset manifest hashing, direct asset uploads (Workers) and presigned uploads (static)
- Versions - Recording a build as an immutable version and serving it, staged uploads with server-verified digests, raw resource payloads, the
BASE44_VERSIONS_APIgate - Plugins - Plugin config, namespaces, entity extension rules, function namespacing, pull/deploy behavior
- Error handling - Error hierarchy, throwing patterns, error codes,
CLIExitError,process.exitban - Writing tests - Testkit, Given/When/Then pattern, API mocks, fixtures, test overrides
- Telemetry & error reporting - PostHog
ErrorReporter, what's captured, disabling - Writing & maintaining docs - Progressive disclosure, style rules, keywords, adding new topic guides
- Authoring agent instructions - Skills, CLAUDE.md, AGENTS.md, subagent definitions, progressive disclosure
- Binary distribution - Standalone binaries, Homebrew formula, asset embedding,
bun build --compile
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

