sigmap 6.0.2 → 6.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +1 -1
- package/gen-context.js +68 -3
- package/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/src/learning/weights.js +32 -0
- package/src/mcp/server.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@ Format: [Semantic Versioning](https://semver.org/)
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
+
## [6.0.3] — 2026-04-21
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **`--coverage` CLI flag** — enables test coverage annotation (`✓`/`✗` per function) at runtime without editing config; sets `testCoverage: true` on the loaded config before any run path.
|
|
18
|
+
- **`sigmap weights --export [file]`** — writes learned weights JSON to a file path, or prints to stdout if no path given (pipe-friendly for CI and team sharing).
|
|
19
|
+
- **`sigmap weights --import <file> [--replace]`** — merges imported weights into the local `.context/weights.json`; `--replace` discards existing weights and takes the imported set entirely. Incoming values are sanitized and clamped.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
13
23
|
## [6.0.2] — 2026-04-21
|
|
14
24
|
|
|
15
25
|
### Fixed
|
package/README.md
CHANGED
|
@@ -147,7 +147,7 @@ volta install sigmap
|
|
|
147
147
|
| `windsurf` | `.windsurfrules` | Windsurf |
|
|
148
148
|
| `openai` | `.github/openai-context.md` | OpenAI models |
|
|
149
149
|
| `gemini` | `.github/gemini-context.md` | Google Gemini |
|
|
150
|
-
| `codex` | `AGENTS.md` | OpenAI Codex |
|
|
150
|
+
| `codex` | `AGENTS.md` | OpenAI Codex · OpenCode |
|
|
151
151
|
|
|
152
152
|
```bash
|
|
153
153
|
sigmap --adapter copilot # default
|
package/gen-context.js
CHANGED
|
@@ -5327,11 +5327,42 @@ __factories["./src/learning/weights"] = function(module, exports) {
|
|
|
5327
5327
|
if (fs.existsSync(outPath)) fs.unlinkSync(outPath);
|
|
5328
5328
|
}
|
|
5329
5329
|
|
|
5330
|
+
function exportWeights(cwd, outputPath) {
|
|
5331
|
+
const weights = loadWeights(cwd);
|
|
5332
|
+
const json = JSON.stringify(weights, null, 2) + '\n';
|
|
5333
|
+
if (outputPath) {
|
|
5334
|
+
fs.mkdirSync(path.dirname(path.resolve(outputPath)), { recursive: true });
|
|
5335
|
+
fs.writeFileSync(outputPath, json, 'utf8');
|
|
5336
|
+
} else {
|
|
5337
|
+
process.stdout.write(json);
|
|
5338
|
+
}
|
|
5339
|
+
return weights;
|
|
5340
|
+
}
|
|
5341
|
+
|
|
5342
|
+
function importWeights(cwd, importPath, replace) {
|
|
5343
|
+
let incoming;
|
|
5344
|
+
try {
|
|
5345
|
+
incoming = JSON.parse(fs.readFileSync(importPath, 'utf8'));
|
|
5346
|
+
} catch (err) {
|
|
5347
|
+
throw new Error('Cannot read weights file: ' + err.message);
|
|
5348
|
+
}
|
|
5349
|
+
const sanitized = sanitizeWeights(cwd, incoming);
|
|
5350
|
+
if (replace) {
|
|
5351
|
+
saveWeights(cwd, sanitized);
|
|
5352
|
+
return sanitized;
|
|
5353
|
+
}
|
|
5354
|
+
const existing = loadWeights(cwd);
|
|
5355
|
+
const merged = Object.assign({}, existing, sanitized);
|
|
5356
|
+
saveWeights(cwd, merged);
|
|
5357
|
+
return merged;
|
|
5358
|
+
}
|
|
5359
|
+
|
|
5330
5360
|
module.exports = {
|
|
5331
5361
|
BASELINE, DECAY, MAX_MULT, MIN_MULT,
|
|
5332
5362
|
weightsPath, clampMultiplier, normalizeFile,
|
|
5333
5363
|
loadWeights, saveWeights, updateWeights,
|
|
5334
5364
|
boostFiles, penalizeFiles, resetWeights,
|
|
5365
|
+
exportWeights, importWeights,
|
|
5335
5366
|
};
|
|
5336
5367
|
};
|
|
5337
5368
|
|
|
@@ -5356,7 +5387,7 @@ __factories["./src/mcp/server"] = function(module, exports) {
|
|
|
5356
5387
|
|
|
5357
5388
|
const SERVER_INFO = {
|
|
5358
5389
|
name: 'sigmap',
|
|
5359
|
-
version: '6.0.
|
|
5390
|
+
version: '6.0.3',
|
|
5360
5391
|
description: 'SigMap MCP server — code signatures on demand',
|
|
5361
5392
|
};
|
|
5362
5393
|
|
|
@@ -7074,7 +7105,7 @@ const path = require('path');
|
|
|
7074
7105
|
const os = require('os');
|
|
7075
7106
|
const { execSync } = require('child_process');
|
|
7076
7107
|
|
|
7077
|
-
const VERSION = '6.0.
|
|
7108
|
+
const VERSION = '6.0.3';
|
|
7078
7109
|
const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
|
|
7079
7110
|
|
|
7080
7111
|
function requireSourceOrBundled(key) {
|
|
@@ -8982,6 +9013,11 @@ function main() {
|
|
|
8982
9013
|
config.srcDirs = ['.'];
|
|
8983
9014
|
}
|
|
8984
9015
|
|
|
9016
|
+
// --coverage: enable test coverage annotation without editing config
|
|
9017
|
+
if (args.includes('--coverage')) {
|
|
9018
|
+
config.testCoverage = true;
|
|
9019
|
+
}
|
|
9020
|
+
|
|
8985
9021
|
// ── --output <file> — parse early so every subsequent block can use it ─────
|
|
8986
9022
|
// Resolves the custom output path and merges it into config.customOutput.
|
|
8987
9023
|
// Also persists the resolved relative path to gen-context.config.json so
|
|
@@ -9304,7 +9340,36 @@ function main() {
|
|
|
9304
9340
|
|
|
9305
9341
|
// v5.2: `sigmap weights` — explain learned ranking multipliers
|
|
9306
9342
|
if (args[0] === 'weights') {
|
|
9307
|
-
const { loadWeights } = requireSourceOrBundled('./src/learning/weights');
|
|
9343
|
+
const { loadWeights, exportWeights, importWeights } = requireSourceOrBundled('./src/learning/weights');
|
|
9344
|
+
|
|
9345
|
+
if (args.includes('--export')) {
|
|
9346
|
+
const exportIdx = args.indexOf('--export');
|
|
9347
|
+
const maybeFile = args[exportIdx + 1];
|
|
9348
|
+
const exportFile = (maybeFile && !maybeFile.startsWith('--')) ? maybeFile : null;
|
|
9349
|
+
exportWeights(cwd, exportFile);
|
|
9350
|
+
if (exportFile) console.warn(`[sigmap] weights exported to ${exportFile}`);
|
|
9351
|
+
process.exit(0);
|
|
9352
|
+
}
|
|
9353
|
+
|
|
9354
|
+
if (args.includes('--import')) {
|
|
9355
|
+
const importIdx = args.indexOf('--import');
|
|
9356
|
+
const importFile = args[importIdx + 1];
|
|
9357
|
+
if (!importFile || importFile.startsWith('--')) {
|
|
9358
|
+
console.error('[sigmap] --import requires a file path');
|
|
9359
|
+
process.exit(1);
|
|
9360
|
+
}
|
|
9361
|
+
const replace = args.includes('--replace');
|
|
9362
|
+
try {
|
|
9363
|
+
const result = importWeights(cwd, importFile, replace);
|
|
9364
|
+
const count = Object.keys(result).length;
|
|
9365
|
+
console.warn(`[sigmap] weights ${replace ? 'replaced' : 'merged'} from ${importFile} — ${count} file(s) with non-baseline weights`);
|
|
9366
|
+
} catch (err) {
|
|
9367
|
+
console.error(`[sigmap] weights import failed: ${err.message}`);
|
|
9368
|
+
process.exit(1);
|
|
9369
|
+
}
|
|
9370
|
+
process.exit(0);
|
|
9371
|
+
}
|
|
9372
|
+
|
|
9308
9373
|
const weights = loadWeights(cwd);
|
|
9309
9374
|
const entries = Object.entries(weights).sort(([, a], [, b]) => b - a || 0);
|
|
9310
9375
|
|
package/package.json
CHANGED
package/src/learning/weights.js
CHANGED
|
@@ -121,6 +121,36 @@ function resetWeights(cwd) {
|
|
|
121
121
|
if (fs.existsSync(outPath)) fs.unlinkSync(outPath);
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
+
function exportWeights(cwd, outputPath) {
|
|
125
|
+
const weights = loadWeights(cwd);
|
|
126
|
+
const json = JSON.stringify(weights, null, 2) + '\n';
|
|
127
|
+
if (outputPath) {
|
|
128
|
+
fs.mkdirSync(path.dirname(path.resolve(outputPath)), { recursive: true });
|
|
129
|
+
fs.writeFileSync(outputPath, json, 'utf8');
|
|
130
|
+
} else {
|
|
131
|
+
process.stdout.write(json);
|
|
132
|
+
}
|
|
133
|
+
return weights;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function importWeights(cwd, importPath, replace) {
|
|
137
|
+
let incoming;
|
|
138
|
+
try {
|
|
139
|
+
incoming = JSON.parse(fs.readFileSync(importPath, 'utf8'));
|
|
140
|
+
} catch (err) {
|
|
141
|
+
throw new Error(`Cannot read weights file: ${err.message}`);
|
|
142
|
+
}
|
|
143
|
+
const sanitized = sanitizeWeights(cwd, incoming);
|
|
144
|
+
if (replace) {
|
|
145
|
+
saveWeights(cwd, sanitized);
|
|
146
|
+
return sanitized;
|
|
147
|
+
}
|
|
148
|
+
const existing = loadWeights(cwd);
|
|
149
|
+
const merged = Object.assign({}, existing, sanitized);
|
|
150
|
+
saveWeights(cwd, merged);
|
|
151
|
+
return merged;
|
|
152
|
+
}
|
|
153
|
+
|
|
124
154
|
module.exports = {
|
|
125
155
|
BASELINE,
|
|
126
156
|
DECAY,
|
|
@@ -135,4 +165,6 @@ module.exports = {
|
|
|
135
165
|
boostFiles,
|
|
136
166
|
penalizeFiles,
|
|
137
167
|
resetWeights,
|
|
168
|
+
exportWeights,
|
|
169
|
+
importWeights,
|
|
138
170
|
};
|
package/src/mcp/server.js
CHANGED