nodewise 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -1,3 +1,7 @@
1
+ <p align="center">
2
+ <img src="logo.png" alt="NodeWise Logo" width="200px">
3
+ </p>
4
+
1
5
  # nodewise
2
6
 
3
7
  > Node.js error explainer with AI-powered clarity
@@ -67,6 +71,9 @@ Traditional error messages can be cryptic, long, or stacked with irrelevant inte
67
71
 
68
72
  ## 📋 Example Output
69
73
 
74
+ <img width="1836" height="694" alt="Screenshot 2026-02-15 223424" src="https://github.com/user-attachments/assets/412f60cf-5ab6-4662-8a0a-1f92145f2485" />
75
+
76
+
70
77
  ✦ GEMINI INTELLIGENCE
71
78
  ─────────────────────────────────────────────
72
79
 
package/bin/nodewise.js CHANGED
@@ -26,7 +26,7 @@ function parseArgs() {
26
26
  setup: false,
27
27
  reset: false
28
28
  };
29
-
29
+
30
30
  let scriptPath = null;
31
31
  const scriptArgs = [];
32
32
 
@@ -78,13 +78,14 @@ ${chalk.bold('MODES')}
78
78
  ${chalk.cyan('Normal Detection')} - Pattern-based error detection (offline)
79
79
 
80
80
  ${chalk.bold('CONFIGURATION')}
81
- Settings are saved in ${chalk.yellow('nodewise.config.json')} in your project root.
81
+ Settings are saved in ${chalk.yellow('node_modules/.nodewise.config.json')} (if available)
82
+ or ${chalk.yellow('.nodewise.config.json')} in your project root.
83
+ This ensures your API keys are not accidentally committed to version control.
82
84
 
83
85
  ${chalk.bold('DOCUMENTATION')}
84
86
  https://github.com/yourusername/nodewise
85
87
  `);
86
88
  }
87
-
88
89
  /**
89
90
  * Display version
90
91
  */
package/logo.png ADDED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodewise",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Node.js error explainer with AI-powered clarity",
5
5
  "main": "src/index.js",
6
6
  "type": "commonjs",
@@ -22,17 +22,19 @@
22
22
  "author": "Gourab Das",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "inquirer": "^9.2.15",
26
25
  "axios": "^1.6.5",
26
+ "chalk": "^4.1.2",
27
27
  "chokidar": "^3.5.3",
28
- "chalk": "^4.1.2"
28
+ "inquirer": "^9.2.15"
29
29
  },
30
30
  "files": [
31
31
  "bin",
32
32
  "src",
33
33
  "examples",
34
34
  "README.md",
35
- "USER_MANUAL.md"
35
+ "USER_MANUAL.md",
36
+ "logo.png",
37
+ "LICENSE"
36
38
  ],
37
39
  "repository": {
38
40
  "type": "git",
@@ -42,8 +44,7 @@
42
44
  "url": "https://github.com/Gourab2005/nodewise/issues"
43
45
  },
44
46
  "homepage": "https://github.com/Gourab2005/nodewise#readme",
45
- "devDependencies": {},
46
47
  "engines": {
47
48
  "node": ">=18.0.0"
48
49
  }
49
- }
50
+ }
package/src/config.js CHANGED
@@ -9,13 +9,47 @@ const fs = require('fs');
9
9
  const path = require('path');
10
10
 
11
11
  const CONFIG_FILE = 'nodewise.config.json';
12
+ const HIDDEN_CONFIG_FILE = '.nodewise.config.json';
12
13
 
13
14
  /**
14
15
  * Get the configuration file path
15
- * Looks in current working directory
16
+ * Prioritizes node_modules to avoid accidental git commits
16
17
  */
17
18
  function getConfigPath() {
18
- return path.join(process.cwd(), CONFIG_FILE);
19
+ const cwd = process.cwd();
20
+ const nodeModulesPath = path.join(cwd, 'node_modules');
21
+ const nodeModulesConfig = path.join(nodeModulesPath, HIDDEN_CONFIG_FILE);
22
+ const rootHiddenConfig = path.join(cwd, HIDDEN_CONFIG_FILE);
23
+ const rootLegacyConfig = path.join(cwd, CONFIG_FILE);
24
+
25
+ // 1. Check if config already exists in node_modules
26
+ if (fs.existsSync(nodeModulesConfig)) {
27
+ return nodeModulesConfig;
28
+ }
29
+
30
+ // 2. Check if hidden config exists in root
31
+ if (fs.existsSync(rootHiddenConfig)) {
32
+ return rootHiddenConfig;
33
+ }
34
+
35
+ // 3. Check if legacy config exists in root
36
+ if (fs.existsSync(rootLegacyConfig)) {
37
+ return rootLegacyConfig;
38
+ }
39
+
40
+ // 4. For NEW configs:
41
+ // If node_modules exists, use it (recommended for security)
42
+ if (fs.existsSync(nodeModulesPath)) {
43
+ try {
44
+ // Ensure node_modules exists (redundant but safe)
45
+ return nodeModulesConfig;
46
+ } catch (e) {
47
+ // Fallback to root if node_modules is not writable
48
+ }
49
+ }
50
+
51
+ // Final fallback to hidden root config
52
+ return rootHiddenConfig;
19
53
  }
20
54
 
21
55
  /**
@@ -163,5 +197,6 @@ module.exports = {
163
197
  mergeWithDefaults,
164
198
  createConfig,
165
199
  updateConfig,
166
- CONFIG_FILE
200
+ CONFIG_FILE,
201
+ HIDDEN_CONFIG_FILE
167
202
  };
@@ -87,12 +87,12 @@ function displayExplanation(explanation) {
87
87
 
88
88
  // High-end minimalist styling
89
89
  // If it starts with a keyword, add a line break before it to create gaps between sections
90
- if (/^(Summary|Problem|Cause|Solution|Fix|Where|Why|File|Line|Note|Suggestion):/i.test(content)) {
90
+ if (/^(Summary|Problem|Cause|Solution|Fix|Where|Why|File|Line|Note|Suggestion|Minimal code fix|Code):/i.test(content)) {
91
91
  console.log();
92
92
  }
93
93
 
94
94
  content = content
95
- .replace(/^(Summary|Problem|Cause|Solution|Fix|Where|Why|File|Line|Note|Suggestion):/i, (match) => chalk.hex('#FFAF00').bold(match))
95
+ .replace(/^(Summary|Problem|Cause|Solution|Fix|Where|Why|File|Line|Note|Suggestion|Minimal code fix|Code):/i, (match) => chalk.hex('#FFAF00').bold(match))
96
96
  .replace(/`([^`]+)`/g, (match) => chalk.hex('#00FF87')(match))
97
97
  .replace(/'([^']+)'/g, (match) => chalk.hex('#00FF87')(match));
