@biffo/cli 0.340.0 → 0.342.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 +39 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -262,7 +262,14 @@ var CoreManifestSchema2 = z2.object({
|
|
|
262
262
|
* template-owned change", the release job would cut nothing, and the fix
|
|
263
263
|
* would never reach npm for any instance to install.
|
|
264
264
|
*/
|
|
265
|
-
released: z2.array(z2.string()).default([])
|
|
265
|
+
released: z2.array(z2.string()).default([]),
|
|
266
|
+
/**
|
|
267
|
+
* Seed mode: exact repo-relative files the template ships as a one-time
|
|
268
|
+
* scaffold into a USER-OWNED location (they must also be user-owned, e.g.
|
|
269
|
+
* under `infra/`). `biffo core upgrade` creates one only when absent from the
|
|
270
|
+
* instance and never overwrites or deletes it afterwards.
|
|
271
|
+
*/
|
|
272
|
+
seeded: z2.array(z2.string()).default([])
|
|
266
273
|
});
|
|
267
274
|
var HARD_EXCLUDED_DIRS = /* @__PURE__ */ new Set([
|
|
268
275
|
".git",
|
|
@@ -1040,6 +1047,22 @@ function applyUpgradePlan(instanceDir, plan, theirsDir) {
|
|
|
1040
1047
|
}
|
|
1041
1048
|
return { written, deleted };
|
|
1042
1049
|
}
|
|
1050
|
+
function pendingSeeds(instanceDir, theirsDir, seeded) {
|
|
1051
|
+
return seeded.filter(
|
|
1052
|
+
(rel) => existsSync5(join5(theirsDir, rel)) && !existsSync5(join5(instanceDir, rel))
|
|
1053
|
+
);
|
|
1054
|
+
}
|
|
1055
|
+
function seedMissingFiles(instanceDir, theirsDir, seeded) {
|
|
1056
|
+
const created = [];
|
|
1057
|
+
for (const rel of pendingSeeds(instanceDir, theirsDir, seeded)) {
|
|
1058
|
+
const src = join5(theirsDir, rel);
|
|
1059
|
+
const dest = join5(instanceDir, rel);
|
|
1060
|
+
mkdirSync(dirname3(dest), { recursive: true });
|
|
1061
|
+
writeFileSync2(dest, readFileSync4(src));
|
|
1062
|
+
created.push(rel);
|
|
1063
|
+
}
|
|
1064
|
+
return created;
|
|
1065
|
+
}
|
|
1043
1066
|
var ORPHAN_BASELINE_FILE = "biffo.orphan-baseline.json";
|
|
1044
1067
|
var OrphanBaselineSchema = z4.object({
|
|
1045
1068
|
count: z4.number().int().min(0)
|
|
@@ -3487,7 +3510,10 @@ var REGISTERED_ADOPTION_PAIRS = [
|
|
|
3487
3510
|
templateFile: "infra/environments/dev/core-api.core.tf",
|
|
3488
3511
|
userFile: "infra/environments/dev/main.tf",
|
|
3489
3512
|
adoptedPattern: new RegExp(NO_CORE_API_MODULE_SOURCE, "m"),
|
|
3490
|
-
|
|
3513
|
+
// core-api.core.tf references local.core_api_instance_environment, which is
|
|
3514
|
+
// declared only in this user-owned, upgrade-seeded file.
|
|
3515
|
+
requiredInstanceFile: "infra/environments/dev/core-api.instance.tf",
|
|
3516
|
+
remedy: 'Run `biffo core upgrade` to receive `core-api.core.tf` and to seed infra/environments/dev/core-api.instance.tf if it is missing (core-api.core.tf references `local.core_api_instance_environment`, declared only there), then delete the `module "core_api" { ... }` block from infra/environments/dev/main.tf (first move instance-only environment variables into `local.core_api_instance_environment` in infra/environments/dev/core-api.instance.tf, and memory/SnapStart/timeout into terraform.tfvars as `core_api_memory_size` / `core_api_enable_warm_capacity` / `core_api_timeout`), then run `terraform plan` and confirm module.core_api shows no changes to destroy/create.'
|
|
3491
3517
|
}
|
|
3492
3518
|
];
|
|
3493
3519
|
function isAdopted(pair, userFileContent) {
|
|
@@ -3506,7 +3532,11 @@ function checkInstanceAdoption(theirsDir, oursDir, pairs = REGISTERED_ADOPTION_P
|
|
|
3506
3532
|
applicablePairs++;
|
|
3507
3533
|
const userPath = join11(oursDir, pair.userFile);
|
|
3508
3534
|
const content = existsSync10(userPath) ? readFileSync8(userPath, "utf8") : null;
|
|
3509
|
-
|
|
3535
|
+
const scaffoldMissing = pair.requiredInstanceFile !== void 0 && existsSync10(join11(theirsDir, pair.requiredInstanceFile)) && !existsSync10(join11(oursDir, pair.requiredInstanceFile));
|
|
3536
|
+
findings.push({
|
|
3537
|
+
pair,
|
|
3538
|
+
status: !scaffoldMissing && isAdopted(pair, content) ? "adopted" : "unadopted"
|
|
3539
|
+
});
|
|
3510
3540
|
}
|
|
3511
3541
|
return {
|
|
3512
3542
|
examinedInstances: 1,
|
|
@@ -4224,7 +4254,8 @@ async function runCoreUpgradeResolved(options, deps, cleanups) {
|
|
|
4224
4254
|
);
|
|
4225
4255
|
}
|
|
4226
4256
|
const coreVersionCleanup = planCoreVersionCleanup(options.cwd);
|
|
4227
|
-
|
|
4257
|
+
const seedsPending = pendingSeeds(options.cwd, theirsDir, manifest.seeded);
|
|
4258
|
+
if (plan.changes.length === 0 && migrations.entries.length === 0 && seedsPending.length === 0) {
|
|
4228
4259
|
log.success("Nothing to upgrade \u2014 the instance already matches the target for all core files.");
|
|
4229
4260
|
return;
|
|
4230
4261
|
}
|
|
@@ -4351,6 +4382,10 @@ async function buildCommitAndOpenPr(options, deps, plan, migrations, fromVersion
|
|
|
4351
4382
|
const { git } = deps;
|
|
4352
4383
|
const applied = applyUpgradePlan(options.cwd, plan, theirsDir);
|
|
4353
4384
|
const carried = applyMigrationCarry(options.cwd, migrations);
|
|
4385
|
+
const seeded = seedMissingFiles(options.cwd, theirsDir, readCoreManifest(theirsDir).seeded);
|
|
4386
|
+
for (const f of seeded) {
|
|
4387
|
+
log.info(`Seeded ${f} (user-owned scaffold; created because it was absent, never overwritten).`);
|
|
4388
|
+
}
|
|
4354
4389
|
writeInstanceCoreVersion(options.cwd, toVersion);
|
|
4355
4390
|
const establishedOrphanBaseline = orphanRatchet.baseline === null;
|
|
4356
4391
|
if (establishedOrphanBaseline) {
|