Skip to main content

The Ultimate Command-Line File Tagging System - Transform chaos into order with intelligent file organization

Project description

๐Ÿท๏ธ TagManager

The Ultimate Command-Line File Tagging System

Transform chaos into order with intelligent file organization

PyPI Python License Platform Tests

Features โ€ข Installation โ€ข Quick Start โ€ข Commands โ€ข Examples


๐ŸŒŸ Why TagManager?

Folder hierarchies force you to put a file in one place. Tags let a file belong to everything it actually is.

# One command to tag โ€” one command to find
tm add report.pdf --tags work client-a q1 2024 final
tm search --tags work q1        # instantly surface it

TagManager stores tags in a lightweight JSON sidecar (~/file_tags.json) โ€” no database, no daemon required โ€” and ships a full command set for search, bulk operations, smart filtering, an interactive network graph, and a file-system watcher that tags new files automatically.


โœจ Features

Category What you get
Core Add/remove/search tags, fuzzy path search, list & tree views
Bulk Mass-tag with glob patterns, retag, bulk-remove โ€” all with --dry-run
Auto-tag Extension-based tag suggestions (60+ file types built-in)
Aliases Normalize tag variants: py โ†’ python, js โ†’ javascript
Presets Save named tag bundles and apply them in one flag
Filters Duplicate sets, orphans, similarity (Jaccard), clusters, isolated files
Stats Tag frequency, co-occurrence, ASCII bar charts & histograms
Visualizer Interactive 2D/3D network graph in your browser โ€” click to open files
Watch mode Auto-tag files the moment they land in a directory
Move tracking tm mv keeps tag records in sync when you rename files
Config Full dot-notation config system with export/import
Shell completion Tab-complete tag names, presets, and alias names

๐Ÿš€ Installation

pip install tagmanager-cli

Commands are available as both tm (short) and tagmanager (long form).

Optional: Watch mode

Watch mode requires watchdog:

pip install tagmanager-cli[watch]
# or separately
pip install watchdog

Install from source

git clone https://github.com/davidtbilisi/TagManager.git
cd TagManager
pip install -e .

โšก Quick Start

# Tag a file (auto-tags by extension too)
tm add main.py --tags backend core

# Tag everything matching a glob
tm bulk add "src/**/*.py" --tags python

# Find files
tm search --tags backend core     # either tag
tm search --tags backend --match-all core  # both tags

# Visual overview
tm ls --tree
tm tags --cloud
tm stats --chart

# Interactive network graph (opens in browser)
tm graph

# Watch a directory โ€” auto-tag as files arrive
tm watch ~/Downloads --tags inbox

๐Ÿ“– Commands

tm add โ€” Tag files

tm add <file> --tags <tag> [<tag>...]   # basic
tm add <file> --tags python --preset webproject  # combine with preset
tm add <file> --no-auto                 # skip extension-based auto-tags
tm add <file> --no-aliases              # skip alias resolution

tm search โ€” Find files

tm search --tags python web            # files with EITHER tag
tm search --tags python --match-all    # files with ALL listed tags
tm search --path /projects/            # by path fragment
tm search --tags python --exact        # exact tag match (no fuzzy)

tm ls โ€” List tagged files

tm ls           # flat table
tm ls --tree    # directory tree with inline tags

tm tags โ€” Explore tags

tm tags                  # list all tags
tm tags --search py      # filter tags by name
tm tags --cloud          # frequency cloud
tm tags --where python   # which files carry this tag

tm stats โ€” Analytics

tm stats              # summary
tm stats --chart      # ASCII bar charts
tm stats --tag python # deep-dive on one tag (co-occurrence, file types)

tm graph โ€” Interactive network visualizer

Opens a self-contained HTML graph in your default browser.

tm graph                        # tag co-occurrence graph, 2D
tm graph --3d                   # start in 3D (toggle button in UI too)
tm graph --mode file            # file similarity graph (Jaccard)
tm graph --mode mixed           # bipartite fileโ†”tag graph
tm graph --export gexf          # also export tag_network.gexf (Gephi)
tm graph --export graphml       # for Cytoscape / yEd
tm graph --min-weight 2         # only show edges with โ‰ฅ2 co-occurrences
tm graph --output ~/graph.html  # save to a specific path

In the browser UI:

  • Sidebar with 10 live filters (search, tag/extension multi-select, weight & degree sliders, cluster highlight, color-by)
  • 2D / 3D toggle โ€” WebGL via Three.js, handles thousands of nodes
  • Click any file node โ†’ opens it in your OS file explorer
  • Download GEXF / GraphML buttons (embedded, no server needed)

tm watch โ€” Auto-tag new files

Monitors a directory with watchdog and tags files as they arrive.

tm watch                         # watch current dir
tm watch ~/Downloads             # watch a specific dir
tm watch . --tags inbox          # always add "inbox" to every new file
tm watch . --preset webproject   # apply a saved preset
tm watch . --no-auto             # skip extension auto-tagging
tm watch . --clean-on-delete     # remove tag entry when file is deleted
tm watch . --no-recursive        # top-level only
tm watch . --ignore "*.log"      # extra ignore patterns
tm watch . --plain               # plain text output (no Rich live display)

Rich live display shows a colour-coded event log (โœš created, โ†’ moved, โœ– deleted) with resolved tags. Press Ctrl+C to stop.

tm filter โ€” Smart analysis

tm filter duplicates             # files with identical tag sets
tm filter orphans                # files with no tags
tm filter similar <file>         # files similar to this one (Jaccard)
tm filter clusters               # group files by shared tag
tm filter isolated               # files that share few tags with others

tm bulk โ€” Mass operations

