dexe-mcp 0.1.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/.mcp.example.json +8 -0
- package/FUTURE.md +37 -0
- package/LICENSE +21 -0
- package/PLAN.md +132 -0
- package/README.md +126 -0
- package/dist/artifacts.d.ts +69 -0
- package/dist/artifacts.d.ts.map +1 -0
- package/dist/artifacts.js +181 -0
- package/dist/artifacts.js.map +1 -0
- package/dist/bootstrap.d.ts +12 -0
- package/dist/bootstrap.d.ts.map +1 -0
- package/dist/bootstrap.js +83 -0
- package/dist/bootstrap.js.map +1 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +40 -0
- package/dist/config.js.map +1 -0
- package/dist/hardhat.d.ts +26 -0
- package/dist/hardhat.d.ts.map +1 -0
- package/dist/hardhat.js +87 -0
- package/dist/hardhat.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/decoders.d.ts +51 -0
- package/dist/lib/decoders.d.ts.map +1 -0
- package/dist/lib/decoders.js +122 -0
- package/dist/lib/decoders.js.map +1 -0
- package/dist/lib/govAddresses.d.ts +35 -0
- package/dist/lib/govAddresses.d.ts.map +1 -0
- package/dist/lib/govAddresses.js +51 -0
- package/dist/lib/govAddresses.js.map +1 -0
- package/dist/lib/selectors.d.ts +31 -0
- package/dist/lib/selectors.d.ts.map +1 -0
- package/dist/lib/selectors.js +110 -0
- package/dist/lib/selectors.js.map +1 -0
- package/dist/rpc.d.ts +14 -0
- package/dist/rpc.d.ts.map +1 -0
- package/dist/rpc.js +23 -0
- package/dist/rpc.js.map +1 -0
- package/dist/tools/build.d.ts +21 -0
- package/dist/tools/build.d.ts.map +1 -0
- package/dist/tools/build.js +281 -0
- package/dist/tools/build.js.map +1 -0
- package/dist/tools/context.d.ts +16 -0
- package/dist/tools/context.d.ts.map +1 -0
- package/dist/tools/context.js +2 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/gov.d.ts +4 -0
- package/dist/tools/gov.d.ts.map +1 -0
- package/dist/tools/gov.js +302 -0
- package/dist/tools/gov.js.map +1 -0
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +21 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/introspect.d.ts +4 -0
- package/dist/tools/introspect.d.ts.map +1 -0
- package/dist/tools/introspect.js +312 -0
- package/dist/tools/introspect.js.map +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Interface } from "ethers";
|
|
2
|
+
/**
|
|
3
|
+
* Lazy, memoized selector index over all loaded contract artifacts.
|
|
4
|
+
* Built on first query; invalidated when the underlying artifact cache is.
|
|
5
|
+
* Supports collisions — the same 4-byte selector can appear in multiple contracts.
|
|
6
|
+
*/
|
|
7
|
+
export class SelectorIndex {
|
|
8
|
+
artifacts;
|
|
9
|
+
built = false;
|
|
10
|
+
byFunctionSelector = new Map();
|
|
11
|
+
byEventTopic = new Map();
|
|
12
|
+
byErrorSelector = new Map();
|
|
13
|
+
lastCacheStamp = null;
|
|
14
|
+
constructor(artifacts) {
|
|
15
|
+
this.artifacts = artifacts;
|
|
16
|
+
}
|
|
17
|
+
/** Build the index (idempotent). Called automatically by find/forContract. */
|
|
18
|
+
ensureBuilt() {
|
|
19
|
+
// Tie rebuild to the artifacts list identity — invalidate() creates a new one.
|
|
20
|
+
const stamp = this.artifacts.list();
|
|
21
|
+
if (this.built && stamp === this.lastCacheStamp)
|
|
22
|
+
return;
|
|
23
|
+
this.byFunctionSelector.clear();
|
|
24
|
+
this.byEventTopic.clear();
|
|
25
|
+
this.byErrorSelector.clear();
|
|
26
|
+
for (const record of stamp) {
|
|
27
|
+
this.indexContract(record);
|
|
28
|
+
}
|
|
29
|
+
this.built = true;
|
|
30
|
+
this.lastCacheStamp = stamp;
|
|
31
|
+
}
|
|
32
|
+
indexContract(record) {
|
|
33
|
+
let iface;
|
|
34
|
+
try {
|
|
35
|
+
iface = new Interface(record.abi);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return; // tolerate malformed ABIs
|
|
39
|
+
}
|
|
40
|
+
iface.forEachFunction((fn) => {
|
|
41
|
+
const hit = {
|
|
42
|
+
contract: record.contractName,
|
|
43
|
+
sourceName: record.sourceName,
|
|
44
|
+
signature: fn.format("sighash"),
|
|
45
|
+
selector: fn.selector,
|
|
46
|
+
kind: "function",
|
|
47
|
+
};
|
|
48
|
+
push(this.byFunctionSelector, fn.selector, hit);
|
|
49
|
+
});
|
|
50
|
+
iface.forEachEvent((ev) => {
|
|
51
|
+
const hit = {
|
|
52
|
+
contract: record.contractName,
|
|
53
|
+
sourceName: record.sourceName,
|
|
54
|
+
signature: ev.format("sighash"),
|
|
55
|
+
selector: ev.topicHash,
|
|
56
|
+
kind: "event",
|
|
57
|
+
};
|
|
58
|
+
push(this.byEventTopic, ev.topicHash, hit);
|
|
59
|
+
});
|
|
60
|
+
iface.forEachError((err) => {
|
|
61
|
+
const hit = {
|
|
62
|
+
contract: record.contractName,
|
|
63
|
+
sourceName: record.sourceName,
|
|
64
|
+
signature: err.format("sighash"),
|
|
65
|
+
selector: err.selector,
|
|
66
|
+
kind: "error",
|
|
67
|
+
};
|
|
68
|
+
push(this.byErrorSelector, err.selector, hit);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/** Look up a selector or event topic. Accepts function selector (4B), error selector (4B), or event topic (32B). */
|
|
72
|
+
find(selector) {
|
|
73
|
+
this.ensureBuilt();
|
|
74
|
+
const s = selector.toLowerCase();
|
|
75
|
+
return [
|
|
76
|
+
...(this.byFunctionSelector.get(s) ?? []),
|
|
77
|
+
...(this.byErrorSelector.get(s) ?? []),
|
|
78
|
+
...(this.byEventTopic.get(s) ?? []),
|
|
79
|
+
];
|
|
80
|
+
}
|
|
81
|
+
/** All selectors exposed by a single contract. */
|
|
82
|
+
forContract(contractName) {
|
|
83
|
+
this.ensureBuilt();
|
|
84
|
+
const out = [];
|
|
85
|
+
for (const hits of this.byFunctionSelector.values()) {
|
|
86
|
+
for (const h of hits)
|
|
87
|
+
if (h.contract === contractName)
|
|
88
|
+
out.push(h);
|
|
89
|
+
}
|
|
90
|
+
for (const hits of this.byEventTopic.values()) {
|
|
91
|
+
for (const h of hits)
|
|
92
|
+
if (h.contract === contractName)
|
|
93
|
+
out.push(h);
|
|
94
|
+
}
|
|
95
|
+
for (const hits of this.byErrorSelector.values()) {
|
|
96
|
+
for (const h of hits)
|
|
97
|
+
if (h.contract === contractName)
|
|
98
|
+
out.push(h);
|
|
99
|
+
}
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function push(m, k, v) {
|
|
104
|
+
const existing = m.get(k);
|
|
105
|
+
if (existing)
|
|
106
|
+
existing.push(v);
|
|
107
|
+
else
|
|
108
|
+
m.set(k, [v]);
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=selectors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.js","sourceRoot":"","sources":["../../src/lib/selectors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAanC;;;;GAIG;AACH,MAAM,OAAO,aAAa;IAOK;IANrB,KAAK,GAAG,KAAK,CAAC;IACd,kBAAkB,GAAG,IAAI,GAAG,EAAyB,CAAC;IACtD,YAAY,GAAG,IAAI,GAAG,EAAyB,CAAC;IAChD,eAAe,GAAG,IAAI,GAAG,EAAyB,CAAC;IACnD,cAAc,GAAY,IAAI,CAAC;IAEvC,YAA6B,SAAoB;QAApB,cAAS,GAAT,SAAS,CAAW;IAAG,CAAC;IAErD,8EAA8E;IACtE,WAAW;QACjB,+EAA+E;QAC/E,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;Q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KAAK,MAAM,CAAC,IAAI,IAAI;gBAAE,IAAI,CAAC,CAAC,QAAQ,KAAK,YAAY;oBAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrE,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC;YAC9C,KAAK,MAAM,CAAC,IAAI,IAAI;gBAAE,IAAI,CAAC,CAAC,QAAQ,KAAK,YAAY;oBAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrE,CAAC;QACD,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,EAAE,CAAC;YACjD,KAAK,MAAM,CAAC,IAAI,IAAI;gBAAE,IAAI,CAAC,CAAC,QAAQ,KAAK,YAAY;oBAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,SAAS,IAAI,CAAO,CAAc,EAAE,CAAI,EAAE,CAAI;IAC5C,MAAM,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC1B,IAAI,QAAQ;QAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;QAC1B,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC"}
|
package/dist/rpc.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { JsonRpcProvider } from "ethers";
|
|
2
|
+
import type { DexeConfig } from "./config.js";
|
|
3
|
+
/**
|
|
4
|
+
* Lazy ethers v6 provider factory. Gov tools that need an RPC endpoint call
|
|
5
|
+
* `requireProvider()`; tools that don't (decode_calldata, list_gov_contract_types)
|
|
6
|
+
* never touch this module. Single-shared-provider per process.
|
|
7
|
+
*/
|
|
8
|
+
export declare class RpcProvider {
|
|
9
|
+
private readonly config;
|
|
10
|
+
private provider;
|
|
11
|
+
constructor(config: DexeConfig);
|
|
12
|
+
requireProvider(): JsonRpcProvider;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=rpc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;GAIG;AACH,qBAAa,WAAW;IAGV,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,OAAO,CAAC,QAAQ,CAAgC;gBAEnB,MAAM,EAAE,UAAU;IAE/C,eAAe,IAAI,eAAe;CAWnC"}
|
package/dist/rpc.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { JsonRpcProvider } from "ethers";
|
|
2
|
+
/**
|
|
3
|
+
* Lazy ethers v6 provider factory. Gov tools that need an RPC endpoint call
|
|
4
|
+
* `requireProvider()`; tools that don't (decode_calldata, list_gov_contract_types)
|
|
5
|
+
* never touch this module. Single-shared-provider per process.
|
|
6
|
+
*/
|
|
7
|
+
export class RpcProvider {
|
|
8
|
+
config;
|
|
9
|
+
provider = null;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
requireProvider() {
|
|
14
|
+
if (!this.config.rpcUrl) {
|
|
15
|
+
throw new Error("DEXE_RPC_URL is not set. This tool requires a JSON-RPC endpoint — add DEXE_RPC_URL to the MCP env block.");
|
|
16
|
+
}
|
|
17
|
+
if (!this.provider) {
|
|
18
|
+
this.provider = new JsonRpcProvider(this.config.rpcUrl);
|
|
19
|
+
}
|
|
20
|
+
return this.provider;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=rpc.js.map
|
package/dist/rpc.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAGzC;;;;GAIG;AACH,MAAM,OAAO,WAAW;IAGO;IAFrB,QAAQ,GAA2B,IAAI,CAAC;IAEhD,YAA6B,MAAkB;QAAlB,WAAM,GAAN,MAAM,CAAY;IAAG,CAAC;IAEnD,eAAe;QACb,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CACb,0GAA0G,CAC3G,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnB,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { ToolContext } from "./context.js";
|
|
3
|
+
export declare function registerBuildTools(server: McpServer, ctx: ToolContext): void;
|
|
4
|
+
export declare function parseSolcDiagnostics(text: string): Array<{
|
|
5
|
+
severity: "error" | "warning";
|
|
6
|
+
code?: string;
|
|
7
|
+
message: string;
|
|
8
|
+
file?: string;
|
|
9
|
+
line?: number;
|
|
10
|
+
}>;
|
|
11
|
+
export interface MochaParseResult {
|
|
12
|
+
passing: number;
|
|
13
|
+
failing: number;
|
|
14
|
+
pending: number;
|
|
15
|
+
failures: Array<{
|
|
16
|
+
title: string;
|
|
17
|
+
error: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export declare function parseMocha(text: string): MochaParseResult;
|
|
21
|
+
//# sourceMappingURL=build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/tools/build.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAK5E;AA4ED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IACxD,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC,CAaD;AAsED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAgBzD"}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { readFileSync, existsSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
export function registerBuildTools(server, ctx) {
|
|
5
|
+
registerCompile(server, ctx);
|
|
6
|
+
registerTest(server, ctx);
|
|
7
|
+
registerCoverage(server, ctx);
|
|
8
|
+
registerLint(server, ctx);
|
|
9
|
+
}
|
|
10
|
+
// ---------- dexe_compile ----------
|
|
11
|
+
function registerCompile(server, ctx) {
|
|
12
|
+
server.registerTool("dexe_compile", {
|
|
13
|
+
title: "Compile DeXe-Protocol",
|
|
14
|
+
description: "Runs `npm run compile` in DEXE_PROTOCOL_PATH. Parses solc diagnostics and invalidates the artifact cache on success. Must be called at least once per session before introspection tools can read artifacts.",
|
|
15
|
+
inputSchema: {
|
|
16
|
+
// The current protocol's `compile` script already passes `--force`;
|
|
17
|
+
// keep this input for forward-compat and ignore it for now.
|
|
18
|
+
force: z.boolean().optional().describe("Forward-compat only — the current compile script always forces."),
|
|
19
|
+
},
|
|
20
|
+
outputSchema: {
|
|
21
|
+
success: z.boolean(),
|
|
22
|
+
errorCount: z.number(),
|
|
23
|
+
warningCount: z.number(),
|
|
24
|
+
diagnostics: z.array(z.object({
|
|
25
|
+
severity: z.enum(["error", "warning"]),
|
|
26
|
+
code: z.string().optional(),
|
|
27
|
+
message: z.string(),
|
|
28
|
+
file: z.string().optional(),
|
|
29
|
+
line: z.number().optional(),
|
|
30
|
+
})),
|
|
31
|
+
durationMs: z.number(),
|
|
32
|
+
logFile: z.string(),
|
|
33
|
+
stdoutTail: z.string(),
|
|
34
|
+
},
|
|
35
|
+
}, async () => {
|
|
36
|
+
const result = await ctx.runner.runNpmScript("compile");
|
|
37
|
+
const diags = parseSolcDiagnostics(result.stdout + "\n" + result.stderr);
|
|
38
|
+
const success = result.exitCode === 0;
|
|
39
|
+
if (success)
|
|
40
|
+
ctx.artifacts.invalidate();
|
|
41
|
+
const structured = {
|
|
42
|
+
success,
|
|
43
|
+
errorCount: diags.filter((d) => d.severity === "error").length,
|
|
44
|
+
warningCount: diags.filter((d) => d.severity === "warning").length,
|
|
45
|
+
diagnostics: diags.slice(0, 20),
|
|
46
|
+
durationMs: result.durationMs,
|
|
47
|
+
logFile: result.logFile,
|
|
48
|
+
stdoutTail: result.stdoutTail,
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{
|
|
53
|
+
type: "text",
|
|
54
|
+
text: summarizeCompile(structured, result),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
structuredContent: structured,
|
|
58
|
+
isError: !success,
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function summarizeCompile(s, r) {
|
|
63
|
+
const header = s.success
|
|
64
|
+
? `Compile OK (${s.warningCount} warning${s.warningCount === 1 ? "" : "s"}) in ${(s.durationMs / 1000).toFixed(1)}s`
|
|
65
|
+
: `Compile FAILED (${s.errorCount} error${s.errorCount === 1 ? "" : "s"}, ${s.warningCount} warning${s.warningCount === 1 ? "" : "s"}) in ${(s.durationMs / 1000).toFixed(1)}s`;
|
|
66
|
+
return `${header}\nFull log: ${s.logFile}\n\n--- tail ---\n${r.stdoutTail || "(empty)"}`;
|
|
67
|
+
}
|
|
68
|
+
const SOLC_DIAG = /^(Error|Warning)(?:\s*\(([^)]+)\))?:\s*(.*?)(?:\n\s*-->\s*([^\s:]+):(\d+):\d+)?/gm;
|
|
69
|
+
export function parseSolcDiagnostics(text) {
|
|
70
|
+
const out = [];
|
|
71
|
+
for (const m of text.matchAll(SOLC_DIAG)) {
|
|
72
|
+
const severity = m[1] === "Error" ? "error" : "warning";
|
|
73
|
+
out.push({
|
|
74
|
+
severity,
|
|
75
|
+
code: m[2],
|
|
76
|
+
message: (m[3] ?? "").trim(),
|
|
77
|
+
file: m[4],
|
|
78
|
+
line: m[5] ? Number(m[5]) : undefined,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
// ---------- dexe_test ----------
|
|
84
|
+
function registerTest(server, ctx) {
|
|
85
|
+
server.registerTool("dexe_test", {
|
|
86
|
+
title: "Run Hardhat tests",
|
|
87
|
+
description: "Runs `npx hardhat test` in DEXE_PROTOCOL_PATH. Optionally filters by mocha --grep or a specific test file. Parses pass/fail counts and captures up to 20 failure bodies.",
|
|
88
|
+
inputSchema: {
|
|
89
|
+
grep: z.string().optional().describe("Mocha --grep pattern"),
|
|
90
|
+
file: z.string().optional().describe("Specific test file path (relative to protocol root)"),
|
|
91
|
+
bail: z.boolean().optional().describe("Stop after first failure"),
|
|
92
|
+
},
|
|
93
|
+
outputSchema: {
|
|
94
|
+
success: z.boolean(),
|
|
95
|
+
passing: z.number(),
|
|
96
|
+
failing: z.number(),
|
|
97
|
+
pending: z.number(),
|
|
98
|
+
failures: z.array(z.object({
|
|
99
|
+
title: z.string(),
|
|
100
|
+
error: z.string(),
|
|
101
|
+
})),
|
|
102
|
+
durationMs: z.number(),
|
|
103
|
+
logFile: z.string(),
|
|
104
|
+
stdoutTail: z.string(),
|
|
105
|
+
},
|
|
106
|
+
}, async ({ grep, file, bail }) => {
|
|
107
|
+
const args = [];
|
|
108
|
+
if (file)
|
|
109
|
+
args.push(file);
|
|
110
|
+
if (grep)
|
|
111
|
+
args.push("--grep", grep);
|
|
112
|
+
if (bail)
|
|
113
|
+
args.push("--bail");
|
|
114
|
+
const result = await ctx.runner.runHardhat("test", args);
|
|
115
|
+
const parsed = parseMocha(result.stdout);
|
|
116
|
+
const success = result.exitCode === 0;
|
|
117
|
+
const structured = {
|
|
118
|
+
success,
|
|
119
|
+
passing: parsed.passing,
|
|
120
|
+
failing: parsed.failing,
|
|
121
|
+
pending: parsed.pending,
|
|
122
|
+
failures: parsed.failures.slice(0, 20),
|
|
123
|
+
durationMs: result.durationMs,
|
|
124
|
+
logFile: result.logFile,
|
|
125
|
+
stdoutTail: result.stdoutTail,
|
|
126
|
+
};
|
|
127
|
+
return {
|
|
128
|
+
content: [
|
|
129
|
+
{
|
|
130
|
+
type: "text",
|
|
131
|
+
text: `Tests: ${structured.passing} passing, ${structured.failing} failing` +
|
|
132
|
+
(structured.pending ? `, ${structured.pending} pending` : "") +
|
|
133
|
+
` (${(result.durationMs / 1000).toFixed(1)}s)\nFull log: ${result.logFile}\n\n--- tail ---\n${result.stdoutTail || "(empty)"}`,
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
structuredContent: structured,
|
|
137
|
+
isError: !success,
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
export function parseMocha(text) {
|
|
142
|
+
const clean = stripAnsi(text);
|
|
143
|
+
const passing = Number(/(\d+)\s+passing/.exec(clean)?.[1] ?? 0);
|
|
144
|
+
const failing = Number(/(\d+)\s+failing/.exec(clean)?.[1] ?? 0);
|
|
145
|
+
const pending = Number(/(\d+)\s+pending/.exec(clean)?.[1] ?? 0);
|
|
146
|
+
const failures = [];
|
|
147
|
+
// Mocha failure blocks: " 1) Test title:" followed by an indented error body.
|
|
148
|
+
const failureRe = /^\s*(\d+)\)\s+(.+?)\n([\s\S]*?)(?=\n\s*\d+\)\s+|\n\s*\d+\s+passing|\n\s*\d+\s+failing|$)/gm;
|
|
149
|
+
for (const m of clean.matchAll(failureRe)) {
|
|
150
|
+
failures.push({
|
|
151
|
+
title: (m[2] ?? "").trim(),
|
|
152
|
+
error: (m[3] ?? "").trim().split("\n").slice(0, 20).join("\n"),
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
return { passing, failing, pending, failures };
|
|
156
|
+
}
|
|
157
|
+
function stripAnsi(s) {
|
|
158
|
+
// eslint-disable-next-line no-control-regex
|
|
159
|
+
return s.replace(/\u001b\[[0-9;]*m/g, "");
|
|
160
|
+
}
|
|
161
|
+
// ---------- dexe_coverage ----------
|
|
162
|
+
function registerCoverage(server, ctx) {
|
|
163
|
+
server.registerTool("dexe_coverage", {
|
|
164
|
+
title: "Run solidity-coverage",
|
|
165
|
+
description: "Runs `npm run coverage` in DEXE_PROTOCOL_PATH and reads coverage/coverage-summary.json for per-file line/branch percentages. Slow — can take several minutes.",
|
|
166
|
+
inputSchema: {
|
|
167
|
+
grep: z.string().optional().describe("Mocha --grep pattern (passed through)"),
|
|
168
|
+
},
|
|
169
|
+
outputSchema: {
|
|
170
|
+
success: z.boolean(),
|
|
171
|
+
total: z
|
|
172
|
+
.object({
|
|
173
|
+
lines: z.number(),
|
|
174
|
+
branches: z.number(),
|
|
175
|
+
functions: z.number(),
|
|
176
|
+
statements: z.number(),
|
|
177
|
+
})
|
|
178
|
+
.optional(),
|
|
179
|
+
files: z.array(z.object({
|
|
180
|
+
file: z.string(),
|
|
181
|
+
lines: z.number(),
|
|
182
|
+
branches: z.number(),
|
|
183
|
+
functions: z.number(),
|
|
184
|
+
statements: z.number(),
|
|
185
|
+
})),
|
|
186
|
+
durationMs: z.number(),
|
|
187
|
+
logFile: z.string(),
|
|
188
|
+
},
|
|
189
|
+
}, async ({ grep }) => {
|
|
190
|
+
const result = grep
|
|
191
|
+
? await ctx.runner.runNpmScript("coverage", ["--grep", grep])
|
|
192
|
+
: await ctx.runner.runNpmScript("coverage");
|
|
193
|
+
const success = result.exitCode === 0;
|
|
194
|
+
const summary = readCoverageSummary(ctx.config.protocolPath);
|
|
195
|
+
const structured = {
|
|
196
|
+
success,
|
|
197
|
+
total: summary?.total,
|
|
198
|
+
files: summary?.files ?? [],
|
|
199
|
+
durationMs: result.durationMs,
|
|
200
|
+
logFile: result.logFile,
|
|
201
|
+
};
|
|
202
|
+
return {
|
|
203
|
+
content: [
|
|
204
|
+
{
|
|
205
|
+
type: "text",
|
|
206
|
+
text: success
|
|
207
|
+
? `Coverage OK (${structured.files.length} files). Lines: ${structured.total?.lines ?? "?"}%, Branches: ${structured.total?.branches ?? "?"}%\nFull log: ${result.logFile}`
|
|
208
|
+
: `Coverage FAILED (exit ${result.exitCode})\nFull log: ${result.logFile}\n\n--- tail ---\n${result.stdoutTail}`,
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
structuredContent: structured,
|
|
212
|
+
isError: !success,
|
|
213
|
+
};
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function readCoverageSummary(protocolPath) {
|
|
217
|
+
const path = join(protocolPath, "coverage", "coverage-summary.json");
|
|
218
|
+
if (!existsSync(path))
|
|
219
|
+
return null;
|
|
220
|
+
try {
|
|
221
|
+
const raw = JSON.parse(readFileSync(path, "utf8"));
|
|
222
|
+
const files = [];
|
|
223
|
+
let total = { lines: 0, branches: 0, functions: 0, statements: 0 };
|
|
224
|
+
for (const [key, entry] of Object.entries(raw)) {
|
|
225
|
+
const rec = {
|
|
226
|
+
file: key,
|
|
227
|
+
lines: entry.lines?.pct ?? 0,
|
|
228
|
+
branches: entry.branches?.pct ?? 0,
|
|
229
|
+
functions: entry.functions?.pct ?? 0,
|
|
230
|
+
statements: entry.statements?.pct ?? 0,
|
|
231
|
+
};
|
|
232
|
+
if (key === "total")
|
|
233
|
+
total = { lines: rec.lines, branches: rec.branches, functions: rec.functions, statements: rec.statements };
|
|
234
|
+
else
|
|
235
|
+
files.push(rec);
|
|
236
|
+
}
|
|
237
|
+
return { total, files };
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
// ---------- dexe_lint ----------
|
|
244
|
+
function registerLint(server, ctx) {
|
|
245
|
+
server.registerTool("dexe_lint", {
|
|
246
|
+
title: "Run protocol linters",
|
|
247
|
+
description: "Runs the protocol's lint scripts. With `fix: true` runs `npm run lint-fix` (chained solhint/eslint/jsonlint fixers). Without, runs `npm run lint-check` if available.",
|
|
248
|
+
inputSchema: {
|
|
249
|
+
fix: z.boolean().optional().describe("Apply fixes in-place"),
|
|
250
|
+
},
|
|
251
|
+
outputSchema: {
|
|
252
|
+
success: z.boolean(),
|
|
253
|
+
script: z.string(),
|
|
254
|
+
durationMs: z.number(),
|
|
255
|
+
logFile: z.string(),
|
|
256
|
+
stdoutTail: z.string(),
|
|
257
|
+
},
|
|
258
|
+
}, async ({ fix }) => {
|
|
259
|
+
const script = fix ? "lint-fix" : "lint-check";
|
|
260
|
+
const result = await ctx.runner.runNpmScript(script);
|
|
261
|
+
const success = result.exitCode === 0;
|
|
262
|
+
const structured = {
|
|
263
|
+
success,
|
|
264
|
+
script,
|
|
265
|
+
durationMs: result.durationMs,
|
|
266
|
+
logFile: result.logFile,
|
|
267
|
+
stdoutTail: result.stdoutTail,
|
|
268
|
+
};
|
|
269
|
+
return {
|
|
270
|
+
content: [
|
|
271
|
+
{
|
|
272
|
+
type: "text",
|
|
273
|
+
text: `${success ? "Lint OK" : `Lint FAILED (exit ${result.exitCode})`} via \`npm run ${script}\` in ${(result.durationMs / 1000).toFixed(1)}s\nFull log: ${result.logFile}\n\n--- tail ---\n${result.stdoutTail || "(empty)"}`,
|
|
274
|
+
},
|
|
275
|
+
],
|
|
276
|
+
structuredContent: structured,
|
|
277
|
+
isError: !success,
|
|
278
|
+
};
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.js","sourceRoot":"","sources":["../../src/tools/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAKjC,MAAM,UAAU,kBAAkB,CAAC,MAAiB,EAAE,GAAgB;IACpE,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,gBAAgB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC;AAED,qCAAqC;AAErC,SAAS,eAAe,CAAC,MAAiB,EAAE,GAAgB;IAC1D,MAAM,CAAC,YAAY,CACjB,cAAc,EACd;QACE,KAAK,EAAE,uBAAuB;QAC9B,WAAW,EACT,8MAA8M;QAChN,WAAW,EAAE;YACX,oEAAoE;YACpE,4DAA4D;YAC5D,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iEAAiE,CAAC;SAC1G;QACD,YAAY,EAAE;YACZ,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;YACpB,UAAU,EAAE,CA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,CAAC,QAAQ,GAAG,kBAAkB,MAAM,SAAS,CAAC,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,MAAM,CAAC,OAAO,qBAAqB,MAAM,CAAC,UAAU,IAAI,SAAS,EAAE;iBAChO;aACF;YACD,iBAAiB,EAAE,UAAU;YAC7B,OAAO,EAAE,CAAC,OAAO;SAClB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DexeConfig } from "../config.js";
|
|
2
|
+
import type { Artifacts } from "../artifacts.js";
|
|
3
|
+
import type { HardhatRunner } from "../hardhat.js";
|
|
4
|
+
import type { SelectorIndex } from "../lib/selectors.js";
|
|
5
|
+
/**
|
|
6
|
+
* Shared dependency bag passed to every tool register() function. Built once
|
|
7
|
+
* in `registerAll` and handed out by reference so all tools share artifact
|
|
8
|
+
* caches, selector indices, and the single-slot hardhat runner.
|
|
9
|
+
*/
|
|
10
|
+
export interface ToolContext {
|
|
11
|
+
readonly config: DexeConfig;
|
|
12
|
+
readonly artifacts: Artifacts;
|
|
13
|
+
readonly runner: HardhatRunner;
|
|
14
|
+
readonly selectors: SelectorIndex;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/tools/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;CACnC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/tools/context.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gov.d.ts","sourceRoot":"","sources":["../../src/tools/gov.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAMhD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,GAAG,IAAI,CAS1E"}
|