Metadata-Version: 2.3
Name: friday-cli
Version: 0.1.46
Summary: AI-powered testing agent
License: MIT
Keywords: atlassian,jira,google,github,vertexai,genai,chroma,openai,cli
Author: Dipjyoti Metia
Author-email: dipjyotimetia@gmail.com
Requires-Python: >=3.12,<4.0
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Testing
Requires-Dist: atlassian-python-api (>=3.41.19,<4.0.0)
Requires-Dist: chromadb (>=0.5.23,<0.6.0)
Requires-Dist: fastapi (>=0.115.7,<0.116.0)
Requires-Dist: google-cloud-aiplatform (>=1.79.0,<2.0.0)
Requires-Dist: google-genai (>=0.7.0,<0.8.0)
Requires-Dist: httpx (>=0.28.1,<0.29.0)
Requires-Dist: jsonschema (>=4.23.0,<5.0.0)
Requires-Dist: langchain (>=0.3.16,<0.4.0)
Requires-Dist: langchain-chroma (>=0.2.2,<0.3.0)
Requires-Dist: langchain-community (>=0.3.16,<0.4.0)
Requires-Dist: langchain-core (>=0.3.32,<0.4.0)
Requires-Dist: langchain-google-genai (>=2.0.9,<3.0.0)
Requires-Dist: langchain-mistralai (>=0.2.6,<0.3.0)
Requires-Dist: langchain-ollama (>=0.2.3,<0.3.0)
Requires-Dist: langchain-openai (>=0.3.2,<0.4.0)
Requires-Dist: pygithub (>=2.5.0,<3.0.0)
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
Requires-Dist: python-json-logger (>=3.2.1,<4.0.0)
Requires-Dist: python-multipart (>=0.0.20,<0.0.21)
Requires-Dist: retrying (>=1.3.4,<2.0.0)
Requires-Dist: scrapy (>=2.12.0,<3.0.0)
Requires-Dist: sentence-transformers (>=3.4.1,<4.0.0)
Requires-Dist: structlog (>=25.1.0,<26.0.0)
Requires-Dist: typer (>=0.15.1,<0.16.0)
Requires-Dist: uvicorn[standard] (>=0.34.0,<0.35.0)
Requires-Dist: websocket (>=0.2.1,<0.3.0)
Project-URL: Bug Tracker, https://github.com/dipjyotimetia/friday/issues
Project-URL: Homepage, https://github.com/dipjyotimetia/friday
Description-Content-Type: text/markdown

# FRIDAY - AI Test Agent

An AI-powered test agent that uses Generative AI and LangChain to automatically create test cases from Jira/GitHub issues and execute API tests, for a streamlined testing experience.

- **Web Application**: React-based UI running on port 3000 for visual interaction
- **CLI Application**: Command-line tool for quick test case generation and web crawling
- **REST API**: FastAPI service running on port 8080 for system integration

