/research_codebase can we go through @apps/desktop/ and let's figure what we need to do get this ready for prod. e.g envs
User
research_codebase
/research_codebase
can we go through @apps/desktop/ and let's figure what we need to do get this ready for prod. e.g envs
Assistant· claude-opus-4-7
I'll research the current state of apps/desktop and what's needed for prod readiness. Let me start by reading the directly relevant plan/memory files and the key desktop config files in parallel.
Assistant· claude-opus-4-7
I have the key context from the pre-release plan. Let me read the rest and the current state of key desktop files in parallel.
Assistant· claude-opus-4-7
I have full context on the pre-release plan. Now let me read the current state of the key desktop files and the relevant memory files in parallel.
Assistant· claude-opus-4-7
Let me now check the current state of key files in parallel — using the Bash and Read tools.
Assistant· claude-opus-4-7
Now I'll spawn 4 parallel research agents to fill in the gaps — auth/sign-in flow on the app side, renderer/IPC contracts, recent thoughts on desktop prod work, and security/CSP/distribution coverage.
Assistant· claude-opus-4-7
Research doc written to thoughts/shared/research/2026-05-05-desktop-prod-readiness.md.
TL;DR — apps/desktop is code-complete; ship is gated on credentials, not code.
The release pipeline (signed/notarized arm64+x64 .dmg/.zip, Sentry source-map upload, Squirrel.Mac feed, build provenance) is wired and active on main (PR #621, 2026-04-24). The four package.json placeholders are stamped at CI time by design.
What's actually needed for v0.1.0:
User
question, why is this tapping into keychain and shit? is this what other electron apps do?
Assistant· claude-opus-4-7
Yes, this is the standard Electron pattern. There are two distinct keychain interactions happening — easy to conflate them:
1. CI temp keychain (desktop-release.yml, "Import Apple signing certificate")
This isn't optional — it's how Apple codesigning works. codesign reads identities from the macOS Keychain. On your Mac you have a login keychain with the Developer ID cert; CI runners don't, so you create a throwaway build.keychain, import the .p12, unlock it, run codesign. Slack, VS Code, Discord, Linear, Codex, Figma — every codesigned Mac Electron app's CI does exactly this. The exact sequence in our workflow is copy-paste from Apple's own GitHub Actions docs.
User
[Request interrupted by user]
User
question, consiering that we havent gotten apple dev account setup how can we deploy?
Assistant· claude-opus-4-7
Three realistic options:
Unsigned closed beta — forge.config.ts:14-41 already gates osxSign/osxNotarize on env presence, so an unsigned build will pack cleanly; users get a Gatekeeper "unidentified developer" warning that they bypass with right-click → Open. The catch: Squirrel.Mac auto-update requires a signed app, so users would be on manual .dmg reinstalls until Apple is sorted. Cheapest path to "people are running it today" — fine for Discord/early-adopter beta, painful for a public launch.
Start Apple enrollment in parallel — $99/yr; individual Apple Dev enrollment is usually same-day to ~24h, but a D-U-N-S-verified org account ("Lightfast AI Inc") takes 1-2 weeks. If the legal entity isn't load-bearing yet, enroll personally now and migrate the cert later. This is the only path to a real auto-updating macOS release.
User
/export
export
Provision 12 GitHub repo entries (Phase A from the pre-release plan):
Prereq: Apple Developer Program enrollment + Developer ID cert + ASC API key
Cut @lightfast/desktop@0.1.0-rc.1 tag to fire the workflow and verify end-to-end.
Make Desktop CI / Typecheck + package (unsigned) a required check on main (manual repo-settings).
Env layer (apps/desktop/src/env/main.ts) is 5 keys, all main-process: SENTRY_DSN, SPARKLE_FEED_URL, SQUIRREL_FEED_URL, LIGHTFAST_APP_ORIGIN (dev-only; prod hardcodes https://lightfast.ai), LIGHTFAST_REMOTE_DEBUG_PORT. The renderer reads zero env vars — everything routes through window.lightfastBridge from preload. LIGHTFAST_APP_ORIGIN is auto-injected in dev by scripts/with-desktop-env.mjs.
Open questions worth surfacing before release (in the doc): (1) Clerk lightfast-desktop JWT template expiry — the desktop persists the token but never refreshes it; (2) CORS behavior from Electron's internal origin against the prod tRPC route allowlist — needs a packaged-build smoke test; (3) signed-out onboarding plan (2026-04-23-desktop-signed-out-onboarding.md) — decide if v0.1.0 ships before or after.
Want me to surface the open questions for follow-up research, or move on?
The JWT isn't stored in Keychain — Electron's safeStorage.encryptString() encrypts the blob using a key that's kept in the OS credential store (Keychain on macOS, DPAPI on Windows, libsecret/kwallet on Linux), and the encrypted blob lands in <userData>/auth.bin. So Keychain holds one app-scoped key, not one entry per token.
This is the recommended Electron pattern for any app handling credentials:
Slack — keychain for tokens (via legacy keytar)
VS Code — keychain for sync auth and Copilot tokens
Linear — same pattern
Codex.app — uses safeStorage identically (we modeled after it)
1Password's Electron renderer, Notion, Cursor — all the same
The alternative is a plaintext file in userData, which any other process running as your user can read. That's how Discord's token-stealer malware family (RedLine etc.) works — they grep userData directories for JWTs because some apps don't bother encrypting.
So: safeStorage is the "do the safe thing" default, not exotic. The CI keychain dance is mandatory if you want Gatekeeper-friendly downloads.
Ship Windows first / stay web-only — MakerSquirrel is configured but also unsigned (no Windows EV cert wired up); Windows SmartScreen is more forgiving than Gatekeeper but still warns. Probably not worth the detour given lightfast.ai already runs.
My take: option 1 + 2 in parallel — cut an unsigned @lightfast/desktop@0.1.0-beta.1 for a tight closed beta this week (requires either a desktop-release-unsigned.yml variant or making the Apple steps if: secrets.APPLE_SIGNING_IDENTITY != ''), while you start individual enrollment so you can drop the unsigned hack within ~2 weeks. The main risk is people on the unsigned build won't auto-receive the signed v0.1.0 — they'd need a one-time manual reinstall.
Want me to spec the unsigned-build workflow tweaks?