unpeek 1.2.0 → 1.4.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.
package/README.md CHANGED
@@ -1,13 +1,24 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Woffluon/unpeek/main/assets/banner.svg">
4
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Woffluon/unpeek/main/assets/banner.svg">
5
+ <img src="https://raw.githubusercontent.com/Woffluon/unpeek/main/assets/banner.svg" alt="unpeek - call-graph aware client-side javascript protection" width="100%">
6
+ </picture>
7
+ </p>
8
+
1
9
  # unpeek
2
10
 
3
- **Zero-config, call-graph-aware polymorphic JavaScript protection and runtime anti-tamper toolkit with <2% CPU overhead.**
11
+ **Nothing to peek at. Nothing to slow down.**
12
+
13
+ Zero-config, call-graph-aware client-side JavaScript protection and runtime anti-tamper toolkit with <2% CPU overhead and <15% Gzip budget.
4
14
 
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-emerald.svg)](LICENSE)
6
- [![CPU Overhead](https://img.shields.io/badge/CPU_Overhead-%3C2%25-10b981.svg)](packages/unpeek/benchmarks/overhead.bench.ts)
7
- [![Gzip Delta](https://img.shields.io/badge/Gzip_Delta-%3C15%25-06b6d4.svg)](packages/unpeek/benchmarks/overhead.bench.ts)
8
- [![Interactive Playground](https://img.shields.io/badge/Playground-Live_Demo-6366f1.svg)](https://woffluon.github.io/unpeek)
15
+ [![License: MIT](https://img.shields.io/badge/License-MIT-111111.svg?style=flat-square)](LICENSE)
16
+ [![Hot-Path CPU](https://img.shields.io/badge/Hot--Path%20CPU-%3C2%25-FF3300.svg?style=flat-square)](packages/unpeek/benchmarks/overhead.bench.ts)
17
+ [![Gzip Delta](https://img.shields.io/badge/Gzip%20Delta-%3C15%25-111111.svg?style=flat-square)](packages/unpeek/benchmarks/overhead.bench.ts)
18
+ [![Interactive Showcase](https://img.shields.io/badge/Showcase-Live%20Demo-FF3300.svg?style=flat-square)](https://woffluon.github.io/unpeek)
19
+ [![Documentation](https://img.shields.io/badge/Docs-Dedicated%20Reference-111111.svg?style=flat-square)](https://woffluon.github.io/unpeek/docs)
9
20
 
10
- English | [Türkçe](./README.tr.md) · [Live Interactive Playground](https://woffluon.github.io/unpeek) · [Agent Architecture Guide](./AGENTS.md) · [AI Skill](./skills/unpeek/SKILL.md)
21
+ English | [Türkçe](./README.tr.md) · [Interactive Showcase](https://woffluon.github.io/unpeek) · [Documentation](https://woffluon.github.io/unpeek/docs) · [Agent Architecture Guide](./AGENTS.md) · [AI Skill](./skills/unpeek/SKILL.md)
11
22
 
12
23
  ---
13
24
 
package/README.tr.md CHANGED
@@ -1,13 +1,24 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Woffluon/unpeek/main/assets/banner.svg">
4
+ <source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/Woffluon/unpeek/main/assets/banner.svg">
5
+ <img src="https://raw.githubusercontent.com/Woffluon/unpeek/main/assets/banner.svg" alt="unpeek - call-graph aware client-side javascript protection" width="100%">
6
+ </picture>
7
+ </p>
8
+
1
9
  # unpeek
2
10
 
3
- **Sıfır yapılandırma gerektiren, çağrı grafiği (call-graph) farkındalıklı, <%2 CPU ek yüküne sahip polimorfik JavaScript koruma ve çalışma zamanı (runtime) müdahale önleme aracı.**
11
+ **Bakılacak bir şey yok. Yavaşlayacak hiçbir şey yok.**
12
+
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ı.
4
14
 
5
- [![Lisans: MIT](https://img.shields.io/badge/Lisans-MIT-emerald.svg)](LICENSE)
6
- [![CPU Ek Yükü](https://img.shields.io/badge/CPU_Ek_Y%C3%BCk%C3%BC-%3C2%25-10b981.svg)](packages/unpeek/benchmarks/overhead.bench.ts)
7
- [![Gzip Artışı](https://img.shields.io/badge/Gzip_Art%C4%B1%C5%9F%C4%B1-%3C15%25-06b6d4.svg)](packages/unpeek/benchmarks/overhead.bench.ts)
8
- [![Canlı Demo](https://img.shields.io/badge/Playground-Canl%C4%B1_Demo-6366f1.svg)](https://woffluon.github.io/unpeek)
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)
18
+ [![Canlı Demo](https://img.shields.io/badge/Showcase-Canl%C4%B1%20Demo-FF3300.svg?style=flat-square)](https://woffluon.github.io/unpeek)
19
+ [![Dokümantasyon](https://img.shields.io/badge/Docs-Detayl%C4%B1%20Referans-111111.svg?style=flat-square)](https://woffluon.github.io/unpeek/docs)
9
20
 
10
- [English](./README.md) | Türkçe · [Canlı İnteraktif Playground](https://woffluon.github.io/unpeek) · [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](./AGENTS.md) · [Yapay Zeka Becerisi (SKILL.md)](./skills/unpeek/SKILL.md)
11
22
 
12
23
  ---
13
24
 
@@ -0,0 +1,22 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 200" width="100%" height="auto" fill="none">
2
+ <!-- Minimalist Carbon Canvas -->
3
+ <rect width="960" height="200" rx="6" fill="#111111" />
4
+ <rect x="0.5" y="0.5" width="959" height="199" rx="5.5" stroke="#2A2A28" />
5
+
6
+ <!-- Signal Orange Top Line -->
7
+ <rect x="0" y="0" width="960" height="2" fill="#FF3300" />
8
+
9
+ <!-- Iconic Brand Mark (Sealed block with open hot-path cut) -->
10
+ <g transform="translate(458, 30) scale(1.833)">
11
+ <path d="M2 2h15l5 5v15H2V2Z" fill="#EDEAE1" />
12
+ <rect x="0" y="10.5" width="24" height="3" fill="#FF3300" />
13
+ </g>
14
+
15
+ <!-- Wordmark -->
16
+ <text x="480" y="122" text-anchor="middle" fill="#EDEAE1" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="38" font-weight="700" letter-spacing="-0.035em">unpeek</text>
17
+
18
+ <!-- Tagline -->
19
+ <text x="480" y="154" text-anchor="middle" fill="#8E8A7E" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif" font-size="14" font-weight="400" letter-spacing="-0.01em">
20
+ Nothing to peek at. <tspan fill="#EDEAE1">Nothing to slow down.</tspan>
21
+ </text>
22
+ </svg>
@@ -1224,7 +1224,7 @@ ${finalCode}`;
1224
1224
  }
1225
1225
 
1226
1226
  // src/cli/index.ts
1227
- var VERSION = "1.2.0";
1227
+ var VERSION = "1.4.0";
1228
1228
  function getPackageVersion() {
1229
1229
  try {
1230
1230
  const pkgUrl = new URL("../../package.json", importMetaUrl);
@@ -1236,25 +1236,52 @@ function getPackageVersion() {
1236
1236
  }
1237
1237
  }
1238
1238
  var RUNTIME_VERSION = getPackageVersion();
1239
+ var MARK_TOP = " \u259B\u2580\u2580\u259C";
1240
+ var MARK_BOTTOM = " \u2599\u2584\u2584\u259F";
1241
+ var RULE = "\u2500";
1242
+ var LABEL_WIDTH = 19;
1243
+ function colorEnabled() {
1244
+ if (process.env.NO_COLOR) return false;
1245
+ if (process.env.TERM === "dumb") return false;
1246
+ return Boolean(process.stdout.isTTY);
1247
+ }
1248
+ function paint(code, text) {
1249
+ return colorEnabled() ? `\x1B[${code}m${text}\x1B[0m` : text;
1250
+ }
1251
+ function dim(text) {
1252
+ return paint("2", text);
1253
+ }
1254
+ function brandBlock() {
1255
+ return [
1256
+ `${MARK_TOP} ${paint("1", `unpeek ${RUNTIME_VERSION}`)}`,
1257
+ `${MARK_BOTTOM} ${dim("client bundle protection")}`
1258
+ ].join("\n");
1259
+ }
1260
+ function sectionBlock(title, rows) {
1261
+ const fill = Math.max(2, 46 - title.length);
1262
+ const header = ` ${dim(title)} ${dim(RULE.repeat(fill))}`;
1263
+ const body = rows.map(([label, value]) => ` ${dim(label.padEnd(LABEL_WIDTH))} ${value}`);
1264
+ return [header, ...body].join("\n");
1265
+ }
1239
1266
  function printHelp() {
1240
- const helpText = `
1241
- unpeek v${VERSION} \u2014 Call-graph-aware polymorphic AST obfuscation & runtime shield
1242
-
1243
- Usage:
1244
- unpeek init [--dry-run] Configure postbuild hook & .unpeek-maps/ vault
1245
- unpeek protect [options] Protect client bundles in-place
1246
-
1247
- Options:
1248
- --out-dir <dir> Explicit client output directory
1249
- --seed <number> Deterministic polymorphic seed
1250
- --passive Use passive deterrent mode instead of gradual
1251
- --no-maps Delete .map files instead of vaulting to .unpeek-maps/
1252
- --min-string-length <num> Minimum string length for encryption vault (default: 4)
1253
- --private-maps-dir <dir> Directory to store vaulted source maps (default: .unpeek-maps)
1254
- --no-shield Do not inject runtime anti-tamper deterrent shield
1255
- -h, --help Show help message
1256
- -v, --version Show version number
1257
- `.trim();
1267
+ const helpText = [
1268
+ brandBlock(),
1269
+ "",
1270
+ " Usage:",
1271
+ " unpeek init [--dry-run] wire postbuild and the .unpeek-maps/ vault",
1272
+ " unpeek protect [options] protect client bundles in place",
1273
+ "",
1274
+ " Options:",
1275
+ " --out-dir <dir> explicit client output directory",
1276
+ " --seed <number> deterministic polymorphic seed",
1277
+ " --passive passive deterrent mode instead of gradual",
1278
+ " --no-maps delete .map files instead of vaulting them",
1279
+ " --min-string-length <num> minimum string length for the vault (default: 4)",
1280
+ " --private-maps-dir <dir> vault directory (default: .unpeek-maps)",
1281
+ " --no-shield skip the runtime anti-tamper shield",
1282
+ " -h, --help show help",
1283
+ " -v, --version show version"
1284
+ ].join("\n");
1258
1285
  console.log(helpText);
1259
1286
  }
1260
1287
  function formatBytes(bytes) {
@@ -1263,30 +1290,66 @@ function formatBytes(bytes) {
1263
1290
  }
1264
1291
  function printSummaryTable(summary) {
1265
1292
  const sign = summary.gzipDeltaPercent > 0 ? "+" : "";
1266
- const rows = [
1267
- ["Framework", summary.framework],
1268
- ["Client OutDir", summary.outDir],
1269
- ["Processed Bundles", String(summary.processedFiles)],
1270
- ["Vaulted Source Maps", String(summary.movedSourceMaps)],
1271
- ["Cold Functions Protected", String(summary.totalColdFunctionsProtected)],
1272
- ["Hot Functions Skipped (0% Tax)", String(summary.totalHotFunctionsSkipped)],
1273
- ["Encrypted Strings", String(summary.totalEncryptedStrings)],
1274
- ["Mangled Symbols", String(summary.totalMangledSymbols)],
1275
- [
1276
- "Gzip Bundle Size",
1277
- `${formatBytes(summary.originalGzipBytes)} -> ${formatBytes(summary.protectedGzipBytes)} (${sign}${summary.gzipDeltaPercent}%)`
1278
- ],
1279
- ["Elapsed Time", `${summary.elapsedMs} ms`]
1280
- ];
1281
- const col1Width = Math.max(...rows.map(([k]) => k.length), 16);
1282
- const col2Width = Math.max(...rows.map(([, v]) => v.length), 20);
1283
- const divider = `+-${"-".repeat(col1Width)}-+-${"-".repeat(col2Width)}-+`;
1284
- console.log("\n[unpeek] Protection Complete");
1285
- console.log(divider);
1286
- for (const [label, value] of rows) {
1287
- console.log(`| ${label.padEnd(col1Width)} | ${value.padEnd(col2Width)} |`);
1293
+ const gzip = `${formatBytes(summary.originalGzipBytes)} -> ${formatBytes(summary.protectedGzipBytes)} ${sign}${summary.gzipDeltaPercent}%`;
1294
+ console.log("");
1295
+ console.log(brandBlock());
1296
+ console.log("");
1297
+ console.log(
1298
+ sectionBlock("PROJECT", [
1299
+ ["framework", summary.framework],
1300
+ ["output", summary.outDir],
1301
+ ["bundles", String(summary.processedFiles)]
1302
+ ])
1303
+ );
1304
+ console.log("");
1305
+ console.log(
1306
+ sectionBlock("CALL GRAPH", [
1307
+ ["hot path exempt", `${summary.totalHotFunctionsSkipped} ${dim("0% tax")}`],
1308
+ ["cold path protected", String(summary.totalColdFunctionsProtected)]
1309
+ ])
1310
+ );
1311
+ console.log("");
1312
+ console.log(
1313
+ sectionBlock("TRANSFORM", [
1314
+ ["string vault", `${summary.totalEncryptedStrings} literals ${dim("O(1) memo")}`],
1315
+ ["symbol mangling", `${summary.totalMangledSymbols} bindings`]
1316
+ ])
1317
+ );
1318
+ console.log("");
1319
+ console.log(
1320
+ sectionBlock("OUTPUT", [
1321
+ ["source maps", `${summary.movedSourceMaps} moved -> .unpeek-maps/`],
1322
+ ["gzip", gzip],
1323
+ ["elapsed", `${summary.elapsedMs} ms`]
1324
+ ])
1325
+ );
1326
+ console.log("");
1327
+ console.log(` ${dim("done. maps are private. hot path untouched.")}`);
1328
+ }
1329
+ function printInitResult(result, dryRun) {
1330
+ const postbuild = result.updatedPackageJson ? dryRun ? "would be added" : "unpeek protect (added)" : "already configured";
1331
+ const vault = result.updatedGitignore ? dryRun ? "would be ignored" : ".unpeek-maps/ (added)" : "already ignored";
1332
+ console.log("");
1333
+ console.log(brandBlock());
1334
+ console.log("");
1335
+ console.log(
1336
+ sectionBlock("PROJECT", [
1337
+ ["framework", result.framework ?? "unknown"],
1338
+ ["postbuild", postbuild],
1339
+ ["vault", vault]
1340
+ ])
1341
+ );
1342
+ console.log("");
1343
+ if (dryRun) {
1344
+ console.log(` ${dim(result.message)}`);
1345
+ } else if (result.updatedPackageJson || result.updatedGitignore) {
1346
+ console.log(` ${dim("postbuild wired. maps stay private from the first build.")}`);
1347
+ } else {
1348
+ console.log(` ${dim(result.message)}`);
1349
+ }
1350
+ if (!dryRun) {
1351
+ console.log(` ${dim("run your build to protect the first bundle.")}`);
1288
1352
  }
1289
- console.log(divider);
1290
1353
  }
1291
1354
  async function runCli(args) {
1292
1355
  if (args.length === 0 || args.includes("--help") || args.includes("-h")) {
@@ -1301,7 +1364,7 @@ async function runCli(args) {
1301
1364
  if (command === "init") {
1302
1365
  const dryRun = args.includes("--dry-run");
1303
1366
  const res = initProject(process.cwd(), { dryRun });
1304
- console.log(`[unpeek] ${res.message}`);
1367
+ printInitResult(res, dryRun);
1305
1368
  return;
1306
1369
  }
1307
1370
  if (command === "protect" || args.length > 0 && args[0].startsWith("-")) {