onto-mcp 0.3.0
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/.onto/authority/core-lens-registry.yaml +134 -0
- package/.onto/authority/core-lexicon.yaml +1562 -0
- package/.onto/authority/diagnostic-codes.yaml +94 -0
- package/.onto/domains/accounting/competency_qs.md +384 -0
- package/.onto/domains/accounting/concepts.md +186 -0
- package/.onto/domains/accounting/conciseness_rules.md +160 -0
- package/.onto/domains/accounting/dependency_rules.md +239 -0
- package/.onto/domains/accounting/domain_scope.md +213 -0
- package/.onto/domains/accounting/extension_cases.md +416 -0
- package/.onto/domains/accounting/logic_rules.md +226 -0
- package/.onto/domains/accounting/structure_spec.md +298 -0
- package/.onto/domains/accounting-kr/competency_qs.md +562 -0
- package/.onto/domains/accounting-kr/concepts.md +187 -0
- package/.onto/domains/accounting-kr/conciseness_rules.md +125 -0
- package/.onto/domains/accounting-kr/dependency_rules.md +93 -0
- package/.onto/domains/accounting-kr/domain_scope.md +140 -0
- package/.onto/domains/accounting-kr/extension_cases.md +343 -0
- package/.onto/domains/accounting-kr/logic_rules.md +160 -0
- package/.onto/domains/accounting-kr/structure_spec.md +85 -0
- package/.onto/domains/business/competency_qs.md +263 -0
- package/.onto/domains/business/concepts.md +200 -0
- package/.onto/domains/business/conciseness_rules.md +135 -0
- package/.onto/domains/business/dependency_rules.md +113 -0
- package/.onto/domains/business/domain_scope.md +240 -0
- package/.onto/domains/business/extension_cases.md +249 -0
- package/.onto/domains/business/logic_rules.md +134 -0
- package/.onto/domains/business/structure_spec.md +114 -0
- package/.onto/domains/finance/competency_qs.md +362 -0
- package/.onto/domains/finance/concepts.md +194 -0
- package/.onto/domains/finance/conciseness_rules.md +155 -0
- package/.onto/domains/finance/dependency_rules.md +171 -0
- package/.onto/domains/finance/domain_scope.md +215 -0
- package/.onto/domains/finance/extension_cases.md +350 -0
- package/.onto/domains/finance/logic_rules.md +191 -0
- package/.onto/domains/finance/structure_spec.md +182 -0
- package/.onto/domains/llm-native-development/competency_qs.md +430 -0
- package/.onto/domains/llm-native-development/concepts.md +242 -0
- package/.onto/domains/llm-native-development/conciseness_rules.md +163 -0
- package/.onto/domains/llm-native-development/dependency_rules.md +216 -0
- package/.onto/domains/llm-native-development/domain_scope.md +197 -0
- package/.onto/domains/llm-native-development/extension_cases.md +474 -0
- package/.onto/domains/llm-native-development/logic_rules.md +123 -0
- package/.onto/domains/llm-native-development/prompt_interface.md +49 -0
- package/.onto/domains/llm-native-development/structure_spec.md +245 -0
- package/.onto/domains/market-intelligence/competency_qs.md +274 -0
- package/.onto/domains/market-intelligence/concepts.md +233 -0
- package/.onto/domains/market-intelligence/conciseness_rules.md +165 -0
- package/.onto/domains/market-intelligence/dependency_rules.md +197 -0
- package/.onto/domains/market-intelligence/domain_scope.md +231 -0
- package/.onto/domains/market-intelligence/extension_cases.md +425 -0
- package/.onto/domains/market-intelligence/logic_rules.md +247 -0
- package/.onto/domains/market-intelligence/structure_spec.md +209 -0
- package/.onto/domains/ontology/competency_qs.md +394 -0
- package/.onto/domains/ontology/concepts.md +172 -0
- package/.onto/domains/ontology/conciseness_rules.md +134 -0
- package/.onto/domains/ontology/dependency_rules.md +125 -0
- package/.onto/domains/ontology/domain_scope.md +114 -0
- package/.onto/domains/ontology/extension_cases.md +501 -0
- package/.onto/domains/ontology/logic_rules.md +114 -0
- package/.onto/domains/ontology/problem_framing_profile.md +67 -0
- package/.onto/domains/ontology/structure_spec.md +115 -0
- package/.onto/domains/palantir-foundry/RESEARCH_NOTES.md +911 -0
- package/.onto/domains/palantir-foundry/competency_qs.md +191 -0
- package/.onto/domains/palantir-foundry/competitive_comparison.md +329 -0
- package/.onto/domains/palantir-foundry/concepts.md +197 -0
- package/.onto/domains/palantir-foundry/conciseness_rules.md +245 -0
- package/.onto/domains/palantir-foundry/dependency_rules.md +135 -0
- package/.onto/domains/palantir-foundry/domain_scope.md +395 -0
- package/.onto/domains/palantir-foundry/extension_cases.md +210 -0
- package/.onto/domains/palantir-foundry/logic_rules.md +172 -0
- package/.onto/domains/palantir-foundry/structure_spec.md +291 -0
- package/.onto/domains/software-engineering/competency_qs.md +538 -0
- package/.onto/domains/software-engineering/concepts.md +238 -0
- package/.onto/domains/software-engineering/conciseness_rules.md +167 -0
- package/.onto/domains/software-engineering/dependency_rules.md +216 -0
- package/.onto/domains/software-engineering/domain_scope.md +183 -0
- package/.onto/domains/software-engineering/extension_cases.md +551 -0
- package/.onto/domains/software-engineering/logic_rules.md +240 -0
- package/.onto/domains/software-engineering/problem_framing_profile.md +68 -0
- package/.onto/domains/software-engineering/structure_spec.md +185 -0
- package/.onto/domains/ui-design/competency_qs.md +567 -0
- package/.onto/domains/ui-design/concepts.md +194 -0
- package/.onto/domains/ui-design/conciseness_rules.md +190 -0
- package/.onto/domains/ui-design/dependency_rules.md +323 -0
- package/.onto/domains/ui-design/domain_scope.md +340 -0
- package/.onto/domains/ui-design/extension_cases.md +563 -0
- package/.onto/domains/ui-design/logic_rules.md +349 -0
- package/.onto/domains/ui-design/structure_spec.md +252 -0
- package/.onto/domains/visual-design/competency_qs.md +472 -0
- package/.onto/domains/visual-design/concepts.md +147 -0
- package/.onto/domains/visual-design/conciseness_rules.md +186 -0
- package/.onto/domains/visual-design/dependency_rules.md +282 -0
- package/.onto/domains/visual-design/domain_scope.md +290 -0
- package/.onto/domains/visual-design/extension_cases.md +480 -0
- package/.onto/domains/visual-design/logic_rules.md +232 -0
- package/.onto/domains/visual-design/structure_spec.md +213 -0
- package/.onto/principles/llm-native-development-guideline.md +401 -0
- package/.onto/principles/llm-runtime-interface-principles.md +665 -0
- package/.onto/principles/non-specialist-communication-guideline.md +74 -0
- package/.onto/principles/ontology-as-code-guideline.md +243 -0
- package/.onto/principles/ontology-as-code-naming-charter.md +130 -0
- package/.onto/principles/product-locality-principle.md +129 -0
- package/.onto/principles/productization-charter.md +569 -0
- package/.onto/processes/evolve/material-kind-adapter-contract.md +113 -0
- package/.onto/processes/reconstruct/reconstruct-boundary-contract.md +366 -0
- package/.onto/processes/reconstruct/source-profile-contract.md +107 -0
- package/.onto/processes/reconstruct/source-profiles/code.md +72 -0
- package/.onto/processes/reconstruct/source-profiles/database.md +74 -0
- package/.onto/processes/reconstruct/source-profiles/document.md +71 -0
- package/.onto/processes/reconstruct/source-profiles/spreadsheet.md +79 -0
- package/.onto/processes/review/binding-contract.md +270 -0
- package/.onto/processes/review/execution-preparation-artifacts.md +281 -0
- package/.onto/processes/review/interpretation-contract.md +245 -0
- package/.onto/processes/review/issue-stance-deliberation-contract.md +761 -0
- package/.onto/processes/review/lens-prompt-contract.md +402 -0
- package/.onto/processes/review/lens-registry.md +127 -0
- package/.onto/processes/review/pre-dispatch-contracts.md +428 -0
- package/.onto/processes/review/productized-live-path.md +398 -0
- package/.onto/processes/review/prompt-execution-runner-contract.md +187 -0
- package/.onto/processes/review/record-contract.md +427 -0
- package/.onto/processes/review/record-field-mapping.md +337 -0
- package/.onto/processes/review/review-context-manifest-contract.md +356 -0
- package/.onto/processes/review/review-execution-ux-contract.md +809 -0
- package/.onto/processes/review/review-target-profile-contract.md +259 -0
- package/.onto/processes/review/shared-phenomenon-contract.md +129 -0
- package/.onto/processes/review/synthesize-prompt-contract.md +343 -0
- package/.onto/processes/shared/target-material-kind-contract.md +198 -0
- package/.onto/roles/axiology.md +81 -0
- package/.onto/roles/conciseness.md +36 -0
- package/.onto/roles/coverage.md +34 -0
- package/.onto/roles/dependency.md +37 -0
- package/.onto/roles/evolution.md +35 -0
- package/.onto/roles/logic.md +104 -0
- package/.onto/roles/pragmatics.md +32 -0
- package/.onto/roles/semantics.md +36 -0
- package/.onto/roles/structure.md +33 -0
- package/.onto/roles/synthesize.md +92 -0
- package/AGENTS.md +240 -0
- package/CLAUDE.md +39 -0
- package/README.md +287 -0
- package/bin/onto +92 -0
- package/dist/cli.js +101 -0
- package/dist/core-api/reconstruct-api.js +222 -0
- package/dist/core-api/review-api.js +1271 -0
- package/dist/core-runtime/cli/assemble-review-record.js +431 -0
- package/dist/core-runtime/cli/bootstrap-review-binding.js +186 -0
- package/dist/core-runtime/cli/codex-nested-dispatch.js +226 -0
- package/dist/core-runtime/cli/codex-nested-dispatch.test.js +390 -0
- package/dist/core-runtime/cli/codex-nested-teamlead-executor.js +464 -0
- package/dist/core-runtime/cli/codex-nested-teamlead-executor.test.js +335 -0
- package/dist/core-runtime/cli/codex-review-unit-executor.js +228 -0
- package/dist/core-runtime/cli/complete-review-session.js +64 -0
- package/dist/core-runtime/cli/complexity-assessment.js +153 -0
- package/dist/core-runtime/cli/coordinator-helpers.js +583 -0
- package/dist/core-runtime/cli/coordinator-state-machine-deliberation.test.js +167 -0
- package/dist/core-runtime/cli/coordinator-state-machine.js +794 -0
- package/dist/core-runtime/cli/e2e-codex-multi-agent-fixes.test.js +615 -0
- package/dist/core-runtime/cli/e2e-start-review-session.test.js +312 -0
- package/dist/core-runtime/cli/health.js +44 -0
- package/dist/core-runtime/cli/inline-http-review-unit-executor.js +656 -0
- package/dist/core-runtime/cli/inline-http-review-unit-executor.test.js +567 -0
- package/dist/core-runtime/cli/materialize-review-execution-preparation.js +104 -0
- package/dist/core-runtime/cli/materialize-review-prompt-packets.js +952 -0
- package/dist/core-runtime/cli/migrate-session-roots.js +118 -0
- package/dist/core-runtime/cli/mock-review-unit-executor.js +285 -0
- package/dist/core-runtime/cli/onto-tools.js +369 -0
- package/dist/core-runtime/cli/prepare-review-session.js +272 -0
- package/dist/core-runtime/cli/render-review-final-output.js +350 -0
- package/dist/core-runtime/cli/repo-layout-migration-replace.smoke.test.js +106 -0
- package/dist/core-runtime/cli/review-invoke-auto-resolution.test.js +268 -0
- package/dist/core-runtime/cli/review-invoke-coordinator-topology.test.js +136 -0
- package/dist/core-runtime/cli/review-invoke-resolver-caching.test.js +201 -0
- package/dist/core-runtime/cli/review-invoke-topology-dispatch.test.js +192 -0
- package/dist/core-runtime/cli/review-invoke.js +2030 -0
- package/dist/core-runtime/cli/run-review-prompt-execution.js +2152 -0
- package/dist/core-runtime/cli/session-root-guard.js +168 -0
- package/dist/core-runtime/cli/spawn-watcher.js +173 -0
- package/dist/core-runtime/cli/spawn-watcher.test.js +457 -0
- package/dist/core-runtime/cli/start-review-session.js +68 -0
- package/dist/core-runtime/cli/strip-wrapping-code-fence.js +56 -0
- package/dist/core-runtime/cli/strip-wrapping-code-fence.test.js +79 -0
- package/dist/core-runtime/cli/teamcreate-lens-deliberation-executor.js +412 -0
- package/dist/core-runtime/cli/teamcreate-lens-deliberation-executor.test.js +351 -0
- package/dist/core-runtime/cli/topology-executor-mapping.js +139 -0
- package/dist/core-runtime/cli/topology-executor-mapping.test.js +173 -0
- package/dist/core-runtime/cli/write-review-interpretation.js +81 -0
- package/dist/core-runtime/config/onto-config-cli.js +278 -0
- package/dist/core-runtime/config/onto-config-key-path.js +288 -0
- package/dist/core-runtime/config/onto-config-key-path.test.js +195 -0
- package/dist/core-runtime/config/onto-config-preview.js +108 -0
- package/dist/core-runtime/config/onto-config-preview.test.js +132 -0
- package/dist/core-runtime/discovery/config-chain.js +118 -0
- package/dist/core-runtime/discovery/config-chain.test.js +103 -0
- package/dist/core-runtime/discovery/config-profile.js +199 -0
- package/dist/core-runtime/discovery/config-profile.test.js +233 -0
- package/dist/core-runtime/discovery/host-detection.js +33 -0
- package/dist/core-runtime/discovery/host-detection.test.js +186 -0
- package/dist/core-runtime/discovery/installation-paths.js +21 -0
- package/dist/core-runtime/discovery/installation-paths.test.js +65 -0
- package/dist/core-runtime/discovery/lens-registry.js +60 -0
- package/dist/core-runtime/discovery/lens-registry.test.js +81 -0
- package/dist/core-runtime/discovery/onto-home.js +71 -0
- package/dist/core-runtime/discovery/path-normalization.js +28 -0
- package/dist/core-runtime/discovery/path-normalization.test.js +22 -0
- package/dist/core-runtime/discovery/plugin-path.js +72 -0
- package/dist/core-runtime/discovery/plugin-path.test.js +95 -0
- package/dist/core-runtime/discovery/project-root.js +47 -0
- package/dist/core-runtime/discovery/settings-chain.js +353 -0
- package/dist/core-runtime/discovery/walk-up.js +17 -0
- package/dist/core-runtime/evolve/adapters/code-product/compile/compile-defense.js +344 -0
- package/dist/core-runtime/evolve/adapters/code-product/compile/compile-defense.test.js +915 -0
- package/dist/core-runtime/evolve/adapters/code-product/compile/compile.js +564 -0
- package/dist/core-runtime/evolve/adapters/code-product/compile/compile.test.js +708 -0
- package/dist/core-runtime/evolve/adapters/code-product/parsers/brief-parser.js +165 -0
- package/dist/core-runtime/evolve/adapters/code-product/parsers/brief-parser.test.js +227 -0
- package/dist/core-runtime/evolve/adapters/code-product/validators/validate.js +59 -0
- package/dist/core-runtime/evolve/adapters/code-product/validators/validate.test.js +205 -0
- package/dist/core-runtime/evolve/adapters/methodology/adapter.js +16 -0
- package/dist/core-runtime/evolve/adapters/methodology/adapter.test.js +9 -0
- package/dist/core-runtime/evolve/adapters/methodology/perspectives/authority-consistency.js +298 -0
- package/dist/core-runtime/evolve/adapters/methodology/perspectives/authority-consistency.test.js +70 -0
- package/dist/core-runtime/evolve/adapters/methodology/scope-types/process.js +46 -0
- package/dist/core-runtime/evolve/adapters/methodology/scope-types/process.test.js +73 -0
- package/dist/core-runtime/evolve/adapters/registry.js +47 -0
- package/dist/core-runtime/evolve/adapters/registry.test.js +67 -0
- package/dist/core-runtime/evolve/cli.js +256 -0
- package/dist/core-runtime/evolve/commands/align.js +194 -0
- package/dist/core-runtime/evolve/commands/align.test.js +82 -0
- package/dist/core-runtime/evolve/commands/apply.js +161 -0
- package/dist/core-runtime/evolve/commands/apply.test.js +138 -0
- package/dist/core-runtime/evolve/commands/close.js +39 -0
- package/dist/core-runtime/evolve/commands/close.test.js +99 -0
- package/dist/core-runtime/evolve/commands/defer.js +40 -0
- package/dist/core-runtime/evolve/commands/defer.test.js +134 -0
- package/dist/core-runtime/evolve/commands/draft.js +323 -0
- package/dist/core-runtime/evolve/commands/draft.test.js +178 -0
- package/dist/core-runtime/evolve/commands/e2e-evolve-full-cycle.test.js +208 -0
- package/dist/core-runtime/evolve/commands/error-messages.js +125 -0
- package/dist/core-runtime/evolve/commands/error-messages.test.js +167 -0
- package/dist/core-runtime/evolve/commands/propose-align.js +222 -0
- package/dist/core-runtime/evolve/commands/propose-align.test.js +136 -0
- package/dist/core-runtime/evolve/commands/reconstruct.js +330 -0
- package/dist/core-runtime/evolve/commands/reconstruct.test.js +278 -0
- package/dist/core-runtime/evolve/commands/shared.js +22 -0
- package/dist/core-runtime/evolve/commands/stale-check.js +103 -0
- package/dist/core-runtime/evolve/commands/stale-check.test.js +84 -0
- package/dist/core-runtime/evolve/commands/start.js +887 -0
- package/dist/core-runtime/evolve/commands/start.test.js +396 -0
- package/dist/core-runtime/evolve/config/project-config.js +99 -0
- package/dist/core-runtime/evolve/config/project-config.test.js +170 -0
- package/dist/core-runtime/evolve/renderers/align-packet.js +280 -0
- package/dist/core-runtime/evolve/renderers/align-packet.test.js +332 -0
- package/dist/core-runtime/evolve/renderers/draft-packet.js +303 -0
- package/dist/core-runtime/evolve/renderers/draft-packet.test.js +377 -0
- package/dist/core-runtime/evolve/renderers/format.js +5 -0
- package/dist/core-runtime/evolve/renderers/scope-md.js +237 -0
- package/dist/core-runtime/evolve/renderers/scope-md.test.js +306 -0
- package/dist/core-runtime/govern/cli.js +369 -0
- package/dist/core-runtime/govern/cli.test.js +314 -0
- package/dist/core-runtime/govern/drift-engine.js +103 -0
- package/dist/core-runtime/govern/drift-engine.test.js +319 -0
- package/dist/core-runtime/govern/promote-principle.js +206 -0
- package/dist/core-runtime/govern/promote-principle.test.js +368 -0
- package/dist/core-runtime/govern/queue.js +81 -0
- package/dist/core-runtime/govern/types.js +16 -0
- package/dist/core-runtime/install/cli.js +530 -0
- package/dist/core-runtime/install/detect.js +128 -0
- package/dist/core-runtime/install/detect.test.js +155 -0
- package/dist/core-runtime/install/gitignore-update.js +74 -0
- package/dist/core-runtime/install/gitignore-update.test.js +64 -0
- package/dist/core-runtime/install/install-integration.test.js +373 -0
- package/dist/core-runtime/install/prompts.js +389 -0
- package/dist/core-runtime/install/prompts.test.js +293 -0
- package/dist/core-runtime/install/types.js +26 -0
- package/dist/core-runtime/install/validation.js +295 -0
- package/dist/core-runtime/install/validation.test.js +313 -0
- package/dist/core-runtime/install/writer.js +254 -0
- package/dist/core-runtime/install/writer.test.js +218 -0
- package/dist/core-runtime/learning/extractor.js +461 -0
- package/dist/core-runtime/learning/feedback.js +179 -0
- package/dist/core-runtime/learning/health-report.js +165 -0
- package/dist/core-runtime/learning/health-report.test.js +169 -0
- package/dist/core-runtime/learning/loader.js +388 -0
- package/dist/core-runtime/learning/loader.test.js +102 -0
- package/dist/core-runtime/learning/promote/apply-state.js +240 -0
- package/dist/core-runtime/learning/promote/audit-obligation.js +195 -0
- package/dist/core-runtime/learning/promote/collector.js +432 -0
- package/dist/core-runtime/learning/promote/degraded-state.js +125 -0
- package/dist/core-runtime/learning/promote/domain-doc-proposer.js +166 -0
- package/dist/core-runtime/learning/promote/e2e-promote.test.js +6385 -0
- package/dist/core-runtime/learning/promote/health-snapshot.js +150 -0
- package/dist/core-runtime/learning/promote/insight-reclassifier.js +544 -0
- package/dist/core-runtime/learning/promote/judgment-auditor.js +517 -0
- package/dist/core-runtime/learning/promote/panel-reviewer.js +1158 -0
- package/dist/core-runtime/learning/promote/promote-executor.js +1675 -0
- package/dist/core-runtime/learning/promote/promoter.js +307 -0
- package/dist/core-runtime/learning/promote/retirement.js +122 -0
- package/dist/core-runtime/learning/promote/types.js +23 -0
- package/dist/core-runtime/learning/prompt-sections.js +51 -0
- package/dist/core-runtime/learning/shared/artifact-registry-init.js +45 -0
- package/dist/core-runtime/learning/shared/artifact-registry.js +254 -0
- package/dist/core-runtime/learning/shared/audit-obligation-kernel.js +73 -0
- package/dist/core-runtime/learning/shared/audit-state.js +99 -0
- package/dist/core-runtime/learning/shared/duplicate-check.js +28 -0
- package/dist/core-runtime/learning/shared/llm-caller.js +831 -0
- package/dist/core-runtime/learning/shared/llm-caller.test.js +601 -0
- package/dist/core-runtime/learning/shared/llm-tool-loop.js +393 -0
- package/dist/core-runtime/learning/shared/mode.js +25 -0
- package/dist/core-runtime/learning/shared/paths.js +84 -0
- package/dist/core-runtime/learning/shared/paths.test.js +79 -0
- package/dist/core-runtime/learning/shared/patterns.js +37 -0
- package/dist/core-runtime/learning/shared/recoverability.js +355 -0
- package/dist/core-runtime/learning/shared/recovery-context.js +374 -0
- package/dist/core-runtime/learning/shared/scope.js +1 -0
- package/dist/core-runtime/learning/shared/semantic-classifier.js +94 -0
- package/dist/core-runtime/learning/shared/specs/apply-execution-state-spec.js +42 -0
- package/dist/core-runtime/learning/shared/specs/audit-state-spec.js +37 -0
- package/dist/core-runtime/learning/shared/specs/backup-metadata-spec.js +39 -0
- package/dist/core-runtime/learning/shared/specs/emergency-log-spec.js +41 -0
- package/dist/core-runtime/learning/shared/specs/layout-version-spec.js +38 -0
- package/dist/core-runtime/learning/shared/specs/promote-decisions-spec.js +43 -0
- package/dist/core-runtime/learning/shared/specs/promote-report-spec.js +113 -0
- package/dist/core-runtime/learning/shared/specs/prune-log-spec.js +36 -0
- package/dist/core-runtime/learning/shared/specs/recovery-resolution-spec.js +48 -0
- package/dist/core-runtime/learning/shared/specs/restore-manifest-spec.js +43 -0
- package/dist/core-runtime/learning/shared/specs/spec-helpers.js +64 -0
- package/dist/core-runtime/learning/usage-tracker.js +190 -0
- package/dist/core-runtime/learning/usage-tracker.test.js +176 -0
- package/dist/core-runtime/llm/llm-caller.js +649 -0
- package/dist/core-runtime/llm/llm-tool-loop.js +401 -0
- package/dist/core-runtime/llm/model-switcher.js +62 -0
- package/dist/core-runtime/logger.js +22 -0
- package/dist/core-runtime/onboard/detect-review-axes.js +122 -0
- package/dist/core-runtime/onboard/detect-review-axes.test.js +127 -0
- package/dist/core-runtime/onboard/write-review-block.js +188 -0
- package/dist/core-runtime/onboard/write-review-block.test.js +240 -0
- package/dist/core-runtime/readers/brownfield-builder.js +150 -0
- package/dist/core-runtime/readers/brownfield-builder.test.js +136 -0
- package/dist/core-runtime/readers/code-chunk-collector.js +53 -0
- package/dist/core-runtime/readers/code-chunk-collector.test.js +136 -0
- package/dist/core-runtime/readers/file-utils.js +240 -0
- package/dist/core-runtime/readers/file-utils.test.js +146 -0
- package/dist/core-runtime/readers/lexicon-citation-check.js +93 -0
- package/dist/core-runtime/readers/lexicon-citation-check.test.js +77 -0
- package/dist/core-runtime/readers/mcp-figma.js +30 -0
- package/dist/core-runtime/readers/mcp-figma.test.js +82 -0
- package/dist/core-runtime/readers/mcp-generic.js +31 -0
- package/dist/core-runtime/readers/mcp-generic.test.js +76 -0
- package/dist/core-runtime/readers/ontology-index.js +148 -0
- package/dist/core-runtime/readers/ontology-index.test.js +245 -0
- package/dist/core-runtime/readers/ontology-query.js +168 -0
- package/dist/core-runtime/readers/ontology-query.test.js +311 -0
- package/dist/core-runtime/readers/ontology-resolve.js +48 -0
- package/dist/core-runtime/readers/ontology-resolve.test.js +48 -0
- package/dist/core-runtime/readers/patterns/index.js +7 -0
- package/dist/core-runtime/readers/review-log.js +213 -0
- package/dist/core-runtime/readers/review-log.test.js +313 -0
- package/dist/core-runtime/readers/scan-local.js +102 -0
- package/dist/core-runtime/readers/scan-local.test.js +102 -0
- package/dist/core-runtime/readers/scan-tarball.js +121 -0
- package/dist/core-runtime/readers/scan-tarball.test.js +283 -0
- package/dist/core-runtime/readers/scan-vault.js +34 -0
- package/dist/core-runtime/readers/scan-vault.test.js +81 -0
- package/dist/core-runtime/readers/types.js +42 -0
- package/dist/core-runtime/readers/types.test.js +94 -0
- package/dist/core-runtime/readers/viewpoint-collectors.js +229 -0
- package/dist/core-runtime/reconstruct/artifact-types.js +1 -0
- package/dist/core-runtime/reconstruct/directive-validation.js +123 -0
- package/dist/core-runtime/reconstruct/materialize-preparation.js +251 -0
- package/dist/core-runtime/reconstruct/record.js +198 -0
- package/dist/core-runtime/reconstruct/run.js +578 -0
- package/dist/core-runtime/reconstruct/seed-candidate-validation.js +356 -0
- package/dist/core-runtime/reconstruct/source-observations.js +62 -0
- package/dist/core-runtime/reconstruct/source-profiles.js +73 -0
- package/dist/core-runtime/release-channel/release-channel.js +90 -0
- package/dist/core-runtime/review/artifact-types.js +13 -0
- package/dist/core-runtime/review/citation-audit.js +204 -0
- package/dist/core-runtime/review/citation-audit.test.js +165 -0
- package/dist/core-runtime/review/controlled-lens-deliberation.js +125 -0
- package/dist/core-runtime/review/execution-plan-resolver.js +247 -0
- package/dist/core-runtime/review/execution-plan-resolver.test.js +243 -0
- package/dist/core-runtime/review/execution-topology-resolver-axis-first.test.js +246 -0
- package/dist/core-runtime/review/execution-topology-resolver.js +401 -0
- package/dist/core-runtime/review/execution-topology-resolver.test.js +315 -0
- package/dist/core-runtime/review/failure-records.js +57 -0
- package/dist/core-runtime/review/inline-context-embedder.js +141 -0
- package/dist/core-runtime/review/inline-context-embedder.test.js +154 -0
- package/dist/core-runtime/review/issue-artifact-runtime.js +859 -0
- package/dist/core-runtime/review/legacy-mode-policy.js +88 -0
- package/dist/core-runtime/review/lens-completion-policy.js +17 -0
- package/dist/core-runtime/review/materializers-effort-persist.test.js +79 -0
- package/dist/core-runtime/review/materializers.js +963 -0
- package/dist/core-runtime/review/ontology-path-classifier.js +179 -0
- package/dist/core-runtime/review/ontology-path-classifier.test.js +216 -0
- package/dist/core-runtime/review/packet-boundary-policy.js +215 -0
- package/dist/core-runtime/review/packet-boundary-policy.test.js +107 -0
- package/dist/core-runtime/review/participating-lens-paths.js +61 -0
- package/dist/core-runtime/review/participating-lens-paths.test.js +73 -0
- package/dist/core-runtime/review/review-artifact-utils.js +287 -0
- package/dist/core-runtime/review/review-config-legacy-translate.js +244 -0
- package/dist/core-runtime/review/review-config-legacy-translate.test.js +161 -0
- package/dist/core-runtime/review/review-config-validator.js +289 -0
- package/dist/core-runtime/review/review-config-validator.test.js +236 -0
- package/dist/core-runtime/review/review-execution-profile.js +193 -0
- package/dist/core-runtime/review/review-execution-route.js +52 -0
- package/dist/core-runtime/review/review-progress-contract.js +123 -0
- package/dist/core-runtime/review/review-record-validation.js +251 -0
- package/dist/core-runtime/review/review-result-classification.js +379 -0
- package/dist/core-runtime/review/review-state-machine.js +39 -0
- package/dist/core-runtime/review/route-visibility.js +125 -0
- package/dist/core-runtime/review/shape-pipeline-audit.test.js +311 -0
- package/dist/core-runtime/review/shape-to-topology-id.js +117 -0
- package/dist/core-runtime/review/shape-to-topology-id.test.js +132 -0
- package/dist/core-runtime/review/topology-shape-derivation.js +155 -0
- package/dist/core-runtime/review/topology-shape-derivation.test.js +195 -0
- package/dist/core-runtime/scope-runtime/constants.js +12 -0
- package/dist/core-runtime/scope-runtime/constraint-pool.js +166 -0
- package/dist/core-runtime/scope-runtime/constraint-pool.test.js +674 -0
- package/dist/core-runtime/scope-runtime/domain-validation-log.js +135 -0
- package/dist/core-runtime/scope-runtime/domain-validation-log.test.js +156 -0
- package/dist/core-runtime/scope-runtime/eval-persistence.js +65 -0
- package/dist/core-runtime/scope-runtime/eval-persistence.test.js +84 -0
- package/dist/core-runtime/scope-runtime/event-pipeline.js +64 -0
- package/dist/core-runtime/scope-runtime/event-pipeline.test.js +450 -0
- package/dist/core-runtime/scope-runtime/event-store.js +39 -0
- package/dist/core-runtime/scope-runtime/event-store.test.js +95 -0
- package/dist/core-runtime/scope-runtime/gate-guard.js +348 -0
- package/dist/core-runtime/scope-runtime/gate-guard.test.js +1047 -0
- package/dist/core-runtime/scope-runtime/hash.js +4 -0
- package/dist/core-runtime/scope-runtime/hash.test.js +33 -0
- package/dist/core-runtime/scope-runtime/id.js +4 -0
- package/dist/core-runtime/scope-runtime/id.test.js +17 -0
- package/dist/core-runtime/scope-runtime/reducer.js +297 -0
- package/dist/core-runtime/scope-runtime/reducer.test.js +759 -0
- package/dist/core-runtime/scope-runtime/scope-manager.js +161 -0
- package/dist/core-runtime/scope-runtime/state-machine.js +309 -0
- package/dist/core-runtime/scope-runtime/state-machine.test.js +704 -0
- package/dist/core-runtime/scope-runtime/types.js +116 -0
- package/dist/core-runtime/scope-runtime/types.test.js +69 -0
- package/dist/core-runtime/target-material-kind.js +256 -0
- package/dist/core-runtime/translate/render-for-user.js +169 -0
- package/dist/core-runtime/translate/render-for-user.test.js +122 -0
- package/dist/mcp/server.js +1011 -0
- package/dist/mcp/tool-schemas.js +93 -0
- package/dist/providers/capability-contract.js +1 -0
- package/package.json +68 -0
- package/settings.example.json +33 -0
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { resolve } from "node:path";
|
|
4
|
+
import { renderDraftPacket } from "./draft-packet.js";
|
|
5
|
+
import { reduce } from "../../scope-runtime/reducer.js";
|
|
6
|
+
// ─── Helpers ───
|
|
7
|
+
function emptyPool() {
|
|
8
|
+
return { constraints: [], summary: { total: 0, required: 0, recommended: 0, decided: 0, clarify_pending: 0, invalidated: 0, undecided: 0 } };
|
|
9
|
+
}
|
|
10
|
+
function makeEntry(id, overrides = {}) {
|
|
11
|
+
return {
|
|
12
|
+
constraint_id: id, perspective: "code", summary: `summary ${id}`,
|
|
13
|
+
severity: "recommended", discovery_stage: "draft_phase2", decision_owner: "product_owner",
|
|
14
|
+
impact_if_ignored: `impact ${id}`, source_refs: [{ source: "t.ts", detail: "d" }],
|
|
15
|
+
evidence_status: "unverified",
|
|
16
|
+
status: "undecided", discovered_at: 1, ...overrides,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function makePoolWith(...entries) {
|
|
20
|
+
let req = 0, rec = 0, inv = 0;
|
|
21
|
+
for (const e of entries) {
|
|
22
|
+
if (e.severity === "required")
|
|
23
|
+
req++;
|
|
24
|
+
else
|
|
25
|
+
rec++;
|
|
26
|
+
if (e.status === "invalidated")
|
|
27
|
+
inv++;
|
|
28
|
+
}
|
|
29
|
+
return { constraints: entries, summary: { total: entries.length, required: req, recommended: rec, decided: 0, clarify_pending: 0, invalidated: inv, undecided: entries.length - inv } };
|
|
30
|
+
}
|
|
31
|
+
function makeState(overrides = {}) {
|
|
32
|
+
return {
|
|
33
|
+
scope_id: "SC-TEST", title: "테스트", description: "d", entry_mode: "experience",
|
|
34
|
+
current_state: "surface_confirmed", constraint_pool: emptyPool(),
|
|
35
|
+
stale: false, compile_ready: false, convergence_blocked: false,
|
|
36
|
+
revision_count_align: 0, revision_count_surface: 0, retry_count_compile: 0,
|
|
37
|
+
snapshot_revision: 0, pre_apply_completed: false, prd_review_completed: false,
|
|
38
|
+
verdict_log: [], feedback_history: [], latest_revision: 0, ...overrides,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function makeContent(overrides = {}) {
|
|
42
|
+
return {
|
|
43
|
+
surface_path: "surface/preview/", scenario_guide: [],
|
|
44
|
+
constraint_details: [], guardrails: [], decision_questions: [], ...overrides,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function poDet(id) {
|
|
48
|
+
return {
|
|
49
|
+
constraint_id: id, decision_owner: "product_owner", situation: `situation ${id}`,
|
|
50
|
+
options_table: [{ choice: "inject", pros: "빠른 적용", description: "desc", risk: "low", reversal_cost: "낮음" }],
|
|
51
|
+
recommendation: "inject 추천",
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function builderDet(id) {
|
|
55
|
+
return {
|
|
56
|
+
constraint_id: id, decision_owner: "builder", situation: `situation ${id}`,
|
|
57
|
+
builder_decision: "DB 테이블 생성", builder_judgment: "필수. 되돌림 비용 낮음",
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
// ─── Golden data ───
|
|
61
|
+
describe("draft-packet — golden data structure", () => {
|
|
62
|
+
it("renders Draft Packet matching golden structure", () => {
|
|
63
|
+
const goldenPath = resolve(import.meta.dirname, "../../scope-runtime/__fixtures__/example-tutor-block/events.ndjson");
|
|
64
|
+
const events = readFileSync(goldenPath, "utf-8").trimEnd().split("\n").map((l) => JSON.parse(l));
|
|
65
|
+
// State at surface_confirmed + all constraints discovered (first 18 events)
|
|
66
|
+
const state = reduce(events.slice(0, 18));
|
|
67
|
+
const content = {
|
|
68
|
+
surface_path: "scopes/SC-2026-001/surface/preview/",
|
|
69
|
+
run_command: "cd surface/preview && npm run dev",
|
|
70
|
+
mockup_revisions: 3,
|
|
71
|
+
scenario_guide: [
|
|
72
|
+
{ scenario: "차단 생성", start: "튜터 프로필", steps: "차단 버튼 → 확인", confirmed: "성공 메시지" },
|
|
73
|
+
{ scenario: "차단 해제", start: "설정 → 차단 관리", steps: "해제 버튼 → 확인", confirmed: "목록에서 제거" },
|
|
74
|
+
],
|
|
75
|
+
constraint_details: [
|
|
76
|
+
{ constraint_id: "CST-001", decision_owner: "product_owner", situation: "매칭 시스템에 제외 기능 없음", options_table: [{ choice: "inject (제외 기능 추가)", pros: "완전한 차단", description: "매칭 시스템에 제외 기능 추가", risk: "가장 큰 변경", reversal_cost: "낮음" }], recommendation: "inject" },
|
|
77
|
+
{ constraint_id: "CST-005", decision_owner: "builder", situation: "차단 정보 저장 공간 없음", builder_decision: "DB 테이블 신규 생성", builder_judgment: "필수. 되돌림 비용 낮음" },
|
|
78
|
+
{ constraint_id: "CST-008", decision_owner: "product_owner", situation: "차단 남용 방지 한도 없음", options_table: [{ choice: "inject (언어별 5명)", pros: "남용 방지", description: "언어별 5명 제한", risk: "한도 낮음 불만", reversal_cost: "낮음" }], recommendation: "inject (언어별 5명)" },
|
|
79
|
+
{ constraint_id: "CST-002", decision_owner: "product_owner", situation: "이용약관 충돌", options_table: [{ choice: "inject (예외 조항)", pros: "법적 안정", description: "약관 예외 추가", risk: "법무 비용", reversal_cost: "중간" }], recommendation: "clarify" },
|
|
80
|
+
{ constraint_id: "CST-003", decision_owner: "product_owner", situation: "버튼 공간 부족", options_table: [{ choice: "inject (간격 확보)", pros: "UX 개선", description: "레이아웃 재배치", risk: "사용자 혼동", reversal_cost: "낮음" }], recommendation: "inject" },
|
|
81
|
+
{ constraint_id: "CST-004", decision_owner: "product_owner", situation: "차단 관리 메뉴 위치", options_table: [{ choice: "defer (현재 유지)", pros: "변경 없음", description: "4번째 항목 유지", risk: "찾기 어려움", reversal_cost: "낮음" }], recommendation: "defer" },
|
|
82
|
+
{ constraint_id: "CST-006", decision_owner: "builder", situation: "API 응답 변경 위험", builder_decision: "optional 필드 방식", builder_judgment: "호환성 유지. 비용 적음", guardrail: "기존 API 응답 형식을 깨지 않는다" },
|
|
83
|
+
{ constraint_id: "CST-007", decision_owner: "product_owner", situation: "개인정보 삭제 의무", options_table: [{ choice: "inject (자동 삭제)", pros: "규정 준수", description: "3년 후 삭제", risk: "차단 자연 해제", reversal_cost: "낮음" }], recommendation: "inject" },
|
|
84
|
+
],
|
|
85
|
+
guardrails: [
|
|
86
|
+
"기존 예약된 수업은 취소하지 않는다",
|
|
87
|
+
"차단 행위는 중복 요청 시 오류 없이 기존 상태를 유지한다",
|
|
88
|
+
"튜터에게 차단 사실을 알리지 않는다",
|
|
89
|
+
"기존 API 응답 형식을 깨지 않는다",
|
|
90
|
+
],
|
|
91
|
+
decision_questions: [
|
|
92
|
+
"위 8건에 대해 각각 선택해 주세요",
|
|
93
|
+
"clarify를 선택한 항목은 해소될 때까지 잠글 수 없습니다",
|
|
94
|
+
"모든 결정이 완료되면 compile을 시작합니다",
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
const md = renderDraftPacket(state, content);
|
|
98
|
+
// Section existence
|
|
99
|
+
expect(md).toContain("### 1. 확정된 Surface");
|
|
100
|
+
expect(md).toContain("### 2. 현재까지의 결정 현황");
|
|
101
|
+
expect(md).toContain("### 3. 결정이 필요한 항목");
|
|
102
|
+
expect(md).toContain("### 5. 제약 조건");
|
|
103
|
+
expect(md).toContain("### 6. 지금 결정할 것");
|
|
104
|
+
// CST tracking + severity
|
|
105
|
+
expect(md).toContain("CST-001");
|
|
106
|
+
expect(md).toContain("CST-008");
|
|
107
|
+
expect(md).toContain("필수");
|
|
108
|
+
expect(md).toContain("권장");
|
|
109
|
+
expect(md).toContain("(Builder 결정)");
|
|
110
|
+
// Impact from pool
|
|
111
|
+
expect(md).toContain("차단 버튼을 눌러도 실제 매칭에 반영되지 않습니다");
|
|
112
|
+
// Scenario table
|
|
113
|
+
expect(md).toContain("| 시나리오 | 시작 | 동작 순서 | 확인된 동작 |");
|
|
114
|
+
// Builder format
|
|
115
|
+
expect(md).toContain("Builder 결정 예정");
|
|
116
|
+
expect(md).toContain("guardrail 확인 후 승인");
|
|
117
|
+
// Decision choices
|
|
118
|
+
expect(md).toContain("**Approve**");
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
// ─── Section 2: auto-generated ───
|
|
122
|
+
describe("draft-packet — Section 2 auto status", () => {
|
|
123
|
+
it("shows Align decisions from state", () => {
|
|
124
|
+
const state = makeState({ direction: "test direction", scope_boundaries: { in: ["A"], out: ["B"] } });
|
|
125
|
+
const md = renderDraftPacket(state, makeContent());
|
|
126
|
+
expect(md).toContain("방향 승인");
|
|
127
|
+
expect(md).toContain("범위 확정");
|
|
128
|
+
});
|
|
129
|
+
it("shows grounding CST IDs", () => {
|
|
130
|
+
const entries = [makeEntry("CST-001", { discovery_stage: "grounding" }), makeEntry("CST-002", { discovery_stage: "draft_phase2" })];
|
|
131
|
+
const state = makeState({ constraint_pool: makePoolWith(...entries) });
|
|
132
|
+
const md = renderDraftPacket(state, makeContent());
|
|
133
|
+
expect(md).toContain("CST-001 인지 완료");
|
|
134
|
+
expect(md).not.toContain("CST-002 인지 완료");
|
|
135
|
+
});
|
|
136
|
+
it("shows clarify lock warning", () => {
|
|
137
|
+
const pool = emptyPool();
|
|
138
|
+
pool.summary.clarify_pending = 2;
|
|
139
|
+
pool.summary.total = 5;
|
|
140
|
+
const md = renderDraftPacket(makeState({ constraint_pool: pool }), makeContent());
|
|
141
|
+
expect(md).toContain("2건");
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
// ─── Section 3: sorting ───
|
|
145
|
+
describe("draft-packet — Section 3 sorting", () => {
|
|
146
|
+
it("sorts required before recommended", () => {
|
|
147
|
+
const e1 = makeEntry("CST-002", { severity: "recommended" });
|
|
148
|
+
const e2 = makeEntry("CST-001", { severity: "required" });
|
|
149
|
+
const state = makeState({ constraint_pool: makePoolWith(e1, e2) });
|
|
150
|
+
const content = makeContent({ constraint_details: [poDet("CST-002"), poDet("CST-001")] });
|
|
151
|
+
const md = renderDraftPacket(state, content);
|
|
152
|
+
const idx001 = md.indexOf("CST-001");
|
|
153
|
+
const idx002 = md.indexOf("CST-002");
|
|
154
|
+
expect(idx001).toBeLessThan(idx002);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
// ─── Section 3: PO vs Builder ───
|
|
158
|
+
describe("draft-packet — Section 3 PO/Builder detail", () => {
|
|
159
|
+
it("renders PO detail with options table", () => {
|
|
160
|
+
const entry = makeEntry("CST-001");
|
|
161
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
162
|
+
const content = makeContent({ constraint_details: [poDet("CST-001")] });
|
|
163
|
+
const md = renderDraftPacket(state, content);
|
|
164
|
+
expect(md).toContain("| 선택 | 이점 | 내용 | 리스크 | 되돌림 비용 |");
|
|
165
|
+
expect(md).toContain("추천:");
|
|
166
|
+
expect(md).toContain("선택: ___");
|
|
167
|
+
});
|
|
168
|
+
it("renders Builder detail with builder_decision", () => {
|
|
169
|
+
const entry = makeEntry("CST-001", { decision_owner: "builder" });
|
|
170
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
171
|
+
const content = makeContent({ constraint_details: [builderDet("CST-001")] });
|
|
172
|
+
const md = renderDraftPacket(state, content);
|
|
173
|
+
expect(md).toContain("**Builder가 결정할 사항:**");
|
|
174
|
+
expect(md).toContain("Builder 결정 예정");
|
|
175
|
+
});
|
|
176
|
+
it("renders Builder without guardrail — '제품 관점 제약 조건 없음'", () => {
|
|
177
|
+
const entry = makeEntry("CST-001", { decision_owner: "builder" });
|
|
178
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
179
|
+
const md = renderDraftPacket(state, makeContent({ constraint_details: [builderDet("CST-001")] }));
|
|
180
|
+
expect(md).toContain("제품 관점 제약 조건 없음");
|
|
181
|
+
expect(md).not.toContain("위 guardrail 확인 후 승인");
|
|
182
|
+
});
|
|
183
|
+
it("renders Builder guardrail when present", () => {
|
|
184
|
+
const entry = makeEntry("CST-001", { decision_owner: "builder" });
|
|
185
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
186
|
+
const det = builderDet("CST-001");
|
|
187
|
+
det.guardrail = "API 호환성 유지";
|
|
188
|
+
const md = renderDraftPacket(state, makeContent({ constraint_details: [det] }));
|
|
189
|
+
expect(md).toContain("**guardrail:** API 호환성 유지");
|
|
190
|
+
});
|
|
191
|
+
it("uses pool impact_if_ignored for '처리하지 않으면'", () => {
|
|
192
|
+
const entry = makeEntry("CST-001", { impact_if_ignored: "big problem" });
|
|
193
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
194
|
+
const md = renderDraftPacket(state, makeContent({ constraint_details: [poDet("CST-001")] }));
|
|
195
|
+
expect(md).toContain("**처리하지 않으면:** big problem");
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
// ─── Section 4: invalidated ───
|
|
199
|
+
describe("draft-packet — Section 4 invalidated", () => {
|
|
200
|
+
it("omits section when no invalidated", () => {
|
|
201
|
+
const md = renderDraftPacket(makeState(), makeContent());
|
|
202
|
+
expect(md).not.toContain("### 4.");
|
|
203
|
+
});
|
|
204
|
+
it("shows invalidated constraints", () => {
|
|
205
|
+
const entry = makeEntry("CST-003", { status: "invalidated" });
|
|
206
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
207
|
+
const md = renderDraftPacket(state, makeContent());
|
|
208
|
+
expect(md).toContain("### 4. 시스템이 제외한 항목");
|
|
209
|
+
expect(md).toContain("CST-003");
|
|
210
|
+
expect(md).toContain("복원");
|
|
211
|
+
});
|
|
212
|
+
it("shows required invalidated warning", () => {
|
|
213
|
+
const entry = makeEntry("CST-001", { status: "invalidated", severity: "required" });
|
|
214
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
215
|
+
const md = renderDraftPacket(state, makeContent());
|
|
216
|
+
expect(md).toContain("기능 불능 또는 규정 위반");
|
|
217
|
+
expect(md).toContain("제외에 동의하시나요");
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
// ─── Section 5: guardrails ───
|
|
221
|
+
describe("draft-packet — Section 5 guardrails", () => {
|
|
222
|
+
it("renders guardrail bullets", () => {
|
|
223
|
+
const md = renderDraftPacket(makeState(), makeContent({ guardrails: ["규칙1", "규칙2"] }));
|
|
224
|
+
expect(md).toContain("- 규칙1");
|
|
225
|
+
expect(md).toContain("- 규칙2");
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
// ─── Section 6: decision ───
|
|
229
|
+
describe("draft-packet — Section 6 decision", () => {
|
|
230
|
+
it("shows approve-only when no constraints", () => {
|
|
231
|
+
const md = renderDraftPacket(makeState(), makeContent());
|
|
232
|
+
expect(md).toContain("Approve만 선택");
|
|
233
|
+
});
|
|
234
|
+
it("shows full choices with constraint questions", () => {
|
|
235
|
+
const entry = makeEntry("CST-001");
|
|
236
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
237
|
+
const md = renderDraftPacket(state, makeContent({
|
|
238
|
+
constraint_details: [poDet("CST-001")],
|
|
239
|
+
decision_questions: ["8건에 대해 선택해 주세요"],
|
|
240
|
+
}));
|
|
241
|
+
expect(md).toContain("각 CST 결정");
|
|
242
|
+
expect(md).toContain("compile을 시작합니다");
|
|
243
|
+
});
|
|
244
|
+
it("shows clarify warning when pending", () => {
|
|
245
|
+
const pool = emptyPool();
|
|
246
|
+
pool.summary.clarify_pending = 1;
|
|
247
|
+
pool.summary.total = 1;
|
|
248
|
+
const entry = makeEntry("CST-001");
|
|
249
|
+
pool.constraints = [entry];
|
|
250
|
+
const state = makeState({ constraint_pool: pool });
|
|
251
|
+
const md = renderDraftPacket(state, makeContent({
|
|
252
|
+
constraint_details: [poDet("CST-001")],
|
|
253
|
+
decision_questions: ["선택하세요"],
|
|
254
|
+
}));
|
|
255
|
+
expect(md).toContain("clarify");
|
|
256
|
+
expect(md).toContain("잠글 수 없습니다");
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
// ─── Edge cases: empty and undefined fields ───
|
|
260
|
+
describe("draft-packet — empty/undefined edge cases", () => {
|
|
261
|
+
it("renders with empty scenario_guide (no table)", () => {
|
|
262
|
+
const md = renderDraftPacket(makeState(), makeContent({ scenario_guide: [] }));
|
|
263
|
+
expect(md).toContain("### 1. 확정된 Surface");
|
|
264
|
+
expect(md).not.toContain("| 시나리오 | 시작 |");
|
|
265
|
+
});
|
|
266
|
+
it("renders '없음' when guardrails is empty", () => {
|
|
267
|
+
const md = renderDraftPacket(makeState(), makeContent({ guardrails: [] }));
|
|
268
|
+
expect(md).toContain("없음");
|
|
269
|
+
});
|
|
270
|
+
it("omits run_command when undefined", () => {
|
|
271
|
+
const md = renderDraftPacket(makeState(), makeContent({
|
|
272
|
+
run_command: undefined,
|
|
273
|
+
}));
|
|
274
|
+
expect(md).not.toContain("**실행 방법**");
|
|
275
|
+
});
|
|
276
|
+
it("omits mockup_revisions when undefined", () => {
|
|
277
|
+
const md = renderDraftPacket(makeState(), makeContent({
|
|
278
|
+
mockup_revisions: undefined,
|
|
279
|
+
}));
|
|
280
|
+
expect(md).not.toContain("mockup 반복");
|
|
281
|
+
});
|
|
282
|
+
it("renders run_command when provided", () => {
|
|
283
|
+
const md = renderDraftPacket(makeState(), makeContent({
|
|
284
|
+
run_command: "npm run dev",
|
|
285
|
+
}));
|
|
286
|
+
expect(md).toContain("`npm run dev`");
|
|
287
|
+
});
|
|
288
|
+
it("renders mockup_revisions when provided", () => {
|
|
289
|
+
const md = renderDraftPacket(makeState(), makeContent({
|
|
290
|
+
mockup_revisions: 5,
|
|
291
|
+
}));
|
|
292
|
+
expect(md).toContain("5회 수정 후 주체자 확정");
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
// ─── Validation ───
|
|
296
|
+
describe("draft-packet — validation", () => {
|
|
297
|
+
it("throws when constraint_id not in pool", () => {
|
|
298
|
+
expect(() => renderDraftPacket(makeState(), makeContent({
|
|
299
|
+
constraint_details: [poDet("CST-MISSING")],
|
|
300
|
+
}))).toThrow("CST-MISSING");
|
|
301
|
+
});
|
|
302
|
+
it("throws when decision_owner mismatch", () => {
|
|
303
|
+
const entry = makeEntry("CST-001", { decision_owner: "builder" });
|
|
304
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
305
|
+
expect(() => renderDraftPacket(state, makeContent({
|
|
306
|
+
constraint_details: [poDet("CST-001")], // PO detail for builder constraint
|
|
307
|
+
}))).toThrow("decision_owner");
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
// ─── Section 2: source consistency (content.constraint_details canonical) ───
|
|
311
|
+
describe("draft-packet — Section 2 source consistency", () => {
|
|
312
|
+
it("Section 2 active count matches content.constraint_details length, not pool.summary.total", () => {
|
|
313
|
+
// pool에 3건 있지만 content에는 2건만 — Section 3에 실제 보이는 수와 일치해야 함
|
|
314
|
+
const e1 = makeEntry("CST-001");
|
|
315
|
+
const e2 = makeEntry("CST-002");
|
|
316
|
+
const e3 = makeEntry("CST-003");
|
|
317
|
+
const state = makeState({ constraint_pool: makePoolWith(e1, e2, e3) });
|
|
318
|
+
const content = makeContent({ constraint_details: [poDet("CST-001"), poDet("CST-002")] });
|
|
319
|
+
const md = renderDraftPacket(state, content);
|
|
320
|
+
expect(md).toContain("아래 2건");
|
|
321
|
+
expect(md).not.toContain("아래 3건");
|
|
322
|
+
});
|
|
323
|
+
it("decided/undecided counts derive from pool lookup of detail ids", () => {
|
|
324
|
+
const e1 = makeEntry("CST-001", { status: "decided", decision: "inject" });
|
|
325
|
+
const e2 = makeEntry("CST-002", { status: "undecided" });
|
|
326
|
+
const state = makeState({ constraint_pool: makePoolWith(e1, e2) });
|
|
327
|
+
const content = makeContent({ constraint_details: [poDet("CST-001"), poDet("CST-002")] });
|
|
328
|
+
const md = renderDraftPacket(state, content);
|
|
329
|
+
expect(md).toContain("1건 결정 완료, 1건 미결정");
|
|
330
|
+
});
|
|
331
|
+
it("clarify_pending detail counts into '미결정' group", () => {
|
|
332
|
+
const e1 = makeEntry("CST-001", { status: "clarify_pending" });
|
|
333
|
+
const state = makeState({ constraint_pool: makePoolWith(e1) });
|
|
334
|
+
const content = makeContent({ constraint_details: [poDet("CST-001")] });
|
|
335
|
+
const md = renderDraftPacket(state, content);
|
|
336
|
+
expect(md).toContain("0건 결정 완료, 1건 미결정");
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
describe("draft-packet — validation (invalidated detail rejection)", () => {
|
|
340
|
+
it("throws when constraint_details references an invalidated constraint", () => {
|
|
341
|
+
const entry = makeEntry("CST-001", { status: "invalidated" });
|
|
342
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
343
|
+
expect(() => renderDraftPacket(state, makeContent({
|
|
344
|
+
constraint_details: [poDet("CST-001")],
|
|
345
|
+
}))).toThrow("invalidated");
|
|
346
|
+
});
|
|
347
|
+
});
|
|
348
|
+
// ─── requires_policy_change rendering ───
|
|
349
|
+
describe("draft-packet — requires_policy_change", () => {
|
|
350
|
+
it("shows policy tag and callout when requires_policy_change=true", () => {
|
|
351
|
+
const entry = makeEntry("CST-001", { requires_policy_change: true, decision: "inject", status: "decided" });
|
|
352
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
353
|
+
const md = renderDraftPacket(state, makeContent({
|
|
354
|
+
constraint_details: [poDet("CST-001")],
|
|
355
|
+
}));
|
|
356
|
+
expect(md).toContain("[정책 변경 검토 필요]");
|
|
357
|
+
expect(md).toContain("정책 변경 전제");
|
|
358
|
+
expect(md).toContain("requires_policy_change=false");
|
|
359
|
+
});
|
|
360
|
+
it("no policy tag when requires_policy_change is false", () => {
|
|
361
|
+
const entry = makeEntry("CST-001", { requires_policy_change: false });
|
|
362
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
363
|
+
const md = renderDraftPacket(state, makeContent({
|
|
364
|
+
constraint_details: [poDet("CST-001")],
|
|
365
|
+
}));
|
|
366
|
+
expect(md).not.toContain("[정책 변경 검토 필요]");
|
|
367
|
+
expect(md).not.toContain("정책 변경 전제");
|
|
368
|
+
});
|
|
369
|
+
it("no policy tag when requires_policy_change is undefined", () => {
|
|
370
|
+
const entry = makeEntry("CST-001"); // no requires_policy_change
|
|
371
|
+
const state = makeState({ constraint_pool: makePoolWith(entry) });
|
|
372
|
+
const md = renderDraftPacket(state, makeContent({
|
|
373
|
+
constraint_details: [poDet("CST-001")],
|
|
374
|
+
}));
|
|
375
|
+
expect(md).not.toContain("[정책 변경 검토 필요]");
|
|
376
|
+
});
|
|
377
|
+
});
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { isPolicyChangeRequired } from "../../scope-runtime/types.js";
|
|
2
|
+
import { MAX_COMPILE_RETRIES } from "../../scope-runtime/constants.js";
|
|
3
|
+
/**
|
|
4
|
+
* Render scope.md — the current status view of a scope.
|
|
5
|
+
*
|
|
6
|
+
* Pure function: (state) → string.
|
|
7
|
+
* No side effects, no external I/O.
|
|
8
|
+
*/
|
|
9
|
+
export function renderScopeMd(state) {
|
|
10
|
+
const lines = [];
|
|
11
|
+
// ── Header ──
|
|
12
|
+
lines.push(`# Scope: ${state.title}`);
|
|
13
|
+
lines.push("");
|
|
14
|
+
// ── Current stage ──
|
|
15
|
+
lines.push("## 현황");
|
|
16
|
+
lines.push("");
|
|
17
|
+
lines.push(`- **상태**: ${formatState(state.current_state)}`);
|
|
18
|
+
if (state.direction) {
|
|
19
|
+
lines.push(`- **방향**: ${state.direction}`);
|
|
20
|
+
}
|
|
21
|
+
lines.push(`- **마지막 업데이트**: revision ${state.latest_revision}`);
|
|
22
|
+
lines.push("");
|
|
23
|
+
// ── Blockers (only when present) ──
|
|
24
|
+
const blockers = collectBlockers(state);
|
|
25
|
+
if (blockers.length > 0) {
|
|
26
|
+
lines.push("## 차단 상태");
|
|
27
|
+
lines.push("");
|
|
28
|
+
for (const b of blockers) {
|
|
29
|
+
lines.push(`- ${b}`);
|
|
30
|
+
}
|
|
31
|
+
lines.push("");
|
|
32
|
+
}
|
|
33
|
+
// ── Next action ──
|
|
34
|
+
lines.push("## 다음 행동");
|
|
35
|
+
lines.push("");
|
|
36
|
+
lines.push(`- ${formatNextAction(state)}`);
|
|
37
|
+
lines.push("");
|
|
38
|
+
// ── Scope boundaries (if locked) ──
|
|
39
|
+
if (state.scope_boundaries) {
|
|
40
|
+
lines.push("## 범위");
|
|
41
|
+
lines.push("");
|
|
42
|
+
if (state.scope_boundaries.in.length > 0) {
|
|
43
|
+
lines.push("**포함:**");
|
|
44
|
+
for (const item of state.scope_boundaries.in) {
|
|
45
|
+
lines.push(`- ${item}`);
|
|
46
|
+
}
|
|
47
|
+
lines.push("");
|
|
48
|
+
}
|
|
49
|
+
if (state.scope_boundaries.out.length > 0) {
|
|
50
|
+
lines.push("**제외:**");
|
|
51
|
+
for (const item of state.scope_boundaries.out) {
|
|
52
|
+
lines.push(`- ${item}`);
|
|
53
|
+
}
|
|
54
|
+
lines.push("");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// ── Scanned sources ──
|
|
58
|
+
if (state.grounding_sources && state.grounding_sources.length > 0) {
|
|
59
|
+
lines.push("## 스캔 소스");
|
|
60
|
+
lines.push("");
|
|
61
|
+
for (const src of state.grounding_sources) {
|
|
62
|
+
lines.push(`- \`${src.type}\`: ${src.path_or_url}`);
|
|
63
|
+
}
|
|
64
|
+
lines.push("");
|
|
65
|
+
}
|
|
66
|
+
// ── Constraint summary ──
|
|
67
|
+
const { summary } = state.constraint_pool;
|
|
68
|
+
if (summary.total > 0) {
|
|
69
|
+
lines.push("## Constraint 현황");
|
|
70
|
+
lines.push("");
|
|
71
|
+
lines.push(`- 전체: ${summary.total}건 (필수 ${summary.required}, 권장 ${summary.recommended})`);
|
|
72
|
+
lines.push(`- 결정 완료: ${summary.decided}건`);
|
|
73
|
+
if (summary.undecided > 0) {
|
|
74
|
+
lines.push(`- 미결정: ${summary.undecided}건`);
|
|
75
|
+
}
|
|
76
|
+
if (summary.clarify_pending > 0) {
|
|
77
|
+
lines.push(`- clarify 대기: ${summary.clarify_pending}건`);
|
|
78
|
+
}
|
|
79
|
+
if (summary.invalidated > 0) {
|
|
80
|
+
lines.push(`- 제외됨: ${summary.invalidated}건`);
|
|
81
|
+
}
|
|
82
|
+
const policyChangeCount = state.constraint_pool.constraints.filter(isPolicyChangeRequired).length;
|
|
83
|
+
if (policyChangeCount > 0) {
|
|
84
|
+
lines.push(`- 정책 변경 검토 필요: ${policyChangeCount}건`);
|
|
85
|
+
}
|
|
86
|
+
lines.push("");
|
|
87
|
+
}
|
|
88
|
+
// ── Validation results ──
|
|
89
|
+
if (state.validation_result) {
|
|
90
|
+
const vr = state.validation_result;
|
|
91
|
+
lines.push("## 검증 결과");
|
|
92
|
+
lines.push("");
|
|
93
|
+
lines.push(`- **결과**: ${vr.result === "pass" ? "통과" : "실패"}`);
|
|
94
|
+
lines.push(`- **통과**: ${vr.pass_count}건, **실패**: ${vr.fail_count}건`);
|
|
95
|
+
if (vr.fail_count > 0 && vr.items.length > 0) {
|
|
96
|
+
const failItems = vr.items.filter(i => i.result === "fail");
|
|
97
|
+
for (const item of failItems) {
|
|
98
|
+
lines.push(`- ${item.val_id} (${item.related_cst}): ${item.detail}`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
lines.push("");
|
|
102
|
+
}
|
|
103
|
+
// ── Constraint decision details (#8) ──
|
|
104
|
+
const decidedConstraints = state.constraint_pool.constraints.filter(c => c.status === "decided");
|
|
105
|
+
if (decidedConstraints.length > 0) {
|
|
106
|
+
lines.push("<details>");
|
|
107
|
+
lines.push(`<summary>Constraint 결정 상세 (${decidedConstraints.length}건)</summary>`);
|
|
108
|
+
lines.push("");
|
|
109
|
+
lines.push("| CST-ID | 결정 | 선택 |");
|
|
110
|
+
lines.push("|--------|------|------|");
|
|
111
|
+
for (const c of decidedConstraints) {
|
|
112
|
+
lines.push(`| ${c.constraint_id} | ${c.decision ?? "-"} | ${c.selected_option ?? "-"} |`);
|
|
113
|
+
}
|
|
114
|
+
lines.push("");
|
|
115
|
+
lines.push("</details>");
|
|
116
|
+
lines.push("");
|
|
117
|
+
}
|
|
118
|
+
// ── Recent decisions ──
|
|
119
|
+
if (state.verdict_log.length > 0) {
|
|
120
|
+
lines.push("## 최근 결정");
|
|
121
|
+
lines.push("");
|
|
122
|
+
const recent = state.verdict_log.slice(-5);
|
|
123
|
+
for (const entry of recent) {
|
|
124
|
+
lines.push(`- ${formatVerdictEntry(entry)}`);
|
|
125
|
+
}
|
|
126
|
+
lines.push("");
|
|
127
|
+
}
|
|
128
|
+
return lines.join("\n");
|
|
129
|
+
}
|
|
130
|
+
// ─── Helpers ───
|
|
131
|
+
const STATE_LABELS = {
|
|
132
|
+
draft: "초안 (소스 스캔 전)",
|
|
133
|
+
grounded: "소스 스캔 완료",
|
|
134
|
+
exploring: "요구사항 탐색 중",
|
|
135
|
+
align_proposed: "Align Packet 검토 중",
|
|
136
|
+
align_locked: "방향·범위 확정됨",
|
|
137
|
+
surface_iterating: "Surface 반복 수정 중",
|
|
138
|
+
surface_confirmed: "Surface 확정됨 — constraint 결정 필요",
|
|
139
|
+
constraints_resolved: "모든 constraint 결정 완료",
|
|
140
|
+
target_locked: "Target 잠김 — compile 진행 중",
|
|
141
|
+
compiled: "Build Spec 생성 완료",
|
|
142
|
+
applied: "구현 적용 완료 — 검증 대기",
|
|
143
|
+
validated: "검증 통과 — 종료 가능",
|
|
144
|
+
closed: "종료됨",
|
|
145
|
+
deferred: "보류됨",
|
|
146
|
+
rejected: "거절됨",
|
|
147
|
+
};
|
|
148
|
+
function formatState(state) {
|
|
149
|
+
return STATE_LABELS[state] ?? state;
|
|
150
|
+
}
|
|
151
|
+
function formatNextAction(state) {
|
|
152
|
+
if (state.stale) {
|
|
153
|
+
return "소스가 변경되었습니다. 재스캔이 필요합니다 (`/start`를 다시 실행하세요)";
|
|
154
|
+
}
|
|
155
|
+
if (state.convergence_blocked) {
|
|
156
|
+
return "수렴 차단 상태입니다. 다음 중 하나를 선택하세요: (1) 방향 변경 (`/align redirect`) (2) scope 축소 (`/align revise`) (3) scope 보류 (`scope.deferred`)";
|
|
157
|
+
}
|
|
158
|
+
switch (state.current_state) {
|
|
159
|
+
case "draft":
|
|
160
|
+
return "소스를 스캔하세요 (`/start`를 실행하세요)";
|
|
161
|
+
case "grounded":
|
|
162
|
+
return "스캔이 끝났습니다. 대화 에이전트가 주체자에게 선택지 기반 질문으로 방향·범위·제약을 확인한 뒤, 수렴된 답을 bounded evolve runtime input으로 제출하세요. Runtime이 constraint.discovered 이벤트 + align-packet.md + align.proposed 이벤트를 기록합니다.";
|
|
163
|
+
case "exploring": {
|
|
164
|
+
const ep = state.exploration_progress;
|
|
165
|
+
const phaseInfo = ep ? ` (Phase ${ep.current_phase}/6: ${ep.current_phase_name})` : "";
|
|
166
|
+
return `요구사항을 탐색하고 있습니다${phaseInfo}. 질문에 답하여 scope를 구체화하세요`;
|
|
167
|
+
}
|
|
168
|
+
case "align_proposed":
|
|
169
|
+
return "Align Packet을 읽고 방향과 범위를 확정하세요 (승인/수정/거절/재스캔 중 선택)";
|
|
170
|
+
case "align_locked":
|
|
171
|
+
return "방향이 확정되었습니다. 화면 설계를 시작하세요 (`/draft`를 실행하세요)";
|
|
172
|
+
case "surface_iterating":
|
|
173
|
+
return state.entry_mode === "experience"
|
|
174
|
+
? "mockup을 확인하세요 (`cd surface/preview && npm run dev`). 수정이 필요하면 피드백을, 맞으면 '확정합니다'라고 말씀하세요"
|
|
175
|
+
: "API 명세를 확인하세요 (`surface/contract-diff/`). 수정이 필요하면 피드백을, 맞으면 '확정합니다'라고 말씀하세요";
|
|
176
|
+
case "surface_confirmed":
|
|
177
|
+
return state.constraint_pool.summary.undecided > 0
|
|
178
|
+
? `${state.constraint_pool.summary.undecided}건의 제약 사항에 대해 결정이 필요합니다. 각 항목의 선택지를 검토하고 결정하세요`
|
|
179
|
+
: state.constraint_pool.summary.clarify_pending > 0
|
|
180
|
+
? `${state.constraint_pool.summary.clarify_pending}건의 확인이 필요합니다. 외부에서 정보를 확보한 뒤 \`/draft\`를 실행하여 결정을 제출하세요`
|
|
181
|
+
: "모든 결정이 완료되었습니다. 확정을 진행합니다 (`/draft`를 실행하세요)";
|
|
182
|
+
case "constraints_resolved":
|
|
183
|
+
if (state.validation_result?.result === "fail") {
|
|
184
|
+
return "검증에서 실패한 항목이 있습니다. 해당 제약 사항을 재검토한 뒤 다시 구현 명세를 생성하세요 (`/draft`를 실행하세요)";
|
|
185
|
+
}
|
|
186
|
+
if (state.retry_count_compile > 0) {
|
|
187
|
+
return `compile 중 새 제약이 발견되었습니다 (재시도 ${state.retry_count_compile}회). 새 제약에 대해 결정한 뒤 진행하세요 (\`/draft\`를 실행하세요)`;
|
|
188
|
+
}
|
|
189
|
+
return "모든 제약 사항이 해결되었습니다. 구현 명세를 생성합니다 (`/draft`를 실행하세요)";
|
|
190
|
+
case "target_locked":
|
|
191
|
+
return "구현 명세(Build Spec)를 생성하고 있습니다";
|
|
192
|
+
case "compiled":
|
|
193
|
+
return "구현 명세가 완성되었습니다. Builder가 코드를 작성합니다";
|
|
194
|
+
case "applied":
|
|
195
|
+
return "코드 작성이 완료되었습니다. 검증을 진행합니다";
|
|
196
|
+
case "validated":
|
|
197
|
+
return "모든 검증을 통과했습니다. 결과를 확인하시고, 완료하려면 '완료'라고 말씀하세요";
|
|
198
|
+
case "closed":
|
|
199
|
+
return "이 scope는 완료되었습니다";
|
|
200
|
+
case "deferred":
|
|
201
|
+
return "이 scope는 보류 중입니다";
|
|
202
|
+
case "rejected":
|
|
203
|
+
return "이 scope는 거절되었습니다";
|
|
204
|
+
default:
|
|
205
|
+
return `현재 상태: ${state.current_state}`;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
function collectBlockers(state) {
|
|
209
|
+
const blockers = [];
|
|
210
|
+
if (state.stale) {
|
|
211
|
+
const sources = state.stale_sources?.map((s) => s.path).join(", ") ?? "알 수 없음";
|
|
212
|
+
blockers.push(`소스가 변경되었습니다: ${sources} (revision ${state.stale_since ?? "?"}부터)`);
|
|
213
|
+
}
|
|
214
|
+
if (state.convergence_blocked) {
|
|
215
|
+
blockers.push("수렴 차단: revise가 차단되었습니다. 행동을 선택해야 합니다");
|
|
216
|
+
}
|
|
217
|
+
if (state.constraint_pool.summary.clarify_pending > 0) {
|
|
218
|
+
blockers.push(`clarify 미해소: ${state.constraint_pool.summary.clarify_pending}건. 해소 전까지 target 잠금 불가`);
|
|
219
|
+
}
|
|
220
|
+
if (state.current_state === "constraints_resolved" && state.retry_count_compile > 0) {
|
|
221
|
+
blockers.push(`compile 중 새 제약이 발견되어 결정이 필요합니다 (재시도 ${state.retry_count_compile}/${MAX_COMPILE_RETRIES}회)`);
|
|
222
|
+
}
|
|
223
|
+
if (state.last_backward_reason) {
|
|
224
|
+
blockers.push(`이전 단계 복귀 사유: ${state.last_backward_reason}`);
|
|
225
|
+
}
|
|
226
|
+
return blockers;
|
|
227
|
+
}
|
|
228
|
+
function formatVerdictEntry(entry) {
|
|
229
|
+
switch (entry.type) {
|
|
230
|
+
case "align.locked":
|
|
231
|
+
return `rev ${entry.revision}: 방향 확정 — "${entry.locked_direction}"`;
|
|
232
|
+
case "constraint.decision_recorded":
|
|
233
|
+
return `rev ${entry.revision}: ${entry.constraint_id} → ${entry.decision} (${entry.decision_owner})`;
|
|
234
|
+
case "constraint.clarify_resolved":
|
|
235
|
+
return `rev ${entry.revision}: ${entry.constraint_id} clarify 해소 → ${entry.decision} (${entry.decision_owner})`;
|
|
236
|
+
}
|
|
237
|
+
}
|