@edge/cli 0.0.0-stage → 0.0.16

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,3 +1,38 @@
1
- # Temporary Holding Version
1
+ # Edge Network CLI
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Deploy and manage cloud infrastructure on [Edge Network](https://edge.network) from your terminal: static sites, compute VMs, S3-compatible storage, DNS, Shield bot protection, Assist AI site answers, and Pulse uptime monitoring.
4
+
5
+ This package is a thin wrapper that downloads the native `edge` binary for your platform (macOS, Linux, Windows — x64 and arm64) from `cli.edge.network`. The binary version is pinned to the package version.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install -g @edge/cli
11
+ edge --version
12
+ ```
13
+
14
+ Or without npm:
15
+
16
+ ```bash
17
+ curl -fsSL https://edge.network/install.sh | sh
18
+ ```
19
+
20
+ ## Quick start
21
+
22
+ ```bash
23
+ edge auth login # authenticate with an API key
24
+ edge compute vm list # list your VMs
25
+ edge dns zone list # list your DNS zones
26
+ edge pulse list # list your Pulse uptime checks
27
+ ```
28
+
29
+ ## Documentation
30
+
31
+ - CLI docs: https://edge.network/docs/cli
32
+ - REST API: https://edge.network/docs/api
33
+ - Agent API & MCP: https://edge.network/docs/agent
34
+ - All developer resources: https://edge.network/developers
35
+
36
+ ## Support
37
+
38
+ support@edge.network
package/bin/edge.js ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Launcher for the native edge binary. If the postinstall download was
4
+ * skipped (--ignore-scripts, offline install), it fetches the binary on
5
+ * first run.
6
+ */
7
+
8
+ import { spawn } from 'node:child_process'
9
+ import { existsSync } from 'node:fs'
10
+ import { binaryPath, installBinary } from '../install.js'
11
+
12
+ async function main() {
13
+ let bin = binaryPath()
14
+ if (!existsSync(bin)) {
15
+ console.error('edge binary not present — downloading…')
16
+ bin = await installBinary()
17
+ }
18
+
19
+ const child = spawn(bin, process.argv.slice(2), { stdio: 'inherit' })
20
+ child.on('exit', (code, signal) => {
21
+ if (signal) process.kill(process.pid, signal)
22
+ else process.exit(code ?? 0)
23
+ })
24
+ }
25
+
26
+ main().catch((err) => {
27
+ console.error(err.message)
28
+ process.exit(1)
29
+ })
package/install.js ADDED
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Downloads the native edge binary for this platform from cli.edge.network.
3
+ *
4
+ * The binary version is pinned to this package's version, so
5
+ * `npm install @edge/cli@X.Y.Z` always yields CLI X.Y.Z. Runs as a
6
+ * postinstall hook; bin/edge.js also calls it lazily if the hook was skipped
7
+ * (e.g. --ignore-scripts).
8
+ */
9
+
10
+ import { createWriteStream } from 'node:fs'
11
+ import { chmod, mkdir, rename, readFile } from 'node:fs/promises'
12
+ import { pipeline } from 'node:stream/promises'
13
+ import { Readable } from 'node:stream'
14
+ import { fileURLToPath } from 'node:url'
15
+ import path from 'node:path'
16
+
17
+ const PKG_DIR = path.dirname(fileURLToPath(import.meta.url))
18
+
19
+ const OS_MAP = { darwin: 'darwin', linux: 'linux', win32: 'windows' }
20
+ const ARCH_MAP = { x64: 'amd64', arm64: 'arm64', arm: 'arm' }
21
+
22
+ export function binaryPath() {
23
+ const ext = process.platform === 'win32' ? '.exe' : ''
24
+ return path.join(PKG_DIR, 'vendor', `edge${ext}`)
25
+ }
26
+
27
+ export async function installBinary() {
28
+ const os = OS_MAP[process.platform]
29
+ const arch = ARCH_MAP[process.arch]
30
+ if (!os || !arch) {
31
+ throw new Error(
32
+ `Unsupported platform: ${process.platform}/${process.arch}. ` +
33
+ 'Supported: macOS (x64/arm64), Linux (x64/arm64/arm), Windows (x64/arm64). ' +
34
+ 'You can also install directly: curl -fsSL https://edge.network/install.sh | sh'
35
+ )
36
+ }
37
+
38
+ const { version } = JSON.parse(await readFile(path.join(PKG_DIR, 'package.json'), 'utf8'))
39
+ const ext = os === 'windows' ? '.exe' : ''
40
+ const url = `https://cli.edge.network/${version}/edge-${os}-${arch}${ext}`
41
+
42
+ const res = await fetch(url)
43
+ if (!res.ok || !res.body) {
44
+ throw new Error(`Failed to download ${url}: HTTP ${res.status}`)
45
+ }
46
+
47
+ const dest = binaryPath()
48
+ await mkdir(path.dirname(dest), { recursive: true })
49
+ // Download to a temp name then rename, so a failed download never leaves a
50
+ // truncated binary in place.
51
+ const tmp = `${dest}.download`
52
+ await pipeline(Readable.fromWeb(res.body), createWriteStream(tmp))
53
+ await chmod(tmp, 0o755)
54
+ await rename(tmp, dest)
55
+ return dest
56
+ }
57
+
58
+ // Run directly as the postinstall hook
59
+ if (process.argv[1] && path.resolve(process.argv[1]) === path.join(PKG_DIR, 'install.js')) {
60
+ installBinary()
61
+ .then((dest) => console.log(`edge CLI installed: ${dest}`))
62
+ .catch((err) => {
63
+ console.error(err.message)
64
+ process.exit(1)
65
+ })
66
+ }
package/package.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
2
  "name": "@edge/cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.16",
4
+ "description": "Edge Network CLI — deploy and manage cloud infrastructure (static sites, VMs, S3-compatible storage, DNS, Shield, Assist, Pulse) from your terminal. Thin npm wrapper that installs the native edge binary for your platform.",
5
+ "keywords": [
6
+ "edge-network",
7
+ "cli",
8
+ "cloud",
9
+ "deploy",
10
+ "cdn",
11
+ "dns",
12
+ "storage",
13
+ "compute",
14
+ "infrastructure"
15
+ ],
16
+ "homepage": "https://edge.network/docs/cli",
17
+ "bugs": {
18
+ "email": "support@edge.network"
19
+ },
20
+ "license": "MIT",
21
+ "type": "module",
22
+ "bin": {
23
+ "edge": "bin/edge.js"
24
+ },
25
+ "scripts": {
26
+ "postinstall": "node install.js"
27
+ },
28
+ "files": [
29
+ "bin",
30
+ "install.js",
31
+ "README.md"
32
+ ],
33
+ "engines": {
34
+ "node": ">=18"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public"
38
+ }
39
+ }