agent-contracts 0.30.1 → 0.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -3952,7 +3952,7 @@ var require_lodash = __commonJS({
3952
3952
  }
3953
3953
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, undefined2, comparator) : [];
3954
3954
  });
3955
- function join4(array, separator) {
3955
+ function join5(array, separator) {
3956
3956
  return array == null ? "" : nativeJoin.call(array, separator);
3957
3957
  }
3958
3958
  function last(array) {
@@ -5876,7 +5876,7 @@ var require_lodash = __commonJS({
5876
5876
  lodash.isUndefined = isUndefined;
5877
5877
  lodash.isWeakMap = isWeakMap;
5878
5878
  lodash.isWeakSet = isWeakSet;
5879
- lodash.join = join4;
5879
+ lodash.join = join5;
5880
5880
  lodash.kebabCase = kebabCase;
5881
5881
  lodash.last = last;
5882
5882
  lodash.lastIndexOf = lastIndexOf;
@@ -7497,7 +7497,7 @@ var require_stable = __commonJS({
7497
7497
  return result;
7498
7498
  }
7499
7499
  function stringifyFullFn(key, parent, stack, replacer, indent) {
7500
- var i3, res, join4;
7500
+ var i3, res, join5;
7501
7501
  const originalIndentation = indentation;
7502
7502
  var value = parent[key];
7503
7503
  if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
@@ -7523,12 +7523,12 @@ var require_stable = __commonJS({
7523
7523
  indentation += indent;
7524
7524
  res += `
7525
7525
  ${indentation}`;
7526
- join4 = `,
7526
+ join5 = `,
7527
7527
  ${indentation}`;
7528
7528
  for (i3 = 0; i3 < value.length - 1; i3++) {
7529
7529
  const tmp2 = stringifyFullFn(i3, value, stack, replacer, indent);
7530
7530
  res += tmp2 !== void 0 ? tmp2 : "null";
7531
- res += join4;
7531
+ res += join5;
7532
7532
  }
7533
7533
  const tmp = stringifyFullFn(i3, value, stack, replacer, indent);
7534
7534
  res += tmp !== void 0 ? tmp : "null";
@@ -7550,7 +7550,7 @@ ${originalIndentation}`;
7550
7550
  indentation += indent;
7551
7551
  res += `
7552
7552
  ${indentation}`;
7553
- join4 = `,
7553
+ join5 = `,
7554
7554
  ${indentation}`;
7555
7555
  var separator = "";
7556
7556
  for (i3 = 0; i3 < keys.length; i3++) {
@@ -7558,7 +7558,7 @@ ${indentation}`;
7558
7558
  const tmp = stringifyFullFn(key, value, stack, replacer, indent);
7559
7559
  if (tmp !== void 0) {
7560
7560
  res += `${separator}"${strEscape(key)}": ${tmp}`;
7561
- separator = join4;
7561
+ separator = join5;
7562
7562
  }
7563
7563
  }
7564
7564
  if (separator !== "") {
@@ -7580,7 +7580,7 @@ ${originalIndentation}`;
7580
7580
  }
7581
7581
  }
7582
7582
  function stringifyFullArr(key, value, stack, replacer, indent) {
7583
- var i3, res, join4;
7583
+ var i3, res, join5;
7584
7584
  const originalIndentation = indentation;
7585
7585
  if (typeof value === "object" && value !== null && typeof value.toJSON === "function") {
7586
7586
  value = value.toJSON(key);
@@ -7604,12 +7604,12 @@ ${originalIndentation}`;
7604
7604
  indentation += indent;
7605
7605
  res += `
7606
7606
  ${indentation}`;
7607
- join4 = `,
7607
+ join5 = `,
7608
7608
  ${indentation}`;
7609
7609
  for (i3 = 0; i3 < value.length - 1; i3++) {
7610
7610
  const tmp2 = stringifyFullArr(i3, value[i3], stack, replacer, indent);
7611
7611
  res += tmp2 !== void 0 ? tmp2 : "null";
7612
- res += join4;
7612
+ res += join5;
7613
7613
  }
7614
7614
  const tmp = stringifyFullArr(i3, value[i3], stack, replacer, indent);
7615
7615
  res += tmp !== void 0 ? tmp : "null";
@@ -7630,7 +7630,7 @@ ${originalIndentation}`;
7630
7630
  indentation += indent;
7631
7631
  res += `
7632
7632
  ${indentation}`;
7633
- join4 = `,
7633
+ join5 = `,
7634
7634
  ${indentation}`;
7635
7635
  var separator = "";
7636
7636
  for (i3 = 0; i3 < replacer.length; i3++) {
@@ -7639,7 +7639,7 @@ ${indentation}`;
7639
7639
  const tmp = stringifyFullArr(key, value[key], stack, replacer, indent);
7640
7640
  if (tmp !== void 0) {
7641
7641
  res += `${separator}"${strEscape(key)}": ${tmp}`;
7642
- separator = join4;
7642
+ separator = join5;
7643
7643
  }
7644
7644
  }
7645
7645
  }
@@ -7662,7 +7662,7 @@ ${originalIndentation}`;
7662
7662
  }
7663
7663
  }
7664
7664
  function stringifyIndent(key, value, stack, indent) {
7665
- var i3, res, join4;
7665
+ var i3, res, join5;
7666
7666
  const originalIndentation = indentation;
7667
7667
  switch (typeof value) {
7668
7668
  case "object":
@@ -7692,12 +7692,12 @@ ${originalIndentation}`;
7692
7692
  indentation += indent;
7693
7693
  res += `
7694
7694
  ${indentation}`;
7695
- join4 = `,
7695
+ join5 = `,
7696
7696
  ${indentation}`;
7697
7697
  for (i3 = 0; i3 < value.length - 1; i3++) {
7698
7698
  const tmp2 = stringifyIndent(i3, value[i3], stack, indent);
7699
7699
  res += tmp2 !== void 0 ? tmp2 : "null";
7700
- res += join4;
7700
+ res += join5;
7701
7701
  }
7702
7702
  const tmp = stringifyIndent(i3, value[i3], stack, indent);
7703
7703
  res += tmp !== void 0 ? tmp : "null";
@@ -7719,7 +7719,7 @@ ${originalIndentation}`;
7719
7719
  indentation += indent;
7720
7720
  res += `
7721
7721
  ${indentation}`;
7722
- join4 = `,
7722
+ join5 = `,
7723
7723
  ${indentation}`;
7724
7724
  var separator = "";
7725
7725
  for (i3 = 0; i3 < keys.length; i3++) {
@@ -7727,7 +7727,7 @@ ${indentation}`;
7727
7727
  const tmp = stringifyIndent(key, value[key], stack, indent);
7728
7728
  if (tmp !== void 0) {
7729
7729
  res += `${separator}"${strEscape(key)}": ${tmp}`;
7730
- separator = join4;
7730
+ separator = join5;
7731
7731
  }
7732
7732
  }
7733
7733
  if (separator !== "") {
@@ -39128,916 +39128,19 @@ var require_runner3 = __commonJS({
39128
39128
  }
39129
39129
  });
39130
39130
 
39131
- // node_modules/concat-map/index.js
39132
- var require_concat_map = __commonJS({
39133
- "node_modules/concat-map/index.js"(exports, module) {
39134
- "use strict";
39135
- module.exports = function(xs, fn) {
39136
- var res = [];
39137
- for (var i3 = 0; i3 < xs.length; i3++) {
39138
- var x3 = fn(xs[i3], i3);
39139
- if (isArray(x3)) res.push.apply(res, x3);
39140
- else res.push(x3);
39141
- }
39142
- return res;
39143
- };
39144
- var isArray = Array.isArray || function(xs) {
39145
- return Object.prototype.toString.call(xs) === "[object Array]";
39146
- };
39147
- }
39148
- });
39149
-
39150
- // node_modules/balanced-match/index.js
39151
- var require_balanced_match = __commonJS({
39152
- "node_modules/balanced-match/index.js"(exports, module) {
39153
- "use strict";
39154
- module.exports = balanced;
39155
- function balanced(a3, b3, str) {
39156
- if (a3 instanceof RegExp) a3 = maybeMatch(a3, str);
39157
- if (b3 instanceof RegExp) b3 = maybeMatch(b3, str);
39158
- var r3 = range(a3, b3, str);
39159
- return r3 && {
39160
- start: r3[0],
39161
- end: r3[1],
39162
- pre: str.slice(0, r3[0]),
39163
- body: str.slice(r3[0] + a3.length, r3[1]),
39164
- post: str.slice(r3[1] + b3.length)
39165
- };
39166
- }
39167
- function maybeMatch(reg, str) {
39168
- var m2 = str.match(reg);
39169
- return m2 ? m2[0] : null;
39170
- }
39171
- balanced.range = range;
39172
- function range(a3, b3, str) {
39173
- var begs, beg, left, right, result;
39174
- var ai = str.indexOf(a3);
39175
- var bi = str.indexOf(b3, ai + 1);
39176
- var i3 = ai;
39177
- if (ai >= 0 && bi > 0) {
39178
- if (a3 === b3) {
39179
- return [ai, bi];
39180
- }
39181
- begs = [];
39182
- left = str.length;
39183
- while (i3 >= 0 && !result) {
39184
- if (i3 == ai) {
39185
- begs.push(i3);
39186
- ai = str.indexOf(a3, i3 + 1);
39187
- } else if (begs.length == 1) {
39188
- result = [begs.pop(), bi];
39189
- } else {
39190
- beg = begs.pop();
39191
- if (beg < left) {
39192
- left = beg;
39193
- right = bi;
39194
- }
39195
- bi = str.indexOf(b3, i3 + 1);
39196
- }
39197
- i3 = ai < bi && ai >= 0 ? ai : bi;
39198
- }
39199
- if (begs.length) {
39200
- result = [left, right];
39201
- }
39202
- }
39203
- return result;
39204
- }
39205
- }
39206
- });
39207
-
39208
- // node_modules/brace-expansion/index.js
39209
- var require_brace_expansion = __commonJS({
39210
- "node_modules/brace-expansion/index.js"(exports, module) {
39211
- "use strict";
39212
- var concatMap = require_concat_map();
39213
- var balanced = require_balanced_match();
39214
- module.exports = expandTop;
39215
- var escSlash = "\0SLASH" + Math.random() + "\0";
39216
- var escOpen = "\0OPEN" + Math.random() + "\0";
39217
- var escClose = "\0CLOSE" + Math.random() + "\0";
39218
- var escComma = "\0COMMA" + Math.random() + "\0";
39219
- var escPeriod = "\0PERIOD" + Math.random() + "\0";
39220
- function numeric(str) {
39221
- return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
39222
- }
39223
- function escapeBraces(str) {
39224
- return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
39225
- }
39226
- function unescapeBraces(str) {
39227
- return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
39228
- }
39229
- function parseCommaParts(str) {
39230
- if (!str)
39231
- return [""];
39232
- var parts = [];
39233
- var m2 = balanced("{", "}", str);
39234
- if (!m2)
39235
- return str.split(",");
39236
- var pre = m2.pre;
39237
- var body = m2.body;
39238
- var post = m2.post;
39239
- var p2 = pre.split(",");
39240
- p2[p2.length - 1] += "{" + body + "}";
39241
- var postParts = parseCommaParts(post);
39242
- if (post.length) {
39243
- p2[p2.length - 1] += postParts.shift();
39244
- p2.push.apply(p2, postParts);
39245
- }
39246
- parts.push.apply(parts, p2);
39247
- return parts;
39248
- }
39249
- function expandTop(str, options) {
39250
- if (!str)
39251
- return [];
39252
- options = options || {};
39253
- var max = options.max == null ? Infinity : options.max;
39254
- if (str.substr(0, 2) === "{}") {
39255
- str = "\\{\\}" + str.substr(2);
39256
- }
39257
- return expand(escapeBraces(str), max, true).map(unescapeBraces);
39258
- }
39259
- function embrace(str) {
39260
- return "{" + str + "}";
39261
- }
39262
- function isPadded(el) {
39263
- return /^-?0\d/.test(el);
39264
- }
39265
- function lte(i3, y) {
39266
- return i3 <= y;
39267
- }
39268
- function gte(i3, y) {
39269
- return i3 >= y;
39270
- }
39271
- function expand(str, max, isTop) {
39272
- var expansions = [];
39273
- var m2 = balanced("{", "}", str);
39274
- if (!m2 || /\$$/.test(m2.pre)) return [str];
39275
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m2.body);
39276
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m2.body);
39277
- var isSequence = isNumericSequence || isAlphaSequence;
39278
- var isOptions = m2.body.indexOf(",") >= 0;
39279
- if (!isSequence && !isOptions) {
39280
- if (m2.post.match(/,(?!,).*\}/)) {
39281
- str = m2.pre + "{" + m2.body + escClose + m2.post;
39282
- return expand(str, max, true);
39283
- }
39284
- return [str];
39285
- }
39286
- var n3;
39287
- if (isSequence) {
39288
- n3 = m2.body.split(/\.\./);
39289
- } else {
39290
- n3 = parseCommaParts(m2.body);
39291
- if (n3.length === 1) {
39292
- n3 = expand(n3[0], max, false).map(embrace);
39293
- if (n3.length === 1) {
39294
- var post = m2.post.length ? expand(m2.post, max, false) : [""];
39295
- return post.map(function(p2) {
39296
- return m2.pre + n3[0] + p2;
39297
- });
39298
- }
39299
- }
39300
- }
39301
- var pre = m2.pre;
39302
- var post = m2.post.length ? expand(m2.post, max, false) : [""];
39303
- var N2;
39304
- if (isSequence) {
39305
- var x3 = numeric(n3[0]);
39306
- var y = numeric(n3[1]);
39307
- var width = Math.max(n3[0].length, n3[1].length);
39308
- var incr = n3.length == 3 ? Math.max(Math.abs(numeric(n3[2])), 1) : 1;
39309
- var test = lte;
39310
- var reverse = y < x3;
39311
- if (reverse) {
39312
- incr *= -1;
39313
- test = gte;
39314
- }
39315
- var pad = n3.some(isPadded);
39316
- N2 = [];
39317
- for (var i3 = x3; test(i3, y); i3 += incr) {
39318
- var c2;
39319
- if (isAlphaSequence) {
39320
- c2 = String.fromCharCode(i3);
39321
- if (c2 === "\\")
39322
- c2 = "";
39323
- } else {
39324
- c2 = String(i3);
39325
- if (pad) {
39326
- var need = width - c2.length;
39327
- if (need > 0) {
39328
- var z21 = new Array(need + 1).join("0");
39329
- if (i3 < 0)
39330
- c2 = "-" + z21 + c2.slice(1);
39331
- else
39332
- c2 = z21 + c2;
39333
- }
39334
- }
39335
- }
39336
- N2.push(c2);
39337
- }
39338
- } else {
39339
- N2 = concatMap(n3, function(el) {
39340
- return expand(el, max, false);
39341
- });
39342
- }
39343
- for (var j2 = 0; j2 < N2.length; j2++) {
39344
- for (var k2 = 0; k2 < post.length && expansions.length < max; k2++) {
39345
- var expansion = pre + N2[j2] + post[k2];
39346
- if (!isTop || isSequence || expansion)
39347
- expansions.push(expansion);
39348
- }
39349
- }
39350
- return expansions;
39351
- }
39352
- }
39353
- });
39354
-
39355
- // node_modules/minimatch/minimatch.js
39356
- var require_minimatch = __commonJS({
39357
- "node_modules/minimatch/minimatch.js"(exports, module) {
39358
- "use strict";
39359
- module.exports = minimatch;
39360
- minimatch.Minimatch = Minimatch;
39361
- var path = (function() {
39362
- try {
39363
- return __require("path");
39364
- } catch (e3) {
39365
- }
39366
- })() || {
39367
- sep: "/"
39368
- };
39369
- minimatch.sep = path.sep;
39370
- var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
39371
- var expand = require_brace_expansion();
39372
- var plTypes = {
39373
- "!": { open: "(?:(?!(?:", close: "))[^/]*?)" },
39374
- "?": { open: "(?:", close: ")?" },
39375
- "+": { open: "(?:", close: ")+" },
39376
- "*": { open: "(?:", close: ")*" },
39377
- "@": { open: "(?:", close: ")" }
39378
- };
39379
- var qmark = "[^/]";
39380
- var star = qmark + "*?";
39381
- var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
39382
- var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
39383
- var reSpecials = charSet("().*{}+?[]^$\\!");
39384
- function charSet(s2) {
39385
- return s2.split("").reduce(function(set, c2) {
39386
- set[c2] = true;
39387
- return set;
39388
- }, {});
39389
- }
39390
- var slashSplit = /\/+/;
39391
- minimatch.filter = filter;
39392
- function filter(pattern, options) {
39393
- options = options || {};
39394
- return function(p2, i3, list) {
39395
- return minimatch(p2, pattern, options);
39396
- };
39397
- }
39398
- function ext(a3, b3) {
39399
- b3 = b3 || {};
39400
- var t3 = {};
39401
- Object.keys(a3).forEach(function(k2) {
39402
- t3[k2] = a3[k2];
39403
- });
39404
- Object.keys(b3).forEach(function(k2) {
39405
- t3[k2] = b3[k2];
39406
- });
39407
- return t3;
39408
- }
39409
- minimatch.defaults = function(def) {
39410
- if (!def || typeof def !== "object" || !Object.keys(def).length) {
39411
- return minimatch;
39412
- }
39413
- var orig = minimatch;
39414
- var m2 = function minimatch2(p2, pattern, options) {
39415
- return orig(p2, pattern, ext(def, options));
39416
- };
39417
- m2.Minimatch = function Minimatch2(pattern, options) {
39418
- return new orig.Minimatch(pattern, ext(def, options));
39419
- };
39420
- m2.Minimatch.defaults = function defaults(options) {
39421
- return orig.defaults(ext(def, options)).Minimatch;
39422
- };
39423
- m2.filter = function filter2(pattern, options) {
39424
- return orig.filter(pattern, ext(def, options));
39425
- };
39426
- m2.defaults = function defaults(options) {
39427
- return orig.defaults(ext(def, options));
39428
- };
39429
- m2.makeRe = function makeRe2(pattern, options) {
39430
- return orig.makeRe(pattern, ext(def, options));
39431
- };
39432
- m2.braceExpand = function braceExpand2(pattern, options) {
39433
- return orig.braceExpand(pattern, ext(def, options));
39434
- };
39435
- m2.match = function(list, pattern, options) {
39436
- return orig.match(list, pattern, ext(def, options));
39437
- };
39438
- return m2;
39439
- };
39440
- Minimatch.defaults = function(def) {
39441
- return minimatch.defaults(def).Minimatch;
39442
- };
39443
- function minimatch(p2, pattern, options) {
39444
- assertValidPattern(pattern);
39445
- if (!options) options = {};
39446
- if (!options.nocomment && pattern.charAt(0) === "#") {
39447
- return false;
39448
- }
39449
- return new Minimatch(pattern, options).match(p2);
39450
- }
39451
- function Minimatch(pattern, options) {
39452
- if (!(this instanceof Minimatch)) {
39453
- return new Minimatch(pattern, options);
39454
- }
39455
- assertValidPattern(pattern);
39456
- if (!options) options = {};
39457
- pattern = pattern.trim();
39458
- if (!options.allowWindowsEscape && path.sep !== "/") {
39459
- pattern = pattern.split(path.sep).join("/");
39460
- }
39461
- this.options = options;
39462
- this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
39463
- this.set = [];
39464
- this.pattern = pattern;
39465
- this.regexp = null;
39466
- this.negate = false;
39467
- this.comment = false;
39468
- this.empty = false;
39469
- this.partial = !!options.partial;
39470
- this.make();
39471
- }
39472
- Minimatch.prototype.debug = function() {
39473
- };
39474
- Minimatch.prototype.make = make;
39475
- function make() {
39476
- var pattern = this.pattern;
39477
- var options = this.options;
39478
- if (!options.nocomment && pattern.charAt(0) === "#") {
39479
- this.comment = true;
39480
- return;
39481
- }
39482
- if (!pattern) {
39483
- this.empty = true;
39484
- return;
39485
- }
39486
- this.parseNegate();
39487
- var set = this.globSet = this.braceExpand();
39488
- if (options.debug) this.debug = function debug() {
39489
- console.error.apply(console, arguments);
39490
- };
39491
- this.debug(this.pattern, set);
39492
- set = this.globParts = set.map(function(s2) {
39493
- return s2.split(slashSplit);
39494
- });
39495
- this.debug(this.pattern, set);
39496
- set = set.map(function(s2, si, set2) {
39497
- return s2.map(this.parse, this);
39498
- }, this);
39499
- this.debug(this.pattern, set);
39500
- set = set.filter(function(s2) {
39501
- return s2.indexOf(false) === -1;
39502
- });
39503
- this.debug(this.pattern, set);
39504
- this.set = set;
39505
- }
39506
- Minimatch.prototype.parseNegate = parseNegate;
39507
- function parseNegate() {
39508
- var pattern = this.pattern;
39509
- var negate = false;
39510
- var options = this.options;
39511
- var negateOffset = 0;
39512
- if (options.nonegate) return;
39513
- for (var i3 = 0, l2 = pattern.length; i3 < l2 && pattern.charAt(i3) === "!"; i3++) {
39514
- negate = !negate;
39515
- negateOffset++;
39516
- }
39517
- if (negateOffset) this.pattern = pattern.substr(negateOffset);
39518
- this.negate = negate;
39519
- }
39520
- minimatch.braceExpand = function(pattern, options) {
39521
- return braceExpand(pattern, options);
39522
- };
39523
- Minimatch.prototype.braceExpand = braceExpand;
39524
- function braceExpand(pattern, options) {
39525
- if (!options) {
39526
- if (this instanceof Minimatch) {
39527
- options = this.options;
39528
- } else {
39529
- options = {};
39530
- }
39531
- }
39532
- pattern = typeof pattern === "undefined" ? this.pattern : pattern;
39533
- assertValidPattern(pattern);
39534
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
39535
- return [pattern];
39536
- }
39537
- return expand(pattern);
39538
- }
39539
- var MAX_PATTERN_LENGTH = 1024 * 64;
39540
- var assertValidPattern = function(pattern) {
39541
- if (typeof pattern !== "string") {
39542
- throw new TypeError("invalid pattern");
39543
- }
39544
- if (pattern.length > MAX_PATTERN_LENGTH) {
39545
- throw new TypeError("pattern is too long");
39546
- }
39547
- };
39548
- Minimatch.prototype.parse = parse2;
39549
- var SUBPARSE = {};
39550
- function parse2(pattern, isSub) {
39551
- assertValidPattern(pattern);
39552
- var options = this.options;
39553
- if (pattern === "**") {
39554
- if (!options.noglobstar)
39555
- return GLOBSTAR;
39556
- else
39557
- pattern = "*";
39558
- }
39559
- if (pattern === "") return "";
39560
- var re2 = "";
39561
- var hasMagic = !!options.nocase;
39562
- var escaping = false;
39563
- var patternListStack = [];
39564
- var negativeLists = [];
39565
- var stateChar;
39566
- var inClass = false;
39567
- var reClassStart = -1;
39568
- var classStart = -1;
39569
- var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
39570
- var self2 = this;
39571
- function clearStateChar() {
39572
- if (stateChar) {
39573
- switch (stateChar) {
39574
- case "*":
39575
- re2 += star;
39576
- hasMagic = true;
39577
- break;
39578
- case "?":
39579
- re2 += qmark;
39580
- hasMagic = true;
39581
- break;
39582
- default:
39583
- re2 += "\\" + stateChar;
39584
- break;
39585
- }
39586
- self2.debug("clearStateChar %j %j", stateChar, re2);
39587
- stateChar = false;
39588
- }
39589
- }
39590
- for (var i3 = 0, len = pattern.length, c2; i3 < len && (c2 = pattern.charAt(i3)); i3++) {
39591
- this.debug("%s %s %s %j", pattern, i3, re2, c2);
39592
- if (escaping && reSpecials[c2]) {
39593
- re2 += "\\" + c2;
39594
- escaping = false;
39595
- continue;
39596
- }
39597
- switch (c2) {
39598
- /* istanbul ignore next */
39599
- case "/": {
39600
- return false;
39601
- }
39602
- case "\\":
39603
- clearStateChar();
39604
- escaping = true;
39605
- continue;
39606
- // the various stateChar values
39607
- // for the "extglob" stuff.
39608
- case "?":
39609
- case "*":
39610
- case "+":
39611
- case "@":
39612
- case "!":
39613
- this.debug("%s %s %s %j <-- stateChar", pattern, i3, re2, c2);
39614
- if (inClass) {
39615
- this.debug(" in class");
39616
- if (c2 === "!" && i3 === classStart + 1) c2 = "^";
39617
- re2 += c2;
39618
- continue;
39619
- }
39620
- if (c2 === "*" && stateChar === "*") continue;
39621
- self2.debug("call clearStateChar %j", stateChar);
39622
- clearStateChar();
39623
- stateChar = c2;
39624
- if (options.noext) clearStateChar();
39625
- continue;
39626
- case "(":
39627
- if (inClass) {
39628
- re2 += "(";
39629
- continue;
39630
- }
39631
- if (!stateChar) {
39632
- re2 += "\\(";
39633
- continue;
39634
- }
39635
- patternListStack.push({
39636
- type: stateChar,
39637
- start: i3 - 1,
39638
- reStart: re2.length,
39639
- open: plTypes[stateChar].open,
39640
- close: plTypes[stateChar].close
39641
- });
39642
- re2 += stateChar === "!" ? "(?:(?!(?:" : "(?:";
39643
- this.debug("plType %j %j", stateChar, re2);
39644
- stateChar = false;
39645
- continue;
39646
- case ")":
39647
- if (inClass || !patternListStack.length) {
39648
- re2 += "\\)";
39649
- continue;
39650
- }
39651
- clearStateChar();
39652
- hasMagic = true;
39653
- var pl = patternListStack.pop();
39654
- re2 += pl.close;
39655
- if (pl.type === "!") {
39656
- negativeLists.push(pl);
39657
- }
39658
- pl.reEnd = re2.length;
39659
- continue;
39660
- case "|":
39661
- if (inClass || !patternListStack.length || escaping) {
39662
- re2 += "\\|";
39663
- escaping = false;
39664
- continue;
39665
- }
39666
- clearStateChar();
39667
- re2 += "|";
39668
- continue;
39669
- // these are mostly the same in regexp and glob
39670
- case "[":
39671
- clearStateChar();
39672
- if (inClass) {
39673
- re2 += "\\" + c2;
39674
- continue;
39675
- }
39676
- inClass = true;
39677
- classStart = i3;
39678
- reClassStart = re2.length;
39679
- re2 += c2;
39680
- continue;
39681
- case "]":
39682
- if (i3 === classStart + 1 || !inClass) {
39683
- re2 += "\\" + c2;
39684
- escaping = false;
39685
- continue;
39686
- }
39687
- var cs = pattern.substring(classStart + 1, i3);
39688
- try {
39689
- RegExp("[" + cs + "]");
39690
- } catch (er) {
39691
- var sp = this.parse(cs, SUBPARSE);
39692
- re2 = re2.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
39693
- hasMagic = hasMagic || sp[1];
39694
- inClass = false;
39695
- continue;
39696
- }
39697
- hasMagic = true;
39698
- inClass = false;
39699
- re2 += c2;
39700
- continue;
39701
- default:
39702
- clearStateChar();
39703
- if (escaping) {
39704
- escaping = false;
39705
- } else if (reSpecials[c2] && !(c2 === "^" && inClass)) {
39706
- re2 += "\\";
39707
- }
39708
- re2 += c2;
39709
- }
39710
- }
39711
- if (inClass) {
39712
- cs = pattern.substr(classStart + 1);
39713
- sp = this.parse(cs, SUBPARSE);
39714
- re2 = re2.substr(0, reClassStart) + "\\[" + sp[0];
39715
- hasMagic = hasMagic || sp[1];
39716
- }
39717
- for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
39718
- var tail = re2.slice(pl.reStart + pl.open.length);
39719
- this.debug("setting tail", re2, pl);
39720
- tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_2, $1, $2) {
39721
- if (!$2) {
39722
- $2 = "\\";
39723
- }
39724
- return $1 + $1 + $2 + "|";
39725
- });
39726
- this.debug("tail=%j\n %s", tail, tail, pl, re2);
39727
- var t3 = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
39728
- hasMagic = true;
39729
- re2 = re2.slice(0, pl.reStart) + t3 + "\\(" + tail;
39730
- }
39731
- clearStateChar();
39732
- if (escaping) {
39733
- re2 += "\\\\";
39734
- }
39735
- var addPatternStart = false;
39736
- switch (re2.charAt(0)) {
39737
- case "[":
39738
- case ".":
39739
- case "(":
39740
- addPatternStart = true;
39741
- }
39742
- for (var n3 = negativeLists.length - 1; n3 > -1; n3--) {
39743
- var nl = negativeLists[n3];
39744
- var nlBefore = re2.slice(0, nl.reStart);
39745
- var nlFirst = re2.slice(nl.reStart, nl.reEnd - 8);
39746
- var nlLast = re2.slice(nl.reEnd - 8, nl.reEnd);
39747
- var nlAfter = re2.slice(nl.reEnd);
39748
- nlLast += nlAfter;
39749
- var openParensBefore = nlBefore.split("(").length - 1;
39750
- var cleanAfter = nlAfter;
39751
- for (i3 = 0; i3 < openParensBefore; i3++) {
39752
- cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
39753
- }
39754
- nlAfter = cleanAfter;
39755
- var dollar = "";
39756
- if (nlAfter === "" && isSub !== SUBPARSE) {
39757
- dollar = "$";
39758
- }
39759
- var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast;
39760
- re2 = newRe;
39761
- }
39762
- if (re2 !== "" && hasMagic) {
39763
- re2 = "(?=.)" + re2;
39764
- }
39765
- if (addPatternStart) {
39766
- re2 = patternStart + re2;
39767
- }
39768
- if (isSub === SUBPARSE) {
39769
- return [re2, hasMagic];
39770
- }
39771
- if (!hasMagic) {
39772
- return globUnescape(pattern);
39773
- }
39774
- var flags = options.nocase ? "i" : "";
39775
- try {
39776
- var regExp = new RegExp("^" + re2 + "$", flags);
39777
- } catch (er) {
39778
- return new RegExp("$.");
39779
- }
39780
- regExp._glob = pattern;
39781
- regExp._src = re2;
39782
- return regExp;
39783
- }
39784
- minimatch.makeRe = function(pattern, options) {
39785
- return new Minimatch(pattern, options || {}).makeRe();
39786
- };
39787
- Minimatch.prototype.makeRe = makeRe;
39788
- function makeRe() {
39789
- if (this.regexp || this.regexp === false) return this.regexp;
39790
- var set = this.set;
39791
- if (!set.length) {
39792
- this.regexp = false;
39793
- return this.regexp;
39794
- }
39795
- var options = this.options;
39796
- var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
39797
- var flags = options.nocase ? "i" : "";
39798
- var re2 = set.map(function(pattern) {
39799
- return pattern.map(function(p2) {
39800
- return p2 === GLOBSTAR ? twoStar : typeof p2 === "string" ? regExpEscape(p2) : p2._src;
39801
- }).join("\\/");
39802
- }).join("|");
39803
- re2 = "^(?:" + re2 + ")$";
39804
- if (this.negate) re2 = "^(?!" + re2 + ").*$";
39805
- try {
39806
- this.regexp = new RegExp(re2, flags);
39807
- } catch (ex) {
39808
- this.regexp = false;
39809
- }
39810
- return this.regexp;
39811
- }
39812
- minimatch.match = function(list, pattern, options) {
39813
- options = options || {};
39814
- var mm = new Minimatch(pattern, options);
39815
- list = list.filter(function(f2) {
39816
- return mm.match(f2);
39817
- });
39818
- if (mm.options.nonull && !list.length) {
39819
- list.push(pattern);
39820
- }
39821
- return list;
39822
- };
39823
- Minimatch.prototype.match = function match(f2, partial) {
39824
- if (typeof partial === "undefined") partial = this.partial;
39825
- this.debug("match", f2, this.pattern);
39826
- if (this.comment) return false;
39827
- if (this.empty) return f2 === "";
39828
- if (f2 === "/" && partial) return true;
39829
- var options = this.options;
39830
- if (path.sep !== "/") {
39831
- f2 = f2.split(path.sep).join("/");
39832
- }
39833
- f2 = f2.split(slashSplit);
39834
- this.debug(this.pattern, "split", f2);
39835
- var set = this.set;
39836
- this.debug(this.pattern, "set", set);
39837
- var filename;
39838
- var i3;
39839
- for (i3 = f2.length - 1; i3 >= 0; i3--) {
39840
- filename = f2[i3];
39841
- if (filename) break;
39842
- }
39843
- for (i3 = 0; i3 < set.length; i3++) {
39844
- var pattern = set[i3];
39845
- var file = f2;
39846
- if (options.matchBase && pattern.length === 1) {
39847
- file = [filename];
39848
- }
39849
- var hit = this.matchOne(file, pattern, partial);
39850
- if (hit) {
39851
- if (options.flipNegate) return true;
39852
- return !this.negate;
39853
- }
39854
- }
39855
- if (options.flipNegate) return false;
39856
- return this.negate;
39857
- };
39858
- Minimatch.prototype.matchOne = function(file, pattern, partial) {
39859
- if (pattern.indexOf(GLOBSTAR) !== -1) {
39860
- return this._matchGlobstar(file, pattern, partial, 0, 0);
39861
- }
39862
- return this._matchOne(file, pattern, partial, 0, 0);
39863
- };
39864
- Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
39865
- var i3;
39866
- var firstgs = -1;
39867
- for (i3 = patternIndex; i3 < pattern.length; i3++) {
39868
- if (pattern[i3] === GLOBSTAR) {
39869
- firstgs = i3;
39870
- break;
39871
- }
39872
- }
39873
- var lastgs = -1;
39874
- for (i3 = pattern.length - 1; i3 >= 0; i3--) {
39875
- if (pattern[i3] === GLOBSTAR) {
39876
- lastgs = i3;
39877
- break;
39878
- }
39879
- }
39880
- var head = pattern.slice(patternIndex, firstgs);
39881
- var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
39882
- var tail = partial ? [] : pattern.slice(lastgs + 1);
39883
- if (head.length) {
39884
- var fileHead = file.slice(fileIndex, fileIndex + head.length);
39885
- if (!this._matchOne(fileHead, head, partial, 0, 0)) {
39886
- return false;
39887
- }
39888
- fileIndex += head.length;
39889
- }
39890
- var fileTailMatch = 0;
39891
- if (tail.length) {
39892
- if (tail.length + fileIndex > file.length) return false;
39893
- var tailStart = file.length - tail.length;
39894
- if (this._matchOne(file, tail, partial, tailStart, 0)) {
39895
- fileTailMatch = tail.length;
39896
- } else {
39897
- if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
39898
- return false;
39899
- }
39900
- tailStart--;
39901
- if (!this._matchOne(file, tail, partial, tailStart, 0)) {
39902
- return false;
39903
- }
39904
- fileTailMatch = tail.length + 1;
39905
- }
39906
- }
39907
- if (!body.length) {
39908
- var sawSome = !!fileTailMatch;
39909
- for (i3 = fileIndex; i3 < file.length - fileTailMatch; i3++) {
39910
- var f2 = String(file[i3]);
39911
- sawSome = true;
39912
- if (f2 === "." || f2 === ".." || !this.options.dot && f2.charAt(0) === ".") {
39913
- return false;
39914
- }
39915
- }
39916
- return partial || sawSome;
39917
- }
39918
- var bodySegments = [[[], 0]];
39919
- var currentBody = bodySegments[0];
39920
- var nonGsParts = 0;
39921
- var nonGsPartsSums = [0];
39922
- for (var bi = 0; bi < body.length; bi++) {
39923
- var b3 = body[bi];
39924
- if (b3 === GLOBSTAR) {
39925
- nonGsPartsSums.push(nonGsParts);
39926
- currentBody = [[], 0];
39927
- bodySegments.push(currentBody);
39928
- } else {
39929
- currentBody[0].push(b3);
39930
- nonGsParts++;
39931
- }
39932
- }
39933
- var idx = bodySegments.length - 1;
39934
- var fileLength = file.length - fileTailMatch;
39935
- for (var si = 0; si < bodySegments.length; si++) {
39936
- bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
39937
- }
39938
- return !!this._matchGlobStarBodySections(
39939
- file,
39940
- bodySegments,
39941
- fileIndex,
39942
- 0,
39943
- partial,
39944
- 0,
39945
- !!fileTailMatch
39946
- );
39947
- };
39948
- Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
39949
- var bs = bodySegments[bodyIndex];
39950
- if (!bs) {
39951
- for (var i3 = fileIndex; i3 < file.length; i3++) {
39952
- sawTail = true;
39953
- var f2 = file[i3];
39954
- if (f2 === "." || f2 === ".." || !this.options.dot && f2.charAt(0) === ".") {
39955
- return false;
39956
- }
39957
- }
39958
- return sawTail;
39959
- }
39960
- var body = bs[0];
39961
- var after = bs[1];
39962
- while (fileIndex <= after) {
39963
- var m2 = this._matchOne(
39964
- file.slice(0, fileIndex + body.length),
39965
- body,
39966
- partial,
39967
- fileIndex,
39968
- 0
39969
- );
39970
- if (m2 && globStarDepth < this.maxGlobstarRecursion) {
39971
- var sub = this._matchGlobStarBodySections(
39972
- file,
39973
- bodySegments,
39974
- fileIndex + body.length,
39975
- bodyIndex + 1,
39976
- partial,
39977
- globStarDepth + 1,
39978
- sawTail
39979
- );
39980
- if (sub !== false) {
39981
- return sub;
39982
- }
39983
- }
39984
- var f2 = file[fileIndex];
39985
- if (f2 === "." || f2 === ".." || !this.options.dot && f2.charAt(0) === ".") {
39986
- return false;
39987
- }
39988
- fileIndex++;
39989
- }
39990
- return partial || null;
39991
- };
39992
- Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
39993
- var fi, pi, fl, pl;
39994
- for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
39995
- this.debug("matchOne loop");
39996
- var p2 = pattern[pi];
39997
- var f2 = file[fi];
39998
- this.debug(pattern, p2, f2);
39999
- if (p2 === false || p2 === GLOBSTAR) return false;
40000
- var hit;
40001
- if (typeof p2 === "string") {
40002
- hit = f2 === p2;
40003
- this.debug("string match", p2, f2, hit);
40004
- } else {
40005
- hit = f2.match(p2);
40006
- this.debug("pattern match", p2, f2, hit);
40007
- }
40008
- if (!hit) return false;
40009
- }
40010
- if (fi === fl && pi === pl) {
40011
- return true;
40012
- } else if (fi === fl) {
40013
- return partial;
40014
- } else if (pi === pl) {
40015
- return fi === fl - 1 && file[fi] === "";
40016
- }
40017
- throw new Error("wtf?");
40018
- };
40019
- function globUnescape(s2) {
40020
- return s2.replace(/\\(.)/g, "$1");
40021
- }
40022
- function regExpEscape(s2) {
40023
- return s2.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
40024
- }
40025
- }
40026
- });
40027
-
40028
39131
  // node_modules/@stoplight/spectral-core/dist/ruleset/utils/minimatch.js
