knodin 0.7.3 → 0.7.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/dist/src/structural-fast-path.js +45 -10
- package/docs/releases/0.7.4.md +17 -0
- package/package.json +2 -1
|
@@ -54,6 +54,43 @@ function lexicalEndLine(lines, startIndex, python) {
|
|
|
54
54
|
}
|
|
55
55
|
return startIndex + 1;
|
|
56
56
|
}
|
|
57
|
+
function genericFunctionSymbol(line) {
|
|
58
|
+
const opening = line.indexOf("(");
|
|
59
|
+
if (opening <= 0)
|
|
60
|
+
return null;
|
|
61
|
+
let depth = 0;
|
|
62
|
+
let closing = -1;
|
|
63
|
+
for (let index = opening; index < line.length; index += 1) {
|
|
64
|
+
if (line[index] === "(")
|
|
65
|
+
depth += 1;
|
|
66
|
+
if (line[index] !== ")")
|
|
67
|
+
continue;
|
|
68
|
+
depth -= 1;
|
|
69
|
+
if (depth === 0) {
|
|
70
|
+
closing = index;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (closing < 0)
|
|
75
|
+
return null;
|
|
76
|
+
const suffix = line.slice(closing + 1).trimStart();
|
|
77
|
+
if (!suffix.startsWith("{") && !suffix.startsWith("=>"))
|
|
78
|
+
return null;
|
|
79
|
+
const prefix = line.slice(0, opening).trim();
|
|
80
|
+
if (/[=;{}()]/.test(prefix))
|
|
81
|
+
return null;
|
|
82
|
+
const tokens = prefix.split(/\s+/);
|
|
83
|
+
const symbol = tokens.at(-1) ?? "";
|
|
84
|
+
return tokens.length >= 2 && /^[A-Za-z_$][\w$]*$/.test(symbol) ? symbol : null;
|
|
85
|
+
}
|
|
86
|
+
function firstPatternSymbol(line, patterns) {
|
|
87
|
+
for (const { kind, expression } of patterns) {
|
|
88
|
+
const match = expression.exec(line);
|
|
89
|
+
if (match)
|
|
90
|
+
return { kind, symbol: match[1] };
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
57
94
|
function directSymbols(filePath, content) {
|
|
58
95
|
const extension = path.extname(filePath).toLowerCase();
|
|
59
96
|
const python = extension === ".py";
|
|
@@ -73,21 +110,20 @@ function directSymbols(filePath, content) {
|
|
|
73
110
|
kind: "function",
|
|
74
111
|
expression: /^\s*(?:(?:export|public|private|protected|internal|async|static|final|pub(?:\([^)]*\))?)\s+)*(?:func|fn|function)\s+([A-Za-z_$][\w$]*)\s*\(/,
|
|
75
112
|
},
|
|
76
|
-
{
|
|
77
|
-
kind: "function",
|
|
78
|
-
expression: /^\s*(?:(?:export|public|private|protected|internal|async|static|final)\s+)*(?:[A-Za-z_$][\w$<>,.?[\]\s:*&]+\s+)+([A-Za-z_$][\w$]*)\s*\([^;]*\)\s*(?:\{|=>)/,
|
|
79
|
-
},
|
|
80
113
|
{
|
|
81
114
|
kind: "function",
|
|
82
115
|
expression: /^\s*(?:(?:export|const|let|var|public|private|protected|static|readonly)\s+)*([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>/,
|
|
83
116
|
},
|
|
84
117
|
];
|
|
85
118
|
for (const [index, line] of lines.entries()) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
119
|
+
let found = firstPatternSymbol(line, patterns);
|
|
120
|
+
if (!found && !python) {
|
|
121
|
+
const symbol = genericFunctionSymbol(line);
|
|
122
|
+
if (symbol)
|
|
123
|
+
found = { kind: "function", symbol };
|
|
124
|
+
}
|
|
125
|
+
if (found) {
|
|
126
|
+
const { kind, symbol } = found;
|
|
91
127
|
const visibility = line.match(/\b(public|private|protected|internal)\b/)?.[1] ??
|
|
92
128
|
(python && symbol.startsWith("_") ? "private" : "default");
|
|
93
129
|
symbols.push({
|
|
@@ -104,7 +140,6 @@ function directSymbols(filePath, content) {
|
|
|
104
140
|
exported: /\bexport\b/.test(line) || /\bpub\b/.test(line),
|
|
105
141
|
evidenceQuality: "lexical-structural-fallback",
|
|
106
142
|
});
|
|
107
|
-
break;
|
|
108
143
|
}
|
|
109
144
|
}
|
|
110
145
|
return symbols;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# knodin 0.7.4
|
|
2
|
+
|
|
3
|
+
This patch release preserves the opt-in diagnostics and support-bundle workflow
|
|
4
|
+
introduced in 0.7.3 while hardening the structural cold-start parser.
|
|
5
|
+
|
|
6
|
+
- Replaces a potentially super-linear declaration-matching expression with a
|
|
7
|
+
bounded, linear parser for typed function declarations.
|
|
8
|
+
- Handles balanced parameter lists without mistaking calls or control-flow
|
|
9
|
+
statements for declarations.
|
|
10
|
+
- Adds regression coverage for typed declarations, nested calls, and negative
|
|
11
|
+
structural matches.
|
|
12
|
+
|
|
13
|
+
Diagnostics remain local and disabled until a user enables them. Knodin never
|
|
14
|
+
uploads a diagnostics bundle automatically; the user must inspect and
|
|
15
|
+
deliberately share it for troubleshooting.
|
|
16
|
+
|
|
17
|
+
This remains an ordinary 0.x release, not a dogfood-only build and not GA.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "knodin",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "knodin — source-evidenced local code intelligence with known bounds. Stable identity, fresh evidence, truthful budgets, and recoverable bounded views.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"docs/releases/0.7.1.md",
|
|
50
50
|
"docs/releases/0.7.2.md",
|
|
51
51
|
"docs/releases/0.7.3.md",
|
|
52
|
+
"docs/releases/0.7.4.md",
|
|
52
53
|
"docs/assets/knodin-favicon.svg",
|
|
53
54
|
"docs/SYSTEMS-AND-RELATIONSHIPS.md",
|
|
54
55
|
"docs/TELEMETRY.md",
|