[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-80878":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":39,"readmeContent":40,"aiSummary":41,"trendingCount":15,"starSnapshotCount":15,"syncStatus":42,"lastSyncTime":43,"discoverSource":44},80878,"syv","kyrtstn\u002Fsyv","kyrtstn","syv ⚡ A dual-threat optimization CLI. Combines local Static Site Generation (SSG) caching and Single Page Application (SPA) payload compression into one lightweight, zero-dependency daemon. Built for Termux and Linux.","",null,"Python",75,7,5,0,1,6,42,3,2.71,"MIT License",false,"main",true,[26,27,28,7,29,30,31,32,33,34,5,35,36,37,38],"caching","ci-cd","cli","multi-threading","optimization","python","spa","ssg","static-site-generator","web-performance","zero-dependencies","zero-dependency","zero-dependency-python","2026-06-12 02:04:08","# ⚡ syv\n**The Zero-Dependency Optimization Daemon (v5.1 Ultimate)**\n\n[![Python 3.6+](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fpython-3.6+-blue.svg)](https:\u002F\u002Fwww.python.org\u002Fdownloads\u002F)\n[![Zero Dependencies](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdependencies-0-brightgreen.svg)]()\n[![Security Hardened](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fsecurity-SSRF%20%7C%20Traversal%20Safe-red.svg)]()\n[![Platform: Linux | macOS | Windows | Termux](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fplatform-POSIX%20%7C%20NT-lightgrey.svg)]()\n[![GitHub Repo stars](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fstars\u002Fkyrtstn\u002Fsyv?style=lightgrey)]()\n[![Star Check](https:\u002F\u002Fwww.fakestarchecker.com\u002Fapi\u002Fbadge\u002Fkyrtstn\u002Fsyv.svg)]()\n\n`syv` is a hyper-lightweight, multi-threaded optimization engine designed to sit between your raw development code and your production web servers. By natively handling **Single Page Application (SPA) payload compression**, **automatic DOM cache-busting injection**, and **Static Site Generation (SSG) caching**, `syv` drastically reduces Time-To-First-Byte (TTFB) and network latency without the bloat of modern JS frameworks.\n\n---\n\n## 🧠 The Philosophy of `syv`\n\nModern web development suffers from dependency fatigue. Tools like Webpack, Vite, or Next.js are incredibly powerful, but they often require downloading gigabytes of `node_modules` just to perform basic file compression or routing. \n\n`syv` was built in defiance of this trend, strictly adhering to the following tenets:\n1. **The Zero-Dependency Oath:** Written entirely in standard Python 3. No `pip install`, no `npm install`, no virtual environments. You drop the binary into your system, and it runs instantly.\n2. **The UNIX Philosophy:** Do one thing, and do it perfectly. `syv` is not a web server. It is a file-generation middleware that generates mathematically hashed payloads and manifests for your actual server (Nginx, Express, FastAPI) to serve.\n3. **Bare-Metal Performance:** By utilizing `concurrent.futures` for multi-threading and low-level `os.path` polling for file watching, it maximizes hardware utilization (from 8-core desktop CPUs to ARM-based Termux environments).\n4. **Enterprise Reliability:** Built-in self-healing retries, granular POSIX exit codes, and actionable exception handling make `syv` a bulletproof, fault-tolerant addition to any CI\u002FCD pipeline.\n\n---\n\n## ✨ Core Capabilities\n\n### 1. Security Hardening & Pre-flight Validation *(New in v5.1)*\n`syv` is built to withstand hostile environments and malicious inputs. The daemon includes strict validation layers:\n* **SSRF Prevention:** The SSG scraper strictly validates that all target URLs are localhost-bound (`127.0.0.1` or `::1`), preventing Server-Side Request Forgery attacks.\n* **Symlink & Path Traversal Blocking:** Refuses to follow symbolic links during cache removal and rejects manifest keys containing `..\u002F`, `\u002F`, or `~` to prevent unauthorized file system access.\n* **Pre-flight Checks:** Automatically validates directory read\u002Fwrite permissions and checks `shutil.disk_usage` before initiating massive multi-threaded I\u002FO operations to prevent disk-full crashes.\n\n### 2. Fault-Tolerance & Self-Healing *(New in v5.1)*\nNetwork drops and memory spikes are a reality. `syv` handles them gracefully:\n* **Exponential Backoff:** Network operations (like sitemap scraping) utilize a `@with_retry` decorator with exponential backoff to survive temporary server overloads.\n* **Graceful Degradation:** If the multi-core `ThreadPoolExecutor` triggers a `MemoryError` on massive directories, `syv` automatically falls back to sequential processing instead of crashing.\n* **Unicode Fallback Chain:** Reads legacy files using a smart decoding chain (`UTF-8` → `latin-1` → `cp1252`), preventing pipeline failures due to malformed characters.\n\n### 3. Automatic DOM Cache-Busting Injection *(New in v5.1)*\nInjecting hashed asset URLs into your HTML shouldn't require backend logic. After every `syv build`, the **DOM Rewriter** scans all `.html` files in your build directory and rewrites asset references in-place using the generated `build_manifest.json`.\n\n**Before:**\n```html\n\u003Cscript src=\"app.js\">\u003C\u002Fscript>\n```\n**After `syv build`:**\n```html\n\u003Cscript src=\"app.js?v=e3b0c4\">\u003C\u002Fscript>\n```\n\n### 4. Multi-Core Payload Compression (SPA)\nWhen dealing with hundreds of heavy JavaScript and CSS files, `syv` maps your build directory to an optimized thread pool, utilizing available CPU cores (capped dynamically to prevent resource exhaustion) to calculate MD5 hashes and generate `.gz` gzip streams simultaneously.\n\n### 5. Live Watch Daemon (Developer Experience)\nInstead of relying on heavy third-party filesystem event libraries, `syv watch` utilizes a highly optimized `os.path.getmtime` polling loop. It features a `MAX_WATCHED_FILES` limit (100,000 files) and periodic memory cleanup to ensure zero memory leaks during extended development sessions.\n\n### 6. Dynamic API Freezing & Multi-Page SSG\n`syv run update` acts as a localized web crawler. It automatically detects `\u002Fsitemap.xml` and utilizes multi-threading to concurrently scrape and freeze your dynamic backend into a flat `.\u002Fsyv_cache\u002F` directory alongside a Time-To-Live (TTL) metadata manifest.\n\n---\n\n## 📂 Workspace Anatomy\n\nWhen `syv` is initialized and running in your project, it manages your workspace efficiently without cluttering it. Here is how your project structure will look:\n\n```text\n.\n├── syv                      # The core Zero-Dependency Python Daemon\n├── syv.json                 # Daemon configuration (Generated by `syv init`)\n├── installer\u002F               \n│   └── install.cmd          # Windows fast-installer & PATH injector\n│   └── uninstall.cmd          # Windows fast-uninstaller & PATH uninjector\n├── dist\u002F                    # Target SPA Build Directory (Your frontend output)\n│   ├── build_manifest.json  # Auto-generated MD5 version map\n│   ├── index.html           # DOM-rewritten HTML (auto-injected by syv)\n│   ├── js\u002F\n│   │   ├── app.js           # Raw JS asset\n│   │   └── app.js.gz        # Multi-thread compressed gzip payload\n│   └── css\u002F\n│       ├── style.css        # Raw CSS asset\n│       └── style.css.gz     # Compressed payload\n└── syv_cache\u002F               # Local SSG Cache (Generated by `syv run update`)\n    ├── manifest.json        # TTL metadata & generation stats\n    ├── index.html           # Scraped root route\n    └── dashboard\u002F\n        └── index.html       # Frozen dynamic endpoint\n```\n\n---\n\n## 📦 Installation\n\nSince `syv` is a standalone Python script, installation is simply making it executable and moving it to your system's PATH.\n\n**For Linux \u002F macOS \u002F Termux:**\n```bash\ncurl -O [https:\u002F\u002Fraw.githubusercontent.com\u002Fkyrtstn\u002Fsyv\u002Fmain\u002Fsyv](https:\u002F\u002Fraw.githubusercontent.com\u002Fkyrtstn\u002Fsyv\u002Fmain\u002Fsyv)\nchmod +x syv\nsudo mv syv \u002Fusr\u002Flocal\u002Fbin\u002F\n```\n\n**For Windows (CMD \u002F PowerShell):**\n`syv` is 100% Windows compatible (including native ANSI terminal aesthetics).\n\n1. Clone the repo and run the installer:\n   ```cmd\n   installer\\install.bat\n   ```\n2. Open a **new** terminal and verify:\n   ```cmd\n   syv help\n   ```\n\n---\n\n## ⚙️ Configuration (`syv.json`)\n\n`syv` respects a `syv.json` file placed in the project root. Generate a template using `syv init`.\n\n```json\n{\n  \"port\": 3000,\n  \"ignore\": [\"node_modules\", \".git\", \".venv\", \"tests\", \"syv_cache\"],\n  \"ttl\": 3600,\n  \"silent_mode\": false\n}\n```\n\n---\n\n## 🛠️ CLI Reference\n\n### Global Utility\n```bash\nsyv init                   # Generate default syv.json template\nsyv clean .\u002Fdist           # Purge .gz files, manifests, and local cache\nsyv build .\u002Fdist --dry-run # Simulate operations without disk I\u002FO\n```\n\n### SPA Operations (Frontend Bundles)\n```bash\nsyv build .\u002Fdist           # Multi-threaded build + automatic DOM injection\nsyv watch .\u002Fdist           # Initialize the live-reload daemon\nsyv build .\u002Fdist --debug   # Enable verbose, actionable execution logs\n```\n\n### SSG Operations (Backend Endpoints)\n```bash\nsyv run update             # Scrapes default port (8080 or config port)\nsyv run update -p 5000     # Scrape specific port\nsyv force run update       # Bypass TTL checks and force hard rebuild\n```\n\n---\n\n## 🤖 CI\u002FCD & Strict Exit Codes\n\n`syv` v5.1 features a highly structured exception hierarchy. It acts as a bulletproof CI\u002FCD citizen by halting deployments on failure and returning granular POSIX exit codes to help automated runners diagnose the exact root cause.\n\n| Exit Code | Classification | Description |\n| :--- | :--- | :--- |\n| `0` | **Success** | Execution completed flawlessly. |\n| `1` | **Fatal Error** | General execution or unexpected thread failure. |\n| `2` | **Config Error** | Invalid `syv.json` syntax or bad CLI parameters (e.g., invalid port). |\n| `3` | **Network Error** | Connection timeouts, DNS failures, or completely dead routes. |\n| `7` | **Security Error** | SSRF attempts, path traversals, or symlink violations detected. |\n| `8` | **Resource Error** | System out of memory or thread explosion. |\n| `13` | **File System Error** | Permission denied, disk full (`ENOSPC`), or missing directories. |\n\n**Example GitHub Actions Pipeline:**\n```yaml\nname: syv Optimization Pipeline\non: [push]\njobs:\n  build-and-optimize:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions\u002Fcheckout@v3\n      - name: Compile Source Code\n        run: npm run build\n      - name: Optimize Payloads with syv\n        run: |\n          chmod +x .\u002Fsyv\n          .\u002Fsyv build .\u002Fdist\n      - name: Deploy to Production\n        run: echo \"Deploying highly optimized, secure payloads...\"\n```\n\n---\n\n## 📈 Star History\n\n\u003Ca href=\"https:\u002F\u002Fwww.star-history.com\u002F?repos=kyrtstn%2Fsyv&type=date&legend=top-left\">\n \u003Cpicture>\n   \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"https:\u002F\u002Fapi.star-history.com\u002Fchart?repos=kyrtstn\u002Fsyv&type=date&theme=dark&legend=bottom-right\" \u002F>\n   \u003Csource media=\"(prefers-color-scheme: light)\" srcset=\"https:\u002F\u002Fapi.star-history.com\u002Fchart?repos=kyrtstn\u002Fsyv&type=date&legend=bottom-right\" \u002F>\n   \u003Cimg alt=\"Star History Chart\" src=\"https:\u002F\u002Fapi.star-history.com\u002Fchart?repos=kyrtstn\u002Fsyv&type=date&legend=bottom-right\" \u002F>\n \u003C\u002Fpicture>\n\u003C\u002Fa>\n","syv 是一个轻量级的优化命令行工具，旨在通过结合静态站点生成（SSG）缓存和单页应用（SPA）负载压缩来提升网页性能。它采用纯 Python 3 编写，无需任何外部依赖即可运行，特别适合在 Termux 和 Linux 环境下使用。核心功能包括多线程处理、自动 DOM 缓存清除注入以及高效的文件生成机制，显著降低了首字节时间（TTFB）和网络延迟。此外，syv 还具备强大的安全特性，如防止服务器端请求伪造（SSRF）攻击和路径遍历防护，确保在开发和生产环境中的稳定性和安全性。适用于需要快速部署且对性能有高要求的前端项目，特别是在资源受限或需要极简配置的情况下。",2,"2026-06-11 04:02:39","CREATED_QUERY"]