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)
| Target | Type |
|---|---|
| renderPromptBase | calls |
No incoming dependencies.