fix(cli): use the run's organization after attestation init
Closes #3861
After chainloop attestation init --org org-a, the commands add, push, status, and reset sent the organization of the repository .chainloop.yml instead of the organization of the run. When the file named another organization, they failed with "workflow run not found".
The organization stored in the local attestation state now comes before the repository config. The order is: --org > CHAINLOOP_ORGANIZATION > local attestation state > .chainloop.yml > saved CLI default. init still reads the repository config, and remote state (--attestation-id) does not change. When the file names a different organization than the local state, the CLI logs which one it uses. The API token check runs for the repository organization only when the CLI uses that organization.
This is an implementation fix within R-003 and R-004 of spec issue-3063-attestation-repo-config. R-003 puts the file before the saved CLI default, not before the organization of an attestation that is already initialized. The spec does not change. The fix keeps the behavior of #2823 and corrects the order that #3518 introduced.
Decision record: adds ATT-006 to docs/decisions/attestation-process.md. It partly replaces ATT-001 (the place of the local attestation state in the order) and ATT-004 (after init, the file does not act as --org).
This PR was prepared with AI assistance (Claude Code).
🤖 Posted by Maximus bot (Claude Code) on behalf of @migmartri