Skip to content

Commit 66503b3

Browse files
committed
refactor(core): extract experimental flag helper
1 parent 541b4d9 commit 66503b3

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/core/src/flag/flag.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ function truthy(key: string) {
77

88
const OPENCODE_EXPERIMENTAL = truthy("OPENCODE_EXPERIMENTAL")
99
const copy = process.env["OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT"]
10-
const workspaces = process.env["OPENCODE_EXPERIMENTAL_WORKSPACES"]
10+
11+
function enabledByExperimental(key: string) {
12+
return process.env[key] === undefined ? OPENCODE_EXPERIMENTAL : truthy(key)
13+
}
1114

1215
export const Flag = {
1316
OTEL_EXPORTER_OTLP_ENDPOINT: process.env["OTEL_EXPORTER_OTLP_ENDPOINT"],
@@ -43,8 +46,7 @@ export const Flag = {
4346
OPENCODE_DB: process.env["OPENCODE_DB"],
4447

4548
OPENCODE_WORKSPACE_ID: process.env["OPENCODE_WORKSPACE_ID"],
46-
OPENCODE_EXPERIMENTAL_WORKSPACES:
47-
workspaces === undefined ? OPENCODE_EXPERIMENTAL : truthy("OPENCODE_EXPERIMENTAL_WORKSPACES"),
49+
OPENCODE_EXPERIMENTAL_WORKSPACES: enabledByExperimental("OPENCODE_EXPERIMENTAL_WORKSPACES"),
4850

4951
// Evaluated at access time (not module load) because tests, the CLI, and
5052
// external tooling set these env vars at runtime.

0 commit comments

Comments
 (0)