fix: embed build-time secrets so Genius API works in packaged app#81
Merged
Conversation
tsc doesn't substitute env vars, so GENIUS_ACCESS_TOKEN was undefined at runtime in packaged builds — the handler silently returned null. build:main now writes dist/build-env.json with both GENIUS_ACCESS_TOKEN and APPINSIGHTS_CONNECTION_STRING baked in from the CI environment. main.ts loads this file at startup and back-fills any vars that dotenv didn't cover (dev .env still takes priority). Also adds --remote-debugging-port=9333 to the dev script and documents the agent-browser visual verification workflow in CLAUDE.md. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Coverage Report
File CoverageNo changed files found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
build:mainnow writesdist/build-env.jsonwithGENIUS_ACCESS_TOKENandAPPINSIGHTS_CONNECTION_STRINGbaked in from the CI environment at build timemain.tsloads this file at startup and back-fills any env vars that dotenv did not cover — dev.envstill takes priority--remote-debugging-port=9333to thedevscript and documents theagent-browservisual verification workflow inCLAUDE.mdRoot cause
tsconly transpiles; it does not substituteprocess.envvalues. In the packaged app there is no.envfile and user machines do not haveGENIUS_ACCESS_TOKENset, so the IPC handler silently returnednullevery time.Test plan
dist/build-env.jsonis present in the asarGenerated with Claude Code