rex-worktrees 0.4.0 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -107
- package/dist/rex-worktrees +1 -1
- package/dist/rex-worktrees.js +310 -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)] : []))];
|
|
@@ -34017,7 +34056,7 @@ var project = exports_Effect.fnUntraced(function* (input) {
|
|
|
34017
34056
|
return checkout;
|
|
34018
34057
|
if (primary.path === checkout.path)
|
|
34019
34058
|
return checkout;
|
|
34020
|
-
const main = primary.bare ? undefined : yield*
|
|
34059
|
+
const main = primary.bare ? undefined : yield* repository(primary.path).pipe(exports_Effect.catchIf((error2) => missing3(error2) || notRepository(error2), () => exports_Effect.succeed(undefined)));
|
|
34021
34060
|
return main?.commonDir === checkout.commonDir ? main : { ...checkout, name: path.basename(primary.path) };
|
|
34022
34061
|
});
|
|
34023
34062
|
var listBranches = exports_Effect.fnUntraced(function* (repoPath) {
|
|
@@ -34115,7 +34154,7 @@ var isolatedEnv = () => {
|
|
|
34115
34154
|
};
|
|
34116
34155
|
var jj = (repo, ...args2) => run4("jj", ["-R", repo, "--no-pager", "--color=never", ...args2], undefined, isolatedEnv());
|
|
34117
34156
|
var inventory = (repo, ...args2) => jj(repo, "--ignore-working-copy", "--at-op=@", ...args2);
|
|
34118
|
-
var
|
|
34157
|
+
var checkVersion = exports_Effect.fnUntraced(function* () {
|
|
34119
34158
|
for (const [program, minimum] of [["jj", [0, 46]], ["git", [2, 42]]]) {
|
|
34120
34159
|
const output = yield* run4(program, ["--version"], undefined, isolatedEnv()).pipe(exports_Effect.catchIf((error2) => missing4(error2), () => fail18(`${program} executable not found on this Rex host; install ${program} >= ${minimum.join(".")} and ensure it is on the popup/task PATH`)));
|
|
34121
34160
|
const match9 = /\b(\d+)\.(\d+)(?:\.\d+)?\b/.exec(output);
|
|
@@ -34124,6 +34163,9 @@ var version = exports_Effect.fnUntraced(function* () {
|
|
|
34124
34163
|
}
|
|
34125
34164
|
}
|
|
34126
34165
|
});
|
|
34166
|
+
var ToolValidation = exports_Context.Reference("rex-worktrees/JjToolValidation", { defaultValue: () => checkVersion() });
|
|
34167
|
+
var version = exports_Effect.flatten(ToolValidation);
|
|
34168
|
+
var withToolValidation = exports_Effect.provideServiceEffect(ToolValidation, exports_Effect.cached(checkVersion()));
|
|
34127
34169
|
var workspaceTemplate = 'json({"name" => name, "path" => root, "commitId" => self.target().commit_id(), "changeId" => self.target().change_id()}) ++ "\\n"';
|
|
34128
34170
|
var revisionTemplate = 'json({"commitId" => commit_id, "changeId" => change_id, "description" => description, "conflict" => self.conflict()}) ++ "\\n"';
|
|
34129
34171
|
var workspaceRow = exports_Schema.Struct({ name: JjWorkspaceNameSchema, path: exports_Schema.NullOr(exports_Schema.String), commitId: JjCommitIdSchema, changeId: JjChangeIdSchema });
|
|
@@ -34181,7 +34223,7 @@ var metadata = exports_Effect.fnUntraced(function* (dot) {
|
|
|
34181
34223
|
return target;
|
|
34182
34224
|
});
|
|
34183
34225
|
var repository2 = exports_Effect.fnUntraced(function* (input) {
|
|
34184
|
-
yield* version
|
|
34226
|
+
yield* version;
|
|
34185
34227
|
const path = yield* exports_Path.Path;
|
|
34186
34228
|
const { directory, dot } = yield* marker(input);
|
|
34187
34229
|
return { vcs: "jj", path: directory, commonDir: yield* metadata(dot), name: path.basename(directory) };
|
|
@@ -34231,9 +34273,15 @@ var resolveRevision = exports_Effect.fnUntraced(function* (repo, expression) {
|
|
|
34231
34273
|
});
|
|
34232
34274
|
var listRevisions = exports_Effect.fnUntraced(function* (repo) {
|
|
34233
34275
|
const current = yield* repository2(repo);
|
|
34234
|
-
const
|
|
34276
|
+
const candidates = ["@-", "bookmarks()", "remote_bookmarks()"];
|
|
34277
|
+
const mainlineQuery = inventory(current.path, "log", "-r", "trunk()", "--no-graph", "--limit", "2", "-T", revisionTemplate).pipe(exports_Effect.catchIf((error2) => exports_Schema.is(CommandError)(error2) && error2.program === "jj" && /^Error: (?:Failed to (?:parse|resolve) revset|Invalid revset|Revision |Revset |Cannot resolve |No such revision)/i.test(error2.stderr), () => exports_Effect.succeed("")));
|
|
34278
|
+
const [bookmarkText, mainline, ...candidateText] = yield* exports_Effect.all([
|
|
34279
|
+
inventory(current.path, "bookmark", "list", "-T", bookmarkTemplate),
|
|
34280
|
+
mainlineQuery,
|
|
34281
|
+
...candidates.map((expression) => inventory(current.path, "log", "-r", expression, "--no-graph", "--limit", "40", "-T", revisionTemplate))
|
|
34282
|
+
], { concurrency: 4 });
|
|
34283
|
+
const bookmarks = (yield* rows(bookmarkRow, bookmarkText)).filter((item) => item.present && !item.conflict && /^[0-9a-f]{40,64}$/.test(item.target));
|
|
34235
34284
|
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
34285
|
const mainlineRows = yield* rows(revisionRow, mainline);
|
|
34238
34286
|
if (mainlineRows.length === 1 && !mainlineRows[0].conflict && !/^0+$/.test(mainlineRows[0].commitId)) {
|
|
34239
34287
|
const item = mainlineRows[0];
|
|
@@ -34243,9 +34291,8 @@ var listRevisions = exports_Effect.fnUntraced(function* (repo) {
|
|
|
34243
34291
|
revision: { commitId: item.commitId, changeId: item.changeId, description: item.description }
|
|
34244
34292
|
});
|
|
34245
34293
|
}
|
|
34246
|
-
const
|
|
34247
|
-
|
|
34248
|
-
const raw = yield* inventory(current.path, "log", "-r", expression, "--no-graph", "--limit", "40", "-T", revisionTemplate);
|
|
34294
|
+
for (const [index2, expression] of candidates.entries()) {
|
|
34295
|
+
const raw = candidateText[index2];
|
|
34249
34296
|
for (const item of yield* rows(revisionRow, raw)) {
|
|
34250
34297
|
if (item.conflict || choices.some((choice) => choice.revision.commitId === item.commitId))
|
|
34251
34298
|
continue;
|
|
@@ -34317,7 +34364,7 @@ var newChange = exports_Effect.fnUntraced(function* (repo, base) {
|
|
|
34317
34364
|
return after;
|
|
34318
34365
|
});
|
|
34319
34366
|
var cloneRepository2 = exports_Effect.fnUntraced(function* (url, destination) {
|
|
34320
|
-
yield* version
|
|
34367
|
+
yield* version;
|
|
34321
34368
|
const safe = yield* exports_Effect.try({ try: () => safeOrigin(url, true), catch: () => new AppError({ message: "Unsafe JJ clone URL" }) });
|
|
34322
34369
|
const spawner = yield* exports_ChildProcessSpawner.ChildProcessSpawner;
|
|
34323
34370
|
const child = yield* spawner.spawn(exports_ChildProcess.make("jj", ["git", "clone", safe, destination], {
|
|
@@ -34363,25 +34410,13 @@ var discoverProjects = exports_Effect.fnUntraced(function* (roots, explicitProje
|
|
|
34363
34410
|
if (!(yield* fs.exists(root)))
|
|
34364
34411
|
continue;
|
|
34365
34412
|
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
|
-
}
|
|
34413
|
+
const markers = yield* fs.glob("{*,*/*}/{.git,.jj}", { root, dot: true });
|
|
34414
|
+
candidates.push(...markers.map((marker2) => path.join(root, path.dirname(marker2))));
|
|
34380
34415
|
}
|
|
34381
34416
|
const found = [];
|
|
34382
34417
|
const seen = new Set;
|
|
34383
|
-
|
|
34384
|
-
|
|
34418
|
+
const inspected = yield* exports_Effect.forEach(new Set(candidates), (candidate) => project3(candidate).pipe(exports_Effect.catchIf((error2) => missing5(error2) || notRepository(error2), () => exports_Effect.succeed(undefined))), { concurrency: 4 });
|
|
34419
|
+
for (const repo of inspected) {
|
|
34385
34420
|
if (repo && !seen.has(`${repo.vcs}\x00${repo.commonDir}`)) {
|
|
34386
34421
|
seen.add(`${repo.vcs}\x00${repo.commonDir}`);
|
|
34387
34422
|
found.push(repo);
|
|
@@ -34490,7 +34525,7 @@ var machinesRegistry = exports_Effect.gen(function* () {
|
|
|
34490
34525
|
const path = yield* exports_Path.Path;
|
|
34491
34526
|
return yield* parse3(RexRegistrySchema, yield* run4(yield* binary(path), ["hosts", "list", "--json"], undefined, nativeEnv()));
|
|
34492
34527
|
});
|
|
34493
|
-
var
|
|
34528
|
+
var readLocalIdentity = exports_Effect.gen(function* () {
|
|
34494
34529
|
const path = yield* exports_Path.Path;
|
|
34495
34530
|
const endpoint = process.env.REX_WORKTREES_LOCAL_ENDPOINT;
|
|
34496
34531
|
if (endpoint !== undefined && !endpoint.startsWith("unix:///")) {
|
|
@@ -34502,6 +34537,9 @@ var localIdentity = exports_Effect.gen(function* () {
|
|
|
34502
34537
|
}
|
|
34503
34538
|
return identity3;
|
|
34504
34539
|
});
|
|
34540
|
+
var LocalIdentity = exports_Context.Reference("rex-worktrees/LocalIdentity", { defaultValue: () => readLocalIdentity });
|
|
34541
|
+
var localIdentity = exports_Effect.flatten(LocalIdentity);
|
|
34542
|
+
var withLocalIdentity = exports_Effect.provideServiceEffect(LocalIdentity, exports_Effect.cached(readLocalIdentity));
|
|
34505
34543
|
var localEndpoint = exports_Effect.gen(function* () {
|
|
34506
34544
|
const explicit = process.env.REX_WORKTREES_LOCAL_ENDPOINT;
|
|
34507
34545
|
if (explicit !== undefined) {
|
|
@@ -34555,88 +34593,7 @@ var originDirectory = exports_Effect.fnUntraced(function* (sessionId, blockId) {
|
|
|
34555
34593
|
const processInfo = yield* parse3(RexProcessSchema, yield* rex(["block", "call", "-s", sessionId, "-b", blockId, "process"]));
|
|
34556
34594
|
const cwd = processInfo.foreground?.cwd;
|
|
34557
34595
|
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
|
-
});
|
|
34596
|
+
}, withLocalIdentity);
|
|
34640
34597
|
var commandWithPath = (command) => {
|
|
34641
34598
|
const env = [
|
|
34642
34599
|
...process.env.PATH ? [`PATH=${process.env.PATH}`] : [],
|
|
@@ -34694,7 +34651,7 @@ var openPopup = exports_Effect.fnUntraced(function* (command, sessionId, origin2
|
|
|
34694
34651
|
const clients = (yield* parse3(RexClientsSchema, yield* localRex(["client", "ls", "--json"]))).clients.filter((client) => client.info?.kind === "app" && client.connection_state === "connected");
|
|
34695
34652
|
const clientId = [sourceOwner, origin2.clientId].find((id2) => id2 && clients.some((client) => client.client_id === id2));
|
|
34696
34653
|
const popupCommand = clientId ? [...command, "--managed-popup", "--origin-client", clientId] : [...command, "--managed-popup"];
|
|
34697
|
-
const width2 = 0.68, height = 0.
|
|
34654
|
+
const width2 = 0.68, height = 0.24;
|
|
34698
34655
|
const args2 = {
|
|
34699
34656
|
session_id: sessionId,
|
|
34700
34657
|
window_id: windowId,
|
|
@@ -34766,7 +34723,7 @@ var resolveWorktreeRoot = exports_Effect.fnUntraced(function* (repoPath) {
|
|
|
34766
34723
|
const config = yield* loadConfig;
|
|
34767
34724
|
const target = yield* project3(repoPath);
|
|
34768
34725
|
for (const entry of config.projectRoots) {
|
|
34769
|
-
const candidate = yield*
|
|
34726
|
+
const candidate = yield* repository3(entry.path).pipe(exports_Effect.catchIf((error2) => missing3(error2) || notRepository(error2), () => exports_Effect.succeed(undefined)));
|
|
34770
34727
|
if (candidate?.vcs === target.vcs && candidate.commonDir === target.commonDir)
|
|
34771
34728
|
return entry.worktreeRoot;
|
|
34772
34729
|
}
|
|
@@ -35128,7 +35085,7 @@ var cloneDestination = exports_Effect.fnUntraced(function* (destination, url, vc
|
|
|
35128
35085
|
const repo = yield* repository3(current).pipe(exports_Effect.catchIf((error2) => missing3(error2) || exports_Schema.is(CommandError)(error2) && error2.args.includes("rev-parse"), () => fail19(`Clone destination already exists and is not a repository: ${current}`)));
|
|
35129
35086
|
if (repo.path !== current || repo.vcs !== vcs)
|
|
35130
35087
|
return yield* fail19(`Clone destination is not the requested ${vcs} repository: ${current}`);
|
|
35131
|
-
const actual = repo.vcs === "git" ? yield* origin(current
|
|
35088
|
+
const actual = repo.vcs === "git" ? yield* origin(current) : (yield* cloneSource2(current, sourceHostId ?? (yield* localHost).id)).url;
|
|
35132
35089
|
if (actual !== url)
|
|
35133
35090
|
return yield* fail19(`Clone destination belongs to a different origin: ${current}`);
|
|
35134
35091
|
return repo.commonDir;
|
|
@@ -35284,7 +35241,7 @@ var prepareCloneCheckout = exports_Effect.fnUntraced(function* (plan) {
|
|
|
35284
35241
|
const repo = yield* repository3(plan.repo);
|
|
35285
35242
|
if (repo.path !== plan.repo || repo.vcs !== plan.vcs || plan.existing && repo.commonDir !== plan.commonDir)
|
|
35286
35243
|
return yield* fail19(`Clone repository changed; retained at ${plan.repo}`);
|
|
35287
|
-
const actual = repo.vcs === "git" ? yield* origin(repo.path
|
|
35244
|
+
const actual = repo.vcs === "git" ? yield* origin(repo.path) : (yield* cloneSource2(repo.path, plan.hostId)).url;
|
|
35288
35245
|
if (actual !== url)
|
|
35289
35246
|
return yield* fail19(`Clone origin changed; retained at ${plan.repo}`);
|
|
35290
35247
|
if (plan.vcs === "jj") {
|
|
@@ -35366,15 +35323,20 @@ var dispatchHost = exports_Effect.fnUntraced(function* (request3, command) {
|
|
|
35366
35323
|
if (host.id !== request3.hostId)
|
|
35367
35324
|
return yield* exports_Effect.fail(new AppError({ message: `Wrong Rex host: expected ${request3.hostId}, got ${host.id}` }));
|
|
35368
35325
|
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];
|
|
35326
|
+
const paths = request3.kind === "sessions" ? [] : request3.kind === "discover" ? request3.context ? [request3.context] : [] : request3.kind === "project" ? [request3.path] : request3.kind === "clone-plan" || request3.kind === "clone-launch" ? [request3.input.repo] : request3.kind === "plan" || request3.kind === "launch" ? [request3.input.repo, ...request3.input.path ? [request3.input.path] : []] : [request3.repo];
|
|
35370
35327
|
if (paths.some((value3) => !path.isAbsolute(value3)))
|
|
35371
35328
|
return yield* exports_Effect.fail(new AppError({ message: "Destination repository and worktree paths must be absolute" }));
|
|
35372
35329
|
const identity3 = { version: 4, hostId: host.id };
|
|
35373
35330
|
let result4;
|
|
35374
35331
|
switch (request3.kind) {
|
|
35332
|
+
case "sessions": {
|
|
35333
|
+
const found = yield* exports_Effect.all({ sessions: listSessions, clients: listClients }, { concurrency: 2 });
|
|
35334
|
+
result4 = { ...identity3, kind: "sessions", ...found };
|
|
35335
|
+
break;
|
|
35336
|
+
}
|
|
35375
35337
|
case "discover": {
|
|
35376
35338
|
const config = yield* loadConfig;
|
|
35377
|
-
const checkoutEffect = request3.context ?
|
|
35339
|
+
const checkoutEffect = request3.context ? repository3(request3.context).pipe(exports_Effect.catchIf((error2) => missing3(error2) || notRepository(error2), () => exports_Effect.succeed(undefined))) : exports_Effect.succeed(undefined);
|
|
35378
35340
|
const { checkout, sessions, clients, projects } = yield* exports_Effect.all({
|
|
35379
35341
|
checkout: checkoutEffect,
|
|
35380
35342
|
sessions: listSessions,
|
|
@@ -35402,14 +35364,17 @@ var dispatchHost = exports_Effect.fnUntraced(function* (request3, command) {
|
|
|
35402
35364
|
}
|
|
35403
35365
|
const checkout = yield* repository3(request3.path);
|
|
35404
35366
|
const canonical2 = yield* project3(request3.path);
|
|
35367
|
+
const inventory2 = yield* exports_Effect.all({
|
|
35368
|
+
worktrees: canonical2.vcs === "git" ? listWorktrees(canonical2.path) : listWorkspaces(canonical2.path),
|
|
35369
|
+
branches: canonical2.vcs === "git" ? listBranches(canonical2.path) : exports_Effect.succeed([]),
|
|
35370
|
+
revisions: canonical2.vcs === "jj" ? listRevisions(canonical2.path) : exports_Effect.succeed([])
|
|
35371
|
+
}, { concurrency: 4 });
|
|
35405
35372
|
result4 = {
|
|
35406
35373
|
...identity3,
|
|
35407
35374
|
kind: "project",
|
|
35408
35375
|
project: canonical2,
|
|
35409
35376
|
checkout,
|
|
35410
|
-
|
|
35411
|
-
branches: canonical2.vcs === "git" ? yield* listBranches(canonical2.path) : [],
|
|
35412
|
-
revisions: canonical2.vcs === "jj" ? yield* listRevisions(canonical2.path) : []
|
|
35377
|
+
...inventory2
|
|
35413
35378
|
};
|
|
35414
35379
|
break;
|
|
35415
35380
|
}
|
|
@@ -35424,13 +35389,16 @@ var dispatchHost = exports_Effect.fnUntraced(function* (request3, command) {
|
|
|
35424
35389
|
}
|
|
35425
35390
|
case "worktrees": {
|
|
35426
35391
|
const repo = yield* repository3(request3.repo);
|
|
35392
|
+
const inventory2 = yield* exports_Effect.all({
|
|
35393
|
+
worktrees: repo.vcs === "git" ? listWorktrees(repo.path) : listWorkspaces(repo.path),
|
|
35394
|
+
branches: repo.vcs === "git" ? listBranches(repo.path) : exports_Effect.succeed([]),
|
|
35395
|
+
revisions: repo.vcs === "jj" ? listRevisions(repo.path) : exports_Effect.succeed([])
|
|
35396
|
+
}, { concurrency: 4 });
|
|
35427
35397
|
result4 = {
|
|
35428
35398
|
...identity3,
|
|
35429
35399
|
kind: "worktrees",
|
|
35430
35400
|
repository: repo,
|
|
35431
|
-
|
|
35432
|
-
branches: repo.vcs === "git" ? yield* listBranches(repo.path) : [],
|
|
35433
|
-
revisions: repo.vcs === "jj" ? yield* listRevisions(repo.path) : []
|
|
35401
|
+
...inventory2
|
|
35434
35402
|
};
|
|
35435
35403
|
break;
|
|
35436
35404
|
}
|
|
@@ -35455,7 +35423,7 @@ var dispatchHost = exports_Effect.fnUntraced(function* (request3, command) {
|
|
|
35455
35423
|
break;
|
|
35456
35424
|
}
|
|
35457
35425
|
return result4;
|
|
35458
|
-
});
|
|
35426
|
+
}, withLocalIdentity, withToolValidation);
|
|
35459
35427
|
var hostRequest = exports_Effect.fnUntraced(function* (raw, command) {
|
|
35460
35428
|
const request3 = yield* exports_Schema.decodeUnknownEffect(exports_Schema.fromJsonString(RequestSchema))(raw);
|
|
35461
35429
|
return yield* dispatchHost(request3, command);
|
|
@@ -35508,19 +35476,26 @@ var request3 = exports_Effect.fnUntraced(function* (host, command, body) {
|
|
|
35508
35476
|
}
|
|
35509
35477
|
return yield* connectedRequest(host, command, body);
|
|
35510
35478
|
});
|
|
35511
|
-
var
|
|
35512
|
-
|
|
35513
|
-
|
|
35514
|
-
|
|
35515
|
-
|
|
35516
|
-
return discovery(result4);
|
|
35479
|
+
var inspectSessions = exports_Effect.fnUntraced(function* (host, command) {
|
|
35480
|
+
const result4 = yield* request3(host, command, { kind: "sessions" });
|
|
35481
|
+
if (result4.kind !== "sessions")
|
|
35482
|
+
return yield* fail20("Unexpected sessions response");
|
|
35483
|
+
return { sessions: result4.sessions, clients: result4.clients };
|
|
35517
35484
|
});
|
|
35518
35485
|
var connectAndDiscover = exports_Effect.fnUntraced(function* (machine, command, context3) {
|
|
35519
35486
|
const host = yield* connectMachine(machine);
|
|
35520
35487
|
const result4 = yield* connectedRequest(host, command, { kind: "discover", ...host.local && context3 ? { context: context3 } : {} });
|
|
35521
35488
|
if (result4.kind !== "discover")
|
|
35522
35489
|
return yield* fail20("Unexpected discovery response");
|
|
35523
|
-
return {
|
|
35490
|
+
return {
|
|
35491
|
+
host,
|
|
35492
|
+
sessions: result4.sessions,
|
|
35493
|
+
clients: result4.clients,
|
|
35494
|
+
projects: result4.projects,
|
|
35495
|
+
roots: result4.roots ?? [],
|
|
35496
|
+
cloneRoot: result4.cloneRoot,
|
|
35497
|
+
...result4.checkout ? { checkout: result4.checkout } : {}
|
|
35498
|
+
};
|
|
35524
35499
|
});
|
|
35525
35500
|
var inspectProject = exports_Effect.fnUntraced(function* (host, command, path) {
|
|
35526
35501
|
const result4 = yield* request3(host, command, { kind: "project", path });
|
|
@@ -38539,69 +38514,61 @@ var safeDisplayText = (text, preserveWhitespace = false) => {
|
|
|
38539
38514
|
};
|
|
38540
38515
|
var fit = (text, width2) => Bun.stringWidth(text) > width2 ? Bun.sliceAnsi(text, 0, Math.max(0, width2), { ellipsis: "\u2026" }) : text;
|
|
38541
38516
|
var pad = (text, width2) => text + " ".repeat(Math.max(0, width2 - Bun.stringWidth(text)));
|
|
38542
|
-
var renderFormFrame = (view, focused,
|
|
38543
|
-
const width2 = Math.max(
|
|
38517
|
+
var renderFormFrame = (view, focused, columns, rows2, colors2 = !process.env.NO_COLOR, options = {}) => {
|
|
38518
|
+
const width2 = Math.max(2, columns);
|
|
38544
38519
|
const inside = width2 - 2;
|
|
38545
38520
|
const screen = [];
|
|
38546
|
-
const border = (
|
|
38547
|
-
const line = (left, right
|
|
38548
|
-
|
|
38521
|
+
const border = (body) => `${color("\u2502", "muted", colors2)}${pad(fit(body, inside), inside)}${color("\u2502", "muted", colors2)}`;
|
|
38522
|
+
const line = (left, right, title = "") => {
|
|
38523
|
+
const text = fit(safeDisplayText(title), inside);
|
|
38524
|
+
return color(`${left}${text}${"\u2500".repeat(Math.max(0, inside - Bun.stringWidth(text)))}${right}`, "muted", colors2);
|
|
38525
|
+
};
|
|
38526
|
+
const add4 = (text) => screen.push(border(text));
|
|
38549
38527
|
screen.push(line("\u250C", "\u2510"));
|
|
38550
|
-
|
|
38551
|
-
add4(heading);
|
|
38528
|
+
add4(`${color("REX", "cyan", colors2)} ${color("/ WORKTREES", "bold", colors2)}`);
|
|
38552
38529
|
screen.push(line("\u251C", "\u2524"));
|
|
38553
|
-
const
|
|
38554
|
-
const
|
|
38555
|
-
const
|
|
38556
|
-
const
|
|
38557
|
-
|
|
38558
|
-
|
|
38559
|
-
|
|
38560
|
-
|
|
38561
|
-
|
|
38530
|
+
const fieldCount = Math.max(1, Math.min(5, rows2 - 11));
|
|
38531
|
+
const detailCount = Math.max(3, rows2 - fieldCount - 8);
|
|
38532
|
+
const focusIndex = view.rows.findIndex((row) => row.id === focused);
|
|
38533
|
+
const start = Math.max(0, Math.min(focusIndex - fieldCount + 1, view.rows.length - fieldCount));
|
|
38534
|
+
for (let index2 = 0;index2 < fieldCount; index2++) {
|
|
38535
|
+
const row = view.rows[start + index2];
|
|
38536
|
+
if (!row) {
|
|
38537
|
+
add4("");
|
|
38538
|
+
continue;
|
|
38562
38539
|
}
|
|
38563
|
-
};
|
|
38564
|
-
for (const row of view.rows) {
|
|
38565
38540
|
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));
|
|
38541
|
+
const tone = row.disabled ? "muted" : active ? "cyan" : "bold";
|
|
38542
|
+
const indicator = index2 === 0 && start > 0 ? "\u2191" : index2 === fieldCount - 1 && start + fieldCount < view.rows.length ? "\u2193" : active ? "\u203A" : " ";
|
|
38543
|
+
add4(`${color(indicator, tone, colors2)} ${color(pad(fit(safeDisplayText(row.label).toUpperCase(), 13), 13), tone, colors2)} ${color(fit(safeDisplayText(row.value) || "\u2014", Math.max(1, inside - 17)), tone, colors2)}`);
|
|
38544
|
+
}
|
|
38545
|
+
add4("");
|
|
38546
|
+
const current = view.rows.find((row) => row.id === focused);
|
|
38547
|
+
screen.push(line("\u251C", "\u2524", ` ${options.editor?.title ?? current?.label ?? "Details"} `));
|
|
38548
|
+
const subtitle = current?.detail ?? view.rows.find((row) => row.id === "destination")?.detail ?? "";
|
|
38549
|
+
const wrapped = [view.error, view.notice, subtitle].filter(Boolean).flatMap((message) => Bun.wrapAnsi(safeDisplayText(message), Math.max(1, inside - 10), { hard: true }).split(`
|
|
38550
|
+
`));
|
|
38551
|
+
const visible = options.editor ? 1 : detailCount;
|
|
38552
|
+
const offset = Math.max(0, Math.min(options.detailOffset ?? 0, wrapped.length - visible));
|
|
38553
|
+
const detailLine = (index2) => `${index2 === 0 && offset > 0 ? "\u2191 " : ""}${wrapped[offset + index2] ?? ""}${index2 === visible - 1 && offset + visible < wrapped.length ? " \u2193 PgDn" : ""}`;
|
|
38554
|
+
if (options.editor) {
|
|
38555
|
+
const errorRows = view.error ? 1 : 0;
|
|
38556
|
+
for (let index2 = 0;index2 < detailCount - errorRows; index2++)
|
|
38557
|
+
add4(options.editor.lines[index2] ?? "");
|
|
38558
|
+
if (errorRows)
|
|
38559
|
+
add4(color(detailLine(0), "red", colors2));
|
|
38560
|
+
} else {
|
|
38561
|
+
for (let index2 = 0;index2 < detailCount; index2++)
|
|
38562
|
+
add4(color(detailLine(index2), view.error ? "red" : view.notice ? "amber" : "muted", colors2));
|
|
38593
38563
|
}
|
|
38564
|
+
screen.push(line("\u251C", "\u2524"));
|
|
38565
|
+
const hint = (key5, label) => `${color(key5, "bold", colors2)} ${color(label, "muted", colors2)}`;
|
|
38566
|
+
const button = (label, active, primary = false, disabled = false) => color(`${active ? "\u203A" : " "}[ ${safeDisplayText(label)} ]`, disabled ? "muted" : active ? "cyan" : primary ? "bold" : "muted", colors2);
|
|
38567
|
+
add4(options.footer ? color(options.footer, "muted", colors2) : options.editor ? `${hint("Enter", "accept")} \xB7 ${hint("Esc", "back")} \xB7 ${hint("\u2191\u2193", "choices")} \xB7 ${hint("PgUp/PgDn", "details")}` : `${button(`${view.submitLabel} \xB7 Ctrl+S`, focused === "submit", true, view.submitDisabled)} ${button("Cancel \xB7 Esc", focused === "cancel")} ${hint("Tab", "next")}`);
|
|
38594
38568
|
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);
|
|
38569
|
+
return screen.slice(0, Math.max(1, rows2)).join(`\r
|
|
38570
|
+
`);
|
|
38603
38571
|
};
|
|
38604
|
-
var popupTargetRows = (view, columns, editing = false) => Math.max(16 + (editing ? 6 : 0), naturalFormRows(view, Math.min(96, columns), editing));
|
|
38605
38572
|
var matchingChoices = (choices, text) => {
|
|
38606
38573
|
const query = text.toLocaleLowerCase();
|
|
38607
38574
|
const matches = [];
|
|
@@ -38642,51 +38609,29 @@ var advanceInputChoice = (state, event, choices, selectionOnly = false) => {
|
|
|
38642
38609
|
return { _tag: "Beep" };
|
|
38643
38610
|
return { _tag: "NextFrame", state: { text: state.text + text, selected: selectionOnly ? state.selected : null } };
|
|
38644
38611
|
};
|
|
38645
|
-
var renderInputChoice = (
|
|
38612
|
+
var renderInputChoice = (state, choices, columns, rows2, colors2 = !process.env.NO_COLOR, selectionOnly = false, count2 = Math.max(2, rows2 - 14)) => {
|
|
38646
38613
|
const width2 = Math.max(20, columns) - 2;
|
|
38647
38614
|
const matches = matchingChoices(choices, state.text);
|
|
38648
|
-
const count2 = rows2 >= 20 ? 3 : 1;
|
|
38649
38615
|
const selected = matches.indexOf(state.selected ?? -1);
|
|
38650
38616
|
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
|
-
];
|
|
38617
|
+
const lines2 = [`${color("\u203A", "cyan", colors2)} ${fit(safeDisplayText(state.text, true) || (selectionOnly ? "Filter exact choices\u2026" : "Type new value\u2026"), width2 - 2)}`];
|
|
38655
38618
|
for (const index2 of matches.slice(start, start + count2)) {
|
|
38656
38619
|
const choice = choices[index2];
|
|
38657
38620
|
if (!choice)
|
|
38658
38621
|
continue;
|
|
38659
38622
|
const label = `${state.selected === index2 ? "\u203A" : " "} ${safeDisplayText(choice.title)}${choice.description ? ` \xB7 ${safeDisplayText(choice.description)}` : ""}`;
|
|
38660
|
-
lines2.push(
|
|
38623
|
+
lines2.push(fit(label, width2));
|
|
38661
38624
|
}
|
|
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
|
-
`);
|
|
38625
|
+
return lines2;
|
|
38667
38626
|
};
|
|
38668
|
-
var acknowledge = (title, lines2, tone) => exports_Prompt.run(exports_Prompt.Custom(
|
|
38669
|
-
render: (
|
|
38627
|
+
var acknowledge = (title, lines2, tone, view = { rows: [], submitLabel: "Close" }) => exports_Prompt.run(exports_Prompt.Custom(0, {
|
|
38628
|
+
render: (detailOffset, action) => action._tag === "Submit" ? exports_Effect.succeed("") : exports_Effect.gen(function* () {
|
|
38670
38629
|
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
|
-
`;
|
|
38630
|
+
const notice = `${title} \xB7 ${lines2.join(" \xB7 ")}`;
|
|
38631
|
+
return `\x1B[H\x1B[2J${renderFormFrame({ ...view, error: tone === "error" ? notice : undefined, notice: tone !== "error" ? notice : undefined }, "submit", yield* terminal.columns, yield* terminal.rows, !process.env.NO_COLOR, { detailOffset, footer: "Enter / Space close \xB7 Esc close \xB7 PgUp/PgDn details" })}`;
|
|
38687
38632
|
}),
|
|
38688
38633
|
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" })
|
|
38634
|
+
process: (input, offset) => exports_Effect.succeed(input.key.name === "pageup" || input.key.name === "pagedown" ? { _tag: "NextFrame", state: Math.max(0, offset + (input.key.name === "pageup" ? -1 : 1)) } : input.key.name === "enter" || input.key.name === "return" || input.key.name === "space" || input.key.name === "escape" || input.key.ctrl && input.key.name === "c" ? { _tag: "Submit", value: undefined } : { _tag: "Beep" })
|
|
38690
38635
|
})).pipe(exports_Effect.catch(() => exports_Effect.void));
|
|
38691
38636
|
var problem = (error2) => error2 instanceof AppError ? error2.message : exports_Cause.pretty(exports_Cause.fail(error2));
|
|
38692
38637
|
var selected = (value3, current, title, description) => ({ value: value3, selected: current, title, description });
|
|
@@ -38751,15 +38696,16 @@ var selectRevision = (draft, choice) => changeDestination(draft, { revision: cho
|
|
|
38751
38696
|
var cloneInputFor = (draft) => {
|
|
38752
38697
|
if (!draft.host || !draft.clone || !draft.session || !draft.clone.repo.startsWith("/"))
|
|
38753
38698
|
return;
|
|
38754
|
-
if (draft.clone.vcs === "jj")
|
|
38699
|
+
if (draft.clone.vcs === "jj") {
|
|
38700
|
+
const revision = draft.clone.revision?.commitId === draft.destination?.revision ? draft.clone.revision : draft.clone.revisions.find((choice) => choice.revision.commitId === draft.destination?.revision)?.revision;
|
|
38755
38701
|
return {
|
|
38756
38702
|
vcs: "jj",
|
|
38757
38703
|
source: {
|
|
38758
38704
|
vcs: "jj",
|
|
38759
38705
|
url: draft.clone.url,
|
|
38760
38706
|
sourceHostId: draft.clone.sourceHostId,
|
|
38761
|
-
revisions:
|
|
38762
|
-
...
|
|
38707
|
+
revisions: [],
|
|
38708
|
+
...revision ? { revision } : {}
|
|
38763
38709
|
},
|
|
38764
38710
|
repo: draft.clone.repo,
|
|
38765
38711
|
session: draft.session,
|
|
@@ -38768,6 +38714,7 @@ var cloneInputFor = (draft) => {
|
|
|
38768
38714
|
...draft.worktreeName ? { worktreeName: draft.worktreeName } : {},
|
|
38769
38715
|
...draft.destination?.revision ? { revision: draft.destination.revision } : {}
|
|
38770
38716
|
};
|
|
38717
|
+
}
|
|
38771
38718
|
if (!draft.destination?.branch)
|
|
38772
38719
|
return;
|
|
38773
38720
|
return {
|
|
@@ -38798,49 +38745,36 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38798
38745
|
let sessions = [];
|
|
38799
38746
|
let focused = "project";
|
|
38800
38747
|
let error2;
|
|
38801
|
-
let
|
|
38802
|
-
let clonePlan;
|
|
38748
|
+
let blocked = false;
|
|
38803
38749
|
let cloneRoot = "";
|
|
38804
38750
|
let cloneRoots = [];
|
|
38805
38751
|
let contextPath;
|
|
38806
|
-
const resizePopup = yield* makePopupSizer;
|
|
38807
38752
|
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);
|
|
38753
|
+
const resizeEvents = exports_Effect.gen(function* () {
|
|
38754
|
+
const source = yield* terminal.size;
|
|
38755
|
+
const events = yield* exports_Queue.sliding(1);
|
|
38756
|
+
yield* exports_Effect.forever(exports_Queue.take(source).pipe(exports_Effect.flatMap((value3) => exports_Queue.offer(events, value3)))).pipe(exports_Effect.forkScoped);
|
|
38757
|
+
return events;
|
|
38758
|
+
});
|
|
38820
38759
|
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);
|
|
38760
|
+
let detailOffset = 0;
|
|
38830
38761
|
const fields = [...view.rows.map((row) => row.id), "submit", "cancel"];
|
|
38831
38762
|
const initial = Math.max(0, fields.indexOf(initialFocus));
|
|
38832
|
-
const prompt = exports_Prompt.Custom(initial,
|
|
38763
|
+
const prompt = exports_Prompt.Custom(initial, yield* resizeEvents, {
|
|
38833
38764
|
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)}`;
|
|
38765
|
+
const columns = yield* terminal.columns;
|
|
38766
|
+
const rows2 = yield* terminal.rows;
|
|
38767
|
+
return `\x1B[H\x1B[2J${renderFormFrame(view, fields[index2], columns, rows2, !process.env.NO_COLOR, { detailOffset })}`;
|
|
38838
38768
|
}),
|
|
38839
38769
|
clear: () => exports_Effect.succeed(""),
|
|
38840
38770
|
process: (event, index2) => {
|
|
38841
38771
|
if (event._tag === "Event")
|
|
38842
38772
|
return exports_Effect.succeed({ _tag: "NextFrame", state: index2 });
|
|
38843
38773
|
const { key: key5 } = event.input;
|
|
38774
|
+
if (key5.name === "pageup" || key5.name === "pagedown") {
|
|
38775
|
+
detailOffset = Math.max(0, detailOffset + (key5.name === "pageup" ? -1 : 1));
|
|
38776
|
+
return exports_Effect.succeed({ _tag: "NextFrame", state: index2 });
|
|
38777
|
+
}
|
|
38844
38778
|
if (key5.name === "escape" || key5.ctrl && key5.name === "c")
|
|
38845
38779
|
return exports_Effect.succeed({ _tag: "Submit", value: "cancel" });
|
|
38846
38780
|
if (key5.ctrl && key5.name === "s")
|
|
@@ -38857,29 +38791,25 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38857
38791
|
return yield* exports_Prompt.run(prompt);
|
|
38858
38792
|
}, exports_Effect.scoped);
|
|
38859
38793
|
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, {
|
|
38794
|
+
let detailOffset = 0;
|
|
38795
|
+
const result4 = yield* exports_Prompt.run(exports_Prompt.Custom({ text: "", selected: options.selected === undefined || options.selected < 0 ? null : options.selected }, yield* resizeEvents, {
|
|
38870
38796
|
render: (state, action) => action._tag === "Submit" ? exports_Effect.succeed("") : exports_Effect.gen(function* () {
|
|
38871
|
-
const columns = yield*
|
|
38872
|
-
const rows2 = yield*
|
|
38797
|
+
const columns = yield* terminal.columns;
|
|
38798
|
+
const rows2 = yield* terminal.rows;
|
|
38873
38799
|
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);
|
|
38800
|
+
const editor = renderInputChoice(state, options.choices, columns, rows2, !process.env.NO_COLOR, options.selectionOnly, Math.max(2, rows2 - 14) - (view?.error ? 1 : 0));
|
|
38877
38801
|
if (!view)
|
|
38878
38802
|
return "";
|
|
38879
|
-
return `\x1B[H\x1B[2J${renderFormFrame(view, focused,
|
|
38803
|
+
return `\x1B[H\x1B[2J${renderFormFrame(view, focused, columns, rows2, !process.env.NO_COLOR, { editor: { title: options.message, lines: editor }, detailOffset })}`;
|
|
38880
38804
|
}),
|
|
38881
38805
|
clear: () => exports_Effect.succeed(""),
|
|
38882
|
-
process: (event, state) =>
|
|
38806
|
+
process: (event, state) => {
|
|
38807
|
+
if (event._tag !== "Event" && (event.input.key.name === "pageup" || event.input.key.name === "pagedown")) {
|
|
38808
|
+
detailOffset = Math.max(0, detailOffset + (event.input.key.name === "pageup" ? -1 : 1));
|
|
38809
|
+
return exports_Effect.succeed({ _tag: "NextFrame", state });
|
|
38810
|
+
}
|
|
38811
|
+
return exports_Effect.succeed(event._tag === "Event" ? { _tag: "NextFrame", state } : advanceInputChoice(state, event.input, options.choices, options.selectionOnly));
|
|
38812
|
+
}
|
|
38883
38813
|
}));
|
|
38884
38814
|
return result4 === null ? yield* exports_Effect.fail(new exports_Terminal.QuitError({})) : result4;
|
|
38885
38815
|
}, exports_Effect.scoped);
|
|
@@ -38982,13 +38912,21 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38982
38912
|
return yield* exports_Effect.fail(new AppError({ message: "Project directory changed; select the exact project directory again" }));
|
|
38983
38913
|
return inspected.success;
|
|
38984
38914
|
});
|
|
38915
|
+
const useProject = (found) => {
|
|
38916
|
+
draft = changeProject(draft, found.project);
|
|
38917
|
+
if (found.checkout.vcs === "jj" && !draft.sourcePath)
|
|
38918
|
+
draft = { ...draft, sourcePath: found.checkout.path };
|
|
38919
|
+
if (!draft.destination) {
|
|
38920
|
+
const tree = found.worktrees.find((item) => item.path === found.checkout.path && (item.vcs === "jj" ? item.present : !item.bare && !item.prunable));
|
|
38921
|
+
if (tree)
|
|
38922
|
+
draft = selectWorktree(draft, tree);
|
|
38923
|
+
}
|
|
38924
|
+
};
|
|
38985
38925
|
const activate2 = exports_Effect.fnUntraced(function* (machine, showLoading = false) {
|
|
38986
38926
|
const previous = draft;
|
|
38987
38927
|
const previousHostId = draft.host?.hostId;
|
|
38988
38928
|
draft = { machine, projectChoice: draft.projectChoice, mode: draft.mode };
|
|
38989
38929
|
sessions = [];
|
|
38990
|
-
plan = undefined;
|
|
38991
|
-
clonePlan = undefined;
|
|
38992
38930
|
cloneRoot = "";
|
|
38993
38931
|
cloneRoots = [];
|
|
38994
38932
|
error2 = undefined;
|
|
@@ -38997,7 +38935,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
38997
38935
|
if (showLoading) {
|
|
38998
38936
|
const pending = { ...formView(true), notice: `Connecting to ${machine.label}\u2026` };
|
|
38999
38937
|
activeView = pending;
|
|
39000
|
-
yield* terminal.display(`\x1B[H\x1B[2J${renderFormFrame(pending, "machine",
|
|
38938
|
+
yield* terminal.display(`\x1B[H\x1B[2J${renderFormFrame(pending, "machine", yield* terminal.columns, yield* terminal.rows)}`);
|
|
39001
38939
|
}
|
|
39002
38940
|
const connected = yield* exports_Effect.result(connectAndDiscover(machine, command, discoveredContext));
|
|
39003
38941
|
if (exports_Result.isFailure(connected)) {
|
|
@@ -39027,15 +38965,8 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39027
38965
|
error2 = problem(inspected.failure);
|
|
39028
38966
|
return;
|
|
39029
38967
|
}
|
|
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
|
-
}
|
|
38968
|
+
draft = changeProjectChoice(draft, known(host, inspected.success.project, inspected.success.checkout));
|
|
38969
|
+
useProject(inspected.success);
|
|
39039
38970
|
} else if (draft.projectChoice) {
|
|
39040
38971
|
const inspected = yield* exports_Effect.result(bindProject(draft.projectChoice, host, found.projects));
|
|
39041
38972
|
if (exports_Result.isFailure(inspected)) {
|
|
@@ -39043,17 +38974,8 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39043
38974
|
error2 = problem(inspected.failure);
|
|
39044
38975
|
return;
|
|
39045
38976
|
}
|
|
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
|
-
}
|
|
38977
|
+
if (inspected.success)
|
|
38978
|
+
useProject(inspected.success);
|
|
39057
38979
|
}
|
|
39058
38980
|
error2 = undefined;
|
|
39059
38981
|
});
|
|
@@ -39104,27 +39026,17 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39104
39026
|
value: draft.mode === "auto" ? "Reuse matching tab, otherwise new tab" : draft.mode === "new-tab" ? "Always new tab" : "Split matching tab, otherwise new tab",
|
|
39105
39027
|
disabled: !draft.host
|
|
39106
39028
|
});
|
|
39107
|
-
const awaitingConfirmation = !!(clonePlan || plan);
|
|
39108
39029
|
return {
|
|
39109
39030
|
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
|
|
39031
|
+
submitLabel: draft.clone ? "Clone & Open" : draft.destination?.path ? "Open checkout" : draft.project?.vcs === "jj" ? "Create workspace & open" : "Create checkout & open",
|
|
39032
|
+
submitDisabled: initializing || blocked || !draft.host || !(cloneInputFor(draft) || inputFor(draft)),
|
|
39033
|
+
notice: draft.clone ? "Only pushed history transfers" : undefined,
|
|
39034
|
+
error: initializing ? undefined : error2 ?? (!draft.projectChoice ? "Select a project" : !draft.machine ? "Select a Rex machine" : !draft.host ? "Connect to the selected machine and install its worktrees helper if missing" : !(draft.project || draft.clone) ? "Select the exact project directory on this machine" : !draft.destination && draft.project?.vcs !== "jj" && draft.clone?.vcs !== "jj" ? "Select a branch" : draft.project?.vcs === "jj" && (!draft.worktreeName && !draft.destination?.path || !!draft.worktreeName && !draft.destination?.revision) ? "Choose an existing workspace or a new workspace name and starting revision" : !draft.session ? "Choose an existing Rex session or type a new name" : undefined)
|
|
39124
39035
|
};
|
|
39125
39036
|
};
|
|
39126
|
-
const initialView = formView(true);
|
|
39037
|
+
const initialView = { ...formView(true), notice: "Discovering projects and Rex sessions\u2026" };
|
|
39127
39038
|
activeView = initialView;
|
|
39039
|
+
yield* terminal.display(`\x1B[H\x1B[2J${renderFormFrame(initialView, "project", yield* terminal.columns, yield* terminal.rows)}`);
|
|
39128
39040
|
const initialize = exports_Effect.gen(function* () {
|
|
39129
39041
|
contextPath = yield* context3;
|
|
39130
39042
|
yield* loadMachines;
|
|
@@ -39153,18 +39065,12 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39153
39065
|
const current2 = yield* exports_Effect.result(reviewClone(draft.host, command, cloneInput));
|
|
39154
39066
|
if (exports_Result.isFailure(current2)) {
|
|
39155
39067
|
error2 = problem(current2.failure);
|
|
39156
|
-
clonePlan = undefined;
|
|
39157
39068
|
continue;
|
|
39158
39069
|
}
|
|
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;
|
|
39070
|
+
const clonePlan = current2.success;
|
|
39071
|
+
if (clonePlan.repo !== cloneInput.repo || clonePlan.hostId !== draft.host.hostId) {
|
|
39072
|
+
error2 = clonePlan.hostId !== draft.host.hostId ? "Rex target changed; select the machine again" : `Clone destination changed; edit the destination: ${clonePlan.repo}`;
|
|
39073
|
+
blocked = true;
|
|
39168
39074
|
continue;
|
|
39169
39075
|
}
|
|
39170
39076
|
const launched2 = yield* exports_Effect.result(submitClone(draft.host, command, cloneInput, clonePlan));
|
|
@@ -39174,7 +39080,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39174
39080
|
problem(launched2.failure),
|
|
39175
39081
|
`Destination: ${clonePlan.repo}`,
|
|
39176
39082
|
"A clone or Rex tab may already exist. Inspect the destination and session before opening again."
|
|
39177
|
-
], "error");
|
|
39083
|
+
], "error", view);
|
|
39178
39084
|
return yield* exports_Effect.fail(launched2.failure);
|
|
39179
39085
|
}
|
|
39180
39086
|
if (launched2.success.warning)
|
|
@@ -39183,7 +39089,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39183
39089
|
`Destination: ${launched2.success.repo}`,
|
|
39184
39090
|
"The clone task was created; Rex may not have focused its tab. Inspect the session before opening again.",
|
|
39185
39091
|
launched2.success.warning
|
|
39186
|
-
], "warning");
|
|
39092
|
+
], "warning", view);
|
|
39187
39093
|
return;
|
|
39188
39094
|
}
|
|
39189
39095
|
const input = inputFor(draft);
|
|
@@ -39192,19 +39098,12 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39192
39098
|
const current = yield* exports_Effect.result(review(draft.host, command, input));
|
|
39193
39099
|
if (exports_Result.isFailure(current)) {
|
|
39194
39100
|
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
39101
|
continue;
|
|
39202
39102
|
}
|
|
39203
|
-
const
|
|
39204
|
-
|
|
39205
|
-
|
|
39206
|
-
|
|
39207
|
-
error2 = changedPath ? `Destination or Rex target changed; review the updated action before submitting again. Destination: ${plan.path}` : undefined;
|
|
39103
|
+
const plan = current.success;
|
|
39104
|
+
if (plan.hostId !== draft.host.hostId || input.path && plan.path !== input.path) {
|
|
39105
|
+
error2 = plan.hostId !== draft.host.hostId ? "Rex target changed; select the machine again" : `Destination changed; select the checkout again: ${plan.path}`;
|
|
39106
|
+
blocked = true;
|
|
39208
39107
|
continue;
|
|
39209
39108
|
}
|
|
39210
39109
|
const launched = yield* exports_Effect.result(submit(draft.host, command, input, plan));
|
|
@@ -39214,7 +39113,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39214
39113
|
problem(launched.failure),
|
|
39215
39114
|
`Destination: ${plan.path}`,
|
|
39216
39115
|
"The checkout or Rex tab may already have changed. Inspect the session before opening again."
|
|
39217
|
-
], "error");
|
|
39116
|
+
], "error", view);
|
|
39218
39117
|
return yield* exports_Effect.fail(launched.failure);
|
|
39219
39118
|
}
|
|
39220
39119
|
if (launched.success.warning || plan.warning)
|
|
@@ -39224,7 +39123,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39224
39123
|
`Action: ${launched.success.action}`,
|
|
39225
39124
|
launched.success.pending ? `Task submitted; ${plan.vcs === "jj" ? "JJ" : "Git"} setup may still be running.` : "Existing task focused.",
|
|
39226
39125
|
...new Set([plan.warning, launched.success.warning].filter((line) => !!line))
|
|
39227
|
-
], "warning");
|
|
39126
|
+
], "warning", view);
|
|
39228
39127
|
return;
|
|
39229
39128
|
}
|
|
39230
39129
|
if (view.rows.find((row) => row.id === action)?.disabled)
|
|
@@ -39255,26 +39154,14 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39255
39154
|
return yield* exports_Effect.fail(new AppError({ message: "Project name is required" }));
|
|
39256
39155
|
const host = draft.host;
|
|
39257
39156
|
if (host) {
|
|
39258
|
-
const
|
|
39259
|
-
|
|
39260
|
-
const inspected = yield* bindProject(choice, host, found.projects);
|
|
39157
|
+
const available = projects.flatMap((item) => item.source?.machineKey === host.key && item.source.hostId === host.hostId ? [item.source.repository] : []);
|
|
39158
|
+
const inspected = yield* bindProject(choice, host, available);
|
|
39261
39159
|
if (inspected) {
|
|
39262
39160
|
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);
|
|
39161
|
+
useProject(inspected);
|
|
39162
|
+
if (!available.some((repo) => repo.vcs === inspected.project.vcs && repo.commonDir === inspected.project.commonDir))
|
|
39163
|
+
projects.push(known(host, inspected.project, inspected.checkout));
|
|
39269
39164
|
}
|
|
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
39165
|
} else
|
|
39279
39166
|
draft = changeProjectChoice(draft, choice);
|
|
39280
39167
|
} else if (action === "destination") {
|
|
@@ -39329,8 +39216,6 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39329
39216
|
const existing = trees.find((tree) => tree.vcs === "git" && tree.branch === branch);
|
|
39330
39217
|
draft = existing ? selectWorktree(draft, existing) : changeDestination(draft, { branch, label: branch }, draft.worktreeName);
|
|
39331
39218
|
} 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
39219
|
draft = selectWorktree(draft, picked.value);
|
|
39335
39220
|
}
|
|
39336
39221
|
} else {
|
|
@@ -39426,7 +39311,7 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39426
39311
|
} else if (action === "session") {
|
|
39427
39312
|
if (!draft.host)
|
|
39428
39313
|
return yield* exports_Effect.fail(new AppError({ message: "Select a machine before choosing a session" }));
|
|
39429
|
-
const found = yield*
|
|
39314
|
+
const found = yield* inspectSessions(draft.host, command);
|
|
39430
39315
|
sessions = found.sessions;
|
|
39431
39316
|
draft = { ...draft, clientId: focusClient(found.clients) };
|
|
39432
39317
|
const picked = yield* inputChoice({
|
|
@@ -39449,11 +39334,14 @@ var popup = (command, context3, origin2 = {}, preferredMachine) => exports_Effec
|
|
|
39449
39334
|
if (!exports_Terminal.isQuitError(editing.failure))
|
|
39450
39335
|
error2 = problem(editing.failure);
|
|
39451
39336
|
} else {
|
|
39452
|
-
|
|
39453
|
-
clonePlan = undefined;
|
|
39337
|
+
blocked = false;
|
|
39454
39338
|
}
|
|
39455
39339
|
}
|
|
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)))))
|
|
39340
|
+
}).pipe(exports_Effect.catchCause((cause) => exports_Cause.hasInterrupts(cause) || launchAcknowledged ? exports_Effect.failCause(cause) : acknowledge("Could not open worktrees", [exports_Cause.pretty(cause)], "error").pipe(exports_Effect.andThen(exports_Effect.failCause(cause)))), exports_Effect.provideServiceEffect(exports_Terminal.Terminal, exports_Effect.gen(function* () {
|
|
39341
|
+
const terminal = yield* exports_Terminal.Terminal;
|
|
39342
|
+
const input = yield* terminal.readInput;
|
|
39343
|
+
return { ...terminal, readInput: exports_Effect.succeed(input) };
|
|
39344
|
+
})));
|
|
39457
39345
|
}));
|
|
39458
39346
|
|
|
39459
39347
|
// src/main.ts
|
|
@@ -39643,14 +39531,14 @@ Run rex config reload to activate.`}`);
|
|
|
39643
39531
|
if (args2.length !== 1)
|
|
39644
39532
|
return yield* exports_Effect.fail(new AppError({ message: "task requires one JSON argument" }));
|
|
39645
39533
|
const request4 = yield* exports_Schema.decodeUnknownEffect(exports_Schema.fromJsonString(TaskRequestSchema))(args2[0]);
|
|
39646
|
-
yield* task(request4);
|
|
39534
|
+
yield* withLocalIdentity(withToolValidation(task(request4)));
|
|
39647
39535
|
return;
|
|
39648
39536
|
}
|
|
39649
39537
|
if (verb === "clone-task") {
|
|
39650
39538
|
if (args2.length !== 1)
|
|
39651
39539
|
return yield* exports_Effect.fail(new AppError({ message: "clone-task requires one JSON argument" }));
|
|
39652
39540
|
const request4 = yield* exports_Schema.decodeUnknownEffect(exports_Schema.fromJsonString(CloneTaskRequestSchema))(args2[0]);
|
|
39653
|
-
yield* cloneTask(request4);
|
|
39541
|
+
yield* withLocalIdentity(withToolValidation(cloneTask(request4)));
|
|
39654
39542
|
return;
|
|
39655
39543
|
}
|
|
39656
39544
|
if (verb === "host-request") {
|