Skip to content

Add rlwrap installation to orchard#20

Open
tomascasas wants to merge 6 commits into
mainfrom
add-rlwrap
Open

Add rlwrap installation to orchard#20
tomascasas wants to merge 6 commits into
mainfrom
add-rlwrap

Conversation

@tomascasas
Copy link
Copy Markdown
Contributor

@tomascasas tomascasas commented May 14, 2026

Fix image rebuild detection and add extra mount support

Summary

  • Fix NEEDS_BUILD always being true — the previous -nt test compared the Dockerfile path against a Docker timestamp string (not a file), so bash always evaluated the right operand as non-existent and triggered a rebuild unconditionally. Replaced with a numeric epoch comparison using stat -f %m for the Dockerfile and date -j -f for the image creation time, with suffix stripping (%%[.Z]*) to handle Docker timestamps both with and without fractional seconds.
  • Add ORCHARD_EXTRA_MOUNTS support — callers (e.g. orchardw.sh) can now inject additional bind mounts by setting ORCHARD_EXTRA_MOUNTS to a newline-separated list of host:container path pairs before invoking orchard.sh. Each valid host directory is forwarded as a -v flag to docker run.
  • Add rlwrap to the image — installed alongside the other apt packages in Dockerfile.orchard for readline support inside the container.

Test plan

  • Run orchard.sh with the image already up to date — confirm it prints "Using existing orchard" without rebuilding
  • Touch Dockerfile.orchard and re-run — confirm it rebuilds
  • Run via orchardw.sh -r /some/repo — confirm /workspace/repos/repo is accessible inside the container
  • Confirm rlwrap is available inside a fresh container (rlwrap --version)

@tomascasas tomascasas requested a review from a team as a code owner May 14, 2026 19:21
This is helpful to run orchard on kspecs or management-kspecs so that you pull in additional folder mappings.
In my case I have an orchardw.sh script in management-kspecs that I plan submitting to kspecs that will trigger orchard accepting relative/absolute paths with -r flag each and mount them to workspace/repost/<basename> upon running orchard.
Creates a named Docker volume (orchard-claude-<basename>-<hash>) for
each project directory and mounts it to /home/orchard/.claude, so
Claude Code chat history and settings survive container restarts and
stay compartmentalized per project. Also pre-creates the ~/.claude
directory in the Dockerfile so the volume mount lands with correct
ownership.
Docker initializes named volume mount points as root:root, preventing
the orchard user from writing to ~/.claude. Run a one-time chown after
volume creation so the user can write without elevated capabilities.
Pass ORCHARD_PROJECT (basename of PROJECT_DIR) into the container and use
PROMPT_COMMAND to set PS1 so the project name is visible in every prompt.
PROMPT_COMMAND is used instead of PS1 directly because Ubuntu's ~/.bashrc
resets PS1 on startup, but PROMPT_COMMAND runs after and wins.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant