codehub-sbs-cli
v1.0.0
Published
Command-line client for CodeHub repositories.
Readme
CodeHub CLI
Cross-platform command-line client for CodeHub repositories. It supports Windows PowerShell and Command Prompt, Linux terminals, and macOS Terminal on Node.js 18 or newer.
Install
npm install -g codehub-cli
codehub --version
codehub --helpFor local development, run npm link in this package directory. The package is not published automatically.
Sign in
codehub login
codehub whoamiThe password prompt does not echo input. CodeHub stores only the access token, expiry, username, user ID, and API URL in the operating system application-data directory:
- Windows:
%APPDATA%\CodeHub\credentials.json - Linux:
~/.config/codehub/credentials.json - macOS:
~/Library/Application Support/CodeHub/credentials.json
Passwords and tokens are never stored in .codehub or printed by commands. Run codehub logout to remove the credential.
Clone
codehub clone https://codehub.sbs/Puskar/project-name
cd project-name
codehub statusPuskar/project-name and legacy repository IDs are also accepted. Clone refuses non-empty destinations, validates every path, preserves nested folders, and creates portable .codehub metadata.
Connect an existing project
codehub init https://codehub.sbs/Puskar/project-name
codehub add .
codehub status
codehub commit -m "Initial commit"
codehub pushadd and commit are local operations. Only push sends data, and the backend rechecks repository role, remote branch head, branch protection, file hashes, size limits, and protected paths.
Branch and pull-request workflow
codehub branch feature/my-change
codehub checkout feature/my-change
codehub add .
codehub commit -m "My change"
codehub pushThe CLI prints a pull-request URL after a feature-branch push. Direct pushes to protected branches fail unless the configured owner or maintainer bypass permits them.
Synchronization and history
codehub fetch
codehub pull
codehub history
codehub log --oneline --limit 20fetch updates remote refs without changing files. pull refuses to overwrite dirty files or unpushed commits. Push finalization uses the expected remote head and returns REMOTE_CHANGED instead of silently overwriting concurrent work.
Staging and branches
codehub add src/App.jsx
codehub add src
codehub add -A
codehub reset src/App.jsx
codehub reset
codehub branch
codehub switch feature/my-change
codehub remote -v
codehub config --list.codehubignore supports comments, blank lines, *, **, ?, directory patterns, and negation. The CLI always excludes .codehub, .git, dependencies, generated output, .env variants, PEM/key files, private-key names, service-account.json, and credentials.json. The backend independently enforces the same security boundary.
API configuration
Production defaults to https://api.codehub.sbs. Override it for development or self-hosting:
codehub --api-url http://localhost:3002 whoami
codehub config api.url http://localhost:3002CODEHUB_API_URL is also supported. Priority is CLI flag, environment variable, global configuration, then the production default.
Troubleshooting
AUTH_REQUIREDorTOKEN_EXPIRED: runcodehub login.PERMISSION_DENIED: ask the repository owner for an appropriate collaborator role.BRANCH_PROTECTED: create and push a feature branch, then open a pull request.REMOTE_CHANGED: runcodehub fetchandcodehub pull, then reconcile changes.PROTECTED_FILE: remove the secret or credential file before staging.FILE_TOO_LARGE: reduce files below the 25 MB per-file limit.DIRTY_WORKTREE: commit or reset local changes before pulling or switching.
Use --json on supported commands such as status for machine-readable output, and --verbose to include debugging details. Tokens are never included in either output mode.
