@rbbtsn0w/adg 0.4.0-beta.5 → 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
 
@@ -152,7 +156,7 @@ asc/
152
156
  ├── .claude-plugin/plugin.json generated by `adg plugins adapt`
153
157
  ├── .codex-plugin/plugin.json generated by `adg plugins adapt`
154
158
  ├── skills/<kebab-name>/SKILL.md
155
- ├── agents/ commands/ hooks/ mcp/ apps/
159
+ ├── agents/ commands/ hooks/ apps/ .mcp.json
156
160
  └── README.md
157
161
  ```
158
162
 
@@ -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
@@ -2,6 +2,7 @@ import { existsSync, readdirSync, statSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { resolveProjectedSkills } from "../skills.js";
4
4
  import { isExposed } from "../components.js";
5
+ import { mcpConfigPath } from "../mcp.js";
5
6
  /**
6
7
  * Claude auto-loads this plugin-relative path; declaring it in `manifest.hooks`
7
8
  * duplicates the load and fails ("Duplicate hooks file detected").
@@ -78,8 +79,9 @@ export function toAnthropicManifest(pluginDir, manifest, selection) {
78
79
  if (hooksFile)
79
80
  out.hooks = hooksFile;
80
81
  }
81
- if (manifest.mcp && isExposed(selection, "mcp"))
82
- out.mcp = manifest.mcp;
82
+ const mcp = mcpConfigPath(manifest);
83
+ if (mcp && isExposed(selection, "mcp"))
84
+ out.mcpServers = mcp;
83
85
  if (manifest.apps && isExposed(selection, "apps"))
84
86
  out.apps = manifest.apps;
85
87
  // Claude's array form is already `./skills/<id>` paths, so a strict array is
@@ -1,18 +1,20 @@
1
1
  import { join } from "node:path";
2
+ import { isExposed } from "../components.js";
3
+ import { mcpConfigPath } from "../mcp.js";
2
4
  /** Projection subdirectory that holds the self-contained agy plugin root. */
3
5
  export const ANTIGRAVITY_PROJECTION_DIR = ".antigravity-plugin";
4
6
  /**
5
7
  * Generate an Antigravity (`agy`) plugin.json from an ADG manifest.
6
8
  *
7
- * Antigravity's manifest is minimal: it reads only `name` from a `plugin.json`
8
- * and discovers components by convention (sibling `skills/`, `agents/`,
9
- * `commands/`, `hooks/` directories plus a `mcp_config.json`) — all resolved
10
- * relative to the directory handed to `agy plugin install`, with no manifest
11
- * path indirection. We therefore project a self-contained agy plugin root under
12
- * `.antigravity-plugin/`: this pure transform emits its `plugin.json`, while the
13
- * agent materializes the rest (mcp_config.json + symlinked component dirs), so a
14
- * partial-install `selection` is not expressible for this target.
9
+ * Antigravity reads the same plugin.json MCP pointer shape as the other plugin
10
+ * runtimes (`mcpServers`). The agent-side projection still materializes a
11
+ * self-contained root for partial installs by copying the referenced file next
12
+ * to plugin.json and linking selected component dirs.
15
13
  */
16
- export function toAntigravityManifest(_pluginDir, manifest, _selection) {
17
- return { defaultPath: join(ANTIGRAVITY_PROJECTION_DIR, "plugin.json"), manifest: { name: manifest.name } };
14
+ export function toAntigravityManifest(_pluginDir, manifest, selection) {
15
+ const out = { name: manifest.name };
16
+ const mcp = mcpConfigPath(manifest);
17
+ if (mcp && isExposed(selection, "mcp"))
18
+ out.mcpServers = mcp;
19
+ return { defaultPath: join(ANTIGRAVITY_PROJECTION_DIR, "plugin.json"), manifest: out };
18
20
  }
@@ -2,6 +2,7 @@ import { existsSync, readdirSync, statSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { resolveProjectedSkills } from "../skills.js";
4
4
  import { isExposed } from "../components.js";
5
+ import { mcpConfigPath } from "../mcp.js";
5
6
  /**
6
7
  * Resolve the hooks config *file* Codex should reference. ADG declares `hooks` as
7
8
  * a directory, but Codex (unlike Claude) has no auto-load — it needs an explicit
@@ -37,7 +38,9 @@ export function resolveCodexHooksFile(pluginDir, hooks) {
37
38
  * declared as *paths* (`./skills/foo`), so they are resolved to identifiers
38
39
  * rather than passed through. Beyond skills, Codex also consumes `hooks` — but as
39
40
  * an explicit config *file* (no auto-load), so a declared hooks directory is
40
- * resolved to its Codex-variant file via `resolveCodexHooksFile`.
41
+ * resolved to its Codex-variant file via `resolveCodexHooksFile`. ADG uses
42
+ * Codex's `mcpServers` key as the canonical MCP config pointer, so that field
43
+ * passes through under the same runtime key.
41
44
  */
42
45
  export function toCodexManifest(pluginDir, manifest, selection) {
43
46
  // Codex's array form is bare ids, so a strict skills *array* is resolved to
@@ -60,5 +63,8 @@ export function toCodexManifest(pluginDir, manifest, selection) {
60
63
  if (hooksFile)
61
64
  out.hooks = hooksFile;
62
65
  }
66
+ const mcp = mcpConfigPath(manifest);
67
+ if (mcp && isExposed(selection, "mcp"))
68
+ out.mcpServers = mcp;
63
69
  return { defaultPath: join(".codex-plugin", "plugin.json"), manifest: out };
64
70
  }
@@ -16,15 +16,15 @@ export const ADAPTER_TARGETS = ["claude", "codex", "antigravity"];
16
16
  /**
17
17
  * Component categories each adapter target can actually express, mirroring what
18
18
  * the adapters emit: the Claude manifest carries skills/agents/commands/hooks/mcp
19
- * plus apps (`toAnthropicManifest`), while Codex consumes skills and hooks
19
+ * plus apps (`toAnthropicManifest`), while Codex consumes skills/hooks/mcp
20
20
  * (`toCodexManifest`). Antigravity (`agy`) discovers components by convention
21
- * (skills/agents/commands/hooks dirs + mcp_config.json) and does not surface
21
+ * (skills/agents/commands/hooks dirs + plugin.json pointers) and does not surface
22
22
  * apps, so apps maps only to the Claude target. Used to derive which agents a
23
23
  * plugin is adaptable to from its exposed component types.
24
24
  */
25
25
  export const ADAPTER_COMPONENTS = {
26
26
  claude: ["skills", "agents", "commands", "hooks", "mcp", "apps"],
27
- codex: ["skills", "hooks"],
27
+ codex: ["skills", "hooks", "mcp"],
28
28
  antigravity: ["skills", "agents", "commands", "hooks", "mcp"],
29
29
  };
30
30
  export { toAnthropicManifest, toCodexManifest, toAntigravityManifest };
@@ -35,7 +35,7 @@ export function fromNativeManifest(raw, kind) {
35
35
  copyIfString(n, out, "commands");
36
36
  copyIfString(n, out, "agents");
37
37
  copyIfString(n, out, "hooks");
38
- copyIfString(n, out, "mcp");
38
+ copyIfString(n, out, "mcpServers");
39
39
  copyIfString(n, out, "apps");
40
40
  if (typeof n.author === "object" && n.author !== null) {
41
41
  manifest.author = n.author;
@@ -8,16 +8,16 @@ import { isExposed } from "../components.js";
8
8
  import { installedPluginDir, lockPath } from "../paths.js";
9
9
  import { readLock } from "../lock.js";
10
10
  import { ANTIGRAVITY_PROJECTION_DIR } from "../adapters/antigravity.js";
11
+ import { mcpConfigPath } from "../mcp.js";
11
12
  import { makeCli, skippedResult } from "./base.js";
12
13
  /**
13
14
  * Antigravity (`agy`) agent.
14
15
  *
15
16
  * Antigravity discovers a plugin by convention relative to the directory handed
16
17
  * to `agy plugin install` — `plugin.json` plus sibling `skills/`, `agents/`,
17
- * `commands/`, `hooks/` dirs and a `mcp_config.json`, with no manifest path
18
- * indirection. We therefore project a self-contained agy plugin root under
19
- * `<store>/.antigravity-plugin/`: generated `plugin.json` + `mcp_config.json`
20
- * (the ADG `mcp/.mcp.json` shape is exactly agy's, so it passes through) and
18
+ * `commands/`, `hooks/` dirs plus plugin.json path pointers. We therefore
19
+ * project a self-contained agy plugin root under `<store>/.antigravity-plugin/`:
20
+ * generated `plugin.json` + copied MCP config (when selected) and
21
21
  * *symlinks* to the real component dirs one level up, so nothing is duplicated
22
22
  * on disk. agy follows these symlinks; where the platform forbids them (e.g.
23
23
  * Windows without privilege) we fall back to a copy. We then drive
@@ -76,11 +76,23 @@ function linkOrCopy(linkPath, absTarget) {
76
76
  cpSync(absTarget, linkPath, { recursive: true });
77
77
  }
78
78
  }
79
+ /** Link a file with a relative symlink, copying instead when symlinks fail. */
80
+ function linkFileOrCopy(linkPath, absTarget) {
81
+ rmSync(linkPath, { force: true });
82
+ ensureDir(dirname(linkPath));
83
+ try {
84
+ symlinkSync(relative(dirname(linkPath), absTarget), linkPath, "file");
85
+ }
86
+ catch {
87
+ cpSync(absTarget, linkPath);
88
+ }
89
+ }
79
90
  /**
80
91
  * Build the agy-native projection under `<dir>/.antigravity-plugin/`: a
81
- * `plugin.json` (name only), a `mcp_config.json` copied verbatim from the
82
- * manifest's mcp file when present, and relative symlinks (copy fallback) to the
83
- * declared component dirs named for agy's convention.
92
+ * `plugin.json`, an MCP config file copied verbatim from the manifest's
93
+ * `mcpServers` pointer when present, an agy-conventional `mcp_config.json` link
94
+ * to that file, and relative symlinks (copy fallback) to the declared component
95
+ * dirs named for agy's convention.
84
96
  *
85
97
  * An optional `selection` (the plugin's partial install) narrows what is
86
98
  * projected: component categories outside it are dropped, and `skills` is pinned
@@ -92,16 +104,25 @@ export function writeAntigravityProjection(dir, selection) {
92
104
  const manifest = readManifest(dir);
93
105
  const stage = join(dir, ANTIGRAVITY_PROJECTION_DIR);
94
106
  ensureDir(stage);
95
- writeJson(join(stage, "plugin.json"), { name: manifest.name });
96
- const mcpConfig = join(stage, "mcp_config.json");
97
- rmSync(mcpConfig, { force: true });
98
- if (manifest.mcp && isExposed(selection, "mcp")) {
99
- const mcpFile = join(dir, manifest.mcp);
100
- // The ADG mcp file shape is exactly agy's `mcp_config.json`, so copy it
101
- // verbatim — preserving formatting and avoiding a parse/re-serialize round-trip.
102
- if (existsSync(mcpFile))
103
- cpSync(mcpFile, mcpConfig);
107
+ rmSync(join(stage, "mcp_config.json"), { force: true });
108
+ const mcp = mcpConfigPath(manifest);
109
+ const pluginJson = { name: manifest.name };
110
+ if (mcp && isExposed(selection, "mcp")) {
111
+ pluginJson.mcpServers = mcp;
112
+ const mcpFile = join(dir, mcp);
113
+ const projectedMcp = join(stage, mcp);
114
+ rmSync(projectedMcp, { force: true });
115
+ ensureDir(dirname(projectedMcp));
116
+ // Copy verbatim — preserving formatting and avoiding a parse/re-serialize round-trip.
117
+ if (existsSync(mcpFile)) {
118
+ cpSync(mcpFile, projectedMcp);
119
+ linkFileOrCopy(join(stage, "mcp_config.json"), projectedMcp);
120
+ }
121
+ }
122
+ else {
123
+ rmSync(join(stage, mcp || ".mcp.json"), { force: true });
104
124
  }
125
+ writeJson(join(stage, "plugin.json"), pluginJson);
105
126
  const skillsDir = join(stage, "skills");
106
127
  rmSync(skillsDir, { recursive: true, force: true });
107
128
  if (manifest.skills !== undefined && isExposed(selection, "skills")) {
@@ -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",
@@ -284,15 +284,18 @@ export async function addPlugins(opts) {
284
284
  const resolved = opts.agents ?? resolveAgents(targets);
285
285
  const scope = opts.scope ?? "project";
286
286
  const ctxFor = (names) => ({ pluginsDir: opts.pluginsDir, plugins: names, scope });
287
- // A "changed" plugin is either brand new (no prior lock entry) or an update
288
- // to an already-installed one. Only updates go through refresh — agents that
289
- // cache a copy (Claude) must drop the stale one and re-pull. Brand-new
290
- // plugins must use activate: refresh would issue an uninstall for something
291
- // never installed, which warns/errors in those agents. On the add path
292
- // (skipUnchanged off) everything is a fresh activate.
293
- const activateNames = (opts.skipUnchanged ? toActivate.filter((r) => !existingPlugins.has(r.name)) : toActivate).map((r) => r.name);
294
- const refreshNames = opts.skipUnchanged ? toActivate.filter((r) => existingPlugins.has(r.name)).map((r) => r.name) : [];
295
287
  agents = resolved.map((a) => {
288
+ const agentInstalled = a.listInstalled?.(ctxFor([]));
289
+ const alreadyInstalled = (name) => agentInstalled !== undefined
290
+ ? agentInstalled.includes(name)
291
+ : existingPlugins.has(name);
292
+ // Existing plugins must go through refresh even on an explicit `add`:
293
+ // agents like Claude cache an installed copy, and their plain install
294
+ // command is a no-op when the plugin already exists. If the agent can
295
+ // enumerate live installs, trust that state; otherwise fall back to the
296
+ // ADG lock to preserve clean-update behavior.
297
+ const activateNames = toActivate.filter((r) => !alreadyInstalled(r.name)).map((r) => r.name);
298
+ const refreshNames = toActivate.filter((r) => alreadyInstalled(r.name)).map((r) => r.name);
296
299
  // An agent may run both lifecycles (new installs + updates) in one pass;
297
300
  // merge into the existing affected/skipped contract so downstream report
298
301
  // and consolidation (renderAgentReport, mergeAgentResults) stay unchanged.
@@ -27,7 +27,7 @@ export function validatePlugin(pluginDir) {
27
27
  ["commands", m.commands],
28
28
  ["apps", m.apps],
29
29
  ["hooks", m.hooks],
30
- ["mcp", m.mcp],
30
+ ["mcpServers", m.mcpServers],
31
31
  ];
32
32
  for (const [field, value] of pathFields) {
33
33
  if (typeof value === "string" && !existsSync(join(pluginDir, value))) {
@@ -2,6 +2,7 @@ import { existsSync, readFileSync, readdirSync } from "node:fs";
2
2
  import { basename, join } from "node:path";
3
3
  import { resolveSkills } from "./skills.js";
4
4
  import { COMPONENT_TYPES } from "./types.js";
5
+ import { mcpConfigPath } from "./mcp.js";
5
6
  export { COMPONENT_TYPES };
6
7
  /** Recursively collect regular (non-dotfile) file basenames, without extension. */
7
8
  function collectFiles(dir) {
@@ -53,13 +54,14 @@ function mcpServers(file) {
53
54
  }
54
55
  /** Enumerate what a plugin contains, by reading its manifest's component paths. */
55
56
  export function pluginContents(dir, manifest) {
57
+ const mcp = mcpConfigPath(manifest);
56
58
  return {
57
59
  skills: resolveSkills(dir, manifest),
58
60
  agents: membersOf(dir, manifest.agents),
59
61
  commands: membersOf(dir, manifest.commands),
60
62
  apps: membersOf(dir, manifest.apps),
61
63
  hooks: membersOf(dir, manifest.hooks),
62
- mcp: manifest.mcp ? mcpServers(join(dir, manifest.mcp)) : [],
64
+ mcp: mcp ? mcpServers(join(dir, mcp)) : [],
63
65
  };
64
66
  }
65
67
  /** Component types this plugin actually has (non-empty). */
@@ -75,7 +75,10 @@ export function collectIssues(raw) {
75
75
  if (m.skills !== undefined && typeof m.skills !== "string" && !isStringArray(m.skills)) {
76
76
  issues.push("skills must be a string or an array of strings");
77
77
  }
78
- for (const key of ["agents", "commands", "apps", "hooks", "mcp", "homepage", "changelog", "license", "category"]) {
78
+ if (m.mcp !== undefined) {
79
+ issues.push("mcp is not supported; use mcpServers");
80
+ }
81
+ for (const key of ["agents", "commands", "apps", "hooks", "mcpServers", "homepage", "changelog", "license", "category"]) {
79
82
  if (m[key] !== undefined && typeof m[key] !== "string") {
80
83
  issues.push(`${key} must be a string`);
81
84
  }
@@ -0,0 +1,4 @@
1
+ /** ADG's canonical MCP config pointer. */
2
+ export function mcpConfigPath(manifest) {
3
+ return manifest.mcpServers;
4
+ }
@@ -1,3 +1,4 @@
1
+ import { mcpConfigPath } from "./mcp.js";
1
2
  /**
2
3
  * Manifest-driven packaging allowlist.
3
4
  *
@@ -29,7 +30,7 @@ export function packagedRoots(manifest) {
29
30
  manifest.skills,
30
31
  manifest.agents,
31
32
  manifest.commands,
32
- manifest.mcp,
33
+ mcpConfigPath(manifest),
33
34
  manifest.hooks,
34
35
  manifest.apps,
35
36
  ];
@@ -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
+ }
@@ -19,7 +19,7 @@ asc/ # a plugin (authoring source)
19
19
  ├── .agents/
20
20
  │ └── .plugin.json # canonical source manifest (source of truth)
21
21
  ├── skills/<name>/SKILL.md # declared payload
22
- ├── commands/ agents/ mcp/ # declared payload
22
+ ├── commands/ agents/ .mcp.json # declared payload
23
23
  └── README.md LICENSE CHANGELOG # canonical metadata
24
24
  # .claude-plugin/ , .codex-plugin/ are NOT authored here — they are runtime
25
25
  # projections, generated at install time (or committed only when publishing to a
@@ -69,7 +69,7 @@ every projection. See the schema for the full field set; the load-bearing fields
69
69
  "skills": "./skills/", // string (dir) | array (explicit)
70
70
  "commands": "./commands/",
71
71
  "agents": "./agents/",
72
- "mcp": "./mcp/.mcp.json",
72
+ "mcpServers": "./.mcp.json",
73
73
  "dependencies": [{ "name": "github-cr", "version": "^0.2.0" }],
74
74
  "strict": true
75
75
  }
@@ -90,8 +90,8 @@ consistent with the content hash.
90
90
  The packaged file set (`src/package.ts:packagedRoots` / `packageFilter`) is:
91
91
 
92
92
  - the `.agents/` manifest home (and legacy `.adg-plugin/` during deprecation);
93
- - the top-level directory of every declared component
94
- (`skills`/`commands`/`agents`/`mcp`/`hooks`/`apps`);
93
+ - the top-level path segment of every declared component pointer
94
+ (`skills`/`commands`/`agents`/`mcpServers`/`hooks`/`apps`);
95
95
  - canonical metadata at the root: `README*`, `LICENSE*`, `CHANGELOG*`, `NOTICE*`;
96
96
  - the runtime projections `.claude-plugin/`, `.codex-plugin/` when present (copy
97
97
  only) — at install they are regenerated into the destination regardless.
@@ -112,7 +112,7 @@ native `.gitattributes export-ignore` rather than a bespoke ignore format.
112
112
  a human or generated by an agent. Beyond JSON-schema validity it SHOULD enforce:
113
113
 
114
114
  - **Pointer integrity** — every path pointer (`skills`/`commands`/`agents`/
115
- `mcp`/`hooks`/`apps`) resolves; every referenced `SKILL.md` has a non-empty
115
+ `mcpServers`/`hooks`/`apps`) resolves; every referenced `SKILL.md` has a non-empty
116
116
  `name` and `description`.
117
117
  - **Projection sync** — *if* a source repo commits projections (to publish to a
118
118
  native registry), they must match a fresh projection of the current
package/docs/authoring.md CHANGED
@@ -35,7 +35,7 @@ A finished plugin on disk — **`.agents/` only**:
35
35
  my-plugin/
36
36
  ├── .agents/.plugin.json # ← source of truth (you edit this)
37
37
  ├── skills/<name>/SKILL.md # payload
38
- ├── commands/ agents/ mcp/ # payload (only if declared!)
38
+ ├── commands/ agents/ .mcp.json # payload (only if declared!)
39
39
  └── README.md LICENSE CHANGELOG
40
40
  ```
