kbimport

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package kbimport converts existing markdown runbooks/postmortems into OKF-compatible catalog entries — the cold-start answer: deterministic frontmatter inference (Infer), dedup against the live catalog (Plan), and an optional LLM refinement (Enrich). It is pure (no I/O, no clock); the command layer in internal/app does the walking, validating, and writing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Result
	Skip   bool
	Reason string // set when Skip
}

Action is Plan's verdict on one inferred result.

func Plan

func Plan(results []Result, existing []catalog.Entry) []Action

Plan dedups inferred results against the existing catalog and against each other, preserving input order (first occurrence wins). It only decides — the caller reports/writes. Skip reasons are checked in order: retired-at-source, destination already an existing entry, fuzzy title duplicate of an existing entry, batch path collision, then fuzzy title duplicate of an entry already accepted earlier in this same batch.

type Result

type Result struct {
	Entry    providers.KBEntry // reuses the curator/forge entry struct — no parallel format
	Meta     okf.Meta          // preserved source timestamp/status/last_validated
	DestPath string            // bundle-relative destination, e.g. playbooks/redis-failover.md
	Source   string            // source path, for reporting
	Warnings []string
}

Result is one source document converted to an importable entry.

func Enrich

Enrich optionally refines a Result's frontmatter with the configured model. It NEVER gates (mirrors kbvalidate.ReviewSemantic): nil model, a model error, a missing tool call, or unusable output all return r unchanged apart from a warning — the deterministic Infer output is always a valid fallback. The model cannot set resource (passthrough-only), the title is re-capped to the merge gate's budget, and DestPath follows the refined type+title.

func Infer

func Infer(data []byte, source string) Result

Infer derives normalized OKF frontmatter for one markdown document, purely from its existing frontmatter, headings, and content. Deterministic by construction — same input, same entry — so imports are reviewable diffs, not model output. It never fabricates: resource is passthrough-only, and a document is an Incident only when it already carries the OKF evidence sections the merge gate demands.

Jump to

Keyboard shortcuts

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