Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .cursor/rules/cli-development.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# CLI Development Guide

## CLI Structure
- Main CLI entry point: [src/guhcampos/cli.py](mdc:src/guhcampos/cli.py)
- Uses Click framework for command-line interface
- Entry point defined in [pyproject.toml](mdc:pyproject.toml) as `guhcampos`

## Command Organization
- Main group: `guhcampos` with subcommands
- Keep CLI logic minimal, delegate to business logic

## CLI Patterns
- Use Click groups for command organization
- Import pre-baked functions, not direct class instantiation
- Use Rich for console output and progress bars
- Handle errors gracefully with user-friendly messages

## Command Structure
```python
@guhcampos.command()
def build():
"""Build the Hugo site"""
# Minimal CLI logic
# Call business logic functions
```

## Error Handling
- Catch exceptions and provide helpful error messages
- Use Rich console for colored output
- Validate inputs before processing
- Provide usage examples in docstrings

## Configuration
- Use environment variables for sensitive data
- Load configuration from [src/guhcampos/settings.py](mdc:src/guhcampos/settings.py)
- Support both required and optional parameters
- Use Click options for configuration

## User Experience
- Provide progress feedback for long-running operations
- Use descriptive command and option names
- Include help text for all commands
- Support both interactive and non-interactive modes

## Testing CLI
- Test CLI commands with mocked dependencies
- Verify correct function calls and parameters
- Test error handling and user feedback
- Use Click's testing utilities when needed

## Key Commands
- `guhcampos build` - Build Hugo site
- `guhcampos spotify list-playlists` - List Spotify playlists
- `guhcampos spotify fetch-playlists` - Fetch playlists into M3U and JSON files
description:
globs:
alwaysApply: false
---
42 changes: 42 additions & 0 deletions .cursor/rules/hugo-development.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Hugo Development Guide

## Hugo Site Structure
- All Hugo content is in [hugo/](mdc:hugo/) directory
- Configuration in [hugo/hugo.toml](mdc:hugo/hugo.toml)
- Theme is managed as git submodule in [hugo/themes/](mdc:hugo/themes/)
- Layouts in [hugo/layouts/](mdc:hugo/layouts/)
- Content in [hugo/content/](mdc:hugo/content/) (if exists)

## Build Process
- Use Python CLI: `uv run guhcampos build` to build Hugo site
- Use Python CLI: `uv run guhcampos serve` to serve locally
- Build output goes to [hugo/public/](mdc:hugo/public/)
- Generated content (Spotify playlists) goes to [build/](mdc:build/)

## Configuration
- Hugo configuration in [hugo/config/_default/](mdc:hugo/config/_default/)
- Environment-specific configs in [hugo/config/](mdc:hugo/config/)
- Theme configuration in [hugo/themes/blowfish/](mdc:hugo/themes/blowfish/)

## Content Integration
- Spotify playlists are fetched and saved as M3U files
- Content can be generated from external APIs
- Use Hugo shortcodes for dynamic content
- Static assets in [hugo/static/](mdc:hugo/static/) (if exists)

## Development Workflow
1. Edit Hugo content in [hugo/](mdc:hugo/) directory
2. Use Python tools to fetch external content
3. Build with `uv run guhcampos build`
4. Test locally with `uv run guhcampos serve`
5. Deploy via GitHub Actions

## Key Files
- [hugo/hugo.toml](mdc:hugo/hugo.toml) - Main Hugo configuration
- [hugo/layouts/](mdc:hugo/layouts/) - Custom layouts and templates
- [hugo/archetypes/](mdc:hugo/archetypes/) - Content templates
- [.gitmodules](mdc:.gitmodules) - Theme submodule configuration
description:
globs:
alwaysApply: false
---
35 changes: 35 additions & 0 deletions .cursor/rules/project-structure.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Project Structure Guide

This is a personal website project using Hugo with Python build tools. The project has a hybrid structure:

## Core Structure
- [hugo/](mdc:hugo/) - Contains all Hugo-related content (the actual website)
- [src/guhcampos/](mdc:src/guhcampos/) - Python package with build tools and CLI
- [tests/](mdc:tests/) - Python tests for the build tools
- [build/](mdc:build/) - Generated build artifacts (gitignored)

## Key Configuration Files
- [pyproject.toml](mdc:pyproject.toml) - Python project configuration and dependencies
- [hugo/hugo.toml](mdc:hugo/hugo.toml) - Hugo site configuration
- [.envrc](mdc:.envrc) - Environment variables for development
- [.gitmodules](mdc:.gitmodules) - Git submodules (Hugo themes)

## Python Package Structure
- [src/guhcampos/cli.py](mdc:src/guhcampos/cli.py) - Click-based CLI entry point
- [src/guhcampos/hugo.py](mdc:src/guhcampos/hugo.py) - Hugo-specific operations
- [src/guhcampos/spotify/](mdc:src/guhcampos/spotify/) - Spotify API integration
- [src/guhcampos/settings.py](mdc:src/guhcampos/settings.py) - Configuration management

