{"id":25911344,"url":"https://github.com/copyleftdev/nword","last_synced_at":"2026-06-06T04:31:32.984Z","repository":{"id":278858098,"uuid":"937002162","full_name":"copyleftdev/nword","owner":"copyleftdev","description":"nword is a command-line tool designed to scan directories, detect programming languages, and process source code files. It generates a JSON snapshot of the directory structure, including file metadata, language detection, and condensed content.","archived":false,"fork":false,"pushed_at":"2025-02-22T05:14:56.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-10T05:40:25.516Z","etag":null,"topics":["ai","text-mining","tokens","tool"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/copyleftdev.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-22T05:14:17.000Z","updated_at":"2025-02-23T07:47:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"f0abf400-acde-42e7-bf94-bfbfb6099b92","html_url":"https://github.com/copyleftdev/nword","commit_stats":null,"previous_names":["copyleftdev/nword"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/copyleftdev/nword","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copyleftdev%2Fnword","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copyleftdev%2Fnword/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copyleftdev%2Fnword/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copyleftdev%2Fnword/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/copyleftdev","download_url":"https://codeload.github.com/copyleftdev/nword/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copyleftdev%2Fnword/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27425829,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-01T02:00:06.371Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","text-mining","tokens","tool"],"created_at":"2025-03-03T09:17:18.324Z","updated_at":"2025-12-01T08:04:44.915Z","avatar_url":"https://github.com/copyleftdev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **nword**  \n**A Rust-based tool for scanning, processing, and analyzing source code directories.**\n\n`nword` is a command-line tool designed to scan directories, detect programming languages, and process source code files. It generates a JSON snapshot of the directory structure, including file metadata, language detection, and condensed content.\n\n---\n\n## **Features**\n- **Directory Scanning**: Recursively scans directories for source code files.\n- **Language Detection**: Detects the programming language of files based on their extensions.\n- **File Filtering**: Excludes binary files, hidden files, and blacklisted directories/extensions.\n- **Content Condensation**: Condenses file content by removing extra whitespace.\n- **JSON Output**: Generates a JSON snapshot of the directory structure and file metadata.\n\n---\n\n## **Installation**\n\n### **Prerequisites**\n- Rust (version 1.60 or higher)\n- Cargo (Rust's package manager)\n\n### **Steps**\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/copyleftdev/nword.git\n   cd nword\n   ```\n\n2. Build the project:\n   ```bash\n   cargo build --release\n   ```\n\n3. Install the binary:\n   ```bash\n   cargo install --path .\n   ```\n\n4. Verify installation:\n   ```bash\n   nword --version\n   ```\n\n---\n\n## **Usage**\n\n### **Basic Command**\nScan the current directory and generate a JSON snapshot:\n```bash\nnword\n```\n\n### **Specify a Directory**\nScan a specific directory:\n```bash\nnword --directory /path/to/your/directory\n```\n\n### **Output**\nThe tool generates a JSON file named `project_snapshot_\u003ctimestamp\u003e.json` in the current directory. The file contains:\n- **File Path**: The relative path of the file.\n- **Language**: The detected programming language.\n- **Content**: The condensed content of the file.\n\nExample output:\n```json\n{\n  \"files\": [\n    {\n      \"path\": \"src/main.rs\",\n      \"language\": \"Rust\",\n      \"content\": \"mod cli; mod file_processor; mod filters; mod language_detection; mod text_processing; ...\"\n    },\n    {\n      \"path\": \"src/filters.rs\",\n      \"language\": \"Rust\",\n      \"content\": \"use std::fs::File; use std::io::Read; use std::path::Component; ...\"\n    }\n  ]\n}\n```\n\n---\n\n## **Configuration**\n\n### **Blacklisted Extensions**\nThe tool excludes files with specific extensions (e.g., binaries, images). You can modify the `BLACKLIST_EXTENSIONS` array in `src/filters.rs` to customize the list.\n\nExample:\n```rust\nconst BLACKLIST_EXTENSIONS: [\u0026str; 29] = [\n    \"exe\", \"dll\", \"so\", \"dylib\", \"bin\", \"jpg\", \"jpeg\", \"png\", \"gif\", \"bmp\", \"tiff\", \"ico\",\n    \"mp3\", \"wav\", \"ogg\", \"flac\", \"mp4\", \"mov\", \"avi\", \"mkv\", \"zip\", \"tar\", \"gz\", \"rar\", \"7z\",\n    \"bz2\", \"class\", \"o\", \"obj\",\n];\n```\n\n### **Blacklisted Directories**\nThe tool excludes specific directories (e.g., `node_modules`, `target`). You can modify the `BLACKLIST_DIRECTORIES` array in `src/filters.rs` to customize the list.\n\nExample:\n```rust\nconst BLACKLIST_DIRECTORIES: [\u0026str; 7] = [\n    \"node_modules\", \"target\", \"vendor\", \"dist\", \"build\", \"out\", \".git\"\n];\n```\n\n---\n\n## **Dependencies**\nThe project uses the following Rust crates:\n- **clap**: For command-line argument parsing.\n- **walkdir**: For directory traversal.\n- **rayon**: For parallel processing.\n- **serde**: For JSON serialization.\n- **chrono**: For timestamp generation.\n\nSee `Cargo.toml` for the full list of dependencies.\n\n---\n\n## **Development**\n\n### **Building and Testing**\n1. Build the project:\n   ```bash\n   cargo build\n   ```\n\n2. Run tests:\n   ```bash\n   cargo test\n   ```\n\n3. Run the project locally:\n   ```bash\n   cargo run -- --directory /path/to/test\n   ```\n\n### **Code Structure**\n- **`src/main.rs`**: Entry point for the application.\n- **`src/cli.rs`**: Handles command-line arguments.\n- **`src/file_processor.rs`**: Processes directories and files.\n- **`src/filters.rs`**: Filters files based on extensions, directories, and content.\n- **`src/language_detection.rs`**: Detects programming languages based on file extensions.\n- **`src/text_processing.rs`**: Condenses file content.\n\n---\n\n## **Contributing**\nContributions are welcome! Please follow these steps:\n1. Fork the repository.\n2. Create a new branch for your feature or bugfix.\n3. Submit a pull request with a detailed description of your changes.\n\n---\n\n## **License**\nThis project is licensed under the **MIT License**. See the `LICENSE` file for details.\n\n---\n\n## **Support**\nFor questions, issues, or feature requests, please open an issue on the [GitHub repository](https://github.com/copyleftdev/nword/issues).\n\n---\n\nEnjoy using `nword`! 🚀\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcopyleftdev%2Fnword","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcopyleftdev%2Fnword","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcopyleftdev%2Fnword/lists"}