migrate to any-cli/kit, add 20 commands#2
Open
tamnd wants to merge 1 commit into
Open
Conversation
Replace cobra/fang/pkg/render with the any-cli/kit framework. Drop cli/cmd_*.go, cli/output.go, cli/errors.go, cli/version.go, pkg/render/. gitee/ gains api.go (20 typed API methods), wire.go (all wire→public converters, wireLicense dual-form, base64 README decode), ids.go (ParseRepoSlug), domain.go (kit.Domain + Session + newClient + MapErr), ops.go (20 kit.Handle registrations: user, user repos, followers, following, repo, commits, branches, tags, releases, issues, pulls, readme, tree, stargazers, forks, contributors, search repos, search users, org, org repos). gitee.go gets Token field + addToken(), ErrUnauthorized, ErrRateLimit. types.go fully rewritten with table/kit struct tags. Test suite updated; ids_test.go added.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rewrites the cobra-based CLI onto the
any-cli/kitframework and adds 15 new commands on top of the original 5.Commands added (20 total):
User group:
gitee user <username>— full user profilegitee repos <username>— public repos (--sort, --direction)gitee followers <username>— follower listgitee following <username>— following listRepo group:
gitee repo <owner/repo>— repo metadatagitee commits <owner/repo>— commit list (--sha, --path, --author, --since, --until)gitee branches <owner/repo>— branch listgitee tags <owner/repo>— tag list (--sort, --direction)gitee releases <owner/repo>— release listgitee issues <owner/repo>— issue list (--state, --sort, --direction)gitee pulls <owner/repo>— PR list (--state, --sort, --direction)gitee readme <owner/repo>— README decoded text (--ref)gitee tree <owner/repo>— recursive file tree (--ref, --recursive)gitee stargazers <owner/repo>— stargazersgitee forks <owner/repo>— forks (--sort)gitee contributors <owner/repo>— contributors (--type)Search group:
gitee search repos <query>— search repos (--sort)gitee search users <query>— search usersOrg group:
gitee org <name>— org profilegitee org repos <name>— org repos (--type, --sort, --direction)Key implementation notes:
numberisstring(alphanumeric like"IJUFI0") — Gitee API contractUser.Staredpreserves the"stared"API typo exactly (not "starred")Repo.URLstrips.gitsuffix from wirehtml_urlfrom/sizepagination (Elasticsearch-style), notpage/per_pageGITEE_TOKENenv var for higher rate limits (20,000 req/hr vs ~60 anonymous)wireLicensehandles both object and bare-string forms via customUnmarshalJSONDeleted: All cobra/fang-specific files (cli/cmd_*.go, cli/output.go, cli/errors.go, pkg/)
Test plan
go build ./...cleango test -race -count=1 ./...passes (httptest-backed, no network)gitee user torvalds,gitee repos oschina,gitee repo oschina/git-osc,gitee issues oschina/git-osc