feat: support sftool stub bin and config - #52
Closed
HalfSweet wants to merge 1 commit into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for configuring an external sftool stub binary and/or stub_config JSON in the VS Code extension, persists the selection in workspace state, surfaces it in the sidebar, and injects the corresponding CLI flags into the generated sftool download command.
Changes:
- Add
buildSftoolStubArgshelper (plus unit tests) to generate--stub/--stub-configCLI arguments. - Persist stub settings in
WorkspaceStateServiceand expose a new command/UI flow (extension.configureSftoolStub) to configure/clear them. - Display stub status in the sidebar and include stub args when building the
sftooldownload command.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/sftoolCommandUtils.ts | New helper for quoting and composing sftool stub CLI arguments. |
| src/test/sftoolCommandUtils.test.ts | Unit tests for the stub argument builder. |
| src/services/workspaceStateService.ts | Adds workspace-state keys/defaults + getters/setters for stub paths. |
| src/services/boardService.ts | Appends configured stub args to the generated sftool download command. |
| src/providers/sifliSidebarProvider.ts | Adds sidebar item showing stub source/status + refresh on state change. |
| src/extension.ts | Registers new configureSftoolStub command. |
| src/commands/configCommands.ts | Implements QuickPick + file pickers to configure/clear stub paths. |
| package.json | Contributes the new command to VS Code. |
| package.nls.json | Adds command title localization key (EN). |
| package.nls.zh-cn.json | Adds command title localization key (ZH-CN). |
| l10n/bundle.l10n.json | Adds runtime UI strings for stub configuration (EN). |
| l10n/bundle.l10n.zh-cn.json | Adds runtime UI strings for stub configuration (ZH-CN). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+6
to
+8
| export function quoteSftoolCommandArg(value: string): string { | ||
| return `"${value}"`; | ||
| } |
Comment on lines
+319
to
+330
| private getSftoolStubStatusLabel(stubPath: string, stubConfigPath: string): string { | ||
| if (stubPath && stubConfigPath) { | ||
| return vscode.l10n.t('External bin + config'); | ||
| } | ||
| if (stubPath) { | ||
| return vscode.l10n.t('External bin'); | ||
| } | ||
| if (stubConfigPath) { | ||
| return vscode.l10n.t('Stub config'); | ||
| } | ||
| return vscode.l10n.t('Embedded'); | ||
| } |
Comment on lines
+1
to
+31
| import * as assert from 'assert'; | ||
| import { describe, it } from 'mocha'; | ||
| import { buildSftoolStubArgs } from '../utils/sftoolCommandUtils'; | ||
|
|
||
| describe('sftoolCommandUtils', () => { | ||
| it('omits stub arguments when no stub settings are configured', () => { | ||
| assert.strictEqual(buildSftoolStubArgs({}), ''); | ||
| assert.strictEqual(buildSftoolStubArgs({ stubPath: '', stubConfigPath: ' ' }), ''); | ||
| }); | ||
|
|
||
| it('builds an external stub bin argument', () => { | ||
| assert.strictEqual(buildSftoolStubArgs({ stubPath: '/tmp/custom stub.bin' }), '--stub "/tmp/custom stub.bin"'); | ||
| }); | ||
|
|
||
| it('builds a stub_config JSON argument', () => { | ||
| assert.strictEqual( | ||
| buildSftoolStubArgs({ stubConfigPath: '/tmp/stub config.json' }), | ||
| '--stub-config "/tmp/stub config.json"' | ||
| ); | ||
| }); | ||
|
|
||
| it('keeps stub arguments before the command when both are configured', () => { | ||
| assert.strictEqual( | ||
| buildSftoolStubArgs({ | ||
| stubPath: '/tmp/custom stub.bin', | ||
| stubConfigPath: '/tmp/stub config.json', | ||
| }), | ||
| '--stub "/tmp/custom stub.bin" --stub-config "/tmp/stub config.json"' | ||
| ); | ||
| }); | ||
| }); |
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.
feat: support sftool stub bin and config