@cross-deck/cli
Advanced tools
+94
-10
@@ -1425,3 +1425,4 @@ // src/cli.ts | ||
| } | ||
| function renderLauncher() { | ||
| function renderLauncher(opts = {}) { | ||
| const repl = opts.repl === true; | ||
| const creds = safeLoad(); | ||
@@ -1445,3 +1446,5 @@ const out = []; | ||
| out.push(""); | ||
| out.push(` ${desc("New here? Run 'crossdeck login' to connect this machine.")}`); | ||
| out.push( | ||
| repl ? ` ${desc("Type 'login' to connect this machine \u2014 or 'help', 'exit'.")}` : ` ${desc("New here? Run 'crossdeck login' to connect this machine.")}` | ||
| ); | ||
| } else { | ||
@@ -1468,3 +1471,5 @@ const who = creds.email ? `Signed in as ${creds.email}` : "Signed in"; | ||
| out.push(` ${desc("Docs")} ${tc(WORD, "cross-deck.com/docs")}`); | ||
| out.push(` ${desc("Run 'crossdeck help' for the full command tree.")}`); | ||
| out.push( | ||
| repl ? ` ${desc("Type a command below \u2014 'help' for the full tree, 'exit' to leave.")}` : ` ${desc("Run 'crossdeck help' for the full command tree.")}` | ||
| ); | ||
| } | ||
@@ -1565,4 +1570,78 @@ out.push(""); | ||
| // src/repl.ts | ||
| import { createInterface } from "readline"; | ||
| import { spawn as spawn2 } from "child_process"; | ||
| var isTTY3 = !!process.stdout.isTTY; | ||
| var useColor4 = isTTY3 && !process.env.NO_COLOR; | ||
| var truecolor3 = useColor4 && /truecolor|24bit/i.test(process.env.COLORTERM ?? ""); | ||
| var CORAL3 = [255, 107, 84]; | ||
| var TAN = [201, 140, 107]; | ||
| var tc3 = (rgb, s) => truecolor3 ? `\x1B[38;2;${rgb[0]};${rgb[1]};${rgb[2]}m${s}\x1B[0m` : useColor4 ? `\x1B[91m${s}\x1B[0m` : s; | ||
| var dim3 = (s) => useColor4 ? `\x1B[2m${s}\x1B[0m` : s; | ||
| function promptText() { | ||
| const active = getActiveProject(); | ||
| const label2 = active ? tc3(TAN, active) : dim3("crossdeck"); | ||
| return `${label2} ${tc3(CORAL3, "\u276F")} `; | ||
| } | ||
| function entryPath() { | ||
| return process.argv[1] ?? ""; | ||
| } | ||
| function runOnce(args) { | ||
| return new Promise((resolve) => { | ||
| const child = spawn2(process.execPath, [entryPath(), ...args], { stdio: "inherit" }); | ||
| child.on("exit", () => resolve()); | ||
| child.on("error", () => resolve()); | ||
| }); | ||
| } | ||
| function startRepl() { | ||
| renderLauncher({ repl: true }); | ||
| const rl = createInterface({ | ||
| input: process.stdin, | ||
| output: process.stdout, | ||
| prompt: promptText(), | ||
| // A light history so ↑ recalls the last commands within the session. | ||
| historySize: 200 | ||
| }); | ||
| const reprompt = () => { | ||
| rl.setPrompt(promptText()); | ||
| rl.prompt(); | ||
| }; | ||
| rl.prompt(); | ||
| rl.on("line", (line2) => { | ||
| let input = line2.trim(); | ||
| if (!input) return reprompt(); | ||
| if (input === "crossdeck") return reprompt(); | ||
| if (input.startsWith("crossdeck ")) input = input.slice("crossdeck ".length).trim(); | ||
| const parts = input.split(/\s+/); | ||
| const cmd2 = parts[0]; | ||
| if (cmd2 === "exit" || cmd2 === "quit") return rl.close(); | ||
| if (cmd2 === "clear") { | ||
| process.stdout.write("\x1B[2J\x1B[H"); | ||
| return reprompt(); | ||
| } | ||
| if (cmd2 === "help" && parts.length === 1) { | ||
| renderHelp(); | ||
| return reprompt(); | ||
| } | ||
| rl.pause(); | ||
| void runOnce(parts).then(() => { | ||
| rl.resume(); | ||
| reprompt(); | ||
| }); | ||
| }); | ||
| rl.on("SIGINT", () => { | ||
| process.stdout.write("\n"); | ||
| reprompt(); | ||
| }); | ||
| rl.on("close", () => { | ||
| process.stdout.write(` | ||
| ${dim3("Left the Crossdeck session.")} | ||
| `); | ||
| process.exit(0); | ||
| }); | ||
| } | ||
| // src/cli.ts | ||
| var VERSION = "1.3.0"; | ||
| var VERSION = "1.4.0"; | ||
| setLauncherVersion(VERSION); | ||
@@ -1674,9 +1753,14 @@ setHelpVersion(VERSION); | ||
| if (process.argv.length <= 2) { | ||
| renderLauncher(); | ||
| process.exit(0); | ||
| if (process.stdin.isTTY && process.stdout.isTTY) { | ||
| startRepl(); | ||
| } else { | ||
| renderLauncher(); | ||
| process.exit(0); | ||
| } | ||
| } else { | ||
| program.parseAsync(process.argv).catch((err) => { | ||
| console.error(err instanceof Error ? err.message : String(err)); | ||
| process.exit(1); | ||
| }); | ||
| } | ||
| program.parseAsync(process.argv).catch((err) => { | ||
| console.error(err instanceof Error ? err.message : String(err)); | ||
| process.exit(1); | ||
| }); | ||
| //# sourceMappingURL=cli.mjs.map |
+1
-1
| { | ||
| "name": "@cross-deck/cli", | ||
| "version": "1.3.0", | ||
| "version": "1.4.0", | ||
| "description": "Crossdeck CLI — upload source maps so production stack traces resolve back to original file:line:function.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
516900
4.17%4147
4.12%76
5.56%22
10%