@kaynooo/cli-wait 0.12.0 → 0.12.2
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.js +81 -2
- package/dist/slot-cli.js +81 -2
- package/package.json +5 -5
package/dist/cli.js
CHANGED
|
@@ -617,7 +617,7 @@ class Completing {
|
|
|
617
617
|
}
|
|
618
618
|
var completion = { active: false };
|
|
619
619
|
var OUTPUT_OPTIONS = {
|
|
620
|
-
color: { type: "string", description: "auto (on a terminal alone
|
|
620
|
+
color: { type: "string", choices: ["auto", "always", "never"], description: "auto (the default) colours on a terminal alone" },
|
|
621
621
|
plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
|
|
622
622
|
};
|
|
623
623
|
function applyOutput(color, plain, env = process9.env) {
|
|
@@ -1083,6 +1083,66 @@ import { readFileSync as readFileSync4, realpathSync as realpathSync2 } from "fs
|
|
|
1083
1083
|
import { dirname as dirname3, join as join6 } from "path";
|
|
1084
1084
|
import process16 from "process";
|
|
1085
1085
|
|
|
1086
|
+
// ../kit/src/completions.ts
|
|
1087
|
+
var COMPLETION_SHELLS = ["fish", "bash", "zsh"];
|
|
1088
|
+
var FISH_FUNCTION = `functions -q __kaynooo_cli_complete; or function __kaynooo_cli_complete --argument-names bin --description 'what a @kaynooo/cli-kit bin offers for the word being typed'
|
|
1089
|
+
set -l tokens (commandline -xpc 2>/dev/null; or commandline -opc)
|
|
1090
|
+
set -l current (commandline -ct)
|
|
1091
|
+
for line in ($bin __complete $tokens[2..-1] $current 2>/dev/null)
|
|
1092
|
+
if test "$line" = __files__
|
|
1093
|
+
__fish_complete_path $current
|
|
1094
|
+
else
|
|
1095
|
+
echo $line
|
|
1096
|
+
end
|
|
1097
|
+
end
|
|
1098
|
+
end`;
|
|
1099
|
+
var BASH_FUNCTION = `__kaynooo_cli_complete() {
|
|
1100
|
+
local IFS=$'\\n' cur=\${COMP_WORDS[COMP_CWORD]} line words=
|
|
1101
|
+
local -a lines
|
|
1102
|
+
COMPREPLY=()
|
|
1103
|
+
lines=($("\${COMP_WORDS[0]}" __complete "\${COMP_WORDS[@]:1:COMP_CWORD}" 2>/dev/null))
|
|
1104
|
+
for line in "\${lines[@]}"; do
|
|
1105
|
+
if [[ $line == __files__ ]]; then
|
|
1106
|
+
COMPREPLY+=($(compgen -f -- "$cur"))
|
|
1107
|
+
else
|
|
1108
|
+
words+="\${line%%$'\\t'*}"$'\\n'
|
|
1109
|
+
fi
|
|
1110
|
+
done
|
|
1111
|
+
COMPREPLY+=($(compgen -W "$words" -- "$cur"))
|
|
1112
|
+
}`;
|
|
1113
|
+
var ZSH_FUNCTION = `__kaynooo_cli_complete() {
|
|
1114
|
+
local line
|
|
1115
|
+
local -a described plain
|
|
1116
|
+
for line in \${(f)"$("\${words[1]}" __complete "\${(@)words[2,CURRENT]}" 2>/dev/null)"}; do
|
|
1117
|
+
if [[ $line == __files__ ]]; then
|
|
1118
|
+
_files
|
|
1119
|
+
elif [[ $line == *$'\\t'* ]]; then
|
|
1120
|
+
described+=("\${\${line%%$'\\t'*}//:/\\\\:}:\${line#*$'\\t'}")
|
|
1121
|
+
else
|
|
1122
|
+
plain+=("$line")
|
|
1123
|
+
fi
|
|
1124
|
+
done
|
|
1125
|
+
(( \${#described} )) && _describe -V value described
|
|
1126
|
+
(( \${#plain} )) && compadd -- "\${plain[@]}"
|
|
1127
|
+
return 0
|
|
1128
|
+
}`;
|
|
1129
|
+
function completionScript(shell, bins, header = `# Generated by \`${bins[0]} --completions ${shell}\``) {
|
|
1130
|
+
if (shell === "fish")
|
|
1131
|
+
return `${header}
|
|
1132
|
+
${FISH_FUNCTION}
|
|
1133
|
+
${bins.map((bin) => `complete -c ${bin} -f -a '(__kaynooo_cli_complete ${bin})'
|
|
1134
|
+
`).join("")}`;
|
|
1135
|
+
if (shell === "bash")
|
|
1136
|
+
return `${header}
|
|
1137
|
+
${BASH_FUNCTION}
|
|
1138
|
+
complete -F __kaynooo_cli_complete ${bins.join(" ")}
|
|
1139
|
+
`;
|
|
1140
|
+
return `${header}
|
|
1141
|
+
${ZSH_FUNCTION}
|
|
1142
|
+
compdef __kaynooo_cli_complete ${bins.join(" ")}
|
|
1143
|
+
`;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1086
1146
|
// ../kit/src/notify.ts
|
|
1087
1147
|
import process13 from "process";
|
|
1088
1148
|
var NOTIFY_AFTER_MS = 1e4;
|
|
@@ -1180,7 +1240,11 @@ var LEVEL_OPTIONS = {
|
|
|
1180
1240
|
...OUTPUT_OPTIONS,
|
|
1181
1241
|
help: { type: "boolean", short: "h", description: "show this help" }
|
|
1182
1242
|
};
|
|
1183
|
-
var TOP_OPTIONS = {
|
|
1243
|
+
var TOP_OPTIONS = {
|
|
1244
|
+
...LEVEL_OPTIONS,
|
|
1245
|
+
version: { type: "boolean", short: "v", description: "print the version" },
|
|
1246
|
+
completions: { type: "string", choices: COMPLETION_SHELLS, description: "print the shell completion script" }
|
|
1247
|
+
};
|
|
1184
1248
|
function printError(prefix, message, hint, cause) {
|
|
1185
1249
|
const colors = paint(process16.stderr);
|
|
1186
1250
|
const styled = takesControlCodes(process16.stderr);
|
|
@@ -1260,6 +1324,19 @@ async function leafCandidates(run, words) {
|
|
|
1260
1324
|
const values = name === undefined ? undefined : await completing.candidates[name]?.(typed);
|
|
1261
1325
|
return values === undefined ? [FILES] : values.map(candidateLine);
|
|
1262
1326
|
}
|
|
1327
|
+
var COMPLETIONS = "--completions";
|
|
1328
|
+
function flagValue([flag = "", ...rest]) {
|
|
1329
|
+
return flag.includes("=") ? [flag.slice(flag.indexOf("=") + 1), ...rest] : rest;
|
|
1330
|
+
}
|
|
1331
|
+
function printCompletionScript(name, args) {
|
|
1332
|
+
const shell = COMPLETION_SHELLS.find((each) => each === args[0]);
|
|
1333
|
+
if (shell === undefined || args.length !== 1) {
|
|
1334
|
+
printError(name, `${COMPLETIONS} takes one of ${COMPLETION_SHELLS.join(", ")}`, `${name} ${COMPLETIONS} fish`);
|
|
1335
|
+
return 2;
|
|
1336
|
+
}
|
|
1337
|
+
console.log(completionScript(shell, [name]).trimEnd());
|
|
1338
|
+
return 0;
|
|
1339
|
+
}
|
|
1263
1340
|
async function printCandidates(found) {
|
|
1264
1341
|
for (const line of await found)
|
|
1265
1342
|
console.log(line);
|
|
@@ -1283,6 +1360,8 @@ function packageVersion(entry = Bun.main) {
|
|
|
1283
1360
|
async function runMain({ name, version, run, redact, usage }, argv = scriptArgs()) {
|
|
1284
1361
|
if (argv[0] === COMPLETE)
|
|
1285
1362
|
return printCandidates(leafCandidates(run, argv.slice(1)));
|
|
1363
|
+
if (argv[0] === COMPLETIONS || argv[0]?.startsWith(`${COMPLETIONS}=`) === true)
|
|
1364
|
+
return printCompletionScript(name, flagValue(argv));
|
|
1286
1365
|
if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v")) {
|
|
1287
1366
|
console.log(version ?? packageVersion());
|
|
1288
1367
|
return 0;
|
package/dist/slot-cli.js
CHANGED
|
@@ -616,7 +616,7 @@ class Completing {
|
|
|
616
616
|
}
|
|
617
617
|
var completion = { active: false };
|
|
618
618
|
var OUTPUT_OPTIONS = {
|
|
619
|
-
color: { type: "string", description: "auto (on a terminal alone
|
|
619
|
+
color: { type: "string", choices: ["auto", "always", "never"], description: "auto (the default) colours on a terminal alone" },
|
|
620
620
|
plain: { type: "boolean", description: "plain text, no colour or spinner: --color never" }
|
|
621
621
|
};
|
|
622
622
|
function applyOutput(color, plain, env = process9.env) {
|
|
@@ -1082,6 +1082,66 @@ import { readFileSync as readFileSync4, realpathSync as realpathSync2 } from "fs
|
|
|
1082
1082
|
import { dirname as dirname3, join as join6 } from "path";
|
|
1083
1083
|
import process16 from "process";
|
|
1084
1084
|
|
|
1085
|
+
// ../kit/src/completions.ts
|
|
1086
|
+
var COMPLETION_SHELLS = ["fish", "bash", "zsh"];
|
|
1087
|
+
var FISH_FUNCTION = `functions -q __kaynooo_cli_complete; or function __kaynooo_cli_complete --argument-names bin --description 'what a @kaynooo/cli-kit bin offers for the word being typed'
|
|
1088
|
+
set -l tokens (commandline -xpc 2>/dev/null; or commandline -opc)
|
|
1089
|
+
set -l current (commandline -ct)
|
|
1090
|
+
for line in ($bin __complete $tokens[2..-1] $current 2>/dev/null)
|
|
1091
|
+
if test "$line" = __files__
|
|
1092
|
+
__fish_complete_path $current
|
|
1093
|
+
else
|
|
1094
|
+
echo $line
|
|
1095
|
+
end
|
|
1096
|
+
end
|
|
1097
|
+
end`;
|
|
1098
|
+
var BASH_FUNCTION = `__kaynooo_cli_complete() {
|
|
1099
|
+
local IFS=$'\\n' cur=\${COMP_WORDS[COMP_CWORD]} line words=
|
|
1100
|
+
local -a lines
|
|
1101
|
+
COMPREPLY=()
|
|
1102
|
+
lines=($("\${COMP_WORDS[0]}" __complete "\${COMP_WORDS[@]:1:COMP_CWORD}" 2>/dev/null))
|
|
1103
|
+
for line in "\${lines[@]}"; do
|
|
1104
|
+
if [[ $line == __files__ ]]; then
|
|
1105
|
+
COMPREPLY+=($(compgen -f -- "$cur"))
|
|
1106
|
+
else
|
|
1107
|
+
words+="\${line%%$'\\t'*}"$'\\n'
|
|
1108
|
+
fi
|
|
1109
|
+
done
|
|
1110
|
+
COMPREPLY+=($(compgen -W "$words" -- "$cur"))
|
|
1111
|
+
}`;
|
|
1112
|
+
var ZSH_FUNCTION = `__kaynooo_cli_complete() {
|
|
1113
|
+
local line
|
|
1114
|
+
local -a described plain
|
|
1115
|
+
for line in \${(f)"$("\${words[1]}" __complete "\${(@)words[2,CURRENT]}" 2>/dev/null)"}; do
|
|
1116
|
+
if [[ $line == __files__ ]]; then
|
|
1117
|
+
_files
|
|
1118
|
+
elif [[ $line == *$'\\t'* ]]; then
|
|
1119
|
+
described+=("\${\${line%%$'\\t'*}//:/\\\\:}:\${line#*$'\\t'}")
|
|
1120
|
+
else
|
|
1121
|
+
plain+=("$line")
|
|
1122
|
+
fi
|
|
1123
|
+
done
|
|
1124
|
+
(( \${#described} )) && _describe -V value described
|
|
1125
|
+
(( \${#plain} )) && compadd -- "\${plain[@]}"
|
|
1126
|
+
return 0
|
|
1127
|
+
}`;
|
|
1128
|
+
function completionScript(shell, bins, header = `# Generated by \`${bins[0]} --completions ${shell}\``) {
|
|
1129
|
+
if (shell === "fish")
|
|
1130
|
+
return `${header}
|
|
1131
|
+
${FISH_FUNCTION}
|
|
1132
|
+
${bins.map((bin) => `complete -c ${bin} -f -a '(__kaynooo_cli_complete ${bin})'
|
|
1133
|
+
`).join("")}`;
|
|
1134
|
+
if (shell === "bash")
|
|
1135
|
+
return `${header}
|
|
1136
|
+
${BASH_FUNCTION}
|
|
1137
|
+
complete -F __kaynooo_cli_complete ${bins.join(" ")}
|
|
1138
|
+
`;
|
|
1139
|
+
return `${header}
|
|
1140
|
+
${ZSH_FUNCTION}
|
|
1141
|
+
compdef __kaynooo_cli_complete ${bins.join(" ")}
|
|
1142
|
+
`;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1085
1145
|
// ../kit/src/notify.ts
|
|
1086
1146
|
import process13 from "process";
|
|
1087
1147
|
var NOTIFY_AFTER_MS = 1e4;
|
|
@@ -1179,7 +1239,11 @@ var LEVEL_OPTIONS = {
|
|
|
1179
1239
|
...OUTPUT_OPTIONS,
|
|
1180
1240
|
help: { type: "boolean", short: "h", description: "show this help" }
|
|
1181
1241
|
};
|
|
1182
|
-
var TOP_OPTIONS = {
|
|
1242
|
+
var TOP_OPTIONS = {
|
|
1243
|
+
...LEVEL_OPTIONS,
|
|
1244
|
+
version: { type: "boolean", short: "v", description: "print the version" },
|
|
1245
|
+
completions: { type: "string", choices: COMPLETION_SHELLS, description: "print the shell completion script" }
|
|
1246
|
+
};
|
|
1183
1247
|
function printError(prefix, message, hint, cause) {
|
|
1184
1248
|
const colors = paint(process16.stderr);
|
|
1185
1249
|
const styled = takesControlCodes(process16.stderr);
|
|
@@ -1259,6 +1323,19 @@ async function leafCandidates(run, words) {
|
|
|
1259
1323
|
const values = name === undefined ? undefined : await completing.candidates[name]?.(typed);
|
|
1260
1324
|
return values === undefined ? [FILES] : values.map(candidateLine);
|
|
1261
1325
|
}
|
|
1326
|
+
var COMPLETIONS = "--completions";
|
|
1327
|
+
function flagValue([flag = "", ...rest]) {
|
|
1328
|
+
return flag.includes("=") ? [flag.slice(flag.indexOf("=") + 1), ...rest] : rest;
|
|
1329
|
+
}
|
|
1330
|
+
function printCompletionScript(name, args) {
|
|
1331
|
+
const shell = COMPLETION_SHELLS.find((each) => each === args[0]);
|
|
1332
|
+
if (shell === undefined || args.length !== 1) {
|
|
1333
|
+
printError(name, `${COMPLETIONS} takes one of ${COMPLETION_SHELLS.join(", ")}`, `${name} ${COMPLETIONS} fish`);
|
|
1334
|
+
return 2;
|
|
1335
|
+
}
|
|
1336
|
+
console.log(completionScript(shell, [name]).trimEnd());
|
|
1337
|
+
return 0;
|
|
1338
|
+
}
|
|
1262
1339
|
async function printCandidates(found) {
|
|
1263
1340
|
for (const line of await found)
|
|
1264
1341
|
console.log(line);
|
|
@@ -1282,6 +1359,8 @@ function packageVersion(entry = Bun.main) {
|
|
|
1282
1359
|
async function runMain({ name, version, run, redact, usage }, argv = scriptArgs()) {
|
|
1283
1360
|
if (argv[0] === COMPLETE)
|
|
1284
1361
|
return printCandidates(leafCandidates(run, argv.slice(1)));
|
|
1362
|
+
if (argv[0] === COMPLETIONS || argv[0]?.startsWith(`${COMPLETIONS}=`) === true)
|
|
1363
|
+
return printCompletionScript(name, flagValue(argv));
|
|
1285
1364
|
if (argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v")) {
|
|
1286
1365
|
console.log(version ?? packageVersion());
|
|
1287
1366
|
return 0;
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaynooo/cli-wait",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.12.
|
|
4
|
+
"version": "0.12.2",
|
|
5
5
|
"description": "waitfor and slot: waits for a log line, a listening port or a URL answering, and queues heavy commands behind machine-wide slots and named locks, for Claude Code, instead of sleep and polling loops.",
|
|
6
6
|
"author": "Kaynooo <contact@kaynooo.fr>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"homepage": "https://
|
|
8
|
+
"homepage": "https://github.com/Kayno0o/cli/tree/main/packages/wait#readme",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "git+https://
|
|
11
|
+
"url": "git+https://github.com/Kayno0o/cli.git",
|
|
12
12
|
"directory": "packages/wait"
|
|
13
13
|
},
|
|
14
|
-
"bugs": "https://
|
|
14
|
+
"bugs": "https://github.com/Kayno0o/cli/issues",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"claude-code",
|
|
17
17
|
"cli",
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
"waitfor": "$npm_execpath src/cli.ts"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@kaynooo/cli-kit": "0.
|
|
41
|
+
"@kaynooo/cli-kit": "0.41.1"
|
|
42
42
|
}
|
|
43
43
|
}
|