markupr 2.1.8 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) hide show
  1. package/README.md +292 -15
  2. package/dist/cli/index.mjs +3593 -0
  3. package/dist/main/index.mjs +743 -220
  4. package/dist/mcp/index.mjs +4053 -0
  5. package/package.json +32 -7
  6. package/.claude/commands/review-feedback.md +0 -47
  7. package/.eslintrc.json +0 -35
  8. package/.github/CODEOWNERS +0 -16
  9. package/.github/FUNDING.yml +0 -1
  10. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -56
  11. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -54
  12. package/.github/PULL_REQUEST_TEMPLATE.md +0 -89
  13. package/.github/dependabot.yml +0 -70
  14. package/.github/workflows/ci.yml +0 -184
  15. package/.github/workflows/deploy-landing.yml +0 -134
  16. package/.github/workflows/nightly.yml +0 -288
  17. package/.github/workflows/release.yml +0 -318
  18. package/CHANGELOG.md +0 -127
  19. package/CLAUDE.md +0 -137
  20. package/CODE_OF_CONDUCT.md +0 -9
  21. package/CONTRIBUTING.md +0 -390
  22. package/PRODUCT_VISION.md +0 -277
  23. package/SECURITY.md +0 -51
  24. package/SIGNING_INSTRUCTIONS.md +0 -284
  25. package/assets/DMG_BACKGROUND_INSTRUCTIONS.md +0 -130
  26. package/assets/svg-source/dmg-background.svg +0 -70
  27. package/assets/svg-source/icon.svg +0 -20
  28. package/assets/svg-source/tray-icon-processing.svg +0 -7
  29. package/assets/svg-source/tray-icon-recording.svg +0 -7
  30. package/assets/svg-source/tray-icon.svg +0 -6
  31. package/assets/tray-complete.png +0 -0
  32. package/assets/tray-complete@2x.png +0 -0
  33. package/assets/tray-completeTemplate.png +0 -0
  34. package/assets/tray-completeTemplate@2x.png +0 -0
  35. package/assets/tray-error.png +0 -0
  36. package/assets/tray-error@2x.png +0 -0
  37. package/assets/tray-errorTemplate.png +0 -0
  38. package/assets/tray-errorTemplate@2x.png +0 -0
  39. package/assets/tray-icon-processing.png +0 -0
  40. package/assets/tray-icon-processing@2x.png +0 -0
  41. package/assets/tray-icon-processingTemplate.png +0 -0
  42. package/assets/tray-icon-processingTemplate@2x.png +0 -0
  43. package/assets/tray-icon-recording.png +0 -0
  44. package/assets/tray-icon-recording@2x.png +0 -0
  45. package/assets/tray-icon-recordingTemplate.png +0 -0
  46. package/assets/tray-icon-recordingTemplate@2x.png +0 -0
  47. package/assets/tray-icon.png +0 -0
  48. package/assets/tray-icon@2x.png +0 -0
  49. package/assets/tray-iconTemplate.png +0 -0
  50. package/assets/tray-iconTemplate@2x.png +0 -0
  51. package/assets/tray-idle.png +0 -0
  52. package/assets/tray-idle@2x.png +0 -0
  53. package/assets/tray-idleTemplate.png +0 -0
  54. package/assets/tray-idleTemplate@2x.png +0 -0
  55. package/assets/tray-processing-0.png +0 -0
  56. package/assets/tray-processing-0@2x.png +0 -0
  57. package/assets/tray-processing-0Template.png +0 -0
  58. package/assets/tray-processing-0Template@2x.png +0 -0
  59. package/assets/tray-processing-1.png +0 -0
  60. package/assets/tray-processing-1@2x.png +0 -0
  61. package/assets/tray-processing-1Template.png +0 -0
  62. package/assets/tray-processing-1Template@2x.png +0 -0
  63. package/assets/tray-processing-2.png +0 -0
  64. package/assets/tray-processing-2@2x.png +0 -0
  65. package/assets/tray-processing-2Template.png +0 -0
  66. package/assets/tray-processing-2Template@2x.png +0 -0
  67. package/assets/tray-processing-3.png +0 -0
  68. package/assets/tray-processing-3@2x.png +0 -0
  69. package/assets/tray-processing-3Template.png +0 -0
  70. package/assets/tray-processing-3Template@2x.png +0 -0
  71. package/assets/tray-processing.png +0 -0
  72. package/assets/tray-processing@2x.png +0 -0
  73. package/assets/tray-processingTemplate.png +0 -0
  74. package/assets/tray-processingTemplate@2x.png +0 -0
  75. package/assets/tray-recording.png +0 -0
  76. package/assets/tray-recording@2x.png +0 -0
  77. package/assets/tray-recordingTemplate.png +0 -0
  78. package/assets/tray-recordingTemplate@2x.png +0 -0
  79. package/build/DMG_BACKGROUND_SPEC.md +0 -50
  80. package/build/dmg-background.png +0 -0
  81. package/build/dmg-background@2x.png +0 -0
  82. package/build/entitlements.mac.inherit.plist +0 -27
  83. package/build/entitlements.mac.plist +0 -41
  84. package/build/favicon-16.png +0 -0
  85. package/build/favicon-180.png +0 -0
  86. package/build/favicon-192.png +0 -0
  87. package/build/favicon-32.png +0 -0
  88. package/build/favicon-48.png +0 -0
  89. package/build/favicon-512.png +0 -0
  90. package/build/favicon-64.png +0 -0
  91. package/build/icon-128.png +0 -0
  92. package/build/icon-16.png +0 -0
  93. package/build/icon-24.png +0 -0
  94. package/build/icon-256.png +0 -0
  95. package/build/icon-32.png +0 -0
  96. package/build/icon-48.png +0 -0
  97. package/build/icon-64.png +0 -0
  98. package/build/icon.icns +0 -0
  99. package/build/icon.ico +0 -0
  100. package/build/icon.iconset/icon_128x128.png +0 -0
  101. package/build/icon.iconset/icon_128x128@2x.png +0 -0
  102. package/build/icon.iconset/icon_16x16.png +0 -0
  103. package/build/icon.iconset/icon_16x16@2x.png +0 -0
  104. package/build/icon.iconset/icon_256x256.png +0 -0
  105. package/build/icon.iconset/icon_256x256@2x.png +0 -0
  106. package/build/icon.iconset/icon_32x32.png +0 -0
  107. package/build/icon.iconset/icon_32x32@2x.png +0 -0
  108. package/build/icon.iconset/icon_512x512.png +0 -0
  109. package/build/icon.iconset/icon_512x512@2x.png +0 -0
  110. package/build/icon.png +0 -0
  111. package/build/installer-header.bmp +0 -0
  112. package/build/installer-header.png +0 -0
  113. package/build/installer-sidebar.bmp +0 -0
  114. package/build/installer-sidebar.png +0 -0
  115. package/build/installer.nsh +0 -45
  116. package/build/overlay-processing.png +0 -0
  117. package/build/overlay-recording.png +0 -0
  118. package/build/toolbar-record.png +0 -0
  119. package/build/toolbar-screenshot.png +0 -0
  120. package/build/toolbar-settings.png +0 -0
  121. package/build/toolbar-stop.png +0 -0
  122. package/dist/preload/index.mjs +0 -907
  123. package/dist/renderer/assets/index-CCmUjl9K.js +0 -19495
  124. package/dist/renderer/assets/index-CUqz_Gs6.css +0 -2270
  125. package/dist/renderer/index.html +0 -27
  126. package/docs/AI_AGENT_QUICKSTART.md +0 -42
  127. package/docs/AI_PIPELINE_DESIGN.md +0 -595
  128. package/docs/API.md +0 -514
  129. package/docs/ARCHITECTURE.md +0 -460
  130. package/docs/CONFIGURATION.md +0 -336
  131. package/docs/DEVELOPMENT.md +0 -508
  132. package/docs/EXPORT_FORMATS.md +0 -451
  133. package/docs/GETTING_STARTED.md +0 -236
  134. package/docs/KEYBOARD_SHORTCUTS.md +0 -334
  135. package/docs/TROUBLESHOOTING.md +0 -418
  136. package/docs/landing/index.html +0 -672
  137. package/docs/landing/script.js +0 -342
  138. package/docs/landing/styles.css +0 -1543
  139. package/electron-builder.yml +0 -140
  140. package/electron.vite.config.ts +0 -63
  141. package/railway.json +0 -12
  142. package/scripts/build.mjs +0 -51
  143. package/scripts/generate-icons.mjs +0 -314
  144. package/scripts/generate-installer-images.cjs +0 -253
  145. package/scripts/generate-tray-icons.mjs +0 -258
  146. package/scripts/notarize.cjs +0 -180
  147. package/scripts/one-click-clean-test.sh +0 -147
  148. package/scripts/postinstall.mjs +0 -36
  149. package/scripts/setup-markupr.sh +0 -55
  150. package/setup +0 -17
  151. package/site/index.html +0 -1835
  152. package/site/package.json +0 -11
  153. package/site/railway.json +0 -12
  154. package/site/server.js +0 -31
  155. package/src/main/AutoUpdater.ts +0 -392
  156. package/src/main/CrashRecovery.ts +0 -655
  157. package/src/main/ErrorHandler.ts +0 -703
  158. package/src/main/HotkeyManager.ts +0 -399
  159. package/src/main/MenuManager.ts +0 -529
  160. package/src/main/PermissionManager.ts +0 -420
  161. package/src/main/SessionController.ts +0 -1465
  162. package/src/main/TrayManager.ts +0 -540
  163. package/src/main/ai/AIPipelineManager.ts +0 -199
  164. package/src/main/ai/ClaudeAnalyzer.ts +0 -339
  165. package/src/main/ai/ImageOptimizer.ts +0 -176
  166. package/src/main/ai/StructuredMarkdownBuilder.ts +0 -379
  167. package/src/main/ai/index.ts +0 -16
  168. package/src/main/ai/types.ts +0 -258
  169. package/src/main/analysis/ClarificationGenerator.ts +0 -385
  170. package/src/main/analysis/FeedbackAnalyzer.ts +0 -531
  171. package/src/main/analysis/index.ts +0 -19
  172. package/src/main/audio/AudioCapture.ts +0 -978
  173. package/src/main/audio/audioUtils.ts +0 -100
  174. package/src/main/audio/index.ts +0 -20
  175. package/src/main/capture/index.ts +0 -1
  176. package/src/main/index.ts +0 -1693
  177. package/src/main/ipc/captureHandlers.ts +0 -272
  178. package/src/main/ipc/index.ts +0 -45
  179. package/src/main/ipc/outputHandlers.ts +0 -302
  180. package/src/main/ipc/sessionHandlers.ts +0 -56
  181. package/src/main/ipc/settingsHandlers.ts +0 -471
  182. package/src/main/ipc/types.ts +0 -56
  183. package/src/main/ipc/windowHandlers.ts +0 -277
  184. package/src/main/output/ClipboardService.ts +0 -369
  185. package/src/main/output/ExportService.ts +0 -539
  186. package/src/main/output/FileManager.ts +0 -416
  187. package/src/main/output/MarkdownGenerator.ts +0 -791
  188. package/src/main/output/MarkdownPatcher.ts +0 -299
  189. package/src/main/output/index.ts +0 -186
  190. package/src/main/output/sessionAdapter.ts +0 -207
  191. package/src/main/output/templates/html-template.ts +0 -553
  192. package/src/main/pipeline/FrameExtractor.ts +0 -330
  193. package/src/main/pipeline/PostProcessor.ts +0 -399
  194. package/src/main/pipeline/TranscriptAnalyzer.ts +0 -226
  195. package/src/main/pipeline/index.ts +0 -36
  196. package/src/main/platform/WindowsTaskbar.ts +0 -600
  197. package/src/main/platform/index.ts +0 -16
  198. package/src/main/settings/SettingsManager.ts +0 -730
  199. package/src/main/settings/index.ts +0 -19
  200. package/src/main/transcription/ModelDownloadManager.ts +0 -494
  201. package/src/main/transcription/TierManager.ts +0 -219
  202. package/src/main/transcription/TranscriptionRecoveryService.ts +0 -340
  203. package/src/main/transcription/WhisperService.ts +0 -748
  204. package/src/main/transcription/index.ts +0 -56
  205. package/src/main/transcription/types.ts +0 -135
  206. package/src/main/windows/PopoverManager.ts +0 -284
  207. package/src/main/windows/TaskbarIntegration.ts +0 -452
  208. package/src/main/windows/index.ts +0 -23
  209. package/src/preload/index.ts +0 -1047
  210. package/src/renderer/App.tsx +0 -515
  211. package/src/renderer/AppWrapper.tsx +0 -28
  212. package/src/renderer/assets/logo-dark.svg +0 -7
  213. package/src/renderer/assets/logo.svg +0 -7
  214. package/src/renderer/audio/AudioCaptureRenderer.ts +0 -454
  215. package/src/renderer/capture/ScreenRecordingRenderer.ts +0 -492
  216. package/src/renderer/components/AnnotationOverlay.tsx +0 -836
  217. package/src/renderer/components/AudioWaveform.tsx +0 -811
  218. package/src/renderer/components/ClarificationQuestions.tsx +0 -656
  219. package/src/renderer/components/CountdownTimer.tsx +0 -495
  220. package/src/renderer/components/CrashRecoveryDialog.tsx +0 -632
  221. package/src/renderer/components/DonateButton.tsx +0 -127
  222. package/src/renderer/components/ErrorBoundary.tsx +0 -308
  223. package/src/renderer/components/ExportDialog.tsx +0 -872
  224. package/src/renderer/components/HotkeyHint.tsx +0 -261
  225. package/src/renderer/components/KeyboardShortcuts.tsx +0 -787
  226. package/src/renderer/components/ModelDownloadDialog.tsx +0 -844
  227. package/src/renderer/components/Onboarding.tsx +0 -1830
  228. package/src/renderer/components/ProcessingOverlay.tsx +0 -157
  229. package/src/renderer/components/RecordingOverlay.tsx +0 -423
  230. package/src/renderer/components/SessionHistory.tsx +0 -1746
  231. package/src/renderer/components/SessionReview.tsx +0 -1321
  232. package/src/renderer/components/SettingsPanel.tsx +0 -217
  233. package/src/renderer/components/Skeleton.tsx +0 -347
  234. package/src/renderer/components/StatusIndicator.tsx +0 -86
  235. package/src/renderer/components/ThemeProvider.tsx +0 -429
  236. package/src/renderer/components/Tooltip.tsx +0 -370
  237. package/src/renderer/components/TranscriptionPreview.tsx +0 -183
  238. package/src/renderer/components/TranscriptionTierSelector.tsx +0 -640
  239. package/src/renderer/components/UpdateNotification.tsx +0 -377
  240. package/src/renderer/components/WindowSelector.tsx +0 -947
  241. package/src/renderer/components/index.ts +0 -99
  242. package/src/renderer/components/primitives/ApiKeyInput.tsx +0 -98
  243. package/src/renderer/components/primitives/ColorPicker.tsx +0 -65
  244. package/src/renderer/components/primitives/DangerButton.tsx +0 -45
  245. package/src/renderer/components/primitives/DirectoryPicker.tsx +0 -41
  246. package/src/renderer/components/primitives/Dropdown.tsx +0 -34
  247. package/src/renderer/components/primitives/KeyRecorder.tsx +0 -117
  248. package/src/renderer/components/primitives/SettingsSection.tsx +0 -32
  249. package/src/renderer/components/primitives/Slider.tsx +0 -43
  250. package/src/renderer/components/primitives/Toggle.tsx +0 -36
  251. package/src/renderer/components/primitives/index.ts +0 -10
  252. package/src/renderer/components/settings/AdvancedTab.tsx +0 -174
  253. package/src/renderer/components/settings/AppearanceTab.tsx +0 -77
  254. package/src/renderer/components/settings/GeneralTab.tsx +0 -40
  255. package/src/renderer/components/settings/HotkeysTab.tsx +0 -79
  256. package/src/renderer/components/settings/RecordingTab.tsx +0 -84
  257. package/src/renderer/components/settings/index.ts +0 -9
  258. package/src/renderer/components/settings/settingsStyles.ts +0 -673
  259. package/src/renderer/components/settings/tabConfig.tsx +0 -85
  260. package/src/renderer/components/settings/useSettingsPanel.ts +0 -447
  261. package/src/renderer/contexts/ProcessingContext.tsx +0 -227
  262. package/src/renderer/contexts/RecordingContext.tsx +0 -683
  263. package/src/renderer/contexts/UIContext.tsx +0 -326
  264. package/src/renderer/contexts/index.ts +0 -24
  265. package/src/renderer/donateMessages.ts +0 -69
  266. package/src/renderer/hooks/index.ts +0 -75
  267. package/src/renderer/hooks/useAnimation.tsx +0 -544
  268. package/src/renderer/hooks/useTheme.ts +0 -313
  269. package/src/renderer/index.html +0 -26
  270. package/src/renderer/main.tsx +0 -52
  271. package/src/renderer/styles/animations.css +0 -1093
  272. package/src/renderer/styles/app-shell.css +0 -662
  273. package/src/renderer/styles/globals.css +0 -515
  274. package/src/renderer/styles/theme.ts +0 -578
  275. package/src/renderer/types/electron.d.ts +0 -385
  276. package/src/shared/hotkeys.ts +0 -283
  277. package/src/shared/types.ts +0 -809
  278. package/tests/clipboard.test.ts +0 -228
  279. package/tests/e2e/criticalPaths.test.ts +0 -594
  280. package/tests/feedbackAnalyzer.test.ts +0 -303
  281. package/tests/integration/sessionFlow.test.ts +0 -583
  282. package/tests/markdownGenerator.test.ts +0 -418
  283. package/tests/output.test.ts +0 -96
  284. package/tests/setup.ts +0 -486
  285. package/tests/unit/appIntegration.test.ts +0 -676
  286. package/tests/unit/appViewState.test.ts +0 -281
  287. package/tests/unit/audioIpcChannels.test.ts +0 -17
  288. package/tests/unit/exportService.test.ts +0 -492
  289. package/tests/unit/hotkeys.test.ts +0 -92
  290. package/tests/unit/navigationPreload.test.ts +0 -94
  291. package/tests/unit/onboardingFlow.test.ts +0 -345
  292. package/tests/unit/permissionManager.test.ts +0 -175
  293. package/tests/unit/permissionManagerExpanded.test.ts +0 -296
  294. package/tests/unit/screenRecordingRenderer.test.ts +0 -368
  295. package/tests/unit/sessionController.test.ts +0 -515
  296. package/tests/unit/tierManager.test.ts +0 -61
  297. package/tests/unit/tierManagerExpanded.test.ts +0 -142
  298. package/tests/unit/transcriptAnalyzer.test.ts +0 -64
  299. package/tsconfig.json +0 -25
  300. package/vitest.config.ts +0 -46
