sigmap 3.0.1-rc.1 → 3.1.0-alpha.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 +49 -0
- package/README.md +143 -129
- package/gen-context.js +146 -0
- package/package.json +4 -2
- package/packages/cli/package.json +1 -1
- package/packages/core/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,12 +8,61 @@ Format: [Semantic Versioning](https://semver.org/)
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## [3.2.0] — Planned — Phase A: Cross-Platform Standalone Binaries
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
- **Standalone binaries** — macOS (arm64 + x64), Linux x64, Windows x64 built via Node.js SEA
|
|
17
|
+
- No Node.js or npm required to run SigMap
|
|
18
|
+
- Download from GitHub Releases: `sigmap-darwin-arm64`, `sigmap-darwin-x64`, `sigmap-linux-x64`, `sigmap-win32-x64.exe`
|
|
19
|
+
- SHA-256 checksums in `sigmap-checksums.txt` attached to every release
|
|
20
|
+
- **`scripts/build-binary.mjs`** — reproducible local binary build for the current platform
|
|
21
|
+
- **`scripts/verify-binary.mjs`** — smoke tests `--version`, `--help`, `generate`, `health`, `report` against a fixture repo
|
|
22
|
+
- **`.github/workflows/release-binaries.yml`** — GHA matrix builds all 4 targets on tag push; attaches artifacts to the GitHub Release
|
|
23
|
+
- **`test/fixtures/binary-smoke/`** — minimal fixture project used by CI smoke tests
|
|
24
|
+
- **`docs/binaries.md`** — install guide covering download, `chmod +x`, macOS Gatekeeper, Windows SmartScreen, and checksum verification
|
|
25
|
+
|
|
26
|
+
### Technical
|
|
27
|
+
- Uses [Node.js SEA](https://nodejs.org/api/single-executable-applications.html) (Node 20 `--experimental-sea-config` + `postject`)
|
|
28
|
+
- `gen-context.js` required no changes — existing `requireSourceOrBundled()` fallback and DEFAULTS fallback in `writeInitConfig()` are both SEA-compatible
|
|
29
|
+
- Binary builds run natively per OS in GHA (no cross-compilation)
|
|
30
|
+
- `release-attach` job waits for the npm-publish Release to exist before uploading binary assets
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## [3.1.0] — 2026-04-07 — Global Command Detection & VS Code Prerelease Fix
|
|
35
|
+
|
|
36
|
+
### Added
|
|
37
|
+
- **VS Code extension: global command auto-detection** — extension now finds `gen-context` installed via Volta, nvm, npm, or Homebrew without requiring `gen-context.js` in the project root or a manual `sigmap.scriptPath` setting
|
|
38
|
+
- Probe chain: local `node_modules/.bin` → `~/.volta/bin` → `~/.nvm/versions/node/*/bin` (newest first) → `/usr/local/bin` → `/opt/homebrew/bin` → `~/.npm-global/bin` → login-shell `which`
|
|
39
|
+
- Works on macOS GUI apps that do not inherit shell `PATH`
|
|
40
|
+
- `resolveGlobalCommand()` + unified `resolveRunner()` added to `vscode-extension/src/extension.js`
|
|
41
|
+
- **VS Code extension: actionable error message** — when command is not found, notification offers "Copy install command" (copies `npm install -g sigmap` to clipboard) and "Open settings" buttons instead of a plain warning
|
|
42
|
+
- **Prerelease GitHub Actions workflow** — new `prerelease-publish.yml` for manual alpha/beta/rc releases across all 5 platforms (npm, GitHub Packages, VS Code, Open VSX, JetBrains) without marking as @latest
|
|
43
|
+
- VS Code/Open VSX uses `major.minor.patch` versioning (VSCE prerelease constraint)
|
|
44
|
+
- npm/JetBrains use full semver prerelease suffix (e.g. `3.1.0-beta.1`)
|
|
45
|
+
|
|
11
46
|
### Fixed
|
|
12
47
|
- **`output` config key not honored for copilot adapter** · [#30](https://github.com/manojmallick/sigmap/issues/30)
|
|
13
48
|
- Custom `output` path in config now correctly used for copilot adapter instead of hard-wired `.github/copilot-instructions.md`
|
|
14
49
|
- Added `resolveAdapterPath()` helper to centralize adapter path resolution
|
|
15
50
|
- Other adapters (claude, cursor, windsurf) continue to use fixed paths as designed
|
|
16
51
|
- 5 new integration tests ensure custom paths work correctly across all config combinations
|
|
52
|
+
- **JetBrains plugin: global `gen-context` command support** · [#29](https://github.com/manojmallick/sigmap/issues/29)
|
|
53
|
+
- Plugin now resolves command via fallback chain: local `gen-context.js` → `node_modules/.bin/gen-context` → system `PATH`
|
|
54
|
+
- Enables use in Java, Rust, Go and other non-Node projects with `gen-context` installed globally via Volta/nvm/npm
|
|
55
|
+
- **VS Code prerelease versioning** — workflow previously failed publishing because semver-suffixed versions (e.g. `3.1.0-alpha.1`) are rejected by VSCE; fixed by splitting into separate `npm_version` and `vscode_version` outputs
|
|
56
|
+
|
|
57
|
+
### Technical
|
|
58
|
+
- `resolveRunner()` returns `{ type: 'script' | 'command', path }` allowing extension to run either `node "path/gen-context.js"` or `"~/.volta/bin/gen-context"` without modification to the terminal command
|
|
59
|
+
|
|
60
|
+
### How to release (tag triggers automatic publish)
|
|
61
|
+
```bash
|
|
62
|
+
git tag v3.1.0
|
|
63
|
+
git push origin v3.1.0
|
|
64
|
+
# npm-publish.yml auto-triggers and publishes to all 5 platforms
|
|
65
|
+
```
|
|
17
66
|
|
|
18
67
|
---
|
|
19
68
|
|
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,96 @@ 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
|
-
| **Charts in reports** | Visualize token reduction, signature counts, and budget usage per run |
|
|
122
|
-
| **Advanced retrieval metrics** | Add precision@K, recall@K, MRR trend, and query-level diagnostics |
|
|
123
|
-
| **Evaluation dashboard output** | Generate shareable HTML/JSON benchmark summaries from CLI runs |
|
|
124
|
-
| **CI-friendly metrics export** | Persist machine-readable metrics for release gates and regression tracking |
|
|
125
|
-
| **Release quality gates** | Add pass/fail thresholds for hit@5 and precision before publish |
|
|
116
|
+
Available from any directory on your machine.
|
|
126
117
|
|
|
127
|
-
|
|
118
|
+
</details>
|
|
128
119
|
|
|
129
|
-
|
|
120
|
+
<details>
|
|
121
|
+
<summary><strong>npm local — per-project, version-pinned</strong></summary>
|
|
130
122
|
|
|
131
123
|
```bash
|
|
132
|
-
|
|
133
|
-
node gen-context.js --adapter copilot # → .github/copilot-instructions.md
|
|
134
|
-
node gen-context.js --adapter openai # → .github/openai-context.md
|
|
135
|
-
node gen-context.js --adapter gemini # → .github/gemini-context.md
|
|
136
|
-
node gen-context.js --adapter claude # → CLAUDE.md (append)
|
|
124
|
+
npm install --save-dev sigmap
|
|
137
125
|
```
|
|
138
126
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
127
|
+
Add to `package.json` scripts for team consistency:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"scripts": {
|
|
132
|
+
"context": "sigmap",
|
|
133
|
+
"context:watch": "sigmap --watch"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Run with `npm run context`. Version is pinned per project.
|
|
139
|
+
|
|
140
|
+
</details>
|
|
141
|
+
|
|
142
|
+
<details>
|
|
143
|
+
<summary><strong>Volta — team-friendly, auto-pinned version</strong></summary>
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
volta install sigmap
|
|
147
|
+
sigmap
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
[Volta](https://volta.sh) pins the exact version in `package.json` — every team member runs the same version automatically without configuration.
|
|
151
|
+
|
|
152
|
+
</details>
|
|
153
|
+
|
|
154
|
+
<details>
|
|
155
|
+
<summary><strong>Single-file download — no npm, any machine</strong></summary>
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
curl -O https://raw.githubusercontent.com/manojmallick/sigmap/main/gen-context.js
|
|
159
|
+
node gen-context.js
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
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.
|
|
163
|
+
|
|
164
|
+
</details>
|
|
165
|
+
|
|
166
|
+
> **Note:** When using the single-file download, replace `sigmap` with `node gen-context.js` in all commands below.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 🚀 Features
|
|
171
|
+
|
|
172
|
+
### Multi-adapter output
|
|
173
|
+
|
|
174
|
+
Generate context for any AI assistant from a single run:
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
sigmap --adapter copilot # → .github/copilot-instructions.md
|
|
178
|
+
sigmap --adapter claude # → CLAUDE.md (appended below marker)
|
|
179
|
+
sigmap --adapter cursor # → .cursorrules
|
|
180
|
+
sigmap --adapter windsurf # → .windsurfrules
|
|
181
|
+
sigmap --adapter openai # → .github/openai-context.md
|
|
182
|
+
sigmap --adapter gemini # → .github/gemini-context.md
|
|
143
183
|
```
|
|
144
184
|
|
|
145
185
|
| Adapter | Output file | AI assistant |
|
|
@@ -151,45 +191,80 @@ const systemPrompt = adapt(context, 'openai', { version: '3.0.0' });
|
|
|
151
191
|
| `openai` | `.github/openai-context.md` | Any OpenAI model |
|
|
152
192
|
| `gemini` | `.github/gemini-context.md` | Google Gemini |
|
|
153
193
|
|
|
154
|
-
|
|
194
|
+
Configure multiple adapters at once in `gen-context.config.json`:
|
|
195
|
+
|
|
196
|
+
```json
|
|
197
|
+
{ "outputs": ["copilot", "claude", "cursor"] }
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Programmatic API
|
|
201
|
+
|
|
202
|
+
Use SigMap as a Node.js library without spawning a subprocess. See the [full API reference](#-programmatic-api) below.
|
|
203
|
+
|
|
204
|
+
### Query-aware retrieval
|
|
205
|
+
|
|
206
|
+
Find the most relevant files for any task without reading the whole codebase:
|
|
155
207
|
|
|
156
|
-
|
|
208
|
+
```bash
|
|
209
|
+
sigmap --query "authentication middleware" # ranked file list
|
|
210
|
+
sigmap --query "auth" --json # machine-readable output
|
|
211
|
+
sigmap --query "auth" --top 5 # top 5 results only
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Diagnostic and evaluation tools
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
sigmap --analyze # per-file: sigs, tokens, extractor, coverage
|
|
218
|
+
sigmap --analyze --slow # include extraction timing
|
|
219
|
+
sigmap --diagnose-extractors # self-test all 21 extractors against fixtures
|
|
220
|
+
sigmap --benchmark # hit@5 and MRR retrieval quality
|
|
221
|
+
sigmap --benchmark --json # machine-readable benchmark results
|
|
222
|
+
```
|
|
157
223
|
|
|
158
224
|
---
|
|
159
225
|
|
|
160
226
|
## ⚡ Quick start
|
|
161
227
|
|
|
162
|
-
|
|
228
|
+
### Install
|
|
163
229
|
|
|
164
|
-
|
|
165
|
-
# 1. Download
|
|
166
|
-
curl -O https://raw.githubusercontent.com/manojmallick/sigmap/main/gen-context.js
|
|
230
|
+
**Standalone binary** — no Node.js or npm required:
|
|
167
231
|
|
|
168
|
-
|
|
169
|
-
|
|
232
|
+
| Platform | Download |
|
|
233
|
+
|---|---|
|
|
234
|
+
| macOS Apple Silicon | [`sigmap-darwin-arm64`](https://github.com/manojmallick/sigmap/releases/latest/download/sigmap-darwin-arm64) |
|
|
235
|
+
| macOS Intel | [`sigmap-darwin-x64`](https://github.com/manojmallick/sigmap/releases/latest/download/sigmap-darwin-x64) |
|
|
236
|
+
| Linux x64 | [`sigmap-linux-x64`](https://github.com/manojmallick/sigmap/releases/latest/download/sigmap-linux-x64) |
|
|
237
|
+
| Windows x64 | [`sigmap-win32-x64.exe`](https://github.com/manojmallick/sigmap/releases/latest/download/sigmap-win32-x64.exe) |
|
|
170
238
|
|
|
171
|
-
|
|
172
|
-
#
|
|
239
|
+
```bash
|
|
240
|
+
# macOS / Linux
|
|
241
|
+
chmod +x ./sigmap-darwin-arm64
|
|
242
|
+
./sigmap-darwin-arm64 generate
|
|
173
243
|
```
|
|
174
244
|
|
|
175
|
-
|
|
245
|
+
See [docs/binaries.md](docs/binaries.md) for Gatekeeper / SmartScreen notes and checksum verification.
|
|
246
|
+
|
|
247
|
+
**npm** (requires Node.js 18+):
|
|
176
248
|
|
|
177
249
|
```bash
|
|
178
|
-
npx sigmap
|
|
179
|
-
npm install -g sigmap
|
|
180
|
-
sigmap # then use anywhere
|
|
250
|
+
npx sigmap # run once without installing
|
|
251
|
+
npm install -g sigmap # install globally
|
|
181
252
|
```
|
|
182
253
|
|
|
183
|
-
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
### Generate context
|
|
257
|
+
|
|
258
|
+
Download the single-file CLI and generate context immediately:
|
|
184
259
|
|
|
185
260
|
```bash
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
261
|
+
sigmap # generate once and exit
|
|
262
|
+
sigmap --watch # regenerate on every file save
|
|
263
|
+
sigmap --setup # generate + install git hook + start watcher
|
|
264
|
+
sigmap --diff # context for git-changed files only (PR mode)
|
|
265
|
+
sigmap --diff --staged # staged files only (pre-commit check)
|
|
266
|
+
sigmap --health # show context health score (grade A–D)
|
|
267
|
+
sigmap --mcp # start MCP server on stdio
|
|
193
268
|
```
|
|
194
269
|
|
|
195
270
|
### Companion tool: Repomix
|
|
@@ -202,8 +277,8 @@ SigMap and [Repomix](https://github.com/yamadashy/repomix) are **complementary,
|
|
|
202
277
|
| **Repomix** | On-demand deep sessions, full file content, broader language support |
|
|
203
278
|
|
|
204
279
|
```bash
|
|
205
|
-
|
|
206
|
-
npx repomix --compress
|
|
280
|
+
sigmap --setup # always-on context
|
|
281
|
+
npx repomix --compress # deep dive sessions
|
|
207
282
|
```
|
|
208
283
|
|
|
209
284
|
*"SigMap for daily always-on context; Repomix for deep one-off sessions — use both."*
|
|
@@ -212,8 +287,6 @@ npx repomix --compress # deep dive sessions
|
|
|
212
287
|
|
|
213
288
|
## 🧩 VS Code extension
|
|
214
289
|
|
|
215
|
-
> Introduced in v1.5 — zero runtime npm dependencies.
|
|
216
|
-
|
|
217
290
|
The `vscode-extension/` directory contains a first-party VS Code extension that keeps you informed without any manual commands.
|
|
218
291
|
|
|
219
292
|
| Feature | Detail |
|
|
@@ -232,8 +305,6 @@ Activate on startup (`onStartupFinished`) — loads within 3 s, never blocks edi
|
|
|
232
305
|
|
|
233
306
|
## 🔧 JetBrains plugin
|
|
234
307
|
|
|
235
|
-
> Introduced in v2.9 — brings SigMap to IntelliJ IDEA, WebStorm, PyCharm, and all JetBrains IDEs.
|
|
236
|
-
|
|
237
308
|
The `jetbrains-plugin/` directory contains a Kotlin-based plugin for JetBrains IDEs with the same core features as the VS Code extension.
|
|
238
309
|
|
|
239
310
|
| Feature | Detail |
|
|
@@ -287,7 +358,7 @@ Compatible with **IntelliJ IDEA 2024.1+** (Community & Ultimate), **WebStorm**,
|
|
|
287
358
|
|
|
288
359
|
## 🗂 Context strategies
|
|
289
360
|
|
|
290
|
-
>
|
|
361
|
+
> Reduce always-injected tokens by 70–90%.
|
|
291
362
|
|
|
292
363
|
Set `"strategy"` in `gen-context.config.json`:
|
|
293
364
|
|
|
@@ -334,8 +405,6 @@ Recently committed files are **hot** (auto-injected). Everything else is **cold*
|
|
|
334
405
|
|
|
335
406
|
## 🔌 MCP server
|
|
336
407
|
|
|
337
|
-
> Introduced in v0.3, expanded to 8 tools through v2.3.
|
|
338
|
-
|
|
339
408
|
Start the MCP server on stdio:
|
|
340
409
|
|
|
341
410
|
```bash
|
|
@@ -353,7 +422,7 @@ node gen-context.js --mcp
|
|
|
353
422
|
| `list_modules` | — | Token-count table of all top-level module directories |
|
|
354
423
|
| `create_checkpoint` | `{ summary: string }` | Write a session checkpoint to `.context/` |
|
|
355
424
|
| `get_routing` | — | Full model routing table |
|
|
356
|
-
| `query_context` | `{ query: string, topK?: number }` | Files ranked by relevance to the query
|
|
425
|
+
| `query_context` | `{ query: string, topK?: number }` | Files ranked by relevance to the query |
|
|
357
426
|
|
|
358
427
|
Reads files on every call — no stale state, no restart needed.
|
|
359
428
|
|
|
@@ -363,7 +432,7 @@ Reads files on every call — no stale state, no restart needed.
|
|
|
363
432
|
|
|
364
433
|
## ⚙️ CLI reference
|
|
365
434
|
|
|
366
|
-
>
|
|
435
|
+
> See [CHANGELOG.md](CHANGELOG.md) for the full history.
|
|
367
436
|
|
|
368
437
|
```
|
|
369
438
|
node gen-context.js Generate once and exit
|
|
@@ -548,7 +617,7 @@ node gen-context.js --format cache
|
|
|
548
617
|
|
|
549
618
|
---
|
|
550
619
|
|
|
551
|
-
## 📦 Programmatic API
|
|
620
|
+
## 📦 Programmatic API
|
|
552
621
|
|
|
553
622
|
Use SigMap as a library — no CLI subprocess needed:
|
|
554
623
|
|
|
@@ -683,61 +752,6 @@ sigmap/
|
|
|
683
752
|
|
|
684
753
|
---
|
|
685
754
|
|
|
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
755
|
## 🤝 Contributing
|
|
742
756
|
|
|
743
757
|
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
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sigmap",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.0-alpha.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,9 @@
|
|
|
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"
|
|
29
31
|
},
|
|
30
32
|
"files": [
|
|
31
33
|
"gen-context.js",
|