@dotlab-hq/env-cli
v1.0.4
Published
CLI tool for managing environment variables
Readme
@dotlab-hq/env-cli
Node.js CLI for managing projects, env files, secrets, and imports against https://env.wpsadi.dev.
Install
npm install
Development
npm run dev -- --helpnpm run typechecknpm run build
Publishing
- the package is built to
dist/ - the published executable is
dist/index.js npm publishrunsprepublishOnly, which typechecks and builds first- GitHub Actions can publish automatically using npm trusted publishing
- if you prefer token-based publishing, you can adapt the workflow to provide
NODE_AUTH_TOKEN
Command groups
npx @dotlab-hq/env-cli auth <whoami|logout|doctor>npx @dotlab-hq/env-cli project <list|create|get|update|delete>npx @dotlab-hq/env-cli file <list|create|show|upload|load|delete>npx @dotlab-hq/env-cli secret <list|create|get|update|delete>npx @dotlab-hq/env-cli import file <projectName> <fileName> --from <path>npx @dotlab-hq/env-cli config <get|set|clear>
Global flags
--endpoint <url>--username <name>--api-key <token>--json--yes--quiet--help
Environment variables
ENV_ENDPOINTENV_API_TOKENENV_API_KEYENV_USERNAME
Resolution order:
- command flags
- environment variables
- local config file
- built-in defaults
Local config
Config is stored at:
- Windows:
%USERPROFILE%\.env-cli\config.json
Example:
{
"endpoint": "https://env.wpsadi.dev",
"username": "wpsadi",
"apiKey": "token"
}Examples
npx @dotlab-hq/env-cli project create my-app --description "Production config"npx @dotlab-hq/env-cli file upload my-app .env --from .env.localnpx @dotlab-hq/env-cli file load my-app .env .env.localnpx @dotlab-hq/env-cli secret create my-app .env DATABASE_URL --value postgres://localhost/dbnpx @dotlab-hq/env-cli import file my-app .env.production --from .env.production --mode overwrite --yesnpx @dotlab-hq/env-cli config get --json
API surface expected by the CLI
The CLI is implemented against the REST shape defined in Plan.md, including:
/api/:username/me/api/:username/projects/api/:username/projects/:projectName/api/:username/projects/:projectName/files/api/:username/projects/:projectName/files/:fileName/secrets/api/:username/projects/:projectName/files/:fileName/import- existing file-level endpoints at
/api/:username/:projectName/:fileName
If the backend has not exposed those routes yet, the CLI will build correctly but related commands will fail at runtime until the API is available.
