/** * Codex plugin-bundle writer. * * Codex is extended through a local plugin marketplace: a marketplace root * (`{codexHome}/rolebox-marketplace`) carrying * `.agents/plugins/marketplace.json` plus one directory per plugin, and a * plugin directory (`{marketplaceRoot}/plugins/rolebox`) whose * `.codex-plugin/plugin.json` declares the skills directory and the MCP server * config (`.mcp.json`). This module owns that layout and the managed * registration block in the Codex `config.toml`, so `rolebox sync codex` is * idempotent and never rewrites bytes outside its own block. */ export interface CodexPluginBundleOptions { /** Codex home directory (`$CODEX_HOME` or `~/.codex`). */ codexHome: string; /** rolebox package root — the directory containing package.json. */ packageRoot: string; /** rolebox package version, written into the plugin manifest. */ version: string; /** Absolute path to the MCP server entry. Defaults to `{packageRoot}/dist/entries/codex.js`. */ serverEntry?: string; /** Runtime that launches the server entry. Defaults to `node`. */ runtimeCommand?: string; } export interface CodexPluginBundlePaths { /** Marketplace root: `{codexHome}/rolebox-marketplace`. */ marketplaceDir: string; /** Plugin directory: `{marketplaceDir}/plugins/rolebox`. */ pluginDir: string; /** `{pluginDir}/.codex-plugin/plugin.json`. */ manifestPath: string; /** `{pluginDir}/.mcp.json`. */ mcpConfigPath: string; /** `{marketplaceDir}/.agents/plugins/marketplace.json`. */ marketplaceManifestPath: string; /** `{pluginDir}/skills` — the symlink exposing `{codexHome}/skills`. */ skillsLinkPath: string; /** `{codexHome}/config.toml` — the managed registration block lives here. */ configPath: string; /** Absolute path to the MCP server entry recorded in `.mcp.json`. */ serverEntry: string; /** * Whether `serverEntry` exists on disk. A source checkout that was never * built is still a valid bundle — the CLI warns instead of failing. */ serverEntryExists: boolean; } /** * Escape a TOML basic-string value: the named short escapes (\b \t \n \f \r * \" \\) plus \uXXXX for every other control character. The marketplace root * comes from the user's home directory, so an embedded newline or tab must not * be able to produce an unparseable config.toml. */ export declare function escapeTomlString(value: string): string; /** * Normalize a symlink readback path: Windows junctions read back with a * \\?\ prefix, and a UNC junction as \\?\UNC\server\share, which must collapse * to \\server\share for a path comparison to work. */ export declare function normalizeLinkTarget(raw: string): string; /** * Walk up from a module URL to the directory containing package.json — bounded * because a missing package.json must fail loudly rather than walk to `/`. */ export declare function resolveRoleboxPackageRoot(moduleUrl: string): string; /** * Write the Codex plugin bundle (manifest, MCP config, marketplace manifest, * skills symlink) under `{codexHome}`. Idempotent: every file is rewritten * with identical bytes for identical options, and an existing correct skills * link is left untouched. */ export declare function writeCodexPluginBundle(opts: CodexPluginBundleOptions): CodexPluginBundlePaths; /** Remove the marketplace directory. `removed` is true when it existed. */ export declare function removeCodexPluginBundle(codexHome: string): { removed: boolean; }; /** * Register the rolebox marketplace + plugin in a Codex `config.toml`. * * The registration is a comment-delimited managed block: when one is already * present it is replaced in place (so a second run with the same marketplace * root is byte-identical), otherwise it is appended after a single newline * separator (a blank line when the file already ends with one). Duplicate * blocks, left behind by a hand-edit, are repaired: the first is replaced with * the fresh block and every later one is removed. No other byte of the user's * file is touched. `changed` reports whether the file's bytes actually changed. */ export declare function registerCodexPlugin(configPath: string, marketplaceDir: string): { changed: boolean; }; /** * Remove every managed rolebox block from a Codex `config.toml`. * * Exactly the blocks and the single newline separator registration introduced * are removed, so a pre-existing file is restored byte for byte whether or not * it ended with a trailing newline. Duplicate blocks are all rolebox's own, so * all of them go. A file without a managed block (or a missing file) is a * no-op; a lone start marker is refused exactly as in registration, because an * unclosed block has no reliable extent to remove. */ export declare function unregisterCodexPlugin(configPath: string): { changed: boolean; }; //# sourceMappingURL=plugin-bundle.d.ts.map