sigmap 1.5.0

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.
Files changed (44) hide show
  1. package/.contextignore.example +34 -0
  2. package/CHANGELOG.md +402 -0
  3. package/LICENSE +21 -0
  4. package/README.md +601 -0
  5. package/gen-context.config.json.example +40 -0
  6. package/gen-context.js +4316 -0
  7. package/gen-project-map.js +172 -0
  8. package/package.json +67 -0
  9. package/src/config/defaults.js +61 -0
  10. package/src/config/loader.js +60 -0
  11. package/src/extractors/cpp.js +60 -0
  12. package/src/extractors/csharp.js +48 -0
  13. package/src/extractors/css.js +51 -0
  14. package/src/extractors/dart.js +58 -0
  15. package/src/extractors/dockerfile.js +49 -0
  16. package/src/extractors/go.js +61 -0
  17. package/src/extractors/html.js +39 -0
  18. package/src/extractors/java.js +49 -0
  19. package/src/extractors/javascript.js +82 -0
  20. package/src/extractors/kotlin.js +62 -0
  21. package/src/extractors/php.js +62 -0
  22. package/src/extractors/python.js +69 -0
  23. package/src/extractors/ruby.js +43 -0
  24. package/src/extractors/rust.js +72 -0
  25. package/src/extractors/scala.js +67 -0
  26. package/src/extractors/shell.js +43 -0
  27. package/src/extractors/svelte.js +51 -0
  28. package/src/extractors/swift.js +63 -0
  29. package/src/extractors/typescript.js +109 -0
  30. package/src/extractors/vue.js +66 -0
  31. package/src/extractors/yaml.js +59 -0
  32. package/src/format/cache.js +53 -0
  33. package/src/health/scorer.js +123 -0
  34. package/src/map/class-hierarchy.js +117 -0
  35. package/src/map/import-graph.js +148 -0
  36. package/src/map/route-table.js +127 -0
  37. package/src/mcp/handlers.js +433 -0
  38. package/src/mcp/server.js +128 -0
  39. package/src/mcp/tools.js +125 -0
  40. package/src/routing/classifier.js +102 -0
  41. package/src/routing/hints.js +103 -0
  42. package/src/security/patterns.js +51 -0
  43. package/src/security/scanner.js +36 -0
  44. package/src/tracking/logger.js +115 -0
