@rbbtsn0w/adg 0.5.0-beta.3 → 0.5.0-beta.4

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
@@ -233,6 +233,8 @@ adg plugins link --target codex --global # enable in one agent (regen
233
233
  adg plugins link --target claude --global # symlink into ~/.claude/skills/
234
234
  adg plugins unlink --target antigravity asc # disable in one agent only (supports agent-only residuals)
235
235
  adg plugins unlink --target all asc # disable in all agents
236
+ adg plugins disable --global asc # persistently disable everywhere; keep store payload
237
+ adg plugins enable --global asc # restore from the store in every compatible agent
236
238
  adg plugins sync --target antigravity asc # reconcile one agent to the store (clears residual)
237
239
  adg plugins sync --target all --global # reconcile all agents to the store in one go
238
240
  adg plugins marketplace sync owner/repo --target all # same, scoped to a whole source across all agents
@@ -245,11 +247,19 @@ adg plugins migrate --dir plugins # move flat installs into per-marketp
245
247
 
246
248
  ```
247
249
 
248
- Two layers, two verb pairs. The **store** (`add` / `remove`) is the system of
249
- record; **agents are projections** of it (`link` / `unlink` toggle one agent;
250
- `sync` forces an agent to match the store). `remove` deletes from the store and
251
- every agent at once — for per-agent control use `unlink`. When something looks
252
- off, `status` shows the drift and `sync` repairs it.
250
+ Two layers, with the store as the system of record. `add` / `remove` control the
251
+ payload; `enable` / `disable` persist whether a stored plugin should be projected
252
+ to any agent. Agents are projections of that desired state: `link` / `unlink`
253
+ remain temporary per-agent controls, while `sync` restores the store state.
254
+ `remove` deletes from the store and every agent; `disable` keeps the payload,
255
+ source, version, and marketplace entry so updates and later re-enabling remain
256
+ available.
257
+
258
+ Disabled plugins stay in their existing on-disk paths. Their lock entry records
259
+ `state: "disabled"`; Codex and Claude installations are removed and Antigravity's
260
+ discovery manifest/projection is cleared. `update` may refresh a disabled
261
+ plugin's payload but never activates it. `list` groups enabled and disabled
262
+ entries, and `status` distinguishes intentional disablement from runtime drift.
253
263
 
254
264
  For the local-directory-source flow into Claude's registry/cache, see
255
265
  [docs/local-plugin-registration.md](docs/local-plugin-registration.md).
package/dist/bin/adg.js CHANGED
@@ -3,6 +3,7 @@ import { spawnSync } from "node:child_process";
3
3
  import { readFileSync, realpathSync } from "node:fs";
4
4
  import { dirname, join, resolve } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
+ import { selfUpdateCommand, parseSelfUpdateArgs, SELF_UPDATE_USAGE } from "../src/self-update.js";
6
7
  import { checkForUpdate, formatUpdateNotice } from "../src/update-check.js";
7
8
  import { ui } from "../src/render/ui.js";
8
9
  import { TOP_USAGE, fail } from "../src/cli/index.js";
@@ -55,6 +56,16 @@ function runSkills(verb, rest) {
55
56
  });
56
57
  return r.status ?? 1;
57
58
  }
59
+ function runSelfUpdate(args) {
60
+ const options = parseSelfUpdateArgs(args);
61
+ if (options.help) {
62
+ console.log(SELF_UPDATE_USAGE);
63
+ return 0;
64
+ }
65
+ const command = selfUpdateCommand(options.beta);
66
+ const r = spawnSync(command.command, command.args, { stdio: "inherit" });
67
+ return r.status ?? 1;
68
+ }
58
69
  /**
59
70
  * Read the package version from package.json.
60
71
  *
@@ -116,8 +127,14 @@ async function main(argv) {
116
127
  span.setAttribute("verb", verb);
117
128
  status = runSkills(verb, rest);
118
129
  break;
130
+ case "update":
131
+ span.setAttribute("domain", "update");
132
+ if (verb)
133
+ span.setAttribute("verb", verb);
134
+ status = runSelfUpdate([verb, ...rest].filter((x) => x !== undefined));
135
+ break;
119
136
  default:
120
- fail(`unknown domain: ${domain} (expected \`plugins\` or \`skills\`)`);
137
+ fail(`unknown domain: ${domain} (expected \`plugins\`, \`skills\`, or \`update\`)`);
121
138
  }
122
139
  span.setAttribute("process.exit.code", status);