[![License](https://img.shields.io/badge/license-MIT-orange.svg)](https://opensource.org/licenses/MIT)

<p align="center">
  <img src="docs/images/friday.png" alt="Friday Logo" width="700">
</p>

## ✨ Key Features

-   **AI-Powered Test Case Generation:** Leverage Google Gemini, OpenAI or mistral to generate test cases.
-   **Requirement Extraction:** Automatically extract requirements from Jira tickets or GitHub issues.
-   **Contextual Integration:** Incorporate relevant context from Confluence pages.
-   **LangChain Processing:** Utilize LangChain for advanced prompt engineering.
-   **Vectorized Storage:** Store and search documents efficiently using ChromaDB vectorization.
-   **Flexible Export:** Export test cases in JSON or Markdown format.
-   **Web Crawling:** Enhance context by creating embeddings using a web crawler.
-   **API Testing:** Execute API tests using OpenAPI specifications.

## ⚙️ Setup

### Prerequisites

-   Python 3.12+
-   Gemini enabled or OpenAI API key 
-   Jira/GitHub and Confluence access credentials

### Installation

1.  **Install via Homebrew:**

    ```bash
    brew tap dipjyotimetia/friday
    brew install friday
    ```

2.  **Run setup:**

    ```bash
    friday setup
    ```

## ⚡️ Usage

### CLI Application

```bash
# From Jira
friday generate --jira-key PROJ-123 --confluence-id 12345 -o test_cases.md

# From GitHub
friday generate --gh-issue 456 --gh-repo owner/repo --confluence-id 12345 -o test_cases.md

# Crawl single domain
friday crawl https://example.com --provider openai --persist-dir ./my_data/chroma --max-pages 5

# Crawl multiple domains
friday crawl https://example.com --provider openai --persist-dir ./my_data/chroma --max-pages 10 --same-domain false

friday --help          # Show all commands
friday version         # Display version
friday generate --help # Show generation options
friday crawl --help    # Show crawling options
```

### REST API

```bash
uvicorn friday.api.app:app --reload --port 8080

# Generate test cases
curl -X POST http://localhost:8080/api/v1/generate \
  -H "Content-Type: application/json" \
  -d '{
    "jira_key": "PROJ-123",
    "confluence_id": "12345",
    "output": "test_cases.md"
  }'

# Run API tests
curl -X POST "http://localhost:8000/api/v1/testapi" \
  -H "Content-Type: multipart/form-data" \
  -F "base_url=https://petstore.swagger.io/v2/pet" \
  -F "spec_upload=@./docs/specs/petstore.yaml" \
  -F "output=report.md"
```

### Web Application

```bash
cd friday/app
npm install
npm start

Open http://localhost:3000 in your browser

* Generate test cases from Jira/GitHub issues
* Execute API tests with OpenAPI specifications
* Crawl websites for additional context
* View real-time test execution logs
```

## 🛠️ Development

1.  **Clone and setup:**

    ```bash
    git clone https://github.com/dipjyotimetia/friday.git
    cd friday
    chmod +x prerequisites.sh
    ./prerequisites.sh
    ```

2.  **Configure environment:**

    ```bash
    cp .env.example .env
    # Add your credentials to .env
    ```

3.  **Run Tests:**

    ```bash
    poetry run pytest tests/ -v
    ```

4.  **Format Code:**

    ```bash
    poetry run ruff format
    ```

5.  **Deploy to Google Cloud:**

    ```bash
    chmod +x deploy.sh
    PROJECT_ID="your-project" REGION="us-west1" ./deploy.sh
    ```

## 🐳 Development Container Setup

This project uses Visual Studio Code's Development Containers feature, providing a consistent development environment via Docker.

### Prerequisites

1.  [Visual Studio Code](https://code.visualstudio.com/)
2.  [Docker Desktop](https://www.docker.com/products/docker-desktop)
3.  [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)

### Features

-   Python 3.12 with Poetry package management
-   Node.js 22 with npm
-   Docker-in-Docker support
-   Pre-configured VS Code extensions:
    -   Python and Pylance
    -   ESLint
    -   Prettier
    -   Docker
    -   Ruff (Python linter)

### Environment Variables

Required environment variables (set these before opening the dev container):

```sh
GOOGLE_CLOUD_PROJECT
GOOGLE_CLOUD_REGION
GITHUB_ACCESS_TOKEN
GITHUB_USERNAME
JIRA_URL
JIRA_USERNAME
JIRA_API_TOKEN
CONFLUENCE_URL
CONFLUENCE_USERNAME
CONFLUENCE_API_TOKEN
OPENAI_API_KEY
GOOGLE_API_KEY
```

### Services

The development environment includes three services:

-   `workspace`: Main development container
-   `api`: FastAPI backend service (port 8080)
-   app: Frontend application (port 3000)

### Getting Started

1.  Clone the repository
2.  Copy .env.example to .env and fill in your credentials
3.  Open in VS Code
4.  Click "Reopen in Container" when prompted
5.  The container will build and install all dependencies automatically

## 🗺️ Sequence Diagram

<details>
<summary>Expand Sequence diagram</summary>

```mermaid
%%{init: {
    'theme': 'base',
    'themeVariables': {
        'primaryColor': '#1a1a1a',
        'primaryTextColor': '#fff',
        'primaryBorderColor': '#4285f4',
        'lineColor': '#4285f4',
        'secondaryColor': '#2d2d2d',
        'tertiaryColor': '#2d2d2d',
        'actorBkg': '#4285f4',
        'actorTextColor': '#fff',
        'actorLineColor': '#4285f4',
        'signalColor': '#6c757d',
        'signalTextColor': '#fff',
        'labelBoxBkgColor': '#2d2d2d',
        'labelBoxBorderColor': '#4285f4',
        'labelTextColor': '#fff',
        'loopTextColor': '#fff',
        'noteBorderColor': '#43a047',
        'noteBkgColor': '#43a047',
        'noteTextColor': '#fff',
        'activationBorderColor': '#4285f4',
        'activationBkgColor': '#2d2d2d',
        'sequenceNumberColor': '#fff'
    }
}}%%

sequenceDiagram
    box rgba(66, 133, 244, 0.1) External Components
    participant User
    end
    
    box rgba(66, 133, 244, 0.1) Core System
    participant Main
    participant IssueConnector
    participant JiraConnector
    participant GitHubConnector
    participant ConfluenceConnector
    participant TestCaseGenerator
    participant PromptBuilder
    end

    Note over User,PromptBuilder: Test Case Generation Flow

    User->>+Main: Run main.py with issue-key/number<br/>and confluence-id
    
    alt Jira Issue
        rect rgba(67, 160, 71, 0.1)
            Main->>+IssueConnector: Get issue details
            IssueConnector->>+JiraConnector: Fetch Jira issue
            JiraConnector-->>-IssueConnector: Return issue details
            IssueConnector-->>-Main: Return issue details
            Main->>+IssueConnector: Extract acceptance criteria
            IssueConnector->>JiraConnector: Extract from Jira
            JiraConnector-->>IssueConnector: Return criteria
            IssueConnector-->>-Main: Return acceptance criteria
        end
    else GitHub Issue
        rect rgba(67, 160, 71, 0.1)
            Main->>+IssueConnector: Get issue details
            IssueConnector->>+GitHubConnector: Fetch GitHub issue
            GitHubConnector-->>-IssueConnector: Return issue details
            IssueConnector-->>-Main: Return issue details
            Main->>+IssueConnector: Extract acceptance criteria
            IssueConnector->>GitHubConnector: Extract from GitHub
            GitHubConnector-->>IssueConnector: Return criteria
            IssueConnector-->>-Main: Return acceptance criteria
        end
    end
    
    rect rgba(255, 152, 0, 0.1)
        Main->>+ConfluenceConnector: Fetch Confluence<br/>page content
        ConfluenceConnector-->>-Main: Return page content
    end
    
    rect rgba(66, 133, 244, 0.1)
        Main->>+PromptBuilder: Build prompt with details
        PromptBuilder-->>-Main: Return prompt
        Main->>+TestCaseGenerator: Generate test cases
        TestCaseGenerator-->>-Main: Return test cases
    end
    
    Main->>-User: Save test cases to<br/>output file

    Note over User,PromptBuilder: Process Complete
```

</details>
MIT License

Copyright (c) 2025 Dipjyoti Metia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

