Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
- **Unknown-command suggestions no longer over-match short inputs** — `FindClosestCommand` now uses Damerau-Levenshtein distance with a length-aware threshold so short unknown commands are no longer steered toward unrelated longer commands (for example `fold` no longer suggests `find` just because it is within the old global distance-3 cutoff), while common typos and missing hyphens such as `serach` and `backfillfold` still resolve to the intended command. Added regression coverage for the tighter heuristic. Affected: `src/CodeIndex/Cli/ConsoleUi.cs`, `tests/CodeIndex.Tests/ConsoleUiTests.cs`.
- **Explicit root paths now bypass descendant skip-dir filters (#153)** — `FileIndexer.ScanFiles()` no longer applies the default skip-directory list to the project root itself, so commands like `cdidx node_modules`, `cdidx vendor`, `cdidx target`, or `cdidx .` from inside those directories no longer silently produce empty indexes. Descendant skip behavior is unchanged, and regression tests now cover explicit roots whose leaf names match `SkipDirs`. Affected: `src/CodeIndex/Indexer/FileIndexer.cs`, `tests/CodeIndex.Tests/FileIndexerTests.cs`. Closes #153.
- **Release verify step waits for CDN-propagated download URL and `gh release create` is idempotent** — The `Verify install.sh against the published release` step in `.github/workflows/release.yml` previously called `install.sh` immediately after `gh release create`, which races the GitHub release download CDN. Asset URLs returned 404 for several seconds even though the API listed them, making the v1.10.0 release run fail despite the actual release being healthy. Added a preceding `Wait for release assets to be downloadable` step that polls the public `releases/download/<tag>/CodeIndex-linux-x64.tar.gz` URL with up to ten 5-second retries before the verify step runs. Also made `Create GitHub release` idempotent: when the same-tag release already exists (e.g. on a re-run after a transient verify failure), the step now uploads any missing assets via `gh release upload --clobber` instead of failing with `a release with the same tag name already exists`. Affected: `.github/workflows/release.yml`.
- **C# methods, properties, indexers, delegates, and explicit-interface implementations with pointer / function-pointer return types are no longer dropped from symbol extraction (#234)** — `SymbolExtractor` now accepts `*` in the shared C# return-type character class and relaxes the `delegate`-keyword negative lookahead so `delegate*<...>` passes through, while `delegate Foo Bar()` style named delegate declarations continue to be handled by their dedicated pattern. The explicit-interface return-type regex has been consolidated onto the same `CSharpTypePattern`, so nested function-pointer payloads such as `delegate*<List<int>, int> IFoo.Transform()`, `delegate*<delegate*<int, void>, int> IFoo.TransformFp()`, and `delegate* unmanaged[Cdecl]<List<int>, int> IFoo.TransformUnmanaged()` are handled uniformly with the regular method / property / indexer / delegate paths instead of tripping on the first nested `>`. Methods such as `int* Get(...)`, `void** Double()`, `byte* Get1()`, `delegate*<int, int> Transform()`, and `int*[] Arr()` are now indexed with `ReturnType` preserved, and the same fix naturally covers pointer properties (`int* P { get; set; }`, `byte* Q => null`), pointer indexers (`int* this[int i]`), delegate declarations with pointer returns (`public unsafe delegate int* PointerDelegate(int)`), and explicit-interface implementations like `int* IFoo.Get()` and `delegate*<int, int> IFoo.Transform()`. Added regression coverage for each form, including nested generics inside `delegate*<...>` payloads and `delegate* unmanaged[Cdecl]<...>` calling conventions, to lock the behavior in place. Affected: `src/CodeIndex/Indexer/SymbolExtractor.cs`, `tests/CodeIndex.Tests/SymbolExtractorTests.cs`. Closes #234.
#### Added
- **`outline` now hints when a C# file likely uses top-level statements** — When `cdidx outline <path>` targets a non-trivial C# file (`TotalLines >= 20`) that has no `class` / `struct` / `interface` / `enum` / `namespace` / `delegate` / `record` declarations and its file-scope content still contains executable code after skipping `using` / `global using` lines, `[assembly:]` / `[module:]` metadata attributes, comments, and preprocessor directives, the human-readable output now appends a short stderr note explaining that the executable body is represented as top-level statements and therefore is not indexed as outline symbols. This keeps the note off metadata-only files such as `GlobalUsings.cs`, generated `GlobalUsings.g.cs`, and `AssemblyInfo.cs`. JSON output is unchanged so machine consumers that already rely on `OutlineResult` keep their contract. Affected: `src/CodeIndex/Cli/QueryCommandRunner.cs`.
- **`hotspots --group-by-name` collapses same-name rows across files** — `cdidx hotspots` previously emitted one row per definition site, so same-named helpers in different files (e.g. a shared `InsertIndexedFile` defined in three test files) produced three consecutive rows with the same `reference_count`. The new `--group-by-name` opt-in flag collapses rows that share `(name, kind)` into a single representative row, showing the chosen definition site plus a `(×N sites)` marker in human output, and `definition_sites` / `paths` / `grouped_by="name_kind"` / `definition_site_total` fields in JSON output, including zero-result and `--count --json` payloads. Default behavior is unchanged so existing consumers that want every definition site keep their contract. Help text, README, and regression tests now pin the new option, `hotspots --count`, and the grouped JSON payload shape. Affected: `src/CodeIndex/Cli/QueryCommandRunner.cs`, `src/CodeIndex/Cli/ConsoleUi.cs`, `tests/CodeIndex.Tests/QueryCommandRunnerTests.cs`, `tests/CodeIndex.Tests/ConsoleUiTests.cs`, `README.md`.
Expand Down Expand Up @@ -685,6 +686,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
- **未知コマンド候補が短い入力に過剰一致しないよう修正** — `FindClosestCommand` を Damerau-Levenshtein 距離と長さ依存の閾値に変更し、短い未知コマンドが無関係に長いコマンドへ誘導されないようにした(例: `fold` が旧来の一律距離 3 閾値だけで `find` を提案しない)。一方で `serach` や `backfillfold` のような一般的な typo やハイフン抜けは引き続き意図したコマンドに解決される。回帰テストも追加。対象: `src/CodeIndex/Cli/ConsoleUi.cs`、`tests/CodeIndex.Tests/ConsoleUiTests.cs`。
- **明示的に指定したルートが `SkipDirs` 名でも空インデックスにならないよう修正 (#153)** — `FileIndexer.ScanFiles()` がデフォルトの skip-directory リストを project root 自体には適用しないようにし、`cdidx node_modules`、`cdidx vendor`、`cdidx target`、あるいはそのようなディレクトリ内での `cdidx .` が、成功扱いのまま 0 件を作る問題を解消した。子ディレクトリに対する skip 挙動は従来どおり維持し、leaf 名が `SkipDirs` に一致するルートを明示指定したケースの回帰テストも追加した。対象: `src/CodeIndex/Indexer/FileIndexer.cs`、`tests/CodeIndex.Tests/FileIndexerTests.cs`。Closes #153。
- **Release ワークフローの verify ステップを CDN 伝播待ち+`gh release create` 冪等化** — `.github/workflows/release.yml` の `Verify install.sh against the published release` は `gh release create` 直後に `install.sh` を起動しており、GitHub Release の download CDN との競合で URL が数秒間 404 を返し、リリース自体は正常なのに verify が落ちることがあった(v1.10.0 で発生)。verify 前に `Wait for release assets to be downloadable` ステップを追加し、`releases/download/<tag>/CodeIndex-linux-x64.tar.gz` を 5 秒間隔で最大 10 回ポーリングしてから verify を回すようにした。あわせて `Create GitHub release` を冪等化し、同名タグの release が既に存在する場合は `gh release upload --clobber` で不足アセットのみ補完するため、verify ステップの再実行で `a release with the same tag name already exists` で落ちないようにした。対象: `.github/workflows/release.yml`。
- **C# のポインタ / 関数ポインタ戻り値を持つメソッド・プロパティ・インデクサ・デリゲート・明示的インターフェース実装をシンボル抽出が落とさないよう修正 (#234)** — `SymbolExtractor` の C# 用共通戻り値型キャラクタクラスに `*` を追加し、`delegate` キーワードの否定先読みも `delegate*<...>` を許容するよう緩めた。`delegate Foo Bar()` のような名前付き delegate 宣言は従来どおり専用パターンで扱う。明示的インターフェース実装の戻り値型正規表現を `CSharpTypePattern` に統合したため、`delegate*<List<int>, int> IFoo.Transform()`、`delegate*<delegate*<int, void>, int> IFoo.TransformFp()`、`delegate* unmanaged[Cdecl]<List<int>, int> IFoo.TransformUnmanaged()` のように payload 内に入れ子の `>` を含む function-pointer 戻り値も、最初の `>` で落ちずに通常メソッドと同じ経路で処理される。これにより `int* Get(...)`、`void** Double()`、`byte* Get1()`、`delegate*<int, int> Transform()`、`int*[] Arr()` のようなメソッドが `ReturnType` を含めて再びインデックスされ、同じ修正で `int* P { get; set; }` / `byte* Q => null` のようなポインタプロパティ、`int* this[int i]` のようなポインタインデクサ、`public unsafe delegate int* PointerDelegate(int)` のようなポインタ戻りを持つ delegate 宣言、`int* IFoo.Get()` や `delegate*<int, int> IFoo.Transform()` のような明示的インターフェース実装も救われる。`delegate*<...>` の payload に入れ子 generic を持つ形と `delegate* unmanaged[Cdecl]<...>` の呼び出し規約付きの形を含む、各パターンを固定する回帰テストも追加。対象: `src/CodeIndex/Indexer/SymbolExtractor.cs`、`tests/CodeIndex.Tests/SymbolExtractorTests.cs`。Closes #234。
#### 追加
- **C# のトップレベルステートメント想定ファイルに対する `outline` ヒント** — `cdidx outline <path>` で対象が 20 行以上の C# ファイルかつ `class` / `struct` / `interface` / `enum` / `namespace` / `delegate` / `record` が一切無く、さらに `using` / `global using` 行、`[assembly:]` / `[module:]` の metadata 属性、コメント、プリプロセッサ行を除いても file-scope の実行コードが残る場合、人間向け出力の末尾に「実行本体はトップレベルステートメントとして書かれているため outline のシンボルには現れない」旨の短いノートを stderr に追記するようにした。これにより `GlobalUsings.cs`、生成された `GlobalUsings.g.cs`、`AssemblyInfo.cs` のような metadata-only ファイルでは注記を出さない。JSON 出力は `OutlineResult` の契約維持のため変更しない。対象: `src/CodeIndex/Cli/QueryCommandRunner.cs`。
- **`hotspots --group-by-name` で同名行をファイル横断で集約** — `cdidx hotspots` はこれまで 1 定義サイト 1 行を返していたため、テストファイル間で共有されている同名ヘルパー(例: 3 ファイルに存在する `InsertIndexedFile`)が同一 `reference_count` のまま 3 行連続で出ていた。オプトインの `--group-by-name` を追加し、`(name, kind)` が一致する行を代表 1 行に畳み込むようにした。人間向け出力には `(×N sites)` マーカーが付き、JSON 出力には `definition_sites` / `paths` / `grouped_by="name_kind"` / `definition_site_total` フィールドが追加され、0 件時や `--count --json` でも同じ grouped shape を維持する。既定の挙動は変更しないため、全定義サイトを列挙したい既存 consumer の契約は維持される。help、README、回帰テストも更新し、新しいオプション、`hotspots --count`、payload shape を固定した。対象: `src/CodeIndex/Cli/QueryCommandRunner.cs`、`src/CodeIndex/Cli/ConsoleUi.cs`、`tests/CodeIndex.Tests/QueryCommandRunnerTests.cs`、`tests/CodeIndex.Tests/ConsoleUiTests.cs`、`README.md`。
Expand Down
4 changes: 2 additions & 2 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ Supported symbol kinds by language (32 languages with symbol extraction):
| Python | def, async def | class | -- | -- | -- | @property | -- | from/import | yes |
| JavaScript | function, arrow, methods (including same-line keyword/modifier-named methods, default arguments, computed names, `#private`, generator, `async *`) | class, export default class, same-line sibling/statement-prefixed public classes, class expressions, multiline/parenthesized/CommonJS class exports | -- | -- | -- | -- | -- | import...from | yes |
| TypeScript | function, arrow, methods (including generic and same-line object/conditional/function-return methods, default arguments, computed names, `#private`, generator, `async *`) | class, export default class, anonymous default `abstract class`, `export = class`, same-line sibling/statement-prefixed public classes, class expressions, multiline/parenthesized class expressions, type | -- | interface | enum, const enum | -- | -- | import...from | yes |
| C# | methods, ctors, explicit-interface impls, and indexers (including `ref` / `ref readonly` returns; guards named-argument labels only before qualified call expressions; allows `global::` / alias-qualified return types and spaced generic type tokens), operators stored as `operator +` / `operator checked +`, conversion operators stored as `implicit operator decimal` / `explicit operator Money` (including `unsafe` / `extern` forms and function-pointer target types), indexers normalized to `Item`, const, static readonly, enum members, #region, finalizers | class, record | struct, record struct, ref struct | interface | enum | property, expression-bodied, `ref` / `ref readonly` properties, record primary components | event, delegate (including spaced generic type tokens) | using, using alias | yes |
| C# | methods, ctors, explicit-interface impls, and indexers (including `ref` / `ref readonly` returns and pointer / function-pointer returns such as `int*` / `void**` / `delegate*<int, int>` / `int*[]`; guards named-argument labels only before qualified call expressions; allows `global::` / alias-qualified return types and spaced generic type tokens), operators stored as `operator +` / `operator checked +`, conversion operators stored as `implicit operator decimal` / `explicit operator Money` (including `unsafe` / `extern` forms and function-pointer target types), indexers normalized to `Item`, const, static readonly, enum members, #region, finalizers | class, record | struct, record struct, ref struct | interface | enum | property, expression-bodied, `ref` / `ref readonly` properties, pointer properties, record primary components | event, delegate (including spaced generic type tokens and pointer returns) | using, using alias | yes |
| Go | func, methods | type alias | struct | interface | -- | -- | -- | import | yes |
| Rust | fn, macro_rules!, const, static | impl, type alias | struct, union | trait | enum | -- | -- | use | yes |
| Java | methods, static final, enum members | class, record, sealed, @interface | -- | interface | enum | record primary components | -- | import | yes |
Expand Down Expand Up @@ -1396,7 +1396,7 @@ LIMIT 20;
| Python | def, async def | class | -- | -- | -- | @property | -- | from/import | yes |
| JavaScript | function, アロー, メソッド(同一行の keyword / modifier 名、default 引数、computed、`#private`、generator、`async *` を含む) | class, export default class, 同一行 sibling / statement-prefixed public class, クラス式, 複数行 / parenthesized / CommonJS クラス export | -- | -- | -- | -- | -- | import...from | yes |
| TypeScript | function, アロー, メソッド(generic / 同一行 object-return / conditional / function-return、default 引数、computed、`#private`、generator、`async *` を含む) | class, export default class, 匿名 default `abstract class`, `export = class`, 同一行 sibling / statement-prefixed public class, 複数行 / parenthesized クラス式, type | -- | interface | enum, const enum | -- | -- | import...from | yes |
| C# | メソッド, コンストラクタ, explicit-interface 実装, インデクサ(いずれも `ref` / `ref readonly` 戻り値対応。qualified call expression の直前にある named-argument label だけを除外し、`global::` / alias-qualified な戻り値型と、スペースを含む generic 型トークンを許可), `operator +` / `operator checked +` 形式で保持する演算子, `implicit operator decimal` / `explicit operator Money` 形式で保持する変換演算子(`unsafe` / `extern` 付きと function-pointer target type を含む), `Item` に正規化するインデクサ, const, static readonly, enum メンバー, #region, ファイナライザ | class, record | struct, record struct, ref struct | interface | enum | property, 式本体, `ref` / `ref readonly` property, record primary component | event, delegate(generic 型引数内スペースを含む形も対応) | using, using alias | yes |
| C# | メソッド, コンストラクタ, explicit-interface 実装, インデクサ(`ref` / `ref readonly` 戻り値と、`int*` / `void**` / `delegate*<int, int>` / `int*[]` のようなポインタ / 関数ポインタ戻り値にも対応。qualified call expression の直前にある named-argument label だけを除外し、`global::` / alias-qualified な戻り値型と、スペースを含む generic 型トークンを許可), `operator +` / `operator checked +` 形式で保持する演算子, `implicit operator decimal` / `explicit operator Money` 形式で保持する変換演算子(`unsafe` / `extern` 付きと function-pointer target type を含む), `Item` に正規化するインデクサ, const, static readonly, enum メンバー, #region, ファイナライザ | class, record | struct, record struct, ref struct | interface | enum | property, 式本体, `ref` / `ref readonly` property, ポインタ property, record primary component | event, delegate(generic 型引数内スペースを含む形と、ポインタ戻り値の delegate 宣言も対応) | using, using alias | yes |
| Go | func, メソッド | 型エイリアス | struct | interface | -- | -- | -- | import | yes |
| Rust | fn, macro_rules!, const, static | impl, type alias | struct, union | trait | enum | -- | -- | use | yes |
| Java | メソッド, static final, enum メンバー | class, record, sealed, @interface | -- | interface | enum | record primary component | -- | import | yes |
Expand Down
Loading
Loading