@punks/cli 2.1.1 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5503,8 +5503,8 @@ ${ctx.indent}`;
5503
5503
  const nl0 = valueStr.indexOf(`
5504
5504
  `);
5505
5505
  const hasNewline = nl0 !== -1;
5506
- const flow = ctx.inFlow ?? value3.flow ?? value3.items.length === 0;
5507
- if (hasNewline || !flow) {
5506
+ const flow2 = ctx.inFlow ?? value3.flow ?? value3.items.length === 0;
5507
+ if (hasNewline || !flow2) {
5508
5508
  let hasPropsLine = false;
5509
5509
  if (hasNewline && (vs0 === "&" || vs0 === "!")) {
5510
5510
  let sp0 = valueStr.indexOf(" ");
@@ -5717,8 +5717,8 @@ var require_stringifyCollection = __commonJS((exports) => {
5717
5717
  var stringify = require_stringify();
5718
5718
  var stringifyComment = require_stringifyComment();
5719
5719
  function stringifyCollection(collection, ctx, options) {
5720
- const flow = ctx.inFlow ?? collection.flow;
5721
- const stringify2 = flow ? stringifyFlowCollection : stringifyBlockCollection;
5720
+ const flow2 = ctx.inFlow ?? collection.flow;
5721
+ const stringify2 = flow2 ? stringifyFlowCollection : stringifyBlockCollection;
5722
5722
  return stringify2(collection, ctx, options);
5723
5723
  }
5724
5724
  function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
@@ -7227,7 +7227,7 @@ var require_Document = __commonJS((exports) => {
7227
7227
  options = replacer;
7228
7228
  replacer = undefined;
7229
7229
  }
7230
- const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag: tag3 } = options ?? {};
7230
+ const { aliasDuplicateObjects, anchorPrefix, flow: flow2, keepUndefined, onTagObj, tag: tag3 } = options ?? {};
7231
7231
  const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(this, anchorPrefix || "a");
7232
7232
  const ctx = {
7233
7233
  aliasDuplicateObjects: aliasDuplicateObjects ?? true,
@@ -7239,7 +7239,7 @@ var require_Document = __commonJS((exports) => {
7239
7239
  sourceObjects
7240
7240
  };
7241
7241
  const node = createNode.createNode(value3, tag3, ctx);
7242
- if (flow && identity3.isCollection(node))
7242
+ if (flow2 && identity3.isCollection(node))
7243
7243
  node.flow = true;
7244
7244
  setAnchors();
7245
7245
  return node;
@@ -7433,7 +7433,7 @@ ${pointer}
7433
7433
 
7434
7434
  // ../../node_modules/.bun/yaml@2.8.4/node_modules/yaml/dist/compose/resolve-props.js
7435
7435
  var require_resolve_props = __commonJS((exports) => {
7436
- function resolveProps(tokens, { flow, indicator, next, offset, onError: onError4, parentIndent, startOnNewline }) {
7436
+ function resolveProps(tokens, { flow: flow2, indicator, next, offset, onError: onError4, parentIndent, startOnNewline }) {
7437
7437
  let spaceBefore = false;
7438
7438
  let atNewline = startOnNewline;
7439
7439
  let hasSpace = startOnNewline;
@@ -7462,7 +7462,7 @@ var require_resolve_props = __commonJS((exports) => {
7462
7462
  }
7463
7463
  switch (token.type) {
7464
7464
  case "space":
7465
- if (!flow && (indicator !== "doc-start" || next?.type !== "flow-collection") && token.source.includes("\t")) {
7465
+ if (!flow2 && (indicator !== "doc-start" || next?.type !== "flow-collection") && token.source.includes("\t")) {
7466
7466
  tab = token;
7467
7467
  }
7468
7468
  hasSpace = true;
@@ -7518,15 +7518,15 @@ var require_resolve_props = __commonJS((exports) => {
7518
7518
  if (anchor || tag3)
7519
7519
  onError4(token, "BAD_PROP_ORDER", `Anchors and tags must be after the ${token.source} indicator`);
7520
7520
  if (found)
7521
- onError4(token, "UNEXPECTED_TOKEN", `Unexpected ${token.source} in ${flow ?? "collection"}`);
7521
+ onError4(token, "UNEXPECTED_TOKEN", `Unexpected ${token.source} in ${flow2 ?? "collection"}`);
7522
7522
  found = token;
7523
7523
  atNewline = indicator === "seq-item-ind" || indicator === "explicit-key-ind";
7524
7524
  hasSpace = false;
7525
7525
  break;
7526
7526
  case "comma":
7527
- if (flow) {
7527
+ if (flow2) {
7528
7528
  if (comma)
7529
- onError4(token, "UNEXPECTED_TOKEN", `Unexpected , in ${flow}`);
7529
+ onError4(token, "UNEXPECTED_TOKEN", `Unexpected , in ${flow2}`);
7530
7530
  comma = token;
7531
7531
  atNewline = false;
7532
7532
  hasSpace = false;
@@ -11131,6 +11131,45 @@ function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {
11131
11131
  }
11132
11132
  }
11133
11133
  }
11134
+ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
11135
+ switch (arguments.length) {
11136
+ case 1:
11137
+ return ab;
11138
+ case 2:
11139
+ return function() {
11140
+ return bc(ab.apply(this, arguments));
11141
+ };
11142
+ case 3:
11143
+ return function() {
11144
+ return cd(bc(ab.apply(this, arguments)));
11145
+ };
11146
+ case 4:
11147
+ return function() {
11148
+ return de(cd(bc(ab.apply(this, arguments))));
11149
+ };
11150
+ case 5:
11151
+ return function() {
11152
+ return ef(de(cd(bc(ab.apply(this, arguments)))));
11153
+ };
11154
+ case 6:
11155
+ return function() {
11156
+ return fg(ef(de(cd(bc(ab.apply(this, arguments))))));
11157
+ };
11158
+ case 7:
11159
+ return function() {
11160
+ return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));
11161
+ };
11162
+ case 8:
11163
+ return function() {
11164
+ return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));
11165
+ };
11166
+ case 9:
11167
+ return function() {
11168
+ return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));
11169
+ };
11170
+ }
11171
+ return;
11172
+ }
11134
11173
 
11135
11174
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Equivalence.js
11136
11175
  var make = (isEquivalent) => (self, that) => self === that || isEquivalent(self, that);
@@ -11204,6 +11243,7 @@ var isDate = (input) => input instanceof Date;
11204
11243
  var isIterable = (input) => typeof input === "string" || hasProperty(input, Symbol.iterator);
11205
11244
  var isRecord = (input) => isRecordOrArray(input) && !Array.isArray(input);
11206
11245
  var isPromiseLike = (input) => hasProperty(input, "then") && isFunction2(input.then);
11246
+ var or = /* @__PURE__ */ dual(2, (self, that) => (a) => self(a) || that(a));
11207
11247
 
11208
11248
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/internal/errors.js
11209
11249
  var getBugErrorMessage = (message) => `BUG: ${message} - please report an issue at https://github.com/Effect-TS/effect/issues`;
@@ -11974,6 +12014,7 @@ var try_ = (evaluate) => {
11974
12014
  var isEither2 = isEither;
11975
12015
  var isLeft2 = isLeft;
11976
12016
  var isRight2 = isRight;
12017
+ var getRight2 = getRight;
11977
12018
  var getEquivalence = ({
11978
12019
  left: left3,
11979
12020
  right: right3
@@ -12056,7 +12097,7 @@ var match2 = /* @__PURE__ */ dual(2, (self, {
12056
12097
  onNone,
12057
12098
  onSome
12058
12099
  }) => isNone2(self) ? onNone() : onSome(self.value));
12059
- var getRight2 = getRight;
12100
+ var getRight3 = getRight;
12060
12101
  var getOrElse = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone() : self.value);
12061
12102
  var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
12062
12103
  var orElseSome = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? some2(onNone()) : self);
@@ -23456,6 +23497,7 @@ var withSpanScoped = function() {
23456
23497
  };
23457
23498
 
23458
23499
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Cause.js
23500
+ var TimeoutExceptionTypeId2 = TimeoutExceptionTypeId;
23459
23501
  var empty28 = empty19;
23460
23502
  var fail4 = fail;
23461
23503
  var die4 = die;
@@ -28858,7 +28900,7 @@ var getSync = (ast, isDecoding, options) => {
28858
28900
  };
28859
28901
  var getOption3 = (ast, isDecoding, options) => {
28860
28902
  const parser = getEither(ast, isDecoding, options);
28861
- return (input, overrideOptions) => getRight2(parser(input, overrideOptions));
28903
+ return (input, overrideOptions) => getRight3(parser(input, overrideOptions));
28862
28904
  };
28863
28905
  var getEffect = (ast, isDecoding, options) => {
28864
28906
  const parser = goMemo(ast, isDecoding);
@@ -32228,6 +32270,8 @@ var runPromiseExit2 = unsafeRunPromiseExit;
32228
32270
  var updateContext3 = updateContext2;
32229
32271
 
32230
32272
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Schedule.js
32273
+ var ScheduleTypeId2 = ScheduleTypeId;
32274
+ var passthrough4 = passthrough2;
32231
32275
  var spaced2 = spaced;
32232
32276
 
32233
32277
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/internal/stream/emit.js
@@ -46664,6 +46708,51 @@ var multiSelect2 = multiSelect;
46664
46708
  var succeed18 = succeed16;
46665
46709
  var text9 = text5;
46666
46710
  var toggle3 = toggle2;
46711
+ // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpClient.js
46712
+ var exports_HttpClient = {};
46713
+ __export(exports_HttpClient, {
46714
+ withTracerPropagation: () => withTracerPropagation2,
46715
+ withTracerDisabledWhen: () => withTracerDisabledWhen2,
46716
+ withSpanNameGenerator: () => withSpanNameGenerator2,
46717
+ withScope: () => withScope2,
46718
+ withCookiesRef: () => withCookiesRef2,
46719
+ transformResponse: () => transformResponse2,
46720
+ transform: () => transform4,
46721
+ tapRequest: () => tapRequest2,
46722
+ tapError: () => tapError7,
46723
+ tap: () => tap7,
46724
+ retryTransient: () => retryTransient2,
46725
+ retry: () => retry6,
46726
+ put: () => put3,
46727
+ post: () => post3,
46728
+ patch: () => patch11,
46729
+ options: () => options5,
46730
+ mapRequestInputEffect: () => mapRequestInputEffect2,
46731
+ mapRequestInput: () => mapRequestInput2,
46732
+ mapRequestEffect: () => mapRequestEffect2,
46733
+ mapRequest: () => mapRequest2,
46734
+ makeWith: () => makeWith2,
46735
+ make: () => make66,
46736
+ layerMergedContext: () => layerMergedContext2,
46737
+ head: () => head9,
46738
+ get: () => get19,
46739
+ followRedirects: () => followRedirects2,
46740
+ filterStatusOk: () => filterStatusOk3,
46741
+ filterStatus: () => filterStatus3,
46742
+ filterOrFail: () => filterOrFail4,
46743
+ filterOrElse: () => filterOrElse4,
46744
+ execute: () => execute3,
46745
+ del: () => del3,
46746
+ currentTracerPropagation: () => currentTracerPropagation2,
46747
+ currentTracerDisabledWhen: () => currentTracerDisabledWhen2,
46748
+ catchTags: () => catchTags5,
46749
+ catchTag: () => catchTag5,
46750
+ catchAll: () => catchAll8,
46751
+ TypeId: () => TypeId35,
46752
+ SpanNameGenerator: () => SpanNameGenerator2,
46753
+ HttpClient: () => HttpClient
46754
+ });
46755
+
46667
46756
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/Cookies.js
46668
46757
  var TypeId27 = /* @__PURE__ */ Symbol.for("@effect/platform/Cookies");
46669
46758
  var CookieTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/Cookies/Cookie");
@@ -46826,6 +46915,7 @@ function parseSetCookie(header) {
46826
46915
  options: Object.keys(options3).length > 0 ? options3 : undefined
46827
46916
  }));
46828
46917
  }
46918
+ var isEmpty17 = (self) => isEmptyRecord(self.cookies);
46829
46919
  var fieldContentRegExp = /^[\u0009\u0020-\u007e\u0080-\u00ff]+$/;
46830
46920
  var CookieProto = {
46831
46921
  [CookieTypeId]: CookieTypeId,
@@ -46839,6 +46929,11 @@ var CookieProto = {
46839
46929
  };
46840
46930
  }
46841
46931
  };
