@sylphx/cli 0.22.8 → 0.24.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/README.md CHANGED
@@ -1,60 +1,25 @@
1
- # `@sylphx/cli`
2
-
3
- **npm install channel for the Rust operator CLI** (`sylphx`).
4
-
5
- This package does **not** reimplement the CLI in TypeScript. It installs and
6
- executes the same native binary published as **`sylphx-cli`** on crates.io
7
- (ADR-3820 sole-wire dual-language product path).
8
-
9
- | Channel | Command | Product |
10
- | --- | --- | --- |
11
- | **npm** | `npm install -g @sylphx/cli` | Rust `sylphx` binary |
12
- | **crates.io** | `cargo install sylphx-cli` | same Rust `sylphx` binary |
13
-
14
- ## Install
15
-
16
- ```bash
17
- npm install -g @sylphx/cli
18
- # equivalent:
19
- cargo install sylphx-cli
20
- ```
21
-
22
- Ships a vendored native binary under `binaries/<os>-<arch>/` for supported hosts (linux-x64 first). Optional platform packages (`@sylphx/cli-linux-x64`,
23
- `@sylphx/cli-darwin-arm64`, …). If the optional native package is missing for
24
- your OS/arch, install falls back messaging to `cargo install sylphx-cli`.
25
-
26
- Override path (advanced):
27
-
28
- ```bash
29
- export SYLPHX_CLI_BINARY=/path/to/sylphx
1
+ # sylphx CLI
2
+
3
+ Every Sylphx API method as a command, generated from the one schema, plus a
4
+ small hand-written porcelain on the generated Rust SDK.
5
+
6
+ ```sh
7
+ curl -fsSL https://github.com/SylphxAI/sylphx-clients/releases/latest/download/install.sh | sh # or: npm i -g @sylphx/cli · cargo install sylphx-cli
8
+ sylphx login # stores an Access key (verified with whoami)
9
+ sylphx link --env orgs/…/envs/… # defaults for this directory (.sylphx/project.json)
10
+ sylphx data databases create main --spec.compute-units 2
11
+ sylphx data databases list -o json
12
+ sylphx mcp # the MCP server over stdio
30
13
  ```
31
14
 
32
- ## Agent operator commands (Rust binary)
33
-
34
- Full agent-operable surface (no Console). See `sylphx version-info --json`
35
- for the authoritative `shippedCommands` list including:
36
-
37
- deploy, rollback, status, env list|set|rm, logs, resources, db, storage,
38
- tasks, backup, flags, previews cost, projects create, plus day-1 health/whoami/…
39
-
40
- ```bash
41
- export SYLPHX_TOKEN=svc_...
42
- export SYLPHX_API_URL=https://api.sylphx.com/v1 # optional
43
- sylphx health --json
44
- sylphx projects list --json
45
- sylphx environments list prj_demo --json
46
- ```
47
-
48
- ## Versioning
49
-
50
- - **npm package** `@sylphx/cli` version (this package) follows the npm channel.
51
- - **Binary** `--version` reports the Rust crate `sylphx-cli` version (see
52
- `package.json#sylphx.crateVersion`).
53
-
54
- Wire SSOT: Protobuf under `api/proto` (`sylphx.platform.v1`). App library:
55
- `@sylphx/sdk` (TypeScript) / `sylphx-sdk` (Rust).
56
-
57
- ## Supported install platforms
58
-
59
- - **Published optional native packages:** linux-x64, linux-arm64, darwin-x64, darwin-arm64
60
- - **Windows:** not yet on the npm optional channel; use GitHub Releases when a Windows asset is published, or `cargo install sylphx-cli`
15
+ - `sylphx <service> <collection> <verb> [NAME|PARENT|ID] [--flags]`: flags
16
+ are the spec fields in dotted kebab-case (`--spec.compute-units`);
17
+ `--from-file` takes a whole request; `--output table|json|yaml|name`.
18
+ - A bare id (`main`) expands below the linked env; parents default to the
19
+ linked project, else the key's scope.
20
+ - Mutations wait for their Operation (`--no-wait` to skip); `--dry-run` sets
21
+ `validate_only`; updates send the etag they read and a mask of the flags
22
+ given; destructive calls ask first (`--yes` to skip).
23
+ - `sylphx api GET /v1/whoami` is the raw escape hatch.
24
+
25
+ `generated/commands.json` is `sylphx-gen` output; never edit it.
package/bin/resolve.js ADDED
@@ -0,0 +1,35 @@
1
+ // Resolves the native `sylphx` binary: SYLPHX_CLI_BINARY, else the platform
2
+ // package npm installed as an optional dependency (esbuild's pattern).
3
+
4
+ import { existsSync } from 'node:fs'
5
+ import { createRequire } from 'node:module'
6
+ import { dirname, join } from 'node:path'
7
+
8
+ const PLATFORMS = {
9
+ 'darwin arm64': '@sylphx/cli-darwin-arm64',
10
+ 'darwin x64': '@sylphx/cli-darwin-x64',
11
+ 'linux arm64': '@sylphx/cli-linux-arm64',
12
+ 'linux x64': '@sylphx/cli-linux-x64',
13
+ }
14
+
15
+ export function binaryPath() {
16
+ const override = process.env.SYLPHX_CLI_BINARY
17
+ if (override) return override
18
+ const pkg = PLATFORMS[`${process.platform} ${process.arch}`]
19
+ if (pkg === undefined) {
20
+ throw new Error(
21
+ `@sylphx/cli has no prebuilt binary for ${process.platform} ${process.arch}; ` +
22
+ 'build it with `cargo install sylphx-cli`, then set SYLPHX_CLI_BINARY.',
23
+ )
24
+ }
25
+ const require = createRequire(import.meta.url)
26
+ let root
27
+ try {
28
+ root = dirname(require.resolve(`${pkg}/package.json`))
29
+ } catch {
30
+ throw new Error(`${pkg} is not installed; reinstall @sylphx/cli without --no-optional.`)
31
+ }
32
+ const bin = join(root, 'bin', 'sylphx')
33
+ if (!existsSync(bin)) throw new Error(`${bin} is missing; reinstall ${pkg}.`)
34
+ return bin
35
+ }
package/bin/sylphx.js ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ // npm shim of the native `sylphx` binary: resolve it and run it.
3
+
4
+ import { spawn } from 'node:child_process'
5
+ import { binaryPath } from './resolve.js'
6
+
7
+ let bin
8
+ try {
9
+ bin = binaryPath()
10
+ } catch (error) {
11
+ console.error(error.message)
12
+ process.exit(1)
13
+ }
14
+ const child = spawn(bin, process.argv.slice(2), { stdio: 'inherit' })
15
+ child.on('error', (error) => {
16
+ console.error(`failed to run ${bin}: ${error.message}`)
17
+ process.exit(1)
18
+ })
19
+ child.on('exit', (code, signal) => {
20
+ if (signal) process.kill(process.pid, signal)
21
+ else process.exit(code ?? 1)
22
+ })
package/package.json CHANGED
@@ -1,64 +1,43 @@
1
1
  {
2
2
  "name": "@sylphx/cli",
3
- "version": "0.22.8",
4
- "description": "Sylphx Platform CLI \u2014 npm install channel for the Rust `sylphx` binary (same SSOT as crates.io sylphx-cli).",
3
+ "version": "0.24.0",
4
+ "description": "The Sylphx CLI: every Sylphx API method as a command. npm channel of the native sylphx binary.",
5
+ "license": "MIT",
5
6
  "type": "module",
6
- "homepage": "https://sylphx.com",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/SylphxAI/platform.git",
10
- "directory": "packages/cli"
11
- },
12
- "bugs": {
13
- "url": "https://github.com/SylphxAI/platform/issues"
9
+ "url": "git+https://github.com/SylphxAI/sylphx-clients.git",
10
+ "directory": "cli/npm/cli"
14
11
  },
