Merge branch 'main' into main

This commit is contained in:
Aaron Powell 2025-07-02 09:56:30 +10:00 committed by GitHub
commit 6bb3368d55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 364 additions and 260 deletions

View File

@ -67,9 +67,10 @@ Ready-to-use prompt templates for specific development scenarios and tasks, defi
Custom chat modes define specific behaviors and tools for GitHub Copilot Chat, enabling enhanced context-aware assistance for particular tasks or workflows. Custom chat modes define specific behaviors and tools for GitHub Copilot Chat, enabling enhanced context-aware assistance for particular tasks or workflows.
- [4.1 Beast Mode](chatmodes/4.1-Beast.chatmode.md) - A custom prompt to get GPT 4.1 to behave like a top-notch coding agent.
- [Database Administrator Chat Mode](chatmodes/PostgreSQL%20DBA.chatmode.md) - Work with PostgreSQL databases using the PostgreSQL extension. - [Database Administrator Chat Mode](chatmodes/PostgreSQL%20DBA.chatmode.md) - Work with PostgreSQL databases using the PostgreSQL extension.
- [Planning mode instructions](chatmodes/planner.chatmode.md) - Generate an implementation plan for new features or refactoring existing code. - [Planning mode instructions](chatmodes/planner.chatmode.md) - Generate an implementation plan for new features or refactoring existing code.
- [4.1 Beast Mode](chatmodes/4.1-Beast.chatmode.md) - A custom prompt to get GPT 4.1 to behave like a top-notch coding agent.
> 💡 **Usage**: Create new chat modes using the command `Chat: Configure Chat Modes...`, then switch your chat mode in the Chat input from _Agent_ or _Ask_ to your own mode. > 💡 **Usage**: Create new chat modes using the command `Chat: Configure Chat Modes...`, then switch your chat mode in the Chat input from _Agent_ or _Ask_ to your own mode.

View File

@ -1,6 +1,7 @@
--- ---
description: '4.1 Beast Mode' description: 'A custom prompt to get GPT 4.1 to behave like a top-notch coding agent.'
tools: ['codebase', 'editFiles', 'fetch', 'problems', 'runCommands', 'search'] tools: ['codebase', 'editFiles', 'fetch', 'problems', 'runCommands', 'search']
title: '4.1 Beast Mode'
--- ---
# SYSTEM PROMPT — GPT-4.1 Coding Agent (VS Code Tools Edition) # SYSTEM PROMPT — GPT-4.1 Coding Agent (VS Code Tools Edition)

View File

