maxsimcli 4.4.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/assets/CHANGELOG.md +41 -0
  3. package/dist/assets/dashboard/server.js +248 -240
  4. package/dist/assets/templates/agents/AGENTS.md +1 -0
  5. package/dist/assets/templates/agents/maxsim-drift-checker.md +522 -0
  6. package/dist/assets/templates/commands/maxsim/check-drift.md +56 -0
  7. package/dist/assets/templates/commands/maxsim/discuss.md +70 -0
  8. package/dist/assets/templates/commands/maxsim/realign.md +39 -0
  9. package/dist/assets/templates/workflows/check-drift.md +248 -0
  10. package/dist/assets/templates/workflows/discuss.md +343 -0
  11. package/dist/assets/templates/workflows/progress.md +8 -0
  12. package/dist/assets/templates/workflows/realign.md +288 -0
  13. package/dist/assets/templates/workflows/roadmap.md +69 -20
  14. package/dist/backend-server.cjs +52 -29
  15. package/dist/backend-server.cjs.map +1 -1
  16. package/dist/cli.cjs +261 -5
  17. package/dist/cli.cjs.map +1 -1
  18. package/dist/cli.js +20 -1
  19. package/dist/cli.js.map +1 -1
  20. package/dist/core/core.d.ts.map +1 -1
  21. package/dist/core/core.js +1 -0
  22. package/dist/core/core.js.map +1 -1
  23. package/dist/core/drift.d.ts +37 -0
  24. package/dist/core/drift.d.ts.map +1 -0
  25. package/dist/core/drift.js +213 -0
  26. package/dist/core/drift.js.map +1 -0
  27. package/dist/core/frontmatter.d.ts.map +1 -1
  28. package/dist/core/frontmatter.js +3 -0
  29. package/dist/core/frontmatter.js.map +1 -1
  30. package/dist/core/index.d.ts +3 -2
  31. package/dist/core/index.d.ts.map +1 -1
  32. package/dist/core/index.js +12 -2
  33. package/dist/core/index.js.map +1 -1
  34. package/dist/core/init.d.ts +5 -3
  35. package/dist/core/init.d.ts.map +1 -1
  36. package/dist/core/init.js +89 -0
  37. package/dist/core/init.js.map +1 -1
  38. package/dist/core/types.d.ts +50 -1
  39. package/dist/core/types.d.ts.map +1 -1
  40. package/dist/core/types.js.map +1 -1
  41. package/dist/core-RRjCSt0G.cjs.map +1 -1
  42. package/dist/{lifecycle-0M4VqOMm.cjs → lifecycle-DxCru7rk.cjs} +2 -2
  43. package/dist/{lifecycle-0M4VqOMm.cjs.map → lifecycle-DxCru7rk.cjs.map} +1 -1
  44. package/dist/mcp/phase-tools.d.ts.map +1 -1
  45. package/dist/mcp/phase-tools.js +17 -4
  46. package/dist/mcp/phase-tools.js.map +1 -1
  47. package/dist/mcp-server.cjs +20 -5
  48. package/dist/mcp-server.cjs.map +1 -1
  49. package/dist/{server-G1MIg_Oe.cjs → server-By0TN-nC.cjs} +21 -6
  50. package/dist/server-By0TN-nC.cjs.map +1 -0
  51. package/dist/skills-MYlMkYNt.cjs.map +1 -1
  52. package/package.json +1 -1
  53. package/dist/server-G1MIg_Oe.cjs.map +0 -1
