mainfast 0.3.0 → 0.3.1
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/mainfast.cjs +100 -22
- package/package.json +1 -1
package/dist/mainfast.cjs
CHANGED
|
@@ -14595,7 +14595,7 @@ var import_node_child_process = require("node:child_process");
|
|
|
14595
14595
|
// package.json
|
|
14596
14596
|
var package_default = {
|
|
14597
14597
|
name: "mainfast",
|
|
14598
|
-
version: "0.3.
|
|
14598
|
+
version: "0.3.1",
|
|
14599
14599
|
description: "Set up and run Mainfast, GitHub checks that stop merges from silently breaking main. CLI and MCP server.",
|
|
14600
14600
|
keywords: [
|
|
14601
14601
|
"github-actions",
|
|
@@ -19598,11 +19598,89 @@ var rails = {
|
|
|
19598
19598
|
var FILE3 = /(^|\/)\d{13}-[^/]+\.[cm]?[jt]s$/;
|
|
19599
19599
|
var isMigrationFile = (f) => FILE3.test(f) && !/\.d\.[cm]?ts$/.test(f);
|
|
19600
19600
|
var isTypeorm = (text) => text !== void 0 && /\bMigrationInterface\b/.test(text);
|
|
19601
|
+
function mask(text) {
|
|
19602
|
+
const strings = [];
|
|
19603
|
+
const n2 = text.length;
|
|
19604
|
+
const regexBefore = /(?:^|[(,=:[!&|?{};+\-*%<>~^]|(?:^|[^\w$])(?:return|typeof|case|do|else|in|of|new|delete|void|throw|yield|await))$/;
|
|
19605
|
+
const put = (v) => {
|
|
19606
|
+
strings.push(v);
|
|
19607
|
+
return `\0${strings.length - 1}\0`;
|
|
19608
|
+
};
|
|
19609
|
+
const scan2 = (i, untilBrace) => {
|
|
19610
|
+
let code = "";
|
|
19611
|
+
let depth = 0;
|
|
19612
|
+
while (i < n2) {
|
|
19613
|
+
const c = text[i];
|
|
19614
|
+
const d = text[i + 1];
|
|
19615
|
+
if (c === "/" && d === "/") {
|
|
19616
|
+
while (i < n2 && text[i] !== "\n") i++;
|
|
19617
|
+
code += " ";
|
|
19618
|
+
} else if (c === "/" && d === "*") {
|
|
19619
|
+
const end = text.indexOf("*/", i + 2);
|
|
19620
|
+
i = end < 0 ? n2 : end + 2;
|
|
19621
|
+
code += " ";
|
|
19622
|
+
} else if (c === "'" || c === '"') {
|
|
19623
|
+
let v = "";
|
|
19624
|
+
for (i++; i < n2 && text[i] !== c && text[i] !== "\n"; i++) {
|
|
19625
|
+
if (text[i] === "\\") i++;
|
|
19626
|
+
v += text[i] ?? "";
|
|
19627
|
+
}
|
|
19628
|
+
i++;
|
|
19629
|
+
code += put(v);
|
|
19630
|
+
} else if (c === "`") {
|
|
19631
|
+
let v = "";
|
|
19632
|
+
let plain = true;
|
|
19633
|
+
for (i++; i < n2 && text[i] !== "`"; ) {
|
|
19634
|
+
if (text[i] === "\\") {
|
|
19635
|
+
v += text[i + 1] ?? "";
|
|
19636
|
+
i += 2;
|
|
19637
|
+
} else if (text[i] === "$" && text[i + 1] === "{") {
|
|
19638
|
+
plain = false;
|
|
19639
|
+
i = scan2(i + 2, true)[1];
|
|
19640
|
+
} else v += text[i++];
|
|
19641
|
+
}
|
|
19642
|
+
i++;
|
|
19643
|
+
code += put(plain ? v : null);
|
|
19644
|
+
} else if (c === "/" && regexBefore.test(code.trimEnd())) {
|
|
19645
|
+
let inClass = false;
|
|
19646
|
+
for (i++; i < n2 && text[i] !== "\n"; i++) {
|
|
19647
|
+
if (text[i] === "\\") i++;
|
|
19648
|
+
else if (text[i] === "[") inClass = true;
|
|
19649
|
+
else if (text[i] === "]") inClass = false;
|
|
19650
|
+
else if (text[i] === "/" && !inClass) break;
|
|
19651
|
+
}
|
|
19652
|
+
i++;
|
|
19653
|
+
while (i < n2 && /[a-z]/i.test(text[i])) i++;
|
|
19654
|
+
code += put(null);
|
|
19655
|
+
} else {
|
|
19656
|
+
if (untilBrace && c === "{") depth++;
|
|
19657
|
+
if (untilBrace && c === "}" && depth-- === 0) return [code, i + 1];
|
|
19658
|
+
code += c;
|
|
19659
|
+
i++;
|
|
19660
|
+
}
|
|
19661
|
+
}
|
|
19662
|
+
return [code, i];
|
|
19663
|
+
};
|
|
19664
|
+
return { code: scan2(0, false)[0], strings };
|
|
19665
|
+
}
|
|
19601
19666
|
function migrationName(text, file) {
|
|
19602
|
-
const
|
|
19603
|
-
const
|
|
19604
|
-
const cls =
|
|
19605
|
-
|
|
19667
|
+
const { code, strings } = mask(text);
|
|
19668
|
+
const classes = [...code.matchAll(/\bclass\s+([A-Za-z_$][\w$]*)([^{]*)\{/g)];
|
|
19669
|
+
const cls = classes.find((m) => /\bimplements\b[^{]*\bMigrationInterface\b/.test(m[2])) ?? classes.find((m) => /\bexport\s+(?:default\s+)?$/.test(code.slice(0, m.index))) ?? classes[0];
|
|
19670
|
+
if (!cls) return basename(file).replace(/\.[^.]+$/, "");
|
|
19671
|
+
let top = "";
|
|
19672
|
+
let depth = 1;
|
|
19673
|
+
for (let j = cls.index + cls[0].length; j < code.length && depth > 0; j++) {
|
|
19674
|
+
const ch = code[j];
|
|
19675
|
+
if (ch === "{" || ch === "(" || ch === "[") depth++;
|
|
19676
|
+
else if (ch === "}" || ch === ")" || ch === "]") depth--;
|
|
19677
|
+
top += depth === 1 && ch !== "}" && ch !== ")" && ch !== "]" ? ch : " ";
|
|
19678
|
+
}
|
|
19679
|
+
const field = top.match(
|
|
19680
|
+
/(?:^|[;\s])(?:(?:public|readonly|override|declare|static)\s+)*name\s*[?!]?\s*(?::\s*string\s*)?=\s*\u0000(\d+)\u0000/
|
|
19681
|
+
);
|
|
19682
|
+
const prop = field ? strings[Number(field[1])] : void 0;
|
|
19683
|
+
return prop || cls[1];
|
|
19606
19684
|
}
|
|
19607
19685
|
function list4(tree, root) {
|
|
19608
19686
|
const out = [];
|
|
@@ -22435,10 +22513,10 @@ var rollcall_default = '# Copy to .github/workflows/mainfast-rollcall.yml.\n# No
|
|
|
22435
22513
|
// src/pins.json
|
|
22436
22514
|
var pins_default = {
|
|
22437
22515
|
_comment: "The release commit of each action repository, written into the workflows `init` installs. Updated at each release once the action repositories are tagged (see RELEASING.md).",
|
|
22438
|
-
version: "0.3.
|
|
22516
|
+
version: "0.3.1",
|
|
22439
22517
|
actions: {
|
|
22440
22518
|
intact: "1dbf7a47069256a308403f6a9174f20763e8cd1b",
|
|
22441
|
-
migrations: "
|
|
22519
|
+
migrations: "30e4eb27f5ec4a1fcb5409d0833c1a7cb61a8cef",
|
|
22442
22520
|
rollcall: "e2fc735bb4319a09a9e1ab1b626aba887e9a773e",
|
|
22443
22521
|
owners: "c292e89c2febe1d35746d1c0410d0e0887ef7548",
|
|
22444
22522
|
evidence: "7e1487a5b915eb6d06197c16f5390ccd412d14a6"
|
|
@@ -23094,7 +23172,7 @@ var BIGINT_FORMAT_RANGES = {
|
|
|
23094
23172
|
int64: [/* @__PURE__ */ BigInt("-9223372036854775808"), /* @__PURE__ */ BigInt("9223372036854775807")],
|
|
23095
23173
|
uint64: [/* @__PURE__ */ BigInt(0), /* @__PURE__ */ BigInt("18446744073709551615")]
|
|
23096
23174
|
};
|
|
23097
|
-
function pick(schema,
|
|
23175
|
+
function pick(schema, mask2) {
|
|
23098
23176
|
const currDef = schema._zod.def;
|
|
23099
23177
|
const checks = currDef.checks;
|
|
23100
23178
|
const hasChecks = checks && checks.length > 0;
|
|
@@ -23102,29 +23180,29 @@ function pick(schema, mask) {
|
|
|
23102
23180
|
throw new Error(".pick() cannot be used on object schemas containing refinements");
|
|
23103
23181
|
}
|
|
23104
23182
|
const newShape = {};
|
|
23105
|
-
mirrorShape(newShape, schema, maskedKeys(schema,
|
|
23183
|
+
mirrorShape(newShape, schema, maskedKeys(schema, mask2));
|
|
23106
23184
|
return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
|
|
23107
23185
|
}
|
|
23108
|
-
function maskedKeys(schema,
|
|
23186
|
+
function maskedKeys(schema, mask2) {
|
|
23109
23187
|
const raw = sourceShape(schema);
|
|
23110
23188
|
const keys = [];
|
|
23111
|
-
for (const key2 of Reflect.ownKeys(
|
|
23189
|
+
for (const key2 of Reflect.ownKeys(mask2)) {
|
|
23112
23190
|
if (!Object.getOwnPropertyDescriptor(raw, key2)?.enumerable) {
|
|
23113
23191
|
throw new Error(`Unrecognized key: "${String(key2)}"`);
|
|
23114
23192
|
}
|
|
23115
|
-
if (
|
|
23193
|
+
if (mask2[key2])
|
|
23116
23194
|
keys.push(key2);
|
|
23117
23195
|
}
|
|
23118
23196
|
return keys;
|
|
23119
23197
|
}
|
|
23120
|
-
function omit(schema,
|
|
23198
|
+
function omit(schema, mask2) {
|
|
23121
23199
|
const currDef = schema._zod.def;
|
|
23122
23200
|
const checks = currDef.checks;
|
|
23123
23201
|
const hasChecks = checks && checks.length > 0;
|
|
23124
23202
|
if (hasChecks) {
|
|
23125
23203
|
throw new Error(".omit() cannot be used on object schemas containing refinements");
|
|
23126
23204
|
}
|
|
23127
|
-
const omitted = new Set(maskedKeys(schema,
|
|
23205
|
+
const omitted = new Set(maskedKeys(schema, mask2));
|
|
23128
23206
|
const newShape = {};
|
|
23129
23207
|
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)).filter((key2) => !omitted.has(key2)));
|
|
23130
23208
|
return clone(schema, mergeDefs(currDef, { shape: newShape, checks: [] }));
|
|
@@ -23176,20 +23254,20 @@ function merge(a, b) {
|
|
|
23176
23254
|
});
|
|
23177
23255
|
return clone(a, def);
|
|
23178
23256
|
}
|
|
23179
|
-
function partial(Class2, schema,
|
|
23257
|
+
function partial(Class2, schema, mask2, name = "partial") {
|
|
23180
23258
|
const currDef = schema._zod.def;
|
|
23181
23259
|
const checks = currDef.checks;
|
|
23182
23260
|
const hasChecks = checks && checks.length > 0;
|
|
23183
23261
|
if (hasChecks) {
|
|
23184
23262
|
throw new Error(`.${name}() cannot be used on object schemas containing refinements`);
|
|
23185
23263
|
}
|
|
23186
|
-
const selected =
|
|
23264
|
+
const selected = mask2 ? new Set(maskedKeys(schema, mask2)) : void 0;
|
|
23187
23265
|
const newShape = {};
|
|
23188
23266
|
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), Class2 && ((value, key2) => selected && !selected.has(key2) ? value : new Class2({ type: "optional", innerType: value })));
|
|
23189
23267
|
return clone(schema, mergeDefs(schema._zod.def, { shape: newShape, checks: [] }));
|
|
23190
23268
|
}
|
|
23191
|
-
function required(Class2, schema,
|
|
23192
|
-
const selected =
|
|
23269
|
+
function required(Class2, schema, mask2) {
|
|
23270
|
+
const selected = mask2 ? new Set(maskedKeys(schema, mask2)) : void 0;
|
|
23193
23271
|
const newShape = {};
|
|
23194
23272
|
mirrorShape(newShape, schema, Reflect.ownKeys(sourceShape(schema)), (value, key2) => (
|
|
23195
23273
|
// overwrite with non-optional
|
|
@@ -28730,11 +28808,11 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
28730
28808
|
merge(other) {
|
|
28731
28809
|
return util_exports.merge(this, other);
|
|
28732
28810
|
},
|
|
28733
|
-
pick(
|
|
28734
|
-
return util_exports.pick(this,
|
|
28811
|
+
pick(mask2) {
|
|
28812
|
+
return util_exports.pick(this, mask2);
|
|
28735
28813
|
},
|
|
28736
|
-
omit(
|
|
28737
|
-
return util_exports.omit(this,
|
|
28814
|
+
omit(mask2) {
|
|
28815
|
+
return util_exports.omit(this, mask2);
|
|
28738
28816
|
},
|
|
28739
28817
|
partial(...args) {
|
|
28740
28818
|
return util_exports.partial(ZodOptional, this, args[0]);
|