Documentation
¶
Overview ¶
Package project detects what a repository is written in and how it is checked, so that a plan naming another ecosystem's tooling can be refused in code rather than found in review.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompareVersions ¶ added in v1.5.1
CompareVersions compares two versions in the version form as three integers: -1 when a is older than b, 0 when they are equal, 1 when a is newer. A part that is not a number counts as 0.
func IsVersion ¶ added in v1.5.1
IsVersion reports whether s is in the version form, MAJOR.MINOR.PATCH.
func Steering ¶
Steering reads <specsDir>/steering.md, the project-level directives to every agent working on the repository, and returns its body: the file after its frontmatter, or the whole file when it has none. A file that is missing, a symlink, or whose body is empty, over the size bound, or only the placeholder or the bare heading is nothing, and the result is "".
Types ¶
type Amendment ¶ added in v1.5.1
type Amendment struct {
Version string `yaml:"version"`
Date string `yaml:"date"`
Change string `yaml:"change"`
}
Amendment is one entry of the steering's record of its amendments: the version it brought the file to, the day it was made, and what changed.
type Profile ¶
type Profile struct {
// Language is the ecosystem, or "" when it could not be determined.
Language string
// AllTests and Linter are the project's real commands.
AllTests string
Linter string
// Manifest is the file the detection was made from, for the message.
Manifest string
// StubMarker is the language's spelling of "not implemented", which the
// integration task is meant to search for.
StubMarker string // Also are the other ecosystems whose manifests are present beside the
// primary one (a package.json frontend in a Go repository).
Also []string
}
Profile is what this repository is written in and how it is checked.
It exists to make the skill's "post-generation language audit" a mechanism instead of a chore. The skill asks a human to read tasks.json afterwards and check that test_commands names the project's real runner, because a model asked to plan work in a repository it did not look at will reach for whichever ecosystem its training favours and write `pytest` into a Go project. Detecting the answer in Go and refusing a mismatched submission turns that from a review item into a repair the model performs before the file is ever written.
func DetectProfile ¶
DetectProfile reads the repository and reports what it is written in.
The Makefile is consulted for the commands but never for the language: a project that ships `make check` has answered "how do I check this", and the manifest has answered "what is this written in". Conflating them would make a Go repository with a Makefile look like a project with no language.
func (Profile) AuditTasks ¶
AuditTasks checks a submitted tasks artifact against the detected project.
It refuses exactly one thing: a test command whose program belongs to a different, known ecosystem. That is narrow on purpose. `go test ./...` in a Python project is unambiguously wrong and mechanically detectable; a command this table has never heard of might be `./scripts/ci.sh`, which is legitimate and which a stricter check would reject.
The returned error is read by the model, so it names both what was submitted and what the project actually uses.
func (Profile) LanguageBlock ¶
LanguageBlock is the section of a generation prompt that tells the model what the project is. It is the positive half of the audit above: saying it up front is cheaper than refusing a submission afterwards.
type SteeringFile ¶ added in v1.5.1
SteeringFile is what ReadSteering read. Body is the directives, the file after its frontmatter. Version and Amendments are the frontmatter's, and both are empty unless the file is versioned: its frontmatter is well formed and its body says something. Problems names each well-formedness rule the frontmatter breaks, in the order the rules are checked, one sentence per rule; a file that breaks any is unversioned, and its body is used all the same.
func ReadSteering ¶ added in v1.5.1
func ReadSteering(specsDir string) SteeringFile
ReadSteering reads <specsDir>/steering.md: its body, and its version and amendment record when it opens with frontmatter (ADR 15). A file whose first line is exactly three hyphens opens a frontmatter block, which ends at the next line of three hyphens. The checks for a file with nothing to say are made on the body alone, and such a file is nothing — no body, no version, no problem — whatever its frontmatter holds.
func (SteeringFile) Malformed ¶ added in v1.5.1
func (f SteeringFile) Malformed(specsDir string) string
Malformed is the message of the steering_malformed warning for the file in specsDir: every rule its frontmatter breaks, and what follows from it. It is "" when the frontmatter breaks none.
func (SteeringFile) Versioned ¶ added in v1.5.1
func (f SteeringFile) Versioned() bool
Versioned reports whether the file has a version a package can record.