mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-23 11:55:12 +00:00
Merge main: resolve conflicts, keep plugin-first approach
- Removed re-added collections/ path triggers from CI - Merged plugin checklist improvements from both branches - Kept plugin:generate-marketplace script from main - Removed new ospo-sponsorship collection file (plugin already exists) - Dropped obsolete plugin:migrate and plugin:refresh scripts
This commit is contained in:
@@ -1,6 +1,30 @@
|
||||
# Contributor Reporting (Maintainers) 🚧
|
||||
|
||||
This directory contains a lightweight helper to generate human-readable reports about missing contributors.
|
||||
This directory contains build scripts and utilities for maintaining the repository.
|
||||
|
||||
## Build Scripts
|
||||
|
||||
### `update-readme.mjs`
|
||||
Generates the main README.md and documentation files from the repository content (agents, prompts, instructions, skills, hooks, collections).
|
||||
|
||||
### `generate-marketplace.mjs`
|
||||
Automatically generates `.github/plugin/marketplace.json` from all plugin directories in the `plugins/` folder. This file is used by the GitHub Copilot CLI to discover and install plugins from this repository.
|
||||
|
||||
**How it works:**
|
||||
- Scans all directories in `plugins/`
|
||||
- Reads each plugin's `.github/plugin/plugin.json` for metadata
|
||||
- Generates a consolidated `marketplace.json` with all available plugins
|
||||
- Runs automatically as part of `npm run build`
|
||||
|
||||
**To run manually:**
|
||||
```bash
|
||||
npm run plugin:generate-marketplace
|
||||
```
|
||||
|
||||
### `generate-website-data.mjs`
|
||||
Generates JSON data files for the website from repository content.
|
||||
|
||||
## Contributor Tools
|
||||
|
||||
- `contributor-report.mjs` — generates a markdown report of merged PRs for missing contributors (includes shared helpers).
|
||||
- `add-missing-contributors.mjs` — on-demand maintainer script to automatically add missing contributors to `.all-contributorsrc` (infers contribution types from merged PR files, then runs the all-contributors CLI).
|
||||
|
||||
99
eng/generate-marketplace.mjs
Executable file
99
eng/generate-marketplace.mjs
Executable file
@@ -0,0 +1,99 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
import { ROOT_FOLDER } from "./constants.mjs";
|
||||
|
||||
const PLUGINS_DIR = path.join(ROOT_FOLDER, "plugins");
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate marketplace.json from plugin directories
|
||||
*/
|
||||
function generateMarketplace() {
|
||||
console.log("Generating marketplace.json...");
|
||||
|
||||
if (!fs.existsSync(PLUGINS_DIR)) {
|
||||
console.error(`Error: Plugins directory not found at ${PLUGINS_DIR}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Read all plugin directories
|
||||
const pluginDirs = fs.readdirSync(PLUGINS_DIR, { withFileTypes: true })
|
||||
.filter(entry => entry.isDirectory())
|
||||
.map(entry => entry.name)
|
||||
.sort();
|
||||
|
||||
console.log(`Found ${pluginDirs.length} plugin directories`);
|
||||
|
||||
// Read metadata for each plugin
|
||||
const plugins = [];
|
||||
for (const dirName of pluginDirs) {
|
||||
const pluginPath = path.join(PLUGINS_DIR, dirName);
|
||||
const metadata = readPluginMetadata(pluginPath);
|
||||
|
||||
if (metadata) {
|
||||
plugins.push({
|
||||
name: metadata.name,
|
||||
source: `./plugins/${dirName}`,
|
||||
description: metadata.description,
|
||||
version: metadata.version || "1.0.0"
|
||||
});
|
||||
console.log(`✓ Added plugin: ${metadata.name}`);
|
||||
} else {
|
||||
console.log(`✗ Skipped: ${dirName} (no valid plugin.json)`);
|
||||
}
|
||||
}
|
||||
|
||||
// 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",
|
||||
pluginRoot: "./plugins"
|
||||
},
|
||||
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`);
|
||||
console.log(` Location: ${MARKETPLACE_FILE}`);
|
||||
}
|
||||
|
||||
// Run the script
|
||||
generateMarketplace();
|
||||
Reference in New Issue
Block a user