@clef-sh/cli 0.1.7-beta.43 → 0.1.7-beta.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -976,8 +976,8 @@ var require_command = __commonJS({
976
976
  "../../node_modules/commander/lib/command.js"(exports) {
977
977
  var EventEmitter = __require("node:events").EventEmitter;
978
978
  var childProcess = __require("node:child_process");
979
- var path43 = __require("node:path");
980
- var fs26 = __require("node:fs");
979
+ var path44 = __require("node:path");
980
+ var fs27 = __require("node:fs");
981
981
  var process2 = __require("node:process");
982
982
  var { Argument: Argument2, humanReadableArgName } = require_argument();
983
983
  var { CommanderError: CommanderError2 } = require_error();
@@ -1909,11 +1909,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
1909
1909
  let launchWithNode = false;
1910
1910
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1911
1911
  function findFile(baseDir, baseName) {
1912
- const localBin = path43.resolve(baseDir, baseName);
1913
- if (fs26.existsSync(localBin)) return localBin;
1914
- if (sourceExt.includes(path43.extname(baseName))) return void 0;
1912
+ const localBin = path44.resolve(baseDir, baseName);
1913
+ if (fs27.existsSync(localBin)) return localBin;
1914
+ if (sourceExt.includes(path44.extname(baseName))) return void 0;
1915
1915
  const foundExt = sourceExt.find(
1916
- (ext) => fs26.existsSync(`${localBin}${ext}`)
1916
+ (ext) => fs27.existsSync(`${localBin}${ext}`)
1917
1917
  );
1918
1918
  if (foundExt) return `${localBin}${foundExt}`;
1919
1919
  return void 0;
@@ -1925,21 +1925,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
1925
1925
  if (this._scriptPath) {
1926
1926
  let resolvedScriptPath;
1927
1927
  try {
1928
- resolvedScriptPath = fs26.realpathSync(this._scriptPath);
1928
+ resolvedScriptPath = fs27.realpathSync(this._scriptPath);
1929
1929
  } catch (err) {
1930
1930
  resolvedScriptPath = this._scriptPath;
1931
1931
  }
1932
- executableDir = path43.resolve(
1933
- path43.dirname(resolvedScriptPath),
1932
+ executableDir = path44.resolve(
1933
+ path44.dirname(resolvedScriptPath),
1934
1934
  executableDir
1935
1935
  );
1936
1936
  }
1937
1937
  if (executableDir) {
1938
1938
  let localFile = findFile(executableDir, executableFile);
1939
1939
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1940
- const legacyName = path43.basename(
1940
+ const legacyName = path44.basename(
1941
1941
  this._scriptPath,
1942
- path43.extname(this._scriptPath)
1942
+ path44.extname(this._scriptPath)
1943
1943
  );
1944
1944
  if (legacyName !== this._name) {
1945
1945
  localFile = findFile(
@@ -1950,7 +1950,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
1950
1950
  }
1951
1951
  executableFile = localFile || executableFile;
1952
1952
  }
1953
- launchWithNode = sourceExt.includes(path43.extname(executableFile));
1953
+ launchWithNode = sourceExt.includes(path44.extname(executableFile));
1954
1954
  let proc;
1955
1955
  if (process2.platform !== "win32") {
1956
1956
  if (launchWithNode) {
@@ -2790,7 +2790,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2790
2790
  * @return {Command}
2791
2791
  */
2792
2792
  nameFromFilename(filename) {
2793
- this._name = path43.basename(filename, path43.extname(filename));
2793
+ this._name = path44.basename(filename, path44.extname(filename));
2794
2794
  return this;
2795
2795
  }
2796
2796
  /**
@@ -2804,9 +2804,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2804
2804
  * @param {string} [path]
2805
2805
  * @return {(string|null|Command)}
2806
2806
  */
2807
- executableDir(path44) {
2808
- if (path44 === void 0) return this._executableDir;
2809
- this._executableDir = path44;
2807
+ executableDir(path45) {
2808
+ if (path45 === void 0) return this._executableDir;
2809
+ this._executableDir = path45;
2810
2810
  return this;
2811
2811
  }
2812
2812
  /**
@@ -3113,17 +3113,17 @@ var require_visit = __commonJS({
3113
3113
  visit.BREAK = BREAK;
3114
3114
  visit.SKIP = SKIP;
3115
3115
  visit.REMOVE = REMOVE;
3116
- function visit_(key, node, visitor, path43) {
3117
- const ctrl = callVisitor(key, node, visitor, path43);
3116
+ function visit_(key, node, visitor, path44) {
3117
+ const ctrl = callVisitor(key, node, visitor, path44);
3118
3118
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
3119
- replaceNode(key, path43, ctrl);
3120
- return visit_(key, ctrl, visitor, path43);
3119
+ replaceNode(key, path44, ctrl);
3120
+ return visit_(key, ctrl, visitor, path44);
3121
3121
  }
3122
3122
  if (typeof ctrl !== "symbol") {
3123
3123
  if (identity.isCollection(node)) {
3124
- path43 = Object.freeze(path43.concat(node));
3124
+ path44 = Object.freeze(path44.concat(node));
3125
3125
  for (let i = 0; i < node.items.length; ++i) {
3126
- const ci = visit_(i, node.items[i], visitor, path43);
3126
+ const ci = visit_(i, node.items[i], visitor, path44);
3127
3127
  if (typeof ci === "number")
3128
3128
  i = ci - 1;
3129
3129
  else if (ci === BREAK)
@@ -3134,13 +3134,13 @@ var require_visit = __commonJS({
3134
3134
  }
3135
3135
  }
3136
3136
  } else if (identity.isPair(node)) {
3137
- path43 = Object.freeze(path43.concat(node));
3138
- const ck = visit_("key", node.key, visitor, path43);
3137
+ path44 = Object.freeze(path44.concat(node));
3138
+ const ck = visit_("key", node.key, visitor, path44);
3139
3139
  if (ck === BREAK)
3140
3140
  return BREAK;
3141
3141
  else if (ck === REMOVE)
3142
3142
  node.key = null;
3143
- const cv = visit_("value", node.value, visitor, path43);
3143
+ const cv = visit_("value", node.value, visitor, path44);
3144
3144
  if (cv === BREAK)
3145
3145
  return BREAK;
3146
3146
  else if (cv === REMOVE)
@@ -3161,17 +3161,17 @@ var require_visit = __commonJS({
3161
3161
  visitAsync.BREAK = BREAK;
3162
3162
  visitAsync.SKIP = SKIP;
3163
3163
  visitAsync.REMOVE = REMOVE;
3164
- async function visitAsync_(key, node, visitor, path43) {
3165
- const ctrl = await callVisitor(key, node, visitor, path43);
3164
+ async function visitAsync_(key, node, visitor, path44) {
3165
+ const ctrl = await callVisitor(key, node, visitor, path44);
3166
3166
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
3167
- replaceNode(key, path43, ctrl);
3168
- return visitAsync_(key, ctrl, visitor, path43);
3167
+ replaceNode(key, path44, ctrl);
3168
+ return visitAsync_(key, ctrl, visitor, path44);
3169
3169
  }
3170
3170
  if (typeof ctrl !== "symbol") {
3171
3171
  if (identity.isCollection(node)) {
3172
- path43 = Object.freeze(path43.concat(node));
3172
+ path44 = Object.freeze(path44.concat(node));
3173
3173
  for (let i = 0; i < node.items.length; ++i) {
3174
- const ci = await visitAsync_(i, node.items[i], visitor, path43);
3174
+ const ci = await visitAsync_(i, node.items[i], visitor, path44);
3175
3175
  if (typeof ci === "number")
3176
3176
  i = ci - 1;
3177
3177
  else if (ci === BREAK)
@@ -3182,13 +3182,13 @@ var require_visit = __commonJS({
3182
3182
  }
3183
3183
  }
3184
3184
  } else if (identity.isPair(node)) {
3185
- path43 = Object.freeze(path43.concat(node));
3186
- const ck = await visitAsync_("key", node.key, visitor, path43);
3185
+ path44 = Object.freeze(path44.concat(node));
3186
+ const ck = await visitAsync_("key", node.key, visitor, path44);
3187
3187
  if (ck === BREAK)
3188
3188
  return BREAK;
3189
3189
  else if (ck === REMOVE)
3190
3190
  node.key = null;
3191
- const cv = await visitAsync_("value", node.value, visitor, path43);
3191
+ const cv = await visitAsync_("value", node.value, visitor, path44);
3192
3192
  if (cv === BREAK)
3193
3193
  return BREAK;
3194
3194
  else if (cv === REMOVE)
@@ -3215,23 +3215,23 @@ var require_visit = __commonJS({
3215
3215
  }
3216
3216
  return visitor;
3217
3217
  }
3218
- function callVisitor(key, node, visitor, path43) {
3218
+ function callVisitor(key, node, visitor, path44) {
3219
3219
  if (typeof visitor === "function")
3220
- return visitor(key, node, path43);
3220
+ return visitor(key, node, path44);
3221
3221
  if (identity.isMap(node))
3222
- return visitor.Map?.(key, node, path43);
3222
+ return visitor.Map?.(key, node, path44);
3223
3223
  if (identity.isSeq(node))
3224
- return visitor.Seq?.(key, node, path43);
3224
+ return visitor.Seq?.(key, node, path44);
3225
3225
  if (identity.isPair(node))
3226
- return visitor.Pair?.(key, node, path43);
3226
+ return visitor.Pair?.(key, node, path44);
3227
3227
  if (identity.isScalar(node))
3228
- return visitor.Scalar?.(key, node, path43);
3228
+ return visitor.Scalar?.(key, node, path44);
3229
3229
  if (identity.isAlias(node))
3230
- return visitor.Alias?.(key, node, path43);
3230
+ return visitor.Alias?.(key, node, path44);
3231
3231
  return void 0;
3232
3232
  }
3233
- function replaceNode(key, path43, node) {
3234
- const parent = path43[path43.length - 1];
3233
+ function replaceNode(key, path44, node) {
3234
+ const parent = path44[path44.length - 1];
3235
3235
  if (identity.isCollection(parent)) {
3236
3236
  parent.items[key] = node;
3237
3237
  } else if (identity.isPair(parent)) {
@@ -3839,10 +3839,10 @@ var require_Collection = __commonJS({
3839
3839
  var createNode = require_createNode();
3840
3840
  var identity = require_identity();
3841
3841
  var Node = require_Node();
3842
- function collectionFromPath(schema, path43, value) {
3842
+ function collectionFromPath(schema, path44, value) {
3843
3843
  let v = value;
3844
- for (let i = path43.length - 1; i >= 0; --i) {
3845
- const k = path43[i];
3844
+ for (let i = path44.length - 1; i >= 0; --i) {
3845
+ const k = path44[i];
3846
3846
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
3847
3847
  const a = [];
3848
3848
  a[k] = v;
@@ -3861,7 +3861,7 @@ var require_Collection = __commonJS({
3861
3861
  sourceObjects: /* @__PURE__ */ new Map()
3862
3862
  });
3863
3863
  }
3864
- var isEmptyPath = (path43) => path43 == null || typeof path43 === "object" && !!path43[Symbol.iterator]().next().done;
3864
+ var isEmptyPath = (path44) => path44 == null || typeof path44 === "object" && !!path44[Symbol.iterator]().next().done;
3865
3865
  var Collection = class extends Node.NodeBase {
3866
3866
  constructor(type, schema) {
3867
3867
  super(type);
@@ -3891,11 +3891,11 @@ var require_Collection = __commonJS({
3891
3891
  * be a Pair instance or a `{ key, value }` object, which may not have a key
3892
3892
  * that already exists in the map.
3893
3893
  */
3894
- addIn(path43, value) {
3895
- if (isEmptyPath(path43))
3894
+ addIn(path44, value) {
3895
+ if (isEmptyPath(path44))
3896
3896
  this.add(value);
3897
3897
  else {
3898
- const [key, ...rest] = path43;
3898
+ const [key, ...rest] = path44;
3899
3899
  const node = this.get(key, true);
3900
3900
  if (identity.isCollection(node))
3901
3901
  node.addIn(rest, value);
@@ -3909,8 +3909,8 @@ var require_Collection = __commonJS({
3909
3909
  * Removes a value from the collection.
3910
3910
  * @returns `true` if the item was found and removed.
3911
3911
  */
3912
- deleteIn(path43) {
3913
- const [key, ...rest] = path43;
3912
+ deleteIn(path44) {
3913
+ const [key, ...rest] = path44;
3914
3914
  if (rest.length === 0)
3915
3915
  return this.delete(key);
3916
3916
  const node = this.get(key, true);
@@ -3924,8 +3924,8 @@ var require_Collection = __commonJS({
3924
3924
  * scalar values from their surrounding node; to disable set `keepScalar` to
3925
3925
  * `true` (collections are always returned intact).
3926
3926
  */
3927
- getIn(path43, keepScalar) {
3928
- const [key, ...rest] = path43;
3927
+ getIn(path44, keepScalar) {
3928
+ const [key, ...rest] = path44;
3929
3929
  const node = this.get(key, true);
3930
3930
  if (rest.length === 0)
3931
3931
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -3943,8 +3943,8 @@ var require_Collection = __commonJS({
3943
3943
  /**
3944
3944
  * Checks if the collection includes a value with the key `key`.
3945
3945
  */
3946
- hasIn(path43) {
3947
- const [key, ...rest] = path43;
3946
+ hasIn(path44) {
3947
+ const [key, ...rest] = path44;
3948
3948
  if (rest.length === 0)
3949
3949
  return this.has(key);
3950
3950
  const node = this.get(key, true);
@@ -3954,8 +3954,8 @@ var require_Collection = __commonJS({
3954
3954
  * Sets a value in this collection. For `!!set`, `value` needs to be a
3955
3955
  * boolean to add/remove the item from the set.
3956
3956
  */
3957
- setIn(path43, value) {
3958
- const [key, ...rest] = path43;
3957
+ setIn(path44, value) {
3958
+ const [key, ...rest] = path44;
3959
3959
  if (rest.length === 0) {
3960
3960
  this.set(key, value);
3961
3961
  } else {
@@ -6459,9 +6459,9 @@ var require_Document = __commonJS({
6459
6459
  this.contents.add(value);
6460
6460
  }
6461
6461
  /** Adds a value to the document. */
6462
- addIn(path43, value) {
6462
+ addIn(path44, value) {
6463
6463
  if (assertCollection(this.contents))
6464
- this.contents.addIn(path43, value);
6464
+ this.contents.addIn(path44, value);
6465
6465
  }
6466
6466
  /**
6467
6467
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -6536,14 +6536,14 @@ var require_Document = __commonJS({
6536
6536
  * Removes a value from the document.
6537
6537
  * @returns `true` if the item was found and removed.
6538
6538
  */
6539
- deleteIn(path43) {
6540
- if (Collection.isEmptyPath(path43)) {
6539
+ deleteIn(path44) {
6540
+ if (Collection.isEmptyPath(path44)) {
6541
6541
  if (this.contents == null)
6542
6542
  return false;
6543
6543
  this.contents = null;
6544
6544
  return true;
6545
6545
  }
6546
- return assertCollection(this.contents) ? this.contents.deleteIn(path43) : false;
6546
+ return assertCollection(this.contents) ? this.contents.deleteIn(path44) : false;
6547
6547
  }
6548
6548
  /**
6549
6549
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -6558,10 +6558,10 @@ var require_Document = __commonJS({
6558
6558
  * scalar values from their surrounding node; to disable set `keepScalar` to
6559
6559
  * `true` (collections are always returned intact).
6560
6560
  */
6561
- getIn(path43, keepScalar) {
6562
- if (Collection.isEmptyPath(path43))
6561
+ getIn(path44, keepScalar) {
6562
+ if (Collection.isEmptyPath(path44))
6563
6563
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
6564
- return identity.isCollection(this.contents) ? this.contents.getIn(path43, keepScalar) : void 0;
6564
+ return identity.isCollection(this.contents) ? this.contents.getIn(path44, keepScalar) : void 0;
6565
6565
  }
6566
6566
  /**
6567
6567
  * Checks if the document includes a value with the key `key`.
@@ -6572,10 +6572,10 @@ var require_Document = __commonJS({
6572
6572
  /**
6573
6573
  * Checks if the document includes a value at `path`.
6574
6574
  */
6575
- hasIn(path43) {
6576
- if (Collection.isEmptyPath(path43))
6575
+ hasIn(path44) {
6576
+ if (Collection.isEmptyPath(path44))
6577
6577
  return this.contents !== void 0;
6578
- return identity.isCollection(this.contents) ? this.contents.hasIn(path43) : false;
6578
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path44) : false;
6579
6579
  }
6580
6580
  /**
6581
6581
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -6592,13 +6592,13 @@ var require_Document = __commonJS({
6592
6592
  * Sets a value in this document. For `!!set`, `value` needs to be a
6593
6593
  * boolean to add/remove the item from the set.
6594
6594
  */
6595
- setIn(path43, value) {
6596
- if (Collection.isEmptyPath(path43)) {
6595
+ setIn(path44, value) {
6596
+ if (Collection.isEmptyPath(path44)) {
6597
6597
  this.contents = value;
6598
6598
  } else if (this.contents == null) {
6599
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path43), value);
6599
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path44), value);
6600
6600
  } else if (assertCollection(this.contents)) {
6601
- this.contents.setIn(path43, value);
6601
+ this.contents.setIn(path44, value);
6602
6602
  }
6603
6603
  }
6604
6604
  /**
@@ -8550,9 +8550,9 @@ var require_cst_visit = __commonJS({
8550
8550
  visit.BREAK = BREAK;
8551
8551
  visit.SKIP = SKIP;
8552
8552
  visit.REMOVE = REMOVE;
8553
- visit.itemAtPath = (cst, path43) => {
8553
+ visit.itemAtPath = (cst, path44) => {
8554
8554
  let item = cst;
8555
- for (const [field, index] of path43) {
8555
+ for (const [field, index] of path44) {
8556
8556
  const tok = item?.[field];
8557
8557
  if (tok && "items" in tok) {
8558
8558
  item = tok.items[index];
@@ -8561,23 +8561,23 @@ var require_cst_visit = __commonJS({
8561
8561
  }
8562
8562
  return item;
8563
8563
  };
8564
- visit.parentCollection = (cst, path43) => {
8565
- const parent = visit.itemAtPath(cst, path43.slice(0, -1));
8566
- const field = path43[path43.length - 1][0];
8564
+ visit.parentCollection = (cst, path44) => {
8565
+ const parent = visit.itemAtPath(cst, path44.slice(0, -1));
8566
+ const field = path44[path44.length - 1][0];
8567
8567
  const coll = parent?.[field];
8568
8568
  if (coll && "items" in coll)
8569
8569
  return coll;
8570
8570
  throw new Error("Parent collection not found");
8571
8571
  };
8572
- function _visit(path43, item, visitor) {
8573
- let ctrl = visitor(item, path43);
8572
+ function _visit(path44, item, visitor) {
8573
+ let ctrl = visitor(item, path44);
8574
8574
  if (typeof ctrl === "symbol")
8575
8575
  return ctrl;
8576
8576
  for (const field of ["key", "value"]) {
8577
8577
  const token = item[field];
8578
8578
  if (token && "items" in token) {
8579
8579
  for (let i = 0; i < token.items.length; ++i) {
8580
- const ci = _visit(Object.freeze(path43.concat([[field, i]])), token.items[i], visitor);
8580
+ const ci = _visit(Object.freeze(path44.concat([[field, i]])), token.items[i], visitor);
8581
8581
  if (typeof ci === "number")
8582
8582
  i = ci - 1;
8583
8583
  else if (ci === BREAK)
@@ -8588,10 +8588,10 @@ var require_cst_visit = __commonJS({
8588
8588
  }
8589
8589
  }
8590
8590
  if (typeof ctrl === "function" && field === "key")
8591
- ctrl = ctrl(item, path43);
8591
+ ctrl = ctrl(item, path44);
8592
8592
  }
8593
8593
  }
8594
- return typeof ctrl === "function" ? ctrl(item, path43) : ctrl;
8594
+ return typeof ctrl === "function" ? ctrl(item, path44) : ctrl;
8595
8595
  }
8596
8596
  exports.visit = visit;
8597
8597
  }
@@ -9876,14 +9876,14 @@ var require_parser = __commonJS({
9876
9876
  case "scalar":
9877
9877
  case "single-quoted-scalar":
9878
9878
  case "double-quoted-scalar": {
9879
- const fs26 = this.flowScalar(this.type);
9879
+ const fs27 = this.flowScalar(this.type);
9880
9880
  if (atNextItem || it.value) {
9881
- map.items.push({ start, key: fs26, sep: [] });
9881
+ map.items.push({ start, key: fs27, sep: [] });
9882
9882
  this.onKeyLine = true;
9883
9883
  } else if (it.sep) {
9884
- this.stack.push(fs26);
9884
+ this.stack.push(fs27);
9885
9885
  } else {
9886
- Object.assign(it, { key: fs26, sep: [] });
9886
+ Object.assign(it, { key: fs27, sep: [] });
9887
9887
  this.onKeyLine = true;
9888
9888
  }
9889
9889
  return;
@@ -10011,13 +10011,13 @@ var require_parser = __commonJS({
10011
10011
  case "scalar":
10012
10012
  case "single-quoted-scalar":
10013
10013
  case "double-quoted-scalar": {
10014
- const fs26 = this.flowScalar(this.type);
10014
+ const fs27 = this.flowScalar(this.type);
10015
10015
  if (!it || it.value)
10016
- fc.items.push({ start: [], key: fs26, sep: [] });
10016
+ fc.items.push({ start: [], key: fs27, sep: [] });
10017
10017
  else if (it.sep)
10018
- this.stack.push(fs26);
10018
+ this.stack.push(fs27);
10019
10019
  else
10020
- Object.assign(it, { key: fs26, sep: [] });
10020
+ Object.assign(it, { key: fs27, sep: [] });
10021
10021
  return;
10022
10022
  }
10023
10023
  case "flow-map-end":
@@ -10225,7 +10225,7 @@ var require_public_api = __commonJS({
10225
10225
  }
10226
10226
  return doc;
10227
10227
  }
10228
- function parse15(src, reviver, options) {
10228
+ function parse16(src, reviver, options) {
10229
10229
  let _reviver = void 0;
10230
10230
  if (typeof reviver === "function") {
10231
10231
  _reviver = reviver;
@@ -10266,7 +10266,7 @@ var require_public_api = __commonJS({
10266
10266
  return value.toString(options);
10267
10267
  return new Document.Document(value, _replacer, options).toString(options);
10268
10268
  }
10269
- exports.parse = parse15;
10269
+ exports.parse = parse16;
10270
10270
  exports.parseAllDocuments = parseAllDocuments;
10271
10271
  exports.parseDocument = parseDocument;
10272
10272
  exports.stringify = stringify7;
@@ -11463,10 +11463,11 @@ var init_metadata = __esm({
11463
11463
  // ../core/src/matrix/manager.ts
11464
11464
  import * as fs5 from "fs";
11465
11465
  import * as path4 from "path";
11466
- var MatrixManager;
11466
+ var YAML3, MatrixManager;
11467
11467
  var init_manager = __esm({
11468
11468
  "../core/src/matrix/manager.ts"() {
11469
11469
  "use strict";
11470
+ YAML3 = __toESM(require_dist());
11470
11471
  init_metadata();
11471
11472
  MatrixManager = class {
11472
11473
  /**
@@ -11522,9 +11523,15 @@ var init_manager = __esm({
11522
11523
  * @param repoRoot - Absolute path to the repository root.
11523
11524
  * @param sopsClient - SOPS client used to decrypt each cell.
11524
11525
  */
11525
- async getMatrixStatus(manifest, repoRoot, sopsClient) {
11526
+ async getMatrixStatus(manifest, repoRoot, _sopsClient) {
11526
11527
  const cells = this.resolveMatrix(manifest, repoRoot);
11527
11528
  const statuses = [];
11529
+ const cellKeys = /* @__PURE__ */ new Map();
11530
+ for (const cell of cells) {
11531
+ if (cell.exists) {
11532
+ cellKeys.set(cell.filePath, this.readKeyNames(cell.filePath));
11533
+ }
11534
+ }
11528
11535
  for (const cell of cells) {
11529
11536
  if (!cell.exists) {
11530
11537
  statuses.push({
@@ -11547,48 +11554,56 @@ var init_manager = __esm({
11547
11554
  pendingCount = pending.length;
11548
11555
  } catch {
11549
11556
  }
11550
- try {
11551
- const decrypted = await sopsClient.decrypt(cell.filePath);
11552
- const keyCount = Object.keys(decrypted.values).length;
11553
- const lastModified = decrypted.metadata.lastModified;
11554
- const issues = [];
11555
- const siblingCells = cells.filter(
11556
- (c) => c.namespace === cell.namespace && c.environment !== cell.environment && c.exists
11557
- );
11558
- for (const sibling of siblingCells) {
11559
- try {
11560
- const siblingDecrypted = await sopsClient.decrypt(sibling.filePath);
11561
- const siblingKeys = Object.keys(siblingDecrypted.values);
11562
- const currentKeys = Object.keys(decrypted.values);
11563
- const missingKeys = siblingKeys.filter((k) => !currentKeys.includes(k));
11564
- for (const mk of missingKeys) {
11565
- issues.push({
11566
- type: "missing_keys",
11567
- message: `Key '${mk}' exists in ${sibling.environment} but is missing here.`,
11568
- key: mk
11569
- });
11570
- }
11571
- } catch {
11572
- }
11557
+ const keys = cellKeys.get(cell.filePath) ?? [];
11558
+ const keyCount = keys.length;
11559
+ const lastModified = this.readLastModified(cell.filePath);
11560
+ const issues = [];
11561
+ const siblingCells = cells.filter(
11562
+ (c) => c.namespace === cell.namespace && c.environment !== cell.environment && c.exists
11563
+ );
11564
+ for (const sibling of siblingCells) {
11565
+ const siblingKeys = cellKeys.get(sibling.filePath) ?? [];
11566
+ const missingKeys = siblingKeys.filter((k) => !keys.includes(k));
11567
+ for (const mk of missingKeys) {
11568
+ issues.push({
11569
+ type: "missing_keys",
11570
+ message: `Key '${mk}' exists in ${sibling.environment} but is missing here.`,
11571
+ key: mk
11572
+ });
11573
11573
  }
11574
- statuses.push({ cell, keyCount, pendingCount, lastModified, issues });
11575
- } catch {
11576
- statuses.push({
11577
- cell,
11578
- keyCount: 0,
11579
- pendingCount: 0,
11580
- lastModified: null,
11581
- issues: [
11582
- {
11583
- type: "sops_error",
11584
- message: `Could not decrypt '${cell.filePath}'. Check your key configuration.`
11585
- }
11586
- ]
11587
- });
11588
11574
  }
11575
+ statuses.push({ cell, keyCount, pendingCount, lastModified, issues });
11589
11576
  }
11590
11577
  return statuses;
11591
11578
  }
11579
+ /**
11580
+ * Read top-level key names from a SOPS file without decryption.
11581
+ * SOPS stores key names in plaintext — only values are encrypted.
11582
+ */
11583
+ readKeyNames(filePath) {
11584
+ try {
11585
+ const raw = fs5.readFileSync(filePath, "utf-8");
11586
+ const parsed = YAML3.parse(raw);
11587
+ if (!parsed || typeof parsed !== "object") return [];
11588
+ return Object.keys(parsed).filter((k) => k !== "sops");
11589
+ } catch {
11590
+ return [];
11591
+ }
11592
+ }
11593
+ /**
11594
+ * Read the lastModified timestamp from SOPS metadata without decryption.
11595
+ */
11596
+ readLastModified(filePath) {
11597
+ try {
11598
+ const raw = fs5.readFileSync(filePath, "utf-8");
11599
+ const parsed = YAML3.parse(raw);
11600
+ const sops = parsed?.sops;
11601
+ if (sops?.lastmodified) return new Date(String(sops.lastmodified));
11602
+ return null;
11603
+ } catch {
11604
+ return null;
11605
+ }
11606
+ }
11592
11607
  /**
11593
11608
  * Check whether an environment has the `protected` flag set in the manifest.
11594
11609
  *
@@ -11605,11 +11620,11 @@ var init_manager = __esm({
11605
11620
 
11606
11621
  // ../core/src/schema/validator.ts
11607
11622
  import * as fs6 from "fs";
11608
- var YAML3, SchemaValidator;
11623
+ var YAML4, SchemaValidator;
11609
11624
  var init_validator2 = __esm({
11610
11625
  "../core/src/schema/validator.ts"() {
11611
11626
  "use strict";
11612
- YAML3 = __toESM(require_dist());
11627
+ YAML4 = __toESM(require_dist());
11613
11628
  init_types();
11614
11629
  SchemaValidator = class {
11615
11630
  /**
@@ -11628,7 +11643,7 @@ var init_validator2 = __esm({
11628
11643
  }
11629
11644
  let parsed;
11630
11645
  try {
11631
- parsed = YAML3.parse(raw);
11646
+ parsed = YAML4.parse(raw);
11632
11647
  } catch {
11633
11648
  throw new SchemaLoadError(`Schema file '${filePath}' contains invalid YAML.`, filePath);
11634
11649
  }
@@ -19702,11 +19717,11 @@ function openWindowsInputPipe(content) {
19702
19717
  });
19703
19718
  });
19704
19719
  }
19705
- var YAML4, SopsClient;
19720
+ var YAML5, SopsClient;
19706
19721
  var init_client = __esm({
19707
19722
  "../core/src/sops/client.ts"() {
19708
19723
  "use strict";
19709
- YAML4 = __toESM(require_dist());
19724
+ YAML5 = __toESM(require_dist());
19710
19725
  init_types();
19711
19726
  init_checker();
19712
19727
  init_keygen();
@@ -19771,7 +19786,7 @@ var init_client = __esm({
19771
19786
  }
19772
19787
  let parsed;
19773
19788
  try {
19774
- parsed = YAML4.parse(result.stdout) ?? {};
19789
+ parsed = YAML5.parse(result.stdout) ?? {};
19775
19790
  } catch {
19776
19791
  throw new SopsDecryptionError(
19777
19792
  `Decrypted content of '${filePath}' is not valid YAML.`,
@@ -19798,7 +19813,7 @@ var init_client = __esm({
19798
19813
  async encrypt(filePath, values, manifest, environment) {
19799
19814
  await assertSops(this.runner, this.sopsCommand);
19800
19815
  const fmt = formatFromPath(filePath);
19801
- const content = fmt === "json" ? JSON.stringify(values, null, 2) : YAML4.stringify(values);
19816
+ const content = fmt === "json" ? JSON.stringify(values, null, 2) : YAML5.stringify(values);
19802
19817
  const args = this.buildEncryptArgs(filePath, manifest, environment);
19803
19818
  const env = this.buildSopsEnv();
19804
19819
  let inputArg;
@@ -19998,7 +20013,7 @@ var init_client = __esm({
19998
20013
  }
19999
20014
  let parsed;
20000
20015
  try {
20001
- parsed = YAML4.parse(content);
20016
+ parsed = YAML5.parse(content);
20002
20017
  } catch {
20003
20018
  throw new SopsDecryptionError(
20004
20019
  `File '${filePath}' is not valid YAML. Cannot extract SOPS metadata.`,
@@ -20466,7 +20481,7 @@ function detectFormat(filePath, content) {
20466
20481
  } catch {
20467
20482
  }
20468
20483
  try {
20469
- const parsed = YAML5.parse(content);
20484
+ const parsed = YAML6.parse(content);
20470
20485
  if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
20471
20486
  return "yaml";
20472
20487
  }
@@ -20547,7 +20562,7 @@ function parseJson(content) {
20547
20562
  function parseYaml(content) {
20548
20563
  let parsed;
20549
20564
  try {
20550
- parsed = YAML5.parse(content);
20565
+ parsed = YAML6.parse(content);
20551
20566
  } catch (err) {
20552
20567
  throw new Error(`Invalid YAML: ${err.message}`);
20553
20568
  }
@@ -20581,7 +20596,7 @@ function parseYaml(content) {
20581
20596
  }
20582
20597
  return { pairs, format: "yaml", skipped, warnings };
20583
20598
  }
20584
- function parse6(content, format, filePath) {
20599
+ function parse7(content, format, filePath) {
20585
20600
  const resolved = format === "auto" ? detectFormat(filePath ?? "", content) : format;
20586
20601
  switch (resolved) {
20587
20602
  case "dotenv":
@@ -20592,11 +20607,11 @@ function parse6(content, format, filePath) {
20592
20607
  return parseYaml(content);
20593
20608
  }
20594
20609
  }
20595
- var YAML5;
20610
+ var YAML6;
20596
20611
  var init_parsers = __esm({
20597
20612
  "../core/src/import/parsers.ts"() {
20598
20613
  "use strict";
20599
- YAML5 = __toESM(require_dist());
20614
+ YAML6 = __toESM(require_dist());
20600
20615
  }
20601
20616
  });
20602
20617
 
@@ -20627,7 +20642,7 @@ var init_import = __esm({
20627
20642
  repoRoot,
20628
20643
  manifest.file_pattern.replace("{namespace}", ns).replace("{environment}", env)
20629
20644
  );
20630
- const parsed = parse6(content, options.format ?? "auto", sourcePath ?? "");
20645
+ const parsed = parse7(content, options.format ?? "auto", sourcePath ?? "");
20631
20646
  let candidates = Object.entries(parsed.pairs);
20632
20647
  if (options.prefix) {
20633
20648
  const prefix2 = options.prefix;
@@ -20708,11 +20723,11 @@ function toRecipient(entry) {
20708
20723
  function readManifestYaml(repoRoot) {
20709
20724
  const manifestPath = path13.join(repoRoot, CLEF_MANIFEST_FILENAME);
20710
20725
  const raw = fs11.readFileSync(manifestPath, "utf-8");
20711
- return YAML6.parse(raw);
20726
+ return YAML7.parse(raw);
20712
20727
  }
20713
20728
  function writeManifestYaml(repoRoot, doc) {
20714
20729
  const manifestPath = path13.join(repoRoot, CLEF_MANIFEST_FILENAME);
20715
- fs11.writeFileSync(manifestPath, YAML6.stringify(doc), "utf-8");
20730
+ fs11.writeFileSync(manifestPath, YAML7.stringify(doc), "utf-8");
20716
20731
  }
20717
20732
  function getRecipientsArray(doc) {
20718
20733
  const sops = doc.sops;
@@ -20760,11 +20775,11 @@ function ensureEnvironmentRecipientsArray(doc, envName) {
20760
20775
  }
20761
20776
  return env.recipients;
20762
20777
  }
20763
- var YAML6, RecipientManager;
20778
+ var YAML7, RecipientManager;
20764
20779
  var init_recipients2 = __esm({
20765
20780
  "../core/src/recipients/index.ts"() {
20766
20781
  "use strict";
20767
- YAML6 = __toESM(require_dist());
20782
+ YAML7 = __toESM(require_dist());
20768
20783
  init_validator();
20769
20784
  init_parser();
20770
20785
  RecipientManager = class {
@@ -20964,7 +20979,7 @@ function loadRequests(repoRoot) {
20964
20979
  try {
20965
20980
  if (!fs12.existsSync(filePath)) return [];
20966
20981
  const content = fs12.readFileSync(filePath, "utf-8");
20967
- const parsed = YAML7.parse(content);
20982
+ const parsed = YAML8.parse(content);
20968
20983
  if (!parsed || !Array.isArray(parsed.requests)) return [];
20969
20984
  return parsed.requests.map((r) => ({
20970
20985
  key: r.key,
@@ -20996,7 +21011,7 @@ function saveRequests(repoRoot, requests) {
20996
21011
  return raw;
20997
21012
  })
20998
21013
  };
20999
- fs12.writeFileSync(filePath, HEADER_COMMENT2 + YAML7.stringify(data), "utf-8");
21014
+ fs12.writeFileSync(filePath, HEADER_COMMENT2 + YAML8.stringify(data), "utf-8");
21000
21015
  }
21001
21016
  function upsertRequest(repoRoot, key, label2, environment) {
21002
21017
  const requests = loadRequests(repoRoot);
@@ -21030,11 +21045,11 @@ function findInList(requests, identifier) {
21030
21045
  const byKey = requests.find((r) => r.key === identifier);
21031
21046
  return byKey ?? null;
21032
21047
  }
21033
- var YAML7, REQUESTS_FILENAME, HEADER_COMMENT2;
21048
+ var YAML8, REQUESTS_FILENAME, HEADER_COMMENT2;
21034
21049
  var init_requests = __esm({
21035
21050
  "../core/src/recipients/requests.ts"() {
21036
21051
  "use strict";
21037
- YAML7 = __toESM(require_dist());
21052
+ YAML8 = __toESM(require_dist());
21038
21053
  REQUESTS_FILENAME = ".clef-requests.yaml";
21039
21054
  HEADER_COMMENT2 = "# Pending recipient access requests. Approve with: clef recipients approve <label>\n";
21040
21055
  }
@@ -21043,11 +21058,11 @@ var init_requests = __esm({
21043
21058
  // ../core/src/drift/detector.ts
21044
21059
  import * as fs13 from "fs";
21045
21060
  import * as path15 from "path";
21046
- var YAML8, DriftDetector;
21061
+ var YAML9, DriftDetector;
21047
21062
  var init_detector = __esm({
21048
21063
  "../core/src/drift/detector.ts"() {
21049
21064
  "use strict";
21050
- YAML8 = __toESM(require_dist());
21065
+ YAML9 = __toESM(require_dist());
21051
21066
  init_parser();
21052
21067
  init_manager();
21053
21068
  DriftDetector = class {
@@ -21136,7 +21151,7 @@ var init_detector = __esm({
21136
21151
  try {
21137
21152
  if (!fs13.existsSync(filePath)) return null;
21138
21153
  const raw = fs13.readFileSync(filePath, "utf-8");
21139
- const parsed = YAML8.parse(raw);
21154
+ const parsed = YAML9.parse(raw);
21140
21155
  if (parsed === null || parsed === void 0 || typeof parsed !== "object") return null;
21141
21156
  return Object.keys(parsed).filter((k) => k !== "sops");
21142
21157
  } catch {
@@ -21289,11 +21304,11 @@ var init_sanitizer = __esm({
21289
21304
  // ../core/src/report/generator.ts
21290
21305
  import * as fs14 from "fs";
21291
21306
  import * as path16 from "path";
21292
- var YAML9, ReportGenerator;
21307
+ var YAML10, ReportGenerator;
21293
21308
  var init_generator = __esm({
21294
21309
  "../core/src/report/generator.ts"() {
21295
21310
  "use strict";
21296
- YAML9 = __toESM(require_dist());
21311
+ YAML10 = __toESM(require_dist());
21297
21312
  init_types();
21298
21313
  init_parser();
21299
21314
  init_runner();
@@ -21472,7 +21487,7 @@ var init_generator = __esm({
21472
21487
  try {
21473
21488
  if (!fs14.existsSync(filePath)) return 0;
21474
21489
  const raw = fs14.readFileSync(filePath, "utf-8");
21475
- const parsed = YAML9.parse(raw);
21490
+ const parsed = YAML10.parse(raw);
21476
21491
  if (parsed === null || parsed === void 0 || typeof parsed !== "object") return 0;
21477
21492
  return Object.keys(parsed).filter((k) => k !== "sops").length;
21478
21493
  } catch {
@@ -21847,11 +21862,11 @@ var init_driver = __esm({
21847
21862
  import * as fs15 from "fs";
21848
21863
  import * as os from "os";
21849
21864
  import * as path17 from "path";
21850
- var YAML10, PartialRotationError, ServiceIdentityManager;
21865
+ var YAML11, PartialRotationError, ServiceIdentityManager;
21851
21866
  var init_manager2 = __esm({
21852
21867
  "../core/src/service-identity/manager.ts"() {
21853
21868
  "use strict";
21854
- YAML10 = __toESM(require_dist());
21869
+ YAML11 = __toESM(require_dist());
21855
21870
  init_types();
21856
21871
  init_keygen();
21857
21872
  init_parser();
@@ -21907,7 +21922,7 @@ var init_manager2 = __esm({
21907
21922
  await this.registerRecipients(definition, manifest, repoRoot);
21908
21923
  const manifestPath = path17.join(repoRoot, CLEF_MANIFEST_FILENAME);
21909
21924
  const raw = fs15.readFileSync(manifestPath, "utf-8");
21910
- const doc = YAML10.parse(raw);
21925
+ const doc = YAML11.parse(raw);
21911
21926
  if (!Array.isArray(doc.service_identities)) {
21912
21927
  doc.service_identities = [];
21913
21928
  }
@@ -21919,7 +21934,7 @@ var init_manager2 = __esm({
21919
21934
  });
21920
21935
  const tmpCreate = path17.join(os.tmpdir(), `clef-manifest-${process.pid}-${Date.now()}.tmp`);
21921
21936
  try {
21922
- fs15.writeFileSync(tmpCreate, YAML10.stringify(doc), "utf-8");
21937
+ fs15.writeFileSync(tmpCreate, YAML11.stringify(doc), "utf-8");
21923
21938
  fs15.renameSync(tmpCreate, manifestPath);
21924
21939
  } finally {
21925
21940
  try {
@@ -21941,6 +21956,46 @@ var init_manager2 = __esm({
21941
21956
  get(manifest, name) {
21942
21957
  return manifest.service_identities?.find((si) => si.name === name);
21943
21958
  }
21959
+ /**
21960
+ * Delete a service identity: remove its recipients from scoped SOPS files
21961
+ * and remove it from the manifest.
21962
+ */
21963
+ async delete(name, manifest, repoRoot) {
21964
+ const identity = this.get(manifest, name);
21965
+ if (!identity) {
21966
+ throw new Error(`Service identity '${name}' not found.`);
21967
+ }
21968
+ const cells = this.matrixManager.resolveMatrix(manifest, repoRoot).filter((c) => c.exists);
21969
+ for (const cell of cells) {
21970
+ if (!identity.namespaces.includes(cell.namespace)) continue;
21971
+ const envConfig = identity.environments[cell.environment];
21972
+ if (!envConfig?.recipient) continue;
21973
+ if (isKmsEnvelope(envConfig)) continue;
21974
+ try {
21975
+ await this.encryption.removeRecipient(cell.filePath, envConfig.recipient);
21976
+ } catch {
21977
+ }
21978
+ }
21979
+ const manifestPath = path17.join(repoRoot, CLEF_MANIFEST_FILENAME);
21980
+ const raw = fs15.readFileSync(manifestPath, "utf-8");
21981
+ const doc = YAML11.parse(raw);
21982
+ const identities = doc.service_identities;
21983
+ if (Array.isArray(identities)) {
21984
+ doc.service_identities = identities.filter(
21985
+ (si) => si.name !== name
21986
+ );
21987
+ }
21988
+ const tmp = path17.join(os.tmpdir(), `clef-manifest-${process.pid}-${Date.now()}.tmp`);
21989
+ try {
21990
+ fs15.writeFileSync(tmp, YAML11.stringify(doc), "utf-8");
21991
+ fs15.renameSync(tmp, manifestPath);
21992
+ } finally {
21993
+ try {
21994
+ fs15.unlinkSync(tmp);
21995
+ } catch {
21996
+ }
21997
+ }
21998
+ }
21944
21999
  /**
21945
22000
  * Update environment backends on an existing service identity.
21946
22001
  * Switches age → KMS (removes old recipient) or updates KMS config.
@@ -21953,7 +22008,7 @@ var init_manager2 = __esm({
21953
22008
  }
21954
22009
  const manifestPath = path17.join(repoRoot, CLEF_MANIFEST_FILENAME);
21955
22010
  const raw = fs15.readFileSync(manifestPath, "utf-8");
21956
- const doc = YAML10.parse(raw);
22011
+ const doc = YAML11.parse(raw);
21957
22012
  const identities = doc.service_identities;
21958
22013
  const siDoc = identities.find((si) => si.name === name);
21959
22014
  const envs = siDoc.environments;
@@ -21980,7 +22035,7 @@ var init_manager2 = __esm({
21980
22035
  }
21981
22036
  const tmp = path17.join(os.tmpdir(), `clef-manifest-${process.pid}-${Date.now()}.tmp`);
21982
22037
  try {
21983
- fs15.writeFileSync(tmp, YAML10.stringify(doc), "utf-8");
22038
+ fs15.writeFileSync(tmp, YAML11.stringify(doc), "utf-8");
21984
22039
  fs15.renameSync(tmp, manifestPath);
21985
22040
  } finally {
21986
22041
  try {
@@ -22022,7 +22077,7 @@ var init_manager2 = __esm({
22022
22077
  }
22023
22078
  const manifestPath = path17.join(repoRoot, CLEF_MANIFEST_FILENAME);
22024
22079
  const raw = fs15.readFileSync(manifestPath, "utf-8");
22025
- const doc = YAML10.parse(raw);
22080
+ const doc = YAML11.parse(raw);
22026
22081
  const identities = doc.service_identities;
22027
22082
  const siDoc = identities.find((si) => si.name === name);
22028
22083
  const envs = siDoc.environments;
@@ -22077,7 +22132,7 @@ var init_manager2 = __esm({
22077
22132
  }
22078
22133
  const tmpRotate = path17.join(os.tmpdir(), `clef-manifest-${process.pid}-${Date.now()}.tmp`);
22079
22134
  try {
22080
- fs15.writeFileSync(tmpRotate, YAML10.stringify(doc), "utf-8");
22135
+ fs15.writeFileSync(tmpRotate, YAML11.stringify(doc), "utf-8");
22081
22136
  fs15.renameSync(tmpRotate, manifestPath);
22082
22137
  } finally {
22083
22138
  try {
@@ -22251,7 +22306,7 @@ var init_packer = __esm({
22251
22306
  const e = new Encrypter2();
22252
22307
  e.addRecipient(ephemeralPublicKey);
22253
22308
  const encrypted = await e.encrypt(plaintext);
22254
- ciphertext = typeof encrypted === "string" ? encrypted : Buffer.from(encrypted).toString("base64");
22309
+ ciphertext = Buffer.from(encrypted).toString("base64");
22255
22310
  } catch {
22256
22311
  throw new Error("Failed to age-encrypt artifact with ephemeral key.");
22257
22312
  }
@@ -22281,7 +22336,7 @@ var init_packer = __esm({
22281
22336
  const e = new Encrypter2();
22282
22337
  e.addRecipient(resolved.recipient);
22283
22338
  const encrypted = await e.encrypt(plaintext);
22284
- ciphertext = typeof encrypted === "string" ? encrypted : Buffer.from(encrypted).toString("base64");
22339
+ ciphertext = Buffer.from(encrypted).toString("base64");
22285
22340
  } catch {
22286
22341
  throw new Error("Failed to age-encrypt artifact. Check recipient key.");
22287
22342
  }
@@ -22383,7 +22438,7 @@ __export(src_exports, {
22383
22438
  markResolved: () => markResolved,
22384
22439
  matchPatterns: () => matchPatterns,
22385
22440
  metadataPath: () => metadataPath,
22386
- parse: () => parse6,
22441
+ parse: () => parse7,
22387
22442
  parseDotenv: () => parseDotenv,
22388
22443
  parseIgnoreContent: () => parseIgnoreContent,
22389
22444
  parseJson: () => parseJson,
@@ -22521,7 +22576,7 @@ var require_ms = __commonJS({
22521
22576
  options = options || {};
22522
22577
  var type = typeof val;
22523
22578
  if (type === "string" && val.length > 0) {
22524
- return parse15(val);
22579
+ return parse16(val);
22525
22580
  } else if (type === "number" && isFinite(val)) {
22526
22581
  return options.long ? fmtLong(val) : fmtShort(val);
22527
22582
  }
@@ -22529,7 +22584,7 @@ var require_ms = __commonJS({
22529
22584
  "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
22530
22585
  );
22531
22586
  };
22532
- function parse15(str2) {
22587
+ function parse16(str2) {
22533
22588
  str2 = String(str2);
22534
22589
  if (str2.length > 100) {
22535
22590
  return;
@@ -23968,7 +24023,7 @@ var require_bytes = __commonJS({
23968
24023
  "use strict";
23969
24024
  module.exports = bytes;
23970
24025
  module.exports.format = format;
23971
- module.exports.parse = parse15;
24026
+ module.exports.parse = parse16;
23972
24027
  var formatThousandsRegExp = /\B(?=(\d{3})+(?!\d))/g;
23973
24028
  var formatDecimalsRegExp = /(?:\.0*|(\.[^0]+)0+)$/;
23974
24029
  var map = {
@@ -23982,7 +24037,7 @@ var require_bytes = __commonJS({
23982
24037
  var parseRegExp = /^((-|\+)?(\d+(?:\.\d+)?)) *(kb|mb|gb|tb|pb)$/i;
23983
24038
  function bytes(value, options) {
23984
24039
  if (typeof value === "string") {
23985
- return parse15(value);
24040
+ return parse16(value);
23986
24041
  }
23987
24042
  if (typeof value === "number") {
23988
24043
  return format(value, options);
@@ -24026,7 +24081,7 @@ var require_bytes = __commonJS({
24026
24081
  }
24027
24082
  return str2 + unitSeparator + unit;
24028
24083
  }
24029
- function parse15(val) {
24084
+ function parse16(val) {
24030
24085
  if (typeof val === "number" && !isNaN(val)) {
24031
24086
  return val;
24032
24087
  }
@@ -28231,7 +28286,7 @@ var require_content_type = __commonJS({
28231
28286
  var QUOTE_REGEXP = /([\\"])/g;
28232
28287
  var TYPE_REGEXP = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;
28233
28288
  exports.format = format;
28234
- exports.parse = parse15;
28289
+ exports.parse = parse16;
28235
28290
  function format(obj) {
28236
28291
  if (!obj || typeof obj !== "object") {
28237
28292
  throw new TypeError("argument obj is required");
@@ -28255,7 +28310,7 @@ var require_content_type = __commonJS({
28255
28310
  }
28256
28311
  return string;
28257
28312
  }
28258
- function parse15(string) {
28313
+ function parse16(string) {
28259
28314
  if (!string) {
28260
28315
  throw new TypeError("argument string is required");
28261
28316
  }
@@ -37780,11 +37835,11 @@ var require_mime_types = __commonJS({
37780
37835
  }
37781
37836
  return exts[0];
37782
37837
  }
37783
- function lookup(path43) {
37784
- if (!path43 || typeof path43 !== "string") {
37838
+ function lookup(path44) {
37839
+ if (!path44 || typeof path44 !== "string") {
37785
37840
  return false;
37786
37841
  }
37787
- var extension2 = extname2("x." + path43).toLowerCase().slice(1);
37842
+ var extension2 = extname2("x." + path44).toLowerCase().slice(1);
37788
37843
  if (!extension2) {
37789
37844
  return false;
37790
37845
  }
@@ -37837,7 +37892,7 @@ var require_media_typer = __commonJS({
37837
37892
  var TYPE_NAME_REGEXP = /^[A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126}$/;
37838
37893
  var TYPE_REGEXP = /^ *([A-Za-z0-9][A-Za-z0-9!#$&^_-]{0,126})\/([A-Za-z0-9][A-Za-z0-9!#$&^_.+-]{0,126}) *$/;
37839
37894
  exports.format = format;
37840
- exports.parse = parse15;
37895
+ exports.parse = parse16;
37841
37896
  exports.test = test;
37842
37897
  function format(obj) {
37843
37898
  if (!obj || typeof obj !== "object") {
@@ -37870,7 +37925,7 @@ var require_media_typer = __commonJS({
37870
37925
  }
37871
37926
  return TYPE_REGEXP.test(string.toLowerCase());
37872
37927
  }
37873
- function parse15(string) {
37928
+ function parse16(string) {
37874
37929
  if (!string) {
37875
37930
  throw new TypeError("argument string is required");
37876
37931
  }
@@ -38056,7 +38111,7 @@ var require_read = __commonJS({
38056
38111
  var hasBody = require_type_is().hasBody;
38057
38112
  var { getCharset } = require_utils();
38058
38113
  module.exports = read2;
38059
- function read2(req, res, next, parse15, debug, options) {
38114
+ function read2(req, res, next, parse16, debug, options) {
38060
38115
  if (onFinished.isFinished(req)) {
38061
38116
  debug("body already parsed");
38062
38117
  next();
@@ -38144,7 +38199,7 @@ var require_read = __commonJS({
38144
38199
  try {
38145
38200
  debug("parse body");
38146
38201
  str2 = typeof body !== "string" && encoding !== null ? iconv.decode(body, encoding) : body;
38147
- req.body = parse15(str2, encoding);
38202
+ req.body = parse16(str2, encoding);
38148
38203
  } catch (err) {
38149
38204
  next(createError(400, err, {
38150
38205
  body: str2,
@@ -38217,7 +38272,7 @@ var require_json = __commonJS({
38217
38272
  const normalizedOptions = normalizeOptions(options, "application/json");
38218
38273
  var reviver = options?.reviver;
38219
38274
  var strict = options?.strict !== false;
38220
- function parse15(body) {
38275
+ function parse16(body) {
38221
38276
  if (body.length === 0) {
38222
38277
  return {};
38223
38278
  }
@@ -38244,7 +38299,7 @@ var require_json = __commonJS({
38244
38299
  isValidCharset: (charset) => charset.slice(0, 4) === "utf-"
38245
38300
  };
38246
38301
  return function jsonParser(req, res, next) {
38247
- read2(req, res, next, parse15, debug, readOptions);
38302
+ read2(req, res, next, parse16, debug, readOptions);
38248
38303
  };
38249
38304
  }
38250
38305
  function createStrictSyntaxError(str2, char) {
@@ -40822,11 +40877,11 @@ var require_lib2 = __commonJS({
40822
40877
  "../../node_modules/qs/lib/index.js"(exports, module) {
40823
40878
  "use strict";
40824
40879
  var stringify7 = require_stringify2();
40825
- var parse15 = require_parse();
40880
+ var parse16 = require_parse();
40826
40881
  var formats = require_formats();
40827
40882
  module.exports = {
40828
40883
  formats,
40829
- parse: parse15,
40884
+ parse: parse16,
40830
40885
  stringify: stringify7
40831
40886
  };
40832
40887
  }
@@ -40848,7 +40903,7 @@ var require_urlencoded = __commonJS({
40848
40903
  throw new TypeError("option defaultCharset must be either utf-8 or iso-8859-1");
40849
40904
  }
40850
40905
  var queryparse = createQueryParser(options);
40851
- function parse15(body, encoding) {
40906
+ function parse16(body, encoding) {
40852
40907
  return body.length ? queryparse(body, encoding) : {};
40853
40908
  }
40854
40909
  const readOptions = {
@@ -40857,7 +40912,7 @@ var require_urlencoded = __commonJS({
40857
40912
  isValidCharset: (charset) => charset === "utf-8" || charset === "iso-8859-1"
40858
40913
  };
40859
40914
  return function urlencodedParser(req, res, next) {
40860
- read2(req, res, next, parse15, debug, readOptions);
40915
+ read2(req, res, next, parse16, debug, readOptions);
40861
40916
  };
40862
40917
  }
40863
40918
  function createQueryParser(options) {
@@ -41041,7 +41096,7 @@ var require_parseurl = __commonJS({
41041
41096
  "../../node_modules/parseurl/index.js"(exports, module) {
41042
41097
  "use strict";
41043
41098
  var url = __require("url");
41044
- var parse15 = url.parse;
41099
+ var parse16 = url.parse;
41045
41100
  var Url = url.Url;
41046
41101
  module.exports = parseurl;
41047
41102
  module.exports.original = originalurl;
@@ -41073,7 +41128,7 @@ var require_parseurl = __commonJS({
41073
41128
  }
41074
41129
  function fastparse(str2) {
41075
41130
  if (typeof str2 !== "string" || str2.charCodeAt(0) !== 47) {
41076
- return parse15(str2);
41131
+ return parse16(str2);
41077
41132
  }
41078
41133
  var pathname = str2;
41079
41134
  var query = null;
@@ -41101,7 +41156,7 @@ var require_parseurl = __commonJS({
41101
41156
  /* # */
41102
41157
  case 160:
41103
41158
  case 65279:
41104
- return parse15(str2);
41159
+ return parse16(str2);
41105
41160
  }
41106
41161
  }
41107
41162
  var url2 = Url !== void 0 ? new Url() : {};
@@ -41252,13 +41307,13 @@ var require_view = __commonJS({
41252
41307
  "../../node_modules/express/lib/view.js"(exports, module) {
41253
41308
  "use strict";
41254
41309
  var debug = require_src()("express:view");
41255
- var path43 = __require("node:path");
41256
- var fs26 = __require("node:fs");
41257
- var dirname7 = path43.dirname;
41258
- var basename5 = path43.basename;
41259
- var extname2 = path43.extname;
41260
- var join39 = path43.join;
41261
- var resolve6 = path43.resolve;
41310
+ var path44 = __require("node:path");
41311
+ var fs27 = __require("node:fs");
41312
+ var dirname7 = path44.dirname;
41313
+ var basename5 = path44.basename;
41314
+ var extname2 = path44.extname;
41315
+ var join40 = path44.join;
41316
+ var resolve6 = path44.resolve;
41262
41317
  module.exports = View;
41263
41318
  function View(name, options) {
41264
41319
  var opts2 = options || {};
@@ -41287,17 +41342,17 @@ var require_view = __commonJS({
41287
41342
  this.path = this.lookup(fileName);
41288
41343
  }
41289
41344
  View.prototype.lookup = function lookup(name) {
41290
- var path44;
41345
+ var path45;
41291
41346
  var roots = [].concat(this.root);
41292
41347
  debug('lookup "%s"', name);
41293
- for (var i = 0; i < roots.length && !path44; i++) {
41348
+ for (var i = 0; i < roots.length && !path45; i++) {
41294
41349
  var root = roots[i];
41295
41350
  var loc = resolve6(root, name);
41296
41351
  var dir = dirname7(loc);
41297
41352
  var file = basename5(loc);
41298
- path44 = this.resolve(dir, file);
41353
+ path45 = this.resolve(dir, file);
41299
41354
  }
41300
- return path44;
41355
+ return path45;
41301
41356
  };
41302
41357
  View.prototype.render = function render(options, callback) {
41303
41358
  var sync = true;
@@ -41319,21 +41374,21 @@ var require_view = __commonJS({
41319
41374
  };
41320
41375
  View.prototype.resolve = function resolve7(dir, file) {
41321
41376
  var ext = this.ext;
41322
- var path44 = join39(dir, file);
41323
- var stat = tryStat(path44);
41377
+ var path45 = join40(dir, file);
41378
+ var stat = tryStat(path45);
41324
41379
  if (stat && stat.isFile()) {
41325
- return path44;
41380
+ return path45;
41326
41381
  }
41327
- path44 = join39(dir, basename5(file, ext), "index" + ext);
41328
- stat = tryStat(path44);
41382
+ path45 = join40(dir, basename5(file, ext), "index" + ext);
41383
+ stat = tryStat(path45);
41329
41384
  if (stat && stat.isFile()) {
41330
- return path44;
41385
+ return path45;
41331
41386
  }
41332
41387
  };
41333
- function tryStat(path44) {
41334
- debug('stat "%s"', path44);
41388
+ function tryStat(path45) {
41389
+ debug('stat "%s"', path45);
41335
41390
  try {
41336
- return fs26.statSync(path44);
41391
+ return fs27.statSync(path45);
41337
41392
  } catch (e) {
41338
41393
  return void 0;
41339
41394
  }
@@ -50839,11 +50894,11 @@ var require_mime_types2 = __commonJS({
50839
50894
  }
50840
50895
  return exts[0];
50841
50896
  }
50842
- function lookup(path43) {
50843
- if (!path43 || typeof path43 !== "string") {
50897
+ function lookup(path44) {
50898
+ if (!path44 || typeof path44 !== "string") {
50844
50899
  return false;
50845
50900
  }
50846
- var extension2 = extname2("x." + path43).toLowerCase().slice(1);
50901
+ var extension2 = extname2("x." + path44).toLowerCase().slice(1);
50847
50902
  if (!extension2) {
50848
50903
  return false;
50849
50904
  }
@@ -50897,7 +50952,7 @@ var require_forwarded = __commonJS({
50897
50952
  if (!req) {
50898
50953
  throw new TypeError("argument req is required");
50899
50954
  }
50900
- var proxyAddrs = parse15(req.headers["x-forwarded-for"] || "");
50955
+ var proxyAddrs = parse16(req.headers["x-forwarded-for"] || "");
50901
50956
  var socketAddr = getSocketAddr(req);
50902
50957
  var addrs = [socketAddr].concat(proxyAddrs);
50903
50958
  return addrs;
@@ -50905,7 +50960,7 @@ var require_forwarded = __commonJS({
50905
50960
  function getSocketAddr(req) {
50906
50961
  return req.socket ? req.socket.remoteAddress : req.connection.remoteAddress;
50907
50962
  }
50908
- function parse15(header) {
50963
+ function parse16(header) {
50909
50964
  var end = header.length;
50910
50965
  var list = [];
50911
50966
  var start = header.length;
@@ -51934,7 +51989,7 @@ var require_dist2 = __commonJS({
51934
51989
  "use strict";
51935
51990
  Object.defineProperty(exports, "__esModule", { value: true });
51936
51991
  exports.PathError = exports.TokenData = void 0;
51937
- exports.parse = parse15;
51992
+ exports.parse = parse16;
51938
51993
  exports.compile = compile;
51939
51994
  exports.match = match;
51940
51995
  exports.pathToRegexp = pathToRegexp;
@@ -51980,7 +52035,7 @@ var require_dist2 = __commonJS({
51980
52035
  }
51981
52036
  };
51982
52037
  exports.PathError = PathError;
51983
- function parse15(str2, options = {}) {
52038
+ function parse16(str2, options = {}) {
51984
52039
  const { encodePath = NOOP_VALUE } = options;
51985
52040
  const chars = [...str2];
51986
52041
  const tokens = [];
@@ -52036,15 +52091,15 @@ var require_dist2 = __commonJS({
52036
52091
  if (token.type === endType)
52037
52092
  break;
52038
52093
  if (token.type === "char" || token.type === "escape") {
52039
- let path43 = token.value;
52094
+ let path44 = token.value;
52040
52095
  let cur = tokens[pos];
52041
52096
  while (cur.type === "char" || cur.type === "escape") {
52042
- path43 += cur.value;
52097
+ path44 += cur.value;
52043
52098
  cur = tokens[++pos];
52044
52099
  }
52045
52100
  output.push({
52046
52101
  type: "text",
52047
- value: encodePath(path43)
52102
+ value: encodePath(path44)
52048
52103
  });
52049
52104
  continue;
52050
52105
  }
@@ -52068,16 +52123,16 @@ var require_dist2 = __commonJS({
52068
52123
  }
52069
52124
  return new TokenData(consumeUntil("end"), str2);
52070
52125
  }
52071
- function compile(path43, options = {}) {
52126
+ function compile(path44, options = {}) {
52072
52127
  const { encode: encode2 = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
52073
- const data = typeof path43 === "object" ? path43 : parse15(path43, options);
52128
+ const data = typeof path44 === "object" ? path44 : parse16(path44, options);
52074
52129
  const fn = tokensToFunction(data.tokens, delimiter, encode2);
52075
- return function path44(params = {}) {
52076
- const [path45, ...missing] = fn(params);
52130
+ return function path45(params = {}) {
52131
+ const [path46, ...missing] = fn(params);
52077
52132
  if (missing.length) {
52078
52133
  throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
52079
52134
  }
52080
- return path45;
52135
+ return path46;
52081
52136
  };
52082
52137
  }
52083
52138
  function tokensToFunction(tokens, delimiter, encode2) {
@@ -52133,9 +52188,9 @@ var require_dist2 = __commonJS({
52133
52188
  return [encodeValue(value)];
52134
52189
  };
52135
52190
  }
52136
- function match(path43, options = {}) {
52191
+ function match(path44, options = {}) {
52137
52192
  const { decode: decode2 = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
52138
- const { regexp, keys } = pathToRegexp(path43, options);
52193
+ const { regexp, keys } = pathToRegexp(path44, options);
52139
52194
  const decoders = keys.map((key) => {
52140
52195
  if (decode2 === false)
52141
52196
  return NOOP_VALUE;
@@ -52147,7 +52202,7 @@ var require_dist2 = __commonJS({
52147
52202
  const m = regexp.exec(input);
52148
52203
  if (!m)
52149
52204
  return false;
52150
- const path44 = m[0];
52205
+ const path45 = m[0];
52151
52206
  const params = /* @__PURE__ */ Object.create(null);
52152
52207
  for (let i = 1; i < m.length; i++) {
52153
52208
  if (m[i] === void 0)
@@ -52156,16 +52211,16 @@ var require_dist2 = __commonJS({
52156
52211
  const decoder = decoders[i - 1];
52157
52212
  params[key.name] = decoder(m[i]);
52158
52213
  }
52159
- return { path: path44, params };
52214
+ return { path: path45, params };
52160
52215
  };
52161
52216
  }
52162
- function pathToRegexp(path43, options = {}) {
52217
+ function pathToRegexp(path44, options = {}) {
52163
52218
  const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
52164
52219
  const keys = [];
52165
52220
  const flags = sensitive ? "" : "i";
52166
52221
  const sources = [];
52167
- for (const input of pathsToArray(path43, [])) {
52168
- const data = typeof input === "object" ? input : parse15(input, options);
52222
+ for (const input of pathsToArray(path44, [])) {
52223
+ const data = typeof input === "object" ? input : parse16(input, options);
52169
52224
  for (const tokens of flatten2(data.tokens, 0, [])) {
52170
52225
  sources.push(toRegExpSource(tokens, delimiter, keys, data.originalPath));
52171
52226
  }
@@ -52294,18 +52349,18 @@ var require_layer = __commonJS({
52294
52349
  var TRAILING_SLASH_REGEXP = /\/+$/;
52295
52350
  var MATCHING_GROUP_REGEXP = /\((?:\?<(.*?)>)?(?!\?)/g;
52296
52351
  module.exports = Layer;
52297
- function Layer(path43, options, fn) {
52352
+ function Layer(path44, options, fn) {
52298
52353
  if (!(this instanceof Layer)) {
52299
- return new Layer(path43, options, fn);
52354
+ return new Layer(path44, options, fn);
52300
52355
  }
52301
- debug("new %o", path43);
52356
+ debug("new %o", path44);
52302
52357
  const opts2 = options || {};
52303
52358
  this.handle = fn;
52304
52359
  this.keys = [];
52305
52360
  this.name = fn.name || "<anonymous>";
52306
52361
  this.params = void 0;
52307
52362
  this.path = void 0;
52308
- this.slash = path43 === "/" && opts2.end === false;
52363
+ this.slash = path44 === "/" && opts2.end === false;
52309
52364
  function matcher(_path) {
52310
52365
  if (_path instanceof RegExp) {
52311
52366
  const keys = [];
@@ -52344,7 +52399,7 @@ var require_layer = __commonJS({
52344
52399
  decode: decodeParam
52345
52400
  });
52346
52401
  }
52347
- this.matchers = Array.isArray(path43) ? path43.map(matcher) : [matcher(path43)];
52402
+ this.matchers = Array.isArray(path44) ? path44.map(matcher) : [matcher(path44)];
52348
52403
  }
52349
52404
  Layer.prototype.handleError = function handleError(error, req, res, next) {
52350
52405
  const fn = this.handle;
@@ -52384,9 +52439,9 @@ var require_layer = __commonJS({
52384
52439
  next(err);
52385
52440
  }
52386
52441
  };
52387
- Layer.prototype.match = function match(path43) {
52442
+ Layer.prototype.match = function match(path44) {
52388
52443
  let match2;
52389
- if (path43 != null) {
52444
+ if (path44 != null) {
52390
52445
  if (this.slash) {
52391
52446
  this.params = {};
52392
52447
  this.path = "";
@@ -52394,7 +52449,7 @@ var require_layer = __commonJS({
52394
52449
  }
52395
52450
  let i = 0;
52396
52451
  while (!match2 && i < this.matchers.length) {
52397
- match2 = this.matchers[i](path43);
52452
+ match2 = this.matchers[i](path44);
52398
52453
  i++;
52399
52454
  }
52400
52455
  }
@@ -52422,13 +52477,13 @@ var require_layer = __commonJS({
52422
52477
  throw err;
52423
52478
  }
52424
52479
  }
52425
- function loosen(path43) {
52426
- if (path43 instanceof RegExp || path43 === "/") {
52427
- return path43;
52480
+ function loosen(path44) {
52481
+ if (path44 instanceof RegExp || path44 === "/") {
52482
+ return path44;
52428
52483
  }
52429
- return Array.isArray(path43) ? path43.map(function(p) {
52484
+ return Array.isArray(path44) ? path44.map(function(p) {
52430
52485
  return loosen(p);
52431
- }) : String(path43).replace(TRAILING_SLASH_REGEXP, "");
52486
+ }) : String(path44).replace(TRAILING_SLASH_REGEXP, "");
52432
52487
  }
52433
52488
  }
52434
52489
  });
@@ -52444,9 +52499,9 @@ var require_route = __commonJS({
52444
52499
  var flatten2 = Array.prototype.flat;
52445
52500
  var methods = METHODS.map((method) => method.toLowerCase());
52446
52501
  module.exports = Route;
52447
- function Route(path43) {
52448
- debug("new %o", path43);
52449
- this.path = path43;
52502
+ function Route(path44) {
52503
+ debug("new %o", path44);
52504
+ this.path = path44;
52450
52505
  this.stack = [];
52451
52506
  this.methods = /* @__PURE__ */ Object.create(null);
52452
52507
  }
@@ -52654,8 +52709,8 @@ var require_router = __commonJS({
52654
52709
  if (++sync > 100) {
52655
52710
  return setImmediate(next, err);
52656
52711
  }
52657
- const path43 = getPathname(req);
52658
- if (path43 == null) {
52712
+ const path44 = getPathname(req);
52713
+ if (path44 == null) {
52659
52714
  return done(layerError);
52660
52715
  }
52661
52716
  let layer;
@@ -52663,7 +52718,7 @@ var require_router = __commonJS({
52663
52718
  let route;
52664
52719
  while (match !== true && idx < stack.length) {
52665
52720
  layer = stack[idx++];
52666
- match = matchLayer(layer, path43);
52721
+ match = matchLayer(layer, path44);
52667
52722
  route = layer.route;
52668
52723
  if (typeof match !== "boolean") {
52669
52724
  layerError = layerError || match;
@@ -52701,18 +52756,18 @@ var require_router = __commonJS({
52701
52756
  } else if (route) {
52702
52757
  layer.handleRequest(req, res, next);
52703
52758
  } else {
52704
- trimPrefix(layer, layerError, layerPath, path43);
52759
+ trimPrefix(layer, layerError, layerPath, path44);
52705
52760
  }
52706
52761
  sync = 0;
52707
52762
  });
52708
52763
  }
52709
- function trimPrefix(layer, layerError, layerPath, path43) {
52764
+ function trimPrefix(layer, layerError, layerPath, path44) {
52710
52765
  if (layerPath.length !== 0) {
52711
- if (layerPath !== path43.substring(0, layerPath.length)) {
52766
+ if (layerPath !== path44.substring(0, layerPath.length)) {
52712
52767
  next(layerError);
52713
52768
  return;
52714
52769
  }
52715
- const c = path43[layerPath.length];
52770
+ const c = path44[layerPath.length];
52716
52771
  if (c && c !== "/") {
52717
52772
  next(layerError);
52718
52773
  return;
@@ -52736,7 +52791,7 @@ var require_router = __commonJS({
52736
52791
  };
52737
52792
  Router.prototype.use = function use(handler) {
52738
52793
  let offset = 0;
52739
- let path43 = "/";
52794
+ let path44 = "/";
52740
52795
  if (typeof handler !== "function") {
52741
52796
  let arg = handler;
52742
52797
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -52744,7 +52799,7 @@ var require_router = __commonJS({
52744
52799
  }
52745
52800
  if (typeof arg !== "function") {
52746
52801
  offset = 1;
52747
- path43 = handler;
52802
+ path44 = handler;
52748
52803
  }
52749
52804
  }
52750
52805
  const callbacks = flatten2.call(slice.call(arguments, offset), Infinity);
@@ -52756,8 +52811,8 @@ var require_router = __commonJS({
52756
52811
  if (typeof fn !== "function") {
52757
52812
  throw new TypeError("argument handler must be a function");
52758
52813
  }
52759
- debug("use %o %s", path43, fn.name || "<anonymous>");
52760
- const layer = new Layer(path43, {
52814
+ debug("use %o %s", path44, fn.name || "<anonymous>");
52815
+ const layer = new Layer(path44, {
52761
52816
  sensitive: this.caseSensitive,
52762
52817
  strict: false,
52763
52818
  end: false
@@ -52767,9 +52822,9 @@ var require_router = __commonJS({
52767
52822
  }
52768
52823
  return this;
52769
52824
  };
52770
- Router.prototype.route = function route(path43) {
52771
- const route2 = new Route(path43);
52772
- const layer = new Layer(path43, {
52825
+ Router.prototype.route = function route(path44) {
52826
+ const route2 = new Route(path44);
52827
+ const layer = new Layer(path44, {
52773
52828
  sensitive: this.caseSensitive,
52774
52829
  strict: this.strict,
52775
52830
  end: true
@@ -52782,8 +52837,8 @@ var require_router = __commonJS({
52782
52837
  return route2;
52783
52838
  };
52784
52839
  methods.concat("all").forEach(function(method) {
52785
- Router.prototype[method] = function(path43) {
52786
- const route = this.route(path43);
52840
+ Router.prototype[method] = function(path44) {
52841
+ const route = this.route(path44);
52787
52842
  route[method].apply(route, slice.call(arguments, 1));
52788
52843
  return this;
52789
52844
  };
@@ -52812,9 +52867,9 @@ var require_router = __commonJS({
52812
52867
  const fqdnIndex = url.substring(0, pathLength).indexOf("://");
52813
52868
  return fqdnIndex !== -1 ? url.substring(0, url.indexOf("/", 3 + fqdnIndex)) : void 0;
52814
52869
  }
52815
- function matchLayer(layer, path43) {
52870
+ function matchLayer(layer, path44) {
52816
52871
  try {
52817
- return layer.match(path43);
52872
+ return layer.match(path44);
52818
52873
  } catch (err) {
52819
52874
  return err;
52820
52875
  }
@@ -53042,7 +53097,7 @@ var require_application = __commonJS({
53042
53097
  };
53043
53098
  app.use = function use(fn) {
53044
53099
  var offset = 0;
53045
- var path43 = "/";
53100
+ var path44 = "/";
53046
53101
  if (typeof fn !== "function") {
53047
53102
  var arg = fn;
53048
53103
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -53050,7 +53105,7 @@ var require_application = __commonJS({
53050
53105
  }
53051
53106
  if (typeof arg !== "function") {
53052
53107
  offset = 1;
53053
- path43 = fn;
53108
+ path44 = fn;
53054
53109
  }
53055
53110
  }
53056
53111
  var fns = flatten2.call(slice.call(arguments, offset), Infinity);
@@ -53060,12 +53115,12 @@ var require_application = __commonJS({
53060
53115
  var router = this.router;
53061
53116
  fns.forEach(function(fn2) {
53062
53117
  if (!fn2 || !fn2.handle || !fn2.set) {
53063
- return router.use(path43, fn2);
53118
+ return router.use(path44, fn2);
53064
53119
  }
53065
- debug(".use app under %s", path43);
53066
- fn2.mountpath = path43;
53120
+ debug(".use app under %s", path44);
53121
+ fn2.mountpath = path44;
53067
53122
  fn2.parent = this;
53068
- router.use(path43, function mounted_app(req, res, next) {
53123
+ router.use(path44, function mounted_app(req, res, next) {
53069
53124
  var orig = req.app;
53070
53125
  fn2.handle(req, res, function(err) {
53071
53126
  Object.setPrototypeOf(req, orig.request);
@@ -53077,8 +53132,8 @@ var require_application = __commonJS({
53077
53132
  }, this);
53078
53133
  return this;
53079
53134
  };
53080
- app.route = function route(path43) {
53081
- return this.router.route(path43);
53135
+ app.route = function route(path44) {
53136
+ return this.router.route(path44);
53082
53137
  };
53083
53138
  app.engine = function engine(ext, fn) {
53084
53139
  if (typeof fn !== "function") {
@@ -53121,7 +53176,7 @@ var require_application = __commonJS({
53121
53176
  }
53122
53177
  return this;
53123
53178
  };
53124
- app.path = function path43() {
53179
+ app.path = function path44() {
53125
53180
  return this.parent ? this.parent.path() + this.mountpath : "";
53126
53181
  };
53127
53182
  app.enabled = function enabled(setting) {
@@ -53137,17 +53192,17 @@ var require_application = __commonJS({
53137
53192
  return this.set(setting, false);
53138
53193
  };
53139
53194
  methods.forEach(function(method) {
53140
- app[method] = function(path43) {
53195
+ app[method] = function(path44) {
53141
53196
  if (method === "get" && arguments.length === 1) {
53142
- return this.set(path43);
53197
+ return this.set(path44);
53143
53198
  }
53144
- var route = this.route(path43);
53199
+ var route = this.route(path44);
53145
53200
  route[method].apply(route, slice.call(arguments, 1));
53146
53201
  return this;
53147
53202
  };
53148
53203
  });
53149
- app.all = function all(path43) {
53150
- var route = this.route(path43);
53204
+ app.all = function all(path44) {
53205
+ var route = this.route(path44);
53151
53206
  var args = slice.call(arguments, 1);
53152
53207
  for (var i = 0; i < methods.length; i++) {
53153
53208
  route[methods[i]].apply(route, args);
@@ -63181,11 +63236,11 @@ var require_mime_types3 = __commonJS({
63181
63236
  }
63182
63237
  return exts[0];
63183
63238
  }
63184
- function lookup(path43) {
63185
- if (!path43 || typeof path43 !== "string") {
63239
+ function lookup(path44) {
63240
+ if (!path44 || typeof path44 !== "string") {
63186
63241
  return false;
63187
63242
  }
63188
- var extension2 = extname2("x." + path43).toLowerCase().slice(1);
63243
+ var extension2 = extname2("x." + path44).toLowerCase().slice(1);
63189
63244
  if (!extension2) {
63190
63245
  return false;
63191
63246
  }
@@ -63474,7 +63529,7 @@ var require_request = __commonJS({
63474
63529
  var http = __require("node:http");
63475
63530
  var fresh = require_fresh();
63476
63531
  var parseRange = require_range_parser();
63477
- var parse15 = require_parseurl();
63532
+ var parse16 = require_parseurl();
63478
63533
  var proxyaddr = require_proxy_addr();
63479
63534
  var req = Object.create(http.IncomingMessage.prototype);
63480
63535
  module.exports = req;
@@ -63519,7 +63574,7 @@ var require_request = __commonJS({
63519
63574
  if (!queryparse) {
63520
63575
  return /* @__PURE__ */ Object.create(null);
63521
63576
  }
63522
- var querystring = parse15(this).query;
63577
+ var querystring = parse16(this).query;
63523
63578
  return queryparse(querystring);
63524
63579
  });
63525
63580
  req.is = function is(types) {
@@ -63562,8 +63617,8 @@ var require_request = __commonJS({
63562
63617
  var subdomains2 = !isIP(hostname) ? hostname.split(".").reverse() : [hostname];
63563
63618
  return subdomains2.slice(offset);
63564
63619
  });
63565
- defineGetter(req, "path", function path43() {
63566
- return parse15(this).pathname;
63620
+ defineGetter(req, "path", function path44() {
63621
+ return parse16(this).pathname;
63567
63622
  });
63568
63623
  defineGetter(req, "host", function host() {
63569
63624
  var trust = this.app.get("trust proxy fn");
@@ -63617,7 +63672,7 @@ var require_content_disposition = __commonJS({
63617
63672
  "../../node_modules/content-disposition/index.js"(exports, module) {
63618
63673
  "use strict";
63619
63674
  module.exports = contentDisposition;
63620
- module.exports.parse = parse15;
63675
+ module.exports.parse = parse16;
63621
63676
  var basename5 = __require("path").basename;
63622
63677
  var ENCODE_URL_ATTR_CHAR_REGEXP = /[\x00-\x20"'()*,/:;<=>?@[\\\]{}\x7f]/g;
63623
63678
  var HEX_ESCAPE_REGEXP = /%[0-9A-Fa-f]{2}/;
@@ -63708,7 +63763,7 @@ var require_content_disposition = __commonJS({
63708
63763
  function getlatin1(val) {
63709
63764
  return String(val).replace(NON_LATIN1_REGEXP, "?");
63710
63765
  }
63711
- function parse15(string) {
63766
+ function parse16(string) {
63712
63767
  if (!string || typeof string !== "string") {
63713
63768
  throw new TypeError("argument string is required");
63714
63769
  }
@@ -63797,7 +63852,7 @@ var require_cookie_signature = __commonJS({
63797
63852
  var require_cookie = __commonJS({
63798
63853
  "../../node_modules/cookie/index.js"(exports) {
63799
63854
  "use strict";
63800
- exports.parse = parse15;
63855
+ exports.parse = parse16;
63801
63856
  exports.serialize = serialize;
63802
63857
  var __toString = Object.prototype.toString;
63803
63858
  var __hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -63805,7 +63860,7 @@ var require_cookie = __commonJS({
63805
63860
  var cookieValueRegExp = /^("?)[\u0021\u0023-\u002B\u002D-\u003A\u003C-\u005B\u005D-\u007E]*\1$/;
63806
63861
  var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
63807
63862
  var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
63808
- function parse15(str2, opt) {
63863
+ function parse16(str2, opt) {
63809
63864
  if (typeof str2 !== "string") {
63810
63865
  throw new TypeError("argument str must be a string");
63811
63866
  }
@@ -73415,11 +73470,11 @@ var require_mime_types4 = __commonJS({
73415
73470
  }
73416
73471
  return exts[0];
73417
73472
  }
73418
- function lookup(path43) {
73419
- if (!path43 || typeof path43 !== "string") {
73473
+ function lookup(path44) {
73474
+ if (!path44 || typeof path44 !== "string") {
73420
73475
  return false;
73421
73476
  }
73422
- var extension2 = extname2("x." + path43).toLowerCase().slice(1);
73477
+ var extension2 = extname2("x." + path44).toLowerCase().slice(1);
73423
73478
  if (!extension2) {
73424
73479
  return false;
73425
73480
  }
@@ -73474,32 +73529,32 @@ var require_send = __commonJS({
73474
73529
  var escapeHtml = require_escape_html();
73475
73530
  var etag = require_etag();
73476
73531
  var fresh = require_fresh();
73477
- var fs26 = __require("fs");
73532
+ var fs27 = __require("fs");
73478
73533
  var mime = require_mime_types4();
73479
73534
  var ms = require_ms();
73480
73535
  var onFinished = require_on_finished();
73481
73536
  var parseRange = require_range_parser();
73482
- var path43 = __require("path");
73537
+ var path44 = __require("path");
73483
73538
  var statuses = require_statuses();
73484
73539
  var Stream = __require("stream");
73485
73540
  var util = __require("util");
73486
- var extname2 = path43.extname;
73487
- var join39 = path43.join;
73488
- var normalize = path43.normalize;
73489
- var resolve6 = path43.resolve;
73490
- var sep = path43.sep;
73541
+ var extname2 = path44.extname;
73542
+ var join40 = path44.join;
73543
+ var normalize = path44.normalize;
73544
+ var resolve6 = path44.resolve;
73545
+ var sep = path44.sep;
73491
73546
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
73492
73547
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
73493
73548
  var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
73494
73549
  module.exports = send;
73495
- function send(req, path44, options) {
73496
- return new SendStream(req, path44, options);
73550
+ function send(req, path45, options) {
73551
+ return new SendStream(req, path45, options);
73497
73552
  }
73498
- function SendStream(req, path44, options) {
73553
+ function SendStream(req, path45, options) {
73499
73554
  Stream.call(this);
73500
73555
  var opts2 = options || {};
73501
73556
  this.options = opts2;
73502
- this.path = path44;
73557
+ this.path = path45;
73503
73558
  this.req = req;
73504
73559
  this._acceptRanges = opts2.acceptRanges !== void 0 ? Boolean(opts2.acceptRanges) : true;
73505
73560
  this._cacheControl = opts2.cacheControl !== void 0 ? Boolean(opts2.cacheControl) : true;
@@ -73613,10 +73668,10 @@ var require_send = __commonJS({
73613
73668
  var lastModified = this.res.getHeader("Last-Modified");
73614
73669
  return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
73615
73670
  };
73616
- SendStream.prototype.redirect = function redirect(path44) {
73671
+ SendStream.prototype.redirect = function redirect(path45) {
73617
73672
  var res = this.res;
73618
73673
  if (hasListeners(this, "directory")) {
73619
- this.emit("directory", res, path44);
73674
+ this.emit("directory", res, path45);
73620
73675
  return;
73621
73676
  }
73622
73677
  if (this.hasTrailingSlash()) {
@@ -73636,38 +73691,38 @@ var require_send = __commonJS({
73636
73691
  SendStream.prototype.pipe = function pipe(res) {
73637
73692
  var root = this._root;
73638
73693
  this.res = res;
73639
- var path44 = decode2(this.path);
73640
- if (path44 === -1) {
73694
+ var path45 = decode2(this.path);
73695
+ if (path45 === -1) {
73641
73696
  this.error(400);
73642
73697
  return res;
73643
73698
  }
73644
- if (~path44.indexOf("\0")) {
73699
+ if (~path45.indexOf("\0")) {
73645
73700
  this.error(400);
73646
73701
  return res;
73647
73702
  }
73648
73703
  var parts;
73649
73704
  if (root !== null) {
73650
- if (path44) {
73651
- path44 = normalize("." + sep + path44);
73705
+ if (path45) {
73706
+ path45 = normalize("." + sep + path45);
73652
73707
  }
73653
- if (UP_PATH_REGEXP.test(path44)) {
73654
- debug('malicious path "%s"', path44);
73708
+ if (UP_PATH_REGEXP.test(path45)) {
73709
+ debug('malicious path "%s"', path45);
73655
73710
  this.error(403);
73656
73711
  return res;
73657
73712
  }
73658
- parts = path44.split(sep);
73659
- path44 = normalize(join39(root, path44));
73713
+ parts = path45.split(sep);
73714
+ path45 = normalize(join40(root, path45));
73660
73715
  } else {
73661
- if (UP_PATH_REGEXP.test(path44)) {
73662
- debug('malicious path "%s"', path44);
73716
+ if (UP_PATH_REGEXP.test(path45)) {
73717
+ debug('malicious path "%s"', path45);
73663
73718
  this.error(403);
73664
73719
  return res;
73665
73720
  }
73666
- parts = normalize(path44).split(sep);
73667
- path44 = resolve6(path44);
73721
+ parts = normalize(path45).split(sep);
73722
+ path45 = resolve6(path45);
73668
73723
  }
73669
73724
  if (containsDotFile(parts)) {
73670
- debug('%s dotfile "%s"', this._dotfiles, path44);
73725
+ debug('%s dotfile "%s"', this._dotfiles, path45);
73671
73726
  switch (this._dotfiles) {
73672
73727
  case "allow":
73673
73728
  break;
@@ -73681,13 +73736,13 @@ var require_send = __commonJS({
73681
73736
  }
73682
73737
  }
73683
73738
  if (this._index.length && this.hasTrailingSlash()) {
73684
- this.sendIndex(path44);
73739
+ this.sendIndex(path45);
73685
73740
  return res;
73686
73741
  }
73687
- this.sendFile(path44);
73742
+ this.sendFile(path45);
73688
73743
  return res;
73689
73744
  };
73690
- SendStream.prototype.send = function send2(path44, stat) {
73745
+ SendStream.prototype.send = function send2(path45, stat) {
73691
73746
  var len = stat.size;
73692
73747
  var options = this.options;
73693
73748
  var opts2 = {};
@@ -73699,9 +73754,9 @@ var require_send = __commonJS({
73699
73754
  this.headersAlreadySent();
73700
73755
  return;
73701
73756
  }
73702
- debug('pipe "%s"', path44);
73703
- this.setHeader(path44, stat);
73704
- this.type(path44);
73757
+ debug('pipe "%s"', path45);
73758
+ this.setHeader(path45, stat);
73759
+ this.type(path45);
73705
73760
  if (this.isConditionalGET()) {
73706
73761
  if (this.isPreconditionFailure()) {
73707
73762
  this.error(412);
@@ -73750,30 +73805,30 @@ var require_send = __commonJS({
73750
73805
  res.end();
73751
73806
  return;
73752
73807
  }
73753
- this.stream(path44, opts2);
73808
+ this.stream(path45, opts2);
73754
73809
  };
73755
- SendStream.prototype.sendFile = function sendFile(path44) {
73810
+ SendStream.prototype.sendFile = function sendFile(path45) {
73756
73811
  var i = 0;
73757
73812
  var self = this;
73758
- debug('stat "%s"', path44);
73759
- fs26.stat(path44, function onstat(err, stat) {
73760
- var pathEndsWithSep = path44[path44.length - 1] === sep;
73761
- if (err && err.code === "ENOENT" && !extname2(path44) && !pathEndsWithSep) {
73813
+ debug('stat "%s"', path45);
73814
+ fs27.stat(path45, function onstat(err, stat) {
73815
+ var pathEndsWithSep = path45[path45.length - 1] === sep;
73816
+ if (err && err.code === "ENOENT" && !extname2(path45) && !pathEndsWithSep) {
73762
73817
  return next(err);
73763
73818
  }
73764
73819
  if (err) return self.onStatError(err);
73765
- if (stat.isDirectory()) return self.redirect(path44);
73820
+ if (stat.isDirectory()) return self.redirect(path45);
73766
73821
  if (pathEndsWithSep) return self.error(404);
73767
- self.emit("file", path44, stat);
73768
- self.send(path44, stat);
73822
+ self.emit("file", path45, stat);
73823
+ self.send(path45, stat);
73769
73824
  });
73770
73825
  function next(err) {
73771
73826
  if (self._extensions.length <= i) {
73772
73827
  return err ? self.onStatError(err) : self.error(404);
73773
73828
  }
73774
- var p = path44 + "." + self._extensions[i++];
73829
+ var p = path45 + "." + self._extensions[i++];
73775
73830
  debug('stat "%s"', p);
73776
- fs26.stat(p, function(err2, stat) {
73831
+ fs27.stat(p, function(err2, stat) {
73777
73832
  if (err2) return next(err2);
73778
73833
  if (stat.isDirectory()) return next();
73779
73834
  self.emit("file", p, stat);
@@ -73781,7 +73836,7 @@ var require_send = __commonJS({
73781
73836
  });
73782
73837
  }
73783
73838
  };
73784
- SendStream.prototype.sendIndex = function sendIndex(path44) {
73839
+ SendStream.prototype.sendIndex = function sendIndex(path45) {
73785
73840
  var i = -1;
73786
73841
  var self = this;
73787
73842
  function next(err) {
@@ -73789,9 +73844,9 @@ var require_send = __commonJS({
73789
73844
  if (err) return self.onStatError(err);
73790
73845
  return self.error(404);
73791
73846
  }
73792
- var p = join39(path44, self._index[i]);
73847
+ var p = join40(path45, self._index[i]);
73793
73848
  debug('stat "%s"', p);
73794
- fs26.stat(p, function(err2, stat) {
73849
+ fs27.stat(p, function(err2, stat) {
73795
73850
  if (err2) return next(err2);
73796
73851
  if (stat.isDirectory()) return next();
73797
73852
  self.emit("file", p, stat);
@@ -73800,10 +73855,10 @@ var require_send = __commonJS({
73800
73855
  }
73801
73856
  next();
73802
73857
  };
73803
- SendStream.prototype.stream = function stream2(path44, options) {
73858
+ SendStream.prototype.stream = function stream2(path45, options) {
73804
73859
  var self = this;
73805
73860
  var res = this.res;
73806
- var stream3 = fs26.createReadStream(path44, options);
73861
+ var stream3 = fs27.createReadStream(path45, options);
73807
73862
  this.emit("stream", stream3);
73808
73863
  stream3.pipe(res);
73809
73864
  function cleanup() {
@@ -73818,17 +73873,17 @@ var require_send = __commonJS({
73818
73873
  self.emit("end");
73819
73874
  });
73820
73875
  };
73821
- SendStream.prototype.type = function type(path44) {
73876
+ SendStream.prototype.type = function type(path45) {
73822
73877
  var res = this.res;
73823
73878
  if (res.getHeader("Content-Type")) return;
73824
- var ext = extname2(path44);
73879
+ var ext = extname2(path45);
73825
73880
  var type2 = mime.contentType(ext) || "application/octet-stream";
73826
73881
  debug("content-type %s", type2);
73827
73882
  res.setHeader("Content-Type", type2);
73828
73883
  };
73829
- SendStream.prototype.setHeader = function setHeader(path44, stat) {
73884
+ SendStream.prototype.setHeader = function setHeader(path45, stat) {
73830
73885
  var res = this.res;
73831
- this.emit("headers", res, path44, stat);
73886
+ this.emit("headers", res, path45, stat);
73832
73887
  if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
73833
73888
  debug("accept ranges");
73834
73889
  res.setHeader("Accept-Ranges", "bytes");
@@ -73886,9 +73941,9 @@ var require_send = __commonJS({
73886
73941
  }
73887
73942
  return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
73888
73943
  }
73889
- function decode2(path44) {
73944
+ function decode2(path45) {
73890
73945
  try {
73891
- return decodeURIComponent(path44);
73946
+ return decodeURIComponent(path45);
73892
73947
  } catch (err) {
73893
73948
  return -1;
73894
73949
  }
@@ -73961,7 +74016,7 @@ var require_vary = __commonJS({
73961
74016
  if (!field) {
73962
74017
  throw new TypeError("field argument is required");
73963
74018
  }
73964
- var fields = !Array.isArray(field) ? parse15(String(field)) : field;
74019
+ var fields = !Array.isArray(field) ? parse16(String(field)) : field;
73965
74020
  for (var j = 0; j < fields.length; j++) {
73966
74021
  if (!FIELD_NAME_REGEXP.test(fields[j])) {
73967
74022
  throw new TypeError("field argument contains an invalid header name");
@@ -73971,7 +74026,7 @@ var require_vary = __commonJS({
73971
74026
  return header;
73972
74027
  }
73973
74028
  var val = header;
73974
- var vals = parse15(header.toLowerCase());
74029
+ var vals = parse16(header.toLowerCase());
73975
74030
  if (fields.indexOf("*") !== -1 || vals.indexOf("*") !== -1) {
73976
74031
  return "*";
73977
74032
  }
@@ -73984,7 +74039,7 @@ var require_vary = __commonJS({
73984
74039
  }
73985
74040
  return val;
73986
74041
  }
73987
- function parse15(header) {
74042
+ function parse16(header) {
73988
74043
  var end = 0;
73989
74044
  var list = [];
73990
74045
  var start = 0;
@@ -74032,7 +74087,7 @@ var require_response = __commonJS({
74032
74087
  var http = __require("node:http");
74033
74088
  var onFinished = require_on_finished();
74034
74089
  var mime = require_mime_types2();
74035
- var path43 = __require("node:path");
74090
+ var path44 = __require("node:path");
74036
74091
  var pathIsAbsolute = __require("node:path").isAbsolute;
74037
74092
  var statuses = require_statuses();
74038
74093
  var sign = require_cookie_signature().sign;
@@ -74041,8 +74096,8 @@ var require_response = __commonJS({
74041
74096
  var setCharset = require_utils3().setCharset;
74042
74097
  var cookie = require_cookie();
74043
74098
  var send = require_send();
74044
- var extname2 = path43.extname;
74045
- var resolve6 = path43.resolve;
74099
+ var extname2 = path44.extname;
74100
+ var resolve6 = path44.resolve;
74046
74101
  var vary = require_vary();
74047
74102
  var { Buffer: Buffer2 } = __require("node:buffer");
74048
74103
  var res = Object.create(http.ServerResponse.prototype);
@@ -74188,26 +74243,26 @@ var require_response = __commonJS({
74188
74243
  this.type("txt");
74189
74244
  return this.send(body);
74190
74245
  };
74191
- res.sendFile = function sendFile(path44, options, callback) {
74246
+ res.sendFile = function sendFile(path45, options, callback) {
74192
74247
  var done = callback;
74193
74248
  var req = this.req;
74194
74249
  var res2 = this;
74195
74250
  var next = req.next;
74196
74251
  var opts2 = options || {};
74197
- if (!path44) {
74252
+ if (!path45) {
74198
74253
  throw new TypeError("path argument is required to res.sendFile");
74199
74254
  }
74200
- if (typeof path44 !== "string") {
74255
+ if (typeof path45 !== "string") {
74201
74256
  throw new TypeError("path must be a string to res.sendFile");
74202
74257
  }
74203
74258
  if (typeof options === "function") {
74204
74259
  done = options;
74205
74260
  opts2 = {};
74206
74261
  }
74207
- if (!opts2.root && !pathIsAbsolute(path44)) {
74262
+ if (!opts2.root && !pathIsAbsolute(path45)) {
74208
74263
  throw new TypeError("path must be absolute or specify root to res.sendFile");
74209
74264
  }
74210
- var pathname = encodeURI(path44);
74265
+ var pathname = encodeURI(path45);
74211
74266
  opts2.etag = this.app.enabled("etag");
74212
74267
  var file = send(req, pathname, opts2);
74213
74268
  sendfile(res2, file, opts2, function(err) {
@@ -74218,7 +74273,7 @@ var require_response = __commonJS({
74218
74273
  }
74219
74274
  });
74220
74275
  };
74221
- res.download = function download(path44, filename, options, callback) {
74276
+ res.download = function download(path45, filename, options, callback) {
74222
74277
  var done = callback;
74223
74278
  var name = filename;
74224
74279
  var opts2 = options || null;
@@ -74235,7 +74290,7 @@ var require_response = __commonJS({
74235
74290
  opts2 = filename;
74236
74291
  }
74237
74292
  var headers = {
74238
- "Content-Disposition": contentDisposition(name || path44)
74293
+ "Content-Disposition": contentDisposition(name || path45)
74239
74294
  };
74240
74295
  if (opts2 && opts2.headers) {
74241
74296
  var keys = Object.keys(opts2.headers);
@@ -74248,7 +74303,7 @@ var require_response = __commonJS({
74248
74303
  }
74249
74304
  opts2 = Object.create(opts2);
74250
74305
  opts2.headers = headers;
74251
- var fullPath = !opts2.root ? resolve6(path44) : path44;
74306
+ var fullPath = !opts2.root ? resolve6(path45) : path45;
74252
74307
  return this.sendFile(fullPath, opts2, done);
74253
74308
  };
74254
74309
  res.contentType = res.type = function contentType(type) {
@@ -74531,11 +74586,11 @@ var require_serve_static = __commonJS({
74531
74586
  }
74532
74587
  var forwardError = !fallthrough;
74533
74588
  var originalUrl = parseUrl.original(req);
74534
- var path43 = parseUrl(req).pathname;
74535
- if (path43 === "/" && originalUrl.pathname.substr(-1) !== "/") {
74536
- path43 = "";
74589
+ var path44 = parseUrl(req).pathname;
74590
+ if (path44 === "/" && originalUrl.pathname.substr(-1) !== "/") {
74591
+ path44 = "";
74537
74592
  }
74538
- var stream2 = send(req, path43, opts2);
74593
+ var stream2 = send(req, path44, opts2);
74539
74594
  stream2.on("directory", onDirectory);
74540
74595
  if (setHeaders) {
74541
74596
  stream2.on("headers", setHeaders);
@@ -75488,7 +75543,7 @@ var require_api = __commonJS({
75488
75543
  })();
75489
75544
  Object.defineProperty(exports, "__esModule", { value: true });
75490
75545
  exports.createApiRouter = createApiRouter;
75491
- var path43 = __importStar(__require("path"));
75546
+ var path44 = __importStar(__require("path"));
75492
75547
  var os3 = __importStar(__require("os"));
75493
75548
  var child_process_1 = __require("child_process");
75494
75549
  var express_1 = require_express2();
@@ -75506,11 +75561,11 @@ var require_api = __commonJS({
75506
75561
  return deps2.runner.run(cmd, args, {
75507
75562
  ...opts2,
75508
75563
  cwd: opts2?.cwd ?? deps2.repoRoot,
75509
- env: { SOPS_CONFIG: path43.join(deps2.repoRoot, ".sops.yaml"), ...opts2?.env }
75564
+ env: { SOPS_CONFIG: path44.join(deps2.repoRoot, ".sops.yaml"), ...opts2?.env }
75510
75565
  });
75511
75566
  }
75512
- const fifoDir = (0, child_process_1.execFileSync)("mktemp", ["-d", path43.join(os3.tmpdir(), "clef-fifo-XXXXXX")]).toString().trim();
75513
- const fifoPath = path43.join(fifoDir, "input");
75567
+ const fifoDir = (0, child_process_1.execFileSync)("mktemp", ["-d", path44.join(os3.tmpdir(), "clef-fifo-XXXXXX")]).toString().trim();
75568
+ const fifoPath = path44.join(fifoDir, "input");
75514
75569
  (0, child_process_1.execFileSync)("mkfifo", [fifoPath]);
75515
75570
  const writer = (0, child_process_1.spawn)("dd", [`of=${fifoPath}`, "status=none"], {
75516
75571
  stdio: ["pipe", "ignore", "ignore"]
@@ -75523,7 +75578,7 @@ var require_api = __commonJS({
75523
75578
  return deps2.runner.run(cmd, patchedArgs, {
75524
75579
  ...restOpts,
75525
75580
  cwd: restOpts?.cwd ?? deps2.repoRoot,
75526
- env: { SOPS_CONFIG: path43.join(deps2.repoRoot, ".sops.yaml"), ...restOpts?.env }
75581
+ env: { SOPS_CONFIG: path44.join(deps2.repoRoot, ".sops.yaml"), ...restOpts?.env }
75527
75582
  }).finally(() => {
75528
75583
  try {
75529
75584
  writer.kill();
@@ -75669,7 +75724,7 @@ var require_api = __commonJS({
75669
75724
  const nsDef = manifest.namespaces.find((n) => n.name === ns);
75670
75725
  if (nsDef?.schema) {
75671
75726
  try {
75672
- const schema = schemaValidator.loadSchema(path43.join(deps2.repoRoot, nsDef.schema));
75727
+ const schema = schemaValidator.loadSchema(path44.join(deps2.repoRoot, nsDef.schema));
75673
75728
  const result = schemaValidator.validate({ [key]: String(value) }, schema);
75674
75729
  const violations = [...result.errors, ...result.warnings];
75675
75730
  if (violations.length > 0) {
@@ -75933,8 +75988,8 @@ var require_api = __commonJS({
75933
75988
  res.status(400).json({ error: "Request body must include a 'file' string.", code: "BAD_REQUEST" });
75934
75989
  return;
75935
75990
  }
75936
- const resolved = path43.resolve(deps2.repoRoot, file);
75937
- if (!resolved.startsWith(deps2.repoRoot + path43.sep) && resolved !== deps2.repoRoot) {
75991
+ const resolved = path44.resolve(deps2.repoRoot, file);
75992
+ if (!resolved.startsWith(deps2.repoRoot + path44.sep) && resolved !== deps2.repoRoot) {
75938
75993
  res.status(400).json({
75939
75994
  error: "File path must be within the repository.",
75940
75995
  code: "BAD_REQUEST"
@@ -76176,7 +76231,7 @@ var require_server = __commonJS({
76176
76231
  };
76177
76232
  Object.defineProperty(exports, "__esModule", { value: true });
76178
76233
  exports.startServer = startServer;
76179
- var path43 = __importStar(__require("path"));
76234
+ var path44 = __importStar(__require("path"));
76180
76235
  var path_1 = __require("path");
76181
76236
  var crypto_1 = __require("crypto");
76182
76237
  var express_1 = __importDefault(require_express2());
@@ -76272,10 +76327,10 @@ var require_server = __commonJS({
76272
76327
  mountSeaStaticRoutes(app, sea, staticLimiter);
76273
76328
  }
76274
76329
  if (!isSeaBinary) {
76275
- const resolvedClientDir = clientDir ?? path43.resolve(__dirname, "../client");
76330
+ const resolvedClientDir = clientDir ?? path44.resolve(__dirname, "../client");
76276
76331
  app.use(staticLimiter, express_1.default.static(resolvedClientDir));
76277
76332
  app.get("/{*splat}", staticLimiter, (_req, res) => {
76278
- res.sendFile(path43.join(resolvedClientDir, "index.html"));
76333
+ res.sendFile(path44.join(resolvedClientDir, "index.html"));
76279
76334
  });
76280
76335
  }
76281
76336
  const url = `http://127.0.0.1:${port}`;
@@ -76417,32 +76472,32 @@ var require_disk_cache = __commonJS({
76417
76472
  })();
76418
76473
  Object.defineProperty(exports, "__esModule", { value: true });
76419
76474
  exports.DiskCache = void 0;
76420
- var fs26 = __importStar(__require("fs"));
76421
- var path43 = __importStar(__require("path"));
76475
+ var fs27 = __importStar(__require("fs"));
76476
+ var path44 = __importStar(__require("path"));
76422
76477
  var DiskCache = class {
76423
76478
  artifactPath;
76424
76479
  metaPath;
76425
76480
  constructor(cachePath, identity, environment) {
76426
- const dir = path43.join(cachePath, identity);
76427
- this.artifactPath = path43.join(dir, `${environment}.age.json`);
76428
- this.metaPath = path43.join(dir, `${environment}.meta`);
76481
+ const dir = path44.join(cachePath, identity);
76482
+ this.artifactPath = path44.join(dir, `${environment}.age.json`);
76483
+ this.metaPath = path44.join(dir, `${environment}.meta`);
76429
76484
  }
76430
76485
  /** Write an artifact and optional metadata to disk (atomic via tmp+rename). */
76431
76486
  write(raw, sha) {
76432
- const dir = path43.dirname(this.artifactPath);
76433
- fs26.mkdirSync(dir, { recursive: true });
76487
+ const dir = path44.dirname(this.artifactPath);
76488
+ fs27.mkdirSync(dir, { recursive: true });
76434
76489
  const tmpArtifact = `${this.artifactPath}.tmp.${process.pid}`;
76435
- fs26.writeFileSync(tmpArtifact, raw, "utf-8");
76436
- fs26.renameSync(tmpArtifact, this.artifactPath);
76490
+ fs27.writeFileSync(tmpArtifact, raw, "utf-8");
76491
+ fs27.renameSync(tmpArtifact, this.artifactPath);
76437
76492
  const meta = { sha, fetchedAt: (/* @__PURE__ */ new Date()).toISOString() };
76438
76493
  const tmpMeta = `${this.metaPath}.tmp.${process.pid}`;
76439
- fs26.writeFileSync(tmpMeta, JSON.stringify(meta), "utf-8");
76440
- fs26.renameSync(tmpMeta, this.metaPath);
76494
+ fs27.writeFileSync(tmpMeta, JSON.stringify(meta), "utf-8");
76495
+ fs27.renameSync(tmpMeta, this.metaPath);
76441
76496
  }
76442
76497
  /** Read the cached artifact. Returns null if no cache file exists. */
76443
76498
  read() {
76444
76499
  try {
76445
- return fs26.readFileSync(this.artifactPath, "utf-8");
76500
+ return fs27.readFileSync(this.artifactPath, "utf-8");
76446
76501
  } catch {
76447
76502
  return null;
76448
76503
  }
@@ -76450,7 +76505,7 @@ var require_disk_cache = __commonJS({
76450
76505
  /** Get the SHA from the cached metadata, if available. */
76451
76506
  getCachedSha() {
76452
76507
  try {
76453
- const raw = fs26.readFileSync(this.metaPath, "utf-8");
76508
+ const raw = fs27.readFileSync(this.metaPath, "utf-8");
76454
76509
  const meta = JSON.parse(raw);
76455
76510
  return meta.sha;
76456
76511
  } catch {
@@ -76460,7 +76515,7 @@ var require_disk_cache = __commonJS({
76460
76515
  /** Get the fetchedAt timestamp from metadata, if available. */
76461
76516
  getFetchedAt() {
76462
76517
  try {
76463
- const raw = fs26.readFileSync(this.metaPath, "utf-8");
76518
+ const raw = fs27.readFileSync(this.metaPath, "utf-8");
76464
76519
  const meta = JSON.parse(raw);
76465
76520
  return meta.fetchedAt;
76466
76521
  } catch {
@@ -76470,11 +76525,11 @@ var require_disk_cache = __commonJS({
76470
76525
  /** Remove cached artifact and metadata files. */
76471
76526
  purge() {
76472
76527
  try {
76473
- fs26.unlinkSync(this.artifactPath);
76528
+ fs27.unlinkSync(this.artifactPath);
76474
76529
  } catch {
76475
76530
  }
76476
76531
  try {
76477
- fs26.unlinkSync(this.metaPath);
76532
+ fs27.unlinkSync(this.metaPath);
76478
76533
  } catch {
76479
76534
  }
76480
76535
  }
@@ -76526,7 +76581,7 @@ var require_decrypt = __commonJS({
76526
76581
  })();
76527
76582
  Object.defineProperty(exports, "__esModule", { value: true });
76528
76583
  exports.AgeDecryptor = void 0;
76529
- var fs26 = __importStar(__require("fs"));
76584
+ var fs27 = __importStar(__require("fs"));
76530
76585
  var AgeDecryptor = class {
76531
76586
  /**
76532
76587
  * Decrypt an age-encrypted PEM-armored ciphertext string.
@@ -76539,9 +76594,7 @@ var require_decrypt = __commonJS({
76539
76594
  const { Decrypter: Decrypter2 } = await Promise.resolve(`${"age-encryption"}`).then((s) => __importStar(__require(s)));
76540
76595
  const d = new Decrypter2();
76541
76596
  d.addIdentity(privateKey);
76542
- const isAgePem = ciphertext.startsWith("age-encryption.org/v1\n");
76543
- const input = isAgePem ? ciphertext : Buffer.from(ciphertext, "base64");
76544
- return d.decrypt(input, "text");
76597
+ return d.decrypt(Buffer.from(ciphertext, "base64"), "text");
76545
76598
  }
76546
76599
  /**
76547
76600
  * Resolve the age private key from either an inline value or a file path.
@@ -76554,7 +76607,7 @@ var require_decrypt = __commonJS({
76554
76607
  if (ageKey)
76555
76608
  return ageKey.trim();
76556
76609
  if (ageKeyFile) {
76557
- const content = fs26.readFileSync(ageKeyFile, "utf-8").trim();
76610
+ const content = fs27.readFileSync(ageKeyFile, "utf-8").trim();
76558
76611
  const lines = content.split("\n").filter((l) => l.startsWith("AGE-SECRET-KEY-"));
76559
76612
  if (lines.length === 0) {
76560
76613
  throw new Error(`No age secret key found in file: ${ageKeyFile}`);
@@ -77364,8 +77417,8 @@ var require_github = __commonJS({
77364
77417
  this.ref = config.ref;
77365
77418
  this.apiUrl = config.apiUrl ?? "https://api.github.com";
77366
77419
  }
77367
- async fetchFile(path43) {
77368
- const url = new URL(`/repos/${this.repo}/contents/${path43}`, this.apiUrl);
77420
+ async fetchFile(path44) {
77421
+ const url = new URL(`/repos/${this.repo}/contents/${path44}`, this.apiUrl);
77369
77422
  if (this.ref)
77370
77423
  url.searchParams.set("ref", this.ref);
77371
77424
  const res = await fetch(url.toString(), {
@@ -77375,7 +77428,7 @@ var require_github = __commonJS({
77375
77428
  }
77376
77429
  });
77377
77430
  if (!res.ok) {
77378
- throw new Error(`GitHub API error: ${res.status} fetching ${path43} from ${this.repo}`);
77431
+ throw new Error(`GitHub API error: ${res.status} fetching ${path44} from ${this.repo}`);
77379
77432
  }
77380
77433
  const data = await res.json();
77381
77434
  const content = Buffer.from(data.content, "base64").toString("utf-8");
@@ -77403,9 +77456,9 @@ var require_gitlab = __commonJS({
77403
77456
  this.ref = config.ref;
77404
77457
  this.apiUrl = config.apiUrl ?? "https://gitlab.com";
77405
77458
  }
77406
- async fetchFile(path43) {
77459
+ async fetchFile(path44) {
77407
77460
  const encodedRepo = encodeURIComponent(this.repo);
77408
- const encodedPath = encodeURIComponent(path43);
77461
+ const encodedPath = encodeURIComponent(path44);
77409
77462
  const url = new URL(`/api/v4/projects/${encodedRepo}/repository/files/${encodedPath}`, this.apiUrl);
77410
77463
  if (this.ref)
77411
77464
  url.searchParams.set("ref", this.ref);
@@ -77415,7 +77468,7 @@ var require_gitlab = __commonJS({
77415
77468
  }
77416
77469
  });
77417
77470
  if (!res.ok) {
77418
- throw new Error(`GitLab API error: ${res.status} fetching ${path43} from ${this.repo}`);
77471
+ throw new Error(`GitLab API error: ${res.status} fetching ${path44} from ${this.repo}`);
77419
77472
  }
77420
77473
  const data = await res.json();
77421
77474
  const content = Buffer.from(data.content, "base64").toString("utf-8");
@@ -77443,8 +77496,8 @@ var require_bitbucket = __commonJS({
77443
77496
  this.ref = config.ref ?? "main";
77444
77497
  this.apiUrl = config.apiUrl ?? "https://api.bitbucket.org";
77445
77498
  }
77446
- async fetchFile(path43) {
77447
- const baseUrl = `${this.apiUrl}/2.0/repositories/${this.repo}/src/${this.ref}/${path43}`;
77499
+ async fetchFile(path44) {
77500
+ const baseUrl = `${this.apiUrl}/2.0/repositories/${this.repo}/src/${this.ref}/${path44}`;
77448
77501
  const metaRes = await fetch(baseUrl, {
77449
77502
  headers: {
77450
77503
  Authorization: `Bearer ${this.token}`,
@@ -77452,7 +77505,7 @@ var require_bitbucket = __commonJS({
77452
77505
  }
77453
77506
  });
77454
77507
  if (!metaRes.ok) {
77455
- throw new Error(`Bitbucket API error: ${metaRes.status} fetching ${path43} from ${this.repo}`);
77508
+ throw new Error(`Bitbucket API error: ${metaRes.status} fetching ${path44} from ${this.repo}`);
77456
77509
  }
77457
77510
  const meta = await metaRes.json();
77458
77511
  const rawRes = await fetch(baseUrl, {
@@ -77461,7 +77514,7 @@ var require_bitbucket = __commonJS({
77461
77514
  }
77462
77515
  });
77463
77516
  if (!rawRes.ok) {
77464
- throw new Error(`Bitbucket API error: ${rawRes.status} fetching raw content of ${path43} from ${this.repo}`);
77517
+ throw new Error(`Bitbucket API error: ${rawRes.status} fetching raw content of ${path44} from ${this.repo}`);
77465
77518
  }
77466
77519
  const content = await rawRes.text();
77467
77520
  return { content, sha: meta.commit.hash };
@@ -77579,14 +77632,14 @@ var require_file = __commonJS({
77579
77632
  })();
77580
77633
  Object.defineProperty(exports, "__esModule", { value: true });
77581
77634
  exports.FileArtifactSource = void 0;
77582
- var fs26 = __importStar(__require("fs"));
77635
+ var fs27 = __importStar(__require("fs"));
77583
77636
  var FileArtifactSource = class {
77584
77637
  path;
77585
77638
  constructor(filePath) {
77586
77639
  this.path = filePath;
77587
77640
  }
77588
77641
  async fetch() {
77589
- const raw = fs26.readFileSync(this.path, "utf-8");
77642
+ const raw = fs27.readFileSync(this.path, "utf-8");
77590
77643
  return { raw };
77591
77644
  }
77592
77645
  describe() {
@@ -77853,7 +77906,7 @@ var NodeSubprocessRunner = class {
77853
77906
  };
77854
77907
 
77855
77908
  // src/commands/init.ts
77856
- var YAML11 = __toESM(require_dist());
77909
+ var YAML12 = __toESM(require_dist());
77857
77910
  init_src();
77858
77911
  import * as fs17 from "fs";
77859
77912
  import * as path19 from "path";
@@ -78203,11 +78256,15 @@ async function setDarwin(runner2, privateKey, account) {
78203
78256
  await runner2.run("security", ["delete-generic-password", "-a", account, "-s", SERVICE]).catch(() => {
78204
78257
  });
78205
78258
  try {
78206
- const result = await runner2.run(
78207
- "security",
78208
- ["add-generic-password", "-a", account, "-s", SERVICE, "-w"],
78209
- { stdin: privateKey }
78210
- );
78259
+ const result = await runner2.run("security", [
78260
+ "add-generic-password",
78261
+ "-a",
78262
+ account,
78263
+ "-s",
78264
+ SERVICE,
78265
+ "-w",
78266
+ privateKey
78267
+ ]);
78211
78268
  if (result.exitCode !== 0) return false;
78212
78269
  const stored = await readDarwinRaw(runner2, account);
78213
78270
  if (stored === privateKey) return true;
@@ -78581,7 +78638,7 @@ async function handleSecondDevOnboarding(repoRoot, clefConfigPath, deps2, option
78581
78638
  if (!fs17.existsSync(clefDir)) {
78582
78639
  fs17.mkdirSync(clefDir, { recursive: true });
78583
78640
  }
78584
- fs17.writeFileSync(clefConfigPath, YAML11.stringify(config), "utf-8");
78641
+ fs17.writeFileSync(clefConfigPath, YAML12.stringify(config), "utf-8");
78585
78642
  formatter.success("Created .clef/config.yaml");
78586
78643
  const gitignorePath = path19.join(clefDir, ".gitignore");
78587
78644
  if (!fs17.existsSync(gitignorePath)) {
@@ -78638,15 +78695,14 @@ async function handleFullSetup(repoRoot, manifestPath, clefConfigPath, deps2, op
78638
78695
  };
78639
78696
  const initParser = new ManifestParser();
78640
78697
  initParser.validate(manifest);
78641
- fs17.writeFileSync(manifestPath, YAML11.stringify(manifest), "utf-8");
78642
- formatter.success("Created clef.yaml");
78643
78698
  let ageKeyFile;
78644
78699
  let ageKey;
78700
+ let publicKey;
78645
78701
  if (backend === "age") {
78646
78702
  const label2 = generateKeyLabel();
78647
78703
  const identity = await generateAgeIdentity();
78648
78704
  const privateKey = identity.privateKey;
78649
- const publicKey = identity.publicKey;
78705
+ publicKey = identity.publicKey;
78650
78706
  const storedInKeychain = await setKeychainKey(deps2.runner, privateKey, label2);
78651
78707
  if (storedInKeychain) {
78652
78708
  formatter.success("Stored age key in OS keychain");
@@ -78690,7 +78746,7 @@ async function handleFullSetup(repoRoot, manifestPath, clefConfigPath, deps2, op
78690
78746
  fs17.mkdirSync(clefDir, { recursive: true });
78691
78747
  }
78692
78748
  const config = ageKeyFile ? { age_key_file: ageKeyFile, age_key_storage: "file", age_keychain_label: label2 } : { age_key_storage: "keychain", age_keychain_label: label2 };
78693
- fs17.writeFileSync(clefConfigPath, YAML11.stringify(config), "utf-8");
78749
+ fs17.writeFileSync(clefConfigPath, YAML12.stringify(config), "utf-8");
78694
78750
  formatter.success("Created .clef/config.yaml");
78695
78751
  const gitignorePath = path19.join(clefDir, ".gitignore");
78696
78752
  if (!fs17.existsSync(gitignorePath)) {
@@ -78698,14 +78754,18 @@ async function handleFullSetup(repoRoot, manifestPath, clefConfigPath, deps2, op
78698
78754
  formatter.success("Created .clef/.gitignore");
78699
78755
  }
78700
78756
  formatter.success(`Key label: ${label2}`);
78757
+ }
78758
+ const manifestDoc = YAML12.parse(YAML12.stringify(manifest));
78759
+ if (backend === "age" && publicKey) {
78760
+ const sopsDoc = manifestDoc.sops;
78761
+ sopsDoc.age = { recipients: [publicKey] };
78762
+ }
78763
+ fs17.writeFileSync(manifestPath, YAML12.stringify(manifestDoc), "utf-8");
78764
+ formatter.success("Created clef.yaml");
78765
+ {
78701
78766
  const sopsYamlPath = path19.join(repoRoot, ".sops.yaml");
78702
78767
  const sopsConfig = buildSopsYaml(manifest, repoRoot, publicKey);
78703
- fs17.writeFileSync(sopsYamlPath, YAML11.stringify(sopsConfig), "utf-8");
78704
- formatter.success("Created .sops.yaml");
78705
- } else {
78706
- const sopsYamlPath = path19.join(repoRoot, ".sops.yaml");
78707
- const sopsConfig = buildSopsYaml(manifest, repoRoot, void 0);
78708
- fs17.writeFileSync(sopsYamlPath, YAML11.stringify(sopsConfig), "utf-8");
78768
+ fs17.writeFileSync(sopsYamlPath, YAML12.stringify(sopsConfig), "utf-8");
78709
78769
  formatter.success("Created .sops.yaml");
78710
78770
  }
78711
78771
  const sopsClient = new SopsClient(deps2.runner, ageKeyFile, ageKey);
@@ -78795,7 +78855,7 @@ function scaffoldSopsConfig(repoRoot) {
78795
78855
  agePublicKey = resolveAgePublicKeyFromEnvOrFile(repoRoot);
78796
78856
  }
78797
78857
  const sopsConfig = buildSopsYaml(manifest, repoRoot, agePublicKey);
78798
- fs17.writeFileSync(sopsYamlPath, YAML11.stringify(sopsConfig), "utf-8");
78858
+ fs17.writeFileSync(sopsYamlPath, YAML12.stringify(sopsConfig), "utf-8");
78799
78859
  }
78800
78860
  function buildSopsYaml(manifest, _repoRoot, agePublicKey) {
78801
78861
  const creationRules = [];
@@ -78861,7 +78921,7 @@ function resolveAgePublicKeyFromEnvOrFile(repoRoot) {
78861
78921
  const clefConfigPath = path19.join(repoRoot, CLEF_DIR, CLEF_CONFIG_FILENAME);
78862
78922
  if (fs17.existsSync(clefConfigPath)) {
78863
78923
  try {
78864
- const config = YAML11.parse(fs17.readFileSync(clefConfigPath, "utf-8"));
78924
+ const config = YAML12.parse(fs17.readFileSync(clefConfigPath, "utf-8"));
78865
78925
  if (config?.age_key_file) {
78866
78926
  const pubKey = extractAgePublicKey(config.age_key_file);
78867
78927
  if (pubKey) return pubKey;
@@ -78941,7 +79001,7 @@ init_src();
78941
79001
  import * as path21 from "path";
78942
79002
 
78943
79003
  // src/age-credential.ts
78944
- var YAML12 = __toESM(require_dist());
79004
+ var YAML13 = __toESM(require_dist());
78945
79005
  init_src();
78946
79006
  import * as fs18 from "fs";
78947
79007
  import * as path20 from "path";
@@ -79036,7 +79096,7 @@ function readLocalConfig(repoRoot) {
79036
79096
  const clefConfigPath = path20.join(repoRoot, CLEF_DIR2, CLEF_CONFIG_FILENAME2);
79037
79097
  try {
79038
79098
  if (!fs18.existsSync(clefConfigPath)) return null;
79039
- return YAML12.parse(fs18.readFileSync(clefConfigPath, "utf-8"));
79099
+ return YAML13.parse(fs18.readFileSync(clefConfigPath, "utf-8"));
79040
79100
  } catch (err) {
79041
79101
  formatter.warn(
79042
79102
  `Failed to parse ${clefConfigPath}: ${err instanceof Error ? err.message : String(err)}
@@ -79823,7 +79883,7 @@ async function fetchCheckpoint(config) {
79823
79883
  }
79824
79884
 
79825
79885
  // package.json
79826
- var version = "0.1.7-beta.43";
79886
+ var version = "0.1.7-beta.48";
79827
79887
  var package_default = {
79828
79888
  name: "@clef-sh/cli",
79829
79889
  version,
@@ -79897,6 +79957,10 @@ function registerLintCommand(program3, deps2) {
79897
79957
  const matrixManager = new MatrixManager();
79898
79958
  const schemaValidator = new SchemaValidator();
79899
79959
  const lintRunner = new LintRunner(matrixManager, schemaValidator, sopsClient);
79960
+ const cellCount = manifest.namespaces.length * manifest.environments.length;
79961
+ formatter.print(
79962
+ `${sym("working")} Linting ${cellCount} file(s) across ${manifest.namespaces.length} namespace(s)...`
79963
+ );
79900
79964
  let result;
79901
79965
  if (options.fix) {
79902
79966
  result = await lintRunner.fix(manifest, repoRoot);
@@ -80421,7 +80485,7 @@ function parseTarget7(target) {
80421
80485
  }
80422
80486
 
80423
80487
  // src/commands/doctor.ts
80424
- var YAML13 = __toESM(require_dist());
80488
+ var YAML14 = __toESM(require_dist());
80425
80489
  init_src();
80426
80490
  import * as fs20 from "fs";
80427
80491
  import * as path32 from "path";
@@ -80672,7 +80736,7 @@ function countAgeRecipients(sopsYamlPath) {
80672
80736
  try {
80673
80737
  if (!fs20.existsSync(sopsYamlPath)) return 0;
80674
80738
  const content = fs20.readFileSync(sopsYamlPath, "utf-8");
80675
- const config = YAML13.parse(content);
80739
+ const config = YAML14.parse(content);
80676
80740
  if (!config?.creation_rules || !Array.isArray(config.creation_rules)) {
80677
80741
  return 0;
80678
80742
  }
@@ -81867,6 +81931,44 @@ Service Identity: ${identity.name}`);
81867
81931
  process.exit(1);
81868
81932
  }
81869
81933
  });
81934
+ serviceCmd.command("delete <name>").description("Delete a service identity and remove its recipients from scoped files.").action(async (name) => {
81935
+ try {
81936
+ const repoRoot = program3.opts().dir || process.cwd();
81937
+ const parser = new ManifestParser();
81938
+ const manifest = parser.parse(path38.join(repoRoot, "clef.yaml"));
81939
+ const identity = manifest.service_identities?.find((si) => si.name === name);
81940
+ if (!identity) {
81941
+ formatter.error(`Service identity '${name}' not found.`);
81942
+ process.exit(1);
81943
+ return;
81944
+ }
81945
+ const confirmed = await formatter.confirm(
81946
+ `Delete service identity '${name}'? This will remove its recipients from all scoped files.`
81947
+ );
81948
+ if (!confirmed) {
81949
+ formatter.error("Aborted.");
81950
+ process.exit(1);
81951
+ return;
81952
+ }
81953
+ const matrixManager = new MatrixManager();
81954
+ const sopsClient = await createSopsClient(repoRoot, deps2.runner);
81955
+ const manager = new ServiceIdentityManager(sopsClient, matrixManager);
81956
+ formatter.print(`${sym("working")} Deleting service identity '${name}'...`);
81957
+ await manager.delete(name, manifest, repoRoot);
81958
+ formatter.success(`Service identity '${name}' deleted.`);
81959
+ formatter.hint(
81960
+ `git add clef.yaml && git commit -m "chore: delete service identity '${name}'"`
81961
+ );
81962
+ } catch (err) {
81963
+ if (err instanceof SopsMissingError || err instanceof SopsVersionError) {
81964
+ formatter.formatDependencyError(err);
81965
+ process.exit(1);
81966
+ return;
81967
+ }
81968
+ formatter.error(err.message);
81969
+ process.exit(1);
81970
+ }
81971
+ });
81870
81972
  serviceCmd.command("rotate <name>").description("Rotate the age key for a service identity.").option("-e, --environment <env>", "Rotate only a specific environment").action(async (name, opts2) => {
81871
81973
  try {
81872
81974
  const repoRoot = program3.opts().dir || process.cwd();
@@ -82411,6 +82513,189 @@ function formatReportOutput(report) {
82411
82513
  formatter.hint("Run clef lint or clef drift locally for details.");
82412
82514
  }
82413
82515
 
82516
+ // src/commands/install.ts
82517
+ var import_yaml = __toESM(require_dist());
82518
+ import * as fs26 from "fs";
82519
+ import * as path43 from "path";
82520
+
82521
+ // src/registry/client.ts
82522
+ var DEFAULT_REGISTRY = "https://raw.githubusercontent.com/clef-sh/clef/main/brokers";
82523
+ async function fetchIndex(registryUrl = DEFAULT_REGISTRY) {
82524
+ const url = `${registryUrl}/index.json`;
82525
+ const res = await fetch(url);
82526
+ if (!res.ok) {
82527
+ throw new Error(`Failed to fetch registry index from ${url} (${res.status})`);
82528
+ }
82529
+ return await res.json();
82530
+ }
82531
+ async function fetchBrokerFile(registryUrl, brokerPath, filename) {
82532
+ const url = `${registryUrl}/${brokerPath}/${filename}`;
82533
+ const res = await fetch(url);
82534
+ if (!res.ok) {
82535
+ throw new Error(`Failed to fetch ${filename} from ${url} (${res.status})`);
82536
+ }
82537
+ return res.text();
82538
+ }
82539
+ function findBroker(index, name) {
82540
+ return index.brokers.find((b) => b.name === name);
82541
+ }
82542
+
82543
+ // src/commands/install.ts
82544
+ var TIER_LABELS = {
82545
+ 1: "self-expiring",
82546
+ 2: "stateful",
82547
+ 3: "complex"
82548
+ };
82549
+ function registerInstallCommand(program3, _deps) {
82550
+ program3.command("install <broker>").description(
82551
+ "Install a broker template from the Clef registry.\n\nDownloads broker.yaml, handler.ts, and README.md\ninto brokers/<name>/ in your project.\n\nExit codes:\n 0 Broker installed successfully\n 1 Error (broker not found, network failure, etc.)"
82552
+ ).option("--registry <url>", "Custom registry base URL", DEFAULT_REGISTRY).option("--force", "Overwrite existing broker directory without prompting").action(async (brokerName, options) => {
82553
+ try {
82554
+ const repoRoot = program3.opts().dir || process.cwd();
82555
+ const registryUrl = options.registry;
82556
+ formatter.info(`Fetching ${brokerName} from registry...`);
82557
+ const index = await fetchIndex(registryUrl);
82558
+ const entry = findBroker(index, brokerName);
82559
+ if (!entry) {
82560
+ formatter.error(
82561
+ `Broker "${brokerName}" not found in the registry. Run 'clef search' to list available brokers.`
82562
+ );
82563
+ process.exit(1);
82564
+ return;
82565
+ }
82566
+ const brokerDir = path43.join(repoRoot, "brokers", entry.name);
82567
+ if (fs26.existsSync(brokerDir) && !options.force) {
82568
+ const overwrite = await formatter.confirm(
82569
+ `brokers/${entry.name}/ already exists. Overwrite?`
82570
+ );
82571
+ if (!overwrite) {
82572
+ formatter.info("Installation cancelled.");
82573
+ process.exit(0);
82574
+ return;
82575
+ }
82576
+ }
82577
+ const files = [];
82578
+ for (const filename of ["broker.yaml", "handler.ts", "README.md"]) {
82579
+ try {
82580
+ const content = await fetchBrokerFile(registryUrl, entry.path, filename);
82581
+ files.push({ name: filename, content });
82582
+ } catch {
82583
+ if (filename === "handler.ts") {
82584
+ try {
82585
+ const content = await fetchBrokerFile(registryUrl, entry.path, "handler.js");
82586
+ files.push({ name: "handler.js", content });
82587
+ } catch {
82588
+ formatter.warn(`Could not download handler file for ${brokerName}`);
82589
+ }
82590
+ }
82591
+ }
82592
+ }
82593
+ if (files.length === 0) {
82594
+ formatter.error(`Could not download any files for ${brokerName}`);
82595
+ process.exit(1);
82596
+ return;
82597
+ }
82598
+ if (!fs26.existsSync(brokerDir)) {
82599
+ fs26.mkdirSync(brokerDir, { recursive: true });
82600
+ }
82601
+ for (const file of files) {
82602
+ fs26.writeFileSync(path43.join(brokerDir, file.name), file.content, "utf-8");
82603
+ }
82604
+ const manifestFile = files.find((f) => f.name === "broker.yaml");
82605
+ const manifest = manifestFile ? (0, import_yaml.parse)(manifestFile.content) : {};
82606
+ formatter.print("");
82607
+ formatter.print(` ${sym("success")} ${entry.name}`);
82608
+ formatter.print("");
82609
+ formatter.keyValue(" Name", entry.name);
82610
+ formatter.keyValue(" Provider", entry.provider);
82611
+ formatter.keyValue(" Tier", `${entry.tier} (${TIER_LABELS[entry.tier] ?? "unknown"})`);
82612
+ formatter.keyValue(" Description", entry.description);
82613
+ formatter.print("");
82614
+ formatter.section(" Created");
82615
+ for (const file of files) {
82616
+ formatter.print(` brokers/${entry.name}/${file.name}`);
82617
+ }
82618
+ if (manifest.inputs && manifest.inputs.length > 0) {
82619
+ formatter.section(" Inputs");
82620
+ for (const input of manifest.inputs) {
82621
+ const suffix = input.default !== void 0 ? ` (default: ${input.default})` : " (required)";
82622
+ formatter.print(` ${input.name}${suffix}`);
82623
+ }
82624
+ }
82625
+ if (manifest.output?.keys) {
82626
+ formatter.section(" Output");
82627
+ formatter.keyValue(" Keys", manifest.output.keys.join(", "));
82628
+ if (manifest.output.ttl) {
82629
+ formatter.keyValue(" TTL", `${manifest.output.ttl}s`);
82630
+ }
82631
+ }
82632
+ if (manifest.runtime?.permissions?.length > 0) {
82633
+ formatter.section(" Permissions");
82634
+ for (const perm of manifest.runtime.permissions) {
82635
+ formatter.print(` ${perm}`);
82636
+ }
82637
+ }
82638
+ formatter.print("");
82639
+ formatter.hint(`https://registry.clef.sh/brokers/${entry.name}`);
82640
+ process.exit(0);
82641
+ } catch (err) {
82642
+ formatter.error(err.message);
82643
+ process.exit(1);
82644
+ }
82645
+ });
82646
+ }
82647
+
82648
+ // src/commands/search.ts
82649
+ function registerSearchCommand(program3, _deps) {
82650
+ program3.command("search [query]").description(
82651
+ "Search the Clef broker registry.\n\nWithout arguments, lists all available brokers.\n\nExit codes:\n 0 Results found or listing complete\n 1 Error fetching registry"
82652
+ ).option("--provider <name>", "Filter by cloud provider (aws, gcp, azure, agnostic)").option("--tier <n>", "Filter by tier (1, 2, 3)").option("--registry <url>", "Custom registry base URL", DEFAULT_REGISTRY).action(
82653
+ async (query, options) => {
82654
+ try {
82655
+ const index = await fetchIndex(options.registry);
82656
+ let results = index.brokers;
82657
+ if (query) {
82658
+ const q = query.toLowerCase();
82659
+ results = results.filter(
82660
+ (b) => b.name.toLowerCase().includes(q) || b.description.toLowerCase().includes(q) || b.provider.toLowerCase().includes(q)
82661
+ );
82662
+ }
82663
+ if (options.provider) {
82664
+ results = results.filter((b) => b.provider === options.provider);
82665
+ }
82666
+ if (options.tier) {
82667
+ results = results.filter((b) => b.tier === Number(options.tier));
82668
+ }
82669
+ if (results.length === 0) {
82670
+ formatter.info("No brokers found matching your query.");
82671
+ process.exit(0);
82672
+ return;
82673
+ }
82674
+ const label2 = query || options.provider || options.tier ? `${results.length} broker${results.length === 1 ? "" : "s"} found` : `${results.length} broker${results.length === 1 ? "" : "s"} available`;
82675
+ formatter.print(`
82676
+ ${label2}
82677
+ `);
82678
+ printBrokerTable(results);
82679
+ formatter.print("");
82680
+ process.exit(0);
82681
+ } catch (err) {
82682
+ formatter.error(err.message);
82683
+ process.exit(1);
82684
+ }
82685
+ }
82686
+ );
82687
+ }
82688
+ function printBrokerTable(brokers) {
82689
+ const nameWidth = Math.max(...brokers.map((b) => b.name.length));
82690
+ const providerWidth = Math.max(...brokers.map((b) => b.provider.length));
82691
+ for (const b of brokers) {
82692
+ const name = b.name.padEnd(nameWidth);
82693
+ const provider = b.provider.padEnd(providerWidth);
82694
+ const tier = `Tier ${b.tier}`;
82695
+ formatter.print(` ${name} ${provider} ${tier} ${b.description}`);
82696
+ }
82697
+ }
82698
+
82414
82699
  // src/index.ts
82415
82700
  var VERSION = package_default.version;
82416
82701
  var program2 = new Command();
@@ -82466,6 +82751,8 @@ registerPackCommand(program2, deps);
82466
82751
  registerRevokeCommand(program2, deps);
82467
82752
  registerDriftCommand(program2, deps);
82468
82753
  registerReportCommand(program2, deps);
82754
+ registerInstallCommand(program2, deps);
82755
+ registerSearchCommand(program2, deps);
82469
82756
  program2.parseAsync(process.argv).catch((err) => {
82470
82757
  formatter.error(err.message);
82471
82758
  process.exit(1);