@deveko/devguard 0.1.3 → 0.1.5

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,12 @@ 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
18
20
  - ✅ Clean, readable CLI output
19
21
 
20
22
  ---
@@ -22,7 +24,7 @@ Built with Rust. Fast by default.
22
24
  ## 🚀 Installation
23
25
 
24
26
  ```bash
25
- npx devguard
27
+ npx @deveko/devguard
26
28
  ```
27
29
 
28
30
  That's it. No installation needed.
@@ -35,19 +37,26 @@ Place a `.env` file in your project root, then run:
35
37
 
36
38
  ```bash
37
39
  # Scan default .env
38
- npx devguard check
40
+ npx @deveko/devguard check
39
41
 
40
42
  # Scan a custom path
41
- npx devguard check --path ./apps/backend/.env
43
+ npx @deveko/devguard check --path ./apps/backend/.env
42
44
  ```
43
45
 
44
46
  ### Example `.env`
45
47
 
46
48
  ```env
49
+ TEST2
47
50
  PORT=abc
48
51
  JWT_SECRET=123
49
52
  DATABASE_URL=localhost
50
- NODE_ENV=development
53
+ NODE_ENV=staging
54
+ API_KEY=
55
+ STRIPE_SECRET_KEY=shortkey
56
+ HOST=
57
+ CLIENT_ID=
58
+
59
+ PORT_HOST_KEY=g
51
60
  ```
52
61
 
53
62
  ### Example output
@@ -55,11 +64,18 @@ NODE_ENV=development
55
64
  ```bash
56
65
  🔍 DevGuard - scanning .env...
57
66
 
67
+ ⚠️ 'TEST2' is malformed - missing '='
68
+ ❌ HOST -> must not be empty
69
+ ❌ PORT_HOST_KEY -> must be greater than or equal to 32
70
+ ❌ NODE_ENV -> must be "development" or "production" or "test"
71
+ ❌ API_KEY -> must not be empty
72
+ ❌ DATABASE_URL -> must start with http://, https://, postgres://, postgresql://, mysql://, redis://, rediss://, mongodb://, mongodb+srv://, amqp://, amqps://, sqlite://
73
+ ❌ JWT_SECRET -> must be greater than or equal to 32
74
+ ❌ CLIENT_ID -> must not be empty
75
+ ❌ STRIPE_SECRET_KEY -> must be greater than or equal to 32
58
76
  ❌ 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
77
 
62
- ⚠️ 3 issue(s) found
78
+ ⚠️ 9 error(s) and 1 warning(s) found
63
79
  ```
64
80
 
65
81
  When everything looks good:
@@ -74,14 +90,18 @@ When everything looks good:
74
90
 
75
91
  ## 🧠 How It Works
76
92
 
77
- DevGuard scans your `.env` file line by line and runs pattern-based validation rules:
93
+ DevGuard scans your `.env` file line by line and runs pattern-based validation rules with priority ordering:
78
94
 
79
95
  | Pattern | Rule |
80
96
  | ------- | ---- |
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
-
97
+ | Key is `NODE_ENV` | Must be `development`, `production`, or `test` |
98
+ | Key contains `SECRET` or `KEY` or `API` | Value must be 32 characters |
99
+ | Key contains `URL` | Must start with a valid protocol (http, postgres, redis, etc.) |
100
+ | Key contains `PORT` | Must be a valid number (0-65535) |
101
+ | Key contains `HOST` | Must not be empty |
102
+ | Key contains `ID` | Must not be empty |
103
+
104
+ Rules are checked in priority order — first match wins.
85
105
  No config needed. Just run it.
86
106
 
87
107
  ---
@@ -93,6 +113,10 @@ No config needed. Just run it.
93
113
  - [x] CLI output with colors
94
114
  - [x] `npx devguard` via npm
95
115
  - [x] `--path` option for custom `.env` paths
116
+ - [x] Malformed line detection
117
+ - [x] Improved error summary
118
+ - [x] New validation rules
119
+ - [x] Priority system
96
120
  - [ ] Custom rules via `devguard.config.toml`
97
121
  - [ ] CI/CD integration
98
122
  - [ ] GitHub Action
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deveko/devguard",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "A fast .env scanner for Node.js projects",
5
5
  "bin": {
6
6
  "devguard": "cli.js"