forgehive 0.7.6 → 0.7.8
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 +14 -3
- package/dist/cli.js +9 -31
- package/docs/user-guide.md +342 -0
- package/forgehive/commands/fh-refactor.md +116 -0
- package/forgehive/commands/review-party.md +42 -23
- package/forgehive/party/defaults.yaml +8 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -45,9 +45,9 @@ Claude loses all project knowledge between sessions. forgehive solves this by wr
|
|
|
45
45
|
|
|
46
46
|
---
|
|
47
47
|
|
|
48
|
-
## Status: v0.7.
|
|
48
|
+
## Status: v0.7.7 — Stable
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
297 passing tests back the commands listed below. The v0.7 feature set has been validated end-to-end.
|
|
51
51
|
|
|
52
52
|
**Stable — use with confidence:**
|
|
53
53
|
|
|
@@ -93,6 +93,15 @@ If you run into issues, please open an issue on GitHub. The most valuable feedba
|
|
|
93
93
|
|
|
94
94
|
---
|
|
95
95
|
|
|
96
|
+
## Documentation
|
|
97
|
+
|
|
98
|
+
| Document | Description |
|
|
99
|
+
|---|---|
|
|
100
|
+
| [User Guide](docs/user-guide.md) | Installation, quick start, all commands with examples, troubleshooting |
|
|
101
|
+
| [TUTORIAL.md](TUTORIAL.md) | Step-by-step walkthrough of a real session |
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
96
105
|
## Installation
|
|
97
106
|
|
|
98
107
|
### From npm (recommended)
|
|
@@ -116,7 +125,7 @@ npm link # makes 'fh' available globally
|
|
|
116
125
|
Verify the installation:
|
|
117
126
|
|
|
118
127
|
```bash
|
|
119
|
-
fh --version # should print 0.7.
|
|
128
|
+
fh --version # should print 0.7.7
|
|
120
129
|
fh --help # lists all available commands
|
|
121
130
|
```
|
|
122
131
|
|
|
@@ -881,6 +890,8 @@ npm test # node --import tsx/esm --test test/*.test.ts
|
|
|
881
890
|
|
|
882
891
|
| Version | What's new |
|
|
883
892
|
|---|---|
|
|
893
|
+
| **0.7.7** | User Guide (`docs/user-guide.md`) included in npm package; Documentation table in README |
|
|
894
|
+
| **0.7.6** | YAML shape fix in `fh docs user`; frontmatter regex fix; 8 new tests for HIGH RISK paths |
|
|
884
895
|
| **0.7.5** | `fh --version` reads from `package.json` (no longer hardcoded) |
|
|
885
896
|
| **0.7.4** | Party slash commands installed by `fh init` (`/party`, `/review-party`, `/design-party`, `/full-party`, `/security-party`) |
|
|
886
897
|
| **0.7.3** | User Docs generation (`fh docs user`, `fh docs api`, `fh docs list`) |
|
package/dist/cli.js
CHANGED
|
@@ -6550,7 +6550,7 @@ function generateUserGuide(projectRoot2, forgehiveDir2) {
|
|
|
6550
6550
|
lines.push("## Overview");
|
|
6551
6551
|
lines.push("");
|
|
6552
6552
|
if (memFiles["project.md"]) {
|
|
6553
|
-
const content = memFiles["project.md"].replace(/^---[\s\S]*?---\n
|
|
6553
|
+
const content = memFiles["project.md"].replace(/^---[\s\S]*?---\n?/, "").trim();
|
|
6554
6554
|
lines.push(content);
|
|
6555
6555
|
} else {
|
|
6556
6556
|
lines.push(`${projectName} is a ${lang ?? "software"} application.`);
|
|
@@ -6585,7 +6585,7 @@ function generateUserGuide(projectRoot2, forgehiveDir2) {
|
|
|
6585
6585
|
}
|
|
6586
6586
|
lines.push("```");
|
|
6587
6587
|
lines.push("");
|
|
6588
|
-
if (Array.isArray(entryPoints) && entryPoints.length > 0) {
|
|
6588
|
+
if ((lang === "typescript" || lang === "javascript") && Array.isArray(entryPoints) && entryPoints.length > 0) {
|
|
6589
6589
|
lines.push("## Getting Started");
|
|
6590
6590
|
lines.push("");
|
|
6591
6591
|
lines.push("```bash");
|
|
@@ -6596,7 +6596,7 @@ function generateUserGuide(projectRoot2, forgehiveDir2) {
|
|
|
6596
6596
|
if (memFiles["stack.md"]) {
|
|
6597
6597
|
lines.push("## Configuration");
|
|
6598
6598
|
lines.push("");
|
|
6599
|
-
const content = memFiles["stack.md"].replace(/^---[\s\S]*?---\n
|
|
6599
|
+
const content = memFiles["stack.md"].replace(/^---[\s\S]*?---\n?/, "").trim();
|
|
6600
6600
|
lines.push(content);
|
|
6601
6601
|
lines.push("");
|
|
6602
6602
|
}
|
|
@@ -7671,6 +7671,7 @@ Setze diese Umgebungsvariablen:`);
|
|
|
7671
7671
|
} else if (subcommand === "onboard") {
|
|
7672
7672
|
const outputArg = rest.includes("--output") ? rest[rest.indexOf("--output") + 1] : null;
|
|
7673
7673
|
const outputPath = outputArg ?? path32.join(projectRoot, "ONBOARDING.md");
|
|
7674
|
+
fs31.mkdirSync(path32.dirname(outputPath), { recursive: true });
|
|
7674
7675
|
const doc = generateOnboardingDoc(projectRoot, forgehiveDir);
|
|
7675
7676
|
fs31.writeFileSync(outputPath, doc, "utf8");
|
|
7676
7677
|
console.log(`\u2714 Onboarding-Dokument geschrieben: ${outputPath}`);
|
|
@@ -7680,12 +7681,11 @@ Setze diese Umgebungsvariablen:`);
|
|
|
7680
7681
|
const since = sinceArg ?? getLatestTag(projectRoot) ?? void 0;
|
|
7681
7682
|
const rawLog = getGitLogSince(projectRoot, since);
|
|
7682
7683
|
const commits = parseGitLog(rawLog);
|
|
7683
|
-
let
|
|
7684
|
+
let pkgVersion = "unreleased";
|
|
7684
7685
|
try {
|
|
7685
|
-
|
|
7686
|
+
pkgVersion = JSON.parse(fs31.readFileSync(path32.join(projectRoot, "package.json"), "utf8")).version ?? "unreleased";
|
|
7686
7687
|
} catch {
|
|
7687
7688
|
}
|
|
7688
|
-
const pkgVersion = pkg.version ?? "unreleased";
|
|
7689
7689
|
const md = formatChangelog(commits, pkgVersion);
|
|
7690
7690
|
const outputPath = outputArg ?? path32.join(projectRoot, "CHANGELOG.md");
|
|
7691
7691
|
let existing = "";
|
|
@@ -7698,31 +7698,9 @@ Setze diese Umgebungsvariablen:`);
|
|
|
7698
7698
|
console.error("Usage: fh docs adr <titel>");
|
|
7699
7699
|
process.exit(1);
|
|
7700
7700
|
}
|
|
7701
|
-
const
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
const adrId = String(existing + 1).padStart(4, "0");
|
|
7705
|
-
const slug = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
7706
|
-
const filename = `${adrId}-${slug}.md`;
|
|
7707
|
-
const content = `# ADR-${adrId}: ${title}
|
|
7708
|
-
|
|
7709
|
-
**Datum:** ${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}
|
|
7710
|
-
**Status:** proposed
|
|
7711
|
-
|
|
7712
|
-
## Kontext
|
|
7713
|
-
|
|
7714
|
-
(Beschreibe das Problem oder die Situation.)
|
|
7715
|
-
|
|
7716
|
-
## Entscheidung
|
|
7717
|
-
|
|
7718
|
-
(Beschreibe die getroffene Entscheidung.)
|
|
7719
|
-
|
|
7720
|
-
## Konsequenzen
|
|
7721
|
-
|
|
7722
|
-
(Beschreibe die Auswirkungen dieser Entscheidung.)
|
|
7723
|
-
`;
|
|
7724
|
-
fs31.writeFileSync(path32.join(adrsDir, filename), content, "utf8");
|
|
7725
|
-
console.log(`\u2714 ADR erstellt: .forgehive/memory/adrs/${filename}`);
|
|
7701
|
+
const adrPath = createAdr(forgehiveDir, projectRoot, title);
|
|
7702
|
+
const adrFilename = path32.relative(projectRoot, adrPath);
|
|
7703
|
+
console.log(`\u2714 ADR erstellt: ${adrFilename}`);
|
|
7726
7704
|
} else {
|
|
7727
7705
|
console.error("Verf\xFCgbar: fh docs [list|user|api|onboard|changelog|adr <titel>]");
|
|
7728
7706
|
}
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
# forgehive — User Guide
|
|
2
|
+
|
|
3
|
+
> Version 0.7.7 · [npm](https://www.npmjs.com/package/forgehive) · `npm install -g forgehive`
|
|
4
|
+
|
|
5
|
+
forgehive (`fh`) gives Claude Code persistent memory about your project. Without it, Claude forgets everything between sessions — your stack, your conventions, your decisions. With it, Claude opens every session already knowing your codebase.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g forgehive
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Requires **Node.js ≥ 18** and **Claude Code** (`claude` CLI). Installs two aliases: `fh` and `forgehive`.
|
|
16
|
+
|
|
17
|
+
Verify:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
fh --version # prints 0.7.7
|
|
21
|
+
fh --help # full command reference
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
Three commands to get Claude up to speed on any project:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
cd my-project
|
|
32
|
+
fh init # scan the project, write .forgehive/
|
|
33
|
+
fh confirm # activate the context for Claude
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Then open a new Claude Code session in the same directory. Claude reads `.forgehive/` automatically at session start and knows your stack, constraints, and memory.
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## What `fh init` Does
|
|
41
|
+
|
|
42
|
+
Running `fh init` in a project:
|
|
43
|
+
|
|
44
|
+
1. Scans your project — language, framework, dependencies, directory structure
|
|
45
|
+
2. Creates `.forgehive/` with capabilities, memory files, 16 expert skills, agent permissions
|
|
46
|
+
3. Merges a context block into `CLAUDE.md` (creates it if it doesn't exist, never overwrites existing content)
|
|
47
|
+
4. Writes `AGENTS.md` to the project root (works with Cursor, Copilot, Gemini CLI, Codex, Windsurf)
|
|
48
|
+
|
|
49
|
+
The result looks like this:
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
my-project/
|
|
53
|
+
.forgehive/
|
|
54
|
+
capabilities.yaml ← detected stack (status: draft → confirmed)
|
|
55
|
+
harness/
|
|
56
|
+
constraints.yaml ← max_lines, require_tests, style rules
|
|
57
|
+
permissions.yaml ← per-agent file access control
|
|
58
|
+
memory/
|
|
59
|
+
MEMORY.md ← index of all memory files
|
|
60
|
+
project.md ← project context and open decisions
|
|
61
|
+
feedback.md ← corrections + confirmed approaches
|
|
62
|
+
stack.md ← details the scanner can't detect
|
|
63
|
+
adrs/ ← Architecture Decision Records
|
|
64
|
+
stories/ ← story cards (US-N.md)
|
|
65
|
+
epics/ ← epic cards (EPC-N.md)
|
|
66
|
+
velocity.md ← sprint velocity history
|
|
67
|
+
skills/expert/ ← 16 preinstalled expert skills
|
|
68
|
+
AGENTS.md
|
|
69
|
+
CLAUDE.md ← forgehive block appended, nothing overwritten
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Already have a `.forgehive/`?** `fh init` prints a warning and stops. Use `fh init --force` to re-initialize, or `fh scan --update` to update only the scan.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## The Two Statuses: Draft and Confirmed
|
|
77
|
+
|
|
78
|
+
After `fh init`, `capabilities.yaml` is in `status: draft`. Claude won't treat the context as authoritative until you run:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
fh confirm
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This is intentional — review what the scanner detected before committing to it. Open `capabilities.yaml`, check that the language, framework, and dependencies look right, then confirm.
|
|
85
|
+
|
|
86
|
+
To check the current status at any time:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
fh status
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Memory — Teaching Claude About Your Project
|
|
95
|
+
|
|
96
|
+
The memory files in `.forgehive/memory/` are the most important part of forgehive. Claude reads them at every session start. Write to them directly in your editor, or let Claude append to them at session end.
|
|
97
|
+
|
|
98
|
+
| File | What to put here |
|
|
99
|
+
|---|---|
|
|
100
|
+
| `project.md` | Architecture decisions, goals, open questions |
|
|
101
|
+
| `feedback.md` | Things Claude got wrong, things that worked well |
|
|
102
|
+
| `stack.md` | Auth patterns, deploy targets, things the scanner missed |
|
|
103
|
+
| `adrs/` | Architecture Decision Records |
|
|
104
|
+
|
|
105
|
+
**Create an ADR:**
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
fh docs adr "Use Postgres over MongoDB"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**List all ADRs:**
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
fh memory adr list
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**View all memory:**
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
fh memory show
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
**Export for sharing:**
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
fh memory snapshot export ./team-memory.json
|
|
127
|
+
fh memory snapshot import ./team-memory.json # on another machine (skips existing files)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Share with your team via git:**
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
fh sync push # push .forgehive/memory/ to a dedicated git branch
|
|
134
|
+
fh sync pull # pull on another machine
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Keeping Context Fresh
|
|
140
|
+
|
|
141
|
+
Claude's context drifts when the codebase changes significantly. Run:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
fh scan --check # is the snapshot still current? (exits 1 if outdated)
|
|
145
|
+
fh scan --update # re-scan and update capabilities.yaml
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Put `fh scan --check` in your CI pipeline to alert when the context needs refreshing.
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Documentation
|
|
153
|
+
|
|
154
|
+
Generate documentation from your project's stack, memory, and git history:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
fh docs # list existing documentation
|
|
158
|
+
fh docs user # user guide → docs/user-guide.md
|
|
159
|
+
fh docs api # API reference from exports → docs/api.md
|
|
160
|
+
fh docs onboard # onboarding doc → ONBOARDING.md
|
|
161
|
+
fh docs changelog # semantic changelog → CHANGELOG.md
|
|
162
|
+
fh docs changelog --since v1.0 # only changes since a tag
|
|
163
|
+
fh docs adr "<title>" # Architecture Decision Record
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Custom output paths:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
fh docs user --output ./guides/getting-started.md
|
|
170
|
+
fh docs api --output ./docs/reference.md
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## Security
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
fh security scan # scan for secrets + SAST vulnerabilities
|
|
179
|
+
fh security deps # check npm dependencies for CVEs
|
|
180
|
+
fh security report # CISO-ready Markdown report
|
|
181
|
+
fh security report gdpr # GDPR-specific checks
|
|
182
|
+
fh security report soc2 # SOC 2 relevant controls
|
|
183
|
+
fh security report hipaa # HIPAA technical safeguards
|
|
184
|
+
fh security audit # view the JSONL audit trail
|
|
185
|
+
fh security permissions # show per-agent file access rules
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
`fh security scan` exits with code 1 if CRITICAL or HIGH findings exist — safe to use as a CI gate. Secrets are never stored verbatim: only the first 6 characters appear in output, followed by `***`.
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Story Cards and Sprint Planning
|
|
193
|
+
|
|
194
|
+
Lightweight agile tracking inside `.forgehive/memory/`:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
# Epics
|
|
198
|
+
fh epic create "User Authentication" --goal "Users can log in securely"
|
|
199
|
+
fh epic list
|
|
200
|
+
fh epic show EPC-1
|
|
201
|
+
|
|
202
|
+
# Stories
|
|
203
|
+
fh story create "As a user I want to log in" --epic EPC-1 --points 3
|
|
204
|
+
fh story list
|
|
205
|
+
fh story show US-1
|
|
206
|
+
fh story sprint US-1 # pull into current sprint
|
|
207
|
+
fh story done US-1 # mark done
|
|
208
|
+
fh story done US-1 --points 5 # mark done and record actual points
|
|
209
|
+
|
|
210
|
+
# Velocity
|
|
211
|
+
fh velocity record sprint-3 --committed 21 --delivered 18
|
|
212
|
+
fh velocity show # history + rolling average + capacity recommendation
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
In a Claude Code session, run `/fh-sprint` to let Claude read the backlog and velocity data and suggest a realistic sprint scope.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Party Mode — Parallel Agent Sessions
|
|
220
|
+
|
|
221
|
+
Party Mode runs specialized agent sets in parallel, each in an isolated git worktree. Use this for reviews, design sessions, or full-release audits.
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
fh party run # start the default (build) party
|
|
225
|
+
fh party status # check active sessions
|
|
226
|
+
fh party cleanup # remove finished worktrees
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**Available party sets — trigger in Claude Code with the slash command:**
|
|
230
|
+
|
|
231
|
+
| Slash Command | Agents | Use for |
|
|
232
|
+
|---|---|---|
|
|
233
|
+
| `/party` | Viktor + Kai + Sam | Feature development |
|
|
234
|
+
| `/design-party` | Suki + Viktor | UI/UX and architecture |
|
|
235
|
+
| `/review-party` | Kai + Sam + Eli | Code review, tests, docs |
|
|
236
|
+
| `/security-party` | Vera + Sam | Security audit |
|
|
237
|
+
| `/full-party` | All 8 agents | Major releases |
|
|
238
|
+
|
|
239
|
+
Each agent works in its own worktree branch. After the party completes, review each agent's findings and merge selectively.
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Slash Commands in Claude Code
|
|
244
|
+
|
|
245
|
+
These commands are available inside any Claude Code session in a forgehive-initialized project:
|
|
246
|
+
|
|
247
|
+
| Command | What it does |
|
|
248
|
+
|---|---|
|
|
249
|
+
| `/fh-sprint` | Sprint planning from backlog + velocity data |
|
|
250
|
+
| `/fh-ship` | Pre-ship checklist: tests, diff, PR draft |
|
|
251
|
+
| `/fh-review` | Structured code review |
|
|
252
|
+
| `/fh-hotfix` | Minimal hotfix protocol (< 50 lines rule) |
|
|
253
|
+
| `/fh-test-this` | Generate tests for the current file |
|
|
254
|
+
| `/fh-docs` | Interactive documentation generation |
|
|
255
|
+
| `/fh-start-task` | Start a new feature branch with full context |
|
|
256
|
+
| `/fh-deploy` | Pre-deploy checklist |
|
|
257
|
+
| `/party` | Start build party (Viktor + Kai + Sam) |
|
|
258
|
+
| `/design-party` | Start design party (Suki + Viktor) |
|
|
259
|
+
| `/review-party` | Start review party (Kai + Sam + Eli) |
|
|
260
|
+
| `/security-party` | Start security party (Vera + Sam) |
|
|
261
|
+
| `/full-party` | Start all 8 agents |
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## MCP — Connecting External Services
|
|
266
|
+
|
|
267
|
+
Wire Claude Code to external services in one command:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
fh wire linear # Linear issue tracker
|
|
271
|
+
fh wire github # GitHub
|
|
272
|
+
fh wire slack # Slack
|
|
273
|
+
fh wire notion # Notion
|
|
274
|
+
fh wire postgres # PostgreSQL
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Also supported: `sentry`, `jira`, `pagerduty`, `datadog`, `figma`.
|
|
278
|
+
|
|
279
|
+
Store API keys securely (encrypted at `~/.forgehive/credentials.json`, chmod 600):
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
fh mcp auth add github GITHUB_TOKEN=ghp_yourtoken
|
|
283
|
+
fh mcp auth add linear LINEAR_API_KEY=lin_api_key
|
|
284
|
+
fh mcp auth list # see which services have credentials
|
|
285
|
+
fh mcp auth remove github # delete credentials for a service
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Cost Tracking
|
|
291
|
+
|
|
292
|
+
```bash
|
|
293
|
+
fh cost # all-time Claude session costs
|
|
294
|
+
fh cost today # today's costs
|
|
295
|
+
fh cost week # this week
|
|
296
|
+
fh cost --limit 20 # set a hard spend limit of $20
|
|
297
|
+
fh cost --alert 15 # set an alert threshold at $15
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Spend limits are enforced every time `fh cost` runs. At the alert threshold: warning printed. At the hard limit: non-zero exit — usable as a CI gate.
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## CI Integration
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
fh ci # CI health report
|
|
308
|
+
fh ci --format markdown # Markdown output
|
|
309
|
+
fh ci --fail-on high # exit 1 on HIGH or CRITICAL findings
|
|
310
|
+
fh ci --init # scaffold .github/workflows/forgehive.yml
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
`fh ci` aggregates security scan, dependency audit, and test results. The `--fail-on` flag controls which severity level blocks the pipeline.
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Removing forgehive
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
fh rollback
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
Removes `.forgehive/` and the forgehive block from `CLAUDE.md`. Everything else in `CLAUDE.md` is preserved. `AGENTS.md` is left in place (it's a standard file other tools use too — delete it manually if you don't want it).
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Troubleshooting
|
|
328
|
+
|
|
329
|
+
**`fh init` says forgehive is already initialized**
|
|
330
|
+
Use `fh init --force` to re-initialize, or `fh scan --update` to refresh only the scan.
|
|
331
|
+
|
|
332
|
+
**Claude doesn't seem to pick up the context**
|
|
333
|
+
Make sure `fh confirm` was run — check `fh status`. The context is inactive while `status: draft`.
|
|
334
|
+
|
|
335
|
+
**`fh scan --check` exits with an error**
|
|
336
|
+
Your codebase has changed significantly since the last scan. Run `fh scan --update` to refresh.
|
|
337
|
+
|
|
338
|
+
**Party Mode: worktrees left over after a session**
|
|
339
|
+
Run `fh party cleanup` to remove all finished worktrees.
|
|
340
|
+
|
|
341
|
+
**`fh cost` shows no data**
|
|
342
|
+
Cost tracking reads `~/.claude/` — requires Claude Code to be installed and to have run at least one session.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
You are running the ForgeHive refactor workflow.
|
|
2
|
+
|
|
3
|
+
## Refactor Workflow
|
|
4
|
+
|
|
5
|
+
**Agenten:** Kai (Plan) → Viktor + Sam + Eli (parallel)
|
|
6
|
+
|
|
7
|
+
**Mission:** Strukturierter Code-Umbau — erst verstehen und planen, dann parallel implementieren, testen und dokumentieren.
|
|
8
|
+
|
|
9
|
+
## Protocol
|
|
10
|
+
|
|
11
|
+
### Step 0: Scope klären
|
|
12
|
+
|
|
13
|
+
Frage den User:
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
**Was soll refactored werden?**
|
|
18
|
+
|
|
19
|
+
Gib eine der folgenden Angaben:
|
|
20
|
+
- **Freie Beschreibung** — z.B. „die Docs-Generierung soll sauberer modularisiert werden"
|
|
21
|
+
- **Dateipfade** — z.B. `src/docs.ts`, `src/cli.ts`
|
|
22
|
+
- **Ziel-Statement** — z.B. „extrahiere generateUserGuide in ein eigenes Modul"
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
Wenn der Scope unklar ist: frage nach, bis das Ziel eindeutig ist.
|
|
27
|
+
|
|
28
|
+
Dann führt **Kai** (Principal Engineer) die Ist-Analyse durch:
|
|
29
|
+
1. Lese alle betroffenen Dateien
|
|
30
|
+
2. Führe `git diff HEAD` aus (aktuelle uncommitted Änderungen)
|
|
31
|
+
3. Liste alle Exports der Scope-Dateien und wo sie importiert werden
|
|
32
|
+
4. Identifiziere Abhängigkeiten (wer importiert was aus den Scope-Dateien)
|
|
33
|
+
|
|
34
|
+
### Step 1: Refactor-Plan erstellen (Kai)
|
|
35
|
+
|
|
36
|
+
Erstelle folgenden Plan:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
## Refactor-Plan: <Ziel>
|
|
40
|
+
|
|
41
|
+
**Ziel:** <Ein Satz>
|
|
42
|
+
|
|
43
|
+
**Betroffene Dateien:**
|
|
44
|
+
- src/foo.ts → src/foo/index.ts + src/foo/helpers.ts
|
|
45
|
+
|
|
46
|
+
**Bewegte Exports:**
|
|
47
|
+
- `helperFn` aus foo.ts → foo/helpers.ts (re-exportiert aus foo/index.ts)
|
|
48
|
+
|
|
49
|
+
**Breaking Changes:** keine / [Liste]
|
|
50
|
+
|
|
51
|
+
**Risiken:** [z.B. zirkuläre Imports möglich bei X]
|
|
52
|
+
|
|
53
|
+
**Nicht geändert:** [öffentliche API, bestehende Tests für Y, ...]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
⚠️ **USER-APPROVAL GATE** — kein Code ohne explizites OK. Warte auf Bestätigung.
|
|
57
|
+
|
|
58
|
+
### Step 2: Parallel Party starten
|
|
59
|
+
|
|
60
|
+
Nach Approval:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
fh party run refactor
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Alle drei Agenten erhalten Kai's genehmigten Refactor-Plan als Kontext.
|
|
67
|
+
|
|
68
|
+
**Viktor** (Systems Architect):
|
|
69
|
+
- Implementiert die Änderungen Datei für Datei nach Plan
|
|
70
|
+
- Darf nicht ohne User-Freigabe vom Plan abweichen
|
|
71
|
+
- Meldet unvorhergesehene Abhängigkeiten explizit
|
|
72
|
+
|
|
73
|
+
**Sam** (Quality Architect):
|
|
74
|
+
- Liest bestehende Tests für betroffene Dateien
|
|
75
|
+
- Schreibt neue Tests für umbenannte/verschobene Exports
|
|
76
|
+
- Fixiert Tests die durch den Refactor brechen
|
|
77
|
+
- Führt Testsuit am Ende aus — alle grün?
|
|
78
|
+
|
|
79
|
+
**Eli** (Documentation Architect):
|
|
80
|
+
- Aktualisiert Inline-Kommentare in geänderten Dateien
|
|
81
|
+
- Aktualisiert Referenzen in README und docs/
|
|
82
|
+
- Schreibt CHANGELOG-Eintrag für den Refactor
|
|
83
|
+
|
|
84
|
+
### Step 3: Verifikation
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
fh party status
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Synthesebericht erstellen:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
## Refactor-Abschlussbericht
|
|
94
|
+
|
|
95
|
+
### Viktor — Implementierung
|
|
96
|
+
[Was wurde umgebaut]
|
|
97
|
+
|
|
98
|
+
### Sam — Tests
|
|
99
|
+
[Welche Tests angepasst/neu — Teststatus: ✅ alle grün / ⚠️ N fehlgeschlagen]
|
|
100
|
+
|
|
101
|
+
### Eli — Dokumentation
|
|
102
|
+
[Was wurde aktualisiert]
|
|
103
|
+
|
|
104
|
+
### Offene Punkte
|
|
105
|
+
[Was blieb unerledigt oder braucht Follow-up]
|
|
106
|
+
|
|
107
|
+
### Verdict: ✅ Fertig / ⚠️ Offen
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Abschlussfrage: **„Soll ich direkt einen Commit erstellen?"**
|
|
111
|
+
|
|
112
|
+
### Step 4: Cleanup
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
fh party cleanup
|
|
116
|
+
```
|
|
@@ -8,55 +8,74 @@ You are running a Review Party using ForgeHive.
|
|
|
8
8
|
|
|
9
9
|
## Protocol
|
|
10
10
|
|
|
11
|
-
### Step
|
|
11
|
+
### Step 0: Scope selection
|
|
12
|
+
|
|
13
|
+
**Before doing anything else**, ask the user what to review:
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
**Was soll reviewed werden?**
|
|
18
|
+
|
|
19
|
+
1. **Aktuelle Änderungen** — uncommitted working tree (`git diff HEAD`)
|
|
20
|
+
2. **Letzter Commit** — `git diff HEAD~1..HEAD`
|
|
21
|
+
3. **Branch vs main** — alles seit dem Abzweigen (`git diff main...HEAD`)
|
|
22
|
+
4. **Letzte N Commits** — Anzahl angeben
|
|
23
|
+
5. **Commit-Range** — z.B. `abc123..def456`
|
|
24
|
+
6. **Spezifische Dateien** — Dateipfade angeben
|
|
25
|
+
7. **PR** — PR-Nummer oder Branch-Name angeben
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
Wait for the user's answer. Then resolve the scope to a concrete `git diff` command and show the `--stat` output to confirm:
|
|
12
30
|
|
|
13
|
-
Run:
|
|
14
31
|
```bash
|
|
15
|
-
|
|
32
|
+
# Example for option 3:
|
|
33
|
+
git diff main...HEAD --stat
|
|
16
34
|
```
|
|
17
35
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
### Step 2: Set the scope
|
|
36
|
+
If the diff is empty or the result looks wrong, say so and ask the user to clarify before proceeding.
|
|
21
37
|
|
|
22
|
-
|
|
38
|
+
### Step 1: Launch the party
|
|
23
39
|
|
|
40
|
+
Once the scope is confirmed, run:
|
|
24
41
|
```bash
|
|
25
|
-
|
|
42
|
+
fh party run review
|
|
26
43
|
```
|
|
27
44
|
|
|
28
|
-
|
|
45
|
+
This spins up isolated git worktrees for Kai, Sam, and Eli.
|
|
46
|
+
|
|
47
|
+
### Step 2: Dispatch agents in parallel
|
|
29
48
|
|
|
30
|
-
|
|
49
|
+
Pass each agent the confirmed scope and diff summary. Each agent works independently:
|
|
31
50
|
|
|
32
|
-
**Kai** (Principal Engineer)
|
|
33
|
-
- Reviews code quality and correctness
|
|
51
|
+
**Kai** (Principal Engineer):
|
|
52
|
+
- Reviews code quality and correctness within the scoped diff
|
|
34
53
|
- Flags bugs, logic errors, and anti-patterns
|
|
35
54
|
- Checks for ambiguous naming, hidden coupling, and missing error handling
|
|
36
55
|
- Labels findings: `[BUG]`, `[DESIGN]`, `[NIT]`, `[Q]`, `[+]`
|
|
37
56
|
|
|
38
|
-
**Sam** (Quality Architect)
|
|
57
|
+
**Sam** (Quality Architect):
|
|
39
58
|
- Checks test coverage for the changed code
|
|
40
59
|
- Identifies missing edge cases, error states, and boundary conditions
|
|
41
|
-
- Flags
|
|
42
|
-
- Proposes specific tests for
|
|
60
|
+
- Flags high-risk untested paths
|
|
61
|
+
- Proposes specific tests for gaps
|
|
43
62
|
|
|
44
|
-
**Eli** (Documentation Architect)
|
|
45
|
-
- Checks if README and docs reflect the changes
|
|
63
|
+
**Eli** (Documentation Architect):
|
|
64
|
+
- Checks if README and docs reflect the changes in scope
|
|
46
65
|
- Flags missing or outdated inline documentation
|
|
47
|
-
- Reviews
|
|
66
|
+
- Reviews CHANGELOG entries for accuracy
|
|
48
67
|
- Checks that public API changes are documented
|
|
49
68
|
|
|
50
|
-
### Step
|
|
69
|
+
### Step 3: Check status
|
|
51
70
|
|
|
52
|
-
After each agent completes
|
|
71
|
+
After each agent completes:
|
|
53
72
|
```bash
|
|
54
73
|
fh party status
|
|
55
74
|
```
|
|
56
75
|
|
|
57
|
-
### Step
|
|
76
|
+
### Step 4: Synthesize findings
|
|
58
77
|
|
|
59
|
-
|
|
78
|
+
Merge the three reports into a unified review:
|
|
60
79
|
|
|
61
80
|
1. **Blocking issues** — anything from Kai or Sam that must be fixed before merge
|
|
62
81
|
2. **Test gaps** — Sam's missing coverage items
|
|
@@ -65,7 +84,7 @@ Collect the three reports and merge them into a unified review:
|
|
|
65
84
|
|
|
66
85
|
Present the synthesized report to the user and ask: **"Soll ich die Blocking Issues direkt fixen?"**
|
|
67
86
|
|
|
68
|
-
### Step
|
|
87
|
+
### Step 5: Cleanup
|
|
69
88
|
|
|
70
89
|
```bash
|
|
71
90
|
fh party cleanup
|
|
@@ -41,3 +41,11 @@ sets:
|
|
|
41
41
|
models:
|
|
42
42
|
vera: claude-opus-4-7
|
|
43
43
|
sam: claude-sonnet-4-6
|
|
44
|
+
refactor:
|
|
45
|
+
agents: [viktor, sam, eli]
|
|
46
|
+
trigger: "/fh-refactor"
|
|
47
|
+
description: "Refactor — Implementierung + Tests + Doku parallel"
|
|
48
|
+
models:
|
|
49
|
+
viktor: claude-opus-4-7
|
|
50
|
+
sam: claude-sonnet-4-6
|
|
51
|
+
eli: claude-sonnet-4-6
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "forgehive",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.8",
|
|
4
4
|
"description": "Context-aware AI development environment — one binary, your stack.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
},
|
|
10
10
|
"files": [
|
|
11
11
|
"dist/",
|
|
12
|
+
"docs/user-guide.md",
|
|
12
13
|
"forgehive/"
|
|
13
14
|
],
|
|
14
15
|
"keywords": [
|