@mutmutco/cli 2.48.0 → 2.48.2

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 (2) hide show
  1. package/dist/main.cjs +67 -1
  2. package/package.json +1 -1
package/dist/main.cjs CHANGED
@@ -32,6 +32,7 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  awsCallerArn: () => awsCallerArn,
34
34
  gcPlan: () => gcPlan,
35
+ isOrgRegisteredRepo: () => isOrgRegisteredRepo,
35
36
  registryClientDeps: () => registryClientDeps,
36
37
  repoSlug: () => repoSlug
37
38
  });
@@ -18195,6 +18196,29 @@ function buildOpencodeVersionCheck(input) {
18195
18196
  }
18196
18197
  return { ...base, ok: false, installedVersion: input.installedVersion, releasedVersion: input.releasedVersion };
18197
18198
  }
18199
+ var OPENCODE_DESKTOP_BOOTSTRAP_LABEL = "OpenCode Desktop stale project bootstrap";
18200
+ var OPENCODE_DESKTOP_BOOTSTRAP_FIX = "OpenCode Desktop is bootstrapping a deleted MMI worktree; open an existing checkout in OpenCode, remove/select away from the stale project entry, then restart OpenCode";
18201
+ function decodeLogUrlDirectory(value) {
18202
+ try {
18203
+ return decodeURIComponent(value.replace(/\+/g, " "));
18204
+ } catch {
18205
+ return value;
18206
+ }
18207
+ }
18208
+ function opencodeAgentDirectoriesFromLog(text) {
18209
+ const found = /* @__PURE__ */ new Set();
18210
+ const re = /opencode server GET\s+http:\/\/127\.0\.0\.1:\d+\/agent\?directory=([^\s]+)\s+→\s+503\s+Service Unavailable/g;
18211
+ for (const match of text.matchAll(re)) {
18212
+ if (match[1]) found.add(decodeLogUrlDirectory(match[1]));
18213
+ }
18214
+ return [...found];
18215
+ }
18216
+ function buildOpencodeDesktopBootstrapCheck(input) {
18217
+ const base = { ok: true, label: OPENCODE_DESKTOP_BOOTSTRAP_LABEL, fix: OPENCODE_DESKTOP_BOOTSTRAP_FIX };
18218
+ if (!input.isOrgRepo || input.surface !== "opencode" || input.issues.length === 0) return base;
18219
+ const dirs = input.issues.map((i) => i.directory).join(", ");
18220
+ return { ...base, ok: false, fix: `${OPENCODE_DESKTOP_BOOTSTRAP_FIX} (stale: ${dirs})`, issues: [...input.issues] };
18221
+ }
18198
18222
  var CURSOR_PLUGIN_INSTALL_LABEL = "Cursor Team Marketplace plugin install";
18199
18223
  var CURSOR_MARKETPLACE_INSTALL_GUIDE = "https://github.com/mutmutco/MMI-Hub/blob/development/docs/Guides/cursor-marketplace-install.md";
18200
18224
  var CURSOR_PLUGIN_JSON_REL = ".cursor-plugin/plugin.json";
