@rbbtsn0w/adg 0.3.0-beta.5 → 0.3.0-beta.7

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/README.md CHANGED
@@ -229,7 +229,7 @@ adg plugins link --target codex --global # regenerate .codex-plugin in place
229
229
  adg plugins link --target claude --global # symlink into ~/.claude/skills/
230
230
 
231
231
  # maintenance
232
- adg plugins update --dir plugins # refresh lock hashes/versions from disk
232
+ adg plugins update --dir plugins # re-fetch remote sources; rescan local ones in place
233
233
  adg plugins list --dir plugins # list locked plugins
234
234
  adg plugins migrate --dir plugins # move flat installs into per-marketplace dirs
235
235
  ```
package/dist/bin/adg.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { parseArgs } from "node:util";
3
3
  import { spawnSync } from "node:child_process";
4
- import { readFileSync, realpathSync } from "node:fs";
4
+ import { existsSync, readFileSync, realpathSync } from "node:fs";
5
5
  import { dirname, join, resolve } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
  import { checkForUpdate, formatUpdateNotice } from "../src/update-check.js";
@@ -9,23 +9,23 @@ import { ADAPTER_TARGETS } from "../src/adapters/index.js";
9
9
  import { initScaffold } from "../src/commands/init.js";
10
10
  import { adaptPlugin } from "../src/commands/adapt.js";
11
11
  import { addPlugins } from "../src/commands/install.js";
12
- import { updateLock } from "../src/commands/update.js";
13
12
  import { validatePlugin } from "../src/commands/validate.js";
14
13
  import { listPlugins } from "../src/commands/list.js";
15
14
  import { importSkills } from "../src/commands/import.js";
16
15
  import { linkPlugins } from "../src/commands/link.js";
17
16
  import { removePlugin } from "../src/commands/remove.js";
18
17
  import { migrateLayout } from "../src/commands/migrate.js";
19
- import { marketplaceList, marketplaceRemove, marketplaceUpgrade } from "../src/commands/marketplace.js";
18
+ import { marketplaceList, marketplaceRemove, marketplaceUpgrade, updatePlugins } from "../src/commands/marketplace.js";
20
19
  import { selectTargetsInteractive } from "../src/commands/select-agents.js";
21
20
  import { selectPluginsInteractive } from "../src/commands/select-plugins.js";
22
- import { selectScopeInteractive } from "../src/commands/select-scope.js";
21
+ import { selectScopeInteractive, selectUpdateScopeInteractive } from "../src/commands/select-scope.js";
22
+ import { lockPath } from "../src/paths.js";
23
23
  import { confirmFullInstall, selectComponentsInteractive } from "../src/commands/select-components.js";
24
24
  import { globalPluginsDir, projectPluginsDir } from "../src/paths.js";
25
25
  import { COMPONENT_TYPES } from "../src/types.js";
26
26
  import { getAgent } from "../src/agents/index.js";
27
27
  import { ui } from "../src/render/ui.js";
28
- import { renderAgentReport, renderMarketplaceList, renderPluginList, } from "../src/render/plugins.js";
28
+ import { renderAgentReport, renderMarketplaceList, renderPluginList, renderUpdateReport, } from "../src/render/plugins.js";
29
29
  const FLAGS = {
30
30
  // Short flags are first-letter aliases. Where several long flags share a
31
31
  // first letter, the highest-frequency one wins the short and the rest stay
@@ -86,9 +86,22 @@ const PLUGIN_COMMANDS = {
86
86
  flags: ["verbose", ...SCOPE],
87
87
  },
88
88
  update: {
89
- summary: "re-sync installed plugins to their sources",
90
- synopsis: "adg plugins update",
91
- flags: [...SCOPE],
89
+ summary: "pull upstream changes for installed plugins",
90
+ synopsis: "adg plugins update [<source>]",
91
+ positional: "<source> limit to one source key from `adg plugins marketplace list` (default: all)",
92
+ blurb: "Re-fetches every remote source and refreshes the plugins installed from it,\n" +
93
+ "reporting what changed, what's unchanged, what was deleted upstream, and what's\n" +
94
+ "newly available (install those too with --all). Local-source plugins are\n" +
95
+ "rescanned in place. In a terminal, it asks whether to update project, global,\n" +
96
+ "or both; pass a scope flag to skip the prompt.\n\n" +
97
+ "This is the plugins-domain twin of `adg skills update`.",
98
+ flags: ["all", ...SCOPE],
99
+ examples: [
100
+ "adg plugins update # guided: project / global / both",
101
+ "adg plugins update --global # every global source",
102
+ "adg plugins update owner/repo # just one source",
103
+ "adg plugins update owner/repo --all # also install newly-added plugins",
104
+ ],
92
105
  },
93
106
  remove: {
94
107
  summary: "uninstall a plugin",
@@ -228,6 +241,35 @@ function scopeInfo(values) {
228
241
  function scopeOf(values) {
229
242
  return values.global ? "user" : "project";
230
243
  }
244
+ /**
245
+ * Resolve which scope(s) `plugins update` should refresh, mirroring
246
+ * `adg skills update`: an explicit --dir is a single ad-hoc location; otherwise
247
+ * --project/--global (or both) win, a terminal prompts for project/global/both,
248
+ * and a non-interactive run defaults to project when a project lock exists.
249
+ */
250
+ async function resolveUpdateScopes(values) {
251
+ if (typeof values.dir === "string") {
252
+ const dir = resolve(values.dir);
253
+ return [{ dir, agentScope: "project", label: dir }];
254
+ }
255
+ const project = { dir: projectPluginsDir(), agentScope: "project", label: "project" };
256
+ const global = { dir: globalPluginsDir(), agentScope: "user", label: "global" };
257
+ let choice;
258
+ if (values.global && values.project)
259
+ choice = "both";
260
+ else if (values.global)
261
+ choice = "global";
262
+ else if (values.project)
263
+ choice = "project";
264
+ else if (process.stdin.isTTY)
265
+ choice = await selectUpdateScopeInteractive();
266
+ else
267
+ choice = existsSync(lockPath(projectPluginsDir())) ? "project" : "global";
268
+ if (choice === "both") {
269
+ return [{ ...project, heading: "Project plugins" }, { ...global, heading: "Global plugins" }];
270
+ }
271
+ return [choice === "global" ? global : project];
272
+ }
231
273
  /** Friendly `--target` aliases mapped onto canonical adapter target ids. */
232
274
  const TARGET_ALIASES = {
233
275
  anthropic: "claude",
@@ -422,17 +464,29 @@ async function runPlugins(rawVerb, rest) {
422
464
  return;
423
465
  }
424
466
  case "update": {
425
- const { values } = parseVerb(verb, cmd.flags, rest);
426
- const { results, missing, agents } = updateLock(resolveScopeDir(values), undefined, {
427
- resync: true,
428
- scope: scopeOf(values),
429
- });
430
- for (const r of results)
431
- console.log(`${r.changed ? ui.ok("updated") : ui.meta("unchanged")} ${ui.name(`${r.name}@${r.version}`)}`);
432
- for (const m of missing)
433
- console.error(ui.warn(` ! missing directory for locked plugin: ${m}`));
434
- for (const line of renderAgentReport(agents, "re-synced"))
435
- console.log(line);
467
+ const { values, positionals } = parseVerb(verb, cmd.flags, rest);
468
+ const source = positionals[0];
469
+ for (const sc of await resolveUpdateScopes(values)) {
470
+ if (sc.heading)
471
+ console.log(`${ui.name(sc.heading)}`);
472
+ try {
473
+ const result = await updatePlugins({
474
+ pluginsDir: sc.dir,
475
+ source,
476
+ all: values.all,
477
+ activate: true,
478
+ agentScope: sc.agentScope,
479
+ scope: { label: sc.label, globalDir: globalPluginsDir() },
480
+ });
481
+ for (const line of renderUpdateReport(result))
482
+ console.log(line);
483
+ for (const line of renderAgentReport(result.agents, "re-synced"))
484
+ console.log(line);
485
+ }
486
+ catch (err) {
487
+ console.error(`${ui.err("error:")} ${err instanceof Error ? err.message : String(err)}`);
488
+ }
489
+ }
436
490
  return;
437
491
  }
438
492
  case "remove": {
@@ -496,11 +550,10 @@ Commands:
496
550
  adg plugins marketplace list [--verbose] [--global | --project | --dir <dir>]
497
551
  Group installed plugins by source. --verbose expands each plugin to its
498
552
  components (skills, agents, commands, …).
499
- adg plugins marketplace upgrade [<source>] [--all] [--target claude|codex|antigravity|all] [--global | --project | --dir <dir>]
500
- Re-fetch a source and update its installed plugins (--all also installs
501
- anything new it now offers). No <source> upgrades every remote source.
502
553
  adg plugins marketplace remove <source> [--force] [--global | --project | --dir <dir>]
503
554
  Uninstall every plugin that came from <source>.
555
+ adg plugins marketplace upgrade … (deprecated → use \`adg plugins update\`)
556
+ Kept as an alias. To pull upstream changes, prefer \`adg plugins update\`.
504
557
 
505
558
  <source> is a key from \`marketplace list\` (e.g. owner/repo).`;
