@sushanglewis/lincoln 1.5.0 → 1.5.1

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 (305) hide show
  1. package/dist/main.d.ts +3 -0
  2. package/dist/main.js +1231 -906
  3. package/dist/main.js.map +1 -1
  4. package/dist/postinstall.d.ts +3 -0
  5. package/dist/postinstall.js +18 -0
  6. package/dist/postinstall.js.map +1 -0
  7. package/framework/.claude/agents/_contract.md +79 -0
  8. package/framework/.claude/agents/architect.md +31 -0
  9. package/framework/.claude/agents/default.md +151 -0
  10. package/framework/.claude/agents/designer.md +33 -0
  11. package/framework/.claude/agents/engineer.md +42 -0
  12. package/framework/.claude/agents/external/NOTICES.md +12 -0
  13. package/framework/.claude/agents/external/everything-claude-code.manifest.yaml +23 -0
  14. package/framework/.claude/agents/external/oh-my-claudecode.manifest.yaml +26 -0
  15. package/framework/.claude/agents/external/wshobson-agents.manifest.yaml +23 -0
  16. package/framework/.claude/agents/frontend-engineer.md +32 -0
  17. package/framework/.claude/agents/knowledge-curator.md +28 -0
  18. package/framework/.claude/agents/pm.md +38 -0
  19. package/framework/.claude/agents/qa.md +28 -0
  20. package/framework/.claude/agents/release-coordinator.md +25 -0
  21. package/framework/.claude/agents/researcher.md +41 -0
  22. package/framework/.claude/harnesses/claude-code.yaml +15 -0
  23. package/framework/.claude/harnesses/codex.yaml +40 -0
  24. package/framework/.claude/harnesses/command-map.yaml +255 -0
  25. package/framework/.claude/harnesses/opencode.yaml +32 -0
  26. package/framework/.claude/harnesses/scenarios.yaml +45 -0
  27. package/framework/.claude/hooks/on-pr-event.sh +69 -0
  28. package/framework/.claude/hooks/on-session-start.sh +427 -0
  29. package/framework/.claude/hooks/on-stop.sh +104 -0
  30. package/framework/.claude/hooks/post-tool-use.sh +161 -0
  31. package/framework/.claude/hooks/pre-tool-use.sh +246 -0
  32. package/framework/.claude/schemas/agent-definition.schema.json +35 -0
  33. package/framework/.claude/schemas/benchmark-report.schema.json +148 -0
  34. package/framework/.claude/schemas/pm-to-ux-handoff.schema.yaml +128 -0
  35. package/framework/.claude/schemas/stage-definition.schema.json +233 -0
  36. package/framework/.claude/schemas/workflow-stage.schema.json +86 -0
  37. package/framework/.claude/schemas/workflow-template.schema.json +88 -0
  38. package/framework/.claude/settings.json +14 -0
  39. package/framework/.claude/skills/build-product-prototype/SKILL.md +35 -0
  40. package/framework/.claude/skills/build-product-prototype/prompts/main.md +78 -0
  41. package/framework/.claude/skills/clarify-requirements/SKILL.md +32 -0
  42. package/framework/.claude/skills/clarify-requirements/prompts/main.md +81 -0
  43. package/framework/.claude/skills/dependencies.yaml +139 -0
  44. package/framework/.claude/skills/draft-product-design/SKILL.md +40 -0
  45. package/framework/.claude/skills/draft-product-design/prompts/main.md +47 -0
  46. package/framework/.claude/skills/lc-analyze-frameworks/SKILL.md +43 -0
  47. package/framework/.claude/skills/lc-analyze-frameworks/prompts/main.md +95 -0
  48. package/framework/.claude/skills/lc-benchmark/SKILL.md +61 -0
  49. package/framework/.claude/skills/lc-build-codebase-knowledge/SKILL.md +38 -0
  50. package/framework/.claude/skills/lc-build-codebase-knowledge/prompts/build-codebase-knowledge.md +61 -0
  51. package/framework/.claude/skills/lc-collect-intelligence/SKILL.md +43 -0
  52. package/framework/.claude/skills/lc-collect-intelligence/prompts/main.md +72 -0
  53. package/framework/.claude/skills/lc-competitive-analysis/SKILL.md +43 -0
  54. package/framework/.claude/skills/lc-competitive-analysis/prompts/main.md +70 -0
  55. package/framework/.claude/skills/lc-explore-opensource/SKILL.md +36 -0
  56. package/framework/.claude/skills/lc-explore-opensource/prompts/explore-opensource.md +77 -0
  57. package/framework/.claude/skills/lc-first-principles/SKILL.md +43 -0
  58. package/framework/.claude/skills/lc-first-principles/prompts/main.md +73 -0
  59. package/framework/.claude/skills/lc-handoff/SKILL.md +34 -0
  60. package/framework/.claude/skills/lc-init-branch/SKILL.md +52 -0
  61. package/framework/.claude/skills/lc-market-research/SKILL.md +43 -0
  62. package/framework/.claude/skills/lc-market-research/prompts/main.md +79 -0
  63. package/framework/.claude/skills/lc-product-research/SKILL.md +43 -0
  64. package/framework/.claude/skills/lc-product-research/prompts/main.md +80 -0
  65. package/framework/.claude/skills/lc-research-report/SKILL.md +43 -0
  66. package/framework/.claude/skills/lc-research-report/prompts/main.md +90 -0
  67. package/framework/.claude/skills/lc-research-scope/SKILL.md +43 -0
  68. package/framework/.claude/skills/lc-research-scope/prompts/main.md +82 -0
  69. package/framework/.claude/skills/lc-setup/SKILL.md +68 -0
  70. package/framework/.claude/skills/lc-setup/prompts/main.md +88 -0
  71. package/framework/.claude/skills/lc-stage/SKILL.md +45 -0
  72. package/framework/.claude/skills/lc-stakeholder-research/SKILL.md +43 -0
  73. package/framework/.claude/skills/lc-stakeholder-research/prompts/main.md +65 -0
  74. package/framework/.claude/skills/lc-status/SKILL.md +25 -0
  75. package/framework/.claude/skills/lc-storytelling/SKILL.md +43 -0
  76. package/framework/.claude/skills/lc-storytelling/prompts/main.md +77 -0
  77. package/framework/.claude/skills/lc-wf/SKILL.md +54 -0
  78. package/framework/.claude/skills/lc-workflow/SKILL.md +48 -0
  79. package/framework/.claude/skills/lc-workflow/validators/validate.py +755 -0
  80. package/framework/.claude/skills/lc-workflow-router/SKILL.md +41 -0
  81. package/framework/.claude/skills/lc-workflow-router/prompts/intake-prompt.md +91 -0
  82. package/framework/.claude/skills/lc-workflow-router/prompts/router-prompt.md +44 -0
  83. package/framework/.claude/skills/plan-tdd-development/SKILL.md +31 -0
  84. package/framework/.claude/skills/plan-tdd-development/prompts/main.md +44 -0
  85. package/framework/.claude/skills/process-interview/SKILL.md +32 -0
  86. package/framework/.claude/skills/process-interview/prompts/main.md +47 -0
  87. package/framework/.claude/skills/propose-with-openspec/SKILL.md +37 -0
  88. package/framework/.claude/skills/propose-with-openspec/prompts/main.md +53 -0
  89. package/framework/.claude/skills/split-to-github/SKILL.md +32 -0
  90. package/framework/.claude/skills/split-to-github/prompts/main.md +42 -0
  91. package/framework/.claude/skills/sync-to-knowledge/SKILL.md +35 -0
  92. package/framework/.claude/skills/sync-to-knowledge/prompts/main.md +54 -0
  93. package/framework/.claude/skills/workflow-continue/SKILL.md +24 -0
  94. package/framework/.claude/skills/workflow-continue/prompts/main.md +25 -0
  95. package/framework/.claude/stages/build-codebase-knowledge.yaml +42 -0
  96. package/framework/.claude/stages/clarify.yaml +59 -0
  97. package/framework/.claude/stages/explore-opensource.yaml +40 -0
  98. package/framework/.claude/stages/implement.yaml +60 -0
  99. package/framework/.claude/stages/ingest.yaml +40 -0
  100. package/framework/.claude/stages/lc-analyze-frameworks.yaml +37 -0
  101. package/framework/.claude/stages/lc-collect-intelligence.yaml +37 -0
  102. package/framework/.claude/stages/lc-competitive-analysis.yaml +37 -0
  103. package/framework/.claude/stages/lc-first-principles.yaml +37 -0
  104. package/framework/.claude/stages/lc-market-research.yaml +37 -0
  105. package/framework/.claude/stages/lc-product-research.yaml +37 -0
  106. package/framework/.claude/stages/lc-research-report.yaml +38 -0
  107. package/framework/.claude/stages/lc-research-scope.yaml +38 -0
  108. package/framework/.claude/stages/lc-stakeholder-research.yaml +37 -0
  109. package/framework/.claude/stages/lc-storytelling.yaml +37 -0
  110. package/framework/.claude/stages/product-design-docs.yaml +66 -0
  111. package/framework/.claude/stages/product-prototype.yaml +53 -0
  112. package/framework/.claude/stages/propose.yaml +45 -0
  113. package/framework/.claude/stages/split.yaml +41 -0
  114. package/framework/.claude/stages/sync-knowledge.yaml +49 -0
  115. package/framework/.claude/stages/tdd-development-plan.yaml +43 -0
  116. package/framework/.claude/stages/workflow-router.yaml +45 -0
  117. package/framework/.claude/templates/solo-workflow-context.yaml +23 -0
  118. package/framework/.claude/workflows/README.md +93 -0
  119. package/framework/.claude/workflows/bug-fix.yaml +81 -0
  120. package/framework/.claude/workflows/design-spike.yaml +55 -0
  121. package/framework/.claude/workflows/existing-project-iteration.yaml +106 -0
  122. package/framework/.claude/workflows/interview-to-knowledge.yaml +189 -0
  123. package/framework/.claude/workflows/oss-first-design.yaml +100 -0
  124. package/framework/.claude/workflows/pm-research.yaml +115 -0
  125. package/framework/.claude-plugin/hooks.json +6 -0
  126. package/framework/.claude-plugin/marketplace.json +32 -0
  127. package/framework/.claude-plugin/plugin.json +57 -0
  128. package/framework/.version-bump.json +43 -0
  129. package/framework/CLAUDE.md +140 -0
  130. package/framework/CONTRIBUTING.md +219 -0
  131. package/framework/LICENSE +21 -0
  132. package/framework/README.en.md +139 -0
  133. package/framework/README.md +139 -0
  134. package/framework/RELEASE.md +334 -0
  135. package/framework/SKILL.md +24 -0
  136. package/framework/USAGE.md +356 -0
  137. package/framework/manifest.json +1214 -0
  138. package/framework/requirements.txt +4 -0
  139. package/framework/scripts/__init__.py +0 -0
  140. package/framework/scripts/build_codebase_knowledge.py +76 -0
  141. package/framework/scripts/bump_version.py +181 -0
  142. package/framework/scripts/check-dependency-drift.py +69 -0
  143. package/framework/scripts/check-harness-drift.sh +57 -0
  144. package/framework/scripts/check-main-merge-hygiene.py +128 -0
  145. package/framework/scripts/check-skill-dependencies.sh +124 -0
  146. package/framework/scripts/init-lincoln-branch.sh +300 -0
  147. package/framework/scripts/init-project.sh +184 -0
  148. package/framework/scripts/lc-benchmark-cli.py +66 -0
  149. package/framework/scripts/lincoln-audit.py +288 -0
  150. package/framework/scripts/lincoln-setup.py +651 -0
  151. package/framework/scripts/lincoln-status.py +448 -0
  152. package/framework/scripts/lincoln_benchmark.py +224 -0
  153. package/framework/scripts/lincoln_benchmark_eval.py +104 -0
  154. package/framework/scripts/lincoln_benchmark_metrics.py +818 -0
  155. package/framework/scripts/lincoln_benchmark_report.py +141 -0
  156. package/framework/scripts/lincoln_command_map.py +289 -0
  157. package/framework/scripts/lincoln_dependency_manager.py +335 -0
  158. package/framework/scripts/lincoln_documents.py +175 -0
  159. package/framework/scripts/lincoln_harness_adapter.py +319 -0
  160. package/framework/scripts/lincoln_index.py +255 -0
  161. package/framework/scripts/lincoln_paths.py +198 -0
  162. package/framework/scripts/lincoln_prd.py +227 -0
  163. package/framework/scripts/lincoln_role.py +46 -0
  164. package/framework/scripts/lincoln_scenario.py +59 -0
  165. package/framework/scripts/lincoln_session_start_metrics.py +71 -0
  166. package/framework/scripts/lincoln_skill_prompt.py +48 -0
  167. package/framework/scripts/lincoln_trace.py +335 -0
  168. package/framework/scripts/lincoln_workflow.py +199 -0
  169. package/framework/scripts/list-active-lincoln-branches.sh +87 -0
  170. package/framework/scripts/package-lincoln-plugin.py +340 -0
  171. package/framework/scripts/run-infrastructure-tests.py +84 -0
  172. package/framework/scripts/stage_loader.py +1071 -0
  173. package/framework/scripts/static-check.sh +356 -0
  174. package/framework/scripts/sync-external-agents.sh +210 -0
  175. package/framework/scripts/sync-framework-package.mjs +218 -0
  176. package/framework/scripts/task_tool_guard.py +213 -0
  177. package/framework/scripts/track-artifacts.py +140 -0
  178. package/framework/scripts/validate_stage.py +350 -0
  179. package/{README.md → framework/tools/lincoln/README.md} +4 -4
  180. package/framework/tools/lincoln/package-lock.json +3349 -0
  181. package/framework/tools/lincoln/package.json +48 -0
  182. package/framework/tools/lincoln/src/cli.tsx +60 -0
  183. package/framework/tools/lincoln/src/components/AudioMeter.tsx +34 -0
  184. package/framework/tools/lincoln/src/components/CancelledScreen.tsx +11 -0
  185. package/framework/tools/lincoln/src/components/DevicesMenu.tsx +79 -0
  186. package/framework/tools/lincoln/src/components/HintBar.tsx +25 -0
  187. package/framework/tools/lincoln/src/components/LogView.tsx +36 -0
  188. package/framework/tools/lincoln/src/components/ModelMenu.tsx +122 -0
  189. package/framework/tools/lincoln/src/components/ReadyScreen.tsx +54 -0
  190. package/framework/tools/lincoln/src/components/RecordingApp.tsx +211 -0
  191. package/framework/tools/lincoln/src/components/RecordingScreen.tsx +41 -0
  192. package/framework/tools/lincoln/src/components/SelectMenu.tsx +53 -0
  193. package/framework/tools/lincoln/src/components/StatusPanel.tsx +52 -0
  194. package/framework/tools/lincoln/src/components/StopConfirmation.tsx +32 -0
  195. package/framework/tools/lincoln/src/config/args.ts +35 -0
  196. package/framework/tools/lincoln/src/config/loadConfig.ts +81 -0
  197. package/framework/tools/lincoln/src/config/resolveConfig.ts +85 -0
  198. package/framework/tools/lincoln/src/devices/listDevices.ts +11 -0
  199. package/framework/tools/lincoln/src/devices/parseDevices.ts +25 -0
  200. package/framework/tools/lincoln/src/hooks/useKeyHandler.ts +63 -0
  201. package/framework/tools/lincoln/src/main.tsx +4 -0
  202. package/framework/tools/lincoln/src/models/models.ts +34 -0
  203. package/framework/tools/lincoln/src/models/runWarmup.ts +46 -0
  204. package/framework/tools/lincoln/src/models/warmupProgress.ts +30 -0
  205. package/framework/tools/lincoln/src/recording/spawnRecorder.ts +127 -0
  206. package/framework/tools/lincoln/src/recording/useRecorder.ts +146 -0
  207. package/framework/tools/lincoln/src/utils/amplitudeToMeter.ts +4 -0
  208. package/framework/tools/lincoln/src/utils/formatDuration.ts +6 -0
  209. package/framework/tools/lincoln/src/utils/sessionId.ts +25 -0
  210. package/framework/tools/lincoln/tests/cli.test.tsx +52 -0
  211. package/framework/tools/lincoln/tests/components/AudioMeter.test.tsx +31 -0
  212. package/framework/tools/lincoln/tests/components/CancelledScreen.test.tsx +12 -0
  213. package/framework/tools/lincoln/tests/components/ReadyScreen.test.tsx +68 -0
  214. package/framework/tools/lincoln/tests/components/RecordingApp.menus.test.tsx +158 -0
  215. package/framework/tools/lincoln/tests/components/RecordingApp.test.tsx +248 -0
  216. package/framework/tools/lincoln/tests/components/RecordingScreen.test.tsx +37 -0
  217. package/framework/tools/lincoln/tests/components/SelectMenu.test.tsx +59 -0
  218. package/framework/tools/lincoln/tests/components/StopConfirmation.test.tsx +38 -0
  219. package/framework/tools/lincoln/tests/config/args.test.ts +49 -0
  220. package/framework/tools/lincoln/tests/config/loadConfig.test.ts +59 -0
  221. package/framework/tools/lincoln/tests/config/resolveConfig.test.ts +72 -0
  222. package/framework/tools/lincoln/tests/devices/parseDevices.test.ts +21 -0
  223. package/framework/tools/lincoln/tests/hooks/useKeyHandler.enabled.test.tsx +44 -0
  224. package/framework/tools/lincoln/tests/hooks/useKeyHandler.test.tsx +130 -0
  225. package/framework/tools/lincoln/tests/models/models.test.ts +27 -0
  226. package/framework/tools/lincoln/tests/models/warmupProgress.test.ts +25 -0
  227. package/framework/tools/lincoln/tests/recording/spawnRecorder.test.ts +85 -0
  228. package/framework/tools/lincoln/tests/recording/useRecorder.test.tsx +172 -0
  229. package/framework/tools/lincoln/tests/utils/amplitudeToMeter.test.ts +22 -0
  230. package/framework/tools/lincoln/tests/utils/formatDuration.test.ts +11 -0
  231. package/framework/tools/lincoln/tests/utils/sessionId.test.ts +30 -0
  232. package/framework/tools/lincoln/tsconfig.json +22 -0
  233. package/framework/tools/lincoln/tsconfig.tests.json +10 -0
  234. package/framework/tools/lincoln/tsup.config.ts +17 -0
  235. package/framework/tools/lincoln/vitest.config.ts +20 -0
  236. package/framework/tools/lincoln-installer/package-lock.json +3611 -0
  237. package/framework/tools/lincoln-installer/package.json +53 -0
  238. package/framework/tools/lincoln-installer/src/cli.tsx +63 -0
  239. package/framework/tools/lincoln-installer/src/components/HarnessSelectScreen.tsx +43 -0
  240. package/framework/tools/lincoln-installer/src/components/InstallerApp.tsx +98 -0
  241. package/framework/tools/lincoln-installer/src/components/OptionsScreen.tsx +56 -0
  242. package/framework/tools/lincoln-installer/src/components/ProgressScreen.tsx +25 -0
  243. package/framework/tools/lincoln-installer/src/components/ResultScreen.tsx +40 -0
  244. package/framework/tools/lincoln-installer/src/components/SelectMenu.tsx +73 -0
  245. package/framework/tools/lincoln-installer/src/components/SummaryScreen.tsx +49 -0
  246. package/framework/tools/lincoln-installer/src/components/UpdateApp.tsx +135 -0
  247. package/framework/tools/lincoln-installer/src/components/WelcomeScreen.tsx +22 -0
  248. package/framework/tools/lincoln-installer/src/config/args.ts +76 -0
  249. package/framework/tools/lincoln-installer/src/config/resolveConfig.ts +33 -0
  250. package/framework/tools/lincoln-installer/src/config/updateArgs.ts +67 -0
  251. package/framework/tools/lincoln-installer/src/hooks/useSetup.ts +149 -0
  252. package/framework/tools/lincoln-installer/src/main.tsx +11 -0
  253. package/framework/tools/lincoln-installer/src/types.ts +19 -0
  254. package/framework/tools/lincoln-installer/src/update-main.tsx +11 -0
  255. package/framework/tools/lincoln-installer/src/update.tsx +90 -0
  256. package/framework/tools/lincoln-installer/src/utils/detectHarness.ts +51 -0
  257. package/framework/tools/lincoln-installer/src/utils/runSetup.ts +62 -0
  258. package/framework/tools/lincoln-installer/src/utils/updateRelease.ts +454 -0
  259. package/framework/tools/lincoln-installer/tests/components/InstallerApp.test.tsx +88 -0
  260. package/framework/tools/lincoln-installer/tests/components/SelectMenu.test.tsx +26 -0
  261. package/framework/tools/lincoln-installer/tests/components/UpdateApp.test.tsx +170 -0
  262. package/framework/tools/lincoln-installer/tests/components/screens.test.tsx +310 -0
  263. package/framework/tools/lincoln-installer/tests/config/args.test.ts +66 -0
  264. package/framework/tools/lincoln-installer/tests/config/resolveConfig.test.ts +75 -0
  265. package/framework/tools/lincoln-installer/tests/config/updateArgs.test.ts +52 -0
  266. package/framework/tools/lincoln-installer/tests/hooks/useSetup.test.tsx +213 -0
  267. package/framework/tools/lincoln-installer/tests/update.test.tsx +108 -0
  268. package/framework/tools/lincoln-installer/tests/utils/detectHarness.test.ts +40 -0
  269. package/framework/tools/lincoln-installer/tests/utils/runSetup.test.ts +45 -0
  270. package/framework/tools/lincoln-installer/tests/utils/updateRelease.test.ts +559 -0
  271. package/framework/tools/lincoln-installer/tsconfig.json +22 -0
  272. package/framework/tools/lincoln-installer/tsconfig.tests.json +8 -0
  273. package/framework/tools/lincoln-installer/tsup.config.ts +17 -0
  274. package/framework/tools/lincoln-installer/vitest.config.ts +20 -0
  275. package/framework/tools/lincoln-record/Cargo.lock +1896 -0
  276. package/framework/tools/lincoln-record/Cargo.toml +24 -0
  277. package/framework/tools/lincoln-record/diarize/diarize.py +117 -0
  278. package/framework/tools/lincoln-record/diarize/merge.py +55 -0
  279. package/framework/tools/lincoln-record/src/audio/capture/microphone.rs +194 -0
  280. package/framework/tools/lincoln-record/src/audio/capture/mod.rs +1 -0
  281. package/framework/tools/lincoln-record/src/audio/devices.rs +20 -0
  282. package/framework/tools/lincoln-record/src/audio/mod.rs +5 -0
  283. package/framework/tools/lincoln-record/src/audio/resampler.rs +44 -0
  284. package/framework/tools/lincoln-record/src/audio/saver.rs +87 -0
  285. package/framework/tools/lincoln-record/src/audio/source.rs +104 -0
  286. package/framework/tools/lincoln-record/src/cli.rs +96 -0
  287. package/framework/tools/lincoln-record/src/config.rs +135 -0
  288. package/framework/tools/lincoln-record/src/lib.rs +6 -0
  289. package/framework/tools/lincoln-record/src/main.rs +242 -0
  290. package/framework/tools/lincoln-record/src/model/mod.rs +248 -0
  291. package/framework/tools/lincoln-record/src/output/metadata.rs +30 -0
  292. package/framework/tools/lincoln-record/src/output/mod.rs +2 -0
  293. package/framework/tools/lincoln-record/src/output/transcript.rs +42 -0
  294. package/framework/tools/lincoln-record/src/transcription/diarization.rs +64 -0
  295. package/framework/tools/lincoln-record/src/transcription/mod.rs +3 -0
  296. package/framework/tools/lincoln-record/src/transcription/provider.rs +43 -0
  297. package/framework/tools/lincoln-record/src/transcription/whisper.rs +176 -0
  298. package/framework/tools/lincoln-record/tests/cli_args.rs +103 -0
  299. package/framework/tools/lincoln-record/tests/config_test.rs +70 -0
  300. package/framework/tools/lincoln-record/tests/devices_test.rs +23 -0
  301. package/framework/tools/lincoln-record/tests/diarization_tests.rs +101 -0
  302. package/framework/tools/lincoln-record/tests/integration_tests.rs +44 -0
  303. package/framework/tools/lincoln-record/tests/model_test.rs +68 -0
  304. package/framework/tools/lincoln-record/tests/transcription_tests.rs +73 -0
  305. package/package.json +19 -13
