muscles-cli 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- muscles/cli/Makefile +26 -0
- muscles/cli/__about__.py +6 -0
- muscles/cli/__init__.py +66 -0
- muscles/cli/__main__.py +5 -0
- muscles/cli/cli/__init__.py +6 -0
- muscles/cli/cli/cli.py +44 -0
- muscles/cli/cli/colory.py +15 -0
- muscles/cli/cli/command.py +778 -0
- muscles/cli/cli/constants.py +3 -0
- muscles/cli/cli/error_handler.py +6 -0
- muscles/cli/cli/func.py +221 -0
- muscles/cli/cli/instance.py +47 -0
- muscles/cli/cli/strategy.py +111 -0
- muscles/cli/providers.py +198 -0
- muscles/cli/streaming.py +50 -0
- muscles/cli/tooling.py +927 -0
- muscles_cli-1.0.0.dist-info/METADATA +165 -0
- muscles_cli-1.0.0.dist-info/RECORD +20 -0
- muscles_cli-1.0.0.dist-info/WHEEL +4 -0
- muscles_cli-1.0.0.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: muscles-cli
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Muscles CLI runtime for shared command routing and strategy execution
|
|
5
|
+
License: MIT
|
|
6
|
+
Author: Denis B.
|
|
7
|
+
Author-email: denis@butko.info
|
|
8
|
+
Requires-Python: >=3.10,<4.0
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Requires-Dist: dnspython (==2.6.1)
|
|
17
|
+
Requires-Dist: greenlet (==3.0.2)
|
|
18
|
+
Requires-Dist: jsonschema (==4.16.0)
|
|
19
|
+
Requires-Dist: muscles (>=1.0.0rc1,<2.0.0)
|
|
20
|
+
Requires-Dist: pyyaml (>=6.0.0,<6.1.0)
|
|
21
|
+
Requires-Dist: watchdog (>=4.0.0,<5.0.0)
|
|
22
|
+
Requires-Dist: werkzeug (==2.1.1)
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
|
|
25
|
+
# Muscles CLI
|
|
26
|
+
|
|
27
|
+
`muscles-cli` is the console runtime for Muscles. It uses the same application
|
|
28
|
+
shape as the HTTP runtimes: an `ApplicationMeta` class owns a `Context`, and the
|
|
29
|
+
context delegates execution to `CliStrategy`.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install muscles-cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Canonical ecosystem install matrix is documented in core:
|
|
38
|
+
[Muscles installation matrix](https://github.com/butkoden/muscles/blob/master/docs/installation.md).
|
|
39
|
+
|
|
40
|
+
## Related Repositories
|
|
41
|
+
|
|
42
|
+
- [`muscles`](https://github.com/butkoden/muscles) - core contracts, actions, inspect output and canonical documentation.
|
|
43
|
+
- [`muscles-asgi`](https://github.com/butkoden/muscles-asgi) - ASGI runtime generated projects can target.
|
|
44
|
+
- [`muscles-wsgi`](https://github.com/butkoden/muscles-wsgi) - WSGI runtime generated projects can target.
|
|
45
|
+
- [`muscles-mcp`](https://github.com/butkoden/muscles-mcp) - MCP projection over the same action contracts.
|
|
46
|
+
- [`muscles-benchmarks`](https://github.com/butkoden/muscles-benchmarks) - CLI regression and architecture checks.
|
|
47
|
+
|
|
48
|
+
## Project Scaffolding
|
|
49
|
+
|
|
50
|
+
Use canonical command `muscles new`:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
muscles new demo --runtime asgi
|
|
54
|
+
muscles new demo --runtime wsgi
|
|
55
|
+
muscles new demo --runtime cli
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Notes:
|
|
59
|
+
|
|
60
|
+
- `muscular new` is not a canonical command.
|
|
61
|
+
- Existing non-empty directory is rejected unless `--force` is used.
|
|
62
|
+
|
|
63
|
+
## AI Workflow Commands
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
muscles capabilities --json
|
|
67
|
+
muscles inspect --json --app app.application:App
|
|
68
|
+
muscles action list --app app.application:App --json
|
|
69
|
+
muscles action inspect bookings.echo --app app.application:App --json
|
|
70
|
+
muscles action run bookings.echo --app app.application:App --payload-json '{"title":"Call"}' --json
|
|
71
|
+
muscles routes --app app.application:App
|
|
72
|
+
muscles schemas --app app.application:App
|
|
73
|
+
muscles rules --app app.application:App
|
|
74
|
+
muscles cli --app app.application:App
|
|
75
|
+
muscles generate page Home --with-tests
|
|
76
|
+
muscles doctor --json
|
|
77
|
+
muscles test --doctor
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Quick Start
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from muscles import ApplicationMeta, Context, cli
|
|
84
|
+
from muscles.cli import CliStrategy
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class App(metaclass=ApplicationMeta):
|
|
88
|
+
context = Context(CliStrategy)
|
|
89
|
+
|
|
90
|
+
def run(self, *args):
|
|
91
|
+
return self.context.execute(*args, shutup=True)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@cli.group()
|
|
95
|
+
def bookings(*args):
|
|
96
|
+
"""Booking commands."""
|
|
97
|
+
return True
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@bookings.command(command_name="remove")
|
|
101
|
+
def remove_booking(*args):
|
|
102
|
+
booking_id = args[0]
|
|
103
|
+
return f"removed {booking_id}"
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
app = App()
|
|
107
|
+
assert app.run("bookings", "remove", "1") == "removed 1"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Routing Model
|
|
111
|
+
|
|
112
|
+
Groups and commands form a tree. That makes CLI routing close to HTTP routing:
|
|
113
|
+
|
|
114
|
+
- `bookings remove 1` is a nested route with an argument;
|
|
115
|
+
- `bookings/list` can be normalized by an application before calling the CLI;
|
|
116
|
+
- groups can have handlers, but returning `True` lets execution continue to a
|
|
117
|
+
child command.
|
|
118
|
+
|
|
119
|
+
More detail: [docs/routing.md](docs/routing.md).
|
|
120
|
+
|
|
121
|
+
## Core Stream Output
|
|
122
|
+
|
|
123
|
+
English: CLI progress output uses core `StreamEvent` items from
|
|
124
|
+
`StreamResult`. `render_stream_result()` can print human-readable progress/log
|
|
125
|
+
and result lines, or machine-readable JSON lines. The CLI layer only owns
|
|
126
|
+
presentation and exit code mapping; stream semantics stay in `muscles.core`.
|
|
127
|
+
|
|
128
|
+
Русский: CLI progress output использует core `StreamEvent` из `StreamResult`.
|
|
129
|
+
`render_stream_result()` может печатать human-readable progress/log/result
|
|
130
|
+
строки или machine-readable JSON lines. CLI слой отвечает только за presentation
|
|
131
|
+
и exit code mapping; stream semantics остаётся в `muscles.core`.
|
|
132
|
+
|
|
133
|
+
## Arguments
|
|
134
|
+
|
|
135
|
+
Use `@cli.argument()` for named arguments and `@cli.flag()` for boolean flags.
|
|
136
|
+
Required prompted arguments use `input()` or `getpass.getpass()` when hidden.
|
|
137
|
+
|
|
138
|
+
For nested commands, define options on the parent group object:
|
|
139
|
+
|
|
140
|
+
```python
|
|
141
|
+
@cli.group(command_name="bookings")
|
|
142
|
+
def bookings(*args):
|
|
143
|
+
return True
|
|
144
|
+
|
|
145
|
+
@bookings.command(command_name="list")
|
|
146
|
+
@bookings.argument("--limit", nargs=1, default="25")
|
|
147
|
+
def bookings_list(*args, limit):
|
|
148
|
+
return limit
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
Canonical invocations for benchmark/automation scripts:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
bookings list --limit 10
|
|
155
|
+
bookings list --limit=10
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Development
|
|
159
|
+
|
|
160
|
+
Run tests with the core package on `PYTHONPATH`:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
PYTHONPATH=../muscles/src:src python -m pytest -q
|
|
164
|
+
```
|
|
165
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
muscles/cli/Makefile,sha256=vKdkkjO4iwFBe2dgYYB0n36E4xRyXz_xG-7_yquavJ4,343
|
|
2
|
+
muscles/cli/__about__.py,sha256=oaHJMB-EPQqvNfDAXyxKbA8mzwMvamLCQ7KZ6yBElAw,137
|
|
3
|
+
muscles/cli/__init__.py,sha256=6UNP5r6x-PMI33ND3XHgkiYC83AOJ_qJMb0k05SULWE,1601
|
|
4
|
+
muscles/cli/__main__.py,sha256=YD1RcSZ1Gn70mVah7-6ETWAkRe4e7jo3TBKZzZnitaY,84
|
|
5
|
+
muscles/cli/cli/__init__.py,sha256=ETDBky16rTCFRrSAbxh_QvLEYdVeprg8lvSXSt5Us3Q,217
|
|
6
|
+
muscles/cli/cli/cli.py,sha256=zmnk4VagJEnKfTjnRtPZvYzp65pQd9rjPxKNEa3A3Wg,1115
|
|
7
|
+
muscles/cli/cli/colory.py,sha256=xoho2DuKLujJdIxo959j7swR-JDb-xRLcizA1FAI4yo,265
|
|
8
|
+
muscles/cli/cli/command.py,sha256=0DfGLGYbBlPNqs2hnkgiXMZpT7KwFk4bMiN8yWpyTAg,29751
|
|
9
|
+
muscles/cli/cli/constants.py,sha256=Lbb4JmgHPTfR-e0TA2KRCtqJGtfPg8h-jbBUGid_tIY,97
|
|
10
|
+
muscles/cli/cli/error_handler.py,sha256=t6iS0K93rhr2Q236NOqxK4Tcacx5deOnZ4hVsm7Oljo,124
|
|
11
|
+
muscles/cli/cli/func.py,sha256=IvWi3nJd3XuoXA2qdg5k_ctNsiqyGmO3Q-TCDD4Z6xA,9297
|
|
12
|
+
muscles/cli/cli/instance.py,sha256=JsNbJuQnc3leP1snLfTxCFQqRPOwnvm9XUO_xxvRaSM,1226
|
|
13
|
+
muscles/cli/cli/strategy.py,sha256=oda94XSQ1N-PRMXuZdvZgbpXc9XzGovNqWunTP1N0KI,3576
|
|
14
|
+
muscles/cli/providers.py,sha256=mdb5E1bV-l3oRCSLhdKG2PZz0ahFa8_5ZB9-35roDpA,7224
|
|
15
|
+
muscles/cli/streaming.py,sha256=qB-tQi7oHPDEVSSwrIg46IQik0Msr7whUuSgzK5R1Fk,1382
|
|
16
|
+
muscles/cli/tooling.py,sha256=79OxlE4I9nEVxyD1Jr5JBoLFe9JBinHRaQ7QuWGgN_I,36099
|
|
17
|
+
muscles_cli-1.0.0.dist-info/METADATA,sha256=uCfVnJpUWv5YZcRWwmakGjZ7lxHe6O5aj0m8M4bvA7E,5121
|
|
18
|
+
muscles_cli-1.0.0.dist-info/WHEEL,sha256=eY7nduwzv-ldUxpzbRlxwvC693Hg6PX8bWDjEHjZ_dk,88
|
|
19
|
+
muscles_cli-1.0.0.dist-info/entry_points.txt,sha256=J_BQzsqEaKAL_R7f0hgz76p4mFkuHBmlnUcEJrIziiU,52
|
|
20
|
+
muscles_cli-1.0.0.dist-info/RECORD,,
|