-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathsettings.json
More file actions
83 lines (83 loc) · 6.01 KB
/
settings.json
File metadata and controls
83 lines (83 loc) · 6.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -q -- '--no-verify'; then echo '{\"decision\": \"block\", \"reason\": \"Do not skip pre-commit hooks. Fix the underlying issue instead.\"}'; exit 2; fi",
"description": "Block --no-verify on git commits"
},
{
"type": "command",
"command": "if echo \"$CLAUDE_TOOL_INPUT\" | grep -qE '(from\\s+@mui|import.*@mui|@emotion)'; then echo '{\"decision\": \"block\", \"reason\": \"Do not use MUI or @emotion. Use components from openmetadata-ui-core-components instead. See CLAUDE.md for details.\"}'; exit 2; fi",
"description": "Block new MUI/emotion imports"
}
]
}
],
"PostToolUse": [
{
"matcher": "Edit",
"hooks": [
{
"type": "command",
"command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.file_path // empty' 2>/dev/null); if [ -n \"$FILE\" ] && echo \"$FILE\" | grep -qE '\\.java$'; then echo 'Reminder: run `mvn spotless:apply` before committing Java changes.'; fi",
"description": "Remind to format Java after edits"
},
{
"type": "command",
"command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.file_path // empty' 2>/dev/null); if [ -n \"$FILE\" ] && echo \"$FILE\" | grep -qE 'openmetadata-spec/src/main/resources/json/schema/.*\\.json$'; then echo 'Schema file modified. Remember to run `make generate` to regenerate Pydantic models and rebuild dependent modules.'; fi",
"description": "Remind to regenerate after schema changes"
},
{
"type": "command",
"command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.file_path // empty' 2>/dev/null); if [ -n \"$FILE\" ] && echo \"$FILE\" | grep -qE 'openmetadata-spec/src/main/resources/json/schema/entity/services/connections/.*\\.json$'; then echo 'Connection schema modified. Remember to run `yarn parse-schema` to update resolved schemas for the UI.'; fi",
"description": "Remind to parse connection schemas for UI"
},
{
"type": "command",
"command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.file_path // empty' 2>/dev/null); CONTENT=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.new_string // empty' 2>/dev/null); if [ -n \"$FILE\" ] && echo \"$FILE\" | grep -qE '\\.(ts|tsx)$' && echo \"$CONTENT\" | grep -qE ': any[^A-Za-z]|: any$|<any>|as any'; then echo 'Warning: `any` type detected in TypeScript. Use proper types, `unknown` with type guards, or import from generated types. See CLAUDE.md.'; fi",
"description": "Warn about any type in TypeScript"
},
{
"type": "command",
"command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.file_path // empty' 2>/dev/null); CONTENT=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.new_string // empty' 2>/dev/null); if [ -n \"$FILE\" ] && echo \"$FILE\" | grep -qE '\\.(ts|tsx)$' && echo \"$CONTENT\" | grep -qE 'console\\.(log|warn|error|info|debug)'; then echo 'Warning: `console.*` detected in TypeScript. Remove before committing — CI lint-src will fail (no-console rule).'; fi",
"description": "Warn about console.log in TypeScript"
},
{
"type": "command",
"command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.file_path // empty' 2>/dev/null); if [ -n \"$FILE\" ] && echo \"$FILE\" | grep -qE 'locale/languages/en-us\\.json$'; then echo 'i18n key added. Run `yarn i18n` to sync all 17 locale files before committing — CI i18n-sync will fail otherwise.'; fi",
"description": "Remind to run i18n sync after adding keys"
}
]
},
{
"matcher": "Write",
"hooks": [
{
"type": "command",
"command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.file_path // empty' 2>/dev/null); if [ -n \"$FILE\" ] && echo \"$FILE\" | grep -qE '\\.java$'; then echo 'Reminder: run `mvn spotless:apply` before committing Java changes.'; fi",
"description": "Remind to format Java after writes"
},
{
"type": "command",
"command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.file_path // empty' 2>/dev/null); CONTENT=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.content // empty' 2>/dev/null); if [ -n \"$FILE\" ] && echo \"$FILE\" | grep -qE '\\.(ts|tsx)$' && echo \"$CONTENT\" | grep -qE 'import.*from.*@mui|import.*from.*@emotion'; then echo 'Warning: MUI/@emotion import detected. Use components from openmetadata-ui-core-components instead. See CLAUDE.md.'; fi",
"description": "Warn about MUI imports in new files"
},
{
"type": "command",
"command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.file_path // empty' 2>/dev/null); CONTENT=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.content // empty' 2>/dev/null); if [ -n \"$FILE\" ] && echo \"$FILE\" | grep -qE '\\.(ts|tsx|js|jsx)$'; then HAS_LICENSE=$(echo \"$CONTENT\" | head -5 | grep -c 'Copyright.*Collate'); if [ \"$HAS_LICENSE\" -eq 0 ]; then echo 'Warning: New file missing Apache 2.0 license header. CI license-header check will fail. Add the standard header or run `yarn license-header-fix`.'; fi; fi",
"description": "Warn about missing license header in new files"
},
{
"type": "command",
"command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.file_path // empty' 2>/dev/null); CONTENT=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.content // empty' 2>/dev/null); if [ -n \"$FILE\" ] && echo \"$FILE\" | grep -qE '\\.(ts|tsx)$' && echo \"$CONTENT\" | grep -qE 'console\\.(log|warn|error|info|debug)'; then echo 'Warning: `console.*` in new file. CI lint-src will fail (no-console rule). Use the logger or remove.'; fi",
"description": "Warn about console.log in new files"
}
]
}
]
}
}