feat(reference): Phase 2 - シンボル lookup インデックス(reference find-symbol)#189
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
SPEC #187 (Phase 2 シンボル lookup インデックス) を land し、Phase 1 で得た知見を tasks/lessons.md に追記する。Phase 1 は PR #186 で develop 統合済みのため、本 PR の diff は Phase 2 と lessons のみ。 採用方針 B (独自 ReferenceSymbolEntry) と Symbol scope (型のみ) は gwt-discussion で確定済み。member-level lookup は Phase 2.5 以降の 拡張余地として残し、validate_kind の受理リストには method/property/ field も含めておく。 主な変更: - src/reference/index.rs (新規): ReferenceSymbolEntry と ReferenceSymbolIndex 構造、build_or_update_index で size+mtime ベースの incremental 更新、find_symbol で kind / namespace フィルタ - src/reference/mod.rs: maybe_execute_reference_tool に reference_find_symbol 分岐と execute_find_symbol を追加、 dispatcher 経由テスト 6 件 - src/cli.rs: ReferenceCommand::FindSymbol variant - src/app/runner.rs: build_reference_call に FindSymbol 分岐と 2 件のテスト - src/tooling/tool_catalog.rs: reference_find_symbol を TOOL_NAMES / executor / read_only / params_schema / parity count(125) に登録 - .claude-plugin/.../unity-csharp-reference/SKILL.md: Preferred Flow に find-symbol 例とフォールバック説明 - references/symbol-lookup-playbook.md: workflow step 1 を反映 - docs/tools.md: Reference Cache (6 -> 7 tools) - tasks/lessons.md: SPEC #185 振り返り 3 件 (clippy 1.95 差、 coverage 90% 維持、SPEC section markers) ローカル検証: - cargo fmt -- --check: clean - cargo clippy --all-targets -- -D warnings: clean - cargo test --bin unity-cli: 356 passed / 0 failed - cargo llvm-cov --all-targets: TOTAL line coverage 90.69% - unity-cli skills lint --severity error: 15 skills / 0 violations Refs #187 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6c8311f to
ebc1f3f
Compare
CI gate clear: merge_state CLEAN
修正サマリ
現在の CI 状態(全 SUCCESS)
Phase 2 で land する内容
Out of Scope(Phase 3 #188 へ)
レビューと merge をお願いします。Phase 3 は別 SPEC #188 で後続。 |
Summary
unity-cli reference find-symbolで UnityCsReference キャッシュ内の型定義(class / interface / struct / enum)を per-version index で定数時間 lookup できるようにする。gwt-discussionで採用方針 B(独自ReferenceSymbolEntry) と symbol scope 型のみ が確定。member-level lookup は Phase 2.5 以降の拡張余地として残す。tasks/lessons.mdに追記して再発防止する。Changes
src/reference/index.rs(新規):ReferenceSymbolEntry/ReferenceSymbolIndex/extract_symbols_from_text(軽量 regex で型定義抽出)/build_or_update_index(size + mtime ベース incremental)/find_symbol/validate_kind/file_signature。LSP workspace には混入させない独立空間。src/reference/mod.rs:maybe_execute_reference_toolに"reference_find_symbol"分岐とexecute_find_symbolを追加。requirednameパラメータ、optionalkind/namespace/version/projectRoot。dispatcher 経由 test を 6 件追加。src/cli.rs:ReferenceCommand::FindSymbol { name, kind, namespace, version }variant を追加。src/app/runner.rs::build_reference_call:FindSymbol分岐と 2 件の test。src/tooling/tool_catalog.rs:reference_find_symbolをTOOL_NAMES/tool_executor::Local/is_read_only_tool/tool_params_schema(required:name) / parity count (124→125) に登録。.claude-plugin/plugins/unity-cli/skills/unity-csharp-reference/SKILL.md:## Preferred Flowにreference find-symbol例 + 使い分けガイド (find-symbol → grep への fallback)。.claude-plugin/plugins/unity-cli/skills/unity-csharp-reference/references/symbol-lookup-playbook.md: workflow step 1 に find-symbol 例とインクリメンタル index の説明。docs/tools.md: 「Reference Cache (6 → 7 tools)」に行追加。tasks/lessons.md: SPEC feat(reference): UnityCsReference のローカルキャッシュ参照機構(Phase 1) #185 振り返り 3 件 (clippy 1.95 のローカル差、coverage 90% を新 module 追加時に確保する手順、gwtd issue spec createの section markers 運用)。Testing
cargo fmt -- --check— cleancargo clippy --all-targets -- -D warnings— clean (clippy 1.95 想定のunnecessary-map-iter修正含む)cargo test --bin unity-cli— 356 passed / 0 failed (Phase 2 で 9 + 6 + 2 + schema test を追加)cargo llvm-cov --all-targets --summary-only -- --test-threads=1— TOTAL line coverage 90.69% (≥ 90% gate を満たす)unity-cli skills lint --severity error— 15 skills / 0 violationsClosing Issues
Related Issues / Links
Checklist
src/reference/index.rs9 件、dispatcher 6 件、build_reference_call2 件)cargo clippy,cargo fmt,unity-cli skills lint)docs/tools.md、skill SKILL.md、references/symbol-lookup-playbook.md、tasks/lessons.md)reference find-symbolの初回実行で~/.unity/cache/UnityCsReference/<version>/.unity-cli-index/symbols.jsonを新規生成するだけで、既存 Phase 1 cache (.unity-cli-meta.json等) には触らない。feat)Context
reference grep / view / searchは walkdir + regex の線形検索のため、UnityEngine.Animatorのような頻出シンボルを LLM が連続して引くと毎回フルスキャンが走り高コスト。.unity-cli-index/symbols.jsonを持ち、初回 lookup 時に build、以降は size + mtime ベースで incremental 更新する。Risk / Impact
src/reference/index.rs+ CLI / catalog / local dispatcher への配線。新 skill / docs は既存 Phase 1 用のものに追記のみ。LSP の workspaceFolders には reference cache を引き続き混入させない(Phase 1 と同じ方針)。.unity-cli-index/ディレクトリを手動で削除しても良い (reference cleanも次回以降のみ)。Notes
find-symbolを前提とした symbol-level diff を予定。f813632は本 PR の中に含まれており、その上に dispatcher テスト / skill / docs / clippy fix が6c8311fとして重ねられている。