Skip to main content

Muscles CLI

muscles-cli is the console runtime for Muscles. It uses the same application shape as the HTTP runtimes: an ApplicationMeta class owns a Context, and the context delegates execution to CliStrategy.

Installation

pip install muscles-cli

Canonical ecosystem install matrix is documented in core: Muscles installation matrix.

  • muscles - core contracts, actions, inspect output and canonical documentation.
  • muscles-asgi - ASGI runtime generated projects can target.
  • muscles-wsgi - WSGI runtime generated projects can target.
  • muscles-mcp - MCP projection over the same action contracts.
  • muscles-benchmarks - CLI regression and architecture checks.

Project Scaffolding

Use canonical command muscles new:

muscles new demo --runtime asgi
muscles new demo --runtime wsgi
muscles new demo --runtime cli

Notes:

  • muscular new is not a canonical command.
  • Existing non-empty directory is rejected unless --force is used.

AI Workflow Commands

muscles capabilities --json
muscles inspect --json --app app.application:App
muscles action list --app app.application:App --json
muscles action inspect bookings.echo --app app.application:App --json
muscles action run bookings.echo --app app.application:App --payload-json '{"title":"Call"}' --json
muscles routes --app app.application:App
muscles schemas --app app.application:App
muscles rules --app app.application:App
muscles cli --app app.application:App
muscles generate page Home --with-tests
muscles doctor --json
muscles test --doctor

Quick Start

from muscles import ApplicationMeta, Context, cli
from muscles.cli import CliStrategy


class App(metaclass=ApplicationMeta):
    context = Context(CliStrategy)

    def run(self, *args):
        return self.context.execute(*args, shutup=True)


@cli.group()
def bookings(*args):
    """Booking commands."""
    return True


@bookings.command(command_name="remove")
def remove_booking(*args):
    booking_id = args[0]
    return f"removed {booking_id}"


app = App()
assert app.run("bookings", "remove", "1") == "removed 1"

Routing Model

Groups and commands form a tree. That makes CLI routing close to HTTP routing:

  • bookings remove 1 is a nested route with an argument;
  • bookings/list can be normalized by an application before calling the CLI;
  • groups can have handlers, but returning True lets execution continue to a child command.

More detail: docs/routing.md.

Core Stream Output

English: CLI progress output uses core StreamEvent items from StreamResult. render_stream_result() can print human-readable progress/log and result lines, or machine-readable JSON lines. The CLI layer only owns presentation and exit code mapping; stream semantics stay in muscles.core.

Русский: CLI progress output использует core StreamEvent из StreamResult. render_stream_result() может печатать human-readable progress/log/result строки или machine-readable JSON lines. CLI слой отвечает только за presentation и exit code mapping; stream semantics остаётся в muscles.core.

Arguments

Use @cli.argument() for named arguments and @cli.flag() for boolean flags. Required prompted arguments use input() or getpass.getpass() when hidden.

For nested commands, define options on the parent group object:

@cli.group(command_name="bookings")
def bookings(*args):
    return True

@bookings.command(command_name="list")
@bookings.argument("--limit", nargs=1, default="25")
def bookings_list(*args, limit):
    return limit

Canonical invocations for benchmark/automation scripts:

bookings list --limit 10
bookings list --limit=10

Development

Run tests with the core package on PYTHONPATH:

PYTHONPATH=../muscles/src:src python -m pytest -q

Metadata

Release files for muscles-cli 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for muscles-cli 1.0.2
File Size Uploaded Provenance Actions
muscles_cli-1.0.2.tar.gz 23.4 kB With provenance Details for muscles_cli-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for muscles-cli 1.0.2
File Interpreter ABI Platform Actions
muscles_cli-1.0.2-py3-none-any.whl Python 3 none any Details for muscles_cli-1.0.2-py3-none-any.whl

Total release size: 50.6 kB

Release files / muscles_cli-1.0.2.tar.gz

Download URL muscles_cli-1.0.2.tar.gz
Size 23.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a4adb6637e45af3ec6647f87fbb41e8bb195a61a6d1af7116b79a98a4facce2c
BLAKE2b-256 checksum
How to use checksums
2d4ac237d36139b19c4037482d13588c54c855b641f763ab8bcc040920c58abc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.

Transparency log

Release files / muscles_cli-1.0.2-py3-none-any.whl

Download URL muscles_cli-1.0.2-py3-none-any.whl
Size 27.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08e038854594f29692824ea39d3779223622710afdd4522db1d64c14c74eaeb3
BLAKE2b-256 checksum
How to use checksums
8c4c1c0e97af2b04403b8cdf7bbc306384bd46f2b88b3c6dfede4ff73b1adb8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.

Transparency log

Security for muscles-cli 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for muscles_cli-1.0.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page