@levnikolaevich/hex-line-mcp 1.14.1 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +55 -15
  2. package/dist/server.mjs +584 -154
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -32,14 +32,14 @@ Advanced / occasional:
32
32
 
33
33
  | Tool | Description | Key Feature |
34
34
  |------|-------------|-------------|
35
- | `read_file` | Read file with hash-annotated lines, checksums, revision, and automatic graph hints when available | Partial reads via `offset`/`limit` or `ranges`, compact output by default |
35
+ | `read_file` | Read file with progressive disclosure, optional edit-ready metadata, and automatic graph hints when available | Minimal plain discovery by default, explicit `edit_ready` for verified edits |
36
36
  | `edit_file` | Revision-aware anchor edits (`set_line`, `replace_lines`, `insert_after`, `replace_between`) | Batched same-file edits + conservative auto-rebase |
37
37
  | `write_file` | Create new file or overwrite, auto-creates parent dirs | Path validation, no hash overhead |
38
- | `grep_search` | Search with ripgrep, 3 output modes, per-group checksums | Plain `files`/`count`, compact edit-ready `content` |
38
+ | `grep_search` | Search with ripgrep, summary-first discovery, and optional edit-ready hunks | `summary` by default, explicit `content` + `edit_ready` for verified edits |
39
39
  | `outline` | AST-based structural overview with hash anchors via tree-sitter WASM. Supports JavaScript/TypeScript, Python, C#, PHP, and fence-aware markdown headings | 95% token reduction, direct edit anchors |
40
40
  | `verify` | Check if held checksums / revision are still current | Staleness check without full re-read |
41
- | `inspect_path` | Unified file-or-directory inspection | File metadata for files, tree or pattern search for directories |
42
- | `changes` | Compare file against git ref, shows added/removed/modified symbols | AST-level semantic diff |
41
+ | `inspect_path` | Unified file-or-directory inspection | Minimal tree discovery by default, deeper traversal on demand |
42
+ | `changes` | Compare file against git ref, shows added/removed/modified symbols | AST-level semantic diff with risk/provenance preview |
43
43
  | `bulk_replace` | Search-and-replace across multiple files inside an explicit root path | Compact summary (default) or capped diffs via `format`, dry_run, max_files |
44
44
 
45
45
  ### Hooks (SessionStart + PreToolUse + PostToolUse)
@@ -86,6 +86,15 @@ npm run lint
86
86
  npm run check
87
87
  ```
88
88
 
89
+ For the full MCP workspace regression pass from the repository root, run the package test scripts explicitly:
90
+
91
+ ```bash
92
+ npm --prefix mcp --workspace hex-common test
93
+ npm --prefix mcp --workspace hex-line-mcp test
94
+ npm --prefix mcp --workspace hex-graph-mcp test
95
+ npm --prefix mcp --workspace hex-ssh-mcp test:all
96
+ ```
97
+
89
98
  Maintainers can also run the internal scenario harness when they want reproducible repo-local workflow regressions:
90
99
 
91
100
  ```bash
@@ -93,7 +102,9 @@ npm run scenarios -- --repo /path/to/repo
93
102
  npm run scenarios:diagnostic -- --repo /path/to/repo
