Gitea/Forgjo Skills Support #20
Reference in New Issue
Block a user
Delete Branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Thinking Path
server/src/services/company-skills.ts) only knew how to fetch skill repos from GitHub.git.farh.net(Gitea/Forgejo). Without native Gitea support, those repos can't be imported as URL-sourced skills — operators have to vendor them locally, which defeats the point of remote skill sources.devtolocalso it ships in the deployed image.What Changed
Three commits on top of `local` (full diff = `local..dev`):
New `server/src/services/gitea-fetch.ts` + `gitea-skills.ts` modules: URL parser, hostname probe (`/api/v1/version`) with FIFO-evicted process-lifetime cache, default-branch resolution, paginated tree traversal, canonical + legacy `/raw/...` URL fallback, and a `fetchGiteaBranch` helper for update checks. Dispatcher in `readUrlSkillImports` routes to the Gitea path when the host probes positive. Wired through `company-portability.ts`, `company-export-readme.ts`, `feedback.ts`, the CLI client (`cli/src/commands/client/skills.ts`), shared types/validators, and the `CompanySkills` UI page. Stored skills get `sourceType: "gitea"`, are read-only, and participate in the existing update-check + content-fetch paths.
Gitea's `/repos/{o}/{r}/commits/{ref}` only resolves SHAs, not branch names — switched `resolveGiteaPinnedRef` to use the branches endpoint, which accepts both branches and tags.
Verification
Risks
Model Used
Gitea's /repos/{o}/{r}/commits/{ref} only resolves 40-hex SHAs — a branch name like "main" returns 404 even when the branch exists. GitHub's API is more lenient and resolves branch names server-side. resolveGiteaPinnedRef was calling /commits/{ref} and 404ing on branch refs, so the entire import path failed before it could read the tree. updateStatus already used the branches endpoint correctly; this aligns resolveGiteaPinnedRef with it. resolveGiteaCommitSha is now a SHA-only helper that refuses to make the API call for non-SHA refs (matches Gitea's contract). Test mocks updated to return the branch response shape. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>deriveCanonicalSkillKey only emitted the owner/repo-based key for github and skills_sh sources, so Gitea skills fell through to the generic company/{companyId}/{slug} branch. Add gitea to the sourceType / sourceKind clause so a Gitea skill at git.example.com/owner/repo gets key owner/repo/{slug}, matching the GitHub format. Existing imports keep their old keys until re-imported. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>