code-compress.mdโข2.54 kB
# ์ฝ๋ ์์ถ
์ฝ๋ ์์ถ์ ๊ตฌํ ์ธ๋ถ ์ฌํญ์ ์ ๊ฑฐํ๋ฉด์ ํ์์ ์ธ ์ฝ๋ ๊ตฌ์กฐ๋ฅผ ์ง๋ฅ์ ์ผ๋ก ์ถ์ถํ๋ ๊ฐ๋ ฅํ ๊ธฐ๋ฅ์
๋๋ค. ์ด๋ ์ฝ๋๋ฒ ์ด์ค์ ์ค์ํ ๊ตฌ์กฐ์ ์ ๋ณด๋ฅผ ์ ์งํ๋ฉด์ ํ ํฐ ์๋ฅผ ์ค์ผ ๋ ํนํ ์ ์ฉํฉ๋๋ค.
> [!NOTE]
> ์ด๊ฒ์ ์คํ์ ์ธ ๊ธฐ๋ฅ์ผ๋ก, ์ฌ์ฉ์ ํผ๋๋ฐฑ๊ณผ ์ค์ ์ฌ์ฉ ์ฌ๋ก๋ฅผ ๋ฐํ์ผ๋ก ์ง์์ ์ผ๋ก ๊ฐ์ ๋ ์์ ์
๋๋ค.
## ๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ
`--compress` ํ๋๊ทธ๋ฅผ ์ฌ์ฉํ์ฌ ์ฝ๋ ์์ถ์ ํ์ฑํํฉ๋๋ค:
```bash
repomix --compress
```
์๊ฒฉ ์ ์ฅ์์์๋ ์ฌ์ฉํ ์ ์์ต๋๋ค:
```bash
repomix --remote user/repo --compress
```
## ์๋ ๋ฐฉ์
์์ถ ์๊ณ ๋ฆฌ์ฆ์ Tree-sitter ํ์ฑ์ ์ฌ์ฉํ์ฌ ์ฝ๋๋ฅผ ์ฒ๋ฆฌํ๊ณ , ๊ตฌํ ์ธ๋ถ ์ฌํญ์ ์ ๊ฑฐํ๋ฉด์ ํ์์ ์ธ ๊ตฌ์กฐ์ ์์๋ฅผ ์ถ์ถํ๊ณ ๋ณด์กดํฉ๋๋ค.
์์ถ ์ ์ ์ง๋๋ ์์:
- ํจ์์ ๋ฉ์๋ ์๊ทธ๋์ฒ
- ์ธํฐํ์ด์ค์ ํ์
์ ์
- ํด๋์ค ๊ตฌ์กฐ์ ์์ฑ
- ์ค์ํ ๊ตฌ์กฐ์ ์์
์ ๊ฑฐ๋๋ ์์:
- ํจ์์ ๋ฉ์๋ ๊ตฌํ
- ๋ฐ๋ณต๋ฌธ๊ณผ ์กฐ๊ฑด๋ฌธ ๋ก์ง ์ธ๋ถ ์ฌํญ
- ๋ด๋ถ ๋ณ์ ์ ์ธ
- ๊ตฌํ ๊ด๋ จ ์ฝ๋
### ์์
์๋ณธ TypeScript ์ฝ๋:
```typescript
import { ShoppingItem } from './shopping-item';
/**
* Calculate the total price of shopping items
*/
const calculateTotal = (
items: ShoppingItem[]
) => {
let total = 0;
for (const item of items) {
total += item.price * item.quantity;
}
return total;
}
// Shopping item interface
interface Item {
name: string;
price: number;
quantity: number;
}
```
์์ถ ํ:
```typescript
import { ShoppingItem } from './shopping-item';
โฎ----
/**
* Calculate the total price of shopping items
*/
const calculateTotal = (
items: ShoppingItem[]
) => {
โฎ----
// Shopping item interface
interface Item {
name: string;
price: number;
quantity: number;
}
```
## ์ค์
์ค์ ํ์ผ์์ ์์ถ์ ํ์ฑํํ ์ ์์ต๋๋ค:
```json
{
"output": {
"compress": true
}
}
```
## ์ฌ์ฉ ์ฌ๋ก
์ฝ๋ ์์ถ์ ๋ค์๊ณผ ๊ฐ์ ๊ฒฝ์ฐ์ ํนํ ์ ์ฉํฉ๋๋ค:
- ์ฝ๋ ๊ตฌ์กฐ์ ์ํคํ
์ฒ ๋ถ์
- LLM ์ฒ๋ฆฌ๋ฅผ ์ํ ํ ํฐ ์ ๊ฐ์
- ๊ณ ์์ค ๋ฌธ์ ์์ฑ
- ์ฝ๋ ํจํด๊ณผ ์๊ทธ๋์ฒ ์ดํด
- API์ ์ธํฐํ์ด์ค ์ค๊ณ ๊ณต์
## ๊ด๋ จ ์ต์
์์ถ์ ๋ค์ ์ต์
๋ค๊ณผ ํจ๊ป ์ฌ์ฉํ ์ ์์ต๋๋ค:
- `--remove-comments`: ์ฝ๋ ์ฃผ์ ์ ๊ฑฐ
- `--remove-empty-lines`: ๋น ์ค ์ ๊ฑฐ
- `--output-show-line-numbers`: ์ถ๋ ฅ์ ์ค ๋ฒํธ ์ถ๊ฐ