@tarout/cli 0.1.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 +21 -0
- package/README.md +295 -0
- package/bin/tarout +3 -0
- package/dist/chunk-GSKD67K4.js +41 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2325 -0
- package/dist/spinner-2NALE2OE.js +14 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2025 Tarout
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# Tarout CLI
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@tarout/cli)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
The official command-line interface for [Tarout](https://tarout.sa) - a Platform-as-a-Service for deploying applications, databases, and more.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install -g @tarout/cli
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Or with other package managers:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Using yarn
|
|
18
|
+
yarn global add @tarout/cli
|
|
19
|
+
|
|
20
|
+
# Using pnpm
|
|
21
|
+
pnpm add -g @tarout/cli
|
|
22
|
+
|
|
23
|
+
# Using bun
|
|
24
|
+
bun add -g @tarout/cli
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# 1. Login via browser (opens authentication page)
|
|
31
|
+
tarout login
|
|
32
|
+
|
|
33
|
+
# 2. List your applications
|
|
34
|
+
tarout apps list
|
|
35
|
+
|
|
36
|
+
# 3. Deploy an application
|
|
37
|
+
tarout deploy my-app
|
|
38
|
+
|
|
39
|
+
# 4. View logs
|
|
40
|
+
tarout logs my-app --follow
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Commands
|
|
44
|
+
|
|
45
|
+
### Authentication
|
|
46
|
+
|
|
47
|
+
| Command | Description |
|
|
48
|
+
|---------|-------------|
|
|
49
|
+
| `tarout login` | Authenticate via browser |
|
|
50
|
+
| `tarout logout` | Sign out and clear credentials |
|
|
51
|
+
| `tarout whoami` | Show current user, organization, and environment |
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Login with custom API URL (for self-hosted)
|
|
55
|
+
tarout login --api-url https://your-tarout-instance.com
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Applications
|
|
59
|
+
|
|
60
|
+
| Command | Description |
|
|
61
|
+
|---------|-------------|
|
|
62
|
+
| `tarout apps list` | List all applications |
|
|
63
|
+
| `tarout apps create <name>` | Create a new application |
|
|
64
|
+
| `tarout apps delete <app>` | Delete an application |
|
|
65
|
+
| `tarout apps info <app>` | Show application details |
|
|
66
|
+
| `tarout apps open <app>` | Open application URL in browser |
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# List apps as JSON
|
|
70
|
+
tarout apps list --json
|
|
71
|
+
|
|
72
|
+
# Create an app
|
|
73
|
+
tarout apps create my-api
|
|
74
|
+
|
|
75
|
+
# Delete without confirmation
|
|
76
|
+
tarout apps delete my-api --yes
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Deployment
|
|
80
|
+
|
|
81
|
+
| Command | Description |
|
|
82
|
+
|---------|-------------|
|
|
83
|
+
| `tarout deploy <app>` | Deploy an application |
|
|
84
|
+
| `tarout deploy:status <app>` | Check deployment status |
|
|
85
|
+
| `tarout deploy:cancel <app>` | Cancel running deployment |
|
|
86
|
+
| `tarout deploy:list <app>` | List recent deployments |
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Deploy specific branch
|
|
90
|
+
tarout deploy my-app --branch feature/new-feature
|
|
91
|
+
|
|
92
|
+
# Deploy and wait for completion
|
|
93
|
+
tarout deploy my-app --wait
|
|
94
|
+
|
|
95
|
+
# Check deployment status
|
|
96
|
+
tarout deploy:status my-app
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Logs
|
|
100
|
+
|
|
101
|
+
| Command | Description |
|
|
102
|
+
|---------|-------------|
|
|
103
|
+
| `tarout logs <app>` | View application logs |
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# Stream logs continuously
|
|
107
|
+
tarout logs my-app --follow
|
|
108
|
+
|
|
109
|
+
# Filter by log level
|
|
110
|
+
tarout logs my-app --level error
|
|
111
|
+
|
|
112
|
+
# Logs from last hour
|
|
113
|
+
tarout logs my-app --since 1h
|
|
114
|
+
|
|
115
|
+
# Last 100 lines
|
|
116
|
+
tarout logs my-app --lines 100
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Environment Variables
|
|
120
|
+
|
|
121
|
+
| Command | Description |
|
|
122
|
+
|---------|-------------|
|
|
123
|
+
| `tarout env <app> list` | List environment variables (masked) |
|
|
124
|
+
| `tarout env <app> set <KEY=value>` | Set an environment variable |
|
|
125
|
+
| `tarout env <app> unset <KEY>` | Remove an environment variable |
|
|
126
|
+
| `tarout env <app> pull` | Download variables as .env file |
|
|
127
|
+
| `tarout env <app> push` | Upload variables from .env file |
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Set a variable
|
|
131
|
+
tarout env my-app set DATABASE_URL=postgres://...
|
|
132
|
+
|
|
133
|
+
# Set multiple variables
|
|
134
|
+
tarout env my-app set API_KEY=xxx SECRET=yyy
|
|
135
|
+
|
|
136
|
+
# Download to .env file
|
|
137
|
+
tarout env my-app pull
|
|
138
|
+
|
|
139
|
+
# Upload from .env file
|
|
140
|
+
tarout env my-app push
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Databases
|
|
144
|
+
|
|
145
|
+
| Command | Description |
|
|
146
|
+
|---------|-------------|
|
|
147
|
+
| `tarout db list` | List all databases |
|
|
148
|
+
| `tarout db create [name]` | Create a new database |
|
|
149
|
+
| `tarout db delete <db>` | Delete a database |
|
|
150
|
+
| `tarout db info <db>` | Show connection details |
|
|
151
|
+
| `tarout db connect <db>` | Open database shell |
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Create PostgreSQL database
|
|
155
|
+
tarout db create mydb --type postgres
|
|
156
|
+
|
|
157
|
+
# Create MySQL database
|
|
158
|
+
tarout db create mydb --type mysql
|
|
159
|
+
|
|
160
|
+
# Create Redis instance
|
|
161
|
+
tarout db create cache --type redis
|
|
162
|
+
|
|
163
|
+
# Get connection string
|
|
164
|
+
tarout db info mydb
|
|
165
|
+
|
|
166
|
+
# Connect directly (opens psql/mysql client)
|
|
167
|
+
tarout db connect mydb
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Domains
|
|
171
|
+
|
|
172
|
+
| Command | Description |
|
|
173
|
+
|---------|-------------|
|
|
174
|
+
| `tarout domains list [app]` | List domains |
|
|
175
|
+
| `tarout domains add <app> <domain>` | Add custom domain |
|
|
176
|
+
| `tarout domains remove <domain>` | Remove domain |
|
|
177
|
+
| `tarout domains verify <domain>` | Check DNS configuration |
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
# Add custom domain
|
|
181
|
+
tarout domains add my-app api.example.com
|
|
182
|
+
|
|
183
|
+
# Verify DNS is configured correctly
|
|
184
|
+
tarout domains verify api.example.com
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Organizations & Environments
|
|
188
|
+
|
|
189
|
+
| Command | Description |
|
|
190
|
+
|---------|-------------|
|
|
191
|
+
| `tarout orgs list` | List organizations |
|
|
192
|
+
| `tarout orgs switch <org>` | Switch active organization |
|
|
193
|
+
| `tarout envs list` | List environments |
|
|
194
|
+
| `tarout envs switch <env>` | Switch environment (production/staging) |
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Switch organization
|
|
198
|
+
tarout orgs switch "Acme Corp"
|
|
199
|
+
|
|
200
|
+
# Switch to staging environment
|
|
201
|
+
tarout envs switch staging
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Global Flags
|
|
205
|
+
|
|
206
|
+
These flags work with all commands:
|
|
207
|
+
|
|
208
|
+
| Flag | Description |
|
|
209
|
+
|------|-------------|
|
|
210
|
+
| `--json` | Output as JSON (machine-readable) |
|
|
211
|
+
| `--yes, -y` | Skip all confirmation prompts |
|
|
212
|
+
| `--quiet, -q` | Minimal output (errors only) |
|
|
213
|
+
| `--verbose, -v` | Extra debug information |
|
|
214
|
+
| `--no-color` | Disable colored output |
|
|
215
|
+
|
|
216
|
+
## AI & Automation Usage
|
|
217
|
+
|
|
218
|
+
The CLI is designed to be 100% AI-friendly and scriptable:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# Get JSON output for parsing
|
|
222
|
+
tarout apps list --json
|
|
223
|
+
|
|
224
|
+
# Non-interactive operations (no prompts)
|
|
225
|
+
tarout apps delete my-app --yes
|
|
226
|
+
|
|
227
|
+
# Quiet mode for scripts
|
|
228
|
+
tarout deploy my-app --quiet
|
|
229
|
+
|
|
230
|
+
# Pipe-friendly
|
|
231
|
+
APP_ID=$(tarout apps list --json | jq -r '.[0].id')
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Exit Codes
|
|
235
|
+
|
|
236
|
+
| Code | Meaning |
|
|
237
|
+
|------|---------|
|
|
238
|
+
| 0 | Success |
|
|
239
|
+
| 1 | General error |
|
|
240
|
+
| 2 | Invalid arguments |
|
|
241
|
+
| 3 | Authentication error (not logged in) |
|
|
242
|
+
| 4 | Resource not found |
|
|
243
|
+
| 5 | Permission denied |
|
|
244
|
+
|
|
245
|
+
### JSON Output Format
|
|
246
|
+
|
|
247
|
+
All `--json` output follows a consistent structure:
|
|
248
|
+
|
|
249
|
+
```json
|
|
250
|
+
// Success
|
|
251
|
+
{ "success": true, "data": { ... } }
|
|
252
|
+
|
|
253
|
+
// Error
|
|
254
|
+
{ "success": false, "error": { "code": "NOT_FOUND", "message": "..." } }
|
|
255
|
+
|
|
256
|
+
// List operations
|
|
257
|
+
{ "success": true, "data": [...], "meta": { "total": 10 } }
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
## Configuration
|
|
261
|
+
|
|
262
|
+
Configuration is stored at `~/.tarout/config.json`:
|
|
263
|
+
|
|
264
|
+
```json
|
|
265
|
+
{
|
|
266
|
+
"currentProfile": "default",
|
|
267
|
+
"profiles": {
|
|
268
|
+
"default": {
|
|
269
|
+
"token": "cli_xxx...",
|
|
270
|
+
"apiUrl": "https://app.tarout.sa",
|
|
271
|
+
"organizationId": "...",
|
|
272
|
+
"organizationName": "My Org",
|
|
273
|
+
"environmentId": "...",
|
|
274
|
+
"environmentName": "production",
|
|
275
|
+
"userId": "...",
|
|
276
|
+
"userEmail": "user@example.com"
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
## Requirements
|
|
283
|
+
|
|
284
|
+
- Node.js 18.0.0 or higher
|
|
285
|
+
- A Tarout account ([sign up](https://tarout.sa))
|
|
286
|
+
|
|
287
|
+
## Support
|
|
288
|
+
|
|
289
|
+
- Documentation: [docs.tarout.sa](https://docs.tarout.sa)
|
|
290
|
+
- Issues: [GitHub Issues](https://github.com/tarout/platform/issues)
|
|
291
|
+
- Discord: [Join our community](https://discord.gg/2tBnJ3jDJc)
|
|
292
|
+
|
|
293
|
+
## License
|
|
294
|
+
|
|
295
|
+
MIT - see [LICENSE](./LICENSE) for details.
|
package/bin/tarout
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// src/utils/spinner.ts
|
|
2
|
+
import ora from "ora";
|
|
3
|
+
var currentSpinner = null;
|
|
4
|
+
function startSpinner(text) {
|
|
5
|
+
if (currentSpinner) {
|
|
6
|
+
currentSpinner.stop();
|
|
7
|
+
}
|
|
8
|
+
currentSpinner = ora(text).start();
|
|
9
|
+
return currentSpinner;
|
|
10
|
+
}
|
|
11
|
+
function succeedSpinner(text) {
|
|
12
|
+
if (currentSpinner) {
|
|
13
|
+
currentSpinner.succeed(text);
|
|
14
|
+
currentSpinner = null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function failSpinner(text) {
|
|
18
|
+
if (currentSpinner) {
|
|
19
|
+
currentSpinner.fail(text);
|
|
20
|
+
currentSpinner = null;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function stopSpinner() {
|
|
24
|
+
if (currentSpinner) {
|
|
25
|
+
currentSpinner.stop();
|
|
26
|
+
currentSpinner = null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function updateSpinner(text) {
|
|
30
|
+
if (currentSpinner) {
|
|
31
|
+
currentSpinner.text = text;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
startSpinner,
|
|
37
|
+
succeedSpinner,
|
|
38
|
+
failSpinner,
|
|
39
|
+
stopSpinner,
|
|
40
|
+
updateSpinner
|
|
41
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|