@tiens.nguyen/gonext-local-worker 1.0.209 → 1.0.210

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/gonext-repl.mjs +26 -4
  2. package/package.json +1 -1
package/gonext-repl.mjs CHANGED
@@ -175,9 +175,16 @@ function slashCompleter(line) {
175
175
  const hits = COMMAND_NAMES.filter((n) => n.startsWith(line));
176
176
  return [hits.length ? hits : COMMAND_NAMES, line];
177
177
  }
178
- function printCommands() {
179
- console.log(dim(" commands (type / then Tab to complete):"));
180
- for (const c of COMMANDS) {
178
+ function printCommands(prefix = "") {
179
+ const p = (prefix ?? "").trim();
180
+ const show = COMMANDS.filter(
181
+ (c) =>
182
+ !p ||
183
+ p === "/" ||
184
+ [c.name, ...(c.aliases ?? [])].some((n) => n.startsWith(p))
185
+ );
186
+ console.log(dim(" commands (Tab completes):"));
187
+ for (const c of show.length ? show : COMMANDS) {
181
188
  const label = c.usage ?? c.name;
182
189
  const alias = c.aliases?.length ? dim(` (${c.aliases.join(", ")})`) : "";
183
190
  console.log(` ${cyan(label)}${alias}${dim(" — " + c.desc)}`);
@@ -236,12 +243,27 @@ rl.on("line", (l) => {
236
243
  // turn: echo is already muted, but readline still recalls history into the invisible
237
244
  // buffer on ↑/↓ — reset the line state after every keypress so nothing accumulates or
238
245
  // moves. Ctrl+C is unaffected (readline emits its SIGINT before this handler runs).
246
+ let slashHintShown = false; // the live command hint is currently displayed for a "/…" line
239
247
  if (process.stdin.isTTY) {
240
248
  process.stdin.on("keypress", () => {
241
249
  if (following) {
242
250
  rl.line = "";
243
251
  rl.cursor = 0;
244
252
  rl.historyIndex = -1;
253
+ return;
254
+ }
255
+ // Live command hint: the moment the line starts with "/", pop the command list ABOVE
256
+ // the prompt (once) so the user sees /model etc. without typing the whole thing or
257
+ // pressing Tab. Shown once per "/…" run; cleared/reset when the line stops being a
258
+ // slash command (so a fresh "/" shows it again).
259
+ const l = rl.line;
260
+ if (l.startsWith("/") && !slashHintShown) {
261
+ slashHintShown = true;
262
+ process.stdout.write("\r\x1b[K"); // wipe the ">> /" input row
263
+ printCommands(l); // list where the prompt was + below
264
+ rl._refreshLine(); // redraw ">> /" (with cursor) beneath the list
265
+ } else if (!l.startsWith("/")) {
266
+ slashHintShown = false;
245
267
  }
246
268
  });
247
269
  }
@@ -947,7 +969,7 @@ async function main() {
947
969
  console.error(red(`gonext: ${err.message}`));
948
970
  process.exit(1);
949
971
  }
950
- console.log(dim("Ask about this repo. Type / (or /help) to list commands Tab completes. Ctrl-C aborts a running turn.\n"));
972
+ console.log(dim("Ask about this repo. Type / to see commands (Tab completes). Ctrl-C aborts a running turn.\n"));
951
973
 
952
974
  const cwd = resolve(process.cwd());
953
975
  const history = await loadSession(cwd);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.209",
3
+ "version": "1.0.210",
4
4
  "description": "Polls GoNext cloud API for async local LLM jobs and runs them against Ollama/OpenAI-compatible servers on this Mac",
5
5
  "type": "module",
6
6
  "license": "MIT",