Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Contributing to Copilot Instructions Builder CLI

First off, thank you for considering contributing to the Copilot Instructions Builder CLI! Your help is greatly appreciated. Whether it's reporting a bug, discussing improvements, or submitting a pull request, every contribution is valuable.

## How to Contribute

We follow a standard GitHub workflow for contributions:

1. **Fork the Repository**: Start by forking the [main repository]([YOUR_GITHUB_REPO_URL_HERE]) to your own GitHub account.
2. **Clone Your Fork**: Clone your forked repository to your local machine.
```bash
git clone https://github.com/YOUR_USERNAME/copilot-instructions-builder.git
```
3. **Create a Branch**: Create a new branch for your changes. Choose a descriptive name (e.g., `feature/add-new-command` or `bugfix/resolve-merge-conflict`).
```bash
git checkout -b your-branch-name
```
4. **Make Your Changes**: Implement your feature, fix the bug, or improve the documentation.
5. **Test Your Changes**: If you've added code that should be tested, please add tests and ensure all tests pass (`npm test`).
6. **Commit Your Changes**: Write clear, concise commit messages.
```bash
git commit -m "feat: Add new feature" -m "Detailed description of the feature."
```
7. **Push to Your Fork**: Push your changes to your forked repository.
```bash
git push origin your-branch-name
```
8. **Submit a Pull Request (PR)**: Open a pull request from your branch to the `main` branch of the original repository. Provide a clear description of your changes in the PR.

## Updating Documentation

Our user-facing documentation is located in the `/docs` folder. This content is used to generate our GitHub Pages documentation site.

Key documentation files include:
- `docs/index.md`: The main landing page for the documentation.
- `docs/getting-started.md`: Installation and initial setup.
- `docs/usage.md`: How to use the CLI commands.
- `docs/configuration.md`: Details on the `copilot-instructions.config.js` file.
- `docs/module-development.md`: How to create custom modules.

**If your contribution affects any user-facing aspects of the project (e.g., new commands, changes to existing commands, configuration options, module structure), please ensure you update the relevant parts of the documentation in the `/docs` folder.**

Updates to these files will be reflected on the GitHub Pages site after they are merged.

## Code of Conduct

While we don't have a formal Code of Conduct document yet, we expect all contributors to interact respectfully and constructively. Please be kind and considerate when communicating.

---

