mongossee 1.0.29 โ†’ 1.0.31

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.
Files changed (2) hide show
  1. package/index.js +13 -39
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -9,6 +9,7 @@ const { hideBin } = require('yargs/helpers');
9
9
  const SERVER_URL = "https://mongossee.vercel.app/api/server";
10
10
 
11
11
 
12
+
12
13
  /**
13
14
  * Generates a full project structure based on a prompt.
14
15
  * @param {string} prompt - The user's project request.
@@ -17,35 +18,8 @@ const SERVER_URL = "https://mongossee.vercel.app/api/server";
17
18
  async function generateProject(prompt, directoryName) {
18
19
 
19
20
 
20
- const body = {
21
- prompt: `
22
- TASK: Generate a coding project based on this user request: "${prompt}"
23
-
24
- STRICT TECHNICAL CONSTRAINTS (Follow for every project):
25
- 1. AUTO-DETECT LANGUAGE & TECH:
26
- - If the request mentions "Typescript" or ".ts/.tsx", use TypeScript strictly.
27
- - If it mentions React/Components, use React (JSX/TSX).
28
- - For DSA/Logic, choose Java, Python, or C++ based on context.
29
- 2. TYPESCRIPT RULES: If using TypeScript, define proper Interfaces/Types for Props and State.
30
- 3. REACT RULES: If using React, always use functional components with hooks (useState, useEffect).
31
-
32
- 4. โŒ REMOVE FALTU STUFF: Do NOT include @testing-library, web-vitals, or eslintConfig.
33
- 5. ๐Ÿง  SMART LOGIC: If the prompt says "Logic", "Algorithm", or "DSA", generate only the core logic without UI or framework code
34
- 6. ๐Ÿงฑ COMPONENT STRUCTURE: If the prompt mentions "component", "ui", or "frontend", build a complete component with proper imports, exports, and structure.
35
-
36
- 7. โ›” ZERO COMMENTS: Return strictly functional code. No // or /* */ comments, and no explanations.
37
-
38
- 8. ๐Ÿ“ 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
-
40
- 9. ๐Ÿ“„ FORMAT: Return ONLY a valid JSON array of objects: [{"filename": "string", "code": "string"}].
41
-
42
- 10. ๐Ÿšซ NO MARKDOWN: Do not wrap the response in \`\`\`json blocks.
43
- 11. ๐Ÿงน 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.
44
- 12. IMPORTANT: I need 'Pretty-Printed' code. Use multi-line formatting. Single-line code is strictly forbidden.
45
- 13. ๐Ÿ› ๏ธ 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.
46
- 14. ๐Ÿงฉ FILE STRUCTURE: If the prompt implies multiple files (e.g. "Create a React app with components"), generate a structured file hierarchy with appropriate imports/exports.
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.
48
- `
21
+ const body = {
22
+ prompt: prompt // Ye wahi prompt hai jo user terminal mein likhega
49
23
  };
50
24
 
51
25
  try {
@@ -63,16 +37,16 @@ async function generateProject(prompt, directoryName) {
63
37
 
64
38
  if (!response.ok || !data.success) {
65
39
  const errorMessage = data.error || 'Unknown Server Error';
66
- console.error(`\nโŒ Server Error: ${errorMessage}`);
40
+ console.error(`\n Server Error: ${errorMessage}`);
67
41
  if (data.raw_response) {
68
- console.log("Raw Output (Debug):");
42
+ // console.log("Raw Output (Debug):");
69
43
  try {
70
44
  // AI ka response agar markdown mein ho toh clean karke parse karein
71
45
  const cleanRaw = data.raw_response.replace(/```json|```/g, "").trim();
72
46
  const prettyJson = JSON.stringify(JSON.parse(cleanRaw), null, 2);
73
47
  console.log(prettyJson);
74
48
  } catch (e) {
75
- console.log("Raw Response:", data.raw_response);
49
+ //console.log("Raw Response:", data.raw_response);
76
50
  }
77
51
  }
78
52
  return; // Stop here
@@ -106,13 +80,13 @@ async function generateProject(prompt, directoryName) {
106
80
 
107
81
  if (typeof formattedCode === 'string') {
108
82
  formattedCode = formattedCode
109
- .replace(/\\\\/g, '\\') // Double backslash ko single banaya
110
- .replace(/\\r/g, '') // Carriage returns hatao
111
- .replace(/\\n/g, '\n') // Double backslash ko newline banao
112
- .replace(/\\t/g, ' ') // Tabs ko spaces banao
113
- .replace(/\\"/g, '"') // Escaped quotes ko sahi karo
114
- .replace(/\\\\"/g, '"'); // Agar AI ne code ko ek single line mein diya hai, toh usko pretty-print karne ki koshish karo
115
-
83
+ .replace(/\\\\"/g, '"') // 1. Triple escaped quotes (\\") pehle
84
+ .replace(/\\"/g, '"') // 2. Normal escaped quotes (\")
85
+ .replace(/\\r/g, '') // 3. Carriage returns hatao
86
+ .replace(/\\n/g, '\n') // 4. Newlines (Actual line breaks) ko restore karo ๐Ÿš€
87
+ .replace(/\\t/g, ' ') // 5. Tabs ko 2 spaces banao
88
+ .replace(/\\{2,}/g, '\\') // 6. Multiple backslashes ko handle karo
89
+ .replace(/\\\\/g, '\\'); // 7. Generic backslashes last mein
116
90
  }
117
91
 
118
92
  // 2. โœจ JSON Pretty-Print Fix:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongossee",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {