@punks/cli 2.1.0 → 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
@@ -10891,9 +10891,9 @@ var require_public_api = __commonJS((exports) => {
10891
10891
 
10892
10892
  // src/index.ts
10893
10893
  import { spawn as spawn2 } from "child_process";
10894
- import { existsSync as existsSync8, mkdirSync as mkdirSync7, readFileSync as readFileSync8, writeFileSync as writeFileSync6 } from "fs";
10895
- import { homedir as homedir4 } from "os";
10896
- import path16 from "path";
10894
+ import { existsSync as existsSync7, mkdirSync as mkdirSync6, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
10895
+ import { homedir as homedir3 } from "os";
10896
+ import path15 from "path";
10897
10897
 
10898
10898
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Array.js
10899
10899
  var exports_Array = {};
@@ -13051,31 +13051,6 @@ var InvalidData2 = InvalidData;
13051
13051
  var isConfigError2 = isConfigError;
13052
13052
  var isMissingDataOnly2 = isMissingDataOnly;
13053
13053
 
13054
- // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Context.js
13055
- var exports_Context = {};
13056
- __export(exports_Context, {
13057
- unsafeMake: () => unsafeMake,
13058
- unsafeGet: () => unsafeGet3,
13059
- pick: () => pick2,
13060
- omit: () => omit2,
13061
- mergeAll: () => mergeAll2,
13062
- merge: () => merge3,
13063
- make: () => make6,
13064
- isTag: () => isTag2,
13065
- isReference: () => isReference2,
13066
- isContext: () => isContext2,
13067
- getOrElse: () => getOrElse3,
13068
- getOption: () => getOption2,
13069
- get: () => get3,
13070
- empty: () => empty6,
13071
- add: () => add2,
13072
- TagTypeId: () => TagTypeId2,
13073
- Tag: () => Tag2,
13074
- ReferenceTypeId: () => ReferenceTypeId2,
13075
- Reference: () => Reference2,
13076
- GenericTag: () => GenericTag
13077
- });
13078
-
13079
13054
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/internal/context.js
13080
13055
  var TagTypeId = /* @__PURE__ */ Symbol.for("effect/Context/Tag");
13081
13056
  var ReferenceTypeId = /* @__PURE__ */ Symbol.for("effect/Context/Reference");
@@ -13281,16 +13256,6 @@ var mergeAll = (...ctxs) => {
13281
13256
  }
13282
13257
  return makeContext(map5);
13283
13258
  };
13284
- var pick = (...tags) => (self) => {
13285
- const tagSet = new Set(tags.map((_) => _.key));
13286
- const newEnv = new Map;
13287
- for (const [tag, s] of self.unsafeMap.entries()) {
13288
- if (tagSet.has(tag)) {
13289
- newEnv.set(tag, s);
13290
- }
13291
- }
13292
- return makeContext(newEnv);
13293
- };
13294
13259
  var omit = (...tags) => (self) => {
13295
13260
  const newEnv = new Map(self.unsafeMap);
13296
13261
  for (const tag of tags) {
@@ -13300,13 +13265,9 @@ var omit = (...tags) => (self) => {
13300
13265
  };
13301
13266
 
13302
13267
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Context.js
13303
- var TagTypeId2 = TagTypeId;
13304
- var ReferenceTypeId2 = ReferenceTypeId;
13305
13268
  var GenericTag = makeGenericTag;
13306
- var unsafeMake = makeContext;
13307
13269
  var isContext2 = isContext;
13308
13270
  var isTag2 = isTag;
13309
- var isReference2 = isReference;
13310
13271
  var empty6 = empty5;
13311
13272
  var make6 = make5;
13312
13273
  var add2 = add;
@@ -13316,7 +13277,6 @@ var unsafeGet3 = unsafeGet2;
13316
13277
  var getOption2 = getOption;
13317
13278
  var merge3 = merge2;
13318
13279
  var mergeAll2 = mergeAll;
13319
- var pick2 = pick;
13320
13280
  var omit2 = omit;
13321
13281
  var Tag2 = Tag;
13322
13282
  var Reference2 = Reference;
@@ -14849,7 +14809,7 @@ var threadName = (self) => {
14849
14809
  const identifiers = Array.from(ids(self)).map((n) => `#${n}`).join(",");
14850
14810
  return identifiers;
14851
14811
  };
14852
- var unsafeMake2 = () => {
14812
+ var unsafeMake = () => {
14853
14813
  const id = get6(_fiberCounter);
14854
14814
  pipe(_fiberCounter, set3(id + 1));
14855
14815
  return new Runtime(id, Date.now());
@@ -14865,7 +14825,7 @@ var combineAll3 = combineAll2;
14865
14825
  var ids2 = ids;
14866
14826
  var make15 = make14;
14867
14827
  var threadName2 = threadName;
14868
- var unsafeMake3 = unsafeMake2;
14828
+ var unsafeMake2 = unsafeMake;
14869
14829
 
14870
14830
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/HashMap.js
14871
14831
  var isHashMap2 = isHashMap;
@@ -18108,11 +18068,11 @@ var parallel3 = parallel2;
18108
18068
  var parallelN2 = parallelN;
18109
18069
 
18110
18070
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/internal/fiberRefs.js
18111
- function unsafeMake4(fiberRefLocals) {
18071
+ function unsafeMake3(fiberRefLocals) {
18112
18072
  return new FiberRefsImpl(fiberRefLocals);
18113
18073
  }
18114
18074
  function empty21() {
18115
- return unsafeMake4(new Map);
18075
+ return unsafeMake3(new Map);
18116
18076
  }
18117
18077
  var FiberRefsSym = /* @__PURE__ */ Symbol.for("effect/FiberRefs");
18118
18078
 
@@ -18965,8 +18925,8 @@ class RefImpl extends Class2 {
18965
18925
  });
18966
18926
  }
18967
18927
  }
18968
- var unsafeMake5 = (value) => new RefImpl(make13(value));
18969
- var make24 = (value) => sync(() => unsafeMake5(value));
18928
+ var unsafeMake4 = (value) => new RefImpl(make13(value));
18929
+ var make24 = (value) => sync(() => unsafeMake4(value));
18970
18930
  var get10 = (self) => self.get;
18971
18931
  var set5 = /* @__PURE__ */ dual(2, (self, value) => self.modify(() => [undefined, value]));
18972
18932
  var getAndSet = /* @__PURE__ */ dual(2, (self, value) => self.modify((a) => [a, value]));
@@ -19907,7 +19867,7 @@ class Local {
19907
19867
  }));
19908
19868
  }
19909
19869
  }
19910
- var unsafeMake6 = (fiber) => {
19870
+ var unsafeMake5 = (fiber) => {
19911
19871
  return new Local(fiber.id(), fiber);
19912
19872
  };
19913
19873
  var globalScope = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("effect/FiberScope/Global"), () => new Global);
@@ -20929,7 +20889,7 @@ var MetricPairTypeId = /* @__PURE__ */ Symbol.for(MetricPairSymbolKey);
20929
20889
  var metricPairVariance = {
20930
20890
  _Type: (_) => _
20931
20891
  };
