diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9931ccc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,31 @@ +name: CI + +on: + push: + branches: ["**"] + pull_request: + branches: [main] + +env: + CARGO_TERM_COLOR: always + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: clippy + + - name: Build + run: cargo build --release + + - name: Test + run: cargo test + + - name: Clippy + run: cargo clippy -- -D warnings diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2844879 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,57 @@ +name: Release + +on: + push: + branches: [main] + +permissions: + contents: write + issues: write + pull-requests: write + +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Build + run: cargo build --release + + - name: Test + run: cargo test + + release: + name: Semantic Release + needs: [test] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "lts/*" + + - name: Install semantic-release + run: | + npm install -D \ + semantic-release \ + @semantic-release/exec \ + @semantic-release/git \ + @semantic-release/changelog \ + @semantic-release/github + + - name: Run semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: npx semantic-release diff --git a/.gitignore b/.gitignore index b8b4d97..3dbbf5a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ target/ .env -.claude/settings.local.json \ No newline at end of file +.claude/settings.local.json +node_modules/ +package.json +package-lock.json \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..8027848 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. diff --git a/CLAUDE.md b/CLAUDE.md index 93bbd68..94cff6b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -89,6 +89,49 @@ Controller (key input → Action) → Event Loop → LLM stream → Tool executi - **Auto inline review** after each edit: `src/app/subagent/auto.rs` — `spawn_quick_review()` injects verdict back into LLM conversation. - **Background subagents** (test-gen, arch-review, security-review) fire asynchronously at turn end via `TurnEvent::SystemNote`. +## Commit Convention + +Gunakan **Conventional Commits** untuk semua commit. Format: + +``` +(): +``` + +**Type & efek ke versi:** + +| Type | Bump | Kapan pakai | +|-------------|-------|------------------------------------------| +| `feat` | minor | Fitur baru | +| `fix` | patch | Perbaikan bug | +| `chore` | patch | Maintenance, update deps, dll | +| `docs` | patch | Perubahan dokumentasi/comment | +| `refactor` | patch | Refactor kode tanpa perubahan fungsional | +| `test` | patch | Nambah/ubah test | +| `style` | patch | Formatting, whitespace, lint | +| `perf` | patch | Optimasi performa | +| `ci` | patch | Perubahan CI/CD | + +**Catatan:** +- **Semua type menghasilkan release** (patch minimal). Tidak ada commit yang "skip release". +- Tambahkan `BREAKING CHANGE:` di body commit untuk bump **major**. +- **Scope** opsional, tapi direkomendasikan (misal `feat(agent):`, `fix(ipc):`). + +### Contoh + +``` +feat(tool): add batch file delete + +chore: bump reqwest to 0.12 + +refactor(harness): flatten guard pipeline + +fix(ipc): reconnect loop on socket timeout + +docs: add architecture diagram to README + +BREAKING CHANGE: IPC frame header changed from 4-byte to 8-byte length +``` + ## Code Documentation Every function, struct, enum, trait, module, and significant code block must have a doc comment (`///` or `//!`) that explains: diff --git a/README.md b/README.md index b39d466..c392f50 100644 --- a/README.md +++ b/README.md @@ -316,6 +316,62 @@ cargo build --release ``` +--- + +## Development + +### Commit Convention + +Project ini menggunakan **Conventional Commits** untuk otomatis menentukan versi rilis (melalui semantic-release). + +Format: +``` +(): + +[optional body] + +[optional footer] +``` + +**`` — menentukan bump version:** + +| Type | Bump | Keterangan | +|-------------|---------|-------------------------------------------| +| `feat` | minor | Fitur baru | +| `fix` | patch | Perbaikan bug | +| `chore` | patch | Tugas maintenance, refactor ringan | +| `docs` | patch | Perubahan dokumentasi | +| `refactor` | patch | Refactor kode (tanpa perubahan fungsional)| +| `test` | patch | Penambahan atau perbaikan test | +| `style` | patch | Perubahan formatting, whitespace, dll | +| `perf` | patch | Optimasi performa | +| `ci` | patch | Perubahan CI/CD | + +**`BREAKING CHANGE`** pada body commit → **major** (apa pun typenya). + +Contoh: +``` +feat(agent): add workspace-aware file search + +Implement context-aware search scoped to current workspace directory. + +BREAKING CHANGE: search results now filter by workspace scope. +``` + +``` +fix(ipc): handle partial frame on unix socket reconnect +``` + +``` +chore: update rustls to 0.23 +``` + +### Release Workflow + +Push ke branch `main` akan memicu: +1. **CI** — `cargo build --release` + `cargo test` +2. **Semantic Release** — analisis commit → update `Cargo.toml` + `CHANGELOG.md` → git tag → GitHub Release dengan binary + --- ## License diff --git a/release.config.cjs b/release.config.cjs new file mode 100644 index 0000000..eb38ef4 --- /dev/null +++ b/release.config.cjs @@ -0,0 +1,49 @@ +module.exports = { + branches: ["main"], + plugins: [ + [ + "@semantic-release/commit-analyzer", + { + preset: "angular", + releaseRules: [ + { type: "chore", release: "patch" }, + { type: "docs", release: "patch" }, + { type: "refactor", release: "patch" }, + { type: "test", release: "patch" }, + { type: "style", release: "patch" }, + { type: "perf", release: "patch" }, + { type: "ci", release: "patch" }, + ], + }, + ], + "@semantic-release/release-notes-generator", + "@semantic-release/changelog", + [ + "@semantic-release/exec", + { + prepareCmd: + 'sed -i \'s/^version = ".*"/version = "${nextRelease.version}"/\' Cargo.toml && cargo check', + publishCmd: "cargo build --release", + }, + ], + [ + "@semantic-release/git", + { + assets: ["Cargo.toml", "Cargo.lock", "CHANGELOG.md"], + message: + "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}", + }, + ], + [ + "@semantic-release/github", + { + assets: [ + { + path: "target/release/zesdex", + label: "zesdex-${nextRelease.version}-linux-amd64", + }, + ], + }, + ], + ], +};