mirror of
https://github.com/jmagar/unraid-mcp
synced 2026-04-21 13:37:53 +00:00
refactor: extract SessionStart hook into language-agnostic install-deps.sh
Replaces the inline uv-specific hook command with a shell script that detects the package manager from lock files (uv, npm, yarn, pnpm) and installs deps into CLAUDE_PLUGIN_DATA. Hook reduces to a single sh call. Bump 1.3.1 → 1.3.2
This commit is contained in:
parent
8d3c431da8
commit
cd1aaa4de2
6 changed files with 55 additions and 5 deletions
45
.claude-plugin/install-deps.sh
Executable file
45
.claude-plugin/install-deps.sh
Executable file
|
|
@ -0,0 +1,45 @@
|
|||
#!/bin/sh
|
||||
# install-deps.sh — language-agnostic dependency installer for Claude Code plugins.
|
||||
#
|
||||
# Detects the package manager from lock files and installs deps into
|
||||
# CLAUDE_PLUGIN_DATA on first run and whenever the lock file changes.
|
||||
# Follows the same diff-copy-install-or-rollback pattern as the npm example
|
||||
# in the Claude Code plugin docs.
|
||||
#
|
||||
# Supported: uv (Python), npm, yarn, pnpm
|
||||
|
||||
PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT}"
|
||||
DATA_DIR="${CLAUDE_PLUGIN_DATA}"
|
||||
|
||||
# sync_if_changed <lockfile> <install-command>
|
||||
# Skips install when the stored lockfile matches the bundled one.
|
||||
# On install failure, removes the stored lockfile so the next session retries.
|
||||
sync_if_changed() {
|
||||
lockfile="$1"
|
||||
install_cmd="$2"
|
||||
|
||||
if diff -q "${PLUGIN_ROOT}/${lockfile}" "${DATA_DIR}/${lockfile}" >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
cp "${PLUGIN_ROOT}/${lockfile}" "${DATA_DIR}/${lockfile}" \
|
||||
&& eval "${install_cmd}" \
|
||||
|| rm -f "${DATA_DIR}/${lockfile}"
|
||||
}
|
||||
|
||||
if [ -f "${PLUGIN_ROOT}/uv.lock" ]; then
|
||||
sync_if_changed "uv.lock" \
|
||||
"UV_PROJECT_ENVIRONMENT=\"${DATA_DIR}/.venv\" uv sync --project \"${PLUGIN_ROOT}\""
|
||||
|
||||
elif [ -f "${PLUGIN_ROOT}/package-lock.json" ]; then
|
||||
sync_if_changed "package-lock.json" \
|
||||
"npm ci --prefix \"${DATA_DIR}\""
|
||||
|
||||
elif [ -f "${PLUGIN_ROOT}/yarn.lock" ]; then
|
||||
sync_if_changed "yarn.lock" \
|
||||
"yarn install --cwd \"${PLUGIN_ROOT}\" --modules-folder \"${DATA_DIR}/node_modules\""
|
||||
|
||||
elif [ -f "${PLUGIN_ROOT}/pnpm-lock.yaml" ]; then
|
||||
sync_if_changed "pnpm-lock.yaml" \
|
||||
"pnpm install --dir \"${PLUGIN_ROOT}\" --virtual-store-dir \"${DATA_DIR}/pnpm-store\""
|
||||
fi
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "unraid-mcp",
|
||||
"displayName": "Unraid MCP",
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.2",
|
||||
"description": "Query, monitor, and manage Unraid servers via GraphQL API through MCP tools. Supports system info, Docker, VMs, array/parity, notifications, plugins, rclone, and live telemetry.",
|
||||
"author": {
|
||||
"name": "Jacob Magar",
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "diff -q \"${CLAUDE_PLUGIN_ROOT}/uv.lock\" \"${CLAUDE_PLUGIN_DATA}/uv.lock\" >/dev/null 2>&1 || (cp \"${CLAUDE_PLUGIN_ROOT}/uv.lock\" \"${CLAUDE_PLUGIN_DATA}/uv.lock\" && UV_PROJECT_ENVIRONMENT=\"${CLAUDE_PLUGIN_DATA}/.venv\" uv sync --project \"${CLAUDE_PLUGIN_ROOT}\") || rm -f \"${CLAUDE_PLUGIN_DATA}/uv.lock\""
|
||||
"command": "sh \"${CLAUDE_PLUGIN_ROOT}/.claude-plugin/install-deps.sh\""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "unraid-mcp",
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.2",
|
||||
"description": "Unraid server management via MCP.",
|
||||
"homepage": "https://github.com/jmagar/unraid-mcp",
|
||||
"repository": "https://github.com/jmagar/unraid-mcp",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.3.2] - 2026-04-05
|
||||
|
||||
### Changed
|
||||
- **SessionStart hook**: Extracted inline uv command into `.claude-plugin/install-deps.sh` — a language-agnostic script that detects the package manager from lock files (uv, npm, yarn, pnpm) and installs deps into `${CLAUDE_PLUGIN_DATA}`.
|
||||
|
||||
## [1.3.1] - 2026-04-05
|
||||
|
||||
### Changed
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "unraid-mcp",
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.2",
|
||||
"description": "Query, monitor, and manage Unraid servers via GraphQL API through MCP tools. Supports system info, Docker, VMs, array/parity, notifications, plugins, and live telemetry.",
|
||||
"mcpServers": {
|
||||
"unraid-mcp": {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ build-backend = "hatchling.build"
|
|||
# ============================================================================
|
||||
[project]
|
||||
name = "unraid-mcp"
|
||||
version = "1.3.1"
|
||||
version = "1.3.2"
|
||||
description = "MCP Server for Unraid API - provides tools to interact with an Unraid server's GraphQL API"
|
||||
readme = "README.md"
|
||||
license = {file = "LICENSE"}
|
||||
|
|
|
|||
Loading…
Reference in a new issue