kctl-supa 0.6.3__tar.gz
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.
- kctl_supa-0.6.3/.gitignore +33 -0
- kctl_supa-0.6.3/PKG-INFO +18 -0
- kctl_supa-0.6.3/README.md +79 -0
- kctl_supa-0.6.3/pyproject.toml +44 -0
- kctl_supa-0.6.3/skills/supa-admin/SKILL.md +198 -0
- kctl_supa-0.6.3/src/kctl_supa/__init__.py +3 -0
- kctl_supa-0.6.3/src/kctl_supa/__main__.py +5 -0
- kctl_supa-0.6.3/src/kctl_supa/cli.py +169 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/__init__.py +1 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/advisors_cmd.py +239 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/auth_cmd.py +276 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/backup_cmd.py +126 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/config_cmd.py +225 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/cron_cmd.py +108 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/dashboard_cmd.py +101 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/db_cmd.py +229 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/deploy_cmd.py +123 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/doctor_cmd.py +289 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/functions_cmd.py +147 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/health_cmd.py +100 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/integrations_cmd.py +85 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/logs_cmd.py +115 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/maintenance_cmd.py +121 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/migrate_cmd.py +128 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/monitor_cmd.py +127 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/publications_cmd.py +113 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/queues_cmd.py +164 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/realtime_cmd.py +72 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/security_cmd.py +146 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/settings_cmd.py +114 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/skill_cmd.py +57 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/status_cmd.py +79 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/storage_cmd.py +255 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/upgrade_cmd.py +258 -0
- kctl_supa-0.6.3/src/kctl_supa/commands/vault_cmd.py +101 -0
- kctl_supa-0.6.3/src/kctl_supa/core/__init__.py +1 -0
- kctl_supa-0.6.3/src/kctl_supa/core/callbacks.py +26 -0
- kctl_supa-0.6.3/src/kctl_supa/core/client.py +203 -0
- kctl_supa-0.6.3/src/kctl_supa/core/config.py +156 -0
- kctl_supa-0.6.3/src/kctl_supa/core/docker.py +250 -0
- kctl_supa-0.6.3/src/kctl_supa/core/exceptions.py +56 -0
- kctl_supa-0.6.3/tests/__init__.py +0 -0
- kctl_supa-0.6.3/tests/conftest.py +58 -0
- kctl_supa-0.6.3/tests/test_cli.py +109 -0
- kctl_supa-0.6.3/tests/test_client.py +26 -0
- kctl_supa-0.6.3/tests/test_commands.py +282 -0
- kctl_supa-0.6.3/tests/test_config.py +31 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
*.egg
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
.eggs/
|
|
9
|
+
|
|
10
|
+
# Virtual environments
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
|
|
14
|
+
# IDE
|
|
15
|
+
.idea/
|
|
16
|
+
.vscode/
|
|
17
|
+
*.swp
|
|
18
|
+
*.swo
|
|
19
|
+
|
|
20
|
+
# Testing
|
|
21
|
+
.pytest_cache/
|
|
22
|
+
.coverage
|
|
23
|
+
htmlcov/
|
|
24
|
+
.mypy_cache/
|
|
25
|
+
.ruff_cache/
|
|
26
|
+
|
|
27
|
+
# OS
|
|
28
|
+
.DS_Store
|
|
29
|
+
Thumbs.db
|
|
30
|
+
|
|
31
|
+
# Environment
|
|
32
|
+
.env
|
|
33
|
+
.env.local
|
kctl_supa-0.6.3/PKG-INFO
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kctl-supa
|
|
3
|
+
Version: 0.6.3
|
|
4
|
+
Summary: Kodemeio Supabase CLI — manage self-hosted Supabase instances
|
|
5
|
+
Requires-Python: >=3.12
|
|
6
|
+
Requires-Dist: httpx>=0.27.0
|
|
7
|
+
Requires-Dist: kctl-lib>=0.8.0
|
|
8
|
+
Requires-Dist: paramiko<4.0.0,>=3.4.0
|
|
9
|
+
Requires-Dist: pydantic>=2.10.0
|
|
10
|
+
Requires-Dist: pyyaml>=6.0.2
|
|
11
|
+
Requires-Dist: rich>=13.9.0
|
|
12
|
+
Requires-Dist: sshtunnel>=0.4.0
|
|
13
|
+
Requires-Dist: typer>=0.15.0
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: mypy>=1.14.0; extra == 'dev'
|
|
16
|
+
Requires-Dist: pytest>=8.3.0; extra == 'dev'
|
|
17
|
+
Requires-Dist: ruff>=0.9.0; extra == 'dev'
|
|
18
|
+
Requires-Dist: types-pyyaml>=6.0.0; extra == 'dev'
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# kctl-supa
|
|
2
|
+
|
|
3
|
+
kctl-supa — Kodemeio Supabase CLI for managing self-hosted Supabase instances.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv pip install -e packages/kctl-supa
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Add a profile
|
|
15
|
+
kctl-supa config add terakidz \
|
|
16
|
+
--url https://supa.terakidz.com \
|
|
17
|
+
--service-role-key <key> \
|
|
18
|
+
--ssh-host 49.13.14.79 \
|
|
19
|
+
--container-prefix terakidz-supabase-prod
|
|
20
|
+
|
|
21
|
+
# Set as default
|
|
22
|
+
kctl-supa config use terakidz
|
|
23
|
+
|
|
24
|
+
# Check health
|
|
25
|
+
kctl-supa health check
|
|
26
|
+
|
|
27
|
+
# Dashboard overview
|
|
28
|
+
kctl-supa dashboard show
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Command Reference
|
|
32
|
+
|
|
33
|
+
| Group | Panel | Description |
|
|
34
|
+
|-------|-------|-------------|
|
|
35
|
+
| config | Admin & Config | Profile management |
|
|
36
|
+
| security | Admin & Config | RLS policies, JWT inspection, API keys |
|
|
37
|
+
| doctor | Admin & Config | Diagnostic checks |
|
|
38
|
+
| health | Services | Service health checks |
|
|
39
|
+
| status | Services | Container status |
|
|
40
|
+
| dashboard | Services | Overview dashboard |
|
|
41
|
+
| monitor | Services | Performance monitoring |
|
|
42
|
+
| db | Database | Database operations |
|
|
43
|
+
| backup | Database | Backup management |
|
|
44
|
+
| maintenance | Database | Vacuum, reindex, analyze |
|
|
45
|
+
| migrate | Database | SQL migrations |
|
|
46
|
+
| auth | Auth & Users | User management |
|
|
47
|
+
| storage | Storage & Files | Bucket operations |
|
|
48
|
+
| realtime | Realtime & Functions | Realtime status |
|
|
49
|
+
| functions | Realtime & Functions | Edge functions |
|
|
50
|
+
| logs | Operations | Log tailing/search |
|
|
51
|
+
| deploy | Operations | Stack deployment |
|
|
52
|
+
|
|
53
|
+
## Config Format
|
|
54
|
+
|
|
55
|
+
```yaml
|
|
56
|
+
# ~/.config/kodemeio/config.yaml
|
|
57
|
+
profiles:
|
|
58
|
+
terakidz:
|
|
59
|
+
supabase:
|
|
60
|
+
url: https://supa.terakidz.com
|
|
61
|
+
service_role_key: <key>
|
|
62
|
+
anon_key: <key>
|
|
63
|
+
db_password: <pass>
|
|
64
|
+
ssh_host: 49.13.14.79
|
|
65
|
+
ssh_user: root
|
|
66
|
+
ssh_key: ~/.ssh/id_ed25519
|
|
67
|
+
container_prefix: terakidz-supabase-prod
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Environment Variables
|
|
71
|
+
|
|
72
|
+
| Variable | Description |
|
|
73
|
+
|----------|-------------|
|
|
74
|
+
| `KCTL_SUPA_URL` | Supabase instance URL |
|
|
75
|
+
| `KCTL_SUPA_SERVICE_ROLE_KEY` | Service role JWT key |
|
|
76
|
+
| `KCTL_SUPA_ANON_KEY` | Anonymous JWT key |
|
|
77
|
+
| `KCTL_SUPA_SSH_HOST` | SSH host for container access |
|
|
78
|
+
| `KCTL_SUPA_CONTAINER_PREFIX` | Docker container name prefix |
|
|
79
|
+
| `KCTL_SUPA_PROFILE` | Active config profile name |
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "kctl-supa"
|
|
7
|
+
version = "0.6.3"
|
|
8
|
+
description = "Kodemeio Supabase CLI — manage self-hosted Supabase instances"
|
|
9
|
+
requires-python = ">=3.12"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"kctl-lib>=0.8.0",
|
|
12
|
+
"typer>=0.15.0",
|
|
13
|
+
"rich>=13.9.0",
|
|
14
|
+
"pydantic>=2.10.0",
|
|
15
|
+
"pyyaml>=6.0.2",
|
|
16
|
+
"httpx>=0.27.0",
|
|
17
|
+
"paramiko>=3.4.0,<4.0.0",
|
|
18
|
+
"sshtunnel>=0.4.0",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
dev = [
|
|
23
|
+
"pytest>=8.3.0",
|
|
24
|
+
"ruff>=0.9.0",
|
|
25
|
+
"mypy>=1.14.0",
|
|
26
|
+
"types-PyYAML>=6.0.0",
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
kctl-supa = "kctl_supa.cli:_run"
|
|
31
|
+
|
|
32
|
+
[tool.uv.sources]
|
|
33
|
+
kctl-lib = { workspace = true }
|
|
34
|
+
|
|
35
|
+
[tool.hatch.build.targets.wheel]
|
|
36
|
+
packages = ["src/kctl_supa"]
|
|
37
|
+
|
|
38
|
+
[tool.ruff]
|
|
39
|
+
target-version = "py312"
|
|
40
|
+
line-length = 120
|
|
41
|
+
|
|
42
|
+
[tool.mypy]
|
|
43
|
+
python_version = "3.12"
|
|
44
|
+
strict = true
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: supa-admin
|
|
3
|
+
description: >
|
|
4
|
+
Self-hosted Supabase administration via kctl-supa CLI (22 groups, ~50+ commands).
|
|
5
|
+
MUST use for ANY kctl-supa operation.
|
|
6
|
+
Triggers on: "advisors", "auth", "backup", "config", "cron", "dashboard", "db", "deploy",
|
|
7
|
+
"doctor", "functions", "health", "integrations", "kctl-supa", "logs", "maintenance",
|
|
8
|
+
"migrate", "monitor", "profile", "publications", "queues", "realtime", "security",
|
|
9
|
+
"settings", "status", "storage", "supabase", "upgrade", "vault".
|
|
10
|
+
Auto-generated: 2026-05-03
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# supa-admin -- kctl-supa CLI Reference
|
|
14
|
+
|
|
15
|
+
> Auto-generated from `kctl-supa` command registry. Do not edit manually.
|
|
16
|
+
> To regenerate: `kctl-supa skill generate`
|
|
17
|
+
> To add custom content: edit `SKILL.extra.md` in the same directory.
|
|
18
|
+
|
|
19
|
+
## Overview
|
|
20
|
+
|
|
21
|
+
**CLI:** `kctl-supa`
|
|
22
|
+
**Command groups:** 22
|
|
23
|
+
**Total commands:** ~50+
|
|
24
|
+
**Install:** `cd packages/kctl-supa && uv tool install --editable .`
|
|
25
|
+
|
|
26
|
+
## Global Options
|
|
27
|
+
|
|
28
|
+
| Flag | Description |
|
|
29
|
+
|------|-------------|
|
|
30
|
+
| `--json` | Output as JSON |
|
|
31
|
+
| `--quiet`, `-q` | Suppress info messages |
|
|
32
|
+
| `--profile`, `-p` | Config profile name |
|
|
33
|
+
| `--url` | Supabase URL override |
|
|
34
|
+
| `--version`, `-V` | Show version |
|
|
35
|
+
|
|
36
|
+
## Command Reference
|
|
37
|
+
|
|
38
|
+
### Admin & Config
|
|
39
|
+
|
|
40
|
+
#### `kctl-supa config`
|
|
41
|
+
|
|
42
|
+
Manage CLI configuration and profiles.
|
|
43
|
+
|
|
44
|
+
| Command | Description |
|
|
45
|
+
|---------|-------------|
|
|
46
|
+
| `config init` | Initialize CLI configuration. |
|
|
47
|
+
| `config show` | Show configuration (keys masked). |
|
|
48
|
+
| `config add` | Add a new profile. |
|
|
49
|
+
| `config use` | Switch default profile. |
|
|
50
|
+
| `config remove` | Remove a profile. |
|
|
51
|
+
|
|
52
|
+
#### `kctl-supa security`
|
|
53
|
+
|
|
54
|
+
Security audit and management for the Supabase instance.
|
|
55
|
+
|
|
56
|
+
#### `kctl-supa doctor`
|
|
57
|
+
|
|
58
|
+
Run diagnostic checks (API connectivity, auth, config).
|
|
59
|
+
|
|
60
|
+
#### `kctl-supa vault`
|
|
61
|
+
|
|
62
|
+
Supabase Vault secret management.
|
|
63
|
+
|
|
64
|
+
#### `kctl-supa integrations`
|
|
65
|
+
|
|
66
|
+
Manage third-party integrations.
|
|
67
|
+
|
|
68
|
+
#### `kctl-supa settings`
|
|
69
|
+
|
|
70
|
+
View and update Supabase instance settings.
|
|
71
|
+
|
|
72
|
+
### Services
|
|
73
|
+
|
|
74
|
+
#### `kctl-supa health`
|
|
75
|
+
|
|
76
|
+
Health checks for the Supabase instance.
|
|
77
|
+
|
|
78
|
+
#### `kctl-supa status`
|
|
79
|
+
|
|
80
|
+
Quick status overview of all Supabase services.
|
|
81
|
+
|
|
82
|
+
#### `kctl-supa dashboard`
|
|
83
|
+
|
|
84
|
+
Dashboard overview with key metrics.
|
|
85
|
+
|
|
86
|
+
#### `kctl-supa monitor`
|
|
87
|
+
|
|
88
|
+
Continuous monitoring and alerting.
|
|
89
|
+
|
|
90
|
+
#### `kctl-supa advisors`
|
|
91
|
+
|
|
92
|
+
Performance advisors and recommendations.
|
|
93
|
+
|
|
94
|
+
### Database
|
|
95
|
+
|
|
96
|
+
#### `kctl-supa db`
|
|
97
|
+
|
|
98
|
+
Core database operations (query, schemas, tables, extensions).
|
|
99
|
+
|
|
100
|
+
#### `kctl-supa backup`
|
|
101
|
+
|
|
102
|
+
Database backup and restore operations.
|
|
103
|
+
|
|
104
|
+
#### `kctl-supa maintenance`
|
|
105
|
+
|
|
106
|
+
Database maintenance tasks (vacuum, reindex, analyze).
|
|
107
|
+
|
|
108
|
+
#### `kctl-supa migrate`
|
|
109
|
+
|
|
110
|
+
Database migration management.
|
|
111
|
+
|
|
112
|
+
#### `kctl-supa cron`
|
|
113
|
+
|
|
114
|
+
Cron job scheduling (pg_cron).
|
|
115
|
+
|
|
116
|
+
#### `kctl-supa queues`
|
|
117
|
+
|
|
118
|
+
Database queue management (pgmq).
|
|
119
|
+
|
|
120
|
+
### Auth & Users
|
|
121
|
+
|
|
122
|
+
#### `kctl-supa auth`
|
|
123
|
+
|
|
124
|
+
Authentication user management (list, create, ban, invite).
|
|
125
|
+
|
|
126
|
+
### Storage & Files
|
|
127
|
+
|
|
128
|
+
#### `kctl-supa storage`
|
|
129
|
+
|
|
130
|
+
Storage bucket and file management.
|
|
131
|
+
|
|
132
|
+
### Realtime & Functions
|
|
133
|
+
|
|
134
|
+
#### `kctl-supa realtime`
|
|
135
|
+
|
|
136
|
+
Realtime channel and subscription management.
|
|
137
|
+
|
|
138
|
+
#### `kctl-supa functions`
|
|
139
|
+
|
|
140
|
+
Edge Function deployment and management.
|
|
141
|
+
|
|
142
|
+
#### `kctl-supa publications`
|
|
143
|
+
|
|
144
|
+
Postgres logical replication publications.
|
|
145
|
+
|
|
146
|
+
### Operations
|
|
147
|
+
|
|
148
|
+
#### `kctl-supa logs`
|
|
149
|
+
|
|
150
|
+
View and stream service logs.
|
|
151
|
+
|
|
152
|
+
#### `kctl-supa deploy`
|
|
153
|
+
|
|
154
|
+
Deployment operations (compose up/down, config push).
|
|
155
|
+
|
|
156
|
+
#### `kctl-supa upgrade`
|
|
157
|
+
|
|
158
|
+
Version upgrade management.
|
|
159
|
+
|
|
160
|
+
## Configuration
|
|
161
|
+
|
|
162
|
+
Shared config: `~/.config/kodemeio/config.yaml`
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
kctl-supa config init # Interactive setup
|
|
166
|
+
kctl-supa config show # Show current config
|
|
167
|
+
kctl-supa doctor run # Full diagnostics
|
|
168
|
+
kctl-supa self-update # Check for updates
|
|
169
|
+
kctl-supa completions zsh --install # Install shell completions
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Examples:**
|
|
173
|
+
```bash
|
|
174
|
+
# Check Supabase health
|
|
175
|
+
kctl-supa health check -p kodemeio
|
|
176
|
+
|
|
177
|
+
# View service status overview
|
|
178
|
+
kctl-supa status overview -p kodemeio
|
|
179
|
+
|
|
180
|
+
# List auth users
|
|
181
|
+
kctl-supa auth list -p kodemeio
|
|
182
|
+
|
|
183
|
+
# Create a database backup
|
|
184
|
+
kctl-supa backup create -p kodemeio
|
|
185
|
+
|
|
186
|
+
# Run database maintenance
|
|
187
|
+
kctl-supa maintenance vacuum -p kodemeio
|
|
188
|
+
|
|
189
|
+
# List storage buckets
|
|
190
|
+
kctl-supa storage list -p kodemeio
|
|
191
|
+
|
|
192
|
+
# Deploy edge functions
|
|
193
|
+
kctl-supa functions deploy -p kodemeio
|
|
194
|
+
|
|
195
|
+
# View logs and manage cron jobs
|
|
196
|
+
kctl-supa logs tail -p kodemeio
|
|
197
|
+
kctl-supa cron list -p kodemeio
|
|
198
|
+
```
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"""Main CLI entry point for kctl-supa."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Annotated
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
from kctl_lib import handle_cli_error
|
|
9
|
+
|
|
10
|
+
from kctl_supa import __version__
|
|
11
|
+
from kctl_supa.commands.advisors_cmd import app as advisors_app
|
|
12
|
+
from kctl_supa.commands.auth_cmd import app as auth_app
|
|
13
|
+
from kctl_supa.commands.backup_cmd import app as backup_app
|
|
14
|
+
from kctl_supa.commands.config_cmd import app as config_app
|
|
15
|
+
from kctl_supa.commands.cron_cmd import app as cron_app
|
|
16
|
+
from kctl_supa.commands.dashboard_cmd import app as dashboard_app
|
|
17
|
+
from kctl_supa.commands.db_cmd import app as db_app
|
|
18
|
+
from kctl_supa.commands.deploy_cmd import app as deploy_app
|
|
19
|
+
from kctl_supa.commands.doctor_cmd import app as doctor_app
|
|
20
|
+
from kctl_supa.commands.functions_cmd import app as functions_app
|
|
21
|
+
from kctl_supa.commands.health_cmd import app as health_app
|
|
22
|
+
from kctl_supa.commands.integrations_cmd import app as integrations_app
|
|
23
|
+
from kctl_supa.commands.logs_cmd import app as logs_app
|
|
24
|
+
from kctl_supa.commands.maintenance_cmd import app as maintenance_app
|
|
25
|
+
from kctl_supa.commands.migrate_cmd import app as migrate_app
|
|
26
|
+
from kctl_supa.commands.monitor_cmd import app as monitor_app
|
|
27
|
+
from kctl_supa.commands.publications_cmd import app as publications_app
|
|
28
|
+
from kctl_supa.commands.queues_cmd import app as queues_app
|
|
29
|
+
from kctl_supa.commands.realtime_cmd import app as realtime_app
|
|
30
|
+
from kctl_supa.commands.security_cmd import app as security_app
|
|
31
|
+
from kctl_supa.commands.settings_cmd import app as settings_app
|
|
32
|
+
from kctl_supa.commands.skill_cmd import app as skill_app
|
|
33
|
+
from kctl_supa.commands.status_cmd import app as status_app
|
|
34
|
+
from kctl_supa.commands.storage_cmd import app as storage_app
|
|
35
|
+
from kctl_supa.commands.upgrade_cmd import app as upgrade_app
|
|
36
|
+
from kctl_supa.commands.vault_cmd import app as vault_app
|
|
37
|
+
from kctl_supa.core.callbacks import AppContext
|
|
38
|
+
from kctl_supa.core.exceptions import SupabaseError
|
|
39
|
+
from kctl_lib.self_update import notify_if_outdated
|
|
40
|
+
from kctl_lib.tui import add_tui_command
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def version_callback(value: bool) -> None:
|
|
44
|
+
if value:
|
|
45
|
+
typer.echo(f"kctl-supa {__version__}")
|
|
46
|
+
raise typer.Exit()
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
app = typer.Typer(
|
|
50
|
+
name="kctl-supa",
|
|
51
|
+
help="Kodemeio Supabase CLI - manage self-hosted Supabase instances.",
|
|
52
|
+
no_args_is_help=True,
|
|
53
|
+
rich_markup_mode="rich",
|
|
54
|
+
pretty_exceptions_enable=False,
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@app.callback()
|
|
59
|
+
def main(
|
|
60
|
+
ctx: typer.Context,
|
|
61
|
+
json_output: Annotated[bool, typer.Option("--json", help="Output as JSON")] = False,
|
|
62
|
+
quiet: Annotated[bool, typer.Option("--quiet", "-q", help="Suppress info messages")] = False,
|
|
63
|
+
profile: Annotated[str | None, typer.Option("--profile", "-p", help="Config profile name")] = None,
|
|
64
|
+
url: Annotated[str | None, typer.Option("--url", help="Supabase URL override")] = None,
|
|
65
|
+
version: Annotated[
|
|
66
|
+
bool, typer.Option("--version", "-V", callback=version_callback, is_eager=True, help="Show version")
|
|
67
|
+
] = False,
|
|
68
|
+
) -> None:
|
|
69
|
+
"""Kodemeio Supabase CLI."""
|
|
70
|
+
ctx.ensure_object(dict)
|
|
71
|
+
ctx.obj = AppContext(
|
|
72
|
+
json_mode=json_output,
|
|
73
|
+
quiet=quiet,
|
|
74
|
+
profile=profile,
|
|
75
|
+
url_override=url,
|
|
76
|
+
)
|
|
77
|
+
notify_if_outdated(ctx.obj.output, "kctl-supa", __version__)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
_P_ADMIN = "Admin & Config"
|
|
81
|
+
app.add_typer(config_app, name="config", rich_help_panel=_P_ADMIN)
|
|
82
|
+
app.add_typer(security_app, name="security", rich_help_panel=_P_ADMIN)
|
|
83
|
+
app.add_typer(doctor_app, name="doctor", rich_help_panel=_P_ADMIN)
|
|
84
|
+
app.add_typer(vault_app, name="vault", rich_help_panel=_P_ADMIN)
|
|
85
|
+
app.add_typer(integrations_app, name="integrations", rich_help_panel=_P_ADMIN)
|
|
86
|
+
app.add_typer(settings_app, name="settings", rich_help_panel=_P_ADMIN)
|
|
87
|
+
|
|
88
|
+
_P_SERVICES = "Services"
|
|
89
|
+
app.add_typer(health_app, name="health", rich_help_panel=_P_SERVICES)
|
|
90
|
+
app.add_typer(status_app, name="status", rich_help_panel=_P_SERVICES)
|
|
91
|
+
app.add_typer(dashboard_app, name="dashboard", rich_help_panel=_P_SERVICES)
|
|
92
|
+
app.add_typer(monitor_app, name="monitor", rich_help_panel=_P_SERVICES)
|
|
93
|
+
app.add_typer(advisors_app, name="advisors", rich_help_panel=_P_SERVICES)
|
|
94
|
+
|
|
95
|
+
_P_DATABASE = "Database"
|
|
96
|
+
app.add_typer(db_app, name="db", rich_help_panel=_P_DATABASE)
|
|
97
|
+
app.add_typer(backup_app, name="backup", rich_help_panel=_P_DATABASE)
|
|
98
|
+
app.add_typer(maintenance_app, name="maintenance", rich_help_panel=_P_DATABASE)
|
|
99
|
+
app.add_typer(migrate_app, name="migrate", rich_help_panel=_P_DATABASE)
|
|
100
|
+
app.add_typer(cron_app, name="cron", rich_help_panel=_P_DATABASE)
|
|
101
|
+
app.add_typer(queues_app, name="queues", rich_help_panel=_P_DATABASE)
|
|
102
|
+
|
|
103
|
+
_P_AUTH = "Auth & Users"
|
|
104
|
+
app.add_typer(auth_app, name="auth", rich_help_panel=_P_AUTH)
|
|
105
|
+
|
|
106
|
+
_P_STORAGE = "Storage & Files"
|
|
107
|
+
app.add_typer(storage_app, name="storage", rich_help_panel=_P_STORAGE)
|
|
108
|
+
|
|
109
|
+
_P_RT = "Realtime & Functions"
|
|
110
|
+
app.add_typer(realtime_app, name="realtime", rich_help_panel=_P_RT)
|
|
111
|
+
app.add_typer(functions_app, name="functions", rich_help_panel=_P_RT)
|
|
112
|
+
app.add_typer(publications_app, name="publications", rich_help_panel=_P_RT)
|
|
113
|
+
|
|
114
|
+
_P_OPS = "Operations"
|
|
115
|
+
app.add_typer(logs_app, name="logs", rich_help_panel=_P_OPS)
|
|
116
|
+
app.add_typer(deploy_app, name="deploy", rich_help_panel=_P_OPS)
|
|
117
|
+
app.add_typer(upgrade_app, name="upgrade", rich_help_panel=_P_OPS)
|
|
118
|
+
|
|
119
|
+
app.add_typer(skill_app, name="skill", hidden=True)
|
|
120
|
+
add_tui_command(app, service_key="supa", version=__version__)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@app.command("self-update")
|
|
124
|
+
def self_update_cmd(ctx: typer.Context) -> None:
|
|
125
|
+
"""Check for updates and upgrade kctl-supa."""
|
|
126
|
+
actx = ctx.obj
|
|
127
|
+
out = actx.output
|
|
128
|
+
from kctl_lib.self_update import check_update
|
|
129
|
+
from kctl_lib.self_update import update as do_update
|
|
130
|
+
|
|
131
|
+
latest = check_update("kctl-supa", __version__)
|
|
132
|
+
if latest:
|
|
133
|
+
out.info(f"Updating to {latest}...")
|
|
134
|
+
do_update("kctl-supa")
|
|
135
|
+
out.success(f"Updated to {latest}")
|
|
136
|
+
else:
|
|
137
|
+
out.success("Already up to date")
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
@app.command()
|
|
141
|
+
def completions(
|
|
142
|
+
shell: Annotated[str, typer.Argument(help="Shell type: zsh, bash, fish")] = "zsh",
|
|
143
|
+
install: Annotated[bool, typer.Option("--install", help="Install completions")] = False,
|
|
144
|
+
) -> None:
|
|
145
|
+
"""Generate or install shell completions."""
|
|
146
|
+
from kctl_lib.completions import get_completion_script, install_completions
|
|
147
|
+
|
|
148
|
+
if install:
|
|
149
|
+
path = install_completions("kctl-supa", shell)
|
|
150
|
+
if path:
|
|
151
|
+
typer.echo(f"Completions installed to {path}")
|
|
152
|
+
else:
|
|
153
|
+
typer.echo(f"Could not install completions for {shell}", err=True)
|
|
154
|
+
raise typer.Exit(code=1)
|
|
155
|
+
else:
|
|
156
|
+
script = get_completion_script("kctl-supa", shell)
|
|
157
|
+
typer.echo(script)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def _run() -> None:
|
|
161
|
+
"""Entry point with error handling."""
|
|
162
|
+
try:
|
|
163
|
+
app()
|
|
164
|
+
except SupabaseError as e:
|
|
165
|
+
handle_cli_error(e)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
if __name__ == "__main__":
|
|
169
|
+
_run()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""CLI command modules for kctl-supa."""
|