94
103
  ```
95
104
 
96
- Comparative built-in vs hex-line benchmarks are maintained outside this package.
105
+ The diagnostics run reports graph payload overhead and auto-refresh telemetry. Read those rows as engineering diagnostics, not as a compression score.
106
+
107
+ Comparative built-in vs hex-line benchmarks are maintained outside this package. External-baseline comparisons must reuse the same scenario suite and correctness contract before making broader claims.
97
108
 
98
109
  ### Optional Graph Enrichment
99
110
 
@@ -103,8 +114,16 @@ If a project already has `.hex-skills/codegraph/index.db`, `hex-line` automatica
103
114
  - Graph enrichment is project-deterministic. `hex-line` only uses the graph database that belongs to the resolved current project scope.
104
115
  - Nested projects do not inherit graph hints from a parent repo index once a nested project boundary is detected.
105
116
  - `better-sqlite3` is optional. If it is unavailable, `hex-line` still works without graph hints.
117
+ - `read_file` only emits the top-line `Graph:` header in `verbosity=full`.
118
+ - `grep_search` only emits line-level graph annotations in `output=content` when `editReady=true`. `summary`, `files`, `count`, and discovery-only content search stay graph-free.
119
+ - Grep annotations are capped and count-suffixes are deduplicated so the first label keeps the counts and later labels stay short.
106
120
  - `read_file`, `outline`, and `grep_search` stay compact: they only surface high-signal local facts such as `api`, framework entrypoints, callers, flow, and clone hints.
107
121
  - `edit_file` and `changes` surface the deeper review layer: external callers, downstream return/property flow, clone peers, public API risk, framework entrypoint risk, and same-name sibling warnings when present.
122
+ - Both tools now expose a short top-level preview before the detailed sections: `payload_sections`, `graph_enrichment`, count fields, and `provenance_summary`.
123
+ - Stale graph data never changes correctness. `hex-line` suppresses stale hints, schedules a best-effort `reindexFile(...)` for a stale file, and escalates to one background `indexProject(...)` when several files go stale inside the burst window.
124
+ - The threshold-crossing file still keeps its point refresh so a short stale burst does not create a blind gap before the project refresh finishes.
125
+ - `edit_file` may still use stale graph context as same-response advisory metadata when the file was just edited, but stale graph never gates the edit protocol itself.
126
+ - `npm run scenarios:diagnostic -- --with-graph` prints graph payload overhead plus an auto-refresh probe line with `suppressions`, `file_refresh`, `project_refresh`, and `threshold_hits`.
108
127
 
109
128
  `hex-line` does not read `hex-graph` internals directly anymore. The integration uses a small read-only contract exposed by `hex-graph-mcp`:
110
129
 
@@ -141,18 +160,32 @@ Use `bulk_replace` for text rename patterns across one or more files inside a kn
141
160
 
142
161
  ### read_file
143
162
 
144
- Read a file as canonical edit-ready blocks. Each valid range becomes a `read_range` block with absolute span, line entries, and a checksum covering exactly the emitted lines. Invalid ranges become explicit diagnostic blocks. Supports batch reads and multi-range reads. Directories go through `inspect_path`.
163
+ Read a file with progressive disclosure. Default mode is discovery-first: plain partial lines, low token cost, and optional continuation hints. When you need verified edits, pass `edit_ready: true` with `verbosity: "full"` to get canonical `read_range` blocks with anchors and checksums. Directories go through `inspect_path`.
145
164
 
146
165
  | Parameter | Type | Required | Description |
147
166
  |-----------|------|----------|-------------|
148
167
  | `path` | string | yes | File path |
149
168
  | `paths` | string[] | no | Array of file paths to read (batch mode) |
150
169
  | `offset` | number | no | Start line, 1-indexed (default: 1) |
151
- | `limit` | number | no | Max lines to return (default: 2000, 0 = all) |
170
+ | `limit` | number | no | Max lines to return (default: 200 for discovery, 2000 for edit-ready, 0 = all) |
152
171
  | `ranges` | array | no | Explicit line ranges, e.g. `[{ "start": 10, "end": 30 }]` |
153
172
  | `plain` | boolean | no | Omit hashes, output `lineNum\|content` instead |
173
+ | `verbosity` | enum | no | `minimal`, `compact`, or `full` |
174
+ | `edit_ready` | boolean | no | Include hash/checksum edit protocol blocks explicitly |
175
+
176
+ Default output is discovery-first:
177
+
178
+ ```text
179
+ File: lib/search.mjs
180
+ meta: 282 lines, 10.2KB, 2 hours ago
181
+ continuation: {"kind":"offset","offset":4,"limit":200}
182
+
183
+ 1|import { resolve } from "node:path";
184
+ 2|import { readFileSync } from "node:fs";
185
+ 3|...
186
+ ```
154
187
 
155
- Default output is compact but block-structured:
188
+ Explicit edit-ready output:
156
189
 
157
190
  ```
158
191
  File: lib/search.mjs
@@ -210,6 +243,11 @@ Result footer includes:
210
243
  - `reason: ...` as the canonical machine-readable cause for the current status
211
244
  - `revision: ...`
212
245
  - `file: ...`
246
+ - `summary: ...` with edited line span / diff counts on successful edits
247
+ - `payload_sections: ...` so callers know which detailed sections follow
248
+ - `graph_enrichment: available | unavailable`
249
+ - `semantic_impact_count: ...`, `semantic_fact_count: ...`, and `clone_warning_count: ...` when graph-backed review data is available
250
+ - `provenance_summary: ...` for the edit protocol + optional graph source
213
251
  - `changed_ranges: ...` when relevant
214
252
  - `recovery_ranges: ...` with the narrowest recommended `read_file` ranges for retry
215
253
  - `next_action: ...` as the canonical immediate choice: `apply_retry_edit`, `apply_retry_batch`, or `reread_then_retry`
@@ -219,7 +257,7 @@ Result footer includes:
219
257
  - `retry_edits: ...` on conservative batch conflicts when every conflicted edit can be retried directly
