Skip to main content

CLI tool for managing structured metadata in monorepos and multi-project repositories

Project description

Folder Metadata (fm)

A powerful CLI tool for managing structured metadata in monorepos and multi-project repositories. fm helps you organize, validate, and maintain hierarchical folder structures with type-safe metadata files.

License: MIT

Overview

fm (Folder Metadata) is designed for teams working with complex repository structures containing multiple projects, platforms, and organizational units. It provides a systematic way to:

  • Define folder types with structured metadata
  • Enforce hierarchical relationships between different folder types
  • Validate repository structure automatically
  • Query and visualize project organization
  • Automate workflows with hooks and tooling configuration

Features

  • ๐Ÿ—๏ธ Structured Metadata: Type-safe folder metadata with validation
  • ๐ŸŒณ Hierarchical Organization: Enforce parent-child relationships between folder types
  • ๐Ÿ” Discovery & Search: Find and list folders by type across your repository
  • ๐Ÿ“Š Visualization: Generate tree and graph views of your repository structure
  • โœ… Validation: Ensure repository structure follows defined rules
  • ๐Ÿš€ Automation: Built-in hooks for build, test, and deployment workflows
  • ๐Ÿท๏ธ Tagging: Organize projects with custom tags
  • ๐Ÿ“ฆ Version Management: Semantic versioning support for projects

Installation

From PyPI (Recommended)

pip install folder-metadata

From Source

git clone https://github.com/yourusername/folder-metadata.git
cd folder-metadata
pip install -e .

Dependencies

The tool requires the following Python packages:

  • typer - CLI framework
  • rich - Rich text and beautiful formatting
  • pydantic - Data validation and settings management
  • semver - Semantic versioning

Quick Start

1. Initialize Repository Root

# Navigate to your repository root
cd /path/to/your/repo

# Initialize as a repository
fm init --type repo

2. Create Platform/Projects Structure

# Create a platform folder
mkdir backend
cd backend
fm init --type platform

# Create a projects collection
mkdir ../apps
cd ../apps
fm init --type projects

3. Add Individual Projects

# Create and initialize a project
mkdir user-service
cd user-service
fm init --type project

4. Validate Your Structure

# Validate from repository root
fm validate

# View the complete structure
fm tree

Folder Types

fm supports four hierarchical folder types:

Repository (.folder.repo)

The root level of your repository.

type: repo
name: "my-awesome-repo"
description: "A comprehensive multi-service application"

Platform (.folder.platform)

Groups related projects by technology stack or domain.

type: platform
name: "backend-services"
description: "Node.js microservices platform"

Projects Collection (.folder.projects)

Organizes multiple related projects.

type: projects
name: "mobile-apps"
description: "iOS and Android applications"

Project (.folder.project)

Individual deployable units with detailed metadata.

type: project
name: "user-service"
language: "typescript"
version: "1.2.3"
owner: "backend-team"
team: "platform"
lifecycle: "production"
tags: ["api", "microservice", "auth"]
tooling:
  build: "npm run build"
  test: "npm test"
  lint: "npm run lint"
hooks:
  pre_build: "npm install"
  post_test: "npm run coverage"
dependencies: ["auth-service", "database"]

Hierarchy Rules

The folder types must follow this hierarchical structure:

Repository Root (.folder.repo)
โ”œโ”€โ”€ Platform (.folder.platform)
โ”‚   โ””โ”€โ”€ Project (.folder.project)
โ””โ”€โ”€ Projects (.folder.projects)
    โ””โ”€โ”€ Project (.folder.project)

Commands

fm init

Initialize a folder with metadata.

# Interactive initialization
fm init

# Specify type directly
fm init --type project

# Force overwrite existing metadata
fm init --type project --force

fm validate

Validate repository structure and metadata.

# Validate current directory
fm validate

# Validate specific path
fm validate --path /path/to/repo

# JSON output
fm validate --json

fm list

List folders of a specific type.

# List all projects
fm list --type project

# List platforms with JSON output
fm list --type platform --json

# Search from specific path
fm list --type project --path /custom/path

fm tree

Display repository structure as a tree.

# Show tree from auto-detected root
fm tree

# Show tree from specific path
fm tree --path /path/to/repo

# JSON output
fm tree --json

fm graph

Generate dependency graphs.

# Show project dependencies
fm graph

