@deveko/devguard 0.1.6 β†’ 0.1.8

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,177 +1,179 @@
1
- # πŸ›‘οΈ DevGuard
2
-
3
- > Catch broken configs before they break your app.
4
-
5
- DevGuard is a fast, zero-config `.env` scanner for Node.js projects. It validates your environment variables and warns you about weak secrets, invalid ports, malformed URLs, and empty values β€” before you ship.
6
-
7
- Built with Rust. Fast by default.
8
-
9
- ---
10
-
11
- ## ✨ Features
12
-
13
- - πŸ” Scans your `.env` file instantly
14
- - ❌ Detects weak secrets (`SECRET`, `KEY`, `API` too short)
15
- - ❌ Catches invalid port values (e.g. `PORT=abc`)
16
- - ❌ Flags malformed URLs (e.g. `DATABASE_URL=localhost`)
17
- - ❌ Validates `NODE_ENV` values
18
- - ⚠️ Warns about empty, malformed, or missing variables
19
- - βœ… Priority-based rule engine
20
- - βœ… Auto-generates `.env.example` from `.env`
21
- - βœ… Clean, readable CLI output
22
-
23
- ---
24
-
25
- ## πŸš€ Installation
26
-
27
- ```bash
28
- npx @deveko/devguard
29
- ```
30
-
31
- That's it. No installation needed.
32
-
33
- ---
34
-
35
- ## πŸ“¦ Usage
36
-
37
- Place a `.env` file in your project root, then run:
38
-
39
- ```bash
40
- # Scan default .env
41
- npx @deveko/devguard check
42
-
43
- # Scan a custom path
44
- npx @deveko/devguard check --path ./apps/backend/.env
45
-
46
- # Generate .env.example from .env
47
- npx @deveko/devguard init
48
- ```
49
-
50
- ### Example `.env`
51
-
52
- ```env
53
- TEST2
54
- PORT=abc
55
- JWT_SECRET=123
56
- DATABASE_URL=localhost
57
- NODE_ENV=staging
58
- API_KEY=
59
- STRIPE_SECRET_KEY=shortkey
60
- HOST=
61
- CLIENT_ID=
62
-
63
- PORT_HOST_KEY=g
64
- ```
65
-
66
- ### Example output
67
-
68
- ```bash
69
- πŸ” DevGuard - scanning .env...
70
-
71
- ⚠️ 'TEST2' is malformed - missing '='
72
- ❌ HOST -> must not be empty
73
- ❌ PORT_HOST_KEY -> must be greater than or equal to 32
74
- ❌ NODE_ENV -> must be "development" or "production" or "test"
75
- ❌ API_KEY -> must not be empty
76
- ❌ DATABASE_URL -> must start with http://, https://, postgres://, postgresql://, mysql://, redis://, rediss://, mongodb://, mongodb+srv://, amqp://, amqps://, sqlite://
77
- ❌ JWT_SECRET -> must be greater than or equal to 32
78
- ❌ CLIENT_ID -> must not be empty
79
- ❌ STRIPE_SECRET_KEY -> must be greater than or equal to 32
80
- ❌ PORT -> must be a number
81
-
82
- ⚠️ 9 error(s) and 1 warning(s) found
83
- ```
84
-
85
- When everything looks good:
86
-
87
- ```bash
88
- πŸ” DevGuard - scanning .env...
89
-
90
- βœ… All checks passed! Your .env looks good!
91
- ```
92
-
93
- ---
94
-
95
- ## 🧠 How It Works
96
-
97
- DevGuard scans your `.env` file line by line and runs pattern-based validation rules with priority ordering:
98
-
99
- | Pattern | Rule |
100
- | ------- | ---- |
101
- | Key is `NODE_ENV` | Must be `development`, `production`, or `test` |
102
- | Key contains `SECRET` or `KEY` or `API` | Value must be β‰₯ 32 characters |
103
- | Key contains `URL` | Must start with a valid protocol (http, postgres, redis, etc.) |
104
- | Key contains `PORT` | Must be a valid number (0-65535) |
105
- | Key contains `HOST` | Must not be empty |
106
- | Key contains `ID` | Must not be empty |
107
-
108
- Rules are checked in priority order β€” first match wins.
109
- No config needed. Just run it.
110
-
111
- ---
112
-
113
- ## πŸ—ΊοΈ Roadmap
114
-
115
- - [x] `.env` parser
116
- - [x] Pattern-based validation engine
117
- - [x] CLI output with colors
118
- - [x] `npx devguard` via npm
119
- - [x] `--path` option for custom `.env` paths
120
- - [x] Malformed line detection
121
- - [x] Improved error summary
122
- - [x] New validation rules
123
- - [x] Priority system
124
- - [x] `devguard init` -> auto-generate `.env.example`
125
- - [ ] Missing required keys detection
126
- - [ ] Custom rules via `devguard.config.toml`
127
- - [ ] CI/CD integration
128
- - [ ] GitHub Action
129
- - [ ] VSCode extension
130
- - [ ] Docker config validation
131
- - [ ] Secret leak detection in source files
132
-
133
- ---
134
-
135
- ## πŸ”§ Local Development
136
-
137
- ```bash
138
- git clone https://github.com/ekojoecovenant/devguard.git
139
- cd devguard
140
- cargo build --release
141
- node cli.js check
142
- ```
143
-
144
- ---
145
-
146
- ## 🀝 Contributing
147
-
148
- Contributions are welcome! Here's how to get started:
149
-
150
- 1. Fork the repo
151
- 2. Create a feature branch
152
-
153
- ```bash
154
- git checkout -b feature/your-feature-name
155
- ```
156
-
157
- 3. Make your changes
158
- 4. Run the project locally to test
159
-
160
- ```bash
161
- cargo build --release
162
- node cli.js check
163
- ```
164
-
165
- 5. Open a Pull Request with a clear description of what you changed and why
166
-
167
- Please keep PRs focused β€” one feature or fix per PR.
168
-
169
- ---
170
-
171
- ## πŸ“„ License
172
-
173
- MIT β€” use it, build on it, ship it.
174
-
175
- ---
176
-
177
- <p align="center">Built with πŸ¦€ Rust β€” by <a href="https://github.com/ekojoecovenant">ℭ𝔬𝔳𝔒</a></p>
1
+ # πŸ›‘οΈ DevGuard
2
+
3
+ > Catch broken configs before they break your app.
4
+
5
+ DevGuard is a fast, zero-config `.env` scanner for Node.js projects. It validates your environment variables and warns you about weak secrets, invalid ports, malformed URLs, and empty values β€” before you ship.
6
+
7
+ Built with Rust. Fast by default.
8
+
9
+ ---
10
+
11
+ ## ✨ Features
12
+
13
+ - πŸ” Scans your `.env` file instantly
14
+ - ❌ Detects weak secrets (`SECRET`, `KEY`, `API` too short)
15
+ - ❌ Catches invalid port values (e.g. `PORT=abc`)
16
+ - ❌ Flags malformed URLs (e.g. `DATABASE_URL=localhost`)
17
+ - ❌ Validates `NODE_ENV` values
18
+ - ⚠️ Warns about empty, malformed, or missing variables
19
+ - βœ… Priority-based rule engine
20
+ - βœ… Auto-generates `.env.example` from `.env`
21
+ - βœ… Clean, readable CLI output
22
+
23
+ ---
24
+
25
+ ## πŸš€ Installation
26
+
27
+ ```bash
28
+ npx @deveko/devguard
29
+ ```
30
+
31
+ That's it. No installation needed.
32
+
33
+ ---
34
+
35
+ ## πŸ“¦ Usage
36
+
37
+ Place a `.env` file in your project root, then run:
38
+
39
+ ```bash
40
+ # Scan default .env
41
+ npx @deveko/devguard check
42
+
43
+ # Scan a custom path
44
+ npx @deveko/devguard check --path ./apps/backend/.env
45
+
46
+ # Generate .env.example from .env
47
+ npx @deveko/devguard init
48
+ ```
49
+
50
+ ### Example `.env`
51
+
52
+ ```env
53
+ TEST2
54
+ PORT=abc
55
+ JWT_SECRET=123
56
+ DATABASE_URL=localhost
57
+ ```
58
+
59
+ ### Example output
60
+
61
+ ```bash
62
+ πŸ” DevGuard - scanning .env...
63
+
64
+ === Warning(s) ===
65
+ ⚠️ 'TEST2' is malformed - missing '='
66
+
67
+ === Error(s) ===
68
+ ❌ PORT -> must be a number
69
+ ❌ JWT_SECRET -> must be greater than or equal to 32
70
+ ❌ DATABASE_URL -> must start with http://, https://, postgres://...
71
+
72
+ === Missing(s) ===
73
+ ❌ REDIS_URL -> missing required variable
74
+
75
+ ⚠️ 4 error(s) and 1 warning(s) found
76
+ ```
77
+
78
+ When everything looks good:
79
+
80
+ ```bash
81
+ πŸ” DevGuard - scanning .env...
82
+
83
+ βœ… All checks passed! Your .env looks good!
84
+ ```
85
+
86
+ ---
87
+
88
+ ## 🧠 How It Works
89
+
90
+ DevGuard runs three checks on your project:
91
+
92
+ **1. Parse Check**
93
+ Scans `.env` line by line for malformed entries
94
+
95
+ **2. Validation Check**
96
+ Runs pattern-based rules with priority ordering:
97
+
98
+ | Pattern | Rule |
99
+ | ------- | ---- |
100
+ | Key is `NODE_ENV` | Must be `development`, `production`, or `test` |
101
+ | Key contains `SECRET` or `KEY` or `API` | Value must be β‰₯ 32 characters |
102
+ | Key contains `URL` | Must start with a valid protocol (http, postgres, redis, etc.) |
103
+ | Key contains `PORT` | Must be a valid number (0-65535) |
104
+ | Key contains `HOST` | Must not be empty |
105
+ | Key contains `ID` | Must not be empty |
106
+
107
+ **3. Missing Keys Check**
108
+ Compares `.env` against `.env.example` - any key in `.env.example` missing from `.env` is flagged!!
109
+
110
+ No config needed. Just run it.
111
+
112
+ ---
113
+
114
+ ## πŸ—ΊοΈ Roadmap
115
+
116
+ - [x] `.env` parser
117
+ - [x] Pattern-based validation engine
118
+ - [x] CLI output with colors
119
+ - [x] `npx devguard` via npm
120
+ - [x] `--path` option for custom `.env` paths
121
+ - [x] Malformed line detection
122
+ - [x] Improved error summary
123
+ - [x] New validation rules
124
+ - [x] Priority system
125
+ - [x] `devguard init` -> auto-generate `.env.example`
126
+ - [x] Missing required keys detection
127
+ - [x] Sectioned output (Warnings, Errors, Missing)
128
+ - [ ] Custom rules via `devguard.config.toml`
129
+ - [ ] CI/CD integration
130
+ - [ ] GitHub Action
131
+ - [ ] VSCode extension
132
+ - [ ] Docker config validation
133
+ - [ ] Secret leak detection in source files
134
+
135
+ ---
136
+
137
+ ## πŸ”§ Local Development
138
+
139
+ ```bash
140
+ git clone https://github.com/ekojoecovenant/devguard.git
141
+ cd devguard
142
+ cargo build --release
143
+ node cli.js check
144
+ ```
145
+
146
+ ---
147
+
148
+ ## 🀝 Contributing
149
+
150
+ Contributions are welcome! Here's how to get started:
151
+
152
+ 1. Fork the repo
153
+ 2. Create a feature branch
154
+
155
+ ```bash
156
+ git checkout -b feature/your-feature-name
157
+ ```
158
+
159
+ 3. Make your changes
160
+ 4. Run the project locally to test
161
+
162
+ ```bash
163
+ cargo build --release
164
+ node cli.js check
165
+ ```
166
+
167
+ 5. Open a Pull Request with a clear description of what you changed and why
168
+
169
+ Please keep PRs focused β€” one feature or fix per PR.
170
+
171
+ ---
172
+
173
+ ## πŸ“„ License
174
+
175
+ MIT β€” use it, build on it, ship it.
176
+
177
+ ---
178
+
179
+ <p align="center">Built with πŸ¦€ Rust β€” by <a href="https://github.com/ekojoecovenant">ℭ𝔬𝔳𝔒</a></p>
Binary file
Binary file
Binary file
package/cli.js CHANGED
@@ -1,23 +1,23 @@
1
- #!/usr/bin/env node
2
-
3
- const path = require('path');
4
- const os = require('os');
5
- const { spawnSync } = require('child_process');
6
-
7
- // detect OS and pick correct binary
8
- const platform = os.platform();
9
- const binaryName =
10
- platform === 'win32'
11
- ? 'devguard-win.exe'
12
- : platform === 'darwin'
13
- ? 'devguard-macos'
14
- : 'devguard-linux';
15
-
16
- const binaryPath = path.join(__dirname, 'bin', binaryName);
17
-
18
- // pass ALL argumets through to RUST binary
19
- const result = spawnSync(binaryPath, process.argv.slice(2), {
20
- stdio: 'inherit',
21
- });
22
-
23
- process.exit(result.status);
1
+ #!/usr/bin/env node
2
+
3
+ const path = require('path');
4
+ const os = require('os');
5
+ const { spawnSync } = require('child_process');
6
+
7
+ // detect OS and pick correct binary
8
+ const platform = os.platform();
9
+ const binaryName =
10
+ platform === 'win32'
11
+ ? 'devguard-win.exe'
12
+ : platform === 'darwin'
13
+ ? 'devguard-macos'
14
+ : 'devguard-linux';
15
+
16
+ const binaryPath = path.join(__dirname, 'bin', binaryName);
17
+
18
+ // pass ALL argumets through to RUST binary
19
+ const result = spawnSync(binaryPath, process.argv.slice(2), {
20
+ stdio: 'inherit',
21
+ });
22
+
23
+ process.exit(result.status);
package/package.json CHANGED
@@ -1,24 +1,24 @@
1
- {
2
- "name": "@deveko/devguard",
3
- "version": "0.1.6",
4
- "description": "A fast .env scanner for Node.js projects",
5
- "bin": {
6
- "devguard": "cli.js"
7
- },
8
- "files": [
9
- "cli.js",
10
- "bin/"
11
- ],
12
- "keywords": [
13
- "env",
14
- "security",
15
- "cli",
16
- "devtools",
17
- "validation"
18
- ],
19
- "author": "Ekojoe Covenant",
20
- "license": "MIT",
21
- "engines": {
22
- "node": ">=14.0.0"
23
- }
24
- }
1
+ {
2
+ "name": "@deveko/devguard",
3
+ "version": "0.1.8",
4
+ "description": "A fast .env scanner for Node.js projects",
5
+ "bin": {
6
+ "devguard": "cli.js"
7
+ },
8
+ "files": [
9
+ "cli.js",
10
+ "bin/"
11
+ ],
12
+ "keywords": [
13
+ "env",
14
+ "security",
15
+ "cli",
16
+ "devtools",
17
+ "validation"
18
+ ],
19
+ "author": "Ekojoe Covenant",
20
+ "license": "MIT",
21
+ "engines": {
22
+ "node": ">=14.0.0"
23
+ }
24
+ }