---
id: TASK-5.1
title: Implement config merge and arg normalization
status: Done
assignee:
  - codex
created_date: '2026-02-03 12:17'
updated_date: '2026-02-03 12:39'
labels: []
dependencies: []
parent_task_id: TASK-5
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Add support for `args` at global and profile scopes in `zconf.lua`, normalize string vs list inputs, and ensure phase execution appends args in global-then-profile order without changing behavior when unset.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [x] #1 Global `args` and per-profile `args` are read from config and applied only to the matching phase.
- [x] #2 Args accept both string and list-of-strings forms and are normalized to a consistent internal list.
- [x] #3 When both global and profile args exist, they are concatenated in order: global first, then profile.
- [x] #4 Phases with no configured args behave exactly as before.
<!-- AC:END -->

## Implementation Plan

<!-- SECTION:PLAN:BEGIN -->
1. Extend zconf schema to allow top-level `args` (table).
2. Add helper in lua/zync/api/manager.lua to resolve per-phase args from global and profile scopes, normalizing string vs list and concatenating global first.
3. Append resolved args to commands for phases: conf (cmake), build (ninja), flash (ninja flash or west flash in sysbuild), run (ninja run).
4. Ensure no change in behavior when args are not configured.
<!-- SECTION:PLAN:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
Implemented config args schema and phase extra-args resolution in lua/zync/api/manager.lua; appended to conf/build/flash/run commands with global->profile ordering. No tests run for this subtask.
<!-- SECTION:NOTES:END -->
