devanvil 0.0.0-stage → 2.1.1

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 (93) hide show
  1. package/LICENSE +21 -0
  2. package/README.ar.md +113 -0
  3. package/README.md +272 -2
  4. package/SECURITY.md +49 -0
  5. package/dist/cli.d.ts +2 -0
  6. package/dist/cli.js +664 -0
  7. package/dist/core/contract-drift.d.ts +49 -0
  8. package/dist/core/contract-drift.js +312 -0
  9. package/dist/core/converters.d.ts +18 -0
  10. package/dist/core/converters.js +989 -0
  11. package/dist/core/cron.d.ts +33 -0
  12. package/dist/core/cron.js +309 -0
  13. package/dist/core/crypto.d.ts +59 -0
  14. package/dist/core/crypto.js +260 -0
  15. package/dist/core/curl.d.ts +17 -0
  16. package/dist/core/curl.js +174 -0
  17. package/dist/core/diff.d.ts +36 -0
  18. package/dist/core/diff.js +148 -0
  19. package/dist/core/encoding.d.ts +3 -0
  20. package/dist/core/encoding.js +143 -0
  21. package/dist/core/importers.d.ts +65 -0
  22. package/dist/core/importers.js +361 -0
  23. package/dist/core/jwt.d.ts +39 -0
  24. package/dist/core/jwt.js +269 -0
  25. package/dist/core/llm-tokens.d.ts +38 -0
  26. package/dist/core/llm-tokens.js +125 -0
  27. package/dist/core/log-analyzer.d.ts +30 -0
  28. package/dist/core/log-analyzer.js +155 -0
  29. package/dist/core/network.d.ts +72 -0
  30. package/dist/core/network.js +185 -0
  31. package/dist/core/oauth-protobuf.d.ts +74 -0
  32. package/dist/core/oauth-protobuf.js +396 -0
  33. package/dist/core/openapi.d.ts +27 -0
  34. package/dist/core/openapi.js +257 -0
  35. package/dist/core/pipeline.d.ts +28 -0
  36. package/dist/core/pipeline.js +154 -0
  37. package/dist/core/regex.d.ts +50 -0
  38. package/dist/core/regex.js +360 -0
  39. package/dist/core/runner.d.ts +53 -0
  40. package/dist/core/runner.js +250 -0
  41. package/dist/core/secrets.d.ts +87 -0
  42. package/dist/core/secrets.js +603 -0
  43. package/dist/core/security.d.ts +34 -0
  44. package/dist/core/security.js +301 -0
  45. package/dist/core/sql-explain.d.ts +50 -0
  46. package/dist/core/sql-explain.js +259 -0
  47. package/dist/core/tls.d.ts +44 -0
  48. package/dist/core/tls.js +169 -0
  49. package/dist/index.d.ts +31 -0
  50. package/dist/index.js +31 -0
  51. package/dist/server/app.d.ts +31 -0
  52. package/dist/server/app.js +359 -0
  53. package/dist/server/http-proxy.d.ts +55 -0
  54. package/dist/server/http-proxy.js +373 -0
  55. package/dist/server/http-utils.d.ts +28 -0
  56. package/dist/server/http-utils.js +118 -0
  57. package/dist/server/load-tester.d.ts +53 -0
  58. package/dist/server/load-tester.js +137 -0
  59. package/dist/server/mcp.d.ts +35 -0
  60. package/dist/server/mcp.js +470 -0
  61. package/dist/server/mock-store.d.ts +38 -0
  62. package/dist/server/mock-store.js +238 -0
  63. package/dist/server/plugin-loader.d.ts +61 -0
  64. package/dist/server/plugin-loader.js +305 -0
  65. package/dist/server/recorder-store.d.ts +35 -0
  66. package/dist/server/recorder-store.js +147 -0
  67. package/dist/server/routes/network-routes.d.ts +3 -0
  68. package/dist/server/routes/network-routes.js +441 -0
  69. package/dist/server/routes/tools-routes.d.ts +3 -0
  70. package/dist/server/routes/tools-routes.js +299 -0
  71. package/dist/server/routes/workspace-routes.d.ts +3 -0
  72. package/dist/server/routes/workspace-routes.js +262 -0
  73. package/dist/server/webhook-store.d.ts +29 -0
  74. package/dist/server/webhook-store.js +100 -0
  75. package/dist/server/workspace-store.d.ts +91 -0
  76. package/dist/server/workspace-store.js +448 -0
  77. package/dist/server/ws-probe.d.ts +34 -0
  78. package/dist/server/ws-probe.js +291 -0
  79. package/dist/ui/app.js +290 -0
  80. package/dist/ui/favicon.svg +14 -0
  81. package/dist/ui/index.html +83 -0
  82. package/dist/ui/logo.png +0 -0
  83. package/dist/ui/styles.css +694 -0
  84. package/dist/ui/tools-data.js +719 -0
  85. package/dist/ui/tools-network.js +769 -0
  86. package/dist/ui/tools-ops.js +299 -0
  87. package/dist/ui/tools-pro.js +500 -0
  88. package/dist/ui/tools-security.js +397 -0
  89. package/dist/ui/tools-v12.js +765 -0
  90. package/dist/ui/tools-v13.js +321 -0
  91. package/dist/ui/tools-v20.js +563 -0
  92. package/dist/ui/tools-v21.js +411 -0
  93. package/package.json +75 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 abd77o
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.ar.md ADDED
@@ -0,0 +1,113 @@
1
+ <div align="center" dir="rtl">
2
+
3
+ [English](README.md) · **العربية**
4
+
5
+ <img src="docs/hero-banner.png" alt="DevAnvil — استوديو مطورين محلي بالكامل بدون أي مكتبات خارجية" width="100%" />
6
+
7
+ <br />
8
+
9
+ [![Live Playground](https://img.shields.io/badge/Live_Playground-Try_in_Browser-f59e0b?style=for-the-badge)](https://abd77o.github.io/devanvil/)
10
+ [![Zero Runtime Deps](https://img.shields.io/badge/Runtime_Deps-0-10b981?style=for-the-badge)](package.json)
11
+ [![License: MIT](https://img.shields.io/badge/License-MIT-38bdf8?style=for-the-badge)](LICENSE)
12
+
13
+ **توقّف عن لصق الـ JWT ومفاتيح `.env` وملفات OpenAPI وسجلات الإنتاج في مواقع مليئة بالإعلانات والتتبع.**
14
+ **DevAnvil v2.1** هو منصة مطورين محلية **أوفلاين 100%** مع **صفر مكتبات تشغيل خارجية (`0 dependencies`)**، تجمع **18 استوديو احترافيًا** + **خادم MCP لوكلاء الذكاء الاصطناعي (16 أداة)** + **كاشف OpenAPI Contract Drift + مسجّل ترافيك API** + **محلّل OAuth2 PKCE و Protobuf الثنائي** + **اختبار ضغط HTTP ببوابات CI** + **محلل SQL EXPLAIN** + **محلل Logs** + **إضافات محلية معزولة بـ Worker Threads + VM**!
15
+
16
+ <br />
17
+
18
+ <img src="docs/demo.gif" alt="استعراض متحرك لأداة DevAnvil" width="92%" />
19
+
20
+ </div>
21
+
22
+ ---
23
+
24
+ <div dir="rtl">
25
+
26
+ ## جرّب فورًا في 10 ثوانٍ
27
+
28
+ ### 1. التشغيل الفوري عبر `npx` / `npm` أو `Homebrew` (الأسرع — Node.js 20+)
29
+
30
+ ```bash
31
+ npx devanvil serve
32
+ # أو التثبيت العالمي:
33
+ npm install -g devanvil && devanvil serve
34
+ # أو على macOS / Linux عبر Homebrew:
35
+ brew install abd77o/tap/devanvil && devanvil serve
36
+ ```
37
+
38
+ ### 2. تجربة فورية في المتصفح (بدون تثبيت)
39
+ 👉 **[افتح DevAnvil Live Playground](https://abd77o.github.io/devanvil/)** — يعمل بالكامل داخل متصفحك بدون إرسال أي بيانات للإنترنت.
40
+
41
+ ### 3. التثبيت المحلي بسطر واحد أو عبر Docker المُحصّن
42
+
43
+ ```bash
44
+ curl -fsSL https://raw.githubusercontent.com/abd77o/devanvil/main/install.sh | bash
45
+ # أو Docker:
46
+ git clone https://github.com/abd77o/devanvil.git && cd devanvil && docker compose up -d
47
+ ```
48
+
49
+ ثم افتح **`http://127.0.0.1:4321`** واضغط **`⌘K`** أو **`Ctrl+K`** للتنقل الفوري بين الـ **18 استوديو**.
50
+
51
+ ---
52
+
53
+ ## لقطات من استوديوهات DevAnvil
54
+
55
+ ### تحويل OpenAPI إلى Live Mock Server بضغطة زر
56
+ <div align="center">
57
+ <img src="docs/studio-openapi.png" alt="استوديو OpenAPI إلى Live Mock في DevAnvil" width="100%" />
58
+ </div>
59
+
60
+ ### فاحص الأسرار وملفات `.env` أوفلاين + إخفاء فوري
61
+ <div align="center">
62
+ <img src="docs/studio-secrets.png" alt="استوديو فحص وإخفاء الأسرار في DevAnvil" width="100%" />
63
+ </div>
64
+
65
+ ### استوديو حساب توكنز وتكلفة نماذج الذكاء الاصطناعي (LLM)
66
+ <div align="center">
67
+ <img src="docs/studio-llm.png" alt="استوديو توكنز وتكلفة نماذج الذكاء الاصطناعي" width="100%" />
68
+ </div>
69
+
70
+ ---
71
+
72
+ ## الـ 17 استوديو المدمجة (إصدار v2.0)
73
+
74
+ 1. **Load Bench & SQL Explain (جديد في v2.0)**: **مختبر ضغط HTTP متزامن (`devanvil load`)** لحساب RPS و P50/P90/P95/P99 ومخطط Histogram بحماية SSRF + **محلّل ومصوّر خطط استعلامات PostgreSQL و SQLite (`devanvil explain`)** لكشف Seq Scans و Disk Sorts وأخطاء التقدير تلقائيًا!
75
+ 2. **Log Analyzer & Zero-Trust Plugins (جديد في v2.0)**: **محلّل ملفات NDJSON / Server Logs (`devanvil logs`)** مع توحيد بصمات الأخطاء (Error Fingerprinting) وحساب P95 وكشف الأسرار المسربة + **نظام إضافات محلية معزول بـ `node:vm` (`~/.devanvil/plugins`)** بدون صلاحيات ملفات أو شبكة وبمهلة 500ms.
76
+ 3. **Workspaces, Import & MCP**: مساحات عمل متوافقة مع Git (`devanvil.json`) تدعم **`{{env.VAR}}`** و **`devanvil.local.json`** + تدقيق أسرار تلقائي + **نسخ مشفّرة `.anvil` (AES-256-GCM)** + **مشغّل اختبارات Collections مع Request Chaining و JUnit XML (`devanvil run`)** + استيراد **Postman/HAR/`.http`** + خادم **MCP (`devanvil mcp` — 14 أداة أوفلاين)**.
77
+ 4. **TLS, GraphQL & WebSocket**: فاحص شهادات **X.509 / SSL** (أوفلاين PEM أو حي محمي بـ SSRF) + استوديو **GraphQL** مع Schema Introspection + مختبر **WebSocket (RFC 6455)**.
78
+ 5. **OpenAPI -> Mock Server**: تحويل OpenAPI 3.x / Swagger إلى سيرفر Mock حي على `/mock/*` بضغطة زر.
79
+ 6. **Secret & `.env` Guard**: فاحص أوفلاين لـ 18 نوعًا من الأسرار + **`devanvil scan --staged --sarif`** + `.devanvilignore` + `devanvil-ignore` + فاحص `.env`.
80
+ 7. **LLM Token & Context Budget Studio**: تقدير أوفلاين للتوكنز وتكلفة Claude/GPT/Gemini/Llama مع ضغط السياق.
81
+ 8. **API Studio**: عميل HTTP/HTTPS بدون قيود CORS + **Record-as-Mock** + **SSE Stream Tester (TTFT)** + متغيرات البيئة وتوليد كود بـ 4 لغات.
82
+ 9. **Live Mock & SSE Webhooks**: سيرفر Mock ديناميكي + ملتقط Webhooks لحظي عبر SSE مع Replay -> API Studio.
83
+ 10. **JWT Studio**: فك التشفير، تدقيق أمني آلي، توقيع/تحقق HS/RS/ES وتوليد مفاتيح.
84
+ 11. **Crypto, Encoding & IDs**: تشفير AES-256-GCM، هاشات SHA/BLAKE2/HMAC، كلمات مرور CSPRNG، UUIDv7/ULID/NanoID و 10 ترميزات.
85
+ 12. **Data Studio**: تحويل JSON ↔ YAML ↔ TOML ↔ CSV ↔ Query + **مستكشف شجرة JSON التفاعلي** + TypeScript & JSON Schema + JSONPath + SQL Formatter.
86
+ 13. **Diff Studio**: مقارنة سطور LCS + مقارنة هيكلية ذكية للـ JSON.
87
+ 14. **Regex & ReDoS Lab**: اختبار Regex مع كشف ReDoS وعزل `node:vm` بمهلة 250ms.
88
+ 15. **Pipeline Lab**: ربط حتى 25 خطوة من 31 عملية مع وصفات جاهزة.
89
+ 16. **Cron & Time Studio**: شرح وتوقع Cron + محوّل طوابع زمنية تلقائي.
90
+ 17. **Network, Chmod & Color**: حاسبة CIDR، مصفوفة `chmod`، فاحص تباين WCAG 2.1 وأكواد HTTP.
91
+
92
+ ---
93
+
94
+ ## المعمارية والأمان والأداء
95
+
96
+ <div align="center">
97
+ <img src="docs/architecture.png" alt="معمارية DevAnvil المكونة من 4 طبقات" width="100%" />
98
+ </div>
99
+
100
+ - **صفر مكتبات خارجية (`dependencies: {}`)** و **0 ثغرات** في `npm audit`.
101
+ - **حماية SSRF + DNS Pinning**، **Strict CSP بدون أي `innerHTML`**، حماية **Prototype Pollution**، وحماية **Slowloris** و **ReDoS**.
102
+ - **29/29 اختبار آلي ناجح** تشمل اختبارات اختراق أمني وتكامل SSE و CLI.
103
+ - نتائج قياس حقيقية (`npm run bench`): **279 ألف UUIDv7/ثانية**، **60 ألف فحص أسرار/ثانية**، **44 ألف تحقق JWT/ثانية**، و **17 ألف ملف OpenAPI/ثانية**.
104
+
105
+ ---
106
+
107
+ <div align="center">
108
+ <img src="docs/logo.png" alt="شعار DevAnvil الرسمي" width="84" />
109
+ <br />
110
+ إذا أعجبتك الأداة، لا تنسَ دعم المشروع بـ <strong>نجمة (Star ★)</strong> على GitHub ومشاركته مع فريقك!
111
+ </div>
112
+
113
+ </div>
package/README.md CHANGED
@@ -1,3 +1,273 @@
1
- # Temporary Holding Version
1
+ <div align="center">
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **English** · [العربية](README.ar.md)
4
+
5
+ <img src="docs/hero-banner.png" alt="DevAnvil — Zero-Dependency Local Developer Studio & CLI" width="100%" />
6
+
7
+ <br />
8
+
9
+ [![Live Playground](https://img.shields.io/badge/Live_Playground-Try_in_Browser-f59e0b?style=for-the-badge)](https://abd77o.github.io/devanvil/)
10
+ [![npm](https://img.shields.io/npm/v/devanvil?style=for-the-badge&color=cb3837&label=npm)](https://www.npmjs.com/package/devanvil)
11
+ [![GitHub Release](https://img.shields.io/github/v/release/abd77o/devanvil?style=for-the-badge&color=10b981)](https://github.com/abd77o/devanvil/releases)
12
+ [![Zero Runtime Deps](https://img.shields.io/badge/Runtime_Deps-0-10b981?style=for-the-badge)](package.json)
13
+
14
+ [![CI](https://github.com/abd77o/devanvil/actions/workflows/ci.yml/badge.svg)](https://github.com/abd77o/devanvil/actions/workflows/ci.yml)
15
+ [![Node.js 20+](https://img.shields.io/badge/node-%3E%3D20.0.0-339933?style=flat-square)](https://nodejs.org)
16
+ [![TypeScript Strict](https://img.shields.io/badge/TypeScript-strict-3178c6?style=flat-square)](tsconfig.json)
17
+ [![Tests Passing](https://img.shields.io/badge/tests-50%2F50%20passing-10b981?style=flat-square)](tests/)
18
+ [![MCP Server](https://img.shields.io/badge/MCP_Server-16_Offline_Tools-38bdf8?style=flat-square)](#ai-agent-mcp-server)
19
+ [![License: MIT](https://img.shields.io/badge/license-MIT-f59e0b?style=flat-square)](LICENSE)
20
+ [![Offline First](https://img.shields.io/badge/privacy-100%25%20offline%20%7C%200%20telemetry-0f172a?style=flat-square)](SECURITY.md)
21
+
22
+ **Stop pasting production JWTs, `.env` secrets, OpenAPI specs, SSL certs, SQL query plans, Protobuf binaries, and logs into ad-filled websites.**
23
+ **DevAnvil v2.1** is the sovereign, self-hosted, **zero-runtime-dependency**, **100% offline** developer platform combining **18 high-craft studios** + **16-tool AI Agent MCP Server** + **OpenAPI Contract Drift & Traffic Recorder** + **OAuth2 PKCE & Protobuf Wire Inspector** + **Chained API Test Runner** + **HTTP Load Benchmarker (with CI Thresholds)** + **Worker+VM Plugin Sandbox** in one runtime.
24
+
25
+ [Try Live Demo](https://abd77o.github.io/devanvil/) · [Quickstart](#30-second-quickstart) · [MCP Server](#ai-agent-mcp-server) · [Studio Gallery](#studio-gallery) · [18 Studios](#18-built-in-studios) · [Benchmarks](#performance-benchmarks) · [CLI & Examples](#cli-and-examples) · [Security](#security-by-design) · [Roadmap](docs/ROADMAP.md)
26
+
27
+ <br />
28
+
29
+ <img src="docs/demo.gif" alt="DevAnvil Interactive CLI & Studio Walkthrough" width="92%" />
30
+
31
+ </div>
32
+
33
+ ---
34
+
35
+ ## Why DevAnvil?
36
+
37
+ Developers routinely juggle 15+ browser tabs and heavy Electron apps for JWT inspection, JSON/YAML conversion, Regex debugging, API testing, OpenAPI mocking, Webhook catching, Secret redaction, and LLM token budgeting—often leaking sensitive company data to third-party websites.
38
+
39
+ Static browser toolkits cannot bypass CORS, cannot run a real HTTP Mock server, cannot stream live Webhooks over SSE, and cannot act as CI gates. **DevAnvil solves all of it with `0` runtime npm dependencies.**
40
+
41
+ | Capability | **DevAnvil v2.1** | Static Dev-Tool Sites | CyberChef | Cloud API Clients |
42
+ | :--- | :---: | :---: | :---: | :---: |
43
+ | **Zero runtime npm dependencies** | **Yes (`0`)** | No | No | No |
44
+ | **100% Offline & Zero Telemetry** | **Yes** | Varies | Yes | No (cloud/login) |
45
+ | **Built-In AI Agent MCP Server (16 Tools)** | **Yes (`devanvil mcp`)** | No | No | No |
46
+ | **OpenAPI Contract Drift + Traffic Recorder** | **Yes (`devanvil drift`)** | No | No | Paid / Separate |
47
+ | **OAuth 2.0/OIDC PKCE + Protobuf Wire Decoder** | **Yes (`pkce` / `proto`)** | No | No | No |
48
+ | **HTTP Load Benchmarker (RPS + P95/P99 + CI Gates)** | **Yes (`devanvil load`)** | No | No | Paid / Separate |
49
+ | **SQL EXPLAIN ANALYZE Visualizer (Postgres & SQLite)** | **Yes (`devanvil explain`)** | No | No | No |
50
+ | **Structured Log Analyzer & Error Fingerprinting** | **Yes (`devanvil logs`)** | No | No | No |
51
+ | **Zero-Trust Worker+VM Local Plugin API** | **Yes (48MB/500ms)** | No | No | Unsafe / None |
52
+ | **Git-Native `devanvil.json` + `{{env.VAR}}` + `.anvil` AES-256** | **Yes (`--workspace`)** | No | No | Cloud / Paid |
53
+ | **CLI Collection Runner + Request Chaining + JUnit XML** | **Yes (`devanvil run`)** | No | No | Heavy (Newman) |
54
+ | **TLS/X.509 Inspector + GraphQL + RFC 6455 WebSocket** | **Yes (Zero Deps)** | No | No | Partial |
55
+ | **Full-Repo & `--staged` Secret Scanner + SARIF + `.devanvilignore`** | **Yes (Web + CI Gate)** | No | No | No |
56
+ | **SSRF + DNS-Pinning + Strict CSP + Slowloris Defense** | **Yes** | N/A | N/A | Varies |
57
+
58
+ ---
59
+
60
+ ## 30-Second Quickstart
61
+
62
+ ### Option 1: Instant Run via `npx` or Global `npm` (Node.js 20+)
63
+ ```bash
64
+ npx devanvil serve
65
+ # or install globally:
66
+ npm install -g devanvil && devanvil serve
67
+ ```
68
+
69
+ ### Option 2: Homebrew (macOS / Linux)
70
+ ```bash
71
+ brew install abd77o/tap/devanvil
72
+ devanvil serve
73
+ ```
74
+
75
+ ### Option 3: Try Instantly in Your Browser (Zero Install)
76
+ 👉 **[Open DevAnvil Live Playground](https://abd77o.github.io/devanvil/)** — 100% client-side, zero network calls, zero login.
77
+
78
+ ### Option 4: 1-Line Installer or Docker (`read_only` + `cap_drop: ALL`)
79
+ ```bash
80
+ curl -fsSL https://raw.githubusercontent.com/abd77o/devanvil/main/install.sh | bash
81
+ # or Docker:
82
+ git clone https://github.com/abd77o/devanvil.git && cd devanvil && docker compose up -d
83
+ ```
84
+
85
+ Open **`http://127.0.0.1:4321`** — press **`⌘K`** (macOS) or **`Ctrl+K`** (Windows/Linux) to jump across all **18 studios**. Want Git-native persistence for your team's Collections, Environments & Mock routes? Run `devanvil serve --workspace ./devanvil.json` (use `{{env.SECRET}}` or gitignored `devanvil.local.json` to keep secrets out of Git!).
86
+
87
+ ---
88
+
89
+ ## AI Agent MCP Server
90
+
91
+ Give **Claude Code**, **Claude Desktop**, **Cursor**, or **Windsurf** **16 blazing-fast offline tools** (Secret Scanner + SARIF, `.env` Drift Validator, OpenAPI -> Mock, **OpenAPI Contract Drift Detector**, **Protobuf Wire Decoder**, JWT Audit, X.509 Certificate Inspector, SQL EXPLAIN Analyzer, Log Fingerprinting, ReDoS-safe Regex VM, Data Converter, Semantic JSON Diff, LLM Token Estimator, UUIDv7/ULID Generator, and Cron Explainer) with **zero dependencies**:
92
+
93
+ ```bash
94
+ # Claude Code (1-line setup)
95
+ claude mcp add devanvil -- devanvil mcp
96
+ ```
97
+
98
+ Or drop this into your Claude Desktop / Cursor / Windsurf MCP JSON config:
99
+
100
+ ```json
101
+ {
102
+ "mcpServers": {
103
+ "devanvil": {
104
+ "command": "devanvil",
105
+ "args": ["mcp"]
106
+ }
107
+ }
108
+ }
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Studio Gallery
114
+
115
+ ### 1. OpenAPI 3.x / Swagger -> Instant Live Mock Server
116
+ Paste any YAML/JSON OpenAPI spec, resolve `$ref` schemas safely, and mount every endpoint live to `/mock/*` in one click.
117
+
118
+ <div align="center">
119
+ <img src="docs/studio-openapi.png" alt="DevAnvil OpenAPI to Live Mock Server Studio" width="100%" />
120
+ </div>
121
+
122
+ ### 2. Offline Secret & `.env` Guard (18 Providers + 1-Click Redactor)
123
+ Detect leaked credentials & high-entropy keys completely offline, redact logs before sharing, and catch missing `.env` variables vs `.env.example`.
124
+
125
+ <div align="center">
126
+ <img src="docs/studio-secrets.png" alt="DevAnvil Offline Secret Scanner and .env Guard Studio" width="100%" />
127
+ </div>
128
+
129
+ ### 3. Offline LLM Token, Cost & Context Budget Studio
130
+ Estimate BPE tokens across English, Arabic, CJK & code for Claude, GPT, Gemini & Llama — and strip redundant tokens offline.
131
+
132
+ <div align="center">
133
+ <img src="docs/studio-llm.png" alt="DevAnvil Offline LLM Token and Context Budget Studio" width="100%" />
134
+ </div>
135
+
136
+ ---
137
+
138
+ ## 18 Built-In Studios
139
+
140
+ ### Network, API & Contracts
141
+ 1. **API Studio** — CORS-free HTTP/HTTPS client with DNS/TTFB/Total timings, `{{VAR}}` & `{{env.SECRET}}` interpolation, **Record response -> Live `/mock/*`**, auto **Traffic Recording**, **Live SSE Stream Tester (with TTFT)**, Auth Helper, Save-to-Collection, cURL importer, and 4-language codegen.
142
+ 2. **Workspaces, Import & MCP** — Git-native `devanvil.json` Collections & Environments manager with **Workspace Secret Audit**, gitignored `devanvil.local.json` overrides, **AES-256-GCM `.anvil` Encrypted Backups**, **Visual Assertions & Request Chaining Builder** (`devanvil run --junit`), **Postman v2.1 / HAR 1.2 / `.http` Importer**, and copy-ready **16-Tool MCP** configs.
143
+ 3. **Contract, Auth & Protobuf (New in v2.1!)** — **OpenAPI Contract Drift Detector** (breaking vs warning drift + 0–100 score + `devanvil drift`), **Live Traffic Recorder -> Inferred OpenAPI 3.0.3 / Mocks / Collection**, **OAuth 2.0 / OIDC PKCE (S256) Debugger** (`devanvil pkce`), and **Zero-Dep Protobuf Binary Wire Decoder + `.proto` Schema Mapper** (`devanvil proto`).
144
+ 4. **TLS, GraphQL & WebSocket** — **X.509 / SSL Certificate Inspector** (offline PEM + live SSRF-guarded TLS handshake), **GraphQL Studio** (queries, variables & 1-click Schema Introspection), and zero-dependency **RFC 6455 WebSocket Live Tester**.
145
+ 5. **Mock & Live SSE Webhooks** — Dynamic Mock API server (`/mock/*`) with `:param` routes, custom latency/headers, template interpolation, plus a real-time **SSE Webhook Inspector** (`/hook/:channel`) with 1-click **Replay -> API Studio**.
146
+ 6. **OpenAPI -> Instant Mock Server** — Parse OpenAPI 3.x / Swagger 2.0 YAML/JSON specs, resolve `$ref` schemas safely, and **mount every route live at `/mock/*` in one click**.
147
+
148
+ ### Performance, Database & Extensibility
149
+ 7. **Load Bench & SQL Explain** — Concurrent **HTTP Load & Latency Benchmarker** (RPS, P50/P90/P95/P99, Histogram, **Baseline Regression Diff** & **CI Threshold Gates `--max-p95`/`--min-rps`**) + **PostgreSQL & SQLite EXPLAIN ANALYZE Visualizer** with heat bars and automated bottleneck detection.
150
+ 8. **Log Analyzer & Plugins** — **NDJSON / Server Log Analyzer** (UUID/IP/duration error fingerprinting, P50/P95/P99 latency & leaked secret detection) + **Hardened Zero-Trust Worker+VM Local Plugin Engine** (`~/.devanvil/plugins`, in-browser code editor, 48MB heap cap, 500ms hard terminate).
151
+
152
+ ### Security & Identity
153
+ 9. **JWT Studio** — Decode, automated **JWT Security Audits**, sign & verify **HS256/384/512, RS256, ES256**, and generate local RSA/EC keypairs.
154
+ 10. **Secret & `.env` Guard** — 18 provider patterns + Shannon entropy + sequential alphabet filtering + `.devanvilignore` + `devanvil-ignore` + `devanvil scan --staged --sarif` + `.env` drift validator.
155
+ 11. **Crypto, Encoding & IDs** — **AES-256-GCM**, SHA/BLAKE2/HMAC, CSPRNG Password Studio, batch **UUIDv7 / UUIDv4 / ULID / NanoID / API Keys**, and 10 codecs.
156
+
157
+ ### Data, Code & Ops
158
+ 12. **Data Studio** — Bidirectional **JSON ↔ YAML ↔ TOML ↔ CSV ↔ Query**, **Interactive JSON Tree Explorer** (1-click Copy JSONPath), **TypeScript & JSON Schema** codegen, **JSONPath**, and **SQL Formatter**.
159
+ 13. **Diff Studio** — Prefix/suffix-trimmed LCS line diff + order-independent **Semantic JSON Structural Diff**.
160
+ 14. **Regex & ReDoS Lab** — Highlighted matches, named groups, static ReDoS check, and isolated 250ms `node:vm` sandbox.
161
+ 15. **Pipeline Lab ("Recipes")** — Chain up to 25 steps across 31 operations with starter recipes and trace.
162
+ 16. **LLM Token & Context Budget Studio** — Offline BPE-calibrated multi-script tokenizer, cost gauges & Smart Context Compactor.
163
+ 17. **Cron & Time Studio** — Jump-optimized 5/6-field Cron parser + auto-detecting Epoch ↔ ISO-8601 ↔ RFC-2822 converter.
164
+ 18. **Network, Chmod & Color** — IPv4 CIDR subnet calculator, Linux `chmod` matrix, **WCAG 2.1** color contrast checker & HTTP Status reference.
165
+
166
+ ---
167
+
168
+ ## Performance Benchmarks
169
+
170
+ Measured locally on **Node.js v20.20.2** with zero runtime dependencies. Reproduce anytime via `npm run bench`:
171
+
172
+ | Operation | Throughput (Ops/sec) | Avg Latency |
173
+ | :--- | ---: | ---: |
174
+ | RFC 9562 UUIDv7 generation | **272,389 /s** | **3.7 µs** |
175
+ | SQL EXPLAIN Plan + Bottleneck Analyzer | **124,901 /s** | **8.0 µs** |
176
+ | Postman v2.1 Import -> Requests + Mocks | **61,237 /s** | **16.3 µs** |
177
+ | Secret Scanner + Redaction (18 rules + entropy) | **52,100 /s** | **19.2 µs** |
178
+ | MCP JSON-RPC Tool Call (UUIDv7 batch) | **46,814 /s** | **21.4 µs** |
179
+ | JWT HS256 cryptographic verify (timing-safe) | **45,961 /s** | **21.8 µs** |
180
+ | JSON -> YAML conversion | **22,025 /s** | **45.4 µs** |
181
+ | OpenAPI 3.0 YAML -> Mock synthesis | **17,226 /s** | **58.1 µs** |
182
+ | Semantic JSON Structural Diff | **17,136 /s** | **58.4 µs** |
183
+ | Cron next-5 (sparse leap-day `0 0 29 2 *`) | **13,899 /s** | **71.9 µs** |
184
+ | 3-step Data Pipeline (`trim -> sort -> yaml`) | **11,348 /s** | **88.1 µs** |
185
+ | Structured Log Fingerprinting (20 lines) | **6,981 /s** | **143.3 µs** |
186
+ | 1,500-line LCS Diff (prefix/suffix optimized) | **4,042 /s** | **247.4 µs** |
187
+ | VM-guarded Regex match + ReDoS analysis | **1,497 /s** | **668.1 µs** |
188
+ | Live HTTP Mock Endpoint (`/mock/health`) | **1,287 /s** | **777.0 µs** |
189
+
190
+ Static UI assets are served from an in-memory cache with **SHA-256 `ETag` (`304 Not Modified`)** and **pre-compressed Gzip**.
191
+
192
+ ---
193
+
194
+ ## CLI and Examples
195
+
196
+ Explore the ready-to-run files in [`examples/`](examples/):
197
+
198
+ ```bash
199
+ # 1. Start Local Studio with Git-native workspace persistence (Collections + Envs + Mocks)
200
+ devanvil serve --workspace ./devanvil.json
201
+
202
+ # 2. Run API Collection Tests with Request Chaining, Assertions & JUnit XML (0-dep Newman!)
203
+ devanvil run ./devanvil.json --env Staging --junit test-results.xml
204
+
205
+ # 3. Concurrent HTTP Load & Latency Benchmark (0-dep k6-lite: RPS, P50/P90/P95/P99 & Histogram)
206
+ devanvil load https://httpbin.org/get -c 10 -n 100
207
+
208
+ # 4. Analyze PostgreSQL EXPLAIN JSON or SQLite Query Plan for bottlenecks & missing indexes
209
+ devanvil explain query-plan.json
210
+
211
+ # 5. Analyze NDJSON/Server Logs (Error Fingerprinting + P95 latency + Secret leak check)
212
+ cat app.log | devanvil logs
213
+
214
+ # 6. Scaffold & run Zero-Trust VM Sandboxed Local Plugins (~/.devanvil/plugins)
215
+ devanvil plugins scaffold my-tool
216
+ devanvil plugins run my-tool "hello\nworld"
217
+
218
+ # 7. Inspect SSL/TLS certificates (live domain OR local .pem file)
219
+ devanvil tls example.com
220
+
221
+ # 8. Run DevAnvil as a zero-dependency MCP Server (14 tools) for Claude Code / Cursor / Windsurf
222
+ devanvil mcp
223
+
224
+ # 9. Scan Git staged changes (pre-commit) or full repo -> SARIF 2.1.0
225
+ devanvil scan --staged
226
+ devanvil scan . --sarif > devanvil-secrets.sarif
227
+
228
+ # 10. Import Postman v2.1, browser HAR 1.2, or .http files -> devanvil.json workspace
229
+ devanvil import postman collection.json --out devanvil.json
230
+
231
+ # 11. Spin up a live Mock API server straight from an OpenAPI YAML spec
232
+ devanvil openapi examples/petstore-openapi.yaml --serve --port 4321
233
+ ```
234
+
235
+ ---
236
+
237
+ ## Architecture
238
+
239
+ <div align="center">
240
+ <img src="docs/architecture.png" alt="DevAnvil Clean 4-Layer Architecture" width="100%" />
241
+ </div>
242
+
243
+ See [docs/architecture.md](docs/architecture.md) for full details.
244
+
245
+ ---
246
+
247
+ ## Security by Design
248
+
249
+ Verified continuously by our dedicated adversarial security & integration test suite (`tests/` — **50/50 tests passing**). Full threat model in [SECURITY.md](SECURITY.md).
250
+
251
+ - **Zero Runtime Dependencies (`"dependencies": {}`)**: `npm audit` reports **0 vulnerabilities** and zero transitive supply-chain surface.
252
+ - **SSRF & DNS-Rebinding Guard**: Blocks loopback, RFC1918, `169.254.169.254` (Cloud IMDS), CGNAT, NAT64, IPv4-mapped IPv6, and non-HTTP schemes by default; pins validated IPs on sockets; strips `Authorization`/`Cookie` on cross-origin redirects.
253
+ - **Strict CSP & Zero `innerHTML`**: Served with `default-src 'self'; script-src 'self'; object-src 'none'` — zero inline scripts, zero external CDNs, zero unsafe DOM sinks.
254
+ - **Prototype Pollution & Circular `$ref` Defense**: Null-prototype parsers across JSON, YAML, TOML, CSV, QueryString, JSONPath, OpenAPI & `.env`.
255
+ - **ReDoS, Zip-Bomb & Slowloris Guards**: Every built-in secret regex is verified ReDoS-safe; user regex runs inside an isolated `node:vm` 250ms sandbox; decompression capped at 10 MB; strict HTTP timeouts (`headersTimeout`, `requestTimeout`, `maxHeadersCount`).
256
+
257
+ ---
258
+
259
+ ## Roadmap & Contributing
260
+
261
+ Check out our [Public Roadmap](docs/ROADMAP.md) and open [`good first issue`](https://github.com/abd77o/devanvil/labels/good%20first%20issue) tickets! Contributions of new studios, benchmarks, docs, and security audits are warmly welcome — see [CONTRIBUTING.md](CONTRIBUTING.md).
262
+
263
+ <div align="center">
264
+ <img src="docs/logo.png" alt="DevAnvil Official Emblem" width="84" />
265
+ <br />
266
+ <sub>If <strong>DevAnvil</strong> replaces 15 browser tabs and keeps your secrets off random websites, give it a <strong>★ Star</strong>!</sub>
267
+ </div>
268
+
269
+ ---
270
+
271
+ ## License
272
+
273
+ Released under the [MIT License](LICENSE) © 2026 [abd77o](https://github.com/abd77o).
package/SECURITY.md ADDED
@@ -0,0 +1,49 @@
1
+ # Security Policy
2
+
3
+ DevAnvil is designed from day one for developers handling sensitive payloads (JWTs, API keys, `.env` files, OpenAPI specs, webhooks, encrypted configs) locally.
4
+
5
+ ## Supported Versions
6
+
7
+ | Version | Supported |
8
+ | --------- | --------- |
9
+ | `>= 2.1.1` | Yes (current hardened release) |
10
+ | `<= 2.1.0` | Deprecated — please upgrade to `v2.1.1+` for SSRF, CSP, sandbox & parser security fixes |
11
+
12
+ ## Threat Model & Built-in Defenses
13
+
14
+ 1. **Zero Runtime Dependencies**: `package.json` ships with `"dependencies": {}`. All networking, cryptography, compression, and sandboxing rely strictly on audited Node.js 20+ core modules.
15
+ 2. **Local Loopback Binding by Default**: `devanvil serve` binds to `127.0.0.1` unless `--host 0.0.0.0` is explicitly requested.
16
+ 3. **SSRF & DNS-Rebinding Protection (`/api/proxy`)**:
17
+ - Only `http:` and `https:` schemes are permitted.
18
+ - Embedded URL credentials (`http://user:pass@host`) are rejected.
19
+ - Loopback (`127.0.0.0/8`, `::1`), RFC1918 private subnets, link-local & cloud metadata (`169.254.169.254`), CGNAT (`100.64.0.0/10`), multicast, NAT64 (`64:ff9b::/96`), and IPv4-mapped IPv6 addresses (`::ffff:127.0.0.1`) are blocked unless `--allow-private-proxy` is explicitly passed.
20
+ - DNS lookups occur prior to socket connection and the validated IP is pinned into the request `lookup` callback to eliminate DNS rebinding (TOCTOU).
21
+ - Redirect hops (max 5) re-run full SSRF validation and strip `Authorization`, `Cookie`, and `Proxy-Authorization` headers across origin changes.
22
+ - Request bodies (2 MB), response bodies (5 MB), and timeouts (15s default, 30s max) are strictly bounded.
23
+ 4. **Slowloris & Malformed Input Protection**:
24
+ - `http.Server` enforces `headersTimeout: 10s`, `requestTimeout: 30s`, `keepAliveTimeout: 5s`, and `maxHeadersCount: 64`.
25
+ - All `/api/*` routes apply runtime type guards so malformed JSON field types return clean `400 Bad Request` responses.
26
+ 5. **XSS & CSP Hardening**:
27
+ - Strict `Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self'; object-src 'none'`.
28
+ - Zero `innerHTML`, `eval`, or external CDN resources across the entire UI.
29
+ - Optional `--deny-iframe` flag emits `X-Frame-Options: DENY` and `frame-ancestors 'none'`.
30
+ 6. **Cross-Origin Mutation Guard**: All mutating `/api/*` endpoints reject requests carrying mismatched browser `Origin` headers.
31
+ 7. **Path Traversal & Symlink Containment**: Static UI serving rejects raw `..` / `%2e%2e` / `%5c` / null bytes and verifies `realpathSync` containment within the UI directory.
32
+ 8. **Prototype Pollution & Circular `$ref` Protection**: JSON, YAML, TOML, CSV, QueryString, JSONPath, `.env`, and OpenAPI parsers use null-prototype objects, reject `__proto__`/`constructor`/`prototype`, and guard recursive OpenAPI `$ref` resolution against cycles.
33
+ 9. **ReDoS & Zip-Bomb Guards**:
34
+ - Every built-in secret scanner regex is automatically verified ReDoS-safe in `tests/security.test.ts`.
35
+ - User regex execution runs inside a pre-compiled isolated `node:vm` sandbox with a hard 250ms timeout.
36
+ - Gzip/deflate decoding enforces `maxOutputLength` (10 MB) to neutralize decompression bombs.
37
+ 10. **Cryptographic Safety**:
38
+ - JWT verification explicitly blocks `alg: "none"`, enforces algorithm allowlists, prevents RSA/EC PEM-key-as-HMAC algorithm confusion, and uses constant-time comparison (`crypto.timingSafeEqual`).
39
+ - AES-256-GCM uses scrypt KDF (`N=16384, r=8, p=1`), fresh 128-bit CSPRNG salt, fresh 96-bit IV, and 128-bit GCM authentication tag.
40
+ 11. **Bounded In-Memory Stores**: Mock routes (max 100), webhook channels (max 50), webhook events per channel (max 100), and concurrent SSE listeners (max 50) are strictly capped to prevent memory exhaustion.
41
+
42
+ ## Reporting a Vulnerability
43
+
44
+ If you discover a security vulnerability in DevAnvil, **please do not open a public issue**.
45
+
46
+ Instead:
47
+ 1. Use GitHub's **Private Vulnerability Reporting** ("Security" tab -> "Report a vulnerability") on `abd77o/devanvil`.
48
+ 2. Include reproduction steps, impact assessment, and any suggested mitigation.
49
+ 3. You will receive an acknowledgement within 48 hours and coordinated disclosure credit upon remediation.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};