@mushi-mushi/cli 0.30.6 → 0.31.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/dist/chunk-B5J64VJ4.js +8 -0
- package/dist/{chunk-YAF2NATT.js → chunk-JFMM7FGM.js} +1 -1
- package/dist/chunk-KSEZHXYC.js +10 -0
- package/dist/{chunk-BNO37ZO5.js → chunk-RQO3VNO7.js} +1 -1
- package/dist/{connect-D7FYRBAP.js → connect-DKPQB4UI.js} +2 -2
- package/dist/{connect-YKI7VZMP.js → connect-GDCWQXKH.js} +2 -2
- package/dist/index.js +82 -4
- package/dist/init.js +3 -3
- package/dist/{version-NJJQDMYO.js → version-XYJRQQMM.js} +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-D7ZVFRYW.js +0 -10
- package/dist/chunk-QR6NCHXT.js +0 -8
|
@@ -6,10 +6,10 @@ import {
|
|
|
6
6
|
saveConfig,
|
|
7
7
|
savedSdkKeyFor,
|
|
8
8
|
waitForIngestReady
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RQO3VNO7.js";
|
|
10
10
|
import {
|
|
11
11
|
MUSHI_MCP_PIN_SPEC
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-B5J64VJ4.js";
|
|
13
13
|
import {
|
|
14
14
|
detectFramework,
|
|
15
15
|
envVarsToWrite,
|
package/dist/index.js
CHANGED
|
@@ -54,11 +54,11 @@ import {
|
|
|
54
54
|
syncKeychainAfterKeyChange,
|
|
55
55
|
trySaveKeyToKeychain,
|
|
56
56
|
writeMcpServerEntry
|
|
57
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-JFMM7FGM.js";
|
|
58
58
|
import {
|
|
59
59
|
MUSHI_CLI_VERSION,
|
|
60
60
|
MUSHI_MCP_PIN_SPEC
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-KSEZHXYC.js";
|
|
62
62
|
import {
|
|
63
63
|
CLOUD_API_ENDPOINT,
|
|
64
64
|
CLOUD_MCP_OAUTH_URL,
|
|
@@ -1546,7 +1546,7 @@ async function checkOnboardingStatus(config, _consoleBase, cwd, doFetch = global
|
|
|
1546
1546
|
}
|
|
1547
1547
|
async function checkVersionDrift(cwd, doFetch) {
|
|
1548
1548
|
const checks = [];
|
|
1549
|
-
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-
|
|
1549
|
+
const { MUSHI_CLI_VERSION: MUSHI_CLI_VERSION2 } = await import("./version-XYJRQQMM.js");
|
|
1550
1550
|
if (MUSHI_CLI_VERSION2 === "0.0.0-dev") return checks;
|
|
1551
1551
|
const parse2 = (v) => {
|
|
1552
1552
|
const m = v.replace(/^[~^]/, "").match(/^(\d+)\.(\d+)\.(\d+)/);
|
|
@@ -2470,7 +2470,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
|
|
|
2470
2470
|
if (p.isCancel(answer) || !answer) return;
|
|
2471
2471
|
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
2472
2472
|
try {
|
|
2473
|
-
const { runConnect: runConnect2 } = await import("./connect-
|
|
2473
|
+
const { runConnect: runConnect2 } = await import("./connect-DKPQB4UI.js");
|
|
2474
2474
|
const saved = loadConfig();
|
|
2475
2475
|
const result = await runConnect2(
|
|
2476
2476
|
{
|
|
@@ -5322,6 +5322,31 @@ Approve: mushi tdd approve <id>`);
|
|
|
5322
5322
|
});
|
|
5323
5323
|
}
|
|
5324
5324
|
|
|
5325
|
+
// src/spend-down.ts
|
|
5326
|
+
function wholeNumber(raw, flag, min, max) {
|
|
5327
|
+
const n = Number(raw);
|
|
5328
|
+
if (!Number.isInteger(n) || n < min || n > max) throw new Error(`${flag} must be a whole number from ${min} to ${max}`);
|
|
5329
|
+
return n;
|
|
5330
|
+
}
|
|
5331
|
+
function spendDownBody(flags) {
|
|
5332
|
+
if (flags.on && flags.off) throw new Error("Pass --on or --off, not both");
|
|
5333
|
+
const body = {};
|
|
5334
|
+
if (flags.on) body.enabled = true;
|
|
5335
|
+
if (flags.off) body.enabled = false;
|
|
5336
|
+
if (flags.expires !== void 0) body.creditsExpireAt = flags.expires;
|
|
5337
|
+
if (flags.model !== void 0) body.model = flags.model === "" ? null : flags.model;
|
|
5338
|
+
if (flags.perDay !== void 0) body.dailyLimit = wholeNumber(flags.perDay, "--per-day", 1, 200);
|
|
5339
|
+
if (flags.windowDays !== void 0) body.windowDays = wholeNumber(flags.windowDays, "--window-days", 1, 90);
|
|
5340
|
+
return Object.keys(body).length > 0 ? body : null;
|
|
5341
|
+
}
|
|
5342
|
+
function spendDownStatusLine(k) {
|
|
5343
|
+
const name = `${k.label ?? "(no label)"} ${k.keyHint ?? ""}`.trim();
|
|
5344
|
+
const expires = k.creditsExpireAt ? k.creditsExpireAt.slice(0, 10) : "not set";
|
|
5345
|
+
const model = k.model ?? "app default";
|
|
5346
|
+
const apps = k.projects.length > 0 ? k.projects.map((p3) => p3.name).join(", ") : "none";
|
|
5347
|
+
return `${name} [${k.scope}] ${k.state} \xB7 ${k.dispatchedToday}/${k.dailyLimit} today \xB7 credits expire ${expires} \xB7 model ${model} \xB7 pays for ${apps} \u2014 ${k.id}`;
|
|
5348
|
+
}
|
|
5349
|
+
|
|
5325
5350
|
// src/commands/keys.ts
|
|
5326
5351
|
function registerKeysCommands(program2) {
|
|
5327
5352
|
const keys = program2.command("keys").description("Manage API key pool (BYOK)");
|
|
@@ -5501,6 +5526,59 @@ function registerKeysCommands(program2) {
|
|
|
5501
5526
|
);
|
|
5502
5527
|
console.log(` ${res.data.validation.detail}`);
|
|
5503
5528
|
});
|
|
5529
|
+
keys.command("spend-down [key-id]").description(
|
|
5530
|
+
"Spend down expiring Cursor credits on open bugs (ADR 0028): show status, or set it for one key"
|
|
5531
|
+
).option("--on", "Turn spend-down on (needs --expires once)").option("--off", "Turn spend-down off").option("--expires <date>", "When the credits expire, YYYY-MM-DD").option("--model <spec>", "Cursor model, e.g. 'grok-4.7?reasoning_effort=xhigh&context=500k' ('' = app default)").option("--per-day <n>", "Fixes per day across the apps this key pays for (1-200)").option("--window-days <n>", "Start this many days before the credits expire (1-90)").option("--json", "Output as JSON (alias for -o json)").action(async (keyId, opts) => {
|
|
5532
|
+
const config = loadConfig();
|
|
5533
|
+
if (!config.apiKey || !config.projectId) {
|
|
5534
|
+
console.error("Run `mushi login` first");
|
|
5535
|
+
process.exit(1);
|
|
5536
|
+
}
|
|
5537
|
+
let body;
|
|
5538
|
+
try {
|
|
5539
|
+
body = spendDownBody(opts);
|
|
5540
|
+
} catch (err) {
|
|
5541
|
+
console.error(`Error: ${err.message}`);
|
|
5542
|
+
process.exit(1);
|
|
5543
|
+
}
|
|
5544
|
+
if (keyId && body) {
|
|
5545
|
+
const res2 = await apiCall(
|
|
5546
|
+
`/v1/admin/byok/keys/${encodeURIComponent(keyId)}/spend-down`,
|
|
5547
|
+
config,
|
|
5548
|
+
{ method: "PATCH", body: JSON.stringify(body) }
|
|
5549
|
+
);
|
|
5550
|
+
if (!res2.ok) {
|
|
5551
|
+
console.error(`Error: ${res2.error.message}`);
|
|
5552
|
+
process.exit(1);
|
|
5553
|
+
}
|
|
5554
|
+
console.log(
|
|
5555
|
+
`\u2713 Spend-down ${res2.data.enabled ? "on" : "off"}${res2.data.creditsExpireAt ? `, credits expire ${res2.data.creditsExpireAt.slice(0, 10)}` : ""} \u2014 id: ${res2.data.id}`
|
|
5556
|
+
);
|
|
5557
|
+
return;
|
|
5558
|
+
}
|
|
5559
|
+
if (keyId && !body) {
|
|
5560
|
+
console.error("Nothing to change: pass --on, --off, --expires, --model, --per-day or --window-days");
|
|
5561
|
+
process.exit(1);
|
|
5562
|
+
}
|
|
5563
|
+
const res = await apiCall(
|
|
5564
|
+
`/v1/admin/byok/spend-down?project_id=${encodeURIComponent(config.projectId)}`,
|
|
5565
|
+
config
|
|
5566
|
+
);
|
|
5567
|
+
if (!res.ok) {
|
|
5568
|
+
console.error(`Error: ${res.error.message}`);
|
|
5569
|
+
process.exit(1);
|
|
5570
|
+
}
|
|
5571
|
+
printResult(res.data, {
|
|
5572
|
+
json: opts.json,
|
|
5573
|
+
render(d) {
|
|
5574
|
+
if (d.keys.length === 0) {
|
|
5575
|
+
console.log("No Cursor key for this project. Add one with `mushi keys add --provider cursor`.");
|
|
5576
|
+
return;
|
|
5577
|
+
}
|
|
5578
|
+
for (const k of d.keys) console.log(spendDownStatusLine(k));
|
|
5579
|
+
}
|
|
5580
|
+
});
|
|
5581
|
+
});
|
|
5504
5582
|
keys.command("remove <key-id>").description("Permanently remove one pooled key and its Vault secret").action(async (keyId) => {
|
|
5505
5583
|
const config = loadConfig();
|
|
5506
5584
|
if (!config.apiKey || !config.projectId) {
|
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-RQO3VNO7.js";
|
|
29
29
|
import {
|
|
30
30
|
MUSHI_CLI_VERSION
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-B5J64VJ4.js";
|
|
32
32
|
import {
|
|
33
33
|
FRAMEWORKS,
|
|
34
34
|
detectFramework,
|
|
@@ -2058,7 +2058,7 @@ async function maybeOfferConnect(credentials, options, _consoleBase) {
|
|
|
2058
2058
|
if (p.isCancel(answer) || !answer) return;
|
|
2059
2059
|
const endpoint = resolveCloudEndpoint(options.endpoint);
|
|
2060
2060
|
try {
|
|
2061
|
-
const { runConnect } = await import("./connect-
|
|
2061
|
+
const { runConnect } = await import("./connect-GDCWQXKH.js");
|
|
2062
2062
|
const saved = loadConfig();
|
|
2063
2063
|
const result = await runConnect(
|
|
2064
2064
|
{
|
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.
|
|
17
|
+
declare const MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.27.0";
|
|
18
18
|
|
|
19
19
|
export { MUSHI_CLI_VERSION, MUSHI_MCP_PIN_SPEC };
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
package/dist/chunk-D7ZVFRYW.js
DELETED