package/README.md ADDED
@@ -0,0 +1,601 @@
1
+ <div align="center">
2
+
3
+ <h1>โšก SigMap</h1>
4
+
5
+ <p><strong>Zero-dependency AI context engine โ€” 97% token reduction</strong></p>
6
+
7
+ <p>
8
+ Every coding agent session starts with full codebase context at under 4K tokens.<br>
9
+ No <code>npm install</code>. No setup. Runs on any machine with Node.js 18+.
10
+ </p>
11
+
12
+ <!-- Status -->
13
+ [![GitHub release](https://img.shields.io/github/v/release/manojmallick/sigmap?color=7c6af7&label=latest)](https://github.com/manojmallick/sigmap/releases)
14
+ [![Tests](https://img.shields.io/badge/tests-274%20passing-22c55e)](https://github.com/manojmallick/sigmap/tree/main/test)
15
+ [![Zero deps](https://img.shields.io/badge/dependencies-zero-22c55e)](package.json)
16
+ [![Last commit](https://img.shields.io/github/last-commit/manojmallick/sigmap?color=7c6af7)](https://github.com/manojmallick/sigmap/commits/main)
17
+
18
+ <!-- Meta -->
19
+ [![License: MIT](https://img.shields.io/badge/License-MIT-7c6af7.svg)](LICENSE)
20
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org)
21
+ [![npm](https://img.shields.io/badge/npm-context--forge-cb3837?logo=npm)](https://www.npmjs.com/package/sigmap)
22
+ [![GitHub Stars](https://img.shields.io/github/stars/manojmallick/sigmap?style=flat&color=f59e0b&logo=github)](https://github.com/manojmallick/sigmap/stargazers)
23
+
24
+ <!-- Links -->
25
+ [![Docs](https://img.shields.io/badge/docs-live-7c6af7?logo=github-pages)](https://manojmallick.github.io/sigmap)
26
+ [![Changelog](https://img.shields.io/badge/changelog-CHANGELOG.md-blue)](CHANGELOG.md)
27
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md)
28
+ [![VS Code](https://img.shields.io/badge/VS%20Code-extension-0078d4?logo=visual-studio-code)](vscode-extension/)
29
+
30
+ </div>
31
+
32
+ ---
33
+
34
+ ## Table of contents
35
+
36
+ | | |
37
+ |---|---|
38
+ | [What it does](#-what-it-does) | Token reduction table, pipeline overview |
39
+ | [Quick start](#-quick-start) | Get running in 60 seconds |
40
+ | [VS Code extension](#-vs-code-extension) | Status bar, stale alerts, commands |
41
+ | [Languages supported](#-languages-supported) | 21 languages |
42
+ | [Context strategies](#-context-strategies) | full / per-module / hot-cold |
43
+ | [MCP server](#-mcp-server) | 7 on-demand tools |
44
+ | [CLI reference](#-cli-reference) | All flags |
45
+ | [Configuration](#-configuration) | Config file + .contextignore |
46
+ | [Observability](#-observability) | Health score, reports, CI |
47
+ | [Testing](#-testing) | Run the test suite |
48
+ | [Project structure](#-project-structure) | File-by-file map |
49
+ | [Principles](#-principles) | Design decisions |
50
+
51
+ ---
52
+
53
+ ## ๐Ÿ” What it does
54
+
55
+ SigMap scans your source files and extracts only the **function and class signatures** โ€” no bodies, no imports, no comments โ€” then writes a compact context file that Copilot, Claude, Cursor, and Windsurf read automatically. Every session starts with full codebase awareness at a fraction of the token cost.
56
+
57
+ ```
58
+ Your codebase
59
+ โ”‚
60
+ โ–ผ
61
+ gen-context.js โ”€โ”€โ–บ extracts signatures from 21 languages
62
+ โ”‚
63
+ โ–ผ
64
+ .github/copilot-instructions.md โ—„โ”€โ”€ auto-read by Copilot / Claude / Cursor
65
+ โ”‚
66
+ โ–ผ
67
+ AI agent session starts with full context
68
+ ```
69
+
70
+ ### Token reduction at every stage
71
+
72
+ | Stage | Tokens | Reduction |
73
+ |---|---:|---:|
74
+ | Raw source files | ~80,000 | โ€” |
75
+ | Repomix compressed | ~8,000 | 90% |
76
+ | **SigMap signatures** | **~4,000** | **95%** |
77
+ | SigMap + MCP (`hot-cold`) | ~200 | **99.75%** |
78
+
79
+ > **97% fewer tokens. The same codebase understanding.**
80
+
81
+ ---
82
+
83
+ ## ๐Ÿš€ Quick start
84
+
85
+ **No install required โ€” just Node.js 18+.**
86
+
87
+ ```bash
88
+ # 1. Copy gen-context.js into your project root
89
+ curl -O https://raw.githubusercontent.com/manojmallick/sigmap/main/gen-context.js
90
+
91
+ # 2. Generate your context file
92
+ node gen-context.js
93
+
94
+ # 3. Output: .github/copilot-instructions.md
95
+ # That file is auto-read by GitHub Copilot in VS Code
96
+ ```
97
+
98
+ Or via npm (globally):
99
+
100
+ ```bash
101
+ npx sigmap # run once without installing
102
+ npm install -g sigmap # install globally
103
+ sigmap # then use anywhere
104
+ ```
105
+
106
+ ### Common workflows
107
+
108
+ ```bash
109
+ node gen-context.js # generate once and exit
110
+ node gen-context.js --watch # regenerate on every file save
111
+ node gen-context.js --setup # generate + install git hook + start watcher
112
+ node gen-context.js --diff # context for git-changed files only (PR mode)
113
+ node gen-context.js --diff --staged # staged files only (pre-commit check)
114
+ node gen-context.js --health # show context health score (grade Aโ€“D)
115
+ node gen-context.js --mcp # start MCP server on stdio
116
+ ```
117
+
118
+ ### Companion tool: Repomix
119
+
120
+ SigMap and [Repomix](https://github.com/yamadashy/repomix) are **complementary, not competing**:
121
+
122
+ | Tool | When to use |
123
+ |---|---|
124
+ | **SigMap** | Always-on, git hooks, daily signature index (~4K tokens) |
125
+ | **Repomix** | On-demand deep sessions, full file content, broader language support |
126
+
127
+ ```bash
128
+ node gen-context.js --setup # always-on context
129
+ npx repomix --compress # deep dive sessions
130
+ ```
131
+
132
+ *"SigMap for daily always-on context; Repomix for deep one-off sessions โ€” use both."*
133
+
134
+ ---
135
+
136
+ ## ๐Ÿงฉ VS Code extension
137
+
138
+ > Introduced in v1.5 โ€” zero runtime npm dependencies.
139
+
140
+ The `vscode-extension/` directory contains a first-party VS Code extension that keeps you informed without any manual commands.
141
+
142
+ | Feature | Detail |
143
+ |---|---|
144
+ | **Status bar item** | Shows health grade (`A`/`B`/`C`/`D`) + time since last regen; refreshes every 60 s |
145
+ | **Stale notification** | Warns when `copilot-instructions.md` is > 24 h old; one-click regeneration |
146
+ | **Regenerate command** | `SigMap: Regenerate Context` โ€” runs `node gen-context.js` in the integrated terminal |
147
+ | **Open context command** | `SigMap: Open Context File` โ€” opens `.github/copilot-instructions.md` |
148
+ | **Script path setting** | `contextforge.scriptPath` โ€” override when `gen-context.js` is not at the project root |
149
+
150
+ Activate on startup (`onStartupFinished`) โ€” loads within 3 s, never blocks editor startup.
151
+
152
+ ---
153
+
154
+ ## ๐ŸŒ Languages supported
155
+
156
+ > 21 languages. All implemented with zero external dependencies โ€” pure regex + Node built-ins.
157
+
158
+ <details>
159
+ <summary><strong>Show all 21 languages</strong></summary>
160
+
161
+ | Language | Extensions | Extracts |
162
+ |---|---|---|
163
+ | TypeScript | `.ts` `.tsx` | interfaces, classes, functions, types, enums |
164
+ | JavaScript | `.js` `.jsx` `.mjs` `.cjs` | classes, functions, exports |
165
+ | Python | `.py` `.pyw` | classes, methods, functions |
166
+ | Java | `.java` | classes, interfaces, methods |
167
+ | Kotlin | `.kt` `.kts` | classes, data classes, functions |
168
+ | Go | `.go` | structs, interfaces, functions |
169
+ | Rust | `.rs` | structs, impls, traits, functions |
170
+ | C# | `.cs` | classes, interfaces, methods |
171
+ | C/C++ | `.cpp` `.c` `.h` `.hpp` `.cc` | classes, functions, templates |
172
+ | Ruby | `.rb` `.rake` | classes, modules, methods |
173
+ | PHP | `.php` | classes, interfaces, functions |
174
+ | Swift | `.swift` | classes, structs, protocols, functions |
175
+ | Dart | `.dart` | classes, mixins, functions |
176
+ | Scala | `.scala` `.sc` | objects, classes, traits, functions |
177
+ | Vue | `.vue` | `<script>` functions and components |
178
+ | Svelte | `.svelte` | `<script>` functions and exports |
179
+ | HTML | `.html` `.htm` | custom elements and script functions |
180
+ | CSS/SCSS | `.css` `.scss` `.sass` `.less` | custom properties and keyframes |
181
+ | YAML | `.yml` `.yaml` | top-level keys and pipeline jobs |
182
+ | Shell | `.sh` `.bash` `.zsh` `.fish` | function declarations |
183
+ | Dockerfile | `Dockerfile` `Dockerfile.*` | stages and key instructions |
184
+
185
+ </details>
186
+
187
+ ---
188
+
189
+ ## ๐Ÿ—‚ Context strategies
190
+
191
+ > Introduced in v1.1. Reduce always-injected tokens by 70โ€“90%.
192
+
193
+ Set `"strategy"` in `gen-context.config.json`:
194
+
195
+ | Strategy | Always-injected | Context lost? | Needs MCP? | Best for |
196
+ |---|---:|:---:|:---:|---|
197
+ | `full` | ~4,000 tokens | No | No | Starting out, cross-module work |
198
+ | `per-module` | ~100โ€“300 tokens | No | No | Large codebases, module-focused sessions |
199
+ | `hot-cold` | ~200โ€“800 tokens | Cold files only | Yes | Claude Code / Cursor with MCP enabled |
200
+
201
+ ### `full` โ€” default, works everywhere
202
+
203
+ ```json
204
+ { "strategy": "full" }
205
+ ```
206
+
207
+ One file, all signatures, always injected on every question.
208
+
209
+ ### `per-module` โ€” 70% fewer injected tokens, zero context loss
210
+
211
+ ```json
212
+ { "strategy": "per-module" }
213
+ ```
214
+
215
+ One `.github/context-<module>.md` per top-level source directory, plus a tiny overview table. Load the relevant module file for focused sessions. No MCP required.
216
+
217
+ ```
218
+ .github/copilot-instructions.md โ† overview table, ~117 tokens (always-on)
219
+ .github/context-server.md โ† server/ signatures, ~2,140 tokens
220
+ .github/context-web.md โ† web/ signatures, ~335 tokens
221
+ .github/context-desktop.md โ† desktop/ signatures, ~1,583 tokens
222
+ ```
223
+
224
+ ### `hot-cold` โ€” 90% fewer injected tokens, requires MCP
225
+
226
+ ```json
227
+ { "strategy": "hot-cold", "hotCommits": 10 }
228
+ ```
229
+
230
+ Recently committed files are **hot** (auto-injected). Everything else is **cold** (on-demand via MCP). Best reduction available โ€” ~200 tokens always-on.
231
+
232
+ ๐Ÿ“– Full guide: [docs/CONTEXT_STRATEGIES.md](docs/CONTEXT_STRATEGIES.md) โ€” decision tree, scenario comparisons, migration steps.
233
+
234
+ ---
235
+
236
+ ## ๐Ÿ”Œ MCP server
237
+
238
+ > Introduced in v0.3, expanded to 7 tools through v1.4.
239
+
240
+ Start the MCP server on stdio:
241
+
242
+ ```bash
243
+ node gen-context.js --mcp
244
+ ```
245
+
246
+ ### Available tools
247
+
248
+ | Tool | Input | Output |
249
+ |---|---|---|
250
+ | `read_context` | `{ module?: string }` | Signatures for one module or entire codebase |
251
+ | `search_signatures` | `{ query: string }` | Matching signatures with file paths |
252
+ | `get_map` | `{ type: "imports"\|"classes"\|"routes" }` | Structural section from `PROJECT_MAP.md` |
253
+ | `explain_file` | `{ path: string }` | Signatures + imports + reverse callers for one file |
254
+ | `list_modules` | โ€” | Token-count table of all top-level module directories |
255
+ | `create_checkpoint` | `{ summary: string }` | Write a session checkpoint to `.context/` |
256
+ | `get_routing` | โ€” | Full model routing table |
257
+
258
+ Reads files on every call โ€” no stale state, no restart needed.
259
+
260
+ ๐Ÿ“– Setup guide: [docs/MCP_SETUP.md](docs/MCP_SETUP.md)
261
+
262
+ ---
263
+
264
+ ## โš™๏ธ CLI reference
265
+
266
+ > All flags live in v1.5. See [CHANGELOG.md](CHANGELOG.md) for when each shipped.
267
+
268
+ ```
269
+ node gen-context.js Generate once and exit
270
+ node gen-context.js --watch Generate and watch for file changes
271
+ node gen-context.js --setup Generate + install git hook + start watcher
272
+ node gen-context.js --diff Generate context for git-changed files only
273
+ node gen-context.js --diff --staged Staged files only (pre-commit check)
274
+ node gen-context.js --mcp Start MCP server on stdio
275
+
276
+ node gen-context.js --report Token reduction stats
277
+ node gen-context.js --report --json Structured JSON report (exits 1 if over budget)
278
+ node gen-context.js --report --history Usage log summary
279
+ node gen-context.js --report --history --json Usage history as JSON
280
+
281
+ node gen-context.js --health Composite health score (0โ€“100, grade Aโ€“D)
282
+ node gen-context.js --health --json Machine-readable health JSON
283
+
284
+ node gen-context.js --suggest-tool "<task>" Recommend model tier for a task
285
+ node gen-context.js --suggest-tool "<task>" --json Machine-readable tier recommendation
286
+
287
+ node gen-context.js --monorepo Per-package context for monorepos
288
+ node gen-context.js --routing Include model routing hints in output
289
+ node gen-context.js --format cache Write Anthropic prompt-cache JSON
290
+ node gen-context.js --track Append run metrics to .context/usage.ndjson
291
+
292
+ node gen-context.js --init Write config + .contextignore scaffold
293
+ node gen-context.js --version Version string
294
+ node gen-context.js --help Usage information
295
+ ```
296
+
297
+ ### Task classification โ€” `--suggest-tool`
298
+
299
+ ```bash
300
+ node gen-context.js --suggest-tool "security audit of the auth module"
301
+ # tier : powerful
302
+ # models : claude-opus-4-6, gpt-5-4, gemini-2-5-pro
303
+
304
+ node gen-context.js --suggest-tool "fix a typo in the yaml config" --json
305
+ # {"tier":"fast","label":"Fast (low-cost)","models":"claude-haiku-4-5, ...","costHint":"~$0.0008 / 1K tokens"}
306
+ ```
307
+
308
+ Tiers: `fast` (config/markup/typos) ยท `balanced` (features/tests/debug) ยท `powerful` (architecture/security/multi-file)
309
+
310
+ ---
311
+
312
+ ## ๐Ÿ”’ Security scanning
313
+
314
+ SigMap automatically redacts secrets from all extracted signatures. Ten patterns are checked on every file:
315
+
316
+ | Pattern | Example match |
317
+ |---|---|
318
+ | AWS Access Key | `AKIA...` |
319
+ | AWS Secret Key | 40-char base64 |
320
+ | GCP API Key | `AIza...` |
321
+ | GitHub Token | `ghp_...` `gho_...` |
322
+ | JWT | `eyJ...` |
323
+ | DB Connection String | `postgres://user:pass@...` |
324
+ | SSH Private Key | `-----BEGIN ... PRIVATE KEY-----` |
325
+ | Stripe Key | `sk_live_...` `sk_test_...` |
326
+ | Twilio Key | `SK[32 hex chars]` |
327
+ | Generic secret | `password = "..."`, `api_key: "..."` |
328
+
329
+ If a match is found, the signature is replaced with `[REDACTED โ€” {pattern} detected in {file}]`. The run continues โ€” no silent failures.
330
+
331
+ ---
332
+
333
+ ## โš™๏ธ Configuration
334
+
335
+ Copy `gen-context.config.json.example` to `gen-context.config.json`:
336
+
337
+ ```json
338
+ {
339
+ "srcDirs": ["src", "app", "lib"],
340
+ "maxTokens": 6000,
341
+ "outputs": ["copilot"],
342
+ "secretScan": true,
343
+ "strategy": "full",
344
+ "watchDebounce": 300,
345
+ "tracking": false
346
+ }
347
+ ```
348
+
349
+ Exclusions go in `.contextignore` (gitignore syntax). Also reads `.repomixignore` if present.
350
+
351
+ ```
352
+ # .contextignore
353
+ node_modules/
354
+ dist/
355
+ build/
356
+ *.generated.*
357
+ test/fixtures/
358
+ ```
359
+
360
+ Run `node gen-context.js --init` to scaffold both files in one step.
361
+
362
+ ### Output targets
363
+
364
+ | Key | Output file | Read by |
365
+ |---|---|---|
366
+ | `"copilot"` | `.github/copilot-instructions.md` | GitHub Copilot |
367
+ | `"claude"` | `CLAUDE.md` (appends below marker) | Claude Code |
368
+ | `"cursor"` | `.cursorrules` | Cursor |
369
+ | `"windsurf"` | `.windsurfrules` | Windsurf |
370
+
371
+ ---
372
+
373
+ ## ๐Ÿ“Š Observability
374
+
375
+ ```bash
376
+ # Append run metrics to .context/usage.ndjson
377
+ node gen-context.js --track
378
+
379
+ # Structured JSON report for CI (exits 1 if over budget)
380
+ node gen-context.js --report --json
381
+ # { "version": "1.5.0", "finalTokens": 3200, "reductionPct": 92.4, "overBudget": false }
382
+
383
+ # Composite health score
384
+ node gen-context.js --health
385
+ # score: 95/100 (grade A) | reduction: 91.2% | 1 day since regen | 47 runs
386
+ ```
387
+
388
+ ### Self-healing CI
389
+
390
+ Copy `examples/self-healing-github-action.yml` to `.github/workflows/` to auto-regenerate context when:
391
+ - Context file is more than 7 days old (always active)
392
+ - Copilot acceptance rate drops below 30% (requires `COPILOT_API_TOKEN` โ€” GitHub Enterprise)
393
+
394
+ ```yaml
395
+ - name: SigMap health check
396
+ run: node gen-context.js --health --json
397
+ - name: Regenerate context
398
+ run: node gen-context.js
399
+ ```
400
+
401
+ ๐Ÿ“– Full guide: [docs/ENTERPRISE_SETUP.md](docs/ENTERPRISE_SETUP.md)
402
+
403
+ ### Prompt caching โ€” 60% API cost reduction
404
+
405
+ ```bash
406
+ node gen-context.js --format cache
407
+ # Writes: .github/copilot-instructions.cache.json
408
+ # Format: { type: 'text', text: '...', cache_control: { type: 'ephemeral' } }
409
+ ```
410
+
411
+ ๐Ÿ“– Full guide: [docs/REPOMIX_CACHE.md](docs/REPOMIX_CACHE.md)
412
+
413
+ ---
414
+
415
+ ## ๐Ÿงช Testing
416
+
417
+ ```bash
418
+ # All 21 language extractors
419
+ node test/run.js
420
+
421
+ # Single language
422
+ node test/run.js typescript
423
+
424
+ # Regenerate expected outputs after extractor changes
425
+ node test/run.js --update
426
+
427
+ # Full integration suite (253 tests across 16 test files)
428
+ for f in test/integration/*.test.js; do node "$f"; done
429
+ ```
430
+
431
+ ### Validation gates
432
+
433
+ ```bash
434
+ # Gate 1 โ€” all tests pass
435
+ node test/run.js
436
+ # Expected: 21/21 PASS
437
+
438
+ # Gate 2 โ€” zero external dependencies
439
+ grep "require(" gen-context.js | grep -v "^.*//.*require"
440
+ # Expected: only fs, path, assert, os, crypto, child_process, readline
441
+
442
+ # Gate 3 โ€” MCP server responds correctly
443
+ echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | node gen-context.js --mcp
444
+ # Expected: valid JSON with 7 tools
445
+
446
+ # Gate 4 โ€” npm artifact is clean
447
+ npm pack --dry-run
448
+ # Expected: no test/, docs/, vscode-extension/ in output
449
+ ```
450
+
451
+ ---
452
+
453
+ ## ๐Ÿ“ Project structure
454
+
455
+ ```
456
+ sigmap/
457
+ โ”‚
458
+ โ”œโ”€โ”€ gen-context.js โ† PRIMARY ENTRY POINT โ€” single file, zero deps
459
+ โ”œโ”€โ”€ gen-project-map.js โ† import graph, class hierarchy, route table
460
+ โ”‚
461
+ โ”œโ”€โ”€ src/
462
+ โ”‚ โ”œโ”€โ”€ extractors/ โ† 21 language extractors (one file per language)
463
+ โ”‚ โ”œโ”€โ”€ mcp/ โ† MCP stdio server โ€” 7 tools
464
+ โ”‚ โ”œโ”€โ”€ security/ โ† secret scanner โ€” 10 patterns
465
+ โ”‚ โ”œโ”€โ”€ routing/ โ† model routing hints
466
+ โ”‚ โ”œโ”€โ”€ tracking/ โ† NDJSON usage logger
467
+ โ”‚ โ”œโ”€โ”€ health/ โ† composite health scorer
468
+ โ”‚ โ”œโ”€โ”€ format/ โ† Anthropic prompt-cache formatter
469
+ โ”‚ โ””โ”€โ”€ config/ โ† config loader + defaults
470
+ โ”‚
471
+ โ”œโ”€โ”€ vscode-extension/ โ† VS Code extension (v1.5)
472
+ โ”‚ โ”œโ”€โ”€ package.json โ† manifest โ€” commands, settings, activation
473
+ โ”‚ โ””โ”€โ”€ src/extension.js โ† status bar, stale notification, commands
474
+ โ”‚
475
+ โ”œโ”€โ”€ test/
476
+ โ”‚ โ”œโ”€โ”€ fixtures/ โ† one source file per language
477
+ โ”‚ โ”œโ”€โ”€ expected/ โ† expected extractor output
478
+ โ”‚ โ”œโ”€โ”€ run.js โ† zero-dep test runner
479
+ โ”‚ โ””โ”€โ”€ integration/ โ† 16 integration test files (253 tests)
480
+ โ”‚
481
+ โ”œโ”€โ”€ docs/ โ† documentation site (GitHub Pages)
482
+ โ”‚ โ”œโ”€โ”€ index.html โ† homepage
483
+ โ”‚ โ”œโ”€โ”€ quick-start.html
484
+ โ”‚ โ”œโ”€โ”€ strategies.html
485
+ โ”‚ โ”œโ”€โ”€ languages.html
486
+ โ”‚ โ”œโ”€โ”€ roadmap.html
487
+ โ”‚ โ””โ”€โ”€ repomix.html
488
+ โ”‚
489
+ โ”œโ”€โ”€ scripts/
490
+ โ”‚ โ”œโ”€โ”€ ci-update.sh โ† CI pipeline helper
491
+ โ”‚ โ””โ”€โ”€ inject-search.py โ† one-time: add search to docs HTML pages
492
+ โ”‚
493
+ โ”œโ”€โ”€ examples/
494
+ โ”‚ โ”œโ”€โ”€ self-healing-github-action.yml
495
+ โ”‚ โ””โ”€โ”€ gen-context.config.json โ† full annotated config
496
+ โ”‚
497
+ โ”œโ”€โ”€ .npmignore โ† excludes docs/, test/, vscode-extension/ from publish
498
+ โ”œโ”€โ”€ .contextignore.example โ† exclusion template
499
+ โ””โ”€โ”€ gen-context.config.json.example โ† annotated config reference
500
+ ```
501
+
502
+ ---
503
+
504
+ ## ๐Ÿ— Principles
505
+
506
+ | Principle | Implementation |
507
+ |---|---|
508
+ | **Zero npm dependencies** | `node gen-context.js` on a blank machine with Node 18+ โ€” nothing else required |
509
+ | **Never throw** | All extractors return `[]` on any error โ€” the run always completes |
510
+ | **Deterministic** | No AI or LLM involved in extraction โ€” only regex + Node built-ins |
511
+ | **Repomix is a companion** | Use both tools; SigMap never replaces Repomix |
512
+ | **No telemetry** | Never phones home; all state is files in your repo |
513
+ | **Local-first** | No cloud service, no database, no accounts |
514
+
515
+ ---
516
+
517
+ ## ๐Ÿ“ฆ Publishing to npm
518
+
519
+ Releases are published automatically via GitHub Actions whenever a version tag is pushed.
520
+
521
+ ### One-time setup
522
+
523
+ 1. **Create an npm account** at [npmjs.com](https://www.npmjs.com) (if you haven't already).
524
+
525
+ 2. **Generate an npm access token**:
526
+ - npmjs.com โ†’ Account โ†’ Access Tokens โ†’ Generate New Token โ†’ **Granular Access Token** (or Classic Automation token)
527
+ - Scope: `sigmap` package, permission: **Read and Write**
528
+
529
+ 3. **Add the secret to GitHub**:
530
+ ```
531
+ GitHub repo โ†’ Settings โ†’ Secrets and variables โ†’ Actions โ†’ New repository secret
532
+ Name: NPM_TOKEN
533
+ Value: <paste token>
534
+ ```
535
+
536
+ ### Releasing a new version
537
+
538
+ ```bash
539
+ # 1. Bump version in package.json
540
+ npm version patch # or minor / major
541
+
542
+ # 2. Push the commit AND the new tag
543
+ git push && git push --tags
544
+ ```
545
+
546
+ The [npm-publish workflow](.github/workflows/npm-publish.yml) will:
547
+ 1. Run the full test suite
548
+ 2. Verify `package.json` version matches the pushed tag
549
+ 3. Publish to npm with provenance attestation
550
+ 4. Create a GitHub Release with auto-generated notes
551
+
552
+ ### Backfilling historical versions
553
+
554
+ Tags that existed before the workflow was set up can be published retroactively:
555
+
556
+ ```bash
557
+ # Dry run first โ€” see what would be published
558
+ ./scripts/backfill-npm.sh
559
+
560
+ # Actually publish all historical tags
561
+ export NPM_TOKEN=npm_xxxxxxxxxxxx
562
+ ./scripts/backfill-npm.sh --publish
563
+
564
+ # Start from a specific tag
565
+ ./scripts/backfill-npm.sh --publish --from v0.5.0
566
+ ```
567
+
568
+ 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.
569
+
570
+ ---
571
+
572
+ ## ๐Ÿค Contributing
573
+
574
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for how to add a language extractor or new feature.
575
+
576
+ Every extractor follows the same contract:
577
+
578
+ ```javascript
579
+ module.exports = { extract };
580
+ function extract(src) { // src: string โ†’ string[]
581
+ if (!src || typeof src !== 'string') return [];
582
+ // ... regex extraction only โ€” no external dependencies ...
583
+ return sigs.slice(0, 25); // never more than 25 signatures per file
584
+ }
585
+ ```
586
+
587
+ ---
588
+
589
+ ## ๐Ÿ“„ License
590
+
591
+ MIT ยฉ 2026 [Manoj Mallick](https://github.com/manojmallick)
592
+
593
+ ---
594
+
595
+ <div align="center">
596
+
597
+ If SigMap saves you time โ€” a โญ on [GitHub](https://github.com/manojmallick/sigmap) helps others find it.
598
+
599
+ **[Docs](https://manojmallick.github.io/sigmap) ยท [Changelog](CHANGELOG.md) ยท [Roadmap](docs/roadmap.html) ยท [Repomix](https://github.com/yamadashy/repomix)**
600
+
601
+ </div>
@@ -0,0 +1,40 @@
1
+ {
2
+ "_comment": "ContextForge configuration โ€” all keys are optional (defaults shown)",
3
+
4
+ "output": ".github/copilot-instructions.md",
5
+
6
+ "outputs": ["copilot"],
7
+
8
+ "srcDirs": ["src", "app", "lib", "packages", "services", "api"],
9
+
10
+ "exclude": [
11
+ "node_modules", ".git", "dist", "build", "out",
12
+ "__pycache__", ".next", "coverage", "target", "vendor",
13
+ ".context"
14
+ ],
15
+
16
+ "maxDepth": 6,
17
+
18
+ "maxSigsPerFile": 25,
19
+
20
+ "maxTokens": 6000,
21
+
22
+ "secretScan": true,
23
+
24
+ "monorepo": false,
25
+
26
+ "diffPriority": true,
27
+
28
+ "mcp": {
29
+ "autoRegister": true
30
+ },
31
+
32
+ "_strategy_comment": "Context output strategy. Options: 'full' | 'per-module' | 'hot-cold'",
33
+ "_strategy_full": " full โ€” single file, all signatures, always injected (default)",
34
+ "_strategy_per_module": " per-module โ€” one .github/context-<module>.md per srcDir + thin overview",
35
+ "_strategy_hot_cold": " hot-cold โ€” recently changed files injected; rest in context-cold.md (MCP)",
36
+ "strategy": "full",
37
+
38
+ "_hotCommits_comment": "Only used by hot-cold strategy: how many recent commits count as 'hot'",
39
+ "hotCommits": 10
40
+ }