5.6 KiB
Gitea Connector for Claude Code — Design Spec
Date: 2026-04-01 Status: Approved Author: Seth + Claude
Overview
A Claude Code plugin that lets collaborators connect to Seth's Gitea instance (git.sethpc.xyz) with their own accounts. Bundles an adapted bash CLI and provides guided setup, commit conventions, and Gitea-aware skills.
Target users: Friends and collaborators Seth invites, who have their own Gitea accounts on git.sethpc.xyz and use Claude Code.
Plugin Structure
gitea-connector/
├── plugin.json # Plugin manifest
├── commands/
│ └── gitea-setup.md # /gitea-setup slash command
├── skills/
│ └── gitea-workflow.md # Commit conventions & Gitea awareness
├── hooks/
│ └── push-reminder.sh # Post-commit push reminder (opt-in)
├── agents/
│ └── gitea-setup.md # Interactive setup agent
├── bin/
│ └── gitea # Bash CLI (external-only, no LAN)
└── README.md
Component Details
1. Bash CLI (bin/gitea)
Adapted from Seth's existing ~/bin/gitea with these changes:
- Host: Always
https://git.sethpc.xyz— no LAN detection, no192.168.0.125references. All users are external. - Username: Read from
~/.config/gitea/username(not hardcoded toSeth). - Token: Read from
~/.config/gitea/token(same convention as original). - Host override: Optional
~/.config/gitea/hostfile for future flexibility, defaults togit.sethpc.xyz.
Commands (unchanged interface):
gitea create <name> [--private] [--description "..."]
gitea remote <name>
gitea push
gitea delete <name>
gitea list
Drops the api_base() LAN/WAN probe function — replaced with a simple https://${GITEA_HOST}/api/v1 base URL.
2. Setup Flow (/gitea-setup)
Invokes the gitea-setup agent for interactive credential setup.
Steps:
- Dependency check: Verify
curl,jq,gitare installed. If missing, tell the user what to install and stop. - Existing config check: If
~/.config/gitea/tokenexists, ask if they want to reconfigure. - Collect username: Ask the user for their Gitea username.
- Walk through API key generation:
Go to
https://git.sethpc.xyz→ click your profile icon (top right) → Settings → Applications → under Manage Access Tokens, name itclaude-code, grant repo (read/write) and user (read) permissions, click Generate Token → paste the token back here. - Store credentials:
- Create
~/.config/gitea/if missing - Write
tokenandusernamefiles chmod 600both files
- Create
- Install CLI:
- Copy
bin/giteato~/bin/gitea chmod +x ~/bin/gitea- If
~/binnot on PATH, warn and suggest adding it
- Copy
- Validate:
GET /api/v1/userwith the token, confirm returned username matches what they entered. - Success message: Confirm everything works, list available commands.
Tone: Silly but appropriate throughout the entire experience — the setup agent's conversational messages, CLI help text, success/error messages, and skill descriptions should all have personality. Think friendly chaos goblin who knows their way around git, not corporate onboarding wizard.
3. Skill (skills/gitea-workflow.md)
Loaded into Claude Code's context when working in repos with a git.sethpc.xyz origin. Provides:
- Commit conventions (default-on, overridable):
- Conventional commits:
feat:,fix:,docs:,refactor:,test:,chore: - Commit every meaningful change immediately
- Always push after commit
- No squashing, no batching unrelated changes
- Conventional commits:
- Gitea CLI usage: Reference for
gitea create,remote,push,delete,list - Credential safety: Never commit tokens; ensure
.gitignorecovers.env, credential files,~/.config/gitea/ - Override mechanism: Users can override any convention in their project's CLAUDE.md
Trigger condition: Skill activates when current repo's origin URL contains git.sethpc.xyz.
4. Hook (hooks/push-reminder.sh)
- Type: PostToolUse hook on the
Bashtool - Trigger: Detects successful
git commitin command output - Action: Echoes a reminder to push
- Default: Disabled (opt-in via plugin settings)
5. Agent (agents/gitea-setup.md)
The interactive agent behind /gitea-setup. Uses AskUserQuestion to collect input step by step. Handles all the logic described in the setup flow above.
Error Handling
| Scenario | Behavior |
|---|---|
| Token invalid / expired | "That token didn't work. Generate a new one at Settings → Applications." |
| Gitea unreachable | "Can't reach git.sethpc.xyz. Check your network or VPN connection." |
~/bin not on PATH |
Warn and suggest adding it to shell profile |
| Token file exists, re-running setup | "Found existing config. Reconfigure? (y/N)" |
jq / curl / git not installed |
Check at start, list what's missing |
| Username mismatch (token returns different user) | "Token belongs to but you said . Which is correct?" |
Networking
- Always HTTPS to
git.sethpc.xyz(Caddy reverse proxy to Gitea CT 146) - No LAN IP references anywhere — all users are external
- Default host overridable via
~/.config/gitea/hostfile
Dependencies
curl— API callsjq— JSON parsinggit— repo operations
No other external dependencies. Pure bash CLI.
Out of Scope
- Multi-instance support (connecting to arbitrary Gitea servers)
- User account creation on Gitea (Seth invites users manually)
- SSH key setup (HTTPS + token auth only)
- CI/CD integration