/** * decorate-tool-primary — the host-owned decorator the mount layer applies to * EVERY tool's PRIMARY command (the flat, no-`parent` spec whose name matches * `tool.metadata.name`: `fit`, `graph`, `sim`, and any third-party tool's run * verb). * * The decorator is the single place the host GUARANTEES a uniform primary-command * surface, so a tool need not opt in per spec: * * 1. `--version` — prints the TOOL's own version (` `, plus a * `(tool contract v)` marker when the Tool declares `contractVersion`). * This is distinct from `opensip --version` (the CLI version, owned at the * composition root). Implemented via Commander's `.version()` on the primary * command — the root no longer registers a Commander version option (it is * handled by a host argv pre-scan), so the subcommand-local `--version` no * longer collides with an inherited global one. * 2. The baseline common flags `--cwd` / `--json` / `--config` are present on * every primary regardless of what the tool declared in `commonFlags`. * 3. `--quiet` / `--verbose` are present on every primary. * * The decorator is IDEMPOTENT: a flag the tool already declared (via its * `commonFlags` or a hand-rolled `OptionSpec` — e.g. fit already ships `--config`, * and all three primaries already opt into `--cwd`/`--json`/`--quiet`/`--verbose`) * is left untouched, so Commander never sees a duplicate-option registration. The * decorator only ADDS what is missing (in practice `--config` for graph/sim). * * This lives in the mount path (called from `mountOneTool`) rather than being * re-declared per tool — there is no per-tool special case here; the same * decoration runs for bundled and discovered tools alike. */ import { type CliProgram } from '@opensip-cli/contracts'; import { type Tool } from '@opensip-cli/core'; /** * Build the tool's `--version` payload: ` `, with a * `(tool contract v)` suffix only when the Tool declares `contractVersion` * (none of the bundled tools do today — they version their tool-specific surface * via `extensionPoints` — so the suffix is reserved for tools that opt in). */ export declare function toolVersionString(tool: Tool): string; /** * Decorate a tool's PRIMARY command with the host-guaranteed uniform surface * (see the module header). Idempotent w.r.t. flags the tool already declared. * * @param primaryCmd The mounted Commander command for the tool's primary spec * (the flat spec whose name === `tool.metadata.name`). * @param tool The tool being mounted — read for `metadata.version` / * `metadata.name` / `contractVersion`. */ export declare function decorateToolPrimary(primaryCmd: CliProgram, tool: Tool): void; //# sourceMappingURL=decorate-tool-primary.d.ts.map