Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions eng/materialize-plugins.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,30 @@ function materializePlugins() {
}
}

// Rewrite plugin.json to use folder paths instead of individual file paths.
// On staged, paths like ./agents/foo.md point to individual source files.
// On main, after materialization, we only need the containing directory.
const rewritten = { ...metadata };
let changed = false;

for (const field of ["agents", "commands"]) {
if (Array.isArray(rewritten[field]) && rewritten[field].length > 0) {
const dirs = [...new Set(rewritten[field].map(p => path.dirname(p)))];
rewritten[field] = dirs;
changed = true;
}
}

if (Array.isArray(rewritten.skills) && rewritten.skills.length > 0) {
// Skills are already folder refs (./skills/name/); strip trailing slash
rewritten.skills = rewritten.skills.map(p => p.replace(/\/$/, ""));
changed = true;
}

if (changed) {
fs.writeFileSync(pluginJsonPath, JSON.stringify(rewritten, null, 2) + "\n", "utf8");
}

Comment on lines +148 to +171
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This produces plugin.json values (e.g. "agents": ["./agents"]) that no longer satisfy the repository’s own plugin manifest validation rules: eng/validate-plugins.mjs currently enforces that agents/commands entries start with ./agents//./commands/ and end with .md (and skills end with /). If plugin.json on main is intentionally different, the validator (and any tooling depending on this schema) should be updated accordingly or split into staged-vs-main manifests.

This issue also appears in the following locations of the same file:

  • line 148
  • line 154
  • line 162
Suggested change
// Rewrite plugin.json to use folder paths instead of individual file paths.
// On staged, paths like ./agents/foo.md point to individual source files.
// On main, after materialization, we only need the containing directory.
const rewritten = { ...metadata };
let changed = false;
for (const field of ["agents", "commands"]) {
if (Array.isArray(rewritten[field]) && rewritten[field].length > 0) {
const dirs = [...new Set(rewritten[field].map(p => path.dirname(p)))];
rewritten[field] = dirs;
changed = true;
}
}
if (Array.isArray(rewritten.skills) && rewritten.skills.length > 0) {
// Skills are already folder refs (./skills/name/); strip trailing slash
rewritten.skills = rewritten.skills.map(p => p.replace(/\/$/, ""));
changed = true;
}
if (changed) {
fs.writeFileSync(pluginJsonPath, JSON.stringify(rewritten, null, 2) + "\n", "utf8");
}

Copilot uses AI. Check for mistakes.
const counts = [];
if (metadata.agents?.length) counts.push(`${metadata.agents.length} agents`);
if (metadata.commands?.length) counts.push(`${metadata.commands.length} commands`);
Expand Down