fix(slash): 同名スキルの Claude/Codex 版が併存できるようマージ層の重複排除キーを揃える (#1380)#1392
Merged
Conversation
`.claude/skills/<name>`(Claude, cliTools undefined)と `.agents/skills/<name>` (Codex, cliTools:['codex'])に同名スキルがあると、Claude Code 選択時に候補へ 出ない不具合を修正する。 原因: `deduplicateByName()` は `name + cliTools` をキーに両版を共存させる(#800) のに対し、`mergeCommandGroups()` は `cmd.name` のみをキーにしていたため、マージ層で 配列後方の Codex 版が Claude 版を同名で上書きし、後段 `filterCommandsByCliTool(..., 'claude')` で Claude 版が除外され候補が空になっていた。 対策(案A): 重複排除キー生成 `keyOf`(name + 正規化 cliTools スコープ、undefined/ 空は claude sentinel)を `command-merger.ts` に切り出し、`deduplicateByName()` と `mergeCommandGroups()` の両方で共有(DRY)。循環 import を避けるため keyOf は command-merger.ts 側に置き、slash-commands.ts から import する(既存の依存方向を維持)。 これにより Claude 版と Codex 版が共存し、SF-1(worktree コマンドが同一 CLI tool scope の同名 standard を override)も従来どおり保たれる。 回帰テスト追加: mergeCommandGroups() で name 衝突する Claude 版と Codex 版が両方残る こと、同一スコープでは worktree が standard を override すること(SF-1 非退行)、および keyOf の正規化挙動を検証する。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016KUNKsdsvJnP3bf7c89vU7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
.claude/skills/<name>(Claude,cliToolsundefined)と.agents/skills/<name>(Codex,cliTools:['codex'])に同名スキルがあると、Claude Code 選択時にスラッシュ候補へ出ない不具合を修正する。Closes #1380。根本原因
2 つの重複排除層でキーの粒度が食い違っていた。
deduplicateByName()(slash-commands.ts): キーはname + cliTools(fix(slash-commands): Codex skills masked when name collides with .claude/commands/*.md (per-CLI dedup) #800)→ Claude 版と Codex 版は共存(正しい)mergeCommandGroups()(command-merger.ts): キーはcmd.nameのみ → マージ層で共存が巻き戻り、配列後方の Codex 版が Claude 版を同名で上書き。後段filterCommandsByCliTool(mergedGroups, 'claude')が残った Codex 版(cliTools:['codex'])を除外 → Claude 選択時に空対策(案A)
keyOf(name + 正規化 cliTools スコープ、undefined/空はclaudesentinel)をcommand-merger.tsに切り出し、deduplicateByName()とmergeCommandGroups()の両方で共有(DRY)keyOfは command-merger.ts 側に置き、slash-commands.ts から import(既存の依存方向を維持)受け入れ条件
.claude/skills/<name>と.agents/skills/<name>が同名でも Claude 選択時に.claude側が/{name}として残る.agents/skills側が従来どおり残るmergeCommandGroups()の name 衝突(Claude vs Codex)を検証する回帰テストを追加変更ファイル
src/lib/command-merger.ts(keyOfを export、mergeCommandGroupsをkeyOfキーへ)src/lib/slash-commands.ts(ローカルkeyOfを削除し import に)tests/unit/lib/command-merger.test.ts(回帰テスト +5)CHANGELOG.md品質(worktree で exit code 実測・CI=true)
🤖 Generated with Claude Code