@aiready/pattern-detect 0.17.8 → 0.17.12

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 (190) hide show
  1. package/dist/analyzer-entry/index.d.mts +1 -1
  2. package/dist/analyzer-entry/index.d.ts +1 -1
  3. package/dist/analyzer-entry/index.js +370 -135
  4. package/dist/analyzer-entry/index.mjs +4 -3
  5. package/dist/chunk-2P7BQHGR.mjs +306 -0
  6. package/dist/{chunk-VGMM3L3O.mjs → chunk-3EORD7DC.mjs} +1 -1
  7. package/dist/{chunk-GREN7X5H.mjs → chunk-4PVPQMRT.mjs} +2 -2
  8. package/dist/{chunk-RS73WLNI.mjs → chunk-6VDL7TAS.mjs} +5 -113
  9. package/dist/chunk-AQIP4JGM.mjs +283 -0
  10. package/dist/{chunk-JBUZ6YHE.mjs → chunk-B4NLWKPZ.mjs} +85 -9
  11. package/dist/chunk-IPBGVPUX.mjs +143 -0
  12. package/dist/chunk-LUUJOUK5.mjs +283 -0
  13. package/dist/chunk-P3BOCGVV.mjs +498 -0
  14. package/dist/{scoring-entry.js → chunk-PHJE6A3J.mjs} +20 -37
  15. package/dist/chunk-PQXOORR4.mjs +234 -0
  16. package/dist/{chunk-GLKAGFKX.mjs → chunk-RDR75DVI.mjs} +85 -9
  17. package/dist/chunk-SXVLRPMF.mjs +143 -0
  18. package/dist/{chunk-DNZS4ESD.mjs → chunk-SY7RX5YQ.mjs} +85 -9
  19. package/dist/{context-rules-entry.js → chunk-TIBF7KST.mjs} +81 -78
  20. package/dist/chunk-WYYSQX5M.mjs +467 -0
  21. package/dist/{chunk-I6ETJC7L.mjs → chunk-X553BOMI.mjs} +56 -26
  22. package/dist/{chunk-K7BO57OO.mjs → chunk-Y6OB7K34.mjs} +80 -4
  23. package/dist/chunk-YLVV6YZ5.mjs +143 -0
  24. package/dist/chunk-ZUWPFVJV.mjs +115 -0
  25. package/dist/chunk-ZZMONVPE.mjs +467 -0
  26. package/dist/cli.js +402 -167
  27. package/dist/cli.mjs +4 -3
  28. package/dist/context-rules-entry/index.d.mts +35 -1
  29. package/dist/context-rules-entry/index.d.ts +35 -1
  30. package/dist/context-rules-entry/index.js +194 -48
  31. package/dist/context-rules-entry/index.mjs +1 -1
  32. package/dist/detector-entry/index.js +192 -46
  33. package/dist/detector-entry/index.mjs +2 -2
  34. package/dist/{analyzer-entry-BVz-HnZd.d.mts → index-B-pnXpgn.d.mts} +10 -1
  35. package/dist/{index-BwuoiCNm.d.ts → index-CWgYOKaK.d.ts} +35 -16
  36. package/dist/{index-BVz-HnZd.d.mts → index-Dl4BrGIT.d.mts} +35 -16
  37. package/dist/{analyzer-entry-BwuoiCNm.d.ts → index-DqS2e0kK.d.ts} +10 -1
  38. package/dist/index.d.mts +5 -6
  39. package/dist/index.d.ts +5 -6
  40. package/dist/index.js +467 -214
  41. package/dist/index.mjs +37 -22
  42. package/dist/scoring-entry/index.js +7 -3
  43. package/dist/scoring-entry/index.mjs +1 -1
  44. package/package.json +2 -2
  45. package/dist/analyzer-entry.d.mts +0 -100
  46. package/dist/analyzer-entry.d.ts +0 -100
  47. package/dist/analyzer-entry.js +0 -693
  48. package/dist/analyzer-entry.mjs +0 -12
  49. package/dist/chunk-262N2JB7.mjs +0 -497
  50. package/dist/chunk-2R7HOR5H.mjs +0 -777
  51. package/dist/chunk-3D7RVGHM.mjs +0 -64
  52. package/dist/chunk-3LS3E6MO.mjs +0 -508
  53. package/dist/chunk-3VRQYFW3.mjs +0 -782
  54. package/dist/chunk-3WK24ZOX.mjs +0 -860
  55. package/dist/chunk-3YYN6ZXN.mjs +0 -1038
  56. package/dist/chunk-4BPRGZRG.mjs +0 -1041
  57. package/dist/chunk-4UHDGB7U.mjs +0 -920
  58. package/dist/chunk-5LYDB7DY.mjs +0 -771
  59. package/dist/chunk-65G3HXLQ.mjs +0 -497
  60. package/dist/chunk-65UQ5J2J.mjs +0 -64
  61. package/dist/chunk-6JTVOBJX.mjs +0 -64
  62. package/dist/chunk-6OEHUI5J.mjs +0 -1045
  63. package/dist/chunk-6YUGU4P4.mjs +0 -914
  64. package/dist/chunk-7EJGNGXM.mjs +0 -771
  65. package/dist/chunk-7O2DUBSN.mjs +0 -1058
  66. package/dist/chunk-7S4AUL5S.mjs +0 -911
  67. package/dist/chunk-A76JUWER.mjs +0 -786
  68. package/dist/chunk-AJZUNNFH.mjs +0 -817
  69. package/dist/chunk-AXHGYYYZ.mjs +0 -404
  70. package/dist/chunk-BKRPSTT2.mjs +0 -64
  71. package/dist/chunk-BUBQ3W6W.mjs +0 -980
  72. package/dist/chunk-CCHM2VLK.mjs +0 -1051
  73. package/dist/chunk-CHFK6EBT.mjs +0 -419
  74. package/dist/chunk-CMT3MWWO.mjs +0 -948
  75. package/dist/chunk-CMWW24HW.mjs +0 -259
  76. package/dist/chunk-CTDBJP25.mjs +0 -1043
  77. package/dist/chunk-DGAKXYIP.mjs +0 -1041
  78. package/dist/chunk-DQSLTL7J.mjs +0 -788
  79. package/dist/chunk-DR5W7S3Z.mjs +0 -968
  80. package/dist/chunk-EFUKPMBE.mjs +0 -950
  81. package/dist/chunk-EVBFDILL.mjs +0 -927
  82. package/dist/chunk-EXORBAXR.mjs +0 -887
  83. package/dist/chunk-EZT3NZGB.mjs +0 -1057
  84. package/dist/chunk-FWUKMJEQ.mjs +0 -1133
  85. package/dist/chunk-GSJFORRO.mjs +0 -504
  86. package/dist/chunk-H4ADJYOG.mjs +0 -925
  87. package/dist/chunk-H5FB2USZ.mjs +0 -762
  88. package/dist/chunk-H73HEG7M.mjs +0 -670
  89. package/dist/chunk-HOS5Z2NC.mjs +0 -669
  90. package/dist/chunk-HXHQOQB5.mjs +0 -508
  91. package/dist/chunk-INEOYHUM.mjs +0 -911
  92. package/dist/chunk-INJ4SBTV.mjs +0 -754
  93. package/dist/chunk-J5CW6NYY.mjs +0 -64
  94. package/dist/chunk-JAFZCZAP.mjs +0 -776
  95. package/dist/chunk-JKVKOXYR.mjs +0 -407
  96. package/dist/chunk-JTHW7EYW.mjs +0 -1041
  97. package/dist/chunk-JWR3AHKO.mjs +0 -788
  98. package/dist/chunk-KC2CQMG2.mjs +0 -858
  99. package/dist/chunk-KDWGWBP5.mjs +0 -832
  100. package/dist/chunk-KPEK5REL.mjs +0 -919
  101. package/dist/chunk-KT6O2IAE.mjs +0 -861
  102. package/dist/chunk-KWMNN3TG.mjs +0 -391
  103. package/dist/chunk-LUA5FXSZ.mjs +0 -771
  104. package/dist/chunk-LYKRYBSM.mjs +0 -64
  105. package/dist/chunk-M4PQMW34.mjs +0 -480
  106. package/dist/chunk-MH6LBXZF.mjs +0 -816
  107. package/dist/chunk-MHU3CL4R.mjs +0 -64
  108. package/dist/chunk-MJWBS6SM.mjs +0 -1058
  109. package/dist/chunk-OFGMDX66.mjs +0 -402
  110. package/dist/chunk-P7B6Z4I2.mjs +0 -1043
  111. package/dist/chunk-PBCXSG7E.mjs +0 -658
  112. package/dist/chunk-PEEHSFDR.mjs +0 -1058
  113. package/dist/chunk-PSVG2NLH.mjs +0 -966
  114. package/dist/chunk-PWNQ6JZW.mjs +0 -508
  115. package/dist/chunk-QE4E3F7C.mjs +0 -410
  116. package/dist/chunk-QEP76HGK.mjs +0 -1039
  117. package/dist/chunk-QX2BQJEO.mjs +0 -1058
  118. package/dist/chunk-R2S73CVG.mjs +0 -503
  119. package/dist/chunk-RMGDSNLE.mjs +0 -770
  120. package/dist/chunk-S2KQFII2.mjs +0 -491
  121. package/dist/chunk-SLDK5PQK.mjs +0 -1129
  122. package/dist/chunk-SNSDVGWW.mjs +0 -783
  123. package/dist/chunk-SUUZMLPS.mjs +0 -391
  124. package/dist/chunk-SVCSIZ2A.mjs +0 -259
  125. package/dist/chunk-T2C6WS73.mjs +0 -670
  126. package/dist/chunk-TCG2G32F.mjs +0 -911
  127. package/dist/chunk-TGBZP7SB.mjs +0 -773
  128. package/dist/chunk-THF4RW63.mjs +0 -254
  129. package/dist/chunk-TJKDLVLN.mjs +0 -503
  130. package/dist/chunk-TXWPOVYU.mjs +0 -402
  131. package/dist/chunk-UB3CGOQ7.mjs +0 -64
  132. package/dist/chunk-UKIKN27B.mjs +0 -950
  133. package/dist/chunk-V5DP4FP6.mjs +0 -876
  134. package/dist/chunk-VRMXVYDZ.mjs +0 -419
  135. package/dist/chunk-WACZ5LFH.mjs +0 -1055
  136. package/dist/chunk-WC7CBAA7.mjs +0 -1058
  137. package/dist/chunk-WKBCNITM.mjs +0 -1072
  138. package/dist/chunk-WMOGJFME.mjs +0 -391
  139. package/dist/chunk-X4GR2N2M.mjs +0 -947
  140. package/dist/chunk-XCWY2DQY.mjs +0 -788
  141. package/dist/chunk-XJD35DS6.mjs +0 -1058
  142. package/dist/chunk-XNPID6FU.mjs +0 -391
  143. package/dist/chunk-XUUVS54V.mjs +0 -776
  144. package/dist/chunk-YCGV65F5.mjs +0 -508
  145. package/dist/chunk-YJYDBFT3.mjs +0 -780
  146. package/dist/chunk-YP3HEDQW.mjs +0 -859
  147. package/dist/chunk-YSDOUNJJ.mjs +0 -1142
  148. package/dist/chunk-Z6GBFFOV.mjs +0 -1040
  149. package/dist/cli.d.ts.map +0 -1
  150. package/dist/cli.js.map +0 -1
  151. package/dist/context-rules-entry-y2uJSngh.d.mts +0 -60
  152. package/dist/context-rules-entry-y2uJSngh.d.ts +0 -60
  153. package/dist/context-rules-entry.d.mts +0 -55
  154. package/dist/context-rules-entry.d.ts +0 -55
  155. package/dist/context-rules-entry.mjs +0 -12
  156. package/dist/context-rules.d.ts +0 -41
  157. package/dist/context-rules.d.ts.map +0 -1
  158. package/dist/context-rules.js +0 -225
  159. package/dist/context-rules.js.map +0 -1
  160. package/dist/detector-entry.d.mts +0 -14
  161. package/dist/detector-entry.d.ts +0 -14
  162. package/dist/detector-entry.js +0 -301
  163. package/dist/detector-entry.mjs +0 -7
  164. package/dist/detector.d.ts +0 -40
  165. package/dist/detector.d.ts.map +0 -1
  166. package/dist/detector.js +0 -385
  167. package/dist/detector.js.map +0 -1
  168. package/dist/extractors/python-extractor.d.ts +0 -19
  169. package/dist/extractors/python-extractor.d.ts.map +0 -1
  170. package/dist/extractors/python-extractor.js +0 -164
  171. package/dist/extractors/python-extractor.js.map +0 -1
  172. package/dist/grouping.d.ts +0 -54
  173. package/dist/grouping.d.ts.map +0 -1
  174. package/dist/grouping.js +0 -347
  175. package/dist/grouping.js.map +0 -1
  176. package/dist/index-y2uJSngh.d.mts +0 -60
  177. package/dist/index-y2uJSngh.d.ts +0 -60
  178. package/dist/index.d.ts.map +0 -1
  179. package/dist/index.js.map +0 -1
  180. package/dist/python-extractor-BGKGX6BK.mjs +0 -131
  181. package/dist/python-extractor-ELAKYK2W.mjs +0 -140
  182. package/dist/scoring-entry.d.mts +0 -23
  183. package/dist/scoring-entry.d.ts +0 -23
  184. package/dist/scoring-entry.mjs +0 -6
  185. package/dist/scoring.d.ts +0 -12
  186. package/dist/scoring.d.ts.map +0 -1
  187. package/dist/scoring.js +0 -116
  188. package/dist/scoring.js.map +0 -1
  189. package/dist/types-C4lmb2Yh.d.mts +0 -36
  190. package/dist/types-C4lmb2Yh.d.ts +0 -36
@@ -1,34 +1,10 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/context-rules-entry.ts
21
- var context_rules_entry_exports = {};
22
- __export(context_rules_entry_exports, {
23
- calculateSeverity: () => calculateSeverity,
24
- filterBySeverity: () => filterBySeverity,
25
- getSeverityLabel: () => getSeverityLabel,
26
- getSeverityThreshold: () => getSeverityThreshold
27
- });
28
- module.exports = __toCommonJS(context_rules_entry_exports);
29
-
30
1
  // src/context-rules.ts
31
- var import_core = require("@aiready/core");
2
+ import {
3
+ IssueType,
4
+ getSeverityLabel,
5
+ filterBySeverity,
6
+ Severity
7
+ } from "@aiready/core";
32
8
  var CONTEXT_RULES = [
33
9
  // Test Fixtures - Intentional duplication for test isolation
34
10
  {
@@ -38,7 +14,7 @@ var CONTEXT_RULES = [
38
14
  const hasTestFixtures = code.includes("beforeAll") || code.includes("afterAll") || code.includes("beforeEach") || code.includes("afterEach") || code.includes("setUp") || code.includes("tearDown");
39
15
  return isTestFile && hasTestFixtures;
40
16
  },
41
- severity: import_core.Severity.Info,
17
+ severity: Severity.Info,
42
18
  reason: "Test fixture duplication is intentional for test isolation",
43
19
  suggestion: "Consider if shared test setup would improve maintainability without coupling tests"
44
20
  },
@@ -50,7 +26,7 @@ var CONTEXT_RULES = [
50
26
  const hasTemplateContent = (code.includes("return") || code.includes("export")) && (code.includes("html") || code.includes("subject") || code.includes("body"));
51
27
  return isTemplate && hasTemplateContent;
52
28
  },
53
- severity: import_core.Severity.Minor,
29
+ severity: Severity.Minor,
54
30
  reason: "Template duplication may be intentional for maintainability and branding consistency",
55
31
  suggestion: "Extract shared structure only if templates become hard to maintain"
56
32
  },
