---
id: TASK-25
title: Implement compile_commands.json link for profile builds
status: Done
assignee: []
created_date: '2026-02-28 16:34'
updated_date: '2026-02-28 16:44'
labels:
  - build
  - logging
dependencies: []
references:
  - src/core/cmd.rs
  - src/core/config.rs
  - src/config/schema.rs
  - docs/zync/lua/zync/api.lua
  - docs/zync/README.md
  - README.md
  - docs/spec.md
  - tests/
priority: medium
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Add behavior similar to zync: when profiles are configured and build/compile_commands linking is enabled, ensure build/compile_commands.json points to the default/first profile’s compile_commands.json. Only run for relevant commands and during profile builds.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 When profiles are configured and link_compile_commands is enabled, running build/conf/flash/run ensures build/compile_commands.json links to build/<default_or_first_profile>/compile_commands.json.
- [x] #2 Link creation is skipped for init/boards/runners/profiles and when profiles are absent or config invalid.
- [x] #3 Existing compile_commands.json file is replaced by a symlink; existing symlink is left intact; non-file/non-link paths cause a safe no-op.
- [x] #4 Behavior is gated by build.link_compile_commands (default true).
- [x] #5 Docs updated to mention the compile_commands.json link behavior.
- [x] #6 Tests cover link creation, replacement, and skip cases (at least one for profiles configured vs not).
<!-- AC:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Implemented compile_commands.json link creation for profile commands (conf/build/flash/run) gated by build.link_compile_commands, using default/first profile. Added tests for default/fallback/skip/replacement and documented skip conditions in README/spec. Ran `just check -- -D warnings` and `cargo test -p nishikaze core::cmd::tests::compile_commands_link`.
<!-- SECTION:FINAL_SUMMARY:END -->
