wispy-cli 2.7.19 → 2.7.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/bin/wispy.mjs +88 -2
- package/package.json +1 -1
package/bin/wispy.mjs
CHANGED
|
@@ -1377,12 +1377,98 @@ if (command === "server") {
|
|
|
1377
1377
|
// ── Default: launch REPL ──────────────────────────────────────────────────────
|
|
1378
1378
|
// For no args, one-shot messages, or unrecognized commands that the REPL handles
|
|
1379
1379
|
|
|
1380
|
+
// ── Shell Completion ──────────────────────────────────────────────────────────
|
|
1381
|
+
|
|
1382
|
+
if (command === "completion") {
|
|
1383
|
+
const shell = args[1] ?? "zsh";
|
|
1384
|
+
const cmds = [
|
|
1385
|
+
"setup", "config", "doctor", "model", "trust", "ws", "skill", "teach",
|
|
1386
|
+
"improve", "where", "handoff", "server", "tui", "overview", "sessions",
|
|
1387
|
+
"resume", "fork", "review", "agents", "cost", "features", "secrets",
|
|
1388
|
+
"tts", "browser", "auth", "exec", "completion",
|
|
1389
|
+
];
|
|
1390
|
+
const flags = [
|
|
1391
|
+
"--help", "--version", "-w", "--workstream", "-p", "--profile",
|
|
1392
|
+
"-i", "--image", "--name", "--model", "--provider", "--personality",
|
|
1393
|
+
"--agent", "--effort", "--system-prompt", "--append-system-prompt",
|
|
1394
|
+
"--max-budget-usd", "--allowedTools", "--disallowedTools", "--json",
|
|
1395
|
+
];
|
|
1396
|
+
|
|
1397
|
+
if (shell === "zsh") {
|
|
1398
|
+
console.log(`#compdef wispy
|
|
1399
|
+
_wispy() {
|
|
1400
|
+
local -a commands flags
|
|
1401
|
+
commands=(${cmds.map(c => `'${c}'`).join(" ")})
|
|
1402
|
+
flags=(${flags.map(f => `'${f}'`).join(" ")})
|
|
1403
|
+
if (( CURRENT == 2 )); then
|
|
1404
|
+
_describe 'command' commands
|
|
1405
|
+
_describe 'flag' flags
|
|
1406
|
+
else
|
|
1407
|
+
_files
|
|
1408
|
+
fi
|
|
1409
|
+
}
|
|
1410
|
+
_wispy "$@"`);
|
|
1411
|
+
} else if (shell === "bash") {
|
|
1412
|
+
console.log(`_wispy_completions() {
|
|
1413
|
+
local cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
1414
|
+
local commands="${cmds.join(" ")}"
|
|
1415
|
+
local flags="${flags.join(" ")}"
|
|
1416
|
+
COMPREPLY=( $(compgen -W "$commands $flags" -- "$cur") )
|
|
1417
|
+
}
|
|
1418
|
+
complete -F _wispy_completions wispy`);
|
|
1419
|
+
} else if (shell === "fish") {
|
|
1420
|
+
for (const c of cmds) {
|
|
1421
|
+
console.log(`complete -c wispy -n '__fish_use_subcommand' -a '${c}'`);
|
|
1422
|
+
}
|
|
1423
|
+
} else {
|
|
1424
|
+
console.error(`Unknown shell: ${shell}. Supported: zsh, bash, fish`);
|
|
1425
|
+
process.exit(1);
|
|
1426
|
+
}
|
|
1427
|
+
process.exit(0);
|
|
1428
|
+
}
|
|
1429
|
+
|
|
1430
|
+
// ── Update ────────────────────────────────────────────────────────────────────
|
|
1431
|
+
|
|
1432
|
+
if (command === "update" || command === "upgrade") {
|
|
1433
|
+
console.log("Updating wispy-cli to latest...");
|
|
1434
|
+
const { execSync } = await import("node:child_process");
|
|
1435
|
+
try {
|
|
1436
|
+
execSync("npm install -g wispy-cli@latest", { stdio: "inherit" });
|
|
1437
|
+
console.log("\n ✓ Updated successfully!");
|
|
1438
|
+
const pkg = JSON.parse(await readFile(join(rootDir, "package.json"), "utf8"));
|
|
1439
|
+
console.log(` Version: ${pkg.version}\n`);
|
|
1440
|
+
} catch (err) {
|
|
1441
|
+
console.error("Update failed:", err.message);
|
|
1442
|
+
console.log("Try manually: npm install -g wispy-cli@latest");
|
|
1443
|
+
}
|
|
1444
|
+
process.exit(0);
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1447
|
+
// ── Guard: known commands that fall through to REPL ───────────────────────────
|
|
1448
|
+
|
|
1449
|
+
const REPL_COMMANDS = new Set(["server", "overview", undefined]);
|
|
1450
|
+
// If command looks like a flag (starts with -), it's a REPL arg (e.g., wispy -w project)
|
|
1451
|
+
// If command is undefined (no args), start REPL
|
|
1452
|
+
// If command is a known REPL command, fall through
|
|
1453
|
+
// Otherwise, if it looks like an unknown command (not a chat message), warn
|
|
1454
|
+
|
|
1455
|
+
if (command && !REPL_COMMANDS.has(command) && !command.startsWith("-")) {
|
|
1456
|
+
// Check if it could be a chat message (contains spaces, is long, etc.)
|
|
1457
|
+
const fullPrompt = args.join(" ");
|
|
1458
|
+
if (fullPrompt.length < 30 && !fullPrompt.includes(" ") && /^[a-z][a-z0-9-]*$/i.test(command)) {
|
|
1459
|
+
// Looks like an unknown command, not a chat message
|
|
1460
|
+
console.error(`Unknown command: ${command}\n`);
|
|
1461
|
+
console.log("Run 'wispy --help' for available commands.");
|
|
1462
|
+
console.log("Or just type your message: wispy \"your question here\"\n");
|
|
1463
|
+
process.exit(1);
|
|
1464
|
+
}
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1380
1467
|
if (command === "server" || command === "overview") {
|
|
1381
1468
|
// Already set up env flags above, fall through to REPL
|
|
1382
1469
|
}
|
|
1383
1470
|
|
|
1384
|
-
// If we get here
|
|
1385
|
-
// The REPL handles: interactive chat, one-shot "wispy <message>", server, overview
|
|
1471
|
+
// If we get here: no args (REPL), server, overview, or a chat message
|
|
1386
1472
|
try {
|
|
1387
1473
|
await import(join(rootDir, "lib/wispy-repl.mjs"));
|
|
1388
1474
|
} catch (err) {
|
package/package.json
CHANGED