@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,170 @@
|
|
|
1
|
+
import { describe, expect, test, vi, afterEach } from 'vitest'
|
|
2
|
+
import { render } from 'ink-testing-library'
|
|
3
|
+
import { UpdateApp } from '../../src/components/UpdateApp'
|
|
4
|
+
import * as updateReleaseModule from '../../src/utils/updateRelease'
|
|
5
|
+
|
|
6
|
+
async function tick() {
|
|
7
|
+
return new Promise((resolve) => setTimeout(resolve, 0))
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
describe('UpdateApp', () => {
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
vi.restoreAllMocks()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('renders welcome and starts checking', async () => {
|
|
16
|
+
vi.spyOn(updateReleaseModule, 'updateRelease').mockResolvedValue({
|
|
17
|
+
success: true,
|
|
18
|
+
fromVersion: '1.2.0',
|
|
19
|
+
toVersion: '1.2.0',
|
|
20
|
+
updated: [],
|
|
21
|
+
preserved: [],
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const { lastFrame } = render(<UpdateApp root="/tmp/proj" repo="sushanglewis/Lincoln" dryRun={false} />)
|
|
25
|
+
await tick()
|
|
26
|
+
expect(lastFrame() ?? '').toMatch(/Lincoln Update|up to date/)
|
|
27
|
+
expect(updateReleaseModule.updateRelease).toHaveBeenCalledWith({
|
|
28
|
+
root: '/tmp/proj',
|
|
29
|
+
repo: 'sushanglewis/Lincoln',
|
|
30
|
+
dryRun: true,
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('shows up-to-date when versions match', async () => {
|
|
35
|
+
vi.spyOn(updateReleaseModule, 'updateRelease').mockResolvedValue({
|
|
36
|
+
success: true,
|
|
37
|
+
fromVersion: '1.3.0',
|
|
38
|
+
toVersion: '1.3.0',
|
|
39
|
+
updated: [],
|
|
40
|
+
preserved: [],
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const { lastFrame } = render(<UpdateApp root="/tmp/proj" repo="sushanglewis/Lincoln" dryRun={false} />)
|
|
44
|
+
|
|
45
|
+
await vi.waitFor(() => expect(lastFrame() ?? '').toContain('up to date'), {
|
|
46
|
+
timeout: 2000,
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
test('shows confirm screen when update is available', async () => {
|
|
51
|
+
vi.spyOn(updateReleaseModule, 'updateRelease').mockResolvedValueOnce({
|
|
52
|
+
success: true,
|
|
53
|
+
fromVersion: '1.2.0',
|
|
54
|
+
toVersion: '1.3.0',
|
|
55
|
+
updated: [],
|
|
56
|
+
preserved: [],
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const { lastFrame } = render(<UpdateApp root="/tmp/proj" repo="sushanglewis/Lincoln" dryRun={false} />)
|
|
60
|
+
|
|
61
|
+
await vi.waitFor(() => expect(lastFrame() ?? '').toContain('Update available'), {
|
|
62
|
+
timeout: 2000,
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
test('starts update on confirm and shows result', async () => {
|
|
67
|
+
const updateSpy = vi
|
|
68
|
+
.spyOn(updateReleaseModule, 'updateRelease')
|
|
69
|
+
.mockResolvedValueOnce({
|
|
70
|
+
success: true,
|
|
71
|
+
fromVersion: '1.2.0',
|
|
72
|
+
toVersion: '1.3.0',
|
|
73
|
+
updated: [],
|
|
74
|
+
preserved: [],
|
|
75
|
+
})
|
|
76
|
+
.mockResolvedValueOnce({
|
|
77
|
+
success: true,
|
|
78
|
+
fromVersion: '1.2.0',
|
|
79
|
+
toVersion: '1.3.0',
|
|
80
|
+
updated: ['README.md'],
|
|
81
|
+
preserved: ['.context'],
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
const { lastFrame, stdin } = render(
|
|
85
|
+
<UpdateApp root="/tmp/proj" repo="sushanglewis/Lincoln" dryRun={false} />
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
await vi.waitFor(() => expect(lastFrame() ?? '').toContain('Update available'), {
|
|
89
|
+
timeout: 2000,
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
stdin.write('\r')
|
|
93
|
+
await tick()
|
|
94
|
+
|
|
95
|
+
await vi.waitFor(() => expect(lastFrame() ?? '').toContain('Update complete'), {
|
|
96
|
+
timeout: 2000,
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
expect(updateSpy).toHaveBeenCalledTimes(2)
|
|
100
|
+
expect(updateSpy).toHaveBeenLastCalledWith({
|
|
101
|
+
root: '/tmp/proj',
|
|
102
|
+
repo: 'sushanglewis/Lincoln',
|
|
103
|
+
dryRun: false,
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
test('displays error when update fails', async () => {
|
|
108
|
+
vi.spyOn(updateReleaseModule, 'updateRelease').mockResolvedValue({
|
|
109
|
+
success: false,
|
|
110
|
+
updated: [],
|
|
111
|
+
preserved: [],
|
|
112
|
+
error: 'network error',
|
|
113
|
+
})
|
|
114
|
+
|
|
115
|
+
const { lastFrame } = render(<UpdateApp root="/tmp/proj" repo="sushanglewis/Lincoln" dryRun={false} />)
|
|
116
|
+
|
|
117
|
+
await vi.waitFor(() => expect(lastFrame() ?? '').toContain('Update failed'), {
|
|
118
|
+
timeout: 2000,
|
|
119
|
+
})
|
|
120
|
+
expect(lastFrame() ?? '').toContain('network error')
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
test('displays error when apply throws after confirmation', async () => {
|
|
124
|
+
const updateSpy = vi
|
|
125
|
+
.spyOn(updateReleaseModule, 'updateRelease')
|
|
126
|
+
.mockResolvedValueOnce({
|
|
127
|
+
success: true,
|
|
128
|
+
fromVersion: '1.2.0',
|
|
129
|
+
toVersion: '1.3.0',
|
|
130
|
+
updated: [],
|
|
131
|
+
preserved: [],
|
|
132
|
+
})
|
|
133
|
+
.mockRejectedValueOnce(new Error('apply failed'))
|
|
134
|
+
|
|
135
|
+
const { lastFrame, stdin } = render(
|
|
136
|
+
<UpdateApp root="/tmp/proj" repo="sushanglewis/Lincoln" dryRun={false} />
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
await vi.waitFor(() => expect(lastFrame() ?? '').toContain('Update available'), {
|
|
140
|
+
timeout: 2000,
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
stdin.write('\r')
|
|
144
|
+
await tick()
|
|
145
|
+
|
|
146
|
+
await vi.waitFor(() => expect(lastFrame() ?? '').toContain('Update failed'), {
|
|
147
|
+
timeout: 2000,
|
|
148
|
+
})
|
|
149
|
+
expect(lastFrame() ?? '').toContain('apply failed')
|
|
150
|
+
expect(updateSpy).toHaveBeenCalledTimes(2)
|
|
151
|
+
})
|
|
152
|
+
|
|
153
|
+
test('shows dry-run result when dryRun is true', async () => {
|
|
154
|
+
vi.spyOn(updateReleaseModule, 'updateRelease').mockResolvedValue({
|
|
155
|
+
success: true,
|
|
156
|
+
fromVersion: '1.2.0',
|
|
157
|
+
toVersion: '1.3.0',
|
|
158
|
+
updated: [],
|
|
159
|
+
preserved: [],
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
const { lastFrame } = render(<UpdateApp root="/tmp/proj" repo="sushanglewis/Lincoln" dryRun />)
|
|
163
|
+
|
|
164
|
+
await vi.waitFor(() => expect(lastFrame() ?? '').toContain('Dry run'), {
|
|
165
|
+
timeout: 2000,
|
|
166
|
+
})
|
|
167
|
+
expect(lastFrame() ?? '').toContain('1.2.0 → 1.3.0')
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
})
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { describe, expect, test, vi } from 'vitest'
|
|
3
|
+
import { render } from 'ink-testing-library'
|
|
4
|
+
import { WelcomeScreen } from '../../src/components/WelcomeScreen'
|
|
5
|
+
import { HarnessSelectScreen } from '../../src/components/HarnessSelectScreen'
|
|
6
|
+
import { OptionsScreen } from '../../src/components/OptionsScreen'
|
|
7
|
+
import { SummaryScreen } from '../../src/components/SummaryScreen'
|
|
8
|
+
import { ProgressScreen } from '../../src/components/ProgressScreen'
|
|
9
|
+
import { ResultScreen } from '../../src/components/ResultScreen'
|
|
10
|
+
import { SelectMenu } from '../../src/components/SelectMenu'
|
|
11
|
+
import type { HarnessInfo } from '../../src/types'
|
|
12
|
+
|
|
13
|
+
async function tick() {
|
|
14
|
+
return new Promise((resolve) => setTimeout(resolve, 0))
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
describe('WelcomeScreen', () => {
|
|
18
|
+
test('renders welcome message', () => {
|
|
19
|
+
const { lastFrame } = render(<WelcomeScreen onStart={() => {}} />)
|
|
20
|
+
expect(lastFrame()).toContain('Welcome to Lincoln')
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test('calls onStart on enter', async () => {
|
|
24
|
+
const onStart = vi.fn()
|
|
25
|
+
const { stdin } = render(<WelcomeScreen onStart={onStart} />)
|
|
26
|
+
await tick()
|
|
27
|
+
stdin.write('\r')
|
|
28
|
+
await tick()
|
|
29
|
+
expect(onStart).toHaveBeenCalled()
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
test('ignores non-enter keys', async () => {
|
|
33
|
+
const onStart = vi.fn()
|
|
34
|
+
const { stdin } = render(<WelcomeScreen onStart={onStart} />)
|
|
35
|
+
await tick()
|
|
36
|
+
stdin.write('x')
|
|
37
|
+
await tick()
|
|
38
|
+
expect(onStart).not.toHaveBeenCalled()
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
describe('SelectMenu', () => {
|
|
43
|
+
test('selects item with enter in single mode', async () => {
|
|
44
|
+
const onSelect = vi.fn()
|
|
45
|
+
const onConfirm = vi.fn()
|
|
46
|
+
const { stdin } = render(
|
|
47
|
+
<SelectMenu
|
|
48
|
+
title="Choose"
|
|
49
|
+
items={[
|
|
50
|
+
{ label: 'One', value: 'one' },
|
|
51
|
+
{ label: 'Two', value: 'two' },
|
|
52
|
+
]}
|
|
53
|
+
selected={[]}
|
|
54
|
+
onSelect={onSelect}
|
|
55
|
+
onConfirm={onConfirm}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
await tick()
|
|
59
|
+
stdin.write('\r')
|
|
60
|
+
await tick()
|
|
61
|
+
expect(onSelect).toHaveBeenCalledWith('one')
|
|
62
|
+
expect(onConfirm).toHaveBeenCalledWith('one')
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
test('toggles item with space in multiple mode', async () => {
|
|
66
|
+
const onSelect = vi.fn()
|
|
67
|
+
const { stdin } = render(
|
|
68
|
+
<SelectMenu
|
|
69
|
+
title="Choose"
|
|
70
|
+
items={[
|
|
71
|
+
{ label: 'One', value: 'one' },
|
|
72
|
+
{ label: 'Two', value: 'two' },
|
|
73
|
+
]}
|
|
74
|
+
selected={[]}
|
|
75
|
+
multiple
|
|
76
|
+
onSelect={onSelect}
|
|
77
|
+
onConfirm={() => {}}
|
|
78
|
+
/>
|
|
79
|
+
)
|
|
80
|
+
await tick()
|
|
81
|
+
stdin.write(' ')
|
|
82
|
+
await tick()
|
|
83
|
+
expect(onSelect).toHaveBeenCalledWith('one')
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
test('navigates down and selects second item', async () => {
|
|
87
|
+
const onSelect = vi.fn()
|
|
88
|
+
const onConfirm = vi.fn()
|
|
89
|
+
const { stdin } = render(
|
|
90
|
+
<SelectMenu
|
|
91
|
+
title="Choose"
|
|
92
|
+
items={[
|
|
93
|
+
{ label: 'One', value: 'one' },
|
|
94
|
+
{ label: 'Two', value: 'two' },
|
|
95
|
+
]}
|
|
96
|
+
selected={[]}
|
|
97
|
+
onSelect={onSelect}
|
|
98
|
+
onConfirm={onConfirm}
|
|
99
|
+
/>
|
|
100
|
+
)
|
|
101
|
+
await tick()
|
|
102
|
+
stdin.write('\x1b[B')
|
|
103
|
+
await tick()
|
|
104
|
+
stdin.write('\r')
|
|
105
|
+
await tick()
|
|
106
|
+
expect(onSelect).toHaveBeenCalledWith('two')
|
|
107
|
+
expect(onConfirm).toHaveBeenCalledWith('two')
|
|
108
|
+
})
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
describe('HarnessSelectScreen', () => {
|
|
112
|
+
const harnesses: HarnessInfo[] = [
|
|
113
|
+
{ id: 'claude-code', name: 'Claude Code', description: 'Anthropic', installed: false },
|
|
114
|
+
{ id: 'codex', name: 'Codex', description: 'OpenAI', installed: true },
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
test('renders harness options and confirms selection', async () => {
|
|
118
|
+
const onConfirm = vi.fn()
|
|
119
|
+
const { lastFrame, stdin } = render(
|
|
120
|
+
<HarnessSelectScreen
|
|
121
|
+
harnesses={harnesses}
|
|
122
|
+
selected={['codex']}
|
|
123
|
+
onConfirm={onConfirm}
|
|
124
|
+
/>
|
|
125
|
+
)
|
|
126
|
+
await tick()
|
|
127
|
+
expect(lastFrame()).toContain('Claude Code')
|
|
128
|
+
expect(lastFrame()).toContain('Codex')
|
|
129
|
+
stdin.write(' ')
|
|
130
|
+
await tick()
|
|
131
|
+
stdin.write('\r')
|
|
132
|
+
await tick()
|
|
133
|
+
expect(onConfirm).toHaveBeenCalledWith(expect.arrayContaining(['codex', 'claude-code']))
|
|
134
|
+
})
|
|
135
|
+
})
|
|
136
|
+
|
|
137
|
+
describe('OptionsScreen', () => {
|
|
138
|
+
test('toggles option with space and confirms', async () => {
|
|
139
|
+
const onConfirm = vi.fn()
|
|
140
|
+
const { stdin } = render(
|
|
141
|
+
<OptionsScreen
|
|
142
|
+
options={{ installRecordingDeps: false, runBenchmark: false }}
|
|
143
|
+
onConfirm={onConfirm}
|
|
144
|
+
/>
|
|
145
|
+
)
|
|
146
|
+
await tick()
|
|
147
|
+
stdin.write(' ')
|
|
148
|
+
await tick()
|
|
149
|
+
stdin.write('\r')
|
|
150
|
+
await tick()
|
|
151
|
+
expect(onConfirm).toHaveBeenCalledWith({
|
|
152
|
+
installRecordingDeps: true,
|
|
153
|
+
runBenchmark: false,
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
test('wraps cursor with up and down arrows', async () => {
|
|
158
|
+
const { lastFrame, stdin } = render(
|
|
159
|
+
<OptionsScreen
|
|
160
|
+
options={{ installRecordingDeps: false, runBenchmark: false }}
|
|
161
|
+
onConfirm={() => {}}
|
|
162
|
+
/>
|
|
163
|
+
)
|
|
164
|
+
await tick()
|
|
165
|
+
stdin.write('\x1b[A')
|
|
166
|
+
await tick()
|
|
167
|
+
expect(lastFrame()).toContain('Enable benchmark tooling')
|
|
168
|
+
stdin.write('\x1b[B')
|
|
169
|
+
await tick()
|
|
170
|
+
stdin.write('\x1b[B')
|
|
171
|
+
await tick()
|
|
172
|
+
expect(lastFrame()).toContain('Enable benchmark tooling')
|
|
173
|
+
})
|
|
174
|
+
})
|
|
175
|
+
|
|
176
|
+
describe('SummaryScreen', () => {
|
|
177
|
+
test('renders summary and confirms', async () => {
|
|
178
|
+
const onConfirm = vi.fn()
|
|
179
|
+
const onCancel = vi.fn()
|
|
180
|
+
const { lastFrame, stdin } = render(
|
|
181
|
+
<SummaryScreen
|
|
182
|
+
root="/tmp/proj"
|
|
183
|
+
selectedHarnesses={['claude-code']}
|
|
184
|
+
harnesses={[
|
|
185
|
+
{ id: 'claude-code', name: 'Claude Code', description: '', installed: false },
|
|
186
|
+
]}
|
|
187
|
+
options={{ installRecordingDeps: false, runBenchmark: true }}
|
|
188
|
+
dryRun={false}
|
|
189
|
+
onConfirm={onConfirm}
|
|
190
|
+
onCancel={onCancel}
|
|
191
|
+
/>
|
|
192
|
+
)
|
|
193
|
+
await tick()
|
|
194
|
+
expect(lastFrame()).toContain('/tmp/proj')
|
|
195
|
+
expect(lastFrame()).toContain('Claude Code')
|
|
196
|
+
stdin.write('\r')
|
|
197
|
+
await tick()
|
|
198
|
+
expect(onConfirm).toHaveBeenCalled()
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
test('cancels on escape', async () => {
|
|
202
|
+
const onCancel = vi.fn()
|
|
203
|
+
const { stdin } = render(
|
|
204
|
+
<SummaryScreen
|
|
205
|
+
root="/tmp/proj"
|
|
206
|
+
selectedHarnesses={[]}
|
|
207
|
+
harnesses={[]}
|
|
208
|
+
options={{ installRecordingDeps: false, runBenchmark: false }}
|
|
209
|
+
dryRun={true}
|
|
210
|
+
onConfirm={() => {}}
|
|
211
|
+
onCancel={onCancel}
|
|
212
|
+
/>
|
|
213
|
+
)
|
|
214
|
+
await tick()
|
|
215
|
+
stdin.write('\x1b')
|
|
216
|
+
await tick()
|
|
217
|
+
expect(onCancel).toHaveBeenCalled()
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
describe('ProgressScreen', () => {
|
|
222
|
+
test('renders completed and current steps', () => {
|
|
223
|
+
const { lastFrame } = render(
|
|
224
|
+
<ProgressScreen
|
|
225
|
+
currentStep="install-clis"
|
|
226
|
+
results={[
|
|
227
|
+
{ step: 'check', success: true },
|
|
228
|
+
{ step: 'install-skills', success: true },
|
|
229
|
+
]}
|
|
230
|
+
/>
|
|
231
|
+
)
|
|
232
|
+
expect(lastFrame()).toContain('check')
|
|
233
|
+
expect(lastFrame()).toContain('install-clis')
|
|
234
|
+
})
|
|
235
|
+
})
|
|
236
|
+
|
|
237
|
+
describe('ResultScreen', () => {
|
|
238
|
+
test('renders success when all steps pass', () => {
|
|
239
|
+
const { lastFrame } = render(
|
|
240
|
+
<ResultScreen
|
|
241
|
+
results={[{ step: 'check', success: true }]}
|
|
242
|
+
onFinish={() => {}}
|
|
243
|
+
/>
|
|
244
|
+
)
|
|
245
|
+
expect(lastFrame()).toContain('complete')
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
test('renders failure for failed step', () => {
|
|
249
|
+
const { lastFrame } = render(
|
|
250
|
+
<ResultScreen
|
|
251
|
+
results={[{ step: 'check', success: false, error: 'oops' }]}
|
|
252
|
+
onFinish={() => {}}
|
|
253
|
+
/>
|
|
254
|
+
)
|
|
255
|
+
expect(lastFrame()).toContain('incomplete')
|
|
256
|
+
expect(lastFrame()).toContain('oops')
|
|
257
|
+
})
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
describe('SelectMenu extras', () => {
|
|
261
|
+
test('calls onCancel on escape', async () => {
|
|
262
|
+
const onCancel = vi.fn()
|
|
263
|
+
const { stdin } = render(
|
|
264
|
+
<SelectMenu
|
|
265
|
+
title="Choose"
|
|
266
|
+
items={[{ label: 'One', value: 'one' }]}
|
|
267
|
+
selected={[]}
|
|
268
|
+
onSelect={() => {}}
|
|
269
|
+
onConfirm={() => {}}
|
|
270
|
+
onCancel={onCancel}
|
|
271
|
+
/>
|
|
272
|
+
)
|
|
273
|
+
await tick()
|
|
274
|
+
stdin.write('\x1b')
|
|
275
|
+
await tick()
|
|
276
|
+
expect(onCancel).toHaveBeenCalled()
|
|
277
|
+
})
|
|
278
|
+
|
|
279
|
+
test('navigates up and wraps cursor', async () => {
|
|
280
|
+
const { lastFrame, stdin } = render(
|
|
281
|
+
<SelectMenu
|
|
282
|
+
title="Choose"
|
|
283
|
+
items={[
|
|
284
|
+
{ label: 'One', value: 'one' },
|
|
285
|
+
{ label: 'Two', value: 'two' },
|
|
286
|
+
]}
|
|
287
|
+
selected={[]}
|
|
288
|
+
onSelect={() => {}}
|
|
289
|
+
onConfirm={() => {}}
|
|
290
|
+
/>
|
|
291
|
+
)
|
|
292
|
+
await tick()
|
|
293
|
+
stdin.write('\x1b[A')
|
|
294
|
+
await tick()
|
|
295
|
+
expect(lastFrame()).toContain('> ○ Two')
|
|
296
|
+
})
|
|
297
|
+
})
|
|
298
|
+
|
|
299
|
+
describe('ResultScreen extras', () => {
|
|
300
|
+
test('calls onFinish on enter', async () => {
|
|
301
|
+
const onFinish = vi.fn()
|
|
302
|
+
const { stdin } = render(
|
|
303
|
+
<ResultScreen results={[{ step: 'check', success: true }]} onFinish={onFinish} />
|
|
304
|
+
)
|
|
305
|
+
await tick()
|
|
306
|
+
stdin.write('\r')
|
|
307
|
+
await tick()
|
|
308
|
+
expect(onFinish).toHaveBeenCalled()
|
|
309
|
+
})
|
|
310
|
+
})
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
import { parseArgs } from '../../src/config/args'
|
|
3
|
+
|
|
4
|
+
describe('parseArgs', () => {
|
|
5
|
+
test('returns defaults for empty argv', () => {
|
|
6
|
+
const args = parseArgs([])
|
|
7
|
+
expect(args.root).toBe('.')
|
|
8
|
+
expect(args.harness).toEqual([])
|
|
9
|
+
expect(args.yes).toBe(false)
|
|
10
|
+
expect(args.dryRun).toBe(false)
|
|
11
|
+
expect(args.noTui).toBe(false)
|
|
12
|
+
expect(args.format).toBe('human')
|
|
13
|
+
expect(args.help).toBe(false)
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
test('parses --root', () => {
|
|
17
|
+
const args = parseArgs(['--root', '/tmp/proj'])
|
|
18
|
+
expect(args.root).toBe('/tmp/proj')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
test('throws when --root is missing value', () => {
|
|
22
|
+
expect(() => parseArgs(['--root'])).toThrow('Missing value for --root')
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test('throws when --root value is another flag', () => {
|
|
26
|
+
expect(() => parseArgs(['--root', '--yes'])).toThrow('Missing value for --root')
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('collects multiple --harness values', () => {
|
|
30
|
+
const args = parseArgs(['--harness', 'claude-code', '--harness', 'codex'])
|
|
31
|
+
expect(args.harness).toEqual(['claude-code', 'codex'])
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('throws when --harness is missing value', () => {
|
|
35
|
+
expect(() => parseArgs(['--harness'])).toThrow('Missing value for --harness')
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('parses boolean flags', () => {
|
|
39
|
+
const args = parseArgs(['--yes', '--dry-run', '--no-tui'])
|
|
40
|
+
expect(args.yes).toBe(true)
|
|
41
|
+
expect(args.dryRun).toBe(true)
|
|
42
|
+
expect(args.noTui).toBe(true)
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
test('parses --format json', () => {
|
|
46
|
+
const args = parseArgs(['--format', 'json'])
|
|
47
|
+
expect(args.format).toBe('json')
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
test('throws on invalid format', () => {
|
|
51
|
+
expect(() => parseArgs(['--format', 'xml'])).toThrow("Invalid value for --format: xml")
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
test('throws when --format is missing value', () => {
|
|
55
|
+
expect(() => parseArgs(['--format'])).toThrow('Missing value for --format')
|
|
56
|
+
})
|
|
57
|
+
|
|
58
|
+
test('sets help for --help and -h', () => {
|
|
59
|
+
expect(parseArgs(['--help']).help).toBe(true)
|
|
60
|
+
expect(parseArgs(['-h']).help).toBe(true)
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
test('throws on unknown argument', () => {
|
|
64
|
+
expect(() => parseArgs(['--unknown'])).toThrow('Unknown argument: --unknown')
|
|
65
|
+
})
|
|
66
|
+
})
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs'
|
|
2
|
+
import { tmpdir } from 'node:os'
|
|
3
|
+
import { resolve, join } from 'node:path'
|
|
4
|
+
import { describe, expect, test, afterEach } from 'vitest'
|
|
5
|
+
import { resolveConfig } from '../../src/config/resolveConfig'
|
|
6
|
+
import type { ParsedArgs } from '../../src/config/args'
|
|
7
|
+
|
|
8
|
+
function makeProjectDir(): string {
|
|
9
|
+
const root = mkdtempSync(join(tmpdir(), 'lincoln-'))
|
|
10
|
+
const scriptsDir = join(root, 'scripts')
|
|
11
|
+
mkdirSync(scriptsDir)
|
|
12
|
+
writeFileSync(join(scriptsDir, 'lincoln-setup.py'), '')
|
|
13
|
+
return root
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function makeArgs(overrides: Partial<ParsedArgs> = {}, root = makeProjectDir()): ParsedArgs {
|
|
17
|
+
return {
|
|
18
|
+
root,
|
|
19
|
+
harness: [],
|
|
20
|
+
yes: false,
|
|
21
|
+
dryRun: false,
|
|
22
|
+
noTui: false,
|
|
23
|
+
format: 'human',
|
|
24
|
+
help: false,
|
|
25
|
+
...overrides,
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
describe('resolveConfig', () => {
|
|
30
|
+
const dirs: string[] = []
|
|
31
|
+
|
|
32
|
+
afterEach(() => {
|
|
33
|
+
for (const dir of dirs) {
|
|
34
|
+
rmSync(dir, { recursive: true, force: true })
|
|
35
|
+
}
|
|
36
|
+
dirs.length = 0
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('resolves root to absolute path', () => {
|
|
40
|
+
const root = makeProjectDir()
|
|
41
|
+
dirs.push(root)
|
|
42
|
+
const config = resolveConfig(makeArgs({ root }))
|
|
43
|
+
expect(config.root).toBe(resolve(root))
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test('uses provided harnesses', () => {
|
|
47
|
+
const root = makeProjectDir()
|
|
48
|
+
dirs.push(root)
|
|
49
|
+
const config = resolveConfig(makeArgs({ root, harness: ['claude-code'] }))
|
|
50
|
+
expect(config.harnesses).toEqual(['claude-code'])
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
test('passes boolean flags through', () => {
|
|
54
|
+
const root = makeProjectDir()
|
|
55
|
+
dirs.push(root)
|
|
56
|
+
const config = resolveConfig(makeArgs({ root, yes: true, dryRun: true, format: 'json' }))
|
|
57
|
+
expect(config.yes).toBe(true)
|
|
58
|
+
expect(config.dryRun).toBe(true)
|
|
59
|
+
expect(config.format).toBe('json')
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
test('throws when root does not exist', () => {
|
|
63
|
+
expect(() => resolveConfig(makeArgs({ root: '/does/not/exist' }, '/does/not/exist'))).toThrow(
|
|
64
|
+
'Project root does not exist or is not a directory'
|
|
65
|
+
)
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
test('throws when setup script is missing', () => {
|
|
69
|
+
const root = mkdtempSync(join(tmpdir(), 'lincoln-'))
|
|
70
|
+
dirs.push(root)
|
|
71
|
+
expect(() => resolveConfig(makeArgs({ root }, root))).toThrow(
|
|
72
|
+
'Lincoln setup script not found'
|
|
73
|
+
)
|
|
74
|
+
})
|
|
75
|
+
})
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
import { parseUpdateArgs } from '../../src/config/updateArgs'
|
|
3
|
+
|
|
4
|
+
describe('parseUpdateArgs', () => {
|
|
5
|
+
test('returns defaults for empty argv', () => {
|
|
6
|
+
const args = parseUpdateArgs([])
|
|
7
|
+
expect(args.root).toBe('.')
|
|
8
|
+
expect(args.repo).toBe('sushanglewis/Lincoln')
|
|
9
|
+
expect(args.dryRun).toBe(false)
|
|
10
|
+
expect(args.noTui).toBe(false)
|
|
11
|
+
expect(args.format).toBe('human')
|
|
12
|
+
expect(args.help).toBe(false)
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
test('parses --root', () => {
|
|
16
|
+
const args = parseUpdateArgs(['--root', '/tmp/proj'])
|
|
17
|
+
expect(args.root).toBe('/tmp/proj')
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
test('throws when --root value is missing', () => {
|
|
21
|
+
expect(() => parseUpdateArgs(['--root'])).toThrow('Missing value for --root')
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
test('parses --repo', () => {
|
|
25
|
+
const args = parseUpdateArgs(['--repo', 'owner/repo'])
|
|
26
|
+
expect(args.repo).toBe('owner/repo')
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('parses --dry-run and --no-tui', () => {
|
|
30
|
+
const args = parseUpdateArgs(['--dry-run', '--no-tui'])
|
|
31
|
+
expect(args.dryRun).toBe(true)
|
|
32
|
+
expect(args.noTui).toBe(true)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
test('parses --format json', () => {
|
|
36
|
+
const args = parseUpdateArgs(['--format', 'json'])
|
|
37
|
+
expect(args.format).toBe('json')
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
test('throws on invalid --format', () => {
|
|
41
|
+
expect(() => parseUpdateArgs(['--format', 'xml'])).toThrow('Invalid value for --format: xml')
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
test('sets help for --help and -h', () => {
|
|
45
|
+
expect(parseUpdateArgs(['--help']).help).toBe(true)
|
|
46
|
+
expect(parseUpdateArgs(['-h']).help).toBe(true)
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
test('throws on invalid repository slug', () => {
|
|
50
|
+
expect(() => parseUpdateArgs(['--repo', 'invalid'])).toThrow('Invalid repository slug')
|
|
51
|
+
})
|
|
52
|
+
})
|