|
2 | 2 |
|
3 | 3 | > Summarize your changes into a concise title and a detailed description. |
4 | 4 |
|
5 | | -In this project, we provide a simple command called `sum-diff`. This command automatically generates a concise and clear title and a detailed description from the current branch's differences in a git repository. |
| 5 | +`sum-diff` is a simple command-line tool that automatically generates a concise title and a detailed description by analyzing the current git branch, including: |
6 | 6 |
|
7 | | -## Install |
| 7 | +- Branch name |
| 8 | +- Code changes (`git diff`) |
| 9 | + |
| 10 | +## Installation |
| 11 | + |
| 12 | +Install using `pipx`: |
8 | 13 |
|
9 | 14 | ```bash |
| 15 | +# Download and unzip |
10 | 16 | $ unzip sum-diff.zip |
11 | | -$ pipx ./sum-diff |
| 17 | +$ pipx install ./sum-diff |
| 18 | + |
| 19 | +# Install nightly from GitHub |
| 20 | +$ pipx install git+https://github.com/ishikawa/sum-diff |
12 | 21 | ``` |
13 | 22 |
|
14 | | -## How to use |
| 23 | +## API Key |
| 24 | + |
| 25 | +`sum-diff` uses Anthropic's Claude 3.5 Sonnet to generate the output. Obtain an API key from [Anthropic's console](https://console.anthropic.com/) and set it as an environment variable: |
| 26 | + |
| 27 | +```bash |
| 28 | +$ export ANTHROPIC_API_KEY=sk-ant-... |
| 29 | +``` |
| 30 | + |
| 31 | +## Usage |
| 32 | + |
| 33 | +After making changes to your project and before creating a PR, run the `sum-diff` command to have the AI generate a title and description for your PR. |
15 | 34 |
|
16 | 35 | ```bash |
17 | 36 | $ sum-diff |
18 | 37 | ``` |
| 38 | + |
| 39 | +The command will take a few seconds to process and then output the title and description. For example: |
| 40 | + |
| 41 | +```` |
| 42 | +Add `while` statement support to compiler |
| 43 | +
|
| 44 | +This PR introduces support for `while` loops in the compiler, enhancing the language's control flow capabilities. |
| 45 | +
|
| 46 | +Key changes: |
| 47 | +- Add `While` token and parsing logic in `tokenizer.rs` |
| 48 | +- Implement `WhileStmt` struct and parsing in `parser.rs` |
| 49 | +- Add code generation for `while` loops in `asm.rs` |
| 50 | +- Update `LocalVarAllocator` to handle `while` statements in `allocator.rs` |
| 51 | +- Add test cases for `while` loops in `test.sh` |
| 52 | +
|
| 53 | +The implementation follows the existing pattern for control flow statements, such as `if` statements. The `while` loop consists of a condition and a body, which are evaluated and executed accordingly. |
| 54 | +
|
| 55 | +Example of the new `while` loop syntax: |
| 56 | +
|
| 57 | +```rust |
| 58 | +i = 0; |
| 59 | +while (i < 20) |
| 60 | + i = i + 1; |
| 61 | +return i; |
| 62 | +``` |
| 63 | +
|
| 64 | +This PR completes the basic control flow structures for the compiler, allowing for more complex program logic to be expressed in the language. |
| 65 | +```` |
0 commit comments