---
id: TASK-13
title: Add global --all/-a flag to run commands across all profiles
status: Done
assignee: []
created_date: '2026-02-18 18:52'
updated_date: '2026-02-19 09:07'
labels: []
dependencies: []
references:
  - bin/zync
  - lua/zync/
  - spec/
  - rockspec/
---

## Description

<!-- SECTION:DESCRIPTION:BEGIN -->
Introduce a command-wide flag `--all`/`-a` that runs eligible commands for every profile instead of a single selected profile. When `--all` is provided, it overrides any `--profile`/`-p` selection and the default profile in config. The behavior should be consistent across commands that currently accept profiles (e.g., build/run/flash as applicable). Update docs and tests accordingly.
<!-- SECTION:DESCRIPTION:END -->

## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 CLI accepts `--all`/`-a` as a global flag alongside existing options.
- [ ] #2 When `--all` is set, any `--profile`/`-p` value is ignored and all profiles are used instead.
- [ ] #3 For any command that supports profiles, invoking `zync -a <command>` runs that command once per profile.
- [ ] #4 Existing behavior is unchanged when `--all` is not set.
- [ ] #5 Tests cover `--all` precedence over `--profile` and default profile.
- [ ] #6 User-facing help text/docs describe the new flag and its precedence rules.
<!-- AC:END -->

## Implementation Notes

<!-- SECTION:NOTES:BEGIN -->
User clarified: `--all/-a` should apply to every command that supports profiles. When `--all/-a` is provided, do not error for missing profiles; treat as selecting all profiles (so no "no profiles" error).
<!-- SECTION:NOTES:END -->

## Final Summary

<!-- SECTION:FINAL_SUMMARY:BEGIN -->
Implemented global --all/-a profile iteration for profile-aware commands (conf/build/flash/run) with per-profile config reloads and logging/pre-clean handling. Added tests for --all precedence and multi-profile execution. Updated README usage, docs, and marked build-all-profiles as complete.
<!-- SECTION:FINAL_SUMMARY:END -->
