@robinpath/cli 3.0.2 → 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.
Files changed (2) hide show
  1. package/dist/cli.mjs +47 -11
  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.0.2" : "3.0.2";
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;
@@ -24277,12 +24277,14 @@ var COMMANDS = {
24277
24277
  "/forget": "Remove a memory",
24278
24278
  "/usage": "Token usage & cost",
24279
24279
  "/shell": "Switch shell",
24280
+ "/init": "Create ROBINPATH.md",
24280
24281
  "/help": "All commands"
24281
24282
  };
24282
24283
  function InputArea({ onSubmit, placeholder, statusText, history }) {
24283
24284
  const [value, setValue] = useState("");
24284
24285
  const [historyIdx, setHistoryIdx] = useState(-1);
24285
24286
  const [savedInput, setSavedInput] = useState("");
24287
+ const [tabIdx, setTabIdx] = useState(-1);
24286
24288
  const { exit } = useApp();
24287
24289
  const matchingCommands = useMemo(() => {
24288
24290
  if (!value.startsWith("/")) return [];
@@ -24344,10 +24346,12 @@ function InputArea({ onSubmit, placeholder, statusText, history }) {
24344
24346
  return;
24345
24347
  }
24346
24348
  if (showFiles.length > 0) {
24349
+ const nextIdx = (tabIdx + 1) % showFiles.length;
24350
+ setTabIdx(nextIdx);
24347
24351
  const atMatch = value.match(/@(\S*)$/);
24348
24352
  if (atMatch) {
24349
24353
  const before = value.slice(0, value.length - atMatch[0].length);
24350
- setValue(before + "@" + showFiles[0].name + " ");
24354
+ setValue(before + "@" + showFiles[nextIdx].name);
24351
24355
  }
24352
24356
  }
24353
24357
  return;
@@ -24381,6 +24385,7 @@ function InputArea({ onSubmit, placeholder, statusText, history }) {
24381
24385
  if (ch && !key.ctrl && !key.meta) {
24382
24386
  setValue((p) => p + ch);
24383
24387
  setHistoryIdx(-1);
24388
+ setTabIdx(-1);
24384
24389
  }
24385
24390
  });
24386
24391
  const lines = value.split("\n");
@@ -24422,9 +24427,9 @@ function InputArea({ onSubmit, placeholder, statusText, history }) {
24422
24427
  ] }, i)) }),
24423
24428
  /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "\u2500".repeat(Math.max(process.stdout.columns || 80, 40)) })
24424
24429
  ] }),
24425
- showFiles.length > 0 && /* @__PURE__ */ jsx2(Box2, { flexDirection: "column", paddingX: 2, marginTop: 1, children: showFiles.map((f) => /* @__PURE__ */ jsxs2(Text2, { children: [
24426
- /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "+ " }),
24427
- /* @__PURE__ */ jsx2(Text2, { bold: f.name.endsWith(".rp") || f.name.endsWith(".robin"), children: f.name }),
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 }),
24428
24433
  f.isDir ? /* @__PURE__ */ jsx2(Text2, { dimColor: true, children: "/" }) : null
24429
24434
  ] }, f.name)) }),
24430
24435
  /* @__PURE__ */ jsxs2(Box2, { paddingX: 2, justifyContent: "space-between", children: [
@@ -24618,6 +24623,11 @@ function ChatApp({ engine }) {
24618
24623
  ] })
24619
24624
  ] }),
24620
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
+ ] }),
24621
24631
  /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
24622
24632
  "Type ",
24623
24633
  /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "/" }),
@@ -24625,13 +24635,8 @@ function ChatApp({ engine }) {
24625
24635
  ] }),
24626
24636
  /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
24627
24637
  "Use ",
24628
- /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "@/file" }),
24638
+ /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "@" }),
24629
24639
  " to include files"
24630
- ] }),
24631
- /* @__PURE__ */ jsxs2(Text2, { dimColor: true, children: [
24632
- "Use ",
24633
- /* @__PURE__ */ jsx2(Text2, { color: "cyan", children: "\\" }),
24634
- " for multiline"
24635
24640
  ] })
24636
24641
  ] })
24637
24642
  ] }) : null,
@@ -24709,6 +24714,20 @@ var ReplEngine = class {
24709
24714
  nativeModules: getNativeModules().map((m) => m.name),
24710
24715
  installedModules: Object.keys(readModulesManifest())
24711
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
+ }
24712
24731
  const mem = buildMemoryContext();
24713
24732
  if (mem.trim()) {
24714
24733
  this.conversationMessages.push({ role: "user", content: `[Context] ${mem.trim()}` });
@@ -24757,6 +24776,23 @@ var ReplEngine = class {
24757
24776
  this.ui?.clearMessages();
24758
24777
  return "";
24759
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
+ }
24760
24796
  if (text === "/compact") {
24761
24797
  if (this.conversationMessages.length > 12) {
24762
24798
  this.conversationMessages.splice(1, this.conversationMessages.length - 11);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robinpath/cli",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "description": "AI-powered scripting CLI — automate anything from your terminal",
5
5
  "type": "module",
6
6
  "license": "MIT",