## Development Tools
- Uses `uv` for Python dependency management
- Ruff for linting and formatting
- Pytest for testing
- VS Code configuration in [.vscode/](mdc:.vscode/)

## Build Process
The Python package provides CLI commands to build and serve the Hugo site, with
additional integrations for Spotify playlists and other content sources.
description:
globs:
alwaysApply: false
---
43 changes: 43 additions & 0 deletions .cursor/rules/python-development.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Python Development Standards

## Code Style
- Use Black for formatting (88 character line length)
- Use Ruff for linting and import sorting
- Follow type hints with Pydantic models
- Use `uv` for dependency management

## Project Structure
- All Python code goes in [src/guhcampos/](mdc:src/guhcampos/)
- Tests go in [tests/](mdc:tests/)
- Use Pydantic models for data validation
- Keep CLI logic separate from business logic

## Testing
- Use pytest with `tmp_path` fixture for file operations
- Mock external APIs (Spotify, etc.)
- Test both success and failure scenarios
- Use descriptive test names and docstrings

## Dependencies
- Core dependencies in [pyproject.toml](mdc:pyproject.toml)
- Development dependencies include pytest, ruff, black
- Use Pydantic for data models and validation
- Use Click for CLI interface
- Use Rich for console output

## Key Patterns
- Use generators for pagination (Spotify API)
- Use Pydantic models for API responses
- Use pathlib.Path for file operations
- Use environment variables for configuration
- Use logging/console output for user feedback

## File Organization
- [src/guhcampos/cli.py](mdc:src/guhcampos/cli.py) - CLI entry points only
- [src/guhcampos/core.py](mdc:src/guhcampos/core.py) - Core utilities
- [src/guhcampos/spotify/](mdc:src/guhcampos/spotify/) - Spotify integration
- [src/guhcampos/settings.py](mdc:src/guhcampos/settings.py) - Configuration
description:
globs:
alwaysApply: false
---
46 changes: 46 additions & 0 deletions .cursor/rules/spotify-integration.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Spotify Integration Guide

## Architecture
- Spotify integration in [src/guhcampos/spotify/](mdc:src/guhcampos/spotify/)
- [src/guhcampos/spotify/client.py](mdc:src/guhcampos/spotify/client.py) - API client and business logic
- [src/guhcampos/spotify/models.py](mdc:src/guhcampos/spotify/models.py) - Pydantic models for data validation

## Key Patterns
- Use Pydantic models for API responses (SpotifyPlaylist, SpotifyTrack)
- Implement pagination using generators in `fetch_playlists()`
- Use environment variables for API credentials
- Save playlists as M3U files for Hugo integration

## API Usage
- Client credentials flow for authentication
- Pagination with offset/limit for playlists
- Track sorting by artist and name
- Error handling with console output

## Data Models
- `SpotifyPlaylist`: Playlist metadata with tracks
- `SpotifyTrack`: Track information with duration
- `to_m3u()` method for playlist export
- `to_json()` method for data serialization


## Testing
- Mock API responses in [tests/test_spotify.py](mdc:tests/test_spotify.py)
- Use `tmp_path` fixture for file operations
- Test pagination with realistic mock data
- Test both success and error scenarios

## Configuration
- Spotify credentials in environment variables
- Output directory configurable via CLI
- Playlist filtering by name
- Progress reporting with Rich console

## File Formats
- M3U format for playlist export
- JSON format for data storage
- Proper URL validation with Pydantic HttpUrl
description:
globs:
alwaysApply: false
---
53 changes: 53 additions & 0 deletions .cursor/rules/testing-standards.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Testing Standards

## Test Structure
- All tests in [tests/](mdc:tests/) directory
- Use pytest as testing framework
- Follow naming convention: `test_*.py` files
- Use descriptive test function names

## Mocking Patterns
- Mock external APIs (Spotify, HTTP requests)
- Use `@patch` decorator for dependency injection
- Mock file system operations with `tmp_path` fixture
- Create realistic mock data for pagination testing

## File Operations
- Always use `tmp_path` fixture for file output
- Never write to repository root in tests
- Clean up temporary files automatically
- Test both file creation and content validation

## API Testing
- Mock HTTP responses with realistic data
- Test pagination logic with multiple mock responses
- Test error scenarios and exception handling
- Validate response parsing and model creation

## Test Data
- Use Pydantic models for test data validation
- Create realistic mock responses matching API format
- Test edge cases (empty responses, pagination boundaries)
- Use valid URLs for HttpUrl validation

## Assertions
- Test both success and failure paths
- Validate data types and model instances
- Check function call counts and parameters
- Verify file content and format

## Test Organization
- Group related tests in same file
- Use descriptive docstrings for test functions
- Test one concept per test function
- Use setup/teardown when needed

## Key Examples
- [tests/test_spotify.py](mdc:tests/test_spotify.py) - Spotify API testing
- Pagination testing with realistic mock data
- File output testing with `tmp_path`
- Model validation testing
description:
globs:
alwaysApply: false
---
Loading