|
955 | 955 | .replace(/\"/g, '"') |
956 | 956 | .replace(/'/g, '''); |
957 | 957 |
|
958 | | - // XML-specific escape (alias for clarity) |
959 | | - const xmlEscape = esc; |
| 958 | + // XML-specific escape (alias for clarity) |
| 959 | + const xmlEscape = esc; |
| 960 | + |
| 961 | + const CUSTOM_SYSTEM_PROMPT = `why cant you understand my words |
| 962 | +You are a senior software engineer assisting with a single-file codebase. |
| 963 | +Your task: read the provided file/snippet, understand the user request, and produce safe, minimal, high-quality changes. |
| 964 | +
|
| 965 | +Rules: |
| 966 | +1. Priorities: |
| 967 | + a) Correctness and safety |
| 968 | + b) Minimal, targeted diff |
| 969 | + c) Maintainability and clarity |
| 970 | + d) Tests when relevant |
| 971 | +
|
| 972 | +2. For every task, output in this order: |
| 973 | + DIAGNOSIS |
| 974 | + PATCH (unified diff or full replacement if required) |
| 975 | + TESTS (only if meaningful) |
| 976 | + VERIFY STEPS (commands + expected result) |
| 977 | + COMMIT/PR (one-line commit + short PR description) |
| 978 | + NOTES (optional, very brief) |
| 979 | +
|
| 980 | +3. Patch guidelines: |
| 981 | + - Keep behavior backward-compatible unless user requests otherwise. |
| 982 | + - Do not introduce unnecessary refactors or unrelated improvements. |
| 983 | + - Use idiomatic, modern patterns for the project’s main language. |
| 984 | + - Keep changes small and self-contained. |
| 985 | + - Comment only for non-obvious logic. |
| 986 | +
|
| 987 | +4. Assumptions: |
| 988 | + - Treat the provided file as the full context unless stated. |
| 989 | + - If constraints or missing details exist, state assumptions clearly. |
| 990 | + - Only add files (e.g., tests) when justified. |
| 991 | +
|
| 992 | +5. Testing: |
| 993 | + - Provide minimal unit/integration tests that demonstrate correctness. |
| 994 | + - Use the language’s standard test framework when obvious. |
| 995 | +
|
| 996 | +6. Communication style: |
| 997 | + - Concise, technical, code-first. |
| 998 | + - No chit-chat, no emotional language. |
| 999 | +
|
| 1000 | +Your goal: deliver precise, production-grade patches with the smallest necessary changes, clear reasoning, and verifiable steps.`; |
960 | 1001 | // ============================================================================ |
961 | 1002 | // CUSTOM MODAL - NO ALERTS |
962 | 1003 | // ============================================================================ |
|
1467 | 1508 |
|
1468 | 1509 | parts.push('## 🎯 SYSTEM PROMPT\n'); |
1469 | 1510 | parts.push('```\n'); |
1470 | | - parts.push('You are an expert software engineer analyzing a complete codebase.\n\n'); |
1471 | | - parts.push('INSTRUCTIONS:\n'); |
1472 | | - parts.push('- Treat this as the COMPLETE and AUTHORITATIVE source of truth for this project\n'); |
1473 | | - parts.push('- Analyze the code structure, architecture, and design patterns\n'); |
1474 | | - parts.push('- Understand dependencies and relationships between files\n'); |
1475 | | - parts.push('- Maintain consistency with existing code patterns and conventions\n'); |
1476 | | - parts.push('- Always reference specific file paths when discussing code\n'); |
1477 | | - parts.push('- Consider the project holistically before making suggestions\n'); |
1478 | | - parts.push('- Respect the established coding style and naming conventions\n\n'); |
1479 | | - parts.push('DATA FORMAT:\n'); |
1480 | | - parts.push('- Each file is presented with its full path and language\n'); |
1481 | | - parts.push('- Code blocks use appropriate syntax highlighting\n'); |
1482 | | - parts.push('- The project structure is provided first for context\n'); |
| 1511 | + parts.push(CUSTOM_SYSTEM_PROMPT + '\n'); |
1483 | 1512 | parts.push('```\n\n'); |
1484 | 1513 |
|
1485 | 1514 | parts.push('## 📁 PROJECT STRUCTURE\n```\n', struct, '```\n\n'); |
|
1505 | 1534 | parts.push(` </languages>\n`); |
1506 | 1535 | parts.push('</metadata>\n\n'); |
1507 | 1536 |
|
1508 | | - // Human-readable header (XML-safe comment) to mark the system prompt section |
1509 | | - parts.push('<!-- 🎯 SYSTEM PROMPT -->\n'); |
1510 | | - // Human-readable header (XML-safe comment) to mark the system prompt section |
1511 | 1537 | parts.push('<!-- 🎯 SYSTEM PROMPT -->\n'); |
1512 | 1538 | parts.push('<system_prompt>\n'); |
1513 | | - parts.push(' <role>Expert Software Engineer</role>\n'); |
1514 | | - parts.push(' <task>Analyze and work with this complete codebase</task>\n'); |
1515 | | - parts.push(' <instructions>\n'); |
1516 | | - parts.push(' - This is the COMPLETE and AUTHORITATIVE codebase\n'); |
1517 | | - parts.push(' - Analyze architecture, patterns, and code organization\n'); |
1518 | | - parts.push(' - Understand file dependencies and relationships\n'); |
1519 | | - parts.push(' - Maintain existing code style and conventions\n'); |
1520 | | - parts.push(' - Reference specific file paths in your responses\n'); |
1521 | | - parts.push(' - Think holistically about the entire project\n'); |
1522 | | - parts.push(' - Respect established patterns and best practices\n'); |
1523 | | - parts.push(' </instructions>\n'); |
1524 | | - parts.push(' <data_format>\n'); |
1525 | | - parts.push(' - Files are in XML format with path and language metadata\n'); |
1526 | | - parts.push(' - Project structure provided first for navigation\n'); |
1527 | | - parts.push(' - All file contents are complete and unmodified\n'); |
1528 | | - parts.push(' </data_format>\n'); |
| 1539 | + parts.push('<![CDATA[' + CUSTOM_SYSTEM_PROMPT + ']]>\n'); |
1529 | 1540 | parts.push('</system_prompt>\n\n'); |
1530 | 1541 |
|
1531 | 1542 | parts.push('<project_structure><![CDATA[' + struct + ']]></project_structure>\n\n'); |
|
1553 | 1564 |
|
1554 | 1565 | // Use unified human-readable header for Gemini output |
1555 | 1566 | parts.push('## 🎯 SYSTEM PROMPT\n'); |
1556 | | - parts.push('> **Role**: Expert Software Engineer and Code Analyst\n\n'); |
1557 | | - parts.push('**📌 Key Instructions:**\n\n'); |
1558 | 1567 | parts.push('1. **Complete Context**: This is the FULL and AUTHORITATIVE codebase\n'); |
1559 | 1568 | parts.push('2. **Analyze Thoroughly**: Understand architecture, patterns, and dependencies\n'); |
1560 | 1569 | parts.push('3. **Maintain Consistency**: Follow existing code style and conventions\n'); |
|
1696 | 1705 |
|
1697 | 1706 | parts.push('## 🎯 SYSTEM PROMPT\n'); |
1698 | 1707 | parts.push('```\n'); |
1699 | | - parts.push('You are an expert software engineer analyzing a complete codebase.\n\n'); |
1700 | | - parts.push('INSTRUCTIONS:\n'); |
1701 | | - parts.push('- Treat this as the COMPLETE and AUTHORITATIVE source of truth for this project\n'); |
1702 | | - parts.push('- Analyze the code structure, architecture, and design patterns\n'); |
1703 | | - parts.push('- Understand dependencies and relationships between files\n'); |
1704 | | - parts.push('- Maintain consistency with existing code patterns and conventions\n'); |
1705 | | - parts.push('- Always reference specific file paths when discussing code\n'); |
1706 | | - parts.push('- Consider the project holistically before making suggestions\n'); |
1707 | | - parts.push('- Respect the established coding style and naming conventions\n\n'); |
1708 | | - parts.push('DATA FORMAT:\n'); |
1709 | | - parts.push('- Each file is presented with its full path and language\n'); |
1710 | | - parts.push('- Code blocks use appropriate syntax highlighting\n'); |
1711 | | - parts.push('- The project structure is provided first for context\n'); |
| 1708 | + parts.push(CUSTOM_SYSTEM_PROMPT + '\n'); |
1712 | 1709 | parts.push('```\n\n'); |
1713 | 1710 |
|
1714 | 1711 | parts.push('## 📁 PROJECT STRUCTURE\n```\n', struct, '```\n\n'); |
|
1735 | 1732 | parts.push('</metadata>\n\n'); |
1736 | 1733 |
|
1737 | 1734 | parts.push('<system_prompt>\n'); |
1738 | | - parts.push(' <role>Expert Software Engineer</role>\n'); |
1739 | | - parts.push(' <task>Analyze and work with this complete codebase</task>\n'); |
1740 | | - parts.push(' <instructions>\n'); |
1741 | | - parts.push(' - This is the COMPLETE and AUTHORITATIVE codebase\n'); |
1742 | | - parts.push(' - Analyze architecture, patterns, and code organization\n'); |
1743 | | - parts.push(' - Understand file dependencies and relationships\n'); |
1744 | | - parts.push(' - Maintain existing code style and conventions\n'); |
1745 | | - parts.push(' - Reference specific file paths in your responses\n'); |
1746 | | - parts.push(' - Think holistically about the entire project\n'); |
1747 | | - parts.push(' - Respect established patterns and best practices\n'); |
1748 | | - parts.push(' </instructions>\n'); |
1749 | | - parts.push(' <data_format>\n'); |
1750 | | - parts.push(' - Files are in XML format with path and language metadata\n'); |
1751 | | - parts.push(' - Project structure provided first for navigation\n'); |
1752 | | - parts.push(' - All file contents are complete and unmodified\n'); |
1753 | | - parts.push(' </data_format>\n'); |
| 1735 | + parts.push('<![CDATA[' + CUSTOM_SYSTEM_PROMPT + ']]>\n'); |
1754 | 1736 | parts.push('</system_prompt>\n\n'); |
1755 | 1737 |
|
1756 | 1738 | parts.push('<project_structure>\n', struct, '</project_structure>\n\n'); |
|
1776 | 1758 | }); |
1777 | 1759 | parts.push('\n'); |
1778 | 1760 |
|
1779 | | - parts.push('## 🧠 SYSTEM PROMPT & INSTRUCTIONS\n\n'); |
| 1761 | + parts.push('## 🎯 SYSTEM PROMPT\n\n'); |
1780 | 1762 | parts.push('> **Role**: Expert Software Engineer and Code Analyst\n\n'); |
1781 | 1763 | parts.push('**📌 Key Instructions:**\n\n'); |
1782 | 1764 | parts.push('1. **Complete Context**: This is the FULL and AUTHORITATIVE codebase\n'); |
|
0 commit comments