ingest

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 20 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ingest adds non-code context (docs, API specs, SQL schemas and ownership) to a sidecar file, stacklit.context.json. It is optional and never alters stacklit.json.

Index

Constants

View Source
const ConfInferred = "INFERRED"

ConfInferred tags everything an adapter produces. Stacklit cannot verify it.

View Source
const ContextFile = "stacklit.context.json"

ContextFile is the sidecar written next to stacklit.json.

View Source
const KindConcept = "concept"

KindConcept is the symbol graph node kind for adapter concepts.

Variables

This section is empty.

Functions

func ApplyAdapter

func ApplyAdapter(ctx *Context, r *AdapterResult)

ApplyAdapter replaces everything previously produced by the same adapter name in ctx, so reruns do not pile up duplicates.

func CarryAdapterOutput

func CarryAdapterOutput(ctx *Context, path string)

CarryAdapterOutput copies adapter concepts and links from an existing sidecar into ctx, so a rerun of the built-in connectors does not erase them.

func DefaultAdapterName

func DefaultAdapterName(command string) string

DefaultAdapterName derives a source label from a shell command.

func FilterFiles

func FilterFiles(files, globs []string) []string

FilterFiles keeps files matching any glob (against the path or the base name). An empty glob list keeps everything.

func ListFiles

func ListFiles(root string) []string

ListFiles returns every candidate file under root (slash paths), skipping build output and hidden folders, so an adapter can pick non-code inputs.

func MergeIntoGraph

func MergeIntoGraph(g *graph.SymGraph, r *AdapterResult) (dropped int)

MergeIntoGraph adds adapter concepts and links to g as INFERRED nodes and edges. Existing nodes from the same adapter are replaced. It returns how many links were dropped because an endpoint did not resolve.

Types

type API

type API struct {
	File       string      `json:"file"`
	Title      string      `json:"title,omitempty"`
	Operations []Operation `json:"operations"`
}

API summarises one OpenAPI/Swagger file.

type AdapterOptions

type AdapterOptions struct {
	Root     string
	Command  string   // run through the platform shell
	Name     string   // value for the source field; defaults to the command's program name
	Files    []string // slash paths relative to Root, sent to the command on stdin
	Timeout  time.Duration
	MaxBytes int64
	MaxItems int
}

AdapterOptions configures one adapter run.

type AdapterResult

type AdapterResult struct {
	Name     string
	Concepts []Concept
	Links    []ConceptLink
	Skipped  int // lines that were malformed, unknown or over the item cap
}

AdapterResult is what an adapter returned after validation.

func RunAdapter

func RunAdapter(parent context.Context, o AdapterOptions) (*AdapterResult, error)

RunAdapter feeds file paths to the command on stdin and reads JSONL back. Stacklit itself makes no network or model calls; the command is the user's.

type Concept

type Concept struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Kind       string `json:"kind,omitempty"`
	Summary    string `json:"summary,omitempty"`
	SourceFile string `json:"source_file"`
	Conf       string `json:"confidence"`
	Source     string `json:"source"`
}

Concept is a node an adapter reported: an idea, entity or topic found in a file stacklit does not parse itself (PDF, image, audio, spreadsheet...).

type ConceptLink struct {
	From       string `json:"from"`
	To         string `json:"to"`
	Kind       string `json:"kind,omitempty"`
	SourceFile string `json:"source_file,omitempty"`
	Conf       string `json:"confidence"`
	Source     string `json:"source"`
}

ConceptLink is an edge an adapter reported. From and To name a concept id, a file path, or a symbol id from the graph.

type Context

type Context struct {
	Version string  `json:"version"`
	Docs    []Doc   `json:"docs,omitempty"`
	APIs    []API   `json:"apis,omitempty"`
	Tables  []Table `json:"tables,omitempty"`
	Owners  *Owners `json:"owners,omitempty"`

	// Concepts and Links come from external adapters (see adapter.go). They are
	// always INFERRED and carry the adapter name in Source.
	Concepts []Concept     `json:"concepts,omitempty"`
	Links    []ConceptLink `json:"concept_links,omitempty"`
}

Context is the sidecar payload.

func Run

func Run(o Options) (*Context, error)

Run executes the selected connectors.

type Doc

type Doc struct {
	Path     string   `json:"path"`
	Kind     string   `json:"kind"`
	Title    string   `json:"title,omitempty"`
	Status   string   `json:"status,omitempty"`
	Headings []string `json:"headings,omitempty"`
}

Doc is one markdown document worth pointing an agent at.

type ModuleOwners

type ModuleOwners struct {
	Module    string   `json:"module"`
	Codeowner []string `json:"codeowners,omitempty"`
	Authors   []string `json:"top_authors,omitempty"`
}

ModuleOwners maps a module to owners from CODEOWNERS and/or recent authors.

type Operation

type Operation struct {
	Method  string `json:"method"`
	Path    string `json:"path"`
	ID      string `json:"id,omitempty"`
	Summary string `json:"summary,omitempty"`
}

Operation is one HTTP operation from an OpenAPI document.

type Options

type Options struct {
	Root      string
	Docs      bool
	API       bool
	Schema    bool
	Owners    bool
	GitOwners bool
	GitDays   int
	Modules   []string // module paths from stacklit.json, for ownership mapping
}

Options selects which connectors run.

type OwnerRule

type OwnerRule struct {
	Pattern string   `json:"pattern"`
	Owners  []string `json:"owners"`
}

OwnerRule is one CODEOWNERS line.

type Owners

type Owners struct {
	Rules   []OwnerRule    `json:"rules,omitempty"`
	Modules []ModuleOwners `json:"modules,omitempty"`
}

Owners is the ownership layer.

type Table

type Table struct {
	Name    string   `json:"name"`
	File    string   `json:"file"`
	Columns []string `json:"columns"`
}

Table is a table or model discovered in SQL or Prisma files.

Jump to

Keyboard shortcuts

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