ref-agents 1.0.0__py3-none-any.whl

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.
Files changed (175) hide show
  1. ref_agents/__init__.py +9 -0
  2. ref_agents/api_keys.json.example +8 -0
  3. ref_agents/auth.py +129 -0
  4. ref_agents/codemap/..md +62 -0
  5. ref_agents/codemap/CODE_MAP.md +37 -0
  6. ref_agents/codemap/core.md +43 -0
  7. ref_agents/codemap/models.md +43 -0
  8. ref_agents/codemap/prompts.md +40 -0
  9. ref_agents/codemap/security.md +45 -0
  10. ref_agents/codemap/tools.md +94 -0
  11. ref_agents/codemap/tools_browser.md +44 -0
  12. ref_agents/codemap/utils.md +42 -0
  13. ref_agents/codemap/workflow.md +42 -0
  14. ref_agents/config/ai_patterns.yaml +101 -0
  15. ref_agents/config/frameworks/angular.yaml +104 -0
  16. ref_agents/config/frameworks/aspnet.yaml +84 -0
  17. ref_agents/config/frameworks/ef_core.yaml +81 -0
  18. ref_agents/config/frameworks/react.yaml +111 -0
  19. ref_agents/config/frameworks/spring_boot.yaml +117 -0
  20. ref_agents/config/languages/csharp.yaml +153 -0
  21. ref_agents/config/languages/java.yaml +188 -0
  22. ref_agents/config/languages/javascript.yaml +172 -0
  23. ref_agents/config/languages/python.yaml +153 -0
  24. ref_agents/config/languages/typescript.yaml +193 -0
  25. ref_agents/constants.py +553 -0
  26. ref_agents/core/__init__.py +15 -0
  27. ref_agents/core/config_loader.py +160 -0
  28. ref_agents/core/config_models.py +167 -0
  29. ref_agents/core/config_parsing.py +84 -0
  30. ref_agents/core/language_detector.py +388 -0
  31. ref_agents/core/validation_models.py +66 -0
  32. ref_agents/core/validation_primitives.py +176 -0
  33. ref_agents/errors.py +34 -0
  34. ref_agents/license_client.py +247 -0
  35. ref_agents/models/__init__.py +22 -0
  36. ref_agents/models/gherkin.py +45 -0
  37. ref_agents/models/hierarchy.py +80 -0
  38. ref_agents/models/invest.py +59 -0
  39. ref_agents/models/version.py +49 -0
  40. ref_agents/prompts/__init__.py +9 -0
  41. ref_agents/prompts/start_agent.py +772 -0
  42. ref_agents/rules/architecture/backend_patterns.md +43 -0
  43. ref_agents/rules/architecture/diagramming.md +100 -0
  44. ref_agents/rules/architecture/frontend_patterns.md +40 -0
  45. ref_agents/rules/architecture/impact_analysis.md +129 -0
  46. ref_agents/rules/architecture/migration_strategy.md +208 -0
  47. ref_agents/rules/architecture/regression_protocol.md +77 -0
  48. ref_agents/rules/architecture/system_design.md +97 -0
  49. ref_agents/rules/common/codemap_standard.md +97 -0
  50. ref_agents/rules/common/core_protocol.md +59 -0
  51. ref_agents/rules/common/prompt_engineering.md +294 -0
  52. ref_agents/rules/development/debugging.md +32 -0
  53. ref_agents/rules/development/implementation.md +205 -0
  54. ref_agents/rules/operations/completion.md +119 -0
  55. ref_agents/rules/operations/cutover_protocol.md +218 -0
  56. ref_agents/rules/operations/discovery.md +179 -0
  57. ref_agents/rules/operations/fix_workflow.md +87 -0
  58. ref_agents/rules/operations/forensics.md +278 -0
  59. ref_agents/rules/operations/platform.md +263 -0
  60. ref_agents/rules/operations/synchronous_flow.md +25 -0
  61. ref_agents/rules/product/ac_validation.md +25 -0
  62. ref_agents/rules/product/brainstorming.md +27 -0
  63. ref_agents/rules/product/ref_flow.md +101 -0
  64. ref_agents/rules/product/requirements_std.md +114 -0
  65. ref_agents/rules/product/spec_writing.md +235 -0
  66. ref_agents/rules/product/strategy.md +96 -0
  67. ref_agents/rules/quality/documentation_standards.md +46 -0
  68. ref_agents/rules/quality/parity_testing.md +234 -0
  69. ref_agents/rules/quality/project_documentation.md +56 -0
  70. ref_agents/rules/quality/qa_lead.md +111 -0
  71. ref_agents/rules/quality/test_design.md +146 -0
  72. ref_agents/rules/quality/testing_standards.md +293 -0
  73. ref_agents/rules/review/pr_review.md +116 -0
  74. ref_agents/rules/security/security_audit.md +83 -0
  75. ref_agents/security/__init__.py +22 -0
  76. ref_agents/security/dependency_audit.py +188 -0
  77. ref_agents/security/file_audit.py +208 -0
  78. ref_agents/security/network_scan.py +179 -0
  79. ref_agents/security/report_generator.py +313 -0
  80. ref_agents/security/secret_scan.py +252 -0
  81. ref_agents/security/url_scan.py +240 -0
  82. ref_agents/security_scan.py +236 -0
  83. ref_agents/server.py +1586 -0
  84. ref_agents/session.py +100 -0
  85. ref_agents/tool_names.py +55 -0
  86. ref_agents/tools/__init__.py +8 -0
  87. ref_agents/tools/agents_generator.py +315 -0
  88. ref_agents/tools/ai_pattern_detector.py +815 -0
  89. ref_agents/tools/brownfield_populator.py +529 -0
  90. ref_agents/tools/browser/__init__.py +50 -0
  91. ref_agents/tools/browser/evidence_verifier.py +302 -0
  92. ref_agents/tools/browser/execution_logger.py +249 -0
  93. ref_agents/tools/browser/playwright_mcp_client.py +259 -0
  94. ref_agents/tools/browser/screenshot_utils.py +184 -0
  95. ref_agents/tools/browser/test_executor.py +537 -0
  96. ref_agents/tools/code_quality_scanner.py +629 -0
  97. ref_agents/tools/codemap/..md +93 -0
  98. ref_agents/tools/codemap/CODE_MAP.md +30 -0
  99. ref_agents/tools/codemap/browser.md +44 -0
  100. ref_agents/tools/codemap.py +403 -0
  101. ref_agents/tools/codemap_freshness.py +234 -0
  102. ref_agents/tools/comment_smell_scanner.py +346 -0
  103. ref_agents/tools/complexity.py +436 -0
  104. ref_agents/tools/complexity_ast.py +333 -0
  105. ref_agents/tools/compliance.py +246 -0
  106. ref_agents/tools/compliance_remediation.py +846 -0
  107. ref_agents/tools/context_graph.py +839 -0
  108. ref_agents/tools/context_manager.py +550 -0
  109. ref_agents/tools/context_tools.py +121 -0
  110. ref_agents/tools/cross_repo_linker.py +393 -0
  111. ref_agents/tools/dead_code_scanner.py +637 -0
  112. ref_agents/tools/debt_scanner.py +1092 -0
  113. ref_agents/tools/dependency_graph.py +272 -0
  114. ref_agents/tools/discovery_audit.py +372 -0
  115. ref_agents/tools/docs_scanner.py +600 -0
  116. ref_agents/tools/evaluate_gate.py +119 -0
  117. ref_agents/tools/external_detector.py +524 -0
  118. ref_agents/tools/features_generator.py +282 -0
  119. ref_agents/tools/flow_gap_detector.py +373 -0
  120. ref_agents/tools/flow_mapper.py +327 -0
  121. ref_agents/tools/full_suite_runner.py +740 -0
  122. ref_agents/tools/gherkin_parser.py +227 -0
  123. ref_agents/tools/guard_tools.py +139 -0
  124. ref_agents/tools/handoff_tools.py +282 -0
  125. ref_agents/tools/health_scanner.py +1211 -0
  126. ref_agents/tools/hierarchy_manager.py +289 -0
  127. ref_agents/tools/invest_scorer.py +249 -0
  128. ref_agents/tools/jira_confluence_export.py +306 -0
  129. ref_agents/tools/json_output.py +76 -0
  130. ref_agents/tools/migration_mapper.py +946 -0
  131. ref_agents/tools/migration_readiness_scanner.py +209 -0
  132. ref_agents/tools/pattern_learner.py +522 -0
  133. ref_agents/tools/report_utils.py +155 -0
  134. ref_agents/tools/requirements_serializer.py +225 -0
  135. ref_agents/tools/security_audit_tool.py +106 -0
  136. ref_agents/tools/sequencing_engine.py +288 -0
  137. ref_agents/tools/summary_generator.py +275 -0
  138. ref_agents/tools/symbol_resolver.py +306 -0
  139. ref_agents/tools/symbol_smoke_runner.py +336 -0
  140. ref_agents/tools/test_plan_validator.py +189 -0
  141. ref_agents/tools/test_smell_walker.py +902 -0
  142. ref_agents/tools/tier1_fixer.py +502 -0
  143. ref_agents/tools/validators/__init__.py +419 -0
  144. ref_agents/tools/validators/architect.py +268 -0
  145. ref_agents/tools/validators/cutover_engineer.py +167 -0
  146. ref_agents/tools/validators/developer.py +180 -0
  147. ref_agents/tools/validators/discovery.py +150 -0
  148. ref_agents/tools/validators/forensic_engineer.py +191 -0
  149. ref_agents/tools/validators/impact_architect.py +181 -0
  150. ref_agents/tools/validators/migration_planner.py +166 -0
  151. ref_agents/tools/validators/parity_tester.py +155 -0
  152. ref_agents/tools/validators/platform_engineer.py +134 -0
  153. ref_agents/tools/validators/pr_reviewer.py +129 -0
  154. ref_agents/tools/validators/product_manager.py +291 -0
  155. ref_agents/tools/validators/qa_lead.py +172 -0
  156. ref_agents/tools/validators/scrum_master.py +212 -0
  157. ref_agents/tools/validators/security_owner.py +162 -0
  158. ref_agents/tools/validators/specifier.py +134 -0
  159. ref_agents/tools/validators/strategist.py +149 -0
  160. ref_agents/tools/validators/tester.py +121 -0
  161. ref_agents/tools/version_manager.py +202 -0
  162. ref_agents/tools/workflow_tools.py +1549 -0
  163. ref_agents/utils/__init__.py +21 -0
  164. ref_agents/utils/git_utils.py +351 -0
  165. ref_agents/utils/handoff_logger.py +368 -0
  166. ref_agents/utils/ignore_matcher.py +270 -0
  167. ref_agents/workflow/__init__.py +19 -0
  168. ref_agents/workflow/capabilities.py +328 -0
  169. ref_agents/workflow/state_machine.py +708 -0
  170. ref_agents/workflow/transitions.py +658 -0
  171. ref_agents-1.0.0.dist-info/METADATA +365 -0
  172. ref_agents-1.0.0.dist-info/RECORD +175 -0
  173. ref_agents-1.0.0.dist-info/WHEEL +4 -0
  174. ref_agents-1.0.0.dist-info/entry_points.txt +2 -0
  175. ref_agents-1.0.0.dist-info/licenses/LICENSE +115 -0