@@ -26636,9 +26636,9 @@ var require_mime_types = /* @__PURE__ */ __commonJSMin(((exports) => {
26636
26636
  * @param {string} path
26637
26637
  * @return {boolean|string}
26638
26638
  */
26639
- function lookup(path$74) {
26640
- if (!path$74 || typeof path$74 !== "string") return false;
26641
- var extension = extname("x." + path$74).toLowerCase().substr(1);
26639
+ function lookup(path$75) {
26640
+ if (!path$75 || typeof path$75 !== "string") return false;
26641
+ var extension = extname("x." + path$75).toLowerCase().substr(1);
26642
26642
  if (!extension) return false;
26643
26643
  return exports.types[extension] || false;
26644
26644
  }
@@ -32132,17 +32132,17 @@ var require_view = /* @__PURE__ */ __commonJSMin(((exports, module) => {
32132
32132
  * @private
32133
32133
  */
32134
32134
  var debug = require_src$3()("express:view");
32135
- var path$19 = require("path");
32136
- var fs$20 = require("fs");
32135
+ var path$20 = require("path");
32136
+ var fs$21 = require("fs");
32137
32137
  /**
32138
32138
  * Module variables.
32139
32139
  * @private
32140
32140
  */
32141
- var dirname = path$19.dirname;
32142
- var basename = path$19.basename;
32143
- var extname = path$19.extname;
32144
- var join = path$19.join;
32145
- var resolve = path$19.resolve;
32141
+ var dirname = path$20.dirname;
32142
+ var basename = path$20.basename;
32143
+ var extname = path$20.extname;
32144
+ var join = path$20.join;
32145
+ var resolve = path$20.resolve;
32146
32146
  /**
32147
32147
  * Module exports.
32148
32148
  * @public
@@ -32190,17 +32190,17 @@ var require_view = /* @__PURE__ */ __commonJSMin(((exports, module) => {
32190
32190
  * @private
32191
32191
  */
32192
32192
  View.prototype.lookup = function lookup(name) {
32193
- var path$71;
32193
+ var path$72;
32194
32194
  var roots = [].concat(this.root);
32195
32195
  debug("lookup \"%s\"", name);
32196
- for (var i = 0; i < roots.length && !path$71; i++) {
32196
+ for (var i = 0; i < roots.length && !path$72; i++) {
32197
32197
  var root = roots[i];
32198
32198
  var loc = resolve(root, name);
32199
32199
  var dir = dirname(loc);
32200
32200
  var file = basename(loc);
32201
- path$71 = this.resolve(dir, file);
32201
+ path$72 = this.resolve(dir, file);
32202
32202
  }
32203
- return path$71;
32203
+ return path$72;
32204
32204
  };
32205
32205
  /**
32206
32206
  * Render with the given options.
@@ -32222,12 +32222,12 @@ var require_view = /* @__PURE__ */ __commonJSMin(((exports, module) => {
32222
32222
  */
32223
32223
  View.prototype.resolve = function resolve(dir, file) {
32224
32224
  var ext = this.ext;
32225
- var path$72 = join(dir, file);
32226
- var stat = tryStat(path$72);
32227
- if (stat && stat.isFile()) return path$72;
32228
- path$72 = join(dir, basename(file, ext), "index" + ext);
32229
- stat = tryStat(path$72);
32230
- if (stat && stat.isFile()) return path$72;
32225
+ var path$73 = join(dir, file);
32226
+ var stat = tryStat(path$73);
32227
+ if (stat && stat.isFile()) return path$73;
32228
+ path$73 = join(dir, basename(file, ext), "index" + ext);
32229
+ stat = tryStat(path$73);
32230
+ if (stat && stat.isFile()) return path$73;
32231
32231
  };
32232
32232
  /**
32233
32233
  * Return a stat, maybe.
@@ -32236,10 +32236,10 @@ var require_view = /* @__PURE__ */ __commonJSMin(((exports, module) => {
32236
32236
  * @return {fs.Stats}
32237
32237
  * @private
32238
32238
  */
32239
- function tryStat(path$73) {
32240
- debug("stat \"%s\"", path$73);
32239
+ function tryStat(path$74) {
32240
+ debug("stat \"%s\"", path$74);
32241
32241
  try {
32242
- return fs$20.statSync(path$73);
32242
+ return fs$21.statSync(path$74);
32243
32243
  } catch (e) {
32244
32244
  return;
32245
32245
  }
@@ -34460,7 +34460,7 @@ var require_types$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
34460
34460
  //#region ../../node_modules/send/node_modules/mime/mime.js
34461
34461
  var require_mime = /* @__PURE__ */ __commonJSMin(((exports, module) => {
34462
34462
  require("path");
34463
- var fs$19 = require("fs");
34463
+ var fs$20 = require("fs");
34464
34464
  function Mime() {
34465
34465
  this.types = Object.create(null);
34466
34466
  this.extensions = Object.create(null);
@@ -34495,7 +34495,7 @@ var require_mime = /* @__PURE__ */ __commonJSMin(((exports, module) => {
34495
34495
  Mime.prototype.load = function(file) {
34496
34496
  this._loading = file;
34497
34497
  var map = {};
34498
- fs$19.readFileSync(file, "ascii").split(/[\r\n]+/).forEach(function(line) {
34498
+ fs$20.readFileSync(file, "ascii").split(/[\r\n]+/).forEach(function(line) {
34499
34499
  var fields = line.replace(/\s*#.*|^\s*|\s*$/g, "").split(/\s+/);
34500
34500
  map[fields.shift()] = fields;
34501
34501
  });
@@ -34505,8 +34505,8 @@ var require_mime = /* @__PURE__ */ __commonJSMin(((exports, module) => {
34505
34505
  /**
34506
34506
  * Lookup a mime type based on extension
34507
34507
  */
34508
- Mime.prototype.lookup = function(path$70, fallback) {
34509
- var ext = path$70.replace(/^.*[\.\/\\]/, "").toLowerCase();
34508
+ Mime.prototype.lookup = function(path$71, fallback) {
34509
+ var ext = path$71.replace(/^.*[\.\/\\]/, "").toLowerCase();
34510
34510
  return this.types[ext] || fallback || this.default_type;
34511
34511
  };
34512
34512
  /**
@@ -34774,12 +34774,12 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
34774
34774
  var escapeHtml = require_escape_html();
34775
34775
  var etag = require_etag();
34776
34776
  var fresh = require_fresh();
34777
- var fs$18 = require("fs");
34777
+ var fs$19 = require("fs");
34778
34778
  var mime = require_mime();
34779
34779
  var ms = require_ms();
34780
34780
  var onFinished = require_on_finished();
34781
34781
  var parseRange = require_range_parser();
34782
- var path$18 = require("path");
34782
+ var path$19 = require("path");
34783
34783
  var statuses = require_statuses();
34784
34784
  var Stream = require("stream");
34785
34785
  var util$2 = require("util");
@@ -34787,11 +34787,11 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
34787
34787
  * Path function references.
34788
34788
  * @private
34789
34789
  */
34790
- var extname = path$18.extname;
34791
- var join = path$18.join;
34792
- var normalize = path$18.normalize;
34793
- var resolve = path$18.resolve;
34794
- var sep = path$18.sep;
34790
+ var extname = path$19.extname;
34791
+ var join = path$19.join;
34792
+ var normalize = path$19.normalize;
34793
+ var resolve = path$19.resolve;
34794
+ var sep = path$19.sep;
34795
34795
  /**
34796
34796
  * Regular expression for identifying a bytes Range header.
34797
34797
  * @private
@@ -34822,8 +34822,8 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
34822
34822
  * @return {SendStream}
34823
34823
  * @public
34824
34824
  */
34825
- function send(req, path$58, options) {
34826
- return new SendStream(req, path$58, options);
34825
+ function send(req, path$59, options) {
34826
+ return new SendStream(req, path$59, options);
34827
34827
  }
34828
34828
  /**
34829
34829
  * Initialize a `SendStream` with the given `path`.
@@ -34833,11 +34833,11 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
34833
34833
  * @param {object} [options]
34834
34834
  * @private
34835
34835
  */
34836
- function SendStream(req, path$59, options) {
34836
+ function SendStream(req, path$60, options) {
34837
34837
  Stream.call(this);
34838
34838
  var opts = options || {};
34839
34839
  this.options = opts;
34840
- this.path = path$59;
34840
+ this.path = path$60;
34841
34841
  this.req = req;
34842
34842
  this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
34843
34843
  this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
@@ -34907,8 +34907,8 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
34907
34907
  * @return {SendStream}
34908
34908
  * @api public
34909
34909
  */
34910
- SendStream.prototype.root = function root(path$60) {
34911
- this._root = resolve(String(path$60));
34910
+ SendStream.prototype.root = function root(path$61) {
34911
+ this._root = resolve(String(path$61));
34912
34912
  debug("root %s", this._root);
34913
34913
  return this;
34914
34914
  };
@@ -35085,10 +35085,10 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35085
35085
  * @param {string} path
35086
35086
  * @private
35087
35087
  */
35088
- SendStream.prototype.redirect = function redirect(path$61) {
35088
+ SendStream.prototype.redirect = function redirect(path$62) {
35089
35089
  var res = this.res;
35090
35090
  if (hasListeners(this, "directory")) {
35091
- this.emit("directory", res, path$61);
35091
+ this.emit("directory", res, path$62);
35092
35092
  return;
35093
35093
  }
35094
35094
  if (this.hasTrailingSlash()) {
@@ -35115,38 +35115,38 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35115
35115
  SendStream.prototype.pipe = function pipe(res) {
35116
35116
  var root = this._root;
35117
35117
  this.res = res;
35118
- var path$62 = decode(this.path);
35119
- if (path$62 === -1) {
35118
+ var path$63 = decode(this.path);
35119
+ if (path$63 === -1) {
35120
35120
  this.error(400);
35121
35121
  return res;
35122
35122
  }
35123
- if (~path$62.indexOf("\0")) {
35123
+ if (~path$63.indexOf("\0")) {
35124
35124
  this.error(400);
35125
35125
  return res;
35126
35126
  }
35127
35127
  var parts;
35128
35128
  if (root !== null) {
35129
- if (path$62) path$62 = normalize("." + sep + path$62);
35130
- if (UP_PATH_REGEXP.test(path$62)) {
35131
- debug("malicious path \"%s\"", path$62);
35129
+ if (path$63) path$63 = normalize("." + sep + path$63);
35130
+ if (UP_PATH_REGEXP.test(path$63)) {
35131
+ debug("malicious path \"%s\"", path$63);
35132
35132
  this.error(403);
35133
35133
  return res;
35134
35134
  }
35135
- parts = path$62.split(sep);
35136
- path$62 = normalize(join(root, path$62));
35135
+ parts = path$63.split(sep);
35136
+ path$63 = normalize(join(root, path$63));
35137
35137
  } else {
35138
- if (UP_PATH_REGEXP.test(path$62)) {
35139
- debug("malicious path \"%s\"", path$62);
35138
+ if (UP_PATH_REGEXP.test(path$63)) {
35139
+ debug("malicious path \"%s\"", path$63);
35140
35140
  this.error(403);
35141
35141
  return res;
35142
35142
  }
35143
- parts = normalize(path$62).split(sep);
35144
- path$62 = resolve(path$62);
35143
+ parts = normalize(path$63).split(sep);
35144
+ path$63 = resolve(path$63);
35145
35145
  }
35146
35146
  if (containsDotFile(parts)) {
35147
35147
  var access = this._dotfiles;
35148
35148
  if (access === void 0) access = parts[parts.length - 1][0] === "." ? this._hidden ? "allow" : "ignore" : "allow";
35149
- debug("%s dotfile \"%s\"", access, path$62);
35149
+ debug("%s dotfile \"%s\"", access, path$63);
35150
35150
  switch (access) {
35151
35151
  case "allow": break;
35152
35152
  case "deny":
@@ -35158,10 +35158,10 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35158
35158
  }
35159
35159
  }
35160
35160
  if (this._index.length && this.hasTrailingSlash()) {
35161
- this.sendIndex(path$62);
35161
+ this.sendIndex(path$63);
35162
35162
  return res;
35163
35163
  }
35164
- this.sendFile(path$62);
35164
+ this.sendFile(path$63);
35165
35165
  return res;
35166
35166
  };
35167
35167
  /**
@@ -35170,7 +35170,7 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35170
35170
  * @param {String} path
35171
35171
  * @api public
35172
35172
  */
35173
- SendStream.prototype.send = function send(path$63, stat) {
35173
+ SendStream.prototype.send = function send(path$64, stat) {
35174
35174
  var len = stat.size;
35175
35175
  var options = this.options;
35176
35176
  var opts = {};
@@ -35182,9 +35182,9 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35182
35182
  this.headersAlreadySent();
35183
35183
  return;
35184
35184
  }
35185
- debug("pipe \"%s\"", path$63);
35186
- this.setHeader(path$63, stat);
35187
- this.type(path$63);
35185
+ debug("pipe \"%s\"", path$64);
35186
+ this.setHeader(path$64, stat);
35187
+ this.type(path$64);
35188
35188
  if (this.isConditionalGET()) {
35189
35189
  if (this.isPreconditionFailure()) {
35190
35190
  this.error(412);
@@ -35227,7 +35227,7 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35227
35227
  res.end();
35228
35228
  return;
35229
35229
  }
35230
- this.stream(path$63, opts);
35230
+ this.stream(path$64, opts);
35231
35231
  };
35232
35232
  /**
35233
35233
  * Transfer file for `path`.
@@ -35235,22 +35235,22 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35235
35235
  * @param {String} path
35236
35236
  * @api private
35237
35237
  */
35238
- SendStream.prototype.sendFile = function sendFile(path$64) {
35238
+ SendStream.prototype.sendFile = function sendFile(path$65) {
35239
35239
  var i = 0;
35240
35240
  var self = this;
35241
- debug("stat \"%s\"", path$64);
35242
- fs$18.stat(path$64, function onstat(err, stat) {
35243
- if (err && err.code === "ENOENT" && !extname(path$64) && path$64[path$64.length - 1] !== sep) return next(err);
35241
+ debug("stat \"%s\"", path$65);
35242
+ fs$19.stat(path$65, function onstat(err, stat) {
35243
+ if (err && err.code === "ENOENT" && !extname(path$65) && path$65[path$65.length - 1] !== sep) return next(err);
35244
35244
  if (err) return self.onStatError(err);
35245
- if (stat.isDirectory()) return self.redirect(path$64);
35246
- self.emit("file", path$64, stat);
35247
- self.send(path$64, stat);
35245
+ if (stat.isDirectory()) return self.redirect(path$65);
35246
+ self.emit("file", path$65, stat);
35247
+ self.send(path$65, stat);
35248
35248
  });
35249
35249
  function next(err) {
35250
35250
  if (self._extensions.length <= i) return err ? self.onStatError(err) : self.error(404);
35251
- var p = path$64 + "." + self._extensions[i++];
35251
+ var p = path$65 + "." + self._extensions[i++];
35252
35252
  debug("stat \"%s\"", p);
35253
- fs$18.stat(p, function(err, stat) {
35253
+ fs$19.stat(p, function(err, stat) {
35254
35254
  if (err) return next(err);
35255
35255
  if (stat.isDirectory()) return next();
35256
35256
  self.emit("file", p, stat);
@@ -35264,7 +35264,7 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35264
35264
  * @param {String} path
35265
35265
  * @api private
35266
35266
  */
35267
- SendStream.prototype.sendIndex = function sendIndex(path$65) {
35267
+ SendStream.prototype.sendIndex = function sendIndex(path$66) {
35268
35268
  var i = -1;
35269
35269
  var self = this;
35270
35270
  function next(err) {
@@ -35272,9 +35272,9 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35272
35272
  if (err) return self.onStatError(err);
35273
35273
  return self.error(404);
35274
35274
  }
35275
- var p = join(path$65, self._index[i]);
35275
+ var p = join(path$66, self._index[i]);
35276
35276
  debug("stat \"%s\"", p);
35277
- fs$18.stat(p, function(err, stat) {
35277
+ fs$19.stat(p, function(err, stat) {
35278
35278
  if (err) return next(err);
35279
35279
  if (stat.isDirectory()) return next();
35280
35280
  self.emit("file", p, stat);
@@ -35290,10 +35290,10 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35290
35290
  * @param {Object} options
35291
35291
  * @api private
35292
35292
  */
35293
- SendStream.prototype.stream = function stream(path$66, options) {
35293
+ SendStream.prototype.stream = function stream(path$67, options) {
35294
35294
  var self = this;
35295
35295
  var res = this.res;
35296
- var stream$5 = fs$18.createReadStream(path$66, options);
35296
+ var stream$5 = fs$19.createReadStream(path$67, options);
35297
35297
  this.emit("stream", stream$5);
35298
35298
  stream$5.pipe(res);
35299
35299
  function cleanup() {
@@ -35315,10 +35315,10 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35315
35315
  * @param {String} path
35316
35316
  * @api private
35317
35317
  */
35318
- SendStream.prototype.type = function type(path$67) {
35318
+ SendStream.prototype.type = function type(path$68) {
35319
35319
  var res = this.res;
35320
35320
  if (res.getHeader("Content-Type")) return;
35321
- var type = mime.lookup(path$67);
35321
+ var type = mime.lookup(path$68);
35322
35322
  if (!type) {
35323
35323
  debug("no content-type");
35324
35324
  return;
@@ -35335,9 +35335,9 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35335
35335
  * @param {Object} stat
35336
35336
  * @api private
35337
35337
  */
35338
- SendStream.prototype.setHeader = function setHeader(path$68, stat) {
35338
+ SendStream.prototype.setHeader = function setHeader(path$69, stat) {
35339
35339
  var res = this.res;
35340
- this.emit("headers", res, path$68, stat);
35340
+ this.emit("headers", res, path$69, stat);
35341
35341
  if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
35342
35342
  debug("accept ranges");
35343
35343
  res.setHeader("Accept-Ranges", "bytes");
@@ -35431,9 +35431,9 @@ var require_send = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35431
35431
  * @param {String} path
35432
35432
  * @api private
35433
35433
  */
35434
- function decode(path$69) {
35434
+ function decode(path$70) {
35435
35435
  try {
35436
- return decodeURIComponent(path$69);
35436
+ return decodeURIComponent(path$70);
35437
35437
  } catch (err) {
35438
35438
  return -1;
35439
35439
  }
@@ -36855,13 +36855,13 @@ var require_application = /* @__PURE__ */ __commonJSMin(((exports, module) => {
36855
36855
  */
36856
36856
  app.use = function use(fn) {
36857
36857
  var offset = 0;
36858
- var path$53 = "/";
36858
+ var path$54 = "/";
36859
36859
  if (typeof fn !== "function") {
36860
36860
  var arg = fn;
36861
36861
  while (Array.isArray(arg) && arg.length !== 0) arg = arg[0];
36862
36862
  if (typeof arg !== "function") {
36863
36863
  offset = 1;
36864
- path$53 = fn;
36864
+ path$54 = fn;
36865
36865
  }
36866
36866
  }
36867
36867
  var fns = flatten(slice.call(arguments, offset));
@@ -36869,11 +36869,11 @@ var require_application = /* @__PURE__ */ __commonJSMin(((exports, module) => {
36869
36869
  this.lazyrouter();
36870
36870
  var router = this._router;
36871
36871
  fns.forEach(function(fn) {
36872
- if (!fn || !fn.handle || !fn.set) return router.use(path$53, fn);
36873
- debug(".use app under %s", path$53);
36874
- fn.mountpath = path$53;
36872
+ if (!fn || !fn.handle || !fn.set) return router.use(path$54, fn);
36873
+ debug(".use app under %s", path$54);
36874
+ fn.mountpath = path$54;
36875
36875
  fn.parent = this;
36876
- router.use(path$53, function mounted_app(req, res, next) {
36876
+ router.use(path$54, function mounted_app(req, res, next) {
36877
36877
  var orig = req.app;
36878
36878
  fn.handle(req, res, function(err) {
36879
36879
  setPrototypeOf(req, orig.request);
@@ -36894,9 +36894,9 @@ var require_application = /* @__PURE__ */ __commonJSMin(((exports, module) => {
36894
36894
  *
36895
36895
  * @public
36896
36896
  */
36897
- app.route = function route(path$54) {
36897
+ app.route = function route(path$55) {
36898
36898
  this.lazyrouter();
36899
- return this._router.route(path$54);
36899
+ return this._router.route(path$55);
36900
36900
  };
36901
36901
  /**
36902
36902
  * Register the given template engine callback `fn`
@@ -37012,7 +37012,7 @@ var require_application = /* @__PURE__ */ __commonJSMin(((exports, module) => {
37012
37012
  * @return {String}
37013
37013
  * @private
37014
37014
  */
37015
- app.path = function path$55() {
37015
+ app.path = function path$56() {
37016
37016
  return this.parent ? this.parent.path() + this.mountpath : "";
37017
37017
  };
37018
37018
  /**
@@ -37073,10 +37073,10 @@ var require_application = /* @__PURE__ */ __commonJSMin(((exports, module) => {
37073
37073
  * Delegate `.VERB(...)` calls to `router.VERB(...)`.
37074
37074
  */
37075
37075
  methods.forEach(function(method) {
37076
- app[method] = function(path$56) {
37077
- if (method === "get" && arguments.length === 1) return this.set(path$56);
37076
+ app[method] = function(path$57) {
37077
+ if (method === "get" && arguments.length === 1) return this.set(path$57);
37078
37078
  this.lazyrouter();
37079
- var route = this._router.route(path$56);
37079
+ var route = this._router.route(path$57);
37080
37080
  route[method].apply(route, slice.call(arguments, 1));
37081
37081
  return this;
37082
37082
  };
@@ -37090,9 +37090,9 @@ var require_application = /* @__PURE__ */ __commonJSMin(((exports, module) => {
37090
37090
  * @return {app} for chaining
37091
37091
  * @public
37092
37092
  */
37093
- app.all = function all(path$57) {
37093
+ app.all = function all(path$58) {
37094
37094
  this.lazyrouter();
37095
- var route = this._router.route(path$57);
37095
+ var route = this._router.route(path$58);
37096
37096
  var args = slice.call(arguments, 1);
37097
37097
  for (var i = 0; i < methods.length; i++) route[methods[i]].apply(route, args);
37098
37098
  return this;
@@ -38827,7 +38827,7 @@ var require_response = /* @__PURE__ */ __commonJSMin(((exports, module) => {
38827
38827
  var http$3 = require("http");
38828
38828
  var isAbsolute = require_utils$1().isAbsolute;
38829
38829
  var onFinished = require_on_finished();
38830
- var path$17 = require("path");
38830
+ var path$18 = require("path");
38831
38831
  var statuses = require_statuses();
38832
38832
  var merge = require_utils_merge();
38833
38833
  var sign = require_cookie_signature().sign;
@@ -38836,9 +38836,9 @@ var require_response = /* @__PURE__ */ __commonJSMin(((exports, module) => {
38836
38836
  var setCharset = require_utils$1().setCharset;
38837
38837
  var cookie = require_cookie();
38838
38838
  var send = require_send();
38839
- var extname = path$17.extname;
38839
+ var extname = path$18.extname;
38840
38840
  var mime = send.mime;
38841
- var resolve = path$17.resolve;
38841
+ var resolve = path$18.resolve;
38842
38842
  var vary = require_vary();
38843
38843
  /**
38844
38844
  * Response prototype.
@@ -39102,20 +39102,20 @@ var require_response = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39102
39102
  *
39103
39103
  * @public
39104
39104
  */
39105
- res.sendFile = function sendFile(path$50, options, callback) {
39105
+ res.sendFile = function sendFile(path$51, options, callback) {
39106
39106
  var done = callback;
39107
39107
  var req = this.req;
39108
39108
  var res = this;
39109
39109
  var next = req.next;
39110
39110
  var opts = options || {};
39111
- if (!path$50) throw new TypeError("path argument is required to res.sendFile");
39112
- if (typeof path$50 !== "string") throw new TypeError("path must be a string to res.sendFile");
39111
+ if (!path$51) throw new TypeError("path argument is required to res.sendFile");
39112
+ if (typeof path$51 !== "string") throw new TypeError("path must be a string to res.sendFile");
39113
39113
  if (typeof options === "function") {
39114
39114
  done = options;
39115
39115
  opts = {};
39116
39116
  }
39117
- if (!opts.root && !isAbsolute(path$50)) throw new TypeError("path must be absolute or specify root to res.sendFile");
39118
- sendfile(res, send(req, encodeURI(path$50), opts), opts, function(err) {
39117
+ if (!opts.root && !isAbsolute(path$51)) throw new TypeError("path must be absolute or specify root to res.sendFile");
39118
+ sendfile(res, send(req, encodeURI(path$51), opts), opts, function(err) {
39119
39119
  if (done) return done(err);
39120
39120
  if (err && err.code === "EISDIR") return next();
39121
39121
  if (err && err.code !== "ECONNABORTED" && err.syscall !== "write") next(err);
@@ -39161,7 +39161,7 @@ var require_response = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39161
39161
  *
39162
39162
  * @public
39163
39163
  */
39164
- res.sendfile = function(path$51, options, callback) {
39164
+ res.sendfile = function(path$52, options, callback) {
39165
39165
  var done = callback;
39166
39166
  var req = this.req;
39167
39167
  var res = this;
@@ -39171,7 +39171,7 @@ var require_response = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39171
39171
  done = options;
39172
39172
  opts = {};
39173
39173
  }
39174
- sendfile(res, send(req, path$51, opts), opts, function(err) {
39174
+ sendfile(res, send(req, path$52, opts), opts, function(err) {
39175
39175
  if (done) return done(err);
39176
39176
  if (err && err.code === "EISDIR") return next();
39177
39177
  if (err && err.code !== "ECONNABORTED" && err.syscall !== "write") next(err);
@@ -39195,7 +39195,7 @@ var require_response = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39195
39195
  *
39196
39196
  * @public
39197
39197
  */
39198
- res.download = function download(path$52, filename, options, callback) {
39198
+ res.download = function download(path$53, filename, options, callback) {
39199
39199
  var done = callback;
39200
39200
  var name = filename;
39201
39201
  var opts = options || null;
@@ -39211,7 +39211,7 @@ var require_response = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39211
39211
  name = null;
39212
39212
  opts = filename;
39213
39213
  }
39214
- var headers = { "Content-Disposition": contentDisposition(name || path$52) };
39214
+ var headers = { "Content-Disposition": contentDisposition(name || path$53) };
39215
39215
  if (opts && opts.headers) {
39216
39216
  var keys = Object.keys(opts.headers);
39217
39217
  for (var i = 0; i < keys.length; i++) {
@@ -39221,7 +39221,7 @@ var require_response = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39221
39221
  }
39222
39222
  opts = Object.create(opts);
39223
39223
  opts.headers = headers;
39224
- var fullPath = !opts.root ? resolve(path$52) : path$52;
39224
+ var fullPath = !opts.root ? resolve(path$53) : path$53;
39225
39225
  return this.sendFile(fullPath, opts, done);
39226
39226
  };
39227
39227
  /**
@@ -39707,9 +39707,9 @@ var require_serve_static = /* @__PURE__ */ __commonJSMin(((exports, module) => {
39707
39707
  }
39708
39708
  var forwardError = !fallthrough;
39709
39709
  var originalUrl = parseUrl.original(req);
39710
- var path$49 = parseUrl(req).pathname;
39711
- if (path$49 === "/" && originalUrl.pathname.substr(-1) !== "/") path$49 = "";
39712
- var stream = send(req, path$49, opts);
39710
+ var path$50 = parseUrl(req).pathname;
39711
+ if (path$50 === "/" && originalUrl.pathname.substr(-1) !== "/") path$50 = "";
39712
+ var stream = send(req, path$50, opts);
39713
39713
  stream.on("directory", onDirectory);
39714
39714
  if (setHeaders) stream.on("headers", setHeaders);
39715
39715
  if (fallthrough) stream.on("file", function onFile() {
@@ -75699,6 +75699,14 @@ function stateReplaceField(content, fieldName, newValue) {
75699
75699
  * Ported from maxsim/bin/lib/verify.cjs
75700
75700
  */
75701
75701
 
75702
+ //#endregion
75703
+ //#region ../cli/src/core/drift.ts
75704
+ /**
75705
+ * Drift — Drift report CRUD, requirement extraction, and spec extraction
75706
+ *
75707
+ * Provides CLI tool commands for the drift-checker agent and realign workflow.
75708
+ */
75709
+
75702
75710
  //#endregion
75703
75711
  //#region ../cli/src/core/phase.ts
75704
75712
  /**
@@ -76319,14 +76327,14 @@ const FsWatchInstances = /* @__PURE__ */ new Map();
76319
76327
  * @param emitRaw emits raw event data
76320
76328
  * @returns {NativeFsWatcher}
76321
76329
  */
76322
- function createFsWatchInstance(path$41, options, listener, errHandler, emitRaw) {
76330
+ function createFsWatchInstance(path$42, options, listener, errHandler, emitRaw) {
76323
76331
  const handleEvent = (rawEvent, evPath) => {
76324
- listener(path$41);
76325
- emitRaw(rawEvent, evPath, { watchedPath: path$41 });
76326
- if (evPath && path$41 !== evPath) fsWatchBroadcast(path.resolve(path$41, evPath), KEY_LISTENERS, path.join(path$41, evPath));
76332
+ listener(path$42);
76333
+ emitRaw(rawEvent, evPath, { watchedPath: path$42 });
76334
+ if (evPath && path$42 !== evPath) fsWatchBroadcast(path.resolve(path$42, evPath), KEY_LISTENERS, path.join(path$42, evPath));
76327
76335
  };
76328
76336
  try {
76329
- return (0, fs.watch)(path$41, { persistent: options.persistent }, handleEvent);
76337
+ return (0, fs.watch)(path$42, { persistent: options.persistent }, handleEvent);
76330
76338
  } catch (error) {
76331
76339
  errHandler(error);
76332
76340
  return;
@@ -76351,12 +76359,12 @@ const fsWatchBroadcast = (fullPath, listenerType, val1, val2, val3) => {
76351
76359
  * @param options to be passed to fs_watch
76352
76360
  * @param handlers container for event listener functions
76353
76361
  */
76354
- const setFsWatchListener = (path$45, fullPath, options, handlers) => {
76362
+ const setFsWatchListener = (path$46, fullPath, options, handlers) => {
76355
76363
  const { listener, errHandler, rawEmitter } = handlers;
76356
76364
  let cont = FsWatchInstances.get(fullPath);
76357
76365
  let watcher;
76358
76366
  if (!options.persistent) {
76359
- watcher = createFsWatchInstance(path$45, options, listener, errHandler, rawEmitter);
76367
+ watcher = createFsWatchInstance(path$46, options, listener, errHandler, rawEmitter);
76360
76368
  if (!watcher) return;
76361
76369
  return watcher.close.bind(watcher);
76362
76370
  }
@@ -76365,13 +76373,13 @@ const setFsWatchListener = (path$45, fullPath, options, handlers) => {
76365
76373
  addAndConvert(cont, KEY_ERR, errHandler);
76366
76374
  addAndConvert(cont, KEY_RAW, rawEmitter);
76367
76375
  } else {
76368
- watcher = createFsWatchInstance(path$45, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
76376
+ watcher = createFsWatchInstance(path$46, options, fsWatchBroadcast.bind(null, fullPath, KEY_LISTENERS), errHandler, fsWatchBroadcast.bind(null, fullPath, KEY_RAW));
76369
76377
  if (!watcher) return;
76370
76378
  watcher.on(EV.ERROR, async (error) => {
76371
76379
  const broadcastErr = fsWatchBroadcast.bind(null, fullPath, KEY_ERR);
76372
76380
  if (cont) cont.watcherUnusable = true;
76373
76381
  if (isWindows && error.code === "EPERM") try {
76374
- await (await (0, fs_promises.open)(path$45, "r")).close();
76382
+ await (await (0, fs_promises.open)(path$46, "r")).close();
76375
76383
  broadcastErr(error);
76376
76384
  } catch (err) {}
76377
76385
  else broadcastErr(error);
@@ -76407,7 +76415,7 @@ const FsWatchFileInstances = /* @__PURE__ */ new Map();
76407
76415
  * @param handlers container for event listener functions
76408
76416
  * @returns closer
76409
76417
  */
76410
- const setFsWatchFileListener = (path$46, fullPath, options, handlers) => {
76418
+ const setFsWatchFileListener = (path$47, fullPath, options, handlers) => {
76411
76419
  const { listener, rawEmitter } = handlers;
76412
76420
  let cont = FsWatchFileInstances.get(fullPath);
76413
76421
  const copts = cont && cont.options;
@@ -76431,7 +76439,7 @@ const setFsWatchFileListener = (path$46, fullPath, options, handlers) => {
76431
76439
  });
76432
76440
  });
76433
76441
  const currmtime = curr.mtimeMs;
76434
- if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) foreach(cont.listeners, (listener) => listener(path$46, curr));
76442
+ if (curr.size !== prev.size || currmtime > prev.mtimeMs || currmtime === 0) foreach(cont.listeners, (listener) => listener(path$47, curr));
76435
76443
  })
76436
76444
  };
76437
76445
  FsWatchFileInstances.set(fullPath, cont);
@@ -76461,22 +76469,22 @@ var NodeFsHandler = class {
76461
76469
  * @param listener on fs change
76462
76470
  * @returns closer for the watcher instance
76463
76471
  */
76464
- _watchWithNodeFs(path$42, listener) {
76472
+ _watchWithNodeFs(path$43, listener) {
76465
76473
  const opts = this.fsw.options;
76466
- const directory = path.dirname(path$42);
76467
- const basename = path.basename(path$42);
76474
+ const directory = path.dirname(path$43);
76475
+ const basename = path.basename(path$43);
76468
76476
  this.fsw._getWatchedDir(directory).add(basename);
76469
- const absolutePath = path.resolve(path$42);
76477
+ const absolutePath = path.resolve(path$43);
76470
76478
  const options = { persistent: opts.persistent };
76471
76479
  if (!listener) listener = EMPTY_FN;
76472
76480
  let closer;
76473
76481
  if (opts.usePolling) {
76474
76482
  options.interval = opts.interval !== opts.binaryInterval && isBinaryPath(basename) ? opts.binaryInterval : opts.interval;
76475
- closer = setFsWatchFileListener(path$42, absolutePath, options, {
76483
+ closer = setFsWatchFileListener(path$43, absolutePath, options, {
76476
76484
  listener,
76477
76485
  rawEmitter: this.fsw._emitRaw
76478
76486
  });
76479
- } else closer = setFsWatchListener(path$42, absolutePath, options, {
76487
+ } else closer = setFsWatchListener(path$43, absolutePath, options, {
76480
76488
  listener,
76481
76489
  errHandler: this._boundHandleError,
76482
76490
  rawEmitter: this.fsw._emitRaw
@@ -76494,7 +76502,7 @@ var NodeFsHandler = class {
76494
76502
  const parent = this.fsw._getWatchedDir(dirname);
76495
76503
  let prevStats = stats;
76496
76504
  if (parent.has(basename)) return;
76497
- const listener = async (path$47, newStats) => {
76505
+ const listener = async (path$48, newStats) => {
76498
76506
  if (!this.fsw._throttle(THROTTLE_MODE_WATCH, file, 5)) return;
76499
76507
  if (!newStats || newStats.mtimeMs === 0) try {
76500
76508
  const newStats = await (0, fs_promises.stat)(file);
@@ -76503,10 +76511,10 @@ var NodeFsHandler = class {
76503
76511
  const mt = newStats.mtimeMs;
76504
76512
  if (!at || at <= mt || mt !== prevStats.mtimeMs) this.fsw._emit(EV.CHANGE, file, newStats);
76505
76513
  if ((isMacos || isLinux || isFreeBSD) && prevStats.ino !== newStats.ino) {
76506
- this.fsw._closeFile(path$47);
76514
+ this.fsw._closeFile(path$48);
76507
76515
  prevStats = newStats;
76508
76516
  const closer = this._watchWithNodeFs(file, listener);
76509
- if (closer) this.fsw._addPathCloser(path$47, closer);
76517
+ if (closer) this.fsw._addPathCloser(path$48, closer);
76510
76518
  } else prevStats = newStats;
76511
76519
  } catch (error) {
76512
76520
  this.fsw._remove(dirname, basename);
@@ -76533,7 +76541,7 @@ var NodeFsHandler = class {
76533
76541
  * @param item basename of this item
76534
76542
  * @returns true if no more processing is needed for this entry.
76535
76543
  */
76536
- async _handleSymlink(entry, directory, path$48, item) {
76544
+ async _handleSymlink(entry, directory, path$49, item) {
76537
76545
  if (this.fsw.closed) return;
76538
76546
  const full = entry.fullPath;
76539
76547
  const dir = this.fsw._getWatchedDir(directory);
@@ -76541,7 +76549,7 @@ var NodeFsHandler = class {
76541
76549
  this.fsw._incrReadyCount();
76542
76550
  let linkPath;
76543
76551
  try {
76544
- linkPath = await (0, fs_promises.realpath)(path$48);
76552
+ linkPath = await (0, fs_promises.realpath)(path$49);
76545
76553
  } catch (e) {
76546
76554
  this.fsw._emitReady();
76547
76555
  return true;
@@ -76550,12 +76558,12 @@ var NodeFsHandler = class {
76550
76558
  if (dir.has(item)) {
76551
76559
  if (this.fsw._symlinkPaths.get(full) !== linkPath) {
76552
76560
  this.fsw._symlinkPaths.set(full, linkPath);
76553
- this.fsw._emit(EV.CHANGE, path$48, entry.stats);
76561
+ this.fsw._emit(EV.CHANGE, path$49, entry.stats);
76554
76562
  }
76555
76563
  } else {
76556
76564
  dir.add(item);
76557
76565
  this.fsw._symlinkPaths.set(full, linkPath);
76558
- this.fsw._emit(EV.ADD, path$48, entry.stats);
76566
+ this.fsw._emit(EV.ADD, path$49, entry.stats);
76559
76567
  }
76560
76568
  this.fsw._emitReady();
76561
76569
  return true;
@@ -76580,17 +76588,17 @@ var NodeFsHandler = class {
76580
76588
  return;
76581
76589
  }
76582
76590
  const item = entry.path;
76583
- let path$43 = path.join(directory, item);
76591
+ let path$44 = path.join(directory, item);
76584
76592
  current.add(item);
76585
- if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path$43, item)) return;
76593
+ if (entry.stats.isSymbolicLink() && await this._handleSymlink(entry, directory, path$44, item)) return;
76586
76594
  if (this.fsw.closed) {
76587
76595
  stream = void 0;
76588
76596
  return;
76589
76597
  }
76590
76598
  if (item === target || !target && !previous.has(item)) {
76591
76599
  this.fsw._incrReadyCount();
76592
- path$43 = path.join(dir, path.relative(dir, path$43));
76593
- this._addToNodeFs(path$43, initialAdd, wh, depth + 1);
76600
+ path$44 = path.join(dir, path.relative(dir, path$44));
76601
+ this._addToNodeFs(path$44, initialAdd, wh, depth + 1);
76594
76602
  }
76595
76603
  }).on(EV.ERROR, this._boundHandleError);
76596
76604
  return new Promise((resolve, reject) => {
@@ -76653,13 +76661,13 @@ var NodeFsHandler = class {
76653
76661
  * @param depth Child path actually targeted for watch
76654
76662
  * @param target Child path actually targeted for watch
76655
76663
  */
76656
- async _addToNodeFs(path$44, initialAdd, priorWh, depth, target) {
76664
+ async _addToNodeFs(path$45, initialAdd, priorWh, depth, target) {
76657
76665
  const ready = this.fsw._emitReady;
76658
- if (this.fsw._isIgnored(path$44) || this.fsw.closed) {
76666
+ if (this.fsw._isIgnored(path$45) || this.fsw.closed) {
76659
76667
  ready();
76660
76668
  return false;
76661
76669
  }
76662
- const wh = this.fsw._getWatchHelpers(path$44);
76670
+ const wh = this.fsw._getWatchHelpers(path$45);
76663
76671
  if (priorWh) {
76664
76672
  wh.filterPath = (entry) => priorWh.filterPath(entry);
76665
76673
  wh.filterDir = (entry) => priorWh.filterDir(entry);
@@ -76674,29 +76682,29 @@ var NodeFsHandler = class {
76674
76682
  const follow = this.fsw.options.followSymlinks;
76675
76683
  let closer;
76676
76684
  if (stats.isDirectory()) {
76677
- const absPath = path.resolve(path$44);
76678
- const targetPath = follow ? await (0, fs_promises.realpath)(path$44) : path$44;
76685
+ const absPath = path.resolve(path$45);
76686
+ const targetPath = follow ? await (0, fs_promises.realpath)(path$45) : path$45;
76679
76687
  if (this.fsw.closed) return;
76680
76688
  closer = await this._handleDir(wh.watchPath, stats, initialAdd, depth, target, wh, targetPath);
76681
76689
  if (this.fsw.closed) return;
76682
76690
  if (absPath !== targetPath && targetPath !== void 0) this.fsw._symlinkPaths.set(absPath, targetPath);
76683
76691
  } else if (stats.isSymbolicLink()) {
76684
- const targetPath = follow ? await (0, fs_promises.realpath)(path$44) : path$44;
76692
+ const targetPath = follow ? await (0, fs_promises.realpath)(path$45) : path$45;
76685
76693
  if (this.fsw.closed) return;
76686
76694
  const parent = path.dirname(wh.watchPath);
76687
76695
  this.fsw._getWatchedDir(parent).add(wh.watchPath);
76688
76696
  this.fsw._emit(EV.ADD, wh.watchPath, stats);
76689
- closer = await this._handleDir(parent, stats, initialAdd, depth, path$44, wh, targetPath);
76697
+ closer = await this._handleDir(parent, stats, initialAdd, depth, path$45, wh, targetPath);
76690
76698
  if (this.fsw.closed) return;
76691
- if (targetPath !== void 0) this.fsw._symlinkPaths.set(path.resolve(path$44), targetPath);
76699
+ if (targetPath !== void 0) this.fsw._symlinkPaths.set(path.resolve(path$45), targetPath);
76692
76700
  } else closer = this._handleFile(wh.watchPath, stats, initialAdd);
76693
76701
  ready();
76694
- if (closer) this.fsw._addPathCloser(path$44, closer);
76702
+ if (closer) this.fsw._addPathCloser(path$45, closer);
76695
76703
  return false;
76696
76704
  } catch (error) {
76697
76705
  if (this.fsw._handleError(error)) {
76698
76706
  ready();
76699
- return path$44;
76707
+ return path$45;
76700
76708
  }
76701
76709
  }
76702
76710
  }
@@ -76733,22 +76741,22 @@ function createPattern(matcher) {
76733
76741
  };
76734
76742
  return () => false;
76735
76743
  }
76736
- function normalizePath(path$20) {
76737
- if (typeof path$20 !== "string") throw new Error("string expected");
76738
- path$20 = path.normalize(path$20);
76739
- path$20 = path$20.replace(/\\/g, "/");
76744
+ function normalizePath(path$21) {
76745
+ if (typeof path$21 !== "string") throw new Error("string expected");
76746
+ path$21 = path.normalize(path$21);
76747
+ path$21 = path$21.replace(/\\/g, "/");
76740
76748
  let prepend = false;
76741
- if (path$20.startsWith("//")) prepend = true;
76749
+ if (path$21.startsWith("//")) prepend = true;
76742
76750
  const DOUBLE_SLASH_RE = /\/\//;
76743
- while (path$20.match(DOUBLE_SLASH_RE)) path$20 = path$20.replace(DOUBLE_SLASH_RE, "/");
76744
- if (prepend) path$20 = "/" + path$20;
76745
- return path$20;
76751
+ while (path$21.match(DOUBLE_SLASH_RE)) path$21 = path$21.replace(DOUBLE_SLASH_RE, "/");
76752
+ if (prepend) path$21 = "/" + path$21;
76753
+ return path$21;
76746
76754
  }
76747
76755
  function matchPatterns(patterns, testString, stats) {
76748
- const path$30 = normalizePath(testString);
76756
+ const path$31 = normalizePath(testString);
76749
76757
  for (let index = 0; index < patterns.length; index++) {
76750
76758
  const pattern = patterns[index];
76751
- if (pattern(path$30, stats)) return true;
76759
+ if (pattern(path$31, stats)) return true;
76752
76760
  }
76753
76761
  return false;
76754
76762
  }
@@ -76773,14 +76781,14 @@ const toUnix = (string) => {
76773
76781
  if (prepend) str = SLASH + str;
76774
76782
  return str;
76775
76783
  };
76776
- const normalizePathToUnix = (path$21) => toUnix(path.normalize(toUnix(path$21)));
76777
- const normalizeIgnored = (cwd = "") => (path$22) => {
76778
- if (typeof path$22 === "string") return normalizePathToUnix(path.isAbsolute(path$22) ? path$22 : path.join(cwd, path$22));
76779
- else return path$22;
76784
+ const normalizePathToUnix = (path$22) => toUnix(path.normalize(toUnix(path$22)));
76785
+ const normalizeIgnored = (cwd = "") => (path$23) => {
76786
+ if (typeof path$23 === "string") return normalizePathToUnix(path.isAbsolute(path$23) ? path$23 : path.join(cwd, path$23));
76787
+ else return path$23;
76780
76788
  };
76781
- const getAbsolutePath = (path$23, cwd) => {
76782
- if (path.isAbsolute(path$23)) return path$23;
76783
- return path.join(cwd, path$23);
76789
+ const getAbsolutePath = (path$24, cwd) => {
76790
+ if (path.isAbsolute(path$24)) return path$24;
76791
+ return path.join(cwd, path$24);
76784
76792
  };
76785
76793
  const EMPTY_SET = Object.freeze(/* @__PURE__ */ new Set());
76786
76794
  /**
@@ -76830,10 +76838,10 @@ var DirEntry = class {
76830
76838
  const STAT_METHOD_F = "stat";
76831
76839
  const STAT_METHOD_L = "lstat";
76832
76840
  var WatchHelper = class {
76833
- constructor(path$24, follow, fsw) {
76841
+ constructor(path$25, follow, fsw) {
76834
76842
  this.fsw = fsw;
76835
- const watchPath = path$24;
76836
- this.path = path$24 = path$24.replace(REPLACER_RE, "");
76843
+ const watchPath = path$25;
76844
+ this.path = path$25 = path$25.replace(REPLACER_RE, "");
76837
76845
  this.watchPath = watchPath;
76838
76846
  this.fullWatchPath = path.resolve(watchPath);
76839
76847
  this.dirParts = [];
@@ -76946,17 +76954,17 @@ var FSWatcher = class extends events.EventEmitter {
76946
76954
  this.closed = false;
76947
76955
  this._closePromise = void 0;
76948
76956
  let paths = unifyPaths(paths_);
76949
- if (cwd) paths = paths.map((path$31) => {
76950
- return getAbsolutePath(path$31, cwd);
76957
+ if (cwd) paths = paths.map((path$32) => {
76958
+ return getAbsolutePath(path$32, cwd);
76951
76959
  });
76952
- paths.forEach((path$32) => {
76953
- this._removeIgnoredPath(path$32);
76960
+ paths.forEach((path$33) => {
76961
+ this._removeIgnoredPath(path$33);
76954
76962
  });
76955
76963
  this._userIgnored = void 0;
76956
76964
  if (!this._readyCount) this._readyCount = 0;
76957
76965
  this._readyCount += paths.length;
76958
- Promise.all(paths.map(async (path$33) => {
76959
- const res = await this._nodeFsHandler._addToNodeFs(path$33, !_internal, void 0, 0, _origAdd);
76966
+ Promise.all(paths.map(async (path$34) => {
76967
+ const res = await this._nodeFsHandler._addToNodeFs(path$34, !_internal, void 0, 0, _origAdd);
76960
76968
  if (res) this._emitReady();
76961
76969
  return res;
76962
76970
  })).then((results) => {
@@ -76974,15 +76982,15 @@ var FSWatcher = class extends events.EventEmitter {
76974
76982
  if (this.closed) return this;
76975
76983
  const paths = unifyPaths(paths_);
76976
76984
  const { cwd } = this.options;
76977
- paths.forEach((path$25) => {
76978
- if (!path.isAbsolute(path$25) && !this._closers.has(path$25)) {
76979
- if (cwd) path$25 = path.join(cwd, path$25);
76980
- path$25 = path.resolve(path$25);
76981
- }
76982
- this._closePath(path$25);
76983
- this._addIgnoredPath(path$25);
76984
- if (this._watched.has(path$25)) this._addIgnoredPath({
76985
- path: path$25,
76985
+ paths.forEach((path$26) => {
76986
+ if (!path.isAbsolute(path$26) && !this._closers.has(path$26)) {
76987
+ if (cwd) path$26 = path.join(cwd, path$26);
76988
+ path$26 = path.resolve(path$26);
76989
+ }
76990
+ this._closePath(path$26);
76991
+ this._addIgnoredPath(path$26);
76992
+ if (this._watched.has(path$26)) this._addIgnoredPath({
76993
+ path: path$26,
76986
76994
  recursive: true
76987
76995
  });
76988
76996
  this._userIgnored = void 0;
@@ -77038,34 +77046,34 @@ var FSWatcher = class extends events.EventEmitter {
77038
77046
  * @param stats arguments to be passed with event
77039
77047
  * @returns the error if defined, otherwise the value of the FSWatcher instance's `closed` flag
77040
77048
  */
77041
- async _emit(event, path$26, stats) {
77049
+ async _emit(event, path$27, stats) {
77042
77050
  if (this.closed) return;
77043
77051
  const opts = this.options;
77044
- if (isWindows) path$26 = path.normalize(path$26);
77045
- if (opts.cwd) path$26 = path.relative(opts.cwd, path$26);
77046
- const args = [path$26];
77052
+ if (isWindows) path$27 = path.normalize(path$27);
77053
+ if (opts.cwd) path$27 = path.relative(opts.cwd, path$27);
77054
+ const args = [path$27];
77047
77055
  if (stats != null) args.push(stats);
77048
77056
  const awf = opts.awaitWriteFinish;
77049
77057
  let pw;
77050
- if (awf && (pw = this._pendingWrites.get(path$26))) {
77058
+ if (awf && (pw = this._pendingWrites.get(path$27))) {
77051
77059
  pw.lastChange = /* @__PURE__ */ new Date();
77052
77060
  return this;
77053
77061
  }
77054
77062
  if (opts.atomic) {
77055
77063
  if (event === EVENTS.UNLINK) {
77056
- this._pendingUnlinks.set(path$26, [event, ...args]);
77064
+ this._pendingUnlinks.set(path$27, [event, ...args]);
77057
77065
  setTimeout(() => {
77058
- this._pendingUnlinks.forEach((entry, path$34) => {
77066
+ this._pendingUnlinks.forEach((entry, path$35) => {
77059
77067
  this.emit(...entry);
77060
77068
  this.emit(EVENTS.ALL, ...entry);
77061
- this._pendingUnlinks.delete(path$34);
77069
+ this._pendingUnlinks.delete(path$35);
77062
77070
  });
77063
77071
  }, typeof opts.atomic === "number" ? opts.atomic : 100);
77064
77072
  return this;
77065
77073
  }
77066
- if (event === EVENTS.ADD && this._pendingUnlinks.has(path$26)) {
77074
+ if (event === EVENTS.ADD && this._pendingUnlinks.has(path$27)) {
77067
77075
  event = EVENTS.CHANGE;
77068
- this._pendingUnlinks.delete(path$26);
77076
+ this._pendingUnlinks.delete(path$27);
77069
77077
  }
77070
77078
  }
77071
77079
  if (awf && (event === EVENTS.ADD || event === EVENTS.CHANGE) && this._readyEmitted) {
@@ -77080,14 +77088,14 @@ var FSWatcher = class extends events.EventEmitter {
77080
77088
  this.emitWithAll(event, args);
77081
77089
  }
77082
77090
  };
77083
- this._awaitWriteFinish(path$26, awf.stabilityThreshold, event, awfEmit);
77091
+ this._awaitWriteFinish(path$27, awf.stabilityThreshold, event, awfEmit);
77084
77092
  return this;
77085
77093
  }
77086
77094
  if (event === EVENTS.CHANGE) {
77087
- if (!this._throttle(EVENTS.CHANGE, path$26, 50)) return this;
77095
+ if (!this._throttle(EVENTS.CHANGE, path$27, 50)) return this;
77088
77096
  }
77089
77097
  if (opts.alwaysStat && stats === void 0 && (event === EVENTS.ADD || event === EVENTS.ADD_DIR || event === EVENTS.CHANGE)) {
77090
- const fullPath = opts.cwd ? path.join(opts.cwd, path$26) : path$26;
77098
+ const fullPath = opts.cwd ? path.join(opts.cwd, path$27) : path$27;
77091
77099
  let stats;
77092
77100
  try {
77093
77101
  stats = await (0, fs_promises.stat)(fullPath);
@@ -77114,20 +77122,20 @@ var FSWatcher = class extends events.EventEmitter {
77114
77122
  * @param timeout duration of time to suppress duplicate actions
77115
77123
  * @returns tracking object or false if action should be suppressed
77116
77124
  */
77117
- _throttle(actionType, path$35, timeout) {
77125
+ _throttle(actionType, path$36, timeout) {
77118
77126
  if (!this._throttled.has(actionType)) this._throttled.set(actionType, /* @__PURE__ */ new Map());
77119
77127
  const action = this._throttled.get(actionType);
77120
77128
  if (!action) throw new Error("invalid throttle");
77121
- const actionPath = action.get(path$35);
77129
+ const actionPath = action.get(path$36);
77122
77130
  if (actionPath) {
77123
77131
  actionPath.count++;
77124
77132
  return false;
77125
77133
  }
77126
77134
  let timeoutObject;
77127
77135
  const clear = () => {
77128
- const item = action.get(path$35);
77136
+ const item = action.get(path$36);
77129
77137
  const count = item ? item.count : 0;
77130
- action.delete(path$35);
77138
+ action.delete(path$36);
77131
77139
  clearTimeout(timeoutObject);
77132
77140
  if (item) clearTimeout(item.timeoutObject);
77133
77141
  return count;
@@ -77138,7 +77146,7 @@ var FSWatcher = class extends events.EventEmitter {
77138
77146
  clear,
77139
77147
  count: 0
77140
77148
  };
77141
- action.set(path$35, thr);
77149
+ action.set(path$36, thr);
77142
77150
  return thr;
77143
77151
  }
77144
77152
  _incrReadyCount() {
@@ -77152,34 +77160,34 @@ var FSWatcher = class extends events.EventEmitter {
77152
77160
  * @param event
77153
77161
  * @param awfEmit Callback to be called when ready for event to be emitted.
77154
77162
  */
77155
- _awaitWriteFinish(path$27, threshold, event, awfEmit) {
77163
+ _awaitWriteFinish(path$28, threshold, event, awfEmit) {
77156
77164
  const awf = this.options.awaitWriteFinish;
77157
77165
  if (typeof awf !== "object") return;
77158
77166
  const pollInterval = awf.pollInterval;
77159
77167
  let timeoutHandler;
77160
- let fullPath = path$27;
77161
- if (this.options.cwd && !path.isAbsolute(path$27)) fullPath = path.join(this.options.cwd, path$27);
77168
+ let fullPath = path$28;
77169
+ if (this.options.cwd && !path.isAbsolute(path$28)) fullPath = path.join(this.options.cwd, path$28);
77162
77170
  const now = /* @__PURE__ */ new Date();
77163
77171
  const writes = this._pendingWrites;
77164
77172
  function awaitWriteFinishFn(prevStat) {
77165
77173
  (0, fs.stat)(fullPath, (err, curStat) => {
77166
- if (err || !writes.has(path$27)) {
77174
+ if (err || !writes.has(path$28)) {
77167
77175
  if (err && err.code !== "ENOENT") awfEmit(err);
77168
77176
  return;
77169
77177
  }
77170
77178
  const now = Number(/* @__PURE__ */ new Date());
77171
- if (prevStat && curStat.size !== prevStat.size) writes.get(path$27).lastChange = now;
77172
- if (now - writes.get(path$27).lastChange >= threshold) {
77173
- writes.delete(path$27);
77179
+ if (prevStat && curStat.size !== prevStat.size) writes.get(path$28).lastChange = now;
77180
+ if (now - writes.get(path$28).lastChange >= threshold) {
77181
+ writes.delete(path$28);
77174
77182
  awfEmit(void 0, curStat);
77175
77183
  } else timeoutHandler = setTimeout(awaitWriteFinishFn, pollInterval, curStat);
77176
77184
  });
77177
77185
  }
77178
- if (!writes.has(path$27)) {
77179
- writes.set(path$27, {
77186
+ if (!writes.has(path$28)) {
77187
+ writes.set(path$28, {
77180
77188
  lastChange: now,
77181
77189
  cancelWait: () => {
77182
- writes.delete(path$27);
77190
+ writes.delete(path$28);
77183
77191
  clearTimeout(timeoutHandler);
77184
77192
  return event;
77185
77193
  }
@@ -77190,24 +77198,24 @@ var FSWatcher = class extends events.EventEmitter {
77190
77198
  /**
77191
77199
  * Determines whether user has asked to ignore this path.
77192
77200
  */
77193
- _isIgnored(path$36, stats) {
77194
- if (this.options.atomic && DOT_RE.test(path$36)) return true;
77201
+ _isIgnored(path$37, stats) {
77202
+ if (this.options.atomic && DOT_RE.test(path$37)) return true;
77195
77203
  if (!this._userIgnored) {
77196
77204
  const { cwd } = this.options;
77197
77205
  const ignored = (this.options.ignored || []).map(normalizeIgnored(cwd));
77198
77206
  this._userIgnored = anymatch([...[...this._ignoredPaths].map(normalizeIgnored(cwd)), ...ignored], void 0);
77199
77207
  }
77200
- return this._userIgnored(path$36, stats);
77208
+ return this._userIgnored(path$37, stats);
77201
77209
  }
77202
- _isntIgnored(path$37, stat) {
77203
- return !this._isIgnored(path$37, stat);
77210
+ _isntIgnored(path$38, stat) {
77211
+ return !this._isIgnored(path$38, stat);
77204
77212
  }
77205
77213
  /**
77206
77214
  * Provides a set of common helpers and properties relating to symlink handling.
77207
77215
  * @param path file or directory pattern being watched
77208
77216
  */
77209
- _getWatchHelpers(path$38) {
77210
- return new WatchHelper(path$38, this.options.followSymlinks, this);
77217
+ _getWatchHelpers(path$39) {
77218
+ return new WatchHelper(path$39, this.options.followSymlinks, this);
77211
77219
  }
77212
77220
  /**
77213
77221
  * Provides directory tracking objects
@@ -77233,50 +77241,50 @@ var FSWatcher = class extends events.EventEmitter {
77233
77241
  * @param item base path of item/directory
77234
77242
  */
77235
77243
  _remove(directory, item, isDirectory) {
77236
- const path$28 = path.join(directory, item);
77237
- const fullPath = path.resolve(path$28);
77238
- isDirectory = isDirectory != null ? isDirectory : this._watched.has(path$28) || this._watched.has(fullPath);
77239
- if (!this._throttle("remove", path$28, 100)) return;
77244
+ const path$29 = path.join(directory, item);
77245
+ const fullPath = path.resolve(path$29);
77246
+ isDirectory = isDirectory != null ? isDirectory : this._watched.has(path$29) || this._watched.has(fullPath);
77247
+ if (!this._throttle("remove", path$29, 100)) return;
77240
77248
  if (!isDirectory && this._watched.size === 1) this.add(directory, item, true);
77241
- this._getWatchedDir(path$28).getChildren().forEach((nested) => this._remove(path$28, nested));
77249
+ this._getWatchedDir(path$29).getChildren().forEach((nested) => this._remove(path$29, nested));
77242
77250
  const parent = this._getWatchedDir(directory);
77243
77251
  const wasTracked = parent.has(item);
77244
77252
  parent.remove(item);
77245
77253
  if (this._symlinkPaths.has(fullPath)) this._symlinkPaths.delete(fullPath);
77246
- let relPath = path$28;
77247
- if (this.options.cwd) relPath = path.relative(this.options.cwd, path$28);
77254
+ let relPath = path$29;
77255
+ if (this.options.cwd) relPath = path.relative(this.options.cwd, path$29);
77248
77256
  if (this.options.awaitWriteFinish && this._pendingWrites.has(relPath)) {
77249
77257
  if (this._pendingWrites.get(relPath).cancelWait() === EVENTS.ADD) return;
77250
77258
  }
77251
- this._watched.delete(path$28);
77259
+ this._watched.delete(path$29);
77252
77260
  this._watched.delete(fullPath);
77253
77261
  const eventName = isDirectory ? EVENTS.UNLINK_DIR : EVENTS.UNLINK;
77254
- if (wasTracked && !this._isIgnored(path$28)) this._emit(eventName, path$28);
77255
- this._closePath(path$28);
77262
+ if (wasTracked && !this._isIgnored(path$29)) this._emit(eventName, path$29);
77263
+ this._closePath(path$29);
77256
77264
  }
77257
77265
  /**
77258
77266
  * Closes all watchers for a path
77259
77267
  */
77260
- _closePath(path$29) {
77261
- this._closeFile(path$29);
77262
- const dir = path.dirname(path$29);
77263
- this._getWatchedDir(dir).remove(path.basename(path$29));
77268
+ _closePath(path$30) {
77269
+ this._closeFile(path$30);
77270
+ const dir = path.dirname(path$30);
77271
+ this._getWatchedDir(dir).remove(path.basename(path$30));
77264
77272
  }
77265
77273
  /**
77266
77274
  * Closes only file-specific watchers
77267
77275
  */
77268
- _closeFile(path$39) {
77269
- const closers = this._closers.get(path$39);
77276
+ _closeFile(path$40) {
77277
+ const closers = this._closers.get(path$40);
77270
77278
  if (!closers) return;
77271
77279
  closers.forEach((closer) => closer());
77272
- this._closers.delete(path$39);
77280
+ this._closers.delete(path$40);
77273
77281
  }
77274
- _addPathCloser(path$40, closer) {
77282
+ _addPathCloser(path$41, closer) {
77275
77283
  if (!closer) return;
77276
- let list = this._closers.get(path$40);
77284
+ let list = this._closers.get(path$41);
77277
77285
  if (!list) {
77278
77286
  list = [];
77279
- this._closers.set(path$40, list);
77287
+ this._closers.set(path$41, list);
77280
77288
  }
77281
77289
  list.push(closer);
77282
77290
  }