syncreport

package
v0.167.1 Latest Latest
Warning

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

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

Documentation

Overview

Package syncreport defines the agent-authored, InGitDB-backed sync analysis records that WB validates and publishes to a user's workbench repository.

Index

Constants

View Source
const (
	SchemaVersion       = 1
	CollectionPath      = "sync-reports"
	CollectionID        = "sync_reports"
	CollectionRecords   = CollectionPath + "/$records"
	DefinitionPath      = CollectionPath + "/.collection/definition.yaml"
	SettingsPath        = ".ingitdb/settings.yaml"
	RootCollectionsPath = ".ingitdb/root-collections.yaml"
)
View Source
const DefinitionYAML = `` /* 836-byte string literal not displayed */
View Source
const RootCollectionsYAML = "sync_reports: sync-reports\n"
View Source
const SettingsYAML = "default_record_format: markdown\n"

Variables

This section is empty.

Functions

func Install

func Install(root string, report Report) error

Install writes the owned schema and report records below root.

func MergeRootCollections

func MergeRootCollections(existing []byte) ([]byte, bool, error)

MergeRootCollections registers this collection without replacing other InGitDB collections or comments already owned by the user.

func RecordName

func RecordName(reportID, repository string) string

RecordName is deterministic and collision-free within a report.

func ValidateInGitDB

func ValidateInGitDB(ctx context.Context, report Report) error

ValidateInGitDB builds an isolated database containing the exact records and asks the installed InGitDB CLI to validate both definitions and data.

func ValidatePath

func ValidatePath(ctx context.Context, directory string) error

ValidatePath asks the installed InGitDB CLI to validate an assembled workbench repository. Publication calls this after installing records and before creating a commit.

func ValidateRepository

func ValidateRepository(repository string) error

Types

type Record

type Record struct {
	SchemaVersion   int    `yaml:"schema_version" json:"schema_version"`
	ReportID        string `yaml:"report_id" json:"report_id"`
	Repository      string `yaml:"repository" json:"repository"`
	Finding         string `yaml:"finding" json:"finding"`
	Severity        string `yaml:"severity" json:"severity"`
	State           string `yaml:"state" json:"state"`
	ObservedAt      string `yaml:"observed_at" json:"observed_at"`
	HeadSHA         string `yaml:"head_sha,omitempty" json:"head_sha,omitempty"`
	Title           string `yaml:"title" json:"title"`
	SuggestedAction string `yaml:"suggested_action" json:"suggested_action"`
	Body            string `yaml:"-" json:"body"`
	SourcePath      string `yaml:"-" json:"source_path"`
	Raw             []byte `yaml:"-" json:"-"`
}

Record is one repository's analysis from one sync run. The Markdown body is deliberately separate from the queryable frontmatter fields.

func Parse

func Parse(raw []byte) (Record, error)

Parse decodes strict YAML frontmatter and preserves the Markdown body.

func (Record) Validate

func (r Record) Validate() error

Validate enforces WB's stable subset in addition to InGitDB schema checks.

type Report

type Report struct {
	ID      string   `json:"report_id"`
	Records []Record `json:"records"`
}

Report is a set of per-repository records from exactly one sync run.

func LoadDirectory

func LoadDirectory(directory string) (Report, error)

LoadDirectory reads every top-level .md record in directory. Symlinks, nested directories, duplicate repositories, and mixed report IDs are refused so an agent cannot smuggle unrelated paths into publication.

Jump to

Keyboard shortcuts

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