Skip to content

feat: devcontainer環境のclaude設定を統合 - #59

Merged
keito4 merged 2 commits into
mainfrom
feat/devcontainer-claude-integration
Jul 26, 2025
Merged

feat: devcontainer環境のclaude設定を統合#59
keito4 merged 2 commits into
mainfrom
feat/devcontainer-claude-integration

Conversation

@keito4

@keito4 keito4 commented Jul 26, 2025

Copy link
Copy Markdown
Owner
  • Claude設定ファイルをDockerイメージに組み込み
  • 開発環境でのClaude初期設定を自動化
  • commitlint.config.jsを追加(Husky用)
  • Supabase CLIバージョンをv2.31.8に更新

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated development container to include default Claude settings for permissions.
    • Added a configuration file to specify allowed command and web fetch permissions within the dev environment.
    • Introduced commit message linting rules to enforce consistent commit formatting.
    • Enhanced local settings with environment variables and webhook hooks for task notifications.

- Claude設定ファイルをDockerイメージに組み込み
- 開発環境でのClaude初期設定を自動化
- commitlint.config.jsを追加(Husky用)
- Supabase CLIバージョンをv2.31.8に更新

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 26, 2025

Copy link
Copy Markdown

Walkthrough

This change updates the development container setup by introducing a default Claude settings JSON file with explicit command and web fetch permissions, adjusts the Dockerfile to copy this configuration into the container, and adds a commitlint configuration to enforce commit message standards. The Dockerfile no longer copies the commitlint config to /tmp/. Additionally, the local Claude settings file is modified to remove some Slack and filesystem permissions, add an environment variable, and define a stop-hook that triggers a webhook notification.

Changes

File(s) Change Summary
.devcontainer/Dockerfile Copies the new Claude settings JSON into the container; removes copying of commitlint config to /tmp/.
.devcontainer/claude-settings.json Adds a configuration file specifying allowed Bash commands and web fetch domains for Claude in the container.
commitlint.config.js Adds commitlint configuration enforcing subject and type rules for commit messages.
.claude/settings.local.json Removes Slack and filesystem permissions; adds environment variable and a stop-hook sending a webhook POST.

Sequence Diagram(s)

sequenceDiagram
    participant DevContainer as DevContainer Build
    participant Dockerfile as Dockerfile
    participant Claude as Claude Settings
    participant CommitLint as CommitLint
    participant LocalSettings as Local Claude Settings

    DevContainer->>Dockerfile: Build container
    Dockerfile->>Claude: Copy claude-settings.json to /.claude/
    Dockerfile->>Claude: Set ownership to vscode
    DevContainer->>CommitLint: Add commitlint.config.js to project root

    Note over LocalSettings: On Claude Stop Hook
    LocalSettings->>Webhook: POST notification with project, task, request info
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

🐇
In the warren, configs bloom anew,
Claude’s rules are crisp, permissions few.
Linting commits with careful might,
Our Docker builds are clean and bright.
Hooks that ping when tasks conclude,
This code hops forward—full of gratitude!
🥕✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/devcontainer-claude-integration

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@keito4 keito4 self-assigned this Jul 26, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
commitlint.config.js (1)

1-9: Commit-lint rules are solid; add max-length for better UX
You already forbid empty / wrong-case subjects and empty types – great. Consider enabling header-max-length (e.g. 100) to avoid CI rejects from overly long commit titles.

     'type-empty': [2, 'never'],
     'scope-empty': [0],
+    'header-max-length': [2, 'always', 100]
.devcontainer/Dockerfile (1)

41-43: Lock down permissions on the settings file after copy
The JSON contains policy data that should not be world-readable. Add a chmod in the same layer to avoid leaking it in later image stages.

 COPY --chown=vscode:vscode .devcontainer/claude-settings.json /home/vscode/.claude/settings.json
+RUN chmod 600 /home/vscode/.claude/settings.json
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2bda188 and becb3e7.

