|
5 | 5 | <h1 align="center">Reforge</h1> |
6 | 6 |
|
7 | 7 | <p align="center"> |
8 | | - Evidence-backed structural analysis for codebases changing faster than they can be reviewed. |
| 8 | + Find structural drift before it becomes the next refactor. |
9 | 9 | </p> |
10 | 10 |
|
11 | 11 | <p align="center"> |
|
15 | 15 | <a href="https://lylemi.github.io/Reforge/"><img alt="Documentation" src="https://img.shields.io/badge/docs-read-1556ad"></a> |
16 | 16 | </p> |
17 | 17 |
|
18 | | -Reforge is a local CLI that shows maintainers where a codebase is becoming |
19 | | -harder to change. It finds duplicated implementations, oversized |
20 | | -responsibilities, dependency tangles, and architecture drift across the whole |
21 | | -repository—including patterns introduced gradually by coding agents. |
| 18 | +Reforge is a local CLI for repository-level code review. It finds duplicated |
| 19 | +implementations, oversized responsibilities, dependency tangles, and |
| 20 | +architecture drift—including patterns introduced gradually by coding agents. |
22 | 21 |
|
23 | | -It does not assign an opaque health score or ask you to trust a generated |
24 | | -summary. Every finding includes the source locations, measurements, and rule |
25 | | -that produced it. Every report also records what Reforge could and could not |
26 | | -analyze. |
| 22 | +Every finding identifies its rule and relevant source locations, with |
| 23 | +measurements or a value-flow witness when the rule produces them. Coverage |
| 24 | +records what Reforge could and could not analyze. Reforge does not upload source |
| 25 | +code, assign a health score, or claim that a finding is a bug. |
27 | 26 |
|
28 | 27 | <p align="center"> |
29 | | - <a href="https://lylemi.github.io/Reforge/playground/"><strong>See the agent-code Playground →</strong></a> |
| 28 | + <a href="https://lylemi.github.io/Reforge/playground/"><strong>Try the agent-code Playground →</strong></a> |
30 | 29 | · |
31 | | - <a href="https://lylemi.github.io/Reforge/sample/"><strong>Explore Reforge's self-analysis report →</strong></a> |
| 30 | + <a href="https://lylemi.github.io/Reforge/sample/"><strong>Open an example report →</strong></a> |
32 | 31 | </p> |
33 | 32 |
|
34 | | -## See the evidence behind a finding |
35 | | - |
36 | | -This finding came from Reforge analyzing its own report application: |
37 | | - |
38 | | -```text |
39 | | -Function readability: ReportView in web/report-app/src/reportApp.tsx |
40 | | -
|
41 | | - Rule: reforge.codebase.complex_function |
42 | | - Location: web/report-app/src/reportApp.tsx:33 |
43 | | - Measurement: estimated complexity 15 (threshold 14) |
44 | | - Guidance: Reduce the function to a clear sequence of named responsibilities. |
45 | | -``` |
46 | | - |
47 | | -The location makes the finding inspectable. The measurement explains why it |
48 | | -was reported. The threshold can be tuned, and a legitimate exception can be |
49 | | -suppressed with its reason preserved. Reforge makes the case for review; it |
50 | | -does not pretend that a measurement can decide the refactor for you. |
51 | | - |
52 | | -## Get started |
| 33 | +## Quick start |
53 | 34 |
|
54 | 35 | Install the latest release on Linux or macOS: |
55 | 36 |
|
56 | 37 | ```sh |
57 | 38 | curl -fsSL https://raw.githubusercontent.com/LyleMi/Reforge/main/scripts/install.sh | sh |
58 | 39 | ``` |
59 | 40 |
|
60 | | -On Windows PowerShell: |
61 | | - |
62 | | -```powershell |
63 | | -$installer = Join-Path $env:TEMP "install-reforge.ps1" |
64 | | -irm https://raw.githubusercontent.com/LyleMi/Reforge/main/scripts/install.ps1 -OutFile $installer |
65 | | -& $installer |
66 | | -``` |
67 | | - |
68 | | -Rust users can alternatively build and install the command from crates.io: |
| 41 | +Or install only the CLI from crates.io: |
69 | 42 |
|
70 | 43 | ```sh |
71 | 44 | cargo install reforge-cli --locked |
72 | 45 | ``` |
73 | 46 |
|
74 | | -The crates.io package installs the `reforge` binary only. Use the verified |
75 | | -release installer above when you also want the bundled `reforge-analyze` Codex |
76 | | -skill. |
77 | | - |
78 | | -Reforge runs Codebase analysis by default. Its rules begin as opt-in previews, |
79 | | -so adopting Reforge does not immediately impose someone else's definition of |
80 | | -maintainability. Initialize a configuration, then enable a small starter set: |
| 47 | +Then analyze a repository: |
81 | 48 |
|
82 | 49 | ```sh |
83 | | -reforge init |
84 | | -``` |
85 | | - |
86 | | -In the generated `reforge.toml`, start with: |
87 | | - |
88 | | -```toml |
89 | | -[rules] |
90 | | -enable = [ |
91 | | - "reforge.codebase.large_file", |
92 | | - "reforge.codebase.long_function", |
93 | | - "reforge.codebase.dependency_cycle", |
94 | | - "reforge.codebase.similar_functions", |
95 | | -] |
| 50 | +reforge analyze . |
96 | 51 | ``` |
97 | 52 |
|
98 | | -Run the review in your repository or generate a standalone HTML report: |
| 53 | +With no configuration, the CLI runs Codebase analysis with four preview |
| 54 | +advisories: large files, long functions, dependency cycles, and similar |
| 55 | +functions. They are review prompts, not CI failures. Create a versioned starter |
| 56 | +configuration to tune or disable them: |
99 | 57 |
|
100 | 58 | ```sh |
101 | | -reforge analyze . |
| 59 | +reforge init |
102 | 60 | reforge analyze . --output html --output-file reforge-report.html |
103 | 61 | ``` |
104 | 62 |
|
105 | | -## Built for repository-level review |
| 63 | +Windows PowerShell and pinned-version installation are covered in the |
| 64 | +[installation guide](https://lylemi.github.io/Reforge/user-guide.html#install). |
106 | 65 |
|
107 | | -| Need | What Reforge provides | |
108 | | -| --- | --- | |
109 | | -| Find change pressure beyond style errors | Project-wide signals for responsibilities, duplication, dependencies, and drift | |
110 | | -| Verify why something was flagged | Source locations, measurements, thresholds, and rule provenance | |
111 | | -| Trust an empty report appropriately | Coverage receipts and explicit analysis limitations | |
112 | | -| Keep an accepted refactor from regressing | Reproducible baselines and CI gates for new or changed findings | |
113 | | -| Keep source code private | Local analysis with no uploads or telemetry | |
114 | | - |
115 | | -Reforge complements compilers, linters, and security scanners. Its job is not |
116 | | -to prove correctness or find vulnerabilities; it identifies structural |
117 | | -pressure that deserves a maintainer's judgment before the next refactor. |
118 | | - |
119 | | -## What Codebase finds |
| 66 | +## What it finds |
120 | 67 |
|
121 | 68 | | Area | Examples | |
122 | 69 | | --- | --- | |
123 | | -| **Responsibilities** | Large files, long or complex functions, deep nesting, broad public surfaces | |
124 | | -| **Duplication** | Similar functions, repeated literals, repeated test setup, overlapping type shapes | |
125 | | -| **Architecture drift** | Dependency cycles, generic buckets, parallel implementations, boundary bypasses | |
126 | | -| **Repository consistency** | Naming drift, stale compatibility paths, TODO/FIXME clusters | |
| 70 | +| Responsibilities | Large files, long or complex functions, deep nesting, broad public surfaces | |
| 71 | +| Duplication | Similar functions, repeated literals, repeated test setup, overlapping type shapes | |
| 72 | +| Architecture drift | Dependency cycles, generic buckets, parallel implementations, boundary bypasses | |
| 73 | +| Repository consistency | Naming drift, stale compatibility paths, TODO/FIXME clusters | |
| 74 | + |
| 75 | +Codebase analysis supports Rust, JavaScript, TypeScript/TSX, Vue, Python, Go, |
| 76 | +Java, C#, Kotlin, PHP, Ruby, Bash, and PowerShell. Dependency rules also |
| 77 | +recognize C and C++. |
127 | 78 |
|
128 | | -Each finding points to a concrete subject and includes the rule, source locations, and measurements that produced it. Coverage shows which languages and capabilities were actually observed. Reforge does not turn these signals into a health score, severity, or defect prediction—the decision stays with the reviewer. |
| 79 | +## What a finding contains |
129 | 80 |
|
130 | | -Codebase supports Rust, JavaScript, TypeScript/TSX, Vue, Python, Go, Java, C#, Kotlin, PHP, Ruby, Bash, and PowerShell. Dependency rules also recognize C and C++. |
| 81 | +```text |
| 82 | +Implementation duplication: 3 related items |
| 83 | +
|
| 84 | + Rule: reforge.codebase.shadowed_abstraction |
| 85 | + Locations: forms/legacy_email_validator.py:1 |
| 86 | + forms/signup_email_validator.py:1 |
| 87 | + shared/email_validator.py:1 |
| 88 | + Measurement: group size 3 (threshold 3) |
| 89 | + Guidance: Consolidate shared behavior or make separate variants explicit. |
| 90 | +``` |
131 | 91 |
|
132 | | -Analysis runs locally. Reforge does not upload source code or collect telemetry. |
| 92 | +The evidence makes a finding inspectable; it does not decide the refactor for |
| 93 | +you. An empty report is meaningful only for the languages, capabilities, and |
| 94 | +rules marked as observed in Coverage. |
133 | 95 |
|
134 | | -## Use it in CI |
| 96 | +## Automate review |
135 | 97 |
|
136 | | -Keep configuration in `reforge.toml`, review a JSON report as a baseline, then gate new or changed policy findings: |
| 98 | +Export JSON or SARIF for CI and code-scanning integrations: |
137 | 99 |
|
138 | 100 | ```sh |
139 | | -reforge analyze . --output json --output-file current.json \ |
140 | | - --baseline reforge-baseline.json --gate new --reproducible |
| 101 | +reforge analyze . --output sarif --output-file reforge.sarif --reproducible |
141 | 102 | ``` |
142 | 103 |
|
143 | | -Rules begin as opt-in previews. This keeps adoption deliberate: enable the signals that fit your codebase, review their evidence, and enforce only the policies your team has accepted. |
| 104 | +All current core rules are preview and advisory-only. The `--gate` options apply |
| 105 | +only to rules that later satisfy Reforge's calibration contract, become stable, |
| 106 | +and are explicitly enforced; preview findings do not fail CI. |
| 107 | + |
| 108 | +## Advanced Dataflow analysis |
| 109 | + |
| 110 | +Dataflow is opt-in and intended for exact value-path and declared-boundary |
| 111 | +inspection: |
| 112 | + |
| 113 | +```sh |
| 114 | +reforge analyze . --analysis dataflow --output json --reproducible |
| 115 | +reforge analyze . --analysis codebase --analysis dataflow --reproducible |
| 116 | +``` |
144 | 117 |
|
145 | | -## Learn more |
| 118 | +See the [Dataflow guide](docs/dataflow.md) for its configuration and coverage |
| 119 | +limits. |
146 | 120 |
|
147 | | -- [Documentation](https://lylemi.github.io/Reforge/) — start here for installation, configuration, and report interpretation |
148 | | -- [Codebase guide](docs/analyses.md) — understand what is analyzed and how to review findings |
149 | | -- [Rule reference](docs/rule-cards.md) — see every available signal and its intended limits |
150 | | -- [Configuration reference](docs/configuration.md) — tune scope, thresholds, policies, and suppressions |
151 | | -- [Contributing](docs/contributing.md) — build and test Reforge locally |
| 121 | +## Documentation |
152 | 122 |
|
153 | | -Reforge also includes an advanced, opt-in [Dataflow analysis](docs/dataflow.md) for exact value-path and boundary-policy inspection. |
| 123 | +- [User guide](https://lylemi.github.io/Reforge/user-guide.html) |
| 124 | +- [Codebase analysis](docs/analyses.md) |
| 125 | +- [Rule reference](docs/rule-cards.md) |
| 126 | +- [Configuration reference](docs/configuration.md) |
| 127 | +- [Contributing](docs/contributing.md) |
154 | 128 |
|
155 | 129 | ## Development |
156 | 130 |
|
157 | | -Reforge is a Rust 2024 workspace. Run the full validation suite with: |
| 131 | +Reforge is a Rust 2024 workspace. Run the complete validation gate with: |
158 | 132 |
|
159 | 133 | ```sh |
160 | | -cargo fmt --all -- --check |
161 | | -cargo clippy --locked --workspace --all-targets --all-features -- -D warnings |
162 | | -cargo test --locked --workspace --all-targets --all-features |
| 134 | +scripts/check-ci.sh |
163 | 135 | ``` |
164 | 136 |
|
165 | | -Run the complete Linux CI gate locally, or install it as a pre-push hook: |
| 137 | +Or run the core checks directly: |
166 | 138 |
|
167 | 139 | ```sh |
168 | | -scripts/check-ci.sh |
169 | | -scripts/install-git-hooks.sh |
| 140 | +cargo fmt --all -- --check |
| 141 | +cargo clippy --locked --workspace --all-targets --all-features -- -D warnings |
| 142 | +cargo test --locked --workspace --all-targets --all-features |
170 | 143 | ``` |
0 commit comments