Commit 1ee6707
feat(promptfoo): add
## Why
Team members — including non-technical people — need a way to run the
promptfoo target discovery agent without setting up a local dev
environment. A Slack-based interface lets anyone DM the Crab bot with a
target specification and get back a ready-to-use `promptfooconfig.yaml`.
## What
Adds `crab pf serve`, a local Slack polling daemon that:
- **Polls for DMs** to the Crab bot, filtering by a `pf:` trigger prefix
- **Runs the discovery agent** locally using the operator's own API keys
- **Posts results** (generated config files) back to the Slack thread
- **Handles file attachments** — users can attach API specs, curl
commands, etc.
### Files changed
| File | Change |
|------|--------|
| `plugins/promptfoo/src/slack.ts` | **New** — Slack Web API helpers
using native `fetch()`, zero new dependencies. Token resolution, user
lookup, DM channel management, message posting, reactions, file
download/upload (3-step flow). |
| `plugins/promptfoo/src/serve.ts` | **New** — Daemon loop with
`--setup` flow (prompts for Slack username and provider preferences),
poll loop, job directory management. Defaults to `openai:gpt-5` with
`reasoning: low`. |
| `plugins/promptfoo/src/cli.ts` | **Modified** — Routes `serve`
subcommand, adds `--reasoning` flag support, updates help text. |
| `plugins/promptfoo/src/agent/providers.ts` | **Modified** — Adds
`reasoningEffort` support for GPT-5/o-series models
(`max_completion_tokens` instead of `max_tokens`, skips `temperature`
for reasoning models). |
| `plugins/promptfoo/package-lock.json` | **Modified** — Minor peer
dependency annotation changes. |
## How to Test
1. Set `CRAB_SLACK_BOT_TOKEN` env var (or add `slack.bot_token` to
`~/.crabcode/config.yaml`)
2. Set `OPENAI_API_KEY` env var
3. Run `crab pf serve --setup` and follow prompts to configure your
Slack username
4. Run `crab pf serve -v` to start the daemon in verbose mode
5. DM the Crab bot in Slack with `pf: My API is at
http://localhost:8080/chat`
6. Verify the bot acknowledges with a reaction, runs the agent, and
posts back a `promptfooconfig.yaml`
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>crab pf serve Slack polling daemon (#37)1 parent 916d46f commit 1ee6707
File tree
5 files changed
+875
-5
lines changed- plugins/promptfoo
- src
- agent
5 files changed
+875
-5
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
76 | 77 | | |
77 | 78 | | |
78 | 79 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
| |||
160 | 167 | | |
161 | 168 | | |
162 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
163 | 175 | | |
164 | 176 | | |
165 | 177 | | |
| |||
0 commit comments