@deslop/workbench 0.0.332 → 0.0.343
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/client/assets/agent-BATV5D0O.js +1 -0
- package/dist/client/assets/agent-K-v27T1K.js +2 -0
- package/dist/client/assets/button-f42ZKq6E.js +16 -0
- package/dist/client/assets/diff-BwOj6t_o.js +217 -0
- package/dist/client/assets/{diff-DRdkZUfM.js → diff-COOvYjfB.js} +2 -2
- package/dist/client/assets/{external-link-CHsqlplI.js → external-link-DR7_wu3r.js} +1 -1
- package/dist/client/assets/{fallbacks-DRWx0EQv.js → fallbacks-D-9MltuA.js} +1 -1
- package/dist/client/assets/{index-COqgQoHe.js → index-DCRiD9Nz.js} +3 -3
- package/dist/client/assets/index-DNWcrdqu.css +2 -0
- package/dist/client/assets/input-group-mMwtG03E.js +153 -0
- package/dist/client/assets/loader-circle-DEYAvEPU.js +1 -0
- package/dist/client/assets/portless-C8dLcQQw.js +2 -0
- package/dist/client/assets/{portless-CIQUkBPx.js → portless-nerboxiJ.js} +1 -1
- package/dist/client/assets/{resizable-bJdqT1JF.js → resizable-ChkQg6Mj.js} +1 -1
- package/dist/client/assets/route-DAz8IJkt.js +2 -0
- package/dist/client/assets/route-GFqYSDK4.js +45 -0
- package/dist/client/assets/run-B16WQaws.js +2 -0
- package/dist/client/assets/run-BHEbhvk3.js +1 -0
- package/dist/client/assets/state-BOj5tZ-Q.js +2 -0
- package/dist/client/assets/terminal-B410vkZ0.js +1 -0
- package/dist/client/assets/{terminal-BehqmxVT.js → terminal-BQ9AR6VK.js} +2 -2
- package/dist/client/assets/terminal-Br297Oa8.js +2 -0
- package/dist/client/assets/{triangle-alert-D2wmXkyn.js → triangle-alert-CQsOhrGn.js} +1 -1
- package/dist/client/index.html +12 -12
- package/dist/{execAsync-CgtnVVso.mjs → execAsync-BeHTdVKh.mjs} +1 -1
- package/dist/{getMachineId-bsd-DYUtJhPR.mjs → getMachineId-bsd-8V0SSHI2.mjs} +2 -2
- package/dist/{getMachineId-darwin-BYjMzwa2.mjs → getMachineId-darwin-fwMRmXNE.mjs} +2 -2
- package/dist/{getMachineId-linux-7FQ_TPIw.mjs → getMachineId-linux-BglPdw6k.mjs} +1 -1
- package/dist/{getMachineId-unsupported-CqYci84U.mjs → getMachineId-unsupported-B6r8oWEG.mjs} +1 -1
- package/dist/{getMachineId-win-BxTTz_Ds.mjs → getMachineId-win-Bvbq3C3K.mjs} +2 -2
- package/dist/server.js +1105 -853
- package/package.json +3 -3
- package/dist/client/assets/agent-ksblBy0b.js +0 -2
- package/dist/client/assets/agent-qBUgLqez.js +0 -1
- package/dist/client/assets/button-Cl3QGxsE.js +0 -16
- package/dist/client/assets/diff-V_u66cov.js +0 -217
- package/dist/client/assets/index-BX6N5TyF.css +0 -2
- package/dist/client/assets/input-group-DfylGHnW.js +0 -153
- package/dist/client/assets/loader-circle-G9WKrfSd.js +0 -1
- package/dist/client/assets/portless-M280rnul.js +0 -2
- package/dist/client/assets/route-CzD0EIT6.js +0 -2
- package/dist/client/assets/route-JiIT6ta2.js +0 -45
- package/dist/client/assets/run-JZrpFZA0.js +0 -1
- package/dist/client/assets/run-nZsFjagi.js +0 -2
- package/dist/client/assets/state-DG0Oc1Jw.js +0 -2
- package/dist/client/assets/terminal-CRGNH_jn.js +0 -1
- package/dist/client/assets/terminal-DtCniSNL.js +0 -2
package/dist/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env -S node --max-old-space-size=
|
|
1
|
+
#!/usr/bin/env -S node --max-old-space-size=16384 --heapsnapshot-near-heap-limit=3 --report-on-fatalerror
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import * as Http from "node:http";
|
|
4
4
|
import { createServer } from "node:http";
|
|
@@ -4562,7 +4562,7 @@ const isSome$1 = (fa) => fa._tag === "Some";
|
|
|
4562
4562
|
/** @internal */
|
|
4563
4563
|
const none$1 = /*#__PURE__*/ Object.create(NoneProto);
|
|
4564
4564
|
/** @internal */
|
|
4565
|
-
const some$
|
|
4565
|
+
const some$1 = (value) => {
|
|
4566
4566
|
const a = Object.create(SomeProto);
|
|
4567
4567
|
a.value = value;
|
|
4568
4568
|
return a;
|
|
@@ -5061,7 +5061,7 @@ const none = () => none$1;
|
|
|
5061
5061
|
* @category constructors
|
|
5062
5062
|
* @since 2.0.0
|
|
5063
5063
|
*/
|
|
5064
|
-
const some
|
|
5064
|
+
const some = some$1;
|
|
5065
5065
|
/**
|
|
5066
5066
|
* Checks whether an `Option` is `None` (absent).
|
|
5067
5067
|
*
|
|
@@ -5153,7 +5153,7 @@ const isSome = isSome$1;
|
|
|
5153
5153
|
* @category pattern matching
|
|
5154
5154
|
* @since 2.0.0
|
|
5155
5155
|
*/
|
|
5156
|
-
const match$
|
|
5156
|
+
const match$4 = /*#__PURE__*/ dual(2, (self, { onNone, onSome }) => isNone(self) ? onNone() : onSome(self.value));
|
|
5157
5157
|
/**
|
|
5158
5158
|
* Extracts the value from a `Some`, or evaluates a fallback thunk on `None`.
|
|
5159
5159
|
*
|
|
@@ -5256,7 +5256,7 @@ const orElse$3 = /*#__PURE__*/ dual(2, (self, that) => isNone(self) ? that() : s
|
|
|
5256
5256
|
* @category converting
|
|
5257
5257
|
* @since 4.0.0
|
|
5258
5258
|
*/
|
|
5259
|
-
const fromNullishOr = (a) => a == null ? none() : some
|
|
5259
|
+
const fromNullishOr = (a) => a == null ? none() : some(a);
|
|
5260
5260
|
/**
|
|
5261
5261
|
* Converts a possibly `undefined` value into an `Option`, leaving `null`
|
|
5262
5262
|
* as a valid `Some`.
|
|
@@ -5291,7 +5291,7 @@ const fromNullishOr = (a) => a == null ? none() : some$1(a);
|
|
|
5291
5291
|
* @category converting
|
|
5292
5292
|
* @since 4.0.0
|
|
5293
5293
|
*/
|
|
5294
|
-
const fromUndefinedOr = (a) => a === void 0 ? none() : some
|
|
5294
|
+
const fromUndefinedOr = (a) => a === void 0 ? none() : some(a);
|
|
5295
5295
|
/**
|
|
5296
5296
|
* Extracts the value from a `Some`, or returns `undefined` for `None`.
|
|
5297
5297
|
*
|
|
@@ -5355,7 +5355,7 @@ const getOrUndefined$1 = /*#__PURE__*/ getOrElse$1(constUndefined);
|
|
|
5355
5355
|
* @category mapping
|
|
5356
5356
|
* @since 2.0.0
|
|
5357
5357
|
*/
|
|
5358
|
-
const map$9 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : some
|
|
5358
|
+
const map$9 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : some(f(self.value)));
|
|
5359
5359
|
/**
|
|
5360
5360
|
* Applies a function that returns an `Option` to the value of a `Some`,
|
|
5361
5361
|
* flattening the result. Returns `None` if the input is `None`.
|
|
@@ -5442,7 +5442,7 @@ const flatMap$6 = /*#__PURE__*/ dual(2, (self, f) => isNone(self) ? none() : f(s
|
|
|
5442
5442
|
* @category filtering
|
|
5443
5443
|
* @since 2.0.0
|
|
5444
5444
|
*/
|
|
5445
|
-
const filter$2 = /*#__PURE__*/ dual(2, (self, predicate) => isNone(self) ? none() : predicate(self.value) ? some
|
|
5445
|
+
const filter$2 = /*#__PURE__*/ dual(2, (self, predicate) => isNone(self) ? none() : predicate(self.value) ? some(self.value) : none());
|
|
5446
5446
|
//#endregion
|
|
5447
5447
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.74/node_modules/effect/dist/Result.js
|
|
5448
5448
|
/**
|
|
@@ -5501,37 +5501,6 @@ const succeed$7 = succeed$8;
|
|
|
5501
5501
|
*/
|
|
5502
5502
|
const fail$7 = fail$8;
|
|
5503
5503
|
/**
|
|
5504
|
-
* Provides a pre-built failed `Result` whose failure value is `undefined`.
|
|
5505
|
-
*
|
|
5506
|
-
* **When to use**
|
|
5507
|
-
*
|
|
5508
|
-
* Use when a failure should act only as a control signal and no failure value
|
|
5509
|
-
* is needed.
|
|
5510
|
-
*
|
|
5511
|
-
* **Details**
|
|
5512
|
-
*
|
|
5513
|
-
* This is equivalent to `Result.fail(undefined)` with type
|
|
5514
|
-
* `Result<never, void>`, but reuses a shared `Failure` wrapper instead of
|
|
5515
|
-
* allocating one each time.
|
|
5516
|
-
*
|
|
5517
|
-
* **Example** (Using a failure without a payload)
|
|
5518
|
-
*
|
|
5519
|
-
* ```ts
|
|
5520
|
-
* import { Result } from "effect"
|
|
5521
|
-
*
|
|
5522
|
-
* const result = Result.failVoid
|
|
5523
|
-
*
|
|
5524
|
-
* console.log(Result.isFailure(result))
|
|
5525
|
-
* // Output: true
|
|
5526
|
-
* ```
|
|
5527
|
-
*
|
|
5528
|
-
* @see {@link fail} to create a Failure with a specific value
|
|
5529
|
-
*
|
|
5530
|
-
* @category constructors
|
|
5531
|
-
* @since 4.0.0
|
|
5532
|
-
*/
|
|
5533
|
-
const failVoid = /*#__PURE__*/ fail$7(void 0);
|
|
5534
|
-
/**
|
|
5535
5504
|
* Checks whether a value is a `Result` (either `Success` or `Failure`).
|
|
5536
5505
|
*
|
|
5537
5506
|
* **When to use**
|
|
@@ -5658,7 +5627,7 @@ const isSuccess$1 = isSuccess$2;
|
|
|
5658
5627
|
* @category pattern matching
|
|
5659
5628
|
* @since 2.0.0
|
|
5660
5629
|
*/
|
|
5661
|
-
const match$
|
|
5630
|
+
const match$3 = /*#__PURE__*/ dual(2, (self, { onFailure, onSuccess }) => isFailure$1(self) ? onFailure(self.failure) : onSuccess(self.success));
|
|
5662
5631
|
//#endregion
|
|
5663
5632
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.74/node_modules/effect/dist/Tuple.js
|
|
5664
5633
|
/**
|
|
@@ -5725,6 +5694,57 @@ const headUnsafe = (self) => {
|
|
|
5725
5694
|
if (result.done) throw new Error("headUnsafe: empty iterable");
|
|
5726
5695
|
return result.value;
|
|
5727
5696
|
};
|
|
5697
|
+
/**
|
|
5698
|
+
* Returns the first element that satisfies the specified
|
|
5699
|
+
* predicate, or `None` if no such element exists.
|
|
5700
|
+
*
|
|
5701
|
+
* **Example** (Finding the first match)
|
|
5702
|
+
*
|
|
5703
|
+
* ```ts
|
|
5704
|
+
* import { Iterable, Option } from "effect"
|
|
5705
|
+
*
|
|
5706
|
+
* const numbers = [1, 3, 4, 6, 8]
|
|
5707
|
+
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
5708
|
+
* console.log(firstEven) // Option.some(4)
|
|
5709
|
+
*
|
|
5710
|
+
* const firstGreaterThan10 = Iterable.findFirst(numbers, (x) => x > 10)
|
|
5711
|
+
* console.log(firstGreaterThan10) // Option.none()
|
|
5712
|
+
*
|
|
5713
|
+
* // With index
|
|
5714
|
+
* const letters = ["a", "b", "c", "d"]
|
|
5715
|
+
* const atEvenIndex = Iterable.findFirst(letters, (_, i) => i % 2 === 0)
|
|
5716
|
+
* console.log(atEvenIndex) // Option.some("a")
|
|
5717
|
+
*
|
|
5718
|
+
* // Type refinement
|
|
5719
|
+
* const mixed: Array<string | number> = [1, "hello", 2, "world"]
|
|
5720
|
+
* const firstString = Iterable.findFirst(
|
|
5721
|
+
* mixed,
|
|
5722
|
+
* (x): x is string => typeof x === "string"
|
|
5723
|
+
* )
|
|
5724
|
+
* console.log(firstString) // Option.some("hello")
|
|
5725
|
+
*
|
|
5726
|
+
* // Transform during search
|
|
5727
|
+
* const findSquareRoot = Iterable.findFirst([1, 4, 9, 16], (x) => {
|
|
5728
|
+
* const sqrt = Math.sqrt(x)
|
|
5729
|
+
* return Number.isInteger(sqrt) ? Option.some(sqrt) : Option.none()
|
|
5730
|
+
* })
|
|
5731
|
+
* console.log(findSquareRoot) // Option.some(1)
|
|
5732
|
+
* ```
|
|
5733
|
+
*
|
|
5734
|
+
* @category elements
|
|
5735
|
+
* @since 2.0.0
|
|
5736
|
+
*/
|
|
5737
|
+
const findFirst$3 = /*#__PURE__*/ dual(2, (self, f) => {
|
|
5738
|
+
let i = 0;
|
|
5739
|
+
for (const a of self) {
|
|
5740
|
+
const o = f(a, i);
|
|
5741
|
+
if (isBoolean(o)) {
|
|
5742
|
+
if (o) return some(a);
|
|
5743
|
+
} else if (isSome(o)) return o;
|
|
5744
|
+
i++;
|
|
5745
|
+
}
|
|
5746
|
+
return none();
|
|
5747
|
+
});
|
|
5728
5748
|
const constEmpty = { [Symbol.iterator]() {
|
|
5729
5749
|
return constEmptyIterator;
|
|
5730
5750
|
} };
|
|
@@ -6176,7 +6196,7 @@ const ensure = (self) => Array$1.isArray(self) ? self : [self];
|
|
|
6176
6196
|
* @category pattern matching
|
|
6177
6197
|
* @since 2.0.0
|
|
6178
6198
|
*/
|
|
6179
|
-
const match$
|
|
6199
|
+
const match$2 = /*#__PURE__*/ dual(2, (self, { onEmpty, onNonEmpty }) => isReadonlyArrayNonEmpty(self) ? onNonEmpty(self) : onEmpty());
|
|
6180
6200
|
/**
|
|
6181
6201
|
* Adds a single element to the end of an iterable, returning a `NonEmptyArray`.
|
|
6182
6202
|
*
|
|
@@ -6368,7 +6388,7 @@ const clamp = (i, as) => Math.floor(Math.min(Math.max(0, i), as.length));
|
|
|
6368
6388
|
*/
|
|
6369
6389
|
const get$10 = /*#__PURE__*/ dual(2, (self, index) => {
|
|
6370
6390
|
const i = Math.floor(index);
|
|
6371
|
-
return isOutOfBounds(i, self) ? none() : some
|
|
6391
|
+
return isOutOfBounds(i, self) ? none() : some(self[i]);
|
|
6372
6392
|
});
|
|
6373
6393
|
/**
|
|
6374
6394
|
* Reads an element at the given index, throwing if the index is out of bounds.
|
|
@@ -6472,7 +6492,7 @@ const headNonEmpty = /*#__PURE__*/ getUnsafe$1(0);
|
|
|
6472
6492
|
* @category getters
|
|
6473
6493
|
* @since 2.0.0
|
|
6474
6494
|
*/
|
|
6475
|
-
const last = (self) => isReadonlyArrayNonEmpty(self) ? some
|
|
6495
|
+
const last = (self) => isReadonlyArrayNonEmpty(self) ? some(lastNonEmpty(self)) : none();
|
|
6476
6496
|
/**
|
|
6477
6497
|
* Returns the last element of a `NonEmptyReadonlyArray` directly (no `Option`
|
|
6478
6498
|
* wrapper).
|
|
@@ -6519,45 +6539,6 @@ const lastNonEmpty = (self) => self[self.length - 1];
|
|
|
6519
6539
|
*/
|
|
6520
6540
|
const tailNonEmpty = (self) => self.slice(1);
|
|
6521
6541
|
/**
|
|
6522
|
-
* Takes elements from the start while the predicate holds, stopping at the
|
|
6523
|
-
* first element that fails.
|
|
6524
|
-
*
|
|
6525
|
-
* **When to use**
|
|
6526
|
-
*
|
|
6527
|
-
* Use to keep the leading elements of an iterable while each element satisfies
|
|
6528
|
-
* a predicate, returning the retained prefix as an array.
|
|
6529
|
-
*
|
|
6530
|
-
* **Details**
|
|
6531
|
-
*
|
|
6532
|
-
* - Supports refinements for type narrowing.
|
|
6533
|
-
* - The predicate receives `(element, index)`.
|
|
6534
|
-
*
|
|
6535
|
-
* **Example** (Taking while condition holds)
|
|
6536
|
-
*
|
|
6537
|
-
* ```ts
|
|
6538
|
-
* import { Array } from "effect"
|
|
6539
|
-
*
|
|
6540
|
-
* console.log(Array.takeWhile([1, 3, 2, 4, 1, 2], (x) => x < 4)) // [1, 3, 2]
|
|
6541
|
-
* ```
|
|
6542
|
-
*
|
|
6543
|
-
* @see {@link take} for keeping a fixed number of leading elements
|
|
6544
|
-
* @see {@link dropWhile} for removing the matching prefix and keeping the rest
|
|
6545
|
-
* @see {@link span} for splitting the matching prefix from the remaining elements
|
|
6546
|
-
*
|
|
6547
|
-
* @category getters
|
|
6548
|
-
* @since 2.0.0
|
|
6549
|
-
*/
|
|
6550
|
-
const takeWhile = /*#__PURE__*/ dual(2, (self, predicate) => {
|
|
6551
|
-
let i = 0;
|
|
6552
|
-
const out = [];
|
|
6553
|
-
for (const a of self) {
|
|
6554
|
-
if (!predicate(a, i)) break;
|
|
6555
|
-
out.push(a);
|
|
6556
|
-
i++;
|
|
6557
|
-
}
|
|
6558
|
-
return out;
|
|
6559
|
-
});
|
|
6560
|
-
/**
|
|
6561
6542
|
* Removes the first `n` elements, creating a new array.
|
|
6562
6543
|
*
|
|
6563
6544
|
* **When to use**
|
|
@@ -6619,6 +6600,37 @@ const dropRight = /*#__PURE__*/ dual(2, (self, n) => {
|
|
|
6619
6600
|
return input.slice(0, input.length - clamp(n, input));
|
|
6620
6601
|
});
|
|
6621
6602
|
/**
|
|
6603
|
+
* Returns the first element matching a predicate, refinement, or mapping
|
|
6604
|
+
* function, wrapped in `Option`.
|
|
6605
|
+
*
|
|
6606
|
+
* **When to use**
|
|
6607
|
+
*
|
|
6608
|
+
* Use to scan an iterable in iteration order and return the first selected
|
|
6609
|
+
* element or mapped value as an `Option`.
|
|
6610
|
+
*
|
|
6611
|
+
* **Details**
|
|
6612
|
+
*
|
|
6613
|
+
* - Accepts a predicate `(a, i) => boolean`, a refinement, or a function
|
|
6614
|
+
* `(a, i) => Option<B>` for simultaneous find-and-transform.
|
|
6615
|
+
* - Returns `Option.none()` if no element matches.
|
|
6616
|
+
*
|
|
6617
|
+
* **Example** (Finding the first match)
|
|
6618
|
+
*
|
|
6619
|
+
* ```ts
|
|
6620
|
+
* import { Array } from "effect"
|
|
6621
|
+
*
|
|
6622
|
+
* console.log(Array.findFirst([1, 2, 3, 4, 5], (x) => x > 3)) // Option.some(4)
|
|
6623
|
+
* ```
|
|
6624
|
+
*
|
|
6625
|
+
* @see {@link findLast} — search from the end
|
|
6626
|
+
* @see {@link findFirstIndex} — get the index instead
|
|
6627
|
+
* @see {@link findFirstWithIndex} — get both element and index
|
|
6628
|
+
*
|
|
6629
|
+
* @category elements
|
|
6630
|
+
* @since 2.0.0
|
|
6631
|
+
*/
|
|
6632
|
+
const findFirst$2 = findFirst$3;
|
|
6633
|
+
/**
|
|
6622
6634
|
* Reverses an iterable into a new array.
|
|
6623
6635
|
*
|
|
6624
6636
|
* **When to use**
|
|
@@ -6925,35 +6937,6 @@ const getSomes = (self) => {
|
|
|
6925
6937
|
return out;
|
|
6926
6938
|
};
|
|
6927
6939
|
/**
|
|
6928
|
-
* Extracts all success values from an iterable of `Result`s, discarding
|
|
6929
|
-
* failures.
|
|
6930
|
-
*
|
|
6931
|
-
* **When to use**
|
|
6932
|
-
*
|
|
6933
|
-
* Use to collect only success values from `Result` values while discarding
|
|
6934
|
-
* failures.
|
|
6935
|
-
*
|
|
6936
|
-
* **Example** (Extracting successes)
|
|
6937
|
-
*
|
|
6938
|
-
* ```ts
|
|
6939
|
-
* import { Array, Result } from "effect"
|
|
6940
|
-
*
|
|
6941
|
-
* console.log(Array.getSuccesses([Result.succeed(1), Result.fail("err"), Result.succeed(2)]))
|
|
6942
|
-
* // [1, 2]
|
|
6943
|
-
* ```
|
|
6944
|
-
*
|
|
6945
|
-
* @see {@link getFailures} — extract failure values
|
|
6946
|
-
* @see {@link separate} — split into failures and successes
|
|
6947
|
-
*
|
|
6948
|
-
* @category filtering
|
|
6949
|
-
* @since 4.0.0
|
|
6950
|
-
*/
|
|
6951
|
-
const getSuccesses = (self) => {
|
|
6952
|
-
const out = [];
|
|
6953
|
-
for (const a of self) if (isSuccess$1(a)) out.push(a.success);
|
|
6954
|
-
return out;
|
|
6955
|
-
};
|
|
6956
|
-
/**
|
|
6957
6940
|
* Keeps only elements satisfying a predicate (or refinement).
|
|
6958
6941
|
*
|
|
6959
6942
|
* **When to use**
|
|
@@ -7036,26 +7019,6 @@ const reduce = /*#__PURE__*/ dual(3, (self, b, f) => fromIterable$2(self).reduce
|
|
|
7036
7019
|
*/
|
|
7037
7020
|
const every = /*#__PURE__*/ dual(2, (self, refinement) => self.every(refinement));
|
|
7038
7021
|
/**
|
|
7039
|
-
* Checks whether at least one element satisfies the predicate. Narrows the type
|
|
7040
|
-
* to `NonEmptyReadonlyArray` on success.
|
|
7041
|
-
*
|
|
7042
|
-
* **Example** (Testing for any match)
|
|
7043
|
-
*
|
|
7044
|
-
* ```ts
|
|
7045
|
-
* import { Array } from "effect"
|
|
7046
|
-
*
|
|
7047
|
-
* console.log(Array.some([1, 3, 4], (x) => x % 2 === 0)) // true
|
|
7048
|
-
* console.log(Array.some([1, 3, 5], (x) => x % 2 === 0)) // false
|
|
7049
|
-
* ```
|
|
7050
|
-
*
|
|
7051
|
-
* @see {@link every} — test if all elements match
|
|
7052
|
-
* @see {@link contains} — test for a specific value
|
|
7053
|
-
*
|
|
7054
|
-
* @category elements
|
|
7055
|
-
* @since 2.0.0
|
|
7056
|
-
*/
|
|
7057
|
-
const some = /*#__PURE__*/ dual(2, (self, predicate) => self.some(predicate));
|
|
7058
|
-
/**
|
|
7059
7022
|
* Creates an `Equivalence` for arrays based on an element `Equivalence`. Two
|
|
7060
7023
|
* arrays are equivalent when they have the same length and all elements are
|
|
7061
7024
|
* pairwise equivalent.
|
|
@@ -7701,8 +7664,8 @@ const serviceNotFoundError = (service) => {
|
|
|
7701
7664
|
* @since 2.0.0
|
|
7702
7665
|
*/
|
|
7703
7666
|
const getOption = /*#__PURE__*/ dual(2, (self, service) => {
|
|
7704
|
-
if (self.mapUnsafe.has(service.key)) return some
|
|
7705
|
-
return isReference(service) ? some
|
|
7667
|
+
if (self.mapUnsafe.has(service.key)) return some(self.mapUnsafe.get(service.key));
|
|
7668
|
+
return isReference(service) ? some(getDefaultValue(service)) : none();
|
|
7706
7669
|
});
|
|
7707
7670
|
/**
|
|
7708
7671
|
* Merges two `Context`s into one.
|
|
@@ -8252,7 +8215,7 @@ const weeks = (weeks) => make$61(weeks * 6048e5);
|
|
|
8252
8215
|
* @category getters
|
|
8253
8216
|
* @since 2.0.0
|
|
8254
8217
|
*/
|
|
8255
|
-
const toMillis = (self) => match$
|
|
8218
|
+
const toMillis = (self) => match$1(fromInputUnsafe(self), {
|
|
8256
8219
|
onMillis: identity,
|
|
8257
8220
|
onNanos: (nanos) => Number(nanos) / 1e6,
|
|
8258
8221
|
onInfinity: () => Infinity,
|
|
@@ -8273,7 +8236,7 @@ const toMillis = (self) => match$2(fromInputUnsafe(self), {
|
|
|
8273
8236
|
* @category getters
|
|
8274
8237
|
* @since 2.0.0
|
|
8275
8238
|
*/
|
|
8276
|
-
const toSeconds = (self) => match$
|
|
8239
|
+
const toSeconds = (self) => match$1(fromInputUnsafe(self), {
|
|
8277
8240
|
onMillis: (millis) => millis / 1e3,
|
|
8278
8241
|
onNanos: (nanos) => Number(nanos) / 1e9,
|
|
8279
8242
|
onInfinity: () => Infinity,
|
|
@@ -8336,7 +8299,7 @@ const toNanosUnsafe = (input) => {
|
|
|
8336
8299
|
* @category pattern matching
|
|
8337
8300
|
* @since 2.0.0
|
|
8338
8301
|
*/
|
|
8339
|
-
const match$
|
|
8302
|
+
const match$1 = /*#__PURE__*/ dual(2, (self, options) => {
|
|
8340
8303
|
switch (self.value._tag) {
|
|
8341
8304
|
case "Millis": return options.onMillis(self.value.millis);
|
|
8342
8305
|
case "Nanos": return options.onNanos(self.value.nanos);
|
|
@@ -9538,7 +9501,7 @@ const suspend$3 = /*#__PURE__*/ makePrimitive({
|
|
|
9538
9501
|
}
|
|
9539
9502
|
});
|
|
9540
9503
|
/** @internal */
|
|
9541
|
-
const fromResult$1 = /*#__PURE__*/ match$
|
|
9504
|
+
const fromResult$1 = /*#__PURE__*/ match$3({
|
|
9542
9505
|
onFailure: fail$6,
|
|
9543
9506
|
onSuccess: succeed$6
|
|
9544
9507
|
});
|
|
@@ -9557,7 +9520,7 @@ const yieldNow$1 = /*#__PURE__*/ (/* @__PURE__ */ makePrimitive({
|
|
|
9557
9520
|
}
|
|
9558
9521
|
}))(0);
|
|
9559
9522
|
/** @internal */
|
|
9560
|
-
const succeedSome$1 = (a) => succeed$6(some
|
|
9523
|
+
const succeedSome$1 = (a) => succeed$6(some(a));
|
|
9561
9524
|
/** @internal */
|
|
9562
9525
|
const succeedNone$1 = /*#__PURE__*/ succeed$6(/*#__PURE__*/ none());
|
|
9563
9526
|
/** @internal */
|
|
@@ -9653,6 +9616,43 @@ const defineFunctionLength = (length, fn) => Object.defineProperty(fn, "length",
|
|
|
9653
9616
|
value: length,
|
|
9654
9617
|
configurable: true
|
|
9655
9618
|
});
|
|
9619
|
+
const fnStackCleaner = /*#__PURE__*/ makeStackCleaner(2);
|
|
9620
|
+
/** @internal */
|
|
9621
|
+
const fn$1 = function() {
|
|
9622
|
+
const nameFirst = typeof arguments[0] === "string";
|
|
9623
|
+
const name = nameFirst ? arguments[0] : "Effect.fn";
|
|
9624
|
+
const spanOptions = nameFirst ? arguments[1] : void 0;
|
|
9625
|
+
const prevLimit = globalThis.Error.stackTraceLimit;
|
|
9626
|
+
globalThis.Error.stackTraceLimit = 2;
|
|
9627
|
+
const defError = new globalThis.Error();
|
|
9628
|
+
globalThis.Error.stackTraceLimit = prevLimit;
|
|
9629
|
+
if (nameFirst) return (body, ...pipeables) => makeFn(name, body, defError, pipeables, nameFirst, spanOptions);
|
|
9630
|
+
return makeFn(name, arguments[0], defError, Array.prototype.slice.call(arguments, 1), nameFirst, spanOptions);
|
|
9631
|
+
};
|
|
9632
|
+
const makeFn = (name, bodyOrOptions, defError, pipeables, addSpan, spanOptions) => {
|
|
9633
|
+
const body = typeof bodyOrOptions === "function" ? bodyOrOptions : pipeables.pop().bind(bodyOrOptions.self);
|
|
9634
|
+
return defineFunctionLength(body.length, function(...args) {
|
|
9635
|
+
let result = suspend$3(() => {
|
|
9636
|
+
const iter = body.apply(this, arguments);
|
|
9637
|
+
return isEffect$1(iter) ? iter : fromIteratorUnsafe(iter);
|
|
9638
|
+
});
|
|
9639
|
+
for (let i = 0; i < pipeables.length; i++) result = pipeables[i](result, ...args);
|
|
9640
|
+
if (!isEffect$1(result)) return result;
|
|
9641
|
+
const prevLimit = globalThis.Error.stackTraceLimit;
|
|
9642
|
+
globalThis.Error.stackTraceLimit = 2;
|
|
9643
|
+
const callError = new globalThis.Error();
|
|
9644
|
+
globalThis.Error.stackTraceLimit = prevLimit;
|
|
9645
|
+
return updateService$1(addSpan ? useSpan$1(name, spanOptions, (span) => provideParentSpan(result, span)) : result, CurrentStackFrame, (prev) => ({
|
|
9646
|
+
name,
|
|
9647
|
+
stack: fnStackCleaner(() => callError.stack),
|
|
9648
|
+
parent: {
|
|
9649
|
+
name: `${name} (definition)`,
|
|
9650
|
+
stack: fnStackCleaner(() => defError.stack),
|
|
9651
|
+
parent: prev
|
|
9652
|
+
}
|
|
9653
|
+
}));
|
|
9654
|
+
});
|
|
9655
|
+
};
|
|
9656
9656
|
/** @internal */
|
|
9657
9657
|
const fnUntracedEager$1 = (body, ...pipeables) => defineFunctionLength(body.length, pipeables.length === 0 ? function() {
|
|
9658
9658
|
return fromIteratorEagerUnsafe(() => body.apply(this, arguments));
|
|
@@ -9712,7 +9712,7 @@ const as$1 = /*#__PURE__*/ dual(2, (self, value) => {
|
|
|
9712
9712
|
return flatMap$4(self, (_) => b);
|
|
9713
9713
|
});
|
|
9714
9714
|
/** @internal */
|
|
9715
|
-
const asSome
|
|
9715
|
+
const asSome = (self) => map$6(self, some);
|
|
9716
9716
|
/** @internal */
|
|
9717
9717
|
const andThen$1 = /*#__PURE__*/ dual(2, (self, f) => flatMap$4(self, (a) => isEffect$1(f) ? f : internalCall(() => f(a))));
|
|
9718
9718
|
/** @internal */
|
|
@@ -9829,7 +9829,7 @@ const exitAsVoidAll = (exits) => {
|
|
|
9829
9829
|
return failures.length === 0 ? exitVoid : exitFailCause(causeFromReasons(failures));
|
|
9830
9830
|
};
|
|
9831
9831
|
/** @internal */
|
|
9832
|
-
const exitGetSuccess = (self) => exitIsSuccess(self) ? some
|
|
9832
|
+
const exitGetSuccess = (self) => exitIsSuccess(self) ? some(self.value) : none();
|
|
9833
9833
|
/** @internal */
|
|
9834
9834
|
const service$1 = (service) => service;
|
|
9835
9835
|
/** @internal */
|
|
@@ -9871,7 +9871,7 @@ const provideServiceImpl = (self, service, implementation) => updateContext$1(se
|
|
|
9871
9871
|
return add(s, service, implementation);
|
|
9872
9872
|
});
|
|
9873
9873
|
/** @internal */
|
|
9874
|
-
const when$3 = /*#__PURE__*/ dual(2, (self, condition) => flatMap$4(condition, (pass) => pass ? asSome
|
|
9874
|
+
const when$3 = /*#__PURE__*/ dual(2, (self, condition) => flatMap$4(condition, (pass) => pass ? asSome(self) : succeedNone$1));
|
|
9875
9875
|
/** @internal */
|
|
9876
9876
|
const forever$1 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, options) => whileLoop$1({
|
|
9877
9877
|
while: constTrue,
|
|
@@ -9954,9 +9954,9 @@ const ignore$2 = /*#__PURE__*/ dual((args) => isEffect$1(args[0]), (self, option
|
|
|
9954
9954
|
});
|
|
9955
9955
|
});
|
|
9956
9956
|
/** @internal */
|
|
9957
|
-
const option$2 = (self) => match
|
|
9957
|
+
const option$2 = (self) => match(self, {
|
|
9958
9958
|
onFailure: none,
|
|
9959
|
-
onSuccess: some
|
|
9959
|
+
onSuccess: some
|
|
9960
9960
|
});
|
|
9961
9961
|
/** @internal */
|
|
9962
9962
|
const result$1 = (self) => matchEager(self, {
|
|
@@ -9987,7 +9987,7 @@ const matchEffect$2 = /*#__PURE__*/ dual(2, (self, options) => matchCauseEffect$
|
|
|
9987
9987
|
onSuccess: options.onSuccess
|
|
9988
9988
|
}));
|
|
9989
9989
|
/** @internal */
|
|
9990
|
-
const match
|
|
9990
|
+
const match = /*#__PURE__*/ dual(2, (self, options) => matchEffect$2(self, {
|
|
9991
9991
|
onFailure: (error) => sync$1(() => options.onFailure(error)),
|
|
9992
9992
|
onSuccess: (value) => sync$1(() => options.onSuccess(value))
|
|
9993
9993
|
}));
|
|
@@ -9999,7 +9999,7 @@ const matchEager = /*#__PURE__*/ dual(2, (self, options) => {
|
|
|
9999
9999
|
if (isFailure$1(error)) return self;
|
|
10000
10000
|
return exitSucceed(options.onFailure(error.success));
|
|
10001
10001
|
}
|
|
10002
|
-
return match
|
|
10002
|
+
return match(self, options);
|
|
10003
10003
|
});
|
|
10004
10004
|
/** @internal */
|
|
10005
10005
|
const exit$1 = (self) => effectIsExit(self) ? exitSucceed(self) : exitPrimitive(self);
|
|
@@ -10019,7 +10019,7 @@ const exitPrimitive = /*#__PURE__*/ makePrimitive({
|
|
|
10019
10019
|
/** @internal */
|
|
10020
10020
|
const timeoutOrElse$1 = /*#__PURE__*/ dual(2, (self, options) => raceFirst$1(self, flatMap$4(sleep$1(options.duration), options.orElse)));
|
|
10021
10021
|
/** @internal */
|
|
10022
|
-
const timeoutOption$1 = /*#__PURE__*/ dual(2, (self, duration) => raceFirst$1(asSome
|
|
10022
|
+
const timeoutOption$1 = /*#__PURE__*/ dual(2, (self, duration) => raceFirst$1(asSome(self), as$1(sleep$1(duration), none())));
|
|
10023
10023
|
/** @internal */
|
|
10024
10024
|
const ScopeTypeId = "~effect/Scope";
|
|
10025
10025
|
/** @internal */
|
|
@@ -10263,7 +10263,7 @@ const findFirst$1 = /*#__PURE__*/ dual((args) => isIterable(args[0]) && !isEffec
|
|
|
10263
10263
|
return succeed$6(none());
|
|
10264
10264
|
}));
|
|
10265
10265
|
const findFirstLoop = (iterator, index, predicate, value) => flatMap$4(predicate(value, index), (keep) => {
|
|
10266
|
-
if (keep) return succeed$6(some
|
|
10266
|
+
if (keep) return succeed$6(some(value));
|
|
10267
10267
|
const next = iterator.next();
|
|
10268
10268
|
if (!next.done) return findFirstLoop(iterator, index + 1, predicate, next.value);
|
|
10269
10269
|
return succeed$6(none());
|
|
@@ -10597,12 +10597,12 @@ const NoopSpanProto = {
|
|
|
10597
10597
|
const noopSpan = (options) => Object.assign(Object.create(NoopSpanProto), options);
|
|
10598
10598
|
const filterDisablePropagation = (span) => {
|
|
10599
10599
|
if (!span) return none();
|
|
10600
|
-
return get$9(span.annotations, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(getOrUndefined$1(span.parent)) : none() : some
|
|
10600
|
+
return get$9(span.annotations, DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(getOrUndefined$1(span.parent)) : none() : some(span);
|
|
10601
10601
|
};
|
|
10602
10602
|
/** @internal */
|
|
10603
10603
|
const makeSpanUnsafe = (fiber, name, options) => {
|
|
10604
10604
|
const disablePropagation = !fiber.getRef(TracerEnabled$1) || options?.annotations && get$9(options.annotations, DisablePropagation);
|
|
10605
|
-
const parent = options?.parent !== void 0 ? some
|
|
10605
|
+
const parent = options?.parent !== void 0 ? some(options.parent) : options?.root ? none() : filterDisablePropagation(fiber.currentSpan);
|
|
10606
10606
|
let span;
|
|
10607
10607
|
if (disablePropagation) span = noopSpan({
|
|
10608
10608
|
name,
|
|
@@ -10681,6 +10681,13 @@ const withSpan$1 = function() {
|
|
|
10681
10681
|
return (self, ...args) => useSpan$1(name, fnArg ? fnArg(...args) : options, (span) => withParentSpan$1(self, span, traceOptions));
|
|
10682
10682
|
};
|
|
10683
10683
|
/** @internal */
|
|
10684
|
+
const annotateCurrentSpan$1 = (...args) => withFiber$1((fiber) => {
|
|
10685
|
+
const span = fiber.currentSpanLocal;
|
|
10686
|
+
if (span) if (args.length === 1) for (const [key, value] of Object.entries(args[0])) span.attribute(key, value);
|
|
10687
|
+
else span.attribute(args[0], args[1]);
|
|
10688
|
+
return void_$3;
|
|
10689
|
+
});
|
|
10690
|
+
/** @internal */
|
|
10684
10691
|
const ClockRef = /*#__PURE__*/ Reference("effect/Clock", { defaultValue: () => new ClockImpl() });
|
|
10685
10692
|
const MAX_TIMER_MILLIS = 2 ** 31 - 1;
|
|
10686
10693
|
var ClockImpl = class {
|
|
@@ -13870,12 +13877,12 @@ const nextPow2 = (n) => {
|
|
|
13870
13877
|
* @since 2.0.0
|
|
13871
13878
|
*/
|
|
13872
13879
|
const parse$2 = (s) => {
|
|
13873
|
-
if (s === "NaN") return some
|
|
13874
|
-
if (s === "Infinity") return some
|
|
13875
|
-
if (s === "-Infinity") return some
|
|
13880
|
+
if (s === "NaN") return some(NaN);
|
|
13881
|
+
if (s === "Infinity") return some(Infinity);
|
|
13882
|
+
if (s === "-Infinity") return some(-Infinity);
|
|
13876
13883
|
if (s.trim() === "") return none();
|
|
13877
13884
|
const n = Number$4(s);
|
|
13878
|
-
return Number$4.isNaN(n) ? none() : some
|
|
13885
|
+
return Number$4.isNaN(n) ? none() : some(n);
|
|
13879
13886
|
};
|
|
13880
13887
|
globalThis.String;
|
|
13881
13888
|
/**
|
|
@@ -13976,6 +13983,24 @@ const split$1 = /*#__PURE__*/ dual(2, (self, separator) => {
|
|
|
13976
13983
|
return isArrayNonEmpty$1(out) ? out : [self];
|
|
13977
13984
|
});
|
|
13978
13985
|
/**
|
|
13986
|
+
* Returns `true` if `searchString` appears as a substring of `self`, at one or more positions that are
|
|
13987
|
+
* greater than or equal to `position`; otherwise, returns `false`.
|
|
13988
|
+
*
|
|
13989
|
+
* **Example** (Checking for substrings)
|
|
13990
|
+
*
|
|
13991
|
+
* ```ts
|
|
13992
|
+
* import { pipe, String } from "effect"
|
|
13993
|
+
* import * as assert from "node:assert"
|
|
13994
|
+
*
|
|
13995
|
+
* assert.deepStrictEqual(pipe("hello world", String.includes("world")), true)
|
|
13996
|
+
* assert.deepStrictEqual(pipe("hello world", String.includes("foo")), false)
|
|
13997
|
+
* ```
|
|
13998
|
+
*
|
|
13999
|
+
* @category predicates
|
|
14000
|
+
* @since 2.0.0
|
|
14001
|
+
*/
|
|
14002
|
+
const includes = (searchString, position) => (self) => self.includes(searchString, position);
|
|
14003
|
+
/**
|
|
13979
14004
|
* Returns `true` if the string starts with the specified search string.
|
|
13980
14005
|
*
|
|
13981
14006
|
* **Example** (Checking string prefixes)
|
|
@@ -15799,24 +15824,6 @@ const map$4 = map$6;
|
|
|
15799
15824
|
*/
|
|
15800
15825
|
const as = as$1;
|
|
15801
15826
|
/**
|
|
15802
|
-
* Maps the success value of an `Effect` to `Some`, preserving failures.
|
|
15803
|
-
*
|
|
15804
|
-
* **Example** (Wrapping success in Option.some)
|
|
15805
|
-
*
|
|
15806
|
-
* ```ts
|
|
15807
|
-
* import { Effect } from "effect"
|
|
15808
|
-
*
|
|
15809
|
-
* const program = Effect.asSome(Effect.succeed(42))
|
|
15810
|
-
*
|
|
15811
|
-
* Effect.runPromise(program).then(console.log)
|
|
15812
|
-
* // { _id: 'Option', _tag: 'Some', value: 42 }
|
|
15813
|
-
* ```
|
|
15814
|
-
*
|
|
15815
|
-
* @category mapping
|
|
15816
|
-
* @since 2.0.0
|
|
15817
|
-
*/
|
|
15818
|
-
const asSome = asSome$1;
|
|
15819
|
-
/**
|
|
15820
15827
|
* Maps the success value of an `Effect` to `void`, preserving failures.
|
|
15821
15828
|
*
|
|
15822
15829
|
* **Example** (Discarding success values)
|
|
@@ -17561,6 +17568,31 @@ const interruptibleMask = interruptibleMask$1;
|
|
|
17561
17568
|
*/
|
|
17562
17569
|
const forever = forever$1;
|
|
17563
17570
|
/**
|
|
17571
|
+
* Adds an annotation to the current span if available.
|
|
17572
|
+
*
|
|
17573
|
+
* **Example** (Annotating the current span)
|
|
17574
|
+
*
|
|
17575
|
+
* ```ts
|
|
17576
|
+
* import { Effect } from "effect"
|
|
17577
|
+
*
|
|
17578
|
+
* const program = Effect.gen(function*() {
|
|
17579
|
+
* yield* Effect.annotateCurrentSpan("userId", "123")
|
|
17580
|
+
* yield* Effect.annotateCurrentSpan({
|
|
17581
|
+
* operation: "user-lookup",
|
|
17582
|
+
* timestamp: Date.now()
|
|
17583
|
+
* })
|
|
17584
|
+
* yield* Effect.log("User lookup completed")
|
|
17585
|
+
* return "success"
|
|
17586
|
+
* })
|
|
17587
|
+
*
|
|
17588
|
+
* const traced = Effect.withSpan(program, "user-operation")
|
|
17589
|
+
* ```
|
|
17590
|
+
*
|
|
17591
|
+
* @category tracing
|
|
17592
|
+
* @since 2.0.0
|
|
17593
|
+
*/
|
|
17594
|
+
const annotateCurrentSpan = annotateCurrentSpan$1;
|
|
17595
|
+
/**
|
|
17564
17596
|
* Create a new span for tracing, and automatically close it when the effect
|
|
17565
17597
|
* completes.
|
|
17566
17598
|
*
|
|
@@ -18040,6 +18072,37 @@ const runSyncExit = runSyncExit$1;
|
|
|
18040
18072
|
*/
|
|
18041
18073
|
const fnUntraced = fnUntraced$1;
|
|
18042
18074
|
/**
|
|
18075
|
+
* Creates a traced function with an optional span name and `SpanOptionsNoTrace` that adds spans and stack frames, plus pipeable post-processing that receives the Effect and the original arguments.
|
|
18076
|
+
*
|
|
18077
|
+
* **Details**
|
|
18078
|
+
*
|
|
18079
|
+
* Pipeable functions run after the body and can transform the resulting Effect.
|
|
18080
|
+
*
|
|
18081
|
+
* **Example** (Defining traced effect functions)
|
|
18082
|
+
*
|
|
18083
|
+
* ```ts
|
|
18084
|
+
* import { Console, Effect } from "effect"
|
|
18085
|
+
*
|
|
18086
|
+
* // Create a named span and post-process the returned Effect.
|
|
18087
|
+
* const greet = Effect.fn("greet")(
|
|
18088
|
+
* function*(name: string) {
|
|
18089
|
+
* yield* Console.log(`Hello, ${name}`)
|
|
18090
|
+
* return name.length
|
|
18091
|
+
* },
|
|
18092
|
+
* Effect.map((length) => length + 1)
|
|
18093
|
+
* )
|
|
18094
|
+
*
|
|
18095
|
+
* const program = Effect.gen(function*() {
|
|
18096
|
+
* const result = yield* greet("Ada")
|
|
18097
|
+
* yield* Console.log(`Length: ${result}`)
|
|
18098
|
+
* })
|
|
18099
|
+
* ```
|
|
18100
|
+
*
|
|
18101
|
+
* @category functions
|
|
18102
|
+
* @since 3.11.0
|
|
18103
|
+
*/
|
|
18104
|
+
const fn = fn$1;
|
|
18105
|
+
/**
|
|
18043
18106
|
* Retrieves the `Clock` service from the context and provides it to the
|
|
18044
18107
|
* specified effectful function.
|
|
18045
18108
|
*
|
|
@@ -19192,14 +19255,14 @@ var OneOf = class extends Base$1 {
|
|
|
19192
19255
|
};
|
|
19193
19256
|
function makeFilterIssue(input, entry) {
|
|
19194
19257
|
if (isIssue(entry)) return entry;
|
|
19195
|
-
if (typeof entry === "string") return new InvalidValue(some
|
|
19196
|
-
const inner = typeof entry.issue === "string" ? new InvalidValue(some
|
|
19258
|
+
if (typeof entry === "string") return new InvalidValue(some(input), { message: entry });
|
|
19259
|
+
const inner = typeof entry.issue === "string" ? new InvalidValue(some(input), { message: entry.issue }) : entry.issue;
|
|
19197
19260
|
return new Pointer(entry.path, inner);
|
|
19198
19261
|
}
|
|
19199
19262
|
/** @internal */
|
|
19200
19263
|
function makeSingle(input, out) {
|
|
19201
19264
|
if (out === void 0) return;
|
|
19202
|
-
if (typeof out === "boolean") return out ? void 0 : new InvalidValue(some
|
|
19265
|
+
if (typeof out === "boolean") return out ? void 0 : new InvalidValue(some(input));
|
|
19203
19266
|
return makeFilterIssue(input, out);
|
|
19204
19267
|
}
|
|
19205
19268
|
/** @internal */
|
|
@@ -19207,7 +19270,7 @@ function make$55(input, ast, out) {
|
|
|
19207
19270
|
if (Array.isArray(out)) {
|
|
19208
19271
|
if (isReadonlyArrayNonEmpty(out)) {
|
|
19209
19272
|
if (out.length === 1) return makeFilterIssue(input, out[0]);
|
|
19210
|
-
return new Composite(ast, some
|
|
19273
|
+
return new Composite(ast, some(input), map$7(out, (entry) => makeFilterIssue(input, entry)));
|
|
19211
19274
|
}
|
|
19212
19275
|
return;
|
|
19213
19276
|
}
|
|
@@ -19684,7 +19747,7 @@ function transformOptional(f) {
|
|
|
19684
19747
|
function withDefault$1(defaultValue) {
|
|
19685
19748
|
return new Getter((o) => {
|
|
19686
19749
|
const filtered = filter$2(o, isNotUndefined);
|
|
19687
|
-
return isSome(filtered) ? succeed$3(filtered) : mapEager(defaultValue, some
|
|
19750
|
+
return isSome(filtered) ? succeed$3(filtered) : mapEager(defaultValue, some);
|
|
19688
19751
|
});
|
|
19689
19752
|
}
|
|
19690
19753
|
/**
|
|
@@ -19747,8 +19810,8 @@ function Number$3() {
|
|
|
19747
19810
|
}
|
|
19748
19811
|
function parseJson(options) {
|
|
19749
19812
|
return onSome((input) => try_({
|
|
19750
|
-
try: () => some
|
|
19751
|
-
catch: (e) => new InvalidValue(some
|
|
19813
|
+
try: () => some(JSON.parse(input, options?.reviver)),
|
|
19814
|
+
catch: (e) => new InvalidValue(some(input), { message: globalThis.String(e) })
|
|
19752
19815
|
}));
|
|
19753
19816
|
}
|
|
19754
19817
|
/**
|
|
@@ -19785,8 +19848,8 @@ function parseJson(options) {
|
|
|
19785
19848
|
*/
|
|
19786
19849
|
function stringifyJson(options) {
|
|
19787
19850
|
return onSome((input) => try_({
|
|
19788
|
-
try: () => some
|
|
19789
|
-
catch: (e) => new InvalidValue(some
|
|
19851
|
+
try: () => some(JSON.stringify(input, options?.replacer, options?.space)),
|
|
19852
|
+
catch: (e) => new InvalidValue(some(input), { message: globalThis.String(e) })
|
|
19790
19853
|
}));
|
|
19791
19854
|
}
|
|
19792
19855
|
/**
|
|
@@ -20805,7 +20868,7 @@ var Declaration = class Declaration extends Base {
|
|
|
20805
20868
|
const run = this.run(this.typeParameters);
|
|
20806
20869
|
return (oinput, options) => {
|
|
20807
20870
|
if (isNone(oinput)) return succeedNone;
|
|
20808
|
-
return mapEager(run(oinput.value, this, options), some
|
|
20871
|
+
return mapEager(run(oinput.value, this, options), some);
|
|
20809
20872
|
};
|
|
20810
20873
|
}
|
|
20811
20874
|
/** @internal */
|
|
@@ -21296,7 +21359,7 @@ var Arrays = class Arrays extends Base {
|
|
|
21296
21359
|
else return yield* fail$3(new Composite(ast, oinput, [issue]));
|
|
21297
21360
|
}
|
|
21298
21361
|
if (state.issues) return yield* fail$3(new Composite(ast, oinput, state.issues));
|
|
21299
|
-
return some
|
|
21362
|
+
return some(state.output);
|
|
21300
21363
|
});
|
|
21301
21364
|
}
|
|
21302
21365
|
/** @internal */
|
|
@@ -21312,7 +21375,7 @@ var Arrays = class Arrays extends Base {
|
|
|
21312
21375
|
};
|
|
21313
21376
|
const parseArray = /*#__PURE__*/ iterateEager()({
|
|
21314
21377
|
onItem(s, item, i) {
|
|
21315
|
-
const value = i < s.len ? some
|
|
21378
|
+
const value = i < s.len ? some(item) : none();
|
|
21316
21379
|
return s.getParser(s.tailThreshold, i).parser(value, s.options);
|
|
21317
21380
|
},
|
|
21318
21381
|
step(s, _, exit, i) {
|
|
@@ -21516,14 +21579,14 @@ var Objects = class Objects extends Base {
|
|
|
21516
21579
|
if (ast.propertySignatures.length === 0 && ast.indexSignatures.length === 0) return fromRefinement(ast, isNotNullish);
|
|
21517
21580
|
const parseIndexes = indexCount > 0 ? iterateEager()({
|
|
21518
21581
|
onItem: fnUntracedEager(function* (s, [key, is]) {
|
|
21519
|
-
const effKey = recur(indexSignatureParameterFromString(is.parameter))(some
|
|
21582
|
+
const effKey = recur(indexSignatureParameterFromString(is.parameter))(some(key), s.options);
|
|
21520
21583
|
const exitKey = effectIsExit(effKey) ? effKey : yield* exit(effKey);
|
|
21521
21584
|
if (exitKey._tag === "Failure") {
|
|
21522
21585
|
const eff = wrapPropertyKeyIssue(s, ast, key, exitKey);
|
|
21523
21586
|
if (eff) yield* eff;
|
|
21524
21587
|
return;
|
|
21525
21588
|
}
|
|
21526
|
-
const value = some
|
|
21589
|
+
const value = some(s.input[key]);
|
|
21527
21590
|
const effValue = recur(is.type)(value, s.options);
|
|
21528
21591
|
const exitValue = effectIsExit(effValue) ? effValue : yield* exit(effValue);
|
|
21529
21592
|
if (exitValue._tag === "Failure") {
|
|
@@ -21593,9 +21656,9 @@ var Objects = class Objects extends Base {
|
|
|
21593
21656
|
const keys = (inputKeys ?? Reflect.ownKeys(input)).concat(expectedKeys);
|
|
21594
21657
|
const preserved = {};
|
|
21595
21658
|
for (const key of keys) if (Object.hasOwn(out, key)) set$7(preserved, key, out[key]);
|
|
21596
|
-
return some
|
|
21659
|
+
return some(preserved);
|
|
21597
21660
|
}
|
|
21598
|
-
return some
|
|
21661
|
+
return some(out);
|
|
21599
21662
|
});
|
|
21600
21663
|
}
|
|
21601
21664
|
rebuild(recur, flipMerge) {
|
|
@@ -21627,7 +21690,7 @@ var Objects = class Objects extends Base {
|
|
|
21627
21690
|
};
|
|
21628
21691
|
const parseProperties = /*#__PURE__*/ iterateEager()({
|
|
21629
21692
|
onItem(s, p) {
|
|
21630
|
-
const value = Object.hasOwn(s.input, p.name) ? some
|
|
21693
|
+
const value = Object.hasOwn(s.input, p.name) ? some(s.input[p.name]) : none();
|
|
21631
21694
|
return p.parser(value, s.options);
|
|
21632
21695
|
},
|
|
21633
21696
|
step(s, p, exit) {
|
|
@@ -22427,7 +22490,7 @@ function isJson(u) {
|
|
|
22427
22490
|
}
|
|
22428
22491
|
}
|
|
22429
22492
|
/** @internal */
|
|
22430
|
-
const Json = /*#__PURE__*/ new Declaration([], () => (input, ast) => isJson(input) ? succeed$3(input) : fail$3(new InvalidType(ast, some
|
|
22493
|
+
const Json = /*#__PURE__*/ new Declaration([], () => (input, ast) => isJson(input) ? succeed$3(input) : fail$3(new InvalidType(ast, some(input))), {
|
|
22431
22494
|
typeConstructor: { _tag: "effect/Json" },
|
|
22432
22495
|
generation: {
|
|
22433
22496
|
runtime: `Schema.Json`,
|
|
@@ -22460,7 +22523,7 @@ function isStringTree(u) {
|
|
|
22460
22523
|
}
|
|
22461
22524
|
}
|
|
22462
22525
|
/** @internal */
|
|
22463
|
-
const unknownToStringTree = /*#__PURE__*/ new Link(/* @__PURE__ */ new Declaration([], () => (input, ast) => isStringTree(input) ? succeed$3(input) : fail$3(new InvalidType(ast, some
|
|
22526
|
+
const unknownToStringTree = /*#__PURE__*/ new Link(/* @__PURE__ */ new Declaration([], () => (input, ast) => isStringTree(input) ? succeed$3(input) : fail$3(new InvalidType(ast, some(input))), {
|
|
22464
22527
|
expected: "StringTree",
|
|
22465
22528
|
toCodecStringTree: () => new Link(unknown, passthrough())
|
|
22466
22529
|
}), /*#__PURE__*/ passthrough());
|
|
@@ -22481,7 +22544,7 @@ const unknownToStringTree = /*#__PURE__*/ new Link(/* @__PURE__ */ new Declarati
|
|
|
22481
22544
|
*/
|
|
22482
22545
|
function nominal() {
|
|
22483
22546
|
return Object.assign((input) => input, {
|
|
22484
|
-
option: (input) => some
|
|
22547
|
+
option: (input) => some(input),
|
|
22485
22548
|
result: (input) => succeed$7(input),
|
|
22486
22549
|
is: (_) => true
|
|
22487
22550
|
});
|
|
@@ -25946,7 +26009,7 @@ var SemaphoreImpl = class {
|
|
|
25946
26009
|
return (self) => uninterruptibleMask$1((restore) => {
|
|
25947
26010
|
if (this.free < n) return succeedNone$1;
|
|
25948
26011
|
this.taken += n;
|
|
25949
|
-
return onExitPrimitive$1(restore(asSome
|
|
26012
|
+
return onExitPrimitive$1(restore(asSome(self)), () => {
|
|
25950
26013
|
this.updateTakenUnsafe(getCurrentFiber(), (taken) => taken - n);
|
|
25951
26014
|
}, true);
|
|
25952
26015
|
});
|
|
@@ -26328,7 +26391,7 @@ const fromIteratorArray = (iterator, chunkSize = DefaultChunkSize) => fromPull$1
|
|
|
26328
26391
|
const state = iter.next();
|
|
26329
26392
|
if (state.done) {
|
|
26330
26393
|
if (buffer.length === 0) return done(state.value);
|
|
26331
|
-
done$15 = some
|
|
26394
|
+
done$15 = some(state.value);
|
|
26332
26395
|
break;
|
|
26333
26396
|
}
|
|
26334
26397
|
buffer.push(state.value);
|
|
@@ -26368,7 +26431,7 @@ const fromIterableArray = (iterable, chunkSize = DefaultChunkSize) => fromIterat
|
|
|
26368
26431
|
* @category constructors
|
|
26369
26432
|
* @since 2.0.0
|
|
26370
26433
|
*/
|
|
26371
|
-
const succeed$2 = (value) => fromEffect(succeed$3(value));
|
|
26434
|
+
const succeed$2 = (value) => fromEffect$1(succeed$3(value));
|
|
26372
26435
|
/**
|
|
26373
26436
|
* Represents a `Channel` that emits no elements.
|
|
26374
26437
|
*
|
|
@@ -26511,7 +26574,7 @@ const die = (defect) => failCause(die$2(defect));
|
|
|
26511
26574
|
* @category constructors
|
|
26512
26575
|
* @since 2.0.0
|
|
26513
26576
|
*/
|
|
26514
|
-
const fromEffect = (effect) => fromPull$1(sync(() => {
|
|
26577
|
+
const fromEffect$1 = (effect) => fromPull$1(sync(() => {
|
|
26515
26578
|
let done$14 = false;
|
|
26516
26579
|
return suspend$2(() => {
|
|
26517
26580
|
if (done$14) return done();
|
|
@@ -27349,7 +27412,7 @@ const splitLines$1 = () => fromTransform$1((upstream, _scope) => sync(() => {
|
|
|
27349
27412
|
onSuccess: loop,
|
|
27350
27413
|
onFailure: failCause$2,
|
|
27351
27414
|
onDone: (leftover) => {
|
|
27352
|
-
done$13 = some
|
|
27415
|
+
done$13 = some(leftover);
|
|
27353
27416
|
if (stringBuilder.length > 0 || midCRLF) {
|
|
27354
27417
|
const last = stringBuilder;
|
|
27355
27418
|
stringBuilder = "";
|
|
@@ -27924,10 +27987,10 @@ const empty$9 = () => {
|
|
|
27924
27987
|
* @since 2.0.0
|
|
27925
27988
|
*/
|
|
27926
27989
|
const get$7 = /*#__PURE__*/ dual(2, (self, key) => {
|
|
27927
|
-
if (self.backing.has(key)) return some
|
|
27990
|
+
if (self.backing.has(key)) return some(self.backing.get(key));
|
|
27928
27991
|
else if (isSimpleKey(key)) return none();
|
|
27929
27992
|
const refKey = referentialKeysCache.get(self);
|
|
27930
|
-
if (refKey !== void 0) return self.backing.has(refKey) ? some
|
|
27993
|
+
if (refKey !== void 0) return self.backing.has(refKey) ? some(self.backing.get(refKey)) : none();
|
|
27931
27994
|
const hash$5 = hash(key);
|
|
27932
27995
|
const bucket = self.buckets.get(hash$5);
|
|
27933
27996
|
if (bucket === void 0) return none();
|
|
@@ -27939,7 +28002,7 @@ const getFromBucket = (self, bucket, key) => {
|
|
|
27939
28002
|
for (let i = 0, len = bucket.length; i < len; i++) if (equals$2(key, bucket[i])) {
|
|
27940
28003
|
const refKey = bucket[i];
|
|
27941
28004
|
referentialKeysCache.set(key, refKey);
|
|
27942
|
-
return some
|
|
28005
|
+
return some(self.backing.get(refKey));
|
|
27943
28006
|
}
|
|
27944
28007
|
return none();
|
|
27945
28008
|
};
|
|
@@ -28752,6 +28815,28 @@ const isStream = (u) => hasProperty(u, TypeId$29);
|
|
|
28752
28815
|
*/
|
|
28753
28816
|
const fromChannel = fromChannel$2;
|
|
28754
28817
|
/**
|
|
28818
|
+
* Creates a stream from an effect.
|
|
28819
|
+
*
|
|
28820
|
+
* **Example** (Creating a stream from an effect)
|
|
28821
|
+
*
|
|
28822
|
+
* ```ts
|
|
28823
|
+
* import { Console, Effect, Stream } from "effect"
|
|
28824
|
+
*
|
|
28825
|
+
* const program = Effect.gen(function*() {
|
|
28826
|
+
* const stream = Stream.fromEffect(Effect.succeed(42))
|
|
28827
|
+
* const values = yield* Stream.runCollect(stream)
|
|
28828
|
+
* yield* Console.log(values)
|
|
28829
|
+
* })
|
|
28830
|
+
*
|
|
28831
|
+
* Effect.runPromise(program)
|
|
28832
|
+
* // Output: [ 42 ]
|
|
28833
|
+
* ```
|
|
28834
|
+
*
|
|
28835
|
+
* @category constructors
|
|
28836
|
+
* @since 2.0.0
|
|
28837
|
+
*/
|
|
28838
|
+
const fromEffect = (effect) => fromChannel(fromEffect$1(map$4(effect, of)));
|
|
28839
|
+
/**
|
|
28755
28840
|
* Creates a stream from an effect producing a value of type `A` which repeats forever.
|
|
28756
28841
|
*
|
|
28757
28842
|
* **Example** (Repeating an effect forever)
|
|
@@ -29684,7 +29769,7 @@ const aggregateWithin = /*#__PURE__*/ dual(3, (self, sink, schedule) => fromChan
|
|
|
29684
29769
|
});
|
|
29685
29770
|
const catchSinkHalt = flatMap$2(([value, leftover_]) => {
|
|
29686
29771
|
if (!sinkHasInput && buffer.state._tag === "Done") return done();
|
|
29687
|
-
lastOutput = some
|
|
29772
|
+
lastOutput = some(value);
|
|
29688
29773
|
leftover = leftover_;
|
|
29689
29774
|
return succeed$3(of(value));
|
|
29690
29775
|
});
|
|
@@ -30238,7 +30323,7 @@ const make$42 = (impl) => FileSystem.of({
|
|
|
30238
30323
|
return fromPull(succeed$3(flatMap$2(suspend$2(() => {
|
|
30239
30324
|
if (bytesToRead !== void 0 && bytesToRead <= totalBytesRead) return done();
|
|
30240
30325
|
return bytesToRead !== void 0 && bytesToRead - totalBytesRead < chunkSize ? file.readAlloc(bytesToRead - totalBytesRead) : readChunk;
|
|
30241
|
-
}), match$
|
|
30326
|
+
}), match$4({
|
|
30242
30327
|
onNone: () => done(),
|
|
30243
30328
|
onSome: (buf) => {
|
|
30244
30329
|
totalBytesRead += BigInt(buf.length);
|
|
@@ -31788,7 +31873,7 @@ var LeafNode = class LeafNode extends Node {
|
|
|
31788
31873
|
return 1;
|
|
31789
31874
|
}
|
|
31790
31875
|
get(_shift, hash, key) {
|
|
31791
|
-
if (this.hash === hash && equals$2(this.key, key)) return some
|
|
31876
|
+
if (this.hash === hash && equals$2(this.key, key)) return some(this.value);
|
|
31792
31877
|
return none();
|
|
31793
31878
|
}
|
|
31794
31879
|
has(_shift, hash, key) {
|
|
@@ -31841,7 +31926,7 @@ var CollisionNode = class CollisionNode extends Node {
|
|
|
31841
31926
|
}
|
|
31842
31927
|
get(_shift, hash, key) {
|
|
31843
31928
|
if (this.hash !== hash) return none();
|
|
31844
|
-
for (const [k, v] of this.entries) if (equals$2(k, key)) return some
|
|
31929
|
+
for (const [k, v] of this.entries) if (equals$2(k, key)) return some(v);
|
|
31845
31930
|
return none();
|
|
31846
31931
|
}
|
|
31847
31932
|
has(_shift, hash, key) {
|
|
@@ -32512,22 +32597,6 @@ const lambda = (f) => f;
|
|
|
32512
32597
|
* @since 4.0.0
|
|
32513
32598
|
*/
|
|
32514
32599
|
const map$1 = /*#__PURE__*/ dual(2, (self, f) => self === void 0 ? void 0 : f(self));
|
|
32515
|
-
/**
|
|
32516
|
-
* Pattern matches on an `A | undefined` value, running `onDefined` when the
|
|
32517
|
-
* value is present or evaluating `onUndefined` when the value is `undefined`.
|
|
32518
|
-
*
|
|
32519
|
-
* **When to use**
|
|
32520
|
-
*
|
|
32521
|
-
* Use when you need to turn an `A | undefined` into a non-optional result by
|
|
32522
|
-
* handling both the defined and undefined branches in one expression.
|
|
32523
|
-
*
|
|
32524
|
-
* @see {@link map} for transforming defined values while preserving `undefined`
|
|
32525
|
-
* @see {@link getOrThrowWith} for throwing when the value is `undefined` instead of returning a fallback branch
|
|
32526
|
-
*
|
|
32527
|
-
* @category pattern matching
|
|
32528
|
-
* @since 4.0.0
|
|
32529
|
-
*/
|
|
32530
|
-
const match = /*#__PURE__*/ dual(2, (self, { onDefined, onUndefined }) => self === void 0 ? onUndefined() : onDefined(self));
|
|
32531
32600
|
//#endregion
|
|
32532
32601
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.74/node_modules/effect/dist/SchemaParser.js
|
|
32533
32602
|
/**
|
|
@@ -32791,7 +32860,7 @@ const mergeParseOptions = (options, overrideOptions) => overrideOptions === void
|
|
|
32791
32860
|
/** @internal */
|
|
32792
32861
|
function run(ast) {
|
|
32793
32862
|
const parser = recur$1(ast);
|
|
32794
|
-
return (input, options) => flatMapEager(parser(some
|
|
32863
|
+
return (input, options) => flatMapEager(parser(some(input), options ?? defaultParseOptions), (oa) => {
|
|
32795
32864
|
if (oa._tag === "None") return fail$3(new InvalidValue(oa));
|
|
32796
32865
|
return succeed$3(oa.value);
|
|
32797
32866
|
});
|
|
@@ -33026,7 +33095,7 @@ function declareConstructor() {
|
|
|
33026
33095
|
* @since 3.10.0
|
|
33027
33096
|
*/
|
|
33028
33097
|
function declare(is, annotations) {
|
|
33029
|
-
return declareConstructor()([], () => (input, ast) => is(input) ? succeed$3(input) : fail$3(new InvalidType(ast, some
|
|
33098
|
+
return declareConstructor()([], () => (input, ast) => is(input) ? succeed$3(input) : fail$3(new InvalidType(ast, some(input))), annotations);
|
|
33030
33099
|
}
|
|
33031
33100
|
/**
|
|
33032
33101
|
* Returns `true` if `u` is a {@link SchemaError}.
|
|
@@ -33076,25 +33145,6 @@ function decodeUnknownEffect(schema, options) {
|
|
|
33076
33145
|
};
|
|
33077
33146
|
}
|
|
33078
33147
|
/**
|
|
33079
|
-
* Decodes a typed input (the schema's `Encoded` type) against a schema,
|
|
33080
|
-
* returning an `Effect` that succeeds with the decoded value or fails with a
|
|
33081
|
-
* {@link SchemaError}.
|
|
33082
|
-
*
|
|
33083
|
-
* **When to use**
|
|
33084
|
-
*
|
|
33085
|
-
* Use when the input is already typed as the schema's `Encoded` type.
|
|
33086
|
-
*
|
|
33087
|
-
* **Details**
|
|
33088
|
-
*
|
|
33089
|
-
* For `unknown` input use {@link decodeUnknownEffect}.
|
|
33090
|
-
* Options may be provided either when creating the decoder or when applying it;
|
|
33091
|
-
* application options override creation options.
|
|
33092
|
-
*
|
|
33093
|
-
* @category decoding
|
|
33094
|
-
* @since 4.0.0
|
|
33095
|
-
*/
|
|
33096
|
-
const decodeEffect = decodeUnknownEffect;
|
|
33097
|
-
/**
|
|
33098
33148
|
* Decodes an `unknown` input against a schema, returning an `Option` that is
|
|
33099
33149
|
* `Some` with the decoded value on success or `None` on failure.
|
|
33100
33150
|
*
|
|
@@ -33150,25 +33200,6 @@ function encodeUnknownEffect(schema, options) {
|
|
|
33150
33200
|
};
|
|
33151
33201
|
}
|
|
33152
33202
|
/**
|
|
33153
|
-
* Encodes a typed input (the schema's `Type`) against a schema, returning an
|
|
33154
|
-
* `Effect` that succeeds with the encoded value or fails with a
|
|
33155
|
-
* {@link SchemaError}.
|
|
33156
|
-
*
|
|
33157
|
-
* **When to use**
|
|
33158
|
-
*
|
|
33159
|
-
* Use when the input is already typed as the schema's `Type`.
|
|
33160
|
-
*
|
|
33161
|
-
* **Details**
|
|
33162
|
-
*
|
|
33163
|
-
* For `unknown` input use {@link encodeUnknownEffect}.
|
|
33164
|
-
* Options may be provided either when creating the encoder or when applying it;
|
|
33165
|
-
* application options override creation options.
|
|
33166
|
-
*
|
|
33167
|
-
* @category encoding
|
|
33168
|
-
* @since 4.0.0
|
|
33169
|
-
*/
|
|
33170
|
-
const encodeEffect = encodeUnknownEffect;
|
|
33171
|
-
/**
|
|
33172
33203
|
* Encodes a typed input (the schema's `Type`) against a schema synchronously,
|
|
33173
33204
|
* throwing a {@link SchemaError} on failure.
|
|
33174
33205
|
*
|
|
@@ -33891,15 +33922,15 @@ function isInt(annotations) {
|
|
|
33891
33922
|
*/
|
|
33892
33923
|
function CauseReason(error, defect) {
|
|
33893
33924
|
return make$35(declareConstructor()([error, defect], ([error, defect]) => (input, ast, options) => {
|
|
33894
|
-
if (!isReason(input)) return fail$3(new InvalidType(ast, some
|
|
33925
|
+
if (!isReason(input)) return fail$3(new InvalidType(ast, some(input)));
|
|
33895
33926
|
switch (input._tag) {
|
|
33896
33927
|
case "Fail": return mapBothEager(decodeUnknownEffect$1(error)(input.error, options), {
|
|
33897
33928
|
onSuccess: makeFailReason,
|
|
33898
|
-
onFailure: (issue) => new Composite(ast, some
|
|
33929
|
+
onFailure: (issue) => new Composite(ast, some(input), [new Pointer(["error"], issue)])
|
|
33899
33930
|
});
|
|
33900
33931
|
case "Die": return mapBothEager(decodeUnknownEffect$1(defect)(input.defect, options), {
|
|
33901
33932
|
onSuccess: makeDieReason,
|
|
33902
|
-
onFailure: (issue) => new Composite(ast, some
|
|
33933
|
+
onFailure: (issue) => new Composite(ast, some(input), [new Pointer(["defect"], issue)])
|
|
33903
33934
|
});
|
|
33904
33935
|
case "Interrupt": return succeed$3(input);
|
|
33905
33936
|
}
|
|
@@ -33994,10 +34025,10 @@ function Cause(error, defect) {
|
|
|
33994
34025
|
return make$35(declareConstructor()([error, defect], ([error, defect]) => {
|
|
33995
34026
|
const failures = ArraySchema(CauseReason(error, defect));
|
|
33996
34027
|
return (input, ast, options) => {
|
|
33997
|
-
if (!isCause(input)) return fail$3(new InvalidType(ast, some
|
|
34028
|
+
if (!isCause(input)) return fail$3(new InvalidType(ast, some(input)));
|
|
33998
34029
|
return mapBothEager(decodeUnknownEffect$1(failures)(input.reasons, options), {
|
|
33999
34030
|
onSuccess: fromReasons,
|
|
34000
|
-
onFailure: (issue) => new Composite(ast, some
|
|
34031
|
+
onFailure: (issue) => new Composite(ast, some(input), [new Pointer(["failures"], issue)])
|
|
34001
34032
|
});
|
|
34002
34033
|
};
|
|
34003
34034
|
}, {
|
|
@@ -34101,15 +34132,15 @@ function Exit(value, error, defect) {
|
|
|
34101
34132
|
], ([value, error, defect]) => {
|
|
34102
34133
|
const cause = Cause(error, defect);
|
|
34103
34134
|
return (input, ast, options) => {
|
|
34104
|
-
if (!isExit(input)) return fail$3(new InvalidType(ast, some
|
|
34135
|
+
if (!isExit(input)) return fail$3(new InvalidType(ast, some(input)));
|
|
34105
34136
|
switch (input._tag) {
|
|
34106
34137
|
case "Success": return mapBothEager(decodeUnknownEffect$1(value)(input.value, options), {
|
|
34107
34138
|
onSuccess: succeed$5,
|
|
34108
|
-
onFailure: (issue) => new Composite(ast, some
|
|
34139
|
+
onFailure: (issue) => new Composite(ast, some(input), [new Pointer(["value"], issue)])
|
|
34109
34140
|
});
|
|
34110
34141
|
case "Failure": return mapBothEager(decodeUnknownEffect$1(cause)(input.cause, options), {
|
|
34111
34142
|
onSuccess: failCause$3,
|
|
34112
|
-
onFailure: (issue) => new Composite(ast, some
|
|
34143
|
+
onFailure: (issue) => new Composite(ast, some(input), [new Pointer(["cause"], issue)])
|
|
34113
34144
|
});
|
|
34114
34145
|
}
|
|
34115
34146
|
};
|
|
@@ -34337,7 +34368,7 @@ function getClassSchemaFactory(from, identifier, annotations) {
|
|
|
34337
34368
|
if (memo === void 0) {
|
|
34338
34369
|
const transformation = getClassTransformation(self);
|
|
34339
34370
|
const to = make$35(new Declaration([from.ast], () => (input, ast) => {
|
|
34340
|
-
return input instanceof self || hasProperty(input, getClassTypeId(identifier)) ? succeed$3(input) : fail$3(new InvalidType(ast, some
|
|
34371
|
+
return input instanceof self || hasProperty(input, getClassTypeId(identifier)) ? succeed$3(input) : fail$3(new InvalidType(ast, some(input)));
|
|
34341
34372
|
}, {
|
|
34342
34373
|
identifier,
|
|
34343
34374
|
[ClassTypeId]: ([from]) => new Link(from, transformation),
|
|
@@ -35964,7 +35995,7 @@ const setUrlParams = /*#__PURE__*/ dual(2, (self, input) => makeWith$1(self.meth
|
|
|
35964
35995
|
* @category combinators
|
|
35965
35996
|
* @since 4.0.0
|
|
35966
35997
|
*/
|
|
35967
|
-
const setHash = /*#__PURE__*/ dual(2, (self, hash) => makeWith$1(self.method, self.url, self.urlParams, some
|
|
35998
|
+
const setHash = /*#__PURE__*/ dual(2, (self, hash) => makeWith$1(self.method, self.url, self.urlParams, some(hash), self.headers, self.body));
|
|
35968
35999
|
/**
|
|
35969
36000
|
* Sets the request body and updates `Content-Type` and `Content-Length` headers from the body metadata when available.
|
|
35970
36001
|
*
|
|
@@ -36259,7 +36290,7 @@ var WebHttpClientResponse = class extends Class$2 {
|
|
|
36259
36290
|
* @since 4.0.0
|
|
36260
36291
|
*/
|
|
36261
36292
|
const toHeaders = (span) => fromRecordUnsafe({
|
|
36262
|
-
b3: `${span.traceId}-${span.spanId}-${span.sampled ? "1" : "0"}${match$
|
|
36293
|
+
b3: `${span.traceId}-${span.spanId}-${span.sampled ? "1" : "0"}${match$4(span.parent, {
|
|
36263
36294
|
onNone: () => "",
|
|
36264
36295
|
onSome: (parent) => `-${parent.spanId}`
|
|
36265
36296
|
})}`,
|
|
@@ -36298,7 +36329,7 @@ const b3 = (headers) => {
|
|
|
36298
36329
|
if (!("b3" in headers)) return none();
|
|
36299
36330
|
const parts = headers["b3"].split("-");
|
|
36300
36331
|
if (parts.length < 2) return none();
|
|
36301
|
-
return some
|
|
36332
|
+
return some(externalSpan({
|
|
36302
36333
|
traceId: parts[0],
|
|
36303
36334
|
spanId: parts[1],
|
|
36304
36335
|
sampled: parts[2] ? parts[2] === "1" : true
|
|
@@ -36317,7 +36348,7 @@ const b3 = (headers) => {
|
|
|
36317
36348
|
*/
|
|
36318
36349
|
const xb3 = (headers) => {
|
|
36319
36350
|
if (!headers["x-b3-traceid"] || !headers["x-b3-spanid"]) return none();
|
|
36320
|
-
return some
|
|
36351
|
+
return some(externalSpan({
|
|
36321
36352
|
traceId: headers["x-b3-traceid"],
|
|
36322
36353
|
spanId: headers["x-b3-spanid"],
|
|
36323
36354
|
sampled: headers["x-b3-sampled"] ? headers["x-b3-sampled"] === "1" : true
|
|
@@ -36343,7 +36374,7 @@ const w3c = (headers) => {
|
|
|
36343
36374
|
switch (version) {
|
|
36344
36375
|
case "00":
|
|
36345
36376
|
if (w3cTraceId.test(traceId) === false || w3cSpanId.test(spanId) === false) return none();
|
|
36346
|
-
return some
|
|
36377
|
+
return some(externalSpan({
|
|
36347
36378
|
traceId,
|
|
36348
36379
|
spanId,
|
|
36349
36380
|
sampled: (parseInt(flags, 16) & 1) === 1
|
|
@@ -37791,7 +37822,7 @@ const causeResponseStripped = (cause) => {
|
|
|
37791
37822
|
}
|
|
37792
37823
|
return true;
|
|
37793
37824
|
});
|
|
37794
|
-
return [response ?? internalServerError, failures.length > 0 ? some
|
|
37825
|
+
return [response ?? internalServerError, failures.length > 0 ? some(fromReasons(failures)) : none()];
|
|
37795
37826
|
};
|
|
37796
37827
|
const internalServerError = /*#__PURE__*/ empty({ status: 500 });
|
|
37797
37828
|
const succeedInternalServerError = /*#__PURE__*/ succeed$3(internalServerError);
|
|
@@ -39560,7 +39591,7 @@ const toURL = (self) => {
|
|
|
39560
39591
|
const host = self.headers.host ?? "localhost";
|
|
39561
39592
|
const protocol = self.headers["x-forwarded-proto"] === "https" ? "https" : "http";
|
|
39562
39593
|
try {
|
|
39563
|
-
return some
|
|
39594
|
+
return some(new URL(self.url, `${protocol}://${host}`));
|
|
39564
39595
|
} catch {
|
|
39565
39596
|
return none();
|
|
39566
39597
|
}
|
|
@@ -39887,7 +39918,7 @@ const toString = (self) => {
|
|
|
39887
39918
|
*/
|
|
39888
39919
|
var Generator = class extends Service()("effect/http/Etag/Generator") {};
|
|
39889
39920
|
const fromFileInfo = (info) => {
|
|
39890
|
-
const mtime = match$
|
|
39921
|
+
const mtime = match$4(info.mtime, {
|
|
39891
39922
|
onNone: () => "0",
|
|
39892
39923
|
onSome: (mtime) => mtime.getTime().toString(16)
|
|
39893
39924
|
});
|
|
@@ -40305,7 +40336,7 @@ const RouteTypeId = "~effect/http/HttpRouter/Route";
|
|
|
40305
40336
|
const makeRoute = (options) => ({
|
|
40306
40337
|
...options,
|
|
40307
40338
|
uninterruptible: options.uninterruptible ?? false,
|
|
40308
|
-
prefix: typeof options.prefix === "string" ? some
|
|
40339
|
+
prefix: typeof options.prefix === "string" ? some(options.prefix) : options.prefix ?? none(),
|
|
40309
40340
|
[RouteTypeId]: RouteTypeId
|
|
40310
40341
|
});
|
|
40311
40342
|
/**
|
|
@@ -40360,7 +40391,7 @@ const prefixPath = /*#__PURE__*/ dual(2, (self, prefix) => {
|
|
|
40360
40391
|
const prefixRoute = /*#__PURE__*/ dual(2, (self, prefix) => makeRoute({
|
|
40361
40392
|
...self,
|
|
40362
40393
|
path: prefixPath(self.path, prefix),
|
|
40363
|
-
prefix: match$
|
|
40394
|
+
prefix: match$4(self.prefix, {
|
|
40364
40395
|
onNone: () => prefix,
|
|
40365
40396
|
onSome: (existingPrefix) => prefixPath(existingPrefix, prefix)
|
|
40366
40397
|
})
|
|
@@ -40636,7 +40667,7 @@ function isStreamSchema(schema) {
|
|
|
40636
40667
|
}
|
|
40637
40668
|
/** @internal */
|
|
40638
40669
|
function getStreamSchemas(schema) {
|
|
40639
|
-
return isStreamSchema(schema) ? some
|
|
40670
|
+
return isStreamSchema(schema) ? some({
|
|
40640
40671
|
success: schema.success,
|
|
40641
40672
|
error: schema.error
|
|
40642
40673
|
}) : none();
|
|
@@ -44940,7 +44971,7 @@ const withDefault = /*#__PURE__*/ dual(2, (self, defaultValue) => {
|
|
|
44940
44971
|
* @category combinators
|
|
44941
44972
|
* @since 2.0.0
|
|
44942
44973
|
*/
|
|
44943
|
-
const option = (self) => self.pipe(map(some
|
|
44974
|
+
const option = (self) => self.pipe(map(some), withDefault(none()));
|
|
44944
44975
|
/**
|
|
44945
44976
|
* Constructs a `Config<T>` from a value matching `Wrap<T>`.
|
|
44946
44977
|
*
|
|
@@ -48966,10 +48997,10 @@ const makeFile = /*#__PURE__*/ (() => {
|
|
|
48966
48997
|
}), (bytesRead) => {
|
|
48967
48998
|
if (bytesRead === 0) return none();
|
|
48968
48999
|
this.position = position + BigInt(bytesRead);
|
|
48969
|
-
if (bytesRead === sizeNumber) return some
|
|
49000
|
+
if (bytesRead === sizeNumber) return some(buffer);
|
|
48970
49001
|
const dst = Buffer.allocUnsafeSlow(bytesRead);
|
|
48971
49002
|
buffer.copy(dst, 0, 0, bytesRead);
|
|
48972
|
-
return some
|
|
49003
|
+
return some(dst);
|
|
48973
49004
|
});
|
|
48974
49005
|
});
|
|
48975
49006
|
}
|
|
@@ -49068,7 +49099,7 @@ const makeFileInfo = (stat) => ({
|
|
|
49068
49099
|
uid: fromNullishOr(stat.uid),
|
|
49069
49100
|
gid: fromNullishOr(stat.gid),
|
|
49070
49101
|
size: Size(stat.size),
|
|
49071
|
-
blksize: stat.blksize !== void 0 ? some
|
|
49102
|
+
blksize: stat.blksize !== void 0 ? some(Size(stat.blksize)) : none(),
|
|
49072
49103
|
blocks: fromNullishOr(stat.blocks)
|
|
49073
49104
|
});
|
|
49074
49105
|
const stat = /*#__PURE__*/ (() => {
|
|
@@ -51631,39 +51662,6 @@ const layerFileSystem = (directory) => effect(KeyValueStore)(gen(function* () {
|
|
|
51631
51662
|
})
|
|
51632
51663
|
});
|
|
51633
51664
|
}));
|
|
51634
|
-
const SchemaStoreTypeId = "~effect/persistence/KeyValueStore/SchemaStore";
|
|
51635
|
-
/**
|
|
51636
|
-
* Adapts a `KeyValueStore` into a `SchemaStore` using the schema's JSON codec.
|
|
51637
|
-
*
|
|
51638
|
-
* @category SchemaStore
|
|
51639
|
-
* @since 4.0.0
|
|
51640
|
-
*/
|
|
51641
|
-
const toSchemaStore = (self, schema) => {
|
|
51642
|
-
const jsonSchema = fromJsonString(toCodecJson(schema));
|
|
51643
|
-
const decode = decodeEffect(jsonSchema);
|
|
51644
|
-
const encode = encodeEffect(jsonSchema);
|
|
51645
|
-
const get = (key) => flatMap$2(self.get(key), match({
|
|
51646
|
-
onUndefined: () => succeedNone,
|
|
51647
|
-
onDefined: (value) => asSome(decode(value))
|
|
51648
|
-
}));
|
|
51649
|
-
const set = (key, value) => flatMap$2(encode(value), (json) => self.set(key, json));
|
|
51650
|
-
const modify = (key, f) => flatMap$2(get(key), (o) => {
|
|
51651
|
-
if (isNone(o)) return succeedNone;
|
|
51652
|
-
const newValue = f(o.value);
|
|
51653
|
-
return as(set(key, newValue), some$1(newValue));
|
|
51654
|
-
});
|
|
51655
|
-
return {
|
|
51656
|
-
[SchemaStoreTypeId]: SchemaStoreTypeId,
|
|
51657
|
-
get,
|
|
51658
|
-
set,
|
|
51659
|
-
modify,
|
|
51660
|
-
remove: self.remove,
|
|
51661
|
-
clear: self.clear,
|
|
51662
|
-
size: self.size,
|
|
51663
|
-
has: self.has,
|
|
51664
|
-
isEmpty: self.isEmpty
|
|
51665
|
-
};
|
|
51666
|
-
};
|
|
51667
51665
|
//#endregion
|
|
51668
51666
|
//#region ../../node_modules/.pnpm/effect@4.0.0-beta.74/node_modules/effect/dist/SubscriptionRef.js
|
|
51669
51667
|
/**
|
|
@@ -52221,38 +52219,49 @@ var GitDiffSegment = class extends Class("GitDiffSegment")({
|
|
|
52221
52219
|
type: Literals(["commit", "worktree"])
|
|
52222
52220
|
}) {};
|
|
52223
52221
|
var GitDiff = class extends Class("GitDiff")({
|
|
52222
|
+
fileContent: optional(String$1),
|
|
52224
52223
|
filePath: String$1,
|
|
52225
52224
|
patch: String$1,
|
|
52226
52225
|
segments: ArraySchema(GitDiffSegment),
|
|
52227
52226
|
status: GitDiffStatus
|
|
52228
52227
|
}) {};
|
|
52229
|
-
const
|
|
52230
|
-
|
|
52231
|
-
|
|
52232
|
-
}),
|
|
52233
|
-
|
|
52234
|
-
|
|
52235
|
-
|
|
52236
|
-
|
|
52237
|
-
|
|
52238
|
-
type: Literal("ref")
|
|
52239
|
-
}), Struct({ type: Literal("worktree") })]);
|
|
52228
|
+
const GitReviewTarget = Union([
|
|
52229
|
+
Struct({ _tag: Literal("changes") }),
|
|
52230
|
+
Struct({ _tag: Literal("local") }),
|
|
52231
|
+
Struct({ _tag: Literal("branch") }),
|
|
52232
|
+
Struct({
|
|
52233
|
+
_tag: Literal("commit"),
|
|
52234
|
+
hash: String$1
|
|
52235
|
+
})
|
|
52236
|
+
]);
|
|
52240
52237
|
var GitCommit = class extends Class("GitCommit")({
|
|
52241
52238
|
hash: String$1,
|
|
52242
|
-
parents: ArraySchema(String$1),
|
|
52243
52239
|
shortHash: String$1,
|
|
52244
|
-
subject: String$1
|
|
52245
|
-
wip: Boolean$1
|
|
52240
|
+
subject: String$1
|
|
52246
52241
|
}) {};
|
|
52247
52242
|
var GitReviewMetadata = class extends Class("GitReviewMetadata")({
|
|
52248
|
-
|
|
52249
|
-
branch: String$1,
|
|
52250
|
-
commits: ArraySchema(GitCommit),
|
|
52251
|
-
defaultBranch: String$1,
|
|
52243
|
+
branchCommits: ArraySchema(GitCommit),
|
|
52252
52244
|
dirty: Boolean$1,
|
|
52245
|
+
localCommits: ArraySchema(GitCommit),
|
|
52253
52246
|
prUrl: optional(String$1),
|
|
52254
52247
|
unpushedCommits: Boolean$1
|
|
52255
52248
|
}) {};
|
|
52249
|
+
var GitReviewMark = class extends Class("GitReviewMark")({
|
|
52250
|
+
filePath: String$1,
|
|
52251
|
+
fingerprint: String$1,
|
|
52252
|
+
segmentId: String$1
|
|
52253
|
+
}) {};
|
|
52254
|
+
var GitReviewComment = class extends Class("GitReviewComment")({
|
|
52255
|
+
body: String$1,
|
|
52256
|
+
filePath: String$1,
|
|
52257
|
+
lineNumber: Number$1,
|
|
52258
|
+
resolved: Boolean$1,
|
|
52259
|
+
side: optional(Literals(["additions", "deletions"]))
|
|
52260
|
+
}) {};
|
|
52261
|
+
var GitReviewState = class extends Class("GitReviewState")({
|
|
52262
|
+
comments: ArraySchema(GitReviewComment),
|
|
52263
|
+
marks: ArraySchema(GitReviewMark)
|
|
52264
|
+
}) {};
|
|
52256
52265
|
var GitHubReviewThread = class extends Class("GitHubReviewThread")({
|
|
52257
52266
|
body: String$1,
|
|
52258
52267
|
filePath: String$1,
|
|
@@ -52298,15 +52307,55 @@ var GitWorktreeStatus = class extends Class("GitWorktreeStatus")({
|
|
|
52298
52307
|
unpushedCommits: Boolean$1,
|
|
52299
52308
|
untracked: Boolean$1
|
|
52300
52309
|
}) {};
|
|
52301
|
-
var GitWorktree
|
|
52310
|
+
var GitWorktree = class extends Class("GitWorktree")({
|
|
52302
52311
|
branch: optional(String$1),
|
|
52303
52312
|
root: String$1,
|
|
52304
52313
|
status: optional(GitWorktreeStatus)
|
|
52305
52314
|
}) {};
|
|
52306
52315
|
var GitProject = class extends Class("GitProject")({
|
|
52307
52316
|
repository: GitRepository,
|
|
52308
|
-
worktrees: ArraySchema(GitWorktree
|
|
52317
|
+
worktrees: ArraySchema(GitWorktree)
|
|
52309
52318
|
}) {};
|
|
52319
|
+
function gitReviewCommentKey(input) {
|
|
52320
|
+
return `${input.filePath}:${input.side ?? "additions"}:${input.lineNumber}`;
|
|
52321
|
+
}
|
|
52322
|
+
function gitReviewMarkKey(input) {
|
|
52323
|
+
return `${input.filePath}:${input.fingerprint}`;
|
|
52324
|
+
}
|
|
52325
|
+
function gitReviewStateSaveComment(state, comment) {
|
|
52326
|
+
const key = gitReviewCommentKey(comment);
|
|
52327
|
+
return new GitReviewState({
|
|
52328
|
+
comments: append$1(filter$1(state.comments, (currentComment) => gitReviewCommentKey(currentComment) !== key), new GitReviewComment({
|
|
52329
|
+
...comment,
|
|
52330
|
+
resolved: false
|
|
52331
|
+
})),
|
|
52332
|
+
marks: state.marks
|
|
52333
|
+
});
|
|
52334
|
+
}
|
|
52335
|
+
function gitReviewStateResolveComment(state, input) {
|
|
52336
|
+
const key = gitReviewCommentKey(input);
|
|
52337
|
+
return new GitReviewState({
|
|
52338
|
+
comments: map$7(state.comments, (comment) => gitReviewCommentKey(comment) === key ? new GitReviewComment({
|
|
52339
|
+
...comment,
|
|
52340
|
+
resolved: true
|
|
52341
|
+
}) : comment),
|
|
52342
|
+
marks: state.marks
|
|
52343
|
+
});
|
|
52344
|
+
}
|
|
52345
|
+
function gitReviewStateMark(state, marks) {
|
|
52346
|
+
const keys = new Set(map$7(marks, gitReviewMarkKey));
|
|
52347
|
+
return new GitReviewState({
|
|
52348
|
+
comments: state.comments,
|
|
52349
|
+
marks: appendAll(filter$1(state.marks, (mark) => !keys.has(gitReviewMarkKey(mark))), marks)
|
|
52350
|
+
});
|
|
52351
|
+
}
|
|
52352
|
+
function gitReviewStateUnmark(state, marks) {
|
|
52353
|
+
const keys = new Set(map$7(marks, gitReviewMarkKey));
|
|
52354
|
+
return new GitReviewState({
|
|
52355
|
+
comments: state.comments,
|
|
52356
|
+
marks: filter$1(state.marks, (mark) => !keys.has(gitReviewMarkKey(mark)))
|
|
52357
|
+
});
|
|
52358
|
+
}
|
|
52310
52359
|
//#endregion
|
|
52311
52360
|
//#region ../../packages/terminal/src/schema.ts
|
|
52312
52361
|
var TerminalError = class extends TaggedErrorClass()("TerminalError", {
|
|
@@ -52340,6 +52389,14 @@ const TerminalUpdate = Union([Struct({
|
|
|
52340
52389
|
}), TerminalEvent]);
|
|
52341
52390
|
//#endregion
|
|
52342
52391
|
//#region src/rpcs/contracts.ts
|
|
52392
|
+
const CreateWorktreeSource = Union([
|
|
52393
|
+
Struct({ _tag: Literal("local") }),
|
|
52394
|
+
Struct({
|
|
52395
|
+
_tag: Literal("remote"),
|
|
52396
|
+
remote: String$1
|
|
52397
|
+
}),
|
|
52398
|
+
Struct({ _tag: Literal("new") })
|
|
52399
|
+
]);
|
|
52343
52400
|
const TerminalPayload = Struct({
|
|
52344
52401
|
args: optional(ArraySchema(String$1)),
|
|
52345
52402
|
command: optional(String$1),
|
|
@@ -52373,22 +52430,6 @@ const AgentSession = Struct({
|
|
|
52373
52430
|
state: TerminalState,
|
|
52374
52431
|
uuid: String$1
|
|
52375
52432
|
});
|
|
52376
|
-
var ReviewMark = class extends Class("ReviewMark")({
|
|
52377
|
-
filePath: String$1,
|
|
52378
|
-
fingerprint: String$1,
|
|
52379
|
-
segmentId: String$1
|
|
52380
|
-
}) {};
|
|
52381
|
-
var ReviewComment = class extends Class("ReviewComment")({
|
|
52382
|
-
body: String$1,
|
|
52383
|
-
filePath: String$1,
|
|
52384
|
-
lineNumber: Number$1,
|
|
52385
|
-
resolved: optional(Boolean$1),
|
|
52386
|
-
side: optional(Literals(["additions", "deletions"]))
|
|
52387
|
-
}) {};
|
|
52388
|
-
var ReviewState = class extends Class("ReviewState")({
|
|
52389
|
-
comments: ArraySchema(ReviewComment),
|
|
52390
|
-
marks: ArraySchema(ReviewMark)
|
|
52391
|
-
}) {};
|
|
52392
52433
|
var RpcContracts = class extends make$15(make$18("agents.create", {
|
|
52393
52434
|
error: TerminalError,
|
|
52394
52435
|
payload: Struct({
|
|
@@ -52423,71 +52464,56 @@ var RpcContracts = class extends make$15(make$18("agents.create", {
|
|
|
52423
52464
|
success: GitBranchesSnapshot
|
|
52424
52465
|
}), make$18("review.metadata", {
|
|
52425
52466
|
error: GitError,
|
|
52426
|
-
payload: Struct({
|
|
52427
|
-
base: optional(String$1),
|
|
52428
|
-
cwd: String$1
|
|
52429
|
-
}),
|
|
52467
|
+
payload: Struct({ cwd: String$1 }),
|
|
52430
52468
|
success: GitReviewMetadata
|
|
52431
|
-
}), make$18("review.
|
|
52469
|
+
}), make$18("review.diffs", {
|
|
52432
52470
|
error: GitError,
|
|
52433
52471
|
payload: Struct({
|
|
52434
52472
|
cwd: String$1,
|
|
52435
|
-
|
|
52436
|
-
to: GitReviewTo
|
|
52473
|
+
target: GitReviewTarget
|
|
52437
52474
|
}),
|
|
52438
52475
|
stream: true,
|
|
52439
52476
|
success: ArraySchema(GitDiff)
|
|
52440
52477
|
}), make$18("review.state.watch", {
|
|
52441
52478
|
error: GitError,
|
|
52442
|
-
payload: Struct({
|
|
52443
|
-
base: String$1,
|
|
52444
|
-
cwd: String$1
|
|
52445
|
-
}),
|
|
52479
|
+
payload: Struct({ cwd: String$1 }),
|
|
52446
52480
|
stream: true,
|
|
52447
|
-
success:
|
|
52481
|
+
success: GitReviewState
|
|
52448
52482
|
}), make$18("review.state.mark", {
|
|
52449
52483
|
error: GitError,
|
|
52450
52484
|
payload: Struct({
|
|
52451
|
-
base: String$1,
|
|
52452
52485
|
cwd: String$1,
|
|
52453
|
-
marks: ArraySchema(
|
|
52486
|
+
marks: ArraySchema(GitReviewMark)
|
|
52454
52487
|
})
|
|
52455
52488
|
}), make$18("review.state.unmark", {
|
|
52456
52489
|
error: GitError,
|
|
52457
52490
|
payload: Struct({
|
|
52458
|
-
base: String$1,
|
|
52459
52491
|
cwd: String$1,
|
|
52460
|
-
marks: ArraySchema(
|
|
52492
|
+
marks: ArraySchema(GitReviewMark)
|
|
52461
52493
|
})
|
|
52462
52494
|
}), make$18("review.comments.save", {
|
|
52463
52495
|
error: GitError,
|
|
52464
52496
|
payload: Struct({
|
|
52465
|
-
|
|
52466
|
-
comment: ReviewComment,
|
|
52497
|
+
comment: GitReviewComment,
|
|
52467
52498
|
cwd: String$1
|
|
52468
52499
|
})
|
|
52469
52500
|
}), make$18("review.comments.resolve", {
|
|
52470
52501
|
error: GitError,
|
|
52471
52502
|
payload: Struct({
|
|
52472
|
-
base: String$1,
|
|
52473
52503
|
cwd: String$1,
|
|
52474
52504
|
filePath: String$1,
|
|
52475
52505
|
lineNumber: Number$1,
|
|
52476
52506
|
side: optional(Literals(["additions", "deletions"]))
|
|
52477
52507
|
})
|
|
52478
|
-
}), make$18("review.
|
|
52508
|
+
}), make$18("review.commit", {
|
|
52479
52509
|
error: GitError,
|
|
52480
52510
|
payload: Struct({
|
|
52481
52511
|
cwd: String$1,
|
|
52482
52512
|
message: String$1
|
|
52483
52513
|
})
|
|
52484
|
-
}), make$18("review.
|
|
52514
|
+
}), make$18("review.push", {
|
|
52485
52515
|
error: GitError,
|
|
52486
|
-
payload: Struct({
|
|
52487
|
-
base: String$1,
|
|
52488
|
-
cwd: String$1,
|
|
52489
|
-
message: String$1
|
|
52490
|
-
})
|
|
52516
|
+
payload: Struct({ cwd: String$1 })
|
|
52491
52517
|
}), make$18("review.githubThreads", {
|
|
52492
52518
|
error: GitError,
|
|
52493
52519
|
payload: Struct({ cwd: String$1 }),
|
|
@@ -52498,43 +52524,17 @@ var RpcContracts = class extends make$15(make$18("agents.create", {
|
|
|
52498
52524
|
cwd: String$1,
|
|
52499
52525
|
threadId: String$1
|
|
52500
52526
|
})
|
|
52501
|
-
}), make$18("review.stageFile", {
|
|
52502
|
-
error: GitError,
|
|
52503
|
-
payload: Struct({
|
|
52504
|
-
cwd: String$1,
|
|
52505
|
-
filePath: String$1
|
|
52506
|
-
})
|
|
52507
|
-
}), make$18("review.unstageFile", {
|
|
52508
|
-
error: GitError,
|
|
52509
|
-
payload: Struct({
|
|
52510
|
-
cwd: String$1,
|
|
52511
|
-
filePath: String$1
|
|
52512
|
-
})
|
|
52513
|
-
}), make$18("review.discardFile", {
|
|
52514
|
-
error: GitError,
|
|
52515
|
-
payload: Struct({
|
|
52516
|
-
cwd: String$1,
|
|
52517
|
-
filePath: String$1
|
|
52518
|
-
})
|
|
52519
52527
|
}), make$18("projects.createWorktree", {
|
|
52520
52528
|
error: GitError,
|
|
52521
52529
|
payload: Struct({
|
|
52522
|
-
baseBranch: String$1,
|
|
52523
52530
|
branch: String$1,
|
|
52524
52531
|
cwd: String$1,
|
|
52525
|
-
|
|
52526
|
-
"existing-local",
|
|
52527
|
-
"existing-remote",
|
|
52528
|
-
"new-local"
|
|
52529
|
-
])
|
|
52532
|
+
source: CreateWorktreeSource
|
|
52530
52533
|
}),
|
|
52531
52534
|
success: String$1
|
|
52532
52535
|
}), make$18("projects.deleteWorktree", {
|
|
52533
52536
|
error: GitError,
|
|
52534
|
-
payload: Struct({
|
|
52535
|
-
cwd: String$1,
|
|
52536
|
-
force: Boolean$1
|
|
52537
|
-
})
|
|
52537
|
+
payload: Struct({ cwd: String$1 })
|
|
52538
52538
|
}), make$18("runs.portless", {
|
|
52539
52539
|
error: TerminalError,
|
|
52540
52540
|
payload: Struct({ cwd: String$1 }),
|
|
@@ -52581,22 +52581,47 @@ var RpcContracts = class extends make$15(make$18("agents.create", {
|
|
|
52581
52581
|
})) {};
|
|
52582
52582
|
//#endregion
|
|
52583
52583
|
//#region ../../packages/git/src/service.ts
|
|
52584
|
-
|
|
52585
|
-
const
|
|
52584
|
+
var GitCommand = class extends Service()("@deslop/git/service/GitCommand", { make: gen(function* () {
|
|
52585
|
+
const spawner = yield* ChildProcessSpawner;
|
|
52586
|
+
const string = fn("GitCommand.string")(function* (cwd, args) {
|
|
52587
|
+
yield* annotateCurrentSpan({
|
|
52588
|
+
command: args[0] ?? "git",
|
|
52589
|
+
cwd
|
|
52590
|
+
});
|
|
52591
|
+
return yield* scoped$3(gen(function* () {
|
|
52592
|
+
const handle = yield* pipe(spawner.spawn(make$40("git", args, {
|
|
52593
|
+
cwd,
|
|
52594
|
+
stderr: "pipe",
|
|
52595
|
+
stdout: "pipe"
|
|
52596
|
+
})), mapError$2((cause) => new GitError({ cause })));
|
|
52597
|
+
const output = yield* all({
|
|
52598
|
+
stderr: pipe(decodeText(handle.stderr), mkString, orElseSucceed(() => "")),
|
|
52599
|
+
stdout: pipe(decodeText(handle.stdout), mkString, orElseSucceed(() => ""))
|
|
52600
|
+
}, { concurrency: "unbounded" });
|
|
52601
|
+
const exitCode = yield* pipe(handle.exitCode, mapError$2((cause) => new GitError({ cause })));
|
|
52602
|
+
if (exitCode !== ExitCode(0)) return yield* new GitError({ cause: new Error(output.stderr || output.stdout || `git ${join$2(" ")(args)} exited with ${exitCode}`) });
|
|
52603
|
+
return output.stdout;
|
|
52604
|
+
})).pipe(withSpan("git.command", { attributes: {
|
|
52605
|
+
command: args[0] ?? "git",
|
|
52606
|
+
cwd
|
|
52607
|
+
} }));
|
|
52608
|
+
});
|
|
52586
52609
|
return {
|
|
52587
|
-
lines:
|
|
52588
|
-
return
|
|
52610
|
+
lines: fn("GitCommand.lines")(function* (cwd, args) {
|
|
52611
|
+
return pipe(yield* string(cwd, args), split$1(/\r?\n/u), filter$1(isNonEmpty$1));
|
|
52589
52612
|
}),
|
|
52590
|
-
string
|
|
52591
|
-
return yield* pipe(execString(make$40("git", args, { cwd })), mapError$2((cause) => new GitError({ cause })));
|
|
52592
|
-
})
|
|
52613
|
+
string
|
|
52593
52614
|
};
|
|
52594
|
-
})
|
|
52595
|
-
|
|
52596
|
-
|
|
52597
|
-
|
|
52615
|
+
}) }) {
|
|
52616
|
+
static layer = effect(this, this.make);
|
|
52617
|
+
};
|
|
52618
|
+
const excludedDiscoveryEntries = new Set([
|
|
52619
|
+
".git",
|
|
52620
|
+
"dist",
|
|
52621
|
+
"node_modules"
|
|
52622
|
+
]);
|
|
52598
52623
|
function segmentsByFile(segments) {
|
|
52599
|
-
return reduce(segments, empty$6(), (groups, segment) => modifyAt(groups, segment.filePath, (current) => some
|
|
52624
|
+
return reduce(segments, empty$6(), (groups, segment) => modifyAt(groups, segment.filePath, (current) => some(append$1(getOrElse$1(current, () => empty$13()), segment))));
|
|
52600
52625
|
}
|
|
52601
52626
|
function diffFromPatchChunk(chunk, segments) {
|
|
52602
52627
|
const deleted = /^deleted file mode /mu.test(chunk);
|
|
@@ -52609,18 +52634,60 @@ function diffFromPatchChunk(chunk, segments) {
|
|
|
52609
52634
|
status
|
|
52610
52635
|
});
|
|
52611
52636
|
}
|
|
52612
|
-
function
|
|
52613
|
-
return
|
|
52637
|
+
function withDisplayedPatchSegments(diffs, id, type) {
|
|
52638
|
+
return map$7(diffs, (diff) => new GitDiff({
|
|
52639
|
+
fileContent: diff.fileContent,
|
|
52640
|
+
filePath: diff.filePath,
|
|
52641
|
+
patch: diff.patch,
|
|
52642
|
+
segments: [new GitDiffSegment({
|
|
52643
|
+
filePath: diff.filePath,
|
|
52644
|
+
fingerprint: diff.patch,
|
|
52645
|
+
id,
|
|
52646
|
+
type
|
|
52647
|
+
})],
|
|
52648
|
+
status: diff.status
|
|
52649
|
+
}));
|
|
52650
|
+
}
|
|
52651
|
+
function commitFromLogLine(line) {
|
|
52652
|
+
const parts = split$1("\0")(line);
|
|
52653
|
+
return new GitCommit({
|
|
52654
|
+
hash: parts[0],
|
|
52655
|
+
shortHash: parts[1] ?? "",
|
|
52656
|
+
subject: parts[2] ?? ""
|
|
52657
|
+
});
|
|
52658
|
+
}
|
|
52659
|
+
function parseWorktreeRecords(output) {
|
|
52660
|
+
const records = [];
|
|
52661
|
+
let current = {
|
|
52662
|
+
hasHead: false,
|
|
52663
|
+
root: ""
|
|
52664
|
+
};
|
|
52665
|
+
for (const field of split$1("\0")(output)) if (startsWith("worktree ")(field)) {
|
|
52666
|
+
if (isNonEmpty$1(current.root) && current.hasHead) records.push(current);
|
|
52667
|
+
current = {
|
|
52668
|
+
hasHead: false,
|
|
52669
|
+
root: replace(/^worktree\s+/u, "")(field)
|
|
52670
|
+
};
|
|
52671
|
+
} else if (startsWith("HEAD ")(field)) current = {
|
|
52672
|
+
...current,
|
|
52673
|
+
hasHead: true
|
|
52674
|
+
};
|
|
52675
|
+
else if (startsWith("branch refs/heads/")(field)) current = {
|
|
52676
|
+
...current,
|
|
52677
|
+
branch: replace(/^branch\s+refs\/heads\//u, "")(field)
|
|
52678
|
+
};
|
|
52679
|
+
if (isNonEmpty$1(current.root) && current.hasHead) records.push(current);
|
|
52680
|
+
return records;
|
|
52614
52681
|
}
|
|
52615
52682
|
var GitWorkspace = class extends Service()("@deslop/git/service/GitWorkspace", { make: gen(function* () {
|
|
52616
|
-
const
|
|
52617
|
-
const git = yield* makeGitExecutor;
|
|
52683
|
+
const git = yield* GitCommand;
|
|
52618
52684
|
const fs = yield* FileSystem;
|
|
52619
52685
|
const path = yield* Path$1;
|
|
52620
52686
|
const home = yield* pipe(string("HOME"), withDefault(process.cwd()));
|
|
52621
52687
|
const projects = yield* make$3(empty$13());
|
|
52622
52688
|
const run = runForkWith(yield* context$1());
|
|
52623
|
-
const getDefaultBranch =
|
|
52689
|
+
const getDefaultBranch = fn("GitWorkspace.getDefaultBranch")(function* (cwd) {
|
|
52690
|
+
yield* annotateCurrentSpan({ cwd });
|
|
52624
52691
|
return yield* pipe(git.string(cwd, [
|
|
52625
52692
|
"symbolic-ref",
|
|
52626
52693
|
"--short",
|
|
@@ -52631,16 +52698,26 @@ var GitWorkspace = class extends Service()("@deslop/git/service/GitWorkspace", {
|
|
|
52631
52698
|
"main"
|
|
52632
52699
|
]), as("main"), catchTag("GitError", () => succeed$3("master")))));
|
|
52633
52700
|
});
|
|
52634
|
-
const getWorktreeStatus =
|
|
52635
|
-
|
|
52701
|
+
const getWorktreeStatus = fn("GitWorkspace.getWorktreeStatus")(function* (cwd, branch) {
|
|
52702
|
+
yield* annotateCurrentSpan({
|
|
52703
|
+
branch: branch ?? "",
|
|
52704
|
+
cwd
|
|
52705
|
+
});
|
|
52706
|
+
const upstream = branch === void 0 ? none() : yield* pipe(git.string(cwd, [
|
|
52707
|
+
"rev-parse",
|
|
52708
|
+
"--abbrev-ref",
|
|
52709
|
+
"--symbolic-full-name",
|
|
52710
|
+
`${branch}@{u}`
|
|
52711
|
+
]), map$4(flow(trim, some)), orElseSucceed(() => none()));
|
|
52712
|
+
const counts = isNone(upstream) ? ["0", "0"] : yield* pipe(git.string(cwd, [
|
|
52636
52713
|
"rev-list",
|
|
52637
52714
|
"--left-right",
|
|
52638
52715
|
"--count",
|
|
52639
|
-
|
|
52716
|
+
`${upstream.value}...HEAD`
|
|
52640
52717
|
]), map$4(flow(trim, split$1(/\s+/u))), orElseSucceed(() => ["0", "0"]));
|
|
52641
52718
|
return new GitWorktreeStatus({
|
|
52642
52719
|
ahead: getOrElse$1(parse$2(counts[1] ?? "0"), () => 0),
|
|
52643
|
-
behind: getOrElse$1(parse$2(counts[0]), () => 0),
|
|
52720
|
+
behind: getOrElse$1(parse$2(counts[0] ?? "0"), () => 0),
|
|
52644
52721
|
dirtyTracked: yield* pipe(git.lines(cwd, [
|
|
52645
52722
|
"status",
|
|
52646
52723
|
"--porcelain",
|
|
@@ -52654,79 +52731,62 @@ var GitWorkspace = class extends Service()("@deslop/git/service/GitWorkspace", {
|
|
|
52654
52731
|
]), map$4((lines) => !isReadonlyArrayEmpty(lines)), orElseSucceed(() => false))
|
|
52655
52732
|
});
|
|
52656
52733
|
});
|
|
52657
|
-
const collectRepositoriesFromRoots =
|
|
52658
|
-
|
|
52734
|
+
const collectRepositoriesFromRoots = fn("GitWorkspace.collectRepositoriesFromRoots")(function* (roots, repositories) {
|
|
52735
|
+
yield* annotateCurrentSpan({
|
|
52736
|
+
repositoryCount: length(repositories),
|
|
52737
|
+
rootCount: length(roots)
|
|
52738
|
+
});
|
|
52739
|
+
return yield* match$2(roots, {
|
|
52659
52740
|
onEmpty: () => succeed$3(repositories),
|
|
52660
52741
|
onNonEmpty: (remainingRoots) => {
|
|
52661
52742
|
const root = remainingRoots[0];
|
|
52662
52743
|
return pipe(fs.readDirectory(root), orElseSucceed(() => empty$13()), flatMap$2((entries) => {
|
|
52663
|
-
if (contains(entries, ".git")) return pipe(
|
|
52664
|
-
|
|
52665
|
-
|
|
52666
|
-
|
|
52667
|
-
|
|
52668
|
-
|
|
52669
|
-
root
|
|
52670
|
-
|
|
52671
|
-
|
|
52672
|
-
|
|
52673
|
-
|
|
52674
|
-
|
|
52675
|
-
|
|
52676
|
-
|
|
52677
|
-
|
|
52678
|
-
|
|
52679
|
-
|
|
52744
|
+
if (contains(entries, ".git")) return pipe(all({
|
|
52745
|
+
gitDirectory: pipe(git.string(root, [
|
|
52746
|
+
"rev-parse",
|
|
52747
|
+
"--path-format=absolute",
|
|
52748
|
+
"--git-common-dir"
|
|
52749
|
+
]), map$4(trim)),
|
|
52750
|
+
worktrees: pipe(git.string(root, [
|
|
52751
|
+
"worktree",
|
|
52752
|
+
"list",
|
|
52753
|
+
"--porcelain",
|
|
52754
|
+
"-z"
|
|
52755
|
+
]), map$4(parseWorktreeRecords))
|
|
52756
|
+
}, { concurrency: "unbounded" }), map$4((repository) => new GitRepository({
|
|
52757
|
+
gitDirectory: repository.gitDirectory,
|
|
52758
|
+
root: repository.worktrees[0]?.root ?? root
|
|
52759
|
+
})), option$1, flatMap$2((repository) => collectRepositoriesFromRoots(drop$1(remainingRoots, 1), pipe(repository, match$4({
|
|
52760
|
+
onNone: () => repositories,
|
|
52761
|
+
onSome: (value) => append$1(repositories, value)
|
|
52762
|
+
})))));
|
|
52763
|
+
return pipe(entries, filter$1((entry) => !excludedDiscoveryEntries.has(entry) && !(startsWith(".")(entry) && entry !== ".git")), forEach$1((entry) => pipe(fs.stat(path.join(root, entry)), map$4((info) => info.type === "Directory" ? path.join(root, entry) : ""), orElseSucceed(() => ""))), flatMap$2((nextRoots) => collectRepositoriesFromRoots(pipe(nextRoots, filter$1(isNonEmpty$1), appendAll(drop$1(roots, 1))), repositories)));
|
|
52680
52764
|
}));
|
|
52681
52765
|
}
|
|
52682
52766
|
});
|
|
52683
52767
|
});
|
|
52684
|
-
const listWorktrees =
|
|
52685
|
-
|
|
52768
|
+
const listWorktrees = fn("GitWorkspace.listWorktrees")(function* (cwd) {
|
|
52769
|
+
yield* annotateCurrentSpan({ cwd });
|
|
52770
|
+
yield* git.string(cwd, ["worktree", "prune"]);
|
|
52771
|
+
const worktrees = yield* pipe(git.string(cwd, [
|
|
52686
52772
|
"worktree",
|
|
52687
52773
|
"list",
|
|
52688
|
-
"--porcelain"
|
|
52689
|
-
|
|
52690
|
-
|
|
52691
|
-
|
|
52692
|
-
|
|
52693
|
-
|
|
52694
|
-
}, (state, line) => {
|
|
52695
|
-
if (startsWith("worktree ")(line)) return {
|
|
52696
|
-
currentBranch: "",
|
|
52697
|
-
currentRoot: replace(/^worktree\s+/u, "")(line),
|
|
52698
|
-
hasCurrentCommit: false,
|
|
52699
|
-
worktrees: isNonEmpty$1(state.currentRoot) && state.hasCurrentCommit ? append$1(state.worktrees, {
|
|
52700
|
-
branch: state.currentBranch,
|
|
52701
|
-
root: state.currentRoot
|
|
52702
|
-
}) : state.worktrees
|
|
52703
|
-
};
|
|
52704
|
-
if (startsWith("HEAD ")(line)) return {
|
|
52705
|
-
currentBranch: state.currentBranch,
|
|
52706
|
-
currentRoot: state.currentRoot,
|
|
52707
|
-
hasCurrentCommit: true,
|
|
52708
|
-
worktrees: state.worktrees
|
|
52709
|
-
};
|
|
52710
|
-
if (startsWith("branch refs/heads/")(line)) return {
|
|
52711
|
-
currentBranch: replace(/^branch\s+refs\/heads\//u, "")(line),
|
|
52712
|
-
currentRoot: state.currentRoot,
|
|
52713
|
-
hasCurrentCommit: state.hasCurrentCommit,
|
|
52714
|
-
worktrees: state.worktrees
|
|
52715
|
-
};
|
|
52716
|
-
return state;
|
|
52717
|
-
}), (state) => isNonEmpty$1(state.currentRoot) && state.hasCurrentCommit ? append$1(state.worktrees, {
|
|
52718
|
-
branch: state.currentBranch,
|
|
52719
|
-
root: state.currentRoot
|
|
52720
|
-
}) : state.worktrees, forEach$1((worktree) => pipe(getWorktreeStatus(worktree.root, isNonEmpty$1(worktree.branch) ? worktree.branch : void 0), map$4((status) => new GitWorktree$1({
|
|
52721
|
-
branch: isNonEmpty$1(worktree.branch) ? worktree.branch : void 0,
|
|
52774
|
+
"--porcelain",
|
|
52775
|
+
"-z"
|
|
52776
|
+
]), flatMap$2((output) => pipe(sync(() => parseWorktreeRecords(output)), withSpan("GitWorkspace.parseWorktrees", { attributes: { cwd } }))));
|
|
52777
|
+
yield* annotateCurrentSpan({ worktreeCount: length(worktrees) });
|
|
52778
|
+
return yield* forEach$1(worktrees, (worktree) => pipe(getWorktreeStatus(worktree.root, worktree.branch), map$4((status) => new GitWorktree({
|
|
52779
|
+
branch: worktree.branch,
|
|
52722
52780
|
root: worktree.root,
|
|
52723
52781
|
status
|
|
52724
|
-
}))))
|
|
52782
|
+
}))));
|
|
52725
52783
|
});
|
|
52726
|
-
const listRepositoriesFrom =
|
|
52727
|
-
|
|
52784
|
+
const listRepositoriesFrom = fn("GitWorkspace.listRepositoriesFrom")(function* (cwd) {
|
|
52785
|
+
yield* annotateCurrentSpan({ cwd });
|
|
52786
|
+
return yield* pipe(fs.realPath(cwd), orElseSucceed(() => cwd), flatMap$2((root) => collectRepositoriesFromRoots([root], empty$13())), map$4((repositories) => pipe(repositories, dedupeWith((left, right) => left.gitDirectory === right.gitDirectory || left.root === right.root))));
|
|
52728
52787
|
});
|
|
52729
|
-
const listProjectsFrom =
|
|
52788
|
+
const listProjectsFrom = fn("GitWorkspace.listProjectsFrom")(function* (cwd) {
|
|
52789
|
+
yield* annotateCurrentSpan({ cwd });
|
|
52730
52790
|
return pipe(yield* pipe(listRepositoriesFrom(cwd), flatMap$2(forEach$1((repository) => option$1(pipe(listWorktrees(repository.root), map$4((discoveredWorktrees) => new GitProject({
|
|
52731
52791
|
repository: new GitRepository({
|
|
52732
52792
|
gitDirectory: repository.gitDirectory,
|
|
@@ -52735,17 +52795,15 @@ var GitWorkspace = class extends Service()("@deslop/git/service/GitWorkspace", {
|
|
|
52735
52795
|
worktrees: sortWith(discoveredWorktrees, (worktree) => `${worktree.root === (discoveredWorktrees[0]?.root ?? repository.root) ? "0" : "1"}:${worktree.branch ?? ""}:${worktree.root}`, String$5)
|
|
52736
52796
|
})))), { concurrency: "unbounded" }))), getSomes, sortWith((project) => project.repository.root, String$5));
|
|
52737
52797
|
});
|
|
52738
|
-
const refreshProjects =
|
|
52798
|
+
const refreshProjects = fn("GitWorkspace.refreshProjects")(function* () {
|
|
52799
|
+
yield* annotateCurrentSpan({ cwd: home });
|
|
52739
52800
|
yield* set(projects, yield* listProjectsFrom(home));
|
|
52740
52801
|
});
|
|
52741
52802
|
yield* refreshProjects();
|
|
52742
|
-
yield* acquireRelease(sync(() => NFS.watch(home, () =>
|
|
52743
|
-
run(refreshProjects());
|
|
52744
|
-
})), (watcher) => sync(() => {
|
|
52745
|
-
watcher.close();
|
|
52746
|
-
}));
|
|
52803
|
+
yield* acquireRelease(sync(() => NFS.watch(home, () => void run(refreshProjects()))), (watcher) => sync(() => watcher.close()));
|
|
52747
52804
|
return {
|
|
52748
|
-
branches:
|
|
52805
|
+
branches: fn("GitWorkspace.branches")(function* (cwd) {
|
|
52806
|
+
yield* annotateCurrentSpan({ cwd });
|
|
52749
52807
|
return new GitBranchesSnapshot({
|
|
52750
52808
|
branches: yield* pipe(git.lines(cwd, [
|
|
52751
52809
|
"for-each-ref",
|
|
@@ -52766,30 +52824,15 @@ var GitWorkspace = class extends Service()("@deslop/git/service/GitWorkspace", {
|
|
|
52766
52824
|
defaultBranch: yield* getDefaultBranch(cwd)
|
|
52767
52825
|
});
|
|
52768
52826
|
}),
|
|
52769
|
-
|
|
52770
|
-
|
|
52771
|
-
|
|
52772
|
-
|
|
52773
|
-
|
|
52774
|
-
"--depth",
|
|
52775
|
-
"1",
|
|
52776
|
-
"--single-branch",
|
|
52777
|
-
input.url,
|
|
52778
|
-
targetDirectory
|
|
52779
|
-
], { cwd: input.cwd })), asVoid, catch_$2(() => pipe(execString(make$40("git", [
|
|
52780
|
-
"-C",
|
|
52781
|
-
targetDirectory,
|
|
52782
|
-
"pull",
|
|
52783
|
-
"--ff-only"
|
|
52784
|
-
])), asVoid, mapError$2((cause) => new GitError({
|
|
52785
|
-
cause,
|
|
52786
|
-
message: `failed to update ${targetDirectory} from ${input.url}`
|
|
52787
|
-
})))));
|
|
52788
|
-
}),
|
|
52789
|
-
createWorktree: fnUntraced(function* (input) {
|
|
52827
|
+
createWorktree: fn("GitWorkspace.createWorktree")(function* (input) {
|
|
52828
|
+
yield* annotateCurrentSpan({
|
|
52829
|
+
branch: input.branch,
|
|
52830
|
+
cwd: input.cwd
|
|
52831
|
+
});
|
|
52790
52832
|
const targetDirectory = path.join(home, ".deslop", "worktrees", `${replaceAll(/[^a-zA-Z0-9._-]+/gu, "-")(path.basename(input.cwd))}-${replaceAll(/[^a-zA-Z0-9._-]+/gu, "-")(input.branch)}-${yield* nextIntBetween(1e5, 999999)}`);
|
|
52791
52833
|
yield* pipe(fs.makeDirectory(path.dirname(targetDirectory), { recursive: true }), ignore$1);
|
|
52792
|
-
if (input.
|
|
52834
|
+
if (input.source._tag === "local") {
|
|
52835
|
+
yield* annotateCurrentSpan({ source: "local" });
|
|
52793
52836
|
yield* pipe(git.string(input.cwd, [
|
|
52794
52837
|
"worktree",
|
|
52795
52838
|
"add",
|
|
@@ -52799,116 +52842,220 @@ var GitWorkspace = class extends Service()("@deslop/git/service/GitWorkspace", {
|
|
|
52799
52842
|
yield* refreshProjects();
|
|
52800
52843
|
return targetDirectory;
|
|
52801
52844
|
}
|
|
52802
|
-
if (input.
|
|
52845
|
+
if (input.source._tag === "remote") {
|
|
52846
|
+
const remoteBranch = `${input.source.remote}/${input.branch}`;
|
|
52847
|
+
yield* annotateCurrentSpan({
|
|
52848
|
+
remote: input.source.remote,
|
|
52849
|
+
source: "remote"
|
|
52850
|
+
});
|
|
52803
52851
|
yield* pipe(git.string(input.cwd, [
|
|
52804
52852
|
"fetch",
|
|
52805
|
-
"--
|
|
52806
|
-
|
|
52807
|
-
]),
|
|
52853
|
+
"--prune",
|
|
52854
|
+
input.source.remote
|
|
52855
|
+
]), asVoid);
|
|
52808
52856
|
yield* pipe(git.string(input.cwd, [
|
|
52809
52857
|
"worktree",
|
|
52810
52858
|
"add",
|
|
52811
52859
|
"-b",
|
|
52812
52860
|
input.branch,
|
|
52813
52861
|
targetDirectory,
|
|
52814
|
-
|
|
52862
|
+
remoteBranch
|
|
52815
52863
|
]), asVoid);
|
|
52816
52864
|
yield* refreshProjects();
|
|
52817
52865
|
return targetDirectory;
|
|
52818
52866
|
}
|
|
52867
|
+
const defaultBranch = yield* getDefaultBranch(input.cwd);
|
|
52868
|
+
yield* annotateCurrentSpan({ source: "new" });
|
|
52819
52869
|
yield* pipe(git.string(input.cwd, [
|
|
52820
52870
|
"worktree",
|
|
52821
52871
|
"add",
|
|
52822
52872
|
"-b",
|
|
52823
52873
|
input.branch,
|
|
52824
52874
|
targetDirectory,
|
|
52825
|
-
|
|
52875
|
+
`origin/${defaultBranch}`
|
|
52826
52876
|
]), asVoid);
|
|
52827
52877
|
yield* refreshProjects();
|
|
52828
52878
|
return targetDirectory;
|
|
52829
52879
|
}),
|
|
52830
|
-
deleteWorktree:
|
|
52831
|
-
|
|
52880
|
+
deleteWorktree: fn("GitWorkspace.deleteWorktree")(function* (input) {
|
|
52881
|
+
yield* annotateCurrentSpan({ cwd: input.cwd });
|
|
52882
|
+
const worktrees = yield* pipe(git.string(input.cwd, [
|
|
52832
52883
|
"worktree",
|
|
52833
52884
|
"list",
|
|
52834
|
-
"--porcelain"
|
|
52835
|
-
|
|
52836
|
-
|
|
52837
|
-
|
|
52838
|
-
|
|
52839
|
-
|
|
52840
|
-
mainRoot: input.cwd
|
|
52841
|
-
}, (state, line) => {
|
|
52842
|
-
if (state.found) return state;
|
|
52843
|
-
if (startsWith("worktree ")(line)) return {
|
|
52844
|
-
branch: state.branch,
|
|
52845
|
-
currentBranch: "",
|
|
52846
|
-
currentRoot: replace(/^worktree\s+/u, "")(line),
|
|
52847
|
-
found: state.found,
|
|
52848
|
-
mainRoot: state.mainRoot === input.cwd ? replace(/^worktree\s+/u, "")(line) : state.mainRoot
|
|
52849
|
-
};
|
|
52850
|
-
if (startsWith("branch refs/heads/")(line)) return {
|
|
52851
|
-
branch: state.currentRoot === input.cwd ? replace(/^branch\s+refs\/heads\//u, "")(line) : state.branch,
|
|
52852
|
-
currentBranch: replace(/^branch\s+refs\/heads\//u, "")(line),
|
|
52853
|
-
currentRoot: state.currentRoot,
|
|
52854
|
-
found: state.currentRoot === input.cwd,
|
|
52855
|
-
mainRoot: state.mainRoot
|
|
52856
|
-
};
|
|
52857
|
-
return state;
|
|
52858
|
-
}), (state) => ({
|
|
52859
|
-
branch: isNonEmpty$1(state.branch) ? state.branch : void 0,
|
|
52860
|
-
mainRoot: state.mainRoot
|
|
52861
|
-
}))));
|
|
52862
|
-
yield* pipe(git.string(worktree.mainRoot, [
|
|
52885
|
+
"--porcelain",
|
|
52886
|
+
"-z"
|
|
52887
|
+
]), map$4(parseWorktreeRecords));
|
|
52888
|
+
const mainRoot = worktrees[0]?.root ?? input.cwd;
|
|
52889
|
+
const branch = pipe(worktrees, findFirst$2((worktree) => worktree.root === input.cwd), getOrUndefined$1)?.branch;
|
|
52890
|
+
yield* pipe(git.string(mainRoot, [
|
|
52863
52891
|
"worktree",
|
|
52864
52892
|
"remove",
|
|
52865
|
-
|
|
52893
|
+
"--force",
|
|
52866
52894
|
input.cwd
|
|
52867
52895
|
]), asVoid);
|
|
52868
|
-
if (isNotUndefined(
|
|
52896
|
+
if (isNotUndefined(branch)) yield* pipe(git.string(mainRoot, [
|
|
52869
52897
|
"branch",
|
|
52870
52898
|
"-D",
|
|
52871
|
-
|
|
52899
|
+
branch
|
|
52872
52900
|
]), ignore$1);
|
|
52873
52901
|
yield* refreshProjects();
|
|
52874
52902
|
}),
|
|
52875
52903
|
listProjectsFrom,
|
|
52876
52904
|
listRepositoriesFrom,
|
|
52877
52905
|
listWorktrees,
|
|
52878
|
-
projects
|
|
52906
|
+
projects,
|
|
52907
|
+
refreshProjects
|
|
52879
52908
|
};
|
|
52880
52909
|
}) }) {
|
|
52881
52910
|
static layer = effect(this, this.make);
|
|
52882
52911
|
};
|
|
52883
|
-
var
|
|
52884
|
-
const
|
|
52885
|
-
const git = yield* makeGitExecutor;
|
|
52912
|
+
var GitMaintenance = class extends Service()("@deslop/git/service/GitMaintenance", { make: gen(function* () {
|
|
52913
|
+
const git = yield* GitCommand;
|
|
52886
52914
|
const fs = yield* FileSystem;
|
|
52887
52915
|
const path = yield* Path$1;
|
|
52888
|
-
const
|
|
52889
|
-
const
|
|
52890
|
-
|
|
52891
|
-
|
|
52892
|
-
|
|
52893
|
-
|
|
52894
|
-
|
|
52895
|
-
|
|
52916
|
+
const home = yield* pipe(string("HOME"), withDefault(process.cwd()));
|
|
52917
|
+
const maintenanceLock = yield* make$47(1);
|
|
52918
|
+
const collectRepositoriesFromRoots = fn("GitMaintenance.collectRepositoriesFromRoots")(function* (roots, repositories) {
|
|
52919
|
+
yield* annotateCurrentSpan({
|
|
52920
|
+
repositoryCount: length(repositories),
|
|
52921
|
+
rootCount: length(roots)
|
|
52922
|
+
});
|
|
52923
|
+
return yield* match$2(roots, {
|
|
52924
|
+
onEmpty: () => succeed$3(repositories),
|
|
52925
|
+
onNonEmpty: (remainingRoots) => {
|
|
52926
|
+
const root = remainingRoots[0];
|
|
52927
|
+
return pipe(fs.readDirectory(root), orElseSucceed(() => empty$13()), flatMap$2((entries) => {
|
|
52928
|
+
if (contains(entries, ".git")) return pipe(all({
|
|
52929
|
+
gitDirectory: pipe(git.string(root, [
|
|
52930
|
+
"rev-parse",
|
|
52931
|
+
"--path-format=absolute",
|
|
52932
|
+
"--git-common-dir"
|
|
52933
|
+
]), map$4(trim)),
|
|
52934
|
+
worktrees: pipe(git.string(root, [
|
|
52935
|
+
"worktree",
|
|
52936
|
+
"list",
|
|
52937
|
+
"--porcelain",
|
|
52938
|
+
"-z"
|
|
52939
|
+
]), map$4(parseWorktreeRecords))
|
|
52940
|
+
}, { concurrency: "unbounded" }), map$4((repository) => new GitRepository({
|
|
52941
|
+
gitDirectory: repository.gitDirectory,
|
|
52942
|
+
root: repository.worktrees[0]?.root ?? root
|
|
52943
|
+
})), option$1, flatMap$2((repository) => collectRepositoriesFromRoots(drop$1(remainingRoots, 1), pipe(repository, match$4({
|
|
52944
|
+
onNone: () => repositories,
|
|
52945
|
+
onSome: (value) => append$1(repositories, value)
|
|
52946
|
+
})))));
|
|
52947
|
+
return pipe(entries, filter$1((entry) => !excludedDiscoveryEntries.has(entry) && !(startsWith(".")(entry) && entry !== ".git")), forEach$1((entry) => pipe(fs.stat(path.join(root, entry)), map$4((info) => info.type === "Directory" ? path.join(root, entry) : ""), orElseSucceed(() => ""))), flatMap$2((nextRoots) => collectRepositoriesFromRoots(pipe(nextRoots, filter$1(isNonEmpty$1), appendAll(drop$1(roots, 1))), repositories)));
|
|
52948
|
+
}));
|
|
52949
|
+
}
|
|
52950
|
+
});
|
|
52951
|
+
});
|
|
52952
|
+
const listRepositoriesFrom = fn("GitMaintenance.listRepositoriesFrom")(function* (cwd) {
|
|
52953
|
+
yield* annotateCurrentSpan({ cwd });
|
|
52954
|
+
return yield* pipe(fs.realPath(cwd), orElseSucceed(() => cwd), flatMap$2((root) => collectRepositoriesFromRoots([root], empty$13())), map$4((repositories) => pipe(repositories, dedupeWith((left, right) => left.gitDirectory === right.gitDirectory || left.root === right.root))));
|
|
52955
|
+
});
|
|
52956
|
+
const maintain = fn("GitMaintenance.maintain")(function* (cwd) {
|
|
52957
|
+
yield* annotateCurrentSpan({ cwd });
|
|
52958
|
+
yield* pipe(gen(function* () {
|
|
52959
|
+
const repositories = yield* listRepositoriesFrom(cwd);
|
|
52960
|
+
yield* annotateCurrentSpan({ repositoryCount: length(repositories) });
|
|
52961
|
+
yield* forEach$1(repositories, (repository) => gen(function* () {
|
|
52962
|
+
yield* pipe(git.string(repository.root, [
|
|
52963
|
+
"fetch",
|
|
52964
|
+
"--all",
|
|
52965
|
+
"--prune"
|
|
52966
|
+
]), asVoid, withSpan("GitMaintenance.fetch", { attributes: { cwd: repository.root } }));
|
|
52967
|
+
const worktrees = parseWorktreeRecords(yield* git.string(repository.root, [
|
|
52968
|
+
"worktree",
|
|
52969
|
+
"list",
|
|
52970
|
+
"--porcelain",
|
|
52971
|
+
"-z"
|
|
52972
|
+
]));
|
|
52973
|
+
yield* forEach$1(yield* git.lines(repository.root, [
|
|
52974
|
+
"for-each-ref",
|
|
52975
|
+
"refs/heads",
|
|
52976
|
+
"--format=%(refname:short)%00%(upstream:short)%00%(upstream:track)%00%(worktreepath)"
|
|
52977
|
+
]), (row) => pipe(gen(function* () {
|
|
52978
|
+
const fields = split$1("\0")(row);
|
|
52979
|
+
const branch = fields[0];
|
|
52980
|
+
const upstream = fields[1] ?? "";
|
|
52981
|
+
const track = fields[2] ?? "";
|
|
52982
|
+
const worktreePath = fields[3] ?? pipe(worktrees, findFirst$2((worktree) => worktree.branch === branch), map$9((worktree) => worktree.root), getOrElse$1(() => ""));
|
|
52983
|
+
yield* annotateCurrentSpan({
|
|
52984
|
+
branch,
|
|
52985
|
+
cwd: repository.root
|
|
52986
|
+
});
|
|
52987
|
+
if (isEmpty$1(branch)) return;
|
|
52988
|
+
if (track === "[gone]") {
|
|
52989
|
+
if (isNonEmpty$1(worktreePath)) yield* pipe(git.string(repository.root, [
|
|
52990
|
+
"worktree",
|
|
52991
|
+
"remove",
|
|
52992
|
+
"--force",
|
|
52993
|
+
worktreePath
|
|
52994
|
+
]), asVoid, withSpan("GitMaintenance.deleteWorktree", { attributes: {
|
|
52995
|
+
branch,
|
|
52996
|
+
cwd: repository.root
|
|
52997
|
+
} }));
|
|
52998
|
+
yield* pipe(git.string(repository.root, [
|
|
52999
|
+
"branch",
|
|
53000
|
+
"-D",
|
|
53001
|
+
branch
|
|
53002
|
+
]), asVoid, withSpan("GitMaintenance.deleteBranch", { attributes: {
|
|
53003
|
+
branch,
|
|
53004
|
+
cwd: repository.root
|
|
53005
|
+
} }));
|
|
53006
|
+
return;
|
|
53007
|
+
}
|
|
53008
|
+
if (isEmpty$1(upstream) || !includes("behind")(track) || includes("ahead")(track)) return;
|
|
53009
|
+
if (isNonEmpty$1(worktreePath)) {
|
|
53010
|
+
yield* pipe(git.string(worktreePath, [
|
|
53011
|
+
"merge",
|
|
53012
|
+
"--ff-only",
|
|
53013
|
+
upstream
|
|
53014
|
+
]), ignore$1, withSpan("GitMaintenance.fastForwardWorktree", { attributes: {
|
|
53015
|
+
branch,
|
|
53016
|
+
cwd: worktreePath
|
|
53017
|
+
} }));
|
|
53018
|
+
return;
|
|
53019
|
+
}
|
|
53020
|
+
yield* pipe(git.string(repository.root, [
|
|
53021
|
+
"merge-base",
|
|
53022
|
+
"--is-ancestor",
|
|
53023
|
+
branch,
|
|
53024
|
+
upstream
|
|
53025
|
+
]), andThen(git.string(repository.root, [
|
|
53026
|
+
"branch",
|
|
53027
|
+
"-f",
|
|
53028
|
+
branch,
|
|
53029
|
+
upstream
|
|
53030
|
+
])), ignore$1, withSpan("GitMaintenance.fastForwardBranch", { attributes: {
|
|
53031
|
+
branch,
|
|
53032
|
+
cwd: repository.root
|
|
53033
|
+
} }));
|
|
53034
|
+
}), withSpan("GitMaintenance.classifyBranch", { attributes: { cwd: repository.root } })), { concurrency: "unbounded" });
|
|
53035
|
+
}), { concurrency: "unbounded" });
|
|
53036
|
+
}), withPermit(maintenanceLock));
|
|
52896
53037
|
});
|
|
53038
|
+
yield* pipe(maintain(home), ignore$1, andThen(sleep(seconds(180))), forever, forkScoped);
|
|
53039
|
+
return { maintain };
|
|
53040
|
+
}) }) {
|
|
53041
|
+
static layer = effect(this, this.make);
|
|
53042
|
+
};
|
|
53043
|
+
var GitReview = class extends Service()("@deslop/git/service/GitReview", { make: fn("GitReview.make")(function* (config) {
|
|
53044
|
+
const spawner = yield* ChildProcessSpawner;
|
|
53045
|
+
const git = yield* GitCommand;
|
|
53046
|
+
const fs = yield* FileSystem;
|
|
53047
|
+
const path = yield* Path$1;
|
|
53048
|
+
const hasWorktreeChanges = pipe(git.lines(config.cwd, ["status", "--porcelain"]), map$4((lines) => !isReadonlyArrayEmpty(lines)));
|
|
52897
53049
|
function diffsFromPatch(patch, segments) {
|
|
52898
53050
|
const groupedSegments = segmentsByFile(segments);
|
|
52899
|
-
return pipe(patch.split(/(?=^diff --git )/mu), filter$1(
|
|
52900
|
-
}
|
|
52901
|
-
function attachSegments(diffs, segments) {
|
|
52902
|
-
const groupedSegments = segmentsByFile(segments);
|
|
52903
|
-
return map$7(diffs, (diff) => new GitDiff({
|
|
52904
|
-
filePath: diff.filePath,
|
|
52905
|
-
patch: diff.patch,
|
|
52906
|
-
segments: getOrElse$1(get$1(groupedSegments, diff.filePath), () => empty$13()),
|
|
52907
|
-
status: diff.status
|
|
52908
|
-
}));
|
|
53051
|
+
return pipe(patch.split(/(?=^diff --git )/mu), filter$1((chunk) => /^diff --git /u.test(chunk)), map$7((chunk) => diffFromPatchChunk(chunk, groupedSegments)));
|
|
52909
53052
|
}
|
|
52910
|
-
const gitDiffs =
|
|
52911
|
-
|
|
53053
|
+
const gitDiffs = fn("GitReview.gitDiffs")(function* (input) {
|
|
53054
|
+
yield* annotateCurrentSpan({
|
|
53055
|
+
cwd: config.cwd,
|
|
53056
|
+
segmentCount: length(input.segments)
|
|
53057
|
+
});
|
|
53058
|
+
const diffs = diffsFromPatch(yield* git.string(config.cwd, [
|
|
52912
53059
|
"diff",
|
|
52913
53060
|
...input.args,
|
|
52914
53061
|
"--ignore-all-space",
|
|
@@ -52916,54 +53063,53 @@ var GitWorktree = class extends Service()("@deslop/git/service/GitWorktree", { m
|
|
|
52916
53063
|
"--ignore-cr-at-eol",
|
|
52917
53064
|
"--patch",
|
|
52918
53065
|
"--find-renames",
|
|
52919
|
-
"-U999999",
|
|
52920
53066
|
"--no-ext-diff"
|
|
52921
53067
|
]), input.segments);
|
|
53068
|
+
yield* annotateCurrentSpan({ diffCount: length(diffs) });
|
|
53069
|
+
return diffs;
|
|
53070
|
+
});
|
|
53071
|
+
const commitDiffs = fn("GitReview.commitDiffs")(function* (hash) {
|
|
53072
|
+
yield* annotateCurrentSpan({ cwd: config.cwd });
|
|
53073
|
+
const diffs = diffsFromPatch(yield* git.string(config.cwd, [
|
|
53074
|
+
"diff-tree",
|
|
53075
|
+
"--root",
|
|
53076
|
+
"--first-parent",
|
|
53077
|
+
"-m",
|
|
53078
|
+
"--patch",
|
|
53079
|
+
"--ignore-all-space",
|
|
53080
|
+
"--ignore-blank-lines",
|
|
53081
|
+
"--ignore-cr-at-eol",
|
|
53082
|
+
"--find-renames",
|
|
53083
|
+
"--no-ext-diff",
|
|
53084
|
+
hash
|
|
53085
|
+
]), empty$13());
|
|
53086
|
+
yield* annotateCurrentSpan({ diffCount: length(diffs) });
|
|
53087
|
+
return diffs;
|
|
52922
53088
|
});
|
|
52923
53089
|
const untrackedDiffs = pipe(git.lines(config.cwd, [
|
|
52924
53090
|
"ls-files",
|
|
52925
53091
|
"--others",
|
|
52926
53092
|
"--exclude-standard"
|
|
52927
|
-
]), flatMap$2((files) => forEach$1(files, (filePath) => pipe(fs.readFileString(path.join(config.cwd, filePath)), orElseSucceed(() => ""), map$4((content) =>
|
|
52928
|
-
filePath,
|
|
52929
|
-
|
|
52930
|
-
segments: [new GitDiffSegment({
|
|
53093
|
+
]), flatMap$2((files) => forEach$1(files, (filePath) => pipe(fs.readFileString(path.join(config.cwd, filePath)), orElseSucceed(() => ""), map$4((content) => {
|
|
53094
|
+
const patch = `diff --git a/${filePath} b/${filePath}\nnew file mode 100644\n--- /dev/null\n+++ b/${filePath}\n@@ -0,0 +1,${length(split$1("\n")(content))} @@\n${pipe(split$1("\n")(content), map$7((line) => `+${line}`), join$2("\n"))}`;
|
|
53095
|
+
return new GitDiff({
|
|
52931
53096
|
filePath,
|
|
52932
|
-
|
|
52933
|
-
|
|
52934
|
-
type: "worktree"
|
|
52935
|
-
})],
|
|
52936
|
-
status: "added"
|
|
52937
|
-
}))), { concurrency: "unbounded" })));
|
|
52938
|
-
const commitSegmentDiffs = fnUntraced(function* (input) {
|
|
52939
|
-
return pipe((yield* git.string(config.cwd, [
|
|
52940
|
-
"log",
|
|
52941
|
-
"--reverse",
|
|
52942
|
-
"--format=%x00DESLOP-COMMIT%x00%H%x00%P",
|
|
52943
|
-
"--find-renames",
|
|
52944
|
-
"--name-only",
|
|
52945
|
-
`${input.from}..${input.to}`
|
|
52946
|
-
])).split("\0DESLOP-COMMIT\0"), filter$1(isNonEmpty$1), flatMap$5((entry) => {
|
|
52947
|
-
const lines = split$1("\n")(entry);
|
|
52948
|
-
const header = lines[0];
|
|
52949
|
-
const parts = split$1("\0")(header);
|
|
52950
|
-
const commit = parts[0];
|
|
52951
|
-
const id = `${pipe(parts[1] ?? "", split$1(" "), filter$1(isNonEmpty$1))[0] ?? `${commit}^`}->${commit}`;
|
|
52952
|
-
return pipe(drop$1(lines, 1), filter$1(isNonEmpty$1), map$7((filePath) => new GitDiffSegment({
|
|
53097
|
+
patch,
|
|
53098
|
+
segments: [new GitDiffSegment({
|
|
52953
53099
|
filePath,
|
|
52954
|
-
fingerprint:
|
|
52955
|
-
id,
|
|
52956
|
-
type: "
|
|
52957
|
-
})
|
|
52958
|
-
|
|
52959
|
-
|
|
52960
|
-
|
|
52961
|
-
|
|
52962
|
-
|
|
52963
|
-
|
|
53100
|
+
fingerprint: patch,
|
|
53101
|
+
id: "HEAD->worktree",
|
|
53102
|
+
type: "worktree"
|
|
53103
|
+
})],
|
|
53104
|
+
status: "added"
|
|
53105
|
+
});
|
|
53106
|
+
})), { concurrency: "unbounded" })));
|
|
53107
|
+
const worktreeDiffs = gen(function* () {
|
|
53108
|
+
if (isReadonlyArrayEmpty(yield* git.lines(config.cwd, ["status", "--porcelain"]))) return empty$13();
|
|
53109
|
+
return yield* pipe(all([gitDiffs({
|
|
52964
53110
|
args: ["HEAD"],
|
|
52965
53111
|
segments: empty$13()
|
|
52966
|
-
}), map$7((diff) => {
|
|
53112
|
+
}), untrackedDiffs], { concurrency: "unbounded" }), map$4(([trackedDiffs, untracked]) => appendAll(map$7(trackedDiffs, (diff) => {
|
|
52967
53113
|
const segment = new GitDiffSegment({
|
|
52968
53114
|
filePath: diff.filePath,
|
|
52969
53115
|
fingerprint: diff.patch,
|
|
@@ -52976,41 +53122,95 @@ var GitWorktree = class extends Service()("@deslop/git/service/GitWorktree", { m
|
|
|
52976
53122
|
segments: [segment],
|
|
52977
53123
|
status: diff.status
|
|
52978
53124
|
});
|
|
52979
|
-
}))))
|
|
52980
|
-
|
|
52981
|
-
|
|
52982
|
-
|
|
52983
|
-
|
|
52984
|
-
|
|
52985
|
-
input.
|
|
52986
|
-
|
|
52987
|
-
|
|
52988
|
-
|
|
52989
|
-
|
|
52990
|
-
|
|
52991
|
-
|
|
52992
|
-
segments: empty$13()
|
|
52993
|
-
})
|
|
52994
|
-
], { concurrency: "unbounded" });
|
|
52995
|
-
const diffsWithSegments = attachSegments(diffs, appendAll(commitSegments, pipe(trackedWorktreeDiffs, map$7((diff) => new GitDiffSegment({
|
|
53125
|
+
}), untracked)));
|
|
53126
|
+
}).pipe(withSpan("GitReview.worktreeDiffs", { attributes: { cwd: config.cwd } }));
|
|
53127
|
+
const fileContent = fn("GitReview.fileContent")(function* (input) {
|
|
53128
|
+
yield* annotateCurrentSpan({
|
|
53129
|
+
cwd: config.cwd,
|
|
53130
|
+
filePath: input.filePath,
|
|
53131
|
+
target: input.target._tag
|
|
53132
|
+
});
|
|
53133
|
+
if (input.target._tag !== "commit") return yield* pipe(fs.readFileString(path.join(config.cwd, input.filePath)), orElseSucceed(() => ""));
|
|
53134
|
+
return yield* pipe(git.string(config.cwd, ["show", `${input.target.hash}:${input.filePath}`]), orElseSucceed(() => ""));
|
|
53135
|
+
});
|
|
53136
|
+
const withFileContent = fn("GitReview.withFileContent")(function* (input) {
|
|
53137
|
+
const contents = yield* forEach$1(input.diffs, (diff) => pipe(fileContent({
|
|
52996
53138
|
filePath: diff.filePath,
|
|
52997
|
-
|
|
52998
|
-
|
|
52999
|
-
|
|
53000
|
-
|
|
53001
|
-
|
|
53002
|
-
|
|
53139
|
+
target: input.target
|
|
53140
|
+
}), map$4((content) => [diff.filePath, content])), { concurrency: "unbounded" });
|
|
53141
|
+
const contentByFilePath = new Map(contents);
|
|
53142
|
+
return map$7(input.diffs, (diff) => contentByFilePath.has(diff.filePath) ? new GitDiff({
|
|
53143
|
+
fileContent: contentByFilePath.get(diff.filePath),
|
|
53144
|
+
filePath: diff.filePath,
|
|
53145
|
+
patch: diff.patch,
|
|
53146
|
+
segments: diff.segments,
|
|
53147
|
+
status: diff.status
|
|
53148
|
+
}) : diff);
|
|
53149
|
+
});
|
|
53150
|
+
const reviewDiffs = fn("GitReview.reviewDiffs")(function* (target) {
|
|
53151
|
+
yield* annotateCurrentSpan({
|
|
53152
|
+
cwd: config.cwd,
|
|
53153
|
+
target: target._tag
|
|
53154
|
+
});
|
|
53155
|
+
if (target._tag === "changes") return yield* withFileContent({
|
|
53156
|
+
diffs: yield* worktreeDiffs,
|
|
53157
|
+
target
|
|
53158
|
+
});
|
|
53159
|
+
if (target._tag === "commit") {
|
|
53160
|
+
const id = `${target.hash}^->${target.hash}`;
|
|
53161
|
+
const diffsWithSegments = withDisplayedPatchSegments(yield* commitDiffs(target.hash), id, "commit");
|
|
53162
|
+
yield* annotateCurrentSpan({ diffCount: length(diffsWithSegments) });
|
|
53163
|
+
return yield* withFileContent({
|
|
53164
|
+
diffs: diffsWithSegments,
|
|
53165
|
+
target
|
|
53166
|
+
});
|
|
53167
|
+
}
|
|
53168
|
+
const base = target._tag === "local" ? yield* localBase() : yield* branchDiffBase();
|
|
53169
|
+
const diffsWithSegments = withDisplayedPatchSegments(yield* aggregateDiffs(base), `${base}->worktree`, "worktree");
|
|
53170
|
+
yield* annotateCurrentSpan({ diffCount: length(diffsWithSegments) });
|
|
53171
|
+
return yield* withFileContent({
|
|
53172
|
+
diffs: diffsWithSegments,
|
|
53173
|
+
target
|
|
53174
|
+
});
|
|
53003
53175
|
});
|
|
53004
|
-
const ghString =
|
|
53005
|
-
|
|
53176
|
+
const ghString = fn("gh.string")(function* (args) {
|
|
53177
|
+
yield* annotateCurrentSpan({
|
|
53178
|
+
command: args[0] ?? "gh",
|
|
53179
|
+
cwd: config.cwd
|
|
53180
|
+
});
|
|
53181
|
+
return yield* scoped$3(gen(function* () {
|
|
53182
|
+
const handle = yield* pipe(spawner.spawn(make$40("gh", args, {
|
|
53183
|
+
cwd: config.cwd,
|
|
53184
|
+
stderr: "pipe",
|
|
53185
|
+
stdout: "pipe"
|
|
53186
|
+
})), mapError$2((cause) => new GitError({ cause })));
|
|
53187
|
+
const output = yield* all({
|
|
53188
|
+
stderr: pipe(decodeText(handle.stderr), mkString, orElseSucceed(() => "")),
|
|
53189
|
+
stdout: pipe(decodeText(handle.stdout), mkString, orElseSucceed(() => ""))
|
|
53190
|
+
}, { concurrency: "unbounded" });
|
|
53191
|
+
const exitCode = yield* pipe(handle.exitCode, mapError$2((cause) => new GitError({ cause })));
|
|
53192
|
+
if (exitCode !== ExitCode(0)) return yield* new GitError({ cause: new Error(output.stderr || output.stdout || `gh ${join$2(" ")(args)} exited with ${exitCode}`) });
|
|
53193
|
+
return output.stdout;
|
|
53194
|
+
})).pipe(withSpan("gh.command", { attributes: {
|
|
53195
|
+
command: args[0] ?? "gh",
|
|
53196
|
+
cwd: config.cwd
|
|
53197
|
+
} }));
|
|
53006
53198
|
});
|
|
53007
53199
|
const currentBranch = pipe(git.string(config.cwd, ["branch", "--show-current"]), map$4(trim));
|
|
53008
53200
|
const defaultBranchName = pipe(git.string(config.cwd, [
|
|
53009
53201
|
"symbolic-ref",
|
|
53010
53202
|
"--short",
|
|
53011
53203
|
"refs/remotes/origin/HEAD"
|
|
53012
|
-
]), map$4(flow(trim, replace(/^origin\//u, ""))))
|
|
53013
|
-
|
|
53204
|
+
]), map$4(flow(trim, replace(/^origin\//u, ""))), catchTag("GitError", () => pipe(git.string(config.cwd, [
|
|
53205
|
+
"rev-parse",
|
|
53206
|
+
"--verify",
|
|
53207
|
+
"main"
|
|
53208
|
+
]), as("main"), catchTag("GitError", () => succeed$3("master")))));
|
|
53209
|
+
const branchBase = fn("GitReview.branchBase")(function* (defaultBranch) {
|
|
53210
|
+
yield* annotateCurrentSpan({
|
|
53211
|
+
cwd: config.cwd,
|
|
53212
|
+
defaultBranch
|
|
53213
|
+
});
|
|
53014
53214
|
return yield* pipe([`origin/${defaultBranch}`, defaultBranch], findFirst((candidate) => pipe(git.string(config.cwd, [
|
|
53015
53215
|
"rev-parse",
|
|
53016
53216
|
"--verify",
|
|
@@ -53024,19 +53224,9 @@ var GitWorktree = class extends Service()("@deslop/git/service/GitWorktree", { m
|
|
|
53024
53224
|
"url",
|
|
53025
53225
|
"--jq",
|
|
53026
53226
|
".url"
|
|
53027
|
-
]), map$4(trim), map$4((url) => isNonEmpty$1(url) ? some
|
|
53028
|
-
function
|
|
53029
|
-
|
|
53030
|
-
const subject = parts[2] ?? "";
|
|
53031
|
-
return new GitCommit({
|
|
53032
|
-
hash: parts[0],
|
|
53033
|
-
parents: pipe(parts[3] ?? "", split$1(" "), filter$1(isNonEmpty$1)),
|
|
53034
|
-
shortHash: parts[1] ?? "",
|
|
53035
|
-
subject,
|
|
53036
|
-
wip: isWipSubject(subject)
|
|
53037
|
-
});
|
|
53038
|
-
}
|
|
53039
|
-
const commits = fnUntraced(function* (base) {
|
|
53227
|
+
]), map$4(trim), map$4((url) => isNonEmpty$1(url) ? some(url) : none()), catchTag("GitError", () => succeed$3(none())));
|
|
53228
|
+
const commits = fn("GitReview.commits")(function* (base) {
|
|
53229
|
+
yield* annotateCurrentSpan({ cwd: config.cwd });
|
|
53040
53230
|
const from = yield* pipe(git.string(config.cwd, [
|
|
53041
53231
|
"merge-base",
|
|
53042
53232
|
base,
|
|
@@ -53045,59 +53235,82 @@ var GitWorktree = class extends Service()("@deslop/git/service/GitWorktree", { m
|
|
|
53045
53235
|
return yield* pipe(git.lines(config.cwd, [
|
|
53046
53236
|
"log",
|
|
53047
53237
|
"--max-count=80",
|
|
53048
|
-
"--format=%H%x00%h%x00%s
|
|
53238
|
+
"--format=%H%x00%h%x00%s",
|
|
53049
53239
|
`${from}..HEAD`
|
|
53050
53240
|
]), map$4(map$7(commitFromLogLine)));
|
|
53051
53241
|
});
|
|
53242
|
+
const commitsBetween = fn("GitReview.commitsBetween")(function* (from, to) {
|
|
53243
|
+
yield* annotateCurrentSpan({ cwd: config.cwd });
|
|
53244
|
+
return yield* pipe(git.lines(config.cwd, [
|
|
53245
|
+
"log",
|
|
53246
|
+
"--max-count=80",
|
|
53247
|
+
"--format=%H%x00%h%x00%s",
|
|
53248
|
+
`${from}..${to}`
|
|
53249
|
+
]), map$4(map$7(commitFromLogLine)));
|
|
53250
|
+
});
|
|
53052
53251
|
const firstParentCommits = pipe(git.lines(config.cwd, [
|
|
53053
53252
|
"log",
|
|
53054
53253
|
"--first-parent",
|
|
53055
53254
|
"--max-count=80",
|
|
53056
|
-
"--format=%H%x00%h%x00%s
|
|
53255
|
+
"--format=%H%x00%h%x00%s",
|
|
53057
53256
|
"HEAD"
|
|
53058
53257
|
]), map$4(map$7(commitFromLogLine)));
|
|
53059
|
-
const
|
|
53060
|
-
|
|
53061
|
-
yield* pipe(git.string(config.cwd, [
|
|
53062
|
-
"push",
|
|
53063
|
-
"-u",
|
|
53064
|
-
"origin",
|
|
53065
|
-
`HEAD:${branch}`
|
|
53066
|
-
]), asVoid);
|
|
53067
|
-
});
|
|
53068
|
-
const hasPushableCommits = pipe(gen(function* () {
|
|
53069
|
-
const remoteBranch = `origin/${yield* currentBranch}`;
|
|
53070
|
-
if (yield* pipe(git.string(config.cwd, [
|
|
53258
|
+
const hasPushableCommits = pipe(fn("GitReview.pushableCommitCount")(function* () {
|
|
53259
|
+
yield* annotateCurrentSpan({ cwd: config.cwd });
|
|
53260
|
+
const upstream = yield* pipe(git.string(config.cwd, [
|
|
53071
53261
|
"rev-parse",
|
|
53072
|
-
"--
|
|
53073
|
-
|
|
53074
|
-
|
|
53075
|
-
|
|
53076
|
-
|
|
53077
|
-
|
|
53078
|
-
|
|
53262
|
+
"--abbrev-ref",
|
|
53263
|
+
"--symbolic-full-name",
|
|
53264
|
+
"@{u}"
|
|
53265
|
+
]), map$4(flow(trim, some)), orElseSucceed(() => none()));
|
|
53266
|
+
if (isSome(upstream)) return yield* pipe(git.string(config.cwd, [
|
|
53267
|
+
"rev-list",
|
|
53268
|
+
"--count",
|
|
53269
|
+
`${upstream.value}..HEAD`
|
|
53270
|
+
]), map$4(flow(trim, parse$2, getOrElse$1(() => 0))));
|
|
53079
53271
|
const base = yield* branchBase(yield* defaultBranchName);
|
|
53080
53272
|
const from = yield* pipe(git.string(config.cwd, [
|
|
53081
53273
|
"merge-base",
|
|
53082
53274
|
base,
|
|
53083
53275
|
"HEAD"
|
|
53084
53276
|
]), map$4(trim), catchTag("GitError", () => succeed$3(base)));
|
|
53085
|
-
return yield* git.
|
|
53086
|
-
"
|
|
53087
|
-
"--
|
|
53277
|
+
return yield* pipe(git.string(config.cwd, [
|
|
53278
|
+
"rev-list",
|
|
53279
|
+
"--count",
|
|
53088
53280
|
`${from}..HEAD`
|
|
53089
|
-
]);
|
|
53090
|
-
}), map$4((
|
|
53091
|
-
const
|
|
53092
|
-
|
|
53093
|
-
|
|
53094
|
-
|
|
53095
|
-
|
|
53096
|
-
|
|
53097
|
-
|
|
53098
|
-
|
|
53099
|
-
|
|
53281
|
+
]), map$4(flow(trim, parse$2, getOrElse$1(() => 0))));
|
|
53282
|
+
})(), map$4((count) => count > 0));
|
|
53283
|
+
const localBase = fn("GitReview.localBase")(function* () {
|
|
53284
|
+
const upstream = yield* pipe(git.string(config.cwd, [
|
|
53285
|
+
"rev-parse",
|
|
53286
|
+
"--abbrev-ref",
|
|
53287
|
+
"--symbolic-full-name",
|
|
53288
|
+
"@{u}"
|
|
53289
|
+
]), map$4(flow(trim, some)), orElseSucceed(() => none()));
|
|
53290
|
+
if (isSome(upstream)) return upstream.value;
|
|
53291
|
+
const base = yield* branchBase(yield* defaultBranchName);
|
|
53292
|
+
return yield* pipe(git.string(config.cwd, [
|
|
53293
|
+
"merge-base",
|
|
53294
|
+
base,
|
|
53295
|
+
"HEAD"
|
|
53296
|
+
]), map$4(trim), catchTag("GitError", () => succeed$3(base)));
|
|
53297
|
+
});
|
|
53298
|
+
const branchDiffBase = fn("GitReview.branchDiffBase")(function* () {
|
|
53299
|
+
const base = yield* branchBase(yield* defaultBranchName);
|
|
53300
|
+
return yield* pipe(git.string(config.cwd, [
|
|
53301
|
+
"merge-base",
|
|
53302
|
+
base,
|
|
53303
|
+
"HEAD"
|
|
53304
|
+
]), map$4(trim), catchTag("GitError", () => succeed$3(base)));
|
|
53305
|
+
});
|
|
53306
|
+
const aggregateDiffs = fn("GitReview.aggregateDiffs")(function* (base) {
|
|
53307
|
+
return appendAll(yield* gitDiffs({
|
|
53308
|
+
args: [base],
|
|
53309
|
+
segments: empty$13()
|
|
53310
|
+
}), yield* untrackedDiffs);
|
|
53311
|
+
});
|
|
53100
53312
|
const prReviewThreads = gen(function* () {
|
|
53313
|
+
yield* annotateCurrentSpan({ cwd: config.cwd });
|
|
53101
53314
|
const pr = yield* pipe(ghString([
|
|
53102
53315
|
"pr",
|
|
53103
53316
|
"view",
|
|
@@ -53105,7 +53318,7 @@ var GitWorktree = class extends Service()("@deslop/git/service/GitWorktree", { m
|
|
|
53105
53318
|
"number",
|
|
53106
53319
|
"--jq",
|
|
53107
53320
|
".number"
|
|
53108
|
-
]), map$4(flow(trim, parse$2)), flatMap$2(match$
|
|
53321
|
+
]), map$4(flow(trim, parse$2)), flatMap$2(match$4({
|
|
53109
53322
|
onNone: () => new GitError({ message: "No PR found." }),
|
|
53110
53323
|
onSome: succeed$3
|
|
53111
53324
|
})));
|
|
@@ -53152,10 +53365,12 @@ var GitWorktree = class extends Service()("@deslop/git/service/GitWorktree", { m
|
|
|
53152
53365
|
"-F",
|
|
53153
53366
|
`number=${pr}`
|
|
53154
53367
|
]);
|
|
53155
|
-
|
|
53368
|
+
const threads = (yield* pipe(decodeUnknownEffect(fromJsonString(GitHubReviewThreadsResponse))(response), mapError$2((cause) => new GitError({
|
|
53156
53369
|
cause,
|
|
53157
53370
|
message: "Failed to parse GitHub review threads."
|
|
53158
|
-
})))).data?.repository?.pullRequest?.reviewThreads?.nodes ?? []
|
|
53371
|
+
})))).data?.repository?.pullRequest?.reviewThreads?.nodes ?? [];
|
|
53372
|
+
yield* annotateCurrentSpan({ threadCount: length(threads) });
|
|
53373
|
+
return pipe(threads, flatMap$5((thread) => pipe(thread.comments.nodes, map$7((comment) => new GitHubReviewThread({
|
|
53159
53374
|
body: comment.body,
|
|
53160
53375
|
filePath: comment.path,
|
|
53161
53376
|
id: thread.id,
|
|
@@ -53164,75 +53379,31 @@ var GitWorktree = class extends Service()("@deslop/git/service/GitWorktree", { m
|
|
|
53164
53379
|
side: thread.diffSide === "LEFT" ? "deletions" : "additions",
|
|
53165
53380
|
url: comment.url
|
|
53166
53381
|
})))));
|
|
53167
|
-
});
|
|
53382
|
+
}).pipe(withSpan("GitReview.reviewThreads", { attributes: { cwd: config.cwd } }));
|
|
53168
53383
|
const worktreeChanges = pipe(make$43(void 0), merge$1(pipe(fs.watch(config.cwd), catch_(() => empty$8), map$2(() => void 0))), debounce(millis(50)));
|
|
53169
53384
|
return {
|
|
53170
|
-
commitAndPush: fnUntraced(function* (input) {
|
|
53171
|
-
const oldestWip = pipe(yield* commits(input.base), takeWhile((commit) => commit.wip), last, getOrUndefined$1);
|
|
53172
|
-
const dirty = yield* hasWorktreeChanges;
|
|
53173
|
-
if (oldestWip) yield* pipe(git.string(config.cwd, [
|
|
53174
|
-
"reset",
|
|
53175
|
-
"--soft",
|
|
53176
|
-
`${oldestWip.hash}^`
|
|
53177
|
-
]), asVoid);
|
|
53178
|
-
else if (!dirty) return yield* new GitError({ message: "No changes to commit." });
|
|
53179
|
-
yield* pipe(git.string(config.cwd, ["add", "-A"]), asVoid);
|
|
53180
|
-
yield* pipe(git.string(config.cwd, [
|
|
53181
|
-
"commit",
|
|
53182
|
-
"-m",
|
|
53183
|
-
input.message
|
|
53184
|
-
]), asVoid);
|
|
53185
|
-
yield* pushCurrentBranch;
|
|
53186
|
-
if (yield* hasPushableCommits) return yield* new GitError({ message: "Push completed but the branch still has unpushed commits." });
|
|
53187
|
-
if ((yield* currentBranch) !== (yield* defaultBranchName) && isNone(yield* branchPrUrl)) yield* createDraftPr;
|
|
53188
|
-
}),
|
|
53189
53385
|
commits,
|
|
53190
|
-
|
|
53191
|
-
|
|
53192
|
-
yield* pipe(git.string(config.cwd, ["add", "-A"]), asVoid);
|
|
53193
|
-
const subject = pipe(message, trim, (value) => isEmpty$1(value) ? "wip" : `wip: ${value}`);
|
|
53194
|
-
yield* pipe(git.string(config.cwd, [
|
|
53195
|
-
"commit",
|
|
53196
|
-
"-m",
|
|
53197
|
-
subject
|
|
53198
|
-
]), asVoid);
|
|
53199
|
-
}),
|
|
53200
|
-
discardFile: fnUntraced(function* (filePath) {
|
|
53201
|
-
yield* pipe(git.string(config.cwd, [
|
|
53202
|
-
"reset",
|
|
53203
|
-
"HEAD",
|
|
53204
|
-
"--",
|
|
53205
|
-
filePath
|
|
53206
|
-
]), ignore$1);
|
|
53207
|
-
yield* pipe(git.string(config.cwd, [
|
|
53208
|
-
"restore",
|
|
53209
|
-
"--worktree",
|
|
53210
|
-
"--source=HEAD",
|
|
53211
|
-
"--",
|
|
53212
|
-
filePath
|
|
53213
|
-
]), ignore$1);
|
|
53214
|
-
yield* pipe(git.string(config.cwd, [
|
|
53215
|
-
"clean",
|
|
53216
|
-
"-fd",
|
|
53217
|
-
"--",
|
|
53218
|
-
filePath
|
|
53219
|
-
]), asVoid);
|
|
53220
|
-
}),
|
|
53221
|
-
metadata: fnUntraced(function* (input) {
|
|
53386
|
+
metadata: fn("GitReview.metadata")(function* () {
|
|
53387
|
+
yield* annotateCurrentSpan({ cwd: config.cwd });
|
|
53222
53388
|
const branch = yield* currentBranch;
|
|
53223
53389
|
const defaultBranch = yield* defaultBranchName;
|
|
53224
|
-
const
|
|
53390
|
+
const branchBaseRef = yield* branchDiffBase();
|
|
53391
|
+
const localCommits = yield* commitsBetween(yield* localBase(), "HEAD");
|
|
53392
|
+
const branchCommitCandidates = branch === defaultBranch ? yield* firstParentCommits : yield* commits(branchBaseRef);
|
|
53393
|
+
const localCommitHashes = new Set(map$7(localCommits, (commit) => commit.hash));
|
|
53225
53394
|
return new GitReviewMetadata({
|
|
53226
|
-
|
|
53227
|
-
branch,
|
|
53228
|
-
commits: branch === defaultBranch ? yield* firstParentCommits : yield* commits(base),
|
|
53229
|
-
defaultBranch,
|
|
53395
|
+
branchCommits: filter$1(branchCommitCandidates, (commit) => !localCommitHashes.has(commit.hash)),
|
|
53230
53396
|
dirty: yield* hasWorktreeChanges,
|
|
53397
|
+
localCommits,
|
|
53231
53398
|
prUrl: getOrUndefined$1(yield* branchPrUrl),
|
|
53232
53399
|
unpushedCommits: yield* hasPushableCommits
|
|
53233
53400
|
});
|
|
53234
53401
|
}),
|
|
53235
|
-
resolveReviewThread:
|
|
53402
|
+
resolveReviewThread: fn("GitReview.resolveReviewThread")(function* (threadId) {
|
|
53403
|
+
yield* annotateCurrentSpan({
|
|
53404
|
+
cwd: config.cwd,
|
|
53405
|
+
threadId
|
|
53406
|
+
});
|
|
53236
53407
|
yield* pipe(ghString([
|
|
53237
53408
|
"api",
|
|
53238
53409
|
"graphql",
|
|
@@ -53249,24 +53420,141 @@ var GitWorktree = class extends Service()("@deslop/git/service/GitWorktree", { m
|
|
|
53249
53420
|
`threadId=${threadId}`
|
|
53250
53421
|
]), asVoid);
|
|
53251
53422
|
}),
|
|
53252
|
-
|
|
53423
|
+
reviewDiffs,
|
|
53253
53424
|
reviewThreads: pipe(prReviewThreads, catchTag("GitError", () => succeed$3(empty$13()))),
|
|
53254
|
-
|
|
53425
|
+
watchReviewDiffs: (target) => {
|
|
53426
|
+
const diffs = pipe(reviewDiffs(target), catchTag("GitError", () => succeed$3(empty$13())));
|
|
53427
|
+
if (target._tag === "commit") return fromEffect(diffs);
|
|
53428
|
+
return fromEffect(diffs).pipe(concat(pipe(worktreeChanges, mapEffect(() => diffs))), changesWith((left, right) => length(left) === length(right) && every(left, (leftDiff, index) => isNotUndefined(right[index]) && leftDiff.filePath === right[index].filePath && leftDiff.status === right[index].status && leftDiff.patch === right[index].patch)));
|
|
53429
|
+
}
|
|
53430
|
+
};
|
|
53431
|
+
}) }) {
|
|
53432
|
+
static layer = flow(this.make, effect(this));
|
|
53433
|
+
};
|
|
53434
|
+
var GitCommitAction = class extends Service()("@deslop/git/service/GitCommitAction", { make: fn("GitCommitAction.make")(function* (config) {
|
|
53435
|
+
const spawner = yield* ChildProcessSpawner;
|
|
53436
|
+
const git = yield* GitCommand;
|
|
53437
|
+
const ghString = fn("gh.string")(function* (args) {
|
|
53438
|
+
yield* annotateCurrentSpan({
|
|
53439
|
+
command: args[0] ?? "gh",
|
|
53440
|
+
cwd: config.cwd
|
|
53441
|
+
});
|
|
53442
|
+
return yield* scoped$3(gen(function* () {
|
|
53443
|
+
const handle = yield* pipe(spawner.spawn(make$40("gh", args, {
|
|
53444
|
+
cwd: config.cwd,
|
|
53445
|
+
stderr: "pipe",
|
|
53446
|
+
stdout: "pipe"
|
|
53447
|
+
})), mapError$2((cause) => new GitError({ cause })));
|
|
53448
|
+
const output = yield* all({
|
|
53449
|
+
stderr: pipe(decodeText(handle.stderr), mkString, orElseSucceed(() => "")),
|
|
53450
|
+
stdout: pipe(decodeText(handle.stdout), mkString, orElseSucceed(() => ""))
|
|
53451
|
+
}, { concurrency: "unbounded" });
|
|
53452
|
+
const exitCode = yield* pipe(handle.exitCode, mapError$2((cause) => new GitError({ cause })));
|
|
53453
|
+
if (exitCode !== ExitCode(0)) return yield* new GitError({ cause: new Error(output.stderr || output.stdout || `gh ${join$2(" ")(args)} exited with ${exitCode}`) });
|
|
53454
|
+
return output.stdout;
|
|
53455
|
+
})).pipe(withSpan("gh.command", { attributes: {
|
|
53456
|
+
command: args[0] ?? "gh",
|
|
53457
|
+
cwd: config.cwd
|
|
53458
|
+
} }));
|
|
53459
|
+
});
|
|
53460
|
+
const hasWorktreeChanges = pipe(git.lines(config.cwd, ["status", "--porcelain"]), map$4((lines) => !isReadonlyArrayEmpty(lines)));
|
|
53461
|
+
const currentBranch = pipe(git.string(config.cwd, ["branch", "--show-current"]), map$4(trim));
|
|
53462
|
+
const defaultBranchName = pipe(git.string(config.cwd, [
|
|
53463
|
+
"symbolic-ref",
|
|
53464
|
+
"--short",
|
|
53465
|
+
"refs/remotes/origin/HEAD"
|
|
53466
|
+
]), map$4(flow(trim, replace(/^origin\//u, ""))), catchTag("GitError", () => pipe(git.string(config.cwd, [
|
|
53467
|
+
"rev-parse",
|
|
53468
|
+
"--verify",
|
|
53469
|
+
"main"
|
|
53470
|
+
]), as("main"), catchTag("GitError", () => succeed$3("master")))));
|
|
53471
|
+
const branchBase = fn("GitCommitAction.branchBase")(function* (defaultBranch) {
|
|
53472
|
+
yield* annotateCurrentSpan({
|
|
53473
|
+
cwd: config.cwd,
|
|
53474
|
+
defaultBranch
|
|
53475
|
+
});
|
|
53476
|
+
return yield* pipe([`origin/${defaultBranch}`, defaultBranch], findFirst((candidate) => pipe(git.string(config.cwd, [
|
|
53477
|
+
"rev-parse",
|
|
53478
|
+
"--verify",
|
|
53479
|
+
candidate
|
|
53480
|
+
]), as(true), orElseSucceed(() => false))), map$4(getOrElse$1(() => "HEAD")));
|
|
53481
|
+
});
|
|
53482
|
+
const branchPrUrl = pipe(ghString([
|
|
53483
|
+
"pr",
|
|
53484
|
+
"view",
|
|
53485
|
+
"--json",
|
|
53486
|
+
"url",
|
|
53487
|
+
"--jq",
|
|
53488
|
+
".url"
|
|
53489
|
+
]), map$4(trim), map$4((url) => isNonEmpty$1(url) ? some(url) : none()), catchTag("GitError", () => succeed$3(none())));
|
|
53490
|
+
const hasPushableCommits = pipe(fn("GitCommitAction.pushableCommitCount")(function* () {
|
|
53491
|
+
yield* annotateCurrentSpan({ cwd: config.cwd });
|
|
53492
|
+
const upstream = yield* pipe(git.string(config.cwd, [
|
|
53493
|
+
"rev-parse",
|
|
53494
|
+
"--abbrev-ref",
|
|
53495
|
+
"--symbolic-full-name",
|
|
53496
|
+
"@{u}"
|
|
53497
|
+
]), map$4(flow(trim, some)), orElseSucceed(() => none()));
|
|
53498
|
+
if (isSome(upstream)) return yield* pipe(git.string(config.cwd, [
|
|
53499
|
+
"rev-list",
|
|
53500
|
+
"--count",
|
|
53501
|
+
`${upstream.value}..HEAD`
|
|
53502
|
+
]), map$4(flow(trim, parse$2, getOrElse$1(() => 0))));
|
|
53503
|
+
const base = yield* branchBase(yield* defaultBranchName);
|
|
53504
|
+
const from = yield* pipe(git.string(config.cwd, [
|
|
53505
|
+
"merge-base",
|
|
53506
|
+
base,
|
|
53507
|
+
"HEAD"
|
|
53508
|
+
]), map$4(trim), catchTag("GitError", () => succeed$3(base)));
|
|
53509
|
+
return yield* pipe(git.string(config.cwd, [
|
|
53510
|
+
"rev-list",
|
|
53511
|
+
"--count",
|
|
53512
|
+
`${from}..HEAD`
|
|
53513
|
+
]), map$4(flow(trim, parse$2, getOrElse$1(() => 0))));
|
|
53514
|
+
})(), map$4((count) => count > 0));
|
|
53515
|
+
const createDraftPr = pipe(ghString([
|
|
53516
|
+
"pr",
|
|
53517
|
+
"create",
|
|
53518
|
+
"--draft",
|
|
53519
|
+
"--fill"
|
|
53520
|
+
]), map$4((output) => {
|
|
53521
|
+
const url = output.match(/https?:\/\/\S+/u)?.[0] ?? trim(output);
|
|
53522
|
+
return isNonEmpty$1(url) ? some(url) : none();
|
|
53523
|
+
}));
|
|
53524
|
+
return {
|
|
53525
|
+
commit: fn("GitCommitAction.commit")(function* (message) {
|
|
53526
|
+
yield* annotateCurrentSpan({ cwd: config.cwd });
|
|
53527
|
+
const dirty = yield* hasWorktreeChanges;
|
|
53528
|
+
yield* annotateCurrentSpan({ dirty });
|
|
53529
|
+
if (!dirty) return yield* new GitError({ message: "No changes to commit." });
|
|
53530
|
+
if (isEmpty$1(trim(message))) return yield* new GitError({ message: "Commit message required." });
|
|
53531
|
+
yield* pipe(git.string(config.cwd, ["add", "-A"]), asVoid, withSpan("GitCommitAction.stageAll"));
|
|
53255
53532
|
yield* pipe(git.string(config.cwd, [
|
|
53256
|
-
"
|
|
53257
|
-
"
|
|
53258
|
-
|
|
53259
|
-
]), asVoid);
|
|
53533
|
+
"commit",
|
|
53534
|
+
"-m",
|
|
53535
|
+
message
|
|
53536
|
+
]), asVoid, withSpan("GitCommitAction.create"));
|
|
53260
53537
|
}),
|
|
53261
|
-
|
|
53538
|
+
push: fn("GitCommitAction.push")(function* () {
|
|
53539
|
+
yield* annotateCurrentSpan({ cwd: config.cwd });
|
|
53540
|
+
if (!(yield* hasPushableCommits)) return yield* new GitError({ message: "No unpushed commits." });
|
|
53541
|
+
const branch = yield* currentBranch;
|
|
53542
|
+
yield* annotateCurrentSpan({ branch });
|
|
53262
53543
|
yield* pipe(git.string(config.cwd, [
|
|
53263
|
-
"
|
|
53264
|
-
"
|
|
53265
|
-
"
|
|
53266
|
-
|
|
53267
|
-
]), asVoid
|
|
53268
|
-
|
|
53269
|
-
|
|
53544
|
+
"push",
|
|
53545
|
+
"-u",
|
|
53546
|
+
"origin",
|
|
53547
|
+
`HEAD:${branch}`
|
|
53548
|
+
]), asVoid, withSpan("GitCommitAction.push", { attributes: {
|
|
53549
|
+
branch,
|
|
53550
|
+
cwd: config.cwd
|
|
53551
|
+
} }));
|
|
53552
|
+
if (yield* hasPushableCommits) return yield* new GitError({ message: "Push completed but the branch still has unpushed commits." });
|
|
53553
|
+
if (branch !== (yield* defaultBranchName) && isNone(yield* branchPrUrl)) yield* pipe(createDraftPr, withSpan("GitCommitAction.createDraftPr", { attributes: {
|
|
53554
|
+
branch,
|
|
53555
|
+
cwd: config.cwd
|
|
53556
|
+
} }));
|
|
53557
|
+
})
|
|
53270
53558
|
};
|
|
53271
53559
|
}) }) {
|
|
53272
53560
|
static layer = flow(this.make, effect(this));
|
|
@@ -53887,7 +54175,7 @@ var Terminal = class extends Service()("@deslop/terminal/service/Terminal", { ma
|
|
|
53887
54175
|
}
|
|
53888
54176
|
});
|
|
53889
54177
|
});
|
|
53890
|
-
yield* pipe(fromQueue(resizeQueue), groupedWithin(32, millis(16)), runForEach((items) => pipe(last(fromIterable$2(items)), match$
|
|
54178
|
+
yield* pipe(fromQueue(resizeQueue), groupedWithin(32, millis(16)), runForEach((items) => pipe(last(fromIterable$2(items)), match$4({
|
|
53891
54179
|
onNone: () => void_$1,
|
|
53892
54180
|
onSome: resizeProcess
|
|
53893
54181
|
}))), forkScoped);
|
|
@@ -53960,7 +54248,7 @@ const TerminalSessionKey = Struct({
|
|
|
53960
54248
|
env: optional(Record(String$1, String$1)),
|
|
53961
54249
|
sessionId: optional(String$1)
|
|
53962
54250
|
});
|
|
53963
|
-
const emptyReviewState = new
|
|
54251
|
+
const emptyReviewState = new GitReviewState({
|
|
53964
54252
|
comments: empty$13(),
|
|
53965
54253
|
marks: empty$13()
|
|
53966
54254
|
});
|
|
@@ -53985,32 +54273,31 @@ function terminalSessionInput(session) {
|
|
|
53985
54273
|
sessionId: session.sessionId
|
|
53986
54274
|
};
|
|
53987
54275
|
}
|
|
53988
|
-
function commentKey(input) {
|
|
53989
|
-
return `${input.filePath}:${input.side ?? "additions"}:${input.lineNumber}`;
|
|
53990
|
-
}
|
|
53991
|
-
function markKey(input) {
|
|
53992
|
-
return `${input.filePath}:${input.segmentId}:${input.fingerprint}`;
|
|
53993
|
-
}
|
|
53994
54276
|
const TerminalSessions = make$46({
|
|
53995
54277
|
idleTimeToLive: infinity,
|
|
53996
54278
|
lookup: fnUntraced(function* (config) {
|
|
53997
54279
|
return get$9(yield* buildWithScope(Terminal.layer(config), yield* scope), Terminal);
|
|
53998
54280
|
})
|
|
53999
54281
|
});
|
|
54000
|
-
const
|
|
54282
|
+
const GitReviewSessions = make$46({
|
|
54283
|
+
idleTimeToLive: zero$1,
|
|
54284
|
+
lookup: fnUntraced(function* (cwd) {
|
|
54285
|
+
return get$9(yield* buildWithScope(pipe(GitReview.layer({ cwd }), provide$2(GitCommand.layer)), yield* scope), GitReview);
|
|
54286
|
+
})
|
|
54287
|
+
});
|
|
54288
|
+
const GitCommitSessions = make$46({
|
|
54001
54289
|
idleTimeToLive: minutes(5),
|
|
54002
54290
|
lookup: fnUntraced(function* (cwd) {
|
|
54003
|
-
return get$9(yield* buildWithScope(
|
|
54291
|
+
return get$9(yield* buildWithScope(pipe(GitCommitAction.layer({ cwd }), provide$2(GitCommand.layer)), yield* scope), GitCommitAction);
|
|
54004
54292
|
})
|
|
54005
54293
|
});
|
|
54006
54294
|
const RpcHandlers = RpcContracts.toLayer(gen(function* () {
|
|
54007
54295
|
const git = yield* GitWorkspace;
|
|
54008
54296
|
const terminals = yield* TerminalSessions;
|
|
54009
|
-
const
|
|
54010
|
-
const
|
|
54297
|
+
const gitReviews = yield* GitReviewSessions;
|
|
54298
|
+
const gitCommits = yield* GitCommitSessions;
|
|
54011
54299
|
const portless = yield* Portless;
|
|
54012
54300
|
const portlessScripts = yield* make$38(empty$6());
|
|
54013
|
-
const reviewStore = toSchemaStore(yield* KeyValueStore, ReviewState);
|
|
54014
54301
|
const portlessWorktrees = yield* make$46({
|
|
54015
54302
|
idleTimeToLive: infinity,
|
|
54016
54303
|
lookup: fnUntraced(function* (cwd) {
|
|
@@ -54049,27 +54336,16 @@ const RpcHandlers = RpcContracts.toLayer(gen(function* () {
|
|
|
54049
54336
|
const getTerminal = fnUntraced(function* (input) {
|
|
54050
54337
|
return yield* pipe(terminalSession(input), map$4(terminalSessionInput), flatMap$2((session) => get$6(terminals, session)));
|
|
54051
54338
|
});
|
|
54052
|
-
const
|
|
54053
|
-
|
|
54054
|
-
|
|
54055
|
-
|
|
54056
|
-
|
|
54057
|
-
return yield* pipe(reviewStore.get(`review-state/${key}`), map$4(getOrElse$1(() => emptyReviewState)), orElseSucceed(() => emptyReviewState));
|
|
54058
|
-
});
|
|
54059
|
-
const reviewStates = yield* make$46({
|
|
54060
|
-
idleTimeToLive: minutes(5),
|
|
54061
|
-
lookup: fnUntraced(function* (key) {
|
|
54062
|
-
return yield* make$3(yield* readReviewState(key));
|
|
54063
|
-
})
|
|
54064
|
-
});
|
|
54065
|
-
const updateReviewState = fnUntraced(function* (input, f) {
|
|
54339
|
+
const reviewStates = yield* make$46({ lookup: fnUntraced(function* () {
|
|
54340
|
+
return yield* make$3(emptyReviewState);
|
|
54341
|
+
}) });
|
|
54342
|
+
const updateReviewState = fn("RpcHandlers.updateReviewState")(function* (cwd, f) {
|
|
54343
|
+
yield* annotateCurrentSpan({ cwd });
|
|
54066
54344
|
return yield* pipe(scoped$3(gen(function* () {
|
|
54067
|
-
|
|
54068
|
-
const state = yield* modify(yield* get$6(reviewStates, key), (current) => {
|
|
54345
|
+
yield* modify(yield* get$6(reviewStates, cwd), (current) => {
|
|
54069
54346
|
const next = f(current);
|
|
54070
54347
|
return [next, next];
|
|
54071
54348
|
});
|
|
54072
|
-
yield* reviewStore.set(`review-state/${key}`, state);
|
|
54073
54349
|
})), mapError$2((cause) => new GitError({ cause })));
|
|
54074
54350
|
});
|
|
54075
54351
|
const agents = yield* make$3(empty$6());
|
|
@@ -54118,9 +54394,9 @@ const RpcHandlers = RpcContracts.toLayer(gen(function* () {
|
|
|
54118
54394
|
cwd: agentSession.cwd,
|
|
54119
54395
|
uuid: agentSession.uuid
|
|
54120
54396
|
});
|
|
54121
|
-
yield* update(agents, (sessions) => modifyAt(sessions, key, match$
|
|
54397
|
+
yield* update(agents, (sessions) => modifyAt(sessions, key, match$4({
|
|
54122
54398
|
onNone: () => none(),
|
|
54123
|
-
onSome: (session) => some
|
|
54399
|
+
onSome: (session) => some({
|
|
54124
54400
|
...session,
|
|
54125
54401
|
state
|
|
54126
54402
|
})
|
|
@@ -54142,53 +54418,29 @@ const RpcHandlers = RpcContracts.toLayer(gen(function* () {
|
|
|
54142
54418
|
"projects.createWorktree": (payload) => git.createWorktree(payload),
|
|
54143
54419
|
"projects.deleteWorktree": (payload) => git.deleteWorktree(payload),
|
|
54144
54420
|
"projects.watch": () => unwrap$1(map$4(get(git.projects), (projects) => pipe(make$43(projects), concat(drop(1)(changes(git.projects)))))),
|
|
54145
|
-
"review.comments.resolve": (payload) => updateReviewState(payload, (state) => {
|
|
54146
|
-
|
|
54147
|
-
|
|
54148
|
-
|
|
54149
|
-
|
|
54150
|
-
|
|
54151
|
-
|
|
54152
|
-
|
|
54153
|
-
|
|
54154
|
-
|
|
54155
|
-
|
|
54156
|
-
|
|
54157
|
-
|
|
54158
|
-
|
|
54159
|
-
|
|
54160
|
-
|
|
54161
|
-
|
|
54162
|
-
|
|
54163
|
-
|
|
54164
|
-
|
|
54165
|
-
|
|
54166
|
-
|
|
54167
|
-
"review.
|
|
54168
|
-
"review.githubThreads": (payload) => pipe(get$6(gitWorktrees, payload.cwd), flatMap$2((worktree) => worktree.reviewThreads)),
|
|
54169
|
-
"review.githubThreads.resolve": (payload) => pipe(get$6(gitWorktrees, payload.cwd), flatMap$2((worktree) => worktree.resolveReviewThread(payload.threadId))),
|
|
54170
|
-
"review.metadata": (payload) => pipe(get$6(gitWorktrees, payload.cwd), flatMap$2((worktree) => worktree.metadata({ base: payload.base }))),
|
|
54171
|
-
"review.stageFile": (payload) => pipe(get$6(gitWorktrees, payload.cwd), flatMap$2((worktree) => worktree.stageFile(payload.filePath))),
|
|
54172
|
-
"review.state.mark": (payload) => updateReviewState(payload, (state) => {
|
|
54173
|
-
const keys = new Set(map$7(payload.marks, markKey));
|
|
54174
|
-
return new ReviewState({
|
|
54175
|
-
comments: state.comments,
|
|
54176
|
-
marks: appendAll(filter$1(state.marks, (mark) => !keys.has(markKey(mark))), payload.marks)
|
|
54177
|
-
});
|
|
54178
|
-
}),
|
|
54179
|
-
"review.state.unmark": (payload) => updateReviewState(payload, (state) => {
|
|
54180
|
-
const keys = new Set(map$7(payload.marks, markKey));
|
|
54181
|
-
return new ReviewState({
|
|
54182
|
-
comments: state.comments,
|
|
54183
|
-
marks: filter$1(state.marks, (mark) => !keys.has(markKey(mark)))
|
|
54184
|
-
});
|
|
54185
|
-
}),
|
|
54186
|
-
"review.state.watch": (payload) => unwrap$1(pipe(reviewStateKey(payload), flatMap$2((key) => get$6(reviewStates, key)), flatMap$2((ref) => pipe(get(ref), map$4((state) => concat(drop(1)(changes(ref)))(make$43(state))))))),
|
|
54187
|
-
"review.unstageFile": (payload) => pipe(get$6(gitWorktrees, payload.cwd), flatMap$2((worktree) => worktree.unstageFile(payload.filePath))),
|
|
54188
|
-
"review.watchRange": (payload) => unwrap$1(pipe(get$6(gitWorktrees, payload.cwd), map$4((worktree) => worktree.watchReviewRangeDiffs({
|
|
54189
|
-
from: payload.from,
|
|
54190
|
-
to: payload.to
|
|
54191
|
-
})))),
|
|
54421
|
+
"review.comments.resolve": (payload) => pipe(updateReviewState(payload.cwd, (state) => gitReviewStateResolveComment(state, payload)), withSpan("RpcHandlers.review.comments.resolve", { attributes: {
|
|
54422
|
+
cwd: payload.cwd,
|
|
54423
|
+
filePath: payload.filePath
|
|
54424
|
+
} })),
|
|
54425
|
+
"review.comments.save": (payload) => pipe(updateReviewState(payload.cwd, (state) => gitReviewStateSaveComment(state, payload.comment)), withSpan("RpcHandlers.review.comments.save", { attributes: {
|
|
54426
|
+
cwd: payload.cwd,
|
|
54427
|
+
filePath: payload.comment.filePath
|
|
54428
|
+
} })),
|
|
54429
|
+
"review.commit": (payload) => pipe(get$6(gitCommits, payload.cwd), flatMap$2((commit) => commit.commit(payload.message))),
|
|
54430
|
+
"review.diffs": (payload) => unwrap$1(pipe(get$6(gitReviews, payload.cwd), map$4((review) => review.watchReviewDiffs(payload.target)))),
|
|
54431
|
+
"review.githubThreads": (payload) => pipe(get$6(gitReviews, payload.cwd), flatMap$2((review) => review.reviewThreads)),
|
|
54432
|
+
"review.githubThreads.resolve": (payload) => pipe(get$6(gitReviews, payload.cwd), flatMap$2((review) => review.resolveReviewThread(payload.threadId))),
|
|
54433
|
+
"review.metadata": (payload) => pipe(get$6(gitReviews, payload.cwd), flatMap$2((review) => review.metadata())),
|
|
54434
|
+
"review.push": (payload) => pipe(get$6(gitCommits, payload.cwd), flatMap$2((commit) => commit.push())),
|
|
54435
|
+
"review.state.mark": (payload) => pipe(updateReviewState(payload.cwd, (state) => gitReviewStateMark(state, payload.marks)), withSpan("RpcHandlers.review.state.mark", { attributes: {
|
|
54436
|
+
cwd: payload.cwd,
|
|
54437
|
+
markCount: length(payload.marks)
|
|
54438
|
+
} })),
|
|
54439
|
+
"review.state.unmark": (payload) => pipe(updateReviewState(payload.cwd, (state) => gitReviewStateUnmark(state, payload.marks)), withSpan("RpcHandlers.review.state.unmark", { attributes: {
|
|
54440
|
+
cwd: payload.cwd,
|
|
54441
|
+
markCount: length(payload.marks)
|
|
54442
|
+
} })),
|
|
54443
|
+
"review.state.watch": (payload) => unwrap$1(pipe(get$6(reviewStates, payload.cwd), flatMap$2((ref) => pipe(get(ref), map$4((state) => concat(drop(1)(changes(ref)))(make$43(state))))))),
|
|
54192
54444
|
"runs.portless": (payload) => get$6(portlessWorktrees, payload.cwd),
|
|
54193
54445
|
"terminal.resize": (payload) => pipe(getTerminal(TerminalSessionKey.make(payload)), flatMap$2((sessionTerminal) => sessionTerminal.resize({
|
|
54194
54446
|
cols: payload.cols,
|
|
@@ -60296,19 +60548,19 @@ var require_getMachineId = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
60296
60548
|
async function getMachineId() {
|
|
60297
60549
|
if (!getMachineIdImpl) switch (process$1.platform) {
|
|
60298
60550
|
case "darwin":
|
|
60299
|
-
getMachineIdImpl = (await import("./getMachineId-darwin-
|
|
60551
|
+
getMachineIdImpl = (await import("./getMachineId-darwin-fwMRmXNE.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
|
|
60300
60552
|
break;
|
|
60301
60553
|
case "linux":
|
|
60302
|
-
getMachineIdImpl = (await import("./getMachineId-linux-
|
|
60554
|
+
getMachineIdImpl = (await import("./getMachineId-linux-BglPdw6k.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
|
|
60303
60555
|
break;
|
|
60304
60556
|
case "freebsd":
|
|
60305
|
-
getMachineIdImpl = (await import("./getMachineId-bsd-
|
|
60557
|
+
getMachineIdImpl = (await import("./getMachineId-bsd-8V0SSHI2.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
|
|
60306
60558
|
break;
|
|
60307
60559
|
case "win32":
|
|
60308
|
-
getMachineIdImpl = (await import("./getMachineId-win-
|
|
60560
|
+
getMachineIdImpl = (await import("./getMachineId-win-Bvbq3C3K.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
|
|
60309
60561
|
break;
|
|
60310
60562
|
default:
|
|
60311
|
-
getMachineIdImpl = (await import("./getMachineId-unsupported-
|
|
60563
|
+
getMachineIdImpl = (await import("./getMachineId-unsupported-B6r8oWEG.mjs").then((m) => /* @__PURE__ */ __toESM(m.default))).getMachineId;
|
|
60312
60564
|
break;
|
|
60313
60565
|
}
|
|
60314
60566
|
return getMachineIdImpl();
|
|
@@ -67760,7 +68012,7 @@ const isSampled = (traceFlags) => (traceFlags & TraceFlags.SAMPLED) === TraceFla
|
|
|
67760
68012
|
const getOtelParent = (tracer, context, annotations) => {
|
|
67761
68013
|
const otelParent = tracer.getSpan(context)?.spanContext();
|
|
67762
68014
|
if (!otelParent) return none();
|
|
67763
|
-
return some
|
|
68015
|
+
return some(externalSpan({
|
|
67764
68016
|
spanId: otelParent.spanId,
|
|
67765
68017
|
traceId: otelParent.traceId,
|
|
67766
68018
|
sampled: (otelParent.traceFlags & 1) === 1,
|
|
@@ -70971,7 +71223,7 @@ var import_src = (/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
70971
71223
|
});
|
|
70972
71224
|
})))();
|
|
70973
71225
|
function OtelLayer(serviceName) {
|
|
70974
|
-
return unwrap$4(map$4(option(string("VITE_OTEL_URL")), match$
|
|
71226
|
+
return unwrap$4(map$4(option(string("VITE_OTEL_URL")), match$4({
|
|
70975
71227
|
onNone: () => empty$11,
|
|
70976
71228
|
onSome: (url) => layer(() => ({
|
|
70977
71229
|
resource: { serviceName },
|
|
@@ -70981,7 +71233,7 @@ function OtelLayer(serviceName) {
|
|
|
70981
71233
|
}
|
|
70982
71234
|
//#endregion
|
|
70983
71235
|
//#region src/lib/serverRuntime.ts
|
|
70984
|
-
const LiveLayers = pipe(empty$11, provideMerge(RpcHandlers), provideMerge(Portless.layer), provideMerge(GitWorkspace.layer), provideMerge(unwrap$4(pipe(string("HOME"), withDefault(process.cwd()), map$4((home) => layerFileSystem(path.join(home, ".deslop")))))), provideMerge(OtelLayer("workbench-server")), provideMerge(layer$16), provideMerge(layerMsgPack));
|
|
71236
|
+
const LiveLayers = pipe(empty$11, provideMerge(RpcHandlers), provideMerge(Portless.layer), provideMerge(pipe(GitWorkspace.layer, provide$2(GitCommand.layer))), provideMerge(pipe(GitMaintenance.layer, provide$2(GitCommand.layer))), provideMerge(unwrap$4(pipe(string("HOME"), withDefault(process.cwd()), map$4((home) => layerFileSystem(path.join(home, ".deslop")))))), provideMerge(OtelLayer("workbench-server")), provideMerge(layer$16), provideMerge(layerMsgPack));
|
|
70985
71237
|
//#endregion
|
|
70986
71238
|
//#region src/main.server.ts
|
|
70987
71239
|
runMain(pipe(serve(mergeAll$1(layerHttp({
|