Skip to content

Commit 4e2dddc

Browse files
committed
fix(generator): copy the icon to .claude-plugin/ instead of an icon key
The claude.ai marketplace sync (Agent SDK) warns that 'icon' is an unknown plugin.json key and strips it. The generator now leaves the key out and writes .claude-plugin/icon.png as a byte copy of the configured icon (checked by --check, removed when claude is off). Other harnesses keep their logo fields. Tested: npm test (16 pass), build --check, typecheck, unittest, claude plugin validate (both profiles). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QT6szwqRxEU4hkZ39MB5av
1 parent 94b4710 commit 4e2dddc

5 files changed

Lines changed: 32 additions & 10 deletions

File tree

‎.claude-plugin/icon.png‎

3.69 KB
Loading

‎.claude-plugin/plugin.json‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@
1616
"cli",
1717
"api",
1818
"console"
19-
],
20-
"icon": "./assets/icon.png"
19+
]
2120
}

‎AGENTS.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ the plugin uses it; **doc** = described here only, not in the template.
119119
│ └── <server code> opt
120120
├── assets/icon.png core
121121
├── .claude-plugin/
122-
│ ├── plugin.json gen Claude Code manifest
122+
│ ├── plugin.json gen Claude Code manifest (no `icon` key: see conflict 8)
123+
│ ├── icon.png gen copy of assets/icon.png (Claude finds it here)
123124
│ └── marketplace.json gen one-plugin marketplace, source "./" (Claude, Copilot, Droid,
124125
│ Augment, Junie; Codex reads it as a legacy location)
125126
├── .mcp.json gen Claude-format MCP (${CLAUDE_PLUGIN_ROOT}); Cursor, Droid, Augment, Devin read it
@@ -200,7 +201,7 @@ Modules: `types.ts` (config shape, `validateConfig`, `nameProblem`), `frontmatte
200201
| `author` | `{name, email?, url?}` | every manifest; Codex `developerName` |
201202
| `homepage`, `repository` | `https://` URLs | manifests, `package.json`, Codex `websiteURL` |
202203
| `license`, `keywords` | SPDX id; string list | manifests (Pi adds `pi-package`) |
203-
| `icon` | path inside the repo | Claude `icon`, Codex `logo`/`composerIcon`, Cursor and Antigravity `logo` |
204+
| `icon` | path inside the repo | copied to `.claude-plugin/icon.png`; Codex `logo`/`composerIcon`, Cursor and Antigravity `logo` |
204205
| `category` | e.g. `Developer Tools` | Codex |
205206
| `harnesses` | one boolean per output group (below) | which files exist |
206207
| `agentPlugins`, `codex`, `claude`, `claudeMarketplace`, `cursor`, `antigravity`, `gemini`, `kimi`, `muse`, `packageJson` | optional objects | deep-merged into that one file (`codex` into `extensions["com.openai"]`); arrays are replaced, not merged |
@@ -271,7 +272,7 @@ periods (Antigravity forbids them). Not `claude`, and not starting `claude-`, `a
271272
| 5 | **Root `AGENTS.md`**: Devin loads it as an always-on rule; Antigravity warns and ignores it; coding agents read it as dev instructions. | Decided (the user, 2026-11-27): keep dev instructions here and accept that Devin users get them. superpowers does the same. |
272273
| 6 | **Agents**: frontmatter differs (Claude `model: sonnet`, Antigravity `model: flash`, Copilot `*.agent.md`). | `agents/*.md` in Claude format; Copilot copies keep only `name` and `description`. Antigravity with Claude model names is [T]. |
273274
| 7 | **Commands**: Claude and Cursor read `commands/*.md`, Gemini `commands/*.toml`, Qwen both, Antigravity warns about `commands/`. | Prefer skills. `.md` and `.toml` commands coexist without clashing. |
274-
| 8 | **Icon fields**: Claude `icon`, Agent Plugins 1.1 `assets/icon.png`, Codex `logo` + `composerIcon`, Cursor, Antigravity (≥ 128 px) and Devin `logo`. | One `assets/icon.png` for all. |
275+
| 8 | **Icon fields**: Claude `icon`, Agent Plugins 1.1 `assets/icon.png`, Codex `logo` + `composerIcon`, Cursor, Antigravity (≥ 128 px) and Devin `logo`. | One `assets/icon.png` for all. Claude gets a generated copy at `.claude-plugin/icon.png` and no `icon` key: the claude.ai marketplace sync (Agent SDK) warns about `icon` as an unknown key (2026-11-28). |
275276
| 9 | **Cursor**: precedence between a root `plugin.json` and `.cursor-plugin/plugin.json` is undocumented. | [T]. If the root one wins, Cursor gets skills + MCP only. |
276277
| 10 | Claude's `skills` manifest path **adds** to `skills/`; Cursor's **replaces** it. | Never set `skills` in a manifest (Kimi's `./skills/` is the same folder). |
277278
| 11 | Claude doesn't load a plugin's root `CLAUDE.md`; `claude plugin validate` may warn. | Accept it: it's the dev-instruction file. |

‎scripts/generate.ts‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const FIXED_OUTPUTS: Record<string, Harness | 'always'> = {
1818
'mcp.json': 'agentPlugins',
1919
'.claude-plugin/plugin.json': 'claude',
2020
'.claude-plugin/marketplace.json': 'claude',
21+
'.claude-plugin/icon.png': 'claude',
2122
'.mcp.json': 'claude',
2223
'.cursor-plugin/plugin.json': 'cursor',
2324
'.antigravity-plugin/plugin.json': 'antigravity',
@@ -39,7 +40,7 @@ export interface Skill {
3940
}
4041

4142
export interface Plan {
42-
files: Map<string, string>; // repo-relative POSIX path -> content
43+
files: Map<string, string | Buffer>; // repo-relative POSIX path -> content (Buffer for binary copies)
4344
errors: string[];
4445
warnings: string[];
4546
}
@@ -204,7 +205,7 @@ function copilotAgents(root: string, errors: string[]): Map<string, string> {
204205
// --- The plan ---------------------------------------------------------------------------------
205206

206207
export function plan(root: string, configPath = join(root, 'plugin.config.json')): Plan {
207-
const files = new Map<string, string>();
208+
const files = new Map<string, string | Buffer>();
208209
const errors: string[] = [];
209210
const warnings: string[] = [];
210211
let raw: unknown;
@@ -256,7 +257,12 @@ export function plan(root: string, configPath = join(root, 'plugin.config.json')
256257
if (mcp) files.set('mcp.json', json({ $schema: AP_MCP_SCHEMA, mcpServers: mcpServers(mcp, 'agentPlugins', errors) }));
257258
}
258259
if (on.claude) {
259-
files.set('.claude-plugin/plugin.json', json(merge({ ...common, icon }, c.claude)));
260+
// No `icon` key: Claude Code finds .claude-plugin/icon.png by itself, and the claude.ai
261+
// marketplace sync (Agent SDK) warns about `icon` as an unknown key and strips it.
262+
files.set('.claude-plugin/plugin.json', json(merge(common, c.claude)));
263+
if (c.icon !== '.claude-plugin/icon.png' && exists(c.icon)) {
264+
files.set('.claude-plugin/icon.png', readFileSync(join(root, c.icon)));
265+
}
260266
files.set('.claude-plugin/marketplace.json', json(merge({
261267
name: c.name,
262268
owner: clean({ name: c.author.name, email: c.author.email }),
@@ -364,7 +370,9 @@ export function diff(root: string, p: Plan): Diff {
364370
for (const [path, content] of p.files) {
365371
const full = join(root, path);
366372
if (!existsSync(full)) d.missing.push(path);
367-
else if (readFileSync(full, 'utf8') !== content) d.stale.push(path);
373+
else if (typeof content === 'string' ? readFileSync(full, 'utf8') !== content : !readFileSync(full).equals(content)) {
374+
d.stale.push(path);
375+
}
368376
}
369377
for (const path of ownedOnDisk(root)) if (!p.files.has(path)) d.leftover.push(path);
370378
return d;
@@ -374,7 +382,7 @@ export function write(root: string, p: Plan): Diff {
374382
const d = diff(root, p);
375383
for (const path of [...d.missing, ...d.stale]) {
376384
mkdirSync(dirname(join(root, path)), { recursive: true });
377-
writeFileSync(join(root, path), p.files.get(path) as string);
385+
writeFileSync(join(root, path), p.files.get(path) as string | Buffer);
378386
}
379387
for (const path of d.leftover) rmSync(join(root, path));
380388
return d;

‎tests/build.test.ts‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@ test('writes every enabled manifest, then --check is clean', () => {
6262
assert.deepEqual(pkg.pi, { skills: ['./skills'] });
6363
});
6464

65+
test('copies the icon into .claude-plugin/ and leaves the icon key out of the Claude manifest', () => {
66+
const root = fixture();
67+
write(root, plan(root));
68+
assert.equal(readFileSync(join(root, '.claude-plugin/icon.png'), 'utf8'), 'png');
69+
assert.equal('icon' in read(root, '.claude-plugin/plugin.json'), false);
70+
put(root, 'assets/icon.png', 'new');
71+
assert.deepEqual(diff(root, plan(root)).stale, ['.claude-plugin/icon.png']);
72+
write(root, plan(root));
73+
assert.equal(readFileSync(join(root, '.claude-plugin/icon.png'), 'utf8'), 'new');
74+
put(root, 'plugin.config.json', JSON.stringify(config({ harnesses: { ...config().harnesses, claude: false } })));
75+
write(root, plan(root));
76+
assert.equal(existsSync(join(root, '.claude-plugin/icon.png')), false);
77+
});
78+
6579
test('the opencode catalog leaves out Python caches, so running tests cannot make it stale', () => {
6680
const root = fixture();
6781
put(root, 'skills/hello/scripts/x.py', 'pass\n');

0 commit comments

Comments
 (0)