@mutmutco/cli 2.51.0 → 2.52.1
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/main.cjs +253 -192
- package/dist/saga.cjs +14 -7
- package/package.json +1 -1
package/dist/saga.cjs
CHANGED
|
@@ -4358,6 +4358,7 @@ function parseNorthStarSlugFromHead(headText) {
|
|
|
4358
4358
|
// src/cli-shared.ts
|
|
4359
4359
|
var import_promises = require("node:fs/promises");
|
|
4360
4360
|
var import_node_fs8 = require("node:fs");
|
|
4361
|
+
var import_node_path7 = require("node:path");
|
|
4361
4362
|
var import_node_crypto2 = require("node:crypto");
|
|
4362
4363
|
var import_node_child_process5 = require("node:child_process");
|
|
4363
4364
|
var import_node_util5 = require("node:util");
|
|
@@ -4469,16 +4470,20 @@ async function hubHeaders(extra = {}) {
|
|
|
4469
4470
|
const base = { ...clientVersionHeaders(), ...extra };
|
|
4470
4471
|
return t ? { ...base, Authorization: `Bearer ${t}` } : base;
|
|
4471
4472
|
}
|
|
4473
|
+
var CONFIG_FILE = ".mmi/config.json";
|
|
4472
4474
|
async function loadConfig() {
|
|
4473
4475
|
let file = {};
|
|
4474
4476
|
try {
|
|
4475
|
-
file = JSON.parse(await (0, import_promises.readFile)(
|
|
4477
|
+
file = JSON.parse(await (0, import_promises.readFile)(CONFIG_FILE, "utf8"));
|
|
4476
4478
|
} catch {
|
|
4477
4479
|
file = {};
|
|
4478
4480
|
}
|
|
4479
4481
|
if (!file.sagaApiUrl) file.sagaApiUrl = defaultHubUrl();
|
|
4480
4482
|
return file;
|
|
4481
4483
|
}
|
|
4484
|
+
function isOrgRepoRoot(cwd = process.cwd(), exists = import_node_fs8.existsSync) {
|
|
4485
|
+
return exists((0, import_node_path7.join)(cwd, CONFIG_FILE));
|
|
4486
|
+
}
|
|
4482
4487
|
var SESSION_FILE = ".mmi/.session";
|
|
4483
4488
|
var gitOut = async (args) => {
|
|
4484
4489
|
try {
|
|
@@ -4795,12 +4800,14 @@ function registerSagaCommands(program2) {
|
|
|
4795
4800
|
saga.command("flush").option("--json", "machine-readable {flushed, dropped, remaining}").option("--run", "detached worker: drain the queue silently (spawned by note/capture)").description("roll the local pending-note queue forward (re-POST queued saga writes); reports what landed").action((o) => runSagaFlush(o));
|
|
4796
4801
|
saga.command("show").option("--quiet", "no-op silently when unconfigured/unreachable (SessionStart hook)").option("--latest-anywhere", "resume the newest saga across all repos (default: current repo)").description("print your resume block \u2014 current repo HEAD + project memory (where you left off)").action((opts) => runSagaShow(opts));
|
|
4797
4802
|
saga.command("capture").option("--quiet", "capture silently (for the Stop hook)").description("per-turn deterministic capture (Stop hook): turn boundary + current sha + gated HEAD-update").action(async (opts) => {
|
|
4803
|
+
if (!isOrgRepoRoot()) return;
|
|
4798
4804
|
const hook = parseHookInput(await readStdin());
|
|
4799
4805
|
if (hook.session_id) persistSession(hook.session_id);
|
|
4800
4806
|
await postCapture({ event: "stop", id: (0, import_node_crypto3.randomUUID)(), source: "hook", sha: await gitOut(["rev-parse", "--short", "HEAD"]), surface: agentSurface() }, opts.quiet ?? false);
|
|
4801
4807
|
await maybeSpawnHeadUpdate();
|
|
4802
4808
|
});
|
|
4803
4809
|
saga.command("session").option("--quiet", "silent (for the SessionStart hook)").description("persist the harness session id for this repo (SessionStart hook)").action(async () => {
|
|
4810
|
+
if (!isOrgRepoRoot()) return;
|
|
4804
4811
|
const hook = parseHookInput(await readStdin());
|
|
4805
4812
|
if (hook.session_id) persistSession(hook.session_id);
|
|
4806
4813
|
});
|
|
@@ -4920,23 +4927,23 @@ var import_node_os4 = require("node:os");
|
|
|
4920
4927
|
|
|
4921
4928
|
// src/daemon-client.ts
|
|
4922
4929
|
var import_node_fs10 = require("node:fs");
|
|
4923
|
-
var
|
|
4930
|
+
var import_node_path9 = require("node:path");
|
|
4924
4931
|
|
|
4925
4932
|
// src/daemon-protocol.ts
|
|
4926
4933
|
var import_node_crypto4 = require("node:crypto");
|
|
4927
4934
|
var import_node_fs9 = require("node:fs");
|
|
4928
4935
|
var import_node_os3 = require("node:os");
|
|
4929
|
-
var
|
|
4936
|
+
var import_node_path8 = require("node:path");
|
|
4930
4937
|
var DEFAULT_IDLE_EXIT_MS = 30 * 6e4;
|
|
4931
4938
|
function idleExitMs(env = process.env) {
|
|
4932
4939
|
const n = Number(env.MMI_CLI_DAEMON_IDLE_MS);
|
|
4933
4940
|
return Number.isFinite(n) && n > 0 ? n : DEFAULT_IDLE_EXIT_MS;
|
|
4934
4941
|
}
|
|
4935
4942
|
function daemonDir(env = process.env) {
|
|
4936
|
-
return env.MMI_CLI_DAEMON_DIR || (0,
|
|
4943
|
+
return env.MMI_CLI_DAEMON_DIR || (0, import_node_path8.join)((0, import_node_os3.homedir)(), ".mmi");
|
|
4937
4944
|
}
|
|
4938
4945
|
function tokenPath(env = process.env) {
|
|
4939
|
-
return (0,
|
|
4946
|
+
return (0, import_node_path8.join)(daemonDir(env), "daemon-token");
|
|
4940
4947
|
}
|
|
4941
4948
|
function ensureDaemonDir(env = process.env) {
|
|
4942
4949
|
const dir = daemonDir(env);
|
|
@@ -4965,7 +4972,7 @@ function socketPath(env = process.env, platform2 = process.platform, user) {
|
|
|
4965
4972
|
}
|
|
4966
4973
|
}
|
|
4967
4974
|
const hash = (0, import_node_crypto4.createHash)("sha256").update(name).digest("hex").slice(0, 12);
|
|
4968
|
-
return platform2 === "win32" ? `\\\\.\\pipe\\mmi-cli-${hash}` : (0,
|
|
4975
|
+
return platform2 === "win32" ? `\\\\.\\pipe\\mmi-cli-${hash}` : (0, import_node_path8.join)(daemonDir(env), `mmi-cli-${hash}.sock`);
|
|
4969
4976
|
}
|
|
4970
4977
|
var HOT_VERBS = /* @__PURE__ */ new Set(["note", "probe", "capture", "session", "head-update"]);
|
|
4971
4978
|
function argvReadsStdin(args) {
|
|
@@ -5015,7 +5022,7 @@ var LineBuffer = class {
|
|
|
5015
5022
|
function clientStamp() {
|
|
5016
5023
|
let mtime = 0;
|
|
5017
5024
|
try {
|
|
5018
|
-
mtime = (0, import_node_fs10.statSync)((0,
|
|
5025
|
+
mtime = (0, import_node_fs10.statSync)((0, import_node_path9.join)(__dirname, "index.cjs")).mtimeMs;
|
|
5019
5026
|
} catch {
|
|
5020
5027
|
}
|
|
5021
5028
|
return buildStamp(resolveClientVersion(), mtime);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mutmutco/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.52.1",
|
|
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",
|