import { type OptionSpec, type ArgSpec, type PrimaryCommandSpecDraft, type ToolCliContext, type ToolRunCompletion, type ToolSessionContribution } from '@opensip-cli/core'; import { type RunHostGateDispatchInput } from './gate-dispatch.js'; import type { SignalEnvelope } from './signal-envelope.js'; /** Common host-owned flags accepted by first-party analysis run commands. */ export interface AnalysisRunCommandOptions { readonly cwd: string; readonly json?: boolean; readonly reportTo?: string; readonly apiKey?: string; readonly open?: boolean; readonly sarif?: string; readonly filter?: readonly string[]; readonly top?: string; readonly raw?: boolean; readonly gateSave?: boolean; readonly gateCompare?: boolean; } /** Inputs used to render human-readable presentation for a completed analysis run. */ export interface AnalysisRunPresentationInput { readonly options: TOptions; readonly request: TRequest; readonly result: TResult; readonly envelope: SignalEnvelope; readonly durationMs: number; } /** Context passed to lifecycle hooks after an analysis envelope has been produced. */ export interface AnalysisRunHookInput { readonly cli: ToolCliContext; readonly options: TOptions; readonly request: TRequest; readonly result?: TResult; readonly envelope: SignalEnvelope; } /** Context passed to live-run hooks when the live renderer returns an envelope. */ export interface AnalysisRunLiveHookInput { readonly cli: ToolCliContext; readonly options: TOptions; readonly request: TRequest; readonly completion: ToolRunCompletion; readonly envelope: SignalEnvelope; } /** Adapter that lets a tool route TTY rendering through the host-owned live view seam. */ export interface AnalysisRunLiveAdapter { readonly key: string; readonly setUp?: (cli: ToolCliContext) => void; readonly shouldUse: (input: { readonly options: TOptions; readonly request: TRequest; readonly cli: ToolCliContext; }) => boolean; readonly args: (input: { readonly options: TOptions; readonly request: TRequest; }) => unknown; readonly session?: (input: AnalysisRunLiveHookInput) => ToolSessionContribution | undefined; } /** Adapter that lets a tool opt into the host-owned baseline gate dispatch path. */ export interface AnalysisRunGateAdapter { readonly tool: string; readonly mode: (input: { readonly options: TOptions; readonly request: TRequest; }) => 'save' | 'compare' | undefined; readonly renderSaveLines: RunHostGateDispatchInput['renderSaveLines']; readonly renderCompareLines: RunHostGateDispatchInput['renderCompareLines']; readonly saveRunFailed?: RunHostGateDispatchInput['saveRunFailed']; readonly compareRunFailed?: RunHostGateDispatchInput['compareRunFailed']; } /** * Complete definition for one host-owned analysis run command. * * Hook matrix: * - static human render: `beforeOutput` → render/presentation → * host delivery/report-open → `afterDelivery` → optional SARIF write. * - static JSON: `beforeOutput` → host delivery/report-open → * `afterDelivery` → JSON/raw emission → optional SARIF write, so the emitted * `CommandOutcome.exitCode` observes the host-owned delivery verdict. * - gate save/compare: host gate dispatch (including delivery/SARIF/gate render) * → `afterDelivery`; `beforeOutput` is skipped because gate mode has no * normal presentation/JSON emission branch. * - live: host live renderer → host delivery/report-open → `afterDelivery` → * optional SARIF write when the live completion carries an envelope. */ export interface AnalysisRunCommandInput { readonly description: string; readonly options?: readonly OptionSpec[]; readonly args?: readonly ArgSpec[]; readonly normalize: (options: TOptions, cli: ToolCliContext) => TRequest | Promise; readonly execute: (request: TRequest, cli: ToolCliContext, options: TOptions) => TResult | Promise; readonly envelope: (result: TResult, request: TRequest, options: TOptions) => SignalEnvelope; readonly session?: (result: TResult, request: TRequest, options: TOptions) => ToolSessionContribution | undefined; readonly presentation?: (input: AnalysisRunPresentationInput) => unknown; readonly live?: AnalysisRunLiveAdapter; readonly gate?: AnalysisRunGateAdapter; readonly beforeOutput?: (input: AnalysisRunHookInput) => void | Promise; readonly afterDelivery?: (input: AnalysisRunHookInput) => void | Promise; } /** * Fixed static-handler descriptor for every analysis-run primary mount. * * The mounted wrapper is the contracts-owned {@link runAnalysisCommand} * dispatch, not a tool-specific analyzer. Callers must not override this — * tool-specific entry points declare their own descriptors on direct * `definePrimaryRunCommand` / worker specs instead. */ export declare const ANALYSIS_RUN_COMMAND_STATIC_HANDLER: { readonly package: string; readonly path: string; readonly declaration: string; }; /** Build a primary run command whose lifecycle, delivery, gates, SARIF, and session return are host owned. */ export declare function defineAnalysisRunCommand(input: AnalysisRunCommandInput): PrimaryCommandSpecDraft; //# sourceMappingURL=analysis-run-command.d.ts.map