tm bulk add "*.py" --tags python          # tag by glob
tm bulk remove --tag deprecated           # remove a tag from all files
tm bulk retag --from js --to javascript   # rename a tag everywhere
# All bulk commands support --dry-run

Aliases, Presets, Move tracking

# Aliases โ€” normalize tag variants
tm alias add py python
tm alias list
tm alias remove py

# Presets โ€” named tag bundles
tm preset save webproject --tags python django web
tm preset apply webproject app.py
tm preset list

# Move tracking โ€” keep the DB in sync
tm mv old/path.py new/path.py
tm clean             # remove entries for deleted files
tm clean --dry-run   # preview

Config

tm config list                         # all settings
tm config set display.emojis false
tm config set search.fuzzy_threshold 0.8
tm config export --file settings.json
tm config import team_settings.json
tm config reset                        # back to defaults

๐ŸŽจ Examples

Network graph

Tag co-occurrence network โ€” 42 nodes, 180 edges
Sidebar filters: search ยท tag multiselect ยท min-weight slider ยท degree range
                 color-by cluster ยท highlight cluster ยท show/hide node types
2D โ†” 3D toggle  |  Download GEXF  |  Download GraphML
Click file node โ†’ opens in Finder/Explorer

Watch mode output

Watching: /home/user/Downloads
  Recursive: True | Auto-tag: True | Clean-on-delete: False
  Always add tags: ['inbox']
Press Ctrl+C to stop.

[14:02:11] โœš created โœ“  report_q1.pdf  [inbox, pdf, document]
[14:02:45] โœš created โœ“  script.py      [inbox, python]
[14:03:10] โ†’ moved   โœ“  script.py  โ†’  processed/script.py

Tag cloud

โ˜๏ธ  Tag Cloud
โ˜… python(15)  โ—† web(8)  โ— documentation(5)  โ€ข config(3)  ยท backup(1)

Tree view

โ””โ”€โ”€ ๐Ÿ“ projects/
    โ”œโ”€โ”€ ๐Ÿ“ backend/
    โ”‚   โ””โ”€โ”€ ๐Ÿ“„ api.py ๐Ÿท๏ธ  [python, web, api, core]
    โ””โ”€โ”€ ๐Ÿ“ docs/
        โ””โ”€โ”€ ๐Ÿ“„ README.md ๐Ÿท๏ธ  [docs, markdown]

๐Ÿ—๏ธ Architecture

tagmanager/
โ”œโ”€โ”€ cli.py                  # Typer CLI โ€” all commands registered here
โ””โ”€โ”€ app/
    โ”œโ”€โ”€ add/                # tm add
    โ”œโ”€โ”€ bulk/               # tm bulk
    โ”œโ”€โ”€ filter/             # tm filter
    โ”œโ”€โ”€ search/             # tm search
    โ”œโ”€โ”€ stats/              # tm stats
    โ”œโ”€โ”€ graph/              # tm graph  (HTML generator, GEXF/GraphML export)
    โ”œโ”€โ”€ watch/              # tm watch  (watchdog integration)
    โ”œโ”€โ”€ alias/              # tm alias
    โ”œโ”€โ”€ preset/             # tm preset
    โ”œโ”€โ”€ autotag/            # extension โ†’ tag mappings
    โ”œโ”€โ”€ move/               # tm mv / tm clean
    โ”œโ”€โ”€ visualization/      # tree, cloud, ASCII charts
    โ”œโ”€โ”€ config/             # tm config
    โ””โ”€โ”€ helpers.py          # load_tags() / save_tags() โ€” atomic JSON I/O

Storage: ~/file_tags.json (path configurable). Plain JSON โ€” easy to inspect, back up, or version-control.


๐Ÿงช Testing

pytest tests/ -v                           # full suite (406 tests)
pytest tests/ --cov=tagmanager             # with coverage
pytest tests/test_graph_service.py -v      # graph module only
pytest tests/test_watch_service.py -v      # watch module only

406 tests across 21 test files. Watch mode integration tests require pip install watchdog.


๐Ÿค Contributing

  1. Fork the repo
  2. Create a feature branch
  3. Add tests
  4. Open a PR

Bug reports and feature requests: GitHub Issues


๐Ÿ“„ License

MIT โ€” see LICENSE.


โญ Star this repo if TagManager helps you stay organized!

Made by David Chincharashvili โ€ข Built with Typer and Rich

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

tagmanager_cli-1.6.2.tar.gz (80.5 kB view details)

Uploaded Source

Built Distribution

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

tagmanager_cli-1.6.2-py3-none-any.whl (96.9 kB view details)

Uploaded Python 3

File details

Details for the file tagmanager_cli-1.6.2.tar.gz.

File metadata

  • Download URL: tagmanager_cli-1.6.2.tar.gz
  • Upload date:
  • Size: 80.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for tagmanager_cli-1.6.2.tar.gz
Algorithm Hash digest
SHA256 1a3e6f5745e8dad29ea763391aa3f8edc0c32bae13946bd39dc61bf34b85cdfc
MD5 514ac382798f3a701eeeb2e87d683df4
BLAKE2b-256 63c078b08aeff532e645aa96f5e792ee43f5d69e21f80a3ee7223cd2834807a0

See more details on using hashes here.

File details

Details for the file tagmanager_cli-1.6.2-py3-none-any.whl.

File metadata

  • Download URL: tagmanager_cli-1.6.2-py3-none-any.whl
  • Upload date:
  • Size: 96.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.10

File hashes

Hashes for tagmanager_cli-1.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ae5fb1921eeaab0dfed013948cfa72af40d2caeaf7a55b3123727087255adb4b
MD5 f68433adbd912d26037c976801f0b374
BLAKE2b-256 2ef9cdcb13067509624ad8dc7a8efb16d91d7f547038b77df3e2ad9a0dbdcd19

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