Documentation
¶
Overview ¶
Package envdetect performs pure-static detection of the commands a repository's own tooling declares (or conventionally implies) for install/build/test/lint. It is Phase 0 of ADR 0002 (docs/adr/0002-environment-detect-and-verify.md): a peer of internal/compare / internal/analyze / internal/callgraph, importing only the public API of internal/freshness. It never executes a command — every Command produced here is inert data (an argv slice) for a caller (or a future, separately-gated Phase 1) to decide what, if anything, to run.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
Kind CommandKind `json:"kind"`
Argv []string `json:"argv"`
Source CommandSource `json:"source"`
WorkDir string `json:"workDir"` // relative to repo root
}
Command is inert data describing one candidate command as an argv slice. This package never executes it — no os/exec import anywhere here.
type CommandKind ¶
type CommandKind string
CommandKind classifies a candidate command by lifecycle phase.
const ( KindInstall CommandKind = "install" KindBuild CommandKind = "build" KindTest CommandKind = "test" KindLint CommandKind = "lint" )
Command lifecycle kinds.
type CommandSource ¶
type CommandSource string
CommandSource records how a command was derived, so callers can weight ground-truth (manifest-declared) over convention (guessed defaults).
const ( SourceManifest CommandSource = "manifest" // read directly from the repo's own manifest (npm "scripts", Makefile targets, poetry scripts) SourceConvention CommandSource = "convention" // a guessed default for the ecosystem (e.g. `go build ./...`) )
Command derivation sources.
type Environment ¶
type Environment struct {
Toolchains []Toolchain `json:"toolchains"`
Polyglot bool `json:"polyglot"`
}
Environment is the whole-repo detection result: one Toolchain per layer.
type Toolchain ¶
type Toolchain struct {
Language string `json:"language"`
RuntimeVersion string `json:"runtimeVersion,omitempty"`
Manager string `json:"manager"` // "npm" | "yarn" | "pnpm" | "cargo" | "go" | "pip" | "poetry" | "make"
ManifestPath string `json:"manifestPath"`
WorkDir string `json:"workDir"`
Commands []Command `json:"commands"`
}
Toolchain is the detected environment for one language layer of the repo.