@mandujs/mcp 0.38.12 → 0.39.0-beta.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/README.md +3 -3
- package/package.json +3 -5
- package/src/activity-adapter.ts +23 -23
- package/src/activity-monitor.ts +39 -10
- package/src/adapters/index.ts +20 -20
- package/src/adapters/monitor-adapter.ts +100 -100
- package/src/adapters/tool-adapter.ts +90 -90
- package/src/executor/index.ts +22 -22
- package/src/executor/tool-executor.ts +148 -148
- package/src/hooks/config-watcher.ts +173 -173
- package/src/hooks/index.ts +23 -23
- package/src/hooks/mcp-hooks.ts +227 -227
- package/src/index.ts +5 -5
- package/src/logging/index.ts +15 -15
- package/src/logging/mcp-transport.ts +134 -134
- package/src/new-resources.ts +2 -2
- package/src/profiles.ts +25 -54
- package/src/prompts.ts +4 -4
- package/src/registry/index.ts +13 -13
- package/src/registry/mcp-tool-registry.ts +298 -298
- package/src/resources/generated-skills/catalog.ts +36 -0
- package/src/resources/generated-skills/mandu-agent-workflow/SKILL.md +48 -0
- package/src/resources/generated-skills/mandu-contract/SKILL.md +20 -0
- package/src/resources/generated-skills/mandu-fs-routes/SKILL.md +19 -0
- package/src/resources/generated-skills/mandu-guard/SKILL.md +20 -0
- package/src/resources/generated-skills/mandu-hydration/SKILL.md +19 -0
- package/src/resources/generated-skills/mandu-testing/SKILL.md +20 -0
- package/src/resources/handlers.ts +3 -3
- package/src/resources/skills/guides.ts +49 -49
- package/src/resources/skills/index.ts +12 -12
- package/src/resources/skills/loader.ts +8 -35
- package/src/resources/skills/recipes.ts +28 -28
- package/src/server.ts +1 -1
- package/src/tools/agent.ts +479 -409
- package/src/tools/ate-exemplar.ts +92 -92
- package/src/tools/ate-flakes.ts +90 -90
- package/src/tools/ate-mutate.ts +103 -103
- package/src/tools/ate-mutation-report.ts +64 -64
- package/src/tools/ate-oracle-pending.ts +49 -49
- package/src/tools/ate-oracle-replay.ts +44 -44
- package/src/tools/ate-oracle-verdict.ts +70 -70
- package/src/tools/ate-prompt.ts +146 -146
- package/src/tools/ate-run.ts +1 -1
- package/src/tools/ate.ts +38 -38
- package/src/tools/brain.ts +6 -6
- package/src/tools/composite.ts +19 -61
- package/src/tools/contract.ts +11 -9
- package/src/tools/deploy-plan.ts +2 -2
- package/src/tools/deploy-preview.ts +316 -316
- package/src/tools/design.ts +825 -825
- package/src/tools/docs.ts +350 -350
- package/src/tools/generate.ts +4 -3
- package/src/tools/guard.ts +1 -1
- package/src/tools/history.ts +1 -1
- package/src/tools/hydration.ts +64 -64
- package/src/tools/index.ts +0 -118
- package/src/tools/kitchen.ts +72 -72
- package/src/tools/lint.ts +226 -226
- package/src/tools/loop-close.ts +175 -175
- package/src/tools/negotiate.ts +263 -263
- package/src/tools/resource.ts +1 -1
- package/src/tools/run-tests.ts +424 -424
- package/src/tools/runtime.ts +1 -1
- package/src/tools/seo.ts +1 -1
- package/src/tools/slot-validation.ts +19 -19
- package/src/tools/spec.ts +201 -201
- package/src/tools/transaction.ts +1 -1
- package/src/tx-lock.ts +73 -73
- package/src/utils/runtime-control.ts +52 -52
- package/src/utils/withWarnings.ts +1 -1
- package/src/resources/skills/mandu-agent-workflow/SKILL.md +0 -124
- package/src/resources/skills/mandu-agent-workflow/metadata.json +0 -7
- package/src/resources/skills/mandu-composition/SKILL.md +0 -131
- package/src/resources/skills/mandu-composition/metadata.json +0 -13
- package/src/resources/skills/mandu-composition/rules/_sections.md +0 -26
- package/src/resources/skills/mandu-composition/rules/_template.md +0 -77
- package/src/resources/skills/mandu-composition/rules/comp-arch-avoid-boolean-props.md +0 -146
- package/src/resources/skills/mandu-composition/rules/comp-arch-compound-components.md +0 -164
- package/src/resources/skills/mandu-composition/rules/comp-island-event.md +0 -161
- package/src/resources/skills/mandu-composition/rules/comp-island-slot-split.md +0 -167
- package/src/resources/skills/mandu-composition/rules/comp-pattern-children.md +0 -149
- package/src/resources/skills/mandu-composition/rules/comp-state-context-interface.md +0 -148
- package/src/resources/skills/mandu-composition/rules/comp-state-lift-state.md +0 -150
- package/src/resources/skills/mandu-deployment/SKILL.md +0 -135
- package/src/resources/skills/mandu-deployment/_sections.md +0 -41
- package/src/resources/skills/mandu-deployment/_template.md +0 -38
- package/src/resources/skills/mandu-deployment/metadata.json +0 -13
- package/src/resources/skills/mandu-deployment/rules/db-provider-supabase.md +0 -300
- package/src/resources/skills/mandu-deployment/rules/deploy-build-bun.md +0 -109
- package/src/resources/skills/mandu-deployment/rules/deploy-build-output.md +0 -115
- package/src/resources/skills/mandu-deployment/rules/deploy-cicd-github.md +0 -219
- package/src/resources/skills/mandu-deployment/rules/deploy-docker-bun.md +0 -150
- package/src/resources/skills/mandu-deployment/rules/deploy-docker-compose.md +0 -223
- package/src/resources/skills/mandu-deployment/rules/deploy-platform-fly.md +0 -152
- package/src/resources/skills/mandu-deployment/rules/deploy-platform-render.md +0 -179
- package/src/resources/skills/mandu-deployment/rules/deploy-platform-vercel.md +0 -140
- package/src/resources/skills/mandu-fs-routes/SKILL.md +0 -122
- package/src/resources/skills/mandu-fs-routes/metadata.json +0 -12
- package/src/resources/skills/mandu-fs-routes/rules/_sections.md +0 -36
- package/src/resources/skills/mandu-fs-routes/rules/_template.md +0 -69
- package/src/resources/skills/mandu-fs-routes/rules/routes-api-methods.md +0 -65
- package/src/resources/skills/mandu-fs-routes/rules/routes-dynamic-param.md +0 -93
- package/src/resources/skills/mandu-fs-routes/rules/routes-naming-page.md +0 -55
- package/src/resources/skills/mandu-guard/SKILL.md +0 -162
- package/src/resources/skills/mandu-guard/metadata.json +0 -12
- package/src/resources/skills/mandu-guard/rules/_sections.md +0 -36
- package/src/resources/skills/mandu-guard/rules/_template.md +0 -82
- package/src/resources/skills/mandu-guard/rules/guard-config-rules.md +0 -100
- package/src/resources/skills/mandu-guard/rules/guard-layer-direction.md +0 -76
- package/src/resources/skills/mandu-guard/rules/guard-preset-mandu.md +0 -81
- package/src/resources/skills/mandu-guard/rules/guard-validate-import.md +0 -80
- package/src/resources/skills/mandu-hydration/SKILL.md +0 -139
- package/src/resources/skills/mandu-hydration/metadata.json +0 -12
- package/src/resources/skills/mandu-hydration/rules/_sections.md +0 -31
- package/src/resources/skills/mandu-hydration/rules/_template.md +0 -72
- package/src/resources/skills/mandu-hydration/rules/hydration-data-event.md +0 -109
- package/src/resources/skills/mandu-hydration/rules/hydration-directive-use-client.md +0 -55
- package/src/resources/skills/mandu-hydration/rules/hydration-island-setup.md +0 -160
- package/src/resources/skills/mandu-hydration/rules/hydration-priority-visible.md +0 -91
- package/src/resources/skills/mandu-performance/SKILL.md +0 -125
- package/src/resources/skills/mandu-performance/metadata.json +0 -14
- package/src/resources/skills/mandu-performance/rules/_sections.md +0 -31
- package/src/resources/skills/mandu-performance/rules/_template.md +0 -64
- package/src/resources/skills/mandu-performance/rules/perf-async-defer-await.md +0 -103
- package/src/resources/skills/mandu-performance/rules/perf-async-parallel.md +0 -95
- package/src/resources/skills/mandu-performance/rules/perf-bun-file.md +0 -124
- package/src/resources/skills/mandu-performance/rules/perf-bun-serve.md +0 -125
- package/src/resources/skills/mandu-performance/rules/perf-bundle-imports.md +0 -80
- package/src/resources/skills/mandu-performance/rules/perf-bundle-island-lazy.md +0 -145
- package/src/resources/skills/mandu-performance/rules/perf-cache-react.md +0 -98
- package/src/resources/skills/mandu-performance/rules/perf-render-transitions.md +0 -154
- package/src/resources/skills/mandu-security/SKILL.md +0 -127
- package/src/resources/skills/mandu-security/metadata.json +0 -13
- package/src/resources/skills/mandu-security/rules/_sections.md +0 -31
- package/src/resources/skills/mandu-security/rules/_template.md +0 -74
- package/src/resources/skills/mandu-security/rules/sec-auth-guard.md +0 -127
- package/src/resources/skills/mandu-security/rules/sec-env-management.md +0 -133
- package/src/resources/skills/mandu-security/rules/sec-input-validate.md +0 -148
- package/src/resources/skills/mandu-security/rules/sec-protect-csrf.md +0 -146
- package/src/resources/skills/mandu-security/rules/sec-protect-headers.md +0 -138
- package/src/resources/skills/mandu-slot/SKILL.md +0 -125
- package/src/resources/skills/mandu-slot/metadata.json +0 -12
- package/src/resources/skills/mandu-slot/rules/_sections.md +0 -36
- package/src/resources/skills/mandu-slot/rules/_template.md +0 -63
- package/src/resources/skills/mandu-slot/rules/slot-basic-structure.md +0 -38
- package/src/resources/skills/mandu-slot/rules/slot-ctx-response.md +0 -56
- package/src/resources/skills/mandu-slot/rules/slot-guard-auth.md +0 -59
- package/src/resources/skills/mandu-slot/rules/slot-http-methods.md +0 -64
- package/src/resources/skills/mandu-styling/SKILL.md +0 -196
- package/src/resources/skills/mandu-styling/_sections.md +0 -43
- package/src/resources/skills/mandu-styling/_template.md +0 -32
- package/src/resources/skills/mandu-styling/metadata.json +0 -15
- package/src/resources/skills/mandu-styling/rules/style-component-compound.md +0 -235
- package/src/resources/skills/mandu-styling/rules/style-component-slots.md +0 -255
- package/src/resources/skills/mandu-styling/rules/style-component-tokens.md +0 -205
- package/src/resources/skills/mandu-styling/rules/style-island-animations.md +0 -272
- package/src/resources/skills/mandu-styling/rules/style-island-scoping.md +0 -167
- package/src/resources/skills/mandu-styling/rules/style-island-variants.md +0 -221
- package/src/resources/skills/mandu-styling/rules/style-perf-critical.md +0 -209
- package/src/resources/skills/mandu-styling/rules/style-perf-purge.md +0 -192
- package/src/resources/skills/mandu-styling/rules/style-setup-modules.md +0 -162
- package/src/resources/skills/mandu-styling/rules/style-setup-panda.md +0 -164
- package/src/resources/skills/mandu-styling/rules/style-setup-tailwind.md +0 -170
- package/src/resources/skills/mandu-styling/rules/style-tailwind-v4-gotchas.md +0 -179
- package/src/resources/skills/mandu-styling/rules/style-theme-darkmode.md +0 -229
- package/src/resources/skills/mandu-testing/SKILL.md +0 -132
- package/src/resources/skills/mandu-testing/metadata.json +0 -13
- package/src/resources/skills/mandu-testing/rules/_sections.md +0 -26
- package/src/resources/skills/mandu-testing/rules/_template.md +0 -65
- package/src/resources/skills/mandu-testing/rules/test-component-island.md +0 -195
- package/src/resources/skills/mandu-testing/rules/test-e2e-playwright.md +0 -196
- package/src/resources/skills/mandu-testing/rules/test-mock-fetch.md +0 -219
- package/src/resources/skills/mandu-testing/rules/test-slot-unit.md +0 -192
- package/src/resources/skills/mandu-ui/SKILL.md +0 -159
- package/src/resources/skills/mandu-ui/_sections.md +0 -23
- package/src/resources/skills/mandu-ui/_template.md +0 -32
- package/src/resources/skills/mandu-ui/metadata.json +0 -13
- package/src/resources/skills/mandu-ui/rules/ui-accessibility-aria.md +0 -232
- package/src/resources/skills/mandu-ui/rules/ui-accessibility-focus.md +0 -238
- package/src/resources/skills/mandu-ui/rules/ui-composition-patterns.md +0 -259
- package/src/resources/skills/mandu-ui/rules/ui-island-integration.md +0 -258
- package/src/resources/skills/mandu-ui/rules/ui-radix-patterns.md +0 -213
- package/src/resources/skills/mandu-ui/rules/ui-shadcn-setup.md +0 -209
package/src/tools/agent.ts
CHANGED
|
@@ -1,443 +1,513 @@
|
|
|
1
|
-
import type { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import {
|
|
1
|
+
import type { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import {
|
|
4
4
|
buildAgentApplyReport,
|
|
5
5
|
buildAgentContext,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
buildExecutableAgentPlan,
|
|
7
|
+
buildAgentPlan,
|
|
8
|
+
buildAgentRepairReport,
|
|
9
|
+
buildAgentSyncReport,
|
|
10
|
+
buildAgentVerifyReport,
|
|
11
|
+
writeAgentApplyReport,
|
|
12
|
+
writeAgentManifest,
|
|
13
|
+
writeAgentPlan,
|
|
14
|
+
writeAgentRepairReport,
|
|
14
15
|
writeAgentVerifyReport,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
16
|
+
type AgentOperationInput,
|
|
17
|
+
} from "@mandujs/core/compat/agent/index";
|
|
18
|
+
|
|
19
|
+
interface AgentContextInput {
|
|
20
|
+
cwd?: unknown;
|
|
21
|
+
includeDiagnose?: unknown;
|
|
22
|
+
includeGit?: unknown;
|
|
23
|
+
writeManifest?: unknown;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface AgentVerifyInput {
|
|
27
|
+
cwd?: unknown;
|
|
28
|
+
changedOnly?: unknown;
|
|
29
|
+
includeDiagnose?: unknown;
|
|
30
|
+
includeGit?: unknown;
|
|
31
|
+
includeGuard?: unknown;
|
|
32
|
+
includeContract?: unknown;
|
|
33
|
+
staged?: unknown;
|
|
34
|
+
base?: unknown;
|
|
35
|
+
writeReport?: unknown;
|
|
36
|
+
}
|
|
37
|
+
|
|
36
38
|
interface AgentPlanInput {
|
|
37
39
|
cwd?: unknown;
|
|
38
40
|
intent?: unknown;
|
|
41
|
+
operations?: unknown;
|
|
42
|
+
idempotencyKey?: unknown;
|
|
43
|
+
rollbackPolicy?: unknown;
|
|
39
44
|
writePlan?: unknown;
|
|
40
45
|
}
|
|
41
|
-
|
|
42
|
-
interface AgentApplyInput {
|
|
43
|
-
cwd?: unknown;
|
|
44
|
-
from?: unknown;
|
|
45
|
-
dryRun?: unknown;
|
|
46
|
-
writeReport?: unknown;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
interface AgentSyncInput {
|
|
50
|
-
cwd?: unknown;
|
|
51
|
-
target?: unknown;
|
|
52
|
-
dryRun?: unknown;
|
|
53
|
-
}
|
|
54
|
-
|
|
46
|
+
|
|
47
|
+
interface AgentApplyInput {
|
|
48
|
+
cwd?: unknown;
|
|
49
|
+
from?: unknown;
|
|
50
|
+
dryRun?: unknown;
|
|
51
|
+
writeReport?: unknown;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
interface AgentSyncInput {
|
|
55
|
+
cwd?: unknown;
|
|
56
|
+
target?: unknown;
|
|
57
|
+
dryRun?: unknown;
|
|
58
|
+
}
|
|
59
|
+
|
|
55
60
|
interface AgentRepairInput {
|
|
56
61
|
cwd?: unknown;
|
|
57
62
|
from?: unknown;
|
|
58
63
|
apply?: unknown;
|
|
64
|
+
rollbackId?: unknown;
|
|
59
65
|
writeReport?: unknown;
|
|
60
66
|
}
|
|
61
|
-
|
|
62
|
-
function boolOrDefault(value: unknown, fallback: boolean): boolean {
|
|
63
|
-
if (value === undefined) return fallback;
|
|
64
|
-
if (typeof value === "boolean") return value;
|
|
65
|
-
return fallback;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function resolveCwd(projectRoot: string, value: unknown): string {
|
|
69
|
-
const root = path.resolve(projectRoot);
|
|
70
|
-
const resolved =
|
|
71
|
-
typeof value === "string" && value.length > 0
|
|
72
|
-
? path.resolve(root, value)
|
|
73
|
-
: root;
|
|
74
|
-
if (resolved !== root && !resolved.startsWith(root + path.sep)) {
|
|
75
|
-
throw new Error("cwd must stay inside the MCP project root");
|
|
76
|
-
}
|
|
77
|
-
return resolved;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
async function runAgentContext(
|
|
81
|
-
projectRoot: string,
|
|
82
|
-
input: AgentContextInput,
|
|
83
|
-
) {
|
|
84
|
-
const cwd = resolveCwd(projectRoot, input.cwd);
|
|
85
|
-
const context = await buildAgentContext(cwd, {
|
|
86
|
-
includeDiagnose: boolOrDefault(input.includeDiagnose, true),
|
|
87
|
-
includeGit: boolOrDefault(input.includeGit, true),
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
if (boolOrDefault(input.writeManifest, false)) {
|
|
91
|
-
const { path, manifest } = await writeAgentManifest(cwd, context);
|
|
92
|
-
return {
|
|
93
|
-
...context,
|
|
94
|
-
manifest: {
|
|
95
|
-
path,
|
|
96
|
-
written: true,
|
|
97
|
-
schemaVersion: manifest.schemaVersion,
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
return context;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
async function runAgentPlan(
|
|
106
|
-
projectRoot: string,
|
|
107
|
-
input: AgentPlanInput,
|
|
108
|
-
) {
|
|
109
|
-
const cwd = resolveCwd(projectRoot, input.cwd);
|
|
110
|
-
const intent = typeof input.intent === "string" ? input.intent.trim() : "";
|
|
111
|
-
if (!intent) {
|
|
112
|
-
throw new Error("intent is required for mandu.agent.plan");
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const plan =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
67
|
+
|
|
68
|
+
function boolOrDefault(value: unknown, fallback: boolean): boolean {
|
|
69
|
+
if (value === undefined) return fallback;
|
|
70
|
+
if (typeof value === "boolean") return value;
|
|
71
|
+
return fallback;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function resolveCwd(projectRoot: string, value: unknown): string {
|
|
75
|
+
const root = path.resolve(projectRoot);
|
|
76
|
+
const resolved =
|
|
77
|
+
typeof value === "string" && value.length > 0
|
|
78
|
+
? path.resolve(root, value)
|
|
79
|
+
: root;
|
|
80
|
+
if (resolved !== root && !resolved.startsWith(root + path.sep)) {
|
|
81
|
+
throw new Error("cwd must stay inside the MCP project root");
|
|
82
|
+
}
|
|
83
|
+
return resolved;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function runAgentContext(
|
|
87
|
+
projectRoot: string,
|
|
88
|
+
input: AgentContextInput,
|
|
89
|
+
) {
|
|
90
|
+
const cwd = resolveCwd(projectRoot, input.cwd);
|
|
91
|
+
const context = await buildAgentContext(cwd, {
|
|
92
|
+
includeDiagnose: boolOrDefault(input.includeDiagnose, true),
|
|
93
|
+
includeGit: boolOrDefault(input.includeGit, true),
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
if (boolOrDefault(input.writeManifest, false)) {
|
|
97
|
+
const { path, manifest } = await writeAgentManifest(cwd, context);
|
|
98
|
+
return {
|
|
99
|
+
...context,
|
|
100
|
+
manifest: {
|
|
101
|
+
path,
|
|
102
|
+
written: true,
|
|
103
|
+
schemaVersion: manifest.schemaVersion,
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return context;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async function runAgentPlan(
|
|
112
|
+
projectRoot: string,
|
|
113
|
+
input: AgentPlanInput,
|
|
114
|
+
) {
|
|
115
|
+
const cwd = resolveCwd(projectRoot, input.cwd);
|
|
116
|
+
const intent = typeof input.intent === "string" ? input.intent.trim() : "";
|
|
117
|
+
if (!intent) {
|
|
118
|
+
throw new Error("intent is required for mandu.agent.plan");
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const plan = Array.isArray(input.operations) && input.operations.length > 0
|
|
122
|
+
? await buildExecutableAgentPlan(cwd, {
|
|
123
|
+
intent,
|
|
124
|
+
operations: input.operations as AgentOperationInput[],
|
|
125
|
+
idempotencyKey:
|
|
126
|
+
typeof input.idempotencyKey === "string" ? input.idempotencyKey : undefined,
|
|
127
|
+
rollbackPolicy:
|
|
128
|
+
input.rollbackPolicy === "automatic" || input.rollbackPolicy === "manual"
|
|
129
|
+
? input.rollbackPolicy
|
|
130
|
+
: undefined,
|
|
131
|
+
})
|
|
132
|
+
: buildAgentPlan({ intent });
|
|
133
|
+
|
|
134
|
+
if (boolOrDefault(input.writePlan, false)) {
|
|
135
|
+
const { path, plan: written } = await writeAgentPlan(cwd, plan);
|
|
136
|
+
return {
|
|
137
|
+
...written,
|
|
138
|
+
plan: {
|
|
139
|
+
path,
|
|
140
|
+
written: true,
|
|
141
|
+
schemaVersion: written.schemaVersion,
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return plan;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
async function runAgentApply(
|
|
150
|
+
projectRoot: string,
|
|
151
|
+
input: AgentApplyInput,
|
|
152
|
+
) {
|
|
153
|
+
const cwd = resolveCwd(projectRoot, input.cwd);
|
|
154
|
+
const report = await buildAgentApplyReport(cwd, {
|
|
155
|
+
from: typeof input.from === "string" && input.from.length > 0 ? input.from : undefined,
|
|
156
|
+
dryRun: boolOrDefault(input.dryRun, true),
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
if (boolOrDefault(input.writeReport, false)) {
|
|
160
|
+
const { path, report: written } = await writeAgentApplyReport(cwd, report);
|
|
161
|
+
return {
|
|
162
|
+
...written,
|
|
163
|
+
report: {
|
|
164
|
+
path,
|
|
165
|
+
written: true,
|
|
166
|
+
schemaVersion: written.schemaVersion,
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return report;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
async function runAgentVerify(
|
|
175
|
+
projectRoot: string,
|
|
176
|
+
input: AgentVerifyInput,
|
|
177
|
+
) {
|
|
178
|
+
const cwd = resolveCwd(projectRoot, input.cwd);
|
|
179
|
+
const report = await buildAgentVerifyReport(cwd, {
|
|
180
|
+
changedOnly: boolOrDefault(input.changedOnly, true),
|
|
181
|
+
includeDiagnose: boolOrDefault(input.includeDiagnose, true),
|
|
182
|
+
includeGit: boolOrDefault(input.includeGit, true),
|
|
183
|
+
includeGuard: boolOrDefault(input.includeGuard, true),
|
|
184
|
+
includeContract: boolOrDefault(input.includeContract, true),
|
|
185
|
+
staged: boolOrDefault(input.staged, false),
|
|
186
|
+
base: typeof input.base === "string" && input.base.length > 0 ? input.base : undefined,
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
if (boolOrDefault(input.writeReport, false)) {
|
|
190
|
+
const { path, report: written } = await writeAgentVerifyReport(cwd, report);
|
|
191
|
+
return {
|
|
192
|
+
...written,
|
|
193
|
+
report: {
|
|
194
|
+
path,
|
|
195
|
+
written: true,
|
|
196
|
+
schemaVersion: written.schemaVersion,
|
|
197
|
+
},
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return report;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
async function runAgentRepair(
|
|
205
|
+
projectRoot: string,
|
|
206
|
+
input: AgentRepairInput,
|
|
207
|
+
) {
|
|
208
|
+
const cwd = resolveCwd(projectRoot, input.cwd);
|
|
209
|
+
const report = await buildAgentRepairReport(cwd, {
|
|
193
210
|
from: typeof input.from === "string" && input.from.length > 0 ? input.from : undefined,
|
|
194
211
|
apply: boolOrDefault(input.apply, false),
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
target
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
212
|
+
rollbackId:
|
|
213
|
+
typeof input.rollbackId === "string" && input.rollbackId.length > 0
|
|
214
|
+
? input.rollbackId
|
|
215
|
+
: undefined,
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
if (boolOrDefault(input.writeReport, false)) {
|
|
219
|
+
const { path, report: written } = await writeAgentRepairReport(cwd, report);
|
|
220
|
+
return {
|
|
221
|
+
...written,
|
|
222
|
+
report: {
|
|
223
|
+
path,
|
|
224
|
+
written: true,
|
|
225
|
+
schemaVersion: written.schemaVersion,
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return report;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
async function runAgentSync(
|
|
234
|
+
projectRoot: string,
|
|
235
|
+
input: AgentSyncInput,
|
|
236
|
+
) {
|
|
237
|
+
const cwd = resolveCwd(projectRoot, input.cwd);
|
|
238
|
+
const target =
|
|
239
|
+
input.target === "codex" ||
|
|
240
|
+
input.target === "claude" ||
|
|
241
|
+
input.target === "gemini" ||
|
|
242
|
+
input.target === "all"
|
|
243
|
+
? input.target
|
|
244
|
+
: "all";
|
|
245
|
+
return buildAgentSyncReport(cwd, {
|
|
246
|
+
target,
|
|
247
|
+
dryRun: boolOrDefault(input.dryRun, false),
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export const agentToolDefinitions: Tool[] = [
|
|
252
|
+
{
|
|
253
|
+
name: "mandu.agent.context",
|
|
254
|
+
description:
|
|
255
|
+
"Official agent-core entry point. Returns one structured project context for Codex/Claude/Gemini: project metadata, routes/APIs, partials/islands, slots/contracts, guard summary, diagnostics, git state, and the canonical context -> plan -> apply -> verify -> repair workflow.",
|
|
256
|
+
annotations: {
|
|
257
|
+
readOnlyHint: true,
|
|
258
|
+
},
|
|
259
|
+
inputSchema: {
|
|
260
|
+
type: "object",
|
|
261
|
+
properties: {
|
|
262
|
+
cwd: {
|
|
263
|
+
type: "string",
|
|
264
|
+
description: "Project directory to inspect. Defaults to the MCP project root.",
|
|
265
|
+
},
|
|
266
|
+
includeDiagnose: {
|
|
267
|
+
type: "boolean",
|
|
268
|
+
description: "Include diagnose summary and normalized diagnostics. Defaults to true.",
|
|
269
|
+
},
|
|
270
|
+
includeGit: {
|
|
271
|
+
type: "boolean",
|
|
272
|
+
description: "Include git branch and changed-file summary. Defaults to true.",
|
|
273
|
+
},
|
|
274
|
+
writeManifest: {
|
|
275
|
+
type: "boolean",
|
|
276
|
+
description:
|
|
277
|
+
"Write .mandu/agent-manifest.json while building context. Defaults to false.",
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
required: [],
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
name: "mandu.agent.plan",
|
|
233
285
|
description:
|
|
234
|
-
"Official agent-core entry point.
|
|
235
|
-
annotations: {
|
|
236
|
-
readOnlyHint: true,
|
|
237
|
-
},
|
|
238
|
-
inputSchema: {
|
|
239
|
-
type: "object",
|
|
240
|
-
properties: {
|
|
241
|
-
cwd: {
|
|
242
|
-
type: "string",
|
|
243
|
-
description: "Project directory to
|
|
244
|
-
},
|
|
245
|
-
|
|
246
|
-
type: "
|
|
247
|
-
description: "
|
|
248
|
-
},
|
|
249
|
-
includeGit: {
|
|
250
|
-
type: "boolean",
|
|
251
|
-
description: "Include git branch and changed-file summary. Defaults to true.",
|
|
286
|
+
"Official agent-core planning entry point. Without operations it returns a conservative intent preview. With typed operations it binds current content hashes, exact write scope, rollback policy, and an idempotency key into an executable plan.",
|
|
287
|
+
annotations: {
|
|
288
|
+
readOnlyHint: true,
|
|
289
|
+
},
|
|
290
|
+
inputSchema: {
|
|
291
|
+
type: "object",
|
|
292
|
+
properties: {
|
|
293
|
+
cwd: {
|
|
294
|
+
type: "string",
|
|
295
|
+
description: "Project directory to plan against. Defaults to the MCP project root.",
|
|
296
|
+
},
|
|
297
|
+
intent: {
|
|
298
|
+
type: "string",
|
|
299
|
+
description: "Natural-language task request, for example: add authenticated dashboard.",
|
|
252
300
|
},
|
|
253
|
-
|
|
254
|
-
type: "
|
|
301
|
+
operations: {
|
|
302
|
+
type: "array",
|
|
255
303
|
description:
|
|
256
|
-
"
|
|
304
|
+
"Optional typed write operations. When present, the server binds current preconditions and returns an executable plan.",
|
|
305
|
+
items: {
|
|
306
|
+
type: "object",
|
|
307
|
+
properties: {
|
|
308
|
+
id: { type: "string" },
|
|
309
|
+
kind: {
|
|
310
|
+
type: "string",
|
|
311
|
+
enum: [
|
|
312
|
+
"file.create",
|
|
313
|
+
"file.patch-with-hash",
|
|
314
|
+
"route.create",
|
|
315
|
+
"api.create",
|
|
316
|
+
"contract.update",
|
|
317
|
+
"guard.safe-fix",
|
|
318
|
+
"generated.refresh",
|
|
319
|
+
],
|
|
320
|
+
},
|
|
321
|
+
target: { type: "string" },
|
|
322
|
+
effect: {
|
|
323
|
+
type: "object",
|
|
324
|
+
properties: {
|
|
325
|
+
type: { type: "string", enum: ["write"] },
|
|
326
|
+
content: { type: "string" },
|
|
327
|
+
encoding: { type: "string", enum: ["utf8"] },
|
|
328
|
+
},
|
|
329
|
+
required: ["type", "content", "encoding"],
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
required: ["kind", "target", "effect"],
|
|
333
|
+
},
|
|
257
334
|
},
|
|
258
|
-
|
|
259
|
-
required: [],
|
|
260
|
-
},
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
name: "mandu.agent.plan",
|
|
264
|
-
description:
|
|
265
|
-
"Official agent-core planning entry point. Converts a natural-language Mandu task into a conservative domain plan with files to inspect, files likely to create, preferred MCP/domain tools, risks, and verification commands.",
|
|
266
|
-
annotations: {
|
|
267
|
-
readOnlyHint: true,
|
|
268
|
-
},
|
|
269
|
-
inputSchema: {
|
|
270
|
-
type: "object",
|
|
271
|
-
properties: {
|
|
272
|
-
cwd: {
|
|
335
|
+
idempotencyKey: {
|
|
273
336
|
type: "string",
|
|
274
|
-
description: "
|
|
337
|
+
description: "Optional stable retry key. A UUID is generated when omitted.",
|
|
275
338
|
},
|
|
276
|
-
|
|
339
|
+
rollbackPolicy: {
|
|
277
340
|
type: "string",
|
|
278
|
-
|
|
341
|
+
enum: ["automatic", "manual"],
|
|
342
|
+
description: "Failure policy. Defaults to automatic rollback.",
|
|
279
343
|
},
|
|
280
|
-
writePlan: {
|
|
281
|
-
type: "boolean",
|
|
282
|
-
description: "Write .mandu/agent-plan.json while planning. Defaults to false.",
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
required: ["intent"],
|
|
286
|
-
},
|
|
287
|
-
},
|
|
288
|
-
{
|
|
344
|
+
writePlan: {
|
|
345
|
+
type: "boolean",
|
|
346
|
+
description: "Write .mandu/agent-plan.json while planning. Defaults to false.",
|
|
347
|
+
},
|
|
348
|
+
},
|
|
349
|
+
required: ["intent"],
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
{
|
|
289
353
|
name: "mandu.agent.apply",
|
|
290
354
|
description:
|
|
291
|
-
"Official agent-core apply
|
|
355
|
+
"Official agent-core typed apply entry point. It previews by default. With dryRun=false it enforces exact scope, base revision and content hashes, snapshots touched files, applies UTF-8 write operations, verifies the result, rolls back failures by policy, and returns the shared ApplyReceipt schema.",
|
|
292
356
|
annotations: {
|
|
293
|
-
readOnlyHint:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
357
|
+
readOnlyHint: false,
|
|
358
|
+
destructiveHint: true,
|
|
359
|
+
},
|
|
360
|
+
inputSchema: {
|
|
361
|
+
type: "object",
|
|
362
|
+
properties: {
|
|
363
|
+
cwd: {
|
|
364
|
+
type: "string",
|
|
365
|
+
description: "Project directory. Defaults to the MCP project root.",
|
|
366
|
+
},
|
|
367
|
+
from: {
|
|
368
|
+
type: "string",
|
|
369
|
+
description: "Plan path relative to cwd. Defaults to .mandu/agent-plan.json.",
|
|
370
|
+
},
|
|
306
371
|
dryRun: {
|
|
307
372
|
type: "boolean",
|
|
308
|
-
description: "
|
|
309
|
-
},
|
|
310
|
-
writeReport: {
|
|
311
|
-
type: "boolean",
|
|
312
|
-
description: "Write .mandu/agent-apply.json. Defaults to false.",
|
|
313
|
-
},
|
|
314
|
-
},
|
|
315
|
-
required: [],
|
|
316
|
-
},
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
name: "mandu.agent.verify",
|
|
373
|
+
description: "Validate and preview without writing. Defaults to true; set false to execute.",
|
|
374
|
+
},
|
|
375
|
+
writeReport: {
|
|
376
|
+
type: "boolean",
|
|
377
|
+
description: "Write .mandu/agent-apply.json. Defaults to false.",
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
required: [],
|
|
381
|
+
},
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
name: "mandu.agent.verify",
|
|
385
|
+
description:
|
|
386
|
+
"Official agent-core verification entry point. Returns one structured report that combines changed files, diagnose, route manifest, guard, contract consistency, normalized diagnostics, and suggested follow-up commands.",
|
|
387
|
+
annotations: {
|
|
388
|
+
readOnlyHint: true,
|
|
389
|
+
},
|
|
390
|
+
inputSchema: {
|
|
391
|
+
type: "object",
|
|
392
|
+
properties: {
|
|
393
|
+
cwd: {
|
|
394
|
+
type: "string",
|
|
395
|
+
description: "Project directory to verify. Defaults to the MCP project root.",
|
|
396
|
+
},
|
|
397
|
+
changedOnly: {
|
|
398
|
+
type: "boolean",
|
|
399
|
+
description: "Filter guard/contract findings to changed files when git data exists. Defaults to true.",
|
|
400
|
+
},
|
|
401
|
+
includeDiagnose: {
|
|
402
|
+
type: "boolean",
|
|
403
|
+
description: "Run diagnose and include normalized diagnose diagnostics. Defaults to true.",
|
|
404
|
+
},
|
|
405
|
+
includeGit: {
|
|
406
|
+
type: "boolean",
|
|
407
|
+
description: "Collect git changed files. Defaults to true.",
|
|
408
|
+
},
|
|
409
|
+
includeGuard: {
|
|
410
|
+
type: "boolean",
|
|
411
|
+
description: "Run architecture guard if the routes manifest is available. Defaults to true.",
|
|
412
|
+
},
|
|
413
|
+
includeContract: {
|
|
414
|
+
type: "boolean",
|
|
415
|
+
description: "Run contract/slot consistency checks if the routes manifest is available. Defaults to true.",
|
|
416
|
+
},
|
|
417
|
+
staged: {
|
|
418
|
+
type: "boolean",
|
|
419
|
+
description: "Use staged changes only. Defaults to false.",
|
|
420
|
+
},
|
|
421
|
+
base: {
|
|
422
|
+
type: "string",
|
|
423
|
+
description: "Optional git base ref for changed-file detection.",
|
|
424
|
+
},
|
|
425
|
+
writeReport: {
|
|
426
|
+
type: "boolean",
|
|
427
|
+
description: "Write .mandu/agent-verify.json while verifying. Defaults to false.",
|
|
428
|
+
},
|
|
429
|
+
},
|
|
430
|
+
required: [],
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
name: "mandu.agent.repair",
|
|
320
435
|
description:
|
|
321
|
-
"Official agent-core
|
|
322
|
-
annotations: {
|
|
323
|
-
readOnlyHint:
|
|
324
|
-
},
|
|
325
|
-
inputSchema: {
|
|
326
|
-
type: "object",
|
|
327
|
-
properties: {
|
|
328
|
-
cwd: {
|
|
329
|
-
type: "string",
|
|
330
|
-
description: "Project directory
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
type: "
|
|
334
|
-
description: "
|
|
335
|
-
},
|
|
336
|
-
includeDiagnose: {
|
|
337
|
-
type: "boolean",
|
|
338
|
-
description: "Run diagnose and include normalized diagnose diagnostics. Defaults to true.",
|
|
339
|
-
},
|
|
340
|
-
includeGit: {
|
|
341
|
-
type: "boolean",
|
|
342
|
-
description: "Collect git changed files. Defaults to true.",
|
|
343
|
-
},
|
|
344
|
-
includeGuard: {
|
|
345
|
-
type: "boolean",
|
|
346
|
-
description: "Run architecture guard if the routes manifest is available. Defaults to true.",
|
|
347
|
-
},
|
|
348
|
-
includeContract: {
|
|
349
|
-
type: "boolean",
|
|
350
|
-
description: "Run contract/slot consistency checks if the routes manifest is available. Defaults to true.",
|
|
351
|
-
},
|
|
352
|
-
staged: {
|
|
353
|
-
type: "boolean",
|
|
354
|
-
description: "Use staged changes only. Defaults to false.",
|
|
355
|
-
},
|
|
356
|
-
base: {
|
|
357
|
-
type: "string",
|
|
358
|
-
description: "Optional git base ref for changed-file detection.",
|
|
359
|
-
},
|
|
360
|
-
writeReport: {
|
|
361
|
-
type: "boolean",
|
|
362
|
-
description: "Write .mandu/agent-verify.json while verifying. Defaults to false.",
|
|
363
|
-
},
|
|
364
|
-
},
|
|
365
|
-
required: [],
|
|
366
|
-
},
|
|
367
|
-
},
|
|
368
|
-
{
|
|
369
|
-
name: "mandu.agent.repair",
|
|
370
|
-
description:
|
|
371
|
-
"Official agent-core repair entry point. Reads an agent verify report and returns structured next actions. It does not execute shell commands; apply mode only handles safe typed patch candidates.",
|
|
372
|
-
annotations: {
|
|
373
|
-
readOnlyHint: false,
|
|
374
|
-
},
|
|
375
|
-
inputSchema: {
|
|
376
|
-
type: "object",
|
|
377
|
-
properties: {
|
|
378
|
-
cwd: {
|
|
379
|
-
type: "string",
|
|
380
|
-
description: "Project directory. Defaults to the MCP project root.",
|
|
381
|
-
},
|
|
382
|
-
from: {
|
|
383
|
-
type: "string",
|
|
384
|
-
description: "Verify report path relative to cwd. Defaults to .mandu/agent-verify.json.",
|
|
385
|
-
},
|
|
436
|
+
"Official agent-core repair entry point. Reads an agent verify report and returns structured next actions, or restores an ApplyReceipt snapshot by rollbackId when apply=true. It never executes shell commands and preserves files changed after apply.",
|
|
437
|
+
annotations: {
|
|
438
|
+
readOnlyHint: false,
|
|
439
|
+
},
|
|
440
|
+
inputSchema: {
|
|
441
|
+
type: "object",
|
|
442
|
+
properties: {
|
|
443
|
+
cwd: {
|
|
444
|
+
type: "string",
|
|
445
|
+
description: "Project directory. Defaults to the MCP project root.",
|
|
446
|
+
},
|
|
447
|
+
from: {
|
|
448
|
+
type: "string",
|
|
449
|
+
description: "Verify report path relative to cwd. Defaults to .mandu/agent-verify.json.",
|
|
450
|
+
},
|
|
386
451
|
apply: {
|
|
387
|
-
type: "boolean",
|
|
388
|
-
description: "Apply safe typed patch candidates only. Defaults to false.",
|
|
389
|
-
},
|
|
390
|
-
writeReport: {
|
|
391
|
-
type: "boolean",
|
|
392
|
-
description: "Write .mandu/agent-repair.json. Defaults to false.",
|
|
452
|
+
type: "boolean",
|
|
453
|
+
description: "Apply safe typed patch candidates only. Defaults to false.",
|
|
393
454
|
},
|
|
394
|
-
|
|
395
|
-
required: [],
|
|
396
|
-
},
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
name: "mandu.agent.sync",
|
|
400
|
-
description:
|
|
401
|
-
"Official agent sync helper. Writes or previews Codex, Claude Code, and Gemini CLI workflow artifacts under .mandu/agent-sync so each agent follows the same Mandu agent loop and MCP profile guidance.",
|
|
402
|
-
annotations: {
|
|
403
|
-
readOnlyHint: false,
|
|
404
|
-
},
|
|
405
|
-
inputSchema: {
|
|
406
|
-
type: "object",
|
|
407
|
-
properties: {
|
|
408
|
-
cwd: {
|
|
409
|
-
type: "string",
|
|
410
|
-
description: "Project directory. Defaults to the MCP project root.",
|
|
411
|
-
},
|
|
412
|
-
target: {
|
|
455
|
+
rollbackId: {
|
|
413
456
|
type: "string",
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
},
|
|
417
|
-
dryRun: {
|
|
418
|
-
type: "boolean",
|
|
419
|
-
description: "Preview files without writing. Defaults to false.",
|
|
457
|
+
description:
|
|
458
|
+
"Optional rollback ID from an ApplyReceipt. With apply=true, restores the touched-file snapshot after conflict checks.",
|
|
420
459
|
},
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
460
|
+
writeReport: {
|
|
461
|
+
type: "boolean",
|
|
462
|
+
description: "Write .mandu/agent-repair.json. Defaults to false.",
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
required: [],
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
name: "mandu.agent.sync",
|
|
470
|
+
description:
|
|
471
|
+
"Official agent sync helper. Writes or previews Codex, Claude Code, and Gemini CLI workflow artifacts under .mandu/agent-sync so each agent follows the same Mandu agent loop and MCP profile guidance.",
|
|
472
|
+
annotations: {
|
|
473
|
+
readOnlyHint: false,
|
|
474
|
+
},
|
|
475
|
+
inputSchema: {
|
|
476
|
+
type: "object",
|
|
477
|
+
properties: {
|
|
478
|
+
cwd: {
|
|
479
|
+
type: "string",
|
|
480
|
+
description: "Project directory. Defaults to the MCP project root.",
|
|
481
|
+
},
|
|
482
|
+
target: {
|
|
483
|
+
type: "string",
|
|
484
|
+
enum: ["codex", "claude", "gemini", "all"],
|
|
485
|
+
description: "Agent target to sync. Defaults to all.",
|
|
486
|
+
},
|
|
487
|
+
dryRun: {
|
|
488
|
+
type: "boolean",
|
|
489
|
+
description: "Preview files without writing. Defaults to false.",
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
required: [],
|
|
493
|
+
},
|
|
494
|
+
},
|
|
495
|
+
];
|
|
496
|
+
|
|
497
|
+
export function agentTools(projectRoot: string) {
|
|
498
|
+
const handlers: Record<string, (args: Record<string, unknown>) => Promise<unknown>> = {
|
|
499
|
+
"mandu.agent.context": async (args) =>
|
|
500
|
+
runAgentContext(projectRoot, args as AgentContextInput),
|
|
501
|
+
"mandu.agent.plan": async (args) =>
|
|
502
|
+
runAgentPlan(projectRoot, args as AgentPlanInput),
|
|
503
|
+
"mandu.agent.apply": async (args) =>
|
|
504
|
+
runAgentApply(projectRoot, args as AgentApplyInput),
|
|
505
|
+
"mandu.agent.verify": async (args) =>
|
|
506
|
+
runAgentVerify(projectRoot, args as AgentVerifyInput),
|
|
507
|
+
"mandu.agent.repair": async (args) =>
|
|
508
|
+
runAgentRepair(projectRoot, args as AgentRepairInput),
|
|
509
|
+
"mandu.agent.sync": async (args) =>
|
|
510
|
+
runAgentSync(projectRoot, args as AgentSyncInput),
|
|
511
|
+
};
|
|
512
|
+
return handlers;
|
|
513
|
+
}
|