Documentation
¶
Overview ¶
Package tablo is the Tableaux backend: a library that loads, validates, audits and derives a Tableaux project from a Git repository and serves every abstract view as data. Command tablo, in cmd/tablo, is a thin shell over the library: plumbing that reads a repository and emits data.
A caller opens a Repository once and loads a Snapshot per change: Load reads the files and the history once, and the snapshot then derives every view from memory. View returns one view's Envelope, Validate the diagnostics and CheckTrailer the check of a commit trailer; the command encodes the same envelope as JSON or YAML, so the two cannot disagree. Linked returns the snapshot of a subproject that the load already read, with its own source and views; Resolve resolves a ref in a snapshot's own repository, a linked one's included; and AuthorTime gives the time of the commit read, with its zone. The data of each view has its types in package view.
The library reads neither the environment nor the clock: the caller passes the viewer and the date staleness counts from in Params. Where the caller names no viewer, DefaultViewer applies the rule of the command's --viewer to the value of GIT_AUTHOR_EMAIL that the caller reads and passes:
p.Viewer = tablo.DefaultViewer(ctx, dir, os.Getenv("GIT_AUTHOR_EMAIL"))
Index ¶
- Constants
- Variables
- func Accepts(v string) bool
- func DefaultViewer(ctx context.Context, dir, author string) string
- func ParseVersion(v string) (major, minor, patch int, ok bool)
- type Brief
- type Diagnostic
- type Envelope
- type Level
- type LinkError
- type NotFoundError
- type Options
- type Params
- type ProjectInfo
- type ReadError
- type Repository
- type Resolved
- type Role
- type Snapshot
- func (s *Snapshot) AuthorTime() string
- func (s *Snapshot) CheckTrailer(t Trailer) error
- func (s *Snapshot) Checkouts() []string
- func (s *Snapshot) Diagnostics() []Diagnostic
- func (s *Snapshot) GateKeys() []string
- func (s *Snapshot) HasTask(id string) bool
- func (s *Snapshot) Linked(url, commit string) (*Snapshot, error)
- func (s *Snapshot) Project() *ProjectInfo
- func (s *Snapshot) Resolve(ctx context.Context, ref string) (string, error)
- func (s *Snapshot) Source() Source
- func (s *Snapshot) Validate() *Envelope
- func (s *Snapshot) View(ctx context.Context, v View, p Params) (*Envelope, error)
- func (s *Snapshot) Viewer(email string) Viewer
- type Source
- type SourceFrom
- type SourceTrunk
- type Trailer
- type UsageError
- type View
- type Viewer
Constants ¶
const ( AcceptedMajor = model.AcceptedMajor AcceptedMinor = model.AcceptedMinor )
The tableaux language versions the module accepts. The method's version rule accepts a project whose major version equals the tool's own and whose minor version does not exceed it; the patch version never matters. The rule itself lives in internal/model, where the Loader applies it.
const SchemaVersion = "tablo/1"
SchemaVersion names the output schema: the envelope and every command's data.
const Version = "0.2.0"
Version is the tablo release version. The tag v<Version> releases it, so a release bumps this constant first.
Variables ¶
var EnvelopeSchema []byte
EnvelopeSchema is envelope.schema.yaml, the JSON Schema of the envelope.
Functions ¶
func Accepts ¶
Accepts reports whether the module accepts a project whose version.yaml states the tableaux language version v, written as major.minor.patch. A malformed version is not accepted.
func DefaultViewer ¶
DefaultViewer returns the viewer when the caller names none, by the rule of 4ed9 decision 18 (a): author, when it is not empty; else the user.email that Git's configuration gives in dir, the repository's and the user's; else nobody, "". A value that is no email address stands for nobody, and so does a directory Git cannot read. The library reads no environment: the caller passes the value of GIT_AUTHOR_EMAIL as author.
viewer := tablo.DefaultViewer(ctx, dir, os.Getenv("GIT_AUTHOR_EMAIL"))
func ParseVersion ¶
ParseVersion splits a tableaux language version into its numbers. It accepts exactly the form version.schema.yaml accepts: three decimal integers without leading zeros, joined by dots. ok is false otherwise.
Types ¶
type Brief ¶
type Brief struct{ Task, Gate string }
A Brief names the one queue item the queue view writes as a brief.
type Diagnostic ¶
type Diagnostic struct {
Severity string `json:"severity"` // "error", "warning" or "information"
Code string `json:"code"` // the rule id of corpus/RULES.md
Path string `json:"path,omitempty"`
Line int `json:"line,omitempty"`
Col int `json:"col,omitempty"`
Task string `json:"task,omitempty"`
Gate string `json:"gate,omitempty"`
Commit string `json:"commit,omitempty"`
Trailer string `json:"trailer,omitempty"`
Message string `json:"message"`
}
A Diagnostic is one finding of the loader or the validator. Path is relative to the directory -C names, starts with .tableaux/ and uses / on every host; Line and Col are 1-based. A field that does not apply is empty or zero and the encodings omit it.
type Envelope ¶
type Envelope struct {
Schema string `json:"schema"`
Command string `json:"command"`
Source *Source `json:"source"`
Project *ProjectInfo `json:"project"`
Viewer *Viewer `json:"viewer"`
Params Resolved `json:"params"`
Data any `json:"data"` // a view's typed data (A5 to A8), or nil
Diagnostics []Diagnostic `json:"diagnostics"`
}
An Envelope is the result of one command: what the library returns and what the command encodes. Field order is the key order of the output.
type LinkError ¶
type LinkError struct {
URL, Commit string // the link: an absolute URL as written or the path cleaned, and its commit
Problem, Detail string
}
A LinkError reports a subproject field whose link leads to no project (4ed9 decision 18 b): the url names a link of the load, and the Loader found no project there. Problem is the reason's name, as RULES.md's J8 and J9 read it: "outside", "missing", "no clone", "bad commit", "commit absent", "no project", "too deep" or, for an unpinned requirement whose clone holds no branch to read, "no trunk". Detail says more.
type NotFoundError ¶
type NotFoundError struct{ Kind, Name string }
A NotFoundError reports a well-formed ref, task or gate that the repository or the project lacks: the command exits 3. Kind is "ref", "task" or "gate".
type Options ¶
type Options struct {
Trunk string // the branch the caller names; read when version.yaml and origin/HEAD name none
Replace map[string]string // an absolute subproject URL to the directory of its local clone
}
Options are what a caller states about a repository beyond its files.
type Params ¶
type Params struct {
Task string // a task id
Person string // an email
Viewer string // whoever runs the tool; "" is an observer
Role Role // the role whose level the view opens at
Level Level // the level, overriding the role's
Window *int // tableau, context: columns either side of the next gates; nil is 1
Columns []string // tableau, context: the gate keys to show, in place of a window
Historical bool // tableau, context: show the marks of historical junctions
Proposed bool // authority: proposed tasks only
Brief *Brief // queue: write this one item as a brief
Stale int // audit: days after which a status is stale; 0 is 7
Now string // audit: the date staleness counts from, YYYY-MM-DD; required
Minimum string // audit: the lowest severity listed, "error", "warning" or "information"; "" is "warning"
From string // history: the ref the range starts after; "" is the whole history
}
Params focus a view. The zero value asks for every default. Check returns a *UsageError when p sets a field v does not take or holds a malformed value, by the rules of the command table. Narrow returns p without the fields v does not take, for a front end that carries one state across views.
func (Params) Check ¶
Check returns a *UsageError when p sets a field v does not take or holds a malformed value, or sets fields that exclude each other: --window with --columns, --task with --person on context, and --brief with --level or --role. It reads no environment, so it does not require a person or a viewer; the resolution of defaults does.
type ProjectInfo ¶
type ProjectInfo struct {
Tableaux string `json:"tableaux"`
Root string `json:"root"`
Title string `json:"title"`
Owner string `json:"owner"`
}
ProjectInfo names the project: the language version version.yaml states, the root task, its title and its assignee.
type ReadError ¶
A ReadError reports a repository that cannot be read: the command exits 3. Op names what failed and Err says why.
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
A Repository is a long-lived handle on one project directory, safe for concurrent use. Resolve returns the full id of the commit a ref names. Load reads the project and its history once: the ref "" reads the files from the working tree and the history from HEAD; a commit-ish reads both from that commit; a tree reads the files alone, for Validate. A project that fails validation still loads, and the snapshot carries the diagnostics.
func Open ¶
Open finds the Git repository that holds dir and returns a handle on the project whose .tableaux lies in dir, or nearest above it. It reads no project file. The error is a *ReadError.
type Resolved ¶
Resolved holds a command's parameters with every default written in. It marshals the keys its command takes, each present and null when unset, in the order task, person, window, columns, historical, proposed, brief, stale, now, minimum, role, level; for a command that is no view it marshals {}.
func (Resolved) MarshalJSON ¶
MarshalJSON writes the keys View takes, each present, in the fixed order.
type Role ¶
type Role string
Role is "owner", "authority", "assignee", "contributor", "agent", "reviewer" or "observer".
const ( RoleOwner Role = "owner" RoleAuthority Role = "authority" RoleAssignee Role = "assignee" RoleContributor Role = "contributor" RoleAgent Role = "agent" RoleReviewer Role = "reviewer" RoleObserver Role = "observer" )
The seven roles, in the order README.md lists them; observer is the role of an email that holds none.
type Snapshot ¶
type Snapshot struct {
// contains filtered or unexported fields
}
A Snapshot is one project at one source. It is immutable and safe for concurrent use, and it computes each derived fact once.
func (*Snapshot) AuthorTime ¶
AuthorTime returns the author time of the commit the load read, with the zone Git records, as git log --format=%aI prints it: 2026-09-01T21:30:00-07:00. Its day is Source.Date. It is "" where Date is nil: a tree, an unborn branch, or a commit the pass lacks.
func (*Snapshot) CheckTrailer ¶
CheckTrailer returns a *UsageError when t is malformed and a *NotFoundError when t names a task the project lacks or, for a reviewed trailer, a gate that gates.yaml lacks or that does not apply to the task.
func (*Snapshot) Checkouts ¶
Checkouts returns the directories of the submodule checkouts whose HEAD gave a pin of this load, absolute and sorted: what a watcher polls beside the working tree, since a moved checkout changes what the project reads (4f60 decision 9). It is empty for a load at a ref.
func (*Snapshot) Diagnostics ¶
func (s *Snapshot) Diagnostics() []Diagnostic
Diagnostics returns what the Loader and the Validator report, sorted and never nil.
func (*Snapshot) Linked ¶
Linked returns the snapshot of the project a subproject field links to, as this load read it (4ed9 decision 18 b): at the commit the link fixes, from a submodule's checkout or store, from a directory of the same repository, or from the clone that Options.Replace or Git's configuration names for an absolute URL. It runs no second walk of the repository: the project, its passes and its facts are the ones Load already holds. The snapshot has its own source, project, diagnostics and views; its Checkouts are those of the links it holds in turn.
url is the field's url: an absolute URL as written, or a path, which Linked cleans as the Loader does, so that "./firmware" and "firmware" name one link. commit is "" unless the files link one absolute URL at more than one commit; then it names the one wanted. The error is a *NotFoundError of kind "subproject" for a url that names no link of the load, a *LinkError for a link that leads to no project, and a *UsageError for a url linked at several commits with none named.
func (*Snapshot) Project ¶
func (s *Snapshot) Project() *ProjectInfo
Project returns the project's name and owner, or nil when the files give no root task.
func (*Snapshot) Resolve ¶
Resolve returns the full id of the commit ref names in the snapshot's own repository (4ed9 decision 20), as Repository.Resolve does for the repository Open opened. A snapshot that Load returns resolves there. One that Linked returns resolves wherever the parent's load read the link: a submodule's checkout or store, the same repository for a directory, or the clone that Options.Replace or Git's configuration names for an absolute URL. The error is a *NotFoundError of kind "ref" for a ref that names no commit, or a *ReadError.
type Source ¶
type Source struct {
Ref string `json:"ref"` // the name given; for the working tree, the branch HEAD names, or HEAD
Dir string `json:"dir"` // the project's directory, relative to the repository's root; "." at the root
Worktree bool `json:"worktree"` // the files come from disk and the history from HEAD
Commit *string `json:"commit"` // the commit in full
Date *string `json:"date"` // the commit's author date, YYYY-MM-DD
From *SourceFrom `json:"from"` // the start of a range, for history alone
Trunk SourceTrunk `json:"trunk"`
OnTrunk bool `json:"on_trunk"`
}
A Source states what a command read. Dir is the directory that holds the project's .tableaux, relative to the repository's root with / on every host, and "." at the root: the nearest at or above the directory -C names, or that directory itself when none is. Commit and Date are nil when the source is a bare tree.
type SourceFrom ¶
A SourceFrom is the start of a range: the ref as given and its commit.
type SourceTrunk ¶
A SourceTrunk names the trunk and how it resolves: "stated", "inferred", "caller" or "undetermined". Name is nil when it is undetermined.
type Trailer ¶
type Trailer struct {
Kind string // "authorised", "reviewed", "reaffirmed" or "model"
Task string // for the three task trailers
Gate string // for reviewed
Model string // for model: printable ASCII with no space
}
A Trailer is one of the four commit trailers of SYNTAX.md. Line returns it as Git writes it, with no newline, or a *UsageError when a field is missing, extra or malformed.
type UsageError ¶
type UsageError struct{ Msg string }
A UsageError reports parameters a command or a view does not accept: the command exits 2. Msg names the option or the value at fault.
type View ¶
type View string
A View names one of the ten views by its command name.
const ( Gates View = "gates" Task View = "task" Authority View = "authority" Assignment View = "assignment" Queue View = "queue" Blockage View = "blockage" Tableau View = "tableau" Context View = "context" History View = "history" Audit View = "audit" )
The ten views, each named as its mockup file is named.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
tablo
command
Command tablo is the Tableaux plumbing command.
|
Command tablo is the Tableaux plumbing command. |
|
internal
|
|
|
audit
Package audit turns the Validator's diagnostics and three facts of the Derivation into findings: each names its task, its gate, its commits, the act that resolves it and the person who takes it, and holds the facts of the Derivation it rests on.
|
Package audit turns the Validator's diagnostics and three facts of the Derivation into findings: each names its task, its gate, its commits, the act that resolves it and the person who takes it, and holds the facts of the Derivation it rests on. |
|
cli
Package cli is the tablo command: the argument parser, the plain forms and the usage text, over the root package that does the work.
|
Package cli is the tablo command: the argument parser, the plain forms and the usage text, over the root package that does the work. |
|
conformance
Package conformance holds the conformance test of tablo: it runs the built command over every entry of the tableaux conformance corpus and compares what the command emits with the entry's expected.yaml, the findings by rule and location and then each derived fact the file states.
|
Package conformance holds the conformance test of tablo: it runs the built command over every entry of the tableaux conformance corpus and compares what the command emits with the entry's expected.yaml, the findings by rule and location and then each derived fact the file states. |
|
corpustest
Package corpustest gives a test the tableaux conformance corpus: a copy of the corpus at one locked tableaux commit, embedded into the package, the entries built from it in a work directory, the labels that name their commits and the rules RULES.md lists.
|
Package corpustest gives a test the tableaux conformance corpus: a copy of the corpus at one locked tableaux commit, embedded into the package, the entries built from it in a work directory, the labels that name their commits and the rules RULES.md lists. |
|
derive
Package derive gives every fact a view shows that no file states: each junction resolved through the ancestors with the supplier of every field, each requirement's condition, each task's authorisation, each status's date and recorder, each review, each parent's roll-up, each task's events, and each recursive junction's status from the subproject at its pin.
|
Package derive gives every fact a view shows that no file states: each junction resolved through the ancestors with the supplier of every field, each requirement's condition, each task's authorisation, each status's date and recorder, each review, each parent's roll-up, each task's events, and each recursive junction's status from the subproject at its pin. |
|
git
Package git is the one place that runs the git executable: it discovers a repository, runs a command in it, lists trees and the index, and reads blobs in one batch.
|
Package git is the one place that runs the git executable: it discovers a repository, runs a command in it, lists trees and the index, and reads blobs in one batch. |
|
history
Package history is the one place that reads a project's history.
|
Package history is the one place that reads a project's history. |
|
load
Package load is the Loader: it reads one Tableaux project, from the working tree or from any Git revision, and returns it as an immutable model with every project its files link to.
|
Package load is the Loader: it reads one Tableaux project, from the working tree or from any Git revision, and returns it as an immutable model with every project its files link to. |
|
model
Package model holds the typed model of a Tableaux project as its files state it: the version, the gating, every task and status as written, every subproject a file links to, and the position of every value.
|
Package model holds the typed model of a Tableaux project as its files state it: the version, the gating, every task and status as written, every subproject a file links to, and the position of every value. |
|
validate
Package validate is the Validator: it applies the rules of the method's RULES.md to a project the Loader read and returns diagnostics, each with a rule id, a severity and a position.
|
Package validate is the Validator: it applies the rules of the method's RULES.md to a project the Loader read and returns diagnostics, each with a rule id, a severity and a position. |
|
views
Package views builds each view's data from the derived facts.
|
Package views builds each view's data from the derived facts. |
|
Package schemas embeds the tableaux schema files that the module validates a project against.
|
Package schemas embeds the tableaux schema files that the module validates a project against. |
|
Package view holds the data of each view as tablo emits it: the Go types that an envelope's Data holds and that marshal to its JSON.
|
Package view holds the data of each view as tablo emits it: the Go types that an envelope's Data holds and that marshal to its JSON. |