Improve /scripts/* with libraries, testing tools, and documentation #13

Merged
Copilot merged 5 commits from copilot/improve-scripts-directory into main 2026-01-03 21:46:00 +00:00
3 changed files with 54 additions and 19 deletions
Showing only changes of commit 62f5325338 - Show all commits

View File

@@ -225,10 +225,12 @@ Runs all validation scripts and provides a comprehensive report:
- Executes all optional validation checks - Executes all optional validation checks
- Provides colored output with pass/fail indicators - Provides colored output with pass/fail indicators
- Returns summary with counts - Returns summary with counts
- Supports verbose mode for detailed output
Usage: Usage:
```bash ```bash
./scripts/run/validate_all.sh ./scripts/run/validate_all.sh # Standard mode
./scripts/run/validate_all.sh -v # Verbose mode (shows all output)
``` ```
Example output: Example output:
@@ -243,7 +245,7 @@ INFO: Running all validation checks...
=== Optional Checks === === Optional Checks ===
[SUCCESS] ✓ no_secrets [SUCCESS] ✓ no_secrets
[SUCCESS] ✓ php_syntax [SUCCESS] ✓ php_syntax
WARN: ✗ tabs (warnings/issues found) WARN: ✗ tabs (warnings/issues found - run with -v for details)
=== Validation Summary === === Validation Summary ===
Required checks passed: 2/2 Required checks passed: 2/2

View File

@@ -132,13 +132,19 @@ fi
# Update README.md version references # Update README.md version references
if [ -f "README.md" ]; then if [ -f "README.md" ]; then
# Look for version references in format VERSION: XX.XX.XX # Look for version references in format VERSION: XX.XX.XX
if grep -q 'VERSION: [0-9]' README.md; then if grep -q 'VERSION: [0-9]' README.md; then
# Convert to zero-padded format if needed # Validate version format has 3 components
PADDED_VERSION="$(printf '%s' "${VERSION}" | awk -F. '{printf "%02d.%02d.%02d", $1, $2, $3}')" component_count=$(echo "${VERSION}" | awk -F. '{print NF}')
sed_inplace "s|VERSION: [0-9]{2}\.[0-9]{2}\.[0-9]{2}|VERSION: ${PADDED_VERSION}|g" README.md if [ "${component_count}" -eq 3 ]; then
log_info "✓ Updated README.md version references" # Convert to zero-padded format
fi PADDED_VERSION="$(printf '%s' "${VERSION}" | awk -F. '{printf "%02d.%02d.%02d", $1, $2, $3}')"
sed_inplace "s|VERSION: [0-9]{2}\.[0-9]{2}\.[0-9]{2}|VERSION: ${PADDED_VERSION}|g" README.md
log_info "✓ Updated README.md version references"
else
log_warn "Version format invalid for padding, skipping README.md update"
fi
fi
fi fi
log_info "=========================================" log_info "========================================="

View File

@@ -43,6 +43,13 @@ SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
# Configuration # Configuration
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
VERBOSE="${1:-}"
if [ "${VERBOSE}" = "-v" ] || [ "${VERBOSE}" = "--verbose" ]; then
VERBOSE="true"
else
VERBOSE="false"
fi
REQUIRED_CHECKS=( REQUIRED_CHECKS=(
"manifest" "manifest"
"xml_wellformed" "xml_wellformed"
@@ -83,12 +90,22 @@ for check in "${REQUIRED_CHECKS[@]}"; do
fi fi
log_step "Running: ${check}" log_step "Running: ${check}"
if "${script}" >/dev/null 2>&1; then if [ "${VERBOSE}" = "true" ]; then
log_success "${check}" if "${script}"; then
required_passed=$((required_passed + 1)) log_success "${check}"
required_passed=$((required_passed + 1))
else
log_error "${check} (FAILED)"
required_failed=$((required_failed + 1))
fi
else else
log_error "${check} (FAILED)" if "${script}" >/dev/null 2>&1; then
required_failed=$((required_failed + 1)) log_success "${check}"
required_passed=$((required_passed + 1))
else
log_error "${check} (FAILED - run with -v for details)"
required_failed=$((required_failed + 1))
fi
fi fi
done done
@@ -104,12 +121,22 @@ for check in "${OPTIONAL_CHECKS[@]}"; do
fi fi
log_step "Running: ${check}" log_step "Running: ${check}"
if "${script}" >/dev/null 2>&1; then if [ "${VERBOSE}" = "true" ]; then
log_success "${check}" if "${script}"; then
optional_passed=$((optional_passed + 1)) log_success "${check}"
optional_passed=$((optional_passed + 1))
else
log_warn "${check} (warnings/issues found)"
optional_failed=$((optional_failed + 1))
fi
else else
log_warn "${check} (warnings/issues found)" if "${script}" >/dev/null 2>&1; then
optional_failed=$((optional_failed + 1)) log_success "${check}"
optional_passed=$((optional_passed + 1))
else
log_warn "${check} (warnings/issues found - run with -v for details)"
optional_failed=$((optional_failed + 1))
fi
fi fi
done done