Skip to content

Package extraction map (on-paper, pre-Trained)

Boundary plan for pulling shared packages out of apps/jg. No code moves yet — this is the agreed target so the extraction is fast (and synthesized best-of-breed) when Trained lands as the second consumer. Confidence reflects how much a single app (jg) can tell us; LOW items genuinely need a 2nd app to resolve.

Source of truth for the Rust side: apps/jg/docs/architecture/target-architecture.md (core = application core + pure sublayer; shell owns I/O; narrow ports, not Device).

packages/ui (design system) — HIGH confidence

Section titled “→ packages/ui (design system) — HIGH confidence”

The cleanest extraction. Generic UI primitives + their storybook.

  • Ui/*: Button, Card, Icon, TextInput, NavBar, ListRow, Sheet, Screen, EmptyState, ErrorBanner, Text, Toggle, Loading, Tokens, DevicePreview, Gesture/DirectionalDrag
  • Book.elm + all Book/*Chapter.elm (the UI-kit storybook)
  • Pairs with the Tailwind v4 @theme tokens in src/input.css
  • Supersedes Planter’s 7hoenix/u7 (mine it for Dropdown/Tooltip/Animation/Effects ideas)

packages/app-core (architecture) — MEDIUM-HIGH

Section titled “→ packages/app-core (architecture) — MEDIUM-HIGH”

Framework, not UI, not jg-domain.

  • Effect.elm, Reply.elm, Js.elm (port interop), Auth.elm, Session.elm, DeepLink.elm, DevWeb.elm (dev-web harness shim)

needs the 2nd app to draw the line — LOW

Section titled “needs the 2nd app to draw the line — LOW”
  • Command.elmsplit: the generic dispatch/Reply machinery → app-core; the jg-specific command variants → jg. The split point is only clear once Trained’s command set sits beside jg’s.
  • Notifications.elm, Sync.elm, Haptic.elm — shared Tauri infra vs jg-specific? TBD.
  • Main.elm — jg’s bootstrap stays in jg, but its shape may seed an app-core scaffold.
  • Entry, Entries, Firing, Firings, Interaction, Interactions, Reclassify, Rotation
  • Page/* (Anchor, Capture, Detail, Entries, List, Login)
  • Generated/* (per-app codegen output)

packages/tauri-core — scaffolding only

Section titled “→ packages/tauri-core — scaffolding only”
  • crates/api transport pattern (Command JSON → service → Response envelope, DispatchSideEffect)
  • generate_elm codegen binary
  • Generic ports (Clock), the Ports/Device-aggregate concept, dispatch wiring
  • build.rs iOS linker / env baking
  • crates/core: events, domain (Entry/Shape/Interaction/Firing), projection, srs, services/* (capture/classify/notifications/auth), the Classifier
  • The pure sublayer + use-case services are jg’s domain, not shared

packages/worker — HIGH (with a split)

Section titled “→ packages/worker — HIGH (with a split)”
  • worker/ Cloudflare auth: Apple OAuth, JWT + sliding expiry, R2 event store → shared
  • jg’s LLM endpoints (classify/similarity/reindex via Vectorize) → likely jg-specific; separate the generic auth/session worker from jg’s app endpoints
  1. Land apps/trained (history-preserving, same recipe).
  2. Extract HIGH-confidence packages from the jg+Trained pair (ui first, then worker, tauri-core), updating both apps to consume via elm.json source-directories / path deps.
  3. Resolve LOW-confidence items (Command split, Notifications/Sync/Haptic) using both apps’ real usage.