canopycms-cdk 0.0.63 → 0.0.65

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.
@@ -814,10 +814,10 @@ var require_src2 = __commonJS({
814
814
  var fs_1 = __require("fs");
815
815
  var debug_1 = __importDefault2(require_src());
816
816
  var log7 = debug_1.default("@kwsites/file-exists");
817
- function check(path15, isFile, isDirectory) {
818
- log7(`checking %s`, path15);
817
+ function check(path16, isFile, isDirectory) {
818
+ log7(`checking %s`, path16);
819
819
  try {
820
- const stat = fs_1.statSync(path15);
820
+ const stat = fs_1.statSync(path16);
821
821
  if (stat.isFile() && isFile) {
822
822
  log7(`[OK] path represents a file`);
823
823
  return true;
@@ -837,8 +837,8 @@ var require_src2 = __commonJS({
837
837
  throw e5;
838
838
  }
839
839
  }
840
- function exists2(path15, type = exports.READABLE) {
841
- return check(path15, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
840
+ function exists2(path16, type = exports.READABLE) {
841
+ return check(path16, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
842
842
  }
843
843
  exports.exists = exists2;
844
844
  exports.FILE = 1;
@@ -927,54 +927,54 @@ var require_polyfills = __commonJS({
927
927
  }
928
928
  var chdir;
929
929
  module.exports = patch;
930
- function patch(fs10) {
930
+ function patch(fs11) {
931
931
  if (constants2.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
932
- patchLchmod(fs10);
933
- }
934
- if (!fs10.lutimes) {
935
- patchLutimes(fs10);
936
- }
937
- fs10.chown = chownFix(fs10.chown);
938
- fs10.fchown = chownFix(fs10.fchown);
939
- fs10.lchown = chownFix(fs10.lchown);
940
- fs10.chmod = chmodFix(fs10.chmod);
941
- fs10.fchmod = chmodFix(fs10.fchmod);
942
- fs10.lchmod = chmodFix(fs10.lchmod);
943
- fs10.chownSync = chownFixSync(fs10.chownSync);
944
- fs10.fchownSync = chownFixSync(fs10.fchownSync);
945
- fs10.lchownSync = chownFixSync(fs10.lchownSync);
946
- fs10.chmodSync = chmodFixSync(fs10.chmodSync);
947
- fs10.fchmodSync = chmodFixSync(fs10.fchmodSync);
948
- fs10.lchmodSync = chmodFixSync(fs10.lchmodSync);
949
- fs10.stat = statFix(fs10.stat);
950
- fs10.fstat = statFix(fs10.fstat);
951
- fs10.lstat = statFix(fs10.lstat);
952
- fs10.statSync = statFixSync(fs10.statSync);
953
- fs10.fstatSync = statFixSync(fs10.fstatSync);
954
- fs10.lstatSync = statFixSync(fs10.lstatSync);
955
- if (fs10.chmod && !fs10.lchmod) {
956
- fs10.lchmod = function(path15, mode, cb) {
932
+ patchLchmod(fs11);
933
+ }
934
+ if (!fs11.lutimes) {
935
+ patchLutimes(fs11);
936
+ }
937
+ fs11.chown = chownFix(fs11.chown);
938
+ fs11.fchown = chownFix(fs11.fchown);
939
+ fs11.lchown = chownFix(fs11.lchown);
940
+ fs11.chmod = chmodFix(fs11.chmod);
941
+ fs11.fchmod = chmodFix(fs11.fchmod);
942
+ fs11.lchmod = chmodFix(fs11.lchmod);
943
+ fs11.chownSync = chownFixSync(fs11.chownSync);
944
+ fs11.fchownSync = chownFixSync(fs11.fchownSync);
945
+ fs11.lchownSync = chownFixSync(fs11.lchownSync);
946
+ fs11.chmodSync = chmodFixSync(fs11.chmodSync);
947
+ fs11.fchmodSync = chmodFixSync(fs11.fchmodSync);
948
+ fs11.lchmodSync = chmodFixSync(fs11.lchmodSync);
949
+ fs11.stat = statFix(fs11.stat);
950
+ fs11.fstat = statFix(fs11.fstat);
951
+ fs11.lstat = statFix(fs11.lstat);
952
+ fs11.statSync = statFixSync(fs11.statSync);
953
+ fs11.fstatSync = statFixSync(fs11.fstatSync);
954
+ fs11.lstatSync = statFixSync(fs11.lstatSync);
955
+ if (fs11.chmod && !fs11.lchmod) {
956
+ fs11.lchmod = function(path16, mode, cb) {
957
957
  if (cb) process.nextTick(cb);
958
958
  };
959
- fs10.lchmodSync = function() {
959
+ fs11.lchmodSync = function() {
960
960
  };
961
961
  }
962
- if (fs10.chown && !fs10.lchown) {
963
- fs10.lchown = function(path15, uid, gid, cb) {
962
+ if (fs11.chown && !fs11.lchown) {
963
+ fs11.lchown = function(path16, uid, gid, cb) {
964
964
  if (cb) process.nextTick(cb);
965
965
  };
966
- fs10.lchownSync = function() {
966
+ fs11.lchownSync = function() {
967
967
  };
968
968
  }
969
969
  if (platform === "win32") {
970
- fs10.rename = typeof fs10.rename !== "function" ? fs10.rename : (function(fs$rename) {
970
+ fs11.rename = typeof fs11.rename !== "function" ? fs11.rename : (function(fs$rename) {
971
971
  function rename(from, to, cb) {
972
972
  var start = Date.now();
973
973
  var backoff = 0;
974
974
  fs$rename(from, to, function CB(er) {
975
975
  if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
976
976
  setTimeout(function() {
977
- fs10.stat(to, function(stater, st) {
977
+ fs11.stat(to, function(stater, st) {
978
978
  if (stater && stater.code === "ENOENT")
979
979
  fs$rename(from, to, CB);
980
980
  else
@@ -990,9 +990,9 @@ var require_polyfills = __commonJS({
990
990
  }
991
991
  if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
992
992
  return rename;
993
- })(fs10.rename);
993
+ })(fs11.rename);
994
994
  }
995
- fs10.read = typeof fs10.read !== "function" ? fs10.read : (function(fs$read) {
995
+ fs11.read = typeof fs11.read !== "function" ? fs11.read : (function(fs$read) {
996
996
  function read(fd, buffer, offset, length, position, callback_) {
997
997
  var callback;
998
998
  if (callback_ && typeof callback_ === "function") {
@@ -1000,22 +1000,22 @@ var require_polyfills = __commonJS({
1000
1000
  callback = function(er, _3, __) {
1001
1001
  if (er && er.code === "EAGAIN" && eagCounter < 10) {
1002
1002
  eagCounter++;
1003
- return fs$read.call(fs10, fd, buffer, offset, length, position, callback);
1003
+ return fs$read.call(fs11, fd, buffer, offset, length, position, callback);
1004
1004
  }
1005
1005
  callback_.apply(this, arguments);
1006
1006
  };
1007
1007
  }
1008
- return fs$read.call(fs10, fd, buffer, offset, length, position, callback);
1008
+ return fs$read.call(fs11, fd, buffer, offset, length, position, callback);
1009
1009
  }
1010
1010
  if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
1011
1011
  return read;
1012
- })(fs10.read);
1013
- fs10.readSync = typeof fs10.readSync !== "function" ? fs10.readSync : /* @__PURE__ */ (function(fs$readSync) {
1012
+ })(fs11.read);
1013
+ fs11.readSync = typeof fs11.readSync !== "function" ? fs11.readSync : /* @__PURE__ */ (function(fs$readSync) {
1014
1014
  return function(fd, buffer, offset, length, position) {
1015
1015
  var eagCounter = 0;
1016
1016
  while (true) {
1017
1017
  try {
1018
- return fs$readSync.call(fs10, fd, buffer, offset, length, position);
1018
+ return fs$readSync.call(fs11, fd, buffer, offset, length, position);
1019
1019
  } catch (er) {
1020
1020
  if (er.code === "EAGAIN" && eagCounter < 10) {
1021
1021
  eagCounter++;
@@ -1025,11 +1025,11 @@ var require_polyfills = __commonJS({
1025
1025
  }
1026
1026
  }
1027
1027
  };
1028
- })(fs10.readSync);
1029
- function patchLchmod(fs11) {
1030
- fs11.lchmod = function(path15, mode, callback) {
1031
- fs11.open(
1032
- path15,
1028
+ })(fs11.readSync);
1029
+ function patchLchmod(fs12) {
1030
+ fs12.lchmod = function(path16, mode, callback) {
1031
+ fs12.open(
1032
+ path16,
1033
1033
  constants2.O_WRONLY | constants2.O_SYMLINK,
1034
1034
  mode,
1035
1035
  function(err, fd) {
@@ -1037,80 +1037,80 @@ var require_polyfills = __commonJS({
1037
1037
  if (callback) callback(err);
1038
1038
  return;
1039
1039
  }
1040
- fs11.fchmod(fd, mode, function(err2) {
1041
- fs11.close(fd, function(err22) {
1040
+ fs12.fchmod(fd, mode, function(err2) {
1041
+ fs12.close(fd, function(err22) {
1042
1042
  if (callback) callback(err2 || err22);
1043
1043
  });
1044
1044
  });
1045
1045
  }
1046
1046
  );
1047
1047
  };
1048
- fs11.lchmodSync = function(path15, mode) {
1049
- var fd = fs11.openSync(path15, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
1048
+ fs12.lchmodSync = function(path16, mode) {
1049
+ var fd = fs12.openSync(path16, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
1050
1050
  var threw = true;
1051
1051
  var ret;
1052
1052
  try {
1053
- ret = fs11.fchmodSync(fd, mode);
1053
+ ret = fs12.fchmodSync(fd, mode);
1054
1054
  threw = false;
1055
1055
  } finally {
1056
1056
  if (threw) {
1057
1057
  try {
1058
- fs11.closeSync(fd);
1058
+ fs12.closeSync(fd);
1059
1059
  } catch (er) {
1060
1060
  }
1061
1061
  } else {
1062
- fs11.closeSync(fd);
1062
+ fs12.closeSync(fd);
1063
1063
  }
1064
1064
  }
1065
1065
  return ret;
1066
1066
  };
1067
1067
  }
1068
- function patchLutimes(fs11) {
1069
- if (constants2.hasOwnProperty("O_SYMLINK") && fs11.futimes) {
1070
- fs11.lutimes = function(path15, at, mt, cb) {
1071
- fs11.open(path15, constants2.O_SYMLINK, function(er, fd) {
1068
+ function patchLutimes(fs12) {
1069
+ if (constants2.hasOwnProperty("O_SYMLINK") && fs12.futimes) {
1070
+ fs12.lutimes = function(path16, at, mt, cb) {
1071
+ fs12.open(path16, constants2.O_SYMLINK, function(er, fd) {
1072
1072
  if (er) {
1073
1073
  if (cb) cb(er);
1074
1074
  return;
1075
1075
  }
1076
- fs11.futimes(fd, at, mt, function(er2) {
1077
- fs11.close(fd, function(er22) {
1076
+ fs12.futimes(fd, at, mt, function(er2) {
1077
+ fs12.close(fd, function(er22) {
1078
1078
  if (cb) cb(er2 || er22);
1079
1079
  });
1080
1080
  });
1081
1081
  });
1082
1082
  };
1083
- fs11.lutimesSync = function(path15, at, mt) {
1084
- var fd = fs11.openSync(path15, constants2.O_SYMLINK);
1083
+ fs12.lutimesSync = function(path16, at, mt) {
1084
+ var fd = fs12.openSync(path16, constants2.O_SYMLINK);
1085
1085
  var ret;
1086
1086
  var threw = true;
1087
1087
  try {
1088
- ret = fs11.futimesSync(fd, at, mt);
1088
+ ret = fs12.futimesSync(fd, at, mt);
1089
1089
  threw = false;
1090
1090
  } finally {
1091
1091
  if (threw) {
1092
1092
  try {
1093
- fs11.closeSync(fd);
1093
+ fs12.closeSync(fd);
1094
1094
  } catch (er) {
1095
1095
  }
1096
1096
  } else {
1097
- fs11.closeSync(fd);
1097
+ fs12.closeSync(fd);
1098
1098
  }
1099
1099
  }
1100
1100
  return ret;
1101
1101
  };
1102
- } else if (fs11.futimes) {
1103
- fs11.lutimes = function(_a3, _b, _c5, cb) {
1102
+ } else if (fs12.futimes) {
1103
+ fs12.lutimes = function(_a3, _b, _c5, cb) {
1104
1104
  if (cb) process.nextTick(cb);
1105
1105
  };
1106
- fs11.lutimesSync = function() {
1106
+ fs12.lutimesSync = function() {
1107
1107
  };
1108
1108
  }
1109
1109
  }
1110
1110
  function chmodFix(orig) {
1111
1111
  if (!orig) return orig;
1112
1112
  return function(target, mode, cb) {
1113
- return orig.call(fs10, target, mode, function(er) {
1113
+ return orig.call(fs11, target, mode, function(er) {
1114
1114
  if (chownErOk(er)) er = null;
1115
1115
  if (cb) cb.apply(this, arguments);
1116
1116
  });
@@ -1120,7 +1120,7 @@ var require_polyfills = __commonJS({
1120
1120
  if (!orig) return orig;
1121
1121
  return function(target, mode) {
1122
1122
  try {
1123
- return orig.call(fs10, target, mode);
1123
+ return orig.call(fs11, target, mode);
1124
1124
  } catch (er) {
1125
1125
  if (!chownErOk(er)) throw er;
1126
1126
  }
@@ -1129,7 +1129,7 @@ var require_polyfills = __commonJS({
1129
1129
  function chownFix(orig) {
1130
1130
  if (!orig) return orig;
1131
1131
  return function(target, uid, gid, cb) {
1132
- return orig.call(fs10, target, uid, gid, function(er) {
1132
+ return orig.call(fs11, target, uid, gid, function(er) {
1133
1133
  if (chownErOk(er)) er = null;
1134
1134
  if (cb) cb.apply(this, arguments);
1135
1135
  });
@@ -1139,7 +1139,7 @@ var require_polyfills = __commonJS({
1139
1139
  if (!orig) return orig;
1140
1140
  return function(target, uid, gid) {
1141
1141
  try {
1142
- return orig.call(fs10, target, uid, gid);
1142
+ return orig.call(fs11, target, uid, gid);
1143
1143
  } catch (er) {
1144
1144
  if (!chownErOk(er)) throw er;
1145
1145
  }
@@ -1159,13 +1159,13 @@ var require_polyfills = __commonJS({
1159
1159
  }
1160
1160
  if (cb) cb.apply(this, arguments);
1161
1161
  }
1162
- return options ? orig.call(fs10, target, options, callback) : orig.call(fs10, target, callback);
1162
+ return options ? orig.call(fs11, target, options, callback) : orig.call(fs11, target, callback);
1163
1163
  };
1164
1164
  }
1165
1165
  function statFixSync(orig) {
1166
1166
  if (!orig) return orig;
1167
1167
  return function(target, options) {
1168
- var stats = options ? orig.call(fs10, target, options) : orig.call(fs10, target);
1168
+ var stats = options ? orig.call(fs11, target, options) : orig.call(fs11, target);
1169
1169
  if (stats) {
1170
1170
  if (stats.uid < 0) stats.uid += 4294967296;
1171
1171
  if (stats.gid < 0) stats.gid += 4294967296;
@@ -1194,16 +1194,16 @@ var require_legacy_streams = __commonJS({
1194
1194
  "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module) {
1195
1195
  var Stream = __require("stream").Stream;
1196
1196
  module.exports = legacy;
1197
- function legacy(fs10) {
1197
+ function legacy(fs11) {
1198
1198
  return {
1199
1199
  ReadStream,
1200
1200
  WriteStream
1201
1201
  };
1202
- function ReadStream(path15, options) {
1203
- if (!(this instanceof ReadStream)) return new ReadStream(path15, options);
1202
+ function ReadStream(path16, options) {
1203
+ if (!(this instanceof ReadStream)) return new ReadStream(path16, options);
1204
1204
  Stream.call(this);
1205
1205
  var self2 = this;
1206
- this.path = path15;
1206
+ this.path = path16;
1207
1207
  this.fd = null;
1208
1208
  this.readable = true;
1209
1209
  this.paused = false;
@@ -1237,7 +1237,7 @@ var require_legacy_streams = __commonJS({
1237
1237
  });
1238
1238
  return;
1239
1239
  }
1240
- fs10.open(this.path, this.flags, this.mode, function(err, fd) {
1240
+ fs11.open(this.path, this.flags, this.mode, function(err, fd) {
1241
1241
  if (err) {
1242
1242
  self2.emit("error", err);
1243
1243
  self2.readable = false;
@@ -1248,10 +1248,10 @@ var require_legacy_streams = __commonJS({
1248
1248
  self2._read();
1249
1249
  });
1250
1250
  }
1251
- function WriteStream(path15, options) {
1252
- if (!(this instanceof WriteStream)) return new WriteStream(path15, options);
1251
+ function WriteStream(path16, options) {
1252
+ if (!(this instanceof WriteStream)) return new WriteStream(path16, options);
1253
1253
  Stream.call(this);
1254
- this.path = path15;
1254
+ this.path = path16;
1255
1255
  this.fd = null;
1256
1256
  this.writable = true;
1257
1257
  this.flags = "w";
@@ -1276,7 +1276,7 @@ var require_legacy_streams = __commonJS({
1276
1276
  this.busy = false;
1277
1277
  this._queue = [];
1278
1278
  if (this.fd === null) {
1279
- this._open = fs10.open;
1279
+ this._open = fs11.open;
1280
1280
  this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
1281
1281
  this.flush();
1282
1282
  }
@@ -1311,7 +1311,7 @@ var require_clone = __commonJS({
1311
1311
  // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
1312
1312
  var require_graceful_fs = __commonJS({
1313
1313
  "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module) {
1314
- var fs10 = __require("fs");
1314
+ var fs11 = __require("fs");
1315
1315
  var polyfills = require_polyfills();
1316
1316
  var legacy = require_legacy_streams();
1317
1317
  var clone = require_clone();
@@ -1343,12 +1343,12 @@ var require_graceful_fs = __commonJS({
1343
1343
  m5 = "GFS4: " + m5.split(/\n/).join("\nGFS4: ");
1344
1344
  console.error(m5);
1345
1345
  };
1346
- if (!fs10[gracefulQueue]) {
1346
+ if (!fs11[gracefulQueue]) {
1347
1347
  queue = global[gracefulQueue] || [];
1348
- publishQueue(fs10, queue);
1349
- fs10.close = (function(fs$close) {
1348
+ publishQueue(fs11, queue);
1349
+ fs11.close = (function(fs$close) {
1350
1350
  function close(fd, cb) {
1351
- return fs$close.call(fs10, fd, function(err) {
1351
+ return fs$close.call(fs11, fd, function(err) {
1352
1352
  if (!err) {
1353
1353
  resetQueue();
1354
1354
  }
@@ -1360,48 +1360,48 @@ var require_graceful_fs = __commonJS({
1360
1360
  value: fs$close
1361
1361
  });
1362
1362
  return close;
1363
- })(fs10.close);
1364
- fs10.closeSync = (function(fs$closeSync) {
1363
+ })(fs11.close);
1364
+ fs11.closeSync = (function(fs$closeSync) {
1365
1365
  function closeSync(fd) {
1366
- fs$closeSync.apply(fs10, arguments);
1366
+ fs$closeSync.apply(fs11, arguments);
1367
1367
  resetQueue();
1368
1368
  }
1369
1369
  Object.defineProperty(closeSync, previousSymbol, {
1370
1370
  value: fs$closeSync
1371
1371
  });
1372
1372
  return closeSync;
1373
- })(fs10.closeSync);
1373
+ })(fs11.closeSync);
1374
1374
  if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
1375
1375
  process.on("exit", function() {
1376
- debug2(fs10[gracefulQueue]);
1377
- __require("assert").equal(fs10[gracefulQueue].length, 0);
1376
+ debug2(fs11[gracefulQueue]);
1377
+ __require("assert").equal(fs11[gracefulQueue].length, 0);
1378
1378
  });
1379
1379
  }
1380
1380
  }
1381
1381
  var queue;
1382
1382
  if (!global[gracefulQueue]) {
1383
- publishQueue(global, fs10[gracefulQueue]);
1384
- }
1385
- module.exports = patch(clone(fs10));
1386
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs10.__patched) {
1387
- module.exports = patch(fs10);
1388
- fs10.__patched = true;
1389
- }
1390
- function patch(fs11) {
1391
- polyfills(fs11);
1392
- fs11.gracefulify = patch;
1393
- fs11.createReadStream = createReadStream;
1394
- fs11.createWriteStream = createWriteStream;
1395
- var fs$readFile = fs11.readFile;
1396
- fs11.readFile = readFile;
1397
- function readFile(path15, options, cb) {
1383
+ publishQueue(global, fs11[gracefulQueue]);
1384
+ }
1385
+ module.exports = patch(clone(fs11));
1386
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs11.__patched) {
1387
+ module.exports = patch(fs11);
1388
+ fs11.__patched = true;
1389
+ }
1390
+ function patch(fs12) {
1391
+ polyfills(fs12);
1392
+ fs12.gracefulify = patch;
1393
+ fs12.createReadStream = createReadStream;
1394
+ fs12.createWriteStream = createWriteStream;
1395
+ var fs$readFile = fs12.readFile;
1396
+ fs12.readFile = readFile;
1397
+ function readFile(path16, options, cb) {
1398
1398
  if (typeof options === "function")
1399
1399
  cb = options, options = null;
1400
- return go$readFile(path15, options, cb);
1401
- function go$readFile(path16, options2, cb2, startTime) {
1402
- return fs$readFile(path16, options2, function(err) {
1400
+ return go$readFile(path16, options, cb);
1401
+ function go$readFile(path17, options2, cb2, startTime) {
1402
+ return fs$readFile(path17, options2, function(err) {
1403
1403
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1404
- enqueue([go$readFile, [path16, options2, cb2], err, startTime || Date.now(), Date.now()]);
1404
+ enqueue([go$readFile, [path17, options2, cb2], err, startTime || Date.now(), Date.now()]);
1405
1405
  else {
1406
1406
  if (typeof cb2 === "function")
1407
1407
  cb2.apply(this, arguments);
@@ -1409,16 +1409,16 @@ var require_graceful_fs = __commonJS({
1409
1409
  });
1410
1410
  }
1411
1411
  }
1412
- var fs$writeFile = fs11.writeFile;
1413
- fs11.writeFile = writeFile;
1414
- function writeFile(path15, data2, options, cb) {
1412
+ var fs$writeFile = fs12.writeFile;
1413
+ fs12.writeFile = writeFile;
1414
+ function writeFile(path16, data2, options, cb) {
1415
1415
  if (typeof options === "function")
1416
1416
  cb = options, options = null;
1417
- return go$writeFile(path15, data2, options, cb);
1418
- function go$writeFile(path16, data3, options2, cb2, startTime) {
1419
- return fs$writeFile(path16, data3, options2, function(err) {
1417
+ return go$writeFile(path16, data2, options, cb);
1418
+ function go$writeFile(path17, data3, options2, cb2, startTime) {
1419
+ return fs$writeFile(path17, data3, options2, function(err) {
1420
1420
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1421
- enqueue([go$writeFile, [path16, data3, options2, cb2], err, startTime || Date.now(), Date.now()]);
1421
+ enqueue([go$writeFile, [path17, data3, options2, cb2], err, startTime || Date.now(), Date.now()]);
1422
1422
  else {
1423
1423
  if (typeof cb2 === "function")
1424
1424
  cb2.apply(this, arguments);
@@ -1426,17 +1426,17 @@ var require_graceful_fs = __commonJS({
1426
1426
  });
1427
1427
  }
1428
1428
  }
1429
- var fs$appendFile = fs11.appendFile;
1429
+ var fs$appendFile = fs12.appendFile;
1430
1430
  if (fs$appendFile)
1431
- fs11.appendFile = appendFile;
1432
- function appendFile(path15, data2, options, cb) {
1431
+ fs12.appendFile = appendFile;
1432
+ function appendFile(path16, data2, options, cb) {
1433
1433
  if (typeof options === "function")
1434
1434
  cb = options, options = null;
1435
- return go$appendFile(path15, data2, options, cb);
1436
- function go$appendFile(path16, data3, options2, cb2, startTime) {
1437
- return fs$appendFile(path16, data3, options2, function(err) {
1435
+ return go$appendFile(path16, data2, options, cb);
1436
+ function go$appendFile(path17, data3, options2, cb2, startTime) {
1437
+ return fs$appendFile(path17, data3, options2, function(err) {
1438
1438
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1439
- enqueue([go$appendFile, [path16, data3, options2, cb2], err, startTime || Date.now(), Date.now()]);
1439
+ enqueue([go$appendFile, [path17, data3, options2, cb2], err, startTime || Date.now(), Date.now()]);
1440
1440
  else {
1441
1441
  if (typeof cb2 === "function")
1442
1442
  cb2.apply(this, arguments);
@@ -1444,9 +1444,9 @@ var require_graceful_fs = __commonJS({
1444
1444
  });
1445
1445
  }
1446
1446
  }
1447
- var fs$copyFile = fs11.copyFile;
1447
+ var fs$copyFile = fs12.copyFile;
1448
1448
  if (fs$copyFile)
1449
- fs11.copyFile = copyFile;
1449
+ fs12.copyFile = copyFile;
1450
1450
  function copyFile(src, dest, flags, cb) {
1451
1451
  if (typeof flags === "function") {
1452
1452
  cb = flags;
@@ -1464,34 +1464,34 @@ var require_graceful_fs = __commonJS({
1464
1464
  });
1465
1465
  }
1466
1466
  }
1467
- var fs$readdir = fs11.readdir;
1468
- fs11.readdir = readdir;
1467
+ var fs$readdir = fs12.readdir;
1468
+ fs12.readdir = readdir;
1469
1469
  var noReaddirOptionVersions = /^v[0-5]\./;
1470
- function readdir(path15, options, cb) {
1470
+ function readdir(path16, options, cb) {
1471
1471
  if (typeof options === "function")
1472
1472
  cb = options, options = null;
1473
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path16, options2, cb2, startTime) {
1474
- return fs$readdir(path16, fs$readdirCallback(
1475
- path16,
1473
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path17, options2, cb2, startTime) {
1474
+ return fs$readdir(path17, fs$readdirCallback(
1475
+ path17,
1476
1476
  options2,
1477
1477
  cb2,
1478
1478
  startTime
1479
1479
  ));
1480
- } : function go$readdir2(path16, options2, cb2, startTime) {
1481
- return fs$readdir(path16, options2, fs$readdirCallback(
1482
- path16,
1480
+ } : function go$readdir2(path17, options2, cb2, startTime) {
1481
+ return fs$readdir(path17, options2, fs$readdirCallback(
1482
+ path17,
1483
1483
  options2,
1484
1484
  cb2,
1485
1485
  startTime
1486
1486
  ));
1487
1487
  };
1488
- return go$readdir(path15, options, cb);
1489
- function fs$readdirCallback(path16, options2, cb2, startTime) {
1488
+ return go$readdir(path16, options, cb);
1489
+ function fs$readdirCallback(path17, options2, cb2, startTime) {
1490
1490
  return function(err, files) {
1491
1491
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1492
1492
  enqueue([
1493
1493
  go$readdir,
1494
- [path16, options2, cb2],
1494
+ [path17, options2, cb2],
1495
1495
  err,
1496
1496
  startTime || Date.now(),
1497
1497
  Date.now()
@@ -1506,21 +1506,21 @@ var require_graceful_fs = __commonJS({
1506
1506
  }
1507
1507
  }
1508
1508
  if (process.version.substr(0, 4) === "v0.8") {
1509
- var legStreams = legacy(fs11);
1509
+ var legStreams = legacy(fs12);
1510
1510
  ReadStream = legStreams.ReadStream;
1511
1511
  WriteStream = legStreams.WriteStream;
1512
1512
  }
1513
- var fs$ReadStream = fs11.ReadStream;
1513
+ var fs$ReadStream = fs12.ReadStream;
1514
1514
  if (fs$ReadStream) {
1515
1515
  ReadStream.prototype = Object.create(fs$ReadStream.prototype);
1516
1516
  ReadStream.prototype.open = ReadStream$open;
1517
1517
  }
1518
- var fs$WriteStream = fs11.WriteStream;
1518
+ var fs$WriteStream = fs12.WriteStream;
1519
1519
  if (fs$WriteStream) {
1520
1520
  WriteStream.prototype = Object.create(fs$WriteStream.prototype);
1521
1521
  WriteStream.prototype.open = WriteStream$open;
1522
1522
  }
1523
- Object.defineProperty(fs11, "ReadStream", {
1523
+ Object.defineProperty(fs12, "ReadStream", {
1524
1524
  get: function() {
1525
1525
  return ReadStream;
1526
1526
  },
@@ -1530,7 +1530,7 @@ var require_graceful_fs = __commonJS({
1530
1530
  enumerable: true,
1531
1531
  configurable: true
1532
1532
  });
1533
- Object.defineProperty(fs11, "WriteStream", {
1533
+ Object.defineProperty(fs12, "WriteStream", {
1534
1534
  get: function() {
1535
1535
  return WriteStream;
1536
1536
  },
@@ -1541,7 +1541,7 @@ var require_graceful_fs = __commonJS({
1541
1541
  configurable: true
1542
1542
  });
1543
1543
  var FileReadStream = ReadStream;
1544
- Object.defineProperty(fs11, "FileReadStream", {
1544
+ Object.defineProperty(fs12, "FileReadStream", {
1545
1545
  get: function() {
1546
1546
  return FileReadStream;
1547
1547
  },
@@ -1552,7 +1552,7 @@ var require_graceful_fs = __commonJS({
1552
1552
  configurable: true
1553
1553
  });
1554
1554
  var FileWriteStream = WriteStream;
1555
- Object.defineProperty(fs11, "FileWriteStream", {
1555
+ Object.defineProperty(fs12, "FileWriteStream", {
1556
1556
  get: function() {
1557
1557
  return FileWriteStream;
1558
1558
  },
@@ -1562,7 +1562,7 @@ var require_graceful_fs = __commonJS({
1562
1562
  enumerable: true,
1563
1563
  configurable: true
1564
1564
  });
1565
- function ReadStream(path15, options) {
1565
+ function ReadStream(path16, options) {
1566
1566
  if (this instanceof ReadStream)
1567
1567
  return fs$ReadStream.apply(this, arguments), this;
1568
1568
  else
@@ -1582,7 +1582,7 @@ var require_graceful_fs = __commonJS({
1582
1582
  }
1583
1583
  });
1584
1584
  }
1585
- function WriteStream(path15, options) {
1585
+ function WriteStream(path16, options) {
1586
1586
  if (this instanceof WriteStream)
1587
1587
  return fs$WriteStream.apply(this, arguments), this;
1588
1588
  else
@@ -1600,22 +1600,22 @@ var require_graceful_fs = __commonJS({
1600
1600
  }
1601
1601
  });
1602
1602
  }
1603
- function createReadStream(path15, options) {
1604
- return new fs11.ReadStream(path15, options);
1603
+ function createReadStream(path16, options) {
1604
+ return new fs12.ReadStream(path16, options);
1605
1605
  }
1606
- function createWriteStream(path15, options) {
1607
- return new fs11.WriteStream(path15, options);
1606
+ function createWriteStream(path16, options) {
1607
+ return new fs12.WriteStream(path16, options);
1608
1608
  }
1609
- var fs$open = fs11.open;
1610
- fs11.open = open;
1611
- function open(path15, flags, mode, cb) {
1609
+ var fs$open = fs12.open;
1610
+ fs12.open = open;
1611
+ function open(path16, flags, mode, cb) {
1612
1612
  if (typeof mode === "function")
1613
1613
  cb = mode, mode = null;
1614
- return go$open(path15, flags, mode, cb);
1615
- function go$open(path16, flags2, mode2, cb2, startTime) {
1616
- return fs$open(path16, flags2, mode2, function(err, fd) {
1614
+ return go$open(path16, flags, mode, cb);
1615
+ function go$open(path17, flags2, mode2, cb2, startTime) {
1616
+ return fs$open(path17, flags2, mode2, function(err, fd) {
1617
1617
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1618
- enqueue([go$open, [path16, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
1618
+ enqueue([go$open, [path17, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
1619
1619
  else {
1620
1620
  if (typeof cb2 === "function")
1621
1621
  cb2.apply(this, arguments);
@@ -1623,20 +1623,20 @@ var require_graceful_fs = __commonJS({
1623
1623
  });
1624
1624
  }
1625
1625
  }
1626
- return fs11;
1626
+ return fs12;
1627
1627
  }
1628
1628
  function enqueue(elem) {
1629
1629
  debug2("ENQUEUE", elem[0].name, elem[1]);
1630
- fs10[gracefulQueue].push(elem);
1630
+ fs11[gracefulQueue].push(elem);
1631
1631
  retry2();
1632
1632
  }
1633
1633
  var retryTimer;
1634
1634
  function resetQueue() {
1635
1635
  var now = Date.now();
1636
- for (var i6 = 0; i6 < fs10[gracefulQueue].length; ++i6) {
1637
- if (fs10[gracefulQueue][i6].length > 2) {
1638
- fs10[gracefulQueue][i6][3] = now;
1639
- fs10[gracefulQueue][i6][4] = now;
1636
+ for (var i6 = 0; i6 < fs11[gracefulQueue].length; ++i6) {
1637
+ if (fs11[gracefulQueue][i6].length > 2) {
1638
+ fs11[gracefulQueue][i6][3] = now;
1639
+ fs11[gracefulQueue][i6][4] = now;
1640
1640
  }
1641
1641
  }
1642
1642
  retry2();
@@ -1644,9 +1644,9 @@ var require_graceful_fs = __commonJS({
1644
1644
  function retry2() {
1645
1645
  clearTimeout(retryTimer);
1646
1646
  retryTimer = void 0;
1647
- if (fs10[gracefulQueue].length === 0)
1647
+ if (fs11[gracefulQueue].length === 0)
1648
1648
  return;
1649
- var elem = fs10[gracefulQueue].shift();
1649
+ var elem = fs11[gracefulQueue].shift();
1650
1650
  var fn = elem[0];
1651
1651
  var args = elem[1];
1652
1652
  var err = elem[2];
@@ -1668,7 +1668,7 @@ var require_graceful_fs = __commonJS({
1668
1668
  debug2("RETRY", fn.name, args);
1669
1669
  fn.apply(null, args.concat([startTime]));
1670
1670
  } else {
1671
- fs10[gracefulQueue].push(elem);
1671
+ fs11[gracefulQueue].push(elem);
1672
1672
  }
1673
1673
  }
1674
1674
  if (retryTimer === void 0) {
@@ -2103,10 +2103,10 @@ var require_mtime_precision = __commonJS({
2103
2103
  "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/mtime-precision.js"(exports, module) {
2104
2104
  "use strict";
2105
2105
  var cacheSymbol = Symbol();
2106
- function probe(file, fs10, callback) {
2107
- const cachedPrecision = fs10[cacheSymbol];
2106
+ function probe(file, fs11, callback) {
2107
+ const cachedPrecision = fs11[cacheSymbol];
2108
2108
  if (cachedPrecision) {
2109
- return fs10.stat(file, (err, stat) => {
2109
+ return fs11.stat(file, (err, stat) => {
2110
2110
  if (err) {
2111
2111
  return callback(err);
2112
2112
  }
@@ -2114,16 +2114,16 @@ var require_mtime_precision = __commonJS({
2114
2114
  });
2115
2115
  }
2116
2116
  const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
2117
- fs10.utimes(file, mtime, mtime, (err) => {
2117
+ fs11.utimes(file, mtime, mtime, (err) => {
2118
2118
  if (err) {
2119
2119
  return callback(err);
2120
2120
  }
2121
- fs10.stat(file, (err2, stat) => {
2121
+ fs11.stat(file, (err2, stat) => {
2122
2122
  if (err2) {
2123
2123
  return callback(err2);
2124
2124
  }
2125
2125
  const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
2126
- Object.defineProperty(fs10, cacheSymbol, { value: precision });
2126
+ Object.defineProperty(fs11, cacheSymbol, { value: precision });
2127
2127
  callback(null, stat.mtime, precision);
2128
2128
  });
2129
2129
  });
@@ -2144,8 +2144,8 @@ var require_mtime_precision = __commonJS({
2144
2144
  var require_lockfile = __commonJS({
2145
2145
  "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
2146
2146
  "use strict";
2147
- var path15 = __require("path");
2148
- var fs10 = require_graceful_fs();
2147
+ var path16 = __require("path");
2148
+ var fs11 = require_graceful_fs();
2149
2149
  var retry2 = require_retry2();
2150
2150
  var onExit = require_signal_exit();
2151
2151
  var mtimePrecision = require_mtime_precision();
@@ -2155,7 +2155,7 @@ var require_lockfile = __commonJS({
2155
2155
  }
2156
2156
  function resolveCanonicalPath(file, options, callback) {
2157
2157
  if (!options.realpath) {
2158
- return callback(null, path15.resolve(file));
2158
+ return callback(null, path16.resolve(file));
2159
2159
  }
2160
2160
  options.fs.realpath(file, callback);
2161
2161
  }
@@ -2276,7 +2276,7 @@ var require_lockfile = __commonJS({
2276
2276
  update: null,
2277
2277
  realpath: true,
2278
2278
  retries: 0,
2279
- fs: fs10,
2279
+ fs: fs11,
2280
2280
  onCompromised: (err) => {
2281
2281
  throw err;
2282
2282
  },
@@ -2320,7 +2320,7 @@ var require_lockfile = __commonJS({
2320
2320
  }
2321
2321
  function unlock(file, options, callback) {
2322
2322
  options = {
2323
- fs: fs10,
2323
+ fs: fs11,
2324
2324
  realpath: true,
2325
2325
  ...options
2326
2326
  };
@@ -2342,7 +2342,7 @@ var require_lockfile = __commonJS({
2342
2342
  options = {
2343
2343
  stale: 1e4,
2344
2344
  realpath: true,
2345
- fs: fs10,
2345
+ fs: fs11,
2346
2346
  ...options
2347
2347
  };
2348
2348
  options.stale = Math.max(options.stale || 0, 2e3);
@@ -2381,16 +2381,16 @@ var require_lockfile = __commonJS({
2381
2381
  var require_adapter = __commonJS({
2382
2382
  "../../node_modules/.pnpm/proper-lockfile@4.1.2/node_modules/proper-lockfile/lib/adapter.js"(exports, module) {
2383
2383
  "use strict";
2384
- var fs10 = require_graceful_fs();
2385
- function createSyncFs(fs11) {
2384
+ var fs11 = require_graceful_fs();
2385
+ function createSyncFs(fs12) {
2386
2386
  const methods = ["mkdir", "realpath", "stat", "rmdir", "utimes"];
2387
- const newFs = { ...fs11 };
2387
+ const newFs = { ...fs12 };
2388
2388
  methods.forEach((method) => {
2389
2389
  newFs[method] = (...args) => {
2390
2390
  const callback = args.pop();
2391
2391
  let ret;
2392
2392
  try {
2393
- ret = fs11[`${method}Sync`](...args);
2393
+ ret = fs12[`${method}Sync`](...args);
2394
2394
  } catch (err) {
2395
2395
  return callback(err);
2396
2396
  }
@@ -2428,7 +2428,7 @@ var require_adapter = __commonJS({
2428
2428
  }
2429
2429
  function toSyncOptions(options) {
2430
2430
  options = { ...options };
2431
- options.fs = createSyncFs(options.fs || fs10);
2431
+ options.fs = createSyncFs(options.fs || fs11);
2432
2432
  if (typeof options.retries === "number" && options.retries > 0 || options.retries && typeof options.retries.retries === "number" && options.retries.retries > 0) {
2433
2433
  throw Object.assign(new Error("Cannot use retries with the sync api"), { code: "ESYNC" });
2434
2434
  }
@@ -3785,15 +3785,15 @@ var require_dist_node9 = __commonJS({
3785
3785
  octokit.log.debug("request", options);
3786
3786
  const start = Date.now();
3787
3787
  const requestOptions = octokit.request.endpoint.parse(options);
3788
- const path15 = requestOptions.url.replace(options.baseUrl, "");
3788
+ const path16 = requestOptions.url.replace(options.baseUrl, "");
3789
3789
  return request(options).then((response) => {
3790
3790
  octokit.log.info(
3791
- `${requestOptions.method} ${path15} - ${response.status} in ${Date.now() - start}ms`
3791
+ `${requestOptions.method} ${path16} - ${response.status} in ${Date.now() - start}ms`
3792
3792
  );
3793
3793
  return response;
3794
3794
  }).catch((error2) => {
3795
3795
  octokit.log.info(
3796
- `${requestOptions.method} ${path15} - ${error2.status} in ${Date.now() - start}ms`
3796
+ `${requestOptions.method} ${path16} - ${error2.status} in ${Date.now() - start}ms`
3797
3797
  );
3798
3798
  throw error2;
3799
3799
  });
@@ -7887,7 +7887,7 @@ var require_dist_node13 = __commonJS({
7887
7887
  ];
7888
7888
  function routeMatcher(paths) {
7889
7889
  const regexes = paths.map(
7890
- (path15) => path15.split("/").map((c7) => c7.startsWith("{") ? "(?:.+?)" : c7).join("/")
7890
+ (path16) => path16.split("/").map((c7) => c7.startsWith("{") ? "(?:.+?)" : c7).join("/")
7891
7891
  );
7892
7892
  const regex2 = `^(?:${regexes.map((r6) => `(?:${r6})`).join("|")})[^/]*$`;
7893
7893
  return new RegExp(regex2, "i");
@@ -8517,8 +8517,8 @@ var init_parseUtil = __esm({
8517
8517
  init_errors();
8518
8518
  init_en();
8519
8519
  makeIssue = (params) => {
8520
- const { data: data2, path: path15, errorMaps, issueData } = params;
8521
- const fullPath = [...path15, ...issueData.path || []];
8520
+ const { data: data2, path: path16, errorMaps, issueData } = params;
8521
+ const fullPath = [...path16, ...issueData.path || []];
8522
8522
  const fullIssue = {
8523
8523
  ...issueData,
8524
8524
  path: fullPath
@@ -8826,11 +8826,11 @@ var init_types2 = __esm({
8826
8826
  init_parseUtil();
8827
8827
  init_util2();
8828
8828
  ParseInputLazyPath = class {
8829
- constructor(parent, value, path15, key) {
8829
+ constructor(parent, value, path16, key) {
8830
8830
  this._cachedPath = [];
8831
8831
  this.parent = parent;
8832
8832
  this.data = value;
8833
- this._path = path15;
8833
+ this._path = path16;
8834
8834
  this._key = key;
8835
8835
  }
8836
8836
  get path() {
@@ -12277,7 +12277,12 @@ var init_field = __esm({
12277
12277
  collections: external_exports.array(external_exports.string().min(1)).min(1).optional(),
12278
12278
  entryTypes: external_exports.array(external_exports.string().min(1)).min(1).optional(),
12279
12279
  displayField: external_exports.string().min(1).optional(),
12280
- options: external_exports.array(referenceOptionSchema).optional()
12280
+ options: external_exports.array(referenceOptionSchema).optional(),
12281
+ // Must be listed here, not just on ReferenceFieldConfig: zod strips unknown keys by
12282
+ // default, so a consumer that adopts this schema's parse output would silently delete a
12283
+ // runtime-consumed flag and the feature would no-op with no error. (`resolvedSchema` is
12284
+ // absent on purpose — it is type-inference-only and stripping it changes no behavior.)
12285
+ includeBody: external_exports.boolean().optional()
12281
12286
  });
12282
12287
  fieldHolder = [external_exports.never()];
12283
12288
  blockSchema = external_exports.object({
@@ -12392,7 +12397,7 @@ var init_media = __esm({
12392
12397
  });
12393
12398
 
12394
12399
  // ../canopycms/src/config/schemas/config.ts
12395
- var defaultBranchAccessSchema, defaultPathAccessLevelSchema, defaultPathAccessLevelsSchema, defaultPathAccessSchema, defaultBaseBranchSchema, defaultRemoteNameSchema, defaultRemoteUrlSchema, gitBotAuthorNameSchema, gitBotAuthorEmailSchema, githubTokenEnvVarSchema, operatingModeSchema, deployedAsSchema, contentRootSchema, sourceRootSchema, deploymentNameSchema, devContentSyncSchema, devConfigSchema, editorConfigSchema, CanopyConfigSchema;
12400
+ var defaultBranchAccessSchema, defaultPathAccessLevelSchema, defaultPathAccessLevelsSchema, defaultPathAccessSchema, defaultBaseBranchSchema, defaultRemoteNameSchema, defaultRemoteUrlSchema, gitBotAuthorNameSchema, gitBotAuthorEmailSchema, githubTokenEnvVarSchema, operatingModeSchema, deployedAsSchema, contentRootSchema, sourceRootSchema, basePathSchema, deploymentNameSchema, devContentSyncSchema, devConfigSchema, editorConfigSchema, CanopyConfigSchema;
12396
12401
  var init_config2 = __esm({
12397
12402
  "../canopycms/src/config/schemas/config.ts"() {
12398
12403
  "use strict";
@@ -12417,6 +12422,9 @@ var init_config2 = __esm({
12417
12422
  deployedAsSchema = external_exports.enum(["static", "server"]).default("server");
12418
12423
  contentRootSchema = relativePathSchema.default("content");
12419
12424
  sourceRootSchema = external_exports.string().min(1).optional();
12425
+ basePathSchema = external_exports.string().transform((value) => value.trim()).refine((value) => value.length > 0, {
12426
+ message: "basePath must not be empty or only whitespace"
12427
+ }).optional();
12420
12428
  deploymentNameSchema = external_exports.string().default("prod");
12421
12429
  devContentSyncSchema = external_exports.enum(["off", "warn"]).default("warn");
12422
12430
  devConfigSchema = external_exports.object({
@@ -12479,6 +12487,7 @@ var init_config2 = __esm({
12479
12487
  deploymentName: deploymentNameSchema.optional(),
12480
12488
  contentRoot: contentRootSchema.default("content"),
12481
12489
  sourceRoot: sourceRootSchema.optional(),
12490
+ basePath: basePathSchema,
12482
12491
  editor: editorConfigSchema.optional(),
12483
12492
  authPlugin: external_exports.custom().optional(),
12484
12493
  entryLinkUrl: external_exports.custom().optional(),
@@ -12508,8 +12517,8 @@ var init_permissions = __esm({
12508
12517
  });
12509
12518
 
12510
12519
  // ../canopycms/src/paths/normalize.ts
12511
- function normalizeFilesystemPath(path15) {
12512
- return path15.split(/[\\/]+/).filter(Boolean).join("/");
12520
+ function normalizeFilesystemPath(path16) {
12521
+ return path16.split(/[\\/]+/).filter(Boolean).join("/");
12513
12522
  }
12514
12523
  var init_normalize = __esm({
12515
12524
  "../canopycms/src/paths/normalize.ts"() {
@@ -13659,9 +13668,9 @@ var init_createPaginator = __esm({
13659
13668
  command = withCommand(command) ?? command;
13660
13669
  return await client.send(command, ...args);
13661
13670
  };
13662
- get = (fromObject, path15) => {
13671
+ get = (fromObject, path16) => {
13663
13672
  let cursor2 = fromObject;
13664
- const pathComponents = path15.split(".");
13673
+ const pathComponents = path16.split(".");
13665
13674
  for (const step of pathComponents) {
13666
13675
  if (!cursor2 || typeof cursor2 !== "object") {
13667
13676
  return void 0;
@@ -14679,12 +14688,12 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
14679
14688
  const password = request.password ?? "";
14680
14689
  auth = `${username}:${password}`;
14681
14690
  }
14682
- let path15 = request.path;
14691
+ let path16 = request.path;
14683
14692
  if (queryString) {
14684
- path15 += `?${queryString}`;
14693
+ path16 += `?${queryString}`;
14685
14694
  }
14686
14695
  if (request.fragment) {
14687
- path15 += `#${request.fragment}`;
14696
+ path16 += `#${request.fragment}`;
14688
14697
  }
14689
14698
  let hostname = request.hostname ?? "";
14690
14699
  if (hostname[0] === "[" && hostname.endsWith("]")) {
@@ -14696,7 +14705,7 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
14696
14705
  headers: request.headers,
14697
14706
  host: hostname,
14698
14707
  method: request.method,
14699
- path: path15,
14708
+ path: path16,
14700
14709
  port: request.port,
14701
14710
  agent,
14702
14711
  auth
@@ -14979,16 +14988,16 @@ or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler conf
14979
14988
  reject(err);
14980
14989
  };
14981
14990
  const queryString = querystringBuilder.buildQueryString(query || {});
14982
- let path15 = request.path;
14991
+ let path16 = request.path;
14983
14992
  if (queryString) {
14984
- path15 += `?${queryString}`;
14993
+ path16 += `?${queryString}`;
14985
14994
  }
14986
14995
  if (request.fragment) {
14987
- path15 += `#${request.fragment}`;
14996
+ path16 += `#${request.fragment}`;
14988
14997
  }
14989
14998
  const req = session.request({
14990
14999
  ...request.headers,
14991
- [http2.constants.HTTP2_HEADER_PATH]: path15,
15000
+ [http2.constants.HTTP2_HEADER_PATH]: path16,
14992
15001
  [http2.constants.HTTP2_HEADER_METHOD]: method
14993
15002
  });
14994
15003
  session.ref();
@@ -15175,13 +15184,13 @@ var require_dist_cjs14 = __commonJS({
15175
15184
  const abortError = buildAbortError(abortSignal);
15176
15185
  return Promise.reject(abortError);
15177
15186
  }
15178
- let path15 = request.path;
15187
+ let path16 = request.path;
15179
15188
  const queryString = querystringBuilder.buildQueryString(request.query || {});
15180
15189
  if (queryString) {
15181
- path15 += `?${queryString}`;
15190
+ path16 += `?${queryString}`;
15182
15191
  }
15183
15192
  if (request.fragment) {
15184
- path15 += `#${request.fragment}`;
15193
+ path16 += `#${request.fragment}`;
15185
15194
  }
15186
15195
  let auth = "";
15187
15196
  if (request.username != null || request.password != null) {
@@ -15190,7 +15199,7 @@ var require_dist_cjs14 = __commonJS({
15190
15199
  auth = `${username}:${password}@`;
15191
15200
  }
15192
15201
  const { port, method } = request;
15193
- const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${path15}`;
15202
+ const url = `${request.protocol}//${auth}${request.hostname}${port ? `:${port}` : ""}${path16}`;
15194
15203
  const body = method === "GET" || method === "HEAD" ? void 0 : request.body;
15195
15204
  const requestOptions = {
15196
15205
  body,
@@ -17422,13 +17431,13 @@ function __disposeResources(env) {
17422
17431
  }
17423
17432
  return next();
17424
17433
  }
17425
- function __rewriteRelativeImportExtension(path15, preserveJsx) {
17426
- if (typeof path15 === "string" && /^\.\.?\//.test(path15)) {
17427
- return path15.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m5, tsx, d5, ext, cm) {
17434
+ function __rewriteRelativeImportExtension(path16, preserveJsx) {
17435
+ if (typeof path16 === "string" && /^\.\.?\//.test(path16)) {
17436
+ return path16.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m5, tsx, d5, ext, cm) {
17428
17437
  return tsx ? preserveJsx ? ".jsx" : ".js" : d5 && (!ext || !cm) ? m5 : d5 + ext + "." + cm.toLowerCase() + "js";
17429
17438
  });
17430
17439
  }
17431
- return path15;
17440
+ return path16;
17432
17441
  }
17433
17442
  var extendStatics, __assign, __createBinding, __setModuleDefault, ownKeys, _SuppressedError, tslib_es6_default;
17434
17443
  var init_tslib_es6 = __esm({
@@ -18326,11 +18335,11 @@ var init_HttpBindingProtocol = __esm({
18326
18335
  const opTraits = translateTraits(operationSchema.traits);
18327
18336
  if (opTraits.http) {
18328
18337
  request.method = opTraits.http[0];
18329
- const [path15, search] = opTraits.http[1].split("?");
18338
+ const [path16, search] = opTraits.http[1].split("?");
18330
18339
  if (request.path == "/") {
18331
- request.path = path15;
18340
+ request.path = path16;
18332
18341
  } else {
18333
- request.path += path15;
18342
+ request.path += path16;
18334
18343
  }
18335
18344
  const traitSearchParams = new URLSearchParams(search ?? "");
18336
18345
  Object.assign(query, Object.fromEntries(traitSearchParams));
@@ -18733,8 +18742,8 @@ var init_requestBuilder = __esm({
18733
18742
  return this;
18734
18743
  }
18735
18744
  p(memberName, labelValueProvider, uriLabel, isGreedyLabel) {
18736
- this.resolvePathStack.push((path15) => {
18737
- this.path = resolvedPath(path15, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
18745
+ this.resolvePathStack.push((path16) => {
18746
+ this.path = resolvedPath(path16, this.input, memberName, labelValueProvider, uriLabel, isGreedyLabel);
18738
18747
  });
18739
18748
  return this;
18740
18749
  }
@@ -19384,18 +19393,18 @@ var require_dist_cjs20 = __commonJS({
19384
19393
  }
19385
19394
  };
19386
19395
  var booleanEquals = (value1, value2) => value1 === value2;
19387
- var getAttrPathList = (path15) => {
19388
- const parts = path15.split(".");
19396
+ var getAttrPathList = (path16) => {
19397
+ const parts = path16.split(".");
19389
19398
  const pathList = [];
19390
19399
  for (const part of parts) {
19391
19400
  const squareBracketIndex = part.indexOf("[");
19392
19401
  if (squareBracketIndex !== -1) {
19393
19402
  if (part.indexOf("]") !== part.length - 1) {
19394
- throw new EndpointError(`Path: '${path15}' does not end with ']'`);
19403
+ throw new EndpointError(`Path: '${path16}' does not end with ']'`);
19395
19404
  }
19396
19405
  const arrayIndex = part.slice(squareBracketIndex + 1, -1);
19397
19406
  if (Number.isNaN(parseInt(arrayIndex))) {
19398
- throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path15}'`);
19407
+ throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path16}'`);
19399
19408
  }
19400
19409
  if (squareBracketIndex !== 0) {
19401
19410
  pathList.push(part.slice(0, squareBracketIndex));
@@ -19407,9 +19416,9 @@ var require_dist_cjs20 = __commonJS({
19407
19416
  }
19408
19417
  return pathList;
19409
19418
  };
19410
- var getAttr = (value, path15) => getAttrPathList(path15).reduce((acc, index) => {
19419
+ var getAttr = (value, path16) => getAttrPathList(path16).reduce((acc, index) => {
19411
19420
  if (typeof acc !== "object") {
19412
- throw new EndpointError(`Index '${index}' in '${path15}' not found in '${JSON.stringify(value)}'`);
19421
+ throw new EndpointError(`Index '${index}' in '${path16}' not found in '${JSON.stringify(value)}'`);
19413
19422
  } else if (Array.isArray(acc)) {
19414
19423
  return acc[parseInt(index)];
19415
19424
  }
@@ -19428,8 +19437,8 @@ var require_dist_cjs20 = __commonJS({
19428
19437
  return value;
19429
19438
  }
19430
19439
  if (typeof value === "object" && "hostname" in value) {
19431
- const { hostname: hostname2, port, protocol: protocol2 = "", path: path15 = "", query = {} } = value;
19432
- const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path15}`);
19440
+ const { hostname: hostname2, port, protocol: protocol2 = "", path: path16 = "", query = {} } = value;
19441
+ const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path16}`);
19433
19442
  url.search = Object.entries(query).map(([k6, v5]) => `${k6}=${v5}`).join("&");
19434
19443
  return url;
19435
19444
  }
@@ -20874,10 +20883,10 @@ ${longDate}
20874
20883
  ${credentialScope}
20875
20884
  ${utilHexEncoding.toHex(hashedRequest)}`;
20876
20885
  }
20877
- getCanonicalPath({ path: path15 }) {
20886
+ getCanonicalPath({ path: path16 }) {
20878
20887
  if (this.uriEscapePath) {
20879
20888
  const normalizedPathSegments = [];
20880
- for (const pathSegment of path15.split("/")) {
20889
+ for (const pathSegment of path16.split("/")) {
20881
20890
  if (pathSegment?.length === 0)
20882
20891
  continue;
20883
20892
  if (pathSegment === ".")
@@ -20888,11 +20897,11 @@ ${utilHexEncoding.toHex(hashedRequest)}`;
20888
20897
  normalizedPathSegments.push(pathSegment);
20889
20898
  }
20890
20899
  }
20891
- const normalizedPath = `${path15?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path15?.endsWith("/") ? "/" : ""}`;
20900
+ const normalizedPath = `${path16?.startsWith("/") ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && path16?.endsWith("/") ? "/" : ""}`;
20892
20901
  const doubleEncoded = utilUriEscape.escapeUri(normalizedPath);
20893
20902
  return doubleEncoded.replace(/%2F/g, "/");
20894
20903
  }
20895
- return path15;
20904
+ return path16;
20896
20905
  }
20897
20906
  validateResolvedCredentials(credentials) {
20898
20907
  if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") {
@@ -22196,11 +22205,11 @@ var init_SmithyRpcV2CborProtocol = __esm({
22196
22205
  }
22197
22206
  }
22198
22207
  const { service, operation: operation2 } = (0, import_util_middleware5.getSmithyContext)(context);
22199
- const path15 = `/service/${service}/operation/${operation2}`;
22208
+ const path16 = `/service/${service}/operation/${operation2}`;
22200
22209
  if (request.path.endsWith("/")) {
22201
- request.path += path15.slice(1);
22210
+ request.path += path16.slice(1);
22202
22211
  } else {
22203
- request.path += path15;
22212
+ request.path += path16;
22204
22213
  }
22205
22214
  return request;
22206
22215
  }
@@ -27845,14 +27854,14 @@ var require_readFile = __commonJS({
27845
27854
  var promises_1 = __require("node:fs/promises");
27846
27855
  exports.filePromises = {};
27847
27856
  exports.fileIntercept = {};
27848
- var readFile = (path15, options) => {
27849
- if (exports.fileIntercept[path15] !== void 0) {
27850
- return exports.fileIntercept[path15];
27857
+ var readFile = (path16, options) => {
27858
+ if (exports.fileIntercept[path16] !== void 0) {
27859
+ return exports.fileIntercept[path16];
27851
27860
  }
27852
- if (!exports.filePromises[path15] || options?.ignoreCache) {
27853
- exports.filePromises[path15] = (0, promises_1.readFile)(path15, "utf8");
27861
+ if (!exports.filePromises[path16] || options?.ignoreCache) {
27862
+ exports.filePromises[path16] = (0, promises_1.readFile)(path16, "utf8");
27854
27863
  }
27855
- return exports.filePromises[path15];
27864
+ return exports.filePromises[path16];
27856
27865
  };
27857
27866
  exports.readFile = readFile;
27858
27867
  }
@@ -27865,7 +27874,7 @@ var require_dist_cjs33 = __commonJS({
27865
27874
  var getHomeDir = require_getHomeDir();
27866
27875
  var getSSOTokenFilepath = require_getSSOTokenFilepath();
27867
27876
  var getSSOTokenFromFile = require_getSSOTokenFromFile();
27868
- var path15 = __require("path");
27877
+ var path16 = __require("path");
27869
27878
  var types = require_dist_cjs();
27870
27879
  var readFile = require_readFile();
27871
27880
  var ENV_PROFILE = "AWS_PROFILE";
@@ -27887,9 +27896,9 @@ var require_dist_cjs33 = __commonJS({
27887
27896
  ...data2.default && { default: data2.default }
27888
27897
  });
27889
27898
  var ENV_CONFIG_PATH = "AWS_CONFIG_FILE";
27890
- var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path15.join(getHomeDir.getHomeDir(), ".aws", "config");
27899
+ var getConfigFilepath = () => process.env[ENV_CONFIG_PATH] || path16.join(getHomeDir.getHomeDir(), ".aws", "config");
27891
27900
  var ENV_CREDENTIALS_PATH = "AWS_SHARED_CREDENTIALS_FILE";
27892
- var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path15.join(getHomeDir.getHomeDir(), ".aws", "credentials");
27901
+ var getCredentialsFilepath = () => process.env[ENV_CREDENTIALS_PATH] || path16.join(getHomeDir.getHomeDir(), ".aws", "credentials");
27893
27902
  var prefixKeyRegex = /^([\w-]+)\s(["'])?([\w-@\+\.%:/]+)\2$/;
27894
27903
  var profileNameBlockList = ["__proto__", "profile __proto__"];
27895
27904
  var parseIni = (iniData) => {
@@ -27944,11 +27953,11 @@ var require_dist_cjs33 = __commonJS({
27944
27953
  const relativeHomeDirPrefix = "~/";
27945
27954
  let resolvedFilepath = filepath;
27946
27955
  if (filepath.startsWith(relativeHomeDirPrefix)) {
27947
- resolvedFilepath = path15.join(homeDir, filepath.slice(2));
27956
+ resolvedFilepath = path16.join(homeDir, filepath.slice(2));
27948
27957
  }
27949
27958
  let resolvedConfigFilepath = configFilepath;
27950
27959
  if (configFilepath.startsWith(relativeHomeDirPrefix)) {
27951
- resolvedConfigFilepath = path15.join(homeDir, configFilepath.slice(2));
27960
+ resolvedConfigFilepath = path16.join(homeDir, configFilepath.slice(2));
27952
27961
  }
27953
27962
  const parsedFiles = await Promise.all([
27954
27963
  readFile.readFile(resolvedConfigFilepath, {
@@ -27987,8 +27996,8 @@ var require_dist_cjs33 = __commonJS({
27987
27996
  getFileRecord() {
27988
27997
  return readFile.fileIntercept;
27989
27998
  },
27990
- interceptFile(path16, contents) {
27991
- readFile.fileIntercept[path16] = Promise.resolve(contents);
27999
+ interceptFile(path17, contents) {
28000
+ readFile.fileIntercept[path17] = Promise.resolve(contents);
27992
28001
  },
27993
28002
  getTokenRecord() {
27994
28003
  return getSSOTokenFromFile.tokenIntercept;
@@ -28313,8 +28322,8 @@ var require_dist_cjs36 = __commonJS({
28313
28322
  return endpoint.url.href;
28314
28323
  }
28315
28324
  if ("hostname" in endpoint) {
28316
- const { protocol, hostname, port, path: path15 } = endpoint;
28317
- return `${protocol}//${hostname}${port ? ":" + port : ""}${path15}`;
28325
+ const { protocol, hostname, port, path: path16 } = endpoint;
28326
+ return `${protocol}//${hostname}${port ? ":" + port : ""}${path16}`;
28318
28327
  }
28319
28328
  }
28320
28329
  return endpoint;
@@ -36511,8 +36520,8 @@ var require_dist_cjs53 = __commonJS({
36511
36520
  });
36512
36521
 
36513
36522
  // ../canopycms/src/worker/cms-worker.ts
36514
- import fs8 from "node:fs/promises";
36515
- import path12 from "node:path";
36523
+ import fs9 from "node:fs/promises";
36524
+ import path13 from "node:path";
36516
36525
 
36517
36526
  // ../../node_modules/.pnpm/simple-git@3.36.0/node_modules/simple-git/dist/esm/index.js
36518
36527
  var import_file_exists = __toESM(require_dist(), 1);
@@ -37103,8 +37112,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
37103
37112
  function forEachLineWithContent(input, callback) {
37104
37113
  return toLinesWithContent(input, true).map((line) => callback(line));
37105
37114
  }
37106
- function folderExists(path15) {
37107
- return (0, import_file_exists.exists)(path15, import_file_exists.FOLDER);
37115
+ function folderExists(path16) {
37116
+ return (0, import_file_exists.exists)(path16, import_file_exists.FOLDER);
37108
37117
  }
37109
37118
  function append(target, item) {
37110
37119
  if (Array.isArray(target)) {
@@ -37506,8 +37515,8 @@ function checkIsRepoRootTask() {
37506
37515
  commands: commands5,
37507
37516
  format: "utf-8",
37508
37517
  onError,
37509
- parser(path15) {
37510
- return /^\.(git)?$/.test(path15.trim());
37518
+ parser(path16) {
37519
+ return /^\.(git)?$/.test(path16.trim());
37511
37520
  }
37512
37521
  };
37513
37522
  }
@@ -37941,11 +37950,11 @@ function parseGrep(grep) {
37941
37950
  const paths = /* @__PURE__ */ new Set();
37942
37951
  const results = {};
37943
37952
  forEachLineWithContent(grep, (input) => {
37944
- const [path15, line, preview] = input.split(NULL);
37945
- paths.add(path15);
37946
- (results[path15] = results[path15] || []).push({
37953
+ const [path16, line, preview] = input.split(NULL);
37954
+ paths.add(path16);
37955
+ (results[path16] = results[path16] || []).push({
37947
37956
  line: asNumber(line),
37948
- path: path15,
37957
+ path: path16,
37949
37958
  preview
37950
37959
  });
37951
37960
  });
@@ -38709,14 +38718,14 @@ var init_hash_object = __esm2({
38709
38718
  init_task();
38710
38719
  }
38711
38720
  });
38712
- function parseInit(bare, path15, text) {
38721
+ function parseInit(bare, path16, text) {
38713
38722
  const response = String(text).trim();
38714
38723
  let result;
38715
38724
  if (result = initResponseRegex.exec(response)) {
38716
- return new InitSummary(bare, path15, false, result[1]);
38725
+ return new InitSummary(bare, path16, false, result[1]);
38717
38726
  }
38718
38727
  if (result = reInitResponseRegex.exec(response)) {
38719
- return new InitSummary(bare, path15, true, result[1]);
38728
+ return new InitSummary(bare, path16, true, result[1]);
38720
38729
  }
38721
38730
  let gitDir = "";
38722
38731
  const tokens = response.split(" ");
@@ -38727,7 +38736,7 @@ function parseInit(bare, path15, text) {
38727
38736
  break;
38728
38737
  }
38729
38738
  }
38730
- return new InitSummary(bare, path15, /^re/i.test(response), gitDir);
38739
+ return new InitSummary(bare, path16, /^re/i.test(response), gitDir);
38731
38740
  }
38732
38741
  var InitSummary;
38733
38742
  var initResponseRegex;
@@ -38736,9 +38745,9 @@ var init_InitSummary = __esm2({
38736
38745
  "src/lib/responses/InitSummary.ts"() {
38737
38746
  "use strict";
38738
38747
  InitSummary = class {
38739
- constructor(bare, path15, existing, gitDir) {
38748
+ constructor(bare, path16, existing, gitDir) {
38740
38749
  this.bare = bare;
38741
- this.path = path15;
38750
+ this.path = path16;
38742
38751
  this.existing = existing;
38743
38752
  this.gitDir = gitDir;
38744
38753
  }
@@ -38750,7 +38759,7 @@ var init_InitSummary = __esm2({
38750
38759
  function hasBareCommand(command) {
38751
38760
  return command.includes(bareCommand);
38752
38761
  }
38753
- function initTask(bare = false, path15, customArgs) {
38762
+ function initTask(bare = false, path16, customArgs) {
38754
38763
  const commands5 = ["init", ...customArgs];
38755
38764
  if (bare && !hasBareCommand(commands5)) {
38756
38765
  commands5.splice(1, 0, bareCommand);
@@ -38759,7 +38768,7 @@ function initTask(bare = false, path15, customArgs) {
38759
38768
  commands: commands5,
38760
38769
  format: "utf-8",
38761
38770
  parser(text) {
38762
- return parseInit(commands5.includes("--bare"), path15, text);
38771
+ return parseInit(commands5.includes("--bare"), path16, text);
38763
38772
  }
38764
38773
  };
38765
38774
  }
@@ -39574,12 +39583,12 @@ var init_FileStatusSummary = __esm2({
39574
39583
  "use strict";
39575
39584
  fromPathRegex = /^(.+)\0(.+)$/;
39576
39585
  FileStatusSummary = class {
39577
- constructor(path15, index, working_dir) {
39578
- this.path = path15;
39586
+ constructor(path16, index, working_dir) {
39587
+ this.path = path16;
39579
39588
  this.index = index;
39580
39589
  this.working_dir = working_dir;
39581
39590
  if (index === "R" || working_dir === "R") {
39582
- const detail = fromPathRegex.exec(path15) || [null, path15, path15];
39591
+ const detail = fromPathRegex.exec(path16) || [null, path16, path16];
39583
39592
  this.from = detail[2] || "";
39584
39593
  this.path = detail[1] || "";
39585
39594
  }
@@ -39610,14 +39619,14 @@ function splitLine(result, lineStr) {
39610
39619
  default:
39611
39620
  return;
39612
39621
  }
39613
- function data2(index, workingDir, path15) {
39622
+ function data2(index, workingDir, path16) {
39614
39623
  const raw = `${index}${workingDir}`;
39615
39624
  const handler = parsers6.get(raw);
39616
39625
  if (handler) {
39617
- handler(result, path15);
39626
+ handler(result, path16);
39618
39627
  }
39619
39628
  if (raw !== "##" && raw !== "!!") {
39620
- result.files.push(new FileStatusSummary(path15, index, workingDir));
39629
+ result.files.push(new FileStatusSummary(path16, index, workingDir));
39621
39630
  }
39622
39631
  }
39623
39632
  }
@@ -39968,9 +39977,9 @@ var init_simple_git_api = __esm2({
39968
39977
  next
39969
39978
  );
39970
39979
  }
39971
- hashObject(path15, write) {
39980
+ hashObject(path16, write) {
39972
39981
  return this._runTask(
39973
- hashObjectTask(path15, write === true),
39982
+ hashObjectTask(path16, write === true),
39974
39983
  trailingFunctionArgument(arguments)
39975
39984
  );
39976
39985
  }
@@ -40324,8 +40333,8 @@ var init_branch = __esm2({
40324
40333
  }
40325
40334
  });
40326
40335
  function toPath(input) {
40327
- const path15 = input.trim().replace(/^["']|["']$/g, "");
40328
- return path15 && normalize(path15);
40336
+ const path16 = input.trim().replace(/^["']|["']$/g, "");
40337
+ return path16 && normalize(path16);
40329
40338
  }
40330
40339
  var parseCheckIgnore;
40331
40340
  var init_CheckIgnore = __esm2({
@@ -40610,8 +40619,8 @@ __export2(sub_module_exports, {
40610
40619
  subModuleTask: () => subModuleTask,
40611
40620
  updateSubModuleTask: () => updateSubModuleTask
40612
40621
  });
40613
- function addSubModuleTask(repo, path15) {
40614
- return subModuleTask(["add", repo, path15]);
40622
+ function addSubModuleTask(repo, path16) {
40623
+ return subModuleTask(["add", repo, path16]);
40615
40624
  }
40616
40625
  function initSubModuleTask(customArgs) {
40617
40626
  return subModuleTask(["init", ...customArgs]);
@@ -40925,8 +40934,8 @@ var require_git = __commonJS2({
40925
40934
  }
40926
40935
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
40927
40936
  };
40928
- Git2.prototype.submoduleAdd = function(repo, path15, then) {
40929
- return this._runTask(addSubModuleTask2(repo, path15), trailingFunctionArgument2(arguments));
40937
+ Git2.prototype.submoduleAdd = function(repo, path16, then) {
40938
+ return this._runTask(addSubModuleTask2(repo, path16), trailingFunctionArgument2(arguments));
40930
40939
  };
40931
40940
  Git2.prototype.submoduleUpdate = function(args, then) {
40932
40941
  return this._runTask(
@@ -41820,7 +41829,7 @@ async function recoverOrphanedTasks(taskDir, maxAgeMs = 5 * 6e4, logger2 = nullL
41820
41829
  async function cleanupOldTasks(taskDir, maxAgeMs = 30 * 24 * 60 * 6e4, logger2 = nullLogger) {
41821
41830
  const now = Date.now();
41822
41831
  let cleaned = 0;
41823
- for (const subdir of ["completed", "failed"]) {
41832
+ for (const subdir of ["completed", "failed", "corrupt"]) {
41824
41833
  const dir = path2.join(taskDir, subdir);
41825
41834
  let files;
41826
41835
  try {
@@ -42729,6 +42738,8 @@ init_types3();
42729
42738
  init_normalize();
42730
42739
 
42731
42740
  // ../canopycms/src/utils/git.ts
42741
+ import fs7 from "node:fs/promises";
42742
+ import path9 from "node:path";
42732
42743
  var REJECTED_MARKER = "[rejected]";
42733
42744
  var NON_FAST_FORWARD_REASONS = ["non-fast-forward", "fetch first"];
42734
42745
  var REJECTION_HINT = "Updates were rejected because";
@@ -42740,18 +42751,95 @@ var STALE_LEASE_REASON = "stale info";
42740
42751
  function isStaleLeaseRejection(message) {
42741
42752
  return message.includes(REJECTED_MARKER) && message.includes(STALE_LEASE_REASON);
42742
42753
  }
42754
+ async function resolveGitDir(repoPath) {
42755
+ const dotGit = path9.join(repoPath, ".git");
42756
+ let stat;
42757
+ try {
42758
+ stat = await fs7.stat(dotGit);
42759
+ } catch {
42760
+ return null;
42761
+ }
42762
+ if (stat.isDirectory()) return dotGit;
42763
+ try {
42764
+ const pointer = await fs7.readFile(dotGit, "utf-8");
42765
+ const match2 = /^gitdir:\s*(.+)$/m.exec(pointer);
42766
+ if (!match2) return null;
42767
+ const target = match2[1].trim();
42768
+ return path9.isAbsolute(target) ? target : path9.resolve(repoPath, target);
42769
+ } catch {
42770
+ return null;
42771
+ }
42772
+ }
42773
+ async function isRebaseInProgress(repoPath) {
42774
+ const gitDir = await resolveGitDir(repoPath);
42775
+ if (!gitDir) return false;
42776
+ const results = await Promise.all(
42777
+ ["rebase-merge", "rebase-apply"].map(
42778
+ (dir) => fs7.stat(path9.join(gitDir, dir)).then(() => true).catch(() => false)
42779
+ )
42780
+ );
42781
+ return results.some(Boolean);
42782
+ }
42743
42783
 
42744
42784
  // ../canopycms/src/utils/provisioning-lock.ts
42745
42785
  var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
42746
- import fs7 from "node:fs/promises";
42747
- import path9 from "node:path";
42748
- async function tryAcquireProvisioningLock(lockTargetDir2, lockName) {
42749
- await fs7.mkdir(lockTargetDir2, { recursive: true });
42750
- return import_proper_lockfile2.default.lock(lockTargetDir2, {
42751
- lockfilePath: path9.join(lockTargetDir2, lockName),
42752
- retries: 0,
42753
- stale: 3e4
42754
- });
42786
+ import fs8 from "node:fs/promises";
42787
+ import path10 from "node:path";
42788
+ init_logger();
42789
+ function provisioningLockOptions(lockPath, retries, onCompromised) {
42790
+ return {
42791
+ lockfilePath: lockPath,
42792
+ realpath: false,
42793
+ retries,
42794
+ stale: 3e4,
42795
+ // proper-lockfile invokes this from inside its refresh timer, so ANY throw
42796
+ // escaping here is an uncaught exception that kills the process -- the very
42797
+ // failure the handler exists to prevent. Call sites are told not to throw
42798
+ // (see OnLockCompromised); this makes it structural rather than a
42799
+ // convention, and also covers the LOGGER throwing: under `CI=true`,
42800
+ // vitest's `onConsoleLog` turns any console write into a throw.
42801
+ onCompromised: (err) => {
42802
+ try {
42803
+ if (onCompromised) {
42804
+ onCompromised(err);
42805
+ return;
42806
+ }
42807
+ canopyLogWarn(
42808
+ `[canopy] Provisioning lock compromised mid-hold for ${lockPath}:`,
42809
+ getErrorMessage2(err)
42810
+ );
42811
+ } catch {
42812
+ try {
42813
+ process.stderr.write(
42814
+ `[canopy] lock compromised for ${lockPath}; its handler or logger threw
42815
+ `
42816
+ );
42817
+ } catch {
42818
+ }
42819
+ }
42820
+ }
42821
+ };
42822
+ }
42823
+ function releaseIgnoringAlreadyReleased(release, lockPath) {
42824
+ return async () => {
42825
+ try {
42826
+ await release();
42827
+ } catch (err) {
42828
+ if (isNodeError(err) && err.code === "ERELEASED") {
42829
+ canopyLogWarn(
42830
+ `[canopy] Lock at ${lockPath} was already released (compromised mid-hold, or released twice); nothing to release`
42831
+ );
42832
+ return;
42833
+ }
42834
+ throw err;
42835
+ }
42836
+ };
42837
+ }
42838
+ async function tryAcquireProvisioningLock(lockTargetDir2, lockName, onCompromised) {
42839
+ await fs8.mkdir(lockTargetDir2, { recursive: true });
42840
+ const lockPath = path10.join(lockTargetDir2, lockName);
42841
+ const release = await import_proper_lockfile2.default.lock(lockPath, provisioningLockOptions(lockPath, 0, onCompromised));
42842
+ return releaseIgnoringAlreadyReleased(release, lockPath);
42755
42843
  }
42756
42844
 
42757
42845
  // ../canopycms/src/git-manager.ts
@@ -42780,21 +42868,26 @@ var GITHUB_TRACKING_REF_PREFIX = "refs/remotes/github/";
42780
42868
  init_deployment_name();
42781
42869
 
42782
42870
  // ../canopycms/src/utils/content-write-lock.ts
42783
- import path10 from "node:path";
42871
+ import path11 from "node:path";
42872
+ init_logger();
42784
42873
  var META_DIR2 = ".canopy-meta";
42785
42874
  var CONTENT_WRITE_LOCK_NAME = "content-write.lock";
42786
42875
  function lockTargetDir(branchRoot) {
42787
- return path10.join(path10.resolve(branchRoot), META_DIR2);
42876
+ return path11.join(path11.resolve(branchRoot), META_DIR2);
42788
42877
  }
42789
- function tryAcquireContentWriteLock(branchRoot) {
42790
- return tryAcquireProvisioningLock(lockTargetDir(branchRoot), CONTENT_WRITE_LOCK_NAME);
42878
+ function tryAcquireContentWriteLock(branchRoot, onCompromised) {
42879
+ return tryAcquireProvisioningLock(
42880
+ lockTargetDir(branchRoot),
42881
+ CONTENT_WRITE_LOCK_NAME,
42882
+ onCompromised
42883
+ );
42791
42884
  }
42792
42885
 
42793
42886
  // ../canopycms/src/worker/worker-status.ts
42794
- import path11 from "node:path";
42887
+ import path12 from "node:path";
42795
42888
  var WORKER_STATUS_FILE = "worker-status.json";
42796
42889
  async function writeWorkerStatus(taskDir, report) {
42797
- const filePath = path11.join(taskDir, WORKER_STATUS_FILE);
42890
+ const filePath = path12.join(taskDir, WORKER_STATUS_FILE);
42798
42891
  const stamped = { ...report, updatedAt: (/* @__PURE__ */ new Date()).toISOString() };
42799
42892
  await atomicWriteFile(filePath, JSON.stringify(stamped, null, 2));
42800
42893
  }
@@ -42889,15 +42982,15 @@ var CmsWorker = class {
42889
42982
  this.releaseLockFn = null;
42890
42983
  this.log = cmsTaskQueueLogger;
42891
42984
  this.octokit = createCanopyOctokit({ auth: config.githubToken });
42892
- this.taskDir = path12.join(config.workspacePath, ".tasks");
42893
- this.remoteGitPath = path12.join(config.workspacePath, "remote.git");
42894
- this.contentBranchesPath = path12.join(config.workspacePath, "content-branches");
42985
+ this.taskDir = path13.join(config.workspacePath, ".tasks");
42986
+ this.remoteGitPath = path13.join(config.workspacePath, "remote.git");
42987
+ this.contentBranchesPath = path13.join(config.workspacePath, "content-branches");
42895
42988
  this.baseBranch = config.baseBranch ?? "main";
42896
42989
  this.sanitizedBaseBranch = sanitizeBranchName(this.baseBranch);
42897
42990
  this.maxTasksPerCycle = config.maxTasksPerCycle ?? 10;
42898
42991
  this.taskTimeoutMs = config.taskTimeoutMs ?? DEFAULT_TASK_TIMEOUT;
42899
42992
  this.maxRetries = config.maxRetries ?? DEFAULT_MAX_RETRIES2;
42900
- this.lockFilePath = path12.join(config.workspacePath, ".tasks", ".worker-lock");
42993
+ this.lockFilePath = path13.join(config.workspacePath, ".tasks", ".worker-lock");
42901
42994
  this.lockStaleMs = config.lockStaleMs ?? DEFAULT_LOCK_STALE_MS;
42902
42995
  this.contentRoot = config.contentRoot ?? "content";
42903
42996
  }
@@ -43048,7 +43141,7 @@ var CmsWorker = class {
43048
43141
  * negligible, but a host with a badly wrong clock could misjudge liveness.
43049
43142
  */
43050
43143
  async acquireLock() {
43051
- await fs8.mkdir(this.taskDir, { recursive: true });
43144
+ await fs9.mkdir(this.taskDir, { recursive: true });
43052
43145
  try {
43053
43146
  this.releaseLockFn = await import_proper_lockfile3.default.lock(this.taskDir, {
43054
43147
  lockfilePath: this.lockFilePath,
@@ -43124,6 +43217,58 @@ var CmsWorker = class {
43124
43217
  `refs/heads/${this.baseBranch}`
43125
43218
  ]);
43126
43219
  }
43220
+ /**
43221
+ * Guarantee a bare repo's config carries NO `remote.origin.url`, and so no
43222
+ * embedded bot token.
43223
+ *
43224
+ * `git clone https://x-access-token:<token>@github.com/...` records that URL
43225
+ * verbatim as `remote.origin.url`, and for `remote.git` that config lives on
43226
+ * shared EFS. The security model in docs/deploying-to-aws.md -- "If Lambda is
43227
+ * compromised, an attacker can read/write content on EFS but cannot push to
43228
+ * GitHub", "Secrets stay on the worker" -- is false while that string is
43229
+ * there: a compromised Lambda could read the token off EFS and, despite
43230
+ * having no egress of its own, exfiltrate it by writing it into branch
43231
+ * content the worker then pushes to GitHub.
43232
+ *
43233
+ * Nothing needs the remote: every push passes the URL explicitly as an
43234
+ * argument (see the `git.push(this.buildGitHubUrl(), ...)` call sites), and
43235
+ * `verifyBaseBranchExists` reads local refs.
43236
+ *
43237
+ * VERIFIES rather than assuming: it re-reads the config and throws if the URL
43238
+ * survives, because the previous code's `.catch(() => {})` meant a failed
43239
+ * scrub was indistinguishable from a successful one.
43240
+ */
43241
+ async scrubPersistedRemote(gitDir) {
43242
+ const git = simpleGit({ baseDir: gitDir });
43243
+ const readOriginUrl = async () => {
43244
+ try {
43245
+ const url = (await git.raw(["config", "--get", "remote.origin.url"])).trim();
43246
+ return url === "" ? null : url;
43247
+ } catch {
43248
+ return "unreadable";
43249
+ }
43250
+ };
43251
+ const before = await readOriginUrl();
43252
+ if (before === null) return;
43253
+ if (before === "unreadable") {
43254
+ workerLogWarn(
43255
+ ` Could not read remote.origin.url in ${gitDir}; attempting the scrub anyway rather than assuming it is absent`
43256
+ );
43257
+ }
43258
+ try {
43259
+ await git.removeRemote("origin");
43260
+ } catch (err) {
43261
+ workerLogWarn(
43262
+ ` removeRemote('origin') failed in ${gitDir}: ${getErrorMessage2(err)} -- verifying directly`
43263
+ );
43264
+ }
43265
+ const remaining = await readOriginUrl();
43266
+ if (remaining !== null) {
43267
+ throw new Error(
43268
+ `Could not confirm the 'origin' remote is gone from ${gitDir} (${remaining === "unreadable" ? "its config was unreadable" : "its config still records a URL"}). For a token-bearing clone URL that means the GitHub bot token may be persisted on shared storage. Refusing to continue.`
43269
+ );
43270
+ }
43271
+ }
43127
43272
  /**
43128
43273
  * Ensure remote.git bare repo exists.
43129
43274
  * On first run, clone from GitHub as a bare repo.
@@ -43142,12 +43287,13 @@ var CmsWorker = class {
43142
43287
  async ensureRemoteGit() {
43143
43288
  let exists2;
43144
43289
  try {
43145
- await fs8.stat(this.remoteGitPath);
43290
+ await fs9.stat(this.remoteGitPath);
43146
43291
  exists2 = true;
43147
43292
  } catch {
43148
43293
  exists2 = false;
43149
43294
  }
43150
43295
  if (exists2) {
43296
+ await this.scrubPersistedRemote(this.remoteGitPath);
43151
43297
  try {
43152
43298
  await this.verifyBaseBranchExists(this.remoteGitPath);
43153
43299
  } catch (err) {
@@ -43160,21 +43306,20 @@ var CmsWorker = class {
43160
43306
  }
43161
43307
  workerLog("Initializing remote.git from GitHub...");
43162
43308
  const git = simpleGit();
43163
- await git.clone(this.buildGitHubUrl(), this.remoteGitPath, ["--bare"]);
43309
+ const stagingPath = `${this.remoteGitPath}.cloning`;
43310
+ await fs9.rm(stagingPath, { recursive: true, force: true });
43164
43311
  try {
43165
- await this.verifyBaseBranchExists(this.remoteGitPath);
43312
+ await git.clone(this.buildGitHubUrl(), stagingPath, ["--bare"]);
43313
+ await this.scrubPersistedRemote(stagingPath);
43314
+ await this.verifyBaseBranchExists(stagingPath);
43166
43315
  } catch (err) {
43167
- workerLogError(
43168
- `remote.git base branch verification failed after clone: ${getErrorMessage2(err)}`
43169
- );
43170
- await fs8.rm(this.remoteGitPath, { recursive: true, force: true });
43316
+ workerLogError(`remote.git clone failed: ${redactCredentials(getErrorMessage2(err))}`);
43317
+ await fs9.rm(stagingPath, { recursive: true, force: true });
43171
43318
  throw new Error(
43172
- `remote.git clone of ${this.config.githubOwner}/${this.config.githubRepo} has no branch '${this.baseBranch}' - the GitHub repository is empty or the base branch does not exist. Push an initial commit to '${this.baseBranch}' and restart the worker (systemd will retry automatically).`
43319
+ `remote.git clone of ${this.config.githubOwner}/${this.config.githubRepo} failed or has no branch '${this.baseBranch}' - the GitHub repository may be empty, or the base branch may not exist. Push an initial commit to '${this.baseBranch}' and restart the worker (systemd will retry automatically).`
43173
43320
  );
43174
43321
  }
43175
- const bareGit = simpleGit({ baseDir: this.remoteGitPath });
43176
- await bareGit.removeRemote("origin").catch(() => {
43177
- });
43322
+ await fs9.rename(stagingPath, this.remoteGitPath);
43178
43323
  workerLog("remote.git initialized");
43179
43324
  }
43180
43325
  /**
@@ -43383,7 +43528,7 @@ var CmsWorker = class {
43383
43528
  if (!branch) return;
43384
43529
  const branchPath = this.branchWorkspacePath(branch);
43385
43530
  try {
43386
- await fs8.stat(branchPath);
43531
+ await fs9.stat(branchPath);
43387
43532
  } catch {
43388
43533
  return;
43389
43534
  }
@@ -43427,7 +43572,7 @@ var CmsWorker = class {
43427
43572
  if (!branch) return;
43428
43573
  const branchPath = this.branchWorkspacePath(branch);
43429
43574
  try {
43430
- await fs8.stat(branchPath);
43575
+ await fs9.stat(branchPath);
43431
43576
  } catch {
43432
43577
  return;
43433
43578
  }
@@ -43463,7 +43608,7 @@ var CmsWorker = class {
43463
43608
  * is sanitized.
43464
43609
  */
43465
43610
  branchWorkspacePath(branchRefName) {
43466
- return path12.join(this.contentBranchesPath, sanitizeBranchName(branchRefName));
43611
+ return path13.join(this.contentBranchesPath, sanitizeBranchName(branchRefName));
43467
43612
  }
43468
43613
  /**
43469
43614
  * What `remote.git` currently holds for `branchRef`, or null when this
@@ -43890,7 +44035,7 @@ var CmsWorker = class {
43890
44035
  */
43891
44036
  async hasPendingHistoryRewrite(branchName) {
43892
44037
  try {
43893
- const branchPath = path12.join(this.contentBranchesPath, sanitizeBranchName(branchName));
44038
+ const branchPath = path13.join(this.contentBranchesPath, sanitizeBranchName(branchName));
43894
44039
  const metaFile = await BranchMetadataFileManager.loadOnly(branchPath);
43895
44040
  return typeof metaFile?.branch.historyRewrittenFrom === "string";
43896
44041
  } catch {
@@ -43965,7 +44110,7 @@ var CmsWorker = class {
43965
44110
  async cleanupTrashedBranchDirs() {
43966
44111
  let entries;
43967
44112
  try {
43968
- entries = await fs8.readdir(this.contentBranchesPath);
44113
+ entries = await fs9.readdir(this.contentBranchesPath);
43969
44114
  } catch (err) {
43970
44115
  if (isNodeError(err) && err.code === "ENOENT") return 0;
43971
44116
  throw err;
@@ -43986,7 +44131,7 @@ var CmsWorker = class {
43986
44131
  }
43987
44132
  if (now - stampDate.getTime() < TRASH_RETENTION_MS) continue;
43988
44133
  try {
43989
- await fs8.rm(path12.join(this.contentBranchesPath, name), {
44134
+ await fs9.rm(path13.join(this.contentBranchesPath, name), {
43990
44135
  recursive: true,
43991
44136
  force: true,
43992
44137
  maxRetries: 3,
@@ -44024,12 +44169,12 @@ var CmsWorker = class {
44024
44169
  * untouched rather than force-resolved.
44025
44170
  */
44026
44171
  async refreshBaseBranchWorkspace() {
44027
- const basePath32 = path12.join(this.contentBranchesPath, this.sanitizedBaseBranch);
44028
- const gitDir = path12.join(basePath32, ".git");
44172
+ const basePath32 = path13.join(this.contentBranchesPath, this.sanitizedBaseBranch);
44173
+ const gitDir = path13.join(basePath32, ".git");
44029
44174
  try {
44030
44175
  let gitDirStat;
44031
44176
  try {
44032
- gitDirStat = await fs8.stat(gitDir);
44177
+ gitDirStat = await fs9.stat(gitDir);
44033
44178
  } catch {
44034
44179
  gitDirStat = null;
44035
44180
  }
@@ -44204,6 +44349,15 @@ var CmsWorker = class {
44204
44349
  */
44205
44350
  async afterConflictDetectedForTesting() {
44206
44351
  }
44352
+ /**
44353
+ * Test seam, sibling of {@link afterConflictDetectedForTesting}: runs at the
44354
+ * instant a rebase round has succeeded, before the completion path (cache
44355
+ * invalidation, conflict metadata, [SYNC-H1] marker) executes. Exists so a
44356
+ * test can lose the content-write lock at exactly the point where bailing out
44357
+ * would strand a rewritten history.
44358
+ */
44359
+ async afterRebaseCompletedForTesting() {
44360
+ }
44207
44361
  async rebaseActiveBranches() {
44208
44362
  const rebased = [];
44209
44363
  const skippedDirty = [];
@@ -44211,7 +44365,7 @@ var CmsWorker = class {
44211
44365
  const failed = [];
44212
44366
  let branchDirs;
44213
44367
  try {
44214
- branchDirs = await fs8.readdir(this.contentBranchesPath);
44368
+ branchDirs = await fs9.readdir(this.contentBranchesPath);
44215
44369
  } catch {
44216
44370
  return { rebased, skippedDirty, skippedLocked, failed };
44217
44371
  }
@@ -44219,10 +44373,10 @@ var CmsWorker = class {
44219
44373
  if (branchDir.startsWith(".") || branchDir === "branches.json") {
44220
44374
  continue;
44221
44375
  }
44222
- const branchPath = path12.join(this.contentBranchesPath, branchDir);
44223
- const gitDir = path12.join(branchPath, ".git");
44376
+ const branchPath = path13.join(this.contentBranchesPath, branchDir);
44377
+ const gitDir = path13.join(branchPath, ".git");
44224
44378
  try {
44225
- const stat = await fs8.stat(gitDir);
44379
+ const stat = await fs9.stat(gitDir);
44226
44380
  if (!stat.isDirectory()) {
44227
44381
  workerLog(` Skipping ${branchDir}: .git is not a directory`);
44228
44382
  continue;
@@ -44257,8 +44411,14 @@ var CmsWorker = class {
44257
44411
  unsafe: { allowUnsafeEditor: true }
44258
44412
  });
44259
44413
  let releaseContentLock;
44414
+ let contentLockCompromised = false;
44260
44415
  try {
44261
- releaseContentLock = await tryAcquireContentWriteLock(branchPath);
44416
+ releaseContentLock = await tryAcquireContentWriteLock(branchPath, (lockErr) => {
44417
+ contentLockCompromised = true;
44418
+ workerLogWarn(
44419
+ ` Content-write lock compromised mid-rebase for ${branchDir}: ${getErrorMessage2(lockErr)}`
44420
+ );
44421
+ });
44262
44422
  } catch (lockErr) {
44263
44423
  if (isNodeError(lockErr) && lockErr.code === "ELOCKED") {
44264
44424
  workerLog(` Skipping ${branchDir}: content write in progress (retrying next cycle)`);
@@ -44268,6 +44428,29 @@ var CmsWorker = class {
44268
44428
  throw lockErr;
44269
44429
  }
44270
44430
  try {
44431
+ if (await isRebaseInProgress(branchPath)) {
44432
+ const preAbort = await branchGit.status().catch(() => null);
44433
+ const collateral = (preAbort?.files ?? []).filter((f5) => !preAbort?.conflicted.includes(f5.path)).filter((f5) => f5.working_dir !== " " && f5.working_dir !== "?").map((f5) => f5.path);
44434
+ if (collateral.length > 0) {
44435
+ workerLogWarn(
44436
+ ` ${branchDir}: aborting the interrupted rebase will DISCARD working-tree changes to ${collateral.length} file(s) saved while the worker was down: ${collateral.join(", ")}`
44437
+ );
44438
+ }
44439
+ workerLogWarn(
44440
+ ` ${branchDir}: found an interrupted rebase (this worker's own abandoned work) -- aborting it to recover the branch`
44441
+ );
44442
+ try {
44443
+ await branchGit.rebase(["--abort"]);
44444
+ } catch (abortErr) {
44445
+ const reason = redactCredentials(
44446
+ `could not abort interrupted rebase: ${getErrorMessage2(abortErr)}`
44447
+ );
44448
+ workerLogWarn(` Skipping ${branchDir}: ${reason}`);
44449
+ failed.push({ branch: branchDir, error: reason });
44450
+ await this.recordRebaseFailure(branchPath, branchDir, reason);
44451
+ continue;
44452
+ }
44453
+ }
44271
44454
  const dirtyCheck = await branchGit.status();
44272
44455
  if (dirtyCheck.files.length > 0) {
44273
44456
  workerLog(` Skipping ${branchDir}: has uncommitted changes`);
@@ -44320,6 +44503,7 @@ var CmsWorker = class {
44320
44503
  let failureReason;
44321
44504
  const MAX_ROUNDS = 50;
44322
44505
  for (let round = 0; round < MAX_ROUNDS && !completed; round++) {
44506
+ if (contentLockCompromised) break;
44323
44507
  try {
44324
44508
  if (nextAction === "start") {
44325
44509
  await branchGit.rebase([fetchedBaseTip]);
@@ -44334,11 +44518,31 @@ var CmsWorker = class {
44334
44518
  const st = await branchGit.status();
44335
44519
  if (st.conflicted.length > 0) {
44336
44520
  await this.afterConflictDetectedForTesting();
44521
+ const conflictKind = new Map(
44522
+ st.files.map((f5) => [f5.path, `${f5.index}${f5.working_dir}`])
44523
+ );
44524
+ let resolutionFailure;
44337
44525
  for (const file of st.conflicted) {
44338
- await branchGit.raw(["checkout", "--theirs", file]);
44339
- await branchGit.add(file);
44526
+ const kind = conflictKind.get(file);
44527
+ try {
44528
+ if (kind === "UD") {
44529
+ await branchGit.raw(["rm", "-f", "--", file]);
44530
+ } else if (kind === "DU") {
44531
+ await branchGit.add(file);
44532
+ } else {
44533
+ await branchGit.raw(["checkout", "--theirs", file]);
44534
+ await branchGit.add(file);
44535
+ }
44536
+ } catch (resolveErr) {
44537
+ resolutionFailure = `failed to resolve conflicted file '${file}' (status ${kind ?? "??"}): ` + getErrorMessage2(resolveErr);
44538
+ break;
44539
+ }
44340
44540
  conflictedFiles.push(file);
44341
44541
  }
44542
+ if (resolutionFailure !== void 0) {
44543
+ failureReason = resolutionFailure;
44544
+ break;
44545
+ }
44342
44546
  } else {
44343
44547
  const msg = rebaseErr instanceof Error ? rebaseErr.message : "";
44344
44548
  if (msg.toLowerCase().includes("nothing to commit") || msg.toLowerCase().includes("apply --skip")) {
@@ -44355,6 +44559,21 @@ var CmsWorker = class {
44355
44559
  }
44356
44560
  }
44357
44561
  }
44562
+ if (completed) await this.afterRebaseCompletedForTesting();
44563
+ if (contentLockCompromised && !completed) {
44564
+ workerLogWarn(
44565
+ ` Skipping ${branchDir}: content-write lock was compromised mid-rebase (retrying next cycle)`
44566
+ );
44567
+ await branchGit.rebase(["--abort"]).catch(() => {
44568
+ });
44569
+ skippedLocked.push(branchDir);
44570
+ continue;
44571
+ }
44572
+ if (contentLockCompromised) {
44573
+ workerLogWarn(
44574
+ ` Content-write lock for ${branchDir} was compromised, but its rebase had already completed -- finishing the sync (history is rewritten; skipping now would strand the history-rewrite marker and wedge the branch)`
44575
+ );
44576
+ }
44358
44577
  if (!completed) {
44359
44578
  workerLogWarn(
44360
44579
  failureReason !== void 0 ? ` Rebase of ${branchDir} aborted due to unexpected error: ${failureReason}` : ` Rebase of ${branchDir} did not complete within ${MAX_ROUNDS} rounds, aborting`
@@ -44373,13 +44592,13 @@ var CmsWorker = class {
44373
44592
  await invalidateBranchContentCaches(branchPath);
44374
44593
  const normalizedContentRoot = normalizeFilesystemPath(this.contentRoot);
44375
44594
  const conflictIds = [...new Set(conflictedFiles)].map((f5) => {
44376
- const fileId = extractIdFromFilename(path12.basename(f5));
44595
+ const fileId = extractIdFromFilename(path13.basename(f5));
44377
44596
  if (fileId) return fileId;
44378
- const parentDir = path12.basename(path12.dirname(f5));
44597
+ const parentDir = path13.basename(path13.dirname(f5));
44379
44598
  const dirId = extractIdFromFilename(parentDir);
44380
44599
  if (dirId) return dirId;
44381
- const parentPath = normalizeFilesystemPath(path12.dirname(f5));
44382
- if (path12.basename(f5) === ".collection.json" && parentPath === normalizedContentRoot) {
44600
+ const parentPath = normalizeFilesystemPath(path13.dirname(f5));
44601
+ if (path13.basename(f5) === ".collection.json" && parentPath === normalizedContentRoot) {
44383
44602
  return ROOT_COLLECTION_ID;
44384
44603
  }
44385
44604
  return null;
@@ -44413,6 +44632,18 @@ var CmsWorker = class {
44413
44632
  }
44414
44633
  }
44415
44634
  } finally {
44635
+ try {
44636
+ if (await isRebaseInProgress(branchPath)) {
44637
+ workerLogWarn(
44638
+ ` ${branchDir}: rebase still in progress on exit -- aborting so the clone is not left wedged`
44639
+ );
44640
+ await branchGit.rebase(["--abort"]);
44641
+ }
44642
+ } catch (abortErr) {
44643
+ workerLogWarn(
44644
+ ` Failed to abort in-progress rebase for ${branchDir}: ${getErrorMessage2(abortErr)}`
44645
+ );
44646
+ }
44416
44647
  await releaseContentLock?.().catch((releaseErr) => {
44417
44648
  workerLogWarn(
44418
44649
  ` Failed to release content-write lock for ${branchDir}: ${getErrorMessage2(releaseErr)}`
@@ -47622,10 +47853,10 @@ var SessionAPI = class extends AbstractAPI {
47622
47853
  */
47623
47854
  async getToken(sessionId, template, expiresInSeconds) {
47624
47855
  this.requireId(sessionId);
47625
- const path15 = template ? joinPaths(basePath24, sessionId, "tokens", template) : joinPaths(basePath24, sessionId, "tokens");
47856
+ const path16 = template ? joinPaths(basePath24, sessionId, "tokens", template) : joinPaths(basePath24, sessionId, "tokens");
47626
47857
  const requestOptions = {
47627
47858
  method: "POST",
47628
- path: path15
47859
+ path: path16
47629
47860
  };
47630
47861
  if (expiresInSeconds !== void 0) {
47631
47862
  requestOptions.bodyParams = { expires_in_seconds: expiresInSeconds };
@@ -49747,12 +49978,12 @@ function buildRequest(options) {
49747
49978
  userAgent = USER_AGENT,
49748
49979
  skipApiVersionInUrl = false
49749
49980
  } = options;
49750
- const { path: path15, method, queryParams, headerParams, bodyParams, formData, options: opts } = requestOptions;
49981
+ const { path: path16, method, queryParams, headerParams, bodyParams, formData, options: opts } = requestOptions;
49751
49982
  const { deepSnakecaseBodyParamKeys = false } = opts || {};
49752
49983
  if (requireSecretKey) {
49753
49984
  assertValidSecretKey(secretKey);
49754
49985
  }
49755
- const url = skipApiVersionInUrl ? joinPaths(apiUrl, path15) : joinPaths(apiUrl, apiVersion, path15);
49986
+ const url = skipApiVersionInUrl ? joinPaths(apiUrl, path16) : joinPaths(apiUrl, apiVersion, path16);
49756
49987
  const finalUrl = new URL(url);
49757
49988
  if (queryParams) {
49758
49989
  const snakecasedQueryParams = snakecase_keys_default({ ...queryParams });
@@ -51814,38 +52045,38 @@ function createClerkClient(options) {
51814
52045
  }
51815
52046
 
51816
52047
  // ../canopycms/src/auth/file-based-auth-cache.ts
51817
- import fs9 from "node:fs/promises";
51818
- import path13 from "node:path";
52048
+ import fs10 from "node:fs/promises";
52049
+ import path14 from "node:path";
51819
52050
  var log5 = createDebugLogger({ prefix: "FileBasedAuthCache" });
51820
52051
  async function writeAuthCacheSnapshot(cachePath, files) {
51821
- await fs9.mkdir(cachePath, { recursive: true });
52052
+ await fs10.mkdir(cachePath, { recursive: true });
51822
52053
  const timestamp2 = Date.now();
51823
- const snapshotDir = path13.join(cachePath, `snapshot-${timestamp2}`);
51824
- await fs9.mkdir(snapshotDir, { recursive: true });
52054
+ const snapshotDir = path14.join(cachePath, `snapshot-${timestamp2}`);
52055
+ await fs10.mkdir(snapshotDir, { recursive: true });
51825
52056
  for (const [fileName, data2] of Object.entries(files)) {
51826
- const tmpPath = path13.join(snapshotDir, `${fileName}.tmp`);
51827
- const finalPath = path13.join(snapshotDir, fileName);
51828
- await fs9.writeFile(tmpPath, JSON.stringify(data2, null, 2), "utf-8");
51829
- await fs9.rename(tmpPath, finalPath);
51830
- }
51831
- const currentLink = path13.join(cachePath, "current");
51832
- const tmpLink = path13.join(cachePath, `current-${timestamp2}`);
51833
- await fs9.symlink(snapshotDir, tmpLink);
51834
- await fs9.rename(tmpLink, currentLink);
52057
+ const tmpPath = path14.join(snapshotDir, `${fileName}.tmp`);
52058
+ const finalPath = path14.join(snapshotDir, fileName);
52059
+ await fs10.writeFile(tmpPath, JSON.stringify(data2, null, 2), "utf-8");
52060
+ await fs10.rename(tmpPath, finalPath);
52061
+ }
52062
+ const currentLink = path14.join(cachePath, "current");
52063
+ const tmpLink = path14.join(cachePath, `current-${timestamp2}`);
52064
+ await fs10.symlink(path14.basename(snapshotDir), tmpLink);
52065
+ await fs10.rename(tmpLink, currentLink);
51835
52066
  await cleanupOldSnapshots(cachePath, 2);
51836
52067
  return snapshotDir;
51837
52068
  }
51838
52069
  async function cleanupOldSnapshots(cachePath, keepCount) {
51839
52070
  let entries;
51840
52071
  try {
51841
- entries = await fs9.readdir(cachePath);
52072
+ entries = await fs10.readdir(cachePath);
51842
52073
  } catch {
51843
52074
  return;
51844
52075
  }
51845
52076
  const snapshots = entries.filter((e5) => e5.startsWith("snapshot-")).sort().reverse();
51846
52077
  for (const snapshot of snapshots.slice(keepCount)) {
51847
52078
  try {
51848
- await fs9.rm(path13.join(cachePath, snapshot), {
52079
+ await fs10.rm(path14.join(cachePath, snapshot), {
51849
52080
  recursive: true,
51850
52081
  force: true
51851
52082
  });
@@ -51939,7 +52170,7 @@ async function refreshClerkCache(options) {
51939
52170
  }
51940
52171
 
51941
52172
  // worker/index.ts
51942
- import path14 from "node:path";
52173
+ import path15 from "node:path";
51943
52174
  async function getSecret(secretArn, retries = 3) {
51944
52175
  const { SecretsManagerClient, GetSecretValueCommand } = await Promise.resolve().then(() => __toESM(require_dist_cjs53(), 1));
51945
52176
  const client = new SecretsManagerClient({});
@@ -51978,7 +52209,7 @@ async function main() {
51978
52209
  if (!clerkSecretKey && process.env.CLERK_SECRET_KEY_SECRET_ARN) {
51979
52210
  clerkSecretKey = await getSecret(process.env.CLERK_SECRET_KEY_SECRET_ARN);
51980
52211
  }
51981
- const cachePath = path14.join(workspacePath, ".cache");
52212
+ const cachePath = path15.join(workspacePath, ".cache");
51982
52213
  const refreshAuthCache = clerkSecretKey ? async () => {
51983
52214
  const result = await refreshClerkCache({
51984
52215
  secretKey: clerkSecretKey,