sigmap 8.34.0 → 8.35.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/CHANGELOG.md +13 -0
- package/README.md +9 -9
- package/gen-context.js +217 -69
- package/llms-full.txt +6 -6
- package/llms.txt +6 -6
- package/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/core/package.json +1 -1
- package/src/extractors/cpp.js +8 -3
- package/src/extractors/csharp.js +8 -3
- package/src/extractors/css.js +1 -1
- package/src/extractors/dart.js +8 -3
- package/src/extractors/dockerfile.js +1 -1
- package/src/extractors/gdscript.js +2 -2
- package/src/extractors/go.js +13 -5
- package/src/extractors/html.js +1 -1
- package/src/extractors/javascript.js +7 -3
- package/src/extractors/kotlin.js +8 -3
- package/src/extractors/lua.js +1 -1
- package/src/extractors/markdown.js +1 -1
- package/src/extractors/php.js +8 -3
- package/src/extractors/properties.js +1 -1
- package/src/extractors/python.js +5 -2
- package/src/extractors/python_dataclass.js +3 -1
- package/src/extractors/r.js +1 -1
- package/src/extractors/ruby.js +1 -1
- package/src/extractors/rust.js +13 -5
- package/src/extractors/scala.js +8 -3
- package/src/extractors/shell.js +1 -1
- package/src/extractors/svelte.js +1 -1
- package/src/extractors/swift.js +8 -3
- package/src/extractors/toml.js +1 -1
- package/src/extractors/typescript.js +8 -4
- package/src/extractors/typescript_react.js +1 -1
- package/src/extractors/vue_sfc.js +3 -1
- package/src/extractors/xml.js +3 -1
- package/src/extractors/yaml.js +1 -1
- package/src/mcp/server.js +46 -4
- package/src/retrieval/ranker.js +14 -5
package/llms-full.txt
CHANGED
|
@@ -11,20 +11,20 @@ ranking keeps the relevant context in scope (cutting tokens ~97% as a side
|
|
|
11
11
|
effect), with no LLM calls, embeddings, or vector database. Works with Claude,
|
|
12
12
|
Cursor, GitHub Copilot, Aider, Windsurf, local LLMs, and MCP.
|
|
13
13
|
|
|
14
|
-
# Version: 8.
|
|
14
|
+
# Version: 8.35.0 | Benchmark: sigmap-v8.35-main (2026-09-13)
|
|
15
15
|
# Source: auto-generated from package.json, version.json, benchmarks/latest.json, src/mcp/tools.js, src/config/defaults.js
|
|
16
16
|
# Regenerate: npm run generate:llms | Validate: npm run validate:llms
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
## Core metrics (benchmark: sigmap-v8.
|
|
20
|
+
## Core metrics (benchmark: sigmap-v8.35-main, 2026-09-13)
|
|
21
21
|
|
|
22
22
|
| Metric | Without SigMap | With SigMap |
|
|
23
23
|
|--------|----------------|-------------|
|
|
24
|
-
| Retrieval hit@5 | 44.0% (single-shot grep) | 78.
|
|
25
|
-
| Token reduction | — | 96.
|
|
26
|
-
| Task-success proxy (modeled) | — |
|
|
27
|
-
| Prompts per task | 2.84 | 1.
|
|
24
|
+
| Retrieval hit@5 | 44.0% (single-shot grep) | 78.6% (1.73× lift) |
|
|
25
|
+
| Token reduction | — | 96.6% average |
|
|
26
|
+
| Task-success proxy (modeled) | — | 61.0% |
|
|
27
|
+
| Prompts per task | 2.84 | 1.61 (43.4% fewer) |
|
|
28
28
|
| Supported languages | — | 33 |
|
|
29
29
|
| MCP tools | — | 21 |
|
|
30
30
|
| npm runtime dependencies | — | 0 |
|
package/llms.txt
CHANGED
|
@@ -11,7 +11,7 @@ ranking keeps the relevant context in scope (cutting tokens ~97% as a side
|
|
|
11
11
|
effect), with no LLM calls, embeddings, or vector database. Works with Claude,
|
|
12
12
|
Cursor, GitHub Copilot, Aider, Windsurf, local LLMs, and MCP.
|
|
13
13
|
|
|
14
|
-
# Version: 8.
|
|
14
|
+
# Version: 8.35.0 | Benchmark: sigmap-v8.35-main (2026-09-13)
|
|
15
15
|
# Source: auto-generated from package.json, version.json, benchmarks/latest.json, src/mcp/tools.js, src/config/defaults.js
|
|
16
16
|
# Regenerate: npm run generate:llms | Validate: npm run validate:llms
|
|
17
17
|
|
|
@@ -23,12 +23,12 @@ Cursor, GitHub Copilot, Aider, Windsurf, local LLMs, and MCP.
|
|
|
23
23
|
- No blast-radius awareness before editing a hub file — `--impact` shows every file a change touches.
|
|
24
24
|
- Pasted stack traces, CI logs, and JSON bloat the prompt — `squeeze` minimizes them and enriches the top frame from the symbol index.
|
|
25
25
|
|
|
26
|
-
## Core metrics (benchmark: sigmap-v8.
|
|
26
|
+
## Core metrics (benchmark: sigmap-v8.35-main, 2026-09-13)
|
|
27
27
|
|
|
28
|
-
- hit@5 retrieval: 78.
|
|
29
|
-
- Token reduction: 96.
|
|
30
|
-
- Task-success proxy:
|
|
31
|
-
- Prompts per task: 1.
|
|
28
|
+
- hit@5 retrieval: 78.6% vs 44.0% single-shot grep baseline (1.73× lift)
|
|
29
|
+
- Token reduction: 96.6% average across benchmark repos
|
|
30
|
+
- Task-success proxy: 61.0% (modeled from retrieval tiers, not measured LLM sessions)
|
|
31
|
+
- Prompts per task: 1.61 vs 2.84 baseline (43.4% fewer, modeled)
|
|
32
32
|
- Languages: 33 supported · MCP tools: 21
|
|
33
33
|
- Dependencies: zero npm runtime dependencies · fully offline
|
|
34
34
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sigmap",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.35.0",
|
|
4
4
|
"description": "The deterministic, verifiable grounding layer for AI code work — a zero-dependency signature-and-evidence map that grounds Claude, Cursor, Copilot, Aider, Windsurf, local LLMs & MCP agents against your real code (repo + installed libraries) so they stop hallucinating files, imports & APIs. Runs offline via npx; byte-stable output; ~97% token reduction as proof.",
|
|
5
5
|
"main": "packages/core/index.js",
|
|
6
6
|
"exports": {
|
package/src/extractors/cpp.js
CHANGED
|
@@ -5,8 +5,13 @@ const { capWithNotice, capMembersWithNotice } = require('../util/truncate');
|
|
|
5
5
|
// Ceilings sit above the default `maxSigsPerFile` so the configured budget
|
|
6
6
|
// governs output rather than a literal buried here, and omissions are disclosed
|
|
7
7
|
// — an undisclosed cap looks like a class that simply has eight methods (#576).
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
// Class bodies are scanned to this many characters. Real classes routinely
|
|
9
|
+
// run past the old 4KB scan window — truncating there silently hid every
|
|
10
|
+
// member after ~4000 chars AND anchored class end-lines short (#576). The
|
|
11
|
+
// ceiling only guards against pathological input (Java parity, #551).
|
|
12
|
+
const MAX_CLASS_BODY_CHARS = 200000;
|
|
13
|
+
const MEMBER_LIMIT = 120;
|
|
14
|
+
const PER_FILE_LIMIT = 200;
|
|
10
15
|
|
|
11
16
|
/**
|
|
12
17
|
* Extract signatures from C/C++ source code.
|
|
@@ -43,7 +48,7 @@ function extract(src) {
|
|
|
43
48
|
|
|
44
49
|
function extractBlock(src, startIndex) {
|
|
45
50
|
let depth = 1, i = startIndex;
|
|
46
|
-
const end = Math.min(src.length, startIndex +
|
|
51
|
+
const end = Math.min(src.length, startIndex + MAX_CLASS_BODY_CHARS);
|
|
47
52
|
while (i < end && depth > 0) {
|
|
48
53
|
if (src[i] === '{') depth++;
|
|
49
54
|
else if (src[i] === '}') depth--;
|
package/src/extractors/csharp.js
CHANGED
|
@@ -6,8 +6,13 @@ const { capWithNotice, capMembersWithNotice } = require('../util/truncate');
|
|
|
6
6
|
// Ceilings sit above the default `maxSigsPerFile` so the configured budget
|
|
7
7
|
// governs output rather than a literal buried here, and omissions are disclosed
|
|
8
8
|
// — an undisclosed cap looks like a class that simply has eight methods (#576).
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// Class bodies are scanned to this many characters. Real classes routinely
|
|
10
|
+
// run past the old 4KB scan window — truncating there silently hid every
|
|
11
|
+
// member after ~4000 chars AND anchored class end-lines short (#576). The
|
|
12
|
+
// ceiling only guards against pathological input (Java parity, #551).
|
|
13
|
+
const MAX_CLASS_BODY_CHARS = 200000;
|
|
14
|
+
const MEMBER_LIMIT = 120;
|
|
15
|
+
const PER_FILE_LIMIT = 200;
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* Extract signatures from C# source code.
|
|
@@ -42,7 +47,7 @@ function extract(src) {
|
|
|
42
47
|
|
|
43
48
|
function extractBlock(src, startIndex) {
|
|
44
49
|
let depth = 1, i = startIndex;
|
|
45
|
-
const end = Math.min(src.length, startIndex +
|
|
50
|
+
const end = Math.min(src.length, startIndex + MAX_CLASS_BODY_CHARS);
|
|
46
51
|
while (i < end && depth > 0) {
|
|
47
52
|
if (src[i] === '{') depth++;
|
|
48
53
|
else if (src[i] === '}') depth--;
|
package/src/extractors/css.js
CHANGED
|
@@ -4,7 +4,7 @@ const { capWithNotice } = require('../util/truncate');
|
|
|
4
4
|
|
|
5
5
|
// Ceiling sits above the default `maxSigsPerFile` so the configured budget
|
|
6
6
|
// governs output rather than a literal buried here, and omissions are disclosed (#576).
|
|
7
|
-
const PER_FILE_LIMIT =
|
|
7
|
+
const PER_FILE_LIMIT = 200;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Extract signatures from CSS/SCSS/SASS/Less source code.
|
package/src/extractors/dart.js
CHANGED
|
@@ -6,8 +6,13 @@ const { capWithNotice, capMembersWithNotice } = require('../util/truncate');
|
|
|
6
6
|
// Ceilings sit above the default `maxSigsPerFile` so the configured budget
|
|
7
7
|
// governs output rather than a literal buried here, and omissions are disclosed
|
|
8
8
|
// — an undisclosed cap looks like a class that simply has eight methods (#576).
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// Class bodies are scanned to this many characters. Real classes routinely
|
|
10
|
+
// run past the old 4KB scan window — truncating there silently hid every
|
|
11
|
+
// member after ~4000 chars AND anchored class end-lines short (#576). The
|
|
12
|
+
// ceiling only guards against pathological input (Java parity, #551).
|
|
13
|
+
const MAX_CLASS_BODY_CHARS = 200000;
|
|
14
|
+
const MEMBER_LIMIT = 120;
|
|
15
|
+
const PER_FILE_LIMIT = 200;
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* Extract signatures from Dart source code.
|
|
@@ -61,7 +66,7 @@ function extract(src) {
|
|
|
61
66
|
|
|
62
67
|
function extractBlock(src, startIndex) {
|
|
63
68
|
let depth = 1, i = startIndex;
|
|
64
|
-
const end = Math.min(src.length, startIndex +
|
|
69
|
+
const end = Math.min(src.length, startIndex + MAX_CLASS_BODY_CHARS);
|
|
65
70
|
while (i < end && depth > 0) {
|
|
66
71
|
if (src[i] === '{') depth++;
|
|
67
72
|
else if (src[i] === '}') depth--;
|
|
@@ -4,7 +4,7 @@ const { capWithNotice } = require('../util/truncate');
|
|
|
4
4
|
|
|
5
5
|
// Ceiling sits above the default `maxSigsPerFile` so the configured budget
|
|
6
6
|
// governs output rather than a literal buried here, and omissions are disclosed (#576).
|
|
7
|
-
const PER_FILE_LIMIT =
|
|
7
|
+
const PER_FILE_LIMIT = 200;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Extract signatures from Dockerfiles.
|
|
@@ -4,10 +4,10 @@ const { capWithNotice } = require('../util/truncate');
|
|
|
4
4
|
|
|
5
5
|
// Ceiling sits above the default `maxSigsPerFile` so the configured budget
|
|
6
6
|
// governs output rather than a literal buried here, and omissions are disclosed (#576).
|
|
7
|
-
const PER_FILE_LIMIT =
|
|
7
|
+
const PER_FILE_LIMIT = 200;
|
|
8
8
|
|
|
9
9
|
// Ceilings disclose what they drop rather than truncating silently (#576).
|
|
10
|
-
const MEMBER_LIMIT =
|
|
10
|
+
const MEMBER_LIMIT = 120;
|
|
11
11
|
const ENUM_LIMIT = 24;
|
|
12
12
|
|
|
13
13
|
/**
|
package/src/extractors/go.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { lineAt, withAnchor } = require('./line-anchor');
|
|
4
|
-
const { capWithNotice } = require('../util/truncate');
|
|
4
|
+
const { capWithNotice, capMembersWithNotice } = require('../util/truncate');
|
|
5
5
|
|
|
6
6
|
// Ceiling sits above the default `maxSigsPerFile` so the configured budget
|
|
7
7
|
// governs output rather than a literal buried here, and omissions are disclosed (#576).
|
|
8
|
-
|
|
8
|
+
// Class bodies are scanned to this many characters. Real classes routinely
|
|
9
|
+
// run past the old 4KB scan window — truncating there silently hid every
|
|
10
|
+
// member after ~4000 chars AND anchored class end-lines short (#576). The
|
|
11
|
+
// ceiling only guards against pathological input (Java parity, #551).
|
|
12
|
+
const MAX_CLASS_BODY_CHARS = 200000;
|
|
13
|
+
const PER_FILE_LIMIT = 200;
|
|
14
|
+
|
|
15
|
+
// Per-interface member ceiling, disclosed via capMembersWithNotice (#576).
|
|
16
|
+
const MEMBER_LIMIT = 120;
|
|
9
17
|
|
|
10
18
|
/**
|
|
11
19
|
* Extract signatures from Go source code.
|
|
@@ -41,7 +49,7 @@ function extract(src) {
|
|
|
41
49
|
const block = extractBlock(stripped, bodyStart);
|
|
42
50
|
sigs.push(hinted(withAnchor(`type ${m[1]} interface`, lineAt(stripped, m.index), lineAt(stripped, bodyStart + block.length)), m[1]));
|
|
43
51
|
for (const meth of extractInterfaceMethods(block)) {
|
|
44
|
-
sigs.push(withAnchor(` ${meth.text}`, lineAt(stripped, bodyStart + meth.declIdx), lineAt(stripped, bodyStart + meth.endIdx)));
|
|
52
|
+
sigs.push(withAnchor(` ${meth.text}`, lineAt(stripped, bodyStart + (meth.declIdx || 0)), lineAt(stripped, bodyStart + (meth.endIdx || 0))));
|
|
45
53
|
}
|
|
46
54
|
}
|
|
47
55
|
|
|
@@ -59,7 +67,7 @@ function extract(src) {
|
|
|
59
67
|
|
|
60
68
|
function extractBlock(src, startIndex) {
|
|
61
69
|
let depth = 1, i = startIndex;
|
|
62
|
-
const end = Math.min(src.length, startIndex +
|
|
70
|
+
const end = Math.min(src.length, startIndex + MAX_CLASS_BODY_CHARS);
|
|
63
71
|
while (i < end && depth > 0) {
|
|
64
72
|
if (src[i] === '{') depth++;
|
|
65
73
|
else if (src[i] === '}') depth--;
|
|
@@ -79,7 +87,7 @@ function extractInterfaceMethods(block) {
|
|
|
79
87
|
endIdx: m.index + m[0].length,
|
|
80
88
|
});
|
|
81
89
|
}
|
|
82
|
-
return methods
|
|
90
|
+
return capMembersWithNotice(methods, MEMBER_LIMIT, 'methods');
|
|
83
91
|
}
|
|
84
92
|
|
|
85
93
|
function normalizeParams(params) {
|
package/src/extractors/html.js
CHANGED
|
@@ -4,7 +4,7 @@ const { capWithNotice } = require('../util/truncate');
|
|
|
4
4
|
|
|
5
5
|
// Ceiling sits above the default `maxSigsPerFile` so the configured budget
|
|
6
6
|
// governs output rather than a literal buried here, and omissions are disclosed (#576).
|
|
7
|
-
const PER_FILE_LIMIT =
|
|
7
|
+
const PER_FILE_LIMIT = 200;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Extract signatures from HTML files.
|
|
@@ -4,6 +4,10 @@ const { lineAt, withAnchor } = require('./line-anchor');
|
|
|
4
4
|
const { capWithNotice, capMembersWithNotice } = require('../util/truncate');
|
|
5
5
|
const { stripComments, maskCode, readBalanced } = require('./scan');
|
|
6
6
|
|
|
7
|
+
// Class bodies are scanned to this many characters — guard against
|
|
8
|
+
// pathological input only; the old 4KB window silently hid members (#576).
|
|
9
|
+
const MAX_CLASS_BODY_CHARS = 200000;
|
|
10
|
+
|
|
7
11
|
/**
|
|
8
12
|
* Extract signatures from JavaScript source code.
|
|
9
13
|
* Top-level declarations and class members carry a `:start-end` line anchor
|
|
@@ -113,13 +117,13 @@ function extract(src) {
|
|
|
113
117
|
const anchored = anchors[i] ? withAnchor(s, anchors[i][0], anchors[i][1]) : s;
|
|
114
118
|
return docHintFor[i] ? `${anchored} # ${docHintFor[i]}` : anchored;
|
|
115
119
|
});
|
|
116
|
-
return capWithNotice(withAnchors,
|
|
120
|
+
return capWithNotice(withAnchors, 200, 'signatures');
|
|
117
121
|
}
|
|
118
122
|
|
|
119
123
|
function extractBlock(src, startIndex) {
|
|
120
124
|
let depth = 1;
|
|
121
125
|
let i = startIndex;
|
|
122
|
-
const end = Math.min(src.length, startIndex +
|
|
126
|
+
const end = Math.min(src.length, startIndex + MAX_CLASS_BODY_CHARS);
|
|
123
127
|
while (i < end && depth > 0) {
|
|
124
128
|
if (src[i] === '{') depth++;
|
|
125
129
|
else if (src[i] === '}') depth--;
|
|
@@ -154,7 +158,7 @@ function extractClassMembers(block, maskedBlock, returnHints) {
|
|
|
154
158
|
const retStr = formatReturnHint(returnHints.get(m[1]));
|
|
155
159
|
members.push({ text: `${isStatic}${isAsync}${m[1]}(${normalizeParams(params)})${retStr}`, start, end });
|
|
156
160
|
}
|
|
157
|
-
return capMembersWithNotice(members,
|
|
161
|
+
return capMembersWithNotice(members, 120, 'methods');
|
|
158
162
|
}
|
|
159
163
|
|
|
160
164
|
function buildReturnHints(src) {
|
package/src/extractors/kotlin.js
CHANGED
|
@@ -6,8 +6,13 @@ const { capWithNotice, capMembersWithNotice } = require('../util/truncate');
|
|
|
6
6
|
// Ceilings sit above the default `maxSigsPerFile` so the configured budget
|
|
7
7
|
// governs output rather than a literal buried here, and omissions are disclosed
|
|
8
8
|
// — an undisclosed cap looks like a class that simply has eight methods (#576).
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// Class bodies are scanned to this many characters. Real classes routinely
|
|
10
|
+
// run past the old 4KB scan window — truncating there silently hid every
|
|
11
|
+
// member after ~4000 chars AND anchored class end-lines short (#576). The
|
|
12
|
+
// ceiling only guards against pathological input (Java parity, #551).
|
|
13
|
+
const MAX_CLASS_BODY_CHARS = 200000;
|
|
14
|
+
const MEMBER_LIMIT = 120;
|
|
15
|
+
const PER_FILE_LIMIT = 200;
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* Extract signatures from Kotlin source code.
|
|
@@ -61,7 +66,7 @@ function extract(src) {
|
|
|
61
66
|
|
|
62
67
|
function extractBlock(src, startIndex) {
|
|
63
68
|
let depth = 1, i = startIndex;
|
|
64
|
-
const end = Math.min(src.length, startIndex +
|
|
69
|
+
const end = Math.min(src.length, startIndex + MAX_CLASS_BODY_CHARS);
|
|
65
70
|
while (i < end && depth > 0) {
|
|
66
71
|
if (src[i] === '{') depth++;
|
|
67
72
|
else if (src[i] === '}') depth--;
|
package/src/extractors/lua.js
CHANGED
|
@@ -5,7 +5,7 @@ const { capWithNotice } = require('../util/truncate');
|
|
|
5
5
|
// Ceiling discloses what it drops rather than truncating silently (#583).
|
|
6
6
|
// Collection runs to completion so the marker reports the true overflow —
|
|
7
7
|
// stopping early made r.js report "+1 more" where 50 were hidden (#584).
|
|
8
|
-
const PER_FILE_LIMIT =
|
|
8
|
+
const PER_FILE_LIMIT = 200;
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Extract signatures from Lua source code.
|
package/src/extractors/php.js
CHANGED
|
@@ -6,8 +6,13 @@ const { capWithNotice, capMembersWithNotice } = require('../util/truncate');
|
|
|
6
6
|
// Ceilings sit above the default `maxSigsPerFile` so the configured budget
|
|
7
7
|
// governs output rather than a literal buried here, and omissions are disclosed
|
|
8
8
|
// — an undisclosed cap looks like a class that simply has eight methods (#576).
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// Class bodies are scanned to this many characters. Real classes routinely
|
|
10
|
+
// run past the old 4KB scan window — truncating there silently hid every
|
|
11
|
+
// member after ~4000 chars AND anchored class end-lines short (#576). The
|
|
12
|
+
// ceiling only guards against pathological input (Java parity, #551).
|
|
13
|
+
const MAX_CLASS_BODY_CHARS = 200000;
|
|
14
|
+
const MEMBER_LIMIT = 120;
|
|
15
|
+
const PER_FILE_LIMIT = 200;
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* Extract signatures from PHP source code.
|
|
@@ -65,7 +70,7 @@ function extract(src) {
|
|
|
65
70
|
|
|
66
71
|
function extractBlock(src, startIndex) {
|
|
67
72
|
let depth = 1, i = startIndex;
|
|
68
|
-
const end = Math.min(src.length, startIndex +
|
|
73
|
+
const end = Math.min(src.length, startIndex + MAX_CLASS_BODY_CHARS);
|
|
69
74
|
while (i < end && depth > 0) {
|
|
70
75
|
if (src[i] === '{') depth++;
|
|
71
76
|
else if (src[i] === '}') depth--;
|
package/src/extractors/python.js
CHANGED
|
@@ -6,7 +6,10 @@ const { capWithNotice } = require('../util/truncate');
|
|
|
6
6
|
|
|
7
7
|
// Ceiling sits above the default `maxSigsPerFile` so the configured budget
|
|
8
8
|
// governs output rather than a literal buried here, and omissions are disclosed (#576).
|
|
9
|
-
const PER_FILE_LIMIT =
|
|
9
|
+
const PER_FILE_LIMIT = 200;
|
|
10
|
+
|
|
11
|
+
// Per-class member ceiling, disclosed via capWithNotice (#576).
|
|
12
|
+
const MEMBER_LIMIT = 120;
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* 1-based line of the last source line belonging to a top-level (indent 0)
|
|
@@ -162,7 +165,7 @@ function extractClassMethods(stripped, startIndex) {
|
|
|
162
165
|
methods.push(`${asyncKw}def ${m[1]}(${params})${retStr}`);
|
|
163
166
|
}
|
|
164
167
|
}
|
|
165
|
-
return methods
|
|
168
|
+
return capWithNotice(methods, MEMBER_LIMIT, 'methods');
|
|
166
169
|
}
|
|
167
170
|
|
|
168
171
|
function tryExtractDataclassFields(stripped, classIndex) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const { capWithNotice } = require('../util/truncate');
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Extract Python dataclass, Pydantic model, and SQLAlchemy ORM metadata.
|
|
5
7
|
* Focuses on model fields, validation, and relationships.
|
|
@@ -71,7 +73,7 @@ function extract(src) {
|
|
|
71
73
|
sigs.push('config-class');
|
|
72
74
|
}
|
|
73
75
|
|
|
74
|
-
return Array.from(new Set(sigs))
|
|
76
|
+
return capWithNotice(Array.from(new Set(sigs)), 200, 'signatures');
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
module.exports = { extract };
|
package/src/extractors/r.js
CHANGED
|
@@ -4,7 +4,7 @@ const { capWithNotice } = require('../util/truncate');
|
|
|
4
4
|
|
|
5
5
|
// Ceiling sits above the default `maxSigsPerFile` so the configured budget
|
|
6
6
|
// governs output rather than a literal buried here, and omissions are disclosed (#576).
|
|
7
|
-
const PER_FILE_LIMIT =
|
|
7
|
+
const PER_FILE_LIMIT = 200;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Extract signatures from R source code.
|
package/src/extractors/ruby.js
CHANGED
|
@@ -4,7 +4,7 @@ const { capWithNotice } = require('../util/truncate');
|
|
|
4
4
|
|
|
5
5
|
// Ceiling sits above the default `maxSigsPerFile` so the configured budget
|
|
6
6
|
// governs output rather than a literal buried here, and omissions are disclosed (#576).
|
|
7
|
-
const PER_FILE_LIMIT =
|
|
7
|
+
const PER_FILE_LIMIT = 200;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Extract signatures from Ruby source code.
|
package/src/extractors/rust.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { lineAt, withAnchor } = require('./line-anchor');
|
|
4
|
-
const { capWithNotice } = require('../util/truncate');
|
|
4
|
+
const { capWithNotice, capMembersWithNotice } = require('../util/truncate');
|
|
5
5
|
|
|
6
6
|
// Ceiling sits above the default `maxSigsPerFile` so the configured budget
|
|
7
7
|
// governs output rather than a literal buried here, and omissions are disclosed (#576).
|
|
8
|
-
|
|
8
|
+
// Class bodies are scanned to this many characters. Real classes routinely
|
|
9
|
+
// run past the old 4KB scan window — truncating there silently hid every
|
|
10
|
+
// member after ~4000 chars AND anchored class end-lines short (#576). The
|
|
11
|
+
// ceiling only guards against pathological input (Java parity, #551).
|
|
12
|
+
const MAX_CLASS_BODY_CHARS = 200000;
|
|
13
|
+
const PER_FILE_LIMIT = 200;
|
|
14
|
+
|
|
15
|
+
// Per-impl member ceiling, disclosed via capMembersWithNotice (#576).
|
|
16
|
+
const MEMBER_LIMIT = 120;
|
|
9
17
|
|
|
10
18
|
/**
|
|
11
19
|
* Extract signatures from Rust source code.
|
|
@@ -63,7 +71,7 @@ function extract(src) {
|
|
|
63
71
|
const block = extractBlock(stripped, bodyStart);
|
|
64
72
|
sigs.push(withAnchor(`impl ${m[1]}`, lineAt(stripped, m.index), lineAt(stripped, bodyStart + block.length)));
|
|
65
73
|
for (const fn of extractMethods(block)) {
|
|
66
|
-
sigs.push(hinted(withAnchor(` ${fn.text}`, lineAt(stripped, bodyStart + fn.declIdx), lineAt(stripped, bodyStart + fn.endIdx)), fn.name));
|
|
74
|
+
sigs.push(hinted(withAnchor(` ${fn.text}`, lineAt(stripped, bodyStart + (fn.declIdx || 0)), lineAt(stripped, bodyStart + (fn.endIdx || 0))), fn.name));
|
|
67
75
|
}
|
|
68
76
|
}
|
|
69
77
|
|
|
@@ -80,7 +88,7 @@ function extract(src) {
|
|
|
80
88
|
|
|
81
89
|
function extractBlock(src, startIndex) {
|
|
82
90
|
let depth = 1, i = startIndex;
|
|
83
|
-
const end = Math.min(src.length, startIndex +
|
|
91
|
+
const end = Math.min(src.length, startIndex + MAX_CLASS_BODY_CHARS);
|
|
84
92
|
while (i < end && depth > 0) {
|
|
85
93
|
if (src[i] === '{') depth++;
|
|
86
94
|
else if (src[i] === '}') depth--;
|
|
@@ -101,7 +109,7 @@ function extractMethods(block) {
|
|
|
101
109
|
endIdx: m.index + m[0].length,
|
|
102
110
|
});
|
|
103
111
|
}
|
|
104
|
-
return methods
|
|
112
|
+
return capMembersWithNotice(methods, MEMBER_LIMIT, 'methods');
|
|
105
113
|
}
|
|
106
114
|
|
|
107
115
|
function normalizeParams(params) {
|
package/src/extractors/scala.js
CHANGED
|
@@ -6,8 +6,13 @@ const { capWithNotice, capMembersWithNotice } = require('../util/truncate');
|
|
|
6
6
|
// Ceilings sit above the default `maxSigsPerFile` so the configured budget
|
|
7
7
|
// governs output rather than a literal buried here, and omissions are disclosed
|
|
8
8
|
// — an undisclosed cap looks like a class that simply has eight methods (#576).
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// Class bodies are scanned to this many characters. Real classes routinely
|
|
10
|
+
// run past the old 4KB scan window — truncating there silently hid every
|
|
11
|
+
// member after ~4000 chars AND anchored class end-lines short (#576). The
|
|
12
|
+
// ceiling only guards against pathological input (Java parity, #551).
|
|
13
|
+
const MAX_CLASS_BODY_CHARS = 200000;
|
|
14
|
+
const MEMBER_LIMIT = 120;
|
|
15
|
+
const PER_FILE_LIMIT = 200;
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* Extract signatures from Scala source code.
|
|
@@ -54,7 +59,7 @@ function extract(src) {
|
|
|
54
59
|
|
|
55
60
|
function extractBlock(src, startIndex) {
|
|
56
61
|
let depth = 1, i = startIndex;
|
|
57
|
-
const end = Math.min(src.length, startIndex +
|
|
62
|
+
const end = Math.min(src.length, startIndex + MAX_CLASS_BODY_CHARS);
|
|
58
63
|
while (i < end && depth > 0) {
|
|
59
64
|
if (src[i] === '{') depth++;
|
|
60
65
|
else if (src[i] === '}') depth--;
|
package/src/extractors/shell.js
CHANGED
|
@@ -4,7 +4,7 @@ const { capWithNotice } = require('../util/truncate');
|
|
|
4
4
|
|
|
5
5
|
// Ceiling sits above the default `maxSigsPerFile` so the configured budget
|
|
6
6
|
// governs output rather than a literal buried here, and omissions are disclosed (#576).
|
|
7
|
-
const PER_FILE_LIMIT =
|
|
7
|
+
const PER_FILE_LIMIT = 200;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Extract signatures from shell scripts (bash, zsh, fish).
|
package/src/extractors/svelte.js
CHANGED
|
@@ -4,7 +4,7 @@ const { capWithNotice } = require('../util/truncate');
|
|
|
4
4
|
|
|
5
5
|
// Ceiling sits above the default `maxSigsPerFile` so the configured budget
|
|
6
6
|
// governs output rather than a literal buried here, and omissions are disclosed (#576).
|
|
7
|
-
const PER_FILE_LIMIT =
|
|
7
|
+
const PER_FILE_LIMIT = 200;
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Extract signatures from Svelte components.
|
package/src/extractors/swift.js
CHANGED
|
@@ -6,8 +6,13 @@ const { capWithNotice, capMembersWithNotice } = require('../util/truncate');
|
|
|
6
6
|
// Ceilings sit above the default `maxSigsPerFile` so the configured budget
|
|
7
7
|
// governs output rather than a literal buried here, and omissions are disclosed
|
|
8
8
|
// — an undisclosed cap looks like a class that simply has eight methods (#576).
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
// Class bodies are scanned to this many characters. Real classes routinely
|
|
10
|
+
// run past the old 4KB scan window — truncating there silently hid every
|
|
11
|
+
// member after ~4000 chars AND anchored class end-lines short (#576). The
|
|
12
|
+
// ceiling only guards against pathological input (Java parity, #551).
|
|
13
|
+
const MAX_CLASS_BODY_CHARS = 200000;
|
|
14
|
+
const MEMBER_LIMIT = 120;
|
|
15
|
+
const PER_FILE_LIMIT = 200;
|
|
11
16
|
|
|
12
17
|
/**
|
|
13
18
|
* Extract signatures from Swift source code.
|
|
@@ -61,7 +66,7 @@ function extract(src) {
|
|
|
61
66
|
|
|
62
67
|
function extractBlock(src, startIndex) {
|
|
63
68
|
let depth = 1, i = startIndex;
|
|
64
|
-
const end = Math.min(src.length, startIndex +
|
|
69
|
+
const end = Math.min(src.length, startIndex + MAX_CLASS_BODY_CHARS);
|
|
65
70
|
while (i < end && depth > 0) {
|
|
66
71
|
if (src[i] === '{') depth++;
|
|
67
72
|
else if (src[i] === '}') depth--;
|
package/src/extractors/toml.js
CHANGED
|
@@ -4,6 +4,10 @@ const { lineAt, withAnchor } = require('./line-anchor');
|
|
|
4
4
|
const { capWithNotice, capMembersWithNotice } = require('../util/truncate');
|
|
5
5
|
const { stripComments, maskCode, readBalanced } = require('./scan');
|
|
6
6
|
|
|
7
|
+
// Class bodies are scanned to this many characters — guard against
|
|
8
|
+
// pathological input only; the old 4KB window silently hid members (#576).
|
|
9
|
+
const MAX_CLASS_BODY_CHARS = 200000;
|
|
10
|
+
|
|
7
11
|
/**
|
|
8
12
|
* Extract signatures from TypeScript source code.
|
|
9
13
|
* Top-level declarations carry a `:start-end` line anchor (see line-anchor.js);
|
|
@@ -189,13 +193,13 @@ function extract(src) {
|
|
|
189
193
|
const anchored = anchors[i] ? withAnchor(s, anchors[i][0], anchors[i][1]) : s;
|
|
190
194
|
return docHintFor[i] ? `${anchored} # ${docHintFor[i]}` : anchored;
|
|
191
195
|
});
|
|
192
|
-
return capWithNotice(withAnchors,
|
|
196
|
+
return capWithNotice(withAnchors, 200, 'signatures');
|
|
193
197
|
}
|
|
194
198
|
|
|
195
199
|
function extractBlock(src, startIndex) {
|
|
196
200
|
let depth = 1;
|
|
197
201
|
let i = startIndex;
|
|
198
|
-
const end = Math.min(src.length, startIndex +
|
|
202
|
+
const end = Math.min(src.length, startIndex + MAX_CLASS_BODY_CHARS);
|
|
199
203
|
while (i < end && depth > 0) {
|
|
200
204
|
if (src[i] === '{') depth++;
|
|
201
205
|
else if (src[i] === '}') depth--;
|
|
@@ -223,7 +227,7 @@ function extractInterfaceMembers(block) {
|
|
|
223
227
|
const start = m.index + (m[0].length - m[0].replace(/^\s+/, '').length);
|
|
224
228
|
members.push({ text: `${m[1]}(${normalizeParams(block.slice(openIdx + 1, closeIdx))})`, start, end: closeIdx + 1 });
|
|
225
229
|
}
|
|
226
|
-
return capMembersWithNotice(members,
|
|
230
|
+
return capMembersWithNotice(members, 120, 'members');
|
|
227
231
|
}
|
|
228
232
|
|
|
229
233
|
const _CTRL_KEYWORDS = new Set(['if', 'for', 'while', 'switch', 'do', 'try', 'catch', 'finally', 'else', 'return']);
|
|
@@ -258,7 +262,7 @@ function extractClassMembers(block, maskedBlock) {
|
|
|
258
262
|
const retStr = retType ? ` → ${retType}` : '';
|
|
259
263
|
members.push({ text: `${isStatic}${isAsync}${m[1]}(${normalizeParams(params)})${retStr}`, start, end });
|
|
260
264
|
}
|
|
261
|
-
return capMembersWithNotice(members,
|
|
265
|
+
return capMembersWithNotice(members, 120, 'methods');
|
|
262
266
|
}
|
|
263
267
|
|
|
264
268
|
function normalizeParams(params) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const { capWithNotice } = require('../util/truncate');
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Extract Vue Single-File Component (SFC) signatures from .vue files.
|
|
5
7
|
* Captures component metadata: name, props, emits, slots, composables, lifecycle.
|
|
@@ -93,7 +95,7 @@ function extract(src) {
|
|
|
93
95
|
sigs.push(`slot ${s}`);
|
|
94
96
|
}
|
|
95
97
|
|
|
96
|
-
return Array.from(new Set(sigs))
|
|
98
|
+
return capWithNotice(Array.from(new Set(sigs)), 200, 'signatures');
|
|
97
99
|
}
|
|
98
100
|
|
|
99
101
|
module.exports = { extract };
|