@orkestrel/scaffold 0.0.10 → 0.0.11

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.
@@ -873,6 +873,34 @@ var CLI = class {
873
873
  const full = diffPlan(compiled, readTarget(target, compiled.artifacts.map((artifact) => artifact.path)));
874
874
  return full.drifted + full.missing + full.foreign;
875
875
  }
876
+ /** Compile and audit the selected repair ownership boundary for one structural snapshot. */
877
+ #prepareRepair(spec, target, host, generated, json) {
878
+ const [compiled] = this.#compile(spec, json);
879
+ const scoped = {
880
+ ...compiled,
881
+ blueprint: {
882
+ ...compiled.blueprint,
883
+ overrides: []
884
+ },
885
+ artifacts: compiled.artifacts.filter((artifact) => artifact.origin === "host" || generated && artifact.origin === "computed" && artifact.path !== "package.json")
886
+ };
887
+ let plan;
888
+ try {
889
+ plan = hydratePlan(scoped, host);
890
+ } catch (error) {
891
+ this.#error(error, json);
892
+ }
893
+ try {
894
+ const audit = diffPlan(plan, readTarget(target, plan.artifacts.map((artifact) => artifact.path)));
895
+ return [
896
+ compiled,
897
+ plan,
898
+ audit
899
+ ];
900
+ } catch (error) {
901
+ this.#error(error, json);
902
+ }
903
+ }
876
904
  /** Reject a cancelled prompt (ctrl-c) with the shared `CANCELLED_MESSAGE` — exit 1, nothing written. */
877
905
  async #guard(promise) {
878
906
  try {
@@ -1216,29 +1244,12 @@ var CLI = class {
1216
1244
  } catch (error) {
1217
1245
  this.#error(error, json);
1218
1246
  }
1219
- const [compiled] = this.#compile(spec, json);
1220
1247
  const generated = values.generated === true;
1221
- const scoped = {
1222
- ...compiled,
1223
- blueprint: {
1224
- ...compiled.blueprint,
1225
- overrides: []
1226
- },
1227
- artifacts: compiled.artifacts.filter((artifact) => artifact.origin === "host" || generated && artifact.origin === "computed" && artifact.path !== "package.json")
1228
- };
1229
1248
  const host = values.from?.[0] ?? hostRoot();
1230
- let plan;
1231
- try {
1232
- plan = hydratePlan(scoped, host);
1233
- } catch (error) {
1234
- this.#error(error, json);
1235
- }
1236
- let audit;
1237
- try {
1238
- audit = diffPlan(plan, readTarget(target, plan.artifacts.map((artifact) => artifact.path)));
1239
- } catch (error) {
1240
- this.#error(error, json);
1241
- }
1249
+ const prepared = this.#prepareRepair(spec, target, host, generated, json);
1250
+ const compiled = prepared[0];
1251
+ let plan = prepared[1];
1252
+ let audit = prepared[2];
1242
1253
  if (!json) {
1243
1254
  this.#reporter.line(generated ? REPAIR_GENERATED_SCOPE : REPAIR_SCOPE);
1244
1255
  this.#reporter.section("Audit");
@@ -1268,6 +1279,21 @@ var CLI = class {
1268
1279
  if (values.prune && !json) if (prunePaths.length === 0) this.#reporter.line(PRUNE_EMPTY);
1269
1280
  else for (const line of prunePreview(prunePaths)) this.#reporter.line(line);
1270
1281
  const doPrune = prunePaths.length > 0 && await this.#prune(terminal, pruneConfirmMessage(prunePaths.length), values, json);
1282
+ let currentGlobal;
1283
+ try {
1284
+ currentGlobal = deriveBlueprint(target).global;
1285
+ } catch (error) {
1286
+ this.#error(error, json);
1287
+ }
1288
+ if (currentGlobal !== spec.global) {
1289
+ spec = {
1290
+ ...spec,
1291
+ global: currentGlobal
1292
+ };
1293
+ const refreshed = this.#prepareRepair(spec, target, host, generated, json);
1294
+ plan = refreshed[1];
1295
+ audit = refreshed[2];
1296
+ }
1271
1297
  const spinner = this.#spinner("repairing", json);
1272
1298
  spinner?.start();
1273
1299
  const materializer = createMaterializer({ host });