@rbbtsn0w/adg 0.1.0-alpha.1

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.
Files changed (84) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +308 -0
  3. package/bin/adg.ts +758 -0
  4. package/docs/agents-spec.md +132 -0
  5. package/docs/authoring.md +352 -0
  6. package/package.json +50 -0
  7. package/schemas/adg-plugin.schema.json +77 -0
  8. package/schemas/marketplace.schema.json +86 -0
  9. package/schemas/plugin-lock.schema.json +90 -0
  10. package/src/adapters/anthropic.ts +54 -0
  11. package/src/adapters/index.ts +24 -0
  12. package/src/adapters/openai.ts +37 -0
  13. package/src/adapters/reverse.ts +60 -0
  14. package/src/agents/claude.ts +124 -0
  15. package/src/agents/codex.ts +67 -0
  16. package/src/agents/index.ts +12 -0
  17. package/src/agents/registry.ts +30 -0
  18. package/src/agents/types.ts +47 -0
  19. package/src/commands/adapt.ts +36 -0
  20. package/src/commands/import.ts +69 -0
  21. package/src/commands/init.ts +146 -0
  22. package/src/commands/install.ts +411 -0
  23. package/src/commands/link.ts +61 -0
  24. package/src/commands/list.ts +28 -0
  25. package/src/commands/marketplace.ts +198 -0
  26. package/src/commands/migrate.ts +84 -0
  27. package/src/commands/multiselect-skills.ts +137 -0
  28. package/src/commands/remove.ts +136 -0
  29. package/src/commands/select-agents.ts +45 -0
  30. package/src/commands/select-components.ts +66 -0
  31. package/src/commands/select-plugins.ts +28 -0
  32. package/src/commands/select-scope.ts +21 -0
  33. package/src/commands/update.ts +85 -0
  34. package/src/commands/validate.ts +57 -0
  35. package/src/components.ts +90 -0
  36. package/src/deps.ts +64 -0
  37. package/src/fsutil.ts +38 -0
  38. package/src/hash.ts +61 -0
  39. package/src/lock.ts +57 -0
  40. package/src/manifest.ts +113 -0
  41. package/src/marketplace.ts +41 -0
  42. package/src/package.ts +74 -0
  43. package/src/paths.ts +129 -0
  44. package/src/semver.ts +67 -0
  45. package/src/skills.ts +88 -0
  46. package/src/sources.ts +159 -0
  47. package/src/types.ts +140 -0
  48. package/vendor/skills/LICENSE +29 -0
  49. package/vendor/skills/PROVENANCE.md +60 -0
  50. package/vendor/skills/ThirdPartyNoticeText.txt +117 -0
  51. package/vendor/skills/package.json +143 -0
  52. package/vendor/skills/src/add.ts +1999 -0
  53. package/vendor/skills/src/agents.ts +755 -0
  54. package/vendor/skills/src/blob.ts +567 -0
  55. package/vendor/skills/src/cli.ts +387 -0
  56. package/vendor/skills/src/constants.ts +3 -0
  57. package/vendor/skills/src/detect-agent.ts +62 -0
  58. package/vendor/skills/src/find.ts +357 -0
  59. package/vendor/skills/src/frontmatter.ts +16 -0
  60. package/vendor/skills/src/git-tree.ts +36 -0
  61. package/vendor/skills/src/git.ts +277 -0
  62. package/vendor/skills/src/install.ts +91 -0
  63. package/vendor/skills/src/installer.ts +1097 -0
  64. package/vendor/skills/src/list.ts +231 -0
  65. package/vendor/skills/src/local-lock.ts +182 -0
  66. package/vendor/skills/src/plugin-manifest.ts +183 -0
  67. package/vendor/skills/src/prompts/search-multiselect.ts +387 -0
  68. package/vendor/skills/src/providers/index.ts +14 -0
  69. package/vendor/skills/src/providers/registry.ts +51 -0
  70. package/vendor/skills/src/providers/types.ts +97 -0
  71. package/vendor/skills/src/providers/wellknown.ts +804 -0
  72. package/vendor/skills/src/remove.ts +323 -0
  73. package/vendor/skills/src/sanitize.ts +65 -0
  74. package/vendor/skills/src/self-cli.ts +20 -0
  75. package/vendor/skills/src/skill-lock.ts +329 -0
  76. package/vendor/skills/src/skills.ts +316 -0
  77. package/vendor/skills/src/source-parser.ts +438 -0
  78. package/vendor/skills/src/sync.ts +478 -0
  79. package/vendor/skills/src/telemetry.ts +186 -0
  80. package/vendor/skills/src/test-utils.ts +73 -0
  81. package/vendor/skills/src/types.ts +128 -0
  82. package/vendor/skills/src/update-source.ts +90 -0
  83. package/vendor/skills/src/update.ts +749 -0
  84. package/vendor/skills/src/use.ts +675 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Agent Directory Group
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,308 @@
1
+ # Agent Directory Group (ADG)
2
+
3
+ `adg` is one umbrella CLI with **two domains**, each aligned to an existing
4
+ ecosystem so there is little new to learn:
5
+
6
+ | Domain | Command | Aligns to |
7
+ |--------|---------|-----------|
8
+ | **plugins** | `adg plugins <verb>` | the Codex plugin flow (`~/.agents/plugins/marketplace.json`) |
9
+ | **skills** | `adg skills <verb>` | [vercel-labs/skills](https://github.com/vercel-labs/skills) — a **vendored fork** (see [vendor/skills](vendor/skills/PROVENANCE.md)) |
10
+
11
+ For plugins, one universal manifest — `.agents/.plugin.json` — is the source
12
+ of truth. Runtime-specific manifests (`.claude-plugin/plugin.json`,
13
+ `.codex-plugin/plugin.json`) are *generated* from it, so a plugin is authored
14
+ once and adapted to each runtime.
15
+
16
+ **Control plane vs export.** ADG's own management lives in the lock
17
+ (`.plugin-lock.json`: provenance, `sha256` integrity, dependencies) — that is the
18
+ only file ADG treats as authoritative. `marketplace.json` is a thin
19
+ **runtime-facing export** kept in the de-facto shape Codex consumes; ADG never
20
+ manages plugins through it.
21
+
22
+ See [docs/authoring.md](docs/authoring.md) to author a plugin, and
23
+ [docs/agents-spec.md](docs/agents-spec.md) for the `.agents/` directory spec.
24
+
25
+ ## Why
26
+
27
+ - **Skill explosion** — hundreds of skills become unmanageable; ADG groups them
28
+ into versioned, discoverable plugins.
29
+ - **Runtime fragmentation** — Claude and Codex use different plugin layouts;
30
+ ADG generates each from a single source.
31
+ - **Reproducibility** — `.plugin-lock.json` records source, version and a content
32
+ hash for every installed plugin.
33
+
34
+ ---
35
+
36
+ # Concepts (common)
37
+
38
+ These apply the same whether you run a released build or the source tree.
39
+
40
+ ## Layout
41
+
42
+ ```
43
+ plugins/ reference plugins + a generated marketplace
44
+ ├── .plugin-lock.json lock file (generated)
45
+ ├── marketplace.json marketplace listing (generated)
46
+ ├── asc/ strict plugin (explicit skills)
47
+ └── github-cr/ non-strict plugin (auto-scanned skills)
48
+
49
+ schemas/ JSON Schemas for the three ADG file formats
50
+ src/ CLI library (manifest, hash, adapters, lock, ...)
51
+ bin/adg.ts CLI entry point
52
+ test/ node:test suite
53
+ ```
54
+
55
+ A single plugin directory:
56
+
57
+ ```
58
+ asc/
59
+ ├── .agents/.plugin.json universal manifest (source of truth)
60
+ ├── .claude-plugin/plugin.json generated by `adg plugins adapt`
61
+ ├── .codex-plugin/plugin.json generated by `adg plugins adapt`
62
+ ├── skills/<kebab-name>/SKILL.md
63
+ ├── agents/ commands/ hooks/ mcp/ apps/
64
+ └── README.md
65
+ ```
66
+
67
+ ## File formats
68
+
69
+ | File | Schema | Role |
70
+ |------|--------|------|
71
+ | `.agents/.plugin.json` | [adg-plugin.schema.json](schemas/adg-plugin.schema.json) (`adg.plugin/v1`) | Universal manifest — source of truth |
72
+ | `.plugin-lock.json` | [plugin-lock.schema.json](schemas/plugin-lock.schema.json) (`version: 2`) | **Control plane** — ADG's authoritative state |
73
+ | `marketplace.json` | [marketplace.schema.json](schemas/marketplace.schema.json) | **Export** — de-facto catalog for Codex |
74
+
75
+ The split is deliberate:
76
+
77
+ - **Lock (control plane, ADG-owned).** Carries provenance (`origin`, a
78
+ discriminated `source` union: `{type:"local",path}` / `{type:"github",repo,ref?,path?}`
79
+ / `{type:"git",url,ref?,path?}`), `sha256` content integrity, resolved
80
+ `version`, and dependencies. Every control operation — `list`, `update`,
81
+ `link`, collision detection, dependency resolution — keys off the lock.
82
+ Installing a same-named plugin from a *different* `origin` is rejected as a
83
+ collision.
84
+ - **Marketplace (export, runtime-owned shape).** Written in the de-facto shape
85
+ Codex consumes (`{ name, source: { source, path }, policy, category }`, no
86
+ ADG-specific schema). ADG never reads it as authority — it is regenerated from
87
+ the plugin directories. Integrity/version/provenance deliberately do **not**
88
+ appear here; they live in the lock.
89
+
90
+ `strict: true` exposes only the manifest's declared skills; `strict: false`
91
+ auto-scans the `skills/` directory (Claude "skill-bundle" form). The Codex
92
+ manifest always emits an explicit `skills` array.
93
+
94
+ ---
95
+
96
+ # Commands (common)
97
+
98
+ The command surface is identical in both modes — **only the launcher differs**:
99
+
100
+ | Mode | Launcher | Setup |
101
+ |------|----------|-------|
102
+ | Released build | `adg …` | install the package (see [Using a released build](#using-a-released-build)) |
103
+ | From source (debug) | `node bin/adg.ts …` | clone + `npm install` (see [Developing from source](#developing-from-source)) |
104
+
105
+ The examples below use the released `adg` launcher. **When running from source,
106
+ replace `adg` with `node bin/adg.ts`** — everything else is the same.
107
+
108
+ ```bash
109
+ # scaffold a new plugin under ./plugins/<name>
110
+ adg plugins init my-plugin
111
+
112
+ # generate runtime manifests (claude | codex | all)
113
+ adg plugins adapt plugins/my-plugin --target all
114
+
115
+ # validate manifest + referenced paths
116
+ adg plugins validate plugins/my-plugin
117
+
118
+ # add from a local dir: copy, adapt, hash, update lock + marketplace
119
+ adg plugins add plugins/my-plugin --project # <repo>/.agents/plugins
120
+ adg plugins add plugins/my-plugin --global # ~/.agents/plugins
121
+ adg plugins add plugins/asc --dir plugins # explicit target dir
122
+
123
+ # add from GitHub (shorthand, @ref, or full URL); --path selects a monorepo subdir
124
+ adg plugins add owner/repo --dir plugins
125
+ adg plugins add owner/repo@v0.1.0 --path plugins/asc --dir plugins
126
+ adg plugins add https://github.com/owner/repo.git --ref main --dir plugins
127
+ adg plugins add plugins/asc --dir plugins --no-deps # skip transitive deps
128
+
129
+ # add existing native plugins — Codex/Claude manifests are reverse-adapted into
130
+ # .agents/.plugin.json automatically during discovery (no separate `import` verb)
131
+ adg plugins add owner/repo --ref main --sparse .agents/plugins --sparse plugins --global
132
+ adg plugins add ./some/local/repo --dir plugins
133
+ adg plugins import-skills ~/.agents/skills --as asc --prefix asc- --dir plugins
134
+
135
+ # project installed plugins into a runtime's discovery path
136
+ adg plugins link --target codex --global # regenerate .codex-plugin in place
137
+ adg plugins link --target claude --global # symlink into ~/.claude/skills/
138
+
139
+ # maintenance
140
+ adg plugins update --dir plugins # refresh lock hashes/versions from disk
141
+ adg plugins list --dir plugins # list locked plugins
142
+ adg plugins migrate --dir plugins # move flat installs into per-marketplace dirs
143
+ ```
144
+
145
+ #### On-disk layout
146
+
147
+ Plugins are grouped on disk by the source they came from. Remote installs nest
148
+ under a per-marketplace bucket; local installs stay flat:
149
+
150
+ ```
151
+ .agents/plugins/
152
+ ├── .plugin-lock.json
153
+ ├── marketplace.json
154
+ ├── my-local-plugin/ ← local: flat
155
+ └── owner__repo/ ← remote: owner/repo, "/" flattened to "__"
156
+ ├── asc/
157
+ └── github-cr/
158
+ ```
159
+
160
+ The plugin **name stays the unique key** across the lock, `marketplace.json`, and
161
+ the Claude symlink bridge — nesting is organizational only, so two sources still
162
+ can't both install a plugin of the same name. `marketplace.json`'s `source.path`
163
+ tracks the real on-disk path (e.g. `./owner__repo/asc`), keeping the Codex export
164
+ accurate. Run `adg plugins migrate` once to lift an older flat store into this
165
+ layout.
166
+
167
+ ### Skills domain
168
+
169
+ `adg skills <verb>` (add/use/remove/list/find/update/init) is a **vendored fork**
170
+ of [vercel-labs/skills](https://github.com/vercel-labs/skills) under
171
+ [vendor/skills/](vendor/skills/) — `adg skills` forwards all args to it. Run
172
+ `adg skills --help` for its full usage.
173
+
174
+ > **License.** Upstream `skills` is **MIT** (declared in its README and
175
+ > `package.json`). The vendored copy retains a reconstructed
176
+ > [LICENSE](vendor/skills/LICENSE) (MIT + attribution) and the upstream
177
+ > third-party notices; see [vendor/skills/PROVENANCE.md](vendor/skills/PROVENANCE.md).
178
+ > GitHub's API shows `license: null` only because upstream ships no standalone
179
+ > LICENSE file. The 6 runtime dependencies in `package.json` exist solely for
180
+ > this vendored CLI; ADG's own plugins code remains dependency-free.
181
+
182
+ ### Install scopes
183
+
184
+ - `--project` (default) → `<repo>/.agents/plugins`
185
+ - `--global` → `~/.agents/plugins`, honoring `ADG_PLUGINS_HOME`, then
186
+ `XDG_STATE_HOME/.agents/plugins`
187
+ - `--dir <path>` → an explicit plugins directory
188
+
189
+ **Safety:** ADG only ever reads and writes the `plugins/` subtree of a scope.
190
+ The sibling `~/.agents/AGENTS.md` and `~/.agents/skills/` are never touched.
191
+
192
+ ### Sources & dependencies
193
+
194
+ `add` accepts a local path or a GitHub source (`owner/repo`,
195
+ `owner/repo@ref`, or a `github.com` URL). GitHub sources are shallow-cloned to a
196
+ temp dir (with cone-mode sparse checkout when `--sparse` is given); the lock
197
+ records the `origin` (`{type:"github",repo,ref,path}`) for reproducibility.
198
+
199
+ Plugin `dependencies` are resolved against sibling plugins in the same source
200
+ tree: install order is a topological sort with semver (`^`, `~`, exact, `*`,
201
+ comparators) checks; cycles / missing deps / version conflicts fail fast. Pass
202
+ `--no-deps` to install only the requested plugin.
203
+
204
+ ### Importing existing inventory (via `add`)
205
+
206
+ `add` also brings non-ADG plugins under management. During discovery it scans the
207
+ source for `.agents/.plugin.json` (or legacy `.adg-plugin`), `.codex-plugin` or
208
+ `.claude-plugin` manifests; native manifests are **reverse-adapted** into a
209
+ canonical `.agents/.plugin.json` (the inverse of `adapt`) and installed
210
+ normally. `import-skills` wraps a flat
211
+ `<name>/SKILL.md` directory (e.g. a pile of global skills) into a single plugin,
212
+ optionally filtered by `--prefix`.
213
+
214
+ ### Runtime mapping (`link`)
215
+
216
+ A single `.agents/plugins/` source of truth is projected onto each runtime's
217
+ private discovery path:
218
+
219
+ | | Codex (OpenAI) | Claude (Anthropic) |
220
+ |---|---|---|
221
+ | plugin manifest | `.codex-plugin/plugin.json` (generated) | `.claude-plugin/plugin.json` (generated) |
222
+ | marketplace root | `~/.agents/plugins/` — **native, zero-copy** | `~/.claude/skills/<name>/` — **symlink bridge** |
223
+ | skill name | scanned | namespaced `/<plugin>:<skill>` |
224
+
225
+ - `link --target codex` only (re)generates `.codex-plugin/plugin.json` —
226
+ `.agents/plugins/` is already Codex's marketplace root.
227
+ - `link --target claude [--global]` (re)generates `.claude-plugin/plugin.json`
228
+ and symlinks each plugin into Claude's skills-dir (`~/.claude/skills/` with
229
+ `--global`, else `<cwd>/.claude/skills/`) so it auto-loads as
230
+ `<name>@skills-dir`. Symlinks never overwrite a real directory — only a stale
231
+ symlink is replaced. This writes under Claude's own `~/.claude/`; the
232
+ never-touched `~/.agents/skills/` and `~/.agents/AGENTS.md` are unaffected.
233
+
234
+ ---
235
+
236
+ # Using a released build
237
+
238
+ > Pre-release: not yet published to npm. This is the intended end-user flow.
239
+
240
+ Install the CLI once, then use the `adg` command from anywhere:
241
+
242
+ ```bash
243
+ npm install -g adg # or: npx adg <command>
244
+ adg --help
245
+ ```
246
+
247
+ Typical end-user workflow — bring a marketplace into your global environment and
248
+ load it into your runtimes:
249
+
250
+ ```bash
251
+ # 1) collect plugins into the global store (~/.agents/plugins)
252
+ adg plugins add anthropics/knowledge-work-plugins --ref main --global
253
+ # large monorepo? fetch only what you need:
254
+ adg plugins add anthropics/knowledge-work-plugins --ref main --sparse engineering --global
255
+
256
+ # 2) load into the runtimes you use
257
+ adg plugins link --target codex --global # Codex discovers ~/.agents/plugins natively
258
+ adg plugins link --target claude --global # Claude loads via ~/.claude/skills symlinks
259
+
260
+ # 3) keep it current
261
+ adg plugins update --global
262
+ adg plugins list --global
263
+ ```
264
+
265
+ No Node toolchain step is required beyond the global install; `adg` is the only
266
+ command you invoke.
267
+
268
+ ---
269
+
270
+ # Developing from source
271
+
272
+ For working on the CLI itself, or testing a plugin before release. The CLI runs
273
+ directly on **Node ≥ 22.6** via native TypeScript type-stripping — **no build
274
+ step**.
275
+
276
+ ```bash
277
+ git clone <this-repo> && cd adg
278
+ npm install # dev-only: typescript + @types/node
279
+
280
+ # run any command straight from source (replace `adg` with this prefix)
281
+ node bin/adg.ts --help
282
+ node bin/adg.ts plugins validate plugins/asc
283
+
284
+ # quality gates
285
+ npm test # node --test (76 cases)
286
+ npm run typecheck # tsc --noEmit
287
+ ```
288
+
289
+ Debugging tips:
290
+
291
+ - **Use a scratch target, not your real environment.** Prefer `--dir /tmp/store`
292
+ over `--global` while iterating, so you never write to `~/.agents/plugins` or
293
+ `~/.claude/skills` by accident:
294
+ ```bash
295
+ node bin/adg.ts plugins add ./some/repo --dir /tmp/adg-store
296
+ node bin/adg.ts plugins list --dir /tmp/adg-store
297
+ ```
298
+ - **Refreshing reference artifacts:** the `plugins/.plugin-lock.json` and
299
+ `plugins/marketplace.json` are generated. Re-sync the lock hashes from disk with
300
+ `node bin/adg.ts plugins update --dir plugins`.
301
+ - **Inspect generated manifests** under each plugin's `.claude-plugin/` and
302
+ `.codex-plugin/` to confirm adaptation output.
303
+ - GitHub clone/sparse logic is injectable (`gitRunner`) and covered offline by
304
+ the test suite; live network clones are exercised by `import owner/repo`.
305
+
306
+ ## License
307
+
308
+ MIT