opencodehub-cli
v1.1.1
Published
Stack-first PR workflows from your terminal - CLI for OpenCodeHub
Downloads
136
Maintainers
Readme
Why OCH
- Fast command-line workflows for repositories, pull requests, issues, and reviews.
- Stack-first branch/PR flow for multi-PR delivery.
- Secure authentication model with OS credential storage support.
- Built-in API tooling for scripting and automation.
Installation
npm install -g opencodehub-cliVerify:
och --version
och --helpQuick Start
# 1) Authenticate
och auth login --url https://git.example.com
# 2) Inspect your setup
och config doctor
# 3) Push and open PR workflow
cd your-repo
och repo push
# 4) Create a pull request
och pr create --base main --title "feat: add onboarding"Core Commands
och authauthentication (login,logout,status)och configCLI settings and diagnostics (list,set,doctor)och reporepository operations (create,clone,push,list)och prpull request lifecycle (create,list,view,merge, ...)och stackstacked branch/PR workflows (create,submit,sync, ...)och reviewcode review + AI review flowsoch issueissue managementoch ci,och queue,och metrics,och insights,och notify,och automateoch apidirect API requests (useful for scripts)
Run och <command> --help for full command options.
Authentication and Security
Login
och auth login --url https://git.example.comFor non-interactive environments:
och auth login --url https://git.example.com --token <PERSONAL_ACCESS_TOKEN>Token storage behavior
OCH_TOKENenv var always takes precedence.- macOS: Keychain (
security) - Linux: Secret Service (
secret-tool) - Windows: DPAPI-encrypted storage via PowerShell
- Fallback: local CLI config storage if secure backend is unavailable
Helpful environment variables
OCH_TOKEN: inject token from environmentOCH_HTTP_TIMEOUT_MS: HTTP timeout in ms (default15000)OCH_DISABLE_KEYCHAIN=1: disable credential backend (useful in CI/tests)
Configuration
Inspect current configuration:
och config list
och config path
och config doctorSet values:
och config set serverUrl https://git.example.com
och config set defaultBranch main
och config set insecure falseCommon Workflows
Repository lifecycle
# Create a remote repository
och repo create my-service --description "Internal API service"
# Clone repository
och repo clone acme/my-service
# Push local repository
och repo push --branch mainPull request lifecycle
# Create PR from current branch
och pr create --base main --title "feat: add API pagination"
# List open PRs
och pr list --state open
# View PR details
och pr view 42
# Merge PR
och pr merge 42Stack workflow
# Create first stack branch
och stack create auth-foundation
# Create subsequent branch
och stack create auth-ui
# Submit stack and create/update PRs
och stack submitAI review workflow
# Trigger AI review
och review ai 42
# Wait for completion
och review ai 42 --wait
# Check latest review status
och review status 42API mode for scripting
# Read current user
och api /user
# Create issue via API
och api /repos/acme/platform/issues -X POST -F title="Bug: timeout" -F body="Steps to reproduce"CI Usage Example
name: OCH Automation
on: [push]
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm install -g opencodehub-cli
- run: |
export OCH_TOKEN="${{ secrets.OCH_TOKEN }}"
och config set serverUrl https://git.example.com
och config doctor
och repo push --branch mainTroubleshooting
Not logged in. Run 'och auth login' first.
- Run
och auth login --url <server>. - Or export
OCH_TOKENfor automation.
Server URL not configured
- Run
och config set serverUrl https://git.example.com.
TLS / certificate issues
- Use
och config set caFile /path/to/ca.pemfor custom CA. - Use
och config set insecure trueonly for temporary debugging.
Validate setup end-to-end
och config doctorDevelopment
cd cli
npm install
npm run build
npm run testLicense
MIT
