@computesdk/cmd
Advanced tools
+106
-1
@@ -33,2 +33,3 @@ "use strict"; | ||
| cmd: () => cmd, | ||
| compute: () => compute2, | ||
| cp: () => cp2, | ||
@@ -1036,2 +1037,102 @@ curl: () => curl2, | ||
| // src/commands/compute.ts | ||
| var compute_exports = {}; | ||
| __export(compute_exports, { | ||
| compute: () => compute, | ||
| health: () => health, | ||
| install: () => install, | ||
| isInstalled: () => isInstalled, | ||
| isSetup: () => isSetup, | ||
| setup: () => setup, | ||
| start: () => start, | ||
| stop: () => stop, | ||
| version: () => version | ||
| }); | ||
| var install = (options) => { | ||
| const installUrl = options?.version ? `https://computesdk.com/install.sh?version=${options.version}` : "https://computesdk.com/install.sh"; | ||
| const curlFlags = options?.silent ? "-fsSL" : "-fSL"; | ||
| let installCmd = `curl ${curlFlags} ${installUrl} | bash`; | ||
| if (options?.apiKey) { | ||
| installCmd = `COMPUTESDK_API_KEY="${options.apiKey}" ${installCmd}`; | ||
| } else if (typeof process !== "undefined" && process.env?.COMPUTESDK_API_KEY) { | ||
| installCmd = `COMPUTESDK_API_KEY="${process.env.COMPUTESDK_API_KEY}" ${installCmd}`; | ||
| } | ||
| return ["sh", "-c", installCmd]; | ||
| }; | ||
| var isInstalled = () => { | ||
| return ["sh", "-c", "which compute > /dev/null 2>&1"]; | ||
| }; | ||
| var version = () => { | ||
| return ["compute", "--version"]; | ||
| }; | ||
| var start = (options) => { | ||
| const args = ["compute", "start"]; | ||
| const apiKey = options?.apiKey || typeof process !== "undefined" && process.env?.COMPUTESDK_API_KEY; | ||
| const accessToken = options?.accessToken; | ||
| if (accessToken) { | ||
| args.push("--access-token", accessToken); | ||
| } else if (apiKey) { | ||
| args.push("--api-key", apiKey); | ||
| } | ||
| if (options?.port) { | ||
| args.push("--port", String(options.port)); | ||
| } | ||
| if (options?.logLevel === "debug") { | ||
| args.push("--verbose"); | ||
| } | ||
| return args; | ||
| }; | ||
| var stop = () => { | ||
| return ["pkill", "-f", "compute start"]; | ||
| }; | ||
| var health = (options) => { | ||
| const host = options?.host || "localhost"; | ||
| const port3 = options?.port || 18080; | ||
| return ["sh", "-c", `curl -f http://${host}:${port3}/health > /dev/null 2>&1`]; | ||
| }; | ||
| var isSetup = (options) => { | ||
| const host = options?.host || "localhost"; | ||
| const port3 = options?.port || 18080; | ||
| return ["sh", "-c", ` | ||
| if ! which compute > /dev/null 2>&1; then | ||
| exit 1 | ||
| fi | ||
| if ! curl -f http://${host}:${port3}/health > /dev/null 2>&1; then | ||
| exit 1 | ||
| fi | ||
| exit 0 | ||
| `.trim()]; | ||
| }; | ||
| var setup = (options) => { | ||
| const apiKey = options?.apiKey || typeof process !== "undefined" && process.env?.COMPUTESDK_API_KEY; | ||
| const accessToken = options?.accessToken; | ||
| const installUrl = options?.version ? `https://computesdk.com/install.sh?version=${options.version}` : "https://computesdk.com/install.sh"; | ||
| const curlFlags = options?.silent ? "-fsSL" : "-fSL"; | ||
| let installCmd = `curl ${curlFlags} ${installUrl} | bash`; | ||
| if (apiKey) { | ||
| installCmd = `COMPUTESDK_API_KEY="${apiKey}" ${installCmd}`; | ||
| } | ||
| let startCmd = "compute start"; | ||
| if (accessToken) { | ||
| startCmd += ` --access-token "${accessToken}"`; | ||
| } else if (apiKey) { | ||
| startCmd += ` --api-key "${apiKey}"`; | ||
| } | ||
| if (options?.port) { | ||
| startCmd += ` --port ${options.port}`; | ||
| } | ||
| const fullCmd = `${installCmd} && ${startCmd} > /dev/null 2>&1 &`; | ||
| return ["sh", "-c", fullCmd]; | ||
| }; | ||
| var compute = { | ||
| install, | ||
| isInstalled, | ||
| version, | ||
| start, | ||
| stop, | ||
| health, | ||
| setup, | ||
| isSetup | ||
| }; | ||
| // src/index.ts | ||
@@ -1059,3 +1160,5 @@ var cmd = Object.assign( | ||
| // System | ||
| ...system_exports | ||
| ...system_exports, | ||
| // Compute | ||
| ...compute_exports | ||
| } | ||
@@ -1107,2 +1210,3 @@ ); | ||
| } = system_exports; | ||
| var { compute: compute2 } = compute_exports; | ||
| var src_default = cmd; | ||
@@ -1121,2 +1225,3 @@ // Annotate the CommonJS export names for ESM import in node: | ||
| cmd, | ||
| compute, | ||
| cp, | ||
@@ -1123,0 +1228,0 @@ curl, |
+96
-6
@@ -113,2 +113,62 @@ /** | ||
| }) => Command) & { | ||
| install: (options?: { | ||
| apiKey?: string; | ||
| version?: string; | ||
| silent?: boolean; | ||
| }) => Command; | ||
| isInstalled: () => Command; | ||
| version: () => Command; | ||
| start: (options?: { | ||
| apiKey?: string; | ||
| accessToken?: string; | ||
| port?: number; | ||
| logLevel?: "debug" | "info" | "warn" | "error"; | ||
| }) => Command; | ||
| stop: () => Command; | ||
| health: (options?: { | ||
| host?: string; | ||
| port?: number; | ||
| }) => Command; | ||
| isSetup: (options?: { | ||
| host?: string; | ||
| port?: number; | ||
| }) => Command; | ||
| setup: (options?: { | ||
| apiKey?: string; | ||
| accessToken?: string; | ||
| port?: number; | ||
| version?: string; | ||
| silent?: boolean; | ||
| }) => Command; | ||
| compute: { | ||
| install: (options?: { | ||
| apiKey?: string; | ||
| version?: string; | ||
| silent?: boolean; | ||
| }) => Command; | ||
| isInstalled: () => Command; | ||
| version: () => Command; | ||
| start: (options?: { | ||
| apiKey?: string; | ||
| accessToken?: string; | ||
| port?: number; | ||
| logLevel?: "debug" | "info" | "warn" | "error"; | ||
| }) => Command; | ||
| stop: () => Command; | ||
| health: (options?: { | ||
| host?: string; | ||
| port?: number; | ||
| }) => Command; | ||
| setup: (options?: { | ||
| apiKey?: string; | ||
| accessToken?: string; | ||
| port?: number; | ||
| version?: string; | ||
| silent?: boolean; | ||
| }) => Command; | ||
| isSetup: (options?: { | ||
| host?: string; | ||
| port?: number; | ||
| }) => Command; | ||
| }; | ||
| echo: (text: string) => Command; | ||
@@ -126,8 +186,8 @@ env: () => Command; | ||
| }) => Command; | ||
| du: (path: string, options?: { | ||
| du: (path: string, // As command builders | ||
| options?: { | ||
| human?: boolean; | ||
| summarize?: boolean; | ||
| }) => Command; | ||
| sleep: (// Process | ||
| seconds: number) => Command; | ||
| sleep: (seconds: number) => Command; | ||
| date: (format?: string) => Command; | ||
@@ -387,4 +447,3 @@ find: (path: string, options?: { | ||
| }; | ||
| cp: (src: string, dest: string, // Export individual command builders for destructured imports | ||
| options?: { | ||
| cp: (src: string, dest: string, options?: { | ||
| recursive?: boolean; | ||
@@ -744,3 +803,34 @@ }) => Command; | ||
| }) => Command; | ||
| declare const compute: { | ||
| install: (options?: { | ||
| apiKey?: string; | ||
| version?: string; | ||
| silent?: boolean; | ||
| }) => Command; | ||
| isInstalled: () => Command; | ||
| version: () => Command; | ||
| start: (options?: { | ||
| apiKey?: string; | ||
| accessToken?: string; | ||
| port?: number; | ||
| logLevel?: "debug" | "info" | "warn" | "error"; | ||
| }) => Command; | ||
| stop: () => Command; | ||
| health: (options?: { | ||
| host?: string; | ||
| port?: number; | ||
| }) => Command; | ||
| setup: (options?: { | ||
| apiKey?: string; | ||
| accessToken?: string; | ||
| port?: number; | ||
| version?: string; | ||
| silent?: boolean; | ||
| }) => Command; | ||
| isSetup: (options?: { | ||
| host?: string; | ||
| port?: number; | ||
| }) => Command; | ||
| }; | ||
| export { type Command, type ShellOptions, awk, base64, bash, buildShellCommand, bun, bunx, cat, chmod, chown, cmd, cp, curl, cut, date, cmd as default, deno, df, diff, du, echo, env, esc, escapeArgs, find, git, grep, head, hostname, jq, kill, ln, ls, md5sum, mkdir, mv, net, node, npm, npx, parallel, pip, pipx, pkill, pnpm, poetry, port, printenv, ps, pwd, python, raw, readlink, rm, rsync, sed, sh, sha1sum, sha256sum, shell, shellEscape, sleep, sort, tail, tar, tee, test, timeout, touch, tr, uname, uniq, unzip, uv, wc, wget, which, whoami, xargs, yarn, zsh }; | ||
| export { type Command, type ShellOptions, awk, base64, bash, buildShellCommand, bun, bunx, cat, chmod, chown, cmd, compute, cp, curl, cut, date, cmd as default, deno, df, diff, du, echo, env, esc, escapeArgs, find, git, grep, head, hostname, jq, kill, ln, ls, md5sum, mkdir, mv, net, node, npm, npx, parallel, pip, pipx, pkill, pnpm, poetry, port, printenv, ps, pwd, python, raw, readlink, rm, rsync, sed, sh, sha1sum, sha256sum, shell, shellEscape, sleep, sort, tail, tar, tee, test, timeout, touch, tr, uname, uniq, unzip, uv, wc, wget, which, whoami, xargs, yarn, zsh }; |
+96
-6
@@ -113,2 +113,62 @@ /** | ||
| }) => Command) & { | ||
| install: (options?: { | ||
| apiKey?: string; | ||
| version?: string; | ||
| silent?: boolean; | ||
| }) => Command; | ||
| isInstalled: () => Command; | ||
| version: () => Command; | ||
| start: (options?: { | ||
| apiKey?: string; | ||
| accessToken?: string; | ||
| port?: number; | ||
| logLevel?: "debug" | "info" | "warn" | "error"; | ||
| }) => Command; | ||
| stop: () => Command; | ||
| health: (options?: { | ||
| host?: string; | ||
| port?: number; | ||
| }) => Command; | ||
| isSetup: (options?: { | ||
| host?: string; | ||
| port?: number; | ||
| }) => Command; | ||
| setup: (options?: { | ||
| apiKey?: string; | ||
| accessToken?: string; | ||
| port?: number; | ||
| version?: string; | ||
| silent?: boolean; | ||
| }) => Command; | ||
| compute: { | ||
| install: (options?: { | ||
| apiKey?: string; | ||
| version?: string; | ||
| silent?: boolean; | ||
| }) => Command; | ||
| isInstalled: () => Command; | ||
| version: () => Command; | ||
| start: (options?: { | ||
| apiKey?: string; | ||
| accessToken?: string; | ||
| port?: number; | ||
| logLevel?: "debug" | "info" | "warn" | "error"; | ||
| }) => Command; | ||
| stop: () => Command; | ||
| health: (options?: { | ||
| host?: string; | ||
| port?: number; | ||
| }) => Command; | ||
| setup: (options?: { | ||
| apiKey?: string; | ||
| accessToken?: string; | ||
| port?: number; | ||
| version?: string; | ||
| silent?: boolean; | ||
| }) => Command; | ||
| isSetup: (options?: { | ||
| host?: string; | ||
| port?: number; | ||
| }) => Command; | ||
| }; | ||
| echo: (text: string) => Command; | ||
@@ -126,8 +186,8 @@ env: () => Command; | ||
| }) => Command; | ||
| du: (path: string, options?: { | ||
| du: (path: string, // As command builders | ||
| options?: { | ||
| human?: boolean; | ||
| summarize?: boolean; | ||
| }) => Command; | ||
| sleep: (// Process | ||
| seconds: number) => Command; | ||
| sleep: (seconds: number) => Command; | ||
| date: (format?: string) => Command; | ||
@@ -387,4 +447,3 @@ find: (path: string, options?: { | ||
| }; | ||
| cp: (src: string, dest: string, // Export individual command builders for destructured imports | ||
| options?: { | ||
| cp: (src: string, dest: string, options?: { | ||
| recursive?: boolean; | ||
@@ -744,3 +803,34 @@ }) => Command; | ||
| }) => Command; | ||
| declare const compute: { | ||
| install: (options?: { | ||
| apiKey?: string; | ||
| version?: string; | ||
| silent?: boolean; | ||
| }) => Command; | ||
| isInstalled: () => Command; | ||
| version: () => Command; | ||
| start: (options?: { | ||
| apiKey?: string; | ||
| accessToken?: string; | ||
| port?: number; | ||
| logLevel?: "debug" | "info" | "warn" | "error"; | ||
| }) => Command; | ||
| stop: () => Command; | ||
| health: (options?: { | ||
| host?: string; | ||
| port?: number; | ||
| }) => Command; | ||
| setup: (options?: { | ||
| apiKey?: string; | ||
| accessToken?: string; | ||
| port?: number; | ||
| version?: string; | ||
| silent?: boolean; | ||
| }) => Command; | ||
| isSetup: (options?: { | ||
| host?: string; | ||
| port?: number; | ||
| }) => Command; | ||
| }; | ||
| export { type Command, type ShellOptions, awk, base64, bash, buildShellCommand, bun, bunx, cat, chmod, chown, cmd, cp, curl, cut, date, cmd as default, deno, df, diff, du, echo, env, esc, escapeArgs, find, git, grep, head, hostname, jq, kill, ln, ls, md5sum, mkdir, mv, net, node, npm, npx, parallel, pip, pipx, pkill, pnpm, poetry, port, printenv, ps, pwd, python, raw, readlink, rm, rsync, sed, sh, sha1sum, sha256sum, shell, shellEscape, sleep, sort, tail, tar, tee, test, timeout, touch, tr, uname, uniq, unzip, uv, wc, wget, which, whoami, xargs, yarn, zsh }; | ||
| export { type Command, type ShellOptions, awk, base64, bash, buildShellCommand, bun, bunx, cat, chmod, chown, cmd, compute, cp, curl, cut, date, cmd as default, deno, df, diff, du, echo, env, esc, escapeArgs, find, git, grep, head, hostname, jq, kill, ln, ls, md5sum, mkdir, mv, net, node, npm, npx, parallel, pip, pipx, pkill, pnpm, poetry, port, printenv, ps, pwd, python, raw, readlink, rm, rsync, sed, sh, sha1sum, sha256sum, shell, shellEscape, sleep, sort, tail, tar, tee, test, timeout, touch, tr, uname, uniq, unzip, uv, wc, wget, which, whoami, xargs, yarn, zsh }; |
+105
-1
@@ -936,2 +936,102 @@ var __defProp = Object.defineProperty; | ||
| // src/commands/compute.ts | ||
| var compute_exports = {}; | ||
| __export(compute_exports, { | ||
| compute: () => compute, | ||
| health: () => health, | ||
| install: () => install, | ||
| isInstalled: () => isInstalled, | ||
| isSetup: () => isSetup, | ||
| setup: () => setup, | ||
| start: () => start, | ||
| stop: () => stop, | ||
| version: () => version | ||
| }); | ||
| var install = (options) => { | ||
| const installUrl = options?.version ? `https://computesdk.com/install.sh?version=${options.version}` : "https://computesdk.com/install.sh"; | ||
| const curlFlags = options?.silent ? "-fsSL" : "-fSL"; | ||
| let installCmd = `curl ${curlFlags} ${installUrl} | bash`; | ||
| if (options?.apiKey) { | ||
| installCmd = `COMPUTESDK_API_KEY="${options.apiKey}" ${installCmd}`; | ||
| } else if (typeof process !== "undefined" && process.env?.COMPUTESDK_API_KEY) { | ||
| installCmd = `COMPUTESDK_API_KEY="${process.env.COMPUTESDK_API_KEY}" ${installCmd}`; | ||
| } | ||
| return ["sh", "-c", installCmd]; | ||
| }; | ||
| var isInstalled = () => { | ||
| return ["sh", "-c", "which compute > /dev/null 2>&1"]; | ||
| }; | ||
| var version = () => { | ||
| return ["compute", "--version"]; | ||
| }; | ||
| var start = (options) => { | ||
| const args = ["compute", "start"]; | ||
| const apiKey = options?.apiKey || typeof process !== "undefined" && process.env?.COMPUTESDK_API_KEY; | ||
| const accessToken = options?.accessToken; | ||
| if (accessToken) { | ||
| args.push("--access-token", accessToken); | ||
| } else if (apiKey) { | ||
| args.push("--api-key", apiKey); | ||
| } | ||
| if (options?.port) { | ||
| args.push("--port", String(options.port)); | ||
| } | ||
| if (options?.logLevel === "debug") { | ||
| args.push("--verbose"); | ||
| } | ||
| return args; | ||
| }; | ||
| var stop = () => { | ||
| return ["pkill", "-f", "compute start"]; | ||
| }; | ||
| var health = (options) => { | ||
| const host = options?.host || "localhost"; | ||
| const port3 = options?.port || 18080; | ||
| return ["sh", "-c", `curl -f http://${host}:${port3}/health > /dev/null 2>&1`]; | ||
| }; | ||
| var isSetup = (options) => { | ||
| const host = options?.host || "localhost"; | ||
| const port3 = options?.port || 18080; | ||
| return ["sh", "-c", ` | ||
| if ! which compute > /dev/null 2>&1; then | ||
| exit 1 | ||
| fi | ||
| if ! curl -f http://${host}:${port3}/health > /dev/null 2>&1; then | ||
| exit 1 | ||
| fi | ||
| exit 0 | ||
| `.trim()]; | ||
| }; | ||
| var setup = (options) => { | ||
| const apiKey = options?.apiKey || typeof process !== "undefined" && process.env?.COMPUTESDK_API_KEY; | ||
| const accessToken = options?.accessToken; | ||
| const installUrl = options?.version ? `https://computesdk.com/install.sh?version=${options.version}` : "https://computesdk.com/install.sh"; | ||
| const curlFlags = options?.silent ? "-fsSL" : "-fSL"; | ||
| let installCmd = `curl ${curlFlags} ${installUrl} | bash`; | ||
| if (apiKey) { | ||
| installCmd = `COMPUTESDK_API_KEY="${apiKey}" ${installCmd}`; | ||
| } | ||
| let startCmd = "compute start"; | ||
| if (accessToken) { | ||
| startCmd += ` --access-token "${accessToken}"`; | ||
| } else if (apiKey) { | ||
| startCmd += ` --api-key "${apiKey}"`; | ||
| } | ||
| if (options?.port) { | ||
| startCmd += ` --port ${options.port}`; | ||
| } | ||
| const fullCmd = `${installCmd} && ${startCmd} > /dev/null 2>&1 &`; | ||
| return ["sh", "-c", fullCmd]; | ||
| }; | ||
| var compute = { | ||
| install, | ||
| isInstalled, | ||
| version, | ||
| start, | ||
| stop, | ||
| health, | ||
| setup, | ||
| isSetup | ||
| }; | ||
| // src/index.ts | ||
@@ -959,3 +1059,5 @@ var cmd = Object.assign( | ||
| // System | ||
| ...system_exports | ||
| ...system_exports, | ||
| // Compute | ||
| ...compute_exports | ||
| } | ||
@@ -1007,2 +1109,3 @@ ); | ||
| } = system_exports; | ||
| var { compute: compute2 } = compute_exports; | ||
| var src_default = cmd; | ||
@@ -1020,2 +1123,3 @@ export { | ||
| cmd, | ||
| compute2 as compute, | ||
| cp2 as cp, | ||
@@ -1022,0 +1126,0 @@ curl2 as curl, |
+1
-1
| { | ||
| "name": "@computesdk/cmd", | ||
| "version": "0.2.0", | ||
| "version": "0.3.0", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Type-safe shell command builders for ComputeSDK sandboxes", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
275873
14.45%3285
9.94%9
800%