@@ -18490,6 +18514,13 @@ async function repoSlug() {
18490
18514
  function registryClientDeps(cfg) {
18491
18515
  return { baseUrl: cfg.sagaApiUrl, token: () => hubAuthToken({ baseUrl: cfg.sagaApiUrl, githubToken }) };
18492
18516
  }
18517
+ async function isOrgRegisteredRepo(cfg, deps = {}) {
18518
+ const slug = await (deps.slug ?? repoSlug)();
18519
+ if (!slug || slug === "-") return false;
18520
+ const read = await (deps.read ?? fetchProjectBySlugChecked)(slug, registryClientDeps(cfg));
18521
+ if (!read.ok) return false;
18522
+ return read.project !== null;
18523
+ }
18493
18524
  async function ghPrs(limit) {
18494
18525
  const args = (state) => ["pr", "list", "--state", state, "--limit", String(limit), "--json", "number,headRefName,headRefOid,state"];
18495
18526
  const [open, closed] = await Promise.all([
@@ -18859,6 +18890,29 @@ function backupAndWriteInstalledPlugins(records, pluginId) {
18859
18890
  return false;
18860
18891
  }
18861
18892
  }
18893
+ function opencodeDesktopLogsRoot() {
18894
+ if (process.platform === "win32") {
18895
+ const base = process.env.APPDATA || (0, import_node_path22.join)((0, import_node_os5.homedir)(), "AppData", "Roaming");
18896
+ return (0, import_node_path22.join)(base, "ai.opencode.desktop", "logs");
18897
+ }
18898
+ if (process.platform === "darwin") {
18899
+ return (0, import_node_path22.join)((0, import_node_os5.homedir)(), "Library", "Application Support", "ai.opencode.desktop", "logs");
18900
+ }
18901
+ return (0, import_node_path22.join)((0, import_node_os5.homedir)(), ".config", "ai.opencode.desktop", "logs");
18902
+ }
18903
+ function opencodeDesktopBootstrapSnapshot() {
18904
+ const root = opencodeDesktopLogsRoot();
18905
+ try {
18906
+ const sessionDirs = (0, import_node_fs26.readdirSync)(root, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => (0, import_node_path22.join)(root, entry.name)).sort((a, b) => (0, import_node_fs26.statSync)(b).mtimeMs - (0, import_node_fs26.statSync)(a).mtimeMs);
18907
+ const newest = sessionDirs[0];
18908
+ if (!newest) return [];
18909
+ const logPath = (0, import_node_path22.join)(newest, "renderer.log");
18910
+ const text = (0, import_node_fs26.readFileSync)(logPath, "utf8");
18911
+ return opencodeAgentDirectoriesFromLog(text).filter((directory) => !(0, import_node_fs26.existsSync)(directory)).map((directory) => ({ directory, logPath }));
18912
+ } catch {
18913
+ return [];
18914
+ }
18915
+ }
18862
18916
  function cursorPluginCacheRoot() {
18863
18917
  return (0, import_node_path22.join)((0, import_node_os5.homedir)(), ".cursor", "plugins", "cache", "mutmutco", "mmi");
18864
18918
  }
@@ -19287,6 +19341,11 @@ async function runDoctor(opts, io = consoleIo) {
19287
19341
  installedVersion: process.env.MMI_OPENCODE_PLUGIN_VERSION,
19288
19342
  releasedVersion
19289
19343
  }));
19344
+ checks.push(buildOpencodeDesktopBootstrapCheck({
19345
+ isOrgRepo: Boolean(cfg.sagaApiUrl),
19346
+ surface,
19347
+ issues: opencodeDesktopBootstrapSnapshot()
19348
+ }));
19290
19349
  }
19291
19350
  let cacheCleanupCheck = buildMmiPluginCacheCleanupCheck({
19292
19351
  isOrgRepo: Boolean(cfg.sagaApiUrl),
@@ -19683,6 +19742,10 @@ async function runRulesSync(opts, io = consoleIo) {
19683
19742
  if (!opts.quiet) io.log('mmi-cli rules: source repo (orgRulesSource: "self") \u2014 skipping self-sync');
19684
19743
  return true;
19685
19744
  }
19745
+ if (!await isOrgRegisteredRepo(cfg)) {
19746
+ if (!opts.quiet) io.log("mmi-cli rules: not an org repo \u2014 skipping spine delivery");
19747
+ return true;
19748
+ }
19686
19749
  const base = resolveRulesBase(cfg.orgRulesSource, DEFAULT_RULES_SOURCE);
19687
19750
  const token = await githubToken();
19688
19751
  let changed = 0;
@@ -22410,7 +22473,9 @@ program2.command("session-start").description("run the SessionStart verbs (rules
22410
22473
  scheduleRefresh: () => spawnDetachedSelf(["board", "slice-refresh", "--quiet"], { spawn: import_node_child_process13.spawn, execPath: process.execPath, scriptPath: process.argv[1] })
22411
22474
  }),
22412
22475
  spineReconcile: async (io) => {
22413
- const isSource = isRulesSource((await loadConfig()).orgRulesSource);
22476
+ const cfg = await loadConfig();
22477
+ const isSource = isRulesSource(cfg.orgRulesSource);
22478
+ if (!isSource && !await isOrgRegisteredRepo(cfg)) return;
22414
22479
  const restored = await restoreDirtyOrgSpineToHead(
22415
22480
  { run: async (cmd, args) => (await execFileP2(cmd, args, { timeout: GIT_TIMEOUT_MS })).stdout },
22416
22481
  { isRulesSource: isSource }
@@ -22439,6 +22504,7 @@ program2.parseAsync().catch((e) => failGraceful(e.message));
22439
22504
  0 && (module.exports = {
22440
22505
  awsCallerArn,
22441
22506
  gcPlan,
22507
+ isOrgRegisteredRepo,
22442
22508
  registryClientDeps,
22443
22509
  repoSlug
22444
22510
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mutmutco/cli",
3
- "version": "2.48.0",
3
+ "version": "2.48.2",
4
4
  "description": "MMI Future CLI — delivers the org rules (whole-file), plus saga and KB access. The cross-IDE engine the plugin's SessionStart hook drives.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",