Contexts

This section explains how to manage various environments seamlessly using a single CLI, ensuring clear separation between development, staging, and production ecosystems.

In the Fathom CLI, a Context represents a specific environment or configuration profile. Instead of logging out and back in to switch between development and production environment, you can use contexts to keep these worlds isolated yet easily accessible.

  • The Default Context: Upon installation and initial setup, the CLI creates a context named default. Unless specified otherwise, all commands execute within this space.
  • The Current Context: This is your active environment. Any command you run will apply to this context until you manually switch to another.

Listing Available Contexts

To see which environments you currently have configured and identify which one is active, use the list command:

fathom context list

The output will display all saved contexts, highlighting the one currently selected for use.

Switching Contexts

There are two primary ways to handle multiple environments: temporary overrides and persistent selection.

Temporary Override

If you want to run a single command against a different environment without changing your global settings, use the --context flag:

fathom --context qa intelligence function list

Persistent Selection

To switch your current context across all future terminal sessions, use the select command:

fathom context select qa 

Once selected, qa becomes your active environment for every subsequent command until you change it again.

Adding New Contexts

Adding a new environment is straightforward. By combining the --context flag with the login command, the CLI initializes a new profile under the name you provide.

To add a new environment named qa:

fathom --context qa login <url>

After completing the authentication flow, the qa context will be saved and available in your context list. You can then configure its specific organization or project settings independently of your default setup.