Created
October 14, 2025 19:05
-
-
Save executeautomation/67e220c337a3f39b385318ffac55a933 to your computer and use it in GitHub Desktop.
ScriptForAgentTask
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env node | |
| const fs = require('fs'); | |
| const path = require('path'); | |
| /** | |
| * Automatically sets up .github/chatmodes/agents.md in the current directory | |
| * This script runs when executing: npx @your-username/copilot-setup | |
| */ | |
| // Get the current working directory where npx was run | |
| const targetDir = process.cwd(); | |
| // Source directory (where our package files are) | |
| const sourceDir = __dirname; | |
| // Define the target structure | |
| const githubDir = path.join(targetDir, '.github'); | |
| const chatmodesDir = path.join(githubDir, 'chatmodes'); | |
| // Available categories mapping | |
| const CATEGORIES = { | |
| 'development': 'development', | |
| 'testing': 'Testing', | |
| 'ui-ux': 'ui_ux', | |
| 'business': 'business', | |
| 'ci-cd': 'ci_cd' | |
| }; | |
| // Parse command line arguments | |
| const args = process.argv.slice(2); | |
| const selectedCategories = []; | |
| // Check for --all flag or specific category flags | |
| const hasAllFlag = args.includes('--all'); | |
| if (hasAllFlag) { | |
| selectedCategories.push(...Object.values(CATEGORIES)); | |
| } else { | |
| args.forEach(arg => { | |
| if (arg.startsWith('--')) { | |
| const category = arg.slice(2); | |
| if (CATEGORIES[category]) { | |
| selectedCategories.push(CATEGORIES[category]); | |
| } else if (category !== 'all') { | |
| console.warn(`⚠️ Unknown category: ${category}`); | |
| } | |
| } | |
| }); | |
| } | |
| // If no categories specified, show usage | |
| if (selectedCategories.length === 0) { | |
| console.log('� GitHub Copilot Agents Setup\n'); | |
| console.log('Usage: npx copilot-setup [options]\n'); | |
| console.log('Options:'); | |
| console.log(' --all Install all agent categories'); | |
| console.log(' --development Install development agents'); | |
| console.log(' --testing Install testing agents'); | |
| console.log(' --ui-ux Install UI/UX agents'); | |
| console.log(' --business Install business agents'); | |
| console.log(' --ci-cd Install CI/CD agents'); | |
| console.log('\nExamples:'); | |
| console.log(' npx copilot-setup --development'); | |
| console.log(' npx copilot-setup --development --testing'); | |
| console.log(' npx copilot-setup --all'); | |
| process.exit(0); | |
| } | |
| console.log('�🚀 Setting up GitHub Copilot chat modes...\n'); | |
| console.log(`📂 Categories: ${selectedCategories.join(', ')}\n`); | |
| try { | |
| // Create .github directory if it doesn't exist | |
| if (!fs.existsSync(githubDir)) { | |
| fs.mkdirSync(githubDir, { recursive: true }); | |
| console.log('✓ Created .github directory'); | |
| } | |
| // Create chatmodes directory if it doesn't exist | |
| if (!fs.existsSync(chatmodesDir)) { | |
| fs.mkdirSync(chatmodesDir, { recursive: true }); | |
| console.log('✓ Created .github/chatmodes directory'); | |
| } | |
| // Copy markdown files from selected categories | |
| let copiedCount = 0; | |
| let skippedCount = 0; | |
| let notFoundCategories = []; | |
| selectedCategories.forEach(category => { | |
| const sourceCategoryDir = path.join(sourceDir, category); | |
| if (!fs.existsSync(sourceCategoryDir)) { | |
| notFoundCategories.push(category); | |
| return; | |
| } | |
| const files = fs.readdirSync(sourceCategoryDir).filter(f => f.endsWith('.md')); | |
| if (files.length === 0) { | |
| console.warn(`⚠️ No agent files found in ${category}`); | |
| return; | |
| } | |
| console.log(`\n📁 Processing ${category}:`); | |
| files.forEach(file => { | |
| const source = path.join(sourceCategoryDir, file); | |
| const target = path.join(chatmodesDir, file); | |
| if (!fs.existsSync(target)) { | |
| fs.copyFileSync(source, target); | |
| console.log(` ✓ Created ${file}`); | |
| copiedCount++; | |
| } else { | |
| console.log(` ⊘ Skipped ${file} (already exists)`); | |
| skippedCount++; | |
| } | |
| }); | |
| }); | |
| if (notFoundCategories.length > 0) { | |
| console.warn(`\n⚠️ Categories not found: ${notFoundCategories.join(', ')}`); | |
| } | |
| console.log('\n' + '='.repeat(50)); | |
| console.log('✨ Setup complete!'); | |
| console.log(`📁 Files copied: ${copiedCount}`); | |
| if (skippedCount > 0) { | |
| console.log(`⊘ Files skipped: ${skippedCount}`); | |
| } | |
| console.log('\n📍 Location: .github/chatmodes/'); | |
| console.log('='.repeat(50)); | |
| } catch (error) { | |
| console.error('\n❌ Error during setup:', error.message); | |
| process.exit(1); | |
| } | |
| { | |
| "name": "@executeautomation/github-agents", | |
| "version": "1.0.0", | |
| "description": "Shared GitHub Copilot instructions", | |
| "main": "install.js", | |
| "bin": { | |
| "copilot-setup": "./install.js" | |
| }, | |
| "files": [ | |
| "development/", | |
| "Testing/", | |
| "ui_ux/", | |
| "business/", | |
| "ci_cd/", | |
| "install.js", | |
| "README.md" | |
| ], | |
| "scripts": { | |
| "test": "node install.js" | |
| }, | |
| "keywords": [ | |
| "github-copilot", | |
| "chatmodes", | |
| "agents", | |
| "ai", | |
| "setup", | |
| "automation" | |
| ], | |
| "author": "Karthik KK", | |
| "license": "MIT", | |
| "repository": { | |
| "type": "git", | |
| "url": "https://github.com/your-username/copilot-setup" | |
| }, | |
| "bugs": { | |
| "url": "https://github.com/your-username/copilot-setup/issues" | |
| }, | |
| "homepage": "https://github.com/your-username/copilot-setup#readme", | |
| "engines": { | |
| "node": ">=12.0.0" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment