[Bug] Projman plugin: repo auto-detection and org validation issues #64
Reference in New Issue
Block a user
Delete Branch "%!s()"
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?
Summary
During diagnostic and label sync operations on
personal-projects/personal-portfolio, several issues were identified with the projman Gitea MCP tools.Issues Identified
1. Repository Auto-Detection Not Working
Expected: MCP tools should auto-detect the repository from the git remote when
repoparameter is omitted.Actual: All calls fail with:
Impact: Every MCP call requires explicit
repoparameter, which is verbose and error-prone.Suggestion: Parse the git remote
originURL to extractowner/repo:2.
validate_repo_orgReturns False for Valid OrganizationExpected:
validate_repo_orgshould returntruefor repos under organizations.Actual: Returns
{"is_organization": false}forpersonal-projects/personal-portfolio.Possible causes:
personal-projectsmay be configured as a user account in Gitea rather than a true organizationTo investigate: Check Gitea admin to verify
personal-projectsentity type.3. Organization Labels Always Empty
Expected:
get_labelsshould return organization-level labels in theorganizationarray.Actual: Always returns:
Likely related to: Issue #2 - if the API doesn't recognize the owner as an organization, it won't fetch org-level labels.
Environment
personal-projects/personal-portfoliogitea.hotserv.cloudssh://git@hotserv.tailc9b278.ts.net:2222/personal-projects/personal-portfolio.gitSuggested Improvements
repoparameter is omittedLabels
Type: Bug,Priority: Medium,Complexity: MediumFixes Applied
Issue 1: Repository Auto-Detection ✅
File:
mcp-servers/gitea/mcp_server/config.pyAdded
_detect_repo_from_git()and_parse_git_url()methods that:git remote get-url originto get the remote URLssh://git@host:port/owner/repo.gitgit@host:owner/repo.githttps://host/owner/repo.gitGITEA_REPOenv var is not setIssue 2: Organization Validation ✅
File:
mcp-servers/gitea/mcp_server/gitea_client.pyChanged
is_org_repo()to use/orgs/{owner}endpoint instead of relying onowner.typefield (which was returningnullin Gitea API):_is_organization(owner)methodTrueif/orgs/{owner}returns 200,Falseif 404Issue 3: Organization Labels ✅
Fixed automatically by Issue 2 fix - now correctly fetches org-level labels for organization-owned repos.
Tests Added
test_parse_git_url_ssh_formattest_parse_git_url_ssh_short_formattest_parse_git_url_https_formattest_parse_git_url_http_formattest_parse_git_url_without_git_suffixtest_parse_git_url_invalid_formattest_is_organization_truetest_is_organization_falsetest_is_org_repo_uses_orgs_endpointAll 11 new tests passing.