Skip to content

@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.

On this page

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 init

Installation

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 init
pnpm dlx ogygia init

To add it yourself, for example in a repository that already has ogygia:

pnpm add -D @ogygia/cli

How 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:

  1. The @ogygia/cli installed in your app, looked up from the package.json in the current folder.
  2. One installed beside the ogygia package itself.
  3. Neither: @ogygia/cli at the same version as ogygia, through the package manager that started the command (pnpm dlx, yarn dlx, bunx, or npx -y otherwise).

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

CommandWhat it doesPage
ogygia initWires ogygia into the SvelteKit app in the current folder, with markdown content if you ask.Project setup
ogygia site initScaffolds a docs site: a collection, its site(), the routes and a DocsShell layout.Project setup
ogygia aiInstalls the ogygia skill for AI agents and registers the MCP server in .mcp.json.AI agents
ogygia mcpRuns the MCP server, which gives an agent the compiler, the profiler and the devtools as tools.AI agents
ogygia perfRenders pages under the SSR profiler on a running server and judges them against a budget.Perf budgets
ogygia bisectBuilds 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

PageWhat it covers
CommandsEvery command with its flags, defaults and exit codes, as a reference.
Project setupWhat init and site init write, file by file, running them again, and what they leave to you.
AI agentsThe skill, the MCP server, registering it with a client, and every tool with its arguments.
Perf budgetsperf in CI: the snapshot, the budget file, the verdict and the PR comment. bisect and the servers it starts.
Keys and stubskeys and its naming rule, fragments, the stub it writes and drift checks.

Integrations

  • @ogygia/devtools: perf, bisect and the MCP server’s ogygia_profile read its SSR profiler, so the server they measure lists devtools({ profiler: true }). ogygia_debug reads the dock’s event stream.
  • @ogygia/federation: keys makes the pairs federate() signs with, fragments types a peer’s widget catalog, and ogygia_fragment checks a peer’s origin.
  • @ogygia/content: init --markdown adds content collections, and site init scaffolds a docs site on its site layer.
  • @ogygia/flags: ogygia_flags lists every flag() call site with the build’s own inventory.
  • @ogygia/testing checks the same budgets from inside Playwright tests, while perf checks 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:

CodeWhere
cli_transform_failedAI agents: a tool’s component failed to compile
cli_server_port_busyPerf budgets: bisect found the port taken
cli_server_exited_earlyPerf budgets: the app exited first
cli_server_not_readyPerf budgets: the app never answered

Moved sections

These sections of this page moved to new addresses: