@bship/cli
v0.2.3
Published
The buildship command: run workflows locally with a live map, then build and deploy them to a BuildShip project.
Readme
@bship/cli
The buildship command for workflows written with @bship/sdk:
set an app up, run its workflows locally with a live map, then build and deploy them to a
BuildShip project.
npx @bship/cli@latest setupsetup works in Vite, Next.js and plain Node apps. It installs both packages and adds
flows/hello.ts, the dev and deploy scripts, the project variable in .env.local, and an
agent skill in .claude/skills/buildship, all without touching your framework's config. Run it
again any time; it keeps whatever is already in place. The skill on its own:
npx skills add https://cdn.jsdelivr.net/npm/@bship/sdk/skill/SKILL.md.
The CLI belongs in your app as a devDependency, next to @bship/sdk: it loads the app's copy of
the SDK to find your workflows. Needs Node 20.12 or later.
Commands
buildship setup [--project <id>] [--skip-install] add BuildShip to this app: packages, flows/, scripts, .env.local, agent skill
buildship dev [dir] [--port <n>] [-- <command>] serve workflows locally, hot-reloading; runs your app's dev command too
buildship run <workflow> [json] [--dir <dir>] run one workflow, streaming its events, then the path it took
buildship graph [dir] [--out <file>] [--outline] [--diff <manifest>]
print the map as JSON or an outline, or what changed since a saved one
buildship build [dir] [--minify] [--external-deps] compile .buildship/<unit>/{build.mjs,triggers.json}
buildship deploy [dir] [--minify] [--take-over] build, then release the app's workflows to your BuildShip project[dir] is the workflows directory and defaults to ./flows.
devservesPOST /v1/function/<name>/runwith{ input }, answering with the workflow's result,POST <route>for eachapitrigger's route (the body is the input),GET /v1/graph, the map, andGET /v1/runs, the latest runs replayed on it. Everything after--is your app's own dev command (buildship dev -- vite), started alongside; stopping either stops both. Edit a flow or anything it imports and call again, no restart;console.logprints in the same terminal. Dev is always local: it blanks the project variables for itself and your app, so a project in.env.localonly applies todeploy, production builds andnpm run dev:remote, whichsetupadds to run your app alone against the deployed project.buildcompiles one self-contained ESM bundle per workflow file, npm dependencies included. Each bundle carries the map of its workflows and replays every run on it, so the runtime can show per-node stats.deployreleases the app (its package.jsonname) to the project as a whole. Functions deleted or renamed in the code stop being served. A workflow name or route that another app in the project already uses is refused;--take-overmoves a name to this app. The project's runtime then serves each workflow with an"api"trigger at its route (POST https://<id>.buildship.run/refunds, the body is the input) and athttps://<id>.buildship.run/v1/function/<name>/run.crontriggers are saved but not scheduled yet. The design is indocs/function-deploys.md.
Environment
| Variable | Meaning |
| -------------------- | ----------------------------------------------------------------------------------------------- |
| BUILDSHIP_PROJECT | The project, e.g. buildship-123abc. Vite and Next.js apps use VITE_BUILDSHIP_PROJECT or NEXT_PUBLIC_BUILDSHIP_PROJECT so it reaches the browser; every command reads all three, and deploy reads .env.local and .env. Once set, callWorkflow() and run use the project's runtime. |
| BUILDSHIP_APP_PROJECT | The project whose BuildShip app shows a deploy's functions. It defaults to the project deployed to; set it to show local deploys, e.g. buildship-a6ax0g. |
| BUILDSHIP_DEV_PORT | Port for buildship dev (default 3939). |
