feat(cli): use repository organization for attestations
Merged
WA
2mo ago+459+459+012345678901234567890123456789-64-64-01234567890123456789
This PR continues Spec 001: Project and Organization from .chainloop.yml in Attestations. It covers R-003, R-005, R-006, R-009, and the organization portion of R-004. The complete implementation is tracked in #3504.
Summary
attestation init,add,push,status, andresetselect the repository organization before opening the control-plane connection.verifyis unchanged.- Organization precedence is
--org,CHAINLOOP_ORGANIZATION, repository config, local attestation state, then the saved default. - Repository selection is run-local. It neither overwrites nor clears the saved default; the final user-facing membership error identifies both the organization and repository file.
- Organization-bound API tokens for a different organization fail before connecting and report both organizations with both supported remedies. Instance-admin tokens keep using the repository organization header.
- A visible line identifies the organization and repository file when the file changes the saved default.
- Trace and attestation commands share API-token parsing while existing Trace mismatch behavior stays unchanged.
Requirements covered
- R-003: Organization from the file
- R-004: Flag and environment precedence (organization portion)
- R-005: API token for a different organization
- R-006: Saved CLI default stays the same
- R-009: Notice when the file changes the organization
Verification
env -u CHAINLOOP_TOKEN -u CHAINLOOP_ORGANIZATION go test ./app/cli/internal/token ./app/cli/cmd ./app/cli/pkg/action ./app/cli- Rebased on current
main
AI assistance
pi helped to write this change. The commit carries an Assisted-by: pi trailer.