@mandujs/mcp 0.29.0 → 0.31.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/package.json +3 -3
- package/src/resources/skills/loader.ts +218 -218
- package/src/resources/skills/mandu-deployment/rules/db-provider-supabase.md +300 -0
- package/src/server.ts +2 -1
- package/src/tools/ai-brief.ts +443 -443
- package/src/tools/ate-run.ts +13 -2
- package/src/tools/ate.ts +52 -3
- package/src/tools/brain.ts +37 -1
- package/src/tools/decisions.ts +270 -270
- package/src/tools/docs.ts +349 -0
- package/src/tools/extract-contract.ts +406 -406
- package/src/tools/guard.ts +56 -3
- package/src/tools/index.ts +4 -0
- package/src/tools/migrate-route-conventions.ts +345 -345
- package/src/tools/project.ts +128 -35
- package/src/tools/resource.ts +2 -1
- package/src/tools/rewrite-generated-barrel.ts +403 -403
- package/src/resources/skills/mandu-deployment/rules/deploy-platform-supabase.md +0 -323
package/src/tools/guard.ts
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
applyHealing,
|
|
11
11
|
healAll,
|
|
12
12
|
explainRule,
|
|
13
|
+
// Follow-up E — type-aware lint bridge
|
|
14
|
+
runTsgolint,
|
|
13
15
|
type GuardConfig,
|
|
14
16
|
type ViolationType,
|
|
15
17
|
type GuardPreset,
|
|
@@ -20,7 +22,7 @@ export const guardToolDefinitions: Tool[] = [
|
|
|
20
22
|
{
|
|
21
23
|
name: "mandu.guard.check",
|
|
22
24
|
description:
|
|
23
|
-
"Run guard checks to validate spec integrity, generated files, and slot files",
|
|
25
|
+
"Run guard checks to validate spec integrity, generated files, and slot files. Set typeAware=true to additionally run `oxlint --type-aware` (tsgolint) and merge its results.",
|
|
24
26
|
annotations: {
|
|
25
27
|
readOnlyHint: true,
|
|
26
28
|
},
|
|
@@ -31,6 +33,11 @@ export const guardToolDefinitions: Tool[] = [
|
|
|
31
33
|
type: "boolean",
|
|
32
34
|
description: "If true, attempt to automatically fix violations",
|
|
33
35
|
},
|
|
36
|
+
typeAware: {
|
|
37
|
+
type: "boolean",
|
|
38
|
+
description:
|
|
39
|
+
"If true, invoke `oxlint --type-aware` after the architecture check and include its violations in the response under `typeAware`. When the config has `guard.typeAware` set, this defaults to true; set false to opt out for a single call.",
|
|
40
|
+
},
|
|
34
41
|
},
|
|
35
42
|
required: [],
|
|
36
43
|
},
|
|
@@ -119,7 +126,10 @@ export function guardTools(projectRoot: string) {
|
|
|
119
126
|
|
|
120
127
|
const handlers: Record<string, (args: Record<string, unknown>) => Promise<unknown>> = {
|
|
121
128
|
"mandu.guard.check": async (args: Record<string, unknown>) => {
|
|
122
|
-
const { autoCorrect = false } = args as {
|
|
129
|
+
const { autoCorrect = false, typeAware: typeAwareArg } = args as {
|
|
130
|
+
autoCorrect?: boolean;
|
|
131
|
+
typeAware?: boolean;
|
|
132
|
+
};
|
|
123
133
|
|
|
124
134
|
// Load manifest
|
|
125
135
|
const manifestResult = await loadManifest(paths.manifestPath);
|
|
@@ -133,12 +143,53 @@ export function guardTools(projectRoot: string) {
|
|
|
133
143
|
// Run guard check
|
|
134
144
|
const checkResult = await runGuardCheck(manifestResult.data, projectRoot);
|
|
135
145
|
|
|
146
|
+
// Follow-up E — resolve type-aware defaulting from config, then
|
|
147
|
+
// run the bridge when enabled. Result envelope is always included
|
|
148
|
+
// in the tool response so MCP clients have a single stable shape.
|
|
149
|
+
let projectConfig: Awaited<ReturnType<typeof readConfig>> | undefined;
|
|
150
|
+
try {
|
|
151
|
+
projectConfig = await readConfig(projectRoot);
|
|
152
|
+
} catch {
|
|
153
|
+
projectConfig = undefined;
|
|
154
|
+
}
|
|
155
|
+
const typeAwareCfg = (
|
|
156
|
+
projectConfig?.guard as
|
|
157
|
+
| { typeAware?: Record<string, unknown> }
|
|
158
|
+
| undefined
|
|
159
|
+
)?.typeAware;
|
|
160
|
+
const typeAwareEnabled =
|
|
161
|
+
typeAwareArg !== undefined ? typeAwareArg : typeAwareCfg !== undefined;
|
|
162
|
+
|
|
163
|
+
let typeAwareResponse: Record<string, unknown> | undefined;
|
|
164
|
+
if (typeAwareEnabled) {
|
|
165
|
+
const bridge = await runTsgolint({
|
|
166
|
+
projectRoot,
|
|
167
|
+
rules: typeAwareCfg?.rules as string[] | undefined,
|
|
168
|
+
severity: typeAwareCfg?.severity as
|
|
169
|
+
| "off"
|
|
170
|
+
| "warn"
|
|
171
|
+
| "error"
|
|
172
|
+
| undefined,
|
|
173
|
+
configPath: typeAwareCfg?.configPath as string | undefined,
|
|
174
|
+
});
|
|
175
|
+
typeAwareResponse = {
|
|
176
|
+
skipped: bridge.skipped,
|
|
177
|
+
summary: bridge.summary,
|
|
178
|
+
violations: bridge.violations,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
|
|
136
182
|
if (checkResult.passed) {
|
|
137
183
|
return {
|
|
138
|
-
passed:
|
|
184
|
+
passed: typeAwareResponse
|
|
185
|
+
? (typeAwareResponse.violations as Array<{ severity: string }>).filter(
|
|
186
|
+
(v) => v.severity === "error",
|
|
187
|
+
).length === 0
|
|
188
|
+
: true,
|
|
139
189
|
violations: [],
|
|
140
190
|
message: "All guard checks passed",
|
|
141
191
|
relatedSkills: ["mandu-guard-guide", "mandu-debug"],
|
|
192
|
+
...(typeAwareResponse ? { typeAware: typeAwareResponse } : {}),
|
|
142
193
|
};
|
|
143
194
|
}
|
|
144
195
|
|
|
@@ -161,6 +212,7 @@ export function guardTools(projectRoot: string) {
|
|
|
161
212
|
rolledBack: autoCorrectResult.rolledBack,
|
|
162
213
|
changeId: autoCorrectResult.changeId,
|
|
163
214
|
},
|
|
215
|
+
...(typeAwareResponse ? { typeAware: typeAwareResponse } : {}),
|
|
164
216
|
};
|
|
165
217
|
}
|
|
166
218
|
|
|
@@ -175,6 +227,7 @@ export function guardTools(projectRoot: string) {
|
|
|
175
227
|
message: `Found ${checkResult.violations.length} violation(s)`,
|
|
176
228
|
tip: "Use autoCorrect: true to attempt automatic fixes",
|
|
177
229
|
relatedSkills: ["mandu-guard-guide", "mandu-debug"],
|
|
230
|
+
...(typeAwareResponse ? { typeAware: typeAwareResponse } : {}),
|
|
178
231
|
};
|
|
179
232
|
},
|
|
180
233
|
|
package/src/tools/index.ts
CHANGED
|
@@ -65,6 +65,8 @@ export { runTestsTools, runTestsToolDefinitions } from "./run-tests.js";
|
|
|
65
65
|
export { deployPreviewTools, deployPreviewToolDefinitions } from "./deploy-preview.js";
|
|
66
66
|
export { aiBriefTools, aiBriefToolDefinitions } from "./ai-brief.js";
|
|
67
67
|
export { loopCloseTools, loopCloseToolDefinitions } from "./loop-close.js";
|
|
68
|
+
// #243 — docs search/get for agents grounding answers in real framework docs
|
|
69
|
+
export { docsTools, docsToolDefinitions } from "./docs.js";
|
|
68
70
|
// Phase 18.ι — AI refactor MCP tools
|
|
69
71
|
export {
|
|
70
72
|
rewriteGeneratedBarrelTools,
|
|
@@ -135,6 +137,7 @@ import { runTestsTools, runTestsToolDefinitions } from "./run-tests.js";
|
|
|
135
137
|
import { deployPreviewTools, deployPreviewToolDefinitions } from "./deploy-preview.js";
|
|
136
138
|
import { aiBriefTools, aiBriefToolDefinitions } from "./ai-brief.js";
|
|
137
139
|
import { loopCloseTools, loopCloseToolDefinitions } from "./loop-close.js";
|
|
140
|
+
import { docsTools, docsToolDefinitions } from "./docs.js";
|
|
138
141
|
// Phase 18.ι — AI refactor MCP tools
|
|
139
142
|
import {
|
|
140
143
|
rewriteGeneratedBarrelTools,
|
|
@@ -250,6 +253,7 @@ const TOOL_MODULES: ToolModule[] = [
|
|
|
250
253
|
{ category: "deploy-preview", definitions: deployPreviewToolDefinitions, handlers: deployPreviewTools },
|
|
251
254
|
{ category: "ai-brief", definitions: aiBriefToolDefinitions, handlers: aiBriefTools },
|
|
252
255
|
{ category: "loop-close", definitions: loopCloseToolDefinitions, handlers: loopCloseTools },
|
|
256
|
+
{ category: "docs", definitions: docsToolDefinitions, handlers: docsTools },
|
|
253
257
|
// Phase 18.ι — AI refactor tools (destructive writes; dry-run by default)
|
|
254
258
|
{
|
|
255
259
|
category: "refactor-barrel",
|