@aiready/context-analyzer 0.9.25 → 0.9.28
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/.turbo/turbo-build.log +11 -11
- package/.turbo/turbo-test.log +22 -24
- package/dist/chunk-FYI56A5M.mjs +1892 -0
- package/dist/chunk-I77HFFZU.mjs +1876 -0
- package/dist/chunk-KYSZF5N6.mjs +1876 -0
- package/dist/chunk-M64RHH4D.mjs +1896 -0
- package/dist/chunk-OP4G6GLN.mjs +1876 -0
- package/dist/chunk-P3T3H27S.mjs +1895 -0
- package/dist/chunk-PJD4VCIH.mjs +1722 -0
- package/dist/chunk-VBWXHKGD.mjs +1895 -0
- package/dist/cli.js +497 -36
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +13 -3
- package/dist/index.d.ts +13 -3
- package/dist/index.js +502 -32
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
- package/src/__tests__/file-classification.test.ts +560 -9
- package/src/analyzer.ts +709 -26
- package/src/index.ts +12 -4
- package/src/scoring.ts +28 -1
- package/src/types.ts +6 -0
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ScanOptions, ToolScoringOutput } from '@aiready/core';
|
|
1
|
+
import { ScanOptions, CostConfig, ToolScoringOutput } from '@aiready/core';
|
|
2
2
|
|
|
3
3
|
interface ContextAnalyzerOptions extends ScanOptions {
|
|
4
4
|
maxDepth?: number;
|
|
@@ -32,7 +32,7 @@ interface ContextAnalysisResult {
|
|
|
32
32
|
* Classification of file type for analysis context
|
|
33
33
|
* Helps distinguish real issues from false positives
|
|
34
34
|
*/
|
|
35
|
-
type FileClassification = 'barrel-export' | 'type-definition' | 'cohesive-module' | 'mixed-concerns' | 'unknown';
|
|
35
|
+
type FileClassification = 'barrel-export' | 'type-definition' | 'cohesive-module' | 'utility-module' | 'service-file' | 'lambda-handler' | 'email-template' | 'parser-file' | 'nextjs-page' | 'mixed-concerns' | 'unknown';
|
|
36
36
|
interface ModuleCluster {
|
|
37
37
|
domain: string;
|
|
38
38
|
files: string[];
|
|
@@ -130,6 +130,11 @@ interface TypeDependency {
|
|
|
130
130
|
* - barrel-export: Re-exports from other modules (index.ts files)
|
|
131
131
|
* - type-definition: Primarily type/interface definitions
|
|
132
132
|
* - cohesive-module: Single domain, high cohesion (acceptable large files)
|
|
133
|
+
* - utility-module: Utility/helper files with cohesive purpose despite multi-domain
|
|
134
|
+
* - service-file: Service files orchestrating multiple dependencies
|
|
135
|
+
* - lambda-handler: Lambda/API handlers with single business purpose
|
|
136
|
+
* - email-template: Email templates/layouts with structural cohesion
|
|
137
|
+
* - parser-file: Parser/transformer files with single transformation purpose
|
|
133
138
|
* - mixed-concerns: Multiple domains, potential refactoring candidate
|
|
134
139
|
* - unknown: Unable to classify
|
|
135
140
|
*/
|
|
@@ -141,6 +146,7 @@ declare function classifyFile(node: DependencyNode, cohesionScore: number, domai
|
|
|
141
146
|
* - Ignoring fragmentation for barrel exports (they're meant to aggregate)
|
|
142
147
|
* - Ignoring fragmentation for type definitions (centralized types are good)
|
|
143
148
|
* - Reducing fragmentation for cohesive modules (large but focused is OK)
|
|
149
|
+
* - Reducing fragmentation for utility/service/handler/template files
|
|
144
150
|
*/
|
|
145
151
|
declare function adjustFragmentationForClassification(baseFragmentation: number, classification: FileClassification): number;
|
|
146
152
|
|
|
@@ -152,8 +158,12 @@ declare function adjustFragmentationForClassification(baseFragmentation: number,
|
|
|
152
158
|
* - Import depth (dependency chain length)
|
|
153
159
|
* - Fragmentation score (code organization)
|
|
154
160
|
* - Critical/major issues
|
|
161
|
+
*
|
|
162
|
+
* Includes business value metrics:
|
|
163
|
+
* - Estimated monthly cost of context waste
|
|
164
|
+
* - Estimated developer hours to fix
|
|
155
165
|
*/
|
|
156
|
-
declare function calculateContextScore(summary: ContextSummary): ToolScoringOutput;
|
|
166
|
+
declare function calculateContextScore(summary: ContextSummary, costConfig?: Partial<CostConfig>): ToolScoringOutput;
|
|
157
167
|
|
|
158
168
|
/**
|
|
159
169
|
* Build co-usage matrix: track which files are imported together
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ScanOptions, ToolScoringOutput } from '@aiready/core';
|
|
1
|
+
import { ScanOptions, CostConfig, ToolScoringOutput } from '@aiready/core';
|
|
2
2
|
|
|
3
3
|
interface ContextAnalyzerOptions extends ScanOptions {
|
|
4
4
|
maxDepth?: number;
|
|
@@ -32,7 +32,7 @@ interface ContextAnalysisResult {
|
|
|
32
32
|
* Classification of file type for analysis context
|
|
33
33
|
* Helps distinguish real issues from false positives
|
|
34
34
|
*/
|
|
35
|
-
type FileClassification = 'barrel-export' | 'type-definition' | 'cohesive-module' | 'mixed-concerns' | 'unknown';
|
|
35
|
+
type FileClassification = 'barrel-export' | 'type-definition' | 'cohesive-module' | 'utility-module' | 'service-file' | 'lambda-handler' | 'email-template' | 'parser-file' | 'nextjs-page' | 'mixed-concerns' | 'unknown';
|
|
36
36
|
interface ModuleCluster {
|
|
37
37
|
domain: string;
|
|
38
38
|
files: string[];
|
|
@@ -130,6 +130,11 @@ interface TypeDependency {
|
|
|
130
130
|
* - barrel-export: Re-exports from other modules (index.ts files)
|
|
131
131
|
* - type-definition: Primarily type/interface definitions
|
|
132
132
|
* - cohesive-module: Single domain, high cohesion (acceptable large files)
|
|
133
|
+
* - utility-module: Utility/helper files with cohesive purpose despite multi-domain
|
|
134
|
+
* - service-file: Service files orchestrating multiple dependencies
|
|
135
|
+
* - lambda-handler: Lambda/API handlers with single business purpose
|
|
136
|
+
* - email-template: Email templates/layouts with structural cohesion
|
|
137
|
+
* - parser-file: Parser/transformer files with single transformation purpose
|
|
133
138
|
* - mixed-concerns: Multiple domains, potential refactoring candidate
|
|
134
139
|
* - unknown: Unable to classify
|
|
135
140
|
*/
|
|
@@ -141,6 +146,7 @@ declare function classifyFile(node: DependencyNode, cohesionScore: number, domai
|
|
|
141
146
|
* - Ignoring fragmentation for barrel exports (they're meant to aggregate)
|
|
142
147
|
* - Ignoring fragmentation for type definitions (centralized types are good)
|
|
143
148
|
* - Reducing fragmentation for cohesive modules (large but focused is OK)
|
|
149
|
+
* - Reducing fragmentation for utility/service/handler/template files
|
|
144
150
|
*/
|
|
145
151
|
declare function adjustFragmentationForClassification(baseFragmentation: number, classification: FileClassification): number;
|
|
146
152
|
|
|
@@ -152,8 +158,12 @@ declare function adjustFragmentationForClassification(baseFragmentation: number,
|
|
|
152
158
|
* - Import depth (dependency chain length)
|
|
153
159
|
* - Fragmentation score (code organization)
|
|
154
160
|
* - Critical/major issues
|
|
161
|
+
*
|
|
162
|
+
* Includes business value metrics:
|
|
163
|
+
* - Estimated monthly cost of context waste
|
|
164
|
+
* - Estimated developer hours to fix
|
|
155
165
|
*/
|
|
156
|
-
declare function calculateContextScore(summary: ContextSummary): ToolScoringOutput;
|
|
166
|
+
declare function calculateContextScore(summary: ContextSummary, costConfig?: Partial<CostConfig>): ToolScoringOutput;
|
|
157
167
|
|
|
158
168
|
/**
|
|
159
169
|
* Build co-usage matrix: track which files are imported together
|