⛔ Files ignored due to path filters (1)
  • supabase/.temp/cli-latest is excluded by !**/.temp/**
📒 Files selected for processing (3)
  • .devcontainer/Dockerfile (1 hunks)
  • .devcontainer/claude-settings.json (1 hunks)
  • commitlint.config.js (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
commitlint.config.js (1)

Learnt from: CR
PR: keito4/config#0
File: .cursor/rules/commit.cursorrules:0-0
Timestamp: 2025-06-25T06:37:26.200Z
Learning: Commit messages must follow the Conventional Commits format: (): , where type can be feat, fix, docs, refactor, etc.

🔇 Additional comments (2)
.devcontainer/claude-settings.json (2)

1-45: Permissions file looks valid JSON and matches Claude-Code schema
The structure is syntactically correct, keys are spelled as expected, and the allow-list granularity is clear. No blockers from a parsing standpoint.


37-43: Allow-list is very permissive – consider tightening or adding explicit denies
Granting Bash(git push:*), Bash(kubectl *:*), and generic web-fetch on github.com gives the agent power to mutate source history or prod-cluster state if mis-prompted. If the container is ever used outside an isolated playground, add a few guard-rails, e.g.

     "deny": [
+      "Bash(git push:*)",
+      "Bash(kubectl apply:*)",
+      "Bash(kubectl delete:*)"
     ]

or move destructive commands to an opt-in “ask-first” list.

- Stopフックでn8n webhookへの通知機能を追加
- プロジェクト名を正しく設定(keito4/config)
- タスク名とリクエスト詳細を環境変数から取得して通知

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@keito4
keito4 merged commit 43a73e6 into main Jul 26, 2025
1 check passed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between becb3e7 and 5d8fe5d.

📒 Files selected for processing (1)
  • .claude/settings.local.json (1 hunks)
🔇 Additional comments (1)
.claude/settings.local.json (1)

28-30: Double-check env-var collision semantics

CLAUDE_CODE_PROJECT_NAME is now hard-wired to "keito4/config".
If the same variable can be injected from the outside (e.g., CI job or host shell), this local definition will silently shadow it, which may confuse users running the container for other forks of the repo.

Confirm that this override is intentional or consider guarding it:

-  "env": {
-    "CLAUDE_CODE_PROJECT_NAME": "keito4/config"
-  },
+  "env": {
+    "CLAUDE_CODE_PROJECT_NAME": "${CLAUDE_CODE_PROJECT_NAME:-keito4/config}"
+  },

Comment on lines +31 to +41
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "curl -X POST http://host.docker.internal:5678/webhook/notify -H \\\"Content-Type: application/json\\\" -d '{\\\"project_name\\\":\\\"keito4/config\\\",\\\"task_name\\\":\\\"${CLAUDE_TASK}\\\",\\\"request_detail\\\":\\\"${CLAUDE_REQUEST}\\\"}'"
}
]
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Quote-handling & injection risk in Stop-hook payload

${CLAUDE_TASK} and ${CLAUDE_REQUEST} are interpolated directly into a one-liner curl command.
If either variable contains double quotes, newlines, or shell metacharacters, the JSON becomes invalid or, worse, allows command injection once the string reaches a shell.

Safer pattern: build the JSON with jq -n (or printf) and pass it to curl via stdin; this removes the need for heavy escaping and prevents shell injection.

-            "command": "curl -X POST http://host.docker.internal:5678/webhook/notify -H \\\"Content-Type: application/json\\\" -d '{\\\"project_name\\\":\\\"keito4/config\\\",\\\"task_name\\\":\\\"${CLAUDE_TASK}\\\",\\\"request_detail\\\":\\\"${CLAUDE_REQUEST}\\\"}'"
+            "command": "jq -n --arg project \"${CLAUDE_CODE_PROJECT_NAME}\" --arg task \"${CLAUDE_TASK}\" --arg detail \"${CLAUDE_REQUEST}\" '{project_name:$project,task_name:$task,request_detail:$detail}' | curl -X POST -H \"Content-Type: application/json\" --data @- http://host.docker.internal:5678/webhook/notify"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "curl -X POST http://host.docker.internal:5678/webhook/notify -H \\\"Content-Type: application/json\\\" -d '{\\\"project_name\\\":\\\"keito4/config\\\",\\\"task_name\\\":\\\"${CLAUDE_TASK}\\\",\\\"request_detail\\\":\\\"${CLAUDE_REQUEST}\\\"}'"
}
]
}
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "jq -n --arg project \"${CLAUDE_CODE_PROJECT_NAME}\" --arg task \"${CLAUDE_TASK}\" --arg detail \"${CLAUDE_REQUEST}\" '{project_name:$project,task_name:$task,request_detail:$detail}' | curl -X POST -H \"Content-Type: application/json\" --data @- http://host.docker.internal:5678/webhook/notify"
}
]
}
🤖 Prompt for AI Agents
In .claude/settings.local.json around lines 31 to 41, the Stop-hook curl command
directly interpolates ${CLAUDE_TASK} and ${CLAUDE_REQUEST} into a JSON string,
risking invalid JSON or shell injection if these variables contain quotes or
special characters. To fix this, refactor the command to build the JSON payload
safely using a tool like jq -n or printf, then pass the JSON to curl via stdin
instead of embedding it inline. This avoids complex escaping and prevents
injection vulnerabilities.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant