purecontext-mcp 1.2.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT_INSTRUCTIONS.md +110 -784
- package/AGENT_REFERENCE.md +561 -0
- package/BENCHMARKS.md +153 -0
- package/CHANGELOG.md +177 -6
- package/FRAMEWORK-ADAPTERS.md +351 -0
- package/FULL-INSTALLATION-GUIDE.md +341 -0
- package/LANGUAGE-SUPPORT.md +144 -0
- package/README.md +154 -16
- package/USER-GUIDE.md +29 -21
- package/dist/cli/hooks.d.ts +28 -0
- package/dist/cli/hooks.d.ts.map +1 -0
- package/dist/cli/hooks.js +570 -0
- package/dist/cli/hooks.js.map +1 -0
- package/dist/cli/install-detect.d.ts +16 -0
- package/dist/cli/install-detect.d.ts.map +1 -0
- package/dist/cli/install-detect.js +70 -0
- package/dist/cli/install-detect.js.map +1 -0
- package/dist/cli/install-writers.d.ts +59 -0
- package/dist/cli/install-writers.d.ts.map +1 -0
- package/dist/cli/install-writers.js +292 -0
- package/dist/cli/install-writers.js.map +1 -0
- package/dist/cli/install.d.ts +14 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +150 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/config/config-loader.js +3 -0
- package/dist/config/config-loader.js.map +1 -1
- package/dist/config/config-schema.d.ts +11 -0
- package/dist/config/config-schema.d.ts.map +1 -1
- package/dist/config/config-schema.js +15 -0
- package/dist/config/config-schema.js.map +1 -1
- package/dist/core/db/symbol-store.d.ts +1 -0
- package/dist/core/db/symbol-store.d.ts.map +1 -1
- package/dist/core/db/symbol-store.js +120 -6
- package/dist/core/db/symbol-store.js.map +1 -1
- package/dist/core/file-discovery.d.ts +6 -0
- package/dist/core/file-discovery.d.ts.map +1 -1
- package/dist/core/file-discovery.js +20 -13
- package/dist/core/file-discovery.js.map +1 -1
- package/dist/core/file-processor.d.ts.map +1 -1
- package/dist/core/file-processor.js +26 -1
- package/dist/core/file-processor.js.map +1 -1
- package/dist/core/git-log-reader.d.ts.map +1 -1
- package/dist/core/git-log-reader.js +21 -0
- package/dist/core/git-log-reader.js.map +1 -1
- package/dist/core/index-manager.d.ts.map +1 -1
- package/dist/core/index-manager.js +21 -7
- package/dist/core/index-manager.js.map +1 -1
- package/dist/core/indexing-worker.d.ts.map +1 -1
- package/dist/core/indexing-worker.js +14 -0
- package/dist/core/indexing-worker.js.map +1 -1
- package/dist/core/parse-dispatcher.d.ts.map +1 -1
- package/dist/core/parse-dispatcher.js +20 -5
- package/dist/core/parse-dispatcher.js.map +1 -1
- package/dist/core/search/query-preprocessor.d.ts +69 -3
- package/dist/core/search/query-preprocessor.d.ts.map +1 -1
- package/dist/core/search/query-preprocessor.js +450 -17
- package/dist/core/search/query-preprocessor.js.map +1 -1
- package/dist/core/search/relevance-ranker.d.ts +60 -5
- package/dist/core/search/relevance-ranker.d.ts.map +1 -1
- package/dist/core/search/relevance-ranker.js +931 -33
- package/dist/core/search/relevance-ranker.js.map +1 -1
- package/dist/core/test-mapper.d.ts.map +1 -1
- package/dist/core/test-mapper.js +7 -1
- package/dist/core/test-mapper.js.map +1 -1
- package/dist/core/types.d.ts +28 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/handlers/angular-html.d.ts +3 -0
- package/dist/handlers/angular-html.d.ts.map +1 -0
- package/dist/handlers/angular-html.js +215 -0
- package/dist/handlers/angular-html.js.map +1 -0
- package/dist/handlers/c.d.ts.map +1 -1
- package/dist/handlers/c.js +19 -0
- package/dist/handlers/c.js.map +1 -1
- package/dist/handlers/cpp-macro-registry.d.ts +21 -0
- package/dist/handlers/cpp-macro-registry.d.ts.map +1 -0
- package/dist/handlers/cpp-macro-registry.js +44 -0
- package/dist/handlers/cpp-macro-registry.js.map +1 -0
- package/dist/handlers/cpp.d.ts.map +1 -1
- package/dist/handlers/cpp.js +579 -10
- package/dist/handlers/cpp.js.map +1 -1
- package/dist/handlers/csharp.d.ts.map +1 -1
- package/dist/handlers/csharp.js +39 -2
- package/dist/handlers/csharp.js.map +1 -1
- package/dist/handlers/css.d.ts +3 -0
- package/dist/handlers/css.d.ts.map +1 -0
- package/dist/handlers/css.js +154 -0
- package/dist/handlers/css.js.map +1 -0
- package/dist/handlers/erlang.d.ts.map +1 -1
- package/dist/handlers/erlang.js +8 -1
- package/dist/handlers/erlang.js.map +1 -1
- package/dist/handlers/fortran.js +1 -1
- package/dist/handlers/fortran.js.map +1 -1
- package/dist/handlers/go.d.ts.map +1 -1
- package/dist/handlers/go.js +87 -2
- package/dist/handlers/go.js.map +1 -1
- package/dist/handlers/handler-registry.d.ts.map +1 -1
- package/dist/handlers/handler-registry.js +4 -0
- package/dist/handlers/handler-registry.js.map +1 -1
- package/dist/handlers/hcl.d.ts +3 -0
- package/dist/handlers/hcl.d.ts.map +1 -0
- package/dist/handlers/hcl.js +193 -0
- package/dist/handlers/hcl.js.map +1 -0
- package/dist/handlers/java.d.ts.map +1 -1
- package/dist/handlers/java.js +33 -16
- package/dist/handlers/java.js.map +1 -1
- package/dist/handlers/kotlin.d.ts.map +1 -1
- package/dist/handlers/kotlin.js +48 -3
- package/dist/handlers/kotlin.js.map +1 -1
- package/dist/handlers/less.d.ts +3 -0
- package/dist/handlers/less.d.ts.map +1 -0
- package/dist/handlers/less.js +255 -0
- package/dist/handlers/less.js.map +1 -0
- package/dist/handlers/objective-c.d.ts.map +1 -1
- package/dist/handlers/objective-c.js +122 -64
- package/dist/handlers/objective-c.js.map +1 -1
- package/dist/handlers/openapi.d.ts.map +1 -1
- package/dist/handlers/openapi.js +30 -5
- package/dist/handlers/openapi.js.map +1 -1
- package/dist/handlers/php.d.ts.map +1 -1
- package/dist/handlers/php.js +287 -41
- package/dist/handlers/php.js.map +1 -1
- package/dist/handlers/protobuf.d.ts.map +1 -1
- package/dist/handlers/protobuf.js +1 -0
- package/dist/handlers/protobuf.js.map +1 -1
- package/dist/handlers/python.d.ts.map +1 -1
- package/dist/handlers/python.js +1 -3
- package/dist/handlers/python.js.map +1 -1
- package/dist/handlers/ruby-dsl.d.ts +23 -0
- package/dist/handlers/ruby-dsl.d.ts.map +1 -0
- package/dist/handlers/ruby-dsl.js +251 -0
- package/dist/handlers/ruby-dsl.js.map +1 -0
- package/dist/handlers/ruby.d.ts.map +1 -1
- package/dist/handlers/ruby.js +29 -4
- package/dist/handlers/ruby.js.map +1 -1
- package/dist/handlers/rust.d.ts.map +1 -1
- package/dist/handlers/rust.js +98 -2
- package/dist/handlers/rust.js.map +1 -1
- package/dist/handlers/scss.d.ts +3 -0
- package/dist/handlers/scss.d.ts.map +1 -0
- package/dist/handlers/scss.js +290 -0
- package/dist/handlers/scss.js.map +1 -0
- package/dist/handlers/sql.d.ts.map +1 -1
- package/dist/handlers/sql.js +37 -18
- package/dist/handlers/sql.js.map +1 -1
- package/dist/handlers/typescript.d.ts.map +1 -1
- package/dist/handlers/typescript.js +65 -17
- package/dist/handlers/typescript.js.map +1 -1
- package/dist/handlers/xml.d.ts.map +1 -1
- package/dist/handlers/xml.js +35 -2
- package/dist/handlers/xml.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +91 -0
- package/dist/index.js.map +1 -1
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +10 -0
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/tools/detect-antipatterns.d.ts +1 -1
- package/dist/server/tools/get-architecture-snapshot.d.ts +1 -1
- package/dist/server/tools/get-entry-points.d.ts +1 -1
- package/dist/server/tools/get-lexical-scope-matches.d.ts +54 -0
- package/dist/server/tools/get-lexical-scope-matches.d.ts.map +1 -0
- package/dist/server/tools/get-lexical-scope-matches.js +470 -0
- package/dist/server/tools/get-lexical-scope-matches.js.map +1 -0
- package/dist/server/tools/search-symbols.d.ts +10 -0
- package/dist/server/tools/search-symbols.d.ts.map +1 -1
- package/dist/server/tools/search-symbols.js +353 -8
- package/dist/server/tools/search-symbols.js.map +1 -1
- package/dist/server/tools/trace-invocation-chain.d.ts +53 -0
- package/dist/server/tools/trace-invocation-chain.d.ts.map +1 -0
- package/dist/server/tools/trace-invocation-chain.js +280 -0
- package/dist/server/tools/trace-invocation-chain.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/02-installation.md +43 -245
- package/docs/05-cli-reference.md +89 -0
- package/docs/07-language-support.md +73 -50
- package/docs/08-framework-adapters.md +7 -2
- package/docs/15-team-setup.md +70 -200
- package/docs/17-web-ui.md +73 -93
- package/docs/README.md +60 -39
- package/docs/dev/benchmark-findings-eu-za-tebe.md +210 -0
- package/docs/dev/phase-35-coverage-audit.md +469 -0
- package/package.json +6 -3
- package/user-manual.md +0 -2466
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Language Support
|
|
2
|
+
|
|
3
|
+
PureContext indexes **34 languages** out of the box, plus a small set of regex-based handlers for stylesheets. Every grammar is bundled as a WASM file — no separate install, no native compilation, no language servers to start. When you point it at a polyglot repo, all handlers run in parallel.
|
|
4
|
+
|
|
5
|
+
This page is the user-facing tour: what's supported, what gets pulled out, and what to expect from each major category. For parameter-level details (every node kind, every signature shape), see the [reference manual](docs/07-language-support.md).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The full list
|
|
10
|
+
|
|
11
|
+
### Web and application languages
|
|
12
|
+
|
|
13
|
+
| Language | Extensions | What you get |
|
|
14
|
+
|----------|-----------|-------------|
|
|
15
|
+
| TypeScript | `.ts`, `.tsx`, `.mts`, `.cts` | functions, classes, methods, consts, types, interfaces, enums — full type annotations in signatures |
|
|
16
|
+
| JavaScript | `.js`, `.jsx`, `.mjs`, `.cjs` | functions, classes, methods, exported consts |
|
|
17
|
+
| Python | `.py` | functions, classes, methods, module-level consts — docstrings used as summaries |
|
|
18
|
+
| PHP | `.php` | functions, classes, interfaces, traits, enums, methods, properties, constants — PHP 8 attributes supported |
|
|
19
|
+
| Ruby | `.rb` | functions, classes, methods, modules, constants |
|
|
20
|
+
| Go | `.go` | functions, methods (bare names, no receiver prefix), structs, interfaces, consts, types — unexported names are skipped |
|
|
21
|
+
| Java | `.java` | classes, interfaces, enums, methods (including package-private), inner classes |
|
|
22
|
+
| Kotlin | `.kt`, `.kts` | functions, extension functions, classes, interfaces, objects, enums, typealiases — KDoc summaries |
|
|
23
|
+
| C# | `.cs` | classes, interfaces, enums, structs, records, methods, properties, consts |
|
|
24
|
+
| Scala | `.scala`, `.sc` | classes, traits, objects, case classes, functions, methods, types, enums |
|
|
25
|
+
| Dart | `.dart` | classes, mixins, extensions, enums, functions, methods — `_`-prefixed names are skipped |
|
|
26
|
+
| Swift | `.swift` | classes, structs, protocols, actors, extensions, methods, enums |
|
|
27
|
+
| Elixir | `.ex`, `.exs` | modules, functions, macros, structs, protocols |
|
|
28
|
+
| Haskell | `.hs`, `.lhs` | functions, data types, typeclasses, instances, type aliases, newtypes |
|
|
29
|
+
| Lua | `.lua` | functions, methods, consts |
|
|
30
|
+
| R | `.r`, `.R`, `.Rmd` | functions, consts, S3/S4/R6 classes — Roxygen2 doc comments |
|
|
31
|
+
| Perl | `.pl`, `.pm` | functions, packages |
|
|
32
|
+
| Groovy | `.groovy` | functions, classes, methods |
|
|
33
|
+
| Erlang | `.erl`, `.hrl` | functions, modules |
|
|
34
|
+
| Gleam | `.gleam` | functions, types |
|
|
35
|
+
|
|
36
|
+
### Systems languages
|
|
37
|
+
|
|
38
|
+
| Language | Extensions | What you get |
|
|
39
|
+
|----------|-----------|-------------|
|
|
40
|
+
| C | `.c`, `.h` | functions, structs, enums, macros, types — `static` functions skipped (translation-unit internal) |
|
|
41
|
+
| C++ | `.cpp`, `.cxx`, `.cc`, `.hpp`, `.hxx`, `.hh` | All C kinds plus namespaces, templates, template classes with export macros |
|
|
42
|
+
| Rust | `.rs` | functions, methods (bare names), structs, enums, traits, consts, types — `pub` filter for impl methods |
|
|
43
|
+
| Fortran | `.f90`, `.f95`, `.for`, `.f` | functions, subroutines, modules |
|
|
44
|
+
| Objective-C | `.m`, `.h` | functions, classes, methods |
|
|
45
|
+
|
|
46
|
+
### Scripting and game
|
|
47
|
+
|
|
48
|
+
| Language | Extensions | What you get |
|
|
49
|
+
|----------|-----------|-------------|
|
|
50
|
+
| Bash | `.sh`, `.bash` | functions |
|
|
51
|
+
| GDScript | `.gd` | functions, classes, signals |
|
|
52
|
+
|
|
53
|
+
### Infrastructure and config
|
|
54
|
+
|
|
55
|
+
| Language | Extensions | What you get |
|
|
56
|
+
|----------|-----------|-------------|
|
|
57
|
+
| Terraform / HCL | `.tf`, `.hcl` | resources, modules, variables, outputs |
|
|
58
|
+
| Nix | `.nix` | functions, attributes |
|
|
59
|
+
|
|
60
|
+
### Data and API
|
|
61
|
+
|
|
62
|
+
| Language | Extensions | What you get |
|
|
63
|
+
|----------|-----------|-------------|
|
|
64
|
+
| SQL | `.sql` | tables, views, functions, procedures |
|
|
65
|
+
| Protobuf | `.proto` | messages, services, enums, RPCs |
|
|
66
|
+
| GraphQL | `.graphql`, `.gql` | types, queries, mutations, subscriptions, fragments |
|
|
67
|
+
| OpenAPI / YAML | `.yaml`, `.yml` | endpoints, schemas (OpenAPI detected by content) |
|
|
68
|
+
| XML | `.xml` | elements (configurable patterns — opt-in) |
|
|
69
|
+
|
|
70
|
+
### Stylesheets (regex-based, no WASM grammar)
|
|
71
|
+
|
|
72
|
+
CSS-family languages don't have a stable tree-sitter grammar, so PureContext extracts a focused subset using regex. Only named, reusable constructs are indexed — plain selectors are skipped because they would flood the index with noise.
|
|
73
|
+
|
|
74
|
+
| Language | Extensions | What you get |
|
|
75
|
+
|----------|-----------|-------------|
|
|
76
|
+
| SCSS / SASS | `.scss`, `.sass` | `@mixin`, `@function`, top-level `$variables`, `%placeholders`, `@keyframes` |
|
|
77
|
+
| LESS | `.less` | `.mixin(@params)`, top-level `@variables`, `@keyframes` |
|
|
78
|
+
| CSS | `.css` | `--custom-properties` (opt-in via `indexing.cssVariables: true`) |
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## What gets indexed for every language
|
|
83
|
+
|
|
84
|
+
Regardless of language, every symbol you find through `search_symbols` carries:
|
|
85
|
+
|
|
86
|
+
- **Name** — the identifier as it appears in source
|
|
87
|
+
- **Kind** — function, class, method, route, component, etc.
|
|
88
|
+
- **Byte offsets** — `startByte` / `endByte` for precise source retrieval; no need to re-read the whole file to grab a function body
|
|
89
|
+
- **Signature** — a one-line declaration with the full type information available in that language
|
|
90
|
+
- **Summary** — sourced from the docstring/JSDoc/Javadoc/Roxygen comment if present, otherwise inferred from framework context (route path, ORM table, etc.), otherwise a one-line AI summary, otherwise the signature itself
|
|
91
|
+
- **Import / dependency edges** — used by the dependency graph, blast radius, and cycle detection tools
|
|
92
|
+
|
|
93
|
+
The summary chain (docstring → framework inference → AI → signature fallback) is what makes search across an undocumented codebase still work. See [AI Summaries](AI-SUMMARIES.md) for how to enable LLM summaries on legacy projects.
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## What is filtered out automatically
|
|
98
|
+
|
|
99
|
+
Some things you don't want in the index — they bloat it and pollute search results. PureContext excludes:
|
|
100
|
+
|
|
101
|
+
- Standard build and dependency directories: `node_modules/`, `.git/`, `dist/`, `build/`, `target/`, `.next/`, `.nuxt/`, `.claude/`
|
|
102
|
+
- Lock files (`*.lock`) and environment files (`.env*`)
|
|
103
|
+
- Binary files (detected by null-byte scanning of the first 8 KB — works without a hardcoded extension list)
|
|
104
|
+
- Files larger than 1 MB (raise the limit with `maxFileSizeBytes` in config)
|
|
105
|
+
- Secret files: `*.pem`, `*.key`, `id_rsa`, `credentials.json`, `serviceAccountKey*.json`
|
|
106
|
+
|
|
107
|
+
It also respects language-level visibility:
|
|
108
|
+
|
|
109
|
+
- **Go**: unexported names (lowercase first letter)
|
|
110
|
+
- **C**: `static` functions (translation-unit internal)
|
|
111
|
+
- **Java / C# / PHP**: `private` members
|
|
112
|
+
- **Dart**: `_`-prefixed names
|
|
113
|
+
|
|
114
|
+
Public API tools (`get_public_api`) rely on these rules being applied consistently — they assume the index already reflects what is externally visible.
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Known limitations
|
|
119
|
+
|
|
120
|
+
- **TypeScript `.tsx`** uses a separate `tree-sitter-tsx` grammar from `.ts`. Both are bundled.
|
|
121
|
+
- **Python stubs** (`.pyi`) are not indexed — only `.py` files.
|
|
122
|
+
- **Terraform** `dynamic` blocks with complex expressions may not be fully extracted.
|
|
123
|
+
- **XML** element extraction uses configurable patterns rather than indexing every tag — turn it on per project if you need it.
|
|
124
|
+
- **CSS** custom properties (`--foo`) are off by default; enable with `indexing.cssVariables: true` when you have a design system worth indexing.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Adding a new language
|
|
129
|
+
|
|
130
|
+
If a grammar you care about is missing, the path to support is straightforward:
|
|
131
|
+
|
|
132
|
+
1. Add a new file in `src/handlers/`, implementing `LanguageHandler`
|
|
133
|
+
2. Bundle the `.wasm` grammar in `grammars/`
|
|
134
|
+
3. Register the handler in the language dispatcher
|
|
135
|
+
4. Add tests against fixture files in `test/handlers/`
|
|
136
|
+
|
|
137
|
+
Regex-only handlers (like SCSS) skip step 2 entirely — they return `null` from `grammarPath()`.
|
|
138
|
+
|
|
139
|
+
See `docs/25-architecture-overview.md` for the three-layer design (Core → Handlers → Adapters) and the conventions every handler follows.
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
→ Full parameter-level reference: [docs/07-language-support.md](docs/07-language-support.md)
|
|
144
|
+
→ Adapter layer that adds framework-specific symbols on top: [FRAMEWORK-ADAPTERS.md](FRAMEWORK-ADAPTERS.md)
|
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/purecontext-mcp)
|
|
4
4
|
[](docs/27-api-stability.md)
|
|
5
|
+
[](LICENSE)
|
|
5
6
|
|
|
6
7
|
**Stop burning context tokens reading whole files.** PureContext MCP indexes your codebase and lets AI agents retrieve exactly the code they need — a single function, a class, a route definition — without loading hundreds of irrelevant lines first.
|
|
7
8
|
|
|
@@ -18,8 +19,12 @@ But token savings are the mechanism, not the point. The point is that AI gets be
|
|
|
18
19
|
## Quick start
|
|
19
20
|
|
|
20
21
|
```bash
|
|
21
|
-
# Connect to Claude Code (no global install needed)
|
|
22
|
-
claude mcp add purecontext-mcp -- npx purecontext-mcp
|
|
22
|
+
# 1. Connect to Claude Code (no global install needed)
|
|
23
|
+
claude mcp add purecontext-mcp -- npx purecontext-mcp@latest
|
|
24
|
+
|
|
25
|
+
# 2. Inside your project, install the workflow rules
|
|
26
|
+
# (auto-detects Claude / Cursor / Windsurf / Continue / Cline / Roo Code / VS Code / Claude Desktop)
|
|
27
|
+
npx purecontext-mcp@latest install all
|
|
23
28
|
```
|
|
24
29
|
|
|
25
30
|
Then in a Claude Code conversation:
|
|
@@ -32,6 +37,45 @@ That's it. Claude will index your codebase and you can start navigating it by na
|
|
|
32
37
|
|
|
33
38
|
---
|
|
34
39
|
|
|
40
|
+
## What this looks like in practice
|
|
41
|
+
|
|
42
|
+
A typical "find and understand" conversation, before vs. after:
|
|
43
|
+
|
|
44
|
+
**Without PureContext**
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
You: Where do we handle Stripe webhook signature verification?
|
|
48
|
+
Claude: I'll search the codebase.
|
|
49
|
+
[reads src/api/webhooks/stripe.ts — 412 lines, ~3,100 tokens]
|
|
50
|
+
[reads src/lib/stripe-client.ts — 287 lines, ~2,150 tokens]
|
|
51
|
+
[reads src/middleware/webhook.ts — 198 lines, ~1,490 tokens]
|
|
52
|
+
Verification happens in verifyStripeSignature() at line 87 of stripe.ts.
|
|
53
|
+
Total context used: ~6,740 tokens
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**With PureContext**
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
You: Where do we handle Stripe webhook signature verification?
|
|
60
|
+
Claude: search_symbols(query: "stripe webhook signature")
|
|
61
|
+
→ 3 matches, 78 tokens
|
|
62
|
+
get_symbol_source(symbolId: "verifyStripeSignature")
|
|
63
|
+
→ 32 lines, 180 tokens
|
|
64
|
+
verifyStripeSignature() at src/api/webhooks/stripe.ts:87.
|
|
65
|
+
It uses the timing-safe HMAC check from Stripe's SDK with a 5-minute tolerance.
|
|
66
|
+
Total context used: ~258 tokens — 96% less
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The agent stays in the conversation and can keep going (blast radius, related tests, change planning) instead of running out of context after one file read.
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Measured search precision
|
|
74
|
+
|
|
75
|
+
PureContext is benchmarked on **87 real-world open-source projects** with 25 curated ground-truth queries each. Top-rank precision (P@1) reaches 84% on NestJS, 84% on Terraform, 72% on Protobuf and GraphQL, 60% on Nix, 52% on LÖVE (Lua/C++), and 40% on Tokio (Rust). Full per-language tables, methodology, and reproduction steps are in [BENCHMARKS.md](BENCHMARKS.md).
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
35
79
|
## Documentation
|
|
36
80
|
|
|
37
81
|
### User Guide — start here
|
|
@@ -54,6 +98,8 @@ The guide explains what PureContext does, why each feature exists, and how to us
|
|
|
54
98
|
| [Visualizing Code Structure](VISUALIZING-CODE.md) | Mermaid/DOT diagrams, architecture snapshots |
|
|
55
99
|
| [AST-Level Search](AST-SEARCH.md) | Node types, signatures, decorators, complexity |
|
|
56
100
|
| [Code Intelligence](CODE-INTELLIGENCE.md) | Entry points, public API, TODOs, coverage |
|
|
101
|
+
| [Language Support](LANGUAGE-SUPPORT.md) | All 34 supported languages and what's extracted |
|
|
102
|
+
| [Framework Adapters](FRAMEWORK-ADAPTERS.md) | Vue, React, Django, Spring, Rails, Flutter, ORMs, and more |
|
|
57
103
|
| [Using PureContext with a Team](TEAM-SETUP.md) | Shared server, enterprise setup |
|
|
58
104
|
|
|
59
105
|
**Real-world workflows:**
|
|
@@ -69,17 +115,45 @@ The guide explains what PureContext does, why each feature exists, and how to us
|
|
|
69
115
|
|
|
70
116
|
### Reference Manual
|
|
71
117
|
|
|
72
|
-
Parameter-level documentation for every tool, configuration option, language, framework adapter, and deployment option.
|
|
73
|
-
|
|
74
|
-
You should start from docs/README.md.
|
|
118
|
+
Parameter-level documentation for every tool, configuration option, language, framework adapter, and deployment option lives in [`docs/README.md`](docs/README.md). The reference manual is cross-linked with the user guide above — every topic has both a narrative and a reference page where one helps.
|
|
75
119
|
|
|
76
120
|
---
|
|
77
121
|
|
|
78
122
|
## What it indexes
|
|
79
123
|
|
|
80
|
-
|
|
124
|
+
### Languages
|
|
125
|
+
|
|
126
|
+
**34 languages** via bundled tree-sitter WASM grammars — no separate install required.
|
|
81
127
|
|
|
82
|
-
|
|
128
|
+
| Category | Languages |
|
|
129
|
+
|----------|-----------|
|
|
130
|
+
| Web / Application | TypeScript, JavaScript, Python, PHP, Ruby, Go, Java, Kotlin, C#, Scala, Dart, Swift, Elixir, Haskell, Lua, R, Perl, Groovy, Erlang, Gleam |
|
|
131
|
+
| Systems | C, C++, Rust, Fortran, Objective-C |
|
|
132
|
+
| Scripting & Game | Bash, GDScript |
|
|
133
|
+
| Infrastructure & Config | Terraform / HCL, Nix |
|
|
134
|
+
| Data & API | SQL, Protobuf, GraphQL, OpenAPI / YAML, XML |
|
|
135
|
+
| Styling (regex-based) | SCSS, SASS, LESS, CSS |
|
|
136
|
+
|
|
137
|
+
→ [Language Support guide](LANGUAGE-SUPPORT.md) · [Full reference](docs/07-language-support.md)
|
|
138
|
+
|
|
139
|
+
### Frameworks
|
|
140
|
+
|
|
141
|
+
**Framework-aware extraction** — routes, components, hooks, models, ORM entities, and middleware are pulled out as first-class symbols (not just functions and classes).
|
|
142
|
+
|
|
143
|
+
| Stack | Frameworks |
|
|
144
|
+
|-------|-----------|
|
|
145
|
+
| JavaScript / TypeScript | Vue 3, React, Nuxt, Next.js (Pages + App Router), Angular, NestJS, Express, Fastify |
|
|
146
|
+
| Python | Django, FastAPI, Flask |
|
|
147
|
+
| Go | Gin, Echo, Fiber |
|
|
148
|
+
| PHP | Laravel, Symfony |
|
|
149
|
+
| Ruby | Rails, Sinatra |
|
|
150
|
+
| Java | Spring Boot, Micronaut, Quarkus |
|
|
151
|
+
| Kotlin | Ktor, Spring (Kotlin) |
|
|
152
|
+
| Rust | Axum, Actix-web, Rocket |
|
|
153
|
+
| Mobile | Flutter |
|
|
154
|
+
| ORMs | Hibernate, SQLAlchemy, Django ORM, Prisma, TypeORM |
|
|
155
|
+
|
|
156
|
+
→ [Framework Adapters guide](FRAMEWORK-ADAPTERS.md) · [Full reference](docs/08-framework-adapters.md)
|
|
83
157
|
|
|
84
158
|
---
|
|
85
159
|
|
|
@@ -180,22 +254,86 @@ If your team runs a shared PureContext server, connect with an HTTP transport in
|
|
|
180
254
|
|
|
181
255
|
Installing PureContext gives your agent the tools. Adding the agent instructions tells it *how* to use them — which tool to pick for each task, in what order, and what to avoid.
|
|
182
256
|
|
|
183
|
-
|
|
257
|
+
Without these instructions, an agent may default to reading entire files rather than using `search_symbols`, or may not know to call `list_repos` first to get the repository ID required by every tool.
|
|
184
258
|
|
|
185
|
-
|
|
259
|
+
### One-command install (recommended)
|
|
186
260
|
|
|
187
|
-
|
|
261
|
+
Run this once inside your project directory:
|
|
188
262
|
|
|
189
|
-
|
|
263
|
+
```bash
|
|
264
|
+
npx purecontext-mcp@latest install all
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
This auto-detects which AI coding tools you have set up in the project and writes the PureContext workflow rules to the right place for each. Re-running is safe — every writer is idempotent (managed blocks are marked and replaced rather than appended).
|
|
268
|
+
|
|
269
|
+
When no `--scope` flag is given, the CLI prompts you to choose where to install:
|
|
270
|
+
|
|
271
|
+
```
|
|
272
|
+
Where should PureContext be installed?
|
|
273
|
+
1) Local — this project only
|
|
274
|
+
2) Global — all projects (user-level config)
|
|
275
|
+
3) Both
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
Pass `--scope` to skip the prompt:
|
|
190
279
|
|
|
191
280
|
```bash
|
|
192
|
-
|
|
281
|
+
npx purecontext-mcp@latest install all --scope=local # this project only
|
|
282
|
+
npx purecontext-mcp@latest install all --scope=global # user-level, all projects
|
|
283
|
+
npx purecontext-mcp@latest install all --scope=both # both places at once
|
|
193
284
|
```
|
|
194
285
|
|
|
195
|
-
|
|
286
|
+
For a single tool:
|
|
196
287
|
|
|
197
|
-
|
|
288
|
+
```bash
|
|
289
|
+
npx purecontext-mcp@latest install <tool> --scope=global
|
|
290
|
+
```
|
|
198
291
|
|
|
199
|
-
|
|
292
|
+
To preview without writing files:
|
|
200
293
|
|
|
201
|
-
|
|
294
|
+
```bash
|
|
295
|
+
npx purecontext-mcp@latest install all --dry-run
|
|
296
|
+
npx purecontext-mcp@latest install --list # show which IDEs were detected
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Supported tools and where each one writes:
|
|
300
|
+
|
|
301
|
+
| Tool | Local | Global |
|
|
302
|
+
|------|-------|--------|
|
|
303
|
+
| `claude` | `CLAUDE.md` in project | `~/.claude/CLAUDE.md` + hooks |
|
|
304
|
+
| `cursor` | `.cursor/rules/purecontext.mdc` | `~/.cursor/rules/purecontext.mdc` |
|
|
305
|
+
| `windsurf` | `.windsurfrules` | `~/.windsurfrules` |
|
|
306
|
+
| `continue` | `.continue/config.json` | `~/.continue/config.json` |
|
|
307
|
+
| `cline` | `.clinerules` | local only |
|
|
308
|
+
| `roo-code` | `.roo/rules-code.md` | local only |
|
|
309
|
+
| `vscode` | `.github/copilot-instructions.md` | local only |
|
|
310
|
+
| `claude-desktop` | always global | always global |
|
|
311
|
+
|
|
312
|
+
### Manual install
|
|
313
|
+
|
|
314
|
+
If you'd rather paste the rules yourself, three instruction files are at the repository root:
|
|
315
|
+
|
|
316
|
+
- **[`AGENT_INSTRUCTIONS_SHORT.md`](AGENT_INSTRUCTIONS_SHORT.md)** — ~2 KB. Mandatory workflow, tool selection table, core rules. Use for agents with limited system-prompt space.
|
|
317
|
+
- **[`AGENT_INSTRUCTIONS.md`](AGENT_INSTRUCTIONS.md)** — ~15 KB. Adds parameter notes, decision trees, anti-patterns.
|
|
318
|
+
- **[`AGENT_REFERENCE.md`](AGENT_REFERENCE.md)** — ~30 KB. Full tool reference with every parameter, every navigation pattern, and every known limitation. Installed automatically by `hooks --install`; read this when an agent needs the canonical answer.
|
|
319
|
+
|
|
320
|
+
Paste the contents into whatever system prompt, memory, or rules configuration your agent uses.
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
## License
|
|
325
|
+
|
|
326
|
+
MIT — see [LICENSE](LICENSE).
|
|
327
|
+
|
|
328
|
+
## Contributing
|
|
329
|
+
|
|
330
|
+
Issues and pull requests are welcome at [github.com/goranocokoljic/pure-context](https://github.com/goranocokoljic/pure-context). Before opening a feature PR, please open an issue to discuss the design — the three-layer architecture (Core → Handlers → Adapters) has hard rules about dependency direction that are easy to violate accidentally. See [`CLAUDE.md`](CLAUDE.md) at the project root for the architectural conventions.
|
|
331
|
+
|
|
332
|
+
For language or framework adapters: pick a real-world repository, add a 25-query ground-truth file in `benchmarks/<project>/queries.json`, and include benchmark numbers (P@1 / P@3 / R@5) in the PR description so reviewers can confirm the change is a net improvement.
|
|
333
|
+
|
|
334
|
+
## Support
|
|
335
|
+
|
|
336
|
+
- **Bug reports and feature requests:** [GitHub Issues](https://github.com/goranocokoljic/pure-context/issues)
|
|
337
|
+
- **Questions about MCP integration:** Open a Discussion on the repository
|
|
338
|
+
- **Changelog:** [CHANGELOG.md](CHANGELOG.md)
|
|
339
|
+
- **Stability and semver policy:** [docs/27-api-stability.md](docs/27-api-stability.md)
|
package/USER-GUIDE.md
CHANGED
|
@@ -2,53 +2,61 @@
|
|
|
2
2
|
|
|
3
3
|
This guide explains what PureContext does, why it changes the way you work with code, and how to use its features effectively. Each section focuses on a capability area with real examples and concrete workflows.
|
|
4
4
|
|
|
5
|
-
For parameter-level documentation — every tool input, output, and flag — see the [Reference Manual](
|
|
5
|
+
For parameter-level documentation — every tool input, output, and flag — see the [Reference Manual](docs/README.md).
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## Start here
|
|
10
10
|
|
|
11
|
-
- [Why PureContext](
|
|
11
|
+
- [Why PureContext](WHY-PURECONTEXT.md) — The full case: what actually improves when AI has precise context instead of bulk context, who benefits, and what PureContext does not do
|
|
12
12
|
|
|
13
13
|
---
|
|
14
14
|
|
|
15
15
|
## Core capabilities
|
|
16
16
|
|
|
17
|
-
- [Navigating a New Codebase](
|
|
17
|
+
- [Navigating a New Codebase](NAVIGATING-NEW-CODE.md) — How to orient yourself on day one, find entry points, trace a feature, and build a mental model without reading files at random
|
|
18
18
|
|
|
19
|
-
- [Finding Code](
|
|
19
|
+
- [Finding Code](FINDING-CODE.md) — Three search modes with examples: by name when you know it, by meaning when you don't, and by content when you need grep. Includes tips for when each fails.
|
|
20
20
|
|
|
21
|
-
- [Making Changes Safely](
|
|
21
|
+
- [Making Changes Safely](SAFE-CHANGES.md) — Blast radius analysis before touching anything, context bundles for understanding dependencies, the full pre-change workflow, and architectural violation detection
|
|
22
22
|
|
|
23
|
-
- [Understanding Code Relationships](
|
|
23
|
+
- [Understanding Code Relationships](UNDERSTANDING-RELATIONSHIPS.md) — Call hierarchies, class hierarchies, interface implementations, circular dependency detection, and coupling maps
|
|
24
24
|
|
|
25
|
-
- [Refactoring Safely](
|
|
25
|
+
- [Refactoring Safely](REFACTORING-SAFELY.md) — Pre-flight checks before renaming, deleting, or moving symbols. Sequenced, risk-annotated refactoring plans for structural changes.
|
|
26
26
|
|
|
27
|
-
- [Understanding Code History](
|
|
27
|
+
- [Understanding Code History](CODE-HISTORY.md) — Symbol-level git history (not file-level), churn analysis for identifying risk, ownership mapping, and PR analysis before you read a diff
|
|
28
28
|
|
|
29
29
|
---
|
|
30
30
|
|
|
31
31
|
## Features worth knowing
|
|
32
32
|
|
|
33
|
-
- [The Web UI](
|
|
33
|
+
- [The Web UI](WEB-UI.md) — When to leave the chat and use the browser: visual dependency graphs, the architecture heatmap, symbol timelines, and what each is actually useful for
|
|
34
34
|
|
|
35
|
-
- [AI Summaries](
|
|
35
|
+
- [AI Summaries](AI-SUMMARIES.md) — How symbol descriptions are generated, why they matter for search quality and AI accuracy, what they cost, and when to enable them
|
|
36
36
|
|
|
37
|
-
- [Code Health & Architecture Analysis](
|
|
37
|
+
- [Code Health & Architecture Analysis](CODE-HEALTH.md) — Quality metrics, anti-pattern detection, auto-generated architecture docs, CI enforcement, and finding refactoring opportunities before they become crises
|
|
38
38
|
|
|
39
|
-
- [Health Dashboards & Debt Reporting](
|
|
39
|
+
- [Health Dashboards & Debt Reporting](HEALTH-DASHBOARDS.md) — Five-axis health radar, before/after PR comparisons, and comprehensive debt reports with prioritized action items
|
|
40
40
|
|
|
41
|
-
- [Visualizing Code Structure](
|
|
41
|
+
- [Visualizing Code Structure](VISUALIZING-CODE.md) — Mermaid and DOT diagrams of import graphs, call graphs, class hierarchies, and dependency matrices. Architecture snapshots for tracking structural change over time.
|
|
42
42
|
|
|
43
|
-
- [AST-Level Search](
|
|
43
|
+
- [AST-Level Search](AST-SEARCH.md) — Find any tree-sitter node type, search by type signature pattern, find symbols by decorator, and filter by complexity thresholds
|
|
44
44
|
|
|
45
|
-
- [Code Intelligence](
|
|
45
|
+
- [Code Intelligence](CODE-INTELLIGENCE.md) — Entry points, public API surface, TODO inventory, complexity hotspots, type graphs, untested symbols, and coverage mapping
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Language and framework coverage
|
|
50
|
+
|
|
51
|
+
- [Language Support](LANGUAGE-SUPPORT.md) — All 34 supported languages plus regex-based stylesheet handlers: what's extracted, what's filtered, and known limitations
|
|
52
|
+
|
|
53
|
+
- [Framework Adapters](FRAMEWORK-ADAPTERS.md) — Routes, components, and ORM entities pulled out as first-class symbols for Vue, React, Nuxt, Next.js, Angular, NestJS, Django, FastAPI, Flask, Spring Boot, Rails, Laravel, Flutter, and more
|
|
46
54
|
|
|
47
55
|
---
|
|
48
56
|
|
|
49
57
|
## For teams and enterprise
|
|
50
58
|
|
|
51
|
-
- [Using PureContext with a Team](
|
|
59
|
+
- [Using PureContext with a Team](TEAM-SETUP.md) — Why a shared server is fundamentally different from local use, how to set it up, how to keep the index current automatically, and what enterprise deployments need to consider
|
|
52
60
|
|
|
53
61
|
---
|
|
54
62
|
|
|
@@ -56,16 +64,16 @@ For parameter-level documentation — every tool input, output, and flag — see
|
|
|
56
64
|
|
|
57
65
|
Complete end-to-end examples showing how PureContext fits into real development situations:
|
|
58
66
|
|
|
59
|
-
- [Onboarding to a New Codebase](
|
|
67
|
+
- [Onboarding to a New Codebase](WORKFLOW-ONBOARDING.md) — First day on a 6,000-file microservices platform: from zero understanding to bug found and fix scoped in 15 minutes
|
|
60
68
|
|
|
61
|
-
- [Refactoring Legacy Code](
|
|
69
|
+
- [Refactoring Legacy Code](WORKFLOW-REFACTORING.md) — Replacing a custom JWT implementation in a 6-year-old Django monolith: discovery, hidden dependencies, migration planning, and verification
|
|
62
70
|
|
|
63
|
-
- [Reviewing a Pull Request](
|
|
71
|
+
- [Reviewing a Pull Request](WORKFLOW-PR-REVIEW.md) — A 40-file authentication migration PR: structured review in 45 minutes that found two real issues before reading most of the diff
|
|
64
72
|
|
|
65
|
-
- [Running a Tech Debt Sprint](
|
|
73
|
+
- [Running a Tech Debt Sprint](WORKFLOW-TECH-DEBT.md) — Full lifecycle of a two-week debt reduction sprint: assessment, planning, safe execution, and proving the improvement with snapshots
|
|
66
74
|
|
|
67
75
|
---
|
|
68
76
|
|
|
69
77
|
## Reference Manual
|
|
70
78
|
|
|
71
|
-
The [Reference Manual](
|
|
79
|
+
The [Reference Manual](docs/README.md) covers every tool, configuration option, language, framework adapter, and deployment option in detail. Use it when you need the exact parameter name, the full list of symbol kinds, or the Docker Compose configuration.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `purecontext-mcp hooks --install` / `hooks --list`
|
|
3
|
+
* `purecontext-mcp hook-pretooluse|hook-posttooluse|hook-precompact|hook-worktree-create|hook-worktree-remove`
|
|
4
|
+
*
|
|
5
|
+
* Merges hook entries into ~/.claude/settings.json using CLI-style commands
|
|
6
|
+
* (npx purecontext-mcp hook-*) so no scripts need to be copied to ~/.claude/hooks/.
|
|
7
|
+
* Also injects PureContext agent instructions into ~/.claude/CLAUDE.md.
|
|
8
|
+
*/
|
|
9
|
+
export declare function cmdHooksInstall(): void;
|
|
10
|
+
export declare function cmdHooksList(): void;
|
|
11
|
+
export declare function mergeSettings(): void;
|
|
12
|
+
export declare function injectClaudeMd(): void;
|
|
13
|
+
/** PreToolUse: warn before Edit/Write/MultiEdit. */
|
|
14
|
+
export declare function cmdHookPreToolUse(): Promise<void>;
|
|
15
|
+
/** PostToolUse: re-index the repo after Edit/Write/MultiEdit. */
|
|
16
|
+
export declare function cmdHookPostToolUse(): Promise<void>;
|
|
17
|
+
/** PreCompact: inject session snapshot before context compaction. */
|
|
18
|
+
export declare function cmdHookPreCompact(): Promise<void>;
|
|
19
|
+
/** WorktreeCreate: auto-index a new agent worktree. */
|
|
20
|
+
export declare function cmdHookWorktreeCreate(): Promise<void>;
|
|
21
|
+
/** WorktreeRemove: fires when an agent worktree is removed. No-op for now. */
|
|
22
|
+
export declare function cmdHookWorktreeRemove(): Promise<void>;
|
|
23
|
+
/** TaskCompleted: surface post-task diagnostics and remind about available tools. */
|
|
24
|
+
export declare function cmdHookTaskCompleted(): Promise<void>;
|
|
25
|
+
/** SubagentStart: inject condensed repo orientation for spawned subagents. */
|
|
26
|
+
export declare function cmdHookSubagentStart(): Promise<void>;
|
|
27
|
+
export declare function runHooksCommand(args: string[]): void;
|
|
28
|
+
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/cli/hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA0IH,wBAAgB,eAAe,IAAI,IAAI,CAetC;AAED,wBAAgB,YAAY,IAAI,IAAI,CAenC;AAID,wBAAgB,aAAa,IAAI,IAAI,CAoDpC;AA6BD,wBAAgB,cAAc,IAAI,IAAI,CAuBrC;AAuCD,oDAAoD;AACpD,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAoBvD;AAED,iEAAiE;AACjE,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CA8BxD;AA6DD,qEAAqE;AACrE,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,CAgBvD;AAED,uDAAuD;AACvD,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkB3D;AAED,8EAA8E;AAC9E,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAG3D;AAyED,qFAAqF;AACrF,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CAwC1D;AAED,8EAA8E;AAC9E,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC,CA8C1D;AAID,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAUpD"}
|