PromptForge-CLI
Lightweight Terminal AI Prompt Engineering Workbench
PromptForge-CLI 是一款轻量级终端AI提示词工程工作台,专为开发者、Prompt工程师和AI研究者设计。它提供了一套完整的提示词模板管理、质量评估、语义搜索和版本控制工具链,全部在终端中完成,零外部依赖,安装即用。
无论你是在调试ChatGPT提示词、管理团队共享的Prompt模板库,还是进行A/B测试寻找最优提示词,PromptForge-CLI 都能成为你的得力助手。
核心亮点:纯Python 3.8+实现,无需安装任何第三方库,一条命令即可开始工作。
| 特性 | 描述 |
|---|---|
| 📝 模板管理 (CRUD) | 创建、查看、更新、删除提示词模板,支持分类标签体系 |
| 🎯 质量评分 | 6维度评估(清晰度、具体性、结构化、上下文、可执行性、变量化),S-F等级评定 |
| 🔍 TF-IDF语义搜索 | 关键词搜索 + 模糊匹配 + 高亮片段,快速定位目标模板 |
| 💉 变量注入 | {{variable}} 模板变量语法,运行时动态填充,支持交互式输入 |
| 📜 版本控制 | 完整的修改历史、版本对比diff、一键回滚到任意版本 |
| 📦 多格式导入导出 | 支持 JSON / Markdown / YAML 三种格式,自动检测格式 |
| 🧪 A/B测试记录 | 记录不同提示词变体的效果对比,数据驱动优化 |
| 🎨 彩色TUI | 进度条、表格、等级徽章、盒子渲染,终端体验优雅美观 |
| 🚀 5个内置示例模板 | 代码审查、技术博客、数据分析、API文档、会议摘要,开箱即用 |
# 通过 pip 安装(推荐)
pip install promptforge-cli# 1. 初始化示例模板
promptforge init
# 2. 查看所有模板
promptforge list
# 3. 查看模板详情(含质量评分)
promptforge show "Code Review Assistant"
# 4. 对一段提示词进行质量评分
promptforge score -c "你是一个AI助手,请帮我写一段代码"
# 5. 搜索模板
promptforge search "代码审查"
# 6. 注入变量并生成最终提示词
promptforge inject "Code Review Assistant" -v language=Python -v code="print('hello')"# 通过命令行参数创建
promptforge create -n "我的模板" -c "模板内容..." -t "标签1,标签2" --category "分类名"
# 通过文件创建(适合长内容)
promptforge create -n "长模板" -f ./template.txt --category "development"# 列出所有模板
promptforge list
# 按分类筛选
promptforge list --category development
# 按标签筛选
promptforge list --tag code-review
# 限制显示数量
promptforge list --limit 10# 通过ID查看
promptforge show abc123def456
# 通过名称查看(推荐)
promptforge show "Code Review Assistant"# 更新内容
promptforge update "我的模板" -c "新的模板内容..." --note "优化了输出格式"
# 更新标签和分类
promptforge update "我的模板" -t "新标签" --category "新分类"
# 通过文件更新
promptforge update "我的模板" -f ./updated.txt --note "从文件更新"# 交互式确认删除
promptforge delete "我的模板"
# 强制删除(跳过确认)
promptforge delete "我的模板" --forcePromptForge-CLI 采用6维度加权评分体系,对提示词质量进行全面评估:
| 维度 | 权重 | 说明 |
|---|---|---|
| 🗣️ 清晰度 (Clarity) | 20% | 是否使用了明确的指令动词 |
| 🎯 具体性 (Specificity) | 25% | 是否包含具体的数量、格式、示例要求 |
| 📐 结构化 (Structure) | 15% | 是否使用了Markdown标题、列表、代码块 |
| 🌐 上下文 (Context) | 15% | 是否定义了角色、受众、背景信息 |
| ⚡ 可执行性 (Actionability) | 15% | 是否明确了输出要求和质量标准 |
| 🔄 变量化 (Variables) | 10% | 是否使用了模板变量提高复用性 |
评分等级:
| 等级 | 分数范围 | 含义 |
|---|---|---|
| 🏆 S | 9.0 - 10.0 | 卓越 — 提示词质量极高 |
| 🥇 A | 8.0 - 8.9 | 优秀 — 高质量提示词 |
| 🥈 B | 7.0 - 7.9 | 良好 — 可用但可优化 |
| 🥉 C | 5.0 - 6.9 | 一般 — 需要改进 |
| 3.0 - 4.9 | 较差 — 存在明显问题 | |
| ❌ F | 0.0 - 2.9 | 不及格 — 需要重写 |
# 对文本内容评分
promptforge score -c "你是一个专业的Python开发者,请帮我审查以下代码,指出其中的安全漏洞和性能问题,并给出改进建议。"
# 对文件内容评分
promptforge score -f ./my_prompt.txt
# 输出JSON格式(方便程序处理)
promptforge score -c "提示词内容" --json# 直接对比
promptforge compare "提示词A的内容" "提示词B的内容"
# 通过文件对比
promptforge compare @prompt_a.txt @prompt_b.txt基于 TF-IDF算法 的全文搜索引擎,支持模糊匹配和关键词高亮:
# 关键词搜索
promptforge search "代码审查"
# 限制结果数量
promptforge search "数据分析" --limit 5模板中使用 {{variable}} 语法定义变量,运行时动态填充:
# 注入变量
promptforge inject "Code Review Assistant" -v language=Python -v code="def hello(): pass"
# 输出到文件
promptforge inject "Meeting Summary" -v project="Alpha" -v meeting_type="周会" -v date="2024-01-15" -o output.md
# 交互式填充缺失变量(未提供的变量会提示输入)
promptforge inject "Technical Blog Writer" -v topic="微服务架构"支持 JSON、Markdown、YAML 三种格式,自动检测导入格式:
# 导出为JSON
promptforge export "Code Review Assistant" --format json -o review.json
# 导出为Markdown
promptforge export "Code Review Assistant" --format markdown -o review.md
# 导出为YAML
promptforge export "Code Review Assistant" --format yaml -o review.yaml
# 导出所有模板
promptforge export --all --format json -o all_templates.json
# 导入模板(自动检测格式)
promptforge import ./template.json
# 指定格式导入
promptforge import ./template.md --format markdown每次修改模板内容都会自动创建版本快照,支持历史查看、版本对比和一键回滚:
# 查看版本历史
promptforge history "Code Review Assistant"
# 对比两个版本
promptforge diff "Code Review Assistant" 1 3
# 回滚到指定版本
promptforge rollback "Code Review Assistant" 2# 查看模板库统计
promptforge stats输出示例:
📊 PromptForge Statistics
Total Templates: 5
Total Versions: 7
Total Usage: 23
Categories: {'development': 3, 'writing': 1, 'data': 1}
Unique Tags: code-review, development, quality, writing, blog, ...
Store Path: ~/.promptforge/templates.json
- 零依赖原则:纯Python标准库实现,不引入任何第三方包,确保最大兼容性和最小安装体积
- 终端优先:所有操作在终端完成,彩色TUI输出,适合开发者的日常工作流
- 数据本地化:模板数据存储在
~/.promptforge/templates.json,完全离线可用,保护隐私 - 渐进式复杂度:简单操作一条命令完成,复杂功能通过参数组合实现
promptforge/
├── cli.py # CLI命令解析与路由
├── store.py # JSON存储引擎(CRUD + 版本控制)
├── scorer.py # 6维度质量评分引擎
├── search.py # TF-IDF语义搜索引擎
├── exporter.py # 多格式导入导出处理器
└── tui.py # 彩色终端UI渲染器
- v1.x — 当前版本:核心CRUD、评分、搜索、变量注入、版本控制、导入导出
- v2.0(规划中) — 云端同步、团队协作、Prompt链式编排、LLM集成自动评分
- v3.0(远期) — Web Dashboard、插件系统、Prompt市场、多语言优化建议
- Python 3.8 或更高版本
- 操作系统:Windows / macOS / Linux(跨平台)
- 网络:无需网络连接(离线可用)
# 从 PyPI 安装(推荐)
pip install promptforge-cli
# 从源码安装
git clone https://github.com/gitstq/PromptForge-CLI.git
cd PromptForge-CLI
pip install .模板数据默认存储在 ~/.promptforge/templates.json,可通过 --store 参数自定义路径:
promptforge --store /path/to/custom/store.json listpip uninstall promptforge-cli
# 如需删除数据文件
rm -rf ~/.promptforge我们欢迎并感谢所有形式的贡献!无论是提交Bug报告、改进文档,还是提交代码PR。
- Fork 本仓库
- 创建功能分支:
git checkout -b feature/your-feature - 提交更改:
git commit -m 'Add some feature' - 推送分支:
git push origin feature/your-feature - 提交 Pull Request
git clone https://github.com/gitstq/PromptForge-CLI.git
cd PromptForge-CLI
pip install -e .- 遵循 PEP 8 编码规范
- 所有公共方法需包含 docstring 文档
- 提交前请运行测试:
python -m pytest tests/
本项目基于 MIT License 开源。
MIT License
Copyright (c) 2024 PromptForge-CLI Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Built with ❤️ by the PromptForge-CLI community
PromptForge-CLI 是一款輕量級終端AI提示詞工程工作台,專為開發者、Prompt工程師和AI研究者設計。它提供了一套完整的提示詞模板管理、質量評估、語義搜尋和版本控制工具鏈,全部在終端中完成,零外部依賴,安裝即用。
無論你是在調試ChatGPT提示詞、管理團隊共享的Prompt模板庫,還是進行A/B測試尋找最優提示詞,PromptForge-CLI 都能成為你的得力助手。
核心亮點:純Python 3.8+實現,無需安裝任何第三方庫,一條命令即可開始工作。
| 特性 | 描述 |
|---|---|
| 📝 模板管理 (CRUD) | 建立、查看、更新、刪除提示詞模板,支援分類標籤體系 |
| 🎯 質量評分 | 6維度評估(清晰度、具體性、結構化、上下文、可執行性、變量化),S-F等級評定 |
| 🔍 TF-IDF語義搜尋 | 關鍵字搜尋 + 模糊匹配 + 高亮片段,快速定位目標模板 |
| 💉 變數注入 | {{variable}} 模板變數語法,執行時動態填充,支援互動式輸入 |
| 📜 版本控制 | 完整的修改歷史、版本對比diff、一鍵回滾到任意版本 |
| 📦 多格式匯入匯出 | 支援 JSON / Markdown / YAML 三種格式,自動偵測格式 |
| 🧪 A/B測試記錄 | 記錄不同提示詞變體的效果對比,數據驅動優化 |
| 🎨 彩色TUI | 進度條、表格、等級徽章、盒子渲染,終端體驗優雅美觀 |
| 🚀 5個內建範例模板 | 程式碼審查、技術部落格、資料分析、API文件、會議摘要,開箱即用 |
# 透過 pip 安裝(推薦)
pip install promptforge-cli# 1. 初始化範例模板
promptforge init
# 2. 查看所有模板
promptforge list
# 3. 查看模板詳情(含質量評分)
promptforge show "Code Review Assistant"
# 4. 對一段提示詞進行質量評分
promptforge score -c "你是一個AI助手,請幫我寫一段程式碼"
# 5. 搜尋模板
promptforge search "程式碼審查"
# 6. 注入變數並生成最終提示詞
promptforge inject "Code Review Assistant" -v language=Python -v code="print('hello')"# 透過命令列參數建立
promptforge create -n "我的模板" -c "模板內容..." -t "標籤1,標籤2" --category "分類名"
# 透過檔案建立(適合長內容)
promptforge create -n "長模板" -f ./template.txt --category "development"# 列出所有模板
promptforge list
# 按分類篩選
promptforge list --category development
# 按標籤篩選
promptforge list --tag code-review
# 限制顯示數量
promptforge list --limit 10# 透過ID查看
promptforge show abc123def456
# 透過名稱查看(推薦)
promptforge show "Code Review Assistant"# 更新內容
promptforge update "我的模板" -c "新的模板內容..." --note "優化了輸出格式"
# 更新標籤和分類
promptforge update "我的模板" -t "新標籤" --category "新分類"
# 透過檔案更新
promptforge update "我的模板" -f ./updated.txt --note "從檔案更新"# 互動式確認刪除
promptforge delete "我的模板"
# 強制刪除(跳過確認)
promptforge delete "我的模板" --forcePromptForge-CLI 採用6維度加權評分體系,對提示詞質量進行全面評估:
| 維度 | 權重 | 說明 |
|---|---|---|
| 🗣️ 清晰度 (Clarity) | 20% | 是否使用了明確的指令動詞 |
| 🎯 具體性 (Specificity) | 25% | 是否包含具體的數量、格式、範例要求 |
| 📐 結構化 (Structure) | 15% | 是否使用了Markdown標題、列表、程式碼區塊 |
| 🌐 上下文 (Context) | 15% | 是否定義了角色、受眾、背景資訊 |
| ⚡ 可執行性 (Actionability) | 15% | 是否明確了輸出要求和品質標準 |
| 🔄 變量化 (Variables) | 10% | 是否使用了模板變數提高復用性 |
評分等級:
| 等級 | 分數範圍 | 含義 |
|---|---|---|
| 🏆 S | 9.0 - 10.0 | 卓越 — 提示詞質量極高 |
| 🥇 A | 8.0 - 8.9 | 優秀 — 高品質提示詞 |
| 🥈 B | 7.0 - 7.9 | 良好 — 可用但可優化 |
| 🥉 C | 5.0 - 6.9 | 一般 — 需要改進 |
| 3.0 - 4.9 | 較差 — 存在明顯問題 | |
| ❌ F | 0.0 - 2.9 | 不及格 — 需要重寫 |
# 對文字內容評分
promptforge score -c "你是一個專業的Python開發者,請幫我審查以下程式碼,指出其中的安全漏洞和效能問題,並給出改進建議。"
# 對檔案內容評分
promptforge score -f ./my_prompt.txt
# 輸出JSON格式(方便程式處理)
promptforge score -c "提示詞內容" --json# 直接對比
promptforge compare "提示詞A的內容" "提示詞B的內容"
# 透過檔案對比
promptforge compare @prompt_a.txt @prompt_b.txt基於 TF-IDF演算法 的全文搜尋引擎,支援模糊匹配和關鍵字高亮:
# 關鍵字搜尋
promptforge search "程式碼審查"
# 限制結果數量
promptforge search "資料分析" --limit 5模板中使用 {{variable}} 語法定義變數,執行時動態填充:
# 注入變數
promptforge inject "Code Review Assistant" -v language=Python -v code="def hello(): pass"
# 輸出到檔案
promptforge inject "Meeting Summary" -v project="Alpha" -v meeting_type="週會" -v date="2024-01-15" -o output.md
# 互動式填充缺失變數(未提供的變數會提示輸入)
promptforge inject "Technical Blog Writer" -v topic="微服務架構"支援 JSON、Markdown、YAML 三種格式,自動偵測匯入格式:
# 匯出為JSON
promptforge export "Code Review Assistant" --format json -o review.json
# 匯出為Markdown
promptforge export "Code Review Assistant" --format markdown -o review.md
# 匯出為YAML
promptforge export "Code Review Assistant" --format yaml -o review.yaml
# 匯出所有模板
promptforge export --all --format json -o all_templates.json
# 匯入模板(自動偵測格式)
promptforge import ./template.json
# 指定格式匯入
promptforge import ./template.md --format markdown每次修改模板內容都會自動建立版本快照,支援歷史查看、版本對比和一鍵回滾:
# 查看版本歷史
promptforge history "Code Review Assistant"
# 對比兩個版本
promptforge diff "Code Review Assistant" 1 3
# 回滾到指定版本
promptforge rollback "Code Review Assistant" 2# 查看模板庫統計
promptforge stats輸出範例:
📊 PromptForge Statistics
Total Templates: 5
Total Versions: 7
Total Usage: 23
Categories: {'development': 3, 'writing': 1, 'data': 1}
Unique Tags: code-review, development, quality, writing, blog, ...
Store Path: ~/.promptforge/templates.json
- 零依賴原則:純Python標準庫實現,不引入任何第三方套件,確保最大相容性和最小安裝體積
- 終端優先:所有操作在終端完成,彩色TUI輸出,適合開發者的日常工作流
- 資料本地化:模板資料儲存在
~/.promptforge/templates.json,完全離線可用,保護隱私 - 漸進式複雜度:簡單操作一條命令完成,複雜功能透過參數組合實現
promptforge/
├── cli.py # CLI命令解析與路由
├── store.py # JSON儲存引擎(CRUD + 版本控制)
├── scorer.py # 6維度質量評分引擎
├── search.py # TF-IDF語義搜尋引擎
├── exporter.py # 多格式匯入匯出處理器
└── tui.py # 彩色終端UI渲染器
- v1.x — 目前版本:核心CRUD、評分、搜尋、變數注入、版本控制、匯入匯出
- v2.0(規劃中) — 雲端同步、團隊協作、Prompt鏈式編排、LLM整合自動評分
- v3.0(遠期) — Web Dashboard、外掛系統、Prompt市場、多語言優化建議
- Python 3.8 或更高版本
- 作業系統:Windows / macOS / Linux(跨平台)
- 網路:無需網路連線(離線可用)
# 從 PyPI 安裝(推薦)
pip install promptforge-cli
# 從原始碼安裝
git clone https://github.com/gitstq/PromptForge-CLI.git
cd PromptForge-CLI
pip install .模板資料預設儲存在 ~/.promptforge/templates.json,可透過 --store 參數自訂路徑:
promptforge --store /path/to/custom/store.json listpip uninstall promptforge-cli
# 如需刪除資料檔案
rm -rf ~/.promptforge我們歡迎並感謝所有形式的貢獻!無論是提交Bug報告、改進文件,還是提交程式碼PR。
- Fork 本倉庫
- 建立功能分支:
git checkout -b feature/your-feature - 提交變更:
git commit -m 'Add some feature' - 推送分支:
git push origin feature/your-feature - 提交 Pull Request
git clone https://github.com/gitstq/PromptForge-CLI.git
cd PromptForge-CLI
pip install -e .- 遵循 PEP 8 編碼規範
- 所有公共方法需包含 docstring 文件
- 提交前請執行測試:
python -m pytest tests/
本專案基於 MIT License 開源。
MIT License
Copyright (c) 2024 PromptForge-CLI Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Built with ❤️ by the PromptForge-CLI community
PromptForge-CLI is a Lightweight Terminal AI Prompt Engineering Workbench designed for developers, prompt engineers, and AI researchers. It provides a complete toolkit for prompt template management, quality assessment, semantic search, and version control — all within your terminal, with zero external dependencies and instant usability.
Whether you're debugging ChatGPT prompts, managing a team-shared prompt template library, or running A/B tests to find the optimal prompt, PromptForge-CLI is your trusted companion.
Key Highlight: Built with pure Python 3.8+, no third-party packages required. Get started with a single command.
| Feature | Description |
|---|---|
| 📝 Template Management (CRUD) | Create, view, update, and delete prompt templates with category & tag support |
| 🎯 Quality Scoring | 6-dimension evaluation (Clarity, Specificity, Structure, Context, Actionability, Variables) with S-F grading |
| 🔍 TF-IDF Semantic Search | Keyword search + fuzzy matching + highlighted snippets for rapid template discovery |
| 💉 Variable Injection | {{variable}} template syntax with runtime dynamic filling and interactive input |
| 📜 Version Control | Full change history, version diff comparison, and one-click rollback |
| 📦 Multi-format Import/Export | Supports JSON / Markdown / YAML with automatic format detection |
| 🧪 A/B Test Records | Log and compare effectiveness of different prompt variants, data-driven optimization |
| 🎨 Colorful TUI | Progress bars, tables, grade badges, and box rendering for an elegant terminal experience |
| 🚀 5 Built-in Sample Templates | Code Review, Technical Blog, Data Analysis, API Documentation, Meeting Summary — ready to use |
# Install via pip (recommended)
pip install promptforge-cli# 1. Initialize with sample templates
promptforge init
# 2. List all templates
promptforge list
# 3. View template details (with quality score)
promptforge show "Code Review Assistant"
# 4. Score a prompt
promptforge score -c "You are an AI assistant, please help me write some code"
# 5. Search templates
promptforge search "code review"
# 6. Inject variables and generate the final prompt
promptforge inject "Code Review Assistant" -v language=Python -v code="print('hello')"# Create via command-line arguments
promptforge create -n "My Template" -c "Template content..." -t "tag1,tag2" --category "category_name"
# Create from file (for long content)
promptforge create -n "Long Template" -f ./template.txt --category "development"# List all templates
promptforge list
# Filter by category
promptforge list --category development
# Filter by tag
promptforge list --tag code-review
# Limit results
promptforge list --limit 10# View by ID
promptforge show abc123def456
# View by name (recommended)
promptforge show "Code Review Assistant"# Update content
promptforge update "My Template" -c "New template content..." --note "Optimized output format"
# Update tags and category
promptforge update "My Template" -t "new-tag" --category "new-category"
# Update from file
promptforge update "My Template" -f ./updated.txt --note "Updated from file"# Interactive confirmation
promptforge delete "My Template"
# Force delete (skip confirmation)
promptforge delete "My Template" --forcePromptForge-CLI uses a 6-dimension weighted scoring system for comprehensive prompt quality evaluation:
| Dimension | Weight | Description |
|---|---|---|
| 🗣️ Clarity | 20% | Whether clear directive verbs are used |
| 🎯 Specificity | 25% | Whether specific quantities, formats, and example requirements are included |
| 📐 Structure | 15% | Whether Markdown headers, lists, and code blocks are used |
| 🌐 Context | 15% | Whether roles, audience, and background information are defined |
| ⚡ Actionability | 15% | Whether output requirements and quality standards are clearly specified |
| 🔄 Variables | 10% | Whether template variables are used for reusability |
Grading Scale:
| Grade | Score Range | Meaning |
|---|---|---|
| 🏆 S | 9.0 - 10.0 | Exceptional — Extremely high quality prompt |
| 🥇 A | 8.0 - 8.9 | Excellent — High quality prompt |
| 🥈 B | 7.0 - 7.9 | Good — Usable but can be improved |
| 🥉 C | 5.0 - 6.9 | Fair — Needs improvement |
| 3.0 - 4.9 | Poor — Has obvious issues | |
| ❌ F | 0.0 - 2.9 | Failing — Needs to be rewritten |
# Score text content
promptforge score -c "You are a professional Python developer. Please review the following code, identify security vulnerabilities and performance issues, and provide improvement suggestions."
# Score from file
promptforge score -f ./my_prompt.txt
# Output as JSON (for programmatic processing)
promptforge score -c "Your prompt content" --json# Direct comparison
promptforge compare "Content of prompt A" "Content of prompt B"
# Compare from files
promptforge compare @prompt_a.txt @prompt_b.txtPowered by a TF-IDF algorithm full-text search engine with fuzzy matching and keyword highlighting:
# Keyword search
promptforge search "code review"
# Limit results
promptforge search "data analysis" --limit 5Templates use {{variable}} syntax to define variables, filled dynamically at runtime:
# Inject variables
promptforge inject "Code Review Assistant" -v language=Python -v code="def hello(): pass"
# Output to file
promptforge inject "Meeting Summary" -v project="Alpha" -v meeting_type="Weekly" -v date="2024-01-15" -o output.md
# Interactive filling for missing variables (unprovided variables will prompt for input)
promptforge inject "Technical Blog Writer" -v topic="microservices architecture"Supports JSON, Markdown, and YAML formats with automatic format detection on import:
# Export as JSON
promptforge export "Code Review Assistant" --format json -o review.json
# Export as Markdown
promptforge export "Code Review Assistant" --format markdown -o review.md
# Export as YAML
promptforge export "Code Review Assistant" --format yaml -o review.yaml
# Export all templates
promptforge export --all --format json -o all_templates.json
# Import template (auto-detect format)
promptforge import ./template.json
# Import with specified format
promptforge import ./template.md --format markdownEvery content modification automatically creates a version snapshot, supporting history viewing, version diffing, and one-click rollback:
# View version history
promptforge history "Code Review Assistant"
# Compare two versions
promptforge diff "Code Review Assistant" 1 3
# Rollback to a specific version
promptforge rollback "Code Review Assistant" 2# View template store statistics
promptforge statsExample output:
📊 PromptForge Statistics
Total Templates: 5
Total Versions: 7
Total Usage: 23
Categories: {'development': 3, 'writing': 1, 'data': 1}
Unique Tags: code-review, development, quality, writing, blog, ...
Store Path: ~/.promptforge/templates.json
- Zero Dependency Principle: Pure Python standard library implementation with no third-party packages, ensuring maximum compatibility and minimal installation footprint
- Terminal-First: All operations completed in the terminal with colorful TUI output, fitting naturally into developer workflows
- Local Data: Template data stored in
~/.promptforge/templates.json, fully offline-capable, protecting your privacy - Progressive Complexity: Simple tasks with a single command, advanced features through parameter combinations
promptforge/
├── cli.py # CLI command parsing and routing
├── store.py # JSON storage engine (CRUD + version control)
├── scorer.py # 6-dimension quality scoring engine
├── search.py # TF-IDF semantic search engine
├── exporter.py # Multi-format import/export handler
└── tui.py # Colorful terminal UI renderer
- v1.x — Current: Core CRUD, scoring, search, variable injection, version control, import/export
- v2.0 (Planned) — Cloud sync, team collaboration, prompt chain orchestration, LLM-integrated auto-scoring
- v3.0 (Long-term) — Web Dashboard, plugin system, prompt marketplace, multilingual optimization suggestions
- Python 3.8 or higher
- Operating System: Windows / macOS / Linux (cross-platform)
- Network: No internet connection required (fully offline)
# Install from PyPI (recommended)
pip install promptforge-cli
# Install from source
git clone https://github.com/gitstq/PromptForge-CLI.git
cd PromptForge-CLI
pip install .Template data is stored by default at ~/.promptforge/templates.json. Customize the path with the --store parameter:
promptforge --store /path/to/custom/store.json listpip uninstall promptforge-cli
# Optionally remove data files
rm -rf ~/.promptforgeWe welcome and appreciate contributions of all kinds! Whether it's filing bug reports, improving documentation, or submitting code PRs.
- Fork this repository
- Create a feature branch:
git checkout -b feature/your-feature - Commit your changes:
git commit -m 'Add some feature' - Push the branch:
git push origin feature/your-feature - Submit a Pull Request
git clone https://github.com/gitstq/PromptForge-CLI.git
cd PromptForge-CLI
pip install -e .- Follow PEP 8 coding conventions
- All public methods must include docstring documentation
- Run tests before submitting:
python -m pytest tests/
This project is licensed under the MIT License.
MIT License
Copyright (c) 2024 PromptForge-CLI Contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Built with ❤️ by the PromptForge-CLI community