Skip to content

Commit 9da9c87

Browse files
authored
fix(hooks): warn at session start when VGV CLI is missing or outdated (#55)
1 parent fc57377 commit 9da9c87

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

CLAUDE.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ hooks/
2020
check-vgv-cli.sh # Validates VGV CLI installed and >= 1.1.0
2121
format.sh # Runs dart format on modified .dart files
2222
vgv-cli-common.sh # Shared utilities for VGV CLI hook scripts
23+
warn-missing-mcp.sh # Warns at session start if VGV CLI is missing/outdated
2324
skills/
2425
accessibility/SKILL.md
2526
accessibility/reference.md
@@ -69,7 +70,13 @@ Every `SKILL.md` follows this structure:
6970

7071
## Hooks
7172

72-
The `hooks/` directory contains PreToolUse and PostToolUse hooks defined in `hooks.json`.
73+
The `hooks/` directory contains SessionStart, PreToolUse, and PostToolUse hooks defined in `hooks.json`.
74+
75+
### SessionStart Hooks
76+
77+
These run **when a session begins**:
78+
79+
- `warn-missing-mcp.sh` — checks if Very Good CLI is installed and >= 1.1.0; outputs a warning to Claude's context if missing or outdated (non-blocking)
7380

7481
### PreToolUse Hooks
7582

hooks/hooks.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
{
22
"description": "Very Good AI Flutter Plugin hooks for Dart and Flutter development",
33
"hooks": {
4+
"SessionStart": [
5+
{
6+
"hooks": [
7+
{
8+
"type": "command",
9+
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/warn-missing-mcp.sh",
10+
"timeout": 10
11+
}
12+
]
13+
}
14+
],
415
"PreToolUse": [
516
{
617
"matcher": "mcp__very-good-cli__.*",

hooks/scripts/warn-missing-mcp.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# SessionStart hook: warn when Very Good CLI is missing or outdated.
3+
# Output is injected into Claude's context (not displayed in the terminal).
4+
# Non-blocking — always exits 0.
5+
6+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7+
source "$SCRIPT_DIR/vgv-cli-common.sh"
8+
9+
cli_status=$(check_vgv_cli)
10+
case "$cli_status" in
11+
not_installed)
12+
echo "⚠️ Very Good CLI is not installed. The Very Good CLI MCP server will not work without Very Good CLI >= ${MIN_VERSION}. Install with: dart pub global activate very_good_cli"
13+
;;
14+
outdated:*)
15+
version="${cli_status#outdated:}"
16+
echo "⚠️ Very Good CLI ${version} is too old. The Very Good CLI MCP server requires >= ${MIN_VERSION}. Update with: dart pub global activate very_good_cli"
17+
;;
18+
esac
19+
20+
exit 0

0 commit comments

Comments
 (0)