Initial commit
This commit is contained in:
47
.claude/hooks/lint.cjs
Normal file
47
.claude/hooks/lint.cjs
Normal file
@@ -0,0 +1,47 @@
|
||||
const { execSync } = require('child_process')
|
||||
const path = require('path')
|
||||
|
||||
const PROJECT_ROOT = path.resolve(__dirname, '../..')
|
||||
|
||||
let input = ''
|
||||
process.stdin.on('data', chunk => { input += chunk })
|
||||
process.stdin.on('end', () => {
|
||||
try {
|
||||
const data = JSON.parse(input)
|
||||
const filePath = data.tool_input?.file_path
|
||||
if (!filePath) process.exit(0)
|
||||
|
||||
const ext = path.extname(filePath).toLowerCase()
|
||||
|
||||
if (ext === '.php') {
|
||||
try {
|
||||
const result = execSync(
|
||||
`php vendor/bin/phpstan analyse "${filePath}" --level=5 --no-progress --error-format=raw`,
|
||||
{ cwd: PROJECT_ROOT, encoding: 'utf8', timeout: 30000 }
|
||||
)
|
||||
if (result.trim()) {
|
||||
process.stderr.write('[PHPStan]\n' + result.trim() + '\n')
|
||||
}
|
||||
} catch (e) {
|
||||
if (e.stdout?.trim()) {
|
||||
process.stderr.write('[PHPStan]\n' + e.stdout.trim() + '\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (['.js', '.jsx'].includes(ext) && filePath.includes('src')) {
|
||||
try {
|
||||
execSync(
|
||||
`npx eslint "${filePath}" --max-warnings 0`,
|
||||
{ cwd: PROJECT_ROOT, encoding: 'utf8', timeout: 30000 }
|
||||
)
|
||||
} catch (e) {
|
||||
if (e.stdout?.trim()) {
|
||||
process.stderr.write('[ESLint]\n' + e.stdout.trim() + '\n')
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// JSON parse error - ignore
|
||||
}
|
||||
})
|
||||
6
.claude/settings.json
Normal file
6
.claude/settings.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"enabledPlugins": {
|
||||
"frontend-design@claude-plugins-official": true,
|
||||
"code-review@claude-plugins-official": true
|
||||
}
|
||||
}
|
||||
27
.claude/settings.local.json
Normal file
27
.claude/settings.local.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"permissions": {
|
||||
"allow": [
|
||||
"Bash(npm run:*)",
|
||||
"Bash(rm:*)",
|
||||
"Bash(cp:*)",
|
||||
"Bash(mv:*)",
|
||||
"Bash(mkdir:*)",
|
||||
"Bash(diff:*)",
|
||||
"Bash(mysql:*)",
|
||||
"Bash(sed:*)",
|
||||
"Bash(npx eslint:*)",
|
||||
"Bash(php:*)",
|
||||
"Bash(npm install:*)",
|
||||
"Bash(grep:*)",
|
||||
"Bash(composer require:*)",
|
||||
"Bash(vendor/bin/phpcs:*)",
|
||||
"Bash(vendor/bin/phpcbf:*)",
|
||||
"Bash(vendor/bin/phpstan analyse:*)",
|
||||
"Bash(wc:*)",
|
||||
"Read(//tmp/**)",
|
||||
"Bash(read f:*)",
|
||||
"Bash(find D:\\\\Weby\\\\BOHA Website\\\\New\\\\api:*)",
|
||||
"Bash(find:*)"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user