Extract chat-domain formatters into publishable SDK package#2
Open
Herklos wants to merge 4 commits into
Open
Conversation
…matters (Tier 1) New publishable headless-core package (tsup ESM+DTS, vitest). Move the pure, dependency-free formatters — format, emoji, message-format, markdown (+ their tests) — out of apps/mobile/src/lib into packages/sdk, rewrite app imports to the package barrel, and wire it into the workspace (dependency, tsconfig path to source, vitest alias to source). App typecheck clean; 289 app tests + 39 SDK tests pass.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
octochat | e2015e7 | Jun 05 2026, 09:42 PM |
…ploy) The SDK's dist is gitignored, so a fresh CI checkout couldn't resolve @drakkar.software/octochat-sdk via package exports -> dist, breaking the Expo web export (Cloudflare deploy). Map the package name to packages/sdk/src in metro.config.js so Metro bundles it from source (it already watches the workspace root); make the barrel imports extensionless so Metro resolves them. Verified: expo export -p web succeeds; published npm package still ships dist.
…-sdk Move the bulk of OctoChat's non-UI logic out of apps/mobile/src/lib into the publishable headless SDK: the whole Starfish sync/crypto layer (identity, client, keyrings, registry, objects/object-index, members, member-caps, dm/pubspace, attachments, stream-bots, session-restore, paths, account-seal) plus the domain types and id helpers — ~50 modules + 108 tests. - Adapter seams: configureOctoChat() (server URL/namespace/events/web origin, replacing env reads) and configureKv() (localStorage/AsyncStorage), wired once at boot via apps/mobile/src/lib/octochat-init.ts. The SDK is now fully headless (no React, no Expo, no env, no platform branching) so any frontend can consume it. - App rewired: 237 import sites across 117 files now import from the package; platform-branched modules (kv/storage/platform/passkey/hash-wasm-shim) + React contexts/hooks stay in the app. Built on the published starfish alpha.19. Verified: SDK typecheck+build+108 tests; app typecheck; 220 app tests; web export.
ac22a2c to
9c1c95e
Compare
Extract the rest of OctoChat's non-UI logic from apps/mobile/src/lib into the SDK: reads/mutes (synced prefs), quick-reactions-settings, reactions, message-view, threads, cross-room, space-stats, project-board, doc-block, nostr, object-types, notification-format/labels/preview, explore-spaces, the events SSE subscriber (events.shared), the pure link parsers (linkify/mentionsUser), the outbox message shape + headless send, and the automations core (runner/orchestrator/hash/secrets/ append/registry-write/providers). - Intra-SDK imports resolve to specific sibling modules (no barrel cycles); kv/config route through the SDK's adapters/config seams. - Decoupled the last UI leaks: object-types/automations icons are plain strings (the app casts to IconName); pure links split from the app's openUrl/openRoom. - Removed the dead events.ts/events.native.ts re-export shims (consumers import subscribeRoomChanges from the SDK directly). - App keeps only React (contexts + use-* hooks), platform-branched modules (kv/storage/platform/passkey/connectivity/...), the outbox store, links nav. Verified: SDK 275 tests + typecheck + build; app typecheck; 52 app tests; web export.
9c1c95e to
e2015e7
Compare
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
Introduces
@drakkar.software/octochat-sdk, a new headless, publishable package containing reusable OctoChat core logic with no UI or platform lock-in. The mobile app now consumes formatting utilities (format,emoji,message-format,markdown) from the SDK instead of local@/libimports.Key Changes
New SDK package (
packages/sdk):package.json,tsconfig.json,tsup.config.ts, andvitest.config.tsfor a standalone, publishable ESM module@drakkar.software/*packages external (consumer owns the single installed copy)format,emoji,message-format,markdown) with no UI or Starfish dependencyMobile app integration:
apps/mobile/package.jsontsconfig.jsonpath alias to resolve@drakkar.software/octochat-sdkto SDK source during developmentvitest.config.tsto alias SDK imports to source for test runs without a build step@drakkar.software/octochat-sdkinstead of@/libDocumentation:
CLAUDE.mdto document the new SDK package and its role in the monorepoImplementation Details
src/index.tsfor a clean public APIhttps://claude.ai/code/session_01TfQhHrB93ondXY7BTpWLiq