unpeek 1.11.0 → 1.13.0

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 (87) hide show
  1. package/README.md +140 -5
  2. package/README.tr.md +148 -13
  3. package/dist/ast/index.cjs +752 -199
  4. package/dist/ast/index.cjs.map +1 -1
  5. package/dist/ast/index.d.cts +7 -6
  6. package/dist/ast/index.d.ts +7 -6
  7. package/dist/ast/index.js +752 -199
  8. package/dist/ast/index.js.map +1 -1
  9. package/dist/browser.cjs +752 -199
  10. package/dist/browser.cjs.map +1 -1
  11. package/dist/browser.d.cts +1 -1
  12. package/dist/browser.d.ts +1 -1
  13. package/dist/browser.js +752 -199
  14. package/dist/browser.js.map +1 -1
  15. package/dist/bundler/detector.cjs +132 -41
  16. package/dist/bundler/detector.cjs.map +1 -1
  17. package/dist/bundler/detector.d.cts +7 -3
  18. package/dist/bundler/detector.d.ts +7 -3
  19. package/dist/bundler/detector.js +129 -41
  20. package/dist/bundler/detector.js.map +1 -1
  21. package/dist/bundler/sourcemap-vault.cjs +136 -46
  22. package/dist/bundler/sourcemap-vault.cjs.map +1 -1
  23. package/dist/bundler/sourcemap-vault.d.cts +2 -1
  24. package/dist/bundler/sourcemap-vault.d.ts +2 -1
  25. package/dist/bundler/sourcemap-vault.js +136 -46
  26. package/dist/bundler/sourcemap-vault.js.map +1 -1
  27. package/dist/bundler/unplugin.cjs +757 -201
  28. package/dist/bundler/unplugin.cjs.map +1 -1
  29. package/dist/bundler/unplugin.js +757 -201
  30. package/dist/bundler/unplugin.js.map +1 -1
  31. package/dist/cli/index.cjs +1264 -315
  32. package/dist/cli/index.cjs.map +1 -1
  33. package/dist/cli/index.js +1249 -300
  34. package/dist/cli/index.js.map +1 -1
  35. package/dist/cli/init.cjs +78 -29
  36. package/dist/cli/init.cjs.map +1 -1
  37. package/dist/cli/init.js +78 -29
  38. package/dist/cli/init.js.map +1 -1
  39. package/dist/cli/protect.cjs +1266 -332
  40. package/dist/cli/protect.cjs.map +1 -1
  41. package/dist/cli/protect.js +1242 -308
  42. package/dist/cli/protect.js.map +1 -1
  43. package/dist/config.cjs +333 -0
  44. package/dist/config.cjs.map +1 -0
  45. package/dist/config.d.cts +12 -0
  46. package/dist/config.d.ts +12 -0
  47. package/dist/config.js +291 -0
  48. package/dist/config.js.map +1 -0
  49. package/dist/esbuild.cjs +757 -201
  50. package/dist/esbuild.cjs.map +1 -1
  51. package/dist/esbuild.d.cts +1 -1
  52. package/dist/esbuild.d.ts +1 -1
  53. package/dist/esbuild.js +757 -201
  54. package/dist/esbuild.js.map +1 -1
  55. package/dist/index.cjs +1359 -352
  56. package/dist/index.cjs.map +1 -1
  57. package/dist/index.d.cts +3 -2
  58. package/dist/index.d.ts +3 -2
  59. package/dist/index.js +1325 -325
  60. package/dist/index.js.map +1 -1
  61. package/dist/rollup.cjs +757 -201
  62. package/dist/rollup.cjs.map +1 -1
  63. package/dist/rollup.d.cts +1 -1
  64. package/dist/rollup.d.ts +1 -1
  65. package/dist/rollup.js +757 -201
  66. package/dist/rollup.js.map +1 -1
  67. package/dist/runtime/index.cjs +5 -3
  68. package/dist/runtime/index.cjs.map +1 -1
  69. package/dist/runtime/index.d.cts +2 -2
  70. package/dist/runtime/index.d.ts +2 -2
  71. package/dist/runtime/index.js +5 -3
  72. package/dist/runtime/index.js.map +1 -1
  73. package/dist/{types-DBNcJBCS.d.cts → types-CgWUnSfX.d.cts} +65 -1
  74. package/dist/{types-DBNcJBCS.d.ts → types-CgWUnSfX.d.ts} +65 -1
  75. package/dist/vite.cjs +757 -201
  76. package/dist/vite.cjs.map +1 -1
  77. package/dist/vite.d.cts +1 -1
  78. package/dist/vite.d.ts +1 -1
  79. package/dist/vite.js +757 -201
  80. package/dist/vite.js.map +1 -1
  81. package/dist/webpack.cjs +757 -201
  82. package/dist/webpack.cjs.map +1 -1
  83. package/dist/webpack.d.cts +1 -1
  84. package/dist/webpack.d.ts +1 -1
  85. package/dist/webpack.js +757 -201
  86. package/dist/webpack.js.map +1 -1
  87. package/package.json +1 -1
