@browserbasehq/cli 0.0.1 → 0.2.1

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/dist/cli.js CHANGED
@@ -1,5 +1,8 @@
1
+ import { createRequire } from "node:module";
1
2
  import { Command, CommanderError } from "commander";
2
3
  import { attachBrowseCommand } from "./commands/browse.js";
4
+ const require = createRequire(import.meta.url);
5
+ const { version } = require("../package.json");
3
6
  import { attachContextsCommand } from "./commands/contexts.js";
4
7
  import { attachDashboardCommand } from "./commands/dashboard.js";
5
8
  import { attachExtensionsCommand } from "./commands/extensions.js";
@@ -7,25 +10,27 @@ import { attachFetchCommand } from "./commands/fetch.js";
7
10
  import { attachFunctionsCommand } from "./commands/functions.js";
8
11
  import { attachProjectsCommand } from "./commands/projects.js";
9
12
  import { attachSessionsCommand } from "./commands/sessions.js";
13
+ import { attachSkillsCommand } from "./commands/skills.js";
10
14
  export function buildProgram() {
11
15
  const program = new Command();
12
16
  program
13
17
  .name("bb")
14
18
  .description("Browserbase CLI for platform APIs, functions, and browse passthrough.")
15
- .version("0.1.0")
19
+ .version(version)
16
20
  .helpCommand(false)
17
21
  .showHelpAfterError()
18
22
  .showSuggestionAfterError()
19
23
  .enablePositionalOptions()
20
24
  .exitOverride();
21
- attachDashboardCommand(program);
22
25
  attachBrowseCommand(program);
23
- attachFunctionsCommand(program);
26
+ attachFetchCommand(program);
24
27
  attachSessionsCommand(program);
28
+ attachDashboardCommand(program);
29
+ attachFunctionsCommand(program);
25
30
  attachProjectsCommand(program);
26
31
  attachContextsCommand(program);
27
32
  attachExtensionsCommand(program);
28
- attachFetchCommand(program);
33
+ attachSkillsCommand(program);
29
34
  return program;
30
35
  }
