https://github.com/cqfn/refrax

Command-Line Agentic Refactoring of Java Code

https://github.com/cqfn/refrax

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.8%) to scientific vocabulary

Keywords

a2a a2a-protocol agentic-ai code-quality deepseek go optimization refactoring

Keywords from Contributors

eolang object-oriented object-oriented-language object-oriented-programming programming-language
Last synced: 5 months ago · JSON representation

Repository

Command-Line Agentic Refactoring of Java Code

Basic Info
Statistics
  • Stars: 3
  • Watchers: 0
  • Forks: 3
  • Open Issues: 17
  • Releases: 5
Topics
a2a a2a-protocol agentic-ai code-quality deepseek go optimization refactoring
Created 8 months ago · Last pushed 6 months ago
Metadata Files
Readme License

README.md

Refrax

codecov

⚠️ Early prototype — subject to rapid change.

Refrax is an AI-powered refactoring agent for Java code, implemented in Go.

We often need our source code to be polished by AI agents (like Claude Code), for example typos to be fixed, small refactorings applied, and JavaDoc blocks improved. But we struggle to formulate the prompt correctly. A simple "make my code better" may not work for two reasons: the agent quickly gets lost when it deals with hundreds of files, and the agent requires regular interaction with the user. Refrax solves both of these issues by breaking down a large demand to polish the code into a series of smaller requests to a number of agents with their specific roles: a critic, a reviewer, an editor, and so on. You just start Refrax and in a few minutes (or hours) it makes your code better, running fully autonomously.

Refrax integrates a number of LLMs communicating via the A2A protocol.

Installation

Releases

Download the latest stable version from the releases page. Pre-built binaries are available for macOS, Windows, and Linux.

Using Go

If you have Go 1.24.1 or later installed, you can run:

bash go install github.com/cqfn/refrax@latest

To install a specific version, use:

bash go install github.com/cqfn/refrax@v0.0.1

From Source

Ensure that Go 1.24.1 or later is installed on your system.

  1. Clone the repository:

bash git clone https://github.com/cqfn/refrax.git cd refrax

  1. Build the binary:

bash go build -o refrax

  1. (Optional) Install the binary to your $GOPATH/bin:

bash go install

Usage

asciicast

  • refrax refactor [path]: Refactor Java code in the specified directory (defaults to current directory).
  • refrax start [agent]: Start the server for agents like fixer, critic, or facilitator.

Example

You can try refactoring the testing project located in this repository. To do so, you will need to clone the repository:

git clone https://github.com/cqfn/refrax.git

Then, run the following command:

sh refrax refactor --output="./out" --ai=deepseek refrax/test/test_data/java/person

Or, if you are already in the refrax folder, simply run:

refrax refactor --output="./out" --ai=deepseek test/test_data/java/person

Checking Results

refrax does not inherently verify whether the applied changes are correct or cause any issues. To address this, you can use the --check option to validate the changes. Multiple --check options can be provided, as shown below:

sh refrax refactor . --ai=deepseek --check="mvn clean test" --check="mvn qulice:check -Pqulice"

When at least one --check option is specified, the reviewer agent executes the provided checks and delivers feedback to the facilitator agent.

Configuration

  • --ai, -a: Specify the AI provider (e.g., deepseek, openai).
  • --token, -t: Token for the AI provider.
  • --debug, -d: Enable debug logging.

Authentication

Some operations in Refrax require AI authentication using an API token. You can provide the token using one of the following methods:

Command-Line Flag

sh refrax refactor . --token your-token-here

AI Providers

Supported AI providers are: * deepseek * openai

Environment Variable

✅ The DEEPSEEK_TOKEN variable is the recommended option for deepseek AI provider ✅ The OPENAI_TOKEN variable is the recommended option for openai AI provider ⚠️ The TOKEN variable is still supported for any AI provider but deprecated.

Set the environment variable:

sh export DEEPSEEK_TOKEN=your-token-here refrax start facilitator

.env File

If a .env file is present in the working directory, Refrax will attempt to read the token from it:

```

.env

DEEPSEEK_TOKEN=your-token-here ```

Priority Order

If multiple sources are provided, the following priority order is applied (highest priority first):

  1. --token command-line flag
  2. DEEPSEEK_TOKEN environment variable
  3. TOKEN environment variable (deprecated)
  4. .env file (DEEPSEEK_TOKEN > TOKEN)

Statistics

To gather interaction statistics, you can use the following command:

sh refrax refactor . --ai=deepseek --stats --stats-format=csv --stats-output=stats.csv

This command generates a stats.csv file containing the interaction statistics. The --stats-output and --stats-format parameters are optional. If you omit them, refrax will output the statistics directly to the console.

License

Licensed under the MIT License.

Owner

  • Name: CQFN
  • Login: cqfn
  • Kind: organization
  • Email: team@cqfn.org

Code Quality Foundation

