GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: add experimental dev build · alfep/free-code@a8b18d9

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .gitignore
  • package.json
  • scripts
    • build.ts
  • src/constants
    • keys.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.gitignore‎

Copy file name to clipboard
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
dist/
33
cli
4+
cli-dev
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"scripts": {
1616
"build": "bun run ./scripts/build.ts",
17+
"build:dev": "bun run ./scripts/build.ts --dev",
1718
"compile": "bun run ./scripts/build.ts --compile",
1819
"dev": "bun run ./src/entrypoints/cli.tsx"
1920
},
Collapse file

‎scripts/build.ts‎

Copy file name to clipboardExpand all lines: scripts/build.ts
+53-3Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,37 @@ const pkg = await Bun.file(new URL('../package.json', import.meta.url)).json() a
88

99
const args = process.argv.slice(2)
1010
const compile = args.includes('--compile')
11+
const dev = args.includes('--dev')
12+
13+
function runCommand(cmd: string[]): string | null {
14+
const proc = Bun.spawnSync({
15+
cmd,
16+
cwd: process.cwd(),
17+
stdout: 'pipe',
18+
stderr: 'pipe',
19+
})
20+
21+
if (proc.exitCode !== 0) {
22+
return null
23+
}
24+
25+
return new TextDecoder().decode(proc.stdout).trim() || null
26+
}
27+
28+
function getDevVersion(baseVersion: string): string {
29+
const timestamp = new Date().toISOString()
30+
const date = timestamp.slice(0, 10).replaceAll('-', '')
31+
const time = timestamp.slice(11, 19).replaceAll(':', '')
32+
const sha = runCommand(['git', 'rev-parse', '--short=8', 'HEAD']) ?? 'unknown'
33+
return `${baseVersion}-dev.${date}.t${time}.sha${sha}`
34+
}
35+
36+
function getVersionChangelog(): string {
37+
return (
38+
runCommand(['git', 'log', '--format=%h %s', '-20']) ??
39+
'Local development build'
40+
)
41+
}
1142

1243
const features: string[] = []
1344
for (let i = 0; i < args.length; i += 1) {
@@ -22,8 +53,15 @@ for (let i = 0; i < args.length; i += 1) {
2253
}
2354
}
2455

25-
const outfile = compile ? './dist/cli' : './cli'
56+
const outfile = compile
57+
? dev
58+
? './dist/cli-dev'
59+
: './dist/cli'
60+
: dev
61+
? './cli-dev'
62+
: './cli'
2663
const buildTime = new Date().toISOString()
64+
const version = dev ? getDevVersion(pkg.version) : pkg.version
2765

2866
mkdirSync(dirname(outfile), { recursive: true })
2967

@@ -37,8 +75,16 @@ const externals = [
3775

3876
const defines = {
3977
'process.env.USER_TYPE': JSON.stringify('external'),
78+
...(dev
79+
? { 'process.env.NODE_ENV': JSON.stringify('development') }
80+
: {}),
81+
...(dev
82+
? {
83+
'process.env.CLAUDE_CODE_EXPERIMENTAL_BUILD': JSON.stringify('true'),
84+
}
85+
: {}),
4086
'process.env.CLAUDE_CODE_VERIFY_PLAN': JSON.stringify('false'),
41-
'MACRO.VERSION': JSON.stringify(pkg.version),
87+
'MACRO.VERSION': JSON.stringify(version),
4288
'MACRO.BUILD_TIME': JSON.stringify(buildTime),
4389
'MACRO.PACKAGE_URL': JSON.stringify(pkg.name),
4490
'MACRO.NATIVE_PACKAGE_URL': 'undefined',
@@ -47,7 +93,7 @@ const defines = {
4793
'This reconstructed source snapshot does not include Anthropic internal issue routing.',
4894
),
4995
'MACRO.VERSION_CHANGELOG': JSON.stringify(
50-
'https://github.com/paoloanzn/claude-code',
96+
dev ? getVersionChangelog() : 'https://github.com/paoloanzn/claude-code',
5197
),
5298
} as const
5399

@@ -74,6 +120,10 @@ for (const external of externals) {
74120
cmd.push('--external', external)
75121
}
76122

123+
for (const feature of features) {
124+
cmd.push(`--feature=${feature}`)
125+
}
126+
77127
for (const [key, value] of Object.entries(defines)) {
78128
cmd.push('--define', `${key}=${value}`)
79129
}
Collapse file

‎src/constants/keys.ts‎

Copy file name to clipboardExpand all lines: src/constants/keys.ts
+10-3Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,16 @@ import { isEnvTruthy } from '../utils/envUtils.js'
33
// Lazy read so ENABLE_GROWTHBOOK_DEV from globalSettings.env (applied after
44
// module load) is picked up. USER_TYPE is a build-time define so it's safe.
55
export function getGrowthBookClientKey(): string {
6+
const useExperimentalClientKey =
7+
isEnvTruthy(process.env.CLAUDE_CODE_EXPERIMENTAL_BUILD) ||
8+
(process.env.USER_TYPE === 'ant' &&
9+
isEnvTruthy(process.env.ENABLE_GROWTHBOOK_DEV))
10+
11+
if (useExperimentalClientKey) {
12+
return 'sdk-yZQvlplybuXjYh6L'
13+
}
14+
615
return process.env.USER_TYPE === 'ant'
7-
? isEnvTruthy(process.env.ENABLE_GROWTHBOOK_DEV)
8-
? 'sdk-yZQvlplybuXjYh6L'
9-
: 'sdk-xRVcrliHIlrg4og4'
16+
? 'sdk-xRVcrliHIlrg4og4'
1017
: 'sdk-zAZezfDKGoZuXXKe'
1118
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.