/** * Arial Server - Configuration types * * Type definitions for arial.config.ts (server) */ import type { Spec } from "../types.js"; /** * Environment configuration */ export interface EnvConfig { /** Dotenv files to load (in order, relative to config file) */ files?: string[]; } /** * Execution result passed to hooks */ export interface ExecutionResult { success: boolean; specId: string; error?: string; } /** * PR configuration defaults */ export interface PRConfig { /** Create PRs as drafts */ draft?: boolean; /** Labels to add to PRs */ labels?: string[]; /** Users to assign to PRs */ assignees?: string[]; /** Users to request review from */ reviewers?: string[]; } /** * GitHub configuration */ export interface GitHubServerConfig { /** GitHub org/username */ owner: string; /** Repository name */ repo: string; /** PR defaults */ pr?: PRConfig; } /** * Lifecycle hooks */ export interface ServerHooks { /** Called when a spec starts execution */ onStart?: (spec: Spec) => Promise; /** Called when a spec completes successfully */ onComplete?: (spec: Spec, result: ExecutionResult) => Promise; /** Called when a spec fails */ onError?: (spec: Spec, error: Error) => Promise; } /** * Repository configuration for multi-repo support */ export interface RepoConfig { /** Path to the repository on the server */ path: string; /** Base branch for creating feature branches (default: 'main') */ baseBranch?: string; /** Max concurrent agents for this repo (default: global limit) */ maxConcurrentAgents?: number; /** GitHub integration configuration for this repo */ github: GitHubServerConfig; } /** * Server configuration */ export interface ServerSettings { /** Server port (default: 7272) */ port?: number; /** Server host (default: '0.0.0.0') */ host?: string; /** Path to SQLite database (default: ~/.arial/arial.db) */ dbPath?: string; } /** * GitHub OAuth configuration for per-user authentication */ export interface GitHubOAuthConfig { /** OAuth App Client ID */ clientId: string; /** OAuth App Client Secret */ clientSecret: string; /** GitHub API base URL (for GitHub Enterprise) */ baseUrl?: string; /** Restrict access to specific organizations */ allowedOrgs?: string[]; /** Restrict access to specific teams (format: "org/team") */ allowedTeams?: string[]; } /** * JWT configuration */ export interface JwtConfig { /** Secret for signing JWTs (auto-generated if not provided) */ secret?: string; /** Access token expiry (default: '1h') */ accessTokenExpiry?: string; /** Refresh token expiry (default: '30d') */ refreshTokenExpiry?: string; } /** * Authentication configuration (GitHub OAuth) */ export interface AuthConfig { /** GitHub OAuth configuration (required) */ github: GitHubOAuthConfig; /** JWT configuration */ jwt?: JwtConfig; } /** * Global configuration */ export interface GlobalSettings { /** Max concurrent agents across all repos (default: 8) */ maxConcurrentAgents?: number; /** Max execution time (ms) per spec (default: 600000) */ timeout?: number; /** Adapter to use (default: 'claude') */ adapter?: string; } /** * Arial server configuration schema (multi-repo) */ export interface ArialServerConfig { /** Server settings */ server?: ServerSettings; /** Authentication configuration (GitHub OAuth) */ auth: AuthConfig; /** Global settings */ global?: GlobalSettings; /** Repository configurations (can be empty - repos are auto-cloned) */ repos?: Record; /** Lifecycle hooks */ hooks?: ServerHooks; /** Environment file loading configuration */ env?: EnvConfig; } /** * Resolved repository configuration */ export interface ResolvedRepoConfig { path: string; baseBranch: string; maxConcurrentAgents: number; github: { owner: string; repo: string; pr: { draft: boolean; labels: string[]; assignees: string[]; reviewers: string[]; }; }; } /** * Resolved authentication configuration (GitHub OAuth) */ export interface ResolvedAuthConfig { /** GitHub OAuth config */ github: { clientId: string; clientSecret: string; baseUrl: string; allowedOrgs: string[]; allowedTeams: string[]; }; jwt: { secret: string; accessTokenExpiry: string; refreshTokenExpiry: string; }; } /** * Resolved server configuration with all defaults applied */ export interface ResolvedServerConfig { server: { port: number; host: string; dbPath: string; }; auth: ResolvedAuthConfig; global: { maxConcurrentAgents: number; timeout: number; adapter: string; }; repos: Record; hooks: ServerHooks; env: { files: string[]; }; } /** * Configuration error */ export interface ServerConfigError { code: "CONFIG_NOT_FOUND" | "CONFIG_INVALID" | "CONFIG_LOAD_FAILED"; message: string; path?: string; cause?: unknown; } /** * Result type */ export type Result = { ok: true; value: T; } | { ok: false; error: E; }; //# sourceMappingURL=types.d.ts.map