@yasaswy.nagavolu/agents 0.9.1 → 0.9.2

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/lib/menu.js CHANGED
@@ -260,6 +260,29 @@ function deriveBundleDetails(bundle, manifest, { repoRoot } = {}) {
260
260
  };
261
261
  }
262
262
 
263
+ /**
264
+ * Toggle-all/none for a picker's "a" key. `selectableKeys` is the scoped set
265
+ * "a" acts over (today: every row the picker offers — passthrough bundles
266
+ * and advancedOnly items included, same as the old select-all behavior).
267
+ * If every selectable key is already selected, deselects all of them;
268
+ * otherwise selects every selectable key. Any selection outside
269
+ * `selectableKeys` (there isn't one today, but a future scoped picker could
270
+ * have one) is left untouched either way.
271
+ *
272
+ * Pure — returns a new Set, does not mutate `selected`. Kept here (not in
273
+ * tty-menu.js) so it's testable without a TTY.
274
+ */
275
+ function toggleAll(selected, selectableKeys) {
276
+ const allSelected = selectableKeys.every((k) => selected.has(k));
277
+ const next = new Set(selected);
278
+ if (allSelected) {
279
+ for (const k of selectableKeys) next.delete(k);
280
+ } else {
281
+ for (const k of selectableKeys) next.add(k);
282
+ }
283
+ return next;
284
+ }
285
+
263
286
  module.exports = {
264
287
  classifyBundle,
265
288
  secretsHint,
@@ -272,4 +295,5 @@ module.exports = {
272
295
  planSelection,
273
296
  describeBundleItems,
274
297
  deriveBundleDetails,
298
+ toggleAll,
275
299
  };
package/lib/tty-menu.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const readline = require('node:readline');
4
4
  const { supportsColor, createStyler, formatBytes } = require('./ansi');
5
+ const { toggleAll } = require('./menu');
5
6
 
6
7
  // Fixed line count for the detail pane so the layout never jumps as the
7
8
  // cursor moves between bundles with different amounts of detail to show.
@@ -183,7 +184,7 @@ function pickWithRawMode(rows, stdin, stdout, { details, header } = {}) {
183
184
  stdin.resume();
184
185
 
185
186
  let cursor = 0;
186
- const selected = new Set();
187
+ let selected = new Set();
187
188
 
188
189
  function draw() {
189
190
  const out = [ansi.clearScreen()];
@@ -195,7 +196,7 @@ function pickWithRawMode(rows, stdin, stdout, { details, header } = {}) {
195
196
  out.push(ansi.dim('─'.repeat(RULE_WIDTH)));
196
197
  out.push(...buildDetailLines(rows[cursor], detailFor(details, rows[cursor]), ansi, { isSelected: selected.has(cursor) }));
197
198
  out.push(ansi.dim('─'.repeat(RULE_WIDTH)));
198
- out.push(ansi.dim('↑/↓/j/k move PgUp/PgDn jump space toggle a all enter confirm q quit'));
199
+ out.push(ansi.dim('↑/↓/j/k move PgUp/PgDn jump space toggle a all/none enter confirm q quit'));
199
200
  stdout.write(`${out.join('\n')}\n`);
200
201
  }
201
202
 
@@ -237,7 +238,10 @@ function pickWithRawMode(rows, stdin, stdout, { details, header } = {}) {
237
238
  } else if (key && key.name === 'space') {
238
239
  toggle(cursor);
239
240
  } else if (str === 'a') {
240
- rows.forEach((_, i) => toggle(i));
241
+ selected = toggleAll(
242
+ selected,
243
+ rows.map((_, i) => i)
244
+ );
241
245
  } else if (key && key.name === 'return') {
242
246
  cleanup();
243
247
  resolve(rows.filter((_, i) => selected.has(i)).map((r) => r.key));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yasaswy.nagavolu/agents",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
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",