feat(worker): compose task prompt from title + description + open steps only

Resolved sub-tasks are no longer appended to the prompt. Extracted into a
shared TaskPromptComposer so the UI's description preview can render the same
'what Claude gets' text.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-06-04 19:16:37 +02:00
parent 8f7e2898fe
commit 299867d8df
3 changed files with 78 additions and 10 deletions

View File

@@ -0,0 +1,29 @@
using System.Text;
namespace ClaudeDo.Data;
/// <summary>
/// Single source of truth for the text handed to Claude as a task prompt:
/// title + description + the OPEN sub-tasks. Resolved sub-tasks are dropped.
/// Shared by the Worker (real prompt) and the UI (the card's "what Claude gets" preview).
/// </summary>
public static class TaskPromptComposer
{
public static string Compose(string title, string? description, IEnumerable<(string Title, bool Completed)> subtasks)
{
var sb = new StringBuilder((title ?? "").Trim());
if (!string.IsNullOrWhiteSpace(description))
sb.Append("\n\n").Append(description.Trim());
var open = subtasks?.Where(s => !s.Completed).ToList() ?? new List<(string, bool)>();
if (open.Count > 0)
{
sb.Append("\n\n## Sub-Tasks\n");
foreach (var s in open)
sb.Append("- [ ] ").Append(s.Title).Append('\n');
}
return sb.ToString();
}
}