Commands as code

Define, publish, and run CLI commands

Author commands as YAML specs with args, flags, templates, and multi-step workflows. Push to a registry, sync across machines, and run from anywhere.

$ brew install mycli-sh/tap/mycli
terminal
# Create a new command spec
$ my cli init deploy
Created deploy/command.yaml
# Edit your command, then push it
$ my cli push -f deploy/command.yaml
Pushed deploy v1
# Run from any machine
$ my cli run deploy -- production
Running deploy (v1)...
Deployed to production successfully
$ |

Everything you need

From authoring to execution, mycli covers the full command lifecycle.

Define as Code

Author commands as YAML or JSON specs with args, flags, environment variables, Go templates, and multi-step workflows. Validated against a JSON Schema.

Publish & Sync

Push commands to a registry and sync them across machines. ETag-based caching keeps your local catalog up to date with minimal bandwidth.

Libraries

Add git-backed libraries — curated repositories of commands that work without an account. Install from the registry or any git URL and run shared commands instantly.

How it works

Three steps from definition to execution.

1

Define

Write a command spec in YAML with arguments, flags, and templated steps.

metadata:
  name: greet
  slug: greet
  description: Greet someone

args:
  positional:
    - name: name
      required: true

steps:
  - name: greet
    run:
      - echo 'Hello, {{.args.name}}!'
2

Publish

Push your command to the registry to share it across machines.

$ my cli push -f command.yaml
Pushed greet v1 ✓

$ my cli push --dir ./commands/
Pushed deploy v3 ✓
Pushed backup v1 ✓
Pushed status v2 ✓
3

Run

Run commands from anywhere with full arg parsing.

$ my cli run greet -- World
Hello, World!

$ my cli run deploy -- production
Running deploy (v3)...
Deployed to production ✓

Powerful command specs

Define complex workflows with args, flags, environment variables, templates, and policies.

command.yaml
schemaVersion: 1
kind: command

metadata:
  name: deploy
  slug: deploy
  description: Deploy application to environment
  tags: [ops, deploy]

args:
  positional:
    - name: environment
      description: Target environment
      required: true
  flags:
    - name: dry-run
      short: n
      type: bool
      description: Preview without applying changes

defaults:
  shell: /bin/bash
  timeout: 5m

steps:
  - name: validate
    run:
      - echo "Deploying to {{.args.environment}}..."
      - test -f {{.cwd}}/deploy.sh
  - name: deploy
    run:
      - ./deploy.sh {{.args.environment}}

policy:
  requireConfirmation: true

Ready to get started?

Install mycli and create your first command in under a minute.