98
98
 
package/USER_MANUAL.md DELETED
@@ -1,106 +0,0 @@
1
- # 📖 NodeWise User Manual
2
-
3
- Welcome to **NodeWise**, your AI-powered companion for Node.js development. This manual will help you get the most out of NodeWise's error explanation and auto-restart features.
4
-
5
- ---
6
-
7
- ## 🚀 Getting Started
8
-
9
- NodeWise is designed to be a drop-in replacement for `node` or `nodemon` during development.
10
-
11
- ### Installation
12
- If you haven't already, you can link it globally or install it in your project:
13
- ```bash
14
- # Link for local development
15
- npm link
16
-
17
- # Install as a dev dependency
18
- npm install -D nodewise
19
- ```
20
-
21
- ### Initial Setup
22
- The first time you run NodeWise, it will launch a setup wizard to configure your preferred explanation mode.
23
- ```bash
24
- npx nodewise --setup
25
- ```
26
-
27
- ---
28
-
29
- ## 🤖 Explanation Modes
30
-
31
- ### 1. Gemini Explainer (AI-Powered)
32
- The "Top-G" mode. It uses Google's latest Gemini models to analyze your specific code and provide context-aware fixes.
33
-
34
- * **Setup**: Requires a free Gemini API Key from [Google AI Studio](https://aistudio.google.com/app/apikey).
35
- * **Best for**: Complex logic errors, obscure Node.js core errors, and step-by-step fix guides.
36
- * **Features**: Beautiful minimalist terminal output with neon highlighting.
37
-
38
- ### 2. Normal Detection (Offline)
39
- A lightning-fast, pattern-based mode that works entirely offline.
40
-
41
- * **Setup**: No setup required.
42
- * **Best for**: Common errors like `MODULE_NOT_FOUND`, `TypeError`, and `ReferenceError`.
43
- * **Features**: Zero latency, works without an internet connection.
44
-
45
- ---
46
-
47
- ## ⌨️ Command Line Interface
48
-
49
- | Command | Description |
50
- | :--- | :--- |
51
- | `nodewise <script.js>` | Run a script with auto-restart and error explainer. |
52
- | `nodewise --setup` | Change modes or update your Gemini API key. |
53
- | `nodewise --reset` | Wipe configuration and start fresh. |
54
- | `nodewise --help` | Show available options and examples. |
55
- | `nodewise -v` | Check your current NodeWise version. |
56
-
57
- ### Running with Arguments
58
- You can pass arguments to your script just like you would with node:
59
- ```bash
60
- nodewise server.js --port 3000 --env production
61
- ```
62
-
63
- ---
64
-
65
- ## ⚙️ Configuration
66
- NodeWise saves your preferences in `nodewise.config.json` in your project root.
67
-
68
- ```json
69
- {
70
- "mode": "gemini",
71
- "gemini": {
72
- "apiKey": "YOUR_KEY_HERE"
73
- },
74
- "autoRestart": true,
75
- "ignorePatterns": ["node_modules", ".git"],
76
- "timeout": 60000
77
- }
78
- ```
79
-
80
- * **autoRestart**: Set to `false` if you don't want the process to restart on file changes.
81
- * **timeout**: Increase this if the AI is taking too long to respond on slow connections.
82
-
83
- ---
84
-
85
- ## ✨ Pro Tips
86
-
87
- ### 1. Minimalist AI Insight
88
- When a crash occurs in Gemini mode, you'll see a clean, gapped output. We've removed bulky boxes to keep your terminal clean. Look for the **✦ GEMINI INTELLIGENCE** header.
89
-
90
- ### 2. Auto-Restart
91
- NodeWise watches your `.js` and `.json` files. As soon as you save a fix, NodeWise will instantly restart your application, allowing for a rapid "Code-Crash-Fix-Repeat" cycle.
92
-
93
- ### 3. Graceful Exit
94
- Use `Ctrl+C` to shut down both your application and the NodeWise watcher gracefully.
95
-
96
- ---
97
-
98
- ## 🆘 Troubleshooting
99
-
100
- * **API Timeouts**: If you see "Gemini timed out," check your internet connection or increase the `timeout` in `nodewise.config.json`.
101
- * **Invalid Key**: Ensure your API key is correct by re-running `nodewise --setup`.
102
- * **Files not watching**: Ensure the directory you are working in doesn't have an ignore pattern matching your files.
103
-
104
- ---
105
-
106
- *Made with ❤️ for Node.js developers.*