Commit cce46bb
fix: use bare identifier references for build-time define constants in bootstrap.ts
Bun's `define` option performs compile-time identifier substitution — it
replaces bare identifier tokens in source code with their configured values.
Dynamic property lookups like `(globalThis as any)["ALTIMATE_VALIDATE_SKILL_MD"]`
are runtime expressions and are NOT substituted by the bundler.
The previous `readAsset(globalName: string, ...)` helper passed constant names
as strings, so the globalThis lookup always returned `undefined` in the
production binary. The fallback `fs.readFile(import.meta.dir + ...)` then
failed because the source paths don't exist in a compiled binary. Since
`ensureValidationSetup()` is wrapped in a bare `catch {}`, this failed
completely silently — skill files were never written to `~/.claude/` on startup.
Fix:
- Add `declare const` for all three build-time globals
- Change `readAsset` signature to accept the resolved value directly
- Pass bare identifiers at each call site so the bundler inlines the content
This matches the pattern already used correctly in `validate.ts`.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent bb29944 commit cce46bb
1 file changed
+11
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
| |||
67 | 72 | | |
68 | 73 | | |
69 | 74 | | |
70 | | - | |
| 75 | + | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
74 | | - | |
| 79 | + | |
75 | 80 | | |
76 | 81 | | |
77 | 82 | | |
| |||
81 | 86 | | |
82 | 87 | | |
83 | 88 | | |
84 | | - | |
| 89 | + | |
85 | 90 | | |
86 | 91 | | |
87 | 92 | | |
| |||
0 commit comments