Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
118 changes: 118 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Release

on:
push:
tags:
- "v*.*.*"

permissions:
contents: write # needed to create GitHub Releases
id-token: write # needed for PyPI trusted publishing (OIDC)

jobs:
# ──────────────────────────────────────────────────────────────────────────
# 1. Run the full test suite before releasing
# ──────────────────────────────────────────────────────────────────────────
test:
name: Test (Python ${{ matrix.python-version }}, ${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt

- name: Install package (editable)
run: pip install -e .

- name: Run tests
run: pytest

# ──────────────────────────────────────────────────────────────────────────
# 2. Build the source distribution and wheel
# ──────────────────────────────────────────────────────────────────────────
build:
name: Build distribution
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install build tool
run: pip install --upgrade build

- name: Build sdist and wheel
run: python -m build

- name: Upload distribution artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 7

# ──────────────────────────────────────────────────────────────────────────
# 3. Publish to PyPI via OIDC trusted publishing (no API token required)
# Set up the trusted publisher on PyPI first:
# https://docs.pypi.org/trusted-publishers/adding-a-publisher/
# ──────────────────────────────────────────────────────────────────────────
publish-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/logpilot
steps:
- name: Download distribution artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

# ──────────────────────────────────────────────────────────────────────────
# 4. Create a GitHub Release with auto-generated release notes
# ──────────────────────────────────────────────────────────────────────────
github-release:
name: Create GitHub Release
needs: publish-pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # full history for release notes

- name: Download distribution artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref_name, '-') }} # e.g. v1.0.0-rc1
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# 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.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0] - 2026-02-26

### Added

- Initial release of `logpilot`
- `analyze` command to analyze log files and directories using the GitHub Copilot SDK
- Support for plain-text and JSON log formats with `--format auto|json|text`
- Auto-detection of log format when `--format auto` (default)
- Accurate token counting via [tiktoken](https://github.com/openai/tiktoken) (cl100k_base / GPT-4 compatible)
- Character-based token count fallback when tiktoken is unavailable
- Automatic chunking of large logs to stay within the model context window (`--max-tokens`)
- Directory mode: analyze all log files in a directory (with optional `--recursive`)
- Glob filters for directory mode (`--include`, `--exclude`)
- Output to stdout or a file (`--out-file`)
- Output format selection: human-readable text or JSON (`--output text|json`)
- Model selection via `--model` (default: `gpt-4`)
- `--version` flag to display the installed version
- Cross-platform support: Windows, macOS, Linux
- Python 3.9–3.13 compatibility

[Unreleased]: https://github.com/colinmakerofthings/logpilot-cli/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/colinmakerofthings/logpilot-cli/releases/tag/v0.1.0
50 changes: 36 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# logpilot 🪵

<!-- badges: start -->
![Python Version](https://img.shields.io/badge/python-3.9%2B-blue)
[![PyPI version](https://img.shields.io/pypi/v/logpilot.svg)](https://pypi.org/project/logpilot/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/logpilot.svg)](https://pypi.org/project/logpilot/)
[![Release](https://github.com/colinmakerofthings/logpilot-cli/actions/workflows/release.yml/badge.svg)](https://github.com/colinmakerofthings/logpilot-cli/actions/workflows/release.yml)
[![Tests](https://github.com/colinmakerofthings/logpilot-cli/actions/workflows/test.yml/badge.svg)](https://github.com/colinmakerofthings/logpilot-cli/actions/workflows/test.yml)
![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)
![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)
![Linter: ruff](https://img.shields.io/badge/linter-ruff-d7ff64.svg)
![Security: ruff](https://img.shields.io/badge/security-ruff%20S-orange)
<!-- badges: end -->

A Python CLI tool for analyzing logs using the GitHub Copilot SDK.
Expand All @@ -18,10 +20,10 @@ A Python CLI tool for analyzing logs using the GitHub Copilot SDK.
- Large logs chunked automatically to stay within the model's context window
- Uses Copilot SDK for LLM-powered analysis

## Usage (MVP)
## Usage

```sh
python -m logpilot.cli [--version] analyze <path> [OPTIONS]
logpilot [--version] analyze <path> [OPTIONS]
```

### Global Options
Expand All @@ -48,31 +50,31 @@ python -m logpilot.cli [--version] analyze <path> [OPTIONS]
Summarize a log file and print to terminal:

```sh
python -m logpilot.cli analyze mylog.txt
logpilot analyze mylog.txt
```

Summarize all logs in a directory (combined analysis):

```sh
python -m logpilot.cli analyze ./logs
logpilot analyze ./logs
```

Summarize logs in a directory recursively with filters:

```sh
python -m logpilot.cli analyze ./logs --recursive --include "*.log" --exclude "archive/*"
logpilot analyze ./logs --recursive --include "*.log" --exclude "archive/*"
```

Summarize a log file and write to a file:

```sh
python -m logpilot.cli analyze mylog.txt --out-file summary.txt
logpilot analyze mylog.txt --out-file summary.txt
```

Analyze logs with a different model:

```sh
python -m logpilot.cli analyze mylog.txt --model gpt-3.5-turbo
logpilot analyze mylog.txt --model gpt-3.5-turbo
```

## Project Structure
Expand All @@ -95,12 +97,32 @@ python -m logpilot.cli analyze mylog.txt --model gpt-3.5-turbo

logpilot works on Windows, macOS, and Linux platforms where Python 3.9+ is available.

## Setup
## Installation

1. Clone the repo
2. Install dependencies: `pip install -r requirements.txt`
3. (Recommended) Install dev dependencies: `pip install -r requirements-dev.txt`
4. Authenticate with Copilot SDK as per GitHub's instructions
### From PyPI (recommended)

```sh
pip install logpilot
```

> **Note:** `logpilot` requires the [GitHub Copilot SDK](https://github.com/github/copilot-sdk), which is not yet available on PyPI.
> Install it separately before running `logpilot`:
>
> ```sh
> pip install "git+https://github.com/github/copilot-sdk.git#subdirectory=python"
> ```

Then authenticate with the Copilot SDK as per [GitHub's instructions](https://github.com/github/copilot-sdk).

### From source (development)

```sh
git clone https://github.com/your-github-username/logpilot-cli.git
cd logpilot-cli
pip install -e .
# Optional: install dev/test dependencies
pip install -r requirements-dev.txt
```

## License

Expand Down
Loading
Loading