@@ -62,7 +38,7 @@ var CONTEXT_RULES = [
62
38
  const hasPageObjectPatterns = code.includes("page.") || code.includes("await page") || code.includes("locator") || code.includes("getBy") || code.includes("selector") || code.includes("click(") || code.includes("fill(");
63
39
  return isE2ETest && hasPageObjectPatterns;
64
40
  },
65
- severity: import_core.Severity.Minor,
41
+ severity: Severity.Minor,
66
42
  reason: "E2E test duplication ensures test independence and reduces coupling",
67
43
  suggestion: "Consider page object pattern only if duplication causes maintenance issues"
68
44
  },
@@ -72,20 +48,21 @@ var CONTEXT_RULES = [
72
48
  detect: (file) => {
73
49
  return file.endsWith(".config.ts") || file.endsWith(".config.js") || file.includes("jest.config") || file.includes("vite.config") || file.includes("webpack.config") || file.includes("rollup.config") || file.includes("tsconfig");
74
50
  },
75
- severity: import_core.Severity.Minor,
51
+ severity: Severity.Minor,
76
52
  reason: "Configuration files often have similar structure by design",
77
53
  suggestion: "Consider shared config base only if configurations become hard to maintain"
78
54
  },
79
55
  // Type Definitions - Duplication for type safety and module independence