20932
- var unsafeMake7 = (metricKey, metricState) => {
20892
+ var unsafeMake6 = (metricKey, metricState) => {
20933
20893
  return {
20934
20894
  [MetricPairTypeId]: metricPairVariance,
20935
20895
  metricKey,
@@ -20950,7 +20910,7 @@ class MetricRegistryImpl {
20950
20910
  snapshot() {
20951
20911
  const result = [];
20952
20912
  for (const [key, hook] of this.map) {
20953
- result.push(unsafeMake7(key, hook.get()));
20913
+ result.push(unsafeMake6(key, hook.get()));
20954
20914
  }
20955
20915
  return result;
20956
20916
  }
@@ -22061,7 +22021,7 @@ class FiberRuntime extends Class2 {
22061
22021
  });
22062
22022
  }
22063
22023
  scope() {
22064
- return unsafeMake6(this);
22024
+ return unsafeMake5(this);
22065
22025
  }
22066
22026
  get children() {
22067
22027
  return this.ask((fiber) => Array.from(fiber.getChildren()));
@@ -23121,7 +23081,7 @@ var unsafeForkUnstarted = (effect, parentFiber, parentRuntimeFlags, overrideScop
23121
23081
  return childFiber;
23122
23082
  };
23123
23083
  var unsafeMakeChildFiber = (effect, parentFiber, parentRuntimeFlags, overrideScope = null) => {
23124
- const childId = unsafeMake3();
23084
+ const childId = unsafeMake2();
23125
23085
  const parentFiberRefs = parentFiber.getFiberRefs();
23126
23086
  const childFiberRefs = forkAs(parentFiberRefs, childId);
23127
23087
  const childFiber = new FiberRuntime(childId, childFiberRefs, parentRuntimeFlags);
@@ -24005,7 +23965,7 @@ class SynchronizedImpl extends Class2 {
24005
23965
  }
24006
23966
  var makeSynchronized = (value) => sync(() => unsafeMakeSynchronized(value));
24007
23967
  var unsafeMakeSynchronized = (value) => {
24008
- const ref = unsafeMake5(value);
23968
+ const ref = unsafeMake4(value);
24009
23969
  const sem = unsafeMakeSemaphore(1);
24010
23970
  return new SynchronizedImpl(ref, sem.withPermits(1));
24011
23971
  };
@@ -24054,7 +24014,7 @@ var makeDual = (f) => function() {
24054
24014
  return f.apply(this, arguments);
24055
24015
  };
24056
24016
  var unsafeFork2 = /* @__PURE__ */ makeDual((runtime3, self, options) => {
24057
- const fiberId2 = unsafeMake3();
24017
+ const fiberId2 = unsafeMake2();
24058
24018
  const fiberRefUpdates = [[currentContext, [[fiberId2, runtime3.context]]]];
24059
24019
  if (options?.scheduler) {
24060
24020
  fiberRefUpdates.push([currentScheduler, [[fiberId2, options.scheduler]]]);
@@ -25237,7 +25197,7 @@ var unsafeFromDate = (date) => {
25237
25197
  }
25238
25198
  return makeUtc(epochMillis);
25239
25199
  };
25240
- var unsafeMake8 = (input) => {
25200
+ var unsafeMake7 = (input) => {
25241
25201
  if (isDateTime(input)) {
25242
25202
  return input;
25243
25203
  } else if (input instanceof Date) {
@@ -25258,7 +25218,7 @@ var unsafeMakeZoned = (input, options) => {
25258
25218
  if (options?.timeZone === undefined && isDateTime(input) && isZoned(input)) {
25259
25219
  return input;
25260
25220
  }
25261
- const self = unsafeMake8(input);
25221
+ const self = unsafeMake7(input);
25262
25222
  if (self.epochMillis < minEpochMillis || self.epochMillis > maxEpochMillis) {
25263
25223
  throw new RangeError(`Epoch millis out of range: ${self.epochMillis}`);
25264
25224
  }
@@ -25589,7 +25549,7 @@ class ScheduleDriverImpl {
25589
25549
  }
25590
25550
  });
25591
25551
  }
25592
- iterationMeta = /* @__PURE__ */ unsafeMake5(defaultIterationMetadata);
25552
+ iterationMeta = /* @__PURE__ */ unsafeMake4(defaultIterationMetadata);
25593
25553
  get reset() {
25594
25554
  return set5(this.ref, [none2(), this.schedule.initial]).pipe(zipLeft(set5(this.iterationMeta, defaultIterationMetadata)));
25595
25555
  }
@@ -25824,7 +25784,7 @@ var failCause6 = deferredFailCause;
25824
25784
  var interrupt5 = deferredInterrupt;
25825
25785
  var isDone5 = deferredIsDone;
25826
25786
  var succeed6 = deferredSucceed;
25827
- var unsafeMake9 = deferredUnsafeMake;
25787
+ var unsafeMake8 = deferredUnsafeMake;
25828
25788
  var unsafeDone = deferredUnsafeDone;
25829
25789
 
25830
25790
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/MutableList.js
@@ -26208,7 +26168,7 @@ class CacheImpl {
26208
26168
  let deferred = undefined;
26209
26169
  let value = getOrUndefined(get12(this.cacheState.map, k));
26210
26170
  if (value === undefined) {
26211
- deferred = unsafeMake9(this.fiberId);
26171
+ deferred = unsafeMake8(this.fiberId);
26212
26172
  mapKey = makeMapKey(k);
26213
26173
  if (has6(this.cacheState.map, k)) {
26214
26174
  value = getOrUndefined(get12(this.cacheState.map, k));
@@ -26253,7 +26213,7 @@ class CacheImpl {
26253
26213
  refresh(key) {
26254
26214
  return clockWith3((clock2) => suspend(() => {
26255
26215
  const k = key;
26256
- const deferred = unsafeMake9(this.fiberId);
26216
+ const deferred = unsafeMake8(this.fiberId);
26257
26217
  let value = getOrUndefined(get12(this.cacheState.map, k));
26258
26218
  if (value === undefined) {
26259
26219
  if (has6(this.cacheState.map, k)) {
@@ -28336,10 +28296,10 @@ var record = (key, value) => {
28336
28296
  indexSignatures
28337
28297
  };
28338
28298
  };
28339
- var pick3 = (ast, keys6) => {
28299
+ var pick2 = (ast, keys6) => {
28340
28300
  const annotation = getSurrogateAnnotation(ast);
28341
28301
  if (isSome2(annotation)) {
28342
- return pick3(annotation.value, keys6);
28302
+ return pick2(annotation.value, keys6);
28343
28303
  }
28344
28304
  switch (ast._tag) {
28345
28305
  case "TypeLiteral": {
@@ -28364,13 +28324,13 @@ var pick3 = (ast, keys6) => {
28364
28324
  case "Union":
28365
28325
  return new TypeLiteral(keys6.map((name) => getPropertyKeyIndexedAccess(ast, name)), []);
28366
28326
  case "Suspend":
28367
- return pick3(ast.f(), keys6);
28327
+ return pick2(ast.f(), keys6);
28368
28328
  case "Refinement":
28369
- return pick3(ast.from, keys6);
28329
+ return pick2(ast.from, keys6);
28370
28330
  case "Transformation": {
28371
28331
  switch (ast.transformation._tag) {
28372
28332
  case "ComposeTransformation":
28373
- return new Transformation(pick3(ast.from, keys6), pick3(ast.to, keys6), composeTransformation);
28333
+ return new Transformation(pick2(ast.from, keys6), pick2(ast.to, keys6), composeTransformation);
28374
28334
  case "TypeLiteralTransformation": {
28375
28335
  const ts = [];
28376
28336
  const fromKeys = [];
@@ -28383,7 +28343,7 @@ var pick3 = (ast, keys6) => {
28383
28343
  fromKeys.push(k);
28384
28344
  }
28385
28345
  }
28386
- return isNonEmptyReadonlyArray(ts) ? new Transformation(pick3(ast.from, fromKeys), pick3(ast.to, keys6), new TypeLiteralTransformation(ts)) : pick3(ast.from, fromKeys);
28346
+ return isNonEmptyReadonlyArray(ts) ? new Transformation(pick2(ast.from, fromKeys), pick2(ast.to, keys6), new TypeLiteralTransformation(ts)) : pick2(ast.from, fromKeys);
28387
28347
  }
28388
28348
  }
28389
28349
  }
@@ -28398,7 +28358,7 @@ var omit3 = (ast, keys6) => {
28398
28358
  }
28399
28359
  return new TypeLiteral([], indexSignatures);
28400
28360
  }
28401
- return pick3(ast, getPropertyKeys(ast).filter((name) => !keys6.includes(name)));
28361
+ return pick2(ast, getPropertyKeys(ast).filter((name) => !keys6.includes(name)));
28402
28362
  };
28403
28363
  var orUndefined = (ast) => Union.make([ast, undefinedKeyword]);
28404
28364
  var partial = (ast, options) => {
@@ -29921,7 +29881,7 @@ var nominal = () => {
29921
29881
  };
29922
29882
 
29923
29883
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/FiberRef.js
29924
- var unsafeMake10 = fiberRefUnsafeMake;
29884
+ var unsafeMake9 = fiberRefUnsafeMake;
29925
29885
  var currentContext2 = currentContext;
29926
29886
  var currentLoggers2 = currentLoggers;
29927
29887
  var currentTracerEnabled2 = currentTracerEnabled;
@@ -30327,10 +30287,10 @@ var bounded2 = (requestedCapacity) => pipe(sync(() => bounded(requestedCapacity)
30327
30287
  var dropping = (requestedCapacity) => pipe(sync(() => bounded(requestedCapacity)), flatMap7((queue) => make42(backingQueueFromMutableQueue(queue), droppingStrategy())));
30328
30288
  var sliding = (requestedCapacity) => pipe(sync(() => bounded(requestedCapacity)), flatMap7((queue) => make42(backingQueueFromMutableQueue(queue), slidingStrategy())));
30329
30289
  var unbounded2 = () => pipe(sync(() => unbounded()), flatMap7((queue) => make42(backingQueueFromMutableQueue(queue), droppingStrategy())));
30330
- var unsafeMake11 = (queue, takers, shutdownHook, shutdownFlag, strategy) => {
30290
+ var unsafeMake10 = (queue, takers, shutdownHook, shutdownFlag, strategy) => {
30331
30291
  return new QueueImpl(queue, takers, shutdownHook, shutdownFlag, strategy);
30332
30292
  };
30333
- var make42 = (queue, strategy) => pipe(deferredMake(), map11((deferred) => unsafeMake11(queue, unbounded(), deferred, make13(false), strategy)));
30293
+ var make42 = (queue, strategy) => pipe(deferredMake(), map11((deferred) => unsafeMake10(queue, unbounded(), deferred, make13(false), strategy)));
30334
30294
 
30335
30295
  class BackingQueueFromMutableQueue {
30336
30296
  mutable;
@@ -32733,7 +32693,7 @@ __export(exports_Schema, {
32733
32693
  positive: () => positive,
32734
32694
  pluck: () => pluck,
32735
32695
  pickLiteral: () => pickLiteral,
32736
- pick: () => pick5,
32696
+ pick: () => pick4,
32737
32697
  pattern: () => pattern,
32738
32698
  partialWith: () => partialWith,
32739
32699
  partial: () => partial2,
@@ -33353,7 +33313,6 @@ var value = (self) => {
33353
33313
  throw new Error("Unable to get redacted value");
33354
33314
  }
33355
33315
  };
33356
- var unsafeWipe = (self) => redactedRegistry.delete(self);
33357
33316
 
33358
33317
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/internal/secret.js
33359
33318
  var SecretSymbolKey = "effect/Secret";
@@ -33440,7 +33399,7 @@ var isUtc2 = isUtc;
33440
33399
  var isZoned2 = isZoned;
33441
33400
  var Equivalence4 = Equivalence2;
33442
33401
  var unsafeFromDate2 = unsafeFromDate;
33443
- var unsafeMake12 = unsafeMake8;
33402
+ var unsafeMake11 = unsafeMake7;
33444
33403
  var unsafeMakeZoned2 = unsafeMakeZoned;
33445
33404
  var makeZonedFromString2 = makeZonedFromString;
33446
33405
  var zoneUnsafeMakeNamed2 = zoneUnsafeMakeNamed;
@@ -34654,24 +34613,13 @@ var MaxItemsSchemaId = /* @__PURE__ */ Symbol.for("effect/SchemaId/MaxItems");
34654
34613
  var ItemsCountSchemaId = /* @__PURE__ */ Symbol.for("effect/SchemaId/ItemsCount");
34655
34614
 
34656
34615
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Redacted.js
34657
- var exports_Redacted = {};
34658
- __export(exports_Redacted, {
34659
- value: () => value2,
34660
- unsafeWipe: () => unsafeWipe2,
34661
- make: () => make52,
34662
- isRedacted: () => isRedacted2,
34663
- getEquivalence: () => getEquivalence7,
34664
- RedactedTypeId: () => RedactedTypeId2
34665
- });
34666
- var RedactedTypeId2 = RedactedTypeId;
34667
34616
  var isRedacted2 = isRedacted;
34668
34617
  var make52 = make49;
34669
34618
  var value2 = value;
34670
- var unsafeWipe2 = unsafeWipe;
34671
34619
  var getEquivalence7 = (isEquivalent) => make((x, y) => isEquivalent(value2(x), value2(y)));
34672
34620
 
34673
34621
  // ../../node_modules/.bun/effect@3.21.2/node_modules/effect/dist/esm/Struct.js
34674
- var pick4 = /* @__PURE__ */ dual((args2) => isObject(args2[0]), (s, ...keys6) => {
34622
+ var pick3 = /* @__PURE__ */ dual((args2) => isObject(args2[0]), (s, ...keys6) => {
34675
34623
  const out = {};
34676
34624
  for (const k of keys6) {
34677
34625
  if (k in s) {
@@ -35518,7 +35466,7 @@ function makeTypeLiteralClass(fields, records, ast = getDefaultTypeLiteralAST(fi
35518
35466
  return getDisableValidationMakeOption(options) ? propsWithDefaults : validateSync(this)(propsWithDefaults);
35519
35467
  };
35520
35468
  static pick(...keys6) {
35521
- return Struct(pick4(fields, ...keys6));
35469
+ return Struct(pick3(fields, ...keys6));
35522
35470
  }
35523
35471
  static omit(...keys6) {
35524
35472
  return Struct(omit4(fields, ...keys6));
@@ -35546,12 +35494,12 @@ function makeRecordClass(key, value3, ast) {
35546
35494
  };
35547
35495
  }
35548
35496
  var Record = (options) => makeRecordClass(options.key, options.value);
35549
- var pick5 = (...keys6) => (self) => make53(pick3(self.ast, keys6));
35497
+ var pick4 = (...keys6) => (self) => make53(pick2(self.ast, keys6));
35550
35498
  var omit5 = (...keys6) => (self) => make53(omit3(self.ast, keys6));
35551
35499
  var pluck = /* @__PURE__ */ dual(2, (schema, key) => {
35552
35500
  const ps = getPropertyKeyIndexedAccess(typeAST(schema.ast), key);
35553
35501
  const value3 = make53(ps.isOptional ? orUndefined(ps.type) : ps.type);
35554
- const out = transform2(schema.pipe(pick5(key)), value3, {
35502
+ const out = transform2(schema.pipe(pick4(key)), value3, {
35555
35503
  strict: true,
35556
35504
  decode: (i) => i[key],
35557
35505
  encode: (a) => ps.isOptional && a === undefined ? {} : {
@@ -36909,7 +36857,7 @@ class DateTimeUtcFromSelf extends (/* @__PURE__ */ declare((u) => isDateTime2(u)
36909
36857
  })) {
36910
36858
  }
36911
36859
  var decodeDateTimeUtc = (input, ast) => _try({
36912
- try: () => unsafeMake12(input),
36860
+ try: () => unsafeMake11(input),
36913
36861
  catch: () => new Type2(ast, input, `Unable to decode ${formatUnknown(input)} into a DateTime.Utc`)
36914
36862
  });
36915
36863
 
@@ -47091,7 +47039,7 @@ var redact2 = /* @__PURE__ */ dual(2, (self, key) => {
47091
47039
  }
47092
47040
  return out;
47093
47041
  });
47094
- var currentRedactedNames = /* @__PURE__ */ globalValue("@effect/platform/Headers/currentRedactedNames", () => unsafeMake10(["authorization", "cookie", "set-cookie", "x-api-key"]));
47042
+ var currentRedactedNames = /* @__PURE__ */ globalValue("@effect/platform/Headers/currentRedactedNames", () => unsafeMake9(["authorization", "cookie", "set-cookie", "x-api-key"]));
47095
47043
 
47096
47044
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/internal/httpClientError.js
47097
47045
  var TypeId28 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpClientError");
@@ -47688,9 +47636,9 @@ var ATTR_URL_SCHEME = "url.scheme";
47688
47636
  var ATTR_URL_QUERY = "url.query";
47689
47637
  var TypeId34 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpClient");
47690
47638
  var tag5 = /* @__PURE__ */ GenericTag("@effect/platform/HttpClient");
47691
- var currentTracerDisabledWhen = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("@effect/platform/HttpClient/tracerDisabledWhen"), () => unsafeMake10(constFalse));
47639
+ var currentTracerDisabledWhen = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("@effect/platform/HttpClient/tracerDisabledWhen"), () => unsafeMake9(constFalse));
47692
47640
  var withTracerDisabledWhen = /* @__PURE__ */ dual(2, (self, pred) => transformResponse(self, locally(currentTracerDisabledWhen, pred)));
47693
- var currentTracerPropagation = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("@effect/platform/HttpClient/currentTracerPropagation"), () => unsafeMake10(true));
47641
+ var currentTracerPropagation = /* @__PURE__ */ globalValue(/* @__PURE__ */ Symbol.for("@effect/platform/HttpClient/currentTracerPropagation"), () => unsafeMake9(true));
47694
47642
  var withTracerPropagation = /* @__PURE__ */ dual(2, (self, enabled2) => transformResponse(self, locally(currentTracerPropagation, enabled2)));
47695
47643
  var SpanNameGenerator = /* @__PURE__ */ Reference2()("@effect/platform/HttpClient/SpanNameGenerator", {
47696
47644
  defaultValue: () => (request2) => `http.client ${request2.method}`
@@ -48575,7 +48523,7 @@ var Proto6 = {
48575
48523
  return pipeArguments(this, arguments);
48576
48524
  }
48577
48525
  };
48578
- var unsafeMake13 = (backing, deferred) => {
48526
+ var unsafeMake12 = (backing, deferred) => {
48579
48527
  const self = Object.create(Proto6);
48580
48528
  self.state = {
48581
48529
  _tag: "Open",
@@ -48584,7 +48532,7 @@ var unsafeMake13 = (backing, deferred) => {
48584
48532
  self.deferred = deferred;
48585
48533
  return self;
48586
48534
  };
48587
- var make70 = () => acquireRelease2(map17(make40(), (deferred) => unsafeMake13(new Set, deferred)), (set11) => withFiberRuntime2((parent) => {
48535
+ var make70 = () => acquireRelease2(map17(make40(), (deferred) => unsafeMake12(new Set, deferred)), (set11) => withFiberRuntime2((parent) => {
48588
48536
  const state = set11.state;
48589
48537
  if (state._tag === "Closed")
48590
48538
  return _void;
@@ -49124,46 +49072,8 @@ class AdditionalSchemas extends (/* @__PURE__ */ Tag2("@effect/platform/HttpApi/
49124
49072
  }
49125
49073
 
49126
49074
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpApiMiddleware.js
49127
- var exports_HttpApiMiddleware = {};
49128
- __export(exports_HttpApiMiddleware, {
49129
- isSecurity: () => isSecurity,
49130
- TypeId: () => TypeId42,
49131
- Tag: () => Tag5,
49132
- SecurityTypeId: () => SecurityTypeId
49133
- });
49134
- var TypeId42 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiMiddleware");
49135
49075
  var SecurityTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiMiddleware/Security");
49136
49076
  var isSecurity = (u) => hasProperty(u, SecurityTypeId);
49137
- var Tag5 = () => (id2, options7) => {
49138
- const Err = globalThis.Error;
49139
- const limit = Err.stackTraceLimit;
49140
- Err.stackTraceLimit = 2;
49141
- const creationError = new Err;
49142
- Err.stackTraceLimit = limit;
49143
- function TagClass() {}
49144
- const TagClass_ = TagClass;
49145
- Object.setPrototypeOf(TagClass, Object.getPrototypeOf(GenericTag(id2)));
49146
- TagClass.key = id2;
49147
- Object.defineProperty(TagClass, "stack", {
49148
- get() {
49149
- return creationError.stack;
49150
- }
49151
- });
49152
- TagClass_[TypeId42] = TypeId42;
49153
- TagClass_.failure = options7?.optional === true || options7?.failure === undefined ? Never : options7.failure;
49154
- if (options7?.provides) {
49155
- TagClass_.provides = options7.provides;
49156
- }
49157
- TagClass_.optional = options7?.optional ?? false;
49158
- if (options7?.security) {
49159
- if (Object.keys(options7.security).length === 0) {
49160
- throw new Error("HttpApiMiddleware.Tag: security object must not be empty");
49161
- }
49162
- TagClass_[SecurityTypeId] = SecurityTypeId;
49163
- TagClass_.security = options7.security;
49164
- }
49165
- return TagClass;
49166
- };
49167
49077
 
49168
49078
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/internal/httpRouter.js
49169
49079
  var removeTrailingSlash = (path2) => path2.endsWith("/") ? path2.slice(0, -1) : path2;
@@ -50412,7 +50322,7 @@ __export(exports_BunContext, {
50412
50322
  });
50413
50323
 
50414
50324
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/internal/commandExecutor.js
50415
- var TypeId44 = /* @__PURE__ */ Symbol.for("@effect/platform/CommandExecutor");
50325
+ var TypeId43 = /* @__PURE__ */ Symbol.for("@effect/platform/CommandExecutor");
50416
50326
  var ProcessTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/Process");
50417
50327
  var ExitCode = /* @__PURE__ */ nominal();
50418
50328
  var ProcessId = /* @__PURE__ */ nominal();
@@ -50424,7 +50334,7 @@ var makeExecutor = (start3) => {
50424
50334
  return splitLines3(mapChunks2(stream5(command), map5((bytes) => decoder2.decode(bytes))));
50425
50335
  };
50426
50336
  return {
50427
- [TypeId44]: TypeId44,
50337
+ [TypeId43]: TypeId43,
50428
50338
  start: start3,
50429
50339
  exitCode: (command) => scoped2(flatMap10(start3(command), (process2) => process2.exitCode)),
50430
50340
  stream: stream5,
@@ -51420,161 +51330,185 @@ var runMain2 = runMain;
51420
51330
 
51421
51331
  // ../../node_modules/.bun/@effect+platform-bun@0.89.0+15f69c4693c05b6b/node_modules/@effect/platform-bun/dist/esm/BunRuntime.js
51422
51332
  var runMain3 = runMain2;
51423
- // src/auth/device-flow.ts
51333
+ // src/github/issues.ts
51424
51334
  import { execFileSync } from "child_process";
51425
- import { setTimeout as sleep5 } from "timers/promises";
51426
-
51427
- // src/auth/store.ts
51428
- import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
51429
- import { homedir } from "os";
51430
- import path2 from "path";
51431
- var authFileName = "auth.json";
51432
-
51433
- class AuthCredential extends Class6("AuthCredential")({
51434
- accessToken: String$,
51435
- authenticatedAt: String$,
51436
- authBaseUrl: optional(String$),
51437
- expiresAt: optional(String$)
51438
- }) {
51439
- }
51440
- var AuthCredentialJson = parseJson(AuthCredential);
51441
- var decodeAuthCredential = decodeUnknownSync(AuthCredentialJson);
51442
- var encodeAuthCredential = encodeSync(AuthCredentialJson);
51443
- var authConfigDirectory = () => process.env.DP_AUTH_CONFIG_HOME ?? path2.join(process.env.XDG_CONFIG_HOME ?? path2.join(homedir(), ".config"), "devpunks");
51444
- var authConfigPath = () => process.env.DP_AUTH_CONFIG_FILE ?? path2.join(authConfigDirectory(), authFileName);
51445
- var readAuthCredential = () => {
51446
- const filePath = authConfigPath();
51447
- if (!existsSync(filePath)) {
51448
- return null;
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;
51449
51340
  }
51450
51341
  try {
51451
- return decodeAuthCredential(readFileSync(filePath, "utf8"));
51342
+ return execFileSync("gh", ["auth", "token"], {
51343
+ encoding: "utf8",
51344
+ stdio: ["ignore", "pipe", "ignore"]
51345
+ }).trim();
51452
51346
  } catch {
51453
- return null;
51347
+ return;
51454
51348
  }
51455
51349
  };
51456
- var writeAuthCredential = (credential) => {
51457
- const filePath = authConfigPath();
51458
- mkdirSync(path2.dirname(filePath), { recursive: true, mode: 448 });
51459
- writeFileSync(filePath, `${encodeAuthCredential(credential)}
51460
- `, {
51461
- encoding: "utf8",
51462
- mode: 384
51463
- });
51464
- };
51465
- var clearAuthCredential = () => {
51466
- const filePath = authConfigPath();
51467
- if (!existsSync(filePath)) {
51468
- return false;
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.");
51469
51360
  }
51470
- rmSync(filePath, { force: true });
51471
- return true;
51361
+ return { owner, repo };
51472
51362
  };
51473
- var controlPlaneBearerToken = () => {
51474
- const envToken = process.env.DP_CONTROL_PLANE_TOKEN;
51475
- if (envToken !== undefined && envToken.length > 0) {
51476
- return envToken;
51363
+ var labelColor = (label) => {
51364
+ if (label === "harness-report") {
51365
+ return "5319e7";
51477
51366
  }
51478
- return readAuthCredential()?.accessToken;
51479
- };
51480
-
51481
- // src/auth/device-flow.ts
51482
- var deviceGrantType = "urn:ietf:params:oauth:grant-type:device_code";
51483
- var trimTrailingSlash = (value6) => value6.replace(/\/+$/u, "");
51484
- var authEndpoint = (authBaseUrl, path3) => `${trimTrailingSlash(authBaseUrl)}${path3}`;
51485
- var readJson = async (response) => {
51486
- const value6 = await response.json();
51487
- if (!response.ok) {
51488
- throw new Error(`Auth request failed with HTTP ${response.status}.`);
51367
+ if (label.startsWith("severity:")) {
51368
+ return "d93f0b";
51489
51369
  }
51490
- return value6;
51491
- };
51492
- var readDeviceToken = async (response) => {
51493
- const value6 = await response.json();
51494
- if (!response.ok && value6.error === undefined) {
51495
- throw new Error(`Auth request failed with HTTP ${response.status}.`);
51370
+ if (label.startsWith("type:")) {
51371
+ return "1d76db";
51496
51372
  }
51497
- return value6;
51498
- };
51499
- var openInBrowser = (url2) => {
51500
- const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
51501
- const args2 = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
51502
- execFileSync(command, args2, { stdio: "ignore" });
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";
51503
51380
  };
51504
- var performDeviceLogin = async ({
51505
- authBaseUrl,
51506
- clientId,
51507
- scope: scope5,
51508
- openBrowser = true,
51509
- timeoutMs = 5 * 60 * 1000,
51510
- fetch: fetchImpl = fetch,
51511
- sleep: sleepImpl = sleep5,
51512
- openUrl = openInBrowser,
51513
- now: now2 = () => new Date,
51514
- onMessage
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
51515
51386
  }) => {
51516
- const code2 = await readJson(await fetchImpl(authEndpoint(authBaseUrl, "/device/code"), {
51387
+ const { owner, repo } = parseRepository(repository);
51388
+ const response = await fetch(`${githubApiBaseUrl}/repos/${owner}/${repo}/labels`, {
51517
51389
  method: "POST",
51518
- headers: { "content-type": "application/json" },
51390
+ headers: githubHeaders(token),
51519
51391
  body: JSON.stringify({
51520
- client_id: clientId,
51521
- ...scope5 === undefined || scope5.length === 0 ? {} : { scope: scope5 }
51392
+ name: label,
51393
+ color: labelColor(label),
51394
+ description: labelDescription(label)
51522
51395
  })
51523
- }));
51524
- const verificationUrl = code2.verification_uri_complete ?? code2.verification_uri;
51525
- onMessage?.(`Open ${verificationUrl} and enter code ${code2.user_code}.`);
51526
- if (openBrowser) {
51527
- try {
51528
- openUrl(verificationUrl);
51529
- } catch {
51530
- onMessage?.("Could not open the browser automatically. Open the URL above manually.");
51531
- }
51532
- }
51533
- const startedAt = now2().getTime();
51534
- const authorizationTimeoutMs = code2.expires_in === undefined ? timeoutMs : Math.max(code2.expires_in, 0) * 1000;
51535
- const deadline = startedAt + authorizationTimeoutMs;
51536
- let intervalMs = Math.max(code2.interval ?? 5, 1) * 1000;
51537
- while (now2().getTime() < deadline) {
51538
- await sleepImpl(intervalMs);
51539
- const token = await readDeviceToken(await fetchImpl(authEndpoint(authBaseUrl, "/device/token"), {
51540
- method: "POST",
51541
- headers: { "content-type": "application/json" },
51542
- body: JSON.stringify({
51543
- grant_type: deviceGrantType,
51544
- device_code: code2.device_code,
51545
- client_id: clientId
51546
- })
51547
- }));
51548
- if (token.access_token !== undefined && token.access_token.length > 0) {
51549
- const authenticatedAt = now2();
51550
- const expiresAt = token.expires_in === undefined ? undefined : new Date(authenticatedAt.getTime() + token.expires_in * 1000).toISOString();
51551
- return new AuthCredential({
51552
- accessToken: token.access_token,
51553
- authenticatedAt: authenticatedAt.toISOString(),
51554
- authBaseUrl,
51555
- ...expiresAt === undefined ? {} : { expiresAt }
51556
- });
51557
- }
51558
- switch (token.error) {
51559
- case "authorization_pending":
51560
- break;
51561
- case "slow_down":
51562
- intervalMs += 5000;
51563
- break;
51564
- case "access_denied":
51565
- throw new Error("Device authorization was denied.");
51566
- case "expired_token":
51567
- throw new Error("Device authorization expired. Run `punks auth login` again.");
51568
- default:
51569
- throw new Error(token.error_description ?? "Device authorization failed.");
51570
- }
51396
+ });
51397
+ if (response.ok || response.status === 422) {
51398
+ return;
51571
51399
  }
51572
- throw new Error("Device authorization timed out.");
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
+ };
51573
51433
  };
51574
51434
 
51575
51435
  // src/telemetry/product.ts
51576
51436
  import { randomUUID } from "crypto";
51577
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
+ };
51578
51512
  // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpApiClient.js
51579
51513
  var exports_HttpApiClient = {};
51580
51514
  __export(exports_HttpApiClient, {
@@ -51864,12 +51798,12 @@ __export(exports_HttpApiEndpoint, {
51864
51798
  head: () => head12,
51865
51799
  get: () => get22,
51866
51800
  del: () => del6,
51867
- TypeId: () => TypeId45
51801
+ TypeId: () => TypeId44
51868
51802
  });
51869
- var TypeId45 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiEndpoint");
51870
- var isHttpApiEndpoint = (u) => hasProperty(u, TypeId45);
51803
+ var TypeId44 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiEndpoint");
51804
+ var isHttpApiEndpoint = (u) => hasProperty(u, TypeId44);
51871
51805
  var Proto9 = {
51872
- [TypeId45]: TypeId45,
51806
+ [TypeId44]: TypeId44,
51873
51807
  pipe() {
51874
51808
  return pipeArguments(this, arguments);
51875
51809
  },
@@ -51998,12 +51932,12 @@ var exports_HttpApiGroup = {};
51998
51932
  __export(exports_HttpApiGroup, {
51999
51933
  make: () => make77,
52000
51934
  isHttpApiGroup: () => isHttpApiGroup,
52001
- TypeId: () => TypeId46
51935
+ TypeId: () => TypeId45
52002
51936
  });
52003
- var TypeId46 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiGroup");
52004
- var isHttpApiGroup = (u) => hasProperty(u, TypeId46);
51937
+ var TypeId45 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiGroup");
51938
+ var isHttpApiGroup = (u) => hasProperty(u, TypeId45);
52005
51939
  var Proto10 = {
52006
- [TypeId46]: TypeId46,
51940
+ [TypeId45]: TypeId45,
52007
51941
  add(endpoint2) {
52008
51942
  return makeProto4({
52009
51943
  identifier: this.identifier,
@@ -52116,49 +52050,10 @@ var make77 = (identifier2, options9) => makeProto4({
52116
52050
  annotations: empty6(),
52117
52051
  middlewares: new Set
52118
52052
  });
52119
- // ../../node_modules/.bun/@effect+platform@0.96.1+941c8e2324531656/node_modules/@effect/platform/dist/esm/HttpApiSecurity.js
52120
- var exports_HttpApiSecurity = {};
52121
- __export(exports_HttpApiSecurity, {
52122
- bearer: () => bearer,
52123
- basic: () => basic,
52124
- apiKey: () => apiKey,
52125
- annotateContext: () => annotateContext,
52126
- annotate: () => annotate3,
52127
- TypeId: () => TypeId47
52128
- });
52129
- var TypeId47 = /* @__PURE__ */ Symbol.for("@effect/platform/HttpApiSecurity");
52130
- var Proto11 = {
52131
- [TypeId47]: TypeId47,
52132
- pipe() {
52133
- return pipeArguments(this, arguments);
52134
- }
52135
- };
52136
- var bearer = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Proto11), {
52137
- _tag: "Bearer",
52138
- annotations: /* @__PURE__ */ empty6()
52139
- });
52140
- var apiKey = (options9) => Object.assign(Object.create(Proto11), {
52141
- _tag: "ApiKey",
52142
- key: options9.key,
52143
- in: options9.in ?? "header",
52144
- annotations: empty6()
52145
- });
52146
- var basic = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(Proto11), {
52147
- _tag: "Basic",
52148
- annotations: /* @__PURE__ */ empty6()
52149
- });
52150
- var annotateContext = /* @__PURE__ */ dual(2, (self, context8) => Object.assign(Object.create(Proto11), {
52151
- ...self,
52152
- annotations: merge3(self.annotations, context8)
52153
- }));
52154
- var annotate3 = /* @__PURE__ */ dual(3, (self, tag6, value6) => Object.assign(Object.create(Proto11), {
52155
- ...self,
52156
- annotations: add2(self.annotations, tag6, value6)
52157
- }));
52158
52053
  // ../../packages/contract/src/errors.ts
52159
52054
  class Unauthorized extends exports_Schema.TaggedError()("@punks/contract/errors/Unauthorized", {
52160
52055
  message: exports_Schema.optionalWith(exports_Schema.String, {
52161
- default: () => "Bearer credentials are required."
52056
+ default: () => "Backoffice session is required."
52162
52057
  })
52163
52058
  }, exports_HttpApiSchema.annotations({ status: 401, title: "Unauthorized" })) {
52164
52059
  }
@@ -52280,7 +52175,7 @@ class BackofficeAccessInviteRequest extends exports_Schema.Class("BackofficeAcce
52280
52175
  role: BackofficeAccessRole
52281
52176
  }) {
52282
52177
  }
52283
- var ProductTelemetryEventName = exports_Schema.Literal("cli.auth.login.completed", "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");
52284
52179
  var TelemetrySource = exports_Schema.Literal("normal", "local-dev", "ci", "debug", "test");
52285
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;
52286
52181
  var isValidIsoDateTime = (value6) => {
@@ -52461,33 +52356,20 @@ class BackofficeReportUpdateRequest extends exports_Schema.Class("BackofficeRepo
52461
52356
  }) {
52462
52357
  }
52463
52358
 
52464
- // ../../packages/contract/src/security.ts
52465
- class CurrentOperator extends exports_Context.Tag("@punks/contract/CurrentOperator")() {
52466
- }
52467
-
52468
- class CliBearerAuth extends exports_HttpApiMiddleware.Tag()("@punks/contract/CliBearerAuth", {
52469
- security: {
52470
- bearer: exports_HttpApiSecurity.bearer
52471
- },
52472
- provides: CurrentOperator,
52473
- failure: Unauthorized
52474
- }) {
52475
- }
52476
-
52477
52359
  // ../../packages/contract/src/api.ts
52478
52360
  class HealthApi extends exports_HttpApiGroup.make("health", { topLevel: true }).add(exports_HttpApiEndpoint.get("healthz")`/healthz`.addSuccess(exports_HttpApiSchema.NoContent.annotations({ description: "Empty health response" }))) {
52479
52361
  }
52480
52362
 
52481
- class BaselineApi extends exports_HttpApiGroup.make("baseline").add(exports_HttpApiEndpoint.get("resolve")`/${exports_HttpApiSchema.param("channel", BaselineChannel)}`.addSuccess(BaselineResolution).addError(BaselineNotFound).addError(ControlPlaneUnavailable)).add(exports_HttpApiEndpoint.get("artifact")`/${exports_HttpApiSchema.param("channel", BaselineChannel)}/artifacts/${exports_HttpApiSchema.param("kind", ArtifactKind)}`.addSuccess(ArtifactMetadata).addError(BaselineNotFound).addError(ControlPlaneUnavailable)).middleware(CliBearerAuth).prefix("/baselines").annotateContext(exports_OpenApi.annotations({ title: "Baseline control plane" })) {
52363
+ class BaselineApi extends exports_HttpApiGroup.make("baseline").add(exports_HttpApiEndpoint.get("resolve")`/${exports_HttpApiSchema.param("channel", BaselineChannel)}`.addSuccess(BaselineResolution).addError(BaselineNotFound).addError(ControlPlaneUnavailable)).add(exports_HttpApiEndpoint.get("artifact")`/${exports_HttpApiSchema.param("channel", BaselineChannel)}/artifacts/${exports_HttpApiSchema.param("kind", ArtifactKind)}`.addSuccess(ArtifactMetadata).addError(BaselineNotFound).addError(ControlPlaneUnavailable)).prefix("/baselines").annotateContext(exports_OpenApi.annotations({ title: "Baseline control plane" })) {
52482
52364
  }
52483
52365
 
52484
- class TelemetryApi extends exports_HttpApiGroup.make("telemetry").add(exports_HttpApiEndpoint.post("record")`/events`.setPayload(ProductTelemetryEventInput).addSuccess(ProductTelemetryEventAccepted).addError(TelemetryEventRejected).addError(TelemetryPersistenceUnavailable)).middleware(CliBearerAuth).prefix("/telemetry").annotateContext(exports_OpenApi.annotations({ title: "Product telemetry" })) {
52366
+ class TelemetryApi extends exports_HttpApiGroup.make("telemetry").add(exports_HttpApiEndpoint.post("record")`/events`.setPayload(ProductTelemetryEventInput).addSuccess(ProductTelemetryEventAccepted).addError(TelemetryEventRejected).addError(TelemetryPersistenceUnavailable)).prefix("/telemetry").annotateContext(exports_OpenApi.annotations({ title: "Product telemetry" })) {
52485
52367
  }
52486
52368
 
52487
- class ReportsApi extends exports_HttpApiGroup.make("reports").add(exports_HttpApiEndpoint.post("submit")`/`.setPayload(HarnessReportInput).addSuccess(HarnessReportCreated).addError(HarnessReportRejected).addError(HarnessReportPersistenceUnavailable)).middleware(CliBearerAuth).prefix("/reports").annotateContext(exports_OpenApi.annotations({ title: "Harness reports" })) {
52369
+ class ReportsApi extends exports_HttpApiGroup.make("reports").add(exports_HttpApiEndpoint.post("submit")`/`.setPayload(HarnessReportInput).addSuccess(HarnessReportCreated).addError(HarnessReportRejected).addError(HarnessReportPersistenceUnavailable)).prefix("/reports").annotateContext(exports_OpenApi.annotations({ title: "Harness reports" })) {
52488
52370
  }
52489
52371
 
52490
- class BackofficeApi extends exports_HttpApiGroup.make("backoffice").add(exports_HttpApiEndpoint.get("currentAccess")`/access/current`.addSuccess(BackofficeAccessSummary).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.get("accessList")`/access-users`.addSuccess(BackofficeAccessList).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.post("inviteAccess")`/access-users`.setPayload(BackofficeAccessInviteRequest).addSuccess(BackofficeAccessSummary).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.post("revokeAccess")`/access-users/${exports_HttpApiSchema.param("email", exports_Schema.String)}/revoke`.addSuccess(BackofficeAccessSummary).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.get("projectUsageList")`/project-usages`.addSuccess(ProjectUsageList).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.get("projectUsageDetail")`/project-usages/${exports_HttpApiSchema.param("projectUsageId", exports_Schema.String)}`.addSuccess(ProjectUsageDetail).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.post("mapRepository")`/project-usages/${exports_HttpApiSchema.param("projectUsageId", exports_Schema.String)}/repositories`.setPayload(BackofficeRepositoryMappingRequest).addSuccess(ObservedRepositorySummary).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.patch("updateReport")`/reports/${exports_HttpApiSchema.param("reportId", exports_Schema.String)}`.setPayload(BackofficeReportUpdateRequest).addSuccess(HarnessReportSummary).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).middleware(CliBearerAuth).prefix("/backoffice").annotateContext(exports_OpenApi.annotations({ title: "Backoffice project usage" })) {
52372
+ class BackofficeApi extends exports_HttpApiGroup.make("backoffice").add(exports_HttpApiEndpoint.get("currentAccess")`/access/current`.addSuccess(BackofficeAccessSummary).addError(Unauthorized).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.get("accessList")`/access-users`.addSuccess(BackofficeAccessList).addError(Unauthorized).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.post("inviteAccess")`/access-users`.setPayload(BackofficeAccessInviteRequest).addSuccess(BackofficeAccessSummary).addError(Unauthorized).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.post("revokeAccess")`/access-users/${exports_HttpApiSchema.param("email", exports_Schema.String)}/revoke`.addSuccess(BackofficeAccessSummary).addError(Unauthorized).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.get("projectUsageList")`/project-usages`.addSuccess(ProjectUsageList).addError(Unauthorized).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.get("projectUsageDetail")`/project-usages/${exports_HttpApiSchema.param("projectUsageId", exports_Schema.String)}`.addSuccess(ProjectUsageDetail).addError(Unauthorized).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.post("mapRepository")`/project-usages/${exports_HttpApiSchema.param("projectUsageId", exports_Schema.String)}/repositories`.setPayload(BackofficeRepositoryMappingRequest).addSuccess(ObservedRepositorySummary).addError(Unauthorized).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).add(exports_HttpApiEndpoint.patch("updateReport")`/reports/${exports_HttpApiSchema.param("reportId", exports_Schema.String)}`.setPayload(BackofficeReportUpdateRequest).addSuccess(HarnessReportSummary).addError(Unauthorized).addError(BackofficeRequestRejected).addError(BackofficePersistenceUnavailable)).prefix("/backoffice").annotateContext(exports_OpenApi.annotations({ title: "Backoffice project usage" })) {
52491
52373
  }
52492
52374
 
52493
52375
  class HarnessApi extends exports_HttpApi.make("harness").add(HealthApi).add(BaselineApi).add(TelemetryApi).add(ReportsApi).add(BackofficeApi).addError(Forbidden2).prefix("/api").annotateContext(exports_OpenApi.annotations({
@@ -52496,15 +52378,14 @@ class HarnessApi extends exports_HttpApi.make("harness").add(HealthApi).add(Base
52496
52378
  })) {
52497
52379
  }
52498
52380
  // ../../packages/contract/src/client.ts
52499
- var makeHarnessClient = ({ baseUrl: baseUrl2, bearerToken: bearerToken3 }) => exports_HttpApiClient.make(HarnessApi, {
52381
+ var makeHarnessClient = ({ baseUrl: baseUrl2, headers }) => exports_HttpApiClient.make(HarnessApi, {
52500
52382
  baseUrl: baseUrl2,
52501
- transformClient: bearerToken3 === undefined || bearerToken3.length === 0 ? undefined : exports_HttpClient.mapRequest(exports_HttpClientRequest.bearerToken(exports_Redacted.make(bearerToken3)))
52383
+ transformClient: (client) => headers === undefined ? client : client.pipe(exports_HttpClient.mapRequest(exports_HttpClientRequest.setHeaders(headers)))
52502
52384
  }).pipe(exports_Effect.provide(exports_FetchHttpClient.layer));
52503
52385
  // src/control-plane/client.ts
52504
52386
  var resolveStableBaselineMetadata = (options9) => exports_Effect.gen(function* () {
52505
52387
  const client2 = yield* makeHarnessClient({
52506
- baseUrl: options9.baseUrl,
52507
- bearerToken: options9.bearerToken
52388
+ baseUrl: options9.baseUrl
52508
52389
  });
52509
52390
  return yield* client2.baseline.resolve({
52510
52391
  path: { channel: "stable" }
@@ -52512,26 +52393,16 @@ var resolveStableBaselineMetadata = (options9) => exports_Effect.gen(function* (
52512
52393
  });
52513
52394
  var recordProductTelemetryEvent = (options9) => exports_Effect.gen(function* () {
52514
52395
  const client2 = yield* makeHarnessClient({
52515
- baseUrl: options9.baseUrl,
52516
- bearerToken: options9.bearerToken
52396
+ baseUrl: options9.baseUrl
52517
52397
  });
52518
52398
  return yield* client2.telemetry.record({
52519
52399
  payload: options9.event
52520
52400
  });
52521
52401
  });
52522
- var submitHarnessReport = (options9) => exports_Effect.gen(function* () {
52523
- const client2 = yield* makeHarnessClient({
52524
- baseUrl: options9.baseUrl,
52525
- bearerToken: options9.bearerToken
52526
- });
52527
- return yield* client2.reports.submit({
52528
- payload: options9.report
52529
- });
52530
- });
52531
52402
 
52532
52403
  // package.json
52533
52404
  var name = "@punks/cli";
52534
- var version = "2.1.0";
52405
+ var version = "2.1.2";
52535
52406
  // src/telemetry/product.ts
52536
52407
  var git = (cwd, args2) => {
52537
52408
  try {
@@ -52595,7 +52466,7 @@ var isLocalControlPlaneUrl = (value6) => {
52595
52466
  return value6.includes("localhost") || value6.includes(".localhost");
52596
52467
  }
52597
52468
  };
52598
- var telemetrySource = () => {
52469
+ var telemetrySource = (controlPlaneUrl = process.env.DP_CONTROL_PLANE_URL) => {
52599
52470
  if (process.env.CI !== undefined) {
52600
52471
  return "ci";
52601
52472
  }
@@ -52605,7 +52476,7 @@ var telemetrySource = () => {
52605
52476
  if (process.env.VITEST !== undefined) {
52606
52477
  return "test";
52607
52478
  }
52608
- if (isLocalControlPlaneUrl(process.env.DP_CONTROL_PLANE_URL)) {
52479
+ if (isLocalControlPlaneUrl(controlPlaneUrl)) {
52609
52480
  return "local-dev";
52610
52481
  }
52611
52482
  return "normal";
@@ -52613,41 +52484,36 @@ var telemetrySource = () => {
52613
52484
  var makeProductTelemetryEvent = ({
52614
52485
  name: name2,
52615
52486
  cwd,
52616
- baseline
52487
+ baseline,
52488
+ controlPlaneUrl
52617
52489
  }) => ({
52618
52490
  eventId: randomUUID(),
52619
52491
  name: name2,
52620
52492
  occurredAt: new Date().toISOString(),
52621
52493
  cliVersion: version,
52622
- source: telemetrySource(),
52494
+ source: telemetrySource(controlPlaneUrl),
52623
52495
  repository: observedRepository(cwd),
52624
52496
  ...baseline === undefined ? {} : { baseline }
52625
52497
  });
52626
- var submitProductTelemetryEffect = (event) => {
52627
- const baseUrl2 = process.env.DP_CONTROL_PLANE_URL;
52628
- 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) {
52629
52502
  return exports_Effect.void;
52630
52503
  }
52631
52504
  return recordProductTelemetryEvent({
52632
52505
  baseUrl: baseUrl2,
52633
- bearerToken: controlPlaneBearerToken(),
52634
52506
  event
52635
52507
  }).pipe(exports_Effect.asVoid, exports_Effect.catchAll(() => exports_Effect.void));
52636
52508
  };
52637
- var telemetryTransportEnabled = () => process.env.DP_CONTROL_PLANE_URL !== undefined && process.env.DP_CONTROL_PLANE_URL.trim().length > 0;
52638
- var submitProductTelemetry = (event) => {
52639
- exports_Effect.runPromise(submitProductTelemetryEffect(event));
52640
- };
52509
+ var telemetryTransportEnabled = (controlPlaneUrl) => telemetryBaseUrl(controlPlaneUrl) !== undefined;
52641
52510
  var makeCliEvent = (name2, options9 = {}) => makeProductTelemetryEvent({
52642
52511
  name: name2,
52643
52512
  cwd: options9.cwd ?? process.cwd(),
52644
- baseline: options9.baseline
52513
+ ...options9.baseline === undefined ? {} : { baseline: options9.baseline },
52514
+ ...options9.controlPlaneUrl === undefined ? {} : { controlPlaneUrl: options9.controlPlaneUrl }
52645
52515
  });
52646
- var submitCliEvent = (name2, options9 = {}) => {
52647
- if (telemetryTransportEnabled()) {
52648
- submitProductTelemetry(makeCliEvent(name2, options9));
52649
- }
52650
- };
52516
+ var submitCliEventEffect = (name2, options9 = {}) => telemetryTransportEnabled(options9.controlPlaneUrl) ? submitProductTelemetryEffect(makeCliEvent(name2, options9), options9.controlPlaneUrl === undefined ? {} : { controlPlaneUrl: options9.controlPlaneUrl }) : exports_Effect.void;
52651
52517
 
52652
52518
  // src/ui/brand.ts
52653
52519
  var reset2 = "\x1B[0m";
@@ -52788,14 +52654,14 @@ var renderCommandGuide = () => [
52788
52654
  title: "Available commands",
52789
52655
  body: [
52790
52656
  "commands:",
52791
- " \u203A punks auth",
52792
- " \u2514 manage CLI credentials for authenticated internal baseline access",
52793
52657
  " \u203A punks report",
52794
52658
  " \u2514 submit structured Harness friction for maintainer triage",
52795
52659
  " \u203A punks scaffold",
52796
52660
  " \u2514 show the scaffold lifecycle index and available setup commands",
52797
52661
  " \u203A punks update",
52798
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",
52799
52665
  "",
52800
52666
  "usage:",
52801
52667
  " \u2022 agents should activate `$dp-cli` before acting on `.devpunks` output",
@@ -52805,7 +52671,7 @@ var renderCommandGuide = () => [
52805
52671
  " \u2022 use `punks scaffold setup` for repo-aware pack detection after repo boilerplate is ready",
52806
52672
  " \u2022 use `punks update` after setup to pull newer scaffolded skills/prompts/manifests/hooks",
52807
52673
  " \u2022 use `punks report` when reusable Harness friction should enter the support loop",
52808
- " \u2022 use `punks auth login` before pulling authenticated internal baselines",
52674
+ " \u2022 reports open GitHub issues; authenticate with `gh auth login` or `GITHUB_TOKEN`",
52809
52675
  "",
52810
52676
  "operator notes:",
52811
52677
  " \u2022 init copies only requirements/backlog skills and the initial wiki structure",
@@ -52844,7 +52710,7 @@ var renderSetupIntro = () => renderCommandIntro({
52844
52710
  "",
52845
52711
  "usage:",
52846
52712
  " \u2022 agents should activate `$dp-cli` before following `.devpunks` handoff artifacts",
52847
- " \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",
52848
52714
  " \u2022 review detected manifests, technologies, and packs before confirming",
52849
52715
  " \u2022 reconcile generic scaffold output with the real repo layout before committing final guidance",
52850
52716
  " \u2022 if detection looks incomplete or suspicious, answer `n` and edit the pack selection before accepting",
@@ -52915,82 +52781,10 @@ var renderQuestion = (value6) => [paint(`${brandPalette.bold}${brandPalette.gree
52915
52781
  var renderJsonLabel = () => paint(`${brandPalette.bold}${brandPalette.lilac}`, "Resolved JSON payload");
52916
52782
  var renderDivider = () => paint(`${brandPalette.dim}${brandPalette.border}`, "\u2500".repeat(sectionWidth));
52917
52783
 
52918
- // src/cli/auth-command.ts
52919
- var tokenOption = exports_Options.optional(exports_Options.text("token").pipe(exports_Options.withDescription("Store an existing bearer token instead of starting device login.")));
52920
- var authUrlOption = exports_Options.optional(exports_Options.text("auth-url").pipe(exports_Options.withDescription("Better Auth base URL. Defaults to DP_AUTH_URL.")));
52921
- var clientIdOption = exports_Options.text("client-id").pipe(exports_Options.withDefault("devpunks-cli"), exports_Options.withDescription("OAuth device-flow client id."));
52922
- var scopeOption = exports_Options.optional(exports_Options.text("scope").pipe(exports_Options.withDescription("Optional OAuth scopes for Better Auth device login.")));
52923
- var noOpenOption = exports_Options.boolean("no-open").pipe(exports_Options.withDescription("Print the verification URL without opening a browser."));
52924
- var nonEmptyText = (value6) => {
52925
- const trimmed2 = value6?.trim();
52926
- return trimmed2 === undefined || trimmed2.length === 0 ? null : trimmed2;
52927
- };
52928
- var authBaseUrl = (authUrl) => nonEmptyText(getOrUndefined(authUrl)) ?? nonEmptyText(process.env.DP_AUTH_URL);
52929
- var authToken = (token) => nonEmptyText(getOrUndefined(token));
52930
- var loginCommand = exports_Command.make("login", {
52931
- token: tokenOption,
52932
- authUrl: authUrlOption,
52933
- clientId: clientIdOption,
52934
- scope: scopeOption,
52935
- noOpen: noOpenOption
52936
- }, ({ token, authUrl, clientId, scope: scope5, noOpen }) => exports_Effect.gen(function* () {
52937
- const configuredAuthBaseUrl = authBaseUrl(authUrl);
52938
- const configuredToken = authToken(token);
52939
- if (isSome2(token) && configuredToken === null) {
52940
- return yield* exports_Effect.fail(new Error("Missing token. Pass a non-empty `--token` value or use device login."));
52941
- }
52942
- const credential = configuredToken !== null ? new AuthCredential({
52943
- accessToken: configuredToken,
52944
- authenticatedAt: new Date().toISOString(),
52945
- ...configuredAuthBaseUrl === null ? {} : { authBaseUrl: configuredAuthBaseUrl }
52946
- }) : yield* exports_Effect.tryPromise({
52947
- try: () => {
52948
- if (configuredAuthBaseUrl === null) {
52949
- throw new Error("Missing auth URL. Pass `--auth-url`, set `DP_AUTH_URL`, or use `--token` for local development.");
52950
- }
52951
- return performDeviceLogin({
52952
- authBaseUrl: configuredAuthBaseUrl,
52953
- clientId,
52954
- scope: getOrUndefined(scope5),
52955
- openBrowser: !noOpen,
52956
- onMessage: (message) => console.log(renderHint(message))
52957
- });
52958
- },
52959
- catch: (cause3) => cause3 instanceof Error ? cause3 : new Error("Auth login failed.")
52960
- });
52961
- writeAuthCredential(credential);
52962
- submitCliEvent("cli.auth.login.completed");
52963
- console.log(renderCommandSection("Auth", [
52964
- "Authenticated CLI credential stored.",
52965
- `Credential file: ${authConfigPath()}`,
52966
- credential.authBaseUrl === undefined ? null : `Auth URL: ${credential.authBaseUrl}`
52967
- ].filter((line4) => line4 !== null).join(`
52968
- `)));
52969
- })).pipe(exports_Command.withDescription("Authenticate the CLI for internal baseline access."));
52970
- var statusCommand = exports_Command.make("status", {}, () => exports_Effect.sync(() => {
52971
- const envToken = process.env.DP_CONTROL_PLANE_TOKEN;
52972
- if (envToken !== undefined && envToken.length > 0) {
52973
- console.log(renderCommandSection("Auth", "Authenticated via DP_CONTROL_PLANE_TOKEN."));
52974
- return;
52975
- }
52976
- const credential = readAuthCredential();
52977
- console.log(renderCommandSection("Auth", credential === null ? "Not authenticated." : [
52978
- "Authenticated.",
52979
- `Credential file: ${authConfigPath()}`,
52980
- `Authenticated at: ${credential.authenticatedAt}`,
52981
- credential.expiresAt === undefined ? null : `Expires at: ${credential.expiresAt}`
52982
- ].filter((line4) => line4 !== null).join(`
52983
- `)));
52984
- })).pipe(exports_Command.withDescription("Show CLI authentication status."));
52985
- var logoutCommand = exports_Command.make("logout", {}, () => exports_Effect.sync(() => {
52986
- const cleared = clearAuthCredential();
52987
- console.log(renderCommandSection("Auth", cleared ? "Stored CLI credential cleared." : "No stored CLI credential found."));
52988
- })).pipe(exports_Command.withDescription("Clear stored CLI authentication."));
52989
- var authCommand = exports_Command.make("auth", {}, () => exports_Effect.sync(() => console.log(renderCommandSection("Auth", "Use auth subcommands to manage CLI credentials.")))).pipe(exports_Command.withDescription("Authenticate the CLI for internal Harness Intelligence resources."), exports_Command.withSubcommands([loginCommand, statusCommand, logoutCommand]));
52990
-
52991
52784
  // src/cli/report-command.ts
52992
- var titleOption = exports_Options.text("title").pipe(exports_Options.withDescription("Short harness friction report title."));
52993
- 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."));
52994
52788
  var typeOption = exports_Options.choice("type", [
52995
52789
  "bug",
52996
52790
  "docs",
@@ -52999,16 +52793,24 @@ var typeOption = exports_Options.choice("type", [
52999
52793
  "other"
53000
52794
  ]).pipe(exports_Options.withDefault("other"), exports_Options.withDescription("Report type."));
53001
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."));
53002
52805
  var repoRootOption = exports_Options.text("repo-root").pipe(exports_Options.withDefault(process.cwd()), exports_Options.withDescription("Repository root used for safe git context."));
53003
- 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.")));
53004
52813
  var jsonOption = exports_Options.boolean("json").pipe(exports_Options.withDescription("Print JSON output."));
53005
- var requiredControlPlaneUrl = () => {
53006
- const baseUrl2 = process.env.DP_CONTROL_PLANE_URL?.trim();
53007
- if (baseUrl2 === undefined || baseUrl2.length === 0) {
53008
- throw new Error("Missing DP_CONTROL_PLANE_URL for harness report submission.");
53009
- }
53010
- return baseUrl2;
53011
- };
53012
52814
  var nonEmpty = (value6, field) => {
53013
52815
  const trimmed2 = value6.trim();
53014
52816
  if (trimmed2.length === 0) {
@@ -53016,13 +52818,15 @@ var nonEmpty = (value6, field) => {
53016
52818
  }
53017
52819
  return trimmed2;
53018
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);
53019
52824
  var buildHarnessReport = ({
53020
52825
  title,
53021
52826
  body,
53022
52827
  type: type2,
53023
52828
  severity,
53024
- repoRoot,
53025
- githubUrl
52829
+ repoRoot
53026
52830
  }) => ({
53027
52831
  title: nonEmpty(title, "title"),
53028
52832
  body: nonEmpty(body, "body"),
@@ -53030,120 +52834,178 @@ var buildHarnessReport = ({
53030
52834
  severity,
53031
52835
  createdAt: new Date().toISOString(),
53032
52836
  cliVersion: version,
53033
- repository: observedRepository(repoRoot),
53034
- ...githubUrl === undefined || githubUrl.trim().length === 0 ? {} : { githubUrl: githubUrl.trim() }
52837
+ repository: observedRepository(repoRoot)
53035
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
+ };
53036
52922
  var reportCommand = exports_Command.make("report", {
53037
52923
  title: titleOption,
53038
52924
  body: bodyOption,
53039
52925
  type: typeOption,
53040
52926
  severity: severityOption,
52927
+ area: areaOption,
53041
52928
  repoRoot: repoRootOption,
53042
- githubUrl: githubUrlOption,
52929
+ repository: repositoryOption,
52930
+ skillPack: skillPackOption,
52931
+ command: commandOption,
52932
+ expected: expectedOption,
52933
+ actual: actualOption,
52934
+ steps: stepsOption,
52935
+ labels: labelsOption,
53043
52936
  json: jsonOption
53044
- }, ({ 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({
53045
52953
  try: async () => {
53046
- const report = buildHarnessReport({
53047
- title,
53048
- 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({
53049
52962
  type: type2,
53050
52963
  severity,
53051
- repoRoot,
53052
- ...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
53053
52982
  });
53054
- const response = await exports_Effect.runPromise(submitHarnessReport({
53055
- baseUrl: requiredControlPlaneUrl(),
53056
- bearerToken: controlPlaneBearerToken(),
53057
- report
52983
+ await exports_Effect.runPromise(submitCliEventEffect("cli.harness.report.submitted", {
52984
+ cwd: repoRoot
53058
52985
  }));
53059
- submitCliEvent("cli.harness.report.submitted", { cwd: repoRoot });
53060
52986
  if (json2) {
53061
52987
  console.log(renderJsonLabel());
53062
- console.log(JSON.stringify(response, null, 2));
52988
+ console.log(JSON.stringify({ issue, labels: issueLabels }, null, 2));
53063
52989
  return;
53064
52990
  }
53065
- console.log(renderCommandSection("Harness report submitted", [
53066
- `Report id: ${response.reportId}`,
53067
- `Status: ${response.status}`,
53068
- response.githubUrl === undefined ? null : `GitHub: ${response.githubUrl}`
53069
- ].filter((line4) => line4 !== null).join(`
52991
+ console.log(renderCommandSection("Harness report issue created", [`Issue: ${issue.htmlUrl}`, `Repository: ${repository}`].join(`
53070
52992
  `)));
53071
52993
  },
53072
- catch: (cause3) => cause3 instanceof Error ? cause3 : new Error("Harness report submission failed.")
53073
- })).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."));
53074
52996
 
53075
52997
  // src/cli/scaffold-command.ts
53076
- import path13 from "path";
52998
+ import path12 from "path";
53077
52999
 
53078
53000
  // src/baseline/resolve.ts
53079
53001
  import { createHash } from "crypto";
53080
53002
  import { execFileSync as execFileSync3 } from "child_process";
53081
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, mkdtempSync, readFileSync as readFileSync4, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
53003
+ import { existsSync as existsSync2, mkdirSync, mkdtempSync, readFileSync as readFileSync3, rmSync, writeFileSync } from "fs";
53082
53004
  import { tmpdir as tmpdir2 } from "os";
53083
- import path6 from "path";
53005
+ import path5 from "path";
53084
53006
 
53085
53007
  // src/baseline/bundled.ts
53086
- import path4 from "path";
53087
-
53088
- // src/content/data.ts
53089
- import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
53090
53008
  import path3 from "path";
53091
- var findFirst8 = (candidates) => candidates.find((candidate) => existsSync2(candidate));
53092
- var findBundledPackageRoot = () => {
53093
- let currentDirectory = path3.resolve(import.meta.dirname, "../..");
53094
- while (true) {
53095
- if (existsSync2(path3.join(currentDirectory, "package.json"))) {
53096
- return currentDirectory;
53097
- }
53098
- const parentDirectory = path3.dirname(currentDirectory);
53099
- if (parentDirectory === currentDirectory) {
53100
- break;
53101
- }
53102
- currentDirectory = parentDirectory;
53103
- }
53104
- return path3.resolve(import.meta.dirname, "../..");
53105
- };
53106
- var packageRoot = findBundledPackageRoot();
53107
- var runtimeRoot = import.meta.dirname;
53108
- var dataCandidates = [
53109
- path3.join(runtimeRoot, "data"),
53110
- path3.resolve(import.meta.dirname, "../data"),
53111
- path3.join(packageRoot, "src/data"),
53112
- path3.resolve(import.meta.dirname, "../../src/data")
53113
- ];
53114
- var skillCandidates = [
53115
- path3.join(runtimeRoot, "skills"),
53116
- path3.join(packageRoot, "skills"),
53117
- path3.resolve(import.meta.dirname, "../../skills"),
53118
- path3.resolve(import.meta.dirname, "../skills")
53119
- ];
53120
- var resolvedDataRoot = findFirst8(dataCandidates);
53121
- var resolvedSkillsRoot = findFirst8(skillCandidates);
53122
- if (resolvedDataRoot === undefined) {
53123
- throw new Error("Could not locate bundled data directory.");
53124
- }
53125
- if (resolvedSkillsRoot === undefined) {
53126
- throw new Error("Could not locate bundled skills directory.");
53127
- }
53128
- var dataRoot = resolvedDataRoot;
53129
- var skillsRoot = resolvedSkillsRoot;
53130
- var dataPath = (...segments) => path3.join(dataRoot, ...segments);
53131
- var readDataFile = (...segments) => readFileSync2(dataPath(...segments), "utf8");
53132
- var readBaselineDataFile = (baselineDataRoot, ...segments) => readFileSync2(path3.join(baselineDataRoot, ...segments), "utf8");
53133
- var resolveBaselinePath = ({
53134
- baselineRoot,
53135
- baselineSkillsRoot,
53136
- relativePath
53137
- }) => {
53138
- const resolvedPath = relativePath.startsWith("skills/") ? findFirst8([
53139
- path3.join(baselineSkillsRoot, relativePath.slice("skills/".length)),
53140
- path3.join(baselineRoot, relativePath)
53141
- ]) : findFirst8([path3.join(baselineRoot, relativePath)]);
53142
- if (resolvedPath !== undefined) {
53143
- return resolvedPath;
53144
- }
53145
- throw new Error(`Could not locate baseline asset: ${relativePath}`);
53146
- };
53147
53009
 
53148
53010
  // src/data/catalog/hooks.ts
53149
53011
  var hookCatalog = [
@@ -54145,7 +54007,7 @@ var bundledBaseline = {
54145
54007
  commit: null,
54146
54008
  sha256: null
54147
54009
  },
54148
- root: path4.dirname(dataRoot),
54010
+ root: path3.dirname(dataRoot),
54149
54011
  dataRoot,
54150
54012
  skillsRoot,
54151
54013
  packs: packCatalog,
@@ -54156,12 +54018,12 @@ var bundledBaseline = {
54156
54018
  };
54157
54019
 
54158
54020
  // src/baseline/load.ts
54159
- import { readFileSync as readFileSync3 } from "fs";
54160
- import path5 from "path";
54161
- var readJson2 = (filePath) => JSON.parse(readFileSync3(filePath, "utf8"));
54021
+ import { readFileSync as readFileSync2 } from "fs";
54022
+ import path4 from "path";
54023
+ var readJson = (filePath) => JSON.parse(readFileSync2(filePath, "utf8"));
54162
54024
  var loadBaselineFromDirectory = (root, source) => {
54163
- const metadata = readJson2(path5.join(root, "baseline.json"));
54164
- const dataRoot2 = path5.join(root, "data");
54025
+ const metadata = readJson(path4.join(root, "baseline.json"));
54026
+ const dataRoot2 = path4.join(root, "data");
54165
54027
  return {
54166
54028
  summary: {
54167
54029
  source,
@@ -54173,12 +54035,12 @@ var loadBaselineFromDirectory = (root, source) => {
54173
54035
  },
54174
54036
  root,
54175
54037
  dataRoot: dataRoot2,
54176
- skillsRoot: path5.join(root, "skills"),
54177
- packs: readJson2(path5.join(dataRoot2, "catalog", "packs.json")),
54178
- skills: readJson2(path5.join(dataRoot2, "catalog", "skills.json")),
54179
- tools: readJson2(path5.join(dataRoot2, "catalog", "tools.json")),
54180
- hooks: readJson2(path5.join(dataRoot2, "catalog", "hooks.json")),
54181
- lintAssets: validateLintCatalog(readJson2(path5.join(dataRoot2, "catalog", "lint-assets.json")))
54038
+ skillsRoot: path4.join(root, "skills"),
54039
+ packs: readJson(path4.join(dataRoot2, "catalog", "packs.json")),
54040
+ skills: readJson(path4.join(dataRoot2, "catalog", "skills.json")),
54041
+ tools: readJson(path4.join(dataRoot2, "catalog", "tools.json")),
54042
+ hooks: readJson(path4.join(dataRoot2, "catalog", "hooks.json")),
54043
+ lintAssets: validateLintCatalog(readJson(path4.join(dataRoot2, "catalog", "lint-assets.json")))
54182
54044
  };
54183
54045
  };
54184
54046
 
@@ -54186,9 +54048,9 @@ var loadBaselineFromDirectory = (root, source) => {
54186
54048
  var repoReleasesUrl = "https://api.github.com/repos/wearedevpunks/harness-intelligence/releases?per_page=30";
54187
54049
  var assetManifestName = "scaffold-baseline.json";
54188
54050
  var assetArchiveName = "scaffold-baseline.tgz";
54189
- var cacheRoot = () => path6.join(process.env.XDG_CACHE_HOME ?? path6.join(process.env.HOME ?? tmpdir2(), ".cache"), "devpunks", "baselines");
54190
- var sha256File = (filePath) => createHash("sha256").update(readFileSync4(filePath)).digest("hex");
54191
- var isSafeTarPath = (entry) => entry.length > 0 && !path6.isAbsolute(entry) && !entry.split("/").includes("..");
54051
+ var cacheRoot = () => path5.join(process.env.XDG_CACHE_HOME ?? path5.join(process.env.HOME ?? tmpdir2(), ".cache"), "devpunks", "baselines");
54052
+ var sha256File = (filePath) => createHash("sha256").update(readFileSync3(filePath)).digest("hex");
54053
+ var isSafeTarPath = (entry) => entry.length > 0 && !path5.isAbsolute(entry) && !entry.split("/").includes("..");
54192
54054
  var isBaselineReleaseTag = (tag6) => tag6.startsWith("baseline/stable/") && !/^v\d+\.\d+\.\d+(?:$|-)/u.test(tag6);
54193
54055
  var fetchJson = async (url2, timeoutMs) => {
54194
54056
  const controller = new AbortController;
@@ -54215,7 +54077,7 @@ var download = async (url2, targetPath, timeoutMs) => {
54215
54077
  throw new Error(`Failed to download ${url2}: ${response.status}`);
54216
54078
  }
54217
54079
  const bytes = new Uint8Array(await response.arrayBuffer());
54218
- writeFileSync2(targetPath, bytes);
54080
+ writeFileSync(targetPath, bytes);
54219
54081
  } finally {
54220
54082
  clearTimeout(timeout4);
54221
54083
  }
@@ -54228,7 +54090,7 @@ var extractSafeTgz = (archivePath, targetDirectory) => {
54228
54090
  if (unsafe !== undefined) {
54229
54091
  throw new Error(`Unsafe baseline archive path: ${unsafe}`);
54230
54092
  }
54231
- mkdirSync2(targetDirectory, { recursive: true });
54093
+ mkdirSync(targetDirectory, { recursive: true });
54232
54094
  execFileSync3("tar", ["-xzf", archivePath, "-C", targetDirectory], {
54233
54095
  stdio: "ignore"
54234
54096
  });
@@ -54240,35 +54102,35 @@ var resolveLocalBaseline = (url2) => {
54240
54102
  const filePath = new URL(url2);
54241
54103
  return loadBaselineFromDirectory(filePath.pathname, "local");
54242
54104
  };
54243
- var submitArtifactPullTelemetry = (baseline, cwd) => {
54244
- submitCliEvent("cli.artifact.pull.completed", {
54105
+ var submitArtifactPullTelemetry = async (baseline, cwd) => {
54106
+ await exports_Effect.runPromise(submitCliEventEffect("cli.artifact.pull.completed", {
54245
54107
  ...cwd === undefined ? {} : { cwd },
54246
54108
  baseline: {
54247
54109
  channel: baseline.summary.channel,
54248
54110
  version: baseline.summary.version
54249
54111
  }
54250
- });
54112
+ }));
54251
54113
  };
54252
54114
  var materializeControlPlaneBaseline = async (resolution, refresh, timeoutMs) => {
54253
- const targetDirectory = path6.join(cacheRoot(), "control-plane", resolution.version);
54254
- if (!refresh && existsSync3(path6.join(targetDirectory, "baseline.json"))) {
54115
+ const targetDirectory = path5.join(cacheRoot(), "control-plane", resolution.version);
54116
+ if (!refresh && existsSync2(path5.join(targetDirectory, "baseline.json"))) {
54255
54117
  return {
54256
54118
  baseline: loadBaselineFromDirectory(targetDirectory, "remote"),
54257
54119
  artifactPulled: false
54258
54120
  };
54259
54121
  }
54260
- const tempDirectory = mkdtempSync(path6.join(tmpdir2(), "punks-control-plane-baseline-"));
54261
- const archivePath = path6.join(tempDirectory, assetArchiveName);
54122
+ const tempDirectory = mkdtempSync(path5.join(tmpdir2(), "punks-control-plane-baseline-"));
54123
+ const archivePath = path5.join(tempDirectory, assetArchiveName);
54262
54124
  await download(resolution.archive.url, archivePath, timeoutMs);
54263
54125
  const archiveSha256 = sha256File(archivePath);
54264
54126
  if (archiveSha256 !== resolution.archive.sha256) {
54265
54127
  throw new Error("Downloaded control plane baseline archive checksum mismatch.");
54266
54128
  }
54267
- rmSync2(targetDirectory, { recursive: true, force: true });
54129
+ rmSync(targetDirectory, { recursive: true, force: true });
54268
54130
  extractSafeTgz(archivePath, targetDirectory);
54269
- const extractedMetadataPath = path6.join(targetDirectory, "baseline.json");
54270
- const extractedMetadata = JSON.parse(readFileSync4(extractedMetadataPath, "utf8"));
54271
- writeFileSync2(extractedMetadataPath, JSON.stringify({
54131
+ const extractedMetadataPath = path5.join(targetDirectory, "baseline.json");
54132
+ const extractedMetadata = JSON.parse(readFileSync3(extractedMetadataPath, "utf8"));
54133
+ writeFileSync(extractedMetadataPath, JSON.stringify({
54272
54134
  ...extractedMetadata,
54273
54135
  channel: resolution.channel,
54274
54136
  version: resolution.version,
@@ -54276,7 +54138,7 @@ var materializeControlPlaneBaseline = async (resolution, refresh, timeoutMs) =>
54276
54138
  commit: resolution.commitSha ?? null,
54277
54139
  sha256: archiveSha256
54278
54140
  }, null, 2), "utf8");
54279
- rmSync2(tempDirectory, { recursive: true, force: true });
54141
+ rmSync(tempDirectory, { recursive: true, force: true });
54280
54142
  return {
54281
54143
  baseline: loadBaselineFromDirectory(targetDirectory, "remote"),
54282
54144
  artifactPulled: true
@@ -54287,7 +54149,7 @@ var resolveControlPlaneStableBaseline = async ({
54287
54149
  timeoutMs,
54288
54150
  cwd
54289
54151
  }) => {
54290
- const baseUrl2 = process.env.DP_CONTROL_PLANE_URL;
54152
+ const baseUrl2 = resolveControlPlaneUrl();
54291
54153
  if (baseUrl2 === undefined || baseUrl2.length === 0) {
54292
54154
  return null;
54293
54155
  }
@@ -54295,8 +54157,7 @@ var resolveControlPlaneStableBaseline = async ({
54295
54157
  try {
54296
54158
  const resolution = await Promise.race([
54297
54159
  exports_Effect.runPromise(resolveStableBaselineMetadata({
54298
- baseUrl: baseUrl2,
54299
- bearerToken: controlPlaneBearerToken()
54160
+ baseUrl: baseUrl2
54300
54161
  })),
54301
54162
  new Promise((_, reject) => {
54302
54163
  timeout4 = setTimeout(() => reject(new Error("Control plane baseline resolution timed out.")), timeoutMs);
@@ -54304,7 +54165,7 @@ var resolveControlPlaneStableBaseline = async ({
54304
54165
  ]);
54305
54166
  const materialized = await materializeControlPlaneBaseline(resolution, refresh, timeoutMs);
54306
54167
  if (materialized.artifactPulled) {
54307
- submitArtifactPullTelemetry(materialized.baseline, cwd);
54168
+ await submitArtifactPullTelemetry(materialized.baseline, cwd);
54308
54169
  }
54309
54170
  return materialized.baseline;
54310
54171
  } catch {
@@ -54347,25 +54208,25 @@ var resolveRemoteStableBaseline = async ({
54347
54208
  throw new Error(`Baseline release ${release.tag_name} is missing required assets.`);
54348
54209
  }
54349
54210
  const manifest = await fetchJson(manifestAsset.browser_download_url, timeoutMs);
54350
- const targetDirectory = path6.join(cacheRoot(), "stable", manifest.version);
54351
- if (!refresh && existsSync3(path6.join(targetDirectory, "baseline.json"))) {
54211
+ const targetDirectory = path5.join(cacheRoot(), "stable", manifest.version);
54212
+ if (!refresh && existsSync2(path5.join(targetDirectory, "baseline.json"))) {
54352
54213
  return loadBaselineFromDirectory(targetDirectory, "remote");
54353
54214
  }
54354
- const tempDirectory = mkdtempSync(path6.join(tmpdir2(), "punks-baseline-"));
54355
- const archivePath = path6.join(tempDirectory, assetArchiveName);
54215
+ const tempDirectory = mkdtempSync(path5.join(tmpdir2(), "punks-baseline-"));
54216
+ const archivePath = path5.join(tempDirectory, assetArchiveName);
54356
54217
  await download(archiveAsset.browser_download_url, archivePath, timeoutMs);
54357
54218
  const archiveSha256 = sha256File(archivePath);
54358
54219
  if (archiveSha256 !== manifest.archiveSha256) {
54359
54220
  throw new Error("Downloaded baseline archive checksum mismatch.");
54360
54221
  }
54361
- rmSync2(targetDirectory, { recursive: true, force: true });
54222
+ rmSync(targetDirectory, { recursive: true, force: true });
54362
54223
  extractSafeTgz(archivePath, targetDirectory);
54363
- const extractedMetadataPath = path6.join(targetDirectory, "baseline.json");
54364
- const extractedMetadata = JSON.parse(readFileSync4(extractedMetadataPath, "utf8"));
54365
- writeFileSync2(extractedMetadataPath, JSON.stringify({ ...extractedMetadata, sha256: archiveSha256 }, null, 2), "utf8");
54366
- rmSync2(tempDirectory, { recursive: true, force: true });
54224
+ const extractedMetadataPath = path5.join(targetDirectory, "baseline.json");
54225
+ const extractedMetadata = JSON.parse(readFileSync3(extractedMetadataPath, "utf8"));
54226
+ writeFileSync(extractedMetadataPath, JSON.stringify({ ...extractedMetadata, sha256: archiveSha256 }, null, 2), "utf8");
54227
+ rmSync(tempDirectory, { recursive: true, force: true });
54367
54228
  const baseline = loadBaselineFromDirectory(targetDirectory, "remote");
54368
- submitArtifactPullTelemetry(baseline, cwd);
54229
+ await submitArtifactPullTelemetry(baseline, cwd);
54369
54230
  return baseline;
54370
54231
  };
54371
54232
  var resolveBaseline = async (options9 = {}) => {
@@ -54623,9 +54484,9 @@ var PromptLive = exports_Effect.acquireRelease(exports_Effect.sync(() => createI
54623
54484
 
54624
54485
  // src/scaffold/run.ts
54625
54486
  import { execFileSync as execFileSync6 } from "child_process";
54626
- import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync4 } from "fs";
54627
- import { homedir as homedir3 } from "os";
54628
- import path11 from "path";
54487
+ import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
54488
+ import { homedir as homedir2 } from "os";
54489
+ import path10 from "path";
54629
54490
 
54630
54491
  // src/content/packs.ts
54631
54492
  var packContents = packCatalog;
@@ -54666,8 +54527,8 @@ var requiredToolsForSkills = (skillIds, baseline = bundledBaseline) => [
54666
54527
  ].toSorted();
54667
54528
 
54668
54529
  // src/core/detect.ts
54669
- import { existsSync as existsSync4, readFileSync as readFileSync5, readdirSync } from "fs";
54670
- import path7 from "path";
54530
+ import { existsSync as existsSync3, readFileSync as readFileSync4, readdirSync } from "fs";
54531
+ import path6 from "path";
54671
54532
  var ignoredDirectoryNames = new Set([
54672
54533
  ".git",
54673
54534
  ".agents",
@@ -54746,7 +54607,7 @@ var recursiveFindFiles = (cwd, filename) => {
54746
54607
  if (ignoredDirectoryNames.has(entry.name)) {
54747
54608
  continue;
54748
54609
  }
54749
- const absolutePath = path7.join(directory3, entry.name);
54610
+ const absolutePath = path6.join(directory3, entry.name);
54750
54611
  if (entry.isDirectory()) {
54751
54612
  visit2(absolutePath);
54752
54613
  continue;
@@ -54756,18 +54617,18 @@ var recursiveFindFiles = (cwd, filename) => {
54756
54617
  }
54757
54618
  }
54758
54619
  };
54759
- if (existsSync4(cwd)) {
54620
+ if (existsSync3(cwd)) {
54760
54621
  visit2(cwd);
54761
54622
  }
54762
54623
  return results.toSorted();
54763
54624
  };
54764
54625
  var discoverPackageJsonPaths = (cwd) => {
54765
- const rootPackageJsonPath = path7.join(cwd, "package.json");
54626
+ const rootPackageJsonPath = path6.join(cwd, "package.json");
54766
54627
  const recursivePackageJsonPaths = recursiveFindFiles(cwd, "package.json");
54767
- if (!existsSync4(rootPackageJsonPath)) {
54628
+ if (!existsSync3(rootPackageJsonPath)) {
54768
54629
  return recursivePackageJsonPaths;
54769
54630
  }
54770
- const rootPackageJson = parsePackageJsonRecord(readFileSync5(rootPackageJsonPath, "utf8"));
54631
+ const rootPackageJson = parsePackageJsonRecord(readFileSync4(rootPackageJsonPath, "utf8"));
54771
54632
  const workspacePatterns = new Set([
54772
54633
  ...readPackageJsonWorkspacePatterns(rootPackageJson),
54773
54634
  ...readPnpmWorkspacePatterns(cwd)
@@ -54783,13 +54644,13 @@ var discoverPackageJsonPaths = (cwd) => {
54783
54644
  ].filter((value6, index, values4) => values4.indexOf(value6) === index).toSorted();
54784
54645
  };
54785
54646
  var discoverConventionalWorkspacePackageJsonPaths = (cwd) => conventionalWorkspaceRoots.flatMap((rootDirectoryName) => {
54786
- const rootDirectory = path7.join(cwd, rootDirectoryName);
54787
- if (!existsSync4(rootDirectory)) {
54647
+ const rootDirectory = path6.join(cwd, rootDirectoryName);
54648
+ if (!existsSync3(rootDirectory)) {
54788
54649
  return [];
54789
54650
  }
54790
- return readdirSync(rootDirectory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !ignoredDirectoryNames.has(entry.name)).map((entry) => path7.join(rootDirectory, entry.name, "package.json")).filter((manifestPath) => existsSync4(manifestPath));
54651
+ return readdirSync(rootDirectory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !ignoredDirectoryNames.has(entry.name)).map((entry) => path6.join(rootDirectory, entry.name, "package.json")).filter((manifestPath) => existsSync3(manifestPath));
54791
54652
  });
54792
- var discoverTopLevelPackageJsonPaths = (cwd) => readdirSync(cwd, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !ignoredDirectoryNames.has(entry.name)).map((entry) => path7.join(cwd, entry.name, "package.json")).filter((manifestPath) => existsSync4(manifestPath));
54653
+ var discoverTopLevelPackageJsonPaths = (cwd) => readdirSync(cwd, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !ignoredDirectoryNames.has(entry.name)).map((entry) => path6.join(cwd, entry.name, "package.json")).filter((manifestPath) => existsSync3(manifestPath));
54793
54654
  var readPackageJsonWorkspacePatterns = (pkg) => {
54794
54655
  const { workspaces } = pkg;
54795
54656
  if (exports_Array.isArray(workspaces)) {
@@ -54801,13 +54662,13 @@ var readPackageJsonWorkspacePatterns = (pkg) => {
54801
54662
  return [];
54802
54663
  };
54803
54664
  var readPnpmWorkspacePatterns = (cwd) => {
54804
- const workspacePath = path7.join(cwd, "pnpm-workspace.yaml");
54805
- if (!existsSync4(workspacePath)) {
54665
+ const workspacePath = path6.join(cwd, "pnpm-workspace.yaml");
54666
+ if (!existsSync3(workspacePath)) {
54806
54667
  return [];
54807
54668
  }
54808
54669
  const patterns = [];
54809
54670
  let inPackagesSection = false;
54810
- for (const rawLine of readFileSync5(workspacePath, "utf8").split(/\r?\n/u)) {
54671
+ for (const rawLine of readFileSync4(workspacePath, "utf8").split(/\r?\n/u)) {
54811
54672
  const line4 = rawLine.trim();
54812
54673
  if (line4 === "packages:") {
54813
54674
  inPackagesSection = true;
@@ -54831,17 +54692,17 @@ var readPnpmWorkspacePatterns = (cwd) => {
54831
54692
  };
54832
54693
  var expandWorkspacePattern = (cwd, pattern2) => {
54833
54694
  if (pattern2.endsWith("/*")) {
54834
- const baseDirectory = path7.join(cwd, pattern2.slice(0, -2));
54835
- if (!existsSync4(baseDirectory)) {
54695
+ const baseDirectory = path6.join(cwd, pattern2.slice(0, -2));
54696
+ if (!existsSync3(baseDirectory)) {
54836
54697
  return [];
54837
54698
  }
54838
- return readdirSync(baseDirectory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !ignoredDirectoryNames.has(entry.name)).map((entry) => path7.join(baseDirectory, entry.name, "package.json")).filter((manifestPath2) => existsSync4(manifestPath2)).toSorted();
54699
+ return readdirSync(baseDirectory, { withFileTypes: true }).filter((entry) => entry.isDirectory() && !ignoredDirectoryNames.has(entry.name)).map((entry) => path6.join(baseDirectory, entry.name, "package.json")).filter((manifestPath2) => existsSync3(manifestPath2)).toSorted();
54839
54700
  }
54840
54701
  if (pattern2.includes("*")) {
54841
54702
  return [];
54842
54703
  }
54843
- const manifestPath = path7.join(cwd, pattern2, "package.json");
54844
- return existsSync4(manifestPath) ? [manifestPath] : [];
54704
+ const manifestPath = path6.join(cwd, pattern2, "package.json");
54705
+ return existsSync3(manifestPath) ? [manifestPath] : [];
54845
54706
  };
54846
54707
  var detectTechnologies = (manifests) => {
54847
54708
  const packageNames = new Set(manifests.flatMap((manifest) => manifest.dependencies));
@@ -54879,7 +54740,7 @@ var detectTechnologies = (manifests) => {
54879
54740
  return detectionOrder.filter((technology) => detected.has(technology));
54880
54741
  };
54881
54742
  var hasPackageTrigger = (packageNames, trigger) => trigger.endsWith("/") ? [...packageNames].some((packageName) => packageName.startsWith(trigger)) : packageNames.has(trigger);
54882
- var isSourceDirectoryPath = (cwd, directory3) => path7.relative(cwd, directory3) !== "";
54743
+ var isSourceDirectoryPath = (cwd, directory3) => path6.relative(cwd, directory3) !== "";
54883
54744
  var detectSourceLanguages = (cwd) => {
54884
54745
  const detected = new Set;
54885
54746
  const visit2 = (directory3) => {
@@ -54887,7 +54748,7 @@ var detectSourceLanguages = (cwd) => {
54887
54748
  if (ignoredDirectoryNames.has(entry.name)) {
54888
54749
  continue;
54889
54750
  }
54890
- const absolutePath = path7.join(directory3, entry.name);
54751
+ const absolutePath = path6.join(directory3, entry.name);
54891
54752
  if (entry.isDirectory()) {
54892
54753
  visit2(absolutePath);
54893
54754
  continue;
@@ -54901,7 +54762,7 @@ var detectSourceLanguages = (cwd) => {
54901
54762
  }
54902
54763
  }
54903
54764
  };
54904
- if (existsSync4(cwd)) {
54765
+ if (existsSync3(cwd)) {
54905
54766
  visit2(cwd);
54906
54767
  }
54907
54768
  return languageDetectionOrder.filter((language) => detected.has(language));
@@ -54929,7 +54790,7 @@ var detectMonorepoSignals = (cwd, manifests) => {
54929
54790
  });
54930
54791
  }
54931
54792
  for (const manifest of manifests) {
54932
- const pkg = parsePackageJsonRecord(readFileSync5(manifest.path, "utf8"));
54793
+ const pkg = parsePackageJsonRecord(readFileSync4(manifest.path, "utf8"));
54933
54794
  const workspaces = pkg.workspaces;
54934
54795
  const hasWorkspaces = exports_Array.isArray(workspaces) || isRecord2(workspaces) && exports_Array.isArray(workspaces.packages);
54935
54796
  if (hasWorkspaces) {
@@ -54940,7 +54801,7 @@ var detectMonorepoSignals = (cwd, manifests) => {
54940
54801
  }
54941
54802
  }
54942
54803
  const workspaceManifests = manifests.filter((manifest) => {
54943
- const pkg = parsePackageJsonRecord(readFileSync5(manifest.path, "utf8"));
54804
+ const pkg = parsePackageJsonRecord(readFileSync4(manifest.path, "utf8"));
54944
54805
  const workspaces = pkg.workspaces;
54945
54806
  return !(exports_Array.isArray(workspaces) || isRecord2(workspaces) && exports_Array.isArray(workspaces.packages));
54946
54807
  });
@@ -54956,10 +54817,10 @@ var detectRepository = (cwd) => exports_Effect.try({
54956
54817
  try: () => {
54957
54818
  const manifestPaths = discoverPackageJsonPaths(cwd);
54958
54819
  const manifests = manifestPaths.map((manifestPath) => {
54959
- const pkg = parsePackageJsonRecord(readFileSync5(manifestPath, "utf8"));
54820
+ const pkg = parsePackageJsonRecord(readFileSync4(manifestPath, "utf8"));
54960
54821
  return {
54961
54822
  path: manifestPath,
54962
- relativePath: path7.relative(cwd, manifestPath) || "package.json",
54823
+ relativePath: path6.relative(cwd, manifestPath) || "package.json",
54963
54824
  packageName: pkg.name ?? null,
54964
54825
  dependencies: collectPackageNames(pkg)
54965
54826
  };
@@ -54981,7 +54842,7 @@ var detectRepository = (cwd) => exports_Effect.try({
54981
54842
  message: "Failed to detect repository shape."
54982
54843
  })
54983
54844
  });
54984
- var manifestPaths = (result) => result.manifests.map((manifest) => path7.relative(result.cwd, manifest.path) || "package.json");
54845
+ var manifestPaths = (result) => result.manifests.map((manifest) => path6.relative(result.cwd, manifest.path) || "package.json");
54985
54846
  var applyRepoShapeMode = (result, repoShapeMode) => repoShapeMode === "auto" ? result : {
54986
54847
  ...result,
54987
54848
  monorepo: repoShapeMode === "monorepo"
@@ -54990,7 +54851,7 @@ var hasFrontendSurface = (result) => exports_Array.some(result.detectedTechnolog
54990
54851
  var backendWorkspacePathSegments = new Set(["api", "backend", "server", "services"]);
54991
54852
  var backendPackageNameSegments = new Set(["api", "backend", "server", "service"]);
54992
54853
  var hasBackendWorkspaceName = (manifest) => {
54993
- const pathSegments = manifest.relativePath.split(path7.sep).slice(0, -1);
54854
+ const pathSegments = manifest.relativePath.split(path6.sep).slice(0, -1);
54994
54855
  if (pathSegments.some((segment) => backendWorkspacePathSegments.has(segment))) {
54995
54856
  return true;
54996
54857
  }
@@ -55003,7 +54864,7 @@ var hasBackendWorkspaceName = (manifest) => {
55003
54864
  var hasBackendSurface = (result) => exports_Array.some(result.detectedTechnologies, (technology) => technology === "better-auth" || technology === "drizzle" || technology === "elysia" || technology === "trpc") || result.manifests.some(hasBackendWorkspaceName);
55004
54865
 
55005
54866
  // src/core/format-summary.ts
55006
- import path8 from "path";
54867
+ import path7 from "path";
55007
54868
  var formatList = (values4) => values4.length === 0 ? [" \u2205"] : values4.map((value6) => ` \u2022 ${value6}`);
55008
54869
  var wrapInlineValues = ({
55009
54870
  values: values4,
@@ -55074,8 +54935,8 @@ var formatDetectionSummary = (detection) => [
55074
54935
  `cwd: ${detection.cwd}`,
55075
54936
  ...section("detected languages:", formatList(detection.detectedLanguages)),
55076
54937
  ...section("detected technologies:", formatList(detection.detectedTechnologies)),
55077
- ...section("manifest files:", formatList(detection.manifests.map((manifest) => path8.relative(detection.cwd, manifest.path) || "package.json"))),
55078
- ...section("monorepo signals:", formatList(detection.monorepoSignals.map((signal) => `${signal.type} (${path8.relative(detection.cwd, signal.path) || "."})`)))
54938
+ ...section("manifest files:", formatList(detection.manifests.map((manifest) => path7.relative(detection.cwd, manifest.path) || "package.json"))),
54939
+ ...section("monorepo signals:", formatList(detection.monorepoSignals.map((signal) => `${signal.type} (${path7.relative(detection.cwd, signal.path) || "."})`)))
55079
54940
  ].join(`
55080
54941
  `);
55081
54942
  var formatConfirmationSummary = (result, baseline = bundledBaseline) => [
@@ -55264,8 +55125,8 @@ var canRemovePack = (resolved, packId) => resolved.preselectedPacks.includes(pac
55264
55125
  // src/core/tools.ts
55265
55126
  import { execFileSync as execFileSync4 } from "child_process";
55266
55127
  import { accessSync, constants as constants2 } from "fs";
55267
- import { homedir as homedir2 } from "os";
55268
- import path9 from "path";
55128
+ import { homedir } from "os";
55129
+ import path8 from "path";
55269
55130
  var commandExistsOnPath = (command, env2 = process.env, platform = process.platform) => {
55270
55131
  const pathValue = env2.PATH ?? env2.Path;
55271
55132
  if (pathValue === undefined || pathValue.length === 0) {
@@ -55275,9 +55136,9 @@ var commandExistsOnPath = (command, env2 = process.env, platform = process.platf
55275
55136
  const pathSeparator = isWindows ? ";" : ":";
55276
55137
  const pathEntries = pathValue.split(pathSeparator).filter((entry) => entry.length > 0);
55277
55138
  const pathExtensions = isWindows ? (env2.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter((extension) => extension.length > 0) : [""];
55278
- const commandExtensions = isWindows && path9.extname(command).length === 0 ? pathExtensions : [""];
55139
+ const commandExtensions = isWindows && path8.extname(command).length === 0 ? pathExtensions : [""];
55279
55140
  const hasPathSegment = command.includes("/") || command.includes("\\");
55280
- const candidates = (hasPathSegment ? [""] : pathEntries).flatMap((entry) => commandExtensions.map((extension) => hasPathSegment ? `${command}${extension}` : path9.join(entry, `${command}${extension}`)));
55141
+ const candidates = (hasPathSegment ? [""] : pathEntries).flatMap((entry) => commandExtensions.map((extension) => hasPathSegment ? `${command}${extension}` : path8.join(entry, `${command}${extension}`)));
55281
55142
  return candidates.some((candidate) => {
55282
55143
  try {
55283
55144
  accessSync(candidate, isWindows ? constants2.F_OK : constants2.X_OK);
@@ -55288,7 +55149,7 @@ var commandExistsOnPath = (command, env2 = process.env, platform = process.platf
55288
55149
  });
55289
55150
  };
55290
55151
  var defaultRuntime3 = {
55291
- cwd: homedir2(),
55152
+ cwd: homedir(),
55292
55153
  commandExists: commandExistsOnPath,
55293
55154
  execFile: (command, args2, options9) => {
55294
55155
  execFileSync4(command, [...args2], {
@@ -55327,7 +55188,7 @@ var ensureToolsInstalled = (toolIds, baseline = bundledBaseline, runtime5 = defa
55327
55188
  throw new Error("Cannot install required tools because no supported global package manager was found on PATH. Install Bun, pnpm, or npm first.");
55328
55189
  }
55329
55190
  const globalPackageManager = packageManager;
55330
- const cwd = runtime5.cwd ?? homedir2();
55191
+ const cwd = runtime5.cwd ?? homedir();
55331
55192
  for (const toolId of toolIds) {
55332
55193
  const tool = toolCatalogById[toolId];
55333
55194
  if (tool === undefined) {
@@ -55367,16 +55228,16 @@ import { execFileSync as execFileSync5 } from "child_process";
55367
55228
  import { createHash as createHash2 } from "crypto";
55368
55229
  import {
55369
55230
  cpSync,
55370
- existsSync as existsSync5,
55231
+ existsSync as existsSync4,
55371
55232
  lstatSync,
55372
- mkdirSync as mkdirSync3,
55233
+ mkdirSync as mkdirSync2,
55373
55234
  readdirSync as readdirSync2,
55374
- readFileSync as readFileSync6,
55235
+ readFileSync as readFileSync5,
55375
55236
  readlinkSync,
55376
- rmSync as rmSync3,
55377
- writeFileSync as writeFileSync3
55237
+ rmSync as rmSync2,
55238
+ writeFileSync as writeFileSync2
55378
55239
  } from "fs";
55379
- import path10 from "path";
55240
+ import path9 from "path";
55380
55241
 
55381
55242
  // src/content/prompts.ts
55382
55243
  var phaseSkillIds = [
@@ -55900,9 +55761,9 @@ var sortSubagentSpecialists = (spec) => ({
55900
55761
 
55901
55762
  // src/scaffold/output.ts
55902
55763
  var encodeJson = encodeSync(parseJson(Unknown));
55903
- var toPosixPath = (value6) => value6.split(path10.sep).join("/");
55764
+ var toPosixPath = (value6) => value6.split(path9.sep).join("/");
55904
55765
  var relativePosixPath = (from, to) => {
55905
- const relativePath = path10.relative(from, to);
55766
+ const relativePath = path9.relative(from, to);
55906
55767
  return relativePath === "" ? "." : toPosixPath(relativePath);
55907
55768
  };
55908
55769
  var specPathForPromptTarget = (relativePath) => {
@@ -55916,7 +55777,7 @@ var specPathForPromptTarget = (relativePath) => {
55916
55777
  if (promptTargetPath === "docs/AGENTS.md") {
55917
55778
  return ".devpunks/specs/prompts/docs.md";
55918
55779
  }
55919
- return path10.posix.join(".devpunks/specs/prompts", path10.posix.dirname(promptTargetPath), "prompt.md");
55780
+ return path9.posix.join(".devpunks/specs/prompts", path9.posix.dirname(promptTargetPath), "prompt.md");
55920
55781
  };
55921
55782
  var uniqueSorted = (values4) => [...new Set(values4)].toSorted();
55922
55783
  var collectOpensrcReferences = (promptSpecs) => uniqueSorted(promptSpecs.flatMap((spec) => spec.opensrcReferences));
@@ -55925,7 +55786,7 @@ var detectionHasPackage = (detection, packageName) => detection.manifests.some((
55925
55786
  var selectedSkills = (finalPacks, baseline) => uniqueSorted(finalPacks.flatMap((packId) => skillsForPack(packId, baseline)));
55926
55787
  var selectedHookIds = (finalPacks, baseline) => uniqueSorted(finalPacks.flatMap((packId) => hooksForPack(packId, baseline)));
55927
55788
  var oxlintConfigCandidates = [".oxlintrc.json", ".oxlintrc.jsonc", "oxlint.config.ts"];
55928
- var existingOxlintConfigFiles = (scanDirectory) => oxlintConfigCandidates.filter((candidate) => existsSync5(path10.join(scanDirectory, candidate)));
55789
+ var existingOxlintConfigFiles = (scanDirectory) => oxlintConfigCandidates.filter((candidate) => existsSync4(path9.join(scanDirectory, candidate)));
55929
55790
  var oxlintStarterConfig = {
55930
55791
  $schema: "./node_modules/oxlint/configuration_schema.json",
55931
55792
  env: {
@@ -55951,7 +55812,7 @@ var oxlintStarterConfig = {
55951
55812
  ],
55952
55813
  overrides: []
55953
55814
  };
55954
- var detectedWorkspaces = (scanDirectory, detection) => detection.manifests.map((manifest) => path10.posix.dirname(relativePosixPath(scanDirectory, manifest.path))).filter((workspace) => workspace !== "" && workspace !== ".").toSorted();
55815
+ var detectedWorkspaces = (scanDirectory, detection) => detection.manifests.map((manifest) => path9.posix.dirname(relativePosixPath(scanDirectory, manifest.path))).filter((workspace) => workspace !== "" && workspace !== ".").toSorted();
55955
55816
  var packsForWorkspace = ({
55956
55817
  relativeWorkspacePath,
55957
55818
  manifest,
@@ -56106,9 +55967,9 @@ var buildPromptSpec = ({
56106
55967
  finalPacks,
56107
55968
  baseline
56108
55969
  }) => {
56109
- const sourcePath = path10.join(scanDirectory, relativePath);
56110
- const source = existsSync5(sourcePath) ? "copied" : "generated";
56111
- const workspacePath = relativePath === ".agents/AGENTS.md" ? ".agents" : relativePath === "AGENTS.md" ? "." : relativePath === "docs/AGENTS.md" ? "docs" : path10.dirname(relativePath);
55970
+ const sourcePath = path9.join(scanDirectory, relativePath);
55971
+ const source = existsSync4(sourcePath) ? "copied" : "generated";
55972
+ const workspacePath = relativePath === ".agents/AGENTS.md" ? ".agents" : relativePath === "AGENTS.md" ? "." : relativePath === "docs/AGENTS.md" ? "docs" : path9.dirname(relativePath);
56112
55973
  const packs = packsForWorkspace({
56113
55974
  relativeWorkspacePath: workspacePath,
56114
55975
  manifest,
@@ -56176,9 +56037,9 @@ var writeArtifact = ({
56176
56037
  relativePath,
56177
56038
  content
56178
56039
  }) => {
56179
- const absolutePath = path10.join(outputDirectory, relativePath);
56180
- mkdirSync3(path10.dirname(absolutePath), { recursive: true });
56181
- writeFileSync3(absolutePath, content, "utf8");
56040
+ const absolutePath = path9.join(outputDirectory, relativePath);
56041
+ mkdirSync2(path9.dirname(absolutePath), { recursive: true });
56042
+ writeFileSync2(absolutePath, content, "utf8");
56182
56043
  return relativePath;
56183
56044
  };
56184
56045
  var resolvePromptContent = ({
@@ -56189,9 +56050,9 @@ var resolvePromptContent = ({
56189
56050
  baseline,
56190
56051
  preserveExistingManagedFiles
56191
56052
  }) => {
56192
- const sourcePath = path10.join(scanDirectory, relativePath);
56193
- if (preserveExistingManagedFiles && existsSync5(sourcePath)) {
56194
- return readFileSync6(sourcePath, "utf8");
56053
+ const sourcePath = path9.join(scanDirectory, relativePath);
56054
+ if (preserveExistingManagedFiles && existsSync4(sourcePath)) {
56055
+ return readFileSync5(sourcePath, "utf8");
56195
56056
  }
56196
56057
  if (relativePath === ".agents/AGENTS.md") {
56197
56058
  return sharedAgentsPromptTemplate;
@@ -56203,7 +56064,7 @@ var resolvePromptContent = ({
56203
56064
  return docsPromptTemplate;
56204
56065
  }
56205
56066
  if (manifest) {
56206
- const relativeWorkspacePath = path10.dirname(relativePath);
56067
+ const relativeWorkspacePath = path9.dirname(relativePath);
56207
56068
  const packs = packsForWorkspace({
56208
56069
  relativeWorkspacePath,
56209
56070
  manifest,
@@ -56224,15 +56085,15 @@ var resolvePromptContent = ({
56224
56085
  return "";
56225
56086
  };
56226
56087
  var collectRelativeFiles = (outputDirectory, relativeDirectory) => {
56227
- const absoluteDirectory = path10.join(outputDirectory, relativeDirectory);
56228
- if (!existsSync5(absoluteDirectory)) {
56088
+ const absoluteDirectory = path9.join(outputDirectory, relativeDirectory);
56089
+ if (!existsSync4(absoluteDirectory)) {
56229
56090
  return [];
56230
56091
  }
56231
56092
  const files = [];
56232
56093
  const visit2 = (currentDirectory) => {
56233
56094
  for (const entry of readdirSync2(currentDirectory, { withFileTypes: true })) {
56234
- const absolutePath = path10.join(currentDirectory, entry.name);
56235
- const relativePath = path10.relative(outputDirectory, absolutePath).split(path10.sep).join("/");
56095
+ const absolutePath = path9.join(currentDirectory, entry.name);
56096
+ const relativePath = path9.relative(outputDirectory, absolutePath).split(path9.sep).join("/");
56236
56097
  const stat3 = lstatSync(absolutePath);
56237
56098
  if (stat3.isSymbolicLink()) {
56238
56099
  files.push(relativePath);
@@ -56287,8 +56148,8 @@ var managedKindForPath = (relativePath) => {
56287
56148
  var expandManagedFiles = (outputDirectory, relativePaths) => {
56288
56149
  const files = new Set;
56289
56150
  for (const relativePath of relativePaths) {
56290
- const absolutePath = path10.join(outputDirectory, relativePath);
56291
- if (!existsSync5(absolutePath)) {
56151
+ const absolutePath = path9.join(outputDirectory, relativePath);
56152
+ if (!existsSync4(absolutePath)) {
56292
56153
  continue;
56293
56154
  }
56294
56155
  const stat3 = lstatSync(absolutePath);
@@ -56303,9 +56164,9 @@ var expandManagedFiles = (outputDirectory, relativePaths) => {
56303
56164
  }
56304
56165
  }
56305
56166
  return [...files].toSorted().map((relativePath) => {
56306
- const absolutePath = path10.join(outputDirectory, relativePath);
56167
+ const absolutePath = path9.join(outputDirectory, relativePath);
56307
56168
  const stat3 = lstatSync(absolutePath);
56308
- const content = stat3.isSymbolicLink() ? `symlink:${readlinkSync(absolutePath)}` : readFileSync6(absolutePath);
56169
+ const content = stat3.isSymbolicLink() ? `symlink:${readlinkSync(absolutePath)}` : readFileSync5(absolutePath);
56309
56170
  return {
56310
56171
  path: relativePath,
56311
56172
  sha256: hashContent(content),
@@ -56318,7 +56179,7 @@ var promptTargetsForDetection = (scanDirectory, detection) => {
56318
56179
  { relativePath: ".agents/AGENTS.md", manifest: null },
56319
56180
  { relativePath: "AGENTS.md", manifest: null }
56320
56181
  ];
56321
- if (existsSync5(path10.join(scanDirectory, "docs"))) {
56182
+ if (existsSync4(path9.join(scanDirectory, "docs"))) {
56322
56183
  targets.push({ relativePath: "docs/AGENTS.md", manifest: null });
56323
56184
  }
56324
56185
  if (!detection.monorepo) {
@@ -56330,7 +56191,7 @@ var promptTargetsForDetection = (scanDirectory, detection) => {
56330
56191
  continue;
56331
56192
  }
56332
56193
  targets.push({
56333
- relativePath: path10.posix.join(path10.posix.dirname(relativeManifestPath), "AGENTS.md"),
56194
+ relativePath: path9.posix.join(path9.posix.dirname(relativeManifestPath), "AGENTS.md"),
56334
56195
  manifest
56335
56196
  });
56336
56197
  }
@@ -56349,7 +56210,7 @@ var writeScaffoldOutput = ({
56349
56210
  }) => exports_Effect.sync(() => {
56350
56211
  const shouldPreserveExistingManagedFiles = preserveExistingManagedFiles ?? true;
56351
56212
  const renderedOutputDirectory = displayOutputDirectory ?? outputDirectory;
56352
- mkdirSync3(outputDirectory, { recursive: true });
56213
+ mkdirSync2(outputDirectory, { recursive: true });
56353
56214
  const generatedFiles = [];
56354
56215
  const promptOutputs = [];
56355
56216
  const promptSpecFiles = [];
@@ -56446,10 +56307,10 @@ var writeScaffoldOutput = ({
56446
56307
  }
56447
56308
  for (const skillId of finalSkills) {
56448
56309
  const sourceDirectory = skillRegistryByIdForBaseline(baseline)[skillId].sourceDirectory;
56449
- const targetDirectory = path10.posix.join(".agents/skills", skillId);
56450
- const absoluteTargetDirectory = path10.join(outputDirectory, targetDirectory);
56451
- mkdirSync3(path10.join(outputDirectory, ".agents/skills"), { recursive: true });
56452
- rmSync3(absoluteTargetDirectory, { recursive: true, force: true });
56310
+ const targetDirectory = path9.posix.join(".agents/skills", skillId);
56311
+ const absoluteTargetDirectory = path9.join(outputDirectory, targetDirectory);
56312
+ mkdirSync2(path9.join(outputDirectory, ".agents/skills"), { recursive: true });
56313
+ rmSync2(absoluteTargetDirectory, { recursive: true, force: true });
56453
56314
  cpSync(resolveBaselinePath({
56454
56315
  baselineRoot: baseline.root,
56455
56316
  baselineSkillsRoot: baseline.skillsRoot,
@@ -56486,11 +56347,11 @@ var writeScaffoldOutput = ({
56486
56347
  content: encodeJson(subagentManifestSpec)
56487
56348
  }));
56488
56349
  subagentFiles.push(subagentManifestSpec.specFile);
56489
- const sourceManifestPath = path10.join(scanDirectory, ".agents/subagents/manifest.mjs");
56350
+ const sourceManifestPath = path9.join(scanDirectory, ".agents/subagents/manifest.mjs");
56490
56351
  generatedFiles.push(writeArtifact({
56491
56352
  outputDirectory,
56492
56353
  relativePath: ".agents/subagents/manifest.mjs",
56493
- content: shouldPreserveExistingManagedFiles && existsSync5(sourceManifestPath) ? readFileSync6(sourceManifestPath, "utf8") : renderSubagentManifestModule({
56354
+ content: shouldPreserveExistingManagedFiles && existsSync4(sourceManifestPath) ? readFileSync5(sourceManifestPath, "utf8") : renderSubagentManifestModule({
56494
56355
  spec: subagentManifestSpec,
56495
56356
  baseline,
56496
56357
  fallback: defaultSubagentManifestTemplate
@@ -56505,7 +56366,7 @@ var writeScaffoldOutput = ({
56505
56366
  }));
56506
56367
  hookFiles.push(hook.outputPath);
56507
56368
  }
56508
- execFileSync5(process.execPath, [path10.join(outputDirectory, syncScriptFile)], {
56369
+ execFileSync5(process.execPath, [path9.join(outputDirectory, syncScriptFile)], {
56509
56370
  cwd: outputDirectory,
56510
56371
  stdio: "ignore"
56511
56372
  });
@@ -56620,14 +56481,14 @@ var yesValues = new Set(["", "y", "yes"]);
56620
56481
  var encodeJson2 = encodeSync(parseJson(Unknown));
56621
56482
  var encodePrettyJson = (value6) => JSON.stringify(JSON.parse(encodeJson2(value6)), null, 2);
56622
56483
  var agentSystemPromptFile = ".devpunks/AGENT-SYSTEM-PROMPT.md";
56623
- var clipboardWorkingDirectory = homedir3();
56484
+ var clipboardWorkingDirectory = homedir2();
56624
56485
  var writeAgentSystemPrompt = ({
56625
56486
  outputDirectory,
56626
56487
  content
56627
56488
  }) => {
56628
- const absolutePath = path11.join(outputDirectory, agentSystemPromptFile);
56629
- mkdirSync4(path11.dirname(absolutePath), { recursive: true });
56630
- writeFileSync4(absolutePath, `${content}
56489
+ const absolutePath = path10.join(outputDirectory, agentSystemPromptFile);
56490
+ mkdirSync3(path10.dirname(absolutePath), { recursive: true });
56491
+ writeFileSync3(absolutePath, `${content}
56631
56492
  `, "utf8");
56632
56493
  return agentSystemPromptFile;
56633
56494
  };
@@ -56698,7 +56559,7 @@ var runScaffold = ({
56698
56559
  }) => exports_Effect.gen(function* () {
56699
56560
  const baseRequiredTools = requiredToolsForSkills([], baseline);
56700
56561
  let toolBootstrapStatuses = [];
56701
- const resolvedOutputDirectory = path11.resolve(outputDirectory ?? scanDirectory);
56562
+ const resolvedOutputDirectory = path10.resolve(outputDirectory ?? scanDirectory);
56702
56563
  yield* prompt4.writeLine(renderScaffoldTitle());
56703
56564
  yield* prompt4.writeLine("");
56704
56565
  yield* prompt4.writeLine(renderSetupIntro());
@@ -56908,7 +56769,7 @@ var runScaffold = ({
56908
56769
  yield* prompt4.writeLine(renderJsonLabel());
56909
56770
  yield* prompt4.writeLine(encodePrettyJson(result));
56910
56771
  }
56911
- submitCliEvent("cli.scaffold.setup.completed", {
56772
+ yield* submitCliEventEffect("cli.scaffold.setup.completed", {
56912
56773
  cwd: scanDirectory,
56913
56774
  baseline: {
56914
56775
  version: baseline.summary.version
@@ -56918,8 +56779,8 @@ var runScaffold = ({
56918
56779
  });
56919
56780
 
56920
56781
  // src/scaffold/stage.ts
56921
- import { cpSync as cpSync2, existsSync as existsSync6, mkdirSync as mkdirSync5, rmSync as rmSync4, symlinkSync, writeFileSync as writeFileSync5 } from "fs";
56922
- import path12 from "path";
56782
+ import { cpSync as cpSync2, existsSync as existsSync5, mkdirSync as mkdirSync4, rmSync as rmSync3, symlinkSync, writeFileSync as writeFileSync4 } from "fs";
56783
+ import path11 from "path";
56923
56784
 
56924
56785
  // src/content/wiki.ts
56925
56786
  var makeWikiScaffoldTemplate = (wikiRoot) => ({
@@ -57683,7 +57544,7 @@ Required skills:
57683
57544
  - \`write-backlog\`
57684
57545
 
57685
57546
  Scaffolded wiki base:
57686
- - 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
57687
57548
  - this is not the same thing as \`docs/\`
57688
57549
  - if the repo is monorepo-shaped, reconcile the scaffolded wiki into the real app layout, usually \`apps/wiki\`
57689
57550
  - if the CLI guessed the wrong root, move or refactor the scaffolded wiki before creating specs, plans, or ingesting domain knowledge
@@ -57712,10 +57573,10 @@ var copySkillDirectory = ({
57712
57573
  baseline
57713
57574
  }) => {
57714
57575
  const sourceDirectory = skillRegistryByIdForBaseline(baseline)[skillId].sourceDirectory;
57715
- const targetDirectory = path12.posix.join(".agents/skills", skillId);
57716
- const absoluteTargetDirectory = path12.join(outputDirectory, targetDirectory);
57717
- mkdirSync5(path12.join(outputDirectory, ".agents/skills"), { recursive: true });
57718
- rmSync4(absoluteTargetDirectory, { recursive: true, force: true });
57576
+ const targetDirectory = path11.posix.join(".agents/skills", skillId);
57577
+ const absoluteTargetDirectory = path11.join(outputDirectory, targetDirectory);
57578
+ mkdirSync4(path11.join(outputDirectory, ".agents/skills"), { recursive: true });
57579
+ rmSync3(absoluteTargetDirectory, { recursive: true, force: true });
57719
57580
  cpSync2(resolveBaselinePath({
57720
57581
  baselineRoot: baseline.root,
57721
57582
  baselineSkillsRoot: baseline.skillsRoot,
@@ -57723,42 +57584,43 @@ var copySkillDirectory = ({
57723
57584
  }), absoluteTargetDirectory, { recursive: true });
57724
57585
  return targetDirectory;
57725
57586
  };
57726
- var relativePosixPath2 = (from, to) => path12.relative(from, to).split(path12.sep).join("/");
57587
+ var relativePosixPath2 = (from, to) => path11.relative(from, to).split(path11.sep).join("/");
57727
57588
  var writeMissingFile = ({
57728
57589
  outputDirectory,
57729
57590
  targetPath,
57730
57591
  content
57731
57592
  }) => {
57732
- if (existsSync6(targetPath)) {
57593
+ if (existsSync5(targetPath)) {
57733
57594
  return null;
57734
57595
  }
57735
- mkdirSync5(path12.dirname(targetPath), { recursive: true });
57736
- writeFileSync5(targetPath, content);
57596
+ mkdirSync4(path11.dirname(targetPath), { recursive: true });
57597
+ writeFileSync4(targetPath, content);
57737
57598
  return relativePosixPath2(outputDirectory, targetPath);
57738
57599
  };
57739
57600
  var scaffoldWiki = ({
57740
57601
  outputDirectory,
57741
- wikiRoot
57602
+ wikiRoot,
57603
+ targetRoot
57742
57604
  }) => {
57743
57605
  const template = makeWikiScaffoldTemplate(wikiRoot);
57744
57606
  const createdFiles = [];
57745
- const wikiDirectory = path12.join(outputDirectory, wikiRoot);
57607
+ const wikiDirectory = path11.join(outputDirectory, targetRoot);
57746
57608
  for (const directory3 of template.topLevelDirectories) {
57747
- mkdirSync5(path12.join(wikiDirectory, directory3), { recursive: true });
57609
+ mkdirSync4(path11.join(wikiDirectory, directory3), { recursive: true });
57748
57610
  }
57749
57611
  for (const rawSubdirectory of template.rawSubdirectories) {
57750
- mkdirSync5(path12.join(wikiDirectory, "raw", rawSubdirectory), {
57612
+ mkdirSync4(path11.join(wikiDirectory, "raw", rawSubdirectory), {
57751
57613
  recursive: true
57752
57614
  });
57753
- const keepFile = path12.join(wikiDirectory, "raw", rawSubdirectory, ".gitkeep");
57615
+ const keepFile = path11.join(wikiDirectory, "raw", rawSubdirectory, ".gitkeep");
57754
57616
  const createdFile = writeMissingFile({ outputDirectory, targetPath: keepFile, content: "" });
57755
57617
  if (createdFile !== null) {
57756
57618
  createdFiles.push(createdFile);
57757
57619
  }
57758
57620
  }
57759
57621
  const directoryKeepFiles = [
57760
- path12.join(wikiDirectory, "content", "docs", "project", ".gitkeep"),
57761
- path12.join(wikiDirectory, "specs", ".gitkeep")
57622
+ path11.join(wikiDirectory, "content", "docs", "project", ".gitkeep"),
57623
+ path11.join(wikiDirectory, "specs", ".gitkeep")
57762
57624
  ];
57763
57625
  for (const keepFile of directoryKeepFiles) {
57764
57626
  const createdFile = writeMissingFile({ outputDirectory, targetPath: keepFile, content: "" });
@@ -57769,14 +57631,14 @@ var scaffoldWiki = ({
57769
57631
  for (const file6 of template.files) {
57770
57632
  const createdFile = writeMissingFile({
57771
57633
  outputDirectory,
57772
- targetPath: path12.join(wikiDirectory, file6.path),
57634
+ targetPath: path11.join(wikiDirectory, file6.path),
57773
57635
  content: file6.content
57774
57636
  });
57775
57637
  if (createdFile !== null) {
57776
57638
  createdFiles.push(createdFile);
57777
57639
  }
57778
57640
  }
57779
- const agentsPath = path12.join(wikiDirectory, "AGENTS.md");
57641
+ const agentsPath = path11.join(wikiDirectory, "AGENTS.md");
57780
57642
  const agentsFile = writeMissingFile({
57781
57643
  outputDirectory,
57782
57644
  targetPath: agentsPath,
@@ -57785,12 +57647,12 @@ var scaffoldWiki = ({
57785
57647
  if (agentsFile !== null) {
57786
57648
  createdFiles.push(agentsFile);
57787
57649
  }
57788
- const claudePath = path12.join(wikiDirectory, "CLAUDE.md");
57789
- if (!existsSync6(claudePath)) {
57650
+ const claudePath = path11.join(wikiDirectory, "CLAUDE.md");
57651
+ if (!existsSync5(claudePath)) {
57790
57652
  symlinkSync("AGENTS.md", claudePath);
57791
57653
  createdFiles.push(relativePosixPath2(outputDirectory, claudePath));
57792
57654
  }
57793
- const indexPath = path12.join(wikiDirectory, "index.md");
57655
+ const indexPath = path11.join(wikiDirectory, "index.md");
57794
57656
  const indexFile = writeMissingFile({
57795
57657
  outputDirectory,
57796
57658
  targetPath: indexPath,
@@ -57799,7 +57661,7 @@ var scaffoldWiki = ({
57799
57661
  if (indexFile !== null) {
57800
57662
  createdFiles.push(indexFile);
57801
57663
  }
57802
- const logPath = path12.join(wikiDirectory, "log.md");
57664
+ const logPath = path11.join(wikiDirectory, "log.md");
57803
57665
  const logFile = writeMissingFile({
57804
57666
  outputDirectory,
57805
57667
  targetPath: logPath,
@@ -57810,6 +57672,26 @@ var scaffoldWiki = ({
57810
57672
  }
57811
57673
  return createdFiles.toSorted();
57812
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
+ };
57813
57695
  var runStageScaffold = ({
57814
57696
  commandId,
57815
57697
  outputDirectory,
@@ -57818,7 +57700,10 @@ var runStageScaffold = ({
57818
57700
  }) => exports_Effect.gen(function* () {
57819
57701
  const stage = stageScaffoldById[commandId];
57820
57702
  const detection = yield* detectRepository(outputDirectory).pipe(exports_Effect.catchAll(() => exports_Effect.succeed(null)));
57821
- const wikiRoot = detection?.monorepo === true ? "apps/wiki" : "wiki";
57703
+ const wikiTarget = stageWikiTarget({
57704
+ outputDirectory,
57705
+ monorepo: detection?.monorepo === true
57706
+ });
57822
57707
  const skillFiles = stage.skills.map((skillId) => copySkillDirectory({
57823
57708
  outputDirectory,
57824
57709
  skillId,
@@ -57826,9 +57711,10 @@ var runStageScaffold = ({
57826
57711
  }));
57827
57712
  const wikiFiles = scaffoldWiki({
57828
57713
  outputDirectory,
57829
- wikiRoot
57714
+ wikiRoot: wikiTarget.wikiRoot,
57715
+ targetRoot: wikiTarget.targetRoot
57830
57716
  });
57831
- const operatorPrompt = stage.renderPrompt({ wikiRoot });
57717
+ const operatorPrompt = stage.renderPrompt({ wikiRoot: wikiTarget.wikiRoot });
57832
57718
  yield* prompt4.writeLine(renderScaffoldTitle());
57833
57719
  yield* prompt4.writeLine("");
57834
57720
  yield* prompt4.writeLine(renderStageIntro({
@@ -57848,6 +57734,12 @@ var runStageScaffold = ({
57848
57734
  yield* prompt4.writeLine(renderNotes([`Output directory: ${outputDirectory}`, "Hidden output directories: .agents"]));
57849
57735
  yield* prompt4.writeLine("");
57850
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
+ });
57851
57743
  return {
57852
57744
  outputDirectory,
57853
57745
  skillFiles,
@@ -57864,7 +57756,7 @@ var baselineOption = exports_Options.optional(exports_Options.choice("baseline",
57864
57756
  var refreshBaselineOption = exports_Options.boolean("refresh-baseline").pipe(exports_Options.withDescription("Refetch the stable baseline instead of reusing the local cache."));
57865
57757
  var stageCommand = (id2, description) => exports_Command.make(id2, { output: outputOption, baseline: baselineOption, refreshBaseline: refreshBaselineOption }, ({ output: output2, baseline, refreshBaseline }) => exports_Effect.scoped(exports_Effect.gen(function* () {
57866
57758
  const prompt4 = yield* PromptLive;
57867
- const outputDirectory = path13.resolve(process.cwd(), getOrElse(output2, () => "."));
57759
+ const outputDirectory = path12.resolve(process.cwd(), getOrElse(output2, () => "."));
57868
57760
  const resolvedBaseline = yield* exports_Effect.promise(() => resolveBaseline(baselineResolveOptions(baseline, refreshBaseline, outputDirectory)));
57869
57761
  yield* runStageScaffold({
57870
57762
  commandId: id2,
@@ -57882,9 +57774,9 @@ var setupCommand = exports_Command.make("setup", {
57882
57774
  refreshBaseline: refreshBaselineOption
57883
57775
  }, ({ input: input2, output: output2, json: json2, repoShape, baseline, refreshBaseline }) => exports_Effect.scoped(exports_Effect.gen(function* () {
57884
57776
  const prompt4 = yield* PromptLive;
57885
- const scanDirectory = path13.resolve(process.cwd(), getOrElse(input2, () => "."));
57777
+ const scanDirectory = path12.resolve(process.cwd(), getOrElse(input2, () => "."));
57886
57778
  const resolvedBaseline = yield* exports_Effect.promise(() => resolveBaseline(baselineResolveOptions(baseline, refreshBaseline, scanDirectory)));
57887
- const outputDirectory = map2(output2, (value6) => path13.resolve(process.cwd(), value6));
57779
+ const outputDirectory = map2(output2, (value6) => path12.resolve(process.cwd(), value6));
57888
57780
  const resolvedRepoShape = getOrElse(repoShape, () => "auto");
57889
57781
  yield* runScaffold(isSome2(outputDirectory) ? {
57890
57782
  scanDirectory,
@@ -57914,23 +57806,23 @@ var scaffoldCommand = exports_Command.make("scaffold", {}, () => exports_Effect.
57914
57806
  ]));
57915
57807
 
57916
57808
  // src/cli/update-command.ts
57917
- import path15 from "path";
57809
+ import path14 from "path";
57918
57810
 
57919
57811
  // src/update/run.ts
57920
57812
  import { createHash as createHash3 } from "crypto";
57921
57813
  import {
57922
57814
  cpSync as cpSync3,
57923
- existsSync as existsSync7,
57815
+ existsSync as existsSync6,
57924
57816
  lstatSync as lstatSync2,
57925
- mkdirSync as mkdirSync6,
57817
+ mkdirSync as mkdirSync5,
57926
57818
  mkdtempSync as mkdtempSync2,
57927
- readFileSync as readFileSync7,
57819
+ readFileSync as readFileSync6,
57928
57820
  readlinkSync as readlinkSync2,
57929
- rmSync as rmSync5,
57821
+ rmSync as rmSync4,
57930
57822
  symlinkSync as symlinkSync2
57931
57823
  } from "fs";
57932
57824
  import { tmpdir as tmpdir3 } from "os";
57933
- import path14 from "path";
57825
+ import path13 from "path";
57934
57826
 
57935
57827
  // ../../node_modules/.bun/diff@9.0.0/node_modules/diff/libesm/diff/base.js
57936
57828
  class Diff {
@@ -58032,16 +57924,16 @@ class Diff {
58032
57924
  }
58033
57925
  }
58034
57926
  }
58035
- addToPath(path14, added, removed, oldPosInc, options9) {
58036
- const last5 = path14.lastComponent;
57927
+ addToPath(path13, added, removed, oldPosInc, options9) {
57928
+ const last5 = path13.lastComponent;
58037
57929
  if (last5 && !options9.oneChangePerToken && last5.added === added && last5.removed === removed) {
58038
57930
  return {
58039
- oldPos: path14.oldPos + oldPosInc,
57931
+ oldPos: path13.oldPos + oldPosInc,
58040
57932
  lastComponent: { count: last5.count + 1, added, removed, previousComponent: last5.previousComponent }
58041
57933
  };
58042
57934
  } else {
58043
57935
  return {
58044
- oldPos: path14.oldPos + oldPosInc,
57936
+ oldPos: path13.oldPos + oldPosInc,
58045
57937
  lastComponent: { count: 1, added, removed, previousComponent: last5 }
58046
57938
  };
58047
57939
  }
@@ -58874,15 +58766,15 @@ var selectedSkills3 = (finalPacks, baseline) => [
58874
58766
  ...new Set(finalPacks.flatMap((packId) => skillsForPack(packId, baseline)))
58875
58767
  ].toSorted();
58876
58768
  var readManifest = (rootDirectory) => {
58877
- const manifestPath = path14.join(rootDirectory, scaffoldManifestFile);
58878
- if (!existsSync7(manifestPath)) {
58769
+ const manifestPath = path13.join(rootDirectory, scaffoldManifestFile);
58770
+ if (!existsSync6(manifestPath)) {
58879
58771
  throw new Error(`Missing ${scaffoldManifestFile}. Run \`punks scaffold setup\` first.`);
58880
58772
  }
58881
- return parseManifest(readFileSync7(manifestPath, "utf8"));
58773
+ return parseManifest(readFileSync6(manifestPath, "utf8"));
58882
58774
  };
58883
58775
  var contentForDiff = (rootDirectory, relativePath) => {
58884
- const absolutePath = path14.join(rootDirectory, relativePath);
58885
- if (!existsSync7(absolutePath)) {
58776
+ const absolutePath = path13.join(rootDirectory, relativePath);
58777
+ if (!existsSync6(absolutePath)) {
58886
58778
  return "";
58887
58779
  }
58888
58780
  const stat3 = lstatSync2(absolutePath);
@@ -58890,15 +58782,15 @@ var contentForDiff = (rootDirectory, relativePath) => {
58890
58782
  return `symlink:${readlinkSync2(absolutePath)}
58891
58783
  `;
58892
58784
  }
58893
- return readFileSync7(absolutePath, "utf8");
58785
+ return readFileSync6(absolutePath, "utf8");
58894
58786
  };
58895
58787
  var hashPath = (rootDirectory, relativePath) => {
58896
- const absolutePath = path14.join(rootDirectory, relativePath);
58897
- if (!existsSync7(absolutePath)) {
58788
+ const absolutePath = path13.join(rootDirectory, relativePath);
58789
+ if (!existsSync6(absolutePath)) {
58898
58790
  return null;
58899
58791
  }
58900
58792
  const stat3 = lstatSync2(absolutePath);
58901
- const content = stat3.isSymbolicLink() ? `symlink:${readlinkSync2(absolutePath)}` : readFileSync7(absolutePath);
58793
+ const content = stat3.isSymbolicLink() ? `symlink:${readlinkSync2(absolutePath)}` : readFileSync6(absolutePath);
58902
58794
  return hashContent2(content);
58903
58795
  };
58904
58796
  var copyManagedFile = ({
@@ -58906,12 +58798,12 @@ var copyManagedFile = ({
58906
58798
  toDirectory,
58907
58799
  relativePath
58908
58800
  }) => {
58909
- const sourcePath = path14.join(fromDirectory, relativePath);
58910
- const targetPath = path14.join(toDirectory, relativePath);
58801
+ const sourcePath = path13.join(fromDirectory, relativePath);
58802
+ const targetPath = path13.join(toDirectory, relativePath);
58911
58803
  const stat3 = lstatSync2(sourcePath);
58912
- mkdirSync6(path14.dirname(targetPath), { recursive: true });
58913
- if (existsSync7(targetPath)) {
58914
- rmSync5(targetPath, { recursive: true, force: true });
58804
+ mkdirSync5(path13.dirname(targetPath), { recursive: true });
58805
+ if (existsSync6(targetPath)) {
58806
+ rmSync4(targetPath, { recursive: true, force: true });
58915
58807
  }
58916
58808
  if (stat3.isSymbolicLink()) {
58917
58809
  symlinkSync2(readlinkSync2(sourcePath), targetPath);
@@ -59028,7 +58920,7 @@ var runUpdate = ({
59028
58920
  const baselineDrift = typeof manifestBaseline?.version === "string" && manifestBaseline.version !== baseline.summary.version;
59029
58921
  const resolvedPacks = resolved.preselectedPacks;
59030
58922
  const packDrift = !comparePacks(finalPacks, resolvedPacks);
59031
- const expectedDirectory = mkdtempSync2(path14.join(tmpdir3(), "punks-update-"));
58923
+ const expectedDirectory = mkdtempSync2(path13.join(tmpdir3(), "punks-update-"));
59032
58924
  const expected = yield* writeScaffoldOutput({
59033
58925
  scanDirectory: rootDirectory,
59034
58926
  detection,
@@ -59123,7 +59015,7 @@ var runUpdate = ({
59123
59015
  });
59124
59016
  }
59125
59017
  for (const staleFile of staleFiles) {
59126
- rmSync5(path14.join(rootDirectory, staleFile), { recursive: true, force: true });
59018
+ rmSync4(path13.join(rootDirectory, staleFile), { recursive: true, force: true });
59127
59019
  }
59128
59020
  }
59129
59021
  if (check2 && needsAttention) {
@@ -59158,9 +59050,9 @@ var runUpdate = ({
59158
59050
  yield* prompt4.writeLine(renderJsonLabel());
59159
59051
  yield* prompt4.writeLine(encodePrettyJson2(result));
59160
59052
  }
59161
- rmSync5(expectedDirectory, { recursive: true, force: true });
59053
+ rmSync4(expectedDirectory, { recursive: true, force: true });
59162
59054
  if (result.applied) {
59163
- submitCliEvent("cli.scaffold.update.applied", {
59055
+ yield* submitCliEventEffect("cli.scaffold.update.applied", {
59164
59056
  cwd: rootDirectory,
59165
59057
  baseline: {
59166
59058
  version: baseline.summary.version
@@ -59186,7 +59078,7 @@ var updateCommand = exports_Command.make("update", {
59186
59078
  refreshBaseline: refreshBaselineOption2
59187
59079
  }, ({ input: input2, check: check2, write: write4, json: json2, baseline, refreshBaseline }) => exports_Effect.scoped(exports_Effect.gen(function* () {
59188
59080
  const prompt4 = yield* PromptLive;
59189
- const rootDirectory = path15.resolve(process.cwd(), getOrElse(input2, () => "."));
59081
+ const rootDirectory = path14.resolve(process.cwd(), getOrElse(input2, () => "."));
59190
59082
  const resolvedBaseline = yield* exports_Effect.promise(() => resolveBaseline(baselineResolveOptions(baseline, refreshBaseline, rootDirectory)));
59191
59083
  yield* runUpdate({
59192
59084
  rootDirectory,
@@ -59325,6 +59217,9 @@ var detectCliInstallPackageManager = ({
59325
59217
  if (normalizedEntrypoint.includes("/pnpm/") || normalizedEntrypoint.includes("\\pnpm\\") || normalizedEntrypoint.includes("/.pnpm/")) {
59326
59218
  return "pnpm";
59327
59219
  }
59220
+ if (normalizedEntrypoint.includes("/yarn/") || normalizedEntrypoint.includes("\\yarn\\") || normalizedEntrypoint.includes("/.yarn/")) {
59221
+ return "yarn";
59222
+ }
59328
59223
  if (normalizedEntrypoint.includes("/node_modules/@punks/cli/") || normalizedEntrypoint.includes("\\node_modules\\@punks\\cli\\")) {
59329
59224
  return "npm";
59330
59225
  }
@@ -59337,6 +59232,9 @@ var detectCliInstallPackageManager = ({
59337
59232
  if (userAgent?.startsWith("pnpm/") === true) {
59338
59233
  return "pnpm";
59339
59234
  }
59235
+ if (userAgent?.startsWith("yarn/") === true) {
59236
+ return "yarn";
59237
+ }
59340
59238
  if (userAgent?.startsWith("npm/") === true) {
59341
59239
  return "npm";
59342
59240
  }
@@ -59350,11 +59248,24 @@ var globalInstallCommandForPackageManager = ({
59350
59248
  const specifier = `${packageName}@${tag6}`;
59351
59249
  switch (packageManager) {
59352
59250
  case "bun":
59353
- return ["bun", "add", "-g", specifier];
59251
+ return ["bun", "add", "-g", specifier, "--minimum-release-age=0"];
59354
59252
  case "pnpm":
59355
59253
  return ["pnpm", "add", "-g", specifier];
59356
59254
  case "npm":
59357
- 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 {};
59358
59269
  }
59359
59270
  };
59360
59271
  var autoUpdateCliIfStale = async ({
@@ -59385,10 +59296,65 @@ var autoUpdateCliIfStale = async ({
59385
59296
  packageName,
59386
59297
  tag: tag6
59387
59298
  });
59299
+ const environment2 = minimumReleaseAgeEnvironmentForPackageManager(packageManager);
59388
59300
  return {
59389
59301
  status: "available",
59390
59302
  check: check2,
59391
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,
59392
59358
  command
59393
59359
  };
59394
59360
  };
@@ -59476,13 +59442,69 @@ var checkDpCliSkillPresence = () => {
59476
59442
  };
59477
59443
  };
59478
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
+
59479
59501
  // src/index.ts
59480
59502
  var startupCheckWorkerEnv = "DP_STARTUP_CHECK_WORKER";
59481
59503
  var startupCheckCliEnv = "DP_STARTUP_CHECK_CLI";
59482
59504
  var startupCheckSkillEnv = "DP_STARTUP_CHECK_SKILL";
59483
59505
  var startupCheckIntervalMs = Number.parseInt(process.env.DP_STARTUP_CHECK_INTERVAL_MS ?? String(12 * 60 * 60 * 1000), 10);
59484
- var startupCheckCacheFile = path16.join(homedir4(), ".cache", "punks", "startup-check.json");
59485
- 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([authCommand, reportCommand, scaffoldCommand, updateCommand]));
59506
+ var startupCheckCacheFile = path15.join(homedir3(), ".cache", "punks", "startup-check.json");
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]));
59486
59508
  var cli = exports_Command.run(app, {
59487
59509
  name: "punks",
59488
59510
  version
@@ -59529,15 +59551,15 @@ var hasFreshStartupCheck = () => {
59529
59551
  return false;
59530
59552
  }
59531
59553
  try {
59532
- const parsed = JSON.parse(readFileSync8(startupCheckCacheFile, "utf8"));
59554
+ const parsed = JSON.parse(readFileSync7(startupCheckCacheFile, "utf8"));
59533
59555
  return typeof parsed.checkedAt === "number" && Date.now() - parsed.checkedAt < startupCheckIntervalMs;
59534
59556
  } catch {
59535
59557
  return false;
59536
59558
  }
59537
59559
  };
59538
59560
  var markStartupCheckStarted = () => {
59539
- mkdirSync7(path16.dirname(startupCheckCacheFile), { recursive: true });
59540
- writeFileSync6(startupCheckCacheFile, JSON.stringify({ checkedAt: Date.now() }, null, 2));
59561
+ mkdirSync6(path15.dirname(startupCheckCacheFile), { recursive: true });
59562
+ writeFileSync5(startupCheckCacheFile, JSON.stringify({ checkedAt: Date.now() }, null, 2));
59541
59563
  };
59542
59564
  var startBackgroundStartupChecks = () => {
59543
59565
  const checkCli = shouldCheckSelfUpdate();
@@ -59546,7 +59568,7 @@ var startBackgroundStartupChecks = () => {
59546
59568
  return;
59547
59569
  }
59548
59570
  const entrypoint = process.argv[1];
59549
- if (entrypoint === undefined || !existsSync8(entrypoint)) {
59571
+ if (entrypoint === undefined || !existsSync7(entrypoint)) {
59550
59572
  return;
59551
59573
  }
59552
59574
  markStartupCheckStarted();