/** * BSO M9-2 — per-harness 配置模板 * * Refs: docs/prd/PRD-BSO-M9-HARNESS-HOOKS.md §3.3 * * 定义每个 harness 的: * - LLM 层目标文件路径(写 priming block 到哪) * - harness 层配置文件路径(写 hooks / MCP server 注册到哪) * - harness 层配置片段(JSON / YAML 结构) * * 写入器在 writers.ts;本文件只声明结构 + 内容模板,无副作用。 * * 完整度: * - claude-code:完整(LLM + hooks + MCP) * - aider:commands_pre/post 可用,配置片段完整 * - openclaw / cursor / windsurf:stub — 只写 LLM 层 + MCP server 注册,PreToolUse hook * 能力 M9-6 调研后再补(PRD §7.2 风险项) */ import type { Harness } from './detector.js'; export interface HarnessPaths { /** LLM priming block 写到这 */ primingFile: string; /** harness 配置(settings.json / mcp.json / aider.conf.yml 等)*/ harnessConfigFile: string | null; /** harness 配置格式 */ harnessConfigFormat: 'json' | 'yaml' | 'none'; /** 用户 workspace 根目录(给 doctor 显示用) */ workspaceRoot: string; } export declare function pathsFor(harness: Harness, cwd: string, home?: string): HarnessPaths; /** * Claude Code .claude/settings.json 合并片段。 * * 参考 Anthropic Claude Code hooks 官方文档: * - hooks.SessionStart / PreToolUse / PostToolUse 三个生命周期钩子 * - matcher 用 "Write|Edit|Bash" 正则筛选破坏性 tool * - 钩子 command 通过 stdin 拿到 JSON payload(含 session_id / tool_name) * * 设计关键:本片段是 "additive merge"(见 writers.mergeClaudeSettings), * 已有 hooks 数组会被保留,我们只 append 我们的 hooks。不覆盖。 */ export interface ClaudeSettingsPatch { hooks: { SessionStart?: Array<{ hooks: Array<{ type: 'command'; command: string; }>; }>; PreToolUse?: Array<{ matcher: string; hooks: Array<{ type: 'command'; command: string; }>; }>; PostToolUse?: Array<{ matcher: string; hooks: Array<{ type: 'command'; command: string; }>; }>; /** * V2 SAFE — UserPromptSubmit hook (PRD §2.4). * Fires on every user prompt; skillfm-guard prompt-context scans for * SkillFM trigger keywords and emits L4 Agent Voice hint to stdout * (Claude Code prepends stdout as additional system context before LLM). */ UserPromptSubmit?: Array<{ hooks: Array<{ type: 'command'; command: string; }>; }>; }; /** MCP server 注册(Claude Code 新版 settings.json 支持) */ mcpServers?: Record; } /** 标识 hook 来自 SkillFM — writer 用它做 idempotent merge(已存在则跳过) */ export declare const SKILLFM_GUARD_COMMAND = "skillfm-guard"; export declare function claudeSettingsPatch(): ClaudeSettingsPatch; export interface AiderConfigPatch { commands_pre: string[]; commands_post: string[]; } export declare function aiderConfigPatch(): AiderConfigPatch; /** * 让 harness 把 @skillfm/local sidecar 当 MCP server 注册。 * * 本模板用 stdio MCP(OpenClaw 原生只支持 stdio,Claude Code/Cursor 也支持)。 * 本模板用 Beacon V2 stdio MCP。旧 `skillfm-mcp-stdio` bin 仍保留为兼容别名, * 但新写入配置必须指向 `skillfm-local mcp`,避免 agent 看到历史 money-skill * MCP surface。 */ export interface McpServerConfig { command: string; args: string[]; env?: Record; } export declare function skillfmMcpServerConfig(): McpServerConfig; /** 各 harness 的 MCP server 字段名(schema 差异) */ export declare const MCP_SERVER_FIELD_NAME: Record; export interface HarnessCapabilities { /** 是否能写 LLM priming block(几乎都能) */ llmPriming: boolean; /** 是否有 PreToolUse 风格的 hook 可注册 */ preToolUseHook: boolean; /** 是否能注册 MCP server(用于 Beacon 工具调用通道) */ mcpRegister: boolean; /** 此 harness 的 hook 支持状态是否已调研确认 */ hookResearched: boolean; /** 若 preToolUseHook=false,fallback 策略描述(给 doctor 用) */ fallback?: string; } export declare function capabilitiesFor(harness: Harness): HarnessCapabilities; //# sourceMappingURL=templates.d.ts.map