purecontext-mcp 1.7.0 → 1.11.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 (156) hide show
  1. package/AGENT_INSTRUCTIONS.md +18 -10
  2. package/AGENT_REFERENCE.md +684 -561
  3. package/CHANGELOG.md +567 -445
  4. package/CODE-HISTORY.md +29 -1
  5. package/FULL-INSTALLATION-GUIDE.md +351 -341
  6. package/README.md +411 -339
  7. package/REFACTORING-SAFELY.md +338 -279
  8. package/SAFE-CHANGES.md +208 -156
  9. package/USER-GUIDE.md +3 -1
  10. package/WHY-PURECONTEXT.md +103 -73
  11. package/WORKFLOW-PR-REVIEW.md +245 -199
  12. package/dist/bin.d.ts +16 -0
  13. package/dist/bin.d.ts.map +1 -0
  14. package/dist/bin.js +21 -0
  15. package/dist/bin.js.map +1 -0
  16. package/dist/cli/hooks.d.ts.map +1 -1
  17. package/dist/cli/hooks.js +20 -15
  18. package/dist/cli/hooks.js.map +1 -1
  19. package/dist/cli/install-writers.d.ts.map +1 -1
  20. package/dist/cli/install-writers.js +281 -36
  21. package/dist/cli/install-writers.js.map +1 -1
  22. package/dist/cli/resolve-node.d.ts +53 -0
  23. package/dist/cli/resolve-node.d.ts.map +1 -0
  24. package/dist/cli/resolve-node.js +84 -0
  25. package/dist/cli/resolve-node.js.map +1 -0
  26. package/dist/config/config-loader.js +24 -0
  27. package/dist/config/config-loader.js.map +1 -1
  28. package/dist/config/config-schema.d.ts +71 -0
  29. package/dist/config/config-schema.d.ts.map +1 -1
  30. package/dist/config/config-schema.js +102 -0
  31. package/dist/config/config-schema.js.map +1 -1
  32. package/dist/core/db/api-keys.d.ts +1 -1
  33. package/dist/core/db/api-keys.d.ts.map +1 -1
  34. package/dist/core/db/api-keys.js +39 -39
  35. package/dist/core/db/api-keys.js.map +1 -1
  36. package/dist/core/db/co-change-store.d.ts +34 -0
  37. package/dist/core/db/co-change-store.d.ts.map +1 -0
  38. package/dist/core/db/co-change-store.js +78 -0
  39. package/dist/core/db/co-change-store.js.map +1 -0
  40. package/dist/core/db/schema.d.ts +3 -3
  41. package/dist/core/db/schema.d.ts.map +1 -1
  42. package/dist/core/db/schema.js +12 -30
  43. package/dist/core/db/schema.js.map +1 -1
  44. package/dist/core/db/sqlite-loader.d.ts +51 -0
  45. package/dist/core/db/sqlite-loader.d.ts.map +1 -0
  46. package/dist/core/db/sqlite-loader.js +94 -0
  47. package/dist/core/db/sqlite-loader.js.map +1 -0
  48. package/dist/core/db/wasm-sqlite.d.ts +4 -0
  49. package/dist/core/db/wasm-sqlite.d.ts.map +1 -0
  50. package/dist/core/db/wasm-sqlite.js +270 -0
  51. package/dist/core/db/wasm-sqlite.js.map +1 -0
  52. package/dist/core/diff-parser.d.ts.map +1 -1
  53. package/dist/core/diff-parser.js +6 -1
  54. package/dist/core/diff-parser.js.map +1 -1
  55. package/dist/core/git-log-reader.d.ts +28 -0
  56. package/dist/core/git-log-reader.d.ts.map +1 -1
  57. package/dist/core/git-log-reader.js +74 -3
  58. package/dist/core/git-log-reader.js.map +1 -1
  59. package/dist/core/index-manager.d.ts.map +1 -1
  60. package/dist/core/index-manager.js +20 -1
  61. package/dist/core/index-manager.js.map +1 -1
  62. package/dist/graph/path-resolver.js +86 -17
  63. package/dist/graph/path-resolver.js.map +1 -1
  64. package/dist/index.d.ts +1 -0
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +9 -1
  67. package/dist/index.js.map +1 -1
  68. package/dist/node-guard.d.ts +15 -0
  69. package/dist/node-guard.d.ts.map +1 -0
  70. package/dist/node-guard.js +33 -0
  71. package/dist/node-guard.js.map +1 -0
  72. package/dist/server/admin-api.d.ts +1 -1
  73. package/dist/server/admin-api.d.ts.map +1 -1
  74. package/dist/server/admin-api.js +2 -2
  75. package/dist/server/admin-api.js.map +1 -1
  76. package/dist/server/auth/api-key.d.ts +1 -1
  77. package/dist/server/auth/api-key.d.ts.map +1 -1
  78. package/dist/server/mcp-server.d.ts.map +1 -1
  79. package/dist/server/mcp-server.js +25 -0
  80. package/dist/server/mcp-server.js.map +1 -1
  81. package/dist/server/tools/analyze-diff.d.ts +8 -0
  82. package/dist/server/tools/analyze-diff.d.ts.map +1 -1
  83. package/dist/server/tools/analyze-diff.js +80 -16
  84. package/dist/server/tools/analyze-diff.js.map +1 -1
  85. package/dist/server/tools/change-synthesis.d.ts +90 -0
  86. package/dist/server/tools/change-synthesis.d.ts.map +1 -0
  87. package/dist/server/tools/change-synthesis.js +236 -0
  88. package/dist/server/tools/change-synthesis.js.map +1 -0
  89. package/dist/server/tools/co-change.d.ts +65 -0
  90. package/dist/server/tools/co-change.d.ts.map +1 -0
  91. package/dist/server/tools/co-change.js +146 -0
  92. package/dist/server/tools/co-change.js.map +1 -0
  93. package/dist/server/tools/compare-change-impact.d.ts +58 -0
  94. package/dist/server/tools/compare-change-impact.d.ts.map +1 -0
  95. package/dist/server/tools/compare-change-impact.js +0 -0
  96. package/dist/server/tools/compare-change-impact.js.map +1 -0
  97. package/dist/server/tools/find-refactoring-opportunities.d.ts +1 -1
  98. package/dist/server/tools/get-architecture-snapshot.d.ts.map +1 -1
  99. package/dist/server/tools/get-architecture-snapshot.js +28 -14
  100. package/dist/server/tools/get-architecture-snapshot.js.map +1 -1
  101. package/dist/server/tools/get-churn-metrics.d.ts.map +1 -1
  102. package/dist/server/tools/get-churn-metrics.js +1 -12
  103. package/dist/server/tools/get-churn-metrics.js.map +1 -1
  104. package/dist/server/tools/get-co-change.d.ts +37 -0
  105. package/dist/server/tools/get-co-change.d.ts.map +1 -0
  106. package/dist/server/tools/get-co-change.js +120 -0
  107. package/dist/server/tools/get-co-change.js.map +1 -0
  108. package/dist/server/tools/get-context-bundle.d.ts.map +1 -1
  109. package/dist/server/tools/get-context-bundle.js +56 -3
  110. package/dist/server/tools/get-context-bundle.js.map +1 -1
  111. package/dist/server/tools/get-entry-points.d.ts +1 -1
  112. package/dist/server/tools/get-symbol-risk.d.ts +25 -0
  113. package/dist/server/tools/get-symbol-risk.d.ts.map +1 -0
  114. package/dist/server/tools/get-symbol-risk.js +60 -0
  115. package/dist/server/tools/get-symbol-risk.js.map +1 -0
  116. package/dist/server/tools/get-symbol-source.d.ts +2 -0
  117. package/dist/server/tools/get-symbol-source.d.ts.map +1 -1
  118. package/dist/server/tools/get-symbol-source.js +18 -1
  119. package/dist/server/tools/get-symbol-source.js.map +1 -1
  120. package/dist/server/tools/prepare-change.d.ts +61 -0
  121. package/dist/server/tools/prepare-change.d.ts.map +1 -0
  122. package/dist/server/tools/prepare-change.js +262 -0
  123. package/dist/server/tools/prepare-change.js.map +1 -0
  124. package/dist/server/tools/search-symbols.d.ts +2 -0
  125. package/dist/server/tools/search-symbols.d.ts.map +1 -1
  126. package/dist/server/tools/search-symbols.js +33 -0
  127. package/dist/server/tools/search-symbols.js.map +1 -1
  128. package/dist/server/tools/symbol-lines.d.ts +25 -0
  129. package/dist/server/tools/symbol-lines.d.ts.map +1 -0
  130. package/dist/server/tools/symbol-lines.js +40 -0
  131. package/dist/server/tools/symbol-lines.js.map +1 -0
  132. package/dist/server/tools/symbol-risk.d.ts +109 -0
  133. package/dist/server/tools/symbol-risk.d.ts.map +1 -0
  134. package/dist/server/tools/symbol-risk.js +251 -0
  135. package/dist/server/tools/symbol-risk.js.map +1 -0
  136. package/dist/server/tools/verify-change.d.ts +40 -0
  137. package/dist/server/tools/verify-change.d.ts.map +1 -0
  138. package/dist/server/tools/verify-change.js +149 -0
  139. package/dist/server/tools/verify-change.js.map +1 -0
  140. package/dist/version.d.ts +1 -1
  141. package/dist/version.d.ts.map +1 -1
  142. package/dist/version.js +1 -1
  143. package/dist/version.js.map +1 -1
  144. package/docs/01-introduction.md +2 -2
  145. package/docs/02-installation.md +97 -89
  146. package/docs/03-quick-start.md +138 -135
  147. package/docs/04-configuration.md +247 -214
  148. package/docs/05-cli-reference.md +236 -219
  149. package/docs/06-tools-reference.md +902 -499
  150. package/docs/14-transport-modes.md +170 -167
  151. package/docs/18-git-history.md +43 -0
  152. package/docs/23-performance.md +123 -121
  153. package/docs/26-troubleshooting.md +249 -234
  154. package/grammars/README.md +88 -0
  155. package/package.json +7 -25
  156. package/AGENT_INSTRUCTIONS_SHORT.md +0 -150
