sigmap 3.1.0 → 3.2.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/CHANGELOG.md +31 -0
- package/README.md +228 -129
- package/gen-context.js +148 -2
- package/package.json +5 -2
- package/packages/cli/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/src/mcp/server.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,37 @@ Format: [Semantic Versioning](https://semver.org/)
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
### Fixed
|
|
12
|
+
- **IDE command resolution parity (VS Code/Open VSX/JetBrains)** · [#34](https://github.com/manojmallick/sigmap/issues/34)
|
|
13
|
+
- Unified resolver now checks both `sigmap` and `gen-context` executables with consistent fallback order.
|
|
14
|
+
- Improved cross-platform probing for local workspace bins, Volta/nvm/npm-global installs, and OS-specific command lookup (`where` on Windows, shell lookup on macOS/Linux).
|
|
15
|
+
- JetBrains plugin now resolves commands more reliably outside Node-only projects and provides OS-aware install guidance when command lookup fails.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- **Installation guidance for plugin users**
|
|
19
|
+
- Updated VS Code/Open VSX and JetBrains setup docs to include all supported install paths: npm global, npm local, npx, standalone binaries in PATH, and project-local `gen-context.js`.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## [3.2.0] — Planned — Phase A: Cross-Platform Standalone Binaries
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- **Standalone binaries** — macOS (arm64 + x64), Linux x64, Windows x64 built via Node.js SEA
|
|
27
|
+
- No Node.js or npm required to run SigMap
|
|
28
|
+
- Download from GitHub Releases: `sigmap-darwin-arm64`, `sigmap-darwin-x64`, `sigmap-linux-x64`, `sigmap-win32-x64.exe`
|
|
29
|
+
- SHA-256 checksums in `sigmap-checksums.txt` attached to every release
|
|
30
|
+
- **`scripts/build-binary.mjs`** — reproducible local binary build for the current platform
|
|
31
|
+
- **`scripts/verify-binary.mjs`** — smoke tests `--version`, `--help`, default generate, `--health`, `--report` against a fixture repo
|
|
32
|
+
- **`.github/workflows/release-binaries.yml`** — GHA matrix builds all 4 targets on tag push; attaches artifacts to the GitHub Release
|
|
33
|
+
- **`test/fixtures/binary-smoke/`** — minimal fixture project used by CI smoke tests
|
|
34
|
+
- **`docs/binaries.md`** — install guide covering download, `chmod +x`, macOS Gatekeeper, Windows SmartScreen, and checksum verification
|
|
35
|
+
|
|
36
|
+
### Technical
|
|
37
|
+
- Uses [Node.js SEA](https://nodejs.org/api/single-executable-applications.html) (Node 20 `--experimental-sea-config` + `postject`)
|
|
38
|
+
- `gen-context.js` was updated to include previously-missing `src/` modules (`todos`, `coverage`, `prdiff`) in the SEA bundle; existing `requireSourceOrBundled()` fallback and DEFAULTS fallback in `writeInitConfig()` remain SEA-compatible
|
|
39
|
+
- Binary builds run natively per OS in GHA (no cross-compilation)
|
|
40
|
+
- `release-attach` job waits for the npm-publish Release to exist before uploading binary assets
|
|
41
|
+
|
|
11
42
|
---
|
|
12
43
|
|
|
13
44
|
## [3.1.0] — 2026-04-07 — Global Command Detection & VS Code Prerelease Fix
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
<p>
|
|
8
8
|
Every coding agent session starts with full codebase context at under 4K tokens.<br>
|
|
9
|
-
|
|
9
|
+
Multiple install options. Zero runtime dependencies. Requires only Node.js 18+.
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<!-- Status -->
|
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
| | |
|
|
39
39
|
|---|---|
|
|
40
40
|
| [What it does](#-what-it-does) | Token reduction table, pipeline overview |
|
|
41
|
-
| [Quick start](#-quick-start) |
|
|
41
|
+
| [Quick start](#-quick-start) | Install (binary or npm), generate in 60 seconds |
|
|
42
|
+
| [Standalone binaries](docs/binaries.md) | macOS, Linux, Windows — no Node required |
|
|
42
43
|
| [VS Code extension](#-vs-code-extension) | Status bar, stale alerts, commands |
|
|
43
44
|
| [JetBrains plugin](#-jetbrains-plugin) | IntelliJ IDEA, WebStorm, PyCharm support |
|
|
44
45
|
| [Languages supported](#-languages-supported) | 21 languages |
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
| [CLI reference](#-cli-reference) | All flags |
|
|
48
49
|
| [Configuration](#-configuration) | Config file + .contextignore |
|
|
49
50
|
| [Observability](#-observability) | Health score, reports, CI |
|
|
51
|
+
| [Programmatic API](#-programmatic-api) | Use as a Node.js library |
|
|
50
52
|
| [Testing](#-testing) | Run the test suite |
|
|
51
53
|
| [Project structure](#-project-structure) | File-by-file map |
|
|
52
54
|
| [Principles](#-principles) | Design decisions |
|
|
@@ -88,58 +90,181 @@ AI agent session starts with full context
|
|
|
88
90
|
|
|
89
91
|
---
|
|
90
92
|
|
|
91
|
-
##
|
|
93
|
+
## ⚡ Installation
|
|
92
94
|
|
|
93
|
-
|
|
94
|
-
|---|---|
|
|
95
|
-
| **Programmatic API** | `require('sigmap')` — use `extract`, `rank`, `buildSigIndex`, `scan`, `score` directly, no CLI subprocess |
|
|
96
|
-
| **`packages/core/`** | New `sigmap-core` package with stable API surface for third-party integrations |
|
|
97
|
-
| **`packages/cli/`** | Thin `sigmap-cli` forward-compat shim for the v3.0 adapter architecture |
|
|
98
|
-
| **15 new tests** | `core-api.test.js` covers all exported functions, edge cases, and backward compat |
|
|
95
|
+
Pick the method that fits your workflow — all produce the same output.
|
|
99
96
|
|
|
100
|
-
|
|
97
|
+
<details open>
|
|
98
|
+
<summary><strong>npx — try without installing</strong></summary>
|
|
101
99
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
| **`--query --json`** | Machine-readable ranked results (`{ query, results[], totalResults }`) |
|
|
106
|
-
| **`--query --top <n>`** | Limit results (default 10, configurable via `retrieval.topK`) |
|
|
107
|
-
| **`query_context` MCP tool** | 8th MCP tool — `{ query, topK? }` returns ranked file list, usable live in any MCP session |
|
|
108
|
-
| **`--analyze` / `--diagnose-extractors`** | Per-file breakdown of sigs/tokens/extractor/coverage; self-tests all 21 extractors (v2.2) |
|
|
109
|
-
| **`--benchmark` / `--eval`** | Measure hit@5 and MRR retrieval quality against a JSONL task file (v2.1) |
|
|
100
|
+
```bash
|
|
101
|
+
npx sigmap
|
|
102
|
+
```
|
|
110
103
|
|
|
111
|
-
|
|
104
|
+
Runs the latest version without any permanent install. Great for a quick try.
|
|
112
105
|
|
|
113
|
-
|
|
106
|
+
</details>
|
|
114
107
|
|
|
115
|
-
|
|
108
|
+
<details>
|
|
109
|
+
<summary><strong>npm global — install once, run anywhere</strong></summary>
|
|
116
110
|
|
|
117
|
-
|
|
111
|
+
```bash
|
|
112
|
+
npm install -g sigmap
|
|
113
|
+
sigmap
|
|
114
|
+
```
|
|
118
115
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
116
|
+
Available from any directory on your machine.
|
|
117
|
+
|
|
118
|
+
</details>
|
|
119
|
+
|
|
120
|
+
<details>
|
|
121
|
+
<summary><strong>Standalone binaries — no Node.js, no npm</strong></summary>
|
|
122
|
+
|
|
123
|
+
Download from the latest release:
|
|
124
|
+
|
|
125
|
+
- <https://github.com/manojmallick/sigmap/releases/latest>
|
|
126
|
+
|
|
127
|
+
Available assets:
|
|
126
128
|
|
|
127
|
-
|
|
129
|
+
- `sigmap-darwin-arm64` (macOS Apple Silicon)
|
|
130
|
+
- `sigmap-linux-x64` (Linux x64)
|
|
131
|
+
- `sigmap-win32-x64.exe` (Windows x64)
|
|
132
|
+
- `sigmap-checksums.txt` (SHA-256 checksums)
|
|
128
133
|
|
|
129
|
-
|
|
134
|
+
<details>
|
|
135
|
+
<summary><strong>macOS / Linux</strong></summary>
|
|
136
|
+
|
|
137
|
+
Run directly:
|
|
130
138
|
|
|
131
139
|
```bash
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
node gen-context.js --adapter gemini # → .github/gemini-context.md
|
|
136
|
-
node gen-context.js --adapter claude # → CLAUDE.md (append)
|
|
140
|
+
chmod +x ./sigmap-darwin-arm64 # or ./sigmap-linux-x64
|
|
141
|
+
./sigmap-darwin-arm64 --help
|
|
142
|
+
./sigmap-darwin-arm64
|
|
137
143
|
```
|
|
138
144
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
145
|
+
Make it globally available in Bash/Zsh (no `./` needed):
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# 1) Pick a user bin dir and move/rename the binary
|
|
149
|
+
mkdir -p "$HOME/.local/bin"
|
|
150
|
+
mv ./sigmap-darwin-arm64 "$HOME/.local/bin/sigmap" # or sigmap-linux-x64
|
|
151
|
+
chmod +x "$HOME/.local/bin/sigmap"
|
|
152
|
+
|
|
153
|
+
# 2) Add to PATH in your shell profile
|
|
154
|
+
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.zshrc" # zsh
|
|
155
|
+
# echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$HOME/.bashrc" # bash
|
|
156
|
+
|
|
157
|
+
# 3) Reload shell and verify
|
|
158
|
+
source "$HOME/.zshrc" # or: source "$HOME/.bashrc"
|
|
159
|
+
sigmap --version
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
</details>
|
|
163
|
+
|
|
164
|
+
<details>
|
|
165
|
+
<summary><strong>Windows (PowerShell)</strong></summary>
|
|
166
|
+
|
|
167
|
+
Run directly:
|
|
168
|
+
|
|
169
|
+
```powershell
|
|
170
|
+
.\sigmap-win32-x64.exe --help
|
|
171
|
+
.\sigmap-win32-x64.exe
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Make it globally available:
|
|
175
|
+
|
|
176
|
+
```powershell
|
|
177
|
+
# 1) Create a user bin directory and rename the binary
|
|
178
|
+
New-Item -ItemType Directory -Force "$HOME\bin" | Out-Null
|
|
179
|
+
Move-Item .\sigmap-win32-x64.exe "$HOME\bin\sigmap.exe"
|
|
180
|
+
|
|
181
|
+
# 2) Add user bin to PATH (current user)
|
|
182
|
+
[Environment]::SetEnvironmentVariable(
|
|
183
|
+
"Path",
|
|
184
|
+
$env:Path + ";$HOME\bin",
|
|
185
|
+
"User"
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
# 3) Restart PowerShell and verify
|
|
189
|
+
sigmap --version
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
</details>
|
|
193
|
+
|
|
194
|
+
Optional checksum verification:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
shasum -a 256 sigmap-darwin-arm64
|
|
198
|
+
# Compare with sigmap-checksums.txt
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
Full guide: [docs/binaries.md](docs/binaries.md)
|
|
202
|
+
|
|
203
|
+
</details>
|
|
204
|
+
|
|
205
|
+
<details>
|
|
206
|
+
<summary><strong>npm local — per-project, version-pinned</strong></summary>
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
npm install --save-dev sigmap
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Add to `package.json` scripts for team consistency:
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"scripts": {
|
|
217
|
+
"context": "sigmap",
|
|
218
|
+
"context:watch": "sigmap --watch"
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Run with `npm run context`. Version is pinned per project.
|
|
224
|
+
|
|
225
|
+
</details>
|
|
226
|
+
|
|
227
|
+
<details>
|
|
228
|
+
<summary><strong>Volta — team-friendly, auto-pinned version</strong></summary>
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
volta install sigmap
|
|
232
|
+
sigmap
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
[Volta](https://volta.sh) pins the exact version in `package.json` — every team member runs the same version automatically without configuration.
|
|
236
|
+
|
|
237
|
+
</details>
|
|
238
|
+
|
|
239
|
+
<details>
|
|
240
|
+
<summary><strong>Single-file download — no npm, any machine</strong></summary>
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
curl -O https://raw.githubusercontent.com/manojmallick/sigmap/main/gen-context.js
|
|
244
|
+
node gen-context.js
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
No npm, no `node_modules`. Drop `gen-context.js` into any project and run it directly. Requires only Node.js 18+. Ideal for CI, locked-down environments, or one-off use.
|
|
248
|
+
|
|
249
|
+
</details>
|
|
250
|
+
|
|
251
|
+
> **Note:** When using the single-file download, replace `sigmap` with `node gen-context.js` in all commands below.
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## 🚀 Features
|
|
256
|
+
|
|
257
|
+
### Multi-adapter output
|
|
258
|
+
|
|
259
|
+
Generate context for any AI assistant from a single run:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
sigmap --adapter copilot # → .github/copilot-instructions.md
|
|
263
|
+
sigmap --adapter claude # → CLAUDE.md (appended below marker)
|
|
264
|
+
sigmap --adapter cursor # → .cursorrules
|
|
265
|
+
sigmap --adapter windsurf # → .windsurfrules
|
|
266
|
+
sigmap --adapter openai # → .github/openai-context.md
|
|
267
|
+
sigmap --adapter gemini # → .github/gemini-context.md
|
|
143
268
|
```
|
|
144
269
|
|
|
145
270
|
| Adapter | Output file | AI assistant |
|
|
@@ -151,45 +276,80 @@ const systemPrompt = adapt(context, 'openai', { version: '3.0.0' });
|
|
|
151
276
|
| `openai` | `.github/openai-context.md` | Any OpenAI model |
|
|
152
277
|
| `gemini` | `.github/gemini-context.md` | Google Gemini |
|
|
153
278
|
|
|
154
|
-
|
|
279
|
+
Configure multiple adapters at once in `gen-context.config.json`:
|
|
280
|
+
|
|
281
|
+
```json
|
|
282
|
+
{ "outputs": ["copilot", "claude", "cursor"] }
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Programmatic API
|
|
155
286
|
|
|
156
|
-
See full
|
|
287
|
+
Use SigMap as a Node.js library without spawning a subprocess. See the [full API reference](#-programmatic-api) below.
|
|
288
|
+
|
|
289
|
+
### Query-aware retrieval
|
|
290
|
+
|
|
291
|
+
Find the most relevant files for any task without reading the whole codebase:
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
sigmap --query "authentication middleware" # ranked file list
|
|
295
|
+
sigmap --query "auth" --json # machine-readable output
|
|
296
|
+
sigmap --query "auth" --top 5 # top 5 results only
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### Diagnostic and evaluation tools
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
sigmap --analyze # per-file: sigs, tokens, extractor, coverage
|
|
303
|
+
sigmap --analyze --slow # include extraction timing
|
|
304
|
+
sigmap --diagnose-extractors # self-test all 21 extractors against fixtures
|
|
305
|
+
sigmap --benchmark # hit@5 and MRR retrieval quality
|
|
306
|
+
sigmap --benchmark --json # machine-readable benchmark results
|
|
307
|
+
```
|
|
157
308
|
|
|
158
309
|
---
|
|
159
310
|
|
|
160
311
|
## ⚡ Quick start
|
|
161
312
|
|
|
162
|
-
|
|
313
|
+
### Install
|
|
163
314
|
|
|
164
|
-
|
|
165
|
-
# 1. Download
|
|
166
|
-
curl -O https://raw.githubusercontent.com/manojmallick/sigmap/main/gen-context.js
|
|
315
|
+
**Standalone binary** — no Node.js or npm required:
|
|
167
316
|
|
|
168
|
-
|
|
169
|
-
|
|
317
|
+
| Platform | Download |
|
|
318
|
+
|---|---|
|
|
319
|
+
| macOS Apple Silicon | [`sigmap-darwin-arm64`](https://github.com/manojmallick/sigmap/releases/latest/download/sigmap-darwin-arm64) |
|
|
320
|
+
| macOS Intel | [`sigmap-darwin-x64`](https://github.com/manojmallick/sigmap/releases/latest/download/sigmap-darwin-x64) |
|
|
321
|
+
| Linux x64 | [`sigmap-linux-x64`](https://github.com/manojmallick/sigmap/releases/latest/download/sigmap-linux-x64) |
|
|
322
|
+
| Windows x64 | [`sigmap-win32-x64.exe`](https://github.com/manojmallick/sigmap/releases/latest/download/sigmap-win32-x64.exe) |
|
|
170
323
|
|
|
171
|
-
|
|
172
|
-
#
|
|
324
|
+
```bash
|
|
325
|
+
# macOS / Linux
|
|
326
|
+
chmod +x ./sigmap-darwin-arm64
|
|
327
|
+
./sigmap-darwin-arm64
|
|
173
328
|
```
|
|
174
329
|
|
|
175
|
-
|
|
330
|
+
See [docs/binaries.md](docs/binaries.md) for Gatekeeper / SmartScreen notes and checksum verification.
|
|
331
|
+
|
|
332
|
+
**npm** (requires Node.js 18+):
|
|
176
333
|
|
|
177
334
|
```bash
|
|
178
|
-
npx sigmap
|
|
179
|
-
npm install -g sigmap
|
|
180
|
-
sigmap # then use anywhere
|
|
335
|
+
npx sigmap # run once without installing
|
|
336
|
+
npm install -g sigmap # install globally
|
|
181
337
|
```
|
|
182
338
|
|
|
183
|
-
|
|
339
|
+
---
|
|
340
|
+
|
|
341
|
+
### Generate context
|
|
342
|
+
|
|
343
|
+
Download the single-file CLI and generate context immediately:
|
|
184
344
|
|
|
185
345
|
```bash
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
346
|
+
sigmap # generate once and exit
|
|
347
|
+
sigmap --watch # regenerate on every file save
|
|
348
|
+
sigmap --setup # generate + install git hook + start watcher
|
|
349
|
+
sigmap --diff # context for git-changed files only (PR mode)
|
|
350
|
+
sigmap --diff --staged # staged files only (pre-commit check)
|
|
351
|
+
sigmap --health # show context health score (grade A–D)
|
|
352
|
+
sigmap --mcp # start MCP server on stdio
|
|
193
353
|
```
|
|
194
354
|
|
|
195
355
|
### Companion tool: Repomix
|
|
@@ -202,8 +362,8 @@ SigMap and [Repomix](https://github.com/yamadashy/repomix) are **complementary,
|
|
|
202
362
|
| **Repomix** | On-demand deep sessions, full file content, broader language support |
|
|
203
363
|
|
|
204
364
|
```bash
|
|
205
|
-
|
|
206
|
-
npx repomix --compress
|
|
365
|
+
sigmap --setup # always-on context
|
|
366
|
+
npx repomix --compress # deep dive sessions
|
|
207
367
|
```
|
|
208
368
|
|
|
209
369
|
*"SigMap for daily always-on context; Repomix for deep one-off sessions — use both."*
|
|
@@ -212,8 +372,6 @@ npx repomix --compress # deep dive sessions
|
|
|
212
372
|
|
|
213
373
|
## 🧩 VS Code extension
|
|
214
374
|
|
|
215
|
-
> Introduced in v1.5 — zero runtime npm dependencies.
|
|
216
|
-
|
|
217
375
|
The `vscode-extension/` directory contains a first-party VS Code extension that keeps you informed without any manual commands.
|
|
218
376
|
|
|
219
377
|
| Feature | Detail |
|
|
@@ -232,8 +390,6 @@ Activate on startup (`onStartupFinished`) — loads within 3 s, never blocks edi
|
|
|
232
390
|
|
|
233
391
|
## 🔧 JetBrains plugin
|
|
234
392
|
|
|
235
|
-
> Introduced in v2.9 — brings SigMap to IntelliJ IDEA, WebStorm, PyCharm, and all JetBrains IDEs.
|
|
236
|
-
|
|
237
393
|
The `jetbrains-plugin/` directory contains a Kotlin-based plugin for JetBrains IDEs with the same core features as the VS Code extension.
|
|
238
394
|
|
|
239
395
|
| Feature | Detail |
|
|
@@ -287,7 +443,7 @@ Compatible with **IntelliJ IDEA 2024.1+** (Community & Ultimate), **WebStorm**,
|
|
|
287
443
|
|
|
288
444
|
## 🗂 Context strategies
|
|
289
445
|
|
|
290
|
-
>
|
|
446
|
+
> Reduce always-injected tokens by 70–90%.
|
|
291
447
|
|
|
292
448
|
Set `"strategy"` in `gen-context.config.json`:
|
|
293
449
|
|
|
@@ -334,8 +490,6 @@ Recently committed files are **hot** (auto-injected). Everything else is **cold*
|
|
|
334
490
|
|
|
335
491
|
## 🔌 MCP server
|
|
336
492
|
|
|
337
|
-
> Introduced in v0.3, expanded to 8 tools through v2.3.
|
|
338
|
-
|
|
339
493
|
Start the MCP server on stdio:
|
|
340
494
|
|
|
341
495
|
```bash
|
|
@@ -353,7 +507,7 @@ node gen-context.js --mcp
|
|
|
353
507
|
| `list_modules` | — | Token-count table of all top-level module directories |
|
|
354
508
|
| `create_checkpoint` | `{ summary: string }` | Write a session checkpoint to `.context/` |
|
|
355
509
|
| `get_routing` | — | Full model routing table |
|
|
356
|
-
| `query_context` | `{ query: string, topK?: number }` | Files ranked by relevance to the query
|
|
510
|
+
| `query_context` | `{ query: string, topK?: number }` | Files ranked by relevance to the query |
|
|
357
511
|
|
|
358
512
|
Reads files on every call — no stale state, no restart needed.
|
|
359
513
|
|
|
@@ -363,7 +517,7 @@ Reads files on every call — no stale state, no restart needed.
|
|
|
363
517
|
|
|
364
518
|
## ⚙️ CLI reference
|
|
365
519
|
|
|
366
|
-
>
|
|
520
|
+
> See [CHANGELOG.md](CHANGELOG.md) for the full history.
|
|
367
521
|
|
|
368
522
|
```
|
|
369
523
|
node gen-context.js Generate once and exit
|
|
@@ -548,7 +702,7 @@ node gen-context.js --format cache
|
|
|
548
702
|
|
|
549
703
|
---
|
|
550
704
|
|
|
551
|
-
## 📦 Programmatic API
|
|
705
|
+
## 📦 Programmatic API
|
|
552
706
|
|
|
553
707
|
Use SigMap as a library — no CLI subprocess needed:
|
|
554
708
|
|
|
@@ -683,61 +837,6 @@ sigmap/
|
|
|
683
837
|
|
|
684
838
|
---
|
|
685
839
|
|
|
686
|
-
## 📦 Publishing to npm
|
|
687
|
-
|
|
688
|
-
Releases are published automatically via GitHub Actions whenever a version tag is pushed.
|
|
689
|
-
|
|
690
|
-
### One-time setup
|
|
691
|
-
|
|
692
|
-
1. **Create an npm account** at [npmjs.com](https://www.npmjs.com) (if you haven't already).
|
|
693
|
-
|
|
694
|
-
2. **Generate an npm access token**:
|
|
695
|
-
- npmjs.com → Account → Access Tokens → Generate New Token → **Granular Access Token** (or Classic Automation token)
|
|
696
|
-
- Scope: `sigmap` package, permission: **Read and Write**
|
|
697
|
-
|
|
698
|
-
3. **Add the secret to GitHub**:
|
|
699
|
-
```
|
|
700
|
-
GitHub repo → Settings → Secrets and variables → Actions → New repository secret
|
|
701
|
-
Name: NPM_TOKEN
|
|
702
|
-
Value: <paste token>
|
|
703
|
-
```
|
|
704
|
-
|
|
705
|
-
### Releasing a new version
|
|
706
|
-
|
|
707
|
-
```bash
|
|
708
|
-
# 1. Bump version in package.json
|
|
709
|
-
npm version patch # or minor / major
|
|
710
|
-
|
|
711
|
-
# 2. Push the commit AND the new tag
|
|
712
|
-
git push && git push --tags
|
|
713
|
-
```
|
|
714
|
-
|
|
715
|
-
The [npm-publish workflow](.github/workflows/npm-publish.yml) will:
|
|
716
|
-
1. Run the full test suite
|
|
717
|
-
2. Verify `package.json` version matches the pushed tag
|
|
718
|
-
3. Publish to npm with provenance attestation
|
|
719
|
-
4. Create a GitHub Release with auto-generated notes
|
|
720
|
-
|
|
721
|
-
### Backfilling historical versions
|
|
722
|
-
|
|
723
|
-
Tags that existed before the workflow was set up can be published retroactively:
|
|
724
|
-
|
|
725
|
-
```bash
|
|
726
|
-
# Dry run first — see what would be published
|
|
727
|
-
./scripts/backfill-npm.sh
|
|
728
|
-
|
|
729
|
-
# Actually publish all historical tags
|
|
730
|
-
export NPM_TOKEN=npm_xxxxxxxxxxxx
|
|
731
|
-
./scripts/backfill-npm.sh --publish
|
|
732
|
-
|
|
733
|
-
# Start from a specific tag
|
|
734
|
-
./scripts/backfill-npm.sh --publish --from v0.5.0
|
|
735
|
-
```
|
|
736
|
-
|
|
737
|
-
The script assigns `dist-tag: legacy` to all versions except `v1.5.0` (which gets `latest`), so `npm install sigmap` always resolves to the current release.
|
|
738
|
-
|
|
739
|
-
---
|
|
740
|
-
|
|
741
840
|
## 🤝 Contributing
|
|
742
841
|
|
|
743
842
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to add a language extractor or new feature.
|
package/gen-context.js
CHANGED
|
@@ -1892,6 +1892,152 @@ __factories["./src/extractors/yaml"] = function(module, exports) {
|
|
|
1892
1892
|
|
|
1893
1893
|
};
|
|
1894
1894
|
|
|
1895
|
+
// ── ./src/extractors/todos ──
|
|
1896
|
+
__factories["./src/extractors/todos"] = function(module, exports) {
|
|
1897
|
+
|
|
1898
|
+
'use strict';
|
|
1899
|
+
|
|
1900
|
+
/**
|
|
1901
|
+
* Extract TODO/FIXME/HACK/XXX comments from source text.
|
|
1902
|
+
* @param {string} src - Raw file content
|
|
1903
|
+
* @returns {{line:number, tag:string, text:string}[]}
|
|
1904
|
+
*/
|
|
1905
|
+
function extractTodos(src) {
|
|
1906
|
+
if (!src || typeof src !== 'string') return [];
|
|
1907
|
+
const todos = [];
|
|
1908
|
+
const lines = src.split('\n');
|
|
1909
|
+
|
|
1910
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1911
|
+
const m = lines[i].match(/(?:\/\/|#)\s*(TODO|FIXME|HACK|XXX)\s*:?\s*(.+)/i);
|
|
1912
|
+
if (!m) continue;
|
|
1913
|
+
todos.push({
|
|
1914
|
+
line: i + 1,
|
|
1915
|
+
tag: m[1].toUpperCase(),
|
|
1916
|
+
text: m[2].trim().slice(0, 70),
|
|
1917
|
+
});
|
|
1918
|
+
}
|
|
1919
|
+
|
|
1920
|
+
return todos;
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
module.exports = { extractTodos };
|
|
1924
|
+
|
|
1925
|
+
};
|
|
1926
|
+
|
|
1927
|
+
// ── ./src/extractors/coverage ──
|
|
1928
|
+
__factories["./src/extractors/coverage"] = function(module, exports) {
|
|
1929
|
+
|
|
1930
|
+
'use strict';
|
|
1931
|
+
|
|
1932
|
+
const fs = require('fs');
|
|
1933
|
+
const path = require('path');
|
|
1934
|
+
|
|
1935
|
+
function walkFiles(dir) {
|
|
1936
|
+
let out = [];
|
|
1937
|
+
let entries;
|
|
1938
|
+
try {
|
|
1939
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
1940
|
+
} catch (_) {
|
|
1941
|
+
return out;
|
|
1942
|
+
}
|
|
1943
|
+
for (const entry of entries) {
|
|
1944
|
+
const full = path.join(dir, entry.name);
|
|
1945
|
+
if (entry.isDirectory()) out = out.concat(walkFiles(full));
|
|
1946
|
+
else if (entry.isFile()) out.push(full);
|
|
1947
|
+
}
|
|
1948
|
+
return out;
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
function buildTestIndex(cwd, testDirs) {
|
|
1952
|
+
const dirs = Array.isArray(testDirs) && testDirs.length ? testDirs : ['tests', 'test', '__tests__', 'spec'];
|
|
1953
|
+
const names = new Set();
|
|
1954
|
+
|
|
1955
|
+
for (const dir of dirs) {
|
|
1956
|
+
const abs = path.join(cwd, dir);
|
|
1957
|
+
if (!fs.existsSync(abs)) continue;
|
|
1958
|
+
for (const file of walkFiles(abs)) {
|
|
1959
|
+
let src = '';
|
|
1960
|
+
try {
|
|
1961
|
+
src = fs.readFileSync(file, 'utf8');
|
|
1962
|
+
} catch (_) {
|
|
1963
|
+
continue;
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
for (const m of src.matchAll(/\b(?:test_|it\(|test\(|describe\()\s*['"`]?([\w_]+)/g)) {
|
|
1967
|
+
if (m[1] && m[1].length >= 3) names.add(m[1].toLowerCase());
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
for (const m of src.matchAll(/\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g)) {
|
|
1971
|
+
if (m[1] && m[1].length >= 4) names.add(m[1].toLowerCase());
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
return names;
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
function isTested(funcName, testIndex) {
|
|
1980
|
+
if (!funcName || funcName.length < 3 || !testIndex || testIndex.size === 0) return false;
|
|
1981
|
+
const lower = funcName.toLowerCase();
|
|
1982
|
+
if (testIndex.has(lower) || testIndex.has(`test_${lower}`)) return true;
|
|
1983
|
+
return false;
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
module.exports = { buildTestIndex, isTested };
|
|
1987
|
+
|
|
1988
|
+
};
|
|
1989
|
+
|
|
1990
|
+
// ── ./src/extractors/prdiff ──
|
|
1991
|
+
__factories["./src/extractors/prdiff"] = function(module, exports) {
|
|
1992
|
+
|
|
1993
|
+
'use strict';
|
|
1994
|
+
|
|
1995
|
+
/**
|
|
1996
|
+
* Compare signature arrays and produce compact diff markers.
|
|
1997
|
+
* @param {string[]} baseSigs
|
|
1998
|
+
* @param {string[]} currentSigs
|
|
1999
|
+
* @returns {{added:string[], removed:string[], modified:string[]}}
|
|
2000
|
+
*/
|
|
2001
|
+
function diffSignatures(baseSigs, currentSigs) {
|
|
2002
|
+
const base = new Set(baseSigs || []);
|
|
2003
|
+
const curr = new Set(currentSigs || []);
|
|
2004
|
+
|
|
2005
|
+
const added = [...curr].filter((s) => !base.has(s));
|
|
2006
|
+
const removed = [...base].filter((s) => !curr.has(s));
|
|
2007
|
+
|
|
2008
|
+
const byName = (arr) => {
|
|
2009
|
+
const m = new Map();
|
|
2010
|
+
for (const s of arr) {
|
|
2011
|
+
const n = extractName(s);
|
|
2012
|
+
if (!n) continue;
|
|
2013
|
+
if (!m.has(n)) m.set(n, []);
|
|
2014
|
+
m.get(n).push(s);
|
|
2015
|
+
}
|
|
2016
|
+
return m;
|
|
2017
|
+
};
|
|
2018
|
+
|
|
2019
|
+
const aBy = byName(added);
|
|
2020
|
+
const rBy = byName(removed);
|
|
2021
|
+
const modified = [];
|
|
2022
|
+
|
|
2023
|
+
for (const [name] of aBy) {
|
|
2024
|
+
if (rBy.has(name)) modified.push(name);
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2027
|
+
return { added, removed, modified };
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
function extractName(sig) {
|
|
2031
|
+
if (!sig) return '';
|
|
2032
|
+
const t = sig.trim();
|
|
2033
|
+
const m = t.match(/(?:def|function|func|class|interface|trait|struct|enum|record)?\s*([A-Za-z_][A-Za-z0-9_]*)\s*(?:\(|$)/);
|
|
2034
|
+
return m ? m[1] : '';
|
|
2035
|
+
}
|
|
2036
|
+
|
|
2037
|
+
module.exports = { diffSignatures, extractName };
|
|
2038
|
+
|
|
2039
|
+
};
|
|
2040
|
+
|
|
1895
2041
|
// ── ./src/format/cache ──
|
|
1896
2042
|
__factories["./src/format/cache"] = function(module, exports) {
|
|
1897
2043
|
|
|
@@ -3554,7 +3700,7 @@ __factories["./src/mcp/server"] = function(module, exports) {
|
|
|
3554
3700
|
|
|
3555
3701
|
const SERVER_INFO = {
|
|
3556
3702
|
name: 'sigmap',
|
|
3557
|
-
version: '2.
|
|
3703
|
+
version: '3.2.1',
|
|
3558
3704
|
description: 'SigMap MCP server — code signatures on demand',
|
|
3559
3705
|
};
|
|
3560
3706
|
|
|
@@ -4903,7 +5049,7 @@ const path = require('path');
|
|
|
4903
5049
|
const os = require('os');
|
|
4904
5050
|
const { execSync } = require('child_process');
|
|
4905
5051
|
|
|
4906
|
-
const VERSION = '3.
|
|
5052
|
+
const VERSION = '3.2.1';
|
|
4907
5053
|
const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
|
|
4908
5054
|
|
|
4909
5055
|
function requireSourceOrBundled(key) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sigmap",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Zero-dependency AI context engine — 97% token reduction. No npm install. Runs on Node 18+.",
|
|
5
5
|
"main": "gen-context.js",
|
|
6
6
|
"exports": {
|
|
@@ -25,7 +25,10 @@
|
|
|
25
25
|
"report": "node gen-context.js --report",
|
|
26
26
|
"health": "node gen-context.js --health",
|
|
27
27
|
"map": "node gen-project-map.js",
|
|
28
|
-
"mcp": "node gen-context.js --mcp"
|
|
28
|
+
"mcp": "node gen-context.js --mcp",
|
|
29
|
+
"build:binary": "node scripts/build-binary.mjs",
|
|
30
|
+
"verify:binary": "node scripts/verify-binary.mjs",
|
|
31
|
+
"version:sync": "node scripts/sync-versions.mjs"
|
|
29
32
|
},
|
|
30
33
|
"files": [
|
|
31
34
|
"gen-context.js",
|
package/src/mcp/server.js
CHANGED