feat: rename rails/ to tools/ and add service tool suites
Rename the `rails/` directory to `tools/` for agent discoverability — agents frequently failed to locate helper scripts due to the non-intuitive directory name. Add backward-compat symlink `rails/ → tools/`. New tool suites: - Authentik: auth-token, user-list, user-create, group-list, app-list, flow-list, admin-status (8 scripts) - Coolify: team-list, project-list, service-list, service-status, deploy, env-set (7 scripts) - Woodpecker: pipeline-list, pipeline-status, pipeline-trigger (3 stubs) - GLPI: session-init, computer-list, ticket-list, ticket-create, user-list (6 scripts) - Health: stack-health.sh — stack-wide connectivity check Infrastructure: - Shared credential loader at tools/_lib/credentials.sh - install.sh creates symlink + chmod on tool scripts - All ~253 rails/ path references updated across 68+ files Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
53
tools/quality/scripts/install.ps1
Normal file
53
tools/quality/scripts/install.ps1
Normal file
@@ -0,0 +1,53 @@
|
||||
# Quality Rails Installation Script (Windows)
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$Template,
|
||||
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string]$TargetDir = "."
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$RepoRoot = Split-Path -Parent $ScriptDir
|
||||
$TemplateDir = Join-Path $RepoRoot "templates\$Template"
|
||||
|
||||
if (-not (Test-Path $TemplateDir)) {
|
||||
Write-Error "Template '$Template' not found at $TemplateDir"
|
||||
Write-Host "Available templates: typescript-node, typescript-nextjs, python, monorepo"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Write-Host "Installing Quality Rails: $Template"
|
||||
Write-Host "Target directory: $TargetDir"
|
||||
Write-Host ""
|
||||
|
||||
# Copy template files
|
||||
Write-Host "Copying template files..."
|
||||
if (Test-Path "$TemplateDir\.husky") {
|
||||
Copy-Item -Path "$TemplateDir\.husky" -Destination $TargetDir -Recurse -Force
|
||||
}
|
||||
Copy-Item -Path "$TemplateDir\.lintstagedrc.js" -Destination $TargetDir -Force -ErrorAction SilentlyContinue
|
||||
Copy-Item -Path "$TemplateDir\.eslintrc.strict.js" -Destination "$TargetDir\.eslintrc.js" -Force -ErrorAction SilentlyContinue
|
||||
Copy-Item -Path "$TemplateDir\tsconfig.strict.json" -Destination "$TargetDir\tsconfig.json" -Force -ErrorAction SilentlyContinue
|
||||
Copy-Item -Path "$TemplateDir\.woodpecker.yml" -Destination $TargetDir -Force -ErrorAction SilentlyContinue
|
||||
|
||||
Write-Host "✓ Files copied"
|
||||
|
||||
if (Test-Path "$TargetDir\package.json") {
|
||||
Write-Host ""
|
||||
Write-Host "⚠ package.json exists. Please manually merge dependencies from:"
|
||||
Write-Host " $TemplateDir\package.json.snippet"
|
||||
} else {
|
||||
Write-Host "⚠ No package.json found. Create one and add dependencies from:"
|
||||
Write-Host " $TemplateDir\package.json.snippet"
|
||||
}
|
||||
|
||||
Write-Host ""
|
||||
Write-Host "✓ Quality Rails installed successfully!"
|
||||
Write-Host ""
|
||||
Write-Host "Next steps:"
|
||||
Write-Host "1. Install dependencies: npm install"
|
||||
Write-Host "2. Initialize husky: npx husky install"
|
||||
Write-Host "3. Run verification: ..\quality-rails\scripts\verify.ps1"
|
||||
75
tools/quality/scripts/install.sh
Executable file
75
tools/quality/scripts/install.sh
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Quality Rails Installation Script
|
||||
# Usage: ./install.sh --template typescript-node [--target /path/to/project]
|
||||
|
||||
TEMPLATE=""
|
||||
TARGET_DIR="."
|
||||
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--template)
|
||||
TEMPLATE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--target)
|
||||
TARGET_DIR="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
echo "Usage: $0 --template <template-name> [--target <directory>]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$TEMPLATE" ]; then
|
||||
echo "Error: --template is required"
|
||||
echo "Available templates: typescript-node, typescript-nextjs, python, monorepo"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
TEMPLATE_DIR="$REPO_ROOT/templates/$TEMPLATE"
|
||||
|
||||
if [ ! -d "$TEMPLATE_DIR" ]; then
|
||||
echo "Error: Template '$TEMPLATE' not found at $TEMPLATE_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Installing Quality Rails: $TEMPLATE"
|
||||
echo "Target directory: $TARGET_DIR"
|
||||
echo ""
|
||||
|
||||
# Copy template files
|
||||
echo "Copying template files..."
|
||||
cp -r "$TEMPLATE_DIR/.husky" "$TARGET_DIR/" 2>/dev/null || true
|
||||
cp "$TEMPLATE_DIR/.lintstagedrc.js" "$TARGET_DIR/" 2>/dev/null || true
|
||||
cp "$TEMPLATE_DIR/.eslintrc.strict.js" "$TARGET_DIR/.eslintrc.js" 2>/dev/null || true
|
||||
cp "$TEMPLATE_DIR/tsconfig.strict.json" "$TARGET_DIR/tsconfig.json" 2>/dev/null || true
|
||||
cp "$TEMPLATE_DIR/.woodpecker.yml" "$TARGET_DIR/" 2>/dev/null || true
|
||||
|
||||
echo "✓ Files copied"
|
||||
|
||||
# Check if package.json exists
|
||||
if [ -f "$TARGET_DIR/package.json" ]; then
|
||||
echo ""
|
||||
echo "⚠ package.json exists. Please manually merge dependencies from:"
|
||||
echo " $TEMPLATE_DIR/package.json.snippet"
|
||||
else
|
||||
echo "⚠ No package.json found. Create one and add dependencies from:"
|
||||
echo " $TEMPLATE_DIR/package.json.snippet"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "✓ Quality Rails installed successfully!"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Install dependencies: npm install"
|
||||
echo "2. Initialize husky: npx husky install"
|
||||
echo "3. Run verification: ~/.config/mosaic/bin/mosaic-quality-verify --target $TARGET_DIR"
|
||||
echo ""
|
||||
57
tools/quality/scripts/verify.ps1
Normal file
57
tools/quality/scripts/verify.ps1
Normal file
@@ -0,0 +1,57 @@
|
||||
# Quality Rails Verification Script (Windows)
|
||||
|
||||
Write-Host "═══════════════════════════════════════════"
|
||||
Write-Host "Quality Rails Enforcement Verification"
|
||||
Write-Host "═══════════════════════════════════════════"
|
||||
Write-Host ""
|
||||
|
||||
$Passed = 0
|
||||
$Failed = 0
|
||||
|
||||
# Test 1: Type error blocked
|
||||
Write-Host "Test 1: Type errors should be blocked..."
|
||||
"const x: string = 123;" | Out-File -FilePath test-file.ts -Encoding utf8
|
||||
git add test-file.ts 2>$null
|
||||
$output = git commit -m "Test commit" 2>&1 | Out-String
|
||||
if ($output -match "error") {
|
||||
Write-Host "✅ PASS: Type errors blocked" -ForegroundColor Green
|
||||
$Passed++
|
||||
} else {
|
||||
Write-Host "❌ FAIL: Type errors NOT blocked" -ForegroundColor Red
|
||||
$Failed++
|
||||
}
|
||||
git reset HEAD test-file.ts 2>$null
|
||||
Remove-Item test-file.ts -ErrorAction SilentlyContinue
|
||||
|
||||
# Test 2: any type blocked
|
||||
Write-Host ""
|
||||
Write-Host "Test 2: 'any' types should be blocked..."
|
||||
"const x: any = 123;" | Out-File -FilePath test-file.ts -Encoding utf8
|
||||
git add test-file.ts 2>$null
|
||||
$output = git commit -m "Test commit" 2>&1 | Out-String
|
||||
if ($output -match "no-explicit-any") {
|
||||
Write-Host "✅ PASS: 'any' types blocked" -ForegroundColor Green
|
||||
$Passed++
|
||||
} else {
|
||||
Write-Host "❌ FAIL: 'any' types NOT blocked" -ForegroundColor Red
|
||||
$Failed++
|
||||
}
|
||||
git reset HEAD test-file.ts 2>$null
|
||||
Remove-Item test-file.ts -ErrorAction SilentlyContinue
|
||||
|
||||
# Summary
|
||||
Write-Host ""
|
||||
Write-Host "═══════════════════════════════════════════"
|
||||
Write-Host "Verification Summary"
|
||||
Write-Host "═══════════════════════════════════════════"
|
||||
Write-Host "✅ Passed: $Passed"
|
||||
Write-Host "❌ Failed: $Failed"
|
||||
Write-Host ""
|
||||
|
||||
if ($Failed -eq 0) {
|
||||
Write-Host "🎉 All tests passed! Quality enforcement is working." -ForegroundColor Green
|
||||
exit 0
|
||||
} else {
|
||||
Write-Host "⚠ Some tests failed. Review configuration." -ForegroundColor Yellow
|
||||
exit 1
|
||||
}
|
||||
92
tools/quality/scripts/verify.sh
Executable file
92
tools/quality/scripts/verify.sh
Executable file
@@ -0,0 +1,92 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Quality Rails Verification Script
|
||||
# Tests that enforcement actually works
|
||||
|
||||
echo "═══════════════════════════════════════════"
|
||||
echo "Quality Rails Enforcement Verification"
|
||||
echo "═══════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
PASSED=0
|
||||
FAILED=0
|
||||
|
||||
# Test 1: Type error blocked
|
||||
echo "Test 1: Type errors should be blocked..."
|
||||
echo "const x: string = 123;" > test-file.ts
|
||||
git add test-file.ts 2>/dev/null
|
||||
if git commit -m "Test commit" 2>&1 | grep -q "error"; then
|
||||
echo "✅ PASS: Type errors blocked"
|
||||
((PASSED++))
|
||||
else
|
||||
echo "❌ FAIL: Type errors NOT blocked"
|
||||
((FAILED++))
|
||||
fi
|
||||
git reset HEAD test-file.ts 2>/dev/null
|
||||
rm test-file.ts 2>/dev/null
|
||||
|
||||
# Test 2: any type blocked
|
||||
echo ""
|
||||
echo "Test 2: 'any' types should be blocked..."
|
||||
echo "const x: any = 123;" > test-file.ts
|
||||
git add test-file.ts 2>/dev/null
|
||||
if git commit -m "Test commit" 2>&1 | grep -q "no-explicit-any"; then
|
||||
echo "✅ PASS: 'any' types blocked"
|
||||
((PASSED++))
|
||||
else
|
||||
echo "❌ FAIL: 'any' types NOT blocked"
|
||||
((FAILED++))
|
||||
fi
|
||||
git reset HEAD test-file.ts 2>/dev/null
|
||||
rm test-file.ts 2>/dev/null
|
||||
|
||||
# Test 3: Hardcoded secret blocked (if git-secrets installed)
|
||||
echo ""
|
||||
echo "Test 3: Hardcoded secrets should be blocked..."
|
||||
if command -v git-secrets &> /dev/null; then
|
||||
echo "const password = 'SuperSecret123!';" > test-file.ts
|
||||
git add test-file.ts 2>/dev/null
|
||||
if git commit -m "Test commit" 2>&1 | grep -q -i "secret\|password"; then
|
||||
echo "✅ PASS: Secrets blocked"
|
||||
((PASSED++))
|
||||
else
|
||||
echo "⚠ WARN: Secrets NOT blocked (git-secrets may need configuration)"
|
||||
((FAILED++))
|
||||
fi
|
||||
git reset HEAD test-file.ts 2>/dev/null
|
||||
rm test-file.ts 2>/dev/null
|
||||
else
|
||||
echo "⚠ SKIP: git-secrets not installed"
|
||||
fi
|
||||
|
||||
# Test 4: Lint error blocked
|
||||
echo ""
|
||||
echo "Test 4: Lint errors should be blocked..."
|
||||
echo "const x=123" > test-file.ts # Missing semicolon
|
||||
git add test-file.ts 2>/dev/null
|
||||
if git commit -m "Test commit" 2>&1 | grep -q "prettier"; then
|
||||
echo "✅ PASS: Lint errors blocked"
|
||||
((PASSED++))
|
||||
else
|
||||
echo "❌ FAIL: Lint errors NOT blocked"
|
||||
((FAILED++))
|
||||
fi
|
||||
git reset HEAD test-file.ts 2>/dev/null
|
||||
rm test-file.ts 2>/dev/null
|
||||
|
||||
# Summary
|
||||
echo ""
|
||||
echo "═══════════════════════════════════════════"
|
||||
echo "Verification Summary"
|
||||
echo "═══════════════════════════════════════════"
|
||||
echo "✅ Passed: $PASSED"
|
||||
echo "❌ Failed: $FAILED"
|
||||
echo ""
|
||||
|
||||
if [ $FAILED -eq 0 ]; then
|
||||
echo "🎉 All tests passed! Quality enforcement is working."
|
||||
exit 0
|
||||
else
|
||||
echo "⚠ Some tests failed. Review configuration."
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user