Skip to content

Commit 4cb8902

Browse files
authored
Add map section controls and deps graph exports (#2755)
* Add map and deps controls for issues #1634 #1635 * Tighten deps format parsing for issues #1634 #1635
2 parents 9cc65fb + 6173323 commit 4cb8902

8 files changed

Lines changed: 528 additions & 28 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
category: added
3+
issues:
4+
- 1634
5+
affected:
6+
- src/CodeIndex/Cli/QueryCommandRunner.cs
7+
- src/CodeIndex/Mcp/McpToolHandlers.cs
8+
- src/CodeIndex/Mcp/McpToolDefinitions.cs
9+
---
10+
11+
## English
12+
13+
- **`deps` can export graph-shaped output and dependency cycles (#1634)**`deps` now accepts graph export formats and a cycle-only mode so callers can feed dependency data directly to visualization or cycle-analysis tooling.
14+
15+
## 日本語
16+
17+
- **`deps` がグラフ形式の出力と依存サイクル検出に対応しました (#1634)**`deps` はグラフ出力形式とサイクルのみを返すモードを受け付けるようになり、可視化やサイクル分析ツールへ依存データを直接渡せます。
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
category: added
3+
issues:
4+
- 1635
5+
affected:
6+
- src/CodeIndex/Cli/QueryCommandRunner.cs
7+
- src/CodeIndex/Mcp/McpToolHandlers.cs
8+
- src/CodeIndex/Mcp/McpToolDefinitions.cs
9+
---
10+
11+
## English
12+
13+
- **`map` can return selected sections with bounded module depth (#1635)**`map` now accepts section selection and depth control so MCP and CLI callers can request smaller repo overviews when they do not need the full payload.
14+
15+
## 日本語
16+
17+
- **`map` がセクション選択とモジュール深さ制御に対応しました (#1635)**`map` は必要なセクションと深さを指定できるようになり、MCP / CLI 呼び出し側が全体ペイロード不要時に小さなリポジトリ俯瞰を取得できます。

src/CodeIndex/Cli/CliFlagSchema.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ internal static class CliFlagSchema
119119
private static readonly string[] SinceCommands = ["search", "definition", "symbols", "files"];
120120
private static readonly string[] ByteFormatCommands = ["files", "map"];
121121
private static readonly string[] EntrypointConfidenceCommands = ["map"];
122+
private static readonly string[] MapSectionCommands = ["map"];
123+
private static readonly string[] DependencyCycleCommands = ["deps"];
122124

123125
// `--exact` is the legacy shorthand that every name-resolution command accepts.
124126
// `--exact` は名前解決系の全コマンドで受け付けるレガシー shorthand。
@@ -180,7 +182,7 @@ internal static class CliFlagSchema
180182

181183
private static readonly string[] FormatCommands =
182184
[
183-
"search", "definition", "references", "callers", "callees", "find", "validate",
185+
"search", "definition", "references", "callers", "callees", "find", "validate", "deps",
184186
];
185187

186188
private static readonly string[] ProfileCommands =
@@ -234,6 +236,8 @@ private static IReadOnlyList<CliFlag> BuildAll()
234236
new() { Name = "--since", ValuePlaceholder = "<datetime>", Description = "Filter by modified-since timestamp", Commands = Set(SinceCommands) },
235237
new() { Name = "--bytes", Description = "Show raw byte counts in human output", Commands = Set(ByteFormatCommands) },
236238
new() { Name = "--min-entrypoint-confidence", ValuePlaceholder = "<0.0..1.0>", Description = "Map: omit entrypoint candidates below this confidence", Commands = Set(EntrypointConfidenceCommands) },
239+
new() { Name = "--sections", ValuePlaceholder = "<tree,languages,hotspots,metrics>", Description = "Map: comma-separated response sections to include", Commands = Set(MapSectionCommands) },
240+
new() { Name = "--cycles", Description = "Deps: return dependency cycles instead of edge rows", Commands = Set(DependencyCycleCommands) },
237241
new() { Name = "--query", ValuePlaceholder = "<query>", Description = "Literal query", Commands = Set(QueryCommands) },
238242
new() { Name = "--body", Description = "Include body", Commands = Set(BodyCommands) },
239243
new() { Name = "--exact", Description = "Backward-compatible exact shorthand", Commands = Set(ExactCommands) },
@@ -256,7 +260,7 @@ private static IReadOnlyList<CliFlag> BuildAll()
256260
new() { Name = "--focus-column", ValuePlaceholder = "<n>", Description = "Focused column to keep visible when clamping", Commands = Set("find", "excerpt") },
257261
new() { Name = "--focus-length", ValuePlaceholder = "<n>", Description = "Focused span width when clamping", Commands = Set("excerpt") },
258262
new() { Name = "--max-hops", ValuePlaceholder = "<n>", Description = "Impact: max BFS hops", Commands = Set("impact") },
259-
new() { Name = "--depth", ValuePlaceholder = "<n>", Description = "Impact: deprecated alias for --max-hops", Commands = Set("impact") },
263+
new() { Name = "--depth", ValuePlaceholder = "<n>", Description = "Map: cap module depth; impact: deprecated alias for --max-hops", Commands = Set("impact", "map") },
260264
new() { Name = "--with-paths", Description = "Impact: include shortest call chains per caller", Commands = Set("impact") },
261265
new() { Name = "--reverse", Description = "Reverse direction (show dependents)", Commands = Set("deps") },
262266
new() { Name = "--group-by", ValuePlaceholder = "<symbol|file|statement>", Description = "Hotspots: choose grouping unit", Commands = Set("hotspots") },

src/CodeIndex/Cli/ConsoleUi.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ private static readonly (string Command, string Usage)[] CommandUsageLines =
8686
("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]"),
8787
("find", "cdidx find <query> --path <glob> [--db <path>] [--json] [--format <text|json|count|compact|csv|tsv|lsp|qf|sarif>] [--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]"),
8888
("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]"),
89-
("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>]"),
89+
("map", "cdidx map [--db <path>] [--json] [--verbose] [--limit <n>|--top <n>] [--lang <lang>] [--path <glob>] [--exclude-path <glob>] [--exclude-tests] [--bytes] [--sections <tree,languages,hotspots,metrics>] [--depth <n>] [--min-entrypoint-confidence <0.0..1.0>]"),
9090
("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]"),
9191
("outline", "cdidx outline <path> [--db <path>] [--json] [--verbose]"),
9292
("status", "cdidx status [--db <path>] [--json] [--verbose] [--check[=workspace,fold,graph,issues,hotspot,csharp,sql,newer]] [--stale-after <duration>] [--explain <field>] [--log-path] [--config] [--check-updates]"),
@@ -98,7 +98,7 @@ private static readonly (string Command, string Usage)[] CommandUsageLines =
9898
("report", "cdidx report --output <path> [--db <path>] [--json] [--log-lines <n>] [--no-log] [--include-args]"),
9999
("validate", "cdidx validate [--db <path>] [--json] [--format <text|json|count|compact|csv|tsv|lsp|qf|sarif>] [--verbose] [--kind <kind>] [--path <glob>]"),
100100
("impact", "cdidx impact <query>|--query <query>|-- <query> [--db <path>] [--json] [--verbose] [--limit <n>|--top <n>] [--lang <lang>] [--path <glob>] [--exclude-path <glob>] [--exclude-tests] [--body] [--snippet-lines <n>] [--max-line-width <n>] [--max-hops <n>] [--count] [--with-paths]"),
101-
("deps", "cdidx deps [--db <path>] [--json] [--verbose] [--limit <n>|--top <n>] [--lang <lang>] [--path <glob>] [--exclude-path <glob>] [--exclude-tests] [--reverse]"),
101+
("deps", "cdidx deps [--db <path>] [--json] [--format <dot|graphml|json-graph|edgelist>] [--verbose] [--limit <n>|--top <n>] [--lang <lang>] [--path <glob>] [--exclude-path <glob>] [--exclude-tests] [--reverse] [--cycles]"),
102102
("unused", "cdidx unused [--db <path>] [--json] [--verbose] [--limit <n>|--top <n>] [--kind <kind>] [--visibility <v[,v]>] [--exclude-visibility <v[,v]>] [--lang <lang>] [--path <glob>] [--exclude-path <glob>] [--exclude-tests] [--count]"),
103103
("hotspots", "cdidx hotspots [--db <path>] [--json] [--verbose] [--limit <n>|--top <n>] [--kind <kind>] [--visibility <v[,v]>] [--exclude-visibility <v[,v]>] [--lang <lang>] [--path <glob>] [--exclude-path <glob>] [--exclude-tests] [--count] [--group-by <symbol|file|statement>] [--group-by-name]"),
104104
("suggestions", "cdidx suggestions <list|show|export> [id] [--db <path>] [--json] [--status <all|submitted|unsubmitted>] [--language <lang>] [--category <category>] [--since <datetime>] [--agent <name>] [--format <json|markdown>]"),

0 commit comments

Comments
 (0)