All files / core/prompt prompt-builder.service.ts

100% Statements 8/8
100% Branches 0/0
100% Functions 4/4
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 605x       5x 120x                             47x                                 19x                           11x                
import { Injectable } from '@nestjs/common';
import { IRoleDefinition } from '@gs-squad-mcp/core/roles';
 
@Injectable()
export class PromptBuilderService {
  private readonly setupReportingFooter = `---
 
# Setup & Reporting Rules
 
If you notice any setup or environment problems that prevent you from ` +
    `completing your task,
you MUST clearly report them as SETUP / ENVIRONMENT ISSUES.
 
Explain what you observed and suggest specific steps for the human to fix.
Do not pretend the task succeeded if the environment blocks you.`;
 
  buildPromptStateless(
    role: IRoleDefinition,
    task: string
  ): string {
    return `# Role
 
${role.body}
 
---
 
# Task
 
${task}
 
${this.setupReportingFooter}`;
  }
 
  buildPromptStatefulNewChat(
    role: IRoleDefinition,
    task: string
  ): string {
    return `# Role
 
${role.body}
 
---
 
# Initial Task
 
${task}
 
${this.setupReportingFooter}`;
  }
 
  buildPromptStatefulExistingChat(task: string): string {
    return `# Task
 
${task}
 
${this.setupReportingFooter}`;
  }
}