/**
 * Forge Types
 *
 * Types for the persistent build/test sandbox.
 */

/** Forge configuration */
export interface ForgeConfig {
  /** File patterns to watch */
  watch: string[]
  /** Command to run tests */
  testCommand: string
  /** Command to run linter */
  lintCommand?: string
  /** Command to run type checker */
  typeCheckCommand?: string
  /** Whether to use incremental testing */
  incremental: boolean
  /** Max concurrent test processes */
  maxConcurrency: number
  /** File patterns to exclude from watching */
  exclude?: string[]
}

/** Result of a Forge run */
export interface ForgeRunResult {
  /** Type of run */
  type: 'test' | 'lint' | 'typecheck'
  /** Whether it passed */
  passed: boolean
  /** Output from the command */
  output: string
  /** Duration in ms */
  duration: number
  /** Timestamp */
  timestamp: number
  /** Files that triggered this run */
  triggerFiles: string[]
  /** Error details (if failed) */
  errors: string[]
}

/** Detected project configuration */
export interface DetectedProjectConfig {
  /** Programming language */
  language: string
  /** Framework (if detected) */
  framework?: string
  /** Package manager */
  packageManager: string
  /** Test command */
  testCommand: string
  /** Lint command (if available) */
  lintCommand?: string
  /** Type check command (if available) */
  typeCheckCommand?: string
  /** Source directory patterns */
  sourcePatterns: string[]
  /** Test directory patterns */
  testPatterns: string[]
  /** File extension */
  extension: string
}

/** Forge daemon status */
export interface ForgeStatus {
  /** Whether the daemon is running */
  running: boolean
  /** Number of runs completed */
  runsCompleted: number
  /** Number of runs passed */
  runsPassed: number
  /** Number of runs failed */
  runsFailed: number
  /** Last run result */
  lastResult?: ForgeRunResult
  /** When the daemon started */
  startedAt?: number
}