506
559
  async function runMarketplace(args) {
@@ -528,6 +581,7 @@ async function runMarketplace(args) {
528
581
  return;
529
582
  }
530
583
  case "upgrade": {
584
+ console.error(ui.warn("note: `marketplace upgrade` is a deprecated alias for `adg plugins update`."));
531
585
  const { values, positionals } = parseVerb("marketplace", ["all", "target", ...SCOPE], rest);
532
586
  const results = await marketplaceUpgrade({
533
587
  pluginsDir: resolveScopeDir(values),
@@ -37,13 +37,6 @@ export function installPlugin(opts) {
37
37
  // their origin. The default (no origin) is a flat local copy-in.
38
38
  const origin = opts.origin ?? { type: "local", path: `./${toPosix(name)}` };
39
39
  const dest = pluginDir(opts.pluginsDir, name, origin);
40
- // When the source already lives at the destination (e.g. adapting an
41
- // in-repo reference plugin) skip the copy to avoid copying onto itself.
42
- // Only the manifest-declared payload is copied (projections included) — dev
43
- // cruft like src/ or test/ never ships.
44
- if (resolve(dest) !== source) {
45
- copyPluginDir(source, dest, packageFilter(manifest, { includeProjections: true }));
46
- }
47
40
  const lockFile = lockPath(opts.pluginsDir);
48
41
  const lock = readLock(lockFile);
49
42
  const prev = lock.plugins[name];
@@ -51,12 +44,29 @@ export function installPlugin(opts) {
51
44
  throw new Error(`name collision: "${name}" is already installed from a different source ` +
52
45
  `(${describe(prev.origin)} vs ${describe(origin)}). Rename one to avoid the conflict.`);
53
46
  }
47
+ // Detect-then-update: compute the source's content hash up front (cheap, no
48
+ // copy) and, when asked, short-circuit if it matches what's already recorded —
49
+ // so an unchanged upstream source is never re-copied, re-adapted, or re-locked.
50
+ if (opts.skipUnchanged && prev) {
51
+ const sourceHash = folderHash(source, HASH_IGNORE, packageFilter(manifest, { includeProjections: false }));
52
+ if (prev.folderHash === sourceHash && prev.version === manifest.version) {
53
+ return { name, installedTo: dest, folderHash: sourceHash, adapted: [], changed: false };
54
+ }
55
+ }
56
+ // When the source already lives at the destination (e.g. adapting an
57
+ // in-repo reference plugin) skip the copy to avoid copying onto itself.
58
+ // Only the manifest-declared payload is copied (projections included) — dev
59
+ // cruft like src/ or test/ never ships.
60
+ if (resolve(dest) !== source) {
61
+ copyPluginDir(source, dest, packageFilter(manifest, { includeProjections: true }));
62
+ }
54
63
  // A new selection wins; otherwise keep whatever a prior install recorded so
55
64
  // partial installs survive re-install / `marketplace upgrade`.
56
65
  const selection = opts.selection ?? prev?.selection;
57
66
  const targets = opts.targets ?? [...ADAPTER_TARGETS];
58
67
  const adapted = adaptPlugin(dest, targets, selection).map((r) => r.file);
59
68
  const hash = folderHash(dest, HASH_IGNORE, packageFilter(manifest, { includeProjections: false }));
69
+ const changed = !prev || prev.folderHash !== hash || prev.version !== manifest.version;
60
70
  const entry = {
61
71
  origin,
62
72
  version: manifest.version,
@@ -81,7 +91,7 @@ export function installPlugin(opts) {
81
91
  ...(manifest.category ? { category: manifest.category } : {}),
82
92
  });
83
93
  writeMarketplace(marketFile, market);
84
- return { name, installedTo: dest, folderHash: hash, adapted };
94
+ return { name, installedTo: dest, folderHash: hash, adapted, changed };
85
95
  }
86
96
  function describe(s) {
87
97
  switch (s.type) {
@@ -112,10 +122,10 @@ async function selectPluginNames(opts, candidates, workRoot, converted) {
112
122
  const names = [...candidates.keys()];
113
123
  if (opts.plugins?.length) {
114
124
  const missing = opts.plugins.filter((p) => !candidates.has(p));
115
- if (missing.length) {
125
+ if (missing.length && opts.missingPlugins !== "skip") {
116
126
  throw new Error(`plugin(s) not found in source: ${missing.join(", ")}.\nAvailable: ${names.join(", ")}`);
117
127
  }
118
- return opts.plugins;
128
+ return opts.plugins.filter((p) => candidates.has(p));
119
129
  }
120
130
  if (opts.path) {
121
131
  const target = resolve(join(workRoot, opts.path));
@@ -207,8 +217,15 @@ export async function addPlugins(opts) {
207
217
  throw new Error(`no plugin found in "${opts.spec}" (no .agents/.plugin.json, .claude-plugin or .codex-plugin manifest).`);
208
218
  }
209
219
  const selected = await selectPluginNames(opts, candidates, workRoot, converted);
210
- if (selected.length === 0)
220
+ if (selected.length === 0) {
221
+ // Under "skip" (the update path) every requested plugin was deleted
222
+ // upstream: don't abort — return what the source still offers so the
223
+ // caller can report the deletions.
224
+ if (opts.missingPlugins === "skip") {
225
+ return { order: [], installed: [], converted, available: [...candidates.keys()] };
226
+ }
211
227
  throw new Error("no plugins selected");
228
+ }
212
229
  // Resolve adapter targets after the plugin choice (lets a CLI agent picker
213
230
  // run once we know what's being installed). undefined → installPlugin's all.
214
231
  const targets = opts.targets ?? (opts.selectTargets ? await opts.selectTargets() : undefined);
@@ -226,6 +243,9 @@ export async function addPlugins(opts) {
226
243
  }
227
244
  }
228
245
  }
246
+ // Snapshot which plugins already existed before this call mutates the lock,
247
+ // so the activation step below can tell brand-new installs from updates.
248
+ const existingPlugins = new Set(Object.keys(readLock(lockPath(opts.pluginsDir)).plugins));
229
249
  const installed = [];
230
250
  for (const name of order) {
231
251
  const candidate = candidates.get(name);
@@ -236,16 +256,40 @@ export async function addPlugins(opts) {
236
256
  marketplaceName: opts.marketplaceName,
237
257
  targets,
238
258
  selection: selections.get(name),
259
+ skipUnchanged: opts.skipUnchanged,
239
260
  now: opts.now,
240
261
  }));
241
262
  }
242
263
  // Activate into the selected agents so the plugins are actually usable, not
243
264
  // just recorded/discoverable — each agent enables them via its own CLI.
244
- // undefined targets = all registered agents.
265
+ // undefined targets = all registered agents. Under skipUnchanged (the update
266
+ // path) only re-activate plugins that actually changed — re-running an agent
267
+ // CLI for an untouched plugin is wasted work.
245
268
  let agents;
246
- if (opts.activate) {
247
- const ctx = { pluginsDir: opts.pluginsDir, plugins: installed.map((r) => r.name), scope: opts.scope ?? "project" };
248
- agents = (opts.agents ?? resolveAgents(targets)).map((a) => a.activate(ctx));
269
+ const toActivate = opts.skipUnchanged ? installed.filter((r) => r.changed) : installed;
270
+ if (opts.activate && toActivate.length > 0) {
271
+ const resolved = opts.agents ?? resolveAgents(targets);
272
+ const scope = opts.scope ?? "project";
273
+ const ctxFor = (names) => ({ pluginsDir: opts.pluginsDir, plugins: names, scope });
274
+ // A "changed" plugin is either brand new (no prior lock entry) or an update
275
+ // to an already-installed one. Only updates go through refresh — agents that
276
+ // cache a copy (Claude) must drop the stale one and re-pull. Brand-new
277
+ // plugins must use activate: refresh would issue an uninstall for something
278
+ // never installed, which warns/errors in those agents. On the add path
279
+ // (skipUnchanged off) everything is a fresh activate.
280
+ const activateNames = (opts.skipUnchanged ? toActivate.filter((r) => !existingPlugins.has(r.name)) : toActivate).map((r) => r.name);
281
+ const refreshNames = opts.skipUnchanged ? toActivate.filter((r) => existingPlugins.has(r.name)).map((r) => r.name) : [];
282
+ agents = resolved.map((a) => {
283
+ // An agent may run both lifecycles (new installs + updates) in one pass;
284
+ // merge into the existing affected/skipped contract so downstream report
285
+ // and consolidation (renderAgentReport, mergeAgentResults) stay unchanged.
286
+ const parts = [];
287
+ if (activateNames.length > 0)
288
+ parts.push(a.activate(ctxFor(activateNames)));
289
+ if (refreshNames.length > 0)
290
+ parts.push(a.refresh(ctxFor(refreshNames)));
291
+ return parts.reduce((acc, r) => ({ agent: r.agent, affected: [...acc.affected, ...r.affected], skipped: acc.skipped && r.skipped }), { agent: a.id, affected: [], skipped: true });
292
+ });
249
293
  }
250
294
  return { order, installed, converted, available: [...candidates.keys()], agents };
251
295
  }
@@ -2,6 +2,7 @@ import { lockPath } from "../paths.js";
2
2
  import { readLock } from "../lock.js";
3
3
  import { addPlugins } from "./install.js";
4
4
  import { removePlugin } from "./remove.js";
5
+ import { updateLock } from "./update.js";
5
6
  /**
6
7
  * A stable key identifying the source a plugin came from. GitHub/git plugins
7
8
  * group by repo/url (the marketplace root, ignoring per-plugin sub-paths);
@@ -106,6 +107,94 @@ export async function marketplaceUpgrade(opts) {
106
107
  }
107
108
  return results;
108
109
  }
110
+ /** Merge per-agent sync results from several passes into one entry per agent. */
111
+ function mergeAgentResults(groups) {
112
+ const merged = new Map();
113
+ for (const r of groups.flat()) {
114
+ const existing = merged.get(r.agent);
115
+ if (existing) {
116
+ existing.affected = [...new Set([...existing.affected, ...r.affected])];
117
+ existing.skipped = existing.skipped || r.skipped;
118
+ }
119
+ else {
120
+ merged.set(r.agent, { ...r, affected: [...r.affected] });
121
+ }
122
+ }
123
+ return [...merged.values()];
124
+ }
125
+ /**
126
+ * The plugins-domain equivalent of `adg skills update`: re-fetch every remote
127
+ * source (or one named `source`), report which installed plugins changed,
128
+ * stayed the same, were deleted upstream, or are newly available, and refresh
129
+ * local-source plugins in place. Failures are recorded per-source rather than
130
+ * aborting the whole pass, so one unreachable repo doesn't hide the rest.
131
+ */
132
+ export async function updatePlugins(opts) {
133
+ const allGroups = marketplaceList({ pluginsDir: opts.pluginsDir });
134
+ // A named source narrows to just that group (and must be remote); otherwise we
135
+ // refresh every remote source and rescan the local bucket.
136
+ const remoteGroups = opts.source
137
+ ? [requireGroup(opts.pluginsDir, opts.source, opts.scope)]
138
+ : allGroups.filter((g) => g.remote);
139
+ if (opts.source && !remoteGroups[0].remote) {
140
+ throw new Error(`source "${opts.source}" is local and cannot be re-synced; re-run \`adg plugins add\`.`);
141
+ }
142
+ const now = opts.now ?? new Date().toISOString();
143
+ const remote = [];
144
+ const remoteAgents = [];
145
+ for (const group of remoteGroups) {
146
+ try {
147
+ const { installed, available, agents } = await addPlugins({
148
+ spec: group.source,
149
+ pluginsDir: opts.pluginsDir,
150
+ ref: group.ref,
151
+ // Default: refresh what's installed. --all: also install anything new.
152
+ ...(opts.all ? { all: true } : { plugins: group.installed }),
153
+ missingPlugins: "skip", // an upstream deletion is reported, not fatal
154
+ skipUnchanged: true, // detect-then-update: leave unchanged plugins alone
155
+ targets: opts.targets,
156
+ marketplaceName: group.source,
157
+ gitRunner: opts.gitRunner,
158
+ activate: opts.activate,
159
+ scope: opts.agentScope,
160
+ agents: opts.agents,
161
+ now,
162
+ });
163
+ if (agents)
164
+ remoteAgents.push(...agents);
165
+ const availableSet = new Set(available);
166
+ const installedNow = new Set(installed.map((r) => r.name));
167
+ remote.push({
168
+ source: group.source,
169
+ ...(group.ref ? { ref: group.ref } : {}),
170
+ updated: installed.filter((r) => r.changed).map((r) => r.name).sort(),
171
+ unchanged: installed.filter((r) => !r.changed).map((r) => r.name).sort(),
172
+ deleted: group.installed.filter((n) => !availableSet.has(n)).sort(),
173
+ available: available.filter((n) => !installedNow.has(n) && !group.installed.includes(n)).sort(),
174
+ });
175
+ }
176
+ catch (err) {
177
+ remote.push({
178
+ source: group.source,
179
+ ...(group.ref ? { ref: group.ref } : {}),
180
+ updated: [],
181
+ unchanged: [],
182
+ deleted: [],
183
+ available: [],
184
+ failed: err instanceof Error ? err.message : String(err),
185
+ });
186
+ }
187
+ }
188
+ // Local-source / disk-edited plugins can't be re-fetched, but a rescan still
189
+ // refreshes their lock/manifests/agents. Only run it on a full pass (no named
190
+ // source) and only for the local bucket — remote ones were just re-fetched.
191
+ const localNames = opts.source ? [] : (allGroups.find((g) => !g.remote)?.installed ?? []);
192
+ const local = localNames.length
193
+ ? updateLock(opts.pluginsDir, now, { only: localNames, resync: opts.activate, scope: opts.agentScope, agents: opts.agents })
194
+ : { results: [], missing: [] };
195
+ const agents = mergeAgentResults([remoteAgents, local.agents ?? []]);
196
+ return { remote, local, agents };
197
+ }
109
198
  /** Uninstall every plugin that came from a given source (and from the agents). */
110
199
  export function marketplaceRemove(opts) {
111
200
  const group = requireGroup(opts.pluginsDir, opts.source, opts.scope);
@@ -18,3 +18,23 @@ export async function selectScopeInteractive() {
18
18
  }
19
19
  return scope;
20
20
  }
21
+ /**
22
+ * Ask which scope(s) to update: project, global, or both — mirroring
23
+ * `adg skills update`. Used by `plugins update` when no scope flag was given in
24
+ * an interactive terminal.
25
+ */
26
+ export async function selectUpdateScopeInteractive() {
27
+ const scope = await p.select({
28
+ message: "Update scope",
29
+ options: [
30
+ { value: "project", label: "Project", hint: "plugins in .agents/plugins" },
31
+ { value: "global", label: "Global", hint: "plugins in ~/.agents/plugins" },
32
+ { value: "both", label: "Both", hint: "update everything" },
33
+ ],
34
+ });
35
+ if (p.isCancel(scope)) {
36
+ p.cancel("Cancelled");
37
+ process.exit(0);
38
+ }
39
+ return scope;
40
+ }
@@ -23,7 +23,10 @@ export function updateLock(pluginsDir, now = new Date().toISOString(), opts = {}
23
23
  const results = [];
24
24
  const missing = [];
25
25
  const changedNames = [];
26
+ const only = opts.only ? new Set(opts.only) : undefined;
26
27
  for (const [name, entry] of Object.entries(lock.plugins)) {
28
+ if (only && !only.has(name))
29
+ continue;
27
30
  const dir = installedPluginDir(pluginsDir, name, entry.origin);
28
31
  if (!existsSync(dir)) {
29
32
  missing.push(name);
@@ -71,6 +71,40 @@ export function renderPluginList(plugins, pluginsDir, opts = {}) {
71
71
  }
72
72
  return out;
73
73
  }
74
+ /**
75
+ * `adg plugins update` — per-source updated/unchanged/deleted/available lines,
76
+ * plus the local-bucket rescan, in the spirit of `adg skills update`. Returns a
77
+ * one-line "nothing to update" message when no remote source had any change.
78
+ */
79
+ export function renderUpdateReport(result) {
80
+ const out = [];
81
+ for (const r of result.remote) {
82
+ const ref = r.ref ? `@${r.ref}` : "";
83
+ const head = `${ui.name(`${r.source}${ref}`)}`;
84
+ if (r.failed) {
85
+ out.push(`${head} ${ui.err("could not be checked")} ${ui.meta(`— ${r.failed}`)}`);
86
+ continue;
87
+ }
88
+ if (r.updated.length > 0)
89
+ out.push(`${head}: ${ui.ok(`updated ${r.updated.join(", ")}`)}`);
90
+ else
91
+ out.push(`${head}: ${ui.meta(`up to date (${r.unchanged.length})`)}`);
92
+ if (r.deleted.length > 0) {
93
+ out.push(ui.warn(` deleted upstream: ${r.deleted.join(", ")} — remove with \`adg plugins remove <name>\``));
94
+ }
95
+ if (r.available.length > 0) {
96
+ out.push(ui.meta(` ${r.available.length} more available (use --all): ${r.available.join(", ")}`));
97
+ }
98
+ }
99
+ for (const res of result.local.results) {
100
+ out.push(`${res.changed ? ui.ok("updated") : ui.meta("unchanged")} ${ui.name(`${res.name}@${res.version}`)} ${ui.meta("(local)")}`);
101
+ }
102
+ for (const m of result.local.missing)
103
+ out.push(ui.warn(` ! missing directory for locked plugin: ${m}`));
104
+ if (out.length === 0)
105
+ out.push(ui.meta("nothing to update (no installed sources)"));
106
+ return out;
107
+ }
74
108
  /**
75
109
  * `adg plugins marketplace list` — installed plugins grouped by source.
76
110
  * `details` (name → ListedPlugin) enables the verbose per-plugin component drill;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbbtsn0w/adg",
3
- "version": "0.3.0-beta.5",
3
+ "version": "0.3.0-beta.7",
4
4
  "description": "Agent Directory Group (ADG) toolkit — two domains: plugins and skills.",
5
5
  "type": "module",
6
6
  "license": "MIT",