@aiready/pattern-detect 0.17.15 → 0.17.17

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 (65) hide show
  1. package/dist/analyzer-entry/index.d.mts +2 -2
  2. package/dist/analyzer-entry/index.d.ts +2 -2
  3. package/dist/analyzer-entry/index.js +357 -140
  4. package/dist/analyzer-entry/index.mjs +4 -4
  5. package/dist/chunk-3LMYFYWG.mjs +514 -0
  6. package/dist/chunk-4YXKUW4P.mjs +143 -0
  7. package/dist/chunk-5A3ULAQ5.mjs +571 -0
  8. package/dist/chunk-5FACKJ7M.mjs +519 -0
  9. package/dist/chunk-6B72OWZA.mjs +143 -0
  10. package/dist/chunk-6SHBBRHF.mjs +600 -0
  11. package/dist/chunk-BKSIA7A2.mjs +516 -0
  12. package/dist/chunk-CM5YJR7G.mjs +516 -0
  13. package/dist/chunk-FSXOU23F.mjs +620 -0
  14. package/dist/chunk-GUYQI3AF.mjs +514 -0
  15. package/dist/chunk-H2TGXGMX.mjs +587 -0
  16. package/dist/chunk-KMAOEVRS.mjs +150 -0
  17. package/dist/chunk-NWG2ZIGX.mjs +146 -0
  18. package/dist/chunk-OFVJFGQW.mjs +514 -0
  19. package/dist/chunk-PCCZREHY.mjs +143 -0
  20. package/dist/chunk-PQS5ACTN.mjs +516 -0
  21. package/dist/chunk-TVE75IDM.mjs +143 -0
  22. package/dist/chunk-UDOGQ42Q.mjs +603 -0
  23. package/dist/chunk-UFI4UDQI.mjs +514 -0
  24. package/dist/chunk-UXV57HN3.mjs +144 -0
  25. package/dist/chunk-VC2BOV6R.mjs +143 -0
  26. package/dist/chunk-VI2OVG73.mjs +514 -0
  27. package/dist/chunk-VKGYNHFY.mjs +514 -0
  28. package/dist/chunk-WBLZYAQ2.mjs +518 -0
  29. package/dist/chunk-WFVXMMB3.mjs +143 -0
  30. package/dist/chunk-WQC43BIO.mjs +516 -0
  31. package/dist/chunk-WTAIM3SG.mjs +146 -0
  32. package/dist/chunk-XC7U55PE.mjs +514 -0
  33. package/dist/chunk-XR373Q6G.mjs +146 -0
  34. package/dist/chunk-XWIBTD67.mjs +620 -0
  35. package/dist/chunk-YUQ2VQVJ.mjs +514 -0
  36. package/dist/chunk-Z4NOH52X.mjs +143 -0
  37. package/dist/cli.js +357 -140
  38. package/dist/cli.mjs +4 -4
  39. package/dist/context-rules-entry/index.js +351 -139
  40. package/dist/context-rules-entry/index.mjs +1 -1
  41. package/dist/detector-entry/index.d.mts +2 -2
  42. package/dist/detector-entry/index.d.ts +2 -2
  43. package/dist/detector-entry/index.js +355 -140
  44. package/dist/detector-entry/index.mjs +2 -2
  45. package/dist/index-BGvkJ9j1.d.mts +136 -0
  46. package/dist/index-BJq32qmj.d.mts +137 -0
  47. package/dist/index-BpoJSgX-.d.mts +136 -0
  48. package/dist/index-C7qLPKmH.d.ts +150 -0
  49. package/dist/index-CThnG9hv.d.ts +155 -0
  50. package/dist/index-D0Hpg9nN.d.mts +150 -0
  51. package/dist/index-DN6XpBOW.d.mts +155 -0
  52. package/dist/index-F8xqZ2PS.d.ts +136 -0
  53. package/dist/index-HNhDr6CV.d.ts +137 -0
  54. package/dist/index-ux0Wo8Ps.d.ts +136 -0
  55. package/dist/index.d.mts +2 -2
  56. package/dist/index.d.ts +2 -2
  57. package/dist/index.js +359 -142
  58. package/dist/index.mjs +4 -4
  59. package/dist/scoring-entry/index.d.mts +1 -1
  60. package/dist/scoring-entry/index.d.ts +1 -1
  61. package/dist/scoring-entry/index.js +2 -2
  62. package/dist/scoring-entry/index.mjs +1 -1
  63. package/dist/types-tgrmUrHE.d.mts +37 -0
  64. package/dist/types-tgrmUrHE.d.ts +37 -0
  65. package/package.json +11 -7
