UNPKG

organ-ai-zer

Version:

AI-powered file organizer CLI tool

375 lines 10.2 kB
import { z, ZodSchema } from 'zod'; export interface FileInfo { path: string; name: string; extension: string; size: number; modified: Date; type: 'file' | 'directory'; } export interface OrganizationSuggestion { file: FileInfo; suggestedPath: string; reason: string; confidence: number; category?: string; metadata?: any; } export interface OrganizeOptions { dryRun?: boolean; recursive?: boolean; config?: string; noCache?: boolean; } export interface PreviewOptions { recursive?: boolean; config?: string; noCache?: boolean; } /** * Generic conversation message types */ export type MessageRole = 'user' | 'assistant' | 'system'; export interface ConversationMessage { role: MessageRole; content: string; } /** * Configuration for conversation behavior */ export interface ConversationConfig { /** Maximum number of turns before timeout */ maxTurns: number; /** System prompt template */ systemPrompt?: string; /** Custom prompt parameters */ promptParams?: Record<string, any>; /** Whether to maintain full message history */ keepFullHistory: boolean; /** Maximum context window size */ maxContextSize?: number; /** Temperature for AI responses */ temperature?: number; /** Custom AI provider settings */ aiSettings?: Record<string, any>; } /** * Result from an AI conversation turn */ export interface ConversationResult<T = any> { /** AI response content */ response: string; /** Parsed structured data (if applicable) */ data?: T; /** Whether the conversation needs user input */ needsInput: boolean; /** Specific questions or prompts for user */ questions?: string[]; /** Confidence level of the response */ confidence?: number; /** Metadata about the response */ metadata?: Record<string, any>; } /** * Clarification phases where AI can ask questions */ export declare enum ClarificationPhase { INITIAL_ANALYSIS = "analysis", SUGGESTIONS = "suggestions", REFINEMENT = "refinement" } /** * Structured clarification data */ export interface Clarification { id: string; phase: ClarificationPhase; question: string; answer: string; context: string; timestamp: Date; } /** * Result from file organization conversation */ export interface OrganizationConversationResult extends ConversationResult<OrganizationSuggestion[]> { /** Organization suggestions */ suggestions: OrganizationSuggestion[]; /** AI-discovered categories */ discoveredCategories?: Record<string, string[]>; /** Whether clarification is needed */ needsClarification?: { questions: string[]; reason: string; }; } /** * User feedback on organization suggestions */ export interface OrganizationFeedback { approved: boolean; feedback?: string; specificIssues?: string[]; selectedSuggestions?: OrganizationSuggestion[]; } export interface AIAnalysisRequest { prompt: string; schema?: ZodSchema; } export interface AIAnalysisResponse { suggestions: Array<{ file: FileInfo | null; suggestedPath: string; reason: string; confidence: number; category?: string; metadata?: any; }>; discoveredCategories?: Record<string, FileInfo[]>; reasoning: string; clarificationNeeded?: { questions: string[]; reason: string; }; detectedProjects?: DetectedProject[]; } export interface CategoryConversationResponse { question: string; inputType: 'choice' | 'freeform'; choices?: string[]; reasoning: string; } export interface DetectedProject { name: string; files: FileInfo[]; type: string; rootPath: string; indicators: string[]; } export declare const AIAnalysisResponseSchema: z.ZodObject<{ discoveredCategories: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{ path: z.ZodString; name: z.ZodString; extension: z.ZodString; size: z.ZodNumber; modified: z.ZodString; type: z.ZodEnum<["file", "directory"]>; }, "strip", z.ZodTypeAny, { type: "file" | "directory"; path: string; name: string; extension: string; size: number; modified: string; }, { type: "file" | "directory"; path: string; name: string; extension: string; size: number; modified: string; }>, "many">>>; reasoning: z.ZodString; clarificationNeeded: z.ZodNullable<z.ZodObject<{ questions: z.ZodArray<z.ZodString, "many">; reason: z.ZodString; }, "strip", z.ZodTypeAny, { questions: string[]; reason: string; }, { questions: string[]; reason: string; }>>; }, "strip", z.ZodTypeAny, { discoveredCategories: Record<string, { type: "file" | "directory"; path: string; name: string; extension: string; size: number; modified: string; }[]> | null; reasoning: string; clarificationNeeded: { questions: string[]; reason: string; } | null; }, { discoveredCategories: Record<string, { type: "file" | "directory"; path: string; name: string; extension: string; size: number; modified: string; }[]> | null; reasoning: string; clarificationNeeded: { questions: string[]; reason: string; } | null; }>; export declare const AISuggestionsResponseSchema: z.ZodObject<{ suggestions: z.ZodArray<z.ZodObject<{ file: z.ZodNullable<z.ZodString>; suggestedPath: z.ZodString; reason: z.ZodString; confidence: z.ZodNumber; category: z.ZodNullable<z.ZodString>; metadata: z.ZodNullable<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>; }, "strip", z.ZodTypeAny, { category: string | null; file: string | null; reason: string; suggestedPath: string; confidence: number; metadata: {} | null; }, { category: string | null; file: string | null; reason: string; suggestedPath: string; confidence: number; metadata: {} | null; }>, "many">; discoveredCategories: z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{ path: z.ZodString; name: z.ZodString; extension: z.ZodString; size: z.ZodNumber; modified: z.ZodString; type: z.ZodEnum<["file", "directory"]>; }, "strip", z.ZodTypeAny, { type: "file" | "directory"; path: string; name: string; extension: string; size: number; modified: string; }, { type: "file" | "directory"; path: string; name: string; extension: string; size: number; modified: string; }>, "many">>>; reasoning: z.ZodString; clarificationNeeded: z.ZodNullable<z.ZodObject<{ questions: z.ZodArray<z.ZodString, "many">; reason: z.ZodString; }, "strip", z.ZodTypeAny, { questions: string[]; reason: string; }, { questions: string[]; reason: string; }>>; }, "strip", z.ZodTypeAny, { suggestions: { category: string | null; file: string | null; reason: string; suggestedPath: string; confidence: number; metadata: {} | null; }[]; discoveredCategories: Record<string, { type: "file" | "directory"; path: string; name: string; extension: string; size: number; modified: string; }[]> | null; reasoning: string; clarificationNeeded: { questions: string[]; reason: string; } | null; }, { suggestions: { category: string | null; file: string | null; reason: string; suggestedPath: string; confidence: number; metadata: {} | null; }[]; discoveredCategories: Record<string, { type: "file" | "directory"; path: string; name: string; extension: string; size: number; modified: string; }[]> | null; reasoning: string; clarificationNeeded: { questions: string[]; reason: string; } | null; }>; export declare const FinalSuggestionsSchema: z.ZodObject<{ suggestions: z.ZodArray<z.ZodObject<{ file: z.ZodNullable<z.ZodString>; suggestedPath: z.ZodString; reason: z.ZodString; confidence: z.ZodNumber; category: z.ZodNullable<z.ZodString>; metadata: z.ZodNullable<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>; }, "strip", z.ZodTypeAny, { category: string | null; file: string | null; reason: string; suggestedPath: string; confidence: number; metadata: {} | null; }, { category: string | null; file: string | null; reason: string; suggestedPath: string; confidence: number; metadata: {} | null; }>, "many">; reasoning: z.ZodString; }, "strip", z.ZodTypeAny, { suggestions: { category: string | null; file: string | null; reason: string; suggestedPath: string; confidence: number; metadata: {} | null; }[]; reasoning: string; }, { suggestions: { category: string | null; file: string | null; reason: string; suggestedPath: string; confidence: number; metadata: {} | null; }[]; reasoning: string; }>; export declare const CategoryConversationSchema: z.ZodObject<{ question: z.ZodString; inputType: z.ZodEnum<["choice", "freeform"]>; choices: z.ZodNullable<z.ZodArray<z.ZodString, "many">>; reasoning: z.ZodString; }, "strip", z.ZodTypeAny, { reasoning: string; question: string; inputType: "choice" | "freeform"; choices: string[] | null; }, { reasoning: string; question: string; inputType: "choice" | "freeform"; choices: string[] | null; }>; export * from './config'; //# sourceMappingURL=index.d.ts.map