/** * BSO M9-1 — Harness detector * * Refs: * - docs/prd/PRD-BSO-M9-HARNESS-HOOKS.md §3.2 * * 目标:识别当前运行 @skillfm/local 的 harness 类型,以便 `skillfm init` * 选择正确的配置模板路径。 * * 检测顺序(命中即停): * 1. env 变量(最可靠,harness 自己设的) * 2. 父进程名(Unix `ps` 拿父 PID 的 command) * 3. cwd 邻近配置文件(.claude/settings.json、.cursor/mcp.json 等) * 4. user-level 配置目录(~/.openclaw/workspace 等) * 5. unknown * * 全部检测都 best-effort;任何 I/O 抛错都降级为 "this check missed",继续下一条。 */ export type Harness = 'claude-code' | 'openclaw' | 'cursor' | 'aider' | 'windsurf' | 'unknown'; export interface HarnessDetectResult { harness: Harness; /** 命中的检测阶段(env / parent-process / cwd-file / user-dir / none) */ source: DetectSource; /** 人类可读的命中原因(给 doctor 用) */ reason: string; } export type DetectSource = 'env' | 'parent-process' | 'cwd-ancestor' | 'cwd-file' | 'user-dir' | 'none'; export declare function getParentProcessName(): string; export interface DetectOptions { env?: NodeJS.ProcessEnv; cwd?: string; home?: string; /** 注入父进程名(测试用);不传则 shell out 到 ps */ parentProcessName?: string; } /** * 识别当前 harness。所有检测阶段命中即停。 * 未命中 → `{ harness: 'unknown', source: 'none', reason: '...' }` * * 不抛异常。任何 I/O 故障都降级为当前阶段 miss。 */ export declare function detectHarness(opts?: DetectOptions): HarnessDetectResult; /** * 便捷函数:只要 harness 字符串。 */ export declare function detectHarnessType(opts?: DetectOptions): Harness; //# sourceMappingURL=detector.d.ts.map