Skip to content

Commit 8a2405a

Browse files
committed
refactor(cli): share the Functions SDK core
Replace Browse's parallel Functions implementation with @browserbasehq/sdk-functions/core adapters while preserving Browse command flags, output, telemetry, and error mapping.
1 parent 998652c commit 8a2405a

13 files changed

Lines changed: 327 additions & 1390 deletions

File tree

‎.changeset/calm-functions-core.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"browse": patch
3+
---
4+
5+
Use the shared `@browserbasehq/sdk-functions/core` implementation for Functions scaffolding, local development, publishing, and invocation.

‎packages/cli/package.json‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,24 +103,21 @@
103103
},
104104
"dependencies": {
105105
"@browserbasehq/sdk": "^2.17.0",
106+
"@browserbasehq/sdk-functions": "catalog:",
106107
"@browserbasehq/stagehand": "workspace:*",
107108
"@oclif/core": "^4.11.0",
108109
"@vercel/detect-agent": "^1.2.3",
109-
"archiver": "^7.0.1",
110110
"deepmerge": "^4.3.1",
111111
"dotenv": "^16.5.0",
112112
"fastest-levenshtein": "^1.0.16",
113113
"http-status-codes": "^2.3.0",
114-
"ignore": "^7.0.5",
115114
"node-html-markdown": "^1.3.0",
116115
"semver": "^7.7.4",
117-
"tsx": "^4.20.6",
118116
"ws": "^8.18.3",
119117
"zod": "^4.2.1"
120118
},
121119
"devDependencies": {
122120
"@eslint/js": "^10.0.1",
123-
"@types/archiver": "^6.0.3",
124121
"@types/node": "^20.11.30",
125122
"@types/semver": "^7.7.1",
126123
"@types/ws": "^8.18.1",

‎packages/cli/src/commands/functions/dev.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ export default class FunctionsDev extends BrowseCommand {
2525
helpValue: "<apiKey>",
2626
}),
2727
"base-url": Flags.string({
28+
aliases: ["api-url"],
29+
char: "u",
2830
description: "Override the Browserbase API base URL.",
2931
helpValue: "<baseUrl>",
3032
}),
@@ -38,6 +40,10 @@ export default class FunctionsDev extends BrowseCommand {
3840
description: "Port to listen on.",
3941
helpValue: "<port>",
4042
}),
43+
"project-id": Flags.string({
44+
description: "Browserbase project ID used for local browser sessions.",
45+
helpValue: "<projectId>",
46+
}),
4147
verbose: Flags.boolean({
4248
description: "Print verbose runtime logs.",
4349
}),
@@ -51,6 +57,7 @@ export default class FunctionsDev extends BrowseCommand {
5157
entrypoint: args.entrypoint,
5258
host: flags.host,
5359
port: flags.port,
60+
projectId: flags["project-id"],
5461
verbose: flags.verbose ?? false,
5562
});
5663
}

‎packages/cli/src/commands/functions/invoke.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ export default class FunctionsInvoke extends BrowseCommand {
2626
helpValue: "<apiKey>",
2727
}),
2828
"base-url": Flags.string({
29+
aliases: ["api-url"],
30+
char: "u",
2931
description: "Override the Browserbase API base URL.",
3032
helpValue: "<baseUrl>",
3133
}),

‎packages/cli/src/commands/functions/publish.ts‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,18 @@ export default class FunctionsPublish extends BrowseCommand {
2525
helpValue: "<apiKey>",
2626
}),
2727
"base-url": Flags.string({
28+
aliases: ["api-url"],
29+
char: "u",
2830
description: "Override the Browserbase API base URL.",
2931
helpValue: "<baseUrl>",
3032
}),
3133
"dry-run": Flags.boolean({
3234
description: "Show what would be published without uploading.",
3335
}),
36+
"project-id": Flags.string({
37+
description: "Browserbase project ID to publish into.",
38+
helpValue: "<projectId>",
39+
}),
3440
};
3541

3642
async run(): Promise<void> {
@@ -40,6 +46,7 @@ export default class FunctionsPublish extends BrowseCommand {
4046
baseUrl: flags["base-url"],
4147
dryRun: flags["dry-run"] ?? false,
4248
entrypoint: args.entrypoint,
49+
projectId: flags["project-id"],
4350
});
4451
}
4552
}

0 commit comments

Comments
 (0)