15
- "author": "Sylphx",
16
- "license": "MIT",
12
+ "homepage": "https://sylphx.com/docs",
13
+ "keywords": [
14
+ "sylphx",
15
+ "cli",
16
+ "cloud",
17
+ "deploy"
18
+ ],
17
19
  "bin": {
18
- "sylphx": "bin/run.js"
20
+ "sylphx": "bin/sylphx.js"
21
+ },
22
+ "exports": {
23
+ "./resolve": "./bin/resolve.js"
19
24
  },
20
- "main": "lib/index.js",
21
25
  "files": [
22
26
  "bin",
23
- "binaries",
24
- "lib",
25
- "install.js",
26
- "README.md",
27
- "CHANGELOG.md",
28
- "LICENSE"
27
+ "README.md"
29
28
  ],
30
- "scripts": {
31
- "build": "node ./scripts/verify-package.js",
32
- "test": "node ./scripts/verify-package.js",
33
- "typecheck": "node ./scripts/verify-package.js",
34
- "prepack": "node ./scripts/verify-package.js",
35
- "postinstall": "node ./install.js"
36
- },
37
29
  "optionalDependencies": {
38
- "@sylphx/cli-linux-x64": "0.22.8",
39
- "@sylphx/cli-linux-arm64": "0.22.8",
40
- "@sylphx/cli-darwin-x64": "0.22.8",
41
- "@sylphx/cli-darwin-arm64": "0.22.8"
30
+ "@sylphx/cli-darwin-arm64": "0.24.0",
31
+ "@sylphx/cli-darwin-x64": "0.24.0",
32
+ "@sylphx/cli-linux-arm64": "0.24.0",
33
+ "@sylphx/cli-linux-x64": "0.24.0"
42
34
  },
