systemprompt-cli 0.2.2

Unified CLI for systemprompt.io AI governance: agent orchestration, MCP governance, analytics, profiles, cloud deploy, and self-hosted operations.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
<div align="center">

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://systemprompt.io/files/images/logo.svg">
  <source media="(prefers-color-scheme: light)" srcset="https://systemprompt.io/files/images/logo-dark.svg">
  <img src="https://systemprompt.io/files/images/logo.svg" alt="systemprompt.io" width="180">
</picture>

### Production infrastructure for AI agents

[**Website**](https://systemprompt.io) · [**Documentation**](https://systemprompt.io/documentation/) · [**Guides**](https://systemprompt.io/guides) · [**Core**](https://github.com/systempromptio/systemprompt-core) · [**CLI Reference**](https://github.com/systempromptio/systemprompt-core/tree/main/crates/entry/cli) · [**Discord**](https://discord.gg/wkAbSuPWpr)

</div>

---


# Cloud CLI Commands

This document provides complete documentation for AI agents to use the cloud CLI commands. All commands support non-interactive mode for automation.

---

## Prerequisites

```bash
export SYSTEMPROMPT_PROFILE=/var/www/html/tyingshoelaces/.systemprompt/profiles/local/profile.yaml
cd /var/www/html/systemprompt-core
cargo build --package systemprompt-cli

alias sp="./target/debug/systemprompt --non-interactive"
```

---

## Command Reference

| Command | Description | Artifact Type | Requires Services |
|---------|-------------|---------------|-------------------|
| `cloud auth login` | Authenticate with systemprompt.io Cloud | `Card` | No |
| `cloud auth logout` | Log out from cloud | `Text` | No |
| `cloud auth whoami` | Show current authentication status | `Card` | No |
| `cloud init` | Initialize project structure | `Text` | No |
| `cloud tenant` | Manage tenants (list/show) | `Table`/`Card` | No |
| `cloud tenant create` | Create a new tenant | `Text` | No |
| `cloud tenant select` | Select active tenant | `Text` | No |
| `cloud tenant rotate` | Rotate tenant API keys | `Text` | No |
| `cloud profile` | Manage profiles (list/show) | `Table`/`Card` | No |
| `cloud profile create` | Create a new profile | `Text` | No |
| `cloud profile edit` | Edit profile configuration | `Text` | No |
| `cloud profile delete` | Delete a profile | `Text` | No |
| `cloud deploy` | Deploy to systemprompt.io Cloud | `Text` | No |
| `cloud status` | Check cloud deployment status | `Card` | No |
| `cloud restart` | Restart tenant machine | `Text` | Yes |
| `cloud sync` | Sync between local and cloud | `Text` | Yes |
| `cloud secrets` | Manage cloud secrets | `Text`/`Table` | No |
| `cloud dockerfile` | Generate Dockerfile | `Text` | No |

---

## Authentication Commands

### cloud auth login

Authenticate with systemprompt.io Cloud.

```bash
sp cloud auth login
sp cloud auth login --email user@example.com --password "password"
sp cloud auth login --token "api_token"
```

**Optional Flags (non-interactive):**
| Flag | Description |
|------|-------------|
| `--email` | Email address |
| `--password` | Password |
| `--token` | API token (alternative to email/password) |

**Output Structure:**
```json
{
  "authenticated": true,
  "user": {
    "email": "user@example.com",
    "name": "User Name"
  },
  "tenant": "tenant_abc123",
  "message": "Successfully authenticated"
}
```

**Artifact Type:** `Card`

---

### cloud auth logout

Log out from systemprompt.io Cloud.

```bash
sp cloud auth logout
```

**Output Structure:**
```json
{
  "message": "Successfully logged out"
}
```

**Artifact Type:** `Text`

---

### cloud auth whoami

Show current authentication status.

```bash
sp cloud auth whoami
sp --json cloud auth whoami
```

**Output Structure:**
```json
{
  "authenticated": true,
  "email": "user@example.com",
  "name": "User Name",
  "tenant": "tenant_abc123",
  "expires_at": "2024-01-16T10:30:00Z"
}
```

**Artifact Type:** `Card`

---

## Project Initialization

### cloud init

Initialize project structure for systemprompt.io.

```bash
sp cloud init
sp cloud init --force
```

**Optional Flags:**
| Flag | Default | Description |
|------|---------|-------------|
| `--force` | `false` | Overwrite existing configuration |

**Created Structure:**
```
.systemprompt/
├── profiles/
│   └── local/
│       ├── profile.yaml
│       └── secrets.yaml
├── services/
│   ├── agents/
│   └── mcp/
└── config.yaml
```

**Output Structure:**
```json
{
  "initialized": true,
  "path": "/var/www/html/project/.systemprompt",
  "message": "Project initialized successfully"
}
```

**Artifact Type:** `Text`

---

## Tenant Management Commands

### cloud tenant (list)

List all tenants.

```bash
sp cloud tenant
sp --json cloud tenant
```

**Output Structure:**
```json
{
  "tenants": [
    {
      "id": "tenant_abc123",
      "name": "My Project",
      "status": "active",
      "region": "us-east-1",
      "created_at": "2024-01-01T00:00:00Z"
    }
  ],
  "active_tenant": "tenant_abc123"
}
```

**Artifact Type:** `Table`
**Columns:** `id`, `name`, `status`, `region`, `created_at`

---

### cloud tenant create

Create a new tenant.

```bash
sp cloud tenant create --name "My Project"
sp cloud tenant create --name "My Project" --region us-west-2
```

**Required Flags (non-interactive):**
| Flag | Required | Description |
|------|----------|-------------|
| `--name` | Yes | Tenant name |

**Optional Flags:**
| Flag | Default | Description |
|------|---------|-------------|
| `--region` | `us-east-1` | Cloud region |

**Output Structure:**
```json
{
  "id": "tenant_abc123",
  "name": "My Project",
  "api_key": "sp_live_xxx...",
  "message": "Tenant created successfully"
}
```

**Artifact Type:** `Text`

---

### cloud tenant select

Select active tenant.

```bash
sp cloud tenant select <tenant-id>
sp cloud tenant select tenant_abc123
```

**Required Arguments:**
| Argument | Required | Description |
|----------|----------|-------------|
| `<id>` | Yes | Tenant ID to select |

**Output Structure:**
```json
{
  "tenant_id": "tenant_abc123",
  "message": "Tenant 'tenant_abc123' selected"
}
```

**Artifact Type:** `Text`

---

### cloud tenant rotate

Rotate tenant API keys.

```bash
sp cloud tenant rotate --yes
sp cloud tenant rotate --tenant tenant_abc123 --yes
```

**Required Flags (non-interactive):**
| Flag | Required | Description |
|------|----------|-------------|
| `--yes` / `-y` | Yes | Confirm key rotation |

**Optional Flags:**
| Flag | Default | Description |
|------|---------|-------------|
| `--tenant` | Active tenant | Specific tenant ID |

**Output Structure:**
```json
{
  "tenant_id": "tenant_abc123",
  "new_api_key": "sp_live_new_xxx...",
  "old_key_revoked": true,
  "message": "API key rotated successfully"
}
```

**Artifact Type:** `Text`

---

## Profile Management Commands

### cloud profile (list)

List all profiles.

```bash
sp cloud profile
sp --json cloud profile
```

**Output Structure:**
```json
{
  "profiles": [
    {
      "name": "local",
      "path": "/var/www/html/tyingshoelaces/.systemprompt/profiles/local",
      "environment": "development",
      "active": true
    },
    {
      "name": "staging",
      "path": "/var/www/html/tyingshoelaces/.systemprompt/profiles/staging",
      "environment": "staging",
      "active": false
    }
  ]
}
```

**Artifact Type:** `Table`
**Columns:** `name`, `environment`, `active`

---

### cloud profile show

Show profile details.

```bash
sp cloud profile show <profile-name>
sp --json cloud profile show local
```

**Required Arguments:**
| Argument | Required | Description |
|----------|----------|-------------|
| `<name>` | Yes | Profile name |

**Output Structure:**
```json
{
  "name": "local",
  "path": "/var/www/html/tyingshoelaces/.systemprompt/profiles/local/profile.yaml",
  "environment": "development",
  "database": {
    "host": "localhost",
    "port": 5432,
    "name": "systemprompt_dev"
  },
  "secrets_configured": {
    "anthropic": true,
    "openai": false
  }
}
```

**Artifact Type:** `Card`

---

### cloud profile create

Create a new profile.

```bash
sp cloud profile create --name staging --environment staging
sp cloud profile create \
  --name production \
  --environment production \
  --db-host prod-db.example.com \
  --db-port 5432 \
  --db-name systemprompt_prod
```

**Required Flags (non-interactive):**
| Flag | Required | Description |
|------|----------|-------------|
| `--name` | Yes | Profile name |
| `--environment` | Yes | Environment type |

**Optional Flags:**
| Flag | Default | Description |
|------|---------|-------------|
| `--db-host` | `localhost` | Database host |
| `--db-port` | `5432` | Database port |
| `--db-name` | `systemprompt_<env>` | Database name |

**Output Structure:**
```json
{
  "name": "staging",
  "path": "/var/www/html/tyingshoelaces/.systemprompt/profiles/staging",
  "message": "Profile 'staging' created successfully"
}
```

**Artifact Type:** `Text`

---

### cloud profile edit

Edit profile configuration.

```bash
sp cloud profile edit <profile-name> --db-host new-host
sp cloud profile edit local --set database.port=5433
```

**Required Arguments:**
| Argument | Required | Description |
|----------|----------|-------------|
| `<name>` | Yes | Profile name |
| At least one change | Yes | Must specify at least one modification |

**Modification Flags:**
| Flag | Description |
|------|-------------|
| `--db-host` | Update database host |
| `--db-port` | Update database port |
| `--db-name` | Update database name |
| `--set <key=value>` | Set arbitrary config value |

**Output Structure:**
```json
{
  "name": "local",
  "message": "Profile 'local' updated successfully",
  "changes": ["database.host: new-host"]
}
```

**Artifact Type:** `Text`

---

### cloud profile delete

Delete a profile.

```bash
sp cloud profile delete <profile-name> --yes
sp cloud profile delete staging --yes
```

**Required Flags (non-interactive):**
| Flag | Required | Description |
|------|----------|-------------|
| `<name>` | Yes | Profile name |
| `--yes` / `-y` | Yes | Skip confirmation |

**Output Structure:**
```json
{
  "deleted": "staging",
  "message": "Profile 'staging' deleted successfully"
}
```

**Artifact Type:** `Text`

---

## Deployment Commands

### cloud deploy

Deploy to systemprompt.io Cloud.

```bash
sp cloud deploy
sp cloud deploy --profile staging
sp cloud deploy --skip-push
```

**Optional Flags:**
| Flag | Default | Description |
|------|---------|-------------|
| `--profile`, `-p` | Current profile | Profile to deploy |
| `--skip-push` | `false` | Skip Docker push (use existing image) |

**Output Structure:**
```json
{
  "deployed": true,
  "tenant_id": "tenant_abc123",
  "version": "v1.2.3",
  "url": "https://tenant_abc123.systemprompt.cloud",
  "message": "Deployment successful"
}
```

**Artifact Type:** `Text`

---

### cloud status

Check cloud deployment status.

```bash
sp cloud status
sp --json cloud status
```

**Output Structure:**
```json
{
  "tenant_id": "tenant_abc123",
  "status": "running",
  "version": "v1.2.3",
  "url": "https://tenant_abc123.systemprompt.cloud",
  "health": {
    "api": "healthy",
    "database": "healthy",
    "agents": "healthy"
  },
  "last_deployed": "2024-01-15T10:30:00Z"
}
```

**Artifact Type:** `Card`

---

### cloud restart

Restart tenant machine.

```bash
sp cloud restart --yes
sp cloud restart --tenant tenant_abc123 --yes
```

**Required Flags (non-interactive):**
| Flag | Required | Description |
|------|----------|-------------|
| `--yes` / `-y` | Yes | Confirm restart |

**Optional Flags:**
| Flag | Default | Description |
|------|---------|-------------|
| `--tenant` | Active tenant | Specific tenant ID |

**Output Structure:**
```json
{
  "tenant_id": "tenant_abc123",
  "status": "restarting",
  "message": "Restart initiated successfully"
}
```

**Artifact Type:** `Text`

---

## Sync Commands

### cloud sync

Sync between local and cloud environments.

```bash
sp cloud sync
sp cloud sync skills
sp cloud sync content
sp cloud sync admin-user
```

**Subcommands:**
| Subcommand | Description |
|------------|-------------|
| `skills` | Sync skills configuration |
| `content` | Sync content to cloud |
| `admin-user` | Sync admin user |

**Output Structure:**
```json
{
  "synced": true,
  "items_synced": 5,
  "direction": "local-to-cloud",
  "message": "Sync completed successfully"
}
```

**Artifact Type:** `Text`

---

## Secrets Commands

### cloud secrets list

List configured secrets.

```bash
sp cloud secrets list
sp --json cloud secrets list
```

**Output Structure:**
```json
{
  "secrets": [
    {"name": "ANTHROPIC_API_KEY", "configured": true, "last_updated": "2024-01-15"},
    {"name": "OPENAI_API_KEY", "configured": false, "last_updated": null}
  ]
}
```

**Artifact Type:** `Table`

---

### cloud secrets set

Set a secret value.

```bash
sp cloud secrets set ANTHROPIC_API_KEY "sk-ant-..."
sp cloud secrets set --name OPENAI_API_KEY --value "sk-..."
```

**Required Arguments:**
| Argument | Required | Description |
|----------|----------|-------------|
| `<name>` | Yes | Secret name |
| `<value>` | Yes | Secret value |

**Output Structure:**
```json
{
  "name": "ANTHROPIC_API_KEY",
  "message": "Secret 'ANTHROPIC_API_KEY' set successfully"
}
```

**Artifact Type:** `Text`

---

## Dockerfile Generation

### cloud dockerfile

Generate Dockerfile based on discovered extensions.

```bash
sp cloud dockerfile
```

**Output:**
Prints a suggested Dockerfile to stdout based on:
- Discovered MCP servers
- Required runtime dependencies
- Extension configurations

**Artifact Type:** `Text`

---

## Complete Cloud Deployment Flow Example

This flow demonstrates deploying a project to systemprompt.io Cloud:

```bash
# Phase 1: Initialize project (if not done)
sp cloud init

# Phase 2: Authenticate
sp cloud auth login --email user@example.com --password "password"

# Phase 3: Verify authentication
sp --json cloud auth whoami

# Phase 4: Create or select tenant
sp cloud tenant create --name "My Project"
# or
sp cloud tenant select tenant_abc123

# Phase 5: Create production profile
sp cloud profile create \
  --name production \
  --environment production \
  --db-host prod-db.example.com

# Phase 6: Configure secrets
sp cloud secrets set ANTHROPIC_API_KEY "$ANTHROPIC_API_KEY"

# Phase 7: Deploy
sp cloud deploy --profile production

# Phase 8: Check status
sp --json cloud status

# Phase 9: Sync skills
sp cloud sync skills

# Phase 10: Verify deployment
curl https://tenant_abc123.systemprompt.cloud/health
```

---

## Multi-Environment Workflow Example

```bash
# Development (local)
export SYSTEMPROMPT_PROFILE=~/.systemprompt/profiles/local/profile.yaml
sp infra services start

# Staging deployment
sp cloud profile create --name staging --environment staging
sp cloud deploy --profile staging
sp --json cloud status

# Production deployment
sp cloud profile create --name production --environment production
sp cloud deploy --profile production
sp --json cloud status
```

---

## Error Handling

### Authentication Errors

```bash
sp cloud auth login --email wrong@example.com --password "wrong"
# Error: Authentication failed. Check your credentials.

sp cloud deploy
# Error: Not authenticated. Run 'cloud auth login' first.
```

### Tenant Errors

```bash
sp cloud tenant select nonexistent
# Error: Tenant 'nonexistent' not found

sp cloud deploy
# Error: No active tenant. Run 'cloud tenant select <id>' first.
```

### Profile Errors

```bash
sp cloud profile show nonexistent
# Error: Profile 'nonexistent' not found

sp cloud profile delete local --yes
# Error: Cannot delete active profile
```

### Deployment Errors

```bash
sp cloud deploy
# Error: Deployment failed. Check logs for details.

sp cloud status
# Error: Tenant is not deployed yet
```

---

## JSON Output

All commands support `--json` flag for structured output:

```bash
# Verify JSON is valid
sp --json cloud auth whoami | jq .

# Extract specific fields
sp --json cloud tenant | jq '.tenants[].id'
sp --json cloud profile | jq '.profiles[] | select(.active == true)'
sp --json cloud status | jq '.health'
sp --json cloud secrets list | jq '.secrets[] | select(.configured == true)'
```

---

## Compliance Checklist

- [x] All `execute` functions accept `config: &CliConfig`
- [x] All commands return `CommandResult<T>` with proper artifact type
- [x] `delete` commands require `--yes` / `-y` flag
- [x] Destructive operations (`restart`, `rotate`) require `--yes` / `-y`
- [x] All output types derive `Serialize`, `Deserialize`, `JsonSchema`
- [x] No `println!` / `eprintln!` - uses `CliService`
- [x] No `unwrap()` / `expect()` - uses `?` with `.context()`
- [x] JSON output supported via `--json` flag
- [x] Proper error messages for missing required flags


---

<div align="center">

**[systemprompt.io](https://systemprompt.io)** · **[Documentation](https://systemprompt.io/documentation/)** · **[Guides](https://systemprompt.io/guides)** · **[Live Demo](https://systemprompt.io/features/demo)** · **[Template](https://github.com/systempromptio/systemprompt-template)** · **[Discord](https://discord.gg/wkAbSuPWpr)**

<sub>CLI reference · Own how your organization uses AI.</sub>

</div>