diff --git a/flaky-tests/use-mcp-server/configuration/README.md b/flaky-tests/use-mcp-server/configuration/README.md index d210e990..ce81055a 100644 --- a/flaky-tests/use-mcp-server/configuration/README.md +++ b/flaky-tests/use-mcp-server/configuration/README.md @@ -1,3 +1,3 @@ # Configuration -
Cover image
Claude Codeclaude.pngclaude-code-cli.md
Cursorcursor.pngcursor-ide.md
GitHub Copilotgithub copilot.pnggithub-copilot-ide.md
Geminigemini.pnggemini-cli.md
+
Cover image
Claude Codeclaude.pngclaude-code-cli.md
Claude Code Pluginclaude.pngclaude-code-plugin.md
Cursorcursor.pngcursor-ide.md
GitHub Copilotgithub copilot.pnggithub-copilot-ide.md
Geminigemini.pnggemini-cli.md
diff --git a/flaky-tests/use-mcp-server/configuration/claude-code-plugin.md b/flaky-tests/use-mcp-server/configuration/claude-code-plugin.md new file mode 100644 index 00000000..8207b8ab --- /dev/null +++ b/flaky-tests/use-mcp-server/configuration/claude-code-plugin.md @@ -0,0 +1,73 @@ +--- +description: Install the Trunk plugin for Claude Code +--- + +# Claude Code Plugin + +The Trunk plugin for Claude Code bundles the MCP server connection, slash commands, and skills into a single install. This is the recommended way to connect Trunk to Claude Code. + +## Install the Plugin + +```bash +/plugin install trunk@https://github.com/trunk-io/claude-code-plugin +``` + +This adds the Trunk MCP server and gives you access to slash commands and skills that activate automatically. + +You can also install directly from the repo without waiting for directory approval: + +## Authentication + +After installing, Claude Code will prompt you to authenticate with Trunk on first use. + +1. Run any Trunk command (e.g., `/trunk:fix-flaky`) or trigger an MCP tool call +2. Claude Code will open a browser window for OAuth login +3. Log in with your Trunk account and authorize the connection +4. You'll see `Authentication successful. Connected to trunk.` back in the terminal + +## Slash Commands + +| Command | What it does | +|---|---| +| `/trunk:fix-flaky ` | Retrieves root cause analysis for a flaky test and offers to apply the fix | +| `/trunk:why-flaky ` | Explains why a test is flaky without making changes — good for triage | +| `/trunk:setup-uploads` | Detects your test framework and CI provider, then generates the upload configuration | + +### Fix a flaky test + +``` +/trunk:fix-flaky test_user_login +``` + +Trunk analyzes the test, explains the root cause (race condition, shared state, time dependency, etc.), and shows a proposed fix with a diff. Say yes to apply the changes directly. + +### Understand why a test is flaky + +``` +/trunk:why-flaky test_payment_processing +``` + +Same analysis as `fix-flaky`, but read-only. Useful when you want to understand the problem before deciding how to handle it — especially for tests you didn't write. + +### Set up test uploads + +``` +/trunk:setup-uploads +``` + +Walks through configuring your repo to upload test results to Trunk. The plugin detects your CI provider and test framework automatically, then generates ready-to-paste config snippets. + +## Skills + +The plugin includes two skills that activate automatically based on context: + +**Flaky test patterns** — activates when you're debugging or writing tests. Provides common flaky test patterns and proven fixes so Claude Code can reference them without you asking. + +**Trunk CI setup** — activates when you're editing CI configuration files (`.github/workflows/`, `.circleci/config.yml`, etc.). Provides best practices for test upload configuration. + +## Also Available For + +- [Cursor](cursor-ide.md) (one-click install) +- [GitHub Copilot](github-copilot-ide.md) (one-click install) +- [Gemini CLI](gemini-cli.md) +- [Any MCP client](https://github.com/trunk-io/mcp-server) — manual configuration diff --git a/summary.md b/summary.md index be98eef2..36333d23 100644 --- a/summary.md +++ b/summary.md @@ -119,6 +119,7 @@ * [Cursor (IDE)](flaky-tests/use-mcp-server/configuration/cursor-ide.md) * [GitHub Copilot (IDE)](flaky-tests/use-mcp-server/configuration/github-copilot-ide.md) * [Claude Code (CLI)](flaky-tests/use-mcp-server/configuration/claude-code-cli.md) + * [Claude Code Plugin](flaky-tests/use-mcp-server/configuration/claude-code-plugin.md) * [Gemini (CLI)](flaky-tests/use-mcp-server/configuration/gemini-cli.md) * [MCP Tool Reference](flaky-tests/use-mcp-server/mcp-tool-reference/README.md) * [Get root cause analysis](flaky-tests/use-mcp-server/mcp-tool-reference/get-root-cause-analysis.md)