rex-worktrees 0.3.3 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -108
- package/dist/rex-worktrees +1 -1
- package/dist/rex-worktrees.js +467 -507
- package/package.json +1 -1
package/dist/rex-worktrees.js
CHANGED
|
@@ -86,6 +86,34 @@ __export(exports_Cause, {
|
|
|
86
86
|
AsyncFiberError: () => AsyncFiberError2
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
+
// node_modules/effect/dist/Context.js
|
|
90
|
+
var exports_Context = {};
|
|
91
|
+
__export(exports_Context, {
|
|
92
|
+
pick: () => pick,
|
|
93
|
+
omit: () => omit,
|
|
94
|
+
mergeAll: () => mergeAll,
|
|
95
|
+
merge: () => merge,
|
|
96
|
+
makeUnsafe: () => makeUnsafe,
|
|
97
|
+
make: () => make5,
|
|
98
|
+
isReference: () => isReference,
|
|
99
|
+
isKey: () => isKey,
|
|
100
|
+
isContext: () => isContext,
|
|
101
|
+
hasSameCache: () => hasSameCache,
|
|
102
|
+
getUnsafe: () => getUnsafe,
|
|
103
|
+
getOrUndefinedUnsafe: () => getOrUndefinedUnsafe,
|
|
104
|
+
getOrUndefined: () => getOrUndefined2,
|
|
105
|
+
getOrElse: () => getOrElse2,
|
|
106
|
+
getOption: () => getOption,
|
|
107
|
+
get: () => get,
|
|
108
|
+
empty: () => empty,
|
|
109
|
+
addUnsafe: () => addUnsafe,
|
|
110
|
+
addOrOmit: () => addOrOmit,
|
|
111
|
+
add: () => add,
|
|
112
|
+
ServiceTypeId: () => ServiceTypeId,
|
|
113
|
+
Service: () => Service,
|
|
114
|
+
Reference: () => Reference
|
|
115
|
+
});
|
|
116
|
+
|
|
89
117
|
// node_modules/effect/dist/Pipeable.js
|
|
90
118
|
var pipeArguments = (self, args) => {
|
|
91
119
|
switch (args.length) {
|
|
@@ -2017,6 +2045,7 @@ var Proto = {
|
|
|
2017
2045
|
};
|
|
2018
2046
|
var hasSameCache = (self, that) => self.cacheRoot === that.cacheRoot;
|
|
2019
2047
|
var isContext = (u) => hasProperty(u, TypeId3);
|
|
2048
|
+
var isKey = (u) => hasProperty(u, ServiceTypeId);
|
|
2020
2049
|
var isReference = (u) => !!u[ReferenceTypeId];
|
|
2021
2050
|
var empty = () => emptyContext2;
|
|
2022
2051
|
var emptyContext2 = /* @__PURE__ */ makeUnsafe(/* @__PURE__ */ new Map);
|
|
@@ -2038,6 +2067,13 @@ var addUnsafe = (self, key, service) => {
|
|
|
2038
2067
|
parent: impl.overlay
|
|
2039
2068
|
}, impl.depth + 1, impl.maxDepth);
|
|
2040
2069
|
};
|
|
2070
|
+
var addOrOmit = /* @__PURE__ */ dual(3, (self, key, service) => service._tag === "None" ? omit(key)(self) : add(self, key, service.value));
|
|
2071
|
+
var getOrElse2 = /* @__PURE__ */ dual(3, (self, key, orElse2) => {
|
|
2072
|
+
const value = lookup(self, key.key);
|
|
2073
|
+
if (value !== notFound)
|
|
2074
|
+
return value;
|
|
2075
|
+
return isReference(key) ? getDefaultValue(key) : orElse2();
|
|
2076
|
+
});
|
|
2041
2077
|
var getOrUndefined2 = /* @__PURE__ */ dual(2, (self, key) => getOrUndefinedUnsafe(self, key.key));
|
|
2042
2078
|
var getOrUndefinedUnsafe = (self, key) => {
|
|
2043
2079
|
const value = lookup(self, key);
|
|
@@ -2093,6 +2129,28 @@ var mergeAll = (...ctxs) => {
|
|
|
2093
2129
|
}
|
|
2094
2130
|
return makeUnsafe(map2);
|
|
2095
2131
|
};
|
|
2132
|
+
var pick = (...services) => (self) => {
|
|
2133
|
+
if (services.length <= 1) {
|
|
2134
|
+
const map2 = new Map;
|
|
2135
|
+
if (services.length === 1) {
|
|
2136
|
+
const key = services[0].key;
|
|
2137
|
+
const value = lookup(self, key);
|
|
2138
|
+
if (value !== notFound)
|
|
2139
|
+
map2.set(key, value);
|
|
2140
|
+
}
|
|
2141
|
+
return makeImpl(undefined, map2, undefined, 0, self.maxDepth);
|
|
2142
|
+
}
|
|
2143
|
+
const keep = new Set(services.map((key) => key.key));
|
|
2144
|
+
return withFlat(self, (map2) => map2.forEach((_, key) => {
|
|
2145
|
+
if (!keep.has(key))
|
|
2146
|
+
map2.delete(key);
|
|
2147
|
+
}));
|
|
2148
|
+
};
|
|
2149
|
+
var omit = (...keys) => (self) => withFlat(self, (map2) => {
|
|
2150
|
+
for (let i = 0;i < keys.length; i++) {
|
|
2151
|
+
map2.delete(keys[i].key);
|
|
2152
|
+
}
|
|
2153
|
+
});
|
|
2096
2154
|
var Reference = Service;
|
|
2097
2155
|
|
|
2098
2156
|
// node_modules/effect/dist/internal/array.js
|
|
@@ -2130,7 +2188,7 @@ __export(exports_Result, {
|
|
|
2130
2188
|
getOrThrowWith: () => getOrThrowWith2,
|
|
2131
2189
|
getOrThrow: () => getOrThrow2,
|
|
2132
2190
|
getOrNull: () => getOrNull2,
|
|
2133
|
-
getOrElse: () =>
|
|
2191
|
+
getOrElse: () => getOrElse3,
|
|
2134
2192
|
getFailure: () => getFailure3,
|
|
2135
2193
|
gen: () => gen2,
|
|
2136
2194
|
fromOption: () => fromOption2,
|
|
@@ -2189,9 +2247,9 @@ var merge2 = /* @__PURE__ */ match2({
|
|
|
2189
2247
|
onFailure: identity,
|
|
2190
2248
|
onSuccess: identity
|
|
2191
2249
|
});
|
|
2192
|
-
var
|
|
2193
|
-
var getOrNull2 = /* @__PURE__ */
|
|
2194
|
-
var getOrUndefined3 = /* @__PURE__ */
|
|
2250
|
+
var getOrElse3 = /* @__PURE__ */ dual(2, (self, onFailure) => isFailure2(self) ? onFailure(self.failure) : self.success);
|
|
2251
|
+
var getOrNull2 = /* @__PURE__ */ getOrElse3(constNull);
|
|
2252
|
+
var getOrUndefined3 = /* @__PURE__ */ getOrElse3(constUndefined);
|
|
2195
2253
|
var getOrThrowWith2 = /* @__PURE__ */ dual(2, (self, onFailure) => {
|
|
2196
2254
|
if (isSuccess2(self)) {
|
|
2197
2255
|
return self.success;
|
|
@@ -15954,7 +16012,7 @@ function transformOptionalEffect(f) {
|
|
|
15954
16012
|
transform: f
|
|
15955
16013
|
});
|
|
15956
16014
|
}
|
|
15957
|
-
function
|
|
16015
|
+
function omit2() {
|
|
15958
16016
|
return transformOptional(() => none2());
|
|
15959
16017
|
}
|
|
15960
16018
|
function withDefault(defaultValue) {
|
|
@@ -21034,7 +21092,7 @@ __export(exports_Aead, {
|
|
|
21034
21092
|
layerWebCryptoWith: () => layerWebCryptoWith,
|
|
21035
21093
|
layerWebCrypto: () => layerWebCrypto,
|
|
21036
21094
|
key: () => key,
|
|
21037
|
-
isKey: () =>
|
|
21095
|
+
isKey: () => isKey2,
|
|
21038
21096
|
fromCryptoKey: () => fromCryptoKey2,
|
|
21039
21097
|
chacha20Poly1305: () => chacha20Poly13052,
|
|
21040
21098
|
aes256Gcm: () => aes256Gcm,
|
|
@@ -22001,7 +22059,7 @@ var xchacha20Poly13052 = {
|
|
|
22001
22059
|
implementation: /* @__PURE__ */ chachaImplementation(xchacha20Poly1305)
|
|
22002
22060
|
};
|
|
22003
22061
|
var KeyProto = /* @__PURE__ */ redactedProto(TypeId36, "Aead.Key");
|
|
22004
|
-
var
|
|
22062
|
+
var isKey2 = (u) => hasProperty(u, TypeId36);
|
|
22005
22063
|
|
|
22006
22064
|
class Aead extends (/* @__PURE__ */ Service()("effect/crypto/Aead")) {
|
|
22007
22065
|
}
|
|
@@ -22093,7 +22151,7 @@ __export(exports_Cipher, {
|
|
|
22093
22151
|
toBytes: () => toBytes3,
|
|
22094
22152
|
layerWebCrypto: () => layerWebCrypto2,
|
|
22095
22153
|
key: () => key2,
|
|
22096
|
-
isKey: () =>
|
|
22154
|
+
isKey: () => isKey3,
|
|
22097
22155
|
fromCryptoKey: () => fromCryptoKey3,
|
|
22098
22156
|
aes256Ctr: () => aes256Ctr,
|
|
22099
22157
|
aes256Cbc: () => aes256Cbc,
|
|
@@ -22123,7 +22181,7 @@ var aes256Cbc = {
|
|
|
22123
22181
|
keyLength: 32
|
|
22124
22182
|
};
|
|
22125
22183
|
var KeyProto2 = /* @__PURE__ */ redactedProto(TypeId37, "Cipher.Key");
|
|
22126
|
-
var
|
|
22184
|
+
var isKey3 = (u) => hasProperty(u, TypeId37);
|
|
22127
22185
|
|
|
22128
22186
|
class Cipher extends (/* @__PURE__ */ Service()("effect/crypto/Cipher")) {
|
|
22129
22187
|
}
|
|
@@ -22353,7 +22411,7 @@ __export(exports_Mac, {
|
|
|
22353
22411
|
layerWebCryptoWith: () => layerWebCryptoWith2,
|
|
22354
22412
|
layerWebCrypto: () => layerWebCrypto3,
|
|
22355
22413
|
key: () => key3,
|
|
22356
|
-
isKey: () =>
|
|
22414
|
+
isKey: () => isKey4,
|
|
22357
22415
|
hmacSha512: () => hmacSha512,
|
|
22358
22416
|
hmacSha384: () => hmacSha384,
|
|
22359
22417
|
hmacSha256: () => hmacSha256,
|
|
@@ -22379,7 +22437,7 @@ var hmacSha512 = {
|
|
|
22379
22437
|
hash: sha512
|
|
22380
22438
|
};
|
|
22381
22439
|
var KeyProto3 = /* @__PURE__ */ redactedProto(TypeId38, "Mac.Key");
|
|
22382
|
-
var
|
|
22440
|
+
var isKey4 = (u) => hasProperty(u, TypeId38);
|
|
22383
22441
|
var blockSizes = {
|
|
22384
22442
|
MD5: 64,
|
|
22385
22443
|
"SHA-1": 64,
|
|
@@ -22446,7 +22504,7 @@ var PublicKeyTypeId2 = "~effect/crypto/KeyWrap/PublicKey";
|
|
|
22446
22504
|
var KeyProto4 = /* @__PURE__ */ redactedProto(KeyTypeId, "KeyWrap.Key");
|
|
22447
22505
|
var PrivateKeyProto2 = /* @__PURE__ */ redactedProto(PrivateKeyTypeId2, "KeyWrap.PrivateKey");
|
|
22448
22506
|
var PublicKeyProto2 = /* @__PURE__ */ redactedProto(PublicKeyTypeId2, "KeyWrap.PublicKey");
|
|
22449
|
-
var
|
|
22507
|
+
var isKey5 = (u) => hasProperty(u, KeyTypeId);
|
|
22450
22508
|
var isPrivateKey2 = (u) => hasProperty(u, PrivateKeyTypeId2);
|
|
22451
22509
|
var isPublicKey2 = (u) => hasProperty(u, PublicKeyTypeId2);
|
|
22452
22510
|
var specOf2 = (algorithm) => ({
|
|
@@ -22473,7 +22531,7 @@ var secretFamily = (algorithm) => ("nonceLength" in algorithm) ? exports_Aead :
|
|
|
22473
22531
|
toBytes: toBytes7
|
|
22474
22532
|
} : exports_Mac;
|
|
22475
22533
|
var key4 = (algorithm, bytes2) => fromBytes("KeyWrap", "key", KeyProto4, algorithm, bytes2, checkKeyLength(algorithm));
|
|
22476
|
-
var toBytes7 = (key5) =>
|
|
22534
|
+
var toBytes7 = (key5) => isKey5(key5) ? toBytes("KeyWrap", key5, exportRaw) : toBytes4(family2, key5);
|
|
22477
22535
|
|
|
22478
22536
|
// node_modules/effect/dist/crypto/Signature.js
|
|
22479
22537
|
var PrivateKeyTypeId3 = "~effect/crypto/Signature/PrivateKey";
|
|
@@ -22728,7 +22786,7 @@ var joseOf = (algorithm) => {
|
|
|
22728
22786
|
};
|
|
22729
22787
|
var publicMembers = ["kty", "crv", "x", "y", "n", "e"];
|
|
22730
22788
|
var privateMembers = [...publicMembers, "d", "p", "q", "dp", "dq", "qi"];
|
|
22731
|
-
var
|
|
22789
|
+
var pick2 = (jwk, members) => {
|
|
22732
22790
|
const out = {};
|
|
22733
22791
|
for (const member of members) {
|
|
22734
22792
|
const value3 = jwk[member];
|
|
@@ -22754,14 +22812,14 @@ var checkJwk = (data, algorithm, role) => {
|
|
|
22754
22812
|
case "public":
|
|
22755
22813
|
if (data.d !== undefined)
|
|
22756
22814
|
return "A public JWK cannot contain d";
|
|
22757
|
-
return
|
|
22815
|
+
return pick2({
|
|
22758
22816
|
...data,
|
|
22759
22817
|
kty: expected.kty
|
|
22760
22818
|
}, publicMembers);
|
|
22761
22819
|
case "private":
|
|
22762
22820
|
if (typeof data.d !== "string")
|
|
22763
22821
|
return "A private JWK must contain d";
|
|
22764
|
-
return
|
|
22822
|
+
return pick2({
|
|
22765
22823
|
...data,
|
|
22766
22824
|
kty: expected.kty
|
|
22767
22825
|
}, privateMembers);
|
|
@@ -22862,7 +22920,7 @@ var encodeAsymmetric = (format6, key5, family4) => suspend2(() => {
|
|
|
22862
22920
|
return runWithReference("KeyFormat", "encode", key5.algorithm.name, async (subtle) => {
|
|
22863
22921
|
const cryptoKey = stored._tag === "CryptoKey" ? stored.cryptoKey : role === "private" ? await importPrivate(subtle, stored.bytes, spec, true) : await importPublic(subtle, stored.bytes, spec);
|
|
22864
22922
|
if (target === "jwk") {
|
|
22865
|
-
return
|
|
22923
|
+
return pick2(await subtle.exportKey("jwk", cryptoKey), role === "private" ? privateMembers : publicMembers);
|
|
22866
22924
|
}
|
|
22867
22925
|
return new Uint8Array(await subtle.exportKey(target, cryptoKey));
|
|
22868
22926
|
});
|
|
@@ -27582,10 +27640,10 @@ function toFormatter(ast, options) {
|
|
|
27582
27640
|
}
|
|
27583
27641
|
|
|
27584
27642
|
// node_modules/effect/dist/Struct.js
|
|
27585
|
-
var
|
|
27643
|
+
var pick3 = /* @__PURE__ */ dual(2, (self, keys4) => {
|
|
27586
27644
|
return buildStruct(self, (k, v) => hasPropertyKey(keys4, k) ? [k, v] : undefined);
|
|
27587
27645
|
});
|
|
27588
|
-
var
|
|
27646
|
+
var omit3 = /* @__PURE__ */ dual(2, (self, keys4) => {
|
|
27589
27647
|
return buildStruct(self, (k, v) => !hasPropertyKey(keys4, k) ? [k, v] : undefined);
|
|
27590
27648
|
});
|
|
27591
27649
|
var assign = /* @__PURE__ */ dual(2, (self, that) => {
|
|
@@ -27710,10 +27768,10 @@ class OptionalImpl {
|
|
|
27710
27768
|
this.replaceResult = replaceResult;
|
|
27711
27769
|
}
|
|
27712
27770
|
replace(a, s) {
|
|
27713
|
-
return
|
|
27771
|
+
return getOrElse3(this.replaceResult(a, s), () => s);
|
|
27714
27772
|
}
|
|
27715
27773
|
modify(f) {
|
|
27716
|
-
return (s) =>
|
|
27774
|
+
return (s) => getOrElse3(flatMap2(this.getResult(s), (a) => this.replaceResult(f(a), s)), () => s);
|
|
27717
27775
|
}
|
|
27718
27776
|
compose(that) {
|
|
27719
27777
|
return make37(compose2(this.node, that.node));
|
|
@@ -27761,14 +27819,14 @@ class OptionalImpl {
|
|
|
27761
27819
|
})));
|
|
27762
27820
|
}
|
|
27763
27821
|
pick(keys4) {
|
|
27764
|
-
return this.compose(makeLens(
|
|
27765
|
-
...
|
|
27822
|
+
return this.compose(makeLens(pick3(keys4), (p, a) => ({
|
|
27823
|
+
...omit3(a, keys4),
|
|
27766
27824
|
...p
|
|
27767
27825
|
})));
|
|
27768
27826
|
}
|
|
27769
27827
|
omit(keys4) {
|
|
27770
|
-
return this.compose(makeLens(
|
|
27771
|
-
...
|
|
27828
|
+
return this.compose(makeLens(omit3(keys4), (o, a) => ({
|
|
27829
|
+
...pick3(a, keys4),
|
|
27772
27830
|
...o
|
|
27773
27831
|
})));
|
|
27774
27832
|
}
|
|
@@ -27811,7 +27869,7 @@ class OptionalImpl {
|
|
|
27811
27869
|
}));
|
|
27812
27870
|
}
|
|
27813
27871
|
modifyAll(f) {
|
|
27814
|
-
return (s) =>
|
|
27872
|
+
return (s) => getOrElse3(flatMap2(this.getResult(s), (as5) => this.replaceResult(as5.map(f), s)), () => s);
|
|
27815
27873
|
}
|
|
27816
27874
|
}
|
|
27817
27875
|
|
|
@@ -27853,7 +27911,7 @@ class PrismImpl extends OptionalImpl {
|
|
|
27853
27911
|
return this.set(a);
|
|
27854
27912
|
}
|
|
27855
27913
|
modify(f) {
|
|
27856
|
-
return (s) =>
|
|
27914
|
+
return (s) => getOrElse3(map2(this.getResult(s), (a) => this.set(f(a))), () => s);
|
|
27857
27915
|
}
|
|
27858
27916
|
}
|
|
27859
27917
|
function make37(node) {
|
|
@@ -29646,7 +29704,7 @@ function toIssueEffect(self) {
|
|
|
29646
29704
|
return catchCause2(self, (cause) => failCauseSync2(() => map6(cause, (error) => error.issue)));
|
|
29647
29705
|
}
|
|
29648
29706
|
function withDecodingDefaultKey(defaultValue, options) {
|
|
29649
|
-
const encode7 = options?.encodingStrategy === "omit" ?
|
|
29707
|
+
const encode7 = options?.encodingStrategy === "omit" ? omit2() : passthrough2();
|
|
29650
29708
|
return (self) => {
|
|
29651
29709
|
return optionalKey2(toEncoded2(self)).pipe(decodeTo2(self, {
|
|
29652
29710
|
decode: withDefault(toIssueEffect(defaultValue)),
|
|
@@ -29660,7 +29718,7 @@ function withDecodingDefaultTypeKey(defaultValue, options) {
|
|
|
29660
29718
|
};
|
|
29661
29719
|
}
|
|
29662
29720
|
function withDecodingDefault(defaultValue, options) {
|
|
29663
|
-
const encode7 = options?.encodingStrategy === "omit" ?
|
|
29721
|
+
const encode7 = options?.encodingStrategy === "omit" ? omit2() : passthrough2();
|
|
29664
29722
|
return (self) => {
|
|
29665
29723
|
return optional2(toEncoded2(self)).pipe(decodeTo2(self, {
|
|
29666
29724
|
decode: withDefault(toIssueEffect(defaultValue)),
|
|
@@ -32302,13 +32360,13 @@ var cryptoKeyFromFormat = (name, to, format10, decode5, canEncode) => {
|
|
|
32302
32360
|
encode: (key5, options) => writable ? mapError3(encode5(format10, key5), (error) => cryptoIssue(error, key5, options)) : cryptoForbiddenEncode(name, key5, options)
|
|
32303
32361
|
})));
|
|
32304
32362
|
};
|
|
32305
|
-
var MacKey = (algorithm) => declareCryptoKey("MacKey", "Mac", "Key",
|
|
32363
|
+
var MacKey = (algorithm) => declareCryptoKey("MacKey", "Mac", "Key", isKey4, algorithm);
|
|
32306
32364
|
var MacKeyFromBytes = (algorithm, options) => cryptoKeyFromBytes("MacKeyFromBytes", MacKey(algorithm), (bytes2) => key3(algorithm, bytes2), options?.allowEncode === true ? toBytes6 : undefined);
|
|
32307
32365
|
var MacKeyFromFormat = (format10, algorithm, options) => cryptoKeyFromFormat("MacKeyFromFormat", MacKey(algorithm), format10, (data) => decodeSecret(format10, algorithm, data), options?.allowEncode === true);
|
|
32308
|
-
var AeadKey = (algorithm) => declareCryptoKey("AeadKey", "Aead", "Key",
|
|
32366
|
+
var AeadKey = (algorithm) => declareCryptoKey("AeadKey", "Aead", "Key", isKey2, algorithm);
|
|
32309
32367
|
var AeadKeyFromBytes = (algorithm, options) => cryptoKeyFromBytes("AeadKeyFromBytes", AeadKey(algorithm), (bytes2) => key(algorithm, bytes2), options?.allowEncode === true ? toBytes2 : undefined);
|
|
32310
32368
|
var AeadKeyFromFormat = (format10, algorithm, options) => cryptoKeyFromFormat("AeadKeyFromFormat", AeadKey(algorithm), format10, (data) => decodeSecret(format10, algorithm, data), options?.allowEncode === true);
|
|
32311
|
-
var CipherKey = (algorithm) => declareCryptoKey("CipherKey", "Cipher", "Key",
|
|
32369
|
+
var CipherKey = (algorithm) => declareCryptoKey("CipherKey", "Cipher", "Key", isKey3, algorithm);
|
|
32312
32370
|
var CipherKeyFromBytes = (algorithm, options) => cryptoKeyFromBytes("CipherKeyFromBytes", CipherKey(algorithm), (bytes2) => key2(algorithm, bytes2), options?.allowEncode === true ? toBytes3 : undefined);
|
|
32313
32371
|
var CipherKeyFromFormat = (format10, algorithm, options) => cryptoKeyFromFormat("CipherKeyFromFormat", CipherKey(algorithm), format10, (data) => decodeSecret(format10, algorithm, data), options?.allowEncode === true);
|
|
32314
32372
|
var SignaturePublicKey = (algorithm) => declareCryptoKey("SignaturePublicKey", "Signature", "PublicKey", isPublicKey3, algorithm);
|
|
@@ -32323,7 +32381,7 @@ var KeyAgreementPublicKeyFromFormat = (format10, algorithm) => cryptoKeyFromForm
|
|
|
32323
32381
|
var KeyAgreementPrivateKey = (algorithm) => declareCryptoKey("KeyAgreementPrivateKey", "KeyAgreement", "PrivateKey", isPrivateKey, algorithm);
|
|
32324
32382
|
var KeyAgreementPrivateKeyFromBytes = (algorithm, options) => cryptoKeyFromBytes("KeyAgreementPrivateKeyFromBytes", KeyAgreementPrivateKey(algorithm), (bytes2) => privateKey(algorithm, bytes2), options?.allowEncode === true ? toBytes5 : undefined);
|
|
32325
32383
|
var KeyAgreementPrivateKeyFromFormat = (format10, algorithm, options) => cryptoKeyFromFormat("KeyAgreementPrivateKeyFromFormat", KeyAgreementPrivateKey(algorithm), format10, (data) => decodePrivate(format10, algorithm, data), options?.allowEncode === true);
|
|
32326
|
-
var KeyWrapKey = (algorithm) => declareCryptoKey("KeyWrapKey", "KeyWrap", "Key",
|
|
32384
|
+
var KeyWrapKey = (algorithm) => declareCryptoKey("KeyWrapKey", "KeyWrap", "Key", isKey5, algorithm);
|
|
32327
32385
|
var KeyWrapKeyFromBytes = (algorithm, options) => cryptoKeyFromBytes("KeyWrapKeyFromBytes", KeyWrapKey(algorithm), (bytes2) => key4(algorithm, bytes2), options?.allowEncode === true ? toBytes7 : undefined);
|
|
32328
32386
|
var KeyWrapKeyFromFormat = (format10, algorithm, options) => cryptoKeyFromFormat("KeyWrapKeyFromFormat", KeyWrapKey(algorithm), format10, (data) => decodeSecret(format10, algorithm, data), options?.allowEncode === true);
|
|
32329
32387
|
var KeyWrapPublicKey = (algorithm) => declareCryptoKey("KeyWrapPublicKey", "KeyWrap", "PublicKey", isPublicKey2, algorithm);
|
|
@@ -33455,6 +33513,9 @@ var withTime = /* @__PURE__ */ dual((args2) => isEffect(args2[0]), (self, label)
|
|
|
33455
33513
|
}))));
|
|
33456
33514
|
// src/git.ts
|
|
33457
33515
|
import { resolve as resolvePath } from "path";
|
|
33516
|
+
// src/process.ts
|
|
33517
|
+
import { basename } from "path";
|
|
33518
|
+
|
|
33458
33519
|
// src/contracts.ts
|
|
33459
33520
|
class AppError extends exports_Schema.TaggedError()("AppError", {
|
|
33460
33521
|
message: exports_Schema.String,
|
|
@@ -33508,14 +33569,6 @@ var JjWorktreeSchema = exports_Schema.Struct({
|
|
|
33508
33569
|
colocated: exports_Schema.Boolean
|
|
33509
33570
|
});
|
|
33510
33571
|
var WorktreeSchema = exports_Schema.Union([GitWorktreeSchema, JjWorktreeSchema]);
|
|
33511
|
-
var WorktreePlanSchema = exports_Schema.Struct({ repository: GitRepositorySchema, path: exports_Schema.String, branch: exports_Schema.String, existing: exports_Schema.Boolean });
|
|
33512
|
-
var CreateWorktreeOptionsSchema = exports_Schema.Struct({
|
|
33513
|
-
startPoint: exports_Schema.optional(exports_Schema.String),
|
|
33514
|
-
attachOnly: exports_Schema.optional(exports_Schema.Boolean),
|
|
33515
|
-
worktreeRoot: exports_Schema.optional(exports_Schema.String),
|
|
33516
|
-
worktreeName: exports_Schema.optional(exports_Schema.String)
|
|
33517
|
-
});
|
|
33518
|
-
var EnvironmentSchema = exports_Schema.Record(exports_Schema.String, exports_Schema.String);
|
|
33519
33572
|
var ConfigSchema = exports_Schema.Struct({
|
|
33520
33573
|
roots: exports_Schema.optional(exports_Schema.Array(exports_Schema.String)),
|
|
33521
33574
|
projects: exports_Schema.optional(exports_Schema.Array(exports_Schema.Union([exports_Schema.String, exports_Schema.Struct({
|
|
@@ -33524,13 +33577,7 @@ var ConfigSchema = exports_Schema.Struct({
|
|
|
33524
33577
|
})]))),
|
|
33525
33578
|
worktreeRoot: exports_Schema.optional(exports_Schema.String)
|
|
33526
33579
|
});
|
|
33527
|
-
var
|
|
33528
|
-
roots: exports_Schema.Array(exports_Schema.String),
|
|
33529
|
-
projects: exports_Schema.Array(exports_Schema.String),
|
|
33530
|
-
worktreeRoot: exports_Schema.UndefinedOr(exports_Schema.String),
|
|
33531
|
-
projectRoots: exports_Schema.Array(exports_Schema.Struct({ path: exports_Schema.String, worktreeRoot: exports_Schema.String }))
|
|
33532
|
-
});
|
|
33533
|
-
var InstallSchema = exports_Schema.Struct({ source: exports_Schema.String, home: exports_Schema.String, configPath: exports_Schema.String, lua: exports_Schema.String, rexBinDir: exports_Schema.String, managedBin: exports_Schema.optional(exports_Schema.String), pathEnv: exports_Schema.optional(exports_Schema.String), allowLinkedConfig: exports_Schema.optional(exports_Schema.Boolean) });
|
|
33580
|
+
var NativeConfigSchema = exports_Schema.Struct({ config: ConfigSchema, directory: exports_Schema.String });
|
|
33534
33581
|
var AssociationSchema = exports_Schema.Struct({
|
|
33535
33582
|
vcs: VcsSchema,
|
|
33536
33583
|
hostId: ServerHostIdSchema,
|
|
@@ -33713,6 +33760,7 @@ var TaskRequestSchema = exports_Schema.Union([GitTaskRequestSchema, JjTaskReques
|
|
|
33713
33760
|
var RequestIdentitySchema = exports_Schema.Struct({ version: exports_Schema.Literal(4), hostId: ServerHostIdSchema });
|
|
33714
33761
|
var RequestSchema = exports_Schema.Union([
|
|
33715
33762
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("discover"), context: exports_Schema.optional(exports_Schema.String) }),
|
|
33763
|
+
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("sessions") }),
|
|
33716
33764
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("clone-source"), repo: exports_Schema.String }),
|
|
33717
33765
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("project"), path: exports_Schema.String }),
|
|
33718
33766
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("worktrees"), repo: exports_Schema.String }),
|
|
@@ -33724,6 +33772,7 @@ var RequestSchema = exports_Schema.Union([
|
|
|
33724
33772
|
]);
|
|
33725
33773
|
var ResponseSchema = exports_Schema.Union([
|
|
33726
33774
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("discover"), sessions: exports_Schema.Array(SessionTargetSchema), clients: exports_Schema.Array(ClientTargetSchema), projects: exports_Schema.Array(RepositorySchema), roots: exports_Schema.optional(exports_Schema.Array(exports_Schema.String)), cloneRoot: exports_Schema.String, checkout: exports_Schema.optional(RepositorySchema) }),
|
|
33775
|
+
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("sessions"), sessions: exports_Schema.Array(SessionTargetSchema), clients: exports_Schema.Array(ClientTargetSchema) }),
|
|
33727
33776
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("project"), project: RepositorySchema, checkout: RepositorySchema, worktrees: exports_Schema.Array(WorktreeSchema), branches: exports_Schema.Array(exports_Schema.String), revisions: exports_Schema.Array(JjRevisionChoiceSchema) }),
|
|
33728
33777
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("project-missing"), path: exports_Schema.String }),
|
|
33729
33778
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("clone-source"), source: CloneSourceSchema }),
|
|
@@ -33735,9 +33784,8 @@ var ResponseSchema = exports_Schema.Union([
|
|
|
33735
33784
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("launch"), result: LaunchResultSchema })
|
|
33736
33785
|
]);
|
|
33737
33786
|
var RexWorktreesResponseSchema = exports_Schema.fromJsonString(exports_Schema.fromJsonString(ResponseSchema));
|
|
33787
|
+
var RexNativeConfigResponseSchema = exports_Schema.fromJsonString(exports_Schema.fromJsonString(NativeConfigSchema));
|
|
33738
33788
|
var PopupOriginSchema = exports_Schema.Struct({ sessionId: exports_Schema.optional(SessionIdSchema), blockId: exports_Schema.optional(BlockIdSchema), clientId: exports_Schema.optional(ClientIdSchema) });
|
|
33739
|
-
var PopupSizeSchema = exports_Schema.Struct({ columns: exports_Schema.Number, rows: exports_Schema.Number });
|
|
33740
|
-
var PopupBoundsSchema = exports_Schema.Tuple([exports_Schema.Number, exports_Schema.Number, exports_Schema.Number, exports_Schema.Number]);
|
|
33741
33789
|
var RexIdentitySchema = exports_Schema.Struct({ host_id: ServerHostIdSchema, endpoint: exports_Schema.String, principal: exports_Schema.Struct({ transport: exports_Schema.String }) });
|
|
33742
33790
|
var RexSessionsSchema = exports_Schema.Struct({ sessions: exports_Schema.Array(exports_Schema.Struct({ session_id: SessionIdSchema, label: exports_Schema.String })) });
|
|
33743
33791
|
var RexSessionCreatedSchema = exports_Schema.Struct({ session_id: SessionIdSchema });
|
|
@@ -33760,15 +33808,10 @@ var RexViewSchema = exports_Schema.Struct({
|
|
|
33760
33808
|
windows: exports_Schema.Array(exports_Schema.Struct({
|
|
33761
33809
|
window_id: WindowIdSchema,
|
|
33762
33810
|
layers: exports_Schema.Array(exports_Schema.Struct({
|
|
33763
|
-
layer_id: exports_Schema.NullOr(LayerIdSchema),
|
|
33764
|
-
kind: exports_Schema.String,
|
|
33765
|
-
bounds: exports_Schema.optional(exports_Schema.NullOr(PopupBoundsSchema)),
|
|
33766
33811
|
blocks: exports_Schema.Array(exports_Schema.Struct({ block_id: BlockIdSchema, owner: exports_Schema.optional(exports_Schema.NullOr(ClientIdSchema)) }))
|
|
33767
33812
|
}))
|
|
33768
33813
|
}))
|
|
33769
33814
|
});
|
|
33770
|
-
var RexResizedSchema = exports_Schema.Struct({ revision: exports_Schema.Number });
|
|
33771
|
-
var RexTerminalSizeSchema = exports_Schema.Struct({ ...PopupSizeSchema.fields, owner: exports_Schema.NullOr(ClientIdSchema) });
|
|
33772
33815
|
var RexCreatedSchema = exports_Schema.Struct({ window_id: exports_Schema.optional(WindowIdSchema), block_ids: exports_Schema.Array(BlockIdSchema) });
|
|
33773
33816
|
var RexLayerSchema = exports_Schema.Struct({ layer_id: exports_Schema.NullOr(LayerIdSchema), block_ids: exports_Schema.NullOr(exports_Schema.Array(exports_Schema.NullOr(BlockIdSchema))), revision: exports_Schema.Number });
|
|
33774
33817
|
var RexDirectorySchema = exports_Schema.Struct({ pwd: exports_Schema.optional(exports_Schema.String) });
|
|
@@ -33810,19 +33853,17 @@ var CliFlagsSchema = exports_Schema.Struct({
|
|
|
33810
33853
|
// src/process.ts
|
|
33811
33854
|
var run4 = exports_Effect.fnUntraced(function* (program, args2, cwd, env) {
|
|
33812
33855
|
const spawner = yield* exports_ChildProcessSpawner.ChildProcessSpawner;
|
|
33813
|
-
|
|
33814
|
-
|
|
33815
|
-
|
|
33816
|
-
|
|
33817
|
-
|
|
33818
|
-
|
|
33819
|
-
|
|
33820
|
-
|
|
33821
|
-
|
|
33822
|
-
|
|
33823
|
-
|
|
33824
|
-
}));
|
|
33825
|
-
});
|
|
33856
|
+
const handle = yield* spawner.spawn(exports_ChildProcess.make(program, args2, { cwd, env }));
|
|
33857
|
+
const [stdout, stderr, exitCode] = yield* exports_Effect.all([
|
|
33858
|
+
exports_Stream.mkString(exports_Stream.decodeText(handle.stdout)),
|
|
33859
|
+
exports_Stream.mkString(exports_Stream.decodeText(handle.stderr)),
|
|
33860
|
+
handle.exitCode
|
|
33861
|
+
], { concurrency: "unbounded" });
|
|
33862
|
+
if (exitCode !== 0) {
|
|
33863
|
+
return yield* exports_Effect.fail(new CommandError({ message: `${basename(program)} exited ${exitCode}: ${stderr.trim() || stdout.trim()}`, program, args: args2, exitCode, stdout, stderr }));
|
|
33864
|
+
}
|
|
33865
|
+
return stdout;
|
|
33866
|
+
}, exports_Effect.scoped);
|
|
33826
33867
|
|
|
33827
33868
|
// src/checkout.ts
|
|
33828
33869
|
var fail16 = (message) => exports_Effect.fail(new AppError({ message }));
|
|
@@ -33917,16 +33958,16 @@ var safeOrigin = (raw, sameHost, base) => {
|
|
|
33917
33958
|
return raw;
|
|
33918
33959
|
throw new Error("Unsafe origin URL");
|
|
33919
33960
|
};
|
|
33920
|
-
var origin = exports_Effect.fnUntraced(function* (repoPath
|
|
33961
|
+
var origin = exports_Effect.fnUntraced(function* (repoPath) {
|
|
33921
33962
|
const raw = yield* git(repoPath, "config", "--get", "remote.origin.url").pipe(exports_Effect.catch(() => fail17("Repository has no usable origin URL")));
|
|
33922
33963
|
return yield* exports_Effect.try({
|
|
33923
|
-
try: () => safeOrigin(raw.replace(/\n$/, ""),
|
|
33964
|
+
try: () => safeOrigin(raw.replace(/\n$/, ""), true, repoPath),
|
|
33924
33965
|
catch: () => new AppError({ message: "Repository origin URL is unsafe or local to another Rex host" })
|
|
33925
33966
|
});
|
|
33926
33967
|
});
|
|
33927
33968
|
var cloneSource = exports_Effect.fnUntraced(function* (repoPath, sourceHostId) {
|
|
33928
33969
|
const repo = yield* repository(repoPath);
|
|
33929
|
-
const url = yield* origin(repo.path
|
|
33970
|
+
const url = yield* origin(repo.path);
|
|
33930
33971
|
const refs = yield* git(repo.path, "for-each-ref", "--format=%(refname)", "refs/heads", "refs/remotes/origin");
|
|
33931
33972
|
const branches = [...new Set(refs.split(`
|
|
33932
33973
|
`).flatMap((ref) => ref.startsWith("refs/heads/") ? [ref.slice("refs/heads/".length)] : ref.startsWith("refs/remotes/origin/") && ref !== "refs/remotes/origin/HEAD" ? [ref.slice("refs/remotes/origin/".length)] : []))];
|
|
@@ -34015,7 +34056,7 @@ var project = exports_Effect.fnUntraced(function* (input) {
|
|
|
34015
34056
|
return checkout;
|
|
34016
34057
|
if (primary.path === checkout.path)
|
|
34017
34058
|
return checkout;
|
|
34018
|
-
const main = primary.bare ? undefined : yield*
|
|
34059
|
+
const main = primary.bare ? undefined : yield* repository(primary.path).pipe(exports_Effect.catchIf((error2) => missing3(error2) || notRepository(error2), () => exports_Effect.succeed(undefined)));
|
|
34019
34060
|
return main?.commonDir === checkout.commonDir ? main : { ...checkout, name: path.basename(primary.path) };
|
|
34020
34061
|
});
|
|
34021
34062
|
var listBranches = exports_Effect.fnUntraced(function* (repoPath) {
|
|
@@ -34113,7 +34154,7 @@ var isolatedEnv = () => {
|
|
|
34113
34154
|
};
|
|
34114
34155
|
var jj = (repo, ...args2) => run4("jj", ["-R", repo, "--no-pager", "--color=never", ...args2], undefined, isolatedEnv());
|
|
34115
34156
|
var inventory = (repo, ...args2) => jj(repo, "--ignore-working-copy", "--at-op=@", ...args2);
|
|
34116
|
-
var
|
|
34157
|
+
var checkVersion = exports_Effect.fnUntraced(function* () {
|
|
34117
34158
|
for (const [program, minimum] of [["jj", [0, 46]], ["git", [2, 42]]]) {
|
|
34118
34159
|
const output = yield* run4(program, ["--version"], undefined, isolatedEnv()).pipe(exports_Effect.catchIf((error2) => missing4(error2), () => fail18(`${program} executable not found on this Rex host; install ${program} >= ${minimum.join(".")} and ensure it is on the popup/task PATH`)));
|
|
34119
34160
|
const match9 = /\b(\d+)\.(\d+)(?:\.\d+)?\b/.exec(output);
|
|
@@ -34122,6 +34163,9 @@ var version = exports_Effect.fnUntraced(function* () {
|
|
|
34122
34163
|
}
|
|
34123
34164
|
}
|
|
34124
34165
|
});
|
|
34166
|
+
var ToolValidation = exports_Context.Reference("rex-worktrees/JjToolValidation", { defaultValue: () => checkVersion() });
|
|
34167
|
+
var version = exports_Effect.flatten(ToolValidation);
|
|
34168
|
+
var withToolValidation = exports_Effect.provideServiceEffect(ToolValidation, exports_Effect.cached(checkVersion()));
|
|
34125
34169
|
var workspaceTemplate = 'json({"name" => name, "path" => root, "commitId" => self.target().commit_id(), "changeId" => self.target().change_id()}) ++ "\\n"';
|
|
34126
34170
|
var revisionTemplate = 'json({"commitId" => commit_id, "changeId" => change_id, "description" => description, "conflict" => self.conflict()}) ++ "\\n"';
|
|
34127
34171
|
var workspaceRow = exports_Schema.Struct({ name: JjWorkspaceNameSchema, path: exports_Schema.NullOr(exports_Schema.String), commitId: JjCommitIdSchema, changeId: JjChangeIdSchema });
|
|
@@ -34179,7 +34223,7 @@ var metadata = exports_Effect.fnUntraced(function* (dot) {
|
|
|
34179
34223
|
return target;
|
|
34180
34224
|
});
|
|
34181
34225
|
var repository2 = exports_Effect.fnUntraced(function* (input) {
|
|
34182
|
-
yield* version
|
|
34226
|
+
yield* version;
|
|
34183
34227
|
const path = yield* exports_Path.Path;
|
|
34184
34228
|
const { directory, dot } = yield* marker(input);
|
|
34185
34229
|
return { vcs: "jj", path: directory, commonDir: yield* metadata(dot), name: path.basename(directory) };
|
|
@@ -34229,9 +34273,15 @@ var resolveRevision = exports_Effect.fnUntraced(function* (repo, expression) {
|
|
|
34229
34273
|
});
|
|
34230
34274
|
var listRevisions = exports_Effect.fnUntraced(function* (repo) {
|
|
34231
34275
|
const current = yield* repository2(repo);
|
|
34232
|
-
const
|
|
34276
|
+
const candidates = ["@-", "bookmarks()", "remote_bookmarks()"];
|
|
34277
|
+
const mainlineQuery = inventory(current.path, "log", "-r", "trunk()", "--no-graph", "--limit", "2", "-T", revisionTemplate).pipe(exports_Effect.catchIf((error2) => exports_Schema.is(CommandError)(error2) && error2.program === "jj" && /^Error: (?:Failed to (?:parse|resolve) revset|Invalid revset|Revision |Revset |Cannot resolve |No such revision)/i.test(error2.stderr), () => exports_Effect.succeed("")));
|
|
34278
|
+
const [bookmarkText, mainline, ...candidateText] = yield* exports_Effect.all([
|
|
34279
|
+
inventory(current.path, "bookmark", "list", "-T", bookmarkTemplate),
|
|
34280
|
+
mainlineQuery,
|
|
34281
|
+
...candidates.map((expression) => inventory(current.path, "log", "-r", expression, "--no-graph", "--limit", "40", "-T", revisionTemplate))
|
|
34282
|
+
], { concurrency: 4 });
|
|
34283
|
+
const bookmarks = (yield* rows(bookmarkRow, bookmarkText)).filter((item) => item.present && !item.conflict && /^[0-9a-f]{40,64}$/.test(item.target));
|
|
34233
34284
|
const choices = [];
|
|
34234
|
-
const mainline = yield* inventory(current.path, "log", "-r", "trunk()", "--no-graph", "--limit", "2", "-T", revisionTemplate).pipe(exports_Effect.catchIf((error2) => exports_Schema.is(CommandError)(error2) && error2.program === "jj" && /^Error: (?:Failed to (?:parse|resolve) revset|Invalid revset|Revision |Revset |Cannot resolve |No such revision)/i.test(error2.stderr), () => exports_Effect.succeed("")));
|
|
34235
34285
|
const mainlineRows = yield* rows(revisionRow, mainline);
|
|
34236
34286
|
if (mainlineRows.length === 1 && !mainlineRows[0].conflict && !/^0+$/.test(mainlineRows[0].commitId)) {
|
|
34237
34287
|
const item = mainlineRows[0];
|
|
@@ -34241,9 +34291,8 @@ var listRevisions = exports_Effect.fnUntraced(function* (repo) {
|
|
|
34241
34291
|
revision: { commitId: item.commitId, changeId: item.changeId, description: item.description }
|
|
34242
34292
|
});
|
|
34243
34293
|
}
|
|
34244
|
-
const
|
|
34245
|
-
|
|
34246
|
-
const raw = yield* inventory(current.path, "log", "-r", expression, "--no-graph", "--limit", "40", "-T", revisionTemplate);
|
|
34294
|
+
for (const [index2, expression] of candidates.entries()) {
|
|
34295
|
+
const raw = candidateText[index2];
|
|
34247
34296
|
for (const item of yield* rows(revisionRow, raw)) {
|
|
34248
34297
|
if (item.conflict || choices.some((choice) => choice.revision.commitId === item.commitId))
|
|
34249
34298
|
continue;
|
|
@@ -34315,7 +34364,7 @@ var newChange = exports_Effect.fnUntraced(function* (repo, base) {
|
|
|
34315
34364
|
return after;
|
|
34316
34365
|
});
|
|
34317
34366
|
var cloneRepository2 = exports_Effect.fnUntraced(function* (url, destination) {
|
|
34318
|
-
yield* version
|
|
34367
|
+
yield* version;
|
|
34319
34368
|
const safe = yield* exports_Effect.try({ try: () => safeOrigin(url, true), catch: () => new AppError({ message: "Unsafe JJ clone URL" }) });
|
|
34320
34369
|
const spawner = yield* exports_ChildProcessSpawner.ChildProcessSpawner;
|
|
34321
34370
|
const child = yield* spawner.spawn(exports_ChildProcess.make("jj", ["git", "clone", safe, destination], {
|
|
@@ -34361,25 +34410,13 @@ var discoverProjects = exports_Effect.fnUntraced(function* (roots, explicitProje
|
|
|
34361
34410
|
if (!(yield* fs.exists(root)))
|
|
34362
34411
|
continue;
|
|
34363
34412
|
candidates.push(root);
|
|
34364
|
-
|
|
34365
|
-
|
|
34366
|
-
if (!(yield* fs.exists(first)))
|
|
34367
|
-
continue;
|
|
34368
|
-
const info2 = yield* fs.stat(first);
|
|
34369
|
-
if (info2.type !== "Directory")
|
|
34370
|
-
continue;
|
|
34371
|
-
candidates.push(first);
|
|
34372
|
-
for (const child of yield* fs.readDirectory(first)) {
|
|
34373
|
-
const second = path.join(first, child);
|
|
34374
|
-
if ((yield* fs.exists(second)) && (yield* fs.stat(second)).type === "Directory")
|
|
34375
|
-
candidates.push(second);
|
|
34376
|
-
}
|
|
34377
|
-
}
|
|
34413
|
+
const markers = yield* fs.glob("{*,*/*}/{.git,.jj}", { root, dot: true });
|
|
34414
|
+
candidates.push(...markers.map((marker2) => path.join(root, path.dirname(marker2))));
|
|
34378
34415
|
}
|
|
34379
34416
|
const found = [];
|
|
34380
34417
|
const seen = new Set;
|
|
34381
|
-
|
|
34382
|
-
|
|
34418
|
+
const inspected = yield* exports_Effect.forEach(new Set(candidates), (candidate) => project3(candidate).pipe(exports_Effect.catchIf((error2) => missing5(error2) || notRepository(error2), () => exports_Effect.succeed(undefined))), { concurrency: 4 });
|
|
34419
|
+
for (const repo of inspected) {
|
|
34383
34420
|
if (repo && !seen.has(`${repo.vcs}\x00${repo.commonDir}`)) {
|
|
34384
34421
|
seen.add(`${repo.vcs}\x00${repo.commonDir}`);
|
|
34385
34422
|
found.push(repo);
|
|
@@ -34452,58 +34489,6 @@ var associations = exports_Effect.gen(function* () {
|
|
|
34452
34489
|
return result4;
|
|
34453
34490
|
});
|
|
34454
34491
|
|
|
34455
|
-
// src/config.ts
|
|
34456
|
-
var loadConfig = exports_Effect.gen(function* () {
|
|
34457
|
-
const fs = yield* exports_FileSystem.FileSystem;
|
|
34458
|
-
const path = yield* exports_Path.Path;
|
|
34459
|
-
const home = process.env.HOME;
|
|
34460
|
-
if (!home)
|
|
34461
|
-
return yield* new AppError({ message: "HOME is required" });
|
|
34462
|
-
const configHome = process.env.XDG_CONFIG_HOME || path.join(home, ".config");
|
|
34463
|
-
if (!path.isAbsolute(configHome))
|
|
34464
|
-
return yield* new AppError({ message: "Config home must be absolute" });
|
|
34465
|
-
const filename = path.join(configHome, "rex-worktrees", "config.json");
|
|
34466
|
-
const exists2 = yield* fs.exists(filename);
|
|
34467
|
-
const values2 = exists2 ? yield* fs.readFileString(filename).pipe(exports_Effect.flatMap(exports_Schema.decodeUnknownEffect(exports_Schema.fromJsonString(ConfigSchema)))) : { roots: undefined, projects: undefined, worktreeRoot: undefined };
|
|
34468
|
-
const expand = (value3) => {
|
|
34469
|
-
const expanded = value3 === "~" ? home : value3.startsWith("~/") ? path.join(home, value3.slice(2)) : value3;
|
|
34470
|
-
return path.resolve(path.dirname(filename), expanded);
|
|
34471
|
-
};
|
|
34472
|
-
const config = {
|
|
34473
|
-
roots: (values2.roots ?? []).map(expand),
|
|
34474
|
-
projects: (values2.projects ?? []).map((entry) => expand(typeof entry === "string" ? entry : entry.path)),
|
|
34475
|
-
worktreeRoot: values2.worktreeRoot === undefined ? undefined : expand(values2.worktreeRoot),
|
|
34476
|
-
projectRoots: (values2.projects ?? []).flatMap((entry) => typeof entry === "string" || entry.worktreeRoot === undefined ? [] : [{ path: expand(entry.path), worktreeRoot: expand(entry.worktreeRoot) }])
|
|
34477
|
-
};
|
|
34478
|
-
return config;
|
|
34479
|
-
});
|
|
34480
|
-
var resolveCloneRoot = exports_Effect.fnUntraced(function* (roots, projects, stateRoot) {
|
|
34481
|
-
const path = yield* exports_Path.Path;
|
|
34482
|
-
if (roots[0])
|
|
34483
|
-
return roots[0];
|
|
34484
|
-
const remembered = yield* rememberedCloneRoot(stateRoot);
|
|
34485
|
-
if (remembered)
|
|
34486
|
-
return remembered;
|
|
34487
|
-
const parents = new Set(projects.map((project4) => path.dirname(project4.path)));
|
|
34488
|
-
if (parents.size === 1)
|
|
34489
|
-
return [...parents][0];
|
|
34490
|
-
const home = process.env.HOME;
|
|
34491
|
-
if (!home || !path.isAbsolute(home))
|
|
34492
|
-
return yield* new AppError({ message: "Target HOME must be an absolute directory" });
|
|
34493
|
-
return home;
|
|
34494
|
-
});
|
|
34495
|
-
var resolveWorktreeRoot = exports_Effect.fnUntraced(function* (repoPath) {
|
|
34496
|
-
const config = yield* loadConfig;
|
|
34497
|
-
const target = yield* project3(repoPath);
|
|
34498
|
-
for (const entry of config.projectRoots) {
|
|
34499
|
-
const candidate = yield* exports_Effect.catchIf(exports_Effect.catchIf(repository3(entry.path), (error2) => missing3(error2), () => exports_Effect.succeed(undefined)), (error2) => notRepository(error2), () => exports_Effect.succeed(undefined));
|
|
34500
|
-
if (candidate?.vcs === target.vcs && candidate.commonDir === target.commonDir)
|
|
34501
|
-
return entry.worktreeRoot;
|
|
34502
|
-
}
|
|
34503
|
-
const path = yield* exports_Path.Path;
|
|
34504
|
-
return config.worktreeRoot === undefined ? undefined : path.join(config.worktreeRoot, target.name);
|
|
34505
|
-
});
|
|
34506
|
-
|
|
34507
34492
|
// src/rex.ts
|
|
34508
34493
|
import { hostname } from "os";
|
|
34509
34494
|
var localName = hostname().toLowerCase().replace(/\.$/, "").replace(/\.local$/, "");
|
|
@@ -34540,7 +34525,7 @@ var machinesRegistry = exports_Effect.gen(function* () {
|
|
|
34540
34525
|
const path = yield* exports_Path.Path;
|
|
34541
34526
|
return yield* parse3(RexRegistrySchema, yield* run4(yield* binary(path), ["hosts", "list", "--json"], undefined, nativeEnv()));
|
|
34542
34527
|
});
|
|
34543
|
-
var
|
|
34528
|
+
var readLocalIdentity = exports_Effect.gen(function* () {
|
|
34544
34529
|
const path = yield* exports_Path.Path;
|
|
34545
34530
|
const endpoint = process.env.REX_WORKTREES_LOCAL_ENDPOINT;
|
|
34546
34531
|
if (endpoint !== undefined && !endpoint.startsWith("unix:///")) {
|
|
@@ -34552,6 +34537,9 @@ var localIdentity = exports_Effect.gen(function* () {
|
|
|
34552
34537
|
}
|
|
34553
34538
|
return identity3;
|
|
34554
34539
|
});
|
|
34540
|
+
var LocalIdentity = exports_Context.Reference("rex-worktrees/LocalIdentity", { defaultValue: () => readLocalIdentity });
|
|
34541
|
+
var localIdentity = exports_Effect.flatten(LocalIdentity);
|
|
34542
|
+
var withLocalIdentity = exports_Effect.provideServiceEffect(LocalIdentity, exports_Effect.cached(readLocalIdentity));
|
|
34555
34543
|
var localEndpoint = exports_Effect.gen(function* () {
|
|
34556
34544
|
const explicit = process.env.REX_WORKTREES_LOCAL_ENDPOINT;
|
|
34557
34545
|
if (explicit !== undefined) {
|
|
@@ -34605,89 +34593,14 @@ var originDirectory = exports_Effect.fnUntraced(function* (sessionId, blockId) {
|
|
|
34605
34593
|
const processInfo = yield* parse3(RexProcessSchema, yield* rex(["block", "call", "-s", sessionId, "-b", blockId, "process"]));
|
|
34606
34594
|
const cwd = processInfo.foreground?.cwd;
|
|
34607
34595
|
return cwd?.startsWith("/") && !cwd.includes("\x00") ? cwd : undefined;
|
|
34608
|
-
});
|
|
34609
|
-
var
|
|
34610
|
-
|
|
34611
|
-
|
|
34612
|
-
|
|
34613
|
-
|
|
34614
|
-
|
|
34615
|
-
|
|
34616
|
-
const next = [(1 - width2) / 2, (1 - height) / 2, width2, height];
|
|
34617
|
-
return Math.abs(width2 - bounds[2]) > 0.000000001 || Math.abs(height - bounds[3]) > 0.000000001 ? next : undefined;
|
|
34618
|
-
};
|
|
34619
|
-
var makePopupSizer = exports_Effect.gen(function* () {
|
|
34620
|
-
const path = yield* exports_Path.Path;
|
|
34621
|
-
const spawner = yield* exports_ChildProcessSpawner.ChildProcessSpawner;
|
|
34622
|
-
let endpoint;
|
|
34623
|
-
const localRex = exports_Effect.fnUntraced(function* (args2) {
|
|
34624
|
-
endpoint ??= yield* localEndpoint.pipe(exports_Effect.provideService(exports_Path.Path, path), exports_Effect.provideService(exports_ChildProcessSpawner.ChildProcessSpawner, spawner));
|
|
34625
|
-
return yield* run4(yield* binary(path), ["-S", endpoint, "--autostart=false", ...args2], undefined, nativeEnv()).pipe(exports_Effect.provideService(exports_ChildProcessSpawner.ChildProcessSpawner, spawner));
|
|
34626
|
-
});
|
|
34627
|
-
const sessionId = process.env.REX_SESSION === undefined ? undefined : yield* exports_Schema.decodeUnknownEffect(SessionIdSchema)(process.env.REX_SESSION);
|
|
34628
|
-
const blockId = process.env.REX_BLOCK === undefined ? undefined : yield* exports_Schema.decodeUnknownEffect(BlockIdSchema)(process.env.REX_BLOCK);
|
|
34629
|
-
let pending;
|
|
34630
|
-
let settled;
|
|
34631
|
-
let warning;
|
|
34632
|
-
let targetSize;
|
|
34633
|
-
let attempts = 0;
|
|
34634
|
-
const resize = exports_Effect.fnUntraced(function* (preferred, observed) {
|
|
34635
|
-
if (!sessionId || !blockId || !observed.columns || !observed.rows)
|
|
34636
|
-
return;
|
|
34637
|
-
const desired = `${preferred.columns}x${preferred.rows}`;
|
|
34638
|
-
if (targetSize !== desired) {
|
|
34639
|
-
targetSize = desired;
|
|
34640
|
-
settled = undefined;
|
|
34641
|
-
attempts = 0;
|
|
34642
|
-
}
|
|
34643
|
-
const seen = `${observed.columns}x${observed.rows}`;
|
|
34644
|
-
if (seen === pending)
|
|
34645
|
-
return warning;
|
|
34646
|
-
if (pending !== undefined && seen !== pending)
|
|
34647
|
-
pending = undefined;
|
|
34648
|
-
const target = `${preferred.columns}x${preferred.rows}:${seen}`;
|
|
34649
|
-
if (settled === target)
|
|
34650
|
-
return warning;
|
|
34651
|
-
if (attempts >= 5)
|
|
34652
|
-
return warning = observed.rows < preferred.rows || observed.columns < 20 ? "Could not fit Rex popup: reached the native resize limit; enlarge the Rex window" : undefined;
|
|
34653
|
-
const view = yield* parse3(RexViewSchema, yield* localRex(["api", "call", "-s", sessionId, "session.view", JSON.stringify({ session_id: sessionId })]));
|
|
34654
|
-
const layer12 = view.windows.flatMap((window) => window.layers).find((layer13) => layer13.kind === "floating" && layer13.blocks.some((block) => block.block_id === blockId));
|
|
34655
|
-
if (!layer12?.layer_id || !layer12.bounds) {
|
|
34656
|
-
settled = target;
|
|
34657
|
-
return;
|
|
34658
|
-
}
|
|
34659
|
-
const size8 = yield* parse3(RexTerminalSizeSchema, yield* localRex(["block", "call", "-s", sessionId, "-b", blockId, "size"]));
|
|
34660
|
-
if (!size8.owner)
|
|
34661
|
-
return;
|
|
34662
|
-
if (size8.columns !== observed.columns || size8.rows !== observed.rows) {
|
|
34663
|
-
settled = target;
|
|
34664
|
-
return;
|
|
34665
|
-
}
|
|
34666
|
-
const bounds = fitPopupBounds(layer12.bounds, preferred, observed);
|
|
34667
|
-
if (!bounds) {
|
|
34668
|
-
settled = target;
|
|
34669
|
-
attempts = 0;
|
|
34670
|
-
return warning = observed.rows < preferred.rows || observed.columns < 20 ? "Could not fit Rex popup: window is too small for the form" : undefined;
|
|
34671
|
-
}
|
|
34672
|
-
yield* parse3(RexResizedSchema, yield* localRex([
|
|
34673
|
-
"api",
|
|
34674
|
-
"call",
|
|
34675
|
-
"-s",
|
|
34676
|
-
sessionId,
|
|
34677
|
-
"session.resize_layer",
|
|
34678
|
-
JSON.stringify({ session_id: sessionId, layer_id: layer12.layer_id, bounds })
|
|
34679
|
-
]));
|
|
34680
|
-
attempts++;
|
|
34681
|
-
pending = seen;
|
|
34682
|
-
warning = undefined;
|
|
34683
|
-
return;
|
|
34684
|
-
}, (effect2, preferred, observed) => effect2.pipe(exports_Effect.catch((error2) => exports_Effect.sync(() => {
|
|
34685
|
-
settled = `${preferred.columns}x${preferred.rows}:${observed.columns}x${observed.rows}`;
|
|
34686
|
-
return warning = `Could not fit Rex popup: ${exports_Cause.pretty(exports_Cause.fail(error2))}`;
|
|
34687
|
-
}))));
|
|
34688
|
-
return resize;
|
|
34689
|
-
});
|
|
34690
|
-
var commandWithPath = (command) => process.env.PATH ? ["/usr/bin/env", `PATH=${process.env.PATH}`, ...command] : command;
|
|
34596
|
+
}, withLocalIdentity);
|
|
34597
|
+
var commandWithPath = (command) => {
|
|
34598
|
+
const env = [
|
|
34599
|
+
...process.env.PATH ? [`PATH=${process.env.PATH}`] : [],
|
|
34600
|
+
...process.env.REX_WORKTREES_CONFIG !== undefined ? [`REX_WORKTREES_CONFIG=${process.env.REX_WORKTREES_CONFIG}`] : []
|
|
34601
|
+
];
|
|
34602
|
+
return env.length ? ["/usr/bin/env", ...env, ...command] : command;
|
|
34603
|
+
};
|
|
34691
34604
|
var createTab = exports_Effect.fnUntraced(function* (sessionId, name, cwd, command) {
|
|
34692
34605
|
const result4 = yield* parse3(RexCreatedSchema, yield* rex(["window", "new", "-s", sessionId, name, "-c", cwd, "--shell=none", "--keep-open", "--json", "--", ...commandWithPath(command)]));
|
|
34693
34606
|
const blockId = result4.block_ids[0];
|
|
@@ -34738,7 +34651,7 @@ var openPopup = exports_Effect.fnUntraced(function* (command, sessionId, origin2
|
|
|
34738
34651
|
const clients = (yield* parse3(RexClientsSchema, yield* localRex(["client", "ls", "--json"]))).clients.filter((client) => client.info?.kind === "app" && client.connection_state === "connected");
|
|
34739
34652
|
const clientId = [sourceOwner, origin2.clientId].find((id2) => id2 && clients.some((client) => client.client_id === id2));
|
|
34740
34653
|
const popupCommand = clientId ? [...command, "--managed-popup", "--origin-client", clientId] : [...command, "--managed-popup"];
|
|
34741
|
-
const width2 = 0.68, height = 0.
|
|
34654
|
+
const width2 = 0.68, height = 0.24;
|
|
34742
34655
|
const args2 = {
|
|
34743
34656
|
session_id: sessionId,
|
|
34744
34657
|
window_id: windowId,
|
|
@@ -34768,6 +34681,56 @@ var closeManagedPopup = exports_Effect.gen(function* () {
|
|
|
34768
34681
|
yield* localRex(["block", "close", "-s", sessionId, blockId]);
|
|
34769
34682
|
});
|
|
34770
34683
|
|
|
34684
|
+
// src/config.ts
|
|
34685
|
+
var loadConfig = exports_Effect.gen(function* () {
|
|
34686
|
+
const path = yield* exports_Path.Path;
|
|
34687
|
+
const raw = process.env.REX_WORKTREES_CONFIG;
|
|
34688
|
+
const { config: values2, directory } = raw === undefined ? yield* rex(["do", "worktrees_config", "--json"]).pipe(exports_Effect.mapError(() => new AppError({ message: "Native Rex worktrees_config is unavailable; register rex-worktrees.setup in this machine's Rex config and reload it" })), exports_Effect.flatMap((response) => exports_Schema.decodeUnknownEffect(RexNativeConfigResponseSchema)(response))) : yield* exports_Schema.decodeUnknownEffect(exports_Schema.fromJsonString(NativeConfigSchema))(raw);
|
|
34689
|
+
if (!path.isAbsolute(directory) || directory.includes("\x00")) {
|
|
34690
|
+
return yield* new AppError({ message: "Native Rex config directory must be an absolute path" });
|
|
34691
|
+
}
|
|
34692
|
+
const home = process.env.HOME;
|
|
34693
|
+
if (!home || !path.isAbsolute(home))
|
|
34694
|
+
return yield* new AppError({ message: "HOME must be an absolute directory" });
|
|
34695
|
+
const expand = (value3) => {
|
|
34696
|
+
const expanded = value3 === "~" ? home : value3.startsWith("~/") ? path.join(home, value3.slice(2)) : value3;
|
|
34697
|
+
return path.resolve(directory, expanded);
|
|
34698
|
+
};
|
|
34699
|
+
const config = {
|
|
34700
|
+
roots: (values2.roots ?? []).map(expand),
|
|
34701
|
+
projects: (values2.projects ?? []).map((entry) => expand(typeof entry === "string" ? entry : entry.path)),
|
|
34702
|
+
worktreeRoot: values2.worktreeRoot === undefined ? undefined : expand(values2.worktreeRoot),
|
|
34703
|
+
projectRoots: (values2.projects ?? []).flatMap((entry) => typeof entry === "string" || entry.worktreeRoot === undefined ? [] : [{ path: expand(entry.path), worktreeRoot: expand(entry.worktreeRoot) }])
|
|
34704
|
+
};
|
|
34705
|
+
return config;
|
|
34706
|
+
});
|
|
34707
|
+
var resolveCloneRoot = exports_Effect.fnUntraced(function* (roots, projects, stateRoot) {
|
|
34708
|
+
const path = yield* exports_Path.Path;
|
|
34709
|
+
if (roots[0])
|
|
34710
|
+
return roots[0];
|
|
34711
|
+
const remembered = yield* rememberedCloneRoot(stateRoot);
|
|
34712
|
+
if (remembered)
|
|
34713
|
+
return remembered;
|
|
34714
|
+
const parents = new Set(projects.map((project4) => path.dirname(project4.path)));
|
|
34715
|
+
if (parents.size === 1)
|
|
34716
|
+
return [...parents][0];
|
|
34717
|
+
const home = process.env.HOME;
|
|
34718
|
+
if (!home || !path.isAbsolute(home))
|
|
34719
|
+
return yield* new AppError({ message: "Target HOME must be an absolute directory" });
|
|
34720
|
+
return home;
|
|
34721
|
+
});
|
|
34722
|
+
var resolveWorktreeRoot = exports_Effect.fnUntraced(function* (repoPath) {
|
|
34723
|
+
const config = yield* loadConfig;
|
|
34724
|
+
const target = yield* project3(repoPath);
|
|
34725
|
+
for (const entry of config.projectRoots) {
|
|
34726
|
+
const candidate = yield* repository3(entry.path).pipe(exports_Effect.catchIf((error2) => missing3(error2) || notRepository(error2), () => exports_Effect.succeed(undefined)));
|
|
34727
|
+
if (candidate?.vcs === target.vcs && candidate.commonDir === target.commonDir)
|
|
34728
|
+
return entry.worktreeRoot;
|
|
34729
|
+
}
|
|
34730
|
+
const path = yield* exports_Path.Path;
|
|
34731
|
+
return config.worktreeRoot === undefined ? undefined : path.join(config.worktreeRoot, target.name);
|
|
34732
|
+
});
|
|
34733
|
+
|
|
34771
34734
|
// src/worktrees.ts
|
|
34772
34735
|
import { constants as constants2 } from "fs";
|
|
34773
34736
|
import { access as access3 } from "fs/promises";
|
|
@@ -35122,7 +35085,7 @@ var cloneDestination = exports_Effect.fnUntraced(function* (destination, url, vc
|
|
|
35122
35085
|
const repo = yield* repository3(current).pipe(exports_Effect.catchIf((error2) => missing3(error2) || exports_Schema.is(CommandError)(error2) && error2.args.includes("rev-parse"), () => fail19(`Clone destination already exists and is not a repository: ${current}`)));
|
|
35123
35086
|
if (repo.path !== current || repo.vcs !== vcs)
|
|
35124
35087
|
return yield* fail19(`Clone destination is not the requested ${vcs} repository: ${current}`);
|
|
35125
|
-
const actual = repo.vcs === "git" ? yield* origin(current
|
|
35088
|
+
const actual = repo.vcs === "git" ? yield* origin(current) : (yield* cloneSource2(current, sourceHostId ?? (yield* localHost).id)).url;
|
|
35126
35089
|
if (actual !== url)
|
|
35127
35090
|
return yield* fail19(`Clone destination belongs to a different origin: ${current}`);
|
|
35128
35091
|
return repo.commonDir;
|
|
@@ -35278,7 +35241,7 @@ var prepareCloneCheckout = exports_Effect.fnUntraced(function* (plan) {
|
|
|
35278
35241
|
const repo = yield* repository3(plan.repo);
|
|
35279
35242
|
if (repo.path !== plan.repo || repo.vcs !== plan.vcs || plan.existing && repo.commonDir !== plan.commonDir)
|
|
35280
35243
|
return yield* fail19(`Clone repository changed; retained at ${plan.repo}`);
|
|
35281
|
-
const actual = repo.vcs === "git" ? yield* origin(repo.path
|
|
35244
|
+
const actual = repo.vcs === "git" ? yield* origin(repo.path) : (yield* cloneSource2(repo.path, plan.hostId)).url;
|
|
35282
35245
|
if (actual !== url)
|
|
35283
35246
|
return yield* fail19(`Clone origin changed; retained at ${plan.repo}`);
|
|
35284
35247
|
if (plan.vcs === "jj") {
|
|
@@ -35360,15 +35323,20 @@ var dispatchHost = exports_Effect.fnUntraced(function* (request3, command) {
|
|
|
35360
35323
|
if (host.id !== request3.hostId)
|
|
35361
35324
|
return yield* exports_Effect.fail(new AppError({ message: `Wrong Rex host: expected ${request3.hostId}, got ${host.id}` }));
|
|
35362
35325
|
const path = yield* exports_Path.Path;
|
|
35363
|
-
const paths = request3.kind === "discover" ? request3.context ? [request3.context] : [] : request3.kind === "project" ? [request3.path] : request3.kind === "clone-plan" || request3.kind === "clone-launch" ? [request3.input.repo] : request3.kind === "plan" || request3.kind === "launch" ? [request3.input.repo, ...request3.input.path ? [request3.input.path] : []] : [request3.repo];
|
|
35326
|
+
const paths = request3.kind === "sessions" ? [] : request3.kind === "discover" ? request3.context ? [request3.context] : [] : request3.kind === "project" ? [request3.path] : request3.kind === "clone-plan" || request3.kind === "clone-launch" ? [request3.input.repo] : request3.kind === "plan" || request3.kind === "launch" ? [request3.input.repo, ...request3.input.path ? [request3.input.path] : []] : [request3.repo];
|
|
35364
35327
|
if (paths.some((value3) => !path.isAbsolute(value3)))
|
|
35365
35328
|
return yield* exports_Effect.fail(new AppError({ message: "Destination repository and worktree paths must be absolute" }));
|
|
35366
35329
|
const identity3 = { version: 4, hostId: host.id };
|
|
35367
35330
|
let result4;
|
|
35368
35331
|
switch (request3.kind) {
|
|
35332
|
+
case "sessions": {
|
|
35333
|
+
const found = yield* exports_Effect.all({ sessions: listSessions, clients: listClients }, { concurrency: 2 });
|
|
35334
|
+
result4 = { ...identity3, kind: "sessions", ...found };
|
|
35335
|
+
break;
|
|
35336
|
+
}
|
|
35369
35337
|
case "discover": {
|
|
35370
35338
|
const config = yield* loadConfig;
|
|
35371
|
-
const checkoutEffect = request3.context ?
|
|
35339
|
+
const checkoutEffect = request3.context ? repository3(request3.context).pipe(exports_Effect.catchIf((error2) => missing3(error2) || notRepository(error2), () => exports_Effect.succeed(undefined))) : exports_Effect.succeed(undefined);
|
|
35372
35340
|
const { checkout, sessions, clients, projects } = yield* exports_Effect.all({
|
|
35373
35341
|
checkout: checkoutEffect,
|
|
35374
35342
|
sessions: listSessions,
|
|
@@ -35396,14 +35364,17 @@ var dispatchHost = exports_Effect.fnUntraced(function* (request3, command) {
|
|
|
35396
35364
|
}
|
|
35397
35365
|
const checkout = yield* repository3(request3.path);
|
|
35398
35366
|
const canonical2 = yield* project3(request3.path);
|
|
35367
|
+
const inventory2 = yield* exports_Effect.all({
|
|
35368
|
+
worktrees: canonical2.vcs === "git" ? listWorktrees(canonical2.path) : listWorkspaces(canonical2.path),
|
|
35369
|
+
branches: canonical2.vcs === "git" ? listBranches(canonical2.path) : exports_Effect.succeed([]),
|
|
35370
|
+
revisions: canonical2.vcs === "jj" ? listRevisions(canonical2.path) : exports_Effect.succeed([])
|
|
35371
|
+
}, { concurrency: 4 });
|
|
35399
35372
|
result4 = {
|
|
35400
35373
|
...identity3,
|
|
35401
35374
|
kind: "project",
|
|
35402
35375
|
project: canonical2,
|
|
35403
35376
|
checkout,
|
|
35404
|
-
|
|
35405
|
-
branches: canonical2.vcs === "git" ? yield* listBranches(canonical2.path) : [],
|
|
35406
|
-
revisions: canonical2.vcs === "jj" ? yield* listRevisions(canonical2.path) : []
|
|
35377
|
+
...inventory2
|
|
35407
35378
|
};
|
|
35408
35379
|
break;
|
|
35409
35380
|
}
|
|
@@ -35418,13 +35389,16 @@ var dispatchHost = exports_Effect.fnUntraced(function* (request3, command) {
|
|
|
35418
35389
|
}
|
|
35419
35390
|
case "worktrees": {
|
|
35420
35391
|
const repo = yield* repository3(request3.repo);
|
|
35392
|
+
const inventory2 = yield* exports_Effect.all({
|
|
35393
|
+
worktrees: repo.vcs === "git" ? listWorktrees(repo.path) : listWorkspaces(repo.path),
|
|
35394
|
+
branches: repo.vcs === "git" ? listBranches(repo.path) : exports_Effect.succeed([]),
|
|
35395
|
+
revisions: repo.vcs === "jj" ? listRevisions(repo.path) : exports_Effect.succeed([])
|
|
35396
|
+
}, { concurrency: 4 });
|
|
35421
35397
|
result4 = {
|
|
35422
35398
|
...identity3,
|
|
35423
35399
|
kind: "worktrees",
|
|
35424
35400
|
repository: repo,
|
|
35425
|
-
|
|
35426
|
-
branches: repo.vcs === "git" ? yield* listBranches(repo.path) : [],
|
|
35427
|
-
revisions: repo.vcs === "jj" ? yield* listRevisions(repo.path) : []
|
|
35401
|
+
...inventory2
|
|
35428
35402
|
};
|
|
35429
35403
|
break;
|
|
35430
35404
|
}
|
|
@@ -35449,7 +35423,7 @@ var dispatchHost = exports_Effect.fnUntraced(function* (request3, command) {
|
|
|
35449
35423
|
break;
|
|
35450
35424
|
}
|
|
35451
35425
|
return result4;
|
|
35452
|
-
});
|
|
35426
|
+
}, withLocalIdentity, withToolValidation);
|
|
35453
35427
|
var hostRequest = exports_Effect.fnUntraced(function* (raw, command) {
|
|
35454
35428
|
const request3 = yield* exports_Schema.decodeUnknownEffect(exports_Schema.fromJsonString(RequestSchema))(raw);
|
|
35455
35429
|
return yield* dispatchHost(request3, command);
|
|
@@ -35502,19 +35476,26 @@ var request3 = exports_Effect.fnUntraced(function* (host, command, body) {
|
|
|
35502
35476
|
}
|
|
35503
35477
|
return yield* connectedRequest(host, command, body);
|
|
35504
35478
|
});
|
|
35505
|
-
var
|
|
35506
|
-
|
|
35507
|
-
|
|
35508
|
-
|
|
35509
|
-
|
|
35510
|
-
return discovery(result4);
|
|
35479
|
+
var inspectSessions = exports_Effect.fnUntraced(function* (host, command) {
|
|
35480
|
+
const result4 = yield* request3(host, command, { kind: "sessions" });
|
|
35481
|
+
if (result4.kind !== "sessions")
|
|
35482
|
+
return yield* fail20("Unexpected sessions response");
|
|
35483
|
+
return { sessions: result4.sessions, clients: result4.clients };
|
|
35511
35484
|
});
|
|
35512
35485
|
var connectAndDiscover = exports_Effect.fnUntraced(function* (machine, command, context3) {
|
|
35513
35486
|
const host = yield* connectMachine(machine);
|
|
35514
35487
|
const result4 = yield* connectedRequest(host, command, { kind: "discover", ...host.local && context3 ? { context: context3 } : {} });
|
|
35515
35488
|
if (result4.kind !== "discover")
|
|
35516
35489
|
return yield* fail20("Unexpected discovery response");
|
|
35517
|
-
return {
|
|
35490
|
+
return {
|
|
35491
|
+
host,
|
|
35492
|
+
sessions: result4.sessions,
|
|
35493
|
+
clients: result4.clients,
|
|
35494
|
+
projects: result4.projects,
|
|
35495
|
+
roots: result4.roots ?? [],
|
|
35496
|
+
cloneRoot: result4.cloneRoot,
|
|
35497
|
+
...result4.checkout ? { checkout: result4.checkout } : {}
|
|
35498
|
+
};
|
|
35518
35499
|
});
|
|
35519
35500
|
var inspectProject = exports_Effect.fnUntraced(function* (host, command, path) {
|
|
35520
35501
|
const result4 = yield* request3(host, command, { kind: "project", path });
|
|
@@ -35572,12 +35553,15 @@ var submitClone = exports_Effect.fnUntraced(function* (host, command, input, rev
|
|
|
35572
35553
|
});
|
|
35573
35554
|
|
|
35574
35555
|
// src/setup.ts
|
|
35556
|
+
import { rmdir } from "fs/promises";
|
|
35575
35557
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
35576
35558
|
|
|
35577
35559
|
// lua/rex-worktrees.lua
|
|
35578
35560
|
var rex_worktrees_default = `-- rex-worktrees: managed module
|
|
35579
35561
|
local installed_rex_bin_dir = false
|
|
35580
35562
|
local installed_path_env = false
|
|
35563
|
+
local installed_bin = false
|
|
35564
|
+
local installed_config_dir = false
|
|
35581
35565
|
-- Opening is opt-in via opts.key.
|
|
35582
35566
|
local M = {}
|
|
35583
35567
|
|
|
@@ -35588,13 +35572,25 @@ function M.setup(opts)
|
|
|
35588
35572
|
error("rex-worktrees: rex_bin_dir must be an absolute directory", 0)
|
|
35589
35573
|
end
|
|
35590
35574
|
local home = os.getenv("HOME")
|
|
35591
|
-
local bin = opts.bin or (home and home .. "/.local/bin/rex-worktrees")
|
|
35575
|
+
local bin = opts.bin or installed_bin or (home and home .. "/.local/bin/rex-worktrees")
|
|
35592
35576
|
if type(bin) ~= "string" or bin:sub(1, 1) ~= "/" then
|
|
35593
35577
|
error("rex-worktrees: set HOME or provide an absolute bin path", 0)
|
|
35594
35578
|
end
|
|
35579
|
+
local rex_config = os.getenv("REX_CONFIG")
|
|
35580
|
+
local config_dir = installed_config_dir or (rex_config and (rex_config:match("^(.+)/[^/]+$") or (rex_config:match("^/[^/]+$") and "/") or rex_config))
|
|
35581
|
+
or (os.getenv("XDG_CONFIG_HOME") and os.getenv("XDG_CONFIG_HOME") .. "/rex")
|
|
35582
|
+
or (home and home .. "/.config/rex")
|
|
35583
|
+
if type(config_dir) ~= "string" or config_dir:sub(1, 1) ~= "/" then
|
|
35584
|
+
error("rex-worktrees: Rex config directory must be absolute", 0)
|
|
35585
|
+
end
|
|
35586
|
+
local config = { roots = opts.roots, projects = opts.projects, worktreeRoot = opts.worktreeRoot }
|
|
35587
|
+
if type(config.roots) == "table" and next(config.roots) == nil then config.roots = nil end
|
|
35588
|
+
if type(config.projects) == "table" and next(config.projects) == nil then config.projects = nil end
|
|
35589
|
+
local settings = rex.json.encode({ config = config, directory = config_dir })
|
|
35595
35590
|
|
|
35596
35591
|
local function worktrees_request(request)
|
|
35597
35592
|
local exec_opts = { stdin = request, timeout = 20, env = {} }
|
|
35593
|
+
exec_opts.env.REX_WORKTREES_CONFIG = settings
|
|
35598
35594
|
if rex_bin_dir then exec_opts.env.REX_BIN_DIR = rex_bin_dir end
|
|
35599
35595
|
if installed_path_env ~= false then exec_opts.env.PATH = installed_path_env end
|
|
35600
35596
|
if os.getenv("REX_WORKTREES_LOCAL_ENDPOINT") then exec_opts.env.REX_WORKTREES_LOCAL_ENDPOINT = os.getenv("REX_WORKTREES_LOCAL_ENDPOINT") end
|
|
@@ -35619,6 +35615,13 @@ function M.setup(opts)
|
|
|
35619
35615
|
end,
|
|
35620
35616
|
}
|
|
35621
35617
|
|
|
35618
|
+
rex.action{
|
|
35619
|
+
name = "worktrees_config",
|
|
35620
|
+
title = "Read this machine's worktree settings",
|
|
35621
|
+
description = "Return destination-local settings to standalone rex-worktrees commands",
|
|
35622
|
+
run = function() return settings end,
|
|
35623
|
+
}
|
|
35624
|
+
|
|
35622
35625
|
rex.action{
|
|
35623
35626
|
name = "worktrees_open",
|
|
35624
35627
|
title = "Open Worktree\u2026",
|
|
@@ -35646,6 +35649,7 @@ function M.setup(opts)
|
|
|
35646
35649
|
table.insert(command, ctx.client_id)
|
|
35647
35650
|
end
|
|
35648
35651
|
local exec_opts = { timeout = 20, env = {} }
|
|
35652
|
+
exec_opts.env.REX_WORKTREES_CONFIG = settings
|
|
35649
35653
|
if rex_bin_dir then exec_opts.env.REX_BIN_DIR = rex_bin_dir end
|
|
35650
35654
|
if installed_path_env ~= false then exec_opts.env.PATH = installed_path_env end
|
|
35651
35655
|
if os.getenv("REX_WORKTREES_LOCAL_ENDPOINT") then exec_opts.env.REX_WORKTREES_LOCAL_ENDPOINT = os.getenv("REX_WORKTREES_LOCAL_ENDPOINT") end
|
|
@@ -35684,30 +35688,28 @@ require("rex-worktrees").setup()
|
|
|
35684
35688
|
var managedRegistration = /^-- BEGIN rex-worktrees\nrequire\("rex-worktrees"\)\.setup\(\{ bin = "(?:\\.|[^"\\])*" \}\)\n-- END rex-worktrees\n$/;
|
|
35685
35689
|
var marker2 = `-- rex-worktrees: managed module
|
|
35686
35690
|
`;
|
|
35687
|
-
var
|
|
35688
|
-
|
|
35691
|
+
var placeholders = [
|
|
35692
|
+
"local installed_rex_bin_dir = false",
|
|
35693
|
+
"local installed_path_env = false",
|
|
35694
|
+
"local installed_bin = false",
|
|
35695
|
+
"local installed_config_dir = false"
|
|
35696
|
+
];
|
|
35689
35697
|
var luaLiteral = (value3) => JSON.stringify(value3).replace(/\\u00([0-1][0-9a-f])/gi, (_, hex) => `\\${parseInt(hex, 16).toString().padStart(3, "0")}`);
|
|
35690
35698
|
var fail21 = (message) => exports_Effect.fail(new AppError({ message }));
|
|
35691
|
-
var installSetup = exports_Effect.fnUntraced(function* ({ source, home, configPath, lua: module, rexBinDir, managedBin, pathEnv, allowLinkedConfig = true }) {
|
|
35699
|
+
var installSetup = exports_Effect.fnUntraced(function* ({ source, home, configPath, lua: module, rexBinDir, managedBin, pathEnv, legacyConfigPath, allowLinkedConfig = true }) {
|
|
35692
35700
|
const fs = yield* exports_FileSystem.FileSystem;
|
|
35693
35701
|
const path = yield* exports_Path.Path;
|
|
35694
|
-
if (!path.isAbsolute(configPath) || !path.isAbsolute(home) || !path.isAbsolute(source) || !path.isAbsolute(rexBinDir) || managedBin !== undefined && !path.isAbsolute(managedBin))
|
|
35702
|
+
if (!path.isAbsolute(configPath) || !path.isAbsolute(home) || !path.isAbsolute(source) || !path.isAbsolute(rexBinDir) || managedBin !== undefined && !path.isAbsolute(managedBin) || legacyConfigPath !== undefined && !path.isAbsolute(legacyConfigPath))
|
|
35695
35703
|
return yield* new AppError({ message: "Setup requires absolute paths" });
|
|
35696
|
-
|
|
35697
|
-
|
|
35698
|
-
if (!module.startsWith(`${marker2}${rexBinPlaceholder}
|
|
35699
|
-
`) || module.split(rexBinPlaceholder).length !== 2)
|
|
35700
|
-
return yield* new AppError({ message: "Embedded Lua module must contain exactly one Rex CLI directory placeholder after its marker" });
|
|
35701
|
-
if (!module.startsWith(`${marker2}${rexBinPlaceholder}
|
|
35702
|
-
${pathEnvPlaceholder}
|
|
35703
|
-
`) || module.split(pathEnvPlaceholder).length !== 2)
|
|
35704
|
-
return yield* new AppError({ message: "Embedded Lua module must contain exactly one host PATH placeholder after its Rex CLI directory placeholder" });
|
|
35705
|
-
const installedLua = module.replace(rexBinPlaceholder, `local installed_rex_bin_dir = ${luaLiteral(rexBinDir)}`).replace(pathEnvPlaceholder, `local installed_path_env = ${pathEnv === undefined ? "false" : luaLiteral(pathEnv)}`);
|
|
35706
|
-
const bin = managedBin ?? path.join(home, ".local", "bin", "rex-worktrees");
|
|
35707
|
-
const registration = managedBin === undefined ? manualRegistration : `-- BEGIN rex-worktrees
|
|
35708
|
-
require("rex-worktrees").setup({ bin = ${JSON.stringify(managedBin)} })
|
|
35709
|
-
-- END rex-worktrees
|
|
35704
|
+
const header = `${marker2}${placeholders.join(`
|
|
35705
|
+
`)}
|
|
35710
35706
|
`;
|
|
35707
|
+
if (!module.startsWith(header) || placeholders.some((placeholder) => module.split(placeholder).length !== 2))
|
|
35708
|
+
return yield* new AppError({ message: "Embedded Lua module must contain exactly four install placeholders in order after its marker" });
|
|
35709
|
+
const bin = managedBin ?? path.join(home, ".local", "bin", "rex-worktrees");
|
|
35710
|
+
const values2 = [rexBinDir, pathEnv, bin, path.dirname(configPath)];
|
|
35711
|
+
const installedLua = placeholders.reduce((text, placeholder, index2) => text.replace(placeholder, placeholder.replace("false", values2[index2] === undefined ? "false" : luaLiteral(values2[index2]))), module);
|
|
35712
|
+
const registration = manualRegistration;
|
|
35711
35713
|
const luaPath = path.join(path.dirname(configPath), "rex-worktrees.lua");
|
|
35712
35714
|
const info2 = (filename) => exports_Effect.catchIf(fs.lstat(filename), (error2) => exports_PlatformError.isPlatformError(error2) && error2.reason._tag === "NotFound", () => exports_Effect.succeed(undefined));
|
|
35713
35715
|
const binaryInfo = managedBin === undefined ? yield* info2(bin) : undefined;
|
|
@@ -35724,14 +35726,41 @@ require("rex-worktrees").setup({ bin = ${JSON.stringify(managedBin)} })
|
|
|
35724
35726
|
if (initInfo?.type === "SymbolicLink" && !allowLinkedConfig)
|
|
35725
35727
|
return yield* fail21(`Refusing linked Rex init: ${configPath}`);
|
|
35726
35728
|
const current = initInfo ? yield* fs.readFileString(configPath) : "";
|
|
35727
|
-
const begin =
|
|
35728
|
-
|
|
35729
|
+
const begin = `-- BEGIN rex-worktrees
|
|
35730
|
+
`;
|
|
35731
|
+
const end3 = `-- END rex-worktrees
|
|
35732
|
+
`;
|
|
35729
35733
|
const start = current.indexOf(begin);
|
|
35730
35734
|
const finish = current.indexOf(end3);
|
|
35731
|
-
if (start < 0 !== finish < 0 || start >= 0 && (current.indexOf(begin, start + begin.length) !== -1 || current.indexOf(end3, finish + end3.length) !== -1 ||
|
|
35735
|
+
if (start < 0 !== finish < 0 || start >= 0 && (current.indexOf(begin, start + begin.length) !== -1 || current.indexOf(end3, finish + end3.length) !== -1 || finish <= start || start > 0 && current[start - 1] !== `
|
|
35736
|
+
`))
|
|
35732
35737
|
return yield* fail21(`Malformed rex-worktrees registration in ${configPath}`);
|
|
35733
|
-
|
|
35734
|
-
|
|
35738
|
+
const existing = start < 0 ? undefined : current.slice(start, finish + end3.length);
|
|
35739
|
+
if (existing !== undefined && !(existing === manualRegistration || managedRegistration.test(existing) || /require\s*\(?\s*["']rex-worktrees["']\s*\)?\.setup\s*\(/.test(existing)))
|
|
35740
|
+
return yield* fail21(`Malformed rex-worktrees registration in ${configPath}`);
|
|
35741
|
+
const unmarkedRegistration = start < 0 && /require\s*\(?\s*["']rex-worktrees["']/.test(current);
|
|
35742
|
+
const simple = !unmarkedRegistration && (existing === undefined || existing === manualRegistration || existing !== undefined && managedRegistration.test(existing));
|
|
35743
|
+
const legacyInfo = legacyConfigPath === undefined ? undefined : yield* info2(legacyConfigPath);
|
|
35744
|
+
if (legacyInfo && legacyInfo.type !== "File")
|
|
35745
|
+
return yield* fail21(`Refusing non-file legacy settings: ${legacyConfigPath}`);
|
|
35746
|
+
if (legacyInfo && !simple)
|
|
35747
|
+
return yield* fail21(`Cannot merge legacy settings ${legacyConfigPath} with custom Rex registration in ${configPath}. Move roots/projects/worktreeRoot into require("rex-worktrees").setup({...}) manually, back up and remove the legacy JSON file, then rerun setup.`);
|
|
35748
|
+
const legacyBytes = legacyInfo ? yield* fs.readFileString(legacyConfigPath) : undefined;
|
|
35749
|
+
const legacy = legacyBytes === undefined ? undefined : yield* exports_Schema.decodeUnknownEffect(exports_Schema.fromJsonString(ConfigSchema))(legacyBytes);
|
|
35750
|
+
const expand = (value3) => value3 === "~" ? home : value3.startsWith("~/") ? path.join(home, value3.slice(2)) : path.resolve(path.dirname(legacyConfigPath), value3);
|
|
35751
|
+
const legacyRegistration = legacy === undefined ? undefined : `-- BEGIN rex-worktrees
|
|
35752
|
+
require("rex-worktrees").setup({${[
|
|
35753
|
+
legacy.roots?.length ? `roots = { ${legacy.roots.map((root) => luaLiteral(expand(root))).join(", ")} }` : undefined,
|
|
35754
|
+
legacy.projects?.length ? `projects = { ${legacy.projects.map((project4) => typeof project4 === "string" ? luaLiteral(expand(project4)) : `{ path = ${luaLiteral(expand(project4.path))}${project4.worktreeRoot === undefined ? "" : `, worktreeRoot = ${luaLiteral(expand(project4.worktreeRoot))}`} }`).join(", ")} }` : undefined,
|
|
35755
|
+
legacy.worktreeRoot === undefined ? undefined : `worktreeRoot = ${luaLiteral(expand(legacy.worktreeRoot))}`
|
|
35756
|
+
].filter((value3) => value3 !== undefined).join(", ")} })
|
|
35757
|
+
-- END rex-worktrees
|
|
35758
|
+
`;
|
|
35759
|
+
const nextRegistration = legacyRegistration ?? (simple ? registration : existing ?? "");
|
|
35760
|
+
const backup = legacyConfigPath === undefined ? undefined : `${legacyConfigPath}.backup`;
|
|
35761
|
+
const backupInfo = backup === undefined ? undefined : yield* info2(backup);
|
|
35762
|
+
if (backupInfo && backupInfo.type !== "File")
|
|
35763
|
+
return yield* fail21(`Refusing non-file legacy backup: ${backup}`);
|
|
35735
35764
|
const sourceInfo = yield* fs.stat(source);
|
|
35736
35765
|
if (sourceInfo.type !== "File")
|
|
35737
35766
|
return yield* fail21(`Installer source is not a file: ${source}`);
|
|
@@ -35751,6 +35780,10 @@ require("rex-worktrees").setup({ bin = ${JSON.stringify(managedBin)} })
|
|
|
35751
35780
|
const temporary = path.join(path.dirname(destination), `.rex-worktrees-${randomUUID2()}.tmp`);
|
|
35752
35781
|
return yield* write2(temporary).pipe(exports_Effect.flatMap(() => fs.rename(temporary, destination)), exports_Effect.ensuring(fs.remove(temporary, { force: true }).pipe(exports_Effect.ignore)));
|
|
35753
35782
|
});
|
|
35783
|
+
const legacyDir = legacyConfigPath === undefined ? undefined : path.dirname(legacyConfigPath);
|
|
35784
|
+
const legacyDirInfo = legacyDir === undefined ? undefined : yield* info2(legacyDir);
|
|
35785
|
+
if (legacyDirInfo && legacyDirInfo.type !== "Directory")
|
|
35786
|
+
return yield* fail21(`Refusing non-directory legacy settings path: ${legacyDir}`);
|
|
35754
35787
|
if (managedBin === undefined) {
|
|
35755
35788
|
if (source !== bin)
|
|
35756
35789
|
yield* atomic(bin, (temporary) => fs.copyFile(source, temporary).pipe(exports_Effect.flatMap(() => fs.chmod(temporary, 493))));
|
|
@@ -35758,13 +35791,26 @@ require("rex-worktrees").setup({ bin = ${JSON.stringify(managedBin)} })
|
|
|
35758
35791
|
yield* fs.chmod(bin, 493);
|
|
35759
35792
|
}
|
|
35760
35793
|
yield* atomic(luaPath, (temporary) => fs.writeFileString(temporary, installedLua, { flag: "wx", mode: 420 }));
|
|
35761
|
-
if (start < 0)
|
|
35794
|
+
if (start < 0 && !unmarkedRegistration)
|
|
35762
35795
|
yield* fs.writeFileString(configPath, `${current && !current.endsWith(`
|
|
35763
35796
|
`) ? `
|
|
35764
|
-
` : ""}${
|
|
35765
|
-
else if (
|
|
35766
|
-
yield* fs.writeFileString(configPath, `${current.slice(0, start)}${
|
|
35767
|
-
|
|
35797
|
+
` : ""}${nextRegistration}`, { flag: "a" });
|
|
35798
|
+
else if (start >= 0 && existing !== nextRegistration)
|
|
35799
|
+
yield* fs.writeFileString(configPath, `${current.slice(0, start)}${nextRegistration}${current.slice(finish + end3.length)}`);
|
|
35800
|
+
if (backupInfo)
|
|
35801
|
+
yield* fs.remove(backup);
|
|
35802
|
+
if (legacyInfo)
|
|
35803
|
+
yield* fs.remove(legacyConfigPath);
|
|
35804
|
+
if (legacyDirInfo)
|
|
35805
|
+
yield* exports_Effect.tryPromise({
|
|
35806
|
+
try: () => rmdir(legacyDir).catch((error2) => {
|
|
35807
|
+
if (error2 instanceof Error && "code" in error2 && (error2.code === "ENOTEMPTY" || error2.code === "EEXIST"))
|
|
35808
|
+
return;
|
|
35809
|
+
throw error2;
|
|
35810
|
+
}),
|
|
35811
|
+
catch: (error2) => new AppError({ message: `Cannot remove legacy settings directory ${legacyDir}: ${String(error2)}` })
|
|
35812
|
+
});
|
|
35813
|
+
return { bin, luaPath, configPath, migrated: legacy !== undefined };
|
|
35768
35814
|
});
|
|
35769
35815
|
var setup = exports_Effect.fnUntraced(function* (managedBin, configPath) {
|
|
35770
35816
|
const home = process.env.HOME;
|
|
@@ -35799,7 +35845,7 @@ var setup = exports_Effect.fnUntraced(function* (managedBin, configPath) {
|
|
|
35799
35845
|
return yield* fail21("Rex config has diagnostics; fix it before setup");
|
|
35800
35846
|
target = checked.path;
|
|
35801
35847
|
}
|
|
35802
|
-
return yield* installSetup({ source: process.execPath, home, configPath: target, lua: rex_worktrees_default, rexBinDir, managedBin, allowLinkedConfig: configPath === undefined, ...process.env.PATH !== undefined ? { pathEnv: process.env.PATH } : {} });
|
|
35848
|
+
return yield* installSetup({ source: process.execPath, home, configPath: target, lua: rex_worktrees_default, rexBinDir, managedBin, allowLinkedConfig: configPath === undefined, ...configPath === undefined ? { legacyConfigPath: path.join(process.env.XDG_CONFIG_HOME ?? path.join(home, ".config"), "rex-worktrees", "config.json") } : {}, ...process.env.PATH !== undefined ? { pathEnv: process.env.PATH } : {} });
|
|
35803
35849
|
});
|
|
35804
35850
|
// node_modules/effect/dist/cli/Prompt.js
|
|
35805
35851
|
var exports_Prompt = {};
|
|
@@ -38468,69 +38514,61 @@ var safeDisplayText = (text, preserveWhitespace = false) => {
|
|
|
38468
38514
|
};
|
|
38469
38515
|
var fit = (text, width2) => Bun.stringWidth(text) > width2 ? Bun.sliceAnsi(text, 0, Math.max(0, width2), { ellipsis: "\u2026" }) : text;
|
|
38470
38516
|
var pad = (text, width2) => text + " ".repeat(Math.max(0, width2 - Bun.stringWidth(text)));
|
|
38471
|
-
var renderFormFrame = (view, focused,
|
|
38472
|
-
const width2 = Math.max(
|
|
38517
|
+
var renderFormFrame = (view, focused, columns, rows2, colors2 = !process.env.NO_COLOR, options = {}) => {
|
|
38518
|
+
const width2 = Math.max(2, columns);
|
|
38473
38519
|
const inside = width2 - 2;
|
|
38474
38520
|
const screen = [];
|
|
38475
|
-
const border = (
|
|
38476
|
-
const line = (left, right
|
|
38477
|
-
|
|
38521
|
+
const border = (body) => `${color("\u2502", "muted", colors2)}${pad(fit(body, inside), inside)}${color("\u2502", "muted", colors2)}`;
|
|
38522
|
+
const line = (left, right, title = "") => {
|
|
38523
|
+
const text = fit(safeDisplayText(title), inside);
|
|
38524
|
+
return color(`${left}${text}${"\u2500".repeat(Math.max(0, inside - Bun.stringWidth(text)))}${right}`, "muted", colors2);
|
|
38525
|
+
};
|
|
38526
|
+
const add4 = (text) => screen.push(border(text));
|
|
38478
38527
|
screen.push(line("\u250C", "\u2510"));
|
|
38479
|
-
|
|
38480
|
-
add4(heading);
|
|
38528
|
+
add4(`${color("REX", "cyan", colors2)} ${color("/ WORKTREES", "bold", colors2)}`);
|
|
38481
38529
|
screen.push(line("\u251C", "\u2524"));
|
|
38482
|
-
const
|
|
38483
|
-
const
|
|
38484
|
-
const
|
|
38485
|
-
const
|
|
38486
|
-
|
|
38487
|
-
|
|
38488
|
-
|
|
38489
|
-
|
|
38490
|
-
|
|
38530
|
+
const fieldCount = Math.max(1, Math.min(5, rows2 - 11));
|
|
38531
|
+
const detailCount = Math.max(3, rows2 - fieldCount - 8);
|
|
38532
|
+
const focusIndex = view.rows.findIndex((row) => row.id === focused);
|
|
38533
|
+
const start = Math.max(0, Math.min(focusIndex - fieldCount + 1, view.rows.length - fieldCount));
|
|
38534
|
+
for (let index2 = 0;index2 < fieldCount; index2++) {
|
|
38535
|
+
const row = view.rows[start + index2];
|
|
38536
|
+
if (!row) {
|
|
38537
|
+
add4("");
|
|
38538
|
+
continue;
|
|
38491
38539
|
}
|
|
38492
|
-
};
|
|
38493
|
-
for (const row of view.rows) {
|
|
38494
38540
|
const active = focused === row.id;
|
|
38495
|
-
const
|
|
38496
|
-
const
|
|
38497
|
-
|
|
38498
|
-
|
|
38499
|
-
|
|
38500
|
-
|
|
38501
|
-
|
|
38502
|
-
|
|
38503
|
-
|
|
38504
|
-
|
|
38505
|
-
|
|
38506
|
-
|
|
38507
|
-
|
|
38508
|
-
if (
|
|
38509
|
-
|
|
38510
|
-
|
|
38511
|
-
|
|
38512
|
-
|
|
38513
|
-
|
|
38514
|
-
|
|
38515
|
-
|
|
38516
|
-
|
|
38517
|
-
screen.push(line("\u251C", "\u2524"));
|
|
38518
|
-
const submit2 = focused === "submit" ? color("\u203A", "cyan", colors2) : " ";
|
|
38519
|
-
const cancel = focused === "cancel" ? color("\u203A", "cyan", colors2) : " ";
|
|
38520
|
-
add4(`${submit2} ${color(fit(safeDisplayText(view.submitLabel), Math.max(1, inside - 19)), view.submitDisabled ? "muted" : "cyan", colors2)} ${cancel} ${color("Cancel", focused === "cancel" ? "cyan" : "muted", colors2)}`);
|
|
38521
|
-
add4(color(" \u2191\u2193 / jk move \xB7 Tab next \xB7 Enter select \xB7 Ctrl+S submit \xB7 Esc close", "muted", colors2));
|
|
38541
|
+
const tone = row.disabled ? "muted" : active ? "cyan" : "bold";
|
|
38542
|
+
const indicator = index2 === 0 && start > 0 ? "\u2191" : index2 === fieldCount - 1 && start + fieldCount < view.rows.length ? "\u2193" : active ? "\u203A" : " ";
|
|
38543
|
+
add4(`${color(indicator, tone, colors2)} ${color(pad(fit(safeDisplayText(row.label).toUpperCase(), 13), 13), tone, colors2)} ${color(fit(safeDisplayText(row.value) || "\u2014", Math.max(1, inside - 17)), tone, colors2)}`);
|
|
38544
|
+
}
|
|
38545
|
+
add4("");
|
|
38546
|
+
const current = view.rows.find((row) => row.id === focused);
|
|
38547
|
+
screen.push(line("\u251C", "\u2524", ` ${options.editor?.title ?? current?.label ?? "Details"} `));
|
|
38548
|
+
const subtitle = current?.detail ?? view.rows.find((row) => row.id === "destination")?.detail ?? "";
|
|
38549
|
+
const wrapped = [view.error, view.notice, subtitle].filter(Boolean).flatMap((message) => Bun.wrapAnsi(safeDisplayText(message), Math.max(1, inside - 10), { hard: true }).split(`
|
|
38550
|
+
`));
|
|
38551
|
+
const visible = options.editor ? 1 : detailCount;
|
|
38552
|
+
const offset = Math.max(0, Math.min(options.detailOffset ?? 0, wrapped.length - visible));
|
|
38553
|
+
const detailLine = (index2) => `${index2 === 0 && offset > 0 ? "\u2191 " : ""}${wrapped[offset + index2] ?? ""}${index2 === visible - 1 && offset + visible < wrapped.length ? " \u2193 PgDn" : ""}`;
|
|
38554
|
+
if (options.editor) {
|
|
38555
|
+
const errorRows = view.error ? 1 : 0;
|
|
38556
|
+
for (let index2 = 0;index2 < detailCount - errorRows; index2++)
|
|
38557
|
+
add4(options.editor.lines[index2] ?? "");
|
|
38558
|
+
if (errorRows)
|
|
38559
|
+
add4(color(detailLine(0), "red", colors2));
|
|
38560
|
+
} else {
|
|
38561
|
+
for (let index2 = 0;index2 < detailCount; index2++)
|
|
38562
|
+
add4(color(detailLine(index2), view.error ? "red" : view.notice ? "amber" : "muted", colors2));
|
|
38522
38563
|
}
|
|
38564
|
+
screen.push(line("\u251C", "\u2524"));
|
|
38565
|
+
const hint = (key5, label) => `${color(key5, "bold", colors2)} ${color(label, "muted", colors2)}`;
|
|
38566
|
+
const button = (label, active, primary = false, disabled = false) => color(`${active ? "\u203A" : " "}[ ${safeDisplayText(label)} ]`, disabled ? "muted" : active ? "cyan" : primary ? "bold" : "muted", colors2);
|
|
38567
|
+
add4(options.footer ? color(options.footer, "muted", colors2) : options.editor ? `${hint("Enter", "accept")} \xB7 ${hint("Esc", "back")} \xB7 ${hint("\u2191\u2193", "choices")} \xB7 ${hint("PgUp/PgDn", "details")}` : `${button(`${view.submitLabel} \xB7 Ctrl+S`, focused === "submit", true, view.submitDisabled)} ${button("Cancel \xB7 Esc", focused === "cancel")} ${hint("Tab", "next")}`);
|
|
38523
38568
|
screen.push(line("\u2514", "\u2518"));
|
|
38524
|
-
return screen.join(`\r
|
|
38525
|
-
`)
|
|
38526
|
-
` : "");
|
|
38527
|
-
};
|
|
38528
|
-
var naturalFormRows = (view, columns, editing = false) => {
|
|
38529
|
-
const fields = [...view.rows.map((row) => row.id), "submit"];
|
|
38530
|
-
return Math.max(...fields.map((field) => renderFormFrame(view, field, editing, columns, 1000, false, false).split(`\r
|
|
38531
|
-
`).length - (editing ? 1 : 0))) + (editing ? 6 : 0);
|
|
38569
|
+
return screen.slice(0, Math.max(1, rows2)).join(`\r
|
|
38570
|
+
`);
|
|
38532
38571
|
};
|
|
38533
|
-
var popupTargetRows = (view, columns, editing = false) => Math.max(16 + (editing ? 6 : 0), naturalFormRows(view, Math.min(96, columns), editing));
|
|
38534
38572
|
var matchingChoices = (choices, text) => {
|
|
38535
38573
|
const query = text.toLocaleLowerCase();
|
|
38536
38574
|
const matches = [];
|
|
@@ -38571,51 +38609,29 @@ var advanceInputChoice = (state, event, choices, selectionOnly = false) => {
|
|
|
38571
38609
|
return { _tag: "Beep" };
|
|
38572
38610
|
return { _tag: "NextFrame", state: { text: state.text + text, selected: selectionOnly ? state.selected : null } };
|
|
38573
38611
|
};
|
|
38574
|
-
var renderInputChoice = (
|
|
38612
|
+
var renderInputChoice = (state, choices, columns, rows2, colors2 = !process.env.NO_COLOR, selectionOnly = false, count2 = Math.max(2, rows2 - 14)) => {
|
|
38575
38613
|
const width2 = Math.max(20, columns) - 2;
|
|
38576
38614
|
const matches = matchingChoices(choices, state.text);
|
|
38577
|
-
const count2 = rows2 >= 20 ? 3 : 1;
|
|
38578
38615
|
const selected = matches.indexOf(state.selected ?? -1);
|
|
38579
38616
|
const start = selected < 0 ? 0 : Math.max(0, Math.min(selected, matches.length - count2));
|
|
38580
|
-
const lines2 = [
|
|
38581
|
-
` ${fit(safeDisplayText(message), width2 - 2)}`,
|
|
38582
|
-
` ${color("\u203A", "cyan", colors2)} ${fit(safeDisplayText(state.text, true) || (selectionOnly ? "Filter exact choices\u2026" : "Type new value\u2026"), width2 - 4)}`
|
|
38583
|
-
];
|
|
38617
|
+
const lines2 = [`${color("\u203A", "cyan", colors2)} ${fit(safeDisplayText(state.text, true) || (selectionOnly ? "Filter exact choices\u2026" : "Type new value\u2026"), width2 - 2)}`];
|
|
38584
38618
|
for (const index2 of matches.slice(start, start + count2)) {
|
|
38585
38619
|
const choice = choices[index2];
|
|
38586
38620
|
if (!choice)
|
|
38587
38621
|
continue;
|
|
38588
38622
|
const label = `${state.selected === index2 ? "\u203A" : " "} ${safeDisplayText(choice.title)}${choice.description ? ` \xB7 ${safeDisplayText(choice.description)}` : ""}`;
|
|
38589
|
-
lines2.push(
|
|
38623
|
+
lines2.push(fit(label, width2));
|
|
38590
38624
|
}
|
|
38591
|
-
|
|
38592
|
-
lines2.push("");
|
|
38593
|
-
lines2.push(` ${fit(selectionOnly ? "Enter selected \xB7 \u2191\u2193 choose \xB7 Ctrl+U clear \xB7 Esc back" : "Enter typed/selected \xB7 \u2191\u2193 choose \xB7 Ctrl+U clear \xB7 Esc back", width2 - 2)}`);
|
|
38594
|
-
return lines2.join(`\r
|
|
38595
|
-
`);
|
|
38625
|
+
return lines2;
|
|
38596
38626
|
};
|
|
38597
|
-
var acknowledge = (title, lines2, tone) => exports_Prompt.run(exports_Prompt.Custom(
|
|
38598
|
-
render: (
|
|
38627
|
+
var acknowledge = (title, lines2, tone, view = { rows: [], submitLabel: "Close" }) => exports_Prompt.run(exports_Prompt.Custom(0, {
|
|
38628
|
+
render: (detailOffset, action) => action._tag === "Submit" ? exports_Effect.succeed("") : exports_Effect.gen(function* () {
|
|
38599
38629
|
const terminal = yield* exports_Terminal.Terminal;
|
|
38600
|
-
const
|
|
38601
|
-
|
|
38602
|
-
const active = !process.env.NO_COLOR;
|
|
38603
|
-
const output = [color(` REX / ${safeDisplayText(title)}`, tone === "error" ? "red" : tone === "warning" ? "amber" : "cyan", active), ""];
|
|
38604
|
-
for (const line of lines2) {
|
|
38605
|
-
for (const part of Bun.wrapAnsi(safeDisplayText(line), width2 - 4, { hard: true }).split(`
|
|
38606
|
-
`)) {
|
|
38607
|
-
if (output.length >= height - 3)
|
|
38608
|
-
break;
|
|
38609
|
-
output.push(` ${part}`);
|
|
38610
|
-
}
|
|
38611
|
-
}
|
|
38612
|
-
output.push("", color(" Enter / Space confirm \xB7 Esc / Ctrl+C close", "muted", active));
|
|
38613
|
-
return `\x1B[H\x1B[2J${output.join(`\r
|
|
38614
|
-
`)}\r
|
|
38615
|
-
`;
|
|
38630
|
+
const notice = `${title} \xB7 ${lines2.join(" \xB7 ")}`;
|
|
38631
|
+
return `\x1B[H\x1B[2J${renderFormFrame({ ...view, error: tone === "error" ? notice : undefined, notice: tone !== "error" ? notice : undefined }, "submit", yield* terminal.columns, yield* terminal.rows, !process.env.NO_COLOR, { detailOffset, footer: "Enter / Space close \xB7 Esc close \xB7 PgUp/PgDn details" })}`;
|
|
38616
38632
|
}),
|
|
38617
38633
|
clear: () => exports_Effect.succeed(""),
|
|
38618
|
-
process: (input) => exports_Effect.succeed(input.key.name === "enter" || input.key.name === "return" || input.key.name === "space" || input.key.name === "escape" || input.key.ctrl && input.key.name === "c" ? { _tag: "Submit", value: undefined } : { _tag: "Beep" })
|
|
38634
|
+
process: (input, offset) => exports_Effect.succeed(input.key.name === "pageup" || input.key.name === "pagedown" ? { _tag: "NextFrame", state: Math.max(0, offset + (input.key.name === "pageup" ? -1 : 1)) } : input.key.name === "enter" || input.key.name === "return" || input.key.name === "space" || input.key.name === "escape" || input.key.ctrl && input.key.name === "c" ? { _tag: "Submit", value: undefined } : { _tag: "Beep" })
|
|
38619
38635
|
})).pipe(exports_Effect.catch(() => exports_Effect.void));
|
|
38620
38636
|
var problem = (error2) => error2 instanceof AppError ? error2.message : exports_Cause.pretty(exports_Cause.fail(error2));
|
|
38621
38637
|
var selected = (value3, current, title, description) => ({ value: value3, selected: current, title, description });
|
|
@@ -38680,15 +38696,16 @@ var selectRevision = (draft, choice) => changeDestination(draft, { revision: cho
|
|
|
38680
38696
|
var cloneInputFor = (draft) => {
|
|
38681
38697
|
if (!draft.host || !draft.clone || !draft.session || !draft.clone.repo.startsWith("/"))
|
|
38682
38698
|
return;
|
|
38683
|
-
if (draft.clone.vcs === "jj")
|
|
38699
|
+
if (draft.clone.vcs === "jj") {
|
|
38700
|
+
const revision = draft.clone.revision?.commitId === draft.destination?.revision ? draft.clone.revision : draft.clone.revisions.find((choice) => choice.revision.commitId === draft.destination?.revision)?.revision;
|
|
38684
38701
|
return {
|
|
38685
38702
|
vcs: "jj",
|
|
38686
38703
|
source: {
|
|
38687
38704
|
vcs: "jj",
|
|
38688
38705
|
url: draft.clone.url,
|
|
38689
38706
|
sourceHostId: draft.clone.sourceHostId,
|
|
38690
|
-
revisions:
|
|
38691
|
-
...
|
|
38707
|
+
revisions: [],
|
|
38708
|
+
...revision ? { revision } : {}
|
|
38692
38709
|
},
|
|
38693
38710
|
repo: draft.clone.repo,
|
|
38694
38711
|
session: draft.session,
|
|
@@ -38697,6 +38714,7 @@ var cloneInputFor = (draft) => {
|
|
|
38697
38714
|
...draft.worktreeName ? { worktreeName: draft.worktreeName } : {},
|
|
38698
38715
|
...draft.destination?.revision ? { revision: draft.destination.revision } : {}
|
|
38699
38716
|
};
|
|
38717
|
+
}
|
|
38700
38718
|
if (!draft.destination?.branch)
|
|
38701
38719
|
return;
|
|
38702
38720
|
return {
|
|
@@ -38727,49 +38745,36 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38727
38745
|
let sessions = [];
|
|
38728
38746
|
let focused = "project";
|
|
38729
38747
|
let error2;
|
|
38730
|
-
let
|
|
38731
|
-
let clonePlan;
|
|
38748
|
+
let blocked = false;
|
|
38732
38749
|
let cloneRoot = "";
|
|
38733
38750
|
let cloneRoots = [];
|
|
38734
38751
|
let contextPath;
|
|
38735
|
-
const resizePopup = yield* makePopupSizer;
|
|
38736
38752
|
let activeView;
|
|
38737
|
-
|
|
38738
|
-
|
|
38739
|
-
|
|
38740
|
-
|
|
38741
|
-
|
|
38742
|
-
|
|
38743
|
-
return;
|
|
38744
|
-
const changed = view.fitWarning !== warning;
|
|
38745
|
-
view.fitWarning = warning;
|
|
38746
|
-
if (changed && repaint)
|
|
38747
|
-
yield* exports_Queue.offer(repaint, { columns, rows: rows2 });
|
|
38748
|
-
})).pipe(exports_Effect.forkScoped);
|
|
38753
|
+
const resizeEvents = exports_Effect.gen(function* () {
|
|
38754
|
+
const source = yield* terminal.size;
|
|
38755
|
+
const events = yield* exports_Queue.sliding(1);
|
|
38756
|
+
yield* exports_Effect.forever(exports_Queue.take(source).pipe(exports_Effect.flatMap((value3) => exports_Queue.offer(events, value3)))).pipe(exports_Effect.forkScoped);
|
|
38757
|
+
return events;
|
|
38758
|
+
});
|
|
38749
38759
|
const chooseField = exports_Effect.fnUntraced(function* (view, initialFocus) {
|
|
38750
|
-
|
|
38751
|
-
const size8 = yield* terminal2.size;
|
|
38752
|
-
const resized = yield* exports_Queue.sliding(1);
|
|
38753
|
-
yield* exports_Effect.acquireRelease(exports_Effect.sync(() => {
|
|
38754
|
-
repaint = resized;
|
|
38755
|
-
}), () => exports_Effect.sync(() => {
|
|
38756
|
-
repaint = undefined;
|
|
38757
|
-
}));
|
|
38758
|
-
yield* exports_Effect.forever(exports_Queue.take(size8).pipe(exports_Effect.flatMap((value3) => exports_Queue.offer(resized, value3)))).pipe(exports_Effect.forkScoped);
|
|
38760
|
+
let detailOffset = 0;
|
|
38759
38761
|
const fields = [...view.rows.map((row) => row.id), "submit", "cancel"];
|
|
38760
38762
|
const initial = Math.max(0, fields.indexOf(initialFocus));
|
|
38761
|
-
const prompt = exports_Prompt.Custom(initial,
|
|
38763
|
+
const prompt = exports_Prompt.Custom(initial, yield* resizeEvents, {
|
|
38762
38764
|
render: (index2, action) => action._tag === "Submit" ? exports_Effect.succeed("") : exports_Effect.gen(function* () {
|
|
38763
|
-
const columns = yield*
|
|
38764
|
-
const rows2 = yield*
|
|
38765
|
-
|
|
38766
|
-
return `\x1B[H\x1B[2J${renderFormFrame(view, fields[index2], false, columns, rows2)}`;
|
|
38765
|
+
const columns = yield* terminal.columns;
|
|
38766
|
+
const rows2 = yield* terminal.rows;
|
|
38767
|
+
return `\x1B[H\x1B[2J${renderFormFrame(view, fields[index2], columns, rows2, !process.env.NO_COLOR, { detailOffset })}`;
|
|
38767
38768
|
}),
|
|
38768
38769
|
clear: () => exports_Effect.succeed(""),
|
|
38769
38770
|
process: (event, index2) => {
|
|
38770
38771
|
if (event._tag === "Event")
|
|
38771
38772
|
return exports_Effect.succeed({ _tag: "NextFrame", state: index2 });
|
|
38772
38773
|
const { key: key5 } = event.input;
|
|
38774
|
+
if (key5.name === "pageup" || key5.name === "pagedown") {
|
|
38775
|
+
detailOffset = Math.max(0, detailOffset + (key5.name === "pageup" ? -1 : 1));
|
|
38776
|
+
return exports_Effect.succeed({ _tag: "NextFrame", state: index2 });
|
|
38777
|
+
}
|
|
38773
38778
|
if (key5.name === "escape" || key5.ctrl && key5.name === "c")
|
|
38774
38779
|
return exports_Effect.succeed({ _tag: "Submit", value: "cancel" });
|
|
38775
38780
|
if (key5.ctrl && key5.name === "s")
|
|
@@ -38786,29 +38791,25 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38786
38791
|
return yield* exports_Prompt.run(prompt);
|
|
38787
38792
|
}, exports_Effect.scoped);
|
|
38788
38793
|
const inputChoice = exports_Effect.fnUntraced(function* (options) {
|
|
38789
|
-
|
|
38790
|
-
const
|
|
38791
|
-
const resized = yield* exports_Queue.sliding(1);
|
|
38792
|
-
yield* exports_Effect.forever(exports_Queue.take(size8).pipe(exports_Effect.flatMap((value3) => exports_Queue.offer(resized, value3)))).pipe(exports_Effect.forkScoped);
|
|
38793
|
-
yield* exports_Effect.acquireRelease(exports_Effect.sync(() => {
|
|
38794
|
-
repaint = resized;
|
|
38795
|
-
}), () => exports_Effect.sync(() => {
|
|
38796
|
-
repaint = undefined;
|
|
38797
|
-
}));
|
|
38798
|
-
const result4 = yield* exports_Prompt.run(exports_Prompt.Custom({ text: "", selected: options.selected === undefined || options.selected < 0 ? null : options.selected }, resized, {
|
|
38794
|
+
let detailOffset = 0;
|
|
38795
|
+
const result4 = yield* exports_Prompt.run(exports_Prompt.Custom({ text: "", selected: options.selected === undefined || options.selected < 0 ? null : options.selected }, yield* resizeEvents, {
|
|
38799
38796
|
render: (state, action) => action._tag === "Submit" ? exports_Effect.succeed("") : exports_Effect.gen(function* () {
|
|
38800
|
-
const columns = yield*
|
|
38801
|
-
const rows2 = yield*
|
|
38797
|
+
const columns = yield* terminal.columns;
|
|
38798
|
+
const rows2 = yield* terminal.rows;
|
|
38802
38799
|
const view = activeView;
|
|
38803
|
-
|
|
38804
|
-
yield* exports_Queue.offer(fitRequests, { view, columns, rows: rows2, editing: true });
|
|
38805
|
-
const editor = renderInputChoice(options.message, state, options.choices, columns, rows2, !process.env.NO_COLOR, options.selectionOnly);
|
|
38800
|
+
const editor = renderInputChoice(state, options.choices, columns, rows2, !process.env.NO_COLOR, options.selectionOnly, Math.max(2, rows2 - 14) - (view?.error ? 1 : 0));
|
|
38806
38801
|
if (!view)
|
|
38807
38802
|
return "";
|
|
38808
|
-
return `\x1B[H\x1B[2J${renderFormFrame(view, focused,
|
|
38803
|
+
return `\x1B[H\x1B[2J${renderFormFrame(view, focused, columns, rows2, !process.env.NO_COLOR, { editor: { title: options.message, lines: editor }, detailOffset })}`;
|
|
38809
38804
|
}),
|
|
38810
38805
|
clear: () => exports_Effect.succeed(""),
|
|
38811
|
-
process: (event, state) =>
|
|
38806
|
+
process: (event, state) => {
|
|
38807
|
+
if (event._tag !== "Event" && (event.input.key.name === "pageup" || event.input.key.name === "pagedown")) {
|
|
38808
|
+
detailOffset = Math.max(0, detailOffset + (event.input.key.name === "pageup" ? -1 : 1));
|
|
38809
|
+
return exports_Effect.succeed({ _tag: "NextFrame", state });
|
|
38810
|
+
}
|
|
38811
|
+
return exports_Effect.succeed(event._tag === "Event" ? { _tag: "NextFrame", state } : advanceInputChoice(state, event.input, options.choices, options.selectionOnly));
|
|
38812
|
+
}
|
|
38812
38813
|
}));
|
|
38813
38814
|
return result4 === null ? yield* exports_Effect.fail(new exports_Terminal.QuitError({})) : result4;
|
|
38814
38815
|
}, exports_Effect.scoped);
|
|
@@ -38911,13 +38912,21 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38911
38912
|
return yield* exports_Effect.fail(new AppError({ message: "Project directory changed; select the exact project directory again" }));
|
|
38912
38913
|
return inspected.success;
|
|
38913
38914
|
});
|
|
38915
|
+
const useProject = (found) => {
|
|
38916
|
+
draft = changeProject(draft, found.project);
|
|
38917
|
+
if (found.checkout.vcs === "jj" && !draft.sourcePath)
|
|
38918
|
+
draft = { ...draft, sourcePath: found.checkout.path };
|
|
38919
|
+
if (!draft.destination) {
|
|
38920
|
+
const tree = found.worktrees.find((item) => item.path === found.checkout.path && (item.vcs === "jj" ? item.present : !item.bare && !item.prunable));
|
|
38921
|
+
if (tree)
|
|
38922
|
+
draft = selectWorktree(draft, tree);
|
|
38923
|
+
}
|
|
38924
|
+
};
|
|
38914
38925
|
const activate2 = exports_Effect.fnUntraced(function* (machine, showLoading = false) {
|
|
38915
38926
|
const previous = draft;
|
|
38916
38927
|
const previousHostId = draft.host?.hostId;
|
|
38917
38928
|
draft = { machine, projectChoice: draft.projectChoice, mode: draft.mode };
|
|
38918
38929
|
sessions = [];
|
|
38919
|
-
plan = undefined;
|
|
38920
|
-
clonePlan = undefined;
|
|
38921
38930
|
cloneRoot = "";
|
|
38922
38931
|
cloneRoots = [];
|
|
38923
38932
|
error2 = undefined;
|
|
@@ -38926,7 +38935,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38926
38935
|
if (showLoading) {
|
|
38927
38936
|
const pending = { ...formView(true), notice: `Connecting to ${machine.label}\u2026` };
|
|
38928
38937
|
activeView = pending;
|
|
38929
|
-
yield* terminal.display(`\x1B[H\x1B[2J${renderFormFrame(pending, "machine",
|
|
38938
|
+
yield* terminal.display(`\x1B[H\x1B[2J${renderFormFrame(pending, "machine", yield* terminal.columns, yield* terminal.rows)}`);
|
|
38930
38939
|
}
|
|
38931
38940
|
const connected = yield* exports_Effect.result(connectAndDiscover(machine, command, discoveredContext));
|
|
38932
38941
|
if (exports_Result.isFailure(connected)) {
|
|
@@ -38956,15 +38965,8 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38956
38965
|
error2 = problem(inspected.failure);
|
|
38957
38966
|
return;
|
|
38958
38967
|
}
|
|
38959
|
-
|
|
38960
|
-
|
|
38961
|
-
draft = changeProject(draft, inspected.success.project);
|
|
38962
|
-
if (inspected.success.checkout.vcs === "jj")
|
|
38963
|
-
draft = { ...draft, sourcePath: inspected.success.checkout.path };
|
|
38964
|
-
const tree = inspected.success.worktrees.find((item) => item.path === found.checkout?.path && (item.vcs === "jj" ? item.present : !item.bare && !item.prunable));
|
|
38965
|
-
if (tree)
|
|
38966
|
-
draft = selectWorktree(draft, tree);
|
|
38967
|
-
}
|
|
38968
|
+
draft = changeProjectChoice(draft, known(host, inspected.success.project, inspected.success.checkout));
|
|
38969
|
+
useProject(inspected.success);
|
|
38968
38970
|
} else if (draft.projectChoice) {
|
|
38969
38971
|
const inspected = yield* exports_Effect.result(bindProject(draft.projectChoice, host, found.projects));
|
|
38970
38972
|
if (exports_Result.isFailure(inspected)) {
|
|
@@ -38972,17 +38974,8 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38972
38974
|
error2 = problem(inspected.failure);
|
|
38973
38975
|
return;
|
|
38974
38976
|
}
|
|
38975
|
-
if (inspected.success)
|
|
38976
|
-
|
|
38977
|
-
if (inspected.success.checkout.vcs === "jj" && !draft.sourcePath)
|
|
38978
|
-
draft = { ...draft, sourcePath: inspected.success.checkout.path };
|
|
38979
|
-
if (!draft.destination) {
|
|
38980
|
-
const checkoutPath = inspected.success.checkout.path;
|
|
38981
|
-
const tree = inspected.success.worktrees.find((item) => item.path === checkoutPath && (item.vcs === "jj" ? item.present : !item.bare && !item.prunable));
|
|
38982
|
-
if (tree)
|
|
38983
|
-
draft = selectWorktree(draft, tree);
|
|
38984
|
-
}
|
|
38985
|
-
}
|
|
38977
|
+
if (inspected.success)
|
|
38978
|
+
useProject(inspected.success);
|
|
38986
38979
|
}
|
|
38987
38980
|
error2 = undefined;
|
|
38988
38981
|
});
|
|
@@ -39033,27 +39026,17 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39033
39026
|
value: draft.mode === "auto" ? "Reuse matching tab, otherwise new tab" : draft.mode === "new-tab" ? "Always new tab" : "Split matching tab, otherwise new tab",
|
|
39034
39027
|
disabled: !draft.host
|
|
39035
39028
|
});
|
|
39036
|
-
const awaitingConfirmation = !!(clonePlan || plan);
|
|
39037
39029
|
return {
|
|
39038
39030
|
rows: rows2.map((row) => ({ ...row, disabled: initializing || row.disabled })),
|
|
39039
|
-
submitLabel:
|
|
39040
|
-
submitDisabled: initializing || !draft.host || !(cloneInputFor(draft) || inputFor(draft)),
|
|
39041
|
-
notice:
|
|
39042
|
-
|
|
39043
|
-
clonePlan?.warning,
|
|
39044
|
-
plan?.warning,
|
|
39045
|
-
plan ? `Destination: ${plan.path}` : undefined,
|
|
39046
|
-
clonePlan && clonePlan.repo !== draft.clone?.repo ? `Changed destination: ${clonePlan.repo}` : undefined,
|
|
39047
|
-
clonePlan?.detail,
|
|
39048
|
-
clonePlan?.vcs === "jj" ? `Start from: ${draft.destination?.revision ? `${draft.destination.label} (${draft.destination.revision})` : "cloned default"}` : undefined,
|
|
39049
|
-
plan?.detail
|
|
39050
|
-
].filter(Boolean).join(" \xB7 ") || undefined,
|
|
39051
|
-
error: initializing ? undefined : error2 ?? (!draft.projectChoice ? "Select a project" : !draft.machine ? "Select a Rex machine" : !draft.host ? "Connect to the selected machine and install its worktrees helper if missing" : !(draft.project || draft.clone) ? "Select the exact project directory on this machine" : !draft.destination && draft.project?.vcs !== "jj" && draft.clone?.vcs !== "jj" ? "Select a branch" : draft.project?.vcs === "jj" && (!draft.worktreeName && !draft.destination?.path || !!draft.worktreeName && !draft.destination?.revision) ? "Choose an existing workspace or a new workspace name and starting revision" : !draft.session ? "Choose an existing Rex session or type a new name" : undefined),
|
|
39052
|
-
fitWarning: activeView?.fitWarning
|
|
39031
|
+
submitLabel: draft.clone ? "Clone & Open" : draft.destination?.path ? "Open checkout" : draft.project?.vcs === "jj" ? "Create workspace & open" : "Create checkout & open",
|
|
39032
|
+
submitDisabled: initializing || blocked || !draft.host || !(cloneInputFor(draft) || inputFor(draft)),
|
|
39033
|
+
notice: draft.clone ? "Only pushed history transfers" : undefined,
|
|
39034
|
+
error: initializing ? undefined : error2 ?? (!draft.projectChoice ? "Select a project" : !draft.machine ? "Select a Rex machine" : !draft.host ? "Connect to the selected machine and install its worktrees helper if missing" : !(draft.project || draft.clone) ? "Select the exact project directory on this machine" : !draft.destination && draft.project?.vcs !== "jj" && draft.clone?.vcs !== "jj" ? "Select a branch" : draft.project?.vcs === "jj" && (!draft.worktreeName && !draft.destination?.path || !!draft.worktreeName && !draft.destination?.revision) ? "Choose an existing workspace or a new workspace name and starting revision" : !draft.session ? "Choose an existing Rex session or type a new name" : undefined)
|
|
39053
39035
|
};
|
|
39054
39036
|
};
|
|
39055
|
-
const initialView = formView(true);
|
|
39037
|
+
const initialView = { ...formView(true), notice: "Discovering projects and Rex sessions\u2026" };
|
|
39056
39038
|
activeView = initialView;
|
|
39039
|
+
yield* terminal.display(`\x1B[H\x1B[2J${renderFormFrame(initialView, "project", yield* terminal.columns, yield* terminal.rows)}`);
|
|
39057
39040
|
const initialize = exports_Effect.gen(function* () {
|
|
39058
39041
|
contextPath = yield* context3;
|
|
39059
39042
|
yield* loadMachines;
|
|
@@ -39082,18 +39065,12 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39082
39065
|
const current2 = yield* exports_Effect.result(reviewClone(draft.host, command, cloneInput));
|
|
39083
39066
|
if (exports_Result.isFailure(current2)) {
|
|
39084
39067
|
error2 = problem(current2.failure);
|
|
39085
|
-
clonePlan = undefined;
|
|
39086
39068
|
continue;
|
|
39087
39069
|
}
|
|
39088
|
-
|
|
39089
|
-
|
|
39090
|
-
|
|
39091
|
-
|
|
39092
|
-
}
|
|
39093
|
-
const wasReviewed2 = !!clonePlan;
|
|
39094
|
-
clonePlan = current2.success;
|
|
39095
|
-
if (!wasReviewed2 && (clonePlan.warning || safeDisplayText(clonePlan.repo) !== clonePlan.repo || view.fitWarning || naturalFormRows(view, yield* terminal.columns) + 1 > (yield* terminal.rows))) {
|
|
39096
|
-
error2 = undefined;
|
|
39070
|
+
const clonePlan = current2.success;
|
|
39071
|
+
if (clonePlan.repo !== cloneInput.repo || clonePlan.hostId !== draft.host.hostId) {
|
|
39072
|
+
error2 = clonePlan.hostId !== draft.host.hostId ? "Rex target changed; select the machine again" : `Clone destination changed; edit the destination: ${clonePlan.repo}`;
|
|
39073
|
+
blocked = true;
|
|
39097
39074
|
continue;
|
|
39098
39075
|
}
|
|
39099
39076
|
const launched2 = yield* exports_Effect.result(submitClone(draft.host, command, cloneInput, clonePlan));
|
|
@@ -39103,7 +39080,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39103
39080
|
problem(launched2.failure),
|
|
39104
39081
|
`Destination: ${clonePlan.repo}`,
|
|
39105
39082
|
"A clone or Rex tab may already exist. Inspect the destination and session before opening again."
|
|
39106
|
-
], "error");
|
|
39083
|
+
], "error", view);
|
|
39107
39084
|
return yield* exports_Effect.fail(launched2.failure);
|
|
39108
39085
|
}
|
|
39109
39086
|
if (launched2.success.warning)
|
|
@@ -39112,7 +39089,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39112
39089
|
`Destination: ${launched2.success.repo}`,
|
|
39113
39090
|
"The clone task was created; Rex may not have focused its tab. Inspect the session before opening again.",
|
|
39114
39091
|
launched2.success.warning
|
|
39115
|
-
], "warning");
|
|
39092
|
+
], "warning", view);
|
|
39116
39093
|
return;
|
|
39117
39094
|
}
|
|
39118
39095
|
const input = inputFor(draft);
|
|
@@ -39121,19 +39098,12 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39121
39098
|
const current = yield* exports_Effect.result(review(draft.host, command, input));
|
|
39122
39099
|
if (exports_Result.isFailure(current)) {
|
|
39123
39100
|
error2 = problem(current.failure);
|
|
39124
|
-
plan = undefined;
|
|
39125
|
-
continue;
|
|
39126
|
-
}
|
|
39127
|
-
if (plan && (!sameLaunchPlan(current.success, plan) || current.success.warning !== plan.warning)) {
|
|
39128
|
-
error2 = `Destination or Rex target changed; review the updated action before submitting again. Destination: ${current.success.path}`;
|
|
39129
|
-
plan = current.success;
|
|
39130
39101
|
continue;
|
|
39131
39102
|
}
|
|
39132
|
-
const
|
|
39133
|
-
|
|
39134
|
-
|
|
39135
|
-
|
|
39136
|
-
error2 = changedPath ? `Destination or Rex target changed; review the updated action before submitting again. Destination: ${plan.path}` : undefined;
|
|
39103
|
+
const plan = current.success;
|
|
39104
|
+
if (plan.hostId !== draft.host.hostId || input.path && plan.path !== input.path) {
|
|
39105
|
+
error2 = plan.hostId !== draft.host.hostId ? "Rex target changed; select the machine again" : `Destination changed; select the checkout again: ${plan.path}`;
|
|
39106
|
+
blocked = true;
|
|
39137
39107
|
continue;
|
|
39138
39108
|
}
|
|
39139
39109
|
const launched = yield* exports_Effect.result(submit(draft.host, command, input, plan));
|
|
@@ -39143,7 +39113,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39143
39113
|
problem(launched.failure),
|
|
39144
39114
|
`Destination: ${plan.path}`,
|
|
39145
39115
|
"The checkout or Rex tab may already have changed. Inspect the session before opening again."
|
|
39146
|
-
], "error");
|
|
39116
|
+
], "error", view);
|
|
39147
39117
|
return yield* exports_Effect.fail(launched.failure);
|
|
39148
39118
|
}
|
|
39149
39119
|
if (launched.success.warning || plan.warning)
|
|
@@ -39153,7 +39123,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39153
39123
|
`Action: ${launched.success.action}`,
|
|
39154
39124
|
launched.success.pending ? `Task submitted; ${plan.vcs === "jj" ? "JJ" : "Git"} setup may still be running.` : "Existing task focused.",
|
|
39155
39125
|
...new Set([plan.warning, launched.success.warning].filter((line) => !!line))
|
|
39156
|
-
], "warning");
|
|
39126
|
+
], "warning", view);
|
|
39157
39127
|
return;
|
|
39158
39128
|
}
|
|
39159
39129
|
if (view.rows.find((row) => row.id === action)?.disabled)
|
|
@@ -39184,26 +39154,14 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39184
39154
|
return yield* exports_Effect.fail(new AppError({ message: "Project name is required" }));
|
|
39185
39155
|
const host = draft.host;
|
|
39186
39156
|
if (host) {
|
|
39187
|
-
const
|
|
39188
|
-
|
|
39189
|
-
const inspected = yield* bindProject(choice, host, found.projects);
|
|
39157
|
+
const available = projects.flatMap((item) => item.source?.machineKey === host.key && item.source.hostId === host.hostId ? [item.source.repository] : []);
|
|
39158
|
+
const inspected = yield* bindProject(choice, host, available);
|
|
39190
39159
|
if (inspected) {
|
|
39191
39160
|
draft = changeProjectChoice(draft, choice);
|
|
39192
|
-
|
|
39193
|
-
if (inspected.
|
|
39194
|
-
|
|
39195
|
-
const tree = inspected.worktrees.find((item) => item.path === inspected.checkout.path && (item.vcs === "jj" ? item.present : !item.bare && !item.prunable));
|
|
39196
|
-
if (tree)
|
|
39197
|
-
draft = selectWorktree(draft, tree);
|
|
39161
|
+
useProject(inspected);
|
|
39162
|
+
if (!available.some((repo) => repo.vcs === inspected.project.vcs && repo.commonDir === inspected.project.commonDir))
|
|
39163
|
+
projects.push(known(host, inspected.project, inspected.checkout));
|
|
39198
39164
|
}
|
|
39199
|
-
projects = [
|
|
39200
|
-
...projects.filter((item) => item.source?.machineKey !== host.key || item.source.hostId !== host.hostId),
|
|
39201
|
-
...found.projects.map((repo) => known(host, repo, found.checkout))
|
|
39202
|
-
];
|
|
39203
|
-
sessions = found.sessions;
|
|
39204
|
-
if (draft.session?.kind === "existing" && !sessions.some((item) => item.id === (draft.session?.kind === "existing" ? draft.session.id : undefined)))
|
|
39205
|
-
draft = { ...draft, session: sessions.length === 1 ? { kind: "existing", id: sessions[0].id } : undefined };
|
|
39206
|
-
draft = { ...draft, clientId: focusClient(found.clients) };
|
|
39207
39165
|
} else
|
|
39208
39166
|
draft = changeProjectChoice(draft, choice);
|
|
39209
39167
|
} else if (action === "destination") {
|
|
@@ -39258,8 +39216,6 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39258
39216
|
const existing = trees.find((tree) => tree.vcs === "git" && tree.branch === branch);
|
|
39259
39217
|
draft = existing ? selectWorktree(draft, existing) : changeDestination(draft, { branch, label: branch }, draft.worktreeName);
|
|
39260
39218
|
} else {
|
|
39261
|
-
if (picked.value.vcs === "jj" && (!picked.value.present || !picked.value.path))
|
|
39262
|
-
return yield* exports_Effect.fail(new AppError({ message: `Workspace ${picked.value.name} is unavailable; inspect its registered location before opening` }));
|
|
39263
39219
|
draft = selectWorktree(draft, picked.value);
|
|
39264
39220
|
}
|
|
39265
39221
|
} else {
|
|
@@ -39355,7 +39311,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39355
39311
|
} else if (action === "session") {
|
|
39356
39312
|
if (!draft.host)
|
|
39357
39313
|
return yield* exports_Effect.fail(new AppError({ message: "Select a machine before choosing a session" }));
|
|
39358
|
-
const found = yield*
|
|
39314
|
+
const found = yield* inspectSessions(draft.host, command);
|
|
39359
39315
|
sessions = found.sessions;
|
|
39360
39316
|
draft = { ...draft, clientId: focusClient(found.clients) };
|
|
39361
39317
|
const picked = yield* inputChoice({
|
|
@@ -39378,11 +39334,14 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39378
39334
|
if (!exports_Terminal.isQuitError(editing.failure))
|
|
39379
39335
|
error2 = problem(editing.failure);
|
|
39380
39336
|
} else {
|
|
39381
|
-
|
|
39382
|
-
clonePlan = undefined;
|
|
39337
|
+
blocked = false;
|
|
39383
39338
|
}
|
|
39384
39339
|
}
|
|
39385
|
-
}).pipe(exports_Effect.catchCause((cause) => exports_Cause.hasInterrupts(cause) || launchAcknowledged ? exports_Effect.failCause(cause) : acknowledge("Could not open worktrees", [exports_Cause.pretty(cause)], "error").pipe(exports_Effect.andThen(exports_Effect.failCause(cause)))))
|
|
39340
|
+
}).pipe(exports_Effect.catchCause((cause) => exports_Cause.hasInterrupts(cause) || launchAcknowledged ? exports_Effect.failCause(cause) : acknowledge("Could not open worktrees", [exports_Cause.pretty(cause)], "error").pipe(exports_Effect.andThen(exports_Effect.failCause(cause)))), exports_Effect.provideServiceEffect(exports_Terminal.Terminal, exports_Effect.gen(function* () {
|
|
39341
|
+
const terminal = yield* exports_Terminal.Terminal;
|
|
39342
|
+
const input = yield* terminal.readInput;
|
|
39343
|
+
return { ...terminal, readInput: exports_Effect.succeed(input) };
|
|
39344
|
+
})));
|
|
39386
39345
|
}));
|
|
39387
39346
|
|
|
39388
39347
|
// src/main.ts
|
|
@@ -39445,10 +39404,11 @@ var main = exports_Effect.gen(function* () {
|
|
|
39445
39404
|
if (!compiled)
|
|
39446
39405
|
return yield* exports_Effect.fail(new AppError({ message: "Build first with bun run build, then run ./dist/rex-worktrees setup" }));
|
|
39447
39406
|
const installed = yield* setup(flags["--bin"], flags["--config"]);
|
|
39448
|
-
yield* exports_Console.log(
|
|
39407
|
+
yield* exports_Console.log(`Default binary: ${installed.bin}
|
|
39449
39408
|
Installed Lua module: ${installed.luaPath}
|
|
39450
|
-
|
|
39451
|
-
|
|
39409
|
+
Rex config: ${installed.configPath}${installed.migrated ? `
|
|
39410
|
+
Migrated legacy JSON settings to Rex Lua; removed legacy files.` : ""}${flags["--config"] ? `
|
|
39411
|
+
Reload the targeted Rex config to activate, or start that instance if it is stopped.` : `
|
|
39452
39412
|
Run rex config reload to activate.`}`);
|
|
39453
39413
|
return;
|
|
39454
39414
|
}
|
|
@@ -39571,14 +39531,14 @@ Run rex config reload to activate.`}`);
|
|
|
39571
39531
|
if (args2.length !== 1)
|
|
39572
39532
|
return yield* exports_Effect.fail(new AppError({ message: "task requires one JSON argument" }));
|
|
39573
39533
|
const request4 = yield* exports_Schema.decodeUnknownEffect(exports_Schema.fromJsonString(TaskRequestSchema))(args2[0]);
|
|
39574
|
-
yield* task(request4);
|
|
39534
|
+
yield* withLocalIdentity(withToolValidation(task(request4)));
|
|
39575
39535
|
return;
|
|
39576
39536
|
}
|
|
39577
39537
|
if (verb === "clone-task") {
|
|
39578
39538
|
if (args2.length !== 1)
|
|
39579
39539
|
return yield* exports_Effect.fail(new AppError({ message: "clone-task requires one JSON argument" }));
|
|
39580
39540
|
const request4 = yield* exports_Schema.decodeUnknownEffect(exports_Schema.fromJsonString(CloneTaskRequestSchema))(args2[0]);
|
|
39581
|
-
yield* cloneTask(request4);
|
|
39541
|
+
yield* withLocalIdentity(withToolValidation(cloneTask(request4)));
|
|
39582
39542
|
return;
|
|
39583
39543
|
}
|
|
39584
39544
|
if (verb === "host-request") {
|