promptpro 0.1.1

PromptPro is an advanced prompt management system with versioning, tagging, encryption, and TUI interface. The ultimate tool for prompt engineers and AI developers.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
# PromptPro๐Ÿš€: Advanced Prompt Manage and Versioning System

![](./assets/image.png)


**Promptpro** is a powerful, flexible, and developer-friendly prompt management system that transforms how you create, manage, and version AI prompts. Designed for prompt engineers, AI developers, and serious AI enthusiasts, it combines speed, security, and usability in one elegant tool.

With built-in versioning, tagging, encryption, and a sleek TUI interface, Promptpro eliminates the chaos of multi-file JSON/YAML management across projects. Reference prompts with a unique key, and every change is automatically trackedโ€”no manual versioning required.

Under the hood, Promptpro is powered by Rust ๐Ÿฆ€, giving you lightning-fast performance while maintaining seamless Python integration. It supports both Python and Rust out of the box, so you can use your prompts in **any language, any project, anywhere.**

```py
pip install promptpro
```

then,

Your chaos prompt can be easily use like this (note, any project, any language):

```py
from promptpro import PromptManager

pm = PromptManager("promptpro.vault", "")
a = pm.get_prompt("pc_operator_v2", "dev")
print(a)
```

That's all! You got speed and security, also fastest prompt development.


## โœจ Key Features

- ๐Ÿ” **Secure Vault**: Optional password-encrypted vault dumps for sensitive prompt data
- ๐Ÿ“ฆ **Complete Backup**: Full vault export/import functionality with binary format
- ๐Ÿ”„ **Automatic Versioning**: Every prompt change is automatically versioned
- ๐Ÿท๏ธ **Smart Tagging**: Tag versions with "dev", "stable", "release", and custom tags
- ๐Ÿ’ป **Beautiful TUI**: Intuitive terminal user interface for easy navigation
- ๐Ÿ“ **Rich History**: Track all changes with timestamps and optional messages
- โšก **Blazing Fast Performance**: Optimized storage with efficient retrieval (powered by Rust)
- ๐Ÿ› ๏ธ **Developer Friendly**: Comprehensive CLI and library API

## ๐Ÿš€ Quick Start

### Installation

Python:

```shell
pip install promptpro
```

Rust:

```shell
cargo install promptpro
```

Install from source:

```bash
# Clone the repository
git clone https://github.com/lucasjinreal/promptpro
cd promptpro

./install.sh
```

### Basic Usage

`ppro` is the short form of `promptpro`. after `install.sh` it will available in your path.

```bash
# Add a new prompt
echo "Write a poem about technology" | ppro add

# Add with a key
ppro add "You are a helpful AI assistant"

# Update an existing prompt
ppro update my-prompt "You are a super helpful AI assistant"

# Get the latest version
ppro get my-prompt

# Get a specific version or tag
ppro get my-prompt 2
ppro get my-prompt stable

# Tag a version
ppro tag my-prompt stable 1

# Show history
ppro history my-prompt

# Open the TUI interface
ppro tui
```

## ๐Ÿ“ฆ Backup & Restore

### Export Your Vault

```bash
# Export without encryption (unencrypted binary)
ppro dump prompts.vault

# Export with password encryption
ppro dump prompts.vault --password "your-secret-password"
```

### Import Your Vault

```bash
# Import unencrypted vault
ppro resume prompts.vault

# Import encrypted vault
ppro resume prompts.vault --password "your-secret-password"
```

## ๐ŸŽฎ TUI Interface

Navigate your prompts with the intuitive terminal interface:

- **Arrow Keys / hjkl**: Navigate between panels and items
- **โ† โ†’**: Switch between the 4 columns (Keys, Versions, Content, Tags)
- **Enter / x**: Apply or toggle tags on selected versions
- **e**: Edit content in the current panel
- **o**: Open external editor (like vim, nano)
- **q**: Quit the application
- **Ctrl+S**: Save when in edit mode

## ๐Ÿ”ง Advanced CLI Commands

### Tag Management

```bash
# Tag a specific version
ppro tag my-prompt stable 1

# Promote a tag to the latest version
ppro promote my-prompt stable

# The 'dev' tag is automatically promoted to latest version on updates
```

### History & Retrieval

```bash
# Show full history for a prompt
ppro history my-prompt

# Get prompt to a file
ppro get my-prompt --output my-file.txt

# Get specific version
ppro get my-prompt 3

# Get by tag
ppro get my-prompt stable
```

## ๐Ÿ› ๏ธ Programmatic API Usage

ppro can be easily integrated into both Rust and Python applications.

### Rust API

#### Add to Cargo.toml

```toml
[dependencies]
promptpro = { path = "path/to/promptpro" }  # or git source
```

#### Basic Rust API Example

High level, write a PromptManager singleton:

```rust
use anyhow::Result;
use once_cell::sync::Lazy;
use promptpro::{PromptVault, VersionSelector};
use std::sync::Arc;
use tokio::sync::RwLock;

// Our global PromptManager singleton
pub struct PromptManager {
    vault: Arc<RwLock<PromptVault>>,
}

// Static global instance
static MANAGER: Lazy<PromptManager> = Lazy::new(|| {
    let vault = PromptVault::restore_or_default("./promptpro.vault", None)
        .expect("Failed to open PromptPro default vault");
    PromptManager {
        vault: Arc::new(RwLock::new(vault)),
    }
});

impl PromptManager {
    pub fn get() -> &'static Self {
        &MANAGER
    }

    pub async fn get_prompt(&self, key: &str, selector: VersionSelector<'_>) -> Result<String> {
        let vault = self.vault.read().await;
        Ok(vault.get(key, selector)?)
    }

    pub async fn latest(&self, key: &str) -> Result<String> {
        self.get_prompt(key, VersionSelector::Latest).await
    }
}

// Use

let pm = PromptManager::get();
let prompt = pm
    .get_prompt("pc_operator_v2", VersionSelector::Tag("dev"))
    .await
    .map_err(|e| AgentBuildError::PromptError(e.to_string()))?;
```

