/** * Attach CLI commands: open, add, list, get, detach, sync * * Uses ILibrary interface for unified operations across local and server modes. */ import type { IdentifierType } from "../../core/library-interface.js"; import { type AddAttachmentResult, type DetachAttachmentResult, type GetAttachmentResult, type ListAttachmentsResult, type OpenAttachmentResult, type SyncAttachmentResult } from "../../features/operations/attachments/index.js"; import { type InferredFile } from "../../features/operations/attachments/sync.js"; import { type ExecutionContext } from "../execution-context.js"; /** * Options for attach open command */ export interface AttachOpenOptions { identifier: string; filename?: string; role?: string; print?: boolean; noSync?: boolean; idType?: IdentifierType; attachmentsDirectory: string; } /** * Options for attach add command */ export interface AttachAddOptions { identifier: string; filePath: string; role: string; label?: string; move?: boolean; force?: boolean; idType?: IdentifierType; attachmentsDirectory: string; } /** * Options for attach list command */ export interface AttachListOptions { identifier: string; role?: string; idType?: IdentifierType; attachmentsDirectory: string; } /** * Options for attach get command */ export interface AttachGetOptions { identifier: string; filename?: string; role?: string; stdout?: boolean; idType?: IdentifierType; attachmentsDirectory: string; } /** * Options for attach detach command */ export interface AttachDetachOptions { identifier: string; filename?: string; role?: string; all?: boolean; removeFiles?: boolean; idType?: IdentifierType; attachmentsDirectory: string; } /** * Options for attach sync command */ export interface AttachSyncOptions { identifier: string; yes?: boolean; fix?: boolean; idType?: IdentifierType; attachmentsDirectory: string; roleOverrides?: Record; /** Skip file renaming (used in Step 6) */ noRename?: boolean; /** Rename files on disk (key: current filename, value: new filename) */ renames?: Record; } export type { AddAttachmentResult, DetachAttachmentResult, GetAttachmentResult, ListAttachmentsResult, OpenAttachmentResult, SyncAttachmentResult, }; /** * Execute attach open command */ export declare function executeAttachOpen(options: AttachOpenOptions, context: ExecutionContext): Promise; /** * Execute attach add command */ export declare function executeAttachAdd(options: AttachAddOptions, context: ExecutionContext): Promise; /** * Execute attach list command */ export declare function executeAttachList(options: AttachListOptions, context: ExecutionContext): Promise; /** * Execute attach get command */ export declare function executeAttachGet(options: AttachGetOptions, context: ExecutionContext): Promise; /** * Execute attach detach command */ export declare function executeAttachDetach(options: AttachDetachOptions, context: ExecutionContext): Promise; /** * Execute attach sync command */ export declare function executeAttachSync(options: AttachSyncOptions, context: ExecutionContext): Promise; /** * Format attach open output */ export declare function formatAttachOpenOutput(result: OpenAttachmentResult): string; /** * Format attach add output */ export declare function formatAttachAddOutput(result: AddAttachmentResult): string; /** * Format attach list output */ export declare function formatAttachListOutput(result: ListAttachmentsResult, identifier: string): string; /** * Format attach get output */ export declare function formatAttachGetOutput(result: GetAttachmentResult): string; /** * Format attach detach output */ export declare function formatAttachDetachOutput(result: DetachAttachmentResult): string; /** * Build role overrides from context-based suggestions for files inferred as "other". * Pure function: uses suggestRoleFromContext to suggest roles. */ export declare function buildRoleOverridesFromSuggestions(newFiles: InferredFile[]): Record; /** * Generate a rename map for files whose names don't match the naming convention * after role override. Key: current filename, Value: new filename. */ export declare function generateRenameMap(newFiles: InferredFile[], overrides: Record): Record; /** * Format sync preview with role suggestions and rename previews for non-TTY output. */ export declare function formatSyncPreviewWithSuggestions(result: SyncAttachmentResult, suggestions: Record, renames: Record, identifier: string): string; /** * Format attach sync output */ export declare function formatAttachSyncOutput(result: SyncAttachmentResult): string; /** * Get exit code for attach command result */ export declare function getAttachExitCode(result: OpenAttachmentResult | AddAttachmentResult | ListAttachmentsResult | GetAttachmentResult | DetachAttachmentResult | SyncAttachmentResult): number; /** * Options for attach open action */ export interface AttachOpenActionOptions { print?: boolean; role?: string; sync?: boolean; uuid?: boolean; } /** * Sync new files with interactive role assignment prompt. * Shared logic for both `attach open` and `attach sync` interactive flows. * * Flow: dry-run → prompt for unknown roles → show preview → confirm → apply */ export declare function syncNewFilesWithRolePrompt(identifier: string, attachmentsDirectory: string, idType: "uuid" | undefined, context: ExecutionContext): Promise; /** * Run interactive mode: show convention, wait for Enter, sync with role prompt */ export declare function runInteractiveMode(identifier: string, dirPath: string, attachmentsDirectory: string, idType: "uuid" | undefined, context: ExecutionContext): Promise; /** * Handle 'attach open' command action. */ export declare function handleAttachOpenAction(identifierArg: string | undefined, filenameArg: string | undefined, options: AttachOpenActionOptions, globalOpts: Record): Promise; /** * Options for attach add action */ export interface AttachAddActionOptions { role: string; label?: string; move?: boolean; force?: boolean; uuid?: boolean; } /** * Handle 'attach add' command action. */ export declare function handleAttachAddAction(identifierArg: string | undefined, filePathArg: string, options: AttachAddActionOptions, globalOpts: Record): Promise; /** * Options for attach list action */ export interface AttachListActionOptions { role?: string; uuid?: boolean; } /** * Handle 'attach list' command action. */ export declare function handleAttachListAction(identifierArg: string | undefined, options: AttachListActionOptions, globalOpts: Record): Promise; /** * Options for attach get action */ export interface AttachGetActionOptions { role?: string; stdout?: boolean; uuid?: boolean; } /** * Handle 'attach get' command action. */ export declare function handleAttachGetAction(identifierArg: string | undefined, filenameArg: string | undefined, options: AttachGetActionOptions, globalOpts: Record): Promise; /** * Options for attach detach action */ export interface AttachDetachActionOptions { role?: string; all?: boolean; removeFiles?: boolean; uuid?: boolean; } /** * Handle 'attach detach' command action. */ export declare function handleAttachDetachAction(identifierArg: string | undefined, filenameArg: string | undefined, options: AttachDetachActionOptions, globalOpts: Record): Promise; /** * Options for attach sync action */ export interface AttachSyncActionOptions { yes?: boolean; fix?: boolean; uuid?: boolean; /** Skip file renaming (used in Step 6) — set by Commander.js --no-rename as rename: false */ noRename?: boolean; /** Commander.js sets this to false when --no-rename is passed */ rename?: boolean; } /** * Handle 'attach sync' command action. */ export declare function handleAttachSyncAction(identifierArg: string | undefined, options: AttachSyncActionOptions, globalOpts: Record): Promise; //# sourceMappingURL=attach.d.ts.map