@event4u/agent-config 1.36.1 → 1.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env bash
2
+ # mcp_setup.sh — One-line MCP server onboarding.
3
+ # Creates .venv-mcp/ (gitignored) and installs the `mcp` SDK.
4
+ # Idempotent: safe to re-run; reuses an existing .venv-mcp/.
5
+
6
+ set -euo pipefail
7
+
8
+ VENV_DIR=".venv-mcp"
9
+
10
+ log_ok() { echo "✅ $*"; }
11
+ log_warn() { echo "⚠️ $*" >&2; }
12
+ log_err() { echo "❌ $*" >&2; }
13
+
14
+ # --- Locate a Python ≥ 3.11 ---
15
+ find_python() {
16
+ for cand in python3.13 python3.12 python3.11; do
17
+ if command -v "$cand" >/dev/null 2>&1; then
18
+ echo "$cand"
19
+ return 0
20
+ fi
21
+ done
22
+ if command -v python3 >/dev/null 2>&1; then
23
+ local ver
24
+ ver="$(python3 -c 'import sys; print("%d.%d" % sys.version_info[:2])')"
25
+ case "$ver" in
26
+ 3.11|3.12|3.13|3.1[4-9]|3.[2-9][0-9]) echo "python3"; return 0 ;;
27
+ esac
28
+ fi
29
+ return 1
30
+ }
31
+
32
+ PY="$(find_python || true)"
33
+ if [[ -z "${PY:-}" ]]; then
34
+ log_err "Python 3.11+ not found."
35
+ log_err "Install Python 3.11+ (e.g. via pyenv, asdf, brew, or apt) and re-run."
36
+ exit 1
37
+ fi
38
+
39
+ PY_VER="$("$PY" -c 'import sys; print("%d.%d.%d" % sys.version_info[:3])')"
40
+
41
+ # --- Create or reuse venv ---
42
+ if [[ -d "$VENV_DIR" ]]; then
43
+ log_ok "$VENV_DIR/ exists — reusing (Python $("$VENV_DIR/bin/python" --version 2>&1 | awk '{print $2}'))"
44
+ else
45
+ "$PY" -m venv "$VENV_DIR"
46
+ log_ok "Created $VENV_DIR/ with $PY ($PY_VER)"
47
+ fi
48
+
49
+ # --- Install / upgrade mcp SDK ---
50
+ "$VENV_DIR/bin/pip" install --quiet --upgrade pip
51
+ "$VENV_DIR/bin/pip" install --quiet --upgrade mcp
52
+
53
+ MCP_VER="$("$VENV_DIR/bin/python" -c 'import mcp, importlib.metadata as m; print(m.version("mcp"))' 2>/dev/null || echo "?")"
54
+ log_ok "Installed mcp SDK ($MCP_VER) in $VENV_DIR/"
55
+
56
+ # --- Smoke: import the server module ---
57
+ if ! "$VENV_DIR/bin/python" -c 'import scripts.mcp_server' 2>/dev/null; then
58
+ log_warn "scripts.mcp_server import failed — check repository checkout."
59
+ exit 1
60
+ fi
61
+ log_ok "scripts.mcp_server import OK"
62
+
63
+ # --- Print client config snippet ---
64
+ ROOT="$(pwd)"
65
+ PY_BIN="$ROOT/$VENV_DIR/bin/python"
66
+
67
+ echo ""
68
+ echo "── MCP server ready ─────────────────────────────────────────"
69
+ echo ""
70
+ echo "Run over stdio:"
71
+ echo " task mcp:run"
72
+ echo ""
73
+ echo "Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):"
74
+ cat <<JSON
75
+ {
76
+ "mcpServers": {
77
+ "agent-config": {
78
+ "command": "$PY_BIN",
79
+ "args": ["-m", "scripts.mcp_server"],
80
+ "env": { "PYTHONPATH": "$ROOT" }
81
+ }
82
+ }
83
+ }
84
+ JSON
85
+ echo ""
86
+ echo "After saving the config: ⌘Q Claude Desktop and restart."
87
+ echo "──────────────────────────────────────────────────────────────"
@@ -2948,6 +2948,13 @@ def main() -> int:
2948
2948
 
2949
2949
  paths = sorted(set(paths))
2950
2950
  if not paths:
2951
+ # Emit a valid empty payload when a structured format was requested
2952
+ # so downstream parsers (e.g. PR-summary workflows) don't fail on an
2953
+ # empty stdout. stderr keeps the human-readable note.
2954
+ if args.report:
2955
+ print(format_report([]))
2956
+ elif args.format == "json":
2957
+ print(format_json([]))
2951
2958
  print("No matching skill/rule files found.", file=sys.stderr)
2952
2959
  return 0
2953
2960