Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:27:33 +08:00
commit 3f48e3c361
5 changed files with 89 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
{
"name": "opinionated-python-hook",
"description": "Strict Python formatter hook",
"version": "0.1.0",
"author": {
"name": "ftnext",
"email": "zhongweili@tubi.tv"
},
"hooks": [
"./hooks"
]
}

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# opinionated-python-hook
Strict Python formatter hook

15
hooks/hooks.json Normal file
View File

@@ -0,0 +1,15 @@
{
"hooks": {
"PostToolUse": [
{
"matcher": "Edit|Write",
"hooks": [
{
"type": "command",
"command": "jq -r '.tool_input.file_path' | { read file_path; if echo \"$file_path\" | grep -q '\\.py$'; then \"$CLAUDE_PLUGIN_ROOT\"/hooks/python_format.sh \"$file_path\"; fi; }"
}
]
}
]
}
}

10
hooks/python_format.sh Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -u
uvx hatch fmt "$1" 1>&2
exit_code=$?
if [ $exit_code -eq 1 ]; then
exit 2
else
exit $exit_code
fi

49
plugin.lock.json Normal file
View File

@@ -0,0 +1,49 @@
{
"$schema": "internal://schemas/plugin.lock.v1.json",
"pluginId": "gh:ftnext/claude-code:plugins/opinionated-python-hook",
"normalized": {
"repo": null,
"ref": "refs/tags/v20251128.0",
"commit": "92fbae564ee47746863fc952df3c5a7bfebbf70f",
"treeHash": "41f711fa2323c953174647afdda5e381e40b2b505d4044c41263b47a3e5f8c67",
"generatedAt": "2025-11-28T10:16:55.566890Z",
"toolVersion": "publish_plugins.py@0.2.0"
},
"origin": {
"remote": "git@github.com:zhongweili/42plugin-data.git",
"branch": "master",
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
},
"manifest": {
"name": "opinionated-python-hook",
"description": "Strict Python formatter hook",
"version": "0.1.0"
},
"content": {
"files": [
{
"path": "README.md",
"sha256": "dcbbb00eb1053cd7df8d6aba3b6e380ec730235aad731b524846317b4b4de6c5"
},
{
"path": "hooks/hooks.json",
"sha256": "14875a9fad3d3c5bb5cc34af5d60eeb1f6fedc50d818bd2c638aca67db4af2b1"
},
{
"path": "hooks/python_format.sh",
"sha256": "047d33a0ad8c19141a20d4965ae9bf8e680a902d40123ffe9bd420e007232de8"
},
{
"path": ".claude-plugin/plugin.json",
"sha256": "70dcec3b6534e9cfb5503e68bd33dce1679864830a46dd11477c363e53aef23c"
}
],
"dirSha256": "41f711fa2323c953174647afdda5e381e40b2b505d4044c41263b47a3e5f8c67"
},
"security": {
"scannedAt": null,
"scannerVersion": null,
"flags": []
}
}