Documentation
¶
Overview ¶
Package render writes the page of a wish: one HTML file standing alone, made by Djinn from its store, never by a model. It shows first what matters now: a bar that stays in sight while something waits for the user, the open questions, what waits for the user and the workers running. Then the tasks that need an eye (the planned ones folded), the decisions (the latest first), the free blocks, the journal and the workers' events. An empty section is not rendered, and the contents at the top name only the sections present.
One colour language runs through the page, always with an icon and a word: done, running, waiting for you, planned, failed, interrupted, paused, stopped; and for what waits, blocking, waiting for you, can wait. A decision the developer took has a colour of its own, human.
The page shows what it is given: the caller strips secrets and local paths first, as an export does.
Index ¶
- Constants
- func Blocked(tasks []*planv1.Task) map[string][]string
- func ByMotion(a, b *planv1.Task) int
- func ByUrgency(questions []*planv1.Question, tasks []*planv1.Task)
- func ForkedAs(t *planv1.Task, tasks []*planv1.Task) string
- func IsDecision(b *planv1.Block) bool
- func NewestEnded(a, b *planv1.Task) int
- func Page(in Input) ([]byte, error)
- func SanitizeSVG(raw string) string
- func ShortSha(sha string) string
- func Shown(e *planv1.TaskEvent) bool
- func SystemLanguage() string
- func TaskDealtWith(t *planv1.Task, tasks []*planv1.Task) bool
- func Translator(lang string) func(key string, params ...string) string
- func Work(t *planv1.Task, code func(id string) string, tr func(string, ...string) string) (text, class string)
- type Decided
- type Input
- type Urgency
Constants ¶
const ( QuestionIcon = "💬" BlockIcon = "📌" )
Default icons of a decision without its own: an answered question, a decision block.
const ByLead = "lead"
ByLead is what Decided.By says of a block written by the wish's lead.
const DecisionKind = "decision"
DecisionKind is the kind of block that holds a decision taken outside a question.
const MaxEvents, _ = 200, 10
MaxEvents is the most worker events a page shows, the latest ones; shownEvents are in sight, the others folded.
Variables ¶
This section is empty.
Functions ¶
func ByMotion ¶
ByMotion orders the tasks that move or wait by status, as the window does; a stable sort keeps the order within a status.
func ByUrgency ¶
ByUrgency orders questions in place: blocking, then before X, then can wait; each level keeps its order.
func ForkedAs ¶
ForkedAs is the code of the task that took over t once it was cut short: a task of its wish forked from its session (Task.fork_of); "" when none did.
func IsDecision ¶
IsDecision tells a block of kind decision, case ignored.
func NewestEnded ¶
NewestEnded orders finished tasks the latest ended first, then the latest created: the window, the page and the brief show them so.
func SanitizeSVG ¶ added in v0.1.1
SanitizeSVG strips dangerous elements, scripts, event handlers, and external URLs from SVG markup.
func Shown ¶
Shown tells whether a page shows a worker's event: what it said, a change of status, an error, when it has a text. Tool calls stay out. Of the others, a page needs only each task's last one and the MaxEvents latest.
func SystemLanguage ¶
func SystemLanguage() string
SystemLanguage is the language of the user's locale, from the environment, or the source language.
func TaskDealtWith ¶ added in v0.1.1
TaskDealtWith tells whether a failed worker has been addressed: marked done, continued (or forked), or a new task names it in its title, decision, forkOf, or as a correction/review target.
func Translator ¶
Translator is the texts of the language lang: a key of locales, then its parameters as name and value pairs.
func Work ¶
func Work(t *planv1.Task, code func(id string) string, tr func(string, ...string) string) (text, class string)
Work says where the finished work of t stands on its way into its wish's integration branch (T07), with tr, and the class that colours it: "" for work Djinn does not integrate. code names a task of the wish by its identifier, for the correction and the review worker; "": the identifier itself.
Types ¶
type Decided ¶
type Decided struct {
// One of the two.
Question *planv1.Question
Block *planv1.Block
// When it was taken: the answer, or the block's creation.
At time.Time
// Human says the developer took it: an answered question, or a block the developer approved.
Human bool
// Approved says the developer took it by an approval: the recommendation on a question, a block as it is.
Approved bool
// By is the agent that took the decision: "lead", or the code of the task it is about. Empty when Human.
By string
// Icon is its emoji: its own, or the default of its kind.
Icon string
// Tasks are the codes of the tasks that name it as their decision, in their order.
Tasks []string
}
Decided is a decision of a wish, as the decision log shows it: an answered question or a block of kind decision, with who took it and the tasks it led to.
func Decisions ¶
func Decisions(exp *planv1.WishExport) []Decided
Decisions are the decisions of an export, the latest first: answered questions and blocks of kind decision.
type Input ¶
type Input struct {
// Export is the wish and all it holds, made portable: no secret, no local path.
Export *planv1.WishExport
// Unattached names the wish's projects that have no folder on this machine.
Unattached []string
// Version of Djinn, shown in the header.
Version string
// Language of the page's own texts; the source language when empty.
Language string
// Now is when the page is rendered. Every time on the page is shown in its location.
Now time.Time
}
Input is what a page shows.
type Urgency ¶
type Urgency int
Urgency is how much an open question holds up, the most urgent first.
const ( // Blocking: a waiting task needs the answer. Djinn computes it from the tasks. Blocking Urgency = iota // Move: a move only the developer can make (push a tag, merge a PR, install, etc.). Move // Before: the asker said what the answer is needed before (Question.before). Before // Later: nothing waits for it; it can wait. Later )