feat(cli): handover — generic ownership switch between the kit users - #47
Merged
Conversation
Recursive chown to <me|opencode>:<sharing-group> + g+w for mixed-owner trees (e.g. ddev's .gotmp after builds by both users); same semantics as the ddev handovers — only the owner flips, group access stays. Validation and --dry-run run before the sudo hop; system roots and whole home directories are refused; loop guard against non-elevating sudo.
…et test CI runners have no /etc/opencode-permissions-kit/install.conf: the conf check masked the unknown-target usage error, and the test read the real /etc conf (passed only on installed machines). Usage errors now surface before the conf requirement; the test pins OPK_INSTALL_CONF explicitly.
…kflow The bare 'handover me .gotmp' line gave no context — show the chmod EPERM symptom, the checkout cd, both directions and --dry-run.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New top-level CLI command:
Also bumps VERSION to 0.0.24.
Why
Mixed-owner trees happen as soon as both the developer and the agent build
or work in the same checkout — for example ddev's
.gotmpcache aftertests ran as both users (came up while working on the ddev upstream PR
around #46):
chownthen needs root, the exact usernames, and the rightgroup, and ddev's Makefile chmods make every build noisy.
handoverwraps that into the kit:
me/opencoderesolve from the install config,no usernames to remember.
Semantics
chown <user>:<sharing group>+g+w— identical to the ddevhandovers (
ddev-handover.sh): only the owner flips, the group staysthe kit's sharing group, so both sides keep group access to the tree.
config/update); validation and--dry-runrun before the sudo hop, so argument errors and the planwork unprivileged.
/,/usr,/var, ...) and whole homedirectories — hand over trees, not systems.
recursing.
Distinct from
config handover(the ddev project bootstrap repair): thatone is project-aware (
.ddev+ settings dirs), this one is a genericowner switch for any path.
Tests
16 new assertions in
tests/test-kit-cli.sh: usage/argument errors,unknown target, nonexistent paths, the refusal cases (
/,/usr,/etc,/var, whole home),--dry-runplan output + no-sudo, sudo elevation hop,and the loop guard (root test envs run the real chown and verify recursive
ownership). Full
make test,make lint,make check-versiongreen.Docs
docs/reference/cli.md: new## handoversection + intro command list.