@biffo/cli 0.404.0 → 0.404.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/index.js +153 -107
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14643,6 +14643,41 @@ async function runCoreDirectPathsCheck(opts = {}) {
|
|
|
14643
14643
|
console.log(`\u2713 core-direct-paths guard: ${report.summary}`);
|
|
14644
14644
|
}
|
|
14645
14645
|
|
|
14646
|
+
// src/lib/merge-in-progress.ts
|
|
14647
|
+
import { readFileSync as readFileSync39 } from "fs";
|
|
14648
|
+
import { isAbsolute, join as join56 } from "path";
|
|
14649
|
+
async function readMergeHeads(root) {
|
|
14650
|
+
const res = await execa("git", ["rev-parse", "--git-path", "MERGE_HEAD"], {
|
|
14651
|
+
cwd: root,
|
|
14652
|
+
reject: false
|
|
14653
|
+
});
|
|
14654
|
+
if (res.exitCode !== 0) return [];
|
|
14655
|
+
const rel = String(res.stdout).trim();
|
|
14656
|
+
if (!rel) return [];
|
|
14657
|
+
const file = isAbsolute(rel) ? rel : join56(root, rel);
|
|
14658
|
+
try {
|
|
14659
|
+
return readFileSync39(file, "utf8").split("\n").map((l) => l.trim()).filter((l) => /^[0-9a-f]{7,64}$/.test(l));
|
|
14660
|
+
} catch {
|
|
14661
|
+
return [];
|
|
14662
|
+
}
|
|
14663
|
+
}
|
|
14664
|
+
async function pathsFromMergeHeads(root, stagedPaths, heads) {
|
|
14665
|
+
const merged = /* @__PURE__ */ new Set();
|
|
14666
|
+
if (heads.length === 0 || stagedPaths.length === 0) return merged;
|
|
14667
|
+
for (const head of heads) {
|
|
14668
|
+
const res = await execa("git", ["diff", "--cached", "--name-only", "--no-renames", head], {
|
|
14669
|
+
cwd: root,
|
|
14670
|
+
reject: false
|
|
14671
|
+
});
|
|
14672
|
+
if (res.exitCode !== 0) continue;
|
|
14673
|
+
const differs = new Set(
|
|
14674
|
+
String(res.stdout).split("\n").map((l) => l.trim()).filter(Boolean)
|
|
14675
|
+
);
|
|
14676
|
+
for (const path of stagedPaths) if (!differs.has(path)) merged.add(path);
|
|
14677
|
+
}
|
|
14678
|
+
return merged;
|
|
14679
|
+
}
|
|
14680
|
+
|
|
14646
14681
|
// src/lib/template-shipped-paths.ts
|
|
14647
14682
|
var TEMPLATE_UPSTREAM_OWNER = "keiranholloway";
|
|
14648
14683
|
var TEMPLATE_UPSTREAM_REPO = "biffo-template";
|
|
@@ -14748,9 +14783,20 @@ async function runOwnershipCheck(argv) {
|
|
|
14748
14783
|
if (staged) {
|
|
14749
14784
|
const { stdout } = await execa("git", ["diff", "--cached", "--name-status"], { cwd: root });
|
|
14750
14785
|
({ changed: changedFiles, deleted: deletedFiles } = parseNameStatus(stdout));
|
|
14786
|
+
const heads = await readMergeHeads(root);
|
|
14787
|
+
if (heads.length > 0) {
|
|
14788
|
+
const mergedIn = await pathsFromMergeHeads(root, changedFiles, heads);
|
|
14789
|
+
if (mergedIn.size > 0) {
|
|
14790
|
+
changedFiles = changedFiles.filter((p) => !mergedIn.has(p));
|
|
14791
|
+
deletedFiles = deletedFiles.filter((p) => !mergedIn.has(p));
|
|
14792
|
+
console.log(
|
|
14793
|
+
`${DIM}\u2139 merge in progress: ${mergedIn.size} staged path(s) match a parent being merged in and are not this commit's edit.${OFF}`
|
|
14794
|
+
);
|
|
14795
|
+
}
|
|
14796
|
+
}
|
|
14751
14797
|
if (messageFile) {
|
|
14752
|
-
const { readFileSync:
|
|
14753
|
-
if (existsSync64(messageFile)) commitMessage =
|
|
14798
|
+
const { readFileSync: readFileSync53, existsSync: existsSync64 } = await import("fs");
|
|
14799
|
+
if (existsSync64(messageFile)) commitMessage = readFileSync53(messageFile, "utf8");
|
|
14754
14800
|
}
|
|
14755
14801
|
} else {
|
|
14756
14802
|
const base = process.env["GITHUB_BASE_REF"] ?? args[0];
|
|
@@ -14876,20 +14922,20 @@ ${BOLD}If the divergence is deliberate${OFF}
|
|
|
14876
14922
|
|
|
14877
14923
|
// src/scripts/check-distribution-inventory.ts
|
|
14878
14924
|
import { existsSync as existsSync52 } from "fs";
|
|
14879
|
-
import { join as
|
|
14925
|
+
import { join as join58 } from "path";
|
|
14880
14926
|
|
|
14881
14927
|
// src/lib/distribution-inventory.ts
|
|
14882
|
-
import { existsSync as existsSync51, readFileSync as
|
|
14883
|
-
import { join as
|
|
14928
|
+
import { existsSync as existsSync51, readFileSync as readFileSync40 } from "fs";
|
|
14929
|
+
import { join as join57 } from "path";
|
|
14884
14930
|
var INVENTORY_FILENAME = "distribution-inventory.json";
|
|
14885
14931
|
function loadDistributionInventory(root) {
|
|
14886
|
-
const path =
|
|
14932
|
+
const path = join57(root, INVENTORY_FILENAME);
|
|
14887
14933
|
if (!existsSync51(path)) {
|
|
14888
14934
|
throw new Error(
|
|
14889
14935
|
`${INVENTORY_FILENAME} not found at ${root} -- expected it beside core-manifest.json`
|
|
14890
14936
|
);
|
|
14891
14937
|
}
|
|
14892
|
-
return JSON.parse(
|
|
14938
|
+
return JSON.parse(readFileSync40(path, "utf8"));
|
|
14893
14939
|
}
|
|
14894
14940
|
function validateInventory(inventory) {
|
|
14895
14941
|
const violations = [];
|
|
@@ -15049,7 +15095,7 @@ async function runDistributionInventoryCheck(root) {
|
|
|
15049
15095
|
);
|
|
15050
15096
|
return;
|
|
15051
15097
|
}
|
|
15052
|
-
if (!existsSync52(
|
|
15098
|
+
if (!existsSync52(join58(repoRoot, INVENTORY_FILENAME))) {
|
|
15053
15099
|
console.log(
|
|
15054
15100
|
`\u2713 distribution-inventory: skipped \u2014 no ${INVENTORY_FILENAME} at ${repoRoot}. This is a template-only registry; a checkout that legitimately has none has nothing for this guard to check.`
|
|
15055
15101
|
);
|
|
@@ -15075,7 +15121,7 @@ async function runDistributionInventoryCheck(root) {
|
|
|
15075
15121
|
}
|
|
15076
15122
|
|
|
15077
15123
|
// src/scripts/check-distribution-remote-state.ts
|
|
15078
|
-
import { join as
|
|
15124
|
+
import { join as join59 } from "path";
|
|
15079
15125
|
async function ghExecCommand(file, args) {
|
|
15080
15126
|
const result = await execa(file, args, { reject: false });
|
|
15081
15127
|
return { stdout: String(result.stdout ?? ""), exitCode: result.exitCode ?? null };
|
|
@@ -15090,7 +15136,7 @@ async function runDistributionRemoteStateCheck(root) {
|
|
|
15090
15136
|
}
|
|
15091
15137
|
}
|
|
15092
15138
|
console.log(
|
|
15093
|
-
`distribution-remote-state: examined ${assertions.length} remote content assertion(s) declared across ${inventory.entries.length} inventory entries (${
|
|
15139
|
+
`distribution-remote-state: examined ${assertions.length} remote content assertion(s) declared across ${inventory.entries.length} inventory entries (${join59(repoRoot, "distribution-inventory.json")})`
|
|
15094
15140
|
);
|
|
15095
15141
|
if (assertions.length === 0) {
|
|
15096
15142
|
console.log("\u2713 distribution-remote-state: nothing declared to check");
|
|
@@ -15135,8 +15181,8 @@ ${assertion.ref}`;
|
|
|
15135
15181
|
}
|
|
15136
15182
|
|
|
15137
15183
|
// src/lib/eventbridge-log-permission-guard.ts
|
|
15138
|
-
import { readFileSync as
|
|
15139
|
-
import { join as
|
|
15184
|
+
import { readFileSync as readFileSync41, readdirSync as readdirSync22, statSync as statSync14 } from "fs";
|
|
15185
|
+
import { join as join60 } from "path";
|
|
15140
15186
|
var SKIP_DIRS3 = /* @__PURE__ */ new Set(["node_modules", ".git", ".terraform", ".worktrees", "dist"]);
|
|
15141
15187
|
var EVENT_TARGET_TYPE = "aws_cloudwatch_event_target";
|
|
15142
15188
|
var LOG_RESOURCE_POLICY_TYPE = "aws_cloudwatch_log_resource_policy";
|
|
@@ -15213,7 +15259,7 @@ function walkTerraformFiles2(root) {
|
|
|
15213
15259
|
return;
|
|
15214
15260
|
}
|
|
15215
15261
|
for (const entry of entries) {
|
|
15216
|
-
const p =
|
|
15262
|
+
const p = join60(dir, entry);
|
|
15217
15263
|
let st;
|
|
15218
15264
|
try {
|
|
15219
15265
|
st = statSync14(p);
|
|
@@ -15256,7 +15302,7 @@ function auditEventBridgeLogPermissions(root) {
|
|
|
15256
15302
|
let rawEventTargetCount = 0;
|
|
15257
15303
|
let rawLogPolicyCount = 0;
|
|
15258
15304
|
for (const file of files) {
|
|
15259
|
-
const text =
|
|
15305
|
+
const text = readFileSync41(file, "utf8");
|
|
15260
15306
|
rawEventTargetCount += countRawResourceDeclarations2(text, EVENT_TARGET_TYPE);
|
|
15261
15307
|
rawLogPolicyCount += countRawResourceDeclarations2(text, LOG_RESOURCE_POLICY_TYPE);
|
|
15262
15308
|
eventTargetBlocks.push(...findResourceBlocks2(text, file, EVENT_TARGET_TYPE));
|
|
@@ -15354,7 +15400,7 @@ async function runEventBridgeLogPermissionCheck() {
|
|
|
15354
15400
|
|
|
15355
15401
|
// src/scripts/check-instance-adoption.ts
|
|
15356
15402
|
import { existsSync as existsSync53 } from "fs";
|
|
15357
|
-
import { join as
|
|
15403
|
+
import { join as join61 } from "path";
|
|
15358
15404
|
async function runInstanceAdoptionCheck(opts = {}) {
|
|
15359
15405
|
if (!opts.instanceDir) {
|
|
15360
15406
|
console.error(
|
|
@@ -15370,7 +15416,7 @@ async function runInstanceAdoptionCheck(opts = {}) {
|
|
|
15370
15416
|
}
|
|
15371
15417
|
const root = (await execa("git", ["rev-parse", "--show-toplevel"])).stdout.trim();
|
|
15372
15418
|
const theirsDir = opts.theirsDir ?? root;
|
|
15373
|
-
const instanceLabel = opts.instance ??
|
|
15419
|
+
const instanceLabel = opts.instance ?? join61(opts.instanceDir).split("/").filter(Boolean).pop();
|
|
15374
15420
|
const report = checkInstanceAdoption(theirsDir, opts.instanceDir);
|
|
15375
15421
|
console.log(
|
|
15376
15422
|
`examined ${report.examinedInstances} instance (${instanceLabel}) against ${report.registeredPairs} registered pair(s), ${report.applicablePairs} applicable to this instance, against template tree ${theirsDir}`
|
|
@@ -15392,12 +15438,12 @@ async function runInstanceAdoptionCheck(opts = {}) {
|
|
|
15392
15438
|
}
|
|
15393
15439
|
|
|
15394
15440
|
// src/lib/lambda-output-guard.ts
|
|
15395
|
-
import { readFileSync as
|
|
15396
|
-
import { join as
|
|
15441
|
+
import { readFileSync as readFileSync43 } from "fs";
|
|
15442
|
+
import { join as join63 } from "path";
|
|
15397
15443
|
|
|
15398
15444
|
// src/lib/terraform-input-guard.ts
|
|
15399
|
-
import { existsSync as existsSync54, readdirSync as readdirSync23, readFileSync as
|
|
15400
|
-
import { join as
|
|
15445
|
+
import { existsSync as existsSync54, readdirSync as readdirSync23, readFileSync as readFileSync42, statSync as statSync15 } from "fs";
|
|
15446
|
+
import { join as join62 } from "path";
|
|
15401
15447
|
var GUARDED_SUBCOMMANDS = [
|
|
15402
15448
|
"init",
|
|
15403
15449
|
"plan",
|
|
@@ -15411,7 +15457,7 @@ function stripComments2(source) {
|
|
|
15411
15457
|
return source.split("\n").map((line) => line.replace(/(^|\s)#.*$/, "$1")).join("\n");
|
|
15412
15458
|
}
|
|
15413
15459
|
function vendoredPluginServiceDirs(repoRoot) {
|
|
15414
|
-
const servicesDir =
|
|
15460
|
+
const servicesDir = join62(repoRoot, "services");
|
|
15415
15461
|
const result = /* @__PURE__ */ new Set();
|
|
15416
15462
|
let entries;
|
|
15417
15463
|
try {
|
|
@@ -15420,9 +15466,9 @@ function vendoredPluginServiceDirs(repoRoot) {
|
|
|
15420
15466
|
return result;
|
|
15421
15467
|
}
|
|
15422
15468
|
for (const entry of entries) {
|
|
15423
|
-
const full =
|
|
15469
|
+
const full = join62(servicesDir, entry);
|
|
15424
15470
|
if (!existsSync54(full) || !statSync15(full).isDirectory()) continue;
|
|
15425
|
-
if (existsSync54(
|
|
15471
|
+
if (existsSync54(join62(full, "biffo.plugin.json"))) {
|
|
15426
15472
|
result.add(entry);
|
|
15427
15473
|
}
|
|
15428
15474
|
}
|
|
@@ -15444,7 +15490,7 @@ function findWorkflowFiles(repoRoot) {
|
|
|
15444
15490
|
if (entry === ".github" && relative11.startsWith("services/") && vendoredPluginDirs.has(relative11.slice("services/".length))) {
|
|
15445
15491
|
continue;
|
|
15446
15492
|
}
|
|
15447
|
-
const full =
|
|
15493
|
+
const full = join62(dir, entry);
|
|
15448
15494
|
const rel = relative11 ? `${relative11}/${entry}` : entry;
|
|
15449
15495
|
let isDir;
|
|
15450
15496
|
try {
|
|
@@ -15494,7 +15540,7 @@ function checkWorkflowSource(file, rawSource) {
|
|
|
15494
15540
|
}
|
|
15495
15541
|
function checkTerraformInput(repoRoot) {
|
|
15496
15542
|
return findWorkflowFiles(repoRoot).flatMap(
|
|
15497
|
-
(file) => checkWorkflowSource(file,
|
|
15543
|
+
(file) => checkWorkflowSource(file, readFileSync42(join62(repoRoot, file), "utf8"))
|
|
15498
15544
|
);
|
|
15499
15545
|
}
|
|
15500
15546
|
|
|
@@ -15552,7 +15598,7 @@ function checkWorkflowSource2(file, rawSource) {
|
|
|
15552
15598
|
}
|
|
15553
15599
|
function checkLambdaOutput(repoRoot) {
|
|
15554
15600
|
return findWorkflowFiles(repoRoot).flatMap(
|
|
15555
|
-
(file) => checkWorkflowSource2(file,
|
|
15601
|
+
(file) => checkWorkflowSource2(file, readFileSync43(join63(repoRoot, file), "utf8"))
|
|
15556
15602
|
);
|
|
15557
15603
|
}
|
|
15558
15604
|
|
|
@@ -15581,7 +15627,7 @@ async function runLambdaOutputCheck() {
|
|
|
15581
15627
|
|
|
15582
15628
|
// src/scripts/check-migration-body-change.ts
|
|
15583
15629
|
import { existsSync as existsSync55 } from "fs";
|
|
15584
|
-
import { join as
|
|
15630
|
+
import { join as join64 } from "path";
|
|
15585
15631
|
|
|
15586
15632
|
// src/lib/migration-body-change-guard.ts
|
|
15587
15633
|
function checkMigrationBodyChangeMarkers(diffs) {
|
|
@@ -15663,7 +15709,7 @@ async function runMigrationBodyChangeCheck(argv) {
|
|
|
15663
15709
|
);
|
|
15664
15710
|
return;
|
|
15665
15711
|
}
|
|
15666
|
-
if (!existsSync55(
|
|
15712
|
+
if (!existsSync55(join64(root, MIGRATIONS_VERSIONS_DIR))) {
|
|
15667
15713
|
console.log(`\u2713 migration body-change guard: no ${MIGRATIONS_VERSIONS_DIR} in this repo.`);
|
|
15668
15714
|
return;
|
|
15669
15715
|
}
|
|
@@ -15770,7 +15816,7 @@ ${BOLD2}What to do${OFF2}
|
|
|
15770
15816
|
|
|
15771
15817
|
// src/scripts/check-orphan-ratchet.ts
|
|
15772
15818
|
import { existsSync as existsSync56 } from "fs";
|
|
15773
|
-
import { basename as basename3, join as
|
|
15819
|
+
import { basename as basename3, join as join65 } from "path";
|
|
15774
15820
|
function reportOrphan(entry, manifest) {
|
|
15775
15821
|
console.error(` ${entry.path}`);
|
|
15776
15822
|
const { templateOwnedMatch, nearestUserOwnedEntries } = explainOwnership(entry.path, manifest);
|
|
@@ -15809,7 +15855,7 @@ async function runOrphanRatchetCheck(opts = {}) {
|
|
|
15809
15855
|
"self-check mode: --instance-dir was not given, so it defaulted to --theirs-dir (this repo's own root) alongside --base-dir \u2014 all three trees are the same, so this run can only ever find zero orphans by construction. See this script's doc comment. Pass a real instance tree with --instance-dir for a check that can actually find something. biffo-template#1714."
|
|
15810
15856
|
);
|
|
15811
15857
|
}
|
|
15812
|
-
if (!existsSync56(
|
|
15858
|
+
if (!existsSync56(join65(theirsDir, CORE_MANIFEST_FILE))) {
|
|
15813
15859
|
console.log(
|
|
15814
15860
|
`orphan-ratchet guard (${label}): no ${CORE_MANIFEST_FILE} in ${theirsDir} \u2014 this is not a Biffo template/instance tree (a satellite repo never carries one), so there is no ownership manifest to classify paths against. Not applicable; skipping.`
|
|
15815
15861
|
);
|
|
@@ -15840,8 +15886,8 @@ baseline was ${String(ratchet.baseline)}, now ${String(ratchet.count)}. See biff
|
|
|
15840
15886
|
}
|
|
15841
15887
|
|
|
15842
15888
|
// src/lib/ownership-header-claim-guard.ts
|
|
15843
|
-
import { readFileSync as
|
|
15844
|
-
import { join as
|
|
15889
|
+
import { readFileSync as readFileSync44 } from "fs";
|
|
15890
|
+
import { join as join66 } from "path";
|
|
15845
15891
|
var OWNERSHIP_HEADER_SWEEP_DIRS = [
|
|
15846
15892
|
"scripts",
|
|
15847
15893
|
".githooks",
|
|
@@ -16050,7 +16096,7 @@ function sweepOwnershipHeaderClaims(root, options = {}) {
|
|
|
16050
16096
|
for (const rel of files) {
|
|
16051
16097
|
let content;
|
|
16052
16098
|
try {
|
|
16053
|
-
content =
|
|
16099
|
+
content = readFileSync44(join66(root, rel), "utf8");
|
|
16054
16100
|
} catch {
|
|
16055
16101
|
continue;
|
|
16056
16102
|
}
|
|
@@ -16125,8 +16171,8 @@ async function runOwnershipHeaderClaimCheck() {
|
|
|
16125
16171
|
}
|
|
16126
16172
|
|
|
16127
16173
|
// src/scripts/check-pipe-trap.ts
|
|
16128
|
-
import { readFileSync as
|
|
16129
|
-
import { join as
|
|
16174
|
+
import { readFileSync as readFileSync45, readdirSync as readdirSync24 } from "fs";
|
|
16175
|
+
import { join as join67, relative as relative9 } from "path";
|
|
16130
16176
|
|
|
16131
16177
|
// src/lib/pipe-trap-guard.ts
|
|
16132
16178
|
var STATUS_BEARING = [
|
|
@@ -16222,7 +16268,7 @@ function findPipeTraps(source) {
|
|
|
16222
16268
|
function shellFiles(root) {
|
|
16223
16269
|
const out = [];
|
|
16224
16270
|
for (const dir of ["scripts", ".githooks"]) {
|
|
16225
|
-
const full =
|
|
16271
|
+
const full = join67(root, dir);
|
|
16226
16272
|
let entries;
|
|
16227
16273
|
try {
|
|
16228
16274
|
entries = readdirSync24(full, { withFileTypes: true });
|
|
@@ -16232,7 +16278,7 @@ function shellFiles(root) {
|
|
|
16232
16278
|
for (const entry of entries) {
|
|
16233
16279
|
if (!entry.isFile()) continue;
|
|
16234
16280
|
if (dir === "scripts" && !entry.name.endsWith(".sh")) continue;
|
|
16235
|
-
out.push(
|
|
16281
|
+
out.push(join67(full, entry.name));
|
|
16236
16282
|
}
|
|
16237
16283
|
}
|
|
16238
16284
|
return out;
|
|
@@ -16248,7 +16294,7 @@ async function runPipeTrapCheck() {
|
|
|
16248
16294
|
process.exit(1);
|
|
16249
16295
|
}
|
|
16250
16296
|
const findings = files.flatMap(
|
|
16251
|
-
(file) => findPipeTraps(
|
|
16297
|
+
(file) => findPipeTraps(readFileSync45(file, "utf8")).map(
|
|
16252
16298
|
(t) => `${relative9(root, file)}:${t.line} ${t.text}
|
|
16253
16299
|
${t.reason}`
|
|
16254
16300
|
)
|
|
@@ -16265,8 +16311,8 @@ async function runPipeTrapCheck() {
|
|
|
16265
16311
|
}
|
|
16266
16312
|
|
|
16267
16313
|
// src/lib/plugin-allowlist-convention.ts
|
|
16268
|
-
import { readFileSync as
|
|
16269
|
-
import { join as
|
|
16314
|
+
import { readFileSync as readFileSync46 } from "fs";
|
|
16315
|
+
import { join as join68 } from "path";
|
|
16270
16316
|
var COMPUTE_MAIN_TF = "modules/cloud/aws/compute/main.tf";
|
|
16271
16317
|
var PLUGIN_TEMPLATE_MAIN_TF = "modules/plugins/_template/main.tf";
|
|
16272
16318
|
var ALLOWLIST_MAIN_TF = "modules/cloud/aws/plugin-allowlist/main.tf";
|
|
@@ -16277,7 +16323,7 @@ var PLUGIN = "<plugin>";
|
|
|
16277
16323
|
var ACCOUNT = "<account>";
|
|
16278
16324
|
function read(repoRoot, relative11) {
|
|
16279
16325
|
try {
|
|
16280
|
-
return
|
|
16326
|
+
return readFileSync46(join68(repoRoot, relative11), "utf8");
|
|
16281
16327
|
} catch {
|
|
16282
16328
|
throw new Error(`plugin-allowlist drift guard: cannot read ${relative11}`);
|
|
16283
16329
|
}
|
|
@@ -16406,11 +16452,11 @@ async function runPluginAllowlistConventionCheck() {
|
|
|
16406
16452
|
|
|
16407
16453
|
// src/scripts/check-plugin-collisions.ts
|
|
16408
16454
|
import { existsSync as existsSync58 } from "fs";
|
|
16409
|
-
import { join as
|
|
16455
|
+
import { join as join70 } from "path";
|
|
16410
16456
|
|
|
16411
16457
|
// src/lib/plugin-collision-guard.ts
|
|
16412
16458
|
import { existsSync as existsSync57, readdirSync as readdirSync25, statSync as statSync16 } from "fs";
|
|
16413
|
-
import { join as
|
|
16459
|
+
import { join as join69 } from "path";
|
|
16414
16460
|
var PYTEST_SPECIAL = /* @__PURE__ */ new Set(["conftest.py"]);
|
|
16415
16461
|
var IGNORED_DIRS = /* @__PURE__ */ new Set([".venv", "node_modules", "__pycache__", ".git", "dist", "build"]);
|
|
16416
16462
|
function subdirectories(dir) {
|
|
@@ -16418,19 +16464,19 @@ function subdirectories(dir) {
|
|
|
16418
16464
|
return readdirSync25(dir).filter((entry) => {
|
|
16419
16465
|
if (IGNORED_DIRS.has(entry) || entry.startsWith(".")) return false;
|
|
16420
16466
|
try {
|
|
16421
|
-
return statSync16(
|
|
16467
|
+
return statSync16(join69(dir, entry)).isDirectory();
|
|
16422
16468
|
} catch {
|
|
16423
16469
|
return false;
|
|
16424
16470
|
}
|
|
16425
16471
|
});
|
|
16426
16472
|
}
|
|
16427
16473
|
function regularPackagesOf(pluginDir2) {
|
|
16428
|
-
return subdirectories(pluginDir2).filter((name) => existsSync57(
|
|
16474
|
+
return subdirectories(pluginDir2).filter((name) => existsSync57(join69(pluginDir2, name, "__init__.py"))).sort();
|
|
16429
16475
|
}
|
|
16430
16476
|
function bareTestModulesOf(pluginDir2) {
|
|
16431
|
-
const testsDir =
|
|
16477
|
+
const testsDir = join69(pluginDir2, "tests");
|
|
16432
16478
|
if (!existsSync57(testsDir)) return [];
|
|
16433
|
-
if (existsSync57(
|
|
16479
|
+
if (existsSync57(join69(testsDir, "__init__.py"))) return [];
|
|
16434
16480
|
return readdirSync25(testsDir).filter((f) => f.endsWith(".py") && !PYTEST_SPECIAL.has(f)).sort();
|
|
16435
16481
|
}
|
|
16436
16482
|
function findCollisions(servicesDir, pluginDirs) {
|
|
@@ -16439,7 +16485,7 @@ function findCollisions(servicesDir, pluginDirs) {
|
|
|
16439
16485
|
const gather = (kind, namesOf) => {
|
|
16440
16486
|
const claims = /* @__PURE__ */ new Map();
|
|
16441
16487
|
for (const plugin of plugins) {
|
|
16442
|
-
for (const name of namesOf(
|
|
16488
|
+
for (const name of namesOf(join69(servicesDir, plugin))) {
|
|
16443
16489
|
claims.set(name, [...claims.get(name) ?? [], plugin]);
|
|
16444
16490
|
}
|
|
16445
16491
|
}
|
|
@@ -16477,7 +16523,7 @@ function formatCollisions(collisions) {
|
|
|
16477
16523
|
// src/scripts/check-plugin-collisions.ts
|
|
16478
16524
|
async function runPluginCollisionCheck() {
|
|
16479
16525
|
const root = (await execa("git", ["rev-parse", "--show-toplevel"])).stdout.trim();
|
|
16480
|
-
const servicesDir =
|
|
16526
|
+
const servicesDir = join70(root, "services");
|
|
16481
16527
|
if (!existsSync58(servicesDir)) {
|
|
16482
16528
|
console.log("\u2713 plugin collision guard: no services/ directory \u2014 nothing to compare");
|
|
16483
16529
|
return;
|
|
@@ -16495,8 +16541,8 @@ async function runPluginCollisionCheck() {
|
|
|
16495
16541
|
}
|
|
16496
16542
|
|
|
16497
16543
|
// src/lib/plugin-terraform-guard.ts
|
|
16498
|
-
import { existsSync as existsSync59, readFileSync as
|
|
16499
|
-
import { dirname as dirname13, join as
|
|
16544
|
+
import { existsSync as existsSync59, readFileSync as readFileSync47, readdirSync as readdirSync26 } from "fs";
|
|
16545
|
+
import { dirname as dirname13, join as join71, relative as relative10, sep as sep4 } from "path";
|
|
16500
16546
|
var SKIP_DIRS4 = /* @__PURE__ */ new Set(["node_modules", ".git", ".worktrees", "dist", ".venv", "__pycache__"]);
|
|
16501
16547
|
var PLUGIN_MANIFEST_FILE2 = "biffo.plugin.json";
|
|
16502
16548
|
function findPluginManifests(root) {
|
|
@@ -16511,9 +16557,9 @@ function findPluginManifests(root) {
|
|
|
16511
16557
|
for (const entry of entries) {
|
|
16512
16558
|
if (entry.isDirectory()) {
|
|
16513
16559
|
if (SKIP_DIRS4.has(entry.name)) continue;
|
|
16514
|
-
walk2(
|
|
16560
|
+
walk2(join71(dir, entry.name));
|
|
16515
16561
|
} else if (entry.isFile() && entry.name === PLUGIN_MANIFEST_FILE2) {
|
|
16516
|
-
found.push(relative10(root,
|
|
16562
|
+
found.push(relative10(root, join71(dir, entry.name)).split(sep4).join("/"));
|
|
16517
16563
|
}
|
|
16518
16564
|
}
|
|
16519
16565
|
};
|
|
@@ -16523,7 +16569,7 @@ function findPluginManifests(root) {
|
|
|
16523
16569
|
function readSubscriptions(absManifestPath) {
|
|
16524
16570
|
let parsed;
|
|
16525
16571
|
try {
|
|
16526
|
-
parsed = JSON.parse(
|
|
16572
|
+
parsed = JSON.parse(readFileSync47(absManifestPath, "utf8"));
|
|
16527
16573
|
} catch {
|
|
16528
16574
|
return null;
|
|
16529
16575
|
}
|
|
@@ -16538,14 +16584,14 @@ function readSubscriptions(absManifestPath) {
|
|
|
16538
16584
|
}
|
|
16539
16585
|
function checkPluginTerraform(root) {
|
|
16540
16586
|
const violations = [];
|
|
16541
|
-
const coreManifest = existsSync59(
|
|
16587
|
+
const coreManifest = existsSync59(join71(root, CORE_MANIFEST_FILE)) ? readCoreManifest(root) : null;
|
|
16542
16588
|
for (const manifest of findPluginManifests(root)) {
|
|
16543
16589
|
if (coreManifest && !isTemplateOwned(manifest, coreManifest)) continue;
|
|
16544
|
-
const absManifest =
|
|
16590
|
+
const absManifest = join71(root, manifest);
|
|
16545
16591
|
const subscriptions = readSubscriptions(absManifest);
|
|
16546
16592
|
if (subscriptions === null) continue;
|
|
16547
16593
|
const pluginDir2 = dirname13(absManifest);
|
|
16548
|
-
if (existsSync59(
|
|
16594
|
+
if (existsSync59(join71(pluginDir2, "terraform"))) continue;
|
|
16549
16595
|
const relPluginDir = relative10(root, pluginDir2).split(sep4).join("/");
|
|
16550
16596
|
violations.push({
|
|
16551
16597
|
manifest,
|
|
@@ -16577,11 +16623,11 @@ async function runPluginTerraformCheck() {
|
|
|
16577
16623
|
|
|
16578
16624
|
// src/scripts/check-plugin-tool-supply.ts
|
|
16579
16625
|
import { existsSync as existsSync61 } from "fs";
|
|
16580
|
-
import { join as
|
|
16626
|
+
import { join as join73 } from "path";
|
|
16581
16627
|
|
|
16582
16628
|
// src/lib/plugin-tool-supply-audit.ts
|
|
16583
|
-
import { existsSync as existsSync60, readFileSync as
|
|
16584
|
-
import { join as
|
|
16629
|
+
import { existsSync as existsSync60, readFileSync as readFileSync48, readdirSync as readdirSync27, statSync as statSync17 } from "fs";
|
|
16630
|
+
import { join as join72 } from "path";
|
|
16585
16631
|
|
|
16586
16632
|
// src/lib/openrouter-model-snapshot.ts
|
|
16587
16633
|
var OPENROUTER_MODEL_SNAPSHOT_FETCHED_AT = "2026-09-25T20:12:57Z";
|
|
@@ -17056,7 +17102,7 @@ function listDirs(root) {
|
|
|
17056
17102
|
}
|
|
17057
17103
|
return entries.filter((e) => {
|
|
17058
17104
|
try {
|
|
17059
|
-
return statSync17(
|
|
17105
|
+
return statSync17(join72(root, e)).isDirectory();
|
|
17060
17106
|
} catch {
|
|
17061
17107
|
return false;
|
|
17062
17108
|
}
|
|
@@ -17072,7 +17118,7 @@ function walkFiles2(root, accept, skipDir) {
|
|
|
17072
17118
|
return;
|
|
17073
17119
|
}
|
|
17074
17120
|
for (const entry of entries) {
|
|
17075
|
-
const p =
|
|
17121
|
+
const p = join72(dir, entry);
|
|
17076
17122
|
let st;
|
|
17077
17123
|
try {
|
|
17078
17124
|
st = statSync17(p);
|
|
@@ -17098,14 +17144,14 @@ function pluginPythonFiles(pluginDir2) {
|
|
|
17098
17144
|
);
|
|
17099
17145
|
}
|
|
17100
17146
|
function pluginTerraformFiles(pluginDir2) {
|
|
17101
|
-
const tfDir =
|
|
17147
|
+
const tfDir = join72(pluginDir2, "terraform");
|
|
17102
17148
|
let entries;
|
|
17103
17149
|
try {
|
|
17104
17150
|
entries = readdirSync27(tfDir);
|
|
17105
17151
|
} catch {
|
|
17106
17152
|
return [];
|
|
17107
17153
|
}
|
|
17108
|
-
return entries.filter((e) => e.endsWith(".tf")).map((e) =>
|
|
17154
|
+
return entries.filter((e) => e.endsWith(".tf")).map((e) => join72(tfDir, e)).sort();
|
|
17109
17155
|
}
|
|
17110
17156
|
function extractManifestTools(manifestText) {
|
|
17111
17157
|
let parsed;
|
|
@@ -17357,8 +17403,8 @@ function isSnapshotStale(fetchedAt, now) {
|
|
|
17357
17403
|
function normalizeModelId(id) {
|
|
17358
17404
|
return id.endsWith(":online") ? id.slice(0, -":online".length) : id;
|
|
17359
17405
|
}
|
|
17360
|
-
var CONFIG_PY_PATH =
|
|
17361
|
-
var ORCHESTRATION_SCHEMA_PATH =
|
|
17406
|
+
var CONFIG_PY_PATH = join72("services", "api", "src", "api", "config.py");
|
|
17407
|
+
var ORCHESTRATION_SCHEMA_PATH = join72(
|
|
17362
17408
|
"services",
|
|
17363
17409
|
"api",
|
|
17364
17410
|
"src",
|
|
@@ -17371,8 +17417,8 @@ function auditDeclaredModelIds(repoRoot, options = {}) {
|
|
|
17371
17417
|
const snapshotFetchedAt = options.snapshotFetchedAt ?? OPENROUTER_MODEL_SNAPSHOT_FETCHED_AT;
|
|
17372
17418
|
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
17373
17419
|
const snapshotAgeEnforced = options.enforceSnapshotAge ?? true;
|
|
17374
|
-
const configPath =
|
|
17375
|
-
const orchestrationPath =
|
|
17420
|
+
const configPath = join72(repoRoot, CONFIG_PY_PATH);
|
|
17421
|
+
const orchestrationPath = join72(repoRoot, ORCHESTRATION_SCHEMA_PATH);
|
|
17376
17422
|
const configMissing = !existsSync60(configPath);
|
|
17377
17423
|
const orchestrationSchemaMissing = !existsSync60(orchestrationPath);
|
|
17378
17424
|
const knownSet = new Set(knownModelIds);
|
|
@@ -17392,13 +17438,13 @@ function auditDeclaredModelIds(repoRoot, options = {}) {
|
|
|
17392
17438
|
};
|
|
17393
17439
|
let settingsBlind = false;
|
|
17394
17440
|
if (!configMissing) {
|
|
17395
|
-
const settingsFields = extractSettingsModelFields(
|
|
17441
|
+
const settingsFields = extractSettingsModelFields(readFileSync48(configPath, "utf8"));
|
|
17396
17442
|
if (settingsFields.length === 0) settingsBlind = true;
|
|
17397
17443
|
for (const { field, value } of settingsFields) record(`${CONFIG_PY_PATH}#${field}`, value);
|
|
17398
17444
|
}
|
|
17399
17445
|
let curatedFieldsBlind = false;
|
|
17400
17446
|
if (!orchestrationSchemaMissing) {
|
|
17401
|
-
const curated = extractCuratedModelFields(
|
|
17447
|
+
const curated = extractCuratedModelFields(readFileSync48(orchestrationPath, "utf8"));
|
|
17402
17448
|
if (curated.rawFieldCount > 0 && curated.fields.every((f) => f.defaultValue === null && f.optionValues.length === 0)) {
|
|
17403
17449
|
curatedFieldsBlind = true;
|
|
17404
17450
|
}
|
|
@@ -17446,7 +17492,7 @@ function auditDeclaredModelIds(repoRoot, options = {}) {
|
|
|
17446
17492
|
function discoverPluginDirs(pluginsRoot) {
|
|
17447
17493
|
return listDirs(pluginsRoot).filter((name) => {
|
|
17448
17494
|
try {
|
|
17449
|
-
return statSync17(
|
|
17495
|
+
return statSync17(join72(pluginsRoot, name, "biffo.plugin.json")).isFile();
|
|
17450
17496
|
} catch {
|
|
17451
17497
|
return false;
|
|
17452
17498
|
}
|
|
@@ -17459,8 +17505,8 @@ function auditPluginToolSupply(pluginsRoot) {
|
|
|
17459
17505
|
let terraformBlind = false;
|
|
17460
17506
|
let totalDeclaredTools = 0;
|
|
17461
17507
|
for (const name of pluginNames) {
|
|
17462
|
-
const pluginDir2 =
|
|
17463
|
-
const manifestText =
|
|
17508
|
+
const pluginDir2 = join72(pluginsRoot, name);
|
|
17509
|
+
const manifestText = readFileSync48(join72(pluginDir2, "biffo.plugin.json"), "utf8");
|
|
17464
17510
|
const manifest = extractManifestTools(manifestText);
|
|
17465
17511
|
if (manifest.parseError) {
|
|
17466
17512
|
findings.push({
|
|
@@ -17478,13 +17524,13 @@ function auditPluginToolSupply(pluginsRoot) {
|
|
|
17478
17524
|
totalDeclaredTools += manifest.tools.length;
|
|
17479
17525
|
const pySources = pluginPythonFiles(pluginDir2).map((f) => ({
|
|
17480
17526
|
file: f,
|
|
17481
|
-
text:
|
|
17527
|
+
text: readFileSync48(f, "utf8")
|
|
17482
17528
|
}));
|
|
17483
17529
|
const resolver = buildSymbolResolver(pySources);
|
|
17484
17530
|
const registry = extractToolRegistryEntries(pySources, resolver);
|
|
17485
17531
|
if (registry.rawToolDefinitionCount > 0 && registry.entries.length === 0) registryBlind = true;
|
|
17486
17532
|
const tfFiles = pluginTerraformFiles(pluginDir2);
|
|
17487
|
-
const tfText = tfFiles.map((f) =>
|
|
17533
|
+
const tfText = tfFiles.map((f) => readFileSync48(f, "utf8")).join("\n");
|
|
17488
17534
|
const terraform = extractTerraformEnvKeys(tfText);
|
|
17489
17535
|
if (terraform.rawMarkerCount > 0 && terraform.resolvedBlockCount === 0) terraformBlind = true;
|
|
17490
17536
|
for (const toolName of manifest.tools) {
|
|
@@ -17558,7 +17604,7 @@ function auditPluginToolSupply(pluginsRoot) {
|
|
|
17558
17604
|
requiredEnvVars: envResult.envVars,
|
|
17559
17605
|
missingEnvVars: anyWired ? [] : envResult.envVars,
|
|
17560
17606
|
status: anyWired ? "ok" : "missing-env",
|
|
17561
|
-
detail: anyWired ? `${entry.predicate}() is satisfiable: at least one of ${JSON.stringify(envResult.envVars)} is wired in Terraform` : `${entry.predicate}() reads ${JSON.stringify(envResult.envVars)} \u2014 NONE of these are wired by any environment_variables block under ${
|
|
17607
|
+
detail: anyWired ? `${entry.predicate}() is satisfiable: at least one of ${JSON.stringify(envResult.envVars)} is wired in Terraform` : `${entry.predicate}() reads ${JSON.stringify(envResult.envVars)} \u2014 NONE of these are wired by any environment_variables block under ${join72(pluginDir2, "terraform")}, so this deployment can never supply it`
|
|
17562
17608
|
});
|
|
17563
17609
|
}
|
|
17564
17610
|
}
|
|
@@ -17598,7 +17644,7 @@ async function runPluginToolSupplyCheck() {
|
|
|
17598
17644
|
return;
|
|
17599
17645
|
}
|
|
17600
17646
|
let allOk = true;
|
|
17601
|
-
const pluginsRoot =
|
|
17647
|
+
const pluginsRoot = join73(root, "services", "_plugins");
|
|
17602
17648
|
if (!existsSync61(pluginsRoot)) {
|
|
17603
17649
|
console.log("\u2713 plugin tool-supply guard: no services/_plugins/ \u2014 nothing to audit");
|
|
17604
17650
|
} else {
|
|
@@ -17629,7 +17675,7 @@ async function runPluginToolSupplyCheck() {
|
|
|
17629
17675
|
console.log(`\u2713 plugin tool-supply guard: ${report.summary}`);
|
|
17630
17676
|
}
|
|
17631
17677
|
}
|
|
17632
|
-
const servicesApiRoot =
|
|
17678
|
+
const servicesApiRoot = join73(root, "services", "api");
|
|
17633
17679
|
if (!existsSync61(servicesApiRoot)) {
|
|
17634
17680
|
console.log("\u2713 plugin model-id guard: no services/api/ \u2014 nothing to audit");
|
|
17635
17681
|
} else {
|
|
@@ -17811,10 +17857,10 @@ async function runReleaseSubjectCheck(argv) {
|
|
|
17811
17857
|
}
|
|
17812
17858
|
|
|
17813
17859
|
// src/scripts/check-shared-file-reduction.ts
|
|
17814
|
-
import { readFileSync as
|
|
17860
|
+
import { readFileSync as readFileSync50 } from "fs";
|
|
17815
17861
|
|
|
17816
17862
|
// src/lib/shared-file-reduction-guard.ts
|
|
17817
|
-
import { readFileSync as
|
|
17863
|
+
import { readFileSync as readFileSync49 } from "fs";
|
|
17818
17864
|
var LEAF_TEST_CALLS = /* @__PURE__ */ new Set(["it", "test"]);
|
|
17819
17865
|
var SUITE_CALLS = /* @__PURE__ */ new Set(["describe", "suite"]);
|
|
17820
17866
|
var TEST_FILE_PATTERN = /\.(test|spec)\.(ts|tsx|mts|cts|js|jsx|mjs|cjs)$/;
|
|
@@ -17941,7 +17987,7 @@ function formatReductionReport(report) {
|
|
|
17941
17987
|
// src/scripts/check-shared-file-reduction.ts
|
|
17942
17988
|
function readStdin() {
|
|
17943
17989
|
try {
|
|
17944
|
-
return
|
|
17990
|
+
return readFileSync50(0, "utf8");
|
|
17945
17991
|
} catch {
|
|
17946
17992
|
return "";
|
|
17947
17993
|
}
|
|
@@ -17958,15 +18004,15 @@ function pairsFromTsv(tsv) {
|
|
|
17958
18004
|
const [target, existingPath, incomingPath] = fields;
|
|
17959
18005
|
pairs.push({
|
|
17960
18006
|
target,
|
|
17961
|
-
existing:
|
|
17962
|
-
incoming:
|
|
18007
|
+
existing: readFileSync50(existingPath, "utf8"),
|
|
18008
|
+
incoming: readFileSync50(incomingPath, "utf8")
|
|
17963
18009
|
});
|
|
17964
18010
|
}
|
|
17965
18011
|
return pairs;
|
|
17966
18012
|
}
|
|
17967
18013
|
function loadAccepted(manifestPath) {
|
|
17968
18014
|
if (!manifestPath) return {};
|
|
17969
|
-
const parsed = JSON.parse(
|
|
18015
|
+
const parsed = JSON.parse(readFileSync50(manifestPath, "utf8"));
|
|
17970
18016
|
return parsed.acceptedReductions ?? {};
|
|
17971
18017
|
}
|
|
17972
18018
|
async function runSharedFileReductionCheck(args) {
|
|
@@ -17974,13 +18020,13 @@ async function runSharedFileReductionCheck(args) {
|
|
|
17974
18020
|
let accepted;
|
|
17975
18021
|
try {
|
|
17976
18022
|
if (args.pairs) {
|
|
17977
|
-
pairs = pairsFromTsv(args.pairs === "-" ? readStdin() :
|
|
18023
|
+
pairs = pairsFromTsv(args.pairs === "-" ? readStdin() : readFileSync50(args.pairs, "utf8"));
|
|
17978
18024
|
} else if (args.target && args.existing && args.incoming) {
|
|
17979
18025
|
pairs = [
|
|
17980
18026
|
{
|
|
17981
18027
|
target: args.target,
|
|
17982
|
-
existing:
|
|
17983
|
-
incoming:
|
|
18028
|
+
existing: readFileSync50(args.existing, "utf8"),
|
|
18029
|
+
incoming: readFileSync50(args.incoming, "utf8")
|
|
17984
18030
|
}
|
|
17985
18031
|
];
|
|
17986
18032
|
} else {
|
|
@@ -18015,11 +18061,11 @@ async function runSharedFileReductionCheck(args) {
|
|
|
18015
18061
|
|
|
18016
18062
|
// src/scripts/check-skeleton-drift.ts
|
|
18017
18063
|
import { existsSync as existsSync62, readdirSync as readdirSync29 } from "fs";
|
|
18018
|
-
import { join as
|
|
18064
|
+
import { join as join75 } from "path";
|
|
18019
18065
|
|
|
18020
18066
|
// src/lib/skeleton-drift-guard.ts
|
|
18021
|
-
import { readFileSync as
|
|
18022
|
-
import { join as
|
|
18067
|
+
import { readFileSync as readFileSync51, readdirSync as readdirSync28, statSync as statSync18 } from "fs";
|
|
18068
|
+
import { join as join74 } from "path";
|
|
18023
18069
|
var isWorkflow = (rel) => rel.startsWith(".github/workflows/") && (rel.endsWith(".yml") || rel.endsWith(".yaml"));
|
|
18024
18070
|
var isRootLayout = (rel) => rel.endsWith("src/app/layout.tsx");
|
|
18025
18071
|
var uncommented = (contents) => contents.split("\n").filter((line) => !/^\s*(\/\/|\/\*|\*)/.test(line)).join("\n");
|
|
@@ -18083,7 +18129,7 @@ function walk(dir, base = dir) {
|
|
|
18083
18129
|
}
|
|
18084
18130
|
for (const entry of entries) {
|
|
18085
18131
|
if (entry === ".venv" || entry === "node_modules" || entry === ".git") continue;
|
|
18086
|
-
const abs =
|
|
18132
|
+
const abs = join74(dir, entry);
|
|
18087
18133
|
let isDir;
|
|
18088
18134
|
try {
|
|
18089
18135
|
isDir = statSync18(abs).isDirectory();
|
|
@@ -18105,7 +18151,7 @@ function auditSkeleton(skeletonRoot, name, rules = SKELETON_RULES) {
|
|
|
18105
18151
|
if (!rule.appliesTo(rel)) continue;
|
|
18106
18152
|
let contents;
|
|
18107
18153
|
try {
|
|
18108
|
-
contents =
|
|
18154
|
+
contents = readFileSync51(join74(skeletonRoot, rel), "utf8");
|
|
18109
18155
|
} catch {
|
|
18110
18156
|
continue;
|
|
18111
18157
|
}
|
|
@@ -18134,23 +18180,23 @@ function formatViolations2(violations) {
|
|
|
18134
18180
|
|
|
18135
18181
|
// src/scripts/check-skeleton-drift.ts
|
|
18136
18182
|
function discoverSkeletons(root) {
|
|
18137
|
-
const skeletonsDir =
|
|
18183
|
+
const skeletonsDir = join75(root, "_skeletons");
|
|
18138
18184
|
let entries;
|
|
18139
18185
|
try {
|
|
18140
18186
|
entries = readdirSync29(skeletonsDir, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
|
|
18141
18187
|
} catch {
|
|
18142
18188
|
return [];
|
|
18143
18189
|
}
|
|
18144
|
-
return entries.filter((name) => existsSync62(
|
|
18190
|
+
return entries.filter((name) => existsSync62(join75(skeletonsDir, name, ".github", "workflows", "ci.yml"))).sort();
|
|
18145
18191
|
}
|
|
18146
18192
|
async function runSkeletonDriftCheck() {
|
|
18147
18193
|
const root = (await execa("git", ["rev-parse", "--show-toplevel"])).stdout.trim();
|
|
18148
18194
|
const skeletons = discoverSkeletons(root);
|
|
18149
18195
|
let filesConsidered = 0;
|
|
18150
18196
|
for (const name of skeletons) {
|
|
18151
|
-
const skeletonRoot =
|
|
18197
|
+
const skeletonRoot = join75(root, "_skeletons", name);
|
|
18152
18198
|
filesConsidered += findWorkflowFiles(skeletonRoot).length;
|
|
18153
|
-
if (existsSync62(
|
|
18199
|
+
if (existsSync62(join75(skeletonRoot, "apps", "frontend", "src", "app", "layout.tsx"))) {
|
|
18154
18200
|
filesConsidered += 1;
|
|
18155
18201
|
}
|
|
18156
18202
|
}
|
|
@@ -18158,7 +18204,7 @@ async function runSkeletonDriftCheck() {
|
|
|
18158
18204
|
`audited ${skeletons.length} skeleton(s) (${skeletons.join(", ") || "none"}), ${filesConsidered} file(s) considered, under ${root}/_skeletons`
|
|
18159
18205
|
);
|
|
18160
18206
|
if (skeletons.length === 0) {
|
|
18161
|
-
if (!existsSync62(
|
|
18207
|
+
if (!existsSync62(join75(root, "_skeletons"))) {
|
|
18162
18208
|
console.log(
|
|
18163
18209
|
`\xB7 Skeleton-drift guard: no _skeletons/ directory under ${root} \u2014 this is not a repo that ships scaffolding (a satellite repo never carries one). Not applicable; skipping.`
|
|
18164
18210
|
);
|
|
@@ -18170,7 +18216,7 @@ async function runSkeletonDriftCheck() {
|
|
|
18170
18216
|
process.exit(1);
|
|
18171
18217
|
}
|
|
18172
18218
|
const violations = skeletons.flatMap(
|
|
18173
|
-
(name) => auditSkeleton(
|
|
18219
|
+
(name) => auditSkeleton(join75(root, "_skeletons", name), name)
|
|
18174
18220
|
);
|
|
18175
18221
|
if (violations.length > 0) {
|
|
18176
18222
|
console.error("\u2717 Skeleton-drift guard: drift found between this repo and its scaffolding\n");
|
|
@@ -18371,8 +18417,8 @@ function rawArgsAfter(subcommand) {
|
|
|
18371
18417
|
}
|
|
18372
18418
|
|
|
18373
18419
|
// src/commands/doctor.ts
|
|
18374
|
-
import { existsSync as existsSync63, readFileSync as
|
|
18375
|
-
import { join as
|
|
18420
|
+
import { existsSync as existsSync63, readFileSync as readFileSync52 } from "fs";
|
|
18421
|
+
import { join as join77, resolve as resolve24 } from "path";
|
|
18376
18422
|
import chalk21 from "chalk";
|
|
18377
18423
|
import { Command as Command27 } from "commander";
|
|
18378
18424
|
|
|
@@ -18713,11 +18759,11 @@ async function reapAllBareBranches(cwd, branches, worktrees, currentBranch, deps
|
|
|
18713
18759
|
|
|
18714
18760
|
// src/lib/scratch-clone-scan.ts
|
|
18715
18761
|
import { readdirSync as readdirSync30, statSync as statSync19 } from "fs";
|
|
18716
|
-
import { join as
|
|
18762
|
+
import { join as join76 } from "path";
|
|
18717
18763
|
var INTEGRATION_BRANCH = "dev";
|
|
18718
18764
|
function isPlainCloneDir(path) {
|
|
18719
18765
|
try {
|
|
18720
|
-
return statSync19(
|
|
18766
|
+
return statSync19(join76(path, ".git")).isDirectory();
|
|
18721
18767
|
} catch {
|
|
18722
18768
|
return false;
|
|
18723
18769
|
}
|
|
@@ -18732,7 +18778,7 @@ async function findScratchCloneCandidates(estateRoot, deps) {
|
|
|
18732
18778
|
const names = readdirSync30(estateRoot, { withFileTypes: true }).filter((e) => e.isDirectory()).map((e) => e.name);
|
|
18733
18779
|
const candidates = [];
|
|
18734
18780
|
for (const name of names) {
|
|
18735
|
-
const path =
|
|
18781
|
+
const path = join76(estateRoot, name);
|
|
18736
18782
|
if (!isPlainCloneDir(path)) continue;
|
|
18737
18783
|
let branch;
|
|
18738
18784
|
try {
|
|
@@ -18912,10 +18958,10 @@ function printScratchCloneReports(estateRoot, reports) {
|
|
|
18912
18958
|
);
|
|
18913
18959
|
}
|
|
18914
18960
|
function readLocalCoreVersion(cwd) {
|
|
18915
|
-
const path =
|
|
18961
|
+
const path = join77(cwd, INSTANCE_CORE_FILE);
|
|
18916
18962
|
if (!existsSync63(path)) return null;
|
|
18917
18963
|
try {
|
|
18918
|
-
return extractVersionField(
|
|
18964
|
+
return extractVersionField(readFileSync52(path, "utf8"));
|
|
18919
18965
|
} catch {
|
|
18920
18966
|
return null;
|
|
18921
18967
|
}
|
|
@@ -18935,10 +18981,10 @@ function extractVersionField(contents) {
|
|
|
18935
18981
|
return match?.[1] ?? null;
|
|
18936
18982
|
}
|
|
18937
18983
|
function readFossil(cwd) {
|
|
18938
|
-
const path =
|
|
18984
|
+
const path = join77(cwd, CORE_VERSION_FILE);
|
|
18939
18985
|
if (!existsSync63(path)) return null;
|
|
18940
18986
|
try {
|
|
18941
|
-
const value =
|
|
18987
|
+
const value = readFileSync52(path, "utf8").trim();
|
|
18942
18988
|
return value === "" ? null : value;
|
|
18943
18989
|
} catch {
|
|
18944
18990
|
return null;
|