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 the file, then run 'my cli push' to publish.
# Edit your command, then push it
$ my cli push -f deploy/command.yaml
Created command "deploy" (a1b2c3d4-...)
Published version 1 (hash: e5f6a7b8)
# Run from any machine
$ my cli run deploy -- production
Deploying to production...
Deploy complete.
$ |

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.

Sources & Libraries

Add git-backed sources — curated command repositories that work without an account. Or install libraries from the public registry. Either way, 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.

schemaVersion: 1
kind: command

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
Created command "greet" (a1b2c3d4-...)
Published version 1 (hash: e5f6a7b8)

$ my cli push --dir ./commands/
Pushing commands/deploy/command.yaml ...
Published version 3 (hash: c4d5e6f7)
Pushing commands/backup/command.yaml ...
Created command "backup" (f8a9b0c1-...)
Published version 1 (hash: d2e3f4a5)

2 succeeded, 0 failed
3

Run

Run commands from anywhere with full arg parsing.

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

$ my cli run deploy -- production
Deploying to production...
Deploy complete.

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.