@tiens.nguyen/gonext-local-worker 1.0.200 → 1.0.202

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 +24 -6
  2. package/package.json +1 -1
package/gonext-repl.mjs CHANGED
@@ -206,6 +206,19 @@ const ask = async (q) => {
206
206
  rl.setPrompt(PROMPT);
207
207
  return (a ?? "").trim();
208
208
  };
209
+ // Yes/no prompt with an explicit default. Empty input (just Enter) → the default;
210
+ // otherwise the FIRST non-space character decides (y*→yes, n*→no), and anything else
211
+ // re-uses the default. This replaces a fragile `(await ask()) || "y"` idiom where any
212
+ // leftover character (a stray escape byte, a stray space) silently defeated the
213
+ // default — the reported "[Y/n] + Enter registered as No" bug.
214
+ const askYesNo = async (question, defaultYes) => {
215
+ const suffix = defaultYes ? " [Y/n] " : " [y/N] ";
216
+ const raw = (await ask(question + suffix)).trim().toLowerCase();
217
+ if (!raw) return defaultYes; // just Enter → the default
218
+ if (raw[0] === "y") return true;
219
+ if (raw[0] === "n") return false;
220
+ return defaultYes; // unrecognized → default (never silently flip it)
221
+ };
209
222
 
210
223
  // ---------- workspace registration for the current folder ----------
211
224
  async function readWorkspaces() {
@@ -229,16 +242,21 @@ async function ensureWorkspace() {
229
242
  }
230
243
  if (!existsSync(cwd) || !statSync(cwd).isDirectory()) return;
231
244
  console.log(`This folder is not a registered workspace:\n ${cwd}`);
232
- const reg = (await ask("Register it so the agent can read/edit code here? [Y/n] ")) || "y";
233
- if (!/^y(es)?$/i.test(reg)) {
245
+ const register = await askYesNo(
246
+ "Register it so the agent can read/edit code here?", true /* default Yes */
247
+ );
248
+ if (!register) {
234
249
  console.log(dim("Skipped — the agent will not be able to touch files here."));
235
250
  return;
236
251
  }
237
- const trust = (await ask(
252
+ const allowRun = await askYesNo(
238
253
  "Do you trust this folder — allow the agent to RUN build/test commands\n" +
239
- "(npm test, mvn, pytest…)? [y/N] "
240
- )) || "n";
241
- const allowRun = /^y(es)?$/i.test(trust);
254
+ "(npm test, mvn, pytest…)?",
255
+ true /* default Yes — you opened THIS folder with gonext deliberately, and the
256
+ action-first workflows (start/test/build the project) need it; commands are
257
+ still allowlisted (npm/mvn/pytest/…) and run with a scrubbed env. Type n to
258
+ keep a workspace read/edit-only. */
259
+ );
242
260
  const next = list.filter((w) => w.path !== cwd);
243
261
  next.push({
244
262
  name: basename(cwd),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.200",
3
+ "version": "1.0.202",
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",