fix(providers,tools): address linter issues after reorg

This commit is contained in:
lc6464 2026-04-17 14:16:18 +08:00
parent 4c133dc2d9
commit 9b4efddd9b
No known key found for this signature in database
GPG key ID: 53C61B42FEC71D6D
5 changed files with 36 additions and 27 deletions

View file

@ -38,15 +38,7 @@ func TestNormalizeToolCallFacadeMatchesCLIProvider(t *testing.T) {
} }
func TestAntigravityFacadeSignaturesRemainAvailable(t *testing.T) { func TestAntigravityFacadeSignaturesRemainAvailable(t *testing.T) {
var projectFetcher func(string) (string, error) = FetchAntigravityProjectID var _ func(string) (string, error) = FetchAntigravityProjectID
var modelsFetcher func(string, string) ([]AntigravityModelInfo, error) = FetchAntigravityModels var _ func(string, string) ([]AntigravityModelInfo, error) = FetchAntigravityModels
if projectFetcher == nil {
t.Fatal("FetchAntigravityProjectID facade should be available")
}
if modelsFetcher == nil {
t.Fatal("FetchAntigravityModels facade should be available")
}
var _ AntigravityModelInfo = oauthprovider.AntigravityModelInfo{} var _ AntigravityModelInfo = oauthprovider.AntigravityModelInfo{}
} }

View file

@ -20,7 +20,12 @@ type (
const MaxReadFileSize = fstools.MaxReadFileSize const MaxReadFileSize = fstools.MaxReadFileSize
func NewReadFileTool(workspace string, restrict bool, maxReadFileSize int, allowPaths ...[]*regexp.Regexp) *ReadFileTool { func NewReadFileTool(
workspace string,
restrict bool,
maxReadFileSize int,
allowPaths ...[]*regexp.Regexp,
) *ReadFileTool {
return fstools.NewReadFileTool(workspace, restrict, maxReadFileSize, allowPaths...) return fstools.NewReadFileTool(workspace, restrict, maxReadFileSize, allowPaths...)
} }
@ -42,19 +47,35 @@ func NewReadFileLinesTool(
return fstools.NewReadFileLinesTool(workspace, restrict, maxReadFileSize, allowPaths...) return fstools.NewReadFileLinesTool(workspace, restrict, maxReadFileSize, allowPaths...)
} }
func NewWriteFileTool(workspace string, restrict bool, allowPaths ...[]*regexp.Regexp) *WriteFileTool { func NewWriteFileTool(
workspace string,
restrict bool,
allowPaths ...[]*regexp.Regexp,
) *WriteFileTool {
return fstools.NewWriteFileTool(workspace, restrict, allowPaths...) return fstools.NewWriteFileTool(workspace, restrict, allowPaths...)
} }
func NewListDirTool(workspace string, restrict bool, allowPaths ...[]*regexp.Regexp) *ListDirTool { func NewListDirTool(
workspace string,
restrict bool,
allowPaths ...[]*regexp.Regexp,
) *ListDirTool {
return fstools.NewListDirTool(workspace, restrict, allowPaths...) return fstools.NewListDirTool(workspace, restrict, allowPaths...)
} }
func NewEditFileTool(workspace string, restrict bool, allowPaths ...[]*regexp.Regexp) *EditFileTool { func NewEditFileTool(
workspace string,
restrict bool,
allowPaths ...[]*regexp.Regexp,
) *EditFileTool {
return fstools.NewEditFileTool(workspace, restrict, allowPaths...) return fstools.NewEditFileTool(workspace, restrict, allowPaths...)
} }
func NewAppendFileTool(workspace string, restrict bool, allowPaths ...[]*regexp.Regexp) *AppendFileTool { func NewAppendFileTool(
workspace string,
restrict bool,
allowPaths ...[]*regexp.Regexp,
) *AppendFileTool {
return fstools.NewAppendFileTool(workspace, restrict, allowPaths...) return fstools.NewAppendFileTool(workspace, restrict, allowPaths...)
} }

View file

@ -120,16 +120,12 @@ func (t *I2CTool) detect() *ToolResult {
// Helper functions for I2C operations (used by platform-specific implementations) // Helper functions for I2C operations (used by platform-specific implementations)
// isValidBusID checks that a bus identifier is a simple number (prevents path injection) // isValidBusID checks that a bus identifier is a simple number (prevents path injection)
//
//nolint:unused // Used by i2c_linux.go
func isValidBusID(id string) bool { func isValidBusID(id string) bool {
matched, _ := regexp.MatchString(`^\d+$`, id) matched, _ := regexp.MatchString(`^\d+$`, id)
return matched return matched
} }
// parseI2CAddress extracts and validates an I2C address from args // parseI2CAddress extracts and validates an I2C address from args
//
//nolint:unused // Used by i2c_linux.go
func parseI2CAddress(args map[string]any) (int, *ToolResult) { func parseI2CAddress(args map[string]any) (int, *ToolResult) {
addrFloat, ok := args["address"].(float64) addrFloat, ok := args["address"].(float64)
if !ok { if !ok {
@ -143,8 +139,6 @@ func parseI2CAddress(args map[string]any) (int, *ToolResult) {
} }
// parseI2CBus extracts and validates an I2C bus from args // parseI2CBus extracts and validates an I2C bus from args
//
//nolint:unused // Used by i2c_linux.go
func parseI2CBus(args map[string]any) (string, *ToolResult) { func parseI2CBus(args map[string]any) (string, *ToolResult) {
bus, ok := args["bus"].(string) bus, ok := args["bus"].(string)
if !ok || bus == "" { if !ok || bus == "" {
@ -155,3 +149,9 @@ func parseI2CBus(args map[string]any) (string, *ToolResult) {
} }
return bus, nil return bus, nil
} }
var (
_ = isValidBusID
_ = parseI2CAddress
_ = parseI2CBus
)

View file

@ -122,8 +122,6 @@ func (t *SPITool) list() *ToolResult {
// Helper function for SPI operations (used by platform-specific implementations) // Helper function for SPI operations (used by platform-specific implementations)
// parseSPIArgs extracts and validates common SPI parameters // parseSPIArgs extracts and validates common SPI parameters
//
//nolint:unused // Used by spi_linux.go
func parseSPIArgs(args map[string]any) (device string, speed uint32, mode uint8, bits uint8, errMsg string) { func parseSPIArgs(args map[string]any) (device string, speed uint32, mode uint8, bits uint8, errMsg string) {
dev, ok := args["device"].(string) dev, ok := args["device"].(string)
if !ok || dev == "" { if !ok || dev == "" {
@ -160,3 +158,5 @@ func parseSPIArgs(args map[string]any) (device string, speed uint32, mode uint8,
return dev, speed, mode, bits, "" return dev, speed, mode, bits, ""
} }
var _ = parseSPIArgs

View file

@ -1,8 +1,6 @@
package tools package tools
import ( import (
"context"
"github.com/modelcontextprotocol/go-sdk/mcp" "github.com/modelcontextprotocol/go-sdk/mcp"
"github.com/sipeed/picoclaw/pkg/audio/tts" "github.com/sipeed/picoclaw/pkg/audio/tts"
@ -101,5 +99,3 @@ func NewWebFetchToolWithConfig(
) (*WebFetchTool, error) { ) (*WebFetchTool, error) {
return integrationtools.NewWebFetchToolWithConfig(maxChars, proxy, format, fetchLimitBytes, privateHostWhitelist) return integrationtools.NewWebFetchToolWithConfig(maxChars, proxy, format, fetchLimitBytes, privateHostWhitelist)
} }
func _keepContext(context.Context) {}