Skip to main content

Command Palette

Search for a command to run...

Week 1 (Part-2) : Project Workflow

Published
•3 min read•View as Markdown
V

I am a CS student learning and exploring this technology field and eagerness to build something.

🔄 Project Workflow

This project is designed as an intelligent command-line file organizer powered by machine learning and optional Gmail integration.
The workflow follows a clean pipeline from user input → prediction → action → logging.


1️⃣ User runs a command

The user interacts with the system through the CLI:

setfile organize ~/Downloads

This command enters through:

setfile/cli.py

Here:

  • Arguments are parsed

  • The requested command is identified

  • Control is passed to the correct command module


2️⃣ Command Dispatcher

cli.py maps the command to a file inside:

setfile/commands/

Example:

This design keeps every command isolated and independent.


3️⃣ File Discovery

Inside organize.py:

  • The target directory is scanned

  • Each file is passed to the system

  • Metadata is extracted using:

utils/reader.py

The system now knows:

  • File name

  • Extension

  • Size

  • Content (if readable)


4️⃣ Intelligent Prediction (Core Logic)

Each file is sent to:

core/prediction.py

This file:

  • Loads the trained ML model from model/doc_classifier_svm.pkl

  • Extracts features

  • Predicts the category of the file (e.g., Invoice, Resume, Image, Code, etc.)

This is the brain of the entire project.


5️⃣ Rules & Decisions

The predicted category is passed to:

utils/file_rules.py

This maps predictions into real folders:

Example:

Invoice → Documents/Finance/
Resume  → Documents/Career/
Image   → Pictures/

Now the system knows where the file should go.


6️⃣ File Movement & Tracking

The file is:

  • Moved to its target directory

  • Recorded in:

utils/history.py

This allows:

  • Undo (revert command)

  • Traceability

  • Recovery if something goes wrong


7️⃣ Logging

Every action is logged through:

utils/logger.py

Logs are stored in:

logs/

This ensures:

  • Debugging is easy

  • User actions are traceable

  • Errors can be diagnosed


8️⃣ (Optional) Gmail Integration

If the user enables Gmail:

setfile gmail-auth

The workflow becomes:

  1. gmail_auth.py authenticates via Google OAuth

  2. gmail_api.py fetches email attachments

  3. Files are downloaded locally

  4. They are passed into the same ML pipeline

  5. Attachments get auto-organized just like normal files

This makes Gmail attachments part of the same intelligent system.


🧠 Why this workflow is powerful

Your project follows a real-world AI pipeline:

User → CLI → Commands → Reader → ML Model → Rules → File System → Logs

This design ensures:

  • Clean separation of concerns

  • Reusability

  • Easy debugging

  • Professional-grade architecture

It’s not just a script — it’s a full intelligent system.

This is Workflow of the project and it doesn’t change. It’s like a basic structure and you can get files or access file from anywhere like google drive or onedrive and can just organize it. This process remains the same.

That’s it for today. In next blog we will be discussing on how to make this whole system that we have talked. You can check my github repo : Github Link and contribute to it.

Thank you !