@sylphx/cli 0.3.2 → 0.5.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,238 @@
1
+ # @sylphx/cli
2
+
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`c4471cf`](https://github.com/SylphxAI/platform/commit/c4471cf729a2a60865d0df5bbf04b87f55d57858) Thanks [@shtse8](https://github.com/shtse8)! - OAuth device flow migrated from platform bypass to BaaS plane (RFC 8628). New `sylphx logout` command (BaaS-dogfooded), automatic OAuth refresh, and `sylphx.toml` manifest workflow (`pull` / `push` / `validate` / `diff` / versioning). New top-level commands: `regions`, `branch-db`, `scale`, `secrets`, `realtime`, `saml`, `ai`, `session-replay`, `search`, `engagement`, `consent`, `privacy`, `referrals`, `newsletter`. ESM-only build, bundled `@sylphx/management`, install-to-run install path fixed.
8
+
9
+ ## 0.4.1 (2026-04-24 — ADR-089 Phase 4c)
10
+
11
+ ### Added
12
+
13
+ - **`sylphx user`** — current-user self-service: `profile show|update`, `security`, `sessions list|revoke|purge`, `export` (GDPR), `delete` (GDPR erasure). Dogfoods `@sylphx/management.user.*`.
14
+ - **`sylphx users`** — platform-admin user directory: `list`, `get <userId>`, `set-role <userId> <role>`. Dogfoods `@sylphx/management.admin.*` user-search endpoints.
15
+ - **`sylphx admin`** — platform-admin ops grouped by surface: `quotas list|alerts|ack`, `audit logs`, `invitations list|create|revoke|resend`, `jwt-keys list|rotate|retire`, `project migrate`. Dogfoods `@sylphx/management.admin.*`.
16
+
17
+ ### Coverage
18
+
19
+ - `scripts/check-cli-coverage.ts` flipped from advisory to strict. 46/46 non-excluded `@sylphx/management` namespaces covered (100%); 9 namespaces excluded with per-entry rationale (`kv`, `authSettings`, `billingSettings`, `branchDatabases`, `envVars`, `github`, `management`, `refresh`, `serviceTokenRequests` — BaaS-plane / Console-only / internal-lifecycle). Kebab ↔ camelCase namespace normalisation matches the Phase 4b `check-paas-sdk-coverage.ts` pattern; an extended CLI-alias table covers non-trivial renames (e.g. `tokens` ↔ `serviceTokens`, `orgs` ↔ `organizations`, `session-replay` ↔ `sessionReplay`).
20
+ - Completes ADR-089 Phase 4 (S6 + S7 + S8 all strict): `check-baas-sdk-coverage` + `check-paas-sdk-coverage` + `check-cli-coverage` all block CI on regression.
21
+
22
+ ## 0.4.0 (wrongly labelled 1.0.0; reverted 2026-04-23 — still in beta)
23
+
24
+ ### Changes
25
+
26
+ - **Beta release (0.4.0).** The CLI's public surface is NOT yet frozen. 60 commands across auth, project lifecycle, deployment, managed primitives (db / storage / volumes / services / tasks / domains / functions / sandbox / runners), integrations (webhooks / flags / secrets / realtime / SAML / AI / session-replay / search / engagement / consent / privacy / referrals / newsletter / backup), billing (plan / billing / experiments / analytics), observability (monitoring / certs / email / notifications), and machine identity (tokens / OIDC / CI).
27
+ - **`@effect/cli` migration complete** (ADR-073 Strategy A). Every command is a pure `Effect` value assembled under one root; `BunRuntime.runMain` is the single `runPromise`-like call site (ADR-058 Rule 21 compliant). Tests swap the Layer and assert on the Exit channel without subprocessing — 351+ passing tests.
28
+ - **ESM-only**, Node ≥ 20 / Bun ≥ 1.3. Previous 0.x CJS output caused `Cannot find module './cjs/index.cjs'` crashes when Effect's package exports resolved to the wrong conditional branch; tsup now emits ESM exclusively.
29
+ - **Self-contained global install.** `@sylphx/management` and `@sylphx/contract` are bundled via tsup `noExternal` — `bun add -g @sylphx/cli` has zero workspace peers to resolve, and consumers never see Effect as a transitive runtime dep through `@sylphx/management`.
30
+ - **Correct `bin` wiring.** `bin.sylphx` points at `./dist/main.js`; the `#!/usr/bin/env bun` shebang is preserved by tsup. Global install + immediate run works with no post-install step.
31
+
32
+ ### OAuth + service tokens (ADR-059)
33
+
34
+ - **OAuth device flow** replaces legacy `slx_*` personal access tokens as the default login mode. Tokens are an atomic `{ accessToken, refreshToken, expiresAt }` triple stored at `~/.sylphx/config.json` with mode `0600`. The refresh interceptor transparently rotates the access token before expiry; a failed refresh prompts re-login.
35
+ - **Service tokens** (`sk_*`) via `SYLPHX_API_TOKEN=...` for CI / CD and server-side automation. Per-project scope with per-token revocation.
36
+ - **OIDC federation** (`sylphx oidc`) for passwordless CI — GitHub Actions / GitLab CI receive short-lived tokens via `id_token` exchange.
37
+
38
+ ### Plane discipline (ADR-083)
39
+
40
+ The CLI is **Management-plane-only**. There is no `sylphx kv get`, `sylphx email send`, or `sylphx flags evaluate` — runtime BaaS verbs live inside the deployed application via [`@sylphx/sdk`](https://www.npmjs.com/package/@sylphx/sdk). Attempting to use a `pk_*` / `sk_*` BaaS key against `api.sylphx.com/v1` returns `401 plane_mismatch`.
41
+
42
+ ### Contract-first types (ADR-084)
43
+
44
+ All wire types (request bodies, response envelopes, error shapes) derive from [`@sylphx/contract`](https://www.npmjs.com/package/@sylphx/contract). Hand-written type shims were removed; adding a new capability starts with a contract entry, not this package.
45
+
46
+ ### Version compatibility
47
+
48
+ | CLI | Management API | Contract |
49
+ | ------------------------ | ------------------- | ------------------------------------- |
50
+ | `@sylphx/cli@0.x` (beta) | `api.sylphx.com/v1` | `@sylphx/contract` (workspace / beta) |
51
+
52
+ ---
53
+
54
+ ## 0.3.3
55
+
56
+ ### Patch Changes
57
+
58
+ - Updated dependencies [[`b98b1c1`](https://github.com/SylphxAI/platform/commit/b98b1c1052b196bfa1440c4d7ed03c53ff549614)]:
59
+ - @sylphx/management@0.1.0
60
+
61
+ ## 0.3.2
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [[`a493b61`](https://github.com/SylphxAI/platform/commit/a493b61743ae6559a91ed056175304948ab6d43f)]:
66
+ - @sylphx/management@1.0.1
67
+
68
+ ## 0.3.1
69
+
70
+ ### Patch Changes
71
+
72
+ - [`1381a94`](https://github.com/SylphxAI/platform/commit/1381a94046043517841e9ed35f5d36afeb9c9cff) Thanks [@shtse8](https://github.com/shtse8)! - feat: extract Management SDK as standalone @sylphx/management package
73
+
74
+ - New package @sylphx/management@1.0.0 — full Management API client
75
+ - Resource-namespaced interface: mgmt.projects._, mgmt.deployments._, etc.
76
+ - CLI now depends on @sylphx/management (dogfooding)
77
+ - All types exported from @sylphx/management
78
+
79
+ - Updated dependencies [[`1381a94`](https://github.com/SylphxAI/platform/commit/1381a94046043517841e9ed35f5d36afeb9c9cff)]:
80
+ - @sylphx/management@1.0.0
81
+
82
+ ## 0.3.0
83
+
84
+ ### Minor Changes
85
+
86
+ - [`0e1c4a9`](https://github.com/SylphxAI/platform/commit/0e1c4a9d15ddab0068d4863b2423c6c7e79ec77c) Thanks [@shtse8](https://github.com/shtse8)! - feat: full API parity, bug fixes, new commands (v0.2.0)
87
+
88
+ **New commands:**
89
+
90
+ - `sylphx tasks` — manage task definitions (list/get/create/update/rm), supports job/cron/service modes
91
+ - `sylphx promote` — promote staging → production environment
92
+ - `sylphx config` — manage per-environment app config (list/get/set/delete)
93
+ - `sylphx storage` — manage object storage buckets
94
+ - `sylphx volumes` — manage persistent volumes
95
+ - `sylphx services` — list and deploy service blueprints
96
+ - `sylphx resources` — bind/unbind shared resources (databases, storage)
97
+
98
+ **Bug fixes:**
99
+
100
+ - `sylphx rollback` — was sending `{ envType }` but backend requires `{ envId | deploymentRecordId }`; now resolves correctly
101
+ - `sylphx env rm` — backend was missing DELETE endpoint; added to server
102
+ - `sylphx domains` — all domain commands were hitting `/domains/projects/...` (404); correct path is `/projects/.../domains/...`
103
+ - `sylphx db create` — tier options now include all 5 tiers: starter | standard | performance | enterprise1 | enterprise2
104
+ - Fixed 8 API response-shape mismatches (wrong wrapper fields causing silent empty results)
105
+
106
+ **Type generation:**
107
+
108
+ - `generate:types` URL fixed: was `sylphx.com/api/openapi.json` (404), now `docs.api.sylphx.com/v1/openapi.json`
109
+ - `generate:types:local` fixed: was `localhost:3002`, now `localhost:3003` (sylphx-sdk dev server)
110
+
111
+ ## 0.1.9
112
+
113
+ ### Patch Changes
114
+
115
+ - [`e611372`](https://github.com/SylphxAI/platform/commit/e611372008511be7c500622fd51a3cc5e629f4bf) Thanks [@shtse8](https://github.com/shtse8)! - fix(open): read URL from environments[] array instead of missing top-level field
116
+
117
+ fix(status): show URL from environments[] — was always blank
118
+
119
+ fix(db list): add missing DeploymentStatusEnv type; annotate environments field
120
+
121
+ ## 0.1.8
122
+
123
+ ### Patch Changes
124
+
125
+ - [`aecec9b`](https://github.com/SylphxAI/platform/commit/aecec9be811aa94664c5ff1e96f8404dd8b8a236) Thanks [@shtse8](https://github.com/shtse8)! - fix(cli): add envType/isActive/publicKey to Project.environments type
126
+
127
+ The server-side environments array includes envType (and more) which
128
+ is required for the projects list display. Fixes TypeScript error
129
+ TS2339 in projects.ts and link.ts.
130
+
131
+ ## 0.1.7
132
+
133
+ ### Patch Changes
134
+
135
+ - [`87134cd`](https://github.com/SylphxAI/platform/commit/87134cd2781e200ba939ce35bd660bc8c77c1b6b) Thanks [@shtse8](https://github.com/shtse8)! - fix(cli): proper fixes — domains direct API, resolveEnvId removed
136
+
137
+ - Domains API now uses `GET/POST/DELETE /domains/projects/{projectId}/domains?envType=`
138
+ — no extra API call to resolve envId first (was 2 roundtrips, now 1)
139
+ - `resolveEnvId` helper removed (no longer needed)
140
+ - `listDomains` now correctly reads `customDomains` from response shape
141
+ - `listDomains` + `addDomain` + `removeDomain` all updated to new route
142
+ - 5 tests updated + 2 new tests (74 total)
143
+
144
+ ## 0.1.6
145
+
146
+ ### Patch Changes
147
+
148
+ - [`6b79cd9`](https://github.com/SylphxAI/platform/commit/6b79cd956152bfb3387bab2aeab2edd9b21cff42) Thanks [@shtse8](https://github.com/shtse8)! - fix(logs): stream=true required, content field, formatLogEntry
149
+
150
+ - `createLogStream` now includes `stream=true` query param — without it the
151
+ backend returns JSON instead of SSE, causing EventSource to emit no events
152
+ and the CLI to silently timeout
153
+ - `stream` param renamed from legacy `tail` to `limit` (backend uses `limit`)
154
+ - `formatLogEntry` now reads `content` field from build-log chunk payloads
155
+ (backend sends `{ content, level, timestamp, sequence }`, not `message`)
156
+ - Added `logs.test.ts` (8 tests) covering formatLogEntry for all field variants
157
+ - Added 4 createLogStream URL tests in api.test.ts
158
+ - Total: 73 tests passing (was 61)
159
+
160
+ ## 0.1.5
161
+
162
+ ### Patch Changes
163
+
164
+ - [`2ea1157`](https://github.com/SylphxAI/platform/commit/2ea1157f178b4a8f7600fb3f9db1f26e0f2f9606) Thanks [@shtse8](https://github.com/shtse8)! - Fix remaining bugs found in 0.1.4 testing:
165
+
166
+ - **env list crash**: `listEnvVars()` now unwraps `{ data: [...] }` API response (same pattern as projects/databases)
167
+ - **projects list environments empty**: Use `e.name || e.envType` instead of `e.slug` (field doesn't exist in API response)
168
+
169
+ ## 0.1.4
170
+
171
+ ### Patch Changes
172
+
173
+ - [`28cb620`](https://github.com/SylphxAI/platform/commit/28cb620e701bb0eaaac0680428aacf4efc38369b) Thanks [@shtse8](https://github.com/shtse8)! - Fix B1-B6 bugs from 0.1.3 testing:
174
+
175
+ - **B1** (400 on status/deploy/env): Backend now accepts legacy `prefix_hex32` IDs alongside base58
176
+ - **B2** (logs Unauthorized): `eventsource@2` uses `http/https`, not `fetch` — pass auth via `headers` option
177
+ - **B3** (projects.map crash): Unwrap `{ object: 'list', data: [...] }` response from API
178
+ - **B4** (domains 410): Route moved to `/domains/projects/{envId}/domains` — resolve envId first
179
+ - **B5** (db 404): Databases now use unified Resources API at `/resources?kind=database`
180
+ - **B6** (version 0.1.0): Read version from package.json instead of hardcoding
181
+
182
+ ## 0.1.3
183
+
184
+ ### Patch Changes
185
+
186
+ - [`fbb8075`](https://github.com/SylphxAI/platform/commit/fbb80755b05048728c97cc0799dfd2636f8343ac) Thanks [@shtse8](https://github.com/shtse8)! - Fix `sylphx whoami` returning 404
187
+
188
+ CLI was calling `GET /v1/users/me` (plural) but backend mounts user routes
189
+ at `/user` (singular). Updated to call `GET /v1/user/me`.
190
+
191
+ Backend adds a new `GET /user/me` endpoint that returns `{ user, orgs }`
192
+ — the combined response the CLI expects for `sylphx whoami`.
193
+
194
+ ## 0.1.2
195
+
196
+ ### Patch Changes
197
+
198
+ - [`ac5e3a3`](https://github.com/SylphxAI/platform/commit/ac5e3a36771e11f288d15391c90d610a2366aeb6) Thanks [@shtse8](https://github.com/shtse8)! - Fix `sylphx logs` crash in Node.js
199
+
200
+ `eventsource@2` exports the class directly (`module.exports = EventSource`),
201
+ not as a named export. Destructuring `const { EventSource } = require("eventsource")`
202
+ returned `undefined`, causing `EventSource is not a constructor` at runtime.
203
+
204
+ Fix: `const EventSource = require("eventsource")` — the module IS the constructor.
205
+
206
+ ## 0.1.1
207
+
208
+ ### Patch Changes
209
+
210
+ - [`3aac758`](https://github.com/SylphxAI/platform/commit/3aac7582bd9b8e4a1a5c507bb4826330de267f40) Thanks [@shtse8](https://github.com/shtse8)! - Fix body-read crash on non-JSON API error responses
211
+
212
+ `api.ts` was calling `res.json()` and catching the error to fall back to `res.text()`,
213
+ but by that point the response body stream was already consumed, causing:
214
+ `Body is unusable: Body has already been read`
215
+
216
+ Fix: read body once with `res.text()`, then attempt `JSON.parse()`.
217
+
218
+ Also adds 45 regression tests covering all api methods, URL construction,
219
+ auth headers, error handling, and 204 No Content responses.
220
+
221
+ ## 0.1.0
222
+
223
+ ### Minor Changes
224
+
225
+ - Initial release of Sylphx CLI
226
+ - **`sylphx login`** — Authenticate with the Sylphx Platform (browser OAuth or `--token` for CI/CD)
227
+ - **`sylphx logout`** — Clear stored credentials
228
+ - **`sylphx whoami`** — Display current authenticated user and org
229
+ - **`sylphx link`** — Link current directory to a Sylphx app
230
+ - **`sylphx deploy`** — Deploy the linked app with real-time log streaming
231
+ - **`sylphx rollback`** — Roll back to a previous deployment
232
+ - **`sylphx logs`** — Stream live application logs
233
+ - **`sylphx status`** — Show deployment and health status
234
+ - **`sylphx env list`** — List environment variables
235
+ - **`sylphx env set`** — Set an environment variable
236
+ - **`sylphx env remove`** — Remove an environment variable
237
+ - **`sylphx domains list`** — List custom domains
238
+ - **`sylphx open`** — Open the app in the browser
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sylphx
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,136 +1,250 @@
1
1
  # @sylphx/cli
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@sylphx/cli.svg?style=flat)](https://www.npmjs.com/package/@sylphx/cli)
4
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue?logo=typescript)](https://www.typescriptlang.org/)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](./LICENSE)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue?logo=typescript)](https://www.typescriptlang.org/)
6
6
 
7
- The official CLI tool for the [Sylphx Platform](https://sylphx.com). Deploy, manage logs, environment variables, domains, and more — directly from your terminal.
7
+ The official CLI for the [Sylphx Platform](https://sylphx.com). Deploy and operate your applications — 60 commands across deployment, logs, env vars, domains, managed databases, object storage, monitoring, webhooks, feature flags, and more — directly from your terminal.
8
8
 
9
- 📖 **Full documentation:** [sylphx.com/docs/cli](https://sylphx.com/docs/cli)
9
+ Full documentation: [sylphx.com/docs/cli](https://sylphx.com/docs/cli)
10
10
 
11
11
  ## Installation
12
12
 
13
13
  ```bash
14
+ bun add -g @sylphx/cli
15
+ # or
14
16
  npm install -g @sylphx/cli
15
17
  # or
16
- bun add -g @sylphx/cli
18
+ pnpm add -g @sylphx/cli
17
19
  ```
18
20
 
19
- ## Quick Start
21
+ Requires **Node.js ≥ 20** (or Bun ≥ 1.3). The CLI binary is `sylphx`; the published package is a single self-contained ESM bundle (`@sylphx/management` and `@sylphx/contract` are bundled via tsup `noExternal`, so there are no workspace peers to resolve on global install).
22
+
23
+ ## Quick start
20
24
 
21
25
  ```bash
22
- # Authenticate
26
+ # Authenticate (opens the browser for OAuth device flow)
23
27
  sylphx login
24
28
 
25
- # Link your project to a Sylphx app
29
+ # Link the current project to a Sylphx app
26
30
  cd my-project
27
31
  sylphx link
28
32
 
29
- # Deploy!
33
+ # Ship it
30
34
  sylphx deploy
31
35
  ```
32
36
 
33
- ## Commands
34
-
35
- ### Authentication
37
+ ## Authentication
36
38
 
37
- ```bash
38
- sylphx login # Opens browser for OAuth flow
39
- sylphx login --token <TOKEN> # Direct token auth (CI/CD)
40
- sylphx logout # Clear stored credentials
41
- sylphx whoami # Show current user + org + app
42
- ```
39
+ The CLI supports two auth paths (ADR-059 + ADR-074):
43
40
 
44
- ### Project Management
41
+ | Mode | Use case | How |
42
+ |---|---|---|
43
+ | **OAuth device flow** (default) | Interactive dev | `sylphx login` — browser-backed device flow, 15-min access + 30-day refresh token stored at `~/.sylphx/config.json` (`0600`), auto-refresh built in |
44
+ | **`SYLPHX_TOKEN` env var** | CI / CD / agents | `export SYLPHX_TOKEN=svc_...` — no login step, no disk write, stateless. Service tokens (`svc_*`, ADR-089 §2.10) or short-lived OAuth access JWTs (`eyJ…`) both work |
45
45
 
46
- ```bash
47
- sylphx link # Link current directory to a Sylphx app
48
- sylphx status # Show deployment status
49
- sylphx open # Open app in browser
50
- ```
46
+ Legacy `slx_*` personal access tokens were eliminated 2026-04-21 (ADR-059 §1.4) and are no longer accepted by the API.
51
47
 
52
- ### Deployments
48
+ Under ADR-059, OAuth tokens are stored as an atomic `{ accessToken, refreshToken, expiresAt }` triple with mode `0600` on disk. The refresh interceptor (`utils/oauth-refresh.ts`) transparently rotates the access token when it's within the refresh window; a failed refresh prompts re-login.
53
49
 
54
50
  ```bash
55
- sylphx deploy # Deploy to default environment
56
- sylphx deploy --env staging # Deploy to staging
57
- sylphx rollback # Rollback to previous deployment
58
- sylphx rollback --env production # Rollback production
59
- ```
60
-
61
- ### Logs
51
+ # Interactive (developers)
52
+ sylphx login
53
+ sylphx whoami # "Auth: stored OAuth session (~/.sylphx/config.json)"
54
+ sylphx logout
62
55
 
63
- ```bash
64
- sylphx logs # Show recent logs
65
- sylphx logs -f # Follow logs (stream continuously)
66
- sylphx logs --env staging # Logs for staging environment
56
+ # Non-interactive (CI / agents)
57
+ export SYLPHX_TOKEN=svc_…
58
+ sylphx whoami # "Auth: SYLPHX_TOKEN env var"
59
+ sylphx deploy --env=production
67
60
  ```
68
61
 
69
- ### Environment Variables
62
+ ### Non-interactive use (CI / agents)
70
63
 
71
- ```bash
72
- sylphx env list # List all env vars
73
- sylphx env list --env staging # List staging env vars
74
- sylphx env set DATABASE_URL=postgres://...
75
- sylphx env set PORT=3000 --env staging
76
- sylphx env rm DATABASE_URL # Remove an env var
77
- ```
64
+ Set `SYLPHX_TOKEN` and every CLI command honours it as a Bearer token —
65
+ no `sylphx login`, no browser, no `~/.sylphx/config.json` write:
78
66
 
79
- ### Domains
67
+ - The env var **wins** over any stored OAuth session — useful when a
68
+ developer's machine doubles as a CI runner.
69
+ - The OAuth refresh interceptor is **skipped** when the env var is
70
+ active. Service tokens have no refresh token (rotate via `sylphx
71
+ tokens rotate` instead); JWTs supplied here are operator-rotated.
72
+ - Empty string (`SYLPHX_TOKEN=`) is treated as unset and falls back to
73
+ the stored session — defends against misconfigured CI shell exports.
74
+ - The same `SYLPHX_TOKEN` GitHub Actions output minted by `sylphx ci
75
+ github-actions` is the variable the CLI itself consumes. One contract,
76
+ no shell glue.
80
77
 
81
- ```bash
82
- sylphx domains list # List custom domains
83
- sylphx domains add example.com # Add a domain
84
- sylphx domains rm example.com # Remove a domain
78
+ GitHub Actions example:
79
+
80
+ ```yaml
81
+ - run: sylphx deploy --env=production
82
+ env:
83
+ SYLPHX_TOKEN: ${{ secrets.SYLPHX_TOKEN }}
85
84
  ```
86
85
 
87
86
  ## Configuration
88
87
 
89
- Config is stored in `~/.sylphx/config.json`:
88
+ Stored at `~/.sylphx/config.json`:
90
89
 
91
90
  ```json
92
91
  {
93
- "token": "slx_cli_...",
92
+ "oauth": {
93
+ "accessToken": "eyJ...",
94
+ "refreshToken": "ref_...",
95
+ "expiresAt": "2026-04-23T15:00:00.000Z"
96
+ },
94
97
  "defaultOrg": "my-org",
95
98
  "apps": {
96
- "/path/to/project": {
97
- "appId": "app-uuid",
98
- "orgId": "org-slug",
99
+ "/Users/me/projects/my-app": {
100
+ "appId": "proj_abc123",
101
+ "orgId": "org_xyz789",
99
102
  "defaultEnv": "production"
100
103
  }
101
104
  }
102
105
  }
103
106
  ```
104
107
 
105
- ## CI/CD Usage
108
+ Per-project overrides live in `./sylphx.json` (git-committable); the home config is a per-user fallback.
106
109
 
107
- For automated environments, use a pre-generated token:
110
+ ## Environment variables
108
111
 
109
- ```bash
110
- sylphx login --token $SYLPHX_API_TOKEN
111
- sylphx deploy --env production
112
- ```
112
+ | Variable | Description |
113
+ |---|---|
114
+ | `SYLPHX_TOKEN` | Bearer token for non-interactive auth (CI / agents). Accepts `svc_*` service tokens or `eyJ…` OAuth access JWTs. Wins over any stored OAuth session; refresh interceptor is skipped (stateless). Empty string is treated as unset. |
115
+ | `SYLPHX_API_URL` | Override API base URL (default: `https://sylphx.com`) |
113
116
 
114
- Or set the env var:
117
+ ## Commands (60)
115
118
 
116
- ```bash
117
- SYLPHX_API_TOKEN=slx_cli_... sylphx deploy
118
- ```
119
+ ### Authentication & identity
119
120
 
120
- ## Environment Variables
121
+ | Command | Purpose |
122
+ |---|---|
123
+ | `sylphx login` | OAuth device flow — browser-based, stores access + refresh tokens |
124
+ | `sylphx logout` | Clear stored credentials |
125
+ | `sylphx whoami` | Show current user + org + linked app |
121
126
 
122
- | Variable | Description |
127
+ ### Project lifecycle
128
+
129
+ | Command | Purpose |
123
130
  |---|---|
124
- | `SYLPHX_API_URL` | Override API base URL (default: `https://sylphx.com`) |
131
+ | `sylphx init` | Scaffold a new project |
132
+ | `sylphx link` | Link current directory to a Sylphx app |
133
+ | `sylphx unlink` | Remove the project link |
134
+ | `sylphx open` | Open the app in the browser |
135
+ | `sylphx projects` | List / manage projects |
136
+ | `sylphx orgs` | List / switch organizations |
137
+
138
+ ### Deployment
139
+
140
+ | Command | Purpose |
141
+ |---|---|
142
+ | `sylphx deploy` | Deploy the linked app |
143
+ | `sylphx deployments` | List / inspect deployments |
144
+ | `sylphx releases` | Manage release tags |
145
+ | `sylphx restart` | Restart running deployment |
146
+ | `sylphx inspect` | Inspect a deployment's build + run metadata |
147
+ | `sylphx bisect` | Git-bisect-style regression hunt across deployments |
148
+ | `sylphx promote` | Promote staging → production |
149
+ | `sylphx rollback` | Roll back to a previous deployment |
150
+ | `sylphx status` | Deployment + health status |
151
+ | `sylphx logs` | Tail application logs |
152
+ | `sylphx tail` | Alias for `logs -f` |
153
+ | `sylphx run` | Run a one-off command in the live environment |
154
+
155
+ ### Managed primitives
156
+
157
+ | Command | Purpose |
158
+ |---|---|
159
+ | `sylphx db` | Manage PostgreSQL databases (CNPG-backed) |
160
+ | `sylphx storage` | Manage object storage buckets (Ceph S3) |
161
+ | `sylphx volumes` | Manage persistent volumes (Rook-Ceph RWO/RWX) |
162
+ | `sylphx resources` | Bind / unbind shared resources |
163
+ | `sylphx services` | List + deploy service blueprints |
164
+ | `sylphx config` | Per-environment app config |
165
+ | `sylphx env` | Environment variables (`list` / `set` / `rm`) |
166
+ | `sylphx tasks` | Task definitions (job / cron / service) |
167
+ | `sylphx domains` | Custom domains + TLS |
168
+ | `sylphx functions` | Serverless function deploy / invoke / logs |
169
+ | `sylphx sandbox` | Interactive sandbox environments |
170
+ | `sylphx runners` | Self-hosted runner admin |
171
+
172
+ ### Integration primitives
173
+
174
+ | Command | Purpose |
175
+ |---|---|
176
+ | `sylphx backup` | Managed data backup + restore |
177
+ | `sylphx webhooks` | Outbound webhook endpoint CRUD |
178
+ | `sylphx flags` | Feature flag admin |
179
+ | `sylphx secrets` | Secret management (AES-256-GCM at rest) |
180
+ | `sylphx realtime` | Realtime channel admin |
181
+ | `sylphx saml` | SAML SSO configuration |
182
+ | `sylphx ai` | AI model / completion admin |
183
+ | `sylphx session-replay` | Session replay admin |
184
+ | `sylphx search` | Search index admin |
185
+ | `sylphx engagement` | Engagement campaign admin |
186
+ | `sylphx consent` | GDPR / CCPA consent admin |
187
+ | `sylphx privacy` | Privacy / data-subject-request admin |
188
+ | `sylphx referrals` | Referral program admin |
189
+ | `sylphx newsletter` | Newsletter admin |
190
+
191
+ ### Billing & scale
192
+
193
+ | Command | Purpose |
194
+ |---|---|
195
+ | `sylphx plan` | View / upgrade plan |
196
+ | `sylphx billing` | Invoices, payment methods |
197
+ | `sylphx experiments` | A/B experiment admin |
198
+ | `sylphx analytics` | Analytics admin queries |
199
+
200
+ ### Observability & integrations
201
+
202
+ | Command | Purpose |
203
+ |---|---|
204
+ | `sylphx monitoring` | Metric + alert admin |
205
+ | `sylphx certs` | TLS certificate inspection |
206
+ | `sylphx email` | Transactional email admin |
207
+ | `sylphx notifications` | Push / in-app notification admin |
208
+
209
+ ### Machine identity & policy
210
+
211
+ | Command | Purpose |
212
+ |---|---|
213
+ | `sylphx tokens` | Service token issuance + revocation |
214
+ | `sylphx oidc` | OIDC federation (GitHub Actions, GitLab CI, …) |
215
+ | `sylphx ci` | CI integration helpers (generates workflow snippets) |
216
+
217
+ ## Architecture
218
+
219
+ - Built on `@effect/cli` (ADR-073 Strategy A) — every command is an Effect value, tests can swap the Layer and assert on the Exit channel without subprocessing.
220
+ - `BunRuntime.runMain` is the single `runPromise`-like call site (ADR-058 Rule 21).
221
+ - Management plane only (ADR-083) — runtime BaaS verbs (`kv.*`, `email.send`, `flags.evaluate`, …) live inside the deployed application via [`@sylphx/sdk`](https://www.npmjs.com/package/@sylphx/sdk).
222
+ - Types derive from [`@sylphx/contract`](https://www.npmjs.com/package/@sylphx/contract) (Effect Schema SSOT, ADR-084). Hand-written wire types are a bug.
223
+ - HTTP client is `@sylphx/management` bundled in via `tsup noExternal` — global install has zero workspace peers to resolve.
224
+
225
+ ## Version compatibility
226
+
227
+ | CLI | Management API | Contract |
228
+ |---|---|---|
229
+ | `@sylphx/cli@0.x` (beta) | `api.sylphx.com/v1` | `@sylphx/contract` (workspace / beta) |
230
+
231
+ The Management API `/v1` surface is the stable HTTP target per ADR-077; the CLI and SDK packages themselves are still in pre-1.0 beta. The CLI auto-detects API version and degrades gracefully on newer fields.
125
232
 
126
233
  ## Development
127
234
 
128
235
  ```bash
129
236
  bun install
130
- bun run dev -- --help # Run CLI in dev mode
131
- bun run build # Build for production
237
+ bun run dev -- --help # Run CLI against workspace
238
+ bun run build # Build production bundle via tsup
239
+ bun test # Run test suite (bun test)
132
240
  ```
133
241
 
242
+ ## Related packages
243
+
244
+ - [`@sylphx/management`](https://www.npmjs.com/package/@sylphx/management) — Promise SDK the CLI is built on (bundled).
245
+ - [`@sylphx/contract`](https://www.npmjs.com/package/@sylphx/contract) — Effect Schema SSOT (bundled).
246
+ - [`@sylphx/sdk`](https://www.npmjs.com/package/@sylphx/sdk) — runtime BaaS SDK for deployed apps.
247
+
134
248
  ## License
135
249
 
136
- MIT © Sylphx
250
+ MIT see [LICENSE](./LICENSE).
package/dist/main.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env bun