Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
24818cc
refactor!: adopt opinionated 4-command CLI architecture
Karib0u Dec 4, 2025
d3bb369
new snapshot fixtures
Karib0u Dec 4, 2025
249c05c
Fix ascii art logo
Karib0u Dec 4, 2025
aa255cf
Update Dockerfile and CLI for improved output handling and version bump
Karib0u Dec 5, 2025
e5e912e
Enhance message handling in ReverseEngineeringAgent
Karib0u Dec 5, 2025
3c56148
Add context handling and CLI enhancements
Karib0u Dec 5, 2025
25351ab
Fix ASCII art logo in CLI banner for improved visual presentation
Karib0u Dec 6, 2025
6e7b050
Remove deprecated prompts from prompts.py to streamline code and impr…
Karib0u Dec 6, 2025
12ec708
Enhance CLI and Dockerfile for improved functionality and user experi…
Karib0u Dec 6, 2025
7be342c
Update README and enhance test coverage for conversation history mana…
Karib0u Dec 6, 2025
467b4d7
Update version to 1.1.0 in pyproject.toml for release
Karib0u Dec 6, 2025
e2a573b
Update kernagent to version 1.1.0 and enhance BinaryArchiveExtractor …
Karib0u Dec 8, 2025
620310c
Refactor CLI output formatting in run_analyze and run_chat functions
Karib0u Dec 8, 2025
1ff28f2
Refactor BinaryArchiveExtractor for improved thread-local management …
Karib0u Dec 8, 2025
205ffd8
Refactor Dockerfile to simplify kernagent package inclusion
Karib0u Dec 8, 2025
51d2b6c
Add verbose logging for detected binaries in kernagent script
Karib0u Dec 8, 2025
c031948
Apply code quality improvements and linting fixes
Karib0u Dec 8, 2025
ddd5599
Add comprehensive type annotations and fix all type errors
Karib0u Dec 8, 2025
aa636b7
Update dependencies and CI configuration
Karib0u Dec 8, 2025
29a5f22
Update CI workflow to trigger on all branches
Karib0u Dec 8, 2025
892ec06
Refactor pruner.py for improved readability
Karib0u Dec 8, 2025
3adb0d0
Update CI workflow to improve efficiency and security
Karib0u Dec 8, 2025
2b49400
Enhance CI workflow with multi-platform testing support
Karib0u Dec 8, 2025
2b84e8e
Improve error logging in capa_runner.py for failed analysis
Karib0u Dec 9, 2025
ec52b1c
Refactor README and enhance agent functionality
Karib0u Dec 9, 2025
689ea1d
Refactor message formatting in ReverseEngineeringAgent class
Karib0u Dec 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 39 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,27 @@ name: CI

on:
push:
branches: [ main, develop ]
branches: [ main, develop ] # Run on main branches only
tags:
- 'v*' # Trigger on version tags (v1.0.0, v1.2.3, etc.)
pull_request:
branches: [ main, develop ]
workflow_dispatch: # Allow manual trigger
inputs:
test_multiplatform:
description: 'Test multi-platform build (amd64 + arm64)'
required: false
default: false
type: boolean

# Cancel previous runs on the same branch/PR to save resources
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Security: Default to read-only, escalate where needed
permissions:
contents: read

jobs:
test:
Expand Down Expand Up @@ -60,16 +76,21 @@ jobs:
cd kernagent
uv sync --all-groups

- name: Check Python syntax
- name: Run ruff format check
run: |
cd kernagent
uv run ruff format --check .

