mirror of
https://github.com/sipeed/picoclaw.git
synced 2026-06-12 18:08:54 +00:00
fix(providers,tools): address linter issues after reorg
This commit is contained in:
@@ -38,15 +38,7 @@ func TestNormalizeToolCallFacadeMatchesCLIProvider(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAntigravityFacadeSignaturesRemainAvailable(t *testing.T) {
|
||||
var projectFetcher func(string) (string, error) = FetchAntigravityProjectID
|
||||
var modelsFetcher 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 _ func(string) (string, error) = FetchAntigravityProjectID
|
||||
var _ func(string, string) ([]AntigravityModelInfo, error) = FetchAntigravityModels
|
||||
var _ AntigravityModelInfo = oauthprovider.AntigravityModelInfo{}
|
||||
}
|
||||
|
||||
+26
-5
@@ -20,7 +20,12 @@ type (
|
||||
|
||||
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...)
|
||||
}
|
||||
|
||||
@@ -42,19 +47,35 @@ func NewReadFileLinesTool(
|
||||
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...)
|
||||
}
|
||||
|
||||
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...)
|
||||
}
|
||||
|
||||
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...)
|
||||
}
|
||||
|
||||
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...)
|
||||
}
|
||||
|
||||
|
||||
@@ -120,16 +120,12 @@ func (t *I2CTool) detect() *ToolResult {
|
||||
// Helper functions for I2C operations (used by platform-specific implementations)
|
||||
|
||||
// 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 {
|
||||
matched, _ := regexp.MatchString(`^\d+$`, id)
|
||||
return matched
|
||||
}
|
||||
|
||||
// parseI2CAddress extracts and validates an I2C address from args
|
||||
//
|
||||
//nolint:unused // Used by i2c_linux.go
|
||||
func parseI2CAddress(args map[string]any) (int, *ToolResult) {
|
||||
addrFloat, ok := args["address"].(float64)
|
||||
if !ok {
|
||||
@@ -143,8 +139,6 @@ func parseI2CAddress(args map[string]any) (int, *ToolResult) {
|
||||
}
|
||||
|
||||
// parseI2CBus extracts and validates an I2C bus from args
|
||||
//
|
||||
//nolint:unused // Used by i2c_linux.go
|
||||
func parseI2CBus(args map[string]any) (string, *ToolResult) {
|
||||
bus, ok := args["bus"].(string)
|
||||
if !ok || bus == "" {
|
||||
@@ -155,3 +149,9 @@ func parseI2CBus(args map[string]any) (string, *ToolResult) {
|
||||
}
|
||||
return bus, nil
|
||||
}
|
||||
|
||||
var (
|
||||
_ = isValidBusID
|
||||
_ = parseI2CAddress
|
||||
_ = parseI2CBus
|
||||
)
|
||||
|
||||
@@ -122,8 +122,6 @@ func (t *SPITool) list() *ToolResult {
|
||||
// Helper function for SPI operations (used by platform-specific implementations)
|
||||
|
||||
// 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) {
|
||||
dev, ok := args["device"].(string)
|
||||
if !ok || dev == "" {
|
||||
@@ -160,3 +158,5 @@ func parseSPIArgs(args map[string]any) (device string, speed uint32, mode uint8,
|
||||
|
||||
return dev, speed, mode, bits, ""
|
||||
}
|
||||
|
||||
var _ = parseSPIArgs
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package tools
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/modelcontextprotocol/go-sdk/mcp"
|
||||
|
||||
"github.com/sipeed/picoclaw/pkg/audio/tts"
|
||||
@@ -101,5 +99,3 @@ func NewWebFetchToolWithConfig(
|
||||
) (*WebFetchTool, error) {
|
||||
return integrationtools.NewWebFetchToolWithConfig(maxChars, proxy, format, fetchLimitBytes, privateHostWhitelist)
|
||||
}
|
||||
|
||||
func _keepContext(context.Context) {}
|
||||
|
||||
Reference in New Issue
Block a user