Skip to content

feat(ssh): add sh command to explore the hook sandbox - #16

Merged
Xe merged 3 commits into
mainfrom
Xe/ssh-sh-hook-shell
Sep 23, 2026
Merged

Xe merged 3 commits into
mainfrom
Xe/ssh-sh-hook-shell

Conversation

@Xe

@Xe Xe commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add an SSH 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.
  • Share one sandbox builder between push hooks and the shell, which also fixes $PWD in hooks (it held the daemon's host working directory instead of /src).

Details

The shell uses x/term over 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 before x/term sees it because x/term treats it as EOF and drops pending input. Known gap, not fixed here: $(pwd) does not capture output in hooks or the shell, because kefkash.CallHandler writes to a fixed stdout.

Test plan

  • Code compiles with go build ./...
  • Code formatted with npm run format
  • go test ./... passes, plus -race on the shell and hook tests (new TestSSHShell drives a real ssh -tt client)
  • Manual testing

Xe added 3 commits September 23, 2026 16:35
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
Xe merged commit ed5dc6c into main Sep 23, 2026
8 checks passed
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>
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.8.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant