Skip to content
Merged
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## **WORK IN PROGRESS**

- (copilot) **NEW**: Added automated template update system using GitHub Copilot-powered issue templates (Fixes #24)
- (copilot) **NEW**: Created copy-paste template for quick automated template validation and updates
- (copilot) **NEW**: Added comprehensive automated updates documentation with step-by-step workflows
- (copilot) **ENHANCED**: Replaced manual template update process with GitHub Copilot automation that preserves all [CUSTOMIZE] sections
- (copilot) **NEW**: Added templates directory with automated-template-update.md and copy-paste-template.md for issue creation
- (copilot) **ENHANCED**: Updated README.md and setup.md to emphasize automated approach over manual processes
- (copilot) **ENHANCED**: Improved initial setup instructions to ensure [CUSTOMIZE] sections are properly used from the start
- (copilot) **NEW**: Added comprehensive test suite for automated template features (test-automated-templates.sh)
- (copilot) **ENHANCED**: Reorganized README into focused documentation files by instruction type for better user experience (Fixes #22)
- (copilot) **NEW**: Created separate docs/ directory with setup.md, maintenance.md, and testing.md for clear audience targeting
- (copilot) **ENHANCED**: Promoted intelligent Copilot-assisted template merging instead of 1:1 copying for better version control
Expand Down
59 changes: 46 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,20 @@ Your contributions help make adapter development better for the entire ioBroker

**For experienced Copilot users:**

1. **Use Copilot for Smart Integration**: Instead of simply copying the template, use GitHub Copilot to intelligently merge it with your existing setup
2. **Prompt Copilot**: "Merge the ioBroker template from https://github.com/DrozmotiX/ioBroker-Copilot-Instructions/blob/main/template.md with my existing .github/copilot-instructions.md, maintaining project-specific context and adding version tracking"
3. **Customize**: Review and modify sections marked with `[CUSTOMIZE]` for your specific adapter
4. **Verify**: Test that Copilot provides enhanced ioBroker-specific suggestions
1. **🚀 Automated Updates** (Recommended): Ensure GitHub Copilot is active in your repository first, then create an issue with the [automated update template](templates/copy-paste-template.md) to let GitHub Copilot handle everything
2. **🎯 Manual Integration**: Use GitHub Copilot to intelligently merge the template with your existing setup
3. **🛠️ Customize**: Review and modify sections marked with `[CUSTOMIZE]` for your specific adapter
4. **✅ Verify**: Test that Copilot provides enhanced ioBroker-specific suggestions

**Quick automation**: First ensure GitHub Copilot is set up in your repository, then copy-paste from [this template](templates/copy-paste-template.md) into a new issue.

![Version](https://img.shields.io/github/package-json/v/DrozmotiX/ioBroker-Copilot-Instructions?label=Current%20Version) | **Template:** [`template.md`](template.md) | ![Last Updated](https://img.shields.io/github/last-commit/DrozmotiX/ioBroker-Copilot-Instructions?label=Last%20Updated)

## 📚 Documentation

### 🛠️ For Developers
- **[Setup Guide](docs/setup.md)** - Complete GitHub Copilot setup and template integration
- **[Automated Updates Guide](docs/automated-updates.md)** - Automated template updates with GitHub Copilot
- **[Testing Guide](docs/testing.md)** - Validate your template integration and Copilot functionality

### 🔧 For Repository Maintainers
Expand All @@ -61,15 +64,45 @@ Check if your template is up-to-date:
curl -s https://raw.githubusercontent.com/DrozmotiX/ioBroker-Copilot-Instructions/main/scripts/check-template-version.sh | bash
```

### Updating Your Template

To update to the latest version:

1. **Check for updates** in this repository
2. **Compare versions** between your local copy and the latest release
3. **Download the new template** and replace your local version
4. **Review changes** to understand what improvements were made
5. **Test** to ensure compatibility with your project
### Automated Template Updates

🤖 **Use GitHub Copilot to automatically update your template** - This is now the recommended approach that preserves all your custom sections:

#### Quick Update (Copy-Paste Method)
1. **Create an issue in your repository** with title: "🤖 Update ioBroker Copilot Instructions Template"
2. **Copy-paste this content**:
```markdown
**GitHub Copilot**: Please help me update my ioBroker Copilot instructions template to the latest version while preserving all custom sections.

## Task
Update `.github/copilot-instructions.md` using this prompt:

"Merge the ioBroker template from https://github.com/DrozmotiX/ioBroker-Copilot-Instructions/blob/main/template.md with my existing .github/copilot-instructions.md.

REQUIREMENTS:
1. Preserve ALL [CUSTOMIZE] sections exactly as they are
2. Keep all project-specific context and custom instructions
3. Add latest ioBroker best practices from the new template
4. Update version to match latest template version
5. Maintain Template Source reference

Show me the changes before applying them."

## Validation
After update, confirm:
- [ ] All [CUSTOMIZE] sections preserved
- [ ] Version updated to latest
- [ ] Custom content intact
- [ ] Template structure complete
```
3. **Let GitHub Copilot handle the merge** automatically while preserving your customizations
4. **Review and apply** the proposed changes

📚 **For detailed automation instructions**: See [Automated Updates Guide](docs/automated-updates.md)

#### Alternative Templates
- **Full automation**: Use [`templates/automated-template-update.md`](templates/automated-template-update.md) for comprehensive workflow
- **Quick copy-paste**: Use [`templates/copy-paste-template.md`](templates/copy-paste-template.md) for simple updates

### Version Information

Expand Down
149 changes: 149 additions & 0 deletions docs/automated-updates.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Automated Template Updates with GitHub Copilot

This guide provides fully automated methods to validate and update your ioBroker Copilot instructions template using GitHub Copilot, ensuring all custom sections are preserved.

## 🚀 Quick Start (Copy-Paste Method)

**Prerequisites**: Ensure GitHub Copilot is active in your repository first. If you haven't set up GitHub Copilot yet, create an issue in your repository with the title "🤖 Setup GitHub Copilot" and content "GitHub Copilot: Please help me set up GitHub Copilot for this repository and create initial .github/copilot-instructions.md file."

The fastest way to update your template:

### Step 1: Create an Issue in Your Repository

1. Go to your ioBroker adapter repository on GitHub
2. Click "Issues" → "New Issue"
3. Use title: **🤖 Update ioBroker Copilot Instructions Template**
4. Copy and paste this content:

```markdown
**GitHub Copilot**: Please help me update my ioBroker Copilot instructions template to the latest version while preserving all custom sections.

## Task
Update `.github/copilot-instructions.md` using this prompt:

```
"Merge the ioBroker template from https://github.com/DrozmotiX/ioBroker-Copilot-Instructions/blob/main/template.md with my existing .github/copilot-instructions.md.

REQUIREMENTS:
1. Preserve ALL [CUSTOMIZE] sections exactly as they are
2. Keep all project-specific context and custom instructions
3. Add latest ioBroker best practices from the new template
4. Update version to match latest template version
5. Maintain Template Source reference

Show me the changes before applying them."
```

## Validation
After update, confirm:
- [ ] All [CUSTOMIZE] sections preserved
- [ ] Version updated to latest
- [ ] Custom content intact
- [ ] Template structure complete

**Reference**: https://github.com/DrozmotiX/ioBroker-Copilot-Instructions
```

### Step 2: Let GitHub Copilot Handle the Update

GitHub Copilot will automatically:
- Analyze your current template
- Fetch the latest template version
- Merge while preserving ALL `[CUSTOMIZE]` sections
- Provide a summary of changes
- Generate the updated file

### Step 3: Review and Apply Changes

Review the proposed changes to ensure:
- All your custom sections are intact
- Version is updated correctly
- New best practices are included
- No project-specific context is lost

## 🔄 Version Check Before Update

Check if your template needs updating:

```bash
curl -s https://raw.githubusercontent.com/DrozmotiX/ioBroker-Copilot-Instructions/main/scripts/check-template-version.sh | bash
```

## 🛠️ Advanced Automated Method

For repositories with existing automation workflows, use the full template:

### Template File Location
Copy from: [`templates/automated-template-update.md`](../templates/automated-template-update.md)

This provides:
- Detailed step-by-step automation
- Comprehensive validation checks
- Progress tracking with checkboxes
- Complete reference information

## 🔍 Custom Section Management

Your custom sections are automatically preserved when using the automation prompts. These include:

### Automatically Preserved Content
- All sections marked with `[CUSTOMIZE]`
- Project-specific adapter context not covered by template
- Custom service integrations and authentication patterns
- Unique error handling specific to your adapter's requirements
- Adapter-specific testing scenarios beyond standard patterns

### Example Custom Section
```markdown
## [CUSTOMIZE] Project-Specific Instructions

### My Adapter Specific Patterns
- Custom authentication flow for [YourService] API
- Adapter-specific device discovery patterns
- Unique error codes and recovery procedures specific to your service

**Note:** This section is preserved during template updates and should contain only content not already covered in the standard template
```

## ✅ Validation Steps

After any automated update, verify:

1. **Version Check**: Compare version number with latest available
2. **Custom Content**: Confirm all `[CUSTOMIZE]` sections are intact
3. **Project Context**: Verify adapter-specific instructions remain
4. **Template Structure**: Ensure all standard sections are present
5. **Functionality**: Test that Copilot provides enhanced suggestions

## 🚨 Troubleshooting

### If Custom Sections Are Lost
Use this recovery prompt:
```
"Restore my custom sections from the previous version of .github/copilot-instructions.md. I need all [CUSTOMIZE] sections and project-specific context to be added back to the current template while keeping the new version and best practices."
```

### If Template Structure Is Incomplete
```
"Please verify my .github/copilot-instructions.md has all required sections from the ioBroker template at https://github.com/DrozmotiX/ioBroker-Copilot-Instructions/blob/main/template.md and add any missing sections while preserving my custom content."
```

## 📋 Success Criteria

A successful automated update includes:
- ✅ Latest template version number
- ✅ All `[CUSTOMIZE]` sections preserved exactly
- ✅ Project-specific context maintained
- ✅ New best practices integrated
- ✅ Template source reference updated
- ✅ Valid markdown structure
- ✅ No loss of custom functionality

---

**Benefits of Automated Updates:**
- 🕒 **Time Saving**: No manual comparison or merging
- 🛡️ **Safe**: Custom content is automatically preserved
- 🎯 **Accurate**: Uses exact merge prompts tested for reliability
- 🔄 **Consistent**: Same process works across all repositories
- 🤖 **Smart**: Leverages GitHub Copilot's understanding of your codebase
74 changes: 61 additions & 13 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,70 @@ This guide walks you through setting up GitHub Copilot for ioBroker adapter deve
ls -la .github/copilot-instructions.md
```

3. **If you don't have a copilot-instructions.md file, let Copilot create one**
- Open any code file in your repository in your preferred editor
- Start typing: `// This is an ioBroker adapter for`
- GitHub Copilot will automatically create basic instructions when you commit changes to `.github/copilot-instructions.md`

4. **If your existing config seems corrupt, start fresh**
3. **Initial template setup**
If you don't have a copilot-instructions.md file yet:

**Option A: Use automated setup** (Recommended)
- **First ensure GitHub Copilot is active**: Create an issue with title "🤖 Setup GitHub Copilot" and content "GitHub Copilot: Please help me set up GitHub Copilot for this repository."
- After Copilot responds and is working, create another issue using the [copy-paste template](../templates/copy-paste-template.md)
- GitHub Copilot will create the complete template for you

**Option B: Manual template download**
```bash
# Remove existing file if needed
rm .github/copilot-instructions.md
# Download the template
curl -o .github/copilot-instructions.md https://raw.githubusercontent.com/DrozmotiX/ioBroker-Copilot-Instructions/main/template.md
# Remove template comment block
sed -i '/^<!--$/,/^-->$/d' .github/copilot-instructions.md
```

**Important**: After initial setup, always add your project-specific content in `[CUSTOMIZE]` sections:
```markdown
## [CUSTOMIZE] Project-Specific Instructions

### My Adapter Specific Patterns
- Custom authentication flow for [YourService] API
- Adapter-specific device discovery patterns
- Unique error codes specific to your service

# Let Copilot create a new one by starting development work
**Note:** This section is preserved during template updates and should contain only content not already covered in the standard template
```

4. **For existing configurations**
If your existing config needs updates, use the automated update process instead of replacing the file

## Template Integration

**Automated template merging** - Always combine with existing instructions, never replace entirely.
**🤖 Fully Automated Updates** - Use GitHub Copilot to handle template updates automatically while preserving all custom sections.

### Option A: Automated Issue-Based Updates (Recommended)

**Best for**: Regular updates and team collaboration

1. **Create an automated update issue**
- Go to your repository's Issues
- Create new issue with title: "🤖 Update ioBroker Copilot Instructions Template"
- Use content from [`templates/copy-paste-template.md`](../templates/copy-paste-template.md)
- GitHub Copilot will automatically handle the merge

2. **Benefits of issue-based automation**
- Creates audit trail of template updates
- Allows team review before applying changes
- Preserves all `[CUSTOMIZE]` sections automatically
- Tracks version history in issues

### Option B: Direct Editor Integration

**Best for**: Quick updates during development

1. **Prompt GitHub Copilot for smart merging**
In your editor, use this prompt:
```
"Merge the ioBroker template from https://github.com/DrozmotiX/ioBroker-Copilot-Instructions/blob/main/template.md
with my existing .github/copilot-instructions.md. Preserve all [CUSTOMIZE] sections and project-specific
context while adding the latest ioBroker best practices. Update the version to the latest available."
```

2. **For comprehensive automation**: Use the full template from [`templates/automated-template-update.md`](../templates/automated-template-update.md)

### Step 1: Prepare for Template Integration

Expand All @@ -76,20 +124,20 @@ This guide walks you through setting up GitHub Copilot for ioBroker adapter deve
```
"Merge the ioBroker template from https://github.com/DrozmotiX/ioBroker-Copilot-Instructions/blob/main/template.md
with my existing .github/copilot-instructions.md. Preserve all [CUSTOMIZE] sections and project-specific
context while adding the latest ioBroker best practices. Update the version to 0.4.0."
context while adding the latest ioBroker best practices. Update the version to the latest available."
```

2. **Verify version tracking**
Ensure your updated file includes:
- Current template version (0.4.0)
- Current template version (latest available)
- Template source reference
- Your custom sections intact
- Project-specific context preserved

3. **Commit with version control**
```bash
git add .github/copilot-instructions.md
git commit -m "Update Copilot instructions to template v0.4.0, preserve custom sections"
git commit -m "Update Copilot instructions to latest template version, preserve custom sections"
```

### Step 3: Custom Section Management
Expand Down
3 changes: 3 additions & 0 deletions templates/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Issue Templates

This directory contains templates that can be used to create automated GitHub issues for template validation and updates.
Loading