@hyperfixi/mcp-server 3.0.0 → 3.1.1
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/index.js +55 -22
- package/package.json +19 -19
package/dist/index.js
CHANGED
|
@@ -2815,6 +2815,30 @@ try {
|
|
|
2815
2815
|
"[mcp:lsp-bridge] @hyperfixi/core/multilingual not available \u2014 hover role inference limited to `set` and `go`"
|
|
2816
2816
|
);
|
|
2817
2817
|
}
|
|
2818
|
+
function parseToInterchange(code) {
|
|
2819
|
+
if (!astToolkit?.fromCoreAST || !parseFunction) return null;
|
|
2820
|
+
const result = parseFunction(code);
|
|
2821
|
+
const errors = Array.isArray(result?.errors) ? result.errors : [];
|
|
2822
|
+
const ast = result?.node ?? null;
|
|
2823
|
+
if (!ast || ast.type === "identifier" && ast.name === "__ERROR__") return { nodes: [], errors };
|
|
2824
|
+
try {
|
|
2825
|
+
const opts = roleInferrer ? { inferRoles: roleInferrer } : void 0;
|
|
2826
|
+
const statements = ast.type === "Program" && Array.isArray(ast.statements) ? ast.statements : [ast];
|
|
2827
|
+
const interchange = statements.flatMap((stmt) => {
|
|
2828
|
+
const converted = astToolkit.fromCoreAST(stmt, opts);
|
|
2829
|
+
return Array.isArray(converted) ? converted : [converted];
|
|
2830
|
+
});
|
|
2831
|
+
const nodes = interchange.filter(
|
|
2832
|
+
// `fromCoreAST` emits an `error` node for a kind it cannot represent
|
|
2833
|
+
// (`def`, `behavior`, …) rather than throwing. That is a converter limit,
|
|
2834
|
+
// not a user error: it must not become a diagnostic or a hover.
|
|
2835
|
+
(n) => n?.type !== "error"
|
|
2836
|
+
);
|
|
2837
|
+
return { nodes, errors };
|
|
2838
|
+
} catch {
|
|
2839
|
+
return { nodes: [], errors };
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2818
2842
|
console.error(
|
|
2819
2843
|
`[mcp:lsp-bridge] capabilities: ast=${!!astToolkit}, parse=${!!parseFunction}, semantic=${!!semanticPackage2}, framework=${!!frameworkIR}, roles=${!!roleInferrer}`
|
|
2820
2844
|
);
|
|
@@ -3040,12 +3064,25 @@ async function getDiagnostics(code, language, _uri) {
|
|
|
3040
3064
|
} catch {
|
|
3041
3065
|
}
|
|
3042
3066
|
}
|
|
3043
|
-
if (diagnostics.length === 0 && astToolkit && parseFunction) {
|
|
3067
|
+
if (diagnostics.length === 0 && astToolkit?.interchangeToLSPDiagnostics && parseFunction) {
|
|
3044
3068
|
try {
|
|
3045
|
-
const
|
|
3046
|
-
|
|
3047
|
-
const
|
|
3048
|
-
|
|
3069
|
+
const parsed = parseToInterchange(code);
|
|
3070
|
+
for (const err of parsed?.errors ?? []) {
|
|
3071
|
+
const line = Math.max(0, (err.line ?? 1) - 1);
|
|
3072
|
+
const character = Math.max(0, err.column ?? 0);
|
|
3073
|
+
diagnostics.push({
|
|
3074
|
+
range: { start: { line, character }, end: { line, character: character + 10 } },
|
|
3075
|
+
severity: 1,
|
|
3076
|
+
// Error
|
|
3077
|
+
code: "parse-error",
|
|
3078
|
+
source: "hyperfixi-mcp",
|
|
3079
|
+
message: err.message
|
|
3080
|
+
});
|
|
3081
|
+
}
|
|
3082
|
+
if (parsed?.nodes.length) {
|
|
3083
|
+
diagnostics.push(
|
|
3084
|
+
...astToolkit.interchangeToLSPDiagnostics(parsed.nodes, { source: "hyperfixi-mcp" })
|
|
3085
|
+
);
|
|
3049
3086
|
}
|
|
3050
3087
|
} catch (parseError) {
|
|
3051
3088
|
diagnostics.push({
|
|
@@ -3295,12 +3332,13 @@ function runSimpleDiagnostics(code, language = "en") {
|
|
|
3295
3332
|
}
|
|
3296
3333
|
async function getCompletions(code, line, character, language, context) {
|
|
3297
3334
|
const completions = [];
|
|
3298
|
-
if (astToolkit && parseFunction) {
|
|
3335
|
+
if (astToolkit?.interchangeToLSPCompletions && parseFunction) {
|
|
3299
3336
|
try {
|
|
3300
|
-
const
|
|
3301
|
-
if (
|
|
3302
|
-
|
|
3303
|
-
|
|
3337
|
+
const parsed = parseToInterchange(code);
|
|
3338
|
+
if (parsed?.nodes.length) {
|
|
3339
|
+
completions.push(
|
|
3340
|
+
...astToolkit.interchangeToLSPCompletions(parsed.nodes, { line, character })
|
|
3341
|
+
);
|
|
3304
3342
|
}
|
|
3305
3343
|
} catch {
|
|
3306
3344
|
}
|
|
@@ -3457,13 +3495,9 @@ function inferContext(beforeCursor) {
|
|
|
3457
3495
|
async function getHoverInfo(code, line, character, language) {
|
|
3458
3496
|
if (astToolkit && parseFunction && astToolkit.fromCoreAST && astToolkit.interchangeToLSPHover) {
|
|
3459
3497
|
try {
|
|
3460
|
-
const
|
|
3461
|
-
if (
|
|
3462
|
-
const
|
|
3463
|
-
ast,
|
|
3464
|
-
roleInferrer ? { inferRoles: roleInferrer } : void 0
|
|
3465
|
-
);
|
|
3466
|
-
const nodes = Array.isArray(interchange) ? interchange : [interchange];
|
|
3498
|
+
const parsed = parseToInterchange(code);
|
|
3499
|
+
if (parsed?.nodes.length) {
|
|
3500
|
+
const nodes = parsed.nodes;
|
|
3467
3501
|
const hoverOptions = {};
|
|
3468
3502
|
if (frameworkIR) {
|
|
3469
3503
|
hoverOptions.renderLSE = (node) => frameworkIR.renderExplicit(frameworkIR.fromInterchangeNode(node));
|
|
@@ -3586,12 +3620,11 @@ function getHoverDocumentation(word, language = "en") {
|
|
|
3586
3620
|
}
|
|
3587
3621
|
async function getDocumentSymbols(code, language) {
|
|
3588
3622
|
const symbols = [];
|
|
3589
|
-
if (astToolkit && parseFunction) {
|
|
3623
|
+
if (astToolkit?.interchangeToLSPSymbols && parseFunction) {
|
|
3590
3624
|
try {
|
|
3591
|
-
const
|
|
3592
|
-
if (
|
|
3593
|
-
|
|
3594
|
-
symbols.push(...astSymbols);
|
|
3625
|
+
const parsed = parseToInterchange(code);
|
|
3626
|
+
if (parsed?.nodes.length) {
|
|
3627
|
+
symbols.push(...astToolkit.interchangeToLSPSymbols(parsed.nodes));
|
|
3595
3628
|
}
|
|
3596
3629
|
} catch {
|
|
3597
3630
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperfixi/mcp-server",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Model Context Protocol server for HyperFixi hyperscript development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -37,22 +37,22 @@
|
|
|
37
37
|
"author": "LokaScript Contributors",
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@hyperfixi/patterns-reference": "^3.
|
|
41
|
-
"@lokascript/compilation-service": "^3.
|
|
42
|
-
"@lokascript/domains": "^
|
|
43
|
-
"@lokascript/framework": "^3.
|
|
44
|
-
"@lokascript/planner": "^3.
|
|
45
|
-
"@lokascript/semantic": "^3.
|
|
40
|
+
"@hyperfixi/patterns-reference": "^3.1.1",
|
|
41
|
+
"@lokascript/compilation-service": "^3.1.1",
|
|
42
|
+
"@lokascript/domains": "^3.0.0",
|
|
43
|
+
"@lokascript/framework": "^3.1.1",
|
|
44
|
+
"@lokascript/planner": "^3.1.1",
|
|
45
|
+
"@lokascript/semantic": "^3.1.1",
|
|
46
46
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
47
47
|
"yaml": "^2.8.3"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@hyperfixi/core": "^3.
|
|
51
|
-
"@hyperfixi/patterns-reference": "^3.
|
|
52
|
-
"@hyperfixi/server-bridge": "^3.
|
|
53
|
-
"@lokascript/compilation-service": "^3.
|
|
54
|
-
"@lokascript/framework": "^3.
|
|
55
|
-
"@lokascript/semantic": "^3.
|
|
50
|
+
"@hyperfixi/core": "^3.1.1",
|
|
51
|
+
"@hyperfixi/patterns-reference": "^3.1.1",
|
|
52
|
+
"@hyperfixi/server-bridge": "^3.1.1",
|
|
53
|
+
"@lokascript/compilation-service": "^3.1.1",
|
|
54
|
+
"@lokascript/framework": "^3.1.1",
|
|
55
|
+
"@lokascript/semantic": "^3.1.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependenciesMeta": {
|
|
58
58
|
"@lokascript/compilation-service": {
|
|
@@ -75,12 +75,12 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"devDependencies": {
|
|
78
|
-
"@hyperfixi/core": "^3.
|
|
79
|
-
"@hyperfixi/patterns-reference": "^3.
|
|
80
|
-
"@hyperfixi/server-bridge": "^3.
|
|
81
|
-
"@lokascript/compilation-service": "^3.
|
|
82
|
-
"@lokascript/framework": "^3.
|
|
83
|
-
"@lokascript/semantic": "^3.
|
|
78
|
+
"@hyperfixi/core": "^3.1.1",
|
|
79
|
+
"@hyperfixi/patterns-reference": "^3.1.1",
|
|
80
|
+
"@hyperfixi/server-bridge": "^3.1.1",
|
|
81
|
+
"@lokascript/compilation-service": "^3.1.1",
|
|
82
|
+
"@lokascript/framework": "^3.1.1",
|
|
83
|
+
"@lokascript/semantic": "^3.1.1",
|
|
84
84
|
"@types/node": "^26.1.2",
|
|
85
85
|
"tsup": "^8.0.0",
|
|
86
86
|
"tsx": "^4.23.1",
|