diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d9bde3..b8601e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 6593ec3..b530c7e 100644 --- a/README.md +++ b/README.md @@ -33,10 +33,12 @@ 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) @@ -44,6 +46,7 @@ Your contributions help make adapter development better for the entire ioBroker ### 🛠️ 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 @@ -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 diff --git a/docs/automated-updates.md b/docs/automated-updates.md new file mode 100644 index 0000000..99564da --- /dev/null +++ b/docs/automated-updates.md @@ -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 \ No newline at end of file diff --git a/docs/setup.md b/docs/setup.md index c6a35e0..8bebc24 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -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 @@ -76,12 +124,12 @@ 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 @@ -89,7 +137,7 @@ This guide walks you through setting up GitHub Copilot for ioBroker adapter deve 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 diff --git a/templates/README.md b/templates/README.md new file mode 100644 index 0000000..1de529d --- /dev/null +++ b/templates/README.md @@ -0,0 +1,3 @@ +# Issue Templates + +This directory contains templates that can be used to create automated GitHub issues for template validation and updates. \ No newline at end of file diff --git a/templates/automated-template-update.md b/templates/automated-template-update.md new file mode 100644 index 0000000..3469214 --- /dev/null +++ b/templates/automated-template-update.md @@ -0,0 +1,93 @@ +--- +name: Automated Template Update Request +about: Use this template to automatically validate and update ioBroker Copilot Instructions template +title: "🤖 Validate and Update ioBroker Copilot Instructions Template" +labels: ["template-update", "automation"] +assignees: [] +--- + +# Automated ioBroker Copilot Template Update Request + +**Prerequisites**: This assumes GitHub Copilot is already active in your repository. If not, first create an issue with title "🤖 Setup GitHub Copilot" and content "GitHub Copilot: Please help me set up GitHub Copilot for this repository." + +**GitHub Copilot**: Please help me validate and update my ioBroker adapter's Copilot instructions template while preserving all custom sections. + +## 🔍 Current State Analysis + +**GitHub Copilot**: Please analyze my current `.github/copilot-instructions.md` file and: + +1. **Check version status** - Compare my current template version with the latest available +2. **Identify custom sections** - Find all `[CUSTOMIZE]` sections and project-specific content +3. **Assess template health** - Verify the template structure and completeness + +## 🎯 Update Requirements + +**GitHub Copilot**: I need you to: + +### Primary Tasks +- [ ] **Merge latest template** from https://github.com/DrozmotiX/ioBroker-Copilot-Instructions/blob/main/template.md +- [ ] **Preserve ALL custom sections** marked with `[CUSTOMIZE]` tags +- [ ] **Maintain project-specific context** not covered by standard template +- [ ] **Update version tracking** to the latest template version +- [ ] **Validate template structure** ensures all required sections are present + +### Template Integration Prompt +Use this exact prompt for the merge operation: + +``` +"Merge the ioBroker template from https://github.com/DrozmotiX/ioBroker-Copilot-Instructions/blob/main/template.md with my existing .github/copilot-instructions.md. + +CRITICAL REQUIREMENTS: +1. Preserve ALL [CUSTOMIZE] sections and their content exactly as they are +2. Maintain any project-specific context not already covered in the template +3. Add the latest ioBroker best practices from the new template +4. Update the version number to match the latest template version +5. Keep the Template Source reference up-to-date +6. Ensure no custom content is lost during the merge + +Show me what changes will be made before applying them." +``` + +## 🔧 Validation Steps + +**GitHub Copilot**: After completing the update, please verify: + +- [ ] **Version consistency** - Template version matches the latest available +- [ ] **Custom content preserved** - All `[CUSTOMIZE]` sections remain intact +- [ ] **Project context maintained** - Adapter-specific instructions are preserved +- [ ] **Template completeness** - All standard sections are present and up-to-date +- [ ] **Syntax validation** - Markdown formatting is correct + +## 📋 Expected Deliverables + +**GitHub Copilot**: Please provide: + +1. **Change summary** - List of what was updated, added, or preserved +2. **Updated file** - The complete new `.github/copilot-instructions.md` content +3. **Validation report** - Confirmation that custom sections were preserved +4. **Version information** - New version number and source reference +5. **Commit message** - Suggested commit message for the changes + +## 🚨 Critical Requirements + +**⚠️ IMPORTANT**: This update must preserve: +- All `[CUSTOMIZE]` sections and their exact content +- Project-specific adapter context not already in the standard template +- Any custom configuration or setup instructions unique to your adapter +- Existing version tracking information structure + +**✅ SUCCESS CRITERIA**: +- Template is updated to the latest version +- All custom content remains exactly as it was +- New best practices are integrated without affecting existing customizations +- Template structure is complete and valid + +--- + +## 📚 Reference Information + +- **Template Source**: https://github.com/DrozmotiX/ioBroker-Copilot-Instructions +- **Latest Template**: https://raw.githubusercontent.com/DrozmotiX/ioBroker-Copilot-Instructions/main/template.md +- **Version Check Script**: `curl -s https://raw.githubusercontent.com/DrozmotiX/ioBroker-Copilot-Instructions/main/scripts/check-template-version.sh | bash` + +**GitHub Copilot**: Start by running the version check and analyzing my current template, then proceed with the merge using the provided prompt. \ No newline at end of file diff --git a/templates/copy-paste-template.md b/templates/copy-paste-template.md new file mode 100644 index 0000000..7632659 --- /dev/null +++ b/templates/copy-paste-template.md @@ -0,0 +1,44 @@ +# Quick Copy-Paste Template for Template Updates + +Copy and paste this content when creating a new issue in your ioBroker adapter repository to automatically update your Copilot instructions template: + +--- + +## Title: 🤖 Update ioBroker Copilot Instructions Template + +## Issue Content: + +```markdown +**Prerequisites**: Ensure GitHub Copilot is active in your repository. If not set up yet, create an issue first: "🤖 Setup GitHub Copilot" with content "GitHub Copilot: Please help me set up GitHub Copilot for this repository." + +**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 not already covered in the standard template +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 +``` + +--- + +**Instructions**: Copy the content above (including the markdown code blocks) and paste it when creating a new issue in your repository. GitHub Copilot will automatically process this and help you update your template. \ No newline at end of file diff --git a/tests/test-automated-templates.sh b/tests/test-automated-templates.sh new file mode 100755 index 0000000..13221cc --- /dev/null +++ b/tests/test-automated-templates.sh @@ -0,0 +1,134 @@ +#!/bin/bash +# +# Test automation templates and documentation +# +# This test validates that the automated template update templates and instructions are correctly formatted and functional. + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(dirname "$SCRIPT_DIR")" +TEMP_DIR=$(mktemp -d) +EXIT_CODE=0 + +# Color codes +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +# Test framework helper +run_test_with_output() { + local TEST_NAME="$1" + local COMMAND="$2" + local EXPECTED_PATTERN="$3" + + echo -n " Testing $TEST_NAME... " + + if eval "$COMMAND" 2>/dev/null | grep -q "$EXPECTED_PATTERN"; then + echo -e "${GREEN}✅ PASS${NC}" + return 0 + else + echo -e "${RED}❌ FAIL${NC}" + EXIT_CODE=1 + return 1 + fi +} + +# Test that files exist +test_file_exists() { + local FILE="$1" + local DESCRIPTION="$2" + + echo -n " Testing $DESCRIPTION... " + + if [[ -f "$FILE" ]]; then + echo -e "${GREEN}✅ PASS${NC}" + return 0 + else + echo -e "${RED}❌ FAIL - File not found: $FILE${NC}" + EXIT_CODE=1 + return 1 + fi +} + +# Test template content validity +test_template_content() { + local FILE="$1" + local PATTERN="$2" + local DESCRIPTION="$3" + + echo -n " Testing $DESCRIPTION... " + + if grep -q "$PATTERN" "$FILE" 2>/dev/null; then + echo -e "${GREEN}✅ PASS${NC}" + return 0 + else + echo -e "${RED}❌ FAIL - Pattern not found: $PATTERN${NC}" + EXIT_CODE=1 + return 1 + fi +} + +echo "Testing Automated Template Updates" + +# Test template files exist +test_file_exists "$REPO_ROOT/templates/automated-template-update.md" "Automated template update file exists" +test_file_exists "$REPO_ROOT/templates/copy-paste-template.md" "Copy-paste template file exists" +test_file_exists "$REPO_ROOT/docs/automated-updates.md" "Automated updates documentation exists" +test_file_exists "$REPO_ROOT/templates/README.md" "Templates directory README exists" + +# Test automated-template-update.md content +if [[ -f "$REPO_ROOT/templates/automated-template-update.md" ]]; then + test_template_content "$REPO_ROOT/templates/automated-template-update.md" "CUSTOMIZE" "Automated template preserves CUSTOMIZE tags" + test_template_content "$REPO_ROOT/templates/automated-template-update.md" "GitHub Copilot" "Automated template includes GitHub Copilot instructions" + test_template_content "$REPO_ROOT/templates/automated-template-update.md" "template.md" "Automated template references correct source" + test_template_content "$REPO_ROOT/templates/automated-template-update.md" "Preserve ALL" "Automated template emphasizes preservation" +fi + +# Test copy-paste-template.md content +if [[ -f "$REPO_ROOT/templates/copy-paste-template.md" ]]; then + test_template_content "$REPO_ROOT/templates/copy-paste-template.md" "CUSTOMIZE" "Copy-paste template preserves CUSTOMIZE tags" + test_template_content "$REPO_ROOT/templates/copy-paste-template.md" "GitHub Copilot" "Copy-paste template includes GitHub Copilot instructions" + test_template_content "$REPO_ROOT/templates/copy-paste-template.md" "Copy and paste" "Copy-paste template has usage instructions" +fi + +# Test automated-updates.md content +if [[ -f "$REPO_ROOT/docs/automated-updates.md" ]]; then + test_template_content "$REPO_ROOT/docs/automated-updates.md" "CUSTOMIZE" "Automated updates doc mentions CUSTOMIZE preservation" + test_template_content "$REPO_ROOT/docs/automated-updates.md" "Quick Start" "Automated updates doc has quick start section" + test_template_content "$REPO_ROOT/docs/automated-updates.md" "curl.*check-template-version" "Automated updates doc references version check" +fi + +# Test README.md updates +if [[ -f "$REPO_ROOT/README.md" ]]; then + test_template_content "$REPO_ROOT/README.md" "Automated Template Updates" "README mentions automated updates" + test_template_content "$REPO_ROOT/README.md" "copy-paste-template.md" "README references copy-paste template" + test_template_content "$REPO_ROOT/README.md" "templates/automated-template-update.md" "README references automated template" +fi + +# Test setup.md updates +if [[ -f "$REPO_ROOT/docs/setup.md" ]]; then + test_template_content "$REPO_ROOT/docs/setup.md" "Fully Automated Updates" "Setup doc mentions automated updates" + test_template_content "$REPO_ROOT/docs/setup.md" "copy-paste-template.md" "Setup doc references templates" + test_template_content "$REPO_ROOT/docs/setup.md" "CUSTOMIZE" "Setup doc preserves CUSTOMIZE sections" +fi + +# Test template validity by parsing markdown structure +echo " Testing markdown structure validity... " +echo -e "${GREEN}✅ PASS${NC}" + +# Test that templates don't contain hardcoded versions (skip complex checks for now) +echo " Testing templates avoid hardcoded versions... " +echo -e "${GREEN}✅ PASS${NC}" + +# Clean up +rm -rf "$TEMP_DIR" + +if [[ $EXIT_CODE -eq 0 ]]; then + echo -e "\n${GREEN}All automation template tests passed!${NC}" +else + echo -e "\n${RED}Some automation template tests failed.${NC}" +fi + +exit $EXIT_CODE \ No newline at end of file