Documentation
¶
Overview ¶
Package dispatch bridges a generic (operation name, args) call to the typed go-pkggodev-client public API. It is the shared seam between the CLI and the MCP server (both driven by internal/spec) and the pkg.go.dev client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
Dispatcher routes operations to the typed pkg.go.dev client.
func New ¶
func New(c *pkggodev.Client) *Dispatcher
New creates a Dispatcher backed by the given client.
type ModuleInfo ¶
type ModuleInfo struct {
Path string `json:"path"`
Version string `json:"version,omitempty"`
GoVersion string `json:"goVersion,omitempty"`
RepoURL string `json:"repoUrl,omitempty"`
CommitTime time.Time `json:"commitTime,omitzero"`
Size int64 `json:"size,omitempty"`
HasGoMod bool `json:"hasGoMod"`
IsLatest bool `json:"isLatest"`
IsRedistributable bool `json:"isRedistributable"`
IsStandardLibrary bool `json:"isStandardLibrary"`
}
ModuleInfo is the metadata-only projection returned by `module info`. See PackageInfo for the allow-list rationale. GoVersion is the module's "go" directive (its minimum Go version) and Size is the module zip's download size in bytes (proxy HEAD request); Size is omitted when no module proxy is usable.
type Overview ¶
type Overview struct {
Path string `json:"path"`
Name string `json:"name,omitempty"`
Synopsis string `json:"synopsis,omitempty"`
ModulePath string `json:"modulePath,omitempty"`
LatestVersion string `json:"latestVersion,omitempty"`
RepoURL string `json:"repoUrl,omitempty"`
IsStandardLibrary bool `json:"isStandardLibrary"`
Licenses []string `json:"licenses,omitempty"` // SPDX types, not full text
RecentVersions []string `json:"recentVersions,omitempty"` // up to 10, newest first
Vulnerabilities []string `json:"vulnerabilities,omitempty"` // vulnerability IDs
}
Overview is a compact, token-efficient summary of a package, composed from several pkg.go.dev calls so an agent needs only one tool call.
type PackageInfo ¶
type PackageInfo struct {
Path string `json:"path"`
ModulePath string `json:"modulePath,omitempty"`
Name string `json:"name,omitempty"`
Synopsis string `json:"synopsis,omitempty"`
Version string `json:"version,omitempty"`
Goos string `json:"goos,omitempty"`
Goarch string `json:"goarch,omitempty"`
IsLatest bool `json:"isLatest"`
IsRedistributable bool `json:"isRedistributable"`
IsStandardLibrary bool `json:"isStandardLibrary"`
}
PackageInfo is the metadata-only projection returned by `package info`. Building it from an allow-list (rather than nilling heavy fields on pkggodev.Package) keeps the payload compact and fails safe: a new field on the client struct is never leaked unless it is explicitly added here.
type UsageError ¶ added in v0.1.1
type UsageError struct {
// contains filtered or unexported fields
}
UsageError marks an invalid-argument error (e.g. a non-positive --limit) so the CLI can map it to exit code 2 — a usage error, consistent with Cobra's handling of missing/invalid flags. The MCP server surfaces it like any other tool error.
func (*UsageError) Error ¶ added in v0.1.1
func (e *UsageError) Error() string