apidoc

package
v0.1.113 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package apidoc renders the framework's public Go API from its sources as the app resolves them (its go.mod, replace directives included), so an agent reads the signatures it can call instead of guessing them. `lidza api` prints it; `lidza mcp` serves it as lidza://api and lidza_api.

Index

Constants

View Source
const Module = "github.com/agim/lidza"

Module is the framework's module path.

Variables

View Source
var Public = []string{"", "pkg/router", "pkg/middleware", "pkg/lidzatest", "pkg/report", "pkg/resilience", "pkg/env", "pkg/decimal", "pkg/webhook"}

Public lists the packages app code imports, relative to the module root ("" is the root package). Every packs/<name> package is public too.

Functions

func AppPackages

func AppPackages(moduleDir string) []string

AppPackages is Public plus the pack packages present at moduleDir.

func Exists

func Exists(moduleDir, importPath string) bool

Exists reports whether importPath names a package of the framework at moduleDir.

func ImportPath

func ImportPath(rel string) string

ImportPath is the import path of a package relative path.

func Listing

func Listing(ctx context.Context, dir string) (string, error)

Listing names the project's packages, then the framework's, one per line with a note on which are the app's and which are framework internals.

func ModuleDir

func ModuleDir(ctx context.Context, dir string) (string, error)

ModuleDir returns the directory holding the framework's sources for the project in dir: dir itself when it is the framework, otherwise what the go tool resolves from the project's go.mod.

func Packages

func Packages(moduleDir string) ([]string, error)

Packages lists every importable package of the module at moduleDir, relative to it, "" for the root. Commands, internal, test data, examples, node_modules and nested modules are left out.

func Rel

func Rel(importPath string) (rel string, ok bool)

Rel turns an import path under the module into its relative path; ok is false for paths outside the module.

func Render

func Render(moduleDir string, rels []string, filter string) (string, error)

Render writes the public API of the framework packages (relative paths; nil means AppPackages) as markdown. filter, when set, keeps only the declarations whose name contains it (case-insensitive).

func Suggest

func Suggest(moduleDir, importPath string) string

Suggest returns the public package whose last element is closest to the one in importPath, or "".

Types

type Source

type Source struct {
	// Dir holds the module's sources.
	Dir string
	// Module is its module path.
	Module string
}

Source is a Go module to render: the framework as the app resolves it, or the app itself.

func App

func App(dir string) (Source, bool)

App returns the project in dir as a source; ok is false without a go.mod.

func Framework

func Framework(ctx context.Context, dir string) (Source, error)

Framework returns the framework as the project in dir resolves it.

func Resolve

func Resolve(ctx context.Context, dir, pkg string) (Source, []string, error)

Resolve picks the source and packages a request names: "" is the framework's app-facing packages, "app" every package of the project, "./rel" or the project's import path one of the project's, and anything else a framework package (import path or path relative to the framework module). The error for an unknown package names both listings.

func (Source) Exists

func (s Source) Exists(p string) bool

Exists reports whether p (an import path or "./rel") names a package of the source.

func (Source) ImportPath

func (s Source) ImportPath(rel string) string

ImportPath is the import path of rel within the source.

func (Source) Index

func (s Source) Index(rels []string, filter string) (string, error)

Index is Render without the doc comments, one line per declaration: the signatures of a package too large to read whole, to pick what to ask for with a filter.

func (Source) Packages

func (s Source) Packages() ([]string, error)

Packages lists the source's packages, including internal packages owned by an application. Framework sources retain their public package boundary.

func (Source) Rel

func (s Source) Rel(p string) (rel string, ok bool)

Rel turns an import path or a "./rel" path into a path relative to the source; ok is false for paths outside it.

func (Source) Render

func (s Source) Render(rels []string, filter string) (string, error)

Render writes the public API of the source's packages as markdown.

Jump to

Keyboard shortcuts

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