mirror of
https://github.com/github/awesome-copilot.git
synced 2026-02-23 11:55:12 +00:00
Remove prompts from website generation and contributor scripts
Co-authored-by: aaronpowell <434140+aaronpowell@users.noreply.github.com>
This commit is contained in:
@@ -30,9 +30,6 @@ export const TYPE_PATTERNS = {
|
|||||||
instructions: [
|
instructions: [
|
||||||
'instructions/*.instructions.md'
|
'instructions/*.instructions.md'
|
||||||
],
|
],
|
||||||
prompts: [
|
|
||||||
'prompts/*.prompt.md'
|
|
||||||
],
|
|
||||||
agents: [
|
agents: [
|
||||||
'chatmodes/*.chatmode.md',
|
'chatmodes/*.chatmode.md',
|
||||||
'agents/*.agent.md'
|
'agents/*.agent.md'
|
||||||
@@ -140,7 +137,7 @@ export const isAutoGeneratedFile = (filePath) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Infer a contribution type string (e.g. 'prompts', 'agents', 'doc') for a file path.
|
* Infer a contribution type string (e.g. 'skills', 'agents', 'doc') for a file path.
|
||||||
* Returns null if no specific type matched.
|
* Returns null if no specific type matched.
|
||||||
* @param {string} filePath
|
* @param {string} filePath
|
||||||
* @returns {string|null}
|
* @returns {string|null}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate JSON metadata files for the GitHub Pages website.
|
* Generate JSON metadata files for the GitHub Pages website.
|
||||||
* This script extracts metadata from agents, prompts, instructions, skills, and plugins
|
* This script extracts metadata from agents, instructions, skills, hooks, and plugins
|
||||||
* and writes them to website/data/ for client-side search and display.
|
* and writes them to website/data/ for client-side search and display.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -15,7 +15,6 @@ import {
|
|||||||
HOOKS_DIR,
|
HOOKS_DIR,
|
||||||
INSTRUCTIONS_DIR,
|
INSTRUCTIONS_DIR,
|
||||||
PLUGINS_DIR,
|
PLUGINS_DIR,
|
||||||
PROMPTS_DIR,
|
|
||||||
ROOT_FOLDER,
|
ROOT_FOLDER,
|
||||||
SKILLS_DIR
|
SKILLS_DIR
|
||||||
} from "./constants.mjs";
|
} from "./constants.mjs";
|
||||||
@@ -192,50 +191,7 @@ function generateHooksData(gitDates) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate prompts metadata
|
|
||||||
*/
|
|
||||||
function generatePromptsData(gitDates) {
|
|
||||||
const prompts = [];
|
|
||||||
const files = fs
|
|
||||||
.readdirSync(PROMPTS_DIR)
|
|
||||||
.filter((f) => f.endsWith(".prompt.md"));
|
|
||||||
|
|
||||||
// Track all unique tools for filters
|
|
||||||
const allTools = new Set();
|
|
||||||
|
|
||||||
for (const file of files) {
|
|
||||||
const filePath = path.join(PROMPTS_DIR, file);
|
|
||||||
const frontmatter = parseFrontmatter(filePath);
|
|
||||||
const relativePath = path
|
|
||||||
.relative(ROOT_FOLDER, filePath)
|
|
||||||
.replace(/\\/g, "/");
|
|
||||||
|
|
||||||
const tools = frontmatter?.tools || [];
|
|
||||||
tools.forEach((t) => allTools.add(t));
|
|
||||||
|
|
||||||
prompts.push({
|
|
||||||
id: file.replace(".prompt.md", ""),
|
|
||||||
title: extractTitle(filePath, frontmatter),
|
|
||||||
description: frontmatter?.description || "",
|
|
||||||
agent: frontmatter?.agent || null,
|
|
||||||
model: frontmatter?.model || null,
|
|
||||||
tools: tools,
|
|
||||||
path: relativePath,
|
|
||||||
filename: file,
|
|
||||||
lastUpdated: gitDates.get(relativePath) || null,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const sortedPrompts = prompts.sort((a, b) => a.title.localeCompare(b.title));
|
|
||||||
|
|
||||||
return {
|
|
||||||
items: sortedPrompts,
|
|
||||||
filters: {
|
|
||||||
tools: Array.from(allTools).sort(),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse applyTo field into an array of patterns
|
* Parse applyTo field into an array of patterns
|
||||||
@@ -603,7 +559,6 @@ function generateToolsData() {
|
|||||||
*/
|
*/
|
||||||
function generateSearchIndex(
|
function generateSearchIndex(
|
||||||
agents,
|
agents,
|
||||||
prompts,
|
|
||||||
instructions,
|
instructions,
|
||||||
hooks,
|
hooks,
|
||||||
skills,
|
skills,
|
||||||
@@ -625,18 +580,6 @@ function generateSearchIndex(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const prompt of prompts) {
|
|
||||||
index.push({
|
|
||||||
type: "prompt",
|
|
||||||
id: prompt.id,
|
|
||||||
title: prompt.title,
|
|
||||||
description: prompt.description,
|
|
||||||
path: prompt.path,
|
|
||||||
lastUpdated: prompt.lastUpdated,
|
|
||||||
searchText: `${prompt.title} ${prompt.description}`.toLowerCase(),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const instruction of instructions) {
|
for (const instruction of instructions) {
|
||||||
index.push({
|
index.push({
|
||||||
type: "instruction",
|
type: "instruction",
|
||||||
@@ -799,7 +742,7 @@ async function main() {
|
|||||||
// Load git dates for all resource files (single efficient git command)
|
// Load git dates for all resource files (single efficient git command)
|
||||||
console.log("Loading git history for last updated dates...");
|
console.log("Loading git history for last updated dates...");
|
||||||
const gitDates = getGitFileDates(
|
const gitDates = getGitFileDates(
|
||||||
["agents/", "prompts/", "instructions/", "hooks/", "skills/", "plugins/"],
|
["agents/", "instructions/", "hooks/", "skills/", "plugins/"],
|
||||||
ROOT_FOLDER
|
ROOT_FOLDER
|
||||||
);
|
);
|
||||||
console.log(`✓ Loaded dates for ${gitDates.size} files\n`);
|
console.log(`✓ Loaded dates for ${gitDates.size} files\n`);
|
||||||
@@ -817,12 +760,6 @@ async function main() {
|
|||||||
`✓ Generated ${hooks.length} hooks (${hooksData.filters.hooks.length} hook types, ${hooksData.filters.tags.length} tags)`
|
`✓ Generated ${hooks.length} hooks (${hooksData.filters.hooks.length} hook types, ${hooksData.filters.tags.length} tags)`
|
||||||
);
|
);
|
||||||
|
|
||||||
const promptsData = generatePromptsData(gitDates);
|
|
||||||
const prompts = promptsData.items;
|
|
||||||
console.log(
|
|
||||||
`✓ Generated ${prompts.length} prompts (${promptsData.filters.tools.length} tools)`
|
|
||||||
);
|
|
||||||
|
|
||||||
const instructionsData = generateInstructionsData(gitDates);
|
const instructionsData = generateInstructionsData(gitDates);
|
||||||
const instructions = instructionsData.items;
|
const instructions = instructionsData.items;
|
||||||
console.log(
|
console.log(
|
||||||
@@ -854,7 +791,6 @@ async function main() {
|
|||||||
|
|
||||||
const searchIndex = generateSearchIndex(
|
const searchIndex = generateSearchIndex(
|
||||||
agents,
|
agents,
|
||||||
prompts,
|
|
||||||
instructions,
|
instructions,
|
||||||
hooks,
|
hooks,
|
||||||
skills,
|
skills,
|
||||||
@@ -873,11 +809,6 @@ async function main() {
|
|||||||
JSON.stringify(hooksData, null, 2)
|
JSON.stringify(hooksData, null, 2)
|
||||||
);
|
);
|
||||||
|
|
||||||
fs.writeFileSync(
|
|
||||||
path.join(WEBSITE_DATA_DIR, "prompts.json"),
|
|
||||||
JSON.stringify(promptsData, null, 2)
|
|
||||||
);
|
|
||||||
|
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
path.join(WEBSITE_DATA_DIR, "instructions.json"),
|
path.join(WEBSITE_DATA_DIR, "instructions.json"),
|
||||||
JSON.stringify(instructionsData, null, 2)
|
JSON.stringify(instructionsData, null, 2)
|
||||||
@@ -913,7 +844,6 @@ async function main() {
|
|||||||
generated: new Date().toISOString(),
|
generated: new Date().toISOString(),
|
||||||
counts: {
|
counts: {
|
||||||
agents: agents.length,
|
agents: agents.length,
|
||||||
prompts: prompts.length,
|
|
||||||
instructions: instructions.length,
|
instructions: instructions.length,
|
||||||
skills: skills.length,
|
skills: skills.length,
|
||||||
hooks: hooks.length,
|
hooks: hooks.length,
|
||||||
|
|||||||
Reference in New Issue
Block a user