universal-plugin 0.3.1 → 0.5.0
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/LICENSE +21 -0
- package/dist/cli.mjs +1262 -375
- package/dist/data/vendors.json +12 -0
- package/dist/run.mjs +4 -4
- package/governances/plugin-design.md +42 -1
- package/package.json +3 -1
- package/plugin.json +1 -1
- package/readme.md +80 -42
- package/skills/doctor/README.md +42 -0
- package/skills/doctor/SKILL.md +144 -0
- package/skills/doctor/scripts/doctor.mjs +273 -0
- package/skills/init/README.md +57 -0
- package/skills/init/SKILL.md +219 -0
- package/skills/{plugin → init}/references/adopt.md +8 -4
- package/skills/init/references/create.md +122 -0
- package/skills/init/references/detection.md +62 -0
- package/skills/init/references/frontmatter.md +65 -0
- package/skills/init/references/standard.md +93 -0
- package/skills/init/references/update.md +31 -0
- package/skills/init/references/vendors/claude-code.md +76 -0
- package/skills/init/references/vendors/codex.md +56 -0
- package/skills/init/references/vendors/copilot-cli.md +53 -0
- package/skills/init/references/vendors/cursor.md +52 -0
- package/skills/init/scripts/init.mjs +11 -0
- package/skills/marketplace/README.md +38 -0
- package/skills/marketplace/SKILL.md +170 -0
- package/skills/marketplace/references/runtimes.md +104 -0
- package/skills/marketplace/scripts/install-docs.mjs +115 -0
- package/skills/marketplace/scripts/marketplace.mjs +11 -0
- package/skills/publish-plugin/SKILL.md +10 -8
- package/skills/publish-plugin/references/vendor-requirements.md +13 -10
- package/skills/remove-plugin/README.md +38 -0
- package/skills/remove-plugin/SKILL.md +87 -0
- package/skills/version/README.md +36 -0
- package/skills/{plugin/references/version.md → version/SKILL.md} +27 -5
- package/skills/version/scripts/version.mjs +11 -0
- package/skills/plugin/README.md +0 -37
- package/skills/plugin/SKILL.md +0 -105
- package/skills/plugin/references/create.md +0 -163
- package/skills/plugin/references/delete.md +0 -23
- package/skills/plugin/references/inspect.md +0 -21
- package/skills/plugin/references/update.md +0 -26
- /package/skills/{plugin → init}/assets/templates/agent.md +0 -0
- /package/skills/{plugin → init}/assets/templates/command.md +0 -0
- /package/skills/{plugin → init}/assets/templates/hooks.json +0 -0
- /package/skills/{plugin → init}/assets/templates/plugin.json +0 -0
- /package/skills/{plugin → init}/assets/templates/setup-command.md +0 -0
- /package/skills/{plugin → init}/assets/templates/skill.md +0 -0
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Read-only diagnosis of a universal plugin. Emits one JSON object on stdout; never writes.
|
|
3
|
+
// Derivation itself is not re-implemented here — the shipped CLI's own build resolver is the source
|
|
4
|
+
// of truth for what each vendor gets, and this script only adds the filesystem facts it cannot see.
|
|
5
|
+
import { spawnSync } from 'node:child_process'
|
|
6
|
+
import * as fs from 'node:fs'
|
|
7
|
+
import * as path from 'node:path'
|
|
8
|
+
import { fileURLToPath } from 'node:url'
|
|
9
|
+
|
|
10
|
+
const UP_NAMESPACE = 'org.cyberuni.universal-plugin'
|
|
11
|
+
// <package>/skills/<skill>/scripts/doctor.mjs: four levels up is the package root.
|
|
12
|
+
const packageRoot = path.dirname(path.dirname(path.dirname(path.dirname(fileURLToPath(import.meta.url)))))
|
|
13
|
+
|
|
14
|
+
const argv = process.argv.slice(2)
|
|
15
|
+
const verbose = argv.includes('--verbose')
|
|
16
|
+
const rootFlag = argv.indexOf('--root')
|
|
17
|
+
const root = path.resolve(rootFlag === -1 ? process.cwd() : (argv[rootFlag + 1] ?? process.cwd()))
|
|
18
|
+
|
|
19
|
+
const findings = []
|
|
20
|
+
const add = (code, severity, detail, repair) => findings.push({ code, severity, detail, repair })
|
|
21
|
+
|
|
22
|
+
const readJson = (file) => {
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(fs.readFileSync(file, 'utf8'))
|
|
25
|
+
} catch {
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const mtime = (file) => (fs.existsSync(file) ? fs.statSync(file).mtimeMs : null)
|
|
30
|
+
|
|
31
|
+
const VENDOR_MANIFESTS = ['.claude-plugin/plugin.json', '.cursor-plugin/plugin.json', '.codex-plugin/plugin.json']
|
|
32
|
+
|
|
33
|
+
const manifestPath = path.join(root, 'plugin.json')
|
|
34
|
+
const manifest = fs.existsSync(manifestPath) ? readJson(manifestPath) : null
|
|
35
|
+
|
|
36
|
+
if (manifest === null) {
|
|
37
|
+
const orphans = VENDOR_MANIFESTS.filter((rel) => fs.existsSync(path.join(root, rel)))
|
|
38
|
+
if (fs.existsSync(manifestPath)) {
|
|
39
|
+
add('unparsable-manifest', 'critical', 'plugin.json is not valid JSON', 'fix the syntax error')
|
|
40
|
+
} else if (orphans.length > 0) {
|
|
41
|
+
add(
|
|
42
|
+
'vendor-only',
|
|
43
|
+
'high',
|
|
44
|
+
`vendor manifests with no canonical manifest: ${orphans.join(', ')}`,
|
|
45
|
+
'/universal-plugin:init, adopt route',
|
|
46
|
+
)
|
|
47
|
+
} else {
|
|
48
|
+
add('no-manifest', 'high', 'no root plugin.json — this is not a plugin yet', '/universal-plugin:init')
|
|
49
|
+
}
|
|
50
|
+
report({ vendors: [] })
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const ext = manifest.extensions?.[UP_NAMESPACE] ?? null
|
|
54
|
+
|
|
55
|
+
// `packagePath` is the CLI's own config, and the CLI reads it from `.agents/universal-plugin.json`
|
|
56
|
+
// (src/version/fs.ts). It is read here from the same file, so a plugin the CLI treats as npm-shipping
|
|
57
|
+
// is one this script treats the same way. The manifest extension is accepted as a fallback for a
|
|
58
|
+
// repository that put it there.
|
|
59
|
+
const packagePath = readPackagePath()
|
|
60
|
+
if (!manifest.$schema?.includes('agent-plugins.org') || ext === null) {
|
|
61
|
+
add(
|
|
62
|
+
'legacy-manifest',
|
|
63
|
+
'high',
|
|
64
|
+
'root plugin.json carries no $schema on agent-plugins.org or no extensions block',
|
|
65
|
+
'/universal-plugin:init, adopt route',
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Shadowing and leftovers. `.plugin/plugin.json` outranks root in Copilot CLI's search order.
|
|
70
|
+
if (fs.existsSync(path.join(root, '.plugin/plugin.json'))) {
|
|
71
|
+
add(
|
|
72
|
+
'shadowing-manifest',
|
|
73
|
+
'high',
|
|
74
|
+
'.plugin/plugin.json outranks root and is read instead of the canonical manifest',
|
|
75
|
+
'/universal-plugin:remove-plugin',
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
if (fs.existsSync(path.join(root, '.github/plugin/plugin.json'))) {
|
|
79
|
+
add(
|
|
80
|
+
'stale-github-plugin',
|
|
81
|
+
'low',
|
|
82
|
+
'.github/plugin/plugin.json is a leftover from an older build and is no longer generated',
|
|
83
|
+
'/universal-plugin:remove-plugin',
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// Ask the shipped CLI what it would write, without writing it.
|
|
88
|
+
const bin = path.join(packageRoot, 'bin', 'universal-plugin.mjs')
|
|
89
|
+
const cli = fs.existsSync(bin)
|
|
90
|
+
? spawnSync(process.execPath, [bin, 'plugin', 'build', '--dry-run', '--format', 'json', '--root', root], {
|
|
91
|
+
encoding: 'utf8',
|
|
92
|
+
})
|
|
93
|
+
: spawnSync('npx', ['universal-plugin', 'plugin', 'build', '--dry-run', '--format', 'json', '--root', root], {
|
|
94
|
+
encoding: 'utf8',
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
const vendors = []
|
|
98
|
+
const build = readJson_stdout(cli.stdout)
|
|
99
|
+
|
|
100
|
+
if (build === null) {
|
|
101
|
+
const stderr = (cli.stderr ?? '').trim()
|
|
102
|
+
if (/required when targeting codex/.test(stderr)) {
|
|
103
|
+
add(
|
|
104
|
+
'codex-fields-missing',
|
|
105
|
+
'high',
|
|
106
|
+
'codex is targeted without version or description — the build writes nothing at all, for any vendor',
|
|
107
|
+
'add both to the canonical top level',
|
|
108
|
+
)
|
|
109
|
+
} else {
|
|
110
|
+
add(
|
|
111
|
+
'build-failed',
|
|
112
|
+
'high',
|
|
113
|
+
stderr.split('\n')[0] || 'plugin build could not resolve the manifest',
|
|
114
|
+
'run plugin build to see the full error',
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
} else {
|
|
118
|
+
const manifestMtime = mtime(manifestPath)
|
|
119
|
+
for (const row of [...build.built, ...build.canonical, ...build.skipped, ...build.failed]) {
|
|
120
|
+
const abs = path.join(root, row.path)
|
|
121
|
+
const exists = fs.existsSync(abs)
|
|
122
|
+
// `canonical` means the vendor reads root plugin.json; no derived file is expected.
|
|
123
|
+
const stale = row.status === 'built' && exists && manifestMtime !== null && mtime(abs) < manifestMtime
|
|
124
|
+
vendors.push({ vendor: row.vendor, path: row.path, status: row.status, exists, stale })
|
|
125
|
+
|
|
126
|
+
if (row.status === 'built' && !exists) {
|
|
127
|
+
add(
|
|
128
|
+
'unbuilt',
|
|
129
|
+
'high',
|
|
130
|
+
`${row.vendor} is declared but ${row.path} does not exist — that runtime sees no plugin`,
|
|
131
|
+
'universal-plugin plugin build',
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
if (stale) {
|
|
135
|
+
add('stale', 'medium', `${row.path} is older than plugin.json`, 'universal-plugin plugin build')
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
for (const warning of build.warnings ?? []) {
|
|
139
|
+
if (/not delivered/.test(warning)) {
|
|
140
|
+
add('undeliverable-override', 'medium', warning, '/universal-plugin:init, update route')
|
|
141
|
+
} else if (/No vendors declared/.test(warning)) {
|
|
142
|
+
add(
|
|
143
|
+
'no-vendors',
|
|
144
|
+
'medium',
|
|
145
|
+
'no vendor is declared — the build writes nothing, so no runtime reads this plugin',
|
|
146
|
+
'/universal-plugin:init, update route',
|
|
147
|
+
)
|
|
148
|
+
} else if (/^Unknown vendor/.test(warning)) {
|
|
149
|
+
add('unknown-vendor', 'medium', warning, 'fix the vendor id in plugin.json')
|
|
150
|
+
} else {
|
|
151
|
+
add('build-warning', 'low', warning, 'read the warning and decide')
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Version drift between the two authored numbers.
|
|
157
|
+
if (packagePath !== null) {
|
|
158
|
+
const pkgPath = path.join(root, packagePath, 'package.json')
|
|
159
|
+
const pkg = readJson(pkgPath)
|
|
160
|
+
if (pkg === null) {
|
|
161
|
+
add(
|
|
162
|
+
'package-path-missing',
|
|
163
|
+
'medium',
|
|
164
|
+
`packagePath names ${packagePath}, which holds no readable package.json`,
|
|
165
|
+
'fix packagePath, or create the package',
|
|
166
|
+
)
|
|
167
|
+
} else if (manifest.version !== undefined && pkg.version !== manifest.version) {
|
|
168
|
+
add(
|
|
169
|
+
'version-drift',
|
|
170
|
+
'high',
|
|
171
|
+
`plugin.json is ${manifest.version}, ${packagePath}/package.json is ${pkg.version}`,
|
|
172
|
+
'/universal-plugin:version',
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Content shipped since the version last moved (ADR-0010 §6). A runtime keys its plugin cache on the
|
|
178
|
+
// version, so anything committed after the commit that set the current one is invisible to a consumer
|
|
179
|
+
// who already installed the plugin. Read-only: the comparison is git's, and it is skipped wherever
|
|
180
|
+
// git cannot answer.
|
|
181
|
+
//
|
|
182
|
+
// Not run where the release picks the number. ADR-0010 §2 makes `packagePath` the switch: a plugin
|
|
183
|
+
// that ships to npm gets its version from the release, so content sitting ahead of the last released
|
|
184
|
+
// one is the normal state there, not a defect. Only the author-picks model can forget the bump.
|
|
185
|
+
if (manifest.version !== undefined && packagePath === null) {
|
|
186
|
+
const introduced = commitThatSetVersion(manifest.version)
|
|
187
|
+
if (introduced !== null) {
|
|
188
|
+
const changed = git('diff', '--name-only', `${introduced}..HEAD`, '--', ...shippedPaths())
|
|
189
|
+
const files = (changed ?? '').split('\n').filter(Boolean)
|
|
190
|
+
if (files.length > 0) {
|
|
191
|
+
const sample = files.slice(0, 3).join(', ')
|
|
192
|
+
add(
|
|
193
|
+
'unreleased-content',
|
|
194
|
+
'medium',
|
|
195
|
+
`${files.length} shipped file(s) changed since ${manifest.version} was set (${sample}${files.length > 3 ? ', …' : ''}) — a consumer keyed on that version never re-extracts them`,
|
|
196
|
+
'/universal-plugin:version',
|
|
197
|
+
)
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
report({ vendors })
|
|
203
|
+
|
|
204
|
+
/** Runs git inside `root`, returning its stdout or `null` — a non-zero status, a missing git, and a
|
|
205
|
+
* directory outside any repository are all the same answer here: no history to read. */
|
|
206
|
+
function git(...args) {
|
|
207
|
+
const result = spawnSync('git', ['-C', root, ...args], { encoding: 'utf8' })
|
|
208
|
+
return result.status === 0 ? result.stdout.trim() : null
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/** The commit that introduced the version the manifest carries now, walking `plugin.json`'s history
|
|
212
|
+
* newest-first until the version changes. `null` when there is no history, or when the newest
|
|
213
|
+
* committed manifest already disagrees — that version is uncommitted, so nothing shipped under it. */
|
|
214
|
+
function commitThatSetVersion(current) {
|
|
215
|
+
const log = git('log', '--format=%H', '-100', '--', 'plugin.json')
|
|
216
|
+
if (log === null || log === '') return null
|
|
217
|
+
|
|
218
|
+
let introduced = null
|
|
219
|
+
for (const sha of log.split('\n').filter(Boolean)) {
|
|
220
|
+
const blob = git('show', `${sha}:./plugin.json`)
|
|
221
|
+
if (blob === null) break
|
|
222
|
+
let version
|
|
223
|
+
try {
|
|
224
|
+
version = JSON.parse(blob).version
|
|
225
|
+
} catch {
|
|
226
|
+
break
|
|
227
|
+
}
|
|
228
|
+
if (version !== current) break
|
|
229
|
+
introduced = sha
|
|
230
|
+
}
|
|
231
|
+
return introduced
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/** What a consumer installs, as pathspecs. The derived vendor manifests are deliberately absent —
|
|
235
|
+
* they only ever change because the canonical manifest did, and counting both would report one
|
|
236
|
+
* change twice. */
|
|
237
|
+
function shippedPaths() {
|
|
238
|
+
const skills = typeof ext?.skills === 'string' ? ext.skills : './skills/'
|
|
239
|
+
const paths = ['plugin.json', skills, 'agents', 'governances', 'mcp.json']
|
|
240
|
+
return paths.filter((rel) => fs.existsSync(path.join(root, rel)))
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function readJson_stdout(stdout) {
|
|
244
|
+
if (!stdout) return null
|
|
245
|
+
try {
|
|
246
|
+
return JSON.parse(stdout)
|
|
247
|
+
} catch {
|
|
248
|
+
return null
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
function report({ vendors }) {
|
|
253
|
+
const result = {
|
|
254
|
+
root,
|
|
255
|
+
manifest: manifest === null ? null : { name: manifest.name ?? null, version: manifest.version ?? null },
|
|
256
|
+
vendors,
|
|
257
|
+
findings,
|
|
258
|
+
ok: findings.length === 0,
|
|
259
|
+
}
|
|
260
|
+
process.stdout.write(`${JSON.stringify(result)}\n`)
|
|
261
|
+
if (verbose) {
|
|
262
|
+
process.stderr.write(result.ok ? 'no findings\n' : `${findings.length} finding(s)\n`)
|
|
263
|
+
for (const f of findings) process.stderr.write(` [${f.severity}] ${f.code}: ${f.detail}\n`)
|
|
264
|
+
}
|
|
265
|
+
process.exit(0)
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/** Where the npm package that ships this plugin lives, or `null` when the plugin ships to no
|
|
269
|
+
* package. `null` is the author-picks release model of ADR-0010 §2. */
|
|
270
|
+
function readPackagePath() {
|
|
271
|
+
const declared = readJson(path.join(root, '.agents', 'universal-plugin.json'))?.packagePath ?? ext?.packagePath
|
|
272
|
+
return typeof declared === 'string' && declared.length > 0 ? declared : null
|
|
273
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# init skill
|
|
2
|
+
|
|
3
|
+
Give a project one canonical `plugin.json` on the [Agent Plugins
|
|
4
|
+
Specification](https://agent-plugins.org), then derive the manifest each runtime expects — Claude
|
|
5
|
+
Code, Cursor, Codex, and GitHub Copilot CLI.
|
|
6
|
+
|
|
7
|
+
## What it does
|
|
8
|
+
|
|
9
|
+
The skill runs a five-phase workflow: survey what the project already has, classify each finding,
|
|
10
|
+
confirm the plan, apply it, then verify and report.
|
|
11
|
+
|
|
12
|
+
It detects what is already there — a canonical manifest, hand-written vendor manifests, a legacy root
|
|
13
|
+
manifest, publicly-shipped skills with no manifest at all — and either adopts it onto the standard,
|
|
14
|
+
rebuilds it, or reports it as something to leave alone. It never rewrites a file the user authored
|
|
15
|
+
without asking first.
|
|
16
|
+
|
|
17
|
+
## Why the derivation step is small
|
|
18
|
+
|
|
19
|
+
Copilot CLI reads the canonical `plugin.json` directly, so nothing is generated for it. Only Claude
|
|
20
|
+
Code, Cursor, and Codex get a derived manifest, and the difference between them is a handful of
|
|
21
|
+
vendor-specific fields under `harnesses.<vendor>`.
|
|
22
|
+
|
|
23
|
+
`references/standard.md` defines the baseline every plugin gets. `references/vendors/<vendor>.md`
|
|
24
|
+
covers what one runtime needs on top of it, and `SKILL.md` routes to them directly rather than
|
|
25
|
+
loading all four.
|
|
26
|
+
|
|
27
|
+
## Routes
|
|
28
|
+
|
|
29
|
+
Phase 4 routes to exactly one reference:
|
|
30
|
+
|
|
31
|
+
| Route | Reference | Covers |
|
|
32
|
+
| --- | --- | --- |
|
|
33
|
+
| Create | [`references/create.md`](./references/create.md) | scaffold a new plugin with chosen vendors and components |
|
|
34
|
+
| Adopt | [`references/adopt.md`](./references/adopt.md) | put an existing vendor-specific plugin, or already-shipped skills, onto the open standard |
|
|
35
|
+
| Update | [`references/update.md`](./references/update.md) | add or remove a vendor or a component |
|
|
36
|
+
|
|
37
|
+
Three neighbours own the rest of the plugin's life, each named for what it does: `doctor` diagnoses,
|
|
38
|
+
`version` moves the number, `remove-plugin` deletes. This skill is the one that writes the manifest.
|
|
39
|
+
|
|
40
|
+
## The part that needs care
|
|
41
|
+
|
|
42
|
+
Deriving a manifest is easy; keeping a skill's *behavior* identical across runtimes is not. Each
|
|
43
|
+
runtime parses the frontmatter fields it knows and silently drops the rest, so anything that must
|
|
44
|
+
hold everywhere belongs in the Markdown body. See `references/frontmatter.md`, which also documents
|
|
45
|
+
`invocation-policy` — the one field this build acts on, by rewriting the authored `SKILL.md`.
|
|
46
|
+
|
|
47
|
+
## Boundaries
|
|
48
|
+
|
|
49
|
+
Plugin authoring only. Setting a repository up to *consume* skills — `AGENTS.md`, the
|
|
50
|
+
`.agents/skills/` layout, per-harness bridges — is `buddy-agent-harness:init`. This skill does not
|
|
51
|
+
touch CI, repository settings, or unrelated project files.
|
|
52
|
+
|
|
53
|
+
## References
|
|
54
|
+
|
|
55
|
+
- [Spec](https://github.com/cyberuni/universal-plugin/blob/main/packages/universal-plugin/.agents/spec/spec.md)
|
|
56
|
+
- [Schema](https://raw.githubusercontent.com/cyberuni/universal-plugin/refs/heads/main/schema/v1.json)
|
|
57
|
+
- [Examples](https://github.com/cyberuni/universal-plugin/tree/main/examples)
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: init
|
|
3
|
+
description: Use this skill to create or change a universal agent plugin — scaffold a new one, adopt an existing vendor-specific plugin or already-shipped skills onto the open Agent Plugins Specification, or add and remove vendors and components on the canonical plugin.json that drives Claude Code, Cursor, Codex, and GitHub Copilot CLI. Trigger on "init a plugin here", "make my Claude Code plugin work in Cursor", "convert this to the open plugin standard", "turn these skills into a plugin", "add Codex support", or "add a hooks component".
|
|
4
|
+
argument-hint: '[--name <name>] [--vendor <id>] [--scaffold] [--npm] [--no-marketplace] [--force]'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Plugin Init
|
|
8
|
+
|
|
9
|
+
Give a project one canonical plugin manifest — a root `plugin.json` on the Agent Plugins
|
|
10
|
+
Specification — and derive from it the manifest each runtime expects.
|
|
11
|
+
|
|
12
|
+
Most of the manifest is shared. The divergence is small and asymmetric: Copilot CLI reads the
|
|
13
|
+
canonical `plugin.json` directly and gets no derived file at all, while Claude Code, Cursor, and
|
|
14
|
+
Codex each read their own path. Keep that asymmetry in mind — this is a consolidation job, not a
|
|
15
|
+
copy-everywhere job.
|
|
16
|
+
|
|
17
|
+
`references/standard.md` defines the baseline every plugin gets. Read the vendor file for each
|
|
18
|
+
runtime you are enabling, and only those.
|
|
19
|
+
|
|
20
|
+
| Vendor | Derived manifest | Extra requirements | Read |
|
|
21
|
+
| --- | --- | --- | --- |
|
|
22
|
+
| Claude Code | `.claude-plugin/plugin.json` | none | `references/vendors/claude-code.md` |
|
|
23
|
+
| Cursor | `.cursor-plugin/plugin.json` | none | `references/vendors/cursor.md` |
|
|
24
|
+
| Codex | `.codex-plugin/plugin.json` | `version`, `description` | `references/vendors/codex.md` |
|
|
25
|
+
| GitHub Copilot CLI | none — reads root `plugin.json` | none | `references/vendors/copilot-cli.md` |
|
|
26
|
+
|
|
27
|
+
This skill owns the **authoring** side: the plugin a project ships. Setting a repository up to
|
|
28
|
+
*consume* skills — the `.agents/skills/` layout, `AGENTS.md`, per-harness bridges — is
|
|
29
|
+
`buddy-agent-harness:init`, not this.
|
|
30
|
+
|
|
31
|
+
## Prerequisites
|
|
32
|
+
|
|
33
|
+
Load the component-selection governance before any work that adds or removes components:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx universal-plugin governance show plugin-design
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
It is the authoritative source for which component to reach for and which anti-patterns to avoid.
|
|
40
|
+
|
|
41
|
+
## Arguments
|
|
42
|
+
|
|
43
|
+
An invocation may carry the CLI's own flags: `/universal-plugin:init --name my-plugin --scaffold --npm`.
|
|
44
|
+
|
|
45
|
+
Read them from the invocation itself rather than from a placeholder. Claude Code appends what the
|
|
46
|
+
caller typed as `ARGUMENTS: <value>`, and Codex substitutes nothing at all, so on every runtime the
|
|
47
|
+
flags arrive as text you can read. Writing `$ARGUMENTS` into this body would resolve on Claude Code
|
|
48
|
+
and stay literal everywhere else.
|
|
49
|
+
|
|
50
|
+
- `--name`, `--vendor`, `--scaffold`, `--force`, `--npm`, and `--root` pass through to
|
|
51
|
+
`universal-plugin plugin init` in Phase 4.
|
|
52
|
+
- Prose carries the same weight: "ship it on npm" means `--npm`, "overwrite what's there" means
|
|
53
|
+
`--force`.
|
|
54
|
+
- An argument never skips a phase. `--force` still needs the Phase 3 approval, and the survey still
|
|
55
|
+
runs first.
|
|
56
|
+
- Say what you did not recognize and carry on. Never guess at a flag.
|
|
57
|
+
|
|
58
|
+
Work in five phases. Do not skip Phase 3.
|
|
59
|
+
|
|
60
|
+
## 1. Survey
|
|
61
|
+
|
|
62
|
+
Locate the plugin root — the directory that holds, or will hold, the canonical `plugin.json`. In a
|
|
63
|
+
monorepo that is usually the package that ships the plugin, not the repository root; `migrate-plugin`
|
|
64
|
+
covers moving one that sits in the wrong place.
|
|
65
|
+
|
|
66
|
+
Inventory both the canonical surface (root `plugin.json`, its `extensions` block, the component
|
|
67
|
+
directories it names) and every pre-existing vendor artifact listed in `references/detection.md`.
|
|
68
|
+
Read what you find. Write nothing yet.
|
|
69
|
+
|
|
70
|
+
## 2. Classify
|
|
71
|
+
|
|
72
|
+
Sort each finding into exactly one bucket:
|
|
73
|
+
|
|
74
|
+
- **canonical** — a root `plugin.json` with `$schema` on `agent-plugins.org` and an `extensions`
|
|
75
|
+
object. This is the source of truth; every edit lands here.
|
|
76
|
+
- **derived** — `.claude-plugin/`, `.cursor-plugin/`, `.codex-plugin/` manifests that `plugin build`
|
|
77
|
+
regenerates. Rebuild them; never hand-edit them.
|
|
78
|
+
- **adoptable** — a hand-written vendor manifest with no canonical manifest above it, a legacy root
|
|
79
|
+
`plugin.json` carrying neither `$schema` nor `extensions`, or publicly-shipped skills with no
|
|
80
|
+
manifest at all. These become canonical content in Phase 4.
|
|
81
|
+
- **undeliverable** — a vendor-specific field with no delivery path, most often a
|
|
82
|
+
`harnesses["copilot-cli"]` override: the canonical schema is closed, so the field cannot ride
|
|
83
|
+
along in root and the build warns about it. Report; do not invent a home for it.
|
|
84
|
+
- **not a plugin** — repo-private agent configuration (`.claude/skills/`, `.agents/skills/`,
|
|
85
|
+
`.cursor/rules/`). It is this project's own tooling, not something it distributes. Say nothing
|
|
86
|
+
about packaging it.
|
|
87
|
+
|
|
88
|
+
`references/detection.md` maps each signal to its bucket, and draws the public-versus-private line
|
|
89
|
+
that decides the last two.
|
|
90
|
+
|
|
91
|
+
## 3. Confirm
|
|
92
|
+
|
|
93
|
+
Present the plan before touching anything the user wrote: which files will be created, which
|
|
94
|
+
hand-written vendor manifests become generated artifacts, which vendors will be enabled, what the
|
|
95
|
+
canonical metadata will say (show `name`, `version`, and `description` verbatim), and what is being
|
|
96
|
+
left alone and why.
|
|
97
|
+
|
|
98
|
+
Get explicit approval before any step that deletes, replaces, or rewrites a user-authored file —
|
|
99
|
+
adoption always crosses that line, because it turns manifests the user maintains into build output.
|
|
100
|
+
Creating a missing `plugin.json`, a missing component directory, or a missing skill scaffold needs
|
|
101
|
+
no approval; report those rather than asking.
|
|
102
|
+
|
|
103
|
+
One case needs asking even when nothing is overwritten: two vendor manifests that disagree on a
|
|
104
|
+
shared field. A silent pick there is a silent behavior change for one runtime.
|
|
105
|
+
|
|
106
|
+
## 4. Apply
|
|
107
|
+
|
|
108
|
+
Route by what Phase 2 found. Read exactly the reference for the work at hand — do not load all six.
|
|
109
|
+
|
|
110
|
+
| What Phase 2 found | Do this | Reference |
|
|
111
|
+
| --- | --- | --- |
|
|
112
|
+
| nothing — greenfield | scaffold a canonical manifest and its components | [`references/create.md`](./references/create.md) |
|
|
113
|
+
| adoptable | carry it onto the canonical manifest, losslessly | [`references/adopt.md`](./references/adopt.md) |
|
|
114
|
+
| canonical, and a vendor or component changes | edit `extensions`, then rebuild | [`references/update.md`](./references/update.md) |
|
|
115
|
+
|
|
116
|
+
Three asks leave this skill rather than routing inside it. Hand them over instead of improvising a
|
|
117
|
+
route: **`doctor`** reports what is declared, built, stale, or drifting; **`version`** moves the
|
|
118
|
+
number; **`remove-plugin`** deletes derived manifests or the plugin itself.
|
|
119
|
+
|
|
120
|
+
Every route ends in the same two commands. Scaffold with the CLI that shipped beside this skill:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
node scripts/init.mjs --name <plugin-name> --vendor claude-code --vendor cursor
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Resolve that path against this skill's own directory. The launcher runs the bundled CLI, so nothing
|
|
127
|
+
is downloaded; fall back to `npx universal-plugin plugin init` when the path cannot be resolved.
|
|
128
|
+
`plugin init` never prompts, so it is safe to run unattended (`--yes` is accepted as a no-op).
|
|
129
|
+
|
|
130
|
+
Then derive the vendor manifests:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
npx universal-plugin plugin build
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
To try the result before publishing, `npx universal-plugin plugin install` puts the working copy
|
|
137
|
+
into every runtime the manifest declares and names the reload each one needs. Never hand-write a
|
|
138
|
+
symlink for this — `references/create.md` records why the recipe that circulated for it does not
|
|
139
|
+
work.
|
|
140
|
+
|
|
141
|
+
With `--vendor`, `plugin init` also registers the plugin in the repository's local marketplace: it
|
|
142
|
+
writes each selected vendor's catalog at the **repository** root and folds an entry for this plugin
|
|
143
|
+
into it, so users can add the repository as a marketplace and install from it. Say what it wrote,
|
|
144
|
+
and read back any line it printed on stderr — a repository with no author, no package author, and no
|
|
145
|
+
remote gets no catalog, because every runtime requires an owner. `--no-marketplace` skips the step.
|
|
146
|
+
|
|
147
|
+
The catalog is named after the repository, `<owner>-<repo>-local`, not after the plugin: it lists
|
|
148
|
+
every plugin the repository develops. Re-running `init` folds the entry back in and leaves the
|
|
149
|
+
marketplace name, the owner, and every other entry alone, so it is safe over a catalog someone
|
|
150
|
+
edited. Generating catalogs for a repository that already holds several plugins, and writing the
|
|
151
|
+
README install section, is the `marketplace` skill's job.
|
|
152
|
+
|
|
153
|
+
`plugin init` writes a **minimal** manifest — `$schema`, `name`, and the vendor list. It never reads
|
|
154
|
+
an existing vendor manifest, so shared metadata and per-vendor overrides are carried in by hand
|
|
155
|
+
afterwards, per the reference you routed to.
|
|
156
|
+
|
|
157
|
+
If the request spans more than one route ("add Codex, then cut a release"), take this skill's part
|
|
158
|
+
first and hand the rest to the skill that owns it. If the route is unclear, ask which the user means
|
|
159
|
+
rather than guessing.
|
|
160
|
+
|
|
161
|
+
## 5. Verify and report
|
|
162
|
+
|
|
163
|
+
Confirm the build wrote what the manifest declares: one file per derived vendor, `canonical` status
|
|
164
|
+
and no file for Copilot CLI. Read the build's warnings — an unknown vendor id and an undeliverable
|
|
165
|
+
override both surface there and both are silent capability loss if ignored.
|
|
166
|
+
|
|
167
|
+
When the work was an adoption, the proof is the diff:
|
|
168
|
+
|
|
169
|
+
```bash
|
|
170
|
+
git diff -- .claude-plugin .cursor-plugin .codex-plugin .github/plugin
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Expect only formatting and key-order churn. Any field that disappeared is a regression, not a
|
|
174
|
+
cleanup — trace it back to the shared metadata or to that vendor's `harnesses` entry before shipping.
|
|
175
|
+
|
|
176
|
+
Audit each skill the plugin ships, per [`references/create.md`](./references/create.md) Step 6.
|
|
177
|
+
Report what was created, adopted, derived, and left alone. For a fuller read of the plugin's state
|
|
178
|
+
than this phase gives — drift, version skew, shadowing manifests — hand off to `doctor`.
|
|
179
|
+
|
|
180
|
+
This skill is not a formatter. If the project has one, run it over the written files and say so.
|
|
181
|
+
|
|
182
|
+
## Rules
|
|
183
|
+
|
|
184
|
+
- **Edit the canonical manifest, never a derived one.** `.claude-plugin/plugin.json` and its
|
|
185
|
+
siblings belong to `plugin build`; a hand-edit there is overwritten on the next build.
|
|
186
|
+
- **Never hand-edit a `version` field.** Two authored files and every derived artifact fall out of
|
|
187
|
+
sync. The `version` skill owns that move.
|
|
188
|
+
- **Adoption is lossless by contract.** Every vendor that worked before must still work after, and
|
|
189
|
+
the Phase 5 diff is the check that proves it.
|
|
190
|
+
- **Do not package repo-private agent configuration.** A `.claude/skills/` directory is the project's
|
|
191
|
+
own tooling; offering to publish it is wrong.
|
|
192
|
+
- **Do not convert vendor settings without a documented mapping.** Hooks have one: author them in
|
|
193
|
+
canonical PascalCase and `plugin build` derives each vendor's form, dropping handler types a vendor
|
|
194
|
+
cannot run — see `references/vendors/claude-code.md`. Unmapped settings stay where they are,
|
|
195
|
+
reported.
|
|
196
|
+
- **Offer adoption once.** If the user declines, or asked for something unrelated, drop it and do
|
|
197
|
+
what they asked.
|
|
198
|
+
- Plugin authoring only. Do not change CI workflows, repository settings, or unrelated project files.
|
|
199
|
+
|
|
200
|
+
## Related skills
|
|
201
|
+
|
|
202
|
+
| Task | Skill |
|
|
203
|
+
|------|-------|
|
|
204
|
+
| Diagnose a plugin — what is declared, built, stale, or drifting | `doctor` |
|
|
205
|
+
| Make the repository installable, and document how | `marketplace` |
|
|
206
|
+
| Move the plugin's version, or reconcile one that drifted | `version` |
|
|
207
|
+
| Delete derived manifests, or the whole plugin | `remove-plugin` |
|
|
208
|
+
| Move a repo-root plugin into its npm package | `migrate-plugin` |
|
|
209
|
+
| Publish a packaged plugin to the marketplace | `publish-plugin` |
|
|
210
|
+
| Bump the pinned `universal-plugin@<version>` the project *calls* (not the plugin's own version) | `upgrade-plugin` |
|
|
211
|
+
| Rewrite `npx` pins to the `upx` runner | `adopt-upx` |
|
|
212
|
+
| Set a repository up to *consume* skills (`AGENTS.md`, `.agents/skills/`) | `buddy-agent-harness:init` |
|
|
213
|
+
|
|
214
|
+
## References
|
|
215
|
+
|
|
216
|
+
- Governance: `npx universal-plugin governance show plugin-design`
|
|
217
|
+
- Spec: https://github.com/cyberuni/universal-plugin/blob/main/packages/universal-plugin/.agents/spec/spec.md
|
|
218
|
+
- Schema: https://raw.githubusercontent.com/cyberuni/universal-plugin/refs/heads/main/schema/v1.json
|
|
219
|
+
- Examples: https://github.com/cyberuni/universal-plugin/tree/main/examples
|
|
@@ -16,8 +16,9 @@ is the check that proves it — do not skip it.
|
|
|
16
16
|
|
|
17
17
|
## Step 0 — Confirm the user wants this
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
This is the skill's Phase 3 gate, and adoption always needs it: adoption rewrites the project's
|
|
20
|
+
manifest layout and turns hand-written vendor manifests into generated artifacts. Say that plainly
|
|
21
|
+
and get agreement before touching files. If the user declines,
|
|
21
22
|
route back to whatever they originally asked for.
|
|
22
23
|
|
|
23
24
|
Also confirm the working tree is clean (`git status`). The Step 6 diff is worthless if uncommitted
|
|
@@ -37,7 +38,7 @@ reproduce all of it.
|
|
|
37
38
|
|
|
38
39
|
**If a root `plugin.json` already exists**, read it before assuming anything. It is either the
|
|
39
40
|
canonical manifest (has `$schema` pointing at `agent-plugins.org` and an `extensions` object — in
|
|
40
|
-
which case there is nothing to adopt; route to `update.md
|
|
41
|
+
which case there is nothing to adopt; route to `update.md`, or hand off to `doctor`, instead), or a legacy
|
|
41
42
|
Copilot CLI manifest that now collides with the canonical path and must be folded in.
|
|
42
43
|
|
|
43
44
|
## Step 2 — Sort every field into shared vs vendor-specific
|
|
@@ -58,9 +59,12 @@ rather than picking one. A silent choice here is a silent behavior change for on
|
|
|
58
59
|
Scaffold it, naming exactly the vendors you found in Step 1:
|
|
59
60
|
|
|
60
61
|
```bash
|
|
61
|
-
|
|
62
|
+
node scripts/init.mjs --name <name> --vendor claude-code --vendor cursor
|
|
62
63
|
```
|
|
63
64
|
|
|
65
|
+
Resolve `scripts/init.mjs` against this skill's directory; `npx universal-plugin plugin init` is the
|
|
66
|
+
fallback.
|
|
67
|
+
|
|
64
68
|
> `plugin init` writes a **minimal** manifest — `$schema`, `name`, and the `vendors` list. It does
|
|
65
69
|
> not read your existing vendor manifests. Carry the Step 2 buckets in by hand afterwards.
|
|
66
70
|
|