220
258
  - `suggested_read_call: ...` when rereading is the safest next step
221
259
  - `retry_plan: ...` with a compact machine-readable next-call plan
222
- - `summary: ...` and `snippet: ...` instead of long prose blocks
260
+ - `summary: ...` and `snippet: ...` instead of long prose blocks on conflicts
223
261
  - `edit_conflicts: N` on conservative multi-edit preflight conflicts
224
262
 
225
263
  ### write_file
@@ -234,7 +272,7 @@ Create a new file or overwrite an existing one. Creates parent directories autom
234
272
 
235
273
  ### grep_search
236
274
 
237
- Search file contents using ripgrep. Three output modes: `content` (canonical `search_hunk` blocks), `files` (plain path list), `count` (plain `file:count` list).
275
+ Search file contents using ripgrep. Default mode is `summary` for discovery. Use `content` with `edit_ready: true` when you need canonical `search_hunk` blocks for verified edits. `files` and `count` stay plain list modes.
238
276
 
239
277
  | Parameter | Type | Required | Description |
240
278
  |-----------|------|----------|-------------|
@@ -242,7 +280,7 @@ Search file contents using ripgrep. Three output modes: `content` (canonical `se
242
280
  | `path` | string | no | Directory or file to search (default: cwd) |
243
281
  | `glob` | string | no | Glob filter, e.g. `"*.ts"` |
244
282
  | `type` | string | no | File type filter, e.g. `"js"`, `"py"` |
245
- | `output` | enum | no | Output format: `"content"` (default), `"files"`, `"count"` |
283
+ | `output` | enum | no | Output format: `"summary"` (default), `"content"`, `"files"`, `"count"` |
246
284
  | `case_insensitive` | boolean | no | Ignore case |
247
285
  | `smart_case` | boolean | no | CI when lowercase, CS when uppercase (`-S`) |
248
286
  | `literal` | boolean | no | Literal string search, no regex (`-F`) |
@@ -250,11 +288,12 @@ Search file contents using ripgrep. Three output modes: `content` (canonical `se
250
288
  | `context` | number | no | Symmetric context lines around matches (`-C`) |
251
289
  | `context_before` | number | no | Context lines BEFORE match (`-B`) |
252
290
  | `context_after` | number | no | Context lines AFTER match (`-A`) |
253
- | `limit` | number | no | Max matches per file (default: 100) |
254
- | `total_limit` | number | no | Total match events across all files; multiline matches count as 1 (default: 200 for `content`, 1000 for `files`/`count`, 0 = unlimited) |
291
+ | `limit` | number | no | Max matches per file (default: 20 for `summary`, 100 for `content`) |
292
+ | `total_limit` | number | no | Total match events across all files; multiline matches count as 1 (default: 50 for `summary`, 200 for `content`, 1000 for `files`/`count`, 0 = unlimited) |
255
293
  | `plain` | boolean | no | Omit hash tags inside block entries, return `lineNum\|content` |
294
+ | `edit_ready` | boolean | no | Preserve hash/checksum search hunks in `content` mode |
256
295
 
257
- `content` mode returns canonical `search_hunk` blocks with per-hunk checksums enabling direct `replace_lines` from grep results without intermediate `read_file`.
296
+ `summary` mode returns counts, top files, and a few plain snippets. `content` mode returns canonical `search_hunk` blocks with per-hunk checksums enabling direct `replace_lines` from grep results without intermediate `read_file`.
258
297
 
259
298
  ### outline
260
299
 
@@ -303,9 +342,10 @@ Inspect a file or directory path without guessing which low-level tool to call f
303
342
  | `path` | string | yes | File or directory path |
304
343
  | `pattern` | string | no | Glob filter on names (e.g. `"*-mcp"`, `"*.mjs"`). Returns flat match list instead of tree |
305
344
  | `type` | string | no | `"file"`, `"dir"`, or `"all"` (default). Like `find -type f/d` |
306
- | `max_depth` | number | no | Max recursion depth (default: 3, or 20 in pattern mode) |
345
+ | `max_depth` | number | no | Max recursion depth (default: 2 for discovery, or 20 in pattern mode) |
307
346
  | `gitignore` | boolean | no | Respect root .gitignore patterns (default: true). Nested .gitignore not supported |
308
347
  | `format` | string | no | `"compact"` = shorter path view. `"full"` = include sizes / metadata where available |
348
+ | `verbosity` | enum | no | `minimal`, `compact`, or `full` |
309
349
 
310
350
  - For regular files it returns compact metadata: size, line count when cheap, modification time, type, and binary flag.
311
351
  - For directories it returns a gitignore-aware tree.