MCPcopy Create free account
hub / github.com/AutoForgeAI/autoforge / _strip_browser_testing_sections

Function _strip_browser_testing_sections

prompts.py:74–128  ·  view source on GitHub ↗

Strip browser automation and Playwright testing instructions from prompt. Used in YOLO mode where browser testing is skipped entirely. Replaces browser-related sections with a brief YOLO-mode note while preserving all non-testing instructions (implementation, git, progress notes, etc.).

(prompt: str)

Source from the content-addressed store, hash-verified

72
73
74def _strip_browser_testing_sections(prompt: str) -> str:
75 """Strip browser automation and Playwright testing instructions from prompt.
76
77 Used in YOLO mode where browser testing is skipped entirely. Replaces
78 browser-related sections with a brief YOLO-mode note while preserving
79 all non-testing instructions (implementation, git, progress notes, etc.).
80
81 Args:
82 prompt: The full coding prompt text.
83
84 Returns:
85 The prompt with browser testing sections replaced by YOLO guidance.
86 """
87 original_prompt = prompt
88
89 # Replace STEP 5 (browser automation verification) with YOLO note
90 prompt = re.sub(
91 r"### STEP 5: VERIFY WITH BROWSER AUTOMATION.*?(?=### STEP 5\.5:)",
92 "### STEP 5: VERIFY FEATURE (YOLO MODE)\n\n"
93 "**YOLO mode is active.** Skip browser automation testing. "
94 "Instead, verify your feature works by ensuring:\n"
95 "- Code compiles without errors (lint and type-check pass)\n"
96 "- Server starts without errors after your changes\n"
97 "- No obvious runtime errors in server logs\n\n",
98 prompt,
99 flags=re.DOTALL,
100 )
101
102 # Replace the screenshots-only marking rule with YOLO-appropriate wording
103 prompt = prompt.replace(
104 "**ONLY MARK A FEATURE AS PASSING AFTER VERIFICATION WITH SCREENSHOTS.**",
105 "**YOLO mode: Mark a feature as passing after lint/type-check succeeds and server starts cleanly.**",
106 )
107
108 # Replace the BROWSER AUTOMATION reference section
109 prompt = re.sub(
110 r"## BROWSER AUTOMATION\n\n.*?(?=---)",
111 "## VERIFICATION (YOLO MODE)\n\n"
112 "Browser automation is disabled in YOLO mode. "
113 "Verify features by running lint, type-check, and confirming the dev server starts without errors.\n\n",
114 prompt,
115 flags=re.DOTALL,
116 )
117
118 # In STEP 4, replace browser automation reference with YOLO guidance
119 prompt = prompt.replace(
120 "2. Test manually using browser automation (see Step 5)",
121 "2. Verify code compiles (lint and type-check pass)",
122 )
123
124 if prompt == original_prompt:
125 print("[YOLO] Warning: No browser testing sections found to strip. "
126 "Project-specific prompt may need manual YOLO adaptation.")
127
128 return prompt
129
130
131def get_coding_prompt(project_dir: Path | None = None, yolo_mode: bool = False) -> str:

Callers 1

get_coding_promptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected