Skip to content

Commit 7c407e4

Browse files
committed
Fix prompt f-string compatibility for Python 3.10 CI
1 parent a58d8d1 commit 7c407e4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

claudecode/prompts.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
from typing import Any, Dict, List, Optional
44

5+
COMPLIANCE_EXTRA_FIELDS = ',\n "rule_reference": "path/to/CLAUDE.md#section"'
6+
SECURITY_EXTRA_FIELDS = (
7+
',\n "exploit_preconditions": "...",\n "trust_boundary": "...",\n'
8+
' "cwe": "optional CWE-###"'
9+
)
10+
511

612
def _format_files_changed(pr_data: Dict[str, Any]) -> str:
713
"""Format changed files for prompt context."""
@@ -145,7 +151,7 @@ def build_compliance_prompt(
145151
Focus exclusively on clear CLAUDE.md violations in changed code. Cite concrete violated rule text in each finding.
146152
Reject ambiguous or preference-only claims.
147153
148-
{_findings_output_schema(',\n "rule_reference": "path/to/CLAUDE.md#section"')}
154+
{_findings_output_schema(COMPLIANCE_EXTRA_FIELDS)}
149155
150156
Return JSON only.
151157
"""
@@ -223,7 +229,7 @@ def build_security_prompt(
223229
- speculative attacks without evidence in changed code paths
224230
- issues outside modified scope unless required to prove exploitability
225231
{custom_block}
226-
{_findings_output_schema(',\n "exploit_preconditions": "...",\n "trust_boundary": "...",\n "cwe": "optional CWE-###"')}
232+
{_findings_output_schema(SECURITY_EXTRA_FIELDS)}
227233
228234
Return JSON only.
229235
"""

0 commit comments

Comments
 (0)