56
+ // Only apply to .d.ts files or files in /types/ directories, not to all files containing interfaces
80
57
  {
81
58
  name: "type-definitions",
82
59
  detect: (file, code) => {
83
60
  const isTypeFile = file.endsWith(".d.ts") || file.includes("/types/");
84
- const hasTypeDefinitions = code.includes("interface ") || code.includes("type ") || code.includes("enum ");
85
- return isTypeFile && hasTypeDefinitions;
61
+ const hasOnlyTypeDefinitions = (code.includes("interface ") || code.includes("type ") || code.includes("enum ")) && !code.includes("function ") && !code.includes("class ") && !code.includes("const ") && !code.includes("let ") && !code.includes("export default");
62
+ return isTypeFile && hasOnlyTypeDefinitions;
86
63
  },
87
- severity: import_core.Severity.Info,
88
- reason: "Type duplication may be intentional for module independence and type safety",
64
+ severity: Severity.Info,
65
+ reason: "Type-only files may be intentionally duplicated for module independence",
89
66
  suggestion: "Extract to shared types package only if causing maintenance burden"
90
67
  },
91
68
  // Migration Scripts - One-off scripts that are similar by nature
@@ -94,7 +71,7 @@ var CONTEXT_RULES = [
94
71
  detect: (file) => {
95
72
  return file.includes("/migrations/") || file.includes("/migrate/") || file.includes(".migration.");
96
73
  },
97
- severity: import_core.Severity.Info,
74
+ severity: Severity.Info,
98
75
  reason: "Migration scripts are typically one-off and intentionally similar",
99
76
  suggestion: "Duplication is acceptable for migration scripts"
100
77
  },
