@robinpath/cli 3.2.1 → 3.3.0
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.mjs +81 -1
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -18598,7 +18598,7 @@ function getNativeModules() {
|
|
|
18598
18598
|
import { join as join3, basename as basename2 } from "node:path";
|
|
18599
18599
|
import { homedir as homedir2, platform as platform2 } from "node:os";
|
|
18600
18600
|
import { existsSync as existsSync2 } from "node:fs";
|
|
18601
|
-
var CLI_VERSION = true ? "3.
|
|
18601
|
+
var CLI_VERSION = true ? "3.3.0" : "3.3.0";
|
|
18602
18602
|
var FLAG_QUIET = false;
|
|
18603
18603
|
var FLAG_VERBOSE = false;
|
|
18604
18604
|
var FLAG_AUTO_ACCEPT = false;
|
|
@@ -28797,6 +28797,86 @@ async function main() {
|
|
|
28797
28797
|
return;
|
|
28798
28798
|
}
|
|
28799
28799
|
checkForUpdates();
|
|
28800
|
+
const auth = readAuth();
|
|
28801
|
+
if (!auth && process.stdin.isTTY) {
|
|
28802
|
+
console.log("");
|
|
28803
|
+
console.log(color.bold(" Welcome to RobinPath!"));
|
|
28804
|
+
console.log("");
|
|
28805
|
+
console.log(" To unlock AI assistant, deploy, snippets, and sync \u2014");
|
|
28806
|
+
console.log(" please login to your RobinPath account.");
|
|
28807
|
+
console.log("");
|
|
28808
|
+
console.log(" Without login you can still:");
|
|
28809
|
+
console.log(` ${color.dim("\u2022")} Run scripts: ${color.cyan("robinpath script.rp")}`);
|
|
28810
|
+
console.log(` ${color.dim("\u2022")} Format code: ${color.cyan("robinpath fmt file.rp")}`);
|
|
28811
|
+
console.log(` ${color.dim("\u2022")} Run tests: ${color.cyan("robinpath test")}`);
|
|
28812
|
+
console.log(` ${color.dim("\u2022")} Install modules: ${color.cyan("robinpath add @robinpath/csv")}`);
|
|
28813
|
+
console.log("");
|
|
28814
|
+
const choice = await new Promise((resolve13) => {
|
|
28815
|
+
if (!process.stdin.isTTY) {
|
|
28816
|
+
resolve13("skip");
|
|
28817
|
+
return;
|
|
28818
|
+
}
|
|
28819
|
+
let selected = 0;
|
|
28820
|
+
const options = ["Login", "Skip for now"];
|
|
28821
|
+
function render2() {
|
|
28822
|
+
process.stdout.write("\x1B[2K\r");
|
|
28823
|
+
for (let i = 0; i < options.length; i++) {
|
|
28824
|
+
if (i > 0) process.stdout.write("\n\x1B[2K");
|
|
28825
|
+
const marker = i === selected ? color.cyan(" \u276F ") : " ";
|
|
28826
|
+
const text = i === selected ? color.bold(options[i]) : options[i];
|
|
28827
|
+
process.stdout.write(`${marker}${text}`);
|
|
28828
|
+
}
|
|
28829
|
+
if (options.length > 1) process.stdout.write(`\x1B[${options.length - 1}A`);
|
|
28830
|
+
process.stdout.write("\r");
|
|
28831
|
+
}
|
|
28832
|
+
render2();
|
|
28833
|
+
process.stdin.setRawMode(true);
|
|
28834
|
+
process.stdin.resume();
|
|
28835
|
+
const onKey = (buf) => {
|
|
28836
|
+
const key = buf.toString();
|
|
28837
|
+
if (key === "\x1B[A") {
|
|
28838
|
+
selected = 0;
|
|
28839
|
+
render2();
|
|
28840
|
+
return;
|
|
28841
|
+
}
|
|
28842
|
+
if (key === "\x1B[B") {
|
|
28843
|
+
selected = 1;
|
|
28844
|
+
render2();
|
|
28845
|
+
return;
|
|
28846
|
+
}
|
|
28847
|
+
if (key === "\r" || key === "\n") {
|
|
28848
|
+
process.stdin.removeListener("data", onKey);
|
|
28849
|
+
try {
|
|
28850
|
+
process.stdin.setRawMode(false);
|
|
28851
|
+
} catch {
|
|
28852
|
+
}
|
|
28853
|
+
process.stdin.pause();
|
|
28854
|
+
process.stdout.write("\n".repeat(options.length));
|
|
28855
|
+
resolve13(selected === 0 ? "login" : "skip");
|
|
28856
|
+
return;
|
|
28857
|
+
}
|
|
28858
|
+
if (key === "\x1B" || key === "") {
|
|
28859
|
+
process.stdin.removeListener("data", onKey);
|
|
28860
|
+
try {
|
|
28861
|
+
process.stdin.setRawMode(false);
|
|
28862
|
+
} catch {
|
|
28863
|
+
}
|
|
28864
|
+
process.stdin.pause();
|
|
28865
|
+
process.stdout.write("\n".repeat(options.length));
|
|
28866
|
+
resolve13("skip");
|
|
28867
|
+
return;
|
|
28868
|
+
}
|
|
28869
|
+
};
|
|
28870
|
+
process.stdin.on("data", onKey);
|
|
28871
|
+
});
|
|
28872
|
+
if (choice === "login") {
|
|
28873
|
+
await handleLogin();
|
|
28874
|
+
} else {
|
|
28875
|
+
console.log(color.dim(" Skipped. Run ") + color.cyan("robinpath login") + color.dim(" anytime to unlock AI features."));
|
|
28876
|
+
console.log("");
|
|
28877
|
+
return;
|
|
28878
|
+
}
|
|
28879
|
+
}
|
|
28800
28880
|
const existingConfig = readAiConfig();
|
|
28801
28881
|
if (Object.keys(existingConfig).length === 0 && process.stdin.isTTY) {
|
|
28802
28882
|
await welcomeWizard();
|