export interface SetupArgs { projectDir: string; global: boolean; print: boolean; uninstall: boolean; } export interface HookCommand { type: string; command: string; } export interface MatcherEntry { matcher: string; hooks: HookCommand[]; } /** * Parse standard setup CLI arguments from process.argv. */ export declare function parseSetupArgs(opts?: { supportsGlobal?: boolean; }): SetupArgs; /** * Read and parse a JSON file. Returns empty object if file doesn't exist or is invalid. */ export declare function readJsonFile(filePath: string): Record; /** * Write a JSON file, creating parent directories if needed. */ export declare function writeJsonFile(filePath: string, data: unknown): void; /** * Check if a hook command belongs to an Ory plugin. * * The command written today is `node "/bin/ory-hook-.js"`, so * the harness's own bin name no longer appears in it — matching goes through * the shared runtime predicate, which also still recognizes the version-pinned * `npx` commands earlier releases wrote so an install merge replaces them * instead of running both. */ export declare function isOryHookCommand(h: HookCommand, binName: string): boolean; /** * Build a matcher-based hook entry: `[{ matcher: "", hooks: [{ type: "command", command }] }]` */ export declare function matcherHookEntry(cmd: string): MatcherEntry[]; /** * Merge matcher-based hooks into existing settings, replacing any existing Ory entries. */ export declare function mergeMatcherHooks(existing: Record, newHooks: Record, binName: string): Record; /** * Remove all Ory matcher-based hooks from existing settings. */ export declare function removeMatcherHooks(existing: Record, binName: string): Record; /** * Build a flat hook entry: `[{ type: "command", command }]` */ export declare function flatHookEntry(cmd: string): HookCommand[]; /** * Merge flat hooks into existing config, replacing any existing Ory entries. */ export declare function mergeFlatHooks(existing: Record, newHooks: Record, binName: string): Record; /** * Remove all Ory flat hooks from existing config. */ export declare function removeFlatHooks(existing: Record, binName: string): Record; /** * Generate the mcpServers config object for the Ory MCP server. * * The command is always supplied by the caller: it is the MCP shim written when * the runtime was resolved at install time. There is deliberately no fallback * that re-resolves the package — a registration that resolves at *run* time is * the thing this design removes. */ export declare function mcpServerEntry(cmd: { command: string; args: string[]; }): Record; /** Merge the Ory MCP server into an existing settings object's `mcpServers` key. */ export declare function mergeMcpServer(existing: Record, cmd: { command: string; args: string[]; }): Record; /** * Remove the Ory MCP server from an existing settings object's `mcpServers` key. */ export declare function removeMcpServer(existing: Record): Record; /** * Register a plugin in the Claude Code plugins registry. */ export declare function registerPlugin(opts: { name: string; installPath: string; version: string; scope: "project" | "user"; projectPath?: string; }): void; /** * Unregister a plugin from the Claude Code plugins registry. */ export declare function unregisterPlugin(opts: { name: string; scope: "project" | "user"; projectPath?: string; }): void; /** * Print the standard setup help text showing supported environment variables. */ export declare function printSetupHelp(binName: string, harnessName: string, opts?: { supportsGlobal?: boolean; globalPath?: string; }): void; /** * A deferred "next steps" renderer. Receives whether the interactive wizard * actually finished wiring Ory up so it can pick the right closing message: * a short "you're all set, launch the harness" summary when everything is * already configured, or the full manual env-var setup guidance when it isn't. */ export type NextStepsRenderer = (opts: { configured: boolean; }) => void; /** Begin capturing `printNextSteps` output instead of printing it. */ export declare function beginDeferNextSteps(): void; /** * Print any captured next-steps output and stop deferring. `configured` tells * the renderer whether the install finished configuring Ory (so it can drop the * manual setup steps, which would only contradict what's already saved). */ export declare function emitDeferredNextSteps(configured?: boolean): void; /** * Either run the next-steps printer now, or capture it for later when * deferral is active. Harness-specific next-steps printers (e.g. Codex's) * route through this so they participate in the same deferral. When run inline * (e.g. the standalone setup binary) nothing configured a connection, so the * renderer is invoked with `configured: false`. */ export declare function nextStepsSink(fn: NextStepsRenderer): void; /** * Print the "Next steps" text after successful setup. Deferred to the end of * an install via {@link nextStepsSink} (see above). When the install already * connected Ory, prints a short launch summary instead of the manual env-var * setup steps. */ export declare function printNextSteps(harnessName: string, uninstallCmd: string, opts?: NextStepsOpts): void; /** * Identity a harness passes to {@link printNextSteps} so the "you're all set" * message can emit copy-pasteable `status` / `permissions` commands * and tailor itself to what the install configured (with Agent Security not * connected there is no enforcement step to describe). Optional so older * callers still get the short summary. */ export interface NextStepsOpts { /** CLI bin name, e.g. `ory-claude` — used to render follow-up commands. */ binName: string; /** Harness slug, e.g. `claude-code` — used to read the configured mode. */ harness: string; }