feat(explorer): add SDK dependency browser#35
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an “SDK Dependencies” explorer view that reads codebase_index.json from the current SiFli project build output, resolves SDK file paths against the active SDK, and provides commands/auto-regeneration to keep the index up to date.
Changes:
- Introduces
SdkDependencyIndexServiceto load/validatecodebase_index.json, map paths into the active SDK, and detect staleness viacompile_commands.json. - Adds a new Explorer view (
sifliSdkDependenciesExplorer) + provider/manager with refresh, auto-generate, and editor-reveal behavior. - Adds build/task + commands to generate the codebase index (
scons --target=json) and refresh dependency data, with localization and docs updates.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/index.ts | Extends command/task ID unions for new commands/task. |
| src/services/workspaceStateService.ts | Adds a workspace-state change event used to refresh the explorer on SDK/board changes. |
| src/services/sdkDependencyIndexService.ts | New service to compute SDK dependency snapshot from codebase_index.json (with caching + compatibility checks). |
| src/services/gitService.ts | Adds isCommitAncestor() helper for SDK compatibility checks. |
| src/services/buildExecutionService.ts | Adds build execution methods for generating the codebase index. |
| src/services/boardService.ts | Refactors board search arg building and adds generate-index command builder. |
| src/providers/sdkDependencyExplorerProvider.ts | New TreeDataProvider + manager, file watchers, auto-generate logic, and editor reveal. |
| src/extension.ts | Registers the new commands and wires up the explorer manager lifecycle. |
| src/constants/index.ts | Adds CODEBASE_INDEX_JSON_FILE and new task name constant. |
| src/commands/buildCommands.ts | Adds a guarded command to generate codebase_index.json with notifications. |
| package.json | Contributes the new view + view title actions + commands. |
| package.nls.json / package.nls.zh-cn.json | Adds localized command/view names. |
| l10n/bundle.l10n.json / l10n/bundle.l10n.zh-cn.json | Adds localized runtime strings for the new feature. |
| docs/src/Feature/README.md | Documents the SDK dependency browser feature and auto-regeneration behavior. |
| docs/src/FAQs/README.md | Adds FAQ entries for index regeneration and unresolved files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+446
to
+448
| const stat = fs.statSync(markerPath); | ||
| if (latestMtimeMs === undefined || stat.mtimeMs > latestMtimeMs) { | ||
| latestMtimeMs = stat.mtimeMs; |
Comment on lines
+265
to
+270
| private getChildFolderMap(node: DependencyExplorerNode): Map<string, DependencyExplorerNode> { | ||
| if (!(node as DependencyExplorerNode & { folderMap?: Map<string, DependencyExplorerNode> }).folderMap) { | ||
| (node as DependencyExplorerNode & { folderMap?: Map<string, DependencyExplorerNode> }).folderMap = new Map(); | ||
| } | ||
| return (node as DependencyExplorerNode & { folderMap: Map<string, DependencyExplorerNode> }).folderMap; | ||
| } |
Comment on lines
+508
to
+511
| const pattern = new vscode.RelativePattern( | ||
| projectInfo.workspaceRoot, | ||
| `${projectInfo.projectEntryRelativePath}/build_*_hcpu/codebase_index.json` | ||
| ); |
Comment on lines
+401
to
+402
| 'SDK dependency browser is only supported on the SiFli-SDK main branch at or after {0}.', | ||
| MIN_SUPPORTED_MAIN_COMMIT |
| message: vscode.l10n.t( | ||
| 'SDK dependency browser requires main branch commit {0} or later. Current commit: {1}.', | ||
| MIN_SUPPORTED_MAIN_COMMIT, | ||
| metadata.hash || vscode.l10n.t('unknown') |
Comment on lines
+359
to
+365
| id: `state:${snapshot.status}`, | ||
| label: snapshot.message, | ||
| description: vscode.l10n.t('Refresh'), | ||
| tooltip: snapshot.indexPath ?? snapshot.message, | ||
| icon: snapshot.status === 'index-invalid' ? 'warning' : 'info', | ||
| commandId: 'extension.refreshSdkDependencies', | ||
| children: [], |
Comment on lines
+142
to
+149
| if (!fs.existsSync(currentSdkPath) || !fs.statSync(currentSdkPath).isDirectory()) { | ||
| return this.cacheAndReturn(`sdk-invalid:${projectInfo.workspaceRoot}:${boardName}:${currentSdkPath}`, { | ||
| status: 'sdk-invalid', | ||
| message: vscode.l10n.t('Selected SDK path is invalid: {0}', currentSdkPath), | ||
| boardName, | ||
| currentSdkPath, | ||
| workspaceRoot: projectInfo.workspaceRoot, | ||
| projects: [], |
Comment on lines
+193
to
+198
| const manifest = readJsonFile<CodebaseIndexManifest>(indexPath); | ||
| if (!manifest || !Array.isArray(manifest.projects)) { | ||
| const snapshot: SdkDependencySnapshot = { | ||
| status: 'index-invalid', | ||
| message: vscode.l10n.t('Failed to parse codebase_index.json.'), | ||
| boardName, |
| workspaceRoot: projectInfo.workspaceRoot, | ||
| indexPath, | ||
| shouldAutoGenerate: true, | ||
| autoGenerateKey: `missing:${projectInfo.workspaceRoot}:${boardName}`, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.