@buildspacestudio/cli 0.2.0 → 0.2.1
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/README.md +194 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# @buildspacestudio/cli
|
|
2
|
+
|
|
3
|
+
BuildSpace CLI for creating apps, cloning repos, managing env vars, and triggering deployments from your terminal.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Requires Node.js 18+.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @buildspacestudio/cli
|
|
11
|
+
buildspace --help
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## What it does
|
|
15
|
+
|
|
16
|
+
- Sign in with browser-based login or a personal access token
|
|
17
|
+
- Create and select BuildSpace apps
|
|
18
|
+
- Clone an app repo locally
|
|
19
|
+
- Manage dev and prod environment variables
|
|
20
|
+
- Enable hosting and inspect hosting state
|
|
21
|
+
- Trigger deployments and stream deployment logs
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 1) Authenticate
|
|
27
|
+
buildspace auth login
|
|
28
|
+
|
|
29
|
+
# 2) Create an app
|
|
30
|
+
buildspace app create --name "My App"
|
|
31
|
+
|
|
32
|
+
# 3) Clone it locally
|
|
33
|
+
buildspace init --app my-app
|
|
34
|
+
|
|
35
|
+
# 4) Pull local env vars
|
|
36
|
+
buildspace env pull --env dev
|
|
37
|
+
|
|
38
|
+
# 5) Deploy current HEAD to dev
|
|
39
|
+
buildspace deploy
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Commands
|
|
43
|
+
|
|
44
|
+
### `auth`
|
|
45
|
+
|
|
46
|
+
Manage authentication for CLI requests.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
buildspace auth login
|
|
50
|
+
buildspace auth set --token <bs_pat_...>
|
|
51
|
+
buildspace auth show
|
|
52
|
+
buildspace auth clear
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- `login` opens a browser, completes a PKCE flow, and stores a token locally
|
|
56
|
+
- `set` stores a personal access token manually
|
|
57
|
+
- `show` prints the masked token and active API/git endpoints
|
|
58
|
+
- `clear` removes the stored token
|
|
59
|
+
|
|
60
|
+
Useful options:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
buildspace auth login --url https://runtime.buildspace.studio --git-url https://runtime.buildspace.studio
|
|
64
|
+
buildspace auth login --no-open
|
|
65
|
+
buildspace auth login --name "CLI on laptop" --expires-days 30
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### `app`
|
|
69
|
+
|
|
70
|
+
Create apps, switch active app context, and manage hosting.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
buildspace app list
|
|
74
|
+
buildspace app current
|
|
75
|
+
buildspace app use <slug>
|
|
76
|
+
buildspace app create --name "My App"
|
|
77
|
+
buildspace app delete <slug> --confirm <slug>
|
|
78
|
+
buildspace app hosting status [--app <slug>] [--env dev|prod]
|
|
79
|
+
buildspace app hosting enable [--app <slug>] [--env dev|prod]
|
|
80
|
+
buildspace app hosting disable [--app <slug>] [--env dev|prod]
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Notes:
|
|
84
|
+
|
|
85
|
+
- `app create` sets the new app as your active app automatically
|
|
86
|
+
- `app delete` is a soft delete and requires `--confirm` to match the slug exactly
|
|
87
|
+
- hosting commands default to the resolved app from `--app`, git remote, or active app
|
|
88
|
+
|
|
89
|
+
### `config`
|
|
90
|
+
|
|
91
|
+
Inspect or override the API and git base URLs used by the CLI.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
buildspace config show
|
|
95
|
+
buildspace config set-url --url <api-base-url> [--git-url <git-base-url>]
|
|
96
|
+
buildspace config reset
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### `init`
|
|
100
|
+
|
|
101
|
+
Clone a BuildSpace app repo by slug.
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
buildspace init --app <slug>
|
|
105
|
+
buildspace init --app <slug> --dir ./my-local-folder
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
After cloning, the CLI attempts to pull dev env vars into `.env.local` automatically when possible.
|
|
109
|
+
|
|
110
|
+
### `env`
|
|
111
|
+
|
|
112
|
+
Manage environment variables for an app.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
buildspace env list [--env dev|prod]
|
|
116
|
+
buildspace env set KEY=VALUE [--env dev|prod] [--secret | --no-secret]
|
|
117
|
+
buildspace env unset KEY [--env dev|prod]
|
|
118
|
+
buildspace env pull [--env dev|prod] [--output .env.local]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Behavior:
|
|
122
|
+
|
|
123
|
+
- `list` shows masked values
|
|
124
|
+
- `set` creates or updates a variable, and uppercases the key automatically
|
|
125
|
+
- `pull` writes system vars plus non-secret vars to a local env file
|
|
126
|
+
- keys with the `BUILDSPACE_` prefix are reserved
|
|
127
|
+
- `NEXT_PUBLIC_*` keys default to non-secret unless you override them
|
|
128
|
+
|
|
129
|
+
Examples:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
buildspace env list --env prod
|
|
133
|
+
buildspace env set STRIPE_SECRET_KEY=sk_test_123 --secret
|
|
134
|
+
buildspace env set NEXT_PUBLIC_API_URL=https://example.com --no-secret
|
|
135
|
+
buildspace env pull --env dev --output .env.local
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### `deploy`
|
|
139
|
+
|
|
140
|
+
Deploy from the current repo and inspect deployment state.
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
buildspace deploy
|
|
144
|
+
buildspace deploy status
|
|
145
|
+
buildspace deploy status --env prod --limit 5
|
|
146
|
+
buildspace deploy logs --env dev --latest
|
|
147
|
+
buildspace deploy logs --env prod --deployment <deployment-id>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
- `deploy` pushes `HEAD` to `origin/main` to trigger a dev deployment
|
|
151
|
+
- `status` shows recent deployments for dev, prod, or both
|
|
152
|
+
- `logs` shows deployment logs for a specific deployment or the latest one
|
|
153
|
+
|
|
154
|
+
## App resolution
|
|
155
|
+
|
|
156
|
+
Most app-aware commands resolve the target app in this order:
|
|
157
|
+
|
|
158
|
+
1. `--app <slug>`
|
|
159
|
+
2. the current git remote `origin`
|
|
160
|
+
3. the active app saved by `buildspace app use`
|
|
161
|
+
|
|
162
|
+
That means commands like `buildspace env list` and `buildspace deploy status` usually work directly inside a cloned BuildSpace app repo.
|
|
163
|
+
|
|
164
|
+
## Local config
|
|
165
|
+
|
|
166
|
+
The CLI stores local settings such as:
|
|
167
|
+
|
|
168
|
+
- personal access token
|
|
169
|
+
- API base URL
|
|
170
|
+
- git base URL
|
|
171
|
+
- active app selection
|
|
172
|
+
|
|
173
|
+
You can inspect the current configuration at any time with:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
buildspace config show
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## Help
|
|
180
|
+
|
|
181
|
+
Run help for any command group:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
buildspace --help
|
|
185
|
+
buildspace auth --help
|
|
186
|
+
buildspace app --help
|
|
187
|
+
buildspace env --help
|
|
188
|
+
buildspace deploy --help
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Links
|
|
192
|
+
|
|
193
|
+
- Docs: https://docs.buildspace.studio/docs/cli/overview
|
|
194
|
+
- Repository: https://github.com/buildspacestudio/buildspace/tree/main/packages/cli
|