@sandbaseai/cli 0.1.14 → 0.3.6
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/LICENSE +200 -2
- package/README.de.md +143 -0
- package/README.es.md +146 -0
- package/README.fr.md +143 -0
- package/README.ja.md +209 -0
- package/README.ko.md +148 -0
- package/README.md +377 -6
- package/README.pt-BR.md +146 -0
- package/README.zh-CN.md +295 -0
- package/assets/mcp-bridge.mjs +142 -19
- package/dist/a1-adapters.d.ts +1 -0
- package/dist/a1-adapters.js +12 -2
- package/dist/adapters/index.js +3 -1
- package/dist/agent/client.d.ts +79 -0
- package/dist/agent/client.js +274 -0
- package/dist/agent/commands.d.ts +28 -0
- package/dist/agent/commands.js +627 -0
- package/dist/agent/probe.d.ts +6 -0
- package/dist/agent/probe.js +25 -0
- package/dist/agent/update.d.ts +5 -0
- package/dist/agent/update.js +64 -0
- package/dist/cli.js +78 -46
- package/dist/commands.d.ts +6 -0
- package/dist/commands.js +82 -6
- package/dist/skills.js +2 -2
- package/llms-install.md +76 -0
- package/package.json +30 -5
- package/skills/sandbase/SKILL.md +263 -0
- package/skills/sandbase/skill.json +19 -0
- package/assets/skills/sandbase/SKILL.md +0 -201
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Real connectivity check used by `sandbase doctor` and `sandbase setup`:
|
|
2
|
+
// initialize → tools/list → sandbase_account (free) against the API endpoint.
|
|
3
|
+
// Local file checks alone cannot tell "configured" from "configured but
|
|
4
|
+
// unreachable", which is the failure agents actually hit.
|
|
5
|
+
import { SandBaseError, SandBaseMCPClient, validMcpUrl, DEFAULT_MCP_URL } from "./client.js";
|
|
6
|
+
import { cliVersion } from "./update.js";
|
|
7
|
+
export async function probeEndpoint(label, credential, mcpUrl, env = process.env, fetchImpl, timeoutMs = 15_000) {
|
|
8
|
+
const url = validMcpUrl(mcpUrl) || DEFAULT_MCP_URL;
|
|
9
|
+
const client = new SandBaseMCPClient({ credential, url, source: label }, fetchImpl, timeoutMs, env);
|
|
10
|
+
const started = Date.now();
|
|
11
|
+
try {
|
|
12
|
+
await client.rpc("initialize", { protocolVersion: "2025-06-18", capabilities: {}, clientInfo: { name: "sandbase-doctor", version: cliVersion() } });
|
|
13
|
+
const listed = await client.rpc("tools/list", {});
|
|
14
|
+
const account = await client.tool("sandbase_account", {});
|
|
15
|
+
const host = new URL(url).host;
|
|
16
|
+
const tools = Array.isArray(listed?.tools) ? listed.tools.length : 0;
|
|
17
|
+
const balance = account.data.balance === undefined ? "unknown" : `$${String(account.data.balance)}`;
|
|
18
|
+
const low = Number(account.data.balance) <= 0 ? ", next_step=Balance is empty; top up before running paid tools." : "";
|
|
19
|
+
return { ok: tools > 0, line: `${label}: network=ok, endpoint=${host}, latency=${Date.now() - started}ms, tools=${tools}, balance=${balance}${low}` };
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
const failure = error instanceof SandBaseError ? error : new SandBaseError("NETWORK", error instanceof Error ? error.message : "unknown failure");
|
|
23
|
+
return { ok: false, line: `${label}: network=failed, code=${failure.code}, reason=${failure.message}${failure.hint ? `, next_step=${failure.hint}` : ""}` };
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const SKILL_URL = "https://www.sandbase.ai/skill.md";
|
|
2
|
+
export declare function cliVersion(): string;
|
|
3
|
+
export declare function compareVersions(a: string, b: string): number;
|
|
4
|
+
/** Starts (at most daily) a background registry check; resolves to an update notice or undefined. Never throws. */
|
|
5
|
+
export declare function updateNotice(env?: NodeJS.ProcessEnv, fetchImpl?: typeof fetch, now?: number): Promise<string | undefined>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Once-a-day npm version check. The notice is printed to stderr in text mode and
|
|
2
|
+
// appended to `notes` in JSON mode, because agents that parse JSON never read
|
|
3
|
+
// stderr — and the notice is what tells them to refresh the Skill too.
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
5
|
+
import { readFile } from "node:fs/promises";
|
|
6
|
+
import { join } from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { atomicWrite } from "../fs-safe.js";
|
|
9
|
+
import { sandbaseHome } from "../paths.js";
|
|
10
|
+
export const SKILL_URL = "https://www.sandbase.ai/skill.md";
|
|
11
|
+
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
12
|
+
export function cliVersion() {
|
|
13
|
+
for (const relative of ["../../package.json", "../../../package.json"]) {
|
|
14
|
+
try {
|
|
15
|
+
const value = JSON.parse(readFileSync(fileURLToPath(new URL(relative, import.meta.url)), "utf8"));
|
|
16
|
+
if (value.name === "@sandbaseai/cli" && value.version)
|
|
17
|
+
return value.version;
|
|
18
|
+
}
|
|
19
|
+
catch { /* try the next layout */ }
|
|
20
|
+
}
|
|
21
|
+
return "0.0.0";
|
|
22
|
+
}
|
|
23
|
+
export function compareVersions(a, b) {
|
|
24
|
+
const parse = (value) => value.replace(/^v/, "").split("-")[0].split(".").map(part => Number.parseInt(part, 10) || 0);
|
|
25
|
+
const left = parse(a), right = parse(b);
|
|
26
|
+
for (let i = 0; i < Math.max(left.length, right.length); i++) {
|
|
27
|
+
const diff = (left[i] || 0) - (right[i] || 0);
|
|
28
|
+
if (diff)
|
|
29
|
+
return Math.sign(diff);
|
|
30
|
+
}
|
|
31
|
+
return 0;
|
|
32
|
+
}
|
|
33
|
+
function cachePath(env) { return join(sandbaseHome(env), "update-check.json"); }
|
|
34
|
+
function disabled(env) { return env.SANDBASE_NO_UPDATE_CHECK === "1" || env.CI === "true" || env.NODE_ENV === "test"; }
|
|
35
|
+
/** Starts (at most daily) a background registry check; resolves to an update notice or undefined. Never throws. */
|
|
36
|
+
export async function updateNotice(env = process.env, fetchImpl = globalThis.fetch, now = Date.now()) {
|
|
37
|
+
if (disabled(env))
|
|
38
|
+
return undefined;
|
|
39
|
+
const current = cliVersion();
|
|
40
|
+
let cache;
|
|
41
|
+
try {
|
|
42
|
+
cache = JSON.parse(await readFile(cachePath(env), "utf8"));
|
|
43
|
+
}
|
|
44
|
+
catch { /* first run */ }
|
|
45
|
+
let latest = cache?.latest;
|
|
46
|
+
if (!cache || now - cache.checkedAt > DAY_MS) {
|
|
47
|
+
try {
|
|
48
|
+
const response = await fetchImpl("https://registry.npmjs.org/@sandbaseai/cli/latest", { signal: AbortSignal.timeout(2000) });
|
|
49
|
+
if (response.ok) {
|
|
50
|
+
const value = await response.json();
|
|
51
|
+
if (typeof value.version === "string")
|
|
52
|
+
latest = value.version;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch { /* offline: keep the cached answer */ }
|
|
56
|
+
try {
|
|
57
|
+
await atomicWrite(cachePath(env), JSON.stringify({ checkedAt: now, ...(latest ? { latest } : {}) }) + "\n", 0o600);
|
|
58
|
+
}
|
|
59
|
+
catch { /* read-only home */ }
|
|
60
|
+
}
|
|
61
|
+
if (!latest || compareVersions(latest, current) <= 0)
|
|
62
|
+
return undefined;
|
|
63
|
+
return `Update available: @sandbaseai/cli ${current} → ${latest}. Run \`npx -y @sandbaseai/cli@latest setup\` (or \`npm install -g @sandbaseai/cli@latest && sandbase setup\`) to update the CLI, the local MCP bridge, and the SandBase Skill. Latest Skill: ${SKILL_URL}`;
|
|
64
|
+
}
|
package/dist/cli.js
CHANGED
|
@@ -1,63 +1,95 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { connect, doctor, unregister } from "./commands.js";
|
|
2
|
+
import { connect, doctor, setup, unregister } from "./commands.js";
|
|
3
3
|
import { clientList } from "./clients.js";
|
|
4
4
|
import { bridgeClients, isBridgeClient, isClient } from "./types.js";
|
|
5
5
|
import { stableCatalog } from "./catalog.js";
|
|
6
|
+
import { agentUsage, isAgentCommand, runAgentCommand } from "./agent/commands.js";
|
|
7
|
+
import { cliVersion } from "./agent/update.js";
|
|
6
8
|
if (Number(process.versions.node.split(".")[0]) < 20) {
|
|
7
9
|
console.error("SandBase CLI requires Node.js 20 or newer. Upgrade Node.js and retry.");
|
|
8
10
|
process.exit(1);
|
|
9
11
|
}
|
|
10
12
|
const [command, ...args] = process.argv.slice(2);
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
const usage = `Usage:
|
|
14
|
+
sandbase connect [--client <client>|auto] Sign in once in the browser and configure your AI clients
|
|
15
|
+
sandbase setup Refresh the local MCP bridge and SandBase Skill after an update, then test connectivity
|
|
16
|
+
sandbase doctor [--client <client>] Check local configuration and make one real round trip to SandBase
|
|
17
|
+
sandbase unregister [--client <client>] Remove SandBase-managed local state
|
|
18
|
+
sandbase --version
|
|
19
|
+
|
|
20
|
+
${agentUsage}
|
|
21
|
+
|
|
22
|
+
Clients: ${clientList()}`;
|
|
23
|
+
if (command === "--version" || command === "-v" || command === "version") {
|
|
24
|
+
console.log(cliVersion());
|
|
25
|
+
process.exit(0);
|
|
20
26
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
process.exit(2);
|
|
25
|
-
}
|
|
27
|
+
if (!command || command === "--help" || command === "-h" || command === "help") {
|
|
28
|
+
console.log(usage);
|
|
29
|
+
process.exit(command ? 0 : 2);
|
|
26
30
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
process.exit(2);
|
|
31
|
+
if (isAgentCommand(command)) {
|
|
32
|
+
process.exitCode = await runAgentCommand(command, args);
|
|
30
33
|
}
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
else {
|
|
35
|
+
const at = args.indexOf("--client");
|
|
36
|
+
const value = at >= 0 ? args[at + 1] : undefined;
|
|
37
|
+
const client = value === undefined || value === "auto" ? "auto" : isClient(value) ? value : undefined;
|
|
38
|
+
const bridgeClient = value !== undefined && isBridgeClient(value) ? value : undefined;
|
|
39
|
+
if (command === "catalog") {
|
|
40
|
+
if (args.length !== 1 || args[0] !== "--json") {
|
|
41
|
+
console.error("Usage: sandbase catalog --json");
|
|
42
|
+
process.exit(2);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
39
45
|
else if (command === "mcp-bridge") {
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
if (!bridgeClient || at !== 0 || args.length !== 2) {
|
|
47
|
+
console.error(`Usage: sandbase mcp-bridge --client <${bridgeClients.join("|")}>`);
|
|
48
|
+
process.exit(2);
|
|
49
|
+
}
|
|
42
50
|
}
|
|
43
|
-
else if (command === "
|
|
44
|
-
|
|
45
|
-
else if (command === "doctor") {
|
|
46
|
-
if (!(await doctor(client)))
|
|
47
|
-
process.exitCode = 1;
|
|
51
|
+
else if (command === "setup") {
|
|
52
|
+
// --client/--email are accepted for parity with agent setup instructions; the CLI never asks for them.
|
|
48
53
|
}
|
|
49
|
-
else
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
else
|
|
57
|
-
console.error(message.replace(/(?:sk|cln)-[A-Za-z0-9_-]+/g, "[REDACTED]"));
|
|
58
|
-
process.exitCode = 1;
|
|
59
|
-
}
|
|
60
|
-
finally {
|
|
54
|
+
else if (!client || !["connect", "doctor", "unregister"].includes(command) || (at >= 0 && !value)) {
|
|
55
|
+
console.error(`Usage: sandbase <connect|doctor|unregister> [--client <${clientList()}|auto>]\nRun \`sandbase --help\` for agent commands (discover, inspect, run, runs, balance, keys).`);
|
|
56
|
+
process.exit(2);
|
|
57
|
+
}
|
|
58
|
+
const controller = new AbortController();
|
|
59
|
+
const signals = ["SIGINT", "SIGTERM"];
|
|
60
|
+
const abort = () => controller.abort();
|
|
61
61
|
for (const signal of signals)
|
|
62
|
-
process.
|
|
62
|
+
process.once(signal, abort);
|
|
63
|
+
try {
|
|
64
|
+
if (command === "catalog")
|
|
65
|
+
process.stdout.write(stableCatalog());
|
|
66
|
+
else if (command === "mcp-bridge") {
|
|
67
|
+
const runtime = await import(new URL("../assets/mcp-bridge.mjs", import.meta.url).href);
|
|
68
|
+
await runtime.runMCPBridge({ client: bridgeClient, signal: controller.signal });
|
|
69
|
+
}
|
|
70
|
+
else if (command === "setup") {
|
|
71
|
+
if (!(await setup()))
|
|
72
|
+
process.exitCode = 1;
|
|
73
|
+
}
|
|
74
|
+
else if (command === "connect")
|
|
75
|
+
await connect(client, { signal: controller.signal });
|
|
76
|
+
else if (command === "doctor") {
|
|
77
|
+
if (!(await doctor(client)))
|
|
78
|
+
process.exitCode = 1;
|
|
79
|
+
}
|
|
80
|
+
else
|
|
81
|
+
await unregister(client);
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
const message = e instanceof Error ? e.message : "Unknown failure";
|
|
85
|
+
if (message.includes("fetch failed"))
|
|
86
|
+
console.error("Authorization response may have been lost. Check SandBase Dashboard for a newly created CLI credential, revoke it if present, then retry.");
|
|
87
|
+
else
|
|
88
|
+
console.error(message.replace(/(?:sk|cln)-[A-Za-z0-9_-]+/g, "[REDACTED]"));
|
|
89
|
+
process.exitCode = 1;
|
|
90
|
+
}
|
|
91
|
+
finally {
|
|
92
|
+
for (const signal of signals)
|
|
93
|
+
process.removeListener(signal, abort);
|
|
94
|
+
}
|
|
63
95
|
}
|
package/dist/commands.d.ts
CHANGED
|
@@ -27,5 +27,11 @@ export interface CommandDependencies {
|
|
|
27
27
|
export declare function openBrowser(url: string): Promise<void>;
|
|
28
28
|
export declare function connect(client?: ConnectClient, deps?: CommandDependencies): Promise<void>;
|
|
29
29
|
export declare function doctor(client?: ConnectClient, store?: CredentialStore, detect?: (client: Client) => Detection, skillsRunner?: SkillsCommandRunner, skillsReadbackVerifier?: SkillsReadbackVerifier, openClawRunner?: OpenClawCommandRunner, openClawReadbackVerifier?: OpenClawReadbackVerifier, a1Runner?: A1CommandRunner, bRunner?: BCommandRunner, cRunner?: CCommandRunner): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* `sandbase setup`: refresh everything a newer CLI ships without a new browser
|
|
32
|
+
* sign-in — the shared MCP bridge and every SandBase-owned Skill copy — then
|
|
33
|
+
* verify connectivity. User-modified Skills are never overwritten.
|
|
34
|
+
*/
|
|
35
|
+
export declare function setup(store?: CredentialStore, log?: (line: string) => void): Promise<boolean>;
|
|
30
36
|
export declare function unregister(client?: ConnectClient, store?: CredentialStore, detect?: (client: Client) => Detection, skillsRunner?: SkillsCommandRunner, skillsReadbackVerifier?: SkillsReadbackVerifier, openClawRunner?: OpenClawCommandRunner, openClawReadbackVerifier?: OpenClawReadbackVerifier, a1Runner?: A1CommandRunner, bRunner?: BCommandRunner, cRunner?: CCommandRunner): Promise<void>;
|
|
31
37
|
export {};
|
package/dist/commands.js
CHANGED
|
@@ -19,6 +19,7 @@ import { claudeDesktopArtifactPath, readClaudeDesktopArtifactState, removeClaude
|
|
|
19
19
|
import { coworkStatePath, readCoworkState, removeCoworkState, rollbackCoworkState } from "./cowork.js";
|
|
20
20
|
import { atomicWrite, readOptional, restore } from "./fs-safe.js";
|
|
21
21
|
import { configPath } from "./paths.js";
|
|
22
|
+
import { probeEndpoint } from "./agent/probe.js";
|
|
22
23
|
const sleep = (ms, signal) => new Promise((resolve, reject) => { const t = setTimeout(resolve, ms); signal?.addEventListener("abort", () => { clearTimeout(t); reject(new Error("Authorization cancelled")); }, { once: true }); });
|
|
23
24
|
async function compensate(api, authorizationId, token) { for (const delay of [0, 250, 750]) {
|
|
24
25
|
if (delay)
|
|
@@ -154,7 +155,7 @@ async function prepareOpenClawSkill(detected, log, runner, verify) {
|
|
|
154
155
|
return false;
|
|
155
156
|
}
|
|
156
157
|
async function connectOpenClaw(deps) {
|
|
157
|
-
const api = deps.api || new AuthorizationApi((process.env.SANDBASE_API_URL || "https://sandbase.ai").replace(/\/$/, ""));
|
|
158
|
+
const api = deps.api || new AuthorizationApi((process.env.SANDBASE_API_URL || "https://api.sandbase.ai").replace(/\/$/, ""));
|
|
158
159
|
const store = deps.store || new FileCredentialStore();
|
|
159
160
|
const log = deps.log || console.log;
|
|
160
161
|
const detect = deps.detect || detectClient;
|
|
@@ -183,7 +184,7 @@ async function connectOpenClaw(deps) {
|
|
|
183
184
|
}
|
|
184
185
|
}
|
|
185
186
|
async function connectDesktop(client, deps) {
|
|
186
|
-
const api = deps.api || new AuthorizationApi((process.env.SANDBASE_API_URL || "https://sandbase.ai").replace(/\/$/, ""));
|
|
187
|
+
const api = deps.api || new AuthorizationApi((process.env.SANDBASE_API_URL || "https://api.sandbase.ai").replace(/\/$/, ""));
|
|
187
188
|
const store = deps.store || new FileCredentialStore();
|
|
188
189
|
const log = deps.log || console.log;
|
|
189
190
|
const previous = await store.get(client);
|
|
@@ -210,7 +211,7 @@ async function connectDesktop(client, deps) {
|
|
|
210
211
|
}
|
|
211
212
|
}
|
|
212
213
|
async function connectPromptAssisted(client, deps) {
|
|
213
|
-
const api = deps.api || new AuthorizationApi((process.env.SANDBASE_API_URL || "https://sandbase.ai").replace(/\/$/, ""));
|
|
214
|
+
const api = deps.api || new AuthorizationApi((process.env.SANDBASE_API_URL || "https://api.sandbase.ai").replace(/\/$/, ""));
|
|
214
215
|
const store = deps.store || new FileCredentialStore();
|
|
215
216
|
const log = deps.log || console.log;
|
|
216
217
|
const previous = await store.get(client);
|
|
@@ -233,7 +234,7 @@ async function connectPromptAssisted(client, deps) {
|
|
|
233
234
|
}
|
|
234
235
|
}
|
|
235
236
|
async function connectChatGPT(deps) {
|
|
236
|
-
const api = deps.api || new AuthorizationApi((process.env.SANDBASE_API_URL || "https://sandbase.ai").replace(/\/$/, ""));
|
|
237
|
+
const api = deps.api || new AuthorizationApi((process.env.SANDBASE_API_URL || "https://api.sandbase.ai").replace(/\/$/, ""));
|
|
237
238
|
const store = deps.store || new FileCredentialStore();
|
|
238
239
|
const log = deps.log || console.log;
|
|
239
240
|
const previous = await store.get("chatgpt");
|
|
@@ -256,7 +257,7 @@ async function connectChatGPT(deps) {
|
|
|
256
257
|
}
|
|
257
258
|
}
|
|
258
259
|
async function connectOne(client, deps) {
|
|
259
|
-
const api = deps.api || new AuthorizationApi((process.env.SANDBASE_API_URL || "https://sandbase.ai").replace(/\/$/, ""));
|
|
260
|
+
const api = deps.api || new AuthorizationApi((process.env.SANDBASE_API_URL || "https://api.sandbase.ai").replace(/\/$/, ""));
|
|
260
261
|
const store = deps.store || new FileCredentialStore();
|
|
261
262
|
const log = deps.log || console.log;
|
|
262
263
|
const detect = deps.detect || detectClient;
|
|
@@ -341,7 +342,7 @@ async function connectOne(client, deps) {
|
|
|
341
342
|
}
|
|
342
343
|
}
|
|
343
344
|
async function connectAuto(deps) {
|
|
344
|
-
const api = deps.api || new AuthorizationApi((process.env.SANDBASE_API_URL || "https://sandbase.ai").replace(/\/$/, ""));
|
|
345
|
+
const api = deps.api || new AuthorizationApi((process.env.SANDBASE_API_URL || "https://api.sandbase.ai").replace(/\/$/, ""));
|
|
345
346
|
const store = deps.store || new FileCredentialStore();
|
|
346
347
|
const log = deps.log || console.log;
|
|
347
348
|
const detect = deps.detect || detectClient;
|
|
@@ -718,6 +719,81 @@ export async function doctor(client = "auto", store = new FileCredentialStore(),
|
|
|
718
719
|
console.log(`${target}: status=${status}, mcp=${configured ? "configured" : "not_configured"}, skill=${skill}, invocation=${capability.invocation}, verification=${capability.verification}, shared_skill_references=${references.join(",") || "none"}, next_step=${skillDetail}`);
|
|
719
720
|
healthy = healthy && detected.installed && !!credential && configured && !["missing", "modified"].includes(skill);
|
|
720
721
|
}
|
|
722
|
+
if (!(await probeStoredCredentials(targets, store)))
|
|
723
|
+
healthy = false;
|
|
724
|
+
return healthy;
|
|
725
|
+
}
|
|
726
|
+
/**
|
|
727
|
+
* Live runtime checks: flags an outdated shared bridge and makes one real
|
|
728
|
+
* authenticated round trip per distinct stored credential. Skipped with
|
|
729
|
+
* SANDBASE_DOCTOR_NETWORK=0 (offline fixtures and tests).
|
|
730
|
+
*/
|
|
731
|
+
async function probeStoredCredentials(targets, store, env = process.env) {
|
|
732
|
+
if (env.SANDBASE_DOCTOR_NETWORK === "0")
|
|
733
|
+
return true;
|
|
734
|
+
let ok = true;
|
|
735
|
+
if (await inspectBridge() === "invalid") {
|
|
736
|
+
console.log("bridge: status=outdated, next_step=The local MCP bridge is from another CLI version. Run `npx -y @sandbaseai/cli@latest setup` to refresh it and the SandBase Skill, then restart your AI client.");
|
|
737
|
+
ok = false;
|
|
738
|
+
}
|
|
739
|
+
const seen = new Set();
|
|
740
|
+
for (const target of targets) {
|
|
741
|
+
let record;
|
|
742
|
+
try {
|
|
743
|
+
record = await store.get(target);
|
|
744
|
+
}
|
|
745
|
+
catch {
|
|
746
|
+
continue;
|
|
747
|
+
}
|
|
748
|
+
if (!record?.credential || !record.mcpUrl || seen.has(record.credential))
|
|
749
|
+
continue;
|
|
750
|
+
seen.add(record.credential);
|
|
751
|
+
const result = await probeEndpoint(target, record.credential, record.mcpUrl, env);
|
|
752
|
+
console.log(result.line);
|
|
753
|
+
ok = ok && result.ok;
|
|
754
|
+
}
|
|
755
|
+
return ok;
|
|
756
|
+
}
|
|
757
|
+
const refreshableSkillClients = ["claude-code", "cursor", "hermes", "kiro"];
|
|
758
|
+
/**
|
|
759
|
+
* `sandbase setup`: refresh everything a newer CLI ships without a new browser
|
|
760
|
+
* sign-in — the shared MCP bridge and every SandBase-owned Skill copy — then
|
|
761
|
+
* verify connectivity. User-modified Skills are never overwritten.
|
|
762
|
+
*/
|
|
763
|
+
export async function setup(store = new FileCredentialStore(), log = console.log) {
|
|
764
|
+
let healthy = true;
|
|
765
|
+
const connected = [];
|
|
766
|
+
for (const client of clients) {
|
|
767
|
+
try {
|
|
768
|
+
const record = await store.get(client);
|
|
769
|
+
if (record?.credential)
|
|
770
|
+
connected.push(client);
|
|
771
|
+
}
|
|
772
|
+
catch { /* unreadable store is reported below */ }
|
|
773
|
+
}
|
|
774
|
+
if (connected.length) {
|
|
775
|
+
const bridge = await installBridge();
|
|
776
|
+
log(`bridge: status=${bridge.changed ? "updated" : "current"}, path=${bridge.path}`);
|
|
777
|
+
}
|
|
778
|
+
else
|
|
779
|
+
log(`bridge: status=skipped, next_step=No connected client yet. Run \`npx -y @sandbaseai/cli@latest connect\` to sign in once in the browser.`);
|
|
780
|
+
for (const client of refreshableSkillClients) {
|
|
781
|
+
const state = await inspectSkill(client);
|
|
782
|
+
if (state === "installed") {
|
|
783
|
+
try {
|
|
784
|
+
const result = await installSkill(client);
|
|
785
|
+
log(`${client}: skill=${result.changed ? "updated" : "current"}`);
|
|
786
|
+
}
|
|
787
|
+
catch (error) {
|
|
788
|
+
healthy = false;
|
|
789
|
+
log(`${client}: skill=failed, reason=${safeFailure(error)}`);
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
else if (state === "modified")
|
|
793
|
+
log(`${client}: skill=modified, next_step=A locally edited SandBase Skill was left untouched; replace it with https://www.sandbase.ai/skill.md if you want the latest guidance.`);
|
|
794
|
+
}
|
|
795
|
+
if (connected.length && !(await probeStoredCredentials(connected, store)))
|
|
796
|
+
healthy = false;
|
|
721
797
|
return healthy;
|
|
722
798
|
}
|
|
723
799
|
export async function unregister(client = "auto", store = new FileCredentialStore(), detect = detectClient, skillsRunner, skillsReadbackVerifier, openClawRunner, openClawReadbackVerifier, a1Runner, bRunner, cRunner) {
|
package/dist/skills.js
CHANGED
|
@@ -42,7 +42,7 @@ export function skillFallback(client) {
|
|
|
42
42
|
export function skillInvocation(client) { return `${clientProfiles[client].label} has a SandBase Skill artifact installed. Native discovery remains unverified until the real-client matrix is complete.`; }
|
|
43
43
|
function nativeTier(client) { return skillTiers[client] === "s3_promotion" || skillTiers[client] === "s1_slash"; }
|
|
44
44
|
function marked(content) { return content.includes(ownershipMarker) && /^name:\s*sandbase\s*$/m.test(content); }
|
|
45
|
-
async function asset(relative = "../
|
|
45
|
+
async function asset(relative = "../skills/sandbase/SKILL.md") {
|
|
46
46
|
const bundled = fileURLToPath(new URL(relative, import.meta.url));
|
|
47
47
|
try {
|
|
48
48
|
return await readFile(bundled, "utf8");
|
|
@@ -50,7 +50,7 @@ async function asset(relative = "../assets/skills/sandbase/SKILL.md") {
|
|
|
50
50
|
catch (error) {
|
|
51
51
|
if (error.code !== "ENOENT")
|
|
52
52
|
throw error;
|
|
53
|
-
return readFile(join(process.cwd(), "
|
|
53
|
+
return readFile(join(process.cwd(), "skills", "sandbase", "SKILL.md"), "utf8");
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
async function sharedOwnership(env = process.env) {
|
package/llms-install.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Install SandBase CLI
|
|
2
|
+
|
|
3
|
+
SandBase CLI is an open-source onboarding tool and local stdio MCP bridge. It
|
|
4
|
+
connects supported AI clients to the SandBase catalog of 2,000+ models and APIs without
|
|
5
|
+
requiring separate provider API keys.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Node.js 20 or newer
|
|
10
|
+
- A graphical browser for the one-time authorization flow
|
|
11
|
+
- A supported client from the catalog below
|
|
12
|
+
|
|
13
|
+
## Verify before installing
|
|
14
|
+
|
|
15
|
+
This read-only command prints the 25 supported client targets. It does not open
|
|
16
|
+
a browser or change local configuration:
|
|
17
|
+
|
|
18
|
+
```sh
|
|
19
|
+
npx -y https://github.com/sandbaseai/cli/releases/download/v0.1.17/sandbaseai-cli-0.1.17.tgz catalog --json
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Install with Homebrew
|
|
23
|
+
|
|
24
|
+
The official tap supports macOS and Linux:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
brew install sandbaseai/tap/sandbaseai-cli
|
|
28
|
+
sandbase catalog --json
|
|
29
|
+
sandbase connect --client <client-id>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The formula installs the immutable v0.1.17 archive and verifies its published
|
|
33
|
+
SHA-256 before installation.
|
|
34
|
+
|
|
35
|
+
## Connect a client
|
|
36
|
+
|
|
37
|
+
Alternatively, run the immutable v0.1.17 GitHub Release directly while npm
|
|
38
|
+
`latest` is being updated:
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
npx -y https://github.com/sandbaseai/cli/releases/download/v0.1.17/sandbaseai-cli-0.1.17.tgz connect --client <client-id>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For an offline/integrity check, the archive's SHA-256 is
|
|
45
|
+
`1ad535b2899ca460b57b3c268aef278fee28fd28e649a89b92951514fd71fffa`.
|
|
46
|
+
|
|
47
|
+
Common client IDs include `codex`, `claude-code`, `cursor`, `gemini-cli`,
|
|
48
|
+
`windsurf`, and `opencode`. To configure every supported client detected on the
|
|
49
|
+
machine, omit `--client <client-id>`.
|
|
50
|
+
|
|
51
|
+
The command opens the SandBase authorization page. The user must complete that
|
|
52
|
+
step personally. Never ask the user to paste a credential into chat. After
|
|
53
|
+
authorization, the CLI stores the credential locally with restricted file
|
|
54
|
+
permissions and adds only the SandBase-owned MCP entry.
|
|
55
|
+
|
|
56
|
+
## Verify
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
npx -y https://github.com/sandbaseai/cli/releases/download/v0.1.17/sandbaseai-cli-0.1.17.tgz doctor --client <client-id>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Restart the target client after a successful connection so it reloads its MCP
|
|
63
|
+
configuration. The client should then expose six SandBase tools:
|
|
64
|
+
`sandbase_discover`, `sandbase_inspect`, `sandbase_run`, `sandbase_run_get`,
|
|
65
|
+
`sandbase_runs`, and `sandbase_account`.
|
|
66
|
+
|
|
67
|
+
## Remove the managed entry
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
npx -y https://github.com/sandbaseai/cli/releases/download/v0.1.17/sandbaseai-cli-0.1.17.tgz unregister --client <client-id>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This removes only the SandBase-owned configuration. It leaves unrelated and
|
|
74
|
+
user-managed MCP entries unchanged.
|
|
75
|
+
|
|
76
|
+
Source: https://github.com/sandbaseai/cli
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sandbaseai/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.3.6",
|
|
4
|
+
"mcpName": "io.github.sandbaseai/cli",
|
|
5
|
+
"description": "Give 25 AI clients—Claude Code, Codex, Cursor, Hermes, OpenClaw and more—2,000+ models and APIs through one MCP server and an agent-friendly CLI",
|
|
5
6
|
"type": "module",
|
|
6
7
|
"bin": {
|
|
7
8
|
"sandbase": "dist/cli.js"
|
|
@@ -12,12 +13,14 @@
|
|
|
12
13
|
"files": [
|
|
13
14
|
"dist",
|
|
14
15
|
"assets",
|
|
16
|
+
"skills",
|
|
17
|
+
"llms-install.md",
|
|
15
18
|
"README.md",
|
|
16
19
|
"LICENSE"
|
|
17
20
|
],
|
|
18
21
|
"scripts": {
|
|
19
22
|
"build": "tsc -p tsconfig.json",
|
|
20
|
-
"test": "npm run build && tsc -p tsconfig.test.json && node --test dist-test/test/*.test.js",
|
|
23
|
+
"test": "npm run build && tsc -p tsconfig.test.json && node --import ./dist-test/test/setup.js --test dist-test/test/*.test.js",
|
|
21
24
|
"lint": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
22
25
|
"audit:package": "bash scripts/audit-package.sh",
|
|
23
26
|
"prepack": "npm run build"
|
|
@@ -29,9 +32,31 @@
|
|
|
29
32
|
"license": "Apache-2.0",
|
|
30
33
|
"repository": {
|
|
31
34
|
"type": "git",
|
|
32
|
-
"url": "https://github.com/sandbaseai/
|
|
33
|
-
"directory": "sandbase-cli"
|
|
35
|
+
"url": "git+https://github.com/sandbaseai/cli.git"
|
|
34
36
|
},
|
|
37
|
+
"homepage": "https://github.com/sandbaseai/cli#readme",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/sandbaseai/cli/issues"
|
|
40
|
+
},
|
|
41
|
+
"keywords": [
|
|
42
|
+
"ai",
|
|
43
|
+
"agent",
|
|
44
|
+
"cli",
|
|
45
|
+
"mcp",
|
|
46
|
+
"model-context-protocol",
|
|
47
|
+
"cursor",
|
|
48
|
+
"claude-code",
|
|
49
|
+
"codex",
|
|
50
|
+
"windsurf",
|
|
51
|
+
"gemini-cli",
|
|
52
|
+
"opencode",
|
|
53
|
+
"openclaw",
|
|
54
|
+
"hermes-agent",
|
|
55
|
+
"model-routing",
|
|
56
|
+
"multimodal-ai",
|
|
57
|
+
"developer-tools",
|
|
58
|
+
"automation"
|
|
59
|
+
],
|
|
35
60
|
"publishConfig": {
|
|
36
61
|
"access": "public",
|
|
37
62
|
"provenance": true
|