/** * WorkForge v3.0 - TypeScript Type Definitions * * This file contains all TypeScript type definitions used throughout the application. * Following DRY principles - all types centralized here with no duplicates. */ /** * Workspace configuration for create command */ export type WorkspaceConfig = { type: string; name: string; base?: string; yes: boolean; ticketId?: string; }; /** * Outcome of primary-branch auto-detection */ export type PrimaryBranchDetection = { branch: string; source: string; }; /** * Where a new branch should fork from */ export type BranchStartPoint = { base: string; startPoint: string | null; source: 'remote' | 'local' | 'committish' | 'missing'; isStale: boolean; }; /** * Path configuration for worktree */ export type PathConfig = { repoRoot: string; workspaceParent: string; workspacePath: string; branchName: string; }; /** * Command options for close */ export type CloseOptions = { path?: string; name?: string; force: boolean; deleteBranch: boolean; skipSync: boolean; yes: boolean; dryRun: boolean; }; /** * Command options for sync-env */ export type SyncEnvOptions = { from?: string; to?: string; between?: string; yes: boolean; dryRun: boolean; }; /** * Command options for list */ export type ListOptions = { all: boolean; json: boolean; simple: boolean; sortBy?: 'name' | 'path' | 'age'; }; /** * Command options for cleanup */ export type CleanupOptions = { olderThan?: number; dryRun: boolean; yes: boolean; }; /** * Information about a worktree */ export type WorktreeInfo = { path: string; branchName: string; isMainRepo: boolean; commitHash: string; commitTimestamp?: number; remoteUrl?: string; isLocked: boolean; isPrunable: boolean; }; /** * Safety check results before closing worktree */ export type SafetyCheckResult = { canClose: boolean; warnings: string[]; hasUncommittedChanges: boolean; uncommittedFiles?: string[]; hasUnpushedCommits: boolean; commitsAhead?: number; commitsBehind?: number; isMerged: boolean; mergedInto?: string[]; hasRemoteBranch: boolean; remoteName?: string; isDetachedHead: boolean; isMergeInProgress: boolean; isRebaseInProgress: boolean; }; /** * Project metadata */ export type ProjectMetadata = { projectId: string; remoteUrl: string; repoPath: string; repoName: string; createdAt: string; lastAccessed: string; }; /** * Parsed environment variable */ export type EnvVariable = { key: string; value: string; lineNumber?: number; comment?: string; hasQuotes?: boolean; quoteType?: 'single' | 'double'; raw?: string; leadingTrivia?: string[]; }; /** * A parsed .env file, including the trivia that follows the last variable */ export type ParsedEnvFile = { variables: Map; trailingTrivia: string[]; }; /** * Modified environment variable */ export type EnvModification = { key: string; oldValue: string; newValue: string; oldLineNumber?: number; newLineNumber?: number; oldComment?: string; newComment?: string; oldHasQuotes?: boolean; newHasQuotes?: boolean; oldQuoteType?: 'single' | 'double'; newQuoteType?: 'single' | 'double'; }; /** * Environment file diff result */ export type EnvDiff = { added: EnvVariable[]; removed: EnvVariable[]; modified: EnvModification[]; unchanged: EnvVariable[]; targets?: SyncTargets; }; /** * User's sync decision */ export type SyncDecision = { addedKeys: Set; modifiedKeys: Set; removedKeys: Set; syncAll: boolean; cancel?: boolean; }; /** * Sync operation result */ export type SyncResult = { success: boolean; backupPath?: string; backupCreated: boolean; addedCount: number; modifiedCount: number; removedCount: number; addedKeys?: string[]; modifiedKeys?: string[]; removedKeys?: string[]; errors: string[]; error?: string; }; /** * Source and target for sync operation */ export type SyncTargets = { sourcePath: string; targetPath: string; sourceLabel: string; targetLabel: string; source?: { path: string; envPath: string; type: 'main-repo' | 'worktree'; branchName?: string; }; target?: { path: string; envPath: string; type: 'main-repo' | 'worktree'; branchName?: string; }; }; /** * Backup information */ export type BackupInfo = { fileName: string; filePath: string; size: number; createdAt: Date; timestamp: Date; ageInDays: number; }; /** * Audit log operation record */ export type AuditOperation = { id?: string; timestamp: string; operation: 'create' | 'close' | 'sync'; source: string; target: string; user?: string; changesApplied: { added: number; modified: number; removed: number; }; variableDetails?: { added: string[]; modified: string[]; removed: string[]; }; success: boolean; backupCreated: boolean; backup?: { path: string; size: number; }; status?: 'success' | 'failure' | 'partial'; error?: string; }; /** * Global configuration */ export type Config = { version: string; preferences: { defaultBaseBranch: string; autoDetectBaseBranch: boolean; autoDeleteBranch: boolean; skipConfirmations: boolean; packageManager: 'auto' | 'npm' | 'pnpm' | 'yarn'; showExistingWorktrees: boolean; }; backup: { enabled: boolean; maxBackupsPerProject: number; autoCleanup: boolean; }; sync: { createBackupBeforeSync: boolean; defaultSyncDirection: 'ask' | 'to-main' | 'to-worktree'; }; audit: { enabled: boolean; includeVariableValues: boolean; retentionDays: number; }; display: { colorEnabled: boolean; verboseOutput: boolean; showProgressIndicators: boolean; }; }; /** * Generic config value type for dynamic access */ export type ConfigValue = string | number | boolean | ConfigObject | ConfigArray; export type ConfigObject = { [key: string]: ConfigValue; }; export type ConfigArray = ConfigValue[]; /** * Generic config path - allows any nested path */ export type ConfigPath = string; /** * Package manager detection result */ export type PackageManagerInfo = { manager: 'npm' | 'pnpm' | 'yarn'; command: string; args: string[]; lockFile: string; }; /** * Standard operation result (consolidated from 6 duplicate patterns) * Replaces all inline { success, message } and { success, message, warnings } types */ export type OperationResult = { success: boolean; message: string; warnings?: string[]; }; /** * Validation result (consolidated from 2 patterns) * Replaces all inline { valid, error } types */ export type ValidationResult = { valid: boolean; errors?: string[]; }; /** * Resolved path information for sync operations */ export type ResolvedPath = { label: string; envPath: string; repoPath: string; }; /** * Worktree removal strategy */ export type RemovalStrategy = { strategy: 'remove' | 'prune' | 'force-remove'; reason: string; }; /** * Environment diff summary */ export type DiffSummary = { addedCount: number; removedCount: number; modifiedCount: number; unchangedCount: number; totalChanges: number; hasChanges: boolean; }; /** * Dry run result for sync preview */ export type DryRunResult = { wouldAdd: string[]; wouldModify: string[]; wouldRemove: string[]; }; /** * Audit statistics */ export type AuditStatistics = { totalOperations: number; successfulOperations: number; failedOperations: number; totalAdded: number; totalModified: number; totalRemoved: number; lastOperation: Date | null; }; /** * Branch deletion recommendation */ export type BranchDeletionRecommendation = { shouldDelete: boolean; requiresForce: boolean; message: string; }; /** * Related branches information */ export type RelatedBranches = { local: boolean; remote: string[]; }; /** * Parsed value from .env file (internal parsing type) */ export type ParsedValue = { value: string; hasQuotes: boolean; quoteType?: 'single' | 'double'; comment?: string; }; /** * Multiline start detection result (internal parsing type) */ export type MultilineStart = { key: string; } | null; /** * Package.json structure */ export type PackageJson = { name: string; version: string; [key: string]: ConfigValue; }; /** * Normalized error structure for safe error handling * Use with toError() utility to safely handle any thrown value */ export type ErrorLike = { message: string; stack?: string; name?: string; }; //# sourceMappingURL=index.d.ts.map