Skip to main content

CLI that cleans up folder by intelligently organizing it

Project description

Safai CLI

Safai is a command-line tool that intelligently organizes your folders using AI. It supports multiple AI platforms and can be customized to your needs.

Features

  • Organize your folders and files using AI suggestions
  • Supports OpenAI, Google Gemini, and Anthropic Claude platforms
  • One-shot (no feedback) or interactive feedback mode
  • Recursively organize subdirectories
  • Ignore specific directories
  • Configurable via CLI options or a config file

Installation

Safai is distributed as a Python package. You can install it using pip:

pip install safai

If you are developing locally, you can install it in editable mode from the repo root:

pip install -e .

Tip: It's recommended to use a virtual environment for isolation.

Usage

Run the CLI with:

python main.py [OPTIONS] PATH

Or using the Makefile:

make run ARGS="[OPTIONS] PATH"

Required Argument

  • PATH: Path to the directory you want to organize

Options

Option Short Description Default
--platform -pl AI platform to use (openai, gemini, claude) (from config)
--api_key -a API Key for the selected AI platform (from config)
--model -m Model to use as per platform (from config)
--one_shot -o Organize without any feedback from user False
--recursive -r Recursively organize sub-directories False
--ignore -i Directories to ignore (can be used multiple times) []

Note: Except for PATH, all options can be set in $HOME/.safai and will be loaded automatically if not provided on the command line.

Recursive mode (-r/--recursive): When this flag is set, Safai will traverse all subdirectories of the specified path and organize files in every folder, not just the root. This is useful for deeply nested or complex folder structures.

Supported Platforms

  • openai (e.g., GPT models)
  • gemini (Google Gemini)
  • claude (Anthropic Claude)

Default Models

Platform Default Model
openai o4-mini
gemini gemini-1.5-flash
claude claude-3-7-sonnet-latest

If you do not specify a model for a platform, Safai will use the default model listed above.

Example: Organizing a Folder

python main.py --platform openai --api_key YOUR_OPENAI_KEY --model gpt-3.5-turbo /path/to/your/folder

Or, with a config file (recommended):

Configuration File: $HOME/.safai

You can store your default options in a config file in your home directory. This file uses INI format and can have a [config] section for global defaults and sections for each platform.

Note: Only platform and ignore can be set in the [config] section. api_key and model must be set in the platform-specific sections ([openai], [gemini], [claude]). one_shot and recursive must be provided via CLI options if needed.

Example $HOME/.safai:

[config]
platform = openai
ignore = .git,node_modules

[openai]
api_key = sk-xxxxxxx
model = gpt-3.5-turbo

[gemini]
api_key = your-gemini-key
model = gemini-1.5-flash

[claude]
api_key = your-claude-key
model = claude-3-7-sonnet-latest
  • Values in [config] are used as defaults for platform and ignore.
  • Platform-specific sections must provide api_key and model for that platform.
  • ignore can be a comma-separated list of directory names to skip.
  • one_shot and recursive must be set via CLI flags (--one_shot, --recursive).

Feedback & Interactive Mode

  • By default, Safai will ask for feedback after suggesting an organization plan. Enter n to accept, s to skip, or provide feedback to refine the suggestion.
  • Use --one_shot to skip feedback and auto-apply suggestions.

Troubleshooting

  • If required options are missing, Safai will prompt you to provide them or add them to your config file.
  • Make sure your API keys are valid and have access to the selected model/platform.

License

GNU General Public License v3.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

safai-0.4.2.tar.gz (114.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

safai-0.4.2-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file safai-0.4.2.tar.gz.

File metadata

  • Download URL: safai-0.4.2.tar.gz
  • Upload date:
  • Size: 114.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for safai-0.4.2.tar.gz
Algorithm Hash digest
SHA256 96cbe47ec294180238a476057a83f0f72267225c60457917f5503fa3c47176d9
MD5 2d2b816ff16bfe7b6ab85fd1225e2d15
BLAKE2b-256 4d2f7f5ce09ba4321db8083882ff2b3f6405a6db32512417b7d3331bf5fa0a3f

See more details on using hashes here.

File details

Details for the file safai-0.4.2-py3-none-any.whl.

File metadata

  • Download URL: safai-0.4.2-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for safai-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ae8e8bbfdd9a74fcd9e6d7a976b40502a40904e217b918ab2466b9d010646d5b
MD5 75cb11df7991c3578b2d26149616ea38
BLAKE2b-256 d29887bdf18c5f481d4a5573ddc70ab4c7acd2019d2cdcb5ea1f8d437508b012

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page