The Cognotik Build Integration Demo showcases how to integrate Cognotik as a build and automation tool using GitHub Actions. This repository provides working examples of AI-powered code review, automated bug fixing, and intelligent issue resolution integrated directly into your CI/CD pipeline.
- Features
- Quick Start
- Usage
- What is Cognotik?
- GitHub Actions Workflows
- Configuration
- API Providers
- Contributing
- License
- π Ready-to-Use GitHub Actions: Pre-configured workflows for immediate integration
- π§ Automated Build Fixing: Automatically fix failing builds in pull requests
- π« Intelligent Issue Resolution: AI agents that create PRs to resolve GitHub issues
- π€ Multi-Model Support: Works with OpenAI, Google Gemini, Anthropic Claude, and Groq
- π Code Review Automation: Review code against best practices and standards
- ποΈ Code Generation: Generate implementations from natural language descriptions
- π Documentation Processing: Automatically update code and docs based on markdown specifications
git clone https://github.com/SimiaCryptus/CognotikDemo.git
cd CognotikDemoAdd the following secrets to your GitHub repository (Settings β Secrets and variables β Actions):
OPENAI_API_KEY- Your OpenAI API keyGOOGLE_API_KEY- Your Google Gemini API key (recommended)
The workflows in .github/workflows/ will automatically:
- Fix failing builds in pull requests
- Create PRs to resolve issues labeled with
agent-help
export GOOGLE_API_KEY="your-google-api-key"
./gradlew codeReview -PreviewPrompt="Review and improve code quality in file (%s)"Cognotik is a powerful AI-powered code automation framework that enables intelligent code review, generation, and modification using large language models (LLMs). This demo project shows how to leverage Cognotik's capabilities within GitHub Actions workflows.
- Code Reviewer: Analyzes source files against standards and suggests improvements
- Code Fixer: Parses build logs and automatically fixes compilation/test errors
- Code Implementer: Generates new code from natural language descriptions
This demo includes two pre-configured GitHub Actions workflows that showcase Cognotik's automation capabilities.
File: .github/workflows/autofix_build.yml
Automatically detects and fixes failing builds in pull requests.
- Triggered on pull requests to
main - Runs the test suite and captures output to
build.log - If tests fail, invokes Cognotik's Code Fixer agent
- Agent analyzes the build log and fixes implementation files
- Verifies the fix by re-running tests
- Commits the fixes automatically
name: Auto-Fixing Build Validator
on:
pull_request:
branches: [ main ]
jobs:
build-and-fix:
runs-on: ubuntu-latest
steps:
- name: Run Tests
id: run_tests
run: ./gradlew test 2>&1 | tee build.log
continue-on-error: true
- name: Agentic Auto-Fix
if: steps.run_tests.outcome == 'failure'
run: |
./gradlew codeFixer \
-PfixPrompt="Fix the build errors" \
-PfixLog="build.log"File: .github/workflows/issue_handler.yml
Automatically creates pull requests to resolve GitHub issues labeled with agent-help.
- Triggered when an issue is opened or labeled with
agent-help - Analyzes the issue title and description
- Invokes Cognotik's Code Implementer agent
- Agent reviews relevant source files and generates fixes
- Creates a pull request with the proposed changes
- Comments on the issue if no changes were needed
- Create a new issue describing the bug or feature
- Add the
agent-helplabel - Wait for the agent to analyze and create a PR
| Secret | Description | Required |
|---|---|---|
GOOGLE_API_KEY |
Google Gemini API key | Yes* |
OPENAI_API_KEY |
OpenAI API key | Yes* |
*At least one API key is required. Google Gemini is recommended for best results.
| Secret | Description |
|---|---|
ANTHROPIC_API_KEY |
Anthropic Claude API key |
GROQ_API_KEY |
Groq API key |
This demo provides three main Gradle tasks:
./gradlew codeReview \
-PreviewPrompt="Update implementation file (%s) according to best practices" \
-PreviewSrc="src/main/java" \
-PreviewThreads=4./gradlew codeFixer \
-PfixPrompt="Fix the build errors reported in build.log" \
-PfixLog="build.log"./gradlew codeImplementer \
-PimplPrompt="Create a REST API endpoint for user management" \
-PimplHeadless=true./gradlew docProcessor \
-PoverwriteMode="PatchToUpdate" \
-ProotDir="." \
-Pthreads=4The DocProcessor enables bidirectional synchronization between documentation and code using markdown frontmatter specifications.
Create markdown files with YAML frontmatter that specify relationships to source files:
Use the specifies key to indicate which files should be updated based on the documentation:
---
specifies:
- "../src/main/java/com/example/*.java"
- "../src/main/kotlin/**/*.kt"
---
# API Design Guidelines
All service classes should follow these patterns...Use the documents key to indicate which source files should inform the documentation:
---
documents:
- "../src/main/java/com/example/UserService.java"
- "../src/main/java/com/example/UserRepository.java"
---
# User Service API Documentation
This documentation is automatically updated based on the source files...Use the transforms key to specify source-to-destination file mappings with regex patterns:
---
transforms:
- "src/main/java/(.+)\\.java -> src/test/java/$1Test.java"
- "src/main/kotlin/(.+)\\.kt -> docs/api/$1.md"
---
# Test Generation Template
Generate test files based on the source implementation...| Key | Description | Example |
|---|---|---|
specifies |
Glob patterns for files to update based on this doc | "../src/**/*.java" |
documents |
Glob patterns for source files that inform this doc | "../src/main/**/*.kt" |
transforms |
Regex patterns with backreferences for file transformations | "src/(.+)\\.java -> test/$1Test.java" |
| Mode | Description |
|---|---|
SkipExisting |
Skip files that already exist |
OverwriteExisting |
Completely replace existing files |
OverwriteToUpdate |
Replace files only if source is newer than target |
PatchExisting |
Apply incremental patches to existing files |
PatchToUpdate |
Apply incremental patches only if source is newer than target (default) |
Cognotik supports multiple AI providers. Configure your preferred provider:
| Provider | Model Example | Environment Variable |
|---|---|---|
| Gemini 3.0 | GOOGLE_API_KEY |
|
| OpenAI | GPT-4o | OPENAI_API_KEY |
| Anthropic | Claude 4.5 | ANTHROPIC_API_KEY |
| Groq | Llama 3 70B | GROQ_API_KEY |
We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
- π Cognotik Documentation
- π Issue Tracker
- π¬ Discussions
Made with β€οΈ by SimiaCryptus | Powered by Cognotik
- π Documentation Processing: Automatically update code and docs based on markdown specifications