Documentation
¶
Overview ¶
Package brief detects a software project's toolchain, configuration, and conventions, then outputs a structured report.
Index ¶
- Variables
- type Command
- type Confidence
- type DepInfo
- type Detection
- type EnrichmentInfo
- type GitInfo
- type LayoutInfo
- type LineCount
- type MissingCategory
- type MissingReport
- type PlatformInfo
- type PublishedPackage
- type RepoEnrichment
- type Report
- type ResourceInfo
- type RuntimeEOL
- type Scope
- type Script
- type SinkEntry
- type SinkReport
- type Skill
- type Source
- type StackEntry
- type Stats
- type StyleInfo
- type Taxonomy
- type TemplateInfo
- type Threat
- type ThreatReport
Constants ¶
This section is empty.
Variables ¶
var KnowledgeFS embed.FS
var Version = "dev"
Version is set at build time via ldflags.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
Run string `json:"run"`
Alternatives []string `json:"alternatives,omitempty"`
Source Source `json:"source"`
InferredTool string `json:"inferred_tool,omitempty"`
}
Command is a runnable command with provenance.
type Confidence ¶
type Confidence string
Confidence indicates how reliable a detection signal is.
const ( ConfidenceHigh Confidence = "high" ConfidenceMedium Confidence = "medium" ConfidenceLow Confidence = "low" )
type DepInfo ¶ added in v0.2.0
type DepInfo struct {
Name string `json:"name"`
Version string `json:"version,omitempty"`
PURL string `json:"purl"`
Scope string `json:"scope,omitempty"` // "runtime", "development", "test", "build"
Direct bool `json:"direct"`
}
DepInfo is a parsed dependency from a manifest file.
type Detection ¶
type Detection struct {
Name string `json:"name"`
Category string `json:"category"`
Confidence Confidence `json:"confidence"`
Command *Command `json:"command,omitempty"`
ConfigFiles []string `json:"config_files,omitempty"`
Lockfile string `json:"lockfile,omitempty"`
Homepage string `json:"homepage,omitempty"`
Docs string `json:"docs,omitempty"`
Repo string `json:"repo,omitempty"`
Description string `json:"description,omitempty"`
Taxonomy *Taxonomy `json:"taxonomy,omitempty"`
}
Detection is a single detected tool or feature.
type EnrichmentInfo ¶ added in v0.2.0
type EnrichmentInfo struct {
Repo *RepoEnrichment `json:"repo,omitempty"`
Packages []PublishedPackage `json:"packages,omitempty"`
RuntimeEOL map[string]*RuntimeEOL `json:"runtime_eol,omitempty"`
}
EnrichmentInfo holds metadata fetched from external sources about the project itself.
type GitInfo ¶
type GitInfo struct {
Branch string `json:"branch,omitempty"`
DefaultBranch string `json:"default_branch,omitempty"`
Remotes map[string]string `json:"remotes,omitempty"` // name -> URL
CommitCount int `json:"commit_count,omitempty"`
}
GitInfo describes the git repository state.
type LayoutInfo ¶
type LayoutInfo struct {
SourceDirs []string `json:"source_dirs,omitempty"` // e.g. ["src/", "lib/", "app/"]
TestDirs []string `json:"test_dirs,omitempty"` // e.g. ["spec/", "test/"]
MirrorsSource bool `json:"mirrors_source,omitempty"`
}
LayoutInfo describes the project's file layout conventions.
type LineCount ¶
type LineCount struct {
TotalFiles int `json:"total_files"`
TotalLines int `json:"total_lines"`
ByLanguage map[string]int `json:"by_language,omitempty"`
Source string `json:"source"` // "scc", "tokei", or "fallback"
}
LineCount holds line count information.
type MissingCategory ¶ added in v0.4.0
type MissingCategory struct {
Category string `json:"category"`
Label string `json:"label"`
Ecosystem string `json:"ecosystem"`
Suggested string `json:"suggested"`
SuggestedCmd string `json:"suggested_cmd,omitempty"`
Description string `json:"description,omitempty"`
Docs string `json:"docs,omitempty"`
}
MissingCategory describes a tool category that has no detected tools despite the ecosystem having known tools for it.
type MissingReport ¶ added in v0.4.0
type MissingReport struct {
Version string `json:"version"`
Path string `json:"path"`
Ecosystems []string `json:"ecosystems"`
Missing []MissingCategory `json:"missing"`
}
MissingReport is the output of a brief missing analysis.
type PlatformInfo ¶
type PlatformInfo struct {
RuntimeVersionFiles map[string]string `json:"runtime_version_files,omitempty"`
CIMatrixVersions map[string][]string `json:"ci_matrix_versions,omitempty"`
CIMatrixOS []string `json:"ci_matrix_os,omitempty"`
}
PlatformInfo describes detected platforms and runtime versions.
type PublishedPackage ¶ added in v0.2.0
type PublishedPackage struct {
Name string `json:"name"`
Ecosystem string `json:"ecosystem"`
PURL string `json:"purl"`
LatestVersion string `json:"latest_version,omitempty"`
License string `json:"license,omitempty"`
Description string `json:"description,omitempty"`
Downloads int `json:"downloads,omitempty"`
DownloadsPeriod string `json:"downloads_period,omitempty"`
DependentPackagesCount int `json:"dependent_packages_count,omitempty"`
DependentReposCount int `json:"dependent_repos_count,omitempty"`
RegistryURL string `json:"registry_url,omitempty"`
}
PublishedPackage describes a package this repo publishes to a registry.
type RepoEnrichment ¶ added in v0.2.0
type RepoEnrichment struct {
Scorecard float64 `json:"scorecard,omitempty"`
ScorecardDate string `json:"scorecard_date,omitempty"`
}
RepoEnrichment holds metadata about the project's own repository.
type Report ¶
type Report struct {
Version string `json:"version"`
Path string `json:"path"`
DiffRef string `json:"diff_ref,omitempty"`
DiffCommits []string `json:"diff_commits,omitempty"`
ChangedFiles []string `json:"changed_files,omitempty"`
Languages []Detection `json:"languages"`
PackageManagers []Detection `json:"package_managers"`
Scripts []Script `json:"scripts,omitempty"`
Tools map[string][]Detection `json:"tools"`
Style *StyleInfo `json:"style,omitempty"`
Layout *LayoutInfo `json:"layout,omitempty"`
Platforms *PlatformInfo `json:"platforms,omitempty"`
Resources *ResourceInfo `json:"resources,omitempty"`
Skills []Skill `json:"skills,omitempty"`
Git *GitInfo `json:"git,omitempty"`
Lines *LineCount `json:"lines,omitempty"`
Dependencies []DepInfo `json:"dependencies,omitempty"`
Enrichment *EnrichmentInfo `json:"enrichment,omitempty"`
Stats Stats `json:"stats"`
}
Report is the complete output of a brief analysis.
type ResourceInfo ¶
type ResourceInfo struct {
Readme string `json:"readme,omitempty"`
Changelog string `json:"changelog,omitempty"`
Roadmap string `json:"roadmap,omitempty"`
License string `json:"license,omitempty"`
LicenseType string `json:"license_type,omitempty"`
Legal map[string]string `json:"legal,omitempty"`
Community map[string]string `json:"community,omitempty"`
Security map[string]string `json:"security,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Agents map[string]string `json:"agents,omitempty"`
Templates *TemplateInfo `json:"templates,omitempty"`
}
ResourceInfo describes project resource files. Paths are relative to the repository root.
func (*ResourceInfo) Empty ¶ added in v0.6.0
func (r *ResourceInfo) Empty() bool
Empty reports whether no resources were found.
type RuntimeEOL ¶ added in v0.2.0
type RuntimeEOL struct {
EOL string `json:"eol,omitempty"` // date string or "true"/"false"
Supported bool `json:"supported"`
LTS bool `json:"lts,omitempty"`
Latest string `json:"latest,omitempty"` // latest patch version
}
RuntimeEOL holds end-of-life status for a runtime version.
type Script ¶
type Script struct {
Name string `json:"name"`
Run string `json:"run"`
Source string `json:"source"` // e.g. "Makefile", "package.json"
}
Script is a project-defined task (Makefile target, package.json script, etc.).
type SinkEntry ¶ added in v0.5.0
type SinkEntry struct {
Symbol string `json:"symbol"`
Tool string `json:"tool"`
Threat string `json:"threat"`
CWE string `json:"cwe,omitempty"`
Note string `json:"note,omitempty"`
}
SinkEntry is a known dangerous function in a detected tool.
type SinkReport ¶ added in v0.5.0
type SinkReport struct {
Version string `json:"version"`
Path string `json:"path"`
Sinks []SinkEntry `json:"sinks"`
}
SinkReport is the output of brief sinks.
type Skill ¶ added in v0.8.0
type Skill struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Path string `json:"path"`
Format string `json:"format"`
}
Skill is an agent skill the project provides: packaged instructions an AI coding agent can load on demand. Path is relative to the repository root.
type StackEntry ¶ added in v0.5.0
StackEntry is a detected tool that contributed to the threat model.
type Stats ¶
type Stats struct {
Duration time.Duration `json:"-"`
DurationMS float64 `json:"duration_ms"`
FilesChecked int `json:"files_checked"`
ToolsMatched int `json:"tools_matched"`
ToolsChecked int `json:"tools_checked"`
}
Stats holds performance and coverage metrics from the detection run.
type StyleInfo ¶
type StyleInfo struct {
Indentation string `json:"indentation,omitempty"` // e.g. "2-space", "4-space", "tabs"
IndentSource string `json:"indent_source,omitempty"` // e.g. "editorconfig", "inferred"
LineEnding string `json:"line_ending,omitempty"` // "LF" or "CRLF"
TrailingNewline *bool `json:"trailing_newline,omitempty"`
}
StyleInfo describes detected coding style conventions.
type Taxonomy ¶ added in v0.5.0
type Taxonomy struct {
Role []string `json:"role,omitempty"`
Function []string `json:"function,omitempty"`
Layer []string `json:"layer,omitempty"`
Domain []string `json:"domain,omitempty"`
Audience []string `json:"audience,omitempty"`
Technology []string `json:"technology,omitempty"`
}
Taxonomy holds oss-taxonomy facet classifications carried through from the tool definition. Values are kebab-case term IDs.
type TemplateInfo ¶ added in v0.8.0
type TemplateInfo struct {
Issue []string `json:"issue,omitempty"`
PullRequest []string `json:"pull_request,omitempty"`
Config string `json:"config,omitempty"`
}
TemplateInfo lists issue and pull request templates the project provides so that contributors (and agents) can follow them. Paths are relative to the repository root. PullRequest also covers GitLab merge request templates.
func (*TemplateInfo) Empty ¶ added in v0.8.0
func (t *TemplateInfo) Empty() bool
Empty reports whether no templates were found.
type Threat ¶ added in v0.5.0
type Threat struct {
ID string `json:"id"`
CWE string `json:"cwe,omitempty"`
OWASP string `json:"owasp,omitempty"`
Title string `json:"title"`
IntroducedBy []string `json:"introduced_by"`
Note string `json:"note,omitempty"`
}
Threat is a threat category that applies to the project's stack.
type ThreatReport ¶ added in v0.5.0
type ThreatReport struct {
Version string `json:"version"`
Path string `json:"path"`
Ecosystems []string `json:"ecosystems"`
Stack []StackEntry `json:"stack"`
Threats []Threat `json:"threats"`
}
ThreatReport is the output of brief threat-model.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
brief
command
|
|
|
Package detect implements the project detection engine.
|
Package detect implements the project detection engine. |
|
Package kb loads and queries the embedded TOML knowledge base.
|
Package kb loads and queries the embedded TOML knowledge base. |
|
Package remote resolves remote sources (git URLs, registry packages) to local directories for scanning.
|
Package remote resolves remote sources (git URLs, registry packages) to local directories for scanning. |
|
Package report formats brief detection results for output.
|
Package report formats brief detection results for output. |