Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"dependencies": {
"@clack/prompts": "^1.2.0",
"@rendobar/sdk": "^3.1.0",
"@rendobar/sdk": "^3.3.0",
"citty": "^0.2.0",
"picocolors": "^1.1.1"
},
Expand Down
11 changes: 5 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions src/commands/ffmpeg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
import { defineCommand } from "citty";
import * as path from "node:path";
import pc from "picocolors";
import { createClient, isApiError } from "@rendobar/sdk";
import { isApiError } from "@rendobar/sdk";
import { createCliClient } from "../lib/client.js";
import { resolveAuth, refreshTokenIfNeeded, getApiBaseUrl, getDashboardBaseUrl } from "../lib/auth.js";
import { parseFfmpegArgs } from "../lib/parse-ffmpeg-args.js";
import { shellEscape } from "../lib/shell-escape.js";
Expand Down Expand Up @@ -196,7 +197,7 @@ export default defineCommand({
const clientConfig = cred.type === "apikey"
? { apiKey: cred.apiKey, baseUrl }
: { accessToken: cred.accessToken, baseUrl };
const client = createClient(clientConfig);
const client = createCliClient(clientConfig);
const steps = new StepRenderer({ isTTY, quiet: flags.quiet });

const controller = new AbortController();
Expand Down
6 changes: 3 additions & 3 deletions src/commands/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
import { defineCommand } from "citty";
import pc from "picocolors";
import { createClient } from "@rendobar/sdk";
import { createCliClient } from "../lib/client.js";
import { saveApiKey, saveOAuthCredentials, getConfigDir, openBrowser, CLI_CLIENT_ID, getApiBaseUrl } from "../lib/auth.js";
const CALLBACK_PORT = 14832;
const REDIRECT_URI = `http://127.0.0.1:${CALLBACK_PORT}/callback`;
Expand Down Expand Up @@ -130,7 +130,7 @@ export default defineCommand({
process.exit(2);
}
try {
const client = createClient({ apiKey });
const client = createCliClient({ apiKey });
const state = await client.orgs.current();
await saveApiKey(apiKey, undefined, { orgName: state.org.name, plan: state.plan.name });
process.stderr.write(` ${pc.green("\u2713")} Verified | ${pc.bold(state.org.name)} | ${state.plan.name} plan\n`);
Expand Down Expand Up @@ -284,7 +284,7 @@ export default defineCommand({

let identity: { orgName: string; plan: string } | undefined;
try {
const client = createClient({ accessToken, baseUrl });
const client = createCliClient({ accessToken, baseUrl });
const orgState = await client.orgs.current();
identity = { orgName: orgState.org.name, plan: orgState.plan.name };
process.stderr.write(` ${pc.green("\u2713")} Signed in | ${pc.bold(orgState.org.name)} | ${orgState.plan.name} plan\n`);
Expand Down
4 changes: 2 additions & 2 deletions src/commands/whoami.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { defineCommand } from "citty";
import pc from "picocolors";
import { createClient } from "@rendobar/sdk";
import { createCliClient } from "../lib/client.js";
import { resolveAuth, refreshTokenIfNeeded, getApiBaseUrl, saveApiKey, saveOAuthCredentials } from "../lib/auth.js";

export default defineCommand({
Expand Down Expand Up @@ -31,7 +31,7 @@ export default defineCommand({
: { accessToken: cred.accessToken, baseUrl };

try {
const client = createClient(clientConfig);
const client = createCliClient(clientConfig);
const state = await client.orgs.current();

process.stderr.write(` ${pc.dim("Org")} ${pc.bold(state.org.name)}\n`);
Expand Down
13 changes: 13 additions & 0 deletions src/lib/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { createClient } from "@rendobar/sdk";

/**
* Build an SDK client that attributes all CLI traffic as `client=cli`.
*
* The SDK defaults the `X-Rendobar-Client` header to "sdk"; wrappers are meant
* to override it so usage analytics can tell CLI-originated jobs apart from
* dashboard/sdk/mcp/n8n traffic. Use this everywhere instead of the raw
* `createClient`.
*/
export function createCliClient(config: Parameters<typeof createClient>[0] = {}) {
return createClient({ ...config, client: "cli" });
}