|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Development Commands |
| 6 | + |
| 7 | +### Run the application |
| 8 | +```bash |
| 9 | +# Start the development server |
| 10 | +bundle exec puma -e development |
| 11 | +``` |
| 12 | + |
| 13 | +### Install dependencies |
| 14 | +```bash |
| 15 | +# Install Ruby gems |
| 16 | +bundle install |
| 17 | +``` |
| 18 | + |
| 19 | +### Run tests |
| 20 | +```bash |
| 21 | +# Run all tests |
| 22 | +bundle exec rake test |
| 23 | + |
| 24 | +# Run specific test file |
| 25 | +bundle exec ruby tests/feedblock.rb |
| 26 | +bundle exec ruby tests/sortblock.rb |
| 27 | +``` |
| 28 | + |
| 29 | +## Architecture Overview |
| 30 | + |
| 31 | +Pipes CE is a Ruby/Sinatra application that provides a graphical interface for data manipulation through connected blocks, using RSS as the internal format. |
| 32 | + |
| 33 | +### Core Components |
| 34 | + |
| 35 | +**Block System Architecture** |
| 36 | +- `block.rb` - Base Block class that all blocks inherit from. Implements recursive processing where blocks call their inputs before processing. |
| 37 | +- `blocks/` directory contains specialized block implementations (FeedBlock, FilterBlock, CombineBlock, etc.) |
| 38 | +- Each block has `inputs` (data sources), `options` (configuration), and a `process` method for data transformation |
| 39 | +- Blocks process data recursively: parent blocks call child blocks' `run()` method to get processed data |
| 40 | + |
| 41 | +**Main Application Components** |
| 42 | +- `server.rb` - Sinatra web application with routes and authentication (uses Portier for passwordless login) |
| 43 | +- `pipe.rb` - Manages pipe execution, creates block chains from JSON definitions, handles caching |
| 44 | +- `database.rb` - Database operations for users, pipes, cache, and webhooks |
| 45 | +- `user.rb` - User management and authentication |
| 46 | +- `downloader.rb` - Handles HTTP downloads with caching |
| 47 | + |
| 48 | +**Data Flow** |
| 49 | +1. Pipes are stored as JSON structures defining blocks and their connections |
| 50 | +2. When executed, a Pipe object creates a tree of Block objects based on the JSON |
| 51 | +3. The output block's `run()` method triggers recursive processing of all input blocks |
| 52 | +4. Each block processes its inputs and returns RSS/XML data |
| 53 | +5. Results are cached for 10 minutes (600 seconds) to improve performance |
| 54 | + |
| 55 | +**Key Implementation Details** |
| 56 | +- Uses SQLite for data storage (pipes, users, sessions, cache) |
| 57 | +- RSS is the internal data format - all blocks input/output RSS feeds |
| 58 | +- Blocks can have both data inputs and text inputs (user parameters) |
| 59 | +- Authentication via Portier (passwordless email-based login) |
| 60 | +- Session persistence using Moneta with SQLite backend |
| 61 | +- Background thread pool for cleanup tasks (cache, webhooks) |
0 commit comments