Documentation
¶
Overview ¶
Package clawhub provides ClawHub skills marketplace integration.
Index ¶
- Constants
- func ValidateSignature(manifest *Manifest, publicKey string) error
- type Dependency
- type DependencyResolver
- type Hub
- func (h *Hub) Get(ctx context.Context, name string) (*SkillInfo, error)
- func (h *Hub) GetVersion(ctx context.Context, name, version string) (*SkillInfo, error)
- func (h *Hub) ListVersions(ctx context.Context, name string) ([]string, error)
- func (h *Hub) Resolve(ctx context.Context, ref string) (*SkillInfo, error)
- func (h *Hub) Search(ctx context.Context, query string, page, perPage int) (*SearchResult, error)
- type IssueType
- type Manifest
- type Option
- type ResolutionError
- type ResolvedDependency
- type ScanResult
- type SearchResult
- type SecurityIssue
- type SecurityScanner
- type SecurityState
- type Severity
- type SkillInfo
Constants ¶
const (
// DefaultHubURL is the default ClawHub API endpoint.
DefaultHubURL = "https://api.clawhub.ai/v1"
)
const ManifestFile = "CLAWHUB.json"
ManifestFile is the name of the manifest file in a skill repository.
Variables ¶
This section is empty.
Functions ¶
func ValidateSignature ¶
ValidateSignature validates a skill's cryptographic signature.
Types ¶
type Dependency ¶
type Dependency struct {
// Name is the dependency name (e.g., "@clawhub/web-search").
Name string `json:"name"`
// Version is the version constraint (e.g., "^1.0.0", ">=2.0.0").
Version string `json:"version"`
// Optional indicates if the dependency is optional.
Optional bool `json:"optional,omitempty"`
}
Dependency represents a skill dependency.
type DependencyResolver ¶
type DependencyResolver struct {
// contains filtered or unexported fields
}
DependencyResolver resolves skill dependencies.
func NewDependencyResolver ¶
func NewDependencyResolver(hub *Hub) *DependencyResolver
NewDependencyResolver creates a new dependency resolver.
func (*DependencyResolver) Resolve ¶
func (r *DependencyResolver) Resolve(ctx context.Context, manifest *Manifest) ([]ResolvedDependency, error)
Resolve resolves all dependencies for a manifest.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub provides access to the ClawHub skills marketplace API.
func (*Hub) GetVersion ¶
GetVersion retrieves information about a specific version of a skill.
func (*Hub) ListVersions ¶
ListVersions lists all versions of a skill.
type Manifest ¶
type Manifest struct {
// Name is the skill name (required).
Name string `json:"name"`
// Version is the semantic version (required).
Version string `json:"version"`
// Description is a brief description of the skill.
Description string `json:"description"`
// Author is the skill author's name or organization.
Author string `json:"author"`
// Repository is the source repository URL.
Repository string `json:"repository"`
// License is the SPDX license identifier.
License string `json:"license"`
// Keywords are searchable tags for the skill.
Keywords []string `json:"keywords,omitempty"`
// Dependencies lists other skills this skill depends on.
Dependencies []Dependency `json:"dependencies,omitempty"`
// Permissions lists the permissions the skill requires.
Permissions []string `json:"permissions,omitempty"`
// Entry is the entry point file (defaults to SKILL.md).
Entry string `json:"entry,omitempty"`
// Signature is the cryptographic signature for verification.
Signature string `json:"signature,omitempty"`
// MinAgentVersion is the minimum omniagent version required.
MinAgentVersion string `json:"minAgentVersion,omitempty"`
}
Manifest represents the CLAWHUB.json manifest file.
func LoadManifest ¶
LoadManifest loads a manifest from a file path.
func ParseManifest ¶
ParseManifest parses a manifest from JSON data.
func (*Manifest) HasPermission ¶
HasPermission checks if the skill requests a specific permission.
func (*Manifest) SaveManifest ¶
SaveManifest saves a manifest to a file path.
type Option ¶
type Option func(*Hub)
Option is a functional option for configuring the Hub.
func WithAPIKey ¶
WithAPIKey sets the API key for authenticated requests.
func WithBaseURL ¶
WithBaseURL sets a custom base URL for the Hub API.
func WithHTTPClient ¶
WithHTTPClient sets a custom HTTP client.
type ResolutionError ¶
type ResolutionError struct {
// Dependency is the name of the dependency that failed.
Dependency string
// Constraint is the version constraint that couldn't be satisfied.
Constraint string
// Reason is the error reason.
Reason string
}
ResolutionError represents an error during dependency resolution.
func (*ResolutionError) Error ¶
func (e *ResolutionError) Error() string
type ResolvedDependency ¶
type ResolvedDependency struct {
// Name is the dependency name.
Name string
// Version is the resolved version.
Version string
// Repository is the source repository URL.
Repository string
// Optional indicates if this is an optional dependency.
Optional bool
// Transitive indicates if this is a transitive dependency.
Transitive bool
}
ResolvedDependency represents a fully resolved dependency.
type ScanResult ¶
type ScanResult struct {
// Issues is the list of security issues found.
Issues []SecurityIssue
// FileHashes contains SHA256 hashes of all files.
FileHashes map[string]string
// Passed indicates if the scan passed.
Passed bool
}
ScanResult contains the results of a security scan.
type SearchResult ¶
type SearchResult struct {
// Skills is the list of matching skills.
Skills []SkillInfo `json:"skills"`
// Total is the total number of matching skills.
Total int `json:"total"`
// Page is the current page number.
Page int `json:"page"`
// PerPage is the number of results per page.
PerPage int `json:"perPage"`
}
SearchResult contains the result of a skill search.
type SecurityIssue ¶
type SecurityIssue struct {
// Severity is the issue severity.
Severity Severity
// Type is the issue type.
Type IssueType
// File is the file where the issue was found.
File string
// Line is the line number (0 if not applicable).
Line int
// Description describes the issue.
Description string
// Recommendation suggests how to fix the issue.
Recommendation string
}
SecurityIssue represents a security finding.
type SecurityScanner ¶
type SecurityScanner struct {
// StrictMode fails on any warning when true.
StrictMode bool
// AllowedCommands is a list of allowed shell commands.
AllowedCommands []string
// BlockedPatterns are regex patterns that are not allowed.
BlockedPatterns []*regexp.Regexp
}
SecurityScanner scans skill packages for security issues.
func NewSecurityScanner ¶
func NewSecurityScanner() *SecurityScanner
NewSecurityScanner creates a new security scanner with defaults.
func (*SecurityScanner) Scan ¶
func (s *SecurityScanner) Scan(dir string) (*ScanResult, error)
Scan scans a skill directory for security issues.
type SecurityState ¶
type SecurityState string
SecurityState represents the security verification state of a skill.
const ( // SecurityStateUnknown indicates the skill has not been verified. SecurityStateUnknown SecurityState = "unknown" // SecurityStatePending indicates verification is in progress. SecurityStatePending SecurityState = "pending" // SecurityStateVerified indicates the skill passed security checks. SecurityStateVerified SecurityState = "verified" // SecurityStateFlagged indicates security issues were found. SecurityStateFlagged SecurityState = "flagged" )
type SkillInfo ¶
type SkillInfo struct {
// Name is the skill name.
Name string `json:"name"`
// Version is the latest version.
Version string `json:"version"`
// Description is the skill description.
Description string `json:"description"`
// Author is the skill author.
Author string `json:"author"`
// Repository is the source repository URL.
Repository string `json:"repository"`
// Downloads is the total download count.
Downloads int `json:"downloads"`
// Stars is the star count.
Stars int `json:"stars"`
// License is the SPDX license identifier.
License string `json:"license"`
// Keywords are searchable tags.
Keywords []string `json:"keywords"`
// CreatedAt is when the skill was first published.
CreatedAt time.Time `json:"createdAt"`
// UpdatedAt is when the skill was last updated.
UpdatedAt time.Time `json:"updatedAt"`
// SecurityState indicates the security verification state.
SecurityState SecurityState `json:"securityState"`
// Versions lists all available versions.
Versions []string `json:"versions,omitempty"`
}
SkillInfo contains information about a skill from the Hub.