@@ -0,0 +1,248 @@
1
+ import { render } from 'ink-testing-library'
2
+ import React from 'react'
3
+ import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest'
4
+ import { RecordingApp } from '../../src/components/RecordingApp'
5
+ import type { RecorderController, RecorderState } from '../../src/recording/useRecorder'
6
+
7
+ const idleState: RecorderState = {
8
+ status: 'idle',
9
+ duration: 0,
10
+ amplitude: 0,
11
+ errorMessage: null,
12
+ }
13
+
14
+ const recordingState: RecorderState = {
15
+ status: 'recording',
16
+ duration: 83,
17
+ amplitude: 0.65,
18
+ errorMessage: null,
19
+ }
20
+
21
+ let currentController: RecorderController
22
+ const exitMock = vi.fn()
23
+
24
+ vi.mock('ink', async () => {
25
+ const actual = await vi.importActual<typeof import('ink')>('ink')
26
+ return {
27
+ ...actual,
28
+ useApp: () => ({ exit: exitMock }),
29
+ }
30
+ })
31
+
32
+ vi.mock('../../src/recording/useRecorder', () => ({
33
+ useRecorder: vi.fn(() => currentController),
34
+ }))
35
+
36
+ async function tick() {
37
+ return new Promise(resolve => setTimeout(resolve, 0))
38
+ }
39
+
40
+ describe('RecordingApp', () => {
41
+ beforeEach(() => {
42
+ currentController = {
43
+ state: { ...idleState },
44
+ start: vi.fn(() => {
45
+ currentController.state = { ...recordingState }
46
+ }),
47
+ stop: vi.fn(() => {
48
+ currentController.state = { status: 'stopped', duration: 83, amplitude: 0, errorMessage: null }
49
+ return Promise.resolve()
50
+ }),
51
+ cancel: vi.fn(() => {
52
+ currentController.state = { status: 'cancelled', duration: 0, amplitude: 0, errorMessage: null }
53
+ return Promise.resolve()
54
+ }),
55
+ }
56
+ exitMock.mockClear()
57
+ })
58
+
59
+ afterEach(() => {
60
+ vi.clearAllMocks()
61
+ })
62
+
63
+ test('renders single HUD initially', () => {
64
+ const { lastFrame } = render(
65
+ <RecordingApp
66
+ workspaceRoot="/workspace"
67
+ sessionId="2026-06-28-test"
68
+ topic="测试访谈"
69
+ designId="test-design"
70
+ branch="main"
71
+ audioMeterStyle="bar"
72
+ />,
73
+ )
74
+
75
+ expect(lastFrame()).toContain('Lincoln Recorder')
76
+ expect(lastFrame()).toContain('Session: 2026-06-28-test')
77
+ expect(lastFrame()).toContain('Topic: 测试访谈')
78
+ expect(lastFrame()).toContain('[r] record [d] devices [m] model [q] quit')
79
+ })
80
+
81
+ test('starts recording when r is pressed', async () => {
82
+ const { stdin } = render(
83
+ <RecordingApp
84
+ workspaceRoot="/workspace"
85
+ sessionId="2026-06-28-test"
86
+ topic=""
87
+ designId=""
88
+ branch=""
89
+ audioMeterStyle="bar"
90
+ />,
91
+ )
92
+
93
+ await tick()
94
+ stdin.write('r')
95
+ await tick()
96
+
97
+ expect(currentController.start).toHaveBeenCalled()
98
+ })
99
+
100
+ test('exits when q is pressed from idle', async () => {
101
+ const { stdin } = render(
102
+ <RecordingApp
103
+ workspaceRoot="/workspace"
104
+ sessionId="2026-06-28-test"
105
+ topic=""
106
+ designId=""
107
+ branch=""
108
+ audioMeterStyle="bar"
109
+ />,
110
+ )
111
+
112
+ await tick()
113
+ stdin.write('q')
114
+ await tick()
115
+
116
+ expect(exitMock).toHaveBeenCalled()
117
+ expect(currentController.start).not.toHaveBeenCalled()
118
+ })
119
+
120
+ test('calls stop when s is pressed during recording', async () => {
121
+ const { stdin, rerender } = render(
122
+ <RecordingApp
123
+ workspaceRoot="/workspace"
124
+ sessionId="2026-06-28-test"
125
+ topic=""
126
+ designId=""
127
+ branch=""
128
+ audioMeterStyle="bar"
129
+ />,
130
+ )
131
+
132
+ await tick()
133
+ stdin.write('r')
134
+ await tick()
135
+ expect(currentController.start).toHaveBeenCalled()
136
+
137
+ rerender(
138
+ <RecordingApp
139
+ workspaceRoot="/workspace"
140
+ sessionId="2026-06-28-test"
141
+ topic=""
142
+ designId=""
143
+ branch=""
144
+ audioMeterStyle="bar"
145
+ />,
146
+ )
147
+ await tick()
148
+
149
+ stdin.write('s')
150
+ await tick()
151
+
152
+ expect(currentController.stop).toHaveBeenCalled()
153
+ })
154
+
155
+ test('calls cancel and exits when c is pressed during recording', async () => {
156
+ const { stdin, rerender } = render(
157
+ <RecordingApp
158
+ workspaceRoot="/workspace"
159
+ sessionId="2026-06-28-test"
160
+ topic=""
161
+ designId=""
162
+ branch=""
163
+ audioMeterStyle="bar"
164
+ />,
165
+ )
166
+
167
+ await tick()
168
+ stdin.write('r')
169
+ await tick()
170
+
171
+ rerender(
172
+ <RecordingApp
173
+ workspaceRoot="/workspace"
174
+ sessionId="2026-06-28-test"
175
+ topic=""
176
+ designId=""
177
+ branch=""
178
+ audioMeterStyle="bar"
179
+ />,
180
+ )
181
+ await tick()
182
+
183
+ stdin.write('c')
184
+ await tick()
185
+
186
+ expect(currentController.cancel).toHaveBeenCalled()
187
+ })
188
+
189
+ test('shows stopped summary when stopped', async () => {
190
+ currentController.state = { status: 'stopped', duration: 120, amplitude: 0, errorMessage: null }
191
+
192
+ const { lastFrame } = render(
193
+ <RecordingApp
194
+ workspaceRoot="/workspace"
195
+ sessionId="2026-06-28-test"
196
+ topic=""
197
+ designId=""
198
+ branch=""
199
+ audioMeterStyle="bar"
200
+ />,
201
+ )
202
+
203
+ await tick()
204
+ expect(lastFrame()).toContain('Stopped')
205
+ expect(lastFrame()).toContain('claude process-interview 2026-06-28-test')
206
+ expect(lastFrame()).toContain('[any key] exit')
207
+ })
208
+
209
+ test('exits when any key is pressed on stopped screen', async () => {
210
+ currentController.state = { status: 'stopped', duration: 120, amplitude: 0, errorMessage: null }
211
+
212
+ const { stdin } = render(
213
+ <RecordingApp
214
+ workspaceRoot="/workspace"
215
+ sessionId="2026-06-28-test"
216
+ topic=""
217
+ designId=""
218
+ branch=""
219
+ audioMeterStyle="bar"
220
+ />,
221
+ )
222
+
223
+ await tick()
224
+ stdin.write('y')
225
+ await tick()
226
+
227
+ expect(exitMock).toHaveBeenCalled()
228
+ })
229
+
230
+ test('logs error when recorder fails', async () => {
231
+ currentController.state = { status: 'error', duration: 0, amplitude: 0, errorMessage: 'microphone not found' }
232
+
233
+ const { lastFrame } = render(
234
+ <RecordingApp
235
+ workspaceRoot="/workspace"
236
+ sessionId="2026-06-28-test"
237
+ topic=""
238
+ designId=""
239
+ branch=""
240
+ audioMeterStyle="bar"
241
+ />,
242
+ )
243
+
244
+ await tick()
245
+ expect(lastFrame()).toContain('microphone not found')
246
+ expect(lastFrame()).toContain('[q] exit')
247
+ })
248
+ })
@@ -0,0 +1,37 @@
1
+ import { render } from 'ink-testing-library'
2
+ import React from 'react'
3
+ import { describe, expect, test } from 'vitest'
4
+ import { RecordingScreen } from '../../src/components/RecordingScreen'
5
+
6
+ describe('RecordingScreen', () => {
7
+ test('renders session info and recording status', () => {
8
+ const { lastFrame } = render(
9
+ <RecordingScreen
10
+ sessionId="2026-06-28-test"
11
+ topic="测试访谈"
12
+ designId="test-design"
13
+ duration={83}
14
+ amplitude={0.65}
15
+ />,
16
+ )
17
+
18
+ expect(lastFrame()).toContain('2026-06-28-test')
19
+ expect(lastFrame()).toContain('测试访谈')
20
+ expect(lastFrame()).toContain('Recording')
21
+ expect(lastFrame()).toContain('01:23')
22
+ })
23
+
24
+ test('renders audio meter when enabled', () => {
25
+ const { lastFrame } = render(
26
+ <RecordingScreen
27
+ sessionId="2026-06-28-test"
28
+ topic=""
29
+ designId=""
30
+ duration={0}
31
+ amplitude={0.8}
32
+ />,
33
+ )
34
+
35
+ expect(lastFrame()).toContain('█')
36
+ })
37
+ })
@@ -0,0 +1,59 @@
1
+ import { render } from 'ink-testing-library'
2
+ import React from 'react'
3
+ import { describe, expect, test, vi } from 'vitest'
4
+ import { SelectMenu } from '../../src/components/SelectMenu'
5
+
6
+ async function tick() {
7
+ return new Promise(resolve => setTimeout(resolve, 0))
8
+ }
9
+
10
+ const items = [
11
+ { key: 'a', label: 'Mic A' },
12
+ { key: 'b', label: 'Mic B' },
13
+ ]
14
+
15
+ describe('SelectMenu', () => {
16
+ test('renders title and items with the first one selected', () => {
17
+ const { lastFrame } = render(
18
+ <SelectMenu title="Devices" items={items} onSelect={() => {}} onClose={() => {}} />,
19
+ )
20
+ expect(lastFrame()).toContain('Devices')
21
+ expect(lastFrame()).toContain('› Mic A')
22
+ expect(lastFrame()).toContain(' Mic B')
23
+ })
24
+
25
+ test('moves selection with the down arrow', async () => {
26
+ const { lastFrame, stdin } = render(
27
+ <SelectMenu title="Devices" items={items} onSelect={() => {}} onClose={() => {}} />,
28
+ )
29
+ await tick()
30
+ stdin.write('')
31
+ await tick()
32
+ expect(lastFrame()).toContain(' Mic A')
33
+ expect(lastFrame()).toContain('› Mic B')
34
+ })
35
+
36
+ test('calls onSelect with the highlighted key on enter', async () => {
37
+ const onSelect = vi.fn()
38
+ const { stdin } = render(
39
+ <SelectMenu title="Devices" items={items} onSelect={onSelect} onClose={() => {}} />,
40
+ )
41
+ await tick()
42
+ stdin.write('')
43
+ await tick()
44
+ stdin.write('\r')
45
+ await tick()
46
+ expect(onSelect).toHaveBeenCalledWith('b')
47
+ })
48
+
49
+ test('calls onClose on escape', async () => {
50
+ const onClose = vi.fn()
51
+ const { stdin } = render(
52
+ <SelectMenu title="Devices" items={items} onSelect={() => {}} onClose={onClose} />,
53
+ )
54
+ await tick()
55
+ stdin.write('')
56
+ await tick()
57
+ expect(onClose).toHaveBeenCalledTimes(1)
58
+ })
59
+ })
@@ -0,0 +1,38 @@
1
+ import { render } from 'ink-testing-library'
2
+ import React from 'react'
3
+ import { describe, expect, test, vi } from 'vitest'
4
+ import { StopConfirmation } from '../../src/components/StopConfirmation'
5
+
6
+ async function tick() {
7
+ return new Promise(resolve => setTimeout(resolve, 0))
8
+ }
9
+
10
+ describe('StopConfirmation', () => {
11
+ test('renders command and workspace', () => {
12
+ const { lastFrame } = render(
13
+ <StopConfirmation
14
+ sessionId="2026-06-28-test"
15
+ workspaceRoot="/workspace"
16
+ onConfirm={vi.fn()}
17
+ />,
18
+ )
19
+
20
+ expect(lastFrame()).toContain('Stopped')
21
+ expect(lastFrame()).toContain('Session 2026-06-28-test saved.')
22
+ expect(lastFrame()).toContain('Workspace: /workspace')
23
+ expect(lastFrame()).toContain('claude process-interview 2026-06-28-test')
24
+ })
25
+
26
+ test('calls onConfirm when any key is pressed', async () => {
27
+ const onConfirm = vi.fn()
28
+ const { stdin } = render(
29
+ <StopConfirmation sessionId="2026-06-28-test" onConfirm={onConfirm} />,
30
+ )
31
+
32
+ await tick()
33
+ stdin.write('y')
34
+ await tick()
35
+
36
+ expect(onConfirm).toHaveBeenCalledTimes(1)
37
+ })
38
+ })
@@ -0,0 +1,49 @@
1
+ import { describe, expect, test } from 'vitest'
2
+ import { parseArgs } from '../../src/config/args'
3
+
4
+ describe('parseArgs', () => {
5
+ test('returns defaults when no args are provided', () => {
6
+ const result = parseArgs([])
7
+
8
+ expect(result.topic).toBeUndefined()
9
+ expect(result.designId).toBeUndefined()
10
+ expect(result.branch).toBeUndefined()
11
+ expect(result.sessionId).toBeUndefined()
12
+ expect(result.noTui).toBe(false)
13
+ expect(result.help).toBe(false)
14
+ })
15
+
16
+ test('parses --topic, --design-id, and --branch', () => {
17
+ const result = parseArgs([
18
+ '--topic',
19
+ '结算流程 redesign 需求访谈',
20
+ '--design-id',
21
+ 'checkout-redesign',
22
+ '--branch',
23
+ 'pm-workflow-integration-plugin',
24
+ ])
25
+
26
+ expect(result.topic).toBe('结算流程 redesign 需求访谈')
27
+ expect(result.designId).toBe('checkout-redesign')
28
+ expect(result.branch).toBe('pm-workflow-integration-plugin')
29
+ })
30
+
31
+ test('parses --no-tui', () => {
32
+ const result = parseArgs(['--no-tui'])
33
+
34
+ expect(result.noTui).toBe(true)
35
+ })
36
+
37
+ test('parses --help', () => {
38
+ const result = parseArgs(['--help'])
39
+
40
+ expect(result.help).toBe(true)
41
+ })
42
+
43
+ test('ignores unknown options and positional arguments', () => {
44
+ const result = parseArgs(['--unknown', 'value', 'positional'])
45
+
46
+ expect(result.topic).toBeUndefined()
47
+ expect(result.noTui).toBe(false)
48
+ })
49
+ })
@@ -0,0 +1,59 @@
1
+ import { mkdtempSync, writeFileSync } from 'node:fs'
2
+ import { tmpdir } from 'node:os'
3
+ import { join } from 'node:path'
4
+ import { describe, expect, test } from 'vitest'
5
+ import { loadConfig, loadConfigOptional } from '../../src/config/loadConfig'
6
+
7
+ describe('loadConfig', () => {
8
+ test('loads a valid YAML config', () => {
9
+ const dir = mkdtempSync(join(tmpdir(), 'lincoln-config-'))
10
+ const path = join(dir, '.lincolnrc')
11
+ writeFileSync(path, 'default_design_id: checkout-redesign\nshow_audio_meter: true\n', 'utf-8')
12
+
13
+ const result = loadConfig(path)
14
+
15
+ expect(result.defaultDesignId).toBe('checkout-redesign')
16
+ expect(result.showAudioMeter).toBe(true)
17
+ })
18
+
19
+ test('loads a valid JSON config', () => {
20
+ const dir = mkdtempSync(join(tmpdir(), 'lincoln-config-'))
21
+ const path = join(dir, '.lincolnrc.json')
22
+ writeFileSync(path, JSON.stringify({ auto_process: false, audio_meter_style: 'dot' }), 'utf-8')
23
+
24
+ const result = loadConfig(path)
25
+
26
+ expect(result.autoProcess).toBe(false)
27
+ expect(result.audioMeterStyle).toBe('dot')
28
+ })
29
+
30
+ test('throws when config file is missing', () => {
31
+ expect(() => loadConfig('/nonexistent/.lincolnrc')).toThrow('Config file not found')
32
+ })
33
+
34
+ test('throws when config file has invalid YAML', () => {
35
+ const dir = mkdtempSync(join(tmpdir(), 'lincoln-config-'))
36
+ const path = join(dir, '.lincolnrc')
37
+ writeFileSync(path, '{ invalid yaml', 'utf-8')
38
+
39
+ expect(() => loadConfig(path)).toThrow('Failed to parse config')
40
+ })
41
+ })
42
+
43
+ describe('loadConfigOptional', () => {
44
+ test('returns empty config when file is missing', () => {
45
+ const result = loadConfigOptional('/nonexistent/.lincolnrc')
46
+
47
+ expect(result).toEqual({})
48
+ })
49
+
50
+ test('returns parsed config when file exists', () => {
51
+ const dir = mkdtempSync(join(tmpdir(), 'lincoln-config-'))
52
+ const path = join(dir, '.lincolnrc')
53
+ writeFileSync(path, 'default_topic: "结算流程 redesign 需求访谈"\n', 'utf-8')
54
+
55
+ const result = loadConfigOptional(path)
56
+
57
+ expect(result.defaultTopic).toBe('结算流程 redesign 需求访谈')
58
+ })
59
+ })
@@ -0,0 +1,72 @@
1
+ import { mkdirSync, mkdtempSync, writeFileSync } from 'node:fs'
2
+ import { tmpdir } from 'node:os'
3
+ import { join } from 'node:path'
4
+ import { describe, expect, test } from 'vitest'
5
+ import { resolveConfig } from '../../src/config/resolveConfig'
6
+
7
+ describe('resolveConfig', () => {
8
+ test('uses defaults when no args and no config files exist', () => {
9
+ const dir = mkdtempSync(join(tmpdir(), 'lincoln-resolve-'))
10
+
11
+ const result = resolveConfig({}, { cwd: dir, home: dir, now: new Date('2026-06-28T00:00:00Z') })
12
+
13
+ expect(result.sessionId).toMatch(/^2026-06-28-/)
14
+ expect(result.noTui).toBe(false)
15
+ })
16
+
17
+ test('CLI args override global config', () => {
18
+ const home = mkdtempSync(join(tmpdir(), 'lincoln-home-'))
19
+ writeFileSync(join(home, '.lincolnrc'), 'default_design_id: global-design\n', 'utf-8')
20
+
21
+ const result = resolveConfig(
22
+ { designId: 'cli-design' },
23
+ { cwd: home, home, now: new Date('2026-06-28T00:00:00Z') },
24
+ )
25
+
26
+ expect(result.designId).toBe('cli-design')
27
+ })
28
+
29
+ test('local config overrides global config', () => {
30
+ const home = mkdtempSync(join(tmpdir(), 'lincoln-home-'))
31
+ const cwd = mkdtempSync(join(tmpdir(), 'lincoln-cwd-'))
32
+ writeFileSync(join(home, '.lincolnrc'), 'default_design_id: global-design\n', 'utf-8')
33
+ writeFileSync(join(cwd, '.lincolnrc'), 'default_design_id: local-design\n', 'utf-8')
34
+
35
+ const result = resolveConfig({}, { cwd, home, now: new Date('2026-06-28T00:00:00Z') })
36
+
37
+ expect(result.designId).toBe('local-design')
38
+ })
39
+
40
+ test('uses global config when no local config or CLI args', () => {
41
+ const home = mkdtempSync(join(tmpdir(), 'lincoln-home-'))
42
+ const cwd = mkdtempSync(join(tmpdir(), 'lincoln-cwd-'))
43
+ writeFileSync(join(home, '.lincolnrc'), 'default_topic: "全局主题"\n', 'utf-8')
44
+
45
+ const result = resolveConfig({}, { cwd, home, now: new Date('2026-06-28T00:00:00Z') })
46
+
47
+ expect(result.topic).toBe('全局主题')
48
+ })
49
+
50
+ test('preserves CLI noTui flag', () => {
51
+ const dir = mkdtempSync(join(tmpdir(), 'lincoln-resolve-'))
52
+
53
+ const result = resolveConfig(
54
+ { noTui: true },
55
+ { cwd: dir, home: dir, now: new Date('2026-06-28T00:00:00Z') },
56
+ )
57
+
58
+ expect(result.noTui).toBe(true)
59
+ })
60
+
61
+ test('appends counter when recording file already exists', () => {
62
+ const dir = mkdtempSync(join(tmpdir(), 'lincoln-resolve-'))
63
+ const recordingsDir = join(dir, 'recordings')
64
+ mkdirSync(recordingsDir)
65
+ writeFileSync(join(recordingsDir, '2026-06-28-recording.m4a'), '', 'utf-8')
66
+ writeFileSync(join(recordingsDir, '2026-06-28-recording-001.m4a'), '', 'utf-8')
67
+
68
+ const result = resolveConfig({}, { cwd: dir, home: dir, now: new Date('2026-06-28T00:00:00Z') })
69
+
70
+ expect(result.sessionId).toBe('2026-06-28-recording-002')
71
+ })
72
+ })
@@ -0,0 +1,21 @@
1
+ import { describe, expect, test } from 'vitest'
2
+ import { parseDevicesOutput } from '../../src/devices/parseDevices'
3
+
4
+ describe('parseDevicesOutput', () => {
5
+ test('parses default device and device list', () => {
6
+ const output = 'Default input: MacBook Pro Microphone\n MacBook Pro Microphone\n External Mic\n'
7
+ const result = parseDevicesOutput(output)
8
+ expect(result.defaultDevice).toBe('MacBook Pro Microphone')
9
+ expect(result.devices).toEqual(['MacBook Pro Microphone', 'External Mic'])
10
+ })
11
+
12
+ test('returns null default when the line is missing', () => {
13
+ const result = parseDevicesOutput(' Mic A\n')
14
+ expect(result.defaultDevice).toBeNull()
15
+ expect(result.devices).toEqual(['Mic A'])
16
+ })
17
+
18
+ test('returns empty result for empty output', () => {
19
+ expect(parseDevicesOutput('')).toEqual({ defaultDevice: null, devices: [] })
20
+ })
21
+ })
@@ -0,0 +1,44 @@
1
+ import { Text } from 'ink'
2
+ import { render } from 'ink-testing-library'
3
+ import React from 'react'
4
+ import { describe, expect, test, vi } from 'vitest'
5
+ import { useKeyHandler } from '../../src/hooks/useKeyHandler'
6
+
7
+ const onRecordMock = vi.fn()
8
+ const onQuitMock = vi.fn()
9
+
10
+ function TestComponent({ enabled }: { enabled: boolean }) {
11
+ useKeyHandler({ enabled, onRecord: onRecordMock, onQuit: onQuitMock })
12
+ return <Text>handlers active</Text>
13
+ }
14
+
15
+ async function tick() {
16
+ return new Promise(resolve => setTimeout(resolve, 0))
17
+ }
18
+
19
+ describe('useKeyHandler enabled flag', () => {
20
+ test('ignores all keys when disabled', async () => {
21
+ onRecordMock.mockClear()
22
+ onQuitMock.mockClear()
23
+ const { stdin } = render(<TestComponent enabled={false} />)
24
+
25
+ await tick()
26
+ stdin.write('r')
27
+ stdin.write('q')
28
+ await tick()
29
+
30
+ expect(onRecordMock).not.toHaveBeenCalled()
31
+ expect(onQuitMock).not.toHaveBeenCalled()
32
+ })
33
+
34
+ test('handles keys when enabled', async () => {
35
+ onRecordMock.mockClear()
36
+ const { stdin } = render(<TestComponent enabled />)
37
+
38
+ await tick()
39
+ stdin.write('r')
40
+ await tick()
41
+
42
+ expect(onRecordMock).toHaveBeenCalledTimes(1)
43
+ })
44
+ })