@mutmutco/cli 2.34.1 → 2.35.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 +1 -1
- package/dist/index.cjs +17 -8
- package/dist/main.cjs +1008 -173
- package/dist/saga.cjs +26 -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
|
}
|
|
@@ -4312,7 +4314,7 @@ function defaultHubUrl() {
|
|
|
4312
4314
|
|
|
4313
4315
|
// src/cli-shared.ts
|
|
4314
4316
|
var import_promises = require("node:fs/promises");
|
|
4315
|
-
var
|
|
4317
|
+
var import_node_fs7 = require("node:fs");
|
|
4316
4318
|
var import_node_crypto2 = require("node:crypto");
|
|
4317
4319
|
var import_node_child_process4 = require("node:child_process");
|
|
4318
4320
|
var import_node_util4 = require("node:util");
|
|
@@ -4355,13 +4357,22 @@ function hardExit(code) {
|
|
|
4355
4357
|
}
|
|
4356
4358
|
|
|
4357
4359
|
// src/stdin-inject.ts
|
|
4360
|
+
var import_node_fs6 = require("node:fs");
|
|
4358
4361
|
var injectedStdin;
|
|
4359
4362
|
function setInjectedStdin(payload) {
|
|
4360
4363
|
injectedStdin = payload;
|
|
4361
4364
|
}
|
|
4365
|
+
function stdinHasPipedInput(statFd = () => (0, import_node_fs6.fstatSync)(0)) {
|
|
4366
|
+
try {
|
|
4367
|
+
const stat = statFd();
|
|
4368
|
+
return stat.isFIFO() || stat.isFile();
|
|
4369
|
+
} catch {
|
|
4370
|
+
return false;
|
|
4371
|
+
}
|
|
4372
|
+
}
|
|
4362
4373
|
async function readStdin() {
|
|
4363
4374
|
if (injectedStdin !== void 0) return injectedStdin;
|
|
4364
|
-
if (
|
|
4375
|
+
if (!stdinHasPipedInput()) return "";
|
|
4365
4376
|
const chunks = [];
|
|
4366
4377
|
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
4367
4378
|
return Buffer.concat(chunks).toString("utf8");
|
|
@@ -4404,7 +4415,7 @@ function sessionDeps() {
|
|
|
4404
4415
|
env: process.env,
|
|
4405
4416
|
readPersisted: () => {
|
|
4406
4417
|
try {
|
|
4407
|
-
return (0,
|
|
4418
|
+
return (0, import_node_fs7.readFileSync)(SESSION_FILE, "utf8");
|
|
4408
4419
|
} catch {
|
|
4409
4420
|
return null;
|
|
4410
4421
|
}
|
|
@@ -4417,8 +4428,8 @@ function sessionDeps() {
|
|
|
4417
4428
|
var resolveSessionId = () => resolveSession(sessionDeps());
|
|
4418
4429
|
function persistSession(id) {
|
|
4419
4430
|
try {
|
|
4420
|
-
(0,
|
|
4421
|
-
(0,
|
|
4431
|
+
(0, import_node_fs7.mkdirSync)(".mmi", { recursive: true });
|
|
4432
|
+
(0, import_node_fs7.writeFileSync)(SESSION_FILE, id, "utf8");
|
|
4422
4433
|
} catch {
|
|
4423
4434
|
}
|
|
4424
4435
|
}
|
|
@@ -4821,16 +4832,16 @@ function runSagaCli(injectedStdin2) {
|
|
|
4821
4832
|
// src/daemon-server.ts
|
|
4822
4833
|
var import_node_net = require("node:net");
|
|
4823
4834
|
var import_node_crypto5 = require("node:crypto");
|
|
4824
|
-
var
|
|
4835
|
+
var import_node_fs10 = require("node:fs");
|
|
4825
4836
|
var import_node_os3 = require("node:os");
|
|
4826
4837
|
|
|
4827
4838
|
// src/daemon-client.ts
|
|
4828
|
-
var
|
|
4839
|
+
var import_node_fs9 = require("node:fs");
|
|
4829
4840
|
var import_node_path7 = require("node:path");
|
|
4830
4841
|
|
|
4831
4842
|
// src/daemon-protocol.ts
|
|
4832
4843
|
var import_node_crypto4 = require("node:crypto");
|
|
4833
|
-
var
|
|
4844
|
+
var import_node_fs8 = require("node:fs");
|
|
4834
4845
|
var import_node_os2 = require("node:os");
|
|
4835
4846
|
var import_node_path6 = require("node:path");
|
|
4836
4847
|
var DEFAULT_IDLE_EXIT_MS = 30 * 6e4;
|
|
@@ -4846,13 +4857,13 @@ function tokenPath(env = process.env) {
|
|
|
4846
4857
|
}
|
|
4847
4858
|
function ensureDaemonDir(env = process.env) {
|
|
4848
4859
|
const dir = daemonDir(env);
|
|
4849
|
-
(0,
|
|
4850
|
-
if (process.platform !== "win32") (0,
|
|
4860
|
+
(0, import_node_fs8.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
4861
|
+
if (process.platform !== "win32") (0, import_node_fs8.chmodSync)(dir, 448);
|
|
4851
4862
|
}
|
|
4852
4863
|
function writeDaemonToken(env = process.env, token = (0, import_node_crypto4.randomBytes)(32).toString("hex")) {
|
|
4853
4864
|
ensureDaemonDir(env);
|
|
4854
|
-
(0,
|
|
4855
|
-
if (process.platform !== "win32") (0,
|
|
4865
|
+
(0, import_node_fs8.writeFileSync)(tokenPath(env), token, { mode: 384 });
|
|
4866
|
+
if (process.platform !== "win32") (0, import_node_fs8.chmodSync)(tokenPath(env), 384);
|
|
4856
4867
|
return token;
|
|
4857
4868
|
}
|
|
4858
4869
|
function tokensEqual(a, b) {
|
|
@@ -4921,7 +4932,7 @@ var LineBuffer = class {
|
|
|
4921
4932
|
function clientStamp() {
|
|
4922
4933
|
let mtime = 0;
|
|
4923
4934
|
try {
|
|
4924
|
-
mtime = (0,
|
|
4935
|
+
mtime = (0, import_node_fs9.statSync)((0, import_node_path7.join)(__dirname, "index.cjs")).mtimeMs;
|
|
4925
4936
|
} catch {
|
|
4926
4937
|
}
|
|
4927
4938
|
return buildStamp(resolveClientVersion(), mtime);
|
|
@@ -5029,7 +5040,7 @@ function startDaemon(deps = {}) {
|
|
|
5029
5040
|
const cleanupSocketFile = () => {
|
|
5030
5041
|
if (process.platform !== "win32") {
|
|
5031
5042
|
try {
|
|
5032
|
-
(0,
|
|
5043
|
+
(0, import_node_fs10.unlinkSync)(path2);
|
|
5033
5044
|
} catch {
|
|
5034
5045
|
}
|
|
5035
5046
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mutmutco/cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.35.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",
|