@ogygia/cli
CLI
The ogygia command line. It wires ogygia into a SvelteKit app, scaffolds a docs site, sets a repository up for AI agents with a skill and an MCP server, judges pages against perf budgets in CI, finds the commit that made a page slower, and makes federation keys and typed widget stubs.
Most of what ogygia does happens inside your build and your server, but a few jobs happen outside them: wiring ogygia into an app the first time, giving an AI agent the real compiler to check its work, failing a pull request that made a page slower, and making the key pair two federated apps sign with. @ogygia/cli is the ogygia command that does those jobs.
You run it with npx, from your app’s folder. The first command most people run wires ogygia into a SvelteKit app:
It isn’t a Vite plugin, so nothing goes in vite.config.ts for it.
npx ogygia initInstallation
You don’t install it by hand to start. npx ogygia init runs it, and init adds @ogygia/cli to your devDependencies, so every later npx ogygia command runs that local copy at a version you control.
npx ogygia initpnpm dlx ogygia initTo add it yourself, for example in a repository that already has ogygia:
pnpm add -D @ogygia/cliHow it runs
The command you type is the ogygia package’s own ogygia bin. It holds no commands. It finds @ogygia/cli and hands it every argument, in this order:
- The
@ogygia/cliinstalled in your app, looked up from thepackage.jsonin the current folder. - One installed beside the
ogygiapackage itself. - Neither:
@ogygia/cliat the same version asogygia, through the package manager that started the command (pnpm dlx,yarn dlx,bunx, ornpx -yotherwise).
The command’s exit status is the CLI’s. When the CLI couldn’t be started at all, it’s 1. Installed on its own, @ogygia/cli names its bin ogygia-cli, so pnpm exec ogygia-cli keys shell works without the ogygia package.
Commands
| Command | What it does | Page |
|---|---|---|
ogygia init | Wires ogygia into the SvelteKit app in the current folder, with markdown content if you ask. | Project setup |
ogygia site init | Scaffolds a docs site: a collection, its site(), the routes and a DocsShell layout. | Project setup |
ogygia ai | Installs the ogygia skill for AI agents and registers the MCP server in .mcp.json. | AI agents |
ogygia mcp | Runs the MCP server, which gives an agent the compiler, the profiler and the devtools as tools. | AI agents |
ogygia perf | Renders pages under the SSR profiler on a running server and judges them against a budget. | Perf budgets |
ogygia bisect | Builds and profiles commits in a binary search, and names the first one that made a page slower. | Perf budgets |
ogygia keys [name] | Makes an Ed25519 key pair for signing federation calls. | Keys and stubs |
ogygia fragments <origin> | Writes typed stubs for a peer’s widgets from its catalog, or checks a committed stub in CI. | Keys and stubs |
npx ogygia with no command, npx ogygia help or npx ogygia --help prints the usage and exits with 0. An unknown command prints it too and exits with 1. Commands has every flag and exit code in one place.
Package contents
| Page | What it covers |
|---|---|
| Commands | Every command with its flags, defaults and exit codes, as a reference. |
| Project setup | What init and site init write, file by file, running them again, and what they leave to you. |
| AI agents | The skill, the MCP server, registering it with a client, and every tool with its arguments. |
| Perf budgets | perf in CI: the snapshot, the budget file, the verdict and the PR comment. bisect and the servers it starts. |
| Keys and stubs | keys and its naming rule, fragments, the stub it writes and drift checks. |
Integrations
- @ogygia/devtools:
perf,bisectand the MCP server’sogygia_profileread its SSR profiler, so the server they measure listsdevtools({ profiler: true }).ogygia_debugreads the dock’s event stream. - @ogygia/federation:
keysmakes the pairsfederate()signs with,fragmentstypes a peer’s widget catalog, andogygia_fragmentchecks a peer’s origin. - @ogygia/content:
init --markdownadds content collections, andsite initscaffolds a docs site on its site layer. - @ogygia/flags:
ogygia_flagslists everyflag()call site with the build’s own inventory. - @ogygia/testing checks the same budgets from inside Playwright tests, while
perfchecks a list of pages with no test suite.
Messages
The CLI’s own failures print a line and exit, as each page describes. Four have a message code and a page of their own:
| Code | Where |
|---|---|
cli_transform_failed | AI agents: a tool’s component failed to compile |
cli_server_port_busy | Perf budgets: bisect found the port taken |
cli_server_exited_early | Perf budgets: the app exited first |
cli_server_not_ready | Perf budgets: the app never answered |
Moved sections
These sections of this page moved to new addresses:
- Next steps, now Package contents
- Integrations, now under its new address