From 7d67aef6012ab99b94e0bf2dacf0178794bb85bc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 20 Sep 2025 21:51:02 +0000 Subject: [PATCH 1/4] Initial plan From 61e056c8e09178133b3c83856697a1c46678b1bb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 20 Sep 2025 21:59:18 +0000 Subject: [PATCH 2/4] Implement refined installation process with .awesome-copilot directory structure Co-authored-by: AstroSteveo <34114851+AstroSteveo@users.noreply.github.com> --- CONFIG.md | 93 ++++++++++++++++------- apply-config.js | 15 ++-- awesome-copilot.js | 5 +- generate-config.js | 2 +- initialize-project.js | 171 ++++++++++++++++++++++++++++++++++++++++++ package.json | 5 +- 6 files changed, 255 insertions(+), 36 deletions(-) create mode 100644 initialize-project.js diff --git a/CONFIG.md b/CONFIG.md index 1b423e2..823fe9e 100644 --- a/CONFIG.md +++ b/CONFIG.md @@ -1,20 +1,42 @@ # Configuration File System -The Awesome Copilot repository now supports a configuration file system that allows you to easily manage which prompts, instructions, chat modes, and collections are included in your project. +The Awesome Copilot repository supports a configuration file system that allows you to easily manage which prompts, instructions, chat modes, and collections are included in your project. + +## Installation + +### Via NPM (Recommended) +```bash +# Install globally +npm install -g awesome-copilot + +# Or run without installing +npx awesome-copilot init +``` + +### Via Git Clone +```bash +git clone https://github.com/AstroSteveo/awesome-copilot +cd awesome-copilot +npm install +``` ## Quick Start -### 1. Generate a Configuration File +### 1. Initialize Your Project ```bash -# Generate default configuration file -node awesome-copilot.js init +# Initialize with default configuration +awesome-copilot init -# Or generate with a specific name -node awesome-copilot.js init my-project.config.yml +# Or initialize with a specific name +awesome-copilot init my-project.config.yml ``` -This creates a YAML configuration file with all available items set to `false` by default. +This creates: +- Configuration file (`awesome-copilot.config.yml`) +- `.awesome-copilot/` directory structure +- VS Code settings pointing to `.awesome-copilot/` directories +- `.gitignore` entry to exclude generated files ### 2. Enable Desired Items @@ -25,7 +47,7 @@ version: "1.0" project: name: "My Project" description: "A project using awesome-copilot customizations" - output_directory: ".github" + output_directory: ".awesome-copilot" prompts: create-readme: true editorconfig: true @@ -47,13 +69,13 @@ collections: ```bash # Apply default configuration file -node awesome-copilot.js apply +awesome-copilot apply # Or apply specific configuration file -node awesome-copilot.js apply my-project.config.yml +awesome-copilot apply my-project.config.yml ``` -This will copy the enabled files to your project's `.github` directory (or the directory specified in the config). +This will copy the enabled files to your project's `.awesome-copilot` directory (or the directory specified in the config). ## Configuration File Format @@ -95,29 +117,42 @@ collections: When you apply a configuration, files are organized as follows: ``` -.github/ -├── copilot/ -│ ├── *.prompt.md # Prompts for /awesome-copilot commands +.awesome-copilot/ +├── prompts/ +│ └── *.prompt.md # Prompts for /awesome-copilot commands +├── chatmodes/ │ └── *.chatmode.md # Chat modes for VS Code └── instructions/ └── *.instructions.md # Instructions that auto-apply to coding ``` +VS Code automatically detects these files through the generated `.vscode/settings.json` configuration. + ## NPM Scripts -You can also use npm scripts instead of the CLI: +If you've cloned the repository locally, you can also use npm scripts: ```bash -# Generate configuration +# Initialize configuration npm run config:init # Apply configuration npm run config:apply -# Access CLI +# Access CLI help npm run config help ``` +## VS Code Integration + +The `awesome-copilot init` command automatically configures VS Code to detect your customizations: + +- Creates `.vscode/settings.json` with proper file locations +- Points to `.awesome-copilot/` directories instead of framework directories +- Maintains separation between your project and the awesome-copilot framework + +No manual VS Code configuration needed! + ## Examples ### Frontend React Project @@ -142,7 +177,7 @@ chatmodes: version: "1.0" project: name: ".NET API" - output_directory: ".github" + output_directory: ".awesome-copilot" collections: csharp-dotnet-development: true instructions: @@ -157,7 +192,7 @@ prompts: version: "1.0" project: name: "Full Stack App" - output_directory: ".github" + output_directory: ".awesome-copilot" collections: frontend-web-dev: true csharp-dotnet-development: true @@ -169,17 +204,23 @@ chatmodes: ## Migration from Manual Approach -If you were previously copying files manually: +If you were previously copying files manually or using an older version: 1. Remove manually copied files from your `.github` directory -2. Run `node awesome-copilot.js init` to create a config file -3. Edit the config to enable the same items you were using manually -4. Run `node awesome-copilot.js apply` to get a clean, managed setup +2. Install awesome-copilot: `npm install -g awesome-copilot` +3. Run `awesome-copilot init` to create a clean setup +4. Edit the config to enable the same items you were using manually +5. Run `awesome-copilot apply` to get a clean, managed setup + +The new approach uses `.awesome-copilot/` directory instead of `.github/` for better separation. ## Benefits +- **Clean Installation**: Install via npm/npx, no need to clone the entire repository - **Centralized Management**: One file controls all your Copilot customizations -- **Version Control Friendly**: Config file tracks what's enabled in your project -- **Easy Updates**: Re-run apply command after pulling awesome-copilot updates +- **VS Code Integration**: Automatic configuration, no manual setup required +- **Clear Separation**: Framework files separated from your project files +- **Version Control Friendly**: Config file tracks what's enabled, generated files are ignored +- **Easy Updates**: Re-run apply command after awesome-copilot updates - **Collection Support**: Enable entire curated sets with one setting -- **Clean Organization**: Files are organized in proper directory structure \ No newline at end of file +- **Minimal Footprint**: Only enabled files are copied to your project \ No newline at end of file diff --git a/apply-config.js b/apply-config.js index b535f5d..a22fd67 100755 --- a/apply-config.js +++ b/apply-config.js @@ -78,12 +78,13 @@ async function applyConfig(configPath = "awesome-copilot.config.yml") { console.log("Applying awesome-copilot configuration..."); const rootDir = __dirname; - const outputDir = config.project?.output_directory || ".github"; + const outputDir = config.project?.output_directory || ".awesome-copilot"; // Create output directory structure ensureDirectoryExists(outputDir); - ensureDirectoryExists(path.join(outputDir, "copilot")); + ensureDirectoryExists(path.join(outputDir, "prompts")); ensureDirectoryExists(path.join(outputDir, "instructions")); + ensureDirectoryExists(path.join(outputDir, "chatmodes")); let copiedCount = 0; const summary = { @@ -119,7 +120,7 @@ async function applyConfig(configPath = "awesome-copilot.config.yml") { if (enabled) { const sourcePath = path.join(rootDir, "prompts", `${promptName}.prompt.md`); if (fs.existsSync(sourcePath)) { - const destPath = path.join(outputDir, "copilot", `${promptName}.prompt.md`); + const destPath = path.join(outputDir, "prompts", `${promptName}.prompt.md`); copyFile(sourcePath, destPath); copiedCount++; summary.prompts++; @@ -149,7 +150,7 @@ async function applyConfig(configPath = "awesome-copilot.config.yml") { if (enabled) { const sourcePath = path.join(rootDir, "chatmodes", `${chatmodeName}.chatmode.md`); if (fs.existsSync(sourcePath)) { - const destPath = path.join(outputDir, "copilot", `${chatmodeName}.chatmode.md`); + const destPath = path.join(outputDir, "chatmodes", `${chatmodeName}.chatmode.md`); copyFile(sourcePath, destPath); copiedCount++; summary.chatmodes++; @@ -165,8 +166,10 @@ async function applyConfig(configPath = "awesome-copilot.config.yml") { const fileName = path.basename(itemPath); let destPath; - if (fileName.endsWith('.prompt.md') || fileName.endsWith('.chatmode.md')) { - destPath = path.join(outputDir, "copilot", fileName); + if (fileName.endsWith('.prompt.md')) { + destPath = path.join(outputDir, "prompts", fileName); + } else if (fileName.endsWith('.chatmode.md')) { + destPath = path.join(outputDir, "chatmodes", fileName); } else if (fileName.endsWith('.instructions.md')) { destPath = path.join(outputDir, "instructions", fileName); } diff --git a/awesome-copilot.js b/awesome-copilot.js index 84f1804..b06217d 100755 --- a/awesome-copilot.js +++ b/awesome-copilot.js @@ -5,11 +5,12 @@ const { applyConfig } = require("./apply-config"); const commands = { init: { - description: "Generate a new configuration file", + description: "Initialize a new project with awesome-copilot configuration", usage: "awesome-copilot init [config-file]", action: async (args) => { const configFile = args[0] || "awesome-copilot.config.yml"; - generateConfig(configFile); + const { initializeProject } = require("./initialize-project"); + await initializeProject(configFile); } }, diff --git a/generate-config.js b/generate-config.js index bd4678c..491dd4c 100755 --- a/generate-config.js +++ b/generate-config.js @@ -21,7 +21,7 @@ function generateConfig(outputPath = "awesome-copilot.config.yml") { project: { name: "My Project", description: "A project using awesome-copilot customizations", - output_directory: ".github" + output_directory: ".awesome-copilot" }, prompts: {}, instructions: {}, diff --git a/initialize-project.js b/initialize-project.js new file mode 100644 index 0000000..bf89b7a --- /dev/null +++ b/initialize-project.js @@ -0,0 +1,171 @@ +#!/usr/bin/env node + +const fs = require("fs"); +const path = require("path"); +const { generateConfig } = require("./generate-config"); + +/** + * Initialize a new project with awesome-copilot configuration + */ +async function initializeProject(configFile = "awesome-copilot.config.yml") { + console.log("🚀 Initializing awesome-copilot project..."); + console.log("=" .repeat(50)); + + // Generate the configuration file + generateConfig(configFile); + + // Create .vscode directory and settings if they don't exist + createVSCodeSettings(); + + // Create .gitignore entry for awesome-copilot directory + updateGitignore(); + + // Create awesome-copilot directory structure + createProjectStructure(); + + console.log("\n" + "=" .repeat(50)); + console.log("✅ Project initialization complete!"); + console.log("=" .repeat(50)); + console.log("\nNext steps:"); + console.log(`1. Edit ${configFile} to enable desired prompts, instructions, and chat modes`); + console.log("2. Run 'awesome-copilot apply' to copy enabled files to your project"); + console.log("3. Your VS Code is now configured to use .awesome-copilot/ directory"); + console.log("4. Files in .awesome-copilot/ are automatically ignored by git"); + console.log("\nWorkflow:"); + console.log("• Edit configuration → apply → VS Code automatically picks up changes"); +} + +/** + * Create VS Code settings that point to .awesome-copilot directory + */ +function createVSCodeSettings() { + const vscodeDir = ".vscode"; + const settingsFile = path.join(vscodeDir, "settings.json"); + + // Ensure .vscode directory exists + if (!fs.existsSync(vscodeDir)) { + fs.mkdirSync(vscodeDir, { recursive: true }); + console.log("📁 Created .vscode directory"); + } + + // VS Code settings template for awesome-copilot + const awesomeCopilotSettings = { + "chat.modeFilesLocations": { + ".awesome-copilot/chatmodes": true + }, + "chat.promptFilesLocations": { + ".awesome-copilot/prompts": true + }, + "chat.instructionsFilesLocations": { + ".awesome-copilot/instructions": true + } + }; + + let settings = {}; + let settingsExisted = false; + + // Read existing settings if they exist + if (fs.existsSync(settingsFile)) { + try { + const existingContent = fs.readFileSync(settingsFile, 'utf8'); + settings = JSON.parse(existingContent); + settingsExisted = true; + } catch (error) { + console.log("⚠️ Warning: Could not parse existing VS Code settings, creating new ones"); + } + } + + // Merge awesome-copilot settings + Object.assign(settings, awesomeCopilotSettings); + + // Write settings back + fs.writeFileSync(settingsFile, JSON.stringify(settings, null, 2)); + + if (settingsExisted) { + console.log("⚙️ Updated existing VS Code settings with awesome-copilot configuration"); + } else { + console.log("⚙️ Created VS Code settings for awesome-copilot"); + } +} + +/** + * Update .gitignore to exclude awesome-copilot directory + */ +function updateGitignore() { + const gitignoreFile = ".gitignore"; + const gitignoreEntry = "\n# Awesome Copilot generated files\n.awesome-copilot/\n"; + + let shouldAdd = true; + + if (fs.existsSync(gitignoreFile)) { + const content = fs.readFileSync(gitignoreFile, 'utf8'); + if (content.includes('.awesome-copilot/')) { + shouldAdd = false; + console.log("📝 .gitignore already contains .awesome-copilot/ entry"); + } + } + + if (shouldAdd) { + fs.appendFileSync(gitignoreFile, gitignoreEntry); + console.log("📝 Added .awesome-copilot/ to .gitignore"); + } +} + +/** + * Create basic project structure + */ +function createProjectStructure() { + const awesomeDir = ".awesome-copilot"; + + // Create main directory and subdirectories + const dirs = [ + awesomeDir, + path.join(awesomeDir, "prompts"), + path.join(awesomeDir, "instructions"), + path.join(awesomeDir, "chatmodes") + ]; + + dirs.forEach(dir => { + if (!fs.existsSync(dir)) { + fs.mkdirSync(dir, { recursive: true }); + console.log(`📁 Created ${dir} directory`); + } + }); + + // Create a README in the awesome-copilot directory + const readmeContent = `# Awesome Copilot Configuration + +This directory contains your project's GitHub Copilot customizations. + +## Directory Structure + +- \`prompts/\` - Custom prompts for /awesome-copilot commands +- \`instructions/\` - Instructions that auto-apply to your coding +- \`chatmodes/\` - Chat modes for enhanced conversations + +## Usage + +1. Edit \`awesome-copilot.config.yml\` in your project root +2. Run \`awesome-copilot apply\` to update files +3. VS Code automatically detects changes + +Files in this directory are automatically ignored by git. +`; + + const readmePath = path.join(awesomeDir, "README.md"); + if (!fs.existsSync(readmePath)) { + fs.writeFileSync(readmePath, readmeContent); + console.log("📄 Created README.md in .awesome-copilot directory"); + } +} + +// CLI usage +if (require.main === module) { + const configFile = process.argv[2] || "awesome-copilot.config.yml"; + initializeProject(configFile).catch(error => { + console.error("Error initializing project:", error.message); + process.exit(1); + }); +} + +module.exports = { initializeProject }; \ No newline at end of file diff --git a/package.json b/package.json index 8adc6c4..b87e66b 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,10 @@ "name": "awesome-copilot", "version": "1.0.0", "description": "Enhance your GitHub Copilot experience with community-contributed instructions, prompts, and chat modes", - "main": "update-readme.js", + "main": "awesome-copilot.js", + "bin": { + "awesome-copilot": "./awesome-copilot.js" + }, "scripts": { "build": "node update-readme.js", "config:init": "node generate-config.js", From 0585489dcaba2df88aca76c8af6f800e6d7e7064 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 20 Sep 2025 22:02:52 +0000 Subject: [PATCH 3/4] Finalize refined installation process with updated documentation and CLI improvements Co-authored-by: AstroSteveo <34114851+AstroSteveo@users.noreply.github.com> --- README.md | 27 +++++++++++++++++++++++++++ generate-config.js | 4 ++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 62d626f..d137c50 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,33 @@ We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING. ## 🌟 Getting Started +### 🔧 CLI Installation (Recommended) + +Install awesome-copilot CLI for streamlined project setup: + +```bash +# Install globally via npm +npm install -g awesome-copilot + +# Or run without installing +npx awesome-copilot init +``` + +**Quick Setup:** +1. Navigate to your project directory +2. Run `awesome-copilot init` to create configuration and VS Code setup +3. Edit `awesome-copilot.config.yml` to enable desired items +4. Run `awesome-copilot apply` to copy files to your project +5. Start using enhanced GitHub Copilot! + +✨ **Benefits:** +- Clean project setup with automatic VS Code configuration +- Files organized in `.awesome-copilot/` directory +- Automatic `.gitignore` management +- Easy updates by re-running `apply` command + +### 📖 Manual Installation + 1. **Browse the Collections**: Check out our comprehensive lists of [prompts](README.prompts.md), [instructions](README.instructions.md), [chat modes](README.chatmodes.md), and [collections](README.collections.md). 2. **Add to your editor**: Click the "Install" button to install to VS Code, or copy the file contents for other editors. 3. **Start Using**: Copy prompts to use with `/` commands, let instructions enhance your coding experience, or activate chat modes for specialized assistance. diff --git a/generate-config.js b/generate-config.js index 491dd4c..6b6c52c 100755 --- a/generate-config.js +++ b/generate-config.js @@ -59,7 +59,7 @@ function generateConfig(outputPath = "awesome-copilot.config.yml") { # Set items to 'true' to include them in your project # Set items to 'false' to exclude them # -# After configuring, run: node apply-config.js +# After configuring, run: awesome-copilot apply # `; @@ -71,7 +71,7 @@ function generateConfig(outputPath = "awesome-copilot.config.yml") { console.log(`Found ${prompts.length} prompts, ${instructions.length} instructions, ${chatmodes.length} chat modes, ${collections.length} collections`); console.log("\nNext steps:"); console.log("1. Edit the configuration file to enable desired items"); - console.log("2. Run: node apply-config.js to apply the configuration"); + console.log("2. Run: awesome-copilot apply to apply the configuration"); } /** From 9f59b8875ae350ced5b41f0980e6576cb598c26c Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 20 Sep 2025 22:23:29 +0000 Subject: [PATCH 4/4] Fix VS Code settings merge to preserve existing chat configurations Co-authored-by: AstroSteveo <34114851+AstroSteveo@users.noreply.github.com> --- initialize-project.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/initialize-project.js b/initialize-project.js index bf89b7a..8e19474 100644 --- a/initialize-project.js +++ b/initialize-project.js @@ -75,8 +75,16 @@ function createVSCodeSettings() { } } - // Merge awesome-copilot settings - Object.assign(settings, awesomeCopilotSettings); + // Deep merge awesome-copilot settings to preserve existing chat settings + for (const [key, value] of Object.entries(awesomeCopilotSettings)) { + if (settings[key] && typeof settings[key] === 'object' && typeof value === 'object') { + // If both the existing setting and new setting are objects, merge them + settings[key] = { ...settings[key], ...value }; + } else { + // Otherwise, set the new value + settings[key] = value; + } + } // Write settings back fs.writeFileSync(settingsFile, JSON.stringify(settings, null, 2));