Repository navigation
feat(ssh): add sh command to explore the hook sandbox - #16
Merged
Merged
Conversation
Hook authors had no way to see the environment a receive-pack hook runs in without pushing again and again. `ssh -t host sh <repo> [branch]` now opens an interactive kefka shell with the same /src and /tmp mounts, OBJGIT_* variables, and stdin line that a hook gets, filled in from the branch tip as if it had just been pushed. It needs -allow-hooks, a PTY, and write access to the repository. Push hooks and the shell now share one sandbox builder, which also fixes $PWD in hooks: it held the daemon's host working directory instead of /src. Assisted-by: Claude Opus 5.5 via Claude Code Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Signed-off-by: Xe Iaso <xe@tigrisdata.com> # Conflicts: # AGENTS.md
main added file-change metadata to push hooks (OBJGIT_*_FILES_JSON and /tmp/objgit-changes.json) inside runHook. Move that into the shared sandbox helpers as loadHookChanges, so the sh shell gets the same variables and file, diffed against the tip's first parent. Signed-off-by: Xe Iaso <xe@tigrisdata.com>
Xe
pushed a commit
that referenced
this pull request
Sep 23, 2026
# [1.8.0](v1.7.0...v1.8.0) (2026-09-23) ### Features * **ssh:** add sh command to explore the hook sandbox ([#16](#16)) ([ed5dc6c](ed5dc6c)) Signed-off-by: Tigris Data <social@tigrisdata.com>
|
🎉 This PR is included in version 1.8.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Summary
sh <repo> [branch]command that opens an interactive shell in the push-hook sandbox, filled in from the branch tip as if it had just been pushed.$PWDin hooks (it held the daemon's host working directory instead of/src).Details
The shell uses
x/termover the session PTY for line editing, and each statement gets the hook stdin line and its own-hook-timeout. It needs-allow-hooks, a PTY, and write access to the repo. Ctrl-C is rewritten beforex/termsees it becausex/termtreats it as EOF and drops pending input. Known gap, not fixed here:$(pwd)does not capture output in hooks or the shell, becausekefkash.CallHandlerwrites to a fixed stdout.Test plan
go build ./...npm run formatgo test ./...passes, plus-raceon the shell and hook tests (newTestSSHShelldrives a realssh -ttclient)