Initial commit
This commit is contained in:
12
.claude-plugin/plugin.json
Normal file
12
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"name": "prettier-plugin",
|
||||||
|
"description": "Automatically formats files with Prettier after edits",
|
||||||
|
"version": "1.0.1",
|
||||||
|
"author": {
|
||||||
|
"name": "Eli Oshinsky",
|
||||||
|
"email": "elimelech.oshinsky@gmail.com"
|
||||||
|
},
|
||||||
|
"hooks": [
|
||||||
|
"./hooks"
|
||||||
|
]
|
||||||
|
}
|
||||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# prettier-plugin
|
||||||
|
|
||||||
|
Automatically formats files with Prettier after edits
|
||||||
15
hooks/hooks.json
Normal file
15
hooks/hooks.json
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"hooks": {
|
||||||
|
"PostToolUse": [
|
||||||
|
{
|
||||||
|
"matcher": "Edit|Write|MultiEdit",
|
||||||
|
"hooks": [
|
||||||
|
{
|
||||||
|
"type": "command",
|
||||||
|
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/prettier-format.sh"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
40
hooks/prettier-format.sh
Executable file
40
hooks/prettier-format.sh
Executable file
@@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Prettier hook for Claude Code (Plugin Mode)
|
||||||
|
# Formats files with prettier after edits and outputs JSON format
|
||||||
|
|
||||||
|
# Source utilities
|
||||||
|
source "$(dirname "$0")/../../shared/hooks/utils.sh"
|
||||||
|
|
||||||
|
# Helper function to output JSON and exit
|
||||||
|
output_json() {
|
||||||
|
echo "$1"
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Read input from stdin
|
||||||
|
INPUT=$(cat)
|
||||||
|
|
||||||
|
# Parse input and extract fields
|
||||||
|
if ! parse_hook_input "$INPUT"; then
|
||||||
|
output_json '{}'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if project has local prettier hook override
|
||||||
|
if has_project_hook_override "$PROJECT_DIR" "prettier"; then
|
||||||
|
output_json '{}'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if project has prettier configured
|
||||||
|
if ! has_prettier_config "$PROJECT_DIR"; then
|
||||||
|
output_json '{}'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the appropriate package runner
|
||||||
|
PKG_RUNNER=$(get_package_runner)
|
||||||
|
|
||||||
|
# Run prettier on the file (always succeed regardless of outcome)
|
||||||
|
cd "$PROJECT_DIR" && $PKG_RUNNER prettier --write "$FILE_PATH" >/dev/null 2>&1
|
||||||
|
|
||||||
|
# Always return empty JSON with success status
|
||||||
|
output_json '{}'
|
||||||
49
plugin.lock.json
Normal file
49
plugin.lock.json
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
{
|
||||||
|
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||||
|
"pluginId": "gh:eli0shin/cli-lsp-client:claude-plugins/prettier-plugin",
|
||||||
|
"normalized": {
|
||||||
|
"repo": null,
|
||||||
|
"ref": "refs/tags/v20251128.0",
|
||||||
|
"commit": "9afe13203d3486923f173a14e0c0755135d0d7e9",
|
||||||
|
"treeHash": "6cb1aec87d0eef19d0a3fbfdf463c7707abf17b1db18a25ccd593419be7785de",
|
||||||
|
"generatedAt": "2025-11-28T10:16:45.970996Z",
|
||||||
|
"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": "prettier-plugin",
|
||||||
|
"description": "Automatically formats files with Prettier after edits",
|
||||||
|
"version": "1.0.1"
|
||||||
|
},
|
||||||
|
"content": {
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"path": "README.md",
|
||||||
|
"sha256": "d3ff5a0c255e8e36a5b6365e6ab44257abbd8fb9a80798e1e78f4b474a097a71"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "hooks/hooks.json",
|
||||||
|
"sha256": "a60661fe2fa430fa7e6d32c8e5149c8d0f89b85457218f14ba3f4ba634ec3dd6"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "hooks/prettier-format.sh",
|
||||||
|
"sha256": "75f349f1737bc51e07b7cb5bf740ffb62b768d90c71087e1e4e52d54a26a13eb"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": ".claude-plugin/plugin.json",
|
||||||
|
"sha256": "88e9f8a28c3b39c401c8559c84f138e25bfdb12f904ff20f0521311c23dea271"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dirSha256": "6cb1aec87d0eef19d0a3fbfdf463c7707abf17b1db18a25ccd593419be7785de"
|
||||||
|
},
|
||||||
|
"security": {
|
||||||
|
"scannedAt": null,
|
||||||
|
"scannerVersion": null,
|
||||||
|
"flags": []
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user