@plexus-ms/cli 0.109.0 → 0.111.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/dist/plx.js +117 -176
- package/package.json +2 -2
package/dist/plx.js
CHANGED
|
@@ -7582,6 +7582,8 @@ function bumpCollectionPin(text, train) {
|
|
|
7582
7582
|
}
|
|
7583
7583
|
return lines.join("\n");
|
|
7584
7584
|
}
|
|
7585
|
+
var RUNNER_IMAGE_PIN_FILE = "ansible/roles/ci_runner_host/defaults/main.yml";
|
|
7586
|
+
var bumpRunnerImagePin = (text, train) => text.replace(/(ghcr\.io\/plexus-ms\/ci-runner:)\d+\.\d+\.\d+/g, `$1${train}`);
|
|
7585
7587
|
var WORKFLOW_REF = "plexus-ms/primitives/.github/workflows/";
|
|
7586
7588
|
var bumpWorkflowRefs = (text, train) => text.replace(/(plexus-ms\/primitives\/\.github\/workflows\/[A-Za-z0-9._-]+)@v?[0-9.]+/g, `$1@${train}`);
|
|
7587
7589
|
var bumpManifestVersion = (text, train) => text.replace(/^(\s*"version":\s*")[^"]*(")/m, `$1${train}$2`);
|
|
@@ -7662,83 +7664,9 @@ async function readCatalog(ctx, compendium) {
|
|
|
7662
7664
|
return catalog;
|
|
7663
7665
|
}
|
|
7664
7666
|
|
|
7665
|
-
// ../lib/dist/changedApps.js
|
|
7666
|
-
import { join as join2 } from "node:path";
|
|
7667
|
-
var BOOKKEEPING = /(^|\/)(PLEXUS\.md|\.copier-answers\.yml)$/;
|
|
7668
|
-
var GLOBALS = /^(pnpm-lock\.yaml|pnpm-workspace\.yaml|package\.json|turbo\.json|mise\.toml|\.npmrc)$/;
|
|
7669
|
-
var NO_REF = /^0*$/;
|
|
7670
|
-
async function selectChangedApps(input) {
|
|
7671
|
-
const all = [...input.all].sort();
|
|
7672
|
-
if (input.changed === void 0)
|
|
7673
|
-
return { apps: all, reason: "no base ref: every app counts as changed" };
|
|
7674
|
-
const changed = input.changed.filter((f) => !BOOKKEEPING.test(f));
|
|
7675
|
-
const under = (app) => changed.some((f) => f.startsWith(`apps/${app}/`));
|
|
7676
|
-
if (!input.workspace)
|
|
7677
|
-
return { apps: all.filter(under), reason: "files under the apps changed" };
|
|
7678
|
-
if (changed.length === 0)
|
|
7679
|
-
return { apps: [], reason: "nothing but bookkeeping changed" };
|
|
7680
|
-
if (changed.some((f) => GLOBALS.test(f)))
|
|
7681
|
-
return { apps: all, reason: "a workspace-global input changed: every app counts as changed" };
|
|
7682
|
-
const outside = changed.some((f) => !f.startsWith("apps/"));
|
|
7683
|
-
const listed = new Set(await input.dependents?.() ?? []);
|
|
7684
|
-
return {
|
|
7685
|
-
apps: all.filter((app) => listed.has(app) && (outside || under(app))),
|
|
7686
|
-
reason: "sources or their dependencies changed"
|
|
7687
|
-
};
|
|
7688
|
-
}
|
|
7689
|
-
async function readChangedApps(ctx, dir, from, to = "HEAD") {
|
|
7690
|
-
const git2 = (args) => ctx.read("git", args, { cwd: dir });
|
|
7691
|
-
const workspace = await exists(ctx, join2(dir, "pnpm-workspace.yaml"));
|
|
7692
|
-
const all = await deployableApps(ctx, dir, workspace);
|
|
7693
|
-
let changed;
|
|
7694
|
-
if (from !== "" && !NO_REF.test(from) && await isCommit(git2, from))
|
|
7695
|
-
changed = (await git2(["diff", "--name-only", from, to])).split("\n").filter(Boolean);
|
|
7696
|
-
const dependents = async () => {
|
|
7697
|
-
const out = await ctx.read("pnpm", ["--filter", `...[${from}...${to}]`, "ls", "--depth", "-1", "--parseable"], {
|
|
7698
|
-
cwd: dir
|
|
7699
|
-
});
|
|
7700
|
-
return out.split("\n").map((line) => /(?:^|\/)apps\/([^/]+)$/.exec(line.trim())?.[1]).filter((app) => app !== void 0);
|
|
7701
|
-
};
|
|
7702
|
-
const result = await selectChangedApps({ workspace, all, changed, dependents });
|
|
7703
|
-
ctx.say(`\u2192 ${result.reason}`, 1);
|
|
7704
|
-
return result;
|
|
7705
|
-
}
|
|
7706
|
-
async function isCommit(git2, ref) {
|
|
7707
|
-
try {
|
|
7708
|
-
await git2(["rev-parse", "--verify", "--quiet", `${ref}^{commit}`]);
|
|
7709
|
-
return true;
|
|
7710
|
-
} catch {
|
|
7711
|
-
return false;
|
|
7712
|
-
}
|
|
7713
|
-
}
|
|
7714
|
-
async function deployableApps(ctx, dir, workspace) {
|
|
7715
|
-
const entries = await ctx.readDir(join2(dir, "apps")).catch(() => []);
|
|
7716
|
-
const apps = [];
|
|
7717
|
-
for (const e of entries) {
|
|
7718
|
-
if (!e.directory)
|
|
7719
|
-
continue;
|
|
7720
|
-
const marks = workspace ? ["package.json"] : ["docker/compose.yaml", "compose.yaml"];
|
|
7721
|
-
for (const mark of marks) {
|
|
7722
|
-
if (await exists(ctx, join2(dir, "apps", e.name, mark))) {
|
|
7723
|
-
apps.push(e.name);
|
|
7724
|
-
break;
|
|
7725
|
-
}
|
|
7726
|
-
}
|
|
7727
|
-
}
|
|
7728
|
-
return apps.sort();
|
|
7729
|
-
}
|
|
7730
|
-
async function exists(ctx, path3) {
|
|
7731
|
-
try {
|
|
7732
|
-
await ctx.readFile(path3);
|
|
7733
|
-
return true;
|
|
7734
|
-
} catch {
|
|
7735
|
-
return false;
|
|
7736
|
-
}
|
|
7737
|
-
}
|
|
7738
|
-
|
|
7739
7667
|
// ../lib/dist/changeset.js
|
|
7740
7668
|
var import_yaml2 = __toESM(require_dist(), 1);
|
|
7741
|
-
import { dirname, join as
|
|
7669
|
+
import { dirname, join as join2 } from "node:path";
|
|
7742
7670
|
|
|
7743
7671
|
// ../lib/dist/io.js
|
|
7744
7672
|
import { spawn } from "node:child_process";
|
|
@@ -7761,7 +7689,7 @@ function realIo(prompt) {
|
|
|
7761
7689
|
stdout: process.stdout,
|
|
7762
7690
|
stderr: process.stderr,
|
|
7763
7691
|
prompt: prompt && isInteractive() ? prompt : void 0,
|
|
7764
|
-
exec: (command, args, options = {}) => new Promise((
|
|
7692
|
+
exec: (command, args, options = {}) => new Promise((resolve10, reject) => {
|
|
7765
7693
|
const child = spawn(command, args, {
|
|
7766
7694
|
cwd: options.cwd,
|
|
7767
7695
|
env: options.env,
|
|
@@ -7784,7 +7712,7 @@ function realIo(prompt) {
|
|
|
7784
7712
|
child.on("error", reject);
|
|
7785
7713
|
child.on("close", (code) => {
|
|
7786
7714
|
if (code === 0)
|
|
7787
|
-
|
|
7715
|
+
resolve10(stdout);
|
|
7788
7716
|
else
|
|
7789
7717
|
reject(new ExecError(render(command, args), code, stderr));
|
|
7790
7718
|
});
|
|
@@ -7803,7 +7731,7 @@ function quote(arg) {
|
|
|
7803
7731
|
return /^[\w./:@%+=,-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", "'\\''")}'`;
|
|
7804
7732
|
}
|
|
7805
7733
|
|
|
7806
|
-
// ../lib/dist/
|
|
7734
|
+
// ../lib/dist/effects.js
|
|
7807
7735
|
var run = (command, args = [], options = {}) => ({
|
|
7808
7736
|
kind: "run",
|
|
7809
7737
|
command,
|
|
@@ -7883,7 +7811,7 @@ ${header.join("\n")}
|
|
|
7883
7811
|
|
|
7884
7812
|
${lines.join("\n")}
|
|
7885
7813
|
`;
|
|
7886
|
-
return { path: path3, releases, changes, sources, content, plan: [write(root ?
|
|
7814
|
+
return { path: path3, releases, changes, sources, content, plan: [write(root ? join2(root, path3) : path3, content)] };
|
|
7887
7815
|
}
|
|
7888
7816
|
function describeChange(c) {
|
|
7889
7817
|
const peer = c.field === "peerDependencies" ? " (peer)" : "";
|
|
@@ -7932,7 +7860,7 @@ async function readChangeset(ctx, dir, base, branch) {
|
|
|
7932
7860
|
};
|
|
7933
7861
|
const current = async (path4) => {
|
|
7934
7862
|
try {
|
|
7935
|
-
return await ctx.readFile(
|
|
7863
|
+
return await ctx.readFile(join2(dir, path4));
|
|
7936
7864
|
} catch {
|
|
7937
7865
|
return void 0;
|
|
7938
7866
|
}
|
|
@@ -7948,7 +7876,7 @@ async function readChangeset(ctx, dir, base, branch) {
|
|
|
7948
7876
|
}
|
|
7949
7877
|
const config = await current(`${CHANGESET_DIR}/config.json`);
|
|
7950
7878
|
const ignore = config ? JSON.parse(config).ignore ?? [] : [];
|
|
7951
|
-
const entries = await ctx.readDir(
|
|
7879
|
+
const entries = await ctx.readDir(join2(dir, CHANGESET_DIR)).catch(() => []);
|
|
7952
7880
|
const path3 = changesetPath(head);
|
|
7953
7881
|
return planChangeset({
|
|
7954
7882
|
branch: head,
|
|
@@ -7969,7 +7897,7 @@ async function expand(ctx, root, glob) {
|
|
|
7969
7897
|
if (star < 0)
|
|
7970
7898
|
return [glob.replace(/\/$/, "")];
|
|
7971
7899
|
const parent = glob.slice(0, star).replace(/\/$/, "");
|
|
7972
|
-
const entries = await ctx.readDir(
|
|
7900
|
+
const entries = await ctx.readDir(join2(root, parent)).catch(() => []);
|
|
7973
7901
|
return entries.filter((e) => e.directory && !e.name.startsWith(".")).map((e) => parent ? `${parent}/${e.name}` : e.name).sort();
|
|
7974
7902
|
}
|
|
7975
7903
|
|
|
@@ -8182,14 +8110,14 @@ function parseAnswers(text) {
|
|
|
8182
8110
|
// ../lib/dist/deploy.js
|
|
8183
8111
|
import { randomBytes } from "node:crypto";
|
|
8184
8112
|
import { tmpdir } from "node:os";
|
|
8185
|
-
import { join as
|
|
8113
|
+
import { join as join5 } from "node:path";
|
|
8186
8114
|
|
|
8187
8115
|
// ../lib/dist/deployTargets.js
|
|
8188
8116
|
var import_yaml4 = __toESM(require_dist(), 1);
|
|
8189
|
-
import { join as
|
|
8117
|
+
import { join as join4 } from "node:path";
|
|
8190
8118
|
|
|
8191
8119
|
// ../lib/dist/train.js
|
|
8192
|
-
import { join as
|
|
8120
|
+
import { join as join3 } from "node:path";
|
|
8193
8121
|
|
|
8194
8122
|
// ../lib/dist/doctor.js
|
|
8195
8123
|
import { relative as relative2 } from "node:path";
|
|
@@ -8279,7 +8207,7 @@ async function readTrain(ctx, upstream) {
|
|
|
8279
8207
|
const repos2 = [];
|
|
8280
8208
|
const all = /* @__PURE__ */ new Set();
|
|
8281
8209
|
for (const name of TRAIN_REPOS) {
|
|
8282
|
-
const path3 =
|
|
8210
|
+
const path3 = join3(upstream, name);
|
|
8283
8211
|
try {
|
|
8284
8212
|
await ctx.read("git", ["rev-parse", "--git-dir"], { cwd: path3 });
|
|
8285
8213
|
} catch {
|
|
@@ -8391,11 +8319,23 @@ function targetsIn(targets, environment) {
|
|
|
8391
8319
|
}
|
|
8392
8320
|
return flat;
|
|
8393
8321
|
}
|
|
8322
|
+
function deployLegs(targets, apps) {
|
|
8323
|
+
const legs = [];
|
|
8324
|
+
const without = [];
|
|
8325
|
+
for (const app of [...apps].sort()) {
|
|
8326
|
+
const host = targets[app];
|
|
8327
|
+
if (host === void 0)
|
|
8328
|
+
without.push(app);
|
|
8329
|
+
else
|
|
8330
|
+
legs.push({ app, host });
|
|
8331
|
+
}
|
|
8332
|
+
return { legs, without };
|
|
8333
|
+
}
|
|
8394
8334
|
async function readDeployTargets(ctx, inventory) {
|
|
8395
8335
|
const files = [];
|
|
8396
8336
|
let found = false;
|
|
8397
8337
|
for (const sub of VARS_DIRS) {
|
|
8398
|
-
const dir =
|
|
8338
|
+
const dir = join4(inventory, sub);
|
|
8399
8339
|
const entries = await ctx.readDir(dir).catch(() => void 0);
|
|
8400
8340
|
if (entries === void 0)
|
|
8401
8341
|
continue;
|
|
@@ -8403,7 +8343,7 @@ async function readDeployTargets(ctx, inventory) {
|
|
|
8403
8343
|
for (const e of entries) {
|
|
8404
8344
|
if (e.directory || !/\.ya?ml$/.test(e.name))
|
|
8405
8345
|
continue;
|
|
8406
|
-
const path3 =
|
|
8346
|
+
const path3 = join4(dir, e.name);
|
|
8407
8347
|
files.push(parseInventoryFile(path3, await ctx.readFile(path3)));
|
|
8408
8348
|
}
|
|
8409
8349
|
}
|
|
@@ -8432,7 +8372,7 @@ function defaultAppDir(tenant, app, environment = DEFAULT_ENVIRONMENT) {
|
|
|
8432
8372
|
}
|
|
8433
8373
|
var q = (word) => `'${word.replaceAll("'", "'\\''")}'`;
|
|
8434
8374
|
var Remote = class {
|
|
8435
|
-
socket =
|
|
8375
|
+
socket = join5(tmpdir(), `plx-deploy-${randomBytes(4).toString("hex")}.sock`);
|
|
8436
8376
|
ctx;
|
|
8437
8377
|
host;
|
|
8438
8378
|
constructor(ctx, host) {
|
|
@@ -8497,7 +8437,7 @@ async function deploy(ctx, options) {
|
|
|
8497
8437
|
let text = "";
|
|
8498
8438
|
for (const candidate of [`${source}/docker/compose.yaml`, `${source}/compose.yaml`]) {
|
|
8499
8439
|
try {
|
|
8500
|
-
text = await ctx.readFile(
|
|
8440
|
+
text = await ctx.readFile(join5(dir, candidate));
|
|
8501
8441
|
compose = candidate;
|
|
8502
8442
|
break;
|
|
8503
8443
|
} catch {
|
|
@@ -8532,15 +8472,15 @@ async function deploy(ctx, options) {
|
|
|
8532
8472
|
};
|
|
8533
8473
|
if (ctx.dryRun)
|
|
8534
8474
|
ctx.say(" (nothing more runs when the host already serves this image from this file, healthy)");
|
|
8535
|
-
else if (image
|
|
8475
|
+
else if (image ? result.previous === image : result.previous !== void 0) {
|
|
8536
8476
|
const sameFile = await remote.test(`cd ${D} && cmp -s compose.yaml ${INCOMING}/compose.yaml`);
|
|
8537
8477
|
if (sameFile) {
|
|
8538
8478
|
resolvedUrl = options.healthUrl || await resolveHealthUrl(remote, D, dc, ctx);
|
|
8539
8479
|
if (await remote.test(poll(1))) {
|
|
8540
|
-
result.live =
|
|
8480
|
+
result.live = result.previous;
|
|
8541
8481
|
result.healthy = true;
|
|
8542
8482
|
result.unchanged = true;
|
|
8543
|
-
ctx.done(`${
|
|
8483
|
+
ctx.done(`${result.previous} is already live and healthy; nothing to do`);
|
|
8544
8484
|
return result;
|
|
8545
8485
|
}
|
|
8546
8486
|
}
|
|
@@ -8623,7 +8563,7 @@ function isNotable(dir) {
|
|
|
8623
8563
|
}
|
|
8624
8564
|
|
|
8625
8565
|
// ../lib/dist/overview.js
|
|
8626
|
-
import { join as
|
|
8566
|
+
import { join as join6 } from "node:path";
|
|
8627
8567
|
var PRUNED = /* @__PURE__ */ new Set([
|
|
8628
8568
|
"node_modules",
|
|
8629
8569
|
".hg",
|
|
@@ -8704,7 +8644,7 @@ async function walk(ctx, path3, name, options) {
|
|
|
8704
8644
|
}
|
|
8705
8645
|
const subdirs = entries.filter((e) => e.directory && e.name !== ".git" && !PRUNED.has(e.name)).map((e) => e.name).sort();
|
|
8706
8646
|
for (const sub of subdirs) {
|
|
8707
|
-
const child = await walk(ctx,
|
|
8647
|
+
const child = await walk(ctx, join6(path3, sub), sub, options);
|
|
8708
8648
|
if (isNotable(child) || child.children.length > 0)
|
|
8709
8649
|
dir.children.push(child);
|
|
8710
8650
|
}
|
|
@@ -8712,7 +8652,7 @@ async function walk(ctx, path3, name, options) {
|
|
|
8712
8652
|
}
|
|
8713
8653
|
async function facet(ctx, dir, file, read) {
|
|
8714
8654
|
try {
|
|
8715
|
-
read(await ctx.readFile(
|
|
8655
|
+
read(await ctx.readFile(join6(dir.path, file)));
|
|
8716
8656
|
} catch (error) {
|
|
8717
8657
|
dir.problems ??= [];
|
|
8718
8658
|
dir.problems.push(`${file}: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -8751,7 +8691,7 @@ async function templateFacet(ctx, cwd) {
|
|
|
8751
8691
|
}
|
|
8752
8692
|
|
|
8753
8693
|
// ../lib/dist/propagate.js
|
|
8754
|
-
import { join as
|
|
8694
|
+
import { join as join7, relative as relative3 } from "node:path";
|
|
8755
8695
|
var isClean = (s) => s.conflicted.length === 0 && s.failed.length === 0 && s.skipped.length === 0;
|
|
8756
8696
|
var emptySummary = (train, preview) => ({
|
|
8757
8697
|
train,
|
|
@@ -8769,7 +8709,7 @@ var copierIn = (dir, args) => [
|
|
|
8769
8709
|
];
|
|
8770
8710
|
async function propagate(ctx, workspace, train) {
|
|
8771
8711
|
const summary = emptySummary(train, ctx.dryRun);
|
|
8772
|
-
const upstream =
|
|
8712
|
+
const upstream = join7(workspace, UPSTREAM);
|
|
8773
8713
|
const tree = await overview(ctx, workspace);
|
|
8774
8714
|
const upstreamDir = tree.children.find((c) => c.path === upstream);
|
|
8775
8715
|
const presets = TRAIN_REPOS.filter((r) => upstreamDir?.children.some((c) => c.name === r && c.template));
|
|
@@ -8789,7 +8729,7 @@ async function propagate(ctx, workspace, train) {
|
|
|
8789
8729
|
for (const consumer of consumers) {
|
|
8790
8730
|
if (consumer.skipped || !consumer.origin)
|
|
8791
8731
|
continue;
|
|
8792
|
-
const clone =
|
|
8732
|
+
const clone = join7(scratch, consumer.rel);
|
|
8793
8733
|
ctx.say(`\u2192 ${consumer.rel}: clone ${consumer.origin} at ${consumer.branch}`);
|
|
8794
8734
|
try {
|
|
8795
8735
|
await ctx.stage(run("git", ["clone", "--quiet", "--branch", consumer.branch, consumer.origin, clone]));
|
|
@@ -8829,13 +8769,13 @@ var previewCommit = (ctx, dir, message) => ctx.stage(run("git", ["add", "-A"], {
|
|
|
8829
8769
|
message
|
|
8830
8770
|
], { cwd: dir })));
|
|
8831
8771
|
async function updateSite(ctx, consumer, site, dir, take, summary) {
|
|
8832
|
-
const target =
|
|
8772
|
+
const target = join7(dir, relative3(consumer.path, site.path));
|
|
8833
8773
|
try {
|
|
8834
8774
|
if (take.previewFrom) {
|
|
8835
|
-
const localPreset =
|
|
8775
|
+
const localPreset = join7(take.previewFrom, site.preset);
|
|
8836
8776
|
ctx.say(`\u2192 ${site.rel}: copier update (preview from ${localPreset}@main)`);
|
|
8837
|
-
const answers = await ctx.readFile(
|
|
8838
|
-
await ctx.stage(write(
|
|
8777
|
+
const answers = await ctx.readFile(join7(target, ANSWERS_FILE));
|
|
8778
|
+
await ctx.stage(write(join7(target, ANSWERS_FILE), answers.replace(/^_src_path: .*$/m, `_src_path: ${localPreset}`)));
|
|
8839
8779
|
await previewCommit(ctx, dir, `plx preview: ${site.rel} reads ${localPreset} from the local checkout`);
|
|
8840
8780
|
await ctx.stage(run(...copierIn(dir, ["update", "--skip-answered", "--trust", "--defaults", "--skip-tasks", "--vcs-ref", "main"]), { cwd: target }));
|
|
8841
8781
|
} else {
|
|
@@ -8863,7 +8803,7 @@ async function updateSite(ctx, consumer, site, dir, take, summary) {
|
|
|
8863
8803
|
let conflict = hasUnmergedEntries(status);
|
|
8864
8804
|
const changed = (await ctx.read("git", ["diff", "--name-only", "--relative", "--", "."], { cwd: target })).split("\n").filter(Boolean);
|
|
8865
8805
|
for (const f of changed) {
|
|
8866
|
-
const text = await ctx.readFile(
|
|
8806
|
+
const text = await ctx.readFile(join7(target, f)).catch(() => "");
|
|
8867
8807
|
if (hasConflictMarkers(text))
|
|
8868
8808
|
conflict = true;
|
|
8869
8809
|
}
|
|
@@ -8883,20 +8823,20 @@ async function updateSite(ctx, consumer, site, dir, take, summary) {
|
|
|
8883
8823
|
await ctx.stage(run("git", ["add", "-A"], { cwd: dir }));
|
|
8884
8824
|
}
|
|
8885
8825
|
async function syncSiteMarker(ctx, site, target) {
|
|
8886
|
-
const marker = await ctx.readFile(
|
|
8826
|
+
const marker = await ctx.readFile(join7(target, MARKER_FILE)).catch(() => void 0);
|
|
8887
8827
|
if (marker === void 0)
|
|
8888
8828
|
return;
|
|
8889
|
-
const { commit } = parseAnswers(await ctx.readFile(
|
|
8829
|
+
const { commit } = parseAnswers(await ctx.readFile(join7(target, ANSWERS_FILE)));
|
|
8890
8830
|
if (!commit)
|
|
8891
8831
|
return;
|
|
8892
8832
|
const synced = syncMarker(marker, commit);
|
|
8893
8833
|
if (synced === marker)
|
|
8894
8834
|
return;
|
|
8895
8835
|
ctx.say(` marker: plexus \u2192 ${commit} in ${site.rel}/${MARKER_FILE}`);
|
|
8896
|
-
await ctx.stage(write(
|
|
8836
|
+
await ctx.stage(write(join7(target, MARKER_FILE), synced));
|
|
8897
8837
|
}
|
|
8898
8838
|
async function refreshLockfile(ctx, consumer, dir, base, summary) {
|
|
8899
|
-
if (await ctx.readFile(
|
|
8839
|
+
if (await ctx.readFile(join7(dir, "pnpm-workspace.yaml")).catch(() => void 0) === void 0)
|
|
8900
8840
|
return;
|
|
8901
8841
|
const manifests = ["*package.json", "pnpm-workspace.yaml"];
|
|
8902
8842
|
const unchanged = await ctx.read("git", ["diff", "--quiet", base, "--", ...manifests], { cwd: dir }).then(() => true).catch(() => false);
|
|
@@ -8911,18 +8851,18 @@ async function refreshLockfile(ctx, consumer, dir, base, summary) {
|
|
|
8911
8851
|
}
|
|
8912
8852
|
}
|
|
8913
8853
|
async function bumpConsumerRefs(ctx, consumer, dir, train) {
|
|
8914
|
-
const workflows =
|
|
8854
|
+
const workflows = join7(dir, ".github", "workflows");
|
|
8915
8855
|
const entries = await ctx.readDir(workflows).catch(() => []);
|
|
8916
8856
|
const files = entries.filter((e) => !e.directory && /\.ya?ml$/.test(e.name)).map((e) => e.name).sort();
|
|
8917
8857
|
for (const f of files) {
|
|
8918
|
-
const text = await ctx.readFile(
|
|
8858
|
+
const text = await ctx.readFile(join7(workflows, f));
|
|
8919
8859
|
if (!text.includes(WORKFLOW_REF))
|
|
8920
8860
|
continue;
|
|
8921
8861
|
const bumped = bumpWorkflowRefs(text, train);
|
|
8922
8862
|
if (bumped === text)
|
|
8923
8863
|
continue;
|
|
8924
8864
|
ctx.say(`\u2192 ${consumer.rel}: ${f} workflow refs \u2192 @${train}`);
|
|
8925
|
-
await ctx.stage(write(
|
|
8865
|
+
await ctx.stage(write(join7(workflows, f), bumped));
|
|
8926
8866
|
}
|
|
8927
8867
|
}
|
|
8928
8868
|
async function openPullUrl(ctx, consumer, dir, train) {
|
|
@@ -9003,7 +8943,7 @@ var detail = (error) => {
|
|
|
9003
8943
|
};
|
|
9004
8944
|
|
|
9005
8945
|
// ../lib/dist/requirements.js
|
|
9006
|
-
import { join as
|
|
8946
|
+
import { join as join8 } from "node:path";
|
|
9007
8947
|
var KEYWORD = /MUST|SHOULD|MAY/;
|
|
9008
8948
|
var hasKeyword = (line) => KEYWORD.test(line.replace(/MUSTs|SHOULDs|MAYs/g, ""));
|
|
9009
8949
|
var list = (value) => value.replace(/^\s*\[/, "").replace(/\].*$/, "").split(",").map((s) => s.trim()).filter(Boolean);
|
|
@@ -9096,7 +9036,7 @@ var MAP_PAGE = "essentials/standard.md";
|
|
|
9096
9036
|
async function modulePages(ctx, compendium) {
|
|
9097
9037
|
const pages = [];
|
|
9098
9038
|
for (const dir of Object.keys(CATALOG_DIRS)) {
|
|
9099
|
-
const entries = await ctx.readDir(
|
|
9039
|
+
const entries = await ctx.readDir(join8(compendium, dir));
|
|
9100
9040
|
for (const e of entries.filter((e2) => !e2.directory && e2.name.endsWith(".md") && e2.name !== "index.md").sort())
|
|
9101
9041
|
pages.push(`${dir}/${e.name}`);
|
|
9102
9042
|
}
|
|
@@ -9104,11 +9044,11 @@ async function modulePages(ctx, compendium) {
|
|
|
9104
9044
|
}
|
|
9105
9045
|
async function checkCompendium(ctx, compendium) {
|
|
9106
9046
|
const defects = [];
|
|
9107
|
-
defects.push(...scanPage(await ctx.readFile(
|
|
9047
|
+
defects.push(...scanPage(await ctx.readFile(join8(compendium, MAP_PAGE)), MAP_PAGE, "map").defects);
|
|
9108
9048
|
const pages = await modulePages(ctx, compendium);
|
|
9109
9049
|
const scans = /* @__PURE__ */ new Map();
|
|
9110
9050
|
for (const page of pages) {
|
|
9111
|
-
const scan = scanPage(await ctx.readFile(
|
|
9051
|
+
const scan = scanPage(await ctx.readFile(join8(compendium, page)), page, "module");
|
|
9112
9052
|
defects.push(...scan.defects);
|
|
9113
9053
|
scans.set(page, scan);
|
|
9114
9054
|
}
|
|
@@ -9167,10 +9107,10 @@ async function preflightSelf(ctx, running) {
|
|
|
9167
9107
|
}
|
|
9168
9108
|
|
|
9169
9109
|
// ../lib/dist/ship.js
|
|
9170
|
-
import { join as
|
|
9110
|
+
import { join as join9 } from "node:path";
|
|
9171
9111
|
var DEFAULT_WAIT = { interval: 15e3, timeout: 20 * 6e4 };
|
|
9172
9112
|
async function ship(ctx, options) {
|
|
9173
|
-
const upstream =
|
|
9113
|
+
const upstream = join9(options.workspace, UPSTREAM);
|
|
9174
9114
|
const propagateOnly = options.propagateOnly ?? false;
|
|
9175
9115
|
if (options.plx)
|
|
9176
9116
|
await preflightSelf(ctx, options.plx);
|
|
@@ -9272,7 +9212,7 @@ async function awaitPublished(ctx, next, wait) {
|
|
|
9272
9212
|
break;
|
|
9273
9213
|
if (Date.now() - started >= wait.timeout)
|
|
9274
9214
|
throw new Error(`${missing.join(", ")} not on npm at ${next} after ${Math.round(wait.timeout / 6e4)} min \u2014 check the release workflow (gh run list -R plexus-ms/${PRIMITIVES})`);
|
|
9275
|
-
await new Promise((
|
|
9215
|
+
await new Promise((resolve10) => setTimeout(resolve10, wait.interval));
|
|
9276
9216
|
}
|
|
9277
9217
|
ctx.say(` \u2713 ${list2} on npm`);
|
|
9278
9218
|
}
|
|
@@ -9281,7 +9221,7 @@ async function planBookkeeping(ctx, train, repos2, next, today2) {
|
|
|
9281
9221
|
const touched = /* @__PURE__ */ new Set();
|
|
9282
9222
|
const repo = (name) => repos2.find((r) => r.name === name);
|
|
9283
9223
|
const edit = async (r, rel, what, transform) => {
|
|
9284
|
-
const path3 =
|
|
9224
|
+
const path3 = join9(r.path, rel);
|
|
9285
9225
|
const text = await ctx.readFile(path3).catch(() => void 0);
|
|
9286
9226
|
if (text === void 0)
|
|
9287
9227
|
return;
|
|
@@ -9296,6 +9236,7 @@ async function planBookkeeping(ctx, train, repos2, next, today2) {
|
|
|
9296
9236
|
const primitives = repo(PRIMITIVES);
|
|
9297
9237
|
if (primitives) {
|
|
9298
9238
|
await edit(primitives, "ansible/galaxy.yml", `version \u2192 ${next}`, (t) => bumpGalaxyVersion(t, next));
|
|
9239
|
+
await edit(primitives, RUNNER_IMAGE_PIN_FILE, `runner image \u2192 ${next}`, (t) => bumpRunnerImagePin(t, next));
|
|
9299
9240
|
for (const p of TRAIN_PACKAGES)
|
|
9300
9241
|
await edit(primitives, `${p.dir}/package.json`, `${p.name} \u2192 ${next}`, (t) => bumpManifestVersion(t, next));
|
|
9301
9242
|
}
|
|
@@ -9316,7 +9257,7 @@ async function planBookkeeping(ctx, train, repos2, next, today2) {
|
|
|
9316
9257
|
if (comp) {
|
|
9317
9258
|
await edit(comp, MAP_PAGE, `version \u2192 ${next}, timestamp \u2192 ${today2}`, (t) => stampStandard(t, next, today2));
|
|
9318
9259
|
for (const page of await modulePages(ctx, comp.path)) {
|
|
9319
|
-
const text = await ctx.readFile(
|
|
9260
|
+
const text = await ctx.readFile(join9(comp.path, page));
|
|
9320
9261
|
if (frontmatterField(text, "maturity") !== "standard")
|
|
9321
9262
|
continue;
|
|
9322
9263
|
const previous = comp.tag ? await ctx.read("git", ["show", `${comp.tag}:${page}`], { cwd: comp.path }).catch(() => "") : "";
|
|
@@ -9335,7 +9276,7 @@ async function planBookkeeping(ctx, train, repos2, next, today2) {
|
|
|
9335
9276
|
}
|
|
9336
9277
|
|
|
9337
9278
|
// ../lib/dist/update.js
|
|
9338
|
-
import { basename, join as
|
|
9279
|
+
import { basename, join as join10 } from "node:path";
|
|
9339
9280
|
var PRESETS = TRAIN_REPOS.filter((r) => r.startsWith("preset-"));
|
|
9340
9281
|
async function update(ctx, options) {
|
|
9341
9282
|
const { repo } = options;
|
|
@@ -9350,14 +9291,14 @@ async function update(ctx, options) {
|
|
|
9350
9291
|
throw new Error(`${name}: ${consumer.skipped}`);
|
|
9351
9292
|
consumer.rel = name;
|
|
9352
9293
|
for (const s of consumer.sites)
|
|
9353
|
-
s.rel = s.rel === "." ? name :
|
|
9294
|
+
s.rel = s.rel === "." ? name : join10(name, s.rel);
|
|
9354
9295
|
const root = consumer.sites.find((s) => s.path === consumer.path);
|
|
9355
9296
|
if (!root)
|
|
9356
9297
|
throw new Error(`${name}: its root is not a site of a repo preset`);
|
|
9357
9298
|
await preflightForge(ctx);
|
|
9358
9299
|
const train = options.train ?? await newestTrain(ctx, root.preset);
|
|
9359
9300
|
const summary = emptySummary(train, ctx.dryRun);
|
|
9360
|
-
const recorded = await Promise.all(consumer.sites.map(async (s) => parseAnswers(await ctx.readFile(
|
|
9301
|
+
const recorded = await Promise.all(consumer.sites.map(async (s) => parseAnswers(await ctx.readFile(join10(s.path, ANSWERS_FILE))).commit));
|
|
9361
9302
|
if (recorded.every((c) => c === train)) {
|
|
9362
9303
|
ctx.say(`\u2022 ${name}: already at ${train}`);
|
|
9363
9304
|
return summary;
|
|
@@ -9375,7 +9316,7 @@ async function update(ctx, options) {
|
|
|
9375
9316
|
return summary;
|
|
9376
9317
|
}
|
|
9377
9318
|
const scratch = (await ctx.stage(run("mktemp", ["-d"])))?.trim() ?? "";
|
|
9378
|
-
const dir =
|
|
9319
|
+
const dir = join10(scratch, name);
|
|
9379
9320
|
try {
|
|
9380
9321
|
ctx.say(`\u2192 ${name}: worktree of origin/${consumer.branch}`);
|
|
9381
9322
|
try {
|
|
@@ -10350,13 +10291,13 @@ import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
|
10350
10291
|
|
|
10351
10292
|
// ../../node_modules/.pnpm/@inquirer+type@4.2.1_@types+node@24.19.2/node_modules/@inquirer/type/dist/utils.js
|
|
10352
10293
|
function withResolver() {
|
|
10353
|
-
let
|
|
10294
|
+
let resolve10;
|
|
10354
10295
|
let reject;
|
|
10355
10296
|
const promise = new Promise((res, rej) => {
|
|
10356
|
-
|
|
10297
|
+
resolve10 = res;
|
|
10357
10298
|
reject = rej;
|
|
10358
10299
|
});
|
|
10359
|
-
return { promise, resolve:
|
|
10300
|
+
return { promise, resolve: resolve10, reject };
|
|
10360
10301
|
}
|
|
10361
10302
|
|
|
10362
10303
|
// ../../node_modules/.pnpm/@inquirer+core@12.0.6_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
@@ -10735,7 +10676,7 @@ function createPrompt(view) {
|
|
|
10735
10676
|
});
|
|
10736
10677
|
output.mute();
|
|
10737
10678
|
const screen = new ScreenManager(rl);
|
|
10738
|
-
const { promise, resolve:
|
|
10679
|
+
const { promise, resolve: resolve10, reject } = withResolver();
|
|
10739
10680
|
return withHooks(rl, (cycle) => {
|
|
10740
10681
|
const clearEffects = AsyncResource3.bind(() => effectScheduler.clearAll());
|
|
10741
10682
|
const settlePrompt = (settle) => {
|
|
@@ -10746,7 +10687,7 @@ function createPrompt(view) {
|
|
|
10746
10687
|
reject(error);
|
|
10747
10688
|
}
|
|
10748
10689
|
};
|
|
10749
|
-
const resolvePrompt = (value) => settlePrompt(() =>
|
|
10690
|
+
const resolvePrompt = (value) => settlePrompt(() => resolve10(value));
|
|
10750
10691
|
const rejectPrompt = (error) => settlePrompt(() => reject(error));
|
|
10751
10692
|
const promptPromise = Object.assign(promise.finally(() => {
|
|
10752
10693
|
cleanups.forEach((cleanup) => cleanup());
|
|
@@ -14265,24 +14206,14 @@ function useColor() {
|
|
|
14265
14206
|
// ../../node_modules/.pnpm/commander@15.0.0/node_modules/commander/index.js
|
|
14266
14207
|
var program = new Command();
|
|
14267
14208
|
|
|
14268
|
-
// src/commands/
|
|
14209
|
+
// src/commands/changeset.ts
|
|
14269
14210
|
import { resolve } from "node:path";
|
|
14270
14211
|
function register(program2) {
|
|
14271
|
-
program2.command("changed-apps").description("list the apps whose sources changed between two refs, dependents of a changed package included").argument("<from>", "the base ref; empty, all zeros or unknown lists every app").argument("[to]", "the ref compared against", "HEAD").option("-C, --dir <dir>", "the checkout to read", ".").action(async (from, to, opts, command) => {
|
|
14272
|
-
const ctx = contextOf2(command);
|
|
14273
|
-
const result = await readChangedApps(ctx, resolve(opts.dir), from, to);
|
|
14274
|
-
ctx.result(result.apps);
|
|
14275
|
-
});
|
|
14276
|
-
}
|
|
14277
|
-
|
|
14278
|
-
// src/commands/changeset.ts
|
|
14279
|
-
import { resolve as resolve2 } from "node:path";
|
|
14280
|
-
function register2(program2) {
|
|
14281
14212
|
program2.command("changeset").description(
|
|
14282
14213
|
"write the changeset a dependency bump owes: a patch per package whose runtime dependencies or shipped source moved"
|
|
14283
14214
|
).argument("[dir]", "a checkout of the package repo, on the bump branch", ".").option("--base <ref>", "the trunk the branch is diffed against, at the merge base", "origin/main").option("--branch <name>", "the branch name that names the file (default: the checked-out branch)").action(async (dir, opts, command) => {
|
|
14284
14215
|
const ctx = contextOf2(command);
|
|
14285
|
-
const changeset = await readChangeset(ctx,
|
|
14216
|
+
const changeset = await readChangeset(ctx, resolve(dir), opts.base, opts.branch);
|
|
14286
14217
|
await ctx.apply(changeset.plan);
|
|
14287
14218
|
ctx.result(changeset, renderChangeset);
|
|
14288
14219
|
});
|
|
@@ -14294,8 +14225,8 @@ function renderChangeset(c) {
|
|
|
14294
14225
|
}
|
|
14295
14226
|
|
|
14296
14227
|
// src/commands/deploy.ts
|
|
14297
|
-
import { resolve as
|
|
14298
|
-
function
|
|
14228
|
+
import { resolve as resolve2 } from "node:path";
|
|
14229
|
+
function register2(program2) {
|
|
14299
14230
|
program2.command("deploy").description(
|
|
14300
14231
|
"render the app\u2019s compose file with the image pinned, stage it on the host, pull, migrate, swap, up, poll readiness, roll back on failure"
|
|
14301
14232
|
).argument("<host>", "ssh target, deploy@host").argument("<tenant>", "tenant slug, the first segment of the app dir on the host").argument("<app>", "the app, apps/<app> in the checkout").option("--image <ref>", "the image ref to pin; absent for a third-party app whose compose.yaml pins its own").option(
|
|
@@ -14319,7 +14250,7 @@ function register3(program2) {
|
|
|
14319
14250
|
environment: opts.environment,
|
|
14320
14251
|
appDir: opts.appDir,
|
|
14321
14252
|
source: opts.source,
|
|
14322
|
-
dir:
|
|
14253
|
+
dir: resolve2(opts.dir)
|
|
14323
14254
|
});
|
|
14324
14255
|
ctx.result(result, renderDeploy);
|
|
14325
14256
|
if (!result.healthy) process.exitCode = 1;
|
|
@@ -14331,13 +14262,24 @@ function renderDeploy(d) {
|
|
|
14331
14262
|
}
|
|
14332
14263
|
|
|
14333
14264
|
// src/commands/deploy-targets.ts
|
|
14334
|
-
import { resolve as
|
|
14335
|
-
function
|
|
14265
|
+
import { resolve as resolve3 } from "node:path";
|
|
14266
|
+
function register3(program2) {
|
|
14336
14267
|
program2.command("deploy-targets").description(
|
|
14337
14268
|
"map each app of a platform repo, per environment, to the deploy target of the inventory file that declares it"
|
|
14338
|
-
).argument("[inventory]", "the inventory directory", "inventory").option("-e, --environment <name>", "one environment only, as a flat app \u2192 target map").
|
|
14269
|
+
).argument("[inventory]", "the inventory directory", "inventory").option("-e, --environment <name>", "one environment only, as a flat app \u2192 target map").option(
|
|
14270
|
+
"--apps <dir>",
|
|
14271
|
+
"with --environment: only the apps with a directory under <dir>, as a list of {app, host} for a matrix"
|
|
14272
|
+
).action(async (inventory, opts, command) => {
|
|
14339
14273
|
const ctx = contextOf2(command);
|
|
14340
|
-
const targets = await readDeployTargets(ctx,
|
|
14274
|
+
const targets = await readDeployTargets(ctx, resolve3(inventory));
|
|
14275
|
+
if (opts.apps !== void 0) {
|
|
14276
|
+
if (!opts.environment) throw new UsageError("--apps needs --environment");
|
|
14277
|
+
const dirs = (await ctx.readDir(resolve3(opts.apps)).catch(() => [])).filter((e) => e.directory).map((e) => e.name);
|
|
14278
|
+
const { legs, without } = deployLegs(targetsIn(targets, opts.environment), dirs);
|
|
14279
|
+
for (const app of without) ctx.say(`${app} has no deployment in ${opts.environment}; nothing to deploy`);
|
|
14280
|
+
ctx.result(legs, (l) => JSON.stringify(l));
|
|
14281
|
+
return;
|
|
14282
|
+
}
|
|
14341
14283
|
const result = opts.environment ? targetsIn(targets, opts.environment) : targets;
|
|
14342
14284
|
ctx.result(result, (t) => JSON.stringify(t));
|
|
14343
14285
|
});
|
|
@@ -14345,7 +14287,7 @@ function register4(program2) {
|
|
|
14345
14287
|
|
|
14346
14288
|
// src/commands/doctor.ts
|
|
14347
14289
|
import { existsSync } from "node:fs";
|
|
14348
|
-
import { join as
|
|
14290
|
+
import { join as join11, resolve as resolve4 } from "node:path";
|
|
14349
14291
|
|
|
14350
14292
|
// src/style.ts
|
|
14351
14293
|
function style(enabled) {
|
|
@@ -14356,15 +14298,15 @@ var colorByDefault = () => process.stdout.isTTY === true && !process.env.NO_COLO
|
|
|
14356
14298
|
|
|
14357
14299
|
// src/commands/doctor.ts
|
|
14358
14300
|
var WORKSPACE_COMPENDIUM = "plexus-ms/compendium";
|
|
14359
|
-
function
|
|
14301
|
+
function register4(program2) {
|
|
14360
14302
|
program2.command("doctor").description("check every PLEXUS.md under a directory for modules that changed since and dependencies not declared").argument("[dir]", "directory to check", ".").option(
|
|
14361
14303
|
"--compendium <path>",
|
|
14362
14304
|
`compendium checkout to read the modules from (default: <dir>/${WORKSPACE_COMPENDIUM})`
|
|
14363
14305
|
).option("--color", "colour the report even when piped").option("--no-color", "never colour the report").action(async (dir, opts, command) => {
|
|
14364
14306
|
const ctx = contextOf2(command);
|
|
14365
|
-
const root =
|
|
14366
|
-
const compendium =
|
|
14367
|
-
if (!existsSync(
|
|
14307
|
+
const root = resolve4(dir);
|
|
14308
|
+
const compendium = resolve4(opts.compendium ?? join11(root, WORKSPACE_COMPENDIUM));
|
|
14309
|
+
if (!existsSync(join11(compendium, "contracts")))
|
|
14368
14310
|
throw new Error(
|
|
14369
14311
|
`no compendium at ${compendium}; pass --compendium <path to a checkout of plexus-ms/compendium>`
|
|
14370
14312
|
);
|
|
@@ -14392,11 +14334,11 @@ function renderReport(report, s, showCurrent) {
|
|
|
14392
14334
|
}
|
|
14393
14335
|
|
|
14394
14336
|
// src/commands/overview.ts
|
|
14395
|
-
import { resolve as
|
|
14396
|
-
function
|
|
14337
|
+
import { resolve as resolve5 } from "node:path";
|
|
14338
|
+
function register5(program2) {
|
|
14397
14339
|
program2.command("overview").description("map the git repos, copier templates and projects, and Plexus units under a directory").argument("[dir]", "directory to map", ".").option("-s, --sync", "fetch every repo first, to show branches behind (or ahead of) their upstream").option("--color", "colour the tree even when piped").option("--no-color", "never colour the tree").action(async (dir, opts, command) => {
|
|
14398
14340
|
const ctx = contextOf2(command);
|
|
14399
|
-
const tree = await overview(ctx,
|
|
14341
|
+
const tree = await overview(ctx, resolve5(dir), { fetch: opts.sync ?? false });
|
|
14400
14342
|
const s = style(opts.color ?? colorByDefault());
|
|
14401
14343
|
ctx.result(tree, (t) => renderTree(t, s, ctx.verbose >= 1));
|
|
14402
14344
|
});
|
|
@@ -14440,16 +14382,16 @@ function annotate(dir, s, modules) {
|
|
|
14440
14382
|
}
|
|
14441
14383
|
|
|
14442
14384
|
// src/commands/propagate.ts
|
|
14443
|
-
import { resolve as
|
|
14385
|
+
import { resolve as resolve7 } from "node:path";
|
|
14444
14386
|
|
|
14445
14387
|
// src/commands/ship.ts
|
|
14446
|
-
import { resolve as
|
|
14447
|
-
function
|
|
14388
|
+
import { resolve as resolve6 } from "node:path";
|
|
14389
|
+
function register6(program2) {
|
|
14448
14390
|
program2.command("ship").description(
|
|
14449
14391
|
"release the train: tag and release every train repo identically, then open a pull request per consumer"
|
|
14450
14392
|
).argument("[dir]", "the workspace: plexus-ms/ and the consumers sit under it", ".").option("--train <version>", "the train version, plain semver (default: minor+1 over the latest train)").action(async (dir, opts, command) => {
|
|
14451
14393
|
const ctx = contextOf2(command);
|
|
14452
|
-
const result = await ship(ctx, { workspace:
|
|
14394
|
+
const result = await ship(ctx, { workspace: resolve6(dir), train: opts.train, plx: version });
|
|
14453
14395
|
ctx.result(result, (r) => renderSummary(r, `plx -y ship --train ${r.train} ${dir}`));
|
|
14454
14396
|
if (!isClean(result)) process.exitCode = 1;
|
|
14455
14397
|
});
|
|
@@ -14473,23 +14415,23 @@ function renderSummary(s, realCommand, verb = "propagate") {
|
|
|
14473
14415
|
}
|
|
14474
14416
|
|
|
14475
14417
|
// src/commands/propagate.ts
|
|
14476
|
-
function
|
|
14418
|
+
function register7(program2) {
|
|
14477
14419
|
program2.command("propagate").description("copier-update every consumer of the presets to the current train, as one pull request per consumer").argument("[dir]", "the workspace: plexus-ms/ and the consumers sit under it", ".").option("--train <version>", "the train to propagate (default: the current one)").action(async (dir, opts, command) => {
|
|
14478
14420
|
const ctx = contextOf2(command);
|
|
14479
|
-
const result = await ship(ctx, { workspace:
|
|
14421
|
+
const result = await ship(ctx, { workspace: resolve7(dir), train: opts.train, propagateOnly: true, plx: version });
|
|
14480
14422
|
ctx.result(result, (r) => renderSummary(r, `plx -y propagate --train ${r.train} ${dir}`));
|
|
14481
14423
|
if (!isClean(result)) process.exitCode = 1;
|
|
14482
14424
|
});
|
|
14483
14425
|
}
|
|
14484
14426
|
|
|
14485
14427
|
// src/commands/requirements.ts
|
|
14486
|
-
import { join as
|
|
14487
|
-
function
|
|
14428
|
+
import { join as join12, resolve as resolve8 } from "node:path";
|
|
14429
|
+
function register8(program2) {
|
|
14488
14430
|
program2.command("requirements").description("lint the standard's map and module pages, or extract one module's requirement lines").argument("[dir]", "a checkout of the compendium", ".").option("--extract <page>", "print a module page's requirement lines instead of linting (path relative to dir)").action(async (dir, opts, command) => {
|
|
14489
14431
|
const ctx = contextOf2(command);
|
|
14490
|
-
const compendium =
|
|
14432
|
+
const compendium = resolve8(dir);
|
|
14491
14433
|
if (opts.extract) {
|
|
14492
|
-
ctx.result(extractRequirements(await ctx.readFile(
|
|
14434
|
+
ctx.result(extractRequirements(await ctx.readFile(join12(compendium, opts.extract))));
|
|
14493
14435
|
return;
|
|
14494
14436
|
}
|
|
14495
14437
|
const check = await checkCompendium(ctx, compendium);
|
|
@@ -14503,13 +14445,13 @@ function renderCheck(c) {
|
|
|
14503
14445
|
}
|
|
14504
14446
|
|
|
14505
14447
|
// src/commands/update.ts
|
|
14506
|
-
import { resolve as
|
|
14507
|
-
function
|
|
14448
|
+
import { resolve as resolve9 } from "node:path";
|
|
14449
|
+
function register9(program2) {
|
|
14508
14450
|
program2.command("update").description(
|
|
14509
14451
|
"bring this repo up to a train, as a pull request on plexus/<version>: copier update at every site, the marker, the lockfile, the workflow refs"
|
|
14510
14452
|
).argument("[dir]", "a repo generated from the presets", ".").option("--train <version>", "the train to take (default: the preset's newest release)").action(async (dir, opts, command) => {
|
|
14511
14453
|
const ctx = contextOf2(command);
|
|
14512
|
-
const result = await update(ctx, { repo:
|
|
14454
|
+
const result = await update(ctx, { repo: resolve9(dir), train: opts.train });
|
|
14513
14455
|
ctx.result(result, (r) => renderSummary(r, `plx -y update --train ${r.train} ${dir}`, "update"));
|
|
14514
14456
|
if (!isClean(result)) process.exitCode = 1;
|
|
14515
14457
|
});
|
|
@@ -14517,16 +14459,15 @@ function register10(program2) {
|
|
|
14517
14459
|
|
|
14518
14460
|
// src/commands/index.ts
|
|
14519
14461
|
var commands = [
|
|
14520
|
-
register6,
|
|
14521
14462
|
register5,
|
|
14463
|
+
register4,
|
|
14464
|
+
register6,
|
|
14522
14465
|
register7,
|
|
14523
|
-
register8,
|
|
14524
|
-
register10,
|
|
14525
14466
|
register9,
|
|
14526
|
-
|
|
14467
|
+
register8,
|
|
14527
14468
|
register,
|
|
14528
|
-
|
|
14529
|
-
|
|
14469
|
+
register3,
|
|
14470
|
+
register2
|
|
14530
14471
|
];
|
|
14531
14472
|
|
|
14532
14473
|
// src/program.ts
|
|
@@ -14536,7 +14477,7 @@ function buildProgram() {
|
|
|
14536
14477
|
program2.addOption(new Option("-n, --dry-run", "print every effect this run would have, perform none").env("PLX_DRY_RUN")).addOption(
|
|
14537
14478
|
new Option("-v, --verbose", "say more: once for reads and inputs, twice for command output").argParser((_value, previous) => previous + 1).default(0)
|
|
14538
14479
|
).addOption(new Option("-q, --quiet", "say nothing but results and errors").env("PLX_QUIET")).addOption(new Option("-y, --yes", "answer every confirmation with yes (needed off a terminal)").env("PLX_YES")).addOption(new Option("--json", "print results as JSON").env("PLX_JSON"));
|
|
14539
|
-
for (const
|
|
14480
|
+
for (const register10 of commands) register10(program2);
|
|
14540
14481
|
return program2;
|
|
14541
14482
|
}
|
|
14542
14483
|
function contextOf2(command) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plexus-ms/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.111.0",
|
|
4
4
|
"description": "plx, the Plexus command-line tool: a single-script adapter over @plexus-ms/lib",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@inquirer/prompts": "^8.7.5",
|
|
27
|
-
"@plexus-ms/lib": "0.
|
|
27
|
+
"@plexus-ms/lib": "0.111.0",
|
|
28
28
|
"commander": "^15.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|