@deveko/devguard 0.1.4 → 0.1.6

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
@@ -11,10 +11,13 @@ Built with Rust. Fast by default.
11
11
  ## ✨ Features
12
12
 
13
13
  - 🔍 Scans your `.env` file instantly
14
- - ❌ Detects weak secrets (e.g. `JWT_SECRET` too short)
14
+ - ❌ Detects weak secrets (`SECRET`, `KEY`, `API` too short)
15
15
  - ❌ Catches invalid port values (e.g. `PORT=abc`)
16
16
  - ❌ Flags malformed URLs (e.g. `DATABASE_URL=localhost`)
17
- - ⚠️ Warns about empty or malformed variables
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`
18
21
  - ✅ Clean, readable CLI output
19
22
 
20
23
  ---
@@ -22,7 +25,7 @@ Built with Rust. Fast by default.
22
25
  ## 🚀 Installation
23
26
 
24
27
  ```bash
25
- npx devguard
28
+ npx @deveko/devguard
26
29
  ```
27
30
 
28
31
  That's it. No installation needed.
@@ -35,19 +38,29 @@ Place a `.env` file in your project root, then run:
35
38
 
36
39
  ```bash
37
40
  # Scan default .env
38
- npx devguard check
41
+ npx @deveko/devguard check
39
42
 
40
43
  # Scan a custom path
41
- npx devguard check --path ./apps/backend/.env
44
+ npx @deveko/devguard check --path ./apps/backend/.env
45
+
46
+ # Generate .env.example from .env
47
+ npx @deveko/devguard init
42
48
  ```
43
49
 
44
50
  ### Example `.env`
45
51
 
46
52
  ```env
53
+ TEST2
47
54
  PORT=abc
48
55
  JWT_SECRET=123
49
56
  DATABASE_URL=localhost
50
- NODE_ENV=development
57
+ NODE_ENV=staging
58
+ API_KEY=
59
+ STRIPE_SECRET_KEY=shortkey
60
+ HOST=
61
+ CLIENT_ID=
62
+
63
+ PORT_HOST_KEY=g
51
64
  ```
52
65
 
53
66
  ### Example output
@@ -55,11 +68,18 @@ NODE_ENV=development
55
68
  ```bash
56
69
  🔍 DevGuard - scanning .env...
57
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
58
80
  ❌ PORT -> must be a number
59
- ❌ JWT_SECRET -> must be greater than or equal to 32 characters
60
- ❌ DATABASE_URL -> must start with http://, https://, postgres://, mysql://
61
81
 
62
- ⚠️ 3 issue(s) found
82
+ ⚠️ 9 error(s) and 1 warning(s) found
63
83
  ```
64
84
 
65
85
  When everything looks good:
@@ -74,14 +94,18 @@ When everything looks good:
74
94
 
75
95
  ## 🧠 How It Works
76
96
 
77
- DevGuard scans your `.env` file line by line and runs pattern-based validation rules:
97
+ DevGuard scans your `.env` file line by line and runs pattern-based validation rules with priority ordering:
78
98
 
79
99
  | Pattern | Rule |
80
100
  | ------- | ---- |
81
- | Key contains `SECRET` | Value must be 32 characters |
82
- | Key contains `PORT` | Value must be a valid number |
83
- | Key contains `URL` | Value must start with a valid protocol |
84
-
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.
85
109
  No config needed. Just run it.
86
110
 
87
111
  ---
@@ -93,6 +117,12 @@ No config needed. Just run it.
93
117
  - [x] CLI output with colors
94
118
  - [x] `npx devguard` via npm
95
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
96
126
  - [ ] Custom rules via `devguard.config.toml`
97
127
  - [ ] CI/CD integration
98
128
  - [ ] GitHub Action
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deveko/devguard",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "A fast .env scanner for Node.js projects",
5
5
  "bin": {
6
6
  "devguard": "cli.js"