machina-cli 0.2.6__tar.gz

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.
Files changed (32) hide show
  1. machina_cli-0.2.6/.github/workflows/ci.yml +30 -0
  2. machina_cli-0.2.6/.github/workflows/release.yml +98 -0
  3. machina_cli-0.2.6/.gitignore +10 -0
  4. machina_cli-0.2.6/PKG-INFO +320 -0
  5. machina_cli-0.2.6/README.md +290 -0
  6. machina_cli-0.2.6/install.ps1 +38 -0
  7. machina_cli-0.2.6/install.sh +59 -0
  8. machina_cli-0.2.6/pyproject.toml +49 -0
  9. machina_cli-0.2.6/src/machina_cli/__init__.py +3 -0
  10. machina_cli-0.2.6/src/machina_cli/browser_auth.py +196 -0
  11. machina_cli-0.2.6/src/machina_cli/client.py +94 -0
  12. machina_cli-0.2.6/src/machina_cli/commands/__init__.py +0 -0
  13. machina_cli-0.2.6/src/machina_cli/commands/agent.py +148 -0
  14. machina_cli-0.2.6/src/machina_cli/commands/auth.py +137 -0
  15. machina_cli-0.2.6/src/machina_cli/commands/config_cmd.py +48 -0
  16. machina_cli-0.2.6/src/machina_cli/commands/connector.py +94 -0
  17. machina_cli-0.2.6/src/machina_cli/commands/credentials.py +128 -0
  18. machina_cli-0.2.6/src/machina_cli/commands/deploy.py +82 -0
  19. machina_cli-0.2.6/src/machina_cli/commands/document.py +101 -0
  20. machina_cli-0.2.6/src/machina_cli/commands/execution.py +163 -0
  21. machina_cli-0.2.6/src/machina_cli/commands/mapping.py +91 -0
  22. machina_cli-0.2.6/src/machina_cli/commands/org.py +120 -0
  23. machina_cli-0.2.6/src/machina_cli/commands/project.py +155 -0
  24. machina_cli-0.2.6/src/machina_cli/commands/prompt.py +102 -0
  25. machina_cli-0.2.6/src/machina_cli/commands/template.py +109 -0
  26. machina_cli-0.2.6/src/machina_cli/commands/workflow.py +95 -0
  27. machina_cli-0.2.6/src/machina_cli/config.py +109 -0
  28. machina_cli-0.2.6/src/machina_cli/main.py +206 -0
  29. machina_cli-0.2.6/src/machina_cli/models/__init__.py +0 -0
  30. machina_cli-0.2.6/src/machina_cli/project_client.py +174 -0
  31. machina_cli-0.2.6/src/machina_cli/repl.py +251 -0
  32. machina_cli-0.2.6/src/machina_cli/updater.py +147 -0
