@kaynooo/cli-wt 0.1.2 → 0.1.7

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.
Files changed (47) hide show
  1. package/README.md +17 -10
  2. package/dist/cli-0gbs87r4.js +313 -0
  3. package/dist/cli-1nyesy1b.js +674 -0
  4. package/dist/cli-4g5ehhgn.js +251 -0
  5. package/dist/cli-6ybxw5sc.js +97 -0
  6. package/dist/cli-dmkfxdbr.js +153 -0
  7. package/dist/cli-dmzvmpge.js +106 -0
  8. package/dist/cli-e2h20nyy.js +36 -0
  9. package/dist/cli-j82fak6j.js +69 -0
  10. package/dist/cli-k4471y24.js +779 -0
  11. package/dist/cli-kek450vq.js +519 -0
  12. package/dist/cli-n5rt07v7.js +105 -0
  13. package/dist/cli-pkvw2k4x.js +37 -0
  14. package/dist/cli-w4w36hng.js +67 -0
  15. package/dist/cli.js +238 -2592
  16. package/dist/commands-jtnbchtb.js +222 -0
  17. package/dist/init-4ynjrztr.js +166 -0
  18. package/dist/list-js6drtvg.js +88 -0
  19. package/dist/print-q6qaqg22.js +77 -0
  20. package/dist/prompt-y71tp3f5.js +436 -0
  21. package/dist/prune-beweag7w.js +17 -0
  22. package/dist/run-7eayrqwy.js +18 -0
  23. package/dist/shell-xrgvqrpp.js +55 -0
  24. package/dist/stack-h3pgyx1e.js +20 -0
  25. package/dist/tools-4j56r47a.js +13 -0
  26. package/package.json +6 -6
  27. package/src/cli.ts +270 -76
  28. package/src/commands.ts +58 -42
  29. package/src/compose.ts +37 -14
  30. package/src/config.ts +8 -1
  31. package/src/errors.ts +31 -5
  32. package/src/files.ts +15 -23
  33. package/src/git.ts +53 -7
  34. package/src/index.ts +3 -2
  35. package/src/init.ts +56 -10
  36. package/src/jobs.ts +60 -19
  37. package/src/list.ts +26 -13
  38. package/src/print.ts +76 -0
  39. package/src/project.ts +134 -23
  40. package/src/proxy.ts +9 -9
  41. package/src/prune.ts +149 -0
  42. package/src/queue.ts +27 -3
  43. package/src/run.ts +82 -23
  44. package/src/shell.ts +34 -7
  45. package/src/stack.ts +10 -12
  46. package/src/sync.ts +28 -3
  47. package/src/tools.ts +91 -0
