overmindtech / cli

Identify the blast radius and risks for Terraform changes in real time
https://overmind.tech/
Other
165 stars 3 forks source link

Rename project and binary #172

Closed dylanratcliffe closed 8 months ago

dylanratcliffe commented 8 months ago

Background

We want the new CLI to be as easy to use as possible. To this end we want user to basically be able to run overmind terraform plan in place of where they would previously run terraform plan. In order to do this though we need to reorganise the CLI

Tasks

Subcommand vs Group

Is is possible to group commands which gives you output like this:

$ overmind help
Calculate the blast radius of your changes, track risks, and make changes with confidence

Usage:
  overmind [command]

Infrastructure as Code Commands

Utility Commands
  create-bookmark        Creates a bookmark from JSON.
  end-change             Finishes the specified change. Call this just after you finished the change. This will store a snapshot of the current system state for later reference.
  get-affected-bookmarks Calculates the bookmarks that would be overlapping with a snapshot.
  get-bookmark           Displays the contents of a bookmark.
  get-change             Displays the contents of a change.
  get-snapshot           Displays the contents of a snapshot.
  list-changes           Displays the contents of a change.
  list-invites           List all invites
  manual-change          Creates a new Change from a given query
  request                Runs a request against the overmind API
  start-change           Starts the specified change. Call this just before you're about to start the change. This will store a snapshot of the current system state for later reference.
  submit-plan            Creates a new Change from a given terraform plan file

Additional Commands:
  completion             Generate the autocompletion script for the specified shell
  create-invite          Create a new invite
  help                   Help about any command
  revoke-invites         Revoke an existing invite

Flags:
      --api-key string             The API key to use for authentication, also read from OVM_API_KEY environment variable
      --api-key-url string         The overmind API Keys endpoint (defaults to --url)
      --auth0-client-id string     OAuth Client ID to use when connecting with auth (default "j3LylZtIosVPZtouKI8WuVHmE6Lluva1")
      --auth0-domain string        Auth0 domain to connect to (default "om-prod.eu.auth0.com")
      --gateway-url string         The overmind Gateway endpoint (defaults to /api/gateway on --url)
  -h, --help                       help for overmind
      --honeycomb-api-key string   If specified, configures opentelemetry libraries to submit traces to honeycomb. This requires --otel to be set.
      --json-log                   Set to true to emit logs as json for easier parsing.
      --log string                 Set the log level. Valid values: panic, fatal, error, warn, info, debug, trace (default "info")
      --otel                       If specified, configures opentelemetry and - optionally, see --sentry-dsn - sentry using their default environment configs.
      --run-mode string            Set the run mode for this service, 'release', 'debug' or 'test'. Defaults to 'release'. (default "release")
      --sentry-dsn string          If specified, configures sentry libraries to capture errors. This requires --otel to be set.
      --stdout-trace-dump          Dump all otel traces to stdout for debugging. This requires --otel to be set.
      --url string                 The overmind API endpoint (default "https://api.prod.overmind.tech")
  -v, --version                    version for overmind

Use "overmind [command] --help" for more information about a command.

The problem is that I think this is way too much text for a default help command. There are a number of things here that users will likely never use like creating invites, I am thinking maybe we should group these based on the service in the API so that they are more similar using both groups and subcommands. This would mean it would look like this:

$ overmind help
Calculate the blast radius of your changes, track risks, and make changes with confidence

Usage:
  overmind [command]

Infrastructure as Code Commands
  terrafrorm             Run Terraform with Overmind as a wrapper calculating the blast radius and risks

Overmind API
  changes                Create, update and delete changes in Overmind
  bookmarks              Interact with the bookarks that were created in the Explore view
  snapshots              Create, view and delete snapshots if your infrastructure
  invites                Manage invitations to your Overmind team

Additional Commands:
  completion             Generate the autocompletion script for the specified shell
  help                   Help about any command

Flags:
      --api-key string             The API key to use for authentication, also read from OVM_API_KEY environment variable
      --api-key-url string         The overmind API Keys endpoint (defaults to --url)
      --auth0-client-id string     OAuth Client ID to use when connecting with auth (default "j3LylZtIosVPZtouKI8WuVHmE6Lluva1")
      --auth0-domain string        Auth0 domain to connect to (default "om-prod.eu.auth0.com")
      --gateway-url string         The overmind Gateway endpoint (defaults to /api/gateway on --url)
  -h, --help                       help for overmind
      --honeycomb-api-key string   If specified, configures opentelemetry libraries to submit traces to honeycomb. This requires --otel to be set.
      --json-log                   Set to true to emit logs as json for easier parsing.
      --log string                 Set the log level. Valid values: panic, fatal, error, warn, info, debug, trace (default "info")
      --otel                       If specified, configures opentelemetry and - optionally, see --sentry-dsn - sentry using their default environment configs.
      --run-mode string            Set the run mode for this service, 'release', 'debug' or 'test'. Defaults to 'release'. (default "release")
      --sentry-dsn string          If specified, configures sentry libraries to capture errors. This requires --otel to be set.
      --stdout-trace-dump          Dump all otel traces to stdout for debugging. This requires --otel to be set.
      --url string                 The overmind API endpoint (default "https://api.prod.overmind.tech")
  -v, --version                    version for overmind

Use "overmind [command] --help" for more information about a command.

I think this would be a bit better for a few reasons:

Arguments

I want to get rid of all the arguments on the root command, to that end I have audited the ones that we have and what they are used for:

DavidS-ovm commented 8 months ago

Please also open a ticket for moving the actions over to the new naming scheme and https://github.com/overmindtech/cli/pull/173