CLI reference
Every graft command with flags that matter.
Project loop
| Command | What it does |
|---|
graft init [dir] | Scaffold config, content/, graft/ barrel |
graft compile | Project the content tree into content_index once |
graft dev | Watch content/ + config; recompile on change |
graft asset put <file> [key] | Upload a binary; print frontmatter snippet |
Operator loop
| Command | What it does |
|---|
graft approvals | List pending approvals |
graft approve <id> / graft deny <id> | Decide one; caller retries with approval |
graft migrate [--apply] | Run pending migrations (dry-run by default) |
graft harden <role> | Grant runtime least-privilege on an existing role |
Branching
| Command | What it does |
|---|
graft branch create <name> [--from main] [--backend neon] | Create overlay (default) or Neon fork |
graft branch list / graft branch drop <name> | Inspect / remove (drop purges transactionally) |
graft merge <name> [--into main] [--apply] | Replay ledger → move data → recompile |
Extending and serving
| Command | What it does |
|---|
graft add [item] | Copy an owned primitive into graft/ (no name: list) |
graft mcp | Serve project MCP over stdio |
graft serve [--port 3903] [--studio] | Headless runtime: /api/fn/<name>, /api/mcp, /api/content/v1/*, /healthz; --studio mounts opt-in Studio at /studio |
graft studio | Opt-in Studio UI — edit content, approve/deny, browse branches (default port 4983) |
graft content | List the content tree from the compiled index (Studio/OpenAPI parity) |
graft compilations | List recent projection trail rows (Studio/OpenAPI parity) |
Studio is optional. The UI is a client of /api/studio/v1/* (see
openapi.json). Same ops on MCP/CLI: content tree + write_content / Studio
Save, list_compilations, list_branches, list_approvals +
decide_approval (or graft approve / deny).
Flags
| Flag | Applies to | Meaning |
|---|
--branch <id> | compile, dev, migrate, mcp, serve, studio, content, compilations | Operate on a content branch |
--apply | migrate, merge | Execute (default is dry-run) |
--prune-unknown | compile | Remove index rows for collections this schema does not know |
--dry-run / --overwrite | add | Preview / replace differing files |
--port / --host | serve, studio | Bind address (default loopback) |
--studio | serve | Mount opt-in Studio (or set GRAFT_STUDIO=1) |
Env discovery
Commands walk up from cwd for .env. DATABASE_URL is required for compile,
dev, migrate, branch, merge, mcp (when projecting), serve, studio, content, and
compilations.