@plexus-ms/cli 0.122.1 → 0.124.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 +1664 -955
- package/package.json +2 -2
package/dist/plx.js
CHANGED
|
@@ -99,13 +99,13 @@ var require_identity = __commonJS({
|
|
|
99
99
|
var require_visit = __commonJS({
|
|
100
100
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/visit.js"(exports) {
|
|
101
101
|
"use strict";
|
|
102
|
-
var
|
|
102
|
+
var identity2 = require_identity();
|
|
103
103
|
var BREAK = /* @__PURE__ */ Symbol("break visit");
|
|
104
104
|
var SKIP = /* @__PURE__ */ Symbol("skip children");
|
|
105
105
|
var REMOVE = /* @__PURE__ */ Symbol("remove node");
|
|
106
106
|
function visit(node, visitor) {
|
|
107
107
|
const visitor_ = initVisitor(visitor);
|
|
108
|
-
if (
|
|
108
|
+
if (identity2.isDocument(node)) {
|
|
109
109
|
const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));
|
|
110
110
|
if (cd === REMOVE)
|
|
111
111
|
node.contents = null;
|
|
@@ -117,12 +117,12 @@ var require_visit = __commonJS({
|
|
|
117
117
|
visit.REMOVE = REMOVE;
|
|
118
118
|
function visit_(key, node, visitor, path3) {
|
|
119
119
|
const ctrl = callVisitor(key, node, visitor, path3);
|
|
120
|
-
if (
|
|
120
|
+
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
121
121
|
replaceNode(key, path3, ctrl);
|
|
122
122
|
return visit_(key, ctrl, visitor, path3);
|
|
123
123
|
}
|
|
124
124
|
if (typeof ctrl !== "symbol") {
|
|
125
|
-
if (
|
|
125
|
+
if (identity2.isCollection(node)) {
|
|
126
126
|
path3 = Object.freeze(path3.concat(node));
|
|
127
127
|
for (let i = 0; i < node.items.length; ++i) {
|
|
128
128
|
const ci = visit_(i, node.items[i], visitor, path3);
|
|
@@ -135,7 +135,7 @@ var require_visit = __commonJS({
|
|
|
135
135
|
i -= 1;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
} else if (
|
|
138
|
+
} else if (identity2.isPair(node)) {
|
|
139
139
|
path3 = Object.freeze(path3.concat(node));
|
|
140
140
|
const ck = visit_("key", node.key, visitor, path3);
|
|
141
141
|
if (ck === BREAK)
|
|
@@ -153,7 +153,7 @@ var require_visit = __commonJS({
|
|
|
153
153
|
}
|
|
154
154
|
async function visitAsync(node, visitor) {
|
|
155
155
|
const visitor_ = initVisitor(visitor);
|
|
156
|
-
if (
|
|
156
|
+
if (identity2.isDocument(node)) {
|
|
157
157
|
const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));
|
|
158
158
|
if (cd === REMOVE)
|
|
159
159
|
node.contents = null;
|
|
@@ -165,12 +165,12 @@ var require_visit = __commonJS({
|
|
|
165
165
|
visitAsync.REMOVE = REMOVE;
|
|
166
166
|
async function visitAsync_(key, node, visitor, path3) {
|
|
167
167
|
const ctrl = await callVisitor(key, node, visitor, path3);
|
|
168
|
-
if (
|
|
168
|
+
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
169
169
|
replaceNode(key, path3, ctrl);
|
|
170
170
|
return visitAsync_(key, ctrl, visitor, path3);
|
|
171
171
|
}
|
|
172
172
|
if (typeof ctrl !== "symbol") {
|
|
173
|
-
if (
|
|
173
|
+
if (identity2.isCollection(node)) {
|
|
174
174
|
path3 = Object.freeze(path3.concat(node));
|
|
175
175
|
for (let i = 0; i < node.items.length; ++i) {
|
|
176
176
|
const ci = await visitAsync_(i, node.items[i], visitor, path3);
|
|
@@ -183,7 +183,7 @@ var require_visit = __commonJS({
|
|
|
183
183
|
i -= 1;
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
} else if (
|
|
186
|
+
} else if (identity2.isPair(node)) {
|
|
187
187
|
path3 = Object.freeze(path3.concat(node));
|
|
188
188
|
const ck = await visitAsync_("key", node.key, visitor, path3);
|
|
189
189
|
if (ck === BREAK)
|
|
@@ -220,31 +220,31 @@ var require_visit = __commonJS({
|
|
|
220
220
|
function callVisitor(key, node, visitor, path3) {
|
|
221
221
|
if (typeof visitor === "function")
|
|
222
222
|
return visitor(key, node, path3);
|
|
223
|
-
if (
|
|
223
|
+
if (identity2.isMap(node))
|
|
224
224
|
return visitor.Map?.(key, node, path3);
|
|
225
|
-
if (
|
|
225
|
+
if (identity2.isSeq(node))
|
|
226
226
|
return visitor.Seq?.(key, node, path3);
|
|
227
|
-
if (
|
|
227
|
+
if (identity2.isPair(node))
|
|
228
228
|
return visitor.Pair?.(key, node, path3);
|
|
229
|
-
if (
|
|
229
|
+
if (identity2.isScalar(node))
|
|
230
230
|
return visitor.Scalar?.(key, node, path3);
|
|
231
|
-
if (
|
|
231
|
+
if (identity2.isAlias(node))
|
|
232
232
|
return visitor.Alias?.(key, node, path3);
|
|
233
233
|
return void 0;
|
|
234
234
|
}
|
|
235
235
|
function replaceNode(key, path3, node) {
|
|
236
236
|
const parent = path3[path3.length - 1];
|
|
237
|
-
if (
|
|
237
|
+
if (identity2.isCollection(parent)) {
|
|
238
238
|
parent.items[key] = node;
|
|
239
|
-
} else if (
|
|
239
|
+
} else if (identity2.isPair(parent)) {
|
|
240
240
|
if (key === "key")
|
|
241
241
|
parent.key = node;
|
|
242
242
|
else
|
|
243
243
|
parent.value = node;
|
|
244
|
-
} else if (
|
|
244
|
+
} else if (identity2.isDocument(parent)) {
|
|
245
245
|
parent.contents = node;
|
|
246
246
|
} else {
|
|
247
|
-
const pt =
|
|
247
|
+
const pt = identity2.isAlias(parent) ? "alias" : "scalar";
|
|
248
248
|
throw new Error(`Cannot replace node with ${pt} parent`);
|
|
249
249
|
}
|
|
250
250
|
}
|
|
@@ -257,7 +257,7 @@ var require_visit = __commonJS({
|
|
|
257
257
|
var require_directives = __commonJS({
|
|
258
258
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/doc/directives.js"(exports) {
|
|
259
259
|
"use strict";
|
|
260
|
-
var
|
|
260
|
+
var identity2 = require_identity();
|
|
261
261
|
var visit = require_visit();
|
|
262
262
|
var escapeChars = {
|
|
263
263
|
"!": "%21",
|
|
@@ -311,26 +311,26 @@ var require_directives = __commonJS({
|
|
|
311
311
|
this.tags = Object.assign({}, _Directives.defaultTags);
|
|
312
312
|
this.atNextDocument = false;
|
|
313
313
|
}
|
|
314
|
-
const
|
|
315
|
-
const name =
|
|
314
|
+
const parts2 = line.trim().split(/[ \t]+/);
|
|
315
|
+
const name = parts2.shift();
|
|
316
316
|
switch (name) {
|
|
317
317
|
case "%TAG": {
|
|
318
|
-
if (
|
|
318
|
+
if (parts2.length !== 2) {
|
|
319
319
|
onError(0, "%TAG directive should contain exactly two parts");
|
|
320
|
-
if (
|
|
320
|
+
if (parts2.length < 2)
|
|
321
321
|
return false;
|
|
322
322
|
}
|
|
323
|
-
const [handle, prefix] =
|
|
323
|
+
const [handle, prefix] = parts2;
|
|
324
324
|
this.tags[handle] = prefix;
|
|
325
325
|
return true;
|
|
326
326
|
}
|
|
327
327
|
case "%YAML": {
|
|
328
328
|
this.yaml.explicit = true;
|
|
329
|
-
if (
|
|
329
|
+
if (parts2.length !== 1) {
|
|
330
330
|
onError(0, "%YAML directive should contain exactly one part");
|
|
331
331
|
return false;
|
|
332
332
|
}
|
|
333
|
-
const [version2] =
|
|
333
|
+
const [version2] = parts2;
|
|
334
334
|
if (version2 === "1.1" || version2 === "1.2") {
|
|
335
335
|
this.yaml.version = version2;
|
|
336
336
|
return true;
|
|
@@ -400,10 +400,10 @@ var require_directives = __commonJS({
|
|
|
400
400
|
const lines = this.yaml.explicit ? [`%YAML ${this.yaml.version || "1.2"}`] : [];
|
|
401
401
|
const tagEntries = Object.entries(this.tags);
|
|
402
402
|
let tagNames;
|
|
403
|
-
if (doc && tagEntries.length > 0 &&
|
|
403
|
+
if (doc && tagEntries.length > 0 && identity2.isNode(doc.contents)) {
|
|
404
404
|
const tags = {};
|
|
405
405
|
visit.visit(doc.contents, (_key, node) => {
|
|
406
|
-
if (
|
|
406
|
+
if (identity2.isNode(node) && node.tag)
|
|
407
407
|
tags[node.tag] = true;
|
|
408
408
|
});
|
|
409
409
|
tagNames = Object.keys(tags);
|
|
@@ -428,7 +428,7 @@ var require_directives = __commonJS({
|
|
|
428
428
|
var require_anchors = __commonJS({
|
|
429
429
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/doc/anchors.js"(exports) {
|
|
430
430
|
"use strict";
|
|
431
|
-
var
|
|
431
|
+
var identity2 = require_identity();
|
|
432
432
|
var visit = require_visit();
|
|
433
433
|
function anchorIsValid(anchor) {
|
|
434
434
|
if (/[\x00-\x19\s,[\]{}]/.test(anchor)) {
|
|
@@ -475,7 +475,7 @@ var require_anchors = __commonJS({
|
|
|
475
475
|
setAnchors: () => {
|
|
476
476
|
for (const source of aliasObjects) {
|
|
477
477
|
const ref = sourceObjects.get(source);
|
|
478
|
-
if (typeof ref === "object" && ref.anchor && (
|
|
478
|
+
if (typeof ref === "object" && ref.anchor && (identity2.isScalar(ref.node) || identity2.isCollection(ref.node))) {
|
|
479
479
|
ref.node.anchor = ref.anchor;
|
|
480
480
|
} else {
|
|
481
481
|
const error = new Error("Failed to resolve repeated object (this should not happen)");
|
|
@@ -548,12 +548,12 @@ var require_applyReviver = __commonJS({
|
|
|
548
548
|
var require_toJS = __commonJS({
|
|
549
549
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/nodes/toJS.js"(exports) {
|
|
550
550
|
"use strict";
|
|
551
|
-
var
|
|
551
|
+
var identity2 = require_identity();
|
|
552
552
|
function toJS(value, arg, ctx) {
|
|
553
553
|
if (Array.isArray(value))
|
|
554
554
|
return value.map((v, i) => toJS(v, String(i), ctx));
|
|
555
555
|
if (value && typeof value.toJSON === "function") {
|
|
556
|
-
if (!ctx || !
|
|
556
|
+
if (!ctx || !identity2.hasAnchor(value))
|
|
557
557
|
return value.toJSON(arg, ctx);
|
|
558
558
|
const data = { aliasCount: 0, count: 1, res: void 0 };
|
|
559
559
|
ctx.anchors.set(value, data);
|
|
@@ -579,11 +579,11 @@ var require_Node = __commonJS({
|
|
|
579
579
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/nodes/Node.js"(exports) {
|
|
580
580
|
"use strict";
|
|
581
581
|
var applyReviver = require_applyReviver();
|
|
582
|
-
var
|
|
582
|
+
var identity2 = require_identity();
|
|
583
583
|
var toJS = require_toJS();
|
|
584
584
|
var NodeBase = class {
|
|
585
585
|
constructor(type) {
|
|
586
|
-
Object.defineProperty(this,
|
|
586
|
+
Object.defineProperty(this, identity2.NODE_TYPE, { value: type });
|
|
587
587
|
}
|
|
588
588
|
/** Create a copy of this node. */
|
|
589
589
|
clone() {
|
|
@@ -594,7 +594,7 @@ var require_Node = __commonJS({
|
|
|
594
594
|
}
|
|
595
595
|
/** A plain JavaScript representation of this node. */
|
|
596
596
|
toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {
|
|
597
|
-
if (!
|
|
597
|
+
if (!identity2.isDocument(doc))
|
|
598
598
|
throw new TypeError("A document argument is required");
|
|
599
599
|
const ctx = {
|
|
600
600
|
anchors: /* @__PURE__ */ new Map(),
|
|
@@ -621,12 +621,12 @@ var require_Alias = __commonJS({
|
|
|
621
621
|
"use strict";
|
|
622
622
|
var anchors = require_anchors();
|
|
623
623
|
var visit = require_visit();
|
|
624
|
-
var
|
|
624
|
+
var identity2 = require_identity();
|
|
625
625
|
var Node = require_Node();
|
|
626
626
|
var toJS = require_toJS();
|
|
627
627
|
var Alias = class extends Node.NodeBase {
|
|
628
628
|
constructor(source) {
|
|
629
|
-
super(
|
|
629
|
+
super(identity2.ALIAS);
|
|
630
630
|
this.source = source;
|
|
631
631
|
Object.defineProperty(this, "tag", {
|
|
632
632
|
set() {
|
|
@@ -648,7 +648,7 @@ var require_Alias = __commonJS({
|
|
|
648
648
|
nodes = [];
|
|
649
649
|
visit.visit(doc, {
|
|
650
650
|
Node: (_key, node) => {
|
|
651
|
-
if (
|
|
651
|
+
if (identity2.isAlias(node) || identity2.hasAnchor(node))
|
|
652
652
|
nodes.push(node);
|
|
653
653
|
}
|
|
654
654
|
});
|
|
@@ -710,11 +710,11 @@ var require_Alias = __commonJS({
|
|
|
710
710
|
}
|
|
711
711
|
};
|
|
712
712
|
function getAliasCount(doc, node, anchors2) {
|
|
713
|
-
if (
|
|
713
|
+
if (identity2.isAlias(node)) {
|
|
714
714
|
const source = node.resolve(doc);
|
|
715
715
|
const anchor = anchors2 && source && anchors2.get(source);
|
|
716
716
|
return anchor ? anchor.count * anchor.aliasCount : 0;
|
|
717
|
-
} else if (
|
|
717
|
+
} else if (identity2.isCollection(node)) {
|
|
718
718
|
let count = 0;
|
|
719
719
|
for (const item of node.items) {
|
|
720
720
|
const c = getAliasCount(doc, item, anchors2);
|
|
@@ -722,7 +722,7 @@ var require_Alias = __commonJS({
|
|
|
722
722
|
count = c;
|
|
723
723
|
}
|
|
724
724
|
return count;
|
|
725
|
-
} else if (
|
|
725
|
+
} else if (identity2.isPair(node)) {
|
|
726
726
|
const kc = getAliasCount(doc, node.key, anchors2);
|
|
727
727
|
const vc = getAliasCount(doc, node.value, anchors2);
|
|
728
728
|
return Math.max(kc, vc);
|
|
@@ -737,13 +737,13 @@ var require_Alias = __commonJS({
|
|
|
737
737
|
var require_Scalar = __commonJS({
|
|
738
738
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/nodes/Scalar.js"(exports) {
|
|
739
739
|
"use strict";
|
|
740
|
-
var
|
|
740
|
+
var identity2 = require_identity();
|
|
741
741
|
var Node = require_Node();
|
|
742
742
|
var toJS = require_toJS();
|
|
743
743
|
var isScalarValue = (value) => !value || typeof value !== "function" && typeof value !== "object";
|
|
744
744
|
var Scalar = class extends Node.NodeBase {
|
|
745
745
|
constructor(value) {
|
|
746
|
-
super(
|
|
746
|
+
super(identity2.SCALAR);
|
|
747
747
|
this.value = value;
|
|
748
748
|
}
|
|
749
749
|
toJSON(arg, ctx) {
|
|
@@ -768,7 +768,7 @@ var require_createNode = __commonJS({
|
|
|
768
768
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/doc/createNode.js"(exports) {
|
|
769
769
|
"use strict";
|
|
770
770
|
var Alias = require_Alias();
|
|
771
|
-
var
|
|
771
|
+
var identity2 = require_identity();
|
|
772
772
|
var Scalar = require_Scalar();
|
|
773
773
|
var defaultTagPrefix = "tag:yaml.org,2002:";
|
|
774
774
|
function findTagObject(value, tagName, tags) {
|
|
@@ -782,12 +782,12 @@ var require_createNode = __commonJS({
|
|
|
782
782
|
return tags.find((t) => t.identify?.(value) && !t.format);
|
|
783
783
|
}
|
|
784
784
|
function createNode(value, tagName, ctx) {
|
|
785
|
-
if (
|
|
785
|
+
if (identity2.isDocument(value))
|
|
786
786
|
value = value.contents;
|
|
787
|
-
if (
|
|
787
|
+
if (identity2.isNode(value))
|
|
788
788
|
return value;
|
|
789
|
-
if (
|
|
790
|
-
const map = ctx.schema[
|
|
789
|
+
if (identity2.isPair(value)) {
|
|
790
|
+
const map = ctx.schema[identity2.MAP].createNode?.(ctx.schema, null, ctx);
|
|
791
791
|
map.items.push(value);
|
|
792
792
|
return map;
|
|
793
793
|
}
|
|
@@ -819,7 +819,7 @@ var require_createNode = __commonJS({
|
|
|
819
819
|
ref.node = node2;
|
|
820
820
|
return node2;
|
|
821
821
|
}
|
|
822
|
-
tagObj = value instanceof Map ? schema[
|
|
822
|
+
tagObj = value instanceof Map ? schema[identity2.MAP] : Symbol.iterator in Object(value) ? schema[identity2.SEQ] : schema[identity2.MAP];
|
|
823
823
|
}
|
|
824
824
|
if (onTagObj) {
|
|
825
825
|
onTagObj(tagObj);
|
|
@@ -843,7 +843,7 @@ var require_Collection = __commonJS({
|
|
|
843
843
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/nodes/Collection.js"(exports) {
|
|
844
844
|
"use strict";
|
|
845
845
|
var createNode = require_createNode();
|
|
846
|
-
var
|
|
846
|
+
var identity2 = require_identity();
|
|
847
847
|
var Node = require_Node();
|
|
848
848
|
function collectionFromPath(schema, path3, value) {
|
|
849
849
|
let v = value;
|
|
@@ -887,7 +887,7 @@ var require_Collection = __commonJS({
|
|
|
887
887
|
const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));
|
|
888
888
|
if (schema)
|
|
889
889
|
copy.schema = schema;
|
|
890
|
-
copy.items = copy.items.map((it) =>
|
|
890
|
+
copy.items = copy.items.map((it) => identity2.isNode(it) || identity2.isPair(it) ? it.clone(schema) : it);
|
|
891
891
|
if (this.range)
|
|
892
892
|
copy.range = this.range.slice();
|
|
893
893
|
return copy;
|
|
@@ -903,7 +903,7 @@ var require_Collection = __commonJS({
|
|
|
903
903
|
else {
|
|
904
904
|
const [key, ...rest] = path3;
|
|
905
905
|
const node = this.get(key, true);
|
|
906
|
-
if (
|
|
906
|
+
if (identity2.isCollection(node))
|
|
907
907
|
node.addIn(rest, value);
|
|
908
908
|
else if (node === void 0 && this.schema)
|
|
909
909
|
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
@@ -920,7 +920,7 @@ var require_Collection = __commonJS({
|
|
|
920
920
|
if (rest.length === 0)
|
|
921
921
|
return this.delete(key);
|
|
922
922
|
const node = this.get(key, true);
|
|
923
|
-
if (
|
|
923
|
+
if (identity2.isCollection(node))
|
|
924
924
|
return node.deleteIn(rest);
|
|
925
925
|
else
|
|
926
926
|
throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);
|
|
@@ -934,16 +934,16 @@ var require_Collection = __commonJS({
|
|
|
934
934
|
const [key, ...rest] = path3;
|
|
935
935
|
const node = this.get(key, true);
|
|
936
936
|
if (rest.length === 0)
|
|
937
|
-
return !keepScalar &&
|
|
937
|
+
return !keepScalar && identity2.isScalar(node) ? node.value : node;
|
|
938
938
|
else
|
|
939
|
-
return
|
|
939
|
+
return identity2.isCollection(node) ? node.getIn(rest, keepScalar) : void 0;
|
|
940
940
|
}
|
|
941
941
|
hasAllNullValues(allowScalar) {
|
|
942
942
|
return this.items.every((node) => {
|
|
943
|
-
if (!
|
|
943
|
+
if (!identity2.isPair(node))
|
|
944
944
|
return false;
|
|
945
945
|
const n = node.value;
|
|
946
|
-
return n == null || allowScalar &&
|
|
946
|
+
return n == null || allowScalar && identity2.isScalar(n) && n.value == null && !n.commentBefore && !n.comment && !n.tag;
|
|
947
947
|
});
|
|
948
948
|
}
|
|
949
949
|
/**
|
|
@@ -954,7 +954,7 @@ var require_Collection = __commonJS({
|
|
|
954
954
|
if (rest.length === 0)
|
|
955
955
|
return this.has(key);
|
|
956
956
|
const node = this.get(key, true);
|
|
957
|
-
return
|
|
957
|
+
return identity2.isCollection(node) ? node.hasIn(rest) : false;
|
|
958
958
|
}
|
|
959
959
|
/**
|
|
960
960
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
@@ -966,7 +966,7 @@ var require_Collection = __commonJS({
|
|
|
966
966
|
this.set(key, value);
|
|
967
967
|
} else {
|
|
968
968
|
const node = this.get(key, true);
|
|
969
|
-
if (
|
|
969
|
+
if (identity2.isCollection(node))
|
|
970
970
|
node.setIn(rest, value);
|
|
971
971
|
else if (node === void 0 && this.schema)
|
|
972
972
|
this.set(key, collectionFromPath(this.schema, rest, value));
|
|
@@ -1422,7 +1422,7 @@ var require_stringify = __commonJS({
|
|
|
1422
1422
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/stringify/stringify.js"(exports) {
|
|
1423
1423
|
"use strict";
|
|
1424
1424
|
var anchors = require_anchors();
|
|
1425
|
-
var
|
|
1425
|
+
var identity2 = require_identity();
|
|
1426
1426
|
var stringifyComment = require_stringifyComment();
|
|
1427
1427
|
var stringifyString = require_stringifyString();
|
|
1428
1428
|
function createStringifyContext(doc, options) {
|
|
@@ -1475,7 +1475,7 @@ var require_stringify = __commonJS({
|
|
|
1475
1475
|
}
|
|
1476
1476
|
let tagObj = void 0;
|
|
1477
1477
|
let obj;
|
|
1478
|
-
if (
|
|
1478
|
+
if (identity2.isScalar(item)) {
|
|
1479
1479
|
obj = item.value;
|
|
1480
1480
|
let match = tags.filter((t) => t.identify?.(obj));
|
|
1481
1481
|
if (match.length > 1) {
|
|
@@ -1498,7 +1498,7 @@ var require_stringify = __commonJS({
|
|
|
1498
1498
|
if (!doc.directives)
|
|
1499
1499
|
return "";
|
|
1500
1500
|
const props = [];
|
|
1501
|
-
const anchor = (
|
|
1501
|
+
const anchor = (identity2.isScalar(node) || identity2.isCollection(node)) && node.anchor;
|
|
1502
1502
|
if (anchor && anchors.anchorIsValid(anchor)) {
|
|
1503
1503
|
anchors$1.add(anchor);
|
|
1504
1504
|
props.push(`&${anchor}`);
|
|
@@ -1509,9 +1509,9 @@ var require_stringify = __commonJS({
|
|
|
1509
1509
|
return props.join(" ");
|
|
1510
1510
|
}
|
|
1511
1511
|
function stringify(item, ctx, onComment, onChompKeep) {
|
|
1512
|
-
if (
|
|
1512
|
+
if (identity2.isPair(item))
|
|
1513
1513
|
return item.toString(ctx, onComment, onChompKeep);
|
|
1514
|
-
if (
|
|
1514
|
+
if (identity2.isAlias(item)) {
|
|
1515
1515
|
if (ctx.doc.directives)
|
|
1516
1516
|
return item.toString(ctx);
|
|
1517
1517
|
if (ctx.resolvedAliases?.has(item)) {
|
|
@@ -1525,15 +1525,15 @@ var require_stringify = __commonJS({
|
|
|
1525
1525
|
}
|
|
1526
1526
|
}
|
|
1527
1527
|
let tagObj = void 0;
|
|
1528
|
-
const node =
|
|
1528
|
+
const node = identity2.isNode(item) ? item : ctx.doc.createNode(item, { onTagObj: (o) => tagObj = o });
|
|
1529
1529
|
tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));
|
|
1530
1530
|
const props = stringifyProps(node, tagObj, ctx);
|
|
1531
1531
|
if (props.length > 0)
|
|
1532
1532
|
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
1533
|
-
const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) :
|
|
1533
|
+
const str = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : identity2.isScalar(node) ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
|
|
1534
1534
|
if (!props)
|
|
1535
1535
|
return str;
|
|
1536
|
-
return
|
|
1536
|
+
return identity2.isScalar(node) || str[0] === "{" || str[0] === "[" ? `${props} ${str}` : `${props}
|
|
1537
1537
|
${ctx.indent}${str}`;
|
|
1538
1538
|
}
|
|
1539
1539
|
exports.createStringifyContext = createStringifyContext;
|
|
@@ -1545,23 +1545,23 @@ ${ctx.indent}${str}`;
|
|
|
1545
1545
|
var require_stringifyPair = __commonJS({
|
|
1546
1546
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyPair.js"(exports) {
|
|
1547
1547
|
"use strict";
|
|
1548
|
-
var
|
|
1548
|
+
var identity2 = require_identity();
|
|
1549
1549
|
var Scalar = require_Scalar();
|
|
1550
1550
|
var stringify = require_stringify();
|
|
1551
1551
|
var stringifyComment = require_stringifyComment();
|
|
1552
1552
|
function stringifyPair({ key, value }, ctx, onComment, onChompKeep) {
|
|
1553
1553
|
const { allNullValues, doc, indent: indent2, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;
|
|
1554
|
-
let keyComment =
|
|
1554
|
+
let keyComment = identity2.isNode(key) && key.comment || null;
|
|
1555
1555
|
if (simpleKeys) {
|
|
1556
1556
|
if (keyComment) {
|
|
1557
1557
|
throw new Error("With simple keys, key nodes cannot have comments");
|
|
1558
1558
|
}
|
|
1559
|
-
if (
|
|
1559
|
+
if (identity2.isCollection(key) || !identity2.isNode(key) && typeof key === "object") {
|
|
1560
1560
|
const msg = "With simple keys, collection cannot be used as a key value";
|
|
1561
1561
|
throw new Error(msg);
|
|
1562
1562
|
}
|
|
1563
1563
|
}
|
|
1564
|
-
let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow ||
|
|
1564
|
+
let explicitKey = !simpleKeys && (!key || keyComment && value == null && !ctx.inFlow || identity2.isCollection(key) || (identity2.isScalar(key) ? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL : typeof key === "object"));
|
|
1565
1565
|
ctx = Object.assign({}, ctx, {
|
|
1566
1566
|
allNullValues: false,
|
|
1567
1567
|
implicitKey: !explicitKey && (simpleKeys || !allNullValues),
|
|
@@ -1602,7 +1602,7 @@ ${indent2}:`;
|
|
|
1602
1602
|
str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));
|
|
1603
1603
|
}
|
|
1604
1604
|
let vsb, vcb, valueComment;
|
|
1605
|
-
if (
|
|
1605
|
+
if (identity2.isNode(value)) {
|
|
1606
1606
|
vsb = !!value.spaceBefore;
|
|
1607
1607
|
vcb = value.commentBefore;
|
|
1608
1608
|
valueComment = value.comment;
|
|
@@ -1614,10 +1614,10 @@ ${indent2}:`;
|
|
|
1614
1614
|
value = doc.createNode(value);
|
|
1615
1615
|
}
|
|
1616
1616
|
ctx.implicitKey = false;
|
|
1617
|
-
if (!explicitKey && !keyComment &&
|
|
1617
|
+
if (!explicitKey && !keyComment && identity2.isScalar(value))
|
|
1618
1618
|
ctx.indentAtStart = str.length + 1;
|
|
1619
1619
|
chompKeep = false;
|
|
1620
|
-
if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey &&
|
|
1620
|
+
if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && identity2.isSeq(value) && !value.flow && !value.tag && !value.anchor) {
|
|
1621
1621
|
ctx.indent = ctx.indent.substring(2);
|
|
1622
1622
|
}
|
|
1623
1623
|
let valueCommentDone = false;
|
|
@@ -1637,7 +1637,7 @@ ${stringifyComment.indentComment(cs, ctx.indent)}`;
|
|
|
1637
1637
|
ws += `
|
|
1638
1638
|
${ctx.indent}`;
|
|
1639
1639
|
}
|
|
1640
|
-
} else if (!explicitKey &&
|
|
1640
|
+
} else if (!explicitKey && identity2.isCollection(value)) {
|
|
1641
1641
|
const vs0 = valueStr[0];
|
|
1642
1642
|
const nl0 = valueStr.indexOf("\n");
|
|
1643
1643
|
const hasNewline = nl0 !== -1;
|
|
@@ -1700,10 +1700,10 @@ var require_log = __commonJS({
|
|
|
1700
1700
|
var require_merge = __commonJS({
|
|
1701
1701
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/merge.js"(exports) {
|
|
1702
1702
|
"use strict";
|
|
1703
|
-
var
|
|
1703
|
+
var identity2 = require_identity();
|
|
1704
1704
|
var Scalar = require_Scalar();
|
|
1705
1705
|
var MERGE_KEY = "<<";
|
|
1706
|
-
var
|
|
1706
|
+
var merge2 = {
|
|
1707
1707
|
identify: (value) => value === MERGE_KEY || typeof value === "symbol" && value.description === MERGE_KEY,
|
|
1708
1708
|
default: "key",
|
|
1709
1709
|
tag: "tag:yaml.org,2002:merge",
|
|
@@ -1713,10 +1713,10 @@ var require_merge = __commonJS({
|
|
|
1713
1713
|
}),
|
|
1714
1714
|
stringify: () => MERGE_KEY
|
|
1715
1715
|
};
|
|
1716
|
-
var isMergeKey = (ctx, key) => (
|
|
1716
|
+
var isMergeKey = (ctx, key) => (merge2.identify(key) || identity2.isScalar(key) && (!key.type || key.type === Scalar.Scalar.PLAIN) && merge2.identify(key.value)) && ctx?.doc.schema.tags.some((tag) => tag.tag === merge2.tag && tag.default);
|
|
1717
1717
|
function addMergeToJSMap(ctx, map, value) {
|
|
1718
1718
|
const source = resolveAliasValue(ctx, value);
|
|
1719
|
-
if (
|
|
1719
|
+
if (identity2.isSeq(source))
|
|
1720
1720
|
for (const it of source.items)
|
|
1721
1721
|
mergeValue(ctx, map, it);
|
|
1722
1722
|
else if (Array.isArray(source))
|
|
@@ -1727,7 +1727,7 @@ var require_merge = __commonJS({
|
|
|
1727
1727
|
}
|
|
1728
1728
|
function mergeValue(ctx, map, value) {
|
|
1729
1729
|
const source = resolveAliasValue(ctx, value);
|
|
1730
|
-
if (!
|
|
1730
|
+
if (!identity2.isMap(source))
|
|
1731
1731
|
throw new Error("Merge sources must be maps or map aliases");
|
|
1732
1732
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
1733
1733
|
for (const [key, value2] of srcMap) {
|
|
@@ -1748,11 +1748,11 @@ var require_merge = __commonJS({
|
|
|
1748
1748
|
return map;
|
|
1749
1749
|
}
|
|
1750
1750
|
function resolveAliasValue(ctx, value) {
|
|
1751
|
-
return ctx &&
|
|
1751
|
+
return ctx && identity2.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
1752
1752
|
}
|
|
1753
1753
|
exports.addMergeToJSMap = addMergeToJSMap;
|
|
1754
1754
|
exports.isMergeKey = isMergeKey;
|
|
1755
|
-
exports.merge =
|
|
1755
|
+
exports.merge = merge2;
|
|
1756
1756
|
}
|
|
1757
1757
|
});
|
|
1758
1758
|
|
|
@@ -1761,15 +1761,15 @@ var require_addPairToJSMap = __commonJS({
|
|
|
1761
1761
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/nodes/addPairToJSMap.js"(exports) {
|
|
1762
1762
|
"use strict";
|
|
1763
1763
|
var log = require_log();
|
|
1764
|
-
var
|
|
1764
|
+
var merge2 = require_merge();
|
|
1765
1765
|
var stringify = require_stringify();
|
|
1766
|
-
var
|
|
1766
|
+
var identity2 = require_identity();
|
|
1767
1767
|
var toJS = require_toJS();
|
|
1768
1768
|
function addPairToJSMap(ctx, map, { key, value }) {
|
|
1769
|
-
if (
|
|
1769
|
+
if (identity2.isNode(key) && key.addToJSMap)
|
|
1770
1770
|
key.addToJSMap(ctx, map, value);
|
|
1771
|
-
else if (
|
|
1772
|
-
|
|
1771
|
+
else if (merge2.isMergeKey(ctx, key))
|
|
1772
|
+
merge2.addMergeToJSMap(ctx, map, value);
|
|
1773
1773
|
else {
|
|
1774
1774
|
const jsKey = toJS.toJS(key, "", ctx);
|
|
1775
1775
|
if (map instanceof Map) {
|
|
@@ -1797,7 +1797,7 @@ var require_addPairToJSMap = __commonJS({
|
|
|
1797
1797
|
return "";
|
|
1798
1798
|
if (typeof jsKey !== "object")
|
|
1799
1799
|
return String(jsKey);
|
|
1800
|
-
if (
|
|
1800
|
+
if (identity2.isNode(key) && ctx?.doc) {
|
|
1801
1801
|
const strCtx = stringify.createStringifyContext(ctx.doc, {});
|
|
1802
1802
|
strCtx.anchors = /* @__PURE__ */ new Set();
|
|
1803
1803
|
for (const node of ctx.anchors.keys())
|
|
@@ -1827,7 +1827,7 @@ var require_Pair = __commonJS({
|
|
|
1827
1827
|
var createNode = require_createNode();
|
|
1828
1828
|
var stringifyPair = require_stringifyPair();
|
|
1829
1829
|
var addPairToJSMap = require_addPairToJSMap();
|
|
1830
|
-
var
|
|
1830
|
+
var identity2 = require_identity();
|
|
1831
1831
|
function createPair(key, value, ctx) {
|
|
1832
1832
|
const k = createNode.createNode(key, void 0, ctx);
|
|
1833
1833
|
const v = createNode.createNode(value, void 0, ctx);
|
|
@@ -1835,15 +1835,15 @@ var require_Pair = __commonJS({
|
|
|
1835
1835
|
}
|
|
1836
1836
|
var Pair = class _Pair {
|
|
1837
1837
|
constructor(key, value = null) {
|
|
1838
|
-
Object.defineProperty(this,
|
|
1838
|
+
Object.defineProperty(this, identity2.NODE_TYPE, { value: identity2.PAIR });
|
|
1839
1839
|
this.key = key;
|
|
1840
1840
|
this.value = value;
|
|
1841
1841
|
}
|
|
1842
1842
|
clone(schema) {
|
|
1843
1843
|
let { key, value } = this;
|
|
1844
|
-
if (
|
|
1844
|
+
if (identity2.isNode(key))
|
|
1845
1845
|
key = key.clone(schema);
|
|
1846
|
-
if (
|
|
1846
|
+
if (identity2.isNode(value))
|
|
1847
1847
|
value = value.clone(schema);
|
|
1848
1848
|
return new _Pair(key, value);
|
|
1849
1849
|
}
|
|
@@ -1864,7 +1864,7 @@ var require_Pair = __commonJS({
|
|
|
1864
1864
|
var require_stringifyCollection = __commonJS({
|
|
1865
1865
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyCollection.js"(exports) {
|
|
1866
1866
|
"use strict";
|
|
1867
|
-
var
|
|
1867
|
+
var identity2 = require_identity();
|
|
1868
1868
|
var stringify = require_stringify();
|
|
1869
1869
|
var stringifyComment = require_stringifyComment();
|
|
1870
1870
|
function stringifyCollection(collection, ctx, options) {
|
|
@@ -1880,14 +1880,14 @@ var require_stringifyCollection = __commonJS({
|
|
|
1880
1880
|
for (let i = 0; i < items.length; ++i) {
|
|
1881
1881
|
const item = items[i];
|
|
1882
1882
|
let comment2 = null;
|
|
1883
|
-
if (
|
|
1883
|
+
if (identity2.isNode(item)) {
|
|
1884
1884
|
if (!chompKeep && item.spaceBefore)
|
|
1885
1885
|
lines.push("");
|
|
1886
1886
|
addCommentBefore(ctx, lines, item.commentBefore, chompKeep);
|
|
1887
1887
|
if (item.comment)
|
|
1888
1888
|
comment2 = item.comment;
|
|
1889
|
-
} else if (
|
|
1890
|
-
const ik =
|
|
1889
|
+
} else if (identity2.isPair(item)) {
|
|
1890
|
+
const ik = identity2.isNode(item.key) ? item.key : null;
|
|
1891
1891
|
if (ik) {
|
|
1892
1892
|
if (!chompKeep && ik.spaceBefore)
|
|
1893
1893
|
lines.push("");
|
|
@@ -1935,14 +1935,14 @@ ${indent2}${line}` : "\n";
|
|
|
1935
1935
|
for (let i = 0; i < items.length; ++i) {
|
|
1936
1936
|
const item = items[i];
|
|
1937
1937
|
let comment = null;
|
|
1938
|
-
if (
|
|
1938
|
+
if (identity2.isNode(item)) {
|
|
1939
1939
|
if (item.spaceBefore)
|
|
1940
1940
|
lines.push("");
|
|
1941
1941
|
addCommentBefore(ctx, lines, item.commentBefore, false);
|
|
1942
1942
|
if (item.comment)
|
|
1943
1943
|
comment = item.comment;
|
|
1944
|
-
} else if (
|
|
1945
|
-
const ik =
|
|
1944
|
+
} else if (identity2.isPair(item)) {
|
|
1945
|
+
const ik = identity2.isNode(item.key) ? item.key : null;
|
|
1946
1946
|
if (ik) {
|
|
1947
1947
|
if (ik.spaceBefore)
|
|
1948
1948
|
lines.push("");
|
|
@@ -1950,7 +1950,7 @@ ${indent2}${line}` : "\n";
|
|
|
1950
1950
|
if (ik.comment)
|
|
1951
1951
|
reqNewline = true;
|
|
1952
1952
|
}
|
|
1953
|
-
const iv =
|
|
1953
|
+
const iv = identity2.isNode(item.value) ? item.value : null;
|
|
1954
1954
|
if (iv) {
|
|
1955
1955
|
if (iv.comment)
|
|
1956
1956
|
comment = iv.comment;
|
|
@@ -2018,16 +2018,16 @@ var require_YAMLMap = __commonJS({
|
|
|
2018
2018
|
var stringifyCollection = require_stringifyCollection();
|
|
2019
2019
|
var addPairToJSMap = require_addPairToJSMap();
|
|
2020
2020
|
var Collection = require_Collection();
|
|
2021
|
-
var
|
|
2021
|
+
var identity2 = require_identity();
|
|
2022
2022
|
var Pair = require_Pair();
|
|
2023
2023
|
var Scalar = require_Scalar();
|
|
2024
2024
|
function findPair(items, key) {
|
|
2025
|
-
const k =
|
|
2025
|
+
const k = identity2.isScalar(key) ? key.value : key;
|
|
2026
2026
|
for (const it of items) {
|
|
2027
|
-
if (
|
|
2027
|
+
if (identity2.isPair(it)) {
|
|
2028
2028
|
if (it.key === key || it.key === k)
|
|
2029
2029
|
return it;
|
|
2030
|
-
if (
|
|
2030
|
+
if (identity2.isScalar(it.key) && it.key.value === k)
|
|
2031
2031
|
return it;
|
|
2032
2032
|
}
|
|
2033
2033
|
}
|
|
@@ -2038,7 +2038,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2038
2038
|
return "tag:yaml.org,2002:map";
|
|
2039
2039
|
}
|
|
2040
2040
|
constructor(schema) {
|
|
2041
|
-
super(
|
|
2041
|
+
super(identity2.MAP, schema);
|
|
2042
2042
|
this.items = [];
|
|
2043
2043
|
}
|
|
2044
2044
|
/**
|
|
@@ -2076,7 +2076,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2076
2076
|
*/
|
|
2077
2077
|
add(pair, overwrite) {
|
|
2078
2078
|
let _pair;
|
|
2079
|
-
if (
|
|
2079
|
+
if (identity2.isPair(pair))
|
|
2080
2080
|
_pair = pair;
|
|
2081
2081
|
else if (!pair || typeof pair !== "object" || !("key" in pair)) {
|
|
2082
2082
|
_pair = new Pair.Pair(pair, pair?.value);
|
|
@@ -2087,7 +2087,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2087
2087
|
if (prev) {
|
|
2088
2088
|
if (!overwrite)
|
|
2089
2089
|
throw new Error(`Key ${_pair.key} already set`);
|
|
2090
|
-
if (
|
|
2090
|
+
if (identity2.isScalar(prev.value) && Scalar.isScalarValue(_pair.value))
|
|
2091
2091
|
prev.value.value = _pair.value;
|
|
2092
2092
|
else
|
|
2093
2093
|
prev.value = _pair.value;
|
|
@@ -2111,7 +2111,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2111
2111
|
get(key, keepScalar) {
|
|
2112
2112
|
const it = findPair(this.items, key);
|
|
2113
2113
|
const node = it?.value;
|
|
2114
|
-
return (!keepScalar &&
|
|
2114
|
+
return (!keepScalar && identity2.isScalar(node) ? node.value : node) ?? void 0;
|
|
2115
2115
|
}
|
|
2116
2116
|
has(key) {
|
|
2117
2117
|
return !!findPair(this.items, key);
|
|
@@ -2136,7 +2136,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2136
2136
|
if (!ctx)
|
|
2137
2137
|
return JSON.stringify(this);
|
|
2138
2138
|
for (const item of this.items) {
|
|
2139
|
-
if (!
|
|
2139
|
+
if (!identity2.isPair(item))
|
|
2140
2140
|
throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);
|
|
2141
2141
|
}
|
|
2142
2142
|
if (!ctx.allNullValues && this.hasAllNullValues(false))
|
|
@@ -2159,7 +2159,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2159
2159
|
var require_map = __commonJS({
|
|
2160
2160
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/schema/common/map.js"(exports) {
|
|
2161
2161
|
"use strict";
|
|
2162
|
-
var
|
|
2162
|
+
var identity2 = require_identity();
|
|
2163
2163
|
var YAMLMap = require_YAMLMap();
|
|
2164
2164
|
var map = {
|
|
2165
2165
|
collection: "map",
|
|
@@ -2167,7 +2167,7 @@ var require_map = __commonJS({
|
|
|
2167
2167
|
nodeClass: YAMLMap.YAMLMap,
|
|
2168
2168
|
tag: "tag:yaml.org,2002:map",
|
|
2169
2169
|
resolve(map2, onError) {
|
|
2170
|
-
if (!
|
|
2170
|
+
if (!identity2.isMap(map2))
|
|
2171
2171
|
onError("Expected a mapping for this tag");
|
|
2172
2172
|
return map2;
|
|
2173
2173
|
},
|
|
@@ -2184,7 +2184,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
2184
2184
|
var createNode = require_createNode();
|
|
2185
2185
|
var stringifyCollection = require_stringifyCollection();
|
|
2186
2186
|
var Collection = require_Collection();
|
|
2187
|
-
var
|
|
2187
|
+
var identity2 = require_identity();
|
|
2188
2188
|
var Scalar = require_Scalar();
|
|
2189
2189
|
var toJS = require_toJS();
|
|
2190
2190
|
var YAMLSeq = class extends Collection.Collection {
|
|
@@ -2192,7 +2192,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
2192
2192
|
return "tag:yaml.org,2002:seq";
|
|
2193
2193
|
}
|
|
2194
2194
|
constructor(schema) {
|
|
2195
|
-
super(
|
|
2195
|
+
super(identity2.SEQ, schema);
|
|
2196
2196
|
this.items = [];
|
|
2197
2197
|
}
|
|
2198
2198
|
add(value) {
|
|
@@ -2218,7 +2218,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
2218
2218
|
if (typeof idx !== "number")
|
|
2219
2219
|
return void 0;
|
|
2220
2220
|
const it = this.items[idx];
|
|
2221
|
-
return !keepScalar &&
|
|
2221
|
+
return !keepScalar && identity2.isScalar(it) ? it.value : it;
|
|
2222
2222
|
}
|
|
2223
2223
|
/**
|
|
2224
2224
|
* Checks if the collection includes a value with the key `key`.
|
|
@@ -2242,7 +2242,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
2242
2242
|
if (typeof idx !== "number")
|
|
2243
2243
|
throw new Error(`Expected a valid index, not ${key}.`);
|
|
2244
2244
|
const prev = this.items[idx];
|
|
2245
|
-
if (
|
|
2245
|
+
if (identity2.isScalar(prev) && Scalar.isScalarValue(value))
|
|
2246
2246
|
prev.value = value;
|
|
2247
2247
|
else
|
|
2248
2248
|
this.items[idx] = value;
|
|
@@ -2284,7 +2284,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
2284
2284
|
}
|
|
2285
2285
|
};
|
|
2286
2286
|
function asItemIndex(key) {
|
|
2287
|
-
let idx =
|
|
2287
|
+
let idx = identity2.isScalar(key) ? key.value : key;
|
|
2288
2288
|
if (idx && typeof idx === "string")
|
|
2289
2289
|
idx = Number(idx);
|
|
2290
2290
|
return typeof idx === "number" && Number.isInteger(idx) && idx >= 0 ? idx : null;
|
|
@@ -2297,7 +2297,7 @@ var require_YAMLSeq = __commonJS({
|
|
|
2297
2297
|
var require_seq = __commonJS({
|
|
2298
2298
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/schema/common/seq.js"(exports) {
|
|
2299
2299
|
"use strict";
|
|
2300
|
-
var
|
|
2300
|
+
var identity2 = require_identity();
|
|
2301
2301
|
var YAMLSeq = require_YAMLSeq();
|
|
2302
2302
|
var seq = {
|
|
2303
2303
|
collection: "seq",
|
|
@@ -2305,7 +2305,7 @@ var require_seq = __commonJS({
|
|
|
2305
2305
|
nodeClass: YAMLSeq.YAMLSeq,
|
|
2306
2306
|
tag: "tag:yaml.org,2002:seq",
|
|
2307
2307
|
resolve(seq2, onError) {
|
|
2308
|
-
if (!
|
|
2308
|
+
if (!identity2.isSeq(seq2))
|
|
2309
2309
|
onError("Expected a sequence for this tag");
|
|
2310
2310
|
return seq2;
|
|
2311
2311
|
},
|
|
@@ -2659,17 +2659,17 @@ var require_binary = __commonJS({
|
|
|
2659
2659
|
var require_pairs = __commonJS({
|
|
2660
2660
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/pairs.js"(exports) {
|
|
2661
2661
|
"use strict";
|
|
2662
|
-
var
|
|
2662
|
+
var identity2 = require_identity();
|
|
2663
2663
|
var Pair = require_Pair();
|
|
2664
2664
|
var Scalar = require_Scalar();
|
|
2665
2665
|
var YAMLSeq = require_YAMLSeq();
|
|
2666
2666
|
function resolvePairs(seq, onError) {
|
|
2667
|
-
if (
|
|
2667
|
+
if (identity2.isSeq(seq)) {
|
|
2668
2668
|
for (let i = 0; i < seq.items.length; ++i) {
|
|
2669
2669
|
let item = seq.items[i];
|
|
2670
|
-
if (
|
|
2670
|
+
if (identity2.isPair(item))
|
|
2671
2671
|
continue;
|
|
2672
|
-
else if (
|
|
2672
|
+
else if (identity2.isMap(item)) {
|
|
2673
2673
|
if (item.items.length > 1)
|
|
2674
2674
|
onError("Each pair must have its own sequence indicator");
|
|
2675
2675
|
const pair = item.items[0] || new Pair.Pair(new Scalar.Scalar(null));
|
|
@@ -2683,7 +2683,7 @@ ${cn.comment}` : item.comment;
|
|
|
2683
2683
|
}
|
|
2684
2684
|
item = pair;
|
|
2685
2685
|
}
|
|
2686
|
-
seq.items[i] =
|
|
2686
|
+
seq.items[i] = identity2.isPair(item) ? item : new Pair.Pair(item);
|
|
2687
2687
|
}
|
|
2688
2688
|
} else
|
|
2689
2689
|
onError("Expected a sequence for this tag");
|
|
@@ -2737,7 +2737,7 @@ ${cn.comment}` : item.comment;
|
|
|
2737
2737
|
var require_omap = __commonJS({
|
|
2738
2738
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/omap.js"(exports) {
|
|
2739
2739
|
"use strict";
|
|
2740
|
-
var
|
|
2740
|
+
var identity2 = require_identity();
|
|
2741
2741
|
var toJS = require_toJS();
|
|
2742
2742
|
var YAMLMap = require_YAMLMap();
|
|
2743
2743
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -2764,7 +2764,7 @@ var require_omap = __commonJS({
|
|
|
2764
2764
|
ctx.onCreate(map);
|
|
2765
2765
|
for (const pair of this.items) {
|
|
2766
2766
|
let key, value;
|
|
2767
|
-
if (
|
|
2767
|
+
if (identity2.isPair(pair)) {
|
|
2768
2768
|
key = toJS.toJS(pair.key, "", ctx);
|
|
2769
2769
|
value = toJS.toJS(pair.value, key, ctx);
|
|
2770
2770
|
} else {
|
|
@@ -2794,7 +2794,7 @@ var require_omap = __commonJS({
|
|
|
2794
2794
|
const pairs$1 = pairs.resolvePairs(seq, onError);
|
|
2795
2795
|
const seenKeys = [];
|
|
2796
2796
|
for (const { key } of pairs$1.items) {
|
|
2797
|
-
if (
|
|
2797
|
+
if (identity2.isScalar(key)) {
|
|
2798
2798
|
if (seenKeys.includes(key.value)) {
|
|
2799
2799
|
onError(`Ordered maps must not include duplicate keys: ${key.value}`);
|
|
2800
2800
|
} else {
|
|
@@ -2975,7 +2975,7 @@ var require_int2 = __commonJS({
|
|
|
2975
2975
|
var require_set = __commonJS({
|
|
2976
2976
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/schema/yaml-1.1/set.js"(exports) {
|
|
2977
2977
|
"use strict";
|
|
2978
|
-
var
|
|
2978
|
+
var identity2 = require_identity();
|
|
2979
2979
|
var Pair = require_Pair();
|
|
2980
2980
|
var YAMLMap = require_YAMLMap();
|
|
2981
2981
|
var YAMLSet = class _YAMLSet extends YAMLMap.YAMLMap {
|
|
@@ -2985,7 +2985,7 @@ var require_set = __commonJS({
|
|
|
2985
2985
|
}
|
|
2986
2986
|
add(key) {
|
|
2987
2987
|
let pair;
|
|
2988
|
-
if (
|
|
2988
|
+
if (identity2.isPair(key))
|
|
2989
2989
|
pair = key;
|
|
2990
2990
|
else if (key && typeof key === "object" && "key" in key && "value" in key && key.value === null)
|
|
2991
2991
|
pair = new Pair.Pair(key.key, null);
|
|
@@ -3001,7 +3001,7 @@ var require_set = __commonJS({
|
|
|
3001
3001
|
*/
|
|
3002
3002
|
get(key, keepPair) {
|
|
3003
3003
|
const pair = YAMLMap.findPair(this.items, key);
|
|
3004
|
-
return !keepPair &&
|
|
3004
|
+
return !keepPair && identity2.isPair(pair) ? identity2.isScalar(pair.key) ? pair.key.value : pair.key : pair;
|
|
3005
3005
|
}
|
|
3006
3006
|
set(key, value) {
|
|
3007
3007
|
if (typeof value !== "boolean")
|
|
@@ -3045,7 +3045,7 @@ var require_set = __commonJS({
|
|
|
3045
3045
|
tag: "tag:yaml.org,2002:set",
|
|
3046
3046
|
createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),
|
|
3047
3047
|
resolve(map, onError) {
|
|
3048
|
-
if (
|
|
3048
|
+
if (identity2.isMap(map)) {
|
|
3049
3049
|
if (map.hasAllNullValues(true))
|
|
3050
3050
|
return Object.assign(new YAMLSet(), map);
|
|
3051
3051
|
else
|
|
@@ -3067,9 +3067,9 @@ var require_timestamp = __commonJS({
|
|
|
3067
3067
|
var stringifyNumber = require_stringifyNumber();
|
|
3068
3068
|
function parseSexagesimal(str, asBigInt) {
|
|
3069
3069
|
const sign = str[0];
|
|
3070
|
-
const
|
|
3070
|
+
const parts2 = sign === "-" || sign === "+" ? str.substring(1) : str;
|
|
3071
3071
|
const num = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
3072
|
-
const res =
|
|
3072
|
+
const res = parts2.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num(60) + num(p), num(0));
|
|
3073
3073
|
return sign === "-" ? num(-1) * res : res;
|
|
3074
3074
|
}
|
|
3075
3075
|
function stringifySexagesimal(node) {
|
|
@@ -3085,18 +3085,18 @@ var require_timestamp = __commonJS({
|
|
|
3085
3085
|
value *= num(-1);
|
|
3086
3086
|
}
|
|
3087
3087
|
const _60 = num(60);
|
|
3088
|
-
const
|
|
3088
|
+
const parts2 = [value % _60];
|
|
3089
3089
|
if (value < 60) {
|
|
3090
|
-
|
|
3090
|
+
parts2.unshift(0);
|
|
3091
3091
|
} else {
|
|
3092
|
-
value = (value -
|
|
3093
|
-
|
|
3092
|
+
value = (value - parts2[0]) / _60;
|
|
3093
|
+
parts2.unshift(value % _60);
|
|
3094
3094
|
if (value >= 60) {
|
|
3095
|
-
value = (value -
|
|
3096
|
-
|
|
3095
|
+
value = (value - parts2[0]) / _60;
|
|
3096
|
+
parts2.unshift(value);
|
|
3097
3097
|
}
|
|
3098
3098
|
}
|
|
3099
|
-
return sign +
|
|
3099
|
+
return sign + parts2.map((n) => String(n).padStart(2, "0")).join(":").replace(/000000\d*$/, "");
|
|
3100
3100
|
}
|
|
3101
3101
|
var intTime = {
|
|
3102
3102
|
identify: (value) => typeof value === "bigint" || Number.isInteger(value),
|
|
@@ -3160,7 +3160,7 @@ var require_schema3 = __commonJS({
|
|
|
3160
3160
|
var bool = require_bool2();
|
|
3161
3161
|
var float = require_float2();
|
|
3162
3162
|
var int = require_int2();
|
|
3163
|
-
var
|
|
3163
|
+
var merge2 = require_merge();
|
|
3164
3164
|
var omap = require_omap();
|
|
3165
3165
|
var pairs = require_pairs();
|
|
3166
3166
|
var set = require_set();
|
|
@@ -3180,7 +3180,7 @@ var require_schema3 = __commonJS({
|
|
|
3180
3180
|
float.floatExp,
|
|
3181
3181
|
float.float,
|
|
3182
3182
|
binary.binary,
|
|
3183
|
-
|
|
3183
|
+
merge2.merge,
|
|
3184
3184
|
omap.omap,
|
|
3185
3185
|
pairs.pairs,
|
|
3186
3186
|
set.set,
|
|
@@ -3206,7 +3206,7 @@ var require_tags = __commonJS({
|
|
|
3206
3206
|
var schema = require_schema();
|
|
3207
3207
|
var schema$1 = require_schema2();
|
|
3208
3208
|
var binary = require_binary();
|
|
3209
|
-
var
|
|
3209
|
+
var merge2 = require_merge();
|
|
3210
3210
|
var omap = require_omap();
|
|
3211
3211
|
var pairs = require_pairs();
|
|
3212
3212
|
var schema$2 = require_schema3();
|
|
@@ -3231,7 +3231,7 @@ var require_tags = __commonJS({
|
|
|
3231
3231
|
intOct: int.intOct,
|
|
3232
3232
|
intTime: timestamp.intTime,
|
|
3233
3233
|
map: map.map,
|
|
3234
|
-
merge:
|
|
3234
|
+
merge: merge2.merge,
|
|
3235
3235
|
null: _null.nullTag,
|
|
3236
3236
|
omap: omap.omap,
|
|
3237
3237
|
pairs: pairs.pairs,
|
|
@@ -3241,7 +3241,7 @@ var require_tags = __commonJS({
|
|
|
3241
3241
|
};
|
|
3242
3242
|
var coreKnownTags = {
|
|
3243
3243
|
"tag:yaml.org,2002:binary": binary.binary,
|
|
3244
|
-
"tag:yaml.org,2002:merge":
|
|
3244
|
+
"tag:yaml.org,2002:merge": merge2.merge,
|
|
3245
3245
|
"tag:yaml.org,2002:omap": omap.omap,
|
|
3246
3246
|
"tag:yaml.org,2002:pairs": pairs.pairs,
|
|
3247
3247
|
"tag:yaml.org,2002:set": set.set,
|
|
@@ -3250,7 +3250,7 @@ var require_tags = __commonJS({
|
|
|
3250
3250
|
function getTags(customTags, schemaName, addMergeTag) {
|
|
3251
3251
|
const schemaTags = schemas.get(schemaName);
|
|
3252
3252
|
if (schemaTags && !customTags) {
|
|
3253
|
-
return addMergeTag && !schemaTags.includes(
|
|
3253
|
+
return addMergeTag && !schemaTags.includes(merge2.merge) ? schemaTags.concat(merge2.merge) : schemaTags.slice();
|
|
3254
3254
|
}
|
|
3255
3255
|
let tags = schemaTags;
|
|
3256
3256
|
if (!tags) {
|
|
@@ -3268,7 +3268,7 @@ var require_tags = __commonJS({
|
|
|
3268
3268
|
tags = customTags(tags.slice());
|
|
3269
3269
|
}
|
|
3270
3270
|
if (addMergeTag)
|
|
3271
|
-
tags = tags.concat(
|
|
3271
|
+
tags = tags.concat(merge2.merge);
|
|
3272
3272
|
return tags.reduce((tags2, tag) => {
|
|
3273
3273
|
const tagObj = typeof tag === "string" ? tagsByName[tag] : tag;
|
|
3274
3274
|
if (!tagObj) {
|
|
@@ -3290,22 +3290,22 @@ var require_tags = __commonJS({
|
|
|
3290
3290
|
var require_Schema = __commonJS({
|
|
3291
3291
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/schema/Schema.js"(exports) {
|
|
3292
3292
|
"use strict";
|
|
3293
|
-
var
|
|
3293
|
+
var identity2 = require_identity();
|
|
3294
3294
|
var map = require_map();
|
|
3295
3295
|
var seq = require_seq();
|
|
3296
3296
|
var string = require_string();
|
|
3297
3297
|
var tags = require_tags();
|
|
3298
3298
|
var sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;
|
|
3299
3299
|
var Schema = class _Schema {
|
|
3300
|
-
constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
|
|
3300
|
+
constructor({ compat, customTags, merge: merge2, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {
|
|
3301
3301
|
this.compat = Array.isArray(compat) ? tags.getTags(compat, "compat") : compat ? tags.getTags(null, compat) : null;
|
|
3302
3302
|
this.name = typeof schema === "string" && schema || "core";
|
|
3303
3303
|
this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};
|
|
3304
|
-
this.tags = tags.getTags(customTags, this.name,
|
|
3304
|
+
this.tags = tags.getTags(customTags, this.name, merge2);
|
|
3305
3305
|
this.toStringOptions = toStringDefaults ?? null;
|
|
3306
|
-
Object.defineProperty(this,
|
|
3307
|
-
Object.defineProperty(this,
|
|
3308
|
-
Object.defineProperty(this,
|
|
3306
|
+
Object.defineProperty(this, identity2.MAP, { value: map.map });
|
|
3307
|
+
Object.defineProperty(this, identity2.SCALAR, { value: string.string });
|
|
3308
|
+
Object.defineProperty(this, identity2.SEQ, { value: seq.seq });
|
|
3309
3309
|
this.sortMapEntries = typeof sortMapEntries === "function" ? sortMapEntries : sortMapEntries === true ? sortMapEntriesByKey : null;
|
|
3310
3310
|
}
|
|
3311
3311
|
clone() {
|
|
@@ -3322,7 +3322,7 @@ var require_Schema = __commonJS({
|
|
|
3322
3322
|
var require_stringifyDocument = __commonJS({
|
|
3323
3323
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/stringify/stringifyDocument.js"(exports) {
|
|
3324
3324
|
"use strict";
|
|
3325
|
-
var
|
|
3325
|
+
var identity2 = require_identity();
|
|
3326
3326
|
var stringify = require_stringify();
|
|
3327
3327
|
var stringifyComment = require_stringifyComment();
|
|
3328
3328
|
function stringifyDocument(doc, options) {
|
|
@@ -3349,7 +3349,7 @@ var require_stringifyDocument = __commonJS({
|
|
|
3349
3349
|
let chompKeep = false;
|
|
3350
3350
|
let contentComment = null;
|
|
3351
3351
|
if (doc.contents) {
|
|
3352
|
-
if (
|
|
3352
|
+
if (identity2.isNode(doc.contents)) {
|
|
3353
3353
|
if (doc.contents.spaceBefore && hasDirectives)
|
|
3354
3354
|
lines.push("");
|
|
3355
3355
|
if (doc.contents.commentBefore) {
|
|
@@ -3404,7 +3404,7 @@ var require_Document = __commonJS({
|
|
|
3404
3404
|
"use strict";
|
|
3405
3405
|
var Alias = require_Alias();
|
|
3406
3406
|
var Collection = require_Collection();
|
|
3407
|
-
var
|
|
3407
|
+
var identity2 = require_identity();
|
|
3408
3408
|
var Pair = require_Pair();
|
|
3409
3409
|
var toJS = require_toJS();
|
|
3410
3410
|
var Schema = require_Schema();
|
|
@@ -3419,7 +3419,7 @@ var require_Document = __commonJS({
|
|
|
3419
3419
|
this.comment = null;
|
|
3420
3420
|
this.errors = [];
|
|
3421
3421
|
this.warnings = [];
|
|
3422
|
-
Object.defineProperty(this,
|
|
3422
|
+
Object.defineProperty(this, identity2.NODE_TYPE, { value: identity2.DOC });
|
|
3423
3423
|
let _replacer = null;
|
|
3424
3424
|
if (typeof replacer === "function" || Array.isArray(replacer)) {
|
|
3425
3425
|
_replacer = replacer;
|
|
@@ -3455,7 +3455,7 @@ var require_Document = __commonJS({
|
|
|
3455
3455
|
*/
|
|
3456
3456
|
clone() {
|
|
3457
3457
|
const copy = Object.create(_Document.prototype, {
|
|
3458
|
-
[
|
|
3458
|
+
[identity2.NODE_TYPE]: { value: identity2.DOC }
|
|
3459
3459
|
});
|
|
3460
3460
|
copy.commentBefore = this.commentBefore;
|
|
3461
3461
|
copy.comment = this.comment;
|
|
@@ -3465,7 +3465,7 @@ var require_Document = __commonJS({
|
|
|
3465
3465
|
if (this.directives)
|
|
3466
3466
|
copy.directives = this.directives.clone();
|
|
3467
3467
|
copy.schema = this.schema.clone();
|
|
3468
|
-
copy.contents =
|
|
3468
|
+
copy.contents = identity2.isNode(this.contents) ? this.contents.clone(copy.schema) : this.contents;
|
|
3469
3469
|
if (this.range)
|
|
3470
3470
|
copy.range = this.range.slice();
|
|
3471
3471
|
return copy;
|
|
@@ -3528,7 +3528,7 @@ var require_Document = __commonJS({
|
|
|
3528
3528
|
sourceObjects
|
|
3529
3529
|
};
|
|
3530
3530
|
const node = createNode.createNode(value, tag, ctx);
|
|
3531
|
-
if (flow &&
|
|
3531
|
+
if (flow && identity2.isCollection(node))
|
|
3532
3532
|
node.flow = true;
|
|
3533
3533
|
setAnchors();
|
|
3534
3534
|
return node;
|
|
@@ -3568,7 +3568,7 @@ var require_Document = __commonJS({
|
|
|
3568
3568
|
* `true` (collections are always returned intact).
|
|
3569
3569
|
*/
|
|
3570
3570
|
get(key, keepScalar) {
|
|
3571
|
-
return
|
|
3571
|
+
return identity2.isCollection(this.contents) ? this.contents.get(key, keepScalar) : void 0;
|
|
3572
3572
|
}
|
|
3573
3573
|
/**
|
|
3574
3574
|
* Returns item at `path`, or `undefined` if not found. By default unwraps
|
|
@@ -3577,14 +3577,14 @@ var require_Document = __commonJS({
|
|
|
3577
3577
|
*/
|
|
3578
3578
|
getIn(path3, keepScalar) {
|
|
3579
3579
|
if (Collection.isEmptyPath(path3))
|
|
3580
|
-
return !keepScalar &&
|
|
3581
|
-
return
|
|
3580
|
+
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3581
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path3, keepScalar) : void 0;
|
|
3582
3582
|
}
|
|
3583
3583
|
/**
|
|
3584
3584
|
* Checks if the document includes a value with the key `key`.
|
|
3585
3585
|
*/
|
|
3586
3586
|
has(key) {
|
|
3587
|
-
return
|
|
3587
|
+
return identity2.isCollection(this.contents) ? this.contents.has(key) : false;
|
|
3588
3588
|
}
|
|
3589
3589
|
/**
|
|
3590
3590
|
* Checks if the document includes a value at `path`.
|
|
@@ -3592,7 +3592,7 @@ var require_Document = __commonJS({
|
|
|
3592
3592
|
hasIn(path3) {
|
|
3593
3593
|
if (Collection.isEmptyPath(path3))
|
|
3594
3594
|
return this.contents !== void 0;
|
|
3595
|
-
return
|
|
3595
|
+
return identity2.isCollection(this.contents) ? this.contents.hasIn(path3) : false;
|
|
3596
3596
|
}
|
|
3597
3597
|
/**
|
|
3598
3598
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3699,7 +3699,7 @@ var require_Document = __commonJS({
|
|
|
3699
3699
|
}
|
|
3700
3700
|
};
|
|
3701
3701
|
function assertCollection(contents) {
|
|
3702
|
-
if (
|
|
3702
|
+
if (identity2.isCollection(contents))
|
|
3703
3703
|
return true;
|
|
3704
3704
|
throw new Error("Expected a YAML collection as document contents");
|
|
3705
3705
|
}
|
|
@@ -3970,12 +3970,12 @@ var require_util_flow_indent_check = __commonJS({
|
|
|
3970
3970
|
var require_util_map_includes = __commonJS({
|
|
3971
3971
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/compose/util-map-includes.js"(exports) {
|
|
3972
3972
|
"use strict";
|
|
3973
|
-
var
|
|
3973
|
+
var identity2 = require_identity();
|
|
3974
3974
|
function mapIncludes(ctx, items, search) {
|
|
3975
3975
|
const { uniqueKeys } = ctx.options;
|
|
3976
3976
|
if (uniqueKeys === false)
|
|
3977
3977
|
return false;
|
|
3978
|
-
const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a, b) => a === b ||
|
|
3978
|
+
const isEqual = typeof uniqueKeys === "function" ? uniqueKeys : (a, b) => a === b || identity2.isScalar(a) && identity2.isScalar(b) && a.value === b.value;
|
|
3979
3979
|
return items.some((pair) => isEqual(pair.key, search));
|
|
3980
3980
|
}
|
|
3981
3981
|
exports.mapIncludes = mapIncludes;
|
|
@@ -4188,7 +4188,7 @@ var require_resolve_end = __commonJS({
|
|
|
4188
4188
|
var require_resolve_flow_collection = __commonJS({
|
|
4189
4189
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/compose/resolve-flow-collection.js"(exports) {
|
|
4190
4190
|
"use strict";
|
|
4191
|
-
var
|
|
4191
|
+
var identity2 = require_identity();
|
|
4192
4192
|
var Pair = require_Pair();
|
|
4193
4193
|
var YAMLMap = require_YAMLMap();
|
|
4194
4194
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -4267,7 +4267,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4267
4267
|
}
|
|
4268
4268
|
if (prevItemComment) {
|
|
4269
4269
|
let prev = coll.items[coll.items.length - 1];
|
|
4270
|
-
if (
|
|
4270
|
+
if (identity2.isPair(prev))
|
|
4271
4271
|
prev = prev.value ?? prev.key;
|
|
4272
4272
|
if (prev.comment)
|
|
4273
4273
|
prev.comment += "\n" + prevItemComment;
|
|
@@ -4382,7 +4382,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4382
4382
|
var require_compose_collection = __commonJS({
|
|
4383
4383
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/compose/compose-collection.js"(exports) {
|
|
4384
4384
|
"use strict";
|
|
4385
|
-
var
|
|
4385
|
+
var identity2 = require_identity();
|
|
4386
4386
|
var Scalar = require_Scalar();
|
|
4387
4387
|
var YAMLMap = require_YAMLMap();
|
|
4388
4388
|
var YAMLSeq = require_YAMLSeq();
|
|
@@ -4432,7 +4432,7 @@ var require_compose_collection = __commonJS({
|
|
|
4432
4432
|
}
|
|
4433
4433
|
const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);
|
|
4434
4434
|
const res = tag.resolve?.(coll, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg), ctx.options) ?? coll;
|
|
4435
|
-
const node =
|
|
4435
|
+
const node = identity2.isNode(res) ? res : new Scalar.Scalar(res);
|
|
4436
4436
|
node.range = coll.range;
|
|
4437
4437
|
node.tag = tagName;
|
|
4438
4438
|
if (tag?.format)
|
|
@@ -4851,7 +4851,7 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
4851
4851
|
var require_compose_scalar = __commonJS({
|
|
4852
4852
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/compose/compose-scalar.js"(exports) {
|
|
4853
4853
|
"use strict";
|
|
4854
|
-
var
|
|
4854
|
+
var identity2 = require_identity();
|
|
4855
4855
|
var Scalar = require_Scalar();
|
|
4856
4856
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
4857
4857
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
@@ -4860,17 +4860,17 @@ var require_compose_scalar = __commonJS({
|
|
|
4860
4860
|
const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null;
|
|
4861
4861
|
let tag;
|
|
4862
4862
|
if (ctx.options.stringKeys && ctx.atKey) {
|
|
4863
|
-
tag = ctx.schema[
|
|
4863
|
+
tag = ctx.schema[identity2.SCALAR];
|
|
4864
4864
|
} else if (tagName)
|
|
4865
4865
|
tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);
|
|
4866
4866
|
else if (token.type === "scalar")
|
|
4867
4867
|
tag = findScalarTagByTest(ctx, value, token, onError);
|
|
4868
4868
|
else
|
|
4869
|
-
tag = ctx.schema[
|
|
4869
|
+
tag = ctx.schema[identity2.SCALAR];
|
|
4870
4870
|
let scalar;
|
|
4871
4871
|
try {
|
|
4872
4872
|
const res = tag.resolve(value, (msg) => onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg), ctx.options);
|
|
4873
|
-
scalar =
|
|
4873
|
+
scalar = identity2.isScalar(res) ? res : new Scalar.Scalar(res);
|
|
4874
4874
|
} catch (error) {
|
|
4875
4875
|
const msg = error instanceof Error ? error.message : String(error);
|
|
4876
4876
|
onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg);
|
|
@@ -4890,7 +4890,7 @@ var require_compose_scalar = __commonJS({
|
|
|
4890
4890
|
}
|
|
4891
4891
|
function findScalarTagByName(schema, value, tagName, tagToken, onError) {
|
|
4892
4892
|
if (tagName === "!")
|
|
4893
|
-
return schema[
|
|
4893
|
+
return schema[identity2.SCALAR];
|
|
4894
4894
|
const matchWithTest = [];
|
|
4895
4895
|
for (const tag of schema.tags) {
|
|
4896
4896
|
if (!tag.collection && tag.tag === tagName) {
|
|
@@ -4909,12 +4909,12 @@ var require_compose_scalar = __commonJS({
|
|
|
4909
4909
|
return kt;
|
|
4910
4910
|
}
|
|
4911
4911
|
onError(tagToken, "TAG_RESOLVE_FAILED", `Unresolved tag: ${tagName}`, tagName !== "tag:yaml.org,2002:str");
|
|
4912
|
-
return schema[
|
|
4912
|
+
return schema[identity2.SCALAR];
|
|
4913
4913
|
}
|
|
4914
4914
|
function findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {
|
|
4915
|
-
const tag = schema.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema[
|
|
4915
|
+
const tag = schema.tags.find((tag2) => (tag2.default === true || atKey && tag2.default === "key") && tag2.test?.test(value)) || schema[identity2.SCALAR];
|
|
4916
4916
|
if (schema.compat) {
|
|
4917
|
-
const compat = schema.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema[
|
|
4917
|
+
const compat = schema.compat.find((tag2) => tag2.default && tag2.test?.test(value)) ?? schema[identity2.SCALAR];
|
|
4918
4918
|
if (tag.tag !== compat.tag) {
|
|
4919
4919
|
const ts = directives.tagString(tag.tag);
|
|
4920
4920
|
const cs = directives.tagString(compat.tag);
|
|
@@ -4963,7 +4963,7 @@ var require_compose_node = __commonJS({
|
|
|
4963
4963
|
"../../node_modules/.pnpm/yaml@2.9.1/node_modules/yaml/dist/compose/compose-node.js"(exports) {
|
|
4964
4964
|
"use strict";
|
|
4965
4965
|
var Alias = require_Alias();
|
|
4966
|
-
var
|
|
4966
|
+
var identity2 = require_identity();
|
|
4967
4967
|
var composeCollection = require_compose_collection();
|
|
4968
4968
|
var composeScalar = require_compose_scalar();
|
|
4969
4969
|
var resolveEnd = require_resolve_end();
|
|
@@ -5009,7 +5009,7 @@ var require_compose_node = __commonJS({
|
|
|
5009
5009
|
node ?? (node = composeEmptyNode(ctx, token.offset, void 0, null, props, onError));
|
|
5010
5010
|
if (anchor && node.anchor === "")
|
|
5011
5011
|
onError(anchor, "BAD_ALIAS", "Anchor cannot be an empty string");
|
|
5012
|
-
if (atKey && ctx.options.stringKeys && (!
|
|
5012
|
+
if (atKey && ctx.options.stringKeys && (!identity2.isScalar(node) || typeof node.value !== "string" || node.tag && node.tag !== "tag:yaml.org,2002:str")) {
|
|
5013
5013
|
const msg = "With stringKeys, all keys must be strings";
|
|
5014
5014
|
onError(tag ?? token, "NON_STRING_KEY", msg);
|
|
5015
5015
|
}
|
|
@@ -5115,7 +5115,7 @@ var require_composer = __commonJS({
|
|
|
5115
5115
|
var directives = require_directives();
|
|
5116
5116
|
var Document = require_Document();
|
|
5117
5117
|
var errors = require_errors();
|
|
5118
|
-
var
|
|
5118
|
+
var identity2 = require_identity();
|
|
5119
5119
|
var composeDoc = require_compose_doc();
|
|
5120
5120
|
var resolveEnd = require_resolve_end();
|
|
5121
5121
|
function getErrorPos(src) {
|
|
@@ -5177,9 +5177,9 @@ var require_composer = __commonJS({
|
|
|
5177
5177
|
${comment}` : comment;
|
|
5178
5178
|
} else if (afterEmptyLine || doc.directives.docStart || !dc) {
|
|
5179
5179
|
doc.commentBefore = comment;
|
|
5180
|
-
} else if (
|
|
5180
|
+
} else if (identity2.isCollection(dc) && !dc.flow && dc.items.length > 0) {
|
|
5181
5181
|
let it = dc.items[0];
|
|
5182
|
-
if (
|
|
5182
|
+
if (identity2.isPair(it))
|
|
5183
5183
|
it = it.key;
|
|
5184
5184
|
const cb = it.commentBefore;
|
|
5185
5185
|
it.commentBefore = cb ? `${comment}
|
|
@@ -7227,7 +7227,7 @@ var require_public_api = __commonJS({
|
|
|
7227
7227
|
var Document = require_Document();
|
|
7228
7228
|
var errors = require_errors();
|
|
7229
7229
|
var log = require_log();
|
|
7230
|
-
var
|
|
7230
|
+
var identity2 = require_identity();
|
|
7231
7231
|
var lineCounter = require_line_counter();
|
|
7232
7232
|
var parser = require_parser();
|
|
7233
7233
|
function parseOptions(options) {
|
|
@@ -7268,7 +7268,7 @@ var require_public_api = __commonJS({
|
|
|
7268
7268
|
}
|
|
7269
7269
|
return doc;
|
|
7270
7270
|
}
|
|
7271
|
-
function
|
|
7271
|
+
function parse6(src, reviver, options) {
|
|
7272
7272
|
let _reviver = void 0;
|
|
7273
7273
|
if (typeof reviver === "function") {
|
|
7274
7274
|
_reviver = reviver;
|
|
@@ -7305,11 +7305,11 @@ var require_public_api = __commonJS({
|
|
|
7305
7305
|
if (!keepUndefined)
|
|
7306
7306
|
return void 0;
|
|
7307
7307
|
}
|
|
7308
|
-
if (
|
|
7308
|
+
if (identity2.isDocument(value) && !_replacer)
|
|
7309
7309
|
return value.toString(options);
|
|
7310
7310
|
return new Document.Document(value, _replacer, options).toString(options);
|
|
7311
7311
|
}
|
|
7312
|
-
exports.parse =
|
|
7312
|
+
exports.parse = parse6;
|
|
7313
7313
|
exports.parseAllDocuments = parseAllDocuments;
|
|
7314
7314
|
exports.parseDocument = parseDocument;
|
|
7315
7315
|
exports.stringify = stringify;
|
|
@@ -7325,7 +7325,7 @@ var require_dist = __commonJS({
|
|
|
7325
7325
|
var Schema = require_Schema();
|
|
7326
7326
|
var errors = require_errors();
|
|
7327
7327
|
var Alias = require_Alias();
|
|
7328
|
-
var
|
|
7328
|
+
var identity2 = require_identity();
|
|
7329
7329
|
var Pair = require_Pair();
|
|
7330
7330
|
var Scalar = require_Scalar();
|
|
7331
7331
|
var YAMLMap = require_YAMLMap();
|
|
@@ -7343,14 +7343,14 @@ var require_dist = __commonJS({
|
|
|
7343
7343
|
exports.YAMLParseError = errors.YAMLParseError;
|
|
7344
7344
|
exports.YAMLWarning = errors.YAMLWarning;
|
|
7345
7345
|
exports.Alias = Alias.Alias;
|
|
7346
|
-
exports.isAlias =
|
|
7347
|
-
exports.isCollection =
|
|
7348
|
-
exports.isDocument =
|
|
7349
|
-
exports.isMap =
|
|
7350
|
-
exports.isNode =
|
|
7351
|
-
exports.isPair =
|
|
7352
|
-
exports.isScalar =
|
|
7353
|
-
exports.isSeq =
|
|
7346
|
+
exports.isAlias = identity2.isAlias;
|
|
7347
|
+
exports.isCollection = identity2.isCollection;
|
|
7348
|
+
exports.isDocument = identity2.isDocument;
|
|
7349
|
+
exports.isMap = identity2.isMap;
|
|
7350
|
+
exports.isNode = identity2.isNode;
|
|
7351
|
+
exports.isPair = identity2.isPair;
|
|
7352
|
+
exports.isScalar = identity2.isScalar;
|
|
7353
|
+
exports.isSeq = identity2.isSeq;
|
|
7354
7354
|
exports.Pair = Pair.Pair;
|
|
7355
7355
|
exports.Scalar = Scalar.Scalar;
|
|
7356
7356
|
exports.YAMLMap = YAMLMap.YAMLMap;
|
|
@@ -7611,14 +7611,14 @@ var NAME_CITATION = new RegExp(`(?<![\\w/-])${NAME_LIKE}(?![\\w/])`, "g");
|
|
|
7611
7611
|
var sectionKey = (n, code) => `\xA7 ${n} ${code}`;
|
|
7612
7612
|
var numbersOf = (list2) => list2.match(new RegExp(NUMBER, "g")) ?? [];
|
|
7613
7613
|
function lintCitations(text, file, citable, own) {
|
|
7614
|
-
const
|
|
7614
|
+
const codes = new Set([...citable].filter((c) => c.startsWith("\xA7 ")).map((c) => c.replace(/^§ \S+ /, "")));
|
|
7615
7615
|
const out = [];
|
|
7616
7616
|
const sections = (list2, code, line) => {
|
|
7617
7617
|
for (const n of numbersOf(list2)) {
|
|
7618
7618
|
const excerpt = sectionKey(n, code);
|
|
7619
7619
|
if (citable.has(excerpt))
|
|
7620
7620
|
continue;
|
|
7621
|
-
const message =
|
|
7621
|
+
const message = codes.has(code) ? `${excerpt} cites a section that does not exist` : `${excerpt} cites ${code}, which is no module`;
|
|
7622
7622
|
out.push({ lint: "citations", file, line, excerpt, message });
|
|
7623
7623
|
}
|
|
7624
7624
|
};
|
|
@@ -7793,102 +7793,15 @@ function compareBaseline(violations, baseline) {
|
|
|
7793
7793
|
return { fresh, stale: stale.sort(), known };
|
|
7794
7794
|
}
|
|
7795
7795
|
|
|
7796
|
-
// ../lib/dist/frontmatter.js
|
|
7797
|
-
function frontmatterLines(lines) {
|
|
7798
|
-
if (lines[0] !== "---")
|
|
7799
|
-
return void 0;
|
|
7800
|
-
const end = lines.findIndex((l, i) => i > 0 && l === "---");
|
|
7801
|
-
return end === -1 ? void 0 : { start: 1, end };
|
|
7802
|
-
}
|
|
7803
|
-
function setFrontmatterField(text, key, value, options = {}) {
|
|
7804
|
-
const lines = text.split("\n");
|
|
7805
|
-
const fm = frontmatterLines(lines);
|
|
7806
|
-
if (!fm)
|
|
7807
|
-
throw new Error("no frontmatter: expected a `---` block at the top");
|
|
7808
|
-
const line = `${key}: ${value}`;
|
|
7809
|
-
const isKey = (l) => l.startsWith(`${key}:`);
|
|
7810
|
-
const existing = lines.findIndex((l, i) => i >= fm.start && i < fm.end && isKey(l));
|
|
7811
|
-
if (existing !== -1) {
|
|
7812
|
-
lines[existing] = line;
|
|
7813
|
-
} else {
|
|
7814
|
-
const anchor = options.after ? lines.findIndex((l, i) => i >= fm.start && i < fm.end && l.startsWith(`${options.after}:`)) : -1;
|
|
7815
|
-
lines.splice(anchor === -1 ? fm.end : anchor + 1, 0, line);
|
|
7816
|
-
}
|
|
7817
|
-
return lines.join("\n");
|
|
7818
|
-
}
|
|
7819
|
-
|
|
7820
7796
|
// ../lib/dist/bookkeeping.js
|
|
7821
7797
|
var WORKFLOW_REF = "plexus-ms/tooling/.github/workflows/";
|
|
7822
7798
|
var bumpWorkflowRefs = (text, version2) => text.replace(/(plexus-ms\/tooling\/\.github\/workflows\/[A-Za-z0-9._-]+)@v?[0-9.]+/g, `$1@${version2}`);
|
|
7823
7799
|
var hasConflictMarkers = (text) => /^<<<<<<< /m.test(text);
|
|
7824
7800
|
var hasUnmergedEntries = (porcelain) => /^(UU|AA|DU|UD)/m.test(porcelain);
|
|
7825
|
-
function syncMarker(marker, commit) {
|
|
7826
|
-
if (hasConflictMarkers(marker))
|
|
7827
|
-
return marker;
|
|
7828
|
-
return setFrontmatterField(marker, "plexus", commit);
|
|
7829
|
-
}
|
|
7830
|
-
|
|
7831
|
-
// ../lib/dist/catalog.js
|
|
7832
|
-
import { join } from "node:path";
|
|
7833
|
-
|
|
7834
|
-
// ../lib/dist/marker.js
|
|
7835
|
-
var import_yaml = __toESM(require_dist(), 1);
|
|
7836
|
-
var MARKER_FILE = "PLEXUS.md";
|
|
7837
|
-
function parseMarker(text) {
|
|
7838
|
-
const { data, body: body2 } = splitFrontmatter(text);
|
|
7839
|
-
const plexus = data.plexus;
|
|
7840
|
-
const modules = data.modules;
|
|
7841
|
-
if (typeof plexus !== "string" && typeof plexus !== "number")
|
|
7842
|
-
throw new Error("marker: `plexus` must be a version");
|
|
7843
|
-
if (!Array.isArray(modules) || !modules.every((m) => typeof m === "string"))
|
|
7844
|
-
throw new Error("marker: `modules` must be a list of module codes");
|
|
7845
|
-
return { plexus: String(plexus), modules, body: body2 };
|
|
7846
|
-
}
|
|
7847
|
-
function splitFrontmatter(text) {
|
|
7848
|
-
const match = /^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)([\s\S]*)$/.exec(text);
|
|
7849
|
-
if (!match)
|
|
7850
|
-
throw new Error("no frontmatter: expected a `---` block at the top");
|
|
7851
|
-
const data = (0, import_yaml.parse)(match[1] ?? "");
|
|
7852
|
-
if (data === null || typeof data !== "object" || Array.isArray(data))
|
|
7853
|
-
throw new Error("frontmatter is not a mapping");
|
|
7854
|
-
return { data, body: match[2] ?? "" };
|
|
7855
|
-
}
|
|
7856
|
-
|
|
7857
|
-
// ../lib/dist/catalog.js
|
|
7858
|
-
var CATALOG_DIRS = { contracts: "contract", approaches: "approach" };
|
|
7859
|
-
function parseModule(text, kind) {
|
|
7860
|
-
const { data } = splitFrontmatter(text);
|
|
7861
|
-
if (typeof data.code !== "string")
|
|
7862
|
-
return void 0;
|
|
7863
|
-
return {
|
|
7864
|
-
code: data.code,
|
|
7865
|
-
kind,
|
|
7866
|
-
maturity: String(data.maturity ?? ""),
|
|
7867
|
-
binds: String(data.binds ?? ""),
|
|
7868
|
-
changed: data.changed === void 0 ? void 0 : String(data.changed),
|
|
7869
|
-
depends: codes(data.depends),
|
|
7870
|
-
consumes: codes(data.consumes)
|
|
7871
|
-
};
|
|
7872
|
-
}
|
|
7873
|
-
function codes(value) {
|
|
7874
|
-
return Array.isArray(value) ? value.map(String) : [];
|
|
7875
|
-
}
|
|
7876
|
-
async function readCatalog(ctx, compendium) {
|
|
7877
|
-
const catalog = /* @__PURE__ */ new Map();
|
|
7878
|
-
for (const [dir, kind] of Object.entries(CATALOG_DIRS)) {
|
|
7879
|
-
const entries = await ctx.readDir(join(compendium, dir));
|
|
7880
|
-
for (const e of entries.filter((e2) => !e2.directory && e2.name.endsWith(".md") && e2.name !== "index.md").sort()) {
|
|
7881
|
-
const module = parseModule(await ctx.readFile(join(compendium, dir, e.name)), kind);
|
|
7882
|
-
if (module)
|
|
7883
|
-
catalog.set(module.code, module);
|
|
7884
|
-
}
|
|
7885
|
-
}
|
|
7886
|
-
return catalog;
|
|
7887
|
-
}
|
|
7888
7801
|
|
|
7889
7802
|
// ../lib/dist/changeset.js
|
|
7890
|
-
var
|
|
7891
|
-
import { dirname, join
|
|
7803
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
7804
|
+
import { dirname, join } from "node:path";
|
|
7892
7805
|
|
|
7893
7806
|
// ../lib/dist/io.js
|
|
7894
7807
|
import { spawn } from "node:child_process";
|
|
@@ -7905,6 +7818,43 @@ ${stderr.trimEnd()}` : ""}`);
|
|
|
7905
7818
|
this.stderr = stderr;
|
|
7906
7819
|
}
|
|
7907
7820
|
};
|
|
7821
|
+
var TimeoutError = class extends ExecError {
|
|
7822
|
+
limit;
|
|
7823
|
+
constructor(command, limit, stderr) {
|
|
7824
|
+
super(command, null, stderr);
|
|
7825
|
+
this.message = `${command} did not finish within ${limit} ms and was killed${stderr ? `
|
|
7826
|
+
${stderr.trimEnd()}` : ""}`;
|
|
7827
|
+
this.limit = limit;
|
|
7828
|
+
}
|
|
7829
|
+
};
|
|
7830
|
+
var GRACE = 5e3;
|
|
7831
|
+
var SIGNALS = ["SIGINT", "SIGTERM"];
|
|
7832
|
+
var cleanups = [];
|
|
7833
|
+
function interrupted(signal) {
|
|
7834
|
+
for (const cleanup of cleanups.splice(0).reverse()) {
|
|
7835
|
+
try {
|
|
7836
|
+
cleanup();
|
|
7837
|
+
} catch {
|
|
7838
|
+
}
|
|
7839
|
+
}
|
|
7840
|
+
for (const s of SIGNALS)
|
|
7841
|
+
process.removeListener(s, interrupted);
|
|
7842
|
+
process.kill(process.pid, signal);
|
|
7843
|
+
}
|
|
7844
|
+
function onInterrupt(cleanup) {
|
|
7845
|
+
if (cleanups.length === 0)
|
|
7846
|
+
for (const s of SIGNALS)
|
|
7847
|
+
process.on(s, interrupted);
|
|
7848
|
+
cleanups.push(cleanup);
|
|
7849
|
+
return () => {
|
|
7850
|
+
const at = cleanups.indexOf(cleanup);
|
|
7851
|
+
if (at >= 0)
|
|
7852
|
+
cleanups.splice(at, 1);
|
|
7853
|
+
if (cleanups.length === 0)
|
|
7854
|
+
for (const s of SIGNALS)
|
|
7855
|
+
process.removeListener(s, interrupted);
|
|
7856
|
+
};
|
|
7857
|
+
}
|
|
7908
7858
|
async function orAbsent(read, absent = () => true) {
|
|
7909
7859
|
try {
|
|
7910
7860
|
return await read;
|
|
@@ -7920,10 +7870,12 @@ function realIo(prompt) {
|
|
|
7920
7870
|
stdout: process.stdout,
|
|
7921
7871
|
stderr: process.stderr,
|
|
7922
7872
|
prompt: prompt && isInteractive() ? prompt : void 0,
|
|
7923
|
-
exec: (command, args, options = {}) => new Promise((
|
|
7873
|
+
exec: (command, args, options = {}) => new Promise((resolve10, reject) => {
|
|
7874
|
+
const limit = options.timeout;
|
|
7924
7875
|
const child = spawn(command, args, {
|
|
7925
7876
|
cwd: options.cwd,
|
|
7926
7877
|
env: options.env,
|
|
7878
|
+
detached: limit !== void 0,
|
|
7927
7879
|
stdio: [
|
|
7928
7880
|
options.input !== void 0 ? "pipe" : options.inherit ? "inherit" : "ignore",
|
|
7929
7881
|
options.inherit ? process.stderr.fd : "pipe",
|
|
@@ -7934,16 +7886,42 @@ function realIo(prompt) {
|
|
|
7934
7886
|
let stderr = "";
|
|
7935
7887
|
child.stdout?.on("data", (chunk) => {
|
|
7936
7888
|
stdout += chunk;
|
|
7889
|
+
if (options.echo)
|
|
7890
|
+
process.stderr.write(chunk);
|
|
7937
7891
|
});
|
|
7938
7892
|
child.stderr?.on("data", (chunk) => {
|
|
7939
7893
|
stderr += chunk;
|
|
7940
|
-
if (options.inherit)
|
|
7894
|
+
if (options.inherit || options.echo)
|
|
7941
7895
|
process.stderr.write(chunk);
|
|
7942
7896
|
});
|
|
7943
|
-
|
|
7897
|
+
let timedOut = false;
|
|
7898
|
+
const group = (signal) => () => {
|
|
7899
|
+
try {
|
|
7900
|
+
if (child.pid !== void 0)
|
|
7901
|
+
process.kill(-child.pid, signal);
|
|
7902
|
+
} catch {
|
|
7903
|
+
}
|
|
7904
|
+
};
|
|
7905
|
+
const timer = limit === void 0 ? void 0 : setTimeout(() => {
|
|
7906
|
+
timedOut = true;
|
|
7907
|
+
group("SIGTERM")();
|
|
7908
|
+
setTimeout(group("SIGKILL"), GRACE).unref();
|
|
7909
|
+
}, limit);
|
|
7910
|
+
const release = limit === void 0 ? void 0 : onInterrupt(group("SIGKILL"));
|
|
7911
|
+
const settle = () => {
|
|
7912
|
+
clearTimeout(timer);
|
|
7913
|
+
release?.();
|
|
7914
|
+
};
|
|
7915
|
+
child.on("error", (error) => {
|
|
7916
|
+
settle();
|
|
7917
|
+
reject(error);
|
|
7918
|
+
});
|
|
7944
7919
|
child.on("close", (code) => {
|
|
7945
|
-
|
|
7946
|
-
|
|
7920
|
+
settle();
|
|
7921
|
+
if (timedOut && limit !== void 0)
|
|
7922
|
+
reject(new TimeoutError(render(command, args), limit, stderr));
|
|
7923
|
+
else if (code === 0)
|
|
7924
|
+
resolve10(stdout);
|
|
7947
7925
|
else
|
|
7948
7926
|
reject(new ExecError(render(command, args), code, stderr));
|
|
7949
7927
|
});
|
|
@@ -7952,7 +7930,11 @@ function realIo(prompt) {
|
|
|
7952
7930
|
}),
|
|
7953
7931
|
readFile: (path3) => readFile(path3, "utf8"),
|
|
7954
7932
|
writeFile: (path3, content) => writeFile(path3, content),
|
|
7955
|
-
readDir: async (path3) => (await readdir(path3, { withFileTypes: true })).map((e) => ({
|
|
7933
|
+
readDir: async (path3) => (await readdir(path3, { withFileTypes: true })).map((e) => ({
|
|
7934
|
+
name: e.name,
|
|
7935
|
+
directory: e.isDirectory(),
|
|
7936
|
+
...e.isSymbolicLink() ? { symlink: true } : {}
|
|
7937
|
+
}))
|
|
7956
7938
|
};
|
|
7957
7939
|
}
|
|
7958
7940
|
function render(command, args) {
|
|
@@ -8042,7 +8024,7 @@ ${header.join("\n")}
|
|
|
8042
8024
|
|
|
8043
8025
|
${lines.join("\n")}
|
|
8044
8026
|
`;
|
|
8045
|
-
return { path: path3, releases, changes, sources, content, plan: [write(root ?
|
|
8027
|
+
return { path: path3, releases, changes, sources, content, plan: [write(root ? join(root, path3) : path3, content)] };
|
|
8046
8028
|
}
|
|
8047
8029
|
function describeChange(c) {
|
|
8048
8030
|
const peer = c.field === "peerDependencies" ? " (peer)" : "";
|
|
@@ -8062,7 +8044,7 @@ function resolveRange(value, dependency, catalogs) {
|
|
|
8062
8044
|
return value;
|
|
8063
8045
|
}
|
|
8064
8046
|
function parseCatalogs(text) {
|
|
8065
|
-
const data = text === void 0 ? void 0 : (0,
|
|
8047
|
+
const data = text === void 0 ? void 0 : (0, import_yaml.parse)(text);
|
|
8066
8048
|
const ws = data !== null && typeof data === "object" ? data : {};
|
|
8067
8049
|
const map = (v) => v !== null && typeof v === "object" ? Object.fromEntries(Object.entries(v).map(([k, r]) => [k, String(r)])) : {};
|
|
8068
8050
|
const named = ws.catalogs !== null && typeof ws.catalogs === "object" ? ws.catalogs : {};
|
|
@@ -8072,7 +8054,7 @@ function parseCatalogs(text) {
|
|
|
8072
8054
|
};
|
|
8073
8055
|
}
|
|
8074
8056
|
function workspaceGlobs(text) {
|
|
8075
|
-
const data = text === void 0 ? void 0 : (0,
|
|
8057
|
+
const data = text === void 0 ? void 0 : (0, import_yaml.parse)(text);
|
|
8076
8058
|
const globs = data !== null && typeof data === "object" ? data.packages : void 0;
|
|
8077
8059
|
return Array.isArray(globs) ? globs.map(String).filter((g) => !g.startsWith("!")) : [];
|
|
8078
8060
|
}
|
|
@@ -8083,7 +8065,7 @@ async function readChangeset(ctx, dir, base, branch) {
|
|
|
8083
8065
|
const show = (path4) => orAbsent(git2(["show", `${mergeBase}:${path4}`]));
|
|
8084
8066
|
const current = async (path4) => {
|
|
8085
8067
|
try {
|
|
8086
|
-
return await ctx.readFile(
|
|
8068
|
+
return await ctx.readFile(join(dir, path4));
|
|
8087
8069
|
} catch {
|
|
8088
8070
|
return void 0;
|
|
8089
8071
|
}
|
|
@@ -8099,7 +8081,7 @@ async function readChangeset(ctx, dir, base, branch) {
|
|
|
8099
8081
|
}
|
|
8100
8082
|
const config = await current(`${CHANGESET_DIR}/config.json`);
|
|
8101
8083
|
const ignore = config ? JSON.parse(config).ignore ?? [] : [];
|
|
8102
|
-
const entries = await ctx.readDir(
|
|
8084
|
+
const entries = await ctx.readDir(join(dir, CHANGESET_DIR)).catch(() => []);
|
|
8103
8085
|
const path3 = changesetPath(head);
|
|
8104
8086
|
return planChangeset({
|
|
8105
8087
|
branch: head,
|
|
@@ -8120,12 +8102,12 @@ async function expand(ctx, root, glob) {
|
|
|
8120
8102
|
if (star < 0)
|
|
8121
8103
|
return [glob.replace(/\/$/, "")];
|
|
8122
8104
|
const parent = glob.slice(0, star).replace(/\/$/, "");
|
|
8123
|
-
const entries = await ctx.readDir(
|
|
8105
|
+
const entries = await ctx.readDir(join(root, parent)).catch(() => []);
|
|
8124
8106
|
return entries.filter((e) => e.directory && !e.name.startsWith(".")).map((e) => parent ? `${parent}/${e.name}` : e.name).sort();
|
|
8125
8107
|
}
|
|
8126
8108
|
|
|
8127
|
-
// ../lib/dist/
|
|
8128
|
-
|
|
8109
|
+
// ../lib/dist/compose.js
|
|
8110
|
+
var import_yaml2 = __toESM(require_dist(), 1);
|
|
8129
8111
|
|
|
8130
8112
|
// ../lib/dist/version.js
|
|
8131
8113
|
var COMPENDIUM = "compendium";
|
|
@@ -8137,6 +8119,15 @@ var VERSIONED_REPOS = [
|
|
|
8137
8119
|
COMPENDIUM
|
|
8138
8120
|
];
|
|
8139
8121
|
var isPlexusVersion = (v) => /^\d+\.\d+\.\d+$/.test(v);
|
|
8122
|
+
function compareVersions(a, b) {
|
|
8123
|
+
const nums = (v) => v.split(".").slice(0, 3).map((p) => Number.parseInt(p, 10) || 0);
|
|
8124
|
+
const [x, y] = [nums(a), nums(b)];
|
|
8125
|
+
for (let i = 0; i < 3; i++)
|
|
8126
|
+
if ((x[i] ?? 0) !== (y[i] ?? 0))
|
|
8127
|
+
return (x[i] ?? 0) > (y[i] ?? 0) ? 1 : -1;
|
|
8128
|
+
return 0;
|
|
8129
|
+
}
|
|
8130
|
+
var plxPinOf = (text) => /^\s*"npm:@plexus-ms\/cli"\s*=\s*(?:\{[^}\n]*?\bversion\s*=\s*)?"([^"]*)"/m.exec(text)?.[1];
|
|
8140
8131
|
async function preflightForge(ctx) {
|
|
8141
8132
|
try {
|
|
8142
8133
|
await ctx.read("gh", ["auth", "status"]);
|
|
@@ -8147,17 +8138,204 @@ async function preflightForge(ctx) {
|
|
|
8147
8138
|
var UsageError = class extends Error {
|
|
8148
8139
|
};
|
|
8149
8140
|
|
|
8141
|
+
// ../lib/dist/compose.js
|
|
8142
|
+
var APP_SERVICE = "web";
|
|
8143
|
+
var isMapping = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
8144
|
+
function parseCompose(text, path3) {
|
|
8145
|
+
let doc;
|
|
8146
|
+
try {
|
|
8147
|
+
doc = (0, import_yaml2.parse)(text, { merge: true });
|
|
8148
|
+
} catch (error) {
|
|
8149
|
+
throw new UsageError(`${path3}: not valid YAML: ${error.message.split("\n")[0]?.replace(/:$/, "")}`);
|
|
8150
|
+
}
|
|
8151
|
+
const declared = isMapping(doc) && isMapping(doc.services) ? doc.services : {};
|
|
8152
|
+
const written = {};
|
|
8153
|
+
for (const [name, service] of Object.entries(declared))
|
|
8154
|
+
if (isMapping(service))
|
|
8155
|
+
written[name] = service;
|
|
8156
|
+
const services = resolveExtends(written, path3);
|
|
8157
|
+
return { services, ...isMapping(doc) && doc.include != null ? { includes: true } : {} };
|
|
8158
|
+
}
|
|
8159
|
+
var IMAGE_PLACEHOLDER = /\$\{PLEXUS_DEPLOYMENT_IMAGE(:[^}]*)?\}/g;
|
|
8160
|
+
var normalImage = (image) => image.replace(IMAGE_PLACEHOLDER, "${PLEXUS_DEPLOYMENT_IMAGE}");
|
|
8161
|
+
var CONCATENATED = /* @__PURE__ */ new Set([
|
|
8162
|
+
"ports",
|
|
8163
|
+
"expose",
|
|
8164
|
+
"env_file",
|
|
8165
|
+
"volumes",
|
|
8166
|
+
"devices",
|
|
8167
|
+
"dns",
|
|
8168
|
+
"secrets",
|
|
8169
|
+
"configs",
|
|
8170
|
+
"tmpfs"
|
|
8171
|
+
]);
|
|
8172
|
+
function baseOf(service) {
|
|
8173
|
+
const ext = service.extends;
|
|
8174
|
+
const ref = isMapping(ext) ? ext.file == null ? ext.service : void 0 : ext;
|
|
8175
|
+
return typeof ref === "string" ? ref : void 0;
|
|
8176
|
+
}
|
|
8177
|
+
var identity = (value) => value !== null && typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
8178
|
+
function union(base, own) {
|
|
8179
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8180
|
+
return [...base, ...own].filter((entry) => {
|
|
8181
|
+
const id = identity(entry);
|
|
8182
|
+
if (seen.has(id))
|
|
8183
|
+
return false;
|
|
8184
|
+
seen.add(id);
|
|
8185
|
+
return true;
|
|
8186
|
+
});
|
|
8187
|
+
}
|
|
8188
|
+
function resolveExtends(written, path3) {
|
|
8189
|
+
const resolved = {};
|
|
8190
|
+
const chain = [];
|
|
8191
|
+
const resolve10 = (name) => {
|
|
8192
|
+
const done = resolved[name];
|
|
8193
|
+
if (done)
|
|
8194
|
+
return done;
|
|
8195
|
+
const service = written[name] ?? {};
|
|
8196
|
+
const at = chain.indexOf(name);
|
|
8197
|
+
if (at >= 0)
|
|
8198
|
+
throw new UsageError(`${path3}: services extend each other in a cycle: ${[...chain.slice(at), name].join(" \u2192 ")}`);
|
|
8199
|
+
const ref = baseOf(service);
|
|
8200
|
+
let merged = service;
|
|
8201
|
+
if (ref !== void 0 && written[ref]) {
|
|
8202
|
+
chain.push(name);
|
|
8203
|
+
merged = merge(resolve10(ref), service);
|
|
8204
|
+
chain.pop();
|
|
8205
|
+
}
|
|
8206
|
+
resolved[name] = merged;
|
|
8207
|
+
return merged;
|
|
8208
|
+
};
|
|
8209
|
+
for (const name of Object.keys(written))
|
|
8210
|
+
resolve10(name);
|
|
8211
|
+
return resolved;
|
|
8212
|
+
}
|
|
8213
|
+
function merge(base, service) {
|
|
8214
|
+
const { extends: _own, ...own } = service;
|
|
8215
|
+
const { extends: _inherited, ...inherited } = base;
|
|
8216
|
+
const merged = { ...inherited };
|
|
8217
|
+
for (const [key, value] of Object.entries(own)) {
|
|
8218
|
+
const from = merged[key];
|
|
8219
|
+
if (key === "labels" && from !== void 0)
|
|
8220
|
+
merged[key] = { ...labelsOf(base), ...labelsOf(service) };
|
|
8221
|
+
else if (isMapping(from) && isMapping(value))
|
|
8222
|
+
merged[key] = { ...from, ...value };
|
|
8223
|
+
else if (CONCATENATED.has(key) && Array.isArray(from) && Array.isArray(value))
|
|
8224
|
+
merged[key] = union(from, value);
|
|
8225
|
+
else
|
|
8226
|
+
merged[key] = value;
|
|
8227
|
+
}
|
|
8228
|
+
return merged;
|
|
8229
|
+
}
|
|
8230
|
+
function healthcheckOf(compose) {
|
|
8231
|
+
const check = compose.services[APP_SERVICE]?.healthcheck;
|
|
8232
|
+
return isMapping(check) ? check : void 0;
|
|
8233
|
+
}
|
|
8234
|
+
var truthy = (value) => value === true || typeof value === "string" && ["true", "yes", "y", "on"].includes(value.toLowerCase());
|
|
8235
|
+
function declaresHealthcheck(check) {
|
|
8236
|
+
if (check === void 0 || truthy(check.disable))
|
|
8237
|
+
return false;
|
|
8238
|
+
const { test } = check;
|
|
8239
|
+
if (typeof test === "string")
|
|
8240
|
+
return test.trim() !== "";
|
|
8241
|
+
return Array.isArray(test) && test.length > 0 && test[0] !== "NONE";
|
|
8242
|
+
}
|
|
8243
|
+
function labelsOf(service) {
|
|
8244
|
+
const { labels } = service;
|
|
8245
|
+
if (isMapping(labels))
|
|
8246
|
+
return Object.fromEntries(Object.entries(labels).map(([k, v]) => [k, v == null ? "" : String(v)]));
|
|
8247
|
+
if (!Array.isArray(labels))
|
|
8248
|
+
return {};
|
|
8249
|
+
return Object.fromEntries(labels.map(String).map((l) => {
|
|
8250
|
+
const at = l.indexOf("=");
|
|
8251
|
+
return at < 0 ? [l, ""] : [l.slice(0, at), l.slice(at + 1)];
|
|
8252
|
+
}));
|
|
8253
|
+
}
|
|
8254
|
+
|
|
8150
8255
|
// ../lib/dist/consumers.js
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8256
|
+
import { relative } from "node:path";
|
|
8257
|
+
|
|
8258
|
+
// ../lib/dist/marker.js
|
|
8259
|
+
var import_yaml3 = __toESM(require_dist(), 1);
|
|
8260
|
+
var OBSOLETE_KEYS = ["plexus", "modules"];
|
|
8261
|
+
var MARKER_FILE = "PLEXUS.md";
|
|
8262
|
+
function parseMarker(text) {
|
|
8263
|
+
const { data, body: body2 } = splitFrontmatter(text);
|
|
8264
|
+
const { profile, deviations = [] } = data;
|
|
8265
|
+
if (profile != null && typeof profile !== "string")
|
|
8266
|
+
throw new Error("marker: `profile` must be a string");
|
|
8267
|
+
const listed = deviations ?? [];
|
|
8268
|
+
if (!Array.isArray(listed) || !listed.every((d) => typeof d === "string"))
|
|
8269
|
+
throw new Error("marker: `deviations` must be a list of requirement names");
|
|
8270
|
+
const obsolete = OBSOLETE_KEYS.filter((k) => k in data);
|
|
8271
|
+
return {
|
|
8272
|
+
...profile == null ? {} : { profile },
|
|
8273
|
+
deviations: listed,
|
|
8274
|
+
body: body2,
|
|
8275
|
+
...obsolete.length > 0 ? { obsolete } : {}
|
|
8276
|
+
};
|
|
8277
|
+
}
|
|
8278
|
+
function splitFrontmatter(text) {
|
|
8279
|
+
const match = /^\uFEFF?---\r?\n(?:([\s\S]*?)\r?\n)?---(?:\r?\n|$)([\s\S]*)$/.exec(text);
|
|
8280
|
+
if (!match)
|
|
8281
|
+
throw new Error("no frontmatter: expected a `---` block at the top");
|
|
8282
|
+
const data = (0, import_yaml3.parse)(match[1] ?? "") ?? {};
|
|
8283
|
+
if (typeof data !== "object" || Array.isArray(data))
|
|
8284
|
+
throw new Error("frontmatter is not a mapping");
|
|
8285
|
+
return { data, body: match[2] ?? "" };
|
|
8286
|
+
}
|
|
8287
|
+
function reasonGiven(body2, name) {
|
|
8288
|
+
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
8289
|
+
const opens = new RegExp(`^(\`?)${escaped}\\1(?![\\w/-])\\s*:?(.*)$`, "s");
|
|
8290
|
+
return listItems(body2).some((item) => {
|
|
8291
|
+
const rest = opens.exec(item)?.[2];
|
|
8292
|
+
return rest !== void 0 && /\w/.test(rest.replace(/`/g, ""));
|
|
8293
|
+
});
|
|
8294
|
+
}
|
|
8295
|
+
var ITEM = /^(\s*)(?:[-*+]|\d{1,9}[.)])(\s+)(.*)$/;
|
|
8296
|
+
var FENCE = /^\s*(```|~~~)/;
|
|
8297
|
+
function listItems(body2) {
|
|
8298
|
+
const items = [];
|
|
8299
|
+
let current;
|
|
8300
|
+
let blank = false;
|
|
8301
|
+
let fence;
|
|
8302
|
+
const close = () => {
|
|
8303
|
+
if (current)
|
|
8304
|
+
items.push(current.text.join(" "));
|
|
8305
|
+
current = void 0;
|
|
8306
|
+
};
|
|
8307
|
+
for (const line of body2.split(/\r?\n/)) {
|
|
8308
|
+
const fenced = FENCE.exec(line)?.[1];
|
|
8309
|
+
if (fence) {
|
|
8310
|
+
if (fenced === fence)
|
|
8311
|
+
fence = void 0;
|
|
8312
|
+
continue;
|
|
8313
|
+
}
|
|
8314
|
+
if (fenced) {
|
|
8315
|
+
close();
|
|
8316
|
+
fence = fenced;
|
|
8317
|
+
continue;
|
|
8318
|
+
}
|
|
8319
|
+
const item = ITEM.exec(line);
|
|
8320
|
+
if (item) {
|
|
8321
|
+
close();
|
|
8322
|
+
const [, lead = "", gap = "", text = ""] = item;
|
|
8323
|
+
current = { text: [text.trim()], indent: lead.length + line.slice(lead.length).indexOf(gap) + gap.length };
|
|
8324
|
+
blank = false;
|
|
8325
|
+
} else if (line.trim() === "")
|
|
8326
|
+
blank = true;
|
|
8327
|
+
else if (current && (!blank || line.length - line.trimStart().length >= current.indent)) {
|
|
8328
|
+
current.text.push(line.trim());
|
|
8329
|
+
blank = false;
|
|
8330
|
+
} else
|
|
8331
|
+
close();
|
|
8332
|
+
}
|
|
8333
|
+
close();
|
|
8334
|
+
return items;
|
|
8160
8335
|
}
|
|
8336
|
+
|
|
8337
|
+
// ../lib/dist/templates.js
|
|
8338
|
+
var TEMPLATES = VERSIONED_REPOS.filter((r) => r.startsWith("template-"));
|
|
8161
8339
|
var templateSource = (template) => `gh:plexus-ms/${template}`;
|
|
8162
8340
|
var RENAMED_TEMPLATES = {
|
|
8163
8341
|
"preset-repo-web": "template-repo-turbo",
|
|
@@ -8166,14 +8344,68 @@ var RENAMED_TEMPLATES = {
|
|
|
8166
8344
|
"preset-app-nextjs": "template-app-nextjs",
|
|
8167
8345
|
"preset-repo-operations": "template-repo-operations"
|
|
8168
8346
|
};
|
|
8347
|
+
var UPSTREAM = "plexus-ms";
|
|
8348
|
+
function githubRepoOf(src) {
|
|
8349
|
+
const m = /^(?:gh:|https?:\/\/(?:www\.)?github\.com\/|git@github\.com:|ssh:\/\/git@github\.com\/)([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/i.exec(src.trim());
|
|
8350
|
+
return m?.[1] && m[2] ? { owner: m[1].toLowerCase(), name: m[2].toLowerCase() } : void 0;
|
|
8351
|
+
}
|
|
8169
8352
|
function templateOf(src, templates) {
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
return void 0;
|
|
8353
|
+
const repo = githubRepoOf(src);
|
|
8354
|
+
if (repo?.owner !== UPSTREAM)
|
|
8355
|
+
return void 0;
|
|
8356
|
+
if (templates.includes(repo.name))
|
|
8357
|
+
return repo.name;
|
|
8358
|
+
const current = Object.hasOwn(RENAMED_TEMPLATES, repo.name) ? RENAMED_TEMPLATES[repo.name] : void 0;
|
|
8359
|
+
return current && templates.includes(current) ? current : void 0;
|
|
8360
|
+
}
|
|
8361
|
+
function namesOldTemplate(src) {
|
|
8362
|
+
const repo = githubRepoOf(src);
|
|
8363
|
+
return repo?.owner === UPSTREAM && Object.hasOwn(RENAMED_TEMPLATES, repo.name);
|
|
8364
|
+
}
|
|
8365
|
+
|
|
8366
|
+
// ../lib/dist/model.js
|
|
8367
|
+
var OPERATIONS_TEMPLATE = "template-repo-operations";
|
|
8368
|
+
var hasMarker = (dir) => Boolean(dir.declaration || dir.problems?.some((p) => p.startsWith(MARKER_FILE)));
|
|
8369
|
+
var APPS_DIR = "apps";
|
|
8370
|
+
var holdsApp = (entries) => entries.some((e) => !e.name.startsWith(".")) && !entries.some((e) => e.name === ".git");
|
|
8371
|
+
var isOperations = (dir) => dir.copier?.src !== void 0 && templateOf(dir.copier.src, [OPERATIONS_TEMPLATE]) !== void 0;
|
|
8372
|
+
function unitsOf(root) {
|
|
8373
|
+
const units = [];
|
|
8374
|
+
const visit = (dir, repo, inApps) => {
|
|
8375
|
+
let here = repo;
|
|
8376
|
+
if (dir.gitRoot) {
|
|
8377
|
+
here = dir;
|
|
8378
|
+
if (hasMarker(dir) || (dir.apps?.length ?? 0) > 0)
|
|
8379
|
+
units.push({ dir, kind: isOperations(dir) ? "operations" : "repo" });
|
|
8380
|
+
} else if (inApps && repo?.apps?.includes(dir.path))
|
|
8381
|
+
units.push({ dir, kind: "app", repo });
|
|
8382
|
+
for (const child of dir.children) {
|
|
8383
|
+
if (child.name === APPS_DIR && here === dir)
|
|
8384
|
+
for (const app of child.children)
|
|
8385
|
+
visit(app, here, true);
|
|
8386
|
+
else
|
|
8387
|
+
visit(child, here, false);
|
|
8388
|
+
}
|
|
8389
|
+
};
|
|
8390
|
+
visit(root, void 0, false);
|
|
8391
|
+
return units;
|
|
8392
|
+
}
|
|
8393
|
+
function shortRemote(url) {
|
|
8394
|
+
const bare = url.replace(/\.git$/, "").replace(/\/$/, "");
|
|
8395
|
+
const m = /^(?:git@github\.com:|github\.com:|ssh:\/\/git@github\.com\/|https?:\/\/github\.com\/)(.+)$/.exec(bare);
|
|
8396
|
+
return m ? `gh:${m[1]}` : bare;
|
|
8397
|
+
}
|
|
8398
|
+
function isNotable(dir) {
|
|
8399
|
+
return Boolean(dir.gitRoot || dir.git || dir.template || dir.copier || dir.declaration || dir.problems?.length || dir.unreadable || dir.symlink);
|
|
8400
|
+
}
|
|
8401
|
+
|
|
8402
|
+
// ../lib/dist/consumers.js
|
|
8403
|
+
function expectedBranch(repo) {
|
|
8404
|
+
if (!repo.declaration)
|
|
8405
|
+
return void 0;
|
|
8406
|
+
if (isOperations(repo))
|
|
8407
|
+
return "main";
|
|
8408
|
+
return repo.copier?.answers.publishes_packages === true ? "main" : "develop";
|
|
8177
8409
|
}
|
|
8178
8410
|
async function findConsumers(ctx, root, templates) {
|
|
8179
8411
|
const consumers = /* @__PURE__ */ new Map();
|
|
@@ -8189,7 +8421,7 @@ async function findConsumers(ctx, root, templates) {
|
|
|
8189
8421
|
else {
|
|
8190
8422
|
let consumer = consumers.get(here.path);
|
|
8191
8423
|
if (!consumer) {
|
|
8192
|
-
const expected = expectedBranch(here
|
|
8424
|
+
const expected = expectedBranch(here);
|
|
8193
8425
|
consumer = {
|
|
8194
8426
|
path: here.path,
|
|
8195
8427
|
rel: relative(root.path, here.path) || ".",
|
|
@@ -8294,7 +8526,7 @@ var Context = class {
|
|
|
8294
8526
|
if (input !== void 0)
|
|
8295
8527
|
this.say(indent(input), step.kind === "write" ? 2 : 1);
|
|
8296
8528
|
if (!this.dryRun)
|
|
8297
|
-
await this.perform(step);
|
|
8529
|
+
await this.perform(step, false);
|
|
8298
8530
|
}
|
|
8299
8531
|
}
|
|
8300
8532
|
/**
|
|
@@ -8309,7 +8541,7 @@ var Context = class {
|
|
|
8309
8541
|
this.say(indent(input), step.kind === "write" ? 2 : 1);
|
|
8310
8542
|
if (this.dryRun)
|
|
8311
8543
|
return void 0;
|
|
8312
|
-
return this.perform(step);
|
|
8544
|
+
return this.perform(step, true);
|
|
8313
8545
|
}
|
|
8314
8546
|
/**
|
|
8315
8547
|
* Perform a step on scratch state, whatever the mode: the one exception to
|
|
@@ -8321,16 +8553,25 @@ var Context = class {
|
|
|
8321
8553
|
const input = body(step);
|
|
8322
8554
|
if (input !== void 0)
|
|
8323
8555
|
this.say(indent(input), 2);
|
|
8324
|
-
return this.perform(step);
|
|
8556
|
+
return this.perform(step, true);
|
|
8325
8557
|
}
|
|
8326
|
-
|
|
8327
|
-
|
|
8558
|
+
/**
|
|
8559
|
+
* A step's output goes to the terminal under -vv. When the caller goes on
|
|
8560
|
+
* with it (`used`: a staged `mktemp -d`, a create call's answer), it is
|
|
8561
|
+
* captured at every verbosity and only echoed, never passed through
|
|
8562
|
+
* uncaptured: an empty answer would send the caller on with ''.
|
|
8563
|
+
*/
|
|
8564
|
+
async perform(step, used) {
|
|
8565
|
+
const shown = this.verbose >= 2;
|
|
8566
|
+
const inherit = shown && !used || step.kind === "run" && step.interactive === true;
|
|
8328
8567
|
switch (step.kind) {
|
|
8329
8568
|
case "run":
|
|
8330
8569
|
return this.io.exec(step.command, step.args, {
|
|
8331
8570
|
cwd: step.cwd,
|
|
8332
8571
|
input: step.input,
|
|
8333
8572
|
inherit,
|
|
8573
|
+
echo: shown && !inherit,
|
|
8574
|
+
timeout: step.timeout,
|
|
8334
8575
|
env: step.env === void 0 ? void 0 : { ...process.env, ...step.env }
|
|
8335
8576
|
});
|
|
8336
8577
|
case "write":
|
|
@@ -8351,13 +8592,13 @@ function indent(text) {
|
|
|
8351
8592
|
}
|
|
8352
8593
|
|
|
8353
8594
|
// ../lib/dist/copier.js
|
|
8354
|
-
var
|
|
8595
|
+
var import_yaml4 = __toESM(require_dist(), 1);
|
|
8355
8596
|
var ANSWERS_FILE = ".copier-answers.yml";
|
|
8356
8597
|
var TEMPLATE_FILES = ["copier.yml", "copier.yaml"];
|
|
8357
8598
|
var COPIER_VERSION = "9.19.1";
|
|
8358
8599
|
var copierVia = (args) => ["exec", `copier@${COPIER_VERSION}`, "--", "copier", ...args];
|
|
8359
8600
|
function parseAnswers(text) {
|
|
8360
|
-
const data = (0,
|
|
8601
|
+
const data = (0, import_yaml4.parse)(text);
|
|
8361
8602
|
if (data === null || typeof data !== "object" || Array.isArray(data))
|
|
8362
8603
|
throw new Error("answers file is not a mapping");
|
|
8363
8604
|
const { _commit, _src_path, ...answers } = data;
|
|
@@ -8371,18 +8612,18 @@ function parseAnswers(text) {
|
|
|
8371
8612
|
// ../lib/dist/deploy.js
|
|
8372
8613
|
import { randomBytes } from "node:crypto";
|
|
8373
8614
|
import { tmpdir } from "node:os";
|
|
8374
|
-
import { join as
|
|
8615
|
+
import { join as join3 } from "node:path";
|
|
8375
8616
|
|
|
8376
8617
|
// ../lib/dist/deployTargets.js
|
|
8377
|
-
var
|
|
8378
|
-
import { join as
|
|
8618
|
+
var import_yaml5 = __toESM(require_dist(), 1);
|
|
8619
|
+
import { join as join2 } from "node:path";
|
|
8379
8620
|
var VARS_DIRS = ["group_vars", "host_vars"];
|
|
8380
8621
|
var DEFAULT_ENVIRONMENT = "production";
|
|
8381
8622
|
function deploymentSlug(app, environment = DEFAULT_ENVIRONMENT) {
|
|
8382
8623
|
return environment === DEFAULT_ENVIRONMENT ? app : `${app}-${environment}`;
|
|
8383
8624
|
}
|
|
8384
8625
|
function parseInventoryFile(path3, text) {
|
|
8385
|
-
const data = (0,
|
|
8626
|
+
const data = (0, import_yaml5.parse)(text);
|
|
8386
8627
|
const vars = data !== null && typeof data === "object" ? data : {};
|
|
8387
8628
|
const target = typeof vars.plexus_deploy_target === "string" ? vars.plexus_deploy_target : void 0;
|
|
8388
8629
|
const records = Array.isArray(vars.plexus_apps) ? vars.plexus_apps : [];
|
|
@@ -8439,7 +8680,7 @@ async function readDeployTargets(ctx, inventory) {
|
|
|
8439
8680
|
const files = [];
|
|
8440
8681
|
let found = false;
|
|
8441
8682
|
for (const sub of VARS_DIRS) {
|
|
8442
|
-
const dir =
|
|
8683
|
+
const dir = join2(inventory, sub);
|
|
8443
8684
|
const entries = await ctx.readDir(dir).catch(() => void 0);
|
|
8444
8685
|
if (entries === void 0)
|
|
8445
8686
|
continue;
|
|
@@ -8447,7 +8688,7 @@ async function readDeployTargets(ctx, inventory) {
|
|
|
8447
8688
|
for (const e of entries) {
|
|
8448
8689
|
if (e.directory || !/\.ya?ml$/.test(e.name))
|
|
8449
8690
|
continue;
|
|
8450
|
-
const path3 =
|
|
8691
|
+
const path3 = join2(dir, e.name);
|
|
8451
8692
|
files.push(parseInventoryFile(path3, await ctx.readFile(path3)));
|
|
8452
8693
|
}
|
|
8453
8694
|
}
|
|
@@ -8457,15 +8698,14 @@ async function readDeployTargets(ctx, inventory) {
|
|
|
8457
8698
|
}
|
|
8458
8699
|
|
|
8459
8700
|
// ../lib/dist/deploy.js
|
|
8460
|
-
var PLACEHOLDER = /\$\{PLEXUS_DEPLOYMENT_IMAGE(:[^}]*)?\}/g;
|
|
8461
8701
|
var INCOMING = ".incoming";
|
|
8462
8702
|
function renderCompose(text, image, path3) {
|
|
8463
|
-
const has =
|
|
8464
|
-
|
|
8703
|
+
const has = IMAGE_PLACEHOLDER.test(text);
|
|
8704
|
+
IMAGE_PLACEHOLDER.lastIndex = 0;
|
|
8465
8705
|
if (image) {
|
|
8466
8706
|
if (!has)
|
|
8467
8707
|
throw new UsageError(`${path3} does not reference \${PLEXUS_DEPLOYMENT_IMAGE}; an image ref was given but nothing would use it (\xA7 3 PLX-App)`);
|
|
8468
|
-
return text.replace(
|
|
8708
|
+
return text.replace(IMAGE_PLACEHOLDER, image);
|
|
8469
8709
|
}
|
|
8470
8710
|
if (has)
|
|
8471
8711
|
throw new UsageError(`${path3} references \${PLEXUS_DEPLOYMENT_IMAGE} but no image ref was given`);
|
|
@@ -8476,7 +8716,7 @@ function defaultAppDir(app, environment = DEFAULT_ENVIRONMENT) {
|
|
|
8476
8716
|
}
|
|
8477
8717
|
var q = (word) => `'${word.replaceAll("'", "'\\''")}'`;
|
|
8478
8718
|
var Remote = class {
|
|
8479
|
-
socket =
|
|
8719
|
+
socket = join3(tmpdir(), `plx-deploy-${randomBytes(4).toString("hex")}.sock`);
|
|
8480
8720
|
ctx;
|
|
8481
8721
|
host;
|
|
8482
8722
|
constructor(ctx, host) {
|
|
@@ -8525,6 +8765,23 @@ var Remote = class {
|
|
|
8525
8765
|
return this.ctx.apply([run("ssh", ["-o", `ControlPath=${this.socket}`, "-O", "exit", this.host])]);
|
|
8526
8766
|
}
|
|
8527
8767
|
};
|
|
8768
|
+
function seconds(duration) {
|
|
8769
|
+
if (typeof duration !== "string" || !/^((\d+\.?\d*|\.\d+)(ns|us|µs|ms|s|m|h))+$/.test(duration))
|
|
8770
|
+
return void 0;
|
|
8771
|
+
const unit = { ns: 1e-9, us: 1e-6, \u00B5s: 1e-6, ms: 1e-3, s: 1, m: 60, h: 3600 };
|
|
8772
|
+
let total = 0;
|
|
8773
|
+
for (const [, n, u] of duration.matchAll(/(\d+\.?\d*|\.\d+)(ns|us|µs|ms|s|m|h)/g))
|
|
8774
|
+
total += Number(n) * (unit[u] ?? 0);
|
|
8775
|
+
return total;
|
|
8776
|
+
}
|
|
8777
|
+
function slowStart(check, budget) {
|
|
8778
|
+
if (check.start_interval == null)
|
|
8779
|
+
return "sets no start_interval";
|
|
8780
|
+
const period = check.start_period == null ? 0 : seconds(check.start_period);
|
|
8781
|
+
if (period !== void 0 && period < budget)
|
|
8782
|
+
return `has a start_period of ${period}s, under the deploy's ${budget}s wait`;
|
|
8783
|
+
return void 0;
|
|
8784
|
+
}
|
|
8528
8785
|
async function deploy(ctx, options) {
|
|
8529
8786
|
const { host, app } = options;
|
|
8530
8787
|
const dir = options.dir ?? ".";
|
|
@@ -8537,7 +8794,7 @@ async function deploy(ctx, options) {
|
|
|
8537
8794
|
let text = "";
|
|
8538
8795
|
for (const candidate of [`${source}/docker/compose.yaml`, `${source}/compose.yaml`]) {
|
|
8539
8796
|
try {
|
|
8540
|
-
text = await ctx.readFile(
|
|
8797
|
+
text = await ctx.readFile(join3(dir, candidate));
|
|
8541
8798
|
compose = candidate;
|
|
8542
8799
|
break;
|
|
8543
8800
|
} catch {
|
|
@@ -8546,300 +8803,134 @@ async function deploy(ctx, options) {
|
|
|
8546
8803
|
if (compose === void 0)
|
|
8547
8804
|
throw new UsageError(`no compose.yaml under ${source}; run from the app's source repo (\xA7 2 PLX-App)`);
|
|
8548
8805
|
const rendered = renderCompose(text, image, compose);
|
|
8806
|
+
const budget = retries * 2;
|
|
8807
|
+
const check = healthcheckOf(parseCompose(rendered, compose));
|
|
8808
|
+
if (!declaresHealthcheck(check))
|
|
8809
|
+
throw new UsageError(`${compose}: the web service declares no healthcheck with a test of its own, and the deploy waits for it to turn healthy (PLX-App/Healthcheck); the files an \`include\` names are not read, nor a service an \`extends\` takes from another file (\`file:\`), and an image's own HEALTHCHECK does not count; to use it, declare it here:
|
|
8810
|
+
healthcheck: { test: [CMD, <the image's check command>], start_period: ${budget}s, start_interval: 1s }`);
|
|
8811
|
+
const slow = slowStart(check, budget);
|
|
8549
8812
|
ctx.say(`\u2192 deploying ${image ?? "<image pinned in compose.yaml>"}`);
|
|
8550
8813
|
ctx.say(` host: ${host}`);
|
|
8551
8814
|
ctx.say(` dir: ${appDir}`);
|
|
8552
8815
|
ctx.say(` compose: ${compose}`);
|
|
8553
|
-
ctx.say(
|
|
8554
|
-
|
|
8816
|
+
ctx.say(" health: the healthcheck of service web, as Docker reports it");
|
|
8817
|
+
if (slow)
|
|
8818
|
+
ctx.say(`\u26A0 ${compose}: the web healthcheck ${slow}, so Docker may probe it only every interval while the deploy waits, which then sees it healthy late or rolls it back; set start_interval: 1s and start_period: ${budget}s`);
|
|
8555
8819
|
const D = q(appDir);
|
|
8556
8820
|
const dc = `cd ${D} && docker compose`;
|
|
8557
|
-
const
|
|
8558
|
-
|
|
8559
|
-
|
|
8821
|
+
const s = {
|
|
8822
|
+
ctx,
|
|
8823
|
+
remote: new Remote(ctx, host),
|
|
8824
|
+
D,
|
|
8825
|
+
dc,
|
|
8826
|
+
dci: `${dc} --project-directory . -f ${INCOMING}/compose.yaml`,
|
|
8827
|
+
// One `web` container is assumed, hence `head -1`: the app contract binds
|
|
8828
|
+
// one fixed loopback port (§ 4 PLX-App), which a second replica could not.
|
|
8829
|
+
liveImage: `${dc} ps -q web 2>/dev/null | head -1 | xargs -r docker inspect --format '{{.Config.Image}}' 2>/dev/null || true`,
|
|
8830
|
+
image,
|
|
8831
|
+
result: { host, appDir, compose, image, healthy: false, rolledBack: false }
|
|
8832
|
+
};
|
|
8833
|
+
const { result } = s;
|
|
8560
8834
|
let staged = false;
|
|
8561
8835
|
try {
|
|
8562
|
-
await
|
|
8836
|
+
await stage(s, rendered);
|
|
8563
8837
|
staged = true;
|
|
8564
|
-
result.previous = await remote.read(liveImage) || void 0;
|
|
8838
|
+
result.previous = await s.remote.read(s.liveImage) || void 0;
|
|
8565
8839
|
ctx.say(` previous: ${result.previous ?? (ctx.dryRun ? "<read on host>" : "<none>")}`);
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
throw new Error("health URL read before it was resolved");
|
|
8571
|
-
return resolvedUrl;
|
|
8572
|
-
};
|
|
8573
|
-
if (ctx.dryRun)
|
|
8574
|
-
ctx.say(" (nothing more runs when the host already serves this image from this file, healthy)");
|
|
8575
|
-
else if (image ? result.previous === image : result.previous !== void 0) {
|
|
8576
|
-
const sameFile = await remote.test(`cd ${D} && cmp -s compose.yaml ${INCOMING}/compose.yaml`);
|
|
8577
|
-
if (sameFile) {
|
|
8578
|
-
resolvedUrl = options.healthUrl || await resolveHealthUrl(remote, D, dc, ctx);
|
|
8579
|
-
if (await remote.test(poll(1))) {
|
|
8580
|
-
result.live = result.previous;
|
|
8581
|
-
result.healthy = true;
|
|
8582
|
-
result.unchanged = true;
|
|
8583
|
-
ctx.done(`${result.previous} is already live and healthy; nothing to do`);
|
|
8584
|
-
return result;
|
|
8585
|
-
}
|
|
8586
|
-
}
|
|
8587
|
-
}
|
|
8588
|
-
await remote.exec(`${dci} pull`);
|
|
8589
|
-
const migrate = await remote.test(`${dci} --profile migrate config --services 2>/dev/null | grep -qx migrate`);
|
|
8590
|
-
if (migrate === void 0)
|
|
8591
|
-
ctx.say(" (if compose.yaml declares a migrate service:)");
|
|
8592
|
-
if (migrate !== false)
|
|
8593
|
-
await remote.exec(`${dci} run --rm migrate </dev/null`);
|
|
8594
|
-
const hadPrev = await remote.test(`test -f ${D}/compose.yaml`);
|
|
8595
|
-
if (hadPrev !== false)
|
|
8596
|
-
await remote.exec(`cd ${D} && cp -p compose.yaml ${INCOMING}/compose.yaml.prev`);
|
|
8597
|
-
await remote.exec(`cd ${D} && mv ${INCOMING}/compose.yaml compose.yaml`);
|
|
8598
|
-
await remote.exec(`${dc} up -d --remove-orphans`);
|
|
8599
|
-
resolvedUrl ??= options.healthUrl || await resolveHealthUrl(remote, D, dc, ctx);
|
|
8840
|
+
if (await alreadyServing(s))
|
|
8841
|
+
return result;
|
|
8842
|
+
await pullAndMigrate(s);
|
|
8843
|
+
const hadPrev = await swapAndUp(s);
|
|
8600
8844
|
const started = Date.now();
|
|
8601
|
-
|
|
8602
|
-
|
|
8603
|
-
result.live = await remote.read(liveImage) || image;
|
|
8845
|
+
if (await awaitHealthy(s, retries, true) !== false) {
|
|
8846
|
+
result.live = await s.remote.read(s.liveImage) || image;
|
|
8604
8847
|
result.healthy = true;
|
|
8605
8848
|
if (ctx.dryRun)
|
|
8606
|
-
ctx.say(" (on failure: restore the previous compose.yaml, up -d --remove-orphans,
|
|
8849
|
+
ctx.say(" (on failure: restore the previous compose.yaml, up -d --remove-orphans, wait again)");
|
|
8607
8850
|
else
|
|
8608
8851
|
ctx.done(`${result.live ?? "the app"} is live and healthy`);
|
|
8609
8852
|
return result;
|
|
8610
8853
|
}
|
|
8611
8854
|
ctx.say(`\u2717 healthcheck failed after ${Math.round((Date.now() - started) / 1e3)}s; last lines from the app:`);
|
|
8612
|
-
const logs = await remote.read(`${dc} logs --no-color --tail 50 web 2>&1 || true`);
|
|
8855
|
+
const logs = await s.remote.read(`${dc} logs --no-color --tail 50 web 2>&1 || true`);
|
|
8613
8856
|
if (logs)
|
|
8614
8857
|
ctx.say(logs.replace(/^/gm, " "));
|
|
8615
|
-
|
|
8616
|
-
if (!differs) {
|
|
8617
|
-
ctx.done("nothing to roll back to (first deploy, or the same run shape re-deployed); manual intervention needed", false);
|
|
8618
|
-
return result;
|
|
8619
|
-
}
|
|
8620
|
-
await remote.exec(`cd ${D} && cp -p ${INCOMING}/compose.yaml.prev compose.yaml`);
|
|
8621
|
-
ctx.say(`\u21A9 rolling back to ${result.previous ?? "the previous compose.yaml"}`);
|
|
8622
|
-
await remote.exec(`${dc} up -d --remove-orphans`);
|
|
8623
|
-
result.rolledBack = true;
|
|
8624
|
-
if (await remote.test(poll(retries))) {
|
|
8625
|
-
result.live = result.previous;
|
|
8626
|
-
ctx.done(`rolled back to ${result.previous ?? "the previous compose.yaml"}`);
|
|
8627
|
-
} else {
|
|
8628
|
-
ctx.done("rollback also unhealthy; manual intervention needed", false);
|
|
8629
|
-
}
|
|
8858
|
+
await rollback(s, hadPrev, retries);
|
|
8630
8859
|
return result;
|
|
8631
8860
|
} finally {
|
|
8632
8861
|
if (staged)
|
|
8633
|
-
await remote.exec(`rm -rf ${D}/${INCOMING}`).catch(() => void 0);
|
|
8634
|
-
await remote.close().catch(() => void 0);
|
|
8862
|
+
await s.remote.exec(`rm -rf ${D}/${INCOMING}`).catch(() => void 0);
|
|
8863
|
+
await s.remote.close().catch(() => void 0);
|
|
8635
8864
|
}
|
|
8636
8865
|
}
|
|
8637
|
-
async function
|
|
8638
|
-
const
|
|
8639
|
-
|
|
8640
|
-
const url = ctx.dryRun ? "http://127.0.0.1:${PLEXUS_LOOPBACK_PORT:-3000}${plexus.healthz:-/healthz}" : `http://127.0.0.1:${port || "3000"}${path3 || "/healthz"}`;
|
|
8641
|
-
ctx.say(` health: ${url}`);
|
|
8642
|
-
return url;
|
|
8643
|
-
}
|
|
8644
|
-
|
|
8645
|
-
// ../lib/dist/doctor.js
|
|
8646
|
-
import { relative as relative2 } from "node:path";
|
|
8647
|
-
function diagnose(root, catalog) {
|
|
8648
|
-
const units = collect(root, []);
|
|
8649
|
-
const declarations = units.map((u) => diagnoseUnit(u, units, catalog, root.path));
|
|
8650
|
-
return { declarations, stale: declarations.filter((d) => d.findings.length > 0).length };
|
|
8651
|
-
}
|
|
8652
|
-
function collect(dir, ancestors, parent) {
|
|
8653
|
-
const here = dir.declaration || dir.problems?.some((p) => p.startsWith("PLEXUS.md")) ? [{ dir, ancestors, parent }] : [];
|
|
8654
|
-
const below = dir.declaration ? [...ancestors, dir] : ancestors;
|
|
8655
|
-
return [...here, ...dir.children.flatMap((c) => collect(c, below, dir))];
|
|
8656
|
-
}
|
|
8657
|
-
function diagnoseUnit(unit, units, catalog, root) {
|
|
8658
|
-
const { dir } = unit;
|
|
8659
|
-
const path3 = relative2(root, dir.path) || ".";
|
|
8660
|
-
const problem = dir.problems?.find((p) => p.startsWith("PLEXUS.md"));
|
|
8661
|
-
if (!dir.declaration)
|
|
8662
|
-
return { path: path3, modules: [], findings: [problem?.replace(/^PLEXUS\.md: /, "") ?? "unreadable marker"] };
|
|
8663
|
-
const { plexus, modules } = dir.declaration;
|
|
8664
|
-
const context = new Set(contextOf(unit, units).flatMap((d) => d.declaration?.modules ?? []));
|
|
8665
|
-
const findings = [];
|
|
8666
|
-
for (const code of modules) {
|
|
8667
|
-
const module = catalog.get(code);
|
|
8668
|
-
if (!module) {
|
|
8669
|
-
findings.push(`declares ${code}, which no module carries`);
|
|
8670
|
-
continue;
|
|
8671
|
-
}
|
|
8672
|
-
if (module.changed && compareVersions(module.changed, plexus) > 0)
|
|
8673
|
-
findings.push(`${code} changed in ${module.changed}, declared at ${plexus}`);
|
|
8674
|
-
for (const dep of module.depends)
|
|
8675
|
-
if (!modules.includes(dep) && !context.has(dep))
|
|
8676
|
-
findings.push(`${code} depends on ${dep}, declared neither here nor by an enclosing or contained declaration`);
|
|
8677
|
-
}
|
|
8678
|
-
return { path: path3, plexus, modules, findings };
|
|
8679
|
-
}
|
|
8680
|
-
function contextOf(unit, units) {
|
|
8681
|
-
const { dir, ancestors } = unit;
|
|
8682
|
-
const context = [...ancestors, ...descendants(dir)];
|
|
8683
|
-
const repo = ancestors[0] ?? dir;
|
|
8684
|
-
const repoParent = units.find((u) => u.dir === repo)?.parent;
|
|
8685
|
-
const siblings = repoParent?.children.filter((c) => c !== repo && c.declaration) ?? [];
|
|
8686
|
-
const isTenancy = (d) => d.declaration?.modules.includes("PLX-Tenancy") ?? false;
|
|
8687
|
-
context.push(...siblings.filter(isTenancy));
|
|
8688
|
-
if (isTenancy(dir))
|
|
8689
|
-
context.push(...siblings);
|
|
8690
|
-
return context;
|
|
8691
|
-
}
|
|
8692
|
-
function descendants(dir) {
|
|
8693
|
-
return dir.children.flatMap((c) => [...c.declaration ? [c] : [], ...descendants(c)]);
|
|
8694
|
-
}
|
|
8695
|
-
function compareVersions(a, b) {
|
|
8696
|
-
const nums = (v) => v.split(".").slice(0, 3).map((p) => Number.parseInt(p, 10) || 0);
|
|
8697
|
-
const [x, y] = [nums(a), nums(b)];
|
|
8698
|
-
for (let i = 0; i < 3; i++)
|
|
8699
|
-
if ((x[i] ?? 0) !== (y[i] ?? 0))
|
|
8700
|
-
return (x[i] ?? 0) > (y[i] ?? 0) ? 1 : -1;
|
|
8701
|
-
return 0;
|
|
8866
|
+
async function stage(s, rendered) {
|
|
8867
|
+
const { D } = s;
|
|
8868
|
+
await s.remote.exec(`rm -rf ${D}/${INCOMING} && mkdir -p ${D}/${INCOMING} && cat > ${D}/${INCOMING}/compose.yaml`, rendered);
|
|
8702
8869
|
}
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
var strings = (value) => Array.isArray(value) && value.every((v) => typeof v === "string");
|
|
8709
|
-
function parseManifest(text) {
|
|
8710
|
-
let data;
|
|
8711
|
-
try {
|
|
8712
|
-
data = JSON.parse(text);
|
|
8713
|
-
} catch {
|
|
8714
|
-
throw new Error("the module manifest is not JSON");
|
|
8870
|
+
async function alreadyServing(s) {
|
|
8871
|
+
const { ctx, result } = s;
|
|
8872
|
+
if (ctx.dryRun) {
|
|
8873
|
+
ctx.say(" (nothing more runs when the host already serves this image from this file, healthy)");
|
|
8874
|
+
return false;
|
|
8715
8875
|
}
|
|
8716
|
-
if (
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
const
|
|
8731
|
-
|
|
8732
|
-
if
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
|
|
8744
|
-
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8750
|
-
};
|
|
8751
|
-
}
|
|
8752
|
-
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
if (
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
}
|
|
8764
|
-
|
|
8765
|
-
const bare = url.replace(/\.git$/, "").replace(/\/$/, "");
|
|
8766
|
-
const m = /^(?:git@github\.com:|github\.com:|ssh:\/\/git@github\.com\/|https?:\/\/github\.com\/)(.+)$/.exec(bare);
|
|
8767
|
-
return m ? `gh:${m[1]}` : bare;
|
|
8768
|
-
}
|
|
8769
|
-
function isNotable(dir) {
|
|
8770
|
-
return Boolean(dir.git || dir.template || dir.copier || dir.declaration || dir.problems?.length);
|
|
8771
|
-
}
|
|
8772
|
-
|
|
8773
|
-
// ../lib/dist/need.js
|
|
8774
|
-
var DEFAULT_MAX_AGE = 30;
|
|
8775
|
-
var MAX_AGE_ANSWER = "update_max_age";
|
|
8776
|
-
var DAY = 24 * 60 * 60 * 1e3;
|
|
8777
|
-
var days = (n) => `${n} day${n === 1 ? "" : "s"}`;
|
|
8778
|
-
function needOf({ recorded, releases, asked, stale = [], maxAge, now }) {
|
|
8779
|
-
if (asked)
|
|
8780
|
-
return { take: true, trigger: "asked", why: `asked for (${asked})` };
|
|
8781
|
-
const [first, ...more] = stale;
|
|
8782
|
-
if (first)
|
|
8783
|
-
return {
|
|
8784
|
-
take: true,
|
|
8785
|
-
trigger: "module",
|
|
8786
|
-
why: `${first.code} changed in ${first.changed}, declared at ${first.declared} in ${first.where}${more.length > 0 ? `, and ${more.length} more` : ""}`
|
|
8787
|
-
};
|
|
8788
|
-
const odd = recorded.findIndex((r) => !r || !isPlexusVersion(r));
|
|
8789
|
-
if (recorded.length === 0 || odd >= 0)
|
|
8790
|
-
return {
|
|
8791
|
-
take: true,
|
|
8792
|
-
trigger: "backstop",
|
|
8793
|
-
why: `a site records ${recorded[odd] ? `'${recorded[odd]}'` : "no version"}, not a version`
|
|
8794
|
-
};
|
|
8795
|
-
const versions = recorded;
|
|
8796
|
-
const oldest = versions.reduce((a, b) => compareVersions(a, b) <= 0 ? a : b);
|
|
8797
|
-
const untaken = releases.filter((r) => isPlexusVersion(r.version) && compareVersions(r.version, oldest) > 0).sort((a, b) => Date.parse(a.published) - Date.parse(b.published));
|
|
8798
|
-
const oldestUntaken = untaken[0];
|
|
8799
|
-
if (!oldestUntaken)
|
|
8800
|
-
return { take: false, why: `no version newer than ${oldest}` };
|
|
8801
|
-
const age = Math.max(0, Math.floor((now.getTime() - Date.parse(oldestUntaken.published)) / DAY));
|
|
8802
|
-
const count = `${untaken.length} newer version${untaken.length === 1 ? "" : "s"}`;
|
|
8803
|
-
if (maxAge === 0)
|
|
8804
|
-
return { take: true, trigger: "backstop", why: `a backstop age of zero takes every version (${count})` };
|
|
8805
|
-
if (age >= maxAge)
|
|
8806
|
-
return {
|
|
8807
|
-
take: true,
|
|
8808
|
-
trigger: "backstop",
|
|
8809
|
-
why: `${oldestUntaken.version}, the oldest version not taken, was cut ${days(age)} ago (backstop: ${days(maxAge)}; ${count})`
|
|
8810
|
-
};
|
|
8811
|
-
return {
|
|
8812
|
-
take: false,
|
|
8813
|
-
why: `${count}, the oldest (${oldestUntaken.version}) cut ${days(age)} ago; the backstop is ${days(maxAge)}`
|
|
8814
|
-
};
|
|
8815
|
-
}
|
|
8816
|
-
function staleModules(markers, catalog) {
|
|
8817
|
-
const stale = [];
|
|
8818
|
-
for (const { where, plexus, modules } of markers) {
|
|
8819
|
-
if (!isPlexusVersion(plexus))
|
|
8820
|
-
continue;
|
|
8821
|
-
for (const code of modules) {
|
|
8822
|
-
const changed = catalog.get(code)?.changed;
|
|
8823
|
-
if (changed && isPlexusVersion(changed) && compareVersions(changed, plexus) > 0)
|
|
8824
|
-
stale.push({ code, changed, where, declared: plexus });
|
|
8825
|
-
}
|
|
8876
|
+
if (!(s.image ? result.previous === s.image : result.previous !== void 0))
|
|
8877
|
+
return false;
|
|
8878
|
+
if (!await s.remote.test(`cd ${s.D} && cmp -s compose.yaml ${INCOMING}/compose.yaml`))
|
|
8879
|
+
return false;
|
|
8880
|
+
if (!await awaitHealthy(s, 1))
|
|
8881
|
+
return false;
|
|
8882
|
+
result.live = result.previous;
|
|
8883
|
+
result.healthy = true;
|
|
8884
|
+
result.unchanged = true;
|
|
8885
|
+
ctx.done(`${result.previous} is already live and healthy; nothing to do`);
|
|
8886
|
+
return true;
|
|
8887
|
+
}
|
|
8888
|
+
async function pullAndMigrate(s) {
|
|
8889
|
+
await s.remote.exec(`${s.dci} pull`);
|
|
8890
|
+
const migrate = await s.remote.test(`${s.dci} --profile migrate config --services 2>/dev/null | grep -qx migrate`);
|
|
8891
|
+
if (migrate === void 0)
|
|
8892
|
+
s.ctx.say(" (if compose.yaml declares a migrate service:)");
|
|
8893
|
+
if (migrate !== false)
|
|
8894
|
+
await s.remote.exec(`${s.dci} run --rm migrate </dev/null`);
|
|
8895
|
+
}
|
|
8896
|
+
async function swapAndUp(s) {
|
|
8897
|
+
const { D } = s;
|
|
8898
|
+
const hadPrev = await s.remote.test(`test -f ${D}/compose.yaml`);
|
|
8899
|
+
if (hadPrev !== false)
|
|
8900
|
+
await s.remote.exec(`cd ${D} && cp -p compose.yaml ${INCOMING}/compose.yaml.prev`);
|
|
8901
|
+
await s.remote.exec(`cd ${D} && mv ${INCOMING}/compose.yaml compose.yaml`);
|
|
8902
|
+
await s.remote.exec(`${s.dc} up -d --remove-orphans`);
|
|
8903
|
+
return hadPrev;
|
|
8904
|
+
}
|
|
8905
|
+
function awaitHealthy(s, attempts, show = false) {
|
|
8906
|
+
const status = `docker compose ps -q web 2>/dev/null | head -1 | xargs -r docker inspect --format '{{if .State.Health}}{{.State.Health.Status}}{{end}}' 2>/dev/null`;
|
|
8907
|
+
return s.remote.test(`cd ${s.D} && for _ in $(seq 1 ${attempts}); do [ "$(${status})" = healthy ] && exit 0; sleep 2; done; exit 1`, show);
|
|
8908
|
+
}
|
|
8909
|
+
async function rollback(s, hadPrev, retries) {
|
|
8910
|
+
const { ctx, D, result } = s;
|
|
8911
|
+
const differs = hadPrev && await s.remote.test(`cd ${D} && ! cmp -s compose.yaml ${INCOMING}/compose.yaml.prev`);
|
|
8912
|
+
if (!differs) {
|
|
8913
|
+
ctx.done("nothing to roll back to (first deploy, or the same run shape re-deployed); manual intervention needed", false);
|
|
8914
|
+
return;
|
|
8915
|
+
}
|
|
8916
|
+
await s.remote.exec(`cd ${D} && cp -p ${INCOMING}/compose.yaml.prev compose.yaml`);
|
|
8917
|
+
ctx.say(`\u21A9 rolling back to ${result.previous ?? "the previous compose.yaml"}`);
|
|
8918
|
+
await s.remote.exec(`${s.dc} up -d --remove-orphans`);
|
|
8919
|
+
result.rolledBack = true;
|
|
8920
|
+
if (await awaitHealthy(s, retries)) {
|
|
8921
|
+
result.live = result.previous;
|
|
8922
|
+
ctx.done(`rolled back to ${result.previous ?? "the previous compose.yaml"}`);
|
|
8923
|
+
} else {
|
|
8924
|
+
ctx.done("rollback also unhealthy; manual intervention needed", false);
|
|
8826
8925
|
}
|
|
8827
|
-
return stale;
|
|
8828
|
-
}
|
|
8829
|
-
function maxAgeOf(answers) {
|
|
8830
|
-
const value = answers[MAX_AGE_ANSWER];
|
|
8831
|
-
if (value === void 0 || value === null || value === "")
|
|
8832
|
-
return DEFAULT_MAX_AGE;
|
|
8833
|
-
return parseMaxAge(String(value), `the answer ${MAX_AGE_ANSWER}`);
|
|
8834
|
-
}
|
|
8835
|
-
function parseMaxAge(value, what) {
|
|
8836
|
-
if (!/^\d+$/.test(value.trim()))
|
|
8837
|
-
throw new Error(`${what} is '${value}', not a whole number of days`);
|
|
8838
|
-
return Number(value.trim());
|
|
8839
8926
|
}
|
|
8840
8927
|
|
|
8928
|
+
// ../lib/dist/doctor.js
|
|
8929
|
+
import { realpath } from "node:fs/promises";
|
|
8930
|
+
import { dirname as dirname2, join as join5, relative as relative2, resolve } from "node:path";
|
|
8931
|
+
|
|
8841
8932
|
// ../lib/dist/overview.js
|
|
8842
|
-
import { join as
|
|
8933
|
+
import { join as join4 } from "node:path";
|
|
8843
8934
|
var PRUNED = /* @__PURE__ */ new Set([
|
|
8844
8935
|
"node_modules",
|
|
8845
8936
|
".hg",
|
|
@@ -8863,6 +8954,7 @@ var PRUNED = /* @__PURE__ */ new Set([
|
|
|
8863
8954
|
".terraform",
|
|
8864
8955
|
".gradle"
|
|
8865
8956
|
]);
|
|
8957
|
+
var MISE_FILE = "mise.toml";
|
|
8866
8958
|
var FETCHES = 8;
|
|
8867
8959
|
async function overview(ctx, root, options = {}) {
|
|
8868
8960
|
const opts = { git: true, fetch: false, ...options };
|
|
@@ -8899,13 +8991,80 @@ async function sync(ctx, dir) {
|
|
|
8899
8991
|
facet2.ahead = ahead;
|
|
8900
8992
|
facet2.behind = behind;
|
|
8901
8993
|
}
|
|
8902
|
-
|
|
8903
|
-
|
|
8994
|
+
var whyUnreadable = (error) => error.code ?? (error instanceof Error ? error.message : String(error));
|
|
8995
|
+
var isMissing = (error) => ["ENOENT", "ENOTDIR"].includes(error.code ?? "");
|
|
8996
|
+
async function appsOf(ctx, repo) {
|
|
8997
|
+
const read = { apps: [], links: [], unreadable: [] };
|
|
8998
|
+
const dir = join4(repo, APPS_DIR);
|
|
8999
|
+
let entries;
|
|
9000
|
+
try {
|
|
9001
|
+
entries = await ctx.readDir(dir);
|
|
9002
|
+
} catch (error) {
|
|
9003
|
+
if (!isMissing(error))
|
|
9004
|
+
read.unreadable.push({ path: dir, why: whyUnreadable(error) });
|
|
9005
|
+
return read;
|
|
9006
|
+
}
|
|
9007
|
+
for (const entry of [...entries].sort(byName)) {
|
|
9008
|
+
const path3 = join4(dir, entry.name);
|
|
9009
|
+
if (entry.symlink) {
|
|
9010
|
+
if (await isDirectory(ctx, path3))
|
|
9011
|
+
read.links.push(path3);
|
|
9012
|
+
continue;
|
|
9013
|
+
}
|
|
9014
|
+
if (!entry.directory)
|
|
9015
|
+
continue;
|
|
9016
|
+
try {
|
|
9017
|
+
if (holdsApp(await ctx.readDir(path3)))
|
|
9018
|
+
read.apps.push(path3);
|
|
9019
|
+
} catch (error) {
|
|
9020
|
+
read.unreadable.push({ path: path3, why: whyUnreadable(error) });
|
|
9021
|
+
}
|
|
9022
|
+
}
|
|
9023
|
+
return read;
|
|
9024
|
+
}
|
|
9025
|
+
var byName = (a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0;
|
|
9026
|
+
var isDirectory = (ctx, path3) => ctx.readDir(path3).then(() => true, () => false);
|
|
9027
|
+
var linksToRepo = (ctx, path3) => ctx.readDir(path3).then((entries) => entries.some((e) => e.name === ".git"), () => false);
|
|
9028
|
+
async function walk(ctx, path3, name, options, apps) {
|
|
9029
|
+
let entries;
|
|
9030
|
+
try {
|
|
9031
|
+
entries = await ctx.readDir(path3);
|
|
9032
|
+
} catch (error) {
|
|
9033
|
+
return { name, path: path3, children: [], unreadable: whyUnreadable(error) };
|
|
9034
|
+
}
|
|
9035
|
+
const dir = await facetsOf(ctx, path3, name, entries, options);
|
|
9036
|
+
const own = dir.gitRoot ? await appsOf(ctx, path3) : void 0;
|
|
9037
|
+
if (own)
|
|
9038
|
+
dir.apps = own.apps;
|
|
9039
|
+
for (const entry of [...entries].sort(byName)) {
|
|
9040
|
+
const sub = join4(path3, entry.name);
|
|
9041
|
+
if (entry.symlink) {
|
|
9042
|
+
if (apps?.links.includes(sub) || await linksToRepo(ctx, sub))
|
|
9043
|
+
dir.children.push({ name: entry.name, path: sub, symlink: true, children: [] });
|
|
9044
|
+
continue;
|
|
9045
|
+
}
|
|
9046
|
+
const app = apps?.apps.includes(sub) ?? false;
|
|
9047
|
+
if (!entry.directory || entry.name === ".git" || PRUNED.has(entry.name) && !app)
|
|
9048
|
+
continue;
|
|
9049
|
+
const child = await walk(ctx, sub, entry.name, options, own && entry.name === APPS_DIR ? own : void 0);
|
|
9050
|
+
if (app || isNotable(child) || child.children.length > 0)
|
|
9051
|
+
dir.children.push(child);
|
|
9052
|
+
}
|
|
9053
|
+
return dir;
|
|
9054
|
+
}
|
|
9055
|
+
async function directoryAt(ctx, path3) {
|
|
9056
|
+
const name = path3.replace(/\/+$/, "").split("/").pop() || path3;
|
|
9057
|
+
return facetsOf(ctx, path3, name, await ctx.readDir(path3), { git: false, fetch: false });
|
|
9058
|
+
}
|
|
9059
|
+
async function facetsOf(ctx, path3, name, entries, options) {
|
|
8904
9060
|
const files = new Set(entries.filter((e) => !e.directory).map((e) => e.name));
|
|
8905
9061
|
const names = new Set(entries.map((e) => e.name));
|
|
8906
9062
|
const dir = { name, path: path3, children: [] };
|
|
8907
|
-
if (names.has(".git")
|
|
8908
|
-
dir.
|
|
9063
|
+
if (names.has(".git")) {
|
|
9064
|
+
dir.gitRoot = true;
|
|
9065
|
+
if (options.git)
|
|
9066
|
+
dir.git = await gitFacet(ctx, path3);
|
|
9067
|
+
}
|
|
8909
9068
|
if (TEMPLATE_FILES.some((f) => files.has(f)))
|
|
8910
9069
|
dir.template = options.git ? await templateFacet(ctx, path3) : {};
|
|
8911
9070
|
if (files.has(ANSWERS_FILE)) {
|
|
@@ -8918,52 +9077,777 @@ async function walk(ctx, path3, name, options) {
|
|
|
8918
9077
|
dir.declaration = parseMarker(text);
|
|
8919
9078
|
});
|
|
8920
9079
|
}
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
9080
|
+
if (files.has(MISE_FILE)) {
|
|
9081
|
+
await facet(ctx, dir, MISE_FILE, (text) => {
|
|
9082
|
+
const pin = plxPinOf(text);
|
|
9083
|
+
if (pin)
|
|
9084
|
+
dir.pin = pin;
|
|
9085
|
+
});
|
|
8926
9086
|
}
|
|
8927
9087
|
return dir;
|
|
8928
9088
|
}
|
|
8929
9089
|
async function facet(ctx, dir, file, read) {
|
|
8930
9090
|
try {
|
|
8931
|
-
read(await ctx.readFile(
|
|
9091
|
+
read(await ctx.readFile(join4(dir.path, file)));
|
|
8932
9092
|
} catch (error) {
|
|
8933
9093
|
dir.problems ??= [];
|
|
8934
9094
|
dir.problems.push(`${file}: ${error instanceof Error ? error.message : String(error)}`);
|
|
8935
9095
|
}
|
|
8936
9096
|
}
|
|
8937
|
-
async function git(ctx, cwd, args) {
|
|
8938
|
-
try {
|
|
8939
|
-
const out = (await ctx.read("git", args, { cwd })).trim();
|
|
8940
|
-
return out === "" ? void 0 : out;
|
|
8941
|
-
} catch {
|
|
8942
|
-
return void 0;
|
|
9097
|
+
async function git(ctx, cwd, args) {
|
|
9098
|
+
try {
|
|
9099
|
+
const out = (await ctx.read("git", args, { cwd })).trim();
|
|
9100
|
+
return out === "" ? void 0 : out;
|
|
9101
|
+
} catch {
|
|
9102
|
+
return void 0;
|
|
9103
|
+
}
|
|
9104
|
+
}
|
|
9105
|
+
async function gitFacet(ctx, cwd) {
|
|
9106
|
+
const branch = await git(ctx, cwd, ["symbolic-ref", "--short", "-q", "HEAD"]) ?? await git(ctx, cwd, ["rev-parse", "--short", "HEAD"]) ?? "?";
|
|
9107
|
+
const dirty = await git(ctx, cwd, ["status", "--porcelain"]) !== void 0;
|
|
9108
|
+
const remote = await git(ctx, cwd, ["remote", "get-url", "origin"]);
|
|
9109
|
+
let defaultRef = await git(ctx, cwd, ["symbolic-ref", "--short", "-q", "refs/remotes/origin/HEAD"]);
|
|
9110
|
+
for (const b of ["main", "master"]) {
|
|
9111
|
+
if (defaultRef)
|
|
9112
|
+
break;
|
|
9113
|
+
if (await git(ctx, cwd, ["rev-parse", "--verify", "-q", `refs/heads/${b}`]))
|
|
9114
|
+
defaultRef = b;
|
|
9115
|
+
}
|
|
9116
|
+
const tag = defaultRef ? await git(ctx, cwd, ["describe", "--tags", "--abbrev=0", defaultRef]) : void 0;
|
|
9117
|
+
const facet2 = { branch, dirty };
|
|
9118
|
+
if (tag)
|
|
9119
|
+
facet2.tag = tag;
|
|
9120
|
+
if (remote)
|
|
9121
|
+
facet2.remote = shortRemote(remote);
|
|
9122
|
+
return facet2;
|
|
9123
|
+
}
|
|
9124
|
+
async function templateFacet(ctx, cwd) {
|
|
9125
|
+
const tag = await git(ctx, cwd, ["describe", "--tags", "--abbrev=0"]) ?? (await git(ctx, cwd, ["tag", "--list", "--sort=-v:refname"]))?.split("\n")[0];
|
|
9126
|
+
return tag ? { tag } : {};
|
|
9127
|
+
}
|
|
9128
|
+
|
|
9129
|
+
// ../lib/dist/standard-index.json
|
|
9130
|
+
var standard_index_default = {
|
|
9131
|
+
version: "0.124.0",
|
|
9132
|
+
citable: [
|
|
9133
|
+
"\xA7 1 PLX",
|
|
9134
|
+
"\xA7 1.1 PLX",
|
|
9135
|
+
"\xA7 1.2 PLX",
|
|
9136
|
+
"\xA7 1.3 PLX",
|
|
9137
|
+
"\xA7 1.4 PLX",
|
|
9138
|
+
"\xA7 1.5 PLX",
|
|
9139
|
+
"\xA7 1.6 PLX",
|
|
9140
|
+
"\xA7 1.7 PLX",
|
|
9141
|
+
"\xA7 1.8 PLX",
|
|
9142
|
+
"\xA7 2 PLX",
|
|
9143
|
+
"\xA7 2.1 PLX",
|
|
9144
|
+
"\xA7 2.2 PLX",
|
|
9145
|
+
"\xA7 2.3 PLX",
|
|
9146
|
+
"\xA7 2.4 PLX",
|
|
9147
|
+
"\xA7 2.5 PLX",
|
|
9148
|
+
"\xA7 2.6 PLX",
|
|
9149
|
+
"\xA7 2.7 PLX",
|
|
9150
|
+
"\xA7 3 PLX",
|
|
9151
|
+
"\xA7 3.1 PLX",
|
|
9152
|
+
"\xA7 3.2 PLX",
|
|
9153
|
+
"\xA7 3.3 PLX",
|
|
9154
|
+
"\xA7 3.4 PLX",
|
|
9155
|
+
"\xA7 4 PLX",
|
|
9156
|
+
"\xA7 4.1 PLX",
|
|
9157
|
+
"\xA7 4.2 PLX",
|
|
9158
|
+
"\xA7 4.3 PLX",
|
|
9159
|
+
"\xA7 4.4 PLX",
|
|
9160
|
+
"\xA7 4.5 PLX",
|
|
9161
|
+
"\xA7 4.6 PLX",
|
|
9162
|
+
"\xA7 4.7 PLX",
|
|
9163
|
+
"\xA7 5 PLX",
|
|
9164
|
+
"\xA7 5.1 PLX",
|
|
9165
|
+
"\xA7 5.2 PLX",
|
|
9166
|
+
"\xA7 5.3 PLX",
|
|
9167
|
+
"\xA7 6 PLX",
|
|
9168
|
+
"\xA7 6.1 PLX",
|
|
9169
|
+
"\xA7 6.2 PLX",
|
|
9170
|
+
"\xA7 6.3 PLX",
|
|
9171
|
+
"\xA7 6.4 PLX",
|
|
9172
|
+
"\xA7 6.5 PLX",
|
|
9173
|
+
"\xA7 6.6 PLX",
|
|
9174
|
+
"\xA7 6.7 PLX",
|
|
9175
|
+
"\xA7 6.8 PLX",
|
|
9176
|
+
"\xA7 6.9 PLX",
|
|
9177
|
+
"\xA7 7 PLX",
|
|
9178
|
+
"\xA7 7.1 PLX",
|
|
9179
|
+
"\xA7 7.2 PLX",
|
|
9180
|
+
"\xA7 7.3 PLX",
|
|
9181
|
+
"\xA7 7.4 PLX",
|
|
9182
|
+
"\xA7 7.5 PLX",
|
|
9183
|
+
"\xA7 7.6 PLX",
|
|
9184
|
+
"\xA7 7.7 PLX",
|
|
9185
|
+
"\xA7 8 PLX",
|
|
9186
|
+
"\xA7 8.1 PLX",
|
|
9187
|
+
"\xA7 8.2 PLX",
|
|
9188
|
+
"\xA7 8.3 PLX",
|
|
9189
|
+
"\xA7 8.4 PLX",
|
|
9190
|
+
"\xA7 8.5 PLX",
|
|
9191
|
+
"\xA7 8.6 PLX",
|
|
9192
|
+
"\xA7 8.7 PLX",
|
|
9193
|
+
"\xA7 9 PLX",
|
|
9194
|
+
"\xA7 10 PLX",
|
|
9195
|
+
"\xA7 10.1 PLX",
|
|
9196
|
+
"\xA7 10.2 PLX",
|
|
9197
|
+
"\xA7 10.3 PLX",
|
|
9198
|
+
"\xA7 10.4 PLX",
|
|
9199
|
+
"\xA7 10.5 PLX",
|
|
9200
|
+
"\xA7 11 PLX",
|
|
9201
|
+
"\xA7 11.1 PLX",
|
|
9202
|
+
"\xA7 11.2 PLX",
|
|
9203
|
+
"\xA7 11.3 PLX",
|
|
9204
|
+
"\xA7 11.4 PLX",
|
|
9205
|
+
"\xA7 11.5 PLX",
|
|
9206
|
+
"\xA7 11.6 PLX",
|
|
9207
|
+
"\xA7 12 PLX",
|
|
9208
|
+
"\xA7 12.1 PLX",
|
|
9209
|
+
"\xA7 12.2 PLX",
|
|
9210
|
+
"\xA7 12.3 PLX",
|
|
9211
|
+
"\xA7 12.4 PLX",
|
|
9212
|
+
"\xA7 12.5 PLX",
|
|
9213
|
+
"\xA7 12.6 PLX",
|
|
9214
|
+
"\xA7 13 PLX",
|
|
9215
|
+
"\xA7 13.1 PLX",
|
|
9216
|
+
"\xA7 13.2 PLX",
|
|
9217
|
+
"\xA7 13.3 PLX",
|
|
9218
|
+
"\xA7 13.4 PLX",
|
|
9219
|
+
"\xA7 13.5 PLX",
|
|
9220
|
+
"\xA7 1 PLX-App",
|
|
9221
|
+
"\xA7 2 PLX-App",
|
|
9222
|
+
"\xA7 3 PLX-App",
|
|
9223
|
+
"\xA7 4 PLX-App",
|
|
9224
|
+
"\xA7 5 PLX-App",
|
|
9225
|
+
"\xA7 6 PLX-App",
|
|
9226
|
+
"\xA7 7 PLX-App",
|
|
9227
|
+
"\xA7 8 PLX-App",
|
|
9228
|
+
"\xA7 9 PLX-App",
|
|
9229
|
+
"\xA7 9.1 PLX-App",
|
|
9230
|
+
"\xA7 9.2 PLX-App",
|
|
9231
|
+
"\xA7 9.3 PLX-App",
|
|
9232
|
+
"PLX-App/Marker",
|
|
9233
|
+
"PLX-App/Compose",
|
|
9234
|
+
"PLX-App/TenantLabel",
|
|
9235
|
+
"PLX-App/SourceRepo",
|
|
9236
|
+
"PLX-App/ComposeDelivery",
|
|
9237
|
+
"PLX-App/EnvFiles",
|
|
9238
|
+
"PLX-App/EnvFileLoad",
|
|
9239
|
+
"PLX-App/NoCommittedValues",
|
|
9240
|
+
"PLX-App/ReservedPrefix",
|
|
9241
|
+
"PLX-App/ImageRef",
|
|
9242
|
+
"PLX-App/SinglePort",
|
|
9243
|
+
"PLX-App/LoopbackPort",
|
|
9244
|
+
"PLX-App/PathPrefix",
|
|
9245
|
+
"PLX-App/Healthcheck",
|
|
9246
|
+
"PLX-App/Logs",
|
|
9247
|
+
"PLX-App/Pipeline",
|
|
9248
|
+
"PLX-App/Dockerfile",
|
|
9249
|
+
"PLX-App/Stateless/NoState",
|
|
9250
|
+
"PLX-App/Stateful/BackupLabel",
|
|
9251
|
+
"PLX-App/Stateful/OwnDatabase",
|
|
9252
|
+
"PLX-App/Stateful/MigrateService",
|
|
9253
|
+
"PLX-App/Stateful/MigrateIdempotent",
|
|
9254
|
+
"PLX-App/Stateful/MigrateResumable",
|
|
9255
|
+
"PLX-App/Stateful/MigrateConcurrent",
|
|
9256
|
+
"PLX-App/Stateful/ExpandContract",
|
|
9257
|
+
"PLX-App/Stateful/BreakingMigration",
|
|
9258
|
+
"PLX-App/Stateful/Seed",
|
|
9259
|
+
"\xA7 1 PLX-Environment",
|
|
9260
|
+
"\xA7 2 PLX-Environment",
|
|
9261
|
+
"\xA7 1 PLX-Host",
|
|
9262
|
+
"\xA7 2 PLX-Host",
|
|
9263
|
+
"\xA7 1 PLX-Repo",
|
|
9264
|
+
"\xA7 2 PLX-Repo",
|
|
9265
|
+
"\xA7 3 PLX-Repo",
|
|
9266
|
+
"PLX-Repo/Marker",
|
|
9267
|
+
"PLX-Repo/Toolchain",
|
|
9268
|
+
"PLX-Repo/CanonicalHome",
|
|
9269
|
+
"PLX-Repo/Hooks",
|
|
9270
|
+
"PLX-Repo/HooksDelegate",
|
|
9271
|
+
"PLX-Repo/NoTaskGraph",
|
|
9272
|
+
"PLX-Repo/Verbs",
|
|
9273
|
+
"PLX-Repo/SubVerbs",
|
|
9274
|
+
"PLX-Repo/VerbSemantics",
|
|
9275
|
+
"PLX-Repo/FreshCheckout",
|
|
9276
|
+
"PLX-Repo/OperatorBoundary",
|
|
9277
|
+
"\xA7 1 PLX-Tenancy",
|
|
9278
|
+
"\xA7 2 PLX-Tenancy",
|
|
9279
|
+
"\xA7 3 PLX-Tenancy",
|
|
9280
|
+
"\xA7 4 PLX-Tenancy",
|
|
9281
|
+
"PLX-Tenancy/SharedMethodology",
|
|
9282
|
+
"PLX-Tenancy/NoSharedSubstance",
|
|
9283
|
+
"PLX-Tenancy/Slug",
|
|
9284
|
+
"PLX-Tenancy/SlugEverywhere",
|
|
9285
|
+
"PLX-Tenancy/SeparateOrgs",
|
|
9286
|
+
"PLX-Tenancy/OperationsRepo",
|
|
9287
|
+
"PLX-Tenancy/NoAppSourceInOperations",
|
|
9288
|
+
"PLX-Tenancy/RepoNames",
|
|
9289
|
+
"PLX-Tenancy/HypervisorSeparation",
|
|
9290
|
+
"PLX-Tenancy/PerTenantPlatform",
|
|
9291
|
+
"PLX-Tenancy/WrittenArrangement",
|
|
9292
|
+
"\xA7 1 PLX-CLI",
|
|
9293
|
+
"\xA7 2 PLX-CLI",
|
|
9294
|
+
"\xA7 3 PLX-CLI",
|
|
9295
|
+
"\xA7 4 PLX-CLI",
|
|
9296
|
+
"\xA7 5 PLX-CLI",
|
|
9297
|
+
"\xA7 6 PLX-CLI",
|
|
9298
|
+
"\xA7 1 PLX-Delivery",
|
|
9299
|
+
"\xA7 2 PLX-Delivery",
|
|
9300
|
+
"\xA7 3 PLX-Delivery",
|
|
9301
|
+
"\xA7 4 PLX-Delivery",
|
|
9302
|
+
"\xA7 5 PLX-Delivery",
|
|
9303
|
+
"\xA7 6 PLX-Delivery",
|
|
9304
|
+
"\xA7 7 PLX-Delivery",
|
|
9305
|
+
"\xA7 8 PLX-Delivery",
|
|
9306
|
+
"PLX-Delivery/ReleaseVerified",
|
|
9307
|
+
"PLX-Delivery/NoControlPlane",
|
|
9308
|
+
"PLX-Delivery/Forge",
|
|
9309
|
+
"PLX-Delivery/GeneratedWorkflows",
|
|
9310
|
+
"PLX-Delivery/NoWorkflowLogic",
|
|
9311
|
+
"PLX-Delivery/EnvironmentBranches",
|
|
9312
|
+
"PLX-Delivery/OperationsTrunk",
|
|
9313
|
+
"PLX-Delivery/NoAppChangesets",
|
|
9314
|
+
"PLX-Delivery/HotfixBackMerge",
|
|
9315
|
+
"PLX-Delivery/FastForwardPromotion",
|
|
9316
|
+
"PLX-Delivery/PromotableDevelop",
|
|
9317
|
+
"PLX-Delivery/NoSelectivePromotion",
|
|
9318
|
+
"PLX-Delivery/SingleMonorepo",
|
|
9319
|
+
"PLX-Delivery/PromotionFreeze",
|
|
9320
|
+
"PLX-Delivery/Recovery",
|
|
9321
|
+
"PLX-Delivery/PrivateRunners",
|
|
9322
|
+
"PLX-Delivery/CIVault",
|
|
9323
|
+
"\xA7 1 PLX-Infrastructure",
|
|
9324
|
+
"\xA7 2 PLX-Infrastructure",
|
|
9325
|
+
"\xA7 3 PLX-Infrastructure",
|
|
9326
|
+
"\xA7 1 PLX-Ingress",
|
|
9327
|
+
"\xA7 2 PLX-Ingress",
|
|
9328
|
+
"PLX-Ingress/PrefixInRecord",
|
|
9329
|
+
"PLX-Ingress/OneAppPerPrefix",
|
|
9330
|
+
"\xA7 1 PLX-JS",
|
|
9331
|
+
"PLX-JS/TaskGraph",
|
|
9332
|
+
"PLX-JS/NoLeafMise",
|
|
9333
|
+
"PLX-JS/DevTools",
|
|
9334
|
+
"PLX-JS/NoEngines",
|
|
9335
|
+
"\xA7 1 PLX-Platform",
|
|
9336
|
+
"\xA7 2 PLX-Platform",
|
|
9337
|
+
"\xA7 3 PLX-Platform",
|
|
9338
|
+
"PLX-Platform/OwnPlays",
|
|
9339
|
+
"PLX-Platform/AppRecord",
|
|
9340
|
+
"PLX-Platform/UniqueAppName",
|
|
9341
|
+
"PLX-Platform/RecordValues",
|
|
9342
|
+
"\xA7 1 PLX-Secrets",
|
|
9343
|
+
"\xA7 2 PLX-Secrets",
|
|
9344
|
+
"\xA7 3 PLX-Secrets",
|
|
9345
|
+
"PLX-Secrets/VaultOnly",
|
|
9346
|
+
"PLX-Secrets/OnePassword",
|
|
9347
|
+
"\xA7 1 PLX-Updates",
|
|
9348
|
+
"\xA7 2 PLX-Updates",
|
|
9349
|
+
"\xA7 3 PLX-Updates",
|
|
9350
|
+
"PLX-Updates/VersionedDependency",
|
|
9351
|
+
"PLX-Updates/LocalConfig",
|
|
9352
|
+
"PLX-Updates/UpdateBot",
|
|
9353
|
+
"PLX-Updates/FromTemplates",
|
|
9354
|
+
"PLX-Updates/Interval"
|
|
9355
|
+
]
|
|
9356
|
+
};
|
|
9357
|
+
|
|
9358
|
+
// ../lib/dist/standardIndex.js
|
|
9359
|
+
var STANDARD_INDEX_FILE = "packages/lib/src/standard-index.json";
|
|
9360
|
+
var bundledIndex = () => checked(standard_index_default);
|
|
9361
|
+
function checked(value) {
|
|
9362
|
+
const { version: version2, citable } = value ?? {};
|
|
9363
|
+
if (typeof version2 !== "string" || !Array.isArray(citable) || !citable.every((c) => typeof c === "string"))
|
|
9364
|
+
throw new Error(`${STANDARD_INDEX_FILE} is not a citable index`);
|
|
9365
|
+
return { version: version2, citable };
|
|
9366
|
+
}
|
|
9367
|
+
|
|
9368
|
+
// ../lib/dist/doctor.js
|
|
9369
|
+
var ROOT_VERBS = ["dev", "build", "verify"];
|
|
9370
|
+
var SUB_VERBS = ["lint", "check", "test", "verify"];
|
|
9371
|
+
function repoMarker(repo) {
|
|
9372
|
+
if (!repo.marker)
|
|
9373
|
+
return [`no ${MARKER_FILE} at the repo's root`];
|
|
9374
|
+
return repo.marker.problem ? [repo.marker.problem] : [];
|
|
9375
|
+
}
|
|
9376
|
+
var missingTasks = (repo, wanted) => "names" in repo.tasks ? wanted.filter((t) => !repo.tasks.names.includes(t)).map((t) => `no root mise task \`${t}\``) : [];
|
|
9377
|
+
function verbs(repo) {
|
|
9378
|
+
if ("problem" in repo.tasks)
|
|
9379
|
+
return [`mise could not list the tasks: ${repo.tasks.problem}`];
|
|
9380
|
+
return missingTasks(repo, ROOT_VERBS);
|
|
9381
|
+
}
|
|
9382
|
+
var subVerbs = (repo) => missingTasks(repo, SUB_VERBS);
|
|
9383
|
+
function appMarker(app) {
|
|
9384
|
+
const { declaration, problem } = app.marker;
|
|
9385
|
+
if (problem || !declaration)
|
|
9386
|
+
return [problem ?? `no ${MARKER_FILE}`];
|
|
9387
|
+
if (declaration.profile === void 0)
|
|
9388
|
+
return ["the marker sets no `profile`: stateless or stateful"];
|
|
9389
|
+
if (!isProfile(declaration.profile))
|
|
9390
|
+
return [`\`profile\` is \`${declaration.profile}\`, not stateless or stateful`];
|
|
9391
|
+
return [];
|
|
9392
|
+
}
|
|
9393
|
+
function composeFile(app) {
|
|
9394
|
+
if (app.composeProblem)
|
|
9395
|
+
return [app.composeProblem];
|
|
9396
|
+
if (!app.compose)
|
|
9397
|
+
return ["no docker/compose.yaml"];
|
|
9398
|
+
if (!app.compose.services[APP_SERVICE])
|
|
9399
|
+
return [
|
|
9400
|
+
`docker/compose.yaml declares no \`${APP_SERVICE}\` service${app.compose.includes ? " itself (the files it includes are not read)" : ""}, the app service the deploy verb reads`
|
|
9401
|
+
];
|
|
9402
|
+
return [];
|
|
9403
|
+
}
|
|
9404
|
+
function tenantLabel(compose) {
|
|
9405
|
+
return Object.entries(compose.services).filter(([, service]) => (labelsOf(service)["plexus.tenant"] ?? "").trim() === "").map(([name]) => `service \`${name}\` carries no \`plexus.tenant\` label`);
|
|
9406
|
+
}
|
|
9407
|
+
function envFileLoad(compose) {
|
|
9408
|
+
const loaded = envFilesOf(compose.services[APP_SERVICE] ?? {});
|
|
9409
|
+
const problems = [];
|
|
9410
|
+
if (!loaded.has(".env"))
|
|
9411
|
+
problems.push(`the ${APP_SERVICE} service does not load .env via env_file`);
|
|
9412
|
+
const secret = loaded.get(".env.secret");
|
|
9413
|
+
if (secret === void 0)
|
|
9414
|
+
problems.push(`the ${APP_SERVICE} service does not load .env.secret via env_file`);
|
|
9415
|
+
else if (secret)
|
|
9416
|
+
problems.push(".env.secret is loaded, but not marked `required: false`");
|
|
9417
|
+
return problems;
|
|
9418
|
+
}
|
|
9419
|
+
var IMAGE_REF = /^\$\{PLEXUS_DEPLOYMENT_IMAGE(:\?[^}]*)?\}$/;
|
|
9420
|
+
function imageRef(compose) {
|
|
9421
|
+
const image = compose.services[APP_SERVICE]?.image;
|
|
9422
|
+
if (typeof image === "string" && IMAGE_REF.test(image))
|
|
9423
|
+
return [];
|
|
9424
|
+
return [
|
|
9425
|
+
image === void 0 ? `the ${APP_SERVICE} service names no image; a built app's is \${PLEXUS_DEPLOYMENT_IMAGE}` : `the ${APP_SERVICE} service's image is \`${String(image)}\`, not \${PLEXUS_DEPLOYMENT_IMAGE}`
|
|
9426
|
+
];
|
|
9427
|
+
}
|
|
9428
|
+
function noCommittedValues(unit) {
|
|
9429
|
+
const repo = unit.kind === "app" ? unit.repo : unit;
|
|
9430
|
+
if (repo.apps.length === 0)
|
|
9431
|
+
return [];
|
|
9432
|
+
const within = (file, dir) => file.startsWith(`${dir}/`);
|
|
9433
|
+
const held = (file) => unit.kind === "app" ? within(file, unit.dir) : !repo.apps.some((dir) => within(file, dir));
|
|
9434
|
+
return (repo.tracked ?? []).filter((f) => /(^|\/)\.env(\.secret)?$/.test(f) && held(f)).map((f) => `the source repo tracks \`${f}\``);
|
|
9435
|
+
}
|
|
9436
|
+
function singlePort(compose) {
|
|
9437
|
+
const ports = portsOf(compose.services[APP_SERVICE] ?? {});
|
|
9438
|
+
if (ports.length === 1)
|
|
9439
|
+
return [];
|
|
9440
|
+
return [
|
|
9441
|
+
ports.length === 0 ? `the ${APP_SERVICE} service publishes no port` : `the ${APP_SERVICE} service publishes ${ports.length} ports, not one`
|
|
9442
|
+
];
|
|
9443
|
+
}
|
|
9444
|
+
var LOOPBACK_PORT = `\${PLEXUS_LOOPBACK_PORT}`;
|
|
9445
|
+
var LOOPBACK_FORM = `127.0.0.1:${LOOPBACK_PORT}:<container-port>`;
|
|
9446
|
+
var isLoopbackVar = (host) => /^(?:\$\{PLEXUS_LOOPBACK_PORT(?::\?[^}]*)?\}|\$PLEXUS_LOOPBACK_PORT)$/.test(host);
|
|
9447
|
+
function loopbackPort(compose) {
|
|
9448
|
+
const problems = [];
|
|
9449
|
+
const own = portsOf(compose.services[APP_SERVICE] ?? {});
|
|
9450
|
+
if (own.length === 0)
|
|
9451
|
+
problems.push(`the ${APP_SERVICE} service publishes no port as ${LOOPBACK_FORM}`);
|
|
9452
|
+
for (const port of own)
|
|
9453
|
+
if (!isLoopback(port))
|
|
9454
|
+
problems.push(`the ${APP_SERVICE} service publishes \`${renderPort(port)}\`, not ${LOOPBACK_FORM}`);
|
|
9455
|
+
for (const [name, service] of Object.entries(compose.services)) {
|
|
9456
|
+
if (name === APP_SERVICE)
|
|
9457
|
+
continue;
|
|
9458
|
+
for (const port of portsOf(service)) {
|
|
9459
|
+
const host = hostPortOf(port);
|
|
9460
|
+
if (host && !isLoopbackVar(host))
|
|
9461
|
+
problems.push(`service \`${name}\` fixes host port \`${host}\` (\`${renderPort(port)}\`)`);
|
|
9462
|
+
}
|
|
9463
|
+
}
|
|
9464
|
+
return problems;
|
|
9465
|
+
}
|
|
9466
|
+
function healthcheck(compose) {
|
|
9467
|
+
if (declaresHealthcheck(healthcheckOf(compose)))
|
|
9468
|
+
return [];
|
|
9469
|
+
return [`the ${APP_SERVICE} service declares no healthcheck with a test of its own`];
|
|
9470
|
+
}
|
|
9471
|
+
var dockerfile = (app) => app.dockerfile ? [] : ["no docker/Dockerfile"];
|
|
9472
|
+
function noState(compose) {
|
|
9473
|
+
const problems = [];
|
|
9474
|
+
if (compose.services.migrate)
|
|
9475
|
+
problems.push("a stateless app declares a `migrate` service");
|
|
9476
|
+
for (const [name, service] of Object.entries(compose.services))
|
|
9477
|
+
if ("plexus.backup" in labelsOf(service))
|
|
9478
|
+
problems.push(`service \`${name}\` of a stateless app carries a \`plexus.backup\` label`);
|
|
9479
|
+
return problems;
|
|
9480
|
+
}
|
|
9481
|
+
function migrateService(compose) {
|
|
9482
|
+
const migrate = compose.services.migrate;
|
|
9483
|
+
if (!migrate)
|
|
9484
|
+
return ["declares no `migrate` service"];
|
|
9485
|
+
const problems = [];
|
|
9486
|
+
const profiles = Array.isArray(migrate.profiles) ? migrate.profiles.map(String) : [];
|
|
9487
|
+
if (!profiles.includes("migrate"))
|
|
9488
|
+
problems.push('the `migrate` service is not under `profiles: ["migrate"]`, so a plain `up` starts it');
|
|
9489
|
+
const own = compose.services[APP_SERVICE]?.image;
|
|
9490
|
+
const same = typeof own === "string" && typeof migrate.image === "string" && normalImage(migrate.image) === normalImage(own);
|
|
9491
|
+
if (own !== void 0 && !same)
|
|
9492
|
+
problems.push(`the \`migrate\` service runs \`${String(migrate.image ?? "no image")}\`, not the app's own image \`${String(own)}\``);
|
|
9493
|
+
return problems;
|
|
9494
|
+
}
|
|
9495
|
+
function seed(app) {
|
|
9496
|
+
if (app.packageJsonProblem)
|
|
9497
|
+
return [app.packageJsonProblem];
|
|
9498
|
+
const scripts = app.packageJson?.scripts;
|
|
9499
|
+
if (!app.packageJson || isMapping(scripts) && typeof scripts.seed === "string" && scripts.seed.trim() !== "")
|
|
9500
|
+
return [];
|
|
9501
|
+
return ["package.json has no `seed` script"];
|
|
9502
|
+
}
|
|
9503
|
+
var onCompose = (check) => (app) => app.compose ? check(app.compose) : [];
|
|
9504
|
+
var onAppService = (check) => (app) => app.compose?.services[APP_SERVICE] ? check(app.compose) : [];
|
|
9505
|
+
var CHECKS = {
|
|
9506
|
+
"PLX-Repo/Marker": { binds: "repo", check: repoMarker },
|
|
9507
|
+
"PLX-Repo/Verbs": { binds: "repo", check: verbs },
|
|
9508
|
+
"PLX-Repo/SubVerbs": { binds: "repo", check: subVerbs },
|
|
9509
|
+
"PLX-App/Marker": { binds: "app", check: appMarker },
|
|
9510
|
+
"PLX-App/Compose": { binds: "app", check: composeFile },
|
|
9511
|
+
"PLX-App/TenantLabel": { binds: "app", check: onCompose(tenantLabel) },
|
|
9512
|
+
"PLX-App/EnvFileLoad": { binds: "app", check: onAppService(envFileLoad) },
|
|
9513
|
+
"PLX-App/ImageRef": { binds: "app", built: true, check: onAppService(imageRef) },
|
|
9514
|
+
"PLX-App/NoCommittedValues": { binds: "unit", check: noCommittedValues },
|
|
9515
|
+
"PLX-App/SinglePort": { binds: "app", check: onAppService(singlePort) },
|
|
9516
|
+
"PLX-App/LoopbackPort": { binds: "app", check: onAppService(loopbackPort) },
|
|
9517
|
+
"PLX-App/Healthcheck": { binds: "app", check: onAppService(healthcheck) },
|
|
9518
|
+
"PLX-App/Dockerfile": { binds: "app", built: true, check: dockerfile },
|
|
9519
|
+
"PLX-App/Stateless/NoState": { binds: "app", profile: "stateless", check: onCompose(noState) },
|
|
9520
|
+
"PLX-App/Stateful/MigrateService": { binds: "app", profile: "stateful", check: onAppService(migrateService) },
|
|
9521
|
+
"PLX-App/Stateful/Seed": { binds: "app", profile: "stateful", check: seed }
|
|
9522
|
+
};
|
|
9523
|
+
var isProfile = (value) => value === "stateless" || value === "stateful";
|
|
9524
|
+
var knownRequirements = () => new Set(bundledIndex().citable.filter((c) => new RegExp(`^${REQUIREMENT_NAME}$`).test(c)));
|
|
9525
|
+
function diagnose(facts, known = knownRequirements()) {
|
|
9526
|
+
const units = facts.map((unit) => diagnoseUnit(unit, known));
|
|
9527
|
+
return { units, failed: units.filter((u) => u.findings.length > 0).length };
|
|
9528
|
+
}
|
|
9529
|
+
function diagnoseUnit(unit, known) {
|
|
9530
|
+
const declaration = unit.marker?.declaration;
|
|
9531
|
+
const deviations = declaration?.deviations ?? [];
|
|
9532
|
+
const profile = unit.kind === "app" && isProfile(declaration?.profile) ? declaration.profile : void 0;
|
|
9533
|
+
const findings = [];
|
|
9534
|
+
for (const name of deviations) {
|
|
9535
|
+
if (!known.has(name))
|
|
9536
|
+
findings.push({ requirement: name, problem: "listed under `deviations`, but no requirement has this name" });
|
|
9537
|
+
else if (!reasonGiven(declaration?.body ?? "", name))
|
|
9538
|
+
findings.push({
|
|
9539
|
+
requirement: name,
|
|
9540
|
+
problem: "listed under `deviations`, but no bullet of the marker's body names it with a reason"
|
|
9541
|
+
});
|
|
9542
|
+
}
|
|
9543
|
+
for (const [name, c] of Object.entries(CHECKS)) {
|
|
9544
|
+
if (deviations.includes(name))
|
|
9545
|
+
continue;
|
|
9546
|
+
for (const problem of run2(c, unit, profile))
|
|
9547
|
+
findings.push({ requirement: name, problem });
|
|
9548
|
+
}
|
|
9549
|
+
const obsolete = (declaration?.obsolete ?? []).map((k) => `\`${k}\``).join(" and ");
|
|
9550
|
+
const hints = [];
|
|
9551
|
+
if (obsolete)
|
|
9552
|
+
hints.push(`the marker's ${obsolete} ${obsolete.includes(" and ") ? "are" : "is"} no longer read and can go`);
|
|
9553
|
+
if (unit.kind === "app" && unit.compose?.includes)
|
|
9554
|
+
hints.push("docker/compose.yaml uses `include`: the compose checks read what the file itself declares, not the files it includes");
|
|
9555
|
+
return {
|
|
9556
|
+
path: unit.path,
|
|
9557
|
+
kind: unit.kind,
|
|
9558
|
+
...profile ? { profile } : {},
|
|
9559
|
+
deviations,
|
|
9560
|
+
findings,
|
|
9561
|
+
...hints.length > 0 ? { hints } : {}
|
|
9562
|
+
};
|
|
9563
|
+
}
|
|
9564
|
+
function run2(c, unit, profile) {
|
|
9565
|
+
if (c.binds === "unit")
|
|
9566
|
+
return c.check(unit);
|
|
9567
|
+
if (c.binds === "repo")
|
|
9568
|
+
return unit.kind === "app" ? [] : c.check(unit);
|
|
9569
|
+
if (unit.kind !== "app")
|
|
9570
|
+
return [];
|
|
9571
|
+
if (c.profile && c.profile !== profile)
|
|
9572
|
+
return [];
|
|
9573
|
+
if (c.built && unit.thirdParty)
|
|
9574
|
+
return [];
|
|
9575
|
+
return c.check(unit);
|
|
9576
|
+
}
|
|
9577
|
+
async function examine(ctx, dir) {
|
|
9578
|
+
const given = resolve(dir);
|
|
9579
|
+
const own = await ctx.readDir(given).catch(() => []);
|
|
9580
|
+
let top = own.some((e) => e.name === ".git") ? given : void 0;
|
|
9581
|
+
const tree = top ? void 0 : await overview(ctx, given, { git: false });
|
|
9582
|
+
if (tree && !holdsGitRoot(tree))
|
|
9583
|
+
top = await enclosingGitRoot(ctx, dirname2(given));
|
|
9584
|
+
if (top) {
|
|
9585
|
+
const repo = await directoryAt(ctx, top);
|
|
9586
|
+
const found = await appsOf(ctx, top);
|
|
9587
|
+
const rel2 = (path3) => relative2(top, path3);
|
|
9588
|
+
return {
|
|
9589
|
+
root: top,
|
|
9590
|
+
inRepo: true,
|
|
9591
|
+
facts: await readUnits(ctx, repo, found.apps, top),
|
|
9592
|
+
skipped: [],
|
|
9593
|
+
links: found.links.map(rel2),
|
|
9594
|
+
unreadable: found.unreadable.map(({ path: path3, why }) => ({ path: rel2(path3), why }))
|
|
9595
|
+
};
|
|
9596
|
+
}
|
|
9597
|
+
const examination = { root: given, inRepo: false, facts: [], skipped: [], links: [], unreadable: [] };
|
|
9598
|
+
const rel = (path3) => relative2(given, path3) || ".";
|
|
9599
|
+
const visit = async (d) => {
|
|
9600
|
+
if (d.unreadable)
|
|
9601
|
+
examination.unreadable.push({ path: rel(d.path), why: d.unreadable });
|
|
9602
|
+
if (d.symlink)
|
|
9603
|
+
examination.links.push(rel(d.path));
|
|
9604
|
+
if (d.gitRoot) {
|
|
9605
|
+
const apps = d.apps ?? [];
|
|
9606
|
+
if (hasMarker(d) || apps.length > 0)
|
|
9607
|
+
examination.facts.push(...await readUnits(ctx, d, apps, given));
|
|
9608
|
+
else
|
|
9609
|
+
examination.skipped.push(rel(d.path));
|
|
9610
|
+
}
|
|
9611
|
+
for (const child of d.children)
|
|
9612
|
+
await visit(child);
|
|
9613
|
+
};
|
|
9614
|
+
if (tree)
|
|
9615
|
+
await visit(tree);
|
|
9616
|
+
return examination;
|
|
9617
|
+
}
|
|
9618
|
+
var holdsGitRoot = (d) => Boolean(d.gitRoot) || d.children.some(holdsGitRoot);
|
|
9619
|
+
async function enclosingGitRoot(ctx, dir) {
|
|
9620
|
+
for (let at = resolve(dir); ; at = dirname2(at)) {
|
|
9621
|
+
const entries = await ctx.readDir(at).catch(() => []);
|
|
9622
|
+
if (entries.some((e) => e.name === ".git"))
|
|
9623
|
+
return at;
|
|
9624
|
+
if (dirname2(at) === at)
|
|
9625
|
+
return void 0;
|
|
9626
|
+
}
|
|
9627
|
+
}
|
|
9628
|
+
async function readUnits(ctx, dir, apps, base) {
|
|
9629
|
+
const repo = await readRepo(ctx, dir, relative2(base, dir.path) || ".", isOperations(dir) ? "operations" : "repo");
|
|
9630
|
+
repo.apps = apps.map((path3) => relative2(dir.path, path3));
|
|
9631
|
+
const facts = [repo];
|
|
9632
|
+
for (const path3 of apps)
|
|
9633
|
+
facts.push(await readApp(ctx, await directoryAt(ctx, path3), relative2(base, path3), relative2(dir.path, path3), repo));
|
|
9634
|
+
return facts;
|
|
9635
|
+
}
|
|
9636
|
+
function markerOf(dir) {
|
|
9637
|
+
if (dir.declaration)
|
|
9638
|
+
return { declaration: dir.declaration };
|
|
9639
|
+
const problem = dir.problems?.find((p) => p.startsWith(`${MARKER_FILE}: `));
|
|
9640
|
+
return problem ? { problem } : void 0;
|
|
9641
|
+
}
|
|
9642
|
+
async function readRepo(ctx, dir, path3, kind) {
|
|
9643
|
+
const marker = markerOf(dir);
|
|
9644
|
+
const tracked = await ctx.read("git", ["ls-files", "-z"], { cwd: dir.path }).then((out) => out.split("\0").filter(Boolean)).catch((error) => {
|
|
9645
|
+
if (error instanceof ExecError)
|
|
9646
|
+
return void 0;
|
|
9647
|
+
throw error;
|
|
9648
|
+
});
|
|
9649
|
+
return { kind, path: path3, ...marker ? { marker } : {}, tasks: await rootTasks(ctx, dir.path), tracked, apps: [] };
|
|
9650
|
+
}
|
|
9651
|
+
async function rootTasks(ctx, repo) {
|
|
9652
|
+
let out;
|
|
9653
|
+
try {
|
|
9654
|
+
out = await ctx.read("mise", ["tasks", "ls", "--json", "--hidden"], { cwd: repo });
|
|
9655
|
+
} catch (error) {
|
|
9656
|
+
if (error.code === "ENOENT")
|
|
9657
|
+
return { problem: "mise is not on PATH" };
|
|
9658
|
+
if (!(error instanceof ExecError))
|
|
9659
|
+
return { problem: error.message };
|
|
9660
|
+
const lines = error.stderr.split("\n").map((l) => l.replace(/^mise ERROR /, "").trim()).filter((l) => l && !/^(Version:|Run with )/.test(l));
|
|
9661
|
+
return { problem: lines.join(" ") || error.message };
|
|
9662
|
+
}
|
|
9663
|
+
let tasks;
|
|
9664
|
+
try {
|
|
9665
|
+
tasks = JSON.parse(out);
|
|
9666
|
+
} catch {
|
|
9667
|
+
return { problem: "`mise tasks ls --json` printed no JSON" };
|
|
9668
|
+
}
|
|
9669
|
+
if (!Array.isArray(tasks))
|
|
9670
|
+
return { problem: "`mise tasks ls --json` printed no list" };
|
|
9671
|
+
const listed = tasks.filter((t) => isMapping(t) && typeof t.name === "string");
|
|
9672
|
+
if (listed.some((t) => typeof t.source !== "string"))
|
|
9673
|
+
return { problem: "`mise tasks ls --json` gives no task's `source`, which tells the repo's own tasks apart" };
|
|
9674
|
+
const roots = /* @__PURE__ */ new Set([resolve(repo), await realpath(repo).catch(() => resolve(repo))]);
|
|
9675
|
+
const under = (path3) => [...roots].some((root) => path3.startsWith(`${root}/`));
|
|
9676
|
+
const isOwn = (task) => task.global !== true && (under(resolve(String(task.source))) || typeof task.dir === "string" && roots.has(resolve(task.dir)));
|
|
9677
|
+
const names = [];
|
|
9678
|
+
for (const task of listed) {
|
|
9679
|
+
if (!isOwn(task))
|
|
9680
|
+
continue;
|
|
9681
|
+
const aliases = Array.isArray(task.aliases) ? task.aliases.filter((a) => typeof a === "string") : [];
|
|
9682
|
+
for (const name of [task.name, ...aliases]) {
|
|
9683
|
+
if (name.startsWith("//:"))
|
|
9684
|
+
names.push(name.slice(3));
|
|
9685
|
+
else if (!name.startsWith("//"))
|
|
9686
|
+
names.push(name);
|
|
9687
|
+
}
|
|
9688
|
+
}
|
|
9689
|
+
return { names };
|
|
9690
|
+
}
|
|
9691
|
+
async function readApp(ctx, dir, path3, inRepo, repo) {
|
|
9692
|
+
const app = {
|
|
9693
|
+
kind: "app",
|
|
9694
|
+
path: path3,
|
|
9695
|
+
repo,
|
|
9696
|
+
dir: inRepo,
|
|
9697
|
+
thirdParty: repo.kind === "operations",
|
|
9698
|
+
marker: markerOf(dir) ?? {},
|
|
9699
|
+
dockerfile: (await ctx.readDir(join5(dir.path, "docker")).catch(() => [])).some((e) => e.name === "Dockerfile" && !e.directory)
|
|
9700
|
+
};
|
|
9701
|
+
const compose = await ctx.readFile(join5(dir.path, "docker/compose.yaml")).catch(() => void 0);
|
|
9702
|
+
if (compose !== void 0) {
|
|
9703
|
+
try {
|
|
9704
|
+
app.compose = parseCompose(compose, "docker/compose.yaml");
|
|
9705
|
+
} catch (error) {
|
|
9706
|
+
app.composeProblem = error.message;
|
|
9707
|
+
}
|
|
9708
|
+
}
|
|
9709
|
+
const manifest2 = await ctx.readFile(join5(dir.path, "package.json")).catch(() => void 0);
|
|
9710
|
+
if (manifest2 !== void 0) {
|
|
9711
|
+
try {
|
|
9712
|
+
const data = JSON.parse(manifest2);
|
|
9713
|
+
app.packageJson = isMapping(data) ? data : {};
|
|
9714
|
+
} catch {
|
|
9715
|
+
app.packageJsonProblem = "package.json is not JSON";
|
|
9716
|
+
}
|
|
9717
|
+
}
|
|
9718
|
+
return app;
|
|
9719
|
+
}
|
|
9720
|
+
function envFilesOf(service) {
|
|
9721
|
+
const { env_file: files } = service;
|
|
9722
|
+
const entries = files === void 0 ? [] : Array.isArray(files) ? files : [files];
|
|
9723
|
+
const loaded = /* @__PURE__ */ new Map();
|
|
9724
|
+
for (const entry of entries) {
|
|
9725
|
+
const path3 = isMapping(entry) ? entry.path : entry;
|
|
9726
|
+
if (typeof path3 !== "string")
|
|
9727
|
+
continue;
|
|
9728
|
+
const required = isMapping(entry) && entry.required != null ? truthy(entry.required) : true;
|
|
9729
|
+
loaded.set(path3.replace(/^\.\//, ""), required);
|
|
9730
|
+
}
|
|
9731
|
+
return loaded;
|
|
9732
|
+
}
|
|
9733
|
+
var portsOf = (service) => Array.isArray(service.ports) ? service.ports : [];
|
|
9734
|
+
var renderPort = (port) => isMapping(port) ? JSON.stringify(port) : String(port);
|
|
9735
|
+
function partsOf(spec) {
|
|
9736
|
+
const parts2 = [""];
|
|
9737
|
+
let depth = 0;
|
|
9738
|
+
for (const ch of spec.replace(/\/(tcp|udp)$/, "")) {
|
|
9739
|
+
if (ch === "{")
|
|
9740
|
+
depth++;
|
|
9741
|
+
if (ch === "}")
|
|
9742
|
+
depth--;
|
|
9743
|
+
if (ch === ":" && depth === 0)
|
|
9744
|
+
parts2.push("");
|
|
9745
|
+
else
|
|
9746
|
+
parts2[parts2.length - 1] += ch;
|
|
8943
9747
|
}
|
|
9748
|
+
return parts2;
|
|
8944
9749
|
}
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
const
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
9750
|
+
function hostPortOf(port) {
|
|
9751
|
+
if (isMapping(port))
|
|
9752
|
+
return port.published == null ? void 0 : String(port.published);
|
|
9753
|
+
const parts2 = partsOf(String(port));
|
|
9754
|
+
return parts2.length >= 2 ? parts2[parts2.length - 2] : void 0;
|
|
9755
|
+
}
|
|
9756
|
+
function isLoopback(port) {
|
|
9757
|
+
if (isMapping(port))
|
|
9758
|
+
return port.host_ip === "127.0.0.1" && isLoopbackVar(String(port.published ?? "")) && /^\d+$/.test(String(port.target)) && (port.protocol == null || port.protocol === "tcp");
|
|
9759
|
+
const spec = String(port);
|
|
9760
|
+
const [ip, host, container, ...rest] = partsOf(spec);
|
|
9761
|
+
return ip === "127.0.0.1" && isLoopbackVar(host ?? "") && /^\d+$/.test(container ?? "") && rest.length === 0 && !spec.endsWith("/udp");
|
|
9762
|
+
}
|
|
9763
|
+
|
|
9764
|
+
// ../lib/dist/need.js
|
|
9765
|
+
var DEFAULT_MAX_AGE = 7;
|
|
9766
|
+
var MAX_AGE_ANSWER = "update_max_age";
|
|
9767
|
+
var DAY = 24 * 60 * 60 * 1e3;
|
|
9768
|
+
var days = (n) => `${n} day${n === 1 ? "" : "s"}`;
|
|
9769
|
+
var parts = (v) => {
|
|
9770
|
+
const [major = 0, minor = 0, patch = 0] = v.split(".").map(Number);
|
|
9771
|
+
return [major, minor, patch];
|
|
9772
|
+
};
|
|
9773
|
+
var newest = (versions) => versions.reduce((a, b) => compareVersions(a, b) >= 0 ? a : b);
|
|
9774
|
+
function needOf({ recorded, releases, maxAge, now }) {
|
|
9775
|
+
const versions = releases.map((r) => r.version).filter(isPlexusVersion);
|
|
9776
|
+
const known = recorded.filter((r) => !!r && isPlexusVersion(r));
|
|
9777
|
+
const majorOf = (v) => parts(v)[0];
|
|
9778
|
+
const heldBeyond = (major2) => {
|
|
9779
|
+
const beyond = versions.filter((v) => majorOf(v) > major2);
|
|
9780
|
+
return beyond.length > 0 ? `${newest(beyond)} is a new major, taken only when asked` : void 0;
|
|
9781
|
+
};
|
|
9782
|
+
const odd = recorded.findIndex((r) => !r || !isPlexusVersion(r));
|
|
9783
|
+
if (recorded.length === 0 || odd >= 0) {
|
|
9784
|
+
const what = `a site records ${recorded[odd] ? `'${recorded[odd]}'` : "no version"}, not a version`;
|
|
9785
|
+
if (known.length === 0)
|
|
9786
|
+
return { take: false, why: `${what}, and no site records one` };
|
|
9787
|
+
const major2 = majorOf(newest(known));
|
|
9788
|
+
const within2 = versions.filter((v) => majorOf(v) === major2);
|
|
9789
|
+
const held2 = heldBeyond(major2);
|
|
9790
|
+
if (within2.length === 0)
|
|
9791
|
+
return { take: false, why: held2 ?? `${what}, and no version of its major is released` };
|
|
9792
|
+
return { take: true, version: newest(within2), why: what, ...held2 ? { held: held2 } : {} };
|
|
9793
|
+
}
|
|
9794
|
+
const on = known.reduce((a, b) => compareVersions(a, b) <= 0 ? a : b);
|
|
9795
|
+
const major = majorOf(on);
|
|
9796
|
+
const held = heldBeyond(major);
|
|
9797
|
+
const time = (r) => {
|
|
9798
|
+
const t = Date.parse(r.published);
|
|
9799
|
+
return Number.isNaN(t) ? Number.NEGATIVE_INFINITY : t;
|
|
9800
|
+
};
|
|
9801
|
+
const within = releases.filter((r) => isPlexusVersion(r.version) && majorOf(r.version) === major && compareVersions(r.version, on) > 0).sort((a, b) => time(a) - time(b));
|
|
9802
|
+
const oldest = within[0];
|
|
9803
|
+
if (!oldest)
|
|
9804
|
+
return { take: false, why: held ?? `no version newer than ${on}` };
|
|
9805
|
+
const pending = within.map((r) => r.version);
|
|
9806
|
+
const target = newest(pending);
|
|
9807
|
+
const count = (upTo) => {
|
|
9808
|
+
const n = pending.filter((v) => compareVersions(v, upTo) <= 0).length;
|
|
9809
|
+
return `${n} newer version${n === 1 ? "" : "s"}`;
|
|
9810
|
+
};
|
|
9811
|
+
const also = held ? { held } : {};
|
|
9812
|
+
const age = Math.max(0, Math.floor((now.getTime() - time(oldest)) / DAY));
|
|
9813
|
+
if (maxAge === 0)
|
|
9814
|
+
return { take: true, version: target, why: `an interval of zero takes every version (${count(target)})`, ...also };
|
|
9815
|
+
if (time(oldest) === Number.NEGATIVE_INFINITY)
|
|
9816
|
+
return {
|
|
9817
|
+
take: true,
|
|
9818
|
+
version: target,
|
|
9819
|
+
why: `${oldest.version} has no readable release date ('${oldest.published}'), so it counts as old enough (${count(target)})`,
|
|
9820
|
+
...also
|
|
9821
|
+
};
|
|
9822
|
+
if (age >= maxAge)
|
|
9823
|
+
return {
|
|
9824
|
+
take: true,
|
|
9825
|
+
version: target,
|
|
9826
|
+
why: `${oldest.version}, the oldest version not taken, was cut ${days(age)} ago (interval: ${days(maxAge)}; ${count(target)})`,
|
|
9827
|
+
...also
|
|
9828
|
+
};
|
|
9829
|
+
const hotfixes = pending.filter((v) => parts(v)[2] > 0);
|
|
9830
|
+
if (hotfixes.length > 0) {
|
|
9831
|
+
const fix = newest(hotfixes);
|
|
9832
|
+
const rest = fix === target ? "" : `; ${target} waits for the interval`;
|
|
9833
|
+
return { take: true, version: fix, why: `${fix} is a hotfix, taken at once (${count(fix)})${rest}`, ...also };
|
|
8955
9834
|
}
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
facet2.remote = shortRemote(remote);
|
|
8962
|
-
return facet2;
|
|
9835
|
+
return {
|
|
9836
|
+
take: false,
|
|
9837
|
+
why: `${count(target)}, the oldest (${oldest.version}) cut ${days(age)} ago; the interval is ${days(maxAge)}`,
|
|
9838
|
+
...also
|
|
9839
|
+
};
|
|
8963
9840
|
}
|
|
8964
|
-
|
|
8965
|
-
const
|
|
8966
|
-
|
|
9841
|
+
function maxAgeOf(answers) {
|
|
9842
|
+
const value = answers[MAX_AGE_ANSWER];
|
|
9843
|
+
if (value === void 0 || value === null || value === "")
|
|
9844
|
+
return DEFAULT_MAX_AGE;
|
|
9845
|
+
return parseMaxAge(String(value), `the answer ${MAX_AGE_ANSWER}`);
|
|
9846
|
+
}
|
|
9847
|
+
function parseMaxAge(value, what) {
|
|
9848
|
+
if (!/^\d+$/.test(value.trim()))
|
|
9849
|
+
throw new Error(`${what} is '${value}', not a whole number of days`);
|
|
9850
|
+
return Number(value.trim());
|
|
8967
9851
|
}
|
|
8968
9852
|
|
|
8969
9853
|
// ../lib/dist/take.js
|
|
@@ -9033,7 +9917,7 @@ async function updateSite(ctx, consumer, site, dir, take, summary) {
|
|
|
9033
9917
|
const answers = await ctx.readFile(join6(target, ANSWERS_FILE));
|
|
9034
9918
|
const current = templateSource(site.template);
|
|
9035
9919
|
const recorded = /^_src_path: (.*)$/m.exec(answers)?.[1];
|
|
9036
|
-
if (recorded &&
|
|
9920
|
+
if (recorded && namesOldTemplate(recorded)) {
|
|
9037
9921
|
ctx.say(` ${site.rel}: the template is ${current} now; the answers follow`);
|
|
9038
9922
|
await ctx.stage(write(join6(target, ANSWERS_FILE), answers.replace(/^_src_path: .*$/m, `_src_path: ${current}`)));
|
|
9039
9923
|
await previewCommit(ctx, dir, `plx: ${site.rel} reads ${current}, the template's name since its rename`);
|
|
@@ -9065,7 +9949,6 @@ async function updateSite(ctx, consumer, site, dir, take, summary) {
|
|
|
9065
9949
|
if (hasConflictMarkers(text))
|
|
9066
9950
|
conflict = true;
|
|
9067
9951
|
}
|
|
9068
|
-
await syncSiteMarker(ctx, site, target);
|
|
9069
9952
|
if (conflict) {
|
|
9070
9953
|
ctx.say(" \u2717 CONFLICTS \u2014 committed with their <<<<<<< markers, to resolve in the pull request:");
|
|
9071
9954
|
summary.conflicted.push(site.rel);
|
|
@@ -9080,19 +9963,6 @@ async function updateSite(ctx, consumer, site, dir, take, summary) {
|
|
|
9080
9963
|
else
|
|
9081
9964
|
await ctx.stage(run("git", ["add", "-A"], { cwd: dir }));
|
|
9082
9965
|
}
|
|
9083
|
-
async function syncSiteMarker(ctx, site, target) {
|
|
9084
|
-
const marker = await ctx.readFile(join6(target, MARKER_FILE)).catch(() => void 0);
|
|
9085
|
-
if (marker === void 0)
|
|
9086
|
-
return;
|
|
9087
|
-
const { commit } = parseAnswers(await ctx.readFile(join6(target, ANSWERS_FILE)));
|
|
9088
|
-
if (!commit)
|
|
9089
|
-
return;
|
|
9090
|
-
const synced = syncMarker(marker, commit);
|
|
9091
|
-
if (synced === marker)
|
|
9092
|
-
return;
|
|
9093
|
-
ctx.say(` marker: plexus \u2192 ${commit} in ${site.rel}/${MARKER_FILE}`);
|
|
9094
|
-
await ctx.stage(write(join6(target, MARKER_FILE), synced));
|
|
9095
|
-
}
|
|
9096
9966
|
async function refreshLockfile(ctx, consumer, dir, base, summary) {
|
|
9097
9967
|
if (await ctx.readFile(join6(dir, "pnpm-workspace.yaml")).catch(() => void 0) === void 0)
|
|
9098
9968
|
return;
|
|
@@ -9172,7 +10042,7 @@ async function openPull(ctx, consumer, dir, take, summary) {
|
|
|
9172
10042
|
}
|
|
9173
10043
|
const sites = consumer.sites.map((s) => s.rel);
|
|
9174
10044
|
const body2 = [
|
|
9175
|
-
`Plexus ${version2} (\xA7 1.5 PLX): \`copier update\` at ${sites.join(", ")}, the
|
|
10045
|
+
`Plexus ${version2} (\xA7 1.5 PLX): \`copier update\` at ${sites.join(", ")}, the lockfile where manifests moved, and the workflow refs.`,
|
|
9176
10046
|
...conflicted.length > 0 ? [`Conflicts to resolve, committed with their markers: ${conflicted.join(", ")}.`] : [],
|
|
9177
10047
|
...failed.length > 0 ? [`Failed, and left as it was: ${failed.join(", ")}.`] : [],
|
|
9178
10048
|
...clean ? [CLEAN_BODY] : [],
|
|
@@ -9231,8 +10101,14 @@ async function update(ctx, options) {
|
|
|
9231
10101
|
throw new Error(`${name}: its root is not a site of a repo template`);
|
|
9232
10102
|
await preflightForge(ctx);
|
|
9233
10103
|
const releases = options.to === void 0 ? await releasesOf(ctx) : [];
|
|
9234
|
-
const
|
|
9235
|
-
|
|
10104
|
+
const newest2 = options.to ?? newestOf(releases);
|
|
10105
|
+
if (await onOrigin(ctx, repo, consumer.branch) === false) {
|
|
10106
|
+
const reason = `origin has no branch \`${consumer.branch}\`, the one the version lands on`;
|
|
10107
|
+
ctx.say(`\u26A0 ${name}: ${reason} \u2014 skipped`);
|
|
10108
|
+
const skipped = emptySummary(newest2, ctx.dryRun);
|
|
10109
|
+
skipped.skipped.push({ path: name, reason });
|
|
10110
|
+
return skipped;
|
|
10111
|
+
}
|
|
9236
10112
|
await ctx.read("git", ["fetch", "--quiet", "origin", consumer.branch], { cwd: repo }).catch(() => "");
|
|
9237
10113
|
const answers = await Promise.all(consumer.sites.map(async (s) => {
|
|
9238
10114
|
const file = join7(relative4(consumer.path, s.path), ANSWERS_FILE);
|
|
@@ -9240,16 +10116,26 @@ async function update(ctx, options) {
|
|
|
9240
10116
|
return parseAnswers(onOrigin2 ?? await ctx.readFile(join7(s.path, ANSWERS_FILE)));
|
|
9241
10117
|
}));
|
|
9242
10118
|
const recorded = answers.map((a) => a.commit);
|
|
9243
|
-
if (recorded.every((c) => c ===
|
|
9244
|
-
ctx.say(`\u2022 ${name}: already at ${
|
|
9245
|
-
return
|
|
10119
|
+
if (recorded.every((c) => c === newest2)) {
|
|
10120
|
+
ctx.say(`\u2022 ${name}: already at ${newest2}`);
|
|
10121
|
+
return emptySummary(newest2, ctx.dryRun);
|
|
9246
10122
|
}
|
|
9247
|
-
const past = recorded.find((c) => c && isPlexusVersion(c) && compareVersions(c,
|
|
10123
|
+
const past = recorded.find((c) => c && isPlexusVersion(c) && compareVersions(c, newest2) > 0);
|
|
9248
10124
|
if (past)
|
|
9249
|
-
throw new Error(`${name} is at ${past}, past ${
|
|
10125
|
+
throw new Error(`${name} is at ${past}, past ${newest2}; a repo is never taken back to an older version`);
|
|
10126
|
+
const asked = options.to !== void 0 ? `--to ${newest2}` : options.now ? "--now" : void 0;
|
|
10127
|
+
const need = asked ? { take: true, version: newest2, why: `asked for (${asked})` } : needOf({
|
|
10128
|
+
recorded,
|
|
10129
|
+
releases,
|
|
10130
|
+
maxAge: options.maxAge ?? maxAgeOf(answers[consumer.sites.indexOf(root)]?.answers ?? {}),
|
|
10131
|
+
now: options.today === void 0 ? /* @__PURE__ */ new Date() : new Date(options.today)
|
|
10132
|
+
});
|
|
10133
|
+
if (need.held)
|
|
10134
|
+
ctx.say(`\u2022 ${name}: ${need.held} (plx update --now takes it)`);
|
|
10135
|
+
const version2 = need.take ? need.version : newest2;
|
|
10136
|
+
const summary = emptySummary(version2, ctx.dryRun);
|
|
9250
10137
|
const branch = versionBranch(version2);
|
|
9251
|
-
|
|
9252
|
-
if (onOrigin) {
|
|
10138
|
+
if (await onOrigin(ctx, repo, branch)) {
|
|
9253
10139
|
const url = await openPullUrl(ctx, consumer, repo, version2);
|
|
9254
10140
|
ctx.say(`\u2022 ${name}: ${branch} is already on origin${url ? ` (${url})` : ""} \u2014 nothing to do; delete the branch to pull the version again`);
|
|
9255
10141
|
if (url) {
|
|
@@ -9260,15 +10146,6 @@ async function update(ctx, options) {
|
|
|
9260
10146
|
}
|
|
9261
10147
|
return summary;
|
|
9262
10148
|
}
|
|
9263
|
-
const asked = options.to !== void 0 ? `--to ${version2}` : options.now ? "--now" : void 0;
|
|
9264
|
-
const need = needOf({
|
|
9265
|
-
recorded,
|
|
9266
|
-
releases,
|
|
9267
|
-
asked,
|
|
9268
|
-
stale: asked ? [] : await staleIn(ctx, consumer, repo, version2),
|
|
9269
|
-
maxAge: options.maxAge ?? maxAgeOf(answers[consumer.sites.indexOf(root)]?.answers ?? {}),
|
|
9270
|
-
now: options.today === void 0 ? /* @__PURE__ */ new Date() : new Date(options.today)
|
|
9271
|
-
});
|
|
9272
10149
|
if (!need.take) {
|
|
9273
10150
|
ctx.say(`\u2022 ${name}: rests \u2014 ${need.why} (plx update --now takes ${version2})`);
|
|
9274
10151
|
summary.resting.push({ path: name, reason: need.why });
|
|
@@ -9295,26 +10172,13 @@ async function update(ctx, options) {
|
|
|
9295
10172
|
}
|
|
9296
10173
|
return summary;
|
|
9297
10174
|
}
|
|
9298
|
-
async function
|
|
9299
|
-
|
|
9300
|
-
|
|
9301
|
-
|
|
9302
|
-
|
|
9303
|
-
|
|
9304
|
-
const catalog = catalogOf(parseManifest(text));
|
|
9305
|
-
const markers = [];
|
|
9306
|
-
for (const site of consumer.sites) {
|
|
9307
|
-
const file = join7(relative4(consumer.path, site.path), MARKER_FILE);
|
|
9308
|
-
const marker = await ctx.read("git", ["show", `origin/${consumer.branch}:${file}`], { cwd: repo }).catch(() => void 0) ?? await ctx.readFile(join7(site.path, MARKER_FILE)).catch(() => void 0);
|
|
9309
|
-
if (marker === void 0)
|
|
9310
|
-
continue;
|
|
9311
|
-
try {
|
|
9312
|
-
const { plexus, modules } = parseMarker(marker);
|
|
9313
|
-
markers.push({ where: join7(site.rel, MARKER_FILE), plexus, modules });
|
|
9314
|
-
} catch {
|
|
9315
|
-
}
|
|
10175
|
+
async function onOrigin(ctx, repo, branch) {
|
|
10176
|
+
try {
|
|
10177
|
+
await ctx.read("git", ["ls-remote", "--exit-code", "--heads", "origin", `refs/heads/${branch}`], { cwd: repo });
|
|
10178
|
+
return true;
|
|
10179
|
+
} catch (error) {
|
|
10180
|
+
return error instanceof ExecError && error.code === 2 ? false : void 0;
|
|
9316
10181
|
}
|
|
9317
|
-
return staleModules(markers, catalog);
|
|
9318
10182
|
}
|
|
9319
10183
|
var RELEASES_REPO = `plexus-ms/${COMPENDIUM}`;
|
|
9320
10184
|
async function releasesOf(ctx) {
|
|
@@ -9323,10 +10187,10 @@ async function releasesOf(ctx) {
|
|
|
9323
10187
|
return lines.split("\n").map((l) => l.trim().split(/\s+/)).filter((p) => p.length === 2 && isPlexusVersion(p[0] ?? "")).map(([version2, published]) => ({ version: version2, published }));
|
|
9324
10188
|
}
|
|
9325
10189
|
function newestOf(releases) {
|
|
9326
|
-
const
|
|
9327
|
-
if (!
|
|
10190
|
+
const newest2 = releases.map((r) => r.version).reduce((a, b) => a && compareVersions(a, b) >= 0 ? a : b, "");
|
|
10191
|
+
if (!newest2)
|
|
9328
10192
|
throw new Error(`no release of ${RELEASES_REPO} found \u2014 pass the version explicitly (--to <version>)`);
|
|
9329
|
-
return
|
|
10193
|
+
return newest2;
|
|
9330
10194
|
}
|
|
9331
10195
|
|
|
9332
10196
|
// ../lib/dist/propagate.js
|
|
@@ -9358,163 +10222,6 @@ async function propagate(ctx, options) {
|
|
|
9358
10222
|
|
|
9359
10223
|
// ../lib/dist/requirements.js
|
|
9360
10224
|
import { join as join8 } from "node:path";
|
|
9361
|
-
|
|
9362
|
-
// ../lib/dist/standard-index.json
|
|
9363
|
-
var standard_index_default = {
|
|
9364
|
-
version: "0.122.1",
|
|
9365
|
-
citable: [
|
|
9366
|
-
"\xA7 1 PLX",
|
|
9367
|
-
"\xA7 1.1 PLX",
|
|
9368
|
-
"\xA7 1.2 PLX",
|
|
9369
|
-
"\xA7 1.3 PLX",
|
|
9370
|
-
"\xA7 1.4 PLX",
|
|
9371
|
-
"\xA7 1.5 PLX",
|
|
9372
|
-
"\xA7 1.6 PLX",
|
|
9373
|
-
"\xA7 1.7 PLX",
|
|
9374
|
-
"\xA7 1.8 PLX",
|
|
9375
|
-
"\xA7 2 PLX",
|
|
9376
|
-
"\xA7 2.1 PLX",
|
|
9377
|
-
"\xA7 2.2 PLX",
|
|
9378
|
-
"\xA7 2.3 PLX",
|
|
9379
|
-
"\xA7 2.4 PLX",
|
|
9380
|
-
"\xA7 2.5 PLX",
|
|
9381
|
-
"\xA7 2.6 PLX",
|
|
9382
|
-
"\xA7 2.7 PLX",
|
|
9383
|
-
"\xA7 3 PLX",
|
|
9384
|
-
"\xA7 3.1 PLX",
|
|
9385
|
-
"\xA7 3.2 PLX",
|
|
9386
|
-
"\xA7 3.3 PLX",
|
|
9387
|
-
"\xA7 3.4 PLX",
|
|
9388
|
-
"\xA7 4 PLX",
|
|
9389
|
-
"\xA7 4.1 PLX",
|
|
9390
|
-
"\xA7 4.2 PLX",
|
|
9391
|
-
"\xA7 4.3 PLX",
|
|
9392
|
-
"\xA7 4.4 PLX",
|
|
9393
|
-
"\xA7 4.5 PLX",
|
|
9394
|
-
"\xA7 4.6 PLX",
|
|
9395
|
-
"\xA7 4.7 PLX",
|
|
9396
|
-
"\xA7 5 PLX",
|
|
9397
|
-
"\xA7 5.1 PLX",
|
|
9398
|
-
"\xA7 5.2 PLX",
|
|
9399
|
-
"\xA7 5.3 PLX",
|
|
9400
|
-
"\xA7 6 PLX",
|
|
9401
|
-
"\xA7 6.1 PLX",
|
|
9402
|
-
"\xA7 6.2 PLX",
|
|
9403
|
-
"\xA7 6.3 PLX",
|
|
9404
|
-
"\xA7 6.4 PLX",
|
|
9405
|
-
"\xA7 6.5 PLX",
|
|
9406
|
-
"\xA7 6.6 PLX",
|
|
9407
|
-
"\xA7 6.7 PLX",
|
|
9408
|
-
"\xA7 6.8 PLX",
|
|
9409
|
-
"\xA7 6.9 PLX",
|
|
9410
|
-
"\xA7 7 PLX",
|
|
9411
|
-
"\xA7 7.1 PLX",
|
|
9412
|
-
"\xA7 7.2 PLX",
|
|
9413
|
-
"\xA7 7.3 PLX",
|
|
9414
|
-
"\xA7 7.4 PLX",
|
|
9415
|
-
"\xA7 7.5 PLX",
|
|
9416
|
-
"\xA7 7.6 PLX",
|
|
9417
|
-
"\xA7 7.7 PLX",
|
|
9418
|
-
"\xA7 8 PLX",
|
|
9419
|
-
"\xA7 8.1 PLX",
|
|
9420
|
-
"\xA7 8.2 PLX",
|
|
9421
|
-
"\xA7 8.3 PLX",
|
|
9422
|
-
"\xA7 8.4 PLX",
|
|
9423
|
-
"\xA7 8.5 PLX",
|
|
9424
|
-
"\xA7 8.6 PLX",
|
|
9425
|
-
"\xA7 8.7 PLX",
|
|
9426
|
-
"\xA7 9 PLX",
|
|
9427
|
-
"\xA7 10 PLX",
|
|
9428
|
-
"\xA7 10.1 PLX",
|
|
9429
|
-
"\xA7 10.2 PLX",
|
|
9430
|
-
"\xA7 10.3 PLX",
|
|
9431
|
-
"\xA7 10.4 PLX",
|
|
9432
|
-
"\xA7 10.5 PLX",
|
|
9433
|
-
"\xA7 11 PLX",
|
|
9434
|
-
"\xA7 11.1 PLX",
|
|
9435
|
-
"\xA7 11.2 PLX",
|
|
9436
|
-
"\xA7 11.3 PLX",
|
|
9437
|
-
"\xA7 11.4 PLX",
|
|
9438
|
-
"\xA7 11.5 PLX",
|
|
9439
|
-
"\xA7 11.6 PLX",
|
|
9440
|
-
"\xA7 12 PLX",
|
|
9441
|
-
"\xA7 12.1 PLX",
|
|
9442
|
-
"\xA7 12.2 PLX",
|
|
9443
|
-
"\xA7 12.3 PLX",
|
|
9444
|
-
"\xA7 12.4 PLX",
|
|
9445
|
-
"\xA7 12.5 PLX",
|
|
9446
|
-
"\xA7 12.6 PLX",
|
|
9447
|
-
"\xA7 13 PLX",
|
|
9448
|
-
"\xA7 13.1 PLX",
|
|
9449
|
-
"\xA7 13.2 PLX",
|
|
9450
|
-
"\xA7 13.3 PLX",
|
|
9451
|
-
"\xA7 13.4 PLX",
|
|
9452
|
-
"\xA7 13.5 PLX",
|
|
9453
|
-
"\xA7 1 PLX-AppStateful",
|
|
9454
|
-
"\xA7 2 PLX-AppStateful",
|
|
9455
|
-
"\xA7 3 PLX-AppStateful",
|
|
9456
|
-
"\xA7 1 PLX-AppStateless",
|
|
9457
|
-
"\xA7 1 PLX-App",
|
|
9458
|
-
"\xA7 2 PLX-App",
|
|
9459
|
-
"\xA7 3 PLX-App",
|
|
9460
|
-
"\xA7 4 PLX-App",
|
|
9461
|
-
"\xA7 5 PLX-App",
|
|
9462
|
-
"\xA7 6 PLX-App",
|
|
9463
|
-
"\xA7 7 PLX-App",
|
|
9464
|
-
"\xA7 1 PLX-Environment",
|
|
9465
|
-
"\xA7 2 PLX-Environment",
|
|
9466
|
-
"\xA7 1 PLX-Host",
|
|
9467
|
-
"\xA7 2 PLX-Host",
|
|
9468
|
-
"\xA7 1 PLX-Repo",
|
|
9469
|
-
"\xA7 2 PLX-Repo",
|
|
9470
|
-
"\xA7 3 PLX-Repo",
|
|
9471
|
-
"\xA7 1 PLX-Tenancy",
|
|
9472
|
-
"\xA7 2 PLX-Tenancy",
|
|
9473
|
-
"\xA7 3 PLX-Tenancy",
|
|
9474
|
-
"\xA7 4 PLX-Tenancy",
|
|
9475
|
-
"\xA7 1 PLX-CLI",
|
|
9476
|
-
"\xA7 2 PLX-CLI",
|
|
9477
|
-
"\xA7 3 PLX-CLI",
|
|
9478
|
-
"\xA7 4 PLX-CLI",
|
|
9479
|
-
"\xA7 5 PLX-CLI",
|
|
9480
|
-
"\xA7 6 PLX-CLI",
|
|
9481
|
-
"\xA7 1 PLX-Delivery",
|
|
9482
|
-
"\xA7 2 PLX-Delivery",
|
|
9483
|
-
"\xA7 3 PLX-Delivery",
|
|
9484
|
-
"\xA7 4 PLX-Delivery",
|
|
9485
|
-
"\xA7 5 PLX-Delivery",
|
|
9486
|
-
"\xA7 6 PLX-Delivery",
|
|
9487
|
-
"\xA7 7 PLX-Delivery",
|
|
9488
|
-
"\xA7 8 PLX-Delivery",
|
|
9489
|
-
"\xA7 1 PLX-Infrastructure",
|
|
9490
|
-
"\xA7 2 PLX-Infrastructure",
|
|
9491
|
-
"\xA7 3 PLX-Infrastructure",
|
|
9492
|
-
"\xA7 1 PLX-Ingress",
|
|
9493
|
-
"\xA7 2 PLX-Ingress",
|
|
9494
|
-
"\xA7 1 PLX-JS",
|
|
9495
|
-
"\xA7 1 PLX-Platform",
|
|
9496
|
-
"\xA7 2 PLX-Platform",
|
|
9497
|
-
"\xA7 3 PLX-Platform",
|
|
9498
|
-
"\xA7 1 PLX-Secrets",
|
|
9499
|
-
"\xA7 2 PLX-Secrets",
|
|
9500
|
-
"\xA7 3 PLX-Secrets",
|
|
9501
|
-
"\xA7 1 PLX-Updates",
|
|
9502
|
-
"\xA7 2 PLX-Updates",
|
|
9503
|
-
"\xA7 3 PLX-Updates"
|
|
9504
|
-
]
|
|
9505
|
-
};
|
|
9506
|
-
|
|
9507
|
-
// ../lib/dist/standardIndex.js
|
|
9508
|
-
var STANDARD_INDEX_FILE = "packages/lib/src/standard-index.json";
|
|
9509
|
-
var bundledIndex = () => checked(standard_index_default);
|
|
9510
|
-
function checked(value) {
|
|
9511
|
-
const { version: version2, citable } = value ?? {};
|
|
9512
|
-
if (typeof version2 !== "string" || !Array.isArray(citable) || !citable.every((c) => typeof c === "string"))
|
|
9513
|
-
throw new Error(`${STANDARD_INDEX_FILE} is not a citable index`);
|
|
9514
|
-
return { version: version2, citable };
|
|
9515
|
-
}
|
|
9516
|
-
|
|
9517
|
-
// ../lib/dist/requirements.js
|
|
9518
10225
|
var KEYWORD = /MUST|SHOULD|MAY/;
|
|
9519
10226
|
var hasKeyword = (line) => KEYWORD.test(line.replace(/MUSTs|SHOULDs|MAYs/g, ""));
|
|
9520
10227
|
function requirementName(bullet) {
|
|
@@ -9624,9 +10331,10 @@ function scanPage(text, name, mode) {
|
|
|
9624
10331
|
}
|
|
9625
10332
|
var extractRequirements = (text) => scanPage(text, "", "module").requirements;
|
|
9626
10333
|
var MAP_PAGE = "essentials/standard.md";
|
|
10334
|
+
var MODULE_DIRS = ["contracts", "approaches"];
|
|
9627
10335
|
async function modulePages(ctx, compendium) {
|
|
9628
10336
|
const pages = [];
|
|
9629
|
-
for (const dir of
|
|
10337
|
+
for (const dir of MODULE_DIRS) {
|
|
9630
10338
|
const entries = await ctx.readDir(join8(compendium, dir));
|
|
9631
10339
|
for (const e of entries.filter((e2) => !e2.directory && e2.name.endsWith(".md") && e2.name !== "index.md").sort())
|
|
9632
10340
|
pages.push(`${dir}/${e.name}`);
|
|
@@ -9665,13 +10373,13 @@ async function checkCompendium(ctx, compendium) {
|
|
|
9665
10373
|
for (const dep of s.depends)
|
|
9666
10374
|
if (!byCode.has(dep))
|
|
9667
10375
|
defects.push(`\u2717 unknown module in depends: ${dep}`);
|
|
9668
|
-
const
|
|
10376
|
+
const kindOf2 = (page) => page.startsWith("contracts/") ? "contract" : "approach";
|
|
9669
10377
|
const side = (binds2) => binds2 === "repo" || binds2 === "app" ? "dev" : "ops";
|
|
9670
|
-
const kinds = new Map([...byCode].map(([code, [page = ""]]) => [code,
|
|
10378
|
+
const kinds = new Map([...byCode].map(([code, [page = ""]]) => [code, kindOf2(page)]));
|
|
9671
10379
|
const binds = new Map([...byCode].map(([code, [page = ""]]) => [code, scans.get(page)?.binds ?? ""]));
|
|
9672
10380
|
for (const [page, s] of scans) {
|
|
9673
10381
|
const m = s.code ?? page.replace(/.*\//, "");
|
|
9674
|
-
const kind =
|
|
10382
|
+
const kind = kindOf2(page);
|
|
9675
10383
|
for (const c of s.consumes) {
|
|
9676
10384
|
if (kind === "contract")
|
|
9677
10385
|
defects.push(`\u2717 ${m} is a contract and consumes ${c}; a contract has no other side to consume`);
|
|
@@ -9711,7 +10419,7 @@ async function readPages(ctx, compendium) {
|
|
|
9711
10419
|
return { citable, own };
|
|
9712
10420
|
}
|
|
9713
10421
|
var COPIER_FILES = ["copier.yml", "copier.yaml"];
|
|
9714
|
-
async function
|
|
10422
|
+
async function kindOf(ctx, dir) {
|
|
9715
10423
|
if (await ctx.readFile(join8(dir, MAP_PAGE)).then(() => true, () => false))
|
|
9716
10424
|
return { kind: "compendium" };
|
|
9717
10425
|
for (const file of COPIER_FILES) {
|
|
@@ -9729,7 +10437,7 @@ async function trackedFiles(ctx, dir) {
|
|
|
9729
10437
|
return out.split("\0").filter(Boolean).sort();
|
|
9730
10438
|
}
|
|
9731
10439
|
async function lintRepo(ctx, dir, options = {}) {
|
|
9732
|
-
const { kind, templateDir } = await
|
|
10440
|
+
const { kind, templateDir } = await kindOf(ctx, dir);
|
|
9733
10441
|
const result = { kind, against: "", defects: [], violations: [] };
|
|
9734
10442
|
let index;
|
|
9735
10443
|
let own = /* @__PURE__ */ new Map();
|
|
@@ -9809,9 +10517,9 @@ function renderSummary(s, realCommand, verb = "propagate") {
|
|
|
9809
10517
|
lines.push(` \u2022 resting: ${path3} (${reason})`);
|
|
9810
10518
|
for (const url of s.pulls)
|
|
9811
10519
|
lines.push(` \u2192 pull: ${url}`);
|
|
9812
|
-
const
|
|
9813
|
-
if (
|
|
9814
|
-
lines.push(" the clean ones, to merge once their checks pass:", ` ${
|
|
10520
|
+
const merge2 = s.preview ? "" : mergeLine(s.mergeable);
|
|
10521
|
+
if (merge2)
|
|
10522
|
+
lines.push(" the clean ones, to merge once their checks pass:", ` ${merge2}`);
|
|
9815
10523
|
const clean = isClean(s);
|
|
9816
10524
|
const idle = clean && s.clean.length === 0;
|
|
9817
10525
|
if (s.preview && !idle) {
|
|
@@ -10774,13 +11482,13 @@ import { AsyncResource as AsyncResource3 } from "node:async_hooks";
|
|
|
10774
11482
|
|
|
10775
11483
|
// ../../node_modules/.pnpm/@inquirer+type@4.3.0_@types+node@24.19.2/node_modules/@inquirer/type/dist/utils.js
|
|
10776
11484
|
function withResolver() {
|
|
10777
|
-
let
|
|
11485
|
+
let resolve10;
|
|
10778
11486
|
let reject;
|
|
10779
11487
|
const promise = new Promise((res, rej) => {
|
|
10780
|
-
|
|
11488
|
+
resolve10 = res;
|
|
10781
11489
|
reject = rej;
|
|
10782
11490
|
});
|
|
10783
|
-
return { promise, resolve:
|
|
11491
|
+
return { promise, resolve: resolve10, reject };
|
|
10784
11492
|
}
|
|
10785
11493
|
|
|
10786
11494
|
// ../../node_modules/.pnpm/@inquirer+core@12.1.0_@types+node@24.19.2/node_modules/@inquirer/core/dist/lib/create-prompt.js
|
|
@@ -11149,7 +11857,7 @@ function createPrompt(view) {
|
|
|
11149
11857
|
const callSites = getCallSites();
|
|
11150
11858
|
const prompt = (config, context = {}) => {
|
|
11151
11859
|
const { input = process.stdin, signal } = context;
|
|
11152
|
-
const
|
|
11860
|
+
const cleanups2 = /* @__PURE__ */ new Set();
|
|
11153
11861
|
const output = new import_mute_stream.default();
|
|
11154
11862
|
output.pipe(context.output ?? process.stdout);
|
|
11155
11863
|
const rl = readline2.createInterface({
|
|
@@ -11159,7 +11867,7 @@ function createPrompt(view) {
|
|
|
11159
11867
|
});
|
|
11160
11868
|
output.mute();
|
|
11161
11869
|
const screen = new ScreenManager(rl);
|
|
11162
|
-
const { promise, resolve:
|
|
11870
|
+
const { promise, resolve: resolve10, reject } = withResolver();
|
|
11163
11871
|
return withHooks(rl, (cycle) => {
|
|
11164
11872
|
const clearEffects = AsyncResource3.bind(() => effectScheduler.clearAll());
|
|
11165
11873
|
const settlePrompt = (settle) => {
|
|
@@ -11170,10 +11878,10 @@ function createPrompt(view) {
|
|
|
11170
11878
|
reject(error);
|
|
11171
11879
|
}
|
|
11172
11880
|
};
|
|
11173
|
-
const resolvePrompt = (value) => settlePrompt(() =>
|
|
11881
|
+
const resolvePrompt = (value) => settlePrompt(() => resolve10(value));
|
|
11174
11882
|
const rejectPrompt = (error) => settlePrompt(() => reject(error));
|
|
11175
11883
|
const promptPromise = Object.assign(promise.finally(() => {
|
|
11176
|
-
|
|
11884
|
+
cleanups2.forEach((cleanup) => cleanup());
|
|
11177
11885
|
screen.done({ clearContent: Boolean(context.clearPromptOnDone) });
|
|
11178
11886
|
output.end();
|
|
11179
11887
|
}).then(() => promise), { cancel: () => rejectPrompt(new CancelPromptError()) });
|
|
@@ -11183,15 +11891,15 @@ function createPrompt(view) {
|
|
|
11183
11891
|
abort();
|
|
11184
11892
|
return promptPromise;
|
|
11185
11893
|
}
|
|
11186
|
-
|
|
11894
|
+
cleanups2.add(listenTo(signal, "abort", abort));
|
|
11187
11895
|
}
|
|
11188
|
-
|
|
11896
|
+
cleanups2.add(onExit((code, signal2) => {
|
|
11189
11897
|
rejectPrompt(new ExitPromptError(`User force closed the prompt with ${code} ${signal2}`));
|
|
11190
11898
|
}));
|
|
11191
|
-
|
|
11192
|
-
|
|
11899
|
+
cleanups2.add(listenTo(rl, "SIGINT", () => rejectPrompt(new ExitPromptError(`User force closed the prompt with SIGINT`))));
|
|
11900
|
+
cleanups2.add(listenTo(rl, "close", clearEffects));
|
|
11193
11901
|
const startCycle = () => {
|
|
11194
|
-
|
|
11902
|
+
cleanups2.add(listenTo(rl.input, "keypress", () => screen.checkCursorPos()));
|
|
11195
11903
|
let pendingDone = null;
|
|
11196
11904
|
cycle(() => {
|
|
11197
11905
|
let effectsSettled = false;
|
|
@@ -11227,7 +11935,7 @@ function createPrompt(view) {
|
|
|
11227
11935
|
};
|
|
11228
11936
|
if ("readableFlowing" in input && input.isTTY) {
|
|
11229
11937
|
const immediate = nativeSetImmediate(startCycle);
|
|
11230
|
-
|
|
11938
|
+
cleanups2.add(() => nativeClearImmediate(immediate));
|
|
11231
11939
|
} else {
|
|
11232
11940
|
startCycle();
|
|
11233
11941
|
}
|
|
@@ -14694,13 +15402,13 @@ function useColor() {
|
|
|
14694
15402
|
var program = new Command();
|
|
14695
15403
|
|
|
14696
15404
|
// src/commands/changeset.ts
|
|
14697
|
-
import { resolve } from "node:path";
|
|
15405
|
+
import { resolve as resolve2 } from "node:path";
|
|
14698
15406
|
function register(program2) {
|
|
14699
15407
|
program2.command("changeset").description(
|
|
14700
15408
|
"write the changeset a dependency bump owes: a patch per package whose runtime dependencies or shipped source moved"
|
|
14701
15409
|
).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) => {
|
|
14702
|
-
const ctx =
|
|
14703
|
-
const changeset = await readChangeset(ctx,
|
|
15410
|
+
const ctx = contextOf(command);
|
|
15411
|
+
const changeset = await readChangeset(ctx, resolve2(dir), opts.base, opts.branch);
|
|
14704
15412
|
await ctx.apply(changeset.plan);
|
|
14705
15413
|
ctx.result(changeset, renderChangeset);
|
|
14706
15414
|
});
|
|
@@ -14712,31 +15420,27 @@ function renderChangeset(c) {
|
|
|
14712
15420
|
}
|
|
14713
15421
|
|
|
14714
15422
|
// src/commands/deploy.ts
|
|
14715
|
-
import { resolve as
|
|
15423
|
+
import { resolve as resolve3 } from "node:path";
|
|
14716
15424
|
function register2(program2) {
|
|
14717
15425
|
program2.command("deploy").description(
|
|
14718
|
-
"render the app\u2019s compose file with the image pinned, stage it on the host, pull, migrate, swap, up,
|
|
14719
|
-
).argument("<host>", "ssh target, deploy@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(
|
|
14720
|
-
"--health-url <url>",
|
|
14721
|
-
"readiness URL polled on the host (default: /healthz, or the plexus.healthz label, on the loopback port)"
|
|
14722
|
-
).option("--retries <n>", "poll attempts, two seconds apart", "30").option(
|
|
15426
|
+
"render the app\u2019s compose file with the image pinned, stage it on the host, pull, migrate, swap, up, wait for the healthcheck, roll back on failure"
|
|
15427
|
+
).argument("<host>", "ssh target, deploy@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("--retries <n>", "looks at the app container\u2019s health status, two seconds apart", "30").option(
|
|
14723
15428
|
"-e, --environment <name>",
|
|
14724
15429
|
"the environment deployed into; decides the app dir\u2019s slug (default: production)"
|
|
14725
15430
|
).option(
|
|
14726
15431
|
"--app-dir <path>",
|
|
14727
15432
|
"the app dir on the host (default: /opt/stacks/<app>, or <app>-<environment> outside production)"
|
|
14728
15433
|
).option("--source <path>", "the app\u2019s dir in the checkout (default: apps/<app>)").option("-C, --dir <dir>", "the checkout to read", ".").action(async (host, app, opts, command) => {
|
|
14729
|
-
const ctx =
|
|
15434
|
+
const ctx = contextOf(command);
|
|
14730
15435
|
const result = await deploy(ctx, {
|
|
14731
15436
|
host,
|
|
14732
15437
|
app,
|
|
14733
15438
|
image: opts.image,
|
|
14734
|
-
healthUrl: opts.healthUrl,
|
|
14735
15439
|
retries: Number(opts.retries),
|
|
14736
15440
|
environment: opts.environment,
|
|
14737
15441
|
appDir: opts.appDir,
|
|
14738
15442
|
source: opts.source,
|
|
14739
|
-
dir:
|
|
15443
|
+
dir: resolve3(opts.dir)
|
|
14740
15444
|
});
|
|
14741
15445
|
ctx.result(result, renderDeploy);
|
|
14742
15446
|
if (!result.healthy) process.exitCode = 1;
|
|
@@ -14748,7 +15452,7 @@ function renderDeploy(d) {
|
|
|
14748
15452
|
}
|
|
14749
15453
|
|
|
14750
15454
|
// src/commands/deploy-targets.ts
|
|
14751
|
-
import { resolve as
|
|
15455
|
+
import { resolve as resolve4 } from "node:path";
|
|
14752
15456
|
function register3(program2) {
|
|
14753
15457
|
program2.command("deploy-targets").description(
|
|
14754
15458
|
"map each app of a platform repo, per environment, to the deploy target of the inventory file that declares it"
|
|
@@ -14756,11 +15460,11 @@ function register3(program2) {
|
|
|
14756
15460
|
"--apps <dir>",
|
|
14757
15461
|
"with --environment: only the apps with a directory under <dir>, as a list of {app, host} for a matrix"
|
|
14758
15462
|
).action(async (inventory, opts, command) => {
|
|
14759
|
-
const ctx =
|
|
14760
|
-
const targets = await readDeployTargets(ctx,
|
|
15463
|
+
const ctx = contextOf(command);
|
|
15464
|
+
const targets = await readDeployTargets(ctx, resolve4(inventory));
|
|
14761
15465
|
if (opts.apps !== void 0) {
|
|
14762
15466
|
if (!opts.environment) throw new UsageError("--apps needs --environment");
|
|
14763
|
-
const dirs = (await ctx.readDir(
|
|
15467
|
+
const dirs = (await ctx.readDir(resolve4(opts.apps)).catch(() => [])).filter((e) => e.directory).map((e) => e.name);
|
|
14764
15468
|
const { legs, without } = deployLegs(targetsIn(targets, opts.environment), dirs);
|
|
14765
15469
|
for (const app of without) ctx.say(`${app} has no deployment in ${opts.environment}; nothing to deploy`);
|
|
14766
15470
|
ctx.result(legs, (l) => JSON.stringify(l));
|
|
@@ -14772,8 +15476,7 @@ function register3(program2) {
|
|
|
14772
15476
|
}
|
|
14773
15477
|
|
|
14774
15478
|
// src/commands/doctor.ts
|
|
14775
|
-
import {
|
|
14776
|
-
import { join as join9, resolve as resolve4 } from "node:path";
|
|
15479
|
+
import { resolve as resolve5 } from "node:path";
|
|
14777
15480
|
|
|
14778
15481
|
// src/style.ts
|
|
14779
15482
|
function style(enabled) {
|
|
@@ -14783,69 +15486,77 @@ function style(enabled) {
|
|
|
14783
15486
|
var colorByDefault = () => process.stdout.isTTY === true && !process.env.NO_COLOR;
|
|
14784
15487
|
|
|
14785
15488
|
// src/commands/doctor.ts
|
|
14786
|
-
var WORKSPACE_COMPENDIUM = "plexus-ms/compendium";
|
|
14787
15489
|
function register4(program2) {
|
|
14788
|
-
program2.command("doctor").description(
|
|
14789
|
-
"
|
|
14790
|
-
|
|
14791
|
-
|
|
14792
|
-
const
|
|
14793
|
-
const
|
|
14794
|
-
const
|
|
14795
|
-
if (!existsSync(join9(compendium, "contracts")))
|
|
14796
|
-
throw new Error(
|
|
14797
|
-
`no compendium at ${compendium}; pass --compendium <path to a checkout of plexus-ms/compendium>`
|
|
14798
|
-
);
|
|
14799
|
-
const catalog = await readCatalog(ctx, compendium);
|
|
14800
|
-
const report = diagnose(await overview(ctx, root, { git: false }), catalog);
|
|
15490
|
+
program2.command("doctor").description(
|
|
15491
|
+
"run the checks of the contracts over this repo and its apps, or every unit with a marker under a directory"
|
|
15492
|
+
).argument("[dir]", "a repo, or a directory of repos", ".").option("--color", "colour the report even when piped").option("--no-color", "never colour the report").action(async (dir, opts, command) => {
|
|
15493
|
+
const ctx = contextOf(command);
|
|
15494
|
+
const given = resolve5(dir);
|
|
15495
|
+
const { facts, ...examined } = await examine(ctx, given);
|
|
15496
|
+
const report = { ...examined, ...diagnose(facts) };
|
|
14801
15497
|
const s = style(opts.color ?? colorByDefault());
|
|
14802
|
-
ctx.result(report, (r) => renderReport(r, s, !ctx.quiet));
|
|
14803
|
-
if (report.
|
|
15498
|
+
ctx.result(report, (r) => renderReport(r, s, !ctx.quiet, given));
|
|
15499
|
+
if (report.failed > 0 || report.units.length === 0) process.exitCode = 1;
|
|
14804
15500
|
});
|
|
14805
15501
|
}
|
|
14806
|
-
function renderReport(report, s,
|
|
15502
|
+
function renderReport(report, s, showPassing, given = report.root) {
|
|
14807
15503
|
const lines = [];
|
|
14808
|
-
|
|
14809
|
-
|
|
14810
|
-
|
|
14811
|
-
|
|
14812
|
-
|
|
14813
|
-
|
|
14814
|
-
|
|
14815
|
-
|
|
14816
|
-
|
|
14817
|
-
|
|
14818
|
-
|
|
15504
|
+
if (report.inRepo && given !== report.root) lines.push(s.dim(`\u2022 the repo at ${report.root}`));
|
|
15505
|
+
for (const u of report.units) {
|
|
15506
|
+
if (u.findings.length === 0) {
|
|
15507
|
+
const notes = [u.kind === "repo" ? "" : u.kind, u.profile ?? "", ...u.deviations.map((d) => `deviates: ${d}`)];
|
|
15508
|
+
const note = notes.filter(Boolean).join(", ");
|
|
15509
|
+
if (showPassing) lines.push(`${s.ok("\u2713")} ${u.path}${note ? ` ${s.dim(`[${note}]`)}` : ""}`);
|
|
15510
|
+
}
|
|
15511
|
+
for (const f of u.findings) lines.push(`${s.warn("\u2717")} ${f.requirement} ${u.path}: ${f.problem}`);
|
|
15512
|
+
if (showPassing) for (const h of u.hints ?? []) lines.push(s.dim(`\u2022 ${u.path}: ${h}`));
|
|
15513
|
+
}
|
|
15514
|
+
if (report.skipped.length > 0)
|
|
15515
|
+
lines.push(s.dim(`\u2022 not Plexus repos (no PLEXUS.md, no app in apps/), not checked: ${report.skipped.join(", ")}`));
|
|
15516
|
+
if (report.links.length > 0)
|
|
15517
|
+
lines.push(s.dim(`\u2022 symbolic links, not followed, not checked: ${report.links.join(", ")}`));
|
|
15518
|
+
if (report.unreadable.length > 0)
|
|
15519
|
+
lines.push(
|
|
15520
|
+
s.warn(
|
|
15521
|
+
`! could not be read, not checked: ${report.unreadable.map(({ path: path3, why }) => `${path3} (${why})`).join(", ")}`
|
|
15522
|
+
)
|
|
15523
|
+
);
|
|
15524
|
+
const n = report.units.length;
|
|
15525
|
+
const units = `${n} unit${n === 1 ? "" : "s"}`;
|
|
15526
|
+
if (n === 0) lines.push(s.warn(report.inRepo ? "\u2717 no unit found" : "\u2717 no Plexus repo found"));
|
|
15527
|
+
else if (report.failed > 0)
|
|
15528
|
+
lines.push(s.warn(`\u2717 ${report.failed} of ${units} ${report.failed === 1 ? "fails" : "fail"} a check`));
|
|
15529
|
+
else lines.push(s.ok(`\u2713 ${units} pass${n === 1 ? "es" : ""} every check`));
|
|
14819
15530
|
return lines.join("\n");
|
|
14820
15531
|
}
|
|
14821
15532
|
|
|
14822
15533
|
// src/commands/overview.ts
|
|
14823
|
-
import { resolve as
|
|
15534
|
+
import { resolve as resolve6 } from "node:path";
|
|
14824
15535
|
function register5(program2) {
|
|
14825
15536
|
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) => {
|
|
14826
|
-
const ctx =
|
|
14827
|
-
const tree = await overview(ctx,
|
|
15537
|
+
const ctx = contextOf(command);
|
|
15538
|
+
const tree = await overview(ctx, resolve6(dir), { fetch: opts.sync ?? false });
|
|
14828
15539
|
const s = style(opts.color ?? colorByDefault());
|
|
14829
|
-
ctx.result(tree, (t) => renderTree(t, s
|
|
15540
|
+
ctx.result(tree, (t) => renderTree(t, s));
|
|
14830
15541
|
});
|
|
14831
15542
|
}
|
|
14832
|
-
function renderTree(root, s
|
|
14833
|
-
const
|
|
15543
|
+
function renderTree(root, s) {
|
|
15544
|
+
const kinds = new Map(unitsOf(root).map((u) => [u.dir, u.kind]));
|
|
15545
|
+
const annotate = (dir) => annotation(dir, kinds.get(dir), s);
|
|
15546
|
+
const lines = [`${s.bold(`${root.name}/`)}${annotate(root)}`];
|
|
14834
15547
|
const walk2 = (dir, prefix) => {
|
|
14835
15548
|
dir.children.forEach((child, i) => {
|
|
14836
15549
|
const last = i === dir.children.length - 1;
|
|
14837
|
-
lines.push(
|
|
14838
|
-
`${s.dim(`${prefix}${last ? "\u2514\u2500 " : "\u251C\u2500 "}`)}${s.bold(`${child.name}/`)}${annotate(child, s, modules)}`
|
|
14839
|
-
);
|
|
15550
|
+
lines.push(`${s.dim(`${prefix}${last ? "\u2514\u2500 " : "\u251C\u2500 "}`)}${s.bold(`${child.name}/`)}${annotate(child)}`);
|
|
14840
15551
|
walk2(child, `${prefix}${last ? " " : "\u2502 "}`);
|
|
14841
15552
|
});
|
|
14842
15553
|
};
|
|
14843
15554
|
walk2(root, "");
|
|
14844
|
-
if (root.children.length === 0 && !annotate(root
|
|
15555
|
+
if (root.children.length === 0 && !annotate(root))
|
|
14845
15556
|
lines.push(s.dim(`(no git repos, copier templates or projects, or Plexus units found under ${root.path})`));
|
|
14846
15557
|
return lines.join("\n");
|
|
14847
15558
|
}
|
|
14848
|
-
function
|
|
15559
|
+
function annotation(dir, kind, s) {
|
|
14849
15560
|
const tags = [];
|
|
14850
15561
|
if (dir.git) {
|
|
14851
15562
|
const { branch, dirty, tag, remote, ahead, behind } = dir.git;
|
|
@@ -14858,30 +15569,28 @@ function annotate(dir, s, modules) {
|
|
|
14858
15569
|
const src = dir.copier.src === void 0 ? "?" : shortRemote(dir.copier.src);
|
|
14859
15570
|
tags.push(s.info(`[copier ${dir.copier.commit ?? "?"} \u2190 ${src}]`));
|
|
14860
15571
|
}
|
|
14861
|
-
if (
|
|
14862
|
-
const
|
|
14863
|
-
|
|
14864
|
-
tags.push(s.bold(`[${kind} ${dir.declaration.plexus}${mods}]`));
|
|
15572
|
+
if (kind) {
|
|
15573
|
+
const detail2 = kind === "app" ? dir.declaration?.profile : dir.pin;
|
|
15574
|
+
tags.push(s.bold(`[${kind}${detail2 ? ` ${detail2}` : ""}]`));
|
|
14865
15575
|
}
|
|
15576
|
+
if (dir.symlink) tags.push(s.dim("[symbolic link, not followed]"));
|
|
15577
|
+
if (dir.unreadable) tags.push(s.warn(`[! cannot be read: ${dir.unreadable}]`));
|
|
14866
15578
|
for (const p of dir.problems ?? []) tags.push(s.warn(`[! ${p}]`));
|
|
14867
15579
|
return tags.length ? ` ${tags.join(" ")}` : "";
|
|
14868
15580
|
}
|
|
14869
15581
|
|
|
14870
15582
|
// src/commands/propagate.ts
|
|
14871
|
-
import { resolve as
|
|
15583
|
+
import { resolve as resolve7 } from "node:path";
|
|
14872
15584
|
function register6(program2) {
|
|
14873
15585
|
program2.command("propagate").description(
|
|
14874
|
-
"run update in every repo generated from the templates under a directory:
|
|
14875
|
-
).argument("[dir]", "a directory the repos sit under, at any depth", ".").option(
|
|
14876
|
-
"--to <version>",
|
|
14877
|
-
"the version every repo takes, whatever the triggers say (default: each template's newest)"
|
|
14878
|
-
).option("--now", "take the newest version in every repo, whatever the triggers say").option(
|
|
15586
|
+
"run update in every repo generated from the templates under a directory: a patch at once, a minor at the next scheduled pull (--max-age), a major only when asked, one pull request per repo"
|
|
15587
|
+
).argument("[dir]", "a directory the repos sit under, at any depth", ".").option("--to <version>", "the version every repo takes, whatever its step: asking").option("--now", "take the newest version in every repo, whatever its step: asking").option(
|
|
14879
15588
|
"--max-age <days>",
|
|
14880
|
-
"the
|
|
15589
|
+
"the interval for every repo, in days (default: each repo's answer update_max_age, else 7; 0 takes every version)",
|
|
14881
15590
|
(v) => parseMaxAge(v, "--max-age")
|
|
14882
15591
|
).action(async (dir, opts, command) => {
|
|
14883
|
-
const ctx =
|
|
14884
|
-
const result = await propagate(ctx, { dir:
|
|
15592
|
+
const ctx = contextOf(command);
|
|
15593
|
+
const result = await propagate(ctx, { dir: resolve7(dir), to: opts.to, now: opts.now, maxAge: opts.maxAge });
|
|
14885
15594
|
const flags = [opts.to ? `--to ${opts.to}` : "", opts.now ? "--now" : ""].filter(Boolean).join(" ");
|
|
14886
15595
|
ctx.result(result, (r) => renderSummary(r, `plx -y propagate ${flags} ${dir}`.replace(/ +/g, " ")));
|
|
14887
15596
|
if (!isClean(result)) process.exitCode = 1;
|
|
@@ -14889,20 +15598,20 @@ function register6(program2) {
|
|
|
14889
15598
|
}
|
|
14890
15599
|
|
|
14891
15600
|
// src/commands/requirements.ts
|
|
14892
|
-
import { join as
|
|
15601
|
+
import { join as join9, resolve as resolve8 } from "node:path";
|
|
14893
15602
|
function register7(program2) {
|
|
14894
15603
|
program2.command("requirements").description(
|
|
14895
15604
|
"lint a repo: the standard's pages in the compendium, citations, dates, template headers and issue identifiers everywhere"
|
|
14896
15605
|
).argument("[dir]", "a repo checkout: the compendium, a template or any other repo", ".").option("--extract <page>", "print a module page's requirement lines instead of linting (path relative to dir)").option("--write-baseline", `record every current violation in ${BASELINE_FILE} as known, instead of checking`).option("--commit-msg <file>", "check a commit message for issue identifiers instead (the commit-msg hook)").option("--compendium <dir>", "resolve citations against this compendium checkout, not this plx's own index").action(async (dir, opts, command) => {
|
|
14897
|
-
const ctx =
|
|
14898
|
-
const repo =
|
|
14899
|
-
const options = { compendium: opts.compendium ?
|
|
15606
|
+
const ctx = contextOf(command);
|
|
15607
|
+
const repo = resolve8(dir);
|
|
15608
|
+
const options = { compendium: opts.compendium ? resolve8(opts.compendium) : void 0 };
|
|
14900
15609
|
if (opts.extract) {
|
|
14901
|
-
ctx.result(extractRequirements(await ctx.readFile(
|
|
15610
|
+
ctx.result(extractRequirements(await ctx.readFile(join9(repo, opts.extract))));
|
|
14902
15611
|
return;
|
|
14903
15612
|
}
|
|
14904
15613
|
if (opts.commitMsg) {
|
|
14905
|
-
const violations = await checkCommitMessage(ctx,
|
|
15614
|
+
const violations = await checkCommitMessage(ctx, resolve8(opts.commitMsg), repo);
|
|
14906
15615
|
ctx.result(violations, (vs) => vs.map(renderViolation).join("\n"));
|
|
14907
15616
|
if (violations.length > 0) process.exitCode = 1;
|
|
14908
15617
|
return;
|
|
@@ -14924,17 +15633,17 @@ function renderCheck(c) {
|
|
|
14924
15633
|
}
|
|
14925
15634
|
|
|
14926
15635
|
// src/commands/update.ts
|
|
14927
|
-
import { resolve as
|
|
15636
|
+
import { resolve as resolve9 } from "node:path";
|
|
14928
15637
|
function register8(program2) {
|
|
14929
15638
|
program2.command("update").description(
|
|
14930
|
-
"
|
|
14931
|
-
).argument("[dir]", "a repo generated from the templates", ".").option("--to <version>", "
|
|
15639
|
+
"take a version as a pull request on plexus/<version> (copier update at every site, the marker, the lockfile, the workflow refs): a patch at once, a minor at the next scheduled pull (--max-age), a major only when asked"
|
|
15640
|
+
).argument("[dir]", "a repo generated from the templates", ".").option("--to <version>", "take this version, whatever its step: asking").option("--now", "take the newest version, whatever its step: asking").option(
|
|
14932
15641
|
"--max-age <days>",
|
|
14933
|
-
"the
|
|
15642
|
+
"the interval: a minor version is taken once the oldest one not taken is this many days old (default: the repo's answer update_max_age, else 7; 0 takes every version)",
|
|
14934
15643
|
(v) => parseMaxAge(v, "--max-age")
|
|
14935
15644
|
).action(async (dir, opts, command) => {
|
|
14936
|
-
const ctx =
|
|
14937
|
-
const result = await update(ctx, { repo:
|
|
15645
|
+
const ctx = contextOf(command);
|
|
15646
|
+
const result = await update(ctx, { repo: resolve9(dir), to: opts.to, now: opts.now, maxAge: opts.maxAge });
|
|
14938
15647
|
ctx.result(result, (r) => renderSummary(r, `plx -y update --to ${r.version} ${dir}`, "update"));
|
|
14939
15648
|
if (!isClean(result)) process.exitCode = 1;
|
|
14940
15649
|
});
|
|
@@ -14962,7 +15671,7 @@ function buildProgram() {
|
|
|
14962
15671
|
for (const register9 of commands) register9(program2);
|
|
14963
15672
|
return program2;
|
|
14964
15673
|
}
|
|
14965
|
-
function
|
|
15674
|
+
function contextOf(command) {
|
|
14966
15675
|
const opts = command.optsWithGlobals();
|
|
14967
15676
|
return new Context(
|
|
14968
15677
|
opts,
|