Documentation
¶
Overview ¶
Package scaffold detects project type and generates cidx.toml configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatDiff ¶
func FormatDiff(diff *DiffResult) string
FormatDiff returns a human-readable representation of the diff.
func GenerateTOML ¶
GenerateTOML produces a cidx.toml from detection results.
For single-language detections the generated config mirrors that language's recommended containers. For multi-language detections (fullstack monorepos: Python backend + Node frontend, etc.) containers are aggregated across all detected languages with order-preserving dedup, so a project gets the linters, scanners, and test runners of every stack it actually uses.
func UpdateTOML ¶
func UpdateTOML(raw string, diff *DiffResult) string
UpdateTOML applies additive changes from a DiffResult to raw TOML content. It preserves all existing content, comments, and formatting. Only containers arrays in matching phases are extended, and new phases are appended.
Types ¶
type Detection ¶
type Detection struct {
Languages []Language
HasGit bool
Remote string // "github" or "gitlab" or ""
}
Detection holds the results of project analysis.
func Detect ¶
Detect analyzes dir (and its immediate subdirectories, for monorepo layouts) to determine the project type(s). Languages from subdirs are aggregated and deduplicated by name — a project with backend/requirements.txt and frontend/package.json produces one Python entry plus one Node.js entry.
type DiffResult ¶
type DiffResult struct {
Changes []PhaseChange
NewPhases []PhaseChange // entirely new phases (not in existing config)
}
DiffResult holds the comparison between fresh detection and existing config.
func Compare ¶
func Compare(detection *Detection, existingPhases map[string][]string) *DiffResult
Compare computes the additive diff between a fresh detection and existing config phases. existingPhases maps phase name to its current container list.
func (*DiffResult) HasChanges ¶
func (d *DiffResult) HasChanges() bool
HasChanges returns true if the diff contains any additions.
func (*DiffResult) TotalAdded ¶
func (d *DiffResult) TotalAdded() int
TotalAdded returns the total number of new containers across all phases.
type Language ¶
type Language struct {
Name string
Marker string // file (or subdir/file) that triggered detection
Security []string
Code []string
Test []string
Build []string
}
Language represents a detected project language/ecosystem.
type PhaseChange ¶
type PhaseChange struct {
Phase string
Added []string // containers found by detection but missing from config
Existing []string // containers already in config for this phase
}
PhaseChange describes additions to a single phase.