/** * Shape returned by `installing/deps-installer`'s * `collectResolutionPolicyViolations` and the inline accumulator on * the resolveDependencies result. Re-declared locally so the commands * layer can react without depending on the deps-installer's private * install types. * * Verifier codes (today: `MINIMUM_RELEASE_AGE_VIOLATION` and * `TRUST_DOWNGRADE`) are the contract surface for downstream UX. * Each `PolicyHandler` below filters violations by code to decide * what to do with them (prompt, persist to an exclude list, log, * abort). */ export interface PolicyViolation { name: string; version: string; code: string; reason: string; } /** * Workspace-manifest patch a per-policy handler can request. Each * field maps to a `pnpm-workspace.yaml` exclude-list array; the * install command forwards these to `updateWorkspaceManifest` so the * workspace writer dedupes and appends them in one pass. * * New policies that want auto-persistence add their field here AND * teach `updateWorkspaceManifest` how to honor it. */ export interface WorkspaceManifestPolicyUpdates { addedMinimumReleaseAgeExcludes?: string[]; } /** * Aggregated plan the install command consumes. The `handleResolutionPolicyViolations` * call fans out across every registered handler in registration order; * any handler can throw to abort. `pickManifestUpdates` merges the * per-handler patches into one bag so the workspace writer runs once. */ export interface PolicyHandlersPlan { handleResolutionPolicyViolations: (violations: readonly PolicyViolation[]) => Promise; pickManifestUpdates: (violations: readonly PolicyViolation[]) => WorkspaceManifestPolicyUpdates | undefined; } export interface PolicyHandlersOptions { minimumReleaseAge?: number; minimumReleaseAgeStrict?: boolean; /** * Pass `false` for `--no-save` installs. Handlers that would * persist to the workspace manifest refuse to enter modes where * approval is durably required (today: strict minimumReleaseAge) * so the prompt never offers an action it can't honor. */ save?: boolean; /** * Override for CI detection. Defaults to `ci-info`'s `isCI` flag. */ ci?: boolean; } /** * Composes the per-policy handlers the install command needs for the * current opts. Returns `undefined` only when no handler reports * activity — saves the install command an empty no-op call at every * checkpoint when no policies are configured. * * Today only the minimumReleaseAge handler is registered. Future * policies (trustPolicy UX, license policy, etc.) plug in by * exporting a sibling `createPolicyHandler(opts)` and getting * pushed into the `handlers` list below. */ export declare function setupPolicyHandlers(opts: PolicyHandlersOptions): PolicyHandlersPlan | undefined;