pluginfetch

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package pluginfetch implements the knot plugin's fetcher: the source of truth for knot:// scheme sources served to the scriptling CLI. The embedded knot.* libraries come from the binary; user and global libraries and scripts come from the knot server API on demand.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Name  string
	IsDir bool
}

Entry mirrors plugin.FetchEntry without importing the scriptling module here (the command wires them together).

type Fetcher

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

Fetcher serves knot:// sources for the scriptling plugin protocol.

The layout is the standard one: modules under lib/, scripts as bare knot://name sources. Under lib/ sit two populations side by side:

lib/knot/<module>.py  — the embedded knot.* API libraries (the embedded
                        copy of apiclient.py is swapped for the
                        plugin-transport variant, so API calls route
                        through this plugin instead of direct HTTP)
lib/<name>.py          — the user's own and global library scripts,
                        fetched from the server on demand

func NewFetcher

func NewFetcher(client *apiclient.ApiClient) *Fetcher

NewFetcher creates a fetcher backed by the given API client.

func (*Fetcher) Read

func (f *Fetcher) Read(ctx context.Context, source, path string) ([]byte, error)

Read implements plugin.Fetcher. An empty path means the source itself is a single script file: knot://myscript fetches the script of that name.

func (*Fetcher) Tree

func (f *Fetcher) Tree(ctx context.Context) ([]Entry, error)

Tree enumerates the served tree with full slash paths, directories included: lib/, lib/knot/ with the embedded modules, and lib/<name>.py for the user's and global library scripts. The command filters it against fetch glob patterns, so one enumeration answers existence probes, listings and subtree matches alike.

Jump to

Keyboard shortcuts

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