sigmap 6.15.0 → 7.0.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/AGENTS.md +798 -401
- package/CHANGELOG.md +36 -0
- package/README.md +8 -8
- package/gen-context.js +1498 -462
- package/llms-full.txt +295 -0
- package/llms.txt +56 -0
- package/package.json +31 -14
- package/packages/adapters/claude.js +0 -6
- package/packages/adapters/codex.js +1 -61
- package/packages/adapters/copilot.js +0 -8
- package/packages/adapters/cursor.js +0 -4
- package/packages/adapters/gemini.js +0 -2
- package/packages/adapters/openai.js +0 -2
- package/packages/adapters/windsurf.js +0 -4
- package/packages/cli/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/src/config/loader.js +6 -6
- package/src/discovery/source-root-scorer.js +2 -2
- package/src/extractors/prdiff.js +28 -3
- package/src/format/llms-txt.js +2 -3
- package/src/format/usage-guidance.js +28 -0
- package/src/mcp/handlers.js +3 -8
- package/src/mcp/server.js +1 -1
- package/src/nudge.js +92 -0
- package/src/session/notes.js +2 -8
- package/src/squeeze/cilog.js +71 -0
- package/src/squeeze/classify.js +115 -0
- package/src/squeeze/index.js +69 -0
- package/src/squeeze/jsonpayload.js +54 -0
- package/src/squeeze/stacktrace.js +135 -0
- package/src/util/git.js +31 -0
package/llms-full.txt
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# SigMap — Complete LLM Reference
|
|
2
|
+
|
|
3
|
+
> Zero-dependency context engine that stops AI coding agents from guessing in your codebase.
|
|
4
|
+
> Grounded context. Verified answers. No embeddings, no vector DB, fully offline.
|
|
5
|
+
|
|
6
|
+
SigMap is a zero-dependency AI context engine. It extracts function and class
|
|
7
|
+
signatures from a codebase and uses TF-IDF ranking to feed an AI assistant only
|
|
8
|
+
the files relevant to the task — cutting tokens ~97% while keeping answers
|
|
9
|
+
grounded. Deterministic, offline, no embeddings or vector database. Works with
|
|
10
|
+
Claude, Cursor, GitHub Copilot, Aider, Windsurf, local LLMs, and MCP.
|
|
11
|
+
|
|
12
|
+
# Version: 7.0.1 | Benchmark: sigmap-v7.0-main (2026-06-14)
|
|
13
|
+
# Source: auto-generated from package.json, version.json, src/mcp/tools.js, src/config/defaults.js
|
|
14
|
+
# Regenerate: npm run generate:llms | Validate: npm run validate:llms
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Core metrics (benchmark: sigmap-v7.0-main, 2026-06-14)
|
|
19
|
+
|
|
20
|
+
| Metric | Without SigMap | With SigMap |
|
|
21
|
+
|--------|----------------|-------------|
|
|
22
|
+
| Retrieval hit@5 | 13.6% (random) | 75.6% (5.6× lift) |
|
|
23
|
+
| Token reduction | — | 97.0% average |
|
|
24
|
+
| Task success proxy | 10% | 52.2% |
|
|
25
|
+
| Prompts per task | 2.84 | 1.72 (39.4% fewer) |
|
|
26
|
+
| Supported languages | — | 31 |
|
|
27
|
+
| MCP tools | — | 11 |
|
|
28
|
+
| npm runtime dependencies | — | 0 |
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Run immediately without installing
|
|
36
|
+
npx sigmap
|
|
37
|
+
|
|
38
|
+
# Install globally
|
|
39
|
+
npm install -g sigmap
|
|
40
|
+
|
|
41
|
+
# Auto-wire MCP + editor config + git hook + watcher
|
|
42
|
+
npx sigmap --setup
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## CLI commands — complete reference
|
|
48
|
+
|
|
49
|
+
Every command and flag (`sigmap --help`):
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
sigmap Generate context once and exit
|
|
53
|
+
sigmap --monorepo Generate per-package context (monorepo)
|
|
54
|
+
sigmap --each Run for every repo in the current directory
|
|
55
|
+
sigmap --routing Include model routing hints in output
|
|
56
|
+
sigmap --format cache Also write Anthropic prompt-cache JSON
|
|
57
|
+
sigmap --track Append run metrics to .context/usage.ndjson
|
|
58
|
+
sigmap --watch Generate + watch for file changes
|
|
59
|
+
sigmap --setup Generate + install git hook + watch
|
|
60
|
+
sigmap --mcp Start MCP server on stdio
|
|
61
|
+
sigmap --report Token reduction stats to stdout
|
|
62
|
+
sigmap --report --json Token report as JSON (for CI; exits 1 if over budget)
|
|
63
|
+
sigmap --report --history Print usage log summary from .context/usage.ndjson
|
|
64
|
+
sigmap --report --history --chart Include inline SVG charts + Unicode sparklines
|
|
65
|
+
sigmap --dashboard Write benchmarks/reports/dashboard.html
|
|
66
|
+
sigmap --suggest-tool "<task>" Recommend model tier for a task description
|
|
67
|
+
sigmap --suggest-tool "<task>" --json Machine-readable tier recommendation
|
|
68
|
+
sigmap --health Print composite health score
|
|
69
|
+
sigmap --health --json Machine-readable health score
|
|
70
|
+
sigmap --diff Generate context for git-changed files only
|
|
71
|
+
sigmap --diff <base-ref> Generate context + structural diff vs base ref (e.g. main)
|
|
72
|
+
sigmap --diff --staged Generate context for staged files only
|
|
73
|
+
sigmap --benchmark Run retrieval benchmark (benchmarks/tasks/retrieval.jsonl)
|
|
74
|
+
sigmap --adapter <name> Generate for a specific adapter only (v3.0+)
|
|
75
|
+
sigmap --adapter <name> --json Show adapter output path as JSON
|
|
76
|
+
sigmap --benchmark --json Benchmark results as JSON
|
|
77
|
+
sigmap --eval Alias for --benchmark
|
|
78
|
+
sigmap --analyze Per-file breakdown: sigs, tokens, extractor, coverage
|
|
79
|
+
sigmap --analyze --json Breakdown as JSON
|
|
80
|
+
sigmap --analyze --slow Re-time each extractor; flag files >50ms
|
|
81
|
+
sigmap --diagnose-extractors Run all 21 extractors vs fixtures; show pass/fail + diff
|
|
82
|
+
sigmap --query "<text>" Rank files by relevance to a query
|
|
83
|
+
sigmap --query "<text>" --json Ranked results as JSON
|
|
84
|
+
sigmap --query "<text>" --top <n> Limit results to top N files (default 10)
|
|
85
|
+
sigmap learn --good <files...> Boost files in .context/weights.json
|
|
86
|
+
sigmap learn --bad <files...> Penalize files in .context/weights.json
|
|
87
|
+
sigmap learn --reset Delete learned file weights
|
|
88
|
+
sigmap weights Show learned file multipliers
|
|
89
|
+
sigmap weights --json Learned weights as JSON
|
|
90
|
+
sigmap --impact <file> Show every file impacted by changing <file>
|
|
91
|
+
sigmap --impact <file> --json Impact as JSON {changed, direct, transitive, tests, routes}
|
|
92
|
+
sigmap --impact <file> --depth <n> BFS depth limit (default 3, 0=unlimited)
|
|
93
|
+
sigmap verify-ai-output <answer.md> Flag fake files/tests/imports/symbols/npm-scripts in an AI answer
|
|
94
|
+
sigmap verify-ai-output <answer.md> --json Hallucination report as JSON (exits 1 if issues)
|
|
95
|
+
sigmap verify-ai-output <answer.md> --report Write a standalone HTML report (red/amber/green)
|
|
96
|
+
sigmap squeeze <file|-> Minimize a pasted stacktrace/CI-log/JSON blob (--json for stats)
|
|
97
|
+
sigmap ask "<query>" --squeeze Auto-accept input minimization (no prompt; for scripts/CI)
|
|
98
|
+
sigmap ask "<query>" --no-squeeze Disable input minimization entirely
|
|
99
|
+
sigmap ask "<query>" --squeeze-threshold N Min reduction %% to prompt (default 30)
|
|
100
|
+
sigmap note "<text>" Append a note to the cross-session decision log
|
|
101
|
+
sigmap note List recent notes (also: note --list <N>)
|
|
102
|
+
sigmap status Show repo state — branch, dirty files, index freshness, notes
|
|
103
|
+
sigmap --init Write example config + .contextignore scaffold
|
|
104
|
+
sigmap --help Show this message
|
|
105
|
+
sigmap --version Show version
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## MCP server — 11 tools
|
|
111
|
+
|
|
112
|
+
Start with `sigmap --mcp` (stdio JSON-RPC). Configure once:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{ "mcpServers": { "sigmap": { "command": "npx", "args": ["sigmap", "--mcp"] } } }
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### read_context
|
|
119
|
+
|
|
120
|
+
Read extracted code signatures for the project or a specific module path. Returns the full copilot-instructions.md content (~500–4K tokens) or a filtered subset when a module path is provided (~50–500 tokens).
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
Input: { module?: string }
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### search_signatures
|
|
127
|
+
|
|
128
|
+
Search extracted code signatures for a keyword, function name, or class name. Returns matching signature lines with their file paths.
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
Input: { query: string }
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### get_map
|
|
135
|
+
|
|
136
|
+
Read a section from PROJECT_MAP.md — import graph, class hierarchy, or route table. Requires gen-project-map.js to have been run first.
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
Input: { type: string }
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### create_checkpoint
|
|
143
|
+
|
|
144
|
+
Create a session checkpoint summarising current project state. Returns recent git commits, active branch, token count, and a compact snapshot of the codebase context — ideal for session handoffs or periodic saves during long coding sessions.
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
Input: { note?: string }
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### get_routing
|
|
151
|
+
|
|
152
|
+
Get model routing hints for this project — which files belong to which complexity tier (fast/balanced/powerful) and which AI model to use for each type of task. Helps reduce API costs by 40–80% by routing simple tasks to cheaper models.
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
Input: { } (no arguments)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### explain_file
|
|
159
|
+
|
|
160
|
+
Explain a specific file: returns its extracted signatures, direct imports (files it depends on), and callers (files that import it). Ideal for understanding a file in isolation without reading raw source. Requires the context file to have been generated first.
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
Input: { path: string }
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### list_modules
|
|
167
|
+
|
|
168
|
+
List all top-level modules (srcDirs) present in the context file, sorted by token count descending. Use this to decide which module to pass to read_context before querying a specific area of the codebase.
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
Input: { } (no arguments)
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### query_context
|
|
175
|
+
|
|
176
|
+
Rank and return the most relevant files for a specific task or question. Uses keyword + symbol + path scoring to surface only the top-K files relevant to the query — much cheaper than reading all context. Returns ranked file list with signatures and relevance scores.
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
Input: { query: string, topK?: number }
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### get_impact
|
|
183
|
+
|
|
184
|
+
Show every file that is impacted when a given file changes — direct importers, transitive importers, affected tests, and affected routes/controllers. Gives agents instant blast-radius awareness before making a change. Handles circular dependencies safely (no infinite loops).
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
Input: { file: string, depth?: number }
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### get_lines
|
|
191
|
+
|
|
192
|
+
Fetch an exact line range from a source file on demand — the Surgical Context workhorse. Signatures carry `path:start-end` anchors; call this to read just those lines instead of re-opening the whole file. Lines are clamped to the file bounds and secret-scanned (redacted) before return. Path is sandboxed to the project root.
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
Input: { file: string, start: number, end: number }
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### read_memory
|
|
199
|
+
|
|
200
|
+
Recall the project decision log — recent notes left by humans or agents across sessions (via `sigmap note`), plus the last ranking-session focus. Call this at the start of a task to kill cold-start: it answers "what were we doing and why" without re-reading the whole codebase.
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
Input: { limit?: number }
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Configuration (gen-context.config.json)
|
|
209
|
+
|
|
210
|
+
Every config key and its default:
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
output = .github/copilot-instructions.md
|
|
214
|
+
outputs = ["copilot"]
|
|
215
|
+
adapters = null
|
|
216
|
+
srcDirs = ["src","app","lib","packages","services","api","server","client","web","frontend","backend","desktop","mobile","shared","common","core","workers","functions","lambda","cmd","pages","components","hooks","routes","controllers","models","views","resources","config","db","projects","apps","libs","instance","blueprints","src/main/java","src/main/kotlin","src/main/scala","app/src/main/java","app/src/main/kotlin","src/test/java","src/test/kotlin"]
|
|
217
|
+
exclude = ["node_modules",".git","dist","build","out","__pycache__",".next","coverage","target","vendor",".context","playwright-tmp","playwright-report","test-results",".turbo","storybook-static",".docusaurus"]
|
|
218
|
+
maxDepth = 6
|
|
219
|
+
maxSigsPerFile = 25
|
|
220
|
+
maxTokens = 6000
|
|
221
|
+
autoMaxTokens = true
|
|
222
|
+
coverageTarget = 0.8
|
|
223
|
+
modelContextLimit = 128000
|
|
224
|
+
maxTokensHeadroom = 0.2
|
|
225
|
+
secretScan = true
|
|
226
|
+
monorepo = false
|
|
227
|
+
diffPriority = true
|
|
228
|
+
strategy = full
|
|
229
|
+
hotCommits = 10
|
|
230
|
+
watchDebounce = 300
|
|
231
|
+
routing = false
|
|
232
|
+
format = default
|
|
233
|
+
tracking = false
|
|
234
|
+
mcp = {"autoRegister":true}
|
|
235
|
+
depMap = true
|
|
236
|
+
todos = true
|
|
237
|
+
changes = true
|
|
238
|
+
changesCommits = 10
|
|
239
|
+
testCoverage = false
|
|
240
|
+
testDirs = ["tests","test","__tests__","spec"]
|
|
241
|
+
sigCache = false
|
|
242
|
+
impactRadius = false
|
|
243
|
+
retrieval = {"topK":10,"recencyBoost":1.5}
|
|
244
|
+
impact = {"depth":3,"includeSigs":true}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## Supported languages (34 extractors)
|
|
250
|
+
|
|
251
|
+
cpp, csharp, css, dart, dockerfile, gdscript, generic, go, graphql, html, java, javascript, kotlin, markdown, php, properties, protobuf, python, r, ruby, rust, scala, shell, sql, svelte, swift, terraform, toml, typescript, typescript_react, vue, vue_sfc, xml, yaml
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Integrations
|
|
256
|
+
|
|
257
|
+
Generates native context files for: claude, codex, copilot, cursor, gemini, openai, willow, windsurf — plus an MCP server for any agent (Claude Code, Cursor, Cline, Windsurf, OpenCode, Gemini CLI, Aider). One `sigmap --setup` wires the lot.
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## Compliance evidence support
|
|
262
|
+
|
|
263
|
+
SigMap can surface repository facts that *support* technical-evidence narratives
|
|
264
|
+
(e.g. DORA Art. 8–11, NIS2 Art. 21, ISO 27001 A.8) — it is a **technical evidence
|
|
265
|
+
pack**, never a certification or a "compliance report". Signed evidence packs are
|
|
266
|
+
planned for a later release. Any compliance-adjacent wording is reviewed against
|
|
267
|
+
the relevant regulation before publication; SigMap makes no legal claims.
|
|
268
|
+
|
|
269
|
+
---
|
|
270
|
+
|
|
271
|
+
## Project information
|
|
272
|
+
|
|
273
|
+
- Author: Manoj Mallick
|
|
274
|
+
- License: MIT
|
|
275
|
+
- Repository: https://github.com/manojmallick/sigmap
|
|
276
|
+
- Documentation: https://manojmallick.github.io/sigmap/
|
|
277
|
+
- npm: https://www.npmjs.com/package/sigmap
|
|
278
|
+
- Benchmark dataset: https://doi.org/10.5281/zenodo.19898842
|
|
279
|
+
- Issues: https://github.com/manojmallick/sigmap/issues
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## What SigMap does not do
|
|
284
|
+
|
|
285
|
+
- **No embeddings / vector database.** Ranking is deterministic TF-IDF over
|
|
286
|
+
extracted signatures — reproducible and offline, not a semantic vector search.
|
|
287
|
+
- **No code execution.** SigMap reads source statically; it never runs your code.
|
|
288
|
+
- **No network calls** on the core generate/ask/verify paths. Nothing is uploaded;
|
|
289
|
+
generation works fully offline.
|
|
290
|
+
- **Not a linter or type checker.** It maps and ranks code structure; it does not
|
|
291
|
+
judge correctness (use `verify-ai-output` only to flag *fabricated* references).
|
|
292
|
+
- **Not a full file reader.** It emits signatures + line anchors; an agent fetches
|
|
293
|
+
exact bodies on demand via the `get_lines` MCP tool.
|
|
294
|
+
- **No telemetry.** Usage tracking (`--track`, `.context/usage.ndjson`) is local
|
|
295
|
+
and opt-in; nothing leaves your machine.
|
package/llms.txt
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# SigMap
|
|
2
|
+
|
|
3
|
+
> Zero-dependency context engine that stops AI coding agents from guessing in your codebase.
|
|
4
|
+
> Grounded context. Verified answers. No embeddings, no vector DB, fully offline.
|
|
5
|
+
|
|
6
|
+
SigMap is a zero-dependency AI context engine. It extracts function and class
|
|
7
|
+
signatures from a codebase and uses TF-IDF ranking to feed an AI assistant only
|
|
8
|
+
the files relevant to the task — cutting tokens ~97% while keeping answers
|
|
9
|
+
grounded. Deterministic, offline, no embeddings or vector database. Works with
|
|
10
|
+
Claude, Cursor, GitHub Copilot, Aider, Windsurf, local LLMs, and MCP.
|
|
11
|
+
|
|
12
|
+
# Version: 7.0.1 | Benchmark: sigmap-v7.0-main (2026-06-14)
|
|
13
|
+
# Source: auto-generated from package.json, version.json, src/mcp/tools.js, src/config/defaults.js
|
|
14
|
+
# Regenerate: npm run generate:llms | Validate: npm run validate:llms
|
|
15
|
+
|
|
16
|
+
## What SigMap solves
|
|
17
|
+
|
|
18
|
+
- AI agents hallucinate functions, files, and imports that don't exist — `verify-ai-output` flags fabricated references before you trust them.
|
|
19
|
+
- Agents load 60–80K tokens of raw source just to orient — `ask` ranks the codebase and sends ~2K tokens of the relevant signatures.
|
|
20
|
+
- Cold start every session — `note` + the `read_memory` MCP tool carry decisions and focus across sessions.
|
|
21
|
+
- No blast-radius awareness before editing a hub file — `--impact` shows every file a change touches.
|
|
22
|
+
- Pasted stack traces, CI logs, and JSON bloat the prompt — `squeeze` minimizes them and enriches the top frame from the symbol index.
|
|
23
|
+
|
|
24
|
+
## Core metrics (benchmark: sigmap-v7.0-main, 2026-06-14)
|
|
25
|
+
|
|
26
|
+
- hit@5 retrieval: 75.6% vs 13.6% random baseline (5.6× lift)
|
|
27
|
+
- Token reduction: 97.0% average across benchmark repos
|
|
28
|
+
- Task success: 52.2% vs 10% without SigMap
|
|
29
|
+
- Prompts per task: 1.72 vs 2.84 baseline (39.4% fewer)
|
|
30
|
+
- Languages: 31 supported · MCP tools: 11
|
|
31
|
+
- Dependencies: zero npm runtime dependencies · fully offline
|
|
32
|
+
|
|
33
|
+
## Quick start
|
|
34
|
+
```bash
|
|
35
|
+
npx sigmap # generate compact signature context for the repo
|
|
36
|
+
npx sigmap ask "<your query>" # rank the files relevant to a task
|
|
37
|
+
npx sigmap verify-ai-output ans.md # flag fabricated files/imports/symbols in an AI answer
|
|
38
|
+
npx sigmap --mcp # start the MCP server over stdio
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Docs
|
|
42
|
+
- [Full documentation](https://manojmallick.github.io/sigmap/)
|
|
43
|
+
- [CLI reference](https://manojmallick.github.io/sigmap/guide/cli)
|
|
44
|
+
- [MCP tools](https://manojmallick.github.io/sigmap/guide/mcp)
|
|
45
|
+
- [Benchmark methodology](https://manojmallick.github.io/sigmap/guide/benchmark)
|
|
46
|
+
- [Configuration guide](https://manojmallick.github.io/sigmap/guide/config)
|
|
47
|
+
- [Changelog](https://github.com/manojmallick/sigmap/blob/main/CHANGELOG.md)
|
|
48
|
+
|
|
49
|
+
## Optional
|
|
50
|
+
- [GitHub repository](https://github.com/manojmallick/sigmap)
|
|
51
|
+
- [npm package](https://www.npmjs.com/package/sigmap)
|
|
52
|
+
- [Benchmark dataset (Zenodo)](https://doi.org/10.5281/zenodo.19898842)
|
|
53
|
+
- [Full LLM reference](https://manojmallick.github.io/sigmap/llms-full.txt)
|
|
54
|
+
|
|
55
|
+
SigMap — grounded AI coding context. The lightweight, deterministic alternative
|
|
56
|
+
to embeddings for feeding the right code to AI assistants.
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sigmap",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "
|
|
3
|
+
"version": "7.0.1",
|
|
4
|
+
"description": "97% token reduction for AI coding. Extracts function & class signatures with TF-IDF ranking to feed only the right files to Claude, Cursor, Copilot, Aider, Windsurf, local LLMs & MCP. Zero dependencies, runs offline via npx.",
|
|
5
|
+
"main": "packages/core/index.js",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": "./packages/core/index.js",
|
|
8
8
|
"./cli": "./packages/cli/index.js",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"test": "node test/run.js && node test/r-language.test.js",
|
|
18
|
-
"test:integration": "node test/integration/strategy.test.js && node test/integration/secret-scan.test.js && node test/integration/token-budget.test.js && node test/integration/auto-budget.test.js && node test/integration/mcp/server.test.js && node test/integration/verify-ai-output.test.js && node test/integration/memory-tools.test.js",
|
|
18
|
+
"test:integration": "node test/integration/strategy.test.js && node test/integration/secret-scan.test.js && node test/integration/token-budget.test.js && node test/integration/auto-budget.test.js && node test/integration/mcp/server.test.js && node test/integration/verify-ai-output.test.js && node test/integration/memory-tools.test.js && node test/integration/squeeze.test.js && node test/integration/context-consistency.test.js && node test/integration/features/llms-current.test.js",
|
|
19
19
|
"test:integration:all": "node test/integration/all.js",
|
|
20
20
|
"test:all": "node test/run.js && node test/r-language.test.js && node test/integration/strategy.test.js && node test/integration/secret-scan.test.js",
|
|
21
21
|
"generate": "node gen-context.js",
|
|
@@ -26,12 +26,17 @@
|
|
|
26
26
|
"audit:strategies": "node scripts/run-strategy-audit.mjs",
|
|
27
27
|
"benchmark:matrix": "node scripts/run-benchmark-matrix.mjs --save --skip-clone",
|
|
28
28
|
"benchmark:verify": "node scripts/run-verify-benchmark.mjs",
|
|
29
|
+
"benchmark:squeeze": "node scripts/run-squeeze-benchmark.mjs --save",
|
|
30
|
+
"validate:squeeze": "node scripts/run-squeeze-benchmark.mjs --gate",
|
|
29
31
|
"health": "node gen-context.js --health",
|
|
30
32
|
"map": "node gen-project-map.js",
|
|
31
33
|
"mcp": "node gen-context.js --mcp",
|
|
32
34
|
"build:binary": "node scripts/build-binary.mjs",
|
|
33
35
|
"verify:binary": "node scripts/verify-binary.mjs",
|
|
34
|
-
"version:sync": "node scripts/sync-versions.mjs"
|
|
36
|
+
"version:sync": "node scripts/sync-versions.mjs",
|
|
37
|
+
"generate:llms": "node scripts/generate-llms.mjs",
|
|
38
|
+
"validate:llms": "node scripts/validate-llms.mjs",
|
|
39
|
+
"prepublishOnly": "node scripts/generate-llms.mjs"
|
|
35
40
|
},
|
|
36
41
|
"files": [
|
|
37
42
|
"gen-context.js",
|
|
@@ -42,24 +47,32 @@
|
|
|
42
47
|
"AGENTS.md",
|
|
43
48
|
"LICENSE",
|
|
44
49
|
"CHANGELOG.md",
|
|
50
|
+
"llms.txt",
|
|
51
|
+
"llms-full.txt",
|
|
45
52
|
".contextignore.example",
|
|
46
53
|
"gen-context.config.json.example"
|
|
47
54
|
],
|
|
48
55
|
"keywords": [
|
|
49
56
|
"ai",
|
|
57
|
+
"llm",
|
|
50
58
|
"context",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
59
|
+
"token-reduction",
|
|
60
|
+
"codebase",
|
|
61
|
+
"retrieval",
|
|
62
|
+
"tf-idf",
|
|
53
63
|
"cursor",
|
|
64
|
+
"claude",
|
|
65
|
+
"github-copilot",
|
|
66
|
+
"aider",
|
|
54
67
|
"windsurf",
|
|
55
|
-
"
|
|
56
|
-
"tokens",
|
|
57
|
-
"token-reduction",
|
|
58
|
-
"code-signatures",
|
|
59
|
-
"ai-context",
|
|
60
|
-
"zero-dependency",
|
|
68
|
+
"developer-tools",
|
|
61
69
|
"mcp",
|
|
62
|
-
"
|
|
70
|
+
"function-signatures",
|
|
71
|
+
"code-intelligence",
|
|
72
|
+
"context-compression",
|
|
73
|
+
"local-llm",
|
|
74
|
+
"ollama",
|
|
75
|
+
"ai-coding"
|
|
63
76
|
],
|
|
64
77
|
"author": {
|
|
65
78
|
"name": "Manoj Mallick",
|
|
@@ -73,6 +86,10 @@
|
|
|
73
86
|
"bugs": {
|
|
74
87
|
"url": "https://github.com/manojmallick/sigmap/issues"
|
|
75
88
|
},
|
|
89
|
+
"funding": {
|
|
90
|
+
"type": "github",
|
|
91
|
+
"url": "https://github.com/sponsors/manojmallick"
|
|
92
|
+
},
|
|
76
93
|
"license": "MIT",
|
|
77
94
|
"engines": {
|
|
78
95
|
"node": ">=18.0.0"
|
|
@@ -61,12 +61,6 @@ function format(context, opts = {}) {
|
|
|
61
61
|
const timestamp = new Date().toISOString();
|
|
62
62
|
const meta = _confidenceMeta(opts);
|
|
63
63
|
return [
|
|
64
|
-
'## SigMap',
|
|
65
|
-
'- Before searching for files, run `sigmap ask "<query>"` — ranks by TF-IDF relevance',
|
|
66
|
-
'- After config changes, run `sigmap validate` to confirm coverage',
|
|
67
|
-
'- To verify answer groundedness, run `sigmap judge --response <file> --context CLAUDE.md`',
|
|
68
|
-
'- For PR-scoped context, run `sigmap --diff`',
|
|
69
|
-
'',
|
|
70
64
|
`<!-- Generated by SigMap v${version} — ${timestamp} -->`,
|
|
71
65
|
meta,
|
|
72
66
|
'',
|
|
@@ -17,44 +17,6 @@ const fs = require('fs');
|
|
|
17
17
|
|
|
18
18
|
const name = 'codex';
|
|
19
19
|
const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
|
|
20
|
-
const TOOLS_MARKER = '<!-- sigmap-tools -->';
|
|
21
|
-
|
|
22
|
-
const TOOLS_BLOCK = [
|
|
23
|
-
'## Tools',
|
|
24
|
-
'',
|
|
25
|
-
TOOLS_MARKER,
|
|
26
|
-
'',
|
|
27
|
-
'```json',
|
|
28
|
-
JSON.stringify([
|
|
29
|
-
{
|
|
30
|
-
name: 'sigmap_ask',
|
|
31
|
-
description: 'Rank source files by relevance to a natural-language query. Run before exploring the codebase.',
|
|
32
|
-
command: 'sigmap ask "$QUERY"',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
name: 'sigmap_validate',
|
|
36
|
-
description: 'Validate SigMap config and measure context coverage. Run after changing config or source dirs.',
|
|
37
|
-
command: 'sigmap validate',
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
name: 'sigmap_judge',
|
|
41
|
-
description: 'Score an LLM response for groundedness against source context. Use to verify answer quality.',
|
|
42
|
-
command: 'sigmap judge --response "$RESPONSE" --context "$CONTEXT"',
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: 'sigmap_query',
|
|
46
|
-
description: 'Rank all files by relevance using TF-IDF and write a focused mini-context.',
|
|
47
|
-
command: 'sigmap --query "$QUERY" --context',
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
name: 'sigmap_weights',
|
|
51
|
-
description: 'Show learned file-ranking multipliers accumulated from past sessions.',
|
|
52
|
-
command: 'sigmap weights',
|
|
53
|
-
},
|
|
54
|
-
], null, 2),
|
|
55
|
-
'```',
|
|
56
|
-
'',
|
|
57
|
-
].join('\n');
|
|
58
20
|
|
|
59
21
|
/**
|
|
60
22
|
* Format context for AGENTS.md — clean markdown, no LLM preamble.
|
|
@@ -64,19 +26,7 @@ const TOOLS_BLOCK = [
|
|
|
64
26
|
*/
|
|
65
27
|
function format(context, opts = {}) {
|
|
66
28
|
if (!context || typeof context !== 'string' || !context.trim()) return '';
|
|
67
|
-
|
|
68
|
-
'## SigMap commands',
|
|
69
|
-
'',
|
|
70
|
-
'| When | Command |',
|
|
71
|
-
'|------|---------|',
|
|
72
|
-
'| Before answering a question | `sigmap ask "<your question>"` |',
|
|
73
|
-
'| After code changes | `sigmap validate` |',
|
|
74
|
-
'| To query by topic | `sigmap --query "<topic>"` |',
|
|
75
|
-
'',
|
|
76
|
-
'Always run `sigmap ask` or `sigmap --query` before searching for files relevant to a task.',
|
|
77
|
-
'',
|
|
78
|
-
].join('\n');
|
|
79
|
-
return `# Code signatures\n\n${toolBlock}${context}`;
|
|
29
|
+
return `# Code signatures\n\n${context}`;
|
|
80
30
|
}
|
|
81
31
|
|
|
82
32
|
/**
|
|
@@ -118,16 +68,6 @@ function write(context, cwd, opts = {}) {
|
|
|
118
68
|
: existing + MARKER + formatted;
|
|
119
69
|
}
|
|
120
70
|
|
|
121
|
-
// Inject ## Tools block above the sig marker if not already present
|
|
122
|
-
if (!newContent.includes(TOOLS_MARKER)) {
|
|
123
|
-
const sigMarkerPos = newContent.indexOf('## Auto-generated signatures');
|
|
124
|
-
if (sigMarkerPos !== -1) {
|
|
125
|
-
newContent = newContent.slice(0, sigMarkerPos) + TOOLS_BLOCK + '\n' + newContent.slice(sigMarkerPos);
|
|
126
|
-
} else {
|
|
127
|
-
newContent = TOOLS_BLOCK + '\n' + newContent;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
|
|
131
71
|
fs.writeFileSync(filePath, newContent, 'utf8');
|
|
132
72
|
}
|
|
133
73
|
|
|
@@ -33,14 +33,6 @@ function format(context, opts = {}) {
|
|
|
33
33
|
meta,
|
|
34
34
|
`<!-- Do not edit below — regenerate with: node gen-context.js -->`,
|
|
35
35
|
'',
|
|
36
|
-
'## SigMap commands',
|
|
37
|
-
'',
|
|
38
|
-
'| When | Command |',
|
|
39
|
-
'|------|---------|',
|
|
40
|
-
'| Before answering a question about code | `sigmap ask "<your question>"` |',
|
|
41
|
-
'| After changing config or source dirs | `sigmap validate` |',
|
|
42
|
-
'| To verify an AI answer is grounded | `sigmap judge --response <file>` |',
|
|
43
|
-
'',
|
|
44
36
|
'# Code signatures',
|
|
45
37
|
'',
|
|
46
38
|
].join('\n');
|
|
@@ -30,10 +30,6 @@ function format(context, opts = {}) {
|
|
|
30
30
|
`# Updated: ${timestamp}`,
|
|
31
31
|
`# ${meta}`,
|
|
32
32
|
`# Regenerate: node gen-context.js`,
|
|
33
|
-
'#',
|
|
34
|
-
'# SigMap: before answering, run: sigmap ask "<query>" — finds relevant files',
|
|
35
|
-
'# SigMap: after config changes, run: sigmap validate',
|
|
36
|
-
'# SigMap: to verify answers, run: sigmap judge --response <file>',
|
|
37
33
|
'',
|
|
38
34
|
].join('\n');
|
|
39
35
|
return header + context;
|
|
@@ -44,8 +44,6 @@ function format(context, opts = {}) {
|
|
|
44
44
|
projectLine,
|
|
45
45
|
`These signatures represent every public function, class, and type in the project.`,
|
|
46
46
|
`Refer to them when answering questions about code structure, APIs, and implementation.`,
|
|
47
|
-
`Before answering questions about specific code areas, suggest running \`sigmap ask "<query>"\` to get the most relevant files. After config changes, \`sigmap validate\` confirms coverage.`,
|
|
48
|
-
``,
|
|
49
47
|
`## Code Signatures`,
|
|
50
48
|
``,
|
|
51
49
|
context,
|
|
@@ -42,8 +42,6 @@ function format(context, opts = {}) {
|
|
|
42
42
|
projectLine,
|
|
43
43
|
`Use these signatures to answer questions about the code accurately.`,
|
|
44
44
|
`When the user asks about a specific file or function, refer to the signatures below.`,
|
|
45
|
-
`Before answering questions about specific code areas, prefer running \`sigmap ask "<query>"\` to get the most relevant files. After config changes, \`sigmap validate\` confirms coverage.`,
|
|
46
|
-
``,
|
|
47
45
|
`## Code Signatures`,
|
|
48
46
|
``,
|
|
49
47
|
context,
|
|
@@ -30,10 +30,6 @@ function format(context, opts = {}) {
|
|
|
30
30
|
`# Updated: ${timestamp}`,
|
|
31
31
|
`# ${meta}`,
|
|
32
32
|
`# Regenerate: node gen-context.js`,
|
|
33
|
-
'#',
|
|
34
|
-
'# SigMap: before answering, run: sigmap ask "<query>" — finds relevant files',
|
|
35
|
-
'# SigMap: after config changes, run: sigmap validate',
|
|
36
|
-
'# SigMap: to verify answers, run: sigmap judge --response <file>',
|
|
37
33
|
'',
|
|
38
34
|
].join('\n');
|
|
39
35
|
return header + context;
|
package/src/config/loader.js
CHANGED
|
@@ -34,12 +34,12 @@ function loadBaseConfig(extendsVal, cwd) {
|
|
|
34
34
|
}).on('error', reject);
|
|
35
35
|
});
|
|
36
36
|
})();
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
);
|
|
37
|
+
// Sync fallback: run a tiny fetch in a child node process. Shell-free —
|
|
38
|
+
// execFileSync runs the node binary directly (no /bin/sh) and the URL is
|
|
39
|
+
// passed as an argv value, never interpolated into a command string.
|
|
40
|
+
const { execFileSync } = require('child_process');
|
|
41
|
+
const SYNC_FETCH = "const u=process.argv[1];const h=require(u.startsWith('https')?'https':'http');let d='';h.get(u,r=>{r.on('data',c=>d+=c);r.on('end',()=>process.stdout.write(d))}).on('error',()=>process.exit(1))";
|
|
42
|
+
const out = execFileSync(process.execPath, ['-e', SYNC_FETCH, extendsVal], { timeout: 10000, encoding: 'utf8' });
|
|
43
43
|
const parsed = JSON.parse(out);
|
|
44
44
|
if (!fs.existsSync(cacheDir)) fs.mkdirSync(cacheDir, { recursive: true });
|
|
45
45
|
fs.writeFileSync(cachePath, JSON.stringify(parsed), 'utf8');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
const {
|
|
5
|
+
const { git } = require('../util/git');
|
|
6
6
|
|
|
7
7
|
const CODE_EXTS = new Set([
|
|
8
8
|
'.js','.mjs','.cjs','.ts','.tsx','.jsx',
|
|
@@ -35,7 +35,7 @@ const ROOT_ENTRYPOINTS = {
|
|
|
35
35
|
|
|
36
36
|
function getRecentlyChangedDirs(cwd) {
|
|
37
37
|
try {
|
|
38
|
-
const out =
|
|
38
|
+
const out = git(['log', '--name-only', '--format=', 'HEAD~10'], { cwd, timeout: 3000 }).toString();
|
|
39
39
|
return new Set(out.split('\n').filter(Boolean).map(f => f.split('/')[0]));
|
|
40
40
|
} catch { return new Set(); }
|
|
41
41
|
}
|