### Prompt Engineering Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/copilot.md Example of how to start typing to get Copilot suggestions for a POST request, including the info block. ```yaml # Type this to get suggestions for a POST request info: name: Create New User type: http ``` -------------------------------- ### Environment Setup File Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/cursor.md Example of an environment file generated by Cursor AI, defining base URLs, API versions, timeouts, and secret variables. ```bru vars { baseUrl: https://api.dev.example.com apiVersion: v1 timeout: 5000 } vars:secret [ authToken, apiKey ] ``` -------------------------------- ### Create Request File Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/copilot.md Example of a Bruno request file (.yml) with info, http method, URL, and authentication details. Copilot suggests this structure. ```yaml info: name: Get User Profile type: http seq: 1 http: method: GET url: "{{baseUrl}}/users/{{userId}}" auth: type: bearer token: "{{token}}" ``` -------------------------------- ### Add Project-Specific AI Instructions Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/vscode.md Example of project-specific rules added to the `.vscode/ai-instructions.md` file. These rules guide AI assistants on API specifics, headers, and versioning. ```markdown ## Project-Specific Rules - This API uses OAuth2 with PKCE flow - All requests must include X-API-Version header - Rate limiting: 100 requests per minute - Use semantic versioning for API versions ``` -------------------------------- ### Prompt Example: Create Bruno Environment File Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/general.md Example prompt for generating a Bruno environment file for a staging environment, including base URL, API version, and secret variables. ```plaintext Create a Bruno environment file for a staging environment with: - Base URL for staging API - API version variable - Secret variables for API key and client secret ``` -------------------------------- ### Prompt Example: Debug Bruno .bru File Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/general.md Example prompt for troubleshooting issues with a Bruno .bru file by providing the file content for analysis. ```plaintext I'm having issues with this Bruno .bru file. Can you help identify what's wrong? [paste .bru file content] ``` -------------------------------- ### AI Assistant Prompt: Environment Setup Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/examples/rest-api/README.md Use this prompt to ask an AI assistant to create a staging environment file with appropriate variables. ```plaintext "Create a staging environment file with appropriate variables" ``` -------------------------------- ### Environment File Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/prompts/general/bruno-ai-context-bru.md Defines environment variables and secrets for API requests. Includes default variables and a list of secret variables. ```bru vars { baseUrl: https://api.example.com apiVersion: v1 timeout: 5000 retries: 3 } vars:secret [ apiKey, clientSecret, refreshToken ] ``` -------------------------------- ### Repository Structure Overview Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/CONTRIBUTING.md Understand the directory structure for prompts, examples, documentation, and scripts. ```tree ai-assistant-prompts/ ├── prompts/ # AI assistant prompt files │ ├── cursor/ # Cursor AI (.cursorrules) │ ├── copilot/ # GitHub Copilot │ ├── vscode/ # VS Code AI extensions │ ├── general/ # Claude, ChatGPT, etc. │ ├── continue/ # Continue extension │ └── codeium/ # Codeium ├── examples/ # Example Bruno projects ├── docs/ # Documentation for each AI assistant ├── scripts/ # Installation and setup scripts └── templates/ # Template files ``` -------------------------------- ### Install Bruno AI Assistant Prompts Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/README.md Use this command to copy all prompts to your Bruno project. Ensure you are in your Bruno project directory. ```bash curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/install.sh | bash ``` -------------------------------- ### Create Production Environment File Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/vscode.md Example of an environment file defining base URL, API version, timeout, and secret variables for a production environment. ```bru vars { baseUrl: https://api.production.example.com apiVersion: v2 timeout: 10000 } vars:secret [ authToken, apiKey, clientSecret ] ``` -------------------------------- ### Manual Codeium Setup: Download Bruno Context Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/codeium.md Download the Bruno context file to the .codeium directory for Codeium to use. Ensure the .codeium directory exists. ```bash mkdir -p .codeium ``` ```bash curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/prompts/codeium/.codeium/context.md -o .codeium/context.md ``` -------------------------------- ### Prompt Example: Create New Bruno Request Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/general.md Example prompt to guide an AI assistant in creating a new POST request using the Bruno .bru format, including authentication, JSON body, and comprehensive tests. ```plaintext Using the Bruno .bru format, create a POST request to create a new user with: - Bearer token authentication - JSON body with name, email, and role - Comprehensive tests for success and error cases ``` -------------------------------- ### Bruno Request File Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/codeium.md Example of a .bru file demonstrating meta block, HTTP request details, authentication, and tests. Codeium understands this syntax. ```bru meta { name: Delete User type: http seq: 3 } delete { url: {{baseUrl}}/users/{{userId}} body: none auth: bearer } auth:bearer { token: {{authToken}} } tests { test("User deleted successfully", function() { expect(res.status).to.equal(204); }); } ``` -------------------------------- ### Create New API Request Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/vscode.md Example of a .bru file generated for updating a user profile. It includes meta information, HTTP request details, headers, authentication, JSON body, and tests. ```bru meta { name: Update User Profile type: http seq: 2 } put { url: {{baseUrl}}/users/{{userId}} body: json auth: bearer } headers { content-type: application/json } auth:bearer { token: {{authToken}} } body:json { { "name": "{{userName}}", "email": "{{userEmail}}" } } tests { test("Profile updated successfully", function() { expect(res.status).to.equal(200); expect(res.body).to.have.property("id"); expect(res.body.name).to.equal(bru.getVar("userName")); }); } ``` -------------------------------- ### Install Cursor AI Rules Automatically Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/cursor.md Use this command to automatically download and install the Cursor AI rules for your Bruno project. ```bash cd your-bruno-project curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/install.sh | bash ``` -------------------------------- ### Bruno Environment Variables Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/codeium.md Example of a Bruno environment file defining variables, including a secret section for sensitive information. Codeium can suggest these. ```bru vars { baseUrl: https://api.example.com apiVersion: v1 timeout: 5000 } vars:secret [ authToken, apiKey, clientSecret ] ``` -------------------------------- ### Environment Variables Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/copilot.md Example of environment variables definition in Bruno. Copilot suggests variable names, values, and secret flags. ```yaml variables: - name: baseUrl value: https://api.example.com - name: apiVersion value: v1 - name: apiKey value: "" secret: true ``` -------------------------------- ### Extend .cursorrules with Project-Specific Rules Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/cursor.md Example of how to add custom, project-specific rules to your .cursorrules file to guide Cursor AI's understanding of your project's conventions. ```yaml # Add to .cursorrules ## Project-Specific Rules - This project uses OAuth2 authentication - All requests should include rate limiting headers - Use semantic versioning for API versions ``` -------------------------------- ### Install Bruno AI Assistant Prompts Source: https://context7.com/bruno-collections/ai-assistant-prompts/llms.txt Automate the copying of AI assistant prompt files into your Bruno project. Run from the root of your Bruno project. ```bash # Run from the root of your Bruno project cd your-bruno-project curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/install.sh | bash # Or with a flag to skip the interactive menu bash install.sh --all # install all assistants bash install.sh --cursor # Cursor AI only bash install.sh --copilot # GitHub Copilot only bash install.sh --vscode # VS Code extensions only bash install.sh --general # Claude / ChatGPT context file only bash install.sh --continue # Continue extension only bash install.sh --codeium # Codeium only ``` -------------------------------- ### Example Prompt File Structure Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/CONTRIBUTING.md A template for structuring prompt files, including sections for Bruno overview, Bru file format, key concepts, best practices, and common patterns. ```markdown # AI Assistant Instructions for Bruno ## About Bruno [Brief overview] ## Bru File Format [Complete .bru file example] ## Key Concepts [Variables, auth, testing, etc.] ## Best Practices [Development guidelines] ``` -------------------------------- ### Request Chaining with `bru.setNextRequest` Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/prompts/general/bruno-ai-context-bru.md Chain requests by setting the next request to execute in the post-response script. This example shows how to set an authentication token and proceed to the 'Get User Profile' request upon successful login. ```javascript // In post-response script of login request if (res.status === 200) { bru.setVar("authToken", res.body.token); bru.setNextRequest("Get User Profile"); } ``` -------------------------------- ### Prompt Example: Convert Postman to Bruno Format Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/general.md Example prompt to request conversion of a Postman collection in JSON format to the Bruno .bru format. ```plaintext Convert this Postman collection JSON to Bruno .bru format: [paste Postman JSON] ``` -------------------------------- ### Bruno Pre-Request Script Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/codeium.md Example of a pre-request script in Bruno. Codeium suggests common patterns for setting variables and request timeouts using the 'bru' API. ```bru script:pre-request { // Set timestamp bru.setVar("timestamp", Date.now()); // Generate random email bru.setVar("email", `user-${Date.now()}@example.com`); // Set request timeout req.setTimeout(10000); } ``` -------------------------------- ### Create .continue Directory (Bash) Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/continue.md Manually create the .continue directory in your project root if not using the automatic installation script. ```bash mkdir -p .continue ``` -------------------------------- ### Configure OpenAI API Key in config.json Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/continue.md Example JSON configuration for setting up OpenAI models, including the API key. ```json { "models": [ { "title": "GPT-4", "provider": "openai", "model": "gpt-4", "apiKey": "sk-your-api-key-here" } ] } ``` -------------------------------- ### AI Assistant Example: Add Tests for 404 Error Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/examples/rest-api/README.md An example of an AI assistant adding tests to handle a 404 error response, including Chai.js assertions. ```bru AI: Add tests for a 404 error response Expected Output: tests { test("Handles user not found", function() { if (res.status === 404) { expect(res.body).to.have.property("error"); expect(res.body.error).to.include("not found"); } }); } ``` -------------------------------- ### Create Complete User Registration Request with Bruno Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/general.md This example demonstrates a complete Bruno .bru file for user registration. It includes meta information, request details, headers, JSON body with environment variables, and tests using Chai.js. Ensure environment variables like {{baseUrl}}, {{userEmail}}, {{userPassword}}, {{firstName}}, and {{lastName}} are defined in your Bruno environment. ```plaintext meta { name: User Registration type: http seq: 1 } post { url: {{baseUrl}}/api/auth/register body: json auth: none } headers { content-type: application/json } body:json { { "email": "{{userEmail}}", "password": "{{userPassword}}", "firstName": "{{firstName}}", "lastName": "{{lastName}}" } } tests { test("Registration successful", function() { expect(res.status).to.equal(201); expect(res.body).to.have.property("token"); expect(res.body).to.have.property("user"); }); } ``` -------------------------------- ### Create a New API Request with Bruno Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/README.md Example of a .bru file demonstrating how to create a new API request, including meta information, request details, headers, authentication, JSON body, and tests. ```bru meta { name: Create User type: http seq: 1 } post { url: {{baseUrl}}/api/users body: json auth: bearer } headers { content-type: application/json } auth:bearer { token: {{authToken}} } body:json { { "name": "{{userName}}", "email": "{{userEmail}}" } } tests { test("User created successfully", function() { expect(res.status).to.equal(201); expect(res.body).to.have.property("id"); }); } ``` -------------------------------- ### Create Continue Configuration Template Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/continue.md Create a template for the Continue configuration file, excluding sensitive API keys, to facilitate team setup and collaboration. ```bash # Create a template cp .continue/config.json .continue/config.template.json # Remove API keys from template git add .continue/config.template.json git commit -m "Add Continue configuration template" ``` -------------------------------- ### Bruno Request File with Comments Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/codeium.md Example of a Bruno request file with comments. Adding descriptive comments helps Codeium understand the context and provide better suggestions. ```bru meta { name: OAuth2 Token Refresh type: http seq: 5 } # Refresh the OAuth2 access token using the refresh token post { url: {{authUrl}}/oauth/token body: json auth: none } ``` -------------------------------- ### Environment Configuration in Bruno Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/README.md Example of a .bru file showing environment variable configuration, including regular variables and secret variables. ```bru vars { baseUrl: https://api.example.com apiVersion: v1 } vars:secret [ authToken, apiKey ] ``` -------------------------------- ### AI Assistant Example: Create DELETE Request Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/examples/rest-api/README.md An example of an AI assistant generating a DELETE request for removing a user, including meta information and request details. ```bru AI: Create a DELETE request for removing a user Expected Output: meta { name: Delete User type: http seq: 3 } delete { url: {{baseUrl}}/api/{{apiVersion}}/users/{{userId}} body: none auth: bearer } # ... rest of the .bru file ``` -------------------------------- ### Example Bruno Environment File Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/troubleshooting.md Define environment-specific variables and secrets using `.bru` syntax. This helps AI assistants suggest and use correct configuration values. ```bru # environments/development.bru vars { baseUrl: https://api.dev.example.com apiVersion: v1 } vars:secret [ authToken, apiKey ] ``` -------------------------------- ### Full opencollection.yml Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/prompts/general/bruno-ai-context.md Includes optional collection-level fields like info, config, request variables/scripts, and docs. Request-specific keys like 'http:' should not be included here. ```yaml opencollection: 1.0.0 info: name: Bruno Example config: proxy: inherit: true request: variables: - name: tokenVar value: tokenCollection disabled: true scripts: - type: before-request code: // console.log('Collection Level Script Logic') docs: content: |- ### Markdown Docs type: text/markdown ``` -------------------------------- ### Configure Ollama Local Model in config.json Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/continue.md Example JSON configuration for connecting to a local model using Ollama. ```json { "models": [ { "title": "Llama 3", "provider": "ollama", "model": "llama3" } ] } ``` -------------------------------- ### Configure Anthropic API Key in config.json Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/continue.md Example JSON configuration for setting up Anthropic Claude models, including the API key. ```json { "models": [ { "title": "Claude 3 Sonnet", "provider": "anthropic", "model": "claude-3-sonnet-20240229", "apiKey": "sk-ant-your-api-key-here" } ] } ``` -------------------------------- ### Test Assertions Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/copilot.md Example of test assertions using Chai.js within Bruno's runtime scripts. Copilot suggests common assertions for response status and body. ```yaml runtime: scripts: - type: tests code: |- test("Status is 200", function() { expect(res.status).to.equal(200); }); test("Response has data", function() { expect(res.body).to.have.property("data"); }); ``` -------------------------------- ### Bru File Format Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/prompts/general/bruno-ai-context-bru.md Defines an HTTP POST request for creating a user, including metadata, request details, headers, authentication, JSON body, pre-request and post-response scripts, tests, and variable definitions. ```bru meta { name: Create User type: http seq: 1 tags: [user-management, post-request] } post { url: {{baseUrl}}/api/users body: json auth: bearer } headers { content-type: application/json accept: application/json x-api-version: {{apiVersion}} } auth:bearer { token: {{authToken}} } body:json { { "name": "{{userName}}", "email": "{{userEmail}}", "role": "user" } } script:pre-request { // JavaScript executed before request const timestamp = Date.now(); bru.setVar("requestId", `req_${timestamp}`); // Validate required variables if (!bru.getVar("userName")) { throw new Error("userName is required"); } } script:post-response { // JavaScript executed after response if (res.status === 201) { bru.setVar("newUserId", res.body.id); bru.setVar("userCreated", true); } } tests { test("User created successfully", function() { expect(res.status).to.equal(201); expect(res.body).to.have.property("id"); expect(res.body.name).to.equal(bru.getVar("userName")); }); test("Response time is acceptable", function() { expect(res.responseTime).to.be.below(2000); }); } vars:pre-request { userName: John Doe userEmail: john@example.com } vars:post-response { userId: {{res.body.id}} createdAt: {{res.body.created_at}} } ``` -------------------------------- ### Install Bruno AI Assistant Prompts via Git Submodule Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/README.md Add the AI assistant prompts repository as a Git submodule to your Bruno project and create a symbolic link for the .cursorrules file. ```bash git submodule add https://github.com/bruno-collections/ai-assistant-prompts.git .bruno-ai ln -s .bruno-ai/prompts/cursor/.cursorrules .cursorrules ``` -------------------------------- ### Install Cursor AI Rules Manually Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/cursor.md Manually download the .cursorrules file to your Bruno project root. Restart Cursor after placing the file to load the new rules. ```bash curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/prompts/cursor/.cursorrules -o .cursorrules ``` -------------------------------- ### Add Request Chaining Script Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/vscode.md Example of a post-response script to extract data (user ID) from the response and set it as a variable for chaining to the next request. ```bru script:post-response { if (res.status === 201) { // Extract user ID from response const userId = res.body.id; bru.setVar("userId", userId); // Chain to the next request bru.setNextRequest("Get User Profile"); } } ``` -------------------------------- ### Adding Comprehensive Tests Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/cursor.md Example of comprehensive test assertions for an API request, checking status codes, response time, and response body structure. ```bru tests { test("Response status is successful", function() { expect(res.status).to.be.oneOf([200, 201]); }); test("Response time is acceptable", function() { expect(res.responseTime).to.be.below(2000); }); test("Response has required structure", function() { expect(res.body).to.be.an("object"); expect(res.body).to.have.property("data"); }); } ``` -------------------------------- ### YAML Request File Format Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/prompts/general/bruno-ai-context.md Defines an HTTP POST request with headers, JSON body, bearer token authentication, and runtime scripts for pre-request, after-response, and tests. Uses bru API for variable manipulation and assertions. ```yaml info: name: Create User type: http seq: 1 http: method: POST url: "{{baseUrl}}/api/users" headers: - name: content-type value: application/json - name: accept value: application/json body: type: json data: |- { "name": "{{userName}}", "email": "{{userEmail}}", "role": "user" } auth: type: bearer token: "{{authToken}}" runtime: scripts: - type: before-request code: |- const timestamp = Date.now(); bru.setVar("requestId", `req_${timestamp}`); if (!bru.getVar("userName")) { throw new Error("userName is required"); } - type: after-response code: |- if (res.status === 201) { bru.setVar("newUserId", res.body.id); bru.setVar("userCreated", true); } - type: tests code: |- test("User created successfully", function() { expect(res.status).to.equal(201); expect(res.body).to.have.property("id"); expect(res.body.name).to.equal(bru.getVar("userName")); }); test("Response time is acceptable", function() { expect(res.responseTime).to.be.below(2000); }); settings: encodeUrl: true ``` -------------------------------- ### Commented Bruno Request Example Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/troubleshooting.md Illustrates how to add comments to a Bruno request file, including meta information and explanations for different steps in an authentication flow. Comments help in understanding and maintaining complex request sequences. ```bru # OAuth2 authentication flow # Step 1: Get access token meta { name: Get Access Token type: http } ``` -------------------------------- ### Manage Cookies with bru.cookies.jar Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/prompts/general/bruno-ai-context-bru.md Demonstrates how to create, set, get, delete, and clear cookies using the bru.cookies.jar API. Supports setting cookies with various options like domain, path, and security flags. ```javascript const jar = bru.cookies.jar(); jar.setCookie("https://api.example.com", "sessionId", "abc123"); jar.setCookie("https://api.example.com", { key: "authToken", value: "xyz789", domain: "example.com", path: "/api", secure: true, httpOnly: true, maxAge: 3600 // 1 hour }); const cookie = await jar.getCookie("https://api.example.com", "sessionId"); const allCookies = await jar.getCookies("https://api.example.com"); jar.deleteCookie("https://api.example.com", "sessionId"); jar.deleteCookies("https://api.example.com"); jar.clear(); ``` -------------------------------- ### Example Bruno Tests with Chai.js Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/troubleshooting.md Implement tests for API responses using Chai.js assertions within a `.bru` file. This demonstrates how to structure tests for status codes, response bodies, and data validation. ```bru tests { test("Status is successful", function() { expect(res.status).to.be.oneOf([200, 201]); }); test("Response has required fields", function() { expect(res.body).to.have.property("id"); expect(res.body).to.have.property("name"); }); } ``` -------------------------------- ### GitHub Actions Workflow for Bruno API Tests Source: https://context7.com/bruno-collections/ai-assistant-prompts/llms.txt Automate API test execution on every push or pull request using `@usebruno/cli`. This workflow checks out code, sets up Node.js, installs the Bruno CLI, runs tests against different environments, and uploads results. ```yaml # .github/workflows/api-tests.yml name: Bruno API Tests on: push: branches: [main, develop] pull_request: branches: [main] jobs: api-tests: runs-on: ubuntu-latest strategy: matrix: environment: [Development, Staging, Production] steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: "20" - name: Install Bruno CLI run: npm install -g @usebruno/cli - name: Run API Tests — ${{ matrix.environment }} working-directory: ./bruno-collection # must point to collection root env: API_KEY: ${{ secrets.API_KEY }} BASE_URL: ${{ secrets.BASE_URL }} run: | bru run \ --env ${{ matrix.environment }} \ --reporter-html results-${{ matrix.environment }}.html \ --reporter-junit results-${{ matrix.environment }}.xml \ --bail - name: Upload Test Results if: always() uses: actions/upload-artifact@v4 with: name: test-results-${{ matrix.environment }} path: ./bruno-collection/results-${{ matrix.environment }}.* ``` -------------------------------- ### Download Copilot Instructions (Bru) Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/copilot.md Download the legacy Bru format Copilot instructions and save it to .github/copilot-instructions.md. ```bash curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/prompts/copilot/.github/copilot-instructions-bru.md -o .github/copilot-instructions.md ``` -------------------------------- ### Create .github Directory Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/copilot.md Manually create the .github directory if it does not exist to store Copilot instructions. ```bash mkdir -p .github ``` -------------------------------- ### Clone Repository Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/CONTRIBUTING.md Clone the repository and navigate into the project directory to begin contributing. ```bash git clone https://github.com/YOUR_USERNAME/ai-assistant-prompts.git cd ai-assistant-prompts ``` -------------------------------- ### Download Bruno Continue Configuration (Bash) Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/continue.md Download the default Continue configuration file for Bruno. Remember to update it with your API keys. ```bash curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/prompts/continue/.continue/config.json -o .continue/config.json ``` -------------------------------- ### Verify and Re-download GitHub Copilot Instructions Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/troubleshooting.md Ensure the `copilot-instructions.md` file is present in the `.github/` directory. If not, this command creates the directory and downloads the file. ```bash # Verify copilot-instructions.md exists ls -la .github/copilot-instructions.md # Re-download if missing mkdir -p .github curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/prompts/copilot/.github/copilot-instructions.md -o .github/copilot-instructions.md ``` -------------------------------- ### Dynamic Variables Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/prompts/general/bruno-ai-context.md Predefined dynamic variables for generating random data like GUIDs, emails, names, and more. ```APIDOC ## Dynamic Variables Bruno supports dynamic variables that generate random data. Use them anywhere in your requests: **Identity:** - `{{$guid}}` - Random GUID/UUID - `{{$randomEmail}}` - Random email address - `{{$randomFirstName}}` - Random first name - `{{$randomLastName}}` - Random last name - `{{$randomFullName}}` - Random full name - `{{$randomPhoneNumber}}` - Random phone number **Location:** - `{{$randomCity}}` - Random city name - `{{$randomCountry}}` - Random country name - `{{$randomStreetAddress}}` - Random street address **Numbers & Text:** - `{{$randomInt}}` - Random integer - `{{$randomUUID}}` - Random UUID - `{{$timestamp}}` - Current Unix timestamp - `{{$isoTimestamp}}` - Current ISO 8601 timestamp **Job & Company:** - `{{$randomJobTitle}}` - Random job title - `{{$randomCompanyName}}` - Random company name Example usage: ```javascript // In pre-request script const email = bru.interpolate('{{$randomEmail}}'); bru.setVar("userEmail", email); ``` ``` -------------------------------- ### Download Copilot Instructions (YAML) Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/copilot.md Download the default YAML format Copilot instructions for Bruno v3.1+ and save it to .github/copilot-instructions.md. ```bash curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/prompts/copilot/.github/copilot-instructions.md -o .github/copilot-instructions.md ``` -------------------------------- ### Download AI Instructions File Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/vscode.md Manually download the AI instructions file to the .vscode directory. This file provides context and guidance to AI assistants. ```bash curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/prompts/vscode/.vscode/ai-instructions.md -o .vscode/ai-instructions.md ``` -------------------------------- ### Configure Basic Authentication in YAML Source: https://context7.com/bruno-collections/ai-assistant-prompts/llms.txt This YAML configuration demonstrates how to set up Basic authentication using username and password. ```yaml # Basic auth auth: type: basic username: "{{username}}" password: "{{password}}" ``` -------------------------------- ### Pull Request Template Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/CONTRIBUTING.md A template for creating pull requests, including sections for description, type of change, testing, and optional screenshots or examples. ```markdown ## Description Brief description of changes ## Type of Change - [ ] New AI assistant support - [ ] Prompt improvement - [ ] Documentation update - [ ] Bug fix - [ ] Example addition ## Testing - [ ] Tested with target AI assistant - [ ] Verified .bru file generation - [ ] Checked documentation accuracy - [ ] Tested installation process ## Screenshots/Examples [If applicable, include examples of the AI assistant using your prompts] ``` -------------------------------- ### Generate Bruno Request File Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/continue.md Example of a generated Bruno request file for a POST request, including body and tests. This is an output of the /bruno-request command. ```bru meta { name: Create Product type: http seq: 1 } post { url: {{baseUrl}}/api/products body: json auth: bearer } headers { content-type: application/json } auth:bearer { token: {{authToken}} } body:json { { "name": "{{productName}}", "price": {{productPrice}}, "category": "{{productCategory}}" } } tests { test("Product created successfully", function() { expect(res.status).to.equal(201); expect(res.body).to.have.property("id"); }); } ``` -------------------------------- ### Download Bruno AI Context File Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/general.md Use this command to download the general AI context file for Bruno development. ```bash curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/prompts/general/bruno-ai-context.md -o bruno-ai-context.md ``` -------------------------------- ### Verify and Re-download VS Code AI Instructions Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/troubleshooting.md Check for the `ai-instructions.md` file within the `.vscode/` directory. If it's missing, this command will create the directory and download the necessary file. ```bash # Verify ai-instructions.md exists ls -la .vscode/ai-instructions.md # Re-download if missing mkdir -p .vscode curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/prompts/vscode/.vscode/ai-instructions.md -o .vscode/ai-instructions.md ``` -------------------------------- ### Add GitHub Copilot Instructions to Git Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/copilot.md Stage, commit, and push the GitHub Copilot instructions file to your repository for team collaboration. ```bash git add .github/copilot-instructions.md git commit -m "Add GitHub Copilot instructions for Bruno" git push ``` -------------------------------- ### Create New AI Assistant Directories Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/CONTRIBUTING.md Create the necessary directory structure for a new AI assistant within the prompts and docs folders. ```bash mkdir -p prompts/your-ai-assistant mkdir -p docs ``` -------------------------------- ### Conditional Request Skipping Based on Environment Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/prompts/general/bruno-ai-context-bru.md Skip a request based on the current environment variable. This example prevents a request from running if the environment is set to 'production'. ```javascript // Skip request based on environment const env = bru.getEnvVar("environment"); if (env === "production") { bru.runner.skipRequest(); } ``` -------------------------------- ### Initial Prompt Template for Bruno Development Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/general.md Template for the initial prompt when using AI assistants for Bruno development. Paste the downloaded context file content where indicated. ```plaintext I'm working with Bruno API Client, which uses a unique .bru file format for API requests. Here's the context about Bruno: [Paste bruno-ai-context.md contents here] Please use this context when helping me with Bruno development. I need help with [specific task]. ``` -------------------------------- ### Update Bruno Prompt Files Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/troubleshooting.md Use this command to update your local Bruno prompt files to the latest version from the main repository. This ensures you have the most up-to-date API references and examples. ```bash # Update to the latest prompt files cd your-bruno-project curl -fsSL https://raw.githubusercontent.com/bruno-collections/ai-assistant-prompts/main/install.sh | bash ``` -------------------------------- ### Chai.js Assertions for Tests Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/prompts/general/bruno-ai-context-bru.md Use Chai.js assertions within the `tests` block to validate API responses. Examples cover status codes, response structure, response time, headers, and data validation. ```javascript test("Status code is 200", function() { expect(res.status).to.equal(200); }); ``` ```javascript test("Response has correct structure", function() { expect(res.body).to.be.an("object"); expect(res.body).to.have.property("data"); expect(res.body.data).to.be.an("array"); }); ``` ```javascript test("Response time is acceptable", function() { expect(res.responseTime).to.be.below(2000); }); ``` ```javascript test("Headers are correct", function() { expect(res.headers["content-type"]).to.include("application/json"); }); ``` ```javascript test("Data validation", function() { expect(res.body.user.email).to.match(/^["\w-\\.]+@([\"\w-]+\\.)+[\w-]{2,4}$/); expect(res.body.user.age).to.be.a("number"); expect(res.body.user.age).to.be.at.least(18); }); ``` -------------------------------- ### Commit AI Instructions to Repository Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/vscode.md Stage and commit the `.vscode/ai-instructions.md` file to your Git repository to share project-specific AI guidance with your team. ```bash git add .vscode/ai-instructions.md git commit -m "Add VS Code AI instructions for Bruno development" ``` -------------------------------- ### Define Production Environment Variables in YAML Source: https://context7.com/bruno-collections/ai-assistant-prompts/llms.txt This YAML snippet defines environment variables for a production setup. It includes base URL, API version, timeout, and sensitive API keys/tokens marked as secrets. ```yaml # environments/Production.yml (OpenCollection YAML format) variables: - name: baseUrl value: https://api.example.com - name: apiVersion value: v1 - name: timeout value: "30000" - name: apiKey value: "" secret: true - name: authToken value: "" secret: true - name: clientSecret value: "" secret: true ``` -------------------------------- ### Implement Request Chaining and Authentication Flow Source: https://context7.com/bruno-collections/ai-assistant-prompts/llms.txt Log in, store the authentication token, and proceed to the next request using after-response scripts. ```yaml info: name: Login type: http seq: 1 http: method: POST url: "{{baseUrl}}/auth/login" body: type: json data: |- { "username": "{{username}}", "password": "{{password}}" } auth: type: none runtime: scripts: - type: after-response code: |- if (res.status === 200) { bru.setEnvVar("authToken", res.body.access_token); bru.setNextRequest("Get User Profile"); } else { bru.setNextRequest(null); } - type: tests code: |- test("Login successful", function() { expect(res.status).to.equal(200); expect(res.body).to.have.property("access_token"); }); ``` -------------------------------- ### Copy Prompt Files for AI Assistants Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/examples/rest-api/README.md Copy prompt files to your Bruno project directory based on the AI assistant you are using. ```bash # For Cursor AI cp prompts/cursor/.cursorrules /path/to/your/project/ ``` ```bash # For GitHub Copilot cp prompts/copilot/.github/copilot-instructions.md /path/to/your/project/.github/ ``` ```bash # For VS Code AI Extensions cp prompts/vscode/.vscode/ai-instructions.md /path/to/your/project/.vscode/ ``` -------------------------------- ### Configure OAuth2 Authorization Code Authentication in YAML Source: https://context7.com/bruno-collections/ai-assistant-prompts/llms.txt This YAML configuration details the setup for OAuth2 Authorization Code grant type, including callback URL, authorization and token endpoints, client credentials, and scopes. ```yaml # OAuth2 Authorization Code auth: type: oauth2 grant_type: authorization_code callback_url: http://localhost:8080/callback authorization_url: https://provider.com/oauth/authorize access_token_url: https://provider.com/oauth/token client_id: "{{client_id}}" client_secret: "{{client_secret}}" scope: read write ``` -------------------------------- ### Data-Driven Testing with Dynamic Variables Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/prompts/general/bruno-ai-context-bru.md Perform data-driven testing by generating dynamic test data in the pre-request script and validating the response in the post-response script. This example uses random email, name, and phone number generation. ```javascript // Pre-request: Generate test data const testUser = { email: bru.interpolate('{{$randomEmail}}'), name: bru.interpolate('{{$randomFullName}}'), phone: bru.interpolate('{{$randomPhoneNumber}}') }; req.setBody(JSON.stringify(testUser)); // Post-response: Validate and store test("User created successfully", function() { expect(res.status).to.equal(201); bru.setVar("userId", res.body.id); }); ``` -------------------------------- ### Manage Cookies with Bruno's Cookie Jar API Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/prompts/general/bruno-ai-context.md Demonstrates how to create, set, get, delete, and clear cookies using the bru.cookies.jar() API. Supports setting cookies with various options like domain, path, and expiration. ```javascript // Create a cookie jar const jar = bru.cookies.jar(); // Set a simple cookie jar.setCookie("https://api.example.com", "sessionId", "abc123"); // Set a cookie with options jar.setCookie("https://api.example.com", { key: "authToken", value: "xyz789", domain: "example.com", path: "/api", secure: true, httpOnly: true, maxAge: 3600 // 1 hour }); // Get a specific cookie const cookie = await jar.getCookie("https://api.example.com", "sessionId"); // Get all cookies for a URL const allCookies = await jar.getCookies("https://api.example.com"); // Delete a cookie jar.deleteCookie("https://api.example.com", "sessionId"); // Delete all cookies for a URL jar.deleteCookies("https://api.example.com"); // Clear all cookies jar.clear(); ``` -------------------------------- ### Define Development Environment Variables in Legacy Bru Format Source: https://context7.com/bruno-collections/ai-assistant-prompts/llms.txt This snippet defines environment variables for a development setup using the legacy Bru format. It specifies base URL, API version, timeout, and lists sensitive variables. ```bru # environments/development.bru (legacy Bru format) vars { baseUrl: https://api.dev.example.com apiVersion: v1 timeout: 5000 } vars:secret [ apiKey, authToken, clientSecret ] ``` -------------------------------- ### Correct Bruno API Usage in Scripts Source: https://github.com/bruno-collections/ai-assistant-prompts/blob/main/docs/troubleshooting.md Demonstrates the correct usage of `bru.setVar`, `bru.getVar`, `req.setHeader`, and `bru.setNextRequest` within pre-request and post-response scripts. Ensure your prompt files include the JavaScript API reference for correct syntax. ```bru script:pre-request { // Correct Bruno API usage bru.setVar("timestamp", Date.now()); req.setHeader("X-Request-ID", bru.getVar("requestId")); } script:post-response { if (res.status === 200) { bru.setVar("userId", res.body.id); bru.setNextRequest("Get User Profile"); } } ``` -------------------------------- ### Use Dynamic Variables in YAML and JavaScript Source: https://context7.com/bruno-collections/ai-assistant-prompts/llms.txt Leverage built-in dynamic variables for generating unique values like GUIDs, timestamps, and random data. These can be used directly in request fields (URLs, headers, body) via YAML interpolation or generated programmatically using `bru.interpolate()` in JavaScript. ```yaml # In any http: field http: url: "{{baseUrl}}/users/{{$guid}}" headers: - name: x-request-id value: "{{$randomUUID}}" body: type: json data: |- { "email": "{{$randomEmail}}", "name": "{{$randomFullName}}", "phone": "{{$randomPhoneNumber}}", "city": "{{$randomCity}}", "country": "{{$randomCountry}}", "ts": "{{$isoTimestamp}}" } ``` -------------------------------- ### Continue Extension Configuration (`.continue/config.json`) Source: https://context7.com/bruno-collections/ai-assistant-prompts/llms.txt Register Bruno-specific slash commands and a system message for the Continue AI extension. This configuration helps the AI understand and interact with Bruno API Client files. ```json { "models": [ { "title": "GPT-4", "provider": "openai", "model": "gpt-4", "apiKey": "[API_KEY]" } ], "customCommands": [ { "name": "bruno-request", "description": "Generate a Bruno API request file (YAML format)", "prompt": "Create a new Bruno .yml request file using the OpenCollection YAML format..." }, { "name": "bruno-test", "description": "Add tests to Bruno request", "prompt": "Add comprehensive tests to a Bruno .yml request file using Chai.js assertions under runtime.scripts with type: tests..." }, { "name": "bruno-collection", "description": "Create a Bruno OpenCollection root file", "prompt": "Create a new Bruno collection with an opencollection.yml root file starting with 'opencollection: 1.0.0'..." } ], "systemMessage": "You are an expert in Bruno API Client (v3.1+, YAML/OpenCollection format)...", "slashCommands": [ { "name": "bruno", "description": "Get help with Bruno API Client development" } ] } ```