audit

package
v0.9.6 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: 14 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 audit answers one question about a registered repository without indexing it: is it structured so that a pass can produce a graph of it, and when it is not, what has to change.

Every check asks the code the pass itself asks -- the same discovery, the same package registry, the same source resolution, the same `go list`, the same `cargo metadata`. A check that reimplemented any of them would answer for a pass nobody runs, which is worse than not answering: it would clear a repository the pass then drops.

Nothing here writes. A remedy is a proposal, spelled out precisely enough for a reader -- or an agent -- to apply it, and Kivgraph does not write inside the code it indexes.

Index

Constants

View Source
const (
	CodeTypeScriptNoPackage        = "TS_NO_PACKAGE"
	CodeTypeScriptNoProject        = "TS_NO_PROJECT"
	CodeTypeScriptProjectClaimsNo  = "TS_PROJECT_CLAIMS_NOTHING"
	CodeTypeScriptDuplicateName    = "TS_DUPLICATE_PACKAGE_NAME"
	CodeTypeScriptUnclaimedSources = "TS_UNCLAIMED_SOURCES"
	CodeGoNoModule                 = "GO_NO_MODULE"
	CodeGoBuildConstraints         = "GO_BUILD_CONSTRAINTS_EXCLUDE_PACKAGE"
	CodeGoPackageError             = "GO_PACKAGE_ERROR"
	CodeRustNoManifest             = "RUST_NO_MANIFEST"
	CodeRustMetadataFailed         = "RUST_METADATA_FAILED"
)

Finding codes. Stable: a caller may branch on them.

Variables

This section is empty.

Functions

This section is empty.

Types

type Finding

type Finding struct {
	Repository string   `json:"repository"`
	Language   string   `json:"language"`
	Code       string   `json:"code"`
	Severity   Severity `json:"severity"`
	// Detail is what was observed, with the paths that were read.
	Detail string `json:"detail"`
	Remedy Remedy `json:"remedy"`
}

Finding is one observed reason a repository does not produce the graph its registration promises.

type Options

type Options struct {
	// GoBuildTags, GoAllowNetwork and the Rust fields mirror the keys of the
	// same name. A repository excluded by a tag the configuration does grant
	// is not a finding.
	GoBuildTags             []string
	GoAllowNetwork          bool
	RustAllowNetwork        bool
	RustTargetDirectory     string
	IncludeUnclaimedSources bool
	// Repository, when set, restricts the audit to that registry name.
	Repository string
}

Options carries the configuration the checks have to honour: auditing under settings other than the ones a pass would use answers for a pass nobody runs.

func OptionsFromConfig

func OptionsFromConfig(configuration config.Config) Options

OptionsFromConfig reads the settings a pass would run under.

type Remedy

type Remedy struct {
	// Summary is one imperative line.
	Summary string `json:"summary"`
	// Path is the repository-relative file a remedy creates or edits.
	Path string `json:"path,omitempty"`
	// Content is the exact text to write at Path.
	Content string `json:"content,omitempty"`
	// ConfigKey and ConfigValue name a Kivgraph configuration change.
	ConfigKey   string `json:"config_key,omitempty"`
	ConfigValue string `json:"config_value,omitempty"`
	// Command runs inside the repository.
	Command string `json:"command,omitempty"`
}

Remedy is what to do about a finding. Every field is optional except Summary; a caller applies what it understands and prints the rest.

type Report

type Report struct {
	Repositories int       `json:"repositories"`
	Findings     []Finding `json:"findings"`
}

Report is the audit of every repository that was asked about.

func Run

func Run(ctx context.Context, repositories []workspace.Repository, options Options) (Report, error)

Run audits every repository, in registry order.

A repository whose toolchain cannot be reached produces a finding rather than an error: an audit that stops at the first unreadable repository says nothing about the other fifty.

func (Report) Blocking

func (report Report) Blocking() int

Blocking counts the findings that leave a repository or package out of the graph entirely.

type Severity

type Severity string

Severity says what a finding costs the graph.

const (
	// SeverityBlocking means the repository, or a package of it,
	// contributes nothing at all: there is no program to read it.
	SeverityBlocking Severity = "blocking"
	// SeverityPartial means the repository is indexed and part of it is
	// invisible.
	SeverityPartial Severity = "partial"
)

Jump to

Keyboard shortcuts

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