sigmap 3.3.3 → 3.3.4
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 +2 -0
- package/gen-context.js +322 -2
- package/package.json +1 -1
- package/packages/cli/package.json +1 -1
- package/packages/core/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,19 @@ Format: [Semantic Versioning](https://semver.org/)
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
+
## [3.3.4] — 2026-04-14 — Binary Bundle Fix
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- **Standalone binary pre-flight now passes for new P1 extractors**
|
|
17
|
+
- Added missing bundled `__factories` entries in `gen-context.js` for:
|
|
18
|
+
- `./src/extractors/graphql`
|
|
19
|
+
- `./src/extractors/protobuf`
|
|
20
|
+
- `./src/extractors/sql`
|
|
21
|
+
- `./src/extractors/terraform`
|
|
22
|
+
- Resolves CI/build failure in `scripts/build-binary.mjs` reporting missing `src/` modules in bundle.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
13
26
|
## [3.3.3] — 2026-04-14 — Auto srcDirs + P1 Extractors
|
|
14
27
|
|
|
15
28
|
### Added
|
package/README.md
CHANGED
|
@@ -19,6 +19,8 @@
|
|
|
19
19
|
npx sigmap # 10 seconds. zero config. your AI never reads the wrong file again.
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
> Latest: **v3.3.4** includes a standalone binary bundle fix for newly added P1 extractors.
|
|
23
|
+
|
|
22
24
|
<div align="center">
|
|
23
25
|
<img src="demo.gif" alt="SigMap demo — reducing 80K tokens to 4K in under 10 seconds" width="760" />
|
|
24
26
|
</div>
|
package/gen-context.js
CHANGED
|
@@ -1680,6 +1680,326 @@ __factories["./src/extractors/typescript"] = function(module, exports) {
|
|
|
1680
1680
|
|
|
1681
1681
|
};
|
|
1682
1682
|
|
|
1683
|
+
// ── ./src/extractors/graphql ──
|
|
1684
|
+
__factories["./src/extractors/graphql"] = function(module, exports) {
|
|
1685
|
+
|
|
1686
|
+
'use strict';
|
|
1687
|
+
|
|
1688
|
+
/**
|
|
1689
|
+
* Extract signatures from GraphQL schema / operation files.
|
|
1690
|
+
* Captures type, interface, enum, input, union, scalar, query, mutation,
|
|
1691
|
+
* subscription, fragment definitions.
|
|
1692
|
+
*
|
|
1693
|
+
* @param {string} src - Raw GraphQL content
|
|
1694
|
+
* @returns {string[]} Array of signature strings
|
|
1695
|
+
*/
|
|
1696
|
+
function extract(src) {
|
|
1697
|
+
if (!src || typeof src !== 'string') return [];
|
|
1698
|
+
const sigs = [];
|
|
1699
|
+
|
|
1700
|
+
// Strip comments (# style)
|
|
1701
|
+
const stripped = src.replace(/#[^\n]*/g, '');
|
|
1702
|
+
|
|
1703
|
+
// Schema type definitions: type Foo [implements Bar] { ... }
|
|
1704
|
+
for (const m of stripped.matchAll(
|
|
1705
|
+
/\b(type|interface|input)\s+(\w+)(?:\s+implements\s+([\w\s&]+))?\s*\{/g
|
|
1706
|
+
)) {
|
|
1707
|
+
const implements_ = m[3] ? ` implements ${m[3].trim().replace(/\s+/g, ' ')}` : '';
|
|
1708
|
+
sigs.push(`${m[1]} ${m[2]}${implements_}`);
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
// enum
|
|
1712
|
+
for (const m of stripped.matchAll(/\benum\s+(\w+)\s*\{/g)) {
|
|
1713
|
+
sigs.push(`enum ${m[1]}`);
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
// union
|
|
1717
|
+
for (const m of stripped.matchAll(/\bunion\s+(\w+)\s*=/g)) {
|
|
1718
|
+
sigs.push(`union ${m[1]}`);
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
// scalar
|
|
1722
|
+
for (const m of stripped.matchAll(/\bscalar\s+(\w+)/g)) {
|
|
1723
|
+
sigs.push(`scalar ${m[1]}`);
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
// extend type / extend interface
|
|
1727
|
+
for (const m of stripped.matchAll(/\bextend\s+(type|interface)\s+(\w+)/g)) {
|
|
1728
|
+
sigs.push(`extend ${m[1]} ${m[2]}`);
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
// Query / Mutation / Subscription operations
|
|
1732
|
+
for (const m of stripped.matchAll(
|
|
1733
|
+
/\b(query|mutation|subscription)\s+(\w+)\s*(?:\([^)]*\))?\s*\{/g
|
|
1734
|
+
)) {
|
|
1735
|
+
sigs.push(`${m[1]} ${m[2]}`);
|
|
1736
|
+
}
|
|
1737
|
+
|
|
1738
|
+
// Named fragments
|
|
1739
|
+
for (const m of stripped.matchAll(/\bfragment\s+(\w+)\s+on\s+(\w+)/g)) {
|
|
1740
|
+
sigs.push(`fragment ${m[1]} on ${m[2]}`);
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1743
|
+
// Top-level schema { query: ... }
|
|
1744
|
+
if (/\bschema\s*\{/.test(stripped)) {
|
|
1745
|
+
sigs.push('schema { ... }');
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
return sigs;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
module.exports = { extract };
|
|
1752
|
+
|
|
1753
|
+
};
|
|
1754
|
+
|
|
1755
|
+
// ── ./src/extractors/protobuf ──
|
|
1756
|
+
__factories["./src/extractors/protobuf"] = function(module, exports) {
|
|
1757
|
+
|
|
1758
|
+
'use strict';
|
|
1759
|
+
|
|
1760
|
+
/**
|
|
1761
|
+
* Extract signatures from Protocol Buffer (.proto) files.
|
|
1762
|
+
* Captures message, enum, service, rpc, oneof, extend definitions.
|
|
1763
|
+
*
|
|
1764
|
+
* @param {string} src - Raw .proto content
|
|
1765
|
+
* @returns {string[]} Array of signature strings
|
|
1766
|
+
*/
|
|
1767
|
+
function extract(src) {
|
|
1768
|
+
if (!src || typeof src !== 'string') return [];
|
|
1769
|
+
const sigs = [];
|
|
1770
|
+
|
|
1771
|
+
// Strip single-line and block comments
|
|
1772
|
+
const stripped = src
|
|
1773
|
+
.replace(/\/\/[^\n]*/g, '')
|
|
1774
|
+
.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
1775
|
+
|
|
1776
|
+
// syntax / package / option (top-level metadata)
|
|
1777
|
+
const syntaxM = stripped.match(/\bsyntax\s*=\s*"([^"]+)"/);
|
|
1778
|
+
if (syntaxM) sigs.push(`syntax = "${syntaxM[1]}"`);
|
|
1779
|
+
|
|
1780
|
+
const pkgM = stripped.match(/\bpackage\s+([\w.]+)\s*;/);
|
|
1781
|
+
if (pkgM) sigs.push(`package ${pkgM[1]}`);
|
|
1782
|
+
|
|
1783
|
+
// message <Name> { ... }
|
|
1784
|
+
for (const m of stripped.matchAll(/\bmessage\s+(\w+)\s*\{/g)) {
|
|
1785
|
+
sigs.push(`message ${m[1]}`);
|
|
1786
|
+
}
|
|
1787
|
+
|
|
1788
|
+
// enum <Name> { ... }
|
|
1789
|
+
for (const m of stripped.matchAll(/\benum\s+(\w+)\s*\{/g)) {
|
|
1790
|
+
sigs.push(`enum ${m[1]}`);
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
// service <Name> { ... }
|
|
1794
|
+
for (const m of stripped.matchAll(/\bservice\s+(\w+)\s*\{/g)) {
|
|
1795
|
+
sigs.push(`service ${m[1]}`);
|
|
1796
|
+
}
|
|
1797
|
+
|
|
1798
|
+
// rpc <Name>(<Request>) returns (<Response>)
|
|
1799
|
+
for (const m of stripped.matchAll(
|
|
1800
|
+
/\brpc\s+(\w+)\s*\(\s*(stream\s+)?(\w+)\s*\)\s+returns\s*\(\s*(stream\s+)?(\w+)\s*\)/g
|
|
1801
|
+
)) {
|
|
1802
|
+
const req = `${m[2] || ''}${m[3]}`.trim();
|
|
1803
|
+
const res = `${m[4] || ''}${m[5]}`.trim();
|
|
1804
|
+
sigs.push(`rpc ${m[1]}(${req}) returns (${res})`);
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
// oneof <name>
|
|
1808
|
+
for (const m of stripped.matchAll(/\boneof\s+(\w+)\s*\{/g)) {
|
|
1809
|
+
sigs.push(`oneof ${m[1]}`);
|
|
1810
|
+
}
|
|
1811
|
+
|
|
1812
|
+
// extend <TypeName>
|
|
1813
|
+
for (const m of stripped.matchAll(/\bextend\s+([\w.]+)\s*\{/g)) {
|
|
1814
|
+
sigs.push(`extend ${m[1]}`);
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1817
|
+
return sigs;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
module.exports = { extract };
|
|
1821
|
+
|
|
1822
|
+
};
|
|
1823
|
+
|
|
1824
|
+
// ── ./src/extractors/sql ──
|
|
1825
|
+
__factories["./src/extractors/sql"] = function(module, exports) {
|
|
1826
|
+
|
|
1827
|
+
'use strict';
|
|
1828
|
+
|
|
1829
|
+
/**
|
|
1830
|
+
* Extract signatures from SQL source files.
|
|
1831
|
+
* Captures CREATE TABLE, VIEW, INDEX, FUNCTION, PROCEDURE, TRIGGER, TYPE, SEQUENCE.
|
|
1832
|
+
*
|
|
1833
|
+
* @param {string} src - Raw SQL content
|
|
1834
|
+
* @returns {string[]} Array of signature strings
|
|
1835
|
+
*/
|
|
1836
|
+
function extract(src) {
|
|
1837
|
+
if (!src || typeof src !== 'string') return [];
|
|
1838
|
+
const sigs = [];
|
|
1839
|
+
|
|
1840
|
+
// Strip single-line comments and block comments
|
|
1841
|
+
const stripped = src
|
|
1842
|
+
.replace(/--[^\n]*/g, '')
|
|
1843
|
+
.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
1844
|
+
|
|
1845
|
+
// CREATE TABLE [IF NOT EXISTS] <name> / CREATE [TEMP] TABLE ...
|
|
1846
|
+
for (const m of stripped.matchAll(
|
|
1847
|
+
/CREATE\s+(?:OR\s+REPLACE\s+)?(?:TEMP(?:ORARY)?\s+)?TABLE\s+(?:IF\s+NOT\s+EXISTS\s+)?([`"[\w.]+)/gi
|
|
1848
|
+
)) {
|
|
1849
|
+
sigs.push(`TABLE ${_cleanName(m[1])}`);
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
// CREATE VIEW / MATERIALIZED VIEW
|
|
1853
|
+
for (const m of stripped.matchAll(
|
|
1854
|
+
/CREATE\s+(?:OR\s+REPLACE\s+)?(?:MATERIALIZED\s+)?VIEW\s+(?:IF\s+NOT\s+EXISTS\s+)?([`"[\w.]+)/gi
|
|
1855
|
+
)) {
|
|
1856
|
+
sigs.push(`VIEW ${_cleanName(m[1])}`);
|
|
1857
|
+
}
|
|
1858
|
+
|
|
1859
|
+
// CREATE INDEX / UNIQUE INDEX
|
|
1860
|
+
for (const m of stripped.matchAll(
|
|
1861
|
+
/CREATE\s+(?:UNIQUE\s+)?INDEX\s+(?:CONCURRENTLY\s+)?(?:IF\s+NOT\s+EXISTS\s+)?([`"[\w.]+)\s+ON\s+([`"[\w.]+)/gi
|
|
1862
|
+
)) {
|
|
1863
|
+
sigs.push(`INDEX ${_cleanName(m[1])} ON ${_cleanName(m[2])}`);
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
// CREATE FUNCTION / CREATE OR REPLACE FUNCTION
|
|
1867
|
+
for (const m of stripped.matchAll(
|
|
1868
|
+
/CREATE\s+(?:OR\s+REPLACE\s+)?FUNCTION\s+([`"[\w.]+)\s*\(([^)]*)\)/gi
|
|
1869
|
+
)) {
|
|
1870
|
+
const params = _normalizeParams(m[2]);
|
|
1871
|
+
sigs.push(`FUNCTION ${_cleanName(m[1])}(${params})`);
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
// CREATE PROCEDURE
|
|
1875
|
+
for (const m of stripped.matchAll(
|
|
1876
|
+
/CREATE\s+(?:OR\s+REPLACE\s+)?PROCEDURE\s+([`"[\w.]+)\s*\(([^)]*)\)/gi
|
|
1877
|
+
)) {
|
|
1878
|
+
const params = _normalizeParams(m[2]);
|
|
1879
|
+
sigs.push(`PROCEDURE ${_cleanName(m[1])}(${params})`);
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
// CREATE TRIGGER
|
|
1883
|
+
for (const m of stripped.matchAll(
|
|
1884
|
+
/CREATE\s+(?:OR\s+REPLACE\s+)?(?:CONSTRAINT\s+)?TRIGGER\s+([`"[\w.]+)/gi
|
|
1885
|
+
)) {
|
|
1886
|
+
sigs.push(`TRIGGER ${_cleanName(m[1])}`);
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
// CREATE TYPE (composite, enum, domain)
|
|
1890
|
+
for (const m of stripped.matchAll(
|
|
1891
|
+
/CREATE\s+(?:OR\s+REPLACE\s+)?TYPE\s+([`"[\w.]+)/gi
|
|
1892
|
+
)) {
|
|
1893
|
+
sigs.push(`TYPE ${_cleanName(m[1])}`);
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
// CREATE SEQUENCE
|
|
1897
|
+
for (const m of stripped.matchAll(
|
|
1898
|
+
/CREATE\s+(?:OR\s+REPLACE\s+)?SEQUENCE\s+(?:IF\s+NOT\s+EXISTS\s+)?([`"[\w.]+)/gi
|
|
1899
|
+
)) {
|
|
1900
|
+
sigs.push(`SEQUENCE ${_cleanName(m[1])}`);
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
return sigs;
|
|
1904
|
+
}
|
|
1905
|
+
|
|
1906
|
+
function _cleanName(raw) {
|
|
1907
|
+
return raw.replace(/^[`"[]|[`"\]]+$/g, '').trim();
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
function _normalizeParams(raw) {
|
|
1911
|
+
if (!raw || !raw.trim()) return '';
|
|
1912
|
+
return raw.trim()
|
|
1913
|
+
.split(',')
|
|
1914
|
+
.map((p) => p.trim().replace(/\s+/g, ' ').split(' ').slice(0, 2).join(' '))
|
|
1915
|
+
.filter(Boolean)
|
|
1916
|
+
.join(', ');
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
module.exports = { extract };
|
|
1920
|
+
|
|
1921
|
+
};
|
|
1922
|
+
|
|
1923
|
+
// ── ./src/extractors/terraform ──
|
|
1924
|
+
__factories["./src/extractors/terraform"] = function(module, exports) {
|
|
1925
|
+
|
|
1926
|
+
'use strict';
|
|
1927
|
+
|
|
1928
|
+
/**
|
|
1929
|
+
* Extract signatures from Terraform (.tf / .tfvars) configuration files.
|
|
1930
|
+
* Captures resource, data, module, variable, output, locals, provider,
|
|
1931
|
+
* terraform blocks, and moved/import blocks.
|
|
1932
|
+
*
|
|
1933
|
+
* @param {string} src - Raw Terraform content
|
|
1934
|
+
* @returns {string[]} Array of signature strings
|
|
1935
|
+
*/
|
|
1936
|
+
function extract(src) {
|
|
1937
|
+
if (!src || typeof src !== 'string') return [];
|
|
1938
|
+
const sigs = [];
|
|
1939
|
+
|
|
1940
|
+
// Strip single-line comments
|
|
1941
|
+
const stripped = src
|
|
1942
|
+
.replace(/\/\/[^\n]*/g, '')
|
|
1943
|
+
.replace(/#[^\n]*/g, '')
|
|
1944
|
+
.replace(/\/\*[\s\S]*?\*\//g, '');
|
|
1945
|
+
|
|
1946
|
+
// resource "<type>" "<name>" { ... }
|
|
1947
|
+
for (const m of stripped.matchAll(/\bresource\s+"([^"]+)"\s+"([^"]+)"\s*\{/g)) {
|
|
1948
|
+
sigs.push(`resource "${m[1]}" "${m[2]}"`);
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
// data "<type>" "<name>" { ... }
|
|
1952
|
+
for (const m of stripped.matchAll(/\bdata\s+"([^"]+)"\s+"([^"]+)"\s*\{/g)) {
|
|
1953
|
+
sigs.push(`data "${m[1]}" "${m[2]}"`);
|
|
1954
|
+
}
|
|
1955
|
+
|
|
1956
|
+
// module "<name>" { ... }
|
|
1957
|
+
for (const m of stripped.matchAll(/\bmodule\s+"([^"]+)"\s*\{/g)) {
|
|
1958
|
+
sigs.push(`module "${m[1]}"`);
|
|
1959
|
+
}
|
|
1960
|
+
|
|
1961
|
+
// variable "<name>" { ... }
|
|
1962
|
+
for (const m of stripped.matchAll(/\bvariable\s+"([^"]+)"\s*\{/g)) {
|
|
1963
|
+
sigs.push(`variable "${m[1]}"`);
|
|
1964
|
+
}
|
|
1965
|
+
|
|
1966
|
+
// output "<name>" { ... }
|
|
1967
|
+
for (const m of stripped.matchAll(/\boutput\s+"([^"]+)"\s*\{/g)) {
|
|
1968
|
+
sigs.push(`output "${m[1]}"`);
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
// provider "<name>" { ... }
|
|
1972
|
+
for (const m of stripped.matchAll(/\bprovider\s+"([^"]+)"\s*\{/g)) {
|
|
1973
|
+
sigs.push(`provider "${m[1]}"`);
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
// locals { ... } (just mark presence; key names too noisy to enumerate)
|
|
1977
|
+
if (/\blocals\s*\{/.test(stripped)) {
|
|
1978
|
+
sigs.push('locals { ... }');
|
|
1979
|
+
}
|
|
1980
|
+
|
|
1981
|
+
// terraform { required_providers / backend }
|
|
1982
|
+
if (/\bterraform\s*\{/.test(stripped)) {
|
|
1983
|
+
sigs.push('terraform { ... }');
|
|
1984
|
+
}
|
|
1985
|
+
|
|
1986
|
+
// moved block
|
|
1987
|
+
for (const m of stripped.matchAll(/\bmoved\s*\{[\s\S]*?from\s*=\s*([^\n]+)/g)) {
|
|
1988
|
+
sigs.push(`moved from ${m[1].trim()}`);
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
// import block (Terraform 1.5+)
|
|
1992
|
+
for (const m of stripped.matchAll(/\bimport\s*\{[\s\S]*?to\s*=\s*([^\n]+)/g)) {
|
|
1993
|
+
sigs.push(`import to ${m[1].trim()}`);
|
|
1994
|
+
}
|
|
1995
|
+
|
|
1996
|
+
return sigs;
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
module.exports = { extract };
|
|
2000
|
+
|
|
2001
|
+
};
|
|
2002
|
+
|
|
1683
2003
|
// ── ./src/extractors/deps ──
|
|
1684
2004
|
__factories["./src/extractors/deps"] = function(module, exports) {
|
|
1685
2005
|
|
|
@@ -3700,7 +4020,7 @@ __factories["./src/mcp/server"] = function(module, exports) {
|
|
|
3700
4020
|
|
|
3701
4021
|
const SERVER_INFO = {
|
|
3702
4022
|
name: 'sigmap',
|
|
3703
|
-
version: '3.3.
|
|
4023
|
+
version: '3.3.4',
|
|
3704
4024
|
description: 'SigMap MCP server — code signatures on demand',
|
|
3705
4025
|
};
|
|
3706
4026
|
|
|
@@ -5110,7 +5430,7 @@ const path = require('path');
|
|
|
5110
5430
|
const os = require('os');
|
|
5111
5431
|
const { execSync } = require('child_process');
|
|
5112
5432
|
|
|
5113
|
-
const VERSION = '3.3.
|
|
5433
|
+
const VERSION = '3.3.4';
|
|
5114
5434
|
const MARKER = '\n\n## Auto-generated signatures\n<!-- Updated by gen-context.js -->\n';
|
|
5115
5435
|
|
|
5116
5436
|
function requireSourceOrBundled(key) {
|
package/package.json
CHANGED