facts

package
v0.27.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package facts interprets the declared project.md layers, merges them with the detection probes and the contract's defaults, and attributes every effective value to its origin. It is the one component of f10 allowed to interpret instruction prose - bin/bundle.sh stays a concatenator.

Interpretation is deliberately shallow: only the sub-facts with a fixed vocabulary (Layering, Visibility, Storage, the tracker kind and its id prefix, the remote review's four facts) become structure; everything else is presented as the declared prose, attributed but unparsed. The binary may be incomplete, never wrong - what it cannot place it shows as-is instead of guessing.

It writes that prose too, in scaffold.go: `f10 init` renders detection as a project.md. Reader and writer share a package so the vocabulary one keys on and the words the other emits cannot drift apart.

Index

Constants

View Source
const (
	OriginDetected = "detected"
	OriginDefault  = "default"
	OriginAbsent   = "absent"
)

Origins an effective value can have. Declared origins are qualified by the layer label at build time: "declared (main)", "declared (worktree)".

View Source
const (
	ReviewerBot   = "bot"
	ReviewerHuman = "human"
	ReviewerCheck = "check"

	ArrivesComment = "issue comment"
	ArrivesInline  = "inline review"
	ArrivesCheck   = "check run"

	TriggerAutomatic = "automatic"
	TriggerManual    = "manual"

	DonePosted    = "posted"
	DoneMarker    = "marker"
	DoneSubmitted = "submitted"
	DoneConcluded = "concluded"

	HandledReaction = "reaction"
	HandledMarker   = "marker"
	HandledCheckbox = "checkbox"
	HandledThread   = "thread resolved"
)

The vocabularies, as the words the parser looks for.

View Source
const DefaultDriveChain = "plan → judge → ship → review → resolve → finish"

DefaultDriveChain is the chain `f10 drive` runs each task through when project.md declares none: review after ship reviews the shipment, and resolve settles it before finish merges.

Variables

This section is empty.

Functions

This section is empty.

Types

type Draft

type Draft struct {
	Markdown string
	Sections []string
	Omitted  []string
}

A Draft is one rendered project.md: the markdown, the contract sections it carries, and the ones left out because nothing detected them.

func Scaffold

func Scaffold(lay *layout.Layout, pb *probe.Probes, eff *Effective) *Draft

Scaffold renders a project.md for a checkout that declares none. Pure: the caller owns the filesystem, this owns the contract.

type Effective

type Effective struct {
	Fields       []Field `json:"fields"`
	Unrecognized []Field `json:"unrecognized,omitempty"`

	// The fixed-vocabulary sub-facts v1 extracts.
	Layering        string `json:"layering"`
	Visibility      string `json:"visibility"`
	Storage         string `json:"storage"`
	TrackerKind     string `json:"trackerKind,omitempty"`
	IDPrefix        string `json:"idPrefix,omitempty"`        // "ABC", "F10" - the task id format's letters
	IDPrefixOrigin  string `json:"idPrefixOrigin,omitempty"`  // "declared (<layer>)" or "derived from project name <name>"
	IDPrefixDerived bool   `json:"idPrefixDerived,omitempty"` // the prefix came from the project's name, not a declaration

	// The remote review's four facts (review.go); zero when Review declares
	// no remote reviewer.
	Review Review `json:"review"`
}

Effective is the merged, attributed view of a project's configuration.

func Build

func Build(lay *layout.Layout, pb *probe.Probes) *Effective

Build merges the declared layers with detection and the contract's defaults into one attributed view.

type Field

type Field struct {
	Name   string `json:"name"`
	Value  string `json:"value"`
	Prose  bool   `json:"prose,omitempty"`  // multi-line prose, not a scalar
	Origin string `json:"origin"`           // "detected", "declared (<layer>)", "default", "absent"
	Source string `json:"source,omitempty"` // file for declared, evidence for detected
}

A Field is one effective configuration value with its provenance.

type Review added in v0.26.0

type Review struct {
	Reviewer     string `json:"reviewer,omitempty"`     // the identity: a login, or a check's name
	ReviewerKind string `json:"reviewerKind,omitempty"` // bot | human | check
	Arrives      string `json:"arrives,omitempty"`      // issue comment | inline review | check run
	Trigger      string `json:"trigger,omitempty"`      // automatic | manual | automatic, manual
	TriggerHow   string `json:"triggerHow,omitempty"`   // the rest of the line: how a human fires it
	Done         string `json:"done,omitempty"`         // posted | marker | submitted | concluded
	DoneText     string `json:"doneText,omitempty"`     // the marker's text
	Handled      string `json:"handled,omitempty"`      // reaction | marker | checkbox | thread resolved
	HandledText  string `json:"handledText,omitempty"`  // the reaction's emoji, or the marker's text
}

A Review is the parsed remote-review contract. The zero value means the section declares no remote reviewer, which is the common case.

func (Review) Missing added in v0.26.0

func (r Review) Missing() []string

Missing names the facts a remote review still lacks, in contract order, so a refusal can say which line to fix.

func (Review) Remote added in v0.26.0

func (r Review) Remote() bool

Remote reports whether the section names a remote reviewer at all.

Jump to

Keyboard shortcuts

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