aegra-cli 0.1.0__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.
@@ -0,0 +1,32 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # env files
13
+ .env
14
+
15
+ # Pycharm
16
+ .idea/
17
+
18
+ # VSCode
19
+ .vscode/
20
+
21
+ # Testing
22
+ .coverage
23
+ coverage.xml
24
+ htmlcov/
25
+ .pytest_cache/
26
+ .mypy_cache/
27
+
28
+ # Ruff
29
+ .ruff_cache/
30
+
31
+ # Pre-commit
32
+ .pre-commit-cache/
@@ -0,0 +1,360 @@
1
+ Metadata-Version: 2.4
2
+ Name: aegra-cli
3
+ Version: 0.1.0
4
+ Summary: Aegra CLI - Manage your self-hosted agent deployments
5
+ Author-email: Muhammad Ibrahim <mibrahim37612@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Keywords: agents,cli,deployment,docker,langgraph
8
+ Classifier: Development Status :: 4 - Beta
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Topic :: Software Development :: Build Tools
15
+ Requires-Python: >=3.11
16
+ Requires-Dist: aegra-api>=0.1.0
17
+ Requires-Dist: click>=8.1.7
18
+ Requires-Dist: jinja2>=3.1
19
+ Requires-Dist: rich>=13.0
20
+ Description-Content-Type: text/markdown
21
+
22
+ # aegra-cli
23
+
24
+ Aegra CLI - Command-line interface for managing self-hosted agent deployments.
25
+
26
+ Aegra is an open-source, self-hosted alternative to LangGraph Platform. Use this CLI to initialize projects, run development servers, manage Docker services, and handle database migrations.
27
+
28
+ ## Installation
29
+
30
+ ### From PyPI
31
+
32
+ ```bash
33
+ pip install aegra-cli
34
+ ```
35
+
36
+ ### From Source
37
+
38
+ ```bash
39
+ # Clone the repository
40
+ git clone https://github.com/your-org/aegra.git
41
+ cd aegra/libs/aegra-cli
42
+
43
+ # Install with pip
44
+ pip install -e .
45
+
46
+ # Or with uv
47
+ uv pip install -e .
48
+ ```
49
+
50
+ ## Quick Start
51
+
52
+ ```bash
53
+ # Initialize a new Aegra project
54
+ aegra init
55
+
56
+ # Start PostgreSQL with Docker
57
+ aegra up postgres
58
+
59
+ # Apply database migrations
60
+ aegra db upgrade
61
+
62
+ # Start the development server
63
+ aegra dev
64
+ ```
65
+
66
+ ## Commands
67
+
68
+ ### `aegra version`
69
+
70
+ Show version information for aegra-cli and aegra-api.
71
+
72
+ ```bash
73
+ aegra version
74
+ ```
75
+
76
+ Output displays a table with versions for both packages.
77
+
78
+ ---
79
+
80
+ ### `aegra init`
81
+
82
+ Initialize a new Aegra project with configuration files and directory structure.
83
+
84
+ ```bash
85
+ aegra init [OPTIONS]
86
+ ```
87
+
88
+ **Options:**
89
+
90
+ | Option | Description |
91
+ |--------|-------------|
92
+ | `--docker` | Include docker-compose.yml in the generated files |
93
+ | `--force` | Overwrite existing files if they exist |
94
+ | `--path PATH` | Project directory (default: current directory) |
95
+
96
+ **Examples:**
97
+
98
+ ```bash
99
+ # Initialize in current directory
100
+ aegra init
101
+
102
+ # Initialize with Docker Compose support
103
+ aegra init --docker
104
+
105
+ # Initialize in a specific directory, overwriting existing files
106
+ aegra init --path ./my-project --force
107
+ ```
108
+
109
+ **Created Files:**
110
+
111
+ - `aegra.json` - Graph configuration
112
+ - `.env.example` - Environment variable template
113
+ - `graphs/example/graph.py` - Example graph implementation
114
+ - `graphs/__init__.py` - Package init file
115
+ - `graphs/example/__init__.py` - Example package init file
116
+ - `docker-compose.yml` - Docker configuration (only with `--docker` flag)
117
+
118
+ ---
119
+
120
+ ### `aegra dev`
121
+
122
+ Run the development server with hot reload.
123
+
124
+ ```bash
125
+ aegra dev [OPTIONS]
126
+ ```
127
+
128
+ **Options:**
129
+
130
+ | Option | Default | Description |
131
+ |--------|---------|-------------|
132
+ | `--host HOST` | `127.0.0.1` | Host to bind the server to |
133
+ | `--port PORT` | `8000` | Port to bind the server to |
134
+ | `--app APP` | `aegra_api.main:app` | Application import path |
135
+
136
+ **Examples:**
137
+
138
+ ```bash
139
+ # Start with defaults (localhost:8000)
140
+ aegra dev
141
+
142
+ # Start on all interfaces, port 3000
143
+ aegra dev --host 0.0.0.0 --port 3000
144
+
145
+ # Start with a custom app
146
+ aegra dev --app myapp.main:app
147
+ ```
148
+
149
+ The server automatically restarts when code changes are detected.
150
+
151
+ ---
152
+
153
+ ### `aegra up`
154
+
155
+ Start services with Docker Compose.
156
+
157
+ ```bash
158
+ aegra up [OPTIONS] [SERVICES...]
159
+ ```
160
+
161
+ **Options:**
162
+
163
+ | Option | Description |
164
+ |--------|-------------|
165
+ | `-f, --file FILE` | Path to docker-compose.yml file |
166
+ | `--build` | Build images before starting containers |
167
+
168
+ **Arguments:**
169
+
170
+ | Argument | Description |
171
+ |----------|-------------|
172
+ | `SERVICES` | Optional list of specific services to start |
173
+
174
+ **Examples:**
175
+
176
+ ```bash
177
+ # Start all services
178
+ aegra up
179
+
180
+ # Start only postgres
181
+ aegra up postgres
182
+
183
+ # Build and start all services
184
+ aegra up --build
185
+
186
+ # Start with a custom compose file
187
+ aegra up -f ./docker-compose.prod.yml
188
+
189
+ # Start specific services with build
190
+ aegra up --build aegra postgres
191
+ ```
192
+
193
+ ---
194
+
195
+ ### `aegra down`
196
+
197
+ Stop services with Docker Compose.
198
+
199
+ ```bash
200
+ aegra down [OPTIONS] [SERVICES...]
201
+ ```
202
+
203
+ **Options:**
204
+
205
+ | Option | Description |
206
+ |--------|-------------|
207
+ | `-f, --file FILE` | Path to docker-compose.yml file |
208
+ | `-v, --volumes` | Remove named volumes declared in the compose file |
209
+
210
+ **Arguments:**
211
+
212
+ | Argument | Description |
213
+ |----------|-------------|
214
+ | `SERVICES` | Optional list of specific services to stop |
215
+
216
+ **Examples:**
217
+
218
+ ```bash
219
+ # Stop all services
220
+ aegra down
221
+
222
+ # Stop only postgres
223
+ aegra down postgres
224
+
225
+ # Stop and remove volumes (WARNING: data will be lost)
226
+ aegra down -v
227
+
228
+ # Stop with a custom compose file
229
+ aegra down -f ./docker-compose.prod.yml
230
+ ```
231
+
232
+ ---
233
+
234
+ ### `aegra db upgrade`
235
+
236
+ Apply all pending database migrations.
237
+
238
+ ```bash
239
+ aegra db upgrade
240
+ ```
241
+
242
+ Runs `alembic upgrade head` to apply all pending migrations and bring the database schema up to date.
243
+
244
+ **Example:**
245
+
246
+ ```bash
247
+ aegra db upgrade
248
+ ```
249
+
250
+ ---
251
+
252
+ ### `aegra db downgrade`
253
+
254
+ Downgrade database to a previous revision.
255
+
256
+ ```bash
257
+ aegra db downgrade [REVISION]
258
+ ```
259
+
260
+ **Arguments:**
261
+
262
+ | Argument | Default | Description |
263
+ |----------|---------|-------------|
264
+ | `REVISION` | `-1` | Target revision (use `-1` for one step back) |
265
+
266
+ **Examples:**
267
+
268
+ ```bash
269
+ # Downgrade by one revision
270
+ aegra db downgrade
271
+
272
+ # Downgrade by two revisions
273
+ aegra db downgrade -2
274
+
275
+ # Downgrade to initial state (removes all migrations)
276
+ aegra db downgrade base
277
+
278
+ # Downgrade to a specific revision
279
+ aegra db downgrade abc123
280
+ ```
281
+
282
+ ---
283
+
284
+ ### `aegra db current`
285
+
286
+ Show the current migration version.
287
+
288
+ ```bash
289
+ aegra db current
290
+ ```
291
+
292
+ Displays the current revision that the database is at. Useful for checking which migrations have been applied.
293
+
294
+ **Example:**
295
+
296
+ ```bash
297
+ aegra db current
298
+ ```
299
+
300
+ ---
301
+
302
+ ### `aegra db history`
303
+
304
+ Show migration history.
305
+
306
+ ```bash
307
+ aegra db history [OPTIONS]
308
+ ```
309
+
310
+ **Options:**
311
+
312
+ | Option | Description |
313
+ |--------|-------------|
314
+ | `-v, --verbose` | Show detailed migration information |
315
+
316
+ **Examples:**
317
+
318
+ ```bash
319
+ # Show migration history
320
+ aegra db history
321
+
322
+ # Show detailed history
323
+ aegra db history --verbose
324
+ aegra db history -v
325
+ ```
326
+
327
+ ---
328
+
329
+ ## Environment Variables
330
+
331
+ The CLI respects the following environment variables (typically set via `.env` file):
332
+
333
+ ```bash
334
+ # Database
335
+ POSTGRES_USER=aegra
336
+ POSTGRES_PASSWORD=aegra_secret
337
+ POSTGRES_HOST=localhost
338
+ POSTGRES_DB=aegra
339
+
340
+ # Authentication
341
+ AUTH_TYPE=noop # Options: noop, api_key, jwt
342
+
343
+ # Server (for aegra dev)
344
+ HOST=0.0.0.0
345
+ PORT=8000
346
+
347
+ # Configuration
348
+ AEGRA_CONFIG=aegra.json
349
+ ```
350
+
351
+ ## Requirements
352
+
353
+ - Python 3.11+
354
+ - Docker (for `aegra up` and `aegra down` commands)
355
+ - PostgreSQL (or use Docker)
356
+
357
+ ## Related Packages
358
+
359
+ - **aegra-api**: Core API package providing the Agent Protocol server
360
+ - **aegra**: Meta-package that installs both aegra-cli and aegra-api
@@ -0,0 +1,339 @@
1
+ # aegra-cli
2
+
3
+ Aegra CLI - Command-line interface for managing self-hosted agent deployments.
4
+
5
+ Aegra is an open-source, self-hosted alternative to LangGraph Platform. Use this CLI to initialize projects, run development servers, manage Docker services, and handle database migrations.
6
+
7
+ ## Installation
8
+
9
+ ### From PyPI
10
+
11
+ ```bash
12
+ pip install aegra-cli
13
+ ```
14
+
15
+ ### From Source
16
+
17
+ ```bash
18
+ # Clone the repository
19
+ git clone https://github.com/your-org/aegra.git
20
+ cd aegra/libs/aegra-cli
21
+
22
+ # Install with pip
23
+ pip install -e .
24
+
25
+ # Or with uv
26
+ uv pip install -e .
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ ```bash
32
+ # Initialize a new Aegra project
33
+ aegra init
34
+
35
+ # Start PostgreSQL with Docker
36
+ aegra up postgres
37
+
38
+ # Apply database migrations
39
+ aegra db upgrade
40
+
41
+ # Start the development server
42
+ aegra dev
43
+ ```
44
+
45
+ ## Commands
46
+
47
+ ### `aegra version`
48
+
49
+ Show version information for aegra-cli and aegra-api.
50
+
51
+ ```bash
52
+ aegra version
53
+ ```
54
+
55
+ Output displays a table with versions for both packages.
56
+
57
+ ---
58
+
59
+ ### `aegra init`
60
+
61
+ Initialize a new Aegra project with configuration files and directory structure.
62
+
63
+ ```bash
64
+ aegra init [OPTIONS]
65
+ ```
66
+
67
+ **Options:**
68
+
69
+ | Option | Description |
70
+ |--------|-------------|
71
+ | `--docker` | Include docker-compose.yml in the generated files |
72
+ | `--force` | Overwrite existing files if they exist |
73
+ | `--path PATH` | Project directory (default: current directory) |
74
+
75
+ **Examples:**
76
+
77
+ ```bash
78
+ # Initialize in current directory
79
+ aegra init
80
+
81
+ # Initialize with Docker Compose support
82
+ aegra init --docker
83
+
84
+ # Initialize in a specific directory, overwriting existing files
85
+ aegra init --path ./my-project --force
86
+ ```
87
+
88
+ **Created Files:**
89
+
90
+ - `aegra.json` - Graph configuration
91
+ - `.env.example` - Environment variable template
92
+ - `graphs/example/graph.py` - Example graph implementation
93
+ - `graphs/__init__.py` - Package init file
94
+ - `graphs/example/__init__.py` - Example package init file
95
+ - `docker-compose.yml` - Docker configuration (only with `--docker` flag)
96
+
97
+ ---
98
+
99
+ ### `aegra dev`
100
+
101
+ Run the development server with hot reload.
102
+
103
+ ```bash
104
+ aegra dev [OPTIONS]
105
+ ```
106
+
107
+ **Options:**
108
+
109
+ | Option | Default | Description |
110
+ |--------|---------|-------------|
111
+ | `--host HOST` | `127.0.0.1` | Host to bind the server to |
112
+ | `--port PORT` | `8000` | Port to bind the server to |
113
+ | `--app APP` | `aegra_api.main:app` | Application import path |
114
+
115
+ **Examples:**
116
+
117
+ ```bash
118
+ # Start with defaults (localhost:8000)
119
+ aegra dev
120
+
121
+ # Start on all interfaces, port 3000
122
+ aegra dev --host 0.0.0.0 --port 3000
123
+
124
+ # Start with a custom app
125
+ aegra dev --app myapp.main:app
126
+ ```
127
+
128
+ The server automatically restarts when code changes are detected.
129
+
130
+ ---
131
+
132
+ ### `aegra up`
133
+
134
+ Start services with Docker Compose.
135
+
136
+ ```bash
137
+ aegra up [OPTIONS] [SERVICES...]
138
+ ```
139
+
140
+ **Options:**
141
+
142
+ | Option | Description |
143
+ |--------|-------------|
144
+ | `-f, --file FILE` | Path to docker-compose.yml file |
145
+ | `--build` | Build images before starting containers |
146
+
147
+ **Arguments:**
148
+
149
+ | Argument | Description |
150
+ |----------|-------------|
151
+ | `SERVICES` | Optional list of specific services to start |
152
+
153
+ **Examples:**
154
+
155
+ ```bash
156
+ # Start all services
157
+ aegra up
158
+
159
+ # Start only postgres
160
+ aegra up postgres
161
+
162
+ # Build and start all services
163
+ aegra up --build
164
+
165
+ # Start with a custom compose file
166
+ aegra up -f ./docker-compose.prod.yml
167
+
168
+ # Start specific services with build
169
+ aegra up --build aegra postgres
170
+ ```
171
+
172
+ ---
173
+
174
+ ### `aegra down`
175
+
176
+ Stop services with Docker Compose.
177
+
178
+ ```bash
179
+ aegra down [OPTIONS] [SERVICES...]
180
+ ```
181
+
182
+ **Options:**
183
+
184
+ | Option | Description |
185
+ |--------|-------------|
186
+ | `-f, --file FILE` | Path to docker-compose.yml file |
187
+ | `-v, --volumes` | Remove named volumes declared in the compose file |
188
+
189
+ **Arguments:**
190
+
191
+ | Argument | Description |
192
+ |----------|-------------|
193
+ | `SERVICES` | Optional list of specific services to stop |
194
+
195
+ **Examples:**
196
+
197
+ ```bash
198
+ # Stop all services
199
+ aegra down
200
+
201
+ # Stop only postgres
202
+ aegra down postgres
203
+
204
+ # Stop and remove volumes (WARNING: data will be lost)
205
+ aegra down -v
206
+
207
+ # Stop with a custom compose file
208
+ aegra down -f ./docker-compose.prod.yml
209
+ ```
210
+
211
+ ---
212
+
213
+ ### `aegra db upgrade`
214
+
215
+ Apply all pending database migrations.
216
+
217
+ ```bash
218
+ aegra db upgrade
219
+ ```
220
+
221
+ Runs `alembic upgrade head` to apply all pending migrations and bring the database schema up to date.
222
+
223
+ **Example:**
224
+
225
+ ```bash
226
+ aegra db upgrade
227
+ ```
228
+
229
+ ---
230
+
231
+ ### `aegra db downgrade`
232
+
233
+ Downgrade database to a previous revision.
234
+
235
+ ```bash
236
+ aegra db downgrade [REVISION]
237
+ ```
238
+
239
+ **Arguments:**
240
+
241
+ | Argument | Default | Description |
242
+ |----------|---------|-------------|
243
+ | `REVISION` | `-1` | Target revision (use `-1` for one step back) |
244
+
245
+ **Examples:**
246
+
247
+ ```bash
248
+ # Downgrade by one revision
249
+ aegra db downgrade
250
+
251
+ # Downgrade by two revisions
252
+ aegra db downgrade -2
253
+
254
+ # Downgrade to initial state (removes all migrations)
255
+ aegra db downgrade base
256
+
257
+ # Downgrade to a specific revision
258
+ aegra db downgrade abc123
259
+ ```
260
+
261
+ ---
262
+
263
+ ### `aegra db current`
264
+
265
+ Show the current migration version.
266
+
267
+ ```bash
268
+ aegra db current
269
+ ```
270
+
271
+ Displays the current revision that the database is at. Useful for checking which migrations have been applied.
272
+
273
+ **Example:**
274
+
275
+ ```bash
276
+ aegra db current
277
+ ```
278
+
279
+ ---
280
+
281
+ ### `aegra db history`
282
+
283
+ Show migration history.
284
+
285
+ ```bash
286
+ aegra db history [OPTIONS]
287
+ ```
288
+
289
+ **Options:**
290
+
291
+ | Option | Description |
292
+ |--------|-------------|
293
+ | `-v, --verbose` | Show detailed migration information |
294
+
295
+ **Examples:**
296
+
297
+ ```bash
298
+ # Show migration history
299
+ aegra db history
300
+
301
+ # Show detailed history
302
+ aegra db history --verbose
303
+ aegra db history -v
304
+ ```
305
+
306
+ ---
307
+
308
+ ## Environment Variables
309
+
310
+ The CLI respects the following environment variables (typically set via `.env` file):
311
+
312
+ ```bash
313
+ # Database
314
+ POSTGRES_USER=aegra
315
+ POSTGRES_PASSWORD=aegra_secret
316
+ POSTGRES_HOST=localhost
317
+ POSTGRES_DB=aegra
318
+
319
+ # Authentication
320
+ AUTH_TYPE=noop # Options: noop, api_key, jwt
321
+
322
+ # Server (for aegra dev)
323
+ HOST=0.0.0.0
324
+ PORT=8000
325
+
326
+ # Configuration
327
+ AEGRA_CONFIG=aegra.json
328
+ ```
329
+
330
+ ## Requirements
331
+
332
+ - Python 3.11+
333
+ - Docker (for `aegra up` and `aegra down` commands)
334
+ - PostgreSQL (or use Docker)
335
+
336
+ ## Related Packages
337
+
338
+ - **aegra-api**: Core API package providing the Agent Protocol server
339
+ - **aegra**: Meta-package that installs both aegra-cli and aegra-api