fix(coding-teacher): restore context and read project files

This commit is contained in:
2026-09-22 19:12:59 +08:00
parent 7f5131e92f
commit 44e754a43e
14 changed files with 626 additions and 37 deletions

View File

@@ -207,6 +207,24 @@ export class CodingProjectFileService {
private readonly git: ConversationGitAdapter = new ProcessConversationGitAdapter(),
) {}
async directory(projectPath: string, requestedPath = '.'): Promise<Array<{
path: string; name: string; type: 'file' | 'directory';
}>> {
const relativePath = requestedPath === '.' ? '' : normalizeRelativePath(requestedPath);
const target = relativePath
? await containedExistingTarget(projectPath, relativePath)
: await realpath(projectPath);
const entries = await readdir(target, { withFileTypes: true });
return entries
.filter(entry => (entry.isFile() || entry.isDirectory()) && !SKIPPED_DIRECTORIES.has(entry.name))
.sort((left, right) => Number(right.isDirectory()) - Number(left.isDirectory()) || left.name.localeCompare(right.name))
.map(entry => ({
path: relativePath ? relativePath + '/' + entry.name : entry.name,
name: entry.name,
type: entry.isDirectory() ? 'directory' as const : 'file' as const,
}));
}
async status(projectPath: string): Promise<CodingProjectFileEntry[]> {
const result = await this.gitResult(projectPath, [
'status',