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
24 changes: 24 additions & 0 deletions changelog.d/959.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
### Fixed
- **Polyglot Outlines Parse With Tree-Sitter (`devops ai read --inspect`, MCP `ai_read`, `devops_cli.ai.inspection`)**:
- The outlines of every non-Python file, at all three levels, came from the regex fallback alone and never from the tree-sitter grammars the project ships. That included a Python file that does not compile. They now come from one `TreeSitterEngine.parse_code` parse, which still falls back to the regex parser when a grammar finds nothing. Take a Rust file declaring `pub fn plain(x: i32)`, `pub fn process<T: Clone>(x: T) -> T`, `pub const fn c()` and `unsafe fn u()`. Its outline listed only `plain`, and `--symbol process` showed lines 1-4 of the file without saying the symbol was not found. All four functions are now listed, and `--symbol process` shows its own line (#959).
- A Level 1 skeleton line for a TypeScript, Go, Rust or Java function held only its parameter list, `(x: string, y: number)`, with no name or return type. It is now the declaration line, `export function a(x: string, y: number): Promise<void> {}` (#959).
- Level 0 lists every method. One whose class the file declares is listed under it, and any other among the functions: a Go method on a type declared in another file of the package as `Server.Close`, which was left out, and a C++ out-of-class definition by its qualified name, `Widget::draw` (#959).
- A C++ `.h` header was outlined as C. Its outline was labelled `c` and listed none of its classes or methods, so `--symbol` found none of them. A header is now outlined as C++ when its content uses C++ and as C otherwise, as `devops ai ast parse` reads it (#959).
- **Topology Token Counts Measure the Outline (`devops ai read --inspect --level 0`, `devops_cli.ai.inspection`)**:
- At Level 0, `outline_tokens` and `token_reduction_pct` were a guess: six tokens a symbol plus a one-line summary. The guess left out the docstrings, bases, method lists, exports and hotspots that the outline prints. Both now count the markdown the outline renders. The guess put `inspection.py`'s own topology at 291 tokens when it renders 1351, so it claimed a reduction of 96.4% against a real 83.2% (#959).
- **The Regex Fallback Signs and Finds Declarations as Tree-Sitter Does (`devops_cli.ai.ast.fallback`)**:
- The fallback now signs every symbol it finds with the line that declares its name, as the tree-sitter engine does. Before, a function or method held only its parameter list (TypeScript, Go, Rust, Java) or a rebuilt `(args) -> ret` (Python), and a class, struct, interface or Terraform block held no signature (#959).
- The fallback finds Rust functions with any qualifier the language allows (`const`, `async`, `safe`, `unsafe`, `extern "C"`) and with generics, `pub fn process<T: Clone>(x: T)`. It finds TypeScript functions with generics, `function f<T>(x: T)`, and declared as `export default function` (#959).
- **Tree-Sitter Gives Go Methods Their Type and Signs a Symbol With the Line That Names It (`devops ai ast parse`, `devops ai repomap --json`, MCP `ai_ast_parse`, `devops_cli.ai.ast.engine`)**:
- A Go method had no owner. It now belongs to the type its receiver names, through a pointer, type arguments or parentheses, as the regex fallback has it: `func (l *List[T]) Push(v T)` is `List`'s (#959).
- A symbol under a Java annotation, a C# attribute or a TypeScript decorator was signed with the annotation's line, `@Override` or `[HttpGet("{id}")]`, with no name or return type. It is now signed with the line that holds its name, `public String toString() {` (#959).

### Changed
- **`devops ai ast parse --query` Queries Only Files in a Known Language (`devops ai ast parse`)**:
- A file whose extension names no supported language was queried as Python. It now exits 1 with the error a plain parse gives (#959).
- **The `--level` Help Promises No Token Budget (`devops ai read`)**:
- The help described Level 0 as "<200 tokens", a figure only the guessed count supported. It now lists what the topology holds: classes, functions, exports and hotspots (#959).

### Security
- **`devops ai ast parse --query` Checks the Size Cap Before Reading (`devops ai ast parse`, MCP `ai_ast_parse`, `devops_cli.ai.ast.engine`)**:
- A plain parse refused a file over the AST size cap of 50 MiB, but `--query` read the whole file and passed it to the parser, so an MCP client could make the server read and parse a file of any size. The query now runs through the new `TreeSitterEngine.query_file`. It applies the plain parse's size check before reading the file and the same `.h` header detection. Over the cap, it exits 1 with the same "Unsupported language or file size exceeded" error (#959).
2 changes: 1 addition & 1 deletion docs/CLI_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3093,7 +3093,7 @@ devops ai read [OPTIONS] <target_path>
| Option / Flag | Type | Default | Description |
|---|---|---|---|
| `--inspect`, `-i` | `boolean` | - | Enable multi-scale semantic outline and inspection scanner. |
| `--level`, `-l` | `integer` | - | Focal zoom level: 0 (Topology: <200 tokens), 1 (Structural Outline: control flow & signatures), 2 (Deep Focal Window: line slice). |
| `--level`, `-l` | `integer` | - | Focal zoom level: 0 (Topology: classes, functions, exports & hotspots), 1 (Structural Outline: control flow & signatures), 2 (Deep Focal Window: line slice). |
| `--lines`, `-L` | `string` | - | Line range for Level 2 focal window (e.g. '40:80'). |
| `--symbol`, `-s` | `string` | - | Target symbol name to inspect or focus on. |
| `--format`, `-f` | `string` | `markdown` | Output format: 'text', 'markdown', or 'json'. |
Expand Down
Loading
Loading