tidyai-ts
v1.1.1
Published
AI-powered cross-platform file organizer using OpenRouter API
Downloads
36
Maintainers
Readme
TidyAI-TS
████████╗██╗██████╗ ██╗ ██╗ █████╗ ██╗
╚══██╔══╝██║██╔══██╗╚██╗ ██╔╝██╔══██╗██║
██║ ██║██║ ██║ ╚████╔╝ ███████║██║
██║ ██║██║ ██║ ╚██╔╝ ██╔══██║██║
██║ ██║██████╔╝ ██║ ██║ ██║██║
╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚═╝╚═╝
========================================
Organize your files with AI power!
========================================Organize your files with AI. Works everywhere. Powered by OpenRouter.
TidyAI-TS is a cross-platform CLI tool that uses AI to organize your messy folders. It leverages the OpenRouter API to analyze filenames and suggest logical folder structures, making file organization effortless and intelligent.
🌟 Features
- AI-powered folder suggestions using OpenRouter API
- Smart file sorting based on file extensions and AI classification
- Undo system to revert changes
- Delete unnecessary files (thumbs.db, .DS*Store, *.tmp, _.log, desktop.ini)
- Cross-platform CLI (Windows, macOS, Linux)
- Secure and private - only sends filenames to the AI, never file contents
- Robust error handling with fallback to default suggestions
- Beautiful CLI interface with progress indicators
- ASCII art logo and colored output
- Automatic logging of operations with timestamps
- GitHub Actions for CI/CD and automatic releases
📦 Installation
Option 1: Download Standalone Executables (Recommended)
Download the standalone executable for your platform from the releases page:
- Windows:
tidyai-win.exe - macOS:
tidyai-macos - Linux:
tidyai-linux
These executables can be run directly without needing to install Node.js.
Option 2: Install from npm (Recommended for library usage)
npm install tidyai-tsOr install globally:
npm install -g tidyai-tsOption 3: Install from Local Directory
If you have the source code locally:
npm install -g /path/to/tidyai-tsOption 4: Install from Git Repository
npm install -g git+https://github.com/pawan67/tidyai-ts.gitOption 5: Run with npx
Run directly from the local directory without installing:
npx . /path/to/folder⚙️ Setup
- Get an API key from OpenRouter
- Set the API key as an environment variable (choose one method):
Method 1: Permanent Environment Variable (Recommended)
Windows (PowerShell):
# Set for current user (permanent)
[Environment]::SetEnvironmentVariable("TIDYAI_API_KEY", "your_openrouter_api_key", "User")Windows (Command Prompt as Administrator):
setx TIDYAI_API_KEY "your_openrouter_api_key"macOS/Linux:
# Add to your shell profile (~/.bashrc, ~/.zshrc, etc.)
echo 'export TIDYAI_API_KEY=your_openrouter_api_key' >> ~/.bashrc
source ~/.bashrcMethod 2: Temporary Environment Variable
Windows (Command Prompt):
set TIDYAI_API_KEY=your_openrouter_api_key
tidyai-win.exe C:\path\to\your\folderWindows (PowerShell):
$env:TIDYAI_API_KEY="your_openrouter_api_key"
.\tidyai-win.exe C:\path\to\your\foldermacOS/Linux:
export TIDYAI_API_KEY=your_openrouter_api_key
./tidyai-macos /path/to/your/folder # macOS
./tidyai-linux /path/to/your/folder # LinuxMethod 3: Using the Provided Scripts
Edit the tidyai.bat (Windows) or tidyai.ps1 (PowerShell) file and uncomment the line with your API key:
set TIDYAI_API_KEY=your_actual_api_key_hereThen run:
tidyai.bat C:\path\to\your\folder🚀 Usage
Basic Commands
tidyai --help # Show help information
tidyai --version # Show version information
tidyai /path/to/folder # Organize files in a folder
tidyai --delete /path/to/folder # Organize and delete unnecessary files
tidyai --undo /path/to/folder # Undo organizationHelp Command Output
Usage:
tidyai [options] [folder_path]
tidyai --help
tidyai --version
Options:
--undo, -u Undo the organization of a folder
--delete, -d Delete unnecessary files after organization
--help, -h Show this help message
--version, -v Show version information
Examples:
tidyai /path/to/folder # Organize files in a folder
tidyai --delete /path/to/folder # Organize and delete unnecessary files
tidyai --undo /path/to/folder # Undo organization
tidyai --help # Show this help message
Notes:
- Unnecessary files include: thumbs.db, .DS_Store, *.tmp, *.log, desktop.ini
- Deletion requires confirmation and cannot be undone (files are permanently deleted)
- Organization history is used for undo operations
Environment Variables:
TIDYAI_API_KEY OpenRouter API key for AI-powered suggestionsExample Usage
Here's an example of how TidyAI organizes a messy folder:
Before:
messy-folder/
├── document.pdf
├── photo.jpg
├── script.js
├── data.csv
├── presentation.pptx
└── video.mp4After running tidyai messy-folder:
messy-folder/
├── Documents/
│ ├── document.pdf
│ └── presentation.pptx
├── Images/
│ └── photo.jpg
├── Scripts/
│ └── script.js
├── Data/
│ └── data.csv
├── Media/
│ └── video.mp4
└── .tidyai/
├── history.json
└── logs/Beautiful CLI Interface
TidyAI-TS features a beautiful CLI interface with:
- Colorful output for different types of messages
- Progress bars for file operations
- ASCII art logo
- Section headers for better organization
- Timestamped log files in
.tidyai/logs/directory
Here's what the output looks like when organizing files:
████████╗██╗██████╗ ██╗ ██╗ █████╗ ██╗
╚══██╔══╝██║██╔══██╗╚██╗ ██╔╝██╔══██╗██║
██║ ██║██║ ██║ ╚████╔╝ ███████║██║
██║ ██║██║ ██║ ╚██╔╝ ██╔══██║██║
██║ ██║██████╔╝ ██║ ██║ ██║██║
╚═╝ ╚═╝╚═════╝ ╚═╝ ╚═╝ ╚═╝╚═╝
========================================
Organize your files with AI power!
========================================
┌──────────────────────┐
│ Organization Process │
└──────────────────────┘
ℹ Scanning folder contents...
ℹ Found 4 files to organize
ℹ Getting folder suggestions from AI...
ℹ Sending request to OpenRouter API...
┌──────────────┐
│ Moving Files │
└──────────────┘
Moving files: [████████████████████████████████████████] 100% (4/4) script.js
✓ Moved 4 files into folders
ℹ Saving organization history...
✓ Organization complete!
✓ Successfully organized folder: test-folder🛡️ Error Handling
TidyAI-TS includes robust error handling:
- When the API key is not set or invalid, it falls back to default folder suggestions based on file extensions
- API errors are properly caught and logged
- The application continues to function even when the AI service is unavailable
- Prompts user to continue with default suggestions when API key is missing
If you're getting authentication errors, make sure you:
- Have a valid API key from OpenRouter
- Are setting the environment variable correctly
- Are using the correct syntax for your operating system and shell
🧪 Development
- Clone the repository
- Install dependencies:
npm install - Build the project:
npm run build - Run the CLI:
npm start -- /path/to/folder
Creating Standalone Executables
To create standalone executables for all platforms, you can use the packaging script:
npm run packageThis will create the following executables:
- Windows:
tidyai-win.exe - macOS:
tidyai-macos - Linux:
tidyai-linux
Alternatively, you can build individual platform executables using the npm scripts:
npm run build:win # Windows executable
npm run build:linux # Linux executable
npm run build:mac # macOS executable
npm run build:all # All platformsDevelopment Scripts
npm run build- Compile TypeScript to JavaScriptnpm run dev- Run the TypeScript code directlynpm start- Run the compiled JavaScriptnpm test- Run testsnpm run package- Create executables for all platformsnpm run clean- Remove generated executablesnpm run build:win- Create Windows executablenpm run build:linux- Create Linux executablenpm run build:mac- Create macOS executablenpm run build:all- Create executables for all platforms
📊 Badges
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
