agents-templated 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Agents Templated
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,367 @@
1
+ # Technology-Agnostic Development Template
2
+
3
+ A flexible, enterprise-grade development template that adapts to any modern technology stack while maintaining security-first development patterns, comprehensive testing, and excellent developer experience. Built with AI assistant integration for Cursor, GitHub Copilot, and other AI coding tools.
4
+
5
+ ## Overview
6
+
7
+ This template provides a proven agent-based development structure that works with any technology stack. It includes comprehensive rules, patterns, and guidelines that help both developers and AI assistants maintain consistent, secure, and high-quality code across different projects.
8
+
9
+ ## Key Features
10
+
11
+ - **Technology-Agnostic**: Works with React, Vue, Angular, Node.js, Python, Go, Rust, or any modern stack
12
+ - **AI Assistant Ready**: Pre-configured for Cursor, GitHub Copilot, and other AI coding tools
13
+ - **Security-First**: Built-in OWASP Top 10 protection patterns and security guidelines
14
+ - **Comprehensive Testing**: Testing strategy with unit, integration, and E2E coverage targets
15
+ - **Agent-Based Architecture**: Specialized agents for frontend, backend, database, testing, and security
16
+ - **Type-Safe Patterns**: Strong typing and validation patterns across the stack
17
+ - **Accessibility Compliant**: WCAG 2.1 AA standards built into development patterns
18
+
19
+ ## Quick Start
20
+
21
+ ### Installation Options
22
+
23
+ **Option 1: NPM Package (Recommended for Existing Projects)**
24
+
25
+ Install globally and use in any project:
26
+
27
+ ```bash
28
+ # Install globally
29
+ npm install -g agents-templated
30
+
31
+ # Use in any existing project
32
+ cd your-existing-project
33
+ agents-templated init
34
+ ```
35
+
36
+ Or install locally per project:
37
+
38
+ ```bash
39
+ # Install as dev dependency
40
+ npm install --save-dev agents-templated
41
+
42
+ # Initialize templates
43
+ npx agents-templated init
44
+ ```
45
+
46
+ **Option 2: Clone Template (New Projects)**
47
+
48
+ ```bash
49
+ git clone <this-repo> my-project
50
+ cd my-project
51
+ ```
52
+
53
+ ### CLI Usage
54
+
55
+ ```bash
56
+ # Install all components
57
+ agents-templated init --all
58
+
59
+ # Install specific components
60
+ agents-templated init --docs # Documentation only
61
+ agents-templated init --rules # Agent rules only
62
+ agents-templated init --skills # Skills only
63
+ agents-templated init --github # GitHub Copilot config
64
+
65
+ # Force overwrite existing files
66
+ agents-templated init --all --force
67
+
68
+ # List available components
69
+ agents-templated list
70
+ ```
71
+
72
+ ### Choose Your Technology Stack
73
+
74
+ This template adapts to your preferred technologies:
75
+
76
+ **Frontend Options:**
77
+ - React/Next.js, Vue/Nuxt, Angular, Svelte/SvelteKit, or traditional SSR
78
+
79
+ **Backend Options:**
80
+ - Node.js (Express/Fastify), Python (Django/FastAPI), Go, Rust, Java/Spring
81
+
82
+ **Database Options:**
83
+ - PostgreSQL/MySQL with ORM, MongoDB/NoSQL, or cloud solutions like Supabase
84
+
85
+ ### Configure AI Assistants
86
+
87
+ The template includes configuration files for multiple AI assistants:
88
+
89
+ - **Cursor**: Uses `.cursorrules` and `agents/rules/*.mdc` files (auto-loaded)
90
+ - **GitHub Copilot**: Uses `.github/copilot-instructions.md` (auto-loaded)
91
+ - **Other AI Tools**: Reference `AI_INSTRUCTIONS.md` in your prompts
92
+
93
+ ### Initialize Your Project
94
+
95
+ Set up your chosen technologies:
96
+
97
+ ```bash
98
+ # Example for Node.js + React
99
+ npm init -y
100
+ npm install react next typescript
101
+
102
+ # Example for Python + Django
103
+ pip install django djangorestframework
104
+ django-admin startproject myproject .
105
+
106
+ # Example for Go + Gin
107
+ go mod init myproject
108
+ go get github.com/gin-gonic/gin
109
+ ```
110
+
111
+ ## Programmatic API
112
+
113
+ Use agents-templated programmatically in your build scripts:
114
+
115
+ ```javascript
116
+ const agentsTemplated = require('agents-templated');
117
+
118
+ // Install all components
119
+ await agentsTemplated.install('./my-project', {
120
+ force: true
121
+ });
122
+
123
+ // Install specific components
124
+ await agentsTemplated.install('./my-project', {
125
+ docs: true,
126
+ rules: true,
127
+ skills: false,
128
+ github: true,
129
+ force: false
130
+ });
131
+ ```
132
+
133
+ ## Directory Structure
134
+
135
+ ```
136
+ ├── agents/ # Agent rules and skills
137
+ │ ├── rules/ # Development rules and patterns
138
+ │ │ ├── core.mdc # Core architecture guidelines
139
+ │ │ ├── security.mdc # Security patterns and requirements
140
+ │ │ ├── testing.mdc # Testing strategy and patterns
141
+ │ │ ├── frontend.mdc # Frontend development patterns
142
+ │ │ ├── database.mdc # Database design and patterns
143
+ │ │ └── style.mdc # Code style and formatting rules
144
+ │ └── skills/ # Reusable agent skills
145
+ │ ├── web-design-guidelines/ # Web interface guidelines skill
146
+ │ └── find-skills/ # Skill discovery utilities
147
+ ├── .github/
148
+ │ └── copilot-instructions.md # GitHub Copilot configuration
149
+ ├── AGENTS.md # Agent responsibilities and usage guide
150
+ ├── CLAUDE.md # Project guidelines and architecture
151
+ ├── AI_INSTRUCTIONS.md # Universal AI assistant instructions
152
+ ├── .cursorrules # Cursor AI assistant configuration
153
+ ├── .aiderignore # Aider AI assistant ignore patterns
154
+ ├── .editorconfig # Editor configuration
155
+ ├── .gitignore # Git ignore patterns
156
+ └── README.md # This file
157
+ ```
158
+
159
+ ## Core Configuration Files
160
+
161
+ ### Documentation Files
162
+
163
+ - **`CLAUDE.md`** - Overall project guidelines, architecture principles, and technology stack selection
164
+ - **`AGENTS.md`** - Agent delegation patterns, responsibilities, and when to use each agent
165
+ - **`AI_INSTRUCTIONS.md`** - Universal instructions for any AI assistant (reference explicitly)
166
+
167
+ ### AI Assistant Configuration
168
+
169
+ - **`.cursorrules`** - Cursor-specific rules (auto-loaded by Cursor)
170
+ - **`.github/copilot-instructions.md`** - GitHub Copilot instructions (auto-loaded)
171
+ - **`agents/rules/*.mdc`** - Detailed rules with `alwaysApply: true` for auto-loading in Cursor
172
+
173
+ ### Rule Files
174
+
175
+ - **`agents/rules/core.mdc`** - Core architecture principles and best practices
176
+ - **`agents/rules/security.mdc`** - Security patterns, OWASP Top 10 protection
177
+ - **`agents/rules/testing.mdc`** - Testing strategy, coverage targets, patterns
178
+ - **`agents/rules/frontend.mdc`** - Frontend development patterns and accessibility
179
+ - **`agents/rules/database.mdc`** - Database schema design and query optimization
180
+ - **`agents/rules/style.mdc`** - Code style guidelines and formatting rules
181
+
182
+ ## Agent-Based Development
183
+
184
+ This template uses specialized agents for different aspects of development:
185
+
186
+ ### FrontendAgent
187
+ Handles UI/UX development, component creation, design system implementation, and accessibility compliance.
188
+
189
+ ### BackendAgent
190
+ Manages API development, business logic, authentication, authorization, rate limiting, and security middleware.
191
+
192
+ ### DatabaseAgent
193
+ Owns database schema design, migrations, query optimization, and data access patterns.
194
+
195
+ ### TestAgent
196
+ Implements comprehensive testing strategy across unit, integration, E2E, accessibility, and security testing.
197
+
198
+ ### SecurityAgent
199
+ Ensures security-first development with input validation, authentication patterns, authorization checks, and OWASP compliance.
200
+
201
+ ### ReviewerAgent
202
+ Performs code reviews focusing on correctness, security, performance, test coverage, and accessibility.
203
+
204
+ ## Core Principles
205
+
206
+ ### Security-First Development
207
+ - Validate all inputs at application boundaries with schema validation
208
+ - Authenticate and authorize every protected endpoint
209
+ - Rate limit public endpoints to prevent abuse
210
+ - Sanitize outputs to prevent injection attacks
211
+ - Never expose sensitive data in error messages or logs
212
+
213
+ ### Testing Strategy
214
+ - **Unit Tests**: 80% coverage for business logic
215
+ - **Integration Tests**: 15% coverage for API endpoints and database operations
216
+ - **E2E Tests**: 5% coverage for critical user journeys
217
+ - **Accessibility Tests**: WCAG 2.1 AA compliance for all UI
218
+
219
+ ### Type Safety
220
+ - Use strong typing systems available in your chosen language
221
+ - Implement runtime validation for all external/user-provided data
222
+ - Validate at boundaries: API endpoints, form submissions, configuration
223
+ - Generate types from schemas when possible (OpenAPI, GraphQL, database schemas)
224
+
225
+ ### Code Quality
226
+ - Maintain consistent patterns throughout the codebase
227
+ - Follow established code style guidelines
228
+ - Ensure proper error handling and logging
229
+ - Keep documentation updated with code changes
230
+
231
+ ## Security Patterns
232
+
233
+ ### Input Validation Example
234
+
235
+ ```typescript
236
+ // TypeScript with Zod
237
+ import { z } from 'zod'
238
+
239
+ const userSchema = z.object({
240
+ email: z.string().email().toLowerCase(),
241
+ password: z.string().min(8)
242
+ })
243
+ ```
244
+
245
+ ```python
246
+ # Python with Pydantic
247
+ from pydantic import BaseModel, EmailStr
248
+
249
+ class User(BaseModel):
250
+ email: EmailStr
251
+ password: str
252
+ ```
253
+
254
+ ### Rate Limiting Example
255
+
256
+ ```javascript
257
+ // Node.js with express-rate-limit
258
+ const rateLimit = require('express-rate-limit')
259
+
260
+ const authLimiter = rateLimit({
261
+ windowMs: 15 * 60 * 1000, // 15 minutes
262
+ max: 5, // 5 attempts per window
263
+ message: 'Too many authentication attempts'
264
+ })
265
+ ```
266
+
267
+ ## Testing Strategy
268
+
269
+ ### Coverage Targets
270
+ - **Unit Tests**: 80% coverage for business logic
271
+ - **Integration Tests**: 15% coverage for API endpoints and database operations
272
+ - **E2E Tests**: 5% coverage for critical user journeys
273
+
274
+ ### Testing Tools by Technology
275
+
276
+ **JavaScript/TypeScript:**
277
+ - Unit/Integration: Jest, Vitest, or framework-specific test runners
278
+ - E2E: Playwright, Cypress, or Selenium
279
+ - Component: Testing Library, Enzyme
280
+
281
+ **Python:**
282
+ - Unit/Integration: pytest, unittest
283
+ - E2E: Selenium, Playwright
284
+ - API: requests, httpx
285
+
286
+ **Go:**
287
+ - Unit/Integration: Built-in testing package, testify
288
+ - E2E: Selenium, Playwright
289
+ - HTTP: httptest package
290
+
291
+ ## AI Assistant Integration
292
+
293
+ ### Cursor
294
+ Rules are automatically loaded from:
295
+ - `.cursorrules` file
296
+ - `agents/rules/*.mdc` files with `alwaysApply: true`
297
+ - `AGENTS.md` and `CLAUDE.md` (via workspace rules)
298
+
299
+ ### GitHub Copilot
300
+ Instructions are automatically loaded from:
301
+ - `.github/copilot-instructions.md`
302
+
303
+ ### Other AI Assistants
304
+ Reference `AI_INSTRUCTIONS.md` explicitly in your prompts:
305
+ - "Follow the patterns in `AI_INSTRUCTIONS.md`"
306
+ - "Check `AGENTS.md` for agent delegation"
307
+ - "Apply security patterns from `agents/rules/security.mdc`"
308
+
309
+ ## Usage Examples
310
+
311
+ ### Frontend Development
312
+ ```
313
+ "Create a responsive navigation component with accessibility support"
314
+ "Redesign the user profile page following our design system"
315
+ "Implement the login form with proper validation"
316
+ ```
317
+
318
+ ### Backend Development
319
+ ```
320
+ "Create a secure user registration endpoint with rate limiting"
321
+ "Implement JWT authentication middleware"
322
+ "Add password reset functionality with email verification"
323
+ ```
324
+
325
+ ### Database Operations
326
+ ```
327
+ "Design a user roles and permissions schema"
328
+ "Create a migration to add audit logging"
329
+ "Optimize the user query to prevent N+1 problems"
330
+ ```
331
+
332
+ ## Documentation
333
+
334
+ ### Getting Started
335
+ 1. Review `CLAUDE.md` for architecture and technology selection guidance
336
+ 2. Check `AGENTS.md` for agent responsibilities and delegation patterns
337
+ 3. Reference `agents/rules/*.mdc` files for detailed implementation patterns
338
+ 4. Configure your AI assistant using the appropriate configuration file
339
+
340
+ ### Additional Resources
341
+ - **Architecture**: See `CLAUDE.md` for detailed architecture guidelines
342
+ - **Agent Usage**: See `AGENTS.md` for detailed agent responsibilities
343
+ - **Security**: See `agents/rules/security.mdc` for security patterns
344
+ - **Testing**: See `agents/rules/testing.mdc` for testing strategy
345
+ - **Code Style**: See `agents/rules/style.mdc` for formatting rules
346
+
347
+ ## Quality Gates
348
+
349
+ All code must meet these standards:
350
+ - Pass linting and formatting checks
351
+ - Meet minimum test coverage thresholds (80% unit, 15% integration, 5% E2E)
352
+ - Pass security scans without high-severity issues
353
+ - Pass accessibility tests for user-facing features
354
+ - Follow established patterns and conventions
355
+
356
+ ## Contributing
357
+
358
+ When contributing to this template:
359
+ 1. Maintain technology-agnostic patterns
360
+ 2. Update relevant rule files in `agents/rules/`
361
+ 3. Keep documentation synchronized with code changes
362
+ 4. Follow security and testing patterns
363
+ 5. Ensure AI assistant configurations remain compatible
364
+
365
+ ---
366
+
367
+ **Ready to start building?** Choose your technology stack, adapt the configuration files, and begin development with enterprise-grade patterns from day one.
package/bin/cli.js ADDED
@@ -0,0 +1,189 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { Command } = require('commander');
4
+ const inquirer = require('inquirer');
5
+ const fs = require('fs-extra');
6
+ const path = require('path');
7
+ const chalk = require('chalk');
8
+
9
+ const program = new Command();
10
+
11
+ program
12
+ .name('agents-templated')
13
+ .description('Technology-agnostic development template with AI assistant integration')
14
+ .version('1.0.0');
15
+
16
+ program
17
+ .command('init')
18
+ .description('Initialize agents template in the current directory')
19
+ .option('-a, --all', 'Install all components')
20
+ .option('-d, --docs', 'Install documentation files only')
21
+ .option('-r, --rules', 'Install agent rules only')
22
+ .option('-s, --skills', 'Install skills only')
23
+ .option('-g, --github', 'Install GitHub Copilot instructions')
24
+ .option('-f, --force', 'Overwrite existing files')
25
+ .action(async (options) => {
26
+ try {
27
+ const targetDir = process.cwd();
28
+ const templateDir = path.join(__dirname, '..', 'templates');
29
+
30
+ console.log(chalk.blue.bold('\n🤖 Agents Templated - AI-Powered Development Setup\n'));
31
+
32
+ let choices = [];
33
+
34
+ // If no specific options provided, prompt user
35
+ if (!options.all && !options.docs && !options.rules && !options.skills && !options.github) {
36
+ const answers = await inquirer.prompt([
37
+ {
38
+ type: 'checkbox',
39
+ name: 'components',
40
+ message: 'Select components to install:',
41
+ choices: [
42
+ { name: 'All components', value: 'all' },
43
+ { name: 'Documentation files (AGENTS.MD, CLAUDE.md, etc.)', value: 'docs' },
44
+ { name: 'Agent rules (agents/rules/*.mdc)', value: 'rules' },
45
+ { name: 'Skills (agents/skills/*)', value: 'skills' },
46
+ { name: 'GitHub Copilot instructions', value: 'github' }
47
+ ],
48
+ default: ['all']
49
+ },
50
+ {
51
+ type: 'confirm',
52
+ name: 'overwrite',
53
+ message: 'Overwrite existing files?',
54
+ default: false,
55
+ when: (answers) => answers.components.length > 0
56
+ }
57
+ ]);
58
+
59
+ choices = answers.components;
60
+ options.force = answers.overwrite;
61
+ } else {
62
+ // Use command line options
63
+ if (options.all) choices.push('all');
64
+ if (options.docs) choices.push('docs');
65
+ if (options.rules) choices.push('rules');
66
+ if (options.skills) choices.push('skills');
67
+ if (options.github) choices.push('github');
68
+ }
69
+
70
+ const installAll = choices.includes('all');
71
+
72
+ // Install documentation files
73
+ if (installAll || choices.includes('docs')) {
74
+ console.log(chalk.yellow('📄 Installing documentation files...'));
75
+ await copyFiles(templateDir, targetDir, [
76
+ 'AGENTS.MD',
77
+ 'CLAUDE.md',
78
+ 'AI_INSTRUCTIONS.md',
79
+ 'README.md'
80
+ ], options.force);
81
+ }
82
+
83
+ // Install agent rules
84
+ if (installAll || choices.includes('rules')) {
85
+ console.log(chalk.yellow('📋 Installing agent rules...'));
86
+ await fs.ensureDir(path.join(targetDir, 'agents', 'rules'));
87
+ await copyDirectory(
88
+ path.join(templateDir, 'agents', 'rules'),
89
+ path.join(targetDir, 'agents', 'rules'),
90
+ options.force
91
+ );
92
+ }
93
+
94
+ // Install skills
95
+ if (installAll || choices.includes('skills')) {
96
+ console.log(chalk.yellow('🎯 Installing skills...'));
97
+ await fs.ensureDir(path.join(targetDir, 'agents', 'skills'));
98
+ await copyDirectory(
99
+ path.join(templateDir, 'agents', 'skills'),
100
+ path.join(targetDir, 'agents', 'skills'),
101
+ options.force
102
+ );
103
+ }
104
+
105
+ // Install GitHub Copilot instructions
106
+ if (installAll || choices.includes('github')) {
107
+ console.log(chalk.yellow('🐙 Installing GitHub Copilot instructions...'));
108
+ await fs.ensureDir(path.join(targetDir, '.github'));
109
+ await copyFiles(templateDir, targetDir, [
110
+ '.github/copilot-instructions.md'
111
+ ], options.force);
112
+ }
113
+
114
+ console.log(chalk.green.bold('\n✅ Installation complete!\n'));
115
+ console.log(chalk.cyan('Next steps:'));
116
+ console.log(chalk.white(' 1. Review CLAUDE.md for project guidelines'));
117
+ console.log(chalk.white(' 2. Review AGENTS.MD for agent patterns'));
118
+ console.log(chalk.white(' 3. Configure your AI assistant (Cursor, Copilot, etc.)'));
119
+ console.log(chalk.white(' 4. Adapt the rules to your technology stack\n'));
120
+
121
+ } catch (error) {
122
+ console.error(chalk.red('❌ Error:'), error.message);
123
+ process.exit(1);
124
+ }
125
+ });
126
+
127
+ program
128
+ .command('list')
129
+ .description('List available components')
130
+ .action(() => {
131
+ console.log(chalk.blue.bold('\n📦 Available Components:\n'));
132
+ console.log(chalk.yellow('docs') + ' - Documentation files (AGENTS.MD, CLAUDE.md, AI_INSTRUCTIONS.md, README.md)');
133
+ console.log(chalk.yellow('rules') + ' - Agent rules (core, database, frontend, security, testing, style)');
134
+ console.log(chalk.yellow('skills') + ' - Agent skills (find-skills, web-design-guidelines)');
135
+ console.log(chalk.yellow('github') + ' - GitHub Copilot instructions (.github/copilot-instructions.md)');
136
+ console.log(chalk.yellow('all') + ' - All components\n');
137
+ });
138
+
139
+ async function copyFiles(sourceDir, targetDir, files, force = false) {
140
+ for (const file of files) {
141
+ const sourcePath = path.join(sourceDir, file);
142
+ const targetPath = path.join(targetDir, file);
143
+
144
+ if (await fs.pathExists(sourcePath)) {
145
+ if (await fs.pathExists(targetPath) && !force) {
146
+ console.log(chalk.gray(` ⏭️ Skipping ${file} (already exists)`));
147
+ continue;
148
+ }
149
+
150
+ await fs.ensureDir(path.dirname(targetPath));
151
+ await fs.copy(sourcePath, targetPath, { overwrite: force });
152
+ console.log(chalk.green(` ✓ ${file}`));
153
+ }
154
+ }
155
+ }
156
+
157
+ async function copyDirectory(sourceDir, targetDir, force = false) {
158
+ if (!(await fs.pathExists(sourceDir))) {
159
+ console.log(chalk.gray(` ⏭️ Directory not found: ${sourceDir}`));
160
+ return;
161
+ }
162
+
163
+ const files = await fs.readdir(sourceDir, { withFileTypes: true });
164
+
165
+ for (const file of files) {
166
+ const sourcePath = path.join(sourceDir, file.name);
167
+ const targetPath = path.join(targetDir, file.name);
168
+
169
+ if (file.isDirectory()) {
170
+ await fs.ensureDir(targetPath);
171
+ await copyDirectory(sourcePath, targetPath, force);
172
+ } else {
173
+ if (await fs.pathExists(targetPath) && !force) {
174
+ console.log(chalk.gray(` ⏭️ Skipping ${path.relative(process.cwd(), targetPath)} (already exists)`));
175
+ continue;
176
+ }
177
+
178
+ await fs.copy(sourcePath, targetPath, { overwrite: force });
179
+ console.log(chalk.green(` ✓ ${path.relative(process.cwd(), targetPath)}`));
180
+ }
181
+ }
182
+ }
183
+
184
+ program.parse(process.argv);
185
+
186
+ // Show help if no command provided
187
+ if (!process.argv.slice(2).length) {
188
+ program.outputHelp();
189
+ }
package/index.js ADDED
@@ -0,0 +1,109 @@
1
+ const fs = require('fs-extra');
2
+ const path = require('path');
3
+
4
+ /**
5
+ * Programmatic API for agents-templated
6
+ * Allows integration into other tools and scripts
7
+ */
8
+
9
+ /**
10
+ * Copy template files to a target directory
11
+ * @param {string} targetDir - Destination directory
12
+ * @param {Object} options - Installation options
13
+ * @param {boolean} options.docs - Install documentation files
14
+ * @param {boolean} options.rules - Install agent rules
15
+ * @param {boolean} options.skills - Install skills
16
+ * @param {boolean} options.github - Install GitHub Copilot instructions
17
+ * @param {boolean} options.force - Overwrite existing files
18
+ * @returns {Promise<void>}
19
+ */
20
+ async function install(targetDir, options = {}) {
21
+ const templateDir = path.join(__dirname, 'templates');
22
+ const installAll = !options.docs && !options.rules && !options.skills && !options.github;
23
+
24
+ const files = [];
25
+
26
+ // Documentation files
27
+ if (installAll || options.docs) {
28
+ files.push(
29
+ 'AGENTS.MD',
30
+ 'CLAUDE.md',
31
+ 'AI_INSTRUCTIONS.md',
32
+ 'README.md'
33
+ );
34
+ }
35
+
36
+ // Copy files
37
+ for (const file of files) {
38
+ const sourcePath = path.join(templateDir, file);
39
+ const targetPath = path.join(targetDir, file);
40
+
41
+ if (await fs.pathExists(sourcePath)) {
42
+ if (await fs.pathExists(targetPath) && !options.force) {
43
+ continue;
44
+ }
45
+
46
+ await fs.ensureDir(path.dirname(targetPath));
47
+ await fs.copy(sourcePath, targetPath, { overwrite: options.force });
48
+ }
49
+ }
50
+
51
+ // Agent rules
52
+ if (installAll || options.rules) {
53
+ await fs.ensureDir(path.join(targetDir, 'agents', 'rules'));
54
+ await copyDirectory(
55
+ path.join(templateDir, 'agents', 'rules'),
56
+ path.join(targetDir, 'agents', 'rules'),
57
+ options.force
58
+ );
59
+ }
60
+
61
+ // Skills
62
+ if (installAll || options.skills) {
63
+ await fs.ensureDir(path.join(targetDir, 'agents', 'skills'));
64
+ await copyDirectory(
65
+ path.join(templateDir, 'agents', 'skills'),
66
+ path.join(targetDir, 'agents', 'skills'),
67
+ options.force
68
+ );
69
+ }
70
+
71
+ // GitHub Copilot instructions
72
+ if (installAll || options.github) {
73
+ await fs.ensureDir(path.join(targetDir, '.github'));
74
+ const sourcePath = path.join(templateDir, '.github', 'copilot-instructions.md');
75
+ const targetPath = path.join(targetDir, '.github', 'copilot-instructions.md');
76
+
77
+ if (await fs.pathExists(sourcePath)) {
78
+ await fs.copy(sourcePath, targetPath, { overwrite: options.force });
79
+ }
80
+ }
81
+ }
82
+
83
+ async function copyDirectory(sourceDir, targetDir, force = false) {
84
+ if (!(await fs.pathExists(sourceDir))) {
85
+ return;
86
+ }
87
+
88
+ const files = await fs.readdir(sourceDir, { withFileTypes: true });
89
+
90
+ for (const file of files) {
91
+ const sourcePath = path.join(sourceDir, file.name);
92
+ const targetPath = path.join(targetDir, file.name);
93
+
94
+ if (file.isDirectory()) {
95
+ await fs.ensureDir(targetPath);
96
+ await copyDirectory(sourcePath, targetPath, force);
97
+ } else {
98
+ if (await fs.pathExists(targetPath) && !force) {
99
+ continue;
100
+ }
101
+
102
+ await fs.copy(sourcePath, targetPath, { overwrite: force });
103
+ }
104
+ }
105
+ }
106
+
107
+ module.exports = {
108
+ install
109
+ };