-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add Claude Code project settings (.claude/settings.json) #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
martinydeAI
wants to merge
1
commit into
develop
Choose a base branch
from
feature/issue-6-claude-settings
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,160 @@ | ||
| { | ||
| "$schema": "https://json.schemastore.org/claude-code-settings.json", | ||
| "env": { | ||
| "COMPOSE_USER": "deploy" | ||
| }, | ||
| "permissions": { | ||
| "allow": [ | ||
| "Bash(cat:*)", | ||
| "Bash(diff:*)", | ||
| "Bash(echo:*)", | ||
| "Bash(find:*)", | ||
| "Bash(gh:*)", | ||
| "Bash(git:*)", | ||
| "Bash(grep:*)", | ||
| "Bash(head:*)", | ||
| "Bash(ls:*)", | ||
| "Bash(pwd)", | ||
| "Bash(tail:*)", | ||
| "Bash(task:*)", | ||
| "Bash(tree:*)", | ||
| "Bash(wc:*)", | ||
| "Bash(which:*)", | ||
| "Bash(docker compose exec:*)", | ||
| "Bash(docker compose run:*)", | ||
| "Bash(docker compose up:*)", | ||
| "Bash(docker compose ps:*)", | ||
| "Bash(docker compose logs:*)", | ||
| "Bash(docker compose top:*)", | ||
| "Bash(docker compose config:*)", | ||
| "Bash(docker compose pull:*)", | ||
| "Bash(docker compose images:*)", | ||
| "Bash(docker network:*)" | ||
| ], | ||
| "deny": [ | ||
| "Bash(rm -rf:*)", | ||
| "Bash(gh issue delete:*)", | ||
| "Bash(gh release delete:*)", | ||
| "Bash(gh repo delete:*)", | ||
| "Bash(gh label delete:*)", | ||
| "Read(./.env.local)", | ||
| "Read(./.env.local.*)", | ||
| "Read(./config/secrets/*)" | ||
| ], | ||
| "ask": [ | ||
| "Bash(docker compose down:*)", | ||
| "Bash(docker compose stop:*)", | ||
| "Bash(docker compose rm:*)", | ||
| "Bash(docker compose restart:*)", | ||
| "Bash(gh issue create:*)", | ||
| "Bash(gh issue close:*)", | ||
| "Bash(gh issue edit:*)", | ||
| "Bash(gh issue comment:*)", | ||
| "Bash(gh pr create:*)", | ||
| "Bash(gh pr close:*)", | ||
| "Bash(gh pr merge:*)", | ||
| "Bash(gh pr edit:*)", | ||
| "Bash(gh pr comment:*)", | ||
| "Bash(gh pr review:*)", | ||
| "Bash(gh release create:*)", | ||
| "Bash(gh release edit:*)", | ||
| "Bash(gh repo create:*)", | ||
| "Bash(gh label create:*)", | ||
| "Bash(gh label edit:*)", | ||
| "Bash(git push:*)", | ||
| "Bash(git branch -d:*)", | ||
| "Bash(git branch -D:*)", | ||
| "Bash(git tag -d:*)", | ||
| "Bash(git tag -a:*)", | ||
| "Bash(git tag :*)", | ||
| "Bash(git reset:*)", | ||
| "Bash(git rebase:*)", | ||
| "Bash(git merge:*)", | ||
| "Bash(git stash drop:*)", | ||
| "Bash(git clean:*)", | ||
| "Bash(git checkout -- :*)", | ||
| "Bash(git restore:*)", | ||
| "Bash(git commit:*)" | ||
| ] | ||
| }, | ||
| "hooks": { | ||
| "SessionStart": [ | ||
| { | ||
| "matcher": "startup", | ||
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "docker compose up --detach --quiet-pull 2>/dev/null || true", | ||
| "timeout": 60, | ||
| "statusMessage": "Starting Docker services..." | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "PreToolUse": [ | ||
| { | ||
| "matcher": "Edit|Write", | ||
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "case \"$CLAUDE_FILE_PATH\" in */composer.lock|*/yarn.lock|*/.env.local|*/.env.local.*) echo 'BLOCKED: Do not edit lock files or .env.local directly' >&2; exit 1 ;; esac" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "PostToolUse": [ | ||
| { | ||
| "matcher": "Write|Edit", | ||
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "case \"$CLAUDE_FILE_PATH\" in *.php) REL_PATH=\"${CLAUDE_FILE_PATH#$CLAUDE_PROJECT_DIR/}\"; docker compose exec -T phpfpm vendor/bin/php-cs-fixer fix --quiet \"$REL_PATH\" 2>/dev/null || true ;; esac", | ||
| "timeout": 30 | ||
| }, | ||
| { | ||
| "type": "command", | ||
| "command": "case \"$CLAUDE_FILE_PATH\" in *.php) REL_PATH=\"${CLAUDE_FILE_PATH#$CLAUDE_PROJECT_DIR/}\"; docker compose exec -T phpfpm vendor/bin/phpstan analyse --no-progress --error-format=raw \"$REL_PATH\" 2>/dev/null || true ;; esac", | ||
| "timeout": 30 | ||
| }, | ||
| { | ||
| "type": "command", | ||
| "command": "case \"$CLAUDE_FILE_PATH\" in *.twig) REL_PATH=\"${CLAUDE_FILE_PATH#$CLAUDE_PROJECT_DIR/}\"; docker compose exec -T phpfpm vendor/bin/twig-cs-fixer lint --fix \"$REL_PATH\" 2>/dev/null || true ;; esac", | ||
| "timeout": 15 | ||
| }, | ||
| { | ||
| "type": "command", | ||
| "command": "case \"$CLAUDE_FILE_PATH\" in */composer.json) docker compose exec -T phpfpm composer normalize --quiet 2>/dev/null || true ;; esac", | ||
| "timeout": 30 | ||
| }, | ||
| { | ||
| "type": "command", | ||
| "command": "case \"$CLAUDE_FILE_PATH\" in *.js|*.css|*.scss|*.yaml|*.yml|*.md) REL_PATH=\"${CLAUDE_FILE_PATH#$CLAUDE_PROJECT_DIR/}\"; docker compose run --rm -T node npx prettier --write \"$REL_PATH\" 2>/dev/null || true ;; esac", | ||
| "timeout": 15 | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "Stop": [ | ||
| { | ||
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "docker compose exec -T phpfpm bin/console lint:container 2>/dev/null || true", | ||
| "timeout": 30, | ||
| "statusMessage": "Validating Symfony DI container..." | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }, | ||
| "enabledPlugins": { | ||
| "php-lsp@claude-plugins-official": true, | ||
| "code-simplifier@claude-plugins-official": true, | ||
| "context7@claude-plugins-official": true, | ||
| "code-review@claude-plugins-official": true, | ||
| "security-guidance@claude-plugins-official": true, | ||
| "playwright@claude-plugins-official": true, | ||
| "feature-dev@claude-plugins-official": true, | ||
| "itkdev-skills@itkdev-marketplace": true | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should just allow all from gh or git
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe look at https://github.com/os2display/display-api-service/blob/release/3.0.0/.claude/settings.json
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have also worked on a settings.json in economics:
https://github.com/itk-dev/economics/pull/317/changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the rules for
deny,ask,alloware evaluated in that order. So when we also have saygh repo deleteunderdenythat will always trigger before the broader rule underallowhttps://code.claude.com/docs/en/permissions#manage-permissions
That said, I agree with @tuj that we shouldn't default to
allowlike this. Allow rules should be scoped to non-commands of "view" or "list" in nature.