Skip to content

Ghost stack 11 — self-describing ghost manifest for CLI discovery#200

Draft
nahiyankhan wants to merge 1 commit into
ghost/10-gather-match-rationalefrom
ghost/11-cli-manifest
Draft

Ghost stack 11 — self-describing ghost manifest for CLI discovery#200
nahiyankhan wants to merge 1 commit into
ghost/10-gather-match-rationalefrom
ghost/11-cli-manifest

Conversation

@nahiyankhan

Copy link
Copy Markdown
Collaborator

Stacks on #199 (ghost/10-gather-match-rationale).

What

Adds ghost manifest --format json — a self-describing manifest of every command and flag, so a host agent can learn the CLI in one call instead of scraping --help. Mirrors the agent-discovery pattern (think OpenAPI-for-the-CLI), done at Ghost's scale.

{ "apiVersion": 1, "type": "manifest", "data": { "tool": "ghost", "commands": [...], "globalOptions": [...] } }

How

  • Extracts a shared buildCliManifest(cli, toolName) in command-discovery.ts, exported from @anarchitecture/ghost/cli. The terminal help, the docs-site manifest (scripts/dump-cli-help.mjs), and the new command now all derive from one shape — they can't drift (guarded by check:cli-manifest).
  • New commands/manifest-command.ts, registered in cli.ts.
  • Placed in the advanced group (defaultHelp: false): hidden from the default ghost --help, shown under ghost --help --all. Near-zero surface cost.
  • dump-cli-help.mjs shrinks 48 → ~7 lines by consuming the shared builder.

Housekeeping

  • Removes a dead INDEX_FILENAME constant and unused test bindings (clears pre-existing biome warnings).

Tests

  • New: manifest happy-path (shape, commands, curated metadata, global options) + non-json --format rejection (exit 2).
  • Full suite green (120 passed / 9 skipped); pnpm check clean incl. manifest drift in sync.

Changeset: minor (new command + new public export).

Add a ghost manifest --format json command that emits a self-describing
manifest of every command and flag, so a host agent can discover the CLI
in one call instead of scraping --help. Terminal help, the docs-site
manifest, and this command all derive from one shared buildCliManifest()
(exported from @anarchitecture/ghost/cli). Placed in the advanced group so
the default help stays curated.

Also removes a dead constant and unused test bindings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant