@robinpath/cli 3.2.0 → 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 +136 -20
- 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;
|
|
@@ -19858,32 +19858,68 @@ function handleInstall() {
|
|
|
19858
19858
|
log("Restart your terminal, then run:");
|
|
19859
19859
|
log(" robinpath --version");
|
|
19860
19860
|
}
|
|
19861
|
-
function handleUninstall() {
|
|
19862
|
-
const installDir = getInstallDir();
|
|
19861
|
+
async function handleUninstall() {
|
|
19863
19862
|
const robinpathHome = getRobinPathHome();
|
|
19864
|
-
|
|
19863
|
+
log("");
|
|
19864
|
+
log(color.bold(" Uninstall RobinPath"));
|
|
19865
|
+
log("");
|
|
19866
|
+
log(" This will remove:");
|
|
19865
19867
|
if (existsSync5(robinpathHome)) {
|
|
19866
|
-
|
|
19867
|
-
log(`Removed ${robinpathHome}`);
|
|
19868
|
-
} else {
|
|
19869
|
-
log("Nothing to remove.");
|
|
19868
|
+
log(` ${color.dim("\u2022")} ${robinpathHome} (config, sessions, modules, memory)`);
|
|
19870
19869
|
}
|
|
19871
|
-
|
|
19870
|
+
log(` ${color.dim("\u2022")} @robinpath/cli npm package`);
|
|
19871
|
+
log("");
|
|
19872
|
+
if (process.stdin.isTTY) {
|
|
19873
|
+
const answer = await new Promise((resolve13) => {
|
|
19874
|
+
process.stdout.write(` ${color.red("Are you sure?")} [y/N] `);
|
|
19875
|
+
process.stdin.setRawMode(true);
|
|
19876
|
+
process.stdin.resume();
|
|
19877
|
+
const onKey = (buf) => {
|
|
19878
|
+
const key = buf.toString().toLowerCase();
|
|
19879
|
+
process.stdin.removeListener("data", onKey);
|
|
19880
|
+
try {
|
|
19881
|
+
process.stdin.setRawMode(false);
|
|
19882
|
+
} catch {
|
|
19883
|
+
}
|
|
19884
|
+
process.stdin.pause();
|
|
19885
|
+
process.stdout.write(key === "y" ? "yes\n" : "no\n");
|
|
19886
|
+
resolve13(key);
|
|
19887
|
+
};
|
|
19888
|
+
process.stdin.on("data", onKey);
|
|
19889
|
+
});
|
|
19890
|
+
if (answer !== "y") {
|
|
19891
|
+
log(color.dim(" Cancelled."));
|
|
19892
|
+
return;
|
|
19893
|
+
}
|
|
19894
|
+
}
|
|
19895
|
+
log("");
|
|
19896
|
+
if (existsSync5(robinpathHome)) {
|
|
19872
19897
|
try {
|
|
19873
|
-
|
|
19874
|
-
|
|
19875
|
-
|
|
19876
|
-
);
|
|
19877
|
-
|
|
19898
|
+
rmSync(robinpathHome, { recursive: true, force: true });
|
|
19899
|
+
log(color.green(" \u2713") + ` Removed ${robinpathHome}`);
|
|
19900
|
+
} catch (err) {
|
|
19901
|
+
log(color.red(" \u2717") + ` Could not remove ${robinpathHome}: ${err.message}`);
|
|
19902
|
+
}
|
|
19903
|
+
}
|
|
19904
|
+
const oldBin = getInstallDir();
|
|
19905
|
+
if (existsSync5(oldBin)) {
|
|
19906
|
+
try {
|
|
19907
|
+
rmSync(oldBin, { recursive: true, force: true });
|
|
19908
|
+
log(color.green(" \u2713") + " Removed old binary");
|
|
19878
19909
|
} catch {
|
|
19879
|
-
log(`Could not update PATH automatically.`);
|
|
19880
|
-
log(`Remove "${installDir}" from your PATH manually.`);
|
|
19881
19910
|
}
|
|
19882
|
-
} else {
|
|
19883
|
-
log(`Remove the robinpath PATH line from your shell profile.`);
|
|
19884
19911
|
}
|
|
19912
|
+
log(color.dim(" Removing npm package..."));
|
|
19913
|
+
try {
|
|
19914
|
+
execSync("npm uninstall -g @robinpath/cli", { stdio: "pipe" });
|
|
19915
|
+
log(color.green(" \u2713") + " Removed @robinpath/cli");
|
|
19916
|
+
} catch {
|
|
19917
|
+
log(color.dim(" npm uninstall skipped (may need manual: npm uninstall -g @robinpath/cli)"));
|
|
19918
|
+
}
|
|
19919
|
+
log("");
|
|
19920
|
+
log(color.green(" RobinPath completely uninstalled."));
|
|
19921
|
+
log(color.dim(" To reinstall: npm install -g @robinpath/cli"));
|
|
19885
19922
|
log("");
|
|
19886
|
-
log("RobinPath uninstalled. Restart your terminal.");
|
|
19887
19923
|
}
|
|
19888
19924
|
function resolveScriptPath(fileArg) {
|
|
19889
19925
|
const filePath = resolve4(fileArg);
|
|
@@ -28628,7 +28664,7 @@ async function main() {
|
|
|
28628
28664
|
return;
|
|
28629
28665
|
}
|
|
28630
28666
|
if (command === "uninstall") {
|
|
28631
|
-
handleUninstall();
|
|
28667
|
+
await handleUninstall();
|
|
28632
28668
|
return;
|
|
28633
28669
|
}
|
|
28634
28670
|
if (command === "update") {
|
|
@@ -28761,6 +28797,86 @@ async function main() {
|
|
|
28761
28797
|
return;
|
|
28762
28798
|
}
|
|
28763
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
|
+
}
|
|
28764
28880
|
const existingConfig = readAiConfig();
|
|
28765
28881
|
if (Object.keys(existingConfig).length === 0 && process.stdin.isTTY) {
|
|
28766
28882
|
await welcomeWizard();
|