oreshnik-cli 0.1.2 → 0.1.3

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/cli.js CHANGED
@@ -3958,6 +3958,31 @@ async function preflightCommand(options) {
3958
3958
  console.log("");
3959
3959
  }
3960
3960
  }
3961
+ const zoneMapPathEarly = join11(ROOT2, "docs", "07_handoffs", "zone-map.json");
3962
+ if (sprint && existsSync10(zoneMapPathEarly)) {
3963
+ try {
3964
+ const zoneRaw = JSON.parse(readFileSync10(zoneMapPathEarly, "utf8").replace(/^\uFEFF/, ""));
3965
+ const zones = zoneRaw.zones || {};
3966
+ let acquiredCount = 0;
3967
+ for (const [pattern, zone] of Object.entries(zones)) {
3968
+ const lockStr = zone.lock || "";
3969
+ const ownerStr = zone.owner || "";
3970
+ const sprints = zone.sprints || [];
3971
+ if (ownerStr !== "none" && lockStr !== "forbidden") {
3972
+ const myLock = lockResult.ok ? lockResult.value.active.find((l) => l.operator === operator && l.zone === pattern) : null;
3973
+ if (!myLock) {
3974
+ const acquireResult = lockService.acquire(pattern, operator, sprint, 7200);
3975
+ if (acquireResult.ok && acquireResult.value.acquired) acquiredCount++;
3976
+ }
3977
+ }
3978
+ }
3979
+ if (acquiredCount > 0) {
3980
+ console.log(` [LOCK] Auto-acquired ${acquiredCount} zone lock(s) for sprint ${sprint}`);
3981
+ console.log("");
3982
+ }
3983
+ } catch {
3984
+ }
3985
+ }
3961
3986
  log("INFO", "5/11 Canonical alignment");
3962
3987
  const canonical2 = createCanonicalService(state, ROOT2);
3963
3988
  const taskBoardPath = join11(ROOT2, "var", "oreshnik", "task-board.json");
@@ -5250,6 +5275,22 @@ async function closeCommand(options) {
5250
5275
  mustGit(git4.push("origin", newMother), `Failed to push mother branch ${newMother}`);
5251
5276
  mustGit(git4.pushTag("origin", tagName), `Failed to push checkpoint tag ${tagName}`);
5252
5277
  log("OK", "Pushed child branch, mother branch, and checkpoint tag.");
5278
+ try {
5279
+ const { createLockService: createLockService2 } = await Promise.resolve().then(() => (init_lock_service(), lock_service_exports));
5280
+ const lockService = createLockService2(ROOT13);
5281
+ const zoneMapPath = join14(ROOT13, "docs", "07_handoffs", "zone-map.json");
5282
+ if (existsSync14(zoneMapPath)) {
5283
+ const zoneRaw = JSON.parse(readFileSync13(zoneMapPath, "utf8").replace(/^\uFEFF/, ""));
5284
+ const zones = zoneRaw.zones || {};
5285
+ let released = 0;
5286
+ for (const [pattern] of Object.entries(zones)) {
5287
+ lockService.release(pattern);
5288
+ released++;
5289
+ }
5290
+ if (released > 0) log("INFO", `Released ${released} zone lock(s).`);
5291
+ }
5292
+ } catch {
5293
+ }
5253
5294
  mustGit(git4.checkout(branch), `Failed to checkout ${branch}`);
5254
5295
  console.log("");
5255
5296
  console.log(`SPRINT CLOSED: ${sprint}`);