feat(V2-1b): packages/core 추출 — 공유 타입/에러/채널/유틸 분리

packages/core (@d3ro/core) 신규 생성:
- types.ts, errors.ts, ipc-channels.ts, constants.ts (shared에서 이동)
- utils/meeting-markdown.ts, utils/markdown-to-docx.ts (main/utils에서 이동)
- subpath exports 정의 (./types, ./errors, ./ipc-channels, ./constants,
  ./utils/meeting-markdown, ./utils/markdown-to-docx)
- src/index.ts barrel export 추가
- docx를 core 자체 dependency로 선언

apps/desktop 연결:
- package.json에 @d3ro/core: '*' dep 추가
- tsconfig.node/web.json paths에 @d3ro/core/* 추가
- electron.vite.config.ts 3개 섹션 alias 추가 (main/preload/renderer)
- externalizeDepsPlugin exclude에 @d3ro/core (workspace 소스 번들 대상)
- vitest.config.ts alias 추가

일괄 치환 (79 파일, 167건):
- @shared/{types,errors,ipc-channels,constants} → @d3ro/core/*
- static/dynamic import + type expression import 모두 포함
- MeetingModeService.ts의 ../utils/* 상대 경로 → @d3ro/core/utils/*
- @shared/theme-vars는 V2-1c 범위로 남김 (WindowManager만 사용)

M1 수정 포함:
- electron.vite.config.ts의 resolve('src/shared') → resolve(__dirname, ...)
  CWD 독립적으로 동작하도록 견고화

검증:
- typecheck 통과
- build 통과 (main+preload+renderer)
- dev 런타임 → DB/핫키/Ollama 모두 정상, 기존 데이터 연속성 유지
This commit is contained in:
yunchan8804 2026-04-08 14:39:46 +09:00
parent a4cb4c0805
commit 3b0eb3393b
95 changed files with 315 additions and 212 deletions

View file

@ -9,7 +9,7 @@ import { I18nProvider } from './i18n'
import { AppLayout } from './components/AppLayout'
import { UpgradePromptModal } from './components/UpgradePromptModal'
import { startSystemAudioCapture, stopSystemAudioCapture } from './utils/systemAudioCapture'
import type { ThemeMode, ConfigChangedEvent } from '@shared/types'
import type { ThemeMode, ConfigChangedEvent } from '@d3ro/core/types'
export function App(): React.ReactElement {
const [themeMode, setThemeMode] = useState<ThemeMode>('auto')

View file

@ -26,7 +26,7 @@ import { StatusBar } from './StatusBar'
import { d3roPalette, d3roFontMono, d3roTypo, d3roShadow, d3roRadius } from '../theme'
import { useI18n } from '../i18n'
import type { TranslationKey } from '../i18n'
import type { LicenseTier } from '@shared/types'
import type { LicenseTier } from '@d3ro/core/types'
type Route = 'dashboard' | 'history' | 'dictionary' | 'commands' | 'conversation' | 'knowledge' | 'meeting'

View file

@ -13,7 +13,7 @@ import type {
FileTranscriptionProgress,
FileTranscriptionResult,
FileTranscriptionState,
} from '@shared/types'
} from '@d3ro/core/types'
const SUPPORTED_EXTENSIONS = [
'.mp3', '.wav', '.m4a', '.ogg', '.flac', '.wma', '.aac',

View file

@ -17,7 +17,7 @@ import {
} from '@mui/material'
import { d3roPalette } from '../theme'
import { useI18n } from '../i18n'
import type { HotkeyBinding } from '@shared/types'
import type { HotkeyBinding } from '@d3ro/core/types'
// ── 키 이름 매핑 (Windows) ──────────────────────────────
const KEY_DISPLAY_MAP: Record<number, string> = {

View file

@ -24,7 +24,7 @@ import CancelIcon from '@mui/icons-material/Cancel'
import { MetalCard, PhosphorText, Led, ScreenPanel, PhysicalButton } from './ds'
import { d3roPalette, d3roFontMono, d3roTypo, d3roRadius, d3roShadow } from '../theme'
import { useI18n } from '../i18n'
import type { LicenseInfo, LicenseTier, TierComparison, UsageQuota } from '@shared/types'
import type { LicenseInfo, LicenseTier, TierComparison, UsageQuota } from '@d3ro/core/types'
interface LicenseModalProps {
open: boolean

View file

@ -20,7 +20,7 @@ import type {
UsageQuota,
TierComparison,
ActivateLicenseResult,
} from '@shared/types'
} from '@d3ro/core/types'
export function LicenseTab(): React.ReactElement {
const { t } = useI18n()

View file

@ -19,7 +19,7 @@ import { d3roPalette, d3roFontMono, d3roShadow } from '../theme'
import { Led } from './ds'
import { HotkeyRecordModal } from './HotkeyRecordModal'
import { useI18n } from '../i18n'
import type { HotkeyBinding, AudioDevice } from '@shared/types'
import type { HotkeyBinding, AudioDevice } from '@d3ro/core/types'
interface OnboardingModalProps {
open: boolean
@ -47,7 +47,7 @@ export function OnboardingModal({ open, onClose }: OnboardingModalProps): React.
const handleFinish = () => {
// 온보딩 완료 플래그 저장
window.electronAPI.config.set({ key: 'onboardingCompleted' as keyof import('@shared/types').AppConfig, value: true as never })
window.electronAPI.config.set({ key: 'onboardingCompleted' as keyof import('@d3ro/core/types').AppConfig, value: true as never })
onClose()
}

View file

@ -7,7 +7,7 @@ import LockIcon from '@mui/icons-material/Lock'
import { d3roPalette, d3roFontMono, d3roTypo, d3roRadius } from '../theme'
import { useProFeature } from '../hooks/useProFeature'
import { useI18n } from '../i18n'
import type { Feature } from '@shared/types'
import type { Feature } from '@d3ro/core/types'
interface ProBadgeProps {
feature: Feature

View file

@ -36,8 +36,8 @@ import { HotkeyRecordModal } from './HotkeyRecordModal'
import { LicenseTab } from './LicenseTab'
import { useI18n, LOCALE_META } from '../i18n'
import type { Locale } from '../i18n'
import type { ThemeMode, AppConfig, HotkeyBinding, AudioDevice } from '@shared/types'
import { Feature } from '@shared/types'
import type { ThemeMode, AppConfig, HotkeyBinding, AudioDevice } from '@d3ro/core/types'
import { Feature } from '@d3ro/core/types'
interface SettingsModalProps {
open: boolean
@ -840,7 +840,7 @@ export function SettingsModal({ open, onClose }: SettingsModalProps): React.Reac
size="small"
onClick={() => {
window.electronAPI.config.set({
key: 'onboardingCompleted' as keyof import('@shared/types').AppConfig,
key: 'onboardingCompleted' as keyof import('@d3ro/core/types').AppConfig,
value: false as never,
})
onClose()

View file

@ -9,7 +9,7 @@ import { Led } from './ds'
import { d3roPalette, d3roFontMono, d3roTypo, d3roShadow, d3roRadius } from '../theme'
import { OllamaGuideModal } from './OllamaGuideModal'
import { useI18n } from '../i18n'
import type { LLMStatus } from '@shared/types'
import type { LLMStatus } from '@d3ro/core/types'
export function StatusBar(): React.ReactElement {
const { t } = useI18n()

View file

@ -11,7 +11,7 @@ import { MetalCard, PhosphorText, Led, PhysicalButton } from './ds'
import { PageHeader, EmptyStateCard } from './shared'
import { d3roPalette, d3roFontMono, d3roTypo, d3roRadius } from '../theme'
import { useI18n } from '../i18n'
import type { DictationTemplate, TemplateField, TemplateSessionInfo } from '@shared/types'
import type { DictationTemplate, TemplateField, TemplateSessionInfo } from '@d3ro/core/types'
export function TemplateSection(): React.ReactElement {
const { t } = useI18n()

View file

@ -16,7 +16,7 @@ import LockIcon from '@mui/icons-material/Lock'
import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'
import { d3roPalette, d3roFontMono, d3roTypo, d3roRadius, d3roShadow } from '../theme'
import { useI18n } from '../i18n'
import type { UpgradePromptEvent, UsageQuota } from '@shared/types'
import type { UpgradePromptEvent, UsageQuota } from '@d3ro/core/types'
export function UpgradePromptModal(): React.ReactElement {
const { t } = useI18n()

View file

@ -9,7 +9,7 @@ import { ExportMenu } from './ExportMenu'
import { PhysicalButton } from '../ds/PhysicalButton'
import { d3roPalette, d3roTypo } from '../../theme'
import { useI18n } from '../../i18n'
import type { MeetingExportFormat } from '@shared/types'
import type { MeetingExportFormat } from '@d3ro/core/types'
interface DocumentTabDoc {
id: string

View file

@ -7,7 +7,7 @@ import FileDownloadIcon from '@mui/icons-material/FileDownload'
import { PhysicalButton } from '../ds/PhysicalButton'
import { d3roPalette, d3roTypo, d3roFontMono, d3roRadius, d3roShadow } from '../../theme'
import { useI18n } from '../../i18n'
import type { MeetingExportFormat } from '@shared/types'
import type { MeetingExportFormat } from '@d3ro/core/types'
interface ExportMenuProps {
onExport: (format: MeetingExportFormat) => void

View file

@ -11,7 +11,7 @@ import { PhosphorText } from '../ds/PhosphorText'
import { PhysicalButton } from '../ds/PhysicalButton'
import { d3roPalette, d3roFontMono, d3roTypo, d3roShadow } from '../../theme'
import { useI18n } from '../../i18n'
import type { MeetingChatMessage } from '@shared/types'
import type { MeetingChatMessage } from '@d3ro/core/types'
interface MeetingChatPanelProps {
sessionId: string

View file

@ -26,7 +26,7 @@ import type {
MeetingDocument,
MeetingDocTemplate,
MeetingExportFormat,
} from '@shared/types'
} from '@d3ro/core/types'
interface MeetingDetailTabsProps {
detail: MeetingSessionDetail

View file

@ -14,7 +14,7 @@ import { MetalCard, Led } from '../ds'
import { d3roPalette, d3roFontMono, d3roTypo, d3roRadius } from '../../theme'
import { useI18n } from '../../i18n'
import { formatDuration } from '../../utils/formatters'
import type { HistoryEntry, MemoTag, MeetingSummaryResult } from '@shared/types'
import type { HistoryEntry, MemoTag, MeetingSummaryResult } from '@d3ro/core/types'
interface HistoryEntryCardProps {
entry: HistoryEntry

View file

@ -2,8 +2,8 @@
// Pro feature gating hook: checks access, subscribes to tier changes
import { useState, useEffect, useCallback } from 'react'
import { Feature } from '@shared/types'
import type { FeatureAccess } from '@shared/types'
import { Feature } from '@d3ro/core/types'
import type { FeatureAccess } from '@d3ro/core/types'
interface UseProFeatureResult {
/** Feature is unlocked for current tier */

