import { VibeKit } from "vibekit";
import { createE2BProvider } from "@vibe-kit/e2b";
const e2bProvider = createE2BProvider({
apiKey: process.env.E2B_API_KEY!,
});
// For operations that require code generation, you'll need agent and sandbox
const vibkitWithAgent = new VibeKit()
.withAgent({
type: "claude",
provider: "anthropic",
apiKey: process.env.ANTHROPIC_API_KEY,
model: "claude-sonnet-4-20250514"
})
.withSandbox(e2bProvider)
.withSecrets({
GH_TOKEN: process.env.GITHUB_TOKEN,
});
// Clone repository and generate code changes
await vibkitWithAgent.cloneRepository("myorg/myrepo");
await vibkitWithAgent.generateCode({
prompt: "Add a new user authentication feature",
mode: "code",
branch: "feature/auth"
});
await vibkitWithAgent.pushToBranch();
const prResponse = await vibkitWithAgent.createPullRequest(
"myorg/myrepo", // Repository parameter now required
{
name: "feature",
color: "0366d6",
description: "New feature"
},
"feature"
);
console.log(`Created PR #${prResponse.number}`);
// After review and approval, merge the PR (only needs GitHub config)
const vibkitSimple = new VibeKit()
.withSecrets({
GH_TOKEN: process.env.GITHUB_TOKEN,
});
const mergeResult = await vibkitSimple.mergePullRequest({
repository: "myorg/myrepo", // Repository parameter now required
pullNumber: prResponse.number,
mergeMethod: "squash"
});
if (mergeResult.merged) {
console.log(`Successfully merged PR #${prResponse.number}`);
}