Markdown Converter
Agent skill for markdown-converter
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Sign in to like and favorite skills
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Run all tests pytest # Run tests with verbose output pytest -v # Run a specific test file pytest tests/test_models.py # Run a specific test pytest tests/test_models.py::test_snippet_initialization # Quick test for CI/hooks (stop on first failure) make test-quick
# Auto-format and fix code with ruff (required before commit) make format # Or: uv run ruff check --fix . # Check linting with ruff make lint # Or: uv run ruff check . # Run all checks (format + lint + test) make all
# Install dependencies using uv (preferred) uv pip install -e ".[dev]" # Set up complete development environment with hooks make dev # Run the CLI locally pypet --help
This is a Python CLI tool (
pypet) for managing command-line snippets, inspired by the Go-based pet tool. The architecture consists of three main components:
Models (
): Defines pypet/models.py
Snippet and Parameter dataclasses
Snippet: Represents a command with metadata (description, tags, parameters, alias, timestamps)Parameter: Represents customizable parameters within commands (with defaults and descriptions)Storage (
): Handles TOML-based persistencepypet/storage.py
~/.config/pypet/snippets.tomlCLI (
): Click-based command interface with Rich formatting (organized into modules)pypet/cli/*.py
new, list, search, edit, delete, exec, copy, sync, save-clipboard, save-last, aliasSync (
): Git-based synchronization systempypet/sync.py
Alias Manager (
): Shell alias managementpypet/alias_manager.py
~/.config/pypet/aliases.sh file{port} or {env=development}pypet exec without ID shows snippet selection tablepypet copy command, --copy option, and save-clipboard command for easy snippet sharingsave-last command~/.config/pypet/snippets.tomlTests are organized by component (130 total tests):
tests/test_models.py: Model validation and serializationtests/test_storage.py: File operations and persistencetests/test_cli.py: Command-line interface using Click's testing utilitiestests/test_sync.py: Git synchronization functionality (15 tests)tests/test_sync_cli.py: Sync command-line interface tests (15 tests)tests/test_alias.py: Alias manager and storage integration tests (15 tests)tests/test_alias_cli.py: Alias CLI command tests (15 tests)Commands support two parameter formats:
{name} - required parameter{name=default} - parameter with default valueParameters are defined with optional descriptions and are prompted for during interactive execution.
pypet alias add/list/remove/update/setup/show commands~/.config/pypet/aliases.shpypet delete without ID for interactive selectionalias field with TOML serializationpypet/alias_manager.py handles alias file generationpypet save-clipboard command (Issue #8): Save clipboard content as snippetspypet save-last command (Issue #8): Save command(s) from shell historypypet edit --file option (Issue #13): Open TOML config directlymake dev, make test, etc.pypet sync remote <url> commandmake commands for development tasks (preferred over direct uv commands)# Install development environment with hooks make dev # Or manually: make install # Install package in dev mode make hooks # Install pre-push git hooks
make format # Auto-format and fix code with ruff make lint # Check linting with ruff make test # Run tests make test-quick # Run tests with early exit (for CI/hooks) make all # Run format + lint + test make clean # Remove build artifacts and cache files
make dev or make hooks)git push --no-verify only in emergenciesSKIP_TESTS=1 to skip tests in hooks (for quick iterations).git/hooks/pre-push (installed from scripts/install-hooks.sh)The CLI is organized into submodules to avoid circular imports:
cli/main.py - Defines the main Click group and shared instances (console, storage, sync_manager)main module and register commands via decoratorscli/__init__.py imports main first, then command modulescli/__init__.py for testsWhen adding a new command:
cli/snippet_commands.py)main from .main to access the Click group@main.command() decoratorcli/__init__.py to trigger registrationtests/test_*_cli.py~/.config/pypet/snippets.toml