@rbbtsn0w/adg 0.4.0-beta.6 → 0.4.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
@@ -64,6 +64,10 @@ adg plugins update --global
64
64
  adg plugins list --global
65
65
  ```
66
66
 
67
+ Machine consumers can use `adg plugins list --json` and
68
+ `adg plugins status --json`; see [docs/cli-json.md](docs/cli-json.md) for the
69
+ stable output and exit-code contract.
70
+
67
71
  `adg` is the only command you invoke — no Node build step beyond the global
68
72
  install. To hack on the CLI itself, see [Developing from source](#developing-from-source).
69
73
 
@@ -247,6 +251,9 @@ record; **agents are projections** of it (`link` / `unlink` toggle one agent;
247
251
  every agent at once — for per-agent control use `unlink`. When something looks
248
252
  off, `status` shows the drift and `sync` repairs it.
249
253
 
254
+ For the local-directory-source flow into Claude's registry/cache, see
255
+ [docs/local-plugin-registration.md](docs/local-plugin-registration.md).
256
+
250
257
  #### On-disk layout
251
258
 
252
259
  Plugins are grouped on disk by the source they came from. Remote installs nest
@@ -21,6 +21,7 @@ import { globalPluginsDir, projectPluginsDir, lockPath } from "../paths.js";
21
21
  import { getAgent } from "../agents/index.js";
22
22
  import { ui } from "../render/ui.js";
23
23
  import { renderAgentReport, renderMarketplaceList, renderPluginList, renderStatus, renderUpdateReport, } from "../render/plugins.js";
24
+ import { pluginsListJson, pluginsStatusJson, printJson } from "../render/json.js";
24
25
  import { MARKETPLACE_USAGE, PLUGIN_ALIASES, PLUGIN_COMMANDS, SCOPE, fail, parseVerb, renderPluginsHelp, renderVerbHelp, requireSingleTarget, resolveComponents, resolveScopeDir, resolveTargets, scopeOf, wantsHelp, } from "./index.js";
25
26
  /**
26
27
  * Resolve which scope(s) `plugins update` should refresh, mirroring
@@ -402,6 +403,10 @@ async function runPluginsVerb(verb, rest, cmd) {
402
403
  const { values } = parseVerb(verb, cmd.flags, rest);
403
404
  const pluginsDir = resolveScopeDir(values);
404
405
  const plugins = listPlugins(pluginsDir);
406
+ if (values.json) {
407
+ printJson(pluginsListJson(plugins, pluginsDir));
408
+ return;
409
+ }
405
410
  for (const line of renderPluginList(plugins, pluginsDir, { verbose: values.verbose })) {
406
411
  console.log(line);
407
412
  }
@@ -409,8 +414,14 @@ async function runPluginsVerb(verb, rest, cmd) {
409
414
  }
410
415
  case "status": {
411
416
  const { values } = parseVerb(verb, cmd.flags, rest);
412
- const targets = values.target !== undefined ? resolveTargets(values.target) : undefined;
413
- const statuses = pluginStatus({ pluginsDir: resolveScopeDir(values), scope: scopeOf(values), targets });
417
+ const targets = resolveTargets(values.target);
418
+ const pluginsDir = resolveScopeDir(values);
419
+ const scope = scopeOf(values);
420
+ const statuses = pluginStatus({ pluginsDir, scope, targets });
421
+ if (values.json) {
422
+ printJson(pluginsStatusJson(statuses, pluginsDir, scope, targets));
423
+ return;
424
+ }
414
425
  for (const line of renderStatus(statuses))
415
426
  console.log(line);
416
427
  return;
@@ -29,6 +29,7 @@ export const FLAGS = {
29
29
  as: { type: "string", hint: "<name>", help: "plugin name to wrap the skills as" },
30
30
  prefix: { type: "string", hint: "<p>", help: "prefix imported skill names" },
31
31
  verbose: { type: "boolean", short: "v", help: "expand each component to its member names" },
32
+ json: { type: "boolean", help: "print stable machine-readable JSON" },
32
33
  };
33
34
  // Scope flags recur on almost every command; name the group once.
34
35
  export const SCOPE = ["project", "global", "dir"];
@@ -61,13 +62,13 @@ export const PLUGIN_COMMANDS = {
61
62
  summary: "list installed plugins",
62
63
  synopsis: "adg plugins list",
63
64
  blurb: "Each plugin shows a one-line summary of what it contains. Add --verbose\nto expand every component (skills, agents, commands, …) to its member names.",
64
- flags: ["verbose", ...SCOPE],
65
+ flags: ["verbose", "json", ...SCOPE],
65
66
  },
66
67
  status: {
67
68
  summary: "show store-vs-agent drift per runtime",
68
69
  synopsis: "adg plugins status [--target claude|codex|antigravity]",
69
70
  blurb: "Query each agent's CLI live and diff it against the store: what's in\nsync, missing (needs `link`/`sync`), or present in the agent only. Each drift\nrow carries the command that repairs it. Inspects the active scope (--global →\nuser, else project). Name-level only — run `sync` if unsure.",
70
- flags: ["target", ...SCOPE],
71
+ flags: ["target", "json", ...SCOPE],
71
72
  },
72
73
  update: {
73
74
  summary: "pull upstream changes for installed plugins",
@@ -0,0 +1,41 @@
1
+ import { installedPluginDir } from "../paths.js";
2
+ import { agentsForComponents } from "../agents/index.js";
3
+ import { COMPONENT_TYPES } from "../types.js";
4
+ function normalizedContents(contents) {
5
+ return Object.fromEntries(COMPONENT_TYPES.map((type) => [type, contents?.[type] ?? []]));
6
+ }
7
+ function contentCounts(contents) {
8
+ return Object.fromEntries(COMPONENT_TYPES.map((type) => [type, contents[type].length]));
9
+ }
10
+ function contentTypes(contents) {
11
+ return COMPONENT_TYPES.filter((type) => contents[type].length > 0);
12
+ }
13
+ /** Stable machine-readable shape for `adg plugins list --json`. */
14
+ export function pluginsListJson(plugins, pluginsDir) {
15
+ return {
16
+ pluginsDir,
17
+ plugins: plugins.map((plugin) => {
18
+ const contents = normalizedContents(plugin.contents);
19
+ return {
20
+ name: plugin.name,
21
+ version: plugin.version,
22
+ source: plugin.origin,
23
+ folderHash: plugin.folderHash,
24
+ installedAt: plugin.installedAt,
25
+ updatedAt: plugin.updatedAt,
26
+ path: installedPluginDir(pluginsDir, plugin.name, plugin.origin),
27
+ agents: agentsForComponents(contentTypes(contents)).map((agent) => agent.id),
28
+ contents,
29
+ counts: contentCounts(contents),
30
+ partial: plugin.selection !== undefined,
31
+ };
32
+ }),
33
+ };
34
+ }
35
+ /** Stable machine-readable shape for `adg plugins status --json`. */
36
+ export function pluginsStatusJson(statuses, pluginsDir, scope, targets) {
37
+ return { pluginsDir, scope, targets, statuses };
38
+ }
39
+ export function printJson(value) {
40
+ console.log(JSON.stringify(value, null, 2));
41
+ }
package/docs/authoring.md CHANGED
@@ -384,8 +384,11 @@ here, at consumption time:
384
384
  └── .claude-plugin/marketplace.json # Claude-facing discovery export
385
385
  ```
