Documentation
¶
Index ¶
- Constants
- Variables
- func FetchCratesReadme(pkgPath string) (string, error)
- func FetchDocumentation(docSource DocSource, forceUpdate bool) (string, error)
- func FetchGitHubReadme(pkgPath string) (string, error)
- func FetchGitLabReadme(pkgPath string) (string, error)
- func FetchNPMReadme(pkgPath string) (string, error)
- func FetchRubyGemsReadme(pkgPath string) (string, error)
- func GetDocumentationURL(docSource DocSource) (*url.URL, error)
- func GetLanguageAliases() map[string]string
- type DocSource
- type ErrorCode
Constants ¶
const ( // Documentation source types SourceTypeGoPkgDev = "go.pkg.dev" SourceTypeJSR = "jsr.io" SourceTypeNPM = "npmjs.com" SourceTypeCratesIO = "crates.io" SourceTypeRubyGems = "rubygems.org" SourceTypeGitHub = "github.com" SourceTypeGitLab = "gitlab.com" SourceTypeUnknown = "" )
Variables ¶
var ( Version = "0.0.3" VersionCommit = "" )
Version and VersionCommit hold the version information
Functions ¶
func FetchCratesReadme ¶
FetchCratesReadme fetches the README content from crates.io
func FetchDocumentation ¶
FetchDocumentation fetches documentation text for the given package from the specified source
func FetchGitHubReadme ¶
FetchGitHubReadme fetches the README content from a GitHub repository
func FetchGitLabReadme ¶
FetchGitLabReadme fetches the README content from a GitLab repository
func FetchNPMReadme ¶
FetchNPMReadme fetches the README content from npm registry
func FetchRubyGemsReadme ¶
FetchRubyGemsReadme fetches the package information from RubyGems API
func GetDocumentationURL ¶
GetDocumentationURL returns the URL for viewing the package documentation in a browser. For unsupported sources, it returns the GitHub URL as a fallback.
func GetLanguageAliases ¶
GetLanguageAliases returns a map of language aliases to their documentation source types
Types ¶
type DocSource ¶
type DocSource struct {
// Type represents the documentation source type (e.g., "go.pkg.dev", "npm", "jsr")
Type string
// PackagePath represents the processed package path for the documentation source
PackagePath string
}
DocSource represents a documentation source
func DetectDocSource ¶
DetectDocSource attempts to detect the documentation source from a package path If explicitLang is provided, it will be used as an explicit language hint
type ErrorCode ¶
type ErrorCode string
ErrorCode defines error types for API operations
const ( // ErrGHCommandNotFound represents an error when the gh command is not found ErrGHCommandNotFound ErrorCode = "GHCommandNotFound" // ErrGHCommandFailed represents an error when the gh command fails ErrGHCommandFailed ErrorCode = "GHCommandFailed" // ErrREADMENotFound represents an error when README is not found ErrREADMENotFound ErrorCode = "READMENotFound" )
const ( // ErrDocumentationFetch represents errors that occur during documentation fetching ErrDocumentationFetch ErrorCode = "DocumentationFetchError" )
const ( // ErrNPMREADMENotFound represents an error when README is not found ErrNPMREADMENotFound ErrorCode = "NPMREADMENotFound" )
const ( // ErrRubyGemsREADMENotFound represents an error when README is not found ErrRubyGemsREADMENotFound ErrorCode = "RubyGemsREADMENotFound" )