31
36
  export async function run(argv) {
@@ -3,7 +3,7 @@ import { findExecutable, spawnPassthrough } from "../lib/process.js";
3
3
  export function attachBrowseCommand(program) {
4
4
  program
5
5
  .command("browse")
6
- .description("Forward commands to the standalone @browserbasehq/browse-cli binary.")
6
+ .description("Run and interact with a local or remote browser. Navigate to pages, send clicks, keystrokes, take screenshots, get a11y trees, and more.")
7
7
  .argument("[args...]", "Arguments to forward to browse")
8
8
  .allowUnknownOption(true)
9
9
  .allowExcessArguments(true)
@@ -2,7 +2,7 @@ import { addCommonApiOptions, createBrowserbaseClient, mergeProjectIdIntoBody, o
2
2
  export function attachContextsCommand(program) {
3
3
  const contexts = program
4
4
  .command("contexts")
5
- .description("Create, inspect, update, and delete Browserbase contexts.")
5
+ .description("Contexts allow you to persist user data across multiple browser sessions, enabling smoother automation, seamless authentication, and faster end-to-end workflows.")
6
6
  .helpCommand(false);
7
7
  contexts.action(() => {
8
8
  contexts.outputHelp();
@@ -2,7 +2,7 @@ import { openUrl } from "../lib/open.js";
2
2
  export function attachDashboardCommand(program) {
3
3
  program
4
4
  .command("dashboard")
5
- .description("Open Browserbase Overview in your local browser.")
5
+ .description("Open the Browserbase web dashboard for your project.")
6
6
  .action(async () => {
7
7
  const url = "http://browserbase.com/overview";
8
8
  await openUrl(url);
@@ -2,7 +2,7 @@ import { addCommonApiOptions, createBrowserbaseClient, outputJson, requestBrowse
2
2
  export function attachExtensionsCommand(program) {
3
3
  const extensions = program
4
4
  .command("extensions")
5
- .description("Upload and manage Browserbase extensions.")
5
+ .description("Install Chrome extensions onto remote Browserbase sessions.")
6
6
  .helpCommand(false);
7
7
  extensions.action(() => {
8
8
  extensions.outputHelp();
@@ -2,7 +2,7 @@ import { addCommonApiOptions, createBrowserbaseClient, outputJson, writeOutputFi
2
2
  export function attachFetchCommand(program) {
3
3
  addCommonApiOptions(program
4
4
  .command("fetch <url>")
5
- .description("Fetch a page with the Browserbase Fetch API.")
5
+ .description("Retrieve webpage content without a full browser session using the lightweight Browserbase Fetch API.")
6
6
  .option("--allow-insecure-ssl", "Bypass TLS certificate verification.")
7
7
  .option("--allow-redirects", "Follow HTTP redirects.")
8
8
  .option("--proxies", "Enable Browserbase proxy support.")
@@ -8,7 +8,7 @@ const packageManagers = ["npm", "pnpm"];
8
8
  export function attachFunctionsCommand(program) {
9
9
  const functions = program
10
10
  .command("functions")
11
- .description("Develop, publish, and invoke Browserbase Functions.")
11
+ .description("Write and deploy web automation scripts to Browserbase cloud Functions.")
12
12
  .helpCommand(false);
13
13
  functions.action(() => {
14
14
  functions.outputHelp();
@@ -2,7 +2,7 @@ import { addCommonApiOptions, createBrowserbaseClient, outputJson } from "../lib
2
2
  export function attachProjectsCommand(program) {
3
3
  const projects = program
4
4
  .command("projects")
5
- .description("List and inspect Browserbase projects.")
5
+ .description("Manage your Browserbase projects.")
6
6
  .helpCommand(false);
7
7
  projects.action(() => {
8
8
  projects.outputHelp();
@@ -3,7 +3,7 @@ import { addCommonApiOptions, createBrowserbaseClient, fail, mergeProjectIdIntoB
3
3
  export function attachSessionsCommand(program) {
4
4
  const sessions = program
5
5
  .command("sessions")
6
- .description("Create, inspect, and manage Browserbase sessions.")
6
+ .description("Manage your remote browser sessions on Browserbase. Create, update, list, and read logs.")
7
7
  .helpCommand(false);
8
8
  sessions.action(() => {
9
9
  sessions.outputHelp();
@@ -0,0 +1,60 @@
1
+ import * as readline from "node:readline/promises";
2
+ import { fail } from "../lib/command.js";
3
+ import { findExecutable, spawnPassthrough } from "../lib/process.js";
4
+ async function installSkills() {
5
+ const npxPath = await findExecutable("npx");
6
+ if (!npxPath) {
7
+ fail([
8
+ "`npx` is not installed.",
9
+ "Install Node.js from https://nodejs.org to get npx,",
10
+ "then rerun `bb skills`.",
11
+ ].join("\n"));
12
+ }
13
+ const exitCode = await spawnPassthrough(npxPath, [
14
+ "skills",
15
+ "add",
16
+ "browserbase/skills",
17
+ "--yes",
18
+ "--global",
19
+ ]);
20
+ if (exitCode !== 0) {
21
+ process.exitCode = exitCode;
22
+ }
23
+ }
24
+ export function attachSkillsCommand(program) {
25
+ const skills = program
26
+ .command("skills")
27
+ .description("Install Browserbase agent skills for Claude Code.")
28
+ .action(async () => {
29
+ console.log([
30
+ "",
31
+ "Browserbase Skills for Claude Code",
32
+ "===================================",
33
+ "",
34
+ "Skills teach Claude Code how to use Browserbase features like",
35
+ "browsing, sessions, functions, and more.",
36
+ "",
37
+ " Source: https://github.com/browserbase/skills",
38
+ " Run: npx skills add browserbase/skills --yes --global",
39
+ "",
40
+ ].join("\n"));
41
+ const rl = readline.createInterface({
42
+ input: process.stdin,
43
+ output: process.stdout,
44
+ });
45
+ try {
46
+ const answer = await rl.question("Install skills? [Y/n] ");
47
+ if (answer.trim().toLowerCase() === "n") {
48
+ return;
49
+ }
50
+ }
51
+ finally {
52
+ rl.close();
53
+ }
54
+ await installSkills();
55
+ });
56
+ skills
57
+ .command("install")
58
+ .description("Install Browserbase agent skills globally via npx (non-interactive).")
59
+ .action(installSkills);
60
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@browserbasehq/cli",
3
- "version": "0.0.1",
3
+ "version": "0.2.1",
4
4
  "description": "Browserbase CLI for platform APIs, functions, and browse passthrough.",
5
5
  "type": "module",
6
6
  "private": false,