@mushi-mushi/cli 0.35.1 → 0.35.3
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/dist/{chunk-R3S4SF4A.js → chunk-AWAWVAQN.js} +26 -8
- package/dist/{chunk-2RCG7AHP.js → chunk-JHCDXD3S.js} +2 -2
- package/dist/chunk-PCZRZE4Y.js +8 -0
- package/dist/chunk-QLR6ZPEQ.js +10 -0
- package/dist/{chunk-VI5A6EDG.js → chunk-WLX3HRNB.js} +1 -1
- package/dist/{chunk-FBCX3OBT.js → chunk-ZT67ZX2O.js} +1 -1
- package/dist/{connect-45YP7OGH.js → connect-5UJIK6E4.js} +2 -2
- package/dist/{connect-VTUZZHQB.js → connect-XQCE4JKF.js} +3 -3
- package/dist/{daemon-5XONC35D.js → daemon-LZWDEQ6D.js} +3 -3
- package/dist/index.js +20 -9
- package/dist/init.js +3 -3
- package/dist/{version-ABB4VJEJ.js → version-M4YSUKSX.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-Q4TOO3HX.js +0 -8
- package/dist/chunk-Z2AFR5AI.js +0 -10
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
requireConfig,
|
|
9
9
|
requireUuid,
|
|
10
10
|
tryLoadWorkerKey
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-WLX3HRNB.js";
|
|
12
12
|
import {
|
|
13
13
|
MUSHI_CLI_VERSION
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-QLR6ZPEQ.js";
|
|
15
15
|
|
|
16
16
|
// src/worker/daemon.ts
|
|
17
17
|
import { existsSync as existsSync6, readFileSync as readFileSync5 } from "fs";
|
|
@@ -608,9 +608,11 @@ function runProc(cmd, args, opts = {}) {
|
|
|
608
608
|
});
|
|
609
609
|
}
|
|
610
610
|
async function clearWorktree(repoDir, wt) {
|
|
611
|
-
if (
|
|
612
|
-
|
|
613
|
-
|
|
611
|
+
if (existsSync(wt)) {
|
|
612
|
+
await runProc("git", ["worktree", "remove", "--force", wt], { cwd: repoDir });
|
|
613
|
+
if (existsSync(wt)) rmSync(wt, { recursive: true, force: true });
|
|
614
|
+
}
|
|
615
|
+
await runProc("git", ["worktree", "unlock", wt], { cwd: repoDir });
|
|
614
616
|
await runProc("git", ["worktree", "prune"], { cwd: repoDir });
|
|
615
617
|
}
|
|
616
618
|
var GIT_TIMEOUT_MS = 10 * 6e4;
|
|
@@ -983,7 +985,7 @@ function registerWorkCommands(program) {
|
|
|
983
985
|
if (opts.repoDir || opts.report || opts.followups) {
|
|
984
986
|
throw new MushiCliError("E_INVALID_INPUT", "--daemon takes its lanes and clones from the worker config, not from --repo-dir, --report or --followups.", "mushi worker install");
|
|
985
987
|
}
|
|
986
|
-
const { runDaemon: runDaemon2 } = await import("./daemon-
|
|
988
|
+
const { runDaemon: runDaemon2 } = await import("./daemon-LZWDEQ6D.js");
|
|
987
989
|
await runDaemon2({ configPath: opts.workerConfig });
|
|
988
990
|
return;
|
|
989
991
|
}
|
|
@@ -2128,6 +2130,7 @@ var IDLE_MS = 15 * 6e4;
|
|
|
2128
2130
|
var BACKOFF_MS = 2 * 6e4;
|
|
2129
2131
|
var GH_CHECK_MS = 5 * 6e4;
|
|
2130
2132
|
var CURSOR_CHECK_MS = 20 * 6e4;
|
|
2133
|
+
var KEY_REFUSALS_TO_STOP = 3;
|
|
2131
2134
|
function createDaemon(cfg, deps) {
|
|
2132
2135
|
const lanes = cfg.lanes.map((local) => ({
|
|
2133
2136
|
local,
|
|
@@ -2167,6 +2170,8 @@ function createDaemon(cfg, deps) {
|
|
|
2167
2170
|
return r.data;
|
|
2168
2171
|
};
|
|
2169
2172
|
const refusedByKey = (r) => !r.ok && (r.httpStatus === 401 || r.httpStatus === 403 && /REVOKED|INVALID_API_KEY|WORKER_KEY_REQUIRED|INSUFFICIENT_SCOPE/.test(r.error.code));
|
|
2173
|
+
const revokedForSure = (r) => !r.ok && r.httpStatus === 403 && /REVOKED|WORKER_KEY_REQUIRED|INSUFFICIENT_SCOPE/.test(r.error.code);
|
|
2174
|
+
let keyRefusals = 0;
|
|
2170
2175
|
function stopAll(why) {
|
|
2171
2176
|
stopped = why;
|
|
2172
2177
|
for (const l of lanes) for (const ac of l.running.values()) ac.abort();
|
|
@@ -2409,7 +2414,12 @@ function createDaemon(cfg, deps) {
|
|
|
2409
2414
|
while (!stopped && lane.running.size < c.concurrency && agents() < g.max_agents && now >= lane.nextClaimAt) {
|
|
2410
2415
|
const r = await deps.call("/v1/worker/claim", { method: "POST", body: JSON.stringify({ laneId: lane.serverId }) });
|
|
2411
2416
|
if (refusedByKey(r)) {
|
|
2412
|
-
stopAll(`the server refused this worker's key (${r.error.code}); it was revoked or lost access`);
|
|
2417
|
+
if (revokedForSure(r)) stopAll(`the server refused this worker's key (${r.error.code}); it was revoked or lost access`);
|
|
2418
|
+
else {
|
|
2419
|
+
lane.nextClaimAt = now + BACKOFF_MS;
|
|
2420
|
+
lane.state = "backoff";
|
|
2421
|
+
say(lane, `claim refused (${r.error.code}); the next heartbeat checks the key again`);
|
|
2422
|
+
}
|
|
2413
2423
|
return;
|
|
2414
2424
|
}
|
|
2415
2425
|
if (!r.ok) {
|
|
@@ -2471,9 +2481,17 @@ function createDaemon(cfg, deps) {
|
|
|
2471
2481
|
if (stopped) return;
|
|
2472
2482
|
const hb = await deps.call("/v1/worker/heartbeat", { method: "POST", body: JSON.stringify(heartbeatBody()) });
|
|
2473
2483
|
if (refusedByKey(hb)) {
|
|
2474
|
-
|
|
2484
|
+
const code = hb.error.code;
|
|
2485
|
+
keyRefusals++;
|
|
2486
|
+
if (revokedForSure(hb) || keyRefusals >= KEY_REFUSALS_TO_STOP) {
|
|
2487
|
+
stopAll(`the server refused this worker's key (${code}) ${keyRefusals > 1 ? `${keyRefusals} times in a row` : ""}; it was revoked or lost access`.replace(/\s+;/, ";"));
|
|
2488
|
+
return;
|
|
2489
|
+
}
|
|
2490
|
+
hostState = "backoff";
|
|
2491
|
+
say(null, `the server refused this worker's key (${code}); checking again before stopping (${keyRefusals} of ${KEY_REFUSALS_TO_STOP})`);
|
|
2475
2492
|
return;
|
|
2476
2493
|
}
|
|
2494
|
+
if (hb.ok) keyRefusals = 0;
|
|
2477
2495
|
if (!hb.ok) {
|
|
2478
2496
|
hostState = "backoff";
|
|
2479
2497
|
say(null, `heartbeat failed: ${hb.error.code} ${hb.error.message}`);
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
requireUuid,
|
|
10
10
|
saveConfig,
|
|
11
11
|
savedSdkKeyFor
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WLX3HRNB.js";
|
|
13
13
|
import {
|
|
14
14
|
MUSHI_MCP_PIN_SPEC
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QLR6ZPEQ.js";
|
|
16
16
|
import {
|
|
17
17
|
assertEndpoint,
|
|
18
18
|
normalizeEndpoint
|
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
saveConfig,
|
|
7
7
|
savedSdkKeyFor,
|
|
8
8
|
waitForIngestReady
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ZT67ZX2O.js";
|
|
10
10
|
import {
|
|
11
11
|
MUSHI_MCP_PIN_SPEC
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-PCZRZE4Y.js";
|
|
13
13
|
import {
|
|
14
14
|
detectFramework,
|
|
15
15
|
envVarsToWrite,
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
resolveSdkEnvKey,
|
|
4
4
|
runConnect
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-JHCDXD3S.js";
|
|
6
6
|
import "./chunk-KOBEOGNF.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-WLX3HRNB.js";
|
|
8
|
+
import "./chunk-QLR6ZPEQ.js";
|
|
9
9
|
import "./chunk-LGGE3LH7.js";
|
|
10
10
|
export {
|
|
11
11
|
resolveSdkEnvKey,
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
readWorkerKey,
|
|
8
8
|
runDaemon,
|
|
9
9
|
workerHostId
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-AWAWVAQN.js";
|
|
11
|
+
import "./chunk-WLX3HRNB.js";
|
|
12
|
+
import "./chunk-QLR6ZPEQ.js";
|
|
13
13
|
import "./chunk-LGGE3LH7.js";
|
|
14
14
|
export {
|
|
15
15
|
assertWorkerKey,
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
sanitizeEndpoint,
|
|
23
23
|
sanitizeProjectId,
|
|
24
24
|
writeMcpServerEntry
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-JHCDXD3S.js";
|
|
26
26
|
import {
|
|
27
27
|
FRAMEWORKS,
|
|
28
28
|
detectFramework,
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
registerUxCommands,
|
|
50
50
|
registerWorkCommands,
|
|
51
51
|
validateWorkerConfig
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-AWAWVAQN.js";
|
|
53
53
|
import {
|
|
54
54
|
CONFIG_PATH,
|
|
55
55
|
MushiCliError,
|
|
@@ -87,11 +87,11 @@ import {
|
|
|
87
87
|
tryDeleteWorkerKey,
|
|
88
88
|
trySaveKeyToKeychain,
|
|
89
89
|
trySaveWorkerKey
|
|
90
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-WLX3HRNB.js";
|
|
91
91
|
import {
|
|
92
92
|
MUSHI_CLI_VERSION,
|
|
93
93
|
MUSHI_MCP_PIN_SPEC
|
|
94
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-QLR6ZPEQ.js";
|
|
95
95
|
import {
|
|
96
96
|
CLOUD_API_ENDPOINT,
|
|
97
97
|
CLOUD_MCP_OAUTH_URL,
|
|
@@ -1594,7 +1594,7 @@ async function checkOnboardingStatus(config, _consoleBase, cwd, doFetch = global
|
|
|
1594
1594
|
}
|
|
1595
1595
|
async function checkVersionDrift(cwd, doFetch) {
|
|
1596
1596
|
const checks = [];
|
|
1597
|
-
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-
|
|
1597
|
+
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-M4YSUKSX.js");
|
|
1598
1598
|
if (MUSHI_CLI_VERSION2 === "0.0.0-dev") return checks;
|
|
1599
1599
|
const parse2 = (v) => {
|
|
1600
1600
|
const m = v.replace(/^[~^]/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
@@ -2567,7 +2567,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
|
|
|
2567
2567
|
if (p.isCancel(answer) || !answer) return;
|
|
2568
2568
|
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
2569
2569
|
try {
|
|
2570
|
-
const { runConnect: runConnect2 } = await import("./connect-
|
|
2570
|
+
const { runConnect: runConnect2 } = await import("./connect-XQCE4JKF.js");
|
|
2571
2571
|
const saved = loadConfig();
|
|
2572
2572
|
const result = await runConnect2(
|
|
2573
2573
|
{
|
|
@@ -12816,12 +12816,23 @@ Uploaded ${p5.rows} day \xD7 repo \xD7 SKU rows for ${p5.month}. The console's C
|
|
|
12816
12816
|
});
|
|
12817
12817
|
const placement = runner.command("placement").description("Where each repo's CI runs, and changing it through one runner variable with approval (ADR 0037)");
|
|
12818
12818
|
const placementBody = (opts, config) => {
|
|
12819
|
-
if (!opts.remove && !opts.value) throw new MushiCliError("E_INVALID_INPUT", "Pass --value <runner label>, or --remove to delete the variable.");
|
|
12819
|
+
if (!opts.remove && !opts.value) throw new MushiCliError("E_INVALID_INPUT", "Pass --value <runner label | economy | thorough>, or --remove to delete the variable.");
|
|
12820
12820
|
if (opts.remove && opts.value) throw new MushiCliError("E_INVALID_INPUT", "Pass either --value or --remove, not both.");
|
|
12821
12821
|
if (!/^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/.test(opts.repo)) throw new MushiCliError("E_INVALID_INPUT", "--repo must be owner/repo.");
|
|
12822
12822
|
const raw = opts.projectId ?? opts.project ?? config.projectId;
|
|
12823
12823
|
if (!raw) throw new MushiCliError("E_INVALID_INPUT", "Pass --project-id (or configure a project).");
|
|
12824
|
-
|
|
12824
|
+
let revertAfterHours;
|
|
12825
|
+
if (opts.revertAfter !== void 0) {
|
|
12826
|
+
revertAfterHours = Number(opts.revertAfter);
|
|
12827
|
+
if (!Number.isInteger(revertAfterHours) || revertAfterHours < 1 || revertAfterHours > 168) throw new MushiCliError("E_INVALID_INPUT", "--revert-after is a whole number of hours from 1 to 168.");
|
|
12828
|
+
}
|
|
12829
|
+
return {
|
|
12830
|
+
projectId: requireUuid(raw, "project id"),
|
|
12831
|
+
repo: opts.repo,
|
|
12832
|
+
variable: opts.variable,
|
|
12833
|
+
value: opts.remove ? null : opts.value,
|
|
12834
|
+
...revertAfterHours !== void 0 ? { revertAfterHours } : {}
|
|
12835
|
+
};
|
|
12825
12836
|
};
|
|
12826
12837
|
placement.command("show").description("Each repo: the runner variables its workflows read and their values, the CI agreement, runner labels, pending requests").option("--project-id <id>", "Project ID (defaults to the configured project)").option("--project <id>", "Same as --project-id").option("--json", "Machine-readable JSON output").action(async (opts) => {
|
|
12827
12838
|
const config = requireConfig();
|
|
@@ -12854,7 +12865,7 @@ Uploaded ${p5.rows} day \xD7 repo \xD7 SKU rows for ${p5.month}. The console's C
|
|
|
12854
12865
|
console.log(`
|
|
12855
12866
|
Requested ${r.id} (${r.status}). ${r.next ?? "An owner or admin approves and runs it in the console."}`);
|
|
12856
12867
|
};
|
|
12857
|
-
const changeOptions = (cmd) => cmd.requiredOption("--repo <owner/repo>", "Repository connected to the project").option("--variable <name>", "LINUX_RUNNER
|
|
12868
|
+
const changeOptions = (cmd) => cmd.requiredOption("--repo <owner/repo>", "Repository connected to the project").option("--variable <name>", "LINUX_RUNNER, RUNNER_<WORKFLOW>, or CI_PROFILE (where a workflow reads it)", "LINUX_RUNNER").option("--value <label>", "The runner label jobs should ask for (CI_PROFILE: economy or thorough)").option("--revert-after <hours>", "A move to GitHub-hosted runners switches back after this many hours (1-168)").option("--remove", "Remove the variable (jobs use the workflow's fallback, usually GitHub-hosted)").option("--project-id <id>", "Project ID (defaults to the configured project)").option("--project <id>", "Same as --project-id").option("--json", "Machine-readable JSON output");
|
|
12858
12869
|
changeOptions(
|
|
12859
12870
|
placement.command("preview").description("Dry run: what would move, what stays and why, the target runners, cost, the CI agreement's verdict. Changes nothing")
|
|
12860
12871
|
).action(placementAction("preview"));
|
package/dist/init.js
CHANGED
|
@@ -25,10 +25,10 @@ import {
|
|
|
25
25
|
saveConfig,
|
|
26
26
|
savedSdkKeyFor,
|
|
27
27
|
trySaveKeyToKeychain
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-ZT67ZX2O.js";
|
|
29
29
|
import {
|
|
30
30
|
MUSHI_CLI_VERSION
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-PCZRZE4Y.js";
|
|
32
32
|
import {
|
|
33
33
|
FRAMEWORKS,
|
|
34
34
|
detectFramework,
|
|
@@ -2127,7 +2127,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
|
|
|
2127
2127
|
if (p.isCancel(answer) || !answer) return;
|
|
2128
2128
|
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
2129
2129
|
try {
|
|
2130
|
-
const { runConnect } = await import("./connect-
|
|
2130
|
+
const { runConnect } = await import("./connect-5UJIK6E4.js");
|
|
2131
2131
|
const saved = loadConfig();
|
|
2132
2132
|
const result = await runConnect(
|
|
2133
2133
|
{
|
package/dist/version.d.ts
CHANGED
|
@@ -14,6 +14,6 @@ declare const MUSHI_CLI_VERSION: string;
|
|
|
14
14
|
* setup refreshes the pin. Synced to packages/mcp/package.json by
|
|
15
15
|
* `scripts/sync-mcp-pin.mjs` — never hand-edit the version.
|
|
16
16
|
*/
|
|
17
|
-
declare const MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.30.
|
|
17
|
+
declare const MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.30.2";
|
|
18
18
|
|
|
19
19
|
export { MUSHI_CLI_VERSION, MUSHI_MCP_PIN_SPEC };
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
package/dist/chunk-Q4TOO3HX.js
DELETED