Skip to content
Merged
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
45 changes: 45 additions & 0 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Code checks

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
lint-and-test:
runs-on: ubuntu-latest

steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v4

# Set up Python 3.13 (matches .python-version)
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'

# Install uv for dependency management
- name: Install uv
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.cargo/bin" >> $GITHUB_PATH

# Install project dependencies with uv
- name: Install dependencies
run: |
uv sync --frozen

# Run linting (using Makefile's lint target)
- name: Lint code
run: |
make lint

# Run tests (using Makefile's test target)
- name: Run tests
run: |
make test
21 changes: 15 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
.PHONY: format lint bump
.PHONY: format lint bump test

CODE_DIRS := src/ tests/

# Format code with ruff
format:
ruff format src/ # Apply formatting
ruff format src/ --check # Check formatting first
uv run ruff format $(CODE_DIRS) # Apply formatting
uv run ruff format $(CODE_DIRS) --check # Check formatting first

# Lint code with ruff
lint:
ruff check src/ --fix # Check and auto-fix where possible
ruff check src/ # Final check after fixes
uv run ruff check $(CODE_DIRS) --fix # Check and auto-fix where possible
uv run ruff check $(CODE_DIRS) # Final check after fixes

# Bump version (patch, minor, major)
bump:
@python bump_version.py $(TYPE)
uv run python bump_version.py $(TYPE)

# Default to patch if no TYPE is specified
TYPE ?= patch
Expand All @@ -26,3 +28,10 @@ bump-minor: bump

bump-major: TYPE = major
bump-major: bump

# Run tests with pytest
test:
uv run pytest tests/ -v

# Combined check for CI
check: format lint test
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# ctxify 🎉
**Turn Your Git Repo into a Clipboard-Ready Context Machine**

*Built mostly with the help of xAI's Grok model—AI-powered coding at its finest!*

![GitHub release (latest by date)](https://img.shields.io/github/v/release/MQ37/ctxify?color=brightgreen)
![Code Checks](https://github.com/mq37/ctxify/actions/workflows/code_checks.yml/badge.svg)
![License](https://img.shields.io/badge/license-MIT-green.svg)

**`ctxify`** is a sleek CLI tool that grabs all tracked files in your Git repository, builds a neat tree structure, and copies everything—code and all—to your clipboard with a single command. Perfect for sharing project context, debugging, or feeding your code straight into AI assistants. It even gives you an approximate token count for fun! 🚀
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "ctxify"
version = "0.1.4"
version = "0.1.5"
description = "A tool to print git repository files with tree structure"
readme = "README.md"
requires-python = ">=3.8"
Expand Down Expand Up @@ -30,5 +30,7 @@ quote-style = "single"

[dependency-groups]
dev = [
"pytest>=8.3.4",
"pytest-mock>=3.14.0",
"ruff>=0.9.7",
]
2 changes: 1 addition & 1 deletion src/ctxify/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.4'
__version__ = '0.1.5'
23 changes: 18 additions & 5 deletions src/ctxify/cli.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import click

from ctxify.main import copy_to_clipboard, print_git_contents, interactive_file_selection
from ctxify.main import (
copy_to_clipboard,
interactive_file_selection,
print_git_contents,
)


@click.command()
Expand All @@ -9,17 +13,26 @@
'--md', '-md', is_flag=True, help='Include README and other .md files in output'
)
@click.option(
'-i', '--interactive', is_flag=True, help='Interactively select files to include with tab autocompletion'
'-i',
'--interactive',
is_flag=True,
help='Interactively select files to include with tab autocompletion',
)
@click.option(
'-s', '--structure', is_flag=True, help='Output only the project structure without file contents'
'-s',
'--structure',
is_flag=True,
help='Output only the project structure without file contents',
)
def main(directory, md, interactive, structure):
def main(directory: str, md: bool, interactive: bool, structure: bool) -> None:
"""A tool to print all tracked files in a git repository directory with tree structure and copy to clipboard."""
output: str
if interactive:
output = interactive_file_selection(directory, include_md=md)
else:
output = print_git_contents(root_dir=directory, include_md=md, structure_only=structure)
output = print_git_contents(
root_dir=directory, include_md=md, structure_only=structure
)
if copy_to_clipboard(output):
click.echo('Project context copied to clipboard!')

Expand Down
Loading