288 lines
8.7 KiB
JSON
288 lines
8.7 KiB
JSON
{
|
|
"name": "Universal Atomic Code Implementer Hooks",
|
|
"description": "Comprehensive hooks configuration for quality enforcement and automatic remediation",
|
|
"version": "1.0.0",
|
|
"hooks": {
|
|
"PostToolUse": [
|
|
{
|
|
"matcher": "Write|Edit|MultiEdit",
|
|
"hooks": [
|
|
{
|
|
"type": "command",
|
|
"command": "bash",
|
|
"args": [
|
|
"-c",
|
|
"echo '[HOOK] Universal quality enforcement for $FILE_PATH'; if [[ \"$FILE_PATH\" == *.ts || \"$FILE_PATH\" == *.tsx ]]; then echo '[HOOK] TypeScript checks'; npx eslint --fix \"$FILE_PATH\" && npx prettier --write \"$FILE_PATH\" && npx tsc --noEmit || echo '[HOOK] TS completed'; elif [[ \"$FILE_PATH\" == *.js || \"$FILE_PATH\" == *.jsx ]]; then echo '[HOOK] JavaScript checks'; npx eslint --fix \"$FILE_PATH\" && npx prettier --write \"$FILE_PATH\" || echo '[HOOK] JS completed'; elif [[ \"$FILE_PATH\" == *.py ]]; then echo '[HOOK] Python checks'; black \"$FILE_PATH\" && flake8 \"$FILE_PATH\" && mypy \"$FILE_PATH\" || echo '[HOOK] Python completed'; fi"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"fileTypeHooks": {
|
|
"*.ts": {
|
|
"afterChange": [
|
|
"echo '[HOOK] TypeScript file modified: ${FILE_PATH}'",
|
|
"npx eslint --fix ${FILE_PATH}",
|
|
"npx prettier --write ${FILE_PATH}",
|
|
"npx tsc --noEmit --project tsconfig.json"
|
|
],
|
|
"beforeDelete": [
|
|
"echo '[HOOK] Checking for TypeScript file dependencies before deletion'"
|
|
]
|
|
},
|
|
"*.tsx": {
|
|
"afterChange": [
|
|
"echo '[HOOK] React TypeScript file modified: ${FILE_PATH}'",
|
|
"npx eslint --fix ${FILE_PATH}",
|
|
"npx prettier --write ${FILE_PATH}",
|
|
"npx tsc --noEmit --project tsconfig.json",
|
|
"if command -v npm >/dev/null 2>&1; then",
|
|
" npm run test:component -- ${FILE_NAME} 2>/dev/null || echo '[HOOK] Component tests checked'",
|
|
"fi"
|
|
]
|
|
},
|
|
"*.js": {
|
|
"afterChange": [
|
|
"echo '[HOOK] JavaScript file modified: ${FILE_PATH}'",
|
|
"npx eslint --fix ${FILE_PATH}",
|
|
"npx prettier --write ${FILE_PATH}"
|
|
]
|
|
},
|
|
"*.jsx": {
|
|
"afterChange": [
|
|
"echo '[HOOK] React JavaScript file modified: ${FILE_PATH}'",
|
|
"npx eslint --fix ${FILE_PATH}",
|
|
"npx prettier --write ${FILE_PATH}",
|
|
"if command -v npm >/dev/null 2>&1; then",
|
|
" npm run test:component -- ${FILE_NAME} 2>/dev/null || echo '[HOOK] Component tests checked'",
|
|
"fi"
|
|
]
|
|
},
|
|
"*.py": {
|
|
"afterChange": [
|
|
"echo '[HOOK] Python file modified: ${FILE_PATH}'",
|
|
"black ${FILE_PATH}",
|
|
"flake8 ${FILE_PATH} || echo '[HOOK] Flake8 linting completed'",
|
|
"mypy ${FILE_PATH} || echo '[HOOK] MyPy type checking completed'",
|
|
"if command -v pytest >/dev/null 2>&1; then",
|
|
" pytest ${FILE_PATH%.*}_test.py 2>/dev/null || echo '[HOOK] Python tests checked'",
|
|
"fi"
|
|
]
|
|
},
|
|
"package.json": {
|
|
"afterChange": [
|
|
"echo '[HOOK] package.json modified, updating dependencies'",
|
|
"npm install --no-audit --no-fund || echo '[HOOK] Dependency update completed'"
|
|
]
|
|
},
|
|
"requirements.txt": {
|
|
"afterChange": [
|
|
"echo '[HOOK] requirements.txt modified, updating Python dependencies'",
|
|
"pip install -r requirements.txt || echo '[HOOK] Python dependency update completed'"
|
|
]
|
|
},
|
|
"*.json": {
|
|
"afterChange": [
|
|
"echo '[HOOK] JSON file modified: ${FILE_PATH}'",
|
|
"if command -v jq >/dev/null 2>&1; then",
|
|
" jq . ${FILE_PATH} > /dev/null || echo '[HOOK] JSON validation failed'",
|
|
"fi"
|
|
]
|
|
},
|
|
"*.md": {
|
|
"afterChange": [
|
|
"echo '[HOOK] Markdown file modified: ${FILE_PATH}'",
|
|
"if command -v prettier >/dev/null 2>&1; then",
|
|
" npx prettier --write ${FILE_PATH} || echo '[HOOK] Markdown formatting completed'",
|
|
"fi"
|
|
]
|
|
}
|
|
},
|
|
"remediationActions": {
|
|
"RETRY_OPERATION": {
|
|
"description": "Retry the last file operation after applying fixes",
|
|
"maxRetries": 2,
|
|
"backoffMs": 1000
|
|
},
|
|
"CONTINUE_WITH_WARNING": {
|
|
"description": "Continue execution but log warnings for manual review",
|
|
"logLevel": "warning"
|
|
},
|
|
"ABORT_WITH_ERROR": {
|
|
"description": "Stop execution and require manual intervention",
|
|
"logLevel": "error"
|
|
},
|
|
"TRIGGER_QA_AGENT": {
|
|
"description": "Escalate to QA validation agent for complex issues",
|
|
"agent": "qa-validation-agent"
|
|
},
|
|
"REQUEST_CONTEXT7_HELP": {
|
|
"description": "Look up documentation for error resolution",
|
|
"tool": "mcp__context7__get-library-docs"
|
|
}
|
|
},
|
|
"qualityGates": {
|
|
"typescript": {
|
|
"eslint": {
|
|
"enabled": true,
|
|
"config": ".eslintrc.js",
|
|
"autoFix": true,
|
|
"failOnError": false
|
|
},
|
|
"prettier": {
|
|
"enabled": true,
|
|
"config": ".prettierrc",
|
|
"autoFix": true
|
|
},
|
|
"typeCheck": {
|
|
"enabled": true,
|
|
"config": "tsconfig.json",
|
|
"failOnError": false
|
|
},
|
|
"testing": {
|
|
"enabled": true,
|
|
"runAffected": true,
|
|
"coverage": 80
|
|
}
|
|
},
|
|
"python": {
|
|
"black": {
|
|
"enabled": true,
|
|
"lineLength": 88,
|
|
"autoFix": true
|
|
},
|
|
"flake8": {
|
|
"enabled": true,
|
|
"config": ".flake8",
|
|
"failOnError": false
|
|
},
|
|
"mypy": {
|
|
"enabled": true,
|
|
"config": "mypy.ini",
|
|
"failOnError": false
|
|
},
|
|
"pytest": {
|
|
"enabled": true,
|
|
"coverage": 90
|
|
}
|
|
},
|
|
"javascript": {
|
|
"eslint": {
|
|
"enabled": true,
|
|
"autoFix": true
|
|
},
|
|
"prettier": {
|
|
"enabled": true,
|
|
"autoFix": true
|
|
}
|
|
}
|
|
},
|
|
"performanceOptimization": {
|
|
"parallelExecution": {
|
|
"enabled": true,
|
|
"maxConcurrency": 4
|
|
},
|
|
"caching": {
|
|
"enabled": true,
|
|
"eslint": true,
|
|
"prettier": true,
|
|
"typescript": true
|
|
},
|
|
"incrementalChecks": {
|
|
"enabled": true,
|
|
"onlyModifiedFiles": true
|
|
}
|
|
},
|
|
"monitoring": {
|
|
"metrics": {
|
|
"hookExecutionTime": true,
|
|
"errorRates": true,
|
|
"remediationSuccess": true
|
|
},
|
|
"logging": {
|
|
"level": "info",
|
|
"format": "json",
|
|
"includeStackTrace": true
|
|
},
|
|
"alerts": {
|
|
"highErrorRate": {
|
|
"threshold": 0.1,
|
|
"action": "log"
|
|
},
|
|
"slowHookExecution": {
|
|
"thresholdMs": 10000,
|
|
"action": "log"
|
|
}
|
|
}
|
|
},
|
|
"integration": {
|
|
"presets": {
|
|
"loadHooksFromPresets": true,
|
|
"overrideWithProjectConfig": true
|
|
},
|
|
"cicd": {
|
|
"skipInCI": false,
|
|
"reportToCI": true
|
|
},
|
|
"ide": {
|
|
"vscode": {
|
|
"showNotifications": true,
|
|
"autoSave": false
|
|
}
|
|
}
|
|
},
|
|
"customCommands": {
|
|
"fullQualityCheck": {
|
|
"description": "Run comprehensive quality checks",
|
|
"commands": [
|
|
"npm run lint",
|
|
"npm run format",
|
|
"npm run build",
|
|
"npm run test",
|
|
"npm run type-check"
|
|
]
|
|
},
|
|
"securityScan": {
|
|
"description": "Run security scanning",
|
|
"commands": [
|
|
"npm audit",
|
|
"npx eslint . --ext .ts,.tsx,.js,.jsx --config .eslintrc.security.js || echo 'Security scan completed'"
|
|
]
|
|
},
|
|
"performanceCheck": {
|
|
"description": "Run performance analysis",
|
|
"commands": [
|
|
"npm run build:analyze || echo 'Bundle analysis completed'",
|
|
"npm run lighthouse || echo 'Lighthouse audit completed'"
|
|
]
|
|
}
|
|
},
|
|
"documentation": {
|
|
"usage": "This configuration provides comprehensive quality enforcement through hooks",
|
|
"examples": [
|
|
{
|
|
"scenario": "TypeScript file creation",
|
|
"flow": "Write file → ESLint auto-fix → Prettier format → TypeScript check → Tests"
|
|
},
|
|
{
|
|
"scenario": "Python file modification",
|
|
"flow": "Edit file → Black format → Flake8 lint → MyPy type check → Pytest"
|
|
},
|
|
{
|
|
"scenario": "Build error",
|
|
"flow": "Error detected → Analyze common issues → Apply fixes → Retry or continue"
|
|
}
|
|
],
|
|
"troubleshooting": [
|
|
{
|
|
"issue": "Hooks taking too long",
|
|
"solution": "Enable parallelExecution and incremental checks"
|
|
},
|
|
{
|
|
"issue": "False positive errors",
|
|
"solution": "Adjust quality gate thresholds or use CONTINUE_WITH_WARNING"
|
|
}
|
|
]
|
|
}
|
|
} |