@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,127 @@
1
+ import { spawn, type ChildProcessByStdio } from 'node:child_process'
2
+ import { type Readable, type Writable } from 'node:stream'
3
+ import { EventEmitter } from 'node:events'
4
+
5
+ export interface SpawnRecorderOptions {
6
+ workspaceRoot: string
7
+ sessionId: string
8
+ lincolnRecordPath?: string
9
+ mic?: string | null
10
+ model?: string | null
11
+ }
12
+
13
+ export interface RecorderProcess {
14
+ on(event: 'ready', listener: () => void): this
15
+ on(event: 'error', listener: (error: Error) => void): this
16
+ on(event: 'exit', listener: (code: number | null, signal: NodeJS.Signals | null) => void): this
17
+ stop(): Promise<void>
18
+ cancel(): Promise<void>
19
+ }
20
+
21
+ class RecorderProcessImpl extends EventEmitter implements RecorderProcess {
22
+ private child: ChildProcessByStdio<Writable, Readable, Readable>
23
+ private stopped = false
24
+ private exitPromise: Promise<void>
25
+ private resolveExit: () => void = () => {}
26
+ private exitSettled = false
27
+
28
+ constructor(child: ChildProcessByStdio<Writable, Readable, Readable>) {
29
+ super()
30
+ this.child = child
31
+ this.exitPromise = new Promise((resolve) => {
32
+ this.resolveExit = resolve
33
+ })
34
+
35
+ this.child.on('error', (error) => {
36
+ this.emit('error', error)
37
+ this.settleExit()
38
+ })
39
+
40
+ this.child.on('exit', (code, signal) => {
41
+ this.emit('exit', code, signal)
42
+ this.settleExit()
43
+ })
44
+
45
+ this.child.stdout.on('data', (data: Buffer) => {
46
+ process.stdout.write(data)
47
+ })
48
+
49
+ this.child.stderr.on('data', (data: Buffer) => {
50
+ process.stderr.write(data)
51
+ })
52
+
53
+ // lincoln-record begins capturing immediately; treat it as ready.
54
+ process.nextTick(() => this.emit('ready'))
55
+ }
56
+
57
+ private settleExit(): void {
58
+ if (!this.exitSettled) {
59
+ this.exitSettled = true
60
+ this.resolveExit()
61
+ }
62
+ }
63
+
64
+ stop(): Promise<void> {
65
+ return this._terminate('SIGINT')
66
+ }
67
+
68
+ cancel(): Promise<void> {
69
+ return this._terminate('SIGKILL')
70
+ }
71
+
72
+ private _terminate(signal: NodeJS.Signals): Promise<void> {
73
+ if (this.stopped) {
74
+ return this.exitPromise
75
+ }
76
+ this.stopped = true
77
+
78
+ if (this.child.killed) {
79
+ return this.exitPromise
80
+ }
81
+
82
+ this.child.kill(signal)
83
+
84
+ const timeout = setTimeout(() => {
85
+ if (!this.child.killed) {
86
+ this.child.kill('SIGKILL')
87
+ }
88
+ }, 5000)
89
+
90
+ this.exitPromise.finally(() => clearTimeout(timeout))
91
+
92
+ return this.exitPromise
93
+ }
94
+ }
95
+
96
+ export function spawnRecorder(options: SpawnRecorderOptions): RecorderProcess {
97
+ const {
98
+ workspaceRoot,
99
+ sessionId,
100
+ lincolnRecordPath = 'lincoln-record',
101
+ mic,
102
+ model,
103
+ } = options
104
+
105
+ const args: string[] = [
106
+ 'record',
107
+ '--session-id',
108
+ sessionId,
109
+ '--output',
110
+ workspaceRoot,
111
+ ]
112
+
113
+ if (mic) {
114
+ args.push('--mic', mic)
115
+ }
116
+
117
+ if (model) {
118
+ args.push('--model', model)
119
+ }
120
+
121
+ const child = spawn(lincolnRecordPath, args, {
122
+ cwd: workspaceRoot,
123
+ stdio: ['pipe', 'pipe', 'pipe'],
124
+ })
125
+
126
+ return new RecorderProcessImpl(child)
127
+ }
@@ -0,0 +1,146 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react'
2
+
3
+ import { spawnRecorder, type RecorderProcess, type SpawnRecorderOptions } from './spawnRecorder'
4
+
5
+ export interface UseRecorderOptions extends SpawnRecorderOptions {
6
+ startOnMount?: boolean
7
+ }
8
+
9
+ export interface RecorderState {
10
+ status: 'idle' | 'recording' | 'stopped' | 'cancelled' | 'error'
11
+ duration: number
12
+ amplitude: number
13
+ errorMessage: string | null
14
+ }
15
+
16
+ export interface RecorderController {
17
+ state: RecorderState
18
+ start: () => void
19
+ stop: () => Promise<void>
20
+ cancel: () => Promise<void>
21
+ }
22
+
23
+ function mockAmplitude(duration: number): number {
24
+ return 0.5 + 0.4 * Math.sin(duration * 0.8)
25
+ }
26
+
27
+ export function useRecorder(options: UseRecorderOptions): RecorderController {
28
+ const {
29
+ startOnMount = false,
30
+ workspaceRoot,
31
+ sessionId,
32
+ lincolnRecordPath,
33
+ mic,
34
+ model,
35
+ } = options
36
+ const [state, setState] = useState<RecorderState>({
37
+ status: 'idle',
38
+ duration: 0,
39
+ amplitude: 0,
40
+ errorMessage: null,
41
+ })
42
+
43
+ const recorderRef = useRef<RecorderProcess | null>(null)
44
+ const intervalRef = useRef<NodeJS.Timeout | null>(null)
45
+ const durationRef = useRef(0)
46
+ const terminatingRef = useRef(false)
47
+
48
+ const clearRecordingInterval = useCallback(() => {
49
+ if (intervalRef.current) {
50
+ clearInterval(intervalRef.current)
51
+ intervalRef.current = null
52
+ }
53
+ }, [])
54
+
55
+ const start = useCallback(() => {
56
+ if (recorderRef.current) {
57
+ return
58
+ }
59
+
60
+ terminatingRef.current = false
61
+ setState({ status: 'recording', duration: 0, amplitude: 0.3, errorMessage: null })
62
+ durationRef.current = 0
63
+
64
+ try {
65
+ const recorder = spawnRecorder({
66
+ workspaceRoot,
67
+ sessionId,
68
+ lincolnRecordPath,
69
+ mic,
70
+ model,
71
+ })
72
+ recorderRef.current = recorder
73
+
74
+ recorder.on('ready', () => {
75
+ // Recording is active
76
+ })
77
+
78
+ recorder.on('error', error => {
79
+ setState(s => ({ ...s, status: 'error', errorMessage: error.message }))
80
+ clearRecordingInterval()
81
+ })
82
+
83
+ recorder.on('exit', (code, signal) => {
84
+ recorderRef.current = null
85
+ clearRecordingInterval()
86
+
87
+ if (terminatingRef.current) {
88
+ return
89
+ }
90
+
91
+ const reason = code !== null && code !== undefined
92
+ ? `lincoln-record exited unexpectedly with code ${code}`
93
+ : `lincoln-record exited unexpectedly with signal ${signal}`
94
+ setState(s => ({ ...s, status: 'error', errorMessage: reason }))
95
+ })
96
+
97
+ intervalRef.current = setInterval(() => {
98
+ durationRef.current += 1
99
+ setState(s => ({
100
+ ...s,
101
+ duration: durationRef.current,
102
+ amplitude: mockAmplitude(durationRef.current),
103
+ }))
104
+ }, 1000)
105
+ } catch (error) {
106
+ const message = error instanceof Error ? error.message : String(error)
107
+ setState(s => ({ ...s, status: 'error', errorMessage: message }))
108
+ }
109
+ }, [workspaceRoot, sessionId, lincolnRecordPath, mic, model, clearRecordingInterval])
110
+
111
+ const stop = useCallback(async () => {
112
+ const recorder = recorderRef.current
113
+ if (!recorder) return
114
+
115
+ terminatingRef.current = true
116
+ clearRecordingInterval()
117
+ setState(s => ({ ...s, status: 'stopped' }))
118
+ await recorder.stop()
119
+ }, [clearRecordingInterval])
120
+
121
+ const cancel = useCallback(async () => {
122
+ const recorder = recorderRef.current
123
+ if (!recorder) return
124
+
125
+ terminatingRef.current = true
126
+ clearRecordingInterval()
127
+ setState(s => ({ ...s, status: 'cancelled' }))
128
+ await recorder.cancel()
129
+ }, [clearRecordingInterval])
130
+
131
+ useEffect(() => {
132
+ if (startOnMount) {
133
+ start()
134
+ }
135
+
136
+ return () => {
137
+ clearRecordingInterval()
138
+ if (recorderRef.current) {
139
+ recorderRef.current.cancel().catch(() => {})
140
+ recorderRef.current = null
141
+ }
142
+ }
143
+ }, [startOnMount, start, clearRecordingInterval])
144
+
145
+ return { state, start, stop, cancel }
146
+ }
@@ -0,0 +1,4 @@
1
+ export function amplitudeToMeter(amplitude: number, maxBars: number): number {
2
+ const clamped = Math.max(0, Math.min(1, amplitude))
3
+ return Math.round(clamped * maxBars)
4
+ }
@@ -0,0 +1,6 @@
1
+ export function formatDuration(totalSeconds: number): string {
2
+ const safeSeconds = Math.max(0, Math.floor(totalSeconds))
3
+ const minutes = Math.floor(safeSeconds / 60)
4
+ const seconds = safeSeconds % 60
5
+ return `${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`
6
+ }
@@ -0,0 +1,25 @@
1
+ export interface GenerateSessionIdOptions {
2
+ now?: Date
3
+ descriptor?: string
4
+ }
5
+
6
+ export function generateSessionId(options: GenerateSessionIdOptions = {}): string {
7
+ const now = options.now ?? new Date()
8
+ const date = now.toISOString().slice(0, 10)
9
+ const slug = normalizeDescriptor(options.descriptor)
10
+ return `${date}-${slug}`
11
+ }
12
+
13
+ function normalizeDescriptor(descriptor: string | undefined): string {
14
+ if (!descriptor) {
15
+ return 'recording'
16
+ }
17
+
18
+ const normalized = descriptor
19
+ .trim()
20
+ .toLowerCase()
21
+ .replace(/[^a-z0-9一-龥]+/g, '-')
22
+ .replace(/^-+|-+$/g, '')
23
+
24
+ return normalized.slice(0, 80) || 'recording'
25
+ }
@@ -0,0 +1,52 @@
1
+ import { render } from 'ink-testing-library'
2
+ import React from 'react'
3
+ import { describe, expect, test, vi } from 'vitest'
4
+ import { App } from '../src/cli'
5
+
6
+ vi.mock('../src/recording/useRecorder', () => ({
7
+ useRecorder: vi.fn(() => ({
8
+ state: { status: 'recording', duration: 0, amplitude: 0.3, errorMessage: null },
9
+ start: vi.fn(),
10
+ stop: vi.fn(),
11
+ cancel: vi.fn(),
12
+ })),
13
+ }))
14
+
15
+ const baseConfig = {
16
+ workspaceRoot: '/workspace',
17
+ topic: '',
18
+ designId: '',
19
+ branch: '',
20
+ sessionId: '2026-06-28-test',
21
+ noTui: false,
22
+ autoProcess: false,
23
+ showAudioMeter: true,
24
+ audioMeterStyle: 'bar' as const,
25
+ }
26
+
27
+ describe('App', () => {
28
+ test('renders help when help arg is true', () => {
29
+ const { lastFrame } = render(<App args={{ help: true, noTui: false }} config={baseConfig} />,
30
+ )
31
+
32
+ expect(lastFrame()).toContain('Usage:')
33
+ })
34
+
35
+ test('renders recording app when help is false', () => {
36
+ const { lastFrame } = render(
37
+ <App
38
+ args={{ help: false, noTui: false }}
39
+ config={{
40
+ ...baseConfig,
41
+ topic: '测试',
42
+ designId: 'test-design',
43
+ branch: 'main',
44
+ }}
45
+ />,
46
+ )
47
+
48
+ expect(lastFrame()).toContain('Lincoln Recorder')
49
+ expect(lastFrame()).toContain('2026-06-28-test')
50
+ expect(lastFrame()).toContain('测试')
51
+ })
52
+ })
@@ -0,0 +1,31 @@
1
+ import { render } from 'ink-testing-library'
2
+ import React from 'react'
3
+ import { describe, expect, test } from 'vitest'
4
+ import { AudioMeter } from '../../src/components/AudioMeter'
5
+
6
+ describe('AudioMeter', () => {
7
+ test('renders bar style with correct number of blocks', () => {
8
+ const { lastFrame } = render(<AudioMeter amplitude={0.5} style="bar" />)
9
+
10
+ expect(lastFrame()).toContain('█')
11
+ expect(lastFrame()?.length).toBeGreaterThan(0)
12
+ })
13
+
14
+ test('renders dot style', () => {
15
+ const { lastFrame } = render(<AudioMeter amplitude={0.5} style="dot" />)
16
+
17
+ expect(lastFrame()).toContain('●')
18
+ })
19
+
20
+ test('renders wave style', () => {
21
+ const { lastFrame } = render(<AudioMeter amplitude={0.5} style="wave" />)
22
+
23
+ expect(lastFrame()).toContain('~')
24
+ })
25
+
26
+ test('renders empty meter for zero amplitude', () => {
27
+ const { lastFrame } = render(<AudioMeter amplitude={0} style="bar" />)
28
+
29
+ expect(lastFrame()).not.toContain('█')
30
+ })
31
+ })
@@ -0,0 +1,12 @@
1
+ import { render } from 'ink-testing-library'
2
+ import React from 'react'
3
+ import { describe, expect, test } from 'vitest'
4
+ import { CancelledScreen } from '../../src/components/CancelledScreen'
5
+
6
+ describe('CancelledScreen', () => {
7
+ test('renders cancellation message', () => {
8
+ const { lastFrame } = render(<CancelledScreen />)
9
+
10
+ expect(lastFrame()).toContain('cancelled')
11
+ })
12
+ })
@@ -0,0 +1,68 @@
1
+ import { render } from 'ink-testing-library'
2
+ import React from 'react'
3
+ import { describe, expect, test } from 'vitest'
4
+ import { ReadyScreen } from '../../src/components/ReadyScreen'
5
+
6
+ describe('ReadyScreen', () => {
7
+ test('renders title and session info', () => {
8
+ const { lastFrame } = render(
9
+ <ReadyScreen
10
+ sessionId="2026-06-28-test"
11
+ topic="测试访谈"
12
+ designId="checkout-redesign"
13
+ branch="main"
14
+ />,
15
+ )
16
+
17
+ expect(lastFrame()).toContain('Lincoln Recorder')
18
+ expect(lastFrame()).toContain('Session: 2026-06-28-test')
19
+ expect(lastFrame()).toContain('Topic: 测试访谈')
20
+ expect(lastFrame()).toContain('Design: checkout-redesign')
21
+ expect(lastFrame()).toContain('Branch: main')
22
+ })
23
+
24
+ test('hides empty optional fields', () => {
25
+ const { lastFrame } = render(
26
+ <ReadyScreen
27
+ sessionId="2026-06-28-test"
28
+ topic=""
29
+ designId=""
30
+ branch=""
31
+ />,
32
+ )
33
+
34
+ expect(lastFrame()).toContain('Session: 2026-06-28-test')
35
+ expect(lastFrame()).not.toContain('Topic:')
36
+ expect(lastFrame()).not.toContain('Design:')
37
+ expect(lastFrame()).not.toContain('Branch:')
38
+ })
39
+
40
+ test('highlights the selected option', () => {
41
+ const { lastFrame: selectedLastFrame } = render(
42
+ <ReadyScreen
43
+ sessionId="2026-06-28-test"
44
+ topic=""
45
+ designId=""
46
+ branch=""
47
+ selectedIndex={0}
48
+ />,
49
+ )
50
+
51
+ expect(selectedLastFrame()).toContain('▸')
52
+ expect(selectedLastFrame()).toContain('开始录音')
53
+ expect(selectedLastFrame()).toContain('退出')
54
+
55
+ const { lastFrame: exitLastFrame } = render(
56
+ <ReadyScreen
57
+ sessionId="2026-06-28-test"
58
+ topic=""
59
+ designId=""
60
+ branch=""
61
+ selectedIndex={1}
62
+ />,
63
+ )
64
+
65
+ expect(exitLastFrame()).toContain('▸')
66
+ expect(exitLastFrame()).toContain('退出')
67
+ })
68
+ })
@@ -0,0 +1,158 @@
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
+ import type { ModelStatus } from '../../src/models/models'
7
+ import type { WarmupProgress } from '../../src/models/warmupProgress'
8
+
9
+ const idleState: RecorderState = {
10
+ status: 'idle',
11
+ duration: 0,
12
+ amplitude: 0,
13
+ errorMessage: null,
14
+ }
15
+
16
+ let currentController: RecorderController
17
+ const exitMock = vi.fn()
18
+
19
+ vi.mock('ink', async () => {
20
+ const actual = await vi.importActual<typeof import('ink')>('ink')
21
+ return {
22
+ ...actual,
23
+ useApp: () => ({ exit: exitMock }),
24
+ }
25
+ })
26
+
27
+ vi.mock('../../src/recording/useRecorder', () => ({
28
+ useRecorder: vi.fn(() => currentController),
29
+ }))
30
+
31
+ async function tick(ms = 0) {
32
+ return new Promise(resolve => setTimeout(resolve, ms))
33
+ }
34
+
35
+ const modelStatuses: ModelStatus[] = [
36
+ { name: 'tiny', cached: false },
37
+ { name: 'base', cached: true },
38
+ ]
39
+
40
+ function renderApp(extraProps: Record<string, unknown> = {}) {
41
+ return render(
42
+ <RecordingApp
43
+ workspaceRoot="/workspace"
44
+ sessionId="2026-06-28-test"
45
+ topic=""
46
+ designId=""
47
+ branch=""
48
+ audioMeterStyle="bar"
49
+ listDevicesFn={async () => ({
50
+ defaultDevice: 'MacBook Pro Microphone',
51
+ devices: ['MacBook Pro Microphone', 'External Mic'],
52
+ })}
53
+ listModelStatusesFn={async () => modelStatuses}
54
+ runWarmupFn={async () => '/cache/whisper/ggml-tiny.bin'}
55
+ {...extraProps}
56
+ />,
57
+ )
58
+ }
59
+
60
+ describe('RecordingApp menus', () => {
61
+ beforeEach(() => {
62
+ currentController = {
63
+ state: { ...idleState },
64
+ start: vi.fn(),
65
+ stop: vi.fn(() => Promise.resolve()),
66
+ cancel: vi.fn(() => Promise.resolve()),
67
+ }
68
+ exitMock.mockClear()
69
+ })
70
+
71
+ afterEach(() => {
72
+ vi.clearAllMocks()
73
+ })
74
+
75
+ test('opens the devices menu when d is pressed and selects a device', async () => {
76
+ const { lastFrame, stdin } = renderApp()
77
+
78
+ await tick()
79
+ stdin.write('d')
80
+ await tick(10)
81
+
82
+ expect(lastFrame()).toContain('Devices')
83
+ expect(lastFrame()).toContain('MacBook Pro Microphone')
84
+ expect(lastFrame()).toContain('External Mic')
85
+
86
+ stdin.write('')
87
+ await tick()
88
+ stdin.write('\r')
89
+ await tick()
90
+
91
+ expect(lastFrame()).toContain('Input device: External Mic')
92
+ expect(lastFrame()).toContain('[r] record')
93
+ })
94
+
95
+ test('closes the devices menu on escape without selecting', async () => {
96
+ const { lastFrame, stdin } = renderApp()
97
+
98
+ await tick()
99
+ stdin.write('d')
100
+ await tick(10)
101
+ stdin.write('')
102
+ await tick()
103
+
104
+ expect(lastFrame()).not.toContain('› MacBook')
105
+ expect(lastFrame()).toContain('[r] record')
106
+ })
107
+
108
+ test('opens the model menu when m is pressed and selects a cached model', async () => {
109
+ const { lastFrame, stdin } = renderApp()
110
+
111
+ await tick()
112
+ stdin.write('m')
113
+ await tick(10)
114
+
115
+ expect(lastFrame()).toContain('Model')
116
+ expect(lastFrame()).toContain('base')
117
+
118
+ stdin.write('')
119
+ await tick()
120
+ stdin.write('\r')
121
+ await tick()
122
+
123
+ expect(lastFrame()).toContain('Model: base')
124
+ })
125
+
126
+ test('runs warmup with progress when selecting an uncached model', async () => {
127
+ const runWarmupFn = vi.fn(
128
+ async (_model: string, onProgress: (p: WarmupProgress) => void) => {
129
+ onProgress({ downloaded: 50, total: 100, percent: 50 })
130
+ return '/cache/whisper/ggml-tiny.bin'
131
+ },
132
+ )
133
+ const { lastFrame, stdin } = renderApp({ runWarmupFn })
134
+
135
+ await tick()
136
+ stdin.write('m')
137
+ await tick(10)
138
+
139
+ // tiny is the first item and is not cached
140
+ stdin.write('\r')
141
+ await tick(10)
142
+
143
+ expect(runWarmupFn).toHaveBeenCalledWith('tiny', expect.any(Function))
144
+ expect(lastFrame()).toContain('Model: tiny')
145
+ })
146
+
147
+ test('does not quit with q while a menu is open', async () => {
148
+ const { stdin } = renderApp()
149
+
150
+ await tick()
151
+ stdin.write('d')
152
+ await tick(10)
153
+ stdin.write('q')
154
+ await tick()
155
+
156
+ expect(exitMock).not.toHaveBeenCalled()
157
+ })
158
+ })