View file

@ -15,7 +15,7 @@ import { PageHeader, EmptyStateCard } from '../components/shared'
import { d3roPalette, d3roFontMono, d3roTypo, d3roRadius } from '../theme'
import { useI18n } from '../i18n'
import { TemplateSection } from '../components/TemplateSection'
import type { VoiceCommandRule, VoiceCommandKeyword, KeywordMatchMode, LLMChain, ChainStep } from '@shared/types'
import type { VoiceCommandRule, VoiceCommandKeyword, KeywordMatchMode, LLMChain, ChainStep } from '@d3ro/core/types'
interface CustomInstruction {
id: string
@ -69,10 +69,10 @@ export function CommandsPage(): React.ReactElement {
const newId = activeId === id ? null : id
setActiveId(newId)
if (newId) {
window.electronAPI.config.set({ key: 'activeInstructionId' as keyof import('@shared/types').AppConfig, value: newId as never })
window.electronAPI.config.set({ key: 'activeInstructionId' as keyof import('@d3ro/core/types').AppConfig, value: newId as never })
window.electronAPI.config.set({ key: 'defaultLLMAction', value: 'custom' })
} else {
window.electronAPI.config.set({ key: 'activeInstructionId' as keyof import('@shared/types').AppConfig, value: '' as never })
window.electronAPI.config.set({ key: 'activeInstructionId' as keyof import('@d3ro/core/types').AppConfig, value: '' as never })
window.electronAPI.config.set({ key: 'defaultLLMAction', value: 'none' })
}
}

View file

@ -10,7 +10,7 @@ import { d3roPalette, d3roTypo } from '../theme'
import { useI18n } from '../i18n'
import { formatRecordingTime, formatRecordingTimeUnit, formatNumber, getDateKey } from '../utils/formatters'
import { FileDropZone } from '../components/FileDropZone'
import type { StatsSummary, HistoryEntry, HotkeyBinding, CaptionState, LicenseTier, UsageQuota } from '@shared/types'
import type { StatsSummary, HistoryEntry, HotkeyBinding, CaptionState, LicenseTier, UsageQuota } from '@d3ro/core/types'
// ── 메인 컴포넌트 ─────────────────────────────────────

View file

@ -10,7 +10,7 @@ import { MetalCard, PhosphorText } from '../components/ds'
import { PageHeader, SearchInput, EmptyStateCard } from '../components/shared'
import { d3roPalette, d3roFontMono, d3roTypo } from '../theme'
import { useI18n } from '../i18n'
import type { DictionaryEntry, DictionaryPage as DictPageData } from '@shared/types'
import type { DictionaryEntry, DictionaryPage as DictPageData } from '@d3ro/core/types'
const PAGE_SIZE = 50

View file

@ -10,7 +10,7 @@ import { d3roPalette, d3roTypo, d3roFontMono, d3roRadius } from '../theme'
import { useI18n } from '../i18n'
import { getDateKey } from '../utils/formatters'
import { EmptyStateCard, SearchInput, PageHeader, HistoryEntryCard } from '../components/shared'
import type { HistoryEntry, HistoryPage as HistoryPageData, TagCount } from '@shared/types'
import type { HistoryEntry, HistoryPage as HistoryPageData, TagCount } from '@d3ro/core/types'
const PAGE_SIZE = 50

View file

@ -14,7 +14,7 @@ import { MetalCard, PhosphorText, Led, PhysicalButton, ScreenPanel } from '../co
import { PageHeader, EmptyStateCard } from '../components/shared'
import { d3roPalette, d3roFontMono, d3roTypo } from '../theme'
import { useI18n } from '../i18n'
import type { RAGDocument, RAGQueryResult, RAGIndexProgress } from '@shared/types'
import type { RAGDocument, RAGQueryResult, RAGIndexProgress } from '@d3ro/core/types'
export function KnowledgeBasePage(): React.ReactElement {
const { t } = useI18n()

View file

@ -25,7 +25,7 @@ import type {
MeetingProcessingProgress,
CaptionSegment,
MeetingMemo,
} from '@shared/types'
} from '@d3ro/core/types'
type MeetingView = 'list' | 'recording' | 'detail'

View file

@ -17,7 +17,7 @@ import type {
ConversationState,
ConversationMessage,
ConversationAssistantDelta,
} from '@shared/types'
} from '@d3ro/core/types'
export function VoiceConversationPage(): React.ReactElement {
const { t } = useI18n()

View file

@ -3,7 +3,7 @@
// CSS Custom Properties 기반: d3roPalette가 var()를 사용하여 테마 전환 시 자동 반응.
import { createTheme, type Theme } from '@mui/material/styles'
import type { ThemeMode } from '@shared/types'
import type { ThemeMode } from '@d3ro/core/types'
// ── 테마 키 타입 ────────────────────────────────────────────
type ThemeKey = 'dark' | 'light' | 'nord' | 'solarized' | 'catppuccin' | 'dracula'