File size: 2,220 Bytes
fd8cdf5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import type { FileEntry } from './scanner.js';
/**
 * Represents a detected entry point in the codebase.
 */
export interface EntryPoint {
    /** Relative file path */
    file: string;
    /** Line number where the entry point was found */
    line: number;
    /** Type of entry point */
    type: 'http' | 'cli' | 'event' | 'cron' | 'manual';
    /** Description of the entry point (e.g., "Express/Koa route") */
    description: string;
    /** The matched text (max 120 chars) */
    match: string;
    /** Code snippet around the match (max 300 chars) */
    snippet: string;
}
/**
 * Represents a file's structural signature.
 */
export interface FileSignature {
    /** Relative file path */
    file: string;
    /** Exported names (max 20) */
    exports: string[];
    /** Import sources (max 20) */
    imports: string[];
    /** Total line count */
    lines: number;
    /** First 80 lines of code (max 500 chars) */
    preview: string;
}
/**
 * The complete domain context extracted from a project.
 */
export interface DomainContext {
    projectRoot: string;
    fileCount: number;
    fileTree: string[];
    entryPoints: EntryPoint[];
    fileSignatures: FileSignature[];
    metadata: Record<string, unknown>;
}
/**
 * Detects entry points in the given files by scanning for known patterns.
 */
export declare function detectEntryPoints(targetPath: string, files: FileEntry[]): EntryPoint[];
/**
 * Extracts file signatures from the top prioritized files.
 */
export declare function extractFileSignatures(targetPath: string, files: FileEntry[]): FileSignature[];
/**
 * Reads project metadata from manifest files.
 */
export declare function extractMetadata(targetPath: string): Record<string, unknown>;
/**
 * Progressively trims the domain context to fit within maxBytes.
 */
export declare function truncateToFit(context: DomainContext, maxBytes?: number): DomainContext;
/**
 * Generates the domain context for a project.
 *
 * @param targetPath - Absolute path to the project root
 * @param files - Already-scanned file entries from the analyzer
 * @returns The generated DomainContext
 */
export declare function generateDomainContext(targetPath: string, files: FileEntry[]): DomainContext;