|
| 1 | +# MCP CI/CD Builder – API Usage Guide |
| 2 | + |
| 3 | +This short guide explains how to use the **Wizard Agent API** to generate pipelines, confirm workflows, and commit the final YAML to GitHub. It also highlights the new **confirmation flow** that ensures pipelines are only committed when the user explicitly approves. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 🚀 Overview |
| 8 | +The Wizard Agent provides a multi‑step workflow for generating and committing CI/CD pipelines via API calls: |
| 9 | + |
| 10 | +1. **User requests a pipeline** → Agent generates YAML |
| 11 | +2. **Agent asks for confirmation** → `requires_confirmation: true` |
| 12 | +3. **User confirms** → Agent commits workflow to GitHub |
| 13 | + |
| 14 | +The session must include a valid `mcp_session` cookie for authentication. |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## 📌 Step 1 — Generate a Pipeline |
| 19 | +Send a prompt describing the pipeline you want. |
| 20 | + |
| 21 | +```bash |
| 22 | +curl -X POST http://localhost:3000/agent/wizard/ai \ |
| 23 | + -H "Content-Type: application/json" \ |
| 24 | + -H "Cookie: mcp_session=YOUR_SESSION_TOKEN" \ |
| 25 | + -d '{ |
| 26 | + "prompt": "Generate pipeline for PVeazie951/google-extention-ai-summarizer" |
| 27 | + }' |
| 28 | +``` |
| 29 | + |
| 30 | +### ✔ Expected Response |
| 31 | +```json |
| 32 | +{ |
| 33 | + "success": true, |
| 34 | + "requires_confirmation": true, |
| 35 | + "message": "A pipeline has been generated. Would you like me to commit this workflow file?", |
| 36 | + "generated_yaml": "...", |
| 37 | + "pipeline_metadata": { ... } |
| 38 | +} |
| 39 | +``` |
| 40 | + |
| 41 | +The agent stores the repo name + generated YAML internally for the next step. |
| 42 | + |
| 43 | +--- |
| 44 | + |
| 45 | +## 📌 Step 2 — Confirm the Commit |
| 46 | +Once the agent asks for confirmation, send a follow-up prompt such as: |
| 47 | + |
| 48 | +```bash |
| 49 | +curl -X POST http://localhost:3000/agent/wizard/ai \ |
| 50 | + -H "Content-Type: application/json" \ |
| 51 | + -H "Cookie: mcp_session=YOUR_SESSION_TOKEN" \ |
| 52 | + -d '{ |
| 53 | + "prompt": "yes commit" |
| 54 | + }' |
| 55 | +``` |
| 56 | + |
| 57 | +### ✔ Expected Response |
| 58 | +```json |
| 59 | +{ |
| 60 | + "success": true, |
| 61 | + "tool_called": "pipeline_commit", |
| 62 | + "committed_repo": "PVeazie951/google-extention-ai-summarizer", |
| 63 | + "committed_path": ".github/workflows/ci.yml", |
| 64 | + "sha": "...", |
| 65 | + "html_url": "https://github.com/.../ci.yml" |
| 66 | +} |
| 67 | +``` |
| 68 | +This confirms the workflow file was successfully committed to the repo. |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +## 🛡 How Confirmation Works |
| 73 | +To avoid accidental commits: |
| 74 | + |
| 75 | +- Only explicit intent triggers `pipeline_commit` (e.g., **"yes commit", "commit workflow", "apply pipeline"**) |
| 76 | +- The agent now **ignores model-generated phrases** like "recent commits" or "show commits" during confirmation |
| 77 | +- User intent always overrides the agent's reasoning |
| 78 | + |
| 79 | +This makes the multi-step flow consistent and safe. |
| 80 | + |
| 81 | +--- |
| 82 | + |
| 83 | +## 📌 Extra: Listing Repositories |
| 84 | +You can ask the agent anything: |
| 85 | + |
| 86 | +```bash |
| 87 | +curl -X POST http://localhost:3000/agent/wizard/ai \ |
| 88 | + -H "Content-Type: application/json" \ |
| 89 | + -H "Cookie: mcp_session=YOUR_SESSION_TOKEN" \ |
| 90 | + -d '{ "prompt": "List my repositories" }' |
| 91 | +``` |
| 92 | + |
| 93 | +--- |
| 94 | + |
| 95 | +## ✅ Summary |
| 96 | +- Use the Wizard Agent API to generate pipelines from natural language prompts |
| 97 | +- The agent **requires confirmation** before committing workflows |
| 98 | +- Multi-step flow works via persistent session state |
| 99 | +- Commits are safe and deterministic due to improved intent detection |
| 100 | + |
| 101 | +If you need a longer doc, diagrams, or frontend usage examples, I can generate those too. |
| 102 | + |
0 commit comments