/** * JSON output formatters for add/remove/update commands * * This module provides machine-readable JSON output for external tool integration. * The formatters are placed in the features layer to enable reuse by CLI, HTTP Server, and MCP Server. */ import type { CslItem } from "../../core/csl-json/types.js"; import type { DuplicateType } from "../duplicate/types.js"; import type { FailureReason } from "../import/importer.js"; import type { AddReferencesResult } from "./add.js"; import type { DeprecateErrorType, DeprecateResult } from "./deprecate.js"; import type { RemoveResult } from "./remove.js"; import type { UpdateOperationResult } from "./update.js"; export interface AddJsonOutputItem { source: string; id: string; uuid: string; title: string; idChanged?: boolean; originalId?: string; warnings?: string[]; item?: CslItem; } export interface SkippedJsonOutputItem { source: string; reason: "duplicate"; existingId: string; duplicateType: DuplicateType; } export interface FailedJsonOutputItem { source: string; reason: FailureReason; error: string; } export interface AddJsonOutput { summary: { total: number; added: number; skipped: number; failed: number; }; added: AddJsonOutputItem[]; skipped: SkippedJsonOutputItem[]; failed: FailedJsonOutputItem[]; } export interface RemoveJsonOutput { success: boolean; id: string; uuid?: string; title?: string; item?: CslItem; error?: string; } export interface UpdateJsonOutput { success: boolean; id: string; uuid?: string; title?: string; unchanged?: boolean; changes?: string[]; idChanged?: boolean; previousId?: string; before?: CslItem; after?: CslItem; error?: string; } export interface FormatAddJsonOptions { /** Include full CSL-JSON data */ full?: boolean; /** Map from added item ID to CslItem (for --full) */ items?: Map; } /** * Format add command result as JSON output */ export declare function formatAddJsonOutput(result: AddReferencesResult, options: FormatAddJsonOptions): AddJsonOutput; export interface FormatRemoveJsonOptions { /** Include full CSL-JSON data */ full?: boolean; } /** * Format remove command result as JSON output */ export declare function formatRemoveJsonOutput(result: RemoveResult, id: string, options: FormatRemoveJsonOptions): RemoveJsonOutput; export interface FormatUpdateJsonOptions { /** Include full CSL-JSON data (before/after) */ full?: boolean; /** The item before update (for --full) */ before?: CslItem; } /** * Format update command result as JSON output */ export declare function formatUpdateJsonOutput(result: UpdateOperationResult, originalId: string, options: FormatUpdateJsonOptions): UpdateJsonOutput; export interface DeprecateSuccessorJson { id: string; uuid: string; } export interface DeprecateJsonOutput { success: boolean; id: string; uuid?: string; title?: string; /** Present when a mark was set */ supersededBy?: DeprecateSuccessorJson; reason?: string; supersededAt?: string; /** True when the mark was cleared */ cleared?: boolean; /** True when --unset ran against a reference that carried no mark */ unchanged?: boolean; item?: CslItem; error?: string; } export interface FormatDeprecateJsonOptions { /** Include full CSL-JSON data */ full?: boolean; } /** * Human-readable message for a rejected deprecate operation. * * Shared by the text and JSON formatters so the two cannot drift. */ export declare function describeDeprecateError(errorType: DeprecateErrorType, id: string, target: string | undefined): string; /** * Format deprecate command result as JSON output */ export declare function formatDeprecateJsonOutput(result: DeprecateResult, id: string, target: string | undefined, options?: FormatDeprecateJsonOptions): DeprecateJsonOutput; //# sourceMappingURL=json-output.d.ts.map