rex-worktrees 0.4.0 → 0.4.4
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 +60 -106
- package/dist/rex-worktrees +1 -1
- package/dist/rex-worktrees.js +313 -422
- 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({
|
|
@@ -33525,13 +33578,6 @@ var ConfigSchema = exports_Schema.Struct({
|
|
|
33525
33578
|
worktreeRoot: exports_Schema.optional(exports_Schema.String)
|
|
33526
33579
|
});
|
|
33527
33580
|
var NativeConfigSchema = exports_Schema.Struct({ config: ConfigSchema, directory: exports_Schema.String });
|
|
33528
|
-
var ResolvedConfigSchema = exports_Schema.Struct({
|
|
33529
|
-
roots: exports_Schema.Array(exports_Schema.String),
|
|
33530
|
-
projects: exports_Schema.Array(exports_Schema.String),
|
|
33531
|
-
worktreeRoot: exports_Schema.UndefinedOr(exports_Schema.String),
|
|
33532
|
-
projectRoots: exports_Schema.Array(exports_Schema.Struct({ path: exports_Schema.String, worktreeRoot: exports_Schema.String }))
|
|
33533
|
-
});
|
|
33534
|
-
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), legacyConfigPath: exports_Schema.optional(exports_Schema.String) });
|
|
33535
33581
|
var AssociationSchema = exports_Schema.Struct({
|
|
33536
33582
|
vcs: VcsSchema,
|
|
33537
33583
|
hostId: ServerHostIdSchema,
|
|
@@ -33714,6 +33760,7 @@ var TaskRequestSchema = exports_Schema.Union([GitTaskRequestSchema, JjTaskReques
|
|
|
33714
33760
|
var RequestIdentitySchema = exports_Schema.Struct({ version: exports_Schema.Literal(4), hostId: ServerHostIdSchema });
|
|
33715
33761
|
var RequestSchema = exports_Schema.Union([
|
|
33716
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") }),
|
|
33717
33764
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("clone-source"), repo: exports_Schema.String }),
|
|
33718
33765
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("project"), path: exports_Schema.String }),
|
|
33719
33766
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("worktrees"), repo: exports_Schema.String }),
|
|
@@ -33725,6 +33772,7 @@ var RequestSchema = exports_Schema.Union([
|
|
|
33725
33772
|
]);
|
|
33726
33773
|
var ResponseSchema = exports_Schema.Union([
|
|
33727
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) }),
|
|
33728
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) }),
|
|
33729
33777
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("project-missing"), path: exports_Schema.String }),
|
|
33730
33778
|
exports_Schema.Struct({ ...RequestIdentitySchema.fields, kind: exports_Schema.Literal("clone-source"), source: CloneSourceSchema }),
|
|
@@ -33738,8 +33786,6 @@ var ResponseSchema = exports_Schema.Union([
|
|
|
33738
33786
|
var RexWorktreesResponseSchema = exports_Schema.fromJsonString(exports_Schema.fromJsonString(ResponseSchema));
|
|
33739
33787
|
var RexNativeConfigResponseSchema = exports_Schema.fromJsonString(exports_Schema.fromJsonString(NativeConfigSchema));
|
|
33740
33788
|
var PopupOriginSchema = exports_Schema.Struct({ sessionId: exports_Schema.optional(SessionIdSchema), blockId: exports_Schema.optional(BlockIdSchema), clientId: exports_Schema.optional(ClientIdSchema) });
|
|
33741
|
-
var PopupSizeSchema = exports_Schema.Struct({ columns: exports_Schema.Number, rows: exports_Schema.Number });
|
|
33742
|
-
var PopupBoundsSchema = exports_Schema.Tuple([exports_Schema.Number, exports_Schema.Number, exports_Schema.Number, exports_Schema.Number]);
|
|
33743
33789
|
var RexIdentitySchema = exports_Schema.Struct({ host_id: ServerHostIdSchema, endpoint: exports_Schema.String, principal: exports_Schema.Struct({ transport: exports_Schema.String }) });
|
|
33744
33790
|
var RexSessionsSchema = exports_Schema.Struct({ sessions: exports_Schema.Array(exports_Schema.Struct({ session_id: SessionIdSchema, label: exports_Schema.String })) });
|
|
33745
33791
|
var RexSessionCreatedSchema = exports_Schema.Struct({ session_id: SessionIdSchema });
|
|
@@ -33762,15 +33808,10 @@ var RexViewSchema = exports_Schema.Struct({
|
|
|
33762
33808
|
windows: exports_Schema.Array(exports_Schema.Struct({
|
|
33763
33809
|
window_id: WindowIdSchema,
|
|
33764
33810
|
layers: exports_Schema.Array(exports_Schema.Struct({
|
|
33765
|
-
layer_id: exports_Schema.NullOr(LayerIdSchema),
|
|
33766
|
-
kind: exports_Schema.String,
|
|
33767
|
-
bounds: exports_Schema.optional(exports_Schema.NullOr(PopupBoundsSchema)),
|
|
33768
33811
|
blocks: exports_Schema.Array(exports_Schema.Struct({ block_id: BlockIdSchema, owner: exports_Schema.optional(exports_Schema.NullOr(ClientIdSchema)) }))
|
|
33769
33812
|
}))
|
|
33770
33813
|
}))
|
|
33771
33814
|
});
|
|
33772
|
-
var RexResizedSchema = exports_Schema.Struct({ revision: exports_Schema.Number });
|
|
33773
|
-
var RexTerminalSizeSchema = exports_Schema.Struct({ ...PopupSizeSchema.fields, owner: exports_Schema.NullOr(ClientIdSchema) });
|
|
33774
33815
|
var RexCreatedSchema = exports_Schema.Struct({ window_id: exports_Schema.optional(WindowIdSchema), block_ids: exports_Schema.Array(BlockIdSchema) });
|
|
33775
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 });
|
|
33776
33817
|
var RexDirectorySchema = exports_Schema.Struct({ pwd: exports_Schema.optional(exports_Schema.String) });
|
|
@@ -33812,19 +33853,17 @@ var CliFlagsSchema = exports_Schema.Struct({
|
|
|
33812
33853
|
// src/process.ts
|
|
33813
33854
|
var run4 = exports_Effect.fnUntraced(function* (program, args2, cwd, env) {
|
|
33814
33855
|
const spawner = yield* exports_ChildProcessSpawner.ChildProcessSpawner;
|
|
33815
|
-
|
|
33816
|
-
|
|
33817
|
-
|
|
33818
|
-
|
|
33819
|
-
|
|
33820
|
-
|
|
33821
|
-
|
|
33822
|
-
|
|
33823
|
-
|
|
33824
|
-
|
|
33825
|
-
|
|
33826
|
-
}));
|
|
33827
|
-
});
|
|
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);
|
|
33828
33867
|
|
|
33829
33868
|
// src/checkout.ts
|
|
33830
33869
|
var fail16 = (message) => exports_Effect.fail(new AppError({ message }));
|
|
@@ -33919,16 +33958,16 @@ var safeOrigin = (raw, sameHost, base) => {
|
|
|
33919
33958
|
return raw;
|
|
33920
33959
|
throw new Error("Unsafe origin URL");
|
|
33921
33960
|
};
|
|
33922
|
-
var origin = exports_Effect.fnUntraced(function* (repoPath
|
|
33961
|
+
var origin = exports_Effect.fnUntraced(function* (repoPath) {
|
|
33923
33962
|
const raw = yield* git(repoPath, "config", "--get", "remote.origin.url").pipe(exports_Effect.catch(() => fail17("Repository has no usable origin URL")));
|
|
33924
33963
|
return yield* exports_Effect.try({
|
|
33925
|
-
try: () => safeOrigin(raw.replace(/\n$/, ""),
|
|
33964
|
+
try: () => safeOrigin(raw.replace(/\n$/, ""), true, repoPath),
|
|
33926
33965
|
catch: () => new AppError({ message: "Repository origin URL is unsafe or local to another Rex host" })
|
|
33927
33966
|
});
|
|
33928
33967
|
});
|
|
33929
33968
|
var cloneSource = exports_Effect.fnUntraced(function* (repoPath, sourceHostId) {
|
|
33930
33969
|
const repo = yield* repository(repoPath);
|
|
33931
|
-
const url = yield* origin(repo.path
|
|
33970
|
+
const url = yield* origin(repo.path);
|
|
33932
33971
|
const refs = yield* git(repo.path, "for-each-ref", "--format=%(refname)", "refs/heads", "refs/remotes/origin");
|
|
33933
33972
|
const branches = [...new Set(refs.split(`
|
|
33934
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)] : []))];
|
|
@@ -33959,6 +33998,7 @@ var cloneRepository = exports_Effect.fnUntraced(function* (url, destination) {
|
|
|
33959
33998
|
env.GIT_TERMINAL_PROMPT = "1";
|
|
33960
33999
|
const child = yield* spawner.spawn(exports_ChildProcess.make("git", ["clone", "--origin", "origin", "--", url, destination], {
|
|
33961
34000
|
env,
|
|
34001
|
+
detached: false,
|
|
33962
34002
|
stdin: "inherit",
|
|
33963
34003
|
stdout: "inherit",
|
|
33964
34004
|
stderr: "inherit"
|
|
@@ -34017,7 +34057,7 @@ var project = exports_Effect.fnUntraced(function* (input) {
|
|
|
34017
34057
|
return checkout;
|
|
34018
34058
|
if (primary.path === checkout.path)
|
|
34019
34059
|
return checkout;
|
|
34020
|
-
const main = primary.bare ? undefined : yield*
|
|
34060
|
+
const main = primary.bare ? undefined : yield* repository(primary.path).pipe(exports_Effect.catchIf((error2) => missing3(error2) || notRepository(error2), () => exports_Effect.succeed(undefined)));
|
|
34021
34061
|
return main?.commonDir === checkout.commonDir ? main : { ...checkout, name: path.basename(primary.path) };
|
|
34022
34062
|
});
|
|
34023
34063
|
var listBranches = exports_Effect.fnUntraced(function* (repoPath) {
|
|
@@ -34115,7 +34155,7 @@ var isolatedEnv = () => {
|
|
|
34115
34155
|
};
|
|
34116
34156
|
var jj = (repo, ...args2) => run4("jj", ["-R", repo, "--no-pager", "--color=never", ...args2], undefined, isolatedEnv());
|
|
34117
34157
|
var inventory = (repo, ...args2) => jj(repo, "--ignore-working-copy", "--at-op=@", ...args2);
|
|
34118
|
-
var
|
|
34158
|
+
var checkVersion = exports_Effect.fnUntraced(function* () {
|
|
34119
34159
|
for (const [program, minimum] of [["jj", [0, 46]], ["git", [2, 42]]]) {
|
|
34120
34160
|
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`)));
|
|
34121
34161
|
const match9 = /\b(\d+)\.(\d+)(?:\.\d+)?\b/.exec(output);
|
|
@@ -34124,6 +34164,9 @@ var version = exports_Effect.fnUntraced(function* () {
|
|
|
34124
34164
|
}
|
|
34125
34165
|
}
|
|
34126
34166
|
});
|
|
34167
|
+
var ToolValidation = exports_Context.Reference("rex-worktrees/JjToolValidation", { defaultValue: () => checkVersion() });
|
|
34168
|
+
var version = exports_Effect.flatten(ToolValidation);
|
|
34169
|
+
var withToolValidation = exports_Effect.provideServiceEffect(ToolValidation, exports_Effect.cached(checkVersion()));
|
|
34127
34170
|
var workspaceTemplate = 'json({"name" => name, "path" => root, "commitId" => self.target().commit_id(), "changeId" => self.target().change_id()}) ++ "\\n"';
|
|
34128
34171
|
var revisionTemplate = 'json({"commitId" => commit_id, "changeId" => change_id, "description" => description, "conflict" => self.conflict()}) ++ "\\n"';
|
|
34129
34172
|
var workspaceRow = exports_Schema.Struct({ name: JjWorkspaceNameSchema, path: exports_Schema.NullOr(exports_Schema.String), commitId: JjCommitIdSchema, changeId: JjChangeIdSchema });
|
|
@@ -34181,7 +34224,7 @@ var metadata = exports_Effect.fnUntraced(function* (dot) {
|
|
|
34181
34224
|
return target;
|
|
34182
34225
|
});
|
|
34183
34226
|
var repository2 = exports_Effect.fnUntraced(function* (input) {
|
|
34184
|
-
yield* version
|
|
34227
|
+
yield* version;
|
|
34185
34228
|
const path = yield* exports_Path.Path;
|
|
34186
34229
|
const { directory, dot } = yield* marker(input);
|
|
34187
34230
|
return { vcs: "jj", path: directory, commonDir: yield* metadata(dot), name: path.basename(directory) };
|
|
@@ -34231,9 +34274,15 @@ var resolveRevision = exports_Effect.fnUntraced(function* (repo, expression) {
|
|
|
34231
34274
|
});
|
|
34232
34275
|
var listRevisions = exports_Effect.fnUntraced(function* (repo) {
|
|
34233
34276
|
const current = yield* repository2(repo);
|
|
34234
|
-
const
|
|
34277
|
+
const candidates = ["@-", "bookmarks()", "remote_bookmarks()"];
|
|
34278
|
+
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("")));
|
|
34279
|
+
const [bookmarkText, mainline, ...candidateText] = yield* exports_Effect.all([
|
|
34280
|
+
inventory(current.path, "bookmark", "list", "-T", bookmarkTemplate),
|
|
34281
|
+
mainlineQuery,
|
|
34282
|
+
...candidates.map((expression) => inventory(current.path, "log", "-r", expression, "--no-graph", "--limit", "40", "-T", revisionTemplate))
|
|
34283
|
+
], { concurrency: 4 });
|
|
34284
|
+
const bookmarks = (yield* rows(bookmarkRow, bookmarkText)).filter((item) => item.present && !item.conflict && /^[0-9a-f]{40,64}$/.test(item.target));
|
|
34235
34285
|
const choices = [];
|
|
34236
|
-
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("")));
|
|
34237
34286
|
const mainlineRows = yield* rows(revisionRow, mainline);
|
|
34238
34287
|
if (mainlineRows.length === 1 && !mainlineRows[0].conflict && !/^0+$/.test(mainlineRows[0].commitId)) {
|
|
34239
34288
|
const item = mainlineRows[0];
|
|
@@ -34243,9 +34292,8 @@ var listRevisions = exports_Effect.fnUntraced(function* (repo) {
|
|
|
34243
34292
|
revision: { commitId: item.commitId, changeId: item.changeId, description: item.description }
|
|
34244
34293
|
});
|
|
34245
34294
|
}
|
|
34246
|
-
const
|
|
34247
|
-
|
|
34248
|
-
const raw = yield* inventory(current.path, "log", "-r", expression, "--no-graph", "--limit", "40", "-T", revisionTemplate);
|
|
34295
|
+
for (const [index2, expression] of candidates.entries()) {
|
|
34296
|
+
const raw = candidateText[index2];
|
|
34249
34297
|
for (const item of yield* rows(revisionRow, raw)) {
|
|
34250
34298
|
if (item.conflict || choices.some((choice) => choice.revision.commitId === item.commitId))
|
|
34251
34299
|
continue;
|
|
@@ -34317,11 +34365,12 @@ var newChange = exports_Effect.fnUntraced(function* (repo, base) {
|
|
|
34317
34365
|
return after;
|
|
34318
34366
|
});
|
|
34319
34367
|
var cloneRepository2 = exports_Effect.fnUntraced(function* (url, destination) {
|
|
34320
|
-
yield* version
|
|
34368
|
+
yield* version;
|
|
34321
34369
|
const safe = yield* exports_Effect.try({ try: () => safeOrigin(url, true), catch: () => new AppError({ message: "Unsafe JJ clone URL" }) });
|
|
34322
34370
|
const spawner = yield* exports_ChildProcessSpawner.ChildProcessSpawner;
|
|
34323
34371
|
const child = yield* spawner.spawn(exports_ChildProcess.make("jj", ["git", "clone", safe, destination], {
|
|
34324
34372
|
env: isolatedEnv(),
|
|
34373
|
+
detached: false,
|
|
34325
34374
|
stdin: "inherit",
|
|
34326
34375
|
stdout: "inherit",
|
|
34327
34376
|
stderr: "inherit"
|
|
@@ -34363,25 +34412,13 @@ var discoverProjects = exports_Effect.fnUntraced(function* (roots, explicitProje
|
|
|
34363
34412
|
if (!(yield* fs.exists(root)))
|
|
34364
34413
|
continue;
|
|
34365
34414
|
candidates.push(root);
|
|
34366
|
-
|
|
34367
|
-
|
|
34368
|
-
if (!(yield* fs.exists(first)))
|
|
34369
|
-
continue;
|
|
34370
|
-
const info2 = yield* fs.stat(first);
|
|
34371
|
-
if (info2.type !== "Directory")
|
|
34372
|
-
continue;
|
|
34373
|
-
candidates.push(first);
|
|
34374
|
-
for (const child of yield* fs.readDirectory(first)) {
|
|
34375
|
-
const second = path.join(first, child);
|
|
34376
|
-
if ((yield* fs.exists(second)) && (yield* fs.stat(second)).type === "Directory")
|
|
34377
|
-
candidates.push(second);
|
|
34378
|
-
}
|
|
34379
|
-
}
|
|
34415
|
+
const markers = yield* fs.glob("{*,*/*}/{.git,.jj}", { root, dot: true });
|
|
34416
|
+
candidates.push(...markers.map((marker2) => path.join(root, path.dirname(marker2))));
|
|
34380
34417
|
}
|
|
34381
34418
|
const found = [];
|
|
34382
34419
|
const seen = new Set;
|
|
34383
|
-
|
|
34384
|
-
|
|
34420
|
+
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 });
|
|
34421
|
+
for (const repo of inspected) {
|
|
34385
34422
|
if (repo && !seen.has(`${repo.vcs}\x00${repo.commonDir}`)) {
|
|
34386
34423
|
seen.add(`${repo.vcs}\x00${repo.commonDir}`);
|
|
34387
34424
|
found.push(repo);
|
|
@@ -34490,7 +34527,7 @@ var machinesRegistry = exports_Effect.gen(function* () {
|
|
|
34490
34527
|
const path = yield* exports_Path.Path;
|
|
34491
34528
|
return yield* parse3(RexRegistrySchema, yield* run4(yield* binary(path), ["hosts", "list", "--json"], undefined, nativeEnv()));
|
|
34492
34529
|
});
|
|
34493
|
-
var
|
|
34530
|
+
var readLocalIdentity = exports_Effect.gen(function* () {
|
|
34494
34531
|
const path = yield* exports_Path.Path;
|
|
34495
34532
|
const endpoint = process.env.REX_WORKTREES_LOCAL_ENDPOINT;
|
|
34496
34533
|
if (endpoint !== undefined && !endpoint.startsWith("unix:///")) {
|
|
@@ -34502,6 +34539,9 @@ var localIdentity = exports_Effect.gen(function* () {
|
|
|
34502
34539
|
}
|
|
34503
34540
|
return identity3;
|
|
34504
34541
|
});
|
|
34542
|
+
var LocalIdentity = exports_Context.Reference("rex-worktrees/LocalIdentity", { defaultValue: () => readLocalIdentity });
|
|
34543
|
+
var localIdentity = exports_Effect.flatten(LocalIdentity);
|
|
34544
|
+
var withLocalIdentity = exports_Effect.provideServiceEffect(LocalIdentity, exports_Effect.cached(readLocalIdentity));
|
|
34505
34545
|
var localEndpoint = exports_Effect.gen(function* () {
|
|
34506
34546
|
const explicit = process.env.REX_WORKTREES_LOCAL_ENDPOINT;
|
|
34507
34547
|
if (explicit !== undefined) {
|
|
@@ -34555,88 +34595,7 @@ var originDirectory = exports_Effect.fnUntraced(function* (sessionId, blockId) {
|
|
|
34555
34595
|
const processInfo = yield* parse3(RexProcessSchema, yield* rex(["block", "call", "-s", sessionId, "-b", blockId, "process"]));
|
|
34556
34596
|
const cwd = processInfo.foreground?.cwd;
|
|
34557
34597
|
return cwd?.startsWith("/") && !cwd.includes("\x00") ? cwd : undefined;
|
|
34558
|
-
});
|
|
34559
|
-
var fitPopupBounds = (bounds, preferred, observed) => {
|
|
34560
|
-
if (![...bounds, preferred.columns, preferred.rows, observed.columns, observed.rows].every(Number.isFinite) || bounds[2] <= 0 || bounds[3] <= 0 || observed.columns <= 0 || observed.rows <= 0 || preferred.columns <= 0 || preferred.rows <= 0)
|
|
34561
|
-
return;
|
|
34562
|
-
const wantsWidth = observed.columns < preferred.columns || observed.columns > preferred.columns + 2;
|
|
34563
|
-
const wantsHeight = observed.rows < preferred.rows || observed.rows > preferred.rows + 1;
|
|
34564
|
-
const width2 = wantsWidth ? Math.min(0.92, bounds[2] * (preferred.columns + 1) / observed.columns) : bounds[2];
|
|
34565
|
-
const height = wantsHeight ? Math.min(0.88, bounds[3] * (preferred.rows + 1) / observed.rows) : bounds[3];
|
|
34566
|
-
const next = [(1 - width2) / 2, (1 - height) / 2, width2, height];
|
|
34567
|
-
return Math.abs(width2 - bounds[2]) > 0.000000001 || Math.abs(height - bounds[3]) > 0.000000001 ? next : undefined;
|
|
34568
|
-
};
|
|
34569
|
-
var makePopupSizer = exports_Effect.gen(function* () {
|
|
34570
|
-
const path = yield* exports_Path.Path;
|
|
34571
|
-
const spawner = yield* exports_ChildProcessSpawner.ChildProcessSpawner;
|
|
34572
|
-
let endpoint;
|
|
34573
|
-
const localRex = exports_Effect.fnUntraced(function* (args2) {
|
|
34574
|
-
endpoint ??= yield* localEndpoint.pipe(exports_Effect.provideService(exports_Path.Path, path), exports_Effect.provideService(exports_ChildProcessSpawner.ChildProcessSpawner, spawner));
|
|
34575
|
-
return yield* run4(yield* binary(path), ["-S", endpoint, "--autostart=false", ...args2], undefined, nativeEnv()).pipe(exports_Effect.provideService(exports_ChildProcessSpawner.ChildProcessSpawner, spawner));
|
|
34576
|
-
});
|
|
34577
|
-
const sessionId = process.env.REX_SESSION === undefined ? undefined : yield* exports_Schema.decodeUnknownEffect(SessionIdSchema)(process.env.REX_SESSION);
|
|
34578
|
-
const blockId = process.env.REX_BLOCK === undefined ? undefined : yield* exports_Schema.decodeUnknownEffect(BlockIdSchema)(process.env.REX_BLOCK);
|
|
34579
|
-
let pending;
|
|
34580
|
-
let settled;
|
|
34581
|
-
let warning;
|
|
34582
|
-
let targetSize;
|
|
34583
|
-
let attempts = 0;
|
|
34584
|
-
const resize = exports_Effect.fnUntraced(function* (preferred, observed) {
|
|
34585
|
-
if (!sessionId || !blockId || !observed.columns || !observed.rows)
|
|
34586
|
-
return;
|
|
34587
|
-
const desired = `${preferred.columns}x${preferred.rows}`;
|
|
34588
|
-
if (targetSize !== desired) {
|
|
34589
|
-
targetSize = desired;
|
|
34590
|
-
settled = undefined;
|
|
34591
|
-
attempts = 0;
|
|
34592
|
-
}
|
|
34593
|
-
const seen = `${observed.columns}x${observed.rows}`;
|
|
34594
|
-
if (seen === pending)
|
|
34595
|
-
return warning;
|
|
34596
|
-
if (pending !== undefined && seen !== pending)
|
|
34597
|
-
pending = undefined;
|
|
34598
|
-
const target = `${preferred.columns}x${preferred.rows}:${seen}`;
|
|
34599
|
-
if (settled === target)
|
|
34600
|
-
return warning;
|
|
34601
|
-
if (attempts >= 5)
|
|
34602
|
-
return warning = observed.rows < preferred.rows || observed.columns < 20 ? "Could not fit Rex popup: reached the native resize limit; enlarge the Rex window" : undefined;
|
|
34603
|
-
const view = yield* parse3(RexViewSchema, yield* localRex(["api", "call", "-s", sessionId, "session.view", JSON.stringify({ session_id: sessionId })]));
|
|
34604
|
-
const layer12 = view.windows.flatMap((window) => window.layers).find((layer13) => layer13.kind === "floating" && layer13.blocks.some((block) => block.block_id === blockId));
|
|
34605
|
-
if (!layer12?.layer_id || !layer12.bounds) {
|
|
34606
|
-
settled = target;
|
|
34607
|
-
return;
|
|
34608
|
-
}
|
|
34609
|
-
const size8 = yield* parse3(RexTerminalSizeSchema, yield* localRex(["block", "call", "-s", sessionId, "-b", blockId, "size"]));
|
|
34610
|
-
if (!size8.owner)
|
|
34611
|
-
return;
|
|
34612
|
-
if (size8.columns !== observed.columns || size8.rows !== observed.rows) {
|
|
34613
|
-
settled = target;
|
|
34614
|
-
return;
|
|
34615
|
-
}
|
|
34616
|
-
const bounds = fitPopupBounds(layer12.bounds, preferred, observed);
|
|
34617
|
-
if (!bounds) {
|
|
34618
|
-
settled = target;
|
|
34619
|
-
attempts = 0;
|
|
34620
|
-
return warning = observed.rows < preferred.rows || observed.columns < 20 ? "Could not fit Rex popup: window is too small for the form" : undefined;
|
|
34621
|
-
}
|
|
34622
|
-
yield* parse3(RexResizedSchema, yield* localRex([
|
|
34623
|
-
"api",
|
|
34624
|
-
"call",
|
|
34625
|
-
"-s",
|
|
34626
|
-
sessionId,
|
|
34627
|
-
"session.resize_layer",
|
|
34628
|
-
JSON.stringify({ session_id: sessionId, layer_id: layer12.layer_id, bounds })
|
|
34629
|
-
]));
|
|
34630
|
-
attempts++;
|
|
34631
|
-
pending = seen;
|
|
34632
|
-
warning = undefined;
|
|
34633
|
-
return;
|
|
34634
|
-
}, (effect2, preferred, observed) => effect2.pipe(exports_Effect.catch((error2) => exports_Effect.sync(() => {
|
|
34635
|
-
settled = `${preferred.columns}x${preferred.rows}:${observed.columns}x${observed.rows}`;
|
|
34636
|
-
return warning = `Could not fit Rex popup: ${exports_Cause.pretty(exports_Cause.fail(error2))}`;
|
|
34637
|
-
}))));
|
|
34638
|
-
return resize;
|
|
34639
|
-
});
|
|
34598
|
+
}, withLocalIdentity);
|
|
34640
34599
|
var commandWithPath = (command) => {
|
|
34641
34600
|
const env = [
|
|
34642
34601
|
...process.env.PATH ? [`PATH=${process.env.PATH}`] : [],
|
|
@@ -34694,7 +34653,7 @@ var openPopup = exports_Effect.fnUntraced(function* (command, sessionId, origin2
|
|
|
34694
34653
|
const clients = (yield* parse3(RexClientsSchema, yield* localRex(["client", "ls", "--json"]))).clients.filter((client) => client.info?.kind === "app" && client.connection_state === "connected");
|
|
34695
34654
|
const clientId = [sourceOwner, origin2.clientId].find((id2) => id2 && clients.some((client) => client.client_id === id2));
|
|
34696
34655
|
const popupCommand = clientId ? [...command, "--managed-popup", "--origin-client", clientId] : [...command, "--managed-popup"];
|
|
34697
|
-
const width2 = 0.68, height = 0.
|
|
34656
|
+
const width2 = 0.68, height = 0.24;
|
|
34698
34657
|
const args2 = {
|
|
34699
34658
|
session_id: sessionId,
|
|
34700
34659
|
window_id: windowId,
|
|
@@ -34766,7 +34725,7 @@ var resolveWorktreeRoot = exports_Effect.fnUntraced(function* (repoPath) {
|
|
|
34766
34725
|
const config = yield* loadConfig;
|
|
34767
34726
|
const target = yield* project3(repoPath);
|
|
34768
34727
|
for (const entry of config.projectRoots) {
|
|
34769
|
-
const candidate = yield*
|
|
34728
|
+
const candidate = yield* repository3(entry.path).pipe(exports_Effect.catchIf((error2) => missing3(error2) || notRepository(error2), () => exports_Effect.succeed(undefined)));
|
|
34770
34729
|
if (candidate?.vcs === target.vcs && candidate.commonDir === target.commonDir)
|
|
34771
34730
|
return entry.worktreeRoot;
|
|
34772
34731
|
}
|
|
@@ -35019,6 +34978,7 @@ var shell = exports_Effect.fnUntraced(function* (cwd) {
|
|
|
35019
34978
|
const spawner = yield* exports_ChildProcessSpawner.ChildProcessSpawner;
|
|
35020
34979
|
const child = yield* spawner.spawn(exports_ChildProcess.make(program, path.basename(program) === "sh" ? ["-i"] : ["-l", "-i"], {
|
|
35021
34980
|
cwd,
|
|
34981
|
+
detached: false,
|
|
35022
34982
|
stdin: "inherit",
|
|
35023
34983
|
stdout: "inherit",
|
|
35024
34984
|
stderr: "inherit"
|
|
@@ -35128,7 +35088,7 @@ var cloneDestination = exports_Effect.fnUntraced(function* (destination, url, vc
|
|
|
35128
35088
|
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}`)));
|
|
35129
35089
|
if (repo.path !== current || repo.vcs !== vcs)
|
|
35130
35090
|
return yield* fail19(`Clone destination is not the requested ${vcs} repository: ${current}`);
|
|
35131
|
-
const actual = repo.vcs === "git" ? yield* origin(current
|
|
35091
|
+
const actual = repo.vcs === "git" ? yield* origin(current) : (yield* cloneSource2(current, sourceHostId ?? (yield* localHost).id)).url;
|
|
35132
35092
|
if (actual !== url)
|
|
35133
35093
|
return yield* fail19(`Clone destination belongs to a different origin: ${current}`);
|
|
35134
35094
|
return repo.commonDir;
|
|
@@ -35284,7 +35244,7 @@ var prepareCloneCheckout = exports_Effect.fnUntraced(function* (plan) {
|
|
|
35284
35244
|
const repo = yield* repository3(plan.repo);
|
|
35285
35245
|
if (repo.path !== plan.repo || repo.vcs !== plan.vcs || plan.existing && repo.commonDir !== plan.commonDir)
|
|
35286
35246
|
return yield* fail19(`Clone repository changed; retained at ${plan.repo}`);
|
|
35287
|
-
const actual = repo.vcs === "git" ? yield* origin(repo.path
|
|
35247
|
+
const actual = repo.vcs === "git" ? yield* origin(repo.path) : (yield* cloneSource2(repo.path, plan.hostId)).url;
|
|
35288
35248
|
if (actual !== url)
|
|
35289
35249
|
return yield* fail19(`Clone origin changed; retained at ${plan.repo}`);
|
|
35290
35250
|
if (plan.vcs === "jj") {
|
|
@@ -35366,15 +35326,20 @@ var dispatchHost = exports_Effect.fnUntraced(function* (request3, command) {
|
|
|
35366
35326
|
if (host.id !== request3.hostId)
|
|
35367
35327
|
return yield* exports_Effect.fail(new AppError({ message: `Wrong Rex host: expected ${request3.hostId}, got ${host.id}` }));
|
|
35368
35328
|
const path = yield* exports_Path.Path;
|
|
35369
|
-
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];
|
|
35329
|
+
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];
|
|
35370
35330
|
if (paths.some((value3) => !path.isAbsolute(value3)))
|
|
35371
35331
|
return yield* exports_Effect.fail(new AppError({ message: "Destination repository and worktree paths must be absolute" }));
|
|
35372
35332
|
const identity3 = { version: 4, hostId: host.id };
|
|
35373
35333
|
let result4;
|
|
35374
35334
|
switch (request3.kind) {
|
|
35335
|
+
case "sessions": {
|
|
35336
|
+
const found = yield* exports_Effect.all({ sessions: listSessions, clients: listClients }, { concurrency: 2 });
|
|
35337
|
+
result4 = { ...identity3, kind: "sessions", ...found };
|
|
35338
|
+
break;
|
|
35339
|
+
}
|
|
35375
35340
|
case "discover": {
|
|
35376
35341
|
const config = yield* loadConfig;
|
|
35377
|
-
const checkoutEffect = request3.context ?
|
|
35342
|
+
const checkoutEffect = request3.context ? repository3(request3.context).pipe(exports_Effect.catchIf((error2) => missing3(error2) || notRepository(error2), () => exports_Effect.succeed(undefined))) : exports_Effect.succeed(undefined);
|
|
35378
35343
|
const { checkout, sessions, clients, projects } = yield* exports_Effect.all({
|
|
35379
35344
|
checkout: checkoutEffect,
|
|
35380
35345
|
sessions: listSessions,
|
|
@@ -35402,14 +35367,17 @@ var dispatchHost = exports_Effect.fnUntraced(function* (request3, command) {
|
|
|
35402
35367
|
}
|
|
35403
35368
|
const checkout = yield* repository3(request3.path);
|
|
35404
35369
|
const canonical2 = yield* project3(request3.path);
|
|
35370
|
+
const inventory2 = yield* exports_Effect.all({
|
|
35371
|
+
worktrees: canonical2.vcs === "git" ? listWorktrees(canonical2.path) : listWorkspaces(canonical2.path),
|
|
35372
|
+
branches: canonical2.vcs === "git" ? listBranches(canonical2.path) : exports_Effect.succeed([]),
|
|
35373
|
+
revisions: canonical2.vcs === "jj" ? listRevisions(canonical2.path) : exports_Effect.succeed([])
|
|
35374
|
+
}, { concurrency: 4 });
|
|
35405
35375
|
result4 = {
|
|
35406
35376
|
...identity3,
|
|
35407
35377
|
kind: "project",
|
|
35408
35378
|
project: canonical2,
|
|
35409
35379
|
checkout,
|
|
35410
|
-
|
|
35411
|
-
branches: canonical2.vcs === "git" ? yield* listBranches(canonical2.path) : [],
|
|
35412
|
-
revisions: canonical2.vcs === "jj" ? yield* listRevisions(canonical2.path) : []
|
|
35380
|
+
...inventory2
|
|
35413
35381
|
};
|
|
35414
35382
|
break;
|
|
35415
35383
|
}
|
|
@@ -35424,13 +35392,16 @@ var dispatchHost = exports_Effect.fnUntraced(function* (request3, command) {
|
|
|
35424
35392
|
}
|
|
35425
35393
|
case "worktrees": {
|
|
35426
35394
|
const repo = yield* repository3(request3.repo);
|
|
35395
|
+
const inventory2 = yield* exports_Effect.all({
|
|
35396
|
+
worktrees: repo.vcs === "git" ? listWorktrees(repo.path) : listWorkspaces(repo.path),
|
|
35397
|
+
branches: repo.vcs === "git" ? listBranches(repo.path) : exports_Effect.succeed([]),
|
|
35398
|
+
revisions: repo.vcs === "jj" ? listRevisions(repo.path) : exports_Effect.succeed([])
|
|
35399
|
+
}, { concurrency: 4 });
|
|
35427
35400
|
result4 = {
|
|
35428
35401
|
...identity3,
|
|
35429
35402
|
kind: "worktrees",
|
|
35430
35403
|
repository: repo,
|
|
35431
|
-
|
|
35432
|
-
branches: repo.vcs === "git" ? yield* listBranches(repo.path) : [],
|
|
35433
|
-
revisions: repo.vcs === "jj" ? yield* listRevisions(repo.path) : []
|
|
35404
|
+
...inventory2
|
|
35434
35405
|
};
|
|
35435
35406
|
break;
|
|
35436
35407
|
}
|
|
@@ -35455,7 +35426,7 @@ var dispatchHost = exports_Effect.fnUntraced(function* (request3, command) {
|
|
|
35455
35426
|
break;
|
|
35456
35427
|
}
|
|
35457
35428
|
return result4;
|
|
35458
|
-
});
|
|
35429
|
+
}, withLocalIdentity, withToolValidation);
|
|
35459
35430
|
var hostRequest = exports_Effect.fnUntraced(function* (raw, command) {
|
|
35460
35431
|
const request3 = yield* exports_Schema.decodeUnknownEffect(exports_Schema.fromJsonString(RequestSchema))(raw);
|
|
35461
35432
|
return yield* dispatchHost(request3, command);
|
|
@@ -35508,19 +35479,26 @@ var request3 = exports_Effect.fnUntraced(function* (host, command, body) {
|
|
|
35508
35479
|
}
|
|
35509
35480
|
return yield* connectedRequest(host, command, body);
|
|
35510
35481
|
});
|
|
35511
|
-
var
|
|
35512
|
-
|
|
35513
|
-
|
|
35514
|
-
|
|
35515
|
-
|
|
35516
|
-
return discovery(result4);
|
|
35482
|
+
var inspectSessions = exports_Effect.fnUntraced(function* (host, command) {
|
|
35483
|
+
const result4 = yield* request3(host, command, { kind: "sessions" });
|
|
35484
|
+
if (result4.kind !== "sessions")
|
|
35485
|
+
return yield* fail20("Unexpected sessions response");
|
|
35486
|
+
return { sessions: result4.sessions, clients: result4.clients };
|
|
35517
35487
|
});
|
|
35518
35488
|
var connectAndDiscover = exports_Effect.fnUntraced(function* (machine, command, context3) {
|
|
35519
35489
|
const host = yield* connectMachine(machine);
|
|
35520
35490
|
const result4 = yield* connectedRequest(host, command, { kind: "discover", ...host.local && context3 ? { context: context3 } : {} });
|
|
35521
35491
|
if (result4.kind !== "discover")
|
|
35522
35492
|
return yield* fail20("Unexpected discovery response");
|
|
35523
|
-
return {
|
|
35493
|
+
return {
|
|
35494
|
+
host,
|
|
35495
|
+
sessions: result4.sessions,
|
|
35496
|
+
clients: result4.clients,
|
|
35497
|
+
projects: result4.projects,
|
|
35498
|
+
roots: result4.roots ?? [],
|
|
35499
|
+
cloneRoot: result4.cloneRoot,
|
|
35500
|
+
...result4.checkout ? { checkout: result4.checkout } : {}
|
|
35501
|
+
};
|
|
35524
35502
|
});
|
|
35525
35503
|
var inspectProject = exports_Effect.fnUntraced(function* (host, command, path) {
|
|
35526
35504
|
const result4 = yield* request3(host, command, { kind: "project", path });
|
|
@@ -38539,69 +38517,61 @@ var safeDisplayText = (text, preserveWhitespace = false) => {
|
|
|
38539
38517
|
};
|
|
38540
38518
|
var fit = (text, width2) => Bun.stringWidth(text) > width2 ? Bun.sliceAnsi(text, 0, Math.max(0, width2), { ellipsis: "\u2026" }) : text;
|
|
38541
38519
|
var pad = (text, width2) => text + " ".repeat(Math.max(0, width2 - Bun.stringWidth(text)));
|
|
38542
|
-
var renderFormFrame = (view, focused,
|
|
38543
|
-
const width2 = Math.max(
|
|
38520
|
+
var renderFormFrame = (view, focused, columns, rows2, colors2 = !process.env.NO_COLOR, options = {}) => {
|
|
38521
|
+
const width2 = Math.max(2, columns);
|
|
38544
38522
|
const inside = width2 - 2;
|
|
38545
38523
|
const screen = [];
|
|
38546
|
-
const border = (
|
|
38547
|
-
const line = (left, right
|
|
38548
|
-
|
|
38524
|
+
const border = (body) => `${color("\u2502", "muted", colors2)}${pad(fit(body, inside), inside)}${color("\u2502", "muted", colors2)}`;
|
|
38525
|
+
const line = (left, right, title = "") => {
|
|
38526
|
+
const text = fit(safeDisplayText(title), inside);
|
|
38527
|
+
return color(`${left}${text}${"\u2500".repeat(Math.max(0, inside - Bun.stringWidth(text)))}${right}`, "muted", colors2);
|
|
38528
|
+
};
|
|
38529
|
+
const add4 = (text) => screen.push(border(text));
|
|
38549
38530
|
screen.push(line("\u250C", "\u2510"));
|
|
38550
|
-
|
|
38551
|
-
add4(heading);
|
|
38531
|
+
add4(`${color("REX", "cyan", colors2)} ${color("/ WORKTREES", "bold", colors2)}`);
|
|
38552
38532
|
screen.push(line("\u251C", "\u2524"));
|
|
38553
|
-
const
|
|
38554
|
-
const
|
|
38555
|
-
const
|
|
38556
|
-
const
|
|
38557
|
-
|
|
38558
|
-
|
|
38559
|
-
|
|
38560
|
-
|
|
38561
|
-
|
|
38533
|
+
const fieldCount = Math.max(1, Math.min(5, rows2 - 11));
|
|
38534
|
+
const detailCount = Math.max(3, rows2 - fieldCount - 8);
|
|
38535
|
+
const focusIndex = view.rows.findIndex((row) => row.id === focused);
|
|
38536
|
+
const start = Math.max(0, Math.min(focusIndex - fieldCount + 1, view.rows.length - fieldCount));
|
|
38537
|
+
for (let index2 = 0;index2 < fieldCount; index2++) {
|
|
38538
|
+
const row = view.rows[start + index2];
|
|
38539
|
+
if (!row) {
|
|
38540
|
+
add4("");
|
|
38541
|
+
continue;
|
|
38562
38542
|
}
|
|
38563
|
-
};
|
|
38564
|
-
for (const row of view.rows) {
|
|
38565
38543
|
const active = focused === row.id;
|
|
38566
|
-
const
|
|
38567
|
-
const
|
|
38568
|
-
|
|
38569
|
-
|
|
38570
|
-
|
|
38571
|
-
|
|
38572
|
-
|
|
38573
|
-
|
|
38574
|
-
|
|
38575
|
-
|
|
38576
|
-
|
|
38577
|
-
|
|
38578
|
-
|
|
38579
|
-
if (
|
|
38580
|
-
|
|
38581
|
-
|
|
38582
|
-
|
|
38583
|
-
|
|
38584
|
-
|
|
38585
|
-
|
|
38586
|
-
|
|
38587
|
-
|
|
38588
|
-
screen.push(line("\u251C", "\u2524"));
|
|
38589
|
-
const submit2 = focused === "submit" ? color("\u203A", "cyan", colors2) : " ";
|
|
38590
|
-
const cancel = focused === "cancel" ? color("\u203A", "cyan", colors2) : " ";
|
|
38591
|
-
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)}`);
|
|
38592
|
-
add4(color(" \u2191\u2193 / jk move \xB7 Tab next \xB7 Enter select \xB7 Ctrl+S submit \xB7 Esc close", "muted", colors2));
|
|
38544
|
+
const tone = row.disabled ? "muted" : active ? "cyan" : "bold";
|
|
38545
|
+
const indicator = index2 === 0 && start > 0 ? "\u2191" : index2 === fieldCount - 1 && start + fieldCount < view.rows.length ? "\u2193" : active ? "\u203A" : " ";
|
|
38546
|
+
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)}`);
|
|
38547
|
+
}
|
|
38548
|
+
add4("");
|
|
38549
|
+
const current = view.rows.find((row) => row.id === focused);
|
|
38550
|
+
screen.push(line("\u251C", "\u2524", ` ${options.editor?.title ?? current?.label ?? "Details"} `));
|
|
38551
|
+
const subtitle = current?.detail ?? view.rows.find((row) => row.id === "destination")?.detail ?? "";
|
|
38552
|
+
const wrapped = [view.error, view.notice, subtitle].filter(Boolean).flatMap((message) => Bun.wrapAnsi(safeDisplayText(message), Math.max(1, inside - 10), { hard: true }).split(`
|
|
38553
|
+
`));
|
|
38554
|
+
const visible = options.editor ? 1 : detailCount;
|
|
38555
|
+
const offset = Math.max(0, Math.min(options.detailOffset ?? 0, wrapped.length - visible));
|
|
38556
|
+
const detailLine = (index2) => `${index2 === 0 && offset > 0 ? "\u2191 " : ""}${wrapped[offset + index2] ?? ""}${index2 === visible - 1 && offset + visible < wrapped.length ? " \u2193 PgDn" : ""}`;
|
|
38557
|
+
if (options.editor) {
|
|
38558
|
+
const errorRows = view.error ? 1 : 0;
|
|
38559
|
+
for (let index2 = 0;index2 < detailCount - errorRows; index2++)
|
|
38560
|
+
add4(options.editor.lines[index2] ?? "");
|
|
38561
|
+
if (errorRows)
|
|
38562
|
+
add4(color(detailLine(0), "red", colors2));
|
|
38563
|
+
} else {
|
|
38564
|
+
for (let index2 = 0;index2 < detailCount; index2++)
|
|
38565
|
+
add4(color(detailLine(index2), view.error ? "red" : view.notice ? "amber" : "muted", colors2));
|
|
38593
38566
|
}
|
|
38567
|
+
screen.push(line("\u251C", "\u2524"));
|
|
38568
|
+
const hint = (key5, label) => `${color(key5, "bold", colors2)} ${color(label, "muted", colors2)}`;
|
|
38569
|
+
const button = (label, active, primary = false, disabled = false) => color(`${active ? "\u203A" : " "}[ ${safeDisplayText(label)} ]`, disabled ? "muted" : active ? "cyan" : primary ? "bold" : "muted", colors2);
|
|
38570
|
+
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")}`);
|
|
38594
38571
|
screen.push(line("\u2514", "\u2518"));
|
|
38595
|
-
return screen.join(`\r
|
|
38596
|
-
`)
|
|
38597
|
-
` : "");
|
|
38598
|
-
};
|
|
38599
|
-
var naturalFormRows = (view, columns, editing = false) => {
|
|
38600
|
-
const fields = [...view.rows.map((row) => row.id), "submit"];
|
|
38601
|
-
return Math.max(...fields.map((field) => renderFormFrame(view, field, editing, columns, 1000, false, false).split(`\r
|
|
38602
|
-
`).length - (editing ? 1 : 0))) + (editing ? 6 : 0);
|
|
38572
|
+
return screen.slice(0, Math.max(1, rows2)).join(`\r
|
|
38573
|
+
`);
|
|
38603
38574
|
};
|
|
38604
|
-
var popupTargetRows = (view, columns, editing = false) => Math.max(16 + (editing ? 6 : 0), naturalFormRows(view, Math.min(96, columns), editing));
|
|
38605
38575
|
var matchingChoices = (choices, text) => {
|
|
38606
38576
|
const query = text.toLocaleLowerCase();
|
|
38607
38577
|
const matches = [];
|
|
@@ -38642,51 +38612,29 @@ var advanceInputChoice = (state, event, choices, selectionOnly = false) => {
|
|
|
38642
38612
|
return { _tag: "Beep" };
|
|
38643
38613
|
return { _tag: "NextFrame", state: { text: state.text + text, selected: selectionOnly ? state.selected : null } };
|
|
38644
38614
|
};
|
|
38645
|
-
var renderInputChoice = (
|
|
38615
|
+
var renderInputChoice = (state, choices, columns, rows2, colors2 = !process.env.NO_COLOR, selectionOnly = false, count2 = Math.max(2, rows2 - 14)) => {
|
|
38646
38616
|
const width2 = Math.max(20, columns) - 2;
|
|
38647
38617
|
const matches = matchingChoices(choices, state.text);
|
|
38648
|
-
const count2 = rows2 >= 20 ? 3 : 1;
|
|
38649
38618
|
const selected = matches.indexOf(state.selected ?? -1);
|
|
38650
38619
|
const start = selected < 0 ? 0 : Math.max(0, Math.min(selected, matches.length - count2));
|
|
38651
|
-
const lines2 = [
|
|
38652
|
-
` ${fit(safeDisplayText(message), width2 - 2)}`,
|
|
38653
|
-
` ${color("\u203A", "cyan", colors2)} ${fit(safeDisplayText(state.text, true) || (selectionOnly ? "Filter exact choices\u2026" : "Type new value\u2026"), width2 - 4)}`
|
|
38654
|
-
];
|
|
38620
|
+
const lines2 = [`${color("\u203A", "cyan", colors2)} ${fit(safeDisplayText(state.text, true) || (selectionOnly ? "Filter exact choices\u2026" : "Type new value\u2026"), width2 - 2)}`];
|
|
38655
38621
|
for (const index2 of matches.slice(start, start + count2)) {
|
|
38656
38622
|
const choice = choices[index2];
|
|
38657
38623
|
if (!choice)
|
|
38658
38624
|
continue;
|
|
38659
38625
|
const label = `${state.selected === index2 ? "\u203A" : " "} ${safeDisplayText(choice.title)}${choice.description ? ` \xB7 ${safeDisplayText(choice.description)}` : ""}`;
|
|
38660
|
-
lines2.push(
|
|
38626
|
+
lines2.push(fit(label, width2));
|
|
38661
38627
|
}
|
|
38662
|
-
|
|
38663
|
-
lines2.push("");
|
|
38664
|
-
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)}`);
|
|
38665
|
-
return lines2.join(`\r
|
|
38666
|
-
`);
|
|
38628
|
+
return lines2;
|
|
38667
38629
|
};
|
|
38668
|
-
var acknowledge = (title, lines2, tone) => exports_Prompt.run(exports_Prompt.Custom(
|
|
38669
|
-
render: (
|
|
38630
|
+
var acknowledge = (title, lines2, tone, view = { rows: [], submitLabel: "Close" }) => exports_Prompt.run(exports_Prompt.Custom(0, {
|
|
38631
|
+
render: (detailOffset, action) => action._tag === "Submit" ? exports_Effect.succeed("") : exports_Effect.gen(function* () {
|
|
38670
38632
|
const terminal = yield* exports_Terminal.Terminal;
|
|
38671
|
-
const
|
|
38672
|
-
|
|
38673
|
-
const active = !process.env.NO_COLOR;
|
|
38674
|
-
const output = [color(` REX / ${safeDisplayText(title)}`, tone === "error" ? "red" : tone === "warning" ? "amber" : "cyan", active), ""];
|
|
38675
|
-
for (const line of lines2) {
|
|
38676
|
-
for (const part of Bun.wrapAnsi(safeDisplayText(line), width2 - 4, { hard: true }).split(`
|
|
38677
|
-
`)) {
|
|
38678
|
-
if (output.length >= height - 3)
|
|
38679
|
-
break;
|
|
38680
|
-
output.push(` ${part}`);
|
|
38681
|
-
}
|
|
38682
|
-
}
|
|
38683
|
-
output.push("", color(" Enter / Space confirm \xB7 Esc / Ctrl+C close", "muted", active));
|
|
38684
|
-
return `\x1B[H\x1B[2J${output.join(`\r
|
|
38685
|
-
`)}\r
|
|
38686
|
-
`;
|
|
38633
|
+
const notice = `${title} \xB7 ${lines2.join(" \xB7 ")}`;
|
|
38634
|
+
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" })}`;
|
|
38687
38635
|
}),
|
|
38688
38636
|
clear: () => exports_Effect.succeed(""),
|
|
38689
|
-
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" })
|
|
38637
|
+
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" })
|
|
38690
38638
|
})).pipe(exports_Effect.catch(() => exports_Effect.void));
|
|
38691
38639
|
var problem = (error2) => error2 instanceof AppError ? error2.message : exports_Cause.pretty(exports_Cause.fail(error2));
|
|
38692
38640
|
var selected = (value3, current, title, description) => ({ value: value3, selected: current, title, description });
|
|
@@ -38751,15 +38699,16 @@ var selectRevision = (draft, choice) => changeDestination(draft, { revision: cho
|
|
|
38751
38699
|
var cloneInputFor = (draft) => {
|
|
38752
38700
|
if (!draft.host || !draft.clone || !draft.session || !draft.clone.repo.startsWith("/"))
|
|
38753
38701
|
return;
|
|
38754
|
-
if (draft.clone.vcs === "jj")
|
|
38702
|
+
if (draft.clone.vcs === "jj") {
|
|
38703
|
+
const revision = draft.clone.revision?.commitId === draft.destination?.revision ? draft.clone.revision : draft.clone.revisions.find((choice) => choice.revision.commitId === draft.destination?.revision)?.revision;
|
|
38755
38704
|
return {
|
|
38756
38705
|
vcs: "jj",
|
|
38757
38706
|
source: {
|
|
38758
38707
|
vcs: "jj",
|
|
38759
38708
|
url: draft.clone.url,
|
|
38760
38709
|
sourceHostId: draft.clone.sourceHostId,
|
|
38761
|
-
revisions:
|
|
38762
|
-
...
|
|
38710
|
+
revisions: [],
|
|
38711
|
+
...revision ? { revision } : {}
|
|
38763
38712
|
},
|
|
38764
38713
|
repo: draft.clone.repo,
|
|
38765
38714
|
session: draft.session,
|
|
@@ -38768,6 +38717,7 @@ var cloneInputFor = (draft) => {
|
|
|
38768
38717
|
...draft.worktreeName ? { worktreeName: draft.worktreeName } : {},
|
|
38769
38718
|
...draft.destination?.revision ? { revision: draft.destination.revision } : {}
|
|
38770
38719
|
};
|
|
38720
|
+
}
|
|
38771
38721
|
if (!draft.destination?.branch)
|
|
38772
38722
|
return;
|
|
38773
38723
|
return {
|
|
@@ -38798,49 +38748,36 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38798
38748
|
let sessions = [];
|
|
38799
38749
|
let focused = "project";
|
|
38800
38750
|
let error2;
|
|
38801
|
-
let
|
|
38802
|
-
let clonePlan;
|
|
38751
|
+
let blocked = false;
|
|
38803
38752
|
let cloneRoot = "";
|
|
38804
38753
|
let cloneRoots = [];
|
|
38805
38754
|
let contextPath;
|
|
38806
|
-
const resizePopup = yield* makePopupSizer;
|
|
38807
38755
|
let activeView;
|
|
38808
|
-
|
|
38809
|
-
|
|
38810
|
-
|
|
38811
|
-
|
|
38812
|
-
|
|
38813
|
-
|
|
38814
|
-
return;
|
|
38815
|
-
const changed = view.fitWarning !== warning;
|
|
38816
|
-
view.fitWarning = warning;
|
|
38817
|
-
if (changed && repaint)
|
|
38818
|
-
yield* exports_Queue.offer(repaint, { columns, rows: rows2 });
|
|
38819
|
-
})).pipe(exports_Effect.forkScoped);
|
|
38756
|
+
const resizeEvents = exports_Effect.gen(function* () {
|
|
38757
|
+
const source = yield* terminal.size;
|
|
38758
|
+
const events = yield* exports_Queue.sliding(1);
|
|
38759
|
+
yield* exports_Effect.forever(exports_Queue.take(source).pipe(exports_Effect.flatMap((value3) => exports_Queue.offer(events, value3)))).pipe(exports_Effect.forkScoped);
|
|
38760
|
+
return events;
|
|
38761
|
+
});
|
|
38820
38762
|
const chooseField = exports_Effect.fnUntraced(function* (view, initialFocus) {
|
|
38821
|
-
|
|
38822
|
-
const size8 = yield* terminal2.size;
|
|
38823
|
-
const resized = yield* exports_Queue.sliding(1);
|
|
38824
|
-
yield* exports_Effect.acquireRelease(exports_Effect.sync(() => {
|
|
38825
|
-
repaint = resized;
|
|
38826
|
-
}), () => exports_Effect.sync(() => {
|
|
38827
|
-
repaint = undefined;
|
|
38828
|
-
}));
|
|
38829
|
-
yield* exports_Effect.forever(exports_Queue.take(size8).pipe(exports_Effect.flatMap((value3) => exports_Queue.offer(resized, value3)))).pipe(exports_Effect.forkScoped);
|
|
38763
|
+
let detailOffset = 0;
|
|
38830
38764
|
const fields = [...view.rows.map((row) => row.id), "submit", "cancel"];
|
|
38831
38765
|
const initial = Math.max(0, fields.indexOf(initialFocus));
|
|
38832
|
-
const prompt = exports_Prompt.Custom(initial,
|
|
38766
|
+
const prompt = exports_Prompt.Custom(initial, yield* resizeEvents, {
|
|
38833
38767
|
render: (index2, action) => action._tag === "Submit" ? exports_Effect.succeed("") : exports_Effect.gen(function* () {
|
|
38834
|
-
const columns = yield*
|
|
38835
|
-
const rows2 = yield*
|
|
38836
|
-
|
|
38837
|
-
return `\x1B[H\x1B[2J${renderFormFrame(view, fields[index2], false, columns, rows2)}`;
|
|
38768
|
+
const columns = yield* terminal.columns;
|
|
38769
|
+
const rows2 = yield* terminal.rows;
|
|
38770
|
+
return `\x1B[H\x1B[2J${renderFormFrame(view, fields[index2], columns, rows2, !process.env.NO_COLOR, { detailOffset })}`;
|
|
38838
38771
|
}),
|
|
38839
38772
|
clear: () => exports_Effect.succeed(""),
|
|
38840
38773
|
process: (event, index2) => {
|
|
38841
38774
|
if (event._tag === "Event")
|
|
38842
38775
|
return exports_Effect.succeed({ _tag: "NextFrame", state: index2 });
|
|
38843
38776
|
const { key: key5 } = event.input;
|
|
38777
|
+
if (key5.name === "pageup" || key5.name === "pagedown") {
|
|
38778
|
+
detailOffset = Math.max(0, detailOffset + (key5.name === "pageup" ? -1 : 1));
|
|
38779
|
+
return exports_Effect.succeed({ _tag: "NextFrame", state: index2 });
|
|
38780
|
+
}
|
|
38844
38781
|
if (key5.name === "escape" || key5.ctrl && key5.name === "c")
|
|
38845
38782
|
return exports_Effect.succeed({ _tag: "Submit", value: "cancel" });
|
|
38846
38783
|
if (key5.ctrl && key5.name === "s")
|
|
@@ -38857,29 +38794,25 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38857
38794
|
return yield* exports_Prompt.run(prompt);
|
|
38858
38795
|
}, exports_Effect.scoped);
|
|
38859
38796
|
const inputChoice = exports_Effect.fnUntraced(function* (options) {
|
|
38860
|
-
|
|
38861
|
-
const
|
|
38862
|
-
const resized = yield* exports_Queue.sliding(1);
|
|
38863
|
-
yield* exports_Effect.forever(exports_Queue.take(size8).pipe(exports_Effect.flatMap((value3) => exports_Queue.offer(resized, value3)))).pipe(exports_Effect.forkScoped);
|
|
38864
|
-
yield* exports_Effect.acquireRelease(exports_Effect.sync(() => {
|
|
38865
|
-
repaint = resized;
|
|
38866
|
-
}), () => exports_Effect.sync(() => {
|
|
38867
|
-
repaint = undefined;
|
|
38868
|
-
}));
|
|
38869
|
-
const result4 = yield* exports_Prompt.run(exports_Prompt.Custom({ text: "", selected: options.selected === undefined || options.selected < 0 ? null : options.selected }, resized, {
|
|
38797
|
+
let detailOffset = 0;
|
|
38798
|
+
const result4 = yield* exports_Prompt.run(exports_Prompt.Custom({ text: "", selected: options.selected === undefined || options.selected < 0 ? null : options.selected }, yield* resizeEvents, {
|
|
38870
38799
|
render: (state, action) => action._tag === "Submit" ? exports_Effect.succeed("") : exports_Effect.gen(function* () {
|
|
38871
|
-
const columns = yield*
|
|
38872
|
-
const rows2 = yield*
|
|
38800
|
+
const columns = yield* terminal.columns;
|
|
38801
|
+
const rows2 = yield* terminal.rows;
|
|
38873
38802
|
const view = activeView;
|
|
38874
|
-
|
|
38875
|
-
yield* exports_Queue.offer(fitRequests, { view, columns, rows: rows2, editing: true });
|
|
38876
|
-
const editor = renderInputChoice(options.message, state, options.choices, columns, rows2, !process.env.NO_COLOR, options.selectionOnly);
|
|
38803
|
+
const editor = renderInputChoice(state, options.choices, columns, rows2, !process.env.NO_COLOR, options.selectionOnly, Math.max(2, rows2 - 14) - (view?.error ? 1 : 0));
|
|
38877
38804
|
if (!view)
|
|
38878
38805
|
return "";
|
|
38879
|
-
return `\x1B[H\x1B[2J${renderFormFrame(view, focused,
|
|
38806
|
+
return `\x1B[H\x1B[2J${renderFormFrame(view, focused, columns, rows2, !process.env.NO_COLOR, { editor: { title: options.message, lines: editor }, detailOffset })}`;
|
|
38880
38807
|
}),
|
|
38881
38808
|
clear: () => exports_Effect.succeed(""),
|
|
38882
|
-
process: (event, state) =>
|
|
38809
|
+
process: (event, state) => {
|
|
38810
|
+
if (event._tag !== "Event" && (event.input.key.name === "pageup" || event.input.key.name === "pagedown")) {
|
|
38811
|
+
detailOffset = Math.max(0, detailOffset + (event.input.key.name === "pageup" ? -1 : 1));
|
|
38812
|
+
return exports_Effect.succeed({ _tag: "NextFrame", state });
|
|
38813
|
+
}
|
|
38814
|
+
return exports_Effect.succeed(event._tag === "Event" ? { _tag: "NextFrame", state } : advanceInputChoice(state, event.input, options.choices, options.selectionOnly));
|
|
38815
|
+
}
|
|
38883
38816
|
}));
|
|
38884
38817
|
return result4 === null ? yield* exports_Effect.fail(new exports_Terminal.QuitError({})) : result4;
|
|
38885
38818
|
}, exports_Effect.scoped);
|
|
@@ -38982,13 +38915,21 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38982
38915
|
return yield* exports_Effect.fail(new AppError({ message: "Project directory changed; select the exact project directory again" }));
|
|
38983
38916
|
return inspected.success;
|
|
38984
38917
|
});
|
|
38918
|
+
const useProject = (found) => {
|
|
38919
|
+
draft = changeProject(draft, found.project);
|
|
38920
|
+
if (found.checkout.vcs === "jj" && !draft.sourcePath)
|
|
38921
|
+
draft = { ...draft, sourcePath: found.checkout.path };
|
|
38922
|
+
if (!draft.destination) {
|
|
38923
|
+
const tree = found.worktrees.find((item) => item.path === found.checkout.path && (item.vcs === "jj" ? item.present : !item.bare && !item.prunable));
|
|
38924
|
+
if (tree)
|
|
38925
|
+
draft = selectWorktree(draft, tree);
|
|
38926
|
+
}
|
|
38927
|
+
};
|
|
38985
38928
|
const activate2 = exports_Effect.fnUntraced(function* (machine, showLoading = false) {
|
|
38986
38929
|
const previous = draft;
|
|
38987
38930
|
const previousHostId = draft.host?.hostId;
|
|
38988
38931
|
draft = { machine, projectChoice: draft.projectChoice, mode: draft.mode };
|
|
38989
38932
|
sessions = [];
|
|
38990
|
-
plan = undefined;
|
|
38991
|
-
clonePlan = undefined;
|
|
38992
38933
|
cloneRoot = "";
|
|
38993
38934
|
cloneRoots = [];
|
|
38994
38935
|
error2 = undefined;
|
|
@@ -38997,7 +38938,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38997
38938
|
if (showLoading) {
|
|
38998
38939
|
const pending = { ...formView(true), notice: `Connecting to ${machine.label}\u2026` };
|
|
38999
38940
|
activeView = pending;
|
|
39000
|
-
yield* terminal.display(`\x1B[H\x1B[2J${renderFormFrame(pending, "machine",
|
|
38941
|
+
yield* terminal.display(`\x1B[H\x1B[2J${renderFormFrame(pending, "machine", yield* terminal.columns, yield* terminal.rows)}`);
|
|
39001
38942
|
}
|
|
39002
38943
|
const connected = yield* exports_Effect.result(connectAndDiscover(machine, command, discoveredContext));
|
|
39003
38944
|
if (exports_Result.isFailure(connected)) {
|
|
@@ -39027,15 +38968,8 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39027
38968
|
error2 = problem(inspected.failure);
|
|
39028
38969
|
return;
|
|
39029
38970
|
}
|
|
39030
|
-
|
|
39031
|
-
|
|
39032
|
-
draft = changeProject(draft, inspected.success.project);
|
|
39033
|
-
if (inspected.success.checkout.vcs === "jj")
|
|
39034
|
-
draft = { ...draft, sourcePath: inspected.success.checkout.path };
|
|
39035
|
-
const tree = inspected.success.worktrees.find((item) => item.path === found.checkout?.path && (item.vcs === "jj" ? item.present : !item.bare && !item.prunable));
|
|
39036
|
-
if (tree)
|
|
39037
|
-
draft = selectWorktree(draft, tree);
|
|
39038
|
-
}
|
|
38971
|
+
draft = changeProjectChoice(draft, known(host, inspected.success.project, inspected.success.checkout));
|
|
38972
|
+
useProject(inspected.success);
|
|
39039
38973
|
} else if (draft.projectChoice) {
|
|
39040
38974
|
const inspected = yield* exports_Effect.result(bindProject(draft.projectChoice, host, found.projects));
|
|
39041
38975
|
if (exports_Result.isFailure(inspected)) {
|
|
@@ -39043,17 +38977,8 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39043
38977
|
error2 = problem(inspected.failure);
|
|
39044
38978
|
return;
|
|
39045
38979
|
}
|
|
39046
|
-
if (inspected.success)
|
|
39047
|
-
|
|
39048
|
-
if (inspected.success.checkout.vcs === "jj" && !draft.sourcePath)
|
|
39049
|
-
draft = { ...draft, sourcePath: inspected.success.checkout.path };
|
|
39050
|
-
if (!draft.destination) {
|
|
39051
|
-
const checkoutPath = inspected.success.checkout.path;
|
|
39052
|
-
const tree = inspected.success.worktrees.find((item) => item.path === checkoutPath && (item.vcs === "jj" ? item.present : !item.bare && !item.prunable));
|
|
39053
|
-
if (tree)
|
|
39054
|
-
draft = selectWorktree(draft, tree);
|
|
39055
|
-
}
|
|
39056
|
-
}
|
|
38980
|
+
if (inspected.success)
|
|
38981
|
+
useProject(inspected.success);
|
|
39057
38982
|
}
|
|
39058
38983
|
error2 = undefined;
|
|
39059
38984
|
});
|
|
@@ -39104,27 +39029,17 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39104
39029
|
value: draft.mode === "auto" ? "Reuse matching tab, otherwise new tab" : draft.mode === "new-tab" ? "Always new tab" : "Split matching tab, otherwise new tab",
|
|
39105
39030
|
disabled: !draft.host
|
|
39106
39031
|
});
|
|
39107
|
-
const awaitingConfirmation = !!(clonePlan || plan);
|
|
39108
39032
|
return {
|
|
39109
39033
|
rows: rows2.map((row) => ({ ...row, disabled: initializing || row.disabled })),
|
|
39110
|
-
submitLabel:
|
|
39111
|
-
submitDisabled: initializing || !draft.host || !(cloneInputFor(draft) || inputFor(draft)),
|
|
39112
|
-
notice:
|
|
39113
|
-
|
|
39114
|
-
clonePlan?.warning,
|
|
39115
|
-
plan?.warning,
|
|
39116
|
-
plan ? `Destination: ${plan.path}` : undefined,
|
|
39117
|
-
clonePlan && clonePlan.repo !== draft.clone?.repo ? `Changed destination: ${clonePlan.repo}` : undefined,
|
|
39118
|
-
clonePlan?.detail,
|
|
39119
|
-
clonePlan?.vcs === "jj" ? `Start from: ${draft.destination?.revision ? `${draft.destination.label} (${draft.destination.revision})` : "cloned default"}` : undefined,
|
|
39120
|
-
plan?.detail
|
|
39121
|
-
].filter(Boolean).join(" \xB7 ") || undefined,
|
|
39122
|
-
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),
|
|
39123
|
-
fitWarning: activeView?.fitWarning
|
|
39034
|
+
submitLabel: draft.clone ? "Clone & Open" : draft.destination?.path ? "Open checkout" : draft.project?.vcs === "jj" ? "Create workspace & open" : "Create checkout & open",
|
|
39035
|
+
submitDisabled: initializing || blocked || !draft.host || !(cloneInputFor(draft) || inputFor(draft)),
|
|
39036
|
+
notice: draft.clone ? "Only pushed history transfers" : undefined,
|
|
39037
|
+
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)
|
|
39124
39038
|
};
|
|
39125
39039
|
};
|
|
39126
|
-
const initialView = formView(true);
|
|
39040
|
+
const initialView = { ...formView(true), notice: "Discovering projects and Rex sessions\u2026" };
|
|
39127
39041
|
activeView = initialView;
|
|
39042
|
+
yield* terminal.display(`\x1B[H\x1B[2J${renderFormFrame(initialView, "project", yield* terminal.columns, yield* terminal.rows)}`);
|
|
39128
39043
|
const initialize = exports_Effect.gen(function* () {
|
|
39129
39044
|
contextPath = yield* context3;
|
|
39130
39045
|
yield* loadMachines;
|
|
@@ -39153,18 +39068,12 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39153
39068
|
const current2 = yield* exports_Effect.result(reviewClone(draft.host, command, cloneInput));
|
|
39154
39069
|
if (exports_Result.isFailure(current2)) {
|
|
39155
39070
|
error2 = problem(current2.failure);
|
|
39156
|
-
clonePlan = undefined;
|
|
39157
39071
|
continue;
|
|
39158
39072
|
}
|
|
39159
|
-
|
|
39160
|
-
|
|
39161
|
-
|
|
39162
|
-
|
|
39163
|
-
}
|
|
39164
|
-
const wasReviewed2 = !!clonePlan;
|
|
39165
|
-
clonePlan = current2.success;
|
|
39166
|
-
if (!wasReviewed2 && (clonePlan.warning || safeDisplayText(clonePlan.repo) !== clonePlan.repo || view.fitWarning || naturalFormRows(view, yield* terminal.columns) + 1 > (yield* terminal.rows))) {
|
|
39167
|
-
error2 = undefined;
|
|
39073
|
+
const clonePlan = current2.success;
|
|
39074
|
+
if (clonePlan.repo !== cloneInput.repo || clonePlan.hostId !== draft.host.hostId) {
|
|
39075
|
+
error2 = clonePlan.hostId !== draft.host.hostId ? "Rex target changed; select the machine again" : `Clone destination changed; edit the destination: ${clonePlan.repo}`;
|
|
39076
|
+
blocked = true;
|
|
39168
39077
|
continue;
|
|
39169
39078
|
}
|
|
39170
39079
|
const launched2 = yield* exports_Effect.result(submitClone(draft.host, command, cloneInput, clonePlan));
|
|
@@ -39174,7 +39083,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39174
39083
|
problem(launched2.failure),
|
|
39175
39084
|
`Destination: ${clonePlan.repo}`,
|
|
39176
39085
|
"A clone or Rex tab may already exist. Inspect the destination and session before opening again."
|
|
39177
|
-
], "error");
|
|
39086
|
+
], "error", view);
|
|
39178
39087
|
return yield* exports_Effect.fail(launched2.failure);
|
|
39179
39088
|
}
|
|
39180
39089
|
if (launched2.success.warning)
|
|
@@ -39183,7 +39092,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39183
39092
|
`Destination: ${launched2.success.repo}`,
|
|
39184
39093
|
"The clone task was created; Rex may not have focused its tab. Inspect the session before opening again.",
|
|
39185
39094
|
launched2.success.warning
|
|
39186
|
-
], "warning");
|
|
39095
|
+
], "warning", view);
|
|
39187
39096
|
return;
|
|
39188
39097
|
}
|
|
39189
39098
|
const input = inputFor(draft);
|
|
@@ -39192,19 +39101,12 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39192
39101
|
const current = yield* exports_Effect.result(review(draft.host, command, input));
|
|
39193
39102
|
if (exports_Result.isFailure(current)) {
|
|
39194
39103
|
error2 = problem(current.failure);
|
|
39195
|
-
plan = undefined;
|
|
39196
|
-
continue;
|
|
39197
|
-
}
|
|
39198
|
-
if (plan && (!sameLaunchPlan(current.success, plan) || current.success.warning !== plan.warning)) {
|
|
39199
|
-
error2 = `Destination or Rex target changed; review the updated action before submitting again. Destination: ${current.success.path}`;
|
|
39200
|
-
plan = current.success;
|
|
39201
39104
|
continue;
|
|
39202
39105
|
}
|
|
39203
|
-
const
|
|
39204
|
-
|
|
39205
|
-
|
|
39206
|
-
|
|
39207
|
-
error2 = changedPath ? `Destination or Rex target changed; review the updated action before submitting again. Destination: ${plan.path}` : undefined;
|
|
39106
|
+
const plan = current.success;
|
|
39107
|
+
if (plan.hostId !== draft.host.hostId || input.path && plan.path !== input.path) {
|
|
39108
|
+
error2 = plan.hostId !== draft.host.hostId ? "Rex target changed; select the machine again" : `Destination changed; select the checkout again: ${plan.path}`;
|
|
39109
|
+
blocked = true;
|
|
39208
39110
|
continue;
|
|
39209
39111
|
}
|
|
39210
39112
|
const launched = yield* exports_Effect.result(submit(draft.host, command, input, plan));
|
|
@@ -39214,7 +39116,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39214
39116
|
problem(launched.failure),
|
|
39215
39117
|
`Destination: ${plan.path}`,
|
|
39216
39118
|
"The checkout or Rex tab may already have changed. Inspect the session before opening again."
|
|
39217
|
-
], "error");
|
|
39119
|
+
], "error", view);
|
|
39218
39120
|
return yield* exports_Effect.fail(launched.failure);
|
|
39219
39121
|
}
|
|
39220
39122
|
if (launched.success.warning || plan.warning)
|
|
@@ -39224,7 +39126,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39224
39126
|
`Action: ${launched.success.action}`,
|
|
39225
39127
|
launched.success.pending ? `Task submitted; ${plan.vcs === "jj" ? "JJ" : "Git"} setup may still be running.` : "Existing task focused.",
|
|
39226
39128
|
...new Set([plan.warning, launched.success.warning].filter((line) => !!line))
|
|
39227
|
-
], "warning");
|
|
39129
|
+
], "warning", view);
|
|
39228
39130
|
return;
|
|
39229
39131
|
}
|
|
39230
39132
|
if (view.rows.find((row) => row.id === action)?.disabled)
|
|
@@ -39255,26 +39157,14 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39255
39157
|
return yield* exports_Effect.fail(new AppError({ message: "Project name is required" }));
|
|
39256
39158
|
const host = draft.host;
|
|
39257
39159
|
if (host) {
|
|
39258
|
-
const
|
|
39259
|
-
|
|
39260
|
-
const inspected = yield* bindProject(choice, host, found.projects);
|
|
39160
|
+
const available = projects.flatMap((item) => item.source?.machineKey === host.key && item.source.hostId === host.hostId ? [item.source.repository] : []);
|
|
39161
|
+
const inspected = yield* bindProject(choice, host, available);
|
|
39261
39162
|
if (inspected) {
|
|
39262
39163
|
draft = changeProjectChoice(draft, choice);
|
|
39263
|
-
|
|
39264
|
-
if (inspected.
|
|
39265
|
-
|
|
39266
|
-
const tree = inspected.worktrees.find((item) => item.path === inspected.checkout.path && (item.vcs === "jj" ? item.present : !item.bare && !item.prunable));
|
|
39267
|
-
if (tree)
|
|
39268
|
-
draft = selectWorktree(draft, tree);
|
|
39164
|
+
useProject(inspected);
|
|
39165
|
+
if (!available.some((repo) => repo.vcs === inspected.project.vcs && repo.commonDir === inspected.project.commonDir))
|
|
39166
|
+
projects.push(known(host, inspected.project, inspected.checkout));
|
|
39269
39167
|
}
|
|
39270
|
-
projects = [
|
|
39271
|
-
...projects.filter((item) => item.source?.machineKey !== host.key || item.source.hostId !== host.hostId),
|
|
39272
|
-
...found.projects.map((repo) => known(host, repo, found.checkout))
|
|
39273
|
-
];
|
|
39274
|
-
sessions = found.sessions;
|
|
39275
|
-
if (draft.session?.kind === "existing" && !sessions.some((item) => item.id === (draft.session?.kind === "existing" ? draft.session.id : undefined)))
|
|
39276
|
-
draft = { ...draft, session: sessions.length === 1 ? { kind: "existing", id: sessions[0].id } : undefined };
|
|
39277
|
-
draft = { ...draft, clientId: focusClient(found.clients) };
|
|
39278
39168
|
} else
|
|
39279
39169
|
draft = changeProjectChoice(draft, choice);
|
|
39280
39170
|
} else if (action === "destination") {
|
|
@@ -39329,8 +39219,6 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39329
39219
|
const existing = trees.find((tree) => tree.vcs === "git" && tree.branch === branch);
|
|
39330
39220
|
draft = existing ? selectWorktree(draft, existing) : changeDestination(draft, { branch, label: branch }, draft.worktreeName);
|
|
39331
39221
|
} else {
|
|
39332
|
-
if (picked.value.vcs === "jj" && (!picked.value.present || !picked.value.path))
|
|
39333
|
-
return yield* exports_Effect.fail(new AppError({ message: `Workspace ${picked.value.name} is unavailable; inspect its registered location before opening` }));
|
|
39334
39222
|
draft = selectWorktree(draft, picked.value);
|
|
39335
39223
|
}
|
|
39336
39224
|
} else {
|
|
@@ -39426,7 +39314,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39426
39314
|
} else if (action === "session") {
|
|
39427
39315
|
if (!draft.host)
|
|
39428
39316
|
return yield* exports_Effect.fail(new AppError({ message: "Select a machine before choosing a session" }));
|
|
39429
|
-
const found = yield*
|
|
39317
|
+
const found = yield* inspectSessions(draft.host, command);
|
|
39430
39318
|
sessions = found.sessions;
|
|
39431
39319
|
draft = { ...draft, clientId: focusClient(found.clients) };
|
|
39432
39320
|
const picked = yield* inputChoice({
|
|
@@ -39449,11 +39337,14 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39449
39337
|
if (!exports_Terminal.isQuitError(editing.failure))
|
|
39450
39338
|
error2 = problem(editing.failure);
|
|
39451
39339
|
} else {
|
|
39452
|
-
|
|
39453
|
-
clonePlan = undefined;
|
|
39340
|
+
blocked = false;
|
|
39454
39341
|
}
|
|
39455
39342
|
}
|
|
39456
|
-
}).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)))))
|
|
39343
|
+
}).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* () {
|
|
39344
|
+
const terminal = yield* exports_Terminal.Terminal;
|
|
39345
|
+
const input = yield* terminal.readInput;
|
|
39346
|
+
return { ...terminal, readInput: exports_Effect.succeed(input) };
|
|
39347
|
+
})));
|
|
39457
39348
|
}));
|
|
39458
39349
|
|
|
39459
39350
|
// src/main.ts
|
|
@@ -39643,14 +39534,14 @@ Run rex config reload to activate.`}`);
|
|
|
39643
39534
|
if (args2.length !== 1)
|
|
39644
39535
|
return yield* exports_Effect.fail(new AppError({ message: "task requires one JSON argument" }));
|
|
39645
39536
|
const request4 = yield* exports_Schema.decodeUnknownEffect(exports_Schema.fromJsonString(TaskRequestSchema))(args2[0]);
|
|
39646
|
-
yield* task(request4);
|
|
39537
|
+
yield* withLocalIdentity(withToolValidation(task(request4)));
|
|
39647
39538
|
return;
|
|
39648
39539
|
}
|
|
39649
39540
|
if (verb === "clone-task") {
|
|
39650
39541
|
if (args2.length !== 1)
|
|
39651
39542
|
return yield* exports_Effect.fail(new AppError({ message: "clone-task requires one JSON argument" }));
|
|
39652
39543
|
const request4 = yield* exports_Schema.decodeUnknownEffect(exports_Schema.fromJsonString(CloneTaskRequestSchema))(args2[0]);
|
|
39653
|
-
yield* cloneTask(request4);
|
|
39544
|
+
yield* withLocalIdentity(withToolValidation(cloneTask(request4)));
|
|
39654
39545
|
return;
|
|
39655
39546
|
}
|
|
39656
39547
|
if (verb === "host-request") {
|