@mokoconsulting/mokogit-cli
v1.3.0
Published
gh-style command-line interface for MokoGit (/api/v1) — repos, PRs, issues, releases, and browser-based OAuth2 authentication
Maintainers
Readme
mokogit-cli
A gh-style command-line interface for MokoGit (the git server at git.mokoconsulting.tech). It mirrors the GitHub CLI's command system — auth, repo, pr, issue, release, api, browse — but speaks MokoGit's /api/v1, which gh cannot. Authentication is browser-based via OAuth2 (PKCE), so tokens can be requested and stored without ever leaving the terminal.
Why this exists
gh assumes every non-github.com host is GitHub Enterprise and validates tokens against /api/v3. MokoGit serves /api/v1, so gh's API commands 404 against MokoGit. mokogit-cli fills that gap with the same ergonomics.
Install
npm install -g @mokoconsulting/mokogit-cliOr from source:
git clone https://git.mokoconsulting.tech/MokoConsulting/mokogit-cli.git
cd mokogit-cli
npm install
npm run build
npm linkAuthenticate
Browser login (recommended) — opens MokoGit, you approve, the token is captured automatically:
mokogit auth login --webOther options:
mokogit auth login # opens the token page, prompts you to paste a PAT
echo "$TOKEN" | mokogit auth login --with-token
mokogit auth status # show who you are and token health
mokogit auth token # print the token (refreshed) for scripts/git
mokogit auth logoutThe browser flow uses OAuth2 Authorization-Code + PKCE against a pre-registered public
client. The CLI listens on an ephemeral http://127.0.0.1:<port>/callback, receives the
authorization code, and exchanges it for an access + refresh token. Access tokens are
refreshed automatically when they near expiry. Credentials live in
~/.config/mokogit/hosts.json (owner-readable). MOKOGIT_TOKEN overrides the store, and
MOKOGIT_HOST overrides the default host — mirroring GH_TOKEN / GH_HOST.
Usage
mokogit repo list --org MokoConsulting
mokogit repo view MokoConsulting/mokogit-cli
mokogit repo create my-project --org MokoConsulting --private
mokogit repo clone MokoConsulting/mokogit-cli
mokogit pr list -R MokoConsulting/mokogit-cli
mokogit pr view 12 -R MokoConsulting/mokogit-cli
mokogit pr create --head feature/x --base main --title "Add x"
mokogit issue list -R MokoConsulting/mokogit-cli
mokogit issue create --title "Bug" --body "…" -R MokoConsulting/mokogit-cli
mokogit release list -R MokoConsulting/mokogit-cli
mokogit release create v1.2.0 --title "1.2.0" --notes "…"
mokogit api /user
mokogit api -X POST /repos/OWNER/REPO/issues -f title="Bug" -f body="…"
mokogit browse -R MokoConsulting/mokogit-cliInside a MokoGit clone, -R/--repo is inferred from the origin remote. Add --json to
any command for raw JSON output.
Requirements
- Node.js 20.0.0 or later
giton PATH (forrepo clone)
License
GNU General Public License v3.0 or later — see LICENSE.
