buildPrompt method presentation ✓ 100.0%

Last updated: 2026-03-01T23:25:47.072Z

Metrics

LOC: 30 Complexity: 6 Params: 1 Coverage: 100.0% (13/13 lines, 20x executed)

Signature

buildPrompt(input: ScriptOptimizerInput): : string

Source Code

  buildPrompt(input: ScriptOptimizerInput): string {
    const base = renderPromptBase(this);
    const sections: string[] = [];

    sections.push(`=== Framework ===\n${input.framework}`);

    if (input.pageUrl) {
      sections.push(`=== Page URL ===\n${input.pageUrl}`);
    }

    if (input.pageTitle) {
      sections.push(`=== Page Title ===\n${input.pageTitle}`);
    }

    if (input.pageContext?.trim()) {
      const ctx =
        input.pageContext.length > MAX_PAGE_CONTEXT_CHARS
          ? input.pageContext.slice(0, MAX_PAGE_CONTEXT_CHARS) + "…"
          : input.pageContext;
      sections.push(`=== Page Structure (simplified HTML) ===\n${ctx}`);
    }

    const script =
      input.script.length > MAX_SCRIPT_CHARS
        ? input.script.slice(0, MAX_SCRIPT_CHARS) + "\n// … (truncated)"
        : input.script;
    sections.push(`=== Script to Optimize ===\n${script}`);

    return `${base}\n\nOptimize this test script:\n\n${sections.join("\n\n")}`;
  },

Dependencies (Outgoing)

graph LR buildPrompt["buildPrompt"] renderPromptBase["renderPromptBase"] buildPrompt -->|calls| renderPromptBase style buildPrompt fill:#dbeafe,stroke:#2563eb,stroke-width:2px click buildPrompt "7b9c7ffaf76b8560.html" click renderPromptBase "1d807d7283d93d7a.html"
TargetType
renderPromptBase calls

No incoming dependencies.