( projectPath: string, )
| 29 | } |
| 30 | |
| 31 | export async function getProjectFileContext( |
| 32 | projectPath: string, |
| 33 | ): Promise<ProjectFileContext> { |
| 34 | _projectRootForMocks = projectPath |
| 35 | const fileTree = await getProjectFileTree({ |
| 36 | projectRoot: projectPath, |
| 37 | fs: fs.promises, |
| 38 | }) |
| 39 | const allFilePaths = getAllFilePaths(fileTree) |
| 40 | const knowledgeFilePaths = allFilePaths.filter(isKnowledgeFile) |
| 41 | const knowledgeFiles: Record<string, string> = {} |
| 42 | for (const filePath of knowledgeFilePaths) { |
| 43 | const content = readMockFile(projectPath, filePath) |
| 44 | if (content !== null) { |
| 45 | knowledgeFiles[filePath] = content |
| 46 | } |
| 47 | } |
| 48 | const fileTokenScoresResponse = await getFileTokenScores( |
| 49 | projectPath, |
| 50 | allFilePaths, |
| 51 | ) |
| 52 | const fileTokenScores = fileTokenScoresResponse.tokenScores |
| 53 | return { |
| 54 | projectRoot: projectPath, |
| 55 | cwd: projectPath, |
| 56 | gitChanges: { |
| 57 | status: '', |
| 58 | diff: '', |
| 59 | diffCached: '', |
| 60 | lastCommitMessages: '', |
| 61 | }, |
| 62 | changesSinceLastChat: {}, |
| 63 | systemInfo: getSystemInfo(), |
| 64 | shellConfigFiles: {}, |
| 65 | knowledgeFiles, |
| 66 | fileTokenScores, |
| 67 | fileTree, |
| 68 | agentTemplates: {}, |
| 69 | customToolDefinitions: {}, |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | export function resetRepoToCommit(projectPath: string, commit: string) { |
| 74 | console.log(`Resetting repository at ${projectPath} to commit ${commit}...`) |
nothing calls this directly
no test coverage detected