wispy-cli 2.7.20 → 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 +38 -2
- package/package.json +1 -1
package/bin/wispy.mjs
CHANGED
|
@@ -1427,12 +1427,48 @@ 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
|
-
// 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
|
|
1436
1472
|
try {
|
|
1437
1473
|
await import(join(rootDir, "lib/wispy-repl.mjs"));
|
|
1438
1474
|
} catch (err) {
|
package/package.json
CHANGED