Inline question choices, compact one-click inbox cards, drop snooze

This commit is contained in:
Ian Gulliver
2026-10-14 23:34:39 -07:00
parent 4dc86e5479
commit c7cfad88a1
30 changed files with 1022 additions and 647 deletions
+46
View File
@@ -0,0 +1,46 @@
package agents
import (
"regexp"
"strings"
)
var (
choiceLine = regexp.MustCompile(`^\s*[-*+]\s+(\([ *]\)|\[[ xX]\])\s+(\S.*?)\s*$`)
choiceFence = regexp.MustCompile("^\\s*(```|~~~)")
)
type choice struct {
text string
checkbox bool
recommended bool
}
func parseChoices(markdown string) []choice {
choices := []choice{}
fence := ""
for _, line := range strings.Split(markdown, "\n") {
if f := choiceFence.FindStringSubmatch(line); f != nil {
switch fence {
case "":
fence = f[1]
case f[1]:
fence = ""
}
continue
}
if fence != "" {
continue
}
m := choiceLine.FindStringSubmatch(line)
if m == nil {
continue
}
choices = append(choices, choice{
text: m[2],
checkbox: m[1][0] == '[',
recommended: m[1][1] != ' ',
})
}
return choices
}