Deploy
Compile TypeScript, sync caches, push to GitHub Pages, and sync Supabase.
# Deploy myMedKitt
Compile TypeScript, sync caches, push to GitHub Pages, and sync Supabase.
**RULE: Users must NEVER need to manually clear cache.** The deploy process must handle all three data layers (Supabase, IndexedDB, SW cache) so content updates are automatic.
## Steps
00. **EDEADLK Preflight (informational — DO NOT abort the deploy):**
```bash
# Diagnostic only. EDEADLK is not a build blocker anymore.
ls ~/Desktop/myMedKitt >/dev/null 2>&1 && echo "project dir OK" || echo "project dir blocked (will use /tmp at commit)"
cd ~/Desktop/myMedKitt && git status >/dev/null 2>&1 && echo "git OK" || echo "git blocked (will use /tmp at commit)"
```
Build steps 1-7 (TypeScript compile, CSS copy, cache sync, Supabase push, file verification) run on Desktop as usual — none of them go through git's mmap path, so they work even when git is locked. The commit/push step (step 8) routes through `~/Desktop/claude-brain/bin/git-via-tmp.sh`, which transparently falls back to a `/tmp` shadow when Desktop git can't open its pack files. Andy does NOT need to reboot, and does NOT need to be at the Mac.
Reboot is the last resort, not the first response. Verified 2-for-2 on real deploys (2026-05-20 culture-positive-results-ed, 2026-05-21 status-epilepticus BAO mimicker). Full reference: `~/Desktop/claude-brain/operations/edeadlk-playbook.md`.
0. **MANDATORY — Lint CRITICAL_ACTIONS linkage:**
```bash
node scripts/lint-critical-actions.mjs --strict
This asserts every nodeId referenced in *_CRITICAL_ACTIONS arrays resolves to an actual node in the same tree's *_NODES array. Broken linkage = dead clinical guidance link = FDA Prong-4 risk (clinician cannot review the basis for the recommendation).
If this step fails, the deploy ABORTS. Fix the broken nodeIds before continuing. Either:
- Rename the CRITICAL_ACTIONS
nodeIdto match an existing node id (most common — usually a node was renamed without updating the reference), OR - Add the missing node to the NODES array if the critical action references content that should exist, OR
- Remove the dead reference from CRITICAL_ACTIONS if it's no longer clinically relevant
Carried recommendation across 6 Louis Litt audits. Closed 2026-05-12 — initial enforcement caught 266 broken nodeIds across 54 files.
Compile TypeScript:
bunx tsc --skipLibCheck --noUnusedLocals falseVerify zero errors (ignore bun-types lib conflicts).
Copy CSS to docs:
cp src/views/style.css docs/style.cssRun cache sync automation:
node scripts/deploy-cache-sync.mjsWhat it does automatically:
- Detects which tree/drug/info-page data files changed (via git diff against HEAD)
- Generates
supabase-hotfix-update.sqlwith UPDATE statements for changed nodes - Bumps
DATA_VERSIONin bothsrc/services/cache-db.tsanddocs/services/cache-db.js→ forces IndexedDB wipe - Bumps
CACHE_NAMEversion indocs/sw.js→ triggers service worker update
Optional flags:
--dry-run— preview changes without writing anything--skip-data-version— don't bump DATA_VERSION (e.g., CSS-only deploys)--skip-sw— don't bump SW cache (unusual, almost never skip this)
After running, recompile to pick up the DATA_VERSION change:
bunx tsc --skipLibCheck --noUnusedLocals falseMANDATORY — Supabase sync for changed tree/node data: The app loads from Supabase FIRST. If Supabase has stale data, users see stale content regardless of hardcoded fixes or cache bumps. This step is NOT optional when any tree node content changes.
4a. Check if deploy-cache-sync generated UPDATE SQL:
- If
supabase-hotfix-update.sqlwas generated → use it (step 9) - If it shows
⚠ Unknown treewarnings or "No node-level changes detected" but you changed tree nodes → the script failed. Proceed to 4b.
4b. Push directly via REST API (preferred — no copy-paste):
node scripts/supabase-push.mjs <tree-id> --updateThis reads compiled JS from
docs/and pushes nodes + citations + metadata directly to Supabase via REST API. No SQL editor needed.For new consults, omit
--update:node scripts/supabase-push.mjs <tree-id>4c. Fallback — manual SQL paste (only if REST push fails):
open -a TextEdit supabase-hotfix-update.sqlUser: Cmd+A, Cmd+C, Supabase → New Query, Cmd+V, Run. If "destructive operation" warning appears: click "Run this query" — it's safe.
Skip step 4 ONLY if the deploy touches zero tree/node data (e.g., CSS-only, calculator-only, new skill file).
- If
Generate Supabase INSERT SQL (for NEW consults only): Only for NEW consults. Step 4 handles updates to existing consults. Wait until all testing and iteration is complete.
node scripts/generate-supabase-sql.mjs <tree-id> \ --drugs <comma-separated new drug IDs> \ --info-pages <comma-separated new info page IDs>- The script reads compiled JS from
docs/and outputssupabase-<tree-id>-insert.sql - Include
--drugsfor any NEW drugs added in this consult - Include
--info-pagesfor any NEW info pages added
Then push directly via REST API (preferred):
node scripts/supabase-push.mjs <tree-id>Add
--drugs id1,id2and--info-pages id1,id2flags for any new drugs/info pages.Skip this step if no new consult was added.
- The script reads compiled JS from
Verify docs/sw.js has content:
wc -l docs/sw.jsIf it's 0 lines, restore from git:
git show HEAD:docs/sw.js > docs/sw.jsand re-run step 3.Verify ALL compiled files are staged: Run
git status docs/and check for ANY unstaged changes. Every modified file indocs/MUST be committed.Stage, commit, and push — via the EDEADLK-safe helper:
Maintain Deploy?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Deploy on getagentictools](https://getagentictools.com/loops/kittechsix-blip-deploy-mymedkitt?ref=badge)