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
4 changes: 2 additions & 2 deletions USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ sections below show examples and option details for the most common workflows.
| Index | `backfill-fold` | Upgrade Unicode folded-name metadata in an existing DB | `backfill_fold` |
| Index | `hooks` | Install, remove, or inspect the optional git pre-commit hook | -- |
| Search | `search` | Full-text search across indexed chunks | `search` |
| Search | `find` | Literal substring search inside one known indexed file | `find_in_file` |
| Search | `find` | Literal or opt-in regex search inside one known indexed file; use context and focus controls to target a position | `find_in_file` |
| Search | `excerpt` | Reconstruct a focused line range from indexed chunks | `excerpt` |
| Navigation | `definition` | Resolve symbol definitions and optional bodies | `definition` |
| Navigation | `symbols` | Search extracted symbols by name, kind, language, and path | `symbols` |
Expand Down Expand Up @@ -2239,7 +2239,7 @@ cdidx index . --quiet
| Index | `backfill-fold` | 既存 DB の Unicode folded-name metadata を更新 | `backfill_fold` |
| Index | `hooks` | 任意の git pre-commit hook を install / remove / inspect | -- |
| Search | `search` | indexed chunk の全文検索 | `search` |
| Search | `find` | 既知の indexed file 内で literal substring 検索 | `find_in_file` |
| Search | `find` | 既知の indexed file 内で literal または opt-in regex 検索。文脈と focus 指定で位置を絞り込み | `find_in_file` |
| Search | `excerpt` | indexed chunk から指定行範囲を復元 | `excerpt` |
| Navigation | `definition` | symbol definition と任意の body を解決 | `definition` |
| Navigation | `symbols` | name / kind / language / path で symbol を検索 | `symbols` |
Expand Down
18 changes: 18 additions & 0 deletions changelog.d/unreleased/1413-1414.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
category: fixed
issues:
- 1413
- 1414
affected:
- src/CodeIndex/Mcp/McpToolHandlers.cs
- src/CodeIndex/Mcp/McpToolDefinitions.cs
- tests/CodeIndex.Tests/McpServerTests.cs
---

## English