# Output in different formats
fm graph --format dot
fm graph --format json

fm bump

Increment project versions (semantic versioning).

# Bump patch version (1.0.0 โ†’ 1.0.1)
fm bump patch

# Bump minor version (1.0.1 โ†’ 1.1.0)
fm bump minor

# Bump major version (1.1.0 โ†’ 2.0.0)
fm bump major

# Bump specific project
fm bump patch --path /path/to/project

fm whoami

Display current folder information.

# Show current folder metadata
fm whoami

fm tag

Manage project tags.

# Add tags to current project
fm tag add api microservice

# Remove tags
fm tag remove deprecated

# List all tags in repository
fm tag list

fm run-hooks

Execute configured hooks.

# Run pre-build hooks
fm run-hooks pre_build

# Run post-test hooks
fm run-hooks post_test

Example Repository Structure

my-monorepo/                      # .folder.repo
โ”œโ”€โ”€ platforms/                    
โ”‚   โ”œโ”€โ”€ backend/                  # .folder.platform
โ”‚   โ”‚   โ”œโ”€โ”€ user-service/         # .folder.project (Node.js API)
โ”‚   โ”‚   โ”œโ”€โ”€ auth-service/         # .folder.project (Authentication)
โ”‚   โ”‚   โ””โ”€โ”€ payment-service/      # .folder.project (Payment processing)
โ”‚   โ””โ”€โ”€ frontend/                 # .folder.platform
โ”‚       โ”œโ”€โ”€ web-app/              # .folder.project (React SPA)
โ”‚       โ””โ”€โ”€ admin-panel/          # .folder.project (Admin interface)
โ”œโ”€โ”€ mobile/                       # .folder.projects
โ”‚   โ”œโ”€โ”€ ios-app/                  # .folder.project (Swift/iOS)
โ”‚   โ””โ”€โ”€ android-app/              # .folder.project (Kotlin/Android)
โ””โ”€โ”€ shared/                       # .folder.projects
    โ”œโ”€โ”€ ui-components/            # .folder.project (Shared UI library)
    โ””โ”€โ”€ utils/                    # .folder.project (Common utilities)

Configuration

Project Tooling

Configure build, test, and lint commands:

tooling:
  build: "npm run build"
  test: "npm test -- --coverage"
  lint: "eslint src/ --fix"

Hooks

Set up automation hooks:

hooks:
  pre_build: "npm install && npm run generate"
  post_test: "npm run coverage-report"

Project Dependencies

Track project dependencies:

dependencies:
  - "auth-service"
  - "shared/utils"
  - "database"

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development

Setting up Development Environment

# Clone the repository
git clone https://github.com/yourusername/folder-metadata.git
cd folder-metadata

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in development mode
pip install -e .

# Install development dependencies
pip install pytest black flake8 mypy

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=fm

# Run specific test file
pytest tests/test_commands.py

Code Quality

# Format code
black fm/

# Lint code
flake8 fm/

# Type checking
mypy fm/

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Peter Corcoran

Roadmap

  • Web Dashboard: Browser-based repository visualization
  • CI/CD Integration: GitHub Actions and GitLab CI templates
  • Import/Export: Support for other metadata formats
  • Plugins: Extensible command system
  • Templates: Project scaffolding from templates
  • Metrics: Repository health and complexity metrics

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

folder_metadata-0.1.0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

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

folder_metadata-0.1.0-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file folder_metadata-0.1.0.tar.gz.

File metadata

  • Download URL: folder_metadata-0.1.0.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for folder_metadata-0.1.0.tar.gz
Algorithm Hash digest
SHA256 57fd737d399114b68a4ea40d5c3409028c18f2cd67eccb900f044d4775b3c2b4
MD5 1baa2a9e07ae5092528859b82fff3efc
BLAKE2b-256 577569970c162d28e84028a35eab67ab49d735855ec9f6a3fdf6fc9893175310

See more details on using hashes here.

File details

Details for the file folder_metadata-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for folder_metadata-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d27795ccfe2af83a9964cf0c2217e100c6e380f65d7b220f84e6c6a2783ad59a
MD5 e52e523a7cda1ee6d0ab74ae2184a938
BLAKE2b-256 46981cf3e194ffcd4ebccb6b8d26fd1cf1d8f75cff79caefe2f7720ccc19c714

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