Skip to content

Implement centralized metadata system and eliminate content duplication#34

Merged
DutchmanNL merged 5 commits intomainfrom
copilot/fix-32
Sep 19, 2025
Merged

Implement centralized metadata system and eliminate content duplication#34
DutchmanNL merged 5 commits intomainfrom
copilot/fix-32

Conversation

Copy link
Contributor

Copilot AI commented Sep 19, 2025

  • Analyzed repository structure and identified duplication issues
  • Found version management and setup information duplicated across multiple files
  • Confirmed existing dynamic version management system works (0.4.0 consistently applied)
  • Identified specific areas for cleanup and centralization
  • Created centralized metadata system with config/metadata.json as single source of truth
  • Implemented shared utility functions in scripts/shared-utils.sh for accessing metadata
  • Created reusable snippet system with standardized content in snippets/ directory
  • Updated all scripts to use centralized metadata (extract-version.sh, manage-versions.sh, check-template-version.sh)
  • Cleaned up duplicated content across documentation files (maintenance.md, testing.md, automated-updates.md, templates)
  • Replaced duplicated content with snippet references for better maintainability
  • Added comprehensive test suite (test-centralized-metadata.sh) for the new system
  • Created GitHub Action (validate-consistency.yml) for automated validation
  • Updated version management to maintain consistency across all files including metadata
  • Addressed feedback: Moved manual version check commands to advanced users section in README
  • Enhanced error handling: Removed hardcoded fallback versions and improved error reporting in shared utilities
  • Fixed test suite: Corrected parameter ordering in test functions

Duplication Reduction Results

Before:

  • Version check curl command duplicated in 6+ files
  • GitHub Action YAML duplicated in 3+ files
  • Version management instructions repeated across docs
  • Manual updates required in multiple locations

After:

  • Centralized metadata (config/metadata.json) as single source of truth
  • Reusable snippets for commonly duplicated content
  • Automated validation of version consistency
  • 9 snippet references replacing duplicated content
  • Dynamic version management with metadata integration
  • Proper error handling without hardcoded fallbacks
  • User-friendly organization with advanced features in dedicated section

New Centralized Structure

Configuration:

  • config/metadata.json - Repository metadata and settings
  • config/README.md - Documentation for centralized system

Reusable Snippets:

  • snippets/version-check-command.md - Standardized version check command
  • snippets/github-action-version-check.yml - Complete GitHub Action template
  • snippets/version-management-commands.md - Version management documentation

Enhanced Scripts:

  • scripts/shared-utils.sh - Utility functions with robust error handling (no hardcoded fallbacks)
  • Updated all existing scripts to use centralized metadata
  • Version consistency validation and GitHub Action automation

Testing & Validation:

  • Comprehensive test suite for centralized system (all 43+ tests passing)
  • GitHub Action for automated consistency checking
  • Fixed test function parameter ordering and improved reliability

User Experience Improvements:

  • Manual/advanced commands moved to dedicated "Advanced Usage" section
  • Regular users guided to automated solutions first
  • Clear separation between basic automation and advanced manual operations

The repository now follows DRY principles with centralized configuration management, proper error handling without hardcoded fallbacks, and user-friendly organization that prioritizes automation while providing advanced options for power users.

Fixes #32.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
Copilot AI changed the title [WIP] cleanup duplication in instruction for setup, update and or maintenance Implement centralized metadata system and eliminate content duplication Sep 19, 2025
Copilot AI requested a review from DutchmanNL September 19, 2025 01:50
@DutchmanNL DutchmanNL marked this pull request as ready for review September 19, 2025 01:52
Copilot AI review requested due to automatic review settings September 19, 2025 01:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a comprehensive centralized metadata system to eliminate content duplication across the repository. The solution introduces a single source of truth for repository metadata and reusable content snippets, replacing scattered duplicate information with centralized configuration.

Key changes:

  • Created centralized config/metadata.json for all repository metadata and configuration
  • Implemented reusable snippet system in snippets/ directory for commonly duplicated content
  • Enhanced existing scripts to use centralized metadata with fallback capabilities
  • Added comprehensive testing and validation infrastructure

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/test-centralized-metadata.sh Comprehensive test suite for centralized metadata system and shared utilities
templates/initial-setup-automation.md Updated to reference centralized snippets instead of duplicated content
templates/automated-template-update.md Replaced duplicated version check command with snippet reference
snippets/version-management-commands.md New reusable snippet for version management script documentation
snippets/version-check-command.md New centralized version check command snippet
snippets/github-action-version-check.yml Complete GitHub Action template for automated version monitoring
scripts/shared-utils.sh New utility functions for accessing centralized metadata
scripts/manage-versions.sh Enhanced with metadata integration and centralized version updates
scripts/extract-version.sh Added metadata support with fallback capabilities
scripts/check-template-version.sh Updated to use centralized metadata for dynamic URL generation
docs/testing.md Replaced duplicated GitHub Action YAML with snippet reference
docs/maintenance.md Updated to reference centralized snippets and removed duplicated content
docs/automated-updates.md Enhanced with centralized snippet references
config/metadata.json New centralized repository metadata and configuration file
config/README.md Documentation for the centralized configuration system
README.md Enhanced with centralized snippet content
.github/workflows/validate-consistency.yml New GitHub Action for automated consistency validation
Comments suppressed due to low confidence (1)

tests/test-centralized-metadata.sh:1

  • Line 136 contains leftover content from documentation files that shouldn't be in this test script. This appears to be from a GitHub Action template and doesn't belong in the test output.
#!/bin/bash

Comment on lines +20 to +21
".version")
grep '"version"' "$METADATA_FILE" 2>/dev/null | sed 's/.*"version": *"//;s/".*//' || echo "0.4.0"
Copy link

Copilot AI Sep 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded fallback version '0.4.0' creates a maintenance burden. Consider extracting this to a variable or using a more dynamic approach to determine the fallback version.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot try to avoid a fixed version and trowh an error/failing if automation fails

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the hardcoded "0.4.0" fallback and improved error handling. The shared utility functions now properly fail with descriptive error messages when automation fails, rather than falling back to fixed versions. This ensures issues are caught early rather than being masked. Commit: 9a667c5

DutchmanNL and others added 2 commits September 19, 2025 03:54
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using the script is for advanced users, move to that section. regular and best practise should stick to the automation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the manual version check script to the new "Advanced Usage" section in the README. Regular users are now guided to use the automated processes first, with manual commands available for advanced users who need more control. Commit: 9a667c5

Comment on lines +20 to +21
".version")
grep '"version"' "$METADATA_FILE" 2>/dev/null | sed 's/.*"version": *"//;s/".*//' || echo "0.4.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot try to avoid a fixed version and trowh an error/failing if automation fails

…e error handling

Co-authored-by: DutchmanNL <7318445+DutchmanNL@users.noreply.github.com>
Copilot AI requested a review from DutchmanNL September 19, 2025 02:05
@DutchmanNL DutchmanNL merged commit 2b79910 into main Sep 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cleanup duplication in instruction for setup, update and or maintenance

3 participants