Muscles CLI runtime for shared command routing and strategy execution
Project description
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.
Related Repositories
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 newis not a canonical command.- Existing non-empty directory is rejected unless
--forceis 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 1is a nested route with an argument;bookings/listcan be normalized by an application before calling the CLI;- groups can have handlers, but returning
Truelets 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file muscles_cli-1.0.1.tar.gz.
File metadata
- Download URL: muscles_cli-1.0.1.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b8fcc1cfe996b24c973e58837c8b8c35403c5bfc736b73fa8e796425c632e65
|
|
| MD5 |
3c3f3c96d0ed4e8b5232b30961f4ef3b
|
|
| BLAKE2b-256 |
1c5746e12f0cd3d4bdec4ae6a262190a3bc639aeeb0089e5f85bdff52f0d3d02
|
Provenance
The following attestation bundles were made for muscles_cli-1.0.1.tar.gz:
Publisher:
release.yml on butkoden/muscles-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
muscles_cli-1.0.1.tar.gz -
Subject digest:
1b8fcc1cfe996b24c973e58837c8b8c35403c5bfc736b73fa8e796425c632e65 - Sigstore transparency entry: 2261288163
- Sigstore integration time:
-
Permalink:
butkoden/muscles-cli@66fcab7fdc07bec52cd791aee32e59fe0a3e4be2 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/butkoden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@66fcab7fdc07bec52cd791aee32e59fe0a3e4be2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file muscles_cli-1.0.1-py3-none-any.whl.
File metadata
- Download URL: muscles_cli-1.0.1-py3-none-any.whl
- Upload date:
- Size: 27.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6d4eab946068281a03d0ce5003fbf9c9a36ea9ae70d57779f113a475433bdf51
|
|
| MD5 |
16b42220644d56b4fa1b025dfa799942
|
|
| BLAKE2b-256 |
febea62a248397d00ee536c74bb551590181d6be8a1ca8b836f97558f411b8e5
|
Provenance
The following attestation bundles were made for muscles_cli-1.0.1-py3-none-any.whl:
Publisher:
release.yml on butkoden/muscles-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
muscles_cli-1.0.1-py3-none-any.whl -
Subject digest:
6d4eab946068281a03d0ce5003fbf9c9a36ea9ae70d57779f113a475433bdf51 - Sigstore transparency entry: 2261288273
- Sigstore integration time:
-
Permalink:
butkoden/muscles-cli@66fcab7fdc07bec52cd791aee32e59fe0a3e4be2 -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/butkoden
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@66fcab7fdc07bec52cd791aee32e59fe0a3e4be2 -
Trigger Event:
release
-
Statement type: