/** * The bootstrap committed to the public install-surface mirrors. * * Three harnesses install from a git repo rather than from npm — Claude Code * (plugin marketplace), Gemini CLI (`gemini extensions install `) and * Codex (`codex plugin marketplace add `) — so those repos carry a * checked-in `hooks.json` / manifest. A machine-specific shim path cannot go * into a file a teammate will clone, and an `npx` command must not go back onto * the tool-call path, so those surfaces instead reference a **bootstrap** that * ships inside the plugin tree, addressed through the harness's own path * variable (verified per harness — see `docs/distribution.md`). * * The bootstrap is deliberately **dependency-free**: the mirror repos have no * `node_modules`, so it uses `node:` builtins only. It does three things: * * 1. Read the runtime manifest this machine's `install` wrote and `require` * the wired entry. That is the steady state, and it costs one file read. * 2. On a **session-start** event with nothing wired, complete the install * once by shelling out to `npx install`. This is what keeps * `claude plugin install …` a working one-liner: the marketplace install * is the install, and the runtime it needs is materialized on first use — * never per hook invocation. * 3. Fail **open** in every other unresolved case: print what to run, emit * the harness's pass-through response, exit 0. A tool-call event never * triggers a materialize, because a `PreToolUse` hook has seconds to * answer and a harness that treats an unanswered gate as a block would * otherwise block the tool while npm ran. */ /** Which entry point the generated bootstrap loads. */ export type MirrorBootstrapKind = "hook" | "mcp"; export interface MirrorBootstrapOptions { /** Harness slug, e.g. `claude-code` — the manifest key to look up. */ harness: string; /** npm package the install command names, e.g. `@ory/claude-code`. */ packageName: string; /** CLI bin the install command runs, e.g. `ory-claude`. */ binName: string; /** Harness pass-through payload for the runtime-missing case. */ fallbackStdout?: string; /** * Event names (as they appear in the hook payload) that may trigger the * one-time materialize. Defaults to the session-start spellings the * harnesses use. */ sessionStartEvents?: readonly string[]; } /** Render the bootstrap script for one entry kind. */ export declare function renderMirrorBootstrap(kind: MirrorBootstrapKind, opts: MirrorBootstrapOptions): string;