Add rlwrap installation to orchard#20
Open
tomascasas wants to merge 7 commits into
Open
Conversation
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.
When ORCHARD_EXTRA_MOUNTS injects additional repos, orchard.sh now writes a .code-workspace file listing /workspace plus each /repos/<name> root, so VS Code can open all roots automatically via "Attach to Running Container". The file is excluded from git (added to .gitignore, also staged here). Dockerfile.orchard gains /repos and sets its ownership to orchard.
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
rlwrapin the container image for readline-stylehistory in interactive CLIs (JShell, Clojure REPL, etc.)
~/.claudeper project — each project directory gets its ownnamed Docker volume (
orchard-claude-<name>-<hash>) mounted at~/.claude,so Claude session history and settings survive container restarts and stay
compartmentalized per project; volume ownership is fixed on creation so the
orcharduser can write without elevated capsORCHARD_EXTRA_MOUNTS(newline-separated host paths) to inject additionalrepos; each is mounted at
/repos/<basename>(provisioned inDockerfile.orchardwithorchardownership) andorchard.shauto-generates
orchard.code-workspacelisting all roots so VS Code's"Attach to Running Container" opens everything at once; when no extra mounts
are present any stale workspace file is removed;
orchard.code-workspaceisadded to
.gitignoreboth statically (committed) and at runtime as a safetynet
ORCHARD_PROJECTandPROMPT_COMMANDso the container prompt identifies which project you'reworking in
NEEDS_BUILDdetection — replaced the broken-ntcomparison(which compared a file path against a Docker timestamp string) with numeric
epoch comparison via
stat+date -j, so the image is only rebuilt whenthe Dockerfile actually changed
Test plan
./orchard.shon a fresh checkout rebuilds the image; subsequent runs skip the buildDockerfile.orchardtriggers a rebuild; unmodified does not~/.claudeinside the container survivesexit+ re-enter; a second project gets a separate volumeORCHARD_EXTRA_MOUNTS="/path/to/other-repo"mounts it at/repos/other-repoinside the containerorchard.code-workspaceis generated at project root andorchard.code-workspaceappears in.gitignoreorchard.code-workspaceis removed[<project-name>]rlwrap --versionworks inside the container🤖 Generated with Claude Code