@@ -106,7 +83,7 @@ var CONTEXT_RULES = [
106
83
  const hasMockData = code.includes("mock") || code.includes("Mock") || code.includes("fixture") || code.includes("stub") || code.includes("export const");
107
84
  return isMockFile && hasMockData;
108
85
  },
109
- severity: import_core.Severity.Info,
86
+ severity: Severity.Info,
110
87
  reason: "Mock data duplication is expected for comprehensive test coverage",
111
88
  suggestion: "Consider shared factories only for complex mock generation"
112
89
  },
@@ -118,9 +95,56 @@ var CONTEXT_RULES = [
118
95
  const hasToolStructure = code.includes("execute") && (code.includes("try") || code.includes("catch"));
119
96
  return isToolFile && hasToolStructure;
120
97
  },
121
- severity: import_core.Severity.Info,
98
+ severity: Severity.Info,
122
99
  reason: "Tool implementations share structural boilerplate but have distinct business logic",
123
100
  suggestion: "Tool duplication is acceptable for boilerplate interface wrappers"
101
+ },
102
+ // Common UI Event Handlers - Boilerplate by nature
103
+ {
104
+ name: "common-ui-handlers",
105
+ detect: (file, code) => {
106
+ const isUIFile = file.includes("/components/") || file.includes(".tsx") || file.includes(".jsx") || file.includes("/hooks/");
107
+ const hasCommonHandler = code.includes("handleClickOutside") || code.includes("handleClickInside") || code.includes("handleEscape") || code.includes("handleKeyDown") || code.includes("handleKeyUp") || code.includes("handleMouseDown") || code.includes("handleMouseUp") || code.includes("handleFocus") || code.includes("handleBlur") || code.includes("handleResize") || code.includes("handleScroll") || code.includes("handleSubmit") || code.includes("handleCancel") || code.includes("handleClose") || code.includes("handleOpen") || code.includes("handleToggle");
108
+ return isUIFile && hasCommonHandler;
109
+ },
110
+ severity: Severity.Minor,
111
+ reason: "Common UI event handlers are boilerplate patterns that repeat across components",
112
+ suggestion: "Consider extracting to shared hooks (useClickOutside, useEscapeKey) only if causing maintenance issues"
113
+ },
114
+ // Utility Functions - Small helpers in dedicated utility files
115
+ {
116
+ name: "utility-functions",
117
+ detect: (file, code) => {
118
+ const isUtilFile = file.endsWith(".util.ts") || file.endsWith(".helper.ts") || file.endsWith(".utils.ts");
119
+ const hasUtilPattern = code.includes("function format") || code.includes("function parse") || code.includes("function sanitize") || code.includes("function normalize") || code.includes("function convert");
120
+ return isUtilFile && hasUtilPattern;
121
+ },
122
+ severity: Severity.Minor,
123
+ reason: "Utility functions in dedicated utility files may be intentionally similar",
124
+ suggestion: "Consider extracting to shared utilities only if causing significant duplication"
125
+ },
126
+ // React/Vue Hooks - Standard patterns
127
+ {
128
+ name: "shared-hooks",
129
+ detect: (file, code) => {
130
+ const isHookFile = file.includes("/hooks/") || file.endsWith(".hook.ts") || file.endsWith(".hook.tsx");
131
+ const hasHookPattern = code.includes("function use") || code.includes("export function use") || code.includes("const use") || code.includes("export const use");
132
+ return isHookFile && hasHookPattern;
133
+ },
134
+ severity: Severity.Minor,
135
+ reason: "Hooks follow standard patterns and are often intentionally similar across components",
136
+ suggestion: "Consider extracting common hook logic only if hooks become complex"
137
+ },
138
+ // Validation Functions - Inherently similar patterns
139
+ {
140
+ name: "validation-functions",
141
+ detect: (file, code) => {
142
+ const hasValidationPattern = code.includes("isValid") || code.includes("validate") || code.includes("checkValid") || code.includes("isEmail") || code.includes("isPhone") || code.includes("isUrl") || code.includes("isNumeric") || code.includes("isAlpha") || code.includes("isAlphanumeric") || code.includes("isEmpty") || code.includes("isNotEmpty") || code.includes("isRequired") || code.includes("isOptional");
143
+ return hasValidationPattern;
144
+ },
145
+ severity: Severity.Minor,
146
+ reason: "Validation functions are inherently similar and often intentionally duplicated for domain clarity",
147
+ suggestion: "Consider extracting to shared validators only if validation logic becomes complex"
124
148
  }
