@mushi-mushi/cli 0.23.0 → 0.24.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 +26 -0
- package/dist/{chunk-GSQO35YD.js → chunk-BWASDQI6.js} +15 -1
- package/dist/{chunk-WLLFV26V.js → chunk-GUVGTFVK.js} +15 -1
- package/dist/chunk-X74T7JKC.js +6 -0
- package/dist/{connect-KX4UGY6Z.js → connect-7LTQRBEW.js} +2 -2
- package/dist/{connect-XFVSH4JZ.js → connect-KKN62YK2.js} +1 -1
- package/dist/index.js +492 -133
- package/dist/init.js +182 -60
- package/dist/version.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-BY5SZYRO.js +0 -6
package/README.md
CHANGED
|
@@ -86,6 +86,20 @@ Monorepo awareness: if you run the wizard at a workspace root with no framework
|
|
|
86
86
|
|
|
87
87
|
Console URL resolution: `MUSHI_CONSOLE_URL` → saved `consoleUrl` in config → localhost `:6464` probe → mushi-mushi monorepo heuristic → hosted default. Saved on successful `mushi login`.
|
|
88
88
|
|
|
89
|
+
### Browser sign-in reliability
|
|
90
|
+
|
|
91
|
+
Device auth (RFC 8628) uses a stable per-machine `client_id` stored in
|
|
92
|
+
`~/.config/mushi/config.json`. Starting a new login on the same machine supersedes
|
|
93
|
+
any older pending approval for that id.
|
|
94
|
+
|
|
95
|
+
During token polling the CLI retries **429** and **408** responses automatically.
|
|
96
|
+
If saved credentials exist, re-running the wizard validates them with
|
|
97
|
+
`GET /v1/sync/whoami` before reinstalling.
|
|
98
|
+
|
|
99
|
+
The browser approval page waits until the CLI actually claims the token (not
|
|
100
|
+
just when you click Approve). Full flow + troubleshooting:
|
|
101
|
+
[CLI ↔ console loop](https://kensaur.us/mushi-mushi/docs/quickstart/cli-console-loop).
|
|
102
|
+
|
|
89
103
|
## Install globally
|
|
90
104
|
|
|
91
105
|
```bash
|
|
@@ -212,6 +226,18 @@ the CLI never points users at a 404. This safety property is unit-pinned in
|
|
|
212
226
|
`packages/cli/src/migrate.test.ts` (positive control + negative control +
|
|
213
227
|
real-catalog regression guard).
|
|
214
228
|
|
|
229
|
+
### `mushi completion`
|
|
230
|
+
|
|
231
|
+
Prints a tab-completion script for bash, zsh, or fish, generated from the
|
|
232
|
+
CLI's live command tree — so it never drifts as commands are added.
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
eval "$(mushi completion bash)" # try it for the current session
|
|
236
|
+
mushi completion bash >> ~/.bashrc # bash: persist across sessions
|
|
237
|
+
mushi completion zsh > "${fpath[1]}/_mushi" # zsh: needs a dir already on $fpath
|
|
238
|
+
mushi completion fish > ~/.config/fish/completions/mushi.fish
|
|
239
|
+
```
|
|
240
|
+
|
|
215
241
|
### `mushi doctor`
|
|
216
242
|
|
|
217
243
|
Checks CLI and SDK health. **Ingest and dispatch (server) checks run by
|
|
@@ -10,6 +10,7 @@ import { appendFile, readFile as readFile2, writeFile as writeFile2 } from "fs/p
|
|
|
10
10
|
import { join as join4, resolve } from "path";
|
|
11
11
|
|
|
12
12
|
// src/config.ts
|
|
13
|
+
import { randomUUID } from "crypto";
|
|
13
14
|
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync } from "fs";
|
|
14
15
|
import { homedir } from "os";
|
|
15
16
|
import { dirname, join } from "path";
|
|
@@ -50,6 +51,18 @@ function loadConfig(path = CONFIG_PATH) {
|
|
|
50
51
|
};
|
|
51
52
|
return { ...file, ...fromEnv };
|
|
52
53
|
}
|
|
54
|
+
function ensureClientId(path = CONFIG_PATH) {
|
|
55
|
+
const existing = loadConfig(path);
|
|
56
|
+
if (existing.clientId && /^[A-Za-z0-9_-]{8,64}$/.test(existing.clientId)) {
|
|
57
|
+
return existing.clientId;
|
|
58
|
+
}
|
|
59
|
+
const clientId = `cli_${randomUUID().replace(/-/g, "")}`;
|
|
60
|
+
try {
|
|
61
|
+
saveConfig({ ...existing, clientId }, path);
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
return clientId;
|
|
65
|
+
}
|
|
53
66
|
function saveConfig(config, path = CONFIG_PATH) {
|
|
54
67
|
const dir = dirname(path);
|
|
55
68
|
if (!existsSync(dir)) {
|
|
@@ -103,7 +116,7 @@ function tightenDirPermissions(path) {
|
|
|
103
116
|
}
|
|
104
117
|
|
|
105
118
|
// src/version.ts
|
|
106
|
-
var MUSHI_CLI_VERSION = true ? "0.
|
|
119
|
+
var MUSHI_CLI_VERSION = true ? "0.24.0" : "0.0.0-dev";
|
|
107
120
|
|
|
108
121
|
// src/errors.ts
|
|
109
122
|
var EXIT_CODE_MAP = {
|
|
@@ -1214,6 +1227,7 @@ export {
|
|
|
1214
1227
|
installSignalHandlers,
|
|
1215
1228
|
MUSHI_CLI_VERSION,
|
|
1216
1229
|
loadConfig,
|
|
1230
|
+
ensureClientId,
|
|
1217
1231
|
saveConfig,
|
|
1218
1232
|
FRAMEWORKS,
|
|
1219
1233
|
readPackageJson,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MUSHI_CLI_VERSION
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-X74T7JKC.js";
|
|
4
4
|
|
|
5
5
|
// src/config.ts
|
|
6
|
+
import { randomUUID } from "crypto";
|
|
6
7
|
import { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, statSync, unlinkSync, writeFileSync } from "fs";
|
|
7
8
|
import { homedir } from "os";
|
|
8
9
|
import { dirname, join } from "path";
|
|
@@ -43,6 +44,18 @@ function loadConfig(path = CONFIG_PATH) {
|
|
|
43
44
|
};
|
|
44
45
|
return { ...file, ...fromEnv };
|
|
45
46
|
}
|
|
47
|
+
function ensureClientId(path = CONFIG_PATH) {
|
|
48
|
+
const existing = loadConfig(path);
|
|
49
|
+
if (existing.clientId && /^[A-Za-z0-9_-]{8,64}$/.test(existing.clientId)) {
|
|
50
|
+
return existing.clientId;
|
|
51
|
+
}
|
|
52
|
+
const clientId = `cli_${randomUUID().replace(/-/g, "")}`;
|
|
53
|
+
try {
|
|
54
|
+
saveConfig({ ...existing, clientId }, path);
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
return clientId;
|
|
58
|
+
}
|
|
46
59
|
function saveConfig(config, path = CONFIG_PATH) {
|
|
47
60
|
const dir = dirname(path);
|
|
48
61
|
if (!existsSync(dir)) {
|
|
@@ -405,6 +418,7 @@ async function apiCall(path, config, options = {}) {
|
|
|
405
418
|
export {
|
|
406
419
|
CONFIG_PATH,
|
|
407
420
|
loadConfig,
|
|
421
|
+
ensureClientId,
|
|
408
422
|
saveConfig,
|
|
409
423
|
consoleUrl,
|
|
410
424
|
resolveConsoleUrlSync,
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
normalizeEndpoint,
|
|
5
5
|
requireUuid,
|
|
6
6
|
saveConfig
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GUVGTFVK.js";
|
|
8
8
|
import {
|
|
9
9
|
detectFramework,
|
|
10
10
|
envVarsToWrite,
|
|
11
11
|
readPackageJson
|
|
12
12
|
} from "./chunk-AIZRI665.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-X74T7JKC.js";
|
|
14
14
|
|
|
15
15
|
// src/connect.ts
|
|
16
16
|
import { appendFile, readFile as readFile2, writeFile as writeFile2 } from "fs/promises";
|