Documentation
¶
Overview ¶
Package design is the Design module: design work handed to a design team and reviewed live.
The owner asks the agent for a change to the interface; the agent records a job and hands it to the Design team (a Tether message and a manual Torque task, behind Dispatcher). The team works on a branch and serves the component gallery from it with hot reload (make design-preview); the job's window frames that preview beside the same page from the base, the files the branch changes, and the owner's notes, which are marks on the job. Notes go back as the next round; approval goes back as the go-ahead to merge. Progress is read from the branch and its pull request, and from what comes back (inbox.go): the Designer's replies on the job's thread and the job's Torque task. Surface never merges.
Index ¶
Constants ¶
const ( StatusRequested = "requested" StatusInProgress = "in progress" StatusReady = "ready for review" StatusChangesRequested = "changes requested" StatusApproved = "approved" StatusMerged = "merged" // StatusClosed is a job the Design team closed without merging, after approval. StatusClosed = "closed" )
The statuses a job moves through, in order. "merged" is read from the pull request.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Anchor ¶
type Anchor struct {
Section string `json:"section"`
Component string `json:"component,omitempty"`
}
Anchor is where a note points in the gallery.
type Change ¶
type Change struct {
Branch *string `json:"branch,omitempty"`
PRURL *string `json:"pr_url,omitempty"`
PreviewURL *string `json:"preview_url,omitempty"`
BaseURL *string `json:"base_url,omitempty"`
Status *string `json:"status,omitempty"`
TaskID *string `json:"task_id,omitempty"`
HeadSHA *string `json:"head_sha,omitempty"`
// What the reader records; not settable from a tool or the page.
TaskStatus *string `json:"-"`
TaskComment *string `json:"-"`
TaskChecked *string `json:"-"`
InboxChecked *string `json:"-"`
ClosedReason *string `json:"-"`
Announced *bool `json:"-"`
}
Change is what may be set on a job; nil fields stay as they are.
type Checked ¶
type Checked struct {
ID string `json:"id"`
Replies int `json:"new_replies"`
Status string `json:"status"`
Problem string `json:"problem,omitempty"`
}
Checked is what one check of one job found.
type Dispatcher ¶
type Dispatcher interface {
Send(ctx context.Context, m Message) (id string, err error)
CreateTask(ctx context.Context, t Task) (id string, err error)
}
Dispatcher reaches the Design team: out by Tether mail and a Torque task. The way back is Reader, which the same transport implements. Both are interfaces so the transport can be replaced without touching the module.
type Inbound ¶
type Inbound struct {
ID, From, To, Thread, Subject, Body, Sent string
}
Inbound is one message read from the sender's mailbox.
type Job ¶
type Job struct {
ID string `json:"id"`
Title string `json:"title"`
Brief string `json:"brief"`
// Refs are references the work should follow (links, screenshots, components), one per line.
Refs string `json:"refs,omitempty"`
Branch string `json:"branch"`
PRURL string `json:"pr_url,omitempty"`
// PreviewURL serves the gallery from the branch; BaseURL from main. Both are given per job.
PreviewURL string `json:"preview_url,omitempty"`
BaseURL string `json:"base_url,omitempty"`
Status string `json:"status"`
TaskID string `json:"task_id,omitempty"`
// HeadSHA is the head the Designer last said the preview shows.
HeadSHA string `json:"head_sha,omitempty"`
// TaskStatus and TaskComment are the Torque task's status and its latest comment, as read
// at TaskChecked. InboxChecked is when the Designer's replies were last looked for.
TaskStatus string `json:"task_status,omitempty"`
TaskComment string `json:"task_comment,omitempty"`
TaskChecked string `json:"task_checked,omitempty"`
InboxChecked string `json:"inbox_checked,omitempty"`
// ApprovedHead is the commit the owner approved, at ApprovedAt; the approval covers it only.
ApprovedHead string `json:"approved_head,omitempty"`
ApprovedAt string `json:"approved_at,omitempty"`
// ApprovedPR is the pull request the approval is for: only its merge completes the job.
ApprovedPR string `json:"approved_pr,omitempty"`
// LatestHead is the head the Designer last named, also after an approval (when HeadSHA
// stays the approved one); HeadDiffers says it is not the approved head.
LatestHead string `json:"latest_head,omitempty"`
HeadDiffers bool `json:"head_differs"`
// UpdateReceived says work came back (a head or a pull request) with no preview to review
// yet; ready for review still needs a preview.
UpdateReceived bool `json:"update_received"`
// MergeWarning says a pull request was merged on GitHub that is not the approved commit.
MergeWarning string `json:"merge_warning,omitempty"`
// ApprovalOwed says the owner is asked again on their own once GitHub shows the head the
// Designer named (GitHub can lag a push by seconds).
ApprovalOwed bool `json:"approval_owed"`
// ClosedReason is why a closed job was closed: the Designer's closed: line, or by hand.
ClosedReason string `json:"closed_reason,omitempty"`
Rounds []Round `json:"rounds"`
Replies []Reply `json:"replies"`
Created string `json:"created"`
Updated string `json:"updated"`
// contains filtered or unexported fields
}
Job is one piece of design work handed to the Design team.
type Message ¶
type Message struct {
From, To string
// Kind is a Tether message kind: "request" for new work and feedback, "notice" otherwise.
Kind string
Subject string
Body string
// Thread groups a job's messages: the job's id.
Thread string
}
Message is mail to the Design team.
type Outbox ¶
type Outbox struct {
Sent bool `json:"sent"`
MessageID string `json:"message_id,omitempty"`
TaskID string `json:"task_id,omitempty"`
// Problem is why it was not sent, in a line; Manual is then the text to send by hand.
Problem string `json:"problem,omitempty"`
Manual string `json:"manual,omitempty"`
}
Outbox is what was (or should be) sent for one ask, as the tools report it.
type Probe ¶
type Probe struct {
URL string `json:"url"`
Reachable bool `json:"reachable"`
Problem string `json:"problem,omitempty"`
}
Probe is whether a preview answered.
type Progress ¶
type Progress struct {
// Exists says the branch has been pushed.
Exists bool `json:"exists"`
Head string `json:"head,omitempty"`
// HeadMessage is the head commit's first line; HeadDate when it was made.
HeadMessage string `json:"head_message,omitempty"`
HeadDate string `json:"head_date,omitempty"`
Files []string `json:"files"`
// PR is the pull request from the branch, when there is one.
PR *PullRequest `json:"pr,omitempty"`
// Problem is why it could not be read, in a line.
Problem string `json:"problem,omitempty"`
Read string `json:"read"`
// contains filtered or unexported fields
}
Progress is what the branch and its pull request say about a job.
type PullRequest ¶
type PullRequest struct {
Number int `json:"number"`
URL string `json:"url"`
State string `json:"state"` // open, closed, merged
Draft bool `json:"draft,omitempty"`
Title string `json:"title,omitempty"`
// HeadSHA is the pull request's head: for a merged one, the commit that was merged (not the
// merge commit).
HeadSHA string `json:"head_sha,omitempty"`
}
PullRequest is the part of a pull request a review needs.
type Reader ¶
type Reader interface {
Unread(ctx context.Context, to, thread string) ([]Inbound, error)
MarkRead(ctx context.Context, as, id string) error
Task(ctx context.Context, id string) (TaskState, error)
}
Reader is the way back: the replies waiting on a job's thread, and the job's task. A Dispatcher that is also a Reader lets the module follow a job without anyone setting it by hand. Unread lists only one thread, so mail on any other thread is never fetched or touched.
type Reply ¶
type Reply struct {
MessageID string `json:"message_id"`
From string `json:"from"`
Subject string `json:"subject,omitempty"`
Body string `json:"body"`
Sent string `json:"sent,omitempty"`
Received string `json:"received"`
PreviewURL string `json:"preview_url,omitempty"`
BaseURL string `json:"base_url,omitempty"`
PRURL string `json:"pr_url,omitempty"`
HeadSHA string `json:"head_sha,omitempty"`
Ignored string `json:"ignored,omitempty"`
// Note says what the reply did to a settled job, or why its merged:/closed: line was not taken.
Note string `json:"note,omitempty"`
// Merged and Closed are its merged:/closed: lines, read only once the job is approved.
// OtherMerged names another pull request GitHub shows merged at that commit, if any.
Merged string `json:"-"`
Closed string `json:"-"`
OtherMerged string `json:"-"`
}
Reply is one message from the Designer on a job's thread. What it set on the job is in its fields; Ignored says which labeled lines were refused and why. The body is shown as text, never acted on.
type Round ¶
type Round struct {
N int `json:"n"`
Asked string `json:"asked"`
// Sent says the message reached Tether; false means it is waiting to be sent by hand.
Sent bool `json:"sent"`
// MessageID is the Tether message that carried it, when it was sent.
MessageID string `json:"message_id,omitempty"`
Created string `json:"created"`
}
Round is one ask of the Design team: the first is the brief, later ones are feedback.
type Task ¶
Task is the Torque task that tracks a job. It is created manual: nothing starts on its own.