125
149
  ];
126
150
  function calculateSeverity(file1, file2, code, similarity, linesOfCode) {
@@ -136,72 +160,51 @@ function calculateSeverity(file1, file2, code, similarity, linesOfCode) {
136
160
  }
137
161
  if (similarity >= 0.95 && linesOfCode >= 30) {
138
162
  return {
139
- severity: import_core.Severity.Critical,
163
+ severity: Severity.Critical,
140
164
  reason: "Large nearly-identical code blocks waste tokens and create maintenance burden",
141
165
  suggestion: "Extract to shared utility module immediately"
142
166
  };
143
167
  } else if (similarity >= 0.95 && linesOfCode >= 15) {
144
168
  return {
145
- severity: import_core.Severity.Major,
169
+ severity: Severity.Major,
146
170
  reason: "Nearly identical code should be consolidated",
147
171
  suggestion: "Move to shared utility file"
148
172
  };
149
173
  } else if (similarity >= 0.85) {
150
174
  return {
151
- severity: import_core.Severity.Major,
175
+ severity: Severity.Major,
152
176
  reason: "High similarity indicates significant duplication",
153
177
  suggestion: "Extract common logic to shared function"
154
178
  };
155
179
  } else if (similarity >= 0.7) {
156
180
  return {
157
- severity: import_core.Severity.Minor,
181
+ severity: Severity.Minor,
158
182
  reason: "Moderate similarity detected",
159
183
  suggestion: "Consider extracting shared patterns if code evolves together"
160
184
  };
161
185
  } else {
162
186
  return {
163
- severity: import_core.Severity.Minor,
187
+ severity: Severity.Minor,
164
188
  reason: "Minor similarity detected",
165
189
  suggestion: "Monitor but refactoring may not be worthwhile"
166
190
  };
167
191
  }
168
192
  }
