@gtmos/cli
v0.3.1
Published
The `gtm` CLI: stand up a self-hosted GTM OS instance (`gtm up`), registry-driven codegen, config-as-code, and operation discovery.
Readme
@gtmos/cli — the gtm command line
Stand up and operate a self-hosted GTM OS instance. This is the WordPress-wp-cli
equivalent for GTM OS: install it globally, then gtm up pulls the released,
cosign-signed GHCR images into a directory with no repo checkout.
Install
npm i -g @gtmos/cli
# or: pnpm add -g @gtmos/cli / yarn global add @gtmos/cliA postinstall hook runs prisma generate against the bundled schema so the
database-touching commands work. It is best-effort: if it cannot run, the
install still succeeds and the bootstrap commands below work regardless.
Stand up an instance (no clone)
gtm up --registry ghcr.io/<your-org> --dir ./my-gtmos
# preview without writing/starting:
gtm up --dry-run --registry ghcr.io/<your-org> --dir ./my-gtmosgtm up writes a pinned, pull-only docker-compose.yml + .env (with generated
secrets) and runs docker compose up -d --pull always. The compose and env
templates travel inside the CLI — nothing is cloned.
Then provision the first operator + organization:
gtm onboard --org "Acme" --email [email protected] --password '…'Or do everything in one go (stack, owner, org, who approves changes, optional blueprint seed, worker, Claude Code / Codex harness):
gtm setup ./my-gtmos --org "Acme" --email [email protected] # just you: you approve your own changes
gtm setup ./my-gtmos --org "Acme" --email [email protected] --team --approver-email [email protected] # a team
gtm setup --help # ports (--api-port/--console-port/--mcp-port/--postgres-port), --no-pull, --demo/--liveA new .env is written with GTMOS_LIVE=true (live mode: a missing key fails
NOT_CONFIGURED). Check what is live with gtm doctor (needs GTMOS_API_URL,
GTMOS_TOKEN, GTMOS_ORG).
Run gtm help for the full command catalog.
What's cross-platform
Everything. The CLI shells out with explicit argument arrays (never a shell
string), generates secrets with node:crypto, and resolves paths with
node:path — identical behavior on Windows, macOS, and Linux (principle 15).
Notes for maintainers
- Built with esbuild (
npm run build→node build.mjs) into a singledist/main.mjsESM bundle with a Node shebang. - Bundled: all
@gtmos/*workspace packages (they aredevDependencies— present for the build, inlined intodist, never published as deps). - Externalized runtime dependencies (declared in
dependencies, resolved at install):@prisma/client+prisma(native query engine + code-generated client cannot be inlined) and@cedar-policy/cedar-wasm(ships a.wasmit loads by path). - The full engine registry (
gtm codegen/describe/hooks list) is a monorepo-dev surface and is loaded on demand; the globally-installed operator commands (up,init,onboard,bootstrap,plan,apply,pkg,logs,trace, …) never pull it in.