41
41
 
@@ -82,7 +82,7 @@ authoring artifact:
82
82
  "agents": "./agents/", // string (dir)
83
83
  "hooks": "./hooks/", // string (dir)
84
84
  "apps": "./apps/", // string (dir)
85
- "mcp": "./mcp/.mcp.json", // string (file)
85
+ "mcpServers": "./.mcp.json", // string (file)
86
86
 
87
87
  "dependencies": [{ "name": "github-cr", "version": "^0.2.0" }],
88
88
  "strict": true, // default true (see Skills)
@@ -114,7 +114,7 @@ authoring artifact:
114
114
  | `agents` | string | | Directory of sub-agent `.md` files. |
115
115
  | `hooks` | string | | Directory of lifecycle hooks. |
116
116
  | `apps` | string | | Directory of third-party app integration config. |
117
- | `mcp` | string | | Path to an MCP config file (e.g. `./mcp/.mcp.json`). |
117
+ | `mcpServers` | string | | Path to an MCP config file (e.g. `./.mcp.json`). |
118
118
  | `dependencies` | `[{ name, version }]` | | Other plugins required; `version` is a semver range. |
119
119
  | `strict` | boolean | | Default `true`. See **Skills**. |
120
120
  | `homepage`, `changelog` | string | | |
@@ -152,7 +152,7 @@ Two ways to declare them:
152
152
 