@@ -0,0 +1,30 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ strategy:
12
+ matrix:
13
+ os: [ubuntu-latest, macos-latest, windows-latest]
14
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
15
+ runs-on: ${{ matrix.os }}
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - uses: actions/setup-python@v5
20
+ with:
21
+ python-version: ${{ matrix.python-version }}
22
+
23
+ - name: Install dependencies
24
+ run: pip install -e ".[dev]"
25
+
26
+ - name: Lint
27
+ run: ruff check src/
28
+
29
+ - name: Verify CLI loads
30
+ run: machina version
@@ -0,0 +1,98 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: write
9
+ id-token: write
10
+
11
+ jobs:
12
+ build-binaries:
13
+ strategy:
14
+ matrix:
15
+ include:
16
+ - os: ubuntu-latest
17
+ asset: machina-linux-amd64
18
+ - os: macos-latest
19
+ asset: machina-darwin-arm64
20
+ - os: windows-latest
21
+ asset: machina-windows-amd64.exe
22
+ runs-on: ${{ matrix.os }}
23
+ steps:
24
+ - uses: actions/checkout@v4
25
+
26
+ - uses: actions/setup-python@v5
27
+ with:
28
+ python-version: "3.12"
29
+
30
+ - name: Install dependencies
31
+ run: |
32
+ pip install -e .
33
+ pip install pyinstaller
34
+
35
+ - name: Build binary
36
+ run: >
37
+ pyinstaller
38
+ --onefile
39
+ --name ${{ matrix.asset }}
40
+ --hidden-import machina_cli
41
+ --hidden-import machina_cli.commands
42
+ --hidden-import machina_cli.commands.auth
43
+ --hidden-import machina_cli.commands.org
44
+ --hidden-import machina_cli.commands.project
45
+ --hidden-import machina_cli.commands.credentials
46
+ --hidden-import machina_cli.commands.deploy
47
+ --hidden-import machina_cli.commands.config_cmd
48
+ --collect-all machina_cli
49
+ src/machina_cli/main.py
50
+
51
+ - name: Upload artifact
52
+ uses: actions/upload-artifact@v4
53
+ with:
54
+ name: ${{ matrix.asset }}
55
+ path: dist/${{ matrix.asset }}
56
+
57
+ github-release:
58
+ needs: [build-binaries]
59
+ runs-on: ubuntu-latest
60
+ steps:
61
+ - uses: actions/checkout@v4
62
+
63
+ - name: Download all artifacts
64
+ uses: actions/download-artifact@v4
65
+ with:
66
+ path: artifacts/
67
+
68
+ - name: Create GitHub Release
69
+ env:
70
+ GH_TOKEN: ${{ github.token }}
71
+ run: |
72
+ tag="${GITHUB_REF#refs/tags/}"
73
+ gh release create "$tag" \
74
+ --title "$tag" \
75
+ --generate-notes \
76
+ artifacts/**/*
77
+
78
+ publish-pypi:
79
+ needs: [github-release]
80
+ runs-on: ubuntu-latest
81
+ environment: pypi
82
+ permissions:
83
+ id-token: write
84
+ contents: write
85
+ steps:
86
+ - uses: actions/checkout@v4
87
+
88
+ - uses: actions/setup-python@v5
89
+ with:
90
+ python-version: "3.12"
91
+
92
+ - name: Build package
93
+ run: |
94
+ pip install build
95
+ python -m build
96
+
97
+ - name: Publish to PyPI
98
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,10 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ dist/
5
+ build/
6
+ .venv/
7
+ .env
8
+ *.egg
9
+ .mypy_cache/
10
+ .ruff_cache/
@@ -0,0 +1,320 @@
1
+ Metadata-Version: 2.4
2
+ Name: machina-cli
3
+ Version: 0.2.6
4
+ Summary: CLI for the Machina AI Agent platform
5
+ Project-URL: Homepage, https://machina.gg
6
+ Project-URL: Repository, https://github.com/machina-sports/machina-cli
7
+ Project-URL: Issues, https://github.com/machina-sports/machina-cli/issues
8
+ Author-email: Machina Sports <eng@machina.gg>
9
+ License-Expression: MIT
10
+ Keywords: agents,ai,cli,machina,sports
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: httpx>=0.27.0
23
+ Requires-Dist: pydantic>=2.0.0
24
+ Requires-Dist: rich>=13.0.0
25
+ Requires-Dist: typer[all]>=0.9.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=8.0; extra == 'dev'
28
+ Requires-Dist: ruff>=0.4; extra == 'dev'
29
+ Description-Content-Type: text/markdown
30
+
31
+ # machina-cli
32
+
33
+ The official command-line interface for the [Machina Sports](https://machina.gg) AI Agent platform.
34
+
35
+ Manage organizations, projects, workflows, agents, and templates directly from your terminal.
36
+
37
+ ## Install
38
+
39
+ ### macOS / Linux
40
+
41
+ ```bash
42
+ curl -fsSL https://raw.githubusercontent.com/machina-sports/machina-cli/main/install.sh | bash
43
+ ```
44
+
45
+ ### Windows (PowerShell)
46
+
47
+ ```powershell
48
+ irm https://raw.githubusercontent.com/machina-sports/machina-cli/main/install.ps1 | iex
49
+ ```
50
+
51
+ ### PyPI
52
+
53
+ ```bash
54
+ pip install machina-cli
55
+ # or
56
+ pipx install machina-cli
57
+ ```
58
+
59
+ ## Quick Start
60
+
61
+ ```bash
62
+ # 1. Authenticate (opens browser)
63
+ machina login
64
+
65
+ # 2. List your organizations and select one
66
+ machina org list
67
+ machina org use <org-id>
68
+
69
+ # 3. List your projects and select one
70
+ machina project list
71
+ machina project use <project-id>
72
+
73
+ # 4. Explore project resources
74
+ machina workflow list
75
+ machina agent list
76
+ machina template list
77
+ ```
78
+
79
+ ## Interactive Session
80
+
81
+ Run `machina` with no arguments to open an interactive REPL:
82
+
83
+ ```
84
+ $ machina
85
+
86
+ ✦ Machina CLI v0.2.2
87
+ Organization: Entain Organization
88
+ Project: sbot-stg
89
+
90
+ Type a command (e.g. `workflow list`) or `help` for commands.
91
+ Press Ctrl+D or type `exit` to quit.
92
+
93
+ ✦ Entain Organization/sbot-stg > workflow list
94
+ ✦ Entain Organization/sbot-stg > agent list
95
+ ✦ Entain Organization/sbot-stg > project list limit 5
96
+ ✦ Entain Organization/sbot-stg > exit
97
+ ```
98
+
99
+ Inside the session you can type commands without the `machina` prefix and without `--` before flags:
100
+
101
+ ```
102
+ workflow list # same as: machina workflow list
103
+ project list limit 5 # same as: machina project list --limit 5
104
+ credentials list json # same as: machina credentials list --json
105
+ ```
106
+
107
+ Features: tab completion, command history (persisted in `~/.machina/history`), current org/project in prompt.
108
+
109
+ ## Authentication
110
+
111
+ The CLI supports three authentication methods:
112
+
113
+ | Method | Command | Use case |
114
+ |--------|---------|----------|
115
+ | **Browser** (default) | `machina login` | Interactive use — opens browser for Clerk SSO / magic link |
116
+ | **API Key** | `machina login --api-key <key>` | CI/CD pipelines and scripts |
117
+ | **Username/Password** | `machina login --with-credentials` | Internal / dev environments |
118
+
119
+ Credentials are stored locally in `~/.machina/credentials.json` (file permissions `600`).
120
+
121
+ ## Commands
122
+
123
+ ### Platform
124
+
125
+ ```bash
126
+ machina login # Authenticate (browser-based)
127
+ machina login --api-key <key> # Authenticate with API key
128
+ machina login --with-credentials # Authenticate with username/password
129
+ machina auth logout # Clear stored credentials
130
+ machina auth whoami # Show current user info
131
+ ```
132
+
133
+ ### Organizations
134
+
135
+ ```bash
136
+ machina org list # List organizations
137
+ machina org list --limit 5 # Paginate (5 per page)
138
+ machina org list --page 2 # Page 2
139
+ machina org list --json # Output as JSON
140
+ machina org create <name> # Create organization
141
+ machina org use <org-id> # Set default organization
142
+ ```
143
+
144
+ ### Projects
145
+
146
+ ```bash
147
+ machina project list # List projects
148
+ machina project list --limit 10 # Paginate (10 per page)
149
+ machina project list --json # Output as JSON
150
+ machina project create <name> # Create project
151
+ machina project use <project-id> # Set default project
152
+ machina project status # Deployment status
153
+ ```
154
+
155
+ ### Workflows
156
+
157
+ ```bash
158
+ machina workflow list # List workflows
159
+ machina workflow list --limit 50 # Paginate
160
+ machina workflow list --json # Output as JSON
161
+ machina workflow get <name> # Get workflow details
162
+ machina workflow get <name> --json # Workflow details as JSON
163
+ ```
164
+
165
+ ### Agents
166
+
167
+ ```bash
168
+ machina agent list # List agents
169
+ machina agent list --json # Output as JSON
170
+ machina agent get <name> # Get agent details
171
+ machina agent get <name> --json # Agent details as JSON
172
+ machina agent executions # List recent executions
173
+ ```
174
+
175
+ ### Connectors
176
+
177
+ ```bash
178
+ machina connector list # List connectors
179
+ machina connector list --json # Output as JSON
180
+ machina connector get <name> # Get connector details
181
+ ```
182
+
183
+ ### Mappings
184
+
185
+ ```bash
186
+ machina mapping list # List mappings
187
+ machina mapping list --json # Output as JSON
188
+ machina mapping get <name> # Get mapping details
189
+ ```
190
+
191
+ ### Prompts
192
+
193
+ ```bash
194
+ machina prompt list # List prompts
195
+ machina prompt list --json # Output as JSON
196
+ machina prompt get <name> # Get prompt with content preview
197
+ ```
198
+
199
+ ### Documents
200
+
201
+ ```bash
202
+ machina document list # List documents
203
+ machina document list --limit 50 # Paginate
204
+ machina document list --json # Output as JSON
205
+ machina document get <id> # Get document with content preview
206
+ ```
207
+
208
+ ### Executions
209
+
210
+ ```bash
211
+ machina execution list # List recent executions
212
+ machina execution list --limit 50 # Paginate
213
+ machina execution get <id> # Get execution details
214
+ machina execution get <id> --compact # Compact output
215
+ machina execution get <id> --json # Full JSON output
216
+ ```
217
+
218
+ ### Templates
219
+
220
+ ```bash
221
+ machina template list # Browse template repository
222
+ machina template list --repo <url> # Browse a custom repository
223
+ machina template list --branch dev # Specific branch
224
+ machina template list --json # Output as JSON
225
+ ```
226
+
227
+ ### Credentials
228
+
229
+ ```bash
230
+ machina credentials list # List API keys (masked)
231
+ machina credentials list --show-keys # List API keys (full)
232
+ machina credentials list --copy client-api # Copy key to clipboard
233
+ machina credentials generate # Generate new API key
234
+ machina credentials generate --name my-key # Custom key name
235
+ machina credentials revoke <key-id> # Revoke an API key
236
+ ```
237
+
238
+ ### Deployment
239
+
240
+ ```bash
241
+ machina deploy start # Deploy Client API
242
+ machina deploy status # Check deployment status
243
+ machina deploy restart # Restart deployment
244
+ ```
245
+
246
+ ### Configuration
247
+
248
+ ```bash
249
+ machina config list # Show all settings
250
+ machina config set <key> <value> # Update a setting
251
+ machina config get <key> # Read a setting
252
+ ```
253
+
254
+ ### Self-update
255
+
256
+ ```bash
257
+ machina update # Update to latest version
258
+ machina update --force # Force re-install
259
+ machina version # Show current version
260
+ ```
261
+
262
+ ## Global Options
263
+
264
+ All list commands support pagination and JSON output:
265
+
266
+ | Flag | Short | Description |
267
+ |------|-------|-------------|
268
+ | `--limit` | `-l` | Items per page (default: 20) |
269
+ | `--page` | | Page number for pagination |
270
+ | `--json` | `-j` | Output raw JSON (useful for piping to `jq`) |
271
+ | `--project` | `-p` | Override default project for this command |
272
+
273
+ Examples:
274
+
275
+ ```bash
276
+ machina project list --limit 5 --page 2 # 5 items, page 2
277
+ machina workflow list --json | jq '.[].name' # Pipe to jq
278
+ machina agent list -p <other-project-id> # Different project
279
+ ```
280
+
281
+ ## Configuration
282
+
283
+ Config is stored in `~/.machina/config.json`:
284
+
285
+ ```bash
286
+ machina config set api_url https://api.machina.gg
287
+ machina config set session_url https://session.machina.gg
288
+ machina config set default_organization_id <org-id>
289
+ machina config set default_project_id <project-id>
290
+ ```
291
+
292
+ Environment variables override config file values:
293
+
294
+ | Variable | Description |
295
+ |----------|-------------|
296
+ | `MACHINA_API_KEY` | API key for authentication |
297
+ | `MACHINA_API_URL` | Override Core API URL |
298
+
299
+ ### Shell Prompt Integration
300
+
301
+ Show current org/project in your terminal prompt:
302
+
303
+ ```bash
304
+ # Add to .zshrc or .bashrc
305
+ precmd() { RPROMPT=$(machina shell-prompt 2>/dev/null); }
306
+ ```
307
+
308
+ ## Development
309
+
310
+ ```bash
311
+ git clone https://github.com/machina-sports/machina-cli.git
312
+ cd machina-cli
313
+ python -m venv .venv && source .venv/bin/activate
314
+ pip install -e ".[dev]"
315
+ machina version
316
+ ```
317
+
318
+ ## License
319
+
320
+ MIT