@mutmutco/cli 4.5.162 → 4.5.164
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 +1049 -892
- package/dist/runbook-sweep.cjs +103 -57
- package/package.json +1 -1
package/dist/runbook-sweep.cjs
CHANGED
|
@@ -243,6 +243,44 @@ var init_gh_read_route = __esm({
|
|
|
243
243
|
}
|
|
244
244
|
});
|
|
245
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
|
+
|
|
246
284
|
// src/github-quota.ts
|
|
247
285
|
var init_github_quota = __esm({
|
|
248
286
|
"src/github-quota.ts"() {
|
|
@@ -348,6 +386,7 @@ var init_cli_shared = __esm({
|
|
|
348
386
|
init_error_codes();
|
|
349
387
|
init_github_client();
|
|
350
388
|
init_gh_read_route();
|
|
389
|
+
init_gh_usage();
|
|
351
390
|
init_hub_auth();
|
|
352
391
|
init_house_map();
|
|
353
392
|
init_stdin_inject();
|
|
@@ -360,6 +399,11 @@ var init_cli_shared = __esm({
|
|
|
360
399
|
rawExecFileP(file, args, { encoding: "utf8", windowsHide: true, timeout: DEFAULT_EXEC_TIMEOUT_MS, killSignal: "SIGTERM", ...options, ...env ? { env } : {} })
|
|
361
400
|
);
|
|
362
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
|
+
}
|
|
363
407
|
if (!appEnv) return run();
|
|
364
408
|
try {
|
|
365
409
|
return await run(appEnv);
|
|
@@ -392,6 +436,8 @@ var init_github_client = __esm({
|
|
|
392
436
|
"src/github-client.ts"() {
|
|
393
437
|
"use strict";
|
|
394
438
|
init_cli_shared();
|
|
439
|
+
init_gh_read_route();
|
|
440
|
+
init_gh_usage();
|
|
395
441
|
}
|
|
396
442
|
});
|
|
397
443
|
|
|
@@ -786,7 +832,7 @@ function checkRunbookCoverage(docs, base, git) {
|
|
|
786
832
|
const globs = lines.slice(heading.start, markerEnd - 1).flatMap((text) => /<!--\s*runbook-covers:\s*(.*?)\s*-->/.exec(text)?.[1].split(",").map((s) => s.trim()) ?? []);
|
|
787
833
|
const affected = changed.filter((path2) => globs.some((glob) => matches(glob, path2)));
|
|
788
834
|
if (affected.length && !ranges.some((r) => r.count > 0 && r.start < end && r.start + r.count > heading.start)) {
|
|
789
|
-
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 }, sources: affected });
|
|
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 });
|
|
790
836
|
}
|
|
791
837
|
}
|
|
792
838
|
}
|
|
@@ -1154,23 +1200,23 @@ init_github_quota();
|
|
|
1154
1200
|
init_cli_shared();
|
|
1155
1201
|
|
|
1156
1202
|
// src/repo-runtime-state.ts
|
|
1157
|
-
var
|
|
1158
|
-
var
|
|
1203
|
+
var import_node_fs4 = require("node:fs");
|
|
1204
|
+
var import_node_path4 = require("node:path");
|
|
1159
1205
|
function resolveGitDir(cwd) {
|
|
1160
|
-
const dotGit = (0,
|
|
1206
|
+
const dotGit = (0, import_node_path4.join)(cwd, ".git");
|
|
1161
1207
|
try {
|
|
1162
|
-
const st = (0,
|
|
1208
|
+
const st = (0, import_node_fs4.statSync)(dotGit);
|
|
1163
1209
|
if (st.isDirectory()) return dotGit;
|
|
1164
1210
|
if (!st.isFile()) return void 0;
|
|
1165
1211
|
} catch {
|
|
1166
1212
|
return void 0;
|
|
1167
1213
|
}
|
|
1168
1214
|
try {
|
|
1169
|
-
const raw = (0,
|
|
1215
|
+
const raw = (0, import_node_fs4.readFileSync)(dotGit, "utf8").trim();
|
|
1170
1216
|
const match = /^gitdir:\s*(.+)$/i.exec(raw);
|
|
1171
1217
|
if (!match) return void 0;
|
|
1172
1218
|
const gitdir = match[1].trim();
|
|
1173
|
-
return (0,
|
|
1219
|
+
return (0, import_node_path4.isAbsolute)(gitdir) ? gitdir : (0, import_node_path4.resolve)(cwd, gitdir);
|
|
1174
1220
|
} catch {
|
|
1175
1221
|
return void 0;
|
|
1176
1222
|
}
|
|
@@ -1398,8 +1444,8 @@ function humanReadableArgName(arg) {
|
|
|
1398
1444
|
// node_modules/commander/lib/command.js
|
|
1399
1445
|
var import_node_events = require("node:events");
|
|
1400
1446
|
var import_node_child_process4 = __toESM(require("node:child_process"), 1);
|
|
1401
|
-
var
|
|
1402
|
-
var
|
|
1447
|
+
var import_node_path5 = __toESM(require("node:path"), 1);
|
|
1448
|
+
var import_node_fs5 = __toESM(require("node:fs"), 1);
|
|
1403
1449
|
var import_node_process = __toESM(require("node:process"), 1);
|
|
1404
1450
|
var import_node_util4 = require("node:util");
|
|
1405
1451
|
|
|
@@ -3367,7 +3413,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3367
3413
|
* @param {string} subcommandName
|
|
3368
3414
|
*/
|
|
3369
3415
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
3370
|
-
if (
|
|
3416
|
+
if (import_node_fs5.default.existsSync(executableFile)) return;
|
|
3371
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";
|
|
3372
3418
|
const executableMissing = `'${executableFile}' does not exist
|
|
3373
3419
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
@@ -3384,11 +3430,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3384
3430
|
args = args.slice();
|
|
3385
3431
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
3386
3432
|
function findFile(baseDir, baseName) {
|
|
3387
|
-
const localBin =
|
|
3388
|
-
if (
|
|
3389
|
-
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;
|
|
3390
3436
|
const foundExt = sourceExt.find(
|
|
3391
|
-
(ext) =>
|
|
3437
|
+
(ext) => import_node_fs5.default.existsSync(`${localBin}${ext}`)
|
|
3392
3438
|
);
|
|
3393
3439
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
3394
3440
|
return void 0;
|
|
@@ -3400,21 +3446,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3400
3446
|
if (this._scriptPath) {
|
|
3401
3447
|
let resolvedScriptPath;
|
|
3402
3448
|
try {
|
|
3403
|
-
resolvedScriptPath =
|
|
3449
|
+
resolvedScriptPath = import_node_fs5.default.realpathSync(this._scriptPath);
|
|
3404
3450
|
} catch {
|
|
3405
3451
|
resolvedScriptPath = this._scriptPath;
|
|
3406
3452
|
}
|
|
3407
|
-
executableDir =
|
|
3408
|
-
|
|
3453
|
+
executableDir = import_node_path5.default.resolve(
|
|
3454
|
+
import_node_path5.default.dirname(resolvedScriptPath),
|
|
3409
3455
|
executableDir
|
|
3410
3456
|
);
|
|
3411
3457
|
}
|
|
3412
3458
|
if (executableDir) {
|
|
3413
3459
|
let localFile = findFile(executableDir, executableFile);
|
|
3414
3460
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
3415
|
-
const legacyName =
|
|
3461
|
+
const legacyName = import_node_path5.default.basename(
|
|
3416
3462
|
this._scriptPath,
|
|
3417
|
-
|
|
3463
|
+
import_node_path5.default.extname(this._scriptPath)
|
|
3418
3464
|
);
|
|
3419
3465
|
if (legacyName !== this._name) {
|
|
3420
3466
|
localFile = findFile(
|
|
@@ -3425,7 +3471,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3425
3471
|
}
|
|
3426
3472
|
executableFile = localFile || executableFile;
|
|
3427
3473
|
}
|
|
3428
|
-
const launchWithNode = sourceExt.includes(
|
|
3474
|
+
const launchWithNode = sourceExt.includes(import_node_path5.default.extname(executableFile));
|
|
3429
3475
|
let proc;
|
|
3430
3476
|
if (import_node_process.default.platform !== "win32") {
|
|
3431
3477
|
if (launchWithNode) {
|
|
@@ -4342,7 +4388,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4342
4388
|
* @return {Command}
|
|
4343
4389
|
*/
|
|
4344
4390
|
nameFromFilename(filename) {
|
|
4345
|
-
this._name =
|
|
4391
|
+
this._name = import_node_path5.default.basename(filename, import_node_path5.default.extname(filename));
|
|
4346
4392
|
return this;
|
|
4347
4393
|
}
|
|
4348
4394
|
/**
|
|
@@ -4858,13 +4904,13 @@ async function discoverShaWorkflowRuns(deps, repo, headSha, seenRunIds) {
|
|
|
4858
4904
|
|
|
4859
4905
|
// src/train-doctor.ts
|
|
4860
4906
|
var import_node_child_process7 = require("node:child_process");
|
|
4861
|
-
var
|
|
4862
|
-
var
|
|
4863
|
-
var
|
|
4907
|
+
var import_node_fs8 = require("node:fs");
|
|
4908
|
+
var import_node_os2 = require("node:os");
|
|
4909
|
+
var import_node_path9 = require("node:path");
|
|
4864
4910
|
|
|
4865
4911
|
// src/doctor-io.ts
|
|
4866
|
-
var
|
|
4867
|
-
var
|
|
4912
|
+
var import_node_fs6 = require("node:fs");
|
|
4913
|
+
var import_node_path6 = require("node:path");
|
|
4868
4914
|
var import_node_child_process5 = require("node:child_process");
|
|
4869
4915
|
var import_node_util5 = require("node:util");
|
|
4870
4916
|
|
|
@@ -4903,8 +4949,8 @@ function nodeDiscardSinkPath(platform = process.platform) {
|
|
|
4903
4949
|
var execFileP2 = (0, import_node_util5.promisify)(import_node_child_process5.execFile);
|
|
4904
4950
|
function execFileCapture(file, args, opts = {}) {
|
|
4905
4951
|
const sink = nodeDiscardSinkPath();
|
|
4906
|
-
const inFd = (0,
|
|
4907
|
-
const errFd = (0,
|
|
4952
|
+
const inFd = (0, import_node_fs6.openSync)(sink, "r");
|
|
4953
|
+
const errFd = (0, import_node_fs6.openSync)(sink, "w");
|
|
4908
4954
|
try {
|
|
4909
4955
|
return (0, import_node_child_process5.execFileSync)(file, args, {
|
|
4910
4956
|
...opts,
|
|
@@ -4912,8 +4958,8 @@ function execFileCapture(file, args, opts = {}) {
|
|
|
4912
4958
|
stdio: [inFd, "pipe", errFd]
|
|
4913
4959
|
});
|
|
4914
4960
|
} finally {
|
|
4915
|
-
(0,
|
|
4916
|
-
(0,
|
|
4961
|
+
(0, import_node_fs6.closeSync)(inFd);
|
|
4962
|
+
(0, import_node_fs6.closeSync)(errFd);
|
|
4917
4963
|
}
|
|
4918
4964
|
}
|
|
4919
4965
|
function worktreeRootSync() {
|
|
@@ -4928,13 +4974,13 @@ function worktreeRootSync() {
|
|
|
4928
4974
|
}
|
|
4929
4975
|
var gitignorePath = () => {
|
|
4930
4976
|
const root = worktreeRootSync();
|
|
4931
|
-
return root === null ? null : (0,
|
|
4977
|
+
return root === null ? null : (0, import_node_path6.join)(root, ".gitignore");
|
|
4932
4978
|
};
|
|
4933
4979
|
function readGitignore() {
|
|
4934
4980
|
const path2 = gitignorePath();
|
|
4935
4981
|
if (path2 === null) return null;
|
|
4936
4982
|
try {
|
|
4937
|
-
return (0,
|
|
4983
|
+
return (0, import_node_fs6.readFileSync)(path2, "utf8");
|
|
4938
4984
|
} catch {
|
|
4939
4985
|
return null;
|
|
4940
4986
|
}
|
|
@@ -4943,7 +4989,7 @@ function writeGitignore(content) {
|
|
|
4943
4989
|
const path2 = gitignorePath();
|
|
4944
4990
|
if (path2 === null) return false;
|
|
4945
4991
|
try {
|
|
4946
|
-
(0,
|
|
4992
|
+
(0, import_node_fs6.writeFileSync)(path2, content, "utf8");
|
|
4947
4993
|
return true;
|
|
4948
4994
|
} catch {
|
|
4949
4995
|
return false;
|
|
@@ -4958,13 +5004,13 @@ var PACKAGE = "@anthropic-ai/claude-code";
|
|
|
4958
5004
|
var CLAUDE_BINARY_INSTALL_COMMAND = `npm install -g ${PACKAGE}`;
|
|
4959
5005
|
|
|
4960
5006
|
// src/release-ledger.ts
|
|
4961
|
-
var
|
|
4962
|
-
var
|
|
5007
|
+
var import_node_fs7 = require("node:fs");
|
|
5008
|
+
var import_node_path8 = require("node:path");
|
|
4963
5009
|
var import_node_crypto = require("node:crypto");
|
|
4964
5010
|
|
|
4965
5011
|
// src/file-lock.ts
|
|
4966
5012
|
var import_promises = require("node:fs/promises");
|
|
4967
|
-
var
|
|
5013
|
+
var import_node_path7 = require("node:path");
|
|
4968
5014
|
function pidIsDead(pid) {
|
|
4969
5015
|
if (!Number.isInteger(pid) || pid <= 0) return false;
|
|
4970
5016
|
if (pid === process.pid) return false;
|
|
@@ -5079,7 +5125,7 @@ async function releaseFileLock(lockPath, guard) {
|
|
|
5079
5125
|
}
|
|
5080
5126
|
async function withFencedFileLock(lockPath, opts, fn) {
|
|
5081
5127
|
const resolved = resolveFileLockOpts(opts);
|
|
5082
|
-
await (0, import_promises.mkdir)((0,
|
|
5128
|
+
await (0, import_promises.mkdir)((0, import_node_path7.dirname)(lockPath), { recursive: true }).catch(() => void 0);
|
|
5083
5129
|
const guard = await acquireFileLock(lockPath, resolved, Date.now() + resolved.maxWaitMs);
|
|
5084
5130
|
try {
|
|
5085
5131
|
return await fn(() => fileLockHeldBy(lockPath, guard.token));
|
|
@@ -5234,30 +5280,30 @@ function resolvePrimaryGitDir(cwd) {
|
|
|
5234
5280
|
}
|
|
5235
5281
|
let common;
|
|
5236
5282
|
try {
|
|
5237
|
-
common = (0,
|
|
5283
|
+
common = (0, import_node_fs7.readFileSync)((0, import_node_path8.join)(gitDir, "commondir"), "utf8").trim();
|
|
5238
5284
|
} catch (e) {
|
|
5239
5285
|
if (e.code !== "ENOENT") {
|
|
5240
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)`);
|
|
5241
5287
|
}
|
|
5242
5288
|
}
|
|
5243
5289
|
if (!common) return gitDir;
|
|
5244
|
-
const commonDir = (0,
|
|
5290
|
+
const commonDir = (0, import_node_path8.isAbsolute)(common) ? common : (0, import_node_path8.resolve)(gitDir, common);
|
|
5245
5291
|
try {
|
|
5246
|
-
(0,
|
|
5292
|
+
(0, import_node_fs7.readFileSync)((0, import_node_path8.join)(commonDir, "HEAD"), "utf8");
|
|
5247
5293
|
} catch (e) {
|
|
5248
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`);
|
|
5249
5295
|
}
|
|
5250
5296
|
return commonDir;
|
|
5251
5297
|
}
|
|
5252
5298
|
function releaseLedgerPath(cwd) {
|
|
5253
|
-
return (0,
|
|
5299
|
+
return (0, import_node_path8.join)(resolvePrimaryGitDir(cwd), "mmi-runtime", "release", "phases.json");
|
|
5254
5300
|
}
|
|
5255
5301
|
function atomicWriteJson(path2, ledger) {
|
|
5256
|
-
(0,
|
|
5302
|
+
(0, import_node_fs7.mkdirSync)((0, import_node_path8.dirname)(path2), { recursive: true });
|
|
5257
5303
|
const tmp = `${path2}.tmp-${process.pid}-${(0, import_node_crypto.randomBytes)(4).toString("hex")}`;
|
|
5258
|
-
(0,
|
|
5304
|
+
(0, import_node_fs7.writeFileSync)(tmp, `${JSON.stringify(ledger, null, 2)}
|
|
5259
5305
|
`, "utf8");
|
|
5260
|
-
(0,
|
|
5306
|
+
(0, import_node_fs7.renameSync)(tmp, path2);
|
|
5261
5307
|
}
|
|
5262
5308
|
var LEDGER_LOCK_OPTS = { label: "release ledger", staleMs: 18e4, deadHolderSteal: true };
|
|
5263
5309
|
async function withLedgerLock(path2, fn, opts = {}) {
|
|
@@ -5269,16 +5315,16 @@ async function withLedgerLock(path2, fn, opts = {}) {
|
|
|
5269
5315
|
}));
|
|
5270
5316
|
}
|
|
5271
5317
|
function checkoutRootFrom(cwd) {
|
|
5272
|
-
let dir = (0,
|
|
5318
|
+
let dir = (0, import_node_path8.resolve)(cwd);
|
|
5273
5319
|
for (; ; ) {
|
|
5274
5320
|
if (resolveGitDir(dir)) return dir;
|
|
5275
|
-
const parent = (0,
|
|
5321
|
+
const parent = (0, import_node_path8.dirname)(dir);
|
|
5276
5322
|
if (parent === dir) throw new ReleaseLedgerError("no-checkout", `train writer lock: no git checkout found above ${cwd}`);
|
|
5277
5323
|
dir = parent;
|
|
5278
5324
|
}
|
|
5279
5325
|
}
|
|
5280
5326
|
function trainWriterLockPath(cwd) {
|
|
5281
|
-
return (0,
|
|
5327
|
+
return (0, import_node_path8.join)((0, import_node_path8.dirname)(releaseLedgerPath(checkoutRootFrom(cwd))), "train.lock");
|
|
5282
5328
|
}
|
|
5283
5329
|
var TRAIN_WRITER_STALE_MS = 12 * 60 * 6e4;
|
|
5284
5330
|
function describeTrainWriterToken(token) {
|
|
@@ -5292,7 +5338,7 @@ function describeTrainWriterToken(token) {
|
|
|
5292
5338
|
function liveTrainWriterHolder(cwd) {
|
|
5293
5339
|
let token;
|
|
5294
5340
|
try {
|
|
5295
|
-
token = (0,
|
|
5341
|
+
token = (0, import_node_fs7.readFileSync)(trainWriterLockPath(cwd), "utf8");
|
|
5296
5342
|
} catch {
|
|
5297
5343
|
return void 0;
|
|
5298
5344
|
}
|
|
@@ -5305,7 +5351,7 @@ async function withReleaseLedger(path2, expected, fn, opts = {}) {
|
|
|
5305
5351
|
let current;
|
|
5306
5352
|
let raw;
|
|
5307
5353
|
try {
|
|
5308
|
-
raw = (0,
|
|
5354
|
+
raw = (0, import_node_fs7.readFileSync)(path2, "utf8");
|
|
5309
5355
|
} catch (e) {
|
|
5310
5356
|
if (e.code !== "ENOENT") {
|
|
5311
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)`);
|
|
@@ -5494,7 +5540,7 @@ async function healStaleAlignmentLeg(deps, cwd, expected) {
|
|
|
5494
5540
|
return withLedgerLock(path2, async (fence) => {
|
|
5495
5541
|
let prior;
|
|
5496
5542
|
try {
|
|
5497
|
-
prior = parseReleaseLedger((0,
|
|
5543
|
+
prior = parseReleaseLedger((0, import_node_fs7.readFileSync)(path2, "utf8"));
|
|
5498
5544
|
} catch {
|
|
5499
5545
|
return void 0;
|
|
5500
5546
|
}
|
|
@@ -5519,7 +5565,7 @@ async function healUnfoldedRunLegs(deps, cwd, model) {
|
|
|
5519
5565
|
const path2 = releaseLedgerPath(cwd);
|
|
5520
5566
|
let prior;
|
|
5521
5567
|
try {
|
|
5522
|
-
prior = parseReleaseLedger((0,
|
|
5568
|
+
prior = parseReleaseLedger((0, import_node_fs7.readFileSync)(path2, "utf8"));
|
|
5523
5569
|
} catch {
|
|
5524
5570
|
return void 0;
|
|
5525
5571
|
}
|
|
@@ -5669,10 +5715,10 @@ function readOriginWorkflowsDefault(root, ref) {
|
|
|
5669
5715
|
}
|
|
5670
5716
|
var NPM_REGISTRY = "https://registry.npmjs.org";
|
|
5671
5717
|
async function probeRegistryWhoami(train) {
|
|
5672
|
-
const dir = (0,
|
|
5673
|
-
const rc = (0,
|
|
5718
|
+
const dir = (0, import_node_fs8.mkdtempSync)((0, import_node_path9.join)((0, import_node_os2.tmpdir)(), "mmi-npmrc-"));
|
|
5719
|
+
const rc = (0, import_node_path9.join)(dir, "npmrc");
|
|
5674
5720
|
try {
|
|
5675
|
-
(0,
|
|
5721
|
+
(0, import_node_fs8.writeFileSync)(rc, "//registry.npmjs.org/:_authToken=${NPM_TOKEN}\n");
|
|
5676
5722
|
await train.runSelf(["secrets", "use", "npm/NPM_TOKEN", "--slug", "_org", "--", "npm", "whoami", "--registry", NPM_REGISTRY, "--userconfig", rc]);
|
|
5677
5723
|
return { kind: "ok", detail: "the registry answered a login" };
|
|
5678
5724
|
} catch (e) {
|
|
@@ -5683,7 +5729,7 @@ async function probeRegistryWhoami(train) {
|
|
|
5683
5729
|
if (/\bE401\b|401 Unauthorized/.test(stderr)) return { kind: "rejected", detail: "npm whoami answered 401 Unauthorized" };
|
|
5684
5730
|
return { kind: "unverified", detail: first };
|
|
5685
5731
|
} finally {
|
|
5686
|
-
(0,
|
|
5732
|
+
(0, import_node_fs8.rmSync)(dir, { recursive: true, force: true });
|
|
5687
5733
|
}
|
|
5688
5734
|
}
|
|
5689
5735
|
var defaultDeps2 = {
|
|
@@ -5696,7 +5742,7 @@ var defaultDeps2 = {
|
|
|
5696
5742
|
ledgerPath: releaseLedgerPath,
|
|
5697
5743
|
readLedgerRaw: (path2) => {
|
|
5698
5744
|
try {
|
|
5699
|
-
return (0,
|
|
5745
|
+
return (0, import_node_fs8.readFileSync)(path2, "utf8");
|
|
5700
5746
|
} catch (e) {
|
|
5701
5747
|
if (e.code === "ENOENT") return void 0;
|
|
5702
5748
|
throw e;
|
|
@@ -5707,7 +5753,7 @@ var defaultDeps2 = {
|
|
|
5707
5753
|
trainWriterHolder: liveTrainWriterHolder,
|
|
5708
5754
|
readSurfacesRaw: (cwd) => {
|
|
5709
5755
|
try {
|
|
5710
|
-
return (0,
|
|
5756
|
+
return (0, import_node_fs8.readFileSync)((0, import_node_path9.join)(cwd, "surfaces.json"), "utf8");
|
|
5711
5757
|
} catch {
|
|
5712
5758
|
return void 0;
|
|
5713
5759
|
}
|
package/package.json
CHANGED