---
id: TASK-10.4
title: Expand tests for CLI entrypoint
status: Done
assignee:
  - codex
created_date: '2026-02-26 12:52'
updated_date: '2026-02-26 13:10'
labels: []
dependencies: []
references:
  - src/main.rs
  - src/core/cli.rs
  - src/core/cmd.rs
  - tests/integration_tests.rs
parent_task_id: TASK-10
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Improve coverage for `src/main.rs` by exercising success and failure paths of the binary entrypoint.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 `just coverage` reports >=90% line coverage for `src/main.rs`.
- [x] #2 Tests validate exit behavior for both success and error cases without modifying the binary behavior.
- [x] #3 Tests pass on CI via `just test`.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
Plan:
1) Extend integration tests to execute the `kaze` binary via `std::process::Command`, using temp project dirs for isolation.
2) Cover success and failure exit paths: success via `kaze init` in empty temp dir; failure via `kaze clean` in a dir without `kaze.toml`, asserting non-zero exit and stderr message.
3) Use `CARGO_BIN_EXE_kaze` to locate the binary (panic if missing) and avoid new dependencies.
4) Run `just coverage` to confirm `src/main.rs` >=90% line coverage, then `just test`.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Added integration tests in `tests/integration_tests.rs` to run the `kaze` binary via `std::process::Command` and cover success (`init`) and failure (`clean` without config) paths. Implemented binary lookup via `CARGO_BIN_EXE_kaze` with a current_exe fallback. `just coverage` now reports `src/main.rs` line coverage 100%. Ran `just test` (64 tests passed).
<!-- SECTION:NOTES:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Added integration tests that execute the `kaze` binary to cover entrypoint success and failure paths, including binary lookup fallback when `CARGO_BIN_EXE_kaze` is unset. `just coverage` now shows 100% line coverage for `src/main.rs`.

Tests: `just coverage`, `just test`
<!-- SECTION:FINAL_SUMMARY:END -->
