Add Explain Directory feature for analyzing specific directories in l…#3
Add Explain Directory feature for analyzing specific directories in l…#3
Conversation
…arge repos - Add new "Explain Directory" command that focuses on a specific directory while maintaining repo context - Useful for monorepos with multiple projects/models in separate directories - Creates DirectoryAnalysisService to scan and analyze individual directories - Add scanDirectory method to RepoScanner for targeted directory scanning - Add buildDirectoryPrompt that instructs LLM to focus on directory while being aware of broader context - Add separate "Explain Directory" history category in sidebar - Fix refresh functionality to correctly re-analyze the same directory - Filter out empty, malformed, and code fence artifact cards from markdown parsing - Add directory cache source type with directoryPath tracking Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e72b43eaf7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const relativePath = path.relative(folder.uri.fsPath, directoryPath); | ||
|
|
||
| // Scan only files within the specific directory | ||
| const pattern = `${relativePath}/**/*`; |
There was a problem hiding this comment.
Normalize glob path before scanning directory
scanDirectory derives relativePath with path.relative and interpolates it directly into the glob passed to vscode.workspace.findFiles. On Windows this produces backslashes (for example src\api/**/*), but VS Code glob patterns are slash-based, so directory scans can return no files and the new Explain Directory flow yields empty context for Windows users.
Useful? React with 👍 / 👎.
| vscode.window.registerTreeDataProvider("codeExplainer.sidebar", sidebarProvider), | ||
| vscode.commands.registerCommand("codeExplainer.refreshSidebar", () => sidebarProvider.refresh()), | ||
| vscode.commands.registerCommand("codeExplainer.explainRepo", wrapCommand(explainRepo)), | ||
| vscode.commands.registerCommand("codeExplainer.explainDirectory", wrapCommand(explainDirectory)), |
There was a problem hiding this comment.
Contribute the new command to the extension manifest
The new command is only registered programmatically here, but there is no codeExplainer.explainDirectory contribution/activation in package.json, so it is not discoverable in the Command Palette and cannot be invoked from Explorer context with a folder URI. That makes the uri-based path in createExplainDirectoryCommand effectively unreachable for normal users and limits the feature to sidebar-triggered active-editor behavior.
Useful? React with 👍 / 👎.
…arge repos