跳到主要内容
知仓学习社ZHICANG

integrate-harness

Use when adding a new agent harness (CLI-based coding agent) adapter to adapters. Covers capability audit, adapter scaffold, session parsing, auth d…

不碰外部(只输出文字)无严重或高危命中a5c-ai/babysitter

它会碰到什么

扫了多少1 个文本文件,3 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

integrate-harness

Goal: produce a production-quality XAdapter extends BaseAgentAdapter with full test coverage and documentation, matching the level of the existing 11 adapters (claude, codex, cursor, gemini, opencode, openclaw, copilot, hermes, pi, omp, adapters-remote).

Checklist

  1. Capability audit — read the harness's CLI docs. Fill in every AgentCapabilities field. Unknown? Set conservatively (false) and note in PR.
  2. Create packages/adapters/src/<name>-adapter.ts extending BaseAgentAdapter. Required: agent, displayName, cliCommand, minVersion, hostEnvSignals, capabilities, models[], defaultModelId, configSchema, buildSpawnArgs, parseEvent, detectAuth, getAuthGuidance, sessionDir, parseSessionFile, listSessionFiles, readConfig, writeConfig.
  3. Session parsing — if the harness stores JSONL sessions, delegate to parseJsonlSessionFile; otherwise write a custom parser and unit-test each event shape.
  4. Hooks — if the harness supports native hooks, override writeNativeHook and mirror into HookConfigManager. If not, rely on the base class's virtual hooks.
  5. Plugins — if it supports MCP servers under mcpServers in its config JSON, flip supportsPlugins: true, add pluginFormats: ['mcp-server'], and delegate to mcp-plugins.ts (see cursor/gemini/opencode/openclaw for the pattern).
  6. Register — add to packages/adapters/src/index.ts exports and to the default registry in packages/core/src/client.ts (if applicable).
  7. Tests — in packages/adapters/tests/<name>-adapter.test.ts:
  • capability shape
  • buildSpawnArgs for a few representative RunOptions
  • parseEvent for each JSONL type the harness emits
  • detectAuth for authenticated + unauthenticated states
  • session file parsing from a real fixture (redacted)
  • If plugins: add the adapter to mcp-plugins-parity.test.ts.
  1. CLI audit test — ensure packages/cli/tests/commands-audit.test.ts passes (it exercises every adapter via the built CLI).
  2. File-size limit — each source file must stay under 400 effective lines (local/max-file-lines). Split helpers into sibling modules if you're close.
  3. Docs — add a row to the README capabilities matrix and a paragraph in docs/02-agents/<name>.md.
  4. Changesetnpm run changeset, pick minor (new adapter), summarize.

Verification

npm run typecheck
npm run lint
npm test
npx vitest run packages/adapters/tests/<name>-adapter.test.ts

All existing tests must continue to pass — no regressions in commands-audit.

Common pitfalls

  • Forgetting to add the adapter to the default registry → commands-audit.test.ts won't exercise it.
  • JSONL parsers that assume a single event per line — some harnesses emit arrays.
  • Auth detection that reads env vars synchronously at construction time instead of detectAuth() — breaks testability.
  • buildSpawnArgs returning the string "undefined" for missing options — always gate with if (options.X != null).
  • Hook writers that overwrite rather than merge — use appendJsonHook or appendYamlHook.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。