Thank you again for your interest in contributing!
320 changes: 9 additions & 311 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[![npm version](https://badge.fury.io/js/copilot-instructions-builder.svg)](https://badge.fury.io/js/copilot-instructions-builder)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Node.js Version](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)
[![Documentation Status](https://img.shields.io/badge/docs-view_site-success)]([YOUR_GITHUB_PAGES_URL_HERE])

A powerful CLI application for building GitHub Copilot instruction files from modular, hierarchical components. Create sophisticated instruction sets using a three-tier architecture: **Base Instructions** → **Domain-Specific Layers** → **Task-Specific Modules**.

Expand All @@ -30,272 +31,16 @@ A powerful CLI application for building GitHub Copilot instruction files from mo
npm install -g copilot-instructions
```

### Initialize a New Project

```bash
copilot-instructions init
```

### Quick Build with Modules

```bash
# Build with specific modules
copilot-instructions build --base programming-fundamentals --domain frontend/react --task ui-components

# Build from configuration file
copilot-instructions build

# Build specific profile
copilot-instructions build --profile production
```

### List Available Modules

```bash
# List all modules
copilot-instructions list

# Filter by type and tags
copilot-instructions list --type domain --tags react,frontend
```

## 🏗️ Architecture Overview

### Hierarchical Instruction System

```
Base Instructions (Foundation)
Domain Layers (Technology-specific)
Task Modules (Use case-specific)
.copilot-instructions.md (Output)
```

### Module Types

- **Base Instructions**: General programming principles, code quality, documentation standards
- **Domain Layers**: Technology-specific guidance (React, Node.js, Python, etc.)
- **Task Modules**: Specific use cases (API development, UI components, testing, etc.)

## 📁 Project Structure

```
copilot-instructions-builder/
├── src/
│ ├── core/ # Core composition engine
│ │ ├── composer.js # Main instruction composition
│ │ ├── resolver.js # Dependency resolution
│ │ ├── conflict-resolver.js # Conflict handling
│ │ └── ...
│ ├── modules/ # Module management
│ ├── commands/ # CLI commands
│ └── utils/ # Utilities and helpers
├── modules/ # Built-in instruction modules
│ ├── base/ # Foundation modules
│ ├── domains/ # Technology-specific modules
│ └── tasks/ # Use case modules
└── templates/ # Output templates
```

## 🔧 CLI Commands

### Core Operations

```bash
# Initialize project configuration
copilot-instructions init

# List available modules
copilot-instructions list [--type base|domain|task] [--tags react,frontend]

# Build instructions from modules
copilot-instructions build --base programming-fundamentals --domain frontend/react --task ui-components

# Add module to existing config
copilot-instructions add frontend/vue

# Validate configuration
copilot-instructions validate

# Show module dependencies
copilot-instructions deps frontend/react

# Search modules
copilot-instructions search "api development"
```

### Configuration-Driven Operations

```bash
# Build from configuration file
copilot-instructions build

# Build specific profile
copilot-instructions build --profile production

# Use custom config file
copilot-instructions build --config ./configs/backend.config.js

# Build all profiles
copilot-instructions build --all-profiles
```

## 📝 Module Structure

Each instruction module follows a standardized JSON format:

```json
{
"id": "module-identifier",
"name": "Module Display Name",
"type": "base|domain|task",
"version": "1.0.0",
"dependencies": ["required-module-ids"],
"conflicts": ["conflicting-module-ids"],
"tags": ["react", "frontend", "ui"],
"priority": 100,
"metadata": {
"description": "Module description",
"author": "author-name",
"category": "frontend|backend|testing|devops|general"
},
"instructions": {
"sections": [
{
"id": "section-identifier",
"title": "Section Title",
"priority": 100,
"merge_strategy": "replace|append|prepend|smart_merge",
"content": ["instruction 1", "instruction 2"],
"conditions": {
"include_if": ["tag1", "tag2"],
"exclude_if": ["tag3"],
"require_modules": ["module-id"]
}
}
]
},
"variables": {
"projectName": "{{PROJECT_NAME}}",
"framework": "{{FRAMEWORK}}"
}
}
```

## 🎯 Key Features

### Smart Dependency Resolution

- **Cycle Detection**: Prevents circular dependencies with detailed error reporting
- **Topological Sorting**: Ensures correct module loading order
- **Conflict Detection**: Identifies and resolves module conflicts automatically

### Intelligent Merging

- **Content-Aware**: Understands different types of content (rules, examples, guidelines)
- **Deduplication**: Removes duplicate instructions automatically
- **Priority-Based**: Respects module and section priorities during merging

### Template Variables

```json
{
"variables": {
"projectName": "{{PROJECT_NAME}}",
"framework": "{{FRAMEWORK || 'React'}}"
}
}
```

Supports:

- Simple variables: `{{VAR}}`
- Default values: `{{VAR || 'default'}}`
- Function calls: `{{func(args)}}`

### Conditional Instructions

```json
{
"conditions": {
"include_if": ["react", "frontend"],
"exclude_if": ["vue"],
"require_modules": ["base-frontend"],
"conflict_with": ["legacy-module"]
}
}
```

## ⚙️ Configuration

### Project Configuration File

Create a [`copilot-instructions.config.js`](./docs/builder-config.md) file:

```javascript
module.exports = {
profiles: {
development: {
modules: ['programming-fundamentals', 'frontend/react', 'ui-components'],
variables: {
PROJECT_NAME: 'My App',
FRAMEWORK: 'React',
},
},
production: {
modules: [
'programming-fundamentals',
'frontend/react',
'ui-components',
'performance-optimization',
],
},
},
output: {
file: '.copilot-instructions.md',
template: 'default',
},
};
```

## 🔍 Examples

### Building a React Frontend Project

```bash
# Quick command approach
copilot-instructions build \
--base programming-fundamentals,code-quality \
--domain frontend/react \
--task ui-components,performance-optimization

# Configuration approach
copilot-instructions init
# Edit copilot-instructions.config.js
copilot-instructions build --profile frontend
```

### Building a Node.js API

```bash
copilot-instructions build \
--base programming-fundamentals,documentation \
--domain backend/nodejs \
--task api-development,database-design
```

### Custom Module Discovery
## 📚 Documentation

```bash
# Search for modules
copilot-instructions search "testing"
copilot-instructions search "performance"
For detailed documentation, including setup, usage, configuration, and module development, please visit our **[GitHub Pages documentation site]([YOUR_GITHUB_PAGES_URL_HERE])**.

# List modules by category
copilot-instructions list --type task --tags api,backend
```
The full documentation includes:
- Getting Started Guide
- Detailed Usage Instructions
- Configuration Options
- Module Development Guide
- Project Architecture and more.

## 🛠️ Development

Expand All @@ -308,53 +53,6 @@ copilot-instructions list --type task --tags api,backend
5. Run tests: `npm test`
6. Submit a pull request

### Adding Custom Modules

Create new modules in the [`modules/`](./modules/) directory following the [module structure](#-module-structure). See our [architecture documentation](./docs/architecture-plan.md) for detailed guidelines.

### Testing

```bash
# Run all tests
npm test

# Run specific test suites
npm run test:unit
npm run test:integration
npm run test:performance
```

## 🔧 Advanced Features

### Error Handling

The CLI provides detailed error messages and recovery suggestions:

- **Circular Dependencies**: Suggests breaking changes
- **Module Conflicts**: Offers interactive resolution
- **Invalid Configuration**: Provides schema validation help
- **Template Errors**: Includes variable debugging information

### Performance Optimizations

- **Lazy Loading**: Modules loaded only when needed
- **Incremental Builds**: Only rebuild changed dependencies
- **Parallel Processing**: Concurrent resolution of independent modules
- **Multi-level Caching**: Optimized module and result caching

## 📚 Documentation

- [Architecture Plan](./docs/architecture-plan.md) - Detailed technical architecture
- [Configuration Guide](./docs/builder-config.md) - Configuration options and examples
- [Module Development](./docs/module-development.md) - Creating custom modules
- [API Reference](./docs/api-reference.md) - Programmatic usage

## 🤝 Support

- 📧 Issues: [GitHub Issues](https://github.com/your-org/copilot-instructions-builder/issues)
- 💬 Discussions: [GitHub Discussions](https://github.com/your-org/copilot-instructions-builder/discussions)
- 📖 Wiki: [Project Wiki](https://github.com/your-org/copilot-instructions-builder/wiki)

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
Expand Down
Loading
Loading