@punks/cli 2.1.1 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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) => {
@@ -51801,46 +52378,35 @@ class HarnessApi extends exports_HttpApi.make("harness").add(HealthApi).add(Base
51801
52378
  })) {
51802
52379
  }
51803
52380
  // ../../packages/contract/src/client.ts
51804
- var makeHarnessClient = ({ baseUrl: baseUrl2 }) => exports_HttpApiClient.make(HarnessApi, {
51805
- baseUrl: baseUrl2
52381
+ var makeHarnessClient = ({ baseUrl: baseUrl2, headers }) => exports_HttpApiClient.make(HarnessApi, {
52382
+ baseUrl: baseUrl2,
52383
+ transformClient: (client) => headers === undefined ? client : client.pipe(exports_HttpClient.mapRequest(exports_HttpClientRequest.setHeaders(headers)))
51806
52384
  }).pipe(exports_Effect.provide(exports_FetchHttpClient.layer));
51807
52385
  // src/control-plane/client.ts
51808
- var resolveStableBaselineMetadata = (options7) => exports_Effect.gen(function* () {
52386
+ var resolveStableBaselineMetadata = (options9) => exports_Effect.gen(function* () {
51809
52387
  const client2 = yield* makeHarnessClient({
51810
- baseUrl: options7.baseUrl
52388
+ baseUrl: options9.baseUrl
51811
52389
  });
51812
52390
  return yield* client2.baseline.resolve({
51813
52391
  path: { channel: "stable" }
51814
52392
  });
51815
52393
  });
51816
- var recordProductTelemetryEvent = (options7) => exports_Effect.gen(function* () {
52394
+ var recordProductTelemetryEvent = (options9) => exports_Effect.gen(function* () {
51817
52395
  const client2 = yield* makeHarnessClient({
51818
- baseUrl: options7.baseUrl
52396
+ baseUrl: options9.baseUrl
51819
52397
  });
51820
52398
  return yield* client2.telemetry.record({
51821
- payload: options7.event
51822
- });
51823
- });
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
52399
+ payload: options9.event
51830
52400
  });
51831
52401
  });
51832
52402
 
51833
- // src/telemetry/product.ts
51834
- import { randomUUID } from "crypto";
51835
- import { execFileSync } from "child_process";
51836
-
51837
52403
  // package.json
51838
52404
  var name = "@punks/cli";
51839
- var version = "2.1.1";
52405
+ var version = "2.1.2";
51840
52406
  // src/telemetry/product.ts
51841
52407
  var git = (cwd, args2) => {
51842
52408
  try {
51843
- return execFileSync("git", args2, {
52409
+ return execFileSync2("git", args2, {
51844
52410
  cwd,
51845
52411
  encoding: "utf8",
51846
52412
  stdio: ["ignore", "pipe", "ignore"]
@@ -51900,7 +52466,7 @@ var isLocalControlPlaneUrl = (value6) => {
51900
52466
  return value6.includes("localhost") || value6.includes(".localhost");
51901
52467
  }
51902
52468
  };
51903
- var telemetrySource = () => {
52469
+ var telemetrySource = (controlPlaneUrl = process.env.DP_CONTROL_PLANE_URL) => {
51904
52470
  if (process.env.CI !== undefined) {
51905
52471
  return "ci";
51906
52472
  }
@@ -51910,7 +52476,7 @@ var telemetrySource = () => {
51910
52476
  if (process.env.VITEST !== undefined) {
51911
52477
  return "test";
51912
52478
  }
51913
- if (isLocalControlPlaneUrl(process.env.DP_CONTROL_PLANE_URL)) {
52479
+ if (isLocalControlPlaneUrl(controlPlaneUrl)) {
51914
52480
  return "local-dev";
51915
52481
  }
51916
52482
  return "normal";
@@ -51918,19 +52484,21 @@ var telemetrySource = () => {
51918
52484
  var makeProductTelemetryEvent = ({
51919
52485
  name: name2,
51920
52486
  cwd,
51921
- baseline
52487
+ baseline,
52488
+ controlPlaneUrl
51922
52489
  }) => ({
51923
52490
  eventId: randomUUID(),
51924
52491
  name: name2,
51925
52492
  occurredAt: new Date().toISOString(),
51926
52493
  cliVersion: version,
51927
- source: telemetrySource(),
52494
+ source: telemetrySource(controlPlaneUrl),
51928
52495
  repository: observedRepository(cwd),
51929
52496
  ...baseline === undefined ? {} : { baseline }
51930
52497
  });
51931
- var submitProductTelemetryEffect = (event) => {
51932
- const baseUrl2 = process.env.DP_CONTROL_PLANE_URL;
51933
- if (baseUrl2 === undefined || baseUrl2.trim().length === 0) {
52498
+ var telemetryBaseUrl = (controlPlaneUrl) => resolveControlPlaneUrl(controlPlaneUrl);
52499
+ var submitProductTelemetryEffect = (event, options9 = {}) => {
52500
+ const baseUrl2 = telemetryBaseUrl(options9.controlPlaneUrl);
52501
+ if (baseUrl2 === undefined) {
51934
52502
  return exports_Effect.void;
51935
52503
  }
51936
52504
  return recordProductTelemetryEvent({
@@ -51938,20 +52506,14 @@ var submitProductTelemetryEffect = (event) => {
51938
52506
  event
51939
52507
  }).pipe(exports_Effect.asVoid, exports_Effect.catchAll(() => exports_Effect.void));
51940
52508
  };
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({
52509
+ var telemetryTransportEnabled = (controlPlaneUrl) => telemetryBaseUrl(controlPlaneUrl) !== undefined;
52510
+ var makeCliEvent = (name2, options9 = {}) => makeProductTelemetryEvent({
51946
52511
  name: name2,
51947
- cwd: options7.cwd ?? process.cwd(),
51948
- baseline: options7.baseline
52512
+ cwd: options9.cwd ?? process.cwd(),
52513
+ ...options9.baseline === undefined ? {} : { baseline: options9.baseline },
52514
+ ...options9.controlPlaneUrl === undefined ? {} : { controlPlaneUrl: options9.controlPlaneUrl }
51949
52515
  });
51950
- var submitCliEvent = (name2, options7 = {}) => {
51951
- if (telemetryTransportEnabled()) {
51952
- submitProductTelemetry(makeCliEvent(name2, options7));
51953
- }
51954
- };
52516
+ var submitCliEventEffect = (name2, options9 = {}) => telemetryTransportEnabled(options9.controlPlaneUrl) ? submitProductTelemetryEffect(makeCliEvent(name2, options9), options9.controlPlaneUrl === undefined ? {} : { controlPlaneUrl: options9.controlPlaneUrl }) : exports_Effect.void;
51955
52517
 
51956
52518
  // src/ui/brand.ts
51957
52519
  var reset2 = "\x1B[0m";
@@ -52098,6 +52660,8 @@ var renderCommandGuide = () => [
52098
52660
  " \u2514 show the scaffold lifecycle index and available setup commands",
52099
52661
  " \u203A punks update",
52100
52662
  " \u2514 refresh managed scaffold assets from `.devpunks/scaffold-manifest.json`",
52663
+ " \u203A punks upgrade",
52664
+ " \u2514 upgrade this CLI through the detected global package manager",
52101
52665
  "",
52102
52666
  "usage:",
52103
52667
  " \u2022 agents should activate `$dp-cli` before acting on `.devpunks` output",
@@ -52107,6 +52671,7 @@ var renderCommandGuide = () => [
52107
52671
  " \u2022 use `punks scaffold setup` for repo-aware pack detection after repo boilerplate is ready",
52108
52672
  " \u2022 use `punks update` after setup to pull newer scaffolded skills/prompts/manifests/hooks",
52109
52673
  " \u2022 use `punks report` when reusable Harness friction should enter the support loop",
52674
+ " \u2022 reports open GitHub issues; authenticate with `gh auth login` or `GITHUB_TOKEN`",
52110
52675
  "",
52111
52676
  "operator notes:",
52112
52677
  " \u2022 init copies only requirements/backlog skills and the initial wiki structure",
@@ -52145,7 +52710,7 @@ var renderSetupIntro = () => renderCommandIntro({
52145
52710
  "",
52146
52711
  "usage:",
52147
52712
  " \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",
52713
+ " \u2022 run this from the outer repo root so docs, wiki, and nested app/package workspaces stay in one scan",
52149
52714
  " \u2022 review detected manifests, technologies, and packs before confirming",
52150
52715
  " \u2022 reconcile generic scaffold output with the real repo layout before committing final guidance",
52151
52716
  " \u2022 if detection looks incomplete or suspicious, answer `n` and edit the pack selection before accepting",
@@ -52217,8 +52782,9 @@ var renderJsonLabel = () => paint(`${brandPalette.bold}${brandPalette.lilac}`, "
52217
52782
  var renderDivider = () => paint(`${brandPalette.dim}${brandPalette.border}`, "\u2500".repeat(sectionWidth));
52218
52783
 
52219
52784
  // 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."));
52785
+ var harnessReportsRepository = "wearedevpunks/harness-intelligence";
52786
+ var titleOption = exports_Options.text("title").pipe(exports_Options.withDescription("Short GitHub issue title for Harness maintainer triage."));
52787
+ var bodyOption = exports_Options.text("body").pipe(exports_Options.withDescription("Narrative report body with the observed friction."));
52222
52788
  var typeOption = exports_Options.choice("type", [
52223
52789
  "bug",
52224
52790
  "docs",
@@ -52227,16 +52793,24 @@ var typeOption = exports_Options.choice("type", [
52227
52793
  "other"
52228
52794
  ]).pipe(exports_Options.withDefault("other"), exports_Options.withDescription("Report type."));
52229
52795
  var severityOption = exports_Options.choice("severity", ["low", "medium", "high"]).pipe(exports_Options.withDefault("medium"), exports_Options.withDescription("Report severity."));
52796
+ var areaOption = exports_Options.choice("area", [
52797
+ "cli",
52798
+ "wiki",
52799
+ "skill",
52800
+ "docs",
52801
+ "workflow",
52802
+ "backoffice",
52803
+ "other"
52804
+ ]).pipe(exports_Options.withDefault("other"), exports_Options.withDescription("Harness area."));
52230
52805
  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.")));
52806
+ var repositoryOption = exports_Options.text("repository").pipe(exports_Options.withDefault(harnessReportsRepository), exports_Options.withDescription("GitHub repository that receives report issues."));
52807
+ 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`.")));
52808
+ var commandOption = exports_Options.optional(exports_Options.text("command").pipe(exports_Options.withDescription("Affected CLI command, for example `dp report` or `dp scaffold init`.")));
52809
+ var expectedOption = exports_Options.optional(exports_Options.text("expected").pipe(exports_Options.withDescription("Expected behavior.")));
52810
+ var actualOption = exports_Options.optional(exports_Options.text("actual").pipe(exports_Options.withDescription("Actual behavior.")));
52811
+ var stepsOption = exports_Options.optional(exports_Options.text("steps").pipe(exports_Options.withDescription("Reproduction steps or evidence summary.")));
52812
+ var labelsOption = exports_Options.optional(exports_Options.text("labels").pipe(exports_Options.withDescription("Comma-separated extra GitHub labels.")));
52232
52813
  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
52814
  var nonEmpty = (value6, field) => {
52241
52815
  const trimmed2 = value6.trim();
52242
52816
  if (trimmed2.length === 0) {
@@ -52244,13 +52818,15 @@ var nonEmpty = (value6, field) => {
52244
52818
  }
52245
52819
  return trimmed2;
52246
52820
  };
52821
+ var optionalValue = (value6) => isNone2(value6) || value6.value.trim().length === 0 ? undefined : value6.value.trim();
52822
+ var labelSlug = (value6) => value6.trim().toLowerCase().replace(/[^a-z0-9._-]+/gu, "-").replace(/^-+|-+$/gu, "");
52823
+ var csvLabels = (value6) => value6 === undefined ? [] : value6.split(",").map((label) => label.trim()).filter((label) => label.length > 0);
52247
52824
  var buildHarnessReport = ({
52248
52825
  title,
52249
52826
  body,
52250
52827
  type: type2,
52251
52828
  severity,
52252
- repoRoot,
52253
- githubUrl
52829
+ repoRoot
52254
52830
  }) => ({
52255
52831
  title: nonEmpty(title, "title"),
52256
52832
  body: nonEmpty(body, "body"),
@@ -52258,53 +52834,172 @@ var buildHarnessReport = ({
52258
52834
  severity,
52259
52835
  createdAt: new Date().toISOString(),
52260
52836
  cliVersion: version,
52261
- repository: observedRepository(repoRoot),
52262
- ...githubUrl === undefined || githubUrl.trim().length === 0 ? {} : { githubUrl: githubUrl.trim() }
52837
+ repository: observedRepository(repoRoot)
52263
52838
  });
52839
+ var buildHarnessReportLabels = ({
52840
+ type: type2,
52841
+ severity,
52842
+ area,
52843
+ skillPack,
52844
+ command,
52845
+ extraLabels
52846
+ }) => {
52847
+ const labels = [
52848
+ "harness-report",
52849
+ `type:${type2}`,
52850
+ `severity:${severity}`,
52851
+ `area:${area}`,
52852
+ area === "wiki" || area === "docs" ? "surface:wiki" : undefined,
52853
+ area === "cli" ? "surface:cli" : undefined,
52854
+ skillPack === undefined ? undefined : `pack:${labelSlug(skillPack)}`,
52855
+ command === undefined ? undefined : `command:${labelSlug(command)}`,
52856
+ ...csvLabels(extraLabels)
52857
+ ].filter((label) => label !== undefined && label.length > 0);
52858
+ return [...new Set(labels)];
52859
+ };
52860
+ var buildHarnessReportIssueBody = ({
52861
+ report,
52862
+ area,
52863
+ skillPack,
52864
+ command,
52865
+ expected,
52866
+ actual,
52867
+ steps
52868
+ }) => {
52869
+ const metadata = {
52870
+ schema: "harness-report.v1",
52871
+ type: report.type,
52872
+ severity: report.severity,
52873
+ area,
52874
+ skillPack,
52875
+ command,
52876
+ createdAt: report.createdAt,
52877
+ cliVersion: report.cliVersion,
52878
+ repository: report.repository
52879
+ };
52880
+ const optionalSections = [
52881
+ expected === undefined ? undefined : `## Expected
52882
+
52883
+ ${expected}`,
52884
+ actual === undefined ? undefined : `## Actual
52885
+
52886
+ ${actual}`,
52887
+ steps === undefined ? undefined : `## Evidence / Steps
52888
+
52889
+ ${steps}`
52890
+ ].filter((section) => section !== undefined);
52891
+ return [
52892
+ "<!-- harness-report",
52893
+ JSON.stringify(metadata, null, 2),
52894
+ "-->",
52895
+ `## Summary
52896
+
52897
+ ${report.body}`,
52898
+ ...optionalSections,
52899
+ "## Classification",
52900
+ [
52901
+ `- Type: ${report.type}`,
52902
+ `- Severity: ${report.severity}`,
52903
+ `- Area: ${area}`,
52904
+ skillPack === undefined ? undefined : `- Skill pack: ${skillPack}`,
52905
+ command === undefined ? undefined : `- Command: ${command}`,
52906
+ `- CLI version: ${report.cliVersion}`
52907
+ ].filter((line4) => line4 !== undefined).join(`
52908
+ `),
52909
+ "## Observed Repository",
52910
+ [
52911
+ `- Remote: ${report.repository?.remoteUrl ?? "unknown"}`,
52912
+ `- Host: ${report.repository?.remoteHost ?? "unknown"}`,
52913
+ `- Path: ${report.repository?.remotePath ?? "unknown"}`,
52914
+ `- Commit: ${report.repository?.commitSha ?? "unknown"}`,
52915
+ `- Dirty: ${report.repository?.dirty === undefined ? "unknown" : String(report.repository.dirty)}`
52916
+ ].join(`
52917
+ `)
52918
+ ].join(`
52919
+
52920
+ `);
52921
+ };
52264
52922
  var reportCommand = exports_Command.make("report", {
52265
52923
  title: titleOption,
52266
52924
  body: bodyOption,
52267
52925
  type: typeOption,
52268
52926
  severity: severityOption,
52927
+ area: areaOption,
52269
52928
  repoRoot: repoRootOption,
52270
- githubUrl: githubUrlOption,
52929
+ repository: repositoryOption,
52930
+ skillPack: skillPackOption,
52931
+ command: commandOption,
52932
+ expected: expectedOption,
52933
+ actual: actualOption,
52934
+ steps: stepsOption,
52935
+ labels: labelsOption,
52271
52936
  json: jsonOption
52272
- }, ({ title, body, type: type2, severity, repoRoot, githubUrl, json: json2 }) => exports_Effect.tryPromise({
52937
+ }, ({
52938
+ title,
52939
+ body,
52940
+ type: type2,
52941
+ severity,
52942
+ area,
52943
+ repoRoot,
52944
+ repository,
52945
+ skillPack,
52946
+ command,
52947
+ expected,
52948
+ actual,
52949
+ steps,
52950
+ labels,
52951
+ json: json2
52952
+ }) => exports_Effect.tryPromise({
52273
52953
  try: async () => {
52274
- const report = buildHarnessReport({
52275
- title,
52276
- body,
52954
+ const report = buildHarnessReport({ title, body, type: type2, severity, repoRoot });
52955
+ const skillPackValue = optionalValue(skillPack);
52956
+ const commandValue = optionalValue(command);
52957
+ const expectedValue = optionalValue(expected);
52958
+ const actualValue = optionalValue(actual);
52959
+ const stepsValue = optionalValue(steps);
52960
+ const extraLabels = optionalValue(labels);
52961
+ const issueLabels = buildHarnessReportLabels({
52277
52962
  type: type2,
52278
52963
  severity,
52279
- repoRoot,
52280
- ...isNone2(githubUrl) ? {} : { githubUrl: githubUrl.value }
52964
+ area,
52965
+ ...skillPackValue === undefined ? {} : { skillPack: skillPackValue },
52966
+ ...commandValue === undefined ? {} : { command: commandValue },
52967
+ ...extraLabels === undefined ? {} : { extraLabels }
52968
+ });
52969
+ const issue = await createGitHubIssue({
52970
+ repository,
52971
+ title: report.title,
52972
+ body: buildHarnessReportIssueBody({
52973
+ report,
52974
+ area,
52975
+ ...skillPackValue === undefined ? {} : { skillPack: skillPackValue },
52976
+ ...commandValue === undefined ? {} : { command: commandValue },
52977
+ ...expectedValue === undefined ? {} : { expected: expectedValue },
52978
+ ...actualValue === undefined ? {} : { actual: actualValue },
52979
+ ...stepsValue === undefined ? {} : { steps: stepsValue }
52980
+ }),
52981
+ labels: issueLabels
52281
52982
  });
52282
- const response = await exports_Effect.runPromise(submitHarnessReport({
52283
- baseUrl: requiredControlPlaneUrl(),
52284
- report
52983
+ await exports_Effect.runPromise(submitCliEventEffect("cli.harness.report.submitted", {
52984
+ cwd: repoRoot
52285
52985
  }));
52286
- submitCliEvent("cli.harness.report.submitted", { cwd: repoRoot });
52287
52986
  if (json2) {
52288
52987
  console.log(renderJsonLabel());
52289
- console.log(JSON.stringify(response, null, 2));
52988
+ console.log(JSON.stringify({ issue, labels: issueLabels }, null, 2));
52290
52989
  return;
52291
52990
  }
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(`
52991
+ console.log(renderCommandSection("Harness report issue created", [`Issue: ${issue.htmlUrl}`, `Repository: ${repository}`].join(`
52297
52992
  `)));
52298
52993
  },
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."));
52994
+ catch: (cause3) => cause3 instanceof Error ? cause3 : new Error("Harness report issue creation failed.")
52995
+ })).pipe(exports_Command.withDescription("Create a GitHub issue in the Harness Intelligence repository for maintainer triage."));
52301
52996
 
52302
52997
  // src/cli/scaffold-command.ts
52303
52998
  import path12 from "path";
52304
52999
 
52305
53000
  // src/baseline/resolve.ts
52306
53001
  import { createHash } from "crypto";
52307
- import { execFileSync as execFileSync2 } from "child_process";
53002
+ import { execFileSync as execFileSync3 } from "child_process";
52308
53003
  import { existsSync as existsSync2, mkdirSync, mkdtempSync, readFileSync as readFileSync3, rmSync, writeFileSync } from "fs";
52309
53004
  import { tmpdir as tmpdir2 } from "os";
52310
53005
  import path5 from "path";
@@ -52312,66 +53007,6 @@ import path5 from "path";
52312
53007
  // src/baseline/bundled.ts
52313
53008
  import path3 from "path";
52314
53009
 
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
53010
  // src/data/catalog/hooks.ts
52376
53011
  var hookCatalog = [
52377
53012
  {
@@ -53448,7 +54083,7 @@ var download = async (url2, targetPath, timeoutMs) => {
53448
54083
  }
53449
54084
  };
53450
54085
  var extractSafeTgz = (archivePath, targetDirectory) => {
53451
- const listing = execFileSync2("tar", ["-tzf", archivePath], {
54086
+ const listing = execFileSync3("tar", ["-tzf", archivePath], {
53452
54087
  encoding: "utf8"
53453
54088
  }).split(/\r?\n/u).filter((line4) => line4.length > 0);
53454
54089
  const unsafe = listing.find((entry) => !isSafeTarPath(entry));
@@ -53456,7 +54091,7 @@ var extractSafeTgz = (archivePath, targetDirectory) => {
53456
54091
  throw new Error(`Unsafe baseline archive path: ${unsafe}`);
53457
54092
  }
53458
54093
  mkdirSync(targetDirectory, { recursive: true });
53459
- execFileSync2("tar", ["-xzf", archivePath, "-C", targetDirectory], {
54094
+ execFileSync3("tar", ["-xzf", archivePath, "-C", targetDirectory], {
53460
54095
  stdio: "ignore"
53461
54096
  });
53462
54097
  };
@@ -53467,14 +54102,14 @@ var resolveLocalBaseline = (url2) => {
53467
54102
  const filePath = new URL(url2);
53468
54103
  return loadBaselineFromDirectory(filePath.pathname, "local");
53469
54104
  };
53470
- var submitArtifactPullTelemetry = (baseline, cwd) => {
53471
- submitCliEvent("cli.artifact.pull.completed", {
54105
+ var submitArtifactPullTelemetry = async (baseline, cwd) => {
54106
+ await exports_Effect.runPromise(submitCliEventEffect("cli.artifact.pull.completed", {
53472
54107
  ...cwd === undefined ? {} : { cwd },
53473
54108
  baseline: {
53474
54109
  channel: baseline.summary.channel,
53475
54110
  version: baseline.summary.version
53476
54111
  }
53477
- });
54112
+ }));
53478
54113
  };
53479
54114
  var materializeControlPlaneBaseline = async (resolution, refresh, timeoutMs) => {
53480
54115
  const targetDirectory = path5.join(cacheRoot(), "control-plane", resolution.version);
@@ -53514,7 +54149,7 @@ var resolveControlPlaneStableBaseline = async ({
53514
54149
  timeoutMs,
53515
54150
  cwd
53516
54151
  }) => {
53517
- const baseUrl2 = process.env.DP_CONTROL_PLANE_URL;
54152
+ const baseUrl2 = resolveControlPlaneUrl();
53518
54153
  if (baseUrl2 === undefined || baseUrl2.length === 0) {
53519
54154
  return null;
53520
54155
  }
@@ -53530,7 +54165,7 @@ var resolveControlPlaneStableBaseline = async ({
53530
54165
  ]);
53531
54166
  const materialized = await materializeControlPlaneBaseline(resolution, refresh, timeoutMs);
53532
54167
  if (materialized.artifactPulled) {
53533
- submitArtifactPullTelemetry(materialized.baseline, cwd);
54168
+ await submitArtifactPullTelemetry(materialized.baseline, cwd);
53534
54169
  }
53535
54170
  return materialized.baseline;
53536
54171
  } catch {
@@ -53591,20 +54226,20 @@ var resolveRemoteStableBaseline = async ({
53591
54226
  writeFileSync(extractedMetadataPath, JSON.stringify({ ...extractedMetadata, sha256: archiveSha256 }, null, 2), "utf8");
53592
54227
  rmSync(tempDirectory, { recursive: true, force: true });
53593
54228
  const baseline = loadBaselineFromDirectory(targetDirectory, "remote");
53594
- submitArtifactPullTelemetry(baseline, cwd);
54229
+ await submitArtifactPullTelemetry(baseline, cwd);
53595
54230
  return baseline;
53596
54231
  };
53597
- var resolveBaseline = async (options7 = {}) => {
53598
- const requested = process.env.DP_BASELINE === "bundled" ? "bundled" : options7.baseline ?? "stable";
54232
+ var resolveBaseline = async (options9 = {}) => {
54233
+ const requested = process.env.DP_BASELINE === "bundled" ? "bundled" : options9.baseline ?? "stable";
53599
54234
  if (requested === "bundled") {
53600
54235
  return bundledBaseline;
53601
54236
  }
53602
54237
  try {
53603
54238
  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 }
54239
+ refresh: options9.refresh ?? process.env.DP_BASELINE_REFRESH === "1",
54240
+ timeoutMs: options9.timeoutMs ?? 1500,
54241
+ releasesUrl: options9.releasesUrl ?? repoReleasesUrl,
54242
+ ...options9.cwd === undefined ? {} : { cwd: options9.cwd }
53608
54243
  });
53609
54244
  } catch {
53610
54245
  return bundledBaseline;
@@ -53692,13 +54327,13 @@ var renderError5 = (state) => match2(state.error, {
53692
54327
  var renderChoiceDescription3 = (choice4, isHighlighted) => choice4.description && isHighlighted ? char3("-").pipe(cat2(space2), cat2(text3(choice4.description)), annotate2(blackBright2)) : empty38;
53693
54328
  var metaOptionsCount2 = 1;
53694
54329
  var withStem = (prefix) => prefix.pipe(cat2(space2), cat2(space2));
53695
- var renderChoices3 = (state, options7) => {
53696
- const allSelected = state.selectedIndices.size === options7.choices.length;
54330
+ var renderChoices3 = (state, options9) => {
54331
+ const allSelected = state.selectedIndices.size === options9.choices.length;
53697
54332
  const metaOptions = [
53698
- { title: allSelected ? "Clear all selected packs" : options7.selectAll }
54333
+ { title: allSelected ? "Clear all selected packs" : options9.selectAll }
53699
54334
  ];
53700
- const allChoices = [...metaOptions, ...options7.choices];
53701
- const toDisplay = entriesToDisplay2(state.index, allChoices.length, options7.maxPerPage);
54335
+ const allChoices = [...metaOptions, ...options9.choices];
54336
+ const toDisplay = entriesToDisplay2(state.index, allChoices.length, options9.maxPerPage);
53702
54337
  const documents = [];
53703
54338
  for (let index = toDisplay.startIndex;index < toDisplay.endIndex; index++) {
53704
54339
  const choice4 = allChoices[index];
@@ -53726,34 +54361,34 @@ var renderChoices3 = (state, options7) => {
53726
54361
  }
53727
54362
  return vsep2(documents);
53728
54363
  };
53729
- var renderNextFrame9 = (state, options7) => exports_Effect.gen(function* () {
54364
+ var renderNextFrame9 = (state, options9) => exports_Effect.gen(function* () {
53730
54365
  const terminal = yield* Terminal;
53731
54366
  const columns = yield* terminal.columns;
53732
- const promptMessage = renderOutput8(options7.message);
53733
- const choices = renderChoices3(state, options7);
54367
+ const promptMessage = renderOutput8(options9.message);
54368
+ const choices = renderChoices3(state, options9);
53734
54369
  const error4 = renderError5(state);
53735
54370
  return cursorHide3.pipe(cat2(promptMessage), cat2(hardLine2), cat2(choices), cat2(error4), render3({ style: "pretty", options: { lineWidth: columns } }));
53736
54371
  });
53737
- var renderSubmission9 = (state, options7) => exports_Effect.gen(function* () {
54372
+ var renderSubmission9 = (state, options9) => exports_Effect.gen(function* () {
53738
54373
  const terminal = yield* Terminal;
53739
54374
  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 } }));
54375
+ const selectedChoices = Array.from(state.selectedIndices).sort(Order2).map((index) => options9.choices[index].title).join(", ");
54376
+ 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
54377
  });
53743
- var clearPrompt = (options7) => exports_Effect.gen(function* () {
54378
+ var clearPrompt = (options9) => exports_Effect.gen(function* () {
53744
54379
  const terminal = yield* Terminal;
53745
54380
  const columns = yield* terminal.columns;
53746
54381
  const text12 = `
53747
- `.repeat(Math.min(options7.choices.length + 1, options7.maxPerPage)) + options7.message;
54382
+ `.repeat(Math.min(options9.choices.length + 1, options9.maxPerPage)) + options9.message;
53748
54383
  return eraseText2(text12, columns).pipe(cat2(eraseLine3), cat2(cursorLeft3), optimize3(Deep), render3({ style: "pretty", options: { lineWidth: columns } }));
53749
54384
  });
53750
- var processSpace2 = (state, options7) => {
54385
+ var processSpace2 = (state, options9) => {
53751
54386
  const selectedIndices = new Set(state.selectedIndices);
53752
54387
  if (state.index === 0) {
53753
- if (selectedIndices.size === options7.choices.length) {
54388
+ if (selectedIndices.size === options9.choices.length) {
53754
54389
  selectedIndices.clear();
53755
54390
  } else {
53756
- for (let index = 0;index < options7.choices.length; index++) {
54391
+ for (let index = 0;index < options9.choices.length; index++) {
53757
54392
  selectedIndices.add(index);
53758
54393
  }
53759
54394
  }
@@ -53767,11 +54402,11 @@ var processSpace2 = (state, options7) => {
53767
54402
  }
53768
54403
  return exports_Effect.succeed(Action2.NextFrame({ state: { ...state, selectedIndices, error: none2() } }));
53769
54404
  };
53770
- var localMultiSelect = (options7) => {
54405
+ var localMultiSelect = (options9) => {
53771
54406
  const resolvedOptions = {
53772
54407
  maxPerPage: 10,
53773
54408
  selectAll: "Select all packs on this step",
53774
- ...options7
54409
+ ...options9
53775
54410
  };
53776
54411
  const prompt4 = exports_Prompt.custom({
53777
54412
  index: 0,
@@ -53848,7 +54483,7 @@ var PromptLive = exports_Effect.acquireRelease(exports_Effect.sync(() => createI
53848
54483
  })));
53849
54484
 
53850
54485
  // src/scaffold/run.ts
53851
- import { execFileSync as execFileSync5 } from "child_process";
54486
+ import { execFileSync as execFileSync6 } from "child_process";
53852
54487
  import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
53853
54488
  import { homedir as homedir2 } from "os";
53854
54489
  import path10 from "path";
@@ -54380,29 +55015,29 @@ var formatAgentHandoffSummary = (result) => [
54380
55015
  " 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
55016
  ].join(`
54382
55017
  `);
54383
- var formatSelectionPreview = (options7) => [
55018
+ var formatSelectionPreview = (options9) => [
54384
55019
  "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}`
55020
+ ...section("prefilled packs:", formatPackList(options9.preselectedPacks, options9.baseline)),
55021
+ ...maybeSection("added packs:", formatPackList(options9.addedPacks, options9.baseline)),
55022
+ ...maybeSection("removed packs:", formatPackList(options9.removedPacks, options9.baseline)),
55023
+ ...section("final packs:", formatCompactPackList(options9.finalPacks)),
55024
+ `output directory: ${options9.outputDirectory}`
54390
55025
  ].join(`
54391
55026
  `);
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)),
55027
+ var formatResolvedPackSummary = (options9) => options9.optionalPacks.length === 0 ? [
55028
+ ...section("default packs:", formatPackList(options9.defaultPacks, options9.baseline)),
55029
+ ...section("language packs:", formatPackList(options9.languagePacks, options9.baseline)),
55030
+ ...section("detected packs:", formatPackList(options9.detectedPacks, options9.baseline)),
55031
+ ...section("surface packs:", formatPackList(options9.surfacePacks, options9.baseline)),
54397
55032
  "additional packs available:",
54398
55033
  " all known packs are already included in the prefilled selection."
54399
55034
  ].join(`
54400
55035
  `) : [
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))
55036
+ ...section("default packs:", formatPackList(options9.defaultPacks, options9.baseline)),
55037
+ ...section("language packs:", formatPackList(options9.languagePacks, options9.baseline)),
55038
+ ...section("detected packs:", formatPackList(options9.detectedPacks, options9.baseline)),
55039
+ ...section("surface packs:", formatPackList(options9.surfacePacks, options9.baseline)),
55040
+ ...section("additional packs available:", formatPackList(options9.optionalPacks, options9.baseline))
54406
55041
  ].join(`
54407
55042
  `);
54408
55043
 
@@ -54488,7 +55123,7 @@ var finalizePackSelection = (resolved, additions, removals) => {
54488
55123
  var canRemovePack = (resolved, packId) => resolved.preselectedPacks.includes(packId) && !resolved.defaultPacks.includes(packId);
54489
55124
 
54490
55125
  // src/core/tools.ts
54491
- import { execFileSync as execFileSync3 } from "child_process";
55126
+ import { execFileSync as execFileSync4 } from "child_process";
54492
55127
  import { accessSync, constants as constants2 } from "fs";
54493
55128
  import { homedir } from "os";
54494
55129
  import path8 from "path";
@@ -54516,10 +55151,10 @@ var commandExistsOnPath = (command, env2 = process.env, platform = process.platf
54516
55151
  var defaultRuntime3 = {
54517
55152
  cwd: homedir(),
54518
55153
  commandExists: commandExistsOnPath,
54519
- execFile: (command, args2, options7) => {
54520
- execFileSync3(command, [...args2], {
54521
- cwd: options7?.cwd,
54522
- stdio: options7?.stdio ?? "inherit"
55154
+ execFile: (command, args2, options9) => {
55155
+ execFileSync4(command, [...args2], {
55156
+ cwd: options9?.cwd,
55157
+ stdio: options9?.stdio ?? "inherit"
54523
55158
  });
54524
55159
  }
54525
55160
  };
@@ -54589,7 +55224,7 @@ var ensureToolsInstalled = (toolIds, baseline = bundledBaseline, runtime5 = defa
54589
55224
  };
54590
55225
 
54591
55226
  // src/scaffold/output.ts
54592
- import { execFileSync as execFileSync4 } from "child_process";
55227
+ import { execFileSync as execFileSync5 } from "child_process";
54593
55228
  import { createHash as createHash2 } from "crypto";
54594
55229
  import {
54595
55230
  cpSync,
@@ -55731,7 +56366,7 @@ var writeScaffoldOutput = ({
55731
56366
  }));
55732
56367
  hookFiles.push(hook.outputPath);
55733
56368
  }
55734
- execFileSync4(process.execPath, [path9.join(outputDirectory, syncScriptFile)], {
56369
+ execFileSync5(process.execPath, [path9.join(outputDirectory, syncScriptFile)], {
55735
56370
  cwd: outputDirectory,
55736
56371
  stdio: "ignore"
55737
56372
  });
@@ -55866,7 +56501,7 @@ var tryClipboardCommand = ({
55866
56501
  return { ok: false };
55867
56502
  }
55868
56503
  try {
55869
- execFileSync5(command, args2, {
56504
+ execFileSync6(command, args2, {
55870
56505
  cwd: clipboardWorkingDirectory,
55871
56506
  input: text12,
55872
56507
  stdio: ["pipe", "ignore", "ignore"]
@@ -55892,16 +56527,16 @@ var copyToClipboard = (text12) => {
55892
56527
  var selectedSkills2 = (finalPacks, baseline) => [
55893
56528
  ...new Set(finalPacks.flatMap((packId) => skillsForPack(packId, baseline)))
55894
56529
  ].toSorted();
55895
- var promptForPackMultiSelect = (prompt4, options7) => exports_Effect.gen(function* () {
56530
+ var promptForPackMultiSelect = (prompt4, options9) => exports_Effect.gen(function* () {
55896
56531
  yield* prompt4.writeLine("");
55897
- yield* prompt4.writeLine(renderCommandSection(options7.title, [options7.intro, "", `available packs: ${options7.allowed.length}`].join(`
56532
+ yield* prompt4.writeLine(renderCommandSection(options9.title, [options9.intro, "", `available packs: ${options9.allowed.length}`].join(`
55898
56533
  `)));
55899
56534
  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];
56535
+ message: options9.message,
56536
+ ...options9.selectAll ? { selectAll: options9.selectAll } : {},
56537
+ ...options9.selectNone ? { selectNone: options9.selectNone } : {},
56538
+ choices: options9.allowed.map((packId) => {
56539
+ const description = options9.descriptions?.[packId];
55905
56540
  return description ? {
55906
56541
  title: packId,
55907
56542
  value: packId,
@@ -56134,7 +56769,7 @@ var runScaffold = ({
56134
56769
  yield* prompt4.writeLine(renderJsonLabel());
56135
56770
  yield* prompt4.writeLine(encodePrettyJson(result));
56136
56771
  }
56137
- submitCliEvent("cli.scaffold.setup.completed", {
56772
+ yield* submitCliEventEffect("cli.scaffold.setup.completed", {
56138
56773
  cwd: scanDirectory,
56139
56774
  baseline: {
56140
56775
  version: baseline.summary.version
@@ -56909,7 +57544,7 @@ Required skills:
56909
57544
  - \`write-backlog\`
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
@@ -56964,11 +57599,12 @@ var writeMissingFile = ({
56964
57599
  };
56965
57600
  var scaffoldWiki = ({
56966
57601
  outputDirectory,
56967
- wikiRoot
57602
+ wikiRoot,
57603
+ targetRoot
56968
57604
  }) => {
56969
57605
  const template = makeWikiScaffoldTemplate(wikiRoot);
56970
57606
  const createdFiles = [];
56971
- const wikiDirectory = path11.join(outputDirectory, wikiRoot);
57607
+ const wikiDirectory = path11.join(outputDirectory, targetRoot);
56972
57608
  for (const directory3 of template.topLevelDirectories) {
56973
57609
  mkdirSync4(path11.join(wikiDirectory, directory3), { recursive: true });
56974
57610
  }
@@ -57036,6 +57672,26 @@ var scaffoldWiki = ({
57036
57672
  }
57037
57673
  return createdFiles.toSorted();
57038
57674
  };
57675
+ var isWikiOutputDirectory = (outputDirectory) => {
57676
+ const normalized = path11.resolve(outputDirectory);
57677
+ return path11.basename(normalized) === "wiki";
57678
+ };
57679
+ var stageWikiTarget = ({
57680
+ outputDirectory,
57681
+ monorepo
57682
+ }) => {
57683
+ if (isWikiOutputDirectory(outputDirectory)) {
57684
+ const parent = path11.basename(path11.dirname(path11.resolve(outputDirectory)));
57685
+ return {
57686
+ wikiRoot: parent === "apps" ? "apps/wiki" : "wiki",
57687
+ targetRoot: "."
57688
+ };
57689
+ }
57690
+ return {
57691
+ wikiRoot: monorepo ? "apps/wiki" : "wiki",
57692
+ targetRoot: monorepo ? "apps/wiki" : "wiki"
57693
+ };
57694
+ };
57039
57695
  var runStageScaffold = ({
57040
57696
  commandId,
57041
57697
  outputDirectory,
@@ -57044,7 +57700,10 @@ var runStageScaffold = ({
57044
57700
  }) => exports_Effect.gen(function* () {
57045
57701
  const stage = stageScaffoldById[commandId];
57046
57702
  const detection = yield* detectRepository(outputDirectory).pipe(exports_Effect.catchAll(() => exports_Effect.succeed(null)));
57047
- const wikiRoot = detection?.monorepo === true ? "apps/wiki" : "wiki";
57703
+ const wikiTarget = stageWikiTarget({
57704
+ outputDirectory,
57705
+ monorepo: detection?.monorepo === true
57706
+ });
57048
57707
  const skillFiles = stage.skills.map((skillId) => copySkillDirectory({
57049
57708
  outputDirectory,
57050
57709
  skillId,
@@ -57052,9 +57711,10 @@ var runStageScaffold = ({
57052
57711
  }));
57053
57712
  const wikiFiles = scaffoldWiki({
57054
57713
  outputDirectory,
57055
- wikiRoot
57714
+ wikiRoot: wikiTarget.wikiRoot,
57715
+ targetRoot: wikiTarget.targetRoot
57056
57716
  });
57057
- const operatorPrompt = stage.renderPrompt({ wikiRoot });
57717
+ const operatorPrompt = stage.renderPrompt({ wikiRoot: wikiTarget.wikiRoot });
57058
57718
  yield* prompt4.writeLine(renderScaffoldTitle());
57059
57719
  yield* prompt4.writeLine("");
57060
57720
  yield* prompt4.writeLine(renderStageIntro({
@@ -57074,6 +57734,12 @@ var runStageScaffold = ({
57074
57734
  yield* prompt4.writeLine(renderNotes([`Output directory: ${outputDirectory}`, "Hidden output directories: .agents"]));
57075
57735
  yield* prompt4.writeLine("");
57076
57736
  yield* prompt4.writeLine(renderCommandSection("Operator prompt", operatorPrompt));
57737
+ yield* submitCliEventEffect("cli.scaffold.init.completed", {
57738
+ cwd: outputDirectory,
57739
+ baseline: {
57740
+ version: baseline.summary.version
57741
+ }
57742
+ });
57077
57743
  return {
57078
57744
  outputDirectory,
57079
57745
  skillFiles,
@@ -57160,24 +57826,24 @@ import path13 from "path";
57160
57826
 
57161
57827
  // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/base.js
57162
57828
  class Diff {
57163
- diff(oldStr, newStr, options7 = {}) {
57829
+ diff(oldStr, newStr, options9 = {}) {
57164
57830
  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) {
57831
+ if (typeof options9 === "function") {
57832
+ callback = options9;
57833
+ options9 = {};
57834
+ } else if ("callback" in options9) {
57835
+ callback = options9.callback;
57836
+ }
57837
+ const oldString = this.castInput(oldStr, options9);
57838
+ const newString = this.castInput(newStr, options9);
57839
+ const oldTokens = this.removeEmpty(this.tokenize(oldString, options9));
57840
+ const newTokens = this.removeEmpty(this.tokenize(newString, options9));
57841
+ return this.diffWithOptionsObj(oldTokens, newTokens, options9, callback);
57842
+ }
57843
+ diffWithOptionsObj(oldTokens, newTokens, options9, callback) {
57178
57844
  var _a;
57179
57845
  const done9 = (value6) => {
57180
- value6 = this.postProcess(value6, options7);
57846
+ value6 = this.postProcess(value6, options9);
57181
57847
  if (callback) {
57182
57848
  setTimeout(function() {
57183
57849
  callback(value6);
@@ -57190,13 +57856,13 @@ class Diff {
57190
57856
  const newLen = newTokens.length, oldLen = oldTokens.length;
57191
57857
  let editLength = 1;
57192
57858
  let maxEditLength = newLen + oldLen;
57193
- if (options7.maxEditLength != null) {
57194
- maxEditLength = Math.min(maxEditLength, options7.maxEditLength);
57859
+ if (options9.maxEditLength != null) {
57860
+ maxEditLength = Math.min(maxEditLength, options9.maxEditLength);
57195
57861
  }
57196
- const maxExecutionTime = (_a = options7.timeout) !== null && _a !== undefined ? _a : Infinity;
57862
+ const maxExecutionTime = (_a = options9.timeout) !== null && _a !== undefined ? _a : Infinity;
57197
57863
  const abortAfterTimestamp = Date.now() + maxExecutionTime;
57198
57864
  const bestPath = [{ oldPos: -1, lastComponent: undefined }];
57199
- let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options7);
57865
+ let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options9);
57200
57866
  if (bestPath[0].oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
57201
57867
  return done9(this.buildValues(bestPath[0].lastComponent, newTokens, oldTokens));
57202
57868
  }
@@ -57219,11 +57885,11 @@ class Diff {
57219
57885
  continue;
57220
57886
  }
57221
57887
  if (!canRemove || canAdd && removePath.oldPos < addPath.oldPos) {
57222
- basePath = this.addToPath(addPath, true, false, 0, options7);
57888
+ basePath = this.addToPath(addPath, true, false, 0, options9);
57223
57889
  } else {
57224
- basePath = this.addToPath(removePath, false, true, 1, options7);
57890
+ basePath = this.addToPath(removePath, false, true, 1, options9);
57225
57891
  }
57226
- newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options7);
57892
+ newPos = this.extractCommon(basePath, newTokens, oldTokens, diagonalPath, options9);
57227
57893
  if (basePath.oldPos + 1 >= oldLen && newPos + 1 >= newLen) {
57228
57894
  return done9(this.buildValues(basePath.lastComponent, newTokens, oldTokens)) || true;
57229
57895
  } else {
@@ -57258,9 +57924,9 @@ class Diff {
57258
57924
  }
57259
57925
  }
57260
57926
  }
57261
- addToPath(path13, added, removed, oldPosInc, options7) {
57927
+ addToPath(path13, added, removed, oldPosInc, options9) {
57262
57928
  const last5 = path13.lastComponent;
57263
- if (last5 && !options7.oneChangePerToken && last5.added === added && last5.removed === removed) {
57929
+ if (last5 && !options9.oneChangePerToken && last5.added === added && last5.removed === removed) {
57264
57930
  return {
57265
57931
  oldPos: path13.oldPos + oldPosInc,
57266
57932
  lastComponent: { count: last5.count + 1, added, removed, previousComponent: last5.previousComponent }
@@ -57272,28 +57938,28 @@ class Diff {
57272
57938
  };
57273
57939
  }
57274
57940
  }
57275
- extractCommon(basePath, newTokens, oldTokens, diagonalPath, options7) {
57941
+ extractCommon(basePath, newTokens, oldTokens, diagonalPath, options9) {
57276
57942
  const newLen = newTokens.length, oldLen = oldTokens.length;
57277
57943
  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)) {
57944
+ while (newPos + 1 < newLen && oldPos + 1 < oldLen && this.equals(oldTokens[oldPos + 1], newTokens[newPos + 1], options9)) {
57279
57945
  newPos++;
57280
57946
  oldPos++;
57281
57947
  commonCount++;
57282
- if (options7.oneChangePerToken) {
57948
+ if (options9.oneChangePerToken) {
57283
57949
  basePath.lastComponent = { count: 1, previousComponent: basePath.lastComponent, added: false, removed: false };
57284
57950
  }
57285
57951
  }
57286
- if (commonCount && !options7.oneChangePerToken) {
57952
+ if (commonCount && !options9.oneChangePerToken) {
57287
57953
  basePath.lastComponent = { count: commonCount, previousComponent: basePath.lastComponent, added: false, removed: false };
57288
57954
  }
57289
57955
  basePath.oldPos = oldPos;
57290
57956
  return newPos;
57291
57957
  }
57292
- equals(left3, right3, options7) {
57293
- if (options7.comparator) {
57294
- return options7.comparator(left3, right3);
57958
+ equals(left3, right3, options9) {
57959
+ if (options9.comparator) {
57960
+ return options9.comparator(left3, right3);
57295
57961
  } else {
57296
- return left3 === right3 || !!options7.ignoreCase && left3.toLowerCase() === right3.toLowerCase();
57962
+ return left3 === right3 || !!options9.ignoreCase && left3.toLowerCase() === right3.toLowerCase();
57297
57963
  }
57298
57964
  }
57299
57965
  removeEmpty(array9) {
@@ -57305,16 +57971,16 @@ class Diff {
57305
57971
  }
57306
57972
  return ret;
57307
57973
  }
57308
- castInput(value6, options7) {
57974
+ castInput(value6, options9) {
57309
57975
  return value6;
57310
57976
  }
57311
- tokenize(value6, options7) {
57977
+ tokenize(value6, options9) {
57312
57978
  return Array.from(value6);
57313
57979
  }
57314
57980
  join(chars) {
57315
57981
  return chars.join("");
57316
57982
  }
57317
- postProcess(changeObjects, options7) {
57983
+ postProcess(changeObjects, options9) {
57318
57984
  return changeObjects;
57319
57985
  }
57320
57986
  get useLongestToken() {
@@ -57486,9 +58152,9 @@ function leadingAndTrailingWs(string8, segmenter) {
57486
58152
  const segments = segment(string8, segmenter);
57487
58153
  const firstSeg = segments[0];
57488
58154
  const lastSeg = segments[segments.length - 1];
57489
- const head11 = /\s/.test(firstSeg) ? firstSeg : "";
58155
+ const head13 = /\s/.test(firstSeg) ? firstSeg : "";
57490
58156
  const tail2 = /\s/.test(lastSeg) ? lastSeg : "";
57491
- return [head11, tail2];
58157
+ return [head13, tail2];
57492
58158
  }
57493
58159
 
57494
58160
  // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/word.js
@@ -57496,17 +58162,17 @@ var extendedWordChars = "a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-
57496
58162
  var tokenizeIncludingWhitespace = new RegExp(`[${extendedWordChars}]+|\\s+|[^${extendedWordChars}]`, "ug");
57497
58163
 
57498
58164
  class WordDiff extends Diff {
57499
- equals(left3, right3, options7) {
57500
- if (options7.ignoreCase) {
58165
+ equals(left3, right3, options9) {
58166
+ if (options9.ignoreCase) {
57501
58167
  left3 = left3.toLowerCase();
57502
58168
  right3 = right3.toLowerCase();
57503
58169
  }
57504
58170
  return left3.trim() === right3.trim();
57505
58171
  }
57506
- tokenize(value6, options7 = {}) {
58172
+ tokenize(value6, options9 = {}) {
57507
58173
  let parts2;
57508
- if (options7.intlSegmenter) {
57509
- const segmenter = options7.intlSegmenter;
58174
+ if (options9.intlSegmenter) {
58175
+ const segmenter = options9.intlSegmenter;
57510
58176
  if (segmenter.resolvedOptions().granularity != "word") {
57511
58177
  throw new Error('The segmenter passed must have a granularity of "word"');
57512
58178
  }
@@ -57545,8 +58211,8 @@ class WordDiff extends Diff {
57545
58211
  }
57546
58212
  }).join("");
57547
58213
  }
57548
- postProcess(changes2, options7) {
57549
- if (!changes2 || options7.oneChangePerToken) {
58214
+ postProcess(changes2, options9) {
58215
+ if (!changes2 || options9.oneChangePerToken) {
57550
58216
  return changes2;
57551
58217
  }
57552
58218
  let lastKeep = null;
@@ -57559,7 +58225,7 @@ class WordDiff extends Diff {
57559
58225
  deletion = change;
57560
58226
  } else {
57561
58227
  if (insertion || deletion) {
57562
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change, options7.intlSegmenter);
58228
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, change, options9.intlSegmenter);
57563
58229
  }
57564
58230
  lastKeep = change;
57565
58231
  insertion = null;
@@ -57567,7 +58233,7 @@ class WordDiff extends Diff {
57567
58233
  }
57568
58234
  });
57569
58235
  if (insertion || deletion) {
57570
- dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null, options7.intlSegmenter);
58236
+ dedupeWhitespaceInChangeObjects(lastKeep, deletion, insertion, null, options9.intlSegmenter);
57571
58237
  }
57572
58238
  return changes2;
57573
58239
  }
@@ -57633,17 +58299,17 @@ class LineDiff extends Diff {
57633
58299
  super(...arguments);
57634
58300
  this.tokenize = tokenize;
57635
58301
  }
57636
- equals(left3, right3, options7) {
57637
- if (options7.ignoreWhitespace) {
57638
- if (!options7.newlineIsToken || !left3.includes(`
58302
+ equals(left3, right3, options9) {
58303
+ if (options9.ignoreWhitespace) {
58304
+ if (!options9.newlineIsToken || !left3.includes(`
57639
58305
  `)) {
57640
58306
  left3 = left3.trim();
57641
58307
  }
57642
- if (!options7.newlineIsToken || !right3.includes(`
58308
+ if (!options9.newlineIsToken || !right3.includes(`
57643
58309
  `)) {
57644
58310
  right3 = right3.trim();
57645
58311
  }
57646
- } else if (options7.ignoreNewlineAtEof && !options7.newlineIsToken) {
58312
+ } else if (options9.ignoreNewlineAtEof && !options9.newlineIsToken) {
57647
58313
  if (left3.endsWith(`
57648
58314
  `)) {
57649
58315
  left3 = left3.slice(0, -1);
@@ -57653,15 +58319,15 @@ class LineDiff extends Diff {
57653
58319
  right3 = right3.slice(0, -1);
57654
58320
  }
57655
58321
  }
57656
- return super.equals(left3, right3, options7);
58322
+ return super.equals(left3, right3, options9);
57657
58323
  }
57658
58324
  }
57659
58325
  var lineDiff = new LineDiff;
57660
- function diffLines(oldStr, newStr, options7) {
57661
- return lineDiff.diff(oldStr, newStr, options7);
58326
+ function diffLines(oldStr, newStr, options9) {
58327
+ return lineDiff.diff(oldStr, newStr, options9);
57662
58328
  }
57663
- function tokenize(value6, options7) {
57664
- if (options7.stripTrailingCr) {
58329
+ function tokenize(value6, options9) {
58330
+ if (options9.stripTrailingCr) {
57665
58331
  value6 = value6.replace(/\r\n/g, `
57666
58332
  `);
57667
58333
  }
@@ -57671,7 +58337,7 @@ function tokenize(value6, options7) {
57671
58337
  }
57672
58338
  for (let i = 0;i < linesAndNewlines.length; i++) {
57673
58339
  const line4 = linesAndNewlines[i];
57674
- if (i % 2 && !options7.newlineIsToken) {
58340
+ if (i % 2 && !options9.newlineIsToken) {
57675
58341
  retLines[retLines.length - 1] += line4;
57676
58342
  } else {
57677
58343
  retLines.push(line4);
@@ -57727,12 +58393,12 @@ class JsonDiff extends Diff {
57727
58393
  get useLongestToken() {
57728
58394
  return true;
57729
58395
  }
57730
- castInput(value6, options7) {
57731
- const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options7;
58396
+ castInput(value6, options9) {
58397
+ const { undefinedReplacement, stringifyReplacer = (k, v) => typeof v === "undefined" ? undefinedReplacement : v } = options9;
57732
58398
  return typeof value6 === "string" ? value6 : JSON.stringify(canonicalize(value6, null, null, stringifyReplacer), null, " ");
57733
58399
  }
57734
- equals(left3, right3, options7) {
57735
- return super.equals(left3.replace(/,([\r\n])/g, "$1"), right3.replace(/,([\r\n])/g, "$1"), options7);
58400
+ equals(left3, right3, options9) {
58401
+ return super.equals(left3.replace(/,([\r\n])/g, "$1"), right3.replace(/,([\r\n])/g, "$1"), options9);
57736
58402
  }
57737
58403
  }
57738
58404
  var jsonDiff = new JsonDiff;
@@ -57852,14 +58518,14 @@ var INCLUDE_HEADERS = {
57852
58518
  includeUnderline: true,
57853
58519
  includeFileHeaders: true
57854
58520
  };
57855
- function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options7) {
58521
+ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options9) {
57856
58522
  let optionsObj;
57857
- if (!options7) {
58523
+ if (!options9) {
57858
58524
  optionsObj = {};
57859
- } else if (typeof options7 === "function") {
57860
- optionsObj = { callback: options7 };
58525
+ } else if (typeof options9 === "function") {
58526
+ optionsObj = { callback: options9 };
57861
58527
  } else {
57862
- optionsObj = options7;
58528
+ optionsObj = options9;
57863
58529
  }
57864
58530
  if (typeof optionsObj.context === "undefined") {
57865
58531
  optionsObj.context = 4;
@@ -57873,8 +58539,8 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
57873
58539
  } else {
57874
58540
  const { callback } = optionsObj;
57875
58541
  diffLines(oldStr, newStr, Object.assign(Object.assign({}, optionsObj), { callback: (diff8) => {
57876
- const patch13 = diffLinesResultToPatch(diff8);
57877
- callback(patch13);
58542
+ const patch15 = diffLinesResultToPatch(diff8);
58543
+ callback(patch15);
57878
58544
  } }));
57879
58545
  }
57880
58546
  function diffLinesResultToPatch(diff8) {
@@ -57959,68 +58625,68 @@ function structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, ne
57959
58625
  };
57960
58626
  }
57961
58627
  }
57962
- function formatPatch(patch13, headerOptions) {
58628
+ function formatPatch(patch15, headerOptions) {
57963
58629
  var _a, _b, _c, _d, _e, _f;
57964
58630
  if (!headerOptions) {
57965
58631
  headerOptions = INCLUDE_HEADERS;
57966
58632
  }
57967
- if (Array.isArray(patch13)) {
57968
- if (patch13.length > 1 && !headerOptions.includeFileHeaders && !patch13.every((p3) => p3.isGit)) {
58633
+ if (Array.isArray(patch15)) {
58634
+ if (patch15.length > 1 && !headerOptions.includeFileHeaders && !patch15.every((p3) => p3.isGit)) {
57969
58635
  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
58636
  }
57971
- return patch13.map((p3) => formatPatch(p3, headerOptions)).join(`
58637
+ return patch15.map((p3) => formatPatch(p3, headerOptions)).join(`
57972
58638
  `);
57973
58639
  }
57974
58640
  const ret = [];
57975
- if (patch13.isGit) {
58641
+ if (patch15.isGit) {
57976
58642
  headerOptions = INCLUDE_HEADERS;
57977
- if (!patch13.oldFileName) {
58643
+ if (!patch15.oldFileName) {
57978
58644
  throw new Error("oldFileName must be specified for Git patches");
57979
58645
  }
57980
- if (!patch13.newFileName) {
58646
+ if (!patch15.newFileName) {
57981
58647
  throw new Error("newFileName must be specified for Git patches");
57982
58648
  }
57983
- let gitOldName = patch13.oldFileName;
57984
- let gitNewName = patch13.newFileName;
57985
- if (patch13.isCreate && gitOldName === "/dev/null") {
58649
+ let gitOldName = patch15.oldFileName;
58650
+ let gitNewName = patch15.newFileName;
58651
+ if (patch15.isCreate && gitOldName === "/dev/null") {
57986
58652
  gitOldName = gitNewName.replace(/^b\//, "a/");
57987
- } else if (patch13.isDelete && gitNewName === "/dev/null") {
58653
+ } else if (patch15.isDelete && gitNewName === "/dev/null") {
57988
58654
  gitNewName = gitOldName.replace(/^a\//, "b/");
57989
58655
  }
57990
58656
  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"));
58657
+ if (patch15.isDelete) {
58658
+ ret.push("deleted file mode " + ((_a = patch15.oldMode) !== null && _a !== undefined ? _a : "100644"));
57993
58659
  }
57994
- if (patch13.isCreate) {
57995
- ret.push("new file mode " + ((_b = patch13.newMode) !== null && _b !== undefined ? _b : "100644"));
58660
+ if (patch15.isCreate) {
58661
+ ret.push("new file mode " + ((_b = patch15.newMode) !== null && _b !== undefined ? _b : "100644"));
57996
58662
  }
57997
- if (patch13.oldMode && patch13.newMode && !patch13.isDelete && !patch13.isCreate) {
57998
- ret.push("old mode " + patch13.oldMode);
57999
- ret.push("new mode " + patch13.newMode);
58663
+ if (patch15.oldMode && patch15.newMode && !patch15.isDelete && !patch15.isCreate) {
58664
+ ret.push("old mode " + patch15.oldMode);
58665
+ ret.push("new mode " + patch15.newMode);
58000
58666
  }
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\//, "")));
58667
+ if (patch15.isRename) {
58668
+ ret.push("rename from " + quoteFileNameIfNeeded(((_c = patch15.oldFileName) !== null && _c !== undefined ? _c : "").replace(/^a\//, "")));
58669
+ ret.push("rename to " + quoteFileNameIfNeeded(((_d = patch15.newFileName) !== null && _d !== undefined ? _d : "").replace(/^b\//, "")));
58004
58670
  }
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\//, "")));
58671
+ if (patch15.isCopy) {
58672
+ ret.push("copy from " + quoteFileNameIfNeeded(((_e = patch15.oldFileName) !== null && _e !== undefined ? _e : "").replace(/^a\//, "")));
58673
+ ret.push("copy to " + quoteFileNameIfNeeded(((_f = patch15.newFileName) !== null && _f !== undefined ? _f : "").replace(/^b\//, "")));
58008
58674
  }
58009
58675
  } else {
58010
- if (headerOptions.includeIndex && patch13.oldFileName == patch13.newFileName && patch13.oldFileName !== undefined) {
58011
- ret.push("Index: " + patch13.oldFileName);
58676
+ if (headerOptions.includeIndex && patch15.oldFileName == patch15.newFileName && patch15.oldFileName !== undefined) {
58677
+ ret.push("Index: " + patch15.oldFileName);
58012
58678
  }
58013
58679
  if (headerOptions.includeUnderline) {
58014
58680
  ret.push("===================================================================");
58015
58681
  }
58016
58682
  }
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 : ""));
58683
+ const hasHunks = patch15.hunks.length > 0;
58684
+ if (headerOptions.includeFileHeaders && patch15.oldFileName !== undefined && patch15.newFileName !== undefined && (!patch15.isGit || hasHunks)) {
58685
+ ret.push("--- " + quoteFileNameIfNeeded(patch15.oldFileName) + (patch15.oldHeader ? "\t" + patch15.oldHeader : ""));
58686
+ ret.push("+++ " + quoteFileNameIfNeeded(patch15.newFileName) + (patch15.newHeader ? "\t" + patch15.newHeader : ""));
58021
58687
  }
58022
- for (let i = 0;i < patch13.hunks.length; i++) {
58023
- const hunk = patch13.hunks[i];
58688
+ for (let i = 0;i < patch15.hunks.length; i++) {
58689
+ const hunk = patch15.hunks[i];
58024
58690
  const oldStart = hunk.oldLines === 0 ? hunk.oldStart - 1 : hunk.oldStart;
58025
58691
  const newStart = hunk.newLines === 0 ? hunk.newStart - 1 : hunk.newStart;
58026
58692
  ret.push("@@ -" + oldStart + "," + hunk.oldLines + " +" + newStart + "," + hunk.newLines + " @@");
@@ -58032,23 +58698,23 @@ function formatPatch(patch13, headerOptions) {
58032
58698
  `) + `
58033
58699
  `;
58034
58700
  }
58035
- function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options7) {
58036
- if (typeof options7 === "function") {
58037
- options7 = { callback: options7 };
58701
+ function createTwoFilesPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options9) {
58702
+ if (typeof options9 === "function") {
58703
+ options9 = { callback: options9 };
58038
58704
  }
58039
- if (!(options7 === null || options7 === undefined ? undefined : options7.callback)) {
58040
- const patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options7);
58705
+ if (!(options9 === null || options9 === undefined ? undefined : options9.callback)) {
58706
+ const patchObj = structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, options9);
58041
58707
  if (!patchObj) {
58042
58708
  return;
58043
58709
  }
58044
- return formatPatch(patchObj, options7 === null || options7 === undefined ? undefined : options7.headerOptions);
58710
+ return formatPatch(patchObj, options9 === null || options9 === undefined ? undefined : options9.headerOptions);
58045
58711
  } else {
58046
- const { callback } = options7;
58047
- structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, Object.assign(Object.assign({}, options7), { callback: (patchObj) => {
58712
+ const { callback } = options9;
58713
+ structuredPatch(oldFileName, newFileName, oldStr, newStr, oldHeader, newHeader, Object.assign(Object.assign({}, options9), { callback: (patchObj) => {
58048
58714
  if (!patchObj) {
58049
58715
  callback(undefined);
58050
58716
  } else {
58051
- callback(formatPatch(patchObj, options7.headerOptions));
58717
+ callback(formatPatch(patchObj, options9.headerOptions));
58052
58718
  }
58053
58719
  } }));
58054
58720
  }
@@ -58386,7 +59052,7 @@ var runUpdate = ({
58386
59052
  }
58387
59053
  rmSync4(expectedDirectory, { recursive: true, force: true });
58388
59054
  if (result.applied) {
58389
- submitCliEvent("cli.scaffold.update.applied", {
59055
+ yield* submitCliEventEffect("cli.scaffold.update.applied", {
58390
59056
  cwd: rootDirectory,
58391
59057
  baseline: {
58392
59058
  version: baseline.summary.version
@@ -58551,6 +59217,9 @@ var detectCliInstallPackageManager = ({
58551
59217
  if (normalizedEntrypoint.includes("/pnpm/") || normalizedEntrypoint.includes("\\pnpm\\") || normalizedEntrypoint.includes("/.pnpm/")) {
58552
59218
  return "pnpm";
58553
59219
  }
59220
+ if (normalizedEntrypoint.includes("/yarn/") || normalizedEntrypoint.includes("\\yarn\\") || normalizedEntrypoint.includes("/.yarn/")) {
59221
+ return "yarn";
59222
+ }
58554
59223
  if (normalizedEntrypoint.includes("/node_modules/@punks/cli/") || normalizedEntrypoint.includes("\\node_modules\\@punks\\cli\\")) {
58555
59224
  return "npm";
58556
59225
  }
@@ -58563,6 +59232,9 @@ var detectCliInstallPackageManager = ({
58563
59232
  if (userAgent?.startsWith("pnpm/") === true) {
58564
59233
  return "pnpm";
58565
59234
  }
59235
+ if (userAgent?.startsWith("yarn/") === true) {
59236
+ return "yarn";
59237
+ }
58566
59238
  if (userAgent?.startsWith("npm/") === true) {
58567
59239
  return "npm";
58568
59240
  }
@@ -58576,11 +59248,24 @@ var globalInstallCommandForPackageManager = ({
58576
59248
  const specifier = `${packageName}@${tag6}`;
58577
59249
  switch (packageManager) {
58578
59250
  case "bun":
58579
- return ["bun", "add", "-g", specifier];
59251
+ return ["bun", "add", "-g", specifier, "--minimum-release-age=0"];
58580
59252
  case "pnpm":
58581
59253
  return ["pnpm", "add", "-g", specifier];
58582
59254
  case "npm":
58583
- return ["npm", "install", "-g", specifier];
59255
+ return ["npm", "install", "-g", specifier, "--min-release-age=0"];
59256
+ case "yarn":
59257
+ return ["yarn", "global", "add", specifier];
59258
+ }
59259
+ };
59260
+ var minimumReleaseAgeEnvironmentForPackageManager = (packageManager) => {
59261
+ switch (packageManager) {
59262
+ case "pnpm":
59263
+ return { npm_config_minimum_release_age: "0" };
59264
+ case "yarn":
59265
+ return { YARN_NPM_MINIMAL_AGE_GATE: "0" };
59266
+ case "bun":
59267
+ case "npm":
59268
+ return {};
58584
59269
  }
58585
59270
  };
58586
59271
  var autoUpdateCliIfStale = async ({
@@ -58611,10 +59296,65 @@ var autoUpdateCliIfStale = async ({
58611
59296
  packageName,
58612
59297
  tag: tag6
58613
59298
  });
59299
+ const environment2 = minimumReleaseAgeEnvironmentForPackageManager(packageManager);
58614
59300
  return {
58615
59301
  status: "available",
58616
59302
  check: check2,
58617
59303
  packageManager,
59304
+ command,
59305
+ environment: environment2
59306
+ };
59307
+ };
59308
+ var upgradeCli = async ({
59309
+ currentVersion,
59310
+ packageName,
59311
+ tag: tag6 = "latest",
59312
+ timeoutMs = 5000,
59313
+ entrypoint,
59314
+ force = false
59315
+ }) => {
59316
+ const check2 = await checkSelfUpdate({ currentVersion, packageName, tag: tag6, timeoutMs });
59317
+ if (check2 === null) {
59318
+ return { status: "unavailable", check: check2 };
59319
+ }
59320
+ if (!check2.updateAvailable && !force) {
59321
+ return { status: "current", check: check2 };
59322
+ }
59323
+ const packageManager = detectCliInstallPackageManager(entrypoint === undefined ? {} : { entrypoint });
59324
+ if (packageManager === null) {
59325
+ return {
59326
+ status: "manager-not-detected",
59327
+ check: check2,
59328
+ packageManager,
59329
+ command: null
59330
+ };
59331
+ }
59332
+ const command = globalInstallCommandForPackageManager({
59333
+ packageManager,
59334
+ packageName,
59335
+ tag: tag6
59336
+ });
59337
+ const environment2 = minimumReleaseAgeEnvironmentForPackageManager(packageManager);
59338
+ const result = spawnSync(command[0], command.slice(1), {
59339
+ env: {
59340
+ ...process.env,
59341
+ ...environment2
59342
+ },
59343
+ stdio: "inherit"
59344
+ });
59345
+ if (result.status === 0) {
59346
+ return {
59347
+ status: "upgraded",
59348
+ check: check2,
59349
+ packageManager,
59350
+ command,
59351
+ environment: environment2
59352
+ };
59353
+ }
59354
+ return {
59355
+ status: "failed",
59356
+ check: check2,
59357
+ packageManager,
58618
59358
  command
58619
59359
  };
58620
59360
  };
@@ -58702,13 +59442,69 @@ var checkDpCliSkillPresence = () => {
58702
59442
  };
58703
59443
  };
58704
59444
 
59445
+ // src/cli/upgrade-command.ts
59446
+ 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`."));
59447
+ var forceOption = exports_Options.boolean("force").pipe(exports_Options.withDescription("Reinstall the selected dist-tag even when the current version is fresh."));
59448
+ var jsonOption4 = exports_Options.boolean("json").pipe(exports_Options.withDescription("Print JSON output."));
59449
+ var formatCommand = ({
59450
+ command,
59451
+ environment: environment2
59452
+ }) => {
59453
+ const envPrefix = environment2 === undefined ? [] : Object.entries(environment2).map(([key, value6]) => `${key}=${value6}`);
59454
+ return [...envPrefix, ...command].join(" ");
59455
+ };
59456
+ var upgradeCommand = exports_Command.make("upgrade", {
59457
+ tag: tagOption,
59458
+ force: forceOption,
59459
+ json: jsonOption4
59460
+ }, ({ tag: tag6, force, json: json2 }) => exports_Effect.tryPromise({
59461
+ try: async () => {
59462
+ const result = await upgradeCli({
59463
+ currentVersion: version,
59464
+ packageName: name,
59465
+ tag: tag6,
59466
+ force
59467
+ });
59468
+ if (json2) {
59469
+ console.log(renderJsonLabel());
59470
+ console.log(JSON.stringify(result, null, 2));
59471
+ return;
59472
+ }
59473
+ switch (result.status) {
59474
+ case "upgraded":
59475
+ console.log(renderCommandSection("CLI upgraded", [
59476
+ `${result.check.packageName} ${result.check.currentVersion} -> ${result.check.latestVersion}`,
59477
+ `Installer: ${result.packageManager}`,
59478
+ `Command: ${formatCommand(result)}`
59479
+ ].join(`
59480
+ `)));
59481
+ return;
59482
+ case "current":
59483
+ if (result.check === null) {
59484
+ throw new Error("Could not read the npm registry version for this CLI.");
59485
+ }
59486
+ console.log(renderCommandSection("CLI already current", `${result.check.packageName} ${result.check.currentVersion} matches ${result.check.latestVersion}.`));
59487
+ return;
59488
+ case "unavailable":
59489
+ throw new Error("Could not read the npm registry version for this CLI.");
59490
+ case "manager-not-detected":
59491
+ throw new Error("Could not detect how this CLI was installed. Reinstall manually with npm, pnpm, bun, or yarn.");
59492
+ case "available":
59493
+ throw new Error(`Upgrade command was not executed: ${formatCommand(result)}`);
59494
+ case "failed":
59495
+ 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 })}`);
59496
+ }
59497
+ },
59498
+ catch: (cause3) => cause3 instanceof Error ? cause3 : new Error("CLI upgrade failed.")
59499
+ })).pipe(exports_Command.withDescription("Upgrade this CLI through the package manager used for its global install."));
59500
+
58705
59501
  // src/index.ts
58706
59502
  var startupCheckWorkerEnv = "DP_STARTUP_CHECK_WORKER";
58707
59503
  var startupCheckCliEnv = "DP_STARTUP_CHECK_CLI";
58708
59504
  var startupCheckSkillEnv = "DP_STARTUP_CHECK_SKILL";
58709
59505
  var startupCheckIntervalMs = Number.parseInt(process.env.DP_STARTUP_CHECK_INTERVAL_MS ?? String(12 * 60 * 60 * 1000), 10);
58710
59506
  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]));
59507
+ 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
59508
  var cli = exports_Command.run(app, {
58713
59509
  name: "punks",
58714
59510
  version