feat(ipuaro): implement v0.1.0 foundation

- 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
This commit is contained in:
imfozilbek
2025-11-29 23:08:38 +05:00
parent 7f6180df37
commit 130a8c4f24
62 changed files with 4629 additions and 6 deletions

View File

@@ -0,0 +1,83 @@
import type { FileAST } from "../value-objects/FileAST.js"
import type { FileData } from "../value-objects/FileData.js"
import type { FileMeta } from "../value-objects/FileMeta.js"
import type { DepsGraph, SymbolIndex } from "./IStorage.js"
/**
* Progress callback for indexing operations.
*/
export interface IndexProgress {
current: number
total: number
currentFile: string
phase: "scanning" | "parsing" | "analyzing" | "indexing"
}
/**
* Result of scanning a single file.
*/
export interface ScanResult {
path: string
type: "file" | "directory" | "symlink"
size: number
lastModified: number
}
/**
* Indexing result statistics.
*/
export interface IndexingStats {
filesScanned: number
filesParsed: number
parseErrors: number
timeMs: number
}
/**
* Indexer service interface (port).
* Handles project scanning, parsing, and indexing.
*/
export interface IIndexer {
/**
* Scan directory and yield file results.
*/
scan(root: string): AsyncGenerator<ScanResult>
/**
* Parse file content into AST.
*/
parseFile(content: string, language: "ts" | "tsx" | "js" | "jsx"): FileAST
/**
* Analyze file and compute metadata.
*/
analyzeFile(path: string, ast: FileAST, allASTs: Map<string, FileAST>): FileMeta
/**
* Build symbol index from all ASTs.
*/
buildSymbolIndex(asts: Map<string, FileAST>): SymbolIndex
/**
* Build dependency graph from all ASTs.
*/
buildDepsGraph(asts: Map<string, FileAST>): DepsGraph
/**
* Full indexing pipeline.
*/
indexProject(
root: string,
onProgress?: (progress: IndexProgress) => void,
): Promise<IndexingStats>
/**
* Update single file (incremental indexing).
*/
updateFile(path: string, data: FileData): Promise<void>
/**
* Remove file from index.
*/
removeFile(path: string): Promise<void>
}