Skip to main content

A CLI tool for managing shared context files across projects

Project description

Context File Manager (CFM)

A command-line tool for managing shared context files across projects. CFM provides a centralized repository for storing, organizing, and retrieving commonly used files with descriptions and tags.

Features

  • Centralized Storage: Store commonly used files and folders in a single repository (~/.context-files by default)
  • File Organization: Add descriptions and tags to files and folders for easy searching and filtering
  • Folder Support: Add entire folders with preserved directory structure
  • Quick Retrieval: Copy files or folders from the repository to any project location
  • Search Capabilities: Find files and folders by name, description, or tags
  • Multiple Output Formats: View file listings in table, JSON, or simple format

Installation

From PyPI (Recommended)

# Basic installation
pip install context-file-manager

# With MCP server support (for AI assistants like Claude)
pip install context-file-manager[mcp]

From Source

Clone the repository and install in development mode:

git clone https://github.com/ananddtyagi/context-file-manager.git
cd context-file-manager
pip install -e .

Manual Installation

Make the script executable and add it to your PATH:

chmod +x cfm
sudo cp cfm /usr/local/bin/

Or create an alias in your shell configuration:

alias cfm='python3 /path/to/context-file-manager/cfm'

Usage

Add files and folders to the repository

# Add a file with description
cfm add README.md "Main project documentation"

# Add a file with description and tags
cfm add config.json "Database configuration" --tags database config production

# Add a folder with all its contents
cfm add-folder ./src "Source code directory" --tags code javascript

# Add a folder with tags
cfm add-folder ./templates "Project templates" --tags templates starter

List files and folders

# List all files and folders
cfm list

# Filter by tag
cfm list --tag database

# Output as JSON
cfm list --format json

# List contents of a specific folder
cfm list-folder src

Search for files and folders

# Search by filename, description, or tags
cfm search "config"
cfm search "database"
cfm search "template"

Retrieve files and folders

# Copy a file to current directory
cfm get README.md

# Copy a file to specific location
cfm get config.json ./my-project/

# Copy a folder to current directory
cfm get-folder src

# Copy a folder to specific location
cfm get-folder templates ./new-project/

Update file metadata

# Update description
cfm update config.json "Production database configuration"

# Add tags to existing file
cfm tag config.json staging development

Remove files and folders

# Remove a file
cfm remove old-config.json

# Remove a folder
cfm remove-folder old-src

Custom Repository Location

By default, files are stored in ~/.context-files. You can use a different location:

cfm --repo /path/to/my/repo add file.txt "Description"

File Storage

Files are stored with their original names in the repository directory. If a filename already exists, a numbered suffix is added (e.g., config_1.json, config_2.json).

Metadata is stored in spec.json within the repository, containing:

  • File descriptions
  • Original file paths
  • Tags
  • File sizes
  • Date added

Examples

Managing Configuration Files

# Store various config files
cfm add nginx.conf "Nginx configuration for load balancing" --tags nginx webserver
cfm add docker-compose.yml "Standard Docker setup" --tags docker devops
cfm add .eslintrc.js "JavaScript linting rules" --tags javascript linting

# Store entire configuration directories
cfm add-folder ./configs "All configuration files" --tags config settings
cfm add-folder ./docker-configs "Docker configurations" --tags docker devops

# Find all Docker-related files
cfm list --tag docker

# Get a config for a new project
cfm get docker-compose.yml ./new-project/

# Get entire config folder
cfm get-folder configs ./new-project/

Managing Documentation Templates

# Store documentation templates
cfm add README-template.md "Standard README template" --tags documentation template
cfm add API-docs-template.md "API documentation template" --tags documentation api

# Store documentation folder
cfm add-folder ./doc-templates "Documentation templates" --tags documentation templates

# Search for documentation
cfm search "template"

# List contents of documentation folder
cfm list-folder doc-templates

Managing Project Templates

# Store entire project template structures
cfm add-folder ./react-template "React project template" --tags react javascript template
cfm add-folder ./python-template "Python project template" --tags python template

# List all templates
cfm list --tag template

# Create new project from template
cfm get-folder react-template ./my-new-react-app

MCP Server for AI Assistants

CFM includes an optional Model Context Protocol (MCP) server that allows AI assistants like Claude to manage your context files.

Installation

pip install context-file-manager[mcp]

Usage with Claude Desktop

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "context-file-manager": {
      "command": "cfm-mcp"
    }
  }
}

Available MCP Tools

Once connected, you can use natural language with your AI assistant:

  • "Store this config file in my context repository" - Add files with descriptions
  • "Find all files tagged with 'docker'" - Search and filter files
  • "Retrieve the nginx config for my new project" - Get files for current work
  • "Add this entire components folder to my repository" - Store complete directories
  • "List all my database configurations" - Browse repository contents

MCP Tool Features

  • File Management: Add, get, remove, update files and folders
  • Search & Discovery: List, search, and filter by tags
  • Metadata Management: Update descriptions and add tags
  • Repository Control: Custom repository paths supported

PyPI Upload

To upload a new version to PyPI:

# Test upload
./upload_to_pypi.sh test

# Production upload  
./upload_to_pypi.sh prod

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

context_file_manager-0.5.1.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

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

context_file_manager-0.5.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file context_file_manager-0.5.1.tar.gz.

File metadata

  • Download URL: context_file_manager-0.5.1.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for context_file_manager-0.5.1.tar.gz
Algorithm Hash digest
SHA256 74b78cbe249b5ee7d9f3b0f29c7636c1453c64c3af38e8dc52165038a5cb6ffa
MD5 d941e3f19d054e0023f7e9758de66fdf
BLAKE2b-256 bc0bd24f04990a35f981e094b91eb06abaaca392764c94c1f078fe6f7e40446f

See more details on using hashes here.

Provenance

The following attestation bundles were made for context_file_manager-0.5.1.tar.gz:

Publisher: publish-to-pypi.yml on ananddtyagi/context-file-manager

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file context_file_manager-0.5.1-py3-none-any.whl.

File metadata

File hashes

Hashes for context_file_manager-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b08b29d746fb2c2a4cb17d0d33b6ffdbe63fe424b8e9bfa99f9709ff7d048e20
MD5 bea068cb49c62255a995b1dcb1b9a0ac
BLAKE2b-256 f1e40566917055876745b61a6e64ae197d79115c16989d22f0521afcdc01bd1d

See more details on using hashes here.

Provenance

The following attestation bundles were made for context_file_manager-0.5.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on ananddtyagi/context-file-manager

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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