megabuff 0.2.0 → 0.3.0
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.
- package/README.md +83 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
AI prompt optimizer CLI - improve your prompts with multiple input/output options
|
|
4
4
|
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Setup](#setup)
|
|
9
|
+
- [Getting Your OpenAI API Key (BYOK)](#getting-your-openai-api-key-byok)
|
|
10
|
+
- [Getting Your Anthropic API Key (BYOK)](#getting-your-anthropic-api-key-byok)
|
|
11
|
+
- [Configuring Your API Key](#configuring-your-api-key)
|
|
12
|
+
- [Option 1: Save to Config (Recommended)](#option-1-save-to-config-recommended)
|
|
13
|
+
- [Option 2: Environment Variable](#option-2-environment-variable)
|
|
14
|
+
- [Option 3: Pass as Flag](#option-3-pass-as-flag)
|
|
15
|
+
- [API Key Priority](#api-key-priority)
|
|
16
|
+
- [Configuration Commands](#configuration-commands)
|
|
17
|
+
- [Development](#development)
|
|
18
|
+
- [Build](#build)
|
|
19
|
+
- [Install Globally](#install-globally)
|
|
20
|
+
- [Usage](#usage)
|
|
21
|
+
- [1. Inline Argument (Quick & Simple)](#1-inline-argument-quick--simple)
|
|
22
|
+
- [2. File Input](#2-file-input)
|
|
23
|
+
- [3. Stdin Pipe](#3-stdin-pipe)
|
|
24
|
+
- [4. Interactive Mode](#4-interactive-mode)
|
|
25
|
+
- [Output Options](#output-options)
|
|
26
|
+
- [Default: Print to stdout AND copy to clipboard](#default-print-to-stdout-and-copy-to-clipboard)
|
|
27
|
+
- [Disable clipboard copy](#disable-clipboard-copy)
|
|
28
|
+
- [Save to file](#save-to-file)
|
|
29
|
+
- [Interactive comparison view](#interactive-comparison-view)
|
|
30
|
+
- [Combine options](#combine-options)
|
|
31
|
+
- [Examples](#examples)
|
|
32
|
+
- [How It Works](#how-it-works)
|
|
33
|
+
- [VS Code Integration: WIP](#vs-code-integration)
|
|
34
|
+
- [Option 1: VS Code Extension (Full Experience)](#option-1-vs-code-extension-full-experience)
|
|
35
|
+
- [Option 2: VS Code Tasks (Quick Setup)](#option-2-vs-code-tasks-quick-setup)
|
|
36
|
+
- [Option 3: Terminal Integration](#option-3-terminal-integration)
|
|
37
|
+
- [Publishing to npm](#publishing-to-npm)
|
|
38
|
+
- [First-time Setup](#first-time-setup)
|
|
39
|
+
- [Publishing Steps](#publishing-steps)
|
|
40
|
+
- [Publishing Updates](#publishing-updates)
|
|
41
|
+
- [What Gets Published](#what-gets-published)
|
|
42
|
+
- [After Publishing](#after-publishing)
|
|
43
|
+
|
|
5
44
|
## Installation
|
|
6
45
|
|
|
7
46
|
Install MegaBuff globally:
|
|
@@ -53,20 +92,47 @@ MegaBuff uses a **BYOK (Bring Your Own Key)** model, meaning you use your own Op
|
|
|
53
92
|
- Store it securely - you'll need to generate a new one if you lose it
|
|
54
93
|
- The key starts with `sk-`
|
|
55
94
|
|
|
95
|
+
### Getting Your Anthropic API Key (BYOK)
|
|
96
|
+
|
|
97
|
+
MegaBuff can also use **Anthropic (Claude)** if you provide your own Anthropic API key.
|
|
98
|
+
|
|
99
|
+
**Steps to get your Anthropic API Key:**
|
|
100
|
+
|
|
101
|
+
1. **Create an Anthropic Console account**
|
|
102
|
+
- Sign up / log in at `https://console.anthropic.com/`
|
|
103
|
+
|
|
104
|
+
2. **Set up billing / credits**
|
|
105
|
+
- Ensure your Anthropic account is enabled for API usage (billing/credits as required by Anthropic).
|
|
106
|
+
|
|
107
|
+
3. **Create an API key**
|
|
108
|
+
- In the [Anthropic Dashboard Console](https://platform.claude.com/dashboard), go to **API Keys**
|
|
109
|
+
- Click **Create key**
|
|
110
|
+
- Name it something like "MegaBuff CLI"
|
|
111
|
+
|
|
112
|
+
4. **Save your key immediately**
|
|
113
|
+
- Copy and store it somewhere secure
|
|
114
|
+
- Anthropic keys typically start with `sk-ant-`
|
|
115
|
+
|
|
56
116
|
### Configuring Your API Key
|
|
57
117
|
|
|
58
|
-
Once you have your
|
|
118
|
+
Once you have your provider API key, configure it using one of these methods:
|
|
59
119
|
|
|
60
120
|
#### Option 1: Save to Config (Recommended)
|
|
61
121
|
|
|
62
122
|
The easiest way to get started:
|
|
63
123
|
|
|
64
124
|
```bash
|
|
65
|
-
# Save to config file
|
|
125
|
+
# Save an OpenAI key to config file (default provider is openai)
|
|
66
126
|
megabuff config set sk-your-api-key-here
|
|
67
127
|
|
|
68
128
|
# Or save to system keychain (more secure)
|
|
69
129
|
megabuff config set sk-your-api-key-here --keychain
|
|
130
|
+
|
|
131
|
+
# Save an Anthropic key
|
|
132
|
+
megabuff config set --provider anthropic sk-ant-your-api-key-here
|
|
133
|
+
|
|
134
|
+
# Save an Anthropic key to keychain
|
|
135
|
+
megabuff config set --provider anthropic sk-ant-your-api-key-here --keychain
|
|
70
136
|
```
|
|
71
137
|
|
|
72
138
|
This saves your key for future use. You only need to do this once!
|
|
@@ -75,6 +141,7 @@ This saves your key for future use. You only need to do this once!
|
|
|
75
141
|
|
|
76
142
|
```bash
|
|
77
143
|
export OPENAI_API_KEY="sk-your-api-key-here"
|
|
144
|
+
export ANTHROPIC_API_KEY="sk-ant-your-api-key-here"
|
|
78
145
|
```
|
|
79
146
|
|
|
80
147
|
Add to your shell profile (`.bashrc`, `.zshrc`, etc.) to persist across sessions.
|
|
@@ -83,30 +150,37 @@ Add to your shell profile (`.bashrc`, `.zshrc`, etc.) to persist across sessions
|
|
|
83
150
|
|
|
84
151
|
```bash
|
|
85
152
|
megabuff optimize "your prompt" --api-key sk-your-key-here
|
|
153
|
+
megabuff optimize --provider anthropic "your prompt" --api-key sk-ant-your-key-here
|
|
86
154
|
```
|
|
87
155
|
|
|
88
156
|
### API Key Priority
|
|
89
157
|
|
|
90
|
-
The CLI checks for your
|
|
158
|
+
The CLI checks for your token in this order (per provider):
|
|
91
159
|
1. `--api-key` flag (highest priority)
|
|
92
|
-
2. `OPENAI_API_KEY`
|
|
160
|
+
2. Provider env var (e.g. `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`)
|
|
93
161
|
3. System keychain (if configured)
|
|
94
162
|
4. Config file at `~/.megabuff/config.json`
|
|
95
163
|
|
|
96
164
|
## Configuration Commands
|
|
97
165
|
|
|
98
166
|
```bash
|
|
99
|
-
# Save your
|
|
167
|
+
# Save your OpenAI key (default provider)
|
|
100
168
|
megabuff config set sk-your-api-key-here
|
|
101
169
|
|
|
170
|
+
# Save your Anthropic key
|
|
171
|
+
megabuff config set --provider anthropic sk-ant-your-api-key-here
|
|
172
|
+
|
|
102
173
|
# Save to keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service)
|
|
103
174
|
megabuff config set sk-your-api-key-here --keychain
|
|
104
175
|
|
|
105
176
|
# Show current configuration
|
|
106
177
|
megabuff config show
|
|
107
178
|
|
|
108
|
-
# Remove saved
|
|
179
|
+
# Remove a saved key (defaults to openai if --provider is omitted)
|
|
109
180
|
megabuff config remove
|
|
181
|
+
|
|
182
|
+
# Remove a saved Anthropic key
|
|
183
|
+
megabuff config remove --provider anthropic
|
|
110
184
|
```
|
|
111
185
|
|
|
112
186
|
## Development
|
|
@@ -243,6 +317,9 @@ megabuff optimize --file prompt.txt --output result.txt --no-copy
|
|
|
243
317
|
|
|
244
318
|
# Use specific API key
|
|
245
319
|
megabuff optimize "Your prompt" --api-key sk-your-key-here
|
|
320
|
+
|
|
321
|
+
# Use Anthropic (Claude)
|
|
322
|
+
megabuff optimize --provider anthropic "Rewrite this prompt to be clearer"
|
|
246
323
|
```
|
|
247
324
|
|
|
248
325
|
## How It Works
|