package/README.md CHANGED
@@ -64,8 +64,10 @@ flowchart TD
64
64
  Before modifying an AST node, [`detectHotPaths`](packages/unpeek/src/ast/index.ts) traverses the file call graph bidirectionally. Functions containing loops (`for`, `while`, `do-while`, `for-of`), array higher-order callbacks (`.map`, `.filter`, `.reduce`, `.forEach`), `requestAnimationFrame` tickers, React/UI render components (`useState`, `useEffect`, `createElement`), and all helper callees invoked from hot loops are flagged as hot paths. `unpeek` exempts hot loops and their callees from both opaque control-flow predicates and string vault rewriting, while protecting cold functions (such as license checks, request signers, and auth validators). V8 JIT optimization inside hot loops remains untouched.
65
65
  2. **O(1) Const-Array String Vault & Tamper Entanglement (`<15%` Gzip Budget)**
66
66
  Cold string literals (`minStringLength >= 4`) are encrypted at build time with a period-2 polymorphic XOR stream cipher keyed by a per-build 32-bit seed that preserves LZ77/Gzip compressibility. At module initialization, the injected `const _uC` vault decodes strings once into a V8 `kConst` array slot so every subsequent read resolves in O(1) constant time via direct array indexing, while dual-entangling the XOR key with both the runtime integrity state (`String.prototype._u`) and self-verifying decoder formatting (`/\n/.test(f)`).
67
- 3. **Self-Defending `Function.prototype.toString()` Integrity and Passive Deterrent**
68
- When an analyst formats a protected chunk using DevTools Pretty-Print (`{}`) or edits a branch instruction in the Sources panel, the formatted source alters `Function.prototype.toString()`. [`verifyCodeIntegrity`](packages/unpeek/src/runtime/index.ts) validates a seeded 32-bit FNV-1a checksum against the function source representation with zero false positives on untouched minified code, triggering gradual state degradation (`deterrentMode: 'gradual'`) rather than an obvious crash point that attackers can patch out.
67
+ 3. **Self-Defending `Function.prototype.toString()` Integrity and Deterrent Modes**
68
+ When an analyst formats a protected chunk using DevTools Pretty-Print (`{}`) or edits a branch instruction in the Sources panel, the formatted source alters `Function.prototype.toString()`. [`verifyCodeIntegrity`](packages/unpeek/src/runtime/index.ts) validates a seeded 32-bit FNV-1a checksum against the function source representation with zero false positives on untouched minified code. The response is governed by `deterrentMode`:
69
+ - `passive` (CLI `protect` default): Dispatches a tamper telemetry event (`unpeek:tamper`) to `window` with zero console muting or audible breakage, enabling covert telemetry.
70
+ - `gradual` (`unplugin` default): Progressively corrupts internal runtime lookups and silences `console` output, neutralizing attackers without providing an immediate crash trace to patch.
69
71
  4. **Automatic Source Map Vault (`.unpeek-maps/`)**
70
72
  Leaving `.js.map` files in a public build directory reconstructs your original TypeScript project tree inside DevTools. [`protectProject`](packages/unpeek/src/cli/protect.ts) extracts `.map` files from your public build directory into a private `.unpeek-maps/` folder and strips `//# sourceMappingURL=` comments from every client bundle so you can upload maps to Sentry or Datadog without serving them to end users.
71
73
 
@@ -103,7 +105,8 @@ npx unpeek protect
103
105
  | `protect` | Protect production client bundles in-place (default command) | |
104
106
  | `--out-dir <path>` | Explicit client output directory override (e.g., `dist/assets`, `.next/static/chunks`) | Auto-detected from project framework |
105
107
  | `--seed <number>` | Deterministic 32-bit polymorphic build seed | Random per build |
106
- | `--passive` | Use passive deterrent mode instead of gradual state degradation | Default: gradual degradation |
108
+ | `--aggressive` | Enable Tier 2 aggressive protection (Micro-VM & WASM KDF) | Disabled (Tier 1 default: <2% CPU, <15% Gzip) |
109
+ | `--passive` | Use passive deterrent mode (tamper telemetry event without console muting) | CLI default: `passive` (`unplugin` default: `gradual`) |
107
110
  | `--no-maps` | Permanently delete `.map` files instead of moving them to `.unpeek-maps/` | Moves to `.unpeek-maps/` |
108
111
  | `--min-string-length <num>` | Minimum string length for O(1) `kConst` encryption vault | `4` |
109
112
  | `--private-maps-dir <dir>` | Directory to store vaulted private source maps | `.unpeek-maps` |
@@ -112,7 +115,11 @@ npx unpeek protect
112
115
  | `-v, --version` | Show CLI version number | |
113
116
 
114
117
  > [!NOTE]
115
- > Programmatic execution through `protectProject(options)` supports additional fine-grained options, including `minStringLength`, `privateMapsDir`, `injectRuntimeShield`, and `cwd`.
118
+ > **Protection Tiers:**
119
+ > - **Tier 1 (Default):** Call-graph hot-path exemption (<2% CPU overhead, <15% Gzip budget), polymorphic O(1) `kConst` string vault, identifier mangling, and 32-bit FNV-1a checksum runtime shield.
120
+ > - **Tier 2 (`--aggressive`):** Bytecode Micro-VM virtualization and inline WebAssembly Key Derivation Function (WASM KDF) for security-critical functions.
121
+ >
122
+ > Programmatic execution through `protectProject(options)` supports additional fine-grained options, including `minStringLength`, `privateMapsDir`, `injectRuntimeShield`, `aggressive`, and `cwd`.
116
123
 
117
124
  > [!IMPORTANT]
118
125
  > **CommonJS Users (Dynamic `import()`):**
