@rbbtsn0w/adg 0.4.0 → 0.5.0-beta.2
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/dist/bin/adg.js +80 -21
- package/dist/src/adapters/antigravity-hooks.js +18 -9
- package/dist/src/agents/base.js +44 -12
- package/dist/src/sources.js +28 -1
- package/dist/src/telemetry.js +76 -0
- package/dist/vendor/skills/src/add.js +6 -12
- package/dist/vendor/skills/src/cli.js +1 -2
- package/dist/vendor/skills/src/install.js +1 -1
- package/dist/vendor/skills/src/telemetry.js +83 -48
- package/dist/vendor/skills/src/update.js +83 -14
- package/docs/agents/antigravity.md +148 -0
- package/docs/agents/claude.md +113 -0
- package/docs/agents/codex.md +89 -0
- package/docs/agents-spec.md +172 -0
- package/package.json +7 -1
- package/vendor/skills/PROVENANCE.md +3 -2
- package/vendor/skills/src/add.ts +5 -13
- package/vendor/skills/src/cli.ts +1 -2
- package/vendor/skills/src/install.ts +1 -1
- package/vendor/skills/src/telemetry.ts +100 -65
- package/vendor/skills/src/update.ts +89 -22
- package/dist/vendor/skills/package.json +0 -143
|
@@ -12,9 +12,10 @@ import { discoverSkills } from "./skills.js";
|
|
|
12
12
|
import { fetchRepoTree, findSkillMdPaths, getSkillFolderHashFromTree } from "./blob.js";
|
|
13
13
|
import { removeCommand } from "./remove.js";
|
|
14
14
|
import { sanitizeMetadata } from "./sanitize.js";
|
|
15
|
-
import { track } from "./telemetry.js";
|
|
15
|
+
import { track, getTracer } from "./telemetry.js";
|
|
16
16
|
import { agents, isUniversalAgent } from "./agents.js";
|
|
17
17
|
import { selfCliArgv } from "./self-cli.js";
|
|
18
|
+
import { SpanKind, SpanStatusCode } from '@opentelemetry/api';
|
|
18
19
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
20
|
/**
|
|
20
21
|
* ADG patch: upstream re-invokes its *built* `bin/cli.mjs` to perform an update,
|
|
@@ -23,7 +24,9 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
23
24
|
* our actual TS entry, run via Node's type-stripping (Node >= 22.6), exactly how
|
|
24
25
|
* `adg skills` launches the CLI. See vendor/skills/PROVENANCE.md.
|
|
25
26
|
*/
|
|
26
|
-
const SELF_CLI_ENTRY = join(__dirname, '
|
|
27
|
+
const SELF_CLI_ENTRY = existsSync(join(__dirname, '../../../bin/adg.ts'))
|
|
28
|
+
? join(__dirname, '../../../bin/adg.ts')
|
|
29
|
+
: join(__dirname, '../../../dist/bin/adg.js');
|
|
27
30
|
const RESET = '\x1b[0m';
|
|
28
31
|
const BOLD = '\x1b[1m';
|
|
29
32
|
const DIM = '\x1b[38;5;102m';
|
|
@@ -186,7 +189,7 @@ export function printSkippedSkills(skipped) {
|
|
|
186
189
|
const names = skills.map((s) => sanitizeMetadata(s.name)).join(', ');
|
|
187
190
|
console.log(` ${TEXT}•${RESET} ${names} ${DIM}(${reason})${RESET}`);
|
|
188
191
|
}
|
|
189
|
-
console.log(` ${DIM}To update: ${TEXT}
|
|
192
|
+
console.log(` ${DIM}To update: ${TEXT}adg skills add ${source} -g -y${RESET}`);
|
|
190
193
|
}
|
|
191
194
|
}
|
|
192
195
|
export async function getProjectSkillsForUpdate(skillFilter) {
|
|
@@ -241,7 +244,7 @@ export async function updateGlobalSkills(options = {}) {
|
|
|
241
244
|
if (skillNames.length === 0) {
|
|
242
245
|
if (!options.skills) {
|
|
243
246
|
console.log(`${DIM}No global skills tracked in lock file.${RESET}`);
|
|
244
|
-
console.log(`${DIM}Install skills with${RESET} ${TEXT}
|
|
247
|
+
console.log(`${DIM}Install skills with${RESET} ${TEXT}adg skills add <package> -g${RESET}`);
|
|
245
248
|
}
|
|
246
249
|
return { successCount, failCount, checkedCount: 0 };
|
|
247
250
|
}
|
|
@@ -402,10 +405,43 @@ export async function updateGlobalSkills(options = {}) {
|
|
|
402
405
|
console.log(` ${DIM}✗ Failed to update ${safeName}: CLI entrypoint not found at ${cliEntry}${RESET}`);
|
|
403
406
|
continue;
|
|
404
407
|
}
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
408
|
+
const tracer = getTracer();
|
|
409
|
+
const args = ['skills', 'add', installUrl, '-g', '-y'];
|
|
410
|
+
const result = tracer.startActiveSpan("adg", { kind: SpanKind.CLIENT }, (span) => {
|
|
411
|
+
try {
|
|
412
|
+
span.setAttribute("process.executable.name", "adg");
|
|
413
|
+
span.setAttribute("process.command_args", ["adg", ...args]);
|
|
414
|
+
const r = spawnSync(process.execPath, selfCliArgv(cliEntry, args), {
|
|
415
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
416
|
+
encoding: 'utf-8',
|
|
417
|
+
shell: process.platform === 'win32',
|
|
418
|
+
});
|
|
419
|
+
if (r.pid !== undefined)
|
|
420
|
+
span.setAttribute("process.pid", r.pid);
|
|
421
|
+
if (r.status !== null) {
|
|
422
|
+
span.setAttribute("process.exit.code", r.status);
|
|
423
|
+
if (r.status !== 0) {
|
|
424
|
+
span.setAttribute("error.type", `EXIT_CODE_${r.status}`);
|
|
425
|
+
span.setStatus({
|
|
426
|
+
code: SpanStatusCode.ERROR,
|
|
427
|
+
message: `Subprocess exited with status ${r.status}`,
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
else if (r.error) {
|
|
432
|
+
span.setAttribute("process.exit.code", -1);
|
|
433
|
+
span.setAttribute("error.type", r.error.code || r.error.name || "SpawnError");
|
|
434
|
+
span.recordException(r.error);
|
|
435
|
+
span.setStatus({
|
|
436
|
+
code: SpanStatusCode.ERROR,
|
|
437
|
+
message: r.error.message,
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
return r;
|
|
441
|
+
}
|
|
442
|
+
finally {
|
|
443
|
+
span.end();
|
|
444
|
+
}
|
|
409
445
|
});
|
|
410
446
|
if (result.status === 0) {
|
|
411
447
|
successCount++;
|
|
@@ -426,7 +462,7 @@ export async function updateProjectSkills(options = {}) {
|
|
|
426
462
|
if (projectSkills.length === 0) {
|
|
427
463
|
if (!options.skills) {
|
|
428
464
|
console.log(`${DIM}No project skills to update.${RESET}`);
|
|
429
|
-
console.log(`${DIM}Install project skills with${RESET} ${TEXT}
|
|
465
|
+
console.log(`${DIM}Install project skills with${RESET} ${TEXT}adg skills add <package>${RESET}`);
|
|
430
466
|
}
|
|
431
467
|
return { successCount, failCount, foundCount: 0 };
|
|
432
468
|
}
|
|
@@ -506,10 +542,43 @@ export async function updateProjectSkills(options = {}) {
|
|
|
506
542
|
const safeName = sanitizeMetadata(skill.name);
|
|
507
543
|
console.log(`${TEXT}Updating ${safeName}...${RESET}`);
|
|
508
544
|
const installUrl = formatSourceInput(skill.entry.source, skill.entry.ref);
|
|
509
|
-
const
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
545
|
+
const tracer = getTracer();
|
|
546
|
+
const args = ['skills', 'add', installUrl, '--skill', skill.name, '-y'];
|
|
547
|
+
const result = tracer.startActiveSpan("adg", { kind: SpanKind.CLIENT }, (span) => {
|
|
548
|
+
try {
|
|
549
|
+
span.setAttribute("process.executable.name", "adg");
|
|
550
|
+
span.setAttribute("process.command_args", ["adg", ...args]);
|
|
551
|
+
const r = spawnSync(process.execPath, selfCliArgv(cliEntry, args), {
|
|
552
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
553
|
+
encoding: 'utf-8',
|
|
554
|
+
shell: process.platform === 'win32',
|
|
555
|
+
});
|
|
556
|
+
if (r.pid !== undefined)
|
|
557
|
+
span.setAttribute("process.pid", r.pid);
|
|
558
|
+
if (r.status !== null) {
|
|
559
|
+
span.setAttribute("process.exit.code", r.status);
|
|
560
|
+
if (r.status !== 0) {
|
|
561
|
+
span.setAttribute("error.type", `EXIT_CODE_${r.status}`);
|
|
562
|
+
span.setStatus({
|
|
563
|
+
code: SpanStatusCode.ERROR,
|
|
564
|
+
message: `Subprocess exited with status ${r.status}`,
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
else if (r.error) {
|
|
569
|
+
span.setAttribute("process.exit.code", -1);
|
|
570
|
+
span.setAttribute("error.type", r.error.code || r.error.name || "SpawnError");
|
|
571
|
+
span.recordException(r.error);
|
|
572
|
+
span.setStatus({
|
|
573
|
+
code: SpanStatusCode.ERROR,
|
|
574
|
+
message: r.error.message,
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
return r;
|
|
578
|
+
}
|
|
579
|
+
finally {
|
|
580
|
+
span.end();
|
|
581
|
+
}
|
|
513
582
|
});
|
|
514
583
|
if (result.status === 0) {
|
|
515
584
|
successCount++;
|
|
@@ -532,7 +601,7 @@ export function printLegacyProjectSkills(legacy) {
|
|
|
532
601
|
for (const skill of legacy) {
|
|
533
602
|
const reinstall = formatSourceInput(skill.entry.source, skill.entry.ref);
|
|
534
603
|
console.log(` ${TEXT}•${RESET} ${sanitizeMetadata(skill.name)}`);
|
|
535
|
-
console.log(` ${DIM}To refresh: ${TEXT}
|
|
604
|
+
console.log(` ${DIM}To refresh: ${TEXT}adg skills add ${reinstall} -y${RESET}`);
|
|
536
605
|
}
|
|
537
606
|
}
|
|
538
607
|
export async function runUpdate(args = []) {
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# Antigravity (Gemini / agy) — Adapter Specification
|
|
2
|
+
|
|
3
|
+
> Based on the [Agent Adapter Template](../agents-spec.md#7-agent-adapter-template).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Official References
|
|
8
|
+
|
|
9
|
+
- Plugin docs: <https://antigravity.google/docs/cli/plugins>
|
|
10
|
+
- **Note**: Antigravity has a convention-based discovery model. There is no rich
|
|
11
|
+
manifest schema — plugins are discovered by directory structure and file presence.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## 2. Projection Output
|
|
16
|
+
|
|
17
|
+
- Output directory: Plugin root (no subdirectory)
|
|
18
|
+
- Manifest file: `plugin.json` (at plugin root)
|
|
19
|
+
- MCP config: `mcp_config.json` (at plugin root, copied from source `.mcp.json`)
|
|
20
|
+
- Hooks config: `hooks.json` (at plugin root, translated from canonical format)
|
|
21
|
+
- Runner script: `.antigravity-plugin/hook-runner.mjs` (generated bridge)
|
|
22
|
+
- Adapter source: [`src/adapters/antigravity.ts`](../../src/adapters/antigravity.ts),
|
|
23
|
+
[`src/adapters/antigravity-hooks.ts`](../../src/adapters/antigravity-hooks.ts)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 3. Manifest Schema
|
|
28
|
+
|
|
29
|
+
Required fields: `name` only.
|
|
30
|
+
|
|
31
|
+
The projected `plugin.json` contains **only the plugin name**. All other metadata
|
|
32
|
+
is discovered by convention (presence of sibling directories/files).
|
|
33
|
+
|
|
34
|
+
```jsonc
|
|
35
|
+
// Projected plugin.json — minimal by design
|
|
36
|
+
{ "name": "my-plugin" }
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## 4. Supported Components
|
|
42
|
+
|
|
43
|
+
| Component | Supported | Manifest Key | Discovery Mechanism |
|
|
44
|
+
| :--- | :---: | :--- | :--- |
|
|
45
|
+
| Skills | ✅ | — | Auto-scan `skills/` dir for sub-dirs with `SKILL.md` |
|
|
46
|
+
| Agents | ✅ | — | Auto-scan `agents/` dir |
|
|
47
|
+
| Commands | ✅ | — | Auto-scan `commands/` dir |
|
|
48
|
+
| Hooks | ✅ | — | Root `hooks.json` file (native schema) |
|
|
49
|
+
| MCP | ✅ | — | Root `mcp_config.json` file |
|
|
50
|
+
| Apps | ❌ | — | Not supported by Antigravity |
|
|
51
|
+
|
|
52
|
+
**Key difference**: Antigravity does NOT read the manifest for component paths.
|
|
53
|
+
It discovers components purely by scanning known directory names and file names at the
|
|
54
|
+
plugin root. The ADG adapter materializes files at these conventional locations.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 5. Skills
|
|
59
|
+
|
|
60
|
+
- **Declared form**: No manifest field. Antigravity scans `skills/` at the plugin root.
|
|
61
|
+
- **Strict mode**: N/A — always auto-discovers. No explicit skill list in manifest.
|
|
62
|
+
- **Array encoding**: N/A — not declared in manifest.
|
|
63
|
+
- **Auto-discovery**: Scans `skills/` for sub-dirs containing `SKILL.md`. Each sub-dir's
|
|
64
|
+
`SKILL.md` YAML frontmatter provides `name` and `description`.
|
|
65
|
+
- **SKILL.md structure**: Identical across all agents:
|
|
66
|
+
```
|
|
67
|
+
skills/<name>/
|
|
68
|
+
└── SKILL.md # Required: YAML frontmatter (name, description) + body
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 6. MCP Servers
|
|
74
|
+
|
|
75
|
+
- **Config file name**: `mcp_config.json` (at plugin root — required conventional name).
|
|
76
|
+
- **Config key**: N/A (no manifest key; discovered by file presence).
|
|
77
|
+
- **Special handling**: ADG copies (or symlinks) the source `.mcp.json` to
|
|
78
|
+
`mcp_config.json` at the plugin root. If the source IS already `mcp_config.json`,
|
|
79
|
+
no copy is performed.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 7. Hooks
|
|
84
|
+
|
|
85
|
+
- **Canonical file**: Root `hooks.json` — Antigravity's only hook discovery point.
|
|
86
|
+
- **Native override**: `hooks/hooks-antigravity.json` — validated and copied verbatim,
|
|
87
|
+
bypassing Claude-to-Antigravity translation.
|
|
88
|
+
- **Supported events** (4 total):
|
|
89
|
+
`PreInvocation` (← SessionStart), `PreToolUse`, `PostToolUse`, `Stop`
|
|
90
|
+
- **Event mapping** (Claude → Antigravity):
|
|
91
|
+
|
|
92
|
+
| Claude Event | Antigravity Event | Notes |
|
|
93
|
+
| :--- | :--- | :--- |
|
|
94
|
+
| `SessionStart` | `PreInvocation` | Only fires when `invocationNum === 0` (runner filters) |
|
|
95
|
+
| `PreToolUse` | `PreToolUse` | Tool groups with matcher |
|
|
96
|
+
| `PostToolUse` | `PostToolUse` | Tool groups with matcher |
|
|
97
|
+
| `Stop` | `Stop` | Direct event |
|
|
98
|
+
|
|
99
|
+
- **Tool name aliases** (Claude → Antigravity):
|
|
100
|
+
|
|
101
|
+
| Claude Tool | Antigravity Tool(s) |
|
|
102
|
+
| :--- | :--- |
|
|
103
|
+
| `Bash` | `run_command` |
|
|
104
|
+
| `Read` | `view_file` |
|
|
105
|
+
| `Write` | `write_to_file` |
|
|
106
|
+
| `Edit` | `replace_file_content`, `multi_replace_file_content` |
|
|
107
|
+
| `Glob` | `find_by_name` |
|
|
108
|
+
| `Grep` | `grep_search` |
|
|
109
|
+
| `WebSearch` | `search_web` |
|
|
110
|
+
| `WebFetch` | `read_url_content` |
|
|
111
|
+
| `Agent` | `invoke_subagent` |
|
|
112
|
+
| `AskUserQuestion` | `ask_question` |
|
|
113
|
+
|
|
114
|
+
- **Hook types**: `command` only (`type: "command"` is the sole supported type).
|
|
115
|
+
`async: true` handlers are NOT supported and produce a warning.
|
|
116
|
+
- **Native hooks schema** (Antigravity-native format):
|
|
117
|
+
```jsonc
|
|
118
|
+
{
|
|
119
|
+
"<hookName>": {
|
|
120
|
+
"enabled": true, // optional boolean
|
|
121
|
+
"PreInvocation": [ // direct events: handler array
|
|
122
|
+
{ "type": "command", "command": "...", "timeout": 30 }
|
|
123
|
+
],
|
|
124
|
+
"PreToolUse": [ // tool events: group array
|
|
125
|
+
{ "matcher": "run_command", "hooks": [
|
|
126
|
+
{ "type": "command", "command": "...", "timeout": 30 }
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
- **Environment bridging**: The generated `hook-runner.mjs` translates:
|
|
134
|
+
- `${CLAUDE_PLUGIN_ROOT}` / `${PLUGIN_ROOT}` → absolute plugin path
|
|
135
|
+
- Antigravity stdin JSON → Claude-format input fields
|
|
136
|
+
- Claude-format output → Antigravity decision output (`allow`/`deny`/`ask`/`stop`)
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 8. Environment Variables
|
|
141
|
+
|
|
142
|
+
| Variable | Description |
|
|
143
|
+
| :--- | :--- |
|
|
144
|
+
| `CLAUDE_PLUGIN_ROOT` | Set by hook-runner bridge to the absolute plugin directory. |
|
|
145
|
+
| `PLUGIN_ROOT` | Alias for `CLAUDE_PLUGIN_ROOT`. |
|
|
146
|
+
|
|
147
|
+
**Note**: These are injected by the generated `hook-runner.mjs`, not by the Antigravity
|
|
148
|
+
runtime itself. The runner bridges Claude-format command scripts to Antigravity's I/O.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Claude (Anthropic) — Adapter Specification
|
|
2
|
+
|
|
3
|
+
> Based on the [Agent Adapter Template](../agents-spec.md#7-agent-adapter-template).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Official References
|
|
8
|
+
|
|
9
|
+
- Plugin docs: <https://code.claude.com/docs/en/plugins-reference>
|
|
10
|
+
- Standard plugin layout: <https://code.claude.com/docs/en/plugins-reference#standard-plugin-layout>
|
|
11
|
+
- File locations reference: <https://code.claude.com/docs/en/plugins-reference#file-locations-reference>
|
|
12
|
+
- Manifest schema: <https://code.claude.com/docs/en/plugins-reference#plugin-manifest-schema>
|
|
13
|
+
- Hooks reference: <https://code.claude.com/docs/en/hooks>
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 2. Projection Output
|
|
18
|
+
|
|
19
|
+
- Output directory: `.claude-plugin/`
|
|
20
|
+
- Manifest file: `.claude-plugin/plugin.json`
|
|
21
|
+
- Adapter source: [`src/adapters/anthropic.ts`](../../src/adapters/anthropic.ts)
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 3. Manifest Schema
|
|
26
|
+
|
|
27
|
+
Required fields: `name`
|
|
28
|
+
|
|
29
|
+
Optional fields: `version`, `description`, `author`, `homepage`, `license`,
|
|
30
|
+
`category`, `skills`, `commands`, `agents`, `hooks`, `mcpServers`, `apps`,
|
|
31
|
+
`strict`, `displayName`, `repository`, `keywords`, `outputStyles`,
|
|
32
|
+
`lspServers`, `dependencies`, `userConfig`, `channels`,
|
|
33
|
+
`experimental.themes`, `experimental.monitors`
|
|
34
|
+
|
|
35
|
+
```jsonc
|
|
36
|
+
// Minimal projected manifest
|
|
37
|
+
{
|
|
38
|
+
"name": "my-plugin",
|
|
39
|
+
"version": "1.0.0",
|
|
40
|
+
"description": "Example plugin",
|
|
41
|
+
"skills": "./skills/"
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## 4. Supported Components
|
|
48
|
+
|
|
49
|
+
| Component | Supported | Manifest Key | Discovery Mechanism |
|
|
50
|
+
| :--- | :---: | :--- | :--- |
|
|
51
|
+
| Skills | ✅ | `skills` (string root or `./skills/<id>` path array) | Auto-scan `skills/` dir for sub-dirs with `SKILL.md`; or explicit path array |
|
|
52
|
+
| Agents | ✅ | `agents` | Markdown files in `agents/` dir |
|
|
53
|
+
| Commands | ✅ | `commands` | Markdown files in `commands/` dir |
|
|
54
|
+
| Hooks | ✅ | `hooks` | `hooks/hooks.json` (auto-loaded); explicit file path |
|
|
55
|
+
| MCP | ✅ | `mcpServers` | `.mcp.json` or inline in manifest |
|
|
56
|
+
| Apps | ✅ | `apps` | App directory |
|
|
57
|
+
| LSP | ✅ | `lspServers` | `.lsp.json` or inline (Claude-only, not in ADG) |
|
|
58
|
+
| Monitors | ✅ | `experimental.monitors` | `monitors/monitors.json` (Claude-only, not in ADG) |
|
|
59
|
+
| Themes | ✅ | `experimental.themes` | `themes/` dir (Claude-only, not in ADG) |
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 5. Skills
|
|
64
|
+
|
|
65
|
+
- **Declared form**: String root (`"./skills/"`) or array of `./skills/<id>` paths.
|
|
66
|
+
- **Strict mode**: `strict: true` (default) = runtime discovers skills from directory.
|
|
67
|
+
`strict: false` = manifest enumerates all skills explicitly.
|
|
68
|
+
- **Array encoding**: Paths in `./skills/<name>` form (not bare ids).
|
|
69
|
+
- **Auto-discovery**: When `strict: true` and skills is a root string, Claude scans
|
|
70
|
+
the directory. A strict array is passed through verbatim.
|
|
71
|
+
- **Root SKILL.md**: A single `SKILL.md` at plugin root is loaded as a single-skill
|
|
72
|
+
plugin when no `skills/` dir exists and no `skills` key is declared.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 6. MCP Servers
|
|
77
|
+
|
|
78
|
+
- **Config file name**: `.mcp.json` (or inline in manifest under `mcpServers`)
|
|
79
|
+
- **Config key**: `mcpServers`
|
|
80
|
+
- **Special handling**: Supports `${CLAUDE_PLUGIN_ROOT}` substitution in command/args/env.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 7. Hooks
|
|
85
|
+
|
|
86
|
+
- **Canonical file**: `hooks/hooks.json` — **auto-loaded** by Claude runtime.
|
|
87
|
+
- **Native override**: N/A (Claude is the canonical format author).
|
|
88
|
+
- **Codex-specific override**: `hooks/hooks-codex.json` — different behavior per agent.
|
|
89
|
+
- **Supported events** (30 total):
|
|
90
|
+
`SessionStart`, `Setup`, `SessionEnd`, `UserPromptSubmit`, `UserPromptExpansion`,
|
|
91
|
+
`Stop`, `StopFailure`, `PreToolUse`, `PostToolUse`, `PostToolUseFailure`,
|
|
92
|
+
`PostToolBatch`, `PermissionRequest`, `PermissionDenied`, `SubagentStart`,
|
|
93
|
+
`SubagentStop`, `TeammateIdle`, `TaskCreated`, `TaskCompleted`,
|
|
94
|
+
`InstructionsLoaded`, `ConfigChange`, `FileChanged`, `CwdChanged`,
|
|
95
|
+
`WorktreeCreate`, `WorktreeRemove`, `PreCompact`, `PostCompact`,
|
|
96
|
+
`Elicitation`, `ElicitationResult`, `Notification`, `MessageDisplay`
|
|
97
|
+
- **Hook types**: `command`, `http`, `mcp_tool`, `prompt`, `agent`
|
|
98
|
+
- **Environment bridging**: `${CLAUDE_PLUGIN_ROOT}`, `${CLAUDE_PLUGIN_DATA}`,
|
|
99
|
+
`${CLAUDE_PROJECT_DIR}`, `${user_config.*}`.
|
|
100
|
+
- **ADG adapter note**: The standard `hooks/hooks.json` is auto-loaded by Claude.
|
|
101
|
+
The adapter MUST NOT repeat this path in the projected manifest, or Claude fails
|
|
102
|
+
with "Duplicate hooks file detected". Only _additional_ hook files are declared.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 8. Environment Variables
|
|
107
|
+
|
|
108
|
+
| Variable | Description |
|
|
109
|
+
| :--- | :--- |
|
|
110
|
+
| `${CLAUDE_PLUGIN_ROOT}` | Absolute path to the plugin installation directory. |
|
|
111
|
+
| `${CLAUDE_PLUGIN_DATA}` | Persistent data directory surviving updates. |
|
|
112
|
+
| `${CLAUDE_PROJECT_DIR}` | Current working directory of the project. |
|
|
113
|
+
| `${user_config.*}` | User-configured values from `userConfig` fields. |
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Codex (OpenAI) — Adapter Specification
|
|
2
|
+
|
|
3
|
+
> Based on the [Agent Adapter Template](../agents-spec.md#7-agent-adapter-template).
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Official References
|
|
8
|
+
|
|
9
|
+
- Plugin docs: <https://code.claude.com/docs/en/plugins-reference> (shared format with Claude)
|
|
10
|
+
- Codex shares Claude's plugin schema. Codex-specific behaviors are documented inline.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 2. Projection Output
|
|
15
|
+
|
|
16
|
+
- Output directory: `.codex-plugin/`
|
|
17
|
+
- Manifest file: `.codex-plugin/plugin.json`
|
|
18
|
+
- Adapter source: [`src/adapters/codex.ts`](../../src/adapters/codex.ts)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 3. Manifest Schema
|
|
23
|
+
|
|
24
|
+
Required fields: `name`, `version`, `description`, `skills`
|
|
25
|
+
|
|
26
|
+
Optional fields: `author`, `homepage`, `license`, `hooks`, `mcpServers`
|
|
27
|
+
|
|
28
|
+
```jsonc
|
|
29
|
+
// Minimal projected manifest
|
|
30
|
+
{
|
|
31
|
+
"name": "my-plugin",
|
|
32
|
+
"version": "1.0.0",
|
|
33
|
+
"description": "Example plugin",
|
|
34
|
+
"skills": "./skills/"
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## 4. Supported Components
|
|
41
|
+
|
|
42
|
+
| Component | Supported | Manifest Key | Discovery Mechanism |
|
|
43
|
+
| :--- | :---: | :--- | :--- |
|
|
44
|
+
| Skills | ✅ | `skills` (string root or bare-id array) | Auto-scan `skills/` dir; or explicit bare-id array |
|
|
45
|
+
| Agents | ❌ | — | Not supported by Codex |
|
|
46
|
+
| Commands | ❌ | — | Not supported by Codex |
|
|
47
|
+
| Hooks | ✅ | `hooks` | Explicit file path (no auto-load) |
|
|
48
|
+
| MCP | ✅ | `mcpServers` | `.mcp.json` path reference |
|
|
49
|
+
| Apps | ❌ | — | Not supported by Codex |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 5. Skills
|
|
54
|
+
|
|
55
|
+
- **Declared form**: String root (`"./skills/"`) or array of **bare ids** (e.g. `["foo", "bar"]`).
|
|
56
|
+
- **Strict mode**: Same as Claude. `strict: true` passes root string through; Codex discovers from directory.
|
|
57
|
+
- **Array encoding**: **Bare ids** — NOT paths. This is the key difference from Claude.
|
|
58
|
+
ADG resolves `./skills/<id>` paths to bare ids during projection.
|
|
59
|
+
- **Auto-discovery**: Codex natively scans a directory root.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 6. MCP Servers
|
|
64
|
+
|
|
65
|
+
- **Config file name**: Same as Claude (`.mcp.json` reference).
|
|
66
|
+
- **Config key**: `mcpServers`
|
|
67
|
+
- **Special handling**: Accepts `${CLAUDE_PLUGIN_ROOT}` in configs.
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 7. Hooks
|
|
72
|
+
|
|
73
|
+
- **Canonical file**: Not auto-loaded — requires explicit manifest reference.
|
|
74
|
+
- **Native override**: `hooks/hooks-codex.json` — preferred over `hooks/hooks.json`
|
|
75
|
+
when present. Adapter resolution order: `hooks-codex.json` → `hooks.json` → sole `*.json`.
|
|
76
|
+
- **Supported events** (10 total):
|
|
77
|
+
`SessionStart`, `SubagentStart`, `PreToolUse`, `PermissionRequest`,
|
|
78
|
+
`PostToolUse`, `PreCompact`, `PostCompact`, `UserPromptSubmit`,
|
|
79
|
+
`SubagentStop`, `Stop`
|
|
80
|
+
- **Hook types**: `command` (same as Claude)
|
|
81
|
+
- **Environment bridging**: Same as Claude (`${CLAUDE_PLUGIN_ROOT}`, etc.).
|
|
82
|
+
- **ADG adapter note**: Unlike Claude, Codex has no auto-load. The hooks config must
|
|
83
|
+
be a file path (not a directory). The adapter resolves `./hooks/` to a concrete file.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## 8. Environment Variables
|
|
88
|
+
|
|
89
|
+
Same as Claude — `${CLAUDE_PLUGIN_ROOT}`, `${CLAUDE_PLUGIN_DATA}`, `${CLAUDE_PROJECT_DIR}`.
|
package/docs/agents-spec.md
CHANGED
|
@@ -130,3 +130,175 @@ a human or generated by an agent. Beyond JSON-schema validity it SHOULD enforce:
|
|
|
130
130
|
commit projections for a native registry.)
|
|
131
131
|
|
|
132
132
|
ADG reads the legacy `.adg-plugin/plugin.json` for one release to ease the move.
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## 6. Supported Agents — Plugin Paths
|
|
139
|
+
|
|
140
|
+
| Agent | Scope | Configuration / Plugin Paths | Details |
|
|
141
|
+
| :--- | :--- | :--- | :--- |
|
|
142
|
+
| **Claude** | Repo (Project) | `$REPO_ROOT/.claude/settings.json` | Team plugins shared via version control. |
|
|
143
|
+
| | Personal (Global) | `~/.claude/settings.json` | Personal plugins available across all projects (default). |
|
|
144
|
+
| **Codex** | Repo (Project) | Marketplace: `$REPO_ROOT/.agents/plugins/marketplace.json`<br>Plugins: `$REPO_ROOT/plugins/` | Add a marketplace file and store your workspace-specific plugins. |
|
|
145
|
+
| | Personal (Global) | Marketplace: `~/.agents/plugins/marketplace.json`<br>Plugins: `~/.codex/plugins/` | Add a marketplace file and store your global plugins. |
|
|
146
|
+
| **Antigravity** | Repo (Project) | `$REPO_ROOT/.agents/plugins/` | Place your plugin folder here; only available within this workspace. |
|
|
147
|
+
| | Personal (Global) | `~/.gemini/config/plugins/` | Place your plugin folder here; active across all workspaces. |
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## 7. Agent Adapter Template
|
|
152
|
+
|
|
153
|
+
Below is the **canonical template** every agent adapter MUST document. When adding
|
|
154
|
+
a new agent, copy this template and fill in the blanks. All existing agent sections
|
|
155
|
+
below follow this structure, making cross-agent comparison and adapter development
|
|
156
|
+
straightforward.
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
### <Agent Name>
|
|
160
|
+
|
|
161
|
+
#### 7.x.1 Official References
|
|
162
|
+
- Plugin docs: <URL>
|
|
163
|
+
- Manifest schema: <URL>
|
|
164
|
+
|
|
165
|
+
#### 7.x.2 Projection Output
|
|
166
|
+
- Output directory: <path relative to plugin root>
|
|
167
|
+
- Manifest file: <filename>
|
|
168
|
+
- Adapter source: `src/adapters/<file>.ts`
|
|
169
|
+
|
|
170
|
+
#### 7.x.3 Manifest Schema
|
|
171
|
+
- Required fields: ...
|
|
172
|
+
- Optional fields: ...
|
|
173
|
+
- Example (minimal):
|
|
174
|
+
|
|
175
|
+
#### 7.x.4 Supported Components
|
|
176
|
+
| Component | Supported | Manifest Key | Discovery Mechanism |
|
|
177
|
+
| :--- | :---: | :--- | :--- |
|
|
178
|
+
|
|
179
|
+
#### 7.x.5 Skills
|
|
180
|
+
- Declared form: ...
|
|
181
|
+
- Strict mode: ...
|
|
182
|
+
- Array encoding: ...
|
|
183
|
+
- Auto-discovery: ...
|
|
184
|
+
|
|
185
|
+
#### 7.x.6 MCP Servers
|
|
186
|
+
- Config file name: ...
|
|
187
|
+
- Config key: ...
|
|
188
|
+
- Special handling: ...
|
|
189
|
+
|
|
190
|
+
#### 7.x.7 Hooks
|
|
191
|
+
- Canonical file: ...
|
|
192
|
+
- Native override: ...
|
|
193
|
+
- Supported events: ...
|
|
194
|
+
- Event mapping: ...
|
|
195
|
+
- Hook types: ...
|
|
196
|
+
- Environment bridging: ...
|
|
197
|
+
|
|
198
|
+
#### 7.x.8 Environment Variables
|
|
199
|
+
- Plugin root: ...
|
|
200
|
+
- Substitution behavior: ...
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Each agent's full specification lives in its own file under `docs/agents/`:
|
|
204
|
+
|
|
205
|
+
| Agent | Spec File |
|
|
206
|
+
| :--- | :--- |
|
|
207
|
+
| Claude (Anthropic) | [`agents/claude.md`](./agents/claude.md) |
|
|
208
|
+
| Codex (OpenAI) | [`agents/codex.md`](./agents/codex.md) |
|
|
209
|
+
| Antigravity (Gemini) | [`agents/antigravity.md`](./agents/antigravity.md) |
|
|
210
|
+
|
|
211
|
+
When adding a new agent, create `docs/agents/<agent>.md` using the template above,
|
|
212
|
+
then add a row to this table.
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
## 8. Cross-Agent Component Matrix
|
|
217
|
+
|
|
218
|
+
Summary of component support across all agents. This is the authoritative view for
|
|
219
|
+
deciding what an ADG plugin can expose to each runtime.
|
|
220
|
+
|
|
221
|
+
| Component | Claude | Codex | Antigravity | ADG Source Key |
|
|
222
|
+
| :--- | :---: | :---: | :---: | :--- |
|
|
223
|
+
| **Skills** | ✅ | ✅ | ✅ | `skills` |
|
|
224
|
+
| **Agents** | ✅ | ❌ | ✅ | `agents` |
|
|
225
|
+
| **Commands** | ✅ | ❌ | ✅ | `commands` |
|
|
226
|
+
| **Hooks** | ✅ | ✅ | ✅ | `hooks` |
|
|
227
|
+
| **MCP** | ✅ | ✅ | ✅ | `mcpServers` |
|
|
228
|
+
| **Apps** | ✅ | ❌ | ❌ | `apps` |
|
|
229
|
+
| **LSP** | ✅ | ❌ | ❌ | N/A (Claude-only) |
|
|
230
|
+
| **Monitors** | ✅ | ❌ | ❌ | N/A (Claude-only) |
|
|
231
|
+
| **Themes** | ✅ | ❌ | ❌ | N/A (Claude-only) |
|
|
232
|
+
|
|
233
|
+
Source: [`ADAPTER_COMPONENTS`](../src/adapters/index.ts) in `src/adapters/index.ts`.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## 9. Cross-Agent Skills Encoding
|
|
238
|
+
|
|
239
|
+
Skills are the most universal component. Their manifest encoding differs per agent:
|
|
240
|
+
|
|
241
|
+
| Aspect | Claude | Codex | Antigravity |
|
|
242
|
+
| :--- | :--- | :--- | :--- |
|
|
243
|
+
| **Root string** | `"./skills/"` — passed through | `"./skills/"` — passed through | N/A — always auto-scans `skills/` |
|
|
244
|
+
| **Array form** | `["./skills/foo", "./skills/bar"]` (path form) | `["foo", "bar"]` (bare-id form) | N/A — no manifest array |
|
|
245
|
+
| **Strict default** | `true` — directory discovery | `true` — directory discovery | Always directory discovery |
|
|
246
|
+
| **Non-strict** | Explicit id list → `strict: false` | Explicit id list | N/A |
|
|
247
|
+
| **SKILL.md** | Required per skill sub-dir | Required per skill sub-dir | Required per skill sub-dir |
|
|
248
|
+
| **Frontmatter** | `name`, `description` (required) | `name`, `description` (required) | `name`, `description` (required) |
|
|
249
|
+
|
|
250
|
+
**Unified rule**: All agents discover skills as sub-directories of `skills/` containing
|
|
251
|
+
a `SKILL.md` with YAML frontmatter. The SKILL.md format is identical across all agents.
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## 10. Cross-Agent Hooks Comparison
|
|
256
|
+
|
|
257
|
+
Hooks require the most complex adapter logic. See also
|
|
258
|
+
[`docs/hooks-strategy.md`](./hooks-strategy.md) for the design rationale.
|
|
259
|
+
|
|
260
|
+
| Aspect | Claude | Codex | Antigravity |
|
|
261
|
+
| :--- | :--- | :--- | :--- |
|
|
262
|
+
| **Canonical format** | Claude's format is canonical | Same as Claude | Native schema (different) |
|
|
263
|
+
| **Authoring file** | `hooks/hooks.json` | `hooks/hooks.json` or `hooks/hooks-codex.json` | `hooks/hooks-antigravity.json` or translated from canonical |
|
|
264
|
+
| **Discovery** | Auto-loaded from `hooks/hooks.json` | Explicit manifest reference (no auto-load) | Root `hooks.json` at plugin root |
|
|
265
|
+
| **Supported events** | 30 events | 10 events | 4 events |
|
|
266
|
+
| **Hook types** | `command`, `http`, `mcp_tool`, `prompt`, `agent` | `command` | `command` |
|
|
267
|
+
| **Matcher** | Regex string | Regex string | Simple tool-name alternation |
|
|
268
|
+
| **Translation by ADG** | None (canonical) | Minimal (file resolution) | Full (schema + event + tool-name + I/O bridge) |
|
|
269
|
+
|
|
270
|
+
### Hooks authoring strategy
|
|
271
|
+
|
|
272
|
+
| Scenario | What to do |
|
|
273
|
+
| :--- | :--- |
|
|
274
|
+
| Same behavior across all agents | Author one `hooks/hooks.json` in Claude's format. ADG routes and translates. |
|
|
275
|
+
| Different behavior per agent | Ship native override files: `hooks/hooks-codex.json`, `hooks/hooks-antigravity.json`. ADG routes each to the right target. |
|
|
276
|
+
| Antigravity-only behavior | Author `hooks/hooks-antigravity.json` in Antigravity's native schema. Bypasses translation. |
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## 11. Cross-Agent MCP Comparison
|
|
281
|
+
|
|
282
|
+
| Aspect | Claude | Codex | Antigravity |
|
|
283
|
+
| :--- | :--- | :--- | :--- |
|
|
284
|
+
| **Config file** | `.mcp.json` or inline in manifest | `.mcp.json` reference | `mcp_config.json` at plugin root |
|
|
285
|
+
| **Manifest key** | `mcpServers` | `mcpServers` | N/A (discovered by file presence) |
|
|
286
|
+
| **Format** | `{ "mcpServers": { "<name>": { "command": ... } } }` | Same as Claude | Same as Claude |
|
|
287
|
+
| **Projection** | Passed through | Passed through | Copied from source `.mcp.json` to `mcp_config.json` |
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## 12. Adding a New Agent
|
|
292
|
+
|
|
293
|
+
When support for a new agent runtime is needed:
|
|
294
|
+
|
|
295
|
+
1. **Create adapter source** at `src/adapters/<agent>.ts` implementing `AdapterFn`.
|
|
296
|
+
2. **Register** in [`src/adapters/index.ts`](../src/adapters/index.ts):
|
|
297
|
+
- Add to `ADAPTERS` map with agent name and any aliases.
|
|
298
|
+
- Add to `ADAPTER_TARGETS`.
|
|
299
|
+
- Add to `ADAPTER_COMPONENTS` with the supported component types.
|
|
300
|
+
3. **Document** by copying the template in §7 and filling in all sections.
|
|
301
|
+
4. **Update cross-agent matrices** (§8–§11) to include the new agent column.
|
|
302
|
+
5. **Add hook event support** in [`src/hooks.ts`](../src/hooks.ts) `SUPPORTED_EVENTS`.
|
|
303
|
+
6. **Test** via `adg plugins adapt --target <agent>` and `adg plugins validate`.
|
|
304
|
+
|