@yasaswy.nagavolu/agents 0.12.0 → 0.13.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 +2 -1
- package/lib/install-state.js +59 -18
- package/lib/install.js +9 -0
- package/lib/ledger.js +3 -1
- package/lib/tty-menu.js +4 -1
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -14,7 +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
|
+
const { bundleInstallState, installChip, installDetailLine, chipIsChange } = require('../lib/install-state');
|
|
18
18
|
const { ledgerPath } = require('../lib/ledger');
|
|
19
19
|
const { WiringError } = require('../lib/wiring');
|
|
20
20
|
const {
|
|
@@ -415,6 +415,7 @@ async function runInteractiveMenu({ advanced, targetDir, targetConfig, noSecrets
|
|
|
415
415
|
const state = bundleInstallState(ledger, row.key);
|
|
416
416
|
row.installChip = installChip(state, pkg.version);
|
|
417
417
|
row.installDetail = installDetailLine(state);
|
|
418
|
+
row.installChipIsChange = chipIsChange(state, pkg.version);
|
|
418
419
|
}
|
|
419
420
|
const selectedKeys = await pickBundles(rows, { details, header, subheader });
|
|
420
421
|
if (selectedKeys === null) {
|
package/lib/install-state.js
CHANGED
|
@@ -2,50 +2,91 @@
|
|
|
2
2
|
|
|
3
3
|
// Per-bundle install state for the interactive menu.
|
|
4
4
|
//
|
|
5
|
-
// The ledger records, per installed FILE, which bundle owns it
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// is
|
|
5
|
+
// The ledger records, per installed FILE, which bundle owns it, when it landed, and
|
|
6
|
+
// (from schema 1.2.0) the CLI version that installed it. The ledger's TOP-LEVEL
|
|
7
|
+
// cliVersion is not usable here: it records only whichever run wrote the file last,
|
|
8
|
+
// which says nothing about a bundle installed under an older CLI. Entries written
|
|
9
|
+
// before 1.2.0 have no version at all and must read as an explicit unknown rather than
|
|
10
|
+
// borrowing that global value — this screen is used to decide what to overwrite, so a
|
|
11
|
+
// guessed version is worse than an admitted gap.
|
|
11
12
|
//
|
|
12
13
|
// Pure and ledger-shaped-input only, so it is testable without a TTY or a real install.
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @param {object|null} ledger parsed agents-ledger.json (or null when absent)
|
|
16
17
|
* @param {string} bundleKey
|
|
17
|
-
* @returns {{installed: boolean, fileCount: number, installedAt: string|null
|
|
18
|
+
* @returns {{installed: boolean, fileCount: number, installedAt: string|null,
|
|
19
|
+
* version: string|null, mixed: boolean}}
|
|
20
|
+
* `version` is null when unknown (pre-1.2.0 entries). `mixed` is true when a bundle's
|
|
21
|
+
* files disagree — possible after a partial/interrupted install — in which case
|
|
22
|
+
* `version` holds the OLDEST, since that is what still needs updating.
|
|
18
23
|
*/
|
|
19
24
|
function bundleInstallState(ledger, bundleKey) {
|
|
20
25
|
const entries = (ledger && ledger.entries) || {};
|
|
21
26
|
let fileCount = 0;
|
|
22
|
-
let
|
|
27
|
+
let newestAt = null;
|
|
28
|
+
const versions = new Set();
|
|
23
29
|
for (const value of Object.values(entries)) {
|
|
24
30
|
if (!value || value.bundle !== bundleKey) continue;
|
|
25
31
|
fileCount += 1;
|
|
26
32
|
const at = value.installedAt;
|
|
27
|
-
if (at && (
|
|
33
|
+
if (at && (newestAt === null || at > newestAt)) newestAt = at;
|
|
34
|
+
versions.add(value.cliVersion || null);
|
|
28
35
|
}
|
|
29
|
-
|
|
36
|
+
if (fileCount === 0) {
|
|
37
|
+
return { installed: false, fileCount: 0, installedAt: null, version: null, mixed: false };
|
|
38
|
+
}
|
|
39
|
+
const known = [...versions].filter(Boolean).sort(compareSemver);
|
|
40
|
+
const hasUnknown = versions.has(null);
|
|
41
|
+
return {
|
|
42
|
+
installed: true,
|
|
43
|
+
fileCount,
|
|
44
|
+
installedAt: newestAt,
|
|
45
|
+
// Any unknown entry makes the whole bundle unknown: reporting the one version we
|
|
46
|
+
// happen to know would overstate what we actually know about the bundle.
|
|
47
|
+
version: hasUnknown ? null : known[0] || null,
|
|
48
|
+
mixed: known.length > 1 || (hasUnknown && known.length > 0),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function compareSemver(a, b) {
|
|
53
|
+
const pa = String(a).split('.').map(Number);
|
|
54
|
+
const pb = String(b).split('.').map(Number);
|
|
55
|
+
for (let i = 0; i < 3; i += 1) {
|
|
56
|
+
if ((pa[i] || 0) !== (pb[i] || 0)) return (pa[i] || 0) - (pb[i] || 0);
|
|
57
|
+
}
|
|
58
|
+
return 0;
|
|
30
59
|
}
|
|
31
60
|
|
|
32
61
|
/**
|
|
33
|
-
*
|
|
62
|
+
* Right-hand chip for a bundle row. Four states:
|
|
63
|
+
* not installed -> "new -> v0.12.0"
|
|
64
|
+
* installed, unknown -> "v? -> v0.12.0" (pre-1.2.0 entry; self-heals on update)
|
|
65
|
+
* installed, current -> "v0.12.0 · current" (no arrow — see below)
|
|
66
|
+
* installed, older -> "v0.9.0 -> v0.12.0"
|
|
34
67
|
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
68
|
+
* The current state deliberately drops the arrow: after any update every bundle sits at
|
|
69
|
+
* the same version, and a wall of identical "v0.12.0 -> v0.12.0" rows hides the one row
|
|
70
|
+
* that genuinely differs.
|
|
38
71
|
*/
|
|
39
72
|
function installChip(state, runningVersion) {
|
|
40
|
-
if (!state.installed) return
|
|
41
|
-
return `
|
|
73
|
+
if (!state.installed) return `new -> v${runningVersion}`;
|
|
74
|
+
if (!state.version) return `v? -> v${runningVersion}`;
|
|
75
|
+
if (state.version === runningVersion) return `v${runningVersion} · current`;
|
|
76
|
+
return `v${state.version} -> v${runningVersion}`;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** True when the chip represents a change the user is about to make. */
|
|
80
|
+
function chipIsChange(state, runningVersion) {
|
|
81
|
+
return !state.installed || state.version !== runningVersion;
|
|
42
82
|
}
|
|
43
83
|
|
|
44
84
|
/** "installed 2026-07-31 · 6 files" for the detail pane, or null when not installed. */
|
|
45
85
|
function installDetailLine(state) {
|
|
46
86
|
if (!state.installed) return null;
|
|
47
87
|
const day = state.installedAt ? String(state.installedAt).slice(0, 10) : 'unknown date';
|
|
48
|
-
|
|
88
|
+
const mixed = state.mixed ? ' · mixed versions on disk' : '';
|
|
89
|
+
return `installed ${day} · ${state.fileCount} file${state.fileCount === 1 ? '' : 's'} on disk${mixed}`;
|
|
49
90
|
}
|
|
50
91
|
|
|
51
|
-
module.exports = { bundleInstallState, installChip, installDetailLine };
|
|
92
|
+
module.exports = { bundleInstallState, installChip, installDetailLine, chipIsChange };
|
package/lib/install.js
CHANGED
|
@@ -155,6 +155,11 @@ function installBundle({
|
|
|
155
155
|
const destHash = fs.existsSync(destFile) ? sha256File(destFile) : null;
|
|
156
156
|
|
|
157
157
|
if (existingEntry && existingEntry.sha256 === sourceHash && destHash === sourceHash) {
|
|
158
|
+
// Byte-identical: nothing to copy, but the entry must still be re-stamped with
|
|
159
|
+
// the CLI version that just verified it. Without this, a bundle whose files
|
|
160
|
+
// happen not to change between releases would keep reporting an old version
|
|
161
|
+
// forever, and the menu's "vX -> vY" row would state something false.
|
|
162
|
+
existingEntry.cliVersion = cliVersion;
|
|
158
163
|
filesUnchanged += 1;
|
|
159
164
|
processedFiles += 1;
|
|
160
165
|
emit({ type: 'file', bundle: bundle.key, file: relTarget, index: processedFiles, total: totalFiles, written: false });
|
|
@@ -166,6 +171,10 @@ function installBundle({
|
|
|
166
171
|
sha256: sourceHash,
|
|
167
172
|
bundle: bundle.key,
|
|
168
173
|
installedAt: timestamp,
|
|
174
|
+
// Per-entry version, so the menu can show a real "installed -> available"
|
|
175
|
+
// delta per bundle. The ledger's top-level cliVersion only records whichever
|
|
176
|
+
// run wrote it LAST, which says nothing about a bundle installed earlier.
|
|
177
|
+
cliVersion,
|
|
169
178
|
sourcePath,
|
|
170
179
|
};
|
|
171
180
|
filesWritten += 1;
|
package/lib/ledger.js
CHANGED
|
@@ -14,7 +14,9 @@ const CLI_LEDGER_SCHEMA_MAJOR = 1;
|
|
|
14
14
|
// item.targetPath override. Additive/backward-compatible: an entry written
|
|
15
15
|
// by an older CLI simply lacks sourcePath, and every reader (managed_files_
|
|
16
16
|
// guard.py, update.js) falls back to the ledger key (relTarget) when absent.
|
|
17
|
-
|
|
17
|
+
// 1.2.0 adds an optional per-entry `cliVersion`. Additive and same-major, so no
|
|
18
|
+
// migration is registered: an entry without it simply reads as "version unknown".
|
|
19
|
+
const CLI_LEDGER_SCHEMA_VERSION = '1.2.0';
|
|
18
20
|
const LEDGER_FILE_NAME = 'agents-ledger.json';
|
|
19
21
|
// ledger.entries[].bundle tag used for files owned by a shared component
|
|
20
22
|
// (e.g. the litellm config/start-script templates) rather than any one
|
package/lib/tty-menu.js
CHANGED
|
@@ -114,8 +114,11 @@ function buildRowLines(row, ansi, { isSelected, isCursor }) {
|
|
|
114
114
|
// Install chip: "installed -> v0.11.0" or "new". Placed on the main line so the list
|
|
115
115
|
// itself answers "which of these do I already have?" without moving the cursor over
|
|
116
116
|
// every row. Never inside the inverse highlight's colour, so it stays legible.
|
|
117
|
+
// Chips that represent a CHANGE (new / older / unknown) are highlighted; a bundle
|
|
118
|
+
// already at the running version is dimmed, so the rows needing attention are the
|
|
119
|
+
// ones that stand out rather than every row shouting equally.
|
|
117
120
|
const chip = row.installChip
|
|
118
|
-
? ` ${row.
|
|
121
|
+
? ` ${row.installChipIsChange === false ? ansi.dim(`[${row.installChip}]`) : ansi.yellow(`[${row.installChip}]`)}`
|
|
119
122
|
: '';
|
|
120
123
|
const mainLine = `${pointer} ${box} ${title} — ${summary}${chip}`;
|
|
121
124
|
const lines = [isCursor ? ansi.inverse(mainLine) : mainLine];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yasaswy.nagavolu/agents",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.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",
|