mirror of
https://github.com/github/awesome-copilot.git
synced 2026-07-14 01:51:02 +00:00
e986f49695
* Remove pluginRoots property from marketplace.json The pluginRoots property is not used by install tooling and was only informational about the extension/plugin source directories. Removing it simplifies the marketplace.json structure while maintaining all functionality. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Migrate java-modernization-studio to plugin.json and update validation workflow - Create .github/plugin/plugin.json for java-modernization-studio extension - Remove legacy canvas.json from java-modernization-studio - Update validate-canvas-extensions.yml workflow to check for plugin.json instead of canvas.json - Update workflow to trigger on .schemas/plugin.schema.json changes (instead of canvas.schema.json) - Remove schema validation logic that relied on canvas.schema.json - All 12 extensions now use plugin.json for metadata Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Add extensions field to all extension plugin.json files Per https://github.com/github/copilot-agent-runtime/pull/9929, plugins that ship extensions need to include an extensions field specifying where the extension code is located. All 12 extensions now have extensions set to '.' to reference the current directory where extension.mjs is located. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Enforce convention-based extension metadata and remove x-awesome-copilot - Remove x-awesome-copilot.screenshots from all extension plugin.json files - Enforce logo=assets/preview.png convention for all extensions - Enforce extensions=. per copilot-agent-runtime#9929 - Update validate-plugins.mjs to enforce conventions - Update validate-canvas-extensions.yml workflow with convention checks - Update AGENTS.md and CONTRIBUTING.md documentation All 12 extensions validated successfully. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Use standard plugin validation for extensions Remove the custom extension schema and schema validation helper, and validate extension plugin.json files through the existing plugin validator instead. Update workflows to stop depending on the removed schema. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
139 lines
4.3 KiB
JavaScript
Executable File
139 lines
4.3 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
import fs from "fs";
|
|
import path from "path";
|
|
import { ROOT_FOLDER } from "./constants.mjs";
|
|
import { readExternalPlugins } from "./external-plugin-validation.mjs";
|
|
|
|
const PLUGINS_DIR = path.join(ROOT_FOLDER, "plugins");
|
|
const EXTENSIONS_DIR = path.join(ROOT_FOLDER, "extensions");
|
|
const MARKETPLACE_FILE = path.join(ROOT_FOLDER, ".github/plugin", "marketplace.json");
|
|
|
|
/**
|
|
* Read plugin metadata from plugin.json file
|
|
* @param {string} pluginDir - Path to plugin directory
|
|
* @returns {object|null} - Plugin metadata or null if not found
|
|
*/
|
|
function readPluginMetadata(pluginDir) {
|
|
const pluginJsonPath = path.join(pluginDir, ".github/plugin", "plugin.json");
|
|
|
|
if (!fs.existsSync(pluginJsonPath)) {
|
|
console.warn(`Warning: No plugin.json found for ${path.basename(pluginDir)}`);
|
|
return null;
|
|
}
|
|
|
|
try {
|
|
const content = fs.readFileSync(pluginJsonPath, "utf8");
|
|
return JSON.parse(content);
|
|
} catch (error) {
|
|
console.error(`Error reading plugin.json for ${path.basename(pluginDir)}:`, error.message);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
function collectLocalPluginsFromRoot(rootDir, sourcePrefix, includeEntry = () => true) {
|
|
if (!fs.existsSync(rootDir)) {
|
|
return [];
|
|
}
|
|
|
|
const entries = fs.readdirSync(rootDir, { withFileTypes: true })
|
|
.filter(entry => entry.isDirectory())
|
|
.filter(entry => includeEntry(entry.name))
|
|
.map(entry => entry.name)
|
|
.sort();
|
|
|
|
const plugins = [];
|
|
for (const dirName of entries) {
|
|
const pluginPath = path.join(rootDir, dirName);
|
|
const metadata = readPluginMetadata(pluginPath);
|
|
|
|
if (!metadata) {
|
|
continue;
|
|
}
|
|
|
|
plugins.push({
|
|
name: metadata.name,
|
|
source: `${sourcePrefix}/${dirName}`,
|
|
description: metadata.description,
|
|
version: metadata.version || "1.0.0"
|
|
});
|
|
}
|
|
|
|
return plugins;
|
|
}
|
|
|
|
/**
|
|
* Generate marketplace.json from plugin directories
|
|
*/
|
|
function generateMarketplace() {
|
|
console.log("Generating marketplace.json...");
|
|
|
|
if (!fs.existsSync(PLUGINS_DIR) && !fs.existsSync(EXTENSIONS_DIR)) {
|
|
console.error(`Error: Neither plugins directory (${PLUGINS_DIR}) nor extensions directory (${EXTENSIONS_DIR}) was found`);
|
|
process.exit(1);
|
|
}
|
|
|
|
const plugins = [
|
|
...collectLocalPluginsFromRoot(PLUGINS_DIR, "plugins"),
|
|
...collectLocalPluginsFromRoot(
|
|
EXTENSIONS_DIR,
|
|
"extensions",
|
|
(entryName) => fs.existsSync(path.join(EXTENSIONS_DIR, entryName, "extension.mjs"))
|
|
)
|
|
];
|
|
|
|
console.log(`Found ${plugins.length} local plugin manifests`);
|
|
|
|
// Read external plugins and merge as-is
|
|
const { plugins: externalPlugins, errors: externalErrors, warnings: externalWarnings } = readExternalPlugins({
|
|
localPluginNames: plugins.map((plugin) => plugin.name),
|
|
policy: "marketplace",
|
|
});
|
|
externalWarnings.forEach((warning) => console.warn(`Warning: ${warning}`));
|
|
if (externalErrors.length > 0) {
|
|
externalErrors.forEach((error) => console.error(`Error: ${error}`));
|
|
console.error("Error: external.json contains invalid entries");
|
|
process.exit(1);
|
|
}
|
|
|
|
if (externalPlugins.length > 0) {
|
|
console.log(`\nFound ${externalPlugins.length} external plugins`);
|
|
for (const ext of externalPlugins) {
|
|
plugins.push(ext);
|
|
console.log(`✓ Added external plugin: ${ext.name}`);
|
|
}
|
|
}
|
|
|
|
// Sort all plugins by name (case-insensitive)
|
|
plugins.sort((a, b) => a.name.localeCompare(b.name, undefined, { sensitivity: "base" }));
|
|
|
|
// Create marketplace.json structure
|
|
const marketplace = {
|
|
name: "awesome-copilot",
|
|
metadata: {
|
|
description: "Community-driven collection of GitHub Copilot plugins, agents, prompts, and skills",
|
|
version: "1.0.0"
|
|
},
|
|
owner: {
|
|
name: "GitHub",
|
|
email: "copilot@github.com"
|
|
},
|
|
plugins: plugins
|
|
};
|
|
|
|
// Ensure directory exists
|
|
const marketplaceDir = path.dirname(MARKETPLACE_FILE);
|
|
if (!fs.existsSync(marketplaceDir)) {
|
|
fs.mkdirSync(marketplaceDir, { recursive: true });
|
|
}
|
|
|
|
// Write marketplace.json
|
|
fs.writeFileSync(MARKETPLACE_FILE, JSON.stringify(marketplace, null, 2) + "\n");
|
|
|
|
console.log(`\n✓ Successfully generated marketplace.json with ${plugins.length} plugins (${plugins.length - externalPlugins.length} local, ${externalPlugins.length} external)`);
|
|
console.log(` Location: ${MARKETPLACE_FILE}`);
|
|
}
|
|
|
|
// Run the script
|
|
generateMarketplace();
|