Skip to content

Commit 03ac5f4

Browse files
committed
Add initial claude file
1 parent 87e8674 commit 03ac5f4

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

CLAUDE.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
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+
### Testing
8+
- `bundle exec rake` - Run all tests (RSpec, Minitest, and Rails tests)
9+
- `bundle exec rspec` - Run RSpec tests only
10+
- `bundle exec rake spec:ui` - Run UI-specific specs
11+
- `bundle exec rake test` - Run Minitest tests only
12+
- `bundle exec rake test_rails` - Run Rails generator tests
13+
- `script/test` - Bootstrap and run tests across multiple Rails versions (5.0-8.0)
14+
15+
### Development Setup
16+
- `script/bootstrap` - Bundle install dependencies and setup binstubs
17+
- `script/console` - Start interactive console with Flipper loaded (uses Pry)
18+
- `script/server` - Start local UI server on port 9999 for testing web interface
19+
20+
### Building and Releasing
21+
- `bundle exec rake build` - Build all gems into pkg/ directory
22+
- `bundle exec rake release` - Tag version, push to remote, and push gems (requires OTP)
23+
24+
## Architecture Overview
25+
26+
Flipper is a feature flag library for Ruby with a modular adapter-based architecture:
27+
28+
### Core Components
29+
30+
**DSL Layer** (`lib/flipper/dsl.rb`):
31+
- Main interface for feature flag operations
32+
- Delegates to Feature instances
33+
- Handles memoization and instrumentation
34+
- Thread-safe instance management
35+
36+
**Feature** (`lib/flipper/feature.rb`):
37+
- Represents individual feature flags
38+
- Manages enable/disable operations through gates
39+
- Handles instrumentation events
40+
- Works with adapters for persistence
41+
42+
**Adapters** (`lib/flipper/adapters/`):
43+
- Pluggable storage backends (Redis, ActiveRecord, Memory, etc.)
44+
- Common interface for all storage implementations
45+
- Support for caching, failover, and synchronization patterns
46+
47+
**Gates** (`lib/flipper/gates/`):
48+
- Different targeting mechanisms:
49+
- Boolean (on/off for everyone)
50+
- Actor (specific users/entities)
51+
- Group (predefined user groups)
52+
- Percentage of Actors (rollout to X% of users)
53+
- Percentage of Time (probabilistic enabling)
54+
- Expression (complex conditional logic)
55+
56+
### Multi-Gem Structure
57+
58+
The project is structured as multiple gems:
59+
- `flipper` - Core library
60+
- `flipper-ui` - Web interface
61+
- `flipper-api` - REST API
62+
- `flipper-cloud` - Cloud service integration
63+
- `flipper-*` - Various adapter gems (redis, active_record, mongo, etc.)
64+
65+
### Key Patterns
66+
67+
**Configuration**: Global configuration through `Flipper.configure` with per-thread instances
68+
**Instrumentation**: Built-in event system for monitoring and debugging
69+
**Memoization**: Automatic caching of feature checks within request/thread scope
70+
**Type Safety**: Strong typing system for actors, percentages, and other values
71+
72+
### Testing
73+
74+
Uses both RSpec (currently preferred for new tests) and Minitest. Shared adapter specs ensure consistency across all storage backends. Extensive testing across multiple Rails versions (5.0-8.0).

0 commit comments

Comments
 (0)