sigmap 3.4.0 → 3.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.
@@ -0,0 +1,99 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Extract Vue Single-File Component (SFC) signatures from .vue files.
5
+ * Captures component metadata: name, props, emits, slots, composables, lifecycle.
6
+ *
7
+ * @param {string} src - Raw Vue SFC content
8
+ * @returns {string[]} Array of signature strings
9
+ */
10
+ function extract(src) {
11
+ if (!src || typeof src !== 'string') return [];
12
+ const sigs = [];
13
+
14
+ // Extract script block (both <script> and <script setup>)
15
+ const scriptMatch = src.match(/<script[^>]*>([\s\S]*?)<\/script>/);
16
+ if (!scriptMatch) return sigs;
17
+ const script = scriptMatch[1];
18
+
19
+ // Component name (from export default { name: '...' })
20
+ const nameRe = /(?:name\s*:\s*['"`]([a-zA-Z0-9]+)['"`]|export\s+default\s+defineComponent\s*\(\s*{\s*name\s*:\s*['"`]([a-zA-Z0-9]+)['"`])/;
21
+ const nameMatch = script.match(nameRe);
22
+ if (nameMatch) {
23
+ sigs.push(`component ${nameMatch[1] || nameMatch[2]}`);
24
+ }
25
+
26
+ // Props definition
27
+ const propsRe = /props\s*:\s*{([^}]*)}/;
28
+ const propsMatch = script.match(propsRe);
29
+ if (propsMatch) {
30
+ const propLines = propsMatch[1].split(',');
31
+ for (const line of propLines) {
32
+ const propName = line.trim().match(/([a-zA-Z_$]\w*)/);
33
+ if (propName) sigs.push(`prop ${propName[1]}`);
34
+ }
35
+ }
36
+
37
+ // Props in composition API (defineProps)
38
+ const definePropsRe = /defineProps\s*(?:<([^>]+)>)?\s*\(/;
39
+ if (definePropsRe.test(script)) {
40
+ sigs.push('props composition-api');
41
+ }
42
+
43
+ // Emits definition
44
+ const emitsRe = /emits\s*:\s*\[([^\]]+)\]/;
45
+ const emitsMatch = script.match(emitsRe);
46
+ if (emitsMatch) {
47
+ const emitNames = emitsMatch[1].split(',').map(e => e.trim().replace(/['"`]/g, ''));
48
+ for (const e of emitNames) {
49
+ if (e) sigs.push(`emit ${e}`);
50
+ }
51
+ }
52
+
53
+ // Emits in composition API (defineEmits)
54
+ const defineEmitsRe = /defineEmits\s*(?:<([^>]+)>)?\s*\(/;
55
+ if (defineEmitsRe.test(script)) {
56
+ sigs.push('emits composition-api');
57
+ }
58
+
59
+ // Lifecycle hooks
60
+ const lifecycleHooks = ['setup', 'created', 'mounted', 'updated', 'unmounted'];
61
+ for (const hook of lifecycleHooks) {
62
+ if (new RegExp(`\\b${hook}\\s*\\(`).test(script)) {
63
+ sigs.push(`lifecycle ${hook}`);
64
+ }
65
+ }
66
+
67
+ // Composable/hooks usage (useXxx)
68
+ const composableRe = /(?:import|const)\s+(?:{[^}]*}|[a-zA-Z_$]\w*)\s+from\s+['"]/g;
69
+ if (composableRe.test(script)) {
70
+ const useRe = /use([A-Z]\w*)/g;
71
+ for (const m of script.matchAll(useRe)) {
72
+ sigs.push(`composable use${m[1]}`);
73
+ }
74
+ }
75
+
76
+ // Slots definition — capture from <slot name="..."> and template slots
77
+ const namedSlotRe = /<slot\s+name=['"]([a-zA-Z_$]\w*)['"][^>]*>/g;
78
+ const templateSlotRe = /<template\s+#([a-zA-Z_$]\w*)|v-slot:([a-zA-Z_$]\w*)/g;
79
+ const slots = new Set();
80
+
81
+ // Named slots in template: <slot name="header">
82
+ for (const m of src.matchAll(namedSlotRe)) {
83
+ if (m[1]) slots.add(m[1]);
84
+ }
85
+
86
+ // Template slots with # or v-slot
87
+ for (const m of src.matchAll(templateSlotRe)) {
88
+ const slotName = m[1] || m[2];
89
+ if (slotName) slots.add(slotName);
90
+ }
91
+
92
+ for (const s of slots) {
93
+ sigs.push(`slot ${s}`);
94
+ }
95
+
96
+ return Array.from(new Set(sigs)).slice(0, 50);
97
+ }
98
+
99
+ module.exports = { extract };
package/src/mcp/server.js CHANGED
@@ -18,7 +18,7 @@ const { readContext, searchSignatures, getMap, createCheckpoint, getRouting, exp
18
18
 
19
19
  const SERVER_INFO = {
20
20
  name: 'sigmap',
21
- version: '3.4.0',
21
+ version: '3.5.0',
22
22
  description: 'SigMap MCP server — code signatures on demand',
23
23
  };
24
24