169
- function getSeverityLabel(severity) {
170
- const labels = {
171
- [import_core.Severity.Critical]: "\u{1F534} CRITICAL",
172
- [import_core.Severity.Major]: "\u{1F7E1} MAJOR",
173
- [import_core.Severity.Minor]: "\u{1F535} MINOR",
174
- [import_core.Severity.Info]: "\u2139\uFE0F INFO"
175
- };
176
- return labels[severity];
177
- }
178
- function filterBySeverity(duplicates, minSeverity) {
179
- const severityOrder = [
180
- import_core.Severity.Info,
181
- import_core.Severity.Minor,
182
- import_core.Severity.Major,
183
- import_core.Severity.Critical
184
- ];
185
- const minIndex = severityOrder.indexOf(minSeverity);
186
- if (minIndex === -1) return duplicates;
187
- return duplicates.filter((dup) => {
188
- const dupIndex = severityOrder.indexOf(dup.severity);
189
- return dupIndex >= minIndex;
190
- });
191
- }
192
193
  function getSeverityThreshold(severity) {
193
194
  const thresholds = {
194
- [import_core.Severity.Critical]: 0.95,
195
- [import_core.Severity.Major]: 0.85,
196
- [import_core.Severity.Minor]: 0.5,
197
- [import_core.Severity.Info]: 0
195
+ [Severity.Critical]: 0.95,
196
+ [Severity.Major]: 0.85,
197
+ [Severity.Minor]: 0.5,
198
+ [Severity.Info]: 0
198
199
  };
199
200
  return thresholds[severity] || 0;
200
201
  }
201
- // Annotate the CommonJS export names for ESM import in node:
202
- 0 && (module.exports = {
203
- calculateSeverity,
204
- filterBySeverity,
202
+
203
+ export {
204
+ IssueType,
205
205
  getSeverityLabel,
206
+ filterBySeverity,
207
+ CONTEXT_RULES,
208
+ calculateSeverity,
206
209
  getSeverityThreshold
207
- });
210
+ };