@@ -0,0 +1,37 @@
1
+ import { Severity } from '@aiready/core';
2
+
3
+ type PatternType = 'api-handler' | 'validator' | 'utility' | 'class-method' | 'component' | 'function' | 'unknown';
4
+ interface DuplicatePattern {
5
+ file1: string;
6
+ line1: number;
7
+ endLine1: number;
8
+ file2: string;
9
+ line2: number;
10
+ endLine2: number;
11
+ code1: string;
12
+ code2: string;
13
+ similarity: number;
14
+ confidence: number;
15
+ patternType: PatternType;
16
+ tokenCost: number;
17
+ severity: Severity;
18
+ reason?: string;
19
+ suggestion?: string;
20
+ matchedRule?: string;
21
+ }
22
+ interface DetectionOptions {
23
+ minSimilarity: number;
24
+ minLines: number;
25
+ batchSize: number;
26
+ approx: boolean;
27
+ minSharedTokens: number;
28
+ maxCandidatesPerBlock: number;
29
+ streamResults: boolean;
30
+ excludePatterns?: string[];
31
+ excludeFiles?: string[];
32
+ confidenceThreshold?: number;
33
+ ignoreWhitelist?: string[];
34
+ onProgress?: (processed: number, total: number, message: string) => void;
35
+ }
36
+
37
+ export type { DuplicatePattern as D, PatternType as P, DetectionOptions as a };
@@ -0,0 +1,37 @@
1
+ import { Severity } from '@aiready/core';
2
+
3
+ type PatternType = 'api-handler' | 'validator' | 'utility' | 'class-method' | 'component' | 'function' | 'unknown';
4
+ interface DuplicatePattern {
5
+ file1: string;
6
+ line1: number;
7
+ endLine1: number;
8
+ file2: string;
9
+ line2: number;
10
+ endLine2: number;
11
+ code1: string;
12
+ code2: string;
13
+ similarity: number;
14
+ confidence: number;
15
+ patternType: PatternType;
16
+ tokenCost: number;
17
+ severity: Severity;
18
+ reason?: string;
19
+ suggestion?: string;
20
+ matchedRule?: string;
21
+ }
22
+ interface DetectionOptions {
23
+ minSimilarity: number;
24
+ minLines: number;
25
+ batchSize: number;
26
+ approx: boolean;
27
+ minSharedTokens: number;
28
+ maxCandidatesPerBlock: number;
29
+ streamResults: boolean;
30
+ excludePatterns?: string[];
31
+ excludeFiles?: string[];
32
+ confidenceThreshold?: number;
33
+ ignoreWhitelist?: string[];
34
+ onProgress?: (processed: number, total: number, message: string) => void;
35
+ }
36
+
37
+ export type { DuplicatePattern as D, PatternType as P, DetectionOptions as a };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiready/pattern-detect",
3
- "version": "0.17.15",
3
+ "version": "0.17.17",
4
4
  "description": "Semantic duplicate pattern detection for AI-generated code - finds similar implementations that waste AI context tokens",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -63,13 +63,14 @@
63
63
  "url": "https://github.com/getaiready/aiready-pattern-detect/issues"
64
64
  },
65
65
  "dependencies": {
66
- "commander": "^14.0.0",
67
- "chalk": "^5.3.0",
68
- "@aiready/core": "0.24.16"
66
+ "chalk": "^5.6.2",
67
+ "commander": "^14.0.3",
68
+ "@aiready/core": "0.24.20"
69
69
  },
70
70
  "devDependencies": {
71
- "tsup": "^8.3.5",
72
- "eslint": "^10.0.0"
71
+ "@types/node": "^24.12.2",
72
+ "eslint": "^10.2.0",
73
+ "tsup": "^8.5.1"
73
74
  },
74
75
  "files": [
75
76
  "dist",
@@ -87,10 +88,13 @@
87
88
  "build": "tsup src/index.ts src/cli.ts src/analyzer-entry/index.ts src/detector-entry/index.ts src/scoring-entry/index.ts src/context-rules-entry/index.ts --format cjs,esm --dts",
88
89
  "dev": "tsup src/index.ts src/cli.ts src/analyzer-entry/index.ts src/detector-entry/index.ts src/scoring-entry/index.ts src/context-rules-entry/index.ts --format cjs,esm --dts --watch",
89
90
  "test": "vitest run",
91
+ "test:coverage": "vitest run --coverage",
90
92
  "lint": "eslint src",
91
93
  "clean": "rm -rf dist",
92
94
  "release": "pnpm build && pnpm publish --no-git-checks",
93
95
  "type-check": "tsc --noEmit",
94
- "format-check": "prettier --check . --ignore-path ../../.prettierignore"
96
+ "format-check": "prettier --check . --ignore-path ../../.prettierignore",
97
+ "format": "prettier --write . --ignore-path ../../.prettierignore",
98
+ "lint:fix": "eslint . --fix"
95
99
  }
96
100
  }