onto-mcp 0.3.2 → 0.4.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/processes/reconstruct/actionable-ontology-seed-recomposition-design.md +447 -0
- package/.onto/processes/reconstruct/foundry-style-ontology-seed-contract.md +934 -0
- package/.onto/processes/reconstruct/reconstruct-boundary-contract.md +303 -725
- package/.onto/processes/reconstruct/reconstruct-contract-registry.yaml +1645 -0
- package/.onto/processes/reconstruct/reconstruct-execution-ux-contract.md +26 -22
- package/.onto/processes/reconstruct/source-profile-contract.md +49 -23
- package/.onto/processes/reconstruct/source-profiles/code.md +6 -3
- package/.onto/processes/reconstruct/source-profiles/database.md +5 -2
- package/.onto/processes/reconstruct/source-profiles/document.md +5 -2
- package/.onto/processes/reconstruct/source-profiles/spreadsheet.md +5 -4
- package/.onto/processes/review/review-execution-ux-contract.md +40 -0
- package/.onto/processes/shared/pipeline-execution-ledger-contract.md +26 -10
- package/.onto/processes/shared/target-material-kind-contract.md +29 -16
- package/AGENTS.md +6 -4
- package/README.md +135 -76
- package/dist/cli.js +8 -8
- package/dist/core-api/reconstruct-api.js +117 -31
- package/dist/core-api/review-api.js +47 -0
- package/dist/core-runtime/cli/codex-review-unit-executor.js +39 -2
- package/dist/core-runtime/cli/complete-review-session.js +2 -2
- package/dist/core-runtime/cli/mock-review-unit-executor.js +1 -1
- package/dist/core-runtime/cli/review-invoke.js +9 -9
- package/dist/core-runtime/cli/run-review-prompt-execution.js +39 -5
- package/dist/core-runtime/cli/spawn-watcher.js +266 -47
- package/dist/core-runtime/cli/start-review-session.js +3 -3
- package/dist/core-runtime/llm/llm-caller.js +11 -0
- package/dist/core-runtime/llm/llm-tool-loop.js +2 -0
- package/dist/core-runtime/observability/runtime-stream-observation.js +118 -0
- package/dist/core-runtime/onboard/cli-host.js +149 -0
- package/dist/core-runtime/onboard/host-target.js +22 -0
- package/dist/core-runtime/onboard/json-config-host.js +122 -0
- package/dist/core-runtime/onboard/path-scan.js +26 -0
- package/dist/core-runtime/onboard/prompt.js +51 -0
- package/dist/core-runtime/onboard/register.js +207 -0
- package/dist/core-runtime/onboard/types.js +27 -0
- package/dist/core-runtime/reconstruct/actionable-seed-validation.js +1777 -0
- package/dist/core-runtime/reconstruct/artifact-types.js +10 -4
- package/dist/core-runtime/reconstruct/contract-registry.js +623 -0
- package/dist/core-runtime/reconstruct/domain-id.js +10 -0
- package/dist/core-runtime/reconstruct/governing-snapshot.js +716 -0
- package/dist/core-runtime/reconstruct/material-profile-validation.js +191 -0
- package/dist/core-runtime/reconstruct/materialize-preparation.js +49 -11
- package/dist/core-runtime/reconstruct/pipeline-execution-ledger.js +269 -79
- package/dist/core-runtime/reconstruct/post-seed-validation.js +1194 -51
- package/dist/core-runtime/reconstruct/record.js +104 -20
- package/dist/core-runtime/reconstruct/run.js +2107 -413
- package/dist/core-runtime/reconstruct/seed-claim-projections.js +268 -0
- package/dist/core-runtime/reconstruct/source-profiles.js +93 -4
- package/dist/core-runtime/reconstruct/terminal-validation.js +807 -0
- package/dist/core-runtime/review/review-invocation-runner.js +4 -4
- package/dist/mcp/server.js +110 -38
- package/dist/mcp/tool-schemas.js +20 -6
- package/package.json +8 -17
- package/scripts/onto-review-watch.sh +486 -0
- package/scripts/onto-runtime-watch.sh +122 -0
- package/scripts/postinstall-hint.js +22 -0
- package/.onto/processes/reconstruct/top-level-concept-discovery-contract.md +0 -387
- package/dist/core-runtime/cli/bootstrap-review-binding.js +0 -186
- package/dist/core-runtime/cli/codex-nested-dispatch.test.js +0 -390
- package/dist/core-runtime/cli/codex-nested-teamlead-executor.test.js +0 -335
- package/dist/core-runtime/cli/coordinator-helpers.js +0 -583
- package/dist/core-runtime/cli/coordinator-state-machine-deliberation.test.js +0 -167
- package/dist/core-runtime/cli/coordinator-state-machine.js +0 -794
- package/dist/core-runtime/cli/e2e-codex-multi-agent-fixes.test.js +0 -615
- package/dist/core-runtime/cli/e2e-start-review-session.test.js +0 -312
- package/dist/core-runtime/cli/health.js +0 -44
- package/dist/core-runtime/cli/inline-http-review-unit-executor.test.js +0 -567
- package/dist/core-runtime/cli/materialize-review-execution-preparation.js +0 -104
- package/dist/core-runtime/cli/migrate-session-roots.js +0 -118
- package/dist/core-runtime/cli/repo-layout-migration-replace.smoke.test.js +0 -106
- package/dist/core-runtime/cli/review-invoke-auto-resolution.test.js +0 -268
- package/dist/core-runtime/cli/review-invoke-coordinator-topology.test.js +0 -136
- package/dist/core-runtime/cli/review-invoke-resolver-caching.test.js +0 -201
- package/dist/core-runtime/cli/review-invoke-topology-dispatch.test.js +0 -192
- package/dist/core-runtime/cli/session-root-guard.js +0 -168
- package/dist/core-runtime/cli/spawn-watcher.test.js +0 -457
- package/dist/core-runtime/cli/strip-wrapping-code-fence.test.js +0 -79
- package/dist/core-runtime/cli/teamcreate-lens-deliberation-executor.js +0 -412
- package/dist/core-runtime/cli/teamcreate-lens-deliberation-executor.test.js +0 -351
- package/dist/core-runtime/cli/topology-executor-mapping.js +0 -139
- package/dist/core-runtime/cli/topology-executor-mapping.test.js +0 -173
- package/dist/core-runtime/cli/write-review-interpretation.js +0 -81
- package/dist/core-runtime/config/onto-config-cli.js +0 -278
- package/dist/core-runtime/config/onto-config-key-path.js +0 -288
- package/dist/core-runtime/config/onto-config-key-path.test.js +0 -195
- package/dist/core-runtime/config/onto-config-preview.js +0 -108
- package/dist/core-runtime/config/onto-config-preview.test.js +0 -132
- package/dist/core-runtime/discovery/config-chain.js +0 -118
- package/dist/core-runtime/discovery/config-chain.test.js +0 -103
- package/dist/core-runtime/discovery/config-profile.js +0 -199
- package/dist/core-runtime/discovery/config-profile.test.js +0 -233
- package/dist/core-runtime/discovery/host-detection.test.js +0 -186
- package/dist/core-runtime/discovery/installation-paths.test.js +0 -65
- package/dist/core-runtime/discovery/lens-registry.test.js +0 -81
- package/dist/core-runtime/discovery/path-normalization.test.js +0 -22
- package/dist/core-runtime/discovery/plugin-path.js +0 -72
- package/dist/core-runtime/discovery/plugin-path.test.js +0 -95
- package/dist/core-runtime/evolve/adapters/code-product/compile/compile-defense.js +0 -344
- package/dist/core-runtime/evolve/adapters/code-product/compile/compile-defense.test.js +0 -915
- package/dist/core-runtime/evolve/adapters/code-product/compile/compile.js +0 -564
- package/dist/core-runtime/evolve/adapters/code-product/compile/compile.test.js +0 -708
- package/dist/core-runtime/evolve/adapters/code-product/parsers/brief-parser.js +0 -165
- package/dist/core-runtime/evolve/adapters/code-product/parsers/brief-parser.test.js +0 -227
- package/dist/core-runtime/evolve/adapters/code-product/validators/validate.js +0 -59
- package/dist/core-runtime/evolve/adapters/code-product/validators/validate.test.js +0 -205
- package/dist/core-runtime/evolve/adapters/methodology/adapter.js +0 -16
- package/dist/core-runtime/evolve/adapters/methodology/adapter.test.js +0 -9
- package/dist/core-runtime/evolve/adapters/methodology/perspectives/authority-consistency.js +0 -298
- package/dist/core-runtime/evolve/adapters/methodology/perspectives/authority-consistency.test.js +0 -70
- package/dist/core-runtime/evolve/adapters/methodology/scope-types/process.js +0 -46
- package/dist/core-runtime/evolve/adapters/methodology/scope-types/process.test.js +0 -73
- package/dist/core-runtime/evolve/adapters/registry.js +0 -47
- package/dist/core-runtime/evolve/adapters/registry.test.js +0 -67
- package/dist/core-runtime/evolve/cli.js +0 -256
- package/dist/core-runtime/evolve/commands/align.js +0 -194
- package/dist/core-runtime/evolve/commands/align.test.js +0 -82
- package/dist/core-runtime/evolve/commands/apply.js +0 -161
- package/dist/core-runtime/evolve/commands/apply.test.js +0 -138
- package/dist/core-runtime/evolve/commands/close.js +0 -39
- package/dist/core-runtime/evolve/commands/close.test.js +0 -99
- package/dist/core-runtime/evolve/commands/defer.js +0 -40
- package/dist/core-runtime/evolve/commands/defer.test.js +0 -134
- package/dist/core-runtime/evolve/commands/draft.js +0 -323
- package/dist/core-runtime/evolve/commands/draft.test.js +0 -178
- package/dist/core-runtime/evolve/commands/e2e-evolve-full-cycle.test.js +0 -208
- package/dist/core-runtime/evolve/commands/error-messages.js +0 -125
- package/dist/core-runtime/evolve/commands/error-messages.test.js +0 -167
- package/dist/core-runtime/evolve/commands/propose-align.js +0 -222
- package/dist/core-runtime/evolve/commands/propose-align.test.js +0 -136
- package/dist/core-runtime/evolve/commands/reconstruct.js +0 -330
- package/dist/core-runtime/evolve/commands/reconstruct.test.js +0 -278
- package/dist/core-runtime/evolve/commands/shared.js +0 -22
- package/dist/core-runtime/evolve/commands/stale-check.js +0 -103
- package/dist/core-runtime/evolve/commands/stale-check.test.js +0 -84
- package/dist/core-runtime/evolve/commands/start.js +0 -887
- package/dist/core-runtime/evolve/commands/start.test.js +0 -396
- package/dist/core-runtime/evolve/config/project-config.js +0 -99
- package/dist/core-runtime/evolve/config/project-config.test.js +0 -170
- package/dist/core-runtime/evolve/renderers/align-packet.js +0 -280
- package/dist/core-runtime/evolve/renderers/align-packet.test.js +0 -332
- package/dist/core-runtime/evolve/renderers/draft-packet.js +0 -303
- package/dist/core-runtime/evolve/renderers/draft-packet.test.js +0 -377
- package/dist/core-runtime/evolve/renderers/format.js +0 -5
- package/dist/core-runtime/evolve/renderers/scope-md.js +0 -237
- package/dist/core-runtime/evolve/renderers/scope-md.test.js +0 -306
- package/dist/core-runtime/govern/cli.js +0 -369
- package/dist/core-runtime/govern/cli.test.js +0 -314
- package/dist/core-runtime/govern/drift-engine.js +0 -103
- package/dist/core-runtime/govern/drift-engine.test.js +0 -319
- package/dist/core-runtime/govern/promote-principle.js +0 -206
- package/dist/core-runtime/govern/promote-principle.test.js +0 -368
- package/dist/core-runtime/govern/queue.js +0 -81
- package/dist/core-runtime/govern/types.js +0 -16
- package/dist/core-runtime/install/cli.js +0 -530
- package/dist/core-runtime/install/detect.js +0 -128
- package/dist/core-runtime/install/detect.test.js +0 -155
- package/dist/core-runtime/install/gitignore-update.js +0 -74
- package/dist/core-runtime/install/gitignore-update.test.js +0 -64
- package/dist/core-runtime/install/install-integration.test.js +0 -373
- package/dist/core-runtime/install/prompts.js +0 -389
- package/dist/core-runtime/install/prompts.test.js +0 -293
- package/dist/core-runtime/install/types.js +0 -26
- package/dist/core-runtime/install/validation.js +0 -295
- package/dist/core-runtime/install/validation.test.js +0 -313
- package/dist/core-runtime/install/writer.js +0 -254
- package/dist/core-runtime/install/writer.test.js +0 -218
- package/dist/core-runtime/learning/extractor.js +0 -461
- package/dist/core-runtime/learning/feedback.js +0 -179
- package/dist/core-runtime/learning/health-report.js +0 -165
- package/dist/core-runtime/learning/health-report.test.js +0 -169
- package/dist/core-runtime/learning/loader.js +0 -388
- package/dist/core-runtime/learning/loader.test.js +0 -102
- package/dist/core-runtime/learning/promote/apply-state.js +0 -240
- package/dist/core-runtime/learning/promote/audit-obligation.js +0 -195
- package/dist/core-runtime/learning/promote/collector.js +0 -432
- package/dist/core-runtime/learning/promote/degraded-state.js +0 -125
- package/dist/core-runtime/learning/promote/domain-doc-proposer.js +0 -166
- package/dist/core-runtime/learning/promote/e2e-promote.test.js +0 -6385
- package/dist/core-runtime/learning/promote/health-snapshot.js +0 -150
- package/dist/core-runtime/learning/promote/insight-reclassifier.js +0 -544
- package/dist/core-runtime/learning/promote/judgment-auditor.js +0 -517
- package/dist/core-runtime/learning/promote/panel-reviewer.js +0 -1158
- package/dist/core-runtime/learning/promote/promote-executor.js +0 -1675
- package/dist/core-runtime/learning/promote/promoter.js +0 -307
- package/dist/core-runtime/learning/promote/retirement.js +0 -122
- package/dist/core-runtime/learning/promote/types.js +0 -23
- package/dist/core-runtime/learning/prompt-sections.js +0 -51
- package/dist/core-runtime/learning/shared/artifact-registry-init.js +0 -45
- package/dist/core-runtime/learning/shared/artifact-registry.js +0 -254
- package/dist/core-runtime/learning/shared/audit-obligation-kernel.js +0 -73
- package/dist/core-runtime/learning/shared/audit-state.js +0 -99
- package/dist/core-runtime/learning/shared/duplicate-check.js +0 -28
- package/dist/core-runtime/learning/shared/llm-caller.js +0 -831
- package/dist/core-runtime/learning/shared/llm-caller.test.js +0 -601
- package/dist/core-runtime/learning/shared/llm-tool-loop.js +0 -393
- package/dist/core-runtime/learning/shared/mode.js +0 -25
- package/dist/core-runtime/learning/shared/paths.js +0 -84
- package/dist/core-runtime/learning/shared/paths.test.js +0 -79
- package/dist/core-runtime/learning/shared/patterns.js +0 -37
- package/dist/core-runtime/learning/shared/recoverability.js +0 -355
- package/dist/core-runtime/learning/shared/recovery-context.js +0 -374
- package/dist/core-runtime/learning/shared/scope.js +0 -1
- package/dist/core-runtime/learning/shared/semantic-classifier.js +0 -94
- package/dist/core-runtime/learning/shared/specs/apply-execution-state-spec.js +0 -42
- package/dist/core-runtime/learning/shared/specs/audit-state-spec.js +0 -37
- package/dist/core-runtime/learning/shared/specs/backup-metadata-spec.js +0 -39
- package/dist/core-runtime/learning/shared/specs/emergency-log-spec.js +0 -41
- package/dist/core-runtime/learning/shared/specs/layout-version-spec.js +0 -38
- package/dist/core-runtime/learning/shared/specs/promote-decisions-spec.js +0 -43
- package/dist/core-runtime/learning/shared/specs/promote-report-spec.js +0 -113
- package/dist/core-runtime/learning/shared/specs/prune-log-spec.js +0 -36
- package/dist/core-runtime/learning/shared/specs/recovery-resolution-spec.js +0 -48
- package/dist/core-runtime/learning/shared/specs/restore-manifest-spec.js +0 -43
- package/dist/core-runtime/learning/shared/specs/spec-helpers.js +0 -64
- package/dist/core-runtime/learning/usage-tracker.js +0 -190
- package/dist/core-runtime/learning/usage-tracker.test.js +0 -176
- package/dist/core-runtime/onboard/detect-review-axes.js +0 -122
- package/dist/core-runtime/onboard/detect-review-axes.test.js +0 -127
- package/dist/core-runtime/onboard/write-review-block.js +0 -188
- package/dist/core-runtime/onboard/write-review-block.test.js +0 -240
- package/dist/core-runtime/readers/brownfield-builder.js +0 -150
- package/dist/core-runtime/readers/brownfield-builder.test.js +0 -136
- package/dist/core-runtime/readers/code-chunk-collector.js +0 -53
- package/dist/core-runtime/readers/code-chunk-collector.test.js +0 -136
- package/dist/core-runtime/readers/file-utils.js +0 -240
- package/dist/core-runtime/readers/file-utils.test.js +0 -146
- package/dist/core-runtime/readers/lexicon-citation-check.js +0 -93
- package/dist/core-runtime/readers/lexicon-citation-check.test.js +0 -77
- package/dist/core-runtime/readers/mcp-figma.js +0 -30
- package/dist/core-runtime/readers/mcp-figma.test.js +0 -82
- package/dist/core-runtime/readers/mcp-generic.js +0 -31
- package/dist/core-runtime/readers/mcp-generic.test.js +0 -76
- package/dist/core-runtime/readers/ontology-index.js +0 -148
- package/dist/core-runtime/readers/ontology-index.test.js +0 -245
- package/dist/core-runtime/readers/ontology-query.js +0 -168
- package/dist/core-runtime/readers/ontology-query.test.js +0 -311
- package/dist/core-runtime/readers/ontology-resolve.js +0 -48
- package/dist/core-runtime/readers/ontology-resolve.test.js +0 -48
- package/dist/core-runtime/readers/patterns/index.js +0 -7
- package/dist/core-runtime/readers/review-log.js +0 -213
- package/dist/core-runtime/readers/review-log.test.js +0 -313
- package/dist/core-runtime/readers/scan-local.js +0 -102
- package/dist/core-runtime/readers/scan-local.test.js +0 -102
- package/dist/core-runtime/readers/scan-tarball.js +0 -121
- package/dist/core-runtime/readers/scan-tarball.test.js +0 -283
- package/dist/core-runtime/readers/scan-vault.js +0 -34
- package/dist/core-runtime/readers/scan-vault.test.js +0 -81
- package/dist/core-runtime/readers/types.js +0 -42
- package/dist/core-runtime/readers/types.test.js +0 -94
- package/dist/core-runtime/readers/viewpoint-collectors.js +0 -229
- package/dist/core-runtime/reconstruct/seed-candidate-validation.js +0 -385
- package/dist/core-runtime/review/citation-audit.test.js +0 -165
- package/dist/core-runtime/review/execution-plan-resolver.js +0 -247
- package/dist/core-runtime/review/execution-plan-resolver.test.js +0 -243
- package/dist/core-runtime/review/execution-topology-resolver-axis-first.test.js +0 -246
- package/dist/core-runtime/review/execution-topology-resolver.js +0 -401
- package/dist/core-runtime/review/execution-topology-resolver.test.js +0 -315
- package/dist/core-runtime/review/inline-context-embedder.test.js +0 -154
- package/dist/core-runtime/review/legacy-mode-policy.js +0 -88
- package/dist/core-runtime/review/materializers-effort-persist.test.js +0 -79
- package/dist/core-runtime/review/ontology-path-classifier.js +0 -179
- package/dist/core-runtime/review/ontology-path-classifier.test.js +0 -216
- package/dist/core-runtime/review/packet-boundary-policy.test.js +0 -107
- package/dist/core-runtime/review/participating-lens-paths.test.js +0 -73
- package/dist/core-runtime/review/review-config-legacy-translate.js +0 -244
- package/dist/core-runtime/review/review-config-legacy-translate.test.js +0 -161
- package/dist/core-runtime/review/review-config-validator.js +0 -289
- package/dist/core-runtime/review/review-config-validator.test.js +0 -236
- package/dist/core-runtime/review/shape-pipeline-audit.test.js +0 -311
- package/dist/core-runtime/review/shape-to-topology-id.js +0 -117
- package/dist/core-runtime/review/shape-to-topology-id.test.js +0 -132
- package/dist/core-runtime/review/topology-shape-derivation.js +0 -155
- package/dist/core-runtime/review/topology-shape-derivation.test.js +0 -195
- package/dist/core-runtime/scope-runtime/constants.js +0 -12
- package/dist/core-runtime/scope-runtime/constraint-pool.js +0 -166
- package/dist/core-runtime/scope-runtime/constraint-pool.test.js +0 -674
- package/dist/core-runtime/scope-runtime/domain-validation-log.js +0 -135
- package/dist/core-runtime/scope-runtime/domain-validation-log.test.js +0 -156
- package/dist/core-runtime/scope-runtime/eval-persistence.js +0 -65
- package/dist/core-runtime/scope-runtime/eval-persistence.test.js +0 -84
- package/dist/core-runtime/scope-runtime/event-pipeline.js +0 -64
- package/dist/core-runtime/scope-runtime/event-pipeline.test.js +0 -450
- package/dist/core-runtime/scope-runtime/event-store.js +0 -39
- package/dist/core-runtime/scope-runtime/event-store.test.js +0 -95
- package/dist/core-runtime/scope-runtime/gate-guard.js +0 -348
- package/dist/core-runtime/scope-runtime/gate-guard.test.js +0 -1047
- package/dist/core-runtime/scope-runtime/hash.js +0 -4
- package/dist/core-runtime/scope-runtime/hash.test.js +0 -33
- package/dist/core-runtime/scope-runtime/id.js +0 -4
- package/dist/core-runtime/scope-runtime/id.test.js +0 -17
- package/dist/core-runtime/scope-runtime/reducer.js +0 -297
- package/dist/core-runtime/scope-runtime/reducer.test.js +0 -759
- package/dist/core-runtime/scope-runtime/scope-manager.js +0 -161
- package/dist/core-runtime/scope-runtime/state-machine.js +0 -309
- package/dist/core-runtime/scope-runtime/state-machine.test.js +0 -704
- package/dist/core-runtime/scope-runtime/types.js +0 -116
- package/dist/core-runtime/scope-runtime/types.test.js +0 -69
- package/dist/core-runtime/translate/render-for-user.js +0 -169
- package/dist/core-runtime/translate/render-for-user.test.js +0 -122
- package/dist/providers/capability-contract.js +0 -1
|
@@ -1,245 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from "vitest";
|
|
2
|
-
import { buildOntologyIndex } from "./ontology-index.js";
|
|
3
|
-
// ─── Fixtures (소규모 테스트 데이터) ───
|
|
4
|
-
const ONTOLOGY_YAML = `
|
|
5
|
-
version: "1.0"
|
|
6
|
-
glossary:
|
|
7
|
-
- canonical: Lesson
|
|
8
|
-
meaning: "수업"
|
|
9
|
-
legacy_aliases: [Class, Lecture]
|
|
10
|
-
code_entity: Lecture
|
|
11
|
-
db_table: GT_CLASS
|
|
12
|
-
fk_variants: [classId, class_id, lectureId]
|
|
13
|
-
- canonical: Tutor
|
|
14
|
-
meaning: "튜터"
|
|
15
|
-
legacy_aliases: [Teacher]
|
|
16
|
-
code_entity: Tutor
|
|
17
|
-
db_table: GT_TUTOR
|
|
18
|
-
fk_variants: [tutorId, TUTOR_ID]
|
|
19
|
-
- canonical: Student
|
|
20
|
-
meaning: "학생"
|
|
21
|
-
legacy_aliases: [User]
|
|
22
|
-
code_entity: User
|
|
23
|
-
db_table: GT_USER
|
|
24
|
-
fk_variants: [studentId, userId, user_id]
|
|
25
|
-
- canonical: Ticket
|
|
26
|
-
meaning: "수강권"
|
|
27
|
-
legacy_aliases: [ClassTicket, 레슨권]
|
|
28
|
-
code_entity: Ticket
|
|
29
|
-
db_table: le_ticket
|
|
30
|
-
fk_variants: [classTicketId, ticketId]
|
|
31
|
-
`;
|
|
32
|
-
const ACTIONS_YAML = `
|
|
33
|
-
version: "1.0"
|
|
34
|
-
write_actions:
|
|
35
|
-
- id: AUTH-1
|
|
36
|
-
name: SocialLogin
|
|
37
|
-
display_name: "소셜 로그인"
|
|
38
|
-
domain: auth
|
|
39
|
-
actor: Student
|
|
40
|
-
target_entities: [Student, UserOauthMapping]
|
|
41
|
-
source_code: "AuthenticationGateway.oauthLogin(), OauthService.authenticate()"
|
|
42
|
-
- id: LEC-1
|
|
43
|
-
name: CreateLecture
|
|
44
|
-
display_name: "수업 생성 (일반)"
|
|
45
|
-
domain: lecture
|
|
46
|
-
actor: Student
|
|
47
|
-
target_entities: [Lesson, LectureOnline]
|
|
48
|
-
source_code: "LectureCommandServiceImpl.createNewPodoLecture()"
|
|
49
|
-
- id: SCHEDULE-1
|
|
50
|
-
name: MatchTutor
|
|
51
|
-
display_name: "튜터 매칭"
|
|
52
|
-
domain: schedule
|
|
53
|
-
actor: Student
|
|
54
|
-
target_entities: [Lesson]
|
|
55
|
-
source_code: "PodoScheduleServiceImplV2.match()"
|
|
56
|
-
read_actions:
|
|
57
|
-
- id: LEC-R1
|
|
58
|
-
name: GetLessonDetail
|
|
59
|
-
display_name: "수업 상세 조회"
|
|
60
|
-
domain: lecture
|
|
61
|
-
actor: Student
|
|
62
|
-
target_entities: [Lesson]
|
|
63
|
-
source_code: "LectureGateway.getLectureDetail()"
|
|
64
|
-
`;
|
|
65
|
-
const TRANSITIONS_YAML = `
|
|
66
|
-
version: "1.0"
|
|
67
|
-
entities:
|
|
68
|
-
- name: Lesson
|
|
69
|
-
state_fields:
|
|
70
|
-
- field_name: invoice_status
|
|
71
|
-
transitions:
|
|
72
|
-
- id: L1
|
|
73
|
-
from: null
|
|
74
|
-
to: CREATED
|
|
75
|
-
trigger: "학생이 수업 생성 (예습 시작)"
|
|
76
|
-
source_code: "LectureCommandServiceImpl.createNewPodoLecture()"
|
|
77
|
-
- id: L2
|
|
78
|
-
from: CREATED
|
|
79
|
-
to: RESERVED
|
|
80
|
-
trigger: "학생이 시간 선택 + 튜터 매칭"
|
|
81
|
-
source_code: "PodoScheduleServiceImplV2.match()"
|
|
82
|
-
- id: L4
|
|
83
|
-
from: RESERVED
|
|
84
|
-
to: CANCEL
|
|
85
|
-
trigger: "학생이 수업 시작 2시간+ 전 취소"
|
|
86
|
-
source_code: "PodoScheduleServiceImplV2.cancel()"
|
|
87
|
-
- name: Ticket
|
|
88
|
-
state_fields:
|
|
89
|
-
- field_name: status
|
|
90
|
-
transitions:
|
|
91
|
-
- id: T1
|
|
92
|
-
from: null
|
|
93
|
-
to: ACTIVE
|
|
94
|
-
trigger: "수강권 활성화"
|
|
95
|
-
source_code: "TicketService.activate()"
|
|
96
|
-
`;
|
|
97
|
-
// ─── Tests ───
|
|
98
|
-
describe("buildOntologyIndex", () => {
|
|
99
|
-
describe("정상 YAML 파싱 → 인덱스 구성", () => {
|
|
100
|
-
it("glossary를 파싱하고 canonical name(소문자)으로 키를 설정한다", () => {
|
|
101
|
-
const index = buildOntologyIndex(ONTOLOGY_YAML, "", "");
|
|
102
|
-
expect(index.glossary.size).toBe(4);
|
|
103
|
-
expect(index.glossary.has("lesson")).toBe(true);
|
|
104
|
-
expect(index.glossary.has("tutor")).toBe(true);
|
|
105
|
-
expect(index.glossary.has("student")).toBe(true);
|
|
106
|
-
expect(index.glossary.has("ticket")).toBe(true);
|
|
107
|
-
const lesson = index.glossary.get("lesson");
|
|
108
|
-
expect(lesson.canonical).toBe("Lesson");
|
|
109
|
-
expect(lesson.meaning).toBe("수업");
|
|
110
|
-
expect(lesson.legacy_aliases).toEqual(["Class", "Lecture"]);
|
|
111
|
-
expect(lesson.code_entity).toBe("Lecture");
|
|
112
|
-
expect(lesson.db_table).toBe("GT_CLASS");
|
|
113
|
-
expect(lesson.fk_variants).toEqual(["classId", "class_id", "lectureId"]);
|
|
114
|
-
});
|
|
115
|
-
it("actions를 파싱하고 action id로 키를 설정한다", () => {
|
|
116
|
-
const index = buildOntologyIndex("", ACTIONS_YAML, "");
|
|
117
|
-
expect(index.actions.size).toBe(4);
|
|
118
|
-
expect(index.actions.has("AUTH-1")).toBe(true);
|
|
119
|
-
expect(index.actions.has("LEC-1")).toBe(true);
|
|
120
|
-
expect(index.actions.has("SCHEDULE-1")).toBe(true);
|
|
121
|
-
expect(index.actions.has("LEC-R1")).toBe(true);
|
|
122
|
-
const auth1 = index.actions.get("AUTH-1");
|
|
123
|
-
expect(auth1.name).toBe("SocialLogin");
|
|
124
|
-
expect(auth1.display_name).toBe("소셜 로그인");
|
|
125
|
-
expect(auth1.domain).toBe("auth");
|
|
126
|
-
expect(auth1.actor).toBe("Student");
|
|
127
|
-
expect(auth1.target_entities).toEqual(["Student", "UserOauthMapping"]);
|
|
128
|
-
expect(auth1.source_code).toBe("AuthenticationGateway.oauthLogin(), OauthService.authenticate()");
|
|
129
|
-
});
|
|
130
|
-
it("write_actions와 read_actions 모두 파싱한다", () => {
|
|
131
|
-
const index = buildOntologyIndex("", ACTIONS_YAML, "");
|
|
132
|
-
// write_actions: AUTH-1, LEC-1, SCHEDULE-1
|
|
133
|
-
// read_actions: LEC-R1
|
|
134
|
-
expect(index.actions.has("LEC-R1")).toBe(true);
|
|
135
|
-
const readAction = index.actions.get("LEC-R1");
|
|
136
|
-
expect(readAction.display_name).toBe("수업 상세 조회");
|
|
137
|
-
});
|
|
138
|
-
it("transitions를 파싱하고 entity name(소문자)으로 키를 설정한다", () => {
|
|
139
|
-
const index = buildOntologyIndex("", "", TRANSITIONS_YAML);
|
|
140
|
-
expect(index.transitions.size).toBe(2);
|
|
141
|
-
expect(index.transitions.has("lesson")).toBe(true);
|
|
142
|
-
expect(index.transitions.has("ticket")).toBe(true);
|
|
143
|
-
const lessonTransitions = index.transitions.get("lesson");
|
|
144
|
-
expect(lessonTransitions).toHaveLength(3);
|
|
145
|
-
const l1 = lessonTransitions[0];
|
|
146
|
-
expect(l1.entity).toBe("Lesson");
|
|
147
|
-
expect(l1.field_name).toBe("invoice_status");
|
|
148
|
-
expect(l1.from).toBe("(none)");
|
|
149
|
-
expect(l1.to).toBe("CREATED");
|
|
150
|
-
expect(l1.trigger).toBe("학생이 수업 생성 (예습 시작)");
|
|
151
|
-
const l2 = lessonTransitions[1];
|
|
152
|
-
expect(l2.from).toBe("CREATED");
|
|
153
|
-
expect(l2.to).toBe("RESERVED");
|
|
154
|
-
});
|
|
155
|
-
it("3개 YAML을 모두 전달하면 전체 인덱스가 구성된다", () => {
|
|
156
|
-
const index = buildOntologyIndex(ONTOLOGY_YAML, ACTIONS_YAML, TRANSITIONS_YAML);
|
|
157
|
-
expect(index.glossary.size).toBe(4);
|
|
158
|
-
expect(index.actions.size).toBe(4);
|
|
159
|
-
expect(index.transitions.size).toBe(2);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
describe("빈 YAML → 빈 Map (에러 아님)", () => {
|
|
163
|
-
it("빈 문자열이면 모든 섹션이 빈 Map이다", () => {
|
|
164
|
-
const index = buildOntologyIndex("", "", "");
|
|
165
|
-
expect(index.glossary.size).toBe(0);
|
|
166
|
-
expect(index.actions.size).toBe(0);
|
|
167
|
-
expect(index.transitions.size).toBe(0);
|
|
168
|
-
});
|
|
169
|
-
it("공백만 있는 문자열도 빈 Map으로 처리한다", () => {
|
|
170
|
-
const index = buildOntologyIndex(" ", " \n ", "\t\n");
|
|
171
|
-
expect(index.glossary.size).toBe(0);
|
|
172
|
-
expect(index.actions.size).toBe(0);
|
|
173
|
-
expect(index.transitions.size).toBe(0);
|
|
174
|
-
});
|
|
175
|
-
it("부분적으로 빈 YAML이어도 나머지는 정상 파싱한다", () => {
|
|
176
|
-
const index = buildOntologyIndex(ONTOLOGY_YAML, "", TRANSITIONS_YAML);
|
|
177
|
-
expect(index.glossary.size).toBe(4);
|
|
178
|
-
expect(index.actions.size).toBe(0);
|
|
179
|
-
expect(index.transitions.size).toBe(2);
|
|
180
|
-
});
|
|
181
|
-
});
|
|
182
|
-
describe("잘못된 YAML → throw (빈 결과와 구분)", () => {
|
|
183
|
-
it("ontology YAML 파싱 에러 시 throw한다", () => {
|
|
184
|
-
const badYaml = "glossary:\n - canonical: [invalid\n meaning: broken";
|
|
185
|
-
expect(() => buildOntologyIndex(badYaml, "", "")).toThrow();
|
|
186
|
-
});
|
|
187
|
-
it("actions YAML 파싱 에러 시 throw한다", () => {
|
|
188
|
-
const badYaml = "write_actions:\n - id: [broken\n name: bad";
|
|
189
|
-
expect(() => buildOntologyIndex("", badYaml, "")).toThrow();
|
|
190
|
-
});
|
|
191
|
-
it("transitions YAML 파싱 에러 시 throw한다", () => {
|
|
192
|
-
const badYaml = "entities:\n - name: [broken\n state_fields: bad";
|
|
193
|
-
expect(() => buildOntologyIndex("", "", badYaml)).toThrow();
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
describe("엣지 케이스", () => {
|
|
197
|
-
it("glossary가 없는 YAML도 빈 Map으로 처리한다", () => {
|
|
198
|
-
const yamlWithoutGlossary = "version: '1.0'\nmetadata:\n title: test";
|
|
199
|
-
const index = buildOntologyIndex(yamlWithoutGlossary, "", "");
|
|
200
|
-
expect(index.glossary.size).toBe(0);
|
|
201
|
-
});
|
|
202
|
-
it("target_entities가 null인 action도 처리한다", () => {
|
|
203
|
-
const actionsWithNull = `
|
|
204
|
-
write_actions:
|
|
205
|
-
- id: AUTH-2
|
|
206
|
-
name: Logout
|
|
207
|
-
display_name: "로그아웃"
|
|
208
|
-
domain: auth
|
|
209
|
-
actor: Student
|
|
210
|
-
target_entities: null
|
|
211
|
-
source_code: "AuthenticationGateway.logout()"
|
|
212
|
-
`;
|
|
213
|
-
const index = buildOntologyIndex("", actionsWithNull, "");
|
|
214
|
-
const action = index.actions.get("AUTH-2");
|
|
215
|
-
expect(action.target_entities).toEqual([]);
|
|
216
|
-
});
|
|
217
|
-
it("from이 null인 transition은 '(none)'으로 변환한다", () => {
|
|
218
|
-
const index = buildOntologyIndex("", "", TRANSITIONS_YAML);
|
|
219
|
-
const lessonTransitions = index.transitions.get("lesson");
|
|
220
|
-
const l1 = lessonTransitions[0];
|
|
221
|
-
expect(l1.from).toBe("(none)");
|
|
222
|
-
});
|
|
223
|
-
it("glossary에 중복 key가 있으면 console.warn을 출력한다", () => {
|
|
224
|
-
const duplicateYaml = `
|
|
225
|
-
glossary:
|
|
226
|
-
- canonical: Lesson
|
|
227
|
-
meaning: "수업"
|
|
228
|
-
legacy_aliases: []
|
|
229
|
-
fk_variants: []
|
|
230
|
-
- canonical: lesson
|
|
231
|
-
meaning: "수업 (중복)"
|
|
232
|
-
legacy_aliases: []
|
|
233
|
-
fk_variants: []
|
|
234
|
-
`;
|
|
235
|
-
const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => { });
|
|
236
|
-
const index = buildOntologyIndex(duplicateYaml, "", "");
|
|
237
|
-
expect(warnSpy).toHaveBeenCalledOnce();
|
|
238
|
-
expect(warnSpy).toHaveBeenCalledWith('[sprint-kit] [ontology] Duplicate glossary key: "lesson" (canonical: "lesson")', "");
|
|
239
|
-
// 후속 항목이 덮어쓰기
|
|
240
|
-
expect(index.glossary.size).toBe(1);
|
|
241
|
-
expect(index.glossary.get("lesson").meaning).toBe("수업 (중복)");
|
|
242
|
-
warnSpy.mockRestore();
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
});
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
// ─── Query Function ───
|
|
2
|
-
/**
|
|
3
|
-
* 키워드 목록으로 온톨로지 인덱스에서 관련 항목을 조회합니다.
|
|
4
|
-
*
|
|
5
|
-
* 매칭 로직:
|
|
6
|
-
* - glossary의 canonical, meaning, legacy_aliases에서 대소문자 무시 부분 매칭
|
|
7
|
-
* - 매칭된 entity를 기반으로 actions과 transitions에서 관련 항목 수집
|
|
8
|
-
* - 0건이면 빈 결과 반환 (caller가 Full Scan fallback 판단)
|
|
9
|
-
*/
|
|
10
|
-
export function queryOntology(index, keywords) {
|
|
11
|
-
if (keywords.length === 0) {
|
|
12
|
-
return { ...emptyResult(), total_glossary_count: index.glossary.size };
|
|
13
|
-
}
|
|
14
|
-
const matchedEntries = findMatchingGlossaryEntries(index, keywords);
|
|
15
|
-
if (matchedEntries.length === 0) {
|
|
16
|
-
return { ...emptyResult(), total_glossary_count: index.glossary.size };
|
|
17
|
-
}
|
|
18
|
-
const matched_entities = matchedEntries.map((e) => e.canonical);
|
|
19
|
-
const db_tables = collectDbTables(matchedEntries);
|
|
20
|
-
const related_actions = collectRelatedActions(index, matched_entities);
|
|
21
|
-
const code_locations = collectCodeLocations(related_actions);
|
|
22
|
-
const related_transitions = collectRelatedTransitions(index, matched_entities);
|
|
23
|
-
const value_filters = collectValueFilters(matchedEntries);
|
|
24
|
-
return {
|
|
25
|
-
matched_entities,
|
|
26
|
-
code_locations,
|
|
27
|
-
db_tables,
|
|
28
|
-
related_actions,
|
|
29
|
-
related_transitions,
|
|
30
|
-
value_filters,
|
|
31
|
-
total_glossary_count: index.glossary.size,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
// ─── Internal Helpers ───
|
|
35
|
-
function emptyResult() {
|
|
36
|
-
return {
|
|
37
|
-
matched_entities: [],
|
|
38
|
-
code_locations: [],
|
|
39
|
-
db_tables: [],
|
|
40
|
-
related_actions: [],
|
|
41
|
-
related_transitions: [],
|
|
42
|
-
value_filters: [],
|
|
43
|
-
total_glossary_count: 0,
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* 키워드와 매칭되는 glossary 항목을 찾습니다.
|
|
48
|
-
* canonical, meaning, legacy_aliases 에서 대소문자 무시 부분 매칭.
|
|
49
|
-
*/
|
|
50
|
-
function findMatchingGlossaryEntries(index, keywords) {
|
|
51
|
-
const lowerKeywords = keywords.map((k) => k.toLowerCase());
|
|
52
|
-
const matched = [];
|
|
53
|
-
const seen = new Set();
|
|
54
|
-
for (const entry of index.glossary.values()) {
|
|
55
|
-
if (isGlossaryMatch(entry, lowerKeywords) && !seen.has(entry.canonical)) {
|
|
56
|
-
seen.add(entry.canonical);
|
|
57
|
-
matched.push(entry);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
return matched;
|
|
61
|
-
}
|
|
62
|
-
function isGlossaryMatch(entry, lowerKeywords) {
|
|
63
|
-
const canonicalLower = entry.canonical.toLowerCase();
|
|
64
|
-
const meaningLower = entry.meaning.toLowerCase();
|
|
65
|
-
const aliasesLower = entry.legacy_aliases.map((a) => a.toLowerCase());
|
|
66
|
-
return lowerKeywords.some((kw) => {
|
|
67
|
-
if (canonicalLower.includes(kw))
|
|
68
|
-
return true;
|
|
69
|
-
if (meaningLower.includes(kw))
|
|
70
|
-
return true;
|
|
71
|
-
if (aliasesLower.some((alias) => alias.includes(kw)))
|
|
72
|
-
return true;
|
|
73
|
-
return false;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
function collectDbTables(entries) {
|
|
77
|
-
const tables = [];
|
|
78
|
-
for (const entry of entries) {
|
|
79
|
-
if (entry.db_table) {
|
|
80
|
-
tables.push(entry.db_table);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return tables;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* 매칭된 entity 목록을 기반으로 관련 action을 수집합니다.
|
|
87
|
-
* action의 target_entities에 매칭된 entity가 포함되어 있으면 관련 action.
|
|
88
|
-
*/
|
|
89
|
-
function collectRelatedActions(index, matchedEntities) {
|
|
90
|
-
const entitySet = new Set(matchedEntities.map((e) => e.toLowerCase()));
|
|
91
|
-
const results = [];
|
|
92
|
-
for (const action of index.actions.values()) {
|
|
93
|
-
const hasMatch = action.target_entities.some((te) => entitySet.has(te.toLowerCase()));
|
|
94
|
-
if (hasMatch) {
|
|
95
|
-
results.push({
|
|
96
|
-
id: action.id,
|
|
97
|
-
display_name: action.display_name,
|
|
98
|
-
source_code: action.source_code,
|
|
99
|
-
guard_note: action.guard_note,
|
|
100
|
-
preconditions: action.preconditions,
|
|
101
|
-
results: action.results,
|
|
102
|
-
state_transitions: action.state_transitions,
|
|
103
|
-
side_effects: action.side_effects,
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return results;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* action의 source_code에서 CodeLocation을 추출합니다.
|
|
111
|
-
*/
|
|
112
|
-
function collectCodeLocations(actions) {
|
|
113
|
-
const locations = [];
|
|
114
|
-
for (const action of actions) {
|
|
115
|
-
if (!action.source_code || action.source_code === "(외부)")
|
|
116
|
-
continue;
|
|
117
|
-
locations.push({
|
|
118
|
-
reference: action.source_code,
|
|
119
|
-
context: `Action ${action.id}: ${action.display_name}`,
|
|
120
|
-
entity: action.id.split("-")[0] ?? "",
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
return locations;
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* 매칭된 entity 목록을 기반으로 관련 transition을 수집합니다.
|
|
127
|
-
*/
|
|
128
|
-
function collectRelatedTransitions(index, matchedEntities) {
|
|
129
|
-
const results = [];
|
|
130
|
-
for (const entityName of matchedEntities) {
|
|
131
|
-
const key = entityName.toLowerCase();
|
|
132
|
-
const transitions = index.transitions.get(key);
|
|
133
|
-
if (!transitions)
|
|
134
|
-
continue;
|
|
135
|
-
for (const t of transitions) {
|
|
136
|
-
results.push({
|
|
137
|
-
id: t.id,
|
|
138
|
-
entity: t.entity,
|
|
139
|
-
field_name: t.field_name,
|
|
140
|
-
from: t.from,
|
|
141
|
-
to: t.to,
|
|
142
|
-
trigger: t.trigger,
|
|
143
|
-
source_code: t.source_code,
|
|
144
|
-
guards: t.guards,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return results;
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* 매칭된 glossary 항목에서 value_filters를 수집합니다.
|
|
152
|
-
*/
|
|
153
|
-
function collectValueFilters(entries) {
|
|
154
|
-
const results = [];
|
|
155
|
-
for (const entry of entries) {
|
|
156
|
-
if (!entry.value_filters)
|
|
157
|
-
continue;
|
|
158
|
-
for (const vf of entry.value_filters) {
|
|
159
|
-
results.push({
|
|
160
|
-
entity: entry.canonical,
|
|
161
|
-
column: vf.column,
|
|
162
|
-
value: vf.value,
|
|
163
|
-
description: vf.description,
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
return results;
|
|
168
|
-
}
|