The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
| 1 | export function proposedPlanTitle(planMarkdown: string): string | null { |
| 2 | const heading = planMarkdown.match(/^\s{0,3}#{1,6}\s+(.+)$/m)?.[1]?.trim(); |
| 3 | return heading && heading.length > 0 ? heading : null; |
| 4 | } |
| 5 | |
| 6 | export function stripDisplayedPlanMarkdown(planMarkdown: string): string { |
| 7 | const lines = planMarkdown.trimEnd().split(/\r?\n/); |
| 8 | let start = lines[0] && /^\s{0,3}#{1,6}\s+/.test(lines[0]) ? 1 : 0; |
| 9 | while (lines[start]?.trim().length === 0) { |
| 10 | start += 1; |
| 11 | } |
| 12 | const firstHeadingMatch = lines[start]?.match(/^\s{0,3}#{1,6}\s+(.+)$/); |
| 13 | if (firstHeadingMatch?.[1]?.trim().toLowerCase() === "summary") { |
| 14 | start += 1; |
| 15 | while (lines[start]?.trim().length === 0) { |
| 16 | start += 1; |
| 17 | } |
| 18 | } |
| 19 | return lines.slice(start).join("\n"); |
| 20 | } |