package fakeclaude import ( "regexp" "strconv" "strings" ) // markdownSample is a coordinator reply in the shape the conversation // streams most: a bold opening line, a bold-led bullet list and a // numbered list, with a task link and inline code. const markdownSample = "**Yes. This is the right shape for it.** The invoice total is counted twice when delivery is added.\n\nTwo people see it:\n\n- **Guest:** sees the total on the basket page.\n- **Customer:** sees it again on the receipt.\n\nWhat I'd do, in [Fix the invoice total](/tasks/tks6kwzzdngr):\n\n1. **Owner of the fix:** Engineering, on the checkout repository.\n2. **One complete change:** the total, the receipt and `go test ./checkout/...` for both.\n3. **Review:** an independent check before it merges." // pasteSample is a reply with two things to paste: a command, with the // characters a copy must keep (<, &, quotes, a tab, trailing spaces), and // a prompt, which wraps. const pasteSample = "Run this in a terminal:\n\n```bash\ngo test ./internal/checkout/... -run 'TestTotal' > out.txt && echo \"a < b\"\t \n```\n\nThen paste this prompt into the review:\n\n```prompt\nCheck that the invoice total counts delivery once, & say which test shows it. Keep the receipt as it is.\n```" // markdownWord asks for markdownSample as the reply ("replymd"), for a // long reply of it repeated ("replymd:long"), or for pasteSample // ("replymd:paste"). var markdownWord = regexp.MustCompile(`\breplymd(:long|:paste)?\b`) func markdownReply(newest string) (string, bool) { m := markdownWord.FindStringSubmatch(newest) if m == nil { return "", false } if m[1] == "" { return markdownSample, true } if m[1] == ":paste" { return pasteSample, true } parts := make([]string, 30) for i := range parts { parts[i] = "## Part " + strconv.Itoa(i+1) + "\n\n" + markdownSample } return strings.Join(parts, "\n\n"), true } // chunksWord streams the reply in that many deltas ("chunks:", // three without it). var chunksWord = regexp.MustCompile(`\bchunks:([0-9]+)`) func chunkCount(newest string) int { if m := chunksWord.FindStringSubmatch(newest); m != nil { if n, err := strconv.Atoi(m[1]); err == nil && n > 0 { return n } } return 3 }