Files
mokoplatform/templates/scripts/README.md
Jonathan Miller b73c1eba25
Generic: Repo Health / Scripts governance (push) Has been cancelled
Generic: Repo Health / Repository health (push) Has been cancelled
Generic: Repo Health / Report Issues (push) Has been cancelled
Generic: Project CI / Tests (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 2: Unit Tests (8.1) (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 2: Unit Tests (8.2) (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 2: Unit Tests (8.3) (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 3: Self-Health Check (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 4: Governance (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 5: Template Integrity (pull_request) Has been cancelled
Platform: mokoplatform CI / CI Summary (pull_request) Has been cancelled
Universal: PR Check / Build RC Package (pull_request) Has been cancelled
Universal: PR Check / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Scripts governance (pull_request) Has been cancelled
Generic: Repo Health / Repository health (pull_request) Has been cancelled
Generic: Repo Health / Report Issues (pull_request) Has been cancelled
Generic: Repo Health / Site Health (push) Has been cancelled
Generic: Repo Health / Access control (push) Has been cancelled
Generic: Repo Health / Site Health (pull_request) Has been cancelled
Universal: PR Check / Branch Policy (pull_request) Has been cancelled
Generic: Repo Health / Access control (pull_request) Has been cancelled
Universal: Build & Release / Promote to RC (pull_request) Has been cancelled
RC Revert / Rename rc/ back to dev/ (pull_request) Has been cancelled
Universal: Security Audit / Dependency Audit (pull_request) Has been cancelled
Branch Cleanup / Delete merged branch (pull_request) Has been cancelled
Universal: Secret Scanning / Gitleaks Secret Scan (pull_request) Has been cancelled
Universal: PR Check / Validate PR (pull_request) Has been cancelled
Universal: Build & Release / Build & Release Pipeline (pull_request) Has been cancelled
Generic: Project CI / Lint & Validate (pull_request) Has been cancelled
Platform: mokoplatform CI / Gate 1: Code Quality (pull_request) Has been cancelled
feat: add manifest_detect.php CLI tool for auto-detecting manifest fields
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.
2026-06-07 15:37:24 -05:00

141 lines
3.4 KiB
Markdown

<!--
Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
SPDX-License-Identifier: GPL-3.0-or-later
FILE INFORMATION
DEFGROUP: MokoPlatform.Index
INGROUP: MokoPlatform.Templates.Scripts
REPO: https://git.mokoconsulting.tech/MokoConsulting/mokoplatform
PATH: /templates/scripts/README.md
BRIEF: Script templates README
-->
# Script Templates
This directory contains template scripts for common repository operations including validation, fixes, and release automation.
## Directory Structure
- `validate/` - Validation scripts for CI pipelines
- `fix/` - Automated fix scripts for common issues
- `release/` - Release automation scripts
- `lib/` - 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:
```yaml
- name: Required validations
run: |
set -e
scripts/validate/manifest.sh
scripts/validate/xml_wellformed.sh
```
### Manual Execution
Make scripts executable and run:
```bash
chmod +x scripts/validate/*.sh
./scripts/validate/tabs.sh
```
### With Library Functions
Source the common library in your scripts:
```bash
#!/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:
1. Copy relevant scripts to your project's `scripts/` directory
2. Modify validation rules to match your standards
3. Update file patterns and paths as needed
4. 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