40029
- var require_minimatch2 = __commonJS({
39132
+ var require_minimatch = __commonJS({
40030
39133
  "node_modules/@stoplight/spectral-core/dist/ruleset/utils/minimatch.js"(exports) {
40031
39134
  "use strict";
40032
39135
  Object.defineProperty(exports, "__esModule", { value: true });
40033
39136
  exports.minimatch = void 0;
40034
39137
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
40035
- var minimatch_1 = (0, tslib_1.__importDefault)(require_minimatch());
39138
+ var minimatch_1 = (0, tslib_1.__importDefault)(__require("minimatch"));
40036
39139
  var DEFAULT_OPTS = { matchBase: true };
40037
- function minimatch(source, pattern) {
39140
+ function minimatch3(source, pattern) {
40038
39141
  return (0, minimatch_1.default)(source, pattern, DEFAULT_OPTS);
40039
39142
  }
40040
- exports.minimatch = minimatch;
39143
+ exports.minimatch = minimatch3;
40041
39144
  }
40042
39145
  });
40043
39146
 
@@ -40190,7 +39293,7 @@ var require_rule = __commonJS({
40190
39293
  var path_1 = (init_index_es(), __toCommonJS(index_es_exports));
40191
39294
  var json_1 = (init_index_es2(), __toCommonJS(index_es_exports2));
40192
39295
  var severity_1 = require_severity();
40193
- var minimatch_1 = require_minimatch2();
39296
+ var minimatch_1 = require_minimatch();
40194
39297
  var formats_1 = require_formats();
40195
39298
  var alias_1 = require_alias();
40196
39299
  var Rule = class _Rule {
@@ -46095,7 +45198,7 @@ var require_ruleset = __commonJS({
46095
45198
  var tslib_1 = (init_tslib_es6(), __toCommonJS(tslib_es6_exports));
46096
45199
  var path_1 = (init_index_es(), __toCommonJS(index_es_exports));
46097
45200
  var json_1 = (init_index_es2(), __toCommonJS(index_es_exports2));
46098
- var minimatch_1 = require_minimatch2();
45201
+ var minimatch_1 = require_minimatch();
46099
45202
  var rule_1 = require_rule();
46100
45203
  var index_1 = require_validation();
46101
45204
  var rules_1 = require_rules();
@@ -49602,6 +48705,45 @@ var commandDefinitions = {
49602
48705
  }
49603
48706
  }
49604
48707
  ]
48708
+ },
48709
+ "artifact-coverage": {
48710
+ "options": [
48711
+ {
48712
+ "name": "config",
48713
+ "schema": {
48714
+ "type": "string"
48715
+ },
48716
+ "file": {
48717
+ "mode": "read",
48718
+ "exists": false,
48719
+ "media_type": "application/yaml",
48720
+ "encoding": "utf-8"
48721
+ }
48722
+ },
48723
+ {
48724
+ "name": "team",
48725
+ "schema": {
48726
+ "type": "string"
48727
+ }
48728
+ },
48729
+ {
48730
+ "name": "format",
48731
+ "schema": {
48732
+ "type": "string",
48733
+ "enum": [
48734
+ "text",
48735
+ "json"
48736
+ ],
48737
+ "default": "text"
48738
+ }
48739
+ },
48740
+ {
48741
+ "name": "min-coverage",
48742
+ "schema": {
48743
+ "type": "number"
48744
+ }
48745
+ }
48746
+ ]
49605
48747
  }
49606
48748
  };
49607
48749
  function deriveCommandPolicy(command_id, optionValues) {
@@ -49713,13 +48855,22 @@ function createProgram(handlers2, version) {
49713
48855
  }
49714
48856
  await handlers2.navigationIndex(dir, opts, globalOpts);
49715
48857
  });
48858
+ program2.command("artifact-coverage").description("Measure file coverage by artifact path_patterns definitions.").argument("[dir]", "Path to agent-contracts.yaml.").option("-c, --config <path>", "Path to agent-contracts.config.yaml.").option("--team <id>", "Limit to one team (multi-team config only).").option("--format <format>", "Output format.", "text").option("--min-coverage <number>", "Minimum coverage percentage; exit 1 if below (for CI gates).").action(async (dir, opts, cmd) => {
48859
+ const globalOpts = cmd.optsWithGlobals();
48860
+ if (globalOpts.introspect) {
48861
+ const policy = deriveCommandPolicy("artifact-coverage", opts);
48862
+ console.log(JSON.stringify(policy, null, 2));
48863
+ return;
48864
+ }
48865
+ await handlers2.artifactCoverage(dir, opts, globalOpts);
48866
+ });
49716
48867
  return program2;
49717
48868
  }
49718
48869
 
49719
48870
  // src/cli/handlers.ts
49720
48871
  import { writeFileSync as writeFileSync2 } from "fs";
49721
48872
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
49722
- import { join as join3, dirname as dirname7 } from "path";
48873
+ import { join as join4, dirname as dirname7 } from "path";
49723
48874
  import { resolve as pathResolve } from "path";
49724
48875
  import { access as access2 } from "fs/promises";
49725
48876
  import { stringify as stringify3, parse as parseYaml5 } from "yaml";
@@ -50350,6 +49501,9 @@ var AuditConfigSchema = z17.object({
50350
49501
  temperature: z17.number().min(0).max(2).optional(),
50351
49502
  cache_dir: z17.string().optional()
50352
49503
  }).optional();
49504
+ var ArtifactCoverageConfigSchema = z17.object({
49505
+ exclude_patterns: z17.array(z17.string()).default([])
49506
+ }).optional();
50353
49507
  var AgentContractsConfigSchema = z17.object({
50354
49508
  dsl: z17.string().optional(),
50355
49509
  vars: z17.record(z17.string(), z17.string()).optional(),
@@ -50358,7 +49512,8 @@ var AgentContractsConfigSchema = z17.object({
50358
49512
  active_guardrail_policy: z17.string().optional(),
50359
49513
  paths: z17.record(z17.string(), z17.string()).optional(),
50360
49514
  teams: z17.record(z17.string(), TeamConfigSchema).optional(),
50361
- audit: AuditConfigSchema
49515
+ audit: AuditConfigSchema,
49516
+ artifact_coverage: ArtifactCoverageConfigSchema
50362
49517
  }).superRefine((data, ctx) => {
50363
49518
  if (data.dsl !== void 0 && data.teams !== void 0) {
50364
49519
  ctx.addIssue({
@@ -50486,7 +49641,8 @@ ${issues}`,
50486
49641
  activeGuardrailPolicy: void 0,
50487
49642
  paths: void 0,
50488
49643
  teams: resolveTeamConfigs(config.teams, configDir),
50489
- audit: config.audit ?? void 0
49644
+ audit: config.audit ?? void 0,
49645
+ artifactCoverage: config.artifact_coverage ?? void 0
50490
49646
  };
50491
49647
  }
50492
49648
  return {
@@ -50497,7 +49653,8 @@ ${issues}`,
50497
49653
  bindings: (config.bindings ?? []).map((b3) => resolve(configDir, b3)),
50498
49654
  activeGuardrailPolicy: config.active_guardrail_policy,
50499
49655
  paths: config.paths,
50500
- audit: config.audit ?? void 0
49656
+ audit: config.audit ?? void 0,
49657
+ artifactCoverage: config.artifact_coverage ?? void 0
50501
49658
  };
50502
49659
  }
50503
49660
  function resolveDslPath(dirArg, dirArgDefault, config) {
@@ -58047,6 +57204,155 @@ function runGenerateInterfaceCli(opts) {
58047
57204
  }
58048
57205
  }
58049
57206
 
57207
+ // src/artifact-coverage/enumerator.ts
57208
+ import { execSync } from "child_process";
57209
+ import { readdirSync } from "fs";
57210
+ import { join as join3 } from "path";
57211
+ import { minimatch } from "minimatch";
57212
+ function enumerateProjectFiles(cwd, excludePatterns) {
57213
+ const filePaths = listFiles(cwd);
57214
+ if (excludePatterns.length === 0) {
57215
+ return filePaths;
57216
+ }
57217
+ return filePaths.filter(
57218
+ (f2) => !excludePatterns.some((p2) => minimatch(f2, p2, { dot: true }))
57219
+ );
57220
+ }
57221
+ function listFiles(cwd) {
57222
+ try {
57223
+ const output = execSync("git ls-files", {
57224
+ encoding: "utf-8",
57225
+ cwd
57226
+ });
57227
+ return output.trim().split("\n").filter(Boolean);
57228
+ } catch {
57229
+ return walkDir(cwd, cwd);
57230
+ }
57231
+ }
57232
+ var IGNORE_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "dist", ".next", "coverage"]);
57233
+ function walkDir(root, dir) {
57234
+ const results = [];
57235
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
57236
+ if (entry.isDirectory()) {
57237
+ if (IGNORE_DIRS.has(entry.name)) continue;
57238
+ results.push(...walkDir(root, join3(dir, entry.name)));
57239
+ } else {
57240
+ const rel = join3(dir, entry.name).slice(root.length + 1).replace(/\\/g, "/");
57241
+ results.push(rel);
57242
+ }
57243
+ }
57244
+ return results;
57245
+ }
57246
+
57247
+ // src/artifact-coverage/matcher.ts
57248
+ import { minimatch as minimatch2 } from "minimatch";
57249
+ function matchFileToArtifacts(filePath, artifacts) {
57250
+ const normalized = filePath.replace(/\\/g, "/");
57251
+ return Object.entries(artifacts).filter(([, art]) => {
57252
+ const included = art.path_patterns.some(
57253
+ (p2) => minimatch2(normalized, p2, { dot: true })
57254
+ );
57255
+ if (!included) return false;
57256
+ if (art.exclude_patterns.length === 0) return true;
57257
+ return !art.exclude_patterns.some(
57258
+ (p2) => minimatch2(normalized, p2, { dot: true })
57259
+ );
57260
+ }).map(([id]) => id);
57261
+ }
57262
+
57263
+ // src/artifact-coverage/reporter.ts
57264
+ function buildCoverageReport(files, artifacts) {
57265
+ const uncovered = [];
57266
+ const overlapping = [];
57267
+ const artifactHits = {};
57268
+ for (const id of Object.keys(artifacts)) {
57269
+ artifactHits[id] = 0;
57270
+ }
57271
+ for (const file of files) {
57272
+ const matches = matchFileToArtifacts(file, artifacts);
57273
+ if (matches.length === 0) {
57274
+ uncovered.push(file);
57275
+ } else if (matches.length > 1) {
57276
+ overlapping.push({ path: file, artifacts: matches });
57277
+ }
57278
+ for (const id of matches) {
57279
+ artifactHits[id] = (artifactHits[id] ?? 0) + 1;
57280
+ }
57281
+ }
57282
+ const totalFiles = files.length;
57283
+ const coveredFiles = totalFiles - uncovered.length;
57284
+ const coveragePercent = totalFiles === 0 ? 100 : Math.round(coveredFiles / totalFiles * 1e3) / 10;
57285
+ const perArtifact = {};
57286
+ for (const [id, info] of Object.entries(artifacts)) {
57287
+ perArtifact[id] = {
57288
+ matched_files: artifactHits[id] ?? 0,
57289
+ patterns: info.path_patterns
57290
+ };
57291
+ }
57292
+ return {
57293
+ summary: {
57294
+ total_files: totalFiles,
57295
+ covered_files: coveredFiles,
57296
+ uncovered_files: uncovered.length,
57297
+ overlapping_files: overlapping.length,
57298
+ coverage_percent: coveragePercent
57299
+ },
57300
+ uncovered: uncovered.sort(),
57301
+ overlapping: overlapping.sort((a3, b3) => a3.path.localeCompare(b3.path)),
57302
+ per_artifact: perArtifact
57303
+ };
57304
+ }
57305
+ function formatCoverageText(report) {
57306
+ const { summary } = report;
57307
+ const lines = [];
57308
+ lines.push("=== Artifact Coverage ===");
57309
+ lines.push("");
57310
+ lines.push(`Total files: ${summary.total_files}`);
57311
+ lines.push(
57312
+ `Covered: ${summary.covered_files} (${summary.coverage_percent}%)`
57313
+ );
57314
+ lines.push(
57315
+ `Uncovered: ${summary.uncovered_files} (${(100 - summary.coverage_percent).toFixed(1)}%)`
57316
+ );
57317
+ lines.push(
57318
+ `Overlapping: ${summary.overlapping_files} (${summary.total_files === 0 ? 0 : (summary.overlapping_files / summary.total_files * 100).toFixed(1)}%)`
57319
+ );
57320
+ if (report.uncovered.length > 0) {
57321
+ const byDir = groupByDirectory(report.uncovered);
57322
+ lines.push("");
57323
+ lines.push("--- Uncovered files (by directory) ---");
57324
+ for (const [dir, count] of byDir.slice(0, 10)) {
57325
+ lines.push(`${dir.padEnd(20)} ${count} file${count > 1 ? "s" : ""}`);
57326
+ }
57327
+ if (byDir.length > 10) {
57328
+ lines.push(`... and ${byDir.length - 10} more directories`);
57329
+ }
57330
+ lines.push("");
57331
+ lines.push("--- Uncovered files ---");
57332
+ for (const f2 of report.uncovered) {
57333
+ lines.push(f2);
57334
+ }
57335
+ }
57336
+ if (report.overlapping.length > 0) {
57337
+ lines.push("");
57338
+ lines.push("--- Overlapping files ---");
57339
+ for (const o3 of report.overlapping) {
57340
+ lines.push(`${o3.path} [${o3.artifacts.join(", ")}]`);
57341
+ }
57342
+ }
57343
+ lines.push("");
57344
+ return lines.join("\n");
57345
+ }
57346
+ function groupByDirectory(files) {
57347
+ const dirs = {};
57348
+ for (const f2 of files) {
57349
+ const parts = f2.split("/");
57350
+ const dir = parts.length > 1 ? parts.slice(0, -1).join("/") + "/" : "./";
57351
+ dirs[dir] = (dirs[dir] ?? 0) + 1;
57352
+ }
57353
+ return Object.entries(dirs).sort((a3, b3) => b3[1] - a3[1]);
57354
+ }
57355
+
58050
57356
  // src/cli/handlers.ts
58051
57357
  var DIR_DEFAULT = "agent-contracts.yaml";
58052
57358
  var handleResolve = async (dir, opts) => {
@@ -58424,7 +57730,7 @@ var handleCheck = async (opts) => {
58424
57730
  hasErrors = true;
58425
57731
  }
58426
57732
  if (schemaResult.data.team_interface) {
58427
- const interfacePath = join3(config.configDir, "team-interface.yaml");
57733
+ const interfacePath = join4(config.configDir, "team-interface.yaml");
58428
57734
  if (existsSync2(interfacePath)) {
58429
57735
  const result = generateInterface({ dsl: schemaResult.data, dryRun: true, format: "yaml" });
58430
57736
  const existing = readFileSync2(interfacePath, "utf8");
@@ -58941,6 +58247,89 @@ var handleNavigationIndex = async (dir, opts) => {
58941
58247
  process.exit(1);
58942
58248
  }
58943
58249
  };
58250
+ var handleArtifactCoverage = async (dir, opts) => {
58251
+ const fmt = opts.format ?? "text";
58252
+ if (fmt !== "text" && fmt !== "json") {
58253
+ process.stderr.write(`Invalid --format: expected text or json, got ${fmt}
58254
+ `);
58255
+ process.exit(1);
58256
+ }
58257
+ try {
58258
+ const config = await loadConfig(opts.config);
58259
+ const excludePatterns = config?.artifactCoverage?.exclude_patterns ?? [];
58260
+ if (config !== null && isMultiTeamConfig(config)) {
58261
+ const teamEntries = getTeamEntries(config, opts.team);
58262
+ const results = {};
58263
+ for (const [teamId, teamConfig] of teamEntries) {
58264
+ const index4 = await buildNavigationIndexForDsl(teamConfig.dsl, teamConfig.vars, void 0);
58265
+ const artifactFiles2 = extractArtifactFiles(index4);
58266
+ const projectRoot2 = dirname7(teamConfig.dsl);
58267
+ const files2 = enumerateProjectFiles(projectRoot2, excludePatterns);
58268
+ results[teamId] = buildCoverageReport(files2, artifactFiles2);
58269
+ }
58270
+ if (fmt === "json") {
58271
+ process.stdout.write(JSON.stringify(results, null, 2) + "\n");
58272
+ } else {
58273
+ for (const [teamId, report2] of Object.entries(results)) {
58274
+ process.stdout.write(`
58275
+ --- Team: ${teamId} ---
58276
+ `);
58277
+ process.stdout.write(formatCoverageText(report2));
58278
+ }
58279
+ }
58280
+ if (opts.minCoverage !== void 0) {
58281
+ const threshold = parseFloat(opts.minCoverage);
58282
+ const allAbove = Object.values(results).every(
58283
+ (r3) => r3.summary.coverage_percent >= threshold
58284
+ );
58285
+ if (!allAbove) {
58286
+ process.stderr.write(`Coverage below threshold (${threshold}%)
58287
+ `);
58288
+ process.exit(1);
58289
+ }
58290
+ }
58291
+ return;
58292
+ }
58293
+ const dslPath = resolveDslPath(dir ?? DIR_DEFAULT, DIR_DEFAULT, config);
58294
+ const index3 = await buildNavigationIndexForDsl(dslPath, config?.vars, void 0);
58295
+ const artifactFiles = extractArtifactFiles(index3);
58296
+ const projectRoot = config?.configDir ?? dirname7(dslPath);
58297
+ const files = enumerateProjectFiles(projectRoot, excludePatterns);
58298
+ const report = buildCoverageReport(files, artifactFiles);
58299
+ if (fmt === "json") {
58300
+ process.stdout.write(JSON.stringify(report, null, 2) + "\n");
58301
+ } else {
58302
+ process.stdout.write(formatCoverageText(report));
58303
+ }
58304
+ if (opts.minCoverage !== void 0) {
58305
+ const threshold = parseFloat(opts.minCoverage);
58306
+ if (report.summary.coverage_percent < threshold) {
58307
+ process.stderr.write(
58308
+ `Coverage ${report.summary.coverage_percent}% is below threshold (${threshold}%)
58309
+ `
58310
+ );
58311
+ process.exit(1);
58312
+ }
58313
+ }
58314
+ } catch (err) {
58315
+ const msg = err instanceof Error ? err.message : String(err);
58316
+ process.stderr.write(`Error: ${msg}
58317
+ `);
58318
+ process.exit(1);
58319
+ }
58320
+ };
58321
+ function extractArtifactFiles(index3) {
58322
+ const result = {};
58323
+ for (const [id, node] of Object.entries(index3.artifacts)) {
58324
+ if (node.files.path_patterns.length > 0) {
58325
+ result[id] = {
58326
+ path_patterns: node.files.path_patterns,
58327
+ exclude_patterns: node.files.exclude_patterns
58328
+ };
58329
+ }
58330
+ }
58331
+ return result;
58332
+ }
58944
58333
  var handlers = {
58945
58334
  resolve: handleResolve,
58946
58335
  validate: handleValidate,
@@ -58950,7 +58339,8 @@ var handlers = {
58950
58339
  score: handleScore,
58951
58340
  audit: handleAudit,
58952
58341
  generate: handleGenerate,
58953
- navigationIndex: handleNavigationIndex
58342
+ navigationIndex: handleNavigationIndex,
58343
+ artifactCoverage: handleArtifactCoverage
58954
58344
  };
58955
58345
 
58956
58346
  // src/cli/cli.ts