46932
+ var merge11 = /* @__PURE__ */ dual(2, (self, that) => fromReadonlyRecord({
46933
+ ...self.cookies,
46934
+ ...that.cookies
46935
+ }));
46936
+ var toCookieHeader = (self) => Object.values(self.cookies).map((cookie) => `${cookie.name}=${cookie.valueEncoded}`).join("; ");
46842
46937
  var tryDecodeURIComponent = (str) => {
46843
46938
  try {
46844
46939
  return decodeURIComponent(str);
@@ -46887,7 +46982,7 @@ var setAll3 = /* @__PURE__ */ dual(2, (self, headers) => make63({
46887
46982
  ...self,
46888
46983
  ...fromInput2(headers)
46889
46984
  }));
46890
- var merge11 = /* @__PURE__ */ dual(2, (self, headers) => {
46985
+ var merge12 = /* @__PURE__ */ dual(2, (self, headers) => {
46891
46986
  const out = make63(self);
46892
46987
  Object.assign(out, headers);
46893
46988
  return out;
@@ -46951,6 +47046,8 @@ var TypeId28 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpClientError");
46951
47046
 
46952
47047
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpClientError.js
46953
47048
  var TypeId29 = TypeId28;
47049
+ var isHttpClientError = (u) => hasProperty(u, TypeId29);
47050
+
46954
47051
  class RequestError extends (/* @__PURE__ */ TypeIdError(TypeId29, "RequestError")) {
46955
47052
  get methodAndUrl() {
46956
47053
  return `${this.request.method} ${this.request.url}`;
@@ -47009,6 +47106,7 @@ var schemaFromSelf = /* @__PURE__ */ Array$(Tuple(String$, String$)).annotations
47009
47106
  identifier: "UrlParams"
47010
47107
  });
47011
47108
  var empty43 = [];
47109
+ var set10 = /* @__PURE__ */ dual(3, (self, key, value6) => append(filter2(self, ([k]) => k !== key), [key, String(value6)]));
47012
47110
  var setAll4 = /* @__PURE__ */ dual(2, (self, input) => {
47013
47111
  const out = fromInput3(input);
47014
47112
  const keys6 = new Set;
@@ -47022,6 +47120,7 @@ var setAll4 = /* @__PURE__ */ dual(2, (self, input) => {
47022
47120
  }
47023
47121
  return out;
47024
47122
  });
47123
+ var append4 = /* @__PURE__ */ dual(3, (self, key, value6) => append(self, [key, String(value6)]));
47025
47124
  var appendAll4 = /* @__PURE__ */ dual(2, (self, input) => appendAll(self, fromInput3(input)));
47026
47125
  var makeUrl = (url2, params, hash2) => {
47027
47126
  try {
@@ -47114,6 +47213,13 @@ var toHeaders = (span4) => unsafeFromRecord({
47114
47213
 
47115
47214
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/internal/httpBody.js
47116
47215
  var TypeId31 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpBody");
47216
+ var ErrorTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/HttpBody/HttpBodyError");
47217
+ var bodyError = /* @__PURE__ */ tagged2("HttpBodyError");
47218
+ var HttpBodyError = (reason) => bodyError({
47219
+ [ErrorTypeId]: ErrorTypeId,
47220
+ reason
47221
+ });
47222
+
47117
47223
  class BodyBase {
47118
47224
  [TypeId31];
47119
47225
  constructor() {
@@ -47163,7 +47269,25 @@ class Uint8ArrayImpl extends BodyBase {
47163
47269
  var uint8Array = (body, contentType) => new Uint8ArrayImpl(body, contentType ?? "application/octet-stream");
47164
47270
  var encoder2 = /* @__PURE__ */ new TextEncoder;
47165
47271
  var text10 = (body, contentType) => uint8Array(encoder2.encode(body), contentType ?? "text/plain");
47272
+ var unsafeJson = (body, contentType) => text10(JSON.stringify(body), contentType ?? "application/json");
47273
+ var json = (body, contentType) => try_3({
47274
+ try: () => unsafeJson(body, contentType),
47275
+ catch: (error4) => HttpBodyError({
47276
+ _tag: "JsonError",
47277
+ error: error4
47278
+ })
47279
+ });
47166
47280
  var urlParams = (urlParams2, contentType) => text10(toString(urlParams2), contentType ?? "application/x-www-form-urlencoded");
47281
+ var jsonSchema = (schema, options3) => {
47282
+ const encode5 = encode4(schema, options3);
47283
+ return (body, contentType) => flatMap10(mapError3(encode5(body), (error4) => HttpBodyError({
47284
+ _tag: "SchemaError",
47285
+ error: error4
47286
+ })), (body2) => json(body2, contentType));
47287
+ };
47288
+ var file5 = (path2, options3) => flatMap10(FileSystem, (fs) => map17(fs.stat(path2), (info2) => stream3(fs.stream(path2, options3), options3?.contentType, Number(info2.size))));
47289
+ var fileWeb = (file6) => stream3(fromReadableStream2(() => file6.stream(), identity), file6.type, file6.size);
47290
+
47167
47291
  class FormDataImpl extends BodyBase {
47168
47292
  formData;
47169
47293
  _tag = "FormData";
@@ -47180,6 +47304,43 @@ class FormDataImpl extends BodyBase {
47180
47304
  }
47181
47305
  }
47182
47306
  var formData = (body) => new FormDataImpl(body);
47307
+ var formDataRecord = (entries2) => {
47308
+ const formData2 = new FormData;
47309
+ for (const [key, value6] of Object.entries(entries2)) {
47310
+ if (Array.isArray(value6)) {
47311
+ for (const item of value6) {
47312
+ if (item == null)
47313
+ continue;
47314
+ formData2.append(key, typeof value6 === "object" ? item : String(item));
47315
+ }
47316
+ } else if (value6 != null) {
47317
+ formData2.append(key, typeof value6 === "object" ? value6 : String(value6));
47318
+ }
47319
+ }
47320
+ return new FormDataImpl(formData2);
47321
+ };
47322
+
47323
+ class StreamImpl2 extends BodyBase {
47324
+ stream;
47325
+ contentType;
47326
+ contentLength;
47327
+ _tag = "Stream";
47328
+ constructor(stream3, contentType, contentLength) {
47329
+ super();
47330
+ this.stream = stream3;
47331
+ this.contentType = contentType;
47332
+ this.contentLength = contentLength;
47333
+ }
47334
+ toJSON() {
47335
+ return {
47336
+ _id: "@effect/platform/HttpBody",
47337
+ _tag: "Stream",
47338
+ contentType: this.contentType,
47339
+ contentLength: this.contentLength
47340
+ };
47341
+ }
47342
+ }
47343
+ var stream3 = (body, contentType, contentLength) => new StreamImpl2(body, contentType ?? "application/octet-stream", contentLength);
47183
47344
 
47184
47345
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/internal/httpClientRequest.js
47185
47346
  var TypeId32 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpClientRequest");
@@ -47211,6 +47372,7 @@ function makeInternal(method, url2, urlParams2, hash2, headers, body) {
47211
47372
  self.body = body;
47212
47373
  return self;
47213
47374
  }
47375
+ var isClientRequest = (u) => typeof u === "object" && u !== null && (TypeId32 in u);
47214
47376
  var empty45 = /* @__PURE__ */ makeInternal("GET", "", empty43, /* @__PURE__ */ none2(), empty42, empty44);
47215
47377
  var make64 = (method) => (url2, options3) => modify6(empty45, {
47216
47378
  method,
@@ -47254,6 +47416,9 @@ var modify6 = /* @__PURE__ */ dual(2, (self, options4) => {
47254
47416
  });
47255
47417
  var setHeader = /* @__PURE__ */ dual(3, (self, key, value6) => makeInternal(self.method, self.url, self.urlParams, self.hash, set9(self.headers, key, value6), self.body));
47256
47418
  var setHeaders = /* @__PURE__ */ dual(2, (self, input) => makeInternal(self.method, self.url, self.urlParams, self.hash, setAll3(self.headers, input), self.body));
47419
+ var stringOrRedacted = (value6) => typeof value6 === "string" ? value6 : value2(value6);
47420
+ var basicAuth = /* @__PURE__ */ dual(3, (self, username, password3) => setHeader(self, "Authorization", `Basic ${btoa(`${stringOrRedacted(username)}:${stringOrRedacted(password3)}`)}`));
47421
+ var bearerToken = /* @__PURE__ */ dual(2, (self, token) => setHeader(self, "Authorization", `Bearer ${stringOrRedacted(token)}`));
47257
47422
  var accept = /* @__PURE__ */ dual(2, (self, mediaType) => setHeader(self, "Accept", mediaType));
47258
47423
  var acceptJson = /* @__PURE__ */ accept("application/json");
47259
47424
  var setMethod = /* @__PURE__ */ dual(2, (self, method) => makeInternal(method, self.url, self.urlParams, self.hash, self.headers, self.body));
@@ -47268,10 +47433,23 @@ var setUrl = /* @__PURE__ */ dual(2, (self, url2) => {
47268
47433
  clone2.hash = "";
47269
47434
  return makeInternal(self.method, clone2.toString(), urlParams2, hash2, self.headers, self.body);
47270
47435
  });
47436
+ var appendUrl = /* @__PURE__ */ dual(2, (self, path2) => {
47437
+ if (path2 === "") {
47438
+ return self;
47439
+ }
47440
+ const baseUrl2 = self.url.endsWith("/") ? self.url : self.url + "/";
47441
+ const pathSegment = path2.startsWith("/") ? path2.slice(1) : path2;
47442
+ return makeInternal(self.method, baseUrl2 + pathSegment, self.urlParams, self.hash, self.headers, self.body);
47443
+ });
47271
47444
  var prependUrl = /* @__PURE__ */ dual(2, (self, url2) => makeInternal(self.method, url2.endsWith("/") && self.url.startsWith("/") ? url2 + self.url.slice(1) : url2 + self.url, self.urlParams, self.hash, self.headers, self.body));
47445
+ var updateUrl = /* @__PURE__ */ dual(2, (self, f) => makeInternal(self.method, f(self.url), self.urlParams, self.hash, self.headers, self.body));
47446
+ var appendUrlParam = /* @__PURE__ */ dual(3, (self, key, value6) => makeInternal(self.method, self.url, append4(self.urlParams, key, value6), self.hash, self.headers, self.body));
47272
47447
  var appendUrlParams = /* @__PURE__ */ dual(2, (self, input) => makeInternal(self.method, self.url, appendAll4(self.urlParams, input), self.hash, self.headers, self.body));
47448
+ var setUrlParam = /* @__PURE__ */ dual(3, (self, key, value6) => makeInternal(self.method, self.url, set10(self.urlParams, key, value6), self.hash, self.headers, self.body));
47273
47449
  var setUrlParams = /* @__PURE__ */ dual(2, (self, input) => makeInternal(self.method, self.url, setAll4(self.urlParams, input), self.hash, self.headers, self.body));
47274
47450
  var setHash = /* @__PURE__ */ dual(2, (self, hash2) => makeInternal(self.method, self.url, self.urlParams, some2(hash2), self.headers, self.body));
47451
+ var removeHash = (self) => makeInternal(self.method, self.url, self.urlParams, none2(), self.headers, self.body);
47452
+ var toUrl = (self) => getRight2(makeUrl(self.url, self.urlParams, self.hash));
47275
47453
  var setBody = /* @__PURE__ */ dual(2, (self, body) => {
47276
47454
  let headers = self.headers;
47277
47455
  if (body._tag === "Empty" || body._tag === "FormData") {
@@ -47288,7 +47466,23 @@ var setBody = /* @__PURE__ */ dual(2, (self, body) => {
47288
47466
  }
47289
47467
  return makeInternal(self.method, self.url, self.urlParams, self.hash, headers, body);
47290
47468
  });
47469
+ var bodyUint8Array = /* @__PURE__ */ dual((args2) => isClientRequest(args2[0]), (self, body, contentType = "application/octet-stream") => setBody(self, uint8Array(body, contentType)));
47470
+ var bodyText = /* @__PURE__ */ dual((args2) => isClientRequest(args2[0]), (self, body, contentType = "text/plain") => setBody(self, text10(body, contentType)));
47471
+ var bodyJson = /* @__PURE__ */ dual(2, (self, body) => map17(json(body), (body2) => setBody(self, body2)));
47472
+ var bodyUnsafeJson = /* @__PURE__ */ dual(2, (self, body) => setBody(self, unsafeJson(body)));
47473
+ var bodyFile = /* @__PURE__ */ dual((args2) => isClientRequest(args2[0]), (self, path2, options4) => map17(file5(path2, options4), (body) => setBody(self, body)));
47474
+ var bodyFileWeb = /* @__PURE__ */ dual(2, (self, file6) => setBody(self, fileWeb(file6)));
47475
+ var schemaBodyJson = (schema, options4) => {
47476
+ const encode5 = jsonSchema(schema, options4);
47477
+ return dual(2, (self, body) => map17(encode5(body), (body2) => setBody(self, body2)));
47478
+ };
47479
+ var bodyUrlParams = /* @__PURE__ */ dual(2, (self, body) => setBody(self, text10(toString(fromInput3(body)), "application/x-www-form-urlencoded")));
47291
47480
  var bodyFormData = /* @__PURE__ */ dual(2, (self, body) => setBody(self, formData(body)));
47481
+ var bodyFormDataRecord = /* @__PURE__ */ dual(2, (self, entries2) => setBody(self, formDataRecord(entries2)));
47482
+ var bodyStream = /* @__PURE__ */ dual((args2) => isClientRequest(args2[0]), (self, body, {
47483
+ contentLength,
47484
+ contentType = "application/octet-stream"
47485
+ } = {}) => setBody(self, stream3(body, contentType, contentLength)));
47292
47486
 
47293
47487
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/internal/httpClientResponse.js
47294
47488
  var TypeId33 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpClientResponse");
@@ -47416,6 +47610,18 @@ var matchStatus = /* @__PURE__ */ dual(2, (self, cases) => {
47416
47610
  }
47417
47611
  return cases.orElse(self);
47418
47612
  });
47613
+ var filterStatus = /* @__PURE__ */ dual(2, (self, f) => suspend3(() => f(self.status) ? succeed8(self) : fail9(new ResponseError({
47614
+ response: self,
47615
+ request: self.request,
47616
+ reason: "StatusCode",
47617
+ description: "invalid status code"
47618
+ }))));
47619
+ var filterStatusOk = (self) => self.status >= 200 && self.status < 300 ? succeed8(self) : fail9(new ResponseError({
47620
+ response: self,
47621
+ request: self.request,
47622
+ reason: "StatusCode",
47623
+ description: "non 2xx status code"
47624
+ }));
47419
47625
 
47420
47626
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/internal/httpClient.js
47421
47627
  var ATTR_HTTP_REQUEST_HEADER = (key) => `http.request.header.${key}`;
@@ -47431,10 +47637,13 @@ var ATTR_URL_QUERY = "url.query";
47431
47637
  var TypeId34 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpClient");
47432
47638
  var tag5 = /* @__PURE__ */ GenericTag("@effect/platform/HttpClient");
47433
47639
  var currentTracerDisabledWhen = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("@effect/platform/HttpClient/tracerDisabledWhen"), () => unsafeMake9(constFalse));
47640
+ var withTracerDisabledWhen = /* @__PURE__ */ dual(2, (self, pred) => transformResponse(self, locally(currentTracerDisabledWhen, pred)));
47434
47641
  var currentTracerPropagation = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("@effect/platform/HttpClient/currentTracerPropagation"), () => unsafeMake9(true));
47642
+ var withTracerPropagation = /* @__PURE__ */ dual(2, (self, enabled2) => transformResponse(self, locally(currentTracerPropagation, enabled2)));
47435
47643
  var SpanNameGenerator = /* @__PURE__ */ Reference2()("@effect/platform/HttpClient/SpanNameGenerator", {
47436
47644
  defaultValue: () => (request2) => `http.client ${request2.method}`
47437
47645
  });
47646
+ var withSpanNameGenerator = /* @__PURE__ */ dual(2, (self, f) => transformResponse(self, provideService2(SpanNameGenerator, f)));
47438
47647
  var ClientProto = {
47439
47648
  [TypeId34]: TypeId34,
47440
47649
  pipe() {
@@ -47468,6 +47677,7 @@ var ClientProto = {
47468
47677
  return this.execute(options3(url2, options4));
47469
47678
  }
47470
47679
  };
47680
+ var isClient = (u) => hasProperty(u, TypeId34);
47471
47681
  var makeWith = (postprocess, preprocess) => {
47472
47682
  const self = Object.create(ClientProto);
47473
47683
  self.preprocess = preprocess;
@@ -47643,42 +47853,230 @@ class InterruptibleResponse {
47643
47853
  return this.original[NodeInspectSymbol]();
47644
47854
  }
47645
47855
  }
47856
+ var withScope = (self) => transform3(self, (effect3, request2) => {
47857
+ const controller = new AbortController;
47858
+ scopedRequests.set(request2, controller);
47859
+ return zipRight3(scopeWith2((scope5) => addFinalizer2(scope5, sync3(() => controller.abort()))), effect3);
47860
+ });
47861
+ var {
47862
+ del: del2,
47863
+ execute: execute2,
47864
+ get: get18,
47865
+ head: head8,
47866
+ options: options4,
47867
+ patch: patch10,
47868
+ post: post2,
47869
+ put: put2
47870
+ } = /* @__PURE__ */ serviceFunctions2(tag5);
47871
+ var transform3 = /* @__PURE__ */ dual(2, (self, f) => {
47872
+ const client = self;
47873
+ return makeWith(flatMap10((request2) => f(client.postprocess(succeed8(request2)), request2)), client.preprocess);
47874
+ });
47875
+ var filterStatus2 = /* @__PURE__ */ dual(2, (self, f) => transformResponse(self, flatMap10(filterStatus(f))));
47876
+ var filterStatusOk2 = (self) => transformResponse(self, flatMap10(filterStatusOk));
47646
47877
  var transformResponse = /* @__PURE__ */ dual(2, (self, f) => {
47647
47878
  const client = self;
47648
47879
  return makeWith((request2) => f(client.postprocess(request2)), client.preprocess);
47649
47880
  });
47881
+ var catchTag4 = /* @__PURE__ */ dual(3, (self, tag6, f) => transformResponse(self, catchTag2(tag6, f)));
47882
+ var catchTags4 = /* @__PURE__ */ dual(2, (self, cases) => transformResponse(self, catchTags2(cases)));
47883
+ var catchAll7 = /* @__PURE__ */ dual(2, (self, f) => transformResponse(self, catchAll3(f)));
47884
+ var filterOrElse3 = /* @__PURE__ */ dual(3, (self, f, orElse17) => transformResponse(self, filterOrElse2(f, orElse17)));
47885
+ var filterOrFail3 = /* @__PURE__ */ dual(3, (self, f, orFailWith) => transformResponse(self, filterOrFail2(f, orFailWith)));
47650
47886
  var mapRequest = /* @__PURE__ */ dual(2, (self, f) => {
47651
47887
  const client = self;
47652
47888
  return makeWith(client.postprocess, (request2) => map17(client.preprocess(request2), f));
47653
47889
  });
47890
+ var mapRequestEffect = /* @__PURE__ */ dual(2, (self, f) => {
47891
+ const client = self;
47892
+ return makeWith(client.postprocess, (request2) => flatMap10(client.preprocess(request2), f));
47893
+ });
47894
+ var mapRequestInput = /* @__PURE__ */ dual(2, (self, f) => {
47895
+ const client = self;
47896
+ return makeWith(client.postprocess, (request2) => client.preprocess(f(request2)));
47897
+ });
47898
+ var mapRequestInputEffect = /* @__PURE__ */ dual(2, (self, f) => {
47899
+ const client = self;
47900
+ return makeWith(client.postprocess, (request2) => flatMap10(f(request2), client.preprocess));
47901
+ });
47902
+ var retry5 = /* @__PURE__ */ dual(2, (self, policy) => transformResponse(self, retry2(policy)));
47903
+ var retryTransient = /* @__PURE__ */ dual(2, (self, options5) => {
47904
+ const isOnlySchedule = ScheduleTypeId2 in options5;
47905
+ const mode = isOnlySchedule ? "both" : options5.mode ?? "both";
47906
+ const schedule3 = isOnlySchedule ? options5 : options5.schedule;
47907
+ const passthroughSchedule = schedule3 && passthrough4(schedule3);
47908
+ const times2 = isOnlySchedule ? undefined : options5.times;
47909
+ return transformResponse(self, flow(mode === "errors-only" ? identity : repeat({
47910
+ schedule: passthroughSchedule,
47911
+ times: times2,
47912
+ while: isTransientResponse
47913
+ }), mode === "response-only" ? identity : retry2({
47914
+ while: isOnlySchedule || options5.while === undefined ? isTransientError : or(isTransientError, options5.while),
47915
+ schedule: schedule3,
47916
+ times: times2
47917
+ })));
47918
+ });
47919
+ var isTransientError = (error4) => hasProperty(error4, TimeoutExceptionTypeId2) || isTransientHttpError(error4);
47920
+ var isTransientHttpError = (error4) => isHttpClientError(error4) && (error4._tag === "RequestError" && error4.reason === "Transport" || error4._tag === "ResponseError" && isTransientResponse(error4.response));
47921
+ var isTransientResponse = (response) => response.status === 408 || response.status === 429 || response.status === 500 || response.status === 502 || response.status === 503 || response.status === 504;
47922
+ var tap6 = /* @__PURE__ */ dual(2, (self, f) => transformResponse(self, tap3(f)));
47923
+ var tapError6 = /* @__PURE__ */ dual(2, (self, f) => transformResponse(self, tapError3(f)));
47924
+ var tapRequest = /* @__PURE__ */ dual(2, (self, f) => {
47925
+ const client = self;
47926
+ return makeWith(client.postprocess, (request2) => tap3(client.preprocess(request2), f));
47927
+ });
47928
+ var withCookiesRef = /* @__PURE__ */ dual(2, (self, ref) => {
47929
+ const client = self;
47930
+ return makeWith((request2) => tap3(client.postprocess(request2), (response) => update3(ref, (cookies) => merge11(cookies, response.cookies))), (request2) => flatMap10(client.preprocess(request2), (request3) => map17(get11(ref), (cookies) => isEmpty17(cookies) ? request3 : setHeader(request3, "cookie", toCookieHeader(cookies)))));
47931
+ });
47932
+ var followRedirects = /* @__PURE__ */ dual((args2) => isClient(args2[0]), (self, maxRedirects) => {
47933
+ const client = self;
47934
+ return makeWith((request2) => {
47935
+ const loop3 = (request3, redirects) => flatMap10(client.postprocess(succeed8(request3)), (response) => response.status >= 300 && response.status < 400 && response.headers.location && redirects < (maxRedirects ?? 10) ? loop3(setUrl(request3, new URL(response.headers.location, response.request.url)), redirects + 1) : succeed8(response));
47936
+ return flatMap10(request2, (request3) => loop3(request3, 0));
47937
+ }, client.preprocess);
47938
+ });
47654
47939
  var layerMergedContext = (effect3) => effect(tag5, flatMap10(context3(), (context8) => map17(effect3, (client) => transformResponse(client, mapInputContext2((input) => merge3(context8, input))))));
47655
47940
 
47656
47941
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpClient.js
47942
+ var TypeId35 = TypeId34;
47657
47943
  var HttpClient = tag5;
47944
+ var execute3 = execute2;
47945
+ var get19 = get18;
47946
+ var head9 = head8;
47947
+ var post3 = post2;
47948
+ var patch11 = patch10;
47949
+ var put3 = put2;
47950
+ var del3 = del2;
47951
+ var options5 = options4;
47952
+ var catchAll8 = catchAll7;
47953
+ var catchTag5 = catchTag4;
47954
+ var catchTags5 = catchTags4;
47955
+ var filterOrElse4 = filterOrElse3;
47956
+ var filterOrFail4 = filterOrFail3;
47957
+ var filterStatus3 = filterStatus2;
47958
+ var filterStatusOk3 = filterStatusOk2;
47959
+ var makeWith2 = makeWith;
47960
+ var make66 = make65;
47961
+ var transform4 = transform3;
47962
+ var transformResponse2 = transformResponse;
47658
47963
  var mapRequest2 = mapRequest;
47964
+ var mapRequestEffect2 = mapRequestEffect;
47965
+ var mapRequestInput2 = mapRequestInput;
47966
+ var mapRequestInputEffect2 = mapRequestInputEffect;
47967
+ var retry6 = retry5;
47968
+ var retryTransient2 = retryTransient;
47969
+ var tap7 = tap6;
47970
+ var tapError7 = tapError6;
47971
+ var tapRequest2 = tapRequest;
47972
+ var withCookiesRef2 = withCookiesRef;
47973
+ var followRedirects2 = followRedirects;
47974
+ var currentTracerDisabledWhen2 = currentTracerDisabledWhen;
47975
+ var withTracerDisabledWhen2 = withTracerDisabledWhen;
47976
+ var currentTracerPropagation2 = currentTracerPropagation;
47977
+ var withTracerPropagation2 = withTracerPropagation;
47978
+ var layerMergedContext2 = layerMergedContext;
47979
+ var SpanNameGenerator2 = SpanNameGenerator;
47980
+ var withSpanNameGenerator2 = withSpanNameGenerator;
47981
+ var withScope2 = withScope;
47659
47982
 
47660
47983
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpClientRequest.js
47661
- var make66 = make64;
47984
+ var exports_HttpClientRequest = {};
47985
+ __export(exports_HttpClientRequest, {
47986
+ updateUrl: () => updateUrl2,
47987
+ toUrl: () => toUrl2,
47988
+ setUrlParams: () => setUrlParams2,
47989
+ setUrlParam: () => setUrlParam2,
47990
+ setUrl: () => setUrl2,
47991
+ setMethod: () => setMethod2,
47992
+ setHeaders: () => setHeaders2,
47993
+ setHeader: () => setHeader2,
47994
+ setHash: () => setHash2,
47995
+ setBody: () => setBody2,
47996
+ schemaBodyJson: () => schemaBodyJson2,
47997
+ removeHash: () => removeHash2,
47998
+ put: () => put4,
47999
+ prependUrl: () => prependUrl2,
48000
+ post: () => post4,
48001
+ patch: () => patch12,
48002
+ options: () => options6,
48003
+ modify: () => modify7,
48004
+ make: () => make67,
48005
+ head: () => head10,
48006
+ get: () => get20,
48007
+ del: () => del4,
48008
+ bodyUrlParams: () => bodyUrlParams2,
48009
+ bodyUnsafeJson: () => bodyUnsafeJson2,
48010
+ bodyUint8Array: () => bodyUint8Array2,
48011
+ bodyText: () => bodyText2,
48012
+ bodyStream: () => bodyStream2,
48013
+ bodyJson: () => bodyJson2,
48014
+ bodyFormDataRecord: () => bodyFormDataRecord2,
48015
+ bodyFormData: () => bodyFormData2,
48016
+ bodyFileWeb: () => bodyFileWeb2,
48017
+ bodyFile: () => bodyFile2,
48018
+ bearerToken: () => bearerToken2,
48019
+ basicAuth: () => basicAuth2,
48020
+ appendUrlParams: () => appendUrlParams2,
48021
+ appendUrlParam: () => appendUrlParam2,
48022
+ appendUrl: () => appendUrl2,
48023
+ acceptJson: () => acceptJson2,
48024
+ accept: () => accept2,
48025
+ TypeId: () => TypeId36
48026
+ });
48027
+ var TypeId36 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpClientRequest");
48028
+ var make67 = make64;
48029
+ var get20 = get17;
48030
+ var post4 = post;
48031
+ var patch12 = patch9;
48032
+ var put4 = put;
48033
+ var del4 = del;
48034
+ var head10 = head7;
48035
+ var options6 = options3;
48036
+ var modify7 = modify6;
48037
+ var setMethod2 = setMethod;
48038
+ var setHeader2 = setHeader;
47662
48039
  var setHeaders2 = setHeaders;
48040
+ var basicAuth2 = basicAuth;
48041
+ var bearerToken2 = bearerToken;
48042
+ var accept2 = accept;
48043
+ var acceptJson2 = acceptJson;
47663
48044
  var setUrl2 = setUrl;
47664
48045
  var prependUrl2 = prependUrl;
48046
+ var appendUrl2 = appendUrl;
48047
+ var updateUrl2 = updateUrl;
48048
+ var setUrlParam2 = setUrlParam;
47665
48049
  var setUrlParams2 = setUrlParams;
48050
+ var appendUrlParam2 = appendUrlParam;
47666
48051
  var appendUrlParams2 = appendUrlParams;
48052
+ var setHash2 = setHash;
48053
+ var removeHash2 = removeHash;
48054
+ var toUrl2 = toUrl;
47667
48055
  var setBody2 = setBody;
48056
+ var bodyUint8Array2 = bodyUint8Array;
48057
+ var bodyText2 = bodyText;
48058
+ var bodyJson2 = bodyJson;
48059
+ var bodyUnsafeJson2 = bodyUnsafeJson;
48060
+ var schemaBodyJson2 = schemaBodyJson;
48061
+ var bodyUrlParams2 = bodyUrlParams;
47668
48062
  var bodyFormData2 = bodyFormData;
48063
+ var bodyFormDataRecord2 = bodyFormDataRecord;
48064
+ var bodyStream2 = bodyStream;
48065
+ var bodyFile2 = bodyFile;
48066
+ var bodyFileWeb2 = bodyFileWeb;
47669
48067
 
47670
48068
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpMethod.js
47671
48069
  var hasBody = (method) => method !== "GET" && method !== "HEAD" && method !== "OPTIONS";
47672
48070
 
47673
48071
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpBody.js
47674
- var TypeId35 = TypeId31;
47675
- var isHttpBody = (u) => hasProperty(u, TypeId35);
48072
+ var TypeId37 = TypeId31;
48073
+ var isHttpBody = (u) => hasProperty(u, TypeId37);
47676
48074
  var uint8Array2 = uint8Array;
47677
48075
  var text11 = text10;
47678
48076
  var urlParams2 = urlParams;
47679
48077
 
47680
48078
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/internal/mailbox.js
47681
- var TypeId36 = /* @__PURE__ */ Symbol.for("effect/Mailbox");
48079
+ var TypeId38 = /* @__PURE__ */ Symbol.for("effect/Mailbox");
47682
48080
  var ReadonlyTypeId = /* @__PURE__ */ Symbol.for("effect/Mailbox/ReadonlyMailbox");
47683
48081
  var empty46 = /* @__PURE__ */ empty7();
47684
48082
  var exitEmpty = /* @__PURE__ */ exitSucceed(empty46);
@@ -47690,7 +48088,7 @@ class MailboxImpl extends Class2 {
47690
48088
  scheduler;
47691
48089
  capacity;
47692
48090
  strategy;
47693
- [TypeId36] = TypeId36;
48091
+ [TypeId38] = TypeId38;
47694
48092
  [ReadonlyTypeId] = ReadonlyTypeId;
47695
48093
  state = {
47696
48094
  _tag: "Open",
@@ -48086,23 +48484,23 @@ class MailboxImpl extends Class2 {
48086
48484
  openState.awaiters.clear();
48087
48485
  }
48088
48486
  }
48089
- var make67 = (capacity3) => withFiberRuntime((fiber) => succeed(new MailboxImpl(fiber.currentScheduler, typeof capacity3 === "number" ? capacity3 : capacity3?.capacity ?? Number.POSITIVE_INFINITY, typeof capacity3 === "number" ? "suspend" : capacity3?.strategy ?? "suspend")));
48487
+ var make68 = (capacity3) => withFiberRuntime((fiber) => succeed(new MailboxImpl(fiber.currentScheduler, typeof capacity3 === "number" ? capacity3 : capacity3?.capacity ?? Number.POSITIVE_INFINITY, typeof capacity3 === "number" ? "suspend" : capacity3?.strategy ?? "suspend")));
48090
48488
  var toChannel3 = (self) => {
48091
48489
  const loop3 = flatMap13(self.takeAll, ([messages, done9]) => done9 ? messages.length === 0 ? void_5 : write(messages) : zipRight4(write(messages), loop3));
48092
48490
  return loop3;
48093
48491
  };
48094
48492
 
48095
48493
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Mailbox.js
48096
- var TypeId37 = TypeId36;
48097
- var isMailbox = (u) => hasProperty(u, TypeId37);
48098
- var make68 = make67;
48494
+ var TypeId39 = TypeId38;
48495
+ var isMailbox = (u) => hasProperty(u, TypeId39);
48496
+ var make69 = make68;
48099
48497
  var toChannel4 = toChannel3;
48100
48498
 
48101
48499
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/FiberSet.js
48102
- var TypeId38 = /* @__PURE__ */ Symbol.for("effect/FiberSet");
48103
- var isFiberSet = (u) => hasProperty(u, TypeId38);
48500
+ var TypeId40 = /* @__PURE__ */ Symbol.for("effect/FiberSet");
48501
+ var isFiberSet = (u) => hasProperty(u, TypeId40);
48104
48502
  var Proto6 = {
48105
- [TypeId38]: TypeId38,
48503
+ [TypeId40]: TypeId40,
48106
48504
  [Symbol.iterator]() {
48107
48505
  if (this.state._tag === "Closed") {
48108
48506
  return empty2();
@@ -48134,7 +48532,7 @@ var unsafeMake12 = (backing, deferred) => {
48134
48532
  self.deferred = deferred;
48135
48533
  return self;
48136
48534
  };
48137
- var make69 = () => acquireRelease2(map17(make40(), (deferred) => unsafeMake12(new Set, deferred)), (set11) => withFiberRuntime2((parent) => {
48535
+ var make70 = () => acquireRelease2(map17(make40(), (deferred) => unsafeMake12(new Set, deferred)), (set11) => withFiberRuntime2((parent) => {
48138
48536
  const state = set11.state;
48139
48537
  if (state._tag === "Closed")
48140
48538
  return _void;
@@ -48154,9 +48552,9 @@ var isInternalInterruption = /* @__PURE__ */ reduceWithContext3(undefined, {
48154
48552
  sequentialCase: (_, left3, right3) => left3 || right3,
48155
48553
  parallelCase: (_, left3, right3) => left3 || right3
48156
48554
  });
48157
- var unsafeAdd = /* @__PURE__ */ dual((args2) => isFiberSet(args2[0]), (self, fiber, options5) => {
48555
+ var unsafeAdd = /* @__PURE__ */ dual((args2) => isFiberSet(args2[0]), (self, fiber, options7) => {
48158
48556
  if (self.state._tag === "Closed") {
48159
- fiber.unsafeInterruptAsFork(combine3(options5?.interruptAs ?? none4, internalFiberId));
48557
+ fiber.unsafeInterruptAsFork(combine3(options7?.interruptAs ?? none4, internalFiberId));
48160
48558
  return;
48161
48559
  } else if (self.state.backing.has(fiber)) {
48162
48560
  return;
@@ -48167,7 +48565,7 @@ var unsafeAdd = /* @__PURE__ */ dual((args2) => isFiberSet(args2[0]), (self, fib
48167
48565
  return;
48168
48566
  }
48169
48567
  self.state.backing.delete(fiber);
48170
- if (isFailure2(exit3) && (options5?.propagateInterruption === true ? !isInternalInterruption(exit3.cause) : !isInterruptedOnly2(exit3.cause))) {
48568
+ if (isFailure2(exit3) && (options7?.propagateInterruption === true ? !isInternalInterruption(exit3.cause) : !isInterruptedOnly2(exit3.cause))) {
48171
48569
  unsafeDone(self.deferred, exit3);
48172
48570
  }
48173
48571
  });
@@ -48178,9 +48576,9 @@ var join4 = (self) => _await3(self.deferred);
48178
48576
  var exports_HttpApi = {};
48179
48577
  __export(exports_HttpApi, {
48180
48578
  reflect: () => reflect,
48181
- make: () => make70,
48579
+ make: () => make71,
48182
48580
  isHttpApi: () => isHttpApi,
48183
- TypeId: () => TypeId39,
48581
+ TypeId: () => TypeId41,
48184
48582
  Api: () => Api,
48185
48583
  AdditionalSchemas: () => AdditionalSchemas
48186
48584
  });
@@ -48333,23 +48731,23 @@ var param = /* @__PURE__ */ dual(2, (name, schema) => {
48333
48731
  var Empty = (status2) => Void.annotations(annotations3({
48334
48732
  status: status2
48335
48733
  }));
48336
- var asEmpty = /* @__PURE__ */ dual(2, (self, options5) => transform2(Void.annotations(self.ast.annotations), typeSchema(self), {
48337
- decode: options5.decode,
48734
+ var asEmpty = /* @__PURE__ */ dual(2, (self, options7) => transform2(Void.annotations(self.ast.annotations), typeSchema(self), {
48735
+ decode: options7.decode,
48338
48736
  encode: constVoid
48339
48737
  }).annotations(annotations3({
48340
- status: options5.status,
48738
+ status: options7.status,
48341
48739
  [AnnotationEmptyDecodeable]: true
48342
48740
  })));
48343
48741
  var Created = /* @__PURE__ */ Empty(201);
48344
48742
  var Accepted = /* @__PURE__ */ Empty(202);
48345
48743
  var NoContent = /* @__PURE__ */ Empty(204);
48346
48744
  var MultipartTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiSchema/Multipart");
48347
- var Multipart = (self, options5) => self.annotations({
48348
- [AnnotationMultipart]: options5 ?? {}
48745
+ var Multipart = (self, options7) => self.annotations({
48746
+ [AnnotationMultipart]: options7 ?? {}
48349
48747
  });
48350
48748
  var MultipartStreamTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiSchema/MultipartStream");
48351
- var MultipartStream = (self, options5) => self.annotations({
48352
- [AnnotationMultipartStream]: options5 ?? {}
48749
+ var MultipartStream = (self, options7) => self.annotations({
48750
+ [AnnotationMultipartStream]: options7 ?? {}
48353
48751
  });
48354
48752
  var defaultContentType = (encoding) => {
48355
48753
  switch (encoding) {
@@ -48367,25 +48765,25 @@ var defaultContentType = (encoding) => {
48367
48765
  }
48368
48766
  }
48369
48767
  };
48370
- var withEncoding = /* @__PURE__ */ dual(2, (self, options5) => self.annotations({
48768
+ var withEncoding = /* @__PURE__ */ dual(2, (self, options7) => self.annotations({
48371
48769
  [AnnotationEncoding]: {
48372
- kind: options5.kind,
48373
- contentType: options5.contentType ?? defaultContentType(options5.kind)
48770
+ kind: options7.kind,
48771
+ contentType: options7.contentType ?? defaultContentType(options7.kind)
48374
48772
  },
48375
- ...options5.kind === "Uint8Array" ? {
48773
+ ...options7.kind === "Uint8Array" ? {
48376
48774
  jsonSchema: {
48377
48775
  type: "string",
48378
48776
  format: "binary"
48379
48777
  }
48380
48778
  } : undefined
48381
48779
  }));
48382
- var Text = (options5) => withEncoding(String$, {
48780
+ var Text = (options7) => withEncoding(String$, {
48383
48781
  kind: "Text",
48384
- ...options5
48782
+ ...options7
48385
48783
  });
48386
- var Uint8Array2 = (options5) => withEncoding(Uint8ArrayFromSelf, {
48784
+ var Uint8Array2 = (options7) => withEncoding(Uint8ArrayFromSelf, {
48387
48785
  kind: "Uint8Array",
48388
- ...options5
48786
+ ...options7
48389
48787
  });
48390
48788
  var astCache2 = /* @__PURE__ */ globalValue("@effect/platform/HttpApiSchema/astCache", () => new WeakMap);
48391
48789
  var deunionize = (schemas, schema) => {
@@ -48412,11 +48810,11 @@ var deunionize = (schemas, schema) => {
48412
48810
  schemas.add(schema);
48413
48811
  }
48414
48812
  };
48415
- var EmptyError = () => (options5) => {
48416
- const symbol3 = Symbol.for(`@effect/platform/HttpApiSchema/EmptyError/${options5.tag}`);
48813
+ var EmptyError = () => (options7) => {
48814
+ const symbol3 = Symbol.for(`@effect/platform/HttpApiSchema/EmptyError/${options7.tag}`);
48417
48815
 
48418
48816
  class EmptyError2 extends StructuralClass {
48419
- _tag = options5.tag;
48817
+ _tag = options7.tag;
48420
48818
  commit() {
48421
48819
  return fail9(this);
48422
48820
  }
@@ -48429,21 +48827,21 @@ var EmptyError = () => (options5) => {
48429
48827
  return make53(this.ast).annotations(annotations4);
48430
48828
  }
48431
48829
  });
48432
- let transform4;
48830
+ let transform5;
48433
48831
  Object.defineProperty(EmptyError2, "ast", {
48434
48832
  get() {
48435
- if (transform4) {
48436
- return transform4.ast;
48833
+ if (transform5) {
48834
+ return transform5.ast;
48437
48835
  }
48438
48836
  const self = this;
48439
- transform4 = asEmpty(declare((u) => hasProperty(u, symbol3), {
48440
- identifier: options5.tag,
48441
- title: options5.tag
48837
+ transform5 = asEmpty(declare((u) => hasProperty(u, symbol3), {
48838
+ identifier: options7.tag,
48839
+ title: options7.tag
48442
48840
  }), {
48443
- status: options5.status,
48841
+ status: options7.status,
48444
48842
  decode: constant(new self)
48445
48843
  });
48446
- return transform4.ast;
48844
+ return transform5.ast;
48447
48845
  }
48448
48846
  });
48449
48847
  return EmptyError2;
@@ -48475,13 +48873,13 @@ class HttpApiDecodeError extends (/* @__PURE__ */ TaggedError2()("HttpApiDecodeE
48475
48873
  }
48476
48874
 
48477
48875
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpApi.js
48478
- var TypeId39 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApi");
48479
- var isHttpApi = (u) => hasProperty(u, TypeId39);
48876
+ var TypeId41 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApi");
48877
+ var isHttpApi = (u) => hasProperty(u, TypeId41);
48480
48878
 
48481
48879
  class Api extends (/* @__PURE__ */ Tag2("@effect/platform/HttpApi/Api")()) {
48482
48880
  }
48483
48881
  var Proto7 = {
48484
- [TypeId39]: TypeId39,
48882
+ [TypeId41]: TypeId41,
48485
48883
  pipe() {
48486
48884
  return pipeArguments(this, arguments);
48487
48885
  },
@@ -48560,41 +48958,41 @@ var Proto7 = {
48560
48958
  });
48561
48959
  }
48562
48960
  };
48563
- var makeProto2 = (options5) => {
48961
+ var makeProto2 = (options7) => {
48564
48962
  function HttpApi() {}
48565
48963
  Object.setPrototypeOf(HttpApi, Proto7);
48566
- HttpApi.groups = options5.groups;
48567
- HttpApi.errorSchema = options5.errorSchema;
48568
- HttpApi.annotations = options5.annotations;
48569
- HttpApi.middlewares = options5.middlewares;
48964
+ HttpApi.groups = options7.groups;
48965
+ HttpApi.errorSchema = options7.errorSchema;
48966
+ HttpApi.annotations = options7.annotations;
48967
+ HttpApi.middlewares = options7.middlewares;
48570
48968
  return HttpApi;
48571
48969
  };
48572
- var make70 = (identifier2) => makeProto2({
48970
+ var make71 = (identifier2) => makeProto2({
48573
48971
  identifier: identifier2,
48574
48972
  groups: new Map,
48575
48973
  errorSchema: HttpApiDecodeError,
48576
48974
  annotations: empty6(),
48577
48975
  middlewares: new Set
48578
48976
  });
48579
- var reflect = (self, options5) => {
48977
+ var reflect = (self, options7) => {
48580
48978
  const apiErrors = extractMembers(self.errorSchema.ast, new Map, getStatusErrorAST);
48581
48979
  const groups = Object.values(self.groups);
48582
48980
  for (const group5 of groups) {
48583
48981
  const groupErrors = extractMembers(group5.errorSchema.ast, apiErrors, getStatusErrorAST);
48584
48982
  const groupAnnotations = merge3(self.annotations, group5.annotations);
48585
- options5.onGroup({
48983
+ options7.onGroup({
48586
48984
  group: group5,
48587
48985
  mergedAnnotations: groupAnnotations
48588
48986
  });
48589
48987
  const endpoints = Object.values(group5.endpoints);
48590
48988
  for (const endpoint of endpoints) {
48591
- if (options5.predicate && !options5.predicate({
48989
+ if (options7.predicate && !options7.predicate({
48592
48990
  endpoint,
48593
48991
  group: group5
48594
48992
  }))
48595
48993
  continue;
48596
48994
  const errors2 = extractMembers(endpoint.errorSchema.ast, groupErrors, getStatusErrorAST);
48597
- options5.onEndpoint({
48995
+ options7.onEndpoint({
48598
48996
  group: group5,
48599
48997
  endpoint,
48600
48998
  middleware: new Set([...group5.middlewares, ...endpoint.middlewares]),
@@ -48708,13 +49106,13 @@ __export(exports_OpenApi, {
48708
49106
  });
48709
49107
 
48710
49108
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/JSONSchema.js
48711
- var fromAST = (ast, options6) => {
48712
- const definitionPath = options6.definitionPath ?? "#/$defs/";
49109
+ var fromAST = (ast, options8) => {
49110
+ const definitionPath = options8.definitionPath ?? "#/$defs/";
48713
49111
  const getRef = (id2) => definitionPath + id2;
48714
- const target = options6.target ?? "jsonSchema7";
48715
- const topLevelReferenceStrategy = options6.topLevelReferenceStrategy ?? "keep";
48716
- const additionalPropertiesStrategy = options6.additionalPropertiesStrategy ?? "strict";
48717
- return go3(ast, options6.definitions, "handle-identifier", [], {
49112
+ const target = options8.target ?? "jsonSchema7";
49113
+ const topLevelReferenceStrategy = options8.topLevelReferenceStrategy ?? "keep";
49114
+ const additionalPropertiesStrategy = options8.additionalPropertiesStrategy ?? "strict";
49115
+ return go3(ast, options8.definitions, "handle-identifier", [], {
48718
49116
  getRef,
48719
49117
  target,
48720
49118
  topLevelReferenceStrategy,
@@ -48905,8 +49303,8 @@ var mergeRefinements = (from, jsonSchema2, ast) => {
48905
49303
  }
48906
49304
  return out;
48907
49305
  };
48908
- function isContentSchemaSupported(options6) {
48909
- switch (options6.target) {
49306
+ function isContentSchemaSupported(options8) {
49307
+ switch (options8.target) {
48910
49308
  case "jsonSchema7":
48911
49309
  return false;
48912
49310
  case "jsonSchema2019-09":
@@ -48915,8 +49313,8 @@ function isContentSchemaSupported(options6) {
48915
49313
  return true;
48916
49314
  }
48917
49315
  }
48918
- function getAdditionalProperties(options6) {
48919
- switch (options6.additionalPropertiesStrategy) {
49316
+ function getAdditionalProperties(options8) {
49317
+ switch (options8.additionalPropertiesStrategy) {
48920
49318
  case "allow":
48921
49319
  return true;
48922
49320
  case "strict":
@@ -48957,17 +49355,17 @@ function getIdentifierAnnotation2(ast) {
48957
49355
  }
48958
49356
  return identifier2;
48959
49357
  }
48960
- function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
48961
- if (identifier2 === "handle-identifier" && (options6.topLevelReferenceStrategy !== "skip" || isSuspend(ast))) {
49358
+ function go3(ast, $defs, identifier2, path2, options8, annotation, errors2) {
49359
+ if (identifier2 === "handle-identifier" && (options8.topLevelReferenceStrategy !== "skip" || isSuspend(ast))) {
48962
49360
  const id2 = getIdentifierAnnotation2(ast);
48963
49361
  if (id2 !== undefined) {
48964
49362
  const escapedId = id2.replace(/~/ig, "~0").replace(/\//ig, "~1");
48965
49363
  const out = {
48966
- $ref: options6.getRef(escapedId)
49364
+ $ref: options8.getRef(escapedId)
48967
49365
  };
48968
49366
  if (!has($defs, id2)) {
48969
49367
  $defs[id2] = out;
48970
- $defs[id2] = go3(ast, $defs, "ignore-identifier", path2, options6, "handle-annotation", errors2);
49368
+ $defs[id2] = go3(ast, $defs, "ignore-identifier", path2, options8, "handle-annotation", errors2);
48971
49369
  }
48972
49370
  return out;
48973
49371
  }
@@ -48988,14 +49386,14 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
48988
49386
  case "Refinement": {
48989
49387
  const t = getTransformationFrom(ast);
48990
49388
  if (t === undefined) {
48991
- return mergeRefinements(go3(ast.from, $defs, identifier2, path2, options6, "handle-annotation", errors2), handler, ast);
49389
+ return mergeRefinements(go3(ast.from, $defs, identifier2, path2, options8, "handle-annotation", errors2), handler, ast);
48992
49390
  } else {
48993
- return go3(t, $defs, identifier2, path2, options6, "handle-annotation", errors2);
49391
+ return go3(t, $defs, identifier2, path2, options8, "handle-annotation", errors2);
48994
49392
  }
48995
49393
  }
48996
49394
  default:
48997
49395
  return {
48998
- ...go3(ast, $defs, identifier2, path2, options6, "ignore-annotation", errors2),
49396
+ ...go3(ast, $defs, identifier2, path2, options8, "ignore-annotation", errors2),
48999
49397
  ...handler
49000
49398
  };
49001
49399
  }
@@ -49004,7 +49402,7 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
49004
49402
  }
49005
49403
  const surrogate = getSurrogateAnnotation(ast);
49006
49404
  if (isSome2(surrogate)) {
49007
- return go3(surrogate.value, $defs, identifier2, path2, options6, "handle-annotation", errors2);
49405
+ return go3(surrogate.value, $defs, identifier2, path2, options8, "handle-annotation", errors2);
49008
49406
  }
49009
49407
  switch (ast._tag) {
49010
49408
  case "Declaration":
@@ -49022,7 +49420,7 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
49022
49420
  return addASTAnnotations(constAny, ast);
49023
49421
  throw new Error(getJSONSchemaMissingIdentifierAnnotationErrorMessage(path2, ast));
49024
49422
  }
49025
- return go3(ast.f(), $defs, "ignore-identifier", path2, options6, "handle-annotation", errors2);
49423
+ return go3(ast.f(), $defs, "ignore-identifier", path2, options8, "handle-annotation", errors2);
49026
49424
  }
49027
49425
  case "NeverKeyword":
49028
49426
  return addASTAnnotations(constNever, ast);
@@ -49087,15 +49485,15 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
49087
49485
  }, ast) : addASTAnnotations(constNever, ast);
49088
49486
  }
49089
49487
  case "TupleType": {
49090
- const elements = ast.elements.map((e, i) => mergeJsonSchemaAnnotations(go3(e.type, $defs, "handle-identifier", path2.concat(i), options6, "handle-annotation", errors2), getContextJsonSchemaAnnotations(e.type, e)));
49091
- const rest = ast.rest.map((type2) => mergeJsonSchemaAnnotations(go3(type2.type, $defs, "handle-identifier", path2, options6, "handle-annotation", errors2), getContextJsonSchemaAnnotations(type2.type, type2)));
49488
+ const elements = ast.elements.map((e, i) => mergeJsonSchemaAnnotations(go3(e.type, $defs, "handle-identifier", path2.concat(i), options8, "handle-annotation", errors2), getContextJsonSchemaAnnotations(e.type, e)));
49489
+ const rest = ast.rest.map((type2) => mergeJsonSchemaAnnotations(go3(type2.type, $defs, "handle-identifier", path2, options8, "handle-annotation", errors2), getContextJsonSchemaAnnotations(type2.type, type2)));
49092
49490
  const output = {
49093
49491
  type: "array"
49094
49492
  };
49095
49493
  const len = ast.elements.length;
49096
49494
  if (len > 0) {
49097
49495
  output.minItems = len - ast.elements.filter((element2) => element2.isOptional).length;
49098
- if (options6.target === "jsonSchema7") {
49496
+ if (options8.target === "jsonSchema7") {
49099
49497
  output.items = elements;
49100
49498
  } else {
49101
49499
  output.prefixItems = elements;
@@ -49103,20 +49501,20 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
49103
49501
  }
49104
49502
  const restLength = rest.length;
49105
49503
  if (restLength > 0) {
49106
- const head10 = rest[0];
49504
+ const head12 = rest[0];
49107
49505
  const isHomogeneous = restLength === 1 && ast.elements.every((e) => e.type === ast.rest[0].type);
49108
49506
  if (isHomogeneous) {
49109
- if (options6.target === "jsonSchema7") {
49110
- output.items = head10;
49507
+ if (options8.target === "jsonSchema7") {
49508
+ output.items = head12;
49111
49509
  } else {
49112
- output.items = head10;
49510
+ output.items = head12;
49113
49511
  delete output.prefixItems;
49114
49512
  }
49115
49513
  } else {
49116
- if (options6.target === "jsonSchema7") {
49117
- output.additionalItems = head10;
49514
+ if (options8.target === "jsonSchema7") {
49515
+ output.additionalItems = head12;
49118
49516
  } else {
49119
- output.items = head10;
49517
+ output.items = head12;
49120
49518
  }
49121
49519
  }
49122
49520
  if (restLength > 1) {
@@ -49126,7 +49524,7 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
49126
49524
  }
49127
49525
  } else {
49128
49526
  if (len > 0) {
49129
- if (options6.target === "jsonSchema7") {
49527
+ if (options8.target === "jsonSchema7") {
49130
49528
  output.additionalItems = false;
49131
49529
  } else {
49132
49530
  output.items = false;
@@ -49145,7 +49543,7 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
49145
49543
  type: "object",
49146
49544
  required: [],
49147
49545
  properties: {},
49148
- additionalProperties: getAdditionalProperties(options6)
49546
+ additionalProperties: getAdditionalProperties(options8)
49149
49547
  };
49150
49548
  let patternProperties = undefined;
49151
49549
  let propertyNames = undefined;
@@ -49154,11 +49552,11 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
49154
49552
  const parameter = is3.parameter;
49155
49553
  switch (parameter._tag) {
49156
49554
  case "StringKeyword": {
49157
- output.additionalProperties = go3(pruned, $defs, "handle-identifier", path2, options6, "handle-annotation", errors2);
49555
+ output.additionalProperties = go3(pruned, $defs, "handle-identifier", path2, options8, "handle-annotation", errors2);
49158
49556
  break;
49159
49557
  }
49160
49558
  case "TemplateLiteral": {
49161
- patternProperties = go3(pruned, $defs, "handle-identifier", path2, options6, "handle-annotation", errors2);
49559
+ patternProperties = go3(pruned, $defs, "handle-identifier", path2, options8, "handle-annotation", errors2);
49162
49560
  propertyNames = {
49163
49561
  type: "string",
49164
49562
  pattern: getTemplateLiteralRegExp(parameter).source
@@ -49166,14 +49564,14 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
49166
49564
  break;
49167
49565
  }
49168
49566
  case "Refinement": {
49169
- patternProperties = go3(pruned, $defs, "handle-identifier", path2, options6, "handle-annotation", errors2);
49170
- propertyNames = go3(parameter, $defs, "handle-identifier", path2, options6, "handle-annotation", errors2);
49567
+ patternProperties = go3(pruned, $defs, "handle-identifier", path2, options8, "handle-annotation", errors2);
49568
+ propertyNames = go3(parameter, $defs, "handle-identifier", path2, options8, "handle-annotation", errors2);
49171
49569
  break;
49172
49570
  }
49173
49571
  case "SymbolKeyword": {
49174
49572
  const indexSignaturePath = path2.concat("[symbol]");
49175
- output.additionalProperties = go3(pruned, $defs, "handle-identifier", indexSignaturePath, options6, "handle-annotation", errors2);
49176
- propertyNames = go3(parameter, $defs, "handle-identifier", indexSignaturePath, options6, "handle-annotation", errors2);
49573
+ output.additionalProperties = go3(pruned, $defs, "handle-identifier", indexSignaturePath, options8, "handle-annotation", errors2);
49574
+ propertyNames = go3(parameter, $defs, "handle-identifier", indexSignaturePath, options8, "handle-annotation", errors2);
49177
49575
  break;
49178
49576
  }
49179
49577
  }
@@ -49184,7 +49582,7 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
49184
49582
  if (isString(name)) {
49185
49583
  const pruned = pruneUndefined3(ps.type);
49186
49584
  const type2 = pruned ?? ps.type;
49187
- output.properties[name] = mergeJsonSchemaAnnotations(go3(type2, $defs, "handle-identifier", path2.concat(ps.name), options6, "handle-annotation", errors2), getContextJsonSchemaAnnotations(type2, ps));
49585
+ output.properties[name] = mergeJsonSchemaAnnotations(go3(type2, $defs, "handle-identifier", path2.concat(ps.name), options8, "handle-annotation", errors2), getContextJsonSchemaAnnotations(type2, ps));
49188
49586
  if (!ps.isOptional && pruned === undefined) {
49189
49587
  output.required.push(name);
49190
49588
  }
@@ -49206,7 +49604,7 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
49206
49604
  return addASTAnnotations(output, ast);
49207
49605
  }
49208
49606
  case "Union": {
49209
- const members = ast.types.map((t) => go3(t, $defs, "handle-identifier", path2, options6, "handle-annotation", errors2));
49607
+ const members = ast.types.map((t) => go3(t, $defs, "handle-identifier", path2, options8, "handle-annotation", errors2));
49210
49608
  const anyOf = compactUnion(members);
49211
49609
  switch (anyOf.length) {
49212
49610
  case 0:
@@ -49220,7 +49618,7 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
49220
49618
  }
49221
49619
  }
49222
49620
  case "Refinement":
49223
- return go3(ast.from, $defs, identifier2, path2, options6, "handle-annotation", errors2);
49621
+ return go3(ast.from, $defs, identifier2, path2, options8, "handle-annotation", errors2);
49224
49622
  case "TemplateLiteral": {
49225
49623
  const regex = getTemplateLiteralRegExp(ast);
49226
49624
  return addASTAnnotations({
@@ -49236,14 +49634,14 @@ function go3(ast, $defs, identifier2, path2, options6, annotation, errors2) {
49236
49634
  type: "string",
49237
49635
  contentMediaType: "application/json"
49238
49636
  };
49239
- if (isContentSchemaSupported(options6)) {
49240
- out["contentSchema"] = go3(ast.to, $defs, identifier2, path2, options6, "handle-annotation", errors2);
49637
+ if (isContentSchemaSupported(options8)) {
49638
+ out["contentSchema"] = go3(ast.to, $defs, identifier2, path2, options8, "handle-annotation", errors2);
49241
49639
  }
49242
49640
  return out;
49243
49641
  }
49244
- const from = go3(ast.from, $defs, identifier2, path2, options6, "handle-annotation", errors2);
49642
+ const from = go3(ast.from, $defs, identifier2, path2, options8, "handle-annotation", errors2);
49245
49643
  if (ast.transformation._tag === "TypeLiteralTransformation" && isJsonSchema7Object(from)) {
49246
- const to = go3(ast.to, {}, "ignore-identifier", path2, options6, "handle-annotation", "ignore-errors");
49644
+ const to = go3(ast.to, {}, "ignore-identifier", path2, options8, "handle-annotation", "ignore-errors");
49247
49645
  if (isJsonSchema7Object(to)) {
49248
49646
  for (const t of ast.transformation.propertySignatureTransformations) {
49249
49647
  const toKey = t.to;
@@ -49315,13 +49713,13 @@ function compactUnion(members) {
49315
49713
  }
49316
49714
 
49317
49715
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/OpenApiJsonSchema.js
49318
- var fromAST2 = (ast, options6) => {
49716
+ var fromAST2 = (ast, options8) => {
49319
49717
  const jsonSchema2 = fromAST(ast, {
49320
- definitions: options6.defs,
49321
- definitionPath: options6.defsPath ?? "#/components/schemas/",
49718
+ definitions: options8.defs,
49719
+ definitionPath: options8.defsPath ?? "#/components/schemas/",
49322
49720
  target: "openApi3.1",
49323
- topLevelReferenceStrategy: options6.topLevelReferenceStrategy,
49324
- additionalPropertiesStrategy: options6.additionalPropertiesStrategy
49721
+ topLevelReferenceStrategy: options8.topLevelReferenceStrategy,
49722
+ additionalPropertiesStrategy: options8.additionalPropertiesStrategy
49325
49723
  });
49326
49724
  return jsonSchema2;
49327
49725
  };
@@ -49369,11 +49767,11 @@ class Transform extends (/* @__PURE__ */ Tag2("@effect/platform/OpenApi/Transfor
49369
49767
  }
49370
49768
  var contextPartial = (tags2) => {
49371
49769
  const entries2 = Object.entries(tags2);
49372
- return (options6) => {
49770
+ return (options8) => {
49373
49771
  let context8 = empty6();
49374
49772
  for (const [key, tag6] of entries2) {
49375
- if (options6[key] !== undefined) {
49376
- context8 = add2(context8, tag6, options6[key]);
49773
+ if (options8[key] !== undefined) {
49774
+ context8 = add2(context8, tag6, options8[key]);
49377
49775
  }
49378
49776
  }
49379
49777
  return context8;
@@ -49401,7 +49799,7 @@ function processAnnotation(ctx, tag6, f) {
49401
49799
  f(o.value);
49402
49800
  }
49403
49801
  }
49404
- var fromApi = (api, options6) => {
49802
+ var fromApi = (api, options8) => {
49405
49803
  const cached4 = apiCache.get(api);
49406
49804
  if (cached4 !== undefined) {
49407
49805
  return cached4;
@@ -49424,7 +49822,7 @@ var fromApi = (api, options6) => {
49424
49822
  function processAST(ast) {
49425
49823
  return fromAST2(ast, {
49426
49824
  defs: jsonSchemaDefs,
49427
- additionalPropertiesStrategy: options6?.additionalPropertiesStrategy
49825
+ additionalPropertiesStrategy: options8?.additionalPropertiesStrategy
49428
49826
  });
49429
49827
  }
49430
49828
  function processHttpApiSecurity(name, security) {
@@ -49777,7 +50175,7 @@ var makeManager = /* @__PURE__ */ gen2(function* () {
49777
50175
  const release = sync3(() => requestMap.delete(id3));
49778
50176
  return isFailure2(exit3) ? zipRight3(orDie3(backing.send([id3, 1])), release) : release;
49779
50177
  };
49780
- const execute3 = (request2) => fromChannel4(acquireUseRelease4(executeAcquire(request2, make68()), ({
50178
+ const execute4 = (request2) => fromChannel4(acquireUseRelease4(executeAcquire(request2, make69()), ({
49781
50179
  mailbox
49782
50180
  }) => toChannel4(mailbox), executeRelease));
49783
50181
  const executeEffect = (request2) => acquireUseRelease2(executeAcquire(request2, make40()), ({
@@ -49792,7 +50190,7 @@ var makeManager = /* @__PURE__ */ gen2(function* () {
49792
50190
  }
49793
50191
  return {
49794
50192
  id: id2,
49795
- execute: execute3,
50193
+ execute: execute4,
49796
50194
  executeEffect
49797
50195
  };
49798
50196
  });
@@ -49800,7 +50198,7 @@ var makeManager = /* @__PURE__ */ gen2(function* () {
49800
50198
  });
49801
50199
  });
49802
50200
  var layerManager = /* @__PURE__ */ effect(WorkerManager, makeManager);
49803
- var makePlatform = () => (options6) => PlatformWorker.of({
50201
+ var makePlatform = () => (options8) => PlatformWorker.of({
49804
50202
  [PlatformWorkerTypeId]: PlatformWorkerTypeId,
49805
50203
  spawn(id2) {
49806
50204
  return gen2(function* () {
@@ -49809,7 +50207,7 @@ var makePlatform = () => (options6) => PlatformWorker.of({
49809
50207
  const buffer3 = [];
49810
50208
  const run10 = (handler) => uninterruptibleMask3((restore) => gen2(function* () {
49811
50209
  const scope5 = yield* scope3;
49812
- const port2 = yield* options6.setup({
50210
+ const port2 = yield* options8.setup({
49813
50211
  worker: spawn(id2),
49814
50212
  scope: scope5
49815
50213
  });
@@ -49818,9 +50216,9 @@ var makePlatform = () => (options6) => PlatformWorker.of({
49818
50216
  currentPort = undefined;
49819
50217
  }));
49820
50218
  const runtime5 = (yield* runtime4()).pipe(updateContext3(omit2(Scope)));
49821
- const fiberSet = yield* make69();
50219
+ const fiberSet = yield* make70();
49822
50220
  const runFork4 = runFork3(runtime5);
49823
- yield* options6.listen({
50221
+ yield* options8.listen({
49824
50222
  port: port2,
49825
50223
  scope: scope5,
49826
50224
  emit(data) {
@@ -49879,11 +50277,11 @@ var requestInitTagKey = "@effect/platform/FetchHttpClient/FetchOptions";
49879
50277
  var fetch2 = /* @__PURE__ */ make65((request2, url2, signal, fiber) => {
49880
50278
  const context8 = fiber.getFiberRef(currentContext2);
49881
50279
  const fetch3 = context8.unsafeMap.get(fetchTagKey) ?? globalThis.fetch;
49882
- const options6 = context8.unsafeMap.get(requestInitTagKey) ?? {};
49883
- const headers = options6.headers ? merge11(fromInput2(options6.headers), request2.headers) : request2.headers;
50280
+ const options8 = context8.unsafeMap.get(requestInitTagKey) ?? {};
50281
+ const headers = options8.headers ? merge12(fromInput2(options8.headers), request2.headers) : request2.headers;
49884
50282
  const send = (body) => map17(tryPromise2({
49885
50283
  try: () => fetch3(url2, {
49886
- ...options6,
50284
+ ...options8,
49887
50285
  method: request2.method,
49888
50286
  headers,
49889
50287
  body,
@@ -49924,7 +50322,7 @@ __export(exports_BunContext, {
49924
50322
  });
49925
50323
 
49926
50324
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/internal/commandExecutor.js
49927
- var TypeId41 = /* @__PURE__ */ Symbol.for("@effect/platform/CommandExecutor");
50325
+ var TypeId43 = /* @__PURE__ */ Symbol.for("@effect/platform/CommandExecutor");
49928
50326
  var ProcessTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/Process");
49929
50327
  var ExitCode = /* @__PURE__ */ nominal();
49930
50328
  var ProcessId = /* @__PURE__ */ nominal();
@@ -49936,7 +50334,7 @@ var makeExecutor = (start3) => {
49936
50334
  return splitLines3(mapChunks2(stream5(command), map5((bytes) => decoder2.decode(bytes))));
49937
50335
  };
49938
50336
  return {
49939
- [TypeId41]: TypeId41,
50337
+ [TypeId43]: TypeId43,
49940
50338
  start: start3,
49941
50339
  exitCode: (command) => scoped2(flatMap10(start3(command), (process2) => process2.exitCode)),
49942
50340
  stream: stream5,
@@ -49994,7 +50392,7 @@ var StandardProto = {
49994
50392
  };
49995
50393
  }
49996
50394
  };
49997
- var makeStandard = (options6) => Object.assign(Object.create(StandardProto), options6);
50395
+ var makeStandard = (options8) => Object.assign(Object.create(StandardProto), options8);
49998
50396
  var PipedProto = {
49999
50397
  ...Proto8,
50000
50398
  _tag: "PipedCommand",
@@ -50007,7 +50405,7 @@ var PipedProto = {
50007
50405
  };
50008
50406
  }
50009
50407
  };
50010
- var makePiped = (options6) => Object.assign(Object.create(PipedProto), options6);
50408
+ var makePiped = (options8) => Object.assign(Object.create(PipedProto), options8);
50011
50409
  var stdin = /* @__PURE__ */ dual(2, (self, input) => {
50012
50410
  switch (self._tag) {
50013
50411
  case "StandardCommand": {
@@ -50077,8 +50475,8 @@ var handleErrnoException = (module, method) => (err, [path2]) => {
50077
50475
  };
50078
50476
 
50079
50477
  // ../../node_modules/.bun/@effect+platform-node-shared@0.59.0+15f69c4693c05b6b/node_modules/@effect/platform-node-shared/dist/esm/internal/stream.js
50080
- var fromReadable = (evaluate2, onError4, options6) => fromChannel4(fromReadableChannel(evaluate2, onError4, options6));
50081
- var fromReadableChannel = (evaluate2, onError4, options6) => suspend8(() => unsafeReadableRead(evaluate2(), onError4, make13(undefined), options6));
50478
+ var fromReadable = (evaluate2, onError4, options8) => fromChannel4(fromReadableChannel(evaluate2, onError4, options8));
50479
+ var fromReadableChannel = (evaluate2, onError4, options8) => suspend8(() => unsafeReadableRead(evaluate2(), onError4, make13(undefined), options8));
50082
50480
  var writeInput = (writable, onFailure, {
50083
50481
  encoding,
50084
50482
  endOnDone = true
@@ -50116,7 +50514,7 @@ var writeEffect = (writable, encoding) => (chunk4) => chunk4.length === 0 ? _voi
50116
50514
  }
50117
50515
  loop3();
50118
50516
  });
50119
- var unsafeReadableRead = (readable, onError4, exit3, options6) => {
50517
+ var unsafeReadableRead = (readable, onError4, exit3, options8) => {
50120
50518
  if (!readable.readable) {
50121
50519
  return void_6;
50122
50520
  }
@@ -50135,7 +50533,7 @@ var unsafeReadableRead = (readable, onError4, exit3, options6) => {
50135
50533
  readable.on("readable", onReadable);
50136
50534
  readable.on("error", onErr);
50137
50535
  readable.on("end", onEnd2);
50138
- const chunkSize = options6?.chunkSize ? Number(options6.chunkSize) : undefined;
50536
+ const chunkSize = options8?.chunkSize ? Number(options8.chunkSize) : undefined;
50139
50537
  const read3 = suspend8(function loop() {
50140
50538
  let item = readable.read(chunkSize);
50141
50539
  if (item === null) {
@@ -50158,15 +50556,15 @@ var unsafeReadableRead = (readable, onError4, exit3, options6) => {
50158
50556
  readable.off("readable", onReadable);
50159
50557
  readable.off("error", onErr);
50160
50558
  readable.off("end", onEnd2);
50161
- if (options6?.closeOnDone !== false && "closed" in readable && !readable.closed) {
50559
+ if (options8?.closeOnDone !== false && "closed" in readable && !readable.closed) {
50162
50560
  readable.destroy();
50163
50561
  }
50164
50562
  }));
50165
50563
  };
50166
50564
 
50167
50565
  // ../../node_modules/.bun/@effect+platform-node-shared@0.59.0+15f69c4693c05b6b/node_modules/@effect/platform-node-shared/dist/esm/internal/sink.js
50168
- var fromWritable = (evaluate2, onError4, options6) => fromChannel3(fromWritableChannel(evaluate2, onError4, options6));
50169
- var fromWritableChannel = (writable, onError4, options6) => flatMap16(zip5(sync3(() => writable()), make40()), ([writable2, deferred]) => embedInput2(writableOutput(writable2, deferred, onError4), writeInput(writable2, (cause3) => failCause6(deferred, cause3), options6, complete2(deferred, _void))));
50566
+ var fromWritable = (evaluate2, onError4, options8) => fromChannel3(fromWritableChannel(evaluate2, onError4, options8));
50567
+ var fromWritableChannel = (writable, onError4, options8) => flatMap16(zip5(sync3(() => writable()), make40()), ([writable2, deferred]) => embedInput2(writableOutput(writable2, deferred, onError4), writeInput(writable2, (cause3) => failCause6(deferred, cause3), options8, complete2(deferred, _void))));
50170
50568
  var writableOutput = (writable, deferred, onError4) => suspend3(() => {
50171
50569
  function handleError(err) {
50172
50570
  unsafeDone(deferred, fail9(onError4(err)));
@@ -50286,11 +50684,11 @@ var runCommand = (fileSystem) => (command) => {
50286
50684
  if (flattened2.length === 1) {
50287
50685
  return pipe(flattened2[0], runCommand(fileSystem));
50288
50686
  }
50289
- const head10 = flattened2[0];
50687
+ const head12 = flattened2[0];
50290
50688
  const tail2 = flattened2.slice(1);
50291
50689
  const initial = tail2.slice(0, tail2.length - 1);
50292
50690
  const last5 = tail2[tail2.length - 1];
50293
- const stream6 = initial.reduce((stdin3, command2) => pipe(stdin2(command2, stdin3), runCommand(fileSystem), map17((process2) => process2.stdout), unwrapScoped7), pipe(runCommand(fileSystem)(head10), map17((process2) => process2.stdout), unwrapScoped7));
50691
+ const stream6 = initial.reduce((stdin3, command2) => pipe(stdin2(command2, stdin3), runCommand(fileSystem), map17((process2) => process2.stdout), unwrapScoped7), pipe(runCommand(fileSystem)(head12), map17((process2) => process2.stdout), unwrapScoped7));
50294
50692
  return pipe(stdin2(last5, stream6), runCommand(fileSystem));
50295
50693
  }
50296
50694
  }
@@ -50333,12 +50731,12 @@ var handleBadArgument = (method) => (cause3) => new BadArgument({
50333
50731
  });
50334
50732
  var access2 = /* @__PURE__ */ (() => {
50335
50733
  const nodeAccess = /* @__PURE__ */ effectify2(NFS.access, /* @__PURE__ */ handleErrnoException("FileSystem", "access"), /* @__PURE__ */ handleBadArgument("access"));
50336
- return (path2, options6) => {
50734
+ return (path2, options8) => {
50337
50735
  let mode = NFS.constants.F_OK;
50338
- if (options6?.readable) {
50736
+ if (options8?.readable) {
50339
50737
  mode |= NFS.constants.R_OK;
50340
50738
  }
50341
- if (options6?.writable) {
50739
+ if (options8?.writable) {
50342
50740
  mode |= NFS.constants.W_OK;
50343
50741
  }
50344
50742
  return nodeAccess(path2, mode);
@@ -50346,9 +50744,9 @@ var access2 = /* @__PURE__ */ (() => {
50346
50744
  })();
50347
50745
  var copy3 = /* @__PURE__ */ (() => {
50348
50746
  const nodeCp = /* @__PURE__ */ effectify2(NFS.cp, /* @__PURE__ */ handleErrnoException("FileSystem", "copy"), /* @__PURE__ */ handleBadArgument("copy"));
50349
- return (fromPath, toPath, options6) => nodeCp(fromPath, toPath, {
50350
- force: options6?.overwrite ?? false,
50351
- preserveTimestamps: options6?.preserveTimestamps ?? false,
50747
+ return (fromPath, toPath, options8) => nodeCp(fromPath, toPath, {
50748
+ force: options8?.overwrite ?? false,
50749
+ preserveTimestamps: options8?.preserveTimestamps ?? false,
50352
50750
  recursive: true
50353
50751
  });
50354
50752
  })();
@@ -50370,39 +50768,39 @@ var link2 = /* @__PURE__ */ (() => {
50370
50768
  })();
50371
50769
  var makeDirectory = /* @__PURE__ */ (() => {
50372
50770
  const nodeMkdir = /* @__PURE__ */ effectify2(NFS.mkdir, /* @__PURE__ */ handleErrnoException("FileSystem", "makeDirectory"), /* @__PURE__ */ handleBadArgument("makeDirectory"));
50373
- return (path2, options6) => nodeMkdir(path2, {
50374
- recursive: options6?.recursive ?? false,
50375
- mode: options6?.mode
50771
+ return (path2, options8) => nodeMkdir(path2, {
50772
+ recursive: options8?.recursive ?? false,
50773
+ mode: options8?.mode
50376
50774
  });
50377
50775
  })();
50378
50776
  var makeTempDirectoryFactory = (method) => {
50379
50777
  const nodeMkdtemp = effectify2(NFS.mkdtemp, handleErrnoException("FileSystem", method), handleBadArgument(method));
50380
- return (options6) => suspend3(() => {
50381
- const prefix = options6?.prefix ?? "";
50382
- const directory3 = typeof options6?.directory === "string" ? Path3.join(options6.directory, ".") : OS.tmpdir();
50778
+ return (options8) => suspend3(() => {
50779
+ const prefix = options8?.prefix ?? "";
50780
+ const directory3 = typeof options8?.directory === "string" ? Path3.join(options8.directory, ".") : OS.tmpdir();
50383
50781
  return nodeMkdtemp(prefix ? Path3.join(directory3, prefix) : directory3 + "/");
50384
50782
  });
50385
50783
  };
50386
50784
  var makeTempDirectory = /* @__PURE__ */ makeTempDirectoryFactory("makeTempDirectory");
50387
50785
  var removeFactory = (method) => {
50388
50786
  const nodeRm = effectify2(NFS.rm, handleErrnoException("FileSystem", method), handleBadArgument(method));
50389
- return (path2, options6) => nodeRm(path2, {
50390
- recursive: options6?.recursive ?? false,
50391
- force: options6?.force ?? false
50787
+ return (path2, options8) => nodeRm(path2, {
50788
+ recursive: options8?.recursive ?? false,
50789
+ force: options8?.force ?? false
50392
50790
  });
50393
50791
  };
50394
50792
  var remove9 = /* @__PURE__ */ removeFactory("remove");
50395
50793
  var makeTempDirectoryScoped = /* @__PURE__ */ (() => {
50396
50794
  const makeDirectory2 = /* @__PURE__ */ makeTempDirectoryFactory("makeTempDirectoryScoped");
50397
50795
  const removeDirectory = /* @__PURE__ */ removeFactory("makeTempDirectoryScoped");
50398
- return (options6) => acquireRelease2(makeDirectory2(options6), (directory3) => orDie3(removeDirectory(directory3, {
50796
+ return (options8) => acquireRelease2(makeDirectory2(options8), (directory3) => orDie3(removeDirectory(directory3, {
50399
50797
  recursive: true
50400
50798
  })));
50401
50799
  })();
50402
50800
  var openFactory = (method) => {
50403
50801
  const nodeOpen = effectify2(NFS.open, handleErrnoException("FileSystem", method), handleBadArgument(method));
50404
50802
  const nodeClose = effectify2(NFS.close, handleErrnoException("FileSystem", method), handleBadArgument(method));
50405
- return (path2, options6) => pipe(acquireRelease2(nodeOpen(path2, options6?.flag ?? "r", options6?.mode), (fd) => orDie3(nodeClose(fd))), map17((fd) => makeFile(FileDescriptor(fd), options6?.flag?.startsWith("a") ?? false)));
50803
+ return (path2, options8) => pipe(acquireRelease2(nodeOpen(path2, options8?.flag ?? "r", options8?.mode), (fd) => orDie3(nodeClose(fd))), map17((fd) => makeFile(FileDescriptor(fd), options8?.flag?.startsWith("a") ?? false)));
50406
50804
  };
50407
50805
  var open2 = /* @__PURE__ */ openFactory("open");
50408
50806
  var makeFile = /* @__PURE__ */ (() => {
@@ -50518,7 +50916,7 @@ var makeTempFileFactory = (method) => {
50518
50916
  const makeDirectory2 = makeTempDirectoryFactory(method);
50519
50917
  const open3 = openFactory(method);
50520
50918
  const randomHexString2 = (bytes) => sync3(() => Crypto.randomBytes(bytes).toString("hex"));
50521
- return (options6) => pipe(zip5(makeDirectory2(options6), randomHexString2(6)), map17(([directory3, random4]) => Path3.join(directory3, random4 + (options6?.suffix ?? ""))), tap3((path2) => scoped2(open3(path2, {
50919
+ return (options8) => pipe(zip5(makeDirectory2(options8), randomHexString2(6)), map17(([directory3, random4]) => Path3.join(directory3, random4 + (options8?.suffix ?? ""))), tap3((path2) => scoped2(open3(path2, {
50522
50920
  flag: "w+"
50523
50921
  }))));
50524
50922
  };
@@ -50526,12 +50924,12 @@ var makeTempFile = /* @__PURE__ */ makeTempFileFactory("makeTempFile");
50526
50924
  var makeTempFileScoped = /* @__PURE__ */ (() => {
50527
50925
  const makeFile2 = /* @__PURE__ */ makeTempFileFactory("makeTempFileScoped");
50528
50926
  const removeDirectory = /* @__PURE__ */ removeFactory("makeTempFileScoped");
50529
- return (options6) => acquireRelease2(makeFile2(options6), (file6) => orDie3(removeDirectory(Path3.dirname(file6), {
50927
+ return (options8) => acquireRelease2(makeFile2(options8), (file6) => orDie3(removeDirectory(Path3.dirname(file6), {
50530
50928
  recursive: true
50531
50929
  })));
50532
50930
  })();
50533
- var readDirectory = (path2, options6) => tryPromise2({
50534
- try: () => NFS.promises.readdir(path2, options6),
50931
+ var readDirectory = (path2, options8) => tryPromise2({
50932
+ try: () => NFS.promises.readdir(path2, options8),
50535
50933
  catch: (err) => handleErrnoException("FileSystem", "readDirectory")(err, [path2])
50536
50934
  });
50537
50935
  var readFile2 = (path2) => async((resume2, signal) => {
@@ -50593,9 +50991,9 @@ var utimes2 = /* @__PURE__ */ (() => {
50593
50991
  const nodeUtimes = /* @__PURE__ */ effectify2(NFS.utimes, /* @__PURE__ */ handleErrnoException("FileSystem", "utime"), /* @__PURE__ */ handleBadArgument("utime"));
50594
50992
  return (path2, atime, mtime) => nodeUtimes(path2, atime, mtime);
50595
50993
  })();
50596
- var watchNode = (path2, options6) => asyncScoped2((emit) => acquireRelease2(sync3(() => {
50994
+ var watchNode = (path2, options8) => asyncScoped2((emit) => acquireRelease2(sync3(() => {
50597
50995
  const watcher = NFS.watch(path2, {
50598
- recursive: options6?.recursive
50996
+ recursive: options8?.recursive
50599
50997
  }, (event, path3) => {
50600
50998
  if (!path3)
50601
50999
  return;
@@ -50633,13 +51031,13 @@ var watchNode = (path2, options6) => asyncScoped2((emit) => acquireRelease2(sync
50633
51031
  });
50634
51032
  return watcher;
50635
51033
  }), (watcher) => sync3(() => watcher.close())));
50636
- var watch2 = (backend, path2, options6) => stat2(path2).pipe(map17((stat3) => backend.pipe(flatMap((_) => _.register(path2, stat3, options6)), getOrElse(() => watchNode(path2, options6)))), unwrap4);
50637
- var writeFile2 = (path2, data, options6) => async((resume2, signal) => {
51034
+ var watch2 = (backend, path2, options8) => stat2(path2).pipe(map17((stat3) => backend.pipe(flatMap((_) => _.register(path2, stat3, options8)), getOrElse(() => watchNode(path2, options8)))), unwrap4);
51035
+ var writeFile2 = (path2, data, options8) => async((resume2, signal) => {
50638
51036
  try {
50639
51037
  NFS.writeFile(path2, data, {
50640
51038
  signal,
50641
- flag: options6?.flag,
50642
- mode: options6?.mode
51039
+ flag: options8?.flag,
51040
+ mode: options8?.mode
50643
51041
  }, (err) => {
50644
51042
  if (err) {
50645
51043
  resume2(fail9(handleErrnoException("FileSystem", "writeFile")(err, [path2])));
@@ -50674,8 +51072,8 @@ var makeFileSystem = /* @__PURE__ */ map17(/* @__PURE__ */ serviceOption2(WatchB
50674
51072
  symlink: symlink2,
50675
51073
  truncate: truncate2,
50676
51074
  utimes: utimes2,
50677
- watch(path2, options6) {
50678
- return watch2(backend, path2, options6);
51075
+ watch(path2, options8) {
51076
+ return watch2(backend, path2, options8);
50679
51077
  },
50680
51078
  writeFile: writeFile2
50681
51079
  }));
@@ -50736,7 +51134,7 @@ var layer12 = layer11;
50736
51134
  // ../../node_modules/.bun/@effect+platform-node-shared@0.59.0+15f69c4693c05b6b/node_modules/@effect/platform-node-shared/dist/esm/internal/terminal.js
50737
51135
  import * as readline from "readline";
50738
51136
  var defaultShouldQuit = (input) => input.key.ctrl && (input.key.name === "c" || input.key.name === "d");
50739
- var make72 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQuit) {
51137
+ var make73 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQuit) {
50740
51138
  const stdin3 = process.stdin;
50741
51139
  const stdout2 = process.stdout;
50742
51140
  const rlRef = yield* make45({
@@ -50762,7 +51160,7 @@ var make72 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
50762
51160
  const isTTY = sync3(() => Boolean(stdout2.isTTY));
50763
51161
  const readInput = gen2(function* () {
50764
51162
  yield* get14(rlRef);
50765
- const mailbox = yield* make68();
51163
+ const mailbox = yield* make69();
50766
51164
  const handleKeypress = (s, k) => {
50767
51165
  const userInput = {
50768
51166
  input: fromNullable(s),
@@ -50804,7 +51202,7 @@ var make72 = /* @__PURE__ */ fnUntraced2(function* (shouldQuit = defaultShouldQu
50804
51202
  display
50805
51203
  });
50806
51204
  });
50807
- var layer13 = /* @__PURE__ */ scoped3(Terminal, /* @__PURE__ */ make72(defaultShouldQuit));
51205
+ var layer13 = /* @__PURE__ */ scoped3(Terminal, /* @__PURE__ */ make73(defaultShouldQuit));
50808
51206
 
50809
51207
  // ../../node_modules/.bun/@effect+platform-node-shared@0.59.0+15f69c4693c05b6b/node_modules/@effect/platform-node-shared/dist/esm/NodeTerminal.js
50810
51208
  var layer14 = layer13;
@@ -50880,18 +51278,18 @@ var addPrettyLogger = (refs, fiberId3) => {
50880
51278
  value: loggers.pipe(remove4(defaultLogger2), add4(prettyLoggerDefault2))
50881
51279
  });
50882
51280
  };
50883
- var makeRunMain = (f) => dual((args2) => isEffect2(args2[0]), (effect3, options6) => {
50884
- const fiber = options6?.disableErrorReporting === true ? runFork2(effect3, {
50885
- updateRefs: options6?.disablePrettyLogger === true ? undefined : addPrettyLogger
51281
+ var makeRunMain = (f) => dual((args2) => isEffect2(args2[0]), (effect3, options8) => {
51282
+ const fiber = options8?.disableErrorReporting === true ? runFork2(effect3, {
51283
+ updateRefs: options8?.disablePrettyLogger === true ? undefined : addPrettyLogger
50886
51284
  }) : runFork2(tapErrorCause3(effect3, (cause3) => {
50887
51285
  if (isInterruptedOnly2(cause3)) {
50888
51286
  return _void;
50889
51287
  }
50890
51288
  return logError2(cause3);
50891
51289
  }), {
50892
- updateRefs: options6?.disablePrettyLogger === true ? undefined : addPrettyLogger
51290
+ updateRefs: options8?.disablePrettyLogger === true ? undefined : addPrettyLogger
50893
51291
  });
50894
- const teardown = options6?.teardown ?? defaultTeardown;
51292
+ const teardown = options8?.teardown ?? defaultTeardown;
50895
51293
  return f({
50896
51294
  fiber,
50897
51295
  teardown
@@ -50932,21 +51330,200 @@ var runMain2 = runMain;
50932
51330
 
50933
51331
  // ../../node_modules/.bun/@effect+platform-bun@0.89.0+15f69c4693c05b6b/node_modules/@effect/platform-bun/dist/esm/BunRuntime.js
50934
51332
  var runMain3 = runMain2;
51333
+ // src/github/issues.ts
51334
+ import { execFileSync } from "child_process";
51335
+ var githubApiBaseUrl = "https://api.github.com";
51336
+ var githubToken = () => {
51337
+ const envToken = process.env.GH_TOKEN?.trim() || process.env.GITHUB_TOKEN?.trim();
51338
+ if (envToken !== undefined && envToken.length > 0) {
51339
+ return envToken;
51340
+ }
51341
+ try {
51342
+ return execFileSync("gh", ["auth", "token"], {
51343
+ encoding: "utf8",
51344
+ stdio: ["ignore", "pipe", "ignore"]
51345
+ }).trim();
51346
+ } catch {
51347
+ return;
51348
+ }
51349
+ };
51350
+ var githubHeaders = (token) => ({
51351
+ accept: "application/vnd.github+json",
51352
+ authorization: `Bearer ${token}`,
51353
+ "content-type": "application/json",
51354
+ "x-github-api-version": "2022-11-28"
51355
+ });
51356
+ var parseRepository = (repository) => {
51357
+ const [owner, repo, extra] = repository.split("/");
51358
+ if (owner === undefined || owner.trim().length === 0 || repo === undefined || repo.trim().length === 0 || extra !== undefined) {
51359
+ throw new Error("GitHub repository must be in owner/name form.");
51360
+ }
51361
+ return { owner, repo };
51362
+ };
51363
+ var labelColor = (label) => {
51364
+ if (label === "harness-report") {
51365
+ return "5319e7";
51366
+ }
51367
+ if (label.startsWith("severity:")) {
51368
+ return "d93f0b";
51369
+ }
51370
+ if (label.startsWith("type:")) {
51371
+ return "1d76db";
51372
+ }
51373
+ if (label.startsWith("area:") || label.startsWith("surface:")) {
51374
+ return "0e8a16";
51375
+ }
51376
+ if (label.startsWith("pack:") || label.startsWith("command:")) {
51377
+ return "fbca04";
51378
+ }
51379
+ return "cfd3d7";
51380
+ };
51381
+ var labelDescription = (label) => label === "harness-report" ? "Created by dp report for Harness maintainer triage." : `dp report classifier: ${label}`;
51382
+ var createLabelIfMissing = async ({
51383
+ token,
51384
+ repository,
51385
+ label
51386
+ }) => {
51387
+ const { owner, repo } = parseRepository(repository);
51388
+ const response = await fetch(`${githubApiBaseUrl}/repos/${owner}/${repo}/labels`, {
51389
+ method: "POST",
51390
+ headers: githubHeaders(token),
51391
+ body: JSON.stringify({
51392
+ name: label,
51393
+ color: labelColor(label),
51394
+ description: labelDescription(label)
51395
+ })
51396
+ });
51397
+ if (response.ok || response.status === 422) {
51398
+ return;
51399
+ }
51400
+ throw new Error(`GitHub label setup failed for ${label}: ${response.status}`);
51401
+ };
51402
+ var createGitHubIssue = async ({
51403
+ repository,
51404
+ title,
51405
+ body,
51406
+ labels
51407
+ }) => {
51408
+ const token = githubToken();
51409
+ if (token === undefined || token.length === 0) {
51410
+ throw new Error("GitHub auth is required. Run `gh auth login` or set GH_TOKEN/GITHUB_TOKEN.");
51411
+ }
51412
+ for (const label of labels) {
51413
+ await createLabelIfMissing({ token, repository, label });
51414
+ }
51415
+ const { owner, repo } = parseRepository(repository);
51416
+ const response = await fetch(`${githubApiBaseUrl}/repos/${owner}/${repo}/issues`, {
51417
+ method: "POST",
51418
+ headers: githubHeaders(token),
51419
+ body: JSON.stringify({ title, body, labels })
51420
+ });
51421
+ if (!response.ok) {
51422
+ throw new Error(`GitHub issue creation failed: ${response.status}`);
51423
+ }
51424
+ const issue = await response.json();
51425
+ if (typeof issue.number !== "number" || typeof issue.html_url !== "string" || typeof issue.title !== "string") {
51426
+ throw new Error("GitHub issue creation returned an unexpected response.");
51427
+ }
51428
+ return {
51429
+ number: issue.number,
51430
+ htmlUrl: issue.html_url,
51431
+ title: issue.title
51432
+ };
51433
+ };
51434
+
51435
+ // src/telemetry/product.ts
51436
+ import { randomUUID } from "crypto";
51437
+ import { execFileSync as execFileSync2 } from "child_process";
51438
+
51439
+ // src/content/data.ts
51440
+ import { existsSync, readFileSync } from "fs";
51441
+ import path2 from "path";
51442
+ var findFirst8 = (candidates) => candidates.find((candidate) => existsSync(candidate));
51443
+ var findBundledPackageRoot = () => {
51444
+ let currentDirectory = path2.resolve(import.meta.dirname, "../..");
51445
+ while (true) {
51446
+ if (existsSync(path2.join(currentDirectory, "package.json"))) {
51447
+ return currentDirectory;
51448
+ }
51449
+ const parentDirectory = path2.dirname(currentDirectory);
51450
+ if (parentDirectory === currentDirectory) {
51451
+ break;
51452
+ }
51453
+ currentDirectory = parentDirectory;
51454
+ }
51455
+ return path2.resolve(import.meta.dirname, "../..");
51456
+ };
51457
+ var packageRoot = findBundledPackageRoot();
51458
+ var runtimeRoot = import.meta.dirname;
51459
+ var dataCandidates = [
51460
+ path2.join(runtimeRoot, "data"),
51461
+ path2.resolve(import.meta.dirname, "../data"),
51462
+ path2.join(packageRoot, "src/data"),
51463
+ path2.resolve(import.meta.dirname, "../../src/data")
51464
+ ];
51465
+ var skillCandidates = [
51466
+ path2.join(runtimeRoot, "skills"),
51467
+ path2.join(packageRoot, "skills"),
51468
+ path2.resolve(import.meta.dirname, "../../skills"),
51469
+ path2.resolve(import.meta.dirname, "../skills")
51470
+ ];
51471
+ var resolvedDataRoot = findFirst8(dataCandidates);
51472
+ var resolvedSkillsRoot = findFirst8(skillCandidates);
51473
+ if (resolvedDataRoot === undefined) {
51474
+ throw new Error("Could not locate bundled data directory.");
51475
+ }
51476
+ if (resolvedSkillsRoot === undefined) {
51477
+ throw new Error("Could not locate bundled skills directory.");
51478
+ }
51479
+ var dataRoot = resolvedDataRoot;
51480
+ var skillsRoot = resolvedSkillsRoot;
51481
+ var dataPath = (...segments) => path2.join(dataRoot, ...segments);
51482
+ var readDataFile = (...segments) => readFileSync(dataPath(...segments), "utf8");
51483
+ var readBaselineDataFile = (baselineDataRoot, ...segments) => readFileSync(path2.join(baselineDataRoot, ...segments), "utf8");
51484
+ var resolveBaselinePath = ({
51485
+ baselineRoot,
51486
+ baselineSkillsRoot,
51487
+ relativePath
51488
+ }) => {
51489
+ const resolvedPath = relativePath.startsWith("skills/") ? findFirst8([
51490
+ path2.join(baselineSkillsRoot, relativePath.slice("skills/".length)),
51491
+ path2.join(baselineRoot, relativePath)
51492
+ ]) : findFirst8([path2.join(baselineRoot, relativePath)]);
51493
+ if (resolvedPath !== undefined) {
51494
+ return resolvedPath;
51495
+ }
51496
+ throw new Error(`Could not locate baseline asset: ${relativePath}`);
51497
+ };
51498
+
51499
+ // src/control-plane/config.ts
51500
+ var trimTrailingSlashes = (value6) => value6.trim().replace(/\/+$/u, "");
51501
+ var bundledControlPlaneUrl = () => {
51502
+ if (process.env.DP_DISABLE_BUNDLED_CONTROL_PLANE_URL === "1") {
51503
+ return;
51504
+ }
51505
+ const config2 = JSON.parse(readDataFile("control-plane.json"));
51506
+ return typeof config2.defaultUrl === "string" && config2.defaultUrl.trim().length > 0 ? trimTrailingSlashes(config2.defaultUrl) : undefined;
51507
+ };
51508
+ var resolveControlPlaneUrl = (explicitUrl) => {
51509
+ const baseUrl2 = explicitUrl?.trim() || process.env.DP_CONTROL_PLANE_URL?.trim() || bundledControlPlaneUrl();
51510
+ return baseUrl2 === undefined || baseUrl2.length === 0 ? undefined : trimTrailingSlashes(baseUrl2);
51511
+ };
50935
51512
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpApiClient.js
50936
51513
  var exports_HttpApiClient = {};
50937
51514
  __export(exports_HttpApiClient, {
50938
- makeWith: () => makeWith2,
50939
- make: () => make74,
51515
+ makeWith: () => makeWith3,
51516
+ make: () => make75,
50940
51517
  group: () => group5,
50941
51518
  endpoint: () => endpoint
50942
51519
  });
50943
- var makeClient = (api, options6) => gen2(function* () {
51520
+ var makeClient = (api, options8) => gen2(function* () {
50944
51521
  const context8 = yield* context3();
50945
- const httpClient = options6.httpClient.pipe(options6?.baseUrl === undefined ? identity : mapRequest2(prependUrl2(options6.baseUrl.toString())));
51522
+ const httpClient = options8.httpClient.pipe(options8?.baseUrl === undefined ? identity : mapRequest2(prependUrl2(options8.baseUrl.toString())));
50946
51523
  reflect(api, {
50947
- predicate: options6?.predicate,
51524
+ predicate: options8?.predicate,
50948
51525
  onGroup(onGroupOptions) {
50949
- options6.onGroup?.(onGroupOptions);
51526
+ options8.onGroup?.(onGroupOptions);
50950
51527
  },
50951
51528
  onEndpoint(onEndpointOptions) {
50952
51529
  const {
@@ -50984,7 +51561,7 @@ var makeClient = (api, options6) => gen2(function* () {
50984
51561
  const encodeHeaders = endpoint.headersSchema.pipe(map2(encodeUnknown2));
50985
51562
  const encodeUrlParams = endpoint.urlParamsSchema.pipe(map2(encodeUnknown2));
50986
51563
  const endpointFn = fnUntraced2(function* (request2) {
50987
- let httpRequest = make66(endpoint.method)(endpoint.path);
51564
+ let httpRequest = make67(endpoint.method)(endpoint.path);
50988
51565
  if (request2 && request2.path) {
50989
51566
  const encodedPathParams = encodePath._tag === "Some" ? yield* encodePath.value(request2.path) : request2.path;
50990
51567
  httpRequest = setUrl2(httpRequest, makeUrl2(encodedPathParams));
@@ -51007,24 +51584,24 @@ var makeClient = (api, options6) => gen2(function* () {
51007
51584
  httpRequest = appendUrlParams2(httpRequest, yield* encodeUrlParams.value(request2.urlParams));
51008
51585
  }
51009
51586
  const response = yield* httpClient.execute(httpRequest);
51010
- const value6 = yield* options6.transformResponse === undefined ? decodeResponse(response) : options6.transformResponse(decodeResponse(response));
51587
+ const value6 = yield* options8.transformResponse === undefined ? decodeResponse(response) : options8.transformResponse(decodeResponse(response));
51011
51588
  return request2?.withResponse === true ? [value6, response] : value6;
51012
51589
  }, mapInputContext2((input) => merge3(context8, input)));
51013
- options6.onEndpoint({
51590
+ options8.onEndpoint({
51014
51591
  ...onEndpointOptions,
51015
51592
  endpointFn
51016
51593
  });
51017
51594
  }
51018
51595
  });
51019
51596
  });
51020
- var make74 = (api, options6) => flatMap10(HttpClient, (httpClient) => makeWith2(api, {
51021
- ...options6,
51022
- httpClient: options6?.transformClient ? options6.transformClient(httpClient) : httpClient
51597
+ var make75 = (api, options8) => flatMap10(HttpClient, (httpClient) => makeWith3(api, {
51598
+ ...options8,
51599
+ httpClient: options8?.transformClient ? options8.transformClient(httpClient) : httpClient
51023
51600
  }));
51024
- var makeWith2 = (api, options6) => {
51601
+ var makeWith3 = (api, options8) => {
51025
51602
  const client = {};
51026
51603
  return makeClient(api, {
51027
- ...options6,
51604
+ ...options8,
51028
51605
  onGroup({
51029
51606
  group: group5
51030
51607
  }) {
@@ -51041,13 +51618,13 @@ var makeWith2 = (api, options6) => {
51041
51618
  }
51042
51619
  }).pipe(map17(() => client));
51043
51620
  };
51044
- var group5 = (api, options6) => {
51621
+ var group5 = (api, options8) => {
51045
51622
  const client = {};
51046
51623
  return makeClient(api, {
51047
- ...options6,
51624
+ ...options8,
51048
51625
  predicate: ({
51049
51626
  group: group6
51050
- }) => group6.identifier === options6.group,
51627
+ }) => group6.identifier === options8.group,
51051
51628
  onEndpoint({
51052
51629
  endpoint,
51053
51630
  endpointFn
@@ -51056,14 +51633,14 @@ var group5 = (api, options6) => {
51056
51633
  }
51057
51634
  }).pipe(map17(() => client));
51058
51635
  };
51059
- var endpoint = (api, options6) => {
51636
+ var endpoint = (api, options8) => {
51060
51637
  let client = undefined;
51061
51638
  return makeClient(api, {
51062
- ...options6,
51639
+ ...options8,
51063
51640
  predicate: ({
51064
51641
  endpoint: endpoint2,
51065
51642
  group: group6
51066
- }) => group6.identifier === options6.group && endpoint2.name === options6.endpoint,
51643
+ }) => group6.identifier === options8.group && endpoint2.name === options8.endpoint,
51067
51644
  onEndpoint({
51068
51645
  endpointFn
51069
51646
  }) {
@@ -51072,11 +51649,11 @@ var endpoint = (api, options6) => {
51072
51649
  }).pipe(map17(() => client));
51073
51650
  };
51074
51651
  var paramsRegex = /:(\w+)\??/g;
51075
- var compilePath = (path2) => {
51076
- const segments = path2.split(paramsRegex);
51652
+ var compilePath = (path3) => {
51653
+ const segments = path3.split(paramsRegex);
51077
51654
  const len = segments.length;
51078
51655
  if (len === 1) {
51079
- return (_) => path2;
51656
+ return (_) => path3;
51080
51657
  }
51081
51658
  return (params2) => {
51082
51659
  let url2 = segments[0];
@@ -51175,7 +51752,7 @@ var bodyFromPayload = (ast) => {
51175
51752
  }
51176
51753
  const schema = make53(ast);
51177
51754
  const encoding = getEncoding(ast);
51178
- const transform5 = transformOrFail(HttpBodyFromSelf, schema, {
51755
+ const transform6 = transformOrFail(HttpBodyFromSelf, schema, {
51179
51756
  decode(fromA, _, ast2) {
51180
51757
  return fail10(new Forbidden(ast2, fromA, "encode only schema"));
51181
51758
  },
@@ -51206,27 +51783,27 @@ var bodyFromPayload = (ast) => {
51206
51783
  }
51207
51784
  }
51208
51785
  });
51209
- bodyFromPayloadCache.set(ast, transform5);
51210
- return transform5;
51786
+ bodyFromPayloadCache.set(ast, transform6);
51787
+ return transform6;
51211
51788
  };
51212
51789
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpApiEndpoint.js
51213
51790
  var exports_HttpApiEndpoint = {};
51214
51791
  __export(exports_HttpApiEndpoint, {
51215
- put: () => put4,
51216
- post: () => post4,
51217
- patch: () => patch12,
51218
- options: () => options6,
51219
- make: () => make75,
51792
+ put: () => put6,
51793
+ post: () => post6,
51794
+ patch: () => patch14,
51795
+ options: () => options8,
51796
+ make: () => make76,
51220
51797
  isHttpApiEndpoint: () => isHttpApiEndpoint,
51221
- head: () => head10,
51222
- get: () => get20,
51223
- del: () => del4,
51224
- TypeId: () => TypeId42
51798
+ head: () => head12,
51799
+ get: () => get22,
51800
+ del: () => del6,
51801
+ TypeId: () => TypeId44
51225
51802
  });
51226
- var TypeId42 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiEndpoint");
51227
- var isHttpApiEndpoint = (u) => hasProperty(u, TypeId42);
51803
+ var TypeId44 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiEndpoint");
51804
+ var isHttpApiEndpoint = (u) => hasProperty(u, TypeId44);
51228
51805
  var Proto9 = {
51229
- [TypeId42]: TypeId42,
51806
+ [TypeId44]: TypeId44,
51230
51807
  pipe() {
51231
51808
  return pipeArguments(this, arguments);
51232
51809
  },
@@ -51297,8 +51874,8 @@ var Proto9 = {
51297
51874
  });
51298
51875
  }
51299
51876
  };
51300
- var makeProto3 = (options6) => Object.assign(Object.create(Proto9), options6);
51301
- var make75 = (method) => (name, ...args2) => {
51877
+ var makeProto3 = (options8) => Object.assign(Object.create(Proto9), options8);
51878
+ var make76 = (method) => (name, ...args2) => {
51302
51879
  if (args2.length === 1) {
51303
51880
  return makeProto3({
51304
51881
  name,
@@ -51315,7 +51892,7 @@ var make75 = (method) => (name, ...args2) => {
51315
51892
  });
51316
51893
  }
51317
51894
  return (segments, ...schemas) => {
51318
- let path2 = segments[0].replace(":", "::");
51895
+ let path3 = segments[0].replace(":", "::");
51319
51896
  let pathSchema = none2();
51320
51897
  if (schemas.length > 0) {
51321
51898
  const obj = {};
@@ -51324,13 +51901,13 @@ var make75 = (method) => (name, ...args2) => {
51324
51901
  const key = getParam(schema.ast) ?? String(i);
51325
51902
  const optional5 = schema.ast._tag === "PropertySignatureTransformation" && schema.ast.from.isOptional || schema.ast._tag === "PropertySignatureDeclaration" && schema.ast.isOptional;
51326
51903
  obj[key] = schema;
51327
- path2 += `:${key}${optional5 ? "?" : ""}${segments[i + 1].replace(":", "::")}`;
51904
+ path3 += `:${key}${optional5 ? "?" : ""}${segments[i + 1].replace(":", "::")}`;
51328
51905
  }
51329
51906
  pathSchema = some2(Struct(obj));
51330
51907
  }
51331
51908
  return makeProto3({
51332
51909
  name,
51333
- path: path2,
51910
+ path: path3,
51334
51911
  method,
51335
51912
  pathSchema,
51336
51913
  urlParamsSchema: none2(),
@@ -51343,24 +51920,24 @@ var make75 = (method) => (name, ...args2) => {
51343
51920
  });
51344
51921
  };
51345
51922
  };
51346
- var get20 = /* @__PURE__ */ make75("GET");
51347
- var post4 = /* @__PURE__ */ make75("POST");
51348
- var put4 = /* @__PURE__ */ make75("PUT");
51349
- var patch12 = /* @__PURE__ */ make75("PATCH");
51350
- var del4 = /* @__PURE__ */ make75("DELETE");
51351
- var head10 = /* @__PURE__ */ make75("HEAD");
51352
- var options6 = /* @__PURE__ */ make75("OPTIONS");
51923
+ var get22 = /* @__PURE__ */ make76("GET");
51924
+ var post6 = /* @__PURE__ */ make76("POST");
51925
+ var put6 = /* @__PURE__ */ make76("PUT");
51926
+ var patch14 = /* @__PURE__ */ make76("PATCH");
51927
+ var del6 = /* @__PURE__ */ make76("DELETE");
51928
+ var head12 = /* @__PURE__ */ make76("HEAD");
51929
+ var options8 = /* @__PURE__ */ make76("OPTIONS");
51353
51930
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpApiGroup.js
51354
51931
  var exports_HttpApiGroup = {};
51355
51932
  __export(exports_HttpApiGroup, {
51356
- make: () => make76,
51933
+ make: () => make77,
51357
51934
  isHttpApiGroup: () => isHttpApiGroup,
51358
- TypeId: () => TypeId43
51935
+ TypeId: () => TypeId45
51359
51936
  });
51360
- var TypeId43 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiGroup");
51361
- var isHttpApiGroup = (u) => hasProperty(u, TypeId43);
51937
+ var TypeId45 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiGroup");
51938
+ var isHttpApiGroup = (u) => hasProperty(u, TypeId45);
51362
51939
  var Proto10 = {
51363
- [TypeId43]: TypeId43,
51940
+ [TypeId45]: TypeId45,
51364
51941
  add(endpoint2) {
51365
51942
  return makeProto4({
51366
51943
  identifier: this.identifier,
@@ -51460,14 +52037,14 @@ var Proto10 = {
51460
52037
  return pipeArguments(this, arguments);
51461
52038
  }
51462
52039
  };
51463
- var makeProto4 = (options7) => {
52040
+ var makeProto4 = (options9) => {
51464
52041
  function HttpApiGroup() {}
51465
52042
  Object.setPrototypeOf(HttpApiGroup, Proto10);
51466
- return Object.assign(HttpApiGroup, options7);
52043
+ return Object.assign(HttpApiGroup, options9);
51467
52044
  };
51468
- var make76 = (identifier2, options7) => makeProto4({
52045
+ var make77 = (identifier2, options9) => makeProto4({
51469
52046
  identifier: identifier2,
51470
- topLevel: options7?.topLevel ?? false,
52047
+ topLevel: options9?.topLevel ?? false,
51471
52048
  endpoints: empty3(),
51472
52049
  errorSchema: Never,
51473
52050
  annotations: empty6(),
@@ -51598,7 +52175,7 @@ class BackofficeAccessInviteRequest extends exports_Schema.Class("BackofficeAcce
51598
52175
  role: BackofficeAccessRole
51599
52176
  }) {
51600
52177
  }
51601
- var ProductTelemetryEventName = exports_Schema.Literal("cli.artifact.pull.completed", "cli.scaffold.setup.completed", "cli.scaffold.update.applied", "cli.harness.report.submitted");
52178
+ var ProductTelemetryEventName = exports_Schema.Literal("cli.artifact.pull.completed", "cli.scaffold.init.completed", "cli.scaffold.setup.completed", "cli.scaffold.update.applied", "cli.harness.report.submitted");
51602
52179
  var TelemetrySource = exports_Schema.Literal("normal", "local-dev", "ci", "debug", "test");
51603
52180
  var isoDateTimePattern = /^(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})T(?<hour>\d{2}):(?<minute>\d{2}):(?<second>\d{2})(?:\.(?<fraction>\d{1,9}))?(?:Z|[+-]\d{2}:\d{2})$/u;
51604
52181
  var isValidIsoDateTime = (value6) => {
@@ -51714,11 +52291,14 @@ class ObservedRepositorySummary extends exports_Schema.Class("ObservedRepository
51714
52291
  class ProjectUsageEventSummary extends exports_Schema.Class("ProjectUsageEventSummary")({
51715
52292
  id: exports_Schema.String,
51716
52293
  eventId: exports_Schema.String,
51717
- name: ProductTelemetryEventName,
51718
- source: TelemetrySource,
52294
+ name: exports_Schema.String,
52295
+ source: exports_Schema.String,
51719
52296
  counted: exports_Schema.Boolean,
51720
52297
  cliVersion: exports_Schema.String,
51721
- baseline: exports_Schema.optional(TelemetryBaselineContext),
52298
+ baseline: exports_Schema.optional(exports_Schema.Struct({
52299
+ channel: exports_Schema.optional(exports_Schema.String),
52300
+ version: exports_Schema.optional(exports_Schema.String)
52301
+ })),
51722
52302
  occurredAt: IsoDateTimeString,
51723
52303
  operator: exports_Schema.optional(BackofficeOperatorSummary)
51724
52304
  }) {
@@ -51730,9 +52310,9 @@ class HarnessReportSummary extends exports_Schema.Class("HarnessReportSummary")(
51730
52310
  observedRepositoryId: exports_Schema.optional(exports_Schema.String),
51731
52311
  title: exports_Schema.String,
51732
52312
  body: exports_Schema.optional(exports_Schema.String),
51733
- type: HarnessReportType,
51734
- severity: HarnessReportSeverity,
51735
- status: HarnessReportStatus,
52313
+ type: exports_Schema.String,
52314
+ severity: exports_Schema.String,
52315
+ status: exports_Schema.String,
51736
52316
  githubUrl: exports_Schema.optional(exports_Schema.String),
51737
52317
  createdAt: IsoDateTimeString,
51738
52318
  updatedAt: IsoDateTimeString,
@@ -51747,7 +52327,7 @@ class ProjectUsageSummary extends exports_Schema.Class("ProjectUsageSummary")({
51747
52327
  countedEventCount: exports_Schema.Number,
51748
52328
  openReportCount: exports_Schema.Number,
51749
52329
  latestCliVersion: exports_Schema.optional(exports_Schema.String),
51750
- latestBaselineChannel: exports_Schema.optional(BaselineChannel),
52330
+ latestBaselineChannel: exports_Schema.optional(exports_Schema.String),
51751
52331
  latestBaselineVersion: exports_Schema.optional(exports_Schema.String),
51752
52332
  lastActivityAt: exports_Schema.optional(IsoDateTimeString),
51753
52333
  initializedBy: exports_Schema.optional(BackofficeOperatorSummary),
@@ -51801,46 +52381,35 @@ class HarnessApi extends exports_HttpApi.make("harness").add(HealthApi).add(Base
51801
52381
  })) {
51802
52382
  }
51803
52383
  // ../../packages/contract/src/client.ts
51804
- var makeHarnessClient = ({ baseUrl: baseUrl2 }) => exports_HttpApiClient.make(HarnessApi, {
51805
- baseUrl: baseUrl2
52384
+ var makeHarnessClient = ({ baseUrl: baseUrl2, headers }) => exports_HttpApiClient.make(HarnessApi, {
52385
+ baseUrl: baseUrl2,
52386
+ transformClient: (client) => headers === undefined ? client : client.pipe(exports_HttpClient.mapRequest(exports_HttpClientRequest.setHeaders(headers)))
51806
52387
  }).pipe(exports_Effect.provide(exports_FetchHttpClient.layer));
51807
52388
  // src/control-plane/client.ts
51808
- var resolveStableBaselineMetadata = (options7) => exports_Effect.gen(function* () {
52389
+ var resolveStableBaselineMetadata = (options9) => exports_Effect.gen(function* () {
51809
52390
  const client2 = yield* makeHarnessClient({
51810
- baseUrl: options7.baseUrl
52391
+ baseUrl: options9.baseUrl
51811
52392
  });
51812
52393
  return yield* client2.baseline.resolve({
51813
52394
  path: { channel: "stable" }
51814
52395
  });
51815
52396
  });
51816
- var recordProductTelemetryEvent = (options7) => exports_Effect.gen(function* () {
52397
+ var recordProductTelemetryEvent = (options9) => exports_Effect.gen(function* () {
51817
52398
  const client2 = yield* makeHarnessClient({
51818
- baseUrl: options7.baseUrl
52399
+ baseUrl: options9.baseUrl
51819
52400
  });
51820
52401
  return yield* client2.telemetry.record({
51821
- payload: options7.event
52402
+ payload: options9.event
51822
52403
  });
51823
52404
  });
51824
- var submitHarnessReport = (options7) => exports_Effect.gen(function* () {
51825
- const client2 = yield* makeHarnessClient({
51826
- baseUrl: options7.baseUrl
51827
- });
51828
- return yield* client2.reports.submit({
51829
- payload: options7.report
51830
- });
51831
- });
51832
-
51833
- // src/telemetry/product.ts
51834
- import { randomUUID } from "crypto";
51835
- import { execFileSync } from "child_process";
51836
52405
 
51837
52406
  // package.json
51838
52407
  var name = "@punks/cli";
51839
- var version = "2.1.1";
52408
+ var version = "2.1.3";
51840
52409
  // src/telemetry/product.ts
51841
52410
  var git = (cwd, args2) => {
51842
52411
  try {
51843
- return execFileSync("git", args2, {
52412
+ return execFileSync2("git", args2, {
51844
52413
  cwd,
51845
52414
  encoding: "utf8",
51846
52415
  stdio: ["ignore", "pipe", "ignore"]
@@ -51900,7 +52469,7 @@ var isLocalControlPlaneUrl = (value6) => {
51900
52469
  return value6.includes("localhost") || value6.includes(".localhost");
51901
52470
  }
51902
52471
  };
51903
- var telemetrySource = () => {
52472
+ var telemetrySource = (controlPlaneUrl = process.env.DP_CONTROL_PLANE_URL) => {
51904
52473
  if (process.env.CI !== undefined) {
51905
52474
  return "ci";
51906
52475
  }
@@ -51910,7 +52479,7 @@ var telemetrySource = () => {
51910
52479
  if (process.env.VITEST !== undefined) {
51911
52480
  return "test";
51912
52481
  }
51913
- if (isLocalControlPlaneUrl(process.env.DP_CONTROL_PLANE_URL)) {
52482
+ if (isLocalControlPlaneUrl(controlPlaneUrl)) {
51914
52483
  return "local-dev";
51915
52484
  }
51916
52485
  return "normal";
@@ -51918,19 +52487,21 @@ var telemetrySource = () => {
51918
52487
  var makeProductTelemetryEvent = ({
51919
52488
  name: name2,
51920
52489
  cwd,
51921
- baseline
52490
+ baseline,
52491
+ controlPlaneUrl
51922
52492
  }) => ({
51923
52493
  eventId: randomUUID(),
51924
52494
  name: name2,
51925
52495
  occurredAt: new Date().toISOString(),
51926
52496
  cliVersion: version,
51927
- source: telemetrySource(),
52497
+ source: telemetrySource(controlPlaneUrl),
51928
52498
  repository: observedRepository(cwd),
51929
52499
  ...baseline === undefined ? {} : { baseline }
51930
52500
  });
51931
- var submitProductTelemetryEffect = (event) => {
51932
- const baseUrl2 = process.env.DP_CONTROL_PLANE_URL;
51933
- if (baseUrl2 === undefined || baseUrl2.trim().length === 0) {
52501
+ var telemetryBaseUrl = (controlPlaneUrl) => resolveControlPlaneUrl(controlPlaneUrl);
52502
+ var submitProductTelemetryEffect = (event, options9 = {}) => {
52503
+ const baseUrl2 = telemetryBaseUrl(options9.controlPlaneUrl);
52504
+ if (baseUrl2 === undefined) {
51934
52505
  return exports_Effect.void;
51935
52506
  }
51936
52507
  return recordProductTelemetryEvent({
@@ -51938,20 +52509,14 @@ var submitProductTelemetryEffect = (event) => {
51938
52509
  event
51939
52510
  }).pipe(exports_Effect.asVoid, exports_Effect.catchAll(() => exports_Effect.void));
51940
52511
  };
51941
- var telemetryTransportEnabled = () => process.env.DP_CONTROL_PLANE_URL !== undefined && process.env.DP_CONTROL_PLANE_URL.trim().length > 0;
51942
- var submitProductTelemetry = (event) => {
51943
- exports_Effect.runPromise(submitProductTelemetryEffect(event));
51944
- };
51945
- var makeCliEvent = (name2, options7 = {}) => makeProductTelemetryEvent({
52512
+ var telemetryTransportEnabled = (controlPlaneUrl) => telemetryBaseUrl(controlPlaneUrl) !== undefined;
52513
+ var makeCliEvent = (name2, options9 = {}) => makeProductTelemetryEvent({
51946
52514
  name: name2,
51947
- cwd: options7.cwd ?? process.cwd(),
51948
- baseline: options7.baseline
52515
+ cwd: options9.cwd ?? process.cwd(),
52516
+ ...options9.baseline === undefined ? {} : { baseline: options9.baseline },
52517
+ ...options9.controlPlaneUrl === undefined ? {} : { controlPlaneUrl: options9.controlPlaneUrl }
51949
52518
  });
51950
- var submitCliEvent = (name2, options7 = {}) => {
51951
- if (telemetryTransportEnabled()) {
51952
- submitProductTelemetry(makeCliEvent(name2, options7));
51953
- }
51954
- };
52519
+ var submitCliEventEffect = (name2, options9 = {}) => telemetryTransportEnabled(options9.controlPlaneUrl) ? submitProductTelemetryEffect(makeCliEvent(name2, options9), options9.controlPlaneUrl === undefined ? {} : { controlPlaneUrl: options9.controlPlaneUrl }) : exports_Effect.void;
51955
52520
 
51956
52521
  // src/ui/brand.ts
51957
52522
  var reset2 = "\x1B[0m";
@@ -52098,6 +52663,8 @@ var renderCommandGuide = () => [
52098
52663
  " \u2514 show the scaffold lifecycle index and available setup commands",
52099
52664
  " \u203A punks update",
52100
52665
  " \u2514 refresh managed scaffold assets from `.devpunks/scaffold-manifest.json`",
52666
+ " \u203A punks upgrade",
52667
+ " \u2514 upgrade this CLI through the detected global package manager",
52101
52668
  "",
52102
52669
  "usage:",
52103
52670
  " \u2022 agents should activate `$dp-cli` before acting on `.devpunks` output",
@@ -52107,6 +52674,7 @@ var renderCommandGuide = () => [
52107
52674
  " \u2022 use `punks scaffold setup` for repo-aware pack detection after repo boilerplate is ready",
52108
52675
  " \u2022 use `punks update` after setup to pull newer scaffolded skills/prompts/manifests/hooks",
52109
52676
  " \u2022 use `punks report` when reusable Harness friction should enter the support loop",
52677
+ " \u2022 reports open GitHub issues; authenticate with `gh auth login` or `GITHUB_TOKEN`",
52110
52678
  "",
52111
52679
  "operator notes:",
52112
52680
  " \u2022 init copies only requirements/backlog skills and the initial wiki structure",
@@ -52145,7 +52713,7 @@ var renderSetupIntro = () => renderCommandIntro({
52145
52713
  "",
52146
52714
  "usage:",
52147
52715
  " \u2022 agents should activate `$dp-cli` before following `.devpunks` handoff artifacts",
52148
- " \u2022 run this from the outer repo root so docs/wiki and nested app/package workspaces stay in one scan",
52716
+ " \u2022 run this from the outer repo root so docs, wiki, and nested app/package workspaces stay in one scan",
52149
52717
  " \u2022 review detected manifests, technologies, and packs before confirming",
52150
52718
  " \u2022 reconcile generic scaffold output with the real repo layout before committing final guidance",
52151
52719
  " \u2022 if detection looks incomplete or suspicious, answer `n` and edit the pack selection before accepting",
@@ -52217,8 +52785,9 @@ var renderJsonLabel = () => paint(`${brandPalette.bold}${brandPalette.lilac}`, "
52217
52785
  var renderDivider = () => paint(`${brandPalette.dim}${brandPalette.border}`, "\u2500".repeat(sectionWidth));
52218
52786
 
52219
52787
  // src/cli/report-command.ts
52220
- var titleOption = exports_Options.text("title").pipe(exports_Options.withDescription("Short harness friction report title."));
52221
- var bodyOption = exports_Options.text("body").pipe(exports_Options.withDescription("Report body with the observed friction and expected behavior."));
52788
+ var harnessReportsRepository = "wearedevpunks/harness-intelligence";
52789
+ var titleOption = exports_Options.text("title").pipe(exports_Options.withDescription("Short GitHub issue title for Harness maintainer triage."));
52790
+ var bodyOption = exports_Options.text("body").pipe(exports_Options.withDescription("Narrative report body with the observed friction."));
52222
52791
  var typeOption = exports_Options.choice("type", [
52223
52792
  "bug",
52224
52793
  "docs",
@@ -52227,16 +52796,24 @@ var typeOption = exports_Options.choice("type", [
52227
52796
  "other"
52228
52797
  ]).pipe(exports_Options.withDefault("other"), exports_Options.withDescription("Report type."));
52229
52798
  var severityOption = exports_Options.choice("severity", ["low", "medium", "high"]).pipe(exports_Options.withDefault("medium"), exports_Options.withDescription("Report severity."));
52799
+ var areaOption = exports_Options.choice("area", [
52800
+ "cli",
52801
+ "wiki",
52802
+ "skill",
52803
+ "docs",
52804
+ "workflow",
52805
+ "backoffice",
52806
+ "other"
52807
+ ]).pipe(exports_Options.withDefault("other"), exports_Options.withDescription("Harness area."));
52230
52808
  var repoRootOption = exports_Options.text("repo-root").pipe(exports_Options.withDefault(process.cwd()), exports_Options.withDescription("Repository root used for safe git context."));
52231
- var githubUrlOption = exports_Options.optional(exports_Options.text("github-url").pipe(exports_Options.withDescription("Existing GitHub issue or pull request URL to link.")));
52809
+ var repositoryOption = exports_Options.text("repository").pipe(exports_Options.withDefault(harnessReportsRepository), exports_Options.withDescription("GitHub repository that receives report issues."));
52810
+ var skillPackOption = exports_Options.optional(exports_Options.text("skill-pack").pipe(exports_Options.withDescription("Affected skill pack, for example `dp-cli` or `docs-ingest-phase`.")));
52811
+ var commandOption = exports_Options.optional(exports_Options.text("command").pipe(exports_Options.withDescription("Affected CLI command, for example `dp report` or `dp scaffold init`.")));
52812
+ var expectedOption = exports_Options.optional(exports_Options.text("expected").pipe(exports_Options.withDescription("Expected behavior.")));
52813
+ var actualOption = exports_Options.optional(exports_Options.text("actual").pipe(exports_Options.withDescription("Actual behavior.")));
52814
+ var stepsOption = exports_Options.optional(exports_Options.text("steps").pipe(exports_Options.withDescription("Reproduction steps or evidence summary.")));
52815
+ var labelsOption = exports_Options.optional(exports_Options.text("labels").pipe(exports_Options.withDescription("Comma-separated extra GitHub labels.")));
52232
52816
  var jsonOption = exports_Options.boolean("json").pipe(exports_Options.withDescription("Print JSON output."));
52233
- var requiredControlPlaneUrl = () => {
52234
- const baseUrl2 = process.env.DP_CONTROL_PLANE_URL?.trim();
52235
- if (baseUrl2 === undefined || baseUrl2.length === 0) {
52236
- throw new Error("Missing DP_CONTROL_PLANE_URL for harness report submission.");
52237
- }
52238
- return baseUrl2;
52239
- };
52240
52817
  var nonEmpty = (value6, field) => {
52241
52818
  const trimmed2 = value6.trim();
52242
52819
  if (trimmed2.length === 0) {
@@ -52244,13 +52821,15 @@ var nonEmpty = (value6, field) => {
52244
52821
  }
52245
52822
  return trimmed2;
52246
52823
  };
52824
+ var optionalValue = (value6) => isNone2(value6) || value6.value.trim().length === 0 ? undefined : value6.value.trim();
52825
+ var labelSlug = (value6) => value6.trim().toLowerCase().replace(/[^a-z0-9._-]+/gu, "-").replace(/^-+|-+$/gu, "");
52826
+ var csvLabels = (value6) => value6 === undefined ? [] : value6.split(",").map((label) => label.trim()).filter((label) => label.length > 0);
52247
52827
  var buildHarnessReport = ({
52248
52828
  title,
52249
52829
  body,
52250
52830
  type: type2,
52251
52831
  severity,
52252
- repoRoot,
52253
- githubUrl
52832
+ repoRoot
52254
52833
  }) => ({
52255
52834
  title: nonEmpty(title, "title"),
52256
52835
  body: nonEmpty(body, "body"),
@@ -52258,53 +52837,172 @@ var buildHarnessReport = ({
52258
52837
  severity,
52259
52838
  createdAt: new Date().toISOString(),
52260
52839
  cliVersion: version,
52261
- repository: observedRepository(repoRoot),
52262
- ...githubUrl === undefined || githubUrl.trim().length === 0 ? {} : { githubUrl: githubUrl.trim() }
52840
+ repository: observedRepository(repoRoot)
52263
52841
  });
52842
+ var buildHarnessReportLabels = ({
52843
+ type: type2,
52844
+ severity,
52845
+ area,
52846
+ skillPack,
52847
+ command,
52848
+ extraLabels
52849
+ }) => {
52850
+ const labels = [
52851
+ "harness-report",
52852
+ `type:${type2}`,
52853
+ `severity:${severity}`,
52854
+ `area:${area}`,
52855
+ area === "wiki" || area === "docs" ? "surface:wiki" : undefined,
52856
+ area === "cli" ? "surface:cli" : undefined,
52857
+ skillPack === undefined ? undefined : `pack:${labelSlug(skillPack)}`,
52858
+ command === undefined ? undefined : `command:${labelSlug(command)}`,
52859
+ ...csvLabels(extraLabels)
52860
+ ].filter((label) => label !== undefined && label.length > 0);
52861
+ return [...new Set(labels)];
52862
+ };
52863
+ var buildHarnessReportIssueBody = ({
52864
+ report,
52865
+ area,
52866
+ skillPack,
52867
+ command,
52868
+ expected,
52869
+ actual,
52870
+ steps
52871
+ }) => {
52872
+ const metadata = {
52873
+ schema: "harness-report.v1",
52874
+ type: report.type,
52875
+ severity: report.severity,
52876
+ area,
52877
+ skillPack,
52878
+ command,
52879
+ createdAt: report.createdAt,
52880
+ cliVersion: report.cliVersion,
52881
+ repository: report.repository
52882
+ };
52883
+ const optionalSections = [
52884
+ expected === undefined ? undefined : `## Expected
52885
+
52886
+ ${expected}`,
52887
+ actual === undefined ? undefined : `## Actual
52888
+
52889
+ ${actual}`,
52890
+ steps === undefined ? undefined : `## Evidence / Steps
52891
+
52892
+ ${steps}`
52893
+ ].filter((section) => section !== undefined);
52894
+ return [
52895
+ "<!-- harness-report",
52896
+ JSON.stringify(metadata, null, 2),
52897
+ "-->",
52898
+ `## Summary
52899
+
52900
+ ${report.body}`,
52901
+ ...optionalSections,
52902
+ "## Classification",
52903
+ [
52904
+ `- Type: ${report.type}`,
52905
+ `- Severity: ${report.severity}`,
52906
+ `- Area: ${area}`,
52907
+ skillPack === undefined ? undefined : `- Skill pack: ${skillPack}`,
52908
+ command === undefined ? undefined : `- Command: ${command}`,
52909
+ `- CLI version: ${report.cliVersion}`
52910
+ ].filter((line4) => line4 !== undefined).join(`
52911
+ `),
52912
+ "## Observed Repository",
52913
+ [
52914
+ `- Remote: ${report.repository?.remoteUrl ?? "unknown"}`,
52915
+ `- Host: ${report.repository?.remoteHost ?? "unknown"}`,
52916
+ `- Path: ${report.repository?.remotePath ?? "unknown"}`,
52917
+ `- Commit: ${report.repository?.commitSha ?? "unknown"}`,
52918
+ `- Dirty: ${report.repository?.dirty === undefined ? "unknown" : String(report.repository.dirty)}`
52919
+ ].join(`
52920
+ `)
52921
+ ].join(`
52922
+
52923
+ `);
52924
+ };
52264
52925
  var reportCommand = exports_Command.make("report", {
52265
52926
  title: titleOption,
52266
52927
  body: bodyOption,
52267
52928
  type: typeOption,
52268
52929
  severity: severityOption,
52930
+ area: areaOption,
52269
52931
  repoRoot: repoRootOption,
52270
- githubUrl: githubUrlOption,
52932
+ repository: repositoryOption,
52933
+ skillPack: skillPackOption,
52934
+ command: commandOption,
52935
+ expected: expectedOption,
52936
+ actual: actualOption,
52937
+ steps: stepsOption,
52938
+ labels: labelsOption,
52271
52939
  json: jsonOption
52272
- }, ({ title, body, type: type2, severity, repoRoot, githubUrl, json: json2 }) => exports_Effect.tryPromise({
52940
+ }, ({
52941
+ title,
52942
+ body,
52943
+ type: type2,
52944
+ severity,
52945
+ area,
52946
+ repoRoot,
52947
+ repository,
52948
+ skillPack,
52949
+ command,
52950
+ expected,
52951
+ actual,
52952
+ steps,
52953
+ labels,
52954
+ json: json2
52955
+ }) => exports_Effect.tryPromise({
52273
52956
  try: async () => {
52274
- const report = buildHarnessReport({
52275
- title,
52276
- body,
52957
+ const report = buildHarnessReport({ title, body, type: type2, severity, repoRoot });
52958
+ const skillPackValue = optionalValue(skillPack);
52959
+ const commandValue = optionalValue(command);
52960
+ const expectedValue = optionalValue(expected);
52961
+ const actualValue = optionalValue(actual);
52962
+ const stepsValue = optionalValue(steps);
52963
+ const extraLabels = optionalValue(labels);
52964
+ const issueLabels = buildHarnessReportLabels({
52277
52965
  type: type2,
52278
52966
  severity,
52279
- repoRoot,
52280
- ...isNone2(githubUrl) ? {} : { githubUrl: githubUrl.value }
52967
+ area,
52968
+ ...skillPackValue === undefined ? {} : { skillPack: skillPackValue },
52969
+ ...commandValue === undefined ? {} : { command: commandValue },
52970
+ ...extraLabels === undefined ? {} : { extraLabels }
52971
+ });
52972
+ const issue = await createGitHubIssue({
52973
+ repository,
52974
+ title: report.title,
52975
+ body: buildHarnessReportIssueBody({
52976
+ report,
52977
+ area,
52978
+ ...skillPackValue === undefined ? {} : { skillPack: skillPackValue },
52979
+ ...commandValue === undefined ? {} : { command: commandValue },
52980
+ ...expectedValue === undefined ? {} : { expected: expectedValue },
52981
+ ...actualValue === undefined ? {} : { actual: actualValue },
52982
+ ...stepsValue === undefined ? {} : { steps: stepsValue }
52983
+ }),
52984
+ labels: issueLabels
52281
52985
  });
52282
- const response = await exports_Effect.runPromise(submitHarnessReport({
52283
- baseUrl: requiredControlPlaneUrl(),
52284
- report
52986
+ await exports_Effect.runPromise(submitCliEventEffect("cli.harness.report.submitted", {
52987
+ cwd: repoRoot
52285
52988
  }));
52286
- submitCliEvent("cli.harness.report.submitted", { cwd: repoRoot });
52287
52989
  if (json2) {
52288
52990
  console.log(renderJsonLabel());
52289
- console.log(JSON.stringify(response, null, 2));
52991
+ console.log(JSON.stringify({ issue, labels: issueLabels }, null, 2));
52290
52992
  return;
52291
52993
  }
52292
- console.log(renderCommandSection("Harness report submitted", [
52293
- `Report id: ${response.reportId}`,
52294
- `Status: ${response.status}`,
52295
- response.githubUrl === undefined ? null : `GitHub: ${response.githubUrl}`
52296
- ].filter((line4) => line4 !== null).join(`
52994
+ console.log(renderCommandSection("Harness report issue created", [`Issue: ${issue.htmlUrl}`, `Repository: ${repository}`].join(`
52297
52995
  `)));
52298
52996
  },
52299
- catch: (cause3) => cause3 instanceof Error ? cause3 : new Error("Harness report submission failed.")
52300
- })).pipe(exports_Command.withDescription("Submit structured Harness friction for maintainer triage. Agents: use after $dp-cli evidence gathering."));
52997
+ catch: (cause3) => cause3 instanceof Error ? cause3 : new Error("Harness report issue creation failed.")
52998
+ })).pipe(exports_Command.withDescription("Create a GitHub issue in the Harness Intelligence repository for maintainer triage."));
52301
52999
 
52302
53000
  // src/cli/scaffold-command.ts
52303
53001
  import path12 from "path";
52304
53002
 
52305
53003
  // src/baseline/resolve.ts
52306
53004
  import { createHash } from "crypto";
52307
- import { execFileSync as execFileSync2 } from "child_process";
53005
+ import { execFileSync as execFileSync3 } from "child_process";
52308
53006
  import { existsSync as existsSync2, mkdirSync, mkdtempSync, readFileSync as readFileSync3, rmSync, writeFileSync } from "fs";
52309
53007
  import { tmpdir as tmpdir2 } from "os";
52310
53008
  import path5 from "path";
@@ -52312,66 +53010,6 @@ import path5 from "path";
52312
53010
  // src/baseline/bundled.ts
52313
53011
  import path3 from "path";
52314
53012
 
52315
- // src/content/data.ts
52316
- import { existsSync, readFileSync } from "fs";
52317
- import path2 from "path";
52318
- var findFirst8 = (candidates) => candidates.find((candidate) => existsSync(candidate));
52319
- var findBundledPackageRoot = () => {
52320
- let currentDirectory = path2.resolve(import.meta.dirname, "../..");
52321
- while (true) {
52322
- if (existsSync(path2.join(currentDirectory, "package.json"))) {
52323
- return currentDirectory;
52324
- }
52325
- const parentDirectory = path2.dirname(currentDirectory);
52326
- if (parentDirectory === currentDirectory) {
52327
- break;
52328
- }
52329
- currentDirectory = parentDirectory;
52330
- }
52331
- return path2.resolve(import.meta.dirname, "../..");
52332
- };
52333
- var packageRoot = findBundledPackageRoot();
52334
- var runtimeRoot = import.meta.dirname;
52335
- var dataCandidates = [
52336
- path2.join(runtimeRoot, "data"),
52337
- path2.resolve(import.meta.dirname, "../data"),
52338
- path2.join(packageRoot, "src/data"),
52339
- path2.resolve(import.meta.dirname, "../../src/data")
52340
- ];
52341
- var skillCandidates = [
52342
- path2.join(runtimeRoot, "skills"),
52343
- path2.join(packageRoot, "skills"),
52344
- path2.resolve(import.meta.dirname, "../../skills"),
52345
- path2.resolve(import.meta.dirname, "../skills")
52346
- ];
52347
- var resolvedDataRoot = findFirst8(dataCandidates);
52348
- var resolvedSkillsRoot = findFirst8(skillCandidates);
52349
- if (resolvedDataRoot === undefined) {
52350
- throw new Error("Could not locate bundled data directory.");
52351
- }
52352
- if (resolvedSkillsRoot === undefined) {
52353
- throw new Error("Could not locate bundled skills directory.");
52354
- }
52355
- var dataRoot = resolvedDataRoot;
52356
- var skillsRoot = resolvedSkillsRoot;
52357
- var dataPath = (...segments) => path2.join(dataRoot, ...segments);
52358
- var readDataFile = (...segments) => readFileSync(dataPath(...segments), "utf8");
52359
- var readBaselineDataFile = (baselineDataRoot, ...segments) => readFileSync(path2.join(baselineDataRoot, ...segments), "utf8");
52360
- var resolveBaselinePath = ({
52361
- baselineRoot,
52362
- baselineSkillsRoot,
52363
- relativePath
52364
- }) => {
52365
- const resolvedPath = relativePath.startsWith("skills/") ? findFirst8([
52366
- path2.join(baselineSkillsRoot, relativePath.slice("skills/".length)),
52367
- path2.join(baselineRoot, relativePath)
52368
- ]) : findFirst8([path2.join(baselineRoot, relativePath)]);
52369
- if (resolvedPath !== undefined) {
52370
- return resolvedPath;
52371
- }
52372
- throw new Error(`Could not locate baseline asset: ${relativePath}`);
52373
- };
52374
-
52375
53013
  // src/data/catalog/hooks.ts
52376
53014
  var hookCatalog = [
52377
53015
  {
@@ -53448,7 +54086,7 @@ var download = async (url2, targetPath, timeoutMs) => {
53448
54086
  }
53449
54087
  };
53450
54088
  var extractSafeTgz = (archivePath, targetDirectory) => {
53451
- const listing = execFileSync2("tar", ["-tzf", archivePath], {
54089
+ const listing = execFileSync3("tar", ["-tzf", archivePath], {
53452
54090
  encoding: "utf8"
53453
54091
  }).split(/\r?\n/u).filter((line4) => line4.length > 0);
53454
54092
  const unsafe = listing.find((entry) => !isSafeTarPath(entry));
@@ -53456,7 +54094,7 @@ var extractSafeTgz = (archivePath, targetDirectory) => {
53456
54094
  throw new Error(`Unsafe baseline archive path: ${unsafe}`);
53457
54095
  }
53458
54096
  mkdirSync(targetDirectory, { recursive: true });
53459
- execFileSync2("tar", ["-xzf", archivePath, "-C", targetDirectory], {
54097
+ execFileSync3("tar", ["-xzf", archivePath, "-C", targetDirectory], {
53460
54098
  stdio: "ignore"
53461
54099
  });
53462
54100
  };
@@ -53467,14 +54105,14 @@ var resolveLocalBaseline = (url2) => {
53467
54105
  const filePath = new URL(url2);
53468
54106
  return loadBaselineFromDirectory(filePath.pathname, "local");
53469
54107
  };
53470
- var submitArtifactPullTelemetry = (baseline, cwd) => {
53471
- submitCliEvent("cli.artifact.pull.completed", {
54108
+ var submitArtifactPullTelemetry = async (baseline, cwd) => {
54109
+ await exports_Effect.runPromise(submitCliEventEffect("cli.artifact.pull.completed", {
53472
54110
  ...cwd === undefined ? {} : { cwd },
53473
54111
  baseline: {
53474
54112
  channel: baseline.summary.channel,
53475
54113
  version: baseline.summary.version
53476
54114
  }
53477
- });
54115
+ }));
53478
54116
  };
53479
54117
  var materializeControlPlaneBaseline = async (resolution, refresh, timeoutMs) => {
53480
54118
  const targetDirectory = path5.join(cacheRoot(), "control-plane", resolution.version);
@@ -53514,7 +54152,7 @@ var resolveControlPlaneStableBaseline = async ({
53514
54152
  timeoutMs,
53515
54153
  cwd
53516
54154
  }) => {
53517
- const baseUrl2 = process.env.DP_CONTROL_PLANE_URL;
54155
+ const baseUrl2 = resolveControlPlaneUrl();
53518
54156
  if (baseUrl2 === undefined || baseUrl2.length === 0) {
53519
54157
  return null;
53520
54158
  }
@@ -53530,7 +54168,7 @@ var resolveControlPlaneStableBaseline = async ({
53530
54168
  ]);
53531
54169
  const materialized = await materializeControlPlaneBaseline(resolution, refresh, timeoutMs);
53532
54170
  if (materialized.artifactPulled) {
53533
- submitArtifactPullTelemetry(materialized.baseline, cwd);
54171
+ await submitArtifactPullTelemetry(materialized.baseline, cwd);
53534
54172
  }
53535
54173
  return materialized.baseline;
53536
54174
  } catch {
@@ -53591,20 +54229,20 @@ var resolveRemoteStableBaseline = async ({
53591
54229
  writeFileSync(extractedMetadataPath, JSON.stringify({ ...extractedMetadata, sha256: archiveSha256 }, null, 2), "utf8");
53592
54230
  rmSync(tempDirectory, { recursive: true, force: true });
53593
54231
  const baseline = loadBaselineFromDirectory(targetDirectory, "remote");
53594
- submitArtifactPullTelemetry(baseline, cwd);
54232
+ await submitArtifactPullTelemetry(baseline, cwd);
53595
54233
  return baseline;
53596
54234
  };
53597
- var resolveBaseline = async (options7 = {}) => {
53598
- const requested = process.env.DP_BASELINE === "bundled" ? "bundled" : options7.baseline ?? "stable";
54235
+ var resolveBaseline = async (options9 = {}) => {
54236
+ const requested = process.env.DP_BASELINE === "bundled" ? "bundled" : options9.baseline ?? "stable";
53599
54237
  if (requested === "bundled") {
53600
54238
  return bundledBaseline;
53601
54239
  }
53602
54240
  try {
53603
54241
  return await resolveRemoteStableBaseline({
53604
- refresh: options7.refresh ?? process.env.DP_BASELINE_REFRESH === "1",
53605
- timeoutMs: options7.timeoutMs ?? 1500,
53606
- releasesUrl: options7.releasesUrl ?? repoReleasesUrl,
53607
- ...options7.cwd === undefined ? {} : { cwd: options7.cwd }
54242
+ refresh: options9.refresh ?? process.env.DP_BASELINE_REFRESH === "1",
54243
+ timeoutMs: options9.timeoutMs ?? 1500,
54244
+ releasesUrl: options9.releasesUrl ?? repoReleasesUrl,
54245
+ ...options9.cwd === undefined ? {} : { cwd: options9.cwd }
53608
54246
  });
53609
54247
  } catch {
53610
54248
  return bundledBaseline;
@@ -53692,13 +54330,13 @@ var renderError5 = (state) => match2(state.error, {
53692
54330
  var renderChoiceDescription3 = (choice4, isHighlighted) => choice4.description && isHighlighted ? char3("-").pipe(cat2(space2), cat2(text3(choice4.description)), annotate2(blackBright2)) : empty38;
53693
54331
  var metaOptionsCount2 = 1;
53694
54332
  var withStem = (prefix) => prefix.pipe(cat2(space2), cat2(space2));
53695
- var renderChoices3 = (state, options7) => {
53696
- const allSelected = state.selectedIndices.size === options7.choices.length;
54333
+ var renderChoices3 = (state, options9) => {
54334
+ const allSelected = state.selectedIndices.size === options9.choices.length;
53697
54335
  const metaOptions = [
53698
- { title: allSelected ? "Clear all selected packs" : options7.selectAll }
54336
+ { title: allSelected ? "Clear all selected packs" : options9.selectAll }
53699
54337
  ];
53700
- const allChoices = [...metaOptions, ...options7.choices];
53701
- const toDisplay = entriesToDisplay2(state.index, allChoices.length, options7.maxPerPage);
54338
+ const allChoices = [...metaOptions, ...options9.choices];
54339
+ const toDisplay = entriesToDisplay2(state.index, allChoices.length, options9.maxPerPage);
53702
54340
  const documents = [];
53703
54341
  for (let index = toDisplay.startIndex;index < toDisplay.endIndex; index++) {
53704
54342
  const choice4 = allChoices[index];
@@ -53726,34 +54364,34 @@ var renderChoices3 = (state, options7) => {
53726
54364
  }
53727
54365
  return vsep2(documents);
53728
54366
  };
53729
- var renderNextFrame9 = (state, options7) => exports_Effect.gen(function* () {
54367
+ var renderNextFrame9 = (state, options9) => exports_Effect.gen(function* () {
53730
54368
  const terminal = yield* Terminal;
53731
54369
  const columns = yield* terminal.columns;
53732
- const promptMessage = renderOutput8(options7.message);
53733
- const choices = renderChoices3(state, options7);
54370
+ const promptMessage = renderOutput8(options9.message);
54371
+ const choices = renderChoices3(state, options9);
53734
54372
  const error4 = renderError5(state);
53735
54373
  return cursorHide3.pipe(cat2(promptMessage), cat2(hardLine2), cat2(choices), cat2(error4), render3({ style: "pretty", options: { lineWidth: columns } }));
53736
54374
  });
53737
- var renderSubmission9 = (state, options7) => exports_Effect.gen(function* () {
54375
+ var renderSubmission9 = (state, options9) => exports_Effect.gen(function* () {
53738
54376
  const terminal = yield* Terminal;
53739
54377
  const columns = yield* terminal.columns;
53740
- const selectedChoices = Array.from(state.selectedIndices).sort(Order2).map((index) => options7.choices[index].title).join(", ");
53741
- return renderOutput8(options7.message).pipe(cat2(annotate2(figures2.tick, green3)), cat2(space2), cat2(annotate2(text3(selectedChoices), white3)), cat2(hardLine2), render3({ style: "pretty", options: { lineWidth: columns } }));
54378
+ const selectedChoices = Array.from(state.selectedIndices).sort(Order2).map((index) => options9.choices[index].title).join(", ");
54379
+ return renderOutput8(options9.message).pipe(cat2(annotate2(figures2.tick, green3)), cat2(space2), cat2(annotate2(text3(selectedChoices), white3)), cat2(hardLine2), render3({ style: "pretty", options: { lineWidth: columns } }));
53742
54380
  });
53743
- var clearPrompt = (options7) => exports_Effect.gen(function* () {
54381
+ var clearPrompt = (options9) => exports_Effect.gen(function* () {
53744
54382
  const terminal = yield* Terminal;
53745
54383
  const columns = yield* terminal.columns;
53746
54384
  const text12 = `
53747
- `.repeat(Math.min(options7.choices.length + 1, options7.maxPerPage)) + options7.message;
54385
+ `.repeat(Math.min(options9.choices.length + 1, options9.maxPerPage)) + options9.message;
53748
54386
  return eraseText2(text12, columns).pipe(cat2(eraseLine3), cat2(cursorLeft3), optimize3(Deep), render3({ style: "pretty", options: { lineWidth: columns } }));
53749
54387
  });
53750
- var processSpace2 = (state, options7) => {
54388
+ var processSpace2 = (state, options9) => {
53751
54389
  const selectedIndices = new Set(state.selectedIndices);
53752
54390
  if (state.index === 0) {
53753
- if (selectedIndices.size === options7.choices.length) {
54391
+ if (selectedIndices.size === options9.choices.length) {
53754
54392
  selectedIndices.clear();
53755
54393
  } else {
53756
- for (let index = 0;index < options7.choices.length; index++) {
54394
+ for (let index = 0;index < options9.choices.length; index++) {
53757
54395
  selectedIndices.add(index);
53758
54396
  }
53759
54397
  }
@@ -53767,11 +54405,11 @@ var processSpace2 = (state, options7) => {
53767
54405
  }
53768
54406
  return exports_Effect.succeed(Action2.NextFrame({ state: { ...state, selectedIndices, error: none2() } }));
53769
54407
  };
53770
- var localMultiSelect = (options7) => {
54408
+ var localMultiSelect = (options9) => {
53771
54409
  const resolvedOptions = {
53772
54410
  maxPerPage: 10,
53773
54411
  selectAll: "Select all packs on this step",
53774
- ...options7
54412
+ ...options9
53775
54413
  };
53776
54414
  const prompt4 = exports_Prompt.custom({
53777
54415
  index: 0,
@@ -53848,7 +54486,7 @@ var PromptLive = exports_Effect.acquireRelease(exports_Effect.sync(() => createI
53848
54486
  })));
53849
54487
 
53850
54488
  // src/scaffold/run.ts
53851
- import { execFileSync as execFileSync5 } from "child_process";
54489
+ import { execFileSync as execFileSync6 } from "child_process";
53852
54490
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
53853
54491
  import { homedir as homedir2 } from "os";
53854
54492
  import path10 from "path";
@@ -54380,29 +55018,29 @@ var formatAgentHandoffSummary = (result) => [
54380
55018
  " 13. Run `opensrc path <package>` or `opensrc path owner/repo` for those core libraries, then inspect the returned checkout paths. Clone the major framework/runtime libraries you will reason about; do not clone every dependency mechanically."
54381
55019
  ].join(`
54382
55020
  `);
54383
- var formatSelectionPreview = (options7) => [
55021
+ var formatSelectionPreview = (options9) => [
54384
55022
  "Review scaffold selection before continuing",
54385
- ...section("prefilled packs:", formatPackList(options7.preselectedPacks, options7.baseline)),
54386
- ...maybeSection("added packs:", formatPackList(options7.addedPacks, options7.baseline)),
54387
- ...maybeSection("removed packs:", formatPackList(options7.removedPacks, options7.baseline)),
54388
- ...section("final packs:", formatCompactPackList(options7.finalPacks)),
54389
- `output directory: ${options7.outputDirectory}`
55023
+ ...section("prefilled packs:", formatPackList(options9.preselectedPacks, options9.baseline)),
55024
+ ...maybeSection("added packs:", formatPackList(options9.addedPacks, options9.baseline)),
55025
+ ...maybeSection("removed packs:", formatPackList(options9.removedPacks, options9.baseline)),
55026
+ ...section("final packs:", formatCompactPackList(options9.finalPacks)),
55027
+ `output directory: ${options9.outputDirectory}`
54390
55028
  ].join(`
54391
55029
  `);
54392
- var formatResolvedPackSummary = (options7) => options7.optionalPacks.length === 0 ? [
54393
- ...section("default packs:", formatPackList(options7.defaultPacks, options7.baseline)),
54394
- ...section("language packs:", formatPackList(options7.languagePacks, options7.baseline)),
54395
- ...section("detected packs:", formatPackList(options7.detectedPacks, options7.baseline)),
54396
- ...section("surface packs:", formatPackList(options7.surfacePacks, options7.baseline)),
55030
+ var formatResolvedPackSummary = (options9) => options9.optionalPacks.length === 0 ? [
55031
+ ...section("default packs:", formatPackList(options9.defaultPacks, options9.baseline)),
55032
+ ...section("language packs:", formatPackList(options9.languagePacks, options9.baseline)),
55033
+ ...section("detected packs:", formatPackList(options9.detectedPacks, options9.baseline)),
55034
+ ...section("surface packs:", formatPackList(options9.surfacePacks, options9.baseline)),
54397
55035
  "additional packs available:",
54398
55036
  " all known packs are already included in the prefilled selection."
54399
55037
  ].join(`
54400
55038
  `) : [
54401
- ...section("default packs:", formatPackList(options7.defaultPacks, options7.baseline)),
54402
- ...section("language packs:", formatPackList(options7.languagePacks, options7.baseline)),
54403
- ...section("detected packs:", formatPackList(options7.detectedPacks, options7.baseline)),
54404
- ...section("surface packs:", formatPackList(options7.surfacePacks, options7.baseline)),
54405
- ...section("additional packs available:", formatPackList(options7.optionalPacks, options7.baseline))
55039
+ ...section("default packs:", formatPackList(options9.defaultPacks, options9.baseline)),
55040
+ ...section("language packs:", formatPackList(options9.languagePacks, options9.baseline)),
55041
+ ...section("detected packs:", formatPackList(options9.detectedPacks, options9.baseline)),
55042
+ ...section("surface packs:", formatPackList(options9.surfacePacks, options9.baseline)),
55043
+ ...section("additional packs available:", formatPackList(options9.optionalPacks, options9.baseline))
54406
55044
  ].join(`
54407
55045
  `);
54408
55046
 
@@ -54488,7 +55126,7 @@ var finalizePackSelection = (resolved, additions, removals) => {
54488
55126
  var canRemovePack = (resolved, packId) => resolved.preselectedPacks.includes(packId) && !resolved.defaultPacks.includes(packId);
54489
55127
 
54490
55128
  // src/core/tools.ts
54491
- import { execFileSync as execFileSync3 } from "child_process";
55129
+ import { execFileSync as execFileSync4 } from "child_process";
54492
55130
  import { accessSync, constants as constants2 } from "fs";
54493
55131
  import { homedir } from "os";
54494
55132
  import path8 from "path";
@@ -54516,10 +55154,10 @@ var commandExistsOnPath = (command, env2 = process.env, platform = process.platf
54516
55154
  var defaultRuntime3 = {
54517
55155
  cwd: homedir(),
54518
55156
  commandExists: commandExistsOnPath,
54519
- execFile: (command, args2, options7) => {
54520
- execFileSync3(command, [...args2], {
54521
- cwd: options7?.cwd,
54522
- stdio: options7?.stdio ?? "inherit"
55157
+ execFile: (command, args2, options9) => {
55158
+ execFileSync4(command, [...args2], {
55159
+ cwd: options9?.cwd,
55160
+ stdio: options9?.stdio ?? "inherit"
54523
55161
  });
54524
55162
  }
54525
55163
  };
@@ -54589,7 +55227,7 @@ var ensureToolsInstalled = (toolIds, baseline = bundledBaseline, runtime5 = defa
54589
55227
  };
54590
55228
 
54591
55229
  // src/scaffold/output.ts
54592
- import { execFileSync as execFileSync4 } from "child_process";
55230
+ import { execFileSync as execFileSync5 } from "child_process";
54593
55231
  import { createHash as createHash2 } from "crypto";
54594
55232
  import {
54595
55233
  cpSync,
@@ -55731,7 +56369,7 @@ var writeScaffoldOutput = ({
55731
56369
  }));
55732
56370
  hookFiles.push(hook.outputPath);
55733
56371
  }
55734
- execFileSync4(process.execPath, [path9.join(outputDirectory, syncScriptFile)], {
56372
+ execFileSync5(process.execPath, [path9.join(outputDirectory, syncScriptFile)], {
55735
56373
  cwd: outputDirectory,
55736
56374
  stdio: "ignore"
55737
56375
  });
@@ -55866,7 +56504,7 @@ var tryClipboardCommand = ({
55866
56504
  return { ok: false };
55867
56505
  }
55868
56506
  try {
55869
- execFileSync5(command, args2, {
56507
+ execFileSync6(command, args2, {
55870
56508
  cwd: clipboardWorkingDirectory,
55871
56509
  input: text12,
55872
56510
  stdio: ["pipe", "ignore", "ignore"]
@@ -55892,16 +56530,16 @@ var copyToClipboard = (text12) => {
55892
56530
  var selectedSkills2 = (finalPacks, baseline) => [
55893
56531
  ...new Set(finalPacks.flatMap((packId) => skillsForPack(packId, baseline)))
55894
56532
  ].toSorted();
55895
- var promptForPackMultiSelect = (prompt4, options7) => exports_Effect.gen(function* () {
56533
+ var promptForPackMultiSelect = (prompt4, options9) => exports_Effect.gen(function* () {
55896
56534
  yield* prompt4.writeLine("");
55897
- yield* prompt4.writeLine(renderCommandSection(options7.title, [options7.intro, "", `available packs: ${options7.allowed.length}`].join(`
56535
+ yield* prompt4.writeLine(renderCommandSection(options9.title, [options9.intro, "", `available packs: ${options9.allowed.length}`].join(`
55898
56536
  `)));
55899
56537
  return yield* prompt4.multiSelect({
55900
- message: options7.message,
55901
- ...options7.selectAll ? { selectAll: options7.selectAll } : {},
55902
- ...options7.selectNone ? { selectNone: options7.selectNone } : {},
55903
- choices: options7.allowed.map((packId) => {
55904
- const description = options7.descriptions?.[packId];
56538
+ message: options9.message,
56539
+ ...options9.selectAll ? { selectAll: options9.selectAll } : {},
56540
+ ...options9.selectNone ? { selectNone: options9.selectNone } : {},
56541
+ choices: options9.allowed.map((packId) => {
56542
+ const description = options9.descriptions?.[packId];
55905
56543
  return description ? {
55906
56544
  title: packId,
55907
56545
  value: packId,
@@ -55920,7 +56558,8 @@ var runScaffold = ({
55920
56558
  prompt: prompt4,
55921
56559
  outputDirectory,
55922
56560
  ensureTools = true,
55923
- baseline = bundledBaseline
56561
+ baseline = bundledBaseline,
56562
+ assumeYes = false
55924
56563
  }) => exports_Effect.gen(function* () {
55925
56564
  const baseRequiredTools = requiredToolsForSkills([], baseline);
55926
56565
  let toolBootstrapStatuses = [];
@@ -55956,7 +56595,11 @@ var runScaffold = ({
55956
56595
  let additions = [];
55957
56596
  let removals = [];
55958
56597
  let finalPacks = resolved.preselectedPacks;
55959
- while (true) {
56598
+ if (assumeYes) {
56599
+ yield* prompt4.writeLine("");
56600
+ yield* prompt4.writeLine(renderHint("Non-interactive mode: accepting prefilled pack selection."));
56601
+ }
56602
+ while (!assumeYes) {
55960
56603
  const shouldKeepPrefilledSelection = (yield* prompt4.readLine(renderQuestion("Keep the prefilled pack selection as-is? [Y/n]: "))).trim().toLowerCase();
55961
56604
  const shouldEditSelection = !yesValues.has(shouldKeepPrefilledSelection);
55962
56605
  additions = shouldEditSelection ? resolved.optionalPacks.length === 0 ? [] : yield* promptForPackMultiSelect(prompt4, {
@@ -56134,7 +56777,7 @@ var runScaffold = ({
56134
56777
  yield* prompt4.writeLine(renderJsonLabel());
56135
56778
  yield* prompt4.writeLine(encodePrettyJson(result));
56136
56779
  }
56137
- submitCliEvent("cli.scaffold.setup.completed", {
56780
+ yield* submitCliEventEffect("cli.scaffold.setup.completed", {
56138
56781
  cwd: scanDirectory,
56139
56782
  baseline: {
56140
56783
  version: baseline.summary.version
@@ -56898,34 +57541,27 @@ var stageScaffoldCatalog = [
56898
57541
  wikiRoot
56899
57542
  }) => `You are the operator agent continuing a \`punks scaffold init\` run.
56900
57543
 
56901
- Use the scaffolded skills now available under \`.agents/skills/\` to run the canonical requirements-to-backlog flow.
56902
-
56903
- Goals:
56904
- - use \`requirements-grill\` to pin down the project idea, requirements, and open branches
56905
- - use \`write-backlog\` only after the grill handoff says the requirements grill is done
56906
-
56907
- Required skills:
56908
- - \`requirements-grill\`
56909
- - \`write-backlog\`
57544
+ Do not start requirements discovery by default. First reconcile the generated output with this repository.
56910
57545
 
56911
57546
  Scaffolded wiki base:
56912
- - treat \`${wikiRoot}\` as the dedicated wiki root for specs, raw inputs, routed wiki/project docs, and ingest bookkeeping
57547
+ - treat \`${wikiRoot}\` as the dedicated wiki root for specs, raw inputs, routed project docs, and ingest bookkeeping
56913
57548
  - this is not the same thing as \`docs/\`
56914
57549
  - if the repo is monorepo-shaped, reconcile the scaffolded wiki into the real app layout, usually \`apps/wiki\`
56915
57550
  - if the CLI guessed the wrong root, move or refactor the scaffolded wiki before creating specs, plans, or ingesting domain knowledge
56916
57551
  - keep using the reconciled wiki root when later steps create specs, plans, or ingest domain knowledge
56917
57552
 
56918
- Execution order:
56919
- 1. Start with \`requirements-grill\` and run the requirements grill session.
56920
- 2. Follow the skill's artifact and wiki-synthesis guidance.
56921
- 3. Run \`write-backlog\` only after the grill gate is closed.
56922
- 4. Use \`punks scaffold setup\` only after the repo shape is ready for repo-aware AI setup.
57553
+ Generated skills:
57554
+ - \`.agents/skills/requirements-grill\`
57555
+ - \`.agents/skills/write-backlog\`
56923
57556
 
56924
- Gate:
56925
- - do not create backlog items while active requirement branches remain unresolved
56926
- - treat this as the canonical step before backlog creation
57557
+ Post-command guidance:
57558
+ 1. Read the repository guidance and inspect the generated files.
57559
+ 2. Move, rename, or refactor the generated wiki and skill output when needed so it matches the actual repo layout.
57560
+ 3. Report what changed and what remains unresolved.
57561
+ 4. Use \`requirements-grill\` and then \`write-backlog\` only when the user actually asks for requirements or backlog generation.
57562
+ 5. Use \`punks scaffold setup\` only after the repo shape is ready for repo-aware AI setup.
56927
57563
 
56928
- When this gate is complete, the next CLI step is:
57564
+ When the generated init output matches the repo, the next CLI step is:
56929
57565
  - \`punks scaffold setup\``
56930
57566
  }
56931
57567
  ];
@@ -56964,11 +57600,12 @@ var writeMissingFile = ({
56964
57600
  };
56965
57601
  var scaffoldWiki = ({
56966
57602
  outputDirectory,
56967
- wikiRoot
57603
+ wikiRoot,
57604
+ targetRoot
56968
57605
  }) => {
56969
57606
  const template = makeWikiScaffoldTemplate(wikiRoot);
56970
57607
  const createdFiles = [];
56971
- const wikiDirectory = path11.join(outputDirectory, wikiRoot);
57608
+ const wikiDirectory = path11.join(outputDirectory, targetRoot);
56972
57609
  for (const directory3 of template.topLevelDirectories) {
56973
57610
  mkdirSync4(path11.join(wikiDirectory, directory3), { recursive: true });
56974
57611
  }
@@ -57036,6 +57673,26 @@ var scaffoldWiki = ({
57036
57673
  }
57037
57674
  return createdFiles.toSorted();
57038
57675
  };
57676
+ var isWikiOutputDirectory = (outputDirectory) => {
57677
+ const normalized = path11.resolve(outputDirectory);
57678
+ return path11.basename(normalized) === "wiki";
57679
+ };
57680
+ var stageWikiTarget = ({
57681
+ outputDirectory,
57682
+ monorepo
57683
+ }) => {
57684
+ if (isWikiOutputDirectory(outputDirectory)) {
57685
+ const parent = path11.basename(path11.dirname(path11.resolve(outputDirectory)));
57686
+ return {
57687
+ wikiRoot: parent === "apps" ? "apps/wiki" : "wiki",
57688
+ targetRoot: "."
57689
+ };
57690
+ }
57691
+ return {
57692
+ wikiRoot: monorepo ? "apps/wiki" : "wiki",
57693
+ targetRoot: monorepo ? "apps/wiki" : "wiki"
57694
+ };
57695
+ };
57039
57696
  var runStageScaffold = ({
57040
57697
  commandId,
57041
57698
  outputDirectory,
@@ -57044,7 +57701,10 @@ var runStageScaffold = ({
57044
57701
  }) => exports_Effect.gen(function* () {
57045
57702
  const stage = stageScaffoldById[commandId];
57046
57703
  const detection = yield* detectRepository(outputDirectory).pipe(exports_Effect.catchAll(() => exports_Effect.succeed(null)));
57047
- const wikiRoot = detection?.monorepo === true ? "apps/wiki" : "wiki";
57704
+ const wikiTarget = stageWikiTarget({
57705
+ outputDirectory,
57706
+ monorepo: detection?.monorepo === true
57707
+ });
57048
57708
  const skillFiles = stage.skills.map((skillId) => copySkillDirectory({
57049
57709
  outputDirectory,
57050
57710
  skillId,
@@ -57052,9 +57712,10 @@ var runStageScaffold = ({
57052
57712
  }));
57053
57713
  const wikiFiles = scaffoldWiki({
57054
57714
  outputDirectory,
57055
- wikiRoot
57715
+ wikiRoot: wikiTarget.wikiRoot,
57716
+ targetRoot: wikiTarget.targetRoot
57056
57717
  });
57057
- const operatorPrompt = stage.renderPrompt({ wikiRoot });
57718
+ const operatorPrompt = stage.renderPrompt({ wikiRoot: wikiTarget.wikiRoot });
57058
57719
  yield* prompt4.writeLine(renderScaffoldTitle());
57059
57720
  yield* prompt4.writeLine("");
57060
57721
  yield* prompt4.writeLine(renderStageIntro({
@@ -57074,6 +57735,12 @@ var runStageScaffold = ({
57074
57735
  yield* prompt4.writeLine(renderNotes([`Output directory: ${outputDirectory}`, "Hidden output directories: .agents"]));
57075
57736
  yield* prompt4.writeLine("");
57076
57737
  yield* prompt4.writeLine(renderCommandSection("Operator prompt", operatorPrompt));
57738
+ yield* submitCliEventEffect("cli.scaffold.init.completed", {
57739
+ cwd: outputDirectory,
57740
+ baseline: {
57741
+ version: baseline.summary.version
57742
+ }
57743
+ });
57077
57744
  return {
57078
57745
  outputDirectory,
57079
57746
  skillFiles,
@@ -57088,6 +57755,7 @@ var jsonOption2 = exports_Options.boolean("json").pipe(exports_Options.withDescr
57088
57755
  var repoShapeOption = exports_Options.optional(exports_Options.choice("repo-shape", ["auto", "monorepo", "single"]).pipe(exports_Options.withDescription("Override repo shape detection. Use 'monorepo' or 'single' when auto-detection is not the desired scaffold mode.")));
57089
57756
  var baselineOption = exports_Options.optional(exports_Options.choice("baseline", ["stable", "bundled"]).pipe(exports_Options.withDescription("Scaffold baseline to use. Defaults to latest stable remote baseline with bundled fallback.")));
57090
57757
  var refreshBaselineOption = exports_Options.boolean("refresh-baseline").pipe(exports_Options.withDescription("Refetch the stable baseline instead of reusing the local cache."));
57758
+ var yesOption = exports_Options.boolean("yes").pipe(exports_Options.withDescription("Run non-interactively and accept the resolved default scaffold selection."));
57091
57759
  var stageCommand = (id2, description) => exports_Command.make(id2, { output: outputOption, baseline: baselineOption, refreshBaseline: refreshBaselineOption }, ({ output: output2, baseline, refreshBaseline }) => exports_Effect.scoped(exports_Effect.gen(function* () {
57092
57760
  const prompt4 = yield* PromptLive;
57093
57761
  const outputDirectory = path12.resolve(process.cwd(), getOrElse(output2, () => "."));
@@ -57105,8 +57773,9 @@ var setupCommand = exports_Command.make("setup", {
57105
57773
  json: jsonOption2,
57106
57774
  repoShape: repoShapeOption,
57107
57775
  baseline: baselineOption,
57108
- refreshBaseline: refreshBaselineOption
57109
- }, ({ input: input2, output: output2, json: json2, repoShape, baseline, refreshBaseline }) => exports_Effect.scoped(exports_Effect.gen(function* () {
57776
+ refreshBaseline: refreshBaselineOption,
57777
+ yes: yesOption
57778
+ }, ({ input: input2, output: output2, json: json2, repoShape, baseline, refreshBaseline, yes }) => exports_Effect.scoped(exports_Effect.gen(function* () {
57110
57779
  const prompt4 = yield* PromptLive;
57111
57780
  const scanDirectory = path12.resolve(process.cwd(), getOrElse(input2, () => "."));
57112
57781
  const resolvedBaseline = yield* exports_Effect.promise(() => resolveBaseline(baselineResolveOptions(baseline, refreshBaseline, scanDirectory)));
@@ -57118,13 +57787,15 @@ var setupCommand = exports_Command.make("setup", {
57118
57787
  prompt: prompt4,
57119
57788
  outputDirectory: outputDirectory.value,
57120
57789
  repoShapeMode: resolvedRepoShape,
57121
- baseline: resolvedBaseline
57790
+ baseline: resolvedBaseline,
57791
+ assumeYes: yes
57122
57792
  } : {
57123
57793
  scanDirectory,
57124
57794
  emitJson: json2,
57125
57795
  prompt: prompt4,
57126
57796
  repoShapeMode: resolvedRepoShape,
57127
- baseline: resolvedBaseline
57797
+ baseline: resolvedBaseline,
57798
+ assumeYes: yes
57128
57799
  });
57129
57800
  }).pipe(exports_Effect.catchTag("CliValidationError", (error4) => exports_Effect.sync(() => {
57130
57801
  console.log(renderHint(error4.message));
@@ -57160,24 +57831,24 @@ import path13 from "path";
57160
57831
 
57161
57832
  // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/base.js
57162
57833
  class Diff {
57163
- diff(oldStr, newStr, options7 = {}) {
57834
+ diff(oldStr, newStr, options9 = {}) {
57164
57835
  let callback;
57165
- if (typeof options7 === "function") {
57166
- callback = options7;
57167
- options7 = {};
57168
- } else if ("callback" in options7) {
57169
- callback = options7.callback;
57170
- }
57171
- const oldString = this.castInput(oldStr, options7);
57172
- const newString = this.castInput(newStr, options7);
57173
- const oldTokens = this.removeEmpty(this.tokenize(oldString, options7));
57174
- const newTokens = this.removeEmpty(this.tokenize(newString, options7));
57175
- return this.diffWithOptionsObj(oldTokens, newTokens, options7, callback);
57176
- }
57177
- diffWithOptionsObj(oldTokens, newTokens, options7, callback) {
57836
+ if (typeof options9 === "function") {
57837
+ callback = options9;
57838
+ options9 = {};
57839
+ } else if ("callback" in options9) {
57840
+ callback = options9.callback;
57841
+ }
57842
+ const oldString = this.castInput(oldStr, options9);
57843
+ const newString = this.castInput(newStr, options9);
57844
+ const oldTokens = this.removeEmpty(this.tokenize(oldString, options9));
57845
+ const newTokens = this.removeEmpty(this.tokenize(newString, options9));
57846
+ return this.diffWithOptionsObj(oldTokens, newTokens, options9, callback);
57847
+ }
57848
+ diffWithOptionsObj(oldTokens, newTokens, options9, callback) {
57178
57849
  var _a;
57179
57850
  const done9 = (value6) => {
57180
- value6 = this.postProcess(value6, options7);
57851
+ value6 = this.postProcess(value6, options9);
57181
57852
  if (callback) {
57182
57853
  setTimeout(function() {
57183
57854
  callback(value6);
@@ -57190,13 +57861,13 @@ class Diff {
57190
57861
  const newLen = newTokens.length, oldLen = oldTokens.length;
57191
57862
  let editLength = 1;
57192
57863
  let maxEditLength = newLen + oldLen;
57193
- if (options7.maxEditLength != null) {
57194
- maxEditLength = Math.min(maxEditLength, options7.maxEditLength);
57864
+ if (options9.maxEditLength != null) {
57865
+ maxEditLength = Math.min(maxEditLength, options9.maxEditLength);
57195
57866
  }
57196
- const maxExecutionTime = (_a = options7.timeout) !== null && _a !== undefined ? _a : Infinity;
57867
+ const maxExecutionTime = (_a = options9.timeout) !== null && _a !== undefined ? _a : Infinity;
57197
57868
  const abortAfterTimestamp = Date.now() + maxExecutionTime;
57198
57869
  const bestPath = [{ oldPos: -1, lastComponent: undefined }];
57199
- let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options7);
57870
+ let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options9);
57200
57871
  if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
57201
57872
  return done9(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
57202
57873
  }
@@ -57219,11 +57890,11 @@ class Diff {
57219
57890
  continue;
57220
57891
  }
57221
57892
  if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
57222
- basePath = this.addToPath(addPath, true, false, 0, options7);
57893
+ basePath = this.addToPath(addPath, true, false, 0, options9);
57223
57894
  } else {
57224
- basePath = this.addToPath(removePath, false, true, 1, options7);
57895
+ basePath = this.addToPath(removePath, false, true, 1, options9);
57225
57896
  }
57226
- newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options7);
57897
+ newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options9);
57227
57898
  if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
57228
57899
  return done9(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
57229
57900
  } else {
@@ -57258,9 +57929,9 @@ class Diff {
57258
57929
  }
57259
57930
  }
57260
57931
  }
57261
- addToPath(path13, added, removed, oldPosInc, options7) {
57932
+ addToPath(path13, added, removed, oldPosInc, options9) {
57262
57933
  const last5 = path13.lastComponent;
57263
- if (last5 && !options7.oneChangePerToken && last5.added === added && last5.removed === removed) {
57934
+ if (last5 && !options9.oneChangePerToken && last5.added === added && last5.removed === removed) {
57264
57935
  return {
57265
57936
  oldPos: path13.oldPos + oldPosInc,
57266
57937
  lastComponent: { count: last5.count + 1, added, removed, previousComponent: last5.previousComponent }
@@ -57272,28 +57943,28 @@ class Diff {
57272
57943
  };
57273
57944
  }
57274
57945
  }
57275
- extractCommon(basePath, newTokens, oldTokens, diagonalPath, options7) {
57946
+ extractCommon(basePath, newTokens, oldTokens, diagonalPath, options9) {
57276
57947
  const newLen = newTokens.length, oldLen = oldTokens.length;
57277
57948
  let oldPos = basePath.oldPos, newPos = oldPos - diagonalPath, commonCount = 0;
57278
- while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options7)) {
57949
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options9)) {
57279
57950
  newPos++;
57280
57951
  oldPos++;
57281
57952
  commonCount++;
57282
- if (options7.oneChangePerToken) {
57953
+ if (options9.oneChangePerToken) {
57283
57954
  basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
57284
57955
  }
57285
57956
  }
57286
- if (commonCount && !options7.oneChangePerToken) {
57957
+ if (commonCount && !options9.oneChangePerToken) {
57287
57958
  basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
57288
57959
  }
57289
57960
  basePath.oldPos = oldPos;
57290
57961
  return newPos;
57291
57962
  }
57292
- equals(left3, right3, options7) {
57293
- if (options7.comparator) {
57294
- return options7.comparator(left3, right3);
57963
+ equals(left3, right3, options9) {
57964
+ if (options9.comparator) {
57965
+ return options9.comparator(left3, right3);
57295
57966
  } else {
57296
- return left3 === right3 || !!options7.ignoreCase && left3.toLowerCase() === right3.toLowerCase();
57967
+ return left3 === right3 || !!options9.ignoreCase && left3.toLowerCase() === right3.toLowerCase();
57297
57968
  }
57298
57969
  }
57299
57970
  removeEmpty(array9) {
@@ -57305,16 +57976,16 @@ class Diff {
57305
57976
  }
57306
57977
  return ret;
57307
57978
  }
57308
- castInput(value6, options7) {
57979
+ castInput(value6, options9) {
57309
57980
  return value6;
57310
57981
  }
57311
- tokenize(value6, options7) {
57982
+ tokenize(value6, options9) {
57312
57983
  return Array.from(value6);
57313
57984
  }
57314
57985
  join(chars) {
57315
57986
  return chars.join("");
57316
57987
  }
57317
- postProcess(changeObjects, options7) {
57988
+ postProcess(changeObjects, options9) {
57318
57989
  return changeObjects;
57319
57990
  }
57320
57991
  get useLongestToken() {
@@ -57486,9 +58157,9 @@ function leadingAndTrailingWs(string8, segmenter) {
57486
58157
  const segments = segment(string8, segmenter);
57487
58158
  const firstSeg = segments[0];
57488
58159
  const lastSeg = segments[segments.length - 1];
57489
- const head11 = /\s/.test(firstSeg) ? firstSeg : "";
58160
+ const head13 = /\s/.test(firstSeg) ? firstSeg : "";
57490
58161
  const tail2 = /\s/.test(lastSeg) ? lastSeg : "";
57491
- return [head11, tail2];
58162
+ return [head13, tail2];
57492
58163
  }
57493
58164
 
57494
58165
  // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/word.js
@@ -57496,17 +58167,17 @@ var extendedWordChars = "a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-
57496
58167
  var tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, "ug");
57497
58168
 
57498
58169
  class WordDiff extends Diff {
57499
- equals(left3, right3, options7) {
57500
- if (options7.ignoreCase) {
58170
+ equals(left3, right3, options9) {
58171
+ if (options9.ignoreCase) {
57501
58172
  left3 = left3.toLowerCase();
57502
58173
  right3 = right3.toLowerCase();
57503
58174
  }
57504
58175
  return left3.trim() === right3.trim();
57505
58176
  }
57506
- tokenize(value6, options7 = {}) {
58177
+ tokenize(value6, options9 = {}) {
57507
58178
  let parts2;
57508
- if (options7.intlSegmenter) {
57509
- const segmenter = options7.intlSegmenter;
58179
+ if (options9.intlSegmenter) {
58180
+ const segmenter = options9.intlSegmenter;
57510
58181
  if (segmenter.resolvedOptions().granularity != "word") {
57511
58182
  throw new Error('The segmenter passed must have a granularity of "word"');
57512
58183
  }
@@ -57545,8 +58216,8 @@ class WordDiff extends Diff {
57545
58216
  }
57546
58217
  }).join("");
57547
58218
  }
57548
- postProcess(changes2, options7) {
57549
- if (!changes2 || options7.oneChangePerToken) {
58219
+ postProcess(changes2, options9) {
58220
+ if (!changes2 || options9.oneChangePerToken) {
57550
58221
  return changes2;
57551
58222
  }
57552
58223
  let lastKeep = null;
@@ -57559,7 +58230,7 @@ class WordDiff extends Diff {
57559
58230
  deletion = change;
57560
58231
  } else {
57561
58232
  if (insertion || deletion) {
57562
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change, options7.intlSegmenter);
58233
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change, options9.intlSegmenter);
57563
58234
  }
57564
58235
  lastKeep = change;
57565
58236
  insertion = null;
@@ -57567,7 +58238,7 @@ class WordDiff extends Diff {
57567
58238
  }
57568
58239
  });
57569
58240
  if (insertion || deletion) {
57570
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null, options7.intlSegmenter);
58241
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null, options9.intlSegmenter);
57571
58242
  }
57572
58243
  return changes2;
57573
58244
  }
@@ -57633,17 +58304,17 @@ class LineDiff extends Diff {
57633
58304
  super(...arguments);
57634
58305
  this.tokenize = tokenize;
57635
58306
  }
57636
- equals(left3, right3, options7) {
57637
- if (options7.ignoreWhitespace) {
57638
- if (!options7.newlineIsToken || !left3.includes(`
58307
+ equals(left3, right3, options9) {
58308
+ if (options9.ignoreWhitespace) {
58309
+ if (!options9.newlineIsToken || !left3.includes(`
57639
58310
  `)) {
57640
58311
  left3 = left3.trim();
57641
58312
  }
57642
- if (!options7.newlineIsToken || !right3.includes(`
58313
+ if (!options9.newlineIsToken || !right3.includes(`
57643
58314
  `)) {
57644
58315
  right3 = right3.trim();
57645
58316
  }
57646
- } else if (options7.ignoreNewlineAtEof && !options7.newlineIsToken) {
58317
+ } else if (options9.ignoreNewlineAtEof && !options9.newlineIsToken) {
57647
58318
  if (left3.endsWith(`
57648
58319
  `)) {
57649
58320
  left3 = left3.slice(0, -1);
@@ -57653,15 +58324,15 @@ class LineDiff extends Diff {
57653
58324
  right3 = right3.slice(0, -1);
57654
58325
  }
57655
58326
  }
57656
- return super.equals(left3, right3, options7);
58327
+ return super.equals(left3, right3, options9);
57657
58328
  }
57658
58329
  }
57659
58330
  var lineDiff = new LineDiff;
57660
- function diffLines(oldStr, newStr, options7) {
57661
- return lineDiff.diff(oldStr, newStr, options7);
58331
+ function diffLines(oldStr, newStr, options9) {
58332
+ return lineDiff.diff(oldStr, newStr, options9);
57662
58333
  }
57663
- function tokenize(value6, options7) {
57664
- if (options7.stripTrailingCr) {
58334
+ function tokenize(value6, options9) {
58335
+ if (options9.stripTrailingCr) {
57665
58336
  value6 = value6.replace(/\r\n/g, `
57666
58337
  `);
57667
58338
  }
@@ -57671,7 +58342,7 @@ function tokenize(value6, options7) {
57671
58342
  }
57672
58343
  for (let i = 0;i < linesAndNewlines.length; i++) {
57673
58344
  const line4 = linesAndNewlines[i];
57674
- if (i % 2 && !options7.newlineIsToken) {
58345
+ if (i % 2 && !options9.newlineIsToken) {
57675
58346
  retLines[retLines.length - 1] += line4;
57676
58347
  } else {
57677
58348
  retLines.push(line4);
@@ -57727,12 +58398,12 @@ class JsonDiff extends Diff {
57727
58398
  get useLongestToken() {
57728
58399
  return true;
57729
58400
  }
57730
- castInput(value6, options7) {
57731
- const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options7;
58401
+ castInput(value6, options9) {
58402
+ const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options9;
57732
58403
  return typeof value6 === "string" ? value6 : JSON.stringify(canonicalize(value6, null, null, stringifyReplacer), null, " ");
57733
58404
  }
57734
- equals(left3, right3, options7) {
57735
- return super.equals(left3.replace(/,([\r\n])/g, "$1"), right3.replace(/,([\r\n])/g, "$1"), options7);
58405
+ equals(left3, right3, options9) {
58406
+ return super.equals(left3.replace(/,([\r\n])/g, "$1"), right3.replace(/,([\r\n])/g, "$1"), options9);
57736
58407
  }
57737
58408
  }
57738
58409
  var jsonDiff = new JsonDiff;
@@ -57852,14 +58523,14 @@ var INCLUDE_HEADERS = {
57852
58523
  includeUnderline: true,
57853
58524
  includeFileHeaders: true
57854
58525
  };
57855
- function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options7) {
58526
+ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options9) {
57856
58527
  let optionsObj;
57857
- if (!options7) {
58528
+ if (!options9) {
57858
58529
  optionsObj = {};
57859
- } else if (typeof options7 === "function") {
57860
- optionsObj = { callback: options7 };
58530
+ } else if (typeof options9 === "function") {
58531
+ optionsObj = { callback: options9 };
57861
58532
  } else {
57862
- optionsObj = options7;
58533
+ optionsObj = options9;
57863
58534
  }
57864
58535
  if (typeof optionsObj.context === "undefined") {
57865
58536
  optionsObj.context = 4;
@@ -57873,8 +58544,8 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
57873
58544
  } else {
57874
58545
  const { callback } = optionsObj;
57875
58546
  diffLines(oldStr, newStr, Object.assign(Object.assign({}, optionsObj), { callback: (diff8) => {
57876
- const patch13 = diffLinesResultToPatch(diff8);
57877
- callback(patch13);
58547
+ const patch15 = diffLinesResultToPatch(diff8);
58548
+ callback(patch15);
57878
58549
  } }));
57879
58550
  }
57880
58551
  function diffLinesResultToPatch(diff8) {
@@ -57959,68 +58630,68 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
57959
58630
  };
57960
58631
  }
57961
58632
  }
57962
- function formatPatch(patch13, headerOptions) {
58633
+ function formatPatch(patch15, headerOptions) {
57963
58634
  var _a, _b, _c, _d, _e, _f;
57964
58635
  if (!headerOptions) {
57965
58636
  headerOptions = INCLUDE_HEADERS;
57966
58637
  }
57967
- if (Array.isArray(patch13)) {
57968
- if (patch13.length > 1 && !headerOptions.includeFileHeaders && !patch13.every((p3) => p3.isGit)) {
58638
+ if (Array.isArray(patch15)) {
58639
+ if (patch15.length > 1 && !headerOptions.includeFileHeaders && !patch15.every((p3) => p3.isGit)) {
57969
58640
  throw new Error("Cannot omit file headers on a multi-file patch. " + "(The result would be unparseable; how would a tool trying to apply " + "the patch know which changes are to which file?)");
57970
58641
  }
57971
- return patch13.map((p3) => formatPatch(p3, headerOptions)).join(`
58642
+ return patch15.map((p3) => formatPatch(p3, headerOptions)).join(`
57972
58643
  `);
57973
58644
  }
57974
58645
  const ret = [];
57975
- if (patch13.isGit) {
58646
+ if (patch15.isGit) {
57976
58647
  headerOptions = INCLUDE_HEADERS;
57977
- if (!patch13.oldFileName) {
58648
+ if (!patch15.oldFileName) {
57978
58649
  throw new Error("oldFileName must be specified for Git patches");
57979
58650
  }
57980
- if (!patch13.newFileName) {
58651
+ if (!patch15.newFileName) {
57981
58652
  throw new Error("newFileName must be specified for Git patches");
57982
58653
  }
57983
- let gitOldName = patch13.oldFileName;
57984
- let gitNewName = patch13.newFileName;
57985
- if (patch13.isCreate && gitOldName === "/dev/null") {
58654
+ let gitOldName = patch15.oldFileName;
58655
+ let gitNewName = patch15.newFileName;
58656
+ if (patch15.isCreate && gitOldName === "/dev/null") {
57986
58657
  gitOldName = gitNewName.replace(/^b\//, "a/");
57987
- } else if (patch13.isDelete && gitNewName === "/dev/null") {
58658
+ } else if (patch15.isDelete && gitNewName === "/dev/null") {
57988
58659
  gitNewName = gitOldName.replace(/^a\//, "b/");
57989
58660
  }
57990
58661
  ret.push("diff --git " + quoteFileNameIfNeeded(gitOldName) + " " + quoteFileNameIfNeeded(gitNewName));
57991
- if (patch13.isDelete) {
57992
- ret.push("deleted file mode " + ((_a = patch13.oldMode) !== null && _a !== undefined ? _a : "100644"));
58662
+ if (patch15.isDelete) {
58663
+ ret.push("deleted file mode " + ((_a = patch15.oldMode) !== null && _a !== undefined ? _a : "100644"));
57993
58664
  }
57994
- if (patch13.isCreate) {
57995
- ret.push("new file mode " + ((_b = patch13.newMode) !== null && _b !== undefined ? _b : "100644"));
58665
+ if (patch15.isCreate) {
58666
+ ret.push("new file mode " + ((_b = patch15.newMode) !== null && _b !== undefined ? _b : "100644"));
57996
58667
  }
57997
- if (patch13.oldMode && patch13.newMode && !patch13.isDelete && !patch13.isCreate) {
57998
- ret.push("old mode " + patch13.oldMode);
57999
- ret.push("new mode " + patch13.newMode);
58668
+ if (patch15.oldMode && patch15.newMode && !patch15.isDelete && !patch15.isCreate) {
58669
+ ret.push("old mode " + patch15.oldMode);
58670
+ ret.push("new mode " + patch15.newMode);
58000
58671
  }
58001
- if (patch13.isRename) {
58002
- ret.push("rename from " + quoteFileNameIfNeeded(((_c = patch13.oldFileName) !== null && _c !== undefined ? _c : "").replace(/^a\//, "")));
58003
- ret.push("rename to " + quoteFileNameIfNeeded(((_d = patch13.newFileName) !== null && _d !== undefined ? _d : "").replace(/^b\//, "")));
58672
+ if (patch15.isRename) {
58673
+ ret.push("rename from " + quoteFileNameIfNeeded(((_c = patch15.oldFileName) !== null && _c !== undefined ? _c : "").replace(/^a\//, "")));
58674
+ ret.push("rename to " + quoteFileNameIfNeeded(((_d = patch15.newFileName) !== null && _d !== undefined ? _d : "").replace(/^b\//, "")));
58004
58675
  }
58005
- if (patch13.isCopy) {
58006
- ret.push("copy from " + quoteFileNameIfNeeded(((_e = patch13.oldFileName) !== null && _e !== undefined ? _e : "").replace(/^a\//, "")));
58007
- ret.push("copy to " + quoteFileNameIfNeeded(((_f = patch13.newFileName) !== null && _f !== undefined ? _f : "").replace(/^b\//, "")));
58676
+ if (patch15.isCopy) {
58677
+ ret.push("copy from " + quoteFileNameIfNeeded(((_e = patch15.oldFileName) !== null && _e !== undefined ? _e : "").replace(/^a\//, "")));
58678
+ ret.push("copy to " + quoteFileNameIfNeeded(((_f = patch15.newFileName) !== null && _f !== undefined ? _f : "").replace(/^b\//, "")));
58008
58679
  }
58009
58680
  } else {
58010
- if (headerOptions.includeIndex && patch13.oldFileName == patch13.newFileName && patch13.oldFileName !== undefined) {
58011
- ret.push("Index: " + patch13.oldFileName);
58681
+ if (headerOptions.includeIndex && patch15.oldFileName == patch15.newFileName && patch15.oldFileName !== undefined) {
58682
+ ret.push("Index: " + patch15.oldFileName);
58012
58683
  }
58013
58684
  if (headerOptions.includeUnderline) {
58014
58685
  ret.push("===================================================================");
58015
58686
  }
58016
58687
  }
58017
- const hasHunks = patch13.hunks.length > 0;
58018
- if (headerOptions.includeFileHeaders && patch13.oldFileName !== undefined && patch13.newFileName !== undefined && (!patch13.isGit || hasHunks)) {
58019
- ret.push("--- " + quoteFileNameIfNeeded(patch13.oldFileName) + (patch13.oldHeader ? "\t" + patch13.oldHeader : ""));
58020
- ret.push("+++ " + quoteFileNameIfNeeded(patch13.newFileName) + (patch13.newHeader ? "\t" + patch13.newHeader : ""));
58688
+ const hasHunks = patch15.hunks.length > 0;
58689
+ if (headerOptions.includeFileHeaders && patch15.oldFileName !== undefined && patch15.newFileName !== undefined && (!patch15.isGit || hasHunks)) {
58690
+ ret.push("--- " + quoteFileNameIfNeeded(patch15.oldFileName) + (patch15.oldHeader ? "\t" + patch15.oldHeader : ""));
58691
+ ret.push("+++ " + quoteFileNameIfNeeded(patch15.newFileName) + (patch15.newHeader ? "\t" + patch15.newHeader : ""));
58021
58692
  }
58022
- for (let i = 0;i < patch13.hunks.length; i++) {
58023
- const hunk = patch13.hunks[i];
58693
+ for (let i = 0;i < patch15.hunks.length; i++) {
58694
+ const hunk = patch15.hunks[i];
58024
58695
  const oldStart = hunk.oldLines === 0 ? hunk.oldStart - 1 : hunk.oldStart;
58025
58696
  const newStart = hunk.newLines === 0 ? hunk.newStart - 1 : hunk.newStart;
58026
58697
  ret.push("@@ -" + oldStart + "," + hunk.oldLines + " +" + newStart + "," + hunk.newLines + " @@");
@@ -58032,23 +58703,23 @@ function formatPatch(patch13, headerOptions) {
58032
58703
  `) + `
58033
58704
  `;
58034
58705
  }
58035
- function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options7) {
58036
- if (typeof options7 === "function") {
58037
- options7 = { callback: options7 };
58706
+ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options9) {
58707
+ if (typeof options9 === "function") {
58708
+ options9 = { callback: options9 };
58038
58709
  }
58039
- if (!(options7 === null || options7 === undefined ? undefined : options7.callback)) {
58040
- const patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options7);
58710
+ if (!(options9 === null || options9 === undefined ? undefined : options9.callback)) {
58711
+ const patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options9);
58041
58712
  if (!patchObj) {
58042
58713
  return;
58043
58714
  }
58044
- return formatPatch(patchObj, options7 === null || options7 === undefined ? undefined : options7.headerOptions);
58715
+ return formatPatch(patchObj, options9 === null || options9 === undefined ? undefined : options9.headerOptions);
58045
58716
  } else {
58046
- const { callback } = options7;
58047
- structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, Object.assign(Object.assign({}, options7), { callback: (patchObj) => {
58717
+ const { callback } = options9;
58718
+ structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, Object.assign(Object.assign({}, options9), { callback: (patchObj) => {
58048
58719
  if (!patchObj) {
58049
58720
  callback(undefined);
58050
58721
  } else {
58051
- callback(formatPatch(patchObj, options7.headerOptions));
58722
+ callback(formatPatch(patchObj, options9.headerOptions));
58052
58723
  }
58053
58724
  } }));
58054
58725
  }
@@ -58229,6 +58900,7 @@ var runUpdate = ({
58229
58900
  prompt: prompt4,
58230
58901
  check: check2 = false,
58231
58902
  write: write4 = false,
58903
+ yes = false,
58232
58904
  emitJson = false,
58233
58905
  ensureTools = true,
58234
58906
  baseline = bundledBaseline
@@ -58324,7 +58996,7 @@ var runUpdate = ({
58324
58996
  ].join(`
58325
58997
  `)));
58326
58998
  }
58327
- const shouldApply = write4 ? true : check2 || !hasManagedUpdates ? false : yesValues2.has((yield* prompt4.readLine(renderQuestion("Apply managed scaffold updates? [Y/n]: "))).trim().toLowerCase());
58999
+ const shouldApply = write4 || yes ? true : check2 || !hasManagedUpdates ? false : yesValues2.has((yield* prompt4.readLine(renderQuestion("Apply managed scaffold updates? [Y/n]: "))).trim().toLowerCase());
58328
59000
  let toolBootstrapStatuses = [];
58329
59001
  if (shouldApply && ensureTools) {
58330
59002
  const requiredTools = requiredToolsForSkills(selectedSkills3(finalPacks, baseline), baseline);
@@ -58386,7 +59058,7 @@ var runUpdate = ({
58386
59058
  }
58387
59059
  rmSync4(expectedDirectory, { recursive: true, force: true });
58388
59060
  if (result.applied) {
58389
- submitCliEvent("cli.scaffold.update.applied", {
59061
+ yield* submitCliEventEffect("cli.scaffold.update.applied", {
58390
59062
  cwd: rootDirectory,
58391
59063
  baseline: {
58392
59064
  version: baseline.summary.version
@@ -58400,6 +59072,7 @@ var runUpdate = ({
58400
59072
  var inputOption2 = exports_Options.optional(exports_Options.text("input").pipe(exports_Options.withAlias("i"), exports_Options.withDescription("Scaffolded repository root to update. Defaults to the current working directory.")));
58401
59073
  var checkOption = exports_Options.boolean("check").pipe(exports_Options.withDescription("Preview managed scaffold updates, write nothing, and exit nonzero when updates are available."));
58402
59074
  var writeOption = exports_Options.boolean("write").pipe(exports_Options.withDescription("Apply managed scaffold updates without asking for confirmation."));
59075
+ var yesOption2 = exports_Options.boolean("yes").pipe(exports_Options.withDescription("Apply managed scaffold updates without asking for confirmation."));
58403
59076
  var jsonOption3 = exports_Options.boolean("json").pipe(exports_Options.withDescription("Print the machine-readable update payload to stdout."));
58404
59077
  var baselineOption2 = exports_Options.optional(exports_Options.choice("baseline", ["stable", "bundled"]).pipe(exports_Options.withDescription("Scaffold baseline to use. Defaults to latest stable remote baseline with bundled fallback.")));
58405
59078
  var refreshBaselineOption2 = exports_Options.boolean("refresh-baseline").pipe(exports_Options.withDescription("Refetch the stable baseline instead of reusing the local cache."));
@@ -58407,10 +59080,11 @@ var updateCommand = exports_Command.make("update", {
58407
59080
  input: inputOption2,
58408
59081
  check: checkOption,
58409
59082
  write: writeOption,
59083
+ yes: yesOption2,
58410
59084
  json: jsonOption3,
58411
59085
  baseline: baselineOption2,
58412
59086
  refreshBaseline: refreshBaselineOption2
58413
- }, ({ input: input2, check: check2, write: write4, json: json2, baseline, refreshBaseline }) => exports_Effect.scoped(exports_Effect.gen(function* () {
59087
+ }, ({ input: input2, check: check2, write: write4, yes, json: json2, baseline, refreshBaseline }) => exports_Effect.scoped(exports_Effect.gen(function* () {
58414
59088
  const prompt4 = yield* PromptLive;
58415
59089
  const rootDirectory = path14.resolve(process.cwd(), getOrElse(input2, () => "."));
58416
59090
  const resolvedBaseline = yield* exports_Effect.promise(() => resolveBaseline(baselineResolveOptions(baseline, refreshBaseline, rootDirectory)));
@@ -58419,6 +59093,7 @@ var updateCommand = exports_Command.make("update", {
58419
59093
  prompt: prompt4,
58420
59094
  check: check2,
58421
59095
  write: write4,
59096
+ yes,
58422
59097
  emitJson: json2,
58423
59098
  baseline: resolvedBaseline
58424
59099
  });
@@ -58551,6 +59226,9 @@ var detectCliInstallPackageManager = ({
58551
59226
  if (normalizedEntrypoint.includes("/pnpm/") || normalizedEntrypoint.includes("\\pnpm\\") || normalizedEntrypoint.includes("/.pnpm/")) {
58552
59227
  return "pnpm";
58553
59228
  }
59229
+ if (normalizedEntrypoint.includes("/yarn/") || normalizedEntrypoint.includes("\\yarn\\") || normalizedEntrypoint.includes("/.yarn/")) {
59230
+ return "yarn";
59231
+ }
58554
59232
  if (normalizedEntrypoint.includes("/node_modules/@punks/cli/") || normalizedEntrypoint.includes("\\node_modules\\@punks\\cli\\")) {
58555
59233
  return "npm";
58556
59234
  }
@@ -58563,6 +59241,9 @@ var detectCliInstallPackageManager = ({
58563
59241
  if (userAgent?.startsWith("pnpm/") === true) {
58564
59242
  return "pnpm";
58565
59243
  }
59244
+ if (userAgent?.startsWith("yarn/") === true) {
59245
+ return "yarn";
59246
+ }
58566
59247
  if (userAgent?.startsWith("npm/") === true) {
58567
59248
  return "npm";
58568
59249
  }
@@ -58576,11 +59257,24 @@ var globalInstallCommandForPackageManager = ({
58576
59257
  const specifier = `${packageName}@${tag6}`;
58577
59258
  switch (packageManager) {
58578
59259
  case "bun":
58579
- return ["bun", "add", "-g", specifier];
59260
+ return ["bun", "add", "-g", specifier, "--minimum-release-age=0"];
58580
59261
  case "pnpm":
58581
59262
  return ["pnpm", "add", "-g", specifier];
58582
59263
  case "npm":
58583
- return ["npm", "install", "-g", specifier];
59264
+ return ["npm", "install", "-g", specifier, "--min-release-age=0"];
59265
+ case "yarn":
59266
+ return ["yarn", "global", "add", specifier];
59267
+ }
59268
+ };
59269
+ var minimumReleaseAgeEnvironmentForPackageManager = (packageManager) => {
59270
+ switch (packageManager) {
59271
+ case "pnpm":
59272
+ return { npm_config_minimum_release_age: "0" };
59273
+ case "yarn":
59274
+ return { YARN_NPM_MINIMAL_AGE_GATE: "0" };
59275
+ case "bun":
59276
+ case "npm":
59277
+ return {};
58584
59278
  }
58585
59279
  };
58586
59280
  var autoUpdateCliIfStale = async ({
@@ -58611,10 +59305,65 @@ var autoUpdateCliIfStale = async ({
58611
59305
  packageName,
58612
59306
  tag: tag6
58613
59307
  });
59308
+ const environment2 = minimumReleaseAgeEnvironmentForPackageManager(packageManager);
58614
59309
  return {
58615
59310
  status: "available",
58616
59311
  check: check2,
58617
59312
  packageManager,
59313
+ command,
59314
+ environment: environment2
59315
+ };
59316
+ };
59317
+ var upgradeCli = async ({
59318
+ currentVersion,
59319
+ packageName,
59320
+ tag: tag6 = "latest",
59321
+ timeoutMs = 5000,
59322
+ entrypoint,
59323
+ force = false
59324
+ }) => {
59325
+ const check2 = await checkSelfUpdate({ currentVersion, packageName, tag: tag6, timeoutMs });
59326
+ if (check2 === null) {
59327
+ return { status: "unavailable", check: check2 };
59328
+ }
59329
+ if (!check2.updateAvailable && !force) {
59330
+ return { status: "current", check: check2 };
59331
+ }
59332
+ const packageManager = detectCliInstallPackageManager(entrypoint === undefined ? {} : { entrypoint });
59333
+ if (packageManager === null) {
59334
+ return {
59335
+ status: "manager-not-detected",
59336
+ check: check2,
59337
+ packageManager,
59338
+ command: null
59339
+ };
59340
+ }
59341
+ const command = globalInstallCommandForPackageManager({
59342
+ packageManager,
59343
+ packageName,
59344
+ tag: tag6
59345
+ });
59346
+ const environment2 = minimumReleaseAgeEnvironmentForPackageManager(packageManager);
59347
+ const result = spawnSync(command[0], command.slice(1), {
59348
+ env: {
59349
+ ...process.env,
59350
+ ...environment2
59351
+ },
59352
+ stdio: "inherit"
59353
+ });
59354
+ if (result.status === 0) {
59355
+ return {
59356
+ status: "upgraded",
59357
+ check: check2,
59358
+ packageManager,
59359
+ command,
59360
+ environment: environment2
59361
+ };
59362
+ }
59363
+ return {
59364
+ status: "failed",
59365
+ check: check2,
59366
+ packageManager,
58618
59367
  command
58619
59368
  };
58620
59369
  };
@@ -58702,13 +59451,69 @@ var checkDpCliSkillPresence = () => {
58702
59451
  };
58703
59452
  };
58704
59453
 
59454
+ // src/cli/upgrade-command.ts
59455
+ var tagOption = exports_Options.text("tag").pipe(exports_Options.withDefault(process.env.DP_UPDATE_TAG ?? "latest"), exports_Options.withDescription("npm dist-tag to install, for example `latest`, `next`, or `beta`."));
59456
+ var forceOption = exports_Options.boolean("force").pipe(exports_Options.withDescription("Reinstall the selected dist-tag even when the current version is fresh."));
59457
+ var jsonOption4 = exports_Options.boolean("json").pipe(exports_Options.withDescription("Print JSON output."));
59458
+ var formatCommand = ({
59459
+ command,
59460
+ environment: environment2
59461
+ }) => {
59462
+ const envPrefix = environment2 === undefined ? [] : Object.entries(environment2).map(([key, value6]) => `${key}=${value6}`);
59463
+ return [...envPrefix, ...command].join(" ");
59464
+ };
59465
+ var upgradeCommand = exports_Command.make("upgrade", {
59466
+ tag: tagOption,
59467
+ force: forceOption,
59468
+ json: jsonOption4
59469
+ }, ({ tag: tag6, force, json: json2 }) => exports_Effect.tryPromise({
59470
+ try: async () => {
59471
+ const result = await upgradeCli({
59472
+ currentVersion: version,
59473
+ packageName: name,
59474
+ tag: tag6,
59475
+ force
59476
+ });
59477
+ if (json2) {
59478
+ console.log(renderJsonLabel());
59479
+ console.log(JSON.stringify(result, null, 2));
59480
+ return;
59481
+ }
59482
+ switch (result.status) {
59483
+ case "upgraded":
59484
+ console.log(renderCommandSection("CLI upgraded", [
59485
+ `${result.check.packageName} ${result.check.currentVersion} -> ${result.check.latestVersion}`,
59486
+ `Installer: ${result.packageManager}`,
59487
+ `Command: ${formatCommand(result)}`
59488
+ ].join(`
59489
+ `)));
59490
+ return;
59491
+ case "current":
59492
+ if (result.check === null) {
59493
+ throw new Error("Could not read the npm registry version for this CLI.");
59494
+ }
59495
+ console.log(renderCommandSection("CLI already current", `${result.check.packageName} ${result.check.currentVersion} matches ${result.check.latestVersion}.`));
59496
+ return;
59497
+ case "unavailable":
59498
+ throw new Error("Could not read the npm registry version for this CLI.");
59499
+ case "manager-not-detected":
59500
+ throw new Error("Could not detect how this CLI was installed. Reinstall manually with npm, pnpm, bun, or yarn.");
59501
+ case "available":
59502
+ throw new Error(`Upgrade command was not executed: ${formatCommand(result)}`);
59503
+ case "failed":
59504
+ throw new Error(result.command === null ? "CLI upgrade failed before an install command could be built." : `CLI upgrade failed while running: ${formatCommand({ command: result.command })}`);
59505
+ }
59506
+ },
59507
+ catch: (cause3) => cause3 instanceof Error ? cause3 : new Error("CLI upgrade failed.")
59508
+ })).pipe(exports_Command.withDescription("Upgrade this CLI through the package manager used for its global install."));
59509
+
58705
59510
  // src/index.ts
58706
59511
  var startupCheckWorkerEnv = "DP_STARTUP_CHECK_WORKER";
58707
59512
  var startupCheckCliEnv = "DP_STARTUP_CHECK_CLI";
58708
59513
  var startupCheckSkillEnv = "DP_STARTUP_CHECK_SKILL";
58709
59514
  var startupCheckIntervalMs = Number.parseInt(process.env.DP_STARTUP_CHECK_INTERVAL_MS ?? String(12 * 60 * 60 * 1000), 10);
58710
59515
  var startupCheckCacheFile = path15.join(homedir3(), ".cache", "punks", "startup-check.json");
58711
- var app = exports_Command.make("punks", {}, () => exports_Effect.sync(() => console.log(renderCommandGuide()))).pipe(exports_Command.withDescription("Harness Intelligence CLI. Agents: activate $dp-cli before acting on generated .devpunks output."), exports_Command.withSubcommands([reportCommand, scaffoldCommand, updateCommand]));
59516
+ var app = exports_Command.make("punks", {}, () => exports_Effect.sync(() => console.log(renderCommandGuide()))).pipe(exports_Command.withDescription("Harness Intelligence CLI. Agents: activate $dp-cli before acting on generated .devpunks output."), exports_Command.withSubcommands([reportCommand, scaffoldCommand, updateCommand, upgradeCommand]));
58712
59517
  var cli = exports_Command.run(app, {
58713
59518
  name: "punks",
58714
59519
  version