@ -6,13 +6,37 @@ const path = require("path");
function extractTitle(filePath) { function extractTitle(filePath) {
try { try {
const content = fs.readFileSync(filePath, "utf8"); const content = fs.readFileSync(filePath, "utf8");
// For prompt files, look for the main heading after frontmatter
if (filePath.includes(".prompt.md") || filePath.includes(".chatmode.md")) {
const lines = content.split("\n"); const lines = content.split("\n");
// Step 1: Look for title in frontmatter for all file types
let inFrontmatter = false; let inFrontmatter = false;
let frontmatterEnded = false; let frontmatterEnded = false;
for (const line of lines) {
if (line.trim() === "---") {
if (!inFrontmatter) {
inFrontmatter = true;
} else if (!frontmatterEnded) {
frontmatterEnded = true;
}
continue;
}
if (inFrontmatter && !frontmatterEnded) {
// Look for title field in frontmatter
const titleMatch = line.match(/^title:\s*['"]?(.+?)['"]?$/);
if (titleMatch) {
return titleMatch[1].trim();
}
}
}
// Reset for second pass
inFrontmatter = false;
frontmatterEnded = false;
// Step 2: For prompt/chatmode files, look for heading after frontmatter
if (filePath.includes(".prompt.md") || filePath.includes(".chatmode.md")) {
for (const line of lines) { for (const line of lines) {
if (line.trim() === "---") { if (line.trim() === "---") {
if (!inFrontmatter) { if (!inFrontmatter) {
@ -28,7 +52,7 @@ function extractTitle(filePath) {
} }
} }
// For prompt files without heading, clean up filename // Step 3: Format filename for prompt/chatmode files if no heading found
const basename = path.basename( const basename = path.basename(
filePath, filePath,
filePath.includes(".prompt.md") ? ".prompt.md" : ".chatmode.md" filePath.includes(".prompt.md") ? ".prompt.md" : ".chatmode.md"
@ -38,15 +62,14 @@ function extractTitle(filePath) {
.replace(/\b\w/g, (l) => l.toUpperCase()); .replace(/\b\w/g, (l) => l.toUpperCase());
} }
// For instruction files, look for the first heading // Step 4: For instruction files, look for the first heading
const lines = content.split("\n");
for (const line of lines) { for (const line of lines) {
if (line.startsWith("# ")) { if (line.startsWith("# ")) {
return line.substring(2).trim(); return line.substring(2).trim();
} }
} }
// Fallback to filename // Step 5: Fallback to filename
const basename = path.basename(filePath, path.extname(filePath)); const basename = path.basename(filePath, path.extname(filePath));
return basename return basename
.replace(/[-_]/g, " ") .replace(/[-_]/g, " ")
@ -129,48 +152,39 @@ function extractDescription(filePath) {
} }
} }
function generateReadme() { function updateInstructionsSection(
const instructionsDir = path.join(__dirname, "instructions"); currentReadme,
const promptsDir = path.join(__dirname, "prompts"); instructionFiles,
const chatmodesDir = path.join(__dirname, "chatmodes"); instructionsDir
const readmePath = path.join(__dirname, "README.md"); ) {
// Check if README file exists
if (!fs.existsSync(readmePath)) {
console.error(
"README.md not found! Please create a base README.md file first."
);
process.exit(1);
}
// Read the current README content
let currentReadme = fs.readFileSync(readmePath, "utf8");
// Get all instruction files
const instructionFiles = fs
.readdirSync(instructionsDir)
.filter((file) => file.endsWith(".md"))
.sort();
// Get all prompt files - we'll use this to find new prompts
const promptFiles = fs
.readdirSync(promptsDir)
.filter((file) => file.endsWith(".prompt.md"))
.sort();
// Get all chat mode files - we'll use this to update the chat modes section
const chatmodeFiles = fs.existsSync(chatmodesDir)
? fs
.readdirSync(chatmodesDir)
.filter((file) => file.endsWith(".chatmode.md"))
.sort()
: [];
// Update instructions section - rebuild the whole list
const instructionsSection = currentReadme.match( const instructionsSection = currentReadme.match(
/## 📋 Custom Instructions\n\nTeam and project-specific instructions.+?(?=\n\n>)/s /## 📋 Custom Instructions\n\nTeam and project-specific instructions.+?(?=\n\n>)/s
); );
if (instructionsSection) {
if (!instructionsSection) {
return currentReadme;
}
// Extract existing instruction links from README
const existingInstructionLinks = [];
const instructionLinkRegex = /\[.*?\]\(instructions\/(.+?)\)/g;
let match;
while ((match = instructionLinkRegex.exec(currentReadme)) !== null) {
existingInstructionLinks.push(match[1]);
}
// Find new instructions that aren't already in the README
const newInstructionFiles = instructionFiles.filter(
(file) => !existingInstructionLinks.includes(file)
);
if (newInstructionFiles.length === 0) {
console.log("No new instructions to add.");
} else {
console.log(`Found ${newInstructionFiles.length} new instructions to add.`);
}
let instructionsListContent = "\n\n"; let instructionsListContent = "\n\n";
// Generate alphabetically sorted list of instruction links // Generate alphabetically sorted list of instruction links
@ -196,12 +210,11 @@ function generateReadme() {
const newInstructionsSection = const newInstructionsSection =
"## 📋 Custom Instructions\n\nTeam and project-specific instructions to enhance GitHub Copilot's behavior for specific technologies and coding practices:" + "## 📋 Custom Instructions\n\nTeam and project-specific instructions to enhance GitHub Copilot's behavior for specific technologies and coding practices:" +
instructionsListContent; instructionsListContent;
currentReadme = currentReadme.replace(
instructionsSection[0],
newInstructionsSection
);
}
return currentReadme.replace(instructionsSection[0], newInstructionsSection);
}
function updatePromptsSection(currentReadme, promptFiles, promptsDir) {
// Extract existing prompt links from README // Extract existing prompt links from README
const existingPromptLinks = []; const existingPromptLinks = [];
const promptLinkRegex = /\[.*?\]\(prompts\/(.+?)\)/g; const promptLinkRegex = /\[.*?\]\(prompts\/(.+?)\)/g;
@ -216,7 +229,11 @@ function generateReadme() {
(file) => !existingPromptLinks.includes(file) (file) => !existingPromptLinks.includes(file)
); );
if (newPromptFiles.length > 0) { if (newPromptFiles.length === 0) {
console.log("No new prompts to add.");
return currentReadme;
}
console.log(`Found ${newPromptFiles.length} new prompts to add.`); console.log(`Found ${newPromptFiles.length} new prompts to add.`);
// Create content for new prompts (in Uncategorised section) // Create content for new prompts (in Uncategorised section)
@ -224,8 +241,7 @@ function generateReadme() {
// Check if we already have an Uncategorised section // Check if we already have an Uncategorised section
const uncategorisedSectionRegex = /### Uncategorised\n/; const uncategorisedSectionRegex = /### Uncategorised\n/;
const hasUncategorisedSection = const hasUncategorisedSection = uncategorisedSectionRegex.test(currentReadme);
uncategorisedSectionRegex.test(currentReadme);
// If we need to add the section header // If we need to add the section header
if (!hasUncategorisedSection) { if (!hasUncategorisedSection) {
@ -270,23 +286,35 @@ function generateReadme() {
insertPos = uncategorisedSectionPos + 16; insertPos = uncategorisedSectionPos + 16;
} }
currentReadme = return (
currentReadme.slice(0, insertPos) + currentReadme.slice(0, insertPos) +
newPromptsContent + newPromptsContent +
currentReadme.slice(insertPos); currentReadme.slice(insertPos)
);
} else { } else {
// No Uncategorised section exists yet - find where to add it // No Uncategorised section exists yet - find where to add it
return addNewUncategorisedSection(currentReadme, newPromptsContent);
}
}
function addNewUncategorisedSection(currentReadme, newPromptsContent) {
// Look for the "Ready-to-use prompt templates" section and the next section after it // Look for the "Ready-to-use prompt templates" section and the next section after it
const promptSectionRegex = const promptSectionRegex =
/## 🎯 Reusable Prompts\n\nReady-to-use prompt templates/; /## 🎯 Reusable Prompts\n\nReady-to-use prompt templates/;
const promptSectionMatch = currentReadme.match(promptSectionRegex); const promptSectionMatch = currentReadme.match(promptSectionRegex);
if (promptSectionMatch) { if (!promptSectionMatch) {
console.error("Could not find the Reusable Prompts section in the README.");
return currentReadme;
}
// Find where to insert the new section - after any existing categories // Find where to insert the new section - after any existing categories
let insertPos; let insertPos;
// First check if there are any existing categories // First check if there are any existing categories
const existingCategoriesRegex = /### [^\n]+\n/g; const existingCategoriesRegex = /### [^\n]+\n/g;
let lastCategoryMatch = null; let lastCategoryMatch = null;
let match;
while ((match = existingCategoriesRegex.exec(currentReadme)) !== null) { while ((match = existingCategoriesRegex.exec(currentReadme)) !== null) {
lastCategoryMatch = match; lastCategoryMatch = match;
} }
@ -306,9 +334,7 @@ function generateReadme() {
nextSectionMatch.index; nextSectionMatch.index;
} else { } else {
// If we can't find the next section, add at the end of the prompt section // If we can't find the next section, add at the end of the prompt section
insertPos = currentReadme.indexOf( insertPos = currentReadme.indexOf("> 💡 **Usage**: Use `/prompt-name`");
"> 💡 **Usage**: Use `/prompt-name`"
);
if (insertPos === -1) { if (insertPos === -1) {
// Fallback position - before Additional Resources // Fallback position - before Additional Resources
insertPos = currentReadme.indexOf("## 📚 Additional Resources"); insertPos = currentReadme.indexOf("## 📚 Additional Resources");
@ -328,31 +354,48 @@ function generateReadme() {
} }
if (insertPos !== -1) { if (insertPos !== -1) {
currentReadme = return (
currentReadme.slice(0, insertPos) + currentReadme.slice(0, insertPos) +
newPromptsContent + newPromptsContent +
currentReadme.slice(insertPos); currentReadme.slice(insertPos)
} else {
console.error(
"Could not find a suitable place to insert new prompts."
); );
}
} else { } else {
console.error( console.error("Could not find a suitable place to insert new prompts.");
"Could not find the Reusable Prompts section in the README." return currentReadme;
);
} }
} }
} else {
console.log("No new prompts to add."); function updateChatModesSection(currentReadme, chatmodeFiles, chatmodesDir) {
// No chat mode files, nothing to do
if (chatmodeFiles.length === 0) {
return currentReadme;
}
// Extract existing chat mode links from README
const existingChatModeLinks = [];
const chatModeLinkRegex = /\[.*?\]\(chatmodes\/(.+?)\)/g;
let match;
while ((match = chatModeLinkRegex.exec(currentReadme)) !== null) {
existingChatModeLinks.push(match[1]);
}
// Find new chat modes that aren't already in the README
const newChatModeFiles = chatmodeFiles.filter(
(file) => !existingChatModeLinks.includes(file)
);
if (newChatModeFiles.length === 0) {
console.log("No new chat modes to add.");
} else {
console.log(`Found ${newChatModeFiles.length} new chat modes to add.`);
} }
// Update chat modes section
const chatmodesSection = currentReadme.match( const chatmodesSection = currentReadme.match(
/## 🎭 Custom Chat Modes\n\nCustom chat modes define.+?(?=\n\n>)/s /## 🧩 Custom Chat Modes\n\nCustom chat modes define.+?(?=\n\n>)/s
); );
if (chatmodesSection && chatmodeFiles.length > 0) { if (chatmodesSection) {
let chatmodesListContent = "\n\n"; let chatmodesListContent = "\n\n";
// Generate list of chat mode links // Generate list of chat mode links
@ -375,15 +418,16 @@ function generateReadme() {
// Replace the current chat modes section with the updated one // Replace the current chat modes section with the updated one
const newChatmodesSection = const newChatmodesSection =
"## 🎭 Custom Chat Modes\n\nCustom chat modes define specific behaviors and tools for GitHub Copilot Chat, enabling enhanced context-aware assistance for particular tasks or workflows." + "## 🧩 Custom Chat Modes\n\nCustom chat modes define specific behaviors and tools for GitHub Copilot Chat, enabling enhanced context-aware assistance for particular tasks or workflows." +
chatmodesListContent; chatmodesListContent;
currentReadme = currentReadme.replace( return currentReadme.replace(chatmodesSection[0], newChatmodesSection);
chatmodesSection[0], } else {
newChatmodesSection
);
} else if (!chatmodesSection && chatmodeFiles.length > 0) {
// Chat modes section doesn't exist yet but we have chat mode files // Chat modes section doesn't exist yet but we have chat mode files
console.log(
"Creating new chat modes section with all available chat modes."
);
const chatmodesListContent = chatmodeFiles const chatmodesListContent = chatmodeFiles
.map((file) => { .map((file) => {
const filePath = path.join(chatmodesDir, file); const filePath = path.join(chatmodesDir, file);
@ -403,20 +447,78 @@ function generateReadme() {
"## 🎭 Custom Chat Modes\n\n" + "## 🎭 Custom Chat Modes\n\n" +
"Custom chat modes define specific behaviors and tools for GitHub Copilot Chat, enabling enhanced context-aware assistance for particular tasks or workflows.\n\n" + "Custom chat modes define specific behaviors and tools for GitHub Copilot Chat, enabling enhanced context-aware assistance for particular tasks or workflows.\n\n" +
chatmodesListContent + chatmodesListContent +
'\n\n> 💡 **Usage**: Create new chat modes using the command `Chat: Configure Chat Modes...`, then switch your chat mode in the Chat input from _Agent_ or _Ask_ to your own mode.\n'; "\n\n> 💡 **Usage**: Create new chat modes using the command `Chat: Configure Chat Modes...`, then switch your chat mode in the Chat input from _Agent_ or _Ask_ to your own mode.\n";
// Insert before Additional Resources section // Insert before Additional Resources section
const additionalResourcesPos = currentReadme.indexOf( const additionalResourcesPos = currentReadme.indexOf(
"## 📚 Additional Resources" "## 📚 Additional Resources"
); );
if (additionalResourcesPos !== -1) { if (additionalResourcesPos !== -1) {
currentReadme = return (
currentReadme.slice(0, additionalResourcesPos) + currentReadme.slice(0, additionalResourcesPos) +
newChatmodesSection + newChatmodesSection +
"\n" + "\n" +
currentReadme.slice(additionalResourcesPos); currentReadme.slice(additionalResourcesPos)
);
} }
return currentReadme;
} }
}
function generateReadme() {
const instructionsDir = path.join(__dirname, "instructions");
const promptsDir = path.join(__dirname, "prompts");
const chatmodesDir = path.join(__dirname, "chatmodes");
const readmePath = path.join(__dirname, "README.md");
// Check if README file exists
if (!fs.existsSync(readmePath)) {
console.error(
"README.md not found! Please create a base README.md file first."
);
process.exit(1);
}
// Read the current README content
let currentReadme = fs.readFileSync(readmePath, "utf8");
// Get all instruction files
const instructionFiles = fs
.readdirSync(instructionsDir)
.filter((file) => file.endsWith(".md"))
.sort();
// Get all prompt files - we'll use this to find new prompts
const promptFiles = fs
.readdirSync(promptsDir)
.filter((file) => file.endsWith(".prompt.md"))
.sort();
// Get all chat mode files - we'll use this to update the chat modes section
const chatmodeFiles = fs.existsSync(chatmodesDir)
? fs
.readdirSync(chatmodesDir)
.filter((file) => file.endsWith(".chatmode.md"))
.sort()
: [];
// Update instructions section
currentReadme = updateInstructionsSection(
currentReadme,
instructionFiles,
instructionsDir
);
// Update prompts section
currentReadme = updatePromptsSection(currentReadme, promptFiles, promptsDir);
// Update chat modes section
currentReadme = updateChatModesSection(
currentReadme,
chatmodeFiles,
chatmodesDir
);
return currentReadme; return currentReadme;
} }