### Install Junie CLI using NPM Source: https://junie.labs.jb.gg/docs/junie-cli Installs the Junie CLI globally using Node Package Manager (NPM). This command is typically run in a terminal or command prompt. After installation, you can verify it by checking the version. ```bash npm install -g @jetbrains/junie-cli junie --version ``` -------------------------------- ### Start Junie CLI in a Project Source: https://junie.labs.jb.gg/docs/junie-cli Navigates to the root directory of a project and starts the Junie CLI. This command assumes you are already in the desired project's directory. Once started, Junie CLI provides an interactive terminal interface. ```bash cd /path/to/your/project junie ``` -------------------------------- ### Install Junie CLI using Homebrew Source: https://junie.labs.jb.gg/docs/junie-cli Installs the Junie CLI using the Homebrew package manager on macOS. This involves tapping the JetBrains Junie repository, updating Homebrew, and then installing the Junie package. The installation can be verified by checking the CLI version. ```bash brew tap jetbrains-junie/junie brew update brew install junie junie --version ``` -------------------------------- ### Junie GitLab CI/CD Setup Source: https://junie.labs.jb.gg/docs/junie-gitlab-ci-cd Instructions for setting up Junie GitLab CI/CD, including Docker installation and GitLab repository configuration. ```APIDOC ## Junie GitLab CI/CD Setup ### Docker Installation 1. **Pull the Docker image:** ``` docker pull registry.jetbrains.team/p/matterhorn/public/junie-gitlab:latest ``` 2. **Run the container with environment variables:** ``` docker run -d \ -e JUNIE_API_KEY=your_token_here \ -e GITLAB_HOST=gitlab_host \ -p 8080:8080 \ registry.jetbrains.team/p/matterhorn/public/junie-gitlab:latest ``` **Environment Variables:** | Variable | Description | Required | |---------------------------------|-----------------------------------------------------------------------------|----------| | `JUNIE_API_KEY` | Your authentication token for Junie. Get token [here]. | Yes | | `GITLAB_HOST` | Your organization's GitLab host (e.g., `https://gitlab.com`). | Yes | | `GITLAB_IGNORE_CERTIFICATE_ERRORS` | Set to `true` to ignore SSL certificate errors. Default is `false`. | No | | `GITLAB_PIPELINE_CONFIGURATION_PATH` | Path to the GitLab pipeline configuration file. Default is `.gitlab-ci.yml`. | No | ### GitLab Repository Setup 1. **Add `.gitlab-ci.yml` to your project:** Copy the provided `.gitlab-ci.yml` content into your GitLab project. 2. **Issue an access token:** In GitLab, go to Project > Settings > Access token or User settings > Access tokens and create a token named `junie` with the following: * **Role:** `Owner` * **Scope:** `api, read_api, read_repository, write_repository` 3. **Configure a webhook:** 1. Go to Project > Settings > Webhooks > Add new webhook. 2. **URL:** Set to your Junie GitLab instance (e.g., `https://HOST/api/public/gitlab/webhooks`). Use a reverse proxy if running locally. 3. **Secret token:** Enter your token. 4. **Triggers:** Enable at least the `Comments` trigger. ``` -------------------------------- ### Run Junie CLI in Non-interactive Mode Source: https://junie.labs.jb.gg/docs/junie-cli Executes Junie CLI in headless mode, suitable for CI/CD pipelines. This command first installs the CLI using NPM, then authenticates using an API key stored in the JUNIE_API_KEY environment variable, and finally runs a specified prompt to review and fix code quality issues. ```bash # Install Junie CLI npm install -g @jetbrains/junie-cli # Authenticate and use Junie junie --auth="$JUNIE_API_KEY" "Review and fix any code quality issues in the latest commit" ``` -------------------------------- ### Match git commands with literal and regex patterns Source: https://junie.labs.jb.gg/docs/action-allowlist Demonstrates how to define terminal rules using exact commands or regular expressions. The example shows a literal command 'git status' and two regex examples: one using Java Regex (`^\Qgit diff \E\S+$`) and another using standard Regex (`^git diff \S+$`) to match commands like 'git diff '. Java Regex is preferred for its security. ```text git status ``` ```regex ^\Qgit diff \E\S+$ ``` ```regex ^git diff \S+$ ``` -------------------------------- ### Start Junie CLI Interactive Session Source: https://junie.labs.jb.gg/docs/junie-cli-usage Initiates an interactive session with the Junie CLI in the terminal. This is the first step to interacting with Junie CLI for project-related tasks. ```bash junie ``` -------------------------------- ### Docker Installation for Junie GitLab CI/CD Source: https://junie.labs.jb.gg/docs/junie-gitlab-ci-cd Instructions for pulling the Junie GitLab CI/CD Docker image and running it with necessary environment variables for authentication and GitLab host configuration. ```shell docker pull registry.jetbrains.team/p/matterhorn/public/junie-gitlab:latest ``` ```shell docker run -d \ -e JUNIE_API_KEY=your_token_here \ -e GITLAB_HOST=gitlab_host \ -p 8080:8080 \ registry.jetbrains.team/p/matterhorn/public/junie-gitlab:latest ``` -------------------------------- ### Install Junie CLI with NPM Source: https://junie.labs.jb.gg/docs/junie-headless Installs the Junie CLI globally using Node Package Manager (NPM). This is a prerequisite for using the CLI on systems with Node.js and NPM installed. ```bash npm install -g @jetbrains/junie-cli ``` -------------------------------- ### GitLab CI/CD Pipeline Configuration Example Source: https://junie.labs.jb.gg/docs/junie-gitlab-ci-cd A basic structure for a `.gitlab-ci.yml` file to integrate Junie GitLab CI/CD into your project's pipeline. This snippet shows the workflow definition. ```yaml workflow: {...} ``` -------------------------------- ### Install Junie CLI with Homebrew Source: https://junie.labs.jb.gg/docs/junie-headless Installs the Junie CLI using the Homebrew package manager on macOS or Linux. This involves tapping the Junie CLI repository, updating Homebrew, and then installing the package. ```bash brew tap jetbrains-junie/junie brew update brew install junie ``` -------------------------------- ### Clear Session Context with /new Source: https://junie.labs.jb.gg/docs/junie-cli-usage Resets the current Junie CLI session, clearing its context and starting a new interactive session. This is useful for beginning a fresh set of tasks. ```bash /new ``` -------------------------------- ### Configure GitHub MCP Server with .env file Source: https://junie.labs.jb.gg/docs/junie-ide-plugin This JSON configuration demonstrates how to use a Docker environment file (`.env.mcp`) for authentication with a GitHub MCP server. This approach is a workaround for Junie's current lack of direct support for security tokens in MCP configs. ```json { "mcpServers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "--env-file", "~/.env.mcp", "ghcr.io/github/github-mcp-server" ] } } } ``` -------------------------------- ### Configure GitHub MCP Server using Docker Source: https://junie.labs.jb.gg/docs/junie-ide-plugin This JSON configuration sets up a GitHub MCP server using Docker. It specifies the command to run the Docker container and includes environment variables for authentication, such as a GitHub Personal Access Token. ```json { "mcpServers": { "github": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server" ], "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT" } } } } ``` -------------------------------- ### Junie GitHub Action Usage and Output Handling Source: https://junie.labs.jb.gg/docs/junie-on-github Demonstrates how to use the Junie GitHub Action with an API key and how to access its outputs. It shows conditional execution based on the 'should_skip' output and prints various details like branch name, title, and PR URL. ```yaml - uses: JetBrains/junie-github-action@v0 id: junie with: junie_api_key: ${{ secrets.JUNIE_API_KEY }} - name: Use outputs if: steps.junie.outputs.should_skip != 'true' run: | echo "Branch: ${{ steps.junie.outputs.branch_name }}" echo "Title: ${{ steps.junie.outputs.junie_title }}" if [ "${{ steps.junie.outputs.pr_url }}" != "" ]; then echo "PR created: ${{ steps.junie.outputs.pr_url }}" fi ``` -------------------------------- ### View Token Usage and Costs with /cost Source: https://junie.labs.jb.gg/docs/junie-cli-usage Displays a detailed breakdown of token usage, models employed, and the remaining balance for the current Junie CLI session. This helps in monitoring resource consumption. ```bash /cost ``` -------------------------------- ### Select LLM Model with /model Source: https://junie.labs.jb.gg/docs/junie-cli-usage Allows the user to select the Large Language Model (LLM) to be used for the current session. The 'Default' option is recommended for optimal price-quality ratio. ```bash /model ``` -------------------------------- ### Display Junie CLI Help Information Source: https://junie.labs.jb.gg/docs/junie-headless Displays all available command-line options for the Junie CLI. This command is useful for understanding the full range of functionalities and parameters the CLI offers. ```bash junie --help ``` -------------------------------- ### Junie GitHub Action Configuration Source: https://junie.labs.jb.gg/docs/junie-on-github This section explains the various input parameters for configuring the Junie GitHub Action, including advanced features and authentication. ```APIDOC ## Junie GitHub Action Configuration ### Description Configure the Junie GitHub Action with various input parameters to control its behavior, including advanced features and authentication. ### Method N/A (Configuration for a GitHub Action) ### Endpoint N/A (Configuration for a GitHub Action) ### Parameters #### Input Parameters (with parameters) - **resolve_conflicts** (boolean) - Optional - Enable automatic conflict detection (not needed for manual `@junie-agent` resolution). Default: `false` - **silent_mode** (boolean) - Optional - Run Junie without comments, branch creation, or commits - only prepare data and output results. Default: `false` - **use_single_comment** (boolean) - Optional - Update a single comment for all runs instead of creating new comments each time. Default: `false` - **use_structured_prompt** (boolean) - Optional - Use the new structured prompt format with XML tags for better organization. Default: `true` #### Authentication Parameters - **junie_api_key** (string) - Required - JetBrains Junie API key. - **custom_github_token** (string) - Optional - Custom GitHub token. ### Request Example ```yaml - uses: JetBrains/junie-github-action@v0 id: junie with: junie_api_key: "${{ secrets.JUNIE_API_KEY }}" resolve_conflicts: "true" silent_mode: "true" ``` ### Response #### Output Parameters - **branch_name** (string) - Name of the working branch created by Junie. - **should_skip** (boolean) - Whether Junie execution was skipped (no trigger matched or no write permissions). - **commit_sha** (string) - SHA of the commit created by Junie (if any). - **pr_url** (string) - URL of the pull request created by Junie (if any). - **junie_title** (string) - Title of the task completion from Junie. - **junie_summary** (string) - Summary of the changes made by Junie. - **github_token** (string) - The GitHub token used by the action. #### Response Example ```json { "branch_name": "feature/junie-update", "should_skip": false, "commit_sha": "a1b2c3d4e5f678901234567890abcdef12345678", "pr_url": "https://github.com/user/repo/pull/123", "junie_title": "Junie task completed", "junie_summary": "Updated documentation and fixed minor issues.", "github_token": "***" } ``` ``` -------------------------------- ### MCP Servers Source: https://junie.labs.jb.gg/docs/junie-on-github Lists the available pre-configured MCP servers that can be used with Junie. ```APIDOC ## MCP Servers ### Description This section lists the available pre-configured MCP (Monitoring, Control, and Provisioning) servers that can be utilized with Junie. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response #### Available MCP Servers - **mcp_github_checks_server** - Analyzes failed GitHub Actions checks. #### Response Example N/A ``` -------------------------------- ### Junie CLI: Version and Help Information Source: https://junie.labs.jb.gg/docs/parameters Displays the current version of Junie CLI or shows the help message with all available options and exits. These are standard utility commands. ```bash junie --version ``` ```bash junie --help ``` ```bash junie -h ``` -------------------------------- ### Run Junie CLI with Authentication Source: https://junie.labs.jb.gg/docs/junie-headless Executes the Junie CLI with a provided authentication token and a prompt for AI code review. The `--auth` option uses an environment variable for the API key, and the prompt is passed as a positional argument. ```bash junie --auth="$JUNIE_API_KEY" "Review and fix any code quality issues in the latest commit" ``` -------------------------------- ### Junie CLI: Environment Variables Equivalents Source: https://junie.labs.jb.gg/docs/parameters Demonstrates environment variables that provide equivalent functionality to Junie CLI command-line options. These variables allow for configuration outside of direct command execution. ```bash export EJ_FOLDER_WORK="/tmp/junie-cache" # Equivalent to -c, --cache-dir ``` ```bash export EJ_PROJECT="./path/to/project" # Equivalent to -p, --project ``` ```bash export JUNIE_GUIDELINES_FILENAME="my_guidelines_gitlab.md" # Overrides default guidelines ``` ```bash export JUNIE_TIME_LIMIT="30000" # Equivalent to -t, --timeout ``` ```bash export JUNIE_INPUT_FORMAT="json" # Equivalent to --input-format ``` ```bash export JUNIE_OUTPUT_FORMAT="text" # Equivalent to --output-format ``` ```bash export JUNIE_JSON_OUTPUT_FILE="./output.json" # Equivalent to --json-output-file ``` ```bash export JUNIE_MODEL="gpt-5-2025-08-07" # Equivalent to --model ``` -------------------------------- ### Junie GitHub Action Workflow Configuration (YAML) Source: https://junie.labs.jb.gg/docs/junie-on-github This YAML configuration sets up a GitHub Actions workflow to trigger the Junie GitHub Action. It listens for specific events like issue comments, PR review comments, issues being opened or assigned, and PR reviews. The action runs on an Ubuntu runner and requires write permissions for contents, pull requests, and issues. It checks out the repository and then uses the Junie GitHub Action with an API key stored as a secret. ```yaml name: Junie on: issue_comment: types: [created] pull_request_review_comment: types: [created] issues: types: [opened, assigned] pull_request_review: types: [submitted] jobs: junie: if: | (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@junie-agent')) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@junie-agent')) || (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@junie-agent')) || (github.event_name == 'issues' && (contains(github.event.issue.body, '@junie-agent') || contains(github.event.issue.title, '@junie-agent'))) runs-on: ubuntu-latest permissions: contents: write pull-requests: write issues: write steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 1 - name: Run Junie id: junie uses: JetBrains/junie-github-action@v1 with: junie_api_key: ${{ secrets.JUNIE_API_KEY }} ``` -------------------------------- ### Provide Natural Language Prompt to Junie CLI Source: https://junie.labs.jb.gg/docs/junie-cli-usage Allows users to input prompts in natural language to instruct Junie CLI. The prompt is used to find files related to log error descriptions in the current project. ```bash > find the files in this project that handle log error descriptions ``` -------------------------------- ### Junie CLI - System Options Source: https://junie.labs.jb.gg/docs/parameters System-level options for Junie CLI, including timeout, cache directory, version, and help. ```APIDOC ## GET /junie/system/info ### Description Retrieves system information or performs system-level operations for Junie CLI. ### Method GET ### Endpoint /junie/system/info ### Parameters #### Query Parameters - **timeout** (integer) - Optional - The time limit in milliseconds. - **cache-dir** (string) - Optional - The path to the caching directory for Junie CLI and the JetBrains IDE it uses. - **version** (boolean) - Optional - If true, shows Junie CLI version. - **help** (boolean) - Optional - If true, shows the help message and exits. ### Request Example ```json { "timeout": 30000, "cache-dir": "/tmp/junie-cache", "version": true } ``` ### Response #### Success Response (200) - **version** (string) - The version of Junie CLI (if requested). - **help_message** (string) - The help message for Junie CLI (if requested). - **status** (string) - A status message indicating the result of the operation. #### Response Example ```json { "version": "1.0.0", "status": "Version information displayed." } ``` ``` -------------------------------- ### Junie GitHub Action Output Usage Source: https://junie.labs.jb.gg/docs/junie-on-github Demonstrates how to access and use the output parameters provided by the Junie GitHub Action in subsequent workflow steps. ```APIDOC ## Junie GitHub Action Output Usage ### Description This example shows how to access and utilize the outputs generated by the Junie GitHub Action, such as branch name, commit SHA, and PR URL, in subsequent steps of your GitHub Actions workflow. ### Method N/A (Usage example for GitHub Actions) ### Endpoint N/A (Usage example for GitHub Actions) ### Parameters N/A ### Request Example N/A ### Response #### Success Response (Example Usage) This demonstrates how to use the outputs in a `run` step. #### Response Example ```yaml - name: Use outputs if: steps.junie.outputs.should_skip != 'true' run: | echo "Branch: ${{ steps.junie.outputs.branch_name }}" echo "Title: ${{ steps.junie.outputs.junie_title }}" if [ "${{ steps.junie.outputs.pr_url }}" != "" ]; then echo "PR created: ${{ steps.junie.outputs.pr_url }}" fi ``` ``` -------------------------------- ### View Session History with /history Source: https://junie.labs.jb.gg/docs/junie-cli-usage Displays the history of previous Junie CLI sessions, allowing users to view and resume past interactions. Junie CLI stores context for the last 10 sessions. ```bash /history ``` -------------------------------- ### Configure Junie CLI GitHub Actions Workflow Source: https://junie.labs.jb.gg/docs/basic-workflow This YAML configuration sets up a GitHub Actions workflow to automate Junie CLI. It defines triggers based on issue and pull request events, specifies required permissions, and includes steps for checking out the repository and running the Junie CLI action. Dependencies include the 'actions/checkout' and 'JetBrains/junie-github-action'. ```yaml # .github/workflows/junie.yml name: Junie on: issue_comment: types: [created] pull_request_review_comment: types: [created] issues: types: [opened, assigned] pull_request_review: types: [submitted] jobs: junie: if: | # The workflow is only triggered on explicit mentions of @junie-agent (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@junie-agent')) || (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@junie-agent')) || (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@junie-agent')) || (github.event_name == 'issues' && (contains(github.event.issue.body, '@junie-agent') || contains(github.event.issue.title, '@junie-agent'))) runs-on: ubuntu-latest permissions: contents: write # Required to create branches, make commits, and push changes pull-requests: write # Required to create PRs, add comments to PRs, and update PR status issues: write # Required to add comments to issues and update issue metadata steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 1 - name: Run Junie id: junie uses: JetBrains/junie-github-action@v0 with: junie_api_key: ${{ secrets.JUNIE_API_KEY }} use_single_comment: true # Updates a single comment for all Junie CLI runs instead of creating new comments every time # Optional: Customize to have Junie CLI always create new branches instead of committing to existing ones # create_new_branch_for_pr: true # Optional: Add custom instructions for Junie CLI # prompt: | # Your prompt text here ``` -------------------------------- ### Sync Documentation Workflow (YAML) Source: https://junie.labs.jb.gg/docs/update-docs This workflow is triggered when pull requests are merged into the 'main' branch. It uses the JetBrains/junie-github-action to analyze code changes and automatically update documentation by creating a new pull request. The 'create_new_branch_for_pr' option is set to true to ensure updates are made on a separate branch. ```yaml # .github/workflows/sync-docs.yml name: Sync Documentation on: pull_request: types: [closed] # Customize the branch names if needed branches: - main jobs: update-docs: if: github.event.pull_request.merged == true runs-on: ubuntu-latest permissions: contents: write pull-requests: write steps: - uses: actions/checkout@v4 with: fetch-depth: 1 - uses: JetBrains/junie-github-action@v0 with: junie_api_key: ${{ secrets.JUNIE_API_KEY }} create_new_branch_for_pr: true prompt: | Review pr diff and update documentation to match code changes. **Check for outdated docs:** - README.md examples using changed APIs - API documentation (JSDoc, docstrings, OpenAPI) - Configuration examples (if config changed) - Migration guides (for breaking changes) **Update only if needed:** - Keep examples simple and runnable - Show before/after for breaking changes - Add "Added in vX.X" for new features - Only modify documentation files (README.md, docs/**) - If nothing to update, don't make changes Procedure: Use gh pr diff ${{ github.event.pull_request.head.ref }} to get a diff of the PR. ``` -------------------------------- ### Junie CLI: Specifying Task Description Source: https://junie.labs.jb.gg/docs/parameters Provides a task description in plain English to the Junie CLI. This serves as an alternative to using positional arguments for defining the task. ```bash junie --task "task in plain English" ``` -------------------------------- ### Junie CLI: Input and Output Formats Source: https://junie.labs.jb.gg/docs/parameters Configures the input and output formats for Junie CLI. Supported input formats are 'text' and 'json'. Supported output formats for print mode are 'text' and 'json'. ```bash --input-format json ``` ```bash --output-format text ``` -------------------------------- ### Match git show with one argument using Java Regex Source: https://junie.labs.jb.gg/docs/action-allowlist This Java Regex pattern matches the 'git show' command followed by exactly one argument. It ensures the argument does not contain whitespace or specific special characters, preventing command chaining or dangerous operations. The pattern `^Qgit show E` matches the literal string 'git show ' and `[^s;&|<>@$]+` matches one or more characters excluding specified unsafe characters. `$` anchors the match to the end of the line. ```regex ^\Qgit show \E[^\s;&|<>@$]+$ ``` -------------------------------- ### GitHub Actions Workflow for Code Review Source: https://junie.labs.jb.gg/docs/automated-code-reviews This workflow automates code reviews for pull requests. It triggers on pull request 'opened' or 'synchronize' events and runs on an Ubuntu environment. It requires permissions to read contents, write pull requests, and write issues. The workflow checks out the code and then uses the JetBrains/junie-github-action to perform the review. ```yaml # .github/workflows/code-review.yml name: Code Review on: pull_request: types: [opened, synchronize] jobs: review: runs-on: ubuntu-latest permissions: contents: read pull-requests: write issues: write steps: - uses: actions/checkout@v4 with: fetch-depth: 1 - uses: JetBrains/junie-github-action@v0 with: junie_api_key: ${{ secrets.JUNIE_API_KEY }} # Update the same comment on subsequent runs instead of adding new comments use_single_comment: true # Customize the review criteria, summary format, or additional instructions as required prompt: | Your task is to: 1. Download the Pull Request diff using `gh pr diff ${{ github.event.pull_request.head.ref }}` 2. Review the downloaded diff according to the criteria below 3. Output summary following the template below using `submit` action ## Review Criteria ``` **Security:** - SQL injection, XSS, exposed secrets - Authentication/authorization issues - Input validation vulnerabilities **Performance:** - N+1 queries, memory leaks - Inefficient algorithms (nested loops, etc.) - Blocking operations **Code Quality:** - Complexity, duplication, naming - Missing tests for new logic - Undocumented complex logic ``` ## Summary template ``` ## 🎯 Summary [2-3 sentences overall assessment] ## ⚠️ Issues Found [Each issue: File:line, Severity (Critical/High/Medium/Low), Description, Suggested fix with code example] ## ✨ Highlights [1-2 things done well] ## 📋 Checklist - [ ] Security: No vulnerabilities - [ ] Tests: Adequate coverage - [ ] Performance: No bottlenecks - [ ] Documentation: Complex logic explained ## Additional instructions - Strictly follow the plan above (`Your task is to:` section) - You are not expected to explore the repo. Do review solely based on the downloaded diff - You are not expected to run any code or any commands except `gh pr diff` ``` -------------------------------- ### Configure GitHub Actions Workflow for CI Failure Analysis (YAML) Source: https://junie.labs.jb.gg/docs/fix-ci-failures This YAML configuration sets up a GitHub Actions workflow that triggers upon the completion of a specified CI workflow. It analyzes failures using the Junie GitHub Action, providing detailed prompts for diagnosing and suggesting fixes for CI issues. ```yaml # .github/workflows/fix-ci.yml name: Fix CI Failures on: workflow_run: workflows: ["CI"] # Replace with your CI workflow name types: [completed] jobs: analyze-failure: if: github.event.workflow_run.conclusion == 'failure' runs-on: ubuntu-latest permissions: contents: write pull-requests: write issues: write checks: read steps: - uses: actions/checkout@v4 with: ref: ${{ github.event.workflow_run.head_branch }} fetch-depth: 1 - uses: JetBrains/junie-github-action@v0 with: junie_api_key: ${{ secrets.JUNIE_API_KEY }} allowed_mcp_servers: "mcp_github_checks_server" use_single_comment: true prompt: | CI workflow "${{ github.event.workflow_run.name }}" failed. Diagnose and fix if possible. **Analysis:** 1. Use `get_pr_failed_checks_info` MCP tool to fetch error logs 2. Identify failing step and error message 3. Determine root cause (test/build error, timeout, flaky test) 4. Check recent commits that might have caused it **Provide diagnosis:** ## CI Failure Analysis **Failed step:** [name] **Error:** [message] **Root cause:** [1-2 sentences] ## Proposed Fix [Description] ## Files to Change - `path/file`: [what needs to change] Only provide analysis without modifying files. ``` -------------------------------- ### Junie CLI: Authorization with Token Source: https://junie.labs.jb.gg/docs/parameters Authenticates with Junie CLI using a provided token. Obtain the token from junie.jetbrains.com/cli. This is essential for secure access to Junie services. ```bash junie --auth "your_secret_token" ``` -------------------------------- ### Junie CLI: Project Path Specification Source: https://junie.labs.jb.gg/docs/parameters Specifies the project directory for Junie CLI operations. If not provided, the current directory is used. This option helps in targeting specific project contexts. ```bash junie --project ./path/to/project ``` ```bash junie -p ./path/to/project ``` -------------------------------- ### Junie CLI - Version Control Options Source: https://junie.labs.jb.gg/docs/parameters Options for initiating merge or rebase conflict resolution tasks. ```APIDOC ## POST /junie/vc/resolve ### Description Starts a conflict resolution task for version control operations. ### Method POST ### Endpoint /junie/vc/resolve ### Parameters #### Query Parameters - **merge** (string) - Optional - Start a merge-conflicts resolution task for the specified branch or commit. - **rebase** (string) - Optional - Start a rebase-conflicts resolution task for the specified branch or commit. ### Request Example ```json { "merge": "main" } ``` Or ```json { "rebase": "1a2b3c4" } ``` ### Response #### Success Response (200) - **message** (string) - A message indicating the start of the conflict resolution task. #### Response Example ```json { "message": "Merge conflict resolution task started for branch main." } ``` ``` -------------------------------- ### Junie CLI - Core Options Source: https://junie.labs.jb.gg/docs/parameters Core options for controlling Junie CLI's task execution and output. ```APIDOC ## POST /junie/execute ### Description Executes a task using the Junie CLI with specified options. ### Method POST ### Endpoint /junie/execute ### Parameters #### Query Parameters - **task** (string) - Optional - The task description in plain English. - **project** (string) - Optional - The path to the project directory where Junie will run. Defaults to the current directory. - **session-id** (string) - Optional - A specific session ID to resume a previous session. If none is provided, a new session ID is generated. - **input-format** (string) - Optional - Specify input format for piped input (options: `text`, `json`). Defaults to `text`. - **output-format** (string) - Optional - Specify output format for print mode (options: `text`, `json`). Defaults to `text`. - **json-output-file** (string) - Optional - Save JSON output to a file. - **model** (string) - Optional - Specify the model to be used by Junie CLI. If an unknown model value is provided, Junie CLI returns the list of available model values. ### Request Example ```json { "task": "task in plain English", "project": "./path/to/project", "session-id": "session-251209-172932-1ze8", "input-format": "json", "output-format": "text", "json-output-file": "./output.json", "model": "gpt-5-2025-08-07" } ``` ### Response #### Success Response (200) - **result** (string) - The result of the executed task. - **session_id** (string) - The session ID used for the execution. #### Response Example ```json { "result": "Task completed successfully.", "session_id": "session-251209-172932-1ze8" } ``` ``` -------------------------------- ### Junie CLI - Authorization Options Source: https://junie.labs.jb.gg/docs/parameters Options related to authenticating with the Junie CLI using a token. ```APIDOC ## POST /junie/auth ### Description Provides a token to authenticate with Junie CLI. To generate the token, visit junie.jetbrains.com/cli. ### Method POST ### Endpoint /junie/auth ### Parameters #### Query Parameters - **auth** (string) - Required - The authentication token for Junie CLI. ### Request Example ```json { "auth": "your_secret_token" } ``` ### Response #### Success Response (200) - **message** (string) - A confirmation message indicating successful authentication. #### Response Example ```json { "message": "Authentication successful." } ``` ``` -------------------------------- ### Match git cat-file with two arguments using Java Regex Source: https://junie.labs.jb.gg/docs/action-allowlist This Java Regex pattern matches the 'git cat-file' command followed by exactly two arguments. Similar to the single argument pattern, it uses `[^s;&|<>@$]+` to match each argument, ensuring they are single words without unsafe characters. The space between the two argument patterns allows for two distinct arguments. ```regex ^\Qgit cat-file \E[^\s;&|<>@$]+ [^\s;&|<>@$]+$ ``` -------------------------------- ### Junie CLI: Model Selection Source: https://junie.labs.jb.gg/docs/parameters Specifies the AI model for Junie CLI to use. If not specified, a default model is dynamically selected. Providing an unknown model name will list available options. ```bash --model gpt-5-2025-08-07 "my task" ``` -------------------------------- ### Junie CLI: Timeout and Cache Directory Source: https://junie.labs.jb.gg/docs/parameters Sets a time limit in milliseconds for Junie CLI operations and specifies a directory for caching. The cache directory is used by Junie CLI and the associated JetBrains IDE. ```bash junie --timeout 30000 ``` ```bash junie --cache-dir "/tmp/junie-cache" ``` ```bash junie -t 30000 ``` ```bash junie -c "/tmp/junie-cache" ``` -------------------------------- ### Match git diff with zero or one argument using Java Regex Source: https://junie.labs.jb.gg/docs/action-allowlist This Java Regex pattern matches the 'git diff' command with either no arguments or exactly one argument. It uses the `*` quantifier instead of `+` in `[^s;&|<>@$]*`, allowing for zero or more characters for the argument, thus matching both 'git diff' and 'git diff '. ```regex ^\Qgit diff \E[^\s;&|<>@$]*$ ``` -------------------------------- ### Logout of Junie CLI with /logout Source: https://junie.labs.jb.gg/docs/junie-cli-usage Quits the Junie CLI and logs out the current user account. This is a more comprehensive exit command than /quit. ```bash /logout ``` -------------------------------- ### Configure Secret Audit Workflow with Junie GitHub Action Source: https://junie.labs.jb.gg/docs/check-for-secrets-in-commits This YAML configuration sets up a GitHub Actions workflow to audit pull request commits for secrets. It utilizes the JetBrains/junie-github-action, configured with an API key and a detailed prompt to identify various types of sensitive data while ignoring false positives. The workflow fails the build if secrets are detected. ```yaml # .github/workflows/secret-audit.yml name: Security Audit on: pull_request: types: [opened, synchronize] jobs: audit: runs-on: ubuntu-latest permissions: contents: read pull-requests: write issues: write steps: - uses: actions/checkout@v4 with: fetch-depth: 2 # Need parent commit for diff - uses: JetBrains/junie-github-action@v0 id: junie with: junie_api_key: ${{ secrets.JUNIE_API_KEY }} # Enable silent mode to avoid GitHub comments and code changes silent_mode: true prompt: | Scan git diff for accidentally committed secrets. Provide a structured report. **Look for:** - API keys (AWS, GCP, Azure, OpenAI, Stripe) - Private keys (RSA, SSH, PGP headers) - Passwords, auth tokens, JWT - Database connection strings, OAuth secrets **Patterns:** - `password=`, `secret=`, `token=`, `api_key=` - Long base64/hex strings (>20 chars) - `https://user:pass@host` - `-----BEGIN PRIVATE KEY-----` **Ignore false positives:** - Placeholders ("your-api-key-here", "example.com") - Test fixtures with dummy data - Encrypted values, public keys **Report format:** ## 🔐 Secret Scan Results **Status:** SECRETS_FOUND or CLEAN ### Issues Found: [If secrets found, list each one:] - **File:** path/file:line - **Type:** API Key / Private Key / Password / etc. - **Severity:** HIGH / MEDIUM - **Pattern:** [show redacted pattern, e.g., "aws_access_key=AKIA..."] - **Recommendation:** Remove from code, use GitHub Secrets [If no secrets found:] No secrets detected in this commit. Procedure: Use gh pr diff ${{ github.event.pull_request.head.ref }} to get a diff of the PR. Only provide feedback without modifying files. - name: Check results if: steps.junie.outputs.junie_summary != '' run: | echo "${{ steps.junie.outputs.junie_summary }}" # Fail if secrets were found if echo "${{ steps.junie.outputs.junie_summary }}" | grep -q "SECRETS_FOUND"; then echo "::error::Secrets detected in commit! Review the summary above." exit 1 fi ``` -------------------------------- ### Junie CLI: Version Control Conflict Resolution Source: https://junie.labs.jb.gg/docs/parameters Initiates tasks for resolving merge or rebase conflicts in version control. Specify the branch or commit hash for the operation. ```bash --merge main ``` ```bash --rebase 1a2b3c4 ``` -------------------------------- ### Junie CLI: Resuming a Session Source: https://junie.labs.jb.gg/docs/parameters Utilizes a specific session ID to resume a previous Junie CLI session. If no session ID is provided, a new one is generated automatically. ```bash junie --session-id session-251209-172932-1ze8 ```