diff --git a/.claude/settings.json b/.claude/settings.json new file mode 100644 index 00000000..3a187885 --- /dev/null +++ b/.claude/settings.json @@ -0,0 +1,76 @@ +{ + "permissions": { + "allow": [ + "Bash(./bin/mise tasks *)", + "Bash(./bin/mise dr)", + "Bash(./bin/mise cfg *)", + "Bash(./bin/mise run check)", + "Bash(./bin/mise run test)", + "Bash(./bin/mise run test *)", + "Bash(./bin/mise run analyze)", + "Bash(./bin/mise run analyze *)", + "Bash(./bin/mise run coverage)", + "Bash(./bin/mise run generate)", + "Bash(./bin/mise run format)", + "Bash(./bin/mise run dart:format)", + "Bash(./bin/mise run dart:format:check)", + "Bash(./bin/mise run dart:format:fast)", + "Bash(./bin/mise run fmt:check)", + "Bash(./bin/mise run mise:format)", + "Bash(./bin/mise run prettier:check)", + "Bash(./bin/mise run prettier:format)", + "Bash(./bin/mise run prettier:format:fast)", + "Bash(./bin/mise run shell:check)", + "Bash(./bin/mise run shell:format)", + "Bash(./bin/mise run shell:format-check)", + "Bash(./bin/mise run proto:lint)", + "Bash(./bin/mise run proto:format)", + "Bash(./bin/mise run proto:api-lint)", + "Bash(./bin/mise run validate:festivals)", + "Bash(./bin/mise run test:worker)", + "Bash(./bin/mise run goldens:update)", + "Bash(./bin/mise run goldens:update *)", + "Bash(git status)", + "Bash(git log *)", + "Bash(git diff *)", + "Bash(git show *)", + "Bash(git fetch *)", + "Bash(git stash list)", + "Bash(git add *)", + "Bash(git commit *)", + "Bash(jq *)" + ] + }, + "hooks": { + "PostToolUse": [ + { + "matcher": "Write|Edit", + "hooks": [ + { + "type": "command", + "command": "jq -r '.tool_input.file_path // empty' | grep -q '\\.dart$' && ./bin/mise run dart:format:fast >/dev/null 2>&1 || true" + }, + { + "type": "command", + "command": "jq -r '.tool_input.file_path // empty' | grep -qE '\\.(js|ts|mjs)$' && ./bin/mise run prettier:format:fast >/dev/null 2>&1 || true" + }, + { + "type": "command", + "command": "jq -r '.tool_input.file_path // empty' | grep -q '\\.sh$' && ./bin/mise run shell:format >/dev/null 2>&1 || true" + }, + { + "type": "command", + "command": "jq -r '.tool_input.file_path // empty' | grep -qE 'mise[^/]*\\.toml$' && ./bin/mise run mise:format >/dev/null 2>&1 || true" + }, + { + "type": "command", + "command": "jq -r '.tool_input.file_path // empty' | grep -q '\\.proto$' && MISE_ENV=dev ./bin/mise run proto:format >/dev/null 2>&1 || true" + } + ] + } + ] + }, + "worktree": { + "symlinkDirectories": [".mise"] + } +} diff --git a/mise.toml b/mise.toml index 0d0783d0..fcffefea 100644 --- a/mise.toml +++ b/mise.toml @@ -38,6 +38,10 @@ depends = ['generate'] sources = ['lib/**/*.dart', 'test/**/*_test.dart'] run = 'dart format .' +[tasks."dart:format:fast"] +description = "Format Dart code without running code generation — for editor hooks" +run = 'dart format .' + [tasks."dart:format:check"] description = "Check Dart formatting without modifying files" run = 'dart format --output=none --set-exit-if-changed .' @@ -46,6 +50,10 @@ run = 'dart format --output=none --set-exit-if-changed .' description = "Format JS/TS/MJS files with Prettier" run = 'npm ci && npx prettier --write "**/*.{js,ts,mjs}"' +[tasks."prettier:format:fast"] +description = "Format JS/TS/MJS files without running npm ci — for editor hooks" +run = 'npx prettier --write "**/*.{js,ts,mjs}"' + [tasks."prettier:check"] description = "Check JS/TS/MJS formatting without modifying files" run = 'npm ci && npx prettier --check "**/*.{js,ts,mjs}"'