@@ -0,0 +1,101 @@
1
+ # AI Anti-Pattern Detection Configuration
2
+ # Used by ai_pattern_detector.py
3
+ #
4
+ # Customize thresholds and enable/disable specific patterns.
5
+
6
+ # Patterns to check (comment out to disable)
7
+ enabled_patterns:
8
+ - over_abstraction
9
+ - unused_params
10
+ - generic_naming
11
+ - verbose_comments
12
+ - copy_paste_blocks
13
+
14
+ # Detection thresholds
15
+ thresholds:
16
+ # Max ratio of classes to functions (0.5 = 1 class per 2 functions)
17
+ class_to_function_ratio: 0.5
18
+
19
+ # Max ratio of comment lines to code lines
20
+ comment_to_code_ratio: 0.4
21
+
22
+ # Hash similarity threshold for copy-paste detection (0.0-1.0)
23
+ similarity_threshold: 0.85
24
+
25
+ # Minimum lines to consider a block for copy-paste analysis
26
+ min_block_size: 5
27
+
28
+ # Variable/function names considered too generic
29
+ generic_names:
30
+ - data
31
+ - result
32
+ - temp
33
+ - tmp
34
+ - handler
35
+ - manager
36
+ - helper
37
+ - utils
38
+ - misc
39
+ - stuff
40
+ - thing
41
+ - obj
42
+ - val
43
+ - var
44
+ - foo
45
+ - bar
46
+ - baz
47
+ - item
48
+ - elem
49
+ - info
50
+
51
+ # Severity levels for each pattern type
52
+ severity_weights:
53
+ over_abstraction: MEDIUM
54
+ unused_params: LOW
55
+ generic_naming: LOW
56
+ verbose_comments: LOW
57
+ copy_paste_blocks: HIGH
58
+
59
+ # STORY-TQ-001 M1a: structural test-smell detection.
60
+ # Detector activates when file path matches one of test_path_globs.
61
+ # Findings emit through the standard PatternFinding channel.
62
+ # Phase-transition gate + Critical routing land in M1b.
63
+ test_smells:
64
+ enabled: true
65
+ # POSIX globs. Match against project-relative path.
66
+ test_path_globs:
67
+ - "tests/**/*.py"
68
+ - "test_*.py"
69
+ - "*_test.py"
70
+ # Files under these names skipped per FR-16.
71
+ excluded_filenames:
72
+ - "conftest.py"
73
+ - "__init__.py"
74
+ # Substring patterns; any match disqualifies file.
75
+ excluded_path_substrings:
76
+ - "/fixtures/"
77
+ # STORY-TQ-003 M3b: generated smoke tests use `assert x is not None` by design.
78
+ - "/tests/generated/"
79
+ patterns:
80
+ no_assertions:
81
+ enabled: true
82
+ severity: HIGH
83
+ trivial_assertion:
84
+ enabled: true
85
+ severity: HIGH
86
+ mock_called_only:
87
+ enabled: true
88
+ severity: HIGH
89
+ uut_mocked:
90
+ enabled: true
91
+ severity: HIGH
92
+ swallowed_exception:
93
+ enabled: true
94
+ severity: HIGH
95
+ not_none_only:
96
+ enabled: true
97
+ # Demoted MEDIUM → LOW (2026-05-25 tune). Baseline showed 35 findings
98
+ # mostly on legitimate `assert x is None` contract assertions
99
+ # (e.g. `_detect_old_framework_version` returns None for no signal).
100
+ # Rule is informational — useful for grep, not blocking.
101
+ severity: LOW
@@ -0,0 +1,104 @@
1
+ # Angular Framework Configuration for REF Agents
2
+ # Extends: typescript.yaml
3
+
4
+ framework: angular
5
+ base_language: typescript
6
+
7
+ # Angular-specific debt patterns
8
+ debt_patterns:
9
+ subscribe_without_unsubscribe:
10
+ description: "Observable subscriptions should be unsubscribed"
11
+ severity: high
12
+ pattern: "\\.subscribe\\("
13
+ suggestion: "Use async pipe, takeUntil, or unsubscribe in ngOnDestroy"
14
+
15
+ any_in_template:
16
+ description: "Using $any() in templates bypasses type checking"
17
+ severity: high
18
+ pattern: "\\$any\\("
19
+ suggestion: "Fix the type error properly"
20
+
21
+ direct_dom_access:
22
+ description: "Direct DOM access bypasses Angular"
23
+ severity: high
24
+ pattern: "document\\.(getElementById|querySelector)"
25
+ suggestion: "Use ViewChild, Renderer2, or ElementRef"
26
+
27
+ missing_trackby:
28
+ description: "ngFor without trackBy causes performance issues"
29
+ severity: medium
30
+ pattern: "\\*ngFor(?!.*trackBy)"
31
+ suggestion: "Add trackBy function for lists"
32
+
33
+ component_too_large:
34
+ description: "Component has too much logic"
35
+ severity: medium
36
+ pattern: "@Component"
37
+ suggestion: "Split into smaller components or services"
38
+
39
+ hardcoded_strings:
40
+ description: "Hardcoded strings block internationalization and localization"
41
+ severity: medium
42
+ pattern: ">\\s*[A-Z][a-z]+.*<"
43
+ suggestion: "Use Angular i18n or ngx-translate"
44
+
45
+ deprecated_http:
46
+ description: "Using deprecated Http module"
47
+ severity: high
48
+ pattern: "import.*from\\s*['\"]@angular/http['\"]"
49
+ suggestion: "Use HttpClient from @angular/common/http"
50
+
51
+ rxjs_compat:
52
+ description: "Using rxjs-compat (legacy)"
53
+ severity: medium
54
+ pattern: "from\\s*['\"]rxjs-compat"
55
+ suggestion: "Migrate to modern rxjs imports"
56
+
57
+ manual_change_detection:
58
+ description: "Manual change detection often indicates design issues"
59
+ severity: medium
60
+ pattern: "ChangeDetectorRef|detectChanges\\(\\)"
61
+ suggestion: "Use OnPush strategy with async pipe for better performance"
62
+
63
+ # Angular naming conventions
64
+ naming:
65
+ generic_names:
66
+ - data
67
+ - result
68
+ - temp
69
+ - handler
70
+ - service
71
+ - component
72
+ - item
73
+ - val
74
+
75
+ conventions:
76
+ components: PascalCase + Component suffix
77
+ services: PascalCase + Service suffix
78
+ modules: PascalCase + Module suffix
79
+ directives: camelCase + Directive suffix
80
+ pipes: camelCase + Pipe suffix
81
+ files: kebab-case
82
+
83
+ # Angular-specific thresholds (production-grade)
84
+ thresholds:
85
+ complexity: 10 # Lower than backend - templates add complexity
86
+ function_length: 50 # Single responsibility
87
+ nesting_depth: 3 # Readable code
88
+ file_length: 300 # Encourages component extraction
89
+ component_methods: 7 # Components should be focused
90
+ injected_services: 4 # >4 deps = too many responsibilities
91
+
92
+ # Angular anti-patterns
93
+ anti_patterns:
94
+ fat_component:
95
+ description: "Component with too much business logic"
96
+ max_methods: 10
97
+
98
+ service_in_component:
99
+ description: "Business logic should be in services"
100
+ suggestion: "Move logic to injectable service"
101
+
102
+ memory_leak:
103
+ description: "Subscriptions not cleaned up"
104
+ suggestion: "Use takeUntil pattern or async pipe"
@@ -0,0 +1,84 @@
1
+ # ASP.NET Core Framework Configuration for REF Agents
2
+ # Extends: csharp.yaml
3
+
4
+ framework: aspnet
5
+ base_language: csharp
6
+
7
+ # ASP.NET Core-specific debt patterns
8
+ debt_patterns:
9
+ missing_cancellation_token:
10
+ description: "Async action methods without CancellationToken cannot be cancelled by the client"
11
+ severity: medium
12
+ pattern: "public\\s+async\\s+Task<.*>\\s+\\w+\\s*\\([^)]*\\)(?![^{]*CancellationToken)"
13
+ suggestion: "Add CancellationToken cancellationToken = default to async action parameters"
14
+
15
+ controller_business_logic:
16
+ description: "Business logic in controllers violates separation of concerns"
17
+ severity: high
18
+ pattern: "\\[(?:HttpGet|HttpPost|HttpPut|HttpDelete|HttpPatch)\\][^}]{300,}"
19
+ suggestion: "Extract business logic to a service class injected via constructor DI"
20
+
21
+ missing_api_controller_attribute:
22
+ description: "API controllers without [ApiController] lose automatic model validation and problem details"
23
+ severity: medium
24
+ pattern: "\\[Route\\(.*\\)\\]\\s*public\\s+class\\s+\\w+Controller(?!.*\\[ApiController\\])"
25
+ suggestion: "Add [ApiController] attribute above [Route] on all API controllers"
26
+
27
+ direct_http_client_instantiation:
28
+ description: "new HttpClient() bypasses IHttpClientFactory and leaks sockets"
29
+ severity: high
30
+ pattern: "new\\s+HttpClient\\s*\\("
31
+ suggestion: "Inject IHttpClientFactory and use CreateClient() or use typed clients"
32
+
33
+ synchronous_io_in_action:
34
+ description: "Synchronous IO in action methods blocks thread pool threads"
35
+ severity: high
36
+ pattern: "public\\s+(?!async)\\s*\\w+\\s+\\w+\\s*\\([^)]*\\)(?=.*Stream|.*File|.*Http)"
37
+ suggestion: "Make action method async and use async IO APIs"
38
+
39
+ hardcoded_cors_wildcard:
40
+ description: "Wildcard CORS policy is a security risk in production"
41
+ severity: critical
42
+ pattern: "\\.AllowAnyOrigin\\(\\)"
43
+ suggestion: "Specify explicit origins via WithOrigins() for production environments"
44
+
45
+ response_caching_on_authenticated:
46
+ description: "Response caching on authenticated endpoints may leak data across users"
47
+ severity: high
48
+ pattern: "\\[ResponseCache\\].*\\[Authorize\\]|\\[Authorize\\].*\\[ResponseCache\\]"
49
+ suggestion: "Do not cache responses on authenticated endpoints; use private cache-control"
50
+
51
+ missing_authorize_attribute:
52
+ description: "API controller actions without [Authorize] or [AllowAnonymous] may be unintentionally public"
53
+ severity: medium
54
+ pattern: "\\[Http(?:Get|Post|Put|Delete|Patch)\\]\\s*public(?!.*\\[Authorize\\]|.*\\[AllowAnonymous\\])"
55
+ suggestion: "Add [Authorize] or explicit [AllowAnonymous] to all action methods"
56
+
57
+ # ASP.NET Core naming conventions
58
+ naming:
59
+ conventions:
60
+ controllers: PascalCase + Controller suffix
61
+ services: PascalCase + Service suffix
62
+ interfaces: I prefix + PascalCase
63
+ dtos: PascalCase + Request/Response/Dto suffix
64
+ validators: PascalCase + Validator suffix
65
+ middleware: PascalCase + Middleware suffix
66
+
67
+ # ASP.NET Core thresholds
68
+ thresholds:
69
+ complexity: 10
70
+ function_length: 40
71
+ nesting_depth: 3
72
+ file_length: 300
73
+ controller_actions: 7
74
+
75
+ # ASP.NET Core anti-patterns
76
+ anti_patterns:
77
+ fat_controller:
78
+ description: "Controller with too many actions or direct data access"
79
+ max_methods: 8
80
+
81
+ service_locator:
82
+ description: "Resolving services from IServiceProvider manually (service locator anti-pattern)"
83
+ pattern: "serviceProvider\\.GetService|serviceProvider\\.GetRequiredService"
84
+ suggestion: "Use constructor injection instead"
@@ -0,0 +1,81 @@
1
+ # Entity Framework Core Framework Configuration for REF Agents
2
+ # Extends: csharp.yaml
3
+
4
+ framework: ef_core
5
+ base_language: csharp
6
+
7
+ # EF Core-specific debt patterns
8
+ debt_patterns:
9
+ missing_as_no_tracking:
10
+ description: "Read-only queries without AsNoTracking() load change tracker overhead unnecessarily"
11
+ severity: medium
12
+ pattern: "\\.Where\\(|\\.\\.FirstOrDefault\\(|\\.ToList\\(|\\.ToListAsync\\("
13
+ suggestion: "Add .AsNoTracking() for read-only queries: _context.Orders.AsNoTracking().Where(...)"
14
+
15
+ from_sql_raw_interpolation:
16
+ description: "String interpolation in FromSqlRaw/ExecuteSqlRaw is a SQL injection vulnerability"
17
+ severity: critical
18
+ pattern: "FromSqlRaw\\s*\\(\\s*\\$\"|ExecuteSqlRaw\\s*\\(\\s*\\$\""
19
+ suggestion: "Use FromSqlInterpolated() or parameterized queries with SqlParameter"
20
+
21
+ lazy_loading_n_plus_one:
22
+ description: "Navigation property access without explicit Include() triggers N+1 lazy-loading queries"
23
+ severity: high
24
+ pattern: "\\.virtual\\s+\\w+|LazyLoadingEnabled\\s*=\\s*true"
25
+ suggestion: "Use .Include() / .ThenInclude() for eager loading or projection with .Select()"
26
+
27
+ synchronous_db_call:
28
+ description: "Synchronous EF Core methods block thread pool threads under load"
29
+ severity: high
30
+ pattern: "\\.SaveChanges\\(\\)(?!Async)|\\.ToList\\(\\)(?!\\s*;//\\s*acceptable)"
31
+ suggestion: "Use async variants: SaveChangesAsync(), ToListAsync(), FirstOrDefaultAsync()"
32
+
33
+ context_per_request_violation:
34
+ description: "DbContext instantiated directly instead of via DI — breaks scoped lifetime"
35
+ severity: high
36
+ pattern: "new\\s+\\w+DbContext\\s*\\(|new\\s+\\w+Context\\s*\\("
37
+ suggestion: "Inject DbContext via constructor DI; register with AddDbContext<T>() as Scoped"
38
+
39
+ missing_index_hint:
40
+ description: "Queries on unindexed foreign key columns degrade at scale"
41
+ severity: medium
42
+ pattern: "\\.Where\\([^)]*Id\\s*==|\\[ForeignKey\\]"
43
+ suggestion: "Ensure foreign key columns have database indexes via HasIndex() in OnModelCreating"
44
+
45
+ unbounded_include:
46
+ description: "Include() without projection loads entire related collection into memory"
47
+ severity: medium
48
+ pattern: "\\.Include\\([^)]+\\)\\.Include\\([^)]+\\)\\.Include\\("
49
+ suggestion: "Use .Select() projection to load only required fields from related entities"
50
+
51
+ hardcoded_connection_string:
52
+ description: "Connection string in DbContext OnConfiguring instead of DI configuration"
53
+ severity: critical
54
+ pattern: "optionsBuilder\\.UseSqlServer\\s*\\(\\s*\"[^\"]{10,}\""
55
+ suggestion: "Read connection string from IConfiguration; configure in Program.cs AddDbContext"
56
+
57
+ # EF Core naming conventions
58
+ naming:
59
+ conventions:
60
+ db_context: PascalCase + Context suffix (e.g. ApplicationDbContext)
61
+ entities: PascalCase, singular noun
62
+ migrations: auto-generated, do not rename
63
+ repositories: PascalCase + Repository suffix
64
+
65
+ # EF Core thresholds
66
+ thresholds:
67
+ complexity: 12
68
+ function_length: 50
69
+ nesting_depth: 3
70
+ file_length: 400
71
+
72
+ # EF Core anti-patterns
73
+ anti_patterns:
74
+ repository_over_context:
75
+ description: "Repository wrapping DbContext adds abstraction with no benefit for simple CRUD"
76
+ suggestion: "Use DbContext directly in services for simple cases; add repositories only for complex query encapsulation"
77
+
78
+ generic_repository:
79
+ description: "Generic Repository<T> forces all entities through the same interface"
80
+ pattern: "class.*Repository<T>|IRepository<T>"
81
+ suggestion: "Use specific repositories or query objects for complex queries"
@@ -0,0 +1,111 @@
1
+ # React Framework Configuration for REF Agents
2
+ # Extends: typescript.yaml or javascript.yaml
3
+
4
+ framework: react
5
+ base_language: typescript # or javascript
6
+
7
+ # React-specific debt patterns
8
+ debt_patterns:
9
+ missing_key_prop:
10
+ description: "List items should have unique key props"
11
+ severity: high
12
+ pattern: "map\\s*\\([^)]+\\)\\s*=>\\s*<(?!.*key=)"
13
+ suggestion: "Add key prop to list items"
14
+
15
+ inline_styles:
16
+ description: "Inline styles block theming, caching, and responsive design"
17
+ severity: medium
18
+ pattern: "style=\\{\\{"
19
+ suggestion: "Use CSS modules, styled-components, or Tailwind"
20
+
21
+ direct_dom_manipulation:
22
+ description: "Direct DOM manipulation bypasses React"
23
+ severity: high
24
+ pattern: "document\\.(getElementById|querySelector|getElementsBy)"
25
+ suggestion: "Use refs and React state"
26
+
27
+ missing_dependency:
28
+ description: "useEffect missing dependencies"
29
+ severity: high
30
+ pattern: "useEffect\\([^,]+,\\s*\\[\\s*\\]\\)"
31
+ suggestion: "Add all dependencies or use useCallback/useMemo"
32
+
33
+ state_mutation:
34
+ description: "Direct state mutation"
35
+ severity: critical
36
+ pattern: "this\\.state\\.\\w+\\s*="
37
+ suggestion: "Use setState or useState setter"
38
+
39
+ prop_drilling:
40
+ description: "Props passed through many components"
41
+ severity: medium
42
+ pattern: "props\\.\\w+.*props\\.\\w+"
43
+ suggestion: "Use Context API or state management"
44
+
45
+ anonymous_function_prop:
46
+ description: "Anonymous functions cause unnecessary re-renders on every parent render"
47
+ severity: medium
48
+ pattern: "on\\w+=\\{\\([^)]*\\)\\s*=>"
49
+ suggestion: "Extract to useCallback for stable references"
50
+
51
+ missing_error_boundary:
52
+ description: "Error boundaries catch rendering errors"
53
+ severity: medium
54
+ pattern: "class.*extends.*Component(?!.*componentDidCatch)"
55
+ suggestion: "Add error boundary for graceful error handling"
56
+
57
+ deprecated_lifecycle:
58
+ description: "Deprecated lifecycle methods"
59
+ severity: high
60
+ pattern: "componentWillMount|componentWillReceiveProps|componentWillUpdate"
61
+ suggestion: "Use componentDidMount, getDerivedStateFromProps, getSnapshotBeforeUpdate"
62
+
63
+ # React naming conventions
64
+ naming:
65
+ generic_names:
66
+ - data
67
+ - result
68
+ - temp
69
+ - handler
70
+ - state
71
+ - props
72
+ - item
73
+ - val
74
+
75
+ conventions:
76
+ components: PascalCase
77
+ hooks: camelCase (use prefix)
78
+ utils: camelCase
79
+ constants: UPPER_SNAKE_CASE
80
+ files: PascalCase for components
81
+
82
+ # React-specific thresholds (production-grade)
83
+ thresholds:
84
+ complexity: 10 # Lower than backend - JSX adds visual complexity
85
+ function_length: 50 # Components should be focused and testable
86
+ nesting_depth: 3
87
+ file_length: 200 # Encourages component extraction
88
+ component_props: 5 # >5 props = prop drilling smell
89
+ hooks_per_component: 4 # >4 hooks = component doing too much
90
+
91
+ # React anti-patterns (production-grade)
92
+ anti_patterns:
93
+ prop_drilling:
94
+ description: "Props passed through too many levels"
95
+ max_levels: 2
96
+ severity: medium
97
+
98
+ large_component:
99
+ description: "Component is too large - split into smaller, testable units"
100
+ max_lines: 100 # Stricter than before
101
+ severity: medium
102
+
103
+ too_many_hooks:
104
+ description: "Too many hooks = component doing too much"
105
+ max_hooks: 4
106
+ severity: medium
107
+
108
+ too_many_props:
109
+ description: "Too many props indicates component needs decomposition"
110
+ max_props: 5
111
+ severity: medium
@@ -0,0 +1,117 @@
1
+ # Spring Boot Framework Configuration for REF Agents
2
+ # Extends: java.yaml
3
+
4
+ framework: spring_boot
5
+ base_language: java
6
+
7
+ # Spring Boot-specific debt patterns
8
+ debt_patterns:
9
+ field_injection:
10
+ description: "Field injection hides dependencies, breaks immutability, makes testing hard"
11
+ severity: high
12
+ pattern: "@Autowired\\s+private"
13
+ suggestion: "Use constructor injection (Spring auto-wires single constructor)"
14
+
15
+ missing_transactional:
16
+ description: "Data modification without transaction risks partial writes"
17
+ severity: high
18
+ pattern: "@Service(?!.*@Transactional)"
19
+ suggestion: "Add @Transactional to service class or methods"
20
+
21
+ entity_in_controller:
22
+ description: "Exposing JPA entities in API responses"
23
+ severity: high
24
+ pattern: "@RestController.*@Entity|ResponseEntity<.*Entity>"
25
+ suggestion: "Use DTOs for API responses"
26
+
27
+ n_plus_one:
28
+ description: "Potential N+1 query problem"
29
+ severity: high
30
+ pattern: "@OneToMany(?!.*fetch.*EAGER|.*@BatchSize)"
31
+ suggestion: "Use @BatchSize, JOIN FETCH, or EntityGraph"
32
+
33
+ missing_validation:
34
+ description: "Unvalidated input is security risk and causes unclear errors"
35
+ severity: high
36
+ pattern: "@RequestBody(?!.*@Valid)"
37
+ suggestion: "Add @Valid annotation for request validation"
38
+
39
+ hardcoded_credentials:
40
+ description: "Credentials should be externalized"
41
+ severity: critical
42
+ pattern: "password\\s*=\\s*['\"][^'\"]+['\"]"
43
+ suggestion: "Use @Value or ConfigurationProperties"
44
+
45
+ missing_exception_handler:
46
+ description: "Controllers should have exception handling"
47
+ severity: medium
48
+ pattern: "@RestController(?!.*@ExceptionHandler|@ControllerAdvice)"
49
+ suggestion: "Add @ControllerAdvice for global exception handling"
50
+
51
+ deprecated_web_security:
52
+ description: "WebSecurityConfigurerAdapter is deprecated"
53
+ severity: high
54
+ pattern: "extends\\s+WebSecurityConfigurerAdapter"
55
+ suggestion: "Use SecurityFilterChain bean"
56
+
57
+ blocking_in_reactive:
58
+ description: "Blocking calls in reactive pipeline"
59
+ severity: high
60
+ pattern: "\\.block\\(\\)|Mono\\.just.*\\.subscribe"
61
+ suggestion: "Use reactive operators throughout"
62
+
63
+ circular_dependency:
64
+ description: "Circular dependency between beans"
65
+ severity: high
66
+ pattern: "@Lazy.*@Autowired|@Autowired.*@Lazy"
67
+ suggestion: "Refactor to remove circular dependency"
68
+
69
+ sql_injection:
70
+ description: "Potential SQL injection"
71
+ severity: critical
72
+ pattern: "createQuery\\(.*\\+|createNativeQuery\\(.*\\+"
73
+ suggestion: "Use parameterized queries or JPA Criteria"
74
+
75
+ # Spring naming conventions
76
+ naming:
77
+ generic_names:
78
+ - data
79
+ - result
80
+ - response
81
+ - request
82
+ - entity
83
+ - dto
84
+ - service
85
+ - repository
86
+
87
+ conventions:
88
+ controllers: PascalCase + Controller suffix
89
+ services: PascalCase + Service suffix
90
+ repositories: PascalCase + Repository suffix
91
+ entities: PascalCase
92
+ dtos: PascalCase + DTO/Request/Response suffix
93
+ config: PascalCase + Config suffix
94
+
95
+ # Spring-specific thresholds (production-grade)
96
+ thresholds:
97
+ complexity: 12 # Maintainable, testable code
98
+ function_length: 50 # Single responsibility
99
+ nesting_depth: 3 # Readable code
100
+ file_length: 300 # Single responsibility
101
+ controller_methods: 7 # REST resources should be focused
102
+ service_dependencies: 4 # >4 deps = too many responsibilities
103
+
104
+ # Spring anti-patterns
105
+ anti_patterns:
106
+ god_service:
107
+ description: "Service with too many responsibilities"
108
+ max_methods: 15
109
+ max_dependencies: 5
110
+
111
+ anemic_domain:
112
+ description: "Entities with only getters/setters"
113
+ suggestion: "Add domain logic to entities"
114
+
115
+ transaction_boundary:
116
+ description: "Transaction spanning multiple services"
117
+ suggestion: "Review transaction boundaries"