@biffo/cli 0.74.1 → 0.76.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/index.js +55 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1628,11 +1628,17 @@ ${issues}`);
|
|
|
1628
1628
|
}
|
|
1629
1629
|
return parsed.data;
|
|
1630
1630
|
}
|
|
1631
|
-
function
|
|
1631
|
+
function parseTrailer(commitMessage, key) {
|
|
1632
1632
|
const body = commitMessage.split("\n").filter((line) => !line.startsWith("#")).join("\n");
|
|
1633
|
-
const match =
|
|
1633
|
+
const match = new RegExp(String.raw`^Core-${key}:[ \t]*(\S.*?)[ \t]*$`, "m").exec(body);
|
|
1634
1634
|
return match?.[1] ?? null;
|
|
1635
1635
|
}
|
|
1636
|
+
function parseDivergenceTrailer(commitMessage) {
|
|
1637
|
+
return parseTrailer(commitMessage, "Divergence");
|
|
1638
|
+
}
|
|
1639
|
+
function parseConvergenceTrailer(commitMessage) {
|
|
1640
|
+
return parseTrailer(commitMessage, "Convergence");
|
|
1641
|
+
}
|
|
1636
1642
|
function resolveBranch(env, gitBranch) {
|
|
1637
1643
|
return (env["GITHUB_HEAD_REF"] || env["GITHUB_REF_NAME"] || gitBranch).trim();
|
|
1638
1644
|
}
|
|
@@ -1657,7 +1663,7 @@ function checkCoreOwnership({
|
|
|
1657
1663
|
commitMessage = "",
|
|
1658
1664
|
warnOnly = []
|
|
1659
1665
|
}) {
|
|
1660
|
-
const empty = { blocked: [], warned: [], divergenceReason: null };
|
|
1666
|
+
const empty = { blocked: [], warned: [], divergenceReason: null, convergenceReason: null };
|
|
1661
1667
|
if (!isInstance) return { skipped: "template", ...empty };
|
|
1662
1668
|
if (branch.startsWith(UPGRADE_BRANCH_PREFIX)) return { skipped: "upgrade-branch", ...empty };
|
|
1663
1669
|
const templateOwned = changedFiles.filter((f) => isTemplateOwned(f, manifest));
|
|
@@ -1673,10 +1679,34 @@ function checkCoreOwnership({
|
|
|
1673
1679
|
else offending.push(path);
|
|
1674
1680
|
}
|
|
1675
1681
|
const divergenceReason = parseDivergenceTrailer(commitMessage);
|
|
1676
|
-
|
|
1677
|
-
|
|
1682
|
+
const convergenceReason = parseConvergenceTrailer(commitMessage);
|
|
1683
|
+
if (offending.length > 0) {
|
|
1684
|
+
if (divergenceReason !== null) {
|
|
1685
|
+
return {
|
|
1686
|
+
skipped: "divergence-trailer",
|
|
1687
|
+
blocked: [],
|
|
1688
|
+
warned,
|
|
1689
|
+
divergenceReason,
|
|
1690
|
+
convergenceReason: null
|
|
1691
|
+
};
|
|
1692
|
+
}
|
|
1693
|
+
if (convergenceReason !== null) {
|
|
1694
|
+
return {
|
|
1695
|
+
skipped: "convergence-trailer",
|
|
1696
|
+
blocked: [],
|
|
1697
|
+
warned,
|
|
1698
|
+
divergenceReason: null,
|
|
1699
|
+
convergenceReason
|
|
1700
|
+
};
|
|
1701
|
+
}
|
|
1678
1702
|
}
|
|
1679
|
-
return {
|
|
1703
|
+
return {
|
|
1704
|
+
skipped: null,
|
|
1705
|
+
blocked: offending,
|
|
1706
|
+
warned,
|
|
1707
|
+
divergenceReason: null,
|
|
1708
|
+
convergenceReason: null
|
|
1709
|
+
};
|
|
1680
1710
|
}
|
|
1681
1711
|
|
|
1682
1712
|
// src/lib/core-upgrade.ts
|
|
@@ -7309,6 +7339,12 @@ async function runOwnershipCheck(argv) {
|
|
|
7309
7339
|
);
|
|
7310
7340
|
return;
|
|
7311
7341
|
}
|
|
7342
|
+
if (result.skipped === "convergence-trailer") {
|
|
7343
|
+
console.log(
|
|
7344
|
+
`\u2713 core ownership guard: allowed by Core-Convergence (reverting toward the template): ${result.convergenceReason ?? ""}`
|
|
7345
|
+
);
|
|
7346
|
+
return;
|
|
7347
|
+
}
|
|
7312
7348
|
if (result.blocked.length === 0) {
|
|
7313
7349
|
console.log("\u2713 core ownership guard: no template-owned paths changed.");
|
|
7314
7350
|
return;
|
|
@@ -7332,11 +7368,20 @@ ${BOLD}What to do instead${OFF}
|
|
|
7332
7368
|
path \u2014 see core-manifest.json for the split.
|
|
7333
7369
|
|
|
7334
7370
|
${result.blocked.some((p) => deletedFiles.includes(p)) ? `${BOLD}Some of these are deletions${OFF}
|
|
7335
|
-
Deleting a template-owned file is
|
|
7336
|
-
core upgrade will
|
|
7337
|
-
|
|
7371
|
+
Deleting a template-owned file is drift like any other: the next
|
|
7372
|
+
\`biffo core upgrade\` will restore it (#395) unless you declare the path an
|
|
7373
|
+
intentional divergence. If the file genuinely should not exist, delete it in
|
|
7374
|
+
biffo-template so every instance drops it.
|
|
7375
|
+
|
|
7376
|
+
` : ""}${BOLD}If this REMOVES divergence (reverting toward the template)${OFF}
|
|
7377
|
+
Reverting a template-owned file to the template's own content, or deleting a
|
|
7378
|
+
file the template no longer ships, leaves the instance strictly closer to the
|
|
7379
|
+
template. Record that it converges \u2014 it is allowed, and kept distinct from a
|
|
7380
|
+
divergence so it never reads as drift to chase later (#385):
|
|
7381
|
+
|
|
7382
|
+
${DIM}Core-Convergence: <what this reverts toward the template>${OFF}
|
|
7338
7383
|
|
|
7339
|
-
|
|
7384
|
+
${BOLD}If the divergence is deliberate${OFF}
|
|
7340
7385
|
Record it in the commit message and it is allowed:
|
|
7341
7386
|
|
|
7342
7387
|
${DIM}Core-Divergence: <why this instance must differ from the template>${OFF}
|