Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@ Your contributions help make adapter development better for the entire ioBroker

## 📋 Quick Start

> **New to GitHub Copilot?** Start with the [detailed setup guide](docs/setup.md) to get GitHub Copilot working in your repository first.

**For experienced Copilot users:**

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
Expand Down
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "iobroker-copilot-instructions",
"version": "0.4.0",
"description": "GitHub Copilot instructions template for ioBroker adapter development",
"keywords": [
"iobroker",
"github-copilot",
"adapter-development",
"template",
"instructions"
],
"homepage": "https://github.com/DrozmotiX/ioBroker-Copilot-Instructions#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/DrozmotiX/ioBroker-Copilot-Instructions.git"
},
"bugs": {
"url": "https://github.com/DrozmotiX/ioBroker-Copilot-Instructions/issues"
},
"license": "MIT",
"author": "DutchmanNL <rdrozda86@gmail.com>",
"private": true,
"scripts": {
"test": "./tests/test-runner.sh",
"check-version": "./scripts/check-template-version.sh",
"manage-version": "./scripts/manage-versions.sh"
}
}
28 changes: 28 additions & 0 deletions scripts/manage-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ REPO_ROOT="$(dirname "$SCRIPT_DIR")"
TEMPLATE_FILE="$REPO_ROOT/template.md"
README_FILE="$REPO_ROOT/README.md"
CHANGELOG_FILE="$REPO_ROOT/CHANGELOG.md"
PACKAGE_FILE="$REPO_ROOT/package.json"
COPILOT_INSTRUCTIONS="$REPO_ROOT/.github/copilot-instructions.md"
EXTRACT_SCRIPT="$SCRIPT_DIR/extract-version.sh"
UPDATE_SCRIPT="$SCRIPT_DIR/update-versions.sh"
Expand Down Expand Up @@ -51,6 +52,13 @@ show_versions() {
echo "📖 README documented version: $README_VER"
fi

if [[ -f "$PACKAGE_FILE" ]]; then
PACKAGE_VER=$(grep '"version":' "$PACKAGE_FILE" | head -1 | sed 's/.*"version": *"//;s/",\?.*$//' | tr -d ' ')
echo "📦 Package.json version: $PACKAGE_VER"
else
echo -e "${YELLOW}⚠️ Package.json not found${NC}"
fi

echo "📅 Current date: $($EXTRACT_SCRIPT current-date)"
}

Expand All @@ -62,6 +70,10 @@ check_consistency() {
TEMPLATE_VER=$(grep "^**Version:**" "$TEMPLATE_FILE" | head -1 | sed 's/.*Version:\*\* *//' | tr -d ' ')
README_VER=$(grep "Latest Version:" "$README_FILE" | head -1 | sed 's/.*Latest Version:\*\* v*//' | tr -d ' ')

if [[ -f "$PACKAGE_FILE" ]]; then
PACKAGE_VER=$(grep '"version":' "$PACKAGE_FILE" | head -1 | sed 's/.*"version": *"//;s/",\?.*$//' | tr -d ' ')
fi

INCONSISTENT=false

if [[ "$TEMPLATE_VER" != "$README_VER" ]]; then
Expand All @@ -71,6 +83,16 @@ check_consistency() {
echo -e "${GREEN}✅ Template and README versions match ($TEMPLATE_VER)${NC}"
fi

# Check package.json version consistency
if [[ -f "$PACKAGE_FILE" && -n "$PACKAGE_VER" ]]; then
if [[ "$TEMPLATE_VER" != "$PACKAGE_VER" ]]; then
echo -e "${RED}❌ Version mismatch: Template ($TEMPLATE_VER) vs Package.json ($PACKAGE_VER)${NC}"
INCONSISTENT=true
else
echo -e "${GREEN}✅ Template and package.json versions match ($TEMPLATE_VER)${NC}"
fi
fi

# Check if dates are current
CURRENT_DATE=$($EXTRACT_SCRIPT current-date)
README_DATE=$(grep "Last Updated:" "$README_FILE" | head -1 | sed 's/.*Last Updated:\*\* *//')
Expand Down Expand Up @@ -135,6 +157,12 @@ update_version() {
echo "✅ Updated .github/copilot-instructions.md"
fi

# Update package.json
if [[ -f "$PACKAGE_FILE" ]]; then
sed -i "s/\"version\": \"[0-9\.]*\"/\"version\": \"$NEW_VERSION\"/" "$PACKAGE_FILE"
echo "✅ Updated package.json"
fi

# Sync documentation
sync_documentation

Expand Down
36 changes: 36 additions & 0 deletions tests/test-manage-versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,42 @@ run_test_with_output \
"Version mismatch" \
1

# Test package.json versioning functionality
run_test_with_output \
"Show command displays package.json version" \
"$TEST_DIR/scripts/manage-versions.sh show" \
"📦 Package.json version"

# Test package.json consistency checking
create_package_inconsistency() {
# Create inconsistency by modifying package.json version
if [[ -f "$TEST_DIR/package.json" ]]; then
sed -i 's/"version": "[^"]*"/"version": "9.8.7"/' "$TEST_DIR/package.json"
fi
}

run_test \
"Create package.json inconsistency for testing" \
"$(declare -f create_package_inconsistency); create_package_inconsistency"

run_test_with_output \
"Check command detects package.json inconsistency" \
"$TEST_DIR/scripts/manage-versions.sh check" \
"Template.*vs.*Package.json" \
1

# Test package.json is updated during version update
run_test_with_output \
"Update command updates package.json version" \
"cd '$TEST_DIR' && ./scripts/manage-versions.sh update 0.8.8" \
"✅ Updated package.json"

# Verify package.json version was actually changed
run_test_with_output \
"Package.json version was actually updated" \
"grep '\"version\":' '$TEST_DIR/package.json'" \
"0.8.8"

# Test script dependencies exist
dependencies=("extract-version.sh" "update-versions.sh")
for dep in "${dependencies[@]}"; do
Expand Down