-
Notifications
You must be signed in to change notification settings - Fork 1
chore(devkit): migrate git hooks to husky #41
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
99aeda6
chore(devkit): migrate git hooks to husky
masseater d823bd5
refactor(devkit): inline husky hook scripts
masseater 05d0321
Merge origin/master into migrate-husky
masseater 3fd4501
style(github-workflow): restore multiline formatting
masseater 2dd9cb4
chore(github-workflow): bump version after merge formatting
masseater 4b0c02a
chore: simplify lint-staged commands
masseater 4bb3140
chore: migrate from lefthook to husky
masseater 58b0bec
chore(mutils): bump version to 0.18.9
masseater 4c18fbb
chore: add .agents/tmp/ to .gitignore
masseater ef45f97
fixup: auto-sync from pre-push
masseater 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
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,43 @@ | ||
| { | ||
| $schema: "https://docs.renovatebot.com/renovate-schema.json", | ||
| extends: ["config:recommended"], | ||
| prConcurrentLimit: 10, | ||
| automerge: true, | ||
| automergeType: "pr", | ||
| packageRules: [ | ||
| { | ||
| matchUpdateTypes: ["major"], | ||
| automerge: false, | ||
| }, | ||
| { | ||
| matchUpdateTypes: ["lockFileMaintenance"], | ||
| automerge: true, | ||
| }, | ||
| { | ||
| groupName: "biomejs", | ||
| matchPackageNames: ["@biomejs/biome"], | ||
| }, | ||
| { | ||
| groupName: "typescript", | ||
| matchPackageNames: ["typescript", "@typescript/native-preview"], | ||
| }, | ||
| { | ||
| groupName: "radix-ui", | ||
| matchPackagePrefixes: ["@radix-ui/"], | ||
| }, | ||
| { | ||
| groupName: "storybook", | ||
| matchPackagePrefixes: ["@storybook/"], | ||
| }, | ||
| { | ||
| groupName: "tanstack", | ||
| matchPackagePrefixes: ["@tanstack/"], | ||
| }, | ||
| { | ||
| groupName: "tailwindcss", | ||
| matchPackagePrefixes: ["@tailwindcss/"], | ||
| matchPackageNames: ["tailwindcss", "tailwind-merge"], | ||
| }, | ||
| ], | ||
| schedule: ["before 6am on Saturday"], | ||
| } |
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 |
|---|---|---|
|
|
@@ -12,9 +12,11 @@ | |
| node_modules/ | ||
| dist/ | ||
| .turbo/ | ||
| .husky/_/ | ||
| docs/api/ | ||
| .serena/ | ||
|
|
||
| !.claude/.turbo | ||
| coverage/ | ||
| .specstory/ | ||
| .agents/tmp/ | ||
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,82 @@ | ||
| #!/bin/sh | ||
| set -eu | ||
|
|
||
| bunx lint-staged | ||
|
|
||
| printf '%s\n' "Running security check..." | ||
|
|
||
| staged_diff=$(git diff --cached) | ||
|
|
||
| if [ -z "$staged_diff" ]; then | ||
| printf '%s\n' "No staged changes. Skipping security check." | ||
| exit 0 | ||
| fi | ||
|
|
||
| temp_file=$(mktemp) | ||
| prompt_file=$(mktemp) | ||
|
|
||
| cleanup() { | ||
| rm -f "$temp_file" "$prompt_file" | ||
| } | ||
|
|
||
| trap cleanup EXIT HUP INT TERM | ||
|
|
||
| printf '%s' "$staged_diff" > "$temp_file" | ||
|
|
||
| cat > "$prompt_file" <<'EOF' | ||
| 以下のgit diffの内容をセキュリティの観点で分析してください。 | ||
|
|
||
| チェック項目: | ||
| - APIキー、パスワード、トークンなどの機密情報のハードコード | ||
| - 危険な関数やコマンドの使用(eval, exec, system呼び出しなど) | ||
| - SQLインジェクション、XSSなどの脆弱性 | ||
| - 企業の機密情報や非公開の技術情報 | ||
| - セキュリティ設定の不適切な変更 | ||
| - ユーザー固有の記述(例:PC名、ユーザー名など)。 | ||
| - tmpファイルなどgitにコミットされないファイルなら問題ない。 | ||
|
|
||
| 問題がある場合は「SECURITY_RISK:」で始まる行で具体的に指摘してください。 | ||
| 問題がない場合は「OK」とだけ回答してください。 | ||
|
|
||
| 差分内容: | ||
| ```diff | ||
| EOF | ||
|
|
||
| cat "$temp_file" >> "$prompt_file" | ||
| printf '\n```\n' >> "$prompt_file" | ||
|
|
||
| if ! command -v claude >/dev/null 2>&1; then | ||
| printf '%s\n' "claude command not found. Unable to run security check." | ||
| exit 1 | ||
| fi | ||
|
|
||
| saved_claudecode=${CLAUDECODE-} | ||
| unset CLAUDECODE | ||
|
|
||
| if ! result=$(claude --permission-mode default --settings '{"disableAllHooks": true}' --append-system-prompt-file "$prompt_file" -p "pls review" 2>/dev/null); then | ||
| if [ -n "$saved_claudecode" ]; then | ||
| export CLAUDECODE="$saved_claudecode" | ||
| fi | ||
| printf '%s\n' "Security check failed because claude did not return a valid response." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -n "$saved_claudecode" ]; then | ||
| export CLAUDECODE="$saved_claudecode" | ||
| fi | ||
|
|
||
| printf '%s\n' "========== RESULT ==========" | ||
| printf '%s\n' "$result" | ||
|
|
||
| if printf '%s\n' "$result" | grep -q "SECURITY_RISK:"; then | ||
| printf '%s\n' "Security risk detected. Commit aborted." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if printf '%s\n' "$result" | grep -qw "OK"; then | ||
| printf '%s\n' "Security check passed." | ||
| exit 0 | ||
| fi | ||
|
|
||
| printf '%s\n' "Security check result was ambiguous. Commit aborted." | ||
| exit 1 | ||
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,30 @@ | ||
| #!/bin/sh | ||
| set -eu | ||
|
|
||
| bun run build | ||
| bun run typecheck | ||
| bun run check | ||
| bun run test | ||
| bun run knip | ||
|
|
||
| bun run hooks:plugin-list-sync | ||
| bunx oxfmt AGENTS.md .claude-plugin/marketplace.json | ||
|
|
||
| if [ -n "$(git status --porcelain -- AGENTS.md .claude-plugin/marketplace.json)" ]; then | ||
| git add AGENTS.md .claude-plugin/marketplace.json | ||
|
|
||
| if [ -n "$(git diff --cached --name-only -- AGENTS.md .claude-plugin/marketplace.json)" ]; then | ||
| git commit -m "chore: auto-sync plugin list" | ||
| fi | ||
| fi | ||
|
|
||
| bun run docs | ||
| bunx oxfmt docs/api/ | ||
|
|
||
| if [ -n "$(git status --porcelain -- docs/api)" ]; then | ||
| git add docs/api | ||
|
|
||
| if [ -n "$(git diff --cached --name-only -- docs/api)" ]; then | ||
| git commit -m "docs: auto-sync API reference" | ||
| fi | ||
| fi |
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 @@ | ||
| .claude-plugin/marketplace.json |
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
Oops, something went wrong.
Oops, something went wrong.
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.
OKdetection is too permissive and can bypass the gate.Current matching accepts any output containing the word
OK(e.g.,NOT OK). This can incorrectly allow unsafe commits.🔧 Proposed fix (strict success match)
📝 Committable suggestion
🤖 Prompt for AI Agents