feat: add manual export provider

This commit is contained in:
2026-06-15 11:06:00 +01:00
parent 94aaa80181
commit 1228d9f2db
3 changed files with 85 additions and 6 deletions
+32 -2
View File
@@ -87,9 +87,9 @@ Decoupled tool handlers from OpenAI implementation via a provider abstraction la
|------|-------|--------|
| test/tools/ask-chatgpt.test.js | 27 | ✅ |
| test/tools/review-plan.test.js | 28 | ✅ |
| test/tools/review-code.test.js | 28 | ✅ |
| test/tools/review-code.test.js | 27 | ✅ |
| test/tools/debug-issue.test.js | 28 | ✅ |
| test/tools/architecture-review.test.js | 28 | ✅ |
| test/tools/architecture-review.test.js | 27 | ✅ |
### New provider/config tests (3 files)
| File | Tests | Status |
@@ -103,6 +103,36 @@ Decoupled tool handlers from OpenAI implementation via a provider abstraction la
- `npm start` → tools/list shows same 5 tools, unchanged schemas
- Zero regression in existing test coverage
## Completed (Phase 8) — Manual Export Provider ✅
### src/providers/manual-export.js
- `manualExportProvider.send(request, config)` — zero-API-cost provider
- Wraps pre-built prompt in copy/paste-ready format for ChatGPT Web (`https://chatgpt.com`)
- Detects tool name from input fields: `debug_issue`, `review_code`, `architecture_review`, `review_plan`, `ask_chatgpt`
- Adds box-delimited display with `│` prefixes, corner delimiters (┌ ┐ └ ┘)
- Includes instructions section (5 numbered steps), metadata section (tool, provider, length)
- Warns on prompts over 30k characters
- Handles empty/missing prompt gracefully with advisory message
- Preserves unicode, markdown code blocks, JSON, special HTML characters exactly
### Factory integration
- `"manual"` added to SUPPORTED_PROVIDERS whitelist in `src/providers/factory.js`
- `CHATGPT_MCP_PROVIDER=manual` switches all tool handlers to manual export mode
- Defaults to `"openai"` when not set — OpenAI behaviour unchanged
- Same provider interface: `{ send(request, config) => Promise<{ content: string }> }`
### Tests added (Phase 8)
| File | Tests | Coverage |
|------|-------|----------|
| test/providers/manual-export.test.js | 56 | structure, tool detection, unicode, long prompts, edge cases, repeatability, visual layout |
| test/providers/factory.test.js | +9 manual provider tests | factory integration with "manual" |
### Final verification
- All 644 tests pass across 21 test files, zero regressions
- `npm start` → tools/list shows same 5 tools, unchanged schemas
- No `chat.openai.com` references in codebase — only `chatgpt.com`
- MCP initialize handshake succeeds with chatgpt-mcp v0.1.0
## Completed (Phase 5)
**All five MCP tools registered:** ask_chatgpt, review_plan, review_code, debug_issue, architecture_review.