43
35
  "engines": {
44
36
  "node": ">=18"
45
37
  },
46
- "keywords": [
47
- "sylphx",
48
- "cli",
49
- "paas",
50
- "deploy",
51
- "platform",
52
- "rust",
53
- "binary"
54
- ],
55
38
  "publishConfig": {
56
- "access": "public"
57
- },
58
- "sylphx": {
59
- "channel": "rust-native",
60
- "crate": "sylphx-cli",
61
- "crateVersion": "0.2.26",
62
- "binaryName": "sylphx"
39
+ "access": "public",
40
+ "tag": "next",
41
+ "provenance": true
63
42
  }
64
43
  }
package/CHANGELOG.md DELETED
@@ -1,44 +0,0 @@
1
- ## 0.22.8
2
-
3
- - Product binary `sylphx-cli` **0.2.26**: schedule commands use `GET|POST /v1/schedules` only.
4
- - Replaces leftover `0.22.7` / crate `0.2.25` adapters that still taught the retired work-schedule family path.
5
-
6
- ## 0.22.5
7
-
8
- - Product binary `sylphx-cli` **0.2.23** (includes `login` / `logout` / `update` / modern operator surface).
9
- - Unblocks public npm + curl installers stuck on pre-login 0.20.x / stale 0.22.4→0.2.7 channel lag behind crates.io.
10
- - `sylphx update` treats crates.io as product version authority when npm adapters lag.
11
-
12
- ## 0.22.4
13
-
14
- - Product binary `sylphx-cli` **0.2.7**: portable Linux prebuilds (Debian bookworm glibc 2.36 baseline).
15
- - Channel-native `sylphx update` (npm/brew/cargo/standalone).
16
- - Install script writes install-method marker for correct upgrades.
17
-
18
- ## 0.20.1
19
-
20
- - Vendor native `sylphx` binary inside `@sylphx/cli` under `binaries/<os>-<arch>/` so `npm install -g @sylphx/cli` works without depending on separate platform package registry propagation.
21
- - Platform optional packages remain secondary install path when available.
22
-
23
- # Changelog
24
-
25
- ## 0.20.0
26
-
27
- ### Breaking (product path)
28
-
29
- - Replaces the retired TypeScript Effect CLI with a **Rust native binary
30
- install channel**.
31
- - `npm install -g @sylphx/cli` now delivers the same `sylphx` binary as
32
- `cargo install sylphx-cli` (crates.io).
33
- - Platform packages: `@sylphx/cli-linux-x64` (and other os/cpu packages as
34
- published). Missing platform packages fail closed with cargo fallback text.
35
-
36
- ### Removed
37
-
38
- - TypeScript reimplementation (~60 historical commands) is no longer shipped
39
- via this package. Day-1 surface is the shipped Rust CLI cores (health,
40
- whoami, orgs, projects, environments, deployments, api, version-info).
41
-
42
- ## 0.19.x and earlier
43
-
44
- Historical TypeScript CLI releases. Retired under ADR-3820; do not use.
package/LICENSE DELETED
@@ -1,21 +0,0 @@
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/bin/run.js DELETED
@@ -1,39 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Thin npm bin shim for the Rust `sylphx` binary.
4
- * Does not reimplement CLI logic — only resolves and execs the native binary.
5
- */
6
-
7
- import { spawn } from 'node:child_process'
8
- import { getBinaryPath } from '../lib/get-binary.js'
9
-
10
- function main() {
11
- let binary
12
- try {
13
- binary = getBinaryPath()
14
- } catch (err) {
15
- console.error(err?.message ? err.message : String(err))
16
- process.exit(1)
17
- }
18
-
19
- const args = process.argv.slice(2)
20
- const child = spawn(binary, args, {
21
- stdio: 'inherit',
22
- windowsHide: true,
23
- })
24
-
25
- child.on('error', (err) => {
26
- console.error(`Failed to execute ${binary}: ${err.message}`)
27
- process.exit(1)
28
- })
29
-
30
- child.on('exit', (code, signal) => {
31
- if (signal) {
32
- process.kill(process.pid, signal)
33
- return
34
- }
35
- process.exit(code == null ? 1 : code)
36
- })
37
- }
38
-
39
- main()
Binary file
package/install.js DELETED
@@ -1,35 +0,0 @@
1
- /**
2
- * postinstall: soft-check that the platform optionalDependency landed.
3
- * Never hard-fails install on optional-missing (npm already soft-fails optionals);
4
- * prints a clear warning so operators see cargo fallback immediately.
5
- */
6
-
7
- import { getBinaryPath } from './lib/get-binary.js'
8
- import { platformKey, platformPackageName } from './lib/platform.js'
9
-
10
- function main() {
11
- // Skip in CI pack / offline contexts that set this intentionally
12
- if (process.env.SYLPHX_CLI_SKIP_POSTINSTALL === '1') {
13
- return
14
- }
15
-
16
- try {
17
- const bin = getBinaryPath()
18
- if (process.env.SYLPHX_CLI_INSTALL_VERBOSE === '1') {
19
- console.log(`@sylphx/cli: native binary ready at ${bin}`)
20
- }
21
- } catch {
22
- const pkg = platformPackageName() || '(unsupported platform)'
23
- console.warn(
24
- [
25
- '',
26
- `[@sylphx/cli] Native binary for ${platformKey()} not found after install.`,
27
- ` Expected optional package: ${pkg}`,
28
- ' Fallbacks: cargo install sylphx-cli | export SYLPHX_CLI_BINARY=/path/to/sylphx',
29
- '',
30
- ].join('\n'),
31
- )
32
- }
33
- }
34
-
35
- main()
package/lib/get-binary.js DELETED
@@ -1,109 +0,0 @@
1
- import fs from 'node:fs'
2
- import { createRequire } from 'node:module'
3
- import path from 'node:path'
4
- import { fileURLToPath } from 'node:url'
5
- import { knownPlatforms, normalizeArch, platformKey, platformPackageName } from './platform.js'
6
-
7
- /**
8
- * Resolve the absolute path to the native `sylphx` binary.
9
- * Fail closed with actionable install paths when missing.
10
- *
11
- * Resolution order:
12
- * 1. SYLPHX_CLI_BINARY env override (absolute path)
13
- * 2. optionalDependency platform package bin/sylphx(.exe)
14
- * (glibc-portable prebuilds from bookworm; preferred over host-vendored)
15
- * 3. Vendored binaries shipped inside this package (binaries/<os>-<arch>/sylphx)
16
- * 4. sibling packages/cli-<platform>/bin (workspace / local pack layout)
17
- */
18
-
19
- const require = createRequire(import.meta.url)
20
- const __dirname = path.dirname(fileURLToPath(import.meta.url))
21
-
22
- function binaryFileName() {
23
- return process.platform === 'win32' ? 'sylphx.exe' : 'sylphx'
24
- }
25
-
26
- function vendorDirName(platform = process.platform, arch = process.arch) {
27
- return `${platform}-${normalizeArch(arch)}`
28
- }
29
-
30
- function tryRequireResolve(pkgName) {
31
- try {
32
- return require.resolve(`${pkgName}/package.json`)
33
- } catch {
34
- return null
35
- }
36
- }
37
-
38
- function pathFromPackageRoot(pkgRoot) {
39
- const candidate = path.join(pkgRoot, 'bin', binaryFileName())
40
- if (fs.existsSync(candidate)) return candidate
41
- return null
42
- }
43
-
44
- function pathFromVendor() {
45
- const vendor = path.join(__dirname, '..', 'binaries', vendorDirName(), binaryFileName())
46
- if (fs.existsSync(vendor)) return vendor
47
- return null
48
- }
49
-
50
- function getBinaryPath() {
51
- if (process.env.SYLPHX_CLI_BINARY) {
52
- const override = path.resolve(process.env.SYLPHX_CLI_BINARY)
53
- if (!fs.existsSync(override)) {
54
- throw missingBinaryError(
55
- `SYLPHX_CLI_BINARY is set to ${override} but that file does not exist.`,
56
- )
57
- }
58
- return override
59
- }
60
-
61
- const pkgName = platformPackageName()
62
- if (!pkgName) {
63
- throw missingBinaryError(
64
- `Unsupported platform: ${platformKey()}. Supported: ${knownPlatforms().join(', ')}.`,
65
- )
66
- }
67
-
68
- const pkgJson = tryRequireResolve(pkgName)
69
- if (pkgJson) {
70
- const fromOptional = pathFromPackageRoot(path.dirname(pkgJson))
71
- if (fromOptional) return fromOptional
72
- }
73
-
74
- const nested = pathFromPackageRoot(
75
- path.resolve(__dirname, '..', 'node_modules', ...pkgName.split('/')),
76
- )
77
- if (nested) return nested
78
-
79
- const vendored = pathFromVendor()
80
- if (vendored) return vendored
81
-
82
- const localSibling = pathFromPackageRoot(
83
- path.resolve(__dirname, '..', '..', pkgName.replace('@sylphx/', '')),
84
- )
85
- if (localSibling) return localSibling
86
-
87
- throw missingBinaryError(
88
- `No platform package ${pkgName} and no vendored binary for ${platformKey()}.`,
89
- )
90
- }
91
-
92
- function missingBinaryError(detail) {
93
- const msg = [
94
- 'Sylphx CLI: native Rust binary not available via npm channel.',
95
- detail,
96
- '',
97
- 'Fix options:',
98
- ' 1) npm install -g @sylphx/cli@latest # reinstall npm channel',
99
- ' 2) cargo install sylphx-cli # crates.io SSOT (same binary product)',
100
- ' 3) export SYLPHX_CLI_BINARY=/path/to/sylphx',
101
- '',
102
- 'This package is an install channel for the Rust `sylphx` binary, not a TypeScript reimplementation.',
103
- ].join('\n')
104
- const err = new Error(msg)
105
- err.code = 'SYLPHX_CLI_BINARY_MISSING'
106
- return err
107
- }
108
-
109
- export { getBinaryPath, binaryFileName, vendorDirName, missingBinaryError }
package/lib/index.js DELETED
@@ -1,4 +0,0 @@
1
- import { binaryFileName, getBinaryPath } from './get-binary.js'
2
- import { knownPlatforms, platformKey, platformPackageName } from './platform.js'
3
-
4
- export { getBinaryPath, binaryFileName, platformPackageName, platformKey, knownPlatforms }
package/lib/platform.js DELETED
@@ -1,31 +0,0 @@
1
- /**
2
- * Map host (os, cpu) → optional platform package name.
3
- * Same pattern as esbuild / @swc / turbo: one meta package + optional native pkgs.
4
- */
5
-
6
- const PLATFORM_PACKAGES = {
7
- 'linux x64': '@sylphx/cli-linux-x64',
8
- 'linux arm64': '@sylphx/cli-linux-arm64',
9
- 'darwin x64': '@sylphx/cli-darwin-x64',
10
- 'darwin arm64': '@sylphx/cli-darwin-arm64',
11
- }
12
-
13
- function normalizeArch(arch) {
14
- if (arch === 'x64' || arch === 'amd64') return 'x64'
15
- if (arch === 'arm64' || arch === 'aarch64') return 'arm64'
16
- return arch
17
- }
18
-
19
- function platformKey(platform = process.platform, arch = process.arch) {
20
- return `${platform} ${normalizeArch(arch)}`
21
- }
22
-
23
- function platformPackageName(platform = process.platform, arch = process.arch) {
24
- return PLATFORM_PACKAGES[platformKey(platform, arch)] || null
25
- }
26
-
27
- function knownPlatforms() {
28
- return Object.keys(PLATFORM_PACKAGES)
29
- }
30
-
31
- export { PLATFORM_PACKAGES, platformKey, platformPackageName, knownPlatforms, normalizeArch }