Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@computesdk/cmd

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@computesdk/cmd - npm Package Compare versions

Comparing version
0.2.0
to
0.3.0
+106
-1
dist/index.cjs

@@ -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,

@@ -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 };

@@ -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 };

@@ -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