Low level API:

```rust
use ppro::{PromptVault, VersionSelector};

// Open the default vault
let vault = PromptVault::open_default()?;

// Add a new prompt
vault.add("greeting", "Hello, World!")?;

// Update an existing prompt
vault.update("greeting", "Hi there!", Some("Updated greeting".to_string()))?;

// Get latest version
let content = vault.get("greeting", VersionSelector::Latest)?;

// Tag a version
vault.tag("greeting", "stable", 1)?;

// Get by tag
let stable_content = vault.get("greeting", VersionSelector::Tag("stable"))?;

// Get history
let history = vault.history("greeting")?;
```

#### Backup & Restore API (Rust)

```rust
use ppro::PromptVault;

// Dump vault to binary file (with optional encryption)
let vault = PromptVault::open_default()?;
vault.dump("backup.vault", Some("my_password"))?;

// Or without encryption
vault.dump("backup.vault", None)?;

// Restore from binary file
let restored_vault = PromptVault::restore("backup.vault", Some("my_password"))?;
```

#### Complete Rust Example Program

```rust
use ppro::{PromptVault, VersionSelector};
use anyhow::Result;

#[tokio::main]
async fn main() -> Result<()> {
    let vault = PromptVault::open_default()?;

    // Add a prompt
    vault.add("summarization", "Summarize the following text concisely...")?;
    
    // Update with improvements
    vault.update("summarization", 
        "Provide a concise summary of the following text. Focus on key points and maintain context.",
        Some("Improved summarization prompt".to_string()))?;
    
    // Tag as stable
    vault.tag("summarization", "stable", 1)?;
    
    // Get the latest version
    let latest = vault.get("summarization", VersionSelector::Latest)?;
    println!("Latest prompt: {}", latest);
    
    // Get the stable version
    let stable = vault.get("summarization", VersionSelector::Tag("stable"))?;
    println!("Stable prompt: {}", stable);
    
    // Show history
    let history = vault.history("summarization")?;
    for version in history {
        println!("Version {}: ({}) {:?}",
            version.version, 
            version.timestamp.format("%Y-%m-%d %H:%M"),
            version.tags
        );
    }

    // Backup the vault
    vault.dump("backup.vault", Some("secure_password"))?;
    println!("Vault backed up successfully!");
    
    Ok(())
}
```

## ๐Ÿ Python Bindings

ppro also provides Python bindings built with PyO3, making it easy to integrate prompt management into Python applications.

### Installation

The Python package can be built and installed using Maturin:

```bash
pip install promptpro
```

Or if building from source:

```bash
cd promptpro
maturin build --features python
pip install target/wheels/promptpro-*.whl
```

### Basic Python Usage

```python
from promptpro import PromptManager

pm = PromptManager.get_singleton("promptpro.vault", "")
a = pm.get_prompt("pc_operator_v2", "dev")
print(a)
```


## ๐ŸŽฏ Why Choose ppro?

### For Prompt Engineers

- **Version Control**: Track every iteration of your prompts
- **A/B Testing**: Maintain multiple versions and compare effectiveness
- **Rollback Capability**: Instantly return to previous versions
- **Tag Management**: Organize prompts by stability, project, or context

### For AI Developers

- **API Integration**: Easy programmatic access to your prompts
- **Environment Management**: Different tags for dev/staging/prod
- **Team Collaboration**: Share and sync prompt collections
- **Performance**: Fast retrieval and minimal overhead

### For Security-Conscious Teams

- **Encryption**: Optional password protection for sensitive prompts
- **Binary Format**: Secure, tamper-resistant backup format
- **Local Storage**: Full control over your prompt data
- **Audit Trail**: Complete history with timestamps

## ๐Ÿท๏ธ Tagging System

### Special Tags

- **`dev`**: Automatically points to the latest version on updates
- **`stable`**: Manually set for production-ready versions  
- **`release`**: For major releases or milestones

### Custom Tags

You can create any custom tag names to organize your prompts:

```bash
# Create custom tags
ppro tag my-prompt experimental 2
ppro tag my-prompt production-ready 3
ppro tag my-prompt "v2.0" 4
```

## ๐Ÿ“Š Use Cases

### AI Model Development

- Track prompt evolution during model training
- A/B test different prompt variations
- Maintain production vs. experimental prompts

### Content Generation

- Template management for marketing campaigns
- Document generation prompts
- Personalized content creation

### Research & Experimentation  

- Maintain experiment logs with associated prompts
- Compare prompt effectiveness across models
- Share prompts within research teams

## ๐Ÿค Contributing

We welcome contributions! Feel free to:

- ๐Ÿ› Report bugs and issues
- ๐Ÿ’ก Suggest new features
- ๐Ÿ”ง Submit pull requests
- ๐Ÿ“– Improve documentation

## ๐Ÿ“„ License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).

**GPL-3.0 License**:

- You can **freely** use, study, share, and modify this software
- You must **distribute** source code when sharing
- You must **license** derivative works under the same terms
- You must **preserve** the original copyright notice and license

For more details, see the [LICENSE](./LICENSE) file.

---

**ppro** - Taking prompt management to the next level! ๐Ÿš€

Made with โค๏ธ for the AI development community.