Merge pull request #2 from AstroSteveo/copilot/fix-db6f06c4-1fa8-4928-9e47-5f55778802d6
Implement refined installation process with .awesome-copilot directory structure and npm CLI
This commit is contained in:
commit
1cd627b1ca
93
CONFIG.md
93
CONFIG.md
@ -1,20 +1,42 @@
|
|||||||
# Configuration File System
|
# 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
|
## Quick Start
|
||||||
|
|
||||||
### 1. Generate a Configuration File
|
### 1. Initialize Your Project
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Generate default configuration file
|
# Initialize with default configuration
|
||||||
node awesome-copilot.js init
|
awesome-copilot init
|
||||||
|
|
||||||
# Or generate with a specific name
|
# Or initialize with a specific name
|
||||||
node awesome-copilot.js init my-project.config.yml
|
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
|
### 2. Enable Desired Items
|
||||||
|
|
||||||
@ -25,7 +47,7 @@ version: "1.0"
|
|||||||
project:
|
project:
|
||||||
name: "My Project"
|
name: "My Project"
|
||||||
description: "A project using awesome-copilot customizations"
|
description: "A project using awesome-copilot customizations"
|
||||||
output_directory: ".github"
|
output_directory: ".awesome-copilot"
|
||||||
prompts:
|
prompts:
|
||||||
create-readme: true
|
create-readme: true
|
||||||
editorconfig: true
|
editorconfig: true
|
||||||
@ -47,13 +69,13 @@ collections:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Apply default configuration file
|
# Apply default configuration file
|
||||||
node awesome-copilot.js apply
|
awesome-copilot apply
|
||||||
|
|
||||||
# Or apply specific configuration file
|
# 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
|
## Configuration File Format
|
||||||
|
|
||||||
@ -95,29 +117,42 @@ collections:
|
|||||||
When you apply a configuration, files are organized as follows:
|
When you apply a configuration, files are organized as follows:
|
||||||
|
|
||||||
```
|
```
|
||||||
.github/
|
.awesome-copilot/
|
||||||
├── copilot/
|
├── prompts/
|
||||||
│ ├── *.prompt.md # Prompts for /awesome-copilot commands
|
│ └── *.prompt.md # Prompts for /awesome-copilot commands
|
||||||
|
├── chatmodes/
|
||||||
│ └── *.chatmode.md # Chat modes for VS Code
|
│ └── *.chatmode.md # Chat modes for VS Code
|
||||||
└── instructions/
|
└── instructions/
|
||||||
└── *.instructions.md # Instructions that auto-apply to coding
|
└── *.instructions.md # Instructions that auto-apply to coding
|
||||||
```
|
```
|
||||||
|
|
||||||
|
VS Code automatically detects these files through the generated `.vscode/settings.json` configuration.
|
||||||
|
|
||||||
## NPM Scripts
|
## 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
|
```bash
|
||||||
# Generate configuration
|
# Initialize configuration
|
||||||
npm run config:init
|
npm run config:init
|
||||||
|
|
||||||
# Apply configuration
|
# Apply configuration
|
||||||
npm run config:apply
|
npm run config:apply
|
||||||
|
|
||||||
# Access CLI
|
# Access CLI help
|
||||||
npm run config 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
|
## Examples
|
||||||
|
|
||||||
### Frontend React Project
|
### Frontend React Project
|
||||||
@ -142,7 +177,7 @@ chatmodes:
|
|||||||
version: "1.0"
|
version: "1.0"
|
||||||
project:
|
project:
|
||||||
name: ".NET API"
|
name: ".NET API"
|
||||||
output_directory: ".github"
|
output_directory: ".awesome-copilot"
|
||||||
collections:
|
collections:
|
||||||
csharp-dotnet-development: true
|
csharp-dotnet-development: true
|
||||||
instructions:
|
instructions:
|
||||||
@ -157,7 +192,7 @@ prompts:
|
|||||||
version: "1.0"
|
version: "1.0"
|
||||||
project:
|
project:
|
||||||
name: "Full Stack App"
|
name: "Full Stack App"
|
||||||
output_directory: ".github"
|
output_directory: ".awesome-copilot"
|
||||||
collections:
|
collections:
|
||||||
frontend-web-dev: true
|
frontend-web-dev: true
|
||||||
csharp-dotnet-development: true
|
csharp-dotnet-development: true
|
||||||
@ -169,17 +204,23 @@ chatmodes:
|
|||||||
|
|
||||||
## Migration from Manual Approach
|
## 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
|
1. Remove manually copied files from your `.github` directory
|
||||||
2. Run `node awesome-copilot.js init` to create a config file
|
2. Install awesome-copilot: `npm install -g awesome-copilot`
|
||||||
3. Edit the config to enable the same items you were using manually
|
3. Run `awesome-copilot init` to create a clean setup
|
||||||
4. Run `node awesome-copilot.js apply` to get a clean, managed 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
|
## Benefits
|
||||||
|
|
||||||
|
- **Clean Installation**: Install via npm/npx, no need to clone the entire repository
|
||||||
- **Centralized Management**: One file controls all your Copilot customizations
|
- **Centralized Management**: One file controls all your Copilot customizations
|
||||||
- **Version Control Friendly**: Config file tracks what's enabled in your project
|
- **VS Code Integration**: Automatic configuration, no manual setup required
|
||||||
- **Easy Updates**: Re-run apply command after pulling awesome-copilot updates
|
- **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
|
- **Collection Support**: Enable entire curated sets with one setting
|
||||||
- **Clean Organization**: Files are organized in proper directory structure
|
- **Minimal Footprint**: Only enabled files are copied to your project
|
||||||
27
README.md
27
README.md
@ -114,6 +114,33 @@ We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.
|
|||||||
|
|
||||||
## 🌟 Getting Started
|
## 🌟 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).
|
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.
|
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.
|
3. **Start Using**: Copy prompts to use with `/` commands, let instructions enhance your coding experience, or activate chat modes for specialized assistance.
|
||||||
|
|||||||
@ -78,12 +78,13 @@ async function applyConfig(configPath = "awesome-copilot.config.yml") {
|
|||||||
console.log("Applying awesome-copilot configuration...");
|
console.log("Applying awesome-copilot configuration...");
|
||||||
|
|
||||||
const rootDir = __dirname;
|
const rootDir = __dirname;
|
||||||
const outputDir = config.project?.output_directory || ".github";
|
const outputDir = config.project?.output_directory || ".awesome-copilot";
|
||||||
|
|
||||||
// Create output directory structure
|
// Create output directory structure
|
||||||
ensureDirectoryExists(outputDir);
|
ensureDirectoryExists(outputDir);
|
||||||
ensureDirectoryExists(path.join(outputDir, "copilot"));
|
ensureDirectoryExists(path.join(outputDir, "prompts"));
|
||||||
ensureDirectoryExists(path.join(outputDir, "instructions"));
|
ensureDirectoryExists(path.join(outputDir, "instructions"));
|
||||||
|
ensureDirectoryExists(path.join(outputDir, "chatmodes"));
|
||||||
|
|
||||||
let copiedCount = 0;
|
let copiedCount = 0;
|
||||||
const summary = {
|
const summary = {
|
||||||
@ -119,7 +120,7 @@ async function applyConfig(configPath = "awesome-copilot.config.yml") {
|
|||||||
if (enabled) {
|
if (enabled) {
|
||||||
const sourcePath = path.join(rootDir, "prompts", `${promptName}.prompt.md`);
|
const sourcePath = path.join(rootDir, "prompts", `${promptName}.prompt.md`);
|
||||||
if (fs.existsSync(sourcePath)) {
|
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);
|
copyFile(sourcePath, destPath);
|
||||||
copiedCount++;
|
copiedCount++;
|
||||||
summary.prompts++;
|
summary.prompts++;
|
||||||
@ -149,7 +150,7 @@ async function applyConfig(configPath = "awesome-copilot.config.yml") {
|
|||||||
if (enabled) {
|
if (enabled) {
|
||||||
const sourcePath = path.join(rootDir, "chatmodes", `${chatmodeName}.chatmode.md`);
|
const sourcePath = path.join(rootDir, "chatmodes", `${chatmodeName}.chatmode.md`);
|
||||||
if (fs.existsSync(sourcePath)) {
|
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);
|
copyFile(sourcePath, destPath);
|
||||||
copiedCount++;
|
copiedCount++;
|
||||||
summary.chatmodes++;
|
summary.chatmodes++;
|
||||||
@ -165,8 +166,10 @@ async function applyConfig(configPath = "awesome-copilot.config.yml") {
|
|||||||
const fileName = path.basename(itemPath);
|
const fileName = path.basename(itemPath);
|
||||||
let destPath;
|
let destPath;
|
||||||
|
|
||||||
if (fileName.endsWith('.prompt.md') || fileName.endsWith('.chatmode.md')) {
|
if (fileName.endsWith('.prompt.md')) {
|
||||||
destPath = path.join(outputDir, "copilot", fileName);
|
destPath = path.join(outputDir, "prompts", fileName);
|
||||||
|
} else if (fileName.endsWith('.chatmode.md')) {
|
||||||
|
destPath = path.join(outputDir, "chatmodes", fileName);
|
||||||
} else if (fileName.endsWith('.instructions.md')) {
|
} else if (fileName.endsWith('.instructions.md')) {
|
||||||
destPath = path.join(outputDir, "instructions", fileName);
|
destPath = path.join(outputDir, "instructions", fileName);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,11 +5,12 @@ const { applyConfig } = require("./apply-config");
|
|||||||
|
|
||||||
const commands = {
|
const commands = {
|
||||||
init: {
|
init: {
|
||||||
description: "Generate a new configuration file",
|
description: "Initialize a new project with awesome-copilot configuration",
|
||||||
usage: "awesome-copilot init [config-file]",
|
usage: "awesome-copilot init [config-file]",
|
||||||
action: async (args) => {
|
action: async (args) => {
|
||||||
const configFile = args[0] || "awesome-copilot.config.yml";
|
const configFile = args[0] || "awesome-copilot.config.yml";
|
||||||
generateConfig(configFile);
|
const { initializeProject } = require("./initialize-project");
|
||||||
|
await initializeProject(configFile);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ function generateConfig(outputPath = "awesome-copilot.config.yml") {
|
|||||||
project: {
|
project: {
|
||||||
name: "My Project",
|
name: "My Project",
|
||||||
description: "A project using awesome-copilot customizations",
|
description: "A project using awesome-copilot customizations",
|
||||||
output_directory: ".github"
|
output_directory: ".awesome-copilot"
|
||||||
},
|
},
|
||||||
prompts: {},
|
prompts: {},
|
||||||
instructions: {},
|
instructions: {},
|
||||||
@ -59,7 +59,7 @@ function generateConfig(outputPath = "awesome-copilot.config.yml") {
|
|||||||
# Set items to 'true' to include them in your project
|
# Set items to 'true' to include them in your project
|
||||||
# Set items to 'false' to exclude them
|
# 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(`Found ${prompts.length} prompts, ${instructions.length} instructions, ${chatmodes.length} chat modes, ${collections.length} collections`);
|
||||||
console.log("\nNext steps:");
|
console.log("\nNext steps:");
|
||||||
console.log("1. Edit the configuration file to enable desired items");
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
179
initialize-project.js
Normal file
179
initialize-project.js
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
#!/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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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));
|
||||||
|
|
||||||
|
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 };
|
||||||
@ -2,7 +2,10 @@
|
|||||||
"name": "awesome-copilot",
|
"name": "awesome-copilot",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"description": "Enhance your GitHub Copilot experience with community-contributed instructions, prompts, and chat modes",
|
"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": {
|
"scripts": {
|
||||||
"build": "node update-readme.js",
|
"build": "node update-readme.js",
|
||||||
"config:init": "node generate-config.js",
|
"config:init": "node generate-config.js",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user