153
153
  - **commands** — `"./commands/"`, a dir of slash-command markdown files.
154
154
  - **agents** — `"./agents/"`, a dir of sub-agent definition `.md` files.
155
- - **mcp** — `"./mcp/.mcp.json"`, an MCP server config file (points at a *file*,
155
+ - **mcpServers** — `"./.mcp.json"`, an MCP server config file (points at a *file*,
156
156
  not a dir).
157
157
  - **hooks**, **apps** — directories, same pattern. For hooks, see **Hooks**
158
158
  below — agents differ on the hook config format, so ADG can compile a single
@@ -345,8 +345,9 @@ files.
345
345
 
346
346
  1. `.agents/.plugin.json` exists and is valid JSON;
347
347
  2. structural validity (required fields, kebab `name`, semver `version`, types);
348
- 3. **every declared path exists** (`agents`/`commands`/`apps`/`hooks`/`mcp` dirs
349
- or files; the `skills` root, or each explicit skill path).
348
+ 3. **every declared path exists** (`agents`/`commands`/`apps`/`hooks` dirs
349
+ or files; the `mcpServers` file; the `skills` root, or each explicit skill
350
+ path).
350
351
 
351
352
  Typical failures:
352
353
 
@@ -383,8 +384,11 @@ here, at consumption time:
383
384
  └── .claude-plugin/marketplace.json # Claude-facing discovery export
384
385
  ```
385
386
 
386
- The runtimes (Claude, Codex) discover the plugin through their respective
387
- `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.
388
392
 
389
393
  ### Legacy note
390
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.
@@ -71,7 +71,7 @@ hook handling (a small `HookTranslation` per target, near the adapter resolvers
71
71
  2. the manifest is also **ADG's own control plane** — `dependencies`, `strict`, partial-install selection,
72
72
  and `.plugin-lock.json` integrity all key off it. Hooks carried no such ADG-internal role.
73
73
 
74
- Its **projection mapping** (skills/commands/agents/hooks/mcp → per-agent) shares the hooks risk and would
74
+ Its **projection mapping** (skills/commands/agents/hooks/mcpServers → per-agent) shares the hooks risk and would
75
75
  lose value if vendors converge; its **control-plane core** does not.
76
76
 
77
77
  ## Revisit triggers
@@ -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.5",
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",
@@ -53,7 +53,7 @@
53
53
  "commands": { "type": "string", "description": "Slash command directory." },
54
54
  "apps": { "type": "string", "description": "Third-party app integration config." },
55
55
  "hooks": { "type": "string", "description": "Lifecycle hooks directory." },
56
- "mcp": { "type": "string", "description": "MCP config file path." },
56
+ "mcpServers": { "type": "string", "description": "MCP config file path." },
57
57
  "dependencies": {
58
58
  "type": "array",
59
59
  "items": {