@mushi-mushi/cli 0.30.5 → 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.
@@ -0,0 +1,8 @@
1
+ // src/version.ts
2
+ var MUSHI_CLI_VERSION = true ? "0.31.0" : "0.0.0-dev";
3
+ var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.27.0";
4
+
5
+ export {
6
+ MUSHI_CLI_VERSION,
7
+ MUSHI_MCP_PIN_SPEC
8
+ };
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  MUSHI_CLI_VERSION,
4
4
  MUSHI_MCP_PIN_SPEC
5
- } from "./chunk-LKC2BEKQ.js";
5
+ } from "./chunk-KSEZHXYC.js";
6
6
  import {
7
7
  CLOUD_API_ENDPOINT,
8
8
  assertEndpoint,
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/version.ts
4
+ var MUSHI_CLI_VERSION = true ? "0.31.0" : "0.0.0-dev";
5
+ var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.27.0";
6
+
7
+ export {
8
+ MUSHI_CLI_VERSION,
9
+ MUSHI_MCP_PIN_SPEC
10
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MUSHI_CLI_VERSION
3
- } from "./chunk-AZZNO4T4.js";
3
+ } from "./chunk-B5J64VJ4.js";
4
4
  import {
5
5
  assertEndpoint,
6
6
  normalizeEndpoint
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  resolveSdkEnvKey,
4
4
  runConnect
5
- } from "./chunk-HVNXKTTL.js";
6
- import "./chunk-LKC2BEKQ.js";
5
+ } from "./chunk-JFMM7FGM.js";
6
+ import "./chunk-KSEZHXYC.js";
7
7
  import "./chunk-LGGE3LH7.js";
8
8
  import "./chunk-KOBEOGNF.js";
9
9
  export {
@@ -6,10 +6,10 @@ import {
6
6
  saveConfig,
7
7
  savedSdkKeyFor,
8
8
  waitForIngestReady
9
- } from "./chunk-EZJN53QO.js";
9
+ } from "./chunk-RQO3VNO7.js";
10
10
  import {
11
11
  MUSHI_MCP_PIN_SPEC
12
- } from "./chunk-AZZNO4T4.js";
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-HVNXKTTL.js";
57
+ } from "./chunk-JFMM7FGM.js";
58
58
  import {
59
59
  MUSHI_CLI_VERSION,
60
60
  MUSHI_MCP_PIN_SPEC
61
- } from "./chunk-LKC2BEKQ.js";
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-AAAJ5462.js");
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-36PCIH7N.js");
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-EZJN53QO.js";
28
+ } from "./chunk-RQO3VNO7.js";
29
29
  import {
30
30
  MUSHI_CLI_VERSION
31
- } from "./chunk-AZZNO4T4.js";
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-TY6YTXQD.js");
2061
+ const { runConnect } = await import("./connect-GDCWQXKH.js");
2062
2062
  const saved = loadConfig();
2063
2063
  const result = await runConnect(
2064
2064
  {
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  MUSHI_CLI_VERSION,
4
4
  MUSHI_MCP_PIN_SPEC
5
- } from "./chunk-LKC2BEKQ.js";
5
+ } from "./chunk-KSEZHXYC.js";
6
6
  export {
7
7
  MUSHI_CLI_VERSION,
8
8
  MUSHI_MCP_PIN_SPEC
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.26.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
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MUSHI_CLI_VERSION,
3
3
  MUSHI_MCP_PIN_SPEC
4
- } from "./chunk-AZZNO4T4.js";
4
+ } from "./chunk-B5J64VJ4.js";
5
5
  export {
6
6
  MUSHI_CLI_VERSION,
7
7
  MUSHI_MCP_PIN_SPEC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mushi-mushi/cli",
3
- "version": "0.30.5",
3
+ "version": "0.31.0",
4
4
  "license": "MIT",
5
5
  "description": "Mushi CLI: SDK setup, MCP wiring, bug triage. The bug mediator for AI-built apps: plain-English diagnosis + a ready fix, in your editor.",
6
6
  "bin": {
@@ -1,8 +0,0 @@
1
- // src/version.ts
2
- var MUSHI_CLI_VERSION = true ? "0.30.5" : "0.0.0-dev";
3
- var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.26.0";
4
-
5
- export {
6
- MUSHI_CLI_VERSION,
7
- MUSHI_MCP_PIN_SPEC
8
- };
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/version.ts
4
- var MUSHI_CLI_VERSION = true ? "0.30.5" : "0.0.0-dev";
5
- var MUSHI_MCP_PIN_SPEC = "@mushi-mushi/mcp@0.26.0";
6
-
7
- export {
8
- MUSHI_CLI_VERSION,
9
- MUSHI_MCP_PIN_SPEC
10
- };