@robinpath/cli 3.1.0 → 3.2.1

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.
Files changed (2) hide show
  1. package/dist/cli.mjs +94 -27
  2. 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.1.0" : "3.1.0";
18601
+ var CLI_VERSION = true ? "3.2.1" : "3.2.1";
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
- const isWindows = platform4() === "win32";
19863
+ log("");
19864
+ log(color.bold(" Uninstall RobinPath"));
19865
+ log("");
19866
+ log(" This will remove:");
19865
19867
  if (existsSync5(robinpathHome)) {
19866
- rmSync(robinpathHome, { recursive: true, force: true });
19867
- log(`Removed ${robinpathHome}`);
19868
- } else {
19869
- log("Nothing to remove.");
19868
+ log(` ${color.dim("\u2022")} ${robinpathHome} (config, sessions, modules, memory)`);
19870
19869
  }
19871
- if (isWindows) {
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
- execSync(
19874
- `powershell -NoProfile -Command "$p = [Environment]::GetEnvironmentVariable('Path','User'); $clean = ($p -split ';' | Where-Object { $_ -notlike '*\\.robinpath\\bin*' }) -join ';'; [Environment]::SetEnvironmentVariable('Path',$clean,'User')"`,
19875
- { encoding: "utf-8" }
19876
- );
19877
- log("Removed from PATH");
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.`);
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)"));
19884
19918
  }
19885
19919
  log("");
19886
- log("RobinPath uninstalled. Restart your terminal.");
19920
+ log(color.green(" RobinPath completely uninstalled."));
19921
+ log(color.dim(" To reinstall: npm install -g @robinpath/cli"));
19922
+ log("");
19887
19923
  }
19888
19924
  function resolveScriptPath(fileArg) {
19889
19925
  const filePath = resolve4(fileArg);
@@ -20076,9 +20112,7 @@ async function loadInstalledModules(rp2) {
20076
20112
  }
20077
20113
  if (FLAG_VERBOSE) logVerbose(`Loaded module: ${packageName}@${info.version}`);
20078
20114
  } catch (err) {
20079
- console.error(
20080
- color.yellow("Warning:") + ` Failed to load module ${packageName}: ${err.message}`
20081
- );
20115
+ logVerbose(`Failed to load module ${packageName}: ${err.message}`);
20082
20116
  }
20083
20117
  }
20084
20118
  }
@@ -24141,6 +24175,7 @@ import { render, Box as Box2, Text as Text2, useInput, useApp } from "ink";
24141
24175
  import InkSpinner from "ink-spinner";
24142
24176
 
24143
24177
  // src/ui/Markdown.tsx
24178
+ import React from "react";
24144
24179
  import { Box, Text } from "ink";
24145
24180
  import { jsx, jsxs } from "react/jsx-runtime";
24146
24181
  function parseBlocks(text) {
@@ -24187,11 +24222,42 @@ function renderInlineMarkdown(line) {
24187
24222
  }
24188
24223
  return parts;
24189
24224
  }
24225
+ function renderTable(tableLines) {
24226
+ const rows = tableLines.filter((l) => !l.match(/^\s*\|[-:\s|]+\|\s*$/)).map((l) => l.split("|").slice(1, -1).map((cell) => cell.trim()));
24227
+ if (rows.length === 0) return null;
24228
+ const colCount = rows[0].length;
24229
+ const widths = Array(colCount).fill(0);
24230
+ for (const row of rows) {
24231
+ for (let c = 0; c < Math.min(row.length, colCount); c++) {
24232
+ widths[c] = Math.max(widths[c], row[c].length);
24233
+ }
24234
+ }
24235
+ return /* @__PURE__ */ jsx(Box, { flexDirection: "column", marginY: 1, children: rows.map((row, ri) => /* @__PURE__ */ jsxs(Text, { bold: ri === 0, dimColor: ri === 0, children: [
24236
+ " ",
24237
+ row.map((cell, ci) => cell.padEnd(widths[ci] || 0) + " ").join("")
24238
+ ] }, ri)) });
24239
+ }
24190
24240
  function TextBlock({ content }) {
24191
24241
  const lines = content.split("\n");
24192
- return /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: lines.map((line, i) => {
24242
+ const rendered = [];
24243
+ let i = 0;
24244
+ while (i < lines.length) {
24245
+ if (lines[i].trim().startsWith("|") && lines[i].trim().endsWith("|")) {
24246
+ const tableStart = i;
24247
+ while (i < lines.length && lines[i].trim().startsWith("|")) i++;
24248
+ if (i - tableStart >= 2) {
24249
+ rendered.push(/* @__PURE__ */ jsx(React.Fragment, { children: renderTable(lines.slice(tableStart, i)) }, tableStart));
24250
+ continue;
24251
+ }
24252
+ i = tableStart;
24253
+ }
24254
+ rendered.push(/* @__PURE__ */ jsx(React.Fragment, { children: renderTextLine(lines[i], i) }, i));
24255
+ i++;
24256
+ }
24257
+ return /* @__PURE__ */ jsx(Box, { flexDirection: "column", children: rendered });
24258
+ function renderTextLine(line, idx) {
24193
24259
  const trimmed = line.trimStart();
24194
- if (!trimmed) return /* @__PURE__ */ jsx(Text, { children: " " }, i);
24260
+ if (!trimmed) return /* @__PURE__ */ jsx(Text, { children: " " }, idx);
24195
24261
  if (trimmed.startsWith("## ")) {
24196
24262
  return /* @__PURE__ */ jsx(Text, { bold: true, children: trimmed.slice(3) }, i);
24197
24263
  }
@@ -24215,8 +24281,8 @@ function TextBlock({ content }) {
24215
24281
  renderInlineMarkdown(trimmed.slice(numMatch[0].length))
24216
24282
  ] }, i);
24217
24283
  }
24218
- return /* @__PURE__ */ jsx(Text, { wrap: "wrap", children: renderInlineMarkdown(line) }, i);
24219
- }) });
24284
+ return /* @__PURE__ */ jsx(Text, { wrap: "wrap", children: renderInlineMarkdown(line) }, idx);
24285
+ }
24220
24286
  }
24221
24287
  function CodeBlock({ content, lang }) {
24222
24288
  const allLines = content.split("\n");
@@ -24581,6 +24647,7 @@ function ChatApp({ engine }) {
24581
24647
  const elapsed = Date.now() - startTime;
24582
24648
  const timeStr = elapsed < 1e3 ? `${elapsed}ms` : elapsed < 6e4 ? `${(elapsed / 1e3).toFixed(1)}s` : `${Math.floor(elapsed / 6e4)}m ${Math.round(elapsed % 6e4 / 1e3)}s`;
24583
24649
  setResponseTime(timeStr);
24650
+ if (elapsed > 1e4) process.stdout.write("\x07");
24584
24651
  engine.updateStatus();
24585
24652
  }
24586
24653
  }, [engine]);
@@ -28597,7 +28664,7 @@ async function main() {
28597
28664
  return;
28598
28665
  }
28599
28666
  if (command === "uninstall") {
28600
- handleUninstall();
28667
+ await handleUninstall();
28601
28668
  return;
28602
28669
  }
28603
28670
  if (command === "update") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinpath/cli",
3
- "version": "3.1.0",
3
+ "version": "3.2.1",
4
4
  "description": "AI-powered scripting CLI — automate anything from your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",