# v0.79.3 TS runtime bootstrap

This branch only adds the safe runtime bootstrap. It must merge before any branch that converts `server/**`, `core/**`, or shared runtime code from JS to TS.

## Merge order

1. Merge this bootstrap branch first.
2. Rebase later TS conversion branches on top of it.
3. Convert runtime entrypoints one at a time. Keep `server/index.js` until the conversion branch is ready to switch the source server entry.
4. When a conversion branch replaces the source server entry with `server/index.ts`, validate `npm run server` in both normal Node mode and the Electron `ELECTRON_RUN_AS_NODE=1` fallback path.
5. Keep the packaged app path on the Vite-built server bundle. Do not add `tsx` to production dependencies or package resources.

## Source server selection

`scripts/launch.ts server` keeps the existing `server/index.js` path when it exists. If `server/index.js` is absent and `server/index.ts` exists, it runs the TS entry with `node --import tsx server/index.ts`.

For pre-merge testing while both files exist, set:

```sh
LYNN_SERVER_ENTRY=ts npm run server
```

Use `LYNN_SERVER_ENTRY=js` to force the current JS path. `LYNN_SERVER_RUNTIME=node|electron|auto` keeps its existing meaning for native addon runtime selection.

## Validation for TS conversion branches

Run these before merging a branch that changes runtime source to TS:

```sh
npm test -- tests/launch.test.js
npm run typecheck
npm run typecheck:runtime
npm run build:server
```

`npm run release:preflight` should stay unchanged and continue to validate the production Vite bundle path.
