godoc

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package godoc implements the godoc tool: query the local Go documentation for a package or symbol via `go doc -short`. Acts as a stdlib/module API oracle so small models don't hallucinate function names. Session 5e20f3f8 burned a build cycle on a phantom `transform.TrimSpace` — querying `godoc golang.org/x/text/transform` first would have shown the real surface (`Append`, `Bytes`, `String`, ...).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cwd string) tools.Tool

New returns a godoc tool rooted at cwd. cwd must be inside (or above) a Go module for module-relative lookups to work; stdlib lookups work regardless.

Types

type Tool

type Tool struct {
	// contains filtered or unexported fields
}

Tool runs `go doc` against the active Go toolchain. cwd is bee's cwd so module-local imports resolve against the user's project go.mod.

func (*Tool) Run

func (t *Tool) Run(ctx context.Context, input map[string]any) (tools.Result, error)

Run shells out to `go doc`. Combined stdout+stderr returned. Truncated at maxOutputBytes so a `go doc <huge-pkg>` can't blow tiny-profile context.

Hard timeout: 5s. `go doc` is local and fast; a slow run usually means a fetch attempt for a missing module, which we'd rather fail than hang on.

func (*Tool) Spec

func (t *Tool) Spec() llm.ToolSpec

Spec advertises the tool. PromptSnippet is the prompt-manifest one-liner shown to tiny profiles; Description is the full API-spec text shown to hosted models that consume native tool schemas.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL