---
id: TASK-8.1
title: Implement full build-dir clean for `zync clean`
status: Done
assignee:
  - codex
created_date: '2026-02-03 17:47'
updated_date: '2026-02-03 17:50'
labels:
  - clean
  - build
  - profiles
dependencies: []
references:
  - lua/zync/api/manager.lua
  - lua/zync/api.lua
parent_task_id: TASK-8
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Change the clean command behavior so `zync clean` removes the entire root build directory (including all profile subdirectories), without affecting `-c/--clean` pre-clean behavior for other commands.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 `zync clean` removes `./build` entirely for profile-less projects.
- [x] #2 `zync clean` removes `./build` (and all profile subdirectories) for build-profile projects.
- [x] #3 `-c/--clean` pre-clean behavior for other commands still targets the selected build directory (no regression).
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
- Inspect lua/zync/api/manager.lua and lua/zync/api.lua to see how clean and -c/--clean are currently wired.
- Adjust the clean command handler so it removes the root ./build directory (full clean) regardless of profile selection.
- Preserve -c/--clean pre-clean behavior by keeping it targeted to the selected build directory when running other commands.
- Add minimal guardrails if needed to ensure root project context is used for full clean.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Plan approved by user on 2026-02-03.

Implemented full build-dir cleanup when config.clean_all is set in `lua/zync/api/manager.lua` and set that flag for the `clean` command in `lua/zync/api.lua` to preserve pre-clean behavior.
<!-- SECTION:NOTES:END -->
