@kaynooo/cli-doctor 0.11.0 → 0.12.0
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/dist/cli-bin.js +81 -17
- package/dist/cli.js +73 -7
- package/package.json +2 -2
package/dist/cli-bin.js
CHANGED
|
@@ -1479,6 +1479,28 @@ var BASH_FUNCTION = `__kaynooo_cli_complete() {
|
|
|
1479
1479
|
done
|
|
1480
1480
|
COMPREPLY+=($(compgen -W "$words" -- "$cur"))
|
|
1481
1481
|
}`;
|
|
1482
|
+
var ZSH_FUNCTION = `__kaynooo_cli_complete() {
|
|
1483
|
+
local line
|
|
1484
|
+
local -a described plain
|
|
1485
|
+
for line in \${(f)"$("\${words[1]}" __complete "\${(@)words[2,CURRENT]}" 2>/dev/null)"}; do
|
|
1486
|
+
if [[ $line == __files__ ]]; then
|
|
1487
|
+
_files
|
|
1488
|
+
elif [[ $line == *$'\\t'* ]]; then
|
|
1489
|
+
described+=("\${\${line%%$'\\t'*}//:/\\\\:}:\${line#*$'\\t'}")
|
|
1490
|
+
else
|
|
1491
|
+
plain+=("$line")
|
|
1492
|
+
fi
|
|
1493
|
+
done
|
|
1494
|
+
(( \${#described} )) && _describe -V value described
|
|
1495
|
+
(( \${#plain} )) && compadd -- "\${plain[@]}"
|
|
1496
|
+
return 0
|
|
1497
|
+
}`;
|
|
1498
|
+
function zshScript(bins) {
|
|
1499
|
+
return `# Generated by \`cli completions zsh\`
|
|
1500
|
+
${ZSH_FUNCTION}
|
|
1501
|
+
compdef __kaynooo_cli_complete ${bins.join(" ")}
|
|
1502
|
+
`;
|
|
1503
|
+
}
|
|
1482
1504
|
function bashScript(bins) {
|
|
1483
1505
|
return `# Generated by \`cli completions bash\`
|
|
1484
1506
|
${BASH_FUNCTION}
|
|
@@ -1577,15 +1599,49 @@ import process16 from "process";
|
|
|
1577
1599
|
|
|
1578
1600
|
// ../kit/src/prompt.ts
|
|
1579
1601
|
import process15 from "process";
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
var
|
|
1583
|
-
var
|
|
1602
|
+
|
|
1603
|
+
// ../kit/src/picker/score.ts
|
|
1604
|
+
var BOUNDARY_AFTER = new Set([" ", "/", "-", "_", ".", ":", "\\", "(", "[", ",", "\t"]);
|
|
1605
|
+
var NONE = Number.NEGATIVE_INFINITY;
|
|
1606
|
+
|
|
1607
|
+
// ../kit/src/picker/state.ts
|
|
1608
|
+
var IS_CONTROL = /[\x00-\x1F\x7F-\x9F]/;
|
|
1584
1609
|
var PASTE_START = "\x1B[200~";
|
|
1585
1610
|
var PASTE_END = "\x1B[201~";
|
|
1586
|
-
var
|
|
1587
|
-
|
|
1611
|
+
var KEY_SEQUENCES = /\x1B\[[0-9;]*[A-Z~]|\x1BO[A-Z]|\x1B[\s\S]|[\s\S]/gu;
|
|
1612
|
+
var KEYS = {
|
|
1613
|
+
"\x1B[A": "up",
|
|
1614
|
+
"\x1BOA": "up",
|
|
1615
|
+
"\x10": "up",
|
|
1616
|
+
"\x1B[B": "down",
|
|
1617
|
+
"\x1BOB": "down",
|
|
1618
|
+
"\x0E": "down",
|
|
1619
|
+
"\x1B[5~": "pageup",
|
|
1620
|
+
"\x1B[6~": "pagedown",
|
|
1621
|
+
"\x1B[H": "home",
|
|
1622
|
+
"\x1B[1~": "home",
|
|
1623
|
+
"\x1BOH": "home",
|
|
1624
|
+
"\x1B[F": "end",
|
|
1625
|
+
"\x1B[4~": "end",
|
|
1626
|
+
"\x1BOF": "end",
|
|
1627
|
+
"\r": "enter",
|
|
1628
|
+
"\n": "enter",
|
|
1629
|
+
"\x03": "cancel",
|
|
1630
|
+
"\x1B": "cancel",
|
|
1631
|
+
"\x7F": "erase",
|
|
1632
|
+
"\b": "erase",
|
|
1633
|
+
"\x15": "clear",
|
|
1634
|
+
"\x17": "word",
|
|
1635
|
+
"\t": "tab",
|
|
1636
|
+
"\x1F": "help",
|
|
1637
|
+
"\x1BOP": "help",
|
|
1638
|
+
"\x1B[11~": "help"
|
|
1639
|
+
};
|
|
1640
|
+
function parseKeys(input, paste = { active: false }, ctrls = []) {
|
|
1641
|
+
const codes = new Map(ctrls.map((name) => [String.fromCharCode(name.codePointAt(name.length - 1) - 96), name]));
|
|
1588
1642
|
return (input.match(KEY_SEQUENCES) ?? []).flatMap((sequence) => {
|
|
1643
|
+
const named = codes.get(sequence);
|
|
1644
|
+
const key = named === undefined ? KEYS[sequence] : { ctrl: named };
|
|
1589
1645
|
if (sequence === PASTE_START || sequence === PASTE_END) {
|
|
1590
1646
|
paste.active = sequence === PASTE_START;
|
|
1591
1647
|
return [];
|
|
@@ -1593,9 +1649,19 @@ function readKeys(input, paste = { active: false }) {
|
|
|
1593
1649
|
if (paste.active && (sequence === "\r" || sequence === `
|
|
1594
1650
|
`))
|
|
1595
1651
|
return [];
|
|
1596
|
-
|
|
1652
|
+
if (key !== undefined)
|
|
1653
|
+
return [key];
|
|
1654
|
+
return IS_CONTROL.test(sequence) || sequence.startsWith("\x1B") ? [] : [{ text: sequence }];
|
|
1597
1655
|
});
|
|
1598
1656
|
}
|
|
1657
|
+
|
|
1658
|
+
// ../kit/src/prompt.ts
|
|
1659
|
+
var WORDS = /\s+/;
|
|
1660
|
+
var MAX_ROWS = 10;
|
|
1661
|
+
var PROMPT_KEYS = new Set(["up", "down", "pageup", "pagedown", "home", "end", "enter", "cancel", "erase"]);
|
|
1662
|
+
function readKeys(input, paste = { active: false }) {
|
|
1663
|
+
return parseKeys(input, paste).filter((key) => typeof key === "object" ? "text" in key : PROMPT_KEYS.has(key));
|
|
1664
|
+
}
|
|
1599
1665
|
function flip(checked, value) {
|
|
1600
1666
|
const next = new Set(checked);
|
|
1601
1667
|
if (!next.delete(value))
|
|
@@ -2073,26 +2139,24 @@ async function list(args, host = hostHere()) {
|
|
|
2073
2139
|
print2(listed);
|
|
2074
2140
|
return 0;
|
|
2075
2141
|
}
|
|
2076
|
-
var COMPLETIONS_USAGE = `cli completions <fish|bash> [--install] [--dir <folder>]: shell completions for every installed bin of the @kaynooo/cli-* packages
|
|
2142
|
+
var COMPLETIONS_USAGE = `cli completions <fish|bash|zsh> [--install] [--dir <folder>]: shell completions for every installed bin of the @kaynooo/cli-* packages
|
|
2077
2143
|
|
|
2078
2144
|
Each bin completes itself through \`<bin> __complete\`; this writes the glue a shell needs per bin.
|
|
2079
2145
|
fish: without --install the files print on stdout, with it they go to ~/.cache/fish/kaynooo-cli (or $XDG_CACHE_HOME), one <bin>.fish each, the stale ones this command wrote taken out. That folder has to be in fish_complete_path, first so a completion fish ships for the same name does not win: \`set -p fish_complete_path ~/.cache/fish/kaynooo-cli\`.
|
|
2080
2146
|
bash: one script on stdout, sourced from ~/.bashrc with \`source <(cli completions bash)\`; --install and --dir are fish's.
|
|
2081
|
-
zsh:
|
|
2147
|
+
zsh: one script on stdout like bash's, after compinit in ~/.zshrc: \`autoload -U +X compinit && compinit\`, then \`source <(cli completions zsh)\` (written without zsh at hand to run it, so untested).`;
|
|
2082
2148
|
var COMPLETIONS_OPTIONS = {
|
|
2083
2149
|
install: { type: "boolean", description: "write the files to the folder instead of printing them" },
|
|
2084
2150
|
dir: { type: "string", short: "d", description: "the folder to write to, instead of ~/.cache/fish/kaynooo-cli" }
|
|
2085
2151
|
};
|
|
2086
2152
|
async function completions(args, host = hostHere()) {
|
|
2087
|
-
const { values, positionals } = parse(args, COMPLETIONS_USAGE, COMPLETIONS_OPTIONS, { positionals: ["<shell>"], exits: [[0, "it printed or wrote them"], [2, "a usage error or a shell without a script"]], candidates: { "<shell>": () => ["fish", "bash"] }, examples: ["cli completions fish", ["cli completions fish --install", "write one file per bin"], ["source <(cli completions bash)", "in ~/.bashrc"]] });
|
|
2088
|
-
if (positionals[0]
|
|
2089
|
-
badUsage("
|
|
2090
|
-
if (positionals[0]
|
|
2091
|
-
badUsage("completions exist for fish and bash: cli completions fish");
|
|
2092
|
-
if (positionals[0] === "bash") {
|
|
2153
|
+
const { values, positionals } = parse(args, COMPLETIONS_USAGE, COMPLETIONS_OPTIONS, { positionals: ["<shell>"], exits: [[0, "it printed or wrote them"], [2, "a usage error or a shell without a script"]], candidates: { "<shell>": () => ["fish", "bash", "zsh"] }, examples: ["cli completions fish", ["cli completions fish --install", "write one file per bin"], ["source <(cli completions bash)", "in ~/.bashrc"], ["source <(cli completions zsh)", "in ~/.zshrc after compinit"]] });
|
|
2154
|
+
if (positionals[0] !== "fish" && positionals[0] !== "bash" && positionals[0] !== "zsh")
|
|
2155
|
+
badUsage("completions exist for fish, bash and zsh: cli completions fish");
|
|
2156
|
+
if (positionals[0] === "bash" || positionals[0] === "zsh") {
|
|
2093
2157
|
if (values.install === true || values.dir !== undefined)
|
|
2094
|
-
badUsage(
|
|
2095
|
-
console.log(bashScript(installedBins(host)).trimEnd());
|
|
2158
|
+
badUsage(`--install and --dir are for fish: source the ${positionals[0]} script instead`);
|
|
2159
|
+
console.log((positionals[0] === "zsh" ? zshScript : bashScript)(installedBins(host)).trimEnd());
|
|
2096
2160
|
return 0;
|
|
2097
2161
|
}
|
|
2098
2162
|
if (values.install !== true) {
|
package/dist/cli.js
CHANGED
|
@@ -1317,6 +1317,28 @@ var BASH_FUNCTION = `__kaynooo_cli_complete() {
|
|
|
1317
1317
|
done
|
|
1318
1318
|
COMPREPLY+=($(compgen -W "$words" -- "$cur"))
|
|
1319
1319
|
}`;
|
|
1320
|
+
var ZSH_FUNCTION = `__kaynooo_cli_complete() {
|
|
1321
|
+
local line
|
|
1322
|
+
local -a described plain
|
|
1323
|
+
for line in \${(f)"$("\${words[1]}" __complete "\${(@)words[2,CURRENT]}" 2>/dev/null)"}; do
|
|
1324
|
+
if [[ $line == __files__ ]]; then
|
|
1325
|
+
_files
|
|
1326
|
+
elif [[ $line == *$'\\t'* ]]; then
|
|
1327
|
+
described+=("\${\${line%%$'\\t'*}//:/\\\\:}:\${line#*$'\\t'}")
|
|
1328
|
+
else
|
|
1329
|
+
plain+=("$line")
|
|
1330
|
+
fi
|
|
1331
|
+
done
|
|
1332
|
+
(( \${#described} )) && _describe -V value described
|
|
1333
|
+
(( \${#plain} )) && compadd -- "\${plain[@]}"
|
|
1334
|
+
return 0
|
|
1335
|
+
}`;
|
|
1336
|
+
function zshScript(bins) {
|
|
1337
|
+
return `# Generated by \`cli completions zsh\`
|
|
1338
|
+
${ZSH_FUNCTION}
|
|
1339
|
+
compdef __kaynooo_cli_complete ${bins.join(" ")}
|
|
1340
|
+
`;
|
|
1341
|
+
}
|
|
1320
1342
|
function bashScript(bins) {
|
|
1321
1343
|
return `# Generated by \`cli completions bash\`
|
|
1322
1344
|
${BASH_FUNCTION}
|
|
@@ -1575,15 +1597,49 @@ import process16 from "process";
|
|
|
1575
1597
|
|
|
1576
1598
|
// ../kit/src/prompt.ts
|
|
1577
1599
|
import process15 from "process";
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
var
|
|
1581
|
-
var
|
|
1600
|
+
|
|
1601
|
+
// ../kit/src/picker/score.ts
|
|
1602
|
+
var BOUNDARY_AFTER = new Set([" ", "/", "-", "_", ".", ":", "\\", "(", "[", ",", "\t"]);
|
|
1603
|
+
var NONE = Number.NEGATIVE_INFINITY;
|
|
1604
|
+
|
|
1605
|
+
// ../kit/src/picker/state.ts
|
|
1606
|
+
var IS_CONTROL = /[\x00-\x1F\x7F-\x9F]/;
|
|
1582
1607
|
var PASTE_START = "\x1B[200~";
|
|
1583
1608
|
var PASTE_END = "\x1B[201~";
|
|
1584
|
-
var
|
|
1585
|
-
|
|
1609
|
+
var KEY_SEQUENCES = /\x1B\[[0-9;]*[A-Z~]|\x1BO[A-Z]|\x1B[\s\S]|[\s\S]/gu;
|
|
1610
|
+
var KEYS = {
|
|
1611
|
+
"\x1B[A": "up",
|
|
1612
|
+
"\x1BOA": "up",
|
|
1613
|
+
"\x10": "up",
|
|
1614
|
+
"\x1B[B": "down",
|
|
1615
|
+
"\x1BOB": "down",
|
|
1616
|
+
"\x0E": "down",
|
|
1617
|
+
"\x1B[5~": "pageup",
|
|
1618
|
+
"\x1B[6~": "pagedown",
|
|
1619
|
+
"\x1B[H": "home",
|
|
1620
|
+
"\x1B[1~": "home",
|
|
1621
|
+
"\x1BOH": "home",
|
|
1622
|
+
"\x1B[F": "end",
|
|
1623
|
+
"\x1B[4~": "end",
|
|
1624
|
+
"\x1BOF": "end",
|
|
1625
|
+
"\r": "enter",
|
|
1626
|
+
"\n": "enter",
|
|
1627
|
+
"\x03": "cancel",
|
|
1628
|
+
"\x1B": "cancel",
|
|
1629
|
+
"\x7F": "erase",
|
|
1630
|
+
"\b": "erase",
|
|
1631
|
+
"\x15": "clear",
|
|
1632
|
+
"\x17": "word",
|
|
1633
|
+
"\t": "tab",
|
|
1634
|
+
"\x1F": "help",
|
|
1635
|
+
"\x1BOP": "help",
|
|
1636
|
+
"\x1B[11~": "help"
|
|
1637
|
+
};
|
|
1638
|
+
function parseKeys(input, paste = { active: false }, ctrls = []) {
|
|
1639
|
+
const codes = new Map(ctrls.map((name) => [String.fromCharCode(name.codePointAt(name.length - 1) - 96), name]));
|
|
1586
1640
|
return (input.match(KEY_SEQUENCES) ?? []).flatMap((sequence) => {
|
|
1641
|
+
const named = codes.get(sequence);
|
|
1642
|
+
const key = named === undefined ? KEYS[sequence] : { ctrl: named };
|
|
1587
1643
|
if (sequence === PASTE_START || sequence === PASTE_END) {
|
|
1588
1644
|
paste.active = sequence === PASTE_START;
|
|
1589
1645
|
return [];
|
|
@@ -1591,9 +1647,19 @@ function readKeys(input, paste = { active: false }) {
|
|
|
1591
1647
|
if (paste.active && (sequence === "\r" || sequence === `
|
|
1592
1648
|
`))
|
|
1593
1649
|
return [];
|
|
1594
|
-
|
|
1650
|
+
if (key !== undefined)
|
|
1651
|
+
return [key];
|
|
1652
|
+
return IS_CONTROL.test(sequence) || sequence.startsWith("\x1B") ? [] : [{ text: sequence }];
|
|
1595
1653
|
});
|
|
1596
1654
|
}
|
|
1655
|
+
|
|
1656
|
+
// ../kit/src/prompt.ts
|
|
1657
|
+
var WORDS = /\s+/;
|
|
1658
|
+
var MAX_ROWS = 10;
|
|
1659
|
+
var PROMPT_KEYS = new Set(["up", "down", "pageup", "pagedown", "home", "end", "enter", "cancel", "erase"]);
|
|
1660
|
+
function readKeys(input, paste = { active: false }) {
|
|
1661
|
+
return parseKeys(input, paste).filter((key) => typeof key === "object" ? "text" in key : PROMPT_KEYS.has(key));
|
|
1662
|
+
}
|
|
1597
1663
|
function flip(checked, value) {
|
|
1598
1664
|
const next = new Set(checked);
|
|
1599
1665
|
if (!next.delete(value))
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-doctor",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.12.0",
|
|
5
5
|
"description": "doctor: checks the @kaynooo/cli-* install of a host: each bin's version against the registry, tea's login to Forgejo, the Claude Code hooks and the Bun floor; cli list: every bin in one line, read from its own help.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
"doctor": "$npm_execpath src/cli.ts"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@kaynooo/cli-kit": "0.
|
|
40
|
+
"@kaynooo/cli-kit": "0.25.0"
|
|
41
41
|
}
|
|
42
42
|
}
|