@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.
- package/dist/analyzer-entry/index.d.mts +1 -1
- package/dist/analyzer-entry/index.d.ts +1 -1
- package/dist/analyzer-entry/index.js +370 -135
- package/dist/analyzer-entry/index.mjs +4 -3
- package/dist/chunk-2P7BQHGR.mjs +306 -0
- package/dist/{chunk-VGMM3L3O.mjs → chunk-3EORD7DC.mjs} +1 -1
- package/dist/{chunk-GREN7X5H.mjs → chunk-4PVPQMRT.mjs} +2 -2
- package/dist/{chunk-RS73WLNI.mjs → chunk-6VDL7TAS.mjs} +5 -113
- package/dist/chunk-AQIP4JGM.mjs +283 -0
- package/dist/{chunk-JBUZ6YHE.mjs → chunk-B4NLWKPZ.mjs} +85 -9
- package/dist/chunk-IPBGVPUX.mjs +143 -0
- package/dist/chunk-LUUJOUK5.mjs +283 -0
- package/dist/chunk-P3BOCGVV.mjs +498 -0
- package/dist/{scoring-entry.js → chunk-PHJE6A3J.mjs} +20 -37
- package/dist/chunk-PQXOORR4.mjs +234 -0
- package/dist/{chunk-GLKAGFKX.mjs → chunk-RDR75DVI.mjs} +85 -9
- package/dist/chunk-SXVLRPMF.mjs +143 -0
- package/dist/{chunk-DNZS4ESD.mjs → chunk-SY7RX5YQ.mjs} +85 -9
- package/dist/{context-rules-entry.js → chunk-TIBF7KST.mjs} +81 -78
- package/dist/chunk-WYYSQX5M.mjs +467 -0
- package/dist/{chunk-I6ETJC7L.mjs → chunk-X553BOMI.mjs} +56 -26
- package/dist/{chunk-K7BO57OO.mjs → chunk-Y6OB7K34.mjs} +80 -4
- package/dist/chunk-YLVV6YZ5.mjs +143 -0
- package/dist/chunk-ZUWPFVJV.mjs +115 -0
- package/dist/chunk-ZZMONVPE.mjs +467 -0
- package/dist/cli.js +402 -167
- package/dist/cli.mjs +4 -3
- package/dist/context-rules-entry/index.d.mts +35 -1
- package/dist/context-rules-entry/index.d.ts +35 -1
- package/dist/context-rules-entry/index.js +194 -48
- package/dist/context-rules-entry/index.mjs +1 -1
- package/dist/detector-entry/index.js +192 -46
- package/dist/detector-entry/index.mjs +2 -2
- package/dist/{analyzer-entry-BVz-HnZd.d.mts → index-B-pnXpgn.d.mts} +10 -1
- package/dist/{index-BwuoiCNm.d.ts → index-CWgYOKaK.d.ts} +35 -16
- package/dist/{index-BVz-HnZd.d.mts → index-Dl4BrGIT.d.mts} +35 -16
- package/dist/{analyzer-entry-BwuoiCNm.d.ts → index-DqS2e0kK.d.ts} +10 -1
- package/dist/index.d.mts +5 -6
- package/dist/index.d.ts +5 -6
- package/dist/index.js +467 -214
- package/dist/index.mjs +37 -22
- package/dist/scoring-entry/index.js +7 -3
- package/dist/scoring-entry/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/analyzer-entry.d.mts +0 -100
- package/dist/analyzer-entry.d.ts +0 -100
- package/dist/analyzer-entry.js +0 -693
- package/dist/analyzer-entry.mjs +0 -12
- package/dist/chunk-262N2JB7.mjs +0 -497
- package/dist/chunk-2R7HOR5H.mjs +0 -777
- package/dist/chunk-3D7RVGHM.mjs +0 -64
- package/dist/chunk-3LS3E6MO.mjs +0 -508
- package/dist/chunk-3VRQYFW3.mjs +0 -782
- package/dist/chunk-3WK24ZOX.mjs +0 -860
- package/dist/chunk-3YYN6ZXN.mjs +0 -1038
- package/dist/chunk-4BPRGZRG.mjs +0 -1041
- package/dist/chunk-4UHDGB7U.mjs +0 -920
- package/dist/chunk-5LYDB7DY.mjs +0 -771
- package/dist/chunk-65G3HXLQ.mjs +0 -497
- package/dist/chunk-65UQ5J2J.mjs +0 -64
- package/dist/chunk-6JTVOBJX.mjs +0 -64
- package/dist/chunk-6OEHUI5J.mjs +0 -1045
- package/dist/chunk-6YUGU4P4.mjs +0 -914
- package/dist/chunk-7EJGNGXM.mjs +0 -771
- package/dist/chunk-7O2DUBSN.mjs +0 -1058
- package/dist/chunk-7S4AUL5S.mjs +0 -911
- package/dist/chunk-A76JUWER.mjs +0 -786
- package/dist/chunk-AJZUNNFH.mjs +0 -817
- package/dist/chunk-AXHGYYYZ.mjs +0 -404
- package/dist/chunk-BKRPSTT2.mjs +0 -64
- package/dist/chunk-BUBQ3W6W.mjs +0 -980
- package/dist/chunk-CCHM2VLK.mjs +0 -1051
- package/dist/chunk-CHFK6EBT.mjs +0 -419
- package/dist/chunk-CMT3MWWO.mjs +0 -948
- package/dist/chunk-CMWW24HW.mjs +0 -259
- package/dist/chunk-CTDBJP25.mjs +0 -1043
- package/dist/chunk-DGAKXYIP.mjs +0 -1041
- package/dist/chunk-DQSLTL7J.mjs +0 -788
- package/dist/chunk-DR5W7S3Z.mjs +0 -968
- package/dist/chunk-EFUKPMBE.mjs +0 -950
- package/dist/chunk-EVBFDILL.mjs +0 -927
- package/dist/chunk-EXORBAXR.mjs +0 -887
- package/dist/chunk-EZT3NZGB.mjs +0 -1057
- package/dist/chunk-FWUKMJEQ.mjs +0 -1133
- package/dist/chunk-GSJFORRO.mjs +0 -504
- package/dist/chunk-H4ADJYOG.mjs +0 -925
- package/dist/chunk-H5FB2USZ.mjs +0 -762
- package/dist/chunk-H73HEG7M.mjs +0 -670
- package/dist/chunk-HOS5Z2NC.mjs +0 -669
- package/dist/chunk-HXHQOQB5.mjs +0 -508
- package/dist/chunk-INEOYHUM.mjs +0 -911
- package/dist/chunk-INJ4SBTV.mjs +0 -754
- package/dist/chunk-J5CW6NYY.mjs +0 -64
- package/dist/chunk-JAFZCZAP.mjs +0 -776
- package/dist/chunk-JKVKOXYR.mjs +0 -407
- package/dist/chunk-JTHW7EYW.mjs +0 -1041
- package/dist/chunk-JWR3AHKO.mjs +0 -788
- package/dist/chunk-KC2CQMG2.mjs +0 -858
- package/dist/chunk-KDWGWBP5.mjs +0 -832
- package/dist/chunk-KPEK5REL.mjs +0 -919
- package/dist/chunk-KT6O2IAE.mjs +0 -861
- package/dist/chunk-KWMNN3TG.mjs +0 -391
- package/dist/chunk-LUA5FXSZ.mjs +0 -771
- package/dist/chunk-LYKRYBSM.mjs +0 -64
- package/dist/chunk-M4PQMW34.mjs +0 -480
- package/dist/chunk-MH6LBXZF.mjs +0 -816
- package/dist/chunk-MHU3CL4R.mjs +0 -64
- package/dist/chunk-MJWBS6SM.mjs +0 -1058
- package/dist/chunk-OFGMDX66.mjs +0 -402
- package/dist/chunk-P7B6Z4I2.mjs +0 -1043
- package/dist/chunk-PBCXSG7E.mjs +0 -658
- package/dist/chunk-PEEHSFDR.mjs +0 -1058
- package/dist/chunk-PSVG2NLH.mjs +0 -966
- package/dist/chunk-PWNQ6JZW.mjs +0 -508
- package/dist/chunk-QE4E3F7C.mjs +0 -410
- package/dist/chunk-QEP76HGK.mjs +0 -1039
- package/dist/chunk-QX2BQJEO.mjs +0 -1058
- package/dist/chunk-R2S73CVG.mjs +0 -503
- package/dist/chunk-RMGDSNLE.mjs +0 -770
- package/dist/chunk-S2KQFII2.mjs +0 -491
- package/dist/chunk-SLDK5PQK.mjs +0 -1129
- package/dist/chunk-SNSDVGWW.mjs +0 -783
- package/dist/chunk-SUUZMLPS.mjs +0 -391
- package/dist/chunk-SVCSIZ2A.mjs +0 -259
- package/dist/chunk-T2C6WS73.mjs +0 -670
- package/dist/chunk-TCG2G32F.mjs +0 -911
- package/dist/chunk-TGBZP7SB.mjs +0 -773
- package/dist/chunk-THF4RW63.mjs +0 -254
- package/dist/chunk-TJKDLVLN.mjs +0 -503
- package/dist/chunk-TXWPOVYU.mjs +0 -402
- package/dist/chunk-UB3CGOQ7.mjs +0 -64
- package/dist/chunk-UKIKN27B.mjs +0 -950
- package/dist/chunk-V5DP4FP6.mjs +0 -876
- package/dist/chunk-VRMXVYDZ.mjs +0 -419
- package/dist/chunk-WACZ5LFH.mjs +0 -1055
- package/dist/chunk-WC7CBAA7.mjs +0 -1058
- package/dist/chunk-WKBCNITM.mjs +0 -1072
- package/dist/chunk-WMOGJFME.mjs +0 -391
- package/dist/chunk-X4GR2N2M.mjs +0 -947
- package/dist/chunk-XCWY2DQY.mjs +0 -788
- package/dist/chunk-XJD35DS6.mjs +0 -1058
- package/dist/chunk-XNPID6FU.mjs +0 -391
- package/dist/chunk-XUUVS54V.mjs +0 -776
- package/dist/chunk-YCGV65F5.mjs +0 -508
- package/dist/chunk-YJYDBFT3.mjs +0 -780
- package/dist/chunk-YP3HEDQW.mjs +0 -859
- package/dist/chunk-YSDOUNJJ.mjs +0 -1142
- package/dist/chunk-Z6GBFFOV.mjs +0 -1040
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/context-rules-entry-y2uJSngh.d.mts +0 -60
- package/dist/context-rules-entry-y2uJSngh.d.ts +0 -60
- package/dist/context-rules-entry.d.mts +0 -55
- package/dist/context-rules-entry.d.ts +0 -55
- package/dist/context-rules-entry.mjs +0 -12
- package/dist/context-rules.d.ts +0 -41
- package/dist/context-rules.d.ts.map +0 -1
- package/dist/context-rules.js +0 -225
- package/dist/context-rules.js.map +0 -1
- package/dist/detector-entry.d.mts +0 -14
- package/dist/detector-entry.d.ts +0 -14
- package/dist/detector-entry.js +0 -301
- package/dist/detector-entry.mjs +0 -7
- package/dist/detector.d.ts +0 -40
- package/dist/detector.d.ts.map +0 -1
- package/dist/detector.js +0 -385
- package/dist/detector.js.map +0 -1
- package/dist/extractors/python-extractor.d.ts +0 -19
- package/dist/extractors/python-extractor.d.ts.map +0 -1
- package/dist/extractors/python-extractor.js +0 -164
- package/dist/extractors/python-extractor.js.map +0 -1
- package/dist/grouping.d.ts +0 -54
- package/dist/grouping.d.ts.map +0 -1
- package/dist/grouping.js +0 -347
- package/dist/grouping.js.map +0 -1
- package/dist/index-y2uJSngh.d.mts +0 -60
- package/dist/index-y2uJSngh.d.ts +0 -60
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/python-extractor-BGKGX6BK.mjs +0 -131
- package/dist/python-extractor-ELAKYK2W.mjs +0 -140
- package/dist/scoring-entry.d.mts +0 -23
- package/dist/scoring-entry.d.ts +0 -23
- package/dist/scoring-entry.mjs +0 -6
- package/dist/scoring.d.ts +0 -12
- package/dist/scoring.d.ts.map +0 -1
- package/dist/scoring.js +0 -116
- package/dist/scoring.js.map +0 -1
- package/dist/types-C4lmb2Yh.d.mts +0 -36
- package/dist/types-C4lmb2Yh.d.ts +0 -36
|
@@ -25,11 +25,14 @@ __export(detector_entry_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(detector_entry_exports);
|
|
26
26
|
|
|
27
27
|
// src/detector.ts
|
|
28
|
-
var
|
|
28
|
+
var import_core6 = require("@aiready/core");
|
|
29
29
|
|
|
30
30
|
// src/context-rules.ts
|
|
31
|
+
var import_core5 = require("@aiready/core");
|
|
32
|
+
|
|
33
|
+
// src/rules/categories/test-rules.ts
|
|
31
34
|
var import_core = require("@aiready/core");
|
|
32
|
-
var
|
|
35
|
+
var TEST_RULES = [
|
|
33
36
|
// Test Fixtures - Intentional duplication for test isolation
|
|
34
37
|
{
|
|
35
38
|
name: "test-fixtures",
|
|
@@ -42,6 +45,35 @@ var CONTEXT_RULES = [
|
|
|
42
45
|
reason: "Test fixture duplication is intentional for test isolation",
|
|
43
46
|
suggestion: "Consider if shared test setup would improve maintainability without coupling tests"
|
|
44
47
|
},
|
|
48
|
+
// E2E/Integration Test Page Objects - Test independence
|
|
49
|
+
{
|
|
50
|
+
name: "e2e-page-objects",
|
|
51
|
+
detect: (file, code) => {
|
|
52
|
+
const isE2ETest = file.includes("e2e/") || file.includes("/e2e/") || file.includes(".e2e.") || file.includes("/playwright/") || file.includes("playwright/") || file.includes("/cypress/") || file.includes("cypress/") || file.includes("/integration/") || file.includes("integration/");
|
|
53
|
+
const hasPageObjectPatterns = code.includes("page.") || code.includes("await page") || code.includes("locator") || code.includes("getBy") || code.includes("selector") || code.includes("click(") || code.includes("fill(");
|
|
54
|
+
return isE2ETest && hasPageObjectPatterns;
|
|
55
|
+
},
|
|
56
|
+
severity: import_core.Severity.Info,
|
|
57
|
+
reason: "E2E test duplication ensures test independence and reduces coupling",
|
|
58
|
+
suggestion: "Consider page object pattern only if duplication causes maintenance issues"
|
|
59
|
+
},
|
|
60
|
+
// Mock Data - Test data intentionally duplicated
|
|
61
|
+
{
|
|
62
|
+
name: "mock-data",
|
|
63
|
+
detect: (file, code) => {
|
|
64
|
+
const isMockFile = file.includes("/mocks/") || file.includes("/__mocks__/") || file.includes("/fixtures/") || file.includes(".mock.") || file.includes(".fixture.");
|
|
65
|
+
const hasMockData = code.includes("mock") || code.includes("Mock") || code.includes("fixture") || code.includes("stub") || code.includes("export const");
|
|
66
|
+
return isMockFile && hasMockData;
|
|
67
|
+
},
|
|
68
|
+
severity: import_core.Severity.Info,
|
|
69
|
+
reason: "Mock data duplication is expected for comprehensive test coverage",
|
|
70
|
+
suggestion: "Consider shared factories only for complex mock generation"
|
|
71
|
+
}
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
// src/rules/categories/web-rules.ts
|
|
75
|
+
var import_core2 = require("@aiready/core");
|
|
76
|
+
var WEB_RULES = [
|
|
45
77
|
// Email/Document Templates - Often intentionally similar for consistency
|
|
46
78
|
{
|
|
47
79
|
name: "templates",
|
|
@@ -50,66 +82,59 @@ var CONTEXT_RULES = [
|
|
|
50
82
|
const hasTemplateContent = (code.includes("return") || code.includes("export")) && (code.includes("html") || code.includes("subject") || code.includes("body"));
|
|
51
83
|
return isTemplate && hasTemplateContent;
|
|
52
84
|
},
|
|
53
|
-
severity:
|
|
85
|
+
severity: import_core2.Severity.Info,
|
|
54
86
|
reason: "Template duplication may be intentional for maintainability and branding consistency",
|
|
55
87
|
suggestion: "Extract shared structure only if templates become hard to maintain"
|
|
56
88
|
},
|
|
57
|
-
//
|
|
89
|
+
// Common UI Event Handlers - Very specific patterns only
|
|
58
90
|
{
|
|
59
|
-
name: "
|
|
91
|
+
name: "common-ui-handlers",
|
|
60
92
|
detect: (file, code) => {
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
return
|
|
93
|
+
const isUIFile = file.includes("/components/") || file.includes(".tsx") || file.includes(".jsx") || file.includes("/hooks/");
|
|
94
|
+
const hasCommonHandler = code.includes("handleClickOutside") && code.includes("dropdownRef.current") && code.includes("!dropdownRef.current.contains") || code.includes("handleEscape") && code.includes("event.key") && code.includes("=== 'Escape'") || code.includes("handleClickInside") && code.includes("event.stopPropagation");
|
|
95
|
+
return isUIFile && hasCommonHandler;
|
|
64
96
|
},
|
|
65
|
-
severity:
|
|
66
|
-
reason: "
|
|
67
|
-
suggestion: "Consider
|
|
97
|
+
severity: import_core2.Severity.Info,
|
|
98
|
+
reason: "Common UI event handlers are boilerplate patterns that repeat across components",
|
|
99
|
+
suggestion: "Consider extracting to shared hooks (useClickOutside, useEscapeKey) only if causing maintenance issues"
|
|
68
100
|
},
|
|
101
|
+
// Next.js Route Handler Patterns - Boilerplate API route patterns
|
|
102
|
+
{
|
|
103
|
+
name: "nextjs-route-handlers",
|
|
104
|
+
detect: (file, code) => {
|
|
105
|
+
const isRouteFile = file.includes("/api/") && (file.endsWith("/route.ts") || file.endsWith("/route.js"));
|
|
106
|
+
const hasRoutePattern = code.includes("export async function POST") || code.includes("export async function GET") || code.includes("export async function PUT") || code.includes("export async function DELETE") || code.includes("NextResponse.json") || code.includes("NextRequest");
|
|
107
|
+
return isRouteFile && hasRoutePattern;
|
|
108
|
+
},
|
|
109
|
+
severity: import_core2.Severity.Info,
|
|
110
|
+
reason: "Next.js route handlers follow standard patterns and are intentionally similar across endpoints",
|
|
111
|
+
suggestion: "Route handler duplication is acceptable for API endpoint boilerplate"
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
// src/rules/categories/infra-rules.ts
|
|
116
|
+
var import_core3 = require("@aiready/core");
|
|
117
|
+
var INFRA_RULES = [
|
|
69
118
|
// Configuration Files - Often necessarily similar by design
|
|
70
119
|
{
|
|
71
120
|
name: "config-files",
|
|
72
121
|
detect: (file) => {
|
|
73
122
|
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
123
|
},
|
|
75
|
-
severity:
|
|
124
|
+
severity: import_core3.Severity.Info,
|
|
76
125
|
reason: "Configuration files often have similar structure by design",
|
|
77
126
|
suggestion: "Consider shared config base only if configurations become hard to maintain"
|
|
78
127
|
},
|
|
79
|
-
// Type Definitions - Duplication for type safety and module independence
|
|
80
|
-
{
|
|
81
|
-
name: "type-definitions",
|
|
82
|
-
detect: (file, code) => {
|
|
83
|
-
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;
|
|
86
|
-
},
|
|
87
|
-
severity: import_core.Severity.Info,
|
|
88
|
-
reason: "Type duplication may be intentional for module independence and type safety",
|
|
89
|
-
suggestion: "Extract to shared types package only if causing maintenance burden"
|
|
90
|
-
},
|
|
91
128
|
// Migration Scripts - One-off scripts that are similar by nature
|
|
92
129
|
{
|
|
93
130
|
name: "migration-scripts",
|
|
94
131
|
detect: (file) => {
|
|
95
132
|
return file.includes("/migrations/") || file.includes("/migrate/") || file.includes(".migration.");
|
|
96
133
|
},
|
|
97
|
-
severity:
|
|
134
|
+
severity: import_core3.Severity.Info,
|
|
98
135
|
reason: "Migration scripts are typically one-off and intentionally similar",
|
|
99
136
|
suggestion: "Duplication is acceptable for migration scripts"
|
|
100
137
|
},
|
|
101
|
-
// Mock Data - Test data intentionally duplicated
|
|
102
|
-
{
|
|
103
|
-
name: "mock-data",
|
|
104
|
-
detect: (file, code) => {
|
|
105
|
-
const isMockFile = file.includes("/mocks/") || file.includes("/__mocks__/") || file.includes("/fixtures/") || file.includes(".mock.") || file.includes(".fixture.");
|
|
106
|
-
const hasMockData = code.includes("mock") || code.includes("Mock") || code.includes("fixture") || code.includes("stub") || code.includes("export const");
|
|
107
|
-
return isMockFile && hasMockData;
|
|
108
|
-
},
|
|
109
|
-
severity: import_core.Severity.Info,
|
|
110
|
-
reason: "Mock data duplication is expected for comprehensive test coverage",
|
|
111
|
-
suggestion: "Consider shared factories only for complex mock generation"
|
|
112
|
-
},
|
|
113
138
|
// Tool Implementations - Structural Boilerplate
|
|
114
139
|
{
|
|
115
140
|
name: "tool-implementations",
|
|
@@ -118,11 +143,132 @@ var CONTEXT_RULES = [
|
|
|
118
143
|
const hasToolStructure = code.includes("execute") && (code.includes("try") || code.includes("catch"));
|
|
119
144
|
return isToolFile && hasToolStructure;
|
|
120
145
|
},
|
|
121
|
-
severity:
|
|
146
|
+
severity: import_core3.Severity.Info,
|
|
122
147
|
reason: "Tool implementations share structural boilerplate but have distinct business logic",
|
|
123
148
|
suggestion: "Tool duplication is acceptable for boilerplate interface wrappers"
|
|
149
|
+
},
|
|
150
|
+
// CLI Command Definitions - Commander.js boilerplate patterns
|
|
151
|
+
{
|
|
152
|
+
name: "cli-command-definitions",
|
|
153
|
+
detect: (file, code) => {
|
|
154
|
+
const isCliFile = file.includes("/commands/") || file.includes("/cli/") || file.endsWith(".command.ts");
|
|
155
|
+
const hasCommandPattern = (code.includes(".command(") || code.includes("defineCommand")) && (code.includes(".description(") || code.includes(".option(")) && (code.includes(".action(") || code.includes("async"));
|
|
156
|
+
return isCliFile && hasCommandPattern;
|
|
157
|
+
},
|
|
158
|
+
severity: import_core3.Severity.Info,
|
|
159
|
+
reason: "CLI command definitions follow standard Commander.js patterns and are intentionally similar",
|
|
160
|
+
suggestion: "Command boilerplate duplication is acceptable for CLI interfaces"
|
|
161
|
+
}
|
|
162
|
+
];
|
|
163
|
+
|
|
164
|
+
// src/rules/categories/logic-rules.ts
|
|
165
|
+
var import_core4 = require("@aiready/core");
|
|
166
|
+
var LOGIC_RULES = [
|
|
167
|
+
// Type Definitions - Duplication for type safety and module independence
|
|
168
|
+
{
|
|
169
|
+
name: "type-definitions",
|
|
170
|
+
detect: (file, code) => {
|
|
171
|
+
const isTypeFile = file.endsWith(".d.ts") || file.includes("/types/");
|
|
172
|
+
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");
|
|
173
|
+
const isInterfaceOnlySnippet = code.trim().startsWith("interface ") && code.includes("{") && code.includes("}") && !code.includes("function ") && !code.includes("const ") && !code.includes("return ");
|
|
174
|
+
return isTypeFile && hasOnlyTypeDefinitions || isInterfaceOnlySnippet;
|
|
175
|
+
},
|
|
176
|
+
severity: import_core4.Severity.Info,
|
|
177
|
+
reason: "Type/interface definitions are intentionally duplicated for module independence",
|
|
178
|
+
suggestion: "Extract to shared types package only if causing maintenance burden"
|
|
179
|
+
},
|
|
180
|
+
// Utility Functions - Small helpers in dedicated utility files
|
|
181
|
+
{
|
|
182
|
+
name: "utility-functions",
|
|
183
|
+
detect: (file, code) => {
|
|
184
|
+
const isUtilFile = file.endsWith(".util.ts") || file.endsWith(".helper.ts") || file.endsWith(".utils.ts");
|
|
185
|
+
const hasUtilPattern = code.includes("function format") || code.includes("function parse") || code.includes("function sanitize") || code.includes("function normalize") || code.includes("function convert");
|
|
186
|
+
return isUtilFile && hasUtilPattern;
|
|
187
|
+
},
|
|
188
|
+
severity: import_core4.Severity.Info,
|
|
189
|
+
reason: "Utility functions in dedicated utility files may be intentionally similar",
|
|
190
|
+
suggestion: "Consider extracting to shared utilities only if causing significant duplication"
|
|
191
|
+
},
|
|
192
|
+
// React/Vue Hooks - Standard patterns
|
|
193
|
+
{
|
|
194
|
+
name: "shared-hooks",
|
|
195
|
+
detect: (file, code) => {
|
|
196
|
+
const isHookFile = file.includes("/hooks/") || file.endsWith(".hook.ts") || file.endsWith(".hook.tsx");
|
|
197
|
+
const hasHookPattern = code.includes("function use") || code.includes("export function use") || code.includes("const use") || code.includes("export const use");
|
|
198
|
+
return isHookFile && hasHookPattern;
|
|
199
|
+
},
|
|
200
|
+
severity: import_core4.Severity.Info,
|
|
201
|
+
reason: "Hooks follow standard patterns and are often intentionally similar across components",
|
|
202
|
+
suggestion: "Consider extracting common hook logic only if hooks become complex"
|
|
203
|
+
},
|
|
204
|
+
// Score/Rating Helper Functions - Common threshold patterns
|
|
205
|
+
{
|
|
206
|
+
name: "score-helpers",
|
|
207
|
+
detect: (file, code) => {
|
|
208
|
+
const isHelperFile = file.includes("/utils/") || file.includes("/helpers/") || file.endsWith(".util.ts");
|
|
209
|
+
const hasScorePattern = (code.includes("if (score >=") || code.includes("if (score >")) && code.includes("return") && code.includes("'") && code.split("if (score").length >= 3;
|
|
210
|
+
return isHelperFile && hasScorePattern;
|
|
211
|
+
},
|
|
212
|
+
severity: import_core4.Severity.Info,
|
|
213
|
+
reason: "Score/rating helper functions use common threshold patterns that are intentionally similar",
|
|
214
|
+
suggestion: "Score formatting duplication is acceptable for consistent UI display"
|
|
215
|
+
},
|
|
216
|
+
// D3/Canvas Event Handlers - Standard visualization patterns
|
|
217
|
+
{
|
|
218
|
+
name: "visualization-handlers",
|
|
219
|
+
detect: (file, code) => {
|
|
220
|
+
const isVizFile = file.includes("/visualizer/") || file.includes("/charts/") || file.includes("GraphCanvas") || file.includes("ForceDirected");
|
|
221
|
+
const hasVizPattern = (code.includes("dragstarted") || code.includes("dragged") || code.includes("dragended")) && (code.includes("simulation") || code.includes("d3.") || code.includes("alphaTarget"));
|
|
222
|
+
return isVizFile && hasVizPattern;
|
|
223
|
+
},
|
|
224
|
+
severity: import_core4.Severity.Info,
|
|
225
|
+
reason: "D3/visualization event handlers follow standard patterns and are intentionally similar",
|
|
226
|
+
suggestion: "Visualization boilerplate duplication is acceptable for interactive charts"
|
|
227
|
+
},
|
|
228
|
+
// Icon/Switch Statement Helpers - Common enum-to-value patterns
|
|
229
|
+
{
|
|
230
|
+
name: "switch-helpers",
|
|
231
|
+
detect: (file, code) => {
|
|
232
|
+
const hasSwitchPattern = code.includes("switch (") && code.includes("case '") && code.includes("return") && code.split("case ").length >= 4;
|
|
233
|
+
const hasIconPattern = code.includes("getIcon") || code.includes("getColor") || code.includes("getLabel") || code.includes("getRating");
|
|
234
|
+
return hasSwitchPattern && hasIconPattern;
|
|
235
|
+
},
|
|
236
|
+
severity: import_core4.Severity.Info,
|
|
237
|
+
reason: "Switch statement helpers for enum-to-value mapping are inherently similar",
|
|
238
|
+
suggestion: "Switch duplication is acceptable for mapping enums to display values"
|
|
239
|
+
},
|
|
240
|
+
// Common API/Utility Functions - Legitimate duplication across modules
|
|
241
|
+
{
|
|
242
|
+
name: "common-api-functions",
|
|
243
|
+
detect: (file, code) => {
|
|
244
|
+
const isApiFile = file.includes("/api/") || file.includes("/lib/") || file.includes("/utils/") || file.endsWith(".ts");
|
|
245
|
+
const hasCommonApiPattern = code.includes("getStripe") && code.includes("process.env.STRIPE_SECRET_KEY") || code.includes("getUserByEmail") && code.includes("queryItems") || code.includes("updateUser") && code.includes("buildUpdateExpression") || code.includes("listUserRepositories") && code.includes("queryItems") || code.includes("listTeamRepositories") && code.includes("queryItems") || code.includes("getRemediation") && code.includes("queryItems") || code.includes("formatBreakdownKey") && code.includes(".replace(/([A-Z])/g") || code.includes("queryItems") && code.includes("KeyConditionExpression") || code.includes("putItem") && code.includes("createdAt") || code.includes("updateItem") && code.includes("buildUpdateExpression");
|
|
246
|
+
return isApiFile && hasCommonApiPattern;
|
|
247
|
+
},
|
|
248
|
+
severity: import_core4.Severity.Info,
|
|
249
|
+
reason: "Common API/utility functions are legitimately duplicated across modules for clarity and independence",
|
|
250
|
+
suggestion: "Consider extracting to shared utilities only if causing significant duplication"
|
|
251
|
+
},
|
|
252
|
+
// Validation Functions - Inherently similar patterns
|
|
253
|
+
{
|
|
254
|
+
name: "validation-functions",
|
|
255
|
+
detect: (file, code) => {
|
|
256
|
+
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");
|
|
257
|
+
return hasValidationPattern;
|
|
258
|
+
},
|
|
259
|
+
severity: import_core4.Severity.Info,
|
|
260
|
+
reason: "Validation functions are inherently similar and often intentionally duplicated for domain clarity",
|
|
261
|
+
suggestion: "Consider extracting to shared validators only if validation logic becomes complex"
|
|
124
262
|
}
|
|
125
263
|
];
|
|
264
|
+
|
|
265
|
+
// src/context-rules.ts
|
|
266
|
+
var CONTEXT_RULES = [
|
|
267
|
+
...TEST_RULES,
|
|
268
|
+
...WEB_RULES,
|
|
269
|
+
...INFRA_RULES,
|
|
270
|
+
...LOGIC_RULES
|
|
271
|
+
];
|
|
126
272
|
function calculateSeverity(file1, file2, code, similarity, linesOfCode) {
|
|
127
273
|
for (const rule of CONTEXT_RULES) {
|
|
128
274
|
if (rule.detect(file1, code) || rule.detect(file2, code)) {
|
|
@@ -136,31 +282,31 @@ function calculateSeverity(file1, file2, code, similarity, linesOfCode) {
|
|
|
136
282
|
}
|
|
137
283
|
if (similarity >= 0.95 && linesOfCode >= 30) {
|
|
138
284
|
return {
|
|
139
|
-
severity:
|
|
285
|
+
severity: import_core5.Severity.Critical,
|
|
140
286
|
reason: "Large nearly-identical code blocks waste tokens and create maintenance burden",
|
|
141
287
|
suggestion: "Extract to shared utility module immediately"
|
|
142
288
|
};
|
|
143
289
|
} else if (similarity >= 0.95 && linesOfCode >= 15) {
|
|
144
290
|
return {
|
|
145
|
-
severity:
|
|
291
|
+
severity: import_core5.Severity.Major,
|
|
146
292
|
reason: "Nearly identical code should be consolidated",
|
|
147
293
|
suggestion: "Move to shared utility file"
|
|
148
294
|
};
|
|
149
295
|
} else if (similarity >= 0.85) {
|
|
150
296
|
return {
|
|
151
|
-
severity:
|
|
297
|
+
severity: import_core5.Severity.Major,
|
|
152
298
|
reason: "High similarity indicates significant duplication",
|
|
153
299
|
suggestion: "Extract common logic to shared function"
|
|
154
300
|
};
|
|
155
301
|
} else if (similarity >= 0.7) {
|
|
156
302
|
return {
|
|
157
|
-
severity:
|
|
303
|
+
severity: import_core5.Severity.Minor,
|
|
158
304
|
reason: "Moderate similarity detected",
|
|
159
305
|
suggestion: "Consider extracting shared patterns if code evolves together"
|
|
160
306
|
};
|
|
161
307
|
} else {
|
|
162
308
|
return {
|
|
163
|
-
severity:
|
|
309
|
+
severity: import_core5.Severity.Minor,
|
|
164
310
|
reason: "Minor similarity detected",
|
|
165
311
|
suggestion: "Monitor but refactoring may not be worthwhile"
|
|
166
312
|
};
|
|
@@ -181,13 +327,13 @@ function normalizeCode(code, isPython = false) {
|
|
|
181
327
|
|
|
182
328
|
// src/detector.ts
|
|
183
329
|
function extractBlocks(file, content) {
|
|
184
|
-
return (0,
|
|
330
|
+
return (0, import_core6.extractCodeBlocks)(file, content);
|
|
185
331
|
}
|
|
186
332
|
function calculateSimilarity(a, b) {
|
|
187
|
-
return (0,
|
|
333
|
+
return (0, import_core6.calculateStringSimilarity)(a, b);
|
|
188
334
|
}
|
|
189
335
|
function calculateConfidence(similarity, tokens, lines) {
|
|
190
|
-
return (0,
|
|
336
|
+
return (0, import_core6.calculateHeuristicConfidence)(similarity, tokens, lines);
|
|
191
337
|
}
|
|
192
338
|
async function detectDuplicatePatterns(fileContents, options) {
|
|
193
339
|
const {
|
|
@@ -49,6 +49,15 @@ declare function createRefactorClusters(duplicates: DuplicatePattern[]): Refacto
|
|
|
49
49
|
* @returns Filtered array of refactor clusters
|
|
50
50
|
*/
|
|
51
51
|
declare function filterClustersByImpact(clusters: RefactorCluster[], minTokenCost?: number, minFiles?: number): RefactorCluster[];
|
|
52
|
+
/**
|
|
53
|
+
* Detect if two duplicate files are likely brand-specific variants
|
|
54
|
+
* (e.g., different themed versions of the same UI component)
|
|
55
|
+
*/
|
|
56
|
+
declare function areBrandSpecificVariants(file1: string, file2: string, code1: string, code2: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Filter out brand-specific variants from duplicates
|
|
59
|
+
*/
|
|
60
|
+
declare function filterBrandSpecificVariants(duplicates: DuplicatePattern[]): DuplicatePattern[];
|
|
52
61
|
|
|
53
62
|
interface PatternDetectOptions extends ScanOptions {
|
|
54
63
|
minSimilarity?: number;
|
|
@@ -116,4 +125,4 @@ declare function analyzePatterns(options: PatternDetectOptions): Promise<{
|
|
|
116
125
|
*/
|
|
117
126
|
declare function generateSummary(results: AnalysisResult[]): PatternSummary;
|
|
118
127
|
|
|
119
|
-
export { type DuplicateGroup as D, type PatternDetectOptions as P, type RefactorCluster as R, type PatternSummary as a, analyzePatterns as b,
|
|
128
|
+
export { type DuplicateGroup as D, type PatternDetectOptions as P, type RefactorCluster as R, type PatternSummary as a, analyzePatterns as b, areBrandSpecificVariants as c, createRefactorClusters as d, filterClustersByImpact as e, filterBrandSpecificVariants as f, generateSummary as g, getSmartDefaults as h, groupDuplicatesByFilePair as i };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Severity, ScanOptions, AnalysisResult } from '@aiready/core';
|
|
1
|
+
import { Severity, ScanOptions, Issue, AnalysisResult } from '@aiready/core';
|
|
2
2
|
import { P as PatternType, D as DuplicatePattern } from './types-DU2mmhwb.js';
|
|
3
3
|
|
|
4
4
|
interface DuplicateGroup {
|
|
@@ -49,6 +49,15 @@ declare function createRefactorClusters(duplicates: DuplicatePattern[]): Refacto
|
|
|
49
49
|
* @returns Filtered array of refactor clusters
|
|
50
50
|
*/
|
|
51
51
|
declare function filterClustersByImpact(clusters: RefactorCluster[], minTokenCost?: number, minFiles?: number): RefactorCluster[];
|
|
52
|
+
/**
|
|
53
|
+
* Detect if two duplicate files are likely brand-specific variants
|
|
54
|
+
* (e.g., different themed versions of the same UI component)
|
|
55
|
+
*/
|
|
56
|
+
declare function areBrandSpecificVariants(file1: string, file2: string, code1: string, code2: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Filter out brand-specific variants from duplicates
|
|
59
|
+
*/
|
|
60
|
+
declare function filterBrandSpecificVariants(duplicates: DuplicatePattern[]): DuplicatePattern[];
|
|
52
61
|
|
|
53
62
|
interface PatternDetectOptions extends ScanOptions {
|
|
54
63
|
minSimilarity?: number;
|
|
@@ -70,6 +79,15 @@ interface PatternDetectOptions extends ScanOptions {
|
|
|
70
79
|
ignoreWhitelist?: string[];
|
|
71
80
|
onProgress?: (processed: number, total: number, message: string) => void;
|
|
72
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Determine smart defaults based on repository size estimation.
|
|
84
|
+
*/
|
|
85
|
+
declare function getSmartDefaults(directory: string, userOptions: Partial<PatternDetectOptions>): Promise<PatternDetectOptions>;
|
|
86
|
+
/**
|
|
87
|
+
* Log current configuration settings to the console.
|
|
88
|
+
*/
|
|
89
|
+
declare function logConfiguration(config: PatternDetectOptions, estimatedBlocks: number): void;
|
|
90
|
+
|
|
73
91
|
interface PatternSummary {
|
|
74
92
|
totalPatterns: number;
|
|
75
93
|
totalTokenCost: number;
|
|
@@ -86,19 +104,27 @@ interface PatternSummary {
|
|
|
86
104
|
}>;
|
|
87
105
|
}
|
|
88
106
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* @param directory - The directory to analyze for size.
|
|
92
|
-
* @param userOptions - User-provided option overrides.
|
|
93
|
-
* @returns Promise resolving to optimal detection options.
|
|
107
|
+
* Generate a summary of pattern detection results.
|
|
94
108
|
*/
|
|
95
|
-
declare function
|
|
109
|
+
declare function generateSummary(results: AnalysisResult[]): PatternSummary;
|
|
110
|
+
/**
|
|
111
|
+
* Filter issues by severity level.
|
|
112
|
+
*/
|
|
113
|
+
declare function filterBySeverity(issues: Issue[], severity: string): Issue[];
|
|
114
|
+
/**
|
|
115
|
+
* Get human-readable label for severity.
|
|
116
|
+
*/
|
|
117
|
+
declare function getSeverityLabel(severity: Severity): string;
|
|
118
|
+
/**
|
|
119
|
+
* Calculate severity based on similarity.
|
|
120
|
+
*/
|
|
121
|
+
declare function calculateSeverity(similarity: number): Severity;
|
|
122
|
+
|
|
96
123
|
/**
|
|
97
124
|
* Main entry point for pattern detection analysis.
|
|
98
125
|
*
|
|
99
126
|
* @param options - Configuration including rootDir and detection parameters.
|
|
100
127
|
* @returns Promise resolving to the comprehensive pattern detect report.
|
|
101
|
-
* @lastUpdated 2026-03-18
|
|
102
128
|
*/
|
|
103
129
|
declare function analyzePatterns(options: PatternDetectOptions): Promise<{
|
|
104
130
|
results: AnalysisResult[];
|
|
@@ -108,12 +134,5 @@ declare function analyzePatterns(options: PatternDetectOptions): Promise<{
|
|
|
108
134
|
clusters?: RefactorCluster[];
|
|
109
135
|
config: PatternDetectOptions;
|
|
110
136
|
}>;
|
|
111
|
-
/**
|
|
112
|
-
* Generate a summary of pattern detection results.
|
|
113
|
-
*
|
|
114
|
-
* @param results - Array of file-level analysis results.
|
|
115
|
-
* @returns Consolidated pattern summary object.
|
|
116
|
-
*/
|
|
117
|
-
declare function generateSummary(results: AnalysisResult[]): PatternSummary;
|
|
118
137
|
|
|
119
|
-
export { type DuplicateGroup as D, type PatternDetectOptions as P, type RefactorCluster as R, type PatternSummary as a, analyzePatterns as b,
|
|
138
|
+
export { type DuplicateGroup as D, type PatternDetectOptions as P, type RefactorCluster as R, type PatternSummary as a, analyzePatterns as b, areBrandSpecificVariants as c, calculateSeverity as d, createRefactorClusters as e, filterBrandSpecificVariants as f, filterBySeverity as g, filterClustersByImpact as h, generateSummary as i, getSeverityLabel as j, getSmartDefaults as k, groupDuplicatesByFilePair as l, logConfiguration as m };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Severity, ScanOptions, AnalysisResult } from '@aiready/core';
|
|
1
|
+
import { Severity, ScanOptions, Issue, AnalysisResult } from '@aiready/core';
|
|
2
2
|
import { P as PatternType, D as DuplicatePattern } from './types-DU2mmhwb.mjs';
|
|
3
3
|
|
|
4
4
|
interface DuplicateGroup {
|
|
@@ -49,6 +49,15 @@ declare function createRefactorClusters(duplicates: DuplicatePattern[]): Refacto
|
|
|
49
49
|
* @returns Filtered array of refactor clusters
|
|
50
50
|
*/
|
|
51
51
|
declare function filterClustersByImpact(clusters: RefactorCluster[], minTokenCost?: number, minFiles?: number): RefactorCluster[];
|
|
52
|
+
/**
|
|
53
|
+
* Detect if two duplicate files are likely brand-specific variants
|
|
54
|
+
* (e.g., different themed versions of the same UI component)
|
|
55
|
+
*/
|
|
56
|
+
declare function areBrandSpecificVariants(file1: string, file2: string, code1: string, code2: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Filter out brand-specific variants from duplicates
|
|
59
|
+
*/
|
|
60
|
+
declare function filterBrandSpecificVariants(duplicates: DuplicatePattern[]): DuplicatePattern[];
|
|
52
61
|
|
|
53
62
|
interface PatternDetectOptions extends ScanOptions {
|
|
54
63
|
minSimilarity?: number;
|
|
@@ -70,6 +79,15 @@ interface PatternDetectOptions extends ScanOptions {
|
|
|
70
79
|
ignoreWhitelist?: string[];
|
|
71
80
|
onProgress?: (processed: number, total: number, message: string) => void;
|
|
72
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Determine smart defaults based on repository size estimation.
|
|
84
|
+
*/
|
|
85
|
+
declare function getSmartDefaults(directory: string, userOptions: Partial<PatternDetectOptions>): Promise<PatternDetectOptions>;
|
|
86
|
+
/**
|
|
87
|
+
* Log current configuration settings to the console.
|
|
88
|
+
*/
|
|
89
|
+
declare function logConfiguration(config: PatternDetectOptions, estimatedBlocks: number): void;
|
|
90
|
+
|
|
73
91
|
interface PatternSummary {
|
|
74
92
|
totalPatterns: number;
|
|
75
93
|
totalTokenCost: number;
|
|
@@ -86,19 +104,27 @@ interface PatternSummary {
|
|
|
86
104
|
}>;
|
|
87
105
|
}
|
|
88
106
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
* @param directory - The directory to analyze for size.
|
|
92
|
-
* @param userOptions - User-provided option overrides.
|
|
93
|
-
* @returns Promise resolving to optimal detection options.
|
|
107
|
+
* Generate a summary of pattern detection results.
|
|
94
108
|
*/
|
|
95
|
-
declare function
|
|
109
|
+
declare function generateSummary(results: AnalysisResult[]): PatternSummary;
|
|
110
|
+
/**
|
|
111
|
+
* Filter issues by severity level.
|
|
112
|
+
*/
|
|
113
|
+
declare function filterBySeverity(issues: Issue[], severity: string): Issue[];
|
|
114
|
+
/**
|
|
115
|
+
* Get human-readable label for severity.
|
|
116
|
+
*/
|
|
117
|
+
declare function getSeverityLabel(severity: Severity): string;
|
|
118
|
+
/**
|
|
119
|
+
* Calculate severity based on similarity.
|
|
120
|
+
*/
|
|
121
|
+
declare function calculateSeverity(similarity: number): Severity;
|
|
122
|
+
|
|
96
123
|
/**
|
|
97
124
|
* Main entry point for pattern detection analysis.
|
|
98
125
|
*
|
|
99
126
|
* @param options - Configuration including rootDir and detection parameters.
|
|
100
127
|
* @returns Promise resolving to the comprehensive pattern detect report.
|
|
101
|
-
* @lastUpdated 2026-03-18
|
|
102
128
|
*/
|
|
103
129
|
declare function analyzePatterns(options: PatternDetectOptions): Promise<{
|
|
104
130
|
results: AnalysisResult[];
|
|
@@ -108,12 +134,5 @@ declare function analyzePatterns(options: PatternDetectOptions): Promise<{
|
|
|
108
134
|
clusters?: RefactorCluster[];
|
|
109
135
|
config: PatternDetectOptions;
|
|
110
136
|
}>;
|
|
111
|
-
/**
|
|
112
|
-
* Generate a summary of pattern detection results.
|
|
113
|
-
*
|
|
114
|
-
* @param results - Array of file-level analysis results.
|
|
115
|
-
* @returns Consolidated pattern summary object.
|
|
116
|
-
*/
|
|
117
|
-
declare function generateSummary(results: AnalysisResult[]): PatternSummary;
|
|
118
137
|
|
|
119
|
-
export { type DuplicateGroup as D, type PatternDetectOptions as P, type RefactorCluster as R, type PatternSummary as a, analyzePatterns as b,
|
|
138
|
+
export { type DuplicateGroup as D, type PatternDetectOptions as P, type RefactorCluster as R, type PatternSummary as a, analyzePatterns as b, areBrandSpecificVariants as c, calculateSeverity as d, createRefactorClusters as e, filterBrandSpecificVariants as f, filterBySeverity as g, filterClustersByImpact as h, generateSummary as i, getSeverityLabel as j, getSmartDefaults as k, groupDuplicatesByFilePair as l, logConfiguration as m };
|
|
@@ -49,6 +49,15 @@ declare function createRefactorClusters(duplicates: DuplicatePattern[]): Refacto
|
|
|
49
49
|
* @returns Filtered array of refactor clusters
|
|
50
50
|
*/
|
|
51
51
|
declare function filterClustersByImpact(clusters: RefactorCluster[], minTokenCost?: number, minFiles?: number): RefactorCluster[];
|
|
52
|
+
/**
|
|
53
|
+
* Detect if two duplicate files are likely brand-specific variants
|
|
54
|
+
* (e.g., different themed versions of the same UI component)
|
|
55
|
+
*/
|
|
56
|
+
declare function areBrandSpecificVariants(file1: string, file2: string, code1: string, code2: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Filter out brand-specific variants from duplicates
|
|
59
|
+
*/
|
|
60
|
+
declare function filterBrandSpecificVariants(duplicates: DuplicatePattern[]): DuplicatePattern[];
|
|
52
61
|
|
|
53
62
|
interface PatternDetectOptions extends ScanOptions {
|
|
54
63
|
minSimilarity?: number;
|
|
@@ -116,4 +125,4 @@ declare function analyzePatterns(options: PatternDetectOptions): Promise<{
|
|
|
116
125
|
*/
|
|
117
126
|
declare function generateSummary(results: AnalysisResult[]): PatternSummary;
|
|
118
127
|
|
|
119
|
-
export { type DuplicateGroup as D, type PatternDetectOptions as P, type RefactorCluster as R, type PatternSummary as a, analyzePatterns as b,
|
|
128
|
+
export { type DuplicateGroup as D, type PatternDetectOptions as P, type RefactorCluster as R, type PatternSummary as a, analyzePatterns as b, areBrandSpecificVariants as c, createRefactorClusters as d, filterClustersByImpact as e, filterBrandSpecificVariants as f, generateSummary as g, getSmartDefaults as h, groupDuplicatesByFilePair as i };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { ToolProvider } from '@aiready/core';
|
|
2
|
-
export {
|
|
3
|
-
export { D as DuplicateGroup, P as PatternDetectOptions, a as PatternSummary, R as RefactorCluster, b as analyzePatterns, c as createRefactorClusters, f as filterClustersByImpact, g as generateSummary, d as getSmartDefaults, e as groupDuplicatesByFilePair } from './index-BVz-HnZd.mjs';
|
|
2
|
+
export { Severity } from '@aiready/core';
|
|
4
3
|
export { detectDuplicatePatterns } from './detector-entry/index.mjs';
|
|
5
|
-
export {
|
|
6
|
-
export { C as CONTEXT_RULES, a as ContextRule, c as calculateSeverity, g as getSeverityThreshold } from './index-szjQDBsm.mjs';
|
|
4
|
+
export { D as DuplicateGroup, P as PatternDetectOptions, a as PatternSummary, R as RefactorCluster, b as analyzePatterns, c as areBrandSpecificVariants, d as calculateSeverity, e as createRefactorClusters, f as filterBrandSpecificVariants, g as filterBySeverity, h as filterClustersByImpact, i as generateSummary, j as getSeverityLabel, k as getSmartDefaults, l as groupDuplicatesByFilePair, m as logConfiguration } from './index-Dl4BrGIT.mjs';
|
|
7
5
|
export { D as DuplicatePattern, P as PatternType } from './types-DU2mmhwb.mjs';
|
|
6
|
+
export { calculatePatternScore } from './scoring-entry/index.mjs';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Pattern Detection Tool Provider
|
|
11
10
|
*/
|
|
12
|
-
declare const
|
|
11
|
+
declare const PATTERN_DETECT_PROVIDER: ToolProvider;
|
|
13
12
|
|
|
14
|
-
export {
|
|
13
|
+
export { PATTERN_DETECT_PROVIDER };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { ToolProvider } from '@aiready/core';
|
|
2
|
-
export {
|
|
3
|
-
export { D as DuplicateGroup, P as PatternDetectOptions, a as PatternSummary, R as RefactorCluster, b as analyzePatterns, c as createRefactorClusters, f as filterClustersByImpact, g as generateSummary, d as getSmartDefaults, e as groupDuplicatesByFilePair } from './index-BwuoiCNm.js';
|
|
2
|
+
export { Severity } from '@aiready/core';
|
|
4
3
|
export { detectDuplicatePatterns } from './detector-entry/index.js';
|
|
5
|
-
export {
|
|
6
|
-
export { C as CONTEXT_RULES, a as ContextRule, c as calculateSeverity, g as getSeverityThreshold } from './index-szjQDBsm.js';
|
|
4
|
+
export { D as DuplicateGroup, P as PatternDetectOptions, a as PatternSummary, R as RefactorCluster, b as analyzePatterns, c as areBrandSpecificVariants, d as calculateSeverity, e as createRefactorClusters, f as filterBrandSpecificVariants, g as filterBySeverity, h as filterClustersByImpact, i as generateSummary, j as getSeverityLabel, k as getSmartDefaults, l as groupDuplicatesByFilePair, m as logConfiguration } from './index-CWgYOKaK.js';
|
|
7
5
|
export { D as DuplicatePattern, P as PatternType } from './types-DU2mmhwb.js';
|
|
6
|
+
export { calculatePatternScore } from './scoring-entry/index.js';
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Pattern Detection Tool Provider
|
|
11
10
|
*/
|
|
12
|
-
declare const
|
|
11
|
+
declare const PATTERN_DETECT_PROVIDER: ToolProvider;
|
|
13
12
|
|
|
14
|
-
export {
|
|
13
|
+
export { PATTERN_DETECT_PROVIDER };
|