diff --git a/README.md b/README.md index 5218377..243ec10 100644 --- a/README.md +++ b/README.md @@ -99,4 +99,55 @@ Generates file: `knowledge_base/history.md` - Always activate the virtual environment before using the tool: `source venv/bin/activate` - Never delete a test case — change the state to `Blocked` if no longer applicable - Update `roadmap.md` whenever a step is completed -- The `venv/` folder should not be shared or pushed to Git \ No newline at end of file +- The `venv/` folder should not be shared or pushed to Git + + +## Changelog + +- 2026-06-30 — Initial project setup + +## Requirements + +> Already listed above, but for AI integration add: +- [Ollama](https://ollama.com) installed and running +- Llama 3.2 model pulled locally + +## AI Integration Setup + +**1. Install Ollama:** +```bash +curl -fsSL https://ollama.com/install.sh | sh +``` + +**2. Start the Ollama server:** +```bash +ollama serve +``` + +**3. Pull the Llama 3.2 model:** +```bash +ollama pull llama3.2 +``` + +**4. Install the Python Ollama library:** +```bash +pip install ollama +``` + +> Note: The `ollama serve` terminal must remain active while using the `ask` command. + +## AI Command + +### šŸ¤– Ask the AI agent a question +```bash +python agent/cli.py ask "Your question here" +``` + +The agent reads the entire Knowledge Base (test cases, roadmap, guidelines) before answering, ensuring responses are always contextualised to your project. + +**Examples:** +```bash +python agent/cli.py ask "What should I test next?" +python agent/cli.py ask "What test cases do we have for the Login module?" +python agent/cli.py ask "What are the team guidelines for automation?" +``` \ No newline at end of file diff --git a/agent/cli.py b/agent/cli.py index a862809..47b8415 100644 --- a/agent/cli.py +++ b/agent/cli.py @@ -227,5 +227,49 @@ def export_tests_history(): click.echo(f"\nāœ… Test cases history exported to knowledge_base/test_cases_history.md\n") +# Command: ask a question to the AI agent +@cli.command() +@click.argument("question") +def ask(question): + """Ask a question to the AI agent based on the Knowledge Base.""" + import ollama + + # Load knowledge base context + with open(TEST_CASES_PATH, "r") as f: + test_cases = json.load(f) + + roadmap_path = os.path.join(BASE_DIR, "knowledge_base", "roadmap", "roadmap.md") + with open(roadmap_path, "r") as f: + roadmap = f.read() + + guidelines_path = os.path.join(BASE_DIR, "knowledge_base", "guidelines", "guidelines.md") + with open(guidelines_path, "r") as f: + guidelines = f.read() + + # Build context + context = f""" +You are a QA assistant. Answer based only on the following project information: + +TEAM ROADMAP: +{roadmap} + +QA GUIDELINES: +{guidelines} + +TEST CASES: +{json.dumps(test_cases, indent=2)} + +Answer the following question: {question} +""" + + click.echo("\nšŸ¤– Thinking...\n") + + response = ollama.chat( + model="llama3.2", + messages=[{"role": "user", "content": context}] + ) + + click.echo(f"{response['message']['content']}\n") + if __name__ == "__main__": cli() \ No newline at end of file