- name: Run ruff linting
run: |
cd kernagent
uv run python -m py_compile *.py */**.py
uv run ruff check .

# Build Docker image for PRs and develop branch (test only, no push)
# Build Docker image for all branches and PRs (test only, no push)
build-test:
name: Build Docker Image (Test)
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' || github.ref == 'refs/heads/develop'
if: github.event_name == 'pull_request' || (github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/'))
needs: [test, lint]
env:
TEST_CONTAINER_NAME: kernagent-test-${{ github.run_id }}
Expand All @@ -86,30 +107,34 @@ jobs:
with:
context: .
push: false
platforms: linux/amd64
platforms: ${{ (github.event_name == 'workflow_dispatch' && inputs.test_multiplatform) && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
tags: kernagent:test
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
load: ${{ !(github.event_name == 'workflow_dispatch' && inputs.test_multiplatform) }} # Can't load multi-platform images

- name: Create container for pytest run
if: ${{ !(github.event_name == 'workflow_dispatch' && inputs.test_multiplatform) }}
run: |
docker create --name "$TEST_CONTAINER_NAME" \
--entrypoint "" \
kernagent:test \
python -m pytest /workspace/project/tests -v

- name: Copy tests into container
if: ${{ !(github.event_name == 'workflow_dispatch' && inputs.test_multiplatform) }}
run: docker cp tests "$TEST_CONTAINER_NAME":/workspace/project/

- name: Run pytest inside Docker image
if: ${{ !(github.event_name == 'workflow_dispatch' && inputs.test_multiplatform) }}
run: docker start -a "$TEST_CONTAINER_NAME"

- name: Remove test container
if: always()
if: always() && !(github.event_name == 'workflow_dispatch' && inputs.test_multiplatform)
run: docker rm -f "$TEST_CONTAINER_NAME"

- name: Test CLI help command
if: ${{ !(github.event_name == 'workflow_dispatch' && inputs.test_multiplatform) }}
run: |
docker run --rm kernagent:test --help

Expand All @@ -119,6 +144,9 @@ jobs:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: [test, lint]
permissions:
contents: write # Needed to create GitHub Release
packages: write # Needed to push to GHCR

steps:
- name: Checkout code
Expand Down Expand Up @@ -159,48 +187,9 @@ jobs:
cache-to: type=gha,mode=max
provenance: false

- name: Generate release notes
id: release_notes
run: |
# Extract version from tag
VERSION=${GITHUB_REF#refs/tags/}
echo "version=$VERSION" >> $GITHUB_OUTPUT

# Generate release notes from commits since last tag
PREV_TAG=$(git describe --abbrev=0 --tags ${GITHUB_REF}^ 2>/dev/null || echo "")
if [ -n "$PREV_TAG" ]; then
echo "## Changes since $PREV_TAG" > release_notes.md
git log $PREV_TAG..HEAD --pretty=format:"- %s (%h)" >> release_notes.md
else
echo "## Initial Release" > release_notes.md
echo "First release of kernagent" >> release_notes.md
fi

# Add installation instructions
cat >> release_notes.md << 'EOF'

## Installation

**Quick install (Linux/macOS/WSL2):**
```bash
bash <(curl -fsSL https://raw.githubusercontent.com/Karib0u/kernagent/$VERSION/install.sh)
```

**Docker:**
```bash
docker pull ghcr.io/karib0u/kernagent:$VERSION
```

**See the [README](https://github.com/Karib0u/kernagent#readme) for full documentation.**
EOF

# Replace $VERSION placeholder
sed -i "s/\$VERSION/$VERSION/g" release_notes.md

- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
body_path: release_notes.md
draft: false
prerelease: false
generate_release_notes: true
Expand All @@ -213,6 +202,9 @@ jobs:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
needs: [test, lint]
permissions:
contents: read
packages: write # Needed to push to GHCR

steps:
- name: Checkout code
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ samples/

# MacOS

.DS_Store
.DS_Store

# Demo
demo/
37 changes: 37 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.1.0] - 2025-12-06

### Added
- Context handling system for improved binary analysis workflow
- Conversation history management in agent
- New snapshot fixtures for testing
- Enhanced CLI output handling and user experience
- Comprehensive test coverage for conversation history management

### Changed
- **BREAKING:** Adopted opinionated 4-command CLI architecture (init, snapshot, analyze, chat)
- Major refactor: modular installation system with improved scripts
- Updated Dockerfile for better functionality
- Enhanced message handling in ReverseEngineeringAgent
- Improved CLI banner presentation

### Fixed
- CI release notes now fetch full git history to detect previous tags
- ASCII art logo rendering in CLI banner

### Documentation
- Complete documentation overhaul
- Added license compliance (NOTICE file)
- Updated README with new CLI architecture

### Removed
- Deprecated prompts from prompts.py

[1.1.0]: https://github.com/Karib0u/kernagent/compare/v1.0.3...v1.1.0
[1.0.2]: https://github.com/Karib0u/kernagent/releases/tag/v1.0.2
25 changes: 8 additions & 17 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ RUN find "${GHIDRA_INSTALL_DIR}/Ghidra/Features/Decompiler/os" -type f -name "de

# Python configuration
ENV PYTHONUNBUFFERED=1
# Force color output in Docker (rich library)
ENV FORCE_COLOR=1
# Set safe default terminal width to prevent wrapping
ENV COLUMNS=100

# Copy application sources and install dependencies with uv
WORKDIR /workspace/project
Expand All @@ -110,22 +114,8 @@ WORKDIR /workspace/project
COPY pyproject.toml uv.lock /workspace/project/
COPY README.md /workspace/project/README.md

# Create the kernagent package directory and copy Python sources
RUN mkdir -p /workspace/project/kernagent
COPY kernagent/__init__.py \
kernagent/__main__.py \
kernagent/agent.py \
kernagent/capa_runner.py \
kernagent/cli.py \
kernagent/config.py \
kernagent/llm_client.py \
kernagent/log.py \
kernagent/prompts.py \
/workspace/project/kernagent/

# Copy subdirectories
COPY kernagent/oneshot /workspace/project/kernagent/oneshot
COPY kernagent/snapshot /workspace/project/kernagent/snapshot
# Copy the entire kernagent package so new modules are automatically included
COPY kernagent /workspace/project/kernagent

# Pin Python version to 3.12 (python-flirt doesn't have wheels for 3.14 yet)
ENV UV_PYTHON=3.12
Expand All @@ -142,5 +132,6 @@ ENV PATH="${VIRTUAL_ENV}/bin:${PATH}"
VOLUME /data

# Run the CLI directly from the virtual environment
ENTRYPOINT ["python", "-m", "kernagent.cli"]
# -u flag forces unbuffered stdout/stderr for reliable streaming in Docker
ENTRYPOINT ["python", "-u", "-m", "kernagent"]
CMD ["--help"]
Loading
Loading