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,531 +0,0 @@
1
- /**
2
- * FeedbackAnalyzer - AI-Powered Feedback Categorization
3
- *
4
- * Hybrid rule-based + AI approach for categorizing user feedback:
5
- * 1. Fast rule-based matching for clear cases (high confidence)
6
- * 2. AI fallback for ambiguous cases (future enhancement)
7
- *
8
- * Categories: bug, ux-issue, suggestion, performance, question, general
9
- * Severity: critical, high, medium, low
10
- */
11
-
12
- // =============================================================================
13
- // Types
14
- // =============================================================================
15
-
16
- export type FeedbackCategory =
17
- | 'bug'
18
- | 'ux-issue'
19
- | 'suggestion'
20
- | 'performance'
21
- | 'question'
22
- | 'general';
23
-
24
- export type FeedbackSeverity = 'critical' | 'high' | 'medium' | 'low';
25
-
26
- export interface AnalysisResult {
27
- category: FeedbackCategory;
28
- categoryConfidence: number; // 0-1
29
- severity: FeedbackSeverity;
30
- severityConfidence: number; // 0-1
31
- keywords: string[];
32
- suggestedTitle: string;
33
- // Analysis metadata
34
- matchedPatterns: string[];
35
- processingTimeMs: number;
36
- }
37
-
38
- interface PatternMatch {
39
- pattern: RegExp;
40
- weight: number;
41
- label: string;
42
- }
43
-
44
- interface CategoryScore {
45
- category: FeedbackCategory;
46
- score: number;
47
- matches: string[];
48
- }
49
-
50
- interface SeverityScore {
51
- severity: FeedbackSeverity;
52
- score: number;
53
- matches: string[];
54
- }
55
-
56
- // =============================================================================
57
- // Pattern Definitions
58
- // =============================================================================
59
-
60
- /**
61
- * Category patterns with weighted scoring
62
- * Higher weight = stronger signal for that category
63
- */
64
- const CATEGORY_PATTERNS: Record<FeedbackCategory, PatternMatch[]> = {
65
- bug: [
66
- // Strong indicators - explicit bug language
67
- { pattern: /\bbug\b/i, weight: 0.5, label: 'bug-explicit' },
68
- { pattern: /\b(broken|crash(ed|es|ing)?)\b/i, weight: 0.4, label: 'broken-crash' },
69
- { pattern: /\bdoesn'?t work\b/i, weight: 0.35, label: 'doesnt-work' },
70
- { pattern: /\bnot working\b/i, weight: 0.35, label: 'not-working' },
71
- { pattern: /\berror\b/i, weight: 0.3, label: 'error' },
72
- { pattern: /\bfail(s|ed|ing)?\b/i, weight: 0.25, label: 'fail' },
73
- { pattern: /\bdoesn'?t match\b/i, weight: 0.3, label: 'doesnt-match' },
74
- // Medium indicators
75
- { pattern: /\b(wrong|incorrect)\b/i, weight: 0.2, label: 'wrong' },
76
- { pattern: /\bunexpected(ly)?\b/i, weight: 0.2, label: 'unexpected' },
77
- { pattern: /\bshould(n'?t| not) (be|have|do)\b/i, weight: 0.25, label: 'should-not' },
78
- { pattern: /\bissue\b/i, weight: 0.15, label: 'issue' },
79
- { pattern: /\bbehavior\b/i, weight: 0.1, label: 'behavior' },
80
- // Weak indicators
81
- { pattern: /\b(stuck|frozen|hang(s|ing)?)\b/i, weight: 0.2, label: 'stuck' },
82
- { pattern: /\bglitch(y|es)?\b/i, weight: 0.25, label: 'glitch' },
83
- ],
84
-
85
- 'ux-issue': [
86
- // Strong indicators
87
- { pattern: /\bconfusing\b/i, weight: 0.35, label: 'confusing' },
88
- { pattern: /\bhard to (find|use|understand)\b/i, weight: 0.35, label: 'hard-to' },
89
- { pattern: /\b(ux|user experience)\b/i, weight: 0.4, label: 'ux-term' },
90
- { pattern: /\bnot (intuitive|obvious|clear)\b/i, weight: 0.35, label: 'not-intuitive' },
91
- // Medium indicators
92
- { pattern: /\b(awkward|clunky|cumbersome)\b/i, weight: 0.3, label: 'awkward' },
93
- { pattern: /\b(annoying|frustrating|painful)\b/i, weight: 0.25, label: 'frustrating' },
94
- { pattern: /\bunclear\b/i, weight: 0.25, label: 'unclear' },
95
- { pattern: /\bwhere (is|are|do|can)\b/i, weight: 0.2, label: 'where-is' },
96
- { pattern: /\bcan'?t find\b/i, weight: 0.3, label: 'cant-find' },
97
- // Weak indicators
98
- { pattern: /\b(hidden|buried)\b/i, weight: 0.2, label: 'hidden' },
99
- { pattern: /\b(cluttered|messy|crowded)\b/i, weight: 0.2, label: 'cluttered' },
100
- ],
101
-
102
- suggestion: [
103
- // Strong indicators
104
- { pattern: /\b(should|could) (add|have|include|be)\b/i, weight: 0.35, label: 'should-add' },
105
- { pattern: /\bwould be (nice|great|better|helpful)\b/i, weight: 0.4, label: 'would-be-nice' },
106
- { pattern: /\b(suggest|idea|feature request)\b/i, weight: 0.4, label: 'suggest' },
107
- { pattern: /\bwish (there was|it had|you could)\b/i, weight: 0.35, label: 'wish' },
108
- { pattern: /\bit would be (nice|great)\b/i, weight: 0.4, label: 'it-would-be' },
109
- { pattern: /\byou should add\b/i, weight: 0.45, label: 'you-should-add' },
110
- { pattern: /\bcould you add\b/i, weight: 0.4, label: 'could-you-add' },
111
- // Medium indicators
112
- { pattern: /\b(add|implement|include|consider) (a |the |an )/i, weight: 0.3, label: 'add-article' },
113
- { pattern: /\bwhat (if|about)\b/i, weight: 0.25, label: 'what-if' },
114
- { pattern: /\bhow about\b/i, weight: 0.3, label: 'how-about' },
115
- { pattern: /\bmaybe (add|have|include)\b/i, weight: 0.3, label: 'maybe-add' },
116
- { pattern: /\bability to\b/i, weight: 0.25, label: 'ability-to' },
117
- { pattern: /\ba way to\b/i, weight: 0.25, label: 'a-way-to' },
118
- // Weak indicators
119
- { pattern: /\b(nice to have|would love)\b/i, weight: 0.25, label: 'nice-to-have' },
120
- { pattern: /\benhance(ment)?\b/i, weight: 0.2, label: 'enhance' },
121
- ],
122
-
123
- performance: [
124
- // Strong indicators
125
- { pattern: /\b(slow|sluggish)\b/i, weight: 0.4, label: 'slow' },
126
- { pattern: /\bperformance\b/i, weight: 0.35, label: 'performance' },
127
- { pattern: /\b(lag(gy|s|ging)?)\b/i, weight: 0.35, label: 'lag' },
128
- { pattern: /\btakes (forever|too long|a while)\b/i, weight: 0.35, label: 'takes-long' },
129
- // Medium indicators
130
- { pattern: /\b(delay(ed)?|wait(ing)?)\b/i, weight: 0.25, label: 'delay' },
131
- { pattern: /\b(hang(s|ing)?|freeze(s|ing)?)\b/i, weight: 0.25, label: 'hang' },
132
- { pattern: /\bloading\b/i, weight: 0.2, label: 'loading' },
133
- { pattern: /\b(responsive(ness)?|speed)\b/i, weight: 0.25, label: 'responsive' },
134
- // Weak indicators
135
- { pattern: /\b(fast|faster|quick(er)?)\b/i, weight: 0.15, label: 'fast' },
136
- { pattern: /\b(memory|cpu|resource)\b/i, weight: 0.2, label: 'resource' },
137
- ],
138
-
139
- question: [
140
- // Strong indicators (questions with question marks)
141
- { pattern: /\b(why|how|what|when|where|which)\b.*\?/i, weight: 0.45, label: 'question-word' },
142
- { pattern: /\b(is there|are there|can I|do I|does it)\b.*\?/i, weight: 0.4, label: 'is-there' },
143
- { pattern: /\b(wondering|curious)\b/i, weight: 0.35, label: 'wondering' },
144
- // Medium indicators
145
- { pattern: /\bquestion\b/i, weight: 0.3, label: 'question' },
146
- { pattern: /\bhow (do|does|can|to)\b/i, weight: 0.25, label: 'how-do' },
147
- { pattern: /\bwhat (is|are|does)\b/i, weight: 0.25, label: 'what-is' },
148
- // Weak indicators
149
- { pattern: /\bhelp\b/i, weight: 0.15, label: 'help' },
150
- { pattern: /\bexplain\b/i, weight: 0.2, label: 'explain' },
151
- ],
152
-
153
- general: [],
154
- };
155
-
156
- /**
157
- * Severity patterns - determine urgency/impact
158
- */
159
- const SEVERITY_PATTERNS: Record<FeedbackSeverity, PatternMatch[]> = {
160
- critical: [
161
- { pattern: /\b(crash(ed|es|ing)?|data loss|security|critical)\b/i, weight: 0.5, label: 'critical-keyword' },
162
- { pattern: /\bcan'?t use (at all|anything)\b/i, weight: 0.45, label: 'cant-use' },
163
- { pattern: /\bcompletely (broken|unusable)\b/i, weight: 0.45, label: 'completely-broken' },
164
- { pattern: /\burgent(ly)?\b/i, weight: 0.4, label: 'urgent' },
165
- { pattern: /\bemergency\b/i, weight: 0.45, label: 'emergency' },
166
- { pattern: /\blost (all|my|the) (data|work|files)\b/i, weight: 0.5, label: 'lost-data' },
167
- ],
168
-
169
- high: [
170
- { pattern: /\bbroken\b/i, weight: 0.35, label: 'broken' },
171
- { pattern: /\bdoesn'?t work\b/i, weight: 0.3, label: 'doesnt-work' },
172
- { pattern: /\b(major|important|significant)\b/i, weight: 0.3, label: 'major' },
173
- { pattern: /\bblocking\b/i, weight: 0.35, label: 'blocking' },
174
- { pattern: /\bserious(ly)?\b/i, weight: 0.25, label: 'serious' },
175
- { pattern: /\bcan'?t (do|complete|finish)\b/i, weight: 0.3, label: 'cant-do' },
176
- ],
177
-
178
- medium: [
179
- { pattern: /\bshould\b/i, weight: 0.2, label: 'should' },
180
- { pattern: /\b(annoying|frustrating)\b/i, weight: 0.25, label: 'annoying' },
181
- { pattern: /\bconfusing\b/i, weight: 0.2, label: 'confusing' },
182
- { pattern: /\bneeds (to be|improvement|work)\b/i, weight: 0.25, label: 'needs' },
183
- { pattern: /\bcould be better\b/i, weight: 0.2, label: 'could-be-better' },
184
- { pattern: /\bimprovement\b/i, weight: 0.2, label: 'improvement' },
185
- ],
186
-
187
- low: [
188
- { pattern: /\b(minor|small|tiny|little)\b/i, weight: 0.3, label: 'minor' },
189
- { pattern: /\bnice to have\b/i, weight: 0.3, label: 'nice-to-have' },
190
- { pattern: /\b(polish|nitpick|nit)\b/i, weight: 0.35, label: 'polish' },
191
- { pattern: /\btrivial\b/i, weight: 0.35, label: 'trivial' },
192
- { pattern: /\bwhen you get a chance\b/i, weight: 0.3, label: 'when-chance' },
193
- { pattern: /\bnot (urgent|important|critical)\b/i, weight: 0.3, label: 'not-urgent' },
194
- ],
195
- };
196
-
197
- /**
198
- * Tech/UI terms for keyword extraction
199
- */
200
- const TECH_TERMS_PATTERN =
201
- /\b(button|form|input|field|modal|dialog|popup|menu|dropdown|select|checkbox|toggle|switch|slider|tab|card|list|table|grid|header|footer|sidebar|navigation|nav|navbar|search|filter|sort|pagination|api|endpoint|error|warning|loading|spinner|animation|transition|responsive|mobile|desktop|tablet|scroll|click|tap|hover|drag|drop|toast|notification|alert|badge|icon|avatar|image|video|audio|file|upload|download|link|url|page|screen|view|panel|section|container|wrapper|row|column|flex|layout)\b/gi;
202
-
203
- /**
204
- * Common action verbs for title generation
205
- */
206
- const ACTION_VERBS_PATTERN =
207
- /\b(click(ed|ing)?|tap(ped|ping)?|open(ed|ing)?|close(d|ing)?|save(d|ing)?|load(ed|ing)?|submit(ted|ting)?|select(ed|ing)?|choose|enter(ed|ing)?|type(d|ing)?|scroll(ed|ing)?|drag(ged|ging)?|drop(ped|ping)?|upload(ed|ing)?|download(ed|ing)?|delete(d|ing)?|remove(d|ing)?|add(ed|ing)?|create(d|ing)?|edit(ed|ing)?|update(d|ing)?|refresh(ed|ing)?|search(ed|ing)?|filter(ed|ing)?|sort(ed|ing)?)\b/gi;
208
-
209
- // =============================================================================
210
- // FeedbackAnalyzer Implementation
211
- // =============================================================================
212
-
213
- class FeedbackAnalyzerImpl {
214
- private readonly CONFIDENCE_THRESHOLD = 0.25;
215
- private readonly DEFAULT_CONFIDENCE = 0.5;
216
-
217
- /**
218
- * Analyze transcribed feedback text
219
- */
220
- analyze(transcription: string): AnalysisResult {
221
- const startTime = performance.now();
222
-
223
- // Normalize text
224
- const normalizedText = this.normalizeText(transcription);
225
-
226
- // 1. Category detection
227
- const categoryScores = this.scoreCategoriesRuleBased(normalizedText);
228
- const topCategory = this.selectTopCategory(categoryScores);
229
-
230
- // 2. Severity detection
231
- const severityScores = this.scoreSeverityRuleBased(normalizedText);
232
- const topSeverity = this.selectTopSeverity(severityScores, topCategory.category);
233
-
234
- // 3. Keyword extraction
235
- const keywords = this.extractKeywords(normalizedText);
236
-
237
- // 4. Title generation
238
- const suggestedTitle = this.generateTitle(normalizedText, topCategory.category);
239
-
240
- // Collect all matched patterns for debugging/transparency
241
- const allMatches = [
242
- ...topCategory.matches,
243
- ...topSeverity.matches,
244
- ];
245
-
246
- const processingTimeMs = performance.now() - startTime;
247
-
248
- return {
249
- category: topCategory.category,
250
- categoryConfidence: topCategory.score,
251
- severity: topSeverity.severity,
252
- severityConfidence: topSeverity.score,
253
- keywords,
254
- suggestedTitle,
255
- matchedPatterns: allMatches,
256
- processingTimeMs,
257
- };
258
- }
259
-
260
- /**
261
- * Batch analyze multiple transcriptions
262
- */
263
- analyzeBatch(transcriptions: string[]): AnalysisResult[] {
264
- return transcriptions.map((t) => this.analyze(t));
265
- }
266
-
267
- /**
268
- * Normalize text for consistent pattern matching
269
- */
270
- private normalizeText(text: string): string {
271
- return text
272
- .trim()
273
- .replace(/\s+/g, ' ') // Normalize whitespace
274
- .replace(/[""]/g, '"') // Normalize quotes
275
- .replace(/['']/g, "'"); // Normalize apostrophes
276
- }
277
-
278
- /**
279
- * Score all categories using pattern matching
280
- */
281
- private scoreCategoriesRuleBased(text: string): CategoryScore[] {
282
- const scores: CategoryScore[] = [];
283
-
284
- for (const [category, patterns] of Object.entries(CATEGORY_PATTERNS)) {
285
- let totalScore = 0;
286
- const matches: string[] = [];
287
-
288
- for (const { pattern, weight, label } of patterns) {
289
- if (pattern.test(text)) {
290
- totalScore += weight;
291
- matches.push(label);
292
- }
293
- }
294
-
295
- // Cap at 1.0
296
- const normalizedScore = Math.min(totalScore, 1.0);
297
-
298
- scores.push({
299
- category: category as FeedbackCategory,
300
- score: normalizedScore,
301
- matches,
302
- });
303
- }
304
-
305
- // Sort by score descending
306
- return scores.sort((a, b) => b.score - a.score);
307
- }
308
-
309
- /**
310
- * Select the best category from scores
311
- */
312
- private selectTopCategory(scores: CategoryScore[]): CategoryScore {
313
- const best = scores[0];
314
-
315
- // If best score is below threshold, default to general
316
- if (!best || best.score < this.CONFIDENCE_THRESHOLD) {
317
- return {
318
- category: 'general',
319
- score: this.DEFAULT_CONFIDENCE,
320
- matches: [],
321
- };
322
- }
323
-
324
- // Boost confidence if there's a clear winner
325
- const secondBest = scores[1];
326
- if (secondBest && best.score - secondBest.score > 0.2) {
327
- // Clear winner - boost confidence
328
- return {
329
- ...best,
330
- score: Math.min(best.score * 1.2, 1.0),
331
- };
332
- }
333
-
334
- return best;
335
- }
336
-
337
- /**
338
- * Score all severity levels using pattern matching
339
- */
340
- private scoreSeverityRuleBased(text: string): SeverityScore[] {
341
- const scores: SeverityScore[] = [];
342
-
343
- for (const [severity, patterns] of Object.entries(SEVERITY_PATTERNS)) {
344
- let totalScore = 0;
345
- const matches: string[] = [];
346
-
347
- for (const { pattern, weight, label } of patterns) {
348
- if (pattern.test(text)) {
349
- totalScore += weight;
350
- matches.push(label);
351
- }
352
- }
353
-
354
- // Cap at 1.0
355
- const normalizedScore = Math.min(totalScore, 1.0);
356
-
357
- scores.push({
358
- severity: severity as FeedbackSeverity,
359
- score: normalizedScore,
360
- matches,
361
- });
362
- }
363
-
364
- // Sort by score descending
365
- return scores.sort((a, b) => b.score - a.score);
366
- }
367
-
368
- /**
369
- * Select the best severity, with category-aware defaults
370
- */
371
- private selectTopSeverity(
372
- scores: SeverityScore[],
373
- category: FeedbackCategory
374
- ): SeverityScore {
375
- const best = scores[0];
376
-
377
- // If best score is below threshold, use category-aware defaults
378
- if (!best || best.score < this.CONFIDENCE_THRESHOLD) {
379
- const defaultSeverity = this.getDefaultSeverity(category);
380
- return {
381
- severity: defaultSeverity,
382
- score: this.DEFAULT_CONFIDENCE,
383
- matches: [],
384
- };
385
- }
386
-
387
- return best;
388
- }
389
-
390
- /**
391
- * Get default severity based on category
392
- */
393
- private getDefaultSeverity(category: FeedbackCategory): FeedbackSeverity {
394
- switch (category) {
395
- case 'bug':
396
- return 'high'; // Bugs default to high
397
- case 'performance':
398
- return 'medium'; // Performance issues are medium
399
- case 'ux-issue':
400
- return 'medium'; // UX issues are medium
401
- case 'suggestion':
402
- return 'low'; // Suggestions are low
403
- case 'question':
404
- return 'low'; // Questions are low
405
- case 'general':
406
- default:
407
- return 'medium'; // Default to medium
408
- }
409
- }
410
-
411
- /**
412
- * Extract relevant keywords from text
413
- */
414
- private extractKeywords(text: string): string[] {
415
- const keywords = new Set<string>();
416
-
417
- // Extract tech/UI terms
418
- const techMatches = text.match(TECH_TERMS_PATTERN) || [];
419
- for (const match of techMatches) {
420
- keywords.add(match.toLowerCase());
421
- }
422
-
423
- // Extract action verbs (useful context)
424
- const actionMatches = text.match(ACTION_VERBS_PATTERN) || [];
425
- for (const match of actionMatches) {
426
- // Normalize verb forms to base form
427
- const normalized = match.toLowerCase().replace(/(ed|ing|ped|ted|ged)$/, '');
428
- keywords.add(normalized);
429
- }
430
-
431
- // Limit to 8 keywords, prioritizing tech terms
432
- const keywordArray = Array.from(keywords);
433
- return keywordArray.slice(0, 8);
434
- }
435
-
436
- /**
437
- * Generate a suggested title from the transcription
438
- */
439
- private generateTitle(text: string, category: FeedbackCategory): string {
440
- // Category-specific prefixes
441
- const prefixes: Record<FeedbackCategory, string> = {
442
- bug: 'Fix:',
443
- 'ux-issue': 'Improve:',
444
- suggestion: 'Add:',
445
- performance: 'Optimize:',
446
- question: 'Clarify:',
447
- general: '',
448
- };
449
-
450
- // Extract key phrase
451
- const keyPhrase = this.extractKeyPhrase(text);
452
-
453
- // Build title
454
- const prefix = prefixes[category];
455
- const maxLength = prefix ? 55 : 60; // Account for prefix length
456
-
457
- let title = keyPhrase;
458
- if (title.length > maxLength) {
459
- // Truncate at word boundary
460
- title = this.truncateAtWordBoundary(title, maxLength);
461
- }
462
-
463
- // Capitalize first letter
464
- title = title.charAt(0).toUpperCase() + title.slice(1);
465
-
466
- return prefix ? `${prefix} ${title}` : title;
467
- }
468
-
469
- /**
470
- * Extract the most meaningful phrase from text
471
- */
472
- private extractKeyPhrase(text: string): string {
473
- // Try to get the first sentence
474
- const sentences = text.split(/[.!?]+/).filter((s) => s.trim().length > 0);
475
-
476
- if (sentences.length === 0) {
477
- return text.trim() || 'Untitled feedback';
478
- }
479
-
480
- let firstSentence = sentences[0].trim();
481
-
482
- // Remove common filler words from the beginning (apply repeatedly)
483
- const fillerPatterns = [
484
- /^(so|well|um|uh|like|okay|ok|alright|anyway)\s+/i,
485
- /^basically\s+/i,
486
- /^(I think|I feel|I believe|I noticed|I found)\s+(that\s+)?/i,
487
- /^(it seems|it looks|it appears)\s+(like|that)?\s*/i,
488
- ];
489
-
490
- let changed = true;
491
- while (changed) {
492
- changed = false;
493
- for (const pattern of fillerPatterns) {
494
- const before = firstSentence;
495
- firstSentence = firstSentence.replace(pattern, '');
496
- if (firstSentence !== before) {
497
- changed = true;
498
- }
499
- }
500
- }
501
-
502
- return firstSentence.trim() || text.trim().slice(0, 60);
503
- }
504
-
505
- /**
506
- * Truncate text at a word boundary
507
- */
508
- private truncateAtWordBoundary(text: string, maxLength: number): string {
509
- if (text.length <= maxLength) {
510
- return text;
511
- }
512
-
513
- // Find last space before maxLength
514
- const truncated = text.slice(0, maxLength);
515
- const lastSpace = truncated.lastIndexOf(' ');
516
-
517
- if (lastSpace > maxLength * 0.5) {
518
- return truncated.slice(0, lastSpace) + '...';
519
- }
520
-
521
- return truncated + '...';
522
- }
523
- }
524
-
525
- // =============================================================================
526
- // Singleton Export
527
- // =============================================================================
528
-
529
- export const feedbackAnalyzer = new FeedbackAnalyzerImpl();
530
- export type { FeedbackAnalyzerImpl as FeedbackAnalyzer };
531
- export default feedbackAnalyzer;
@@ -1,19 +0,0 @@
1
- /**
2
- * Analysis module exports
3
- */
4
- export {
5
- feedbackAnalyzer,
6
- type FeedbackAnalyzer,
7
- type AnalysisResult,
8
- type FeedbackCategory,
9
- type FeedbackSeverity,
10
- } from './FeedbackAnalyzer';
11
-
12
- export {
13
- clarificationGenerator,
14
- type ClarificationGenerator,
15
- type ClarificationQuestion,
16
- type ClarificationAnswer,
17
- type ClarifiedFeedback,
18
- type ClarificationType,
19
- } from './ClarificationGenerator';