Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@aws-sdk/client-sts": "^3.921.0",
"@aws-sdk/credential-provider-sso": "^3.921.0",
"@openai/agents": "^0.2.1",
"@supabase/supabase-js": "^2.81.1",
"axios": "^1.12.2",
"chalk": "^5.6.2",
"cookie-parser": "^1.4.7",
Expand Down
102 changes: 102 additions & 0 deletions server/agent/api_calls_doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# MCP CI/CD Builder – API Usage Guide

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.

---

## πŸš€ Overview
The Wizard Agent provides a multi‑step workflow for generating and committing CI/CD pipelines via API calls:

1. **User requests a pipeline** β†’ Agent generates YAML
2. **Agent asks for confirmation** β†’ `requires_confirmation: true`
3. **User confirms** β†’ Agent commits workflow to GitHub

The session must include a valid `mcp_session` cookie for authentication.

---

## πŸ“Œ Step 1 β€” Generate a Pipeline
Send a prompt describing the pipeline you want.

```bash
curl -X POST http://localhost:3000/agent/wizard/ai \
-H "Content-Type: application/json" \
-H "Cookie: mcp_session=YOUR_SESSION_TOKEN" \
-d '{
"prompt": "Generate pipeline for PVeazie951/google-extention-ai-summarizer"
}'
```

### βœ” Expected Response
```json
{
"success": true,
"requires_confirmation": true,
"message": "A pipeline has been generated. Would you like me to commit this workflow file?",
"generated_yaml": "...",
"pipeline_metadata": { ... }
}
```

The agent stores the repo name + generated YAML internally for the next step.

---

## πŸ“Œ Step 2 β€” Confirm the Commit
Once the agent asks for confirmation, send a follow-up prompt such as:

```bash
curl -X POST http://localhost:3000/agent/wizard/ai \
-H "Content-Type: application/json" \
-H "Cookie: mcp_session=YOUR_SESSION_TOKEN" \
-d '{
"prompt": "yes commit"
}'
```

### βœ” Expected Response
```json
{
"success": true,
"tool_called": "pipeline_commit",
"committed_repo": "PVeazie951/google-extention-ai-summarizer",
"committed_path": ".github/workflows/ci.yml",
"sha": "...",
"html_url": "https://github.com/.../ci.yml"
}
```
This confirms the workflow file was successfully committed to the repo.

---

## πŸ›‘ How Confirmation Works
To avoid accidental commits:

- Only explicit intent triggers `pipeline_commit` (e.g., **"yes commit", "commit workflow", "apply pipeline"**)
- The agent now **ignores model-generated phrases** like "recent commits" or "show commits" during confirmation
- User intent always overrides the agent's reasoning

This makes the multi-step flow consistent and safe.

---

## πŸ“Œ Extra: Listing Repositories
You can ask the agent anything:

```bash
curl -X POST http://localhost:3000/agent/wizard/ai \
-H "Content-Type: application/json" \
-H "Cookie: mcp_session=YOUR_SESSION_TOKEN" \
-d '{ "prompt": "List my repositories" }'
```

---

## βœ… Summary
- Use the Wizard Agent API to generate pipelines from natural language prompts
- The agent **requires confirmation** before committing workflows
- Multi-step flow works via persistent session state
- Commits are safe and deterministic due to improved intent detection

If you need a longer doc, diagrams, or frontend usage examples, I can generate those too.

Loading
Loading