Better git server config/management for issue refs #78
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?
Problem
When delegating work via
kugetsu start github.com/shoko/kugetsu#76, the tool needs to determine the actual git clone URL. Currently this is handled in two places:~/.kugetsu/repos.json) — a manual mapping of issue ref to repo URLget_repo_url()— constructs URL from issue ref formatrepos.json approach
Entries must be pre-registered before
kugetsu startworks. If an issue ref is not in repos.json, it falls through to the fallback.Fallback URL builder (current)
For
github.com/shoko/kugetsu#76, the fallback builds:Two problems:
git.fbrns.co. The fallback has no way to know which git server to use.https://github.com/kugetsu.git(missingshoko). The patched version includes owner but still wrong instance.extract_issue_ref_from_message() bug (related)
When delegating via full URL (e.g.,
https://git.fbrns.co/shoko/kugetsu/issues/78), the function that parses URLs is broken:For
https://git.fbrns.co/shoko/kugetsu/issues/78, this incorrectly captures from the protocol part (://git.fbrns.co) instead of the path part (/shoko/kugetsu), producing garbage likegit.fbrns.co/git.fbrns.co/shoko/issues#78instead ofgit.fbrns.co/shoko/kugetsu#78.This makes URL-based delegation fail even when repos.json has the correct entry.
Current workaround
Manually add entries to repos.json before delegating:
This is error-prone and requires manual steps before delegation.
Proposed solutions
Option A: Git server registry
Add a config file (e.g.,
~/.kugetsu/servers.json) that maps git hostnames to instances:Then
get_repo_urluses the issue ref hostname directly, falling back to github.com only for baregithub.comrefs with no known git server.Option B: Default server per namespace
Allow repos.json entries to use short keys that map to specific git servers:
get_repo_urlwould try progressively shorter keys until it finds a match.Option C: Delegate self-registration
PM agent automatically adds issue refs to repos.json before calling
kugetsu start. Requires PM agent to know the correct repo URL ahead of time.Questions
extract_issue_ref_from_messageURL parsing be fixed as part of this issue, or split into a separate bugfix?References
extract_issue_ref_from_message()URL parsing bug (see description above)kugetsu could support multiple git server instances, and the example right now is sufficient.
default fallback from the kugetsu init should always refer to github.com, but yes its should be configurable in a way that we could change the default midway without restarting kugetsu
what do you think of a dedicated command for a better UX? like for example "getting a git server" it will fallback to default one if not given, then we can verify if the fallback value is our wanted git server or not. we can also list all the git server that we have. we can add them as well. I think its the same think for the git server's username and repositories as well. do you have suggestions?
Thanks for the feedback han. Delegating to PM to review and respond to your suggestions about dedicated git-server commands. Will update shortly.
Implementation Proposal
Based on the discussion, here is my proposed implementation:
1. Server Configuration File (
~/.kugetsu/servers.json)2. New
kugetsu serverCommand3. Modified
get_repo_url()Logic4. Questions
kugetsu init(e.g., extract from git config)?servers.jsonthe right filename, or should it be part of the existing config file?Does this approach make sense? Any preferences on naming or structure?
in the kugetsu server command, is there no modify and delete command? I think during init, we should prompt to user if they want to add new server or left as default one (github). no server aliases are not needed right now, it can be for improvement but not for this blocking issue. yes I think servers.json is good enough.
but the question can we utilize the kugetsu config file instead of making a new servers json file? what do you think?