Documentation
¶
Overview ¶
Package mapslice assembles a slice: the part of the map one task needs. A bare slice is the floor and the headings: the product's rules, and for each capability an agent chose its promise, overview and rules in full, with only the headings of its decisions and questions. The agent then takes the entries its task touches by their slugs, from anywhere in the map. It never matches, ranks or searches the map; it takes only what is named, and the same map and request always give the same slice. Every slice carries the slice skill, and no slice is built from a map the check would reject. It also declares the flags of physa map slice and reads them into a Request.
Index ¶
- func Read(dir string) (*mapfile.Map, error)
- func Write(w io.Writer, m *mapfile.Map, f Flags) error
- func WriteJSON(w io.Writer, s *Slice) error
- func WriteMD(w io.Writer, s *Slice) error
- func WriteTakenJSON(w io.Writer, t *Taken) error
- func WriteTakenMD(w io.Writer, t *Taken) error
- type Entry
- type Flags
- type Heading
- type Line
- type Request
- type Section
- type Slice
- type Taken
- type TakenEntry
- type Term
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Read ¶
Read reads the map in dir/.physa for a slice. It fails when the map has a problem physa check map would report, with anchors checked for their form only, so neither history nor the forge is read; the error names every problem by file and line.
func Write ¶
Write builds what f asks for from m and writes it to w, as JSON when f.JSON is set: the entries its request names, or else the slice of its capabilities. Nothing is written when the request fails.
func WriteJSON ¶
WriteJSON writes s as one line of JSON with the same content as WriteMD, its fields in a fixed order.
func WriteMD ¶
WriteMD writes s as markdown, its sections in a fixed order: the header, the product, each capability, the terms, Reading further (the slice skill) and how to anchor, a blank line between sections. Empty sections are omitted. The same slice always gives the same bytes.
func WriteTakenJSON ¶
WriteTakenJSON writes t as one line of JSON, {"entries":[...]}, each entry with the capability it lives in.
Types ¶
type Entry ¶
type Entry struct {
Slug string `json:"slug"`
Kind string `json:"kind"` // "rule", "decision" or "question"
Heading string `json:"heading"`
Role string `json:"role,omitempty"` // "decided" or "raised"
Person string `json:"person,omitempty"`
How string `json:"how,omitempty"`
Date string `json:"date,omitempty"`
Anchors []string `json:"anchors,omitempty"` // "#12", "a1b2c3d", "from docs/x.md"
Body string `json:"body,omitempty"`
Because string `json:"because,omitempty"`
Rejected []string `json:"rejected,omitempty"`
}
Entry is a rule, decision or question in full.
type Flags ¶
Flags is a parsed physa map slice command line: the request it makes and whether the slice is printed as JSON.
type Heading ¶
type Heading struct {
Kind string `json:"kind"` // "decision" or "question"
Slug string `json:"slug"`
Heading string `json:"heading"`
}
Heading is one entry shown by its slug and heading alone, to be taken with physa map slice --entry.
type Line ¶
type Line struct {
// contains filtered or unexported fields
}
Line is one physa map slice command line as its declared flags read it: capability names and --with and --format, or --entry and slugs, in any order, each flag as "--flag value" or "--flag=value". --entry takes no value of its own: every word after it is a slug, and --entry=slug names one; it may be repeated. --with may be repeated and adds up.
type Request ¶
type Request struct {
Capabilities []string
WithDecisions, WithQuestions bool
Entries []string // slugs, in the order asked
}
Request is what an agent asks for: either the capabilities its task touches, with the kinds of entry to print in full in place of their headings, or the entries it chose, by slug. A request never asks for both.
type Section ¶
type Section struct {
Name string `json:"name"` // "product" for the product
Title string `json:"title"`
File string `json:"file"`
Promise string `json:"promise"`
Overview string `json:"overview"` // empty for the product
Entries []Entry `json:"entries"` // rules, then decisions, then questions
Contents []Heading `json:"contents"` // decisions, then questions, shown by heading only
}
Section is the product or one capability: its rules and any kinds asked for in full as entries, and the other kinds as headings.
type Slice ¶
type Slice struct {
Capabilities []string `json:"capabilities"` // chosen, deduplicated, sorted
Product *Section `json:"product,omitempty"` // nil without the product
Sections []Section `json:"sections"` // one per chosen capability
Terms []Term `json:"terms"`
ReadingFurther string `json:"reading_further"` // the slice skill
Trailers []string `json:"trailers"`
}
Slice is an assembled bare slice, ready to write as markdown or JSON. Field order is the JSON field order.
type Taken ¶
type Taken struct {
Entries []TakenEntry `json:"entries"`
}
Taken is the entries an agent took by slug, in the order it named them.
type TakenEntry ¶
type TakenEntry struct {
Capability string `json:"capability"` // the capability's name, or "product"
Entry
}
TakenEntry is one taken entry in full and where it lives in the map.