kctl-api 0.2.0__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.
Files changed (76) hide show
  1. kctl_api-0.2.0/.gitignore +33 -0
  2. kctl_api-0.2.0/PKG-INFO +34 -0
  3. kctl_api-0.2.0/README.md +227 -0
  4. kctl_api-0.2.0/pyproject.toml +85 -0
  5. kctl_api-0.2.0/skills/api-admin/SKILL.md +625 -0
  6. kctl_api-0.2.0/src/kctl_api/__init__.py +3 -0
  7. kctl_api-0.2.0/src/kctl_api/__main__.py +5 -0
  8. kctl_api-0.2.0/src/kctl_api/cli.py +238 -0
  9. kctl_api-0.2.0/src/kctl_api/commands/__init__.py +1 -0
  10. kctl_api-0.2.0/src/kctl_api/commands/ai.py +250 -0
  11. kctl_api-0.2.0/src/kctl_api/commands/aliases.py +84 -0
  12. kctl_api-0.2.0/src/kctl_api/commands/apps.py +172 -0
  13. kctl_api-0.2.0/src/kctl_api/commands/auth.py +313 -0
  14. kctl_api-0.2.0/src/kctl_api/commands/automation.py +242 -0
  15. kctl_api-0.2.0/src/kctl_api/commands/build_cmd.py +87 -0
  16. kctl_api-0.2.0/src/kctl_api/commands/clean.py +182 -0
  17. kctl_api-0.2.0/src/kctl_api/commands/config_cmd.py +443 -0
  18. kctl_api-0.2.0/src/kctl_api/commands/dashboard.py +139 -0
  19. kctl_api-0.2.0/src/kctl_api/commands/db.py +599 -0
  20. kctl_api-0.2.0/src/kctl_api/commands/deploy.py +84 -0
  21. kctl_api-0.2.0/src/kctl_api/commands/deps.py +289 -0
  22. kctl_api-0.2.0/src/kctl_api/commands/dev.py +136 -0
  23. kctl_api-0.2.0/src/kctl_api/commands/docker_cmd.py +252 -0
  24. kctl_api-0.2.0/src/kctl_api/commands/doctor_cmd.py +286 -0
  25. kctl_api-0.2.0/src/kctl_api/commands/env.py +289 -0
  26. kctl_api-0.2.0/src/kctl_api/commands/files.py +250 -0
  27. kctl_api-0.2.0/src/kctl_api/commands/fmt_cmd.py +58 -0
  28. kctl_api-0.2.0/src/kctl_api/commands/health.py +479 -0
  29. kctl_api-0.2.0/src/kctl_api/commands/jobs.py +169 -0
  30. kctl_api-0.2.0/src/kctl_api/commands/lint_cmd.py +81 -0
  31. kctl_api-0.2.0/src/kctl_api/commands/logs.py +258 -0
  32. kctl_api-0.2.0/src/kctl_api/commands/marketplace.py +316 -0
  33. kctl_api-0.2.0/src/kctl_api/commands/monitor_cmd.py +243 -0
  34. kctl_api-0.2.0/src/kctl_api/commands/notifications.py +132 -0
  35. kctl_api-0.2.0/src/kctl_api/commands/odoo_proxy.py +182 -0
  36. kctl_api-0.2.0/src/kctl_api/commands/openapi.py +299 -0
  37. kctl_api-0.2.0/src/kctl_api/commands/perf.py +307 -0
  38. kctl_api-0.2.0/src/kctl_api/commands/rate_limit.py +223 -0
  39. kctl_api-0.2.0/src/kctl_api/commands/realtime.py +100 -0
  40. kctl_api-0.2.0/src/kctl_api/commands/redis_cmd.py +609 -0
  41. kctl_api-0.2.0/src/kctl_api/commands/routes_cmd.py +277 -0
  42. kctl_api-0.2.0/src/kctl_api/commands/saas.py +145 -0
  43. kctl_api-0.2.0/src/kctl_api/commands/scaffold.py +362 -0
  44. kctl_api-0.2.0/src/kctl_api/commands/security_cmd.py +350 -0
  45. kctl_api-0.2.0/src/kctl_api/commands/services.py +191 -0
  46. kctl_api-0.2.0/src/kctl_api/commands/shell.py +197 -0
  47. kctl_api-0.2.0/src/kctl_api/commands/skill_cmd.py +58 -0
  48. kctl_api-0.2.0/src/kctl_api/commands/streams.py +309 -0
  49. kctl_api-0.2.0/src/kctl_api/commands/stripe_cmd.py +105 -0
  50. kctl_api-0.2.0/src/kctl_api/commands/tenant_ai.py +169 -0
  51. kctl_api-0.2.0/src/kctl_api/commands/test_cmd.py +95 -0
  52. kctl_api-0.2.0/src/kctl_api/commands/users.py +302 -0
  53. kctl_api-0.2.0/src/kctl_api/commands/webhooks.py +56 -0
  54. kctl_api-0.2.0/src/kctl_api/commands/workflows.py +127 -0
  55. kctl_api-0.2.0/src/kctl_api/commands/ws.py +323 -0
  56. kctl_api-0.2.0/src/kctl_api/core/__init__.py +1 -0
  57. kctl_api-0.2.0/src/kctl_api/core/async_client.py +120 -0
  58. kctl_api-0.2.0/src/kctl_api/core/callbacks.py +88 -0
  59. kctl_api-0.2.0/src/kctl_api/core/client.py +190 -0
  60. kctl_api-0.2.0/src/kctl_api/core/config.py +260 -0
  61. kctl_api-0.2.0/src/kctl_api/core/db.py +65 -0
  62. kctl_api-0.2.0/src/kctl_api/core/exceptions.py +43 -0
  63. kctl_api-0.2.0/src/kctl_api/core/output.py +5 -0
  64. kctl_api-0.2.0/src/kctl_api/core/plugins.py +26 -0
  65. kctl_api-0.2.0/src/kctl_api/core/redis.py +35 -0
  66. kctl_api-0.2.0/src/kctl_api/core/resolve.py +47 -0
  67. kctl_api-0.2.0/src/kctl_api/core/utils.py +109 -0
  68. kctl_api-0.2.0/tests/__init__.py +0 -0
  69. kctl_api-0.2.0/tests/conftest.py +66 -0
  70. kctl_api-0.2.0/tests/test_auth.py +287 -0
  71. kctl_api-0.2.0/tests/test_cli.py +116 -0
  72. kctl_api-0.2.0/tests/test_config_cmd.py +380 -0
  73. kctl_api-0.2.0/tests/test_core.py +203 -0
  74. kctl_api-0.2.0/tests/test_deploy.py +129 -0
  75. kctl_api-0.2.0/tests/test_smoke.py +731 -0
  76. kctl_api-0.2.0/tests/test_users.py +357 -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
