Skip to content

feat(explorer): add SDK dependency browser#35

Merged
HalfSweet merged 6 commits intomainfrom
feat/sdk-source
Mar 26, 2026
Merged

feat(explorer): add SDK dependency browser#35
HalfSweet merged 6 commits intomainfrom
feat/sdk-source

Conversation

@HalfSweet
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings March 17, 2026 09:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SdkDependencyIndexService to load/validate codebase_index.json, map paths into the active SDK, and detect staleness via compile_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}`,
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@HalfSweet HalfSweet merged commit 3e6c1c0 into main Mar 26, 2026
4 checks passed
@HalfSweet HalfSweet deleted the feat/sdk-source branch March 26, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants