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
- func ApplyAdapter(ctx *Context, r *AdapterResult)
- func CarryAdapterOutput(ctx *Context, path string)
- func DefaultAdapterName(command string) string
- func FilterFiles(files, globs []string) []string
- func ListFiles(root string) []string
- func MergeIntoGraph(g *graph.SymGraph, r *AdapterResult) (dropped int)
- type API
- type AdapterOptions
- type AdapterResult
- type Concept
- type ConceptLink
- type Context
- type Doc
- type ModuleOwners
- type Operation
- type Options
- type OwnerRule
- type Owners
- type Table
Constants ¶
const ConfInferred = "INFERRED"
ConfInferred tags everything an adapter produces. Stacklit cannot verify it.
const ContextFile = "stacklit.context.json"
ContextFile is the sidecar written next to stacklit.json.
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 ¶
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 ¶
DefaultAdapterName derives a source label from a shell command.
func FilterFiles ¶
FilterFiles keeps files matching any glob (against the path or the base name). An empty glob list keeps everything.
func ListFiles ¶
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 ¶
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.
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 Owners ¶
type Owners struct {
Rules []OwnerRule `json:"rules,omitempty"`
Modules []ModuleOwners `json:"modules,omitempty"`
}
Owners is the ownership layer.