browse 0.9.4 → 0.9.5-alpha-2a6e20b
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/README.md +9 -0
- package/bin/run.js +27 -1
- package/dist/commands/skills/show.js +20 -0
- package/dist/help.js +19 -0
- package/dist/lib/skills/install.js +1 -1
- package/oclif.manifest.json +24 -1
- package/package.json +3 -2
- package/skills/browse/SKILL.md +4 -0
package/README.md
CHANGED
|
@@ -277,10 +277,19 @@ export BROWSERBASE_API_KEY=bb_live_...
|
|
|
277
277
|
|
|
278
278
|
Local driver commands (`--local`) work without an API key.
|
|
279
279
|
|
|
280
|
+
`browse` also auto-loads a `.env` file from the current directory on startup, and prints a
|
|
281
|
+
one-time deprecation warning to stderr when it actually pulls a variable from `.env` this way.
|
|
282
|
+
This is deprecated because a CLI used across many unrelated projects can silently pick up a
|
|
283
|
+
stale key from the wrong project's `.env`; a future release will disable auto-loading by
|
|
284
|
+
default so `browse` only reads `process.env`. Set `BROWSE_LOAD_DOTENV=0` (or `false`/`no`) to
|
|
285
|
+
opt out of `.env` auto-loading now, ahead of that change, or `BROWSE_LOAD_DOTENV=1` to keep
|
|
286
|
+
auto-loading with no warning.
|
|
287
|
+
|
|
280
288
|
| Variable | Description |
|
|
281
289
|
|----------|-------------|
|
|
282
290
|
| `BROWSERBASE_API_KEY` | Enables `--remote` sessions and all `browse cloud` / `functions` commands |
|
|
283
291
|
| `BROWSE_SESSION` | Default session name (alternative to `-s, --session`) |
|
|
292
|
+
| `BROWSE_LOAD_DOTENV` | Controls `.env` auto-loading: unset = load + warn once (default, deprecated), `0`/`false`/`no` = skip loading, anything else = load silently |
|
|
284
293
|
|
|
285
294
|
## Links
|
|
286
295
|
|
package/bin/run.js
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "dotenv
|
|
2
|
+
import { config as loadDotenvConfig } from "dotenv";
|
|
3
|
+
|
|
4
|
+
// `BROWSE_LOAD_DOTENV` controls whether `browse` auto-loads a `.env` file
|
|
5
|
+
// from the current working directory. This is deprecated: a future release
|
|
6
|
+
// will flip the default to "off" so `browse` only reads `process.env`,
|
|
7
|
+
// matching how most CLIs used across many unrelated projects behave. Until
|
|
8
|
+
// then we keep loading `.env` by default (unset behaves exactly as before)
|
|
9
|
+
// but warn once when we actually pull a value from it, so users relying on
|
|
10
|
+
// the implicit default get a heads-up before the default changes.
|
|
11
|
+
const dotenvToggle = process.env.BROWSE_LOAD_DOTENV;
|
|
12
|
+
const dotenvOptedOut =
|
|
13
|
+
dotenvToggle !== undefined &&
|
|
14
|
+
["0", "false", "no"].includes(dotenvToggle.toLowerCase());
|
|
15
|
+
|
|
16
|
+
if (!dotenvOptedOut) {
|
|
17
|
+
const keysBeforeLoad = new Set(Object.keys(process.env));
|
|
18
|
+
const { parsed } = loadDotenvConfig();
|
|
19
|
+
const appliedFromDotenv = Object.keys(parsed ?? {}).filter(
|
|
20
|
+
(key) => !keysBeforeLoad.has(key),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
if (appliedFromDotenv.length > 0 && dotenvToggle === undefined) {
|
|
24
|
+
console.error(
|
|
25
|
+
`[browse] Loaded ${appliedFromDotenv.join(", ")} from .env. Auto-loading .env is deprecated and will be disabled by default in a future release -- export these variables in your shell instead, or set BROWSE_LOAD_DOTENV=1 to keep this behavior explicitly once that happens. Set BROWSE_LOAD_DOTENV=0 to opt out today. Run \`browse doctor\` to check for conflicts with your shell environment.`,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
3
29
|
|
|
4
30
|
globalThis.oclif = {
|
|
5
31
|
...globalThis.oclif,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { BrowseCommand } from "../../base.js";
|
|
4
|
+
import { fail } from "../../lib/errors.js";
|
|
5
|
+
import { bundledCliSkillPath } from "../../lib/skills/install.js";
|
|
6
|
+
export default class SkillsShow extends BrowseCommand {
|
|
7
|
+
static description = "Print the bundled browse skill (usage patterns, workflows, gotchas) to stdout. Run before using browse in an agent.";
|
|
8
|
+
static examples = ["browse skills show"];
|
|
9
|
+
async run() {
|
|
10
|
+
const skillMdPath = join(bundledCliSkillPath(), "SKILL.md");
|
|
11
|
+
let contents;
|
|
12
|
+
try {
|
|
13
|
+
contents = await readFile(skillMdPath, "utf8");
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
fail(`Could not read the bundled browse skill (SKILL.md): ${error.message}`, 1, { resultCode: "skill_show_missing" });
|
|
17
|
+
}
|
|
18
|
+
this.log(contents);
|
|
19
|
+
}
|
|
20
|
+
}
|
package/dist/help.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Help } from "@oclif/core";
|
|
2
|
+
// Custom root-help formatter so `browse --help` (and bare `browse`) lead with
|
|
3
|
+
// a short block pointing agents at the bundled skill, ahead of oclif's
|
|
4
|
+
// auto-generated VERSION/USAGE/DESCRIPTION/COMMANDS sections. Only the root
|
|
5
|
+
// help view is customized -- individual `browse <command> --help` views are
|
|
6
|
+
// unaffected.
|
|
7
|
+
const AGENT_HEADER = `Start here (for AI agents):
|
|
8
|
+
browse skills show
|
|
9
|
+
|
|
10
|
+
The bundled skill ships with the CLI (always version-matched) and covers
|
|
11
|
+
workflows, session management, and common failure recovery. Prefer it over
|
|
12
|
+
guessing commands from flag docs alone.
|
|
13
|
+
`;
|
|
14
|
+
export default class BrowseHelp extends Help {
|
|
15
|
+
async showRootHelp() {
|
|
16
|
+
this.log(AGENT_HEADER);
|
|
17
|
+
await super.showRootHelp();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -167,7 +167,7 @@ function localSkillPath(skillId) {
|
|
|
167
167
|
const configHome = process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
|
|
168
168
|
return join(configHome, "browserbase", "skills", skillId.domain, skillId.task);
|
|
169
169
|
}
|
|
170
|
-
function bundledCliSkillPath() {
|
|
170
|
+
export function bundledCliSkillPath() {
|
|
171
171
|
return join(packageRoot(), "skills", "browse");
|
|
172
172
|
}
|
|
173
173
|
function packageRoot() {
|
package/oclif.manifest.json
CHANGED
|
@@ -4536,6 +4536,29 @@
|
|
|
4536
4536
|
"list.js"
|
|
4537
4537
|
]
|
|
4538
4538
|
},
|
|
4539
|
+
"skills:show": {
|
|
4540
|
+
"aliases": [],
|
|
4541
|
+
"args": {},
|
|
4542
|
+
"description": "Print the bundled browse skill (usage patterns, workflows, gotchas) to stdout. Run before using browse in an agent.",
|
|
4543
|
+
"examples": [
|
|
4544
|
+
"browse skills show"
|
|
4545
|
+
],
|
|
4546
|
+
"flags": {},
|
|
4547
|
+
"hasDynamicHelp": false,
|
|
4548
|
+
"hiddenAliases": [],
|
|
4549
|
+
"id": "skills:show",
|
|
4550
|
+
"pluginAlias": "browse",
|
|
4551
|
+
"pluginName": "browse",
|
|
4552
|
+
"pluginType": "core",
|
|
4553
|
+
"strict": true,
|
|
4554
|
+
"isESM": true,
|
|
4555
|
+
"relativePath": [
|
|
4556
|
+
"dist",
|
|
4557
|
+
"commands",
|
|
4558
|
+
"skills",
|
|
4559
|
+
"show.js"
|
|
4560
|
+
]
|
|
4561
|
+
},
|
|
4539
4562
|
"tab:close": {
|
|
4540
4563
|
"aliases": [],
|
|
4541
4564
|
"args": {
|
|
@@ -6398,5 +6421,5 @@
|
|
|
6398
6421
|
]
|
|
6399
6422
|
}
|
|
6400
6423
|
},
|
|
6401
|
-
"version": "0.9.
|
|
6424
|
+
"version": "0.9.5"
|
|
6402
6425
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browse",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.5-alpha-2a6e20b",
|
|
4
4
|
"description": "Unified Browserbase CLI for browser automation and cloud APIs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"bin": "browse",
|
|
25
25
|
"dirname": "browse",
|
|
26
26
|
"commands": "./dist/commands",
|
|
27
|
+
"helpClass": "./dist/help.js",
|
|
27
28
|
"hooks": {
|
|
28
29
|
"init": "./dist/hooks/init.js",
|
|
29
30
|
"prerun": "./dist/hooks/prerun.js",
|
|
@@ -100,7 +101,7 @@
|
|
|
100
101
|
"tsx": "^4.20.6",
|
|
101
102
|
"ws": "^8.18.3",
|
|
102
103
|
"zod": "^4.2.1",
|
|
103
|
-
"@browserbasehq/stagehand": "3.
|
|
104
|
+
"@browserbasehq/stagehand": "3.7.0"
|
|
104
105
|
},
|
|
105
106
|
"devDependencies": {
|
|
106
107
|
"@eslint/js": "^10.0.1",
|
package/skills/browse/SKILL.md
CHANGED
|
@@ -65,12 +65,16 @@ browse open https://example.com --cdp ws://127.0.0.1:9222/devtools/browser/<id>
|
|
|
65
65
|
|
|
66
66
|
Use local mode for development, localhost, trusted sites, and fast iteration. Use `--auto-connect` only when the user explicitly wants to attach to an already-running debuggable Chrome session with existing cookies or login state; use `--local` when no debuggable Chrome is available. Use remote mode when Browserbase credentials are available and the site needs hosted browser infrastructure, Verified browser mode, CAPTCHA solving, proxies, or session persistence.
|
|
67
67
|
|
|
68
|
+
`--local` requires Chrome or Chromium already installed on the machine. In containers, CI, and sandboxes with no browser installed, use `--remote` instead of `--local`. If `--local` fails with "No Chrome or Chromium found" and `BROWSERBASE_API_KEY` is set, switch to `--remote` — do not retry `--local`.
|
|
69
|
+
|
|
68
70
|
For a Verified and/or proxied remote session, add `--verified` and/or `--proxies` to `--remote` — a single command that keeps the Browserbase session identity, so `browse status` and `browse doctor` report the session ID and live-view URL. `--verified` requires a Browserbase Scale plan. These flags only apply to `--remote` and are sticky for the session's lifetime, like `--headed`. Reach for `browse cloud sessions create` + `--cdp` only when you need session options `open` doesn't expose (region, keep-alive, contexts).
|
|
69
71
|
|
|
70
72
|
Choose headed/headless and local/remote mode when starting a session. A running session keeps its mode: passing a conflicting flag such as `--headed` to an already-running headless session fails until you run `browse stop --session <name>` or target a different session.
|
|
71
73
|
|
|
72
74
|
Use named sessions for any non-trivial work, especially when multiple agents or parallel tasks may run at once. Every browser command accepts `--session <name>` (or `-s <name>`); the `BROWSE_SESSION` env var sets the default, and commands without either share the `default` session.
|
|
73
75
|
|
|
76
|
+
If `BROWSE_SESSION` is already set in the environment, every command already targets that session — do not pass `--session` or invent a new name. An explicit `--session <name>` always overrides `BROWSE_SESSION` for that command, so only pass it to deliberately target a different session.
|
|
77
|
+
|
|
74
78
|
```bash
|
|
75
79
|
browse open https://example.com --session research --local
|
|
76
80
|
browse snapshot --session research
|