@aiready/pattern-detect 0.17.0 → 0.17.1
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/README.md +7 -7
- package/dist/chunk-3D7RVGHM.mjs +64 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -13,7 +13,6 @@ AI models often suffer from "semantic confusion" when multiple variants of the s
|
|
|
13
13
|
|
|
14
14
|
- **Full Support:** TypeScript, JavaScript, Python, Java, Go, C#
|
|
15
15
|
- **Capabilities:** Semantic duplicate detection, logic fragmentation, refactoring suggestions.
|
|
16
|
-
toxicology
|
|
17
16
|
|
|
18
17
|
## 🏛️ Architecture
|
|
19
18
|
|
|
@@ -22,11 +21,11 @@ AI models often suffer from "semantic confusion" when multiple variants of the s
|
|
|
22
21
|
│
|
|
23
22
|
▼
|
|
24
23
|
🎛️ @aiready/cli (orchestrator)
|
|
25
|
-
│ │ │ │ │ │ │ │ │
|
|
26
|
-
▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼
|
|
27
|
-
[PAT] [CTX] [CON] [AMP] [DEP] [DOC] [SIG] [AGT] [TST]
|
|
28
|
-
│ │ │ │ │ │ │ │ │
|
|
29
|
-
|
|
24
|
+
│ │ │ │ │ │ │ │ │ │
|
|
25
|
+
▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼ ▼
|
|
26
|
+
[PAT] [CTX] [CON] [AMP] [DEP] [DOC] [SIG] [AGT] [TST] [CTR]
|
|
27
|
+
│ │ │ │ │ │ │ │ │ │
|
|
28
|
+
└─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
|
30
29
|
│
|
|
31
30
|
▼
|
|
32
31
|
🏢 @aiready/core
|
|
@@ -36,7 +35,8 @@ Legend:
|
|
|
36
35
|
CON = consistency AMP = change-amplification
|
|
37
36
|
DEP = deps-health DOC = doc-drift
|
|
38
37
|
SIG = ai-signal-clarity AGT = agent-grounding
|
|
39
|
-
TST = testability
|
|
38
|
+
TST = testability CTR = contract-enforcement
|
|
39
|
+
★ = YOU ARE HERE
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
## Features
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
calculatePatternScore
|
|
3
|
+
} from "./chunk-WBBO35SC.mjs";
|
|
4
|
+
import {
|
|
5
|
+
analyzePatterns
|
|
6
|
+
} from "./chunk-SUUZMLPS.mjs";
|
|
7
|
+
|
|
8
|
+
// src/index.ts
|
|
9
|
+
import { ToolRegistry, Severity } from "@aiready/core";
|
|
10
|
+
|
|
11
|
+
// src/provider.ts
|
|
12
|
+
import {
|
|
13
|
+
ToolName,
|
|
14
|
+
SpokeOutputSchema,
|
|
15
|
+
GLOBAL_SCAN_OPTIONS
|
|
16
|
+
} from "@aiready/core";
|
|
17
|
+
var PatternDetectProvider = {
|
|
18
|
+
id: ToolName.PatternDetect,
|
|
19
|
+
alias: ["patterns", "duplicates", "duplication"],
|
|
20
|
+
async analyze(options) {
|
|
21
|
+
const results = await analyzePatterns(options);
|
|
22
|
+
return SpokeOutputSchema.parse({
|
|
23
|
+
results: results.results,
|
|
24
|
+
summary: {
|
|
25
|
+
totalFiles: results.files.length,
|
|
26
|
+
totalIssues: results.results.reduce(
|
|
27
|
+
(sum, r) => sum + r.issues.length,
|
|
28
|
+
0
|
|
29
|
+
),
|
|
30
|
+
duplicates: results.duplicates,
|
|
31
|
+
// Keep the raw duplicates for score calculation
|
|
32
|
+
clusters: results.clusters,
|
|
33
|
+
config: Object.fromEntries(
|
|
34
|
+
Object.entries(results.config).filter(
|
|
35
|
+
([key]) => !GLOBAL_SCAN_OPTIONS.includes(key) || key === "rootDir"
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
},
|
|
39
|
+
metadata: {
|
|
40
|
+
toolName: ToolName.PatternDetect,
|
|
41
|
+
version: "0.12.5",
|
|
42
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
score(output, options) {
|
|
47
|
+
const duplicates = output.summary.duplicates || [];
|
|
48
|
+
const totalFiles = output.summary.totalFiles || output.results.length;
|
|
49
|
+
return calculatePatternScore(
|
|
50
|
+
duplicates,
|
|
51
|
+
totalFiles,
|
|
52
|
+
options.costConfig
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
defaultWeight: 22
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// src/index.ts
|
|
59
|
+
ToolRegistry.register(PatternDetectProvider);
|
|
60
|
+
|
|
61
|
+
export {
|
|
62
|
+
PatternDetectProvider,
|
|
63
|
+
Severity
|
|
64
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/pattern-detect",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
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",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"commander": "^14.0.0",
|
|
67
67
|
"chalk": "^5.3.0",
|
|
68
|
-
"@aiready/core": "0.24.
|
|
68
|
+
"@aiready/core": "0.24.1"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"tsup": "^8.3.5",
|