@sushanglewis/lincoln 1.5.0 → 1.5.2
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 +1286 -916
- 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,213 @@
|
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
|
+
import { Text } from 'ink'
|
|
3
|
+
import { describe, expect, test, vi, afterEach } from 'vitest'
|
|
4
|
+
import { render } from 'ink-testing-library'
|
|
5
|
+
import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs'
|
|
6
|
+
import { tmpdir } from 'node:os'
|
|
7
|
+
import { join } from 'node:path'
|
|
8
|
+
import { useSetup, type StepResult } from '../../src/hooks/useSetup'
|
|
9
|
+
import * as runSetupModule from '../../src/utils/runSetup'
|
|
10
|
+
|
|
11
|
+
afterEach(() => {
|
|
12
|
+
vi.restoreAllMocks()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
function createProjectDir(): string {
|
|
16
|
+
const root = mkdtempSync(join(tmpdir(), 'lincoln-'))
|
|
17
|
+
const scriptsDir = join(root, 'scripts')
|
|
18
|
+
mkdirSync(scriptsDir)
|
|
19
|
+
writeFileSync(join(scriptsDir, 'lincoln-setup.py'), '')
|
|
20
|
+
return root
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
describe('useSetup', () => {
|
|
24
|
+
const dirs: string[] = []
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
for (const dir of dirs) {
|
|
28
|
+
rmSync(dir, { recursive: true, force: true })
|
|
29
|
+
}
|
|
30
|
+
dirs.length = 0
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
test('initial state is idle with no results', () => {
|
|
34
|
+
function C() {
|
|
35
|
+
const { isRunning, results } = useSetup()
|
|
36
|
+
return (
|
|
37
|
+
<Text>
|
|
38
|
+
{isRunning ? 'running' : 'idle'}:{results.length}
|
|
39
|
+
</Text>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
const { lastFrame } = render(<C />)
|
|
43
|
+
expect(lastFrame()).toBe('idle:0')
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test('startSetup runs all steps and completes on success', async () => {
|
|
47
|
+
vi.spyOn(runSetupModule, 'runSetup').mockResolvedValue({
|
|
48
|
+
success: true,
|
|
49
|
+
code: 0,
|
|
50
|
+
stdout: '{"ok":true}',
|
|
51
|
+
stderr: '',
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
const root = createProjectDir()
|
|
55
|
+
dirs.push(root)
|
|
56
|
+
let complete = false
|
|
57
|
+
let latestResults: StepResult[] = []
|
|
58
|
+
|
|
59
|
+
function TestHarness() {
|
|
60
|
+
const { isRunning, results, startSetup } = useSetup()
|
|
61
|
+
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
startSetup({
|
|
64
|
+
root,
|
|
65
|
+
harnesses: ['claude-code'],
|
|
66
|
+
yes: true,
|
|
67
|
+
dryRun: false,
|
|
68
|
+
})
|
|
69
|
+
}, [])
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
if (!isRunning && results.length > 0) {
|
|
73
|
+
complete = true
|
|
74
|
+
}
|
|
75
|
+
}, [isRunning, results])
|
|
76
|
+
|
|
77
|
+
latestResults = results
|
|
78
|
+
return <Text>{isRunning ? 'running' : 'idle'}</Text>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
render(<TestHarness />)
|
|
82
|
+
|
|
83
|
+
await vi.waitFor(() => expect(complete).toBe(true), {
|
|
84
|
+
timeout: 2000,
|
|
85
|
+
})
|
|
86
|
+
expect(latestResults.every((r) => r.success)).toBe(true)
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
test('startSetup records failure when a step fails', async () => {
|
|
90
|
+
vi.spyOn(runSetupModule, 'runSetup').mockResolvedValue({
|
|
91
|
+
success: false,
|
|
92
|
+
code: 1,
|
|
93
|
+
stdout: '',
|
|
94
|
+
stderr: 'missing dependency',
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
const root = createProjectDir()
|
|
98
|
+
dirs.push(root)
|
|
99
|
+
let complete = false
|
|
100
|
+
let latestResults: StepResult[] = []
|
|
101
|
+
|
|
102
|
+
function TestHarness() {
|
|
103
|
+
const { isRunning, results, startSetup } = useSetup()
|
|
104
|
+
|
|
105
|
+
useEffect(() => {
|
|
106
|
+
startSetup({
|
|
107
|
+
root,
|
|
108
|
+
harnesses: [],
|
|
109
|
+
yes: true,
|
|
110
|
+
dryRun: false,
|
|
111
|
+
})
|
|
112
|
+
}, [])
|
|
113
|
+
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (!isRunning && results.length > 0) {
|
|
116
|
+
complete = true
|
|
117
|
+
}
|
|
118
|
+
}, [isRunning, results])
|
|
119
|
+
|
|
120
|
+
latestResults = results
|
|
121
|
+
return <Text>{isRunning ? 'running' : 'idle'}</Text>
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
render(<TestHarness />)
|
|
125
|
+
|
|
126
|
+
await vi.waitFor(() => expect(complete).toBe(true), {
|
|
127
|
+
timeout: 2000,
|
|
128
|
+
})
|
|
129
|
+
expect(latestResults[0].success).toBe(false)
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
test('records error when startSetup throws', async () => {
|
|
133
|
+
vi.spyOn(runSetupModule, 'runSetup').mockRejectedValue(new Error('spawn failed'))
|
|
134
|
+
|
|
135
|
+
const root = createProjectDir()
|
|
136
|
+
dirs.push(root)
|
|
137
|
+
let capturedError: string | undefined
|
|
138
|
+
|
|
139
|
+
function TestHarness() {
|
|
140
|
+
const { isRunning, error, startSetup } = useSetup()
|
|
141
|
+
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
startSetup({
|
|
144
|
+
root,
|
|
145
|
+
harnesses: [],
|
|
146
|
+
yes: true,
|
|
147
|
+
dryRun: false,
|
|
148
|
+
})
|
|
149
|
+
}, [])
|
|
150
|
+
|
|
151
|
+
useEffect(() => {
|
|
152
|
+
if (!isRunning && error) {
|
|
153
|
+
capturedError = error
|
|
154
|
+
}
|
|
155
|
+
}, [isRunning, error])
|
|
156
|
+
|
|
157
|
+
return <Text>{isRunning ? 'running' : 'idle'}</Text>
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
render(<TestHarness />)
|
|
161
|
+
|
|
162
|
+
await vi.waitFor(() => expect(capturedError).toBeTruthy(), {
|
|
163
|
+
timeout: 2000,
|
|
164
|
+
})
|
|
165
|
+
expect(capturedError).toContain('spawn failed')
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
test('stops after install-skills fails', async () => {
|
|
169
|
+
let callCount = 0
|
|
170
|
+
vi.spyOn(runSetupModule, 'runSetup').mockImplementation(async () => {
|
|
171
|
+
callCount++
|
|
172
|
+
if (callCount === 1) {
|
|
173
|
+
return { success: true, code: 0, stdout: '{"ok":true}', stderr: '' }
|
|
174
|
+
}
|
|
175
|
+
return { success: false, code: 1, stdout: '', stderr: 'missing skill' }
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
const root = createProjectDir()
|
|
179
|
+
dirs.push(root)
|
|
180
|
+
let complete = false
|
|
181
|
+
let latestResults: StepResult[] = []
|
|
182
|
+
|
|
183
|
+
function TestHarness() {
|
|
184
|
+
const { isRunning, results, startSetup } = useSetup()
|
|
185
|
+
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
startSetup({
|
|
188
|
+
root,
|
|
189
|
+
harnesses: [],
|
|
190
|
+
yes: true,
|
|
191
|
+
dryRun: false,
|
|
192
|
+
})
|
|
193
|
+
}, [])
|
|
194
|
+
|
|
195
|
+
useEffect(() => {
|
|
196
|
+
if (!isRunning && results.length > 1) {
|
|
197
|
+
complete = true
|
|
198
|
+
}
|
|
199
|
+
}, [isRunning, results])
|
|
200
|
+
|
|
201
|
+
latestResults = results
|
|
202
|
+
return <Text>{isRunning ? 'running' : 'idle'}</Text>
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
render(<TestHarness />)
|
|
206
|
+
|
|
207
|
+
await vi.waitFor(() => expect(complete).toBe(true), {
|
|
208
|
+
timeout: 2000,
|
|
209
|
+
})
|
|
210
|
+
expect(latestResults[0].success).toBe(true)
|
|
211
|
+
expect(latestResults[1].success).toBe(false)
|
|
212
|
+
})
|
|
213
|
+
})
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { describe, expect, test, vi, afterEach } from 'vitest'
|
|
2
|
+
import * as updateReleaseModule from '../src/utils/updateRelease'
|
|
3
|
+
|
|
4
|
+
vi.mock('ink', async (importOriginal) => {
|
|
5
|
+
const actual = await importOriginal<typeof import('ink')>()
|
|
6
|
+
return {
|
|
7
|
+
...actual,
|
|
8
|
+
render: vi.fn(),
|
|
9
|
+
}
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
describe('updateMain', () => {
|
|
13
|
+
afterEach(() => {
|
|
14
|
+
vi.restoreAllMocks()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
test('prints help and exits zero for --help', async () => {
|
|
18
|
+
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
|
|
19
|
+
const { render: mockedRender } = await import('ink')
|
|
20
|
+
const { updateMain } = await import('../src/update')
|
|
21
|
+
await updateMain(['--help'])
|
|
22
|
+
expect(errorSpy).not.toHaveBeenCalled()
|
|
23
|
+
expect(process.exitCode).not.toBe(1)
|
|
24
|
+
expect(mockedRender).toHaveBeenCalled()
|
|
25
|
+
const element = (mockedRender as unknown as ReturnType<typeof vi.fn>).mock.calls[0][0]
|
|
26
|
+
expect(element.props.args.help).toBe(true)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('prints JSON result for --no-tui --format json', async () => {
|
|
30
|
+
vi.spyOn(updateReleaseModule, 'updateRelease').mockResolvedValue({
|
|
31
|
+
success: true,
|
|
32
|
+
fromVersion: '1.2.0',
|
|
33
|
+
toVersion: '1.3.0',
|
|
34
|
+
updated: ['README.md'],
|
|
35
|
+
preserved: ['.context'],
|
|
36
|
+
})
|
|
37
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {})
|
|
38
|
+
|
|
39
|
+
const { updateMain } = await import('../src/update')
|
|
40
|
+
await updateMain(['--root', '/tmp/proj', '--no-tui', '--format', 'json'])
|
|
41
|
+
|
|
42
|
+
expect(logSpy).toHaveBeenCalled()
|
|
43
|
+
const output = JSON.parse(logSpy.mock.calls[0][0] as string)
|
|
44
|
+
expect(output.success).toBe(true)
|
|
45
|
+
expect(output.toVersion).toBe('1.3.0')
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('prints human result for --no-tui --format human', async () => {
|
|
49
|
+
vi.spyOn(updateReleaseModule, 'updateRelease').mockResolvedValue({
|
|
50
|
+
success: true,
|
|
51
|
+
fromVersion: '1.2.0',
|
|
52
|
+
toVersion: '1.3.0',
|
|
53
|
+
updated: ['README.md'],
|
|
54
|
+
preserved: ['.context'],
|
|
55
|
+
backupDir: '/tmp/.context/lincoln-update-backup',
|
|
56
|
+
})
|
|
57
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {})
|
|
58
|
+
|
|
59
|
+
const { updateMain } = await import('../src/update')
|
|
60
|
+
await updateMain(['--root', '/tmp/proj', '--no-tui', '--format', 'human'])
|
|
61
|
+
|
|
62
|
+
expect(logSpy).toHaveBeenCalled()
|
|
63
|
+
const output = logSpy.mock.calls.map((call) => call[0]).join('\n')
|
|
64
|
+
expect(output).toContain('Update available')
|
|
65
|
+
expect(output).toContain('README.md')
|
|
66
|
+
expect(output).toContain('Preserved user data')
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
test('prints error for invalid argument', async () => {
|
|
70
|
+
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
|
|
71
|
+
const { updateMain } = await import('../src/update')
|
|
72
|
+
await updateMain(['--unknown'])
|
|
73
|
+
expect(errorSpy).toHaveBeenCalled()
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
test('rejects invalid repository slug', async () => {
|
|
77
|
+
const errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {})
|
|
78
|
+
const { updateMain } = await import('../src/update')
|
|
79
|
+
await updateMain(['--repo', 'invalid'])
|
|
80
|
+
expect(errorSpy).toHaveBeenCalled()
|
|
81
|
+
expect(process.exitCode).toBe(1)
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
test('renders TUI by default', async () => {
|
|
85
|
+
const { render: mockedRender } = await import('ink')
|
|
86
|
+
const { updateMain } = await import('../src/update')
|
|
87
|
+
await updateMain(['--root', '/tmp/proj'])
|
|
88
|
+
expect(mockedRender).toHaveBeenCalled()
|
|
89
|
+
const element = (mockedRender as unknown as ReturnType<typeof vi.fn>).mock.calls[0][0]
|
|
90
|
+
expect(element.props.args.noTui).toBe(false)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
test('prints human result for failed update', async () => {
|
|
94
|
+
vi.spyOn(updateReleaseModule, 'updateRelease').mockResolvedValue({
|
|
95
|
+
success: false,
|
|
96
|
+
updated: [],
|
|
97
|
+
preserved: [],
|
|
98
|
+
error: 'network error',
|
|
99
|
+
})
|
|
100
|
+
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {})
|
|
101
|
+
|
|
102
|
+
const { updateMain } = await import('../src/update')
|
|
103
|
+
await updateMain(['--root', '/tmp/proj', '--no-tui', '--format', 'human'])
|
|
104
|
+
|
|
105
|
+
expect(logSpy).toHaveBeenCalled()
|
|
106
|
+
expect(logSpy.mock.calls[0][0]).toContain('network error')
|
|
107
|
+
})
|
|
108
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { mkdtempSync, mkdirSync, rmSync } from 'node:fs'
|
|
2
|
+
import { tmpdir } from 'node:os'
|
|
3
|
+
import { join } from 'node:path'
|
|
4
|
+
import { describe, expect, test, afterEach } from 'vitest'
|
|
5
|
+
import { detectHarnesses } from '../../src/utils/detectHarness'
|
|
6
|
+
|
|
7
|
+
describe('detectHarnesses', () => {
|
|
8
|
+
let root: string
|
|
9
|
+
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
if (root) rmSync(root, { recursive: true, force: true })
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
function setupRoot() {
|
|
15
|
+
root = mkdtempSync(join(tmpdir(), 'lincoln-'))
|
|
16
|
+
return root
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
test('detects project-level claude-code harness', () => {
|
|
20
|
+
setupRoot()
|
|
21
|
+
mkdirSync(join(root, '.claude'))
|
|
22
|
+
const harnesses = detectHarnesses(root, root)
|
|
23
|
+
const claude = harnesses.find((h) => h.id === 'claude-code')
|
|
24
|
+
expect(claude?.installed).toBe(true)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
test('detects project-level codex harness', () => {
|
|
28
|
+
setupRoot()
|
|
29
|
+
mkdirSync(join(root, '.codex'))
|
|
30
|
+
const harnesses = detectHarnesses(root, root)
|
|
31
|
+
const codex = harnesses.find((h) => h.id === 'codex')
|
|
32
|
+
expect(codex?.installed).toBe(true)
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
test('marks undetected harnesses as not installed', () => {
|
|
36
|
+
setupRoot()
|
|
37
|
+
const harnesses = detectHarnesses(root, root)
|
|
38
|
+
expect(harnesses.every((h) => !h.installed)).toBe(true)
|
|
39
|
+
})
|
|
40
|
+
})
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
import { runSetup, parseJsonOutput } from '../../src/utils/runSetup'
|
|
3
|
+
|
|
4
|
+
describe('runSetup', () => {
|
|
5
|
+
test('runs a successful command and captures stdout', async () => {
|
|
6
|
+
const result = await runSetup({ root: process.cwd(), command: 'node', args: ['-e', 'console.log("ok")'] })
|
|
7
|
+
expect(result.success).toBe(true)
|
|
8
|
+
expect(result.code).toBe(0)
|
|
9
|
+
expect(result.stdout.trim()).toBe('ok')
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
test('returns failure for non-zero exit', async () => {
|
|
13
|
+
const result = await runSetup({ root: process.cwd(), command: 'node', args: ['-e', 'process.exit(1)'] })
|
|
14
|
+
expect(result.success).toBe(false)
|
|
15
|
+
expect(result.code).toBe(1)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
test('returns error when command is missing', async () => {
|
|
19
|
+
const result = await runSetup({ root: process.cwd(), command: 'this-command-does-not-exist-12345', args: [] })
|
|
20
|
+
expect(result.success).toBe(false)
|
|
21
|
+
expect(result.error).toBeTruthy()
|
|
22
|
+
})
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
describe('parseJsonOutput', () => {
|
|
26
|
+
test('parses single JSON line', () => {
|
|
27
|
+
expect(parseJsonOutput('{"ok":true}')).toEqual({ ok: true })
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
test('parses last JSON line from mixed output', () => {
|
|
31
|
+
expect(parseJsonOutput('log line\n{"ok":true}')).toEqual({ ok: true })
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('returns undefined for empty output', () => {
|
|
35
|
+
expect(parseJsonOutput('')).toBeUndefined()
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
test('returns undefined for invalid JSON', () => {
|
|
39
|
+
expect(parseJsonOutput('not json')).toBeUndefined()
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
test('returns undefined for whitespace-only output', () => {
|
|
43
|
+
expect(parseJsonOutput(' ')).toBeUndefined()
|
|
44
|
+
})
|
|
45
|
+
})
|