@mutmutco/cli 4.5.161 → 4.5.163
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 +1183 -956
- package/dist/runbook-sweep.cjs +106 -54
- package/package.json +1 -1
package/dist/runbook-sweep.cjs
CHANGED
|
@@ -191,6 +191,11 @@ var init_error_codes = __esm({
|
|
|
191
191
|
});
|
|
192
192
|
|
|
193
193
|
// src/gh-read-route.ts
|
|
194
|
+
function isAppFilingWrite(args) {
|
|
195
|
+
if (args.some((a) => VIEWER.test(a))) return false;
|
|
196
|
+
const [group, verb] = args;
|
|
197
|
+
return (group === "issue" || group === "label") && verb === "create";
|
|
198
|
+
}
|
|
194
199
|
function isViewerFreeGhRead(args) {
|
|
195
200
|
if (args.some((a) => VIEWER.test(a))) return false;
|
|
196
201
|
const [group, verb] = args;
|
|
@@ -238,6 +243,44 @@ var init_gh_read_route = __esm({
|
|
|
238
243
|
}
|
|
239
244
|
});
|
|
240
245
|
|
|
246
|
+
// src/gh-usage.ts
|
|
247
|
+
function commandPath() {
|
|
248
|
+
if (cachedCommand !== void 0) return cachedCommand;
|
|
249
|
+
const words = [];
|
|
250
|
+
for (const arg of process.argv.slice(2)) {
|
|
251
|
+
if (arg.startsWith("-") || words.length === 3) break;
|
|
252
|
+
words.push(arg);
|
|
253
|
+
}
|
|
254
|
+
return cachedCommand = words.join(" ") || "(none)";
|
|
255
|
+
}
|
|
256
|
+
function shapeOp(op) {
|
|
257
|
+
return op.split("?")[0].replace(/\b[0-9a-f]{7,40}\b/gi, "N").replace(/\d+/g, "N").split("/").slice(0, 5).join("/");
|
|
258
|
+
}
|
|
259
|
+
function ambientPool(env = process.env) {
|
|
260
|
+
return env.MMI_GH_POOL === "app" ? "app" : "personal";
|
|
261
|
+
}
|
|
262
|
+
function recordGhUsage(via, pool, op) {
|
|
263
|
+
if (process.env.MMI_GH_USAGE === "off" || process.env.VITEST && !process.env.MMI_GH_USAGE_DIR) return;
|
|
264
|
+
try {
|
|
265
|
+
const dir = usageDir();
|
|
266
|
+
(0, import_node_fs3.mkdirSync)(dir, { recursive: true });
|
|
267
|
+
const row = { t: Date.now(), cmd: commandPath(), via, pool, op: shapeOp(op) };
|
|
268
|
+
(0, import_node_fs3.appendFileSync)((0, import_node_path3.join)(dir, `${new Date(row.t).toISOString().slice(0, 13)}.jsonl`), `${JSON.stringify(row)}
|
|
269
|
+
`);
|
|
270
|
+
} catch {
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
var import_node_fs3, import_node_os, import_node_path3, usageDir, cachedCommand;
|
|
274
|
+
var init_gh_usage = __esm({
|
|
275
|
+
"src/gh-usage.ts"() {
|
|
276
|
+
"use strict";
|
|
277
|
+
import_node_fs3 = require("node:fs");
|
|
278
|
+
import_node_os = require("node:os");
|
|
279
|
+
import_node_path3 = require("node:path");
|
|
280
|
+
usageDir = (env = process.env) => env.MMI_GH_USAGE_DIR || (0, import_node_path3.join)((0, import_node_os.homedir)(), ".mmi", "gh-usage");
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
|
|
241
284
|
// src/github-quota.ts
|
|
242
285
|
var init_github_quota = __esm({
|
|
243
286
|
"src/github-quota.ts"() {
|
|
@@ -285,6 +328,12 @@ var init_stdin_inject = __esm({
|
|
|
285
328
|
});
|
|
286
329
|
|
|
287
330
|
// src/cli-shared.ts
|
|
331
|
+
async function ghFilingAppEnv(file, args) {
|
|
332
|
+
if (!ghWriteTokenProvider || !/(^|[\\/])gh(\.exe)?$/i.test(file) || process.env.MMI_ACTOR?.trim() === "personal") return void 0;
|
|
333
|
+
if (!isAppFilingWrite(args)) return void 0;
|
|
334
|
+
const token = await ghWriteTokenProvider().catch(() => void 0);
|
|
335
|
+
return token ? { ...process.env, GH_TOKEN: token } : void 0;
|
|
336
|
+
}
|
|
288
337
|
async function ghReadAppEnv(file, args) {
|
|
289
338
|
if (!ghReadTokenProvider || !/(^|[\\/])gh(\.exe)?$/i.test(file) || process.env.MMI_ACTOR?.trim() === "personal") return void 0;
|
|
290
339
|
if (!isViewerFreeGhRead(args)) return void 0;
|
|
@@ -325,7 +374,7 @@ function execFileHard(file, args, options) {
|
|
|
325
374
|
timer.unref?.();
|
|
326
375
|
});
|
|
327
376
|
}
|
|
328
|
-
var import_node_child_process3, import_node_util2, rawExecFileP, DEFAULT_EXEC_TIMEOUT_MS, execFileP, ghReadTokenProvider, ExecDeadlineError;
|
|
377
|
+
var import_node_child_process3, import_node_util2, rawExecFileP, DEFAULT_EXEC_TIMEOUT_MS, execFileP, ghReadTokenProvider, ghWriteTokenProvider, ExecDeadlineError;
|
|
329
378
|
var init_cli_shared = __esm({
|
|
330
379
|
"src/cli-shared.ts"() {
|
|
331
380
|
"use strict";
|
|
@@ -337,6 +386,7 @@ var init_cli_shared = __esm({
|
|
|
337
386
|
init_error_codes();
|
|
338
387
|
init_github_client();
|
|
339
388
|
init_gh_read_route();
|
|
389
|
+
init_gh_usage();
|
|
340
390
|
init_hub_auth();
|
|
341
391
|
init_house_map();
|
|
342
392
|
init_stdin_inject();
|
|
@@ -348,7 +398,12 @@ var init_cli_shared = __esm({
|
|
|
348
398
|
// promisify(execFile)'s overloads widen to string|Buffer when options is spread in.
|
|
349
399
|
rawExecFileP(file, args, { encoding: "utf8", windowsHide: true, timeout: DEFAULT_EXEC_TIMEOUT_MS, killSignal: "SIGTERM", ...options, ...env ? { env } : {} })
|
|
350
400
|
);
|
|
351
|
-
const appEnv = options.env ? void 0 : await ghReadAppEnv(file, args);
|
|
401
|
+
const appEnv = options.env ? void 0 : await ghReadAppEnv(file, args) ?? await ghFilingAppEnv(file, args);
|
|
402
|
+
if (/(^|[\\/])gh(\.exe)?$/i.test(file) && args[0] !== "auth") {
|
|
403
|
+
const callerEnv = options.env;
|
|
404
|
+
const pool = appEnv ? "app" : !callerEnv ? ambientPool() : !callerEnv.GH_TOKEN ? "personal" : callerEnv.MMI_GH_POOL === "app" ? "app" : callerEnv.GH_TOKEN === process.env.GH_TOKEN ? ambientPool() : "caller";
|
|
405
|
+
recordGhUsage("gh", pool, args.filter((a) => !a.startsWith("-")).slice(0, 2).join(" "));
|
|
406
|
+
}
|
|
352
407
|
if (!appEnv) return run();
|
|
353
408
|
try {
|
|
354
409
|
return await run(appEnv);
|
|
@@ -381,6 +436,8 @@ var init_github_client = __esm({
|
|
|
381
436
|
"src/github-client.ts"() {
|
|
382
437
|
"use strict";
|
|
383
438
|
init_cli_shared();
|
|
439
|
+
init_gh_read_route();
|
|
440
|
+
init_gh_usage();
|
|
384
441
|
}
|
|
385
442
|
});
|
|
386
443
|
|
|
@@ -775,7 +832,7 @@ function checkRunbookCoverage(docs, base, git) {
|
|
|
775
832
|
const globs = lines.slice(heading.start, markerEnd - 1).flatMap((text) => /<!--\s*runbook-covers:\s*(.*?)\s*-->/.exec(text)?.[1].split(",").map((s) => s.trim()) ?? []);
|
|
776
833
|
const affected = changed.filter((path2) => globs.some((glob) => matches(glob, path2)));
|
|
777
834
|
if (affected.length && !ranges.some((r) => r.count > 0 && r.start < end && r.start + r.count > heading.start)) {
|
|
778
|
-
findings.push({ kind: "runbook-section-stale", doc, line: heading.start, detail: `${heading.title}: changed ${affected.join(", ")}; update this section or declare Runbook-Unaffected: <reason
|
|
835
|
+
findings.push({ kind: "runbook-section-stale", doc, line: heading.start, detail: `${heading.title}: changed ${affected.join(", ")}; update this section or declare Runbook-Unaffected: <reason>`, section: { heading: heading.title, level: heading.level, startLine: heading.start, endLine: end - 1, covers: globs }, sources: affected });
|
|
779
836
|
}
|
|
780
837
|
}
|
|
781
838
|
}
|
|
@@ -1143,23 +1200,23 @@ init_github_quota();
|
|
|
1143
1200
|
init_cli_shared();
|
|
1144
1201
|
|
|
1145
1202
|
// src/repo-runtime-state.ts
|
|
1146
|
-
var
|
|
1147
|
-
var
|
|
1203
|
+
var import_node_fs4 = require("node:fs");
|
|
1204
|
+
var import_node_path4 = require("node:path");
|
|
1148
1205
|
function resolveGitDir(cwd) {
|
|
1149
|
-
const dotGit = (0,
|
|
1206
|
+
const dotGit = (0, import_node_path4.join)(cwd, ".git");
|
|
1150
1207
|
try {
|
|
1151
|
-
const st = (0,
|
|
1208
|
+
const st = (0, import_node_fs4.statSync)(dotGit);
|
|
1152
1209
|
if (st.isDirectory()) return dotGit;
|
|
1153
1210
|
if (!st.isFile()) return void 0;
|
|
1154
1211
|
} catch {
|
|
1155
1212
|
return void 0;
|
|
1156
1213
|
}
|
|
1157
1214
|
try {
|
|
1158
|
-
const raw = (0,
|
|
1215
|
+
const raw = (0, import_node_fs4.readFileSync)(dotGit, "utf8").trim();
|
|
1159
1216
|
const match = /^gitdir:\s*(.+)$/i.exec(raw);
|
|
1160
1217
|
if (!match) return void 0;
|
|
1161
1218
|
const gitdir = match[1].trim();
|
|
1162
|
-
return (0,
|
|
1219
|
+
return (0, import_node_path4.isAbsolute)(gitdir) ? gitdir : (0, import_node_path4.resolve)(cwd, gitdir);
|
|
1163
1220
|
} catch {
|
|
1164
1221
|
return void 0;
|
|
1165
1222
|
}
|
|
@@ -1387,8 +1444,8 @@ function humanReadableArgName(arg) {
|
|
|
1387
1444
|
// node_modules/commander/lib/command.js
|
|
1388
1445
|
var import_node_events = require("node:events");
|
|
1389
1446
|
var import_node_child_process4 = __toESM(require("node:child_process"), 1);
|
|
1390
|
-
var
|
|
1391
|
-
var
|
|
1447
|
+
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
1448
|
+
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
1392
1449
|
var import_node_process = __toESM(require("node:process"), 1);
|
|
1393
1450
|
var import_node_util4 = require("node:util");
|
|
1394
1451
|
|
|
@@ -3356,7 +3413,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3356
3413
|
* @param {string} subcommandName
|
|
3357
3414
|
*/
|
|
3358
3415
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
3359
|
-
if (
|
|
3416
|
+
if (import_node_fs5.default.existsSync(executableFile)) return;
|
|
3360
3417
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
3361
3418
|
const executableMissing = `'${executableFile}' does not exist
|
|
3362
3419
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
@@ -3373,11 +3430,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3373
3430
|
args = args.slice();
|
|
3374
3431
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
3375
3432
|
function findFile(baseDir, baseName) {
|
|
3376
|
-
const localBin =
|
|
3377
|
-
if (
|
|
3378
|
-
if (sourceExt.includes(
|
|
3433
|
+
const localBin = import_node_path5.default.resolve(baseDir, baseName);
|
|
3434
|
+
if (import_node_fs5.default.existsSync(localBin)) return localBin;
|
|
3435
|
+
if (sourceExt.includes(import_node_path5.default.extname(baseName))) return void 0;
|
|
3379
3436
|
const foundExt = sourceExt.find(
|
|
3380
|
-
(ext) =>
|
|
3437
|
+
(ext) => import_node_fs5.default.existsSync(`${localBin}${ext}`)
|
|
3381
3438
|
);
|
|
3382
3439
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
3383
3440
|
return void 0;
|
|
@@ -3389,21 +3446,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3389
3446
|
if (this._scriptPath) {
|
|
3390
3447
|
let resolvedScriptPath;
|
|
3391
3448
|
try {
|
|
3392
|
-
resolvedScriptPath =
|
|
3449
|
+
resolvedScriptPath = import_node_fs5.default.realpathSync(this._scriptPath);
|
|
3393
3450
|
} catch {
|
|
3394
3451
|
resolvedScriptPath = this._scriptPath;
|
|
3395
3452
|
}
|
|
3396
|
-
executableDir =
|
|
3397
|
-
|
|
3453
|
+
executableDir = import_node_path5.default.resolve(
|
|
3454
|
+
import_node_path5.default.dirname(resolvedScriptPath),
|
|
3398
3455
|
executableDir
|
|
3399
3456
|
);
|
|
3400
3457
|
}
|
|
3401
3458
|
if (executableDir) {
|
|
3402
3459
|
let localFile = findFile(executableDir, executableFile);
|
|
3403
3460
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
3404
|
-
const legacyName =
|
|
3461
|
+
const legacyName = import_node_path5.default.basename(
|
|
3405
3462
|
this._scriptPath,
|
|
3406
|
-
|
|
3463
|
+
import_node_path5.default.extname(this._scriptPath)
|
|
3407
3464
|
);
|
|
3408
3465
|
if (legacyName !== this._name) {
|
|
3409
3466
|
localFile = findFile(
|
|
@@ -3414,7 +3471,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3414
3471
|
}
|
|
3415
3472
|
executableFile = localFile || executableFile;
|
|
3416
3473
|
}
|
|
3417
|
-
const launchWithNode = sourceExt.includes(
|
|
3474
|
+
const launchWithNode = sourceExt.includes(import_node_path5.default.extname(executableFile));
|
|
3418
3475
|
let proc;
|
|
3419
3476
|
if (import_node_process.default.platform !== "win32") {
|
|
3420
3477
|
if (launchWithNode) {
|
|
@@ -4331,7 +4388,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4331
4388
|
* @return {Command}
|
|
4332
4389
|
*/
|
|
4333
4390
|
nameFromFilename(filename) {
|
|
4334
|
-
this._name =
|
|
4391
|
+
this._name = import_node_path5.default.basename(filename, import_node_path5.default.extname(filename));
|
|
4335
4392
|
return this;
|
|
4336
4393
|
}
|
|
4337
4394
|
/**
|
|
@@ -4847,13 +4904,13 @@ async function discoverShaWorkflowRuns(deps, repo, headSha, seenRunIds) {
|
|
|
4847
4904
|
|
|
4848
4905
|
// src/train-doctor.ts
|
|
4849
4906
|
var import_node_child_process7 = require("node:child_process");
|
|
4850
|
-
var
|
|
4851
|
-
var
|
|
4907
|
+
var import_node_fs8 = require("node:fs");
|
|
4908
|
+
var import_node_os2 = require("node:os");
|
|
4852
4909
|
var import_node_path9 = require("node:path");
|
|
4853
4910
|
|
|
4854
4911
|
// src/doctor-io.ts
|
|
4855
|
-
var
|
|
4856
|
-
var
|
|
4912
|
+
var import_node_fs6 = require("node:fs");
|
|
4913
|
+
var import_node_path6 = require("node:path");
|
|
4857
4914
|
var import_node_child_process5 = require("node:child_process");
|
|
4858
4915
|
var import_node_util5 = require("node:util");
|
|
4859
4916
|
|
|
@@ -4892,8 +4949,8 @@ function nodeDiscardSinkPath(platform = process.platform) {
|
|
|
4892
4949
|
var execFileP2 = (0, import_node_util5.promisify)(import_node_child_process5.execFile);
|
|
4893
4950
|
function execFileCapture(file, args, opts = {}) {
|
|
4894
4951
|
const sink = nodeDiscardSinkPath();
|
|
4895
|
-
const inFd = (0,
|
|
4896
|
-
const errFd = (0,
|
|
4952
|
+
const inFd = (0, import_node_fs6.openSync)(sink, "r");
|
|
4953
|
+
const errFd = (0, import_node_fs6.openSync)(sink, "w");
|
|
4897
4954
|
try {
|
|
4898
4955
|
return (0, import_node_child_process5.execFileSync)(file, args, {
|
|
4899
4956
|
...opts,
|
|
@@ -4901,8 +4958,8 @@ function execFileCapture(file, args, opts = {}) {
|
|
|
4901
4958
|
stdio: [inFd, "pipe", errFd]
|
|
4902
4959
|
});
|
|
4903
4960
|
} finally {
|
|
4904
|
-
(0,
|
|
4905
|
-
(0,
|
|
4961
|
+
(0, import_node_fs6.closeSync)(inFd);
|
|
4962
|
+
(0, import_node_fs6.closeSync)(errFd);
|
|
4906
4963
|
}
|
|
4907
4964
|
}
|
|
4908
4965
|
function worktreeRootSync() {
|
|
@@ -4917,13 +4974,13 @@ function worktreeRootSync() {
|
|
|
4917
4974
|
}
|
|
4918
4975
|
var gitignorePath = () => {
|
|
4919
4976
|
const root = worktreeRootSync();
|
|
4920
|
-
return root === null ? null : (0,
|
|
4977
|
+
return root === null ? null : (0, import_node_path6.join)(root, ".gitignore");
|
|
4921
4978
|
};
|
|
4922
4979
|
function readGitignore() {
|
|
4923
4980
|
const path2 = gitignorePath();
|
|
4924
4981
|
if (path2 === null) return null;
|
|
4925
4982
|
try {
|
|
4926
|
-
return (0,
|
|
4983
|
+
return (0, import_node_fs6.readFileSync)(path2, "utf8");
|
|
4927
4984
|
} catch {
|
|
4928
4985
|
return null;
|
|
4929
4986
|
}
|
|
@@ -4932,7 +4989,7 @@ function writeGitignore(content) {
|
|
|
4932
4989
|
const path2 = gitignorePath();
|
|
4933
4990
|
if (path2 === null) return false;
|
|
4934
4991
|
try {
|
|
4935
|
-
(0,
|
|
4992
|
+
(0, import_node_fs6.writeFileSync)(path2, content, "utf8");
|
|
4936
4993
|
return true;
|
|
4937
4994
|
} catch {
|
|
4938
4995
|
return false;
|
|
@@ -4942,17 +4999,12 @@ function writeGitignore(content) {
|
|
|
4942
4999
|
// src/doctor-fleet-drift.ts
|
|
4943
5000
|
var JOURNAL_TAIL_BYTES = 256 * 1024;
|
|
4944
5001
|
|
|
4945
|
-
// src/jerv-cli-spawn.ts
|
|
4946
|
-
var import_node_path6 = require("node:path");
|
|
4947
|
-
init_cli_shared();
|
|
4948
|
-
var JERV_CLI_ENTRY = (0, import_node_path6.join)("node_modules", "@jervaise", "jerv-cli", "dist", "index.cjs");
|
|
4949
|
-
|
|
4950
5002
|
// src/claude-binary-doctor.ts
|
|
4951
5003
|
var PACKAGE = "@anthropic-ai/claude-code";
|
|
4952
5004
|
var CLAUDE_BINARY_INSTALL_COMMAND = `npm install -g ${PACKAGE}`;
|
|
4953
5005
|
|
|
4954
5006
|
// src/release-ledger.ts
|
|
4955
|
-
var
|
|
5007
|
+
var import_node_fs7 = require("node:fs");
|
|
4956
5008
|
var import_node_path8 = require("node:path");
|
|
4957
5009
|
var import_node_crypto = require("node:crypto");
|
|
4958
5010
|
|
|
@@ -5228,7 +5280,7 @@ function resolvePrimaryGitDir(cwd) {
|
|
|
5228
5280
|
}
|
|
5229
5281
|
let common;
|
|
5230
5282
|
try {
|
|
5231
|
-
common = (0,
|
|
5283
|
+
common = (0, import_node_fs7.readFileSync)((0, import_node_path8.join)(gitDir, "commondir"), "utf8").trim();
|
|
5232
5284
|
} catch (e) {
|
|
5233
5285
|
if (e.code !== "ENOENT") {
|
|
5234
5286
|
throw new ReleaseLedgerError("unreadable", `release ledger: the worktree gitdir's commondir pointer could not be READ (${e instanceof Error ? e.message : String(e)}) \u2014 a failed read is unverified, not primary (#5987/#4713)`);
|
|
@@ -5237,7 +5289,7 @@ function resolvePrimaryGitDir(cwd) {
|
|
|
5237
5289
|
if (!common) return gitDir;
|
|
5238
5290
|
const commonDir = (0, import_node_path8.isAbsolute)(common) ? common : (0, import_node_path8.resolve)(gitDir, common);
|
|
5239
5291
|
try {
|
|
5240
|
-
(0,
|
|
5292
|
+
(0, import_node_fs7.readFileSync)((0, import_node_path8.join)(commonDir, "HEAD"), "utf8");
|
|
5241
5293
|
} catch (e) {
|
|
5242
5294
|
throw new ReleaseLedgerError("no-checkout", `release ledger: the worktree's commondir pointer names ${commonDir}, which has no readable HEAD (${e instanceof Error ? e.message : String(e)}) \u2014 the primary checkout may have been removed; refusing to write the ledger into a doomed location`);
|
|
5243
5295
|
}
|
|
@@ -5247,11 +5299,11 @@ function releaseLedgerPath(cwd) {
|
|
|
5247
5299
|
return (0, import_node_path8.join)(resolvePrimaryGitDir(cwd), "mmi-runtime", "release", "phases.json");
|
|
5248
5300
|
}
|
|
5249
5301
|
function atomicWriteJson(path2, ledger) {
|
|
5250
|
-
(0,
|
|
5302
|
+
(0, import_node_fs7.mkdirSync)((0, import_node_path8.dirname)(path2), { recursive: true });
|
|
5251
5303
|
const tmp = `${path2}.tmp-${process.pid}-${(0, import_node_crypto.randomBytes)(4).toString("hex")}`;
|
|
5252
|
-
(0,
|
|
5304
|
+
(0, import_node_fs7.writeFileSync)(tmp, `${JSON.stringify(ledger, null, 2)}
|
|
5253
5305
|
`, "utf8");
|
|
5254
|
-
(0,
|
|
5306
|
+
(0, import_node_fs7.renameSync)(tmp, path2);
|
|
5255
5307
|
}
|
|
5256
5308
|
var LEDGER_LOCK_OPTS = { label: "release ledger", staleMs: 18e4, deadHolderSteal: true };
|
|
5257
5309
|
async function withLedgerLock(path2, fn, opts = {}) {
|
|
@@ -5286,7 +5338,7 @@ function describeTrainWriterToken(token) {
|
|
|
5286
5338
|
function liveTrainWriterHolder(cwd) {
|
|
5287
5339
|
let token;
|
|
5288
5340
|
try {
|
|
5289
|
-
token = (0,
|
|
5341
|
+
token = (0, import_node_fs7.readFileSync)(trainWriterLockPath(cwd), "utf8");
|
|
5290
5342
|
} catch {
|
|
5291
5343
|
return void 0;
|
|
5292
5344
|
}
|
|
@@ -5299,7 +5351,7 @@ async function withReleaseLedger(path2, expected, fn, opts = {}) {
|
|
|
5299
5351
|
let current;
|
|
5300
5352
|
let raw;
|
|
5301
5353
|
try {
|
|
5302
|
-
raw = (0,
|
|
5354
|
+
raw = (0, import_node_fs7.readFileSync)(path2, "utf8");
|
|
5303
5355
|
} catch (e) {
|
|
5304
5356
|
if (e.code !== "ENOENT") {
|
|
5305
5357
|
throw new ReleaseLedgerError("unreadable", `release ledger at ${path2} could not be READ (${e instanceof Error ? e.message : String(e)}) \u2014 a failed read is unverified, not absent (#5987)`);
|
|
@@ -5488,7 +5540,7 @@ async function healStaleAlignmentLeg(deps, cwd, expected) {
|
|
|
5488
5540
|
return withLedgerLock(path2, async (fence) => {
|
|
5489
5541
|
let prior;
|
|
5490
5542
|
try {
|
|
5491
|
-
prior = parseReleaseLedger((0,
|
|
5543
|
+
prior = parseReleaseLedger((0, import_node_fs7.readFileSync)(path2, "utf8"));
|
|
5492
5544
|
} catch {
|
|
5493
5545
|
return void 0;
|
|
5494
5546
|
}
|
|
@@ -5513,7 +5565,7 @@ async function healUnfoldedRunLegs(deps, cwd, model) {
|
|
|
5513
5565
|
const path2 = releaseLedgerPath(cwd);
|
|
5514
5566
|
let prior;
|
|
5515
5567
|
try {
|
|
5516
|
-
prior = parseReleaseLedger((0,
|
|
5568
|
+
prior = parseReleaseLedger((0, import_node_fs7.readFileSync)(path2, "utf8"));
|
|
5517
5569
|
} catch {
|
|
5518
5570
|
return void 0;
|
|
5519
5571
|
}
|
|
@@ -5663,10 +5715,10 @@ function readOriginWorkflowsDefault(root, ref) {
|
|
|
5663
5715
|
}
|
|
5664
5716
|
var NPM_REGISTRY = "https://registry.npmjs.org";
|
|
5665
5717
|
async function probeRegistryWhoami(train) {
|
|
5666
|
-
const dir = (0,
|
|
5718
|
+
const dir = (0, import_node_fs8.mkdtempSync)((0, import_node_path9.join)((0, import_node_os2.tmpdir)(), "mmi-npmrc-"));
|
|
5667
5719
|
const rc = (0, import_node_path9.join)(dir, "npmrc");
|
|
5668
5720
|
try {
|
|
5669
|
-
(0,
|
|
5721
|
+
(0, import_node_fs8.writeFileSync)(rc, "//registry.npmjs.org/:_authToken=${NPM_TOKEN}\n");
|
|
5670
5722
|
await train.runSelf(["secrets", "use", "npm/NPM_TOKEN", "--slug", "_org", "--", "npm", "whoami", "--registry", NPM_REGISTRY, "--userconfig", rc]);
|
|
5671
5723
|
return { kind: "ok", detail: "the registry answered a login" };
|
|
5672
5724
|
} catch (e) {
|
|
@@ -5677,7 +5729,7 @@ async function probeRegistryWhoami(train) {
|
|
|
5677
5729
|
if (/\bE401\b|401 Unauthorized/.test(stderr)) return { kind: "rejected", detail: "npm whoami answered 401 Unauthorized" };
|
|
5678
5730
|
return { kind: "unverified", detail: first };
|
|
5679
5731
|
} finally {
|
|
5680
|
-
(0,
|
|
5732
|
+
(0, import_node_fs8.rmSync)(dir, { recursive: true, force: true });
|
|
5681
5733
|
}
|
|
5682
5734
|
}
|
|
5683
5735
|
var defaultDeps2 = {
|
|
@@ -5690,7 +5742,7 @@ var defaultDeps2 = {
|
|
|
5690
5742
|
ledgerPath: releaseLedgerPath,
|
|
5691
5743
|
readLedgerRaw: (path2) => {
|
|
5692
5744
|
try {
|
|
5693
|
-
return (0,
|
|
5745
|
+
return (0, import_node_fs8.readFileSync)(path2, "utf8");
|
|
5694
5746
|
} catch (e) {
|
|
5695
5747
|
if (e.code === "ENOENT") return void 0;
|
|
5696
5748
|
throw e;
|
|
@@ -5701,7 +5753,7 @@ var defaultDeps2 = {
|
|
|
5701
5753
|
trainWriterHolder: liveTrainWriterHolder,
|
|
5702
5754
|
readSurfacesRaw: (cwd) => {
|
|
5703
5755
|
try {
|
|
5704
|
-
return (0,
|
|
5756
|
+
return (0, import_node_fs8.readFileSync)((0, import_node_path9.join)(cwd, "surfaces.json"), "utf8");
|
|
5705
5757
|
} catch {
|
|
5706
5758
|
return void 0;
|
|
5707
5759
|
}
|
package/package.json
CHANGED