@orcapt/cli 1.0.0
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.
- package/LICENSE +22 -0
- package/QUICK_START.md +241 -0
- package/README.md +949 -0
- package/bin/orca.js +406 -0
- package/package.json +58 -0
- package/src/commands/db.js +248 -0
- package/src/commands/fetch-doc.js +220 -0
- package/src/commands/kickstart-node.js +431 -0
- package/src/commands/kickstart-python.js +360 -0
- package/src/commands/lambda.js +736 -0
- package/src/commands/login.js +277 -0
- package/src/commands/storage.js +911 -0
- package/src/commands/ui.js +286 -0
- package/src/config.js +62 -0
- package/src/utils/docker-helper.js +357 -0
- package/src/utils/index.js +349 -0
package/README.md
ADDED
|
@@ -0,0 +1,949 @@
|
|
|
1
|
+
# @orcapt/cli
|
|
2
|
+
|
|
3
|
+
> A powerful command-line tool for managing Orca projects. Set up and run your AI agent in seconds! 🚀
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 🎯 **One Command Setup** - Clone, configure, and run with `orcapt kickstart <language>`
|
|
8
|
+
- 🌐 **Multi-Language Support** - Python ✅ | Node.js ✅ | Go (coming soon)
|
|
9
|
+
- 🖥️ **Cross-Platform** - Works on Windows, Linux, and macOS
|
|
10
|
+
- 📦 **No Dependencies** - Just Node.js (which you already have!)
|
|
11
|
+
- 🎨 **Beautiful UI** - Colorful output with progress indicators
|
|
12
|
+
- ⚡ **Fast** - Node.js native performance
|
|
13
|
+
- 🔄 **Process Management** - Manages both backend and frontend automatically
|
|
14
|
+
- 🚀 **Lambda Deployment** - Deploy Docker images to AWS Lambda with one command
|
|
15
|
+
- 💾 **Storage Management** - Manage S3-compatible storage buckets and files
|
|
16
|
+
- 🗄️ **Database Management** - Create and manage PostgreSQL databases
|
|
17
|
+
|
|
18
|
+
## 🌟 What's New
|
|
19
|
+
|
|
20
|
+
### Latest Features (v2.0)
|
|
21
|
+
|
|
22
|
+
- 🚀 **`orcapt ship`** - Deploy Docker images to AWS Lambda in one command!
|
|
23
|
+
- 📊 **Real-time Progress Bar** - See exactly how much of your image has been pushed
|
|
24
|
+
- 🔐 **Environment Variables** - Support for `.env` files and `--env` flags
|
|
25
|
+
- 💾 **Storage Management** - Full S3-compatible storage with buckets, files, and permissions
|
|
26
|
+
- 🗄️ **Database Management** - PostgreSQL database creation and management
|
|
27
|
+
- 🔑 **Authentication** - Secure workspace-based authentication
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 📦 Installation
|
|
32
|
+
|
|
33
|
+
### Quick Install (Recommended)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Install globally via npm
|
|
37
|
+
npm install -g @orcapt/cli
|
|
38
|
+
|
|
39
|
+
# Or use it directly with npx (no installation needed)
|
|
40
|
+
npx @orcapt/cli kickstart python
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Install from Source
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Clone the repository
|
|
47
|
+
git clone https://github.com/Orcapt/orca-cli
|
|
48
|
+
cd orca-cli
|
|
49
|
+
|
|
50
|
+
# Install dependencies
|
|
51
|
+
npm install
|
|
52
|
+
|
|
53
|
+
# Link globally
|
|
54
|
+
npm link
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 🚀 Quick Start
|
|
58
|
+
|
|
59
|
+
### Prerequisites
|
|
60
|
+
|
|
61
|
+
Make sure you have these installed:
|
|
62
|
+
|
|
63
|
+
- **Node.js** 14+ (you already have this!)
|
|
64
|
+
- **Python** 3.8+ (for Python starter kit)
|
|
65
|
+
- **Git**
|
|
66
|
+
- **Docker** (for Lambda deployments)
|
|
67
|
+
|
|
68
|
+
### Authentication
|
|
69
|
+
|
|
70
|
+
First, authenticate with Orca:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
orcapt login
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Usage
|
|
77
|
+
|
|
78
|
+
Create and run a new Orca Python agent in one command:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
orcapt kickstart python
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
That's it! This will:
|
|
85
|
+
|
|
86
|
+
1. ✅ Check prerequisites (Python, Git, Node.js)
|
|
87
|
+
2. 📁 Create `orca-kickstart` directory
|
|
88
|
+
3. 📦 Clone the [starter kit](https://github.com/Orcapt/orca-starter-kit-python-v1)
|
|
89
|
+
4. 🐍 Set up Python virtual environment
|
|
90
|
+
5. 📥 Install all dependencies
|
|
91
|
+
6. 🚀 Start backend (port 5001)
|
|
92
|
+
7. 🎨 Start frontend (port 3000)
|
|
93
|
+
|
|
94
|
+
## 📖 Command Reference
|
|
95
|
+
|
|
96
|
+
### Authentication Commands
|
|
97
|
+
|
|
98
|
+
#### `orcapt login`
|
|
99
|
+
|
|
100
|
+
Authenticate with Orca platform.
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
orcapt login
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
#### `orcapt logout`
|
|
107
|
+
|
|
108
|
+
Clear stored credentials.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
orcapt logout
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### `orcapt status`
|
|
115
|
+
|
|
116
|
+
Check authentication status and workspace info.
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
orcapt status
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### `orcapt kickstart <language>`
|
|
125
|
+
|
|
126
|
+
Quick setup for a new Orca project in your preferred language.
|
|
127
|
+
|
|
128
|
+
#### Available Languages:
|
|
129
|
+
|
|
130
|
+
- **`python`** - Python-based agent (FastAPI + OpenAI) ✅ Available now
|
|
131
|
+
- **`node`** - Node.js-based agent (Express + OpenAI) ✅ Available now
|
|
132
|
+
- **`go`** - Go-based agent 🚧 Coming soon
|
|
133
|
+
|
|
134
|
+
#### `orcapt kickstart python`
|
|
135
|
+
|
|
136
|
+
Set up a Python-based Orca agent with FastAPI and OpenAI.
|
|
137
|
+
|
|
138
|
+
**Options:**
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
-d, --directory <name> Directory name (default: "orca-kickstart")
|
|
142
|
+
-p, --port <number> Frontend port (default: 3000)
|
|
143
|
+
-a, --agent-port <number> Backend port (default: 5001)
|
|
144
|
+
--no-start Skip auto-starting servers
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Examples:**
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Basic usage
|
|
151
|
+
orcapt kickstart python
|
|
152
|
+
|
|
153
|
+
# Custom directory name
|
|
154
|
+
orcapt kickstart python --directory my-awesome-agent
|
|
155
|
+
|
|
156
|
+
# Custom ports
|
|
157
|
+
orcapt kickstart python --port 8080 --agent-port 8000
|
|
158
|
+
|
|
159
|
+
# Setup without auto-start
|
|
160
|
+
orcapt kickstart python --no-start
|
|
161
|
+
|
|
162
|
+
# All options combined
|
|
163
|
+
orcapt kickstart python -d my-agent -p 4000 -a 5000
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### `orcapt kickstart node`
|
|
167
|
+
|
|
168
|
+
Set up a Node.js-based Orca agent with Express and OpenAI.
|
|
169
|
+
|
|
170
|
+
**Options:** Same as Python (see above)
|
|
171
|
+
|
|
172
|
+
**Examples:**
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
# Basic usage
|
|
176
|
+
orcapt kickstart node
|
|
177
|
+
|
|
178
|
+
# Custom directory name
|
|
179
|
+
orcapt kickstart node --directory my-node-agent
|
|
180
|
+
|
|
181
|
+
# Custom ports
|
|
182
|
+
orcapt kickstart node --port 8080 --agent-port 8000
|
|
183
|
+
|
|
184
|
+
# All options combined
|
|
185
|
+
orcapt kickstart node -d my-agent -p 4000 -a 5000
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
#### Coming Soon:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
# Go agent (coming soon)
|
|
192
|
+
orcapt kickstart go
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### 🚀 `orcapt ship <function-name>`
|
|
198
|
+
|
|
199
|
+
Deploy Docker images to AWS Lambda with one command!
|
|
200
|
+
|
|
201
|
+
**Syntax:**
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
orcapt ship <function-name> [options]
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
**Options:**
|
|
208
|
+
|
|
209
|
+
- `--image <image>` - Docker image (registry/image:tag) **[Required]**
|
|
210
|
+
- `--memory <mb>` - Memory in MB (default: 512)
|
|
211
|
+
- `--timeout <seconds>` - Timeout in seconds (default: 30)
|
|
212
|
+
- `--env <key=value>` - Environment variable (can be repeated)
|
|
213
|
+
- `--env-file <path>` - Path to .env file
|
|
214
|
+
|
|
215
|
+
**Examples:**
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Basic deployment
|
|
219
|
+
orcapt ship my-api --image=my-app:latest
|
|
220
|
+
|
|
221
|
+
# With custom memory and timeout
|
|
222
|
+
orcapt ship my-api \
|
|
223
|
+
--image=my-app:latest \
|
|
224
|
+
--memory=1024 \
|
|
225
|
+
--timeout=60
|
|
226
|
+
|
|
227
|
+
# With environment variables
|
|
228
|
+
orcapt ship my-api \
|
|
229
|
+
--image=my-app:latest \
|
|
230
|
+
--env DATABASE_URL=postgres://... \
|
|
231
|
+
--env API_KEY=secret123 \
|
|
232
|
+
--env DEBUG=true
|
|
233
|
+
|
|
234
|
+
# With .env file
|
|
235
|
+
orcapt ship my-api \
|
|
236
|
+
--image=my-app:latest \
|
|
237
|
+
--env-file=.env
|
|
238
|
+
|
|
239
|
+
# Override .env with specific values
|
|
240
|
+
orcapt ship my-api \
|
|
241
|
+
--image=my-app:latest \
|
|
242
|
+
--env-file=.env \
|
|
243
|
+
--env DEBUG=false
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
**What it does:**
|
|
247
|
+
|
|
248
|
+
1. ✅ Checks Docker installation
|
|
249
|
+
2. ✅ Validates local image exists
|
|
250
|
+
3. ✅ Requests ECR credentials from backend
|
|
251
|
+
4. ✅ Logs into AWS ECR
|
|
252
|
+
5. ✅ Tags image for ECR
|
|
253
|
+
6. ✅ Pushes image to ECR (with progress bar!)
|
|
254
|
+
7. ✅ Creates/updates Lambda function
|
|
255
|
+
8. ✅ Configures Function URL
|
|
256
|
+
9. ✅ Returns invoke URL
|
|
257
|
+
|
|
258
|
+
**Output:**
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
============================================================
|
|
262
|
+
🚀 Deploying Lambda Function
|
|
263
|
+
============================================================
|
|
264
|
+
|
|
265
|
+
Function: my-api
|
|
266
|
+
Image: my-app:latest
|
|
267
|
+
Memory: 1024 MB
|
|
268
|
+
Timeout: 60s
|
|
269
|
+
Workspace: my-workspace
|
|
270
|
+
Env Vars: 3 variables
|
|
271
|
+
|
|
272
|
+
✓ Docker is installed and running
|
|
273
|
+
✓ Found image 'my-app:latest' (259 MB)
|
|
274
|
+
✓ ECR credentials received
|
|
275
|
+
✓ Logged into ECR
|
|
276
|
+
✓ Image tagged for ECR
|
|
277
|
+
✓ Image pushed to ECR [████████████████████] 100% (3/3 layers)
|
|
278
|
+
✓ Lambda function created
|
|
279
|
+
✓ API Gateway configured
|
|
280
|
+
✓ Deployment completed
|
|
281
|
+
|
|
282
|
+
============================================================
|
|
283
|
+
✓ Function deployed successfully!
|
|
284
|
+
============================================================
|
|
285
|
+
|
|
286
|
+
Function Details:
|
|
287
|
+
Name: my-api
|
|
288
|
+
Image: 123456789.dkr.ecr.us-east-1.amazonaws.com/...
|
|
289
|
+
Region: us-east-1
|
|
290
|
+
Memory: 1024 MB
|
|
291
|
+
Timeout: 60s
|
|
292
|
+
Status: Active
|
|
293
|
+
|
|
294
|
+
Invoke URL:
|
|
295
|
+
https://abc123.lambda-url.us-east-1.on.aws
|
|
296
|
+
|
|
297
|
+
Try it:
|
|
298
|
+
curl https://abc123.lambda-url.us-east-1.on.aws
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
### Lambda Management Commands
|
|
304
|
+
|
|
305
|
+
#### `orcapt lambda list`
|
|
306
|
+
|
|
307
|
+
List all Lambda functions in your workspace.
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
orcapt lambda list
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
#### `orcapt lambda info <function-name>`
|
|
314
|
+
|
|
315
|
+
Get detailed information about a Lambda function.
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
orcapt lambda info my-api
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
#### `orcapt lambda invoke <function-name>`
|
|
322
|
+
|
|
323
|
+
Invoke a Lambda function.
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
# Simple invoke
|
|
327
|
+
orcapt lambda invoke my-api
|
|
328
|
+
|
|
329
|
+
# With JSON payload
|
|
330
|
+
orcapt lambda invoke my-api --payload '{"key": "value"}'
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
#### `orcapt lambda logs <function-name>`
|
|
334
|
+
|
|
335
|
+
View Lambda function logs.
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
# Recent logs
|
|
339
|
+
orcapt lambda logs my-api
|
|
340
|
+
|
|
341
|
+
# Stream logs in real-time
|
|
342
|
+
orcapt lambda logs my-api --tail
|
|
343
|
+
|
|
344
|
+
# Logs from last hour
|
|
345
|
+
orcapt lambda logs my-api --since 1h
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
#### `orcapt lambda remove <function-name>`
|
|
349
|
+
|
|
350
|
+
Delete a Lambda function.
|
|
351
|
+
|
|
352
|
+
```bash
|
|
353
|
+
orcapt lambda remove my-api
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
### 💾 Storage Commands
|
|
359
|
+
|
|
360
|
+
Manage S3-compatible storage buckets and files.
|
|
361
|
+
|
|
362
|
+
#### Bucket Management
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
# Create bucket
|
|
366
|
+
orcapt storage bucket create my-bucket
|
|
367
|
+
|
|
368
|
+
# Create public bucket with versioning
|
|
369
|
+
orcapt storage bucket create my-bucket --public --versioning
|
|
370
|
+
|
|
371
|
+
# List all buckets
|
|
372
|
+
orcapt storage bucket list
|
|
373
|
+
|
|
374
|
+
# Get bucket info
|
|
375
|
+
orcapt storage bucket info my-bucket
|
|
376
|
+
|
|
377
|
+
# Delete bucket
|
|
378
|
+
orcapt storage bucket delete my-bucket
|
|
379
|
+
|
|
380
|
+
# Force delete (removes all files)
|
|
381
|
+
orcapt storage bucket delete my-bucket --force
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
#### File Management
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
# Upload file
|
|
388
|
+
orcapt storage upload my-bucket ./file.txt
|
|
389
|
+
|
|
390
|
+
# Upload to specific folder
|
|
391
|
+
orcapt storage upload my-bucket ./file.txt --folder=/documents
|
|
392
|
+
|
|
393
|
+
# Upload as public file
|
|
394
|
+
orcapt storage upload my-bucket ./file.txt --public
|
|
395
|
+
|
|
396
|
+
# List files in bucket
|
|
397
|
+
orcapt storage files my-bucket
|
|
398
|
+
|
|
399
|
+
# List files in folder
|
|
400
|
+
orcapt storage files my-bucket --folder=/documents
|
|
401
|
+
|
|
402
|
+
# Download file
|
|
403
|
+
orcapt storage download my-bucket file.txt
|
|
404
|
+
|
|
405
|
+
# Download to specific path
|
|
406
|
+
orcapt storage download my-bucket file.txt ./downloads/
|
|
407
|
+
|
|
408
|
+
# Delete file
|
|
409
|
+
orcapt storage delete my-bucket file.txt
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
#### Permission Management
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
# Add permission
|
|
416
|
+
orcapt storage permission add my-bucket \
|
|
417
|
+
--target-type=user \
|
|
418
|
+
--target-id=user123 \
|
|
419
|
+
--read \
|
|
420
|
+
--write
|
|
421
|
+
|
|
422
|
+
# List permissions
|
|
423
|
+
orcapt storage permission list my-bucket
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
---
|
|
427
|
+
|
|
428
|
+
### 🗄️ Database Commands
|
|
429
|
+
|
|
430
|
+
Create and manage PostgreSQL databases.
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
# Create database
|
|
434
|
+
orcapt db create
|
|
435
|
+
|
|
436
|
+
# List all databases
|
|
437
|
+
orcapt db list
|
|
438
|
+
|
|
439
|
+
# Delete database
|
|
440
|
+
orcapt db remove my-database
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
---
|
|
444
|
+
|
|
445
|
+
### 🎨 UI Commands
|
|
446
|
+
|
|
447
|
+
Manage Orca UI installation.
|
|
448
|
+
|
|
449
|
+
```bash
|
|
450
|
+
# Install UI globally
|
|
451
|
+
orcapt ui init
|
|
452
|
+
|
|
453
|
+
# Start UI
|
|
454
|
+
orcapt ui start
|
|
455
|
+
|
|
456
|
+
# Start with custom ports
|
|
457
|
+
orcapt ui start --port 3000 --agent-port 5001
|
|
458
|
+
|
|
459
|
+
# Remove UI
|
|
460
|
+
orcapt ui remove
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
## 🎬 What It Looks Like
|
|
464
|
+
|
|
465
|
+
```bash
|
|
466
|
+
$ orcapt kickstart python
|
|
467
|
+
|
|
468
|
+
============================================================
|
|
469
|
+
🚀 Orca Kickstart - Python
|
|
470
|
+
============================================================
|
|
471
|
+
|
|
472
|
+
✓ Python found: python3
|
|
473
|
+
✓ Git found
|
|
474
|
+
✓ Node.js/npm found
|
|
475
|
+
✓ npx found
|
|
476
|
+
|
|
477
|
+
► Creating directory: orca-kickstart
|
|
478
|
+
✓ Created directory: /path/to/orca-kickstart
|
|
479
|
+
|
|
480
|
+
✓ Repository cloned successfully
|
|
481
|
+
✓ Virtual environment created
|
|
482
|
+
✓ Dependencies installed
|
|
483
|
+
|
|
484
|
+
============================================================
|
|
485
|
+
✓ Setup completed successfully!
|
|
486
|
+
============================================================
|
|
487
|
+
|
|
488
|
+
✓ Backend started (PID: 12345)
|
|
489
|
+
✓ Frontend started (PID: 12346)
|
|
490
|
+
|
|
491
|
+
============================================================
|
|
492
|
+
🎉 Orca is running!
|
|
493
|
+
============================================================
|
|
494
|
+
|
|
495
|
+
Frontend: http://localhost:3000
|
|
496
|
+
Backend: http://localhost:5001
|
|
497
|
+
|
|
498
|
+
⚠ Press Ctrl+C to stop both servers
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
## 🛠️ Development
|
|
502
|
+
|
|
503
|
+
### Project Structure
|
|
504
|
+
|
|
505
|
+
```
|
|
506
|
+
orca-cli/
|
|
507
|
+
├── bin/
|
|
508
|
+
│ └── orca.js # CLI entry point (executable)
|
|
509
|
+
├── src/
|
|
510
|
+
│ ├── commands/
|
|
511
|
+
│ │ ├── kickstart-python.js # Python kickstart
|
|
512
|
+
│ │ ├── kickstart-node.js # Node.js kickstart
|
|
513
|
+
│ │ ├── login.js # Authentication
|
|
514
|
+
│ │ ├── lambda.js # Lambda deployment
|
|
515
|
+
│ │ ├── storage.js # Storage management
|
|
516
|
+
│ │ ├── db.js # Database management
|
|
517
|
+
│ │ ├── ui.js # UI management
|
|
518
|
+
│ │ └── fetch-doc.js # Documentation fetcher
|
|
519
|
+
│ ├── utils/
|
|
520
|
+
│ │ └── docker-helper.js # Docker utilities
|
|
521
|
+
│ └── config.js # Configuration
|
|
522
|
+
├── package.json # Package configuration
|
|
523
|
+
├── README.md # This file
|
|
524
|
+
├── ENVIRONMENT_VARIABLES.md # Environment variables guide
|
|
525
|
+
├── PROGRESS_BAR_ENHANCEMENT.md # Progress bar documentation
|
|
526
|
+
└── .gitignore # Git ignore patterns
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
### Adding New Commands
|
|
530
|
+
|
|
531
|
+
1. Create a new file in `src/commands/`:
|
|
532
|
+
|
|
533
|
+
```javascript
|
|
534
|
+
// src/commands/mycommand.js
|
|
535
|
+
async function myCommand(options) {
|
|
536
|
+
console.log("Hello from my command!");
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
module.exports = myCommand;
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
2. Register it in `bin/orca.js`:
|
|
543
|
+
|
|
544
|
+
```javascript
|
|
545
|
+
const myCommand = require("../src/commands/mycommand");
|
|
546
|
+
|
|
547
|
+
program.command("mycommand").description("My custom command").action(myCommand);
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
### Dependencies
|
|
551
|
+
|
|
552
|
+
- **commander** - CLI framework with elegant syntax
|
|
553
|
+
- **chalk** - Terminal styling and colors
|
|
554
|
+
- **ora** - Beautiful terminal spinners
|
|
555
|
+
- **inquirer** - Interactive prompts
|
|
556
|
+
- **simple-git** - Git operations
|
|
557
|
+
- **cross-spawn** - Cross-platform process spawning
|
|
558
|
+
|
|
559
|
+
## 🐛 Troubleshooting
|
|
560
|
+
|
|
561
|
+
### Kickstart Issues
|
|
562
|
+
|
|
563
|
+
**"Python not found"**
|
|
564
|
+
|
|
565
|
+
```bash
|
|
566
|
+
# Install Python 3.8+
|
|
567
|
+
# macOS: brew install python3
|
|
568
|
+
# Windows: https://www.python.org/downloads/
|
|
569
|
+
# Linux: sudo apt install python3
|
|
570
|
+
```
|
|
571
|
+
|
|
572
|
+
**"Git not found"**
|
|
573
|
+
|
|
574
|
+
```bash
|
|
575
|
+
# Install Git
|
|
576
|
+
# macOS: brew install git
|
|
577
|
+
# Windows: https://git-scm.com/downloads
|
|
578
|
+
# Linux: sudo apt install git
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
**"Directory already exists"**
|
|
582
|
+
|
|
583
|
+
```bash
|
|
584
|
+
# Use a different directory name
|
|
585
|
+
orcapt kickstart python --directory my-other-project
|
|
586
|
+
|
|
587
|
+
# Or remove the existing directory
|
|
588
|
+
rm -rf orca-kickstart
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
**"Port already in use"**
|
|
592
|
+
|
|
593
|
+
```bash
|
|
594
|
+
# Use different ports
|
|
595
|
+
orcapt kickstart python --port 4000 --agent-port 5000
|
|
596
|
+
|
|
597
|
+
# Or find and kill the process using the port
|
|
598
|
+
# macOS/Linux: lsof -ti:3000 | xargs kill
|
|
599
|
+
# Windows: netstat -ano | findstr :3000
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
### Lambda Deployment Issues
|
|
603
|
+
|
|
604
|
+
**"Docker not found"**
|
|
605
|
+
|
|
606
|
+
```bash
|
|
607
|
+
# Install Docker
|
|
608
|
+
# macOS: brew install --cask docker
|
|
609
|
+
# Windows: https://docs.docker.com/desktop/install/windows-install/
|
|
610
|
+
# Linux: https://docs.docker.com/engine/install/
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
**"Docker image not found"**
|
|
614
|
+
|
|
615
|
+
```bash
|
|
616
|
+
# Build your image first
|
|
617
|
+
docker build -t my-app:latest .
|
|
618
|
+
|
|
619
|
+
# Check if image exists
|
|
620
|
+
docker images | grep my-app
|
|
621
|
+
```
|
|
622
|
+
|
|
623
|
+
**"ECR login failed"**
|
|
624
|
+
|
|
625
|
+
```bash
|
|
626
|
+
# Check your authentication
|
|
627
|
+
orcapt status
|
|
628
|
+
|
|
629
|
+
# Re-login if needed
|
|
630
|
+
orcapt logout
|
|
631
|
+
orcapt login
|
|
632
|
+
|
|
633
|
+
# Check backend is running and AWS credentials are configured
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
**"Lambda deployment timeout"**
|
|
637
|
+
|
|
638
|
+
```bash
|
|
639
|
+
# Increase timeout
|
|
640
|
+
orcapt ship my-api --image=my-app:latest --timeout=120
|
|
641
|
+
|
|
642
|
+
# Check image size (should be < 10 GB)
|
|
643
|
+
docker images | grep my-app
|
|
644
|
+
```
|
|
645
|
+
|
|
646
|
+
**"Environment variables not working"**
|
|
647
|
+
|
|
648
|
+
```bash
|
|
649
|
+
# Check .env file format
|
|
650
|
+
cat .env
|
|
651
|
+
|
|
652
|
+
# Test with explicit --env flags
|
|
653
|
+
orcapt ship my-api --image=my-app:latest --env DEBUG=true
|
|
654
|
+
|
|
655
|
+
# Check Lambda function info
|
|
656
|
+
orcapt lambda info my-api
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
### Storage Issues
|
|
660
|
+
|
|
661
|
+
**"Bucket already exists"**
|
|
662
|
+
|
|
663
|
+
```bash
|
|
664
|
+
# Use a different bucket name
|
|
665
|
+
orcapt storage bucket create my-bucket-2
|
|
666
|
+
|
|
667
|
+
# Or delete existing bucket
|
|
668
|
+
orcapt storage bucket delete my-bucket --force
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
**"File upload failed"**
|
|
672
|
+
|
|
673
|
+
```bash
|
|
674
|
+
# Check file exists
|
|
675
|
+
ls -lh ./file.txt
|
|
676
|
+
|
|
677
|
+
# Check bucket exists
|
|
678
|
+
orcapt storage bucket list
|
|
679
|
+
|
|
680
|
+
# Try with absolute path
|
|
681
|
+
orcapt storage upload my-bucket /full/path/to/file.txt
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
### Platform-Specific Notes
|
|
685
|
+
|
|
686
|
+
#### Windows
|
|
687
|
+
|
|
688
|
+
- Uses `orca_env\Scripts\python.exe`
|
|
689
|
+
- Automatically handles Windows paths
|
|
690
|
+
- PowerShell and CMD supported
|
|
691
|
+
|
|
692
|
+
#### macOS/Linux
|
|
693
|
+
|
|
694
|
+
- Uses `orca_env/bin/python`
|
|
695
|
+
- Bash and Zsh supported
|
|
696
|
+
|
|
697
|
+
## 📝 Manual Setup
|
|
698
|
+
|
|
699
|
+
If you prefer to set up manually:
|
|
700
|
+
|
|
701
|
+
```bash
|
|
702
|
+
# After kickstart python (with --no-start)
|
|
703
|
+
cd orca-kickstart
|
|
704
|
+
|
|
705
|
+
# Activate virtual environment
|
|
706
|
+
source orca_env/bin/activate # macOS/Linux
|
|
707
|
+
orca_env\Scripts\activate # Windows
|
|
708
|
+
|
|
709
|
+
# Start backend
|
|
710
|
+
python main.py --dev
|
|
711
|
+
|
|
712
|
+
# In another terminal, start frontend
|
|
713
|
+
npx -y @orcapt/ui --port=3000 --agent-port=5001
|
|
714
|
+
```
|
|
715
|
+
|
|
716
|
+
## 🌐 Multi-Language Support
|
|
717
|
+
|
|
718
|
+
Orca CLI is designed to support multiple programming languages:
|
|
719
|
+
|
|
720
|
+
### Currently Available:
|
|
721
|
+
|
|
722
|
+
- ✅ **Python** - Full support with FastAPI + OpenAI
|
|
723
|
+
- ✅ **Node.js** - Full support with Express + OpenAI
|
|
724
|
+
|
|
725
|
+
### Coming Soon:
|
|
726
|
+
|
|
727
|
+
- 🚧 **Go** - Gin/Fiber + OpenAI
|
|
728
|
+
|
|
729
|
+
### Future Languages:
|
|
730
|
+
|
|
731
|
+
- TypeScript
|
|
732
|
+
- Rust
|
|
733
|
+
- Java
|
|
734
|
+
- C#/.NET
|
|
735
|
+
|
|
736
|
+
Want to contribute a starter kit in your favorite language? Check out our [Contributing Guide](#-contributing)!
|
|
737
|
+
|
|
738
|
+
## 🚢 Publishing to npm
|
|
739
|
+
|
|
740
|
+
To publish this package to npm:
|
|
741
|
+
|
|
742
|
+
```bash
|
|
743
|
+
# Login to npm
|
|
744
|
+
npm login
|
|
745
|
+
|
|
746
|
+
# Publish
|
|
747
|
+
npm publish
|
|
748
|
+
|
|
749
|
+
# Or publish as scoped package
|
|
750
|
+
npm publish --access public
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
## 🤝 Contributing
|
|
754
|
+
|
|
755
|
+
Contributions are welcome! Here's how:
|
|
756
|
+
|
|
757
|
+
1. Fork the repository
|
|
758
|
+
2. Create your feature branch: `git checkout -b feature/amazing-feature`
|
|
759
|
+
3. Commit your changes: `git commit -m 'Add amazing feature'`
|
|
760
|
+
4. Push to the branch: `git push origin feature/amazing-feature`
|
|
761
|
+
5. Open a Pull Request
|
|
762
|
+
|
|
763
|
+
## 📄 License
|
|
764
|
+
|
|
765
|
+
MIT License - see LICENSE file for details
|
|
766
|
+
|
|
767
|
+
## 💡 Quick Examples
|
|
768
|
+
|
|
769
|
+
### Example 1: Deploy FastAPI to Lambda
|
|
770
|
+
|
|
771
|
+
```bash
|
|
772
|
+
# 1. Create FastAPI app
|
|
773
|
+
mkdir my-api && cd my-api
|
|
774
|
+
|
|
775
|
+
# 2. Create Dockerfile
|
|
776
|
+
cat > Dockerfile << 'EOF'
|
|
777
|
+
FROM public.ecr.aws/lambda/python:3.11
|
|
778
|
+
COPY requirements.txt .
|
|
779
|
+
RUN pip install -r requirements.txt --target .
|
|
780
|
+
COPY . .
|
|
781
|
+
CMD ["lambda_adapter.handler"]
|
|
782
|
+
EOF
|
|
783
|
+
|
|
784
|
+
# 3. Create requirements.txt
|
|
785
|
+
cat > requirements.txt << 'EOF'
|
|
786
|
+
fastapi
|
|
787
|
+
mangum
|
|
788
|
+
EOF
|
|
789
|
+
|
|
790
|
+
# 4. Create main.py
|
|
791
|
+
cat > main.py << 'EOF'
|
|
792
|
+
from fastapi import FastAPI
|
|
793
|
+
app = FastAPI()
|
|
794
|
+
|
|
795
|
+
@app.get("/")
|
|
796
|
+
async def root():
|
|
797
|
+
return {"message": "Hello from Lambda!"}
|
|
798
|
+
EOF
|
|
799
|
+
|
|
800
|
+
# 5. Create lambda_adapter.py
|
|
801
|
+
cat > lambda_adapter.py << 'EOF'
|
|
802
|
+
from mangum import Mangum
|
|
803
|
+
from main import app
|
|
804
|
+
handler = Mangum(app)
|
|
805
|
+
EOF
|
|
806
|
+
|
|
807
|
+
# 6. Build Docker image
|
|
808
|
+
docker build -t my-api:latest .
|
|
809
|
+
|
|
810
|
+
# 7. Deploy to Lambda
|
|
811
|
+
orcapt ship my-api --image=my-api:latest --memory=1024 --timeout=60
|
|
812
|
+
|
|
813
|
+
# 8. Test
|
|
814
|
+
curl https://YOUR-FUNCTION-URL/
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
### Example 2: Deploy with Environment Variables
|
|
818
|
+
|
|
819
|
+
```bash
|
|
820
|
+
# Create .env file
|
|
821
|
+
cat > .env << 'EOF'
|
|
822
|
+
DATABASE_URL=postgresql://user:pass@host:5432/db
|
|
823
|
+
OPENAI_API_KEY=sk-...
|
|
824
|
+
DEBUG=false
|
|
825
|
+
EOF
|
|
826
|
+
|
|
827
|
+
# Deploy with .env
|
|
828
|
+
orcapt ship my-api \
|
|
829
|
+
--image=my-api:latest \
|
|
830
|
+
--env-file=.env \
|
|
831
|
+
--memory=2048 \
|
|
832
|
+
--timeout=120
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
### Example 3: Storage Workflow
|
|
836
|
+
|
|
837
|
+
```bash
|
|
838
|
+
# 1. Create bucket
|
|
839
|
+
orcapt storage bucket create my-files --public
|
|
840
|
+
|
|
841
|
+
# 2. Upload files
|
|
842
|
+
orcapt storage upload my-files ./document.pdf
|
|
843
|
+
orcapt storage upload my-files ./image.png --folder=/images
|
|
844
|
+
|
|
845
|
+
# 3. List files
|
|
846
|
+
orcapt storage files my-files
|
|
847
|
+
|
|
848
|
+
# 4. Download file
|
|
849
|
+
orcapt storage download my-files document.pdf
|
|
850
|
+
|
|
851
|
+
# 5. Add permissions
|
|
852
|
+
orcapt storage permission add my-files \
|
|
853
|
+
--target-type=user \
|
|
854
|
+
--target-id=user123 \
|
|
855
|
+
--read --write
|
|
856
|
+
```
|
|
857
|
+
|
|
858
|
+
### Example 4: Complete Workflow
|
|
859
|
+
|
|
860
|
+
```bash
|
|
861
|
+
# 1. Login
|
|
862
|
+
orcapt login
|
|
863
|
+
|
|
864
|
+
# 2. Create database
|
|
865
|
+
orcapt db create
|
|
866
|
+
|
|
867
|
+
# 3. Create storage bucket
|
|
868
|
+
orcapt storage bucket create app-storage
|
|
869
|
+
|
|
870
|
+
# 4. Deploy Lambda function
|
|
871
|
+
orcapt ship my-app \
|
|
872
|
+
--image=my-app:latest \
|
|
873
|
+
--env DATABASE_URL=postgres://... \
|
|
874
|
+
--env BUCKET_NAME=app-storage \
|
|
875
|
+
--memory=1024
|
|
876
|
+
|
|
877
|
+
# 5. Check deployment
|
|
878
|
+
orcapt lambda info my-app
|
|
879
|
+
|
|
880
|
+
# 6. View logs
|
|
881
|
+
orcapt lambda logs my-app
|
|
882
|
+
|
|
883
|
+
# 7. Invoke function
|
|
884
|
+
orcapt lambda invoke my-app --payload '{"test": true}'
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
---
|
|
888
|
+
|
|
889
|
+
## 🙏 Support
|
|
890
|
+
|
|
891
|
+
- 📚 [Documentation](https://github.com/Orcapt/orca-starter-kit-python-v1)
|
|
892
|
+
- 🐛 [Report Issues](https://github.com/Orcapt/orca-cli/issues)
|
|
893
|
+
- 💬 [Discussions](https://github.com/Orcapt/orca-cli/discussions)
|
|
894
|
+
|
|
895
|
+
## 🎯 Roadmap
|
|
896
|
+
|
|
897
|
+
### ✅ Completed Features
|
|
898
|
+
|
|
899
|
+
- ✅ Authentication (`login`, `logout`, `status`)
|
|
900
|
+
- ✅ Kickstart for Python and Node.js
|
|
901
|
+
- ✅ Lambda deployment with Docker (`ship`)
|
|
902
|
+
- ✅ Storage management (buckets, files, permissions)
|
|
903
|
+
- ✅ Database management (PostgreSQL)
|
|
904
|
+
- ✅ UI management
|
|
905
|
+
- ✅ Environment variables support
|
|
906
|
+
- ✅ Progress bar for Docker push
|
|
907
|
+
- ✅ `.env` file support
|
|
908
|
+
|
|
909
|
+
### 🚧 Coming Soon
|
|
910
|
+
|
|
911
|
+
#### Commands
|
|
912
|
+
|
|
913
|
+
```bash
|
|
914
|
+
orcapt stop # Stop running servers
|
|
915
|
+
orcapt restart # Restart servers
|
|
916
|
+
orcapt update # Update Orca packages
|
|
917
|
+
orcapt config # Configure Orca settings
|
|
918
|
+
orcapt logs # View all logs
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
#### Lambda Features
|
|
922
|
+
|
|
923
|
+
```bash
|
|
924
|
+
orcapt ship --auto-scale # Auto-scaling configuration
|
|
925
|
+
orcapt ship --vpc # VPC configuration
|
|
926
|
+
orcapt lambda rollback # Rollback to previous version
|
|
927
|
+
orcapt lambda alias # Manage function aliases
|
|
928
|
+
```
|
|
929
|
+
|
|
930
|
+
#### Storage Features
|
|
931
|
+
|
|
932
|
+
```bash
|
|
933
|
+
orcapt storage sync # Sync local folder to bucket
|
|
934
|
+
orcapt storage cdn # CDN configuration
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
### Language Support
|
|
938
|
+
|
|
939
|
+
- ✅ **Python** - Available
|
|
940
|
+
- ✅ **Node.js** - Available
|
|
941
|
+
- 🚧 **Go** - Coming soon
|
|
942
|
+
- 🚧 **Rust** - Planned
|
|
943
|
+
- 🚧 **TypeScript** - Planned
|
|
944
|
+
|
|
945
|
+
---
|
|
946
|
+
|
|
947
|
+
**Made with ❤️ by the Orca Team**
|
|
948
|
+
|
|
949
|
+
Star ⭐ this repo if you find it helpful!
|