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.
- package/.contextignore.example +34 -0
- package/CHANGELOG.md +402 -0
- package/LICENSE +21 -0
- package/README.md +601 -0
- package/gen-context.config.json.example +40 -0
- package/gen-context.js +4316 -0
- package/gen-project-map.js +172 -0
- package/package.json +67 -0
- package/src/config/defaults.js +61 -0
- package/src/config/loader.js +60 -0
- package/src/extractors/cpp.js +60 -0
- package/src/extractors/csharp.js +48 -0
- package/src/extractors/css.js +51 -0
- package/src/extractors/dart.js +58 -0
- package/src/extractors/dockerfile.js +49 -0
- package/src/extractors/go.js +61 -0
- package/src/extractors/html.js +39 -0
- package/src/extractors/java.js +49 -0
- package/src/extractors/javascript.js +82 -0
- package/src/extractors/kotlin.js +62 -0
- package/src/extractors/php.js +62 -0
- package/src/extractors/python.js +69 -0
- package/src/extractors/ruby.js +43 -0
- package/src/extractors/rust.js +72 -0
- package/src/extractors/scala.js +67 -0
- package/src/extractors/shell.js +43 -0
- package/src/extractors/svelte.js +51 -0
- package/src/extractors/swift.js +63 -0
- package/src/extractors/typescript.js +109 -0
- package/src/extractors/vue.js +66 -0
- package/src/extractors/yaml.js +59 -0
- package/src/format/cache.js +53 -0
- package/src/health/scorer.js +123 -0
- package/src/map/class-hierarchy.js +117 -0
- package/src/map/import-graph.js +148 -0
- package/src/map/route-table.js +127 -0
- package/src/mcp/handlers.js +433 -0
- package/src/mcp/server.js +128 -0
- package/src/mcp/tools.js +125 -0
- package/src/routing/classifier.js +102 -0
- package/src/routing/hints.js +103 -0
- package/src/security/patterns.js +51 -0
- package/src/security/scanner.js +36 -0
- package/src/tracking/logger.js +115 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# .contextignore — ContextForge exclusion file (gitignore syntax)
|
|
2
|
+
# Patterns here are unioned with .repomixignore if present.
|
|
3
|
+
# Lines starting with # are comments.
|
|
4
|
+
|
|
5
|
+
# Build outputs
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
out/
|
|
9
|
+
.next/
|
|
10
|
+
.nuxt/
|
|
11
|
+
|
|
12
|
+
# Dependencies
|
|
13
|
+
node_modules/
|
|
14
|
+
vendor/
|
|
15
|
+
target/
|
|
16
|
+
|
|
17
|
+
# Generated files
|
|
18
|
+
*.generated.*
|
|
19
|
+
*.pb.go
|
|
20
|
+
*_pb.py
|
|
21
|
+
coverage/
|
|
22
|
+
|
|
23
|
+
# Test snapshots (keep test code, drop snapshots)
|
|
24
|
+
**/__snapshots__/
|
|
25
|
+
|
|
26
|
+
# Large data files
|
|
27
|
+
*.csv
|
|
28
|
+
*.sql
|
|
29
|
+
*.parquet
|
|
30
|
+
|
|
31
|
+
# IDE
|
|
32
|
+
.idea/
|
|
33
|
+
.vscode/
|
|
34
|
+
*.suo
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to SigMap are documented here.
|
|
4
|
+
|
|
5
|
+
Format: [Semantic Versioning](https://semver.org/)
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## [1.5.0] — 2026-04-04
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **VS Code extension** (`vscode-extension/`) — zero-dependency extension for VS Code / VS Code-compatible editors:
|
|
13
|
+
- **Status bar item** — shows health grade (A/B/C/D) and time since last regeneration; refreshes every 60 s and immediately on file-system change to `copilot-instructions.md`.
|
|
14
|
+
- **`SigMap: Regenerate Context`** command — runs `node gen-context.js` in an integrated terminal from the workspace root.
|
|
15
|
+
- **`SigMap: Open Context File`** command — opens `.github/copilot-instructions.md` in the editor.
|
|
16
|
+
- **Stale context notification** — warns when `copilot-instructions.md` is > 24 h old; offers one-click regeneration or "Don't show again" suppression per workspace.
|
|
17
|
+
- **`contextforge.scriptPath` setting** — override the path to `gen-context.js` when it is not at the project root.
|
|
18
|
+
- `onStartupFinished` activation — loads within 3 s of VS Code opening, does not block startup.
|
|
19
|
+
- **Docs site search** — lightweight client-side keyword search added to all 6 HTML docs pages (`index.html`, `quick-start.html`, `strategies.html`, `languages.html`, `roadmap.html`, `repomix.html`):
|
|
20
|
+
- Press `/` anywhere to open the search overlay; `Escape` or click outside to close.
|
|
21
|
+
- Searches all headings, paragraphs, and list items in the current page.
|
|
22
|
+
- Up to 12 results shown with snippet preview; matching text highlighted in amber.
|
|
23
|
+
- Click a result to scroll to the exact section with a 2-second amber outline highlight.
|
|
24
|
+
- Zero external dependencies — ~60 lines of inline JS per page. Theme-aware (dark/light).
|
|
25
|
+
- **`.npmignore`** — excludes `test/`, `docs/`, `scripts/`, `examples/`, `.claude/`, `vscode-extension/`, `.github/workflows/` and planning docs from npm publish. Published package contains only the runtime files listed in `package.json#files`.
|
|
26
|
+
- **`test/integration/v1.5.test.js`** — 58 integration tests covering all v1.5 features:
|
|
27
|
+
- npm package integrity (name, bin, engines, zero deps, .npmignore exclusions)
|
|
28
|
+
- shebang line presence and correctness
|
|
29
|
+
- extension manifest structure (commands, configuration, activation)
|
|
30
|
+
- extension.js API coverage (status bar, notification, commands, scriptPath)
|
|
31
|
+
- search injection verified in all 6 docs pages (overlay, input, keyboard handlers, highlights)
|
|
32
|
+
|
|
33
|
+
### Notes
|
|
34
|
+
- The VS Code extension requires the `vscode` peer dependency at runtime (provided by the editor). It has no npm runtime dependencies of its own.
|
|
35
|
+
- `scripts/inject-search.py` is the one-time migration script used to add search to existing HTML pages; it is idempotent (skip if already patched).
|
|
36
|
+
|
|
37
|
+
### Validation gate
|
|
38
|
+
- `node gen-context.js --version` → `1.5.0` ✔ *(note: version bumped separately if desired)*
|
|
39
|
+
- `node test/integration/v1.5.test.js` → 58/58 pass ✔
|
|
40
|
+
- `node test/run.js` → 21/21 extractor tests pass ✔
|
|
41
|
+
- `npm pack --dry-run` → no `test/`, `docs/`, or `vscode-extension/` in artifact ✔
|
|
42
|
+
- All 6 docs pages: press `/` → search overlay opens; type "python" → result appears ✔
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## [1.4.0] — 2026-04-04
|
|
47
|
+
|
|
48
|
+
### Added
|
|
49
|
+
- **`explain_file` MCP tool** — deep-dive tool for a single file. Given a relative path, returns three sections: `## Signatures` (from the indexed context file), `## Imports` (resolved relative dependencies from the live source file), and `## Callers` (reverse import lookup across all indexed files). Gracefully returns partial output if the file is not on disk.
|
|
50
|
+
- **`list_modules` MCP tool** — returns a markdown table listing all top-level module directories found in the context file, sorted by token count descending, with columns: `Module | Files | Tokens`. Helps agents pick the right `module` arg for `read_context`.
|
|
51
|
+
- **Strategy-aware health scorer** — `src/health/scorer.js` and `--health` display now read `gen-context.config.json` and adjust the low-reduction penalty threshold by strategy:
|
|
52
|
+
- `full` (default): 60% reduction threshold — unchanged behaviour.
|
|
53
|
+
- `hot-cold` / `per-module`: reduction penalty disabled — intentionally small hot outputs are not penalised.
|
|
54
|
+
- `hot-cold` only: adds a `context-cold.md` freshness check (`strategyFreshnessDays`). If the cold context file is >1 day stale, up to 10 pts are deducted.
|
|
55
|
+
- **New `--health` output fields** — `strategy:` line always visible; `cold freshness:` line shown for `hot-cold` strategy.
|
|
56
|
+
- **`test/integration/mcp-v14.test.js`** — 13 integration tests covering `explain_file` and `list_modules`:
|
|
57
|
+
- 7-tool count verification
|
|
58
|
+
- Signature extraction from index
|
|
59
|
+
- Imports and Callers sections (file on disk)
|
|
60
|
+
- Graceful error for unknown path, missing arg, no context file
|
|
61
|
+
- Token count and table structure in `list_modules`
|
|
62
|
+
- Multi-call session combining both new tools
|
|
63
|
+
- **`test/integration/observability.test.js`** — 12 new unit tests for strategy-aware scorer:
|
|
64
|
+
- `strategy` field in all return objects
|
|
65
|
+
- No reduction penalty for `hot-cold` and `per-module`
|
|
66
|
+
- Reduction penalty still applied for `full`
|
|
67
|
+
- `strategyFreshnessDays` null/populated correctly
|
|
68
|
+
- Grade A for a fresh, untracked project
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
- Health scorer: projects with **zero tracking history** (brand-new or never run with `--track`) are no longer penalised for "0% reduction". `tokenReductionPct` is only set when `totalRuns > 0`.
|
|
72
|
+
|
|
73
|
+
### Changed
|
|
74
|
+
- MCP server now exposes **7 tools** (was 5 before v1.3, 5 in v1.3). `tools/list` assertion updated in `mcp-server.test.js`.
|
|
75
|
+
- `gen-context.js` VERSION bumped to `1.4.0`
|
|
76
|
+
- MCP server `SERVER_INFO.version` bumped to `1.4.0`
|
|
77
|
+
- `package.json` version bumped to `1.4.0`
|
|
78
|
+
|
|
79
|
+
### Validation gate
|
|
80
|
+
- `node gen-context.js --version` → `1.4.0` ✔
|
|
81
|
+
- `echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | node gen-context.js --mcp` → 7 tools ✔
|
|
82
|
+
- `node test/integration/mcp-v14.test.js` → 13/13 pass ✔
|
|
83
|
+
- `node test/integration/observability.test.js` → 35/35 pass ✔
|
|
84
|
+
- `node test/integration/mcp-server.test.js` → 16/16 pass ✔
|
|
85
|
+
- `node test/run.js` → 21/21 extractor tests pass ✔
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Added
|
|
92
|
+
- **`--diff` CLI flag** — generates context only for files changed in the current git working tree (`git diff HEAD --name-only`). Useful in CI and pre-review workflows where you only want signatures for files you've touched.
|
|
93
|
+
- **`--diff --staged` variant** — restricts context to files in the git staging area only (`git diff --cached --name-only`). Ideal as a pre-commit check.
|
|
94
|
+
- **Smart fallback** — both `--diff` modes automatically fall back to a full `runGenerate` when: outside a git repo, no changed files, or all changed files are outside tracked `srcDirs`. No silent failures.
|
|
95
|
+
- **`--diff --report`** — when both flags are used together, prints a side-by-side comparison of diff-mode vs full-mode token counts and savings.
|
|
96
|
+
- **`watchDebounce` config key** — new key in `gen-context.config.json` (default: `300`) controls the debounce delay (ms) between file-system events and regeneration in watch mode. Configurable per project.
|
|
97
|
+
- **`test/integration/diff.test.js`** — 6 integration tests covering all diff-mode scenarios:
|
|
98
|
+
- Diff-only output excludes unchanged files
|
|
99
|
+
- `--staged` excludes unstaged modifications
|
|
100
|
+
- Empty diff fallback to full generate
|
|
101
|
+
- Non-git-repo fallback
|
|
102
|
+
- Changed files outside srcDirs fallback
|
|
103
|
+
- Multiple changed files all appear in output
|
|
104
|
+
|
|
105
|
+
### Changed
|
|
106
|
+
- Watch mode debounce reduced from **500 ms → 300 ms** (default). Now reads `config.watchDebounce || 300` — fully configurable.
|
|
107
|
+
- `gen-context.js` VERSION bumped to `1.3.0`
|
|
108
|
+
- MCP server version bumped to `1.3.0`
|
|
109
|
+
- `package.json` version bumped to `1.3.0`
|
|
110
|
+
- `src/config/defaults.js` — added `watchDebounce: 300` key
|
|
111
|
+
|
|
112
|
+
### Validation gate
|
|
113
|
+
- `node gen-context.js --version` → `1.3.0` ✔
|
|
114
|
+
- `node gen-context.js --diff` on a repo with changes → output contains only changed-file sigs ✔
|
|
115
|
+
- `node gen-context.js --diff --staged` → output contains only staged-file sigs ✔
|
|
116
|
+
- `node test/integration/diff.test.js` → 6/6 pass ✔
|
|
117
|
+
- `node test/run.js` → 21/21 extractor tests pass ✔
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## [1.2.0] — 2026-04-02
|
|
122
|
+
|
|
123
|
+
### Added
|
|
124
|
+
- **`--init` now scaffolds `.contextignore`** alongside `gen-context.config.json`. Running `node gen-context.js --init` on a fresh project creates both files. `.contextignore` is pre-populated with sensible defaults (`node_modules/`, `dist/`, `build/`, `*.generated.*`, etc.). Safe to re-run — existing files are never overwritten.
|
|
125
|
+
- **`test/integration/strategy.test.js`** — 9 integration tests covering `per-module` and `hot-cold` strategies:
|
|
126
|
+
- `per-module`: asserts one `context-<module>.md` per `srcDir`, overview file references all modules, cross-module signature isolation
|
|
127
|
+
- `hot-cold`: asserts `context-cold.md` is created, primary output contains only hot files, `hotCommits` config controls the boundary
|
|
128
|
+
- Both strategies: fallback behaviour when `srcDir` is missing or repo has no git history
|
|
129
|
+
- **`sigmap` npm binary alias** — `package.json` `bin` now exposes both `gen-context` (existing) and `sigmap` (new alias), making `npx sigmap` work ahead of full npm publish in v1.5
|
|
130
|
+
- **`--diff` and `--diff --staged` listed in `--help`** — help text documents the upcoming flags so tooling auto-complete picks them up
|
|
131
|
+
|
|
132
|
+
### Changed
|
|
133
|
+
- `package.json` version bumped to `1.1.0` (syncs with already-shipped v1.1 strategy features)
|
|
134
|
+
- `gen-context.js` `VERSION` constant bumped to `1.1.0`
|
|
135
|
+
- `src/mcp/server.js` `SERVER_INFO.version` bumped to `1.1.0`
|
|
136
|
+
- `--init` no longer exits early when config already exists — it still skips writing config but continues to check / write `.contextignore`
|
|
137
|
+
- `keywords` in `package.json` expanded: added `token-reduction`, `code-signatures`
|
|
138
|
+
|
|
139
|
+
### Validation gate
|
|
140
|
+
- `node gen-context.js --version` → `1.1.0` ✔
|
|
141
|
+
- `cat package.json | grep version` → `"version": "1.1.0"` ✔
|
|
142
|
+
- `node gen-context.js --init` on a fresh dir → both `gen-context.config.json` and `.contextignore` created ✔
|
|
143
|
+
- `node test/integration/strategy.test.js` → all 9 tests pass ✔
|
|
144
|
+
- `node test/run.js` → 21/21 extractor tests pass ✔
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## [1.1.0] — 2026-04-01
|
|
149
|
+
|
|
150
|
+
### Added
|
|
151
|
+
- **Context strategies** — new `"strategy"` config key with three options:
|
|
152
|
+
- `"full"` (default) — existing behaviour, single output file, all signatures
|
|
153
|
+
- `"per-module"` — one `.github/context-<module>.md` per top-level `srcDir` plus a
|
|
154
|
+
thin always-injected overview table (~100–300 tokens); ~70% fewer injected tokens
|
|
155
|
+
per question with zero context loss; no MCP required
|
|
156
|
+
- `"hot-cold"` — recently committed files auto-injected as usual; all other files
|
|
157
|
+
written to `.github/context-cold.md` for MCP on-demand retrieval; ~90% fewer
|
|
158
|
+
always-injected tokens; best with Claude Code / Cursor MCP enabled
|
|
159
|
+
- **`"hotCommits"`** config key — controls how many recent git commits count as "hot"
|
|
160
|
+
for the `hot-cold` strategy (default: 10)
|
|
161
|
+
- **`docs/CONTEXT_STRATEGIES.md`** — comprehensive strategy guide: decision tree,
|
|
162
|
+
four worked-scenario comparisons (fix-a-bug, cross-module question, daily dev,
|
|
163
|
+
onboarding), full configuration reference, migration guide, and feature-compatibility
|
|
164
|
+
matrix
|
|
165
|
+
- README: new "Context strategies" section with inline examples linking to full guide
|
|
166
|
+
- `gen-context.config.json.example`: `strategy` and `hotCommits` keys with comments
|
|
167
|
+
|
|
168
|
+
### Changed
|
|
169
|
+
- `gen-context.js` version remains `1.0.0`; `runGenerate` now dispatches to
|
|
170
|
+
`runPerModuleStrategy` or `runHotColdStrategy` based on `config.strategy`
|
|
171
|
+
- `getRecentlyCommittedFiles(cwd, count)` now accepts a count parameter so
|
|
172
|
+
`hotCommits` is respected
|
|
173
|
+
- `--help` text updated with strategy descriptions
|
|
174
|
+
|
|
175
|
+
### Validation gate
|
|
176
|
+
- `strategy: per-module` on arbi-platform: `3 modules, overview ~117 tokens, total ~4,058 tokens`
|
|
177
|
+
- `strategy: hot-cold` on arbi-platform: `79 hot files ~3,700 tokens, 1 cold ~363 tokens`
|
|
178
|
+
- `strategy: full` unchanged: `80 files, ~3,980 tokens, 94.9% reduction`
|
|
179
|
+
- All 21 checks pass post-deployment
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## [1.0.0] — 2026-04-01
|
|
184
|
+
|
|
185
|
+
### Added
|
|
186
|
+
- **Self-healing CI** — `examples/self-healing-github-action.yml`: weekly cron workflow that queries the GitHub Enterprise Copilot API for acceptance rate; automatically opens a PR with regenerated context when rate drops below threshold (default 30%) or context file is stale (> 7 days); falls back to staleness check when no API token is configured
|
|
187
|
+
- **`scripts/ci-update.sh`** — CI helper script: `--fail-over-budget` (exits 1 if output tokens exceed budget), `--track`, `--format cache`; designed for required CI pipeline steps
|
|
188
|
+
- **`--suggest-tool "<task>"`** — recommends a model tier (fast / balanced / powerful) from a free-text task description using keyword matching against `src/routing/hints.js` TIERS; `--json` variant returns machine-readable `{ tier, label, models, costHint }` for IDE integrations
|
|
189
|
+
- **`--health`** — composite 0-100 health score derived from: context staleness (days since last regeneration), average token reduction %, and over-budget run rate; letter grade A–D; `--json` variant for dashboards and CI
|
|
190
|
+
- **`src/health/scorer.js`** — zero-dependency health scoring module: `score(cwd)` reads usage log + context file mtime; never throws
|
|
191
|
+
- Integration test: `test/integration/system.test.js` — 15 tests covering suggest-tool (all three tiers, `--json` shape, missing-description guard) and health (`--json` field presence, score range, grade values, run counters)
|
|
192
|
+
|
|
193
|
+
### Changed
|
|
194
|
+
- `gen-context.js` version bumped to `1.0.0`; help text expanded with `--suggest-tool`, `--health`
|
|
195
|
+
- `package.json` version bumped to `1.0.0`
|
|
196
|
+
- `src/mcp/server.js` version bumped to `1.0.0`
|
|
197
|
+
- README updated: v1.0 features section, new CLI reference entries, updated project structure tree
|
|
198
|
+
|
|
199
|
+
### Validation gate
|
|
200
|
+
- 177/177 tests pass (21 extractor + 156 integration)
|
|
201
|
+
- `node gen-context.js --suggest-tool "security audit" ` → tier: powerful
|
|
202
|
+
- `node gen-context.js --health --json` → `{ score, grade, tokenReductionPct, daysSinceRegen, ... }`
|
|
203
|
+
- Self-healing CI workflow validates via `node gen-context.js --health --json` in check job
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## [0.9.0] — 2026-04-01
|
|
208
|
+
|
|
209
|
+
### Added
|
|
210
|
+
- **Enhanced `--report --json`** — structured JSON report now includes `version`, `timestamp`, `overBudget`, and `budgetLimit` fields alongside existing token stats; exits with code `1` when output exceeds `maxTokens` so CI pipelines can fail automatically
|
|
211
|
+
- **`--track` CLI flag** — appends one NDJSON record per run to `.context/usage.ndjson`; also enabled by `"tracking": true` in config
|
|
212
|
+
- **`src/tracking/logger.js`** — zero-dependency append-only log module; exports `logRun(entry, cwd)`, `readLog(cwd)`, and `summarize(entries)`; uses NDJSON (one JSON object per line) compatible with standard Unix tools
|
|
213
|
+
- **`--report --history`** — prints aggregate summary from `.context/usage.ndjson` (total runs, avg reduction %, avg tokens, over-budget count, first/last run timestamps); add `--json` for machine-readable output
|
|
214
|
+
- **`docs/ENTERPRISE_SETUP.md`** — comprehensive enterprise guide: GitHub Enterprise REST API acceptance rate tracking, CI token reporting with Prometheus/Grafana dashboard integration, self-hosted runner configuration, usage log analysis examples
|
|
215
|
+
- `tracking: false` default added to `src/config/defaults.js`
|
|
216
|
+
- Integration test: `test/integration/observability.test.js` — 23 tests covering `logRun`, `readLog`, `summarize`, CLI `--report --json`, `--track`, config-driven tracking, and `--report --history`
|
|
217
|
+
|
|
218
|
+
### Changed
|
|
219
|
+
- `gen-context.js` version bumped to `0.9.0`
|
|
220
|
+
- `package.json` version bumped to `0.9.0`
|
|
221
|
+
- `src/mcp/server.js` version bumped to `0.9.0`
|
|
222
|
+
- `--report` human output now includes `version` and `budget limit` lines
|
|
223
|
+
- README updated: `--track` / `--report --history` in CLI reference, new Observability section, updated project structure tree
|
|
224
|
+
|
|
225
|
+
### Validation gate
|
|
226
|
+
- 162/162 tests pass (21 extractor + 141 integration)
|
|
227
|
+
- `node gen-context.js --report --json` outputs JSON with `version`, `timestamp`, `overBudget`
|
|
228
|
+
- `node gen-context.js --track` writes `.context/usage.ndjson`
|
|
229
|
+
- `node gen-context.js --report --history` prints usage summary
|
|
230
|
+
- `node gen-context.js --report --history --json` outputs valid JSON
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## [0.8.0] — 2026-03-31
|
|
235
|
+
|
|
236
|
+
### Added
|
|
237
|
+
- **`--format cache` CLI flag** — alongside the standard markdown output, writes `.github/copilot-instructions.cache.json`, a single Anthropic content block with `cache_control: { type: "ephemeral" }` ready for direct use in Anthropic API calls
|
|
238
|
+
- **`src/format/cache.js`** — zero-dependency formatter; exports `formatCache(content) → JSON string` (single content block) and `formatCachePayload(content, model) → JSON string` (full messages API payload with system array)
|
|
239
|
+
- **`format: 'default'` config key** — set `"format": "cache"` in `gen-context.config.json` to always write the cache JSON file on every run; default is `'default'` (markdown only)
|
|
240
|
+
- **`docs/REPOMIX_CACHE.md`** — full prompt cache strategy: two-layer design (Repomix as stable cached prefix + SigMap as dynamic segment), cost calculations (~60% reduction), API call examples, CI integration, cache warm-up strategy
|
|
241
|
+
- Integration test: `test/integration/cache.test.js` — 20 tests covering `formatCache()`, `formatCachePayload()`, CLI `--format cache` flag, config-driven mode, and absence of cache file when flag is not set
|
|
242
|
+
|
|
243
|
+
### Changed
|
|
244
|
+
- `gen-context.js` version bumped to `0.8.0`
|
|
245
|
+
- `package.json` version bumped to `0.8.0`
|
|
246
|
+
- README updated: `--format cache` entry in CLI reference, new Prompt Caching section, updated project structure tree
|
|
247
|
+
|
|
248
|
+
### Validation gate
|
|
249
|
+
- 139/139 tests pass (21 extractor + 118 integration)
|
|
250
|
+
- `node gen-context.js --format cache` writes `.github/copilot-instructions.cache.json`
|
|
251
|
+
- Cache JSON has `type: "text"` and `cache_control: { type: "ephemeral" }`
|
|
252
|
+
- `node gen-context.js` without `--format cache` does NOT write cache file
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## [0.7.0] — 2026-03-31
|
|
257
|
+
|
|
258
|
+
### Added
|
|
259
|
+
- **Model routing hints** — classifies every indexed file into `fast`, `balanced`, or `powerful` tier based on path conventions and signature count, then appends a `## Model routing hints` section to the context output
|
|
260
|
+
- **`--routing` CLI flag** — `node gen-context.js --routing` appends routing hints in one pass; set `"routing": true` in config to always include them
|
|
261
|
+
- **`src/routing/classifier.js`** — zero-dependency heuristic classifier (path patterns, sig count, indented method count)
|
|
262
|
+
- **`src/routing/hints.js`** — tier definitions (`TIERS`) and `formatRoutingSection()` formatter
|
|
263
|
+
- **`get_routing` MCP tool** (5th tool) — returns routing hints for the current project on demand; reads context file, classifies files, returns formatted markdown
|
|
264
|
+
- **`docs/MODEL_ROUTING.md`** — full routing guide: tier criteria, task-to-tier decision flow, VS Code / Claude Code / CI integration, cost calculation reference
|
|
265
|
+
- Integration test: `test/integration/routing.test.js` — 25 tests covering classifier unit tests, classifyAll grouping, formatRoutingSection, CLI flag, config flag, and MCP tool
|
|
266
|
+
- `routing: false` default added to `src/config/defaults.js`
|
|
267
|
+
- `src/mcp/server.js` version bumped to `0.7.0`
|
|
268
|
+
|
|
269
|
+
### Changed
|
|
270
|
+
- `tools/list` now returns 5 tools (previously 4) — adds `get_routing`
|
|
271
|
+
|
|
272
|
+
### Validation gate
|
|
273
|
+
- 119/119 tests pass (21 extractor + 98 integration)
|
|
274
|
+
- `node gen-context.js --routing` produces `## Model routing hints` in output
|
|
275
|
+
- `tools/list` returns 5 tools including `get_routing`
|
|
276
|
+
- `get_routing` MCP call returns tier classification for current project
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## [0.6.0] — 2026-03-31
|
|
281
|
+
|
|
282
|
+
### Added
|
|
283
|
+
- **`create_checkpoint` MCP tool** — returns a markdown session snapshot: active branch, last 5 commits, context token count, modules indexed, and route table summary (when `PROJECT_MAP.md` is present)
|
|
284
|
+
- **`examples/copilot-prompts.code-snippets`** — 20 VS Code code snippets with `cf-` prefix covering the full session lifecycle (`cf-start`, `cf-checkpoint`, `cf-end`, `cf-pr`, `cf-debug`, `cf-test`, `cf-search`, `cf-map-*`, and more)
|
|
285
|
+
- **`examples/slack-context-bot.js`** — zero-dependency Node.js script that posts daily context-freshness reminders to a Slack channel via an Incoming Webhook URL; includes branch, recent commit, token count, and a session checklist
|
|
286
|
+
- **`docs/SESSION_DISCIPLINE.md`** — complete session discipline guide: session lifecycle, 30-minute checkpoint cadence, token hygiene table, multi-session workflow, git hook integration, MCP tool reference, and VS Code snippet install instructions
|
|
287
|
+
- `src/mcp/server.js` version bumped to `0.6.0`
|
|
288
|
+
- Integration tests: 5 new tests for `create_checkpoint` in `test/integration/mcp-server.test.js`
|
|
289
|
+
|
|
290
|
+
### Changed
|
|
291
|
+
- `tools/list` now returns 4 tools (previously 3) — `read_context`, `search_signatures`, `get_map`, `create_checkpoint`
|
|
292
|
+
|
|
293
|
+
### Validation gate
|
|
294
|
+
- 94/94 tests pass (21 extractor + 73 integration)
|
|
295
|
+
- `create_checkpoint` MCP tool returns JSON with `# SigMap Checkpoint` header
|
|
296
|
+
- `create_checkpoint` with `note` param includes note in output
|
|
297
|
+
- `tools/list` returns 4 tools including `create_checkpoint`
|
|
298
|
+
- VS Code snippets file has JSON-valid syntax; `cf-` prefix on all 20 snippets
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## [0.5.0] — 2026-03-31
|
|
303
|
+
|
|
304
|
+
### Added
|
|
305
|
+
- `--monorepo` CLI flag — auto-detects packages under `packages/`, `apps/`, `services/`, `libs/` and writes one `CLAUDE.md` per package
|
|
306
|
+
- Manifest detection covers `package.json`, `Cargo.toml`, `go.mod`, `pyproject.toml`, `pom.xml`, `build.gradle`
|
|
307
|
+
- `config.monorepo: true` triggers monorepo mode without the CLI flag
|
|
308
|
+
- **Git-diff priority output ordering** — recently committed files now appear first in the generated output (not just protected from token-budget drops)
|
|
309
|
+
- `examples/github-action.yml` — ready-to-use 4-job CI workflow: SigMap, gen-project-map, Repomix, test suite (Node 18/20/22 matrix)
|
|
310
|
+
- `docs/CI_GUIDE.md` — full CI setup guide, monorepo config, `.contextignore` patterns, token report in CI
|
|
311
|
+
- Integration test: `test/integration/monorepo.test.js` — 8 tests (packages/, apps/, services/, multi-manifest, 5-package smoke)
|
|
312
|
+
- Integration test: `test/integration/contextignore.test.js` — 7 tests (patterns, wildcards, comments, union of both ignore files)
|
|
313
|
+
|
|
314
|
+
### Validation gate
|
|
315
|
+
- 89/89 tests pass (21 extractor + 68 integration)
|
|
316
|
+
- `node gen-context.js --monorepo` writes `CLAUDE.md` per detected package
|
|
317
|
+
- `node gen-context.js --report` confirms git-diff files appear first in output
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
321
|
+
## [0.4.0] — 2026-03-31
|
|
322
|
+
|
|
323
|
+
### Added
|
|
324
|
+
- `gen-project-map.js` — standalone zero-dependency CLI; generates `PROJECT_MAP.md`
|
|
325
|
+
- `src/map/import-graph.js` — static import/require analysis for JS, TS, Python; DFS cycle detection with `⚠` warnings
|
|
326
|
+
- `src/map/class-hierarchy.js` — extracts `extends`/`implements` relationships across TypeScript, JavaScript, Python, Java, Kotlin, C#
|
|
327
|
+
- `src/map/route-table.js` — HTTP route extraction for Express, Fastify, NestJS, Flask, FastAPI, Go (Gin/stdlib), Spring
|
|
328
|
+
- Output: `PROJECT_MAP.md` with `### Import graph`, `### Class hierarchy`, `### Route table` sections (MCP-compatible headers)
|
|
329
|
+
- `gen-project-map.js --version` and `--help` flags
|
|
330
|
+
- Integration test: `test/integration/project-map.test.js` — 12 tests covering all frameworks, circular detection, MCP section extraction
|
|
331
|
+
- `package.json` updated to `v0.4.0`; `gen-project-map` added to `bin`
|
|
332
|
+
|
|
333
|
+
### Validation gate
|
|
334
|
+
- 74/74 tests pass (21 extractor + 53 integration)
|
|
335
|
+
- `node gen-project-map.js` writes `PROJECT_MAP.md` with all three sections
|
|
336
|
+
- MCP `get_map` tool correctly extracts each section by `### ` header
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## [0.3.0] — 2026-03-31
|
|
341
|
+
|
|
342
|
+
### Added
|
|
343
|
+
- `src/mcp/server.js` — stdio JSON-RPC 2.0 MCP server (zero npm dependencies); handles `initialize`, `tools/list`, `tools/call`
|
|
344
|
+
- `src/mcp/tools.js` — 3 tool definitions: `read_context`, `search_signatures`, `get_map`
|
|
345
|
+
- `src/mcp/handlers.js` — tool implementations; reads context files from disk on every call (no in-memory state)
|
|
346
|
+
- `--mcp` CLI flag — starts MCP server on stdio
|
|
347
|
+
- MCP auto-registration in `.claude/settings.json` and `.cursor/mcp.json` via `--setup`
|
|
348
|
+
- `examples/claude-code-settings.json` — pre-configured entry for both SigMap and Repomix MCP servers
|
|
349
|
+
- `docs/MCP_SETUP.md` — full MCP setup guide with both Claude Code and Cursor examples
|
|
350
|
+
- Integration test: `test/integration/mcp-server.test.js` — 11 tests
|
|
351
|
+
|
|
352
|
+
### Tools
|
|
353
|
+
| Tool | Input | Output |
|
|
354
|
+
|------|-------|--------|
|
|
355
|
+
| `read_context` | `{ module?: string }` | All signatures or module-scoped subset |
|
|
356
|
+
| `search_signatures` | `{ query: string }` | Matching signatures with file paths |
|
|
357
|
+
| `get_map` | `{ type: "imports" \| "classes" \| "routes" }` | Section from `PROJECT_MAP.md` |
|
|
358
|
+
|
|
359
|
+
### Validation gate
|
|
360
|
+
- 62/62 tests pass (21 extractor + 41 integration)
|
|
361
|
+
- `echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | node gen-context.js --mcp` returns 3 tools
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## [0.2.0] — 2026-03-31
|
|
366
|
+
|
|
367
|
+
### Added
|
|
368
|
+
- `src/security/patterns.js` — 10 secret detection patterns (AWS, GCP, GitHub, JWT, DB URLs, SSH, Stripe, Twilio, generic key=value)
|
|
369
|
+
- `src/security/scanner.js` — `scan(sigs, filePath) → { safe, redacted }`; never throws; redacts per-file only
|
|
370
|
+
- `src/config/loader.js` — reads and deep-merges `gen-context.config.json` with defaults; warns on unknown keys
|
|
371
|
+
- `src/config/defaults.js` — all config keys documented with defaults
|
|
372
|
+
- Token budget drop order: generated → test → config → least-recently-changed
|
|
373
|
+
- Multi-agent output targets: `copilot`, `claude`, `cursor`, `windsurf`
|
|
374
|
+
- `CLAUDE.md` append strategy — appends below `## Auto-generated signatures` marker; never overwrites human content above
|
|
375
|
+
- `docs/REPOMIX_INTEGRATION.md` — companion tool integration guide
|
|
376
|
+
- Integration tests: `secret-scan.test.js` (12), `config-loader.test.js` (6), `token-budget.test.js` (5), `multi-output.test.js` (7)
|
|
377
|
+
|
|
378
|
+
### Validation gate
|
|
379
|
+
- 51/51 tests pass (21 extractor + 30 integration)
|
|
380
|
+
- Secret in fixture → `[REDACTED — AWS Access Key detected]` in output
|
|
381
|
+
- Output ≤ 6000 tokens on any project over 200 files
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## [0.1.0] — 2026-03-31
|
|
386
|
+
|
|
387
|
+
### Added
|
|
388
|
+
- `gen-context.js` — single-file zero-dependency CLI entry point
|
|
389
|
+
- 21 language extractors: TypeScript, JavaScript, Python, Java, Kotlin, Go, Rust, C#, C/C++, Ruby, PHP, Swift, Dart, Scala, Vue, Svelte, HTML, CSS/SCSS, YAML, Shell, Dockerfile
|
|
390
|
+
- CLI flags: `--generate`, `--watch`, `--setup`, `--report`, `--report --json`, `--init`, `--help`, `--version`
|
|
391
|
+
- `.contextignore` support (gitignore syntax), also reads `.repomixignore`
|
|
392
|
+
- `fs.watch` auto-update with 500ms debounce
|
|
393
|
+
- `post-commit` git hook installer via `--setup`
|
|
394
|
+
- Token budget enforcement with priority drop order
|
|
395
|
+
- `test/run.js` zero-dependency test runner
|
|
396
|
+
- 21 fixture files and expected outputs
|
|
397
|
+
- `gen-context.config.json.example` and `.contextignore.example`
|
|
398
|
+
|
|
399
|
+
### Validation gate
|
|
400
|
+
- 21/21 extractor tests pass
|
|
401
|
+
- Runs on a Node 18 machine with zero npm install
|
|
402
|
+
- Output written to `.github/copilot-instructions.md`
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Manoj Kumar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|