Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
7 changes: 7 additions & 0 deletions promptforge/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
dist/
.env*
.promptforge/
*.vsix
*.map
.DS_Store
7 changes: 7 additions & 0 deletions promptforge/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"semi": false,
"trailingComma": "all",
"printWidth": 100,
"tabWidth": 2
}
22 changes: 22 additions & 0 deletions promptforge/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
src/**
webview/src/**
webview/node_modules/**
tests/**
node_modules/**
.env*
.promptforge/**
*.map
*.vsix
.gitignore
.prettierrc
eslint.config.js
postcss.config.js
tailwind.config.js
tsconfig.json
tsconfig.webview.json
vitest.config.ts
esbuild.js
package-lock.json
!dist/**
!media/**
!package.json
16 changes: 16 additions & 0 deletions promptforge/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

## [0.1.0] - 2026-04-04

### Added
- AI co-writer with model-specific best practices (Claude, GPT-5, Gemini, o-series)
- Dynamic variable templates (`{{variable}}` and `{{variable:default}}`)
- Test runner with semantic scoring and iterative refinement
- A/B testing side by side (up to 20 inputs)
- Call replay with visual diff
- Cost tracking per model (10 models, 4 providers)
- Code snippet generator (TypeScript, Python, cURL x Anthropic, OpenAI, Google)
- Prompt library with versioning (max 15 versions + automatic archiving)
- Export in JSON, Markdown, and code snippets
- API key management via VS Code SecretStorage
- Onboarding banner for first-time users
21 changes: 21 additions & 0 deletions promptforge/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 PromptForge 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. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
87 changes: 87 additions & 0 deletions promptforge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# PromptForge

> AI-powered prompt engineering copilot for VS Code

PromptForge is a VS Code extension that helps you write, test, and refine prompts for Large Language Models — with an AI co-writer that knows the best practices of each model.

## Features

### Co-Writer with Model-Specific Best Practices
Write prompts with an AI assistant that adapts its suggestions based on the target model:
- **Claude** (Anthropic): XML tag structure, role-first system prompts
- **GPT-5 / o-series** (OpenAI): Markdown headers, concise directives
- **Gemini** (Google): Declarative instructions, thinking level control

### Dynamic Variable Templates
Use `{{variable}}` and `{{variable:default_value}}` syntax in your prompts. PromptForge auto-detects variables and generates input forms.

### Test Runner with Semantic Scoring
Test your prompts against live models, compare outputs with desired results, and get a semantic similarity score. Refine prompts iteratively based on real outputs.

### A/B Testing
Compare two prompt versions side by side with the same inputs. See cost, latency, and output differences at a glance. Up to 20 inputs per test.

### Call Replay
Capture API calls and replay them later with different prompts. Compare original vs. new outputs with a visual diff.

### Cost Tracking
Track token usage and costs per model with 4-decimal precision. Supports 10 models across 4 providers.

### Code Snippet Export
Generate ready-to-use code in TypeScript, Python, or cURL for Anthropic, OpenAI, and Google APIs (9 combinations).

### Prompt Library
Save, version, search, and export your prompts. Up to 15 versions per prompt with automatic archiving.

## Supported Models

| Provider | Models |
|----------|--------|
| Anthropic | Claude Opus 4.6, Claude Sonnet 4.6, Claude Haiku 4.5 |
| OpenAI | GPT-5.4, GPT-5.4 Mini, o3, o4-mini |
| Google | Gemini 3.1 Pro, Gemini 2.5 Flash, Gemini 3.1 Flash Lite |
| OpenRouter | Auto (fallback) |

## Getting Started

1. Install the extension from the VS Code Marketplace
2. Open Command Palette (`Ctrl+Shift+P`) and run `PromptForge: Configure API Keys`
3. Enter your API key for at least one provider
4. Press `Ctrl+Alt+N` to create your first prompt

## Keyboard Shortcuts

| Shortcut | Command |
|----------|---------|
| `Ctrl+Alt+N` | New Prompt |
| `Ctrl+Alt+T` | Test Prompt |
| `Ctrl+Alt+L` | Open Library |

## Requirements

- VS Code 1.100.0 or later
- At least one API key (Anthropic, OpenAI, Google, or OpenRouter)

## Extension Settings

| Setting | Default | Description |
|---------|---------|-------------|
| `promptforge.defaultModel` | `claude-opus-4-6` | Default model for new prompts |

## Data Storage

- **API Keys**: Stored securely in VS Code SecretStorage (never in files)
- **Prompts**: Saved as JSON in `.promptforge/prompts/` (add to `.gitignore`)
- **Replays**: Saved as JSON in `.promptforge/replays/`

## Tech Stack

- TypeScript (strict mode)
- React 18 + Tailwind CSS (Webview UI)
- Zustand (state management)
- esbuild (bundler)
- Vitest (testing)

## License

MIT
59 changes: 59 additions & 0 deletions promptforge/esbuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
const esbuild = require('esbuild')
const { execSync } = require('child_process')
const path = require('path')
const fs = require('fs')

const production = process.argv.includes('--production')
const watch = process.argv.includes('--watch')

const extensionConfig = {
entryPoints: ['src/extension.ts'],
bundle: true,
format: 'cjs',
platform: 'node',
outfile: 'dist/extension.js',
external: ['vscode'],
minify: production,
sourcemap: !production,
}

const webviewConfig = {
entryPoints: ['webview/src/main.tsx'],
bundle: true,
format: 'iife',
platform: 'browser',
outfile: 'dist/webview/main.js',
loader: { '.tsx': 'tsx', '.ts': 'ts', '.css': 'css' },
define: {
'process.env.NODE_ENV': production ? '"production"' : '"development"',
},
minify: production,
sourcemap: !production,
}

function buildTailwindCSS() {
const inputCSS = path.resolve(__dirname, 'webview/src/index.css')
const outputCSS = path.resolve(__dirname, 'dist/webview/main.css')
fs.mkdirSync(path.dirname(outputCSS), { recursive: true })
execSync(
`npx tailwindcss -i ${inputCSS} -o ${outputCSS} ${production ? '--minify' : ''}`,
{ stdio: 'inherit' },
)
}

async function main() {
buildTailwindCSS()

const extCtx = await esbuild.context(extensionConfig)
const wvCtx = await esbuild.context(webviewConfig)

if (watch) {
await Promise.all([extCtx.watch(), wvCtx.watch()])
console.log('Watching...')
} else {
await Promise.all([extCtx.rebuild(), wvCtx.rebuild()])
await Promise.all([extCtx.dispose(), wvCtx.dispose()])
}
}

main().catch(console.error)
24 changes: 24 additions & 0 deletions promptforge/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = [
{
files: ['src/**/*.ts'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
rules: {
'no-unused-vars': 'off',
'no-undef': 'off',
},
},
{
files: ['webview/src/**/*.{ts,tsx}'],
languageOptions: {
ecmaVersion: 2022,
sourceType: 'module',
},
rules: {
'no-unused-vars': 'off',
'no-undef': 'off',
},
},
]
Binary file added promptforge/media/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading