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

MIT

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.0.tar.gz (113.4 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.0-py3-none-any.whl (23.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: safai-0.4.0.tar.gz
  • Upload date:
  • Size: 113.4 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.0.tar.gz
Algorithm Hash digest
SHA256 e26d8faaa4871ec378401f5880619769ffd670ebfb39b966a29d6cebfb48239f
MD5 4c6ec8f5f7524b83c21f1ab8d270a6fc
BLAKE2b-256 6df784a0f623be1c6a35d8bb57443254f7a5d8ea4b10bd166abd4aca531027c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: safai-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 23.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d38e69f3947bd932073d88c878c74328cdf5a359be66473fae942215d0ea8f81
MD5 bf98cc1763aaa9515eee1044a58d9b1b
BLAKE2b-256 ef20e545383c21dea8b36034978cc5902c2a38a8585a9d92e508a1997f5ea405

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