package/CHANGELOG.md CHANGED
@@ -1,445 +1,567 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ---
9
-
10
- ## [Unreleased]
11
-
12
- ### Added
13
-
14
- **Claude Code hook system overhaul**
15
-
16
- Hooks now use CLI-style commands (`npx purecontext-mcp hook-*`) registered directly in `~/.claude/settings.json`. No scripts are copied to `~/.claude/hooks/` — the commands invoke the installed package directly, so hook logic updates automatically when the package updates.
17
-
18
- Seven hook events are now supported (up from three):
19
-
20
- | Hook event | Command | What it does |
21
- |------------|---------|--------------|
22
- | `PostToolUse` | `hook-posttooluse` | Re-indexes modified files after Edit/Write/MultiEdit |
23
- | `PreCompact` | `hook-precompact` | Injects indexed repo list into context before compaction |
24
- | `PreToolUse` | `hook-pretooluse` | Soft edit guardsuggests read tools before editing |
25
- | `WorktreeCreate` | `hook-worktree-create` | Auto-indexes a newly created agent worktree |
26
- | `WorktreeRemove` | `hook-worktree-remove` | Fires when an agent worktree is removed |
27
- | `TaskCompleted` | `hook-taskcompleted` | Post-task diagnostics: complexity stats, TODO count, tool suggestions |
28
- | `SubagentStart` | `hook-subagentstart` | Injects condensed repo orientation for newly spawned subagents |
29
-
30
- *TaskCompleted* — after the agent finishes a task, queries each indexed repo for high-complexity symbols (cyclomatic complexity > 5) and TODO/FIXME annotations, then injects a diagnostic summary plus a reminder of relevant tools: `find_dead_code`, `find_untested_symbols`, `get_todos`, `get_complexity_hotspots`, `health_radar`.
31
-
32
- *SubagentStart* — when a subagent spawns it has no session context. This hook injects the indexed repo list (repoId, path, file and symbol counts, last-indexed timestamp) plus the mandatory workflow table so the subagent is oriented without needing an extra tool call.
33
-
34
- *WorktreeCreate* Claude Code's Agent tool can create isolated git worktrees for sub-tasks. This hook calls `index-folder` on the new worktree automatically so PureContext tools work immediately inside it.
35
-
36
- Re-running `npx purecontext-mcp hooks --install` upgrades existing installations: old `node ~/.claude/hooks/purecontext-*.mjs` entries are replaced with the new CLI form, and the four new hook events are added.
37
-
38
- ---
39
-
40
- ## [1.5.0] - 2026-05-22
41
-
42
- ### Added
43
-
44
- **New language handlers**
45
-
46
- - **HCL / Terraform** (`.tf`, `.tfvars`, `.hcl`) — extracts `variable`, `output`, `resource`, `data`, `module`, `provider`, and `locals` blocks; names follow Terraform reference syntax (`var.name`, `module.name`, `local.name`, `output.name`) so queries match the way you write them in code
47
- - **Angular HTML templates** (`.html`) extracts component selectors, structural directives (`*ngIf`, `*ngFor`, `@if`, `@for`), event bindings (`(click)="handler"`), template references (`#userInput`), and `routerLink` directives; auto-detected via a sibling `.component.ts` file or Angular marker patterns
48
- - **Extensionless scripts** — extensionless files (e.g. `plugins/*/functions` in Bash-heavy projects) are now discovered and indexed automatically; shebang detection routes each file to the correct handler
49
-
50
- **Objective-C handler overhaul**
51
-
52
- - `@interface`, `@protocol`, and `@implementation` declarations now fully extracted from both `.m` and `.h` files
53
- - Named categories stored as `ClassName+CategoryName`; anonymous categories flagged with `classExtension: true`
54
- - Full Objective-C selector building (`setObject:forKey:`) instead of plain method names
55
- - Properties extracted with `property` kind (was `const`)
56
- - `.h` files guarded by an ObjC detection pass — C headers that happen to use `.h` are not misidentified
57
-
58
- **XML symbol disambiguation**
59
-
60
- - Root-element symbols in multi-module XML repositories (e.g. `pom.xml` across 30+ Maven modules) are now stored as `tag@module` names, eliminating collisions where every module shared the same top-level element name
61
- - Bare tag name retained as an FTS token so single-word queries still find the right file
62
-
63
- **Search relevance improvements**
64
-
65
- - *Monorepo path heuristics* — frontend app directories (`apps/dashboard/`, `apps/web/`) get a score boost when the query contains hook or component vocabulary; avoids backend symbols drowning React/Angular results in mixed monorepos
66
- - *Java/Groovy core-path boost* symbols in `/core/src/main/java/` paths boosted; symbols in plugin directories penalised; reduces noise from plugin implementations when querying for core API methods
67
- - *Library path penalties* extended to cover `engine/`, `erts/`, and `contrib/` directory segments (common in projects that embed a runtime)
68
- - *Compound underscore boost* fires when all underscore-separated parts of a symbol name are present in the query, without requiring an exact full-name match
69
- - *Single-token exact match boost* — single-word queries reliably surface the best exact match at rank 1
70
- - *Cross-language FTS aliases* — Neovim `nvim_*` C functions get a `vim.api.nvim_*` alias so Lua-style queries (`vim.api.nvim_open_win`) find the C implementation; Proto RPC method symbols include their service name as an FTS token
71
- - *Erlang bare function names* — Erlang symbols stored without arity suffix (`start_link` instead of `start_link/3`); arity preserved in `frameworkMeta`; module name injected as an FTS token so `module:function` queries work
72
- - *TypeScript HOC detection* — `export const X = React.memo(() => ...)`, `forwardRef(...)`, and similar HOC-wrapped arrow functions emitted as `kind=function` instead of `kind=const`, ensuring rendering-domain boosts fire correctly
73
-
74
- ### Fixed
75
-
76
- - Case-insensitive file extension matching in file discovery (`.F90` Fortran files were silently skipped)
77
- - Directory trailing-slash handling in `ignore` negation patterns — fixes traversal of directories with explicit `!negation` rules
78
- - Index workers were missing registrations for the Fortran, SCSS, LESS, CSS, and Objective-C handlers; files with those extensions were silently dropped before parsing
79
- - C++ qualified name FTS — bare local name (`Future`) now stored as a separate FTS token alongside the fully-qualified name (`folly::Future`), improving single-word C++ queries
80
- - Rust synonym scoping `future→poll`, `spawn→tokio/task`, and serde-specific synonyms now fire only in Rust repositories, preventing them from polluting C++ search results
81
-
82
- ---
83
-
84
- ## [1.4.0] - 2026-05-20
85
-
86
- ### Added
87
-
88
- **New MCP tools**
89
-
90
- - `get_lexical_scope_matches` — returns all symbols accessible from a given file and line (local scope, module imports, and exported API), letting agents reason about what identifiers are in scope without reading whole files
91
- - `trace_invocation_chain` — follows call edges from a symbol N hops deep and returns the linearised invocation path; useful for tracing a request from an entry point through to storage
92
-
93
- **Language handler depth**
94
-
95
- - *Ruby* — DSL macro extraction: `has_many`, `belongs_to`, `has_one`, `has_and_belongs_to_many`, `before_action`, `after_action`, `validates`, and `scope` class macros extracted as `property` symbols; metaprogramming patterns (`define_method`, `method_missing`) flagged in `frameworkMeta`
96
- - *Rust*`#[cfg(...)]` attributes now captured in `frameworkMeta.cfgAttributes`; new `cfgFilter` parameter on `search_symbols` restricts results to symbols matching a specific cfg condition (e.g. `target_os = "linux"`)
97
- - *C++* — export-macro class extraction: `class MY_EXPORT ClassName` and similar patterns now correctly identified as class declarations rather than function definitions
98
- - *TypeScript* `export const X = forwardRef(...)` / `React.memo(...)` and similar HOC patterns emitted as `kind=function`; decorator extraction inside `export_statement` wrapper fixed (was silently dropping `@Injectable` and similar decorators on exported classes)
99
- - *C#* — interface member extraction fixed (interface members are implicitly public; visibility guard removed); method name extraction uses `findLast` before `parameter_list` to avoid returning the return type; event field declarations (`event_field_declaration`) extracted as `property` kind
100
- - *Kotlin* — extension function extraction; primary constructor property parameters extracted as `property` symbols
101
- - *PHP*PHP 8 `#[Attribute]` syntax parsed correctly; Symfony route and controller patterns added to quality-gate trigger; property declarations, `define()` constants, closures, abstract methods, enum cases, and interface constants all extracted
102
-
103
- **Search quality**
104
-
105
- - FTS BM25 raw rank exposed to the relevance ranker high keyword-match scores contribute a 0–50 point bonus on top of structural scoring; prevents purely-structural boosts from overriding strong keyword matches
106
- - Docstring extraction extended — Python and C++ full-paragraph docstrings (not just the first line) fed to the FTS index; improves matches for queries that use documentation vocabulary rather than identifier names
107
- - Nuxt/Vue-specific vocabulary synonyms added (`composable`, `setup`, `defineComponent`, `useNuxt`, etc.)
108
- - `search_symbols` returns `verdict: "no_match"` with `negative_evidence` details when all retrieval strategies are exhausted, allowing agents to stop retrying instead of looping through variant queries
109
-
110
- **Multi-IDE installer**
111
-
112
- `npx purecontext-mcp install <tool|all>` now supports:
113
-
114
- | IDE / Tool | Config location |
115
- |------------|----------------|
116
- | Cursor | `.cursor/rules/purecontext.mdc` |
117
- | Windsurf | `.windsurfrules` |
118
- | Continue | `.continue/config.json` system message |
119
- | Cline | `.clinerules` |
120
- | Roo Code | `.roo/rules-code.md` |
121
- | VS Code Copilot | `.github/copilot-instructions.md` |
122
- | Claude Desktop | Platform config (`claude_desktop_config.json`) |
123
-
124
- All writers are idempotent running `install` a second time updates the existing block rather than appending a duplicate.
125
-
126
- **Claude Code hooks**
127
-
128
- - *PostToolUse index hook* re-indexes modified files automatically after any Edit/Write tool call, keeping the symbol index in sync with in-session edits
129
- - *PreCompact snapshot hook* — captures an architecture snapshot before context is compacted
130
- - *Edit guard hook* (soft) warns when an edit target has dependents with high blast radius; never blocks
131
-
132
- Install via `npx purecontext-mcp hooks --install`.
133
-
134
- ### Fixed
135
-
136
- - `expandVerbSynonyms`: prototype-chain collision on the `constructor` key — calling `expandVerbSynonyms("constructor")` previously returned the built-in `Function.prototype.constructor`; fixed by using `Object.create(null)` for the synonym map
137
- - Test-mapper transaction: FK constraint errors no longer propagate and block FTS index population
138
- - Windows path-case mismatch: repo ID computation now uses the canonical absolute path from the indexer output rather than recomputing from a potentially different-cased input string
139
-
140
- ---
141
-
142
- ## [1.3.0] - 2026-05-16
143
-
144
- ### Added
145
-
146
- **Search quality**
147
-
148
- - *OR-fallback retrieval* — when the FTS5 AND query returns too few results, the engine automatically retries with an OR query and re-ranks the combined pool; improves recall for longer, natural-language queries
149
- - *Abbreviation expansion*common abbreviations in queries expanded before FTS: `db→database`, `auth→authentication`, `cfg→configuration`, `mgr→manager`, `ctrl→controller`, and 40+ more; C/C++ abbreviations included
150
- - *camelCase boundary tokenisation* FTS5 index now correctly splits `getUserById` into `get`, `user`, `by`, `id` at index time, not just at query time; improves recall when query uses word-boundary terms that appear inside camelCase identifiers
151
- - *Verb synonym expansion* common verb synonyms expanded at query time: `fetch↔get↔retrieve`, `create↔insert↔add`, `delete↔remove↔drop`, `update↔modify↔edit`, `authenticate→login`, `list↔find`, and more
152
- - *Stop-word expansion* — 30 additional stop words filtered from multi-word queries: `with`, `without`, `using`, `via`, `existing`, `before`, `after`, `during`, and others
153
- - *Service/repository kind boost* — `*Service` method symbols +30, `*Repository`/`*Manager`/`*Store` method symbols +15; surfaces application-layer API methods before utility helpers with similar names
154
- - *Method verb bonus* — fires when the first camelCase part of a method name (the action verb) matches a query word, differentiating `ProductsService.create` from `buildProductListCacheKey`
155
- - *Quality-gate OR-fallback* — if the AND pool contains no `*Service`/`*Repository` methods even after the first OR-fallback, a second OR pass retrieves the broader candidate pool
156
- - *Stem matching* — pluralised name parts (`products→product`) now match singular query words
157
- - *Library path penalty* symbols from `vendor/`, `node_modules/`, `bower_components/`, `third_party/`, and similar paths penalised to prevent dependency code from ranking above project code
158
-
159
- **New stylesheet handlers**
160
-
161
- - *SCSS / SASS* (`.scss`, `.sass`) — `@mixin` → function, `@function` → function, top-level `$variable` → const, `%placeholder` → class, `@keyframes` → type
162
- - *LESS* (`.less`) — `.mixin(@params){}` → function, top-level `@variable` → const, `@keyframes` → type
163
- - *CSS* (`.css`) — CSS custom properties (`--token-name`) indexed as const (opt-in via `indexing.cssVariables: true` in config)
164
-
165
- **Handler depth improvements**
166
-
167
- - *Go* — interface `method_spec` extraction; top-level `var` declarations; `*Handler`/`*DB`/`*Client` receiver types added to kind-boost patterns
168
- - *Java*inner-class extraction no longer gated on `isStatic`; package-private methods included; Android `Activity`/`Fragment`/`ViewModel` pattern boosts
169
- - *Rust* `impl` methods filtered to `pub` visibility by default; `trait` implementations boosted; Rust-specific synonyms scoped to Rust repos only
170
- - *PHP*UTF-8 multibyte character offset bug fixed (was producing broken symbol names for methods after accented characters in source); property declarations, closures, `define()` global constants, abstract methods, PHP 8.1 enum cases, and interface constants all extracted
171
- - *TypeScript* — decorator extraction inside `export_statement` wrapper fixed
172
-
173
- ### Fixed
174
-
175
- - FTS5 syntax error in synonym OR-groups: tokens joined as `(a OR b)` were concatenated without an explicit `AND` connector when followed by another group, producing invalid FTS5 queries; fixed by inserting explicit ` AND ` between groups and checking for top-level OR context before switching to OR-fallback mode
176
- - `namePrefix` word-boundary guard: stem matching no longer fires when a name only contains the query word as an interior substring (e.g. query `user` no longer matches `superuser` via stem)
177
- - Short-token filter in multi-word query branch: tokens shorter than 2 characters no longer enter the AND query, preventing FTS5 from returning zero results on trivially-true constraints
178
-
179
- ---
180
-
181
- ## [1.2.0] - 2026-05-13
182
-
183
- ### Added
184
-
185
- **Advanced relationship analysis**
186
- - `find_implementations` — find all concrete implementations of a TypeScript interface or abstract class; returns implementing classes with `implementedMethods` and `missingMethods` arrays compared against the interface contract
187
- - `get_call_hierarchy`callers and callees of a function N levels deep as a hierarchical tree; supports `callers`, `callees`, and `both` directions; recursive calls marked `cyclic: true`
188
- - `get_class_hierarchy` full inheritance tree rooted at a class, showing both ancestors and descendants; use before refactoring a base class to understand the full polymorphism surface
189
- - `find_cycles` detect circular import dependencies across the repo or a subtree; returns strongly-connected components with severity rating
190
- - `get_coupling_map`afferent/efferent coupling metrics and instability scores (`I = efferent / (afferent + efferent)`) for every file; highlights highest-risk refactoring candidates
191
-
192
- **Architectural visualization**
193
- - `render_diagram`general-purpose Mermaid or DOT dependency diagram (module, call graph, class hierarchy); output renders natively in GitHub, VS Code, and Claude
194
- - `render_call_graph` specialized call graph diagram rooted at a symbol with call-graph-specific layout options
195
- - `render_import_graph` — file-level import graph for a directory or whole repo; nodes clustered by directory
196
- - `render_class_hierarchy` — class inheritance diagram in Mermaid `classDiagram` format; shows fields, methods, and inheritance/implementation relationships
197
- - `render_dep_matrix` — dependency matrix diagram showing coupling between modules as a grid; surfaces structural hotspots at a glance
198
- - `get_architecture_snapshot` captures architectural state (file count, symbol count, module breakdown, coupling summary, health scores); take two snapshots to prove structural improvement objectively
199
-
200
- **Refactoring safety checks**
201
- - `check_rename_safe` pre-flight check before renaming a symbol; returns `safe` verdict and all `affectedSites` (call, import, type-reference, string-literal, comment) with file, line, column, and context snippet
202
- - `check_delete_safe` pre-flight check before deleting a symbol; returns `safe: false` if anything in the repo still imports or references the symbol
203
- - `check_move_safe` — pre-flight check before moving a symbol to a different file; validates no import conflicts and lists all import statements that need updating
204
- - `plan_refactoring` — generate a sequenced, dependency-ordered plan for a structural change from a natural-language description; steps ordered so lower-risk changes happen first
205
-
206
- **Health dashboards & debt reporting**
207
- - `health_radar` — five-axis health score (complexity, coupling, maintainability, documentation, stability), each 0–100; returns `overallHealth` score and letter grade (A–F); designed for CI health gates
208
- - `diff_health_radar` — compare two health radar snapshots (before/after a refactoring) with axis-by-axis deltas and regression/improvement verdicts
209
- - `get_debt_report` — detailed technical debt report with per-file rankings, priority tiers, worst files by each metric, specific symbols to address, and estimated effort indicators
210
-
211
- **AST-level search**
212
- - `search_ast` — find every occurrence of a specific tree-sitter node type across all indexed files (e.g. `try_statement`, `arrow_function`, `await_expression`); returns file, line, column, and snippet
213
- - `search_by_signature` — search symbols by type signature pattern (regex or substring); find all functions returning `Promise<void>` or methods accepting a `Request` parameter
214
- - `search_by_decorator` — find all symbols annotated with a specific decorator; works for TypeScript (`@Injectable`, `@Controller`) and Python (`@app.route`, `@property`) decorators
215
- - `search_by_complexity` — find symbols above or below a complexity threshold; returns symbols ranked by complexity score; use before refactoring sprints or to enforce complexity budgets
216
-
217
- **Code intelligence helpers**
218
- - `get_entry_points`identify all runnable entry points: main functions, CLI handlers, HTTP server startups, Lambda handlers, test suites, and scripts; each result includes `kind`, `confidence`, and reason
219
- - `get_public_api`all exported symbols grouped by file; use to document a library, audit what is exposed, or check for accidental exports
220
- - `get_todos`find all TODO, FIXME, HACK, NOTE, and XXX comments across the repo with file, line, tag type, and comment text
221
- - `get_complexity_hotspots`symbols ranked by complexity score, highest first; use to identify the worst functions before a refactoring sprint
222
- - `get_type_graph`type dependency graph showing which types reference which other types, rooted at a specific type or across the whole repo; supports `uses`, `usedBy`, and `both` directions
223
- - `find_untested_symbols`exported symbols with no corresponding test coverage, ranked by complexity (highest priority first); uses import-based heuristics
224
- - `get_test_coverage_map` — per-file coverage map showing which symbols are referenced by test files and which are not; produces `coverageRatio` per file and aggregated totals
225
-
226
- **Documentation guides**
227
- - `AST-SEARCH.md` guide to AST-level search tools and tree-sitter node types
228
- - `CODE-INTELLIGENCE.md`guide to code intelligence helper tools
229
- - `HEALTH-DASHBOARDS.md` guide to health radar, debt reporting, and architecture snapshots
230
- - `REFACTORING-SAFELY.md` guide to refactoring safety check tools and pre-flight workflows
231
- - `UNDERSTANDING-RELATIONSHIPS.md` — guide to relationship analysis tools (call hierarchy, class hierarchy, coupling)
232
- - `VISUALIZING-CODE.md` — guide to diagram rendering tools and Mermaid output
233
- - `WORKFLOW-TECH-DEBT.md` — end-to-end tech debt sprint workflow
234
-
235
- ### Fixed
236
-
237
- - Token savings tracker: corrected cumulative savings calculation and fixed display in web UI
238
- - Web UI: dependency graph and repo detail pages now render correctly after token tracker refactor
239
- - Docker: UI workspace panel and repo list routing fixes
240
-
241
- ---
242
-
243
- ## [1.1.0] - 2026-05-07
244
-
245
- ### Added
246
-
247
- **New MCP tools**
248
- - `find_references` — find all usage/call sites for a symbol across the repo (identifier-level, not import-level)
249
- - `get_file_content` — retrieve raw cached file content with optional line-range slicing (`startLine`/`endLine`)
250
- - `get_symbols`batch-fetch multiple symbols by ID, returning source in a single round-trip
251
- - `invalidate_cache` force a full or per-file re-index by clearing content hashes; accepts optional `filePath` to scope invalidation
252
-
253
- **Tool capability enhancements**
254
- - `search_symbols`: new `debug` parameter — includes per-result relevance scoring breakdown (FTS5 rank, kind boost, exact-match bonus)
255
- - `get_symbol_source`: new `context_lines` parameter (extra lines above/below) and `verify` flag (re-reads from disk to confirm source is current)
256
- - `index_repo`: clone and index a remote Git repository by URL; supports private repos via `token`; clones stored at `~/.purecontext/clones/`
257
- - AI summarization via Gemini Flash — configurable as an embedding/summarization provider alongside Anthropic and OpenAI
258
-
259
- **Ecosystem & data tools**
260
- - Context provider framework plugin interface (`ContextProvider`) for domain-specific symbol enrichment; providers auto-detected from project config
261
- - dbt integration — indexes models, sources, seeds, macros, and exposures; dbt Jinja pre-processor expands `{{ ref() }}` / `{{ source() }}` before SQL parsing; column definitions from `schema.yml` stored in `frameworkMeta.columns`
262
- - OpenAPI/Swagger handler — parses `.yaml`/`.yml` files detected as OpenAPI specs; indexes endpoints and schemas as symbols
263
- - SQL handler — indexes tables, views, functions, and stored procedures; works standalone and with dbt Jinja expansion
264
- - `search_columns` tool — search dbt/SQL column definitions by name or description, with upstream/downstream lineage
265
-
266
- **Language coverage expansion to 34 languages**
267
-
268
- 16 new language handlers added (previously 18):
269
-
270
- | Language | Extensions | Key symbol types |
271
- |----------|-----------|-----------------|
272
- | Bash | `.sh`, `.bash` | function |
273
- | Perl | `.pl`, `.pm` | function, package |
274
- | Terraform / HCL | `.tf`, `.hcl` | resource, module, variable, output |
275
- | Nix | `.nix` | function, attribute |
276
- | Protobuf | `.proto` | message, service, enum, rpc |
277
- | GraphQL | `.graphql`, `.gql` | type, query, mutation, subscription, fragment |
278
- | Groovy | `.groovy` | function, class, method |
279
- | Erlang | `.erl`, `.hrl` | function, module |
280
- | Gleam | `.gleam` | function, type |
281
- | GDScript | `.gd` | function, class, signal |
282
- | XML | `.xml` | element (pattern-configurable) |
283
- | Objective-C | `.m`, `.h` | function, class, method |
284
- | Fortran | `.f90`, `.f95`, `.for`, `.f` | function, subroutine, module |
285
- | SQL | `.sql` | table, view, function, procedure |
286
- | OpenAPI / YAML | `.yaml`, `.yml` | endpoint, schema |
287
- | PHP (doc coverage) | existing | PHPDoc `/** */` extraction improved |
288
-
289
- **Cross-repo intelligence**
290
- - `search_cross_repo` tool unified symbol search across all repos in a workspace; supports keyword, semantic, and hybrid modes; results include `repoId` and `repoPath`
291
- - `find_similar` tool find semantically similar code across repos using HNSW cosine similarity; configurable `minSimilarity` threshold (requires semantic search enabled)
292
- - Cross-repo dependency tracking `dep_edges` extended with `sourceRepoId`/`targetRepoId` columns; `get_blast_radius` and `find_importers` can now follow edges across repo boundaries
293
- - MCP Resources indexed symbol outlines exposed as MCP Resources (`purecontext://repo/<repoId>/outline`) for clients that support resource subscriptions
294
-
295
- **Git & history integration**
296
- - Git metadata indexing — during `index_folder`, PureContext walks `git log` and maps commits to symbols via byte-range overlap; stored in new `git_metadata` SQLite table; configurable via `git.enabled`, `git.maxCommits`, `git.branches`
297
- - `get_symbol_history` tool symbol-level commit history (hash, author, date, message, diff) without agents needing to run git commands
298
- - `get_churn_metrics` tool file or symbol churn scores (commits, lines changed, authors, churn score) with optional `since` date filter; surfaces high-risk files
299
-
300
- **AI-powered architecture analysis**
301
- - `get_quality_metrics` tool — per-file quality scores: cyclomatic complexity, coupling (fan-in/fan-out), cohesion, doc coverage, and a composite 0–100 score
302
- - `detect_antipatterns` tool — detects god classes, circular dependencies, deep inheritance, feature envy, and other common anti-patterns; results include severity and symbol ID
303
- - `get_architecture_doc` tool — auto-generates a Markdown or Mermaid architecture summary from the dependency graph and quality metrics
304
- - `get_layer_violations` tool — detects import boundary violations given a layer definition (e.g., controllers must not import repositories directly)
305
-
306
- **Enhanced Web UI**
307
- - Architecture heatmap — colour-coded file tree where heat indicates churn score or quality score; helps identify hot spots at a glance
308
- - Symbol timeline visual history of commits touching a symbol, linked to `get_symbol_history` data
309
- - Test coverage overlay when a coverage JSON report is present, file tree nodes show line coverage percentages
310
- - Multi-repo workspace view repository picker with cross-repo search tab; switch between repos without reloading
311
- - Advanced dependency graph zoom/pan, node grouping by directory, edge filtering by kind, and path highlighting between two selected nodes
312
-
313
- **Distribution & platform**
314
- - Index export (`npx purecontext-mcp export`) — archives the SQLite database and HNSW index into a portable `.pctx.tar.gz` file
315
- - Index import (`npx purecontext-mcp import`) restores an exported archive; repo is immediately searchable, no re-indexing required
316
- - Public registry pre-built indexes for popular open-source projects hosted on CDN; pull with `npx purecontext-mcp pull <package>@<version>`; browse with `npx purecontext-mcp registry list`
317
- - Webhook auto-reindex HTTP endpoint (`POST /webhook/reindex`) accepts GitHub/GitLab push payloads and triggers incremental re-indexing automatically
318
- - GitHub Actions composite action `.github/actions/purecontext-cache/action.yml`; caches the index between CI runs using `actions/cache`, exports after indexing, imports on cache hit
319
- - VS Code extension — `vscode-purecontext` extension wraps the MCP server with a sidebar panel for symbol search, file outline, and dependency graph directly in the editor
320
-
321
- ### Changed
322
-
323
- - `search_symbols` response now includes `repoId` in every result (was implicit from the request parameter) enables direct use in cross-repo result lists
324
- - `list_repos` now includes `gitEnabled` and `lastGitIndexed` fields when git metadata indexing is active
325
- - Default `fileLimit` raised from 1000 to 5000 (language expansion makes larger repos viable)
326
- - `_meta` envelope included in all tool responses (previously only retrieval tools); fields: `timing_ms`, `tokens_saved`, `total_tokens_saved`, `cost_avoided`
327
-
328
- ---
329
-
330
- ## [1.0.0] - 2026-04-26
331
-
332
- This is the first stable release of PureContext MCP. The public tool API is now under
333
- semver: breaking changes require a major version bump, new tools and fields increment
334
- the minor version, and bug fixes increment the patch version.
335
-
336
- ### Added
337
-
338
- **Core symbol indexing (TypeScript and JavaScript)**
339
- - Tree-sitter AST parsing via WASM bindings (`web-tree-sitter`) — no native compilation required for the parser itself
340
- - Extracts functions, classes, methods, constants, types, interfaces, and enums with one-line signatures
341
- - Deterministic symbol IDs (SHA-256 of `filePath:name:kind`) for stable cross-session references
342
- - SQLite storage (`better-sqlite3`) with four tables: `symbols`, `files`, `dep_edges`, `repos`
343
- - Incremental re-indexing via chokidar file watcher with debounce
344
-
345
- **Language support (16 languages)**
346
- - TypeScript and JavaScript (full symbol + import extraction)
347
- - Python, Go, Rust, Java, C, C++, C#, Swift, Kotlin, Dart
348
- - Elixir, Haskell, Scala, R
349
- - PHP, Lua, Ruby
350
-
351
- **Framework adapters (20+ frameworks)**
352
- - Vue 3 (SFC `<script setup>`, composables, components)
353
- - Nuxt 3 (pages, layouts, composables, server routes, plugins)
354
- - React and Next.js (components, hooks, server/client components, API routes)
355
- - Angular (components, services, pipes, guards, modules, directives)
356
- - Express and Fastify (routes, middleware, plugins)
357
- - Django, FastAPI, Flask (views, serializers, models, routers, dependencies)
358
- - SQLAlchemy and Prisma (models, schemas, migrations)
359
- - Axum and Actix-web (handlers, middleware, extractors)
360
- - Echo, Fiber, Gin (handlers, middleware, groups)
361
- - Spring and Hibernate (controllers, services, repositories, entities)
362
-
363
- **MCP tool surface (12 tools)**
364
- - `index_folder` — index a project directory
365
- - `resolve_repo` resolve a path to its repo ID
366
- - `list_repos` — list all indexed repositories
367
- - `search_symbols` — search by name fragment with kind and path filters
368
- - `get_symbol_source` — retrieve raw source by byte offsets
369
- - `get_file_outline` — all symbols in a file with signatures
370
- - `get_repo_outline` — all files with top-level symbols
371
- - `get_file_tree` — directory tree with file counts
372
- - `get_context_bundle` — transitive forward-walk from a symbol
373
- - `get_blast_radius` — reverse-walk to find all dependents
374
- - `find_importers` — direct importers of a file
375
- - `find_dead_code` — exported symbols that nothing imports
376
-
377
- **Dependency graph**
378
- - Import resolution with tsconfig path alias support
379
- - Forward (context bundle) and reverse (blast radius) BFS traversal
380
- - Dead code detection across the entire project graph
381
-
382
- **FTS5 keyword search with relevance ranking**
383
- - Full-text search over symbol names and signatures
384
- - camelCase query preprocessor (`getUserById` `get user by id`)
385
- - Hyphen-aware tokenization
386
- - Relevance ranker: exact name match prefix match content match
387
-
388
- **Semantic search HNSW vector index**
389
- - Optional embedding-based symbol search via `hnswlib-wasm`
390
- - Configurable embedding provider (Anthropic, OpenAI, or none)
391
- - Index persists alongside the SQLite database
392
-
393
- **Token savings tracker**
394
- - Each tool response includes `_tokenEstimate` so agents can gauge context size
395
- - Cumulative session savings reported by `list_repos`
396
-
397
- **Multi-tenant rate limiting**
398
- - Per-client request quotas configurable in `config.json`
399
- - Token bucket algorithm with burst allowance
400
-
401
- **Web UI**
402
- - Vite + Vue 3 dashboard served from the MCP process
403
- - Symbol search, file outline, dependency graph visualisation
404
- - 28 Playwright end-to-end tests
405
-
406
- **Worker thread pool for enterprise repos**
407
- - Parallel tree-sitter parsing across a configurable thread pool
408
- - Designed for 10k–50k file codebases
409
- - Graceful degradation to single-threaded mode when the pool is unavailable
410
-
411
- **npm release infrastructure**
412
- - `prebuildify` prebuilt binaries for Node 18/20/22 × Windows/macOS/Linux
413
- - GitHub Actions CI: 9-job matrix (3 OS × 3 Node versions) on every push and PR
414
- - Release workflow: prebuild + publish triggered by `v*` tags
415
- - `files` allowlist in `package.json` published package < 20 MB
416
- - `scripts/check-sqlite.js` postinstall canary with actionable error message
417
- - `scripts/verify-package.sh` pre-release verification helper
418
-
419
- **Public launch polish**
420
- - `--health` flagchecks prerequisites (grammars, SQLite, index directory) and exits with JSON output; non-zero exit code on any failure
421
- - Actionable error messages throughout: missing grammar files, SQLite open failures, and config validation all produce human-readable guidance instead of raw stack traces
422
- - Opt-in telemetry — reports anonymised usage counts (tool invocations, file counts); disabled by default, enabled via `telemetry.enabled: true` in config
423
-
424
- **Team and cloud features**
425
- - HTTP/SSE transportstart the server with `--transport http` (or `--transport both` for stdio + HTTP simultaneously); port and bind address configurable via `--port`/`--host` or `config.json`
426
- - API key management `purecontext-mcp keys create/list/revoke` CLI; keys stored as bcrypt hashes, shown once on creation; format `pctx_<workspaceId>_<24-char-random>_<checksum>`
427
- - Workspace support — logical namespaces that group repos and API keys; managed via the admin key (`PCTX_ADMIN_KEY` env var)
428
- - Docker deployment — official `purecontext/purecontext-mcp` image; `docker-compose.yml` included in the repo; `/health` HTTP endpoint for container health checks
429
-
430
- ### Changed
431
-
432
- - Minimum Node.js version: **18.0.0** (uses native `fetch`, `worker_threads`, `structuredClone`)
433
- - Default `fileLimit` raised from 500 to 1000
434
-
435
- ### Fixed
436
-
437
- - `web-tree-sitter` character-vs-byte offset bug in handler text extraction (all language handlers now use byte offsets throughout)
438
- - Forward-slash normalisation for file paths stored in SQLite (Windows compatibility)
439
- - FTS5 hyphen tokenization hyphens in symbol names are now indexed correctly
440
-
441
- ---
442
-
443
- ## [0.1.0] - 2026-04-10
444
-
445
- Initial internal release. Core TypeScript/JavaScript indexing, SQLite storage, and MCP stdio transport.
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ---
9
+
10
+ ## [Unreleased]
11
+
12
+ ---
13
+
14
+ ## [1.11.0] - 2026-06-14
15
+
16
+ ### Added
17
+
18
+ **Refactoring loop `prepare_change` `verify_change` `compare_change_impact`**
19
+
20
+ Three new read-only tools that turn PureContext from "flags risk" into "confirms the change was safe and complete." They are **judgment, not actuation** — none of them edit code; your agent applies the change, and these tell it what's safe and what's still missing, each with a plain-English `reasons[]` (not a bare confidence score). All three are thin consumers of the existing change-synthesis engine.
21
+
22
+ - **`prepare_change`** — pre-edit verdict for a stated `intent` (`rename` / `delete` / `modify` / `extract`) and a target (`targetSymbolId` or free-text `query`). Resolves the concrete change set and returns the predicted files, composite risk, historically co-changing files MISSING from the change (the "you forgot to touch X" signal), recommended tests, coverage gaps, architectural flags, and a `predictionId`. Returns `ambiguous_target` with candidates when a query has no clear match — it never guesses.
23
+ - **`verify_change`** — post-edit reconciliation of the real diff against the prediction: `unaddressedCoChange` (planned partners still untouched), `addressedCoChange`, `unplannedChanges` (scope creep), and `coverageGapsRemaining`. Verdict `complete` / `incomplete` / `scope_expanded`. Stateless — pass `predictedFilePaths` and `predictedCoChange` back from the prepare_change output. Co-change reconciliation is suppressed when the git signal is low.
24
+ - **`compare_change_impact`** — before/after architecture *regression* delta against a baseline snapshot: `newCycles` and `newLayerViolations` introduced by the change (plus `resolvedCycles` / `resolvedLayerViolations`). Distinct from `analyze_diff`'s `architecturalFlags`, which flag pre-existing issues this reports only the delta and never blames the change for problems it didn't create. Verdict `regressed` / `improved` / `unchanged` / `no_baseline`.
25
+
26
+ **`get_architecture_snapshot` stores diffable cycle/layer data.** Snapshots now persist import-cycle membership and layer violations in their metrics (additive — snapshots created before 1.11.0 are treated as "no usable baseline" by `compare_change_impact`).
27
+
28
+ ### Configuration
29
+
30
+ - `refactoring.maxCandidates` (default 5) how many candidate symbols `prepare_change` returns when disambiguating a free-text query.
31
+
32
+ ---
33
+
34
+ ## [1.10.0] - 2026-06-14
35
+
36
+ ### Added
37
+
38
+ **Node-version independence — WASM SQLite fallback (`@sqlite.org/sqlite-wasm`)**
39
+
40
+ PureContext now runs on **any Node.js ≥ 18**. The native `better-sqlite3` engine remains the fast path on Node 18/20/22; on any other Node — or whenever the native binary fails to load (e.g. an ABI mismatch under a Volta-pinned project) — PureContext automatically falls back to a pure-WASM SQLite engine that is ABI-independent.
41
+
42
+ - The WASM engine is FTS5-capable, so full-text search (`search_symbols`, `search_text`) works identically on the fallback. (`node:sqlite` and stock `sql.js` were evaluated and rejected — neither ships FTS5.)
43
+ - The fallback is **full-featured, not degraded**: FTS5, transactions, BLOBs, and the entire schema work. The only difference from native is throughput (WASM is somewhat slower on large indexes).
44
+ - Index database files use the standard SQLite format and are portable across the native and WASM engines.
45
+ - Backend selection is automatic and logged (`SQLite backend: WASM (@sqlite.org/sqlite-wasm)`). The override `PCTX_SQLITE_BACKEND=wasm` forces the fallback.
46
+
47
+ This eliminates the `MCP error -32000: Connection closed` failures caused by native ABI mismatches on Node versions without a matching prebuild (19/21/23/24+) or under per-project Node managers like Volta.
48
+
49
+ **Startup Node-version guard**
50
+
51
+ Running on Node < 18 now prints a clear, actionable message and exits — instead of crashing with an opaque `-32000 Connection closed`. A dependency-free launcher (`dist/bin.js`, now the package `bin`) checks the Node version *before* the heavy module graph (including any native addon) is loaded.
52
+
53
+ **Install pins the server to a globally-available Node**
54
+
55
+ `install` now configures the MCP server to run under the user's **global/default** Node (Volta's default via `platform.json`, else the system Node), independent of any project's Node pin:
56
+
57
+ - Claude Desktop config is written with the resolved absolute Node path.
58
+ - Claude Code **hooks** (`~/.claude/settings.json`) are pinned to the same global Node, instead of whatever Node ran `install` (previously they inherited a project-pinned version under Volta).
59
+ - `install claude` prints the exact `claude mcp add purecontext-mcp --scope user -- <node> <launcher>` command to register Claude Code at user scope.
60
+ - Machine-specific absolute paths are only ever placed in **user-scope** config never a project-committed `.mcp.json`, which stays portable (and now works on any project Node 18 thanks to the WASM fallback).
61
+
62
+ **Claude Code hook system overhaul**
63
+
64
+ Hooks now use CLI-style commands (`npx purecontext-mcp hook-*`) registered directly in `~/.claude/settings.json`. No scripts are copied to `~/.claude/hooks/` — the commands invoke the installed package directly, so hook logic updates automatically when the package updates.
65
+
66
+ Seven hook events are now supported (up from three):
67
+
68
+ | Hook event | Command | What it does |
69
+ |------------|---------|--------------|
70
+ | `PostToolUse` | `hook-posttooluse` | Re-indexes modified files after Edit/Write/MultiEdit |
71
+ | `PreCompact` | `hook-precompact` | Injects indexed repo list into context before compaction |
72
+ | `PreToolUse` | `hook-pretooluse` | Soft edit guard suggests read tools before editing |
73
+ | `WorktreeCreate` | `hook-worktree-create` | Auto-indexes a newly created agent worktree |
74
+ | `WorktreeRemove` | `hook-worktree-remove` | Fires when an agent worktree is removed |
75
+ | `TaskCompleted` | `hook-taskcompleted` | Post-task diagnostics: complexity stats, TODO count, tool suggestions |
76
+ | `SubagentStart` | `hook-subagentstart` | Injects condensed repo orientation for newly spawned subagents |
77
+
78
+ *TaskCompleted* after the agent finishes a task, queries each indexed repo for high-complexity symbols (cyclomatic complexity > 5) and TODO/FIXME annotations, then injects a diagnostic summary plus a reminder of relevant tools: `find_dead_code`, `find_untested_symbols`, `get_todos`, `get_complexity_hotspots`, `health_radar`.
79
+
80
+ *SubagentStart* when a subagent spawns it has no session context. This hook injects the indexed repo list (repoId, path, file and symbol counts, last-indexed timestamp) plus the mandatory workflow table so the subagent is oriented without needing an extra tool call.
81
+
82
+ *WorktreeCreate* — Claude Code's Agent tool can create isolated git worktrees for sub-tasks. This hook calls `index-folder` on the new worktree automatically so PureContext tools work immediately inside it.
83
+
84
+ Re-running `npx purecontext-mcp hooks --install` upgrades existing installations: old `node ~/.claude/hooks/purecontext-*.mjs` entries are replaced with the new CLI form, and the four new hook events are added.
85
+
86
+ ### Fixed
87
+
88
+ - Native backend detection now probes the `better-sqlite3` binding (a throwaway in-memory open) during selection. Previously the loader committed to native after only `require()`-ing the JS wrapper and then threw at first `open()` under a mismatched ABI (e.g. Node 21), bypassing the WASM fallback.
89
+
90
+ ---
91
+
92
+ ## [1.9.0] - 2026-06-07
93
+
94
+ ### Added
95
+
96
+ **Change-impact synthesis — `analyze_diff` reviews by impact, not by diff size (Phase 77, Phase A)**
97
+
98
+ `analyze_diff` is upgraded from "changed symbols + blast radius + a simple priority heuristic" into an impact-aware change report. Paste a unified `git diff` and, on top of the changed-symbol list, it now returns:
99
+
100
+ - **`missingCoChange`** — the headline new signal: files that *historically* change together with the edited files but are **absent from this diff** (the senior-reviewer "you touched `refundService` but `ledgerService` usually moves with it and it's not here" instinct). Suppressed entirely on thin/squashed history (`signalQuality: "low"`) — it never invents warnings.
101
+ - **`risk`**aggregate risk band (`low` / `review` / `high`) plus the top composite-risk symbols touched (reusing the Phase 76 `get_symbol_risk` engine).
102
+ - **`recommendedTests`** — tests that exercise the changed symbols, plus co-changing test files.
103
+ - **`coverageGaps`** — changed symbols with no detected test coverage.
104
+ - **`architecturalFlags`** — import cycles / layer-boundary crossings the changed files **currently sit on** (current-state *flags*, not "regressions introduced by the diff" — a before/after graph delta is deferred to a future `compare_change_impact`).
105
+ - **`reviewPriority`** same `low` / `medium` / `high` / `critical` enum, now folding in the aggregate risk band and coverage-gap count alongside the original signature-break / blast signal.
106
+
107
+ All impact sections default **on** and are individually switchable off (`includeRisk`, `includeCoChangeGaps`, `includeTests`, `includeArchitectureFlags`) for cheap runs — with all four off, the output reduces to the pre-1.9 shape exactly. All new fields are additive, so existing CI/JSON consumers are unaffected.
108
+
109
+ Internally this ships a reusable, MCP-free **change-synthesis core** (`synthesizeChange`) that a future pre-edit `prepare_change` orchestrator will consume verbatim, and a `RiskContext` performance refactor so scoring many symbols in one diff builds the repo-wide distributions once instead of per symbol (composite-risk output is byte-identical).
110
+
111
+ New config: `changeSynthesis.coChangeConfidenceThreshold` (0.4), `changeSynthesis.maxSymbolsScored` (25), `changeSynthesis.maxCoChangeGaps` (10), `changeSynthesis.maxRecommendedTests` (15). Risk weights reuse `risk.weights`; mega-commit handling reuses `git.megaCommitThreshold`. **Still deliberately code-centered: no author, ownership, or productivity metrics.**
112
+
113
+ ---
114
+
115
+ ## [1.8.0] - 2026-06-04
116
+
117
+ ### Added
118
+
119
+ **Temporal risk intelligence (Phase 76)**
120
+
121
+ PureContext now models the one signal a static dependency graph can't derive — which files *historically change together* — and fuses it with the risk primitives it already computes into a single, explainable verdict surfaced *before* you edit.
122
+
123
+ - **`get_co_change`** — temporal coupling. Reports the files that change together with a target file or symbol, derived from git commit history. Surfaces coupling the import graph cannot see (a route and its test; a feature flag and the code it gates). Returns explainable association metrics — `support` (shared commits), `confidence` (directional A→B probability), and `lift` (association strength) — with mega-commits (reformats, lockfile sweeps, codemods) filtered out and down-weighted by `1/(k−1)`. Granularity is file-level (a `symbolId` resolves to its file). Shallow/sparse histories return `signalQuality: "low"` instead of overstating weak ratios.
124
+ - **`get_symbol_risk`** composite, explainable "how risky is it to change this symbol?" score (0–100, banded `low` / `review` / `high`). Blends churn (90 d), centrality (afferent coupling + reverse blast radius), cyclomatic complexity, test-coverage gap, and co-change spread — each normalized **repo-relative** (midrank percentile) so the score is comparable within a repo and not dominated by absolute size. Always returns `factors` (raw + normalized) and human-readable `reasons[]` — never a black-box number. Weights are configurable via `risk.weights`.
125
+ - **`get_context_bundle` → `historicalNeighbors`** — the bundle now appends files that historically change with the target but are *not* reachable through imports, each with a small outline. Empty (and bundle output byte-identical to before) when no co-change data exists, so token estimates are unchanged unless the signal is present.
126
+ - **`includeRisk` flag** on `search_symbols` and `get_symbol_source` — opt-in (default `false`, no added cost). When set, each result carries a compact `{ band, riskScore }`; the full breakdown stays in `get_symbol_risk`.
127
+
128
+ Capture is a single repo-level `git log --name-only -n N` stored in a dedicated `commit_files` table (separate from `git_metadata`, whose per-file last-10 window is too shallow and recency-skewed for co-change). New config: `git.coChangeDepth` (default 300; `0` disables capture entirely with zero behavioral change) and `git.megaCommitThreshold` (default 30). Capture is additive and failure-tolerant; skipped for non-git directories. **Deliberately code-centered: no author, ownership, or productivity metrics.**
129
+
130
+ Known limitations (documented, not bugs): repo-level capture does not `--follow`, so a mid-history rename splits a file's co-change signal; squash-merge monorepos can inflate coupling (mitigated by `megaCommitThreshold` + `signalQuality`).
131
+
132
+ **TypeScript HOC arrow detection + `delete-index` CLI (Phase 74)**
133
+
134
+ - HOC-wrapped arrow/function exports — `export const X = React.memo(fn)`, `forwardRef<T,P>(fn)`, `withRouter(fn)` — are now stored as `kind=function` instead of `kind=const`, so rendering-domain ranking (`computeRenderingCompoundBoost`, `kindBoost`) can see them.
135
+ - New `npx purecontext-mcp delete-index <path>` command cleanly removes a project's stored index.
136
+
137
+ ### Database
138
+
139
+ - Schema version bumped to **8**: additive `commit_files` table (`repo_id`, `commit_sha`, `file_path`, `commit_date`) with a `commit_sha` index. Migration is backward-safe — existing indexes load without re-indexing; co-change/risk simply report low signal until the next re-index captures history.
140
+
141
+ ---
142
+
143
+ ## [1.7.0] - 2026-06-01
144
+
145
+ ### Added
146
+
147
+ **Svelte and Astro single-file-component support (Phase 75)**
148
+
149
+ - **Svelte** (`.svelte`)a `splitSvelteSFC` preprocessor extracts `<script>` and `<script context="module">` blocks; one `component` symbol per file; `useXxx` helpers are classified as composables.
150
+ - **Astro** (`.astro`)a `splitAstroSFC` preprocessor extracts the leading `---` frontmatter as a TypeScript block; one `component` symbol per file. A `---` later in markup is not treated as frontmatter; an unterminated fence raises a parse error.
151
+ - Both adapters use a shared `detect-utils.ts` providing bounded recursive monorepo detection (mirrors the Vue/Nuxt approach).
152
+
153
+ ### Fixed
154
+
155
+ **Adapter-extension wiring (the `.vue`-not-indexed bug class, Phase 75)**
156
+
157
+ - The **file watcher** and the **GitHub remote-index path** now union adapter extensions (`getAdapterExtensions(getRegisteredAdapters())`) into their handler-extension sets, so `.vue`/`.svelte`/`.astro` edits trigger re-index and remote SFC blobs are no longer dropped. (Previously both gated on handler extensions only.) New `watchedExtensions()` helper for testability.
158
+ - The **benchmark harness** now imports all framework adapters for self-registration — it previously registered 40 handlers but 0 adapters, so it had never indexed `.vue`. Vue/Nuxt benchmark numbers shift on the next run as a measurement-scope correction, not a regression.
159
+
160
+ ---
161
+
162
+ ## [1.5.0] - 2026-05-22
163
+
164
+ ### Added
165
+
166
+ **New language handlers**
167
+
168
+ - **HCL / Terraform** (`.tf`, `.tfvars`, `.hcl`) extracts `variable`, `output`, `resource`, `data`, `module`, `provider`, and `locals` blocks; names follow Terraform reference syntax (`var.name`, `module.name`, `local.name`, `output.name`) so queries match the way you write them in code
169
+ - **Angular HTML templates** (`.html`) extracts component selectors, structural directives (`*ngIf`, `*ngFor`, `@if`, `@for`), event bindings (`(click)="handler"`), template references (`#userInput`), and `routerLink` directives; auto-detected via a sibling `.component.ts` file or Angular marker patterns
170
+ - **Extensionless scripts** extensionless files (e.g. `plugins/*/functions` in Bash-heavy projects) are now discovered and indexed automatically; shebang detection routes each file to the correct handler
171
+
172
+ **Objective-C handler overhaul**
173
+
174
+ - `@interface`, `@protocol`, and `@implementation` declarations now fully extracted from both `.m` and `.h` files
175
+ - Named categories stored as `ClassName+CategoryName`; anonymous categories flagged with `classExtension: true`
176
+ - Full Objective-C selector building (`setObject:forKey:`) instead of plain method names
177
+ - Properties extracted with `property` kind (was `const`)
178
+ - `.h` files guarded by an ObjC detection pass — C headers that happen to use `.h` are not misidentified
179
+
180
+ **XML symbol disambiguation**
181
+
182
+ - Root-element symbols in multi-module XML repositories (e.g. `pom.xml` across 30+ Maven modules) are now stored as `tag@module` names, eliminating collisions where every module shared the same top-level element name
183
+ - Bare tag name retained as an FTS token so single-word queries still find the right file
184
+
185
+ **Search relevance improvements**
186
+
187
+ - *Monorepo path heuristics* frontend app directories (`apps/dashboard/`, `apps/web/`) get a score boost when the query contains hook or component vocabulary; avoids backend symbols drowning React/Angular results in mixed monorepos
188
+ - *Java/Groovy core-path boost* symbols in `/core/src/main/java/` paths boosted; symbols in plugin directories penalised; reduces noise from plugin implementations when querying for core API methods
189
+ - *Library path penalties* extended to cover `engine/`, `erts/`, and `contrib/` directory segments (common in projects that embed a runtime)
190
+ - *Compound underscore boost* fires when all underscore-separated parts of a symbol name are present in the query, without requiring an exact full-name match
191
+ - *Single-token exact match boost* — single-word queries reliably surface the best exact match at rank 1
192
+ - *Cross-language FTS aliases* — Neovim `nvim_*` C functions get a `vim.api.nvim_*` alias so Lua-style queries (`vim.api.nvim_open_win`) find the C implementation; Proto RPC method symbols include their service name as an FTS token
193
+ - *Erlang bare function names* Erlang symbols stored without arity suffix (`start_link` instead of `start_link/3`); arity preserved in `frameworkMeta`; module name injected as an FTS token so `module:function` queries work
194
+ - *TypeScript HOC detection* — `export const X = React.memo(() => ...)`, `forwardRef(...)`, and similar HOC-wrapped arrow functions emitted as `kind=function` instead of `kind=const`, ensuring rendering-domain boosts fire correctly
195
+
196
+ ### Fixed
197
+
198
+ - Case-insensitive file extension matching in file discovery (`.F90` Fortran files were silently skipped)
199
+ - Directory trailing-slash handling in `ignore` negation patterns — fixes traversal of directories with explicit `!negation` rules
200
+ - Index workers were missing registrations for the Fortran, SCSS, LESS, CSS, and Objective-C handlers; files with those extensions were silently dropped before parsing
201
+ - C++ qualified name FTS bare local name (`Future`) now stored as a separate FTS token alongside the fully-qualified name (`folly::Future`), improving single-word C++ queries
202
+ - Rust synonym scoping `future→poll`, `spawn→tokio/task`, and serde-specific synonyms now fire only in Rust repositories, preventing them from polluting C++ search results
203
+
204
+ ---
205
+
206
+ ## [1.4.0] - 2026-05-20
207
+
208
+ ### Added
209
+
210
+ **New MCP tools**
211
+
212
+ - `get_lexical_scope_matches` — returns all symbols accessible from a given file and line (local scope, module imports, and exported API), letting agents reason about what identifiers are in scope without reading whole files
213
+ - `trace_invocation_chain` — follows call edges from a symbol N hops deep and returns the linearised invocation path; useful for tracing a request from an entry point through to storage
214
+
215
+ **Language handler depth**
216
+
217
+ - *Ruby* — DSL macro extraction: `has_many`, `belongs_to`, `has_one`, `has_and_belongs_to_many`, `before_action`, `after_action`, `validates`, and `scope` class macros extracted as `property` symbols; metaprogramming patterns (`define_method`, `method_missing`) flagged in `frameworkMeta`
218
+ - *Rust*`#[cfg(...)]` attributes now captured in `frameworkMeta.cfgAttributes`; new `cfgFilter` parameter on `search_symbols` restricts results to symbols matching a specific cfg condition (e.g. `target_os = "linux"`)
219
+ - *C++*export-macro class extraction: `class MY_EXPORT ClassName` and similar patterns now correctly identified as class declarations rather than function definitions
220
+ - *TypeScript*`export const X = forwardRef(...)` / `React.memo(...)` and similar HOC patterns emitted as `kind=function`; decorator extraction inside `export_statement` wrapper fixed (was silently dropping `@Injectable` and similar decorators on exported classes)
221
+ - *C#*interface member extraction fixed (interface members are implicitly public; visibility guard removed); method name extraction uses `findLast` before `parameter_list` to avoid returning the return type; event field declarations (`event_field_declaration`) extracted as `property` kind
222
+ - *Kotlin*extension function extraction; primary constructor property parameters extracted as `property` symbols
223
+ - *PHP*PHP 8 `#[Attribute]` syntax parsed correctly; Symfony route and controller patterns added to quality-gate trigger; property declarations, `define()` constants, closures, abstract methods, enum cases, and interface constants all extracted
224
+
225
+ **Search quality**
226
+
227
+ - FTS BM25 raw rank exposed to the relevance ranker — high keyword-match scores contribute a 0–50 point bonus on top of structural scoring; prevents purely-structural boosts from overriding strong keyword matches
228
+ - Docstring extraction extended Python and C++ full-paragraph docstrings (not just the first line) fed to the FTS index; improves matches for queries that use documentation vocabulary rather than identifier names
229
+ - Nuxt/Vue-specific vocabulary synonyms added (`composable`, `setup`, `defineComponent`, `useNuxt`, etc.)
230
+ - `search_symbols` returns `verdict: "no_match"` with `negative_evidence` details when all retrieval strategies are exhausted, allowing agents to stop retrying instead of looping through variant queries
231
+
232
+ **Multi-IDE installer**
233
+
234
+ `npx purecontext-mcp install <tool|all>` now supports:
235
+
236
+ | IDE / Tool | Config location |
237
+ |------------|----------------|
238
+ | Cursor | `.cursor/rules/purecontext.mdc` |
239
+ | Windsurf | `.windsurfrules` |
240
+ | Continue | `.continue/config.json` system message |
241
+ | Cline | `.clinerules` |
242
+ | Roo Code | `.roo/rules-code.md` |
243
+ | VS Code Copilot | `.github/copilot-instructions.md` |
244
+ | Claude Desktop | Platform config (`claude_desktop_config.json`) |
245
+
246
+ All writers are idempotent — running `install` a second time updates the existing block rather than appending a duplicate.
247
+
248
+ **Claude Code hooks**
249
+
250
+ - *PostToolUse index hook* re-indexes modified files automatically after any Edit/Write tool call, keeping the symbol index in sync with in-session edits
251
+ - *PreCompact snapshot hook* captures an architecture snapshot before context is compacted
252
+ - *Edit guard hook* (soft) — warns when an edit target has dependents with high blast radius; never blocks
253
+
254
+ Install via `npx purecontext-mcp hooks --install`.
255
+
256
+ ### Fixed
257
+
258
+ - `expandVerbSynonyms`: prototype-chain collision on the `constructor` key — calling `expandVerbSynonyms("constructor")` previously returned the built-in `Function.prototype.constructor`; fixed by using `Object.create(null)` for the synonym map
259
+ - Test-mapper transaction: FK constraint errors no longer propagate and block FTS index population
260
+ - Windows path-case mismatch: repo ID computation now uses the canonical absolute path from the indexer output rather than recomputing from a potentially different-cased input string
261
+
262
+ ---
263
+
264
+ ## [1.3.0] - 2026-05-16
265
+
266
+ ### Added
267
+
268
+ **Search quality**
269
+
270
+ - *OR-fallback retrieval* when the FTS5 AND query returns too few results, the engine automatically retries with an OR query and re-ranks the combined pool; improves recall for longer, natural-language queries
271
+ - *Abbreviation expansion* — common abbreviations in queries expanded before FTS: `db→database`, `auth→authentication`, `cfg→configuration`, `mgr→manager`, `ctrl→controller`, and 40+ more; C/C++ abbreviations included
272
+ - *camelCase boundary tokenisation* — FTS5 index now correctly splits `getUserById` into `get`, `user`, `by`, `id` at index time, not just at query time; improves recall when query uses word-boundary terms that appear inside camelCase identifiers
273
+ - *Verb synonym expansion* — common verb synonyms expanded at query time: `fetch↔get↔retrieve`, `create↔insert↔add`, `delete↔remove↔drop`, `update↔modify↔edit`, `authenticate→login`, `list↔find`, and more
274
+ - *Stop-word expansion* 30 additional stop words filtered from multi-word queries: `with`, `without`, `using`, `via`, `existing`, `before`, `after`, `during`, and others
275
+ - *Service/repository kind boost* — `*Service` method symbols +30, `*Repository`/`*Manager`/`*Store` method symbols +15; surfaces application-layer API methods before utility helpers with similar names
276
+ - *Method verb bonus* fires when the first camelCase part of a method name (the action verb) matches a query word, differentiating `ProductsService.create` from `buildProductListCacheKey`
277
+ - *Quality-gate OR-fallback* if the AND pool contains no `*Service`/`*Repository` methods even after the first OR-fallback, a second OR pass retrieves the broader candidate pool
278
+ - *Stem matching* — pluralised name parts (`products→product`) now match singular query words
279
+ - *Library path penalty* — symbols from `vendor/`, `node_modules/`, `bower_components/`, `third_party/`, and similar paths penalised to prevent dependency code from ranking above project code
280
+
281
+ **New stylesheet handlers**
282
+
283
+ - *SCSS / SASS* (`.scss`, `.sass`) `@mixin` → function, `@function` → function, top-level `$variable` → const, `%placeholder` → class, `@keyframes` → type
284
+ - *LESS* (`.less`) `.mixin(@params){}` function, top-level `@variable` → const, `@keyframes` → type
285
+ - *CSS* (`.css`) CSS custom properties (`--token-name`) indexed as const (opt-in via `indexing.cssVariables: true` in config)
286
+
287
+ **Handler depth improvements**
288
+
289
+ - *Go* — interface `method_spec` extraction; top-level `var` declarations; `*Handler`/`*DB`/`*Client` receiver types added to kind-boost patterns
290
+ - *Java*inner-class extraction no longer gated on `isStatic`; package-private methods included; Android `Activity`/`Fragment`/`ViewModel` pattern boosts
291
+ - *Rust* — `impl` methods filtered to `pub` visibility by default; `trait` implementations boosted; Rust-specific synonyms scoped to Rust repos only
292
+ - *PHP* — UTF-8 multibyte character offset bug fixed (was producing broken symbol names for methods after accented characters in source); property declarations, closures, `define()` global constants, abstract methods, PHP 8.1 enum cases, and interface constants all extracted
293
+ - *TypeScript*decorator extraction inside `export_statement` wrapper fixed
294
+
295
+ ### Fixed
296
+
297
+ - FTS5 syntax error in synonym OR-groups: tokens joined as `(a OR b)` were concatenated without an explicit `AND` connector when followed by another group, producing invalid FTS5 queries; fixed by inserting explicit ` AND ` between groups and checking for top-level OR context before switching to OR-fallback mode
298
+ - `namePrefix` word-boundary guard: stem matching no longer fires when a name only contains the query word as an interior substring (e.g. query `user` no longer matches `superuser` via stem)
299
+ - Short-token filter in multi-word query branch: tokens shorter than 2 characters no longer enter the AND query, preventing FTS5 from returning zero results on trivially-true constraints
300
+
301
+ ---
302
+
303
+ ## [1.2.0] - 2026-05-13
304
+
305
+ ### Added
306
+
307
+ **Advanced relationship analysis**
308
+ - `find_implementations`find all concrete implementations of a TypeScript interface or abstract class; returns implementing classes with `implementedMethods` and `missingMethods` arrays compared against the interface contract
309
+ - `get_call_hierarchy` callers and callees of a function N levels deep as a hierarchical tree; supports `callers`, `callees`, and `both` directions; recursive calls marked `cyclic: true`
310
+ - `get_class_hierarchy` full inheritance tree rooted at a class, showing both ancestors and descendants; use before refactoring a base class to understand the full polymorphism surface
311
+ - `find_cycles`detect circular import dependencies across the repo or a subtree; returns strongly-connected components with severity rating
312
+ - `get_coupling_map` — afferent/efferent coupling metrics and instability scores (`I = efferent / (afferent + efferent)`) for every file; highlights highest-risk refactoring candidates
313
+
314
+ **Architectural visualization**
315
+ - `render_diagram` general-purpose Mermaid or DOT dependency diagram (module, call graph, class hierarchy); output renders natively in GitHub, VS Code, and Claude
316
+ - `render_call_graph`specialized call graph diagram rooted at a symbol with call-graph-specific layout options
317
+ - `render_import_graph`file-level import graph for a directory or whole repo; nodes clustered by directory
318
+ - `render_class_hierarchy`class inheritance diagram in Mermaid `classDiagram` format; shows fields, methods, and inheritance/implementation relationships
319
+ - `render_dep_matrix` dependency matrix diagram showing coupling between modules as a grid; surfaces structural hotspots at a glance
320
+ - `get_architecture_snapshot` — captures architectural state (file count, symbol count, module breakdown, coupling summary, health scores); take two snapshots to prove structural improvement objectively
321
+
322
+ **Refactoring safety checks**
323
+ - `check_rename_safe` pre-flight check before renaming a symbol; returns `safe` verdict and all `affectedSites` (call, import, type-reference, string-literal, comment) with file, line, column, and context snippet
324
+ - `check_delete_safe` pre-flight check before deleting a symbol; returns `safe: false` if anything in the repo still imports or references the symbol
325
+ - `check_move_safe` pre-flight check before moving a symbol to a different file; validates no import conflicts and lists all import statements that need updating
326
+ - `plan_refactoring` generate a sequenced, dependency-ordered plan for a structural change from a natural-language description; steps ordered so lower-risk changes happen first
327
+
328
+ **Health dashboards & debt reporting**
329
+ - `health_radar` — five-axis health score (complexity, coupling, maintainability, documentation, stability), each 0–100; returns `overallHealth` score and letter grade (A–F); designed for CI health gates
330
+ - `diff_health_radar` compare two health radar snapshots (before/after a refactoring) with axis-by-axis deltas and regression/improvement verdicts
331
+ - `get_debt_report` — detailed technical debt report with per-file rankings, priority tiers, worst files by each metric, specific symbols to address, and estimated effort indicators
332
+
333
+ **AST-level search**
334
+ - `search_ast` find every occurrence of a specific tree-sitter node type across all indexed files (e.g. `try_statement`, `arrow_function`, `await_expression`); returns file, line, column, and snippet
335
+ - `search_by_signature` — search symbols by type signature pattern (regex or substring); find all functions returning `Promise<void>` or methods accepting a `Request` parameter
336
+ - `search_by_decorator` — find all symbols annotated with a specific decorator; works for TypeScript (`@Injectable`, `@Controller`) and Python (`@app.route`, `@property`) decorators
337
+ - `search_by_complexity` — find symbols above or below a complexity threshold; returns symbols ranked by complexity score; use before refactoring sprints or to enforce complexity budgets
338
+
339
+ **Code intelligence helpers**
340
+ - `get_entry_points` — identify all runnable entry points: main functions, CLI handlers, HTTP server startups, Lambda handlers, test suites, and scripts; each result includes `kind`, `confidence`, and reason
341
+ - `get_public_api` all exported symbols grouped by file; use to document a library, audit what is exposed, or check for accidental exports
342
+ - `get_todos` — find all TODO, FIXME, HACK, NOTE, and XXX comments across the repo with file, line, tag type, and comment text
343
+ - `get_complexity_hotspots` symbols ranked by complexity score, highest first; use to identify the worst functions before a refactoring sprint
344
+ - `get_type_graph` — type dependency graph showing which types reference which other types, rooted at a specific type or across the whole repo; supports `uses`, `usedBy`, and `both` directions
345
+ - `find_untested_symbols` — exported symbols with no corresponding test coverage, ranked by complexity (highest priority first); uses import-based heuristics
346
+ - `get_test_coverage_map` — per-file coverage map showing which symbols are referenced by test files and which are not; produces `coverageRatio` per file and aggregated totals
347
+
348
+ **Documentation guides**
349
+ - `AST-SEARCH.md` guide to AST-level search tools and tree-sitter node types
350
+ - `CODE-INTELLIGENCE.md` — guide to code intelligence helper tools
351
+ - `HEALTH-DASHBOARDS.md` guide to health radar, debt reporting, and architecture snapshots
352
+ - `REFACTORING-SAFELY.md` guide to refactoring safety check tools and pre-flight workflows
353
+ - `UNDERSTANDING-RELATIONSHIPS.md` guide to relationship analysis tools (call hierarchy, class hierarchy, coupling)
354
+ - `VISUALIZING-CODE.md` guide to diagram rendering tools and Mermaid output
355
+ - `WORKFLOW-TECH-DEBT.md` end-to-end tech debt sprint workflow
356
+
357
+ ### Fixed
358
+
359
+ - Token savings tracker: corrected cumulative savings calculation and fixed display in web UI
360
+ - Web UI: dependency graph and repo detail pages now render correctly after token tracker refactor
361
+ - Docker: UI workspace panel and repo list routing fixes
362
+
363
+ ---
364
+
365
+ ## [1.1.0] - 2026-05-07
366
+
367
+ ### Added
368
+
369
+ **New MCP tools**
370
+ - `find_references` — find all usage/call sites for a symbol across the repo (identifier-level, not import-level)
371
+ - `get_file_content` — retrieve raw cached file content with optional line-range slicing (`startLine`/`endLine`)
372
+ - `get_symbols` — batch-fetch multiple symbols by ID, returning source in a single round-trip
373
+ - `invalidate_cache` — force a full or per-file re-index by clearing content hashes; accepts optional `filePath` to scope invalidation
374
+
375
+ **Tool capability enhancements**
376
+ - `search_symbols`: new `debug` parameter — includes per-result relevance scoring breakdown (FTS5 rank, kind boost, exact-match bonus)
377
+ - `get_symbol_source`: new `context_lines` parameter (extra lines above/below) and `verify` flag (re-reads from disk to confirm source is current)
378
+ - `index_repo`: clone and index a remote Git repository by URL; supports private repos via `token`; clones stored at `~/.purecontext/clones/`
379
+ - AI summarization via Gemini Flash configurable as an embedding/summarization provider alongside Anthropic and OpenAI
380
+
381
+ **Ecosystem & data tools**
382
+ - Context provider framework plugin interface (`ContextProvider`) for domain-specific symbol enrichment; providers auto-detected from project config
383
+ - dbt integration indexes models, sources, seeds, macros, and exposures; dbt Jinja pre-processor expands `{{ ref() }}` / `{{ source() }}` before SQL parsing; column definitions from `schema.yml` stored in `frameworkMeta.columns`
384
+ - OpenAPI/Swagger handler parses `.yaml`/`.yml` files detected as OpenAPI specs; indexes endpoints and schemas as symbols
385
+ - SQL handler — indexes tables, views, functions, and stored procedures; works standalone and with dbt Jinja expansion
386
+ - `search_columns` tool search dbt/SQL column definitions by name or description, with upstream/downstream lineage
387
+
388
+ **Language coverage expansion to 34 languages**
389
+
390
+ 16 new language handlers added (previously 18):
391
+
392
+ | Language | Extensions | Key symbol types |
393
+ |----------|-----------|-----------------|
394
+ | Bash | `.sh`, `.bash` | function |
395
+ | Perl | `.pl`, `.pm` | function, package |
396
+ | Terraform / HCL | `.tf`, `.hcl` | resource, module, variable, output |
397
+ | Nix | `.nix` | function, attribute |
398
+ | Protobuf | `.proto` | message, service, enum, rpc |
399
+ | GraphQL | `.graphql`, `.gql` | type, query, mutation, subscription, fragment |
400
+ | Groovy | `.groovy` | function, class, method |
401
+ | Erlang | `.erl`, `.hrl` | function, module |
402
+ | Gleam | `.gleam` | function, type |
403
+ | GDScript | `.gd` | function, class, signal |
404
+ | XML | `.xml` | element (pattern-configurable) |
405
+ | Objective-C | `.m`, `.h` | function, class, method |
406
+ | Fortran | `.f90`, `.f95`, `.for`, `.f` | function, subroutine, module |
407
+ | SQL | `.sql` | table, view, function, procedure |
408
+ | OpenAPI / YAML | `.yaml`, `.yml` | endpoint, schema |
409
+ | PHP (doc coverage) | existing | PHPDoc `/** */` extraction improved |
410
+
411
+ **Cross-repo intelligence**
412
+ - `search_cross_repo` tool unified symbol search across all repos in a workspace; supports keyword, semantic, and hybrid modes; results include `repoId` and `repoPath`
413
+ - `find_similar` tool find semantically similar code across repos using HNSW cosine similarity; configurable `minSimilarity` threshold (requires semantic search enabled)
414
+ - Cross-repo dependency tracking `dep_edges` extended with `sourceRepoId`/`targetRepoId` columns; `get_blast_radius` and `find_importers` can now follow edges across repo boundaries
415
+ - MCP Resources indexed symbol outlines exposed as MCP Resources (`purecontext://repo/<repoId>/outline`) for clients that support resource subscriptions
416
+
417
+ **Git & history integration**
418
+ - Git metadata indexing — during `index_folder`, PureContext walks `git log` and maps commits to symbols via byte-range overlap; stored in new `git_metadata` SQLite table; configurable via `git.enabled`, `git.maxCommits`, `git.branches`
419
+ - `get_symbol_history` tool — symbol-level commit history (hash, author, date, message, diff) without agents needing to run git commands
420
+ - `get_churn_metrics` toolfile or symbol churn scores (commits, lines changed, authors, churn score) with optional `since` date filter; surfaces high-risk files
421
+
422
+ **AI-powered architecture analysis**
423
+ - `get_quality_metrics` tool — per-file quality scores: cyclomatic complexity, coupling (fan-in/fan-out), cohesion, doc coverage, and a composite 0–100 score
424
+ - `detect_antipatterns` tool — detects god classes, circular dependencies, deep inheritance, feature envy, and other common anti-patterns; results include severity and symbol ID
425
+ - `get_architecture_doc` toolauto-generates a Markdown or Mermaid architecture summary from the dependency graph and quality metrics
426
+ - `get_layer_violations` tooldetects import boundary violations given a layer definition (e.g., controllers must not import repositories directly)
427
+
428
+ **Enhanced Web UI**
429
+ - Architecture heatmap — colour-coded file tree where heat indicates churn score or quality score; helps identify hot spots at a glance
430
+ - Symbol timeline — visual history of commits touching a symbol, linked to `get_symbol_history` data
431
+ - Test coverage overlay — when a coverage JSON report is present, file tree nodes show line coverage percentages
432
+ - Multi-repo workspace view repository picker with cross-repo search tab; switch between repos without reloading
433
+ - Advanced dependency graph zoom/pan, node grouping by directory, edge filtering by kind, and path highlighting between two selected nodes
434
+
435
+ **Distribution & platform**
436
+ - Index export (`npx purecontext-mcp export`) — archives the SQLite database and HNSW index into a portable `.pctx.tar.gz` file
437
+ - Index import (`npx purecontext-mcp import`) restores an exported archive; repo is immediately searchable, no re-indexing required
438
+ - Public registry — pre-built indexes for popular open-source projects hosted on CDN; pull with `npx purecontext-mcp pull <package>@<version>`; browse with `npx purecontext-mcp registry list`
439
+ - Webhook auto-reindexHTTP endpoint (`POST /webhook/reindex`) accepts GitHub/GitLab push payloads and triggers incremental re-indexing automatically
440
+ - GitHub Actions composite action — `.github/actions/purecontext-cache/action.yml`; caches the index between CI runs using `actions/cache`, exports after indexing, imports on cache hit
441
+ - VS Code extension — `vscode-purecontext` extension wraps the MCP server with a sidebar panel for symbol search, file outline, and dependency graph directly in the editor
442
+
443
+ ### Changed
444
+
445
+ - `search_symbols` response now includes `repoId` in every result (was implicit from the request parameter) — enables direct use in cross-repo result lists
446
+ - `list_repos` now includes `gitEnabled` and `lastGitIndexed` fields when git metadata indexing is active
447
+ - Default `fileLimit` raised from 1000 to 5000 (language expansion makes larger repos viable)
448
+ - `_meta` envelope included in all tool responses (previously only retrieval tools); fields: `timing_ms`, `tokens_saved`, `total_tokens_saved`, `cost_avoided`
449
+
450
+ ---
451
+
452
+ ## [1.0.0] - 2026-04-26
453
+
454
+ This is the first stable release of PureContext MCP. The public tool API is now under
455
+ semver: breaking changes require a major version bump, new tools and fields increment
456
+ the minor version, and bug fixes increment the patch version.
457
+
458
+ ### Added
459
+
460
+ **Core symbol indexing (TypeScript and JavaScript)**
461
+ - Tree-sitter AST parsing via WASM bindings (`web-tree-sitter`) — no native compilation required for the parser itself
462
+ - Extracts functions, classes, methods, constants, types, interfaces, and enums with one-line signatures
463
+ - Deterministic symbol IDs (SHA-256 of `filePath:name:kind`) for stable cross-session references
464
+ - SQLite storage (`better-sqlite3`) with four tables: `symbols`, `files`, `dep_edges`, `repos`
465
+ - Incremental re-indexing via chokidar file watcher with debounce
466
+
467
+ **Language support (16 languages)**
468
+ - TypeScript and JavaScript (full symbol + import extraction)
469
+ - Python, Go, Rust, Java, C, C++, C#, Swift, Kotlin, Dart
470
+ - Elixir, Haskell, Scala, R
471
+ - PHP, Lua, Ruby
472
+
473
+ **Framework adapters (20+ frameworks)**
474
+ - Vue 3 (SFC `<script setup>`, composables, components)
475
+ - Nuxt 3 (pages, layouts, composables, server routes, plugins)
476
+ - React and Next.js (components, hooks, server/client components, API routes)
477
+ - Angular (components, services, pipes, guards, modules, directives)
478
+ - Express and Fastify (routes, middleware, plugins)
479
+ - Django, FastAPI, Flask (views, serializers, models, routers, dependencies)
480
+ - SQLAlchemy and Prisma (models, schemas, migrations)
481
+ - Axum and Actix-web (handlers, middleware, extractors)
482
+ - Echo, Fiber, Gin (handlers, middleware, groups)
483
+ - Spring and Hibernate (controllers, services, repositories, entities)
484
+
485
+ **MCP tool surface (12 tools)**
486
+ - `index_folder` — index a project directory
487
+ - `resolve_repo` — resolve a path to its repo ID
488
+ - `list_repos` — list all indexed repositories
489
+ - `search_symbols` — search by name fragment with kind and path filters
490
+ - `get_symbol_source` — retrieve raw source by byte offsets
491
+ - `get_file_outline` — all symbols in a file with signatures
492
+ - `get_repo_outline` — all files with top-level symbols
493
+ - `get_file_tree` — directory tree with file counts
494
+ - `get_context_bundle` — transitive forward-walk from a symbol
495
+ - `get_blast_radius` — reverse-walk to find all dependents
496
+ - `find_importers` — direct importers of a file
497
+ - `find_dead_code` — exported symbols that nothing imports
498
+
499
+ **Dependency graph**
500
+ - Import resolution with tsconfig path alias support
501
+ - Forward (context bundle) and reverse (blast radius) BFS traversal
502
+ - Dead code detection across the entire project graph
503
+
504
+ **FTS5 keyword search with relevance ranking**
505
+ - Full-text search over symbol names and signatures
506
+ - camelCase query preprocessor (`getUserById` → `get user by id`)
507
+ - Hyphen-aware tokenization
508
+ - Relevance ranker: exact name match → prefix match → content match
509
+
510
+ **Semantic search — HNSW vector index**
511
+ - Optional embedding-based symbol search via `hnswlib-wasm`
512
+ - Configurable embedding provider (Anthropic, OpenAI, or none)
513
+ - Index persists alongside the SQLite database
514
+
515
+ **Token savings tracker**
516
+ - Each tool response includes `_tokenEstimate` so agents can gauge context size
517
+ - Cumulative session savings reported by `list_repos`
518
+
519
+ **Multi-tenant rate limiting**
520
+ - Per-client request quotas configurable in `config.json`
521
+ - Token bucket algorithm with burst allowance
522
+
523
+ **Web UI**
524
+ - Vite + Vue 3 dashboard served from the MCP process
525
+ - Symbol search, file outline, dependency graph visualisation
526
+ - 28 Playwright end-to-end tests
527
+
528
+ **Worker thread pool for enterprise repos**
529
+ - Parallel tree-sitter parsing across a configurable thread pool
530
+ - Designed for 10k–50k file codebases
531
+ - Graceful degradation to single-threaded mode when the pool is unavailable
532
+
533
+ **npm release infrastructure**
534
+ - `prebuildify` prebuilt binaries for Node 18/20/22 × Windows/macOS/Linux
535
+ - GitHub Actions CI: 9-job matrix (3 OS × 3 Node versions) on every push and PR
536
+ - Release workflow: prebuild + publish triggered by `v*` tags
537
+ - `files` allowlist in `package.json` — published package < 20 MB
538
+ - `scripts/check-sqlite.js` postinstall canary with actionable error message
539
+ - `scripts/verify-package.sh` pre-release verification helper
540
+
541
+ **Public launch polish**
542
+ - `--health` flag — checks prerequisites (grammars, SQLite, index directory) and exits with JSON output; non-zero exit code on any failure
543
+ - Actionable error messages throughout: missing grammar files, SQLite open failures, and config validation all produce human-readable guidance instead of raw stack traces
544
+ - Opt-in telemetry — reports anonymised usage counts (tool invocations, file counts); disabled by default, enabled via `telemetry.enabled: true` in config
545
+
546
+ **Team and cloud features**
547
+ - HTTP/SSE transport — start the server with `--transport http` (or `--transport both` for stdio + HTTP simultaneously); port and bind address configurable via `--port`/`--host` or `config.json`
548
+ - API key management — `purecontext-mcp keys create/list/revoke` CLI; keys stored as bcrypt hashes, shown once on creation; format `pctx_<workspaceId>_<24-char-random>_<checksum>`
549
+ - Workspace support — logical namespaces that group repos and API keys; managed via the admin key (`PCTX_ADMIN_KEY` env var)
550
+ - Docker deployment — official `purecontext/purecontext-mcp` image; `docker-compose.yml` included in the repo; `/health` HTTP endpoint for container health checks
551
+
552
+ ### Changed
553
+
554
+ - Minimum Node.js version: **18.0.0** (uses native `fetch`, `worker_threads`, `structuredClone`)
555
+ - Default `fileLimit` raised from 500 to 1000
556
+
557
+ ### Fixed
558
+
559
+ - `web-tree-sitter` character-vs-byte offset bug in handler text extraction (all language handlers now use byte offsets throughout)
560
+ - Forward-slash normalisation for file paths stored in SQLite (Windows compatibility)
561
+ - FTS5 hyphen tokenization — hyphens in symbol names are now indexed correctly
562
+
563
+ ---
564
+
565
+ ## [0.1.0] - 2026-04-10
566
+
567
+ Initial internal release. Core TypeScript/JavaScript indexing, SQLite storage, and MCP stdio transport.