@aiready/context-analyzer 0.21.16 → 0.21.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.
- package/.turbo/turbo-build.log +11 -11
- package/.turbo/turbo-test.log +28 -27
- package/dist/chunk-CBWM3EK5.mjs +1854 -0
- package/dist/chunk-MR7WXHIE.mjs +1833 -0
- package/dist/chunk-UMZTAWDA.mjs +1812 -0
- package/dist/chunk-ZAMFWKIB.mjs +1842 -0
- package/dist/cli.js +94 -60
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +152 -22
- package/dist/index.d.ts +152 -22
- package/dist/index.js +185 -107
- package/dist/index.mjs +72 -2
- package/package.json +2 -2
- package/src/ast-utils.ts +1 -1
- package/src/classifier.ts +1 -1
- package/src/classify/classification-patterns.ts +74 -0
- package/src/{heuristics.ts → classify/file-classifiers.ts} +12 -65
- package/src/cli-action.ts +3 -5
- package/src/graph-builder.ts +28 -5
- package/src/index.ts +15 -2
- package/src/report/console-report.ts +110 -0
- package/src/report/html-report.ts +208 -0
- package/src/report/interactive-setup.ts +96 -0
- package/src/semantic/co-usage.ts +85 -0
- package/src/semantic/consolidation.ts +46 -0
- package/src/{semantic-analysis.ts → semantic/domain-inference.ts} +20 -174
- package/src/semantic/type-graph.ts +26 -0
- package/src/utils/output-formatter.ts +0 -411
package/dist/cli.js
CHANGED
|
@@ -319,39 +319,22 @@ function singularize(word) {
|
|
|
319
319
|
return word;
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
// src/semantic-
|
|
323
|
-
function
|
|
324
|
-
const
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
return coUsageMatrix;
|
|
341
|
-
}
|
|
342
|
-
function buildTypeGraph(graph) {
|
|
343
|
-
const typeGraph = /* @__PURE__ */ new Map();
|
|
344
|
-
for (const [file, node] of graph.nodes) {
|
|
345
|
-
for (const exp of node.exports) {
|
|
346
|
-
if (exp.typeReferences) {
|
|
347
|
-
for (const typeRef of exp.typeReferences) {
|
|
348
|
-
if (!typeGraph.has(typeRef)) typeGraph.set(typeRef, /* @__PURE__ */ new Set());
|
|
349
|
-
typeGraph.get(typeRef).add(file);
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
return typeGraph;
|
|
322
|
+
// src/semantic/domain-inference.ts
|
|
323
|
+
function calculateDomainConfidence(signals) {
|
|
324
|
+
const weights = {
|
|
325
|
+
coUsage: 0.35,
|
|
326
|
+
typeReference: 0.3,
|
|
327
|
+
exportName: 0.15,
|
|
328
|
+
importPath: 0.1,
|
|
329
|
+
folderStructure: 0.1
|
|
330
|
+
};
|
|
331
|
+
let confidence = 0;
|
|
332
|
+
if (signals.coUsage) confidence += weights.coUsage;
|
|
333
|
+
if (signals.typeReference) confidence += weights.typeReference;
|
|
334
|
+
if (signals.exportName) confidence += weights.exportName;
|
|
335
|
+
if (signals.importPath) confidence += weights.importPath;
|
|
336
|
+
if (signals.folderStructure) confidence += weights.folderStructure;
|
|
337
|
+
return confidence;
|
|
355
338
|
}
|
|
356
339
|
function inferDomainFromSemantics(file, exportName, graph, coUsageMatrix, typeGraph, exportTypeRefs) {
|
|
357
340
|
const domainSignals = /* @__PURE__ */ new Map();
|
|
@@ -413,22 +396,6 @@ function inferDomainFromSemantics(file, exportName, graph, coUsageMatrix, typeGr
|
|
|
413
396
|
assignments.sort((a, b) => b.confidence - a.confidence);
|
|
414
397
|
return assignments;
|
|
415
398
|
}
|
|
416
|
-
function calculateDomainConfidence(signals) {
|
|
417
|
-
const weights = {
|
|
418
|
-
coUsage: 0.35,
|
|
419
|
-
typeReference: 0.3,
|
|
420
|
-
exportName: 0.15,
|
|
421
|
-
importPath: 0.1,
|
|
422
|
-
folderStructure: 0.1
|
|
423
|
-
};
|
|
424
|
-
let confidence = 0;
|
|
425
|
-
if (signals.coUsage) confidence += weights.coUsage;
|
|
426
|
-
if (signals.typeReference) confidence += weights.typeReference;
|
|
427
|
-
if (signals.exportName) confidence += weights.exportName;
|
|
428
|
-
if (signals.importPath) confidence += weights.importPath;
|
|
429
|
-
if (signals.folderStructure) confidence += weights.folderStructure;
|
|
430
|
-
return confidence;
|
|
431
|
-
}
|
|
432
399
|
function extractExports(content, filePath, domainOptions, fileImports) {
|
|
433
400
|
const exports2 = [];
|
|
434
401
|
const patterns = [
|
|
@@ -744,9 +711,69 @@ function isBuildArtifact(filePath) {
|
|
|
744
711
|
// src/graph-builder.ts
|
|
745
712
|
var import_core4 = require("@aiready/core");
|
|
746
713
|
init_dependency_graph_utils();
|
|
714
|
+
|
|
715
|
+
// src/semantic/co-usage.ts
|
|
716
|
+
function buildCoUsageMatrix(graph) {
|
|
717
|
+
const coUsageMatrix = /* @__PURE__ */ new Map();
|
|
718
|
+
for (const [, node] of graph.nodes) {
|
|
719
|
+
const imports = node.imports;
|
|
720
|
+
for (let i = 0; i < imports.length; i++) {
|
|
721
|
+
const fileA = imports[i];
|
|
722
|
+
if (!coUsageMatrix.has(fileA)) coUsageMatrix.set(fileA, /* @__PURE__ */ new Map());
|
|
723
|
+
for (let j = i + 1; j < imports.length; j++) {
|
|
724
|
+
const fileB = imports[j];
|
|
725
|
+
const fileAUsage = coUsageMatrix.get(fileA);
|
|
726
|
+
fileAUsage.set(fileB, (fileAUsage.get(fileB) || 0) + 1);
|
|
727
|
+
if (!coUsageMatrix.has(fileB)) coUsageMatrix.set(fileB, /* @__PURE__ */ new Map());
|
|
728
|
+
const fileBUsage = coUsageMatrix.get(fileB);
|
|
729
|
+
fileBUsage.set(fileA, (fileBUsage.get(fileA) || 0) + 1);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
return coUsageMatrix;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// src/semantic/type-graph.ts
|
|
737
|
+
function buildTypeGraph(graph) {
|
|
738
|
+
const typeGraph = /* @__PURE__ */ new Map();
|
|
739
|
+
for (const [file, node] of graph.nodes) {
|
|
740
|
+
for (const exp of node.exports) {
|
|
741
|
+
if (exp.typeReferences) {
|
|
742
|
+
for (const typeRef of exp.typeReferences) {
|
|
743
|
+
if (!typeGraph.has(typeRef)) typeGraph.set(typeRef, /* @__PURE__ */ new Set());
|
|
744
|
+
typeGraph.get(typeRef).add(file);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
return typeGraph;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
// src/graph-builder.ts
|
|
747
753
|
var import_path = require("path");
|
|
748
754
|
function resolveImport(source, importingFile, allFiles) {
|
|
749
755
|
if (!source.startsWith(".") && !source.startsWith("/")) {
|
|
756
|
+
if (source.startsWith("@aiready/")) {
|
|
757
|
+
const pkgName = source.split("/")[1];
|
|
758
|
+
const possiblePaths = [
|
|
759
|
+
// Standard src/index.ts entry point for our packages
|
|
760
|
+
(0, import_path.join)("packages", pkgName, "src", "index.ts"),
|
|
761
|
+
(0, import_path.join)("packages", pkgName, "src", "index.tsx"),
|
|
762
|
+
// Support for sub-exports if needed (e.g. @aiready/core/client)
|
|
763
|
+
(0, import_path.join)(
|
|
764
|
+
"packages",
|
|
765
|
+
pkgName,
|
|
766
|
+
"src",
|
|
767
|
+
`${source.split("/").slice(2).join("/") || "index"}.ts`
|
|
768
|
+
)
|
|
769
|
+
];
|
|
770
|
+
for (const p of possiblePaths) {
|
|
771
|
+
const absolutePkgPath = Array.from(allFiles).find(
|
|
772
|
+
(f) => f.endsWith((0, import_path.normalize)(p))
|
|
773
|
+
);
|
|
774
|
+
if (absolutePkgPath) return absolutePkgPath;
|
|
775
|
+
}
|
|
776
|
+
}
|
|
750
777
|
if (allFiles.has(source)) return source;
|
|
751
778
|
return null;
|
|
752
779
|
}
|
|
@@ -869,7 +896,7 @@ function detectCircularDependencies(graph) {
|
|
|
869
896
|
return detectGraphCycles(graph.edges);
|
|
870
897
|
}
|
|
871
898
|
|
|
872
|
-
// src/
|
|
899
|
+
// src/classify/classification-patterns.ts
|
|
873
900
|
var BARREL_EXPORT_MIN_EXPORTS = 5;
|
|
874
901
|
var BARREL_EXPORT_TOKEN_LIMIT = 1e3;
|
|
875
902
|
var HANDLER_NAME_PATTERNS = [
|
|
@@ -923,6 +950,8 @@ var CONFIG_NAME_PATTERNS = [
|
|
|
923
950
|
"next.config",
|
|
924
951
|
"sst.config"
|
|
925
952
|
];
|
|
953
|
+
|
|
954
|
+
// src/classify/file-classifiers.ts
|
|
926
955
|
function isBoilerplateBarrel(node) {
|
|
927
956
|
const { exports: exports2, tokenCost } = node;
|
|
928
957
|
if (!exports2 || exports2.length === 0) return false;
|
|
@@ -1624,11 +1653,8 @@ function generateSummary(results, options = {}) {
|
|
|
1624
1653
|
};
|
|
1625
1654
|
}
|
|
1626
1655
|
|
|
1627
|
-
// src/
|
|
1656
|
+
// src/report/console-report.ts
|
|
1628
1657
|
var import_chalk = __toESM(require("chalk"));
|
|
1629
|
-
var import_fs2 = require("fs");
|
|
1630
|
-
var import_path3 = require("path");
|
|
1631
|
-
var import_prompts = __toESM(require("prompts"));
|
|
1632
1658
|
function displayConsoleReport(summary, results, maxResults = 10) {
|
|
1633
1659
|
const divider = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
1634
1660
|
const totalIssues = summary.criticalIssues + summary.majorIssues + summary.minorIssues;
|
|
@@ -1698,6 +1724,8 @@ function displayConsoleReport(summary, results, maxResults = 10) {
|
|
|
1698
1724
|
)
|
|
1699
1725
|
);
|
|
1700
1726
|
}
|
|
1727
|
+
|
|
1728
|
+
// src/report/html-report.ts
|
|
1701
1729
|
function generateHTMLReport(summary, results) {
|
|
1702
1730
|
const totalIssues = summary.criticalIssues + summary.majorIssues + summary.minorIssues;
|
|
1703
1731
|
void results;
|
|
@@ -1877,8 +1905,14 @@ function generateHTMLReport(summary, results) {
|
|
|
1877
1905
|
</body>
|
|
1878
1906
|
</html>`;
|
|
1879
1907
|
}
|
|
1908
|
+
|
|
1909
|
+
// src/report/interactive-setup.ts
|
|
1910
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
1911
|
+
var import_fs2 = require("fs");
|
|
1912
|
+
var import_path3 = require("path");
|
|
1913
|
+
var import_prompts = __toESM(require("prompts"));
|
|
1880
1914
|
async function runInteractiveSetup(directory, current) {
|
|
1881
|
-
console.log(
|
|
1915
|
+
console.log(import_chalk2.default.yellow("\u{1F9ED} Interactive mode: let's tailor the analysis."));
|
|
1882
1916
|
const pkgPath = (0, import_path3.join)(directory, "package.json");
|
|
1883
1917
|
let deps = {};
|
|
1884
1918
|
if ((0, import_fs2.existsSync)(pkgPath)) {
|
|
@@ -1941,15 +1975,15 @@ async function runInteractiveSetup(directory, current) {
|
|
|
1941
1975
|
"**/*.{ts,js,py,java}"
|
|
1942
1976
|
];
|
|
1943
1977
|
}
|
|
1944
|
-
console.log(
|
|
1978
|
+
console.log(import_chalk2.default.green("\u2713 Interactive configuration applied."));
|
|
1945
1979
|
return nextOptions;
|
|
1946
1980
|
}
|
|
1947
1981
|
|
|
1948
1982
|
// src/cli-action.ts
|
|
1949
|
-
var
|
|
1983
|
+
var import_chalk3 = __toESM(require("chalk"));
|
|
1950
1984
|
var import_fs3 = require("fs");
|
|
1951
1985
|
async function contextActionHandler(directory, options) {
|
|
1952
|
-
console.log(
|
|
1986
|
+
console.log(import_chalk3.default.blue("\u{1F50D} Analyzing context window costs...\n"));
|
|
1953
1987
|
const startTime = Date.now();
|
|
1954
1988
|
try {
|
|
1955
1989
|
const defaults = {
|
|
@@ -2004,11 +2038,11 @@ async function contextActionHandler(directory, options) {
|
|
|
2004
2038
|
"context-report.html"
|
|
2005
2039
|
);
|
|
2006
2040
|
(0, import_fs3.writeFileSync)(outputPath, html, "utf-8");
|
|
2007
|
-
console.log(
|
|
2041
|
+
console.log(import_chalk3.default.green(`
|
|
2008
2042
|
\u2705 HTML report saved to: ${outputPath}`));
|
|
2009
2043
|
} else {
|
|
2010
2044
|
displayConsoleReport(summary, results, finalOptions.maxResults);
|
|
2011
|
-
console.log(
|
|
2045
|
+
console.log(import_chalk3.default.dim(`
|
|
2012
2046
|
\u2728 Analysis completed in ${duration}ms
|
|
2013
2047
|
`));
|
|
2014
2048
|
}
|
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -421,6 +421,23 @@ declare function generateSummary(results: ContextAnalysisResult[], options?: any
|
|
|
421
421
|
* @returns Map of file path to nested map of related files and their co-occurrence counts.
|
|
422
422
|
*/
|
|
423
423
|
declare function buildCoUsageMatrix(graph: DependencyGraph): Map<string, Map<string, number>>;
|
|
424
|
+
/**
|
|
425
|
+
* Find semantic clusters using frequently occurring co-usage patterns.
|
|
426
|
+
*
|
|
427
|
+
* @param coUsageMatrix - The co-usage matrix from buildCoUsageMatrix.
|
|
428
|
+
* @param minCoUsage - Minimum co-usage count to consider a strong relationship (default: 3).
|
|
429
|
+
* @returns Map of cluster representative files to their associated cluster members.
|
|
430
|
+
*/
|
|
431
|
+
declare function findSemanticClusters(coUsageMatrix: Map<string, Map<string, number>>, minCoUsage?: number): Map<string, string[]>;
|
|
432
|
+
/**
|
|
433
|
+
* Retrieve co-usage data for a specific file.
|
|
434
|
+
*
|
|
435
|
+
* @param file - The file path to look up.
|
|
436
|
+
* @param coUsageMatrix - The global co-usage matrix.
|
|
437
|
+
* @returns Formatted co-usage data object.
|
|
438
|
+
*/
|
|
439
|
+
declare function getCoUsageData(file: string, coUsageMatrix: Map<string, Map<string, number>>): CoUsageData;
|
|
440
|
+
|
|
424
441
|
/**
|
|
425
442
|
* Extract type dependencies from AST exports to build a type-based relationship graph.
|
|
426
443
|
*
|
|
@@ -428,14 +445,14 @@ declare function buildCoUsageMatrix(graph: DependencyGraph): Map<string, Map<str
|
|
|
428
445
|
* @returns Map of type reference names to sets of files that consume or export them.
|
|
429
446
|
*/
|
|
430
447
|
declare function buildTypeGraph(graph: DependencyGraph): Map<string, Set<string>>;
|
|
448
|
+
|
|
431
449
|
/**
|
|
432
|
-
*
|
|
450
|
+
* Calculate confidence score for a domain assignment based on signals.
|
|
433
451
|
*
|
|
434
|
-
* @param
|
|
435
|
-
* @
|
|
436
|
-
* @returns Map of cluster representative files to their associated cluster members.
|
|
452
|
+
* @param signals - The set of semantic signals detected for a domain.
|
|
453
|
+
* @returns Numerical confidence score (0-1).
|
|
437
454
|
*/
|
|
438
|
-
declare function
|
|
455
|
+
declare function calculateDomainConfidence(signals: DomainSignals): number;
|
|
439
456
|
/**
|
|
440
457
|
* Infer domain from semantic analysis (co-usage + types) to identify logical modules.
|
|
441
458
|
*
|
|
@@ -448,13 +465,6 @@ declare function findSemanticClusters(coUsageMatrix: Map<string, Map<string, num
|
|
|
448
465
|
* @returns Array of potential domain assignments with confidence scores.
|
|
449
466
|
*/
|
|
450
467
|
declare function inferDomainFromSemantics(file: string, exportName: string, graph: DependencyGraph, coUsageMatrix: Map<string, Map<string, number>>, typeGraph: Map<string, Set<string>>, exportTypeRefs?: string[]): DomainAssignment[];
|
|
451
|
-
/**
|
|
452
|
-
* Calculate confidence score for a domain assignment based on signals.
|
|
453
|
-
*
|
|
454
|
-
* @param signals - The set of semantic signals detected for a domain.
|
|
455
|
-
* @returns Numerical confidence score (0-1).
|
|
456
|
-
*/
|
|
457
|
-
declare function calculateDomainConfidence(signals: DomainSignals): number;
|
|
458
468
|
/**
|
|
459
469
|
* Regex-based export extraction (legacy/fallback)
|
|
460
470
|
*
|
|
@@ -479,14 +489,7 @@ declare function extractExports(content: string, filePath?: string, domainOption
|
|
|
479
489
|
declare function inferDomain(name: string, filePath?: string, domainOptions?: {
|
|
480
490
|
domainKeywords?: string[];
|
|
481
491
|
}, fileImports?: string[]): string;
|
|
482
|
-
|
|
483
|
-
* Retrieve co-usage data for a specific file.
|
|
484
|
-
*
|
|
485
|
-
* @param file - The file path to look up.
|
|
486
|
-
* @param coUsageMatrix - The global co-usage matrix.
|
|
487
|
-
* @returns Formatted co-usage data object.
|
|
488
|
-
*/
|
|
489
|
-
declare function getCoUsageData(file: string, coUsageMatrix: Map<string, Map<string, number>>): CoUsageData;
|
|
492
|
+
|
|
490
493
|
/**
|
|
491
494
|
* Identify candidates for module consolidation based on high co-usage or shared types.
|
|
492
495
|
*
|
|
@@ -497,19 +500,146 @@ declare function getCoUsageData(file: string, coUsageMatrix: Map<string, Map<str
|
|
|
497
500
|
* @param minSharedTypes - Minimum shared types threshold.
|
|
498
501
|
* @returns Array of consolidation candidates sorted by strength.
|
|
499
502
|
*/
|
|
500
|
-
declare function findConsolidationCandidates(graph: DependencyGraph, coUsageMatrix: Map<string, Map<string, number>>, typeGraph: Map<string, Set<string>>, minCoUsage?: number, minSharedTypes?: number):
|
|
503
|
+
declare function findConsolidationCandidates(graph: DependencyGraph, coUsageMatrix: Map<string, Map<string, number>>, typeGraph: Map<string, Set<string>>, minCoUsage?: number, minSharedTypes?: number): {
|
|
504
|
+
files: string[];
|
|
505
|
+
reason: string;
|
|
506
|
+
strength: number;
|
|
507
|
+
}[];
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Classification pattern constants for file type detection.
|
|
511
|
+
*/
|
|
512
|
+
/** Minimum exports to consider a file as a barrel export */
|
|
513
|
+
declare const BARREL_EXPORT_MIN_EXPORTS = 5;
|
|
514
|
+
/** Token cost limit for barrel export detection */
|
|
515
|
+
declare const BARREL_EXPORT_TOKEN_LIMIT = 1000;
|
|
516
|
+
/** Patterns for Lambda/API handler detection */
|
|
517
|
+
declare const HANDLER_NAME_PATTERNS: string[];
|
|
518
|
+
/** Patterns for service file detection */
|
|
519
|
+
declare const SERVICE_NAME_PATTERNS: string[];
|
|
520
|
+
/** Patterns for email template detection */
|
|
521
|
+
declare const EMAIL_NAME_PATTERNS: string[];
|
|
522
|
+
/** Patterns for parser/transformer detection */
|
|
523
|
+
declare const PARSER_NAME_PATTERNS: string[];
|
|
524
|
+
/** Patterns for session/state management detection */
|
|
525
|
+
declare const SESSION_NAME_PATTERNS: string[];
|
|
526
|
+
/** Next.js metadata export names */
|
|
527
|
+
declare const NEXTJS_METADATA_EXPORTS: string[];
|
|
528
|
+
/** Patterns for configuration file detection */
|
|
529
|
+
declare const CONFIG_NAME_PATTERNS: string[];
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Detect if a file is a boilerplate barrel (architectural theater).
|
|
533
|
+
* A boilerplate barrel re-exports from other sources without adding value.
|
|
534
|
+
*
|
|
535
|
+
* @param node - The dependency node to analyze.
|
|
536
|
+
* @returns True if the file matches boilerplate barrel patterns.
|
|
537
|
+
*/
|
|
538
|
+
declare function isBoilerplateBarrel(node: DependencyNode): boolean;
|
|
539
|
+
/**
|
|
540
|
+
* Detect if a file is a barrel export (index.ts).
|
|
541
|
+
*
|
|
542
|
+
* @param node - The dependency node to analyze.
|
|
543
|
+
* @returns True if the file matches barrel export patterns.
|
|
544
|
+
* @lastUpdated 2026-03-20
|
|
545
|
+
*/
|
|
546
|
+
declare function isBarrelExport(node: DependencyNode): boolean;
|
|
547
|
+
/**
|
|
548
|
+
* Detect if a file is primarily type definitions.
|
|
549
|
+
*
|
|
550
|
+
* @param node - The dependency node to analyze.
|
|
551
|
+
* @returns True if the file contains primarily types or matches type paths.
|
|
552
|
+
* @lastUpdated 2026-03-18
|
|
553
|
+
*/
|
|
554
|
+
declare function isTypeDefinition(node: DependencyNode): boolean;
|
|
555
|
+
/**
|
|
556
|
+
* Detect if a file is a utility module.
|
|
557
|
+
*
|
|
558
|
+
* @param node - The dependency node to analyze.
|
|
559
|
+
* @returns True if the file path or name suggests a utility/helper role.
|
|
560
|
+
* @lastUpdated 2026-03-18
|
|
561
|
+
*/
|
|
562
|
+
declare function isUtilityModule(node: DependencyNode): boolean;
|
|
563
|
+
/**
|
|
564
|
+
* Detect if a file is a Lambda/API handler.
|
|
565
|
+
*
|
|
566
|
+
* @param node - The dependency node to analyze.
|
|
567
|
+
* @returns True if the file serves as a coordination point for requests/lambdas.
|
|
568
|
+
* @lastUpdated 2026-03-18
|
|
569
|
+
*/
|
|
570
|
+
declare function isLambdaHandler(node: DependencyNode): boolean;
|
|
571
|
+
/**
|
|
572
|
+
* Detect if a file is a service file.
|
|
573
|
+
*
|
|
574
|
+
* @param node - The dependency node to analyze.
|
|
575
|
+
* @returns True if the file orchestrates logic or matches service patterns.
|
|
576
|
+
* @lastUpdated 2026-03-18
|
|
577
|
+
*/
|
|
578
|
+
declare function isServiceFile(node: DependencyNode): boolean;
|
|
579
|
+
/**
|
|
580
|
+
* Detect if a file is an email template/layout.
|
|
581
|
+
*
|
|
582
|
+
* @param node - The dependency node to analyze.
|
|
583
|
+
* @returns True if the file is used for rendering notifications or emails.
|
|
584
|
+
* @lastUpdated 2026-03-18
|
|
585
|
+
*/
|
|
586
|
+
declare function isEmailTemplate(node: DependencyNode): boolean;
|
|
587
|
+
/**
|
|
588
|
+
* Detect if a file is a parser/transformer.
|
|
589
|
+
*
|
|
590
|
+
* @param node - The dependency node to analyze.
|
|
591
|
+
* @returns True if the file handles data conversion or serialization.
|
|
592
|
+
* @lastUpdated 2026-03-18
|
|
593
|
+
*/
|
|
594
|
+
declare function isParserFile(node: DependencyNode): boolean;
|
|
595
|
+
/**
|
|
596
|
+
* Detect if a file is a session/state management file.
|
|
597
|
+
*
|
|
598
|
+
* @param node - The dependency node to analyze.
|
|
599
|
+
* @returns True if the file manages application state or sessions.
|
|
600
|
+
* @lastUpdated 2026-03-18
|
|
601
|
+
*/
|
|
602
|
+
declare function isSessionFile(node: DependencyNode): boolean;
|
|
603
|
+
/**
|
|
604
|
+
* Detect if a file is a Next.js App Router page.
|
|
605
|
+
*
|
|
606
|
+
* @param node - The dependency node to analyze.
|
|
607
|
+
* @returns True if the file is a Next.js page or metadata entry.
|
|
608
|
+
* @lastUpdated 2026-03-18
|
|
609
|
+
*/
|
|
610
|
+
declare function isNextJsPage(node: DependencyNode): boolean;
|
|
611
|
+
/**
|
|
612
|
+
* Detect if a file is a configuration or schema file.
|
|
613
|
+
*
|
|
614
|
+
* @param node - The dependency node to analyze.
|
|
615
|
+
* @returns True if the file matches configuration, setting, or schema patterns.
|
|
616
|
+
* @lastUpdated 2026-03-18
|
|
617
|
+
*/
|
|
618
|
+
declare function isConfigFile(node: DependencyNode): boolean;
|
|
619
|
+
/**
|
|
620
|
+
* Detect if a file is part of a hub-and-spoke monorepo architecture.
|
|
621
|
+
*
|
|
622
|
+
* Many files spread across multiple packages (spokes) is intentional in
|
|
623
|
+
* AIReady and shouldn't be penalized as heavily for fragmentation.
|
|
624
|
+
*
|
|
625
|
+
* @param node - The dependency node to analyze.
|
|
626
|
+
* @returns True if the file path suggests it belongs to a spoke package.
|
|
627
|
+
*/
|
|
628
|
+
declare function isHubAndSpokeFile(node: DependencyNode): boolean;
|
|
501
629
|
|
|
502
630
|
/**
|
|
503
631
|
* Display analysis report in console
|
|
504
632
|
*/
|
|
505
633
|
declare function displayConsoleReport(summary: ReturnType<typeof generateSummary>, results: Awaited<ReturnType<typeof analyzeContext>>, maxResults?: number): void;
|
|
634
|
+
|
|
506
635
|
/**
|
|
507
636
|
* Generate HTML report
|
|
508
637
|
*/
|
|
509
638
|
declare function generateHTMLReport(summary: ReturnType<typeof generateSummary>, results: Awaited<ReturnType<typeof analyzeContext>>): string;
|
|
639
|
+
|
|
510
640
|
/**
|
|
511
641
|
* Interactive setup: detect common frameworks and suggest excludes & focus areas
|
|
512
642
|
*/
|
|
513
643
|
declare function runInteractiveSetup(directory: string, current: any): Promise<any>;
|
|
514
644
|
|
|
515
|
-
export { Classification, type CoUsageData, type ContextAnalysisResult, type ContextAnalyzerOptions, ContextAnalyzerProvider, type ContextSummary, type DependencyGraph, type DependencyNode, type DomainAssignment, type DomainSignals, type ExportInfo, type FileClassification, type ModuleCluster, type TypeDependency, adjustCohesionForClassification, adjustFragmentationForClassification, analyzeContext, buildCoUsageMatrix, buildDependencyGraph, buildTypeGraph, calculateCohesion, calculateContextBudget, calculateContextScore, calculateDirectoryDistance, calculateDomainConfidence, calculateEnhancedCohesion, calculateFragmentation, calculateImportDepth, calculatePathEntropy, calculateStructuralCohesionFromCoUsage, classifyFile, detectCircularDependencies, detectModuleClusters, displayConsoleReport, extractDomainKeywordsFromPaths, extractExports, findConsolidationCandidates, findSemanticClusters, generateHTMLReport, generateSummary, getClassificationRecommendations, getCoUsageData, getGeneralRecommendations, getSmartDefaults, getTransitiveDependencies, inferDomain, inferDomainFromSemantics, mapScoreToRating, runInteractiveSetup };
|
|
645
|
+
export { BARREL_EXPORT_MIN_EXPORTS, BARREL_EXPORT_TOKEN_LIMIT, CONFIG_NAME_PATTERNS, Classification, type CoUsageData, type ContextAnalysisResult, type ContextAnalyzerOptions, ContextAnalyzerProvider, type ContextSummary, type DependencyGraph, type DependencyNode, type DomainAssignment, type DomainSignals, EMAIL_NAME_PATTERNS, type ExportInfo, type FileClassification, HANDLER_NAME_PATTERNS, type ModuleCluster, NEXTJS_METADATA_EXPORTS, PARSER_NAME_PATTERNS, SERVICE_NAME_PATTERNS, SESSION_NAME_PATTERNS, type TypeDependency, adjustCohesionForClassification, adjustFragmentationForClassification, analyzeContext, buildCoUsageMatrix, buildDependencyGraph, buildTypeGraph, calculateCohesion, calculateContextBudget, calculateContextScore, calculateDirectoryDistance, calculateDomainConfidence, calculateEnhancedCohesion, calculateFragmentation, calculateImportDepth, calculatePathEntropy, calculateStructuralCohesionFromCoUsage, classifyFile, detectCircularDependencies, detectModuleClusters, displayConsoleReport, extractDomainKeywordsFromPaths, extractExports, findConsolidationCandidates, findSemanticClusters, generateHTMLReport, generateSummary, getClassificationRecommendations, getCoUsageData, getGeneralRecommendations, getSmartDefaults, getTransitiveDependencies, inferDomain, inferDomainFromSemantics, isBarrelExport, isBoilerplateBarrel, isConfigFile, isEmailTemplate, isHubAndSpokeFile, isLambdaHandler, isNextJsPage, isParserFile, isServiceFile, isSessionFile, isTypeDefinition, isUtilityModule, mapScoreToRating, runInteractiveSetup };
|