Help us shape the future of Go! Take the 2026 Go Developer Survey

concept

package
v0.1.14 Latest Latest
Warning

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

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

Documentation

Overview

Package concept reads concept.md, the handover from the design phase to implementation, and checks it against the research it must stand on.

The file has fixed sections in a fixed order and free content inside them: the headings guarantee every decision is made, the words are the author's. Decisions cite research by ID (V012 for a voice, P003 for a peer), so every claim can be traced back to what real people wrote or what pages show.

Index

Constants

View Source
const (
	MinVoiceNotes = 8
	MinPathSteps  = 3
	MinRejected   = 2
	MinFacts      = 10
	MinAxes       = 5
	MinSparks     = 3
	MaxSparks     = 5
	MinDirections = 8
	MinSpine      = 3
	MinColors     = 3
	MinCopy       = 3
)

Minimums each section must meet. The design skill prints the same numbers.

View Source
const (
	RuleFormat   = "concept.format"
	RuleEvidence = "concept.evidence"
	RuleDefaults = "concept.defaults"
	RuleGround   = "concept.ground"
	RuleOpen     = "concept.open"
)

Rule IDs reported by Check.

View Source
const File = "concept.md"

File is concept.md in the project root.

Variables

View Source
var Sections = []SectionSpec{
	{"Diagnosis", true},
	{"Voices", false},
	{"Buyer", false},
	{"Decision path", false},
	{"Mechanism", false},
	{"Offer", false},
	{"Facts", false},
	{"Axes", false},
	{"Sparks", false},
	{"Directions", false},
	{"Concept", false},
	{"Spine", false},
	{"Palette", false},
	{"Type", false},
	{"Form", false},
	{"Imagery", false},
	{"Motion", false},
	{"Copy", false},
	{"Qualities", true},
	{"Changelog", true},
}

Sections are the sections of concept.md in their required order.

Functions

func Citations

func Citations(text string) []string

Citations returns the research IDs cited in text, in order of appearance.

func Parse

func Parse(text string) (Document, []Problem)

Parse splits concept.md into its sections.

func ParseFormat added in v0.0.3

func ParseFormat(text, title, placeholder string, sections []SectionSpec) (Document, []Problem)

ParseFormat splits a concept-style file into the given sections. The first line must be title followed by a name; placeholder names it in messages.

func Rules

func Rules() []diagnostic.RuleInfo

Rules describes the concept checks for the rule catalog.

func StripCitations

func StripCitations(text string) string

StripCitations removes research IDs and the spaces they leave.

Types

type Document

type Document struct {
	Title    string
	Sections map[string]*Section
	Order    []*Section
}

Document is a parsed concept.md.

type Line

type Line struct {
	N    int
	Text string
}

Line is one source line of a section.

type Problem

type Problem struct {
	Line    int
	Message string
	Hint    string
}

Problem is a format defect at a line.

type Report

type Report struct {
	Diagnostics []diagnostic.Diagnostic
	Summary     Summary
}

Report is the result of checking concept.md.

func Check

func Check(text string, voices *research.Voices, competitors *research.Competitors) Report

Check parses concept.md and checks it against the parsed research, which may be nil when the files are absent.

func CheckProject added in v0.1.9

func CheckProject(text string, voices *research.Voices, competitors *research.Competitors, p project.Project) Report

CheckProject also validates relative fact links against the confined project sources.

type Row

type Row struct {
	N     int
	Cells []string
}

Row is one table row with its cells.

type Section

type Section struct {
	Name  string
	Line  int
	Lines []Line // non-empty lines, excluding the heading
}

Section is the content under one "## " heading.

func (*Section) Field

func (s *Section) Field(label string) (string, int)

Field returns the value of a "Label: value" line in the section.

func (*Section) Head

func (s *Section) Head(n int) string

Head returns the first line of the item starting at line n, without its list marker and continuation lines.

func (*Section) Items

func (s *Section) Items() []Line

Items returns the list items of a section: lines starting with "- " or "1. ", with continuation lines joined. Other lines are ignored.

func (*Section) Numbered

func (s *Section) Numbered() bool

Numbered reports whether every item line of the section is numbered.

func (*Section) Table

func (s *Section) Table(columns []string) (rows []Row, header bool)

Table returns the data rows of the section's table and whether its header matches columns. Separator rows are skipped.

func (*Section) Text

func (s *Section) Text() string

Text joins the section's lines.

type SectionSpec added in v0.0.3

type SectionSpec struct {
	Name     string
	Optional bool
}

SectionSpec names one section of a format and whether it may be omitted.

type Summary

type Summary struct {
	Present        bool          `json:"present"`
	Chosen         string        `json:"chosen,omitempty"` // the chosen direction
	Voices         int           `json:"voices"`           // distinct IDs cited
	Peers          int           `json:"peers"`
	Platforms      int           `json:"platforms"` // distinct platforms among cited voices
	Colors         int           `json:"colors"`
	Faces          int           `json:"typefaces"`
	DeclaredColors []color.Color `json:"-"`
	Families       []string      `json:"families,omitempty"`
	Intensity      string        `json:"intensity,omitempty"`
	Imagery        int           `json:"plannedImages"`
	Open           int           `json:"openQuestions"`
	Use            []string      `json:"use,omitempty"` // exact phrases the Copy section requires or forbids
	Avoid          []string      `json:"avoid,omitempty"`
}

Summary describes a concept for the compile report.

Jump to

Keyboard shortcuts

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