@martinloop/mcp 0.2.5 → 0.3.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/README.md +40 -132
- package/dist/discovery-metadata.d.ts +10 -5
- package/dist/discovery-metadata.js +95 -5
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/prompts.d.ts +1 -1
- package/dist/prompts.js +93 -1
- package/dist/resources.d.ts +9 -1
- package/dist/resources.js +247 -16
- package/dist/server-validation.d.ts +2 -1
- package/dist/server-validation.js +124 -0
- package/dist/server.js +379 -5
- package/dist/tools/doctor.d.ts +14 -1
- package/dist/tools/doctor.js +43 -8
- package/dist/tools/eval.d.ts +24 -0
- package/dist/tools/eval.js +66 -0
- package/dist/tools/get-run.d.ts +2 -0
- package/dist/tools/get-run.js +2 -1
- package/dist/tools/get-status.d.ts +8 -0
- package/dist/tools/get-status.js +18 -0
- package/dist/tools/get-verification-results.d.ts +2 -0
- package/dist/tools/get-verification-results.js +2 -1
- package/dist/tools/logs.d.ts +25 -0
- package/dist/tools/logs.js +49 -0
- package/dist/tools/plan.d.ts +20 -0
- package/dist/tools/plan.js +10 -0
- package/dist/tools/pr-tools.d.ts +31 -0
- package/dist/tools/pr-tools.js +112 -0
- package/dist/tools/preflight.d.ts +24 -1
- package/dist/tools/preflight.js +47 -7
- package/dist/tools/run-controls.d.ts +36 -0
- package/dist/tools/run-controls.js +88 -0
- package/dist/tools/run-dossier.d.ts +16 -0
- package/dist/tools/run-dossier.js +64 -2
- package/dist/tools/run-loop.d.ts +3 -2
- package/dist/tools/run-loop.js +52 -13
- package/dist/tools/tool-errors.d.ts +1 -1
- package/dist/tools/tool-errors.js +1 -1
- package/dist/tools/tool-support.d.ts +6 -3
- package/dist/tools/tool-support.js +37 -3
- package/dist/tools/workflow-governance.d.ts +133 -0
- package/dist/tools/workflow-governance.js +581 -0
- package/dist/vendor/adapters/claude-cli.d.ts +25 -0
- package/dist/vendor/adapters/claude-cli.js +279 -19
- package/dist/vendor/adapters/cli-bridge.d.ts +6 -0
- package/dist/vendor/adapters/cli-bridge.js +58 -9
- package/dist/vendor/adapters/codex-launcher.d.ts +44 -0
- package/dist/vendor/adapters/codex-launcher.js +247 -0
- package/dist/vendor/adapters/index.d.ts +4 -2
- package/dist/vendor/adapters/index.js +4 -1
- package/dist/vendor/adapters/openai-compatible.d.ts +62 -0
- package/dist/vendor/adapters/openai-compatible.js +267 -0
- package/dist/vendor/adapters/runtime-support.d.ts +3 -0
- package/dist/vendor/adapters/runtime-support.js +8 -1
- package/dist/vendor/adapters/verifier-only.js +4 -3
- package/dist/vendor/contracts/index.d.ts +39 -0
- package/dist/vendor/contracts/index.js +2 -0
- package/dist/vendor/core/index.d.ts +23 -3
- package/dist/vendor/core/index.js +88 -15
- package/dist/vendor/core/persistence/index.d.ts +2 -0
- package/dist/vendor/core/persistence/index.js +1 -0
- package/dist/vendor/core/persistence/integrity.d.ts +38 -0
- package/dist/vendor/core/persistence/integrity.js +239 -0
- package/dist/vendor/core/persistence/store.d.ts +7 -0
- package/dist/vendor/core/persistence/store.js +25 -1
- package/dist/vendor/core/policy.d.ts +9 -0
- package/dist/workflow-state.d.ts +25 -0
- package/dist/workflow-state.js +102 -0
- package/package.json +3 -3
- package/server.json +2 -2
package/README.md
CHANGED
|
@@ -1,55 +1,63 @@
|
|
|
1
1
|
# @martinloop/mcp
|
|
2
2
|
|
|
3
|
-
Governed
|
|
3
|
+
Governed MCP server for AI coding agents over local stdio.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`@martinloop/mcp@0.2.7` is the current public baseline. It gives hosts one bounded execution entrypoint, strong read-only inspection, clear next-step guidance, and a safer default MartinLoop workflow.
|
|
6
6
|
|
|
7
|
-
This package stays local-first and stdio-first in public
|
|
7
|
+
This package stays local-first and stdio-first in the public OSS lane.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Public release train
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
- `0.2.7` made the guided MCP workflow easier to adopt and harder to misuse.
|
|
12
|
+
- `0.3.0` is the next adoption release.
|
|
13
|
+
- `0.3.1` is planned for review and handoff controls.
|
|
14
|
+
- `0.3.2` is planned for opt-in execution controls.
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
- 0.2.0 cockpit expansion. 0.2.0 adds resources, resource templates, prompts, and read-only cockpit inspection.
|
|
15
|
-
- 0.2.5 stable cockpit line with local triage and degraded run-store hardening.
|
|
16
|
-
|
|
17
|
-
## What Ships
|
|
16
|
+
## What ships today
|
|
18
17
|
|
|
19
18
|
### Tools
|
|
20
19
|
|
|
21
20
|
- `martin_doctor`
|
|
21
|
+
- `martin_plan`
|
|
22
22
|
- `martin_preflight`
|
|
23
23
|
- `martin_run`
|
|
24
24
|
- `martin_inspect`
|
|
25
25
|
- `martin_status`
|
|
26
|
+
- `martin_logs`
|
|
27
|
+
- `martin_pause`
|
|
28
|
+
- `martin_cancel`
|
|
29
|
+
- `martin_continue`
|
|
26
30
|
- `martin_list_runs`
|
|
27
31
|
- `martin_triage_runs`
|
|
28
32
|
- `martin_get_run`
|
|
29
33
|
- `martin_get_attempt`
|
|
30
34
|
- `martin_get_verification_results`
|
|
31
35
|
- `martin_run_dossier`
|
|
36
|
+
- `martin_dossier`
|
|
37
|
+
- `martin_eval`
|
|
38
|
+
- `martin_pr_summary`
|
|
39
|
+
- `martin_create_pr`
|
|
40
|
+
- `martin_review_pr`
|
|
32
41
|
|
|
33
42
|
### Resources
|
|
34
43
|
|
|
35
44
|
- `martin://server/health`
|
|
36
45
|
- `martin://runs/recent`
|
|
37
46
|
- `martin://runs/triage`
|
|
47
|
+
- `martin://runs/latest`
|
|
38
48
|
- `martin://runs/latest/summary`
|
|
39
49
|
- `martin://runs/latest/proof-card`
|
|
40
50
|
- `martin://runs/latest/budget-status`
|
|
41
51
|
- `martin://runs/latest/verifier-evidence`
|
|
42
52
|
- `martin://runs/latest/rollback-evidence`
|
|
53
|
+
- `martin://policies/current`
|
|
54
|
+
- `martin://repo/risk-map`
|
|
55
|
+
- `martin://verifiers/results`
|
|
43
56
|
- `martin://agent/next-step`
|
|
44
57
|
- `martin://guides/mcp-usage`
|
|
58
|
+
- `martin://guides/agent-start`
|
|
45
59
|
- `martin://guides/publish-readiness`
|
|
46
60
|
|
|
47
|
-
### Resource templates
|
|
48
|
-
|
|
49
|
-
- `martin://runs/{loopId}`
|
|
50
|
-
- `martin://runs/{loopId}/attempts/{attemptIndex}`
|
|
51
|
-
- `martin://runs/{loopId}/verification`
|
|
52
|
-
|
|
53
61
|
### Prompts
|
|
54
62
|
|
|
55
63
|
- `martin_start`
|
|
@@ -63,31 +71,29 @@ For host-facing guidance, see [MCP for AI Agents](https://github.com/Keesan12/ma
|
|
|
63
71
|
- `martin_publish_readiness_review`
|
|
64
72
|
- `martin_triage_run_store`
|
|
65
73
|
|
|
66
|
-
## Recommended
|
|
74
|
+
## Recommended flow
|
|
67
75
|
|
|
68
76
|
1. `martin_doctor`
|
|
69
|
-
2. `
|
|
70
|
-
3. `
|
|
71
|
-
4. `
|
|
72
|
-
5. `
|
|
73
|
-
6. `
|
|
74
|
-
7. `
|
|
77
|
+
2. `martin_plan`
|
|
78
|
+
3. `martin_preflight`
|
|
79
|
+
4. `martin_run`
|
|
80
|
+
5. `martin_status` or `martin_logs`
|
|
81
|
+
6. `martin_dossier`
|
|
82
|
+
7. `martin_eval`
|
|
75
83
|
|
|
76
84
|
## Install
|
|
77
85
|
|
|
78
|
-
Run the packaged server directly:
|
|
79
|
-
|
|
80
86
|
```sh
|
|
81
87
|
npx -y @martinloop/mcp
|
|
82
88
|
```
|
|
83
89
|
|
|
84
|
-
|
|
90
|
+
Codex:
|
|
85
91
|
|
|
86
92
|
```sh
|
|
87
93
|
codex mcp add martin-loop -- npx -y @martinloop/mcp
|
|
88
94
|
```
|
|
89
95
|
|
|
90
|
-
|
|
96
|
+
Claude Code:
|
|
91
97
|
|
|
92
98
|
```sh
|
|
93
99
|
# macOS/Linux
|
|
@@ -97,103 +103,24 @@ claude mcp add --transport stdio --scope user martin-loop -- npx -y @martinloop/
|
|
|
97
103
|
claude mcp add --transport stdio --scope user martin-loop -- cmd /c npx -y @martinloop/mcp
|
|
98
104
|
```
|
|
99
105
|
|
|
100
|
-
|
|
106
|
+
If you want generated host config, use the MartinLoop CLI:
|
|
101
107
|
|
|
102
108
|
```sh
|
|
103
109
|
martin mcp print-config --host codex --transport stdio --profile minimal
|
|
104
110
|
martin mcp print-config --host claude --transport stdio --profile diagnostic
|
|
105
111
|
martin mcp print-config --host gemini --transport stdio --profile full-local
|
|
112
|
+
martin mcp print-config --host generic --transport stdio --profile github-review
|
|
106
113
|
```
|
|
107
114
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
Codex also supports `~/.codex/config.toml` and project-scoped `.codex/config.toml`:
|
|
111
|
-
|
|
112
|
-
```toml
|
|
113
|
-
[mcp_servers."martin-loop"]
|
|
114
|
-
command = "npx"
|
|
115
|
-
args = ["-y", "@martinloop/mcp"]
|
|
116
|
-
cwd = "C:\\path\\to\\repo"
|
|
117
|
-
startup_timeout_sec = 20
|
|
118
|
-
tool_timeout_sec = 180
|
|
119
|
-
enabled_tools = [
|
|
120
|
-
"martin_doctor",
|
|
121
|
-
"martin_preflight",
|
|
122
|
-
"martin_list_runs",
|
|
123
|
-
"martin_triage_runs",
|
|
124
|
-
"martin_run_dossier",
|
|
125
|
-
]
|
|
126
|
-
env = { MARTIN_RUNS_DIR = "C:\\path\\to\\runs" }
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
If you use `martin mcp install`, it will only write a starter host config when the target file is absent, or when it detects an existing Martin Loop block and can remain idempotent. Otherwise it refuses to overwrite mixed host config so you can merge safely.
|
|
130
|
-
|
|
131
|
-
When `CODEX_HOME` is set, Codex user-scope installs target `CODEX_HOME\\config.toml` instead of the default user path.
|
|
132
|
-
|
|
133
|
-
Registry/server identifier: `io.github.Keesan12/martin-loop`
|
|
134
|
-
|
|
135
|
-
## Host coverage
|
|
136
|
-
|
|
137
|
-
- `codex`: local stdio profiles
|
|
138
|
-
- `claude`: local, user, and project scopes
|
|
139
|
-
- `gemini`: local `settings.json` snippets with `includeTools`
|
|
140
|
-
- `generic`: JSON config for MCP-aware wrappers
|
|
141
|
-
|
|
142
|
-
Operating-system launcher behavior is explicit:
|
|
143
|
-
|
|
144
|
-
- Windows: `cmd /c npx -y @martinloop/mcp`
|
|
145
|
-
- macOS/Linux: `npx -y @martinloop/mcp`
|
|
146
|
-
|
|
147
|
-
Claude `--scope local` remains CLI-managed. `martin mcp install --host claude --scope local` shells out to Claude Code directly instead of fabricating a repo config file for that scope.
|
|
148
|
-
|
|
149
|
-
## Discovery metadata
|
|
150
|
-
|
|
151
|
-
- JSON resources now carry `metadata.serverVersion` and `metadata.discoveryRevision`.
|
|
152
|
-
- Environment-specific path details stay in `martin://server/health` instead of low-context discovery metadata.
|
|
153
|
-
- Compact resources expose low-token latest-run summaries, proof cards, budget status, verifier evidence, rollback evidence, and a single recommended next step.
|
|
154
|
-
- Prompts stamp the current server version and discovery revision into their descriptions so hosts can confirm which surface they discovered.
|
|
155
|
-
- The server does **not** advertise `listChanged` yet. That is deliberate: the current discovery surface is stable and versioned, but it does not yet emit authoritative change notifications.
|
|
156
|
-
|
|
157
|
-
## Runtime Model
|
|
158
|
-
|
|
159
|
-
- `martin_run` is the only execution entrypoint.
|
|
160
|
-
- All other Martin MCP tools are read-only.
|
|
161
|
-
- Live runs require `claude` or `codex` on `PATH`.
|
|
162
|
-
- Stub or smoke flows use `MARTIN_LIVE=false`.
|
|
163
|
-
- Paths stay bounded to the configured workspace root and runs root.
|
|
164
|
-
- Direct raw-model compatibility is not the target. Martin Loop supports hosts and wrappers that speak MCP; open-source model families such as Gemma or Nemotron should use the `generic` host path through an MCP-capable shell or runtime.
|
|
165
|
-
|
|
166
|
-
## Operator Notes
|
|
115
|
+
## Compatibility posture
|
|
167
116
|
|
|
168
|
-
- `
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
- `
|
|
172
|
-
- Resources and prompts reuse the same run-store selectors as the tools; they are discovery surfaces, not a second data model.
|
|
173
|
-
- The recommended host default is the `minimal` profile: `martin_doctor`, `martin_preflight`, `martin_list_runs`, `martin_triage_runs`, and `martin_run_dossier`. Use `diagnostic` for read-only archaeology and `full-local` only when the host should execute runs.
|
|
174
|
-
|
|
175
|
-
## Debugging
|
|
176
|
-
|
|
177
|
-
Use the live handshake inspector before you blame the host:
|
|
178
|
-
|
|
179
|
-
```sh
|
|
180
|
-
pnpm --filter @martinloop/mcp inspect:live
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
If you want the official MCP Inspector UI, point it at the same stdio launch command:
|
|
184
|
-
|
|
185
|
-
```sh
|
|
186
|
-
npx @modelcontextprotocol/inspector --command npx --args "-y,@martinloop/mcp"
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
The stdio server keeps protocol output on stdout and diagnostic logging on stderr. When a host integration goes sideways, confirm the live discovery surface first, then move on to the host config.
|
|
190
|
-
|
|
191
|
-
For WSL or Linux validation, do a native install on that platform before you smoke the package. Reusing Windows-installed `node_modules` across WSL will fail on native dependencies such as `esbuild`, which looks like a transport failure but is really a cross-platform install mismatch.
|
|
117
|
+
- `martin_run` remains the single execution entrypoint.
|
|
118
|
+
- Read-only inspection stays available without execution-capable profiles.
|
|
119
|
+
- The OSS package stays focused on local stdio workflows. Hosted and team features live on a separate product track.
|
|
120
|
+
- Later `0.3.x` releases should widen adoption and guidance without blurring those boundaries.
|
|
192
121
|
|
|
193
122
|
## Verification
|
|
194
123
|
|
|
195
|
-
From the repository root:
|
|
196
|
-
|
|
197
124
|
```sh
|
|
198
125
|
pnpm --filter @martinloop/mcp lint
|
|
199
126
|
pnpm --filter @martinloop/mcp test
|
|
@@ -201,23 +128,4 @@ pnpm --filter @martinloop/mcp build
|
|
|
201
128
|
pnpm --filter @martinloop/mcp smoke:pack
|
|
202
129
|
pnpm --filter @martinloop/mcp smoke:published:pack
|
|
203
130
|
pnpm --filter @martinloop/mcp verify:release
|
|
204
|
-
pnpm --filter @martin/cli verify:hosts:live
|
|
205
|
-
pnpm --filter @martinloop/mcp smoke:published
|
|
206
|
-
pnpm --filter @martinloop/mcp inspect:live
|
|
207
131
|
```
|
|
208
|
-
|
|
209
|
-
- `smoke:pack` verifies the packed tarball and stdio launch path.
|
|
210
|
-
- `smoke:published:pack` verifies install-and-run behavior from a freshly packed local tarball through the installed `mcp` bin before npm publish.
|
|
211
|
-
- `verify:release` checks metadata parity, release-note presence, install docs, and discovery-surface claims.
|
|
212
|
-
- `@martin/cli verify:hosts:live` proves the generated host config against the real Codex, Claude, and Gemini CLIs on this machine.
|
|
213
|
-
- `smoke:published` remains a post-publish npm gate.
|
|
214
|
-
|
|
215
|
-
## Compatibility
|
|
216
|
-
|
|
217
|
-
`0.2.5` is the current integrated governed execution cockpit line:
|
|
218
|
-
|
|
219
|
-
- `martin_run`, `martin_inspect`, `martin_status`, `martin_doctor`, and `martin_preflight` remain backward-compatible.
|
|
220
|
-
- New read-only surfaces are additive.
|
|
221
|
-
- No new write-capable MCP tools are introduced in `0.2.5`.
|
|
222
|
-
|
|
223
|
-
See `docs/release/MCP-COMPATIBILITY.md`, `docs/release/MCP-0.2.0-RELEASE-NOTES.md`, and `docs/release/MCP-0.2.5-RELEASE-NOTES.md` for the public release contract and delivery sequence.
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
export declare const MARTIN_TOOL_NAMES: readonly ["martin_run", "martin_inspect", "martin_status", "martin_doctor", "martin_preflight", "martin_list_runs", "martin_triage_runs", "martin_get_run", "martin_get_attempt", "martin_get_verification_results", "martin_run_dossier"];
|
|
2
|
-
export declare const MARTIN_STARTER_TOOL_NAMES: readonly ["martin_doctor", "martin_preflight", "martin_run", "martin_triage_runs", "
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
1
|
+
export declare const MARTIN_TOOL_NAMES: readonly ["martin_run", "martin_inspect", "martin_status", "martin_doctor", "martin_plan", "martin_preflight", "martin_logs", "martin_pause", "martin_cancel", "martin_continue", "martin_list_runs", "martin_triage_runs", "martin_get_run", "martin_get_attempt", "martin_get_verification_results", "martin_run_dossier", "martin_dossier", "martin_eval", "martin_pr_summary", "martin_create_pr", "martin_review_pr"];
|
|
2
|
+
export declare const MARTIN_STARTER_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_run", "martin_triage_runs", "martin_dossier"];
|
|
3
|
+
export declare const MARTIN_MINIMAL_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_list_runs", "martin_triage_runs", "martin_dossier"];
|
|
4
|
+
export declare const MARTIN_DIAGNOSTIC_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_logs", "martin_list_runs", "martin_triage_runs", "martin_get_run", "martin_get_attempt", "martin_get_verification_results", "martin_dossier", "martin_eval"];
|
|
5
|
+
export declare const MARTIN_GITHUB_REVIEW_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_dossier", "martin_eval", "martin_pr_summary", "martin_create_pr", "martin_review_pr"];
|
|
6
|
+
export declare const MARTIN_PAID_REMOTE_TOOL_NAMES: readonly ["martin_doctor", "martin_plan", "martin_preflight", "martin_run", "martin_list_runs", "martin_triage_runs", "martin_get_run", "martin_get_verification_results", "martin_dossier", "martin_eval"];
|
|
7
|
+
export declare const MARTIN_RESOURCE_URIS: readonly ["martin://server/health", "martin://runs/recent", "martin://runs/triage", "martin://runs/latest", "martin://runs/latest/summary", "martin://runs/latest/proof-card", "martin://runs/latest/budget-status", "martin://runs/latest/verifier-evidence", "martin://runs/latest/rollback-evidence", "martin://policies/current", "martin://repo/risk-map", "martin://verifiers/results", "martin://agent/next-step", "martin://guides/mcp-usage", "martin://guides/agent-start", "martin://guides/command-map", "martin://guides/ide-onboarding", "martin://guides/operating-rules", "martin://guides/publish-readiness"];
|
|
8
|
+
export declare const MARTIN_RESOURCE_TEMPLATE_URIS: readonly ["martin://runs/{loopId}", "martin://runs/{loopId}/dossier", "martin://runs/{loopId}/attempts/{attemptIndex}", "martin://runs/{loopId}/verification"];
|
|
9
|
+
export declare const MARTIN_PROMPT_NAMES: readonly ["martin_start", "martin_preflight", "martin_triage", "martin_resume", "martin_prove", "martin_release_check", "martin_governed_coding_kickoff", "martin_debug_failed_run", "martin_publish_readiness_review", "martin_triage_run_store", "safe_bug_fix", "write_tests_first", "small_refactor", "security_review", "pr_review", "release_check"];
|
|
6
10
|
export interface MartinDiscoveryMetadata {
|
|
7
11
|
serverVersion: string;
|
|
8
12
|
discoveryRevision: string;
|
|
@@ -12,5 +16,6 @@ export interface MartinDiscoveryMetadata {
|
|
|
12
16
|
resourceTemplateCount: number;
|
|
13
17
|
promptCount: number;
|
|
14
18
|
starterTools: string[];
|
|
19
|
+
profiles: Record<string, string[]>;
|
|
15
20
|
}
|
|
16
21
|
export declare function buildMartinDiscoveryMetadata(serverVersion: string): MartinDiscoveryMetadata;
|
|
@@ -4,38 +4,119 @@ export const MARTIN_TOOL_NAMES = [
|
|
|
4
4
|
"martin_inspect",
|
|
5
5
|
"martin_status",
|
|
6
6
|
"martin_doctor",
|
|
7
|
+
"martin_plan",
|
|
7
8
|
"martin_preflight",
|
|
9
|
+
"martin_logs",
|
|
10
|
+
"martin_pause",
|
|
11
|
+
"martin_cancel",
|
|
12
|
+
"martin_continue",
|
|
8
13
|
"martin_list_runs",
|
|
9
14
|
"martin_triage_runs",
|
|
10
15
|
"martin_get_run",
|
|
11
16
|
"martin_get_attempt",
|
|
12
17
|
"martin_get_verification_results",
|
|
13
|
-
"martin_run_dossier"
|
|
18
|
+
"martin_run_dossier",
|
|
19
|
+
"martin_dossier",
|
|
20
|
+
"martin_eval",
|
|
21
|
+
"martin_pr_summary",
|
|
22
|
+
"martin_create_pr",
|
|
23
|
+
"martin_review_pr"
|
|
14
24
|
];
|
|
15
25
|
export const MARTIN_STARTER_TOOL_NAMES = [
|
|
16
26
|
"martin_doctor",
|
|
27
|
+
"martin_plan",
|
|
17
28
|
"martin_preflight",
|
|
18
29
|
"martin_run",
|
|
19
30
|
"martin_triage_runs",
|
|
20
|
-
"
|
|
31
|
+
"martin_dossier"
|
|
32
|
+
];
|
|
33
|
+
export const MARTIN_MINIMAL_TOOL_NAMES = [
|
|
34
|
+
"martin_doctor",
|
|
35
|
+
"martin_plan",
|
|
36
|
+
"martin_preflight",
|
|
37
|
+
"martin_list_runs",
|
|
38
|
+
"martin_triage_runs",
|
|
39
|
+
"martin_dossier"
|
|
40
|
+
];
|
|
41
|
+
export const MARTIN_DIAGNOSTIC_TOOL_NAMES = [
|
|
42
|
+
"martin_doctor",
|
|
43
|
+
"martin_plan",
|
|
44
|
+
"martin_preflight",
|
|
45
|
+
"martin_logs",
|
|
46
|
+
"martin_list_runs",
|
|
47
|
+
"martin_triage_runs",
|
|
48
|
+
"martin_get_run",
|
|
49
|
+
"martin_get_attempt",
|
|
50
|
+
"martin_get_verification_results",
|
|
51
|
+
"martin_dossier",
|
|
52
|
+
"martin_eval"
|
|
53
|
+
];
|
|
54
|
+
export const MARTIN_GITHUB_REVIEW_TOOL_NAMES = [
|
|
55
|
+
"martin_doctor",
|
|
56
|
+
"martin_plan",
|
|
57
|
+
"martin_preflight",
|
|
58
|
+
"martin_dossier",
|
|
59
|
+
"martin_eval",
|
|
60
|
+
"martin_pr_summary",
|
|
61
|
+
"martin_create_pr",
|
|
62
|
+
"martin_review_pr"
|
|
63
|
+
];
|
|
64
|
+
export const MARTIN_PAID_REMOTE_TOOL_NAMES = [
|
|
65
|
+
"martin_doctor",
|
|
66
|
+
"martin_plan",
|
|
67
|
+
"martin_preflight",
|
|
68
|
+
"martin_run",
|
|
69
|
+
"martin_list_runs",
|
|
70
|
+
"martin_triage_runs",
|
|
71
|
+
"martin_get_run",
|
|
72
|
+
"martin_get_verification_results",
|
|
73
|
+
"martin_dossier",
|
|
74
|
+
"martin_eval"
|
|
21
75
|
];
|
|
22
76
|
export const MARTIN_RESOURCE_URIS = [
|
|
23
77
|
"martin://server/health",
|
|
24
78
|
"martin://runs/recent",
|
|
25
79
|
"martin://runs/triage",
|
|
80
|
+
"martin://runs/latest",
|
|
81
|
+
"martin://runs/latest/summary",
|
|
82
|
+
"martin://runs/latest/proof-card",
|
|
83
|
+
"martin://runs/latest/budget-status",
|
|
84
|
+
"martin://runs/latest/verifier-evidence",
|
|
85
|
+
"martin://runs/latest/rollback-evidence",
|
|
86
|
+
"martin://policies/current",
|
|
87
|
+
"martin://repo/risk-map",
|
|
88
|
+
"martin://verifiers/results",
|
|
89
|
+
"martin://agent/next-step",
|
|
26
90
|
"martin://guides/mcp-usage",
|
|
91
|
+
"martin://guides/agent-start",
|
|
92
|
+
"martin://guides/command-map",
|
|
93
|
+
"martin://guides/ide-onboarding",
|
|
94
|
+
"martin://guides/operating-rules",
|
|
27
95
|
"martin://guides/publish-readiness"
|
|
28
96
|
];
|
|
29
97
|
export const MARTIN_RESOURCE_TEMPLATE_URIS = [
|
|
30
98
|
"martin://runs/{loopId}",
|
|
99
|
+
"martin://runs/{loopId}/dossier",
|
|
31
100
|
"martin://runs/{loopId}/attempts/{attemptIndex}",
|
|
32
101
|
"martin://runs/{loopId}/verification"
|
|
33
102
|
];
|
|
34
103
|
export const MARTIN_PROMPT_NAMES = [
|
|
104
|
+
"martin_start",
|
|
105
|
+
"martin_preflight",
|
|
106
|
+
"martin_triage",
|
|
107
|
+
"martin_resume",
|
|
108
|
+
"martin_prove",
|
|
109
|
+
"martin_release_check",
|
|
35
110
|
"martin_governed_coding_kickoff",
|
|
36
111
|
"martin_debug_failed_run",
|
|
37
112
|
"martin_publish_readiness_review",
|
|
38
|
-
"martin_triage_run_store"
|
|
113
|
+
"martin_triage_run_store",
|
|
114
|
+
"safe_bug_fix",
|
|
115
|
+
"write_tests_first",
|
|
116
|
+
"small_refactor",
|
|
117
|
+
"security_review",
|
|
118
|
+
"pr_review",
|
|
119
|
+
"release_check"
|
|
39
120
|
];
|
|
40
121
|
export function buildMartinDiscoveryMetadata(serverVersion) {
|
|
41
122
|
const surface = {
|
|
@@ -43,7 +124,15 @@ export function buildMartinDiscoveryMetadata(serverVersion) {
|
|
|
43
124
|
resources: [...MARTIN_RESOURCE_URIS],
|
|
44
125
|
resourceTemplates: [...MARTIN_RESOURCE_TEMPLATE_URIS],
|
|
45
126
|
prompts: [...MARTIN_PROMPT_NAMES],
|
|
46
|
-
starterTools: [...MARTIN_STARTER_TOOL_NAMES]
|
|
127
|
+
starterTools: [...MARTIN_STARTER_TOOL_NAMES],
|
|
128
|
+
profiles: {
|
|
129
|
+
minimal: [...MARTIN_MINIMAL_TOOL_NAMES],
|
|
130
|
+
diagnostic: [...MARTIN_DIAGNOSTIC_TOOL_NAMES],
|
|
131
|
+
"github-review": [...MARTIN_GITHUB_REVIEW_TOOL_NAMES],
|
|
132
|
+
"full-local": [...MARTIN_TOOL_NAMES],
|
|
133
|
+
starter: [...MARTIN_STARTER_TOOL_NAMES],
|
|
134
|
+
full: [...MARTIN_TOOL_NAMES]
|
|
135
|
+
}
|
|
47
136
|
};
|
|
48
137
|
const discoveryRevision = createHash("sha256")
|
|
49
138
|
.update(JSON.stringify({ serverVersion, surface }))
|
|
@@ -57,6 +146,7 @@ export function buildMartinDiscoveryMetadata(serverVersion) {
|
|
|
57
146
|
resourceCount: surface.resources.length,
|
|
58
147
|
resourceTemplateCount: surface.resourceTemplates.length,
|
|
59
148
|
promptCount: surface.prompts.length,
|
|
60
|
-
starterTools: [...surface.starterTools]
|
|
149
|
+
starterTools: [...surface.starterTools],
|
|
150
|
+
profiles: surface.profiles
|
|
61
151
|
};
|
|
62
152
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const MARTIN_MCP_PACKAGE_VERSION = "0.
|
|
1
|
+
export declare const MARTIN_MCP_PACKAGE_VERSION = "0.3.0";
|
package/dist/package-version.js
CHANGED
package/dist/prompts.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface MartinGetPromptInput {
|
|
|
5
5
|
arguments?: Record<string, string>;
|
|
6
6
|
runsDir?: string;
|
|
7
7
|
workingDirectory?: string;
|
|
8
|
-
engine?: "claude" | "codex";
|
|
8
|
+
engine?: "claude" | "codex" | "gemini";
|
|
9
9
|
}
|
|
10
10
|
export declare function listMartinPrompts(): {
|
|
11
11
|
prompts: Prompt[];
|
package/dist/prompts.js
CHANGED
|
@@ -108,6 +108,56 @@ export const MARTIN_PROMPTS = [
|
|
|
108
108
|
arguments: [
|
|
109
109
|
{ name: "focus", description: "Optional triage focus, such as verification failures, budget pressure, or publish blockers." }
|
|
110
110
|
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "safe_bug_fix",
|
|
114
|
+
title: "Safe Bug Fix",
|
|
115
|
+
description: appendPromptMetadata("Plan a small scoped bug fix through doctor, plan, preflight, run, and dossier."),
|
|
116
|
+
arguments: [
|
|
117
|
+
{ name: "objective", description: "Bug fix objective.", required: true }
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: "write_tests_first",
|
|
122
|
+
title: "Write Tests First",
|
|
123
|
+
description: appendPromptMetadata("Constrain the plan around failing tests first, then a small fix."),
|
|
124
|
+
arguments: [
|
|
125
|
+
{ name: "objective", description: "Objective to satisfy with tests-first discipline.", required: true }
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: "small_refactor",
|
|
130
|
+
title: "Small Refactor",
|
|
131
|
+
description: appendPromptMetadata("Keep a refactor small, verifier-backed, and path-scoped."),
|
|
132
|
+
arguments: [
|
|
133
|
+
{ name: "objective", description: "Refactor objective.", required: true }
|
|
134
|
+
]
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: "security_review",
|
|
138
|
+
title: "Security Review",
|
|
139
|
+
description: appendPromptMetadata("Review a risky change with Martin risk, scope, and verifier evidence first."),
|
|
140
|
+
arguments: [
|
|
141
|
+
{ name: "objective", description: "Security review focus.", required: true }
|
|
142
|
+
]
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "pr_review",
|
|
146
|
+
title: "PR Review",
|
|
147
|
+
description: appendPromptMetadata("Generate a Martin-aware PR review checklist with dossier and eval evidence."),
|
|
148
|
+
arguments: [
|
|
149
|
+
{ name: "objective", description: "Review objective.", required: true },
|
|
150
|
+
{ name: "loopId", description: "Optional loop identifier to review." }
|
|
151
|
+
]
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "release_check",
|
|
155
|
+
title: "Release Check",
|
|
156
|
+
description: appendPromptMetadata("Run a release-readiness check grounded in Martin evidence."),
|
|
157
|
+
arguments: [
|
|
158
|
+
{ name: "objective", description: "Release check objective.", required: true },
|
|
159
|
+
{ name: "loopId", description: "Optional loop identifier for concrete evidence." }
|
|
160
|
+
]
|
|
111
161
|
}
|
|
112
162
|
];
|
|
113
163
|
export function listMartinPrompts() {
|
|
@@ -141,6 +191,7 @@ export async function getMartinPrompt(input) {
|
|
|
141
191
|
});
|
|
142
192
|
case "martin_release_check":
|
|
143
193
|
case "martin_publish_readiness_review":
|
|
194
|
+
case "release_check":
|
|
144
195
|
return buildPublishReadinessPrompt({
|
|
145
196
|
args,
|
|
146
197
|
runsDir: context.runsRoot
|
|
@@ -161,6 +212,16 @@ export async function getMartinPrompt(input) {
|
|
|
161
212
|
args,
|
|
162
213
|
runsDir: context.runsRoot
|
|
163
214
|
});
|
|
215
|
+
case "safe_bug_fix":
|
|
216
|
+
return buildWorkflowPrompt(args, "safe bug fix", "Keep the file scope narrow and verifier-backed.");
|
|
217
|
+
case "write_tests_first":
|
|
218
|
+
return buildWorkflowPrompt(args, "tests-first change", "Write or update the targeted verifier before widening the implementation.");
|
|
219
|
+
case "small_refactor":
|
|
220
|
+
return buildWorkflowPrompt(args, "small refactor", "Preserve behavior and keep the diff easy to review.");
|
|
221
|
+
case "security_review":
|
|
222
|
+
return buildWorkflowPrompt(args, "security-sensitive change", "Escalate if auth, secrets, payments, or infra paths are involved.");
|
|
223
|
+
case "pr_review":
|
|
224
|
+
return buildWorkflowPrompt(args, "PR review", "Use martin_dossier and martin_eval before any approval decision.");
|
|
164
225
|
default:
|
|
165
226
|
throw invalidArgumentsError(`Unknown prompt '${input.name}'.`, "Use prompts/list to discover the available Martin prompt names.");
|
|
166
227
|
}
|
|
@@ -172,12 +233,24 @@ async function buildKickoffPrompt(input) {
|
|
|
172
233
|
runsDir: input.runsDir,
|
|
173
234
|
workingDirectory: input.workingDirectory
|
|
174
235
|
});
|
|
236
|
+
const commandMapGuide = await readMartinResource({
|
|
237
|
+
uri: MARTIN_STATIC_RESOURCE_URIS.commandMapGuide,
|
|
238
|
+
runsDir: input.runsDir,
|
|
239
|
+
workingDirectory: input.workingDirectory
|
|
240
|
+
});
|
|
241
|
+
const operatingRulesGuide = await readMartinResource({
|
|
242
|
+
uri: MARTIN_STATIC_RESOURCE_URIS.operatingRulesGuide,
|
|
243
|
+
runsDir: input.runsDir,
|
|
244
|
+
workingDirectory: input.workingDirectory
|
|
245
|
+
});
|
|
175
246
|
const healthResource = MARTIN_STATIC_RESOURCES.find((resource) => resource.uri === MARTIN_STATIC_RESOURCE_URIS.serverHealth);
|
|
176
247
|
return {
|
|
177
248
|
description: appendPromptMetadata("Kick off a Martin-governed coding session with explicit scope, budgets, and verification expectations."),
|
|
178
249
|
messages: [
|
|
179
|
-
textMessage("assistant", "You are helping prepare a Martin Loop coding run. Keep the plan governed: validate the environment first, preflight non-trivial work, preserve scope discipline, and make verification requirements explicit."),
|
|
250
|
+
textMessage("assistant", "You are helping prepare a Martin Loop coding run. Keep the plan governed: validate the environment first, plan before spend, preflight non-trivial work, preserve scope discipline, and make verification requirements explicit. Do not skip Martin commands and do not treat Martin as optional."),
|
|
180
251
|
embeddedResourceMessage("assistant", firstResourceContent(usageGuide)),
|
|
252
|
+
embeddedResourceMessage("assistant", firstResourceContent(commandMapGuide)),
|
|
253
|
+
embeddedResourceMessage("assistant", firstResourceContent(operatingRulesGuide)),
|
|
181
254
|
...(healthResource ? [resourceLinkMessage("assistant", healthResource)] : []),
|
|
182
255
|
textMessage("user", joinSections([
|
|
183
256
|
"Prepare a Martin Loop kickoff plan and a ready-to-send `martin_preflight` payload for this task.",
|
|
@@ -193,6 +266,7 @@ async function buildKickoffPrompt(input) {
|
|
|
193
266
|
optionalLine("Workspace ID", input.args["workspaceId"]),
|
|
194
267
|
optionalLine("Project ID", input.args["projectId"]),
|
|
195
268
|
"Return:",
|
|
269
|
+
"- the required Martin command order before actual coding work begins,",
|
|
196
270
|
"- a concise governed execution plan,",
|
|
197
271
|
"- the exact `martin_preflight` arguments,",
|
|
198
272
|
"- the main risks or blockers to resolve before `martin_run`."
|
|
@@ -304,6 +378,24 @@ async function buildTriageRunStorePrompt(input) {
|
|
|
304
378
|
]
|
|
305
379
|
};
|
|
306
380
|
}
|
|
381
|
+
async function buildWorkflowPrompt(args, label, guardrail) {
|
|
382
|
+
const objective = requirePromptArgument(args, "objective");
|
|
383
|
+
return {
|
|
384
|
+
description: appendPromptMetadata(`Guide an agent through a ${label} with Martin governance.`),
|
|
385
|
+
messages: [
|
|
386
|
+
textMessage("assistant", "Use Martin as the command center: doctor first, then plan, preflight, run, dossier, and eval. Do not jump directly to execution."),
|
|
387
|
+
textMessage("user", joinSections([
|
|
388
|
+
`Objective: ${objective}`,
|
|
389
|
+
`Guardrail: ${guardrail}`,
|
|
390
|
+
"Return:",
|
|
391
|
+
"- the first Martin tool to call,",
|
|
392
|
+
"- the proposed file scope,",
|
|
393
|
+
"- the verifier plan,",
|
|
394
|
+
"- the conditions that should block or escalate the run."
|
|
395
|
+
]))
|
|
396
|
+
]
|
|
397
|
+
};
|
|
398
|
+
}
|
|
307
399
|
async function buildResumePrompt(input) {
|
|
308
400
|
const loopId = input.args["loopId"]?.trim();
|
|
309
401
|
const messages = [
|
package/dist/resources.d.ts
CHANGED
|
@@ -3,13 +3,21 @@ export declare const MARTIN_STATIC_RESOURCE_URIS: {
|
|
|
3
3
|
readonly serverHealth: "martin://server/health";
|
|
4
4
|
readonly recentRuns: "martin://runs/recent";
|
|
5
5
|
readonly triage: "martin://runs/triage";
|
|
6
|
+
readonly latestRun: "martin://runs/latest";
|
|
6
7
|
readonly latestSummary: "martin://runs/latest/summary";
|
|
7
8
|
readonly latestProofCard: "martin://runs/latest/proof-card";
|
|
8
9
|
readonly latestBudgetStatus: "martin://runs/latest/budget-status";
|
|
9
10
|
readonly latestVerifierEvidence: "martin://runs/latest/verifier-evidence";
|
|
10
11
|
readonly latestRollbackEvidence: "martin://runs/latest/rollback-evidence";
|
|
12
|
+
readonly currentPolicies: "martin://policies/current";
|
|
13
|
+
readonly repoRiskMap: "martin://repo/risk-map";
|
|
14
|
+
readonly verifierResults: "martin://verifiers/results";
|
|
11
15
|
readonly agentNextStep: "martin://agent/next-step";
|
|
12
16
|
readonly mcpUsageGuide: "martin://guides/mcp-usage";
|
|
17
|
+
readonly agentStartGuide: "martin://guides/agent-start";
|
|
18
|
+
readonly commandMapGuide: "martin://guides/command-map";
|
|
19
|
+
readonly ideOnboardingGuide: "martin://guides/ide-onboarding";
|
|
20
|
+
readonly operatingRulesGuide: "martin://guides/operating-rules";
|
|
13
21
|
readonly publishReadinessGuide: "martin://guides/publish-readiness";
|
|
14
22
|
};
|
|
15
23
|
export declare const MARTIN_RESOURCE_TEMPLATES: ResourceTemplate[];
|
|
@@ -18,7 +26,7 @@ export interface MartinReadResourceInput {
|
|
|
18
26
|
uri: string;
|
|
19
27
|
runsDir?: string;
|
|
20
28
|
workingDirectory?: string;
|
|
21
|
-
engine?: "claude" | "codex";
|
|
29
|
+
engine?: "claude" | "codex" | "gemini";
|
|
22
30
|
}
|
|
23
31
|
export declare function listMartinResources(): {
|
|
24
32
|
resources: Resource[];
|