@@ -0,0 +1,34 @@
1
+ Metadata-Version: 2.4
2
+ Name: kctl-api
3
+ Version: 0.2.0
4
+ Summary: Kodemeio API CLI - manage your FastAPI platform
5
+ Author-email: Kodemeio <dev@kodeme.io>
6
+ License-Expression: MIT
7
+ Keywords: api,cli,fastapi,kodemeio,rest
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Environment :: Console
10
+ Classifier: Intended Audience :: System Administrators
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3.12
13
+ Classifier: Programming Language :: Python :: 3.13
14
+ Classifier: Topic :: System :: Systems Administration
15
+ Requires-Python: >=3.12
16
+ Requires-Dist: httpx>=0.28.0
17
+ Requires-Dist: kctl-lib>=0.4.0
18
+ Provides-Extra: all
19
+ Requires-Dist: asyncpg>=0.30.0; extra == 'all'
20
+ Requires-Dist: redis>=5.0.0; extra == 'all'
21
+ Requires-Dist: sqlalchemy[asyncio]>=2.0.0; extra == 'all'
22
+ Provides-Extra: db
23
+ Requires-Dist: asyncpg>=0.30.0; extra == 'db'
24
+ Requires-Dist: sqlalchemy[asyncio]>=2.0.0; extra == 'db'
25
+ Provides-Extra: dev
26
+ Requires-Dist: mypy>=1.14.0; extra == 'dev'
27
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
28
+ Requires-Dist: pytest-cov>=6.0.0; extra == 'dev'
29
+ Requires-Dist: pytest-httpx>=0.35.0; extra == 'dev'
30
+ Requires-Dist: pytest>=8.3.0; extra == 'dev'
31
+ Requires-Dist: ruff>=0.9.0; extra == 'dev'
32
+ Requires-Dist: types-pyyaml>=6.0.0; extra == 'dev'
33
+ Provides-Extra: redis
34
+ Requires-Dist: redis>=5.0.0; extra == 'redis'
@@ -0,0 +1,227 @@
1
+ # kctl-api
2
+
3
+ Kodemeio API CLI — manage your FastAPI platform.
4
+
5
+ 231 commands across 46 groups covering the full lifecycle: development, deployment,
6
+ observability, AI integration, multi-tenant SaaS, and API analysis.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ uv tool install .
12
+ ```
13
+
14
+ ## Quick Start
15
+
16
+ ```bash
17
+ kctl-api config init
18
+ kctl-api health
19
+ kctl-api dashboard
20
+ kctl-api routes list
21
+ ```
22
+
23
+ ## Global Options
24
+
25
+ These options are available on every command and must be passed before the subcommand.
26
+
27
+ | Option | Short | Default | Description |
28
+ |--------|-------|---------|-------------|
29
+ | `--json` | | false | Output as JSON |
30
+ | `--quiet` | `-q` | false | Suppress info messages |
31
+ | `--format` | `-f` | `pretty` | Output format: `pretty`, `json`, `csv`, `yaml` |
32
+ | `--no-header` | | false | Omit table headers (for scripting) |
33
+ | `--profile` | `-p` | | Config profile name |
34
+ | `--url` | | | API URL override |
35
+ | `--ai-url` | | | AI API URL override |
36
+ | `--api-key` | | | API key override |
37
+ | `--database-url` | | | Database URL override |
38
+ | `--redis-url` | | | Redis URL override |
39
+ | `--version` | `-V` | | Show version and exit |
40
+
41
+ Example: output JSON, suppress headers, use a non-default profile:
42
+
43
+ ```bash
44
+ kctl-api -p staging --json --no-header users list
45
+ ```
46
+
47
+ ## Command Groups
48
+
49
+ ### Authentication & Access
50
+
51
+ | Group | Description |
52
+ |-------|-------------|
53
+ | `config` | Profile and connection management (init, add, use, show, validate, remove, set, profiles, current) |
54
+ | `auth` | Authentication and token management |
55
+ | `health` | Health checks — endpoint reachability and latency |
56
+
57
+ ### API Resources
58
+
59
+ | Group | Description |
60
+ |-------|-------------|
61
+ | `users` | User management — list, get, create, update, deactivate |
62
+ | `files` | File and asset management |
63
+ | `jobs` | Background job management — queue, status, overview, cancel |
64
+ | `workflows` | Workflow orchestration |
65
+ | `automation` | Workflow automation rules |
66
+ | `notifications` | Notification management |
67
+ | `webhooks` | Webhook configuration |
68
+ | `marketplace` | Marketplace integrations |
69
+ | `saas` | Multi-tenant SaaS operations |
70
+ | `stripe` | Stripe billing integration |
71
+ | `odoo` | Odoo ERP proxy operations |
72
+ | `realtime` | Real-time event management |
73
+
74
+ ### AI Platform
75
+
76
+ | Group | Description |
77
+ |-------|-------------|
78
+ | `ai` | AI/ML model and inference management |
79
+ | `tenant-ai` | Per-tenant AI configuration and quotas |
80
+
81
+ ### Infrastructure
82
+
83
+ | Group | Description |
84
+ |-------|-------------|
85
+ | `db` | Database operations and migrations |
86
+ | `redis` | Redis cache operations |
87
+ | `streams` | Event stream management |
88
+ | `services` | Service management |
89
+ | `deploy` | Deployment management — apply, status, logs, rollback |
90
+ | `apps` | Application lifecycle management |
91
+ | `docker` | Docker container operations |
92
+
93
+ ### Development Tools
94
+
95
+ | Group | Description |
96
+ |-------|-------------|
97
+ | `dev` | Developer tools — up, down, rebuild, reload |
98
+ | `test` | Test runner |
99
+ | `lint` | Code linting |
100
+ | `fmt` | Code formatting |
101
+ | `build` | Build and compilation tasks |
102
+ | `scaffold` | Code generation |
103
+ | `shell` | Interactive REPL shell |
104
+
105
+ ### API Analysis & Testing
106
+
107
+ | Group | Description |
108
+ |-------|-------------|
109
+ | `openapi` | OpenAPI spec management — export, validate, diff |
110
+ | `routes` | API route inspection — list, describe, search |
111
+ | `rate-limit` | Rate limiting configuration |
112
+ | `ws` | WebSocket management |
113
+ | `perf` | Performance profiling and benchmarking |
114
+
115
+ ### Environment & Security
116
+
117
+ | Group | Description |
118
+ |-------|-------------|
119
+ | `doctor` | Diagnostic checks — connectivity, config, dependencies |
120
+ | `env` | Environment variable management |
121
+ | `security` | Security audit and configuration |
122
+ | `deps` | Dependency management |
123
+ | `clean` | Cleanup operations |
124
+
125
+ ### Observability & Monitoring
126
+
127
+ | Group | Description |
128
+ |-------|-------------|
129
+ | `logs` | Log streaming and filtering |
130
+ | `dashboard` | Platform overview and statistics |
131
+ | `monitor` | Monitoring and metrics |
132
+
133
+ ### Utility
134
+
135
+ | Group | Description |
136
+ |-------|-------------|
137
+ | `skill` | Auto-generate SKILL.md from CLI introspection |
138
+
139
+ ## Command Aliases
140
+
141
+ Hidden short aliases for frequent operations. All aliases forward global flags
142
+ (`--profile`, `--json`, `--format`, etc.) to the underlying command automatically.
143
+
144
+ | Alias | Expands to | Description |
145
+ |-------|-----------|-------------|
146
+ | `hc` | `health all` | Full health check |
147
+ | `dl [app]` | `deploy logs <app>` | Stream deploy logs (default: `api-main`) |
148
+ | `ds` | `deploy status` | Deployment status |
149
+ | `ul` | `users list` | List users |
150
+ | `fl` | `files list` | List files |
151
+ | `jo` | `jobs overview` | Jobs overview |
152
+ | `du` | `dev up` | Start dev stack |
153
+ | `dd` | `dev down` | Stop dev stack |
154
+ | `dr` | `dev rebuild` | Rebuild dev containers |
155
+ | `tr` | `test run all` | Run all tests |
156
+
157
+ Example:
158
+
159
+ ```bash
160
+ kctl-api -p staging hc # health all on staging profile
161
+ kctl-api dl api-worker # stream logs for api-worker app
162
+ kctl-api jo # jobs overview
163
+ ```
164
+
165
+ ## Shell Completions
166
+
167
+ Generate and install completions for your shell:
168
+
169
+ ```bash
170
+ # Zsh
171
+ kctl-api --install-completion zsh
172
+
173
+ # Bash
174
+ kctl-api --install-completion bash
175
+
176
+ # Fish
177
+ kctl-api --install-completion fish
178
+
179
+ # Print without installing (manual setup)
180
+ kctl-api --show-completion zsh
181
+ ```
182
+
183
+ After installing, restart your shell or source the completion file.
184
+
185
+ ## Configuration
186
+
187
+ Config lives at `~/.config/kodemeio/config.yaml` and is shared across all kctl-* CLIs.
188
+ The `api` service key scopes kctl-api settings.
189
+
190
+ ```bash
191
+ # Set up initial profile
192
+ kctl-api config init
193
+
194
+ # Add a second profile (e.g., staging)
195
+ kctl-api config add --profile staging
196
+
197
+ # Switch active profile
198
+ kctl-api config use staging
199
+
200
+ # Show current config (secrets masked)
201
+ kctl-api config show
202
+
203
+ # Validate profile connectivity
204
+ kctl-api config validate
205
+ ```
206
+
207
+ ## Architecture Note
208
+
209
+ kctl-api uses an async-capable HTTP client (`AsyncAPIClient` from `kctl-lib`) under the
210
+ hood. Long-running commands (log streaming, WebSocket tailing, performance profiling)
211
+ run on an asyncio event loop, while quick CRUD operations use the synchronous
212
+ `APIClient` path for simpler error propagation.
213
+
214
+ Command modules are registered lazily via `_register_commands()` at import time, so
215
+ `--help` and completions are available with minimal startup overhead even with 46
216
+ command groups loaded.
217
+
218
+ Plugins can extend kctl-api by exporting an entry point under the
219
+ `kctl_api.plugins` group — they are discovered and loaded automatically at startup.
220
+
221
+ ## Development
222
+
223
+ ```bash
224
+ uv run pytest tests/ -v
225
+ uv run ruff check src/
226
+ uv run mypy src/
227
+ ```
@@ -0,0 +1,85 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "kctl-api"
7
+ version = "0.2.0"
8
+ description = "Kodemeio API CLI - manage your FastAPI platform"
9
+ license = "MIT"
10
+ requires-python = ">=3.12"
11
+ authors = [{ name = "Kodemeio", email = "dev@kodeme.io" }]
12
+ keywords = ["fastapi", "api", "cli", "kodemeio", "rest"]
13
+ classifiers = [
14
+ "Development Status :: 3 - Alpha",
15
+ "Environment :: Console",
16
+ "Intended Audience :: System Administrators",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Topic :: System :: Systems Administration",
21
+ ]
22
+ dependencies = [
23
+ "kctl-lib>=0.4.0",
24
+ "httpx>=0.28.0",
25
+ ]
26
+
27
+ [project.optional-dependencies]
28
+ db = [
29
+ "sqlalchemy[asyncio]>=2.0.0",
30
+ "asyncpg>=0.30.0",
31
+ ]
32
+ redis = [
33
+ "redis>=5.0.0",
34
+ ]
35
+ all = [
36
+ "kctl-api[db,redis]",
37
+ ]
38
+ dev = [
39
+ "pytest>=8.3.0",
40
+ "pytest-httpx>=0.35.0",
41
+ "pytest-asyncio>=0.24.0",
42
+ "pytest-cov>=6.0.0",
43
+ "ruff>=0.9.0",
44
+ "mypy>=1.14.0",
45
+ "types-PyYAML>=6.0.0",
46
+ ]
47
+
48
+ [project.scripts]
49
+ kctl-api = "kctl_api.cli:_run"
50
+
51
+ [tool.uv.sources]
52
+ kctl-lib = { workspace = true }
53
+
54
+ [tool.hatch.build.targets.wheel]
55
+ packages = ["src/kctl_api"]
56
+
57
+ [tool.ruff]
58
+ target-version = "py312"
59
+ line-length = 120
60
+
61
+ [tool.ruff.lint]
62
+ select = ["E", "F", "I", "N", "W", "UP", "B", "SIM", "RUF"]
63
+
64
+ [tool.ruff.lint.isort]
65
+ known-first-party = ["kctl_api"]
66
+
67
+ [tool.mypy]
68
+ python_version = "3.12"
69
+ strict = true
70
+
71
+ [tool.pytest.ini_options]
72
+ testpaths = ["tests"]
73
+ asyncio_mode = "auto"
74
+ markers = [
75
+ "integration: tests that require a running API instance",
76
+ ]
77
+
78
+ [tool.coverage.run]
79
+ source = ["src/kctl_api"]
80
+ omit = ["*/commands/aliases.py"]
81
+
82
+
83
+ [tool.coverage.report]
84
+ show_missing = true
85
+ skip_empty = true