---
id: TASK-25.1
title: Add compile_commands link helper + call site for profile builds
status: Done
assignee: []
created_date: '2026-02-28 16:34'
updated_date: '2026-02-28 16:38'
labels:
  - build
dependencies: []
references:
  - src/core/cmd.rs
  - src/core/config.rs
  - docs/zync/lua/zync/api.lua
parent_task_id: TASK-25
priority: medium
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Implement a helper (modeled on zync) to ensure build/compile_commands.json symlink points to the selected profile’s compile_commands.json, and invoke it for profile commands (conf/build/flash/run) when profiles are configured.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Helper resolves default/first profile when default_profile missing, using declaration or deterministic order.
- [x] #2 Helper uses project_dir (or cwd fallback) + build root to build link target.
- [x] #3 Helper handles existing file/link per spec and is idempotent.
- [x] #4 Helper invoked only for profile commands and only when profiles configured + link_compile_commands enabled.
<!-- AC:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Added compile_commands link helper in cmd module, resolved default/first profile via config, and invoked it for profile commands (conf/build/flash/run) when enabled. Helper handles existing link/file/other and creates symlink under build root. Ran `just check -- -D warnings`.
<!-- SECTION:FINAL_SUMMARY:END -->
