0.0.2 • Published 4 years ago

@bi/checkly-cli v0.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

checkly-cli

Manage checkly files from CLI, CI & more. This is in early prototyping stages but should work for most use cases. Apart from managing your checks from a single file in your repository, you can also use it to provide script files from your repository.

Be sure to checkout the example repository that utilizes this CLI.

oclif Version Codecov Downloads/week License

Usage

$ npm install -g @bi/checkly-cli
$ checkly COMMAND
running command...
$ checkly (-v|--version|version)
@bi/checkly-cli/0.0.1 linux-x64 node-v12.14.0
$ checkly --help [COMMAND]
USAGE
  $ checkly COMMAND
...

Commands

checkly conf [KEY] [VALUE]

manage configuration

USAGE
  $ checkly conf [KEY] [VALUE]

ARGUMENTS
  KEY    key of the config
  VALUE  value of the config

OPTIONS
  -d, --cwd=cwd          config file location
  -d, --delete           delete?
  -h, --help             show CLI help
  -k, --key=key          key of the config
  -n, --name=name        config file name
  -p, --project=project  project name
  -v, --value=value      value of the config

See code: conf-cli

checkly file:sync [FILE]

Syncs YAML file

USAGE
  $ checkly file:sync [FILE]

ARGUMENTS
  FILE  [default: .checkly.yml] Path to the .checkly.yml file

OPTIONS
  -d, --dryRun  Dry run. Outputs changed to be made without actual operation.

EXAMPLE
  $ checkly file:sync
  loading checkly file: ~/projects/example/.checkly.yml
  Done syncing, 0 deleted, 2 synced, 3 created

See code: src/commands/file/sync.ts

checkly file:validate [FILE]

Validates YAML file

USAGE
  $ checkly file:validate [FILE]

ARGUMENTS
  FILE  [default: .checkly.yml] Path to the .checkly.yml file

EXAMPLE
  $ checkly validate
  validate world from ./src/validate.ts!

See code: src/commands/file/validate.ts

checkly help [COMMAND]

display help for checkly

USAGE
  $ checkly help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

checkly limits

lists current limits

USAGE
  $ checkly limits

See code: src/commands/limits.ts

checkly login

login to your Checkly account

USAGE
  $ checkly login

OPTIONS
  -e, --email=email        email
  -p, --password=password  password

EXAMPLES
  $ checkly login -e CHECKLY_USERNAME -p CHECKLY_PASSWORD
  loading checkly file: ~/projects/example/.checkly.yml
  Done syncing, 0 deleted, 2 synced, 3 created

See code: src/commands/login.ts

Basic usage

Checkout

Known issues & limitations

Since this is a proof of concept written in a relatively short time, there are some cevats to be aware of.

Checks

  • If you don't pass any key for a check, it'll check uniqueness from a combination of name and type.

Authentication

  • Checkly does provide a public API but that API doesn't expose account limits. This project uses both the "private API" (the one app.checklyhq.com uses) and the public API. This was more fun than mocking the API.
  • You can't use Google or GitHub login, this utility only works with e-mail and password. If you have multiple accounts assosicated with your account, we'll pick the first one found. You should have OWNER access to that account.
  • You need to have an API key generated from the dashboard before using this utility. If you have more than 1 API key assosicated with your account, we'll pick the first one found.
  • If you changed your plan after you've logged-in, you'll have to run the checkly login command again.

Additional notes

  • Ideally, we should load the API token from the environment. It's still possible but too verbose: checkly login -e ${CHECKLY_EMAIL} -p ${CHECKLY_PASSWORD}. The "real" version of this project should of course only use a valid public API token and not the credentials.
  • Since this is essentially a proof of concept work, we only sync checks. A real version of this would have a good support for snippets.

License

MIT.