mirror of
https://github.com/samiyev/puaros.git
synced 2025-12-28 07:16:53 +05:00
- Project setup with tsup, vitest, ESM support - Domain entities: Session, Project - Value objects: FileData, FileAST, FileMeta, ChatMessage, ToolCall, ToolResult, UndoEntry - Service interfaces: IStorage, ILLMClient, ITool, IIndexer, IToolRegistry - Shared: Config (zod), IpuaroError, utils (hash, tokens), Result type - CLI with placeholder commands (start, init, index) - 91 unit tests with 100% coverage - Fix package scope @puaros -> @samiyev in CLAUDE.md
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
/**
|
|
* Represents computed metadata about a file.
|
|
*/
|
|
|
|
export interface ComplexityMetrics {
|
|
/** Lines of code (excluding empty and comments) */
|
|
loc: number
|
|
/** Maximum nesting depth */
|
|
nesting: number
|
|
/** Cyclomatic complexity score */
|
|
cyclomaticComplexity: number
|
|
/** Overall complexity score (0-100) */
|
|
score: number
|
|
}
|
|
|
|
export interface FileMeta {
|
|
/** Complexity metrics for the file */
|
|
complexity: ComplexityMetrics
|
|
/** Files that this file imports (internal paths) */
|
|
dependencies: string[]
|
|
/** Files that import this file */
|
|
dependents: string[]
|
|
/** Whether file is a dependency hub (>5 dependents) */
|
|
isHub: boolean
|
|
/** Whether file is an entry point (index.ts or 0 dependents) */
|
|
isEntryPoint: boolean
|
|
/** File type classification */
|
|
fileType: "source" | "test" | "config" | "types" | "unknown"
|
|
}
|
|
|
|
export function createFileMeta(partial: Partial<FileMeta> = {}): FileMeta {
|
|
return {
|
|
complexity: {
|
|
loc: 0,
|
|
nesting: 0,
|
|
cyclomaticComplexity: 1,
|
|
score: 0,
|
|
},
|
|
dependencies: [],
|
|
dependents: [],
|
|
isHub: false,
|
|
isEntryPoint: false,
|
|
fileType: "unknown",
|
|
...partial,
|
|
}
|
|
}
|
|
|
|
export function isHubFile(dependentCount: number): boolean {
|
|
return dependentCount > 5
|
|
}
|