prompt-forge-cc 1.0.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/LICENSE +21 -0
- package/README.md +215 -0
- package/SKILL.md +77 -0
- package/bin/install.js +252 -0
- package/docs/architecture.md +165 -0
- package/docs/usage.md +99 -0
- package/evals/adversarial_cases.md +123 -0
- package/evals/benchmark.md +101 -0
- package/evals/scoring.md +106 -0
- package/evals/test_cases.md +173 -0
- package/package.json +41 -0
- package/prompts/examples/example-session.md +132 -0
- package/prompts/templates/anthropic-prompting-guide.md +119 -0
- package/prompts/templates/context-file-template.md +100 -0
- package/prompts/templates/gsd-output-format.md +75 -0
- package/prompts/templates/superpowers-output-format.md +89 -0
- package/prompts/templates/task-type-blueprints.md +317 -0
- package/src/adapters/claude.md +86 -0
- package/src/adapters/gemini.md +89 -0
- package/src/adapters/openai.md +100 -0
- package/src/commands/prompt-forge.md +34 -0
- package/src/core/constraints.md +70 -0
- package/src/core/intent_parser.md +104 -0
- package/src/core/modes.md +116 -0
- package/src/core/prompt_builder.md +123 -0
- package/src/utils/helpers.md +100 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nirvaan (Nirvaan05), Hill Patel (STiFLeR7)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Prompt Forge
|
|
2
|
+
|
|
3
|
+
**A prompt compiler skill for Claude Code, Gemini CLI, and other coding agents.**
|
|
4
|
+
|
|
5
|
+
**Solves prompt fatigue — the quality collapse that happens when you've been coding for hours and your prompts go from detailed instructions to "fix the auth thing."**
|
|
6
|
+
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
[](https://github.com/STiFLeR7/prompt-forge)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Why This Exists
|
|
13
|
+
|
|
14
|
+
You're three hours into a session. You know exactly what needs to happen — but you're too fried to write it properly. So you type "fix the login thing" and Claude hallucinates a solution to a problem you didn't describe.
|
|
15
|
+
|
|
16
|
+
The issue isn't Claude. It's your prompt. You stopped including context, constraints, file paths, test commands, and the six perspectives you'd normally think about. Not because you're lazy — because your working memory is full.
|
|
17
|
+
|
|
18
|
+
Prompt Forge sits between your tired brain and your coding agent. You type the vague thing. It reads your codebase, asks one or two easy questions, surfaces what you forgot, and hands you back a grounded, structured prompt you can paste and run.
|
|
19
|
+
|
|
20
|
+
It works with [Superpowers](https://github.com/obra/superpowers) and [GSD](https://github.com/gsd-build/get-shit-done) — or standalone with raw Claude Code and Gemini CLI.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## How It Works
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
You: "fix the auth thing"
|
|
28
|
+
|
|
29
|
+
Prompt Forge: [reads your code, greps for patterns, checks docs]
|
|
30
|
+
"loginUser() in auth-service.ts handles invalid passwords
|
|
31
|
+
and missing users differently. Is the bug about which one?"
|
|
32
|
+
|
|
33
|
+
You: "yeah the missing user case"
|
|
34
|
+
|
|
35
|
+
Prompt Forge: [delivers a grounded prompt with investigation steps,
|
|
36
|
+
fix approach, test commands, and a security note about
|
|
37
|
+
input validation you didn't think to mention]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The whole pipeline:
|
|
41
|
+
|
|
42
|
+
1. **Read your input** — detect fatigue signals, find the hidden intent
|
|
43
|
+
2. **First grounding** — read CLAUDE.md, scan the codebase, research docs
|
|
44
|
+
3. **Ask 1-3 questions** — grounded, easy to answer (yes/no, pick-one)
|
|
45
|
+
4. **Second grounding** — targeted deep-dive based on your answers
|
|
46
|
+
5. **Apply lenses** — 9 perspectives that fatigue makes you skip
|
|
47
|
+
6. **Compile the prompt** — structured, grounded, ready to paste
|
|
48
|
+
|
|
49
|
+
That's it. You get back a prompt. You paste it. Prompt Forge never writes code, never runs builds, never executes anything. It's the architect, not the builder.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## The 9 Lenses
|
|
54
|
+
|
|
55
|
+
Things a fresh engineer thinks about but a tired one forgets:
|
|
56
|
+
|
|
57
|
+
| # | Lens | What It Catches |
|
|
58
|
+
|---|------|----------------|
|
|
59
|
+
| 1 | **Business/Product** | Building the technically elegant wrong thing |
|
|
60
|
+
| 2 | **QA/Testing** | "Works on my machine" prompts with no test commands |
|
|
61
|
+
| 3 | **Architecture** | Spaghetti that ignores existing patterns |
|
|
62
|
+
| 4 | **User Experience** | Missing loading states, error messages, accessibility |
|
|
63
|
+
| 5 | **Security** | Unvalidated input, auth gaps, data exposure |
|
|
64
|
+
| 6 | **Performance** | N+1 queries, unindexed lookups, no caching strategy |
|
|
65
|
+
| 7 | **Developer Experience** | Code that future-you will curse past-you for |
|
|
66
|
+
| 8 | **Edge Cases** | Empty arrays, null users, network timeouts |
|
|
67
|
+
| 9 | **Migration/Compat** | Breaking changes to downstream consumers |
|
|
68
|
+
|
|
69
|
+
These aren't presented as a checklist. They're woven naturally into the prompt: *"The endpoint doesn't validate email format before the DB query — I'll include that. Also, there's no test for this route."*
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## Modes
|
|
74
|
+
|
|
75
|
+
Prompt Forge adapts its output based on what you're doing:
|
|
76
|
+
|
|
77
|
+
| Mode | Emphasis | Auto-detected from |
|
|
78
|
+
|------|----------|--------------------|
|
|
79
|
+
| `build` | Patterns, step-by-step, done criteria | "add", "create", "implement" |
|
|
80
|
+
| `audit` | Constraints, checklists, verification gates | "review", "check", "secure" |
|
|
81
|
+
| `debug` | Investigation-first, root cause before fix | "fix", "bug", "broken" |
|
|
82
|
+
| `research` | Alternatives, trade-offs, comparison tables | "how", "why", "explore" |
|
|
83
|
+
| `optimize` | Measure first, prove the improvement | "slow", "performance", "cache" |
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## LLM Adapters
|
|
88
|
+
|
|
89
|
+
Same prompt intelligence, different formatting for each model:
|
|
90
|
+
|
|
91
|
+
| Adapter | Formatting Style |
|
|
92
|
+
|---------|-----------------|
|
|
93
|
+
| **Claude** | XML tags, `@file` references, chain-of-thought |
|
|
94
|
+
| **Gemini** | MUST/MUST NOT rules, markdown structure, search grounding |
|
|
95
|
+
| **OpenAI** | System/user split, few-shot examples, bold constraints |
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Works With
|
|
100
|
+
|
|
101
|
+
- **[Superpowers](https://github.com/obra/superpowers)** — Feeds brainstorming with design considerations already surfaced, so the Socratic questioning goes deeper instead of extracting basics
|
|
102
|
+
- **[GSD](https://github.com/gsd-build/get-shit-done)** — Produces rich project briefs that give GSD's interview and research phases a head start instead of starting from nothing
|
|
103
|
+
- **Raw Claude Code / Gemini CLI** — Outputs task-type-specific blueprints (bug fix, feature, refactor, migration, performance, security, investigation, testing)
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## What's Inside
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
prompt-forge/
|
|
111
|
+
├── SKILL.md # Skill entrypoint
|
|
112
|
+
├── src/
|
|
113
|
+
│ ├── core/
|
|
114
|
+
│ │ ├── intent_parser.md # Fatigue detection, grounding, questions
|
|
115
|
+
│ │ ├── prompt_builder.md # Lenses, task classification, output
|
|
116
|
+
│ │ ├── modes.md # 5 compilation modes
|
|
117
|
+
│ │ └── constraints.md # The cardinal rule: never implement
|
|
118
|
+
│ ├── adapters/
|
|
119
|
+
│ │ ├── claude.md # Claude-specific formatting
|
|
120
|
+
│ │ ├── gemini.md # Gemini-specific formatting
|
|
121
|
+
│ │ └── openai.md # OpenAI-specific formatting
|
|
122
|
+
│ ├── commands/
|
|
123
|
+
│ │ └── prompt-forge.md # /prompt-forge slash command
|
|
124
|
+
│ └── utils/
|
|
125
|
+
│ └── helpers.md # Tone, collaboration, complexity adaptation
|
|
126
|
+
├── prompts/
|
|
127
|
+
│ ├── templates/ # 8 task-type blueprints + output formats
|
|
128
|
+
│ └── examples/ # Full session walkthrough
|
|
129
|
+
├── evals/
|
|
130
|
+
│ ├── test_cases.md # 14 functional tests
|
|
131
|
+
│ ├── adversarial_cases.md # 15 boundary tests
|
|
132
|
+
│ ├── benchmark.md # Cross-model benchmarks
|
|
133
|
+
│ └── scoring.md # Scoring rubric
|
|
134
|
+
└── docs/
|
|
135
|
+
├── architecture.md # System design
|
|
136
|
+
└── usage.md # Integration guide
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Installation
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
npx prompt-forge-cc@latest
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
The installer prompts you to choose:
|
|
148
|
+
1. **Runtime** — Claude Code, Gemini CLI, or both
|
|
149
|
+
2. **Scope** — Global (all projects) or local (current project only)
|
|
150
|
+
|
|
151
|
+
### Non-interactive Install
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Claude Code (global — recommended)
|
|
155
|
+
npx prompt-forge-cc --claude --global
|
|
156
|
+
|
|
157
|
+
# Gemini CLI (global)
|
|
158
|
+
npx prompt-forge-cc --gemini --global
|
|
159
|
+
|
|
160
|
+
# Both runtimes
|
|
161
|
+
npx prompt-forge-cc --all --global
|
|
162
|
+
|
|
163
|
+
# Current project only
|
|
164
|
+
npx prompt-forge-cc --claude --local
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Verify
|
|
168
|
+
|
|
169
|
+
Start a new session and run:
|
|
170
|
+
```
|
|
171
|
+
/prompt-forge fix the auth thing
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Updating
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
npx prompt-forge-cc@latest
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Uninstall
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
npx prompt-forge-cc --uninstall
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Philosophy
|
|
189
|
+
|
|
190
|
+
- **Investigate, never implement** — Prompt Forge reads your code aggressively but never touches it
|
|
191
|
+
- **Fatigue is the enemy, not laziness** — "fix the thing" is a valid input
|
|
192
|
+
- **Grounding over guessing** — Every file path, function name, and type in the output comes from actually reading the code
|
|
193
|
+
- **Collaborate, don't obey** — It challenges bad assumptions and proposes alternatives
|
|
194
|
+
- **Match complexity to the task** — A typo fix gets a one-liner, not five sections of context
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Contributing
|
|
199
|
+
|
|
200
|
+
1. Fork the repository
|
|
201
|
+
2. Create a branch for your changes
|
|
202
|
+
3. Submit a PR
|
|
203
|
+
|
|
204
|
+
See `docs/architecture.md` for system design and `evals/` for validation criteria.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Contributors
|
|
209
|
+
|
|
210
|
+
- **Nirvaan** ([Nirvaan05](https://github.com/Nirvaan05)) — Core Architecture, prompt system design, evaluation framework
|
|
211
|
+
- **Hill Patel** ([STiFLeR7](https://github.com/STiFLeR7)) — Lead Contributor, prompt system design, original extraction from Superpowers
|
|
212
|
+
|
|
213
|
+
## License
|
|
214
|
+
|
|
215
|
+
MIT — see [LICENSE](LICENSE)
|
package/SKILL.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: prompt-forge
|
|
3
|
+
description: "Use when a developer explicitly asks for help crafting or refining an execution prompt. Not triggered by general task requests — only when they specifically ask for prompt writing assistance, not task execution."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Prompt Forge
|
|
7
|
+
|
|
8
|
+
A prompt refinement skill that extracts what a developer actually means — especially when they're too deep in a session to say it clearly. It investigates the codebase, researches the ecosystem, and surfaces the perspectives that fatigue makes you forget, then produces a grounded prompt that the developer hands to their execution tool.
|
|
9
|
+
|
|
10
|
+
Built on Anthropic's official prompting best practices. Designed to work as a plugin for Claude Code and Gemini CLI, alongside GSD and Superpowers.
|
|
11
|
+
|
|
12
|
+
## The Cardinal Rule
|
|
13
|
+
|
|
14
|
+
**Investigate freely — but never implement.** Prompt Forge is a prompt writer, not a task executor. Its only job is to produce a refined, grounded prompt. See `src/core/constraints.md` for full boundary definition.
|
|
15
|
+
|
|
16
|
+
## Core Workflow
|
|
17
|
+
|
|
18
|
+
The workflow has two grounding passes — one before asking questions, one after.
|
|
19
|
+
|
|
20
|
+
| Step | Module | What Happens |
|
|
21
|
+
|------|--------|-------------|
|
|
22
|
+
| 1. Receive input | `src/core/intent_parser.md` | Read raw input, detect fatigue signals |
|
|
23
|
+
| 2. First grounding | `src/core/intent_parser.md` | CLAUDE.md → code analysis → web research |
|
|
24
|
+
| 3. Ask questions | `src/core/intent_parser.md` | 1-3 grounded, fatigue-friendly questions |
|
|
25
|
+
| 4. Second grounding | `src/core/intent_parser.md` | Targeted deep-dive from answers |
|
|
26
|
+
| 5. Apply lenses | `src/core/prompt_builder.md` | 9 perspective lenses (business, QA, architecture, UX, security, performance, DX, edge cases, migration) |
|
|
27
|
+
| 6. Produce output | `src/core/prompt_builder.md` | Intent breakdown + copy-paste prompt |
|
|
28
|
+
| 7. Scope check | `src/core/constraints.md` | Verify no implementation drift |
|
|
29
|
+
| 8. Deliver | `src/utils/helpers.md` | Present prompt, stay open for refinement |
|
|
30
|
+
|
|
31
|
+
## Module Index
|
|
32
|
+
|
|
33
|
+
### Core Logic
|
|
34
|
+
- **`src/core/intent_parser.md`** — Steps 1-4: input parsing, grounding, clarifying questions
|
|
35
|
+
- **`src/core/prompt_builder.md`** — Steps 5-6: lens analysis, task classification, output generation
|
|
36
|
+
- **`src/core/modes.md`** — 5 compilation modes (build, audit, debug, research, optimize)
|
|
37
|
+
- **`src/core/constraints.md`** — The Cardinal Rule, scope boundaries, drift detection
|
|
38
|
+
|
|
39
|
+
### LLM Adapters
|
|
40
|
+
- **`src/adapters/claude.md`** — Claude/Anthropic formatting (XML tags, @ references)
|
|
41
|
+
- **`src/adapters/gemini.md`** — Gemini/Google formatting (MUST/MUST NOT, markdown)
|
|
42
|
+
- **`src/adapters/openai.md`** — OpenAI/GPT formatting (system/user split, few-shot)
|
|
43
|
+
|
|
44
|
+
### Command
|
|
45
|
+
- **`src/commands/prompt-forge.md`** — Slash command entrypoint and invocation guide
|
|
46
|
+
|
|
47
|
+
### Helpers
|
|
48
|
+
- **`src/utils/helpers.md`** — Tone, collaboration style, complexity adaptation, delivery protocol
|
|
49
|
+
|
|
50
|
+
### Templates
|
|
51
|
+
- **`prompts/templates/task-type-blueprints.md`** — 8 task-type prompt structures
|
|
52
|
+
- **`prompts/templates/gsd-output-format.md`** — GSD-optimized output format
|
|
53
|
+
- **`prompts/templates/superpowers-output-format.md`** — Superpowers-optimized output format
|
|
54
|
+
- **`prompts/templates/context-file-template.md`** — Template for project context files
|
|
55
|
+
- **`prompts/templates/anthropic-prompting-guide.md`** — Anthropic prompting best practices
|
|
56
|
+
|
|
57
|
+
### Examples
|
|
58
|
+
- **`prompts/examples/example-session.md`** — Full walkthrough: vague input → 3 output formats
|
|
59
|
+
|
|
60
|
+
### Evaluation
|
|
61
|
+
- **`evals/test_cases.md`** — 14 functional test cases
|
|
62
|
+
- **`evals/adversarial_cases.md`** — 15 boundary and failure mode tests
|
|
63
|
+
- **`evals/benchmark.md`** — Cross-model benchmark framework (8 cases)
|
|
64
|
+
- **`evals/scoring.md`** — Scoring rubric (clarity, constraints, structure, grounding, leakage)
|
|
65
|
+
|
|
66
|
+
### Documentation
|
|
67
|
+
- **`docs/architecture.md`** — System design and directory map
|
|
68
|
+
- **`docs/usage.md`** — Integration and usage guide
|
|
69
|
+
|
|
70
|
+
## Reference Files
|
|
71
|
+
|
|
72
|
+
When building prompts, read the relevant references:
|
|
73
|
+
|
|
74
|
+
- **Task-type blueprints** — Primary reference on every invocation
|
|
75
|
+
- **Anthropic prompting guide** — Prompting principles: XML structuring, few-shot, chain-of-thought, grounding
|
|
76
|
+
- **Context file template** — For generating project context files
|
|
77
|
+
- **GSD/Superpowers output formats** — When plugins are detected
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const readline = require('readline');
|
|
7
|
+
|
|
8
|
+
// Colors
|
|
9
|
+
const cyan = '\x1b[36m';
|
|
10
|
+
const green = '\x1b[32m';
|
|
11
|
+
const yellow = '\x1b[33m';
|
|
12
|
+
const red = '\x1b[31m';
|
|
13
|
+
const bold = '\x1b[1m';
|
|
14
|
+
const dim = '\x1b[2m';
|
|
15
|
+
const reset = '\x1b[0m';
|
|
16
|
+
|
|
17
|
+
const pkg = require('../package.json');
|
|
18
|
+
|
|
19
|
+
// Parse args
|
|
20
|
+
const args = process.argv.slice(2);
|
|
21
|
+
const hasClaude = args.includes('--claude');
|
|
22
|
+
const hasGemini = args.includes('--gemini');
|
|
23
|
+
const hasAll = args.includes('--all');
|
|
24
|
+
const hasGlobal = args.includes('--global') || args.includes('-g');
|
|
25
|
+
const hasLocal = args.includes('--local') || args.includes('-l');
|
|
26
|
+
const hasUninstall = args.includes('--uninstall') || args.includes('-u');
|
|
27
|
+
const hasHelp = args.includes('--help') || args.includes('-h');
|
|
28
|
+
|
|
29
|
+
if (hasHelp) {
|
|
30
|
+
console.log(`
|
|
31
|
+
${bold}Prompt Forge Installer v${pkg.version}${reset}
|
|
32
|
+
|
|
33
|
+
${bold}Usage:${reset}
|
|
34
|
+
npx prompt-forge-cc@latest ${dim}# Interactive install${reset}
|
|
35
|
+
npx prompt-forge-cc --claude --global ${dim}# Claude Code, all projects${reset}
|
|
36
|
+
npx prompt-forge-cc --gemini --global ${dim}# Gemini CLI, all projects${reset}
|
|
37
|
+
npx prompt-forge-cc --all --global ${dim}# All runtimes${reset}
|
|
38
|
+
npx prompt-forge-cc --uninstall ${dim}# Remove Prompt Forge${reset}
|
|
39
|
+
|
|
40
|
+
${bold}Options:${reset}
|
|
41
|
+
--claude Install for Claude Code
|
|
42
|
+
--gemini Install for Gemini CLI
|
|
43
|
+
--all Install for all runtimes
|
|
44
|
+
--global, -g Install globally (all projects)
|
|
45
|
+
--local, -l Install locally (current project only)
|
|
46
|
+
--uninstall, -u Remove Prompt Forge
|
|
47
|
+
--help, -h Show this help
|
|
48
|
+
`);
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Skill files to copy (relative to package root)
|
|
53
|
+
const SKILL_FILES = [
|
|
54
|
+
'SKILL.md',
|
|
55
|
+
'src/core/intent_parser.md',
|
|
56
|
+
'src/core/prompt_builder.md',
|
|
57
|
+
'src/core/constraints.md',
|
|
58
|
+
'src/core/modes.md',
|
|
59
|
+
'src/adapters/claude.md',
|
|
60
|
+
'src/adapters/gemini.md',
|
|
61
|
+
'src/adapters/openai.md',
|
|
62
|
+
'src/commands/prompt-forge.md',
|
|
63
|
+
'src/utils/helpers.md',
|
|
64
|
+
'prompts/templates/task-type-blueprints.md',
|
|
65
|
+
'prompts/templates/gsd-output-format.md',
|
|
66
|
+
'prompts/templates/superpowers-output-format.md',
|
|
67
|
+
'prompts/templates/context-file-template.md',
|
|
68
|
+
'prompts/templates/anthropic-prompting-guide.md',
|
|
69
|
+
'prompts/examples/example-session.md',
|
|
70
|
+
'evals/test_cases.md',
|
|
71
|
+
'evals/adversarial_cases.md',
|
|
72
|
+
'evals/benchmark.md',
|
|
73
|
+
'evals/scoring.md',
|
|
74
|
+
'docs/architecture.md',
|
|
75
|
+
'docs/usage.md',
|
|
76
|
+
];
|
|
77
|
+
|
|
78
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
79
|
+
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
// Helpers
|
|
82
|
+
// ---------------------------------------------------------------------------
|
|
83
|
+
|
|
84
|
+
function copyFileSync(src, dest) {
|
|
85
|
+
const destDir = path.dirname(dest);
|
|
86
|
+
if (!fs.existsSync(destDir)) {
|
|
87
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
88
|
+
}
|
|
89
|
+
fs.copyFileSync(src, dest);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function removeDir(dir) {
|
|
93
|
+
if (fs.existsSync(dir)) {
|
|
94
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function getTargetDir(runtime, isGlobal) {
|
|
101
|
+
const home = os.homedir();
|
|
102
|
+
if (runtime === 'claude') {
|
|
103
|
+
const base = isGlobal ? path.join(home, '.claude') : path.join(process.cwd(), '.claude');
|
|
104
|
+
return path.join(base, 'skills', 'prompt-forge');
|
|
105
|
+
}
|
|
106
|
+
if (runtime === 'gemini') {
|
|
107
|
+
const base = isGlobal ? path.join(home, '.gemini') : path.join(process.cwd(), '.gemini');
|
|
108
|
+
return path.join(base, 'skills', 'prompt-forge');
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function installRuntime(runtime, isGlobal) {
|
|
114
|
+
const targetDir = getTargetDir(runtime, isGlobal);
|
|
115
|
+
if (!targetDir) return false;
|
|
116
|
+
|
|
117
|
+
const scope = isGlobal ? 'global' : 'local';
|
|
118
|
+
console.log(`\n${cyan}Installing Prompt Forge for ${bold}${runtime}${reset}${cyan} (${scope})...${reset}`);
|
|
119
|
+
console.log(`${dim} Target: ${targetDir}${reset}`);
|
|
120
|
+
|
|
121
|
+
let copied = 0;
|
|
122
|
+
for (const file of SKILL_FILES) {
|
|
123
|
+
const src = path.join(packageRoot, file);
|
|
124
|
+
const dest = path.join(targetDir, file);
|
|
125
|
+
if (fs.existsSync(src)) {
|
|
126
|
+
copyFileSync(src, dest);
|
|
127
|
+
copied++;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
console.log(`${green} Copied ${copied} files.${reset}`);
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function uninstallRuntime(runtime, isGlobal) {
|
|
136
|
+
const targetDir = getTargetDir(runtime, isGlobal);
|
|
137
|
+
if (!targetDir) return false;
|
|
138
|
+
if (removeDir(targetDir)) {
|
|
139
|
+
const scope = isGlobal ? 'global' : 'local';
|
|
140
|
+
console.log(`${green} Removed Prompt Forge from ${runtime} (${scope}).${reset}`);
|
|
141
|
+
return true;
|
|
142
|
+
}
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// ---------------------------------------------------------------------------
|
|
147
|
+
// Interactive prompts
|
|
148
|
+
// ---------------------------------------------------------------------------
|
|
149
|
+
|
|
150
|
+
function createRL() {
|
|
151
|
+
return readline.createInterface({
|
|
152
|
+
input: process.stdin,
|
|
153
|
+
output: process.stdout,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function ask(rl, question) {
|
|
158
|
+
return new Promise((resolve) => rl.question(question, resolve));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async function promptRuntime(rl) {
|
|
162
|
+
console.log(`\n${bold}Which runtime?${reset}`);
|
|
163
|
+
console.log(` ${cyan}1${reset} Claude Code`);
|
|
164
|
+
console.log(` ${cyan}2${reset} Gemini CLI`);
|
|
165
|
+
console.log(` ${cyan}3${reset} Both`);
|
|
166
|
+
const answer = await ask(rl, `\n${bold}Choose (1-3):${reset} `);
|
|
167
|
+
const choice = answer.trim();
|
|
168
|
+
if (choice === '1') return ['claude'];
|
|
169
|
+
if (choice === '2') return ['gemini'];
|
|
170
|
+
if (choice === '3') return ['claude', 'gemini'];
|
|
171
|
+
console.log(`${yellow}Invalid choice, defaulting to Claude Code.${reset}`);
|
|
172
|
+
return ['claude'];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
async function promptScope(rl) {
|
|
176
|
+
console.log(`\n${bold}Install scope?${reset}`);
|
|
177
|
+
console.log(` ${cyan}1${reset} Global ${dim}(all projects — recommended)${reset}`);
|
|
178
|
+
console.log(` ${cyan}2${reset} Local ${dim}(current project only)${reset}`);
|
|
179
|
+
const answer = await ask(rl, `\n${bold}Choose (1-2):${reset} `);
|
|
180
|
+
return answer.trim() === '2' ? false : true;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// ---------------------------------------------------------------------------
|
|
184
|
+
// Main
|
|
185
|
+
// ---------------------------------------------------------------------------
|
|
186
|
+
|
|
187
|
+
async function main() {
|
|
188
|
+
console.log(`\n${bold}${cyan}Prompt Forge${reset} ${dim}v${pkg.version}${reset}`);
|
|
189
|
+
console.log(`${dim}A prompt compiler skill for coding agents${reset}`);
|
|
190
|
+
|
|
191
|
+
// Resolve runtimes
|
|
192
|
+
let runtimes = [];
|
|
193
|
+
if (hasAll) {
|
|
194
|
+
runtimes = ['claude', 'gemini'];
|
|
195
|
+
} else {
|
|
196
|
+
if (hasClaude) runtimes.push('claude');
|
|
197
|
+
if (hasGemini) runtimes.push('gemini');
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
let isGlobal = hasGlobal ? true : hasLocal ? false : null;
|
|
201
|
+
|
|
202
|
+
// Uninstall flow
|
|
203
|
+
if (hasUninstall) {
|
|
204
|
+
console.log(`\n${yellow}Uninstalling Prompt Forge...${reset}`);
|
|
205
|
+
let removed = false;
|
|
206
|
+
for (const runtime of ['claude', 'gemini']) {
|
|
207
|
+
removed = uninstallRuntime(runtime, true) || removed;
|
|
208
|
+
removed = uninstallRuntime(runtime, false) || removed;
|
|
209
|
+
}
|
|
210
|
+
if (!removed) {
|
|
211
|
+
console.log(`${dim} Nothing to remove.${reset}`);
|
|
212
|
+
}
|
|
213
|
+
console.log(`\n${green}Done.${reset}\n`);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Interactive mode if no flags
|
|
218
|
+
if (runtimes.length === 0 || isGlobal === null) {
|
|
219
|
+
const rl = createRL();
|
|
220
|
+
try {
|
|
221
|
+
if (runtimes.length === 0) {
|
|
222
|
+
runtimes = await promptRuntime(rl);
|
|
223
|
+
}
|
|
224
|
+
if (isGlobal === null) {
|
|
225
|
+
isGlobal = await promptScope(rl);
|
|
226
|
+
}
|
|
227
|
+
} finally {
|
|
228
|
+
rl.close();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Install
|
|
233
|
+
for (const runtime of runtimes) {
|
|
234
|
+
installRuntime(runtime, isGlobal);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Done
|
|
238
|
+
console.log(`\n${green}${bold}Prompt Forge installed.${reset}`);
|
|
239
|
+
console.log(`\n${dim}Invoke with:${reset}`);
|
|
240
|
+
if (runtimes.includes('claude')) {
|
|
241
|
+
console.log(` ${cyan}Claude Code:${reset} /prompt-forge [your intent]`);
|
|
242
|
+
}
|
|
243
|
+
if (runtimes.includes('gemini')) {
|
|
244
|
+
console.log(` ${cyan}Gemini CLI:${reset} /prompt-forge [your intent]`);
|
|
245
|
+
}
|
|
246
|
+
console.log('');
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
main().catch((err) => {
|
|
250
|
+
console.error(`${red}Error: ${err.message}${reset}`);
|
|
251
|
+
process.exit(1);
|
|
252
|
+
});
|