@supacontrol/cli 0.1.0 โ 0.1.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 +27 -30
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
> Safety-first CLI wrapper for Supabase with environment guards and confirmation prompts
|
|
4
4
|
|
|
5
|
-
[](https://github.com/haal-laah/supacontrol/actions/workflows/ci.yml)
|
|
6
6
|
[](https://www.npmjs.com/package/@supacontrol/cli)
|
|
7
7
|
|
|
8
8
|
## Why SupaControl?
|
|
9
9
|
|
|
10
10
|
The Supabase CLI is powerful but dangerous. One wrong command on the wrong branch can wipe your production database. **SupaControl adds safety guards:**
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
12
|
+
- **Environment locking** - Production locked by default
|
|
13
|
+
- **Confirmation prompts** - Type environment name to confirm destructive operations
|
|
14
|
+
- **Branch-based auto-detection** - Automatically targets the right environment
|
|
15
|
+
- **Project ref validation** - Prevents operating on wrong database
|
|
16
|
+
- **Clean git checks** - Requires clean working directory for safety
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
@@ -202,9 +202,13 @@ supacontrol doctor
|
|
|
202
202
|
### GitHub Actions
|
|
203
203
|
|
|
204
204
|
```yaml
|
|
205
|
+
- name: Install Supabase CLI
|
|
206
|
+
uses: supabase/setup-cli@v1
|
|
207
|
+
with:
|
|
208
|
+
version: latest
|
|
209
|
+
|
|
205
210
|
- name: Push migrations
|
|
206
|
-
run:
|
|
207
|
-
supacontrol push -e production --ci --i-know-what-im-doing
|
|
211
|
+
run: supacontrol push -e production --ci
|
|
208
212
|
env:
|
|
209
213
|
SUPABASE_ACCESS_TOKEN: ${{ secrets.SUPABASE_ACCESS_TOKEN }}
|
|
210
214
|
```
|
|
@@ -214,8 +218,7 @@ supacontrol doctor
|
|
|
214
218
|
| Flag | Description |
|
|
215
219
|
|------|-------------|
|
|
216
220
|
| `--ci` | Non-interactive mode |
|
|
217
|
-
|
|
|
218
|
-
| `-e, --env <name>` | Explicit environment (required in CI) |
|
|
221
|
+
| `-e, --env <name>` | Explicit environment target |
|
|
219
222
|
|
|
220
223
|
### Environment Variables
|
|
221
224
|
|
|
@@ -230,10 +233,10 @@ supacontrol doctor
|
|
|
230
233
|
Production environments are locked by default. Locked environments block ALL destructive operations:
|
|
231
234
|
|
|
232
235
|
```
|
|
233
|
-
|
|
236
|
+
x Environment 'production' is locked
|
|
234
237
|
Suggestions:
|
|
235
|
-
|
|
236
|
-
|
|
238
|
+
- Set 'locked = false' in supacontrol.toml for [environments.production]
|
|
239
|
+
- Or use --force flag to override (not recommended for production)
|
|
237
240
|
```
|
|
238
241
|
|
|
239
242
|
### Operation Guard
|
|
@@ -241,7 +244,7 @@ Production environments are locked by default. Locked environments block ALL des
|
|
|
241
244
|
Protected operations require typing a confirmation word:
|
|
242
245
|
|
|
243
246
|
```
|
|
244
|
-
|
|
247
|
+
! This will reset the staging database
|
|
245
248
|
Type 'staging' to confirm:
|
|
246
249
|
```
|
|
247
250
|
|
|
@@ -250,9 +253,9 @@ Protected operations require typing a confirmation word:
|
|
|
250
253
|
Validates that the linked Supabase project matches the expected environment:
|
|
251
254
|
|
|
252
255
|
```
|
|
253
|
-
|
|
256
|
+
x Project mismatch: linked to 'wrong-project' but 'production' expects 'prod-project'
|
|
254
257
|
Suggestions:
|
|
255
|
-
|
|
258
|
+
- Run 'supabase link --project-ref prod-project' to switch
|
|
256
259
|
```
|
|
257
260
|
|
|
258
261
|
### Git Guard
|
|
@@ -260,9 +263,9 @@ Validates that the linked Supabase project matches the expected environment:
|
|
|
260
263
|
Requires clean git working directory for destructive operations:
|
|
261
264
|
|
|
262
265
|
```
|
|
263
|
-
|
|
266
|
+
x Uncommitted changes detected
|
|
264
267
|
Suggestions:
|
|
265
|
-
|
|
268
|
+
- Commit or stash your changes before running this command
|
|
266
269
|
```
|
|
267
270
|
|
|
268
271
|
## Aliases
|
|
@@ -275,29 +278,23 @@ The CLI is available under three names:
|
|
|
275
278
|
|
|
276
279
|
## Contributing
|
|
277
280
|
|
|
281
|
+
See [CONTRIBUTING.md](https://github.com/haal-laah/supacontrol/blob/develop/CONTRIBUTING.md) for guidelines.
|
|
282
|
+
|
|
278
283
|
```bash
|
|
279
284
|
# Clone the repo
|
|
280
|
-
git clone https://github.com/
|
|
285
|
+
git clone https://github.com/haal-laah/supacontrol.git
|
|
281
286
|
cd supacontrol
|
|
282
287
|
|
|
283
288
|
# Install dependencies
|
|
284
289
|
pnpm install
|
|
285
290
|
|
|
286
291
|
# Run tests
|
|
287
|
-
pnpm
|
|
292
|
+
pnpm test
|
|
288
293
|
|
|
289
294
|
# Build
|
|
290
|
-
pnpm
|
|
295
|
+
pnpm build
|
|
291
296
|
```
|
|
292
297
|
|
|
293
|
-
### Test Fixtures
|
|
294
|
-
|
|
295
|
-
Test fixtures in `tests/fixtures/` are protected by SHA256 checksums. If a test fails:
|
|
296
|
-
|
|
297
|
-
1. **DO NOT** modify the fixture
|
|
298
|
-
2. **DO** fix the implementation in `src/`
|
|
299
|
-
3. If the expected behavior changed, update fixtures and run `pnpm verify-fixtures --update`
|
|
300
|
-
|
|
301
298
|
## License
|
|
302
299
|
|
|
303
|
-
MIT
|
|
300
|
+
MIT - see [LICENSE](https://github.com/haal-laah/supacontrol/blob/main/LICENSE) for details.
|