cinna-cli 0.1.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.
- cinna/__init__.py +3 -0
- cinna/auth.py +42 -0
- cinna/bootstrap.py +278 -0
- cinna/client.py +169 -0
- cinna/config.py +193 -0
- cinna/console.py +39 -0
- cinna/context.py +216 -0
- cinna/errors.py +56 -0
- cinna/logging.py +38 -0
- cinna/main.py +715 -0
- cinna/mcp_proxy.py +151 -0
- cinna/mutagen_runtime.py +168 -0
- cinna/sync.py +120 -0
- cinna/sync_session.py +418 -0
- cinna/sync_ssh_shim.py +232 -0
- cinna/sync_tui.py +352 -0
- cinna/templates/CLAUDE.md.template +558 -0
- cinna/templates/__init__.py +0 -0
- cinna_cli-0.1.0.dist-info/METADATA +231 -0
- cinna_cli-0.1.0.dist-info/RECORD +23 -0
- cinna_cli-0.1.0.dist-info/WHEEL +4 -0
- cinna_cli-0.1.0.dist-info/entry_points.txt +3 -0
- cinna_cli-0.1.0.dist-info/licenses/LICENSE.md +21 -0
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cinna-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Local development CLI for Cinna Core agents
|
|
5
|
+
Project-URL: Homepage, https://github.com/opencinna/cinna-cli
|
|
6
|
+
Project-URL: Repository, https://github.com/opencinna/cinna-cli
|
|
7
|
+
Project-URL: Issues, https://github.com/opencinna/cinna-cli/issues
|
|
8
|
+
Author-email: evgeny-l <evgeny-l@opencinna.io>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE.md
|
|
11
|
+
Keywords: agents,cinna,cli,developer-tools,mcp,mutagen
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Software Development
|
|
23
|
+
Classifier: Topic :: Utilities
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: click>=8.1
|
|
26
|
+
Requires-Dist: httpx>=0.27
|
|
27
|
+
Requires-Dist: mcp>=1.0
|
|
28
|
+
Requires-Dist: rich>=13.0
|
|
29
|
+
Requires-Dist: textual>=0.50
|
|
30
|
+
Requires-Dist: websockets>=12.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: respx>=0.21; extra == 'dev'
|
|
35
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# cinna-cli
|
|
39
|
+
|
|
40
|
+
Local development CLI for [Cinna Core](https://github.com/opencinna/cinna-core) agents.
|
|
41
|
+
|
|
42
|
+
Work on agent scripts, prompts, and webapps locally with your own editor and AI tools. The CLI keeps your workspace continuously synced with the remote agent environment, streams commands to it, and wires up MCP integration — so the platform is the single source of truth for runtime and credentials.
|
|
43
|
+
|
|
44
|
+
## How It Works
|
|
45
|
+
|
|
46
|
+
Cinna Core agents run in managed cloud environments. `cinna-cli` does **not** run a local Docker container. Instead:
|
|
47
|
+
|
|
48
|
+
1. **Continuous sync** — [Mutagen](https://mutagen.io) keeps `./workspace` bidirectionally synced with the remote agent env over a WebSocket tunnel to the platform.
|
|
49
|
+
2. **Remote exec** — `cinna exec <cmd>` streams your command through the platform to the remote env, with live stdout/stderr and the remote process's exit code.
|
|
50
|
+
3. **MCP integration** — the local MCP proxy gives Claude Code / opencode access to the agent's knowledge base.
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
Your Editor / Claude Code
|
|
54
|
+
│
|
|
55
|
+
▼
|
|
56
|
+
workspace/ ← edit locally
|
|
57
|
+
│
|
|
58
|
+
cinna sync (Mutagen) ◄──► Remote Agent Environment (no local container)
|
|
59
|
+
│
|
|
60
|
+
cinna exec <cmd> ── streaming output
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Prerequisites
|
|
64
|
+
|
|
65
|
+
- **Python 3.10+**
|
|
66
|
+
- **[Mutagen](https://mutagen.io)** (version pinned by the platform — `cinna setup` checks and prompts to install)
|
|
67
|
+
|
|
68
|
+
## Getting Started
|
|
69
|
+
|
|
70
|
+
Setup is initiated from the Cinna Core platform UI. Click **"Local Development"** on your agent's page to get a bootstrap command:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
curl -s https://your-platform.com/api/cli-setup/TOKEN | python3 -
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This will:
|
|
77
|
+
|
|
78
|
+
1. Install `cinna-cli` (via `uv`, `pipx`, or `pip`)
|
|
79
|
+
2. Exchange the setup token for CLI credentials
|
|
80
|
+
3. Verify / prompt-install the required Mutagen version
|
|
81
|
+
4. Clone the workspace (one-shot tarball; Mutagen takes over afterwards)
|
|
82
|
+
5. Generate `CLAUDE.md`, `BUILDING_AGENT.md`, `.mcp.json`, `opencode.json`, `.gitignore`, `mutagen.yml`
|
|
83
|
+
6. Start the continuous sync session
|
|
84
|
+
|
|
85
|
+
After setup:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
cd hr-manager-agent/
|
|
89
|
+
cinna dev # start a foreground dev session (live sync + TUI)
|
|
90
|
+
claude # open Claude Code (MCP tools auto-configured)
|
|
91
|
+
cinna sync status # see sync state from another terminal
|
|
92
|
+
cinna exec python scripts/main.py # run a command in the remote env
|
|
93
|
+
cinna list # see every agent registered on this machine
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Commands
|
|
97
|
+
|
|
98
|
+
### `cinna setup <token_or_url>`
|
|
99
|
+
|
|
100
|
+
Initialize a local workspace. Accepts the setup token, the URL, or the full curl command from the platform UI.
|
|
101
|
+
|
|
102
|
+
The agent directory name is normalized to lowercase with dashes ("HR Manager Agent" → `hr-manager-agent/`).
|
|
103
|
+
|
|
104
|
+
### `cinna set-token <token_or_url>`
|
|
105
|
+
|
|
106
|
+
Refresh the CLI token on the current workspace without re-cloning. Run this from inside an existing agent directory when the stored token has expired — `cinna set-token` re-exchanges the setup token via `POST /api/cli-setup/{token}` and swaps the result into `.cinna/config.json` and `~/.cinna/agents.json` in place. Workspace files, `mutagen.yml`, and generated context files are left untouched.
|
|
107
|
+
|
|
108
|
+
Accepts the same input forms as `cinna setup` (curl command, URL, or bare token). When only a bare token is given, the platform URL is reused from the workspace's existing `.cinna/config.json` — so you can refresh each agent from inside its own directory even if different agents live on different platforms. The exchanged token must belong to the same agent as the workspace; mismatched agent IDs abort the refresh.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
cd hr-manager-agent/
|
|
112
|
+
cinna set-token yWo36tbkdAOzrALxOEKq31_OA2iMelEg
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### `cinna dev`
|
|
116
|
+
|
|
117
|
+
Start a foreground dev session — creates / resumes the Mutagen sync session for this workspace and attaches the terminal to a two-tab TUI (status + raw Mutagen details). Ctrl-C terminates the session; sync does not outlive the TUI. To observe sync from another terminal without affecting it, use `cinna sync status`.
|
|
118
|
+
|
|
119
|
+
### `cinna sync status | conflicts`
|
|
120
|
+
|
|
121
|
+
Read-only views onto the live sync session (started by `cinna dev`).
|
|
122
|
+
|
|
123
|
+
- `status` — state, pending changes, conflict count.
|
|
124
|
+
- `conflicts` — list any conflict copies Mutagen has written. Resolve by picking a winner in your editor and deleting the `.conflict.*` copy.
|
|
125
|
+
|
|
126
|
+
### `cinna exec <command…>`
|
|
127
|
+
|
|
128
|
+
Stream a command through the platform to the remote agent environment. Output streams back live; Ctrl+C aborts. Exit code matches the remote process.
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
cinna exec python scripts/main.py
|
|
132
|
+
cinna exec pip install pandas
|
|
133
|
+
cinna exec 'bash -c "ls -la"'
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### `cinna status`
|
|
137
|
+
|
|
138
|
+
One-shot summary of the agent + current sync state. Includes a backend probe (`GET /sync-runtime`) that reports whether the stored CLI token is still accepted — `valid token`, `expired token`, or `no connection`. Use `cinna set-token` to refresh an expired token.
|
|
139
|
+
|
|
140
|
+
### `cinna list`
|
|
141
|
+
|
|
142
|
+
List every agent registered on this machine (from `~/.cinna/agents.json`). Three columns:
|
|
143
|
+
|
|
144
|
+
1. **Agent** — display name on top, full agent ID below.
|
|
145
|
+
2. **Location** — workspace path on top, platform UI link below. Missing directories are flagged in red.
|
|
146
|
+
3. **Sync** — Mutagen session state on top (`active` / `paused` / `connecting` / `error`), plus a per-agent backend probe (`valid token` / `expired token` / `no connection`) on the bottom. The probes run in parallel with a short timeout so the view stays snappy even with many registered agents.
|
|
147
|
+
|
|
148
|
+
### `cinna disconnect`
|
|
149
|
+
|
|
150
|
+
Stop sync, remove `.cinna/` config and generated files (`CLAUDE.md`, `BUILDING_AGENT.md`, `.mcp.json`, `opencode.json`, `mutagen.yml`). Workspace files are preserved.
|
|
151
|
+
|
|
152
|
+
### `cinna disconnect-all`
|
|
153
|
+
|
|
154
|
+
Scan the current directory for every cinna workspace (directories containing `.cinna/config.json`), stop each sync session, and delete the directories entirely. Prompts for confirmation and prints a summary of what was removed.
|
|
155
|
+
|
|
156
|
+
### `cinna completion [SHELL] [--install]`
|
|
157
|
+
|
|
158
|
+
Output or install shell completion for bash, zsh, or fish.
|
|
159
|
+
|
|
160
|
+
## Workspace Structure
|
|
161
|
+
|
|
162
|
+
After setup, the agent directory looks like:
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
my-agent/
|
|
166
|
+
.cinna/ # CLI config (do not edit)
|
|
167
|
+
config.json
|
|
168
|
+
workspace/ # Continuously synced with the remote env
|
|
169
|
+
scripts/ # Bundle-owned: agent Python scripts
|
|
170
|
+
docs/ # Bundle-owned: WORKFLOW/ENTRYPOINT/REFINER prompts
|
|
171
|
+
webapp/ # Bundle-owned: dashboard + data endpoints
|
|
172
|
+
knowledge/ # Bundle-owned: static integration docs
|
|
173
|
+
files/ # Bundle-owned: static publisher-shipped assets
|
|
174
|
+
app-data/ # Per-user persistent — NOT shipped in bundle revisions.
|
|
175
|
+
# Backed by a platform AppDataVolume keyed by (user_id, bundle_id);
|
|
176
|
+
# mounted on the platform at /app/workspace/app-data.
|
|
177
|
+
# Survives apply-update and uninstall/reinstall.
|
|
178
|
+
storage/ # long-lived runtime output (DBs, reports, derived data)
|
|
179
|
+
uploads/ # all user-supplied file uploads at runtime
|
|
180
|
+
# (chat attachments, task attachments, MCP uploads)
|
|
181
|
+
cache/ # disposable caches
|
|
182
|
+
credentials/ # Backend-managed; visible read-only on your side
|
|
183
|
+
workspace_requirements.txt
|
|
184
|
+
workspace_system_packages.txt
|
|
185
|
+
mutagen.yml # Sync rules (customizable)
|
|
186
|
+
CLAUDE.md # Local dev instructions for AI tools
|
|
187
|
+
BUILDING_AGENT.md # Building mode prompt pulled from the platform
|
|
188
|
+
.mcp.json # MCP config for Claude Code
|
|
189
|
+
opencode.json # MCP config for opencode
|
|
190
|
+
.gitignore # ignores workspace/credentials/ and workspace/app-data/
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Persistence tiers** mirror the platform's bundle/install model:
|
|
194
|
+
|
|
195
|
+
- **Bundle-owned** folders (`scripts/`, `docs/`, `webapp/`, `knowledge/`, `files/`, `workspace_requirements.txt`, `workspace_system_packages.txt`) are part of what gets snapshotted when a new bundle revision is published. As the developer/publisher, your edits here become the next shipped revision.
|
|
196
|
+
- **`app-data/`** is the per-user persistent runtime volume. On the platform it lives in an `AppDataVolume` keyed by `(user_id, bundle_id)` — one volume per user per bundle, bind-mounted into the agent container at `/app/workspace/app-data`. It is **not** part of bundle revisions: when you publish, only the bundle-owned folders are snapshotted, and every user who installs your bundle gets their own fresh app-data volume. On the platform side the volume survives `apply-update` (bundle folders are overwritten, app-data is never touched) and uninstall/reinstall (orphaned, not deleted; reattaches by `bundle_id`). What you see synced to your local `workspace/app-data/` is your *own* developer install's app-data — useful for inspecting runtime output your scripts produce. It's gitignored by default since it's per-user runtime state, not bundle content.
|
|
197
|
+
|
|
198
|
+
Where scripts should put what:
|
|
199
|
+
- **`storage/`** — long-lived runtime state (databases, JSON, CSVs, generated reports). Anything the agent must keep across sessions and bundle updates.
|
|
200
|
+
- **`uploads/`** — every user-supplied file at runtime lands here automatically: chat attachments, task attachments, MCP `get_file_upload_url` uploads. Read from this folder, don't write to it from scripts.
|
|
201
|
+
- **`cache/`** — disposable caches the scripts may rebuild on demand.
|
|
202
|
+
- **`credentials/`** is managed by the backend and only readable on your side.
|
|
203
|
+
|
|
204
|
+
## Working with AI Coding Tools
|
|
205
|
+
|
|
206
|
+
Setup generates MCP server configs for **Claude Code** (`.mcp.json`) and **opencode** (`opencode.json`), giving your AI tool a `knowledge_query` tool that searches the agent's knowledge base.
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
cd my-agent/
|
|
210
|
+
claude # or: opencode
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Sync & Conflict Resolution
|
|
214
|
+
|
|
215
|
+
`cinna sync` drives Mutagen in `two-way-safe` mode with VCS-aware ignores. When the same file changes on both sides, Mutagen writes `<file>.conflict.<side>.<timestamp>` instead of picking a winner — inspect them with `cinna sync conflicts`, resolve, and delete the conflict copy.
|
|
216
|
+
|
|
217
|
+
Large binary files and build artifacts are ignored by default (see `mutagen.yml`). Add your own ignores there if needed.
|
|
218
|
+
|
|
219
|
+
## Development
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
git clone https://github.com/opencinna/cinna-cli.git
|
|
223
|
+
cd cinna-cli
|
|
224
|
+
uv venv && uv pip install -e ".[dev]"
|
|
225
|
+
uv run pytest -v
|
|
226
|
+
uv run ruff check src/
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## License
|
|
230
|
+
|
|
231
|
+
MIT
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
cinna/__init__.py,sha256=bOmc91LU6gdXMnmMbBfHhwF-y3xEi-QuXdGL9S4YiII,88
|
|
2
|
+
cinna/auth.py,sha256=HTzv-qI9Dq2KLmYumoxrBGXgCqNErEROV3YqxyIRn-o,1312
|
|
3
|
+
cinna/bootstrap.py,sha256=CMWh8S0ixdDZ8BsNP5um7uuOkFrKVwf0CeUKJn2LmmU,10550
|
|
4
|
+
cinna/client.py,sha256=3iUYCacCJqdvJMFvfZlzfdQ1qkevEQOnznAMkqoD7EA,6199
|
|
5
|
+
cinna/config.py,sha256=rF-oMTAYAztIJZo4oBezS-C2dPofADPKm0cPlFBAJe8,6454
|
|
6
|
+
cinna/console.py,sha256=m2AN2DW1KQcjd-AwHSYZZu5zu4JQI4SBqfUimAyQA24,966
|
|
7
|
+
cinna/context.py,sha256=EQ6GoBenEneMXbwsAouXnSqeTrF7fW7G-nK0dV4wnDM,7756
|
|
8
|
+
cinna/errors.py,sha256=U-wo5tbz0wwRoDjkR4Jw0H5gzQTbrHmejlVyOfs5_no,1896
|
|
9
|
+
cinna/logging.py,sha256=SzilkiYqnBaqrQGz6QuoF-4Ix0s0V5sXv7k09Mrnc-Y,1224
|
|
10
|
+
cinna/main.py,sha256=6NBv9SVSCmjV0SLeYe-dp0m-UlS4Rmt3DFeaFGCqxKk,24747
|
|
11
|
+
cinna/mcp_proxy.py,sha256=tBxh6c-dM6Ma-shTvbF86BPwy3Tilz4-9Js2xN_8vJ8,5118
|
|
12
|
+
cinna/mutagen_runtime.py,sha256=roBbS-kLFPz2KoJC-4JXfD6Swbpbfi4XjLHmDfSrxEM,5636
|
|
13
|
+
cinna/sync.py,sha256=aCVhXFN-h9YCdFF13a6e0Uyk6upXBQr6OpjyUH7SjKk,4274
|
|
14
|
+
cinna/sync_session.py,sha256=E8GHa6hxGebQEI92CgTw6aAYinOT4O2kn2sOZ1w8I1A,14130
|
|
15
|
+
cinna/sync_ssh_shim.py,sha256=zkI43K8mBka5-xCkKnbTLU2p_EYGcpqXwuDXMrE2DpE,7978
|
|
16
|
+
cinna/sync_tui.py,sha256=SWzh9JvSw0Cd0E92Zu8Kr022vBa2D3Dm4Po8r3WeErQ,13816
|
|
17
|
+
cinna/templates/CLAUDE.md.template,sha256=cTVQ2Dmaj8Lam7Ph2_wSl37G3bwlrvDk-_PLwOj38Pk,37272
|
|
18
|
+
cinna/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
cinna_cli-0.1.0.dist-info/METADATA,sha256=FEtWnVpR2ID757gm8fCZnxpUECMz1rfHcXUbkAisMr8,11844
|
|
20
|
+
cinna_cli-0.1.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
21
|
+
cinna_cli-0.1.0.dist-info/entry_points.txt,sha256=DjNWWC4ZX1q4F3yjvrw4bI1svGeAG94la1ws1MjzL34,83
|
|
22
|
+
cinna_cli-0.1.0.dist-info/licenses/LICENSE.md,sha256=gVEdPREa-NR6fUryFu-ZAyYB5qkipYPro6fIrndBbtc,1066
|
|
23
|
+
cinna_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OpenCinna
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|