@yasaswy.nagavolu/agents 0.11.0 → 0.12.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
@@ -14,6 +14,7 @@ const { loadManifest, findBundle, ManifestError } = require('../lib/manifest');
14
14
  const { loadLedger, bundleKeysInLedger, LedgerError } = require('../lib/ledger');
15
15
  const { updateBundles, UpdateError } = require('../lib/update');
16
16
  const { formatVersionBanner } = require('../lib/version-banner');
17
+ const { bundleInstallState, installChip, installDetailLine } = require('../lib/install-state');
17
18
  const { ledgerPath } = require('../lib/ledger');
18
19
  const { WiringError } = require('../lib/wiring');
19
20
  const {
@@ -352,10 +353,9 @@ function printFinalSummary({ installed, skipped, targetBase }) {
352
353
  * file. A ledger problem must not be able to stop the installer from rendering its
353
354
  * menu -- the install path itself will surface that error properly.
354
355
  */
355
- function readInstalledCliVersion(targetDir) {
356
+ function readLedgerSafely(targetDir) {
356
357
  try {
357
- const raw = readFileSync(ledgerPath(targetDir), 'utf8');
358
- return JSON.parse(raw).cliVersion || null;
358
+ return JSON.parse(readFileSync(ledgerPath(targetDir), 'utf8'));
359
359
  } catch {
360
360
  return null;
361
361
  }
@@ -403,11 +403,19 @@ async function runInteractiveMenu({ advanced, targetDir, targetConfig, noSecrets
403
403
  const rows = candidateBundles.map((b) => describeBundleRow(b, manifest));
404
404
  const details = new Map(candidateBundles.map((b) => [b.key, deriveBundleDetails(b, manifest, { repoRoot })]));
405
405
  const header = `${pkg.name} v${pkg.version}`;
406
+ const ledger = readLedgerSafely(targetDir || defaultTargetBase());
406
407
  const subheader = formatVersionBanner({
407
408
  running: pkg.version,
408
- installed: readInstalledCliVersion(targetDir),
409
+ installed: (ledger && ledger.cliVersion) || null,
409
410
  latest: await fetchLatestVersion(pkg.name),
410
411
  });
412
+ // Per-row install state, so the list itself answers "which of these do I already
413
+ // have, and what will confirming do to them?"
414
+ for (const row of rows) {
415
+ const state = bundleInstallState(ledger, row.key);
416
+ row.installChip = installChip(state, pkg.version);
417
+ row.installDetail = installDetailLine(state);
418
+ }
411
419
  const selectedKeys = await pickBundles(rows, { details, header, subheader });
412
420
  if (selectedKeys === null) {
413
421
  console.log('Cancelled — nothing installed.');
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ // Per-bundle install state for the interactive menu.
4
+ //
5
+ // The ledger records, per installed FILE, which bundle owns it and when it landed —
6
+ // but no per-bundle version; `cliVersion` is a single global stamp of whichever run
7
+ // last wrote the ledger. So a row must NOT claim "installed v0.10.0" for a bundle that
8
+ // may have been installed under an older CLI: that would be a fabricated fact on a
9
+ // screen people use to decide what to overwrite. What the ledger can honestly support
10
+ // is installed-vs-new, the file count, and when it was installed.
11
+ //
12
+ // Pure and ledger-shaped-input only, so it is testable without a TTY or a real install.
13
+
14
+ /**
15
+ * @param {object|null} ledger parsed agents-ledger.json (or null when absent)
16
+ * @param {string} bundleKey
17
+ * @returns {{installed: boolean, fileCount: number, installedAt: string|null}}
18
+ */
19
+ function bundleInstallState(ledger, bundleKey) {
20
+ const entries = (ledger && ledger.entries) || {};
21
+ let fileCount = 0;
22
+ let newest = null;
23
+ for (const value of Object.values(entries)) {
24
+ if (!value || value.bundle !== bundleKey) continue;
25
+ fileCount += 1;
26
+ const at = value.installedAt;
27
+ if (at && (newest === null || at > newest)) newest = at;
28
+ }
29
+ return { installed: fileCount > 0, fileCount, installedAt: newest };
30
+ }
31
+
32
+ /**
33
+ * Short right-hand chip for a bundle row.
34
+ *
35
+ * `installed -> v0.11.0` reads as "you have this, and confirming replaces it with the
36
+ * running version"; `new` reads as "this is not on the machine". Deliberately no
37
+ * per-bundle version number — see the module note above.
38
+ */
39
+ function installChip(state, runningVersion) {
40
+ if (!state.installed) return 'new';
41
+ return `installed -> v${runningVersion}`;
42
+ }
43
+
44
+ /** "installed 2026-07-31 · 6 files" for the detail pane, or null when not installed. */
45
+ function installDetailLine(state) {
46
+ if (!state.installed) return null;
47
+ const day = state.installedAt ? String(state.installedAt).slice(0, 10) : 'unknown date';
48
+ return `installed ${day} · ${state.fileCount} file${state.fileCount === 1 ? '' : 's'} on disk`;
49
+ }
50
+
51
+ module.exports = { bundleInstallState, installChip, installDetailLine };
package/lib/tty-menu.js CHANGED
@@ -111,7 +111,13 @@ function buildRowLines(row, ansi, { isSelected, isCursor }) {
111
111
  const pointer = isCursor ? ansi.cyan('❯') : ' ';
112
112
  const title = ansi.bold(ansi.white(row.title));
113
113
  const summary = ansi.dim(row.summary);
114
- const mainLine = `${pointer} ${box} ${title} — ${summary}`;
114
+ // Install chip: "installed -> v0.11.0" or "new". Placed on the main line so the list
115
+ // itself answers "which of these do I already have?" without moving the cursor over
116
+ // every row. Never inside the inverse highlight's colour, so it stays legible.
117
+ const chip = row.installChip
118
+ ? ` ${row.installChip === 'new' ? ansi.dim('[new]') : ansi.yellow(`[${row.installChip}]`)}`
119
+ : '';
120
+ const mainLine = `${pointer} ${box} ${title} — ${summary}${chip}`;
115
121
  const lines = [isCursor ? ansi.inverse(mainLine) : mainLine];
116
122
  const hintLine = buildHintLine(hintsFromRow(row), ansi);
117
123
  if (hintLine) lines.push(`${HINT_INDENT}${hintLine}`);
@@ -147,6 +153,10 @@ function buildDetailLines(row, detail, ansi, { isSelected }) {
147
153
  } else {
148
154
  const stateLabel = isSelected ? ansi.green('selected') : ansi.dim('not selected');
149
155
  lines.push(`${ansi.bold(detail.title)} ${ansi.dim('—')} ${stateLabel}`);
156
+ // Exact install facts for the highlighted bundle (date + files actually on disk).
157
+ // The ledger has no per-bundle version, so none is claimed here — see
158
+ // lib/install-state.js.
159
+ if (row && row.installDetail) lines.push(ansi.yellow(row.installDetail));
150
160
 
151
161
  const kindParts = Object.entries(detail.kindCounts || {}).map(
152
162
  ([kind, count]) => `${count} ${kind}${count === 1 ? '' : 's'}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yasaswy.nagavolu/agents",
3
- "version": "0.11.0",
3
+ "version": "0.12.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",