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
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
import type { FileData } from "../value-objects/FileData.js"
|
|
import type { FileAST } from "../value-objects/FileAST.js"
|
|
import type { FileMeta } from "../value-objects/FileMeta.js"
|
|
|
|
/**
|
|
* Symbol index mapping symbol names to their locations.
|
|
*/
|
|
export interface SymbolLocation {
|
|
path: string
|
|
line: number
|
|
type: "function" | "class" | "interface" | "type" | "variable"
|
|
}
|
|
|
|
export type SymbolIndex = Map<string, SymbolLocation[]>
|
|
|
|
/**
|
|
* Dependencies graph for the project.
|
|
*/
|
|
export interface DepsGraph {
|
|
/** Map from file path to its imports */
|
|
imports: Map<string, string[]>
|
|
/** Map from file path to files that import it */
|
|
importedBy: Map<string, string[]>
|
|
}
|
|
|
|
/**
|
|
* Storage service interface (port).
|
|
* Abstracts the persistence layer for project data.
|
|
*/
|
|
export interface IStorage {
|
|
// File data operations
|
|
getFile(path: string): Promise<FileData | null>
|
|
setFile(path: string, data: FileData): Promise<void>
|
|
deleteFile(path: string): Promise<void>
|
|
getAllFiles(): Promise<Map<string, FileData>>
|
|
getFileCount(): Promise<number>
|
|
|
|
// AST operations
|
|
getAST(path: string): Promise<FileAST | null>
|
|
setAST(path: string, ast: FileAST): Promise<void>
|
|
deleteAST(path: string): Promise<void>
|
|
getAllASTs(): Promise<Map<string, FileAST>>
|
|
|
|
// Meta operations
|
|
getMeta(path: string): Promise<FileMeta | null>
|
|
setMeta(path: string, meta: FileMeta): Promise<void>
|
|
deleteMeta(path: string): Promise<void>
|
|
getAllMetas(): Promise<Map<string, FileMeta>>
|
|
|
|
// Index operations
|
|
getSymbolIndex(): Promise<SymbolIndex>
|
|
setSymbolIndex(index: SymbolIndex): Promise<void>
|
|
getDepsGraph(): Promise<DepsGraph>
|
|
setDepsGraph(graph: DepsGraph): Promise<void>
|
|
|
|
// Config operations
|
|
getProjectConfig(key: string): Promise<unknown>
|
|
setProjectConfig(key: string, value: unknown): Promise<void>
|
|
|
|
// Lifecycle
|
|
connect(): Promise<void>
|
|
disconnect(): Promise<void>
|
|
isConnected(): boolean
|
|
clear(): Promise<void>
|
|
}
|