123
140
  if (status !== 0) {
@@ -127,7 +127,7 @@ export function parseCodexPluginList(out, marketplace) {
127
127
  const status = (cols[1] ?? "").toLowerCase();
128
128
  // Count only plugins actually added and active; "disabled" never contains
129
129
  // "enabled", so the substring tests cleanly separate the states.
130
- if (!status.includes("installed") || status.includes("disabled"))
130
+ if (!status.includes("installed") || !status.includes("enabled") || status.includes("disabled"))
131
131
  continue;
132
132
  if (!seen.has(head[1])) {
133
133
  seen.add(head[1]);
@@ -9,6 +9,7 @@ import { linkPlugins } from "../commands/link.js";
9
9
  import { unlinkPlugins } from "../commands/unlink.js";
10
10
  import { syncPlugins } from "../commands/sync.js";
11
11
  import { removePlugin } from "../commands/remove.js";
12
+ import { disablePlugins, enablePlugins } from "../commands/state.js";
12
13
  import { migrateLayout } from "../commands/migrate.js";
13
14
  import { pluginStatus } from "../commands/status.js";
14
15
  import { marketplaceList, marketplaceRemove, marketplaceSync, updatePlugins } from "../commands/marketplace.js";
@@ -303,6 +304,28 @@ async function runPluginsVerb(verb, rest, cmd) {
303
304
  }
304
305
  return;
305
306
  }
307
+ case "disable":
308
+ case "enable": {
309
+ const { values, positionals } = parseVerb(verb, cmd.flags, rest);
310
+ if (positionals.length === 0)
311
+ fail(`plugins ${verb} requires at least one <name>`);
312
+ const sc = await resolveActionScope(values, verb);
313
+ const result = verb === "disable"
314
+ ? disablePlugins({ pluginsDir: sc.pluginsDir, names: positionals, scope: sc.agentScope })
315
+ : enablePlugins({ pluginsDir: sc.pluginsDir, names: positionals, scope: sc.agentScope });
316
+ for (const name of result.order) {
317
+ const changed = result.changed.includes(name);
318
+ console.log(`${changed ? ui.ok(verb === "disable" ? "disabled" : "enabled") : ui.meta("already " + result.state)} ${ui.name(name)}`);
319
+ }
320
+ for (const agent of result.agents) {
321
+ const display = getAgent(agent.agent)?.displayName ?? agent.agent;
322
+ if (agent.affected.length > 0)
323
+ console.log(ui.meta(` ${result.state} in ${display}: ${agent.affected.join(", ")}`));
324
+ else if (agent.skipped)
325
+ console.log(ui.warn(` ${agent.agent} unavailable — run \`adg plugins sync --target ${agent.agent} ${result.order.join(" ")}\` later`));
326
+ }
327
+ return;
328
+ }
306
329
  case "unlink": {
307
330
  const { values, positionals } = parseVerb(verb, cmd.flags, rest);
308
331
  const targets = values.target === "all"
@@ -94,6 +94,20 @@ export const PLUGIN_COMMANDS = {
94
94
  positional: "<name> an installed plugin name (see `adg plugins list`)",
95
95
  flags: ["force", ...SCOPE],
96
96
  },
97
+ disable: {
98
+ summary: "disable plugins across every runtime (store kept)",
99
+ synopsis: "adg plugins disable <name...>",
100
+ positional: "<name...> installed plugin names (see `adg plugins list`)",
101
+ blurb: "Keep plugin payloads in the ADG store while removing their projections\nfrom every registered agent. Disabled state survives update and sync.",
102
+ flags: [...SCOPE],
103
+ },
104
+ enable: {
105
+ summary: "enable stored plugins across every runtime",
106
+ synopsis: "adg plugins enable <name...>",
107
+ positional: "<name...> installed plugin names (see `adg plugins list`)",
108
+ blurb: "Restore disabled plugins and their dependencies from the ADG store,\nregenerate projections, and activate them in every compatible agent.",
109
+ flags: [...SCOPE],
110
+ },
97
111
  init: {
98
112
  summary: "scaffold a new plugin or marketplace (.agents/ only)",
99
113
  synopsis: "adg plugins init <name> [--type plugin|marketplace|all]",
@@ -172,6 +186,7 @@ plugin sets — and adapt each to both Claude and Codex runtimes from one manife
172
186
  Quick start:
173
187
  adg plugins add <owner/repo> install plugins from a source (guided in a terminal)
174
188
  adg plugins list see what's installed
189
+ adg update upgrade the ADG CLI itself
175
190
 
176
191
  Two domains:
177
192
  adg plugins <verb> manage plugins (run \`adg plugins -h\`)
@@ -232,7 +247,7 @@ Scope (most commands): --project (default) | --global | --dir <dir>
232
247
  --global honors XDG_STATE_HOME / ADG_PLUGINS_HOME. Only the plugins/ subtree is
233
248
  touched; AGENTS.md and skills/ are never modified.
234
249
  Mutating verbs ask project/global in a terminal when no scope flag is given.
235
- sync/link/unlink/remove/migrate/import-skills require one in a non-interactive
250
+ sync/link/unlink/enable/disable/remove/migrate/import-skills require one in a non-interactive
236
251
  run (rather than assuming project); add/update fall back to a safe default. A
237
252
  project store that resolves to the global path is auto-promoted to global.`;
238
253
  }
@@ -14,7 +14,7 @@ import { ADG_MANIFEST_PATH, readManifest } from "../manifest.js";
14
14
  import { readMarketplace, upsertMarketplacePlugin, writeMarketplace } from "../marketplace.js";
15
15
  import { resolveInstallOrder } from "../deps.js";
16
16
  import { cloneGitHub, parseSource, scanNativePlugins, scanPlugins } from "../sources.js";
17
- import { sameSource, COMPONENT_TYPES } from "../types.js";
17
+ import { pluginState, sameSource, COMPONENT_TYPES } from "../types.js";
18
18
  import { pluginContents, presentComponents } from "../components.js";
19
19
  import { skillDescriptionLoader } from "../skills.js";
20
20
  import { resolveAgents } from "../agents/index.js";
@@ -82,6 +82,8 @@ export function installPlugin(opts) {
82
82
  }
83
83
  if (selection)
84
84
  entry.selection = selection;
85
+ if (prev?.state)
86
+ entry.state = prev.state;
85
87
  upsertEntry(lock, name, entry, opts.now);
86
88
  writeLock(lockFile, lock);
87
89
  const marketFile = marketplacePath(opts.pluginsDir);
@@ -330,7 +332,9 @@ export async function addPlugins(opts) {
330
332
  // path) only re-activate plugins that actually changed — re-running an agent
331
333
  // CLI for an untouched plugin is wasted work.
332
334
  let agents;
333
- const toActivate = opts.skipUnchanged ? installed.filter((r) => r.changed) : installed;
335
+ const updatedLock = readLock(lockPath(opts.pluginsDir));
336
+ const eligible = installed.filter((result) => pluginState(updatedLock.plugins[result.name]) === "enabled");
337
+ const toActivate = opts.skipUnchanged ? eligible.filter((r) => r.changed) : eligible;
334
338
  if (opts.activate && toActivate.length > 0) {
335
339
  const resolved = opts.agents ?? resolveAgents(targets);
336
340
  const scope = opts.scope ?? "project";
@@ -3,6 +3,7 @@ import { adaptPlugin } from "./adapt.js";
3
3
  import { selectInstalled } from "./projection.js";
4
4
  import { installedPluginDir } from "../paths.js";
5
5
  import { getAgent } from "../agents/index.js";
6
+ import { pluginState } from "../types.js";
6
7
  /**
7
8
  * Project installed plugins into an agent: (re)generate that agent's manifest
8
9
  * from each plugin (honoring its partial-install selection), then enable the
@@ -12,8 +13,15 @@ import { getAgent } from "../agents/index.js";
12
13
  export function linkPlugins(opts) {
13
14
  const agent = opts.agent ?? getAgent(opts.target);
14
15
  const adaptTarget = agent?.adaptTarget ?? opts.target;
16
+ const selected = selectInstalled(opts.pluginsDir, opts.names);
17
+ const disabled = selected.filter((p) => pluginState(p) === "disabled");
18
+ if (opts.names && disabled.length > 0) {
19
+ const names = disabled.map((p) => p.name);
20
+ throw new Error(`disabled plugin(s): ${names.join(", ")}. Run \`adg plugins enable ${names.join(" ")}\`.`);
21
+ }
22
+ const enabled = selected.filter((p) => pluginState(p) === "enabled");
15
23
  const actions = [];
16
- for (const p of selectInstalled(opts.pluginsDir, opts.names)) {
24
+ for (const p of enabled) {
17
25
  const dir = installedPluginDir(opts.pluginsDir, p.name, p.origin);
18
26
  if (!existsSync(dir))
19
27
  continue;
@@ -22,6 +30,8 @@ export function linkPlugins(opts) {
22
30
  }
23
31
  if (!agent)
24
32
  return { target: opts.target, actions };
33
+ if (actions.length === 0)
34
+ return { target: opts.target, actions };
25
35
  const res = agent.activate({
26
36
  pluginsDir: opts.pluginsDir,
27
37
  plugins: actions.map((a) => a.name),
@@ -0,0 +1,84 @@
1
+ import { existsSync } from "node:fs";
2
+ import { adaptPlugin } from "./adapt.js";
3
+ import { listPlugins } from "./list.js";
4
+ import { agentsForComponents, resolveAgents } from "../agents/index.js";
5
+ import { installedPluginDir, lockPath } from "../paths.js";
6
+ import { readLock, writeLock } from "../lock.js";
7
+ import { pluginState } from "../types.js";
8
+ function selectedLock(opts) {
9
+ const lock = readLock(lockPath(opts.pluginsDir));
10
+ const names = [...new Set(opts.names)];
11
+ const missing = names.filter((name) => !lock.plugins[name]);
12
+ if (missing.length > 0)
13
+ throw new Error(`not installed: ${missing.join(", ")}. See \`adg plugins list\`.`);
14
+ return { lock, names };
15
+ }
16
+ function enabledDependents(lock, names) {
17
+ return Object.entries(lock.plugins)
18
+ .filter(([name, entry]) => !names.has(name) && pluginState(entry) === "enabled" && Object.keys(entry.dependencies ?? {}).some((dep) => names.has(dep)))
19
+ .map(([name]) => name)
20
+ .sort();
21
+ }
22
+ function enableOrder(lock, roots) {
23
+ const order = [];
24
+ const seen = new Set();
25
+ const visit = (name) => {
26
+ if (seen.has(name))
27
+ return;
28
+ seen.add(name);
29
+ const entry = lock.plugins[name];
30
+ if (!entry)
31
+ throw new Error(`missing installed dependency: ${name}`);
32
+ for (const dependency of Object.keys(entry.dependencies ?? {}).sort())
33
+ visit(dependency);
34
+ order.push(name);
35
+ };
36
+ for (const root of roots)
37
+ visit(root);
38
+ return order;
39
+ }
40
+ function pluginAgentIds(plugins, name) {
41
+ const plugin = plugins.find((item) => item.name === name);
42
+ const types = Object.entries(plugin?.contents ?? {})
43
+ .filter(([, members]) => members.length > 0)
44
+ .map(([type]) => type);
45
+ return new Set(agentsForComponents(types).map((agent) => agent.id));
46
+ }
47
+ export function disablePlugins(opts) {
48
+ const { lock, names } = selectedLock(opts);
49
+ const requested = new Set(names);
50
+ const dependents = enabledDependents(lock, requested);
51
+ if (dependents.length > 0)
52
+ throw new Error(`required by enabled plugin(s): ${dependents.join(", ")}`);
53
+ const changed = names.filter((name) => pluginState(lock.plugins[name]) !== "disabled");
54
+ for (const name of names)
55
+ lock.plugins[name].state = "disabled";
56
+ if (changed.length > 0)
57
+ writeLock(lockPath(opts.pluginsDir), lock);
58
+ const ctx = { pluginsDir: opts.pluginsDir, plugins: names, scope: opts.scope };
59
+ const agents = (opts.agents ?? resolveAgents()).map((agent) => agent.deactivate(ctx));
60
+ return { state: "disabled", order: names, changed, agents };
61
+ }
62
+ export function enablePlugins(opts) {
63
+ const { lock, names } = selectedLock(opts);
64
+ const order = enableOrder(lock, names);
65
+ const changed = order.filter((name) => pluginState(lock.plugins[name]) !== "enabled");
66
+ for (const name of order)
67
+ lock.plugins[name].state = "enabled";
68
+ if (changed.length > 0)
69
+ writeLock(lockPath(opts.pluginsDir), lock);
70
+ const plugins = listPlugins(opts.pluginsDir);
71
+ const agents = (opts.agents ?? resolveAgents()).map((agent) => {
72
+ const compatible = changed.filter((name) => pluginAgentIds(plugins, name).has(agent.id));
73
+ for (const name of compatible) {
74
+ const entry = lock.plugins[name];
75
+ const dir = installedPluginDir(opts.pluginsDir, name, entry.origin);
76
+ if (existsSync(dir))
77
+ adaptPlugin(dir, [agent.adaptTarget], entry.selection);
78
+ }
79
+ if (compatible.length === 0)
80
+ return { agent: agent.id, affected: [], skipped: false };
81
+ return agent.activate({ pluginsDir: opts.pluginsDir, plugins: compatible, scope: opts.scope });
82
+ });
83
+ return { state: "enabled", order, changed, agents };
84
+ }
@@ -2,9 +2,13 @@ import { existsSync } from "node:fs";
2
2
  import { listPlugins } from "./list.js";
3
3
  import { allAgents, isAgentListFailure, resolveAgents } from "../agents/index.js";
4
4
  import { lockPath } from "../paths.js";
5
+ import { pluginState } from "../types.js";
5
6
  /** Diff the store against each agent's live plugin list. Read-only. */
6
7
  export function pluginStatus(opts) {
7
- const store = listPlugins(opts.pluginsDir).map((p) => p.name);
8
+ const plugins = listPlugins(opts.pluginsDir);
9
+ const enabled = plugins.filter((p) => pluginState(p) === "enabled").map((p) => p.name);
10
+ const disabled = plugins.filter((p) => pluginState(p) === "disabled").map((p) => p.name);
11
+ const store = plugins.map((p) => p.name);
8
12
  const storeSet = new Set(store);
9
13
  // Query every registered agent (not just `detect`ed ones): `detect` is a
10
14
  // config-dir heuristic that can miss an installed CLI, and an agent that
@@ -14,7 +18,7 @@ export function pluginStatus(opts) {
14
18
  return agents.map((a) => {
15
19
  const installed = a.listInstalled?.({ pluginsDir: opts.pluginsDir, plugins: [], scope: opts.scope });
16
20
  if (installed === undefined) {
17
- return { id: a.id, displayName: a.displayName, queryable: false, inSync: [], missing: [], agentOnly: [] };
21
+ return { id: a.id, displayName: a.displayName, queryable: false, inSync: [], missing: [], agentOnly: [], disabled: [], unexpectedlyEnabled: [] };
18
22
  }
19
23
  if (isAgentListFailure(installed)) {
20
24
  return {
@@ -26,6 +30,8 @@ export function pluginStatus(opts) {
26
30
  inSync: [],
27
31
  missing: [],
28
32
  agentOnly: [],
33
+ disabled: [],
34
+ unexpectedlyEnabled: [],
29
35
  };
30
36
  }
31
37
  const agentSet = new Set(installed);
@@ -39,9 +45,11 @@ export function pluginStatus(opts) {
39
45
  id: a.id,
40
46
  displayName: a.displayName,
41
47
  queryable: true,
42
- inSync: store.filter((n) => agentSet.has(n)),
43
- missing: store.filter((n) => !agentSet.has(n)),
48
+ inSync: enabled.filter((n) => agentSet.has(n)),
49
+ missing: enabled.filter((n) => !agentSet.has(n)),
44
50
  agentOnly,
51
+ disabled: disabled.filter((n) => !agentSet.has(n)),
52
+ unexpectedlyEnabled: disabled.filter((n) => agentSet.has(n)),
45
53
  };
46
54
  });
47
55
  }
@@ -3,12 +3,16 @@ import { adaptPlugin } from "./adapt.js";
3
3
  import { selectInstalled } from "./projection.js";
4
4
  import { installedPluginDir } from "../paths.js";
5
5
  import { getAgent } from "../agents/index.js";
6
+ import { pluginState } from "../types.js";
6
7
  /** Regenerate manifests for the selected plugins, then refresh them in the agent. */
7
8
  export function syncPlugins(opts) {
8
9
  const agent = opts.agent ?? getAgent(opts.target);
9
10
  const adaptTarget = agent?.adaptTarget ?? opts.target;
10
- const actions = [];
11
- for (const p of selectInstalled(opts.pluginsDir, opts.names)) {
11
+ const selected = selectInstalled(opts.pluginsDir, opts.names);
12
+ const enabled = selected.filter((p) => pluginState(p) === "enabled");
13
+ const disabled = selected.filter((p) => pluginState(p) === "disabled");
14
+ const actions = disabled.map((p) => ({ name: p.name, adapted: [], synced: false }));
15
+ for (const p of enabled) {
12
16
  const dir = installedPluginDir(opts.pluginsDir, p.name, p.origin);
13
17
  if (!existsSync(dir))
14
18
  continue;
@@ -17,13 +21,13 @@ export function syncPlugins(opts) {
17
21
  }
18
22
  if (!agent)
19
23
  return { target: opts.target, actions };
20
- const res = agent.refresh({
21
- pluginsDir: opts.pluginsDir,
22
- plugins: actions.map((a) => a.name),
23
- scope: opts.global ? "user" : "project",
24
- });
25
- for (const a of actions)
26
- if (res.affected.includes(a.name))
27
- a.synced = true;
28
- return { target: opts.target, actions, cliSkipped: res.skipped };
24
+ const scope = opts.global ? "user" : "project";
25
+ const parts = [
26
+ ...(disabled.length > 0 ? [agent.deactivate({ pluginsDir: opts.pluginsDir, plugins: disabled.map((p) => p.name), scope })] : []),
27
+ ...(enabled.length > 0 ? [agent.refresh({ pluginsDir: opts.pluginsDir, plugins: enabled.map((p) => p.name), scope })] : []),
28
+ ];
29
+ for (const action of actions)
30
+ if (parts.some((part) => part.affected.includes(action.name)))
31
+ action.synced = true;
32
+ return { target: opts.target, actions, cliSkipped: parts.length > 0 && parts.every((part) => part.skipped) };
29
33
  }
@@ -1,6 +1,6 @@
1
1
  import { installedPluginDir } from "../paths.js";
2
2
  import { agentsForComponents } from "../agents/index.js";
3
- import { COMPONENT_TYPES } from "../types.js";
3
+ import { COMPONENT_TYPES, pluginState } from "../types.js";
4
4
  function normalizedContents(contents) {
5
5
  return Object.fromEntries(COMPONENT_TYPES.map((type) => [type, contents?.[type] ?? []]));
6
6
  }
@@ -28,6 +28,7 @@ export function pluginsListJson(plugins, pluginsDir) {
28
28
  contents,
29
29
  counts: contentCounts(contents),
30
30
  partial: plugin.selection !== undefined,
31
+ state: pluginState(plugin),
31
32
  };
32
33
  }),
33
34
  };
@@ -1,6 +1,7 @@
1
1
  import { ui, formatColumns, abbrevHome, ellipsizeStart } from "./ui.js";
2
2
  import { installedPluginDir } from "../paths.js";
3
3
  import { agentsForComponents, getAgent } from "../agents/index.js";
4
+ import { pluginState } from "../types.js";
4
5
  // ---------------------------------------------------------------------------
5
6
  // Presentation layer for `adg plugins`. Each function turns command-layer data
6
7
  // into terminal-ready lines (returned as string[]), so bin/adg.ts only parses
@@ -59,16 +60,23 @@ export function renderPluginList(plugins, pluginsDir, opts = {}) {
59
60
  // dimmed as secondary metadata. Widths are measured on the uncolored strings
60
61
  // (above), so wrapping the padded text keeps columns aligned.
61
62
  const out = [];
62
- for (const r of rows) {
63
- const partial = r.p.selection ? " (partial)" : "";
64
- const name = ui.name(r.label.padEnd(nameW));
65
- const path = ui.meta(ellipsizeStart(r.path, pathW).padEnd(pathW));
66
- out.push(`${name} ${path} ${ui.meta("Agents:")} ${r.agents}`);
67
- const provenance = `[${r.p.origin.type}] ${(r.p.folderHash ?? "").slice(0, 19)}${partial}`;
68
- out.push(ui.meta(` ${[provenance, ...r.counts].join(" ")}`));
69
- if (opts.verbose)
70
- out.push(...renderContents(r.p.contents, 4));
71
- }
63
+ const appendRows = (heading, group) => {
64
+ if (group.length === 0)
65
+ return;
66
+ out.push(ui.name(heading));
67
+ for (const r of group) {
68
+ const partial = r.p.selection ? " (partial)" : "";
69
+ const name = ui.name(r.label.padEnd(nameW));
70
+ const path = ui.meta(ellipsizeStart(r.path, pathW).padEnd(pathW));
71
+ out.push(`${name} ${path} ${ui.meta("Agents:")} ${r.agents}`);
72
+ const provenance = `[${r.p.origin.type}] ${(r.p.folderHash ?? "").slice(0, 19)}${partial}`;
73
+ out.push(ui.meta(` ${[provenance, ...r.counts].join(" ")}`));
74
+ if (opts.verbose)
75
+ out.push(...renderContents(r.p.contents, 4));
76
+ }
77
+ };
78
+ appendRows("Enabled", rows.filter((row) => pluginState(row.p) === "enabled"));
79
+ appendRows("Disabled", rows.filter((row) => pluginState(row.p) === "disabled"));
72
80
  return out;
73
81
  }
74
82
  /**
@@ -137,6 +145,13 @@ export function renderStatus(statuses) {
137
145
  out.push(ui.warn(` in agent only (${s.agentOnly.length}): ${s.agentOnly.join(", ")}`));
138
146
  out.push(ui.meta(` → if ADG-managed, adg plugins unlink --target ${s.id} <name> (else ignore)`));
139
147
  }
148
+ if (s.disabled.length > 0) {
149
+ out.push(ui.meta(` disabled (${s.disabled.length}): ${s.disabled.join(", ")}`));
150
+ }
151
+ if (s.unexpectedlyEnabled.length > 0) {
152
+ out.push(ui.warn(` unexpectedly enabled (${s.unexpectedlyEnabled.length}): ${s.unexpectedlyEnabled.join(", ")}`));
153
+ out.push(ui.meta(` → adg plugins sync --target ${s.id} ${s.unexpectedlyEnabled.join(" ")}`));
154
+ }
140
155
  }
141
156
  const totalSync = statuses.reduce((acc, s) => acc + s.inSync.length + s.missing.length, 0);
142
157
  const totalAgentOnly = statuses.reduce((acc, s) => acc + s.agentOnly.length, 0);
@@ -0,0 +1,39 @@
1
+ import { prereleaseChannel } from "./semver.js";
2
+ export const PACKAGE_NAME = "@rbbtsn0w/adg";
3
+ export function parseSelfUpdateArgs(args) {
4
+ const options = { beta: false, help: false };
5
+ for (const arg of args) {
6
+ if (arg === "--beta" || arg === "-b") {
7
+ options.beta = true;
8
+ continue;
9
+ }
10
+ if (arg === "--help" || arg === "-h") {
11
+ options.help = true;
12
+ continue;
13
+ }
14
+ throw new Error(arg.startsWith("-")
15
+ ? `unknown flag for \`adg update\`: ${arg}`
16
+ : `adg update takes no positional arguments (got: ${arg})`);
17
+ }
18
+ return options;
19
+ }
20
+ export function selfUpdateTarget(beta) {
21
+ return beta ? "beta" : "latest";
22
+ }
23
+ export function selfUpdateCommand(beta, npmBin = "npm") {
24
+ return {
25
+ command: npmBin,
26
+ args: ["install", "-g", `${PACKAGE_NAME}@${selfUpdateTarget(beta)}`],
27
+ };
28
+ }
29
+ export function selfUpdateHint(latestVersion) {
30
+ return prereleaseChannel(latestVersion) ? "adg update --beta" : "adg update";
31
+ }
32
+ export const SELF_UPDATE_USAGE = `adg update — upgrade the ADG CLI
33
+
34
+ Usage:
35
+ adg update
36
+ Install the latest stable release with npm.
37
+ adg update --beta
38
+ adg update -b
39
+ Install the latest beta release with npm.`;
package/dist/src/types.js CHANGED
@@ -5,6 +5,9 @@ export const ADG_SCHEMA_VERSION = "adg.plugin/v1";
5
5
  export const LOCK_VERSION = 2;
6
6
  /** The component categories a plugin can expose. */
7
7
  export const COMPONENT_TYPES = ["skills", "agents", "commands", "mcp", "hooks", "apps"];
8
+ export function pluginState(entry) {
9
+ return entry?.state ?? "enabled";
10
+ }
8
11
  /** Structural equality for provenance/source comparison (collision checks). */
9
12
  export function sameSource(a, b) {
10
13
  if (a.type !== b.type)
@@ -11,7 +11,7 @@ import https from "node:https";
11
11
  import { homedir } from "node:os";
12
12
  import { join } from "node:path";
13
13
  import { compareVersions, prereleaseChannel } from "./semver.js";
14
- const PACKAGE_NAME = "@rbbtsn0w/adg";
14
+ import { selfUpdateHint, PACKAGE_NAME } from "./self-update.js";
15
15
  // URL-encode the slash in the scoped package name for the npm registry API.
16
16
  // The abbreviated packument (vnd.npm.install-v1+json) is small and exposes
17
17
  // `dist-tags`, which we need to follow the caller's release channel (e.g. the
@@ -158,11 +158,7 @@ export function checkForUpdate(currentVersion, env = process.env, refresh = sche
158
158
  }
159
159
  /** Format an update notice for display on stderr. */
160
160
  export function formatUpdateNotice(currentVersion, latestVersion) {
161
- // A pre-release suggestion lives on its channel dist-tag (e.g. `beta`), not
162
- // `latest`; installing `@latest` would pull the stable release instead of the
163
- // advertised version. Pin to the exact version so the right artifact installs.
164
- const channel = prereleaseChannel(latestVersion);
165
- const installTarget = channel ? latestVersion : "latest";
166
161
  return (`\n Update available: ${currentVersion} → ${latestVersion}\n` +
167
- ` Run: npm install -g ${PACKAGE_NAME}@${installTarget}\n`);
162
+ ` Run: ${selfUpdateHint(latestVersion)}\n` +
163
+ ` npm: npm install -g ${PACKAGE_NAME}@${prereleaseChannel(latestVersion) ? "beta" : "latest"}\n`);
168
164
  }
package/docs/cli-json.md CHANGED
@@ -55,7 +55,8 @@ Shape:
55
55
  "hooks": 0,
56
56
  "apps": 0
57
57
  },
58
- "partial": false
58
+ "partial": false,
59
+ "state": "enabled"
59
60
  }
60
61
  ]
61
62
  }
@@ -71,6 +72,8 @@ Field notes:
71
72
  - `counts` mirrors `contents` lengths.
72
73
  - `partial` is true when the installed plugin has a stored partial-install
73
74
  selection.
75
+ - `state` is always normalized to `enabled` or `disabled`; legacy lock entries
76
+ without an explicit state are reported as `enabled`.
74
77
 
75
78
  ## `adg plugins status --json`
76
79
 
@@ -88,7 +91,9 @@ Shape:
88
91
  "queryable": true,
89
92
  "inSync": ["apple-skills"],
90
93
  "missing": [],
91
- "agentOnly": []
94
+ "agentOnly": [],
95
+ "disabled": [],
96
+ "unexpectedlyEnabled": []
92
97
  }
93
98
  ]
94
99
  }
