@robinpath/cli 3.0.1 → 3.1.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 +62 -23
- 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.0
|
|
18601
|
+
var CLI_VERSION = true ? "3.1.0" : "3.1.0";
|
|
18602
18602
|
var FLAG_QUIET = false;
|
|
18603
18603
|
var FLAG_VERBOSE = false;
|
|
18604
18604
|
var FLAG_AUTO_ACCEPT = false;
|
|
@@ -19778,28 +19778,31 @@ async function checkForUpdates() {
|
|
|
19778
19778
|
if (latest !== CLI_VERSION) {
|
|
19779
19779
|
console.log(
|
|
19780
19780
|
`
|
|
19781
|
-
${color.
|
|
19781
|
+
${color.dim("Update available:")} ${color.green("v" + latest)} ${color.dim("(current: v" + CLI_VERSION + ")")}`
|
|
19782
19782
|
);
|
|
19783
|
-
console.log(
|
|
19783
|
+
console.log(`${color.dim("Run")} ${color.cyan("robinpath update")} ${color.dim("to upgrade")}
|
|
19784
19784
|
`);
|
|
19785
19785
|
}
|
|
19786
19786
|
} catch {
|
|
19787
19787
|
}
|
|
19788
19788
|
}
|
|
19789
|
-
function handleUpdate() {
|
|
19790
|
-
const isWindows = platform4() === "win32";
|
|
19791
|
-
const env = { ...process.env, ROBINPATH_CURRENT_VERSION: CLI_VERSION };
|
|
19789
|
+
async function handleUpdate() {
|
|
19792
19790
|
try {
|
|
19793
|
-
|
|
19794
|
-
|
|
19795
|
-
|
|
19796
|
-
|
|
19797
|
-
|
|
19798
|
-
|
|
19799
|
-
|
|
19791
|
+
log(color.dim("Checking for updates..."));
|
|
19792
|
+
const res = await fetch("https://registry.npmjs.org/@robinpath/cli/latest");
|
|
19793
|
+
const data = await res.json();
|
|
19794
|
+
const latest = data.version;
|
|
19795
|
+
if (latest === CLI_VERSION) {
|
|
19796
|
+
log(color.green(`\u2713 Already on latest version (v${CLI_VERSION})`));
|
|
19797
|
+
return;
|
|
19800
19798
|
}
|
|
19799
|
+
log(`Updating v${CLI_VERSION} \u2192 v${latest}...`);
|
|
19800
|
+
execSync("npm install -g @robinpath/cli@latest", { stdio: "inherit" });
|
|
19801
|
+
log(color.green(`\u2713 Updated to v${latest}`));
|
|
19802
|
+
log(color.dim("Restart robinpath to use the new version."));
|
|
19801
19803
|
} catch (err) {
|
|
19802
19804
|
console.error(color.red("Update failed:") + ` ${err.message}`);
|
|
19805
|
+
console.error(color.dim("Try manually: npm install -g @robinpath/cli"));
|
|
19803
19806
|
process.exit(1);
|
|
19804
19807
|
}
|
|
19805
19808
|
}
|
|
@@ -24274,12 +24277,14 @@ var COMMANDS = {
|
|
|
24274
24277
|
"/forget": "Remove a memory",
|
|
24275
24278
|
"/usage": "Token usage & cost",
|
|
24276
24279
|
"/shell": "Switch shell",
|
|
24280
|
+
"/init": "Create ROBINPATH.md",
|
|
24277
24281
|
"/help": "All commands"
|
|
24278
24282
|
};
|
|
24279
24283
|
function InputArea({ onSubmit, placeholder, statusText, history }) {
|
|
24280
24284
|
const [value, setValue] = useState("");
|
|
24281
24285
|
const [historyIdx, setHistoryIdx] = useState(-1);
|
|
24282
24286
|
const [savedInput, setSavedInput] = useState("");
|
|
24287
|
+
const [tabIdx, setTabIdx] = useState(-1);
|
|
24283
24288
|
const { exit } = useApp();
|
|
24284
24289
|
const matchingCommands = useMemo(() => {
|
|
24285
24290
|
if (!value.startsWith("/")) return [];
|
|
@@ -24341,10 +24346,12 @@ function InputArea({ onSubmit, placeholder, statusText, history }) {
|
|
|
24341
24346
|
return;
|
|
24342
24347
|
}
|
|
24343
24348
|
if (showFiles.length > 0) {
|
|
24349
|
+
const nextIdx = (tabIdx + 1) % showFiles.length;
|
|
24350
|
+
setTabIdx(nextIdx);
|
|
24344
24351
|
const atMatch = value.match(/@(\S*)$/);
|
|
24345
24352
|
if (atMatch) {
|
|
24346
24353
|
const before = value.slice(0, value.length - atMatch[0].length);
|
|
24347
|
-
setValue(before + "@" + showFiles[
|
|
24354
|
+
setValue(before + "@" + showFiles[nextIdx].name);
|
|
24348
24355
|
}
|
|
24349
24356
|
}
|
|
24350
24357
|
return;
|
|
@@ -24378,6 +24385,7 @@ function InputArea({ onSubmit, placeholder, statusText, history }) {
|
|
|
24378
24385
|
if (ch && !key.ctrl && !key.meta) {
|
|
24379
24386
|
setValue((p) => p + ch);
|
|
24380
24387
|
setHistoryIdx(-1);
|
|
24388
|
+
setTabIdx(-1);
|
|
24381
24389
|
}
|
|
24382
24390
|
});
|
|
24383
24391
|
const lines = value.split("\n");
|
|
@@ -24419,9 +24427,9 @@ function InputArea({ onSubmit, placeholder, statusText, history }) {
|
|
|
24419
24427
|
] }, i)) }),
|
|
24420
24428
|
/* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "\u2500".repeat(Math.max(process.stdout.columns || 80, 40)) })
|
|
24421
24429
|
] }),
|
|
24422
|
-
showFiles.length > 0 && /* @__PURE__ */ jsx2(Box2, { flexDirection: "column", paddingX: 2, marginTop: 1, children: showFiles.map((f) => /* @__PURE__ */ jsxs2(Text2, { children: [
|
|
24423
|
-
/* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "+ " }),
|
|
24424
|
-
/* @__PURE__ */ jsx2(Text2, { bold:
|
|
24430
|
+
showFiles.length > 0 && /* @__PURE__ */ jsx2(Box2, { flexDirection: "column", paddingX: 2, marginTop: 1, children: showFiles.map((f, i) => /* @__PURE__ */ jsxs2(Text2, { children: [
|
|
24431
|
+
/* @__PURE__ */ jsx2(Text2, { color: i === tabIdx ? "cyan" : "gray", children: i === tabIdx ? "\u276F " : "+ " }),
|
|
24432
|
+
/* @__PURE__ */ jsx2(Text2, { bold: i === tabIdx, color: i === tabIdx ? "cyan" : void 0, children: f.name }),
|
|
24425
24433
|
f.isDir ? /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "/" }) : null
|
|
24426
24434
|
] }, f.name)) }),
|
|
24427
24435
|
/* @__PURE__ */ jsxs2(Box2, { paddingX: 2, justifyContent: "space-between", children: [
|
|
@@ -24615,6 +24623,11 @@ function ChatApp({ engine }) {
|
|
|
24615
24623
|
] })
|
|
24616
24624
|
] }),
|
|
24617
24625
|
/* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", width: "50%", children: [
|
|
24626
|
+
/* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
24627
|
+
"Run ",
|
|
24628
|
+
/* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "/init" }),
|
|
24629
|
+
" to create ROBINPATH.md"
|
|
24630
|
+
] }),
|
|
24618
24631
|
/* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
24619
24632
|
"Type ",
|
|
24620
24633
|
/* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "/" }),
|
|
@@ -24622,13 +24635,8 @@ function ChatApp({ engine }) {
|
|
|
24622
24635
|
] }),
|
|
24623
24636
|
/* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
24624
24637
|
"Use ",
|
|
24625
|
-
/* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "
|
|
24638
|
+
/* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "@" }),
|
|
24626
24639
|
" to include files"
|
|
24627
|
-
] }),
|
|
24628
|
-
/* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
|
|
24629
|
-
"Use ",
|
|
24630
|
-
/* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "\\" }),
|
|
24631
|
-
" for multiline"
|
|
24632
24640
|
] })
|
|
24633
24641
|
] })
|
|
24634
24642
|
] }) : null,
|
|
@@ -24706,6 +24714,20 @@ var ReplEngine = class {
|
|
|
24706
24714
|
nativeModules: getNativeModules().map((m) => m.name),
|
|
24707
24715
|
installedModules: Object.keys(readModulesManifest())
|
|
24708
24716
|
};
|
|
24717
|
+
const projectFiles = ["ROBINPATH.md", "robinpath.md", ".robinpath.md"];
|
|
24718
|
+
for (const pf of projectFiles) {
|
|
24719
|
+
try {
|
|
24720
|
+
const projectPath = join12(process.cwd(), pf);
|
|
24721
|
+
if (existsSync11(projectPath)) {
|
|
24722
|
+
const content = readFileSync10(projectPath, "utf-8").slice(0, 1e4);
|
|
24723
|
+
this.conversationMessages.push({ role: "user", content: `[Project Instructions \u2014 ${pf}]
|
|
24724
|
+
${content}` });
|
|
24725
|
+
this.conversationMessages.push({ role: "assistant", content: "Project instructions loaded." });
|
|
24726
|
+
break;
|
|
24727
|
+
}
|
|
24728
|
+
} catch {
|
|
24729
|
+
}
|
|
24730
|
+
}
|
|
24709
24731
|
const mem = buildMemoryContext();
|
|
24710
24732
|
if (mem.trim()) {
|
|
24711
24733
|
this.conversationMessages.push({ role: "user", content: `[Context] ${mem.trim()}` });
|
|
@@ -24754,6 +24776,23 @@ var ReplEngine = class {
|
|
|
24754
24776
|
this.ui?.clearMessages();
|
|
24755
24777
|
return "";
|
|
24756
24778
|
}
|
|
24779
|
+
if (text === "/init") {
|
|
24780
|
+
const mdPath = join12(process.cwd(), "ROBINPATH.md");
|
|
24781
|
+
if (existsSync11(mdPath)) return "ROBINPATH.md already exists. Edit it to update project instructions.";
|
|
24782
|
+
writeFileSync6(mdPath, `# Project Instructions
|
|
24783
|
+
|
|
24784
|
+
## About
|
|
24785
|
+
Describe your project here.
|
|
24786
|
+
|
|
24787
|
+
## Rules
|
|
24788
|
+
- Use RobinPath scripting language for automation
|
|
24789
|
+
- Follow the project structure
|
|
24790
|
+
|
|
24791
|
+
## Context
|
|
24792
|
+
Any context the AI should know about this project.
|
|
24793
|
+
`);
|
|
24794
|
+
return "\u2713 Created ROBINPATH.md \u2014 edit it to customize AI behavior for this project.";
|
|
24795
|
+
}
|
|
24757
24796
|
if (text === "/compact") {
|
|
24758
24797
|
if (this.conversationMessages.length > 12) {
|
|
24759
24798
|
this.conversationMessages.splice(1, this.conversationMessages.length - 11);
|