- **MCP excerpt and find_in_file now clamp oversized context windows (#1413, #1414)** - `before` and `after` values above the MCP context cap are clamped to 1000 lines and reported with `contextTruncated`, preventing accidental multi-million-line responses.

## 日本語

- **MCP の excerpt / find_in_file が過大な前後文脈をクランプするようになりました (#1413, #1414)** - MCP の `before` / `after` が上限を超えた場合は 1000 行に丸め、`contextTruncated` で通知することで、誤って数百万行のレスポンスを生成しないようにしました。
20 changes: 20 additions & 0 deletions changelog.d/unreleased/1593.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
category: fixed
issues:
- 1593
affected:
- src/CodeIndex/Cli/QueryCommandRunner.cs
- src/CodeIndex/Cli/CliFlagSchema.cs
- src/CodeIndex/Cli/ConsoleUi.cs
- src/CodeIndex/Mcp/McpToolDefinitions.cs
- src/CodeIndex/Mcp/McpToolHandlers.cs
- USER_GUIDE.md
---

## English

- **find_in_file now supports snippet line controls (#1593)** - CLI `find --snippet-lines N` and MCP `find_in_file` `snippetLines` can widen or narrow match context without a separate `excerpt` call.

## 日本語

- **find_in_file が snippet 行数指定に対応しました (#1593)** - CLI の `find --snippet-lines N` と MCP `find_in_file` の `snippetLines` で、別途 `excerpt` を呼ばずに一致箇所の前後文脈を広げたり狭めたりできます。
21 changes: 21 additions & 0 deletions changelog.d/unreleased/1597.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
category: fixed
issues:
- 1597
affected:
- src/CodeIndex/Cli/QueryCommandRunner.cs
- src/CodeIndex/Cli/CliFlagSchema.cs
- src/CodeIndex/Cli/ConsoleUi.cs
- src/CodeIndex/Database/DbReader.FilesStatus.cs
- src/CodeIndex/Mcp/McpToolDefinitions.cs
- src/CodeIndex/Mcp/McpToolHandlers.cs
- USER_GUIDE.md
---

## English

- **find now supports focus line and column targeting (#1597)** - CLI `find --focus-line` / `--focus-column` and MCP `find_in_file` focus arguments restrict matches to the requested source position.

## 日本語

- **find が focus line / column 指定に対応しました (#1597)** - CLI の `find --focus-line` / `--focus-column` と MCP `find_in_file` の focus 引数で、指定したソース位置に一致する結果へ絞り込めます。
21 changes: 21 additions & 0 deletions changelog.d/unreleased/1930.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
category: fixed
issues:
- 1930
affected:
- src/CodeIndex/Cli/QueryCommandRunner.cs
- src/CodeIndex/Cli/CliFlagSchema.cs
- src/CodeIndex/Cli/ConsoleUi.cs
- src/CodeIndex/Database/DbReader.FilesStatus.cs
- src/CodeIndex/Mcp/McpToolDefinitions.cs
- src/CodeIndex/Mcp/McpToolHandlers.cs
- USER_GUIDE.md
---

## English

- **find_in_file now supports opt-in regex matching (#1930)** - CLI `find --regex` and MCP `find_in_file` `regex` treat the query as a regular expression with a timeout and report invalid patterns instead of silently returning literal misses.

## 日本語

- **find_in_file が opt-in regex 検索に対応しました (#1930)** - CLI の `find --regex` と MCP `find_in_file` の `regex` はクエリをタイムアウト付き正規表現として扱い、不正なパターンは literal miss ではなくエラーとして返します。
7 changes: 4 additions & 3 deletions src/CodeIndex/Cli/CliFlagSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,13 @@ private static IReadOnlyList<CliFlag> BuildAll()
new() { Name = "--query", ValuePlaceholder = "<query>", Description = "Literal query", Commands = Set(QueryCommands) },
new() { Name = "--body", Description = "Include body", Commands = Set(BodyCommands) },
new() { Name = "--exact", Description = "Backward-compatible exact shorthand", Commands = Set(ExactCommands) },
new() { Name = "--regex", Description = "Use regular expression matching", Commands = Set("find") },
new() { Name = "--exact-name", Description = "Exact symbol-name equality", Commands = Set(ExactNameCommands), AlsoAcceptedBy = Set("search") },
new() { Name = "--exact-substring", Description = "Search-only exact substring match", Commands = Set("search"), AlsoAcceptedBy = Set(ExactSubstringAccepted) },
new() { Name = "--prefix", Description = "Trailing-asterisk prefix shorthand", Commands = Set("search") },
new() { Name = "--name", ValuePlaceholder = "<name>", Description = "Exact symbol name", Commands = Set("symbols") },
new() { Name = "--max-line-width", ValuePlaceholder = "<n>", Description = "Clamp long single-line payloads (0 disables clamping)", Commands = Set(MaxLineWidthCommands) },
new() { Name = "--snippet-lines", ValuePlaceholder = "<n>", Description = "Snippet length", Commands = Set("search", "references", "callers", "callees", "impact") },
new() { Name = "--snippet-lines", ValuePlaceholder = "<n>", Description = "Snippet length", Commands = Set("search", "find", "references", "callers", "callees", "impact") },
new() { Name = "--snippet-focus", ValuePlaceholder = "<leftmost|quality|proximity>", Description = "Search snippet long-line focus mode", Commands = Set("search") },
new() { Name = "--fts", Description = "Raw FTS5 syntax", Commands = Set("search") },
new() { Name = "--no-dedup", Description = "Show duplicate chunks", Commands = Set("search") },
Expand All @@ -250,8 +251,8 @@ private static IReadOnlyList<CliFlag> BuildAll()
new() { Name = "--after", ValuePlaceholder = "<n>", Description = "Context lines after", Commands = Set("find", "excerpt") },
new() { Name = "--start", ValuePlaceholder = "<line>", Description = "Start line", Commands = Set("excerpt") },
new() { Name = "--end", ValuePlaceholder = "<line>", Description = "End line", Commands = Set("excerpt") },
new() { Name = "--focus-line", ValuePlaceholder = "<line>", Description = "Focused line to keep visible when clamping", Commands = Set("excerpt") },
new() { Name = "--focus-column", ValuePlaceholder = "<n>", Description = "Focused column to keep visible when clamping", Commands = Set("excerpt") },
new() { Name = "--focus-line", ValuePlaceholder = "<line>", Description = "Focused line to keep visible when clamping", Commands = Set("find", "excerpt") },
new() { Name = "--focus-column", ValuePlaceholder = "<n>", Description = "Focused column to keep visible when clamping", Commands = Set("find", "excerpt") },
new() { Name = "--focus-length", ValuePlaceholder = "<n>", Description = "Focused span width when clamping", Commands = Set("excerpt") },
new() { Name = "--max-hops", ValuePlaceholder = "<n>", Description = "Impact: max BFS hops", Commands = Set("impact") },
new() { Name = "--depth", ValuePlaceholder = "<n>", Description = "Impact: deprecated alias for --max-hops", Commands = Set("impact") },
Expand Down
8 changes: 4 additions & 4 deletions src/CodeIndex/Cli/ConsoleUi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private static readonly (string Command, string Usage)[] CommandUsageLines =
("callees", "cdidx callees <query>|--query <query>|-- <query> [--db <path>] [--json] [--verbose] [--limit <n>|--top <n>] [--lang <lang>] [--kind <kind>] [--rank-by <weighted|count|kind>] [--raw-kinds] [--path <glob>] [--exclude-path <glob>] [--exclude-tests] [--body] [--snippet-lines <n>] [--max-line-width <n>] [--exact|--exact-name] [--count]"),
("symbols", "cdidx symbols [query|--query <query>|-- <query>] [--name <name>] [--db <path>] [--json] [--verbose] [--limit <n>|--top <n>] [--lang <lang>] [--kind <kind>] [--visibility <v[,v]>] [--exclude-visibility <v[,v]>] [--path <glob>] [--exclude-path <glob>] [--exclude-tests] [--exact|--exact-name] [--count] [--since <datetime>]"),
("files", "cdidx files [query|--query <query>|-- <query>] [--db <path>] [--json] [--verbose] [--limit <n>|--top <n>] [--lang <lang>] [--path <glob>] [--exclude-path <glob>] [--exclude-tests] [--count] [--since <datetime>] [--bytes]"),
("find", "cdidx find <query> --path <glob> [--db <path>] [--json] [--verbose] [--limit <n>|--top <n>] [--lang <lang>] [--exclude-path <glob>] [--exclude-tests] [--before <n>] [--after <n>] [--max-line-width <n>] [--exact] [--count]"),
("find", "cdidx find <query> --path <glob> [--db <path>] [--json] [--verbose] [--limit <n>|--top <n>] [--lang <lang>] [--exclude-path <glob>] [--exclude-tests] [--before <n>] [--after <n>] [--snippet-lines <n>] [--focus-line <line>] [--focus-column <n>] [--max-line-width <n>] [--exact] [--regex] [--count]"),
("excerpt", "cdidx excerpt <path> --start <line> [--end <line>] [--before <n>] [--after <n>] [--max-line-width <n>] [--focus-line <line>] [--focus-column <n>] [--focus-length <n>] [--db <path>] [--json] [--verbose]"),
("map", "cdidx map [--db <path>] [--json] [--verbose] [--limit <n>|--top <n>] [--lang <lang>] [--path <glob>] [--exclude-path <glob>] [--exclude-tests] [--bytes] [--min-entrypoint-confidence <0.0..1.0>]"),
("inspect", "cdidx inspect <query>|--query <query>|-- <query> [--db <path>] [--json] [--verbose] [--limit <n>|--top <n>] [--lang <lang>] [--path <glob>] [--exclude-path <glob>] [--exclude-tests] [--body] [--max-line-width <n>] [--exact|--exact-name]"),
Expand Down Expand Up @@ -815,11 +815,11 @@ private static void PrintFlagReference(Action<string> WriteHelpLine)
Console.WriteLine(" --exclude-path <glob> Exclude glob-style path patterns (* and ?) (repeatable)");
Console.WriteLine(" --exclude-tests Exclude likely test files");
Console.WriteLine(" --include-generated Include generated files in query results");
Console.WriteLine(" --snippet-lines <n> Search snippet length (1-20, default: 8)");
Console.WriteLine(" --snippet-lines <n> search/find snippet length (1-20, default: search 8; find 1)");
Console.WriteLine(" --snippet-focus <mode> search only: long-line focus mode (leftmost|quality|proximity, default: quality)");
WriteHelpLine($" --max-line-width <n> search/references/callers/callees/find/excerpt/impact/inspect only: clamp very long single-line snippet/context/excerpt payloads (`0` disables clamping; default: {LineWidthFormatter.DefaultMaxLineWidth})");
Console.WriteLine(" --focus-line <line> excerpt: line whose focused column should stay visible (requires --focus-column)");
Console.WriteLine(" --focus-column <n> excerpt: column to keep centered when clamping (must be within the focused line)");
Console.WriteLine(" --focus-line <line> find/excerpt: focus a specific line");
Console.WriteLine(" --focus-column <n> find/excerpt: focus a specific 1-based column");
Console.WriteLine(" --focus-length <n> excerpt: width of the focused span (default: 1, requires --focus-column)");
WriteHelpLine($" --fts Use raw FTS5 query syntax for search (content:term, NEAR(a b, 5), OR, NOT, groups, prefix*, \"phrase\"; search query max {QueryLimits.MaxQueryLength} chars; raw FTS parser max {DbReader.MaxRawFtsQueryLength} chars, {DbReader.MaxRawFtsBooleanOperators} boolean ops, {DbReader.MaxRawFtsNearOperators} NEAR ops; trailing * is a prefix shorthand in literal-safe mode)");
Console.WriteLine(" --exact Backward-compatible shorthand.");
Expand Down
Loading
Loading