# xw-devtool-cli **Repository Path**: github-9819409/xw-devtool-cli ## Basic Information - **Project Name**: xw-devtool-cli - **Description**: No description available - **Primary Language**: Unknown - **License**: ISC - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-19 - **Last Updated**: 2026-05-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # xw-devtool-cli [中文文档](https://unpkg.com/xw-devtool-cli@latest/README.md) | **English** A Node.js-based developer command-line toolbox designed to provide out-of-the-box common development tools to help developers handle daily tasks quickly. Key features include: Base64 encoding/decoding, image format conversion, image <-> Base64, Mock data generation, timestamp/date formatting, time calculation, console clock, countdown timer, stopwatch, URL encoding/decoding, UUID generation, Chinese pinyin conversion, color conversion, variable format conversion, hash calculation, QR code generation, QR code recognition, special symbols, Markdown snippets, VS Code snippet generation, current directory tree generation, port occupation query and force-kill process support, etc. Most results can be copied to the clipboard in one step, greatly improving development efficiency. ## ✨ Features - **Base64 Tools**: Convert strings to/from Base64, supports reading from clipboard, file, or manual input. - **Image Tools**: - **Format Conversion**: Convert between PNG, JPG, WebP, with adjustable compression quality. - **Image ↔ Base64**: Convert images to Base64 strings and vice versa. - **Image Splitter**: Split images into grid (rows/cols) or custom split lines (pixels/percentage). - **Image Merger**: Supports two input modes (folder or multiple images); the dialog mode supports selecting multiple images at once. You can choose **horizontal** or **vertical** merge, and choose a specific output directory (dialog or manual input). Default output filename includes timestamp, and output path is copied to clipboard. - **Placeholder Image**: Quickly generate placeholder images with custom size, color, and text. - **Color Picker**: Pick a single pixel color or area average from an image; supports px/% coordinates; shows preview bar and auto-copies Hex/Hex8. - **Screen Picker**: Pick color directly from the screen at the mouse position; move the cursor and press Enter to sample; supports alpha preview. - **Screen Crosshair**: Display a full-screen red crosshair following the mouse for alignment. - **Pixel Distance**: Measure pixel distance between two points on the screen. - **Screen Mark**: Click on the screen to add text annotations. Right-click to undo, Delete to clear. - **Image Compression**: Compress a single file or an entire folder (optionally include subfolders). Supports PNG/JPG/WebP with quality 1–100. Output filenames include timestamps; the output directory is copied to clipboard. - After compression, optionally open the output directory (includes a Back option). - **Mock Data**: - Generate: Lorem Ipsum, Chinese characters, ID cards, Emails, URLs, Order IDs, Phone numbers. - Supports batch generation. - **Time Tools**: - **Formatting**: Timestamp/Date string -> `YYYY-MM-DD HH:mm:ss`. - **Timestamp**: Quickly get current millisecond timestamp. - **Calculation**: Calculate date differences or offsets (Add/Subtract). - **Console Clock**: Show real-time current time in terminal, press `Enter` or `Q` to go back. - **Countdown Timer**: Select seconds/minutes/hours first, then enter the value to start; once it reaches zero, it keeps counting with a negative sign (such as `-00:00:05`). - **Stopwatch**: Start from `00:00:00` and count up every second in terminal. - **Dev Tools**: - **URL Encode/Decode** - **Unicode Encode/Decode**: Text <-> Unicode escape sequences (\uXXXX). - **UUID**: Generate UUID v4. - **Pinyin**: Convert Chinese characters to Pinyin (without tone). - **Base Converter**: Convert between Binary, Octal, Decimal, and Hexadecimal. - **Color Converter**: Hex <-> RGB, and shows a color bar preview in results (with checkerboard alpha simulation); Hex auto-copied. - **Color Preview**: Enter a color and display a color bar in terminal for quick visual confirmation; Hex is auto-copied to clipboard. - **Variable Format**: CamelCase, PascalCase, SnakeCase, KebabCase, ConstantCase. - **Hash Calculator**: MD5, SHA1, SHA256, SHA512, SM3. - **QR Code**: Display QR codes in terminal, save as PNG. - **QR Code Reader**: Select a QR code image and recognize the content, then copy the result to clipboard. - **Special Symbols**: 170+ symbols, arrows, math symbols, etc. - **Emoji Picker**: Browse and copy emojis. - **HTML Entity**: Encode/Decode HTML entities. - **Markdown Snippets**: Common Markdown templates. - **VS Code Snippets**: Generate VS Code snippet JSON from code. - **Git Helper**: Generate standardized Git branch names (feature/bugfix) and Conventional Commits messages. - **Current Directory Tree**: Generate the file tree for the current directory with optional depth limit, then choose to copy to clipboard or export as a `.txt` file. - **Port Occupation / Kill Process**: Enter a port to view occupied processes, then force-kill one selected process or all occupied processes. - **Line Ending Converter**: Detect the file's line ending type (CRLF/LF) and support one-click conversion. - **Convenience**: - File selection dialog (Windows). - Auto-copy results to clipboard. - Auto-read from clipboard. - Save large results to file. - **Internationalization (i18n)**: - Support **English** and **Chinese**. - Switch via **Settings** in the menu or use CLI flags: `xw-devtool --en` / `xw-devtool --zh`. ## 💻 System Requirements This tool is based on Node.js and supports multiple platforms, but some screen-interaction features are currently **Windows only** (due to reliance on PowerShell/WinForms): - **Screen Color Pick** (Screen source) - **Screen Crosshair** - **Pixel Distance Tool** - **Screen Mark Tool** - **File Dialogs** (Select/Save file) - *On non-Windows systems, please input file paths manually.* - **Port Occupation / Kill Process** (Windows: `netstat` / `taskkill`, macOS/Linux: `lsof` or `ss` + `kill`) All other features (Image processing, Encoders, Mock data, Time, etc.) are fully cross-platform (Windows/macOS/Linux). ## 📦 Installation ### Global Installation (Recommended) ```bash npm install -g xw-devtool-cli ``` After installation, use `xw-devtool` or `xw-dev` command. ### Run via npx ```bash npx xw-devtool-cli@latest ``` ## 🚀 Quick Start Run in terminal: ```bash xw-devtool ``` Or specify language directly: ```bash xw-devtool --en # Start in English xw-devtool --zh # Start in Chinese ``` The interactive menu will appear. You can enter a feature key directly, or type a keyword (e.g. `json`, `image`, `git`) to search and then choose from matched results: ```text ================================= xw-devtool-cli Menu ================================= 1. Image <-> Base64 2. Image Format Convert 3. Placeholder Image Generator 4. QR Code Generator 5. URL Encode/Decode 6. String Encode/Decode (Base64) 7. Unicode Encode/Decode 8. HTML Entity Encode/Decode 9. Variable Format Converter a. JSON Format (Minify/Prettify) b. Chinese to Pinyin c. Time Format / Timestamp d. Time Calculation (Diff/Offset) e. Color Converter (Hex <-> RGB) f. Get UUID g. Hash Calculator (MD5/SHA/SM3) h. Mock Text i. Special Characters (Symbols) j. Emoji Picker k. Markdown Snippets l. VS Code Snippet Generator m. Current Directory Tree s. Settings (Language) 0. Exit ================================= ``` ## 📖 Detailed Usage ### 1. Image <-> Base64 - Select `1`. - **Image -> Base64**: - Select image file. - Output Base64 string (can save to `.txt`). - **Base64 -> Image**: - Input Base64 string (file or clipboard). - Auto-detect format and save as file. ### 2. Image Format Convert - Select `2`. - Select source image. - Select target format (PNG / JPG / WebP). - Set quality/compression. - Saved in the same directory. ### 3. Placeholder Image Generator - Select `3`. - **Mode 1: Local Image File** - Generate file locally. - Customize: Size, Colors, Text, Format. - **Mode 2: Remote Image URL** - Generate URL and copy to clipboard. - Supports: Picsum Photos, DummyImage, Via Placeholder, Placehold.jp, DevTool Tech, FPO Img. ### 4. QR Code Generator - Select `4`. - Input text or URL. - Preview in terminal. - Option to save as PNG. ### QR Code Reader - Select `qrcodeDecode` (menu key). - Supports two input methods: - **Select file (dialog)** - **Enter file path manually** - Recognized content is copied to clipboard automatically. ### 5. URL Encode/Decode - Select `5`. - Select `Encode` or `Decode`. - Input URL, result auto-copied. ### 6. String Base64 - Select `6`. - Input sources: Clipboard, File, Manual. - Output: Copy, Save to file. ### 7. Unicode Encode/Decode - Select `7`. - **Encode**: Text to Unicode escape sequences. - **Non-ASCII Only**: Recommended. - **All Characters**. - **Decode**: Unicode to Text. ### 8. HTML Entity Encode/Decode - Select `8`. - **Standard**: Special chars only. - **Everything**: All chars. ### 9. Variable Format Converter - Select `9`. - Input variable name. - Shows CamelCase, PascalCase, SnakeCase, KebabCase, ConstantCase. - Select one to copy. ### 10. JSON Format - Select `a`. - Supports two input sources: - **Clipboard**: Read content directly from clipboard. - **Local file**: Pick by file dialog or enter file path manually. - Parses standard JSON first; if it detects common non-standard patterns (code fences, single quotes, unquoted keys, trailing commas, HTML entities), it auto-fixes and then formats. - Converts to canonical JSON with 2-space indentation. - Supports going back to previous step in option lists. - Output supports: - **Copy to clipboard** (recommended). - **Save to file** (default filename includes timestamp to avoid overwriting old files). - **Note**: Full output is not printed to terminal to avoid flooding. ### 11. Chinese to Pinyin - Select `b`. - Input Chinese string. - Output Pinyin (no tone). ### 12. Time Format - Select `c`. - Timestamp <-> Date String. - Enter to get current timestamp. ### 13. Time Calculation - Select `d`. - **Diff**: Calculate difference between two dates. - **Offset**: Calculate date after add/subtract time units. ### Console Clock - Select `Console Clock` in the menu. - Current time refreshes every second in terminal. - Press `Enter` or `Q` to go back. ### Countdown Timer - Select `Countdown Timer` in the menu. - Select unit first (Seconds / Minutes / Hours), then enter the value. - After reaching zero, the timer continues with a negative sign (for example `-00:00:01`). - Press `Enter` or `Q` to go back. ### Stopwatch - Select `Stopwatch` in the menu. - It starts from `00:00:00` and updates every second. - Press `Enter` or `Q` to go back. ### 14. Color Converter - Select `e`. - Hex <-> RGB. ### 15. Get UUID - Select `f`. - Generate UUID v4. ### 16. Hash Calculator - Select `g`. - Input text. - Shows MD5, SHA1, SHA256, SHA512, SM3. ### 17. Mock Data - Select `h`. - Generate Lorem Ipsum, Names, IDs, Emails, Phones, etc. ### 18. Special Symbols - Select `i`. - Grid view of symbols. - Select index to copy. ### 19. Emoji Picker - Select `j`. - Categorized emojis. - Select to copy. ### 20. Markdown Snippets - Select `k`. - Templates for Headers, Lists, Tables, Links, etc. ### 21. VS Code Snippet Generator - Select `l`. - Convert code to `.code-snippets` JSON body. - Auto-escapes quotes/newlines. - Copied to clipboard. ### Port Occupation / Force Kill Process - Select `Port Occupation / Kill Process` in menu (or search with keyword `port`). - Enter the target port, then the tool shows PID, process name, protocol, and local address, and copies the list to clipboard. - Available actions: - **Force kill selected process** - **Force kill all occupied processes** - **Refresh occupation info** - Each option list includes a **Back** entry. ### Line Ending Converter (CRLF/LF) - Select `Line Ending Converter (CRLF/LF)` in the menu. - Choose file input method (file dialog or manual input). - Auto-detects the current file's line ending type (CRLF, LF, Mixed, or None). - Convert all line endings to CRLF or LF. - Choose to overwrite the original file or save as a new file with a timestamp. ## 📄 License ISC