Agents + bash
diff --git a/loop/todo.go b/loop/todo.go
index e639857..4dc41d6 100644
--- a/loop/todo.go
+++ b/loop/todo.go
@@ -9,8 +9,8 @@
)
type Comment struct {
- Author string `json:"author"`
- Comment string `json:"comment"`
+ Author string `json:"author" jsonschema:"title=author,description=author of the comment,required"`
+ Comment string `json:"comment" jsonschema:"title=comment,description=actual comment text,required"`
}
func (c Comment) String() string {
@@ -18,31 +18,56 @@
}
type ToDo struct {
- ID string `json:"id"`
- Title string `json:"title"`
- Description string `json:"description"`
- Items []*ToDo `json:"items"`
- Done bool `json:"done"`
- AssignedTo string `json:"assignedTo"`
- Discussion []Comment `json:"discussion"`
- lock sync.Locker
+ ID string `json:"id" jsonschema:"title=id,description=unique id of the TODO item,required"`
+ Title string `json:"title" jsonschema:"title=title,description=high level title of the TODO item,required"`
+ Description string `json:"description" jsonschema:"title=description,description=detailed description what this TODO item is about"`
+ Items []*ToDo `json:"items" jsonschema:"title=sub items,description=array of sub items current item consists of"`
+ Parallel bool `json:"parallel" jsonschema:"title=parallel,description=if true sub-items may be worked on in parallel and there is no depencency between them, otherwise they shall be worked on sequentially"`
+ Done bool `json:"done" jsonschema:"title=done,description=if true item shall be considered as done"`
+ AssignedTo string `json:"assignedTo" jsonschema:"title=assigned to,description=name of the person who shall work on this item"`
+ Discussion []Comment `json:"discussion" jsonschema:"title=discussion,description=comments related to current item"`
+ Summary string `json:"summary" jsonschem:"title=summary,description=detailed summary of current item and all of it's sub-item trees."`
+ lock sync.RWMutex
}
-const tmpl = `%s: %s
-%s
-%s
-%s`
-
func (t ToDo) String() string {
- var comments []string
+ var ret []string
+ status := "IN PROGRESS"
+ if t.Done {
+ status = "DONE"
+ }
+ ret = append(ret, fmt.Sprintf("%s: %s - %s %s %t", t.ID, t.Title, status, t.AssignedTo, t.Parallel))
+ if t.Description != "" {
+ ret = append(ret, t.Description)
+ }
+ if t.Summary != "" {
+ ret = append(ret, fmt.Sprintf("SUMMARY: %s", t.Summary))
+ }
for _, c := range t.Discussion {
- comments = append(comments, fmt.Sprintf("\t - %s", c.String()))
+ ret = append(ret, fmt.Sprintf("\t - %s", c.String()))
}
- var items []string
for _, i := range t.Items {
- items = append(items, fmt.Sprintf("\t%s", i.String()))
+ for _, k := range strings.Split(i.String(), "\n") {
+ ret = append(ret, fmt.Sprintf("\t%s", k))
+ }
}
- return fmt.Sprintf(tmpl, t.ID, t.Title, t.Description, strings.Join(comments, "\n"), strings.Join(items, "\n"))
+ return strings.Join(ret, "\n")
+}
+
+func (t *ToDo) LockRead() {
+ t.lock.RLock()
+}
+
+func (t *ToDo) UnlockRead() {
+ t.lock.RUnlock()
+}
+
+func (t *ToDo) Lock() {
+ t.lock.Lock()
+}
+
+func (t *ToDo) Unlock() {
+ t.lock.Unlock()
}
func ToDoJSONSchema() string {