@su-record/vibe 3.2.13 → 3.2.15
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/CLAUDE.md +15 -14
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/dist/cli/setup/ProjectSetup.d.ts +6 -0
- package/dist/cli/setup/ProjectSetup.d.ts.map +1 -1
- package/dist/cli/setup/ProjectSetup.js +19 -13
- package/dist/cli/setup/ProjectSetup.js.map +1 -1
- package/dist/infra/lib/codex-proxy.d.ts +126 -0
- package/dist/infra/lib/codex-proxy.d.ts.map +1 -1
- package/dist/infra/lib/codex-proxy.js +16 -16
- package/dist/infra/lib/codex-proxy.js.map +1 -1
- package/dist/infra/lib/figma/audit.d.ts.map +1 -1
- package/dist/infra/lib/figma/audit.js +0 -2
- package/dist/infra/lib/figma/audit.js.map +1 -1
- package/dist/infra/lib/figma/extract.d.ts +6 -1
- package/dist/infra/lib/figma/extract.d.ts.map +1 -1
- package/dist/infra/lib/figma/extract.js +17 -15
- package/dist/infra/lib/figma/extract.js.map +1 -1
- package/dist/infra/lib/figma/types.d.ts +103 -0
- package/dist/infra/lib/figma/types.d.ts.map +1 -1
- package/dist/infra/lib/figma/types.js +8 -0
- package/dist/infra/lib/figma/types.js.map +1 -1
- package/hooks/hooks.json +1 -1
- package/hooks/scripts/clone-extract.js +16 -1
- package/hooks/scripts/code-check.js +72 -55
- package/hooks/scripts/lib/anchor.js +74 -0
- package/hooks/scripts/lib/console-allow.js +66 -0
- package/hooks/scripts/lib/dispatcher.js +71 -19
- package/hooks/scripts/lib/inbox.js +60 -0
- package/hooks/scripts/loop-ledger.js +24 -1
- package/hooks/scripts/post-edit-dispatcher.js +4 -3
- package/hooks/scripts/post-edit.js +2 -2
- package/package.json +13 -9
- package/skills/vibe/SKILL.md +2 -1
- package/skills/vibe.clone/references/verification-loops.md +6 -3
- package/skills/vibe.loop/SKILL.md +7 -4
- package/skills/vibe.review/SKILL.md +5 -1
- package/skills/vibe.run/references/e2e-and-autofix.md +1 -1
- package/skills/vibe.run/references/process-steps.md +1 -1
- package/vibe/constitution.md +1 -1
- package/vibe/rules/loop-contract.md +40 -3
- package/vibe/rules/quality/checklist.md +3 -3
- package/vibe/templates/constitution-template.md +1 -1
- package/dist/__tests__/agent-model-sync.test.d.ts +0 -2
- package/dist/__tests__/agent-model-sync.test.d.ts.map +0 -1
- package/dist/__tests__/agent-model-sync.test.js +0 -71
- package/dist/__tests__/agent-model-sync.test.js.map +0 -1
- package/dist/__tests__/architecture.test.d.ts +0 -2
- package/dist/__tests__/architecture.test.d.ts.map +0 -1
- package/dist/__tests__/architecture.test.js +0 -207
- package/dist/__tests__/architecture.test.js.map +0 -1
- package/dist/__tests__/skill-namespace.test.d.ts +0 -2
- package/dist/__tests__/skill-namespace.test.d.ts.map +0 -1
- package/dist/__tests__/skill-namespace.test.js +0 -60
- package/dist/__tests__/skill-namespace.test.js.map +0 -1
- package/dist/__tests__/stakes-contract.test.d.ts +0 -2
- package/dist/__tests__/stakes-contract.test.d.ts.map +0 -1
- package/dist/__tests__/stakes-contract.test.js +0 -166
- package/dist/__tests__/stakes-contract.test.js.map +0 -1
- package/dist/__tests__/stuck-semantics.test.d.ts +0 -2
- package/dist/__tests__/stuck-semantics.test.d.ts.map +0 -1
- package/dist/__tests__/stuck-semantics.test.js +0 -109
- package/dist/__tests__/stuck-semantics.test.js.map +0 -1
- package/dist/__tests__/wiring-integrity.test.d.ts +0 -2
- package/dist/__tests__/wiring-integrity.test.d.ts.map +0 -1
- package/dist/__tests__/wiring-integrity.test.js +0 -160
- package/dist/__tests__/wiring-integrity.test.js.map +0 -1
- package/dist/cli/commands/info.test.d.ts +0 -2
- package/dist/cli/commands/info.test.d.ts.map +0 -1
- package/dist/cli/commands/info.test.js +0 -74
- package/dist/cli/commands/info.test.js.map +0 -1
- package/dist/cli/commands/upgrade.test.d.ts +0 -2
- package/dist/cli/commands/upgrade.test.d.ts.map +0 -1
- package/dist/cli/commands/upgrade.test.js +0 -99
- package/dist/cli/commands/upgrade.test.js.map +0 -1
- package/dist/cli/design/design-md-parser.test.d.ts +0 -2
- package/dist/cli/design/design-md-parser.test.d.ts.map +0 -1
- package/dist/cli/design/design-md-parser.test.js +0 -149
- package/dist/cli/design/design-md-parser.test.js.map +0 -1
- package/dist/cli/detect.characterization.test.d.ts +0 -7
- package/dist/cli/detect.characterization.test.d.ts.map +0 -1
- package/dist/cli/detect.characterization.test.js +0 -294
- package/dist/cli/detect.characterization.test.js.map +0 -1
- package/dist/cli/postinstall/fs-utils.test.d.ts +0 -2
- package/dist/cli/postinstall/fs-utils.test.d.ts.map +0 -1
- package/dist/cli/postinstall/fs-utils.test.js +0 -259
- package/dist/cli/postinstall/fs-utils.test.js.map +0 -1
- package/dist/cli/setup/CodexHooks.test.d.ts +0 -2
- package/dist/cli/setup/CodexHooks.test.d.ts.map +0 -1
- package/dist/cli/setup/CodexHooks.test.js +0 -52
- package/dist/cli/setup/CodexHooks.test.js.map +0 -1
- package/dist/cli/setup/GlobalInstaller.test.d.ts +0 -2
- package/dist/cli/setup/GlobalInstaller.test.d.ts.map +0 -1
- package/dist/cli/setup/GlobalInstaller.test.js +0 -16
- package/dist/cli/setup/GlobalInstaller.test.js.map +0 -1
- package/dist/cli/utils/cli-detector.test.d.ts +0 -2
- package/dist/cli/utils/cli-detector.test.d.ts.map +0 -1
- package/dist/cli/utils/cli-detector.test.js +0 -52
- package/dist/cli/utils/cli-detector.test.js.map +0 -1
- package/dist/infra/lib/SkillFrontmatter.test.d.ts +0 -2
- package/dist/infra/lib/SkillFrontmatter.test.d.ts.map +0 -1
- package/dist/infra/lib/SkillFrontmatter.test.js +0 -60
- package/dist/infra/lib/SkillFrontmatter.test.js.map +0 -1
- package/dist/infra/lib/__tests__/AutomationLevel.test.d.ts +0 -2
- package/dist/infra/lib/__tests__/AutomationLevel.test.d.ts.map +0 -1
- package/dist/infra/lib/__tests__/AutomationLevel.test.js +0 -297
- package/dist/infra/lib/__tests__/AutomationLevel.test.js.map +0 -1
- package/dist/infra/lib/__tests__/ComponentRegistry.test.d.ts +0 -2
- package/dist/infra/lib/__tests__/ComponentRegistry.test.d.ts.map +0 -1
- package/dist/infra/lib/__tests__/ComponentRegistry.test.js +0 -99
- package/dist/infra/lib/__tests__/ComponentRegistry.test.js.map +0 -1
- package/dist/infra/lib/__tests__/DecisionTracer.test.d.ts +0 -2
- package/dist/infra/lib/__tests__/DecisionTracer.test.d.ts.map +0 -1
- package/dist/infra/lib/__tests__/DecisionTracer.test.js +0 -274
- package/dist/infra/lib/__tests__/DecisionTracer.test.js.map +0 -1
- package/dist/infra/lib/__tests__/InteractiveCheckpoint.test.d.ts +0 -2
- package/dist/infra/lib/__tests__/InteractiveCheckpoint.test.d.ts.map +0 -1
- package/dist/infra/lib/__tests__/InteractiveCheckpoint.test.js +0 -350
- package/dist/infra/lib/__tests__/InteractiveCheckpoint.test.js.map +0 -1
- package/dist/infra/lib/__tests__/LoopBreaker.test.d.ts +0 -2
- package/dist/infra/lib/__tests__/LoopBreaker.test.d.ts.map +0 -1
- package/dist/infra/lib/__tests__/LoopBreaker.test.js +0 -340
- package/dist/infra/lib/__tests__/LoopBreaker.test.js.map +0 -1
- package/dist/infra/lib/__tests__/VerificationLoop.test.d.ts +0 -2
- package/dist/infra/lib/__tests__/VerificationLoop.test.d.ts.map +0 -1
- package/dist/infra/lib/__tests__/VerificationLoop.test.js +0 -486
- package/dist/infra/lib/__tests__/VerificationLoop.test.js.map +0 -1
- package/dist/infra/lib/config/GlobalConfigManager.test.d.ts +0 -2
- package/dist/infra/lib/config/GlobalConfigManager.test.d.ts.map +0 -1
- package/dist/infra/lib/config/GlobalConfigManager.test.js +0 -9
- package/dist/infra/lib/config/GlobalConfigManager.test.js.map +0 -1
- package/dist/infra/lib/embedding/__tests__/EmbeddingProvider.test.d.ts +0 -2
- package/dist/infra/lib/embedding/__tests__/EmbeddingProvider.test.d.ts.map +0 -1
- package/dist/infra/lib/embedding/__tests__/EmbeddingProvider.test.js +0 -43
- package/dist/infra/lib/embedding/__tests__/EmbeddingProvider.test.js.map +0 -1
- package/dist/infra/lib/embedding/__tests__/VectorStore.test.d.ts +0 -2
- package/dist/infra/lib/embedding/__tests__/VectorStore.test.d.ts.map +0 -1
- package/dist/infra/lib/embedding/__tests__/VectorStore.test.js +0 -94
- package/dist/infra/lib/embedding/__tests__/VectorStore.test.js.map +0 -1
- package/dist/infra/lib/embedding/__tests__/cosine.test.d.ts +0 -2
- package/dist/infra/lib/embedding/__tests__/cosine.test.d.ts.map +0 -1
- package/dist/infra/lib/embedding/__tests__/cosine.test.js +0 -73
- package/dist/infra/lib/embedding/__tests__/cosine.test.js.map +0 -1
- package/dist/infra/lib/evolution/__tests__/deprecation.test.d.ts +0 -2
- package/dist/infra/lib/evolution/__tests__/deprecation.test.d.ts.map +0 -1
- package/dist/infra/lib/evolution/__tests__/deprecation.test.js +0 -251
- package/dist/infra/lib/evolution/__tests__/deprecation.test.js.map +0 -1
- package/dist/infra/lib/evolution/__tests__/eval.test.d.ts +0 -2
- package/dist/infra/lib/evolution/__tests__/eval.test.d.ts.map +0 -1
- package/dist/infra/lib/evolution/__tests__/eval.test.js +0 -603
- package/dist/infra/lib/evolution/__tests__/eval.test.js.map +0 -1
- package/dist/infra/lib/evolution/__tests__/generation.test.d.ts +0 -2
- package/dist/infra/lib/evolution/__tests__/generation.test.d.ts.map +0 -1
- package/dist/infra/lib/evolution/__tests__/generation.test.js +0 -396
- package/dist/infra/lib/evolution/__tests__/generation.test.js.map +0 -1
- package/dist/infra/lib/evolution/__tests__/insight.test.d.ts +0 -2
- package/dist/infra/lib/evolution/__tests__/insight.test.d.ts.map +0 -1
- package/dist/infra/lib/evolution/__tests__/insight.test.js +0 -204
- package/dist/infra/lib/evolution/__tests__/insight.test.js.map +0 -1
- package/dist/infra/lib/evolution/__tests__/integration.test.d.ts +0 -2
- package/dist/infra/lib/evolution/__tests__/integration.test.d.ts.map +0 -1
- package/dist/infra/lib/evolution/__tests__/integration.test.js +0 -206
- package/dist/infra/lib/evolution/__tests__/integration.test.js.map +0 -1
- package/dist/infra/lib/evolution/__tests__/lifecycle.test.d.ts +0 -2
- package/dist/infra/lib/evolution/__tests__/lifecycle.test.d.ts.map +0 -1
- package/dist/infra/lib/evolution/__tests__/lifecycle.test.js +0 -350
- package/dist/infra/lib/evolution/__tests__/lifecycle.test.js.map +0 -1
- package/dist/infra/lib/evolution/__tests__/parity.test.d.ts +0 -2
- package/dist/infra/lib/evolution/__tests__/parity.test.d.ts.map +0 -1
- package/dist/infra/lib/evolution/__tests__/parity.test.js +0 -319
- package/dist/infra/lib/evolution/__tests__/parity.test.js.map +0 -1
- package/dist/infra/lib/llm/auth/AuthProfileManager.test.d.ts +0 -5
- package/dist/infra/lib/llm/auth/AuthProfileManager.test.d.ts.map +0 -1
- package/dist/infra/lib/llm/auth/AuthProfileManager.test.js +0 -168
- package/dist/infra/lib/llm/auth/AuthProfileManager.test.js.map +0 -1
- package/dist/infra/lib/llm/auth/TokenRefresher.test.d.ts +0 -2
- package/dist/infra/lib/llm/auth/TokenRefresher.test.d.ts.map +0 -1
- package/dist/infra/lib/llm/auth/TokenRefresher.test.js +0 -120
- package/dist/infra/lib/llm/auth/TokenRefresher.test.js.map +0 -1
- package/dist/infra/lib/llm/timeout.test.d.ts +0 -2
- package/dist/infra/lib/llm/timeout.test.d.ts.map +0 -1
- package/dist/infra/lib/llm/timeout.test.js +0 -50
- package/dist/infra/lib/llm/timeout.test.js.map +0 -1
- package/dist/infra/lib/llm-availability.test.d.ts +0 -2
- package/dist/infra/lib/llm-availability.test.d.ts.map +0 -1
- package/dist/infra/lib/llm-availability.test.js +0 -37
- package/dist/infra/lib/llm-availability.test.js.map +0 -1
- package/dist/infra/lib/memory/KnowledgeGraph.test.d.ts +0 -2
- package/dist/infra/lib/memory/KnowledgeGraph.test.d.ts.map +0 -1
- package/dist/infra/lib/memory/KnowledgeGraph.test.js +0 -189
- package/dist/infra/lib/memory/KnowledgeGraph.test.js.map +0 -1
- package/dist/infra/lib/memory/MemorySearch.test.d.ts +0 -2
- package/dist/infra/lib/memory/MemorySearch.test.d.ts.map +0 -1
- package/dist/infra/lib/memory/MemorySearch.test.js +0 -149
- package/dist/infra/lib/memory/MemorySearch.test.js.map +0 -1
- package/dist/infra/lib/memory/MemoryStorage.test.d.ts +0 -2
- package/dist/infra/lib/memory/MemoryStorage.test.d.ts.map +0 -1
- package/dist/infra/lib/memory/MemoryStorage.test.js +0 -198
- package/dist/infra/lib/memory/MemoryStorage.test.js.map +0 -1
- package/dist/infra/lib/memory/SessionRAGRetriever.test.d.ts +0 -2
- package/dist/infra/lib/memory/SessionRAGRetriever.test.d.ts.map +0 -1
- package/dist/infra/lib/memory/SessionRAGRetriever.test.js +0 -180
- package/dist/infra/lib/memory/SessionRAGRetriever.test.js.map +0 -1
- package/dist/infra/lib/memory/SessionRAGStore.test.d.ts +0 -2
- package/dist/infra/lib/memory/SessionRAGStore.test.d.ts.map +0 -1
- package/dist/infra/lib/memory/SessionRAGStore.test.js +0 -326
- package/dist/infra/lib/memory/SessionRAGStore.test.js.map +0 -1
- package/dist/infra/lib/memory/__tests__/InMemoryStorage.test.d.ts +0 -2
- package/dist/infra/lib/memory/__tests__/InMemoryStorage.test.d.ts.map +0 -1
- package/dist/infra/lib/memory/__tests__/InMemoryStorage.test.js +0 -114
- package/dist/infra/lib/memory/__tests__/InMemoryStorage.test.js.map +0 -1
- package/dist/infra/lib/memory/__tests__/ReflectionStore.test.d.ts +0 -2
- package/dist/infra/lib/memory/__tests__/ReflectionStore.test.d.ts.map +0 -1
- package/dist/infra/lib/memory/__tests__/ReflectionStore.test.js +0 -196
- package/dist/infra/lib/memory/__tests__/ReflectionStore.test.js.map +0 -1
- package/dist/infra/lib/memory/index.test.d.ts +0 -2
- package/dist/infra/lib/memory/index.test.d.ts.map +0 -1
- package/dist/infra/lib/memory/index.test.js +0 -23
- package/dist/infra/lib/memory/index.test.js.map +0 -1
- package/dist/infra/lib/telemetry/SkillTelemetry.test.d.ts +0 -2
- package/dist/infra/lib/telemetry/SkillTelemetry.test.d.ts.map +0 -1
- package/dist/infra/lib/telemetry/SkillTelemetry.test.js +0 -124
- package/dist/infra/lib/telemetry/SkillTelemetry.test.js.map +0 -1
- package/dist/infra/lib/ui-ux/Bm25Engine.test.d.ts +0 -2
- package/dist/infra/lib/ui-ux/Bm25Engine.test.d.ts.map +0 -1
- package/dist/infra/lib/ui-ux/Bm25Engine.test.js +0 -159
- package/dist/infra/lib/ui-ux/Bm25Engine.test.js.map +0 -1
- package/dist/infra/lib/ui-ux/CsvDataLoader.test.d.ts +0 -2
- package/dist/infra/lib/ui-ux/CsvDataLoader.test.d.ts.map +0 -1
- package/dist/infra/lib/ui-ux/CsvDataLoader.test.js +0 -141
- package/dist/infra/lib/ui-ux/CsvDataLoader.test.js.map +0 -1
- package/dist/infra/lib/ui-ux/DesignSystemGenerator.test.d.ts +0 -2
- package/dist/infra/lib/ui-ux/DesignSystemGenerator.test.d.ts.map +0 -1
- package/dist/infra/lib/ui-ux/DesignSystemGenerator.test.js +0 -370
- package/dist/infra/lib/ui-ux/DesignSystemGenerator.test.js.map +0 -1
- package/dist/infra/lib/ui-ux/SearchService.test.d.ts +0 -2
- package/dist/infra/lib/ui-ux/SearchService.test.d.ts.map +0 -1
- package/dist/infra/lib/ui-ux/SearchService.test.js +0 -215
- package/dist/infra/lib/ui-ux/SearchService.test.js.map +0 -1
- package/dist/test-helpers/index.d.ts +0 -36
- package/dist/test-helpers/index.d.ts.map +0 -1
- package/dist/test-helpers/index.js +0 -85
- package/dist/test-helpers/index.js.map +0 -1
- package/dist/test-helpers/index.test.d.ts +0 -2
- package/dist/test-helpers/index.test.d.ts.map +0 -1
- package/dist/test-helpers/index.test.js +0 -92
- package/dist/test-helpers/index.test.js.map +0 -1
- package/dist/tests/curated-release-notes.test.d.ts +0 -2
- package/dist/tests/curated-release-notes.test.d.ts.map +0 -1
- package/dist/tests/curated-release-notes.test.js +0 -160
- package/dist/tests/curated-release-notes.test.js.map +0 -1
- package/dist/tools/convention/analyzeComplexity.test.d.ts +0 -2
- package/dist/tools/convention/analyzeComplexity.test.d.ts.map +0 -1
- package/dist/tools/convention/analyzeComplexity.test.js +0 -207
- package/dist/tools/convention/analyzeComplexity.test.js.map +0 -1
- package/dist/tools/convention/validateCodeQuality.test.d.ts +0 -2
- package/dist/tools/convention/validateCodeQuality.test.d.ts.map +0 -1
- package/dist/tools/convention/validateCodeQuality.test.js +0 -230
- package/dist/tools/convention/validateCodeQuality.test.js.map +0 -1
- package/dist/tools/loop/validateLoopDefinition.test.d.ts +0 -14
- package/dist/tools/loop/validateLoopDefinition.test.d.ts.map +0 -1
- package/dist/tools/loop/validateLoopDefinition.test.js +0 -229
- package/dist/tools/loop/validateLoopDefinition.test.js.map +0 -1
- package/dist/tools/spec/executionPacket.test.d.ts +0 -2
- package/dist/tools/spec/executionPacket.test.d.ts.map +0 -1
- package/dist/tools/spec/executionPacket.test.js +0 -374
- package/dist/tools/spec/executionPacket.test.js.map +0 -1
- package/dist/tools/spec/prdParser.test.d.ts +0 -6
- package/dist/tools/spec/prdParser.test.d.ts.map +0 -1
- package/dist/tools/spec/prdParser.test.js +0 -332
- package/dist/tools/spec/prdParser.test.js.map +0 -1
- package/dist/tools/spec/specGenerator.test.d.ts +0 -2
- package/dist/tools/spec/specGenerator.test.d.ts.map +0 -1
- package/dist/tools/spec/specGenerator.test.js +0 -130
- package/dist/tools/spec/specGenerator.test.js.map +0 -1
- package/dist/tools/spec/traceabilityMatrix.path-resolution.test.d.ts +0 -10
- package/dist/tools/spec/traceabilityMatrix.path-resolution.test.d.ts.map +0 -1
- package/dist/tools/spec/traceabilityMatrix.path-resolution.test.js +0 -120
- package/dist/tools/spec/traceabilityMatrix.path-resolution.test.js.map +0 -1
- package/dist/tools/spec/traceabilityMatrix.test.d.ts +0 -6
- package/dist/tools/spec/traceabilityMatrix.test.d.ts.map +0 -1
- package/dist/tools/spec/traceabilityMatrix.test.js +0 -359
- package/dist/tools/spec/traceabilityMatrix.test.js.map +0 -1
- package/hooks/scripts/__tests__/.vibe/command-log.txt +0 -3
- package/hooks/scripts/__tests__/auto-test-debounce.test.js +0 -145
- package/hooks/scripts/__tests__/clone-behaviors.test.js +0 -152
- package/hooks/scripts/__tests__/clone-merge-responsive.test.js +0 -106
- package/hooks/scripts/__tests__/code-check-detectors.test.js +0 -213
- package/hooks/scripts/__tests__/code-check-memory-write.test.js +0 -81
- package/hooks/scripts/__tests__/codex-hook-adapter.test.js +0 -64
- package/hooks/scripts/__tests__/curation-index.test.js +0 -157
- package/hooks/scripts/__tests__/dispatcher-inprocess.test.js +0 -99
- package/hooks/scripts/__tests__/figma-extract.test.js +0 -338
- package/hooks/scripts/__tests__/hook-payload.test.js +0 -29
- package/hooks/scripts/__tests__/llm-orchestrate-antigravity.test.js +0 -66
- package/hooks/scripts/__tests__/loop-ledger.test.js +0 -321
- package/hooks/scripts/__tests__/post-edit-dispatcher.test.js +0 -139
- package/hooks/scripts/__tests__/pre-tool-guard.test.js +0 -523
- package/hooks/scripts/__tests__/recipe-extractor.test.js +0 -244
- package/hooks/scripts/__tests__/run-ledger-verify-required.test.js +0 -151
- package/hooks/scripts/__tests__/run-ledger.test.js +0 -481
- package/hooks/scripts/__tests__/scope-from-spec.test.js +0 -215
- package/hooks/scripts/__tests__/sentinel-guard.test.js +0 -263
- package/hooks/scripts/__tests__/step-counter.test.js +0 -459
- package/hooks/scripts/__tests__/utils-npm-root.test.js +0 -99
|
@@ -1,481 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* run-ledger 라이브러리 테스트
|
|
3
|
-
*
|
|
4
|
-
* REQ-harness-remediation-005, 006, 007, 008 커버리지:
|
|
5
|
-
* - round-trip 읽기/쓰기
|
|
6
|
-
* - verifyAt > runStarted 로직
|
|
7
|
-
* - extractRunFeature / isVibeRunPrompt 헬퍼
|
|
8
|
-
* - recordRunStart → verifyPassed 리셋
|
|
9
|
-
* - recordVerify pass/fail
|
|
10
|
-
* - prompt-dispatcher 에서의 vibe.run 감지 (CLI 실행)
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
14
|
-
import fs from 'fs';
|
|
15
|
-
import path from 'path';
|
|
16
|
-
import os from 'os';
|
|
17
|
-
import { execFileSync, spawnSync } from 'child_process';
|
|
18
|
-
import { fileURLToPath } from 'url';
|
|
19
|
-
|
|
20
|
-
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
21
|
-
const PASS_RESULTS = [{ command: 'npm test', exitCode: 0 }];
|
|
22
|
-
|
|
23
|
-
function verifyOptions(ledger, results = PASS_RESULTS) {
|
|
24
|
-
return { runId: ledger.runId, verificationResults: results };
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// 테스트 격리용 임시 디렉토리
|
|
28
|
-
let tmpDir;
|
|
29
|
-
beforeEach(() => {
|
|
30
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'vibe-ledger-test-'));
|
|
31
|
-
});
|
|
32
|
-
afterEach(() => {
|
|
33
|
-
try { fs.rmSync(tmpDir, { recursive: true, force: true }); } catch { /* ignore */ }
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// 모듈 임포트 (ESM 동적)
|
|
37
|
-
async function importLedger() {
|
|
38
|
-
const ledgerPath = path.resolve(__dirname, '..', 'lib', 'run-ledger.js');
|
|
39
|
-
// 캐시 버스팅 불필요 — 순수 함수, 상태 없음
|
|
40
|
-
return import(ledgerPath);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// ──────────────────────────────────────────────────────────────────
|
|
44
|
-
// readLedger / recordRunStart / recordVerify round-trip
|
|
45
|
-
// ──────────────────────────────────────────────────────────────────
|
|
46
|
-
describe('run-ledger: round-trip', () => {
|
|
47
|
-
it('존재하지 않는 레저 → null 반환', async () => {
|
|
48
|
-
const { readLedger } = await importLedger();
|
|
49
|
-
const result = readLedger(tmpDir);
|
|
50
|
-
expect(result).toBeNull();
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
it('recordRunStart 후 읽으면 runStarted가 ISO 문자열', async () => {
|
|
54
|
-
const { recordRunStart, readLedger } = await importLedger();
|
|
55
|
-
const before = new Date().toISOString();
|
|
56
|
-
recordRunStart(tmpDir, 'my-feature');
|
|
57
|
-
const ledger = readLedger(tmpDir);
|
|
58
|
-
expect(ledger).not.toBeNull();
|
|
59
|
-
expect(ledger.runStarted).toBeDefined();
|
|
60
|
-
expect(ledger.runStarted >= before).toBe(true);
|
|
61
|
-
expect(ledger.runFeature).toBe('my-feature');
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
it('recordRunStart는 verifyPassed를 false로 리셋', async () => {
|
|
65
|
-
const { recordRunStart, recordVerify, readLedger } = await importLedger();
|
|
66
|
-
recordRunStart(tmpDir, 'f1');
|
|
67
|
-
recordVerify(tmpDir, true, verifyOptions(readLedger(tmpDir)));
|
|
68
|
-
// 두 번째 run — 리셋
|
|
69
|
-
recordRunStart(tmpDir, 'f2');
|
|
70
|
-
const ledger = readLedger(tmpDir);
|
|
71
|
-
expect(ledger.verifyPassed).toBe(false);
|
|
72
|
-
expect(ledger.verifyAt).toBeNull();
|
|
73
|
-
expect(ledger.stopWarned).toBe(false);
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('recordVerify(pass) → verifyPassed=true, verifyAt 설정', async () => {
|
|
77
|
-
const { recordRunStart, recordVerify, readLedger } = await importLedger();
|
|
78
|
-
recordRunStart(tmpDir, 'feat');
|
|
79
|
-
const before = new Date().toISOString();
|
|
80
|
-
recordVerify(tmpDir, true, verifyOptions(readLedger(tmpDir)));
|
|
81
|
-
const ledger = readLedger(tmpDir);
|
|
82
|
-
expect(ledger.verifyPassed).toBe(true);
|
|
83
|
-
expect(ledger.verifyAt).toBeDefined();
|
|
84
|
-
expect(ledger.verifyAt >= before).toBe(true);
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('recordVerify(fail) → verifyPassed=false', async () => {
|
|
88
|
-
const { recordRunStart, recordVerify, readLedger } = await importLedger();
|
|
89
|
-
recordRunStart(tmpDir, 'feat');
|
|
90
|
-
recordVerify(tmpDir, false, verifyOptions(readLedger(tmpDir), []));
|
|
91
|
-
const ledger = readLedger(tmpDir);
|
|
92
|
-
expect(ledger.verifyPassed).toBe(false);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('recordVerify → 안정된 runId 경로에 evidence.json 원자 기록', async () => {
|
|
96
|
-
const { recordRunStart, recordVerify, readLedger } = await importLedger();
|
|
97
|
-
recordRunStart(tmpDir, 'feat');
|
|
98
|
-
const started = readLedger(tmpDir);
|
|
99
|
-
fs.mkdirSync(path.join(tmpDir, '.vibe', 'specs'), { recursive: true });
|
|
100
|
-
fs.writeFileSync(path.join(tmpDir, '.vibe', 'specs', 'feat.md'), '# SPEC');
|
|
101
|
-
expect(recordVerify(tmpDir, true, verifyOptions(started))).toBe(true);
|
|
102
|
-
|
|
103
|
-
const after = readLedger(tmpDir);
|
|
104
|
-
expect(after.runId).toBe(started.runId);
|
|
105
|
-
const evidencePath = path.join(tmpDir, '.vibe', 'runs', after.runId, 'evidence.json');
|
|
106
|
-
expect(fs.existsSync(evidencePath)).toBe(true);
|
|
107
|
-
const evidence = JSON.parse(fs.readFileSync(evidencePath, 'utf-8'));
|
|
108
|
-
expect(evidence).toMatchObject({
|
|
109
|
-
schemaVersion: '1.0.0',
|
|
110
|
-
runId: after.runId,
|
|
111
|
-
specPath: '.vibe/specs/feat.md',
|
|
112
|
-
judges: {
|
|
113
|
-
deterministic: { authority: 'blocking', verifyPassed: true },
|
|
114
|
-
model: { authority: 'advisory-only', canComplete: false },
|
|
115
|
-
humanTaste: { authority: 'release-only', canComplete: false },
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
it('레거시 ledger도 runId를 보강하고 누락된 검증 결과는 빈 배열로 기록', async () => {
|
|
121
|
-
const p = path.join(tmpDir, '.vibe', 'metrics', 'run-ledger.json');
|
|
122
|
-
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
123
|
-
fs.writeFileSync(p, JSON.stringify({ runStarted: '2026-01-01T00:00:00.000Z' }));
|
|
124
|
-
const { recordVerify, readLedger } = await importLedger();
|
|
125
|
-
expect(recordVerify(tmpDir, false)).toBe(true);
|
|
126
|
-
const ledger = readLedger(tmpDir);
|
|
127
|
-
const evidencePath = path.join(tmpDir, '.vibe', 'runs', ledger.runId, 'evidence.json');
|
|
128
|
-
const evidence = JSON.parse(fs.readFileSync(evidencePath, 'utf-8'));
|
|
129
|
-
expect(evidence.specPath).toBeNull();
|
|
130
|
-
expect(evidence.judges.deterministic.verificationResults).toEqual([]);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it('기존 verificationResults의 command와 exitCode를 evidence에 보존', async () => {
|
|
134
|
-
const { recordRunStart, recordVerify, readLedger } = await importLedger();
|
|
135
|
-
recordRunStart(tmpDir, 'feat');
|
|
136
|
-
const p = path.join(tmpDir, '.vibe', 'metrics', 'run-ledger.json');
|
|
137
|
-
const ledger = readLedger(tmpDir);
|
|
138
|
-
fs.writeFileSync(p, JSON.stringify({
|
|
139
|
-
...ledger,
|
|
140
|
-
verificationResults: [{ command: 'npm test', exitCode: 0 }],
|
|
141
|
-
}));
|
|
142
|
-
recordVerify(tmpDir, true, verifyOptions(ledger, [
|
|
143
|
-
{ command: 'npm test', exitCode: 0 },
|
|
144
|
-
]));
|
|
145
|
-
const evidencePath = path.join(tmpDir, '.vibe', 'runs', ledger.runId, 'evidence.json');
|
|
146
|
-
const evidence = JSON.parse(fs.readFileSync(evidencePath, 'utf-8'));
|
|
147
|
-
expect(evidence.judges.deterministic.verificationResults)
|
|
148
|
-
.toEqual([{ command: 'npm test', exitCode: 0 }]);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it('새 run은 이전 run의 검증 결과를 제거', async () => {
|
|
152
|
-
const { recordRunStart, recordVerify, readLedger } = await importLedger();
|
|
153
|
-
recordRunStart(tmpDir, 'first');
|
|
154
|
-
const first = readLedger(tmpDir);
|
|
155
|
-
recordVerify(tmpDir, true, verifyOptions(first, [{ command: 'old-test', exitCode: 0 }]));
|
|
156
|
-
|
|
157
|
-
recordRunStart(tmpDir, 'second');
|
|
158
|
-
const second = readLedger(tmpDir);
|
|
159
|
-
expect(second.verificationResults).toBeUndefined();
|
|
160
|
-
recordVerify(tmpDir, true, verifyOptions(second));
|
|
161
|
-
const evidencePath = path.join(tmpDir, '.vibe', 'runs', second.runId, 'evidence.json');
|
|
162
|
-
const evidence = JSON.parse(fs.readFileSync(evidencePath, 'utf-8'));
|
|
163
|
-
expect(evidence.judges.deterministic.verificationResults).toEqual(PASS_RESULTS);
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it('조작된 runId는 프로젝트 밖에 evidence를 기록하지 않음', async () => {
|
|
167
|
-
const ledgerPath = path.join(tmpDir, '.vibe', 'metrics', 'run-ledger.json');
|
|
168
|
-
const escapedDir = path.join(path.dirname(tmpDir), `escaped-${path.basename(tmpDir)}`);
|
|
169
|
-
fs.mkdirSync(path.dirname(ledgerPath), { recursive: true });
|
|
170
|
-
fs.writeFileSync(ledgerPath, JSON.stringify({
|
|
171
|
-
runId: `../../../${path.basename(escapedDir)}`,
|
|
172
|
-
runStarted: new Date().toISOString(),
|
|
173
|
-
verifyPassed: false,
|
|
174
|
-
}));
|
|
175
|
-
const { recordVerify } = await importLedger();
|
|
176
|
-
expect(recordVerify(tmpDir, true, {
|
|
177
|
-
runId: `../../../${path.basename(escapedDir)}`,
|
|
178
|
-
verificationResults: PASS_RESULTS,
|
|
179
|
-
})).toBe(false);
|
|
180
|
-
expect(fs.existsSync(path.join(escapedDir, 'evidence.json'))).toBe(false);
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
it('evidence 기록 실패 시 ledger를 통과 상태로 바꾸지 않음', async () => {
|
|
184
|
-
const { recordRunStart, recordVerify, readLedger } = await importLedger();
|
|
185
|
-
recordRunStart(tmpDir, 'feat');
|
|
186
|
-
const ledger = readLedger(tmpDir);
|
|
187
|
-
const runPath = path.join(tmpDir, '.vibe', 'runs', ledger.runId);
|
|
188
|
-
fs.mkdirSync(path.dirname(runPath), { recursive: true });
|
|
189
|
-
fs.writeFileSync(runPath, 'occupied');
|
|
190
|
-
|
|
191
|
-
expect(recordVerify(tmpDir, true, verifyOptions(ledger))).toBe(false);
|
|
192
|
-
expect(readLedger(tmpDir).verifyPassed).toBe(false);
|
|
193
|
-
});
|
|
194
|
-
|
|
195
|
-
it('다른 runId의 verify 결과를 현재 run에 적용하지 않음', async () => {
|
|
196
|
-
const { recordRunStart, recordVerify, readLedger } = await importLedger();
|
|
197
|
-
recordRunStart(tmpDir, 'feat');
|
|
198
|
-
expect(recordVerify(tmpDir, true, {
|
|
199
|
-
runId: 'aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa',
|
|
200
|
-
verificationResults: PASS_RESULTS,
|
|
201
|
-
})).toBe(false);
|
|
202
|
-
expect(readLedger(tmpDir).verifyPassed).toBe(false);
|
|
203
|
-
});
|
|
204
|
-
|
|
205
|
-
it('분할 SPEC의 _index.md를 evidence 경로로 기록', async () => {
|
|
206
|
-
const { recordRunStart, recordVerify, readLedger } = await importLedger();
|
|
207
|
-
const specDir = path.join(tmpDir, '.vibe', 'specs', 'large-feature');
|
|
208
|
-
fs.mkdirSync(specDir, { recursive: true });
|
|
209
|
-
fs.writeFileSync(path.join(specDir, '_index.md'), '# Master SPEC');
|
|
210
|
-
recordRunStart(tmpDir, 'large-feature');
|
|
211
|
-
const ledger = readLedger(tmpDir);
|
|
212
|
-
recordVerify(tmpDir, true, verifyOptions(ledger));
|
|
213
|
-
const evidencePath = path.join(tmpDir, '.vibe', 'runs', ledger.runId, 'evidence.json');
|
|
214
|
-
const evidence = JSON.parse(fs.readFileSync(evidencePath, 'utf-8'));
|
|
215
|
-
expect(evidence.specPath).toBe('.vibe/specs/large-feature/_index.md');
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
// ──────────────────────────────────────────────────────────────────
|
|
220
|
-
// verifyAt > runStarted 관계 검증
|
|
221
|
-
// ──────────────────────────────────────────────────────────────────
|
|
222
|
-
describe('run-ledger: verifyAt > runStarted', () => {
|
|
223
|
-
it('recordVerify 후 verifyAt > runStarted', async () => {
|
|
224
|
-
const { recordRunStart, recordVerify, readLedger } = await importLedger();
|
|
225
|
-
recordRunStart(tmpDir, 'f');
|
|
226
|
-
// 동일 밀리초 내 실행 가능성을 피하기 위해 runStarted를 과거로 조작
|
|
227
|
-
const ledger = readLedger(tmpDir);
|
|
228
|
-
const p = path.join(tmpDir, '.vibe', 'metrics', 'run-ledger.json');
|
|
229
|
-
const patched = { ...ledger, runStarted: new Date(Date.now() - 1000).toISOString() };
|
|
230
|
-
fs.writeFileSync(p, JSON.stringify(patched), 'utf-8');
|
|
231
|
-
|
|
232
|
-
recordVerify(tmpDir, true, verifyOptions(readLedger(tmpDir)));
|
|
233
|
-
const after = readLedger(tmpDir);
|
|
234
|
-
expect(after.verifyAt > after.runStarted).toBe(true);
|
|
235
|
-
expect(after.verifyPassed).toBe(true);
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
it('verifyAt이 runStarted보다 이르면 gate 불충족 (simulate)', async () => {
|
|
239
|
-
const { readLedger } = await importLedger();
|
|
240
|
-
const p = path.join(tmpDir, '.vibe', 'metrics', 'run-ledger.json');
|
|
241
|
-
fs.mkdirSync(path.dirname(p), { recursive: true });
|
|
242
|
-
const now = new Date();
|
|
243
|
-
// runStarted가 verifyAt보다 나중
|
|
244
|
-
const data = {
|
|
245
|
-
runStarted: new Date(now.getTime() + 5000).toISOString(),
|
|
246
|
-
runFeature: 'f',
|
|
247
|
-
verifyPassed: true,
|
|
248
|
-
verifyAt: now.toISOString(),
|
|
249
|
-
stopWarned: false,
|
|
250
|
-
};
|
|
251
|
-
fs.writeFileSync(p, JSON.stringify(data), 'utf-8');
|
|
252
|
-
const ledger = readLedger(tmpDir);
|
|
253
|
-
// auto-commit 게이트 로직: verifyPassed=true 이지만 verifyAt < runStarted
|
|
254
|
-
const gatePass = ledger.verifyPassed === true
|
|
255
|
-
&& ledger.verifyAt
|
|
256
|
-
&& ledger.verifyAt > ledger.runStarted;
|
|
257
|
-
expect(gatePass).toBe(false);
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
// ──────────────────────────────────────────────────────────────────
|
|
262
|
-
// isVibeRunPrompt / extractRunFeature
|
|
263
|
-
// ──────────────────────────────────────────────────────────────────
|
|
264
|
-
describe('run-ledger: vibe.run 감지 헬퍼', () => {
|
|
265
|
-
it('/vibe.run 감지', async () => {
|
|
266
|
-
const { isVibeRunPrompt } = await importLedger();
|
|
267
|
-
expect(isVibeRunPrompt('/vibe.run my-feature')).toBe(true);
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
it('$vibe.run 감지', async () => {
|
|
271
|
-
const { isVibeRunPrompt } = await importLedger();
|
|
272
|
-
expect(isVibeRunPrompt('$vibe.run my-feature')).toBe(true);
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
it('대소문자 무관', async () => {
|
|
276
|
-
const { isVibeRunPrompt } = await importLedger();
|
|
277
|
-
expect(isVibeRunPrompt('/VIBE.RUN feature')).toBe(true);
|
|
278
|
-
});
|
|
279
|
-
|
|
280
|
-
it('부분 매칭 방지 — vibe.runs 는 미감지', async () => {
|
|
281
|
-
const { isVibeRunPrompt } = await importLedger();
|
|
282
|
-
// "vibe.runs"는 \b로 경계 처리됨
|
|
283
|
-
expect(isVibeRunPrompt('vibe.runs everything')).toBe(false);
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
it('단어 내 포함은 미감지', async () => {
|
|
287
|
-
const { isVibeRunPrompt } = await importLedger();
|
|
288
|
-
expect(isVibeRunPrompt('I was talking about vibe.runner')).toBe(false);
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
it('extractRunFeature: 기능명 추출', async () => {
|
|
292
|
-
const { extractRunFeature } = await importLedger();
|
|
293
|
-
expect(extractRunFeature('/vibe.run my-feature')).toBe('my-feature');
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
it('extractRunFeature: $vibe.run에서 추출', async () => {
|
|
297
|
-
const { extractRunFeature } = await importLedger();
|
|
298
|
-
expect(extractRunFeature('$vibe.run auth-login ultrawork')).toBe('auth-login');
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
it('extractRunFeature: 따옴표를 제거해 SPEC 경로용 기능명을 반환', async () => {
|
|
302
|
-
const { extractRunFeature } = await importLedger();
|
|
303
|
-
expect(extractRunFeature('/vibe.run "auth-login"')).toBe('auth-login');
|
|
304
|
-
expect(extractRunFeature("$vibe.run 'auth-login'")).toBe('auth-login');
|
|
305
|
-
});
|
|
306
|
-
|
|
307
|
-
it('extractRunFeature: 기능명 없으면 null', async () => {
|
|
308
|
-
const { extractRunFeature } = await importLedger();
|
|
309
|
-
expect(extractRunFeature('/vibe.run --phase 1')).toBeNull();
|
|
310
|
-
});
|
|
311
|
-
|
|
312
|
-
it('extractRunFeature: /vibe.run만 있으면 null', async () => {
|
|
313
|
-
const { extractRunFeature } = await importLedger();
|
|
314
|
-
expect(extractRunFeature('/vibe.run')).toBeNull();
|
|
315
|
-
});
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
// ──────────────────────────────────────────────────────────────────
|
|
319
|
-
// markStopWarned
|
|
320
|
-
// ──────────────────────────────────────────────────────────────────
|
|
321
|
-
describe('run-ledger: stopWarned', () => {
|
|
322
|
-
it('markStopWarned → stopWarned=true', async () => {
|
|
323
|
-
const { recordRunStart, markStopWarned, readLedger } = await importLedger();
|
|
324
|
-
recordRunStart(tmpDir, 'f');
|
|
325
|
-
markStopWarned(tmpDir);
|
|
326
|
-
const ledger = readLedger(tmpDir);
|
|
327
|
-
expect(ledger.stopWarned).toBe(true);
|
|
328
|
-
});
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
// ──────────────────────────────────────────────────────────────────
|
|
332
|
-
// verify-ledger.js CLI
|
|
333
|
-
// ──────────────────────────────────────────────────────────────────
|
|
334
|
-
describe('verify-ledger CLI', () => {
|
|
335
|
-
const CLI = path.resolve(__dirname, '..', 'verify-ledger.js');
|
|
336
|
-
|
|
337
|
-
function cliArgs(status, ledger, results = PASS_RESULTS) {
|
|
338
|
-
const resultsPath = path.join(tmpDir, 'verification-results.json');
|
|
339
|
-
fs.writeFileSync(resultsPath, JSON.stringify(results));
|
|
340
|
-
return [CLI, status, ledger.runId, resultsPath];
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
it('pass 인자 → verifyPassed=true, exit 0', async () => {
|
|
344
|
-
const { recordRunStart, readLedger } = await importLedger();
|
|
345
|
-
recordRunStart(tmpDir, 'feat');
|
|
346
|
-
|
|
347
|
-
const result = spawnSync('node', cliArgs('pass', readLedger(tmpDir)), {
|
|
348
|
-
encoding: 'utf-8',
|
|
349
|
-
timeout: 5000,
|
|
350
|
-
env: { ...process.env, CLAUDE_PROJECT_DIR: tmpDir },
|
|
351
|
-
});
|
|
352
|
-
expect(result.status).toBe(0);
|
|
353
|
-
expect(result.stdout).toContain('verifyPassed=true');
|
|
354
|
-
|
|
355
|
-
const ledger = readLedger(tmpDir);
|
|
356
|
-
expect(ledger.verifyPassed).toBe(true);
|
|
357
|
-
});
|
|
358
|
-
|
|
359
|
-
it('fail 인자 → verifyPassed=false, exit 0', async () => {
|
|
360
|
-
const { recordRunStart, readLedger } = await importLedger();
|
|
361
|
-
recordRunStart(tmpDir, 'feat');
|
|
362
|
-
|
|
363
|
-
const result = spawnSync('node', cliArgs('fail', readLedger(tmpDir), []), {
|
|
364
|
-
encoding: 'utf-8',
|
|
365
|
-
timeout: 5000,
|
|
366
|
-
env: { ...process.env, CLAUDE_PROJECT_DIR: tmpDir },
|
|
367
|
-
});
|
|
368
|
-
expect(result.status).toBe(0);
|
|
369
|
-
expect(result.stdout).toContain('verifyPassed=false');
|
|
370
|
-
|
|
371
|
-
const ledger = readLedger(tmpDir);
|
|
372
|
-
expect(ledger.verifyPassed).toBe(false);
|
|
373
|
-
});
|
|
374
|
-
|
|
375
|
-
it('인자 없이도 exit 0 (fail-open)', () => {
|
|
376
|
-
const result = spawnSync('node', [CLI], {
|
|
377
|
-
encoding: 'utf-8',
|
|
378
|
-
timeout: 5000,
|
|
379
|
-
env: { ...process.env, CLAUDE_PROJECT_DIR: tmpDir },
|
|
380
|
-
});
|
|
381
|
-
expect(result.status).toBe(0);
|
|
382
|
-
});
|
|
383
|
-
|
|
384
|
-
it('기록 실패는 exit 0을 유지하되 stderr 경고로 노출', () => {
|
|
385
|
-
const projectFile = path.join(tmpDir, 'not-a-directory');
|
|
386
|
-
fs.writeFileSync(projectFile, 'occupied');
|
|
387
|
-
const result = spawnSync('node', [CLI, 'pass'], {
|
|
388
|
-
encoding: 'utf-8',
|
|
389
|
-
timeout: 5000,
|
|
390
|
-
env: { ...process.env, CLAUDE_PROJECT_DIR: projectFile },
|
|
391
|
-
});
|
|
392
|
-
expect(result.status).toBe(0);
|
|
393
|
-
expect(result.stderr).toContain('evidence.json write failed');
|
|
394
|
-
expect(result.stdout).not.toContain('recorded:');
|
|
395
|
-
});
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
// ──────────────────────────────────────────────────────────────────
|
|
399
|
-
// prompt-dispatcher vibe.run 감지 (sanity — ledger 파일 생성 확인)
|
|
400
|
-
// ──────────────────────────────────────────────────────────────────
|
|
401
|
-
describe('prompt-dispatcher: vibe.run 감지 → ledger 파일 생성', () => {
|
|
402
|
-
const DISPATCHER = path.resolve(__dirname, '..', 'prompt-dispatcher.js');
|
|
403
|
-
|
|
404
|
-
it('/vibe.run 프롬프트 → run-ledger.json 생성', () => {
|
|
405
|
-
const payload = JSON.stringify({ prompt: '/vibe.run test-feature' });
|
|
406
|
-
const result = spawnSync('node', [DISPATCHER], {
|
|
407
|
-
input: payload,
|
|
408
|
-
encoding: 'utf-8',
|
|
409
|
-
timeout: 10000,
|
|
410
|
-
env: {
|
|
411
|
-
...process.env,
|
|
412
|
-
CLAUDE_PROJECT_DIR: tmpDir,
|
|
413
|
-
VIBE_HOOK_DEPTH: undefined,
|
|
414
|
-
// 자식 프로세스 타임아웃 내 완료
|
|
415
|
-
},
|
|
416
|
-
});
|
|
417
|
-
expect(result.status).toBe(0);
|
|
418
|
-
const ledgerFile = path.join(tmpDir, '.vibe', 'metrics', 'run-ledger.json');
|
|
419
|
-
expect(fs.existsSync(ledgerFile)).toBe(true);
|
|
420
|
-
const ledger = JSON.parse(fs.readFileSync(ledgerFile, 'utf-8'));
|
|
421
|
-
expect(ledger.runStarted).toBeDefined();
|
|
422
|
-
expect(ledger.runFeature).toBe('test-feature');
|
|
423
|
-
expect(ledger.verifyPassed).toBe(false);
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
it('일반 프롬프트 → ledger 파일 미생성', () => {
|
|
427
|
-
const payload = JSON.stringify({ prompt: 'implement the login form' });
|
|
428
|
-
spawnSync('node', [DISPATCHER], {
|
|
429
|
-
input: payload,
|
|
430
|
-
encoding: 'utf-8',
|
|
431
|
-
timeout: 10000,
|
|
432
|
-
env: { ...process.env, CLAUDE_PROJECT_DIR: tmpDir },
|
|
433
|
-
});
|
|
434
|
-
const ledgerFile = path.join(tmpDir, '.vibe', 'metrics', 'run-ledger.json');
|
|
435
|
-
expect(fs.existsSync(ledgerFile)).toBe(false);
|
|
436
|
-
});
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
// ──────────────────────────────────────────────────────────────────
|
|
440
|
-
// auto-commit 게이트 로직 (단위 수준 — 레저 상태별 gate 검증)
|
|
441
|
-
// ──────────────────────────────────────────────────────────────────
|
|
442
|
-
describe('auto-commit: verify gate 로직 (레저 상태 시뮬레이션)', () => {
|
|
443
|
-
function gatePass(ledger) {
|
|
444
|
-
if (!ledger || !ledger.runStarted) return true; // 레저 없으면 통과 (기존 동작)
|
|
445
|
-
return ledger.verifyPassed === true
|
|
446
|
-
&& ledger.verifyAt
|
|
447
|
-
&& ledger.verifyAt > ledger.runStarted;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
it('레저 없음 → 통과 (기존 동작 유지)', () => {
|
|
451
|
-
expect(gatePass(null)).toBe(true);
|
|
452
|
-
});
|
|
453
|
-
|
|
454
|
-
it('runStarted 없음 → 통과', () => {
|
|
455
|
-
expect(gatePass({ verifyPassed: false, verifyAt: null })).toBe(true);
|
|
456
|
-
});
|
|
457
|
-
|
|
458
|
-
it('verifyPassed=false → 차단', () => {
|
|
459
|
-
expect(gatePass({
|
|
460
|
-
runStarted: '2026-01-01T10:00:00.000Z',
|
|
461
|
-
verifyPassed: false,
|
|
462
|
-
verifyAt: null,
|
|
463
|
-
})).toBe(false);
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
it('verifyPassed=true + verifyAt > runStarted → 통과', () => {
|
|
467
|
-
expect(gatePass({
|
|
468
|
-
runStarted: '2026-01-01T10:00:00.000Z',
|
|
469
|
-
verifyPassed: true,
|
|
470
|
-
verifyAt: '2026-01-01T10:05:00.000Z',
|
|
471
|
-
})).toBe(true);
|
|
472
|
-
});
|
|
473
|
-
|
|
474
|
-
it('verifyPassed=true 이지만 verifyAt < runStarted → 차단', () => {
|
|
475
|
-
expect(gatePass({
|
|
476
|
-
runStarted: '2026-01-01T10:05:00.000Z',
|
|
477
|
-
verifyPassed: true,
|
|
478
|
-
verifyAt: '2026-01-01T10:00:00.000Z',
|
|
479
|
-
})).toBe(false);
|
|
480
|
-
});
|
|
481
|
-
});
|