prompt_manager 0.5.7 → 0.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/COMMITS.md +196 -0
- data/README.md +485 -203
- data/docs/.keep +0 -0
- data/docs/advanced/custom-keywords.md +421 -0
- data/docs/advanced/dynamic-directives.md +535 -0
- data/docs/advanced/performance.md +612 -0
- data/docs/advanced/search-integration.md +635 -0
- data/docs/api/configuration.md +355 -0
- data/docs/api/directive-processor.md +431 -0
- data/docs/api/prompt-class.md +354 -0
- data/docs/api/storage-adapters.md +462 -0
- data/docs/assets/favicon.ico +1 -0
- data/docs/assets/logo.svg +24 -0
- data/docs/core-features/comments.md +48 -0
- data/docs/core-features/directive-processing.md +38 -0
- data/docs/core-features/erb-integration.md +68 -0
- data/docs/core-features/error-handling.md +197 -0
- data/docs/core-features/parameter-history.md +76 -0
- data/docs/core-features/parameterized-prompts.md +500 -0
- data/docs/core-features/shell-integration.md +79 -0
- data/docs/development/architecture.md +544 -0
- data/docs/development/contributing.md +425 -0
- data/docs/development/roadmap.md +234 -0
- data/docs/development/testing.md +822 -0
- data/docs/examples/advanced.md +523 -0
- data/docs/examples/basic.md +688 -0
- data/docs/examples/real-world.md +776 -0
- data/docs/examples.md +337 -0
- data/docs/getting-started/basic-concepts.md +318 -0
- data/docs/getting-started/installation.md +97 -0
- data/docs/getting-started/quick-start.md +256 -0
- data/docs/index.md +230 -0
- data/docs/migration/v0.9.0.md +459 -0
- data/docs/migration/v1.0.0.md +591 -0
- data/docs/storage/activerecord-adapter.md +348 -0
- data/docs/storage/custom-adapters.md +176 -0
- data/docs/storage/filesystem-adapter.md +236 -0
- data/docs/storage/overview.md +427 -0
- data/examples/advanced_integrations.rb +52 -0
- data/examples/prompts_dir/advanced_demo.txt +79 -0
- data/examples/prompts_dir/directive_example.json +1 -0
- data/examples/prompts_dir/directive_example.txt +8 -0
- data/examples/prompts_dir/todo.json +1 -1
- data/improvement_plan.md +996 -0
- data/lib/prompt_manager/storage/file_system_adapter.rb +8 -2
- data/lib/prompt_manager/version.rb +1 -1
- data/mkdocs.yml +146 -0
- data/prompt_manager_logo.png +0 -0
- metadata +46 -3
- data/LICENSE.txt +0 -21
@@ -0,0 +1,591 @@
|
|
1
|
+
# Migration Guide: Version 1.0.0
|
2
|
+
|
3
|
+
This guide helps you migrate from PromptManager v0.9.x to v1.0.0, which represents the first stable release with a commitment to semantic versioning.
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
Version 1.0.0 focuses on API stabilization, performance improvements, and enhanced developer experience. While there are some breaking changes, most applications should migrate smoothly.
|
8
|
+
|
9
|
+
## Major Changes
|
10
|
+
|
11
|
+
### 1. Stable Public API
|
12
|
+
- All public APIs are now considered stable
|
13
|
+
- Semantic versioning is strictly followed from this version forward
|
14
|
+
- Deprecation warnings will be provided for 6 months before removal
|
15
|
+
|
16
|
+
### 2. Enhanced Storage System
|
17
|
+
- New storage adapter capabilities
|
18
|
+
- Improved error handling and diagnostics
|
19
|
+
- Better performance for large prompt libraries
|
20
|
+
|
21
|
+
### 3. Advanced Template Features
|
22
|
+
- Template inheritance system
|
23
|
+
- Custom directive registration
|
24
|
+
- Improved ERB integration
|
25
|
+
|
26
|
+
## Breaking Changes
|
27
|
+
|
28
|
+
### 1. Removed Deprecated Methods
|
29
|
+
|
30
|
+
#### Methods Removed in v1.0.0
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
# These methods were deprecated in v0.9.x and removed in v1.0.0
|
34
|
+
|
35
|
+
# OLD (removed):
|
36
|
+
prompt.enable_erb = true
|
37
|
+
prompt.enable_envar = true
|
38
|
+
|
39
|
+
# NEW (use during initialization):
|
40
|
+
prompt = PromptManager::Prompt.new(
|
41
|
+
id: 'template',
|
42
|
+
erb_flag: true,
|
43
|
+
envar_flag: true
|
44
|
+
)
|
45
|
+
```
|
46
|
+
|
47
|
+
#### Migration Steps
|
48
|
+
1. Remove usage of deprecated setter methods
|
49
|
+
2. Pass flags during prompt initialization
|
50
|
+
|
51
|
+
### 2. Storage Adapter Method Signatures
|
52
|
+
|
53
|
+
#### Updated Method Signatures
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
# OLD (v0.9.x):
|
57
|
+
def read(prompt_id)
|
58
|
+
# Simple string return
|
59
|
+
end
|
60
|
+
|
61
|
+
# NEW (v1.0.0):
|
62
|
+
def read(prompt_id)
|
63
|
+
# Can return string or PromptData object
|
64
|
+
end
|
65
|
+
|
66
|
+
# NEW: Enhanced read method (optional)
|
67
|
+
def read_with_metadata(prompt_id)
|
68
|
+
{
|
69
|
+
content: "prompt content",
|
70
|
+
metadata: { author: "user", version: 1 },
|
71
|
+
last_modified: Time.current
|
72
|
+
}
|
73
|
+
end
|
74
|
+
```
|
75
|
+
|
76
|
+
#### Migration Steps
|
77
|
+
- No changes required for basic adapters
|
78
|
+
- Optionally implement `read_with_metadata` for enhanced functionality
|
79
|
+
|
80
|
+
### 3. Configuration Changes
|
81
|
+
|
82
|
+
#### Updated Configuration Structure
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
# OLD (v0.9.x):
|
86
|
+
PromptManager.configure do |config|
|
87
|
+
config.cache_prompts = true
|
88
|
+
config.cache_ttl = 300
|
89
|
+
end
|
90
|
+
|
91
|
+
# NEW (v1.0.0):
|
92
|
+
PromptManager.configure do |config|
|
93
|
+
config.cache = {
|
94
|
+
enabled: true,
|
95
|
+
ttl: 300,
|
96
|
+
store: :memory, # or :redis, :memcached
|
97
|
+
options: {}
|
98
|
+
}
|
99
|
+
end
|
100
|
+
```
|
101
|
+
|
102
|
+
#### Migration Steps
|
103
|
+
1. Update cache configuration to use nested structure
|
104
|
+
2. Specify cache store type explicitly
|
105
|
+
|
106
|
+
## New Features
|
107
|
+
|
108
|
+
### 1. Template Inheritance
|
109
|
+
|
110
|
+
Create reusable template hierarchies:
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
# layouts/base.txt
|
114
|
+
<!DOCTYPE html>
|
115
|
+
<html>
|
116
|
+
<head>
|
117
|
+
<title>//yield title</title>
|
118
|
+
</head>
|
119
|
+
<body>
|
120
|
+
<h1>//yield heading</h1>
|
121
|
+
<div class="content">
|
122
|
+
//yield content
|
123
|
+
</div>
|
124
|
+
</body>
|
125
|
+
</html>
|
126
|
+
|
127
|
+
# email.txt
|
128
|
+
//extends layouts/base
|
129
|
+
//section title: Email Notification
|
130
|
+
//section heading: Important Update
|
131
|
+
//section content: Your account has been updated.
|
132
|
+
```
|
133
|
+
|
134
|
+
### 2. Custom Directive System
|
135
|
+
|
136
|
+
Register custom processing directives:
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
PromptManager.configure do |config|
|
140
|
+
config.register_directive('timestamp') do |format, context|
|
141
|
+
Time.current.strftime(format || '%Y-%m-%d %H:%M:%S')
|
142
|
+
end
|
143
|
+
|
144
|
+
config.register_directive('user_info') do |user_id, context|
|
145
|
+
user = User.find(user_id)
|
146
|
+
"#{user.name} (#{user.email})"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# Usage in prompts:
|
151
|
+
# Generated at: //timestamp %B %d, %Y
|
152
|
+
# User: //user_info [USER_ID]
|
153
|
+
```
|
154
|
+
|
155
|
+
### 3. Enhanced Error Information
|
156
|
+
|
157
|
+
More detailed error messages and context:
|
158
|
+
|
159
|
+
```ruby
|
160
|
+
begin
|
161
|
+
prompt.render(incomplete_params)
|
162
|
+
rescue PromptManager::MissingParametersError => e
|
163
|
+
puts "Missing parameters:"
|
164
|
+
e.missing_parameters.each do |param|
|
165
|
+
puts " - #{param[:name]} (line #{param[:line]})"
|
166
|
+
end
|
167
|
+
|
168
|
+
puts "Suggestions:"
|
169
|
+
e.suggestions.each { |suggestion| puts " - #{suggestion}" }
|
170
|
+
end
|
171
|
+
```
|
172
|
+
|
173
|
+
### 4. Performance Monitoring
|
174
|
+
|
175
|
+
Built-in performance tracking:
|
176
|
+
|
177
|
+
```ruby
|
178
|
+
PromptManager.configure do |config|
|
179
|
+
config.performance_monitoring = {
|
180
|
+
enabled: true,
|
181
|
+
slow_threshold: 0.1, # seconds
|
182
|
+
callback: ->(metrics) {
|
183
|
+
Rails.logger.warn "Slow prompt: #{metrics[:prompt_id]} (#{metrics[:duration]}s)"
|
184
|
+
}
|
185
|
+
}
|
186
|
+
end
|
187
|
+
```
|
188
|
+
|
189
|
+
## Database Schema Updates (ActiveRecord Adapter)
|
190
|
+
|
191
|
+
### New Schema for Enhanced Features
|
192
|
+
|
193
|
+
```ruby
|
194
|
+
class UpdatePromptsForV100 < ActiveRecord::Migration[7.0]
|
195
|
+
def change
|
196
|
+
# Add versioning support
|
197
|
+
add_column :prompts, :version_number, :integer, default: 1
|
198
|
+
add_column :prompts, :parent_version, :integer
|
199
|
+
|
200
|
+
# Add template inheritance
|
201
|
+
add_column :prompts, :extends, :string
|
202
|
+
add_column :prompts, :template_type, :string, default: 'prompt'
|
203
|
+
|
204
|
+
# Add usage tracking
|
205
|
+
add_column :prompts, :usage_count, :integer, default: 0
|
206
|
+
add_column :prompts, :last_used_at, :timestamp
|
207
|
+
|
208
|
+
# Add performance tracking
|
209
|
+
add_column :prompts, :avg_render_time, :decimal, precision: 8, scale: 4
|
210
|
+
add_column :prompts, :last_render_time, :decimal, precision: 8, scale: 4
|
211
|
+
|
212
|
+
# Enhanced metadata
|
213
|
+
change_column :prompts, :metadata, :jsonb # PostgreSQL
|
214
|
+
# For MySQL: change_column :prompts, :metadata, :json
|
215
|
+
|
216
|
+
# New indexes
|
217
|
+
add_index :prompts, :version_number
|
218
|
+
add_index :prompts, :template_type
|
219
|
+
add_index :prompts, :usage_count
|
220
|
+
add_index :prompts, :last_used_at
|
221
|
+
add_index :prompts, [:extends, :template_type]
|
222
|
+
|
223
|
+
# GIN index for metadata search (PostgreSQL)
|
224
|
+
add_index :prompts, :metadata, using: :gin
|
225
|
+
end
|
226
|
+
|
227
|
+
def down
|
228
|
+
remove_column :prompts, :version_number
|
229
|
+
remove_column :prompts, :parent_version
|
230
|
+
remove_column :prompts, :extends
|
231
|
+
remove_column :prompts, :template_type
|
232
|
+
remove_column :prompts, :usage_count
|
233
|
+
remove_column :prompts, :last_used_at
|
234
|
+
remove_column :prompts, :avg_render_time
|
235
|
+
remove_column :prompts, :last_render_time
|
236
|
+
end
|
237
|
+
end
|
238
|
+
```
|
239
|
+
|
240
|
+
## Configuration Migration
|
241
|
+
|
242
|
+
### Full Configuration Example
|
243
|
+
|
244
|
+
```ruby
|
245
|
+
# config/initializers/prompt_manager.rb (v1.0.0)
|
246
|
+
|
247
|
+
PromptManager.configure do |config|
|
248
|
+
# Storage configuration
|
249
|
+
config.storage = if Rails.env.production?
|
250
|
+
PromptManager::Storage::ActiveRecordAdapter.new(
|
251
|
+
model_class: Prompt,
|
252
|
+
enable_versioning: true,
|
253
|
+
enable_usage_tracking: true
|
254
|
+
)
|
255
|
+
else
|
256
|
+
PromptManager::Storage::FileSystemAdapter.new(
|
257
|
+
prompts_dir: Rails.root.join('app', 'prompts'),
|
258
|
+
enable_hot_reload: Rails.env.development?
|
259
|
+
)
|
260
|
+
end
|
261
|
+
|
262
|
+
# Caching configuration
|
263
|
+
config.cache = {
|
264
|
+
enabled: Rails.env.production?,
|
265
|
+
ttl: 1.hour,
|
266
|
+
store: :redis,
|
267
|
+
options: {
|
268
|
+
url: ENV['REDIS_URL'],
|
269
|
+
namespace: 'prompt_manager',
|
270
|
+
compress: true
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
# Template processing
|
275
|
+
config.templates = {
|
276
|
+
inheritance_enabled: true,
|
277
|
+
max_inheritance_depth: 5,
|
278
|
+
custom_directives: true
|
279
|
+
}
|
280
|
+
|
281
|
+
# Performance monitoring
|
282
|
+
config.performance_monitoring = {
|
283
|
+
enabled: Rails.env.production?,
|
284
|
+
slow_threshold: 0.5,
|
285
|
+
callback: ->(metrics) {
|
286
|
+
Rails.logger.info "PromptManager: #{metrics[:prompt_id]} rendered in #{metrics[:duration]}s"
|
287
|
+
|
288
|
+
if metrics[:duration] > config.performance_monitoring[:slow_threshold]
|
289
|
+
SlackNotifier.notify("Slow prompt detected: #{metrics[:prompt_id]}")
|
290
|
+
end
|
291
|
+
}
|
292
|
+
}
|
293
|
+
|
294
|
+
# Error handling
|
295
|
+
config.error_handling = {
|
296
|
+
raise_on_missing_prompts: Rails.env.development?,
|
297
|
+
raise_on_missing_parameters: Rails.env.development?,
|
298
|
+
fallback_handler: ->(error, context) {
|
299
|
+
Rails.logger.error "PromptManager error: #{error.message}"
|
300
|
+
Rails.logger.error "Context: #{context.inspect}"
|
301
|
+
|
302
|
+
case error
|
303
|
+
when PromptManager::PromptNotFoundError
|
304
|
+
"[Prompt temporarily unavailable]"
|
305
|
+
when PromptManager::MissingParametersError
|
306
|
+
"[Missing: #{error.missing_parameters.map(&:name).join(', ')}]"
|
307
|
+
else
|
308
|
+
"[Content unavailable]"
|
309
|
+
end
|
310
|
+
}
|
311
|
+
}
|
312
|
+
|
313
|
+
# Custom directives
|
314
|
+
config.register_directive('format_currency') do |amount, currency, context|
|
315
|
+
# Custom currency formatting logic
|
316
|
+
Money.new(amount.to_f * 100, currency).format
|
317
|
+
end
|
318
|
+
|
319
|
+
config.register_directive('user_avatar') do |user_id, size, context|
|
320
|
+
user = User.find(user_id)
|
321
|
+
user.avatar.variant(resize: "#{size}x#{size}").url
|
322
|
+
end
|
323
|
+
end
|
324
|
+
```
|
325
|
+
|
326
|
+
## Step-by-Step Migration
|
327
|
+
|
328
|
+
### 1. Update Dependencies
|
329
|
+
|
330
|
+
```ruby
|
331
|
+
# Gemfile
|
332
|
+
gem 'prompt_manager', '~> 1.0.0'
|
333
|
+
|
334
|
+
# If using additional features:
|
335
|
+
gem 'redis-rails' # For Redis caching
|
336
|
+
gem 'money-rails' # For currency formatting example
|
337
|
+
```
|
338
|
+
|
339
|
+
### 2. Run Database Migration
|
340
|
+
|
341
|
+
```bash
|
342
|
+
rails generate migration UpdatePromptsForV100
|
343
|
+
# Edit the migration with schema changes above
|
344
|
+
rails db:migrate
|
345
|
+
```
|
346
|
+
|
347
|
+
### 3. Update Configuration
|
348
|
+
|
349
|
+
Replace your existing configuration with the new structure shown above.
|
350
|
+
|
351
|
+
### 4. Update Custom Storage Adapters
|
352
|
+
|
353
|
+
```ruby
|
354
|
+
class CustomAdapter < PromptManager::Storage::Base
|
355
|
+
# Add new optional methods for enhanced features
|
356
|
+
|
357
|
+
def read_with_metadata(prompt_id)
|
358
|
+
content = read(prompt_id)
|
359
|
+
{
|
360
|
+
content: content,
|
361
|
+
metadata: get_metadata(prompt_id),
|
362
|
+
last_modified: get_last_modified(prompt_id)
|
363
|
+
}
|
364
|
+
rescue PromptNotFoundError
|
365
|
+
raise
|
366
|
+
end
|
367
|
+
|
368
|
+
def track_usage(prompt_id, render_time)
|
369
|
+
# Optional: implement usage tracking
|
370
|
+
end
|
371
|
+
|
372
|
+
def get_versions(prompt_id)
|
373
|
+
# Optional: implement versioning
|
374
|
+
[{ version: 1, content: read(prompt_id), created_at: Time.current }]
|
375
|
+
end
|
376
|
+
end
|
377
|
+
```
|
378
|
+
|
379
|
+
### 5. Update Application Code
|
380
|
+
|
381
|
+
```ruby
|
382
|
+
# OLD (v0.9.x):
|
383
|
+
class EmailService
|
384
|
+
def send_welcome_email(user)
|
385
|
+
prompt = PromptManager::Prompt.new(id: 'welcome_email')
|
386
|
+
content = prompt.render(user: user)
|
387
|
+
# Send email
|
388
|
+
end
|
389
|
+
end
|
390
|
+
|
391
|
+
# NEW (v1.0.0) - with error handling:
|
392
|
+
class EmailService
|
393
|
+
def send_welcome_email(user)
|
394
|
+
begin
|
395
|
+
prompt = PromptManager::Prompt.new(id: 'welcome_email')
|
396
|
+
content = prompt.render(user: user)
|
397
|
+
EmailMailer.welcome(user, content).deliver_later
|
398
|
+
rescue PromptManager::PromptNotFoundError
|
399
|
+
Rails.logger.error "Welcome email template not found"
|
400
|
+
EmailMailer.fallback_welcome(user).deliver_later
|
401
|
+
rescue PromptManager::MissingParametersError => e
|
402
|
+
Rails.logger.error "Missing email parameters: #{e.missing_parameters.join(', ')}"
|
403
|
+
# Handle gracefully or re-raise
|
404
|
+
end
|
405
|
+
end
|
406
|
+
end
|
407
|
+
```
|
408
|
+
|
409
|
+
### 6. Migrate to Template Inheritance
|
410
|
+
|
411
|
+
Convert related prompts to use inheritance:
|
412
|
+
|
413
|
+
```ruby
|
414
|
+
# Before: Separate files with duplicated structure
|
415
|
+
# welcome_email.txt, reset_password_email.txt, etc.
|
416
|
+
|
417
|
+
# After: Base template + specific content
|
418
|
+
# templates/email_base.txt
|
419
|
+
Subject: [SUBJECT]
|
420
|
+
|
421
|
+
Dear [USER_NAME],
|
422
|
+
|
423
|
+
[CONTENT]
|
424
|
+
|
425
|
+
Best regards,
|
426
|
+
The [COMPANY_NAME] Team
|
427
|
+
|
428
|
+
---
|
429
|
+
This email was sent to [USER_EMAIL].
|
430
|
+
To unsubscribe, visit [UNSUBSCRIBE_URL]
|
431
|
+
|
432
|
+
# welcome_email.txt
|
433
|
+
//extends templates/email_base
|
434
|
+
//section subject: Welcome to [COMPANY_NAME]!
|
435
|
+
//section content: Thank you for joining us. We're excited to have you aboard!
|
436
|
+
|
437
|
+
# reset_password_email.txt
|
438
|
+
//extends templates/email_base
|
439
|
+
//section subject: Password Reset Request
|
440
|
+
//section content: Click here to reset your password: [RESET_URL]
|
441
|
+
```
|
442
|
+
|
443
|
+
## Testing Migration
|
444
|
+
|
445
|
+
### Automated Migration Test
|
446
|
+
|
447
|
+
```ruby
|
448
|
+
# test/migration_test.rb
|
449
|
+
require 'test_helper'
|
450
|
+
|
451
|
+
class V100MigrationTest < ActiveSupport::TestCase
|
452
|
+
def setup
|
453
|
+
# Setup test data
|
454
|
+
end
|
455
|
+
|
456
|
+
test "basic prompt rendering still works" do
|
457
|
+
prompt = PromptManager::Prompt.new(id: 'test_prompt')
|
458
|
+
result = prompt.render(name: 'Test')
|
459
|
+
assert_equal 'Hello Test!', result
|
460
|
+
end
|
461
|
+
|
462
|
+
test "template inheritance works" do
|
463
|
+
prompt = PromptManager::Prompt.new(id: 'inherited_prompt')
|
464
|
+
result = prompt.render(title: 'Test Page', content: 'Test content')
|
465
|
+
assert_includes result, 'Test Page'
|
466
|
+
assert_includes result, 'Test content'
|
467
|
+
end
|
468
|
+
|
469
|
+
test "custom directives work" do
|
470
|
+
prompt = PromptManager::Prompt.new(id: 'directive_prompt')
|
471
|
+
result = prompt.render
|
472
|
+
assert_match /\d{4}-\d{2}-\d{2}/, result # Should include timestamp
|
473
|
+
end
|
474
|
+
|
475
|
+
test "error handling provides detailed information" do
|
476
|
+
prompt = PromptManager::Prompt.new(id: 'param_prompt')
|
477
|
+
|
478
|
+
error = assert_raises(PromptManager::MissingParametersError) do
|
479
|
+
prompt.render # Missing required parameters
|
480
|
+
end
|
481
|
+
|
482
|
+
assert error.missing_parameters.any?
|
483
|
+
assert error.suggestions.any?
|
484
|
+
end
|
485
|
+
end
|
486
|
+
```
|
487
|
+
|
488
|
+
### Performance Verification
|
489
|
+
|
490
|
+
```ruby
|
491
|
+
# test/performance_test.rb
|
492
|
+
require 'test_helper'
|
493
|
+
require 'benchmark'
|
494
|
+
|
495
|
+
class V100PerformanceTest < ActiveSupport::TestCase
|
496
|
+
test "rendering performance is acceptable" do
|
497
|
+
prompt = PromptManager::Prompt.new(id: 'complex_prompt')
|
498
|
+
params = { user: create_test_user, items: create_test_items(100) }
|
499
|
+
|
500
|
+
time = Benchmark.measure do
|
501
|
+
100.times { prompt.render(params) }
|
502
|
+
end
|
503
|
+
|
504
|
+
# Should render 100 complex prompts in under 1 second
|
505
|
+
assert time.real < 1.0, "Rendering too slow: #{time.real}s"
|
506
|
+
end
|
507
|
+
end
|
508
|
+
```
|
509
|
+
|
510
|
+
## Rollback Procedures
|
511
|
+
|
512
|
+
### Quick Rollback
|
513
|
+
|
514
|
+
```bash
|
515
|
+
# 1. Update Gemfile
|
516
|
+
gem 'prompt_manager', '~> 0.9.0'
|
517
|
+
|
518
|
+
# 2. Bundle install
|
519
|
+
bundle install
|
520
|
+
|
521
|
+
# 3. Rollback database
|
522
|
+
rails db:rollback STEP=1
|
523
|
+
|
524
|
+
# 4. Restart application
|
525
|
+
```
|
526
|
+
|
527
|
+
### Configuration Rollback
|
528
|
+
|
529
|
+
Keep a backup of your v0.9.x configuration:
|
530
|
+
|
531
|
+
```ruby
|
532
|
+
# config/initializers/prompt_manager_v09_backup.rb
|
533
|
+
PromptManager.configure do |config|
|
534
|
+
config.storage = PromptManager::Storage::FileSystemAdapter.new(
|
535
|
+
prompts_dir: Rails.root.join('app', 'prompts')
|
536
|
+
)
|
537
|
+
config.cache_prompts = true
|
538
|
+
config.cache_ttl = 1800
|
539
|
+
end
|
540
|
+
```
|
541
|
+
|
542
|
+
## Validation Checklist
|
543
|
+
|
544
|
+
- [ ] **Dependencies Updated**: Gemfile shows v1.0.0
|
545
|
+
- [ ] **Database Migrated**: New columns and indexes created
|
546
|
+
- [ ] **Configuration Updated**: New configuration structure in use
|
547
|
+
- [ ] **Custom Adapters Updated**: Enhanced methods implemented (if applicable)
|
548
|
+
- [ ] **Template Inheritance**: Converted applicable prompts to use inheritance
|
549
|
+
- [ ] **Error Handling**: Updated to use new error information
|
550
|
+
- [ ] **Tests Updated**: All tests pass with new version
|
551
|
+
- [ ] **Performance Verified**: Rendering performance is acceptable
|
552
|
+
- [ ] **Documentation Updated**: Internal documentation reflects v1.0.0 features
|
553
|
+
|
554
|
+
## Getting Support
|
555
|
+
|
556
|
+
- **Documentation**: https://madbomber.github.io/prompt_manager
|
557
|
+
- **GitHub Issues**: https://github.com/MadBomber/prompt_manager/issues
|
558
|
+
- **Community Forum**: https://github.com/MadBomber/prompt_manager/discussions
|
559
|
+
- **Migration Support**: Tag issues with `migration-v1.0.0`
|
560
|
+
|
561
|
+
## Post-Migration Optimization
|
562
|
+
|
563
|
+
### 1. Enable New Features Gradually
|
564
|
+
|
565
|
+
Start with basic v1.0.0 functionality, then gradually enable:
|
566
|
+
- Template inheritance
|
567
|
+
- Custom directives
|
568
|
+
- Performance monitoring
|
569
|
+
- Advanced caching
|
570
|
+
|
571
|
+
### 2. Monitor Performance
|
572
|
+
|
573
|
+
Use the new performance monitoring to identify optimization opportunities:
|
574
|
+
|
575
|
+
```ruby
|
576
|
+
# Check slow prompts
|
577
|
+
PromptManager.slow_prompts(threshold: 0.1).each do |prompt_data|
|
578
|
+
puts "#{prompt_data[:id]}: #{prompt_data[:avg_time]}s average"
|
579
|
+
end
|
580
|
+
```
|
581
|
+
|
582
|
+
### 3. Optimize Storage
|
583
|
+
|
584
|
+
Consider upgrading storage adapters for better performance:
|
585
|
+
- Use Redis adapter for high-frequency prompts
|
586
|
+
- Enable database connection pooling
|
587
|
+
- Implement read replicas for heavy read workloads
|
588
|
+
|
589
|
+
---
|
590
|
+
|
591
|
+
**Congratulations!** You've successfully migrated to PromptManager v1.0.0. This stable release provides a solid foundation for scaling your prompt management needs.
|