@mutmutco/cli 2.34.1 → 2.36.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/README.md +2 -1
- package/dist/index.cjs +17 -8
- package/dist/main.cjs +1942 -302
- package/dist/saga.cjs +27 -15
- package/package.json +1 -1
package/dist/saga.cjs
CHANGED
|
@@ -3456,7 +3456,9 @@ async function resolveTextArg(input, deps, labels) {
|
|
|
3456
3456
|
const source = input.file ?? "";
|
|
3457
3457
|
const text = source === "-" ? await deps.readStdin() : await deps.readFile(source, "utf8");
|
|
3458
3458
|
if (text.trim().length === 0) {
|
|
3459
|
-
throw new Error(
|
|
3459
|
+
throw new Error(
|
|
3460
|
+
source === "-" ? `${labels.file} - read empty stdin (nothing piped \u2014 pass a heredoc/pipe, or ${labels.file} <path>)` : `${labels.file} produced an empty ${labels.noun}`
|
|
3461
|
+
);
|
|
3460
3462
|
}
|
|
3461
3463
|
return text;
|
|
3462
3464
|
}
|
|
@@ -3886,6 +3888,7 @@ function buildNoteCapture(summary, o, id, evidence) {
|
|
|
3886
3888
|
next: o.next,
|
|
3887
3889
|
decision: o.decision,
|
|
3888
3890
|
queueOp,
|
|
3891
|
+
handoffClose: o.handoffClose,
|
|
3889
3892
|
state,
|
|
3890
3893
|
source,
|
|
3891
3894
|
evidence: Object.keys(ev).length ? ev : void 0,
|
|
@@ -4312,7 +4315,7 @@ function defaultHubUrl() {
|
|
|
4312
4315
|
|
|
4313
4316
|
// src/cli-shared.ts
|
|
4314
4317
|
var import_promises = require("node:fs/promises");
|
|
4315
|
-
var
|
|
4318
|
+
var import_node_fs7 = require("node:fs");
|
|
4316
4319
|
var import_node_crypto2 = require("node:crypto");
|
|
4317
4320
|
var import_node_child_process4 = require("node:child_process");
|
|
4318
4321
|
var import_node_util4 = require("node:util");
|
|
@@ -4355,13 +4358,22 @@ function hardExit(code) {
|
|
|
4355
4358
|
}
|
|
4356
4359
|
|
|
4357
4360
|
// src/stdin-inject.ts
|
|
4361
|
+
var import_node_fs6 = require("node:fs");
|
|
4358
4362
|
var injectedStdin;
|
|
4359
4363
|
function setInjectedStdin(payload) {
|
|
4360
4364
|
injectedStdin = payload;
|
|
4361
4365
|
}
|
|
4366
|
+
function stdinHasPipedInput(statFd = () => (0, import_node_fs6.fstatSync)(0)) {
|
|
4367
|
+
try {
|
|
4368
|
+
const stat = statFd();
|
|
4369
|
+
return stat.isFIFO() || stat.isFile();
|
|
4370
|
+
} catch {
|
|
4371
|
+
return false;
|
|
4372
|
+
}
|
|
4373
|
+
}
|
|
4362
4374
|
async function readStdin() {
|
|
4363
4375
|
if (injectedStdin !== void 0) return injectedStdin;
|
|
4364
|
-
if (
|
|
4376
|
+
if (!stdinHasPipedInput()) return "";
|
|
4365
4377
|
const chunks = [];
|
|
4366
4378
|
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
4367
4379
|
return Buffer.concat(chunks).toString("utf8");
|
|
@@ -4404,7 +4416,7 @@ function sessionDeps() {
|
|
|
4404
4416
|
env: process.env,
|
|
4405
4417
|
readPersisted: () => {
|
|
4406
4418
|
try {
|
|
4407
|
-
return (0,
|
|
4419
|
+
return (0, import_node_fs7.readFileSync)(SESSION_FILE, "utf8");
|
|
4408
4420
|
} catch {
|
|
4409
4421
|
return null;
|
|
4410
4422
|
}
|
|
@@ -4417,8 +4429,8 @@ function sessionDeps() {
|
|
|
4417
4429
|
var resolveSessionId = () => resolveSession(sessionDeps());
|
|
4418
4430
|
function persistSession(id) {
|
|
4419
4431
|
try {
|
|
4420
|
-
(0,
|
|
4421
|
-
(0,
|
|
4432
|
+
(0, import_node_fs7.mkdirSync)(".mmi", { recursive: true });
|
|
4433
|
+
(0, import_node_fs7.writeFileSync)(SESSION_FILE, id, "utf8");
|
|
4422
4434
|
} catch {
|
|
4423
4435
|
}
|
|
4424
4436
|
}
|
|
@@ -4821,16 +4833,16 @@ function runSagaCli(injectedStdin2) {
|
|
|
4821
4833
|
// src/daemon-server.ts
|
|
4822
4834
|
var import_node_net = require("node:net");
|
|
4823
4835
|
var import_node_crypto5 = require("node:crypto");
|
|
4824
|
-
var
|
|
4836
|
+
var import_node_fs10 = require("node:fs");
|
|
4825
4837
|
var import_node_os3 = require("node:os");
|
|
4826
4838
|
|
|
4827
4839
|
// src/daemon-client.ts
|
|
4828
|
-
var
|
|
4840
|
+
var import_node_fs9 = require("node:fs");
|
|
4829
4841
|
var import_node_path7 = require("node:path");
|
|
4830
4842
|
|
|
4831
4843
|
// src/daemon-protocol.ts
|
|
4832
4844
|
var import_node_crypto4 = require("node:crypto");
|
|
4833
|
-
var
|
|
4845
|
+
var import_node_fs8 = require("node:fs");
|
|
4834
4846
|
var import_node_os2 = require("node:os");
|
|
4835
4847
|
var import_node_path6 = require("node:path");
|
|
4836
4848
|
var DEFAULT_IDLE_EXIT_MS = 30 * 6e4;
|
|
@@ -4846,13 +4858,13 @@ function tokenPath(env = process.env) {
|
|
|
4846
4858
|
}
|
|
4847
4859
|
function ensureDaemonDir(env = process.env) {
|
|
4848
4860
|
const dir = daemonDir(env);
|
|
4849
|
-
(0,
|
|
4850
|
-
if (process.platform !== "win32") (0,
|
|
4861
|
+
(0, import_node_fs8.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
4862
|
+
if (process.platform !== "win32") (0, import_node_fs8.chmodSync)(dir, 448);
|
|
4851
4863
|
}
|
|
4852
4864
|
function writeDaemonToken(env = process.env, token = (0, import_node_crypto4.randomBytes)(32).toString("hex")) {
|
|
4853
4865
|
ensureDaemonDir(env);
|
|
4854
|
-
(0,
|
|
4855
|
-
if (process.platform !== "win32") (0,
|
|
4866
|
+
(0, import_node_fs8.writeFileSync)(tokenPath(env), token, { mode: 384 });
|
|
4867
|
+
if (process.platform !== "win32") (0, import_node_fs8.chmodSync)(tokenPath(env), 384);
|
|
4856
4868
|
return token;
|
|
4857
4869
|
}
|
|
4858
4870
|
function tokensEqual(a, b) {
|
|
@@ -4921,7 +4933,7 @@ var LineBuffer = class {
|
|
|
4921
4933
|
function clientStamp() {
|
|
4922
4934
|
let mtime = 0;
|
|
4923
4935
|
try {
|
|
4924
|
-
mtime = (0,
|
|
4936
|
+
mtime = (0, import_node_fs9.statSync)((0, import_node_path7.join)(__dirname, "index.cjs")).mtimeMs;
|
|
4925
4937
|
} catch {
|
|
4926
4938
|
}
|
|
4927
4939
|
return buildStamp(resolveClientVersion(), mtime);
|
|
@@ -5029,7 +5041,7 @@ function startDaemon(deps = {}) {
|
|
|
5029
5041
|
const cleanupSocketFile = () => {
|
|
5030
5042
|
if (process.platform !== "win32") {
|
|
5031
5043
|
try {
|
|
5032
|
-
(0,
|
|
5044
|
+
(0, import_node_fs10.unlinkSync)(path2);
|
|
5033
5045
|
} catch {
|
|
5034
5046
|
}
|
|
5035
5047
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mutmutco/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.36.0",
|
|
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",
|