Skip to content

Commit 8357b67

Browse files
committed
✨ feat(cli): Add command-line interface (#15)
1 parent 68aff83 commit 8357b67

File tree

79 files changed

+5882
-1515
lines changed

Some content is hidden

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

79 files changed

+5882
-1515
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
ANTHROPIC_API_KEY=your_api_key_here
22
FORCE_REGENERATE=false
3-
LOG_LEVEL=debug
3+
LOG_LEVEL=debug
4+
CLI_ENV=local

.github/workflows/update_views.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ on:
66
- ".github/workflows/**/*.yml"
77
- "prompts/**/*.md"
88
- "prompts/prompt.md"
9-
- "src/**/*.ts"
10-
- "src/system_prompts/**/*.md"
11-
- "src/templates/*.md"
9+
- "src/app/**/*.ts"
10+
- "src/app/system_prompts/**/*.md"
11+
- "src/app/templates/*.md"
1212

1313
jobs:
1414
update_views:
@@ -20,7 +20,7 @@ jobs:
2020

2121
- name: Validate critical files
2222
run: |
23-
if [ ! -f "src/system_prompts/prompt_analysis_agent/prompt.md" ]; then
23+
if [ ! -f "src/app/system_prompts/prompt_analysis_agent/prompt.md" ]; then
2424
echo "Error: AI prompt analyzer file is missing"
2525
exit 1
2626
fi
@@ -58,7 +58,7 @@ jobs:
5858
- name: Check for system prompt changes
5959
id: check_changes
6060
run: |
61-
if git diff --name-only HEAD^ HEAD | grep -q "src/system_prompts/prompt_analysis_agent/"; then
61+
if git diff --name-only HEAD^ HEAD | grep -q "src/app/system_prompts/prompt_analysis_agent/"; then
6262
echo "FORCE_REGENERATE=true" >> $GITHUB_ENV
6363
else
6464
echo "FORCE_REGENERATE=false" >> $GITHUB_ENV
@@ -68,6 +68,7 @@ jobs:
6868
env:
6969
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
7070
FORCE_REGENERATE: ${{ env.FORCE_REGENERATE }}
71+
CLI_ENV: github_actions
7172
run: npm run generate-metadata
7273

7374
- name: Update views

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ dist/
66
node_modules/
77
archive/
88

9+
# Ignore local database
10+
*.sqlite
11+
912
# Ignore local temporary files
1013
z_diff_output.txt
1114
z_dir2prompt_output.txt

.promptignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ package-lock.json
1515
dist/
1616
node_modules/
1717
archive/
18-
fragments/
19-
prompts/
2018

2119
# Ignore local temporary files
2220
z_diff_output.txt

README.md

Lines changed: 156 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -2,159 +2,225 @@
22

33
> 🚧 **Project Under Development** - Evolving project, expect changes. Feedback welcome!
44
5-
Welcome to the **Prompt Library**, a collection of categorized AI prompts for easy navigation and reuse. Fork and customize this repository to build your own personalized prompt library tailored to your needs.
5+
Welcome to the **Prompt Library**, a collection of categorized AI prompts for easy navigation and reuse. This project combines GitHub Actions automation with a CLI for managing and using prompts, supporting both CI environments and desktop usage.
66

77
## 📚 Table of Contents
88

9-
<!-- START doctoc -->
10-
<!-- END doctoc -->
9+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
10+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
1111

12-
## 🎯 Purpose
12+
- [🎯 Purpose & Features](#-purpose--features)
13+
- [⚡ Quick Start](#-quick-start)
14+
- [🛠️ How It Works](#-how-it-works)
15+
- [🖥️ CLI Usage](#-cli-usage)
16+
- [Interactive Menu](#interactive-menu)
17+
- [List Prompts and Categories](#list-prompts-and-categories)
18+
- [Sync Personal Library](#sync-personal-library)
19+
- [Execute Prompts](#execute-prompts)
20+
- [📂 Prompt Library Example](#-prompt-library-example)
21+
- [🚀 Getting Started](#-getting-started)
22+
- [🧩 Using Fragments](#-using-fragments)
23+
- [⚙️ Metadata Customization](#-metadata-customization)
24+
- [🤝 Contributing](#-contributing)
25+
- [📄 License](#-license)
1326

14-
This project provides a structured framework for organizing and managing AI prompts, helping you to:
27+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
1528

16-
1. Store and categorize your prompts efficiently
17-
2. Automatically generate metadata for your prompts
18-
3. Easily navigate and reuse your prompt collection
19-
4. Collaborate and share prompts with others
20-
5. Create modular and reusable prompt components using fragments
29+
## 🎯 Purpose & Features
30+
31+
The Prompt Library treats AI prompts as mini-applications that instruct AI models to become specialized agents. This approach promotes modularity, reusability, and shareability across projects and teams. In the rapidly evolving AI landscape, maintaining a library of prompts and agent definitions is increasingly valuable for both individuals and organizations.
32+
33+
Key features include:
34+
35+
- Prompt storage and categorization
36+
- Automatic metadata generation
37+
- Easy navigation and reuse of prompts
38+
- Collaboration and sharing capabilities
39+
- Modular prompt components (fragments)
40+
- CLI for prompt management and execution
41+
- GitHub Actions for automation
42+
43+
> **Note**: Currently, this tool works exclusively with Claude from Anthropic. Support for additional AI models may be added in future updates.
44+
45+
This project serves as a starting point for creating your own AI toolkit, demonstrating one way to manage and utilize AI prompts and agent definitions in personal and professional contexts.
46+
47+
## ⚡ Quick Start
48+
49+
1. Fork and clone the repository
50+
2. Set up Anthropic API key (GitHub Actions and CLI)
51+
3. Install dependencies: `npm install`
52+
4. Build and install CLI: `npm run build && npm install -g .`
53+
5. Initialize CLI: `prompt-library-cli`
54+
55+
Detailed setup instructions in [Getting Started](#-getting-started).
2156

2257
## 🛠️ How It Works
2358

24-
1. **Add Prompts**: Create a `prompt.md` file in the `prompts` directory.
25-
2. **Commit Changes**: Push your changes to the repository.
26-
3. **Automation**: GitHub Actions generate metadata and update README files.
27-
4. **Update Repository**: Changes are automatically committed back.
59+
1. Create a `prompt.md` file in `prompts` directory
60+
2. Commit and push changes
61+
3. GitHub Actions generate metadata and update READMEs
62+
4. Use CLI to manage and execute prompts
2863

29-
## 📂 Prompt Library Example
64+
> **Important**: Create and commit `prompt.md` files individually to allow GitHub Actions to generate corresponding `metadata.yml` files. Both files are required for CLI prompt usage.
65+
66+
## 🖥️ CLI Usage
67+
68+
### Interactive Menu
69+
70+
```sh
71+
prompt-library-cli
72+
```
73+
74+
For all CLI options, run:
75+
76+
```sh
77+
prompt-library-cli --help
78+
```
79+
80+
### List Prompts and Categories
81+
82+
```sh
83+
prompt-library-cli prompts --list
84+
prompt-library-cli prompts --categories
85+
```
86+
87+
### Sync Personal Library
88+
89+
```sh
90+
prompt-library-cli sync
91+
```
92+
93+
> **Note**: Sync currently operates in read-only mode, fetching updates from the remote Git repository without pushing local changes.
94+
95+
### Execute Prompts
96+
97+
The `execute` command is a powerful tool for running prompts, especially useful in CI environments:
98+
99+
```sh
100+
prompt-library-cli execute [options]
101+
```
102+
103+
Key options:
104+
105+
- `-p, --prompt <id>`: Execute a stored prompt by ID
106+
- `-i, --inspect`: Inspect the prompt variables without executing
107+
- `-fi, --file-input <variable>=<file>`: Specify a file to use as input for a variable
108+
- `-c, --ci`: Run in CI mode (non-interactive)
109+
110+
In CI mode, the `execute` command acts as a dynamic CLI, allowing you to pass prompt variables as command-line arguments:
30111

31-
> **Note:** The prompts listed here are examples to demonstrate structure and organization. Customize and maintain your own prompts as needed.
112+
```sh
113+
prompt-library-cli execute -p <prompt_id> --<variable1> <value1> --<variable2> <value2> -c
114+
```
32115

116+
For detailed usage, run:
117+
118+
```sh
119+
prompt-library-cli execute --help
120+
```
121+
122+
## 📂 Prompt Library Example
123+
124+
> **Note:** The prompts listed here are examples. Customize and maintain your own prompts as needed.
33125
> **Tip:** Check out the Prompt Engineering category for prompts to help you create high-quality prompts and build your own library.
34-
<details open>
126+
<details>
35127
<summary><strong>Coding</strong></summary>
36128
37-
- [Git Branch Name Generator](prompts/git_branch_name_generator/README.md) - Generates optimized git branch names based on project context and best practices
38-
- [Git Commit Message Creator](prompts/git_commit_message_agent/README.md) - Generates optimized git commit messages following Conventional Commits specification
39129
- [GitHub Issue Creator Agent](prompts/github_issue_creator_agent/README.md) - Creates comprehensive and actionable GitHub issues based on provided project information
130+
- [Git Commit Message Creator](prompts/git_commit_message_agent/README.md) - Generates optimized git commit messages following Conventional Commits specification
40131
- [Software Architect Code Reviewer](prompts/software_architect_code_reviewer/README.md) - Generates comprehensive pull requests with architectural analysis and optimization suggestions
132+
- [Git Branch Name Generator](prompts/git_branch_name_generator/README.md) - Generates optimized git branch names based on project context and best practices
41133
- [Software Development Expert Agent](prompts/software_development_agent/README.md) - Provides expert assistance across the software development lifecycle
42134

43135
</details>
44-
<details open>
136+
<details>
45137
<summary><strong>Content Creation</strong></summary>
46138

47139
- [Documentation Specialist Agent](prompts/documentation_specialist_agent/README.md) - Generates revolutionary software documentation using AI-powered techniques and industry expertise
48140

49141
</details>
50-
<details open>
142+
<details>
51143
<summary><strong>Healthcare</strong></summary>
52144

53145
- [Health Optimization Agent](prompts/health_optimization_agent/README.md) - Generates personalized, adaptive health optimization plans based on comprehensive user data analysis
54146
- [Psychological Support Therapy Agent](prompts/psychological_support_agent/README.md) - Provides personalized, AI-driven psychological support and therapy through digital platforms
55147

56148
</details>
57-
<details open>
149+
<details>
58150
<summary><strong>Problem Solving</strong></summary>
59151

60152
- [Problem Solving Assistant](prompts/problem_solving_agent/README.md) - Generates expert networks and strategies to solve complex problems and achieve goals
61153

62154
</details>
63-
<details open>
155+
<details>
64156
<summary><strong>Prompt Engineering</strong></summary>
65157

66-
- [Prompt Engineering God](prompts/prompt_engineering_agent/README.md) - Creates or refines optimized prompts to maximize AI potential within ethical boundaries
67158
- [AI Assistant Concept Architect](prompts/ai_assistant_concept_architect/README.md) - Generates innovative and feasible AI assistant concepts based on user-provided topics
68-
- [Software Engineering Architect Agent](prompts/software_engineering_architect/README.md) - Generates comprehensive software specification documents with futuristic insights
159+
- [Prompt Engineering God](prompts/prompt_engineering_agent/README.md) - Creates or refines optimized prompts to maximize AI potential within ethical boundaries
160+
- [Software Specification Architect](prompts/software_spec_architect_agent/README.md) - Analyzes user requirements and creates comprehensive software specification documents
69161

70162
</details>
71-
<details open>
163+
<details>
72164
<summary><strong>Translation</strong></summary>
73165

74-
- [Omniscient Cosmic Translator](prompts/cosmic_translator_agent/README.md) - Translates between all forms of expression and existence across infinite realities
166+
- [Universal Translator Agent](prompts/universal_translator_agent/README.md) - Translates between any languages, modes of expression, or conceptual frameworks
75167

76168
</details>
77169

78170
## 🚀 Getting Started
79171

80172
1. **Fork the Repository**: Click "Fork" to create a copy in your GitHub account.
173+
81174
2. **Clone Your Fork**:
82-
```
175+
176+
```sh
83177
git clone https://github.com/YOUR_USERNAME/REPO_NAME.git
84178
```
179+
85180
3. **Set Up Anthropic API Key**:
86-
- Create an Anthropic account and generate an API key at the [Anthropic Console](https://console.anthropic.com/).
87-
- In repository settings: **Secrets and variables** > **Actions**.
88-
- Create a secret named `ANTHROPIC_API_KEY` with your API key.
181+
- Generate an API key at the [Anthropic Console](https://console.anthropic.com/).
182+
- For GitHub Actions: Add as `ANTHROPIC_API_KEY` secret in repository settings.
183+
- For CLI: Enter when prompted or set as environment variable.
184+
89185
4. **Install Dependencies**:
90-
- Ensure [Node.js](https://nodejs.org/en) (v22+ recommended) is installed.
91-
- Run `npm install`.
92-
5. **Add Prompts**:
93-
- Create a `prompt.md` file in the `prompts` directory.
94-
- Write your prompt content.
95-
- Commit and push:
96-
```
97-
git add .
98-
git commit -m "Add new prompt: [Brief Description]"
99-
git push
100-
```
101-
6. **Automated Processes**: GitHub Actions will generate metadata and update README files.
102-
7. **Run Locally (Optional)**:
103-
- Copy `.env.example` to `.env`:
104-
```
105-
cp .env.example .env
106-
```
107-
- Update `.env` with your API key.
108-
- Generate metadata:
109-
```
110-
npm run generate-metadata
111-
```
112-
- Update README files:
113-
```
114-
npm run update-views
115-
```
116-
8. **Customize as Needed**:
117-
- Modify templates in `src/templates` to change prompt display.
118-
- Update scripts in `src/core` to alter metadata generation or view updates.
119-
120-
## 🔧 Customizing Metadata Extraction
121-
122-
To customize metadata extraction:
123-
124-
1. Open and edit `src/system_prompts/prompt_analysis_agent/prompt.md`.
125-
2. Run `npm run generate-metadata` to test.
126-
3. Commit and push changes to trigger GitHub Actions.
127-
128-
> **Note**: Changes affect future metadata generations. Test thoroughly.
186+
- Ensure [Node.js](https://nodejs.org/en) is installed.
129187

130-
## 🧩 Using Fragments
188+
```sh
189+
npm install
190+
```
191+
192+
5. **Build and Install CLI**:
131193

132-
Fragments are reusable prompt components.
194+
```sh
195+
npm run build
196+
npm install -g .
197+
```
198+
199+
6. **Initialize CLI**:
200+
201+
```sh
202+
prompt-library-cli
203+
```
204+
205+
Follow prompts to set up configuration.
133206

134-
To use fragments:
207+
## 🧩 Using Fragments
135208

136-
1. **Create a Fragment**:
137-
- In `fragments`, create a new `.md` file under the appropriate category (categories are listed [here](/src/system_prompts/prompt_analysis_agent/prompt.md)).
138-
- Create your fragment content.
139-
- To match a variable in a prompt, name the fragment file to correspond with that variable.
209+
Fragments are reusable prompt components:
140210

141-
**Example:** `awesome_guidelines.md` → `AWESOME_GUIDELINES`
211+
1. Create `.md` files in `fragments` directory under the appropriate [categories](/src/app/system_prompts/prompt_analysis_agent/prompt.md)).
212+
2. Reference in prompts: `` (e.g., `` for `awesome_guidelines.md`).
213+
3. Manage and use via CLI.
142214

143-
2. **Update Metadata and Views**:
144-
- Regenerate metadata:
145-
```
146-
FORCE_REGENERATE=true npm run generate-metadata
147-
```
148-
- Update views:
149-
```
150-
npm run update-views
151-
```
215+
## ⚙️ Metadata Customization
152216

153-
Once metadata and views are regenerated, each prompt's README will list compatible fragments.
217+
1. Edit `src/system_prompts/prompt_analysis_agent/prompt.md`.
218+
2. Test with `npm run generate-metadata`.
219+
3. Commit and push to trigger GitHub Actions.
154220

155-
> **Note**: Forcing metadata regeneration can be costly; consider running selectively.
221+
> **Note**: Changes affect future metadata generations. Test thoroughly before committing.
156222
157-
## 📝 Contributing
223+
## 🤝 Contributing
158224

159225
Contributions to improve templates, scripts, or structure are welcome! Submit issues or pull requests.
160226

0 commit comments

Comments
 (0)