@yasaswy.nagavolu/agents 0.14.0 → 0.15.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/bin/cli.js CHANGED
@@ -985,6 +985,32 @@ async function main(argv) {
985
985
  return 1;
986
986
  }
987
987
 
988
+ /**
989
+ * Return stdin to an idle state so the process can actually exit.
990
+ *
991
+ * A resumed stdin is an active libuv handle: the event loop never drains and node hangs
992
+ * with no shell prompt, even though all work is done and the exit code is set. The
993
+ * interactive readers all resume it -- the raw-mode picker (which pauses on its own way
994
+ * out) and, crucially, the secrets prompts, whose ensureFlowing() resumes stdin and
995
+ * never pauses it again. Observed 2026-08-02: a full interactive install printed its
996
+ * summary and then sat there forever.
997
+ *
998
+ * Done once here, at the single exit point, rather than in each reader: any future
999
+ * prompt that resumes stdin is covered automatically, which a per-reader fix would not
1000
+ * be. Best-effort and never throws -- failing to tidy stdin must not change the exit
1001
+ * code of an otherwise successful run.
1002
+ */
1003
+ function releaseStdin() {
1004
+ try {
1005
+ if (process.stdin.isTTY && typeof process.stdin.setRawMode === 'function') {
1006
+ process.stdin.setRawMode(false);
1007
+ }
1008
+ } catch { /* platform refused — nothing further to do */ }
1009
+ try {
1010
+ process.stdin.pause();
1011
+ } catch { /* ditto */ }
1012
+ }
1013
+
988
1014
  main(process.argv.slice(2))
989
1015
  .then((code) => {
990
1016
  process.exitCode = code;
@@ -992,4 +1018,5 @@ main(process.argv.slice(2))
992
1018
  .catch((err) => {
993
1019
  console.error(err.stack || err.message);
994
1020
  process.exitCode = 1;
995
- });
1021
+ })
1022
+ .finally(releaseStdin);
@@ -84,6 +84,20 @@ function maskValue(value) {
84
84
  return '*'.repeat(str.length - 4) + str.slice(-4);
85
85
  }
86
86
 
87
+ /**
88
+ * Fixed-width mask for DISPLAY: four stars plus the last four characters, and the real
89
+ * length alongside. maskValue() mirrors the value's length, which for a 164-character
90
+ * OpenAI key prints 160 asterisks — a wall of noise that hides the only part a human
91
+ * can actually recognise. The length is kept because it is the other thing worth
92
+ * eyeballing (a truncated paste shows up as a wrong count).
93
+ */
94
+ function maskCompact(value) {
95
+ const str = String(value == null ? '' : value);
96
+ if (!str) return '(empty)';
97
+ if (str.length < 8) return `${'*'.repeat(str.length)} (${str.length} chars)`;
98
+ return `****${str.slice(-4)} (${str.length} chars)`;
99
+ }
100
+
87
101
  /**
88
102
  * Ensure `input` is actively flowing before reading from it. A stream left
89
103
  * paused by a prior consumer (notably lib/tty-menu.js's raw-mode bundle
@@ -258,15 +272,17 @@ const DEFAULT_VALIDATORS = { GITLAB_TOKEN: validateGitlabToken };
258
272
  * `'kept'`) rather than "skip" (status `'skipped'`), and the prompt text is
259
273
  * worded to match.
260
274
  */
261
- async function promptOneSecret({ secret, io, validator, alreadySet = false }) {
275
+ async function promptOneSecret({ secret, io, validator, alreadySet = false, replacing = false }) {
262
276
  for (;;) {
263
277
  // eslint-disable-next-line no-await-in-loop
264
278
  const value = await readMaskedSecret({
265
279
  input: io.input,
266
280
  output: io.output,
267
- promptText: alreadySet
268
- ? `Enter ${secret.name} (Enter to keep current value): `
269
- : `Enter ${secret.name} (Enter to skip): `,
281
+ promptText: replacing
282
+ ? ` Enter NEW ${secret.name} (Enter to cancel and keep current): `
283
+ : alreadySet
284
+ ? `Enter ${secret.name} (Enter to keep current value): `
285
+ : `Enter ${secret.name} (Enter to skip): `,
270
286
  });
271
287
  if (!value) {
272
288
  return { status: alreadySet ? 'kept' : 'skipped' };
@@ -371,14 +387,34 @@ async function promptForMissingSecrets({ bundles, targetBase, io, validators, no
371
387
  if (secret.validationHint) {
372
388
  log(` (${secret.validationHint})`);
373
389
  }
390
+ let replacing = false;
374
391
  if (resolution.resolved) {
375
- log(` already set (${maskValue(resolution.value)}, from ${resolution.source}) — Enter keeps, type to replace`);
392
+ // Show what is there, then ask a single explicit question. The old flow printed
393
+ // "Enter keeps, type to replace" and dropped straight into a masked field, so
394
+ // replacing meant blind-typing a long secret with no confirmation step, and there
395
+ // was no way to see what you already had beyond a row of asterisks.
396
+ log(` current: ${maskCompact(resolution.value)} — from ${resolution.source}`);
397
+ // eslint-disable-next-line no-await-in-loop
398
+ const choice = await askChoice({
399
+ input: resolvedIo.input,
400
+ output: resolvedIo.output,
401
+ promptText: ` [K] keep [R] replace (Enter = keep): `,
402
+ choices: ['k', 'r'],
403
+ defaultChoice: 'k',
404
+ });
405
+ if (choice !== 'r') {
406
+ log(` Kept existing ${secret.name}.`);
407
+ result.alreadySet.push(secret.name);
408
+ continue;
409
+ }
410
+ replacing = true;
376
411
  }
377
412
  const outcome = await promptOneSecret({ // eslint-disable-line no-await-in-loop
378
413
  secret,
379
414
  io: resolvedIo,
380
415
  validator: activeValidators[secret.name],
381
416
  alreadySet: resolution.resolved,
417
+ replacing,
382
418
  });
383
419
  if (outcome.status === 'kept') {
384
420
  log(` Kept existing ${secret.name}.`);
@@ -409,6 +445,7 @@ module.exports = {
409
445
  resolveSecretSource,
410
446
  isResolved,
411
447
  maskValue,
448
+ maskCompact,
412
449
  readMaskedSecret,
413
450
  readPlainLine,
414
451
  askChoice,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yasaswy.nagavolu/agents",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "CLI for installing the yasaswy.nagavolu agent/skill/hook bundle. `install` opens an interactive bundle menu in a TTY (or `--bundle <key> --yes` for non-interactive installs), with hash-tracked idempotent deploys, automatic hook wiring into settings.json, and masked secret prompting. `update` reconciles installed bundles against the current source (hash-tracked: silent overwrite, conflict diff+prompt, or --theirs/--keep-mine). `uninstall` removes a bundle's files and wiring. `secrets` re-runs secret prompting for already-installed bundles.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",