refactor(cli): keep each tool's formats in its own profile

未關閉
#1,143 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
18/100
Issue 類型
重構
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
typescript
領域
cli, tooling

研究方向

Start with cli/tests/architecture/tool-addition-cost.arch.test.ts and the rules in cli/.claude/rules/00-architecture/0-hexagonal.md to see what the guardrail checks. Then trace the tool-named identifiers in formats/opencode-mcp-merge.ts, formats/vscode-mcp-merge.ts and formats/agent-frontmatter-strip.ts, and their callers. Done means the application/ and domain/formats/ baseline is empty and the golden snapshot is unchanged. This depends on #1141, which is not merged yet.

由索引模型根據 Issue 內容生成。

描述

Problem

The CLI's own rule says application code never branches on the targeted tool and reads its capability instead (cli/.claude/rules/00-architecture/0-hexagonal.md), and a tool may only be named in its profile (cli/tests/architecture/tool-addition-cost.arch.test.ts). That test only sees a tool named in a string literal. Identifiers escape it: measured, 30 files outside src/contexts/tools/domain/profiles/ carry a tool name in what they declare or import, 9 of them in an application/ layer. A second host that needs the same behaviour means editing application code again.

#1141 moves every hook format into its tool's profile, hands the project-hooks format through PluginsCapability, and adds the guardrail for application/ and domain/formats/, with today's remaining violations as a baseline that may only shrink. This issue empties that baseline.

Scope
  • OpenCode's MCP merge: formats/opencode-mcp-merge.ts, called by name from install-runtime-config-use-case.ts, flat-mcp-materializer.ts, plugin-remove-use-case.ts and project-plugin-cleanup.ts.
  • formats/vscode-mcp-merge.ts and formats/agent-frontmatter-strip.ts (Copilot and Cursor agent frontmatter).
  • clean-user-scope-use-case.ts (purgeCursorUserScopeFiles), telemetry-on-use-case.ts (claudeSettings), flat-build-strategy.ts (the Claude root rewrite).
  • Same method as #1141: move each tool's format into its profile, expose what the application needs through the capability, behaviour unchanged, the golden snapshot identical.
Acceptance criteria
  • The guardrail's baseline for application/ and domain/formats/ is empty.
  • No application file imports a module from a tool's profile or a function named after a tool.
  • The golden snapshot is unchanged, and the CLI suite and the touched mutation scopes hold their floors.
Prior art in this repo
  • #1141 and the guardrail it adds.
  • cli/.claude/rules/00-architecture/0-hexagonal.md, 0-contexts.md; tool-addition-cost.arch.test.ts, context-boundary.arch.test.ts.
Out of scope
  • The composition root (src/runtime/wiring/) and readers whose job is one tool's own files (telemetry transcript readers, host plugin registry readers): naming the tool is their purpose.
主要語言
TypeScript
星號
481
分支
45
平均合併
1 天 13 小時
30 天內合併 PR
91

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

ai-driven-dev/framework 的其他 Issue

查看 ai-driven-dev/framework 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。