@@ -0,0 +1,436 @@
1
+ // @bun
2
+ import {
3
+ isInteractive,
4
+ paint,
5
+ truncate,
6
+ textWidth,
7
+ fail,
8
+ cacheFolder
9
+ } from "./cli-k4471y24.js";
10
+
11
+ // ../kit/src/prompt.ts
12
+ import process2 from "process";
13
+
14
+ // ../kit/src/answers.ts
15
+ import { mkdirSync, readFileSync, writeFileSync } from "fs";
16
+ import { dirname, join } from "path";
17
+ var KEPT = 50;
18
+ function answersFile() {
19
+ return join(cacheFolder(), "kaynooo-cli", "answers.json");
20
+ }
21
+ function stored() {
22
+ try {
23
+ const parsed = JSON.parse(readFileSync(answersFile(), "utf-8"));
24
+ if (typeof parsed !== "object" || parsed === null)
25
+ return {};
26
+ return Object.fromEntries(Object.entries(parsed).filter((entry) => Array.isArray(entry[1]) && entry[1].every((answer) => typeof answer === "string")));
27
+ } catch {
28
+ return {};
29
+ }
30
+ }
31
+ function earlierAnswers(key) {
32
+ return stored()[key] ?? [];
33
+ }
34
+ function rememberAnswer(key, answer) {
35
+ const all = stored();
36
+ const file = answersFile();
37
+ all[key] = [answer, ...(all[key] ?? []).filter((earlier) => earlier !== answer)].slice(0, KEPT);
38
+ try {
39
+ mkdirSync(dirname(file), { recursive: true });
40
+ writeFileSync(file, JSON.stringify(all));
41
+ } catch {}
42
+ }
43
+
44
+ // ../kit/src/job.ts
45
+ import process from "process";
46
+ function stopJob() {
47
+ process.kill(0, "SIGTSTP");
48
+ }
49
+
50
+ // ../kit/src/picker/line.ts
51
+ var EDIT_KEYS = new Set(["left", "right", "wordleft", "wordright", "linestart", "lineend", "erase", "delete", "word", "killword", "killnext", "clear", "killend", "yank"]);
52
+ var BACKWARD_KILLS = new Set(["word", "killword", "clear"]);
53
+ var FORWARD_KILLS = new Set(["killnext", "killend"]);
54
+ function isEditKey(key) {
55
+ return EDIT_KEYS.has(key);
56
+ }
57
+ function endsKills(key) {
58
+ return typeof key !== "object" && !isEditKey(key);
59
+ }
60
+ var WORD_CHARACTER = /[\p{L}\p{N}_]/u;
61
+ var SPACE = /\s/;
62
+ function isWord(char) {
63
+ return char !== undefined && WORD_CHARACTER.test(char);
64
+ }
65
+ function wordStart(chars, from) {
66
+ let at = from;
67
+ while (at > 0 && !isWord(chars[at - 1]))
68
+ at--;
69
+ while (at > 0 && isWord(chars[at - 1]))
70
+ at--;
71
+ return at;
72
+ }
73
+ function wordEnd(chars, from) {
74
+ let at = from;
75
+ while (at < chars.length && !isWord(chars[at]))
76
+ at++;
77
+ while (at < chars.length && isWord(chars[at]))
78
+ at++;
79
+ return at;
80
+ }
81
+ function spacedStart(chars, from) {
82
+ let at = from;
83
+ while (at > 0 && SPACE.test(chars[at - 1] ?? ""))
84
+ at--;
85
+ while (at > 0 && !SPACE.test(chars[at - 1] ?? ""))
86
+ at--;
87
+ return at;
88
+ }
89
+ function cut(chars, from, to) {
90
+ return { text: [...chars.slice(0, from), ...chars.slice(to)].join(""), caret: from };
91
+ }
92
+ function insert(chars, at, text) {
93
+ const typed = [...text];
94
+ return { text: [...chars.slice(0, at), ...typed, ...chars.slice(at)].join(""), caret: at + typed.length };
95
+ }
96
+ function editLine(line, key) {
97
+ const { killed = "", chained = false } = line;
98
+ const chars = [...line.text];
99
+ const at = Math.min(Math.max(line.caret, 0), chars.length);
100
+ const edited = edit(chars, at, key, killed);
101
+ if (typeof key === "object" || !BACKWARD_KILLS.has(key) && !FORWARD_KILLS.has(key))
102
+ return line.killed === undefined ? edited : { ...edited, killed };
103
+ const taken = chars.slice(edited.caret, edited.caret + chars.length - [...edited.text].length).join("");
104
+ if (taken === "")
105
+ return { ...edited, killed, chained };
106
+ if (!chained)
107
+ return { ...edited, killed: taken, chained: true };
108
+ return { ...edited, killed: BACKWARD_KILLS.has(key) ? taken + killed : killed + taken, chained: true };
109
+ }
110
+ function edit(chars, at, key, killed) {
111
+ const text = chars.join("");
112
+ if (typeof key === "object")
113
+ return insert(chars, at, key.text);
114
+ switch (key) {
115
+ case "left":
116
+ return { text, caret: Math.max(at - 1, 0) };
117
+ case "right":
118
+ return { text, caret: Math.min(at + 1, chars.length) };
119
+ case "wordleft":
120
+ return { text, caret: wordStart(chars, at) };
121
+ case "wordright":
122
+ return { text, caret: wordEnd(chars, at) };
123
+ case "linestart":
124
+ return { text, caret: 0 };
125
+ case "lineend":
126
+ return { text, caret: chars.length };
127
+ case "erase":
128
+ return cut(chars, Math.max(at - 1, 0), at);
129
+ case "delete":
130
+ return cut(chars, at, Math.min(at + 1, chars.length));
131
+ case "word":
132
+ return cut(chars, spacedStart(chars, at), at);
133
+ case "killword":
134
+ return cut(chars, wordStart(chars, at), at);
135
+ case "killnext":
136
+ return cut(chars, at, wordEnd(chars, at));
137
+ case "clear":
138
+ return cut(chars, 0, at);
139
+ case "killend":
140
+ return cut(chars, at, chars.length);
141
+ case "yank":
142
+ return insert(chars, at, killed);
143
+ }
144
+ }
145
+ function visible({ text, caret }, room) {
146
+ const chars = [...text];
147
+ const at = Math.min(Math.max(caret, 0), chars.length);
148
+ const cells = at === chars.length ? [...chars, " "] : chars;
149
+ const widths = cells.map((char) => Bun.stringWidth(char));
150
+ const width = (from, to) => widths.slice(from, to).reduce((sum, size) => sum + size, 0);
151
+ const fits = (from, to) => (from > 0 ? 1 : 0) + width(from, to) + (to < cells.length ? 1 : 0) <= room;
152
+ let start = at;
153
+ let end = at + 1;
154
+ while (start > 0 && fits(start - 1, end))
155
+ start--;
156
+ while (end < cells.length && fits(start, end + 1))
157
+ end++;
158
+ const left = start > 0 ? "\u2026" : "";
159
+ const right = end < cells.length ? "\u2026" : "";
160
+ return { before: left + chars.slice(start, at).join(""), at: chars[at], after: chars.slice(at + 1, end).join("") + right, column: left.length + width(start, at) };
161
+ }
162
+
163
+ // ../kit/src/picker/score.ts
164
+ var BOUNDARY_AFTER = new Set([" ", "/", "-", "_", ".", ":", "\\", "(", "[", ",", "\t"]);
165
+ var NONE = Number.NEGATIVE_INFINITY;
166
+
167
+ // ../kit/src/picker/state.ts
168
+ var IS_CONTROL = /[\x00-\x1F\x7F-\x9F]/;
169
+ var PASTE_START = "\x1B[200~";
170
+ var PASTE_END = "\x1B[201~";
171
+ var KEY_SEQUENCES = /\x1B\[<[0-9;]*[A-Za-z]|\x1B\[[0-9;]*[A-Z~]|\x1BO[A-Z]|\x1B[\s\S]|[\s\S]/gu;
172
+ var MOUSE = /^\x1B\[<(\d+);\d+;\d+[a-z]$/i;
173
+ var WHEEL_LINES = 3;
174
+ var KEYS = {
175
+ "\x1B[A": "up",
176
+ "\x1BOA": "up",
177
+ "\x10": "up",
178
+ "\x1B[B": "down",
179
+ "\x1BOB": "down",
180
+ "\x0E": "down",
181
+ "\x1B[5~": "pageup",
182
+ "\x1B[6~": "pagedown",
183
+ "\x1B[H": "home",
184
+ "\x1B[1~": "home",
185
+ "\x1BOH": "home",
186
+ "\x1B[F": "end",
187
+ "\x1B[4~": "end",
188
+ "\x1BOF": "end",
189
+ "\r": "enter",
190
+ "\n": "enter",
191
+ "\x03": "cancel",
192
+ "\x1B": "cancel",
193
+ "\x1B[D": "left",
194
+ "\x1BOD": "left",
195
+ "\x1B[C": "right",
196
+ "\x1BOC": "right",
197
+ "\x1B[1;5D": "wordleft",
198
+ "\x1B[1;3D": "wordleft",
199
+ "\x1Bb": "wordleft",
200
+ "\x1B[1;5C": "wordright",
201
+ "\x1B[1;3C": "wordright",
202
+ "\x1Bf": "wordright",
203
+ "\x01": "linestart",
204
+ "\x05": "lineend",
205
+ "\x7F": "erase",
206
+ "\x1B[3~": "delete",
207
+ "\b": "killword",
208
+ "\x1B\x7F": "killword",
209
+ "\x1B[3;5~": "killnext",
210
+ "\x1Bd": "killnext",
211
+ "\x15": "clear",
212
+ "\v": "killend",
213
+ "\x17": "word",
214
+ "\x19": "yank",
215
+ "\x1A": "suspend",
216
+ "\t": "tab",
217
+ "\x1F": "help",
218
+ "\x1BOP": "help",
219
+ "\x1B[11~": "help"
220
+ };
221
+ function repeat(value, count) {
222
+ return Array.from({ length: count }).fill(value);
223
+ }
224
+ function parseKeys(input, paste = { active: false }, ctrls = []) {
225
+ const codes = new Map(ctrls.map((name) => [String.fromCharCode(name.codePointAt(name.length - 1) - 96), name]));
226
+ return (input.match(KEY_SEQUENCES) ?? []).flatMap((sequence) => {
227
+ const wheel = MOUSE.exec(sequence)?.[1];
228
+ if (wheel !== undefined)
229
+ return repeat(wheel === "64" ? "up" : "down", wheel === "64" || wheel === "65" ? WHEEL_LINES : 0);
230
+ const named = codes.get(sequence);
231
+ const key = named === undefined ? KEYS[sequence] : { ctrl: named };
232
+ if (sequence === PASTE_START || sequence === PASTE_END) {
233
+ paste.active = sequence === PASTE_START;
234
+ return [];
235
+ }
236
+ if (paste.active && (sequence === "\r" || sequence === `
237
+ `))
238
+ return [];
239
+ if (key !== undefined)
240
+ return [key];
241
+ return IS_CONTROL.test(sequence) || sequence.startsWith("\x1B") ? [] : [{ text: sequence }];
242
+ });
243
+ }
244
+
245
+ // ../kit/src/redraw.ts
246
+ var SYNC_START = "\x1B[?2026h";
247
+ var SYNC_END = "\x1B[?2026l";
248
+ function overwrite(lines, columns) {
249
+ return lines.map((line) => textWidth(line) % columns === 0 ? `\x1B[2K${line}` : `${line}\x1B[K`).join(`
250
+ `);
251
+ }
252
+ function rowsTaken(lines, columns) {
253
+ return lines.reduce((rows, line) => rows + Math.max(1, Math.ceil(textWidth(line) / columns)), 0);
254
+ }
255
+
256
+ // ../kit/src/prompt.ts
257
+ var PROMPT_KEYS = new Set(["up", "down", "pageup", "pagedown", "home", "end", "enter", "cancel", "suspend", "tab"]);
258
+ var MAX_LISTED = 12;
259
+ function readKeys(input, paste = { active: false }) {
260
+ return parseKeys(input, paste).filter((key) => typeof key === "object" ? "text" in key : PROMPT_KEYS.has(key) || isEditKey(key));
261
+ }
262
+ function roomAfter(question, columns) {
263
+ return Math.max(columns - textWidth(`? ${question} `) % columns - 1, 1);
264
+ }
265
+ function withCaret(colors, line, room, dim = false) {
266
+ const { before, at, after } = visible(line, room);
267
+ const tone = dim ? colors.dim : (text) => text;
268
+ return `${tone(before)}${at === undefined ? colors.dim("\u2588") : colors.inverse(at)}${tone(after)}`;
269
+ }
270
+ async function confirm(question, { default: fallback, ...settings } = {}) {
271
+ let answered = fallback;
272
+ const choices = { true: "Y/n", false: "y/N", undefined: "y/n" }[String(fallback)];
273
+ const accepted = await ask(question, settings, (colors, state) => [state === "asking" ? asking(colors, question, "", choices) : answer(colors, question, state, answered ? "yes" : "no")], (key) => {
274
+ if (key === "cancel")
275
+ return "cancel";
276
+ if (key === "enter")
277
+ return answered === undefined ? undefined : "enter";
278
+ const letter = typeof key === "object" ? key.text.toLowerCase() : "";
279
+ if (letter !== "y" && letter !== "n")
280
+ return;
281
+ answered = letter === "y";
282
+ return "enter";
283
+ });
284
+ return accepted ? answered : undefined;
285
+ }
286
+ function sharedStart(texts) {
287
+ const [first = [], ...rest] = texts.map((text) => [...text]);
288
+ let length = first.length;
289
+ for (const chars of rest) {
290
+ const differs = chars.findIndex((char, index) => char !== first[index]);
291
+ length = Math.min(length, differs === -1 ? chars.length : differs);
292
+ }
293
+ return first.slice(0, length).join("");
294
+ }
295
+ function listed(colors, found, columns) {
296
+ const shared = sharedStart(found);
297
+ const cut = Math.max(shared.lastIndexOf("/"), shared.lastIndexOf(" ")) + 1;
298
+ const names = found.slice(0, MAX_LISTED).map((each) => each.slice(cut));
299
+ const more = found.length > MAX_LISTED ? ` \u2026 ${found.length - MAX_LISTED} more` : "";
300
+ return ` ${colors.dim(truncate(names.join(" ") + more, Math.max(columns - 3, 1)))}`;
301
+ }
302
+ async function input(question, { default: fallback, mask = false, validate, history, complete, ...settings } = {}) {
303
+ let line = { text: "", caret: 0 };
304
+ let invalid;
305
+ let completions = [];
306
+ const remembered = history === undefined || mask ? undefined : history;
307
+ const earlier = remembered === undefined ? [] : earlierAnswers(remembered);
308
+ let recalled = -1;
309
+ let draft = line;
310
+ const taken = () => line.text === "" ? fallback ?? "" : line.text;
311
+ const shown = () => mask ? "*".repeat([...taken()].length) : taken();
312
+ const accepted = await ask(question, settings, (colors, state, { columns }) => {
313
+ if (state !== "asking")
314
+ return [answer(colors, question, state, shown())];
315
+ const typed = line.text === "" ? { text: shown(), caret: [...shown()].length } : { text: shown(), caret: line.caret };
316
+ return [`${colors.cyan("?")} ${question} ${withCaret(colors, typed, roomAfter(question, columns), line.text === "")}`, ...invalid === undefined ? [] : [` ${colors.red(invalid)}`], ...completions.length > 1 ? [listed(colors, completions, columns)] : []];
317
+ }, (key) => {
318
+ if (key === "cancel")
319
+ return "cancel";
320
+ invalid = undefined;
321
+ completions = [];
322
+ if (line.chained === true && endsKills(key))
323
+ line = { ...line, chained: false };
324
+ if (key === "tab") {
325
+ const chars = [...line.text];
326
+ const before = chars.slice(0, line.caret).join("");
327
+ const found = complete?.(before) ?? [];
328
+ const filled = sharedStart(found);
329
+ if ([...filled].length > [...before].length)
330
+ line = { ...line, text: filled + chars.slice(line.caret).join(""), caret: [...filled].length };
331
+ else
332
+ completions = found;
333
+ return;
334
+ }
335
+ if (key === "enter") {
336
+ invalid = validate?.(taken());
337
+ return invalid === undefined ? "enter" : undefined;
338
+ }
339
+ if (key === "up" || key === "down") {
340
+ const to = Math.min(Math.max(recalled + (key === "up" ? 1 : -1), -1), earlier.length - 1);
341
+ if (recalled === -1)
342
+ draft = line;
343
+ recalled = to;
344
+ const shown = to === -1 ? draft : { text: earlier[to], caret: [...earlier[to]].length };
345
+ line = { ...shown, killed: line.killed ?? "" };
346
+ return;
347
+ }
348
+ const edit = { home: "linestart", end: "lineend" }[key] ?? key;
349
+ if (typeof edit === "object" || isEditKey(edit))
350
+ line = editLine(line, edit);
351
+ return;
352
+ });
353
+ if (!accepted)
354
+ return;
355
+ if (remembered !== undefined && taken() !== "")
356
+ rememberAnswer(remembered, taken());
357
+ return taken();
358
+ }
359
+ function asking(colors, question, typed, keys) {
360
+ return `${colors.cyan("?")} ${question} ${typed === "" ? colors.dim(`(${keys})`) : typed}`;
361
+ }
362
+ function answer(colors, question, state, picked) {
363
+ return state === "enter" ? `${colors.green("\u2713")} ${question} ${colors.cyan(picked)}` : `${colors.red("\u2717")} ${question} ${colors.dim("cancelled")}`;
364
+ }
365
+ async function ask(question, { hint, terminal = process2 }, render, press) {
366
+ const { stdin, stderr } = terminal;
367
+ if (!isInteractive(terminal))
368
+ fail(`cannot ask "${question}" off a terminal`, 2, hint);
369
+ const colors = paint(stderr);
370
+ let current = "asking";
371
+ let outcome;
372
+ const columns = () => stderr.columns || 80;
373
+ const draw = (state, last = false) => {
374
+ const frame = render(colors, state, { columns: columns(), rows: stderr.rows || 24 });
375
+ const rows = rowsTaken(frame, columns());
376
+ stderr.write(`${SYNC_START}\r${overwrite(frame, columns())}\x1B[0J${last || rows < 2 ? "" : `\x1B[${rows - 1}A`}${last ? "" : "\r"}${SYNC_END}`);
377
+ current = state;
378
+ };
379
+ const redraw = () => draw(current);
380
+ const paste = { active: false };
381
+ const stop = terminal.stop ?? (terminal === process2 ? stopJob : undefined);
382
+ const suspend = () => {
383
+ if (stop === undefined)
384
+ return;
385
+ stderr.write("\x1B[0J\x1B[?25h\x1B[?2004l");
386
+ stdin.setRawMode(false);
387
+ stop();
388
+ stdin.setRawMode(true);
389
+ stderr.write("\x1B[?25l\x1B[?2004h");
390
+ };
391
+ try {
392
+ stderr.on?.("resize", redraw);
393
+ stdin.setRawMode(true);
394
+ stdin.resume();
395
+ stderr.write("\x1B[?25l\x1B[?2004h");
396
+ draw("asking");
397
+ return await new Promise((resolve) => {
398
+ function onData(data) {
399
+ for (const key of readKeys(data.toString(), paste)) {
400
+ if (key === "suspend") {
401
+ suspend();
402
+ continue;
403
+ }
404
+ const pressed = press(key);
405
+ if (pressed !== undefined) {
406
+ settle(pressed);
407
+ return;
408
+ }
409
+ }
410
+ draw("asking");
411
+ }
412
+ function onEnd() {
413
+ settle("cancel");
414
+ }
415
+ function settle(settled) {
416
+ outcome = settled;
417
+ stdin.off("data", onData);
418
+ stdin.off("end", onEnd);
419
+ resolve(settled === "enter");
420
+ }
421
+ stdin.on("data", onData);
422
+ stdin.on("end", onEnd);
423
+ });
424
+ } finally {
425
+ stderr.off?.("resize", redraw);
426
+ draw(outcome ?? "cancel", true);
427
+ stderr.write(`
428
+ \x1B[?25h\x1B[?2004l`);
429
+ stdin.setRawMode(false);
430
+ stdin.pause();
431
+ }
432
+ }
433
+ export {
434
+ confirm,
435
+ input
436
+ };
@@ -0,0 +1,17 @@
1
+ // @bun
2
+ import {
3
+ leftBehind2,
4
+ describeLeftBehind2,
5
+ pruneRegistrations2,
6
+ removeQueues2
7
+ } from "./cli-n5rt07v7.js";
8
+ import"./cli-dmzvmpge.js";
9
+ import"./cli-kek450vq.js";
10
+ import"./cli-1nyesy1b.js";
11
+ import"./cli-k4471y24.js";
12
+ export {
13
+ describeLeftBehind2 as describeLeftBehind,
14
+ leftBehind2 as leftBehind,
15
+ pruneRegistrations2 as pruneRegistrations,
16
+ removeQueues2 as removeQueues
17
+ };
@@ -0,0 +1,18 @@
1
+ // @bun
2
+ import {
3
+ forgetTestDatabases2,
4
+ runTask2,
5
+ runsDir2,
6
+ runHeavy2
7
+ } from "./cli-0gbs87r4.js";
8
+ import"./cli-j82fak6j.js";
9
+ import"./cli-dmkfxdbr.js";
10
+ import"./cli-kek450vq.js";
11
+ import"./cli-1nyesy1b.js";
12
+ import"./cli-k4471y24.js";
13
+ export {
14
+ forgetTestDatabases2 as forgetTestDatabases,
15
+ runHeavy2 as runHeavy,
16
+ runTask2 as runTask,
17
+ runsDir2 as runsDir
18
+ };
@@ -0,0 +1,55 @@
1
+ // @bun
2
+ import"./cli-k4471y24.js";
3
+ import {
4
+ completionScript,
5
+ KnownError
6
+ } from "./cli-1nyesy1b.js";
7
+
8
+ // src/shell.ts
9
+ var FISH = `function wt --description 'git worktrees of a compose project, each with its own stack'
10
+ switch "$argv[1]"
11
+ case cd
12
+ set -l dir (command wt path $argv[2..-1]); or return
13
+ builtin cd $dir
14
+ case rm
15
+ set -l main (command wt path 2>/dev/null)
16
+ command wt $argv
17
+ set -l code $status
18
+ test -d $PWD; or builtin cd $main
19
+ return $code
20
+ case '*'
21
+ command wt $argv
22
+ end
23
+ end`;
24
+ var POSIX = `wt() {
25
+ case "$1" in
26
+ cd)
27
+ local dir
28
+ dir=$(command wt path "\${@:2}") || return
29
+ builtin cd "$dir"
30
+ ;;
31
+ rm)
32
+ local main code
33
+ main=$(command wt path 2>/dev/null)
34
+ command wt "$@"
35
+ code=$?
36
+ [ -d "$PWD" ] || builtin cd "$main"
37
+ return $code
38
+ ;;
39
+ *)
40
+ command wt "$@"
41
+ ;;
42
+ esac
43
+ }`;
44
+ var WRAPPERS = { fish: [FISH, "fish"], bash: [POSIX, "bash"], zsh: [POSIX, "zsh"] };
45
+ var WRAPPED_SHELLS = Object.keys(WRAPPERS);
46
+ function shellWrapper(shell) {
47
+ const found = shell === undefined ? undefined : WRAPPERS[shell];
48
+ if (found === undefined)
49
+ throw new KnownError(`no wrapper for ${shell ?? "that shell"}, only ${WRAPPED_SHELLS.join(", ")}`);
50
+ return `${found[0]}
51
+ ${completionScript(found[1], ["wt"], `# Completion, as \`wt --completions ${found[1]}\` prints it`)}`;
52
+ }
53
+ export {
54
+ shellWrapper
55
+ };
@@ -0,0 +1,20 @@
1
+ // @bun
2
+ import {
3
+ stackUp2,
4
+ stackDown2,
5
+ followLogs2,
6
+ afterRemove2,
7
+ hasContainers2
8
+ } from "./cli-6ybxw5sc.js";
9
+ import"./cli-pkvw2k4x.js";
10
+ import"./cli-dmkfxdbr.js";
11
+ import"./cli-kek450vq.js";
12
+ import"./cli-1nyesy1b.js";
13
+ import"./cli-k4471y24.js";
14
+ export {
15
+ afterRemove2 as afterRemove,
16
+ followLogs2 as followLogs,
17
+ hasContainers2 as hasContainers,
18
+ stackDown2 as stackDown,
19
+ stackUp2 as stackUp
20
+ };
@@ -0,0 +1,13 @@
1
+ // @bun
2
+ import {
3
+ assertTools2,
4
+ doctor2
5
+ } from "./cli-w4w36hng.js";
6
+ import"./cli-pkvw2k4x.js";
7
+ import"./cli-kek450vq.js";
8
+ import"./cli-1nyesy1b.js";
9
+ import"./cli-k4471y24.js";
10
+ export {
11
+ assertTools2 as assertTools,
12
+ doctor2 as doctor
13
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kaynooo/cli-wt",
3
3
  "type": "module",
4
- "version": "0.1.2",
4
+ "version": "0.1.7",
5
5
  "description": "wt: git worktrees of a compose project, each with its own stack, data and <task>.<host> subdomains beside main.",
6
6
  "author": "Kaynooo <contact@kaynooo.fr>",
7
7
  "license": "MIT",
@@ -27,13 +27,13 @@
27
27
  "registry": "https://git.kaynooo.fr/api/packages/kaynooo/npm/"
28
28
  },
29
29
  "scripts": {
30
- "build": "$npm_execpath build src/cli.ts --target bun --outdir dist",
30
+ "build": "rm -rf dist && $npm_execpath build src/cli.ts --target bun --splitting --outdir dist",
31
31
  "wt": "$npm_execpath src/cli.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@kaynooo/cli-env": "0.14.1",
35
- "@kaynooo/cli-kit": "0.41.0",
36
- "@kaynooo/devproxy": "0.2.0",
37
- "@kaynooo/utils": "3.0.0"
34
+ "@kaynooo/cli-env": "0.15.2",
35
+ "@kaynooo/cli-kit": "0.46.1",
36
+ "@kaynooo/devproxy": "0.2.1",
37
+ "@kaynooo/utils": "3.1.0"
38
38
  }
39
39
  }