feat: add HTTP proxy, custom CA, metrics exposure, and category filtering

- Add createHttpAgent() for proxy/CA support via undici
- Thread dispatcher through all registry sources
- Add collectMetrics() for SRE metrics exposure
- Add caPath to RegistryClientConfig
- Add category field to RegistryServer with Glama extraction
- Add category filtering in client search
- Add pr.sh for Gitea PR creation

63 tests passing (13 new).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michal
2026-02-21 03:53:08 +00:00
parent 386029d052
commit 53245b4826
15 changed files with 447 additions and 16 deletions

68
pr.sh Executable file
View File

@@ -0,0 +1,68 @@
#!/bin/bash
# pr.sh - Create PRs on Gitea from current branch
# Usage: ./pr.sh [base_branch] [title]
set -euo pipefail
GITEA_API="http://10.0.0.194:3012/api/v1"
GITEA_PUBLIC="https://mysources.co.uk"
GITEA_TOKEN="$(grep '^GITEA_TOKEN=' /home/michal/developer/michalzxc/claude/homeassistant-alchemy/stack/.env | cut -d= -f2-)"
REPO="michal/mcpctl"
if [[ -z "$GITEA_TOKEN" ]]; then
echo "Error: GITEA_TOKEN not found" >&2
exit 1
fi
BRANCH=$(git branch --show-current)
BASE="${1:-main}"
TITLE="${2:-}"
if [[ "$BRANCH" == "$BASE" ]]; then
echo "Error: already on $BASE, switch to a feature branch first" >&2
exit 1
fi
# Check for existing open PR for this branch
EXISTING=$(curl -s "$GITEA_API/repos/$REPO/pulls?state=open&head=$BRANCH" \
-H "Authorization: token $GITEA_TOKEN" | jq -r '.[0].number // empty' 2>/dev/null)
if [[ -n "$EXISTING" ]]; then
echo "PR #$EXISTING already exists for $BRANCH"
echo "$GITEA_PUBLIC/$REPO/pulls/$EXISTING"
exit 0
fi
# Auto-generate title from branch name if not provided
if [[ -z "$TITLE" ]]; then
TITLE=$(echo "$BRANCH" | sed 's|^feat/||;s|^fix/||;s|^chore/||' | tr '-' ' ' | sed 's/.*/\u&/')
fi
# Build body from commit messages on this branch
COMMITS=$(git log "$BASE..$BRANCH" --pretty=format:"- %s" 2>/dev/null)
BODY="## Summary
${COMMITS}
---
Generated with [Claude Code](https://claude.com/claude-code)"
# Push if needed
if ! git rev-parse --verify "origin/$BRANCH" &>/dev/null; then
echo "Pushing $BRANCH to origin..."
git push -u origin "$BRANCH"
fi
# Create PR
RESPONSE=$(curl -s -X POST "$GITEA_API/repos/$REPO/pulls" \
-H "Content-Type: application/json" \
-H "Authorization: token $GITEA_TOKEN" \
-d "$(jq -n --arg title "$TITLE" --arg body "$BODY" --arg head "$BRANCH" --arg base "$BASE" \
'{title: $title, body: $body, head: $head, base: $base}')")
PR_NUM=$(echo "$RESPONSE" | jq -r '.number // empty')
if [[ -z "$PR_NUM" ]]; then
echo "Error creating PR: $(echo "$RESPONSE" | jq -r '.message // "unknown error"')" >&2
exit 1
fi
echo "Created PR #$PR_NUM: $TITLE"
echo "$GITEA_PUBLIC/$REPO/pulls/$PR_NUM"