@@ -1,676 +0,0 @@
1
- /**
2
- * App.tsx Integration Logic Tests (Expanded)
3
- *
4
- * Tests the view-state management, navigation event handling,
5
- * screen recording sync, and component rendering conditions.
6
- *
7
- * Builds on appViewState.test.ts with deeper integration behavior:
8
- * - Navigation events switch views correctly
9
- * - Session state changes reset view
10
- * - Screen recording sync behavior
11
- * - Popover state mapping for all transitions
12
- * - Error/complete state handling
13
- * - Countdown timer integration
14
- * - Crash recovery rendering conditions
15
- */
16
-
17
- import { describe, it, expect } from 'vitest';
18
- import type { SessionState, SessionStatusPayload } from '../../src/shared/types';
19
-
20
- // ============================================================================
21
- // Replicate App.tsx logic for testing
22
- // ============================================================================
23
-
24
- type AppView = 'main' | 'settings' | 'history' | 'shortcuts';
25
-
26
- function mapPopoverState(
27
- state: SessionState
28
- ): 'idle' | 'recording' | 'processing' | 'complete' | 'error' {
29
- if (state === 'recording' || state === 'starting') return 'recording';
30
- if (state === 'stopping' || state === 'processing') return 'processing';
31
- if (state === 'complete') return 'complete';
32
- if (state === 'error') return 'error';
33
- return 'idle';
34
- }
35
-
36
- // Simulates the state machine in App component
37
- interface AppState {
38
- currentView: AppView;
39
- showOnboarding: boolean;
40
- showCountdown: boolean;
41
- showExportDialog: boolean;
42
- sessionState: SessionState;
43
- errorMessage: string | null;
44
- reportPath: string | null;
45
- recordingPath: string | null;
46
- sessionDir: string | null;
47
- duration: number;
48
- screenshotCount: number;
49
- transcriptEntries: string[];
50
- liveInterimTranscript: string;
51
- hasTranscriptionCapability: boolean | null;
52
- isMutating: boolean;
53
- settings: { defaultCountdown: number; showAudioWaveform: boolean } | null;
54
- }
55
-
56
- function createInitialState(): AppState {
57
- return {
58
- currentView: 'main',
59
- showOnboarding: false,
60
- showCountdown: false,
61
- showExportDialog: false,
62
- sessionState: 'idle',
63
- errorMessage: null,
64
- reportPath: null,
65
- recordingPath: null,
66
- sessionDir: null,
67
- duration: 0,
68
- screenshotCount: 0,
69
- transcriptEntries: [],
70
- liveInterimTranscript: '',
71
- hasTranscriptionCapability: null,
72
- isMutating: false,
73
- settings: { defaultCountdown: 0, showAudioWaveform: true },
74
- };
75
- }
76
-
77
- // Simulates onStateChange handler
78
- function handleStateChange(appState: AppState, nextState: SessionState): AppState {
79
- const updated = { ...appState, sessionState: nextState };
80
-
81
- if (nextState === 'recording') {
82
- updated.errorMessage = null;
83
- updated.reportPath = null;
84
- updated.recordingPath = null;
85
- updated.sessionDir = null;
86
- updated.transcriptEntries = [];
87
- updated.liveInterimTranscript = '';
88
- updated.currentView = 'main';
89
- updated.showCountdown = false;
90
- }
91
-
92
- if (nextState === 'idle') {
93
- updated.duration = 0;
94
- }
95
-
96
- return updated;
97
- }
98
-
99
- // Simulates navigation event handlers
100
- function handleNavigation(appState: AppState, target: string): AppState {
101
- const updated = { ...appState };
102
-
103
- switch (target) {
104
- case 'settings':
105
- updated.currentView = 'settings';
106
- break;
107
- case 'history':
108
- updated.currentView = 'history';
109
- break;
110
- case 'shortcuts':
111
- updated.currentView = 'shortcuts';
112
- break;
113
- case 'onboarding':
114
- updated.showOnboarding = true;
115
- break;
116
- case 'export':
117
- updated.showExportDialog = true;
118
- break;
119
- }
120
-
121
- return updated;
122
- }
123
-
124
- // Simulates output ready handler
125
- function handleOutputReady(
126
- appState: AppState,
127
- payload: { path?: string; reportPath?: string; recordingPath?: string; sessionDir?: string }
128
- ): AppState {
129
- return {
130
- ...appState,
131
- sessionState: 'complete',
132
- errorMessage: null,
133
- reportPath: payload.path || payload.reportPath || null,
134
- recordingPath: payload.recordingPath || null,
135
- sessionDir: payload.sessionDir || null,
136
- duration: 0,
137
- liveInterimTranscript: '',
138
- };
139
- }
140
-
141
- // Derive computed values
142
- function deriveState(appState: AppState) {
143
- const primaryActionLabel =
144
- appState.sessionState === 'recording' ? 'Stop Session' : 'Start Session';
145
- const primaryActionDisabled =
146
- appState.isMutating ||
147
- appState.sessionState === 'starting' ||
148
- appState.sessionState === 'stopping' ||
149
- appState.sessionState === 'processing';
150
- const manualCaptureDisabled = appState.isMutating || appState.sessionState !== 'recording';
151
- const countdownDuration = appState.settings?.defaultCountdown ?? 0;
152
- const showAudioWaveform = appState.settings?.showAudioWaveform ?? true;
153
-
154
- return {
155
- primaryActionLabel,
156
- primaryActionDisabled,
157
- manualCaptureDisabled,
158
- countdownDuration,
159
- showAudioWaveform,
160
- };
161
- }
162
-
163
- // ============================================================================
164
- // Tests
165
- // ============================================================================
166
-
167
- describe('App Integration Logic', () => {
168
- // ========================================================================
169
- // Navigation events switch views
170
- // ========================================================================
171
-
172
- describe('navigation events', () => {
173
- it('onShowSettings switches to settings view', () => {
174
- const state = handleNavigation(createInitialState(), 'settings');
175
- expect(state.currentView).toBe('settings');
176
- });
177
-
178
- it('onShowHistory switches to history view', () => {
179
- const state = handleNavigation(createInitialState(), 'history');
180
- expect(state.currentView).toBe('history');
181
- });
182
-
183
- it('onShowShortcuts switches to shortcuts view', () => {
184
- const state = handleNavigation(createInitialState(), 'shortcuts');
185
- expect(state.currentView).toBe('shortcuts');
186
- });
187
-
188
- it('onShowOnboarding shows onboarding overlay', () => {
189
- const state = handleNavigation(createInitialState(), 'onboarding');
190
- expect(state.showOnboarding).toBe(true);
191
- });
192
-
193
- it('onShowExport shows export dialog', () => {
194
- const state = handleNavigation(createInitialState(), 'export');
195
- expect(state.showExportDialog).toBe(true);
196
- });
197
-
198
- it('navigation does not affect session state', () => {
199
- let state = createInitialState();
200
- state.sessionState = 'recording';
201
- state = handleNavigation(state, 'settings');
202
-
203
- expect(state.sessionState).toBe('recording');
204
- expect(state.currentView).toBe('settings');
205
- });
206
- });
207
-
208
- // ========================================================================
209
- // Session state changes
210
- // ========================================================================
211
-
212
- describe('session state changes', () => {
213
- it('recording resets view to main', () => {
214
- let state = createInitialState();
215
- state.currentView = 'settings';
216
-
217
- state = handleStateChange(state, 'recording');
218
-
219
- expect(state.currentView).toBe('main');
220
- });
221
-
222
- it('recording clears error message', () => {
223
- let state = createInitialState();
224
- state.errorMessage = 'Previous error';
225
-
226
- state = handleStateChange(state, 'recording');
227
-
228
- expect(state.errorMessage).toBeNull();
229
- });
230
-
231
- it('recording clears report path', () => {
232
- let state = createInitialState();
233
- state.reportPath = '/old/report.md';
234
-
235
- state = handleStateChange(state, 'recording');
236
-
237
- expect(state.reportPath).toBeNull();
238
- });
239
-
240
- it('recording clears recording path', () => {
241
- let state = createInitialState();
242
- state.recordingPath = '/old/recording.webm';
243
-
244
- state = handleStateChange(state, 'recording');
245
-
246
- expect(state.recordingPath).toBeNull();
247
- });
248
-
249
- it('recording clears session dir', () => {
250
- let state = createInitialState();
251
- state.sessionDir = '/old/session';
252
-
253
- state = handleStateChange(state, 'recording');
254
-
255
- expect(state.sessionDir).toBeNull();
256
- });
257
-
258
- it('recording clears transcript entries', () => {
259
- let state = createInitialState();
260
- state.transcriptEntries = ['old entry'];
261
- state.liveInterimTranscript = 'typing...';
262
-
263
- state = handleStateChange(state, 'recording');
264
-
265
- expect(state.transcriptEntries).toEqual([]);
266
- expect(state.liveInterimTranscript).toBe('');
267
- });
268
-
269
- it('recording dismisses countdown', () => {
270
- let state = createInitialState();
271
- state.showCountdown = true;
272
-
273
- state = handleStateChange(state, 'recording');
274
-
275
- expect(state.showCountdown).toBe(false);
276
- });
277
-
278
- it('idle resets duration to 0', () => {
279
- let state = createInitialState();
280
- state.duration = 30000;
281
-
282
- state = handleStateChange(state, 'idle');
283
-
284
- expect(state.duration).toBe(0);
285
- });
286
-
287
- it('complete does not reset view', () => {
288
- let state = createInitialState();
289
- state.currentView = 'settings';
290
-
291
- state = handleStateChange(state, 'complete');
292
-
293
- expect(state.currentView).toBe('settings');
294
- });
295
-
296
- it('error does not reset view', () => {
297
- let state = createInitialState();
298
- state.currentView = 'history';
299
-
300
- state = handleStateChange(state, 'error');
301
-
302
- expect(state.currentView).toBe('history');
303
- });
304
- });
305
-
306
- // ========================================================================
307
- // Output ready handler
308
- // ========================================================================
309
-
310
- describe('output ready handler', () => {
311
- it('sets state to complete', () => {
312
- let state = createInitialState();
313
- state.sessionState = 'processing';
314
-
315
- state = handleOutputReady(state, { path: '/report.md' });
316
-
317
- expect(state.sessionState).toBe('complete');
318
- });
319
-
320
- it('sets report path from payload.path', () => {
321
- const state = handleOutputReady(createInitialState(), { path: '/output/report.md' });
322
- expect(state.reportPath).toBe('/output/report.md');
323
- });
324
-
325
- it('sets report path from payload.reportPath', () => {
326
- const state = handleOutputReady(createInitialState(), { reportPath: '/output/report.md' });
327
- expect(state.reportPath).toBe('/output/report.md');
328
- });
329
-
330
- it('sets recording path', () => {
331
- const state = handleOutputReady(createInitialState(), {
332
- path: '/report.md',
333
- recordingPath: '/output/recording.webm',
334
- });
335
- expect(state.recordingPath).toBe('/output/recording.webm');
336
- });
337
-
338
- it('sets session dir', () => {
339
- const state = handleOutputReady(createInitialState(), {
340
- path: '/report.md',
341
- sessionDir: '/output/session-123',
342
- });
343
- expect(state.sessionDir).toBe('/output/session-123');
344
- });
345
-
346
- it('clears error message', () => {
347
- let state = createInitialState();
348
- state.errorMessage = 'old error';
349
-
350
- state = handleOutputReady(state, { path: '/report.md' });
351
-
352
- expect(state.errorMessage).toBeNull();
353
- });
354
-
355
- it('resets duration and live transcript', () => {
356
- let state = createInitialState();
357
- state.duration = 60000;
358
- state.liveInterimTranscript = 'something';
359
-
360
- state = handleOutputReady(state, { path: '/report.md' });
361
-
362
- expect(state.duration).toBe(0);
363
- expect(state.liveInterimTranscript).toBe('');
364
- });
365
- });
366
-
367
- // ========================================================================
368
- // Popover state mapping (comprehensive)
369
- // ========================================================================
370
-
371
- describe('popover state mapping', () => {
372
- const cases: Array<[SessionState, string]> = [
373
- ['idle', 'idle'],
374
- ['starting', 'recording'],
375
- ['recording', 'recording'],
376
- ['stopping', 'processing'],
377
- ['processing', 'processing'],
378
- ['complete', 'complete'],
379
- ['error', 'error'],
380
- ];
381
-
382
- cases.forEach(([input, expected]) => {
383
- it(`maps '${input}' to '${expected}'`, () => {
384
- expect(mapPopoverState(input)).toBe(expected);
385
- });
386
- });
387
- });
388
-
389
- // ========================================================================
390
- // Derived state
391
- // ========================================================================
392
-
393
- describe('derived state', () => {
394
- it('primary action label is "Start Session" when idle', () => {
395
- const state = createInitialState();
396
- expect(deriveState(state).primaryActionLabel).toBe('Start Session');
397
- });
398
-
399
- it('primary action label is "Stop Session" when recording', () => {
400
- const state = { ...createInitialState(), sessionState: 'recording' as SessionState };
401
- expect(deriveState(state).primaryActionLabel).toBe('Stop Session');
402
- });
403
-
404
- it('primary action disabled during starting', () => {
405
- const state = { ...createInitialState(), sessionState: 'starting' as SessionState };
406
- expect(deriveState(state).primaryActionDisabled).toBe(true);
407
- });
408
-
409
- it('primary action disabled during stopping', () => {
410
- const state = { ...createInitialState(), sessionState: 'stopping' as SessionState };
411
- expect(deriveState(state).primaryActionDisabled).toBe(true);
412
- });
413
-
414
- it('primary action disabled during processing', () => {
415
- const state = { ...createInitialState(), sessionState: 'processing' as SessionState };
416
- expect(deriveState(state).primaryActionDisabled).toBe(true);
417
- });
418
-
419
- it('primary action disabled when mutating', () => {
420
- const state = { ...createInitialState(), isMutating: true };
421
- expect(deriveState(state).primaryActionDisabled).toBe(true);
422
- });
423
-
424
- it('primary action enabled when idle and not mutating', () => {
425
- const state = createInitialState();
426
- expect(deriveState(state).primaryActionDisabled).toBe(false);
427
- });
428
-
429
- it('manual capture enabled only during recording', () => {
430
- const states: SessionState[] = ['idle', 'starting', 'recording', 'stopping', 'processing', 'complete', 'error'];
431
- const results = states.map((s) => {
432
- const state = { ...createInitialState(), sessionState: s };
433
- return deriveState(state).manualCaptureDisabled;
434
- });
435
-
436
- // Only recording (index 2) should be false (enabled)
437
- expect(results).toEqual([true, true, false, true, true, true, true]);
438
- });
439
-
440
- it('countdown duration from settings', () => {
441
- const state = {
442
- ...createInitialState(),
443
- settings: { defaultCountdown: 5, showAudioWaveform: true },
444
- };
445
- expect(deriveState(state).countdownDuration).toBe(5);
446
- });
447
-
448
- it('countdown duration defaults to 0 when settings null', () => {
449
- const state = { ...createInitialState(), settings: null };
450
- expect(deriveState(state).countdownDuration).toBe(0);
451
- });
452
-
453
- it('audio waveform defaults to true when settings null', () => {
454
- const state = { ...createInitialState(), settings: null };
455
- expect(deriveState(state).showAudioWaveform).toBe(true);
456
- });
457
- });
458
-
459
- // ========================================================================
460
- // Countdown integration
461
- // ========================================================================
462
-
463
- describe('countdown integration', () => {
464
- it('shows countdown when idle and countdown > 0', () => {
465
- const state = createInitialState();
466
- state.settings = { defaultCountdown: 3, showAudioWaveform: true };
467
- state.showCountdown = true;
468
-
469
- const shouldRender = state.showCountdown && (state.settings?.defaultCountdown ?? 0) > 0;
470
- expect(shouldRender).toBe(true);
471
- });
472
-
473
- it('does not show countdown when countdown is 0', () => {
474
- const state = createInitialState();
475
- state.settings = { defaultCountdown: 0, showAudioWaveform: true };
476
- state.showCountdown = true;
477
-
478
- const shouldRender = state.showCountdown && (state.settings?.defaultCountdown ?? 0) > 0;
479
- expect(shouldRender).toBe(false);
480
- });
481
-
482
- it('countdown dismissed when recording starts', () => {
483
- let state = createInitialState();
484
- state.showCountdown = true;
485
-
486
- state = handleStateChange(state, 'recording');
487
-
488
- expect(state.showCountdown).toBe(false);
489
- });
490
- });
491
-
492
- // ========================================================================
493
- // Status copy text
494
- // ========================================================================
495
-
496
- describe('status copy text', () => {
497
- function getStatusCopy(
498
- state: SessionState,
499
- errorMessage: string | null = null,
500
- hasTranscription: boolean | null = null
501
- ): { title: string; detail: string } {
502
- switch (state) {
503
- case 'starting':
504
- return { title: 'Preparing Session', detail: 'Initializing microphone and transcription stack.' };
505
- case 'recording':
506
- return { title: 'Recording Live', detail: 'Talk while testing. Pauses, hotkey, and voice cues can trigger captures.' };
507
- case 'stopping':
508
- case 'processing':
509
- return { title: 'Building Report', detail: 'Generating markdown and linking screenshots to context.' };
510
- case 'complete':
511
- return { title: 'Report Ready', detail: 'Markdown path copied to your clipboard.' };
512
- case 'error':
513
- return { title: 'Session Error', detail: errorMessage || 'An unexpected error interrupted this capture.' };
514
- default:
515
- return {
516
- title: 'Ready To Capture',
517
- detail:
518
- hasTranscription === false
519
- ? 'Transcription unavailable. Download a Whisper model, then start.'
520
- : 'Press Cmd+Shift+F to start a fresh feedback pass.',
521
- };
522
- }
523
- }
524
-
525
- it('idle shows ready to capture', () => {
526
- const copy = getStatusCopy('idle');
527
- expect(copy.title).toBe('Ready To Capture');
528
- });
529
-
530
- it('idle shows transcription warning when unavailable', () => {
531
- const copy = getStatusCopy('idle', null, false);
532
- expect(copy.detail).toContain('Transcription unavailable');
533
- });
534
-
535
- it('recording shows recording live', () => {
536
- const copy = getStatusCopy('recording');
537
- expect(copy.title).toBe('Recording Live');
538
- });
539
-
540
- it('processing shows building report', () => {
541
- const copy = getStatusCopy('processing');
542
- expect(copy.title).toBe('Building Report');
543
- });
544
-
545
- it('error shows custom message', () => {
546
- const copy = getStatusCopy('error', 'Mic disconnected');
547
- expect(copy.detail).toBe('Mic disconnected');
548
- });
549
-
550
- it('error shows default message when no custom message', () => {
551
- const copy = getStatusCopy('error');
552
- expect(copy.detail).toContain('unexpected error');
553
- });
554
- });
555
-
556
- // ========================================================================
557
- // Crash recovery conditions
558
- // ========================================================================
559
-
560
- describe('crash recovery rendering', () => {
561
- it('shows dialog when incomplete session found and not checking', () => {
562
- const incompleteSession = { id: 'sess-crash', startTime: Date.now() - 60000 };
563
- const isCheckingRecovery = false;
564
-
565
- const showDialog = !!incompleteSession && !isCheckingRecovery;
566
- expect(showDialog).toBe(true);
567
- });
568
-
569
- it('hides dialog while checking recovery', () => {
570
- const incompleteSession = { id: 'sess-crash', startTime: Date.now() - 60000 };
571
- const isCheckingRecovery = true;
572
-
573
- const showDialog = !!incompleteSession && !isCheckingRecovery;
574
- expect(showDialog).toBe(false);
575
- });
576
-
577
- it('hides dialog when no incomplete session', () => {
578
- const incompleteSession = null;
579
- const isCheckingRecovery = false;
580
-
581
- const showDialog = !!incompleteSession && !isCheckingRecovery;
582
- expect(showDialog).toBe(false);
583
- });
584
- });
585
-
586
- // ========================================================================
587
- // Screen recording sync behavior
588
- // ========================================================================
589
-
590
- describe('screen recording sync', () => {
591
- it('should start recording when state transitions to recording', () => {
592
- const nextState: SessionState = 'recording';
593
- const isCurrentlyRecording = false;
594
- const shouldStart = nextState === 'recording' && !isCurrentlyRecording;
595
- expect(shouldStart).toBe(true);
596
- });
597
-
598
- it('should not start if already recording', () => {
599
- const nextState: SessionState = 'recording';
600
- const isCurrentlyRecording = true;
601
- const shouldStart = nextState === 'recording' && !isCurrentlyRecording;
602
- expect(shouldStart).toBe(false);
603
- });
604
-
605
- it('should stop recording when state transitions away from recording', () => {
606
- const nextStates: SessionState[] = ['idle', 'stopping', 'processing', 'complete', 'error'];
607
- const isCurrentlyRecording = true;
608
-
609
- nextStates.forEach((nextState) => {
610
- const shouldStop = nextState !== 'recording' && isCurrentlyRecording;
611
- expect(shouldStop).toBe(true);
612
- });
613
- });
614
-
615
- it('should not stop if not recording', () => {
616
- const nextState: SessionState = 'idle';
617
- const isCurrentlyRecording = false;
618
- const shouldStop = nextState !== 'recording' && isCurrentlyRecording;
619
- expect(shouldStop).toBe(false);
620
- });
621
- });
622
-
623
- // ========================================================================
624
- // Component visibility matrix
625
- // ========================================================================
626
-
627
- describe('component visibility matrix', () => {
628
- it('SettingsPanel visible only in settings view', () => {
629
- const views: AppView[] = ['main', 'settings', 'history', 'shortcuts'];
630
- expect(views.map((v) => v === 'settings')).toEqual([false, true, false, false]);
631
- });
632
-
633
- it('SessionHistory visible only in history view', () => {
634
- const views: AppView[] = ['main', 'settings', 'history', 'shortcuts'];
635
- expect(views.map((v) => v === 'history')).toEqual([false, false, true, false]);
636
- });
637
-
638
- it('KeyboardShortcuts visible only in shortcuts view', () => {
639
- const views: AppView[] = ['main', 'settings', 'history', 'shortcuts'];
640
- expect(views.map((v) => v === 'shortcuts')).toEqual([false, false, false, true]);
641
- });
642
-
643
- it('Onboarding overlays any view', () => {
644
- let state = createInitialState();
645
- state.currentView = 'settings';
646
- state = handleNavigation(state, 'onboarding');
647
-
648
- expect(state.showOnboarding).toBe(true);
649
- expect(state.currentView).toBe('settings'); // View doesn't change
650
- });
651
-
652
- it('RecordingOverlay shows only during recording', () => {
653
- const states: SessionState[] = ['idle', 'starting', 'recording', 'stopping', 'processing', 'complete', 'error'];
654
- expect(states.map((s) => s === 'recording')).toEqual([false, false, true, false, false, false, false]);
655
- });
656
-
657
- it('Transcript section shows only during recording', () => {
658
- const states: SessionState[] = ['idle', 'starting', 'recording', 'stopping', 'processing', 'complete', 'error'];
659
- expect(states.map((s) => s === 'recording')).toEqual([false, false, true, false, false, false, false]);
660
- });
661
-
662
- it('Error section shows only in error state with message', () => {
663
- const errorMessage = 'Something broke';
664
- const states: SessionState[] = ['idle', 'starting', 'recording', 'stopping', 'processing', 'complete', 'error'];
665
- const visible = states.map((s) => !!errorMessage && s === 'error');
666
- expect(visible).toEqual([false, false, false, false, false, false, true]);
667
- });
668
-
669
- it('Report section shows when reportPath exists', () => {
670
- const withPath = !!'/report.md';
671
- const withoutPath = !!null;
672
- expect(withPath).toBe(true);
673
- expect(withoutPath).toBe(false);
674
- });
675
- });
676
- });