@mushi-mushi/cli 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +23 -0
- package/dist/index.js +138 -0
- package/package.json +63 -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/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# @mushi-mushi/cli
|
|
2
|
+
|
|
3
|
+
CLI tool for Mushi Mushi project management and report triage.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @mushi-mushi/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
mushi login # Authenticate with your API key
|
|
15
|
+
mushi status # Project overview
|
|
16
|
+
mushi reports list # List recent reports
|
|
17
|
+
mushi reports show <id> # View report details
|
|
18
|
+
mushi reports triage <id> --priority high --assign @dev
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
MIT
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { Command } from "commander";
|
|
5
|
+
|
|
6
|
+
// src/config.ts
|
|
7
|
+
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
8
|
+
import { join } from "path";
|
|
9
|
+
import { homedir } from "os";
|
|
10
|
+
var CONFIG_PATH = join(homedir(), ".mushirc");
|
|
11
|
+
function loadConfig(path = CONFIG_PATH) {
|
|
12
|
+
if (!existsSync(path)) return {};
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(readFileSync(path, "utf-8"));
|
|
15
|
+
} catch {
|
|
16
|
+
return {};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function saveConfig(config, path = CONFIG_PATH) {
|
|
20
|
+
writeFileSync(path, JSON.stringify(config, null, 2));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/index.ts
|
|
24
|
+
async function apiCall(path, config, options = {}) {
|
|
25
|
+
const endpoint = config.endpoint ?? "https://api.mushimushi.dev";
|
|
26
|
+
const res = await fetch(`${endpoint}${path}`, {
|
|
27
|
+
...options,
|
|
28
|
+
headers: {
|
|
29
|
+
"Content-Type": "application/json",
|
|
30
|
+
"Authorization": `Bearer ${config.apiKey}`,
|
|
31
|
+
...options.headers
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return res.json();
|
|
35
|
+
}
|
|
36
|
+
var program = new Command().name("mushi").description("Mushi Mushi CLI \u2014 manage bug reports and pipeline").version("0.0.1");
|
|
37
|
+
program.command("login").description("Store API key for authentication").requiredOption("--api-key <key>", "API key").option("--endpoint <url>", "API endpoint URL").option("--project-id <id>", "Default project ID").action((opts) => {
|
|
38
|
+
const config = loadConfig();
|
|
39
|
+
config.apiKey = opts.apiKey;
|
|
40
|
+
if (opts.endpoint) config.endpoint = opts.endpoint;
|
|
41
|
+
if (opts.projectId) config.projectId = opts.projectId;
|
|
42
|
+
saveConfig(config);
|
|
43
|
+
console.log("Saved credentials to ~/.mushirc");
|
|
44
|
+
});
|
|
45
|
+
program.command("status").description("Show project stats").action(async () => {
|
|
46
|
+
const config = loadConfig();
|
|
47
|
+
if (!config.apiKey) {
|
|
48
|
+
console.error("Run `mushi login` first");
|
|
49
|
+
process.exit(1);
|
|
50
|
+
}
|
|
51
|
+
const data = await apiCall("/v1/admin/stats", config);
|
|
52
|
+
console.log(JSON.stringify(data, null, 2));
|
|
53
|
+
});
|
|
54
|
+
var reports = program.command("reports").description("Manage bug reports");
|
|
55
|
+
reports.command("list").description("List recent reports").option("--limit <n>", "Max results", "20").option("--status <status>", "Filter by status").option("--json", "JSON output").action(async (opts) => {
|
|
56
|
+
const config = loadConfig();
|
|
57
|
+
if (!config.apiKey) {
|
|
58
|
+
console.error("Run `mushi login` first");
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
const params = new URLSearchParams();
|
|
62
|
+
params.set("limit", opts.limit);
|
|
63
|
+
if (opts.status) params.set("status", opts.status);
|
|
64
|
+
const data = await apiCall(`/v1/admin/reports?${params}`, config);
|
|
65
|
+
if (opts.json) {
|
|
66
|
+
console.log(JSON.stringify(data, null, 2));
|
|
67
|
+
} else {
|
|
68
|
+
const reports2 = data.data?.reports ?? [];
|
|
69
|
+
for (const r of reports2) {
|
|
70
|
+
console.log(`${r.id} ${r.severity ?? "unset"} ${r.status ?? "new"} ${(r.summary ?? "").slice(0, 60)}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
reports.command("show <id>").description("Show report details").action(async (id) => {
|
|
75
|
+
const config = loadConfig();
|
|
76
|
+
if (!config.apiKey) {
|
|
77
|
+
console.error("Run `mushi login` first");
|
|
78
|
+
process.exit(1);
|
|
79
|
+
}
|
|
80
|
+
const data = await apiCall(`/v1/admin/reports/${id}`, config);
|
|
81
|
+
console.log(JSON.stringify(data, null, 2));
|
|
82
|
+
});
|
|
83
|
+
reports.command("triage <id>").description("Update report status/severity").option("--status <status>", "New status").option("--severity <severity>", "New severity").action(async (id, opts) => {
|
|
84
|
+
const config = loadConfig();
|
|
85
|
+
if (!config.apiKey) {
|
|
86
|
+
console.error("Run `mushi login` first");
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
const body = {};
|
|
90
|
+
if (opts.status) body.status = opts.status;
|
|
91
|
+
if (opts.severity) body.severity = opts.severity;
|
|
92
|
+
const data = await apiCall(`/v1/admin/reports/${id}`, config, { method: "PATCH", body: JSON.stringify(body) });
|
|
93
|
+
console.log(JSON.stringify(data, null, 2));
|
|
94
|
+
});
|
|
95
|
+
program.command("config").description("View or update CLI config").argument("[key]", "Config key to set").argument("[value]", "Value").action((key, value) => {
|
|
96
|
+
const config = loadConfig();
|
|
97
|
+
if (key && value) {
|
|
98
|
+
;
|
|
99
|
+
config[key] = value;
|
|
100
|
+
saveConfig(config);
|
|
101
|
+
console.log(`Set ${key} = ${value}`);
|
|
102
|
+
} else {
|
|
103
|
+
console.log(JSON.stringify(config, null, 2));
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
program.command("deploy").description("Check edge function health").command("check").action(async () => {
|
|
107
|
+
const config = loadConfig();
|
|
108
|
+
if (!config.apiKey) {
|
|
109
|
+
console.error("Run `mushi login` first");
|
|
110
|
+
process.exit(1);
|
|
111
|
+
}
|
|
112
|
+
const endpoint = config.endpoint ?? "https://api.mushimushi.dev";
|
|
113
|
+
try {
|
|
114
|
+
const res = await fetch(`${endpoint}/v1/health`);
|
|
115
|
+
console.log(`Health: ${res.status === 200 ? "OK" : "FAIL"} (${res.status})`);
|
|
116
|
+
} catch (err) {
|
|
117
|
+
console.error("Failed:", err);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
program.command("test").description("Submit a test report to verify pipeline").action(async () => {
|
|
121
|
+
const config = loadConfig();
|
|
122
|
+
if (!config.apiKey) {
|
|
123
|
+
console.error("Run `mushi login` first");
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
const data = await apiCall("/v1/reports", config, {
|
|
127
|
+
method: "POST",
|
|
128
|
+
headers: { "X-Mushi-Api-Key": config.apiKey ?? "" },
|
|
129
|
+
body: JSON.stringify({
|
|
130
|
+
projectId: config.projectId,
|
|
131
|
+
description: "CLI test report \u2014 verifying pipeline",
|
|
132
|
+
category: "other",
|
|
133
|
+
environment: { url: "cli://test", browser: "mushi-cli" }
|
|
134
|
+
})
|
|
135
|
+
});
|
|
136
|
+
console.log("Test report submitted:", JSON.stringify(data, null, 2));
|
|
137
|
+
});
|
|
138
|
+
program.parse();
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mushi-mushi/cli",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "CLI tool for Mushi Mushi — project management, report triage, pipeline health",
|
|
6
|
+
"bin": {
|
|
7
|
+
"mushi": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsup",
|
|
11
|
+
"lint": "eslint src/",
|
|
12
|
+
"test": "vitest run",
|
|
13
|
+
"typecheck": "tsc --noEmit"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"commander": "^13.1.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@mushi-mushi/eslint-config": "workspace:*",
|
|
20
|
+
"@types/node": "^22.15.3",
|
|
21
|
+
"eslint": "^9.39.4",
|
|
22
|
+
"tsup": "^8.5.1",
|
|
23
|
+
"typescript": "^5.9.3",
|
|
24
|
+
"vitest": "^3.2.1"
|
|
25
|
+
},
|
|
26
|
+
"author": "Kenji Sakuramoto",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/kensaurus/mushi-mushi.git",
|
|
30
|
+
"directory": "packages/cli"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://github.com/kensaurus/mushi-mushi/tree/main/packages/cli#readme",
|
|
33
|
+
"bugs": {
|
|
34
|
+
"url": "https://github.com/kensaurus/mushi-mushi/issues"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist",
|
|
41
|
+
"README.md",
|
|
42
|
+
"LICENSE"
|
|
43
|
+
],
|
|
44
|
+
"sideEffects": false,
|
|
45
|
+
"keywords": [
|
|
46
|
+
"mushi-mushi",
|
|
47
|
+
"bug-reporting",
|
|
48
|
+
"sdk"
|
|
49
|
+
],
|
|
50
|
+
"exports": {
|
|
51
|
+
".": {
|
|
52
|
+
"import": {
|
|
53
|
+
"types": "./dist/index.d.ts",
|
|
54
|
+
"default": "./dist/index.js"
|
|
55
|
+
},
|
|
56
|
+
"require": {
|
|
57
|
+
"types": "./dist/index.d.cts",
|
|
58
|
+
"default": "./dist/index.cjs"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"type": "module"
|
|
63
|
+
}
|