GitHub Events

Total
  • Create event: 4
  • Commit comment event: 10
  • Release event: 3
  • Issues event: 59
  • Delete event: 1
  • Issue comment event: 52
  • Member event: 1
  • Push event: 37
  • Pull request review event: 18
  • Pull request review comment event: 24
  • Pull request event: 56
  • Fork event: 2
Last Year
  • Create event: 4
  • Commit comment event: 10
  • Release event: 3
  • Issues event: 59
  • Delete event: 1
  • Issue comment event: 52
  • Member event: 1
  • Push event: 37
  • Pull request review event: 18
  • Pull request review comment event: 24
  • Pull request event: 56
  • Fork event: 2

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 47
  • Total Committers: 3
  • Avg Commits per committer: 15.667
  • Development Distribution Score (DDS): 0.085
Past Year
  • Commits: 47
  • Committers: 3
  • Avg Commits per committer: 15.667
  • Development Distribution Score (DDS): 0.085
Top Committers
Name Email Commits
Volodya Lombrozo v****o@g****m 43
Aliaksei Bialiauski h****x@g****m 3
Max Trunnikov m****v@g****m 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 38
  • Total pull requests: 37
  • Average time to close issues: 4 days
  • Average time to close pull requests: about 6 hours
  • Total issue authors: 3
  • Total pull request authors: 3
  • Average comments per issue: 0.89
  • Average comments per pull request: 0.38
  • Merged pull requests: 23
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 38
  • Pull requests: 37
  • Average time to close issues: 4 days
  • Average time to close pull requests: about 6 hours
  • Issue authors: 3
  • Pull request authors: 3
  • Average comments per issue: 0.89
  • Average comments per pull request: 0.38
  • Merged pull requests: 23
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • volodya-lombrozo (26)
  • 0pdd (11)
  • yegor256 (1)
Pull Request Authors
  • volodya-lombrozo (33)
  • h1alexbel (2)
Top Labels
Issue Labels
enhancement (24) bug (14) pdd (11) help wanted (6) documentation (4) good first issue (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 5
proxy.golang.org: github.com/cqfn/refrax

Refrax entry point.

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Dependent packages count: 5.3%
Average: 5.5%
Dependent repos count: 5.7%
Last synced: 6 months ago

Dependencies

.github/workflows/codecov.yml actions
  • actions/checkout v4 composite
  • actions/setup-go v5 composite
  • codecov/codecov-action v5 composite
.github/workflows/go-coverage-limit.yml actions
  • actions/checkout v4 composite
  • actions/setup-go v5 composite
.github/workflows/golangci-lint.yml actions
  • actions/checkout v4 composite
  • actions/setup-go v5 composite
  • golangci/golangci-lint-action v8 composite
.github/workflows/release.yml actions
  • actions/checkout v4 composite
  • actions/setup-go v5 composite
  • goreleaser/goreleaser-action v6 composite
.github/workflows/tests.yml actions
  • actions/checkout v4 composite
  • actions/setup-go v5 composite
go.mod go
  • github.com/davecgh/go-spew v1.1.1
  • github.com/inconshreveable/mousetrap v1.1.0
  • github.com/mattn/go-colorable v0.1.13
  • github.com/mattn/go-isatty v0.0.19
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/rs/zerolog v1.34.0
  • github.com/spf13/cobra v1.9.1
  • github.com/spf13/pflag v1.0.6
  • github.com/stretchr/testify v1.10.0
  • golang.org/x/sys v0.12.0
  • gopkg.in/yaml.v3 v3.0.1
go.sum go
  • github.com/coreos/go-systemd/v22 v22.5.0
  • github.com/cpuguy83/go-md2man/v2 v2.0.6
  • github.com/davecgh/go-spew v1.1.1
  • github.com/godbus/dbus/v5 v5.0.4
  • github.com/inconshreveable/mousetrap v1.1.0
  • github.com/mattn/go-colorable v0.1.13
  • github.com/mattn/go-isatty v0.0.16
  • github.com/mattn/go-isatty v0.0.19
  • github.com/pkg/errors v0.9.1
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/rs/xid v1.6.0
  • github.com/rs/zerolog v1.34.0
  • github.com/russross/blackfriday/v2 v2.1.0
  • github.com/spf13/cobra v1.9.1
  • github.com/spf13/pflag v1.0.6
  • github.com/stretchr/testify v1.10.0
  • golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab
  • golang.org/x/sys v0.6.0
  • golang.org/x/sys v0.12.0
  • gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
  • gopkg.in/yaml.v3 v3.0.1
.github/workflows/pdd.yml actions
  • actions/checkout v4 composite
  • volodya-lombrozo/pdd-action master composite
.github/workflows/publish-release.yml actions
  • actions/checkout v4 composite
  • actions/setup-go v5 composite
  • goreleaser/goreleaser-action v6 composite