@grundy40/contextslice 0.3.5 → 0.4.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/README.md CHANGED
@@ -1,12 +1,13 @@
1
1
  # @grundy40/contextslice
2
2
 
3
- > **Zero-dependency multi-language AST code slicer & 1-Tool MCP server for AI coding agents.**
3
+ > **Zero-dependency multi-language structural code parser & 1-Tool MCP server for AI coding agents.**
4
4
 
5
5
  `ContextSlice` builds a lightweight local call graph of your repository, keeps **focal target functions complete**, folds direct `1-hop` / `2-hop` neighbors into **signature-only skeletons**, and drops unrelated noise — cutting token costs dramatically with **zero runtime dependencies**.
6
6
 
7
7
  - **Zero runtime `dependencies`**: Uses only Node.js built-ins + an embedded `web-tree-sitter` WASM runtime with lazy grammar caching (`~/.contextslice/parsers/`) and automatic offline state-machine fallback.
8
- - **Multi-language AST & Call Graph**: Supports TypeScript/JavaScript, Python, Go, Rust, Java, Kotlin, C#, C/C++, Swift, PHP, Ruby, SQL, and generic text files.
9
- - **Smart Relevance & Quotas**: TF-IDF keyword scarcity weighting, directory quota cap (65%), CJK 2-gram + bilingual matching, and `<omitted_top_matches>` recovery hints.
8
+ - **Multi-Language Structural Parsing & Config Windowing**: Supports TypeScript/JavaScript, Python (including method-level `ClassName.methodName` extraction & structural class skeletons), Go, Rust, Java, Kotlin, C#, C/C++, Swift, PHP, Ruby, SQL, and plain-text configs (`.json`, `.yaml`, `.yml`, `.toml`, `.ini`, `.cfg`, `.conf`, `.xml`, `.properties`, `.txt`) with automatic ±40-line local window truncation for configs over 200 lines.
9
+ - **Focal-First Source Priority, Dual-State File Tree & XML Boundary Tags**: Prioritizes direct-hit core source implementations as `<focal>` ahead of `docs/**` and `tests/**` with per-slice doc/test caps, deduplicates Markdown rendering, returns explicit `file_tree_empty_query` and `file_tree_zero_matches` modes with `<note>` guidance, annotates `<file total_lines="..." shown_lines="...">` ranges, enforces strict on-demand blanking, and filters conversational stopwords safely.
10
+ - **32K Benchmark Proven (`32,768` Default Budget)**: Evaluated on Hono (TS), HTTPX (Py), and Gin (Go) open-source repos with **85.1% token savings** and **100% refactoring pass rate** at the unified 32K default budget.
10
11
 
11
12
  ---
12
13
 
@@ -23,7 +24,7 @@ npx @grundy40/contextslice "login token validation" --budget 32768
23
24
  Slice a specific repository path:
24
25
 
25
26
  ```bash
26
- npx @grundy40/contextslice "checkout discount" --root ./my-project --budget 16384
27
+ npx @grundy40/contextslice "checkout discount" --root ./my-project --budget 32768
27
28
  ```
28
29
 
29
30
  Check version or CLI options:
@@ -47,8 +48,8 @@ Prefer a visual browser UI? Try the **Live Demo** at [https://grundy40.github.io
47
48
  ## Connect 1-Tool MCP to AI Coding Agents
48
49
 
49
50
  `@grundy40/contextslice` exposes two MCP tools inside a single ultra-lean stdio server (`ctxslice-mcp`):
50
- 1. `get_context_slice` — Primary code-reading tool (Tree-sitter WASM / state-machine AST + True Call Graph + TF-IDF).
51
- 2. `expand_skeleton_cluster` — On-demand symbol expander for `<omitted_top_matches>` or folded skeleton hubs.
51
+ 1. `get_context_slice` — Primary code-reading tool (Tree-sitter WASM / state-machine structural parser + True Call Graph + TF-IDF).
52
+ 2. `expand_skeleton_cluster` — On-demand symbol expander for folded skeleton hubs.
52
53
 
53
54
  ### Claude Code (`npx` Zero-Setup)
54
55
 
@@ -56,49 +57,20 @@ Prefer a visual browser UI? Try the **Live Demo** at [https://grundy40.github.io
56
57
  claude mcp add --scope user context-slice -- npx -y -p @grundy40/contextslice ctxslice-mcp
57
58
  ```
58
59
 
59
- Or if installed globally (`npm i -g @grundy40/contextslice`):
60
-
61
- ```bash
62
- claude mcp add --scope user context-slice -- ctxslice-mcp
63
- ```
64
-
65
60
  Add to `~/.claude/CLAUDE.md` so Claude always slices first before reading raw files:
66
61
 
67
62
  ```markdown
68
63
  When inspecting, debugging, or modifying code in any project folder, ALWAYS call the `get_context_slice` MCP tool first (passing `projectPath` and `query`) BEFORE reading raw files.
69
64
  ```
70
65
 
71
- ### Claude Desktop / Cursor / Windsurf (`mcpServers` JSON)
72
-
73
- ```json
74
- {
75
- "mcpServers": {
76
- "context-slice": {
77
- "command": "npx",
78
- "args": ["-y", "-p", "@grundy40/contextslice", "ctxslice-mcp"]
79
- }
80
- }
81
- }
82
- ```
83
-
84
- ### OpenCode (`~/.config/opencode/opencode.json`)
85
-
86
- ```json
87
- {
88
- "mcp": {
89
- "context-slice": {
90
- "type": "local",
91
- "command": ["npx", "-y", "-p", "@grundy40/contextslice", "ctxslice-mcp"]
92
- }
93
- }
94
- }
95
- ```
66
+ ### Full Documentation & Benchmark Report
67
+ For complete setup guides, dual-state File Tree behavior, and benchmark results, see the [Full GitHub Repository README](https://github.com/grundy40/ContextSlice#readme).
96
68
 
97
69
  ---
98
70
 
99
71
  ## Environment Variables
100
72
 
101
- - `CTXSLICE_DISABLE_WASM_FETCH=1`: Skip downloading `.wasm` language parsers and run purely on the built-in zero-network state-machine AST parser.
73
+ - `CTXSLICE_DISABLE_WASM_FETCH=1`: Skip downloading `.wasm` language parsers and run purely on the built-in zero-network state-machine structural parser.
102
74
 
103
75
  ---
104
76