tools

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package tools provides the tailkitd tool registry. It reads tool registration files from /etc/tailkitd/tools/ on every GET /tools request so that installs and upgrades are reflected immediately without a tailkitd restart.

Index

Constants

View Source
const DefaultToolsDir = "/etc/tailkitd/tools"

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry reads tool registration files and serves the GET /tools endpoint. It reads from disk on every request so installs and upgrades are live.

func NewRegistry

func NewRegistry(dir string, logger *zap.Logger) *Registry

NewRegistry constructs a Registry that reads from the given directory. Pass defaultToolsDir ("/etc/tailkitd/tools") in production.

func (*Registry) Handler

func (r *Registry) Handler() http.HandlerFunc

Handler returns an http.HandlerFunc for GET /tools. It lists all registered tools and responds with JSON.

func (*Registry) HasTool

func (r *Registry) HasTool(ctx context.Context, name, minVersion string) (bool, error)

HasTool reports whether a tool with the given name (and at least the given minimum version) is registered. An empty minVersion matches any version.

func (*Registry) List

func (r *Registry) List(ctx context.Context) ([]types.Tool, error)

List reads all *.json files in the tools directory and returns the parsed tools. Malformed files are logged as warnings and skipped — one bad file must not prevent other tools from being listed.

Jump to

Keyboard shortcuts

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