@krapht/ork 1.0.0-alpha.2 → 1.0.0-alpha.21
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 +12 -7
- package/dist/__build_info__-0wqQ-rtf.mjs +180 -0
- package/dist/apply-Mb0fNpCX.mjs +17 -0
- package/dist/argument-error-CihH46Le.mjs +27 -0
- package/dist/attach-C0-YyNoY.mjs +92 -0
- package/dist/attach-CAKNqnUK.mjs +1259 -0
- package/dist/bin.mjs +1885 -1609
- package/dist/brief-C2hew8cS.mjs +116 -0
- package/dist/{decide-CGyx9rv7.mjs → builtin-files-YYAnbZGD.mjs} +3 -51
- package/dist/chips-CP_pgKlj.mjs +48 -0
- package/dist/command-tree-CEkzWNy6.mjs +63 -0
- package/dist/{completion-CSU5vkEt.mjs → completion-K4rAVsrf.mjs} +200 -30
- package/dist/context-B-fjPJky.mjs +106 -0
- package/dist/context-DMK0U1w0.mjs +160 -0
- package/dist/detached-q0AYG0Bs.mjs +39 -0
- package/dist/extra-arguments-BxQMXARO.mjs +13 -0
- package/dist/{find-D6Gj1sxg.mjs → find-Ct5CNl1J.mjs} +2 -2
- package/dist/flags-C90N4J1i.mjs +145 -0
- package/dist/follow-ups-D3HPyNYM.mjs +568 -0
- package/dist/format-CiPhQqbX.mjs +260 -0
- package/dist/{help-groups-BwYoAWsh.mjs → help-groups-BQvcKQ9H.mjs} +49 -78
- package/dist/in-a-run-D_wg4iJi.mjs +27 -0
- package/dist/install-Hji6LIei.mjs +259 -0
- package/dist/{limits-B1-DYc3d.mjs → limits-BD6RZRCS.mjs} +2 -2
- package/dist/{mcp-DE_EmyVm.mjs → mcp-CpbDmBLG.mjs} +6 -6
- package/dist/once-J8Qn5fTG.mjs +112 -0
- package/dist/orphan-guard-BFKg8VSd.mjs +58 -0
- package/dist/output-DXZbnFt_.mjs +458 -0
- package/dist/outputs-text-CNTJ7Qq_.mjs +19 -0
- package/dist/{pause-CL6N_Xrj.mjs → pause-Cl4ZYA35.mjs} +7 -4
- package/dist/print-DzugGZQB.mjs +19 -0
- package/dist/project-records-CtkmlsHN.mjs +233 -0
- package/dist/refusals-DQQX3AIb.mjs +116 -0
- package/dist/{relay-0SD0erwf.mjs → relay-CiP77vga.mjs} +2 -2
- package/dist/run-CtuNY3mE.mjs +234 -0
- package/dist/send-DRYGks8K.mjs +104 -0
- package/dist/short-flags-DkJLWVqh.mjs +1 -0
- package/dist/short-flags-Qf21as0E.mjs +83 -0
- package/dist/src-BMFQKHz4.mjs +3122 -0
- package/dist/{src-BbyEoMn4.mjs → src-BrFfDKux.mjs} +800 -235
- package/dist/{src-Dujmvv4s.mjs → src-BuF9Lbow.mjs} +12580 -5505
- package/dist/{src-DOcK8Jfp.mjs → src-k0A_QpST.mjs} +1024 -590
- package/dist/store-rTgRu8xy.mjs +25 -0
- package/dist/ui/THIRD_PARTY_LICENSES.txt +612 -0
- package/dist/ui/assets/app-BYxpKJRh.css +1 -0
- package/dist/ui/assets/app-SEFEJLkF.js +112 -0
- package/dist/ui/assets/{index-9dFha9Qn.js → index-Cb6Voq_W.js} +3 -3
- package/dist/ui/assets/theme-CdXvqTQ6.js +1 -0
- package/dist/ui/index.html +2 -2
- package/dist/{ui-CTmO2Xzu.mjs → ui-C2f37TSb.mjs} +57 -25
- package/dist/usage-BuvGcQSk.mjs +256 -0
- package/dist/validate-ObP5lt29.mjs +1 -0
- package/dist/validate-_HjACtk9.mjs +632 -0
- package/dist/verdict-B592j1W3.mjs +84 -0
- package/dist/{watch-CtbgDAcz.mjs → watch-DV3ixCYj.mjs} +45 -17
- package/dist/{workflows-D1_WVukk.mjs → workflows-QLjBhGNS.mjs} +30 -5
- package/dist/worktrees-D3ubG_Qw.mjs +302 -0
- package/dist/yolo-BSH1E_kE.mjs +33 -0
- package/package.json +10 -8
- package/dist/__build_info__-fy6L1Mrd.mjs +0 -615
- package/dist/clean-DaHjs__2.mjs +0 -88
- package/dist/context-DT8MfEIR.mjs +0 -274
- package/dist/format-Dnfv8zMT.mjs +0 -427
- package/dist/in-a-run-pLAZeNys.mjs +0 -22
- package/dist/list-BrH8KRSJ.mjs +0 -110
- package/dist/output-BLQWD6MJ.mjs +0 -950
- package/dist/remove-BeGdqroy.mjs +0 -194
- package/dist/report-DK4LGqwF.mjs +0 -129
- package/dist/send-C8tunWhv.mjs +0 -163
- package/dist/src-CCUKRX51.mjs +0 -1204
- package/dist/ui/assets/app-BNT0SuIz.css +0 -1
- package/dist/ui/assets/app-T7wVAhgx.js +0 -67
- package/dist/ui/assets/theme-3xH5jxKs.js +0 -1
- package/dist/usage-DYUmP0i4.mjs +0 -419
- package/dist/worktrees-DdMYoNOC.mjs +0 -212
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { a as resolved } from "./command-tree-CEkzWNy6.mjs";
|
|
2
|
+
// src/short-flags.ts
|
|
3
|
+
/**
|
|
4
|
+
* Each flag's short form. A letter is given only where a well-known CLI uses it
|
|
5
|
+
* for the same thing (`tail -f`, `git commit -m`, `head -n`); `-h` and `-v` are
|
|
6
|
+
* help and version, and `-s` is no one's, as `--since`, `--status` and
|
|
7
|
+
* `--severity` would all want it.
|
|
8
|
+
*/
|
|
9
|
+
const SHORT_FLAGS = {
|
|
10
|
+
all: "a",
|
|
11
|
+
detach: "d",
|
|
12
|
+
follow: "f",
|
|
13
|
+
input: "i",
|
|
14
|
+
limit: "n",
|
|
15
|
+
message: "m",
|
|
16
|
+
output: "o",
|
|
17
|
+
project: "p",
|
|
18
|
+
yes: "y"
|
|
19
|
+
};
|
|
20
|
+
/** `def` with `short` first among its aliases. */
|
|
21
|
+
const withAlias = (def, short) => {
|
|
22
|
+
if (def.type === "positional") return def;
|
|
23
|
+
const given = "alias" in def ? [def.alias ?? []].flat() : [];
|
|
24
|
+
return {
|
|
25
|
+
...def,
|
|
26
|
+
alias: [short, ...given.filter((alias) => alias !== short)]
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
/** `args` with each flag's short form from {@link SHORT_FLAGS}. */
|
|
30
|
+
const shortFlagsOf = (args) => {
|
|
31
|
+
const out = { ...args };
|
|
32
|
+
for (const [name, def] of Object.entries(args)) {
|
|
33
|
+
const short = SHORT_FLAGS[name];
|
|
34
|
+
if (short !== void 0) Reflect.set(out, name, withAlias(def, short));
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
};
|
|
38
|
+
/** Each subcommand wrapped once, so `worktrees` and `wt` stay one command. */
|
|
39
|
+
const wrapped = /* @__PURE__ */ new WeakMap();
|
|
40
|
+
const wrappedOnce = (cmd) => {
|
|
41
|
+
const known = wrapped.get(cmd);
|
|
42
|
+
if (known !== void 0) return known;
|
|
43
|
+
const out = withShortFlags(cmd);
|
|
44
|
+
wrapped.set(cmd, out);
|
|
45
|
+
return out;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* `cmd` and every command under it, loaded on use or not, with their flags'
|
|
49
|
+
* short forms.
|
|
50
|
+
*/
|
|
51
|
+
const withShortFlags = (cmd) => {
|
|
52
|
+
const { args, subCommands } = cmd;
|
|
53
|
+
return {
|
|
54
|
+
...cmd,
|
|
55
|
+
...args === void 0 ? {} : { args: async () => shortFlagsOf(await resolved(args)) },
|
|
56
|
+
...subCommands === void 0 ? {} : { subCommands: async () => Object.fromEntries(Object.entries(await resolved(subCommands)).map(([name, sub]) => [name, async () => wrappedOnce(await resolved(sub))])) }
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
/** The spellings of the flag `--name` on a command line. */
|
|
60
|
+
const spellingsOf = (name) => {
|
|
61
|
+
const short = SHORT_FLAGS[name];
|
|
62
|
+
return short === void 0 ? [`--${name}`] : [`--${name}`, `-${short}`];
|
|
63
|
+
};
|
|
64
|
+
/** Whether `arg` is the flag `--name` (a boolean), in either spelling. */
|
|
65
|
+
const isFlag = (arg, name) => spellingsOf(name).includes(arg);
|
|
66
|
+
/**
|
|
67
|
+
* Every value given to the flag `--name` in `rawArgs`, in order: `--name v`,
|
|
68
|
+
* `--name=v`, `-x v` and `-x=v` for its short form `-x`.
|
|
69
|
+
*/
|
|
70
|
+
const flagValues = (rawArgs, name) => {
|
|
71
|
+
const spellings = spellingsOf(name);
|
|
72
|
+
const values = [];
|
|
73
|
+
for (const [index, arg] of rawArgs.entries()) {
|
|
74
|
+
const joined = spellings.find((flag) => arg.startsWith(`${flag}=`));
|
|
75
|
+
if (joined !== void 0) values.push(arg.slice(joined.length + 1));
|
|
76
|
+
else if (spellings.includes(arg)) {
|
|
77
|
+
const value = rawArgs[index + 1];
|
|
78
|
+
if (value !== void 0) values.push(value);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return values;
|
|
82
|
+
};
|
|
83
|
+
export { withShortFlags as a, shortFlagsOf as i, flagValues as n, isFlag as r, SHORT_FLAGS as t };
|