@@ -192,10 +199,138 @@ const summary = await protectProject({
192
199
 
193
200
  ---
194
201
 
202
+ ## Configuration (`unpeek.config.js` / `.mjs` / `.cjs` / `.json`)
203
+
204
+ `unpeek` supports declarative configuration via a dedicated configuration file in your project root. Both the CLI and bundler plugins discover configuration files in this priority order:
205
+ 1. `unpeek.config.js`
206
+ 2. `unpeek.config.mjs`
207
+ 3. `unpeek.config.cjs`
208
+ 4. `unpeek.config.json`
209
+
210
+ ### Type-Safe Configuration (`defineConfig`)
211
+
212
+ Import `defineConfig` from `'unpeek'` to enable IDE autocompletion and schema validation:
213
+
214
+ ```javascript
215
+ // unpeek.config.mjs (or unpeek.config.js)
216
+ import { defineConfig } from 'unpeek';
217
+
218
+ export default defineConfig({
219
+ // Target framework override ('nextjs' | 'vite' | 'webpack' | 'vanilla')
220
+ framework: 'nextjs',
221
+
222
+ // Target environment ('browser' | 'worker' | 'universal')
223
+ target: 'browser',
224
+
225
+ // Explicit client output directory override (auto-detected if omitted)
226
+ outDir: '.next/static/chunks',
227
+
228
+ // Target file extensions to protect
229
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs'],
230
+
231
+ // Public asset directories
232
+ publicDirs: ['public', 'static'],
233
+
234
+ // Inclusion and exclusion glob filters
235
+ filter: {
236
+ include: [],
237
+ exclude: ['node_modules/**', '**/*.test.*', '**/*.spec.*'],
238
+ },
239
+
240
+ // Call-graph analysis and hot-path tuning
241
+ hotPath: {
242
+ // Custom animation loop and timer functions to exempt from protection
243
+ customAnimationCalls: ['requestAnimationFrame', 'ticker', 'renderLoop'],
244
+ // Custom React hooks to treat as UI render boundaries
245
+ customHooks: ['useAnimation', 'useCanvas'],
246
+ // Higher-order array methods treated as hot loops
247
+ arrayHofMethods: ['map', 'filter', 'reduce', 'forEach'],
248
+ // Transitive caller traversal depth for hot path exemption (default: 2)
249
+ maxPipelineCallers: 2,
250
+ // Component names exempt from AST transformation
251
+ excludeComponents: ['VirtualTable', 'DataGrid'],
252
+ },
253
+
254
+ // Polymorphic string vault configuration
255
+ vault: {
256
+ // Minimum string length to encrypt in O(1) kConst array (default: 4)
257
+ minStringLength: 4,
258
+ // CSS framework class extraction ('tailwind' | 'unocss' | 'none')
259
+ cssFramework: 'tailwind',
260
+ // Preserve UI class strings and semantic DOM anchors
261
+ semanticAnchors: {
262
+ excludeUiClasses: true,
263
+ },
264
+ // Generate decoy strings to defeat automated entropy scanners
265
+ polymorphicDecoys: true,
266
+ },
267
+
268
+ // Identifier and symbol mangler configuration
269
+ mangler: {
270
+ // Top-level identifiers preserved from name mangling
271
+ reservedIdentifiers: ['__NEXT_DATA__', '__PRELOADED_STATE__'],
272
+ // Property prefixes to preserve
273
+ excludePrefixes: ['data-', 'aria-'],
274
+ // Regular expression patterns to preserve
275
+ excludePatterns: [/^on[A-Z]/],
276
+ },
277
+
278
+ // Private source map vault options
279
+ sourcemaps: {
280
+ // Relocate .map files to private vault directory (default: true)
281
+ keepPrivate: true,
282
+ // Private directory name for relocated source maps (default: '.unpeek-maps')
283
+ vaultDir: '.unpeek-maps',
284
+ // Strip //# sourceMappingURL= directives from client chunks (default: true)
285
+ stripComments: true,
286
+ },
287
+
288
+ // Next.js specific overrides
289
+ next: {
290
+ // Custom build directory (default: '.next')
291
+ distDir: '.next',
292
+ },
293
+
294
+ // Vite specific overrides
295
+ vite: {
296
+ // Output directory (default: 'dist')
297
+ outDir: 'dist',
298
+ // Assets directory inside outDir (default: 'assets')
299
+ assetsDir: 'assets',
300
+ },
301
+ });
302
+ ```
303
+
304
+ For JSON configurations (`unpeek.config.json`):
305
+
306
+ ```json
307
+ {
308
+ "framework": "nextjs",
309
+ "target": "browser",
310
+ "vault": {
311
+ "minStringLength": 4,
312
+ "cssFramework": "tailwind"
313
+ },
314
+ "sourcemaps": {
315
+ "keepPrivate": true,
316
+ "vaultDir": ".unpeek-maps"
317
+ },
318
+ "next": {
319
+ "distDir": ".next"
320
+ }
321
+ }
322
+ ```
323
+
324
+ ---
325
+
195
326
  ## `.unpeek-maps/` Source Map Vault & Sentry Workflow
196
327
 
197
328
  When `keepPrivateMaps` is enabled (the default), `unpeek` relocates all `.js.map` files from your public output directory into `.unpeek-maps/` while preserving relative filenames, and strips `//# sourceMappingURL=` directives from public `.js` chunks.
198
329
 
330
+ > [!CAUTION]
331
+ > **Container Security Advisory (`.dockerignore`):**
332
+ > When packaging web applications with Docker, ensure `.unpeek-maps/` is explicitly listed in your `.dockerignore` file. If `.unpeek-maps/` is omitted, standard `COPY . .` commands copy private source maps into the published container image layer, allowing anyone with image access to extract your full original source code. `unpeek` CLI automatically audits `.dockerignore` during build execution and prints an advisory warning if the entry is missing.
333
+
199
334
  To retain full stack-trace symbolication in production error trackers:
200
335
 
201
336
  ```bash
@@ -212,7 +347,7 @@ npx @sentry/cli sourcemaps upload .unpeek-maps --release="$GIT_COMMIT_SHA"
212
347
 
213
348
  ## AI Coding Agent Integration
214
349
 
215
- `unpeek` ships with an official AI Agent Skill ([`skills/unpeek/SKILL.md`](skills/unpeek/SKILL.md)) following the open Vercel Agent Skills specification and Agent Skills Discovery Optimization (SDO) standards. Installing this skill equips coding agents (Claude Code, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot, OpenCode) with deep domain knowledge for protecting client-side bundles, preserving hot-path performance budgets (<2% CPU, <15% Gzip), guarding SSR boundaries, and managing `.unpeek-maps/` in CI/CD pipelines.
350
+ `unpeek` ships with an official AI Agent Skill ([`skills/unpeek/SKILL.md`](skills/unpeek/SKILL.md)) following the open Vercel Agent Skills specification and Agent Skills Discovery Optimization (SDO) standards. Installing this skill equips coding agents (Claude Code, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot, OpenCode) with operational workflows for protecting client-side bundles, preserving hot-path performance budgets (<2% CPU, <15% Gzip), guarding SSR boundaries, and managing `.unpeek-maps/` in CI/CD pipelines.
216
351
 
217
352
  ### Skill Installation
218
353
 
package/README.tr.md CHANGED
@@ -13,12 +13,12 @@
13
13
  Sıfır yapılandırma gerektiren, çağrı grafiği (call-graph) farkındalıklı, <%2 CPU ek yükü ve <%15 Gzip bütçesine sahip istemci tarafı JavaScript koruma ve çalışma zamanı (runtime) müdahale önleme aracı.
14
14
 
15
15
  [![Lisans: MIT](https://img.shields.io/badge/Lisans-MIT-111111.svg?style=flat-square)](LICENSE)
16
- [![Sıcak Yol CPU](https://img.shields.io/badge/S%C4%B1cak%20Yol%20CPU-%3C2%25-FF3300.svg?style=flat-square)](packages/unpeek/benchmarks/overhead.bench.ts)
17
- [![Gzip Artışı](https://img.shields.io/badge/Gzip%20Art%C4%B1%C5%9F%C4%B1-%3C15%25-111111.svg?style=flat-square)](packages/unpeek/benchmarks/overhead.bench.ts)
16
+ [![Sıcak Yol CPU](https://img.shields.io/badge/S%C4%B1cak%20Yol%20CPU-%3C2%25-FF3300.svg?style=flat-square)](./benchmarks/overhead.bench.ts)
17
+ [![Gzip Artışı](https://img.shields.io/badge/Gzip%20Art%C4%B1%C5%9F%C4%B1-%3C15%25-111111.svg?style=flat-square)](./benchmarks/overhead.bench.ts)
18
18
  [![Canlı Demo](https://img.shields.io/badge/Showcase-Canl%C4%B1%20Demo-FF3300.svg?style=flat-square)](https://woffluon.github.io/unpeek)
19
19
  [![Dokümantasyon](https://img.shields.io/badge/Docs-Detayl%C4%B1%20Referans-111111.svg?style=flat-square)](https://woffluon.github.io/unpeek/docs)
20
20
 
21
- [English](./README.md) | Türkçe · [İnteraktif Vitrin](https://woffluon.github.io/unpeek) · [Dokümantasyon](https://woffluon.github.io/unpeek/docs) · [Ajan Mimari Kılavuzu](./AGENTS.md) · [Yapay Zeka Becerisi (SKILL.md)](./skills/unpeek/SKILL.md)
21
+ [English](./README.md) | Türkçe · [İnteraktif Vitrin](https://woffluon.github.io/unpeek) · [Dokümantasyon](https://woffluon.github.io/unpeek/docs) · [Ajan Mimari Kılavuzu](https://github.com/Woffluon/unpeek/blob/main/AGENTS.md) · [Yapay Zeka Becerisi (SKILL.md)](https://github.com/Woffluon/unpeek/blob/main/skills/unpeek/SKILL.md)
22
22
 
23
23
  ---
24
24
 
@@ -61,13 +61,15 @@ flowchart TD
61
61
  ```
62
62
 
63
63
  1. **Çağrı Grafiği (Call-Graph) Hot-Path Muafiyeti (`<%2` CPU Bütçesi)**
64
- [`detectHotPaths`](packages/unpeek/src/ast/index.ts), tek bir AST düğümünü değiştirmeden önce dosyanın çağrı grafiğini çift yönlü tarar. Döngü içeren fonksiyonlar (`for`, `while`, `do-while`, `for-of`), dizi yüksek mertebe geri çağrıları (`.map`, `.filter`, `.reduce`, `.forEach`), `requestAnimationFrame` zamanlayıcıları, React/UI bileşenleri (`useState`, `useEffect`, `createElement`) ve sıcak döngülerden çağrılan tüm yardımcı fonksiyonlar sıcak yol (hot path) olarak işaretlenir. `unpeek` sıcak döngüleri ve yardımcılarını hem opak kontrol akışı korumalarından hem de metin kasası dönüşümünden muaf tutar; korumayı yalnızca soğuk fonksiyonlara (lisans doğrulama, istek imzalama, yetki kontrolü gibi) uygular. Sıcak döngülerdeki V8 JIT optimizasyonu doğal hızında çalışmayı sürdürür.
64
+ [`detectHotPaths`](./src/ast/index.ts), tek bir AST düğümünü değiştirmeden önce dosyanın çağrı grafiğini çift yönlü tarar. Döngü içeren fonksiyonlar (`for`, `while`, `do-while`, `for-of`), dizi yüksek mertebe geri çağrıları (`.map`, `.filter`, `.reduce`, `.forEach`), `requestAnimationFrame` zamanlayıcıları, React/UI bileşenleri (`useState`, `useEffect`, `createElement`) ve sıcak döngülerden çağrılan tüm yardımcı fonksiyonlar sıcak yol (hot path) olarak işaretlenir. `unpeek` sıcak döngüleri ve yardımcılarını hem opak kontrol akışı korumalarından hem de metin kasası dönüşümünden muaf tutar; korumayı yalnızca soğuk fonksiyonlara (lisans doğrulama, istek imzalama, yetki kontrolü gibi) uygular. Sıcak döngülerdeki V8 JIT optimizasyonu doğal hızında çalışmayı sürdürür.
65
65
  2. **O(1) Sabit-Dizi Metin Kasası ve Kalkan Dolanıklığı (`<%15` Gzip Bütçesi)**
66
66
  Soğuk metin sabitleri (`minStringLength >= 4`), derleme zamanında LZ77/Gzip sıkıştırılabilirliğini koruyan periyot-2 polimorfik bir XOR akış şifresiyle kodlanır. Modül başlangıcında enjekte edilen `const _uC` kasası metinleri tek seferde V8 `kConst` sabit dizi hücrelerine çözer ve XOR anahtarını hem çalışma zamanı bütünlük kalkanına (`String.prototype._u`) hem de çözücü fonksiyonun kendi biçimlendirme kontrolüne (`/\n/.test(f)`) ikili olarak bağlar. Sonraki tüm okumalar doğrudan dizi indeksleme ile O(1) sürede tamamlanır.
67
- 3. **Öz-Savunmalı `Function.prototype.toString()` Bütünlük Kontrolü ve Pasif Caydırıcı**
68
- Bir analist korumalı bir dosyayı DevTools Pretty-Print (`{}`) ile biçimlendirdiğinde veya Sources panelinde bir koşulu değiştirdiğinde, biçimlendirilen kod `Function.prototype.toString()` çıktısını değiştirir. [`verifyCodeIntegrity`](packages/unpeek/src/runtime/index.ts), dokunulmamış küçültülmüş kodda sıfır yanlış pozitif oranıyla 32-bit FNV-1a özetini doğrular ve saldırganların doğrudan yamayabileceği ani bir çökme yerine kademeli durum bozulması (`deterrentMode: 'gradual'`) başlatır.
67
+ 3. **Öz-Savunmalı `Function.prototype.toString()` Bütünlük Kontrolü ve Caydırıcı Modlar (Deterrent Modes)**
68
+ Bir analist korumalı bir dosyayı DevTools Pretty-Print (`{}`) ile biçimlendirdiğinde veya Sources panelinde bir koşulu değiştirdiğinde, biçimlendirilen kod `Function.prototype.toString()` çıktısını değiştirir. [`verifyCodeIntegrity`](./src/runtime/index.ts), dokunulmamış küçültülmüş kodda sıfır yanlış pozitif oranıyla 32-bit FNV-1a özetini (checksum) doğrular. Verilen tepki `deterrentMode` seçeneğiyle yönetilir:
69
+ - `passive` (CLI `protect` varsayılanı): Konsol çıktısını susturmadan veya uygulamayı çökertmeden `window` nesnesine bir telemetri olayı (`unpeek:tamper` event) iletir; tersine mühendislik girişimlerinin sessizce izlenmesini sağlar.
70
+ - `gradual` (`unplugin` varsayılanı): İç çalışma zamanı çözümlemelerini kademeli olarak bozar ve `console` çıktılarını susturur; saldırganların doğrudan yamayabileceği ani bir hata yığın izi (stack trace) üretmeden kodu işlevsizleştirir.
69
71
  4. **Otomatik Source Map Kasası (`.unpeek-maps/`)**
70
- Üretim çıktısında `.js.map` dosyalarını bırakmak, orijinal TypeScript proje ağacınızın DevTools içinde birebir yeniden oluşturulmasına yol açar. [`protectProject`](packages/unpeek/src/cli/protect.ts), `.map` dosyalarını genel çıktı dizininden özel `.unpeek-maps/` klasörüne taşır ve tüm istemci paketlerinden `//# sourceMappingURL=` yorumlarını temizler. Böylece haritaları son kullanıcılara sunmadan Sentry veya Datadog gibi platformlara yükleyebilirsiniz.
72
+ Üretim çıktısında `.js.map` dosyalarını bırakmak, orijinal TypeScript proje ağacınızın DevTools içinde birebir yeniden oluşturulmasına yol açar. [`protectProject`](./src/cli/protect.ts), `.map` dosyalarını genel çıktı dizininden özel `.unpeek-maps/` klasörüne taşır ve tüm istemci paketlerinden `//# sourceMappingURL=` yorumlarını temizler. Böylece haritaları son kullanıcılara sunmadan Sentry veya Datadog gibi platformlara yükleyebilirsiniz.
71
73
 
72
74
  ---
73
75
 
@@ -103,7 +105,8 @@ npx unpeek protect
103
105
  | `protect` | Üretim istemci paketlerini yerinde korur (varsayılan komut) | |
104
106
  | `--out-dir <yol>` | İstemci çıktı klasörünü açıkça belirtir (ör. `dist/assets`, `.next/static/chunks`) | Proje framework'ünden otomatik tespit |
105
107
  | `--seed <sayı>` | Deterministik 32-bit polimorfik derleme tohumu (seed) | Derleme başına rastgele |
106
- | `--passive` | Kademeli bozulma yerine pasif telemetri caydırıcı modunu kullan | Varsayılan: kademeli bozulma (`gradual`) |
108
+ | `--aggressive` | Katman 2 (Tier 2) agresif korumayı etkinleştirir (Micro-VM ve WASM KDF) | Varsayılan: kapalı (Tier 1 varsayılanı: <%2 CPU, <%15 Gzip) |
109
+ | `--passive` | Pasif caydırıcı modunu kullanır (konsol sessize alma olmadan yalnızca telemetri olayı) | CLI varsayılanı: `passive` (`unplugin` varsayılanı: `gradual`) |
107
110
  | `--no-maps` | `.map` dosyalarını `.unpeek-maps/` klasörüne taşımak yerine kalıcı olarak sil | `.unpeek-maps/` içine taşır |
108
111
  | `--min-string-length <sayı>` | O(1) `kConst` şifreleme kasasına alınacak minimum metin uzunluğu | `4` |
109
112
  | `--private-maps-dir <dizin>` | Kaynak haritalarının taşınacağı özel kasa klasörü | `.unpeek-maps` |
@@ -112,7 +115,11 @@ npx unpeek protect
112
115
  | `-v, --version` | Sürüm numarasını göster | |
113
116
 
114
117
  > [!NOTE]
115
- > `protectProject(options)` üzerinden programatik kullanım; `minStringLength`, `privateMapsDir`, `injectRuntimeShield` ve `cwd` gibi ek yapılandırma seçeneklerini destekler.
118
+ > **Koruma Katmanları (Protection Tiers):**
119
+ > - **Tier 1 (Varsayılan):** Çağrı grafiği (call-graph) sıcak yol (hot path) muafiyeti (<%2 CPU ek yükü, <%15 Gzip bütçesi), polimorfik O(1) `kConst` sabit metin kasası, sembol maskeleme ve 32-bit FNV-1a sağlama toplamı (checksum) çalışma zamanı kalkanı.
120
+ > - **Tier 2 (`--aggressive`):** Güvenlik açısından kritik mantıklar için bayt kodu Micro-VM sanallaştırması ve satır içi WebAssembly Anahtar Türetme Fonksiyonu (WASM KDF - Key Derivation Function).
121
+ >
122
+ > `protectProject(options)` üzerinden programatik kullanım; `minStringLength`, `privateMapsDir`, `injectRuntimeShield`, `aggressive` ve `cwd` gibi ek yapılandırma seçeneklerini destekler.
116
123
 
117
124
  > [!IMPORTANT]
118
125
  > **CommonJS Kullanıcıları İçin Dinamik `import()` Uyarısı:**
@@ -125,7 +132,7 @@ npx unpeek protect
125
132
 
126
133
  ### 3. Evrensel Paketleyici Eklentisi (`unpeek/unplugin`)
127
134
 
128
- Derleme sonrası CLI adımı yerine paketleyicinin `renderChunk` yaşam döngüsü sırasında bellek içi dönüşüm yapmak isterseniz [`unpeek/unplugin`](packages/unpeek/src/bundler/unplugin.ts) modülünü kullanabilirsiniz:
135
+ Derleme sonrası CLI adımı yerine paketleyicinin `renderChunk` yaşam döngüsü sırasında bellek içi dönüşüm yapmak isterseniz [`unpeek/unplugin`](./src/bundler/unplugin.ts) modülünü kullanabilirsiniz:
129
136
 
130
137
  #### Vite (`vite.config.ts`)
131
138
 
@@ -192,10 +199,138 @@ const summary = await protectProject({
192
199
 
193
200
  ---
194
201
 
202
+ ## Yapılandırma Dosyası (`unpeek.config.js` / `.mjs` / `.cjs` / `.json`)
203
+
204
+ `unpeek`, proje kök dizinindeki özel bir yapılandırma dosyası (configuration file) aracılığıyla bildirimsel yapılandırmayı destekler. Hem CLI hem de paketleyici eklentileri (bundler plugins), yapılandırma dosyalarını şu öncelik sırasına göre otomatik olarak keşfeder:
205
+ 1. `unpeek.config.js`
206
+ 2. `unpeek.config.mjs`
207
+ 3. `unpeek.config.cjs`
208
+ 4. `unpeek.config.json`
209
+
210
+ ### Tip Güvenli Yapılandırma (`defineConfig`)
211
+
212
+ IDE otomatik tamamlama ve TypeScript tip doğrulamasını etkinleştirmek için `'unpeek'` üzerinden `defineConfig` yardımcısını içe aktarın:
213
+
214
+ ```javascript
215
+ // unpeek.config.mjs (veya unpeek.config.js)
216
+ import { defineConfig } from 'unpeek';
217
+
218
+ export default defineConfig({
219
+ // Hedef çatı geçersiz kılma ('nextjs' | 'vite' | 'webpack' | 'vanilla')
220
+ framework: 'nextjs',
221
+
222
+ // Hedef çalışma ortamı ('browser' | 'worker' | 'universal')
223
+ target: 'browser',
224
+
225
+ // İstemci çıktı dizini geçersiz kılma (belirtilmezse çatıdan otomatik algılanır)
226
+ outDir: '.next/static/chunks',
227
+
228
+ // Korumaya dahil edilecek dosya uzantıları
229
+ extensions: ['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs'],
230
+
231
+ // Genel statik varlık dizinleri
232
+ publicDirs: ['public', 'static'],
233
+
234
+ // Dosya dahil etme ve hariç tutma filtreleri
235
+ filter: {
236
+ include: [],
237
+ exclude: ['node_modules/**', '**/*.test.*', '**/*.spec.*'],
238
+ },
239
+
240
+ // Çağrı grafiği analizi ve sıcak yol (hot path) ince ayarları
241
+ hotPath: {
242
+ // Korumadan muaf tutulacak özel animasyon döngüsü ve zamanlayıcı fonksiyonları
243
+ customAnimationCalls: ['requestAnimationFrame', 'ticker', 'renderLoop'],
244
+ // UI render sınırı olarak ele alınacak özel React kancaları (hooks)
245
+ customHooks: ['useAnimation', 'useCanvas'],
246
+ // Sıcak döngü muamelesi görecek yüksek mertebe dizi fonksiyonları
247
+ arrayHofMethods: ['map', 'filter', 'reduce', 'forEach'],
248
+ // Sıcak yol muafiyeti için geçişken çağıran tarama derinliği (varsayılan: 2)
249
+ maxPipelineCallers: 2,
250
+ // AST dönüşümünden tamamen muaf tutulacak bileşen adları
251
+ excludeComponents: ['VirtualTable', 'DataGrid'],
252
+ },
253
+
254
+ // Polimorfik metin kasası (string vault) yapılandırması
255
+ vault: {
256
+ // O(1) kConst dizisine şifrelenecek minimum metin uzunluğu (varsayılan: 4)
257
+ minStringLength: 4,
258
+ // CSS çatısı sınıf ayrıştırması ('tailwind' | 'unocss' | 'none')
259
+ cssFramework: 'tailwind',
260
+ // UI sınıf dizgilerini ve anlamsal DOM bağlayıcılarını koru
261
+ semanticAnchors: {
262
+ excludeUiClasses: true,
263
+ },
264
+ // Otomatik entropi tarayıcılarını yanıltmak için sahte metinler üret
265
+ polymorphicDecoys: true,
266
+ },
267
+
268
+ // Tanımlayıcı ve sembol maskeleme (mangler) yapılandırması
269
+ mangler: {
270
+ // Maskelemeden muaf tutulacak üst düzey tanımlayıcılar
271
+ reservedIdentifiers: ['__NEXT_DATA__', '__PRELOADED_STATE__'],
272
+ // Korunacak özellik önekleri
273
+ excludePrefixes: ['data-', 'aria-'],
274
+ // Korunacak düzenli ifade (RegExp) desenleri
275
+ excludePatterns: [/^on[A-Z]/],
276
+ },
277
+
278
+ // Özel kaynak haritası (source map) kasası seçenekleri
279
+ sourcemaps: {
280
+ // .map dosyalarını özel kasa dizinine taşı (varsayılan: true)
281
+ keepPrivate: true,
282
+ // Taşınan kaynak haritaları için özel dizin adı (varsayılan: '.unpeek-maps')
283
+ vaultDir: '.unpeek-maps',
284
+ // İstemci paketlerinden //# sourceMappingURL= yönergelerini temizle (varsayılan: true)
285
+ stripComments: true,
286
+ },
287
+
288
+ // Next.js'e özgü geçersiz kılmalar
289
+ next: {
290
+ // Özel derleme çıktı dizini (varsayılan: '.next')
291
+ distDir: '.next',
292
+ },
293
+
294
+ // Vite'a özgü geçersiz kılmalar
295
+ vite: {
296
+ // Çıktı dizini (varsayılan: 'dist')
297
+ outDir: 'dist',
298
+ // outDir içerisindeki varlıklar dizini (varsayılan: 'assets')
299
+ assetsDir: 'assets',
300
+ },
301
+ });
302
+ ```
303
+
304
+ JSON formatındaki yapılandırmalar için (`unpeek.config.json`):
305
+
306
+ ```json
307
+ {
308
+ "framework": "nextjs",
309
+ "target": "browser",
310
+ "vault": {
311
+ "minStringLength": 4,
312
+ "cssFramework": "tailwind"
313
+ },
314
+ "sourcemaps": {
315
+ "keepPrivate": true,
316
+ "vaultDir": ".unpeek-maps"
317
+ },
318
+ "next": {
319
+ "distDir": ".next"
320
+ }
321
+ }
322
+ ```
323
+
324
+ ---
325
+
195
326
  ## `.unpeek-maps/` Source Map Kasası ve Sentry İş Akışı
196
327
 
197
328
  `keepPrivateMaps` etkinleştirildiğinde (varsayılan), `unpeek` genel çıktı dizininizdeki tüm `.js.map` dosyalarını göreli dosya adlarını koruyarak `.unpeek-maps/` dizinine taşır ve genel `.js` dosyalarından `//# sourceMappingURL=` yönergelerini temizler.
198
329
 
330
+ > [!CAUTION]
331
+ > **Konteyner Güvenliği Uyarısı (`.dockerignore`):**
332
+ > Web uygulamalarınızı Docker ile paketlerken `.unpeek-maps/` dizininin `.dockerignore` dosyasına eklendiğinden emin olun. Eğer `.unpeek-maps/` atlanırsa, standart `COPY . .` komutları özel kaynak haritalarını yayınlanan konteyner imaj katmanına kopyalar ve imaja erişimi olan herkesin orijinal kaynak kodlarınızı elde etmesine yol açar. `unpeek` CLI, derleme sırasında `.dockerignore` dosyasını otomatik olarak denetler ve bu kayıt eksikse uyarı mesajı görüntüler.
333
+
199
334
  Üretim hata izleme sistemlerinde tam yığın izi çözümlemesini (symbolication) korumak için:
200
335
 
201
336
  ```bash
@@ -212,7 +347,7 @@ npx @sentry/cli sourcemaps upload .unpeek-maps --release="$GIT_COMMIT_SHA"
212
347
 
213
348
  ## Yapay Zeka Kodlama Ajanı Entegrasyonu (AI Coding Agent Integration)
214
349
 
215
- `unpeek`, açık Vercel Agent Skills belirtimi ve Ajan Becerileri Keşif Optimizasyonu (SDO) standartlarıyla tam uyumlu resmi bir Yapay Zeka Ajan Becerisi ([`skills/unpeek/SKILL.md`](skills/unpeek/SKILL.md)) sunar. Bu beceriyi eklemek; kodlama ajanlarınıza (Claude Code, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot, OpenCode) istemci paketlerini koruma, hot-path performans bütçelerini (<%2 CPU, <%15 Gzip) koruma, SSR sınırlarını gözetme ve `.unpeek-maps/` kasasını CI/CD hatlarına bağlama konularında derin uzmanlık kazandırır.
350
+ `unpeek`, açık Vercel Agent Skills belirtimi ve Ajan Becerileri Keşif Optimizasyonu (SDO) standartlarıyla tam uyumlu resmi bir Yapay Zeka Ajan Becerisi ([`SKILL.md`](https://github.com/Woffluon/unpeek/blob/main/skills/unpeek/SKILL.md)) sunar. Bu beceriyi eklemek; kodlama ajanlarınıza (Claude Code, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot, OpenCode) istemci paketlerini koruma, hot-path performans bütçelerini (<%2 CPU, <%15 Gzip) koruma, SSR sınırlarını gözetme ve `.unpeek-maps/` kasasını CI/CD hatlarına bağlama konularında doğrudan operasyonel iş akışları kazandırır.
216
351
 
217
352
  ### Beceri (Skill) Kurulumu
218
353
 
@@ -266,7 +401,7 @@ $unpeek Protect this build with passive telemetry and seed 0x7f4a2c.
266
401
 
267
402
  ### Token-Optimize Modüler Referans Yapısı (`skills/unpeek/references/`)
268
403
 
269
- Ajan bağlam penceresini (context window) korumak ve gereksiz token tüketimini önlemek için ana [`skills/unpeek/SKILL.md`](skills/unpeek/SKILL.md) dosyası kompakt tutulmuş; detaylı rehberler `skills/unpeek/references/` dizini altındaki 6 modüler dokümana ayrılmıştır:
404
+ Ajan bağlam penceresini (context window) korumak ve gereksiz token tüketimini önlemek için ana [`SKILL.md`](https://github.com/Woffluon/unpeek/blob/main/skills/unpeek/SKILL.md) dosyası kompakt tutulmuş; detaylı rehberler `skills/unpeek/references/` dizini altındaki 6 modüler dokümana ayrılmıştır:
270
405
 
271
406
  - **`quickstart.md`**: Sıfır ayarlı kurulum, postbuild betikleri ve 3 adımlı doğrulama döngüsü.
272
407
  - **`frameworks.md`**: Çatı bazlı yapılandırmalar ve SSR istemci sınırları (Next.js, Vite, Webpack, Rollup).
@@ -316,7 +451,7 @@ powershell -File scripts/validate-version.ps1 -Message "fix: description"
316
451
  powershell -File scripts/stage-release.ps1
317
452
  ```
318
453
 
319
- ### Benchmark Çıktı Referansı ([`packages/unpeek/benchmarks/overhead.bench.ts`](packages/unpeek/benchmarks/overhead.bench.ts))
454
+ ### Benchmark Çıktı Referansı ([`./benchmarks/overhead.bench.ts`](./benchmarks/overhead.bench.ts))
320
455
 
321
456
  - **Derleme / Dönüşüm Süresi:** `< 3000 ms`
322
457
  - **Gzip Boyut Artışı:** `< %15` (üretim uygulama paketlerinde)