Skip to content

Commit dd1d22d

Browse files
committed
feat(schema): add relationship weights to framework edge enhancements
Add traversal weights to NestJS and FairSquare edge definitions: - Critical (0.9-0.95): DI, routing, API exposure - High (0.8-0.88): data access, security, internal APIs
1 parent b07ab38 commit dd1d22d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/core/config/fairsquare-framework-schema.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ export const FAIRSQUARE_FRAMEWORK_SCHEMA: FrameworkSchema = {
654654
injectableDependencies: {
655655
name: 'Injectable Dependencies',
656656
semanticType: FairSquareSemanticEdgeType.FS_INJECTS as any,
657+
relationshipWeight: 0.95, // Critical - FairSquare DI is core architecture
657658

658659
detectionPattern: (parsedSourceNode: ParsedNode, parsedTargetNode: ParsedNode, allParsedNodes, sharedContext) => {
659660
// FILTER: Only create INJECTS edges between ClassDeclarations
@@ -699,6 +700,7 @@ export const FAIRSQUARE_FRAMEWORK_SCHEMA: FrameworkSchema = {
699700
repositoryUsesDAL: {
700701
name: 'Repository Uses DAL',
701702
semanticType: FairSquareSemanticEdgeType.FS_REPOSITORY_USES_DAL as any,
703+
relationshipWeight: 0.85, // High - data access layer relationships
702704

703705
detectionPattern: (parsedSourceNode: ParsedNode, parsedTargetNode: ParsedNode, allParsedNodes, sharedContext) => {
704706
const isSourceRepo = parsedSourceNode.semanticType === FairSquareSemanticNodeType.FS_REPOSITORY;
@@ -737,6 +739,7 @@ export const FAIRSQUARE_FRAMEWORK_SCHEMA: FrameworkSchema = {
737739
controllerProtectedBy: {
738740
name: 'Controller Protected By Permission Manager',
739741
semanticType: FairSquareSemanticEdgeType.FS_PROTECTED_BY as any,
742+
relationshipWeight: 0.88, // High - security/authorization is critical
740743

741744
detectionPattern: (parsedSourceNode: ParsedNode, parsedTargetNode: ParsedNode, allParsedNodes, sharedContext) => {
742745
const isSourceController = parsedSourceNode.semanticType === FairSquareSemanticNodeType.FS_CONTROLLER;
@@ -775,6 +778,7 @@ export const FAIRSQUARE_FRAMEWORK_SCHEMA: FrameworkSchema = {
775778
routeToController: {
776779
name: 'Route To Controller',
777780
semanticType: FairSquareSemanticEdgeType.FS_ROUTES_TO as any,
781+
relationshipWeight: 0.92, // Critical - HTTP routing is primary entry point
778782

779783
detectionPattern: (parsedSourceNode: ParsedNode, parsedTargetNode: ParsedNode, allParsedNodes, sharedContext) => {
780784
const isSourceRoute = parsedSourceNode.semanticType === FairSquareSemanticNodeType.FS_ROUTE_DEFINITION;
@@ -813,6 +817,7 @@ export const FAIRSQUARE_FRAMEWORK_SCHEMA: FrameworkSchema = {
813817
routeToHandlerMethod: {
814818
name: 'Route To Handler Method',
815819
semanticType: FairSquareSemanticEdgeType.FS_ROUTES_TO_HANDLER as any,
820+
relationshipWeight: 0.9, // Critical - direct route to handler method
816821

817822
detectionPattern: (parsedSourceNode: ParsedNode, parsedTargetNode: ParsedNode, allParsedNodes, sharedContext) => {
818823
const isSourceRoute = parsedSourceNode.semanticType === FairSquareSemanticNodeType.FS_ROUTE_DEFINITION;
@@ -883,6 +888,7 @@ export const FAIRSQUARE_FRAMEWORK_SCHEMA: FrameworkSchema = {
883888
internalApiCall: {
884889
name: 'Internal API Call',
885890
semanticType: FairSquareSemanticEdgeType.FS_INTERNAL_API_CALL as any,
891+
relationshipWeight: 0.82, // High - internal service communication
886892
detectionPattern: (parsedSourceNode: ParsedNode, parsedTargetNode: ParsedNode, allParsedNodes, sharedContext) => {
887893
// Service → VendorController (through VendorClient)
888894
const isSourceService = parsedSourceNode.semanticType === FairSquareSemanticNodeType.FS_SERVICE;
@@ -954,6 +960,7 @@ export const FAIRSQUARE_FRAMEWORK_SCHEMA: FrameworkSchema = {
954960
usesRepository: {
955961
name: 'Uses Repository',
956962
semanticType: 'USES_REPOSITORY',
963+
relationshipWeight: 0.8, // High - service to repository data access
957964

958965
detectionPattern: (parsedSourceNode: ParsedNode, parsedTargetNode: ParsedNode, allParsedNodes, sharedContext) => {
959966
// Service → Repository

src/core/config/nestjs-framework-schema.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,7 @@ export const NESTJS_FRAMEWORK_SCHEMA: FrameworkSchema = {
715715
DependencyInjection: {
716716
name: 'DependencyInjection',
717717
semanticType: SemanticEdgeType.INJECTS,
718+
relationshipWeight: 0.95, // Critical - core NestJS DI is primary architecture
718719
detectionPattern: (parsedSourceNode: ParsedNode, parsedTargetNode: ParsedNode) => {
719720
return detectDependencyInjection(parsedSourceNode, parsedTargetNode);
720721
},
@@ -732,6 +733,7 @@ export const NESTJS_FRAMEWORK_SCHEMA: FrameworkSchema = {
732733
MessageHandlerExposure: {
733734
name: 'MessageHandlerExposure',
734735
semanticType: SemanticEdgeType.EXPOSES,
736+
relationshipWeight: 0.9, // Critical - API surface exposure
735737
detectionPattern: (parsedSourceNode: ParsedNode, parsedTargetNode: ParsedNode) => {
736738
if (
737739
parsedSourceNode.properties?.semanticType !== SemanticNodeType.NEST_CONTROLLER ||
@@ -769,6 +771,7 @@ export const NESTJS_FRAMEWORK_SCHEMA: FrameworkSchema = {
769771
HttpEndpointExposure: {
770772
name: 'HttpEndpointExposure',
771773
semanticType: SemanticEdgeType.EXPOSES,
774+
relationshipWeight: 0.9, // Critical - HTTP API surface
772775
detectionPattern: (parsedSourceNode: ParsedNode, parsedTargetNode: ParsedNode) => {
773776
// Check if source is controller and target is HTTP endpoint
774777
if (

0 commit comments

Comments
 (0)