import type { GuardResult, AnyGuardDefinition } from './guard.js'; /** Known AI coding harness identifiers (extensible via string for third-party adapters) */ export type HarnessId = 'claude-code' | 'cursor' | 'cline' | 'windsurf' | 'continue' | 'aider' | 'ob1' | 'generic' | (string & {}); /** Tool categories that guards can match against (harness-agnostic) */ export type ToolCategory = 'read_file' | 'write_file' | 'search_files' | 'search_content' | 'execute_command' | 'create_subagent' | 'exit_plan' | 'enter_worktree'; /** All tool categories for iteration */ export declare const TOOL_CATEGORIES: ToolCategory[]; /** Maps tool categories to harness-specific tool name patterns */ export type ToolNameMap = Record; /** Interface that all harness adapters must implement */ export interface HarnessAdapter { /** Unique identifier for this harness */ id: HarnessId; /** Human-readable display name */ displayName: string; /** Maps tool categories to harness-specific tool names */ toolNames: ToolNameMap; /** Format a GuardResult for PreToolUse hook output */ formatPreToolOutput(result: GuardResult): unknown; /** Format a GuardResult for PostToolUse hook output */ formatPostToolOutput(result: GuardResult): unknown; /** Format a GuardResult for Stop hook output */ formatStopOutput(result: GuardResult): unknown; /** Generate hooks configuration for this harness */ generateHooksConfig(guards: AnyGuardDefinition[], guardScriptPath: string): unknown; /** Install guard hooks into the project for this harness */ installGuards(cwd: string, guards: AnyGuardDefinition[], options?: HarnessInstallOptions): void; /** Detect whether this harness is active in the given directory */ detect(cwd: string): boolean; /** Hook events this harness supports (e.g. PreToolUse, PostToolUse, Stop, PreCompact) */ readonly supportedEvents: ReadonlySet; /** Whether the harness can inject additionalContext into the agent's context */ readonly supportsContextInjection: boolean; /** Return the path to this harness's hooks config file, or null if N/A */ hooksConfigPath(cwd: string): string | null; } export interface HarnessInstallOptions { /** Install into the project by default; some harnesses also support user-level hooks. */ scope?: 'project' | 'user'; /** Test override for user-level installs. Defaults to the current user's home directory. */ homeDir?: string; } /** Claude Code tool name mappings */ export declare const CLAUDE_CODE_TOOLS: ToolNameMap; /** Detection order for adapters. First match wins. Generic is always last (fallback). */ export declare const ADAPTER_PRIORITY: HarnessId[]; /** Register a harness adapter. Idempotent — overwrites if id already registered. */ export declare function registerAdapter(adapter: HarnessAdapter): void; /** Get a registered adapter by id. Returns undefined if not found. */ export declare function getAdapter(id: HarnessId): HarnessAdapter | undefined; /** List all registered adapter ids. */ export declare function listAdapters(): HarnessId[]; /** * Detect which harness is active in the given directory. * Iterates ADAPTER_PRIORITY in order; first match wins. * Falls back to generic if registered and no other adapter matches. * Adapters not in ADAPTER_PRIORITY are checked after priority list (before generic). */ export declare function detectAdapter(cwd: string): HarnessAdapter | undefined; /** Clear all registered adapters (for testing). */ export declare function clearAdapters(): void; /** * Shell preamble that resolves the `slope` binary at runtime. * Checks: project node_modules → SLOPE dev dist → global PATH → npx fallback. * Defines a `slope()` shell function so all downstream `slope` calls just work. */ export declare const SLOPE_BIN_PREAMBLE: string[]; export declare function normalizeShellScriptLineEndings(content: string): string; /** * Write or update a SLOPE-managed shell script. * - New file: writes `fullScript` as-is. * - Existing file with markers: replaces content between MANAGED START and * MANAGED END while preserving header (above START) and user content (below END). * - Existing file without markers: leaves unchanged (user fully customized). * * @param filePath Path to the shell script * @param fullScript Complete script content (used for new files) * @returns 'created' | 'updated' | 'unchanged' */ export declare function writeOrUpdateManagedScript(filePath: string, fullScript: string): 'created' | 'updated' | 'unchanged'; /** * Resolve tool categories to a matcher string for a specific harness. * If categories is undefined, returns undefined (match all tools). */ export declare function resolveToolMatcher(adapter: HarnessAdapter, categories: ToolCategory[] | undefined): string | undefined; //# sourceMappingURL=harness.d.ts.map