buildwithnexus 0.8.2 → 0.8.3

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/bin.js +49 -18
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -1593,7 +1593,7 @@ init_secrets();
1593
1593
  init_docker();
1594
1594
 
1595
1595
  // src/core/version.ts
1596
- var resolvedVersion = true ? "0.8.2" : pkg.version;
1596
+ var resolvedVersion = true ? "0.8.3" : pkg.version;
1597
1597
 
1598
1598
  // src/cli/interactive.ts
1599
1599
  var appVersion = resolvedVersion;
@@ -1652,7 +1652,38 @@ ${urlCheck.error}`));
1652
1652
  input: process.stdin,
1653
1653
  output: process.stdout
1654
1654
  });
1655
- const ask = (question) => new Promise((resolve) => rl.question(question, resolve));
1655
+ let modeIndicator = "";
1656
+ let shiftTabPressed = false;
1657
+ let requestedModeSwitch = false;
1658
+ if (process.stdin.isTTY) {
1659
+ process.stdin.setRawMode(true);
1660
+ const originalKD = process.stdin._handle?.onread;
1661
+ process.stdin.on("data", (data) => {
1662
+ if (data.toString() === "\x1B[Z") {
1663
+ shiftTabPressed = true;
1664
+ requestedModeSwitch = true;
1665
+ }
1666
+ });
1667
+ }
1668
+ const ask = (question, currentMode) => new Promise((resolve) => {
1669
+ if (currentMode) {
1670
+ const agentNames = {
1671
+ PLAN: "\u{1F3AF} Planner",
1672
+ BUILD: "\u{1F528} Builder",
1673
+ BRAINSTORM: "\u{1F4A1} Brainstorm Chief"
1674
+ };
1675
+ modeIndicator = `
1676
+ ${chalk3.dim(`\u2192 ${agentNames[currentMode]}`)}`;
1677
+ }
1678
+ rl.question(question + modeIndicator, (answer) => {
1679
+ if (requestedModeSwitch) {
1680
+ requestedModeSwitch = false;
1681
+ resolve("__SHIFT_TAB__");
1682
+ } else {
1683
+ resolve(answer);
1684
+ }
1685
+ });
1686
+ });
1656
1687
  console.clear();
1657
1688
  console.log(chalk3.gray("Welcome! Describe what you want the AI agents to do."));
1658
1689
  console.log(chalk3.gray('Type "exit" to quit.\n'));
@@ -1702,7 +1733,7 @@ async function runModeLoop(mode, task, backendUrl, ask) {
1702
1733
  tui.displayModeBar(currentMode);
1703
1734
  tui.displayModeHeader(currentMode);
1704
1735
  if (currentMode === "PLAN") {
1705
- const next = await planModeLoop(task, backendUrl, ask);
1736
+ const next = await planModeLoop(task, backendUrl, currentMode, ask);
1706
1737
  if (next === "BUILD") {
1707
1738
  currentMode = "BUILD";
1708
1739
  continue;
@@ -1714,7 +1745,7 @@ async function runModeLoop(mode, task, backendUrl, ask) {
1714
1745
  return;
1715
1746
  }
1716
1747
  if (currentMode === "BUILD") {
1717
- const next = await buildModeLoop(task, backendUrl, ask);
1748
+ const next = await buildModeLoop(task, backendUrl, currentMode, ask);
1718
1749
  if (next === "switch") {
1719
1750
  currentMode = await promptModeSwitch(currentMode, ask);
1720
1751
  continue;
@@ -1722,7 +1753,7 @@ async function runModeLoop(mode, task, backendUrl, ask) {
1722
1753
  return;
1723
1754
  }
1724
1755
  if (currentMode === "BRAINSTORM") {
1725
- const next = await brainstormModeLoop(task, backendUrl, ask);
1756
+ const next = await brainstormModeLoop(task, backendUrl, currentMode, ask);
1726
1757
  if (next === "switch") {
1727
1758
  currentMode = await promptModeSwitch(currentMode, ask);
1728
1759
  continue;
@@ -1755,7 +1786,7 @@ async function promptModeSwitch(current, ask) {
1755
1786
  if (n === 2) return others[1];
1756
1787
  return current;
1757
1788
  }
1758
- async function planModeLoop(task, backendUrl, ask) {
1789
+ async function planModeLoop(task, backendUrl, currentMode, ask) {
1759
1790
  console.log(chalk3.bold("Task:"), chalk3.white(task));
1760
1791
  console.log("");
1761
1792
  console.log(chalk3.yellow("\u23F3 Fetching plan from backend..."));
@@ -1823,7 +1854,7 @@ async function planModeLoop(task, backendUrl, ask) {
1823
1854
  displayPlanSteps(steps);
1824
1855
  while (true) {
1825
1856
  console.log(chalk3.gray("Options: ") + chalk3.bold("[Y]") + chalk3.gray(" Execute ") + chalk3.bold("[e]") + chalk3.gray(" Edit step ") + chalk3.bold("[s]") + chalk3.gray(" Switch mode ") + chalk3.bold("[Esc/n]") + chalk3.gray(" Cancel"));
1826
- const answer = (await ask(tui.displayPermissionPrompt("Execute this plan?"))).trim().toLowerCase();
1857
+ const answer = (await ask(tui.displayPermissionPrompt("Execute this plan?"), currentMode)).trim().toLowerCase();
1827
1858
  if (answer === "" || answer === "y") {
1828
1859
  return "BUILD";
1829
1860
  }
@@ -1832,11 +1863,11 @@ async function planModeLoop(task, backendUrl, ask) {
1832
1863
  return "cancel";
1833
1864
  }
1834
1865
  if (answer === "e" || answer === "edit") {
1835
- steps = await editPlanSteps(steps, ask);
1866
+ steps = await editPlanSteps(steps, currentMode, ask);
1836
1867
  displayPlanSteps(steps);
1837
1868
  continue;
1838
1869
  }
1839
- if (answer === "s" || answer === "switch") {
1870
+ if (answer === "__shift_tab__" || answer === "s" || answer === "switch") {
1840
1871
  return "switch";
1841
1872
  }
1842
1873
  }
@@ -1857,18 +1888,18 @@ function displayPlanSteps(steps) {
1857
1888
  console.log(chalk3.bold.cyan("\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518"));
1858
1889
  console.log("");
1859
1890
  }
1860
- async function editPlanSteps(steps, ask) {
1891
+ async function editPlanSteps(steps, currentMode, ask) {
1861
1892
  console.log(chalk3.gray("Enter step number to edit, or press Enter to finish editing:"));
1862
- const numStr = await ask(chalk3.bold("Step #: "));
1893
+ const numStr = await ask(chalk3.bold("Step #: "), currentMode);
1863
1894
  const n = parseInt(numStr.trim(), 10);
1864
1895
  if (!isNaN(n) && n >= 1 && n <= steps.length) {
1865
1896
  console.log(chalk3.gray(`Current: ${steps[n - 1]}`));
1866
- const updated = await ask(chalk3.bold("New text: "));
1897
+ const updated = await ask(chalk3.bold("New text: "), currentMode);
1867
1898
  if (updated.trim()) steps[n - 1] = updated.trim();
1868
1899
  }
1869
1900
  return steps;
1870
1901
  }
1871
- async function buildModeLoop(task, backendUrl, ask) {
1902
+ async function buildModeLoop(task, backendUrl, currentMode, ask) {
1872
1903
  console.log(chalk3.bold("Task:"), chalk3.white(task));
1873
1904
  tui.displayConnecting();
1874
1905
  try {
@@ -1938,11 +1969,11 @@ async function buildModeLoop(task, backendUrl, ask) {
1938
1969
  console.log(
1939
1970
  chalk3.gray("Options: ") + chalk3.bold("[Enter]") + chalk3.gray(" Done ") + chalk3.bold("[s]") + chalk3.gray(" Switch mode")
1940
1971
  );
1941
- const answer = (await ask(chalk3.bold("> "))).trim().toLowerCase();
1942
- if (answer === "s" || answer === "switch") return "switch";
1972
+ const answer = (await ask(chalk3.bold("> "), currentMode)).trim().toLowerCase();
1973
+ if (answer === "__shift_tab__" || answer === "s" || answer === "switch") return "switch";
1943
1974
  return "done";
1944
1975
  }
1945
- async function brainstormModeLoop(task, backendUrl, ask) {
1976
+ async function brainstormModeLoop(task, backendUrl, currentMode, ask) {
1946
1977
  console.log(chalk3.bold("Starting topic:"), chalk3.white(task));
1947
1978
  console.log(chalk3.gray('Ask follow-up questions. Type "done" to exit, "switch" to change mode.\n'));
1948
1979
  let currentQuestion = task;
@@ -2027,10 +2058,10 @@ async function brainstormModeLoop(task, backendUrl, ask) {
2027
2058
  const msg = err instanceof Error ? err.message : String(err);
2028
2059
  console.error(chalk3.red("Error: " + msg));
2029
2060
  }
2030
- const followUp = await ask(chalk3.bold.blue("\u{1F4AC} You: "));
2061
+ const followUp = await ask(chalk3.bold.blue("\u{1F4AC} You: "), currentMode);
2031
2062
  const lower = followUp.trim().toLowerCase();
2032
2063
  if (lower === "done" || lower === "exit") return "done";
2033
- if (lower === "switch") return "switch";
2064
+ if (lower === "__shift_tab__" || lower === "switch") return "switch";
2034
2065
  if (!followUp.trim()) continue;
2035
2066
  currentQuestion = followUp.trim();
2036
2067
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "buildwithnexus",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
4
4
  "description": "Interactive AI agent orchestrator with intent-based planning, execution, and brainstorming modes",
5
5
  "type": "module",
6
6
  "bin": {