mirror of
https://github.com/ivuorinen/emoji.git
synced 2026-03-13 06:00:03 +00:00
chore: add ruff formatter, .gitignore, and uv convention (#40)
* chore: add ruff formatter, .gitignore, and uv convention - Add ruff as dev dependency with basic config - Add PostToolUse hook to auto-run ruff on .py edits - Create .gitignore to exclude __pycache__ and settings.local.json - Document uv run convention in CLAUDE.md - Add CLAUDE.md, .claude/settings.json, and skills - Apply ruff formatting to existing Python files * fix: address CR feedback on hooks and uv run convention - Fix hooks to read file_path from stdin JSON via jq instead of nonexistent $CLAUDE_FILE env var - Update CLAUDE.md commands to use uv run python3 consistently - Update skills to use uv run for python/dedup commands
This commit is contained in:
71
.claude/settings.json
Normal file
71
.claude/settings.json
Normal file
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"hooks": {
|
||||
"PreToolUse": [
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "file=$(jq -r '.tool_input.file_path // empty'); if [[ \"$file\" == *README.md || \"$file\" == *index.html ]]; then echo 'BLOCKED: README.md and index.html are generated artifacts. Edit create_listing.py instead, then run /regen-listings.' >&2; exit 2; fi"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "file=$(jq -r '.tool_input.file_path // empty'); if [[ \"$file\" == */uv.lock || \"$file\" == uv.lock ]]; then echo 'BLOCKED: uv.lock is auto-generated. Modify pyproject.toml and run uv sync instead.' >&2; exit 2; fi"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "file=$(jq -r '.tool_input.file_path // empty'); if [[ \"$file\" == *.github/workflows/*.yml || \"$file\" == .github/workflows/*.yml ]]; then echo 'BLOCKED: CI workflows use pinned action SHAs with # version comments for security. Edit workflow files carefully and maintain the SHA-pinning convention.' >&2; exit 2; fi"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "file=$(jq -r '.tool_input.file_path // empty'); if [[ \"$file\" == */renovate.json || \"$file\" == renovate.json ]]; then echo 'BLOCKED: renovate.json is rarely edited. Make changes deliberately and confirm with the user first.' >&2; exit 2; fi"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "file=$(jq -r '.tool_input.file_path // empty'); if [[ \"$file\" == emoji/* || \"$file\" == */emoji/* ]]; then echo 'BLOCKED: Emoji image files should not be written by Claude. Manage images manually or use /dedup-check.' >&2; exit 2; fi"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "file=$(jq -r '.tool_input.file_path // empty'); if [[ \"$file\" == *.py ]]; then uv run ruff check --fix \"$file\" 2>&1 | tail -5 && uv run ruff format \"$file\" 2>&1 | tail -3; fi"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "Edit|Write",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "file=$(jq -r '.tool_input.file_path // empty'); if [[ \"$file\" == *.py ]]; then uv run pytest --tb=short -q 2>&1 | tail -5; fi"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
10
.claude/skills/dedup-check/SKILL.md
Normal file
10
.claude/skills/dedup-check/SKILL.md
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
name: dedup-check
|
||||
description: Run dedup in dry-run mode and report duplicate groups found
|
||||
disable-model-invocation: true
|
||||
---
|
||||
|
||||
## Steps
|
||||
|
||||
1. Run `uv run dedup --dry-run` from the project root
|
||||
2. Summarize the output — report how many duplicate groups were found and which files are involved
|
||||
11
.claude/skills/regen-listings/SKILL.md
Normal file
11
.claude/skills/regen-listings/SKILL.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
name: regen-listings
|
||||
description: Regenerate README.md and index.html from emoji/ contents and verify output
|
||||
disable-model-invocation: true
|
||||
---
|
||||
|
||||
## Steps
|
||||
|
||||
1. Run `uv run python3 create_listing.py` from the project root
|
||||
2. Confirm both `README.md` and `index.html` exist and are non-empty
|
||||
3. Report the file sizes of both generated files
|
||||
Reference in New Issue
Block a user