mongossee 1.0.23 → 1.0.25

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 +25 -20
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4,7 +4,6 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const yargs = require('yargs/yargs');
6
6
  const { hideBin } = require('yargs/helpers');
7
- const { execSync } = require('child_process');
8
7
 
9
8
 
10
9
  const SERVER_URL = "https://mongossee.vercel.app/api/server";
@@ -19,7 +18,22 @@ async function generateProject(prompt, directoryName) {
19
18
 
20
19
 
21
20
  const body = {
22
- prompt: prompt + " . IMPORTANT: Return strictly code only. Do not include any comments, docstrings, or explanations inside the code files."
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
+ 3. TYPESCRIPT RULES: If using TypeScript, define proper Interfaces/Types for Props and State. No "any" type.
30
+ 4. ⛔ NO EXTRA BLOAT: In package.json, include ONLY strictly necessary dependencies (e.g., react, react-dom, react-scripts).
31
+ 5. ❌ REMOVE FALTU STUFF: Do NOT include @testing-library, web-vitals, or eslintConfig. I want a clean, minimal package.json.
32
+ 6. ⛔ ZERO COMMENTS: Return strictly functional code. No // or /* */ comments, and no explanations.
33
+ 7. 📁 ARCHITECTURE: If the prompt mentions Parent/Child or Props, strictly follow React best practices (state in parent, props to child, arrow functions for events).
34
+ 8. 📄 FORMAT: Return ONLY a valid JSON array of objects: [{"filename": "string", "code": "string"}].
35
+ 9. 🚫 NO MARKDOWN: Do not wrap the response in \`\`\`json blocks.
36
+ `
23
37
  };
24
38
 
25
39
  try {
@@ -39,7 +53,15 @@ async function generateProject(prompt, directoryName) {
39
53
  const errorMessage = data.error || 'Unknown Server Error';
40
54
  console.error(`\n❌ Server Error: ${errorMessage}`);
41
55
  if (data.raw_response) {
42
- console.log("Raw Output (Debug):", data.raw_response);
56
+ console.log("Raw Output (Debug):");
57
+ try {
58
+ // AI ka response agar markdown mein ho toh clean karke parse karein
59
+ const cleanRaw = data.raw_response.replace(/```json|```/g, "").trim();
60
+ const prettyJson = JSON.stringify(JSON.parse(cleanRaw), null, 2);
61
+ console.log(prettyJson);
62
+ } catch (e) {
63
+ console.log("Raw Response:", data.raw_response);
64
+ }
43
65
  }
44
66
  return; // Stop here
45
67
  }
@@ -73,23 +95,6 @@ async function generateProject(prompt, directoryName) {
73
95
  //console.log(`Created file: ${filePath}`);
74
96
  }
75
97
 
76
- const hasPackageJson = files.some(file => file.filename === 'package.json');
77
-
78
-
79
- if (hasPackageJson) {
80
- console.log(`📦 package.json detected. Installing dependencies...`);
81
- try {
82
- // Folder ke andar jaakar npm install chalao
83
- execSync('npm install', {
84
- cwd: directoryName,
85
- stdio: 'inherit' // Taaki installation progress dikhe
86
- });
87
- console.log(`\n✅ All dependencies installed!`);
88
- } catch (err) {
89
- console.error(`\n⚠️ NPM Install failed. Please run 'npm install' manually inside "${directoryName}".`);
90
- }
91
- }
92
-
93
98
  // console.log(`\n Project "${directoryName}" created successfully!`);
94
99
 
95
100
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongossee",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {