Skip to content

Running Commands

After installing a library, its commands are available as top-level subcommands:

Terminal window
my <library> <command> [args] [--flags]

For example:

Terminal window
my kubernetes port-forward svc/my-service -p 8080
my ops deploy api -e production

Libraries can have aliases, so my k8s logs may work as a shorthand for my kubernetes logs. Use my <library> --help to see available commands in a library.

Your local catalog is synced automatically when you run my cli login or my source add. You can also update git-backed sources manually:

Terminal window
my source update

This pulls the latest changes from all installed source repos. The API catalog is synced with ETag support for efficient caching and stored locally at ~/.my/cache/.

Run your own published commands by slug:

Terminal window
my cli run <slug> [-- args...]

For example:

Terminal window
my cli run deploy -- production
my cli run greet -- --name World

Arguments after -- are parsed by the command spec. Positional arguments are matched in order, and flags use --name value syntax.

If a command has requireConfirmation: true in its policy, use -y to skip the prompt:

Terminal window
my cli run deploy -y -- production

Running my cli run with no arguments opens an interactive picker:

Terminal window
my cli run

The picker searches across all sources: local spec files in the current directory, personal (synced) commands, installed libraries, and git sources.

If the terminal is not a TTY (e.g., inside a script or CI), the command prints a table of available commands instead.

Run a spec file directly without pushing to the registry:

Terminal window
my cli run -f command.yaml -- production

You can also pass a directory to -f to auto-detect a spec file in the current directory:

Terminal window
my cli run -f .

This is useful for local development and testing.

View details of a cached command:

Terminal window
my cli show deploy
my cli show deploy --raw # Output raw JSON spec
Terminal window
my cli history
my cli history -n 50 # Show last 50 entries

History is stored as JSONL at ~/.my/history.jsonl.

When you run a command, mycli:

  1. Loads the cached spec (or reads the file with -f)
  2. Parses positional args and flags from the command line
  3. Renders Go templates in run lines and env values
  4. Executes each step sequentially using the specified shell
  5. Records the run in history