386
386
 
387
- The runtimes (Claude, Codex) discover the plugin through their respective
388
- `marketplace.json`; you do not need to configure them by hand.
387
+ After `add`, run `link` or `sync` for the runtimes that should see the plugin.
388
+ Claude keeps its own registry/cache, so local directory-source plugins are not
389
+ fully visible there until ADG links or syncs them. See
390
+ [local-plugin-registration.md](local-plugin-registration.md) for the supported
391
+ integrator flow and the Claude registration boundary.
389
392
 
390
393
  ### Legacy note
391
394
 
@@ -0,0 +1,107 @@
1
+ # CLI JSON Output Contract
2
+
3
+ ADG exposes stable JSON output for read-only plugin commands so external tools
4
+ can integrate over the CLI boundary without scraping human-formatted text.
5
+
6
+ ## General Contract
7
+
8
+ - Supported commands in this contract:
9
+ - `adg plugins list --json`
10
+ - `adg plugins status --json`
11
+ - On success, stdout contains exactly one valid JSON document and no human
12
+ formatting, ANSI color, notes, or tips.
13
+ - On failure, diagnostics are written to stderr and the process exits non-zero.
14
+ JSON error envelopes are not part of this contract.
15
+ - Existing fields documented here are stable. Future releases may add fields;
16
+ callers should ignore unknown fields.
17
+
18
+ ## Exit Codes
19
+
20
+ | Code | Meaning |
21
+ | --- | --- |
22
+ | `0` | Command succeeded; stdout is complete and parseable. |
23
+ | `1` | Invalid arguments, missing required input, validation/runtime error, unknown option, or command failure. |
24
+
25
+ ## `adg plugins list --json`
26
+
27
+ Shape:
28
+
29
+ ```json
30
+ {
31
+ "pluginsDir": "/absolute/path/to/.agents/plugins",
32
+ "plugins": [
33
+ {
34
+ "name": "apple-skills",
35
+ "version": "1.13.2",
36
+ "source": { "type": "github", "repo": "RbBtSn0w/apple-skills" },
37
+ "folderHash": "sha256-...",
38
+ "installedAt": "2026-06-26T00:00:00.000Z",
39
+ "updatedAt": "2026-06-26T00:00:00.000Z",
40
+ "path": "/absolute/path/to/.agents/plugins/RbBtSn0w__apple-skills/apple-skills",
41
+ "agents": ["claude", "codex", "antigravity"],
42
+ "contents": {
43
+ "skills": ["xcode-build-fixer"],
44
+ "agents": [],
45
+ "commands": [],
46
+ "mcp": ["xcode"],
47
+ "hooks": [],
48
+ "apps": []
49
+ },
50
+ "counts": {
51
+ "skills": 1,
52
+ "agents": 0,
53
+ "commands": 0,
54
+ "mcp": 1,
55
+ "hooks": 0,
56
+ "apps": 0
57
+ },
58
+ "partial": false
59
+ }
60
+ ]
61
+ }
62
+ ```
63
+
64
+ Field notes:
65
+
66
+ - `pluginsDir` and each `path` are absolute filesystem paths.
67
+ - `source` is ADG's lock-file provenance object.
68
+ - `agents` contains stable agent ids, not display names.
69
+ - `contents` always includes every component category, using empty arrays when a
70
+ plugin has none of that category.
71
+ - `counts` mirrors `contents` lengths.
72
+ - `partial` is true when the installed plugin has a stored partial-install
73
+ selection.
74
+
75
+ ## `adg plugins status --json`
76
+
77
+ Shape:
78
+
79
+ ```json
80
+ {
81
+ "pluginsDir": "/absolute/path/to/.agents/plugins",
82
+ "scope": "user",
83
+ "targets": ["claude"],
84
+ "statuses": [
85
+ {
86
+ "id": "claude",
87
+ "displayName": "Claude Code",
88
+ "queryable": true,
89
+ "inSync": ["apple-skills"],
90
+ "missing": [],
91
+ "agentOnly": []
92
+ }
93
+ ]
94
+ }
95
+ ```
96
+
97
+ Field notes:
98
+
99
+ - `scope` is the agent install scope: `user` for `--global`, otherwise
100
+ `project`.
101
+ - `targets` contains the resolved target ids requested by `--target`; omitted
102
+ `--target` resolves to all registered targets.
103
+ - `queryable: false` means the agent CLI could not be queried; the arrays are
104
+ then empty because live state is unknown.
105
+ - `inSync`, `missing`, and `agentOnly` are name-level comparisons. Content drift
106
+ is not represented; use `adg plugins sync` when a full runtime refresh is
107
+ required.
@@ -0,0 +1,125 @@
1
+ # Local Plugin Registration
2
+
3
+ This note documents the supported flow for taking a local directory-source
4
+ plugin and making it available in Claude, Codex, and Antigravity through ADG.
5
+ Integrators should rely on these commands instead of editing runtime-private
6
+ registry files.
7
+
8
+ ## End-to-End Flow
9
+
10
+ Given a local plugin directory with a canonical `.agents/.plugin.json`:
11
+
12
+ ```bash
13
+ adg plugins add <plugin-dir> --global
14
+ adg plugins link --target all <plugin-name> --global
15
+ ```
16
+
17
+ Use `sync` instead of `link` when you want a clean runtime refresh:
18
+
19
+ ```bash
20
+ adg plugins sync --target all <plugin-name> --global
21
+ ```
22
+
23
+ Both `link` and `sync` are idempotent and safe to re-run. The recommended
24
+ integrator pattern is:
25
+
26
+ 1. Run `add` to copy the directory-source plugin into ADG's store.
27
+ 2. Run `link` or `sync` for each runtime target that should see the plugin.
28
+ 3. Re-run `sync` to self-heal runtime drift after updates, manual cleanup, or
29
+ suspected stale runtime caches.
30
+
31
+ ## What `add` Writes
32
+
33
+ `adg plugins add <plugin-dir> --global` records the plugin in the global ADG
34
+ store:
35
+
36
+ ```text
37
+ ~/.agents/plugins/
38
+ ├── <plugin-name>/
39
+ │ ├── .agents/.plugin.json
40
+ │ ├── .claude-plugin/plugin.json
41
+ │ ├── .codex-plugin/plugin.json
42
+ │ └── ...
43
+ ├── .plugin-lock.json
44
+ ├── marketplace.json
45
+ └── .claude-plugin/marketplace.json
46
+ ```
47
+
48
+ For a local directory source, the lock provenance uses `source.type: "local"`.
49
+ The generated marketplace entries make the plugin a member of ADG's local
50
+ `adg` marketplace. At this point ADG has stored and adapted the plugin, but a
51
+ runtime that keeps its own registry may still need a `link` or `sync` step.
52
+
53
+ ## Claude Registration
54
+
55
+ Claude Code does not become fully registered just because the plugin exists in
56
+ `~/.agents/plugins`. Register it through ADG:
57
+
58
+ ```bash
59
+ adg plugins link --target claude <plugin-name> --global
60
+ ```
61
+
62
+ or refresh it through ADG:
63
+
64
+ ```bash
65
+ adg plugins sync --target claude <plugin-name> --global
66
+ ```
67
+
68
+ ADG drives Claude's plugin CLI and lets Claude own its private registry. A
69
+ successful registration creates or updates a Claude entry equivalent to:
70
+
71
+ ```json
72
+ {
73
+ "plugins": {
74
+ "<plugin-name>@adg": [
75
+ {
76
+ "scope": "user",
77
+ "installPath": "~/.claude/plugins/cache/adg/<plugin-name>/<version>",
78
+ "version": "<version>",
79
+ "installedAt": "<timestamp>",
80
+ "lastUpdated": "<timestamp>"
81
+ }
82
+ ]
83
+ }
84
+ }
85
+ ```
86
+
87
+ The concrete file is `~/.claude/plugins/installed_plugins.json`, and Claude also
88
+ keeps a cached copy under `~/.claude/plugins/cache/adg/<plugin-name>/<version>`.
89
+ These paths describe the contract boundary for integrators, but they are
90
+ Claude-managed implementation details. Do not hand-edit them; use ADG
91
+ `link`/`sync`/`unlink`.
92
+
93
+ For project installs, the Claude entry uses `scope: "project"` and records a
94
+ `projectPath`. For global installs, the entry uses `scope: "user"`.
95
+
96
+ ## Other Runtimes
97
+
98
+ Codex reads the ADG marketplace export directly from `~/.agents/plugins`, but
99
+ `link --target codex` is still the supported way to regenerate projections and
100
+ ensure the runtime sees the latest store state.
101
+
102
+ Antigravity imports from ADG's generated `.antigravity-plugin/` projection.
103
+ Use `link --target antigravity` for first registration and `sync --target
104
+ antigravity` when you need to clear stale imported components.
105
+
106
+ ## Operational Checks
107
+
108
+ Use these read commands rather than scraping runtime-private files:
109
+
110
+ ```bash
111
+ adg plugins list --global --json
112
+ adg plugins status --target claude --global --json
113
+ ```
114
+
115
+ `status` reports name-level drift:
116
+
117
+ - `inSync`: present in both ADG's store and the runtime.
118
+ - `missing`: present in ADG's store but not linked into the runtime.
119
+ - `agentOnly`: present in the runtime but absent from ADG's store.
120
+
121
+ Repair drift with:
122
+
123
+ ```bash
124
+ adg plugins sync --target <runtime> <plugin-name> --global
125
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbbtsn0w/adg",
3
- "version": "0.4.0-beta.6",
3
+ "version": "0.4.0-beta.7",
4
4
  "description": "Agent Directory Group (ADG) toolkit — two domains: plugins and skills.",
5
5
  "type": "module",
6
6
  "license": "MIT",