Files
repoctl/src/stewardship
Alexander BaranovandClaude Opus 5 c483d94f36 fix(cli): report a refused plan as an envelope
Only `apply` had a handler for AdoptionError, which was true when the error
type was introduced. `plan` has since gained two ways to refuse: it validates
the managed block of an existing CLAUDE.md to test idempotence, and it now
decides the knowledge entrypoint by content. Both reached the top-level safety
net in main, which prints a bare line to stderr and exits -- so `--output json`
answered a caller with no envelope at all, breaking the machine-readable
contract precisely when something went wrong and the caller needed the code.

The mapping from finding code to exit code now lives in one place rather than
being spelled out per branch.

- add _adoption_failure and use it from both plan and apply
- cover a refused plan end to end, envelope shape and exit code included

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-24 22:56:58 +03:00
..