@noyrax/5d-database-plugin 0.1.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/ADR_VORSCHLAEGE.md +247 -0
- package/CHROMADB_SETUP.md +69 -0
- package/IMPROVEMENT_ROADMAP.md +435 -0
- package/INSTALLATION_READINESS.md +150 -0
- package/KNOWN_ISSUES.md +210 -0
- package/LICENSE +21 -0
- package/MCP_SERVER_SETUP.md +359 -0
- package/MCP_SERVER_TEST_REPORT.md +206 -0
- package/NOYRAX_INTEGRATION.md +224 -0
- package/QUICK_START.md +316 -0
- package/README.md +240 -0
- package/SETUP_NEW_PROJECT.md +260 -0
- package/SYSTEM_ANALYSIS_REPORT.md +341 -0
- package/out/api/adr-api.d.ts +22 -0
- package/out/api/adr-api.d.ts.map +1 -0
- package/out/api/adr-api.js +38 -0
- package/out/api/adr-api.js.map +1 -0
- package/out/api/bootstrap-api.d.ts +43 -0
- package/out/api/bootstrap-api.d.ts.map +1 -0
- package/out/api/bootstrap-api.js +88 -0
- package/out/api/bootstrap-api.js.map +1 -0
- package/out/api/change-api.d.ts +30 -0
- package/out/api/change-api.d.ts.map +1 -0
- package/out/api/change-api.js +54 -0
- package/out/api/change-api.js.map +1 -0
- package/out/api/context-builder.d.ts +81 -0
- package/out/api/context-builder.d.ts.map +1 -0
- package/out/api/context-builder.js +288 -0
- package/out/api/context-builder.js.map +1 -0
- package/out/api/cross-dimension-api.d.ts +43 -0
- package/out/api/cross-dimension-api.d.ts.map +1 -0
- package/out/api/cross-dimension-api.js +55 -0
- package/out/api/cross-dimension-api.js.map +1 -0
- package/out/api/dependency-api.d.ts +26 -0
- package/out/api/dependency-api.d.ts.map +1 -0
- package/out/api/dependency-api.js +46 -0
- package/out/api/dependency-api.js.map +1 -0
- package/out/api/learning-path-api.d.ts +49 -0
- package/out/api/learning-path-api.d.ts.map +1 -0
- package/out/api/learning-path-api.js +174 -0
- package/out/api/learning-path-api.js.map +1 -0
- package/out/api/module-api.d.ts +26 -0
- package/out/api/module-api.d.ts.map +1 -0
- package/out/api/module-api.js +46 -0
- package/out/api/module-api.js.map +1 -0
- package/out/api/search-api.d.ts +64 -0
- package/out/api/search-api.d.ts.map +1 -0
- package/out/api/search-api.js +235 -0
- package/out/api/search-api.js.map +1 -0
- package/out/api/self-explanation-api.d.ts +71 -0
- package/out/api/self-explanation-api.d.ts.map +1 -0
- package/out/api/self-explanation-api.js +153 -0
- package/out/api/self-explanation-api.js.map +1 -0
- package/out/api/semantic-search-api.d.ts +64 -0
- package/out/api/semantic-search-api.d.ts.map +1 -0
- package/out/api/semantic-search-api.js +205 -0
- package/out/api/semantic-search-api.js.map +1 -0
- package/out/api/symbol-api.d.ts +22 -0
- package/out/api/symbol-api.d.ts.map +1 -0
- package/out/api/symbol-api.js +38 -0
- package/out/api/symbol-api.js.map +1 -0
- package/out/api/vector-api.d.ts +26 -0
- package/out/api/vector-api.d.ts.map +1 -0
- package/out/api/vector-api.js +49 -0
- package/out/api/vector-api.js.map +1 -0
- package/out/cli/embedding-cli.d.ts +3 -0
- package/out/cli/embedding-cli.d.ts.map +1 -0
- package/out/cli/embedding-cli.js +151 -0
- package/out/cli/embedding-cli.js.map +1 -0
- package/out/cli/ingest-cli.d.ts +3 -0
- package/out/cli/ingest-cli.d.ts.map +1 -0
- package/out/cli/ingest-cli.js +145 -0
- package/out/cli/ingest-cli.js.map +1 -0
- package/out/cli/mcp-server-cli.d.ts +3 -0
- package/out/cli/mcp-server-cli.d.ts.map +1 -0
- package/out/cli/mcp-server-cli.js +159 -0
- package/out/cli/mcp-server-cli.js.map +1 -0
- package/out/cli/query-cli.d.ts +3 -0
- package/out/cli/query-cli.d.ts.map +1 -0
- package/out/cli/query-cli.js +217 -0
- package/out/cli/query-cli.js.map +1 -0
- package/out/cli/semantic-search-cli.d.ts +3 -0
- package/out/cli/semantic-search-cli.d.ts.map +1 -0
- package/out/cli/semantic-search-cli.js +196 -0
- package/out/cli/semantic-search-cli.js.map +1 -0
- package/out/cli/test-chromadb.d.ts +3 -0
- package/out/cli/test-chromadb.d.ts.map +1 -0
- package/out/cli/test-chromadb.js +204 -0
- package/out/cli/test-chromadb.js.map +1 -0
- package/out/cli/test-v-dimension.d.ts +3 -0
- package/out/cli/test-v-dimension.d.ts.map +1 -0
- package/out/cli/test-v-dimension.js +330 -0
- package/out/cli/test-v-dimension.js.map +1 -0
- package/out/cli/tool-cli.d.ts +3 -0
- package/out/cli/tool-cli.d.ts.map +1 -0
- package/out/cli/tool-cli.js +237 -0
- package/out/cli/tool-cli.js.map +1 -0
- package/out/cli/verify-openai-key.d.ts +3 -0
- package/out/cli/verify-openai-key.d.ts.map +1 -0
- package/out/cli/verify-openai-key.js +141 -0
- package/out/cli/verify-openai-key.js.map +1 -0
- package/out/cli/verify-vss-status.d.ts +3 -0
- package/out/cli/verify-vss-status.d.ts.map +1 -0
- package/out/cli/verify-vss-status.js +185 -0
- package/out/cli/verify-vss-status.js.map +1 -0
- package/out/core/chromadb-vector-database.d.ts +52 -0
- package/out/core/chromadb-vector-database.d.ts.map +1 -0
- package/out/core/chromadb-vector-database.js +276 -0
- package/out/core/chromadb-vector-database.js.map +1 -0
- package/out/core/docs-path-resolver.d.ts +43 -0
- package/out/core/docs-path-resolver.d.ts.map +1 -0
- package/out/core/docs-path-resolver.js +137 -0
- package/out/core/docs-path-resolver.js.map +1 -0
- package/out/core/id-mapper.d.ts +68 -0
- package/out/core/id-mapper.d.ts.map +1 -0
- package/out/core/id-mapper.js +132 -0
- package/out/core/id-mapper.js.map +1 -0
- package/out/core/migration-manager.d.ts +75 -0
- package/out/core/migration-manager.d.ts.map +1 -0
- package/out/core/migration-manager.js +212 -0
- package/out/core/migration-manager.js.map +1 -0
- package/out/core/multi-db-manager.d.ts +84 -0
- package/out/core/multi-db-manager.d.ts.map +1 -0
- package/out/core/multi-db-manager.js +206 -0
- package/out/core/multi-db-manager.js.map +1 -0
- package/out/core/transaction-manager.d.ts +69 -0
- package/out/core/transaction-manager.d.ts.map +1 -0
- package/out/core/transaction-manager.js +138 -0
- package/out/core/transaction-manager.js.map +1 -0
- package/out/core/vector-database-factory.d.ts +25 -0
- package/out/core/vector-database-factory.d.ts.map +1 -0
- package/out/core/vector-database-factory.js +82 -0
- package/out/core/vector-database-factory.js.map +1 -0
- package/out/core/vector-database-interface.d.ts +50 -0
- package/out/core/vector-database-interface.d.ts.map +1 -0
- package/out/core/vector-database-interface.js +3 -0
- package/out/core/vector-database-interface.js.map +1 -0
- package/out/core/vss-loader.d.ts +29 -0
- package/out/core/vss-loader.d.ts.map +1 -0
- package/out/core/vss-loader.js +150 -0
- package/out/core/vss-loader.js.map +1 -0
- package/out/core/vss-manager.d.ts +81 -0
- package/out/core/vss-manager.d.ts.map +1 -0
- package/out/core/vss-manager.js +323 -0
- package/out/core/vss-manager.js.map +1 -0
- package/out/core/vss-vector-database.d.ts +71 -0
- package/out/core/vss-vector-database.d.ts.map +1 -0
- package/out/core/vss-vector-database.js +284 -0
- package/out/core/vss-vector-database.js.map +1 -0
- package/out/embedding/embedding-generator.d.ts +45 -0
- package/out/embedding/embedding-generator.d.ts.map +1 -0
- package/out/embedding/embedding-generator.js +143 -0
- package/out/embedding/embedding-generator.js.map +1 -0
- package/out/embedding/embedding-pipeline.d.ts +42 -0
- package/out/embedding/embedding-pipeline.d.ts.map +1 -0
- package/out/embedding/embedding-pipeline.js +290 -0
- package/out/embedding/embedding-pipeline.js.map +1 -0
- package/out/extension.d.ts +10 -0
- package/out/extension.d.ts.map +1 -0
- package/out/extension.js +164 -0
- package/out/extension.js.map +1 -0
- package/out/ingestors/adr-ingestor.d.ts +41 -0
- package/out/ingestors/adr-ingestor.d.ts.map +1 -0
- package/out/ingestors/adr-ingestor.js +329 -0
- package/out/ingestors/adr-ingestor.js.map +1 -0
- package/out/ingestors/base-ingestor.d.ts +30 -0
- package/out/ingestors/base-ingestor.d.ts.map +1 -0
- package/out/ingestors/base-ingestor.js +3 -0
- package/out/ingestors/base-ingestor.js.map +1 -0
- package/out/ingestors/change-ingestor.d.ts +36 -0
- package/out/ingestors/change-ingestor.d.ts.map +1 -0
- package/out/ingestors/change-ingestor.js +216 -0
- package/out/ingestors/change-ingestor.js.map +1 -0
- package/out/ingestors/dependency-ingestor.d.ts +32 -0
- package/out/ingestors/dependency-ingestor.d.ts.map +1 -0
- package/out/ingestors/dependency-ingestor.js +194 -0
- package/out/ingestors/dependency-ingestor.js.map +1 -0
- package/out/ingestors/module-ingestor.d.ts +27 -0
- package/out/ingestors/module-ingestor.d.ts.map +1 -0
- package/out/ingestors/module-ingestor.js +137 -0
- package/out/ingestors/module-ingestor.js.map +1 -0
- package/out/ingestors/symbol-ingestor.d.ts +26 -0
- package/out/ingestors/symbol-ingestor.d.ts.map +1 -0
- package/out/ingestors/symbol-ingestor.js +183 -0
- package/out/ingestors/symbol-ingestor.js.map +1 -0
- package/out/mcp/resources/adrs.d.ts +13 -0
- package/out/mcp/resources/adrs.d.ts.map +1 -0
- package/out/mcp/resources/adrs.js +26 -0
- package/out/mcp/resources/adrs.js.map +1 -0
- package/out/mcp/resources/changes.d.ts +13 -0
- package/out/mcp/resources/changes.d.ts.map +1 -0
- package/out/mcp/resources/changes.js +26 -0
- package/out/mcp/resources/changes.js.map +1 -0
- package/out/mcp/resources/dependencies.d.ts +13 -0
- package/out/mcp/resources/dependencies.d.ts.map +1 -0
- package/out/mcp/resources/dependencies.js +26 -0
- package/out/mcp/resources/dependencies.js.map +1 -0
- package/out/mcp/resources/modules.d.ts +13 -0
- package/out/mcp/resources/modules.d.ts.map +1 -0
- package/out/mcp/resources/modules.js +26 -0
- package/out/mcp/resources/modules.js.map +1 -0
- package/out/mcp/resources/symbols.d.ts +13 -0
- package/out/mcp/resources/symbols.d.ts.map +1 -0
- package/out/mcp/resources/symbols.js +26 -0
- package/out/mcp/resources/symbols.js.map +1 -0
- package/out/mcp/server.d.ts +29 -0
- package/out/mcp/server.d.ts.map +1 -0
- package/out/mcp/server.js +300 -0
- package/out/mcp/server.js.map +1 -0
- package/out/mcp/tools/architecture-mining.d.ts +46 -0
- package/out/mcp/tools/architecture-mining.d.ts.map +1 -0
- package/out/mcp/tools/architecture-mining.js +272 -0
- package/out/mcp/tools/architecture-mining.js.map +1 -0
- package/out/mcp/tools/bootstrap.d.ts +9 -0
- package/out/mcp/tools/bootstrap.d.ts.map +1 -0
- package/out/mcp/tools/bootstrap.js +14 -0
- package/out/mcp/tools/bootstrap.js.map +1 -0
- package/out/mcp/tools/cross-analysis.d.ts +18 -0
- package/out/mcp/tools/cross-analysis.d.ts.map +1 -0
- package/out/mcp/tools/cross-analysis.js +23 -0
- package/out/mcp/tools/cross-analysis.js.map +1 -0
- package/out/mcp/tools/gap-analysis.d.ts +34 -0
- package/out/mcp/tools/gap-analysis.d.ts.map +1 -0
- package/out/mcp/tools/gap-analysis.js +106 -0
- package/out/mcp/tools/gap-analysis.js.map +1 -0
- package/out/mcp/tools/learning-path.d.ts +10 -0
- package/out/mcp/tools/learning-path.d.ts.map +1 -0
- package/out/mcp/tools/learning-path.js +18 -0
- package/out/mcp/tools/learning-path.js.map +1 -0
- package/out/mcp/tools/query-dependencies.d.ts +18 -0
- package/out/mcp/tools/query-dependencies.d.ts.map +1 -0
- package/out/mcp/tools/query-dependencies.js +31 -0
- package/out/mcp/tools/query-dependencies.js.map +1 -0
- package/out/mcp/tools/query-modules.d.ts +17 -0
- package/out/mcp/tools/query-modules.d.ts.map +1 -0
- package/out/mcp/tools/query-modules.js +22 -0
- package/out/mcp/tools/query-modules.js.map +1 -0
- package/out/mcp/tools/query-symbols.d.ts +18 -0
- package/out/mcp/tools/query-symbols.d.ts.map +1 -0
- package/out/mcp/tools/query-symbols.js +32 -0
- package/out/mcp/tools/query-symbols.js.map +1 -0
- package/out/mcp/tools/semantic-discovery.d.ts +12 -0
- package/out/mcp/tools/semantic-discovery.d.ts.map +1 -0
- package/out/mcp/tools/semantic-discovery.js +35 -0
- package/out/mcp/tools/semantic-discovery.js.map +1 -0
- package/out/mcp/tools/system-explanation.d.ts +9 -0
- package/out/mcp/tools/system-explanation.d.ts.map +1 -0
- package/out/mcp/tools/system-explanation.js +14 -0
- package/out/mcp/tools/system-explanation.js.map +1 -0
- package/out/mcp/types.d.ts +19 -0
- package/out/mcp/types.d.ts.map +1 -0
- package/out/mcp/types.js +6 -0
- package/out/mcp/types.js.map +1 -0
- package/out/models/adr.d.ts +26 -0
- package/out/models/adr.d.ts.map +1 -0
- package/out/models/adr.js +3 -0
- package/out/models/adr.js.map +1 -0
- package/out/models/change.d.ts +42 -0
- package/out/models/change.d.ts.map +1 -0
- package/out/models/change.js +3 -0
- package/out/models/change.js.map +1 -0
- package/out/models/dependency.d.ts +37 -0
- package/out/models/dependency.d.ts.map +1 -0
- package/out/models/dependency.js +3 -0
- package/out/models/dependency.js.map +1 -0
- package/out/models/entity-reference.d.ts +20 -0
- package/out/models/entity-reference.d.ts.map +1 -0
- package/out/models/entity-reference.js +19 -0
- package/out/models/entity-reference.js.map +1 -0
- package/out/models/module.d.ts +26 -0
- package/out/models/module.d.ts.map +1 -0
- package/out/models/module.js +3 -0
- package/out/models/module.js.map +1 -0
- package/out/models/symbol.d.ts +31 -0
- package/out/models/symbol.d.ts.map +1 -0
- package/out/models/symbol.js +3 -0
- package/out/models/symbol.js.map +1 -0
- package/out/repositories/adr-repository.d.ts +41 -0
- package/out/repositories/adr-repository.d.ts.map +1 -0
- package/out/repositories/adr-repository.js +128 -0
- package/out/repositories/adr-repository.js.map +1 -0
- package/out/repositories/base-repository.d.ts +86 -0
- package/out/repositories/base-repository.d.ts.map +1 -0
- package/out/repositories/base-repository.js +66 -0
- package/out/repositories/base-repository.js.map +1 -0
- package/out/repositories/change-repository.d.ts +40 -0
- package/out/repositories/change-repository.d.ts.map +1 -0
- package/out/repositories/change-repository.js +150 -0
- package/out/repositories/change-repository.js.map +1 -0
- package/out/repositories/dependency-repository.d.ts +40 -0
- package/out/repositories/dependency-repository.d.ts.map +1 -0
- package/out/repositories/dependency-repository.js +129 -0
- package/out/repositories/dependency-repository.js.map +1 -0
- package/out/repositories/embedding-repository.d.ts +64 -0
- package/out/repositories/embedding-repository.d.ts.map +1 -0
- package/out/repositories/embedding-repository.js +126 -0
- package/out/repositories/embedding-repository.js.map +1 -0
- package/out/repositories/importance-repository.d.ts +63 -0
- package/out/repositories/importance-repository.d.ts.map +1 -0
- package/out/repositories/importance-repository.js +117 -0
- package/out/repositories/importance-repository.js.map +1 -0
- package/out/repositories/module-repository.d.ts +37 -0
- package/out/repositories/module-repository.d.ts.map +1 -0
- package/out/repositories/module-repository.js +122 -0
- package/out/repositories/module-repository.js.map +1 -0
- package/out/repositories/navigation-repository.d.ts +117 -0
- package/out/repositories/navigation-repository.d.ts.map +1 -0
- package/out/repositories/navigation-repository.js +211 -0
- package/out/repositories/navigation-repository.js.map +1 -0
- package/out/repositories/symbol-repository.d.ts +37 -0
- package/out/repositories/symbol-repository.d.ts.map +1 -0
- package/out/repositories/symbol-repository.js +136 -0
- package/out/repositories/symbol-repository.js.map +1 -0
- package/out/services/cross-dimension-linker.d.ts +45 -0
- package/out/services/cross-dimension-linker.d.ts.map +1 -0
- package/out/services/cross-dimension-linker.js +98 -0
- package/out/services/cross-dimension-linker.js.map +1 -0
- package/out/services/importance-scorer.d.ts +47 -0
- package/out/services/importance-scorer.d.ts.map +1 -0
- package/out/services/importance-scorer.js +188 -0
- package/out/services/importance-scorer.js.map +1 -0
- package/out/services/ingestion-orchestrator.d.ts +49 -0
- package/out/services/ingestion-orchestrator.d.ts.map +1 -0
- package/out/services/ingestion-orchestrator.js +140 -0
- package/out/services/ingestion-orchestrator.js.map +1 -0
- package/out/services/navigation-builder.d.ts +29 -0
- package/out/services/navigation-builder.d.ts.map +1 -0
- package/out/services/navigation-builder.js +229 -0
- package/out/services/navigation-builder.js.map +1 -0
- package/out/services/system-model-builder.d.ts +40 -0
- package/out/services/system-model-builder.d.ts.map +1 -0
- package/out/services/system-model-builder.js +88 -0
- package/out/services/system-model-builder.js.map +1 -0
- package/out/ui/commands.d.ts +9 -0
- package/out/ui/commands.d.ts.map +1 -0
- package/out/ui/commands.js +123 -0
- package/out/ui/commands.js.map +1 -0
- package/out/ui/database-explorer.d.ts +27 -0
- package/out/ui/database-explorer.d.ts.map +1 -0
- package/out/ui/database-explorer.js +169 -0
- package/out/ui/database-explorer.js.map +1 -0
- package/out/ui/detail-view-provider.d.ts +86 -0
- package/out/ui/detail-view-provider.d.ts.map +1 -0
- package/out/ui/detail-view-provider.js +1037 -0
- package/out/ui/detail-view-provider.js.map +1 -0
- package/out/ui/search-provider.d.ts +30 -0
- package/out/ui/search-provider.d.ts.map +1 -0
- package/out/ui/search-provider.js +240 -0
- package/out/ui/search-provider.js.map +1 -0
- package/out/ui/status-provider.d.ts +17 -0
- package/out/ui/status-provider.d.ts.map +1 -0
- package/out/ui/status-provider.js +76 -0
- package/out/ui/status-provider.js.map +1 -0
- package/out/validators/consistency-validator.d.ts +37 -0
- package/out/validators/consistency-validator.d.ts.map +1 -0
- package/out/validators/consistency-validator.js +93 -0
- package/out/validators/consistency-validator.js.map +1 -0
- package/out/validators/integrity-validator.d.ts +45 -0
- package/out/validators/integrity-validator.d.ts.map +1 -0
- package/out/validators/integrity-validator.js +115 -0
- package/out/validators/integrity-validator.js.map +1 -0
- package/package.json +173 -0
- package/schemas/sqlite/001_initial_modules.sql +39 -0
- package/schemas/sqlite/002_initial_symbols.sql +46 -0
- package/schemas/sqlite/003_initial_dependencies.sql +51 -0
- package/schemas/sqlite/004_initial_adrs.sql +41 -0
- package/schemas/sqlite/005_initial_changes.sql +54 -0
- package/schemas/sqlite/006_initial_ingestion.sql +34 -0
- package/schemas/sqlite/006_vectors_schema.sql +73 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { MultiDbManager } from '../core/multi-db-manager';
|
|
2
|
+
import { IdMapper } from '../core/id-mapper';
|
|
3
|
+
import { EntityReference } from '../models/entity-reference';
|
|
4
|
+
/**
|
|
5
|
+
* Links entities across dimensions using external IDs.
|
|
6
|
+
* Resolves cross-dimension references (e.g., symbol_id → module_id).
|
|
7
|
+
*/
|
|
8
|
+
export declare class CrossDimensionLinker {
|
|
9
|
+
private dbManager;
|
|
10
|
+
private idMapper;
|
|
11
|
+
constructor(dbManager: MultiDbManager, idMapper: IdMapper);
|
|
12
|
+
/**
|
|
13
|
+
* Resolves a symbol ID to its module reference.
|
|
14
|
+
*
|
|
15
|
+
* @param symbolId External symbol ID (e.g., ts://src/core/scanner.ts#scanWorkspace(...))
|
|
16
|
+
* @param pluginId The plugin ID
|
|
17
|
+
* @returns Entity reference to the module, or null if not found
|
|
18
|
+
*/
|
|
19
|
+
resolveSymbolToModule(symbolId: string, pluginId: string): Promise<EntityReference | null>;
|
|
20
|
+
/**
|
|
21
|
+
* Resolves an ADR number to its entity reference.
|
|
22
|
+
*
|
|
23
|
+
* @param adrNumber External ADR number (e.g., "020")
|
|
24
|
+
* @param pluginId The plugin ID
|
|
25
|
+
* @returns Entity reference to the ADR, or null if not found
|
|
26
|
+
*/
|
|
27
|
+
resolveAdrNumber(adrNumber: string, pluginId: string): Promise<EntityReference | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Gets all ADRs that reference a specific file path.
|
|
30
|
+
*
|
|
31
|
+
* @param filePath Repository-relative source path
|
|
32
|
+
* @param pluginId The plugin ID
|
|
33
|
+
* @returns Array of entity references to ADRs
|
|
34
|
+
*/
|
|
35
|
+
getAdrsForFilePath(filePath: string, pluginId: string): Promise<EntityReference[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Gets all symbols for a module.
|
|
38
|
+
*
|
|
39
|
+
* @param filePath Repository-relative source path
|
|
40
|
+
* @param pluginId The plugin ID
|
|
41
|
+
* @returns Array of entity references to symbols
|
|
42
|
+
*/
|
|
43
|
+
getSymbolsForModule(filePath: string, pluginId: string): Promise<EntityReference[]>;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=cross-dimension-linker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cross-dimension-linker.d.ts","sourceRoot":"","sources":["../../src/services/cross-dimension-linker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAE7D;;;GAGG;AACH,qBAAa,oBAAoB;IAC7B,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,QAAQ,CAAW;gBAEf,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,QAAQ;IAKzD;;;;;;OAMG;IACU,qBAAqB,CAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAwBlC;;;;;;OAMG;IACU,gBAAgB,CACzB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAgBlC;;;;;;OAMG;IACU,kBAAkB,CAC3B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,EAAE,CAAC;IAa7B;;;;;;OAMG;IACU,mBAAmB,CAC5B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACjB,OAAO,CAAC,eAAe,EAAE,CAAC;CAYhC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CrossDimensionLinker = void 0;
|
|
4
|
+
const module_repository_1 = require("../repositories/module-repository");
|
|
5
|
+
const symbol_repository_1 = require("../repositories/symbol-repository");
|
|
6
|
+
const adr_repository_1 = require("../repositories/adr-repository");
|
|
7
|
+
/**
|
|
8
|
+
* Links entities across dimensions using external IDs.
|
|
9
|
+
* Resolves cross-dimension references (e.g., symbol_id → module_id).
|
|
10
|
+
*/
|
|
11
|
+
class CrossDimensionLinker {
|
|
12
|
+
constructor(dbManager, idMapper) {
|
|
13
|
+
this.dbManager = dbManager;
|
|
14
|
+
this.idMapper = idMapper;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resolves a symbol ID to its module reference.
|
|
18
|
+
*
|
|
19
|
+
* @param symbolId External symbol ID (e.g., ts://src/core/scanner.ts#scanWorkspace(...))
|
|
20
|
+
* @param pluginId The plugin ID
|
|
21
|
+
* @returns Entity reference to the module, or null if not found
|
|
22
|
+
*/
|
|
23
|
+
async resolveSymbolToModule(symbolId, pluginId) {
|
|
24
|
+
const symbolDb = await this.dbManager.getDatabase('Y');
|
|
25
|
+
const symbolRepo = new symbol_repository_1.SymbolRepository(symbolDb);
|
|
26
|
+
const symbol = await symbolRepo.getBySymbolId(symbolId, pluginId);
|
|
27
|
+
if (!symbol) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const moduleDb = await this.dbManager.getDatabase('X');
|
|
31
|
+
const moduleRepo = new module_repository_1.ModuleRepository(moduleDb);
|
|
32
|
+
const module = await moduleRepo.getByFilePath(symbol.path, pluginId);
|
|
33
|
+
if (!module) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
dimension: 'X',
|
|
38
|
+
entity_id: module.id,
|
|
39
|
+
external_id: `${pluginId}:${module.file_path}`
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Resolves an ADR number to its entity reference.
|
|
44
|
+
*
|
|
45
|
+
* @param adrNumber External ADR number (e.g., "020")
|
|
46
|
+
* @param pluginId The plugin ID
|
|
47
|
+
* @returns Entity reference to the ADR, or null if not found
|
|
48
|
+
*/
|
|
49
|
+
async resolveAdrNumber(adrNumber, pluginId) {
|
|
50
|
+
const adrDb = await this.dbManager.getDatabase('W');
|
|
51
|
+
const adrRepo = new adr_repository_1.AdrRepository(adrDb);
|
|
52
|
+
const adr = await adrRepo.getByAdrNumber(adrNumber, pluginId);
|
|
53
|
+
if (!adr) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
dimension: 'W',
|
|
58
|
+
entity_id: adr.id,
|
|
59
|
+
external_id: adr.adr_number
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Gets all ADRs that reference a specific file path.
|
|
64
|
+
*
|
|
65
|
+
* @param filePath Repository-relative source path
|
|
66
|
+
* @param pluginId The plugin ID
|
|
67
|
+
* @returns Array of entity references to ADRs
|
|
68
|
+
*/
|
|
69
|
+
async getAdrsForFilePath(filePath, pluginId) {
|
|
70
|
+
const adrDb = await this.dbManager.getDatabase('W');
|
|
71
|
+
const adrRepo = new adr_repository_1.AdrRepository(adrDb);
|
|
72
|
+
const adrs = await adrRepo.findByFilePath(filePath, pluginId);
|
|
73
|
+
return adrs.map(adr => ({
|
|
74
|
+
dimension: 'W',
|
|
75
|
+
entity_id: adr.id,
|
|
76
|
+
external_id: adr.adr_number
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Gets all symbols for a module.
|
|
81
|
+
*
|
|
82
|
+
* @param filePath Repository-relative source path
|
|
83
|
+
* @param pluginId The plugin ID
|
|
84
|
+
* @returns Array of entity references to symbols
|
|
85
|
+
*/
|
|
86
|
+
async getSymbolsForModule(filePath, pluginId) {
|
|
87
|
+
const symbolDb = await this.dbManager.getDatabase('Y');
|
|
88
|
+
const symbolRepo = new symbol_repository_1.SymbolRepository(symbolDb);
|
|
89
|
+
const symbols = await symbolRepo.findByPath(filePath, pluginId);
|
|
90
|
+
return symbols.map(symbol => ({
|
|
91
|
+
dimension: 'Y',
|
|
92
|
+
entity_id: symbol.id,
|
|
93
|
+
external_id: symbol.symbol_id
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.CrossDimensionLinker = CrossDimensionLinker;
|
|
98
|
+
//# sourceMappingURL=cross-dimension-linker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cross-dimension-linker.js","sourceRoot":"","sources":["../../src/services/cross-dimension-linker.ts"],"names":[],"mappings":";;;AAEA,yEAAqE;AACrE,yEAAqE;AACrE,mEAA+D;AAG/D;;;GAGG;AACH,MAAa,oBAAoB;IAI7B,YAAY,SAAyB,EAAE,QAAkB;QACrD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED;;;;;;OAMG;IACI,KAAK,CAAC,qBAAqB,CAC9B,QAAgB,EAChB,QAAgB;QAEhB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACvD,MAAM,UAAU,GAAG,IAAI,oCAAgB,CAAC,QAAQ,CAAC,CAAC;QAElD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,aAAa,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAClE,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACvD,MAAM,UAAU,GAAG,IAAI,oCAAgB,CAAC,QAAQ,CAAC,CAAC;QAElD,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACrE,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,OAAO;YACH,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,MAAM,CAAC,EAAE;YACpB,WAAW,EAAE,GAAG,QAAQ,IAAI,MAAM,CAAC,SAAS,EAAE;SACjD,CAAC;IACN,CAAC;IAED;;;;;;OAM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AG,MAAM,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAEhE,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC1B,SAAS,EAAE,GAAG;YACd,SAAS,EAAE,MAAM,CAAC,EAAE;YACpB,WAAW,EAAE,MAAM,CAAC,SAAS;SAChC,CAAC,CAAC,CAAC;IACR,CAAC;CACJ;AAlHD,oDAkHC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { MultiDbManager } from '../core/multi-db-manager';
|
|
2
|
+
import { Module } from '../models/module';
|
|
3
|
+
/**
|
|
4
|
+
* Calculates importance scores for entities using graph algorithms.
|
|
5
|
+
* Uses PageRank and Betweenness Centrality, then combines them.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ImportanceScorer {
|
|
8
|
+
private dbManager;
|
|
9
|
+
private dependencyApi;
|
|
10
|
+
private moduleApi;
|
|
11
|
+
private readonly pagerankWeight;
|
|
12
|
+
private readonly betweennessWeight;
|
|
13
|
+
constructor(dbManager: MultiDbManager);
|
|
14
|
+
/**
|
|
15
|
+
* Calculates combined importance scores for all dimensions.
|
|
16
|
+
* Currently focuses on X-dimension (Modules) using dependency graph.
|
|
17
|
+
*/
|
|
18
|
+
calculateCombinedScores(pluginId: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Calculates importance scores for modules (X-dimension).
|
|
21
|
+
*/
|
|
22
|
+
private calculateModuleScores;
|
|
23
|
+
/**
|
|
24
|
+
* Builds an adjacency list representation of the dependency graph.
|
|
25
|
+
*/
|
|
26
|
+
private buildDependencyGraph;
|
|
27
|
+
/**
|
|
28
|
+
* Calculates PageRank scores for modules.
|
|
29
|
+
* Uses iterative algorithm with damping factor.
|
|
30
|
+
*/
|
|
31
|
+
calculatePageRank(graph: Map<string, Set<string>>, modules: Module[]): Promise<Map<string, number>>;
|
|
32
|
+
/**
|
|
33
|
+
* Calculates Betweenness Centrality scores.
|
|
34
|
+
* Uses simplified algorithm (all-pairs shortest paths would be too expensive).
|
|
35
|
+
* Uses approximation: nodes with more incoming edges have higher betweenness.
|
|
36
|
+
*/
|
|
37
|
+
calculateBetweenness(graph: Map<string, Set<string>>, modules: Module[]): Promise<Map<string, number>>;
|
|
38
|
+
/**
|
|
39
|
+
* Gets all nodes that have edges to the given node.
|
|
40
|
+
*/
|
|
41
|
+
private getIncomingEdges;
|
|
42
|
+
/**
|
|
43
|
+
* Combines PageRank and Betweenness scores with weights.
|
|
44
|
+
*/
|
|
45
|
+
private combineScores;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=importance-scorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importance-scorer.d.ts","sourceRoot":"","sources":["../../src/services/importance-scorer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAK1D,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAG1C;;;GAGG;AACH,qBAAa,gBAAgB;IACzB,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAC9C,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAe;gBAErC,SAAS,EAAE,cAAc;IAMrC;;;OAGG;IACG,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU9D;;OAEG;YACW,qBAAqB;IA4CnC;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAmB5B;;;OAGG;IACG,iBAAiB,CACnB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,EAC/B,OAAO,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAkD/B;;;;OAIG;IACG,oBAAoB,CACtB,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,EAC/B,OAAO,EAAE,MAAM,EAAE,GAClB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAe/B;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAUxB;;OAEG;IACH,OAAO,CAAC,aAAa;CAgCxB"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ImportanceScorer = void 0;
|
|
4
|
+
const dependency_api_1 = require("../api/dependency-api");
|
|
5
|
+
const module_api_1 = require("../api/module-api");
|
|
6
|
+
const importance_repository_1 = require("../repositories/importance-repository");
|
|
7
|
+
const uuid_1 = require("uuid");
|
|
8
|
+
/**
|
|
9
|
+
* Calculates importance scores for entities using graph algorithms.
|
|
10
|
+
* Uses PageRank and Betweenness Centrality, then combines them.
|
|
11
|
+
*/
|
|
12
|
+
class ImportanceScorer {
|
|
13
|
+
constructor(dbManager) {
|
|
14
|
+
this.pagerankWeight = 0.7;
|
|
15
|
+
this.betweennessWeight = 0.3;
|
|
16
|
+
this.dbManager = dbManager;
|
|
17
|
+
this.dependencyApi = new dependency_api_1.DependencyApi(dbManager);
|
|
18
|
+
this.moduleApi = new module_api_1.ModuleApi(dbManager);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Calculates combined importance scores for all dimensions.
|
|
22
|
+
* Currently focuses on X-dimension (Modules) using dependency graph.
|
|
23
|
+
*/
|
|
24
|
+
async calculateCombinedScores(pluginId) {
|
|
25
|
+
console.log(`[ImportanceScorer] Calculating importance scores for plugin ${pluginId}`);
|
|
26
|
+
// For now, we calculate scores for X-dimension (Modules) based on dependency graph
|
|
27
|
+
// Other dimensions can be added later
|
|
28
|
+
await this.calculateModuleScores(pluginId);
|
|
29
|
+
console.log(`[ImportanceScorer] Importance scores calculated for plugin ${pluginId}`);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Calculates importance scores for modules (X-dimension).
|
|
33
|
+
*/
|
|
34
|
+
async calculateModuleScores(pluginId) {
|
|
35
|
+
const modules = await this.moduleApi.getAllModules(pluginId);
|
|
36
|
+
const dependencies = await this.dependencyApi.getAllDependencies(pluginId);
|
|
37
|
+
if (modules.length === 0) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// Build adjacency list for dependency graph
|
|
41
|
+
const graph = this.buildDependencyGraph(modules, dependencies);
|
|
42
|
+
// Calculate PageRank
|
|
43
|
+
const pagerankScores = await this.calculatePageRank(graph, modules);
|
|
44
|
+
// Calculate Betweenness Centrality
|
|
45
|
+
const betweennessScores = await this.calculateBetweenness(graph, modules);
|
|
46
|
+
// Combine scores and rank
|
|
47
|
+
const combinedScores = this.combineScores(pagerankScores, betweennessScores, modules);
|
|
48
|
+
// Save to database
|
|
49
|
+
const db = await this.dbManager.getDatabase('V');
|
|
50
|
+
const scoreRepo = new importance_repository_1.ImportanceRepository(db);
|
|
51
|
+
const now = new Date();
|
|
52
|
+
for (let i = 0; i < combinedScores.length; i++) {
|
|
53
|
+
const score = combinedScores[i];
|
|
54
|
+
const importanceScore = {
|
|
55
|
+
id: (0, uuid_1.v4)(),
|
|
56
|
+
plugin_id: pluginId,
|
|
57
|
+
dimension: 'X',
|
|
58
|
+
entity_id: score.moduleId,
|
|
59
|
+
pagerank_score: score.pagerank,
|
|
60
|
+
betweenness_score: score.betweenness,
|
|
61
|
+
combined_score: score.combined,
|
|
62
|
+
rank: i + 1, // 1 = most important
|
|
63
|
+
created_at: now
|
|
64
|
+
};
|
|
65
|
+
await scoreRepo.upsert(importanceScore);
|
|
66
|
+
}
|
|
67
|
+
console.log(`[ImportanceScorer] Calculated scores for ${combinedScores.length} modules`);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Builds an adjacency list representation of the dependency graph.
|
|
71
|
+
*/
|
|
72
|
+
buildDependencyGraph(modules, dependencies) {
|
|
73
|
+
const graph = new Map();
|
|
74
|
+
// Initialize all modules
|
|
75
|
+
for (const module of modules) {
|
|
76
|
+
graph.set(module.file_path, new Set());
|
|
77
|
+
}
|
|
78
|
+
// Add edges (dependencies)
|
|
79
|
+
for (const dep of dependencies) {
|
|
80
|
+
const fromSet = graph.get(dep.from_module);
|
|
81
|
+
if (fromSet) {
|
|
82
|
+
fromSet.add(dep.to_module);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return graph;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Calculates PageRank scores for modules.
|
|
89
|
+
* Uses iterative algorithm with damping factor.
|
|
90
|
+
*/
|
|
91
|
+
async calculatePageRank(graph, modules) {
|
|
92
|
+
const dampingFactor = 0.85;
|
|
93
|
+
const maxIterations = 100;
|
|
94
|
+
const tolerance = 1e-6;
|
|
95
|
+
const modulePaths = modules.map(m => m.file_path);
|
|
96
|
+
const scores = new Map();
|
|
97
|
+
const newScores = new Map();
|
|
98
|
+
// Initialize all scores to 1/N
|
|
99
|
+
const initialScore = 1.0 / modulePaths.length;
|
|
100
|
+
for (const path of modulePaths) {
|
|
101
|
+
scores.set(path, initialScore);
|
|
102
|
+
newScores.set(path, 0);
|
|
103
|
+
}
|
|
104
|
+
// Iterate until convergence
|
|
105
|
+
for (let iter = 0; iter < maxIterations; iter++) {
|
|
106
|
+
// Calculate new scores
|
|
107
|
+
for (const path of modulePaths) {
|
|
108
|
+
let sum = 0;
|
|
109
|
+
const incoming = this.getIncomingEdges(graph, path);
|
|
110
|
+
for (const incomingPath of incoming) {
|
|
111
|
+
const outgoingCount = graph.get(incomingPath)?.size || 1;
|
|
112
|
+
const oldScore = scores.get(incomingPath) || 0;
|
|
113
|
+
sum += oldScore / outgoingCount;
|
|
114
|
+
}
|
|
115
|
+
newScores.set(path, (1 - dampingFactor) / modulePaths.length + dampingFactor * sum);
|
|
116
|
+
}
|
|
117
|
+
// Check convergence
|
|
118
|
+
let maxDiff = 0;
|
|
119
|
+
for (const path of modulePaths) {
|
|
120
|
+
const oldScore = scores.get(path) || 0;
|
|
121
|
+
const newScore = newScores.get(path) || 0;
|
|
122
|
+
const diff = Math.abs(newScore - oldScore);
|
|
123
|
+
maxDiff = Math.max(maxDiff, diff);
|
|
124
|
+
scores.set(path, newScore);
|
|
125
|
+
}
|
|
126
|
+
if (maxDiff < tolerance) {
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return scores;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Calculates Betweenness Centrality scores.
|
|
134
|
+
* Uses simplified algorithm (all-pairs shortest paths would be too expensive).
|
|
135
|
+
* Uses approximation: nodes with more incoming edges have higher betweenness.
|
|
136
|
+
*/
|
|
137
|
+
async calculateBetweenness(graph, modules) {
|
|
138
|
+
const scores = new Map();
|
|
139
|
+
// Simplified betweenness: count how many shortest paths go through this node
|
|
140
|
+
// For efficiency, we use a simpler metric: number of incoming edges
|
|
141
|
+
// This correlates with betweenness in dependency graphs
|
|
142
|
+
for (const module of modules) {
|
|
143
|
+
const incoming = this.getIncomingEdges(graph, module.file_path);
|
|
144
|
+
// Normalize by total number of modules
|
|
145
|
+
scores.set(module.file_path, incoming.size / modules.length);
|
|
146
|
+
}
|
|
147
|
+
return scores;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Gets all nodes that have edges to the given node.
|
|
151
|
+
*/
|
|
152
|
+
getIncomingEdges(graph, target) {
|
|
153
|
+
const incoming = new Set();
|
|
154
|
+
for (const [from, toSet] of graph.entries()) {
|
|
155
|
+
if (toSet.has(target)) {
|
|
156
|
+
incoming.add(from);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return incoming;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Combines PageRank and Betweenness scores with weights.
|
|
163
|
+
*/
|
|
164
|
+
combineScores(pagerankScores, betweennessScores, modules) {
|
|
165
|
+
const results = [];
|
|
166
|
+
// Normalize scores to [0, 1] range
|
|
167
|
+
const pagerankValues = Array.from(pagerankScores.values());
|
|
168
|
+
const betweennessValues = Array.from(betweennessScores.values());
|
|
169
|
+
const maxPageRank = Math.max(...pagerankValues, 1);
|
|
170
|
+
const maxBetweenness = Math.max(...betweennessValues, 1);
|
|
171
|
+
for (const module of modules) {
|
|
172
|
+
const pagerank = (pagerankScores.get(module.file_path) || 0) / maxPageRank;
|
|
173
|
+
const betweenness = (betweennessScores.get(module.file_path) || 0) / maxBetweenness;
|
|
174
|
+
const combined = this.pagerankWeight * pagerank + this.betweennessWeight * betweenness;
|
|
175
|
+
results.push({
|
|
176
|
+
moduleId: module.id,
|
|
177
|
+
pagerank,
|
|
178
|
+
betweenness,
|
|
179
|
+
combined
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
// Sort by combined score (descending)
|
|
183
|
+
results.sort((a, b) => b.combined - a.combined);
|
|
184
|
+
return results;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.ImportanceScorer = ImportanceScorer;
|
|
188
|
+
//# sourceMappingURL=importance-scorer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importance-scorer.js","sourceRoot":"","sources":["../../src/services/importance-scorer.ts"],"names":[],"mappings":";;;AACA,0DAAsD;AACtD,kDAA8C;AAC9C,iFAA8F;AAG9F,+BAAoC;AAEpC;;;GAGG;AACH,MAAa,gBAAgB;IAOzB,YAAY,SAAyB;QAHpB,mBAAc,GAAW,GAAG,CAAC;QAC7B,sBAAiB,GAAW,GAAG,CAAC;QAG7C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,aAAa,GAAG,IAAI,8BAAa,CAAC,SAAS,CAAC,CAAC;QAClD,IAAI,CAAC,SAAS,GAAG,IAAI,sBAAS,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,KAAK,CAA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QAAQ;aACX,CAAC,CAAC;QACP,CAAC;QAED,sCAAsC;QACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;QAEhD,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAhOD,4CAgOC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { MultiDbManager } from '../core/multi-db-manager';
|
|
2
|
+
import { MigrationManager } from '../core/migration-manager';
|
|
3
|
+
import { Dimension } from '../core/multi-db-manager';
|
|
4
|
+
/**
|
|
5
|
+
* Orchestrates ingestion across all 5 dimensions.
|
|
6
|
+
* Coordinates the ingestion process and ensures consistency.
|
|
7
|
+
*/
|
|
8
|
+
export declare class IngestionOrchestrator {
|
|
9
|
+
private dbManager;
|
|
10
|
+
private migrationManager;
|
|
11
|
+
private ingestors;
|
|
12
|
+
private docsPath?;
|
|
13
|
+
private embeddingPipeline?;
|
|
14
|
+
private importanceScorer?;
|
|
15
|
+
private navigationBuilder?;
|
|
16
|
+
constructor(dbManager: MultiDbManager, migrationManager: MigrationManager, docsPath?: string);
|
|
17
|
+
/**
|
|
18
|
+
* Performs a full ingestion of all dimensions.
|
|
19
|
+
* After 5D ingestion, triggers V-Dimension processing (embeddings, importance scores, navigation).
|
|
20
|
+
*
|
|
21
|
+
* @param workspaceRoot The workspace root directory
|
|
22
|
+
* @param pluginId The plugin ID
|
|
23
|
+
* @param docsPath The path to the docs directory (optional, uses constructor value if not provided)
|
|
24
|
+
* @returns Promise that resolves when ingestion is complete
|
|
25
|
+
*/
|
|
26
|
+
ingestFull(workspaceRoot: string, pluginId: string, docsPath?: string): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Performs an incremental ingestion of all dimensions.
|
|
29
|
+
* After 5D ingestion, triggers V-Dimension processing (embeddings, importance scores, navigation).
|
|
30
|
+
*
|
|
31
|
+
* @param workspaceRoot The workspace root directory
|
|
32
|
+
* @param pluginId The plugin ID
|
|
33
|
+
* @param docsPath The path to the docs directory (optional, uses constructor value if not provided)
|
|
34
|
+
* @returns Promise that resolves when ingestion is complete
|
|
35
|
+
*/
|
|
36
|
+
ingestIncremental(workspaceRoot: string, pluginId: string, docsPath?: string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Ingests a specific dimension.
|
|
39
|
+
*
|
|
40
|
+
* @param dimension The dimension to ingest
|
|
41
|
+
* @param workspaceRoot The workspace root directory
|
|
42
|
+
* @param pluginId The plugin ID
|
|
43
|
+
* @param docsPath The path to the docs directory (optional, uses constructor value if not provided)
|
|
44
|
+
* @param incremental Whether to perform incremental ingestion
|
|
45
|
+
* @returns Promise that resolves when ingestion is complete
|
|
46
|
+
*/
|
|
47
|
+
ingestDimension(dimension: Dimension, workspaceRoot: string, pluginId: string, docsPath?: string, incremental?: boolean): Promise<void>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=ingestion-orchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingestion-orchestrator.d.ts","sourceRoot":"","sources":["../../src/services/ingestion-orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAO7D,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAMrD;;;GAGG;AACH,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,SAAS,CAA+B;IAChD,OAAO,CAAC,QAAQ,CAAC,CAAS;IAC1B,OAAO,CAAC,iBAAiB,CAAC,CAAoB;IAC9C,OAAO,CAAC,gBAAgB,CAAC,CAAmB;IAC5C,OAAO,CAAC,iBAAiB,CAAC,CAAoB;gBAElC,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,QAAQ,CAAC,EAAE,MAAM;IAmB5F;;;;;;;;OAQG;IACU,UAAU,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsClG;;;;;;;;OAQG;IACU,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsCzG;;;;;;;;;OASG;IACU,eAAe,CACxB,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,MAAM,EACjB,WAAW,GAAE,OAAe,GAC7B,OAAO,CAAC,IAAI,CAAC;CAiBnB"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IngestionOrchestrator = void 0;
|
|
4
|
+
const module_ingestor_1 = require("../ingestors/module-ingestor");
|
|
5
|
+
const symbol_ingestor_1 = require("../ingestors/symbol-ingestor");
|
|
6
|
+
const dependency_ingestor_1 = require("../ingestors/dependency-ingestor");
|
|
7
|
+
const adr_ingestor_1 = require("../ingestors/adr-ingestor");
|
|
8
|
+
const change_ingestor_1 = require("../ingestors/change-ingestor");
|
|
9
|
+
const embedding_pipeline_1 = require("../embedding/embedding-pipeline");
|
|
10
|
+
const embedding_generator_1 = require("../embedding/embedding-generator");
|
|
11
|
+
const importance_scorer_1 = require("../services/importance-scorer");
|
|
12
|
+
const navigation_builder_1 = require("../services/navigation-builder");
|
|
13
|
+
/**
|
|
14
|
+
* Orchestrates ingestion across all 5 dimensions.
|
|
15
|
+
* Coordinates the ingestion process and ensures consistency.
|
|
16
|
+
*/
|
|
17
|
+
class IngestionOrchestrator {
|
|
18
|
+
constructor(dbManager, migrationManager, docsPath) {
|
|
19
|
+
this.dbManager = dbManager;
|
|
20
|
+
this.migrationManager = migrationManager;
|
|
21
|
+
this.docsPath = docsPath;
|
|
22
|
+
this.ingestors = new Map();
|
|
23
|
+
this.ingestors.set('X', new module_ingestor_1.ModuleIngestor(dbManager));
|
|
24
|
+
this.ingestors.set('Y', new symbol_ingestor_1.SymbolIngestor(dbManager));
|
|
25
|
+
this.ingestors.set('Z', new dependency_ingestor_1.DependencyIngestor(dbManager));
|
|
26
|
+
this.ingestors.set('W', new adr_ingestor_1.AdrIngestor(dbManager));
|
|
27
|
+
this.ingestors.set('T', new change_ingestor_1.ChangeIngestor(dbManager));
|
|
28
|
+
// Initialize V-Dimension services (lazy initialization)
|
|
29
|
+
const embeddingGenerator = new embedding_generator_1.EmbeddingGenerator();
|
|
30
|
+
this.embeddingPipeline = new embedding_pipeline_1.EmbeddingPipeline(dbManager, embeddingGenerator);
|
|
31
|
+
this.importanceScorer = new importance_scorer_1.ImportanceScorer(dbManager);
|
|
32
|
+
this.navigationBuilder = new navigation_builder_1.NavigationBuilder(dbManager);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Performs a full ingestion of all dimensions.
|
|
36
|
+
* After 5D ingestion, triggers V-Dimension processing (embeddings, importance scores, navigation).
|
|
37
|
+
*
|
|
38
|
+
* @param workspaceRoot The workspace root directory
|
|
39
|
+
* @param pluginId The plugin ID
|
|
40
|
+
* @param docsPath The path to the docs directory (optional, uses constructor value if not provided)
|
|
41
|
+
* @returns Promise that resolves when ingestion is complete
|
|
42
|
+
*/
|
|
43
|
+
async ingestFull(workspaceRoot, pluginId, docsPath) {
|
|
44
|
+
await this.migrationManager.migrateAll();
|
|
45
|
+
const effectiveDocsPath = docsPath || this.docsPath;
|
|
46
|
+
if (!effectiveDocsPath) {
|
|
47
|
+
throw new Error('docs/ directory not found. Cannot perform ingestion.');
|
|
48
|
+
}
|
|
49
|
+
// 1. Ingest 5D dimensions
|
|
50
|
+
const dimensions = ['X', 'Y', 'Z', 'W', 'T'];
|
|
51
|
+
for (const dimension of dimensions) {
|
|
52
|
+
const ingestor = this.ingestors.get(dimension);
|
|
53
|
+
if (ingestor) {
|
|
54
|
+
await ingestor.ingestFull(workspaceRoot, pluginId, effectiveDocsPath);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
// 2. V-Dimension: Semantic Brain
|
|
58
|
+
// Ensure V-dimension migration is applied
|
|
59
|
+
await this.migrationManager.migrate('V');
|
|
60
|
+
// Sync embeddings
|
|
61
|
+
if (this.embeddingPipeline) {
|
|
62
|
+
await this.embeddingPipeline.syncEmbeddings(pluginId);
|
|
63
|
+
}
|
|
64
|
+
// Calculate importance scores (after dependencies are ingested)
|
|
65
|
+
if (this.importanceScorer) {
|
|
66
|
+
await this.importanceScorer.calculateCombinedScores(pluginId);
|
|
67
|
+
}
|
|
68
|
+
// Build navigation metadata
|
|
69
|
+
if (this.navigationBuilder) {
|
|
70
|
+
await this.navigationBuilder.buildMetadata(pluginId);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Performs an incremental ingestion of all dimensions.
|
|
75
|
+
* After 5D ingestion, triggers V-Dimension processing (embeddings, importance scores, navigation).
|
|
76
|
+
*
|
|
77
|
+
* @param workspaceRoot The workspace root directory
|
|
78
|
+
* @param pluginId The plugin ID
|
|
79
|
+
* @param docsPath The path to the docs directory (optional, uses constructor value if not provided)
|
|
80
|
+
* @returns Promise that resolves when ingestion is complete
|
|
81
|
+
*/
|
|
82
|
+
async ingestIncremental(workspaceRoot, pluginId, docsPath) {
|
|
83
|
+
await this.migrationManager.migrateAll();
|
|
84
|
+
const effectiveDocsPath = docsPath || this.docsPath;
|
|
85
|
+
if (!effectiveDocsPath) {
|
|
86
|
+
throw new Error('docs/ directory not found. Cannot perform ingestion.');
|
|
87
|
+
}
|
|
88
|
+
// 1. Ingest 5D dimensions
|
|
89
|
+
const dimensions = ['X', 'Y', 'Z', 'W', 'T'];
|
|
90
|
+
for (const dimension of dimensions) {
|
|
91
|
+
const ingestor = this.ingestors.get(dimension);
|
|
92
|
+
if (ingestor) {
|
|
93
|
+
await ingestor.ingestIncremental(workspaceRoot, pluginId, effectiveDocsPath);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// 2. V-Dimension: Semantic Brain
|
|
97
|
+
// Ensure V-dimension migration is applied
|
|
98
|
+
await this.migrationManager.migrate('V');
|
|
99
|
+
// Sync embeddings
|
|
100
|
+
if (this.embeddingPipeline) {
|
|
101
|
+
await this.embeddingPipeline.syncEmbeddings(pluginId);
|
|
102
|
+
}
|
|
103
|
+
// Calculate importance scores (after dependencies are ingested)
|
|
104
|
+
if (this.importanceScorer) {
|
|
105
|
+
await this.importanceScorer.calculateCombinedScores(pluginId);
|
|
106
|
+
}
|
|
107
|
+
// Build navigation metadata
|
|
108
|
+
if (this.navigationBuilder) {
|
|
109
|
+
await this.navigationBuilder.buildMetadata(pluginId);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Ingests a specific dimension.
|
|
114
|
+
*
|
|
115
|
+
* @param dimension The dimension to ingest
|
|
116
|
+
* @param workspaceRoot The workspace root directory
|
|
117
|
+
* @param pluginId The plugin ID
|
|
118
|
+
* @param docsPath The path to the docs directory (optional, uses constructor value if not provided)
|
|
119
|
+
* @param incremental Whether to perform incremental ingestion
|
|
120
|
+
* @returns Promise that resolves when ingestion is complete
|
|
121
|
+
*/
|
|
122
|
+
async ingestDimension(dimension, workspaceRoot, pluginId, docsPath, incremental = false) {
|
|
123
|
+
await this.migrationManager.migrate(dimension);
|
|
124
|
+
const effectiveDocsPath = docsPath || this.docsPath;
|
|
125
|
+
if (!effectiveDocsPath) {
|
|
126
|
+
throw new Error('docs/ directory not found. Cannot perform ingestion.');
|
|
127
|
+
}
|
|
128
|
+
const ingestor = this.ingestors.get(dimension);
|
|
129
|
+
if (ingestor) {
|
|
130
|
+
if (incremental) {
|
|
131
|
+
await ingestor.ingestIncremental(workspaceRoot, pluginId, effectiveDocsPath);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
await ingestor.ingestFull(workspaceRoot, pluginId, effectiveDocsPath);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.IngestionOrchestrator = IngestionOrchestrator;
|
|
140
|
+
//# sourceMappingURL=ingestion-orchestrator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingestion-orchestrator.js","sourceRoot":"","sources":["../../src/services/ingestion-orchestrator.ts"],"names":[],"mappings":";;;AAGA,kEAA8D;AAC9D,kEAA8D;AAC9D,0EAAsE;AACtE,4DAAwD;AACxD,kEAA8D;AAE9D,wEAAoE;AACpE,0EAAsE;AACtE,qEAAiE;AACjE,uEAAmE;AAEnE;;;GAGG;AACH,MAAa,qBAAqB;IAS9B,YAAY,SAAyB,EAAE,gBAAkC,EAAE,QAAiB;QACxF,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAEzB,IAAI,CAAC,SAAS,GAAG,IAAI,GAAG,EAA2B,CAAC;QACpD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,gCAAc,CAAC,SAAS,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,gCAAc,CAAC,SAAS,CAAC,CAAC,CAAC;QACvD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,wCAAkB,CAAC,SAAS,CAAC,CAAC,CAAC;QAC3D,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,0BAAW,CAAC,SAAS,CAAC,CAAC,CAAC;QACpD,IAAI,CAAC,SAAS,CAAC,GAA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|
4
|
+
*/
|
|
5
|
+
export declare class NavigationBuilder {
|
|
6
|
+
private dbManager;
|
|
7
|
+
private moduleApi;
|
|
8
|
+
private dependencyApi;
|
|
9
|
+
private adrApi;
|
|
10
|
+
constructor(dbManager: MultiDbManager);
|
|
11
|
+
/**
|
|
12
|
+
* Builds all navigation metadata for a plugin.
|
|
13
|
+
*/
|
|
14
|
+
buildMetadata(pluginId: string): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Identifies entry points (automatically + manually).
|
|
17
|
+
*/
|
|
18
|
+
identifyEntryPoints(pluginId: string): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Links entities with related ADRs.
|
|
21
|
+
*/
|
|
22
|
+
linkRelatedAdrs(pluginId: string): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Groups related entities into clusters.
|
|
25
|
+
* Uses directory structure for clustering.
|
|
26
|
+
*/
|
|
27
|
+
buildClusters(pluginId: string): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=navigation-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navigation-builder.d.ts","sourceRoot":"","sources":["../../src/services/navigation-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAW1D;;GAEG;AACH,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,MAAM,CAAS;gBAEX,SAAS,EAAE,cAAc;IAOrC;;OAEG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAUpD;;OAEG;IACG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA4E1D;;OAEG;IACG,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsDtD;;;OAGG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAmDvD"}
|