Deploily CLI is a Node.js command-line tool for authenticating against a Keycloak-backed Deploily environment.
- OAuth2 login flow with PKCE
- Local callback server for browser-based authentication
- Secure credential storage via
keytarwith a file fallback login,logout, andwhoamicommands- TypeScript + native ESM project setup
This is the recommended section for developers who want to install and use the published CLI without contributing to the repository.
- Node.js 20+
- npm (or pnpm)
- A browser for the OAuth login flow
The CLI connects to the public Deploily Keycloak instance by default:
- URL:
https://auth.deploily.cloud - realm:
deploily - client ID:
deploily
No .env file is required for standard use. If you need to override the defaults for a custom environment, you can set KEYCLOAK_URL, KEYCLOAK_REALM, or KEYCLOAK_CLIENT_ID.
npm install -g @deploily/deploily-cliOr run it without installing globally:
npx @deploily/deploily-cli --helpdeploily --help
deploily --version
deploily login
deploily logout
deploily whoamideploily login
deploily logout
deploily whoami
deploily --help
deploily --version- The CLI uses the default Keycloak base URL
https://auth.deploily.cloudwhen no environment variables are set. - It uses the
deploilyrealm and thedeploilyclient ID by default. - It opens the Keycloak authorization URL in your browser.
- Keycloak redirects back to the local callback server on port
8976. - The CLI exchanges the authorization code for tokens.
- User info is fetched from the Keycloak userinfo endpoint.
- Credentials are stored with
keytar, or in~/.config/deploily/config.jsonifkeytaris unavailable.
This section is for contributors working from the repository source.
- Node.js 20+
- pnpm
- Docker (optional, for the local Keycloak container)
git clone <repository-url>
cd deploily-cli
pnpm installpnpm build
node dist/index.js --helpIf you want to invoke the project as deploily from your shell while developing locally:
export PATH="$HOME/.local/share/pnpm/bin:$PATH"
pnpm setup
pnpm link --global .
deploily --helpIf the command is still not found, use the direct entry point instead:
node dist/index.js --helppnpm build
node dist/index.js --help
deploily loginThe project devcontainer already exposes the Keycloak service, so no separate Docker Compose startup is required.
src/index.ts- CLI entry point and command routingsrc/commands/- CLI command handlerssrc/auth/- authentication service and callback serversrc/config/- configuration constantssrc/storage/- credential persistencesrc/utils/- PKCE helperssrc/types/- shared TypeScript types
Before publishing a release, validate the package and the npm auth flow:
export NPM_TOKEN="npm_your_token_here"
npm config set //registry.npmjs.org/:_authToken "$NPM_TOKEN"
npm whoami
npm publish --access public --dry-runIn GitHub Actions, configure a repository secret named NPM_SECRET_TOKEN and the publish workflow will:
- install dependencies
- build the CLI
- validate authentication with
npm whoami - run a dry-run publish
- publish the package to npm on a successful run