wispy-cli 2.7.20 → 2.7.22
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 +53 -2
- package/package.json +1 -1
package/bin/wispy.mjs
CHANGED
|
@@ -1427,12 +1427,63 @@ complete -F _wispy_completions wispy`);
|
|
|
1427
1427
|
process.exit(0);
|
|
1428
1428
|
}
|
|
1429
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
|
+
|
|
1430
1467
|
if (command === "server" || command === "overview") {
|
|
1431
1468
|
// Already set up env flags above, fall through to REPL
|
|
1432
1469
|
}
|
|
1433
1470
|
|
|
1434
|
-
// If we get here
|
|
1435
|
-
//
|
|
1471
|
+
// If we get here with no args → launch TUI (like OpenClaw)
|
|
1472
|
+
// Chat is only available through TUI. Use `wispy exec` for non-interactive one-shot.
|
|
1473
|
+
if (!command || command === "server" || command === "overview") {
|
|
1474
|
+
// No args → TUI
|
|
1475
|
+
if (!command) {
|
|
1476
|
+
try {
|
|
1477
|
+
await import(join(rootDir, "bin/wispy-tui.mjs"));
|
|
1478
|
+
} catch (err) {
|
|
1479
|
+
console.error("TUI failed to start:", err.message);
|
|
1480
|
+
console.log("Falling back to REPL...");
|
|
1481
|
+
await import(join(rootDir, "lib/wispy-repl.mjs"));
|
|
1482
|
+
}
|
|
1483
|
+
process.exit(0);
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1436
1487
|
try {
|
|
1437
1488
|
await import(join(rootDir, "lib/wispy-repl.mjs"));
|
|
1438
1489
|
} catch (err) {
|
package/package.json
CHANGED