@mushi-mushi/mcp-ci 0.2.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/LICENSE +21 -0
- package/action.yml +45 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +93 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kenji Sakuramoto
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/action.yml
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
name: 'Mushi Mushi CI Gate'
|
|
2
|
+
description: 'Run Mushi Mushi MCP tools from GitHub Actions — trigger judge, dispatch fixes, gate PR merges on classification coverage.'
|
|
3
|
+
author: 'Kenji Sakuramoto'
|
|
4
|
+
branding:
|
|
5
|
+
icon: bug
|
|
6
|
+
color: green
|
|
7
|
+
|
|
8
|
+
inputs:
|
|
9
|
+
api-key:
|
|
10
|
+
description: 'Mushi project API key (store as a repo secret).'
|
|
11
|
+
required: true
|
|
12
|
+
project-id:
|
|
13
|
+
description: 'Mushi project UUID.'
|
|
14
|
+
required: true
|
|
15
|
+
api-endpoint:
|
|
16
|
+
description: 'Override API endpoint for self-hosted instances.'
|
|
17
|
+
required: false
|
|
18
|
+
default: 'https://dxptnwrhwsqckaftyymj.supabase.co/functions/v1/api'
|
|
19
|
+
command:
|
|
20
|
+
description: 'Which MCP tool to run: trigger-judge | dispatch-fix | check-coverage | query'
|
|
21
|
+
required: true
|
|
22
|
+
report-id:
|
|
23
|
+
description: 'Report UUID — required for dispatch-fix.'
|
|
24
|
+
required: false
|
|
25
|
+
question:
|
|
26
|
+
description: 'NL query text — required for command=query.'
|
|
27
|
+
required: false
|
|
28
|
+
min-coverage:
|
|
29
|
+
description: 'For check-coverage: minimum classified/total ratio to pass.'
|
|
30
|
+
required: false
|
|
31
|
+
default: '0.8'
|
|
32
|
+
fail-on-quota:
|
|
33
|
+
description: 'Whether to fail the action when Mushi returns 402 QUOTA_EXCEEDED.'
|
|
34
|
+
required: false
|
|
35
|
+
default: 'true'
|
|
36
|
+
|
|
37
|
+
outputs:
|
|
38
|
+
result:
|
|
39
|
+
description: 'JSON payload returned by the MCP tool.'
|
|
40
|
+
coverage:
|
|
41
|
+
description: 'For check-coverage: observed classified ratio.'
|
|
42
|
+
|
|
43
|
+
runs:
|
|
44
|
+
using: 'node20'
|
|
45
|
+
main: 'dist/cli.js'
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli.ts
|
|
4
|
+
import * as core from "@actions/core";
|
|
5
|
+
async function api(endpoint, apiKey, projectId, path, init) {
|
|
6
|
+
const res = await fetch(`${endpoint}${path}`, {
|
|
7
|
+
...init,
|
|
8
|
+
headers: {
|
|
9
|
+
"Content-Type": "application/json",
|
|
10
|
+
"X-Mushi-Api-Key": apiKey,
|
|
11
|
+
"X-Mushi-Project": projectId,
|
|
12
|
+
...init?.headers ?? {}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const text = await res.text();
|
|
16
|
+
let body;
|
|
17
|
+
try {
|
|
18
|
+
body = JSON.parse(text);
|
|
19
|
+
} catch {
|
|
20
|
+
body = { ok: false, error: { code: `HTTP_${res.status}`, message: text.slice(0, 500) } };
|
|
21
|
+
}
|
|
22
|
+
return body;
|
|
23
|
+
}
|
|
24
|
+
async function main() {
|
|
25
|
+
const apiKey = core.getInput("api-key", { required: true });
|
|
26
|
+
const projectId = core.getInput("project-id", { required: true });
|
|
27
|
+
const endpoint = core.getInput("api-endpoint").replace(/\/$/, "");
|
|
28
|
+
const command = core.getInput("command", { required: true });
|
|
29
|
+
const failOnQuota = core.getInput("fail-on-quota") !== "false";
|
|
30
|
+
switch (command) {
|
|
31
|
+
case "trigger-judge": {
|
|
32
|
+
const res = await api(endpoint, apiKey, projectId, "/v1/admin/judge/run", {
|
|
33
|
+
method: "POST",
|
|
34
|
+
body: JSON.stringify({ limit: 50, projectId })
|
|
35
|
+
});
|
|
36
|
+
handleResult(res, failOnQuota);
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case "dispatch-fix": {
|
|
40
|
+
const reportId = core.getInput("report-id", { required: true });
|
|
41
|
+
const res = await api(endpoint, apiKey, projectId, "/v1/admin/fixes/dispatch", {
|
|
42
|
+
method: "POST",
|
|
43
|
+
body: JSON.stringify({ reportId })
|
|
44
|
+
});
|
|
45
|
+
handleResult(res, failOnQuota);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case "check-coverage": {
|
|
49
|
+
const minCoverage = Number(core.getInput("min-coverage") || "0.8");
|
|
50
|
+
const res = await api(endpoint, apiKey, projectId, "/v1/admin/stats");
|
|
51
|
+
if (!res.ok || !res.data) {
|
|
52
|
+
core.setFailed(`stats query failed: ${res.error?.message ?? "unknown"}`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const ratio = res.data.total === 0 ? 1 : res.data.classified / res.data.total;
|
|
56
|
+
core.setOutput("coverage", ratio.toFixed(3));
|
|
57
|
+
core.setOutput("result", JSON.stringify(res.data));
|
|
58
|
+
if (ratio < minCoverage) {
|
|
59
|
+
core.setFailed(`classification coverage ${ratio.toFixed(3)} below threshold ${minCoverage}`);
|
|
60
|
+
} else {
|
|
61
|
+
core.info(`classification coverage ${ratio.toFixed(3)} >= ${minCoverage} \u2713`);
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
case "query": {
|
|
66
|
+
const question = core.getInput("question", { required: true });
|
|
67
|
+
const res = await api(endpoint, apiKey, projectId, "/v1/admin/query", {
|
|
68
|
+
method: "POST",
|
|
69
|
+
body: JSON.stringify({ question })
|
|
70
|
+
});
|
|
71
|
+
handleResult(res, failOnQuota);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
default:
|
|
75
|
+
core.setFailed(`unknown command: ${command}. Expected trigger-judge | dispatch-fix | check-coverage | query.`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
function handleResult(res, failOnQuota) {
|
|
79
|
+
core.setOutput("result", JSON.stringify(res));
|
|
80
|
+
if (!res.ok) {
|
|
81
|
+
if (res.error?.code === "QUOTA_EXCEEDED" && !failOnQuota) {
|
|
82
|
+
core.warning(`quota exceeded, skipping: ${res.error?.message}`);
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
core.setFailed(`${res.error?.code ?? "ERROR"}: ${res.error?.message ?? "unknown"}`);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
core.info(`Mushi ok: ${JSON.stringify(res.data).slice(0, 500)}`);
|
|
89
|
+
}
|
|
90
|
+
main().catch((err) => {
|
|
91
|
+
core.setFailed(err.message);
|
|
92
|
+
});
|
|
93
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport * as core from '@actions/core'\n\n/**\n * Wave G2 — GitHub Action entrypoint.\n *\n * Intentionally NOT a full MCP client. The Action runs in a short-lived CI\n * job where spinning up an MCP server + stdio transport would add latency\n * for zero benefit. We hit the same REST endpoints the MCP tools call\n * (`/v1/admin/*`) directly, forward the result, and fail/pass the step.\n *\n * If a user wants the full MCP experience in CI, they install the\n * `@mushi-mushi/mcp` npm package and talk to it over stdio from their own\n * Claude Code / Codex CLI step. This Action is the 80% glue path: \"hey CI,\n * block merging until Mushi finishes triaging my reports\".\n */\n\ninterface ApiResp<T = unknown> { ok: boolean; data?: T; error?: { code: string; message: string } }\n\nasync function api<T>(endpoint: string, apiKey: string, projectId: string, path: string, init?: RequestInit): Promise<ApiResp<T>> {\n const res = await fetch(`${endpoint}${path}`, {\n ...init,\n headers: {\n 'Content-Type': 'application/json',\n 'X-Mushi-Api-Key': apiKey,\n 'X-Mushi-Project': projectId,\n ...(init?.headers ?? {}),\n },\n })\n const text = await res.text()\n let body: ApiResp<T>\n try { body = JSON.parse(text) as ApiResp<T> } catch { body = { ok: false, error: { code: `HTTP_${res.status}`, message: text.slice(0, 500) } } }\n return body\n}\n\nasync function main(): Promise<void> {\n const apiKey = core.getInput('api-key', { required: true })\n const projectId = core.getInput('project-id', { required: true })\n const endpoint = core.getInput('api-endpoint').replace(/\\/$/, '')\n const command = core.getInput('command', { required: true })\n const failOnQuota = core.getInput('fail-on-quota') !== 'false'\n\n switch (command) {\n case 'trigger-judge': {\n const res = await api(endpoint, apiKey, projectId, '/v1/admin/judge/run', {\n method: 'POST',\n body: JSON.stringify({ limit: 50, projectId }),\n })\n handleResult(res, failOnQuota)\n break\n }\n case 'dispatch-fix': {\n const reportId = core.getInput('report-id', { required: true })\n const res = await api(endpoint, apiKey, projectId, '/v1/admin/fixes/dispatch', {\n method: 'POST',\n body: JSON.stringify({ reportId }),\n })\n handleResult(res, failOnQuota)\n break\n }\n case 'check-coverage': {\n const minCoverage = Number(core.getInput('min-coverage') || '0.8')\n const res = await api<{ total: number; classified: number }>(endpoint, apiKey, projectId, '/v1/admin/stats')\n if (!res.ok || !res.data) {\n core.setFailed(`stats query failed: ${res.error?.message ?? 'unknown'}`)\n return\n }\n const ratio = res.data.total === 0 ? 1 : res.data.classified / res.data.total\n core.setOutput('coverage', ratio.toFixed(3))\n core.setOutput('result', JSON.stringify(res.data))\n if (ratio < minCoverage) {\n core.setFailed(`classification coverage ${ratio.toFixed(3)} below threshold ${minCoverage}`)\n } else {\n core.info(`classification coverage ${ratio.toFixed(3)} >= ${minCoverage} ✓`)\n }\n break\n }\n case 'query': {\n const question = core.getInput('question', { required: true })\n const res = await api(endpoint, apiKey, projectId, '/v1/admin/query', {\n method: 'POST',\n body: JSON.stringify({ question }),\n })\n handleResult(res, failOnQuota)\n break\n }\n default:\n core.setFailed(`unknown command: ${command}. Expected trigger-judge | dispatch-fix | check-coverage | query.`)\n }\n}\n\nfunction handleResult(res: ApiResp<unknown>, failOnQuota: boolean): void {\n core.setOutput('result', JSON.stringify(res))\n if (!res.ok) {\n if (res.error?.code === 'QUOTA_EXCEEDED' && !failOnQuota) {\n core.warning(`quota exceeded, skipping: ${res.error?.message}`)\n return\n }\n core.setFailed(`${res.error?.code ?? 'ERROR'}: ${res.error?.message ?? 'unknown'}`)\n return\n }\n core.info(`Mushi ok: ${JSON.stringify(res.data).slice(0, 500)}`)\n}\n\nmain().catch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C,IAAI,IAAI;AACX,QAAI,IAAI,OAAO,SAAS,oBAAoB,CAAC,aAAa;AACxD,MAAK,aAAQ,6BAA6B,IAAI,OAAO,OAAO,EAAE;AAC9D;AAAA,IACF;AACA,IAAK,eAAU,GAAG,IAAI,OAAO,QAAQ,OAAO,KAAK,IAAI,OAAO,WAAW,SAAS,EAAE;AAClF;AAAA,EACF;AACA,EAAK,UAAK,aAAa,KAAK,UAAU,IAAI,IAAI,EAAE,MAAM,GAAG,GAAG,CAAC,EAAE;AACjE;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,EAAK,eAAW,IAAc,OAAO;AACvC,CAAC;","names":[]}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mushi-mushi/mcp-ci",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "GitHub Action entrypoint for running Mushi Mushi MCP tools in CI — trigger judge, dispatch fixes, gate merges on classification coverage.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"mushi-mcp-ci": "./dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "./dist/index.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"default": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"action.yml",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE"
|
|
24
|
+
],
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/kensaurus/mushi-mushi.git",
|
|
28
|
+
"directory": "packages/mcp-ci"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"mushi-mushi",
|
|
32
|
+
"mcp",
|
|
33
|
+
"github-action",
|
|
34
|
+
"ci",
|
|
35
|
+
"dispatch-fix"
|
|
36
|
+
],
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@actions/core": "^1.11.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^22.0.0",
|
|
45
|
+
"eslint": "^10.2.0",
|
|
46
|
+
"tsup": "^8.5.0",
|
|
47
|
+
"typescript": "^6.0.2",
|
|
48
|
+
"@mushi-mushi/eslint-config": "0.0.0",
|
|
49
|
+
"@mushi-mushi/tsconfig": "0.0.0"
|
|
50
|
+
},
|
|
51
|
+
"author": "Kenji Sakuramoto",
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsup",
|
|
54
|
+
"lint": "eslint src/",
|
|
55
|
+
"typecheck": "tsc --noEmit"
|
|
56
|
+
}
|
|
57
|
+
}
|