opengrok-mcp-server 3.3.3
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.
- package/CHANGELOG.md +460 -0
- package/CONTRIBUTING.md +281 -0
- package/LICENSE +131 -0
- package/MCP_CLIENTS.md +348 -0
- package/README.md +234 -0
- package/images/icon.png +0 -0
- package/out/extension.js +1 -0
- package/out/server/main.js +255 -0
- package/out/webview/configManager.html +759 -0
- package/package.json +157 -0
- package/scripts/build-vsix.js +47 -0
- package/scripts/generate-release-notes.js +70 -0
- package/scripts/install.sh +136 -0
- package/scripts/opengrok-mcp-wrapper.cmd +5 -0
- package/scripts/opengrok-mcp-wrapper.ps1 +377 -0
- package/scripts/opengrok-mcp-wrapper.sh +379 -0
- package/scripts/package-server.js +140 -0
- package/scripts/release.ps1 +137 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the OpenGrok MCP extension will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## Highlights
|
|
9
|
+
|
|
10
|
+
### ๐ง v3.0 โ Code Intelligence Engine
|
|
11
|
+
|
|
12
|
+
6 new compound tools, ~92% fewer tokens, full OpenGrok 1.7.x support, and a zero-config local source layer that knows your compiler flags. The largest update since the original rewrite.
|
|
13
|
+
|
|
14
|
+
- ๐ **v3.1** โ Auto-update notifications. One click in VS Code, no manual downloads.
|
|
15
|
+
- ๐ **v3.2** โ Standalone MCP server. One-command installer, cross-platform credential wrappers, no VS Code required.
|
|
16
|
+
- ๐ก๏ธ **v3.3** โ Security hardening, 100% code coverage, Node 24, enterprise-grade quality. 476 tests, zero audit findings.
|
|
17
|
+
|
|
18
|
+
### ๐ v2.0 โ Full TypeScript Rewrite
|
|
19
|
+
|
|
20
|
+
Native MCP integration, OS keychain credentials, 8 OpenGrok tools, SSRF protection, and 45 unit tests. The foundation everything else is built on.
|
|
21
|
+
|
|
22
|
+
- ๐จ **v2.1** โ Brand-new Configuration Manager UI. Dark/light mode, auto-test on save, no more setup prompts.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## [3.3.3] - 2026-03-14
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- **Security: bump `undici` to 7.24.2** โ addressed multiple high/moderate severity CVEs including WebSocket 64-bit length overflow (GHSA-f269-vfmq-vjvj), HTTP request/response smuggling (GHSA-2mjp-6q6p-2qxm), unbounded memory consumption in WebSocket permessage-deflate decompression (GHSA-vrm6-8vpv-qv8q), unhandled exception in WebSocket client (GHSA-v9p9-hfj2-hcw8), and CRLF injection via `upgrade` option (GHSA-4992-7rv2-5pvq).
|
|
31
|
+
- **Fix `testConnection` test**: mock updated to return a JSON array (matching the real `/api/v1/projects` endpoint) instead of HTML, fixing a false-negative assertion..
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## [3.3.2] - 2026-03-09
|
|
36
|
+
|
|
37
|
+
### Fixed
|
|
38
|
+
|
|
39
|
+
- **`get_file_content` shows wrong line numbers when `start_line` is used**: The formatter always displayed lines as `1, 2, 3...` regardless of the `start_line` parameter, making it hard to correlate output with the actual file. Root cause: `FileContent` had no `startLine` field, so `formatFileContent` had no offset to start from. Fixed by adding `startLine?: number` to the `FileContent` interface and populating it in all three code paths (`client.ts` API read, `server.ts` local abs-path read, `server.ts` local root read). The formatter now numbers lines from `startLine` (e.g., a `start_line=60` request shows `60 | ...`, `61 | ...`, etc.).
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## [3.3.1] - 2026-03-09
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
|
|
47
|
+
- **`get_file_annotate` shows blame markers instead of source code on OpenGrok 1.7.x**: In the real 1.7.x annotate HTML format, source code lines appear as sibling nodes *after* `<span class="blame">`, not inside it. The performance refactor in v3.3.0 introduced a regression: `el.text` on the blame span returned the blame anchor text (`851c8156SRudra Roy`) instead of the actual source line. Fixed with index-based parent `childNodes` iteration (since `TextNode.nextSibling` is unreliable in `node-html-parser`). Also added `content` assertions to the OpenGrok 1.7.x annotate parser test.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## [3.3.0] - 2026-03-09
|
|
52
|
+
|
|
53
|
+
### ๐ก๏ธ Security Hardening
|
|
54
|
+
|
|
55
|
+
- **Content Security Policy**: Added CSP `<meta>` tags to the Configuration Manager webview and inline fallback HTML, restricting script/style sources to nonces.
|
|
56
|
+
- **XSS prevention**: Replaced `innerHTML` with `textContent` for toast notification messages in the Configuration Manager.
|
|
57
|
+
- **Cross-origin redirect blocking**: `downloadToFile()` (used by auto-updater) now rejects cross-origin redirects and protocol downgrades (HTTPS โ HTTP).
|
|
58
|
+
- **Removed global TLS bypass**: Removed `NODE_TLS_REJECT_UNAUTHORIZED=0` env var mutation; SSL verification is now controlled solely by the `verifySsl` setting.
|
|
59
|
+
- **ReDoS guard**: `listProjects` filter input is capped at 100 characters and rejects patterns with 3+ consecutive wildcards.
|
|
60
|
+
- **Error message sanitization**: Filesystem paths are stripped from error messages returned to the LLM to prevent path disclosure.
|
|
61
|
+
- **Wrapper script key derivation**: Added random salt to AES key derivation in bash and PowerShell credential wrappers, with automatic migration from unsalted keys. Added `.env` file TTL warnings.
|
|
62
|
+
|
|
63
|
+
### โก Performance
|
|
64
|
+
|
|
65
|
+
- **Singleton HTTP agent**: Reuse a single `undici.Agent` instead of creating one per request (eliminates socket leaks under sustained load).
|
|
66
|
+
- **Async local layer I/O**: Converted all `fs.realpathSync` / `fs.readFileSync` calls in the local layer to async (`fsp.realpath`, `fsp.readFile`).
|
|
67
|
+
- **O(1) compile index lookups**: `resolveFileFromIndex()` now uses a pre-built suffix index instead of linear scan.
|
|
68
|
+
- **Single-pass parsers**: `parseFileSymbols()` and `parseAnnotate()` rewritten as single-pass (eliminated double HTML parses).
|
|
69
|
+
- **Fast string operations**: `extractLineRange()` replaced `split/slice/join` with `indexOf`-based extraction; `capResponse()` uses `Buffer.byteLength` fast path.
|
|
70
|
+
- **Probabilistic cache eviction**: TTL cache evicts expired entries every 10th write instead of every write.
|
|
71
|
+
- **Cached annotate style**: The annotation endpoint style (REST vs. xref fallback) is cached after the first successful call per session.
|
|
72
|
+
|
|
73
|
+
### ๐๏ธ Architecture & Code Quality
|
|
74
|
+
|
|
75
|
+
- **Tool definitions extracted** (`tool-schemas.ts`): Tool definitions are now generated from Zod schemas via `zod-to-json-schema` in a dedicated module, replacing the hand-maintained JSON schemas that were inline in `server.ts`.
|
|
76
|
+
- **Server refactored**: Three long `dispatchTool` handler cases (`search_and_read`, `get_symbol_context`, `get_compile_info`) extracted into standalone functions โ the switch case shrank by ~260 lines.
|
|
77
|
+
- **ESLint flat config** (`eslint.config.mjs`): Added `typescript-eslint` + Prettier integration. `npm run lint` now runs both `tsc --noEmit` and ESLint.
|
|
78
|
+
- **Centralized logger** (`logger.ts`): All modules use a structured logger with `[INFO]`/`[WARN]`/`[ERROR]` prefixes; raw `console.error` calls eliminated.
|
|
79
|
+
- **Config hardening**: NaN-safe integer parsing via `zIntString` helper for all 9 numeric env vars. `Config` object frozen after construction.
|
|
80
|
+
- **Zod 4 upgrade**: Migrated from Zod 3 to Zod 4 with `zod-to-json-schema` for tool input schemas.
|
|
81
|
+
- **Node 24**: Runtime upgraded from Node 22 to Node 24. All dependencies updated to latest (undici 7.22, esbuild 0.25, vitest 4, typescript-eslint 8).
|
|
82
|
+
|
|
83
|
+
### ๐จ UI Improvements
|
|
84
|
+
|
|
85
|
+
- **Configuration Manager accessibility**: Improved HTML structure with proper semantic elements, ARIA attributes, and keyboard navigation in the webview panel.
|
|
86
|
+
|
|
87
|
+
### ๐งช Tests โ 100% Code Coverage
|
|
88
|
+
|
|
89
|
+
- **476 tests passing** (up from 123 in v3.2.1) โ **100% statement, branch, function, and line coverage** across all metrics.
|
|
90
|
+
- 10 new test files: `branch-coverage.test.ts`, `branch-targets.test.ts`, `client-extended.test.ts`, `client-internals.test.ts`, `coverage-gaps.test.ts`, `formatters-extended.test.ts`, `logger.test.ts`, `main.test.ts`, `parsers-extended.test.ts`, `server-coverage.test.ts`, `server-dispatch.test.ts`, `server-extended.test.ts`.
|
|
91
|
+
- Test fixtures updated to match real OpenGrok 1.7.x HTML output.
|
|
92
|
+
- CI pipeline now reports coverage metrics via Vitest's `v8` coverage provider.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## [3.2.1] - 2026-03-09
|
|
97
|
+
|
|
98
|
+
### Fixed
|
|
99
|
+
- **VSIX download fails with "not a zip file" error**: artifact URLs (`/-/jobs/artifacts/.../raw/...`) redirected unauthenticated requests to a sign-in page. The download URL was rewritten to the provider API equivalent (`/api/v4/projects/.../jobs/artifacts/.../raw/...`) that accepts auth headers correctly. Auth headers are also stripped on any cross-host redirects to avoid leaking them to CDN/S3 servers.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## [3.2.0] - 2026-03-09
|
|
104
|
+
|
|
105
|
+
### โจ New Features
|
|
106
|
+
|
|
107
|
+
- **Standalone MCP server distribution**: The server binary is now packaged into platform archives (`-linux.tar.gz`, `-darwin.tar.gz`, `-win.zip`) and attached to every release, so developers can use it without VS Code from any MCP-compatible client (Claude Code, Cursor, Windsurf, Claude Desktop, OpenCode, etc.).
|
|
108
|
+
|
|
109
|
+
- **One-command installer** (`scripts/install.sh`): Detects OS, pulls the correct archive from the latest release, and installs to `~/.local/bin`. Respects `HTTPS_PROXY` and `OPENGROK_MCP_VERSION` for pinned versions.
|
|
110
|
+
|
|
111
|
+
- **Credential wrapper scripts**: Cross-platform wrapper scripts (`opengrok-mcp-wrapper.sh` / `.ps1` / `.cmd`) handle secure credential storage and injection. Credentials are never written as plaintext โ stored in the OS keychain (macOS), Secret Service (Linux), or Windows Credential Manager, with an AES-256-CBC encrypted file fallback for headless environments. An interactive `--setup` mode guides first-time configuration.
|
|
112
|
+
|
|
113
|
+
- **`--version` flag**: `opengrok-mcp --version` (or `-v`) now prints the version and exits, enabling health checks and wrapper pre-flight validation.
|
|
114
|
+
|
|
115
|
+
- **Updated `MCP_CLIENTS.md`**: Comprehensive setup guide covering all supported clients with both wrapper-based quick start and manual (env var) fallback instructions.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## [3.1.0] - 2026-03-08
|
|
120
|
+
|
|
121
|
+
### โจ New Features
|
|
122
|
+
|
|
123
|
+
- **Auto-update notifications**: The extension checks the releases API on activation (throttled to once per 24 hours) for newer stable versions. When an update is found, a notification offers to download the `.vsix` and install it automatically โ no manual download required. Pre-release tags (`beta`, `alpha`, `rc`) are skipped. Authentication is handled through VS Code's authentication API.
|
|
124
|
+
|
|
125
|
+
- **"OpenGrok: Check for Updates" command**: New Command Palette entry and status bar menu item to manually trigger an update check at any time. Triggers a sign-in prompt if not already authenticated.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## [3.0.1] - 2026-03-08
|
|
130
|
+
|
|
131
|
+
### Fixed
|
|
132
|
+
- `get_file_annotate` now shows per-line blame instead of collapsing consecutive same-author lines
|
|
133
|
+
- `list_projects` filter works as substring match (e.g. `release` matches all `release-*` projects)
|
|
134
|
+
- Renamed `get_compile_info` parameter `file_path` โ `path` for consistency with other tools
|
|
135
|
+
- Added AI hints to MCP instructions to prevent common parameter mistakes
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## [3.0.0] - 2026-03-08
|
|
140
|
+
|
|
141
|
+
### ๐ The Big One โ OpenGrok Gets a Brain
|
|
142
|
+
|
|
143
|
+
v3.0 is the largest update since the original TypeScript rewrite. It transforms OpenGrok from a basic "fetch this file" tool into a full code intelligence engine for Copilot Chat.
|
|
144
|
+
|
|
145
|
+
**6 new tools** โ The headline additions are `get_symbol_context`, `search_and_read`, `batch_search`, `get_file_symbols`, `get_compile_info`, and `index_health`. The star of the show is `get_symbol_context`: give it a symbol name and it returns the definition, the header declaration, and every call site โ all in a single round-trip. That's a ~92% token reduction compared to the old manual workflow.
|
|
146
|
+
|
|
147
|
+
**Your compiler joins the conversation** โ If your workspace has a `compile_commands.json`, the extension auto-discovers it and enables `get_compile_info`. Ask Copilot "what flags does this file compile with?" and get back exact include paths, defines, and the language standard. Zero configuration required.
|
|
148
|
+
|
|
149
|
+
**Every symbol in a file, at a glance** โ `get_file_symbols` lists all functions, classes, macros, enums, structs, and typedefs in a file. Works even on OpenGrok instances that block the REST API โ it falls back to parsing the web UI directly.
|
|
150
|
+
|
|
151
|
+
**Massively smarter formatting** โ Responses are capped at 16 KB (no more blowing up Copilot's context window), search output is compact one-line-per-result, and all search tools now support a `file_type` filter and `hist` search type for commit messages.
|
|
152
|
+
|
|
153
|
+
**OpenGrok 1.7.x fully supported** โ Fixed a slew of compatibility issues: annotate 404s, broken blame parsing, empty directory listings, and defs/refs searches returning errors. If it works in the browser, it works through this extension now.
|
|
154
|
+
|
|
155
|
+
> For the full technical details, see the beta changelogs below (beta.1 through beta.4).
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## [3.0.0-beta.4] - 2026-03-08
|
|
160
|
+
|
|
161
|
+
### โจ New Features
|
|
162
|
+
|
|
163
|
+
- **`get_file_symbols` tool** (`server.ts`, `client.ts`, `parsers.ts`, `formatters.ts`, `models.ts`): new tool that lists all top-level symbols (functions, classes, macros, enums, structs, typedefs) defined in a file. Tries the `/api/v1/file/defs` REST endpoint first; falls back to parsing the xref HTML page for `data-definition-place="def"` `intelliWindow-symbol` links when the REST endpoint returns 401 (as on some OpenGrok instances). CSS class mapping: `xf`โfunction, `xm`โmacro, `xc`โclass, `xe`โenum, `xs`โstruct, `xt`โtypedef. Extracts line numbers and scope signatures. Integrates with `get_symbol_context` as an optional Step 2.5.
|
|
164
|
+
|
|
165
|
+
### ๐ Bug Fixes
|
|
166
|
+
|
|
167
|
+
- **Config Manager UI overflows small windows** (`configManager.html`): the webview panel was overflowing vertically on small screens and short windows, cutting off the Save button. Fixed with `min-height: 100vh` on body, `justify-content: safe center` on the flex container, `flex-shrink: 0` on the glass panel, and three responsive breakpoints (`@media (max-height: 700px)`, `(max-height: 520px)`, `(max-width: 500px)`) to scale down padding and font sizes.
|
|
168
|
+
|
|
169
|
+
- **Tool selection reset on every window open** (`extension.ts`): `workbench.action.chat.mcp.resetCachedTools` was being invoked inside `activate()` on every extension activation (i.e., every time a new VS Code window opened). This caused Copilot Chat to reset its enabled-tools list, forcing the user to re-tick every OpenGrok tool after opening a new folder. Fixed by removing the `resetCachedTools` call from `activate()` and `testConnection()`.
|
|
170
|
+
|
|
171
|
+
- **`command 'workbench.action.chat.mcp.resetCachedTools' not found`** (`extension.ts`): the internal VS Code command used to notify Copilot of MCP server changes does not exist in all VS Code versions, producing a logged error on every configuration save and version update. Replaced all uses with the official `onDidChangeMcpServerDefinitions` event API: added a `_onDidChange` `EventEmitter` to `OpenGrokMcpProvider`, a `fireChanged()` method, a module-level `mcpProvider` variable, and a `notifyMcpServerChanged()` helper. The event fires only on version update and configuration save.
|
|
172
|
+
|
|
173
|
+
### ๐งช Tests
|
|
174
|
+
|
|
175
|
+
- **123 tests passing** (up from 106)
|
|
176
|
+
- 9 new `parseFileSymbols` tests: type mapping, line numbers, scope signatures, HTML entity decoding, local/argument exclusion, empty input, no-def anchors
|
|
177
|
+
- 8 new `formatFileSymbols` tests: grouped output, unknown types, empty input
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## [3.0.0-beta.3] - 2026-03-07
|
|
182
|
+
|
|
183
|
+
### โจ New Features
|
|
184
|
+
|
|
185
|
+
- **Zero-config local layer**: The extension now auto-discovers `compile_commands.json` files from all VS Code workspace folders using `vscode.workspace.findFiles`. No manual configuration is needed โ open a workspace that contains a build tree and the local layer enables itself automatically.
|
|
186
|
+
|
|
187
|
+
- **`inferBuildRoot()` function**: New helper in `compile-info.ts` that derives the build root as the longest common path prefix of all `directory` entries across the discovered `compile_commands.json` files. This correctly handles build trees where sources are compiled across multiple subdirectories.
|
|
188
|
+
|
|
189
|
+
- **`OPENGROK_LOCAL_COMPILE_DB_PATHS` env var**: Replaced `OPENGROK_LOCAL_BUILD_ROOT`. Accepts a comma-separated list of absolute paths to `compile_commands.json` files. Used by standalone (non-VS Code) deployments to explicitly provide compile databases.
|
|
190
|
+
|
|
191
|
+
- **`get_file_content` local bypass โ compile index path resolution** (`server.ts`): fixed the transparent local read to actually work when the local source tree path differs from the OpenGrok-relative path. Previously `tryLocalRead` only did a path-join of the OpenGrok path against configured roots, which fails when the workspace is an rsync of a deep subtree (e.g. `/home/user/code/myproject`) rather than a mirror of the full build tree. Now the bypass uses a two-tier lookup:
|
|
192
|
+
1. **Compile index hit** (`resolveFileFromIndex`): suffix-matches the OpenGrok path (e.g. `project/source/module/Foo.cpp`) against the absolute paths already stored in the compile index from `compile_commands.json` `file` fields (e.g. `/build/project/source/module/Foo.cpp`). Reads directly from the authoritative build-tree path. No root inference needed.
|
|
193
|
+
2. **Path-join fallback** (`tryLocalRead`): unchanged, catches header files (`.h`/`.hpp`) that are not compiled units and therefore not present in the compile index.
|
|
194
|
+
|
|
195
|
+
### ๐๏ธ Removed
|
|
196
|
+
|
|
197
|
+
- **`opengrok-mcp.local.buildRoot` VS Code setting**: No longer needed. The build root is now inferred automatically from the `directory` fields in discovered compile databases.
|
|
198
|
+
|
|
199
|
+
- **"Local Source Layer" panel** in Configuration Manager: Removed the Build Root input and Save Local Settings button. The local layer is fully zero-config.
|
|
200
|
+
|
|
201
|
+
### ๐ Bug Fixes
|
|
202
|
+
|
|
203
|
+
- **"What's new" notification loop** (`extension.ts`): the update notification was reappearing on every VS Code reload after a version upgrade. Root cause: `context.globalState.update('extensionVersion', currentVersion)` was called *after* `vscode.window.showInformationMessage`, which is an awaited call that can complete after the extension reloads. This meant the version was never persisted before the next activation, so the notification fired again. Fixed by moving the `globalState.update` call to before the version comparison.
|
|
204
|
+
|
|
205
|
+
- **`get_file_annotate` always 404 on OpenGrok 1.7.x** (`client.ts`): `getAnnotate()` was hardcoded to hit the `/annotate/<project>/<path>` endpoint which only exists in OpenGrok 1.12+. On 1.7.x this always returns HTTP 404. Fixed with a try/catch that attempts `/annotate/` first and falls back to `/xref/<project>/<path>?a=true` (the 1.7.x annotation URL).
|
|
206
|
+
|
|
207
|
+
- **`get_file_annotate` blame parser wrong on OpenGrok 1.7.x** (`parsers.ts`): three bugs in `parseAnnotate()` caused every blame line to produce empty revision/author/date even when the HTML contained full blame data. Root causes: (1) OpenGrok 1.7.x puts the `title` attribute on the child `<a class="r">` element, not on `<span class="blame">` itself โ the parser was only checking the span. (2) The `title` format uses `changeset:` not `revision:` and `user:` not `author:`. (3) Field values are separated by ` ` (decoded to `\u00a0`) not plain spaces. All three are now handled; the parser accepts both old and new title formats.
|
|
208
|
+
|
|
209
|
+
- **`search_suggest` empty-index diagnostic** (`server.ts`): when the OpenGrok suggester index has not been built, the API returns `time: 0` in the response. The tool now surfaces a descriptive message in this case instead of the generic "No suggestions found."
|
|
210
|
+
|
|
211
|
+
### ๐งช Tests
|
|
212
|
+
|
|
213
|
+
- **106 tests passing** (up from 105)
|
|
214
|
+
- 1 new `parseAnnotate` test: real OpenGrok 1.7.x annotate HTML with `changeset:`/`user:`/` ` title format (child `<a class="r">` element)
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## [3.0.0-beta.2] - 2026-03-07
|
|
219
|
+
|
|
220
|
+
### ๐ Bug Fixes
|
|
221
|
+
|
|
222
|
+
- **History parser** (`parseFileHistory`): fixed incorrect revision extraction. OpenGrok 1.7.x emits two `<a>` tags per revision cell โ a `#` anchor link followed by the actual hash link. The parser was grabbing the first one, stripping `#`, and producing an empty string, which caused all history entries to be silently skipped. Now selects the last non-`#` link text, falling back to raw cell text.
|
|
223
|
+
|
|
224
|
+
- **Directory listing parser** (`parseDirectoryListing`): fixed empty results on real OpenGrok HTML. The actual table structure has an icon cell (`<p class="r"/>`) in `cells[0]` with no link; the entry name is in `cells[1]`. The parser was only looking in `cells[0]` and found nothing. Also fixed relative href handling โ real OpenGrok emits relative hrefs (e.g. `DistributedIDA/`) instead of absolute `/xref/project/โฆ` paths; these are now joined with the current browse path.
|
|
225
|
+
|
|
226
|
+
### โจ New Features
|
|
227
|
+
|
|
228
|
+
- **`defs`/`refs` web search fallback**: OpenGrok 1.7.x REST API (`/api/v1/search?defs=โฆ`) returns HTTP 400 for `defs` and `refs` search types. The client now automatically falls back to the web search endpoint (`/search?defs=โฆ`) and parses the HTML response. This makes `search_code(search_type=defs)`, `get_symbol_context`, and all tools that use defs/refs fully functional against OpenGrok 1.7.x instances.
|
|
229
|
+
|
|
230
|
+
- **`file_type` filter** (`search_code`, `batch_search`, `search_and_read`, `get_symbol_context`): new optional parameter restricts results to a specific language. Common values: `cxx` (C++), `c`, `java`, `python`, `javascript`, `typescript`, `csharp`, `golang`, `ruby`, `perl`, `sql`, `xml`, `yaml`, `shell`, `makefile`. Passed as `?type=<value>` to the REST API or `?type=<value>` to the web search fallback.
|
|
231
|
+
|
|
232
|
+
- **`hist` search type** (`search_code`, `batch_search`, `search_and_read`): new enum value for `search_type`. Searches commit messages and change history via `/api/v1/search?hist=โฆ`. Use this to find when a feature was introduced or who last touched a subsystem.
|
|
233
|
+
|
|
234
|
+
- **Default project** (`OPENGROK_DEFAULT_PROJECT`): new config variable. When a search tool is called without an explicit `projects` argument, this project is applied automatically. Overrideable per-call by passing `projects`. The MCP server instructions block also tells the LLM to use the configured default project.
|
|
235
|
+
|
|
236
|
+
### ๐งช Tests
|
|
237
|
+
|
|
238
|
+
- **99 tests passing** (up from 95)
|
|
239
|
+
- 4 new tests: real-world OpenGrok history HTML with two `<a>` per cell, real-world directory listing with icon cell and relative hrefs, web search HTML results parser for defs, web search HTML results parser for refs
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## [3.0.0-beta.1] - 2026-03-07
|
|
244
|
+
|
|
245
|
+
This release is the result of a full token-optimization sprint. The headline number: **~92% fewer tokens** on typical codebase investigations compared to v2.x. That means Copilot Chat gets more done per context window, costs less, and produces better answers because it's no longer drowning in bloated tool responses.
|
|
246
|
+
|
|
247
|
+
> **Beta note:** All features are implemented and fully tested (95/95 tests passing). The beta label reflects that production telemetry is still being gathered. Breaking output format changes from v2.x are intentional.
|
|
248
|
+
|
|
249
|
+
### ๐ New Tools โ Compound Operations
|
|
250
|
+
|
|
251
|
+
Four new high-efficiency tools that collapse multi-step workflows into a single MCP call:
|
|
252
|
+
|
|
253
|
+
- **`batch_search`** โ Execute up to 5 OpenGrok searches in parallel in a single call. Before this, Copilot would fire `search_code` 3โ5 times sequentially for any multi-angle investigation (search by defs, then refs, then full text). Now it's one round trip. Each query has its own `search_type` and `max_results`. This alone turns `~4,500 tokens โ ~1,200 tokens` for a 3-query investigation.
|
|
254
|
+
|
|
255
|
+
- **`search_and_read`** โ Combined search + contextual file read in one call. Previously: `search_code` returns a hit, Copilot then calls `get_file_content` on the full file (often 1,500+ lines). Now: search + surrounding context lines come back together, capped at 8 KB total. Result: `search(500) + full_file(24,000) โ search_and_read(~1,500)` โ **~92% reduction**.
|
|
256
|
+
|
|
257
|
+
- **`get_symbol_context`** โ The big one. Complete symbol investigation in a single call: (1) find the definition, (2) fetch context lines around it, (3) if it's a `.cpp` file, automatically locate and fetch the corresponding `.h`/`.hpp` header, (4) return reference samples. What used to take 4โ5 sequential tool calls (~36,500 tokens) now costs one call (~2,800 tokens) โ **~92% reduction**. This is the right first call for any unknown C++ symbol, class, or function.
|
|
258
|
+
|
|
259
|
+
- **`index_health`** โ Lightweight diagnostic: tests the OpenGrok connection, measures latency, and reports back in one line. Use this if search results seem stale or incomplete before wasting tokens on failed queries.
|
|
260
|
+
|
|
261
|
+
### ๐๏ธ Formatter Rewrites โ Compact Output Formats
|
|
262
|
+
|
|
263
|
+
Every response formatter was rewritten to strip decorative markdown and maximize information density:
|
|
264
|
+
|
|
265
|
+
- **Search results** (`search_code`, `find_file`): replaced multi-line markdown blocks (headings, `**Project:**` labels, `` ``` `` fences, `[View in OpenGrok]()` links) with one-liner-per-match: `path (project) Lline: content`. **~75% token reduction** per result set.
|
|
266
|
+
|
|
267
|
+
- **File content** (`get_file_content`): added smart truncation โ full-file reads without `start_line`/`end_line` are capped at 200 lines (configurable via `OPENGROK_MAX_INLINE_LINES`). The truncation message tells Copilot exactly what to do: `*Showing first N of M lines. Use start_line/end_line to read specific sections.*` **~70% reduction** on blind file reads.
|
|
268
|
+
|
|
269
|
+
- **File history** (`get_file_history`): replaced markdown tables with dense one-liners: `[abc1234] user (2026-03-05): "Fix connection leak"`. Revision truncated to 8 chars, author email stripped. **~90% reduction**.
|
|
270
|
+
|
|
271
|
+
- **Directory listing** (`browse_directory`): removed ๐/๐ emojis and `### Directories`/`### Files` subheadings. Now: `DIR src/` and `FILE config.ts (1,234 bytes)`, directories sorted first. **~50% reduction**.
|
|
272
|
+
|
|
273
|
+
- **Annotate/blame** (`get_file_annotate`): consecutive lines with the same revision + author are grouped into ranges (`abc1234 user L10-L25: <content>`). Default cap reduced from 100 lines to 50 for full-file views. **~70% reduction**.
|
|
274
|
+
|
|
275
|
+
### ๐ง Behavioral Improvements
|
|
276
|
+
|
|
277
|
+
- **`get_file_annotate` line ranges**: Added `start_line`/`end_line` parameters. Copilot can now request blame for a 20-line window instead of fetching the entire file's blame history.
|
|
278
|
+
|
|
279
|
+
- **Lowered `max_results` defaults**: `search_code` and `find_file` default from 25 โ 10 results. Still 100 max if you need it. Reduces noise on typical queries.
|
|
280
|
+
|
|
281
|
+
- **Global 16 KB response cap**: Every tool response is gated through a byte-budget interceptor. Responses exceeding 16 KB (configurable via `OPENGROK_MAX_RESPONSE_BYTES`) are truncated at the last newline and a guidance message is appended. Prevents catastrophic 20 K+ token blowouts from unexpectedly large files.
|
|
282
|
+
|
|
283
|
+
- **Server-level LLM instructions**: The MCP server now advertises a `instructions` block that nudges Copilot toward correct behavior at the session level โ use compound tools first, always pass line ranges, prefer `defs`/`refs` for known symbols. Zero backend cost.
|
|
284
|
+
|
|
285
|
+
- **Tightened tool descriptions**: All 8 original tool descriptions reduced to one concise sentence. The `get_file_content` description now says `ALWAYS pass start_line/end_line โ never fetch full files` in caps. LLM behavior follows tool descriptions.
|
|
286
|
+
|
|
287
|
+
### ๐๏ธ Local Source Layer โ Optional
|
|
288
|
+
|
|
289
|
+
An optional zero-dependency local layer that lets the server read source files directly from disk and resolve compiler flags from `compile_commands.json`:
|
|
290
|
+
|
|
291
|
+
- **`get_compile_info`** tool: given a source file path, returns compiler, include paths, preprocessor defines, language standard (`-std=`), and extra flags. Uses an in-memory index built from one or more `compile_commands.json` files at startup. Lookup supports absolute paths, OpenGrok-relative paths, and basename fallback.
|
|
292
|
+
|
|
293
|
+
- **Transparent `get_file_content` bypass**: when the local layer is enabled and a file resolves within a configured source root, `get_file_content` reads directly from disk instead of making an HTTP request to OpenGrok. Same response format โ Copilot doesn't know the difference. Falls back to the API silently on any local read failure.
|
|
294
|
+
|
|
295
|
+
- **Security**: all paths validated with `fs.realpathSync()` and boundary-checked against configured allowed roots. Files and include paths that escape the roots are silently dropped. Path traversal sequences rejected. The `compile_commands.json` tokenizer handles both POSIX escape sequences and Windows backslash paths correctly.
|
|
296
|
+
|
|
297
|
+
- **Configuration**: enabled via `opengrok-mcp.local.enabled` (VS Code setting) or `OPENGROK_LOCAL_ENABLED=true` (env var). Source roots configured via `opengrok-mcp.local.compileDbRoots` (array of directory paths in VS Code settings) or `OPENGROK_LOCAL_COMPILE_DB_ROOTS` (comma-separated env var).
|
|
298
|
+
|
|
299
|
+
### ๐งช Tests
|
|
300
|
+
|
|
301
|
+
- **95 tests passing** (up from 45 in v2.x)
|
|
302
|
+
- 23 new tests for `compile-info.ts`: parser (arguments-array and command-string formats), security (out-of-root path rejection for both source files and include paths), resilience (missing files, malformed JSON, missing fields, empty-roots failsafe), and multi-DB merge
|
|
303
|
+
- Existing formatter tests updated for new compact output formats
|
|
304
|
+
- All tests run in-process with no network โ fast and CI-safe
|
|
305
|
+
|
|
306
|
+
### Configuration Reference
|
|
307
|
+
|
|
308
|
+
New environment variables / VS Code settings in v3.0:
|
|
309
|
+
|
|
310
|
+
| Variable | Setting | Default | Description |
|
|
311
|
+
|---|---|---|---|
|
|
312
|
+
| `OPENGROK_MAX_INLINE_LINES` | โ | `200` | Max lines returned for a full-file read |
|
|
313
|
+
| `OPENGROK_MAX_RESPONSE_BYTES` | โ | `16384` | Hard cap (bytes) on any tool response |
|
|
314
|
+
| `OPENGROK_LOCAL_ENABLED` | `opengrok-mcp.local.enabled` | `false` | Enable local file read bypass + compile info |
|
|
315
|
+
| `OPENGROK_LOCAL_COMPILE_DB_ROOTS` | `opengrok-mcp.local.compileDbRoots` | `""` | Comma-separated directories containing `compile_commands.json` |
|
|
316
|
+
| `OPENGROK_DEFAULT_PROJECT` | โ | `""` | Default project applied when `projects` argument is omitted |
|
|
317
|
+
|
|
318
|
+
## [2.1.2] - 2026-03-01
|
|
319
|
+
|
|
320
|
+
### Added
|
|
321
|
+
|
|
322
|
+
- **Modern Connection Manager**: Replaced traditional setup prompts with a sleek, centered webview interface featuring dark/light mode theming.
|
|
323
|
+
- **First-Time Setup Auto-Reload**: Introduced graceful `needsReloadForTools` tracking to correctly prompt a VS Code Window Reload only on completely fresh installations.
|
|
324
|
+
|
|
325
|
+
### Changed
|
|
326
|
+
|
|
327
|
+
- Auto-Test connection runs smoothly and silently immediately after clicking the new 'Save Settings' webview button.
|
|
328
|
+
- Updated README.md instructions with accurate automated setup flow logic and new visual screenshots.
|
|
329
|
+
|
|
330
|
+
## [2.0.7] - 2026-02-26
|
|
331
|
+
|
|
332
|
+
### Security
|
|
333
|
+
|
|
334
|
+
- **AES-256-CBC encrypted credential files**: Passwords are now encrypted before being written to temporary files, adding defense-in-depth protection
|
|
335
|
+
- **Secure file deletion**: Credential files are overwritten with random data before deletion, preventing forensic recovery
|
|
336
|
+
- Encryption key is passed via environment variable (not visible in process arguments)
|
|
337
|
+
|
|
338
|
+
### Changed
|
|
339
|
+
|
|
340
|
+
- Stale credential file cleanup now uses 60-second threshold (handles VS Code's lazy MCP server spawning)
|
|
341
|
+
- Removed timer-based cleanup in favor of on-demand cleanup during server definition requests
|
|
342
|
+
|
|
343
|
+
### Fixed
|
|
344
|
+
|
|
345
|
+
- Credential files no longer deleted before MCP server can read them (VS Code spawns servers lazily on first tool invocation)
|
|
346
|
+
|
|
347
|
+
## [2.0.6] - 2026-02-26
|
|
348
|
+
|
|
349
|
+
### Security
|
|
350
|
+
|
|
351
|
+
- **Credential file cleanup**: Extension now guarantees credential file deletion after 2 seconds, even if the MCP server is already running and doesn't read the file
|
|
352
|
+
- Old credential files are cleaned up when new server definitions are requested
|
|
353
|
+
- All credential files are cleaned up on extension deactivation
|
|
354
|
+
|
|
355
|
+
## [2.0.5] - 2026-02-26
|
|
356
|
+
|
|
357
|
+
### Security
|
|
358
|
+
|
|
359
|
+
- **Secure credential file handling**: Passwords are now passed to the MCP server via temporary files instead of environment variables, preventing exposure via process inspection (`ps`, `/proc`, Task Manager)
|
|
360
|
+
- Credential files are created with restricted permissions (`0o600` on Unix, ACL-hardened on Windows)
|
|
361
|
+
- Files are deleted immediately after reading, minimizing the exposure window
|
|
362
|
+
|
|
363
|
+
### Added
|
|
364
|
+
|
|
365
|
+
- Comprehensive test suite for credential file security (8 new tests)
|
|
366
|
+
|
|
367
|
+
### Fixed
|
|
368
|
+
|
|
369
|
+
- Credentials no longer visible in process environment listings
|
|
370
|
+
|
|
371
|
+
## [2.0.4] - 2026-02-21
|
|
372
|
+
|
|
373
|
+
### Added
|
|
374
|
+
|
|
375
|
+
- Created a quick-access `OpenGrok: Status Menu` available by clicking the bottom-right status bar icon, making connection testing and settings trivially accessible.
|
|
376
|
+
|
|
377
|
+
### Changed
|
|
378
|
+
|
|
379
|
+
- Revised README setup instructions to perfectly match the interactive wizard flow (Configure -> Test -> Reload).
|
|
380
|
+
|
|
381
|
+
## [2.0.3] - 2026-02-21
|
|
382
|
+
|
|
383
|
+
### Changed
|
|
384
|
+
|
|
385
|
+
- Improved Setup & Configuration documentation in README.md
|
|
386
|
+
|
|
387
|
+
### Fixed
|
|
388
|
+
|
|
389
|
+
- Fixed MCP tool caching issue by providing extension version in server definition (Copilot now correctly refreshes tools on update)
|
|
390
|
+
|
|
391
|
+
## [2.0.2] - 2026-02-21
|
|
392
|
+
|
|
393
|
+
### Added
|
|
394
|
+
|
|
395
|
+
- Automatic version tracking and update notifications
|
|
396
|
+
- Version management scripts (patch, minor, major releases)
|
|
397
|
+
- Automated CI/CD release pipeline
|
|
398
|
+
- Complete release workflow documentation (RELEASE_WORKFLOW.md, VERSIONING.md)
|
|
399
|
+
|
|
400
|
+
### Changed
|
|
401
|
+
|
|
402
|
+
- Extension now uses VS Code's bundled Node.js runtime (fixes Windows compatibility)
|
|
403
|
+
- README updated to use natural language for Copilot Chat interactions
|
|
404
|
+
- Releases now fully automated - no manual VSIX uploads needed
|
|
405
|
+
|
|
406
|
+
### Fixed
|
|
407
|
+
|
|
408
|
+
- Windows "spawn node ENOENT" error when Node.js not in PATH
|
|
409
|
+
|
|
410
|
+
## [2.0.0] - 2026-02-21
|
|
411
|
+
|
|
412
|
+
### Added
|
|
413
|
+
|
|
414
|
+
- Complete TypeScript rewrite
|
|
415
|
+
- Native MCP (Model Context Protocol) server integration
|
|
416
|
+
- Support for 8 OpenGrok operations:
|
|
417
|
+
- Full-text code search
|
|
418
|
+
- Symbol definitions and references
|
|
419
|
+
- File path search
|
|
420
|
+
- File content retrieval with line ranges
|
|
421
|
+
- File history and git annotations
|
|
422
|
+
- Directory browsing
|
|
423
|
+
- Project listing
|
|
424
|
+
- Search suggestions
|
|
425
|
+
- Secure credential storage using VS Code SecretStorage (OS keychain)
|
|
426
|
+
- Intelligent caching with TTL and size limits
|
|
427
|
+
- Rate limiting and retry logic
|
|
428
|
+
- SSRF and path traversal protections
|
|
429
|
+
- 45 comprehensive unit tests
|
|
430
|
+
|
|
431
|
+
### Changed
|
|
432
|
+
|
|
433
|
+
- Migrated from Python to TypeScript
|
|
434
|
+
- Bundled as single VSIX with no external dependencies
|
|
435
|
+
- Uses VS Code's built-in Node.js runtime
|
|
436
|
+
|
|
437
|
+
### Fixed
|
|
438
|
+
|
|
439
|
+
- SSL certificate handling for internal/self-signed CAs
|
|
440
|
+
- Windows compatibility issues
|
|
441
|
+
|
|
442
|
+
### Security
|
|
443
|
+
|
|
444
|
+
- Passwords stored in OS keychain (never in plain text)
|
|
445
|
+
- Error messages sanitized to prevent credential leakage
|
|
446
|
+
- Secure temporary file-based credential passing to server process (improved in 2.0.5)
|
|
447
|
+
|
|
448
|
+
## [1.0.0] - Previous
|
|
449
|
+
|
|
450
|
+
- Original Python implementation
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## Version Numbering
|
|
455
|
+
|
|
456
|
+
We use [Semantic Versioning](https://semver.org/):
|
|
457
|
+
|
|
458
|
+
- **MAJOR** (X.0.0): Breaking changes or major feature overhauls
|
|
459
|
+
- **MINOR** (x.Y.0): New features, backwards compatible
|
|
460
|
+
- **PATCH** (x.y.Z): Bug fixes, minor improvements
|