@deploily/deploily-cli
v0.1.2
Published
Deploily CLI - Deploy and manage your applications with ease
Readme
deploily-cli
Deploily CLI is a Node.js command-line tool for authenticating against a Keycloak-backed Deploily environment.
Features
- 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
Section 1: Using the CLI
This is the recommended section for developers who want to install and use the published CLI without contributing to the repository.
Requirements
- Node.js 20+
- npm (or pnpm)
- A browser for the OAuth login flow
Default behavior
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.
Install from npm
npm install -g @deploily/deploily-cliOr run it without installing globally:
npx @deploily/deploily-cli --helpBasic usage
deploily --help
deploily --version
deploily login
deploily logout
deploily whoamiCommands
deploily login
deploily logout
deploily whoami
deploily --help
deploily --versionAuthentication flow
- 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.
Section 2: Contributing to the project
This section is for contributors working from the repository source.
Requirements
- Node.js 20+
- pnpm
- Docker (optional, for the local Keycloak container)
Clone and install
git clone <repository-url>
cd deploily-cli
pnpm installBuild the CLI from source
pnpm build
node dist/index.js --helpRun the local CLI binary
If 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 --helpLocal development flow
pnpm build
node dist/index.js --help
deploily loginThe project devcontainer already exposes the Keycloak service, so no separate Docker Compose startup is required.
Project structure
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
Publishing checks
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