@@ -105,6 +110,9 @@ Field notes:
105
110
  query, `queryError` contains its diagnostic and `recoveryCommand` contains a
106
111
  safe repair command when ADG recognizes the failure. Both fields are omitted
107
112
  when unavailable.
108
- - `inSync`, `missing`, and `agentOnly` are name-level comparisons. Content drift
109
- is not represented; use `adg plugins sync` when a full runtime refresh is
110
- required.
113
+ - `inSync` and `missing` apply only to store-enabled plugins. `disabled` contains
114
+ store-disabled plugins absent from the runtime as intended;
115
+ `unexpectedlyEnabled` contains disabled plugins still active in that runtime.
116
+ `agentOnly` remains reserved for runtime plugins absent from the store.
117
+ Content drift is not represented; use `adg plugins sync` when a full runtime
118
+ refresh is required.
@@ -123,3 +123,22 @@ Repair drift with:
123
123
  ```bash
124
124
  adg plugins sync --target <runtime> <plugin-name> --global
125
125
  ```
126
+
127
+ ## Persistent Disablement
128
+
129
+ Use store-level disablement when a plugin should remain installed and updateable
130
+ without being loaded by any runtime:
131
+
132
+ ```bash
133
+ adg plugins disable <plugin-name> --global
134
+ adg plugins enable <plugin-name> --global
135
+ ```
136
+
137
+ `disable` keeps the payload and marketplace catalog entry in ADG's store, records
138
+ the desired state in `.plugin-lock.json`, and removes the plugin from every
139
+ registered runtime. `enable` restores disabled dependencies first, regenerates
140
+ runtime projections, and activates the plugin in each compatible runtime.
141
+
142
+ `unlink --target <runtime>` is different: it is a temporary per-runtime override
143
+ and does not change store state. A later `sync` restores the store's enabled or
144
+ disabled state. `remove` deletes the payload and catalog entry entirely.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbbtsn0w/adg",
3
- "version": "0.5.0-beta.3",
3
+ "version": "0.5.0-beta.4",
4
4
  "description": "Agent Directory Group (ADG) toolkit — two domains: plugins and skills.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -32,6 +32,10 @@
32
32
  },
33
33
  "installedAt": { "type": "string", "format": "date-time" },
34
34
  "updatedAt": { "type": "string", "format": "date-time" },
35
+ "state": {
36
+ "enum": ["enabled", "disabled"],
37
+ "description": "Desired cross-agent projection state. Absent means enabled."
38
+ },
35
39
  "dependencies": {
36
40
  "type": "object",
37
41
  "additionalProperties": { "type": "string" }