mongossee 1.0.28 โ 1.0.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +33 -20
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -27,24 +27,25 @@ async function generateProject(prompt, directoryName) {
|
|
|
27
27
|
- If it mentions React/Components, use React (JSX/TSX).
|
|
28
28
|
- For DSA/Logic, choose Java, Python, or C++ based on context.
|
|
29
29
|
2. TYPESCRIPT RULES: If using TypeScript, define proper Interfaces/Types for Props and State.
|
|
30
|
-
3.
|
|
30
|
+
3. ๐ฏ CONTEXTUAL ONLY: Scrutinize the prompt. If it's a simple app, do NOT add router or state management. Only add 'react-router-dom', 'axios', etc., if the specific feature is requested.
|
|
31
|
+
4. ๐ซ NO BLOAT: In package.json, include ONLY the absolute minimum dependencies to run the app (e.g., react, react-dom, react-scripts).
|
|
32
|
+
5. โ REMOVE FALTU LIBRARIES: Strictly do NOT include @testing-library/*, web-vitals, eslintConfig, or reportWebVitals.
|
|
33
|
+
6. REACT RULES: If using React, always use functional components with hooks (useState, useEffect).
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
6. ๐งฑ COMPONENT STRUCTURE: If the prompt mentions "component", "ui", or "frontend", build a complete component with proper imports, exports, and structure.
|
|
35
|
+
7. ๐ง SMART LOGIC: If the prompt says "Logic", "Algorithm", or "DSA", generate only the core logic without UI or framework code
|
|
36
|
+
8. ๐งฑ COMPONENT STRUCTURE: If the prompt mentions "component", "ui", or "frontend", build a complete component with proper imports, exports, and structure.
|
|
35
37
|
|
|
36
|
-
|
|
38
|
+
9. โ ZERO COMMENTS: Return strictly functional code. No // or /* */ comments, and no explanations.
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
10. ๐ ARCHITECTURE: If the prompt mentions Parent/Child or Props, strictly follow React best practices (state in parent, props to child, arrow functions for events).
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
11. ๐ FORMAT: Return ONLY a valid JSON array of objects: [{"filename": "string", "code": "string"}].
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
15. ๐งโ๐ป FULL SOURCE CODE: The 'code' field must contain the complete source code for the file, including all necessary imports, exports, and boilerplate. Do not return partial code snippets.
|
|
44
|
+
12. ๐ซ NO MARKDOWN: Do not wrap the response in \`\`\`json blocks.
|
|
45
|
+
13. ๐งน CLEAN CODE: Ensure the 'code' string has proper indentation (spaces/tabs) and newlines so it is human-readable after being written to a file. Single-line code is not acceptable.
|
|
46
|
+
14. IMPORTANT: I need 'Pretty-Printed' code. Use multi-line formatting. Single-line code is strictly forbidden.
|
|
47
|
+
15. ๐ ๏ธ BOILERPLATE: Include all necessary boilerplate files (e.g. package.json for Node.js, pom.xml for Java, etc.) based on the detected language and framework.
|
|
48
|
+
16. ๐งโ๐ป FULL SOURCE CODE: The 'code' field must contain the complete source code for the file, including all necessary imports, exports, and boilerplate. Do not return partial code snippets.
|
|
48
49
|
`
|
|
49
50
|
};
|
|
50
51
|
|
|
@@ -106,13 +107,25 @@ async function generateProject(prompt, directoryName) {
|
|
|
106
107
|
|
|
107
108
|
if (typeof formattedCode === 'string') {
|
|
108
109
|
formattedCode = formattedCode
|
|
109
|
-
.replace(
|
|
110
|
-
.replace(/\\
|
|
111
|
-
.replace(/\\
|
|
112
|
-
.replace(/\\
|
|
113
|
-
.replace(/\\
|
|
114
|
-
.replace(
|
|
115
|
-
|
|
110
|
+
.replace(/\\\\"/g, '"') // 1. Triple escaped quotes (\\") pehle
|
|
111
|
+
.replace(/\\"/g, '"') // 2. Normal escaped quotes (\")
|
|
112
|
+
.replace(/\\r/g, '') // 3. Carriage returns hatao
|
|
113
|
+
.replace(/\\n/g, '\n') // 4. Newlines (Actual line breaks) ko restore karo ๐
|
|
114
|
+
.replace(/\\t/g, ' ') // 5. Tabs ko 2 spaces banao
|
|
115
|
+
.replace(/\\{2,}/g, '\\') // 6. Multiple backslashes ko handle karo
|
|
116
|
+
.replace(/\\\\/g, '\\'); // 7. Generic backslashes last mein
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// 2. โจ JSON Pretty-Print Fix:
|
|
120
|
+
// Agar file .json hai, toh usey dubara parse karke sundar format mein badlo
|
|
121
|
+
if (file.filename.endsWith('.json')) {
|
|
122
|
+
try {
|
|
123
|
+
const jsonObject = JSON.parse(formattedCode);
|
|
124
|
+
formattedCode = JSON.stringify(jsonObject, null, 2);
|
|
125
|
+
} catch (e) {
|
|
126
|
+
// Agar parse fail ho jaye toh purana formatted code hi rehne do
|
|
127
|
+
//console.log(` ${file.filename}`);
|
|
128
|
+
}
|
|
116
129
|
}
|
|
117
130
|
|
|
118
131
|
// Write the code to the file
|