(
ctx: Extract<AIContext, { mode: "plan-review" }>
)
| 157 | } |
| 158 | |
| 159 | function buildPlanReviewPrompt( |
| 160 | ctx: Extract<AIContext, { mode: "plan-review" }> |
| 161 | ): string { |
| 162 | const sections: string[] = [ |
| 163 | ANSWER_DIRECTLY, |
| 164 | "", |
| 165 | "The user is reviewing an implementation plan in Plannotator.", |
| 166 | "", |
| 167 | "## Plan Under Review", |
| 168 | ]; |
| 169 | |
| 170 | if (ctx.plan.version) { |
| 171 | const total = ctx.plan.totalVersions ? ` of ${ctx.plan.totalVersions}` : ""; |
| 172 | sections.push(`Plan version: ${ctx.plan.version}${total}`); |
| 173 | } |
| 174 | |
| 175 | if (ctx.plan.project) { |
| 176 | sections.push(`Project: ${ctx.plan.project}`); |
| 177 | } |
| 178 | |
| 179 | sections.push(""); |
| 180 | sections.push(truncate(ctx.plan.plan, MAX_PLAN_CHARS)); |
| 181 | |
| 182 | if (ctx.plan.previousPlan) { |
| 183 | sections.push(""); |
| 184 | sections.push("## Previous Plan Version (for reference)"); |
| 185 | sections.push(truncate(ctx.plan.previousPlan, MAX_PLAN_CHARS / 2)); |
| 186 | } |
| 187 | |
| 188 | if (ctx.plan.annotations) { |
| 189 | sections.push(""); |
| 190 | sections.push("## User Annotations"); |
| 191 | sections.push(ctx.plan.annotations); |
| 192 | } |
| 193 | |
| 194 | return sections.join("\n"); |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * Code-review system prompt: role only. The actual changeset and how to inspect |
no test coverage detected