graft. docs

CLI reference

Every graft command with flags that matter.

Project loop

CommandWhat it does
graft init [dir]Scaffold config, content/, graft/ barrel
graft compileProject the content tree into content_index once
graft devWatch content/ + config; recompile on change
graft asset put <file> [key]Upload a binary; print frontmatter snippet

Operator loop

CommandWhat it does
graft approvalsList 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

CommandWhat 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

CommandWhat it does
graft add [item]Copy an owned primitive into graft/ (no name: list)
graft mcpServe 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 studioOpt-in Studio UI — edit content, approve/deny, browse branches (default port 4983)
graft contentList the content tree from the compiled index (Studio/OpenAPI parity)
graft compilationsList 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

FlagApplies toMeaning
--branch <id>compile, dev, migrate, mcp, serve, studio, content, compilationsOperate on a content branch
--applymigrate, mergeExecute (default is dry-run)
--prune-unknowncompileRemove index rows for collections this schema does not know
--dry-run / --overwriteaddPreview / replace differing files
--port / --hostserve, studioBind address (default loopback)
--studioserveMount 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.