Scans source files to detect platform, name, version, element_name, package_type, language, entry_point, description, and license_spdx. Supports Joomla, Dolibarr, Go, MCP/Node, and generic platforms. Includes --diff and --update modes for comparing against and pushing to the Gitea manifest API. Warns on missing core fields. Also removes deprecated mcp/servers/mokowaas_api (consolidated to separate repo) and syncs dev branch changes.
3.4 KiB
Script Templates
This directory contains template scripts for common repository operations including validation, fixes, and release automation.
Directory Structure
validate/- Validation scripts for CI pipelinesfix/- Automated fix scripts for common issuesrelease/- Release automation scriptslib/- Shared library functions
Validation Scripts
validate/tabs.sh
Validates that no literal tab characters exist in source files.
validate/paths.sh
Validates that path separators use forward slashes.
validate/changelog.sh
Validates CHANGELOG.md structure and format.
validate/xml_wellformed.sh
Validates XML files are well-formed.
validate/license_headers.sh
Validates license headers in source files.
validate/no_secrets.sh
Checks for potential secrets in committed files.
validate/php_syntax.sh
Validates PHP syntax (Joomla projects).
validate/version_alignment.sh
Validates version alignment across manifest files.
validate/manifest.sh
Validates Joomla manifest structure (Joomla projects).
validate/language_structure.sh
Validates language file structure (Joomla projects).
Fix Scripts
fix/line_endings.sh
Fixes line endings to LF.
fix/permissions.sh
Fixes file permissions (644 for files, 755 for directories and scripts).
Release Scripts
release/package.sh
Creates release package with proper structure.
Library Scripts
lib/common.sh
Common utility functions for scripts including logging, command checks, and git utilities.
Usage
In CI Workflows
Add validation scripts to your CI workflow:
- name: Required validations
run: |
set -e
scripts/validate/manifest.sh
scripts/validate/xml_wellformed.sh
Manual Execution
Make scripts executable and run:
chmod +x scripts/validate/*.sh
./scripts/validate/tabs.sh
With Library Functions
Source the common library in your scripts:
#!/usr/bin/env bash
source "$(dirname "$0")/../lib/common.sh"
log_info "Starting validation..."
require_command "xmllint"
Customization
These are template scripts. Adapt them to your project's specific needs:
- Copy relevant scripts to your project's
scripts/directory - Modify validation rules to match your standards
- Update file patterns and paths as needed
- Add project-specific validation logic
Standards Compliance
All scripts follow mokoplatform requirements:
- SPDX license headers
- GPL-3.0-or-later license
- Proper error handling with
set -euo pipefail - Informative logging output
- Exit code conventions (0 = success, 1 = failure)
Integration with repo_health.yml
The repo_health.yml workflow enforces script governance:
- Allowed directories:
scripts/,scripts/validate/,scripts/fix/,scripts/release/,scripts/lib/ - ShellCheck validation (advisory)
- Script structure validation
Notes
- Scripts in
validate/should exit with code 1 on failure - Scripts in
fix/should be idempotent - Scripts in
release/should be safe to run multiple times - Always test scripts locally before committing