feat(workflow): repository step types; implement and tdd ship as YAML in general steps

This commit is contained in:
sam committed 2026-10-05 00:04:34 +11:00
1 parent 2dc3e68ec7
commit e6eee9a808
9 files changed
+407 -266

No files matched your search

-80
View File
@@ -123,83 +123,3 @@ func runBaselineFix(ctx context.Context, tc *TaskContext, argv []string, out []b
}
return nil
}
// Implement is the default workflow: plan read-only, post the plan to
// the issue for visibility, build behind the repo's gate, open the PR
// with the builder's own summary.
func Implement() Workflow {
return Workflow{
Name: "implement",
Stages: []Stage{
StagePrepareWorktree(),
StageBaselineGate(),
AgentStage{
Name: "plan",
Role: "planner",
ReadOnly: true,
Mission: func(tc *TaskContext) string {
prd := ""
if tc.Task.Plan != "" {
prd = "\n<approved_prd>\n" + tc.Task.Plan + "\n</approved_prd>\n"
}
return fmt.Sprintf(
"Produce a concrete implementation plan for this %s on the repository %s.\n"+prd+"\n"+
"%s\n\n"+
"Explore the codebase with your read-only tools, then call finish with status "+
"\"passed\" and the plan as the summary: files to touch, the approach, acceptance "+
"criteria, and what tests should prove it. Keep the plan tightly scoped to the task -- "+
"call finish with status \"blocked\" if the task is too vague or too large for one PR.",
taskKind(tc.Task), tc.Repo.FullName(), taskPromptBlock(tc.Task),
)
},
OnResult: func(tc *TaskContext, res agentrun.Result) error {
tc.Task.Plan = res.Summary
return nil
},
}.Stage(),
AgentStage{
Name: "build",
Role: "builder",
Gate: func(tc *TaskContext) agentrun.Gate {
return GateFromRepo(tc.Repo, tc.Cfg.Budgets)
},
ExtraRules: "Files matching the repository's protected suffixes (e.g. generated code) are " +
"write-blocked -- edit their sources instead; the gate regenerates them.",
Mission: func(tc *TaskContext) string {
return fmt.Sprintf(
"Implement this %s on the repository %s, following the plan below.\n\n"+
"%s\n\n<plan>\n%s\n</plan>\n\n"+
"Make the smallest change that satisfies the task and the plan's acceptance criteria. "+
"Do not run git -- the orchestrator commits and pushes for you. When done, call finish "+
"with status \"passed\" and a summary written for the human who will review the pull "+
"request: what changed, why, and how it was verified.",
taskKind(tc.Task), tc.Repo.FullName(), taskPromptBlock(tc.Task), tc.Task.Plan,
)
},
OnResult: func(tc *TaskContext, res agentrun.Result) error {
tc.BuildSummary = res.Summary
if res.Status == agentrun.StatusPassed && len(res.Changes) == 0 && !tc.BaselineFixed {
tc.BuildNoChanges = true
}
return nil
},
}.Stage(),
StageCommitPush(func(tc *TaskContext) string {
return fmt.Sprintf("%s (archie)", tc.Task.Title) +
commitIssueReference("Implements", tc.Task)
}),
StageDiffCap(),
StagePRReviewAndOpenPR(implementPRBody),
},
}
}
// implementPRBody is the implement workflow's PR footer: token usage split
// into fresh and cached.
func implementPRBody(tc *TaskContext) string {
return fmt.Sprintf("%s\n\n---\n*workflow: implement · %d iterations · %s*",
tc.BuildSummary, tc.Task.Iterations, formatTokenUsage(tc.Task.TokensUsed, tc.RunUsage))
}