@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.
- package/dist/main.d.ts +3 -0
- package/dist/main.js +1231 -906
- package/dist/main.js.map +1 -1
- package/dist/postinstall.d.ts +3 -0
- package/dist/postinstall.js +18 -0
- package/dist/postinstall.js.map +1 -0
- package/framework/.claude/agents/_contract.md +79 -0
- package/framework/.claude/agents/architect.md +31 -0
- package/framework/.claude/agents/default.md +151 -0
- package/framework/.claude/agents/designer.md +33 -0
- package/framework/.claude/agents/engineer.md +42 -0
- package/framework/.claude/agents/external/NOTICES.md +12 -0
- package/framework/.claude/agents/external/everything-claude-code.manifest.yaml +23 -0
- package/framework/.claude/agents/external/oh-my-claudecode.manifest.yaml +26 -0
- package/framework/.claude/agents/external/wshobson-agents.manifest.yaml +23 -0
- package/framework/.claude/agents/frontend-engineer.md +32 -0
- package/framework/.claude/agents/knowledge-curator.md +28 -0
- package/framework/.claude/agents/pm.md +38 -0
- package/framework/.claude/agents/qa.md +28 -0
- package/framework/.claude/agents/release-coordinator.md +25 -0
- package/framework/.claude/agents/researcher.md +41 -0
- package/framework/.claude/harnesses/claude-code.yaml +15 -0
- package/framework/.claude/harnesses/codex.yaml +40 -0
- package/framework/.claude/harnesses/command-map.yaml +255 -0
- package/framework/.claude/harnesses/opencode.yaml +32 -0
- package/framework/.claude/harnesses/scenarios.yaml +45 -0
- package/framework/.claude/hooks/on-pr-event.sh +69 -0
- package/framework/.claude/hooks/on-session-start.sh +427 -0
- package/framework/.claude/hooks/on-stop.sh +104 -0
- package/framework/.claude/hooks/post-tool-use.sh +161 -0
- package/framework/.claude/hooks/pre-tool-use.sh +246 -0
- package/framework/.claude/schemas/agent-definition.schema.json +35 -0
- package/framework/.claude/schemas/benchmark-report.schema.json +148 -0
- package/framework/.claude/schemas/pm-to-ux-handoff.schema.yaml +128 -0
- package/framework/.claude/schemas/stage-definition.schema.json +233 -0
- package/framework/.claude/schemas/workflow-stage.schema.json +86 -0
- package/framework/.claude/schemas/workflow-template.schema.json +88 -0
- package/framework/.claude/settings.json +14 -0
- package/framework/.claude/skills/build-product-prototype/SKILL.md +35 -0
- package/framework/.claude/skills/build-product-prototype/prompts/main.md +78 -0
- package/framework/.claude/skills/clarify-requirements/SKILL.md +32 -0
- package/framework/.claude/skills/clarify-requirements/prompts/main.md +81 -0
- package/framework/.claude/skills/dependencies.yaml +139 -0
- package/framework/.claude/skills/draft-product-design/SKILL.md +40 -0
- package/framework/.claude/skills/draft-product-design/prompts/main.md +47 -0
- package/framework/.claude/skills/lc-analyze-frameworks/SKILL.md +43 -0
- package/framework/.claude/skills/lc-analyze-frameworks/prompts/main.md +95 -0
- package/framework/.claude/skills/lc-benchmark/SKILL.md +61 -0
- package/framework/.claude/skills/lc-build-codebase-knowledge/SKILL.md +38 -0
- package/framework/.claude/skills/lc-build-codebase-knowledge/prompts/build-codebase-knowledge.md +61 -0
- package/framework/.claude/skills/lc-collect-intelligence/SKILL.md +43 -0
- package/framework/.claude/skills/lc-collect-intelligence/prompts/main.md +72 -0
- package/framework/.claude/skills/lc-competitive-analysis/SKILL.md +43 -0
- package/framework/.claude/skills/lc-competitive-analysis/prompts/main.md +70 -0
- package/framework/.claude/skills/lc-explore-opensource/SKILL.md +36 -0
- package/framework/.claude/skills/lc-explore-opensource/prompts/explore-opensource.md +77 -0
- package/framework/.claude/skills/lc-first-principles/SKILL.md +43 -0
- package/framework/.claude/skills/lc-first-principles/prompts/main.md +73 -0
- package/framework/.claude/skills/lc-handoff/SKILL.md +34 -0
- package/framework/.claude/skills/lc-init-branch/SKILL.md +52 -0
- package/framework/.claude/skills/lc-market-research/SKILL.md +43 -0
- package/framework/.claude/skills/lc-market-research/prompts/main.md +79 -0
- package/framework/.claude/skills/lc-product-research/SKILL.md +43 -0
- package/framework/.claude/skills/lc-product-research/prompts/main.md +80 -0
- package/framework/.claude/skills/lc-research-report/SKILL.md +43 -0
- package/framework/.claude/skills/lc-research-report/prompts/main.md +90 -0
- package/framework/.claude/skills/lc-research-scope/SKILL.md +43 -0
- package/framework/.claude/skills/lc-research-scope/prompts/main.md +82 -0
- package/framework/.claude/skills/lc-setup/SKILL.md +68 -0
- package/framework/.claude/skills/lc-setup/prompts/main.md +88 -0
- package/framework/.claude/skills/lc-stage/SKILL.md +45 -0
- package/framework/.claude/skills/lc-stakeholder-research/SKILL.md +43 -0
- package/framework/.claude/skills/lc-stakeholder-research/prompts/main.md +65 -0
- package/framework/.claude/skills/lc-status/SKILL.md +25 -0
- package/framework/.claude/skills/lc-storytelling/SKILL.md +43 -0
- package/framework/.claude/skills/lc-storytelling/prompts/main.md +77 -0
- package/framework/.claude/skills/lc-wf/SKILL.md +54 -0
- package/framework/.claude/skills/lc-workflow/SKILL.md +48 -0
- package/framework/.claude/skills/lc-workflow/validators/validate.py +755 -0
- package/framework/.claude/skills/lc-workflow-router/SKILL.md +41 -0
- package/framework/.claude/skills/lc-workflow-router/prompts/intake-prompt.md +91 -0
- package/framework/.claude/skills/lc-workflow-router/prompts/router-prompt.md +44 -0
- package/framework/.claude/skills/plan-tdd-development/SKILL.md +31 -0
- package/framework/.claude/skills/plan-tdd-development/prompts/main.md +44 -0
- package/framework/.claude/skills/process-interview/SKILL.md +32 -0
- package/framework/.claude/skills/process-interview/prompts/main.md +47 -0
- package/framework/.claude/skills/propose-with-openspec/SKILL.md +37 -0
- package/framework/.claude/skills/propose-with-openspec/prompts/main.md +53 -0
- package/framework/.claude/skills/split-to-github/SKILL.md +32 -0
- package/framework/.claude/skills/split-to-github/prompts/main.md +42 -0
- package/framework/.claude/skills/sync-to-knowledge/SKILL.md +35 -0
- package/framework/.claude/skills/sync-to-knowledge/prompts/main.md +54 -0
- package/framework/.claude/skills/workflow-continue/SKILL.md +24 -0
- package/framework/.claude/skills/workflow-continue/prompts/main.md +25 -0
- package/framework/.claude/stages/build-codebase-knowledge.yaml +42 -0
- package/framework/.claude/stages/clarify.yaml +59 -0
- package/framework/.claude/stages/explore-opensource.yaml +40 -0
- package/framework/.claude/stages/implement.yaml +60 -0
- package/framework/.claude/stages/ingest.yaml +40 -0
- package/framework/.claude/stages/lc-analyze-frameworks.yaml +37 -0
- package/framework/.claude/stages/lc-collect-intelligence.yaml +37 -0
- package/framework/.claude/stages/lc-competitive-analysis.yaml +37 -0
- package/framework/.claude/stages/lc-first-principles.yaml +37 -0
- package/framework/.claude/stages/lc-market-research.yaml +37 -0
- package/framework/.claude/stages/lc-product-research.yaml +37 -0
- package/framework/.claude/stages/lc-research-report.yaml +38 -0
- package/framework/.claude/stages/lc-research-scope.yaml +38 -0
- package/framework/.claude/stages/lc-stakeholder-research.yaml +37 -0
- package/framework/.claude/stages/lc-storytelling.yaml +37 -0
- package/framework/.claude/stages/product-design-docs.yaml +66 -0
- package/framework/.claude/stages/product-prototype.yaml +53 -0
- package/framework/.claude/stages/propose.yaml +45 -0
- package/framework/.claude/stages/split.yaml +41 -0
- package/framework/.claude/stages/sync-knowledge.yaml +49 -0
- package/framework/.claude/stages/tdd-development-plan.yaml +43 -0
- package/framework/.claude/stages/workflow-router.yaml +45 -0
- package/framework/.claude/templates/solo-workflow-context.yaml +23 -0
- package/framework/.claude/workflows/README.md +93 -0
- package/framework/.claude/workflows/bug-fix.yaml +81 -0
- package/framework/.claude/workflows/design-spike.yaml +55 -0
- package/framework/.claude/workflows/existing-project-iteration.yaml +106 -0
- package/framework/.claude/workflows/interview-to-knowledge.yaml +189 -0
- package/framework/.claude/workflows/oss-first-design.yaml +100 -0
- package/framework/.claude/workflows/pm-research.yaml +115 -0
- package/framework/.claude-plugin/hooks.json +6 -0
- package/framework/.claude-plugin/marketplace.json +32 -0
- package/framework/.claude-plugin/plugin.json +57 -0
- package/framework/.version-bump.json +43 -0
- package/framework/CLAUDE.md +140 -0
- package/framework/CONTRIBUTING.md +219 -0
- package/framework/LICENSE +21 -0
- package/framework/README.en.md +139 -0
- package/framework/README.md +139 -0
- package/framework/RELEASE.md +334 -0
- package/framework/SKILL.md +24 -0
- package/framework/USAGE.md +356 -0
- package/framework/manifest.json +1214 -0
- package/framework/requirements.txt +4 -0
- package/framework/scripts/__init__.py +0 -0
- package/framework/scripts/build_codebase_knowledge.py +76 -0
- package/framework/scripts/bump_version.py +181 -0
- package/framework/scripts/check-dependency-drift.py +69 -0
- package/framework/scripts/check-harness-drift.sh +57 -0
- package/framework/scripts/check-main-merge-hygiene.py +128 -0
- package/framework/scripts/check-skill-dependencies.sh +124 -0
- package/framework/scripts/init-lincoln-branch.sh +300 -0
- package/framework/scripts/init-project.sh +184 -0
- package/framework/scripts/lc-benchmark-cli.py +66 -0
- package/framework/scripts/lincoln-audit.py +288 -0
- package/framework/scripts/lincoln-setup.py +651 -0
- package/framework/scripts/lincoln-status.py +448 -0
- package/framework/scripts/lincoln_benchmark.py +224 -0
- package/framework/scripts/lincoln_benchmark_eval.py +104 -0
- package/framework/scripts/lincoln_benchmark_metrics.py +818 -0
- package/framework/scripts/lincoln_benchmark_report.py +141 -0
- package/framework/scripts/lincoln_command_map.py +289 -0
- package/framework/scripts/lincoln_dependency_manager.py +335 -0
- package/framework/scripts/lincoln_documents.py +175 -0
- package/framework/scripts/lincoln_harness_adapter.py +319 -0
- package/framework/scripts/lincoln_index.py +255 -0
- package/framework/scripts/lincoln_paths.py +198 -0
- package/framework/scripts/lincoln_prd.py +227 -0
- package/framework/scripts/lincoln_role.py +46 -0
- package/framework/scripts/lincoln_scenario.py +59 -0
- package/framework/scripts/lincoln_session_start_metrics.py +71 -0
- package/framework/scripts/lincoln_skill_prompt.py +48 -0
- package/framework/scripts/lincoln_trace.py +335 -0
- package/framework/scripts/lincoln_workflow.py +199 -0
- package/framework/scripts/list-active-lincoln-branches.sh +87 -0
- package/framework/scripts/package-lincoln-plugin.py +340 -0
- package/framework/scripts/run-infrastructure-tests.py +84 -0
- package/framework/scripts/stage_loader.py +1071 -0
- package/framework/scripts/static-check.sh +356 -0
- package/framework/scripts/sync-external-agents.sh +210 -0
- package/framework/scripts/sync-framework-package.mjs +218 -0
- package/framework/scripts/task_tool_guard.py +213 -0
- package/framework/scripts/track-artifacts.py +140 -0
- package/framework/scripts/validate_stage.py +350 -0
- package/{README.md → framework/tools/lincoln/README.md} +4 -4
- package/framework/tools/lincoln/package-lock.json +3349 -0
- package/framework/tools/lincoln/package.json +48 -0
- package/framework/tools/lincoln/src/cli.tsx +60 -0
- package/framework/tools/lincoln/src/components/AudioMeter.tsx +34 -0
- package/framework/tools/lincoln/src/components/CancelledScreen.tsx +11 -0
- package/framework/tools/lincoln/src/components/DevicesMenu.tsx +79 -0
- package/framework/tools/lincoln/src/components/HintBar.tsx +25 -0
- package/framework/tools/lincoln/src/components/LogView.tsx +36 -0
- package/framework/tools/lincoln/src/components/ModelMenu.tsx +122 -0
- package/framework/tools/lincoln/src/components/ReadyScreen.tsx +54 -0
- package/framework/tools/lincoln/src/components/RecordingApp.tsx +211 -0
- package/framework/tools/lincoln/src/components/RecordingScreen.tsx +41 -0
- package/framework/tools/lincoln/src/components/SelectMenu.tsx +53 -0
- package/framework/tools/lincoln/src/components/StatusPanel.tsx +52 -0
- package/framework/tools/lincoln/src/components/StopConfirmation.tsx +32 -0
- package/framework/tools/lincoln/src/config/args.ts +35 -0
- package/framework/tools/lincoln/src/config/loadConfig.ts +81 -0
- package/framework/tools/lincoln/src/config/resolveConfig.ts +85 -0
- package/framework/tools/lincoln/src/devices/listDevices.ts +11 -0
- package/framework/tools/lincoln/src/devices/parseDevices.ts +25 -0
- package/framework/tools/lincoln/src/hooks/useKeyHandler.ts +63 -0
- package/framework/tools/lincoln/src/main.tsx +4 -0
- package/framework/tools/lincoln/src/models/models.ts +34 -0
- package/framework/tools/lincoln/src/models/runWarmup.ts +46 -0
- package/framework/tools/lincoln/src/models/warmupProgress.ts +30 -0
- package/framework/tools/lincoln/src/recording/spawnRecorder.ts +127 -0
- package/framework/tools/lincoln/src/recording/useRecorder.ts +146 -0
- package/framework/tools/lincoln/src/utils/amplitudeToMeter.ts +4 -0
- package/framework/tools/lincoln/src/utils/formatDuration.ts +6 -0
- package/framework/tools/lincoln/src/utils/sessionId.ts +25 -0
- package/framework/tools/lincoln/tests/cli.test.tsx +52 -0
- package/framework/tools/lincoln/tests/components/AudioMeter.test.tsx +31 -0
- package/framework/tools/lincoln/tests/components/CancelledScreen.test.tsx +12 -0
- package/framework/tools/lincoln/tests/components/ReadyScreen.test.tsx +68 -0
- package/framework/tools/lincoln/tests/components/RecordingApp.menus.test.tsx +158 -0
- package/framework/tools/lincoln/tests/components/RecordingApp.test.tsx +248 -0
- package/framework/tools/lincoln/tests/components/RecordingScreen.test.tsx +37 -0
- package/framework/tools/lincoln/tests/components/SelectMenu.test.tsx +59 -0
- package/framework/tools/lincoln/tests/components/StopConfirmation.test.tsx +38 -0
- package/framework/tools/lincoln/tests/config/args.test.ts +49 -0
- package/framework/tools/lincoln/tests/config/loadConfig.test.ts +59 -0
- package/framework/tools/lincoln/tests/config/resolveConfig.test.ts +72 -0
- package/framework/tools/lincoln/tests/devices/parseDevices.test.ts +21 -0
- package/framework/tools/lincoln/tests/hooks/useKeyHandler.enabled.test.tsx +44 -0
- package/framework/tools/lincoln/tests/hooks/useKeyHandler.test.tsx +130 -0
- package/framework/tools/lincoln/tests/models/models.test.ts +27 -0
- package/framework/tools/lincoln/tests/models/warmupProgress.test.ts +25 -0
- package/framework/tools/lincoln/tests/recording/spawnRecorder.test.ts +85 -0
- package/framework/tools/lincoln/tests/recording/useRecorder.test.tsx +172 -0
- package/framework/tools/lincoln/tests/utils/amplitudeToMeter.test.ts +22 -0
- package/framework/tools/lincoln/tests/utils/formatDuration.test.ts +11 -0
- package/framework/tools/lincoln/tests/utils/sessionId.test.ts +30 -0
- package/framework/tools/lincoln/tsconfig.json +22 -0
- package/framework/tools/lincoln/tsconfig.tests.json +10 -0
- package/framework/tools/lincoln/tsup.config.ts +17 -0
- package/framework/tools/lincoln/vitest.config.ts +20 -0
- package/framework/tools/lincoln-installer/package-lock.json +3611 -0
- package/framework/tools/lincoln-installer/package.json +53 -0
- package/framework/tools/lincoln-installer/src/cli.tsx +63 -0
- package/framework/tools/lincoln-installer/src/components/HarnessSelectScreen.tsx +43 -0
- package/framework/tools/lincoln-installer/src/components/InstallerApp.tsx +98 -0
- package/framework/tools/lincoln-installer/src/components/OptionsScreen.tsx +56 -0
- package/framework/tools/lincoln-installer/src/components/ProgressScreen.tsx +25 -0
- package/framework/tools/lincoln-installer/src/components/ResultScreen.tsx +40 -0
- package/framework/tools/lincoln-installer/src/components/SelectMenu.tsx +73 -0
- package/framework/tools/lincoln-installer/src/components/SummaryScreen.tsx +49 -0
- package/framework/tools/lincoln-installer/src/components/UpdateApp.tsx +135 -0
- package/framework/tools/lincoln-installer/src/components/WelcomeScreen.tsx +22 -0
- package/framework/tools/lincoln-installer/src/config/args.ts +76 -0
- package/framework/tools/lincoln-installer/src/config/resolveConfig.ts +33 -0
- package/framework/tools/lincoln-installer/src/config/updateArgs.ts +67 -0
- package/framework/tools/lincoln-installer/src/hooks/useSetup.ts +149 -0
- package/framework/tools/lincoln-installer/src/main.tsx +11 -0
- package/framework/tools/lincoln-installer/src/types.ts +19 -0
- package/framework/tools/lincoln-installer/src/update-main.tsx +11 -0
- package/framework/tools/lincoln-installer/src/update.tsx +90 -0
- package/framework/tools/lincoln-installer/src/utils/detectHarness.ts +51 -0
- package/framework/tools/lincoln-installer/src/utils/runSetup.ts +62 -0
- package/framework/tools/lincoln-installer/src/utils/updateRelease.ts +454 -0
- package/framework/tools/lincoln-installer/tests/components/InstallerApp.test.tsx +88 -0
- package/framework/tools/lincoln-installer/tests/components/SelectMenu.test.tsx +26 -0
- package/framework/tools/lincoln-installer/tests/components/UpdateApp.test.tsx +170 -0
- package/framework/tools/lincoln-installer/tests/components/screens.test.tsx +310 -0
- package/framework/tools/lincoln-installer/tests/config/args.test.ts +66 -0
- package/framework/tools/lincoln-installer/tests/config/resolveConfig.test.ts +75 -0
- package/framework/tools/lincoln-installer/tests/config/updateArgs.test.ts +52 -0
- package/framework/tools/lincoln-installer/tests/hooks/useSetup.test.tsx +213 -0
- package/framework/tools/lincoln-installer/tests/update.test.tsx +108 -0
- package/framework/tools/lincoln-installer/tests/utils/detectHarness.test.ts +40 -0
- package/framework/tools/lincoln-installer/tests/utils/runSetup.test.ts +45 -0
- package/framework/tools/lincoln-installer/tests/utils/updateRelease.test.ts +559 -0
- package/framework/tools/lincoln-installer/tsconfig.json +22 -0
- package/framework/tools/lincoln-installer/tsconfig.tests.json +8 -0
- package/framework/tools/lincoln-installer/tsup.config.ts +17 -0
- package/framework/tools/lincoln-installer/vitest.config.ts +20 -0
- package/framework/tools/lincoln-record/Cargo.lock +1896 -0
- package/framework/tools/lincoln-record/Cargo.toml +24 -0
- package/framework/tools/lincoln-record/diarize/diarize.py +117 -0
- package/framework/tools/lincoln-record/diarize/merge.py +55 -0
- package/framework/tools/lincoln-record/src/audio/capture/microphone.rs +194 -0
- package/framework/tools/lincoln-record/src/audio/capture/mod.rs +1 -0
- package/framework/tools/lincoln-record/src/audio/devices.rs +20 -0
- package/framework/tools/lincoln-record/src/audio/mod.rs +5 -0
- package/framework/tools/lincoln-record/src/audio/resampler.rs +44 -0
- package/framework/tools/lincoln-record/src/audio/saver.rs +87 -0
- package/framework/tools/lincoln-record/src/audio/source.rs +104 -0
- package/framework/tools/lincoln-record/src/cli.rs +96 -0
- package/framework/tools/lincoln-record/src/config.rs +135 -0
- package/framework/tools/lincoln-record/src/lib.rs +6 -0
- package/framework/tools/lincoln-record/src/main.rs +242 -0
- package/framework/tools/lincoln-record/src/model/mod.rs +248 -0
- package/framework/tools/lincoln-record/src/output/metadata.rs +30 -0
- package/framework/tools/lincoln-record/src/output/mod.rs +2 -0
- package/framework/tools/lincoln-record/src/output/transcript.rs +42 -0
- package/framework/tools/lincoln-record/src/transcription/diarization.rs +64 -0
- package/framework/tools/lincoln-record/src/transcription/mod.rs +3 -0
- package/framework/tools/lincoln-record/src/transcription/provider.rs +43 -0
- package/framework/tools/lincoln-record/src/transcription/whisper.rs +176 -0
- package/framework/tools/lincoln-record/tests/cli_args.rs +103 -0
- package/framework/tools/lincoln-record/tests/config_test.rs +70 -0
- package/framework/tools/lincoln-record/tests/devices_test.rs +23 -0
- package/framework/tools/lincoln-record/tests/diarization_tests.rs +101 -0
- package/framework/tools/lincoln-record/tests/integration_tests.rs +44 -0
- package/framework/tools/lincoln-record/tests/model_test.rs +68 -0
- package/framework/tools/lincoln-record/tests/transcription_tests.rs +73 -0
- package/package.json +19 -13
|
@@ -0,0 +1,130 @@
|
|
|
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
|
+
interface TestComponentProps {
|
|
8
|
+
onRecord?: () => void
|
|
9
|
+
onStop?: () => void
|
|
10
|
+
onCancel?: () => void
|
|
11
|
+
onQuit?: () => void
|
|
12
|
+
onDevices?: () => void
|
|
13
|
+
onModel?: () => void
|
|
14
|
+
onAnyKey?: () => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function TestComponent(props: TestComponentProps) {
|
|
18
|
+
useKeyHandler(props)
|
|
19
|
+
return <Text>handlers active</Text>
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function tick() {
|
|
23
|
+
return new Promise(resolve => setTimeout(resolve, 0))
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
describe('useKeyHandler', () => {
|
|
27
|
+
test('calls onRecord when r is pressed', async () => {
|
|
28
|
+
const onRecord = vi.fn()
|
|
29
|
+
const { stdin } = render(
|
|
30
|
+
<TestComponent onRecord={onRecord} />,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
await tick()
|
|
34
|
+
stdin.write('r')
|
|
35
|
+
await tick()
|
|
36
|
+
|
|
37
|
+
expect(onRecord).toHaveBeenCalledTimes(1)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
test('calls onStop when s is pressed', async () => {
|
|
41
|
+
const onStop = vi.fn()
|
|
42
|
+
const { stdin } = render(
|
|
43
|
+
<TestComponent onStop={onStop} />,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
await tick()
|
|
47
|
+
stdin.write('s')
|
|
48
|
+
await tick()
|
|
49
|
+
|
|
50
|
+
expect(onStop).toHaveBeenCalledTimes(1)
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
test('calls onCancel when c is pressed', async () => {
|
|
54
|
+
const onCancel = vi.fn()
|
|
55
|
+
const { stdin } = render(
|
|
56
|
+
<TestComponent onCancel={onCancel} />,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
await tick()
|
|
60
|
+
stdin.write('c')
|
|
61
|
+
await tick()
|
|
62
|
+
|
|
63
|
+
expect(onCancel).toHaveBeenCalledTimes(1)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
test('calls onQuit when q is pressed', async () => {
|
|
67
|
+
const onQuit = vi.fn()
|
|
68
|
+
const { stdin } = render(
|
|
69
|
+
<TestComponent onQuit={onQuit} />,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
await tick()
|
|
73
|
+
stdin.write('q')
|
|
74
|
+
await tick()
|
|
75
|
+
|
|
76
|
+
expect(onQuit).toHaveBeenCalledTimes(1)
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
test('calls onQuit when Escape is pressed', async () => {
|
|
80
|
+
const onQuit = vi.fn()
|
|
81
|
+
const { stdin } = render(
|
|
82
|
+
<TestComponent onQuit={onQuit} />,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
await tick()
|
|
86
|
+
stdin.write('')
|
|
87
|
+
await tick()
|
|
88
|
+
|
|
89
|
+
expect(onQuit).toHaveBeenCalledTimes(1)
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
test('calls onDevices when d is pressed', async () => {
|
|
93
|
+
const onDevices = vi.fn()
|
|
94
|
+
const { stdin } = render(
|
|
95
|
+
<TestComponent onDevices={onDevices} />,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
await tick()
|
|
99
|
+
stdin.write('d')
|
|
100
|
+
await tick()
|
|
101
|
+
|
|
102
|
+
expect(onDevices).toHaveBeenCalledTimes(1)
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
test('calls onModel when m is pressed', async () => {
|
|
106
|
+
const onModel = vi.fn()
|
|
107
|
+
const { stdin } = render(
|
|
108
|
+
<TestComponent onModel={onModel} />,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
await tick()
|
|
112
|
+
stdin.write('m')
|
|
113
|
+
await tick()
|
|
114
|
+
|
|
115
|
+
expect(onModel).toHaveBeenCalledTimes(1)
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
test('calls onAnyKey for unrecognized input', async () => {
|
|
119
|
+
const onAnyKey = vi.fn()
|
|
120
|
+
const { stdin } = render(
|
|
121
|
+
<TestComponent onAnyKey={onAnyKey} />,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
await tick()
|
|
125
|
+
stdin.write('x')
|
|
126
|
+
await tick()
|
|
127
|
+
|
|
128
|
+
expect(onAnyKey).toHaveBeenCalledTimes(1)
|
|
129
|
+
})
|
|
130
|
+
})
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { mkdtempSync, mkdirSync, 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 { KNOWN_MODELS, listModelStatuses, modelCachePath } from '../../src/models/models'
|
|
6
|
+
|
|
7
|
+
describe('models', () => {
|
|
8
|
+
test('KNOWN_MODELS includes common whisper models', () => {
|
|
9
|
+
expect(KNOWN_MODELS).toContain('tiny')
|
|
10
|
+
expect(KNOWN_MODELS).toContain('base')
|
|
11
|
+
expect(KNOWN_MODELS).toContain('large-v3')
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test('modelCachePath returns the ggml path under the engine dir', () => {
|
|
15
|
+
expect(modelCachePath('base', '/cache')).toBe('/cache/whisper/ggml-base.bin')
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('listModelStatuses marks cached and missing models', () => {
|
|
19
|
+
const dir = mkdtempSync(join(tmpdir(), 'lincoln-models-'))
|
|
20
|
+
mkdirSync(join(dir, 'whisper'), { recursive: true })
|
|
21
|
+
writeFileSync(join(dir, 'whisper', 'ggml-base.bin'), 'fake')
|
|
22
|
+
|
|
23
|
+
const statuses = listModelStatuses(dir)
|
|
24
|
+
expect(statuses.find(s => s.name === 'base')?.cached).toBe(true)
|
|
25
|
+
expect(statuses.find(s => s.name === 'small')?.cached).toBe(false)
|
|
26
|
+
})
|
|
27
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
import { parseWarmupProgress } from '../../src/models/warmupProgress'
|
|
3
|
+
|
|
4
|
+
describe('parseWarmupProgress', () => {
|
|
5
|
+
test('parses progress with a total', () => {
|
|
6
|
+
expect(parseWarmupProgress('\r downloaded 512 / 1024 bytes (50.0%)')).toEqual({
|
|
7
|
+
downloaded: 512,
|
|
8
|
+
total: 1024,
|
|
9
|
+
percent: 50,
|
|
10
|
+
})
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test('parses progress without a total', () => {
|
|
14
|
+
expect(parseWarmupProgress('\r downloaded 512 bytes')).toEqual({
|
|
15
|
+
downloaded: 512,
|
|
16
|
+
total: null,
|
|
17
|
+
percent: null,
|
|
18
|
+
})
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('returns null for unrelated lines', () => {
|
|
22
|
+
expect(parseWarmupProgress("Warming up whisper model 'base'")).toBeNull()
|
|
23
|
+
expect(parseWarmupProgress('Model ready at /tmp/x')).toBeNull()
|
|
24
|
+
})
|
|
25
|
+
})
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { EventEmitter } from 'node:events'
|
|
2
|
+
import { describe, expect, test, vi, beforeEach, afterEach } from 'vitest'
|
|
3
|
+
import { spawnRecorder, type RecorderProcess } from '../../src/recording/spawnRecorder'
|
|
4
|
+
|
|
5
|
+
describe('spawnRecorder', () => {
|
|
6
|
+
let spawnMock: ReturnType<typeof vi.fn>
|
|
7
|
+
let child: EventEmitter
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
child = new EventEmitter()
|
|
11
|
+
child.pid = 12345
|
|
12
|
+
child.kill = vi.fn()
|
|
13
|
+
child.stdout = new EventEmitter()
|
|
14
|
+
child.stderr = new EventEmitter()
|
|
15
|
+
spawnMock = vi.fn(() => child)
|
|
16
|
+
vi.doMock('node:child_process', () => ({ spawn: spawnMock }))
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
afterEach(() => {
|
|
20
|
+
vi.doUnmock('node:child_process')
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test('spawns lincoln-record record with correct args', async () => {
|
|
24
|
+
const { spawnRecorder: spawnRecorderMocked } = await import('../../src/recording/spawnRecorder')
|
|
25
|
+
spawnRecorderMocked({
|
|
26
|
+
workspaceRoot: '/workspace',
|
|
27
|
+
sessionId: '2026-06-28-test',
|
|
28
|
+
lincolnRecordPath: '/usr/local/bin/lincoln-record',
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
expect(spawnMock).toHaveBeenCalledWith(
|
|
32
|
+
'/usr/local/bin/lincoln-record',
|
|
33
|
+
[
|
|
34
|
+
'record',
|
|
35
|
+
'--session-id',
|
|
36
|
+
'2026-06-28-test',
|
|
37
|
+
'--output',
|
|
38
|
+
'/workspace',
|
|
39
|
+
],
|
|
40
|
+
expect.objectContaining({ cwd: '/workspace', stdio: ['pipe', 'pipe', 'pipe'] }),
|
|
41
|
+
)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
test('emits ready immediately after spawn', async () => {
|
|
45
|
+
const { spawnRecorder: spawnRecorderMocked } = await import('../../src/recording/spawnRecorder')
|
|
46
|
+
const recorder = spawnRecorderMocked({
|
|
47
|
+
workspaceRoot: '/workspace',
|
|
48
|
+
sessionId: '2026-06-28-test',
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const readyHandler = vi.fn()
|
|
52
|
+
recorder.on('ready', readyHandler)
|
|
53
|
+
|
|
54
|
+
await new Promise((resolve) => setImmediate(resolve))
|
|
55
|
+
expect(readyHandler).toHaveBeenCalled()
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test('stop sends SIGINT and resolves on exit', async () => {
|
|
59
|
+
const { spawnRecorder: spawnRecorderMocked } = await import('../../src/recording/spawnRecorder')
|
|
60
|
+
const recorder = spawnRecorderMocked({
|
|
61
|
+
workspaceRoot: '/workspace',
|
|
62
|
+
sessionId: '2026-06-28-test',
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
const stopPromise = recorder.stop()
|
|
66
|
+
expect(child.kill).toHaveBeenCalledWith('SIGINT')
|
|
67
|
+
child.emit('exit', 0, null)
|
|
68
|
+
|
|
69
|
+
await expect(stopPromise).resolves.toBeUndefined()
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
test('cancel sends SIGKILL and resolves on exit', async () => {
|
|
73
|
+
const { spawnRecorder: spawnRecorderMocked } = await import('../../src/recording/spawnRecorder')
|
|
74
|
+
const recorder = spawnRecorderMocked({
|
|
75
|
+
workspaceRoot: '/workspace',
|
|
76
|
+
sessionId: '2026-06-28-test',
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
const cancelPromise = recorder.cancel()
|
|
80
|
+
expect(child.kill).toHaveBeenCalledWith('SIGKILL')
|
|
81
|
+
child.emit('exit', null, 'SIGTERM')
|
|
82
|
+
|
|
83
|
+
await expect(cancelPromise).resolves.toBeUndefined()
|
|
84
|
+
})
|
|
85
|
+
})
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { Text } from 'ink'
|
|
2
|
+
import { render } from 'ink-testing-library'
|
|
3
|
+
import { EventEmitter } from 'node:events'
|
|
4
|
+
import React, { useEffect } from 'react'
|
|
5
|
+
import { afterEach, describe, expect, test, vi } from 'vitest'
|
|
6
|
+
import { useRecorder, type RecorderController } from '../../src/recording/useRecorder'
|
|
7
|
+
import { spawnRecorder as spawnRecorderMock } from '../../src/recording/spawnRecorder'
|
|
8
|
+
|
|
9
|
+
vi.mock('../../src/recording/spawnRecorder', () => {
|
|
10
|
+
const { EventEmitter } = require('node:events')
|
|
11
|
+
|
|
12
|
+
function createMockRecorder() {
|
|
13
|
+
const recorder = new EventEmitter()
|
|
14
|
+
recorder.stop = vi.fn(() => Promise.resolve())
|
|
15
|
+
recorder.cancel = vi.fn(() => Promise.resolve())
|
|
16
|
+
return recorder
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
spawnRecorder: vi.fn(() => createMockRecorder()),
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
function TestApp() {
|
|
25
|
+
const { state } = useRecorder({
|
|
26
|
+
workspaceRoot: '/workspace',
|
|
27
|
+
sessionId: '2026-06-28-test',
|
|
28
|
+
})
|
|
29
|
+
return <Text>{state.status}</Text>
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function TestAppWithRerender({ startOnMount }: { startOnMount?: boolean } = {}) {
|
|
33
|
+
const [count, setCount] = React.useState(0)
|
|
34
|
+
const { state } = useRecorder({
|
|
35
|
+
workspaceRoot: '/workspace',
|
|
36
|
+
sessionId: '2026-06-28-test',
|
|
37
|
+
startOnMount,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
return <Text>{state.status}:{count}</Text>
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
describe('useRecorder', () => {
|
|
44
|
+
afterEach(() => {
|
|
45
|
+
vi.clearAllMocks()
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('starts in idle state', () => {
|
|
49
|
+
const { lastFrame } = render(<TestApp />)
|
|
50
|
+
|
|
51
|
+
expect(lastFrame()).toBe('idle')
|
|
52
|
+
expect(spawnRecorderMock).not.toHaveBeenCalled()
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
test('does not start recorder by default', async () => {
|
|
56
|
+
const { lastFrame, rerender } = render(<TestAppWithRerender />)
|
|
57
|
+
|
|
58
|
+
await new Promise(resolve => setTimeout(resolve, 0))
|
|
59
|
+
expect(lastFrame()).toContain('idle')
|
|
60
|
+
expect(spawnRecorderMock).not.toHaveBeenCalled()
|
|
61
|
+
|
|
62
|
+
rerender(<TestAppWithRerender />)
|
|
63
|
+
await new Promise(resolve => setTimeout(resolve, 50))
|
|
64
|
+
|
|
65
|
+
expect(spawnRecorderMock).not.toHaveBeenCalled()
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test('starts recorder once on mount when startOnMount is true', async () => {
|
|
69
|
+
const { lastFrame, rerender } = render(
|
|
70
|
+
<TestAppWithRerender startOnMount={true} />
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
await new Promise(resolve => setTimeout(resolve, 0))
|
|
74
|
+
expect(lastFrame()).toContain('recording')
|
|
75
|
+
expect(spawnRecorderMock).toHaveBeenCalledTimes(1)
|
|
76
|
+
|
|
77
|
+
rerender(<TestAppWithRerender startOnMount={true} />)
|
|
78
|
+
await new Promise(resolve => setTimeout(resolve, 50))
|
|
79
|
+
|
|
80
|
+
expect(spawnRecorderMock).toHaveBeenCalledTimes(1)
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
test('shows error when recorder exits unexpectedly', async () => {
|
|
84
|
+
let recorder: EventEmitter | undefined
|
|
85
|
+
function CaptureRecorder() {
|
|
86
|
+
const { state } = useRecorder({
|
|
87
|
+
workspaceRoot: '/workspace',
|
|
88
|
+
sessionId: '2026-06-28-test',
|
|
89
|
+
topic: '',
|
|
90
|
+
designId: '',
|
|
91
|
+
branch: '',
|
|
92
|
+
startOnMount: true,
|
|
93
|
+
})
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
recorder = spawnRecorderMock.mock.results[0]?.value
|
|
96
|
+
}, [])
|
|
97
|
+
return <Text>{state.status}:{state.errorMessage ?? ''}</Text>
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const { lastFrame } = render(<CaptureRecorder />)
|
|
101
|
+
await new Promise(resolve => setTimeout(resolve, 0))
|
|
102
|
+
expect(lastFrame()).toContain('recording')
|
|
103
|
+
|
|
104
|
+
recorder!.emit('exit', 1, null)
|
|
105
|
+
await new Promise(resolve => setTimeout(resolve, 0))
|
|
106
|
+
|
|
107
|
+
expect(lastFrame()).toContain('error')
|
|
108
|
+
expect(lastFrame()).toContain('exited unexpectedly')
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
test('stays stopped when stop is called and recorder exits with non-zero code', async () => {
|
|
112
|
+
let controller: RecorderController | null = null
|
|
113
|
+
let recorder: EventEmitter | undefined
|
|
114
|
+
|
|
115
|
+
function StopController() {
|
|
116
|
+
controller = useRecorder({
|
|
117
|
+
workspaceRoot: '/workspace',
|
|
118
|
+
sessionId: '2026-06-28-test',
|
|
119
|
+
topic: '',
|
|
120
|
+
designId: '',
|
|
121
|
+
branch: '',
|
|
122
|
+
startOnMount: true,
|
|
123
|
+
})
|
|
124
|
+
useEffect(() => {
|
|
125
|
+
recorder = spawnRecorderMock.mock.results[0]?.value
|
|
126
|
+
}, [])
|
|
127
|
+
return <Text>{controller.state.status}</Text>
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const { lastFrame } = render(<StopController />)
|
|
131
|
+
await new Promise(resolve => setTimeout(resolve, 0))
|
|
132
|
+
expect(lastFrame()).toBe('recording')
|
|
133
|
+
|
|
134
|
+
const stopPromise = controller!.stop()
|
|
135
|
+
recorder!.emit('exit', 1, null)
|
|
136
|
+
await stopPromise
|
|
137
|
+
await new Promise(resolve => setTimeout(resolve, 0))
|
|
138
|
+
|
|
139
|
+
expect(lastFrame()).toBe('stopped')
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
test('stays cancelled when cancel is called and recorder exits with non-zero code', async () => {
|
|
143
|
+
let controller: RecorderController | null = null
|
|
144
|
+
let recorder: EventEmitter | undefined
|
|
145
|
+
|
|
146
|
+
function CancelController() {
|
|
147
|
+
controller = useRecorder({
|
|
148
|
+
workspaceRoot: '/workspace',
|
|
149
|
+
sessionId: '2026-06-28-test',
|
|
150
|
+
topic: '',
|
|
151
|
+
designId: '',
|
|
152
|
+
branch: '',
|
|
153
|
+
startOnMount: true,
|
|
154
|
+
})
|
|
155
|
+
useEffect(() => {
|
|
156
|
+
recorder = spawnRecorderMock.mock.results[0]?.value
|
|
157
|
+
}, [])
|
|
158
|
+
return <Text>{controller.state.status}</Text>
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
const { lastFrame } = render(<CancelController />)
|
|
162
|
+
await new Promise(resolve => setTimeout(resolve, 0))
|
|
163
|
+
expect(lastFrame()).toBe('recording')
|
|
164
|
+
|
|
165
|
+
const cancelPromise = controller!.cancel()
|
|
166
|
+
recorder!.emit('exit', null, 'SIGTERM')
|
|
167
|
+
await cancelPromise
|
|
168
|
+
await new Promise(resolve => setTimeout(resolve, 0))
|
|
169
|
+
|
|
170
|
+
expect(lastFrame()).toBe('cancelled')
|
|
171
|
+
})
|
|
172
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
import { amplitudeToMeter } from '../../src/utils/amplitudeToMeter'
|
|
3
|
+
|
|
4
|
+
describe('amplitudeToMeter', () => {
|
|
5
|
+
test('returns 0 bars for zero amplitude', () => {
|
|
6
|
+
expect(amplitudeToMeter(0, 10)).toBe(0)
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
test('returns max bars for full amplitude', () => {
|
|
10
|
+
expect(amplitudeToMeter(1, 10)).toBe(10)
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
test('scales linearly between 0 and max', () => {
|
|
14
|
+
expect(amplitudeToMeter(0.5, 10)).toBe(5)
|
|
15
|
+
expect(amplitudeToMeter(0.23, 10)).toBe(2)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('clamps out-of-range values', () => {
|
|
19
|
+
expect(amplitudeToMeter(-0.5, 10)).toBe(0)
|
|
20
|
+
expect(amplitudeToMeter(1.5, 10)).toBe(10)
|
|
21
|
+
})
|
|
22
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
import { formatDuration } from '../../src/utils/formatDuration'
|
|
3
|
+
|
|
4
|
+
describe('formatDuration', () => {
|
|
5
|
+
test('formats seconds as mm:ss', () => {
|
|
6
|
+
expect(formatDuration(0)).toBe('00:00')
|
|
7
|
+
expect(formatDuration(5)).toBe('00:05')
|
|
8
|
+
expect(formatDuration(83)).toBe('01:23')
|
|
9
|
+
expect(formatDuration(3661)).toBe('61:01')
|
|
10
|
+
})
|
|
11
|
+
})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
import { generateSessionId } from '../../src/utils/sessionId'
|
|
3
|
+
|
|
4
|
+
describe('generateSessionId', () => {
|
|
5
|
+
test('uses date and descriptor', () => {
|
|
6
|
+
const result = generateSessionId({
|
|
7
|
+
now: new Date('2026-06-28T10:00:00Z'),
|
|
8
|
+
descriptor: 'stakeholder-checkout',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
expect(result).toBe('2026-06-28-stakeholder-checkout')
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
test('falls back to recording when no descriptor', () => {
|
|
15
|
+
const result = generateSessionId({ now: new Date('2026-06-28T10:00:00Z') })
|
|
16
|
+
|
|
17
|
+
expect(result).toBe('2026-06-28-recording')
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('slugifies descriptors with spaces and special characters', () => {
|
|
21
|
+
const result = generateSessionId({
|
|
22
|
+
now: new Date('2026-06-28T10:00:00Z'),
|
|
23
|
+
descriptor: '结算流程 redesign 需求访谈!',
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
expect(result).toMatch(/^2026-06-28-/)
|
|
27
|
+
expect(result).not.toContain(' ')
|
|
28
|
+
expect(result).not.toContain('!')
|
|
29
|
+
})
|
|
30
|
+
})
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"lib": ["ES2022"],
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"declaration": true,
|
|
14
|
+
"declarationMap": true,
|
|
15
|
+
"sourceMap": true,
|
|
16
|
+
"outDir": "./dist",
|
|
17
|
+
"rootDir": "./src",
|
|
18
|
+
"types": ["node", "vitest/globals"]
|
|
19
|
+
},
|
|
20
|
+
"include": ["src/**/*"],
|
|
21
|
+
"exclude": ["node_modules", "dist", "tests"]
|
|
22
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineConfig } from 'tsup'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
entry: ['src/main.tsx'],
|
|
5
|
+
outDir: 'dist',
|
|
6
|
+
format: ['esm'],
|
|
7
|
+
target: 'node20',
|
|
8
|
+
platform: 'node',
|
|
9
|
+
bundle: true,
|
|
10
|
+
splitting: false,
|
|
11
|
+
sourcemap: true,
|
|
12
|
+
clean: true,
|
|
13
|
+
dts: false,
|
|
14
|
+
esbuildOptions(options) {
|
|
15
|
+
options.jsx = 'automatic'
|
|
16
|
+
},
|
|
17
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
resolve: {
|
|
5
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
|
|
6
|
+
},
|
|
7
|
+
test: {
|
|
8
|
+
globals: true,
|
|
9
|
+
environment: 'node',
|
|
10
|
+
coverage: {
|
|
11
|
+
provider: 'v8',
|
|
12
|
+
thresholds: {
|
|
13
|
+
lines: 80,
|
|
14
|
+
functions: 80,
|
|
15
|
+
branches: 80,
|
|
16
|
+
statements: 80,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
})
|