@devshub198211/devguard 2.0.1 → 2.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.
Files changed (3) hide show
  1. package/MODULES.md +122 -0
  2. package/SETUP.md +168 -0
  3. package/package.json +4 -2
package/MODULES.md ADDED
@@ -0,0 +1,122 @@
1
+ # DevGuard — Module Reference Guide
2
+
3
+ DevGuard is a zero-dependency toolkit containing 15 production-grade modules for Security, AI, Auth, and Developer Experience (DX).
4
+
5
+ ---
6
+
7
+ ## 🛡️ 1. Security Modules
8
+
9
+ ### lockfile-guardian
10
+ * **What it does:** Prevents "Supply Chain Attacks" by ensuring your `package-lock.json` hasn't been tampered with.
11
+ * **Usefulness:** Critical for CI/CD to prevent malicious code from sneaking into your build.
12
+ * **Example:**
13
+ ```typescript
14
+ import { verifyLockfile } from 'devguard';
15
+ const result = verifyLockfile(); // Returns { valid: true/false }
16
+ ```
17
+
18
+ ### hook-scanner
19
+ * **What it does:** Scans all `node_modules` for malicious install hooks (preinstall/postinstall).
20
+ * **Usefulness:** Stops malware from running on your machine immediately after `npm install`.
21
+ * **Example:**
22
+ ```bash
23
+ devguard scan
24
+ ```
25
+
26
+ ### token-rotator
27
+ * **What it does:** Monitors your environment variables (NPM_TOKEN, etc.) for expiration and stale usage.
28
+ * **Usefulness:** Reduces the risk of a leaked token being used forever.
29
+ * **Example:**
30
+ ```bash
31
+ devguard check # automatically alerts if tokens are > 30 days old
32
+ ```
33
+
34
+ ### dep-pincer
35
+ * **What it does:** Enforces "Exact Pinning" for your dependencies (removes `^` and `~`).
36
+ * **Usefulness:** Ensures your production build is 100% identical to your local build.
37
+ * **Example:**
38
+ ```bash
39
+ devguard pin --fix
40
+ ```
41
+
42
+ ---
43
+
44
+ ## 🤖 2. AI & Agent Modules
45
+
46
+ ### agent-schema
47
+ * **What it does:** Type-safe JSON schema builder for LLM Tool Calling (Function calling).
48
+ * **Usefulness:** Ensures AI models send perfectly formatted data to your backend tools.
49
+ * **Example:**
50
+ ```typescript
51
+ const tool = s.obj({
52
+ city: s.str().desc("The city name")
53
+ });
54
+ ```
55
+
56
+ ### mcp-server-kit
57
+ * **What it does:** Build "Model Context Protocol" servers over standard input/output.
58
+ * **Usefulness:** Connect your custom tools and data directly to Claude, ChatGPT, or other AI agents.
59
+ * **Example:**
60
+ ```typescript
61
+ const server = new MCPServerBuilder("MyServer");
62
+ server.addTool({ name: "get_weather", handler: async () => "Sunny" });
63
+ server.startStdio();
64
+ ```
65
+
66
+ ### refactor-engine
67
+ * **What it does:** AI-powered security and performance refactoring with an interactive review UI.
68
+ * **Usefulness:** One-click optimization of time complexity and security flaws.
69
+ * **Example:**
70
+ ```bash
71
+ devguard refactor src/utils.ts
72
+ ```
73
+
74
+ ### agent-memory & llm-budget
75
+ * **What they do:** Persistent history for AI agents and real-time cost/token tracking.
76
+ * **Usefulness:** Prevents runaway AI costs and allows agents to "remember" users across sessions.
77
+
78
+ ---
79
+
80
+ ## 🔐 3. Auth & Identity Modules
81
+
82
+ ### zero-trust-jwt
83
+ * **What it does:** Ultra-secure JWT issuing and verification.
84
+ * **Usefulness:** Hardened against "Algorithm Confusion" and "Replay Attacks." Uses constant-time comparisons.
85
+ * **Example:**
86
+ ```typescript
87
+ const verifier = new JWTVerifier({ secret: process.env.SECRET });
88
+ const payload = await verifier.verify(token);
89
+ ```
90
+
91
+ ### passkey-node
92
+ * **What it does:** Zero-dependency WebAuthn (Passkey) implementation.
93
+ * **Usefulness:** Allows you to build passwordless login that is immune to phishing.
94
+
95
+ ### bot-fence
96
+ * **What it does:** Smart rate-limiter and IP-based bot detection.
97
+ * **Usefulness:** Protects your login endpoints from brute-force attacks.
98
+
99
+ ---
100
+
101
+ ## 🛠️ 4. DX (Developer Experience)
102
+
103
+ ### env-safe
104
+ * **What it does:** Startup validation for `.env` files with full TypeScript types.
105
+ * **Usefulness:** Prevents your app from starting if a critical secret (like DB_URL) is missing or malformed.
106
+ * **Example:**
107
+ ```typescript
108
+ const env = loadEnv({ PORT: s.num().default(3000) });
109
+ ```
110
+
111
+ ### log-otlp
112
+ * **What it does:** High-performance logger that sends data to OpenTelemetry (Grafana/Honeycomb).
113
+ * **Usefulness:** Cloud-native observability with zero external dependencies.
114
+
115
+ ### api-contract
116
+ * **What it does:** Type-safe fetch and request validation.
117
+ * **Usefulness:** Shares types between your frontend and backend so they never "break" each other.
118
+
119
+
120
+
121
+ ### Its for testing purpous if you like it leave some reviews and also if you got some sugestion you can contact me to Update it i am a student and it was an idea so let me know what i can add more and make it more usefull for developers.
122
+ ### you can contact me at [devs.hub.604@gmail.com]
package/SETUP.md ADDED
@@ -0,0 +1,168 @@
1
+ # devguard — Complete Setup, Publish & Monetisation Guide
2
+
3
+ ## PART 1: Local Setup
4
+
5
+ ### Step 1 — Prerequisites
6
+ ```
7
+ node --version # must be >= 18.0.0
8
+ npm --version # must be >= 9.0.0
9
+ ```
10
+
11
+ ### Step 2 — Unzip & Install
12
+ ```
13
+ unzip devguard-final.zip
14
+ cd devguard-final
15
+ npm install
16
+ ```
17
+
18
+ ### Step 3 — Build
19
+ ```
20
+ npm run build
21
+ ```
22
+ Generates dist/ with CJS + ESM + TypeScript declarations + CLI.
23
+
24
+ ### Step 4 — Test CLI locally
25
+ ```
26
+ node dist/cli.js # full security scan
27
+ node dist/cli.js lockfile snapshot # create integrity baseline
28
+ node dist/cli.js lockfile verify # verify against baseline
29
+ node dist/cli.js hooks # scan for malicious scripts
30
+ node dist/cli.js pins --fix # auto-fix unpinned deps
31
+ node dist/cli.js tokens --live # live API token check
32
+ node dist/cli.js --json # machine-readable output
33
+ node dist/cli.js help # all commands
34
+ ```
35
+
36
+ ### Step 5 — Use in your project
37
+ ```
38
+ npm install devguard
39
+ ```
40
+
41
+ ```typescript
42
+ import { runAllChecks } from 'devguard';
43
+ const report = await runAllChecks();
44
+ console.log(report.score); // 0-100
45
+ if (!report.passedAll) process.exit(1);
46
+ ```
47
+
48
+ ---
49
+
50
+ ## PART 2: Publish to npm
51
+
52
+ ### Step 1 — Create Account
53
+ 1. https://www.npmjs.com/signup
54
+ 2. Verify email
55
+ 3. Enable 2FA (mandatory): https://www.npmjs.com/settings/~/profile
56
+
57
+ ### Step 2 — Login
58
+ ```
59
+ npm login
60
+ npm whoami
61
+ ```
62
+
63
+ ### Step 3 — Check name availability
64
+ ```
65
+ npm info devguard
66
+ ```
67
+ If taken, rename in package.json: "name": "@yourscope/devguard"
68
+
69
+ ### Step 4 — Dry run
70
+ ```
71
+ npm publish --dry-run --access public
72
+ ```
73
+
74
+ ### Step 5 — Publish
75
+ ```
76
+ npm run build
77
+ npm publish --access public
78
+ ```
79
+
80
+ ### Step 6 — Verify
81
+ ```
82
+ npm info devguard
83
+ npx devguard help
84
+ ```
85
+
86
+ ### Step 7 — Update versions
87
+ ```
88
+ npm version patch # 2.0.0 -> 2.0.1
89
+ npm run build
90
+ npm publish --access public
91
+ ```
92
+
93
+ ---
94
+
95
+ ## PART 3: GitHub Setup
96
+
97
+ ```
98
+ git init
99
+ git add .
100
+ git commit -m "feat: devguard v2.0.0"
101
+ gh repo create devguard --public --push
102
+ ```
103
+
104
+ Add CI (.github/workflows/ci.yml):
105
+ ```yaml
106
+ name: CI
107
+ on: [push, pull_request]
108
+ jobs:
109
+ build:
110
+ runs-on: ubuntu-latest
111
+ steps:
112
+ - uses: actions/checkout@v4
113
+ - uses: actions/setup-node@v4
114
+ with: { node-version: '20', cache: 'npm' }
115
+ - run: npm ci && npm run build
116
+ - run: node dist/cli.js --json
117
+ ```
118
+
119
+ ---
120
+
121
+ ## PART 4: Monetisation
122
+
123
+ ### Free (builds audience)
124
+ - GitHub Sponsors: github.com/sponsors/onboarding — $5/$15/$50 tiers
125
+ - Polar.sh: polar.sh — connect repo, create paid issues
126
+ - Target: $200-2000/month at 1k+ weekly downloads
127
+
128
+ ### Pro SaaS ($19-299/month)
129
+ Create @devguard/pro package with:
130
+ - Web dashboard (Next.js + Stripe + Supabase)
131
+ - Slack/email alerts for stale tokens
132
+ - Team management
133
+ - PDF reports
134
+
135
+ Pricing: Indie $19 | Team $79 | Enterprise $299
136
+
137
+ ### GitHub Marketplace Action
138
+ Publish a scan action, charge per CI minute.
139
+ Guide: github.com/marketplace/actions/new
140
+
141
+ ### VS Code Extension
142
+ Inline warnings for ^ ~ deps, missing env vars, security score in status bar.
143
+ Freemium: free basic, paid Pro ($4.99/month).
144
+
145
+ ### Enterprise ($5k-50k/year)
146
+ Commercial license + SLA + private registry + security audits.
147
+
148
+ ---
149
+
150
+ ## PART 5: Marketing
151
+
152
+ Week 1: npm publish + GitHub + post on r/node + Hacker News Show HN
153
+ Week 2: Blog post + awesome-nodejs PR + newsletter outreach
154
+ Month 1: Product Hunt + YouTube demo + devguard.dev landing page
155
+
156
+ ---
157
+
158
+ ## Quick Reference
159
+
160
+ ```
161
+ npm install devguard
162
+
163
+ import { runAllChecks } from 'devguard';
164
+ import { verifyLockfile } from 'devguard/security';
165
+ import { LLMBudget } from 'devguard/ai';
166
+ import { JWTVerifier } from 'devguard/auth';
167
+ import { loadEnv } from 'devguard/dx';
168
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devshub198211/devguard",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "description": "The only Node.js/TypeScript security, AI-tooling, auth & DX package you will ever need. Zero external dependencies. Production-complete.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -41,7 +41,9 @@
41
41
  "dist",
42
42
  "README.md",
43
43
  "LICENSE",
44
- "CHANGELOG.md"
44
+ "CHANGELOG.md",
45
+ "MODULES.md",
46
+ "SETUP.md"
45
47
  ],
46
48
  "scripts": {
47
49
  "build": "tsup src/index.ts src/cli.ts src/security.ts src/ai.ts src/auth.ts src/dx.ts --format cjs,esm --dts --clean --treeshake",