@mushi-mushi/cli 0.1.0 → 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.
Files changed (3) hide show
  1. package/README.md +2 -0
  2. package/dist/index.js +70 -4
  3. package/package.json +63 -63
package/README.md CHANGED
@@ -16,6 +16,8 @@ mushi status # Project overview
16
16
  mushi reports list # List recent reports
17
17
  mushi reports show <id> # View report details
18
18
  mushi reports triage <id> --priority high --assign @dev
19
+ mushi deploy check # Check edge function health
20
+ mushi test # Submit a test report to verify pipeline
19
21
  ```
20
22
 
21
23
  ## License
package/dist/index.js CHANGED
@@ -28,6 +28,8 @@ async function apiCall(path, config, options = {}) {
28
28
  headers: {
29
29
  "Content-Type": "application/json",
30
30
  "Authorization": `Bearer ${config.apiKey}`,
31
+ "X-Mushi-Api-Key": config.apiKey ?? "",
32
+ "X-Mushi-Project": config.projectId ?? "",
31
33
  ...options.headers
32
34
  }
33
35
  });
@@ -103,7 +105,8 @@ program.command("config").description("View or update CLI config").argument("[ke
103
105
  console.log(JSON.stringify(config, null, 2));
104
106
  }
105
107
  });
106
- program.command("deploy").description("Check edge function health").command("check").action(async () => {
108
+ var deploy = program.command("deploy").description("Deployment management");
109
+ deploy.command("check").description("Check edge function health").action(async () => {
107
110
  const config = loadConfig();
108
111
  if (!config.apiKey) {
109
112
  console.error("Run `mushi login` first");
@@ -111,12 +114,65 @@ program.command("deploy").description("Check edge function health").command("che
111
114
  }
112
115
  const endpoint = config.endpoint ?? "https://api.mushimushi.dev";
113
116
  try {
114
- const res = await fetch(`${endpoint}/v1/health`);
117
+ const res = await fetch(`${endpoint}/health`);
115
118
  console.log(`Health: ${res.status === 200 ? "OK" : "FAIL"} (${res.status})`);
116
119
  } catch (err) {
117
120
  console.error("Failed:", err);
118
121
  }
119
122
  });
123
+ program.command("index <path>").description("Walk a local repo and upload code chunks to the RAG indexer (non-GitHub fallback for V5.3 \xA72.3.4)").option("--language <lang>", "Limit to one language (ts, tsx, js, py, go, rs)").option("--dry-run", "Show what would be uploaded without sending").action(async (path, opts) => {
124
+ const config = loadConfig();
125
+ if (!config.apiKey) {
126
+ console.error("Run `mushi login` first");
127
+ process.exit(1);
128
+ }
129
+ if (!config.projectId) {
130
+ console.error("Set projectId via `mushi config projectId <id>`");
131
+ process.exit(1);
132
+ }
133
+ const { readdir, readFile, stat } = await import("fs/promises");
134
+ const nodePath = await import("path");
135
+ const SKIP = /node_modules|\.git|dist|build|\.next|\.turbo|coverage/;
136
+ const EXTS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".py", ".go", ".rs"]);
137
+ async function* walk(dir) {
138
+ const entries = await readdir(dir, { withFileTypes: true });
139
+ for (const e of entries) {
140
+ const full = nodePath.join(dir, e.name);
141
+ if (SKIP.test(full)) continue;
142
+ if (e.isDirectory()) yield* walk(full);
143
+ else if (EXTS.has(nodePath.extname(e.name))) yield full;
144
+ }
145
+ }
146
+ let count = 0;
147
+ let bytes = 0;
148
+ const root = nodePath.resolve(path);
149
+ for await (const file of walk(root)) {
150
+ const lang = nodePath.extname(file).slice(1);
151
+ if (opts.language && opts.language !== lang) continue;
152
+ const stats = await stat(file);
153
+ if (stats.size > 5e5) continue;
154
+ const source = await readFile(file, "utf8");
155
+ const relative = nodePath.relative(root, file).replaceAll("\\", "/");
156
+ count++;
157
+ bytes += source.length;
158
+ if (opts.dryRun) {
159
+ console.log(` ${relative} (${source.length} bytes)`);
160
+ continue;
161
+ }
162
+ const res = await apiCall("/v1/admin/codebase/upload", config, {
163
+ method: "POST",
164
+ body: JSON.stringify({
165
+ projectId: config.projectId,
166
+ filePath: relative,
167
+ source
168
+ })
169
+ });
170
+ if (!res.ok) console.error(` FAIL ${relative}: ${res.error ?? "unknown"}`);
171
+ else process.stdout.write(` ${relative} \u2192 ${res.chunks ?? 0} chunks
172
+ `);
173
+ }
174
+ console.log(`Indexed ${count} files (${(bytes / 1024).toFixed(1)} KB) into project ${config.projectId}`);
175
+ });
120
176
  program.command("test").description("Submit a test report to verify pipeline").action(async () => {
121
177
  const config = loadConfig();
122
178
  if (!config.apiKey) {
@@ -125,12 +181,22 @@ program.command("test").description("Submit a test report to verify pipeline").a
125
181
  }
126
182
  const data = await apiCall("/v1/reports", config, {
127
183
  method: "POST",
128
- headers: { "X-Mushi-Api-Key": config.apiKey ?? "" },
129
184
  body: JSON.stringify({
130
185
  projectId: config.projectId,
131
186
  description: "CLI test report \u2014 verifying pipeline",
132
187
  category: "other",
133
- environment: { url: "cli://test", browser: "mushi-cli" }
188
+ reporterToken: `cli-test-${Date.now()}`,
189
+ createdAt: (/* @__PURE__ */ new Date()).toISOString(),
190
+ environment: {
191
+ url: "cli://test",
192
+ userAgent: "mushi-cli",
193
+ platform: process.platform,
194
+ language: "en",
195
+ viewport: { width: 0, height: 0 },
196
+ referrer: "",
197
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
198
+ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone
199
+ }
134
200
  })
135
201
  });
136
202
  console.log("Test report submitted:", JSON.stringify(data, null, 2));
package/package.json CHANGED
@@ -1,63 +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
- }
1
+ {
2
+ "name": "@mushi-mushi/cli",
3
+ "version": "0.2.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
+ "dependencies": {
10
+ "commander": "^14.0.3"
11
+ },
12
+ "devDependencies": {
13
+ "@types/node": "^22.15.3",
14
+ "eslint": "^10.2.0",
15
+ "tsup": "^8.5.1",
16
+ "typescript": "^6.0.2",
17
+ "vitest": "^4.1.4",
18
+ "@mushi-mushi/eslint-config": "0.0.0"
19
+ },
20
+ "author": "Kenji Sakuramoto",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/kensaurus/mushi-mushi.git",
24
+ "directory": "packages/cli"
25
+ },
26
+ "homepage": "https://github.com/kensaurus/mushi-mushi/tree/main/packages/cli#readme",
27
+ "bugs": {
28
+ "url": "https://github.com/kensaurus/mushi-mushi/issues"
29
+ },
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "README.md",
36
+ "LICENSE"
37
+ ],
38
+ "sideEffects": false,
39
+ "keywords": [
40
+ "mushi-mushi",
41
+ "bug-reporting",
42
+ "sdk"
43
+ ],
44
+ "exports": {
45
+ ".": {
46
+ "import": {
47
+ "types": "./dist/index.d.ts",
48
+ "default": "./dist/index.js"
49
+ },
50
+ "require": {
51
+ "types": "./dist/index.d.cts",
52
+ "default": "./dist/index.cjs"
53
+ }
54
+ }
55
+ },
56
+ "type": "module",
57
+ "scripts": {
58
+ "build": "tsup",
59
+ "lint": "eslint src/",
60
+ "test": "vitest run",
61
+ "typecheck": "tsc --noEmit"
62
+ }
63
+ }