Skip to content

Commit f2a8046

Browse files
committed
Rename Done
1 parent bfc5fc1 commit f2a8046

190 files changed

Lines changed: 3272 additions & 2549 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CLAUDE.md

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
# CLAUDE.md
22

3-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this
4+
repository.
45

5-
## ActivePrompt Rails Engine
6+
## PromptEngine Rails Engine
67

7-
ActivePrompt is a mountable Rails engine for AI prompt management. It provides a centralized admin interface where teams can create, version, test, and optimize their AI prompts without deploying code changes.
8+
PromptEngine is a mountable Rails engine for AI prompt management. It provides a centralized admin
9+
interface where teams can create, version, test, and optimize their AI prompts without deploying
10+
code changes.
811

912
## Development Commands
1013

1114
### Running the Development Server
15+
1216
```bash
1317
cd spec/dummy && rails s
1418
```
15-
Access the admin interface at `http://localhost:3000/active_prompt`
19+
20+
Access the admin interface at `http://localhost:3000/prompt_engine`
1621

1722
### Database Setup
23+
1824
```bash
1925
cd spec/dummy
2026
bundle exec rails db:create
@@ -23,9 +29,10 @@ bundle exec rails db:seed # Loads sample prompts
2329
```
2430

2531
### Running Tests
32+
2633
```bash
2734
bundle exec rspec # Run all tests with coverage
28-
bundle exec rspec spec/models # Run model tests
35+
bundle exec rspec spec/models # Run model tests
2936
bundle exec rspec spec/requests # Run request specs (controllers)
3037
bundle exec rspec spec/system # Run system tests
3138
bundle exec rspec path/to/spec.rb # Run specific test file
@@ -37,49 +44,56 @@ open coverage/index.html # View SimpleCov coverage report
3744
```
3845

3946
### Rake Tasks
47+
4048
```bash
4149
bundle exec rake setup # Setup dummy app for development
4250
bundle exec rake spec # Run all specs
43-
bin/rails active_prompt:install:migrations # Install engine migrations in host app
51+
bin/rails prompt_engine:install:migrations # Install engine migrations in host app
4452
```
4553

4654
## Architecture Overview
4755

4856
### Core Models & Relationships
4957

50-
**ActivePrompt::Prompt**
58+
**PromptEngine::Prompt**
59+
5160
- Central model containing prompt templates with `{{variable}}` syntax
5261
- Has many versions (auto-versioned on content/system_message changes)
5362
- Has many parameters (auto-detected from variables)
5463
- Status enum: draft, active, archived
5564
- Key method: `render(variables: {})` for template rendering
5665

57-
**ActivePrompt::PromptVersion**
66+
**PromptEngine::PromptVersion**
67+
5868
- Immutable snapshots of prompts
5969
- Auto-incremented version numbers
6070
- Stores content, system_message, model_config at time of creation
6171
- Key method: `restore!` to revert prompt to this version
6272

63-
**ActivePrompt::Parameter**
73+
**PromptEngine::Parameter**
74+
6475
- Defines expected variables with types and validation
6576
- Types: string, integer, decimal, boolean, datetime, date, array, json
6677
- Auto-generates appropriate form inputs
6778

6879
### Service Objects
6980

7081
**VariableDetector**
82+
7183
- Extracts `{{variables}}` from prompt content
7284
- Infers types from variable names (e.g., `_at` → datetime)
7385
- Validates provided variables against template
7486

7587
**PlaygroundExecutor**
88+
7689
- Handles AI provider communication (Anthropic, OpenAI)
7790
- Manages API keys from Rails credentials
7891
- Formats requests and parses responses
7992

8093
### Testing Philosophy
8194

8295
Read `.ai/RSPEC-TESTS.md` before writing tests. Key principles:
96+
8397
- Use request specs instead of controller specs
8498
- Test full request/response cycle
8599
- Use FactoryBot for test data
@@ -97,31 +111,36 @@ Read `.ai/RSPEC-TESTS.md` before writing tests. Key principles:
97111
## Key Implementation Details
98112

99113
### Version Control System
114+
100115
- Automatic versioning tracks changes to content, system_message, and model settings
101116
- Version history preserved with change descriptions
102117
- One-click restore to any previous version
103118
- Counter cache for efficient version counting
104119

105120
### Variable System
121+
106122
- Variables use `{{variable_name}}` syntax
107123
- Automatic parameter detection and synchronization
108124
- Type inference based on naming conventions
109125
- Support for complex types (arrays, JSON)
110126

111127
### Playground Feature
128+
112129
- Live testing with real AI providers
113130
- Supports multiple models (GPT-4, Claude, etc.)
114131
- Real-time execution with streaming responses
115132
- Token counting and cost estimation
116133

117134
### Engine Integration
135+
118136
The engine is designed to be mounted in Rails applications:
137+
119138
```ruby
120139
# Host app's routes.rb
121-
mount ActivePrompt::Engine => "/active_prompt"
140+
mount PromptEngine::Engine => "/prompt_engine"
122141

123142
# Usage in application
124-
ActivePrompt.render(:prompt_name, variables: { user_name: "John" })
143+
PromptEngine.render(:prompt_name, variables: { user_name: "John" })
125144
```
126145

127146
## Current Status
@@ -132,4 +151,5 @@ ActivePrompt.render(:prompt_name, variables: { user_name: "John" })
132151

133152
**Planned**: Multi-language support, A/B testing, prompt marketplace
134153

135-
See `docs/SPEC.md` for complete product vision and `docs/ARCHITECTURE.md` for detailed technical documentation.
154+
See `docs/SPEC.md` for complete product vision and `docs/ARCHITECTURE.md` for detailed technical
155+
documentation.

0 commit comments

Comments
 (0)