Skip to content

Add rlwrap installation to orchard#20

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

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

Conversation

@tomascasas
Copy link
Copy Markdown
Contributor

@tomascasas tomascasas commented May 14, 2026

Summary

  • Add rlwrap — installs rlwrap in the container image for readline-style
    history in interactive CLIs (JShell, Clojure REPL, etc.)
  • Persist ~/.claude per project — each project directory gets its own
    named 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
    orchard user can write without elevated caps
  • Accept extra bind mounts with auto VS Code workspace — callers set
    ORCHARD_EXTRA_MOUNTS (newline-separated host paths) to inject additional
    repos; each is mounted at /repos/<basename> (provisioned in
    Dockerfile.orchard with orchard ownership) and orchard.sh
    auto-generates orchard.code-workspace listing 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-workspace is
    added to .gitignore both statically (committed) and at runtime as a safety
    net
  • Show project name in shell prompt — injects ORCHARD_PROJECT and
    PROMPT_COMMAND so the container prompt identifies which project you're
    working in
  • Fix NEEDS_BUILD detection — replaced the broken -nt comparison
    (which compared a file path against a Docker timestamp string) with numeric
    epoch comparison via stat + date -j, so the image is only rebuilt when
    the Dockerfile actually changed

Test plan

  • ./orchard.sh on a fresh checkout rebuilds the image; subsequent runs skip the build
  • Modifying Dockerfile.orchard triggers a rebuild; unmodified does not
  • ~/.claude inside the container survives exit + re-enter; a second project gets a separate volume
  • Setting ORCHARD_EXTRA_MOUNTS="/path/to/other-repo" mounts it at /repos/other-repo inside the container
  • With extra mounts set, orchard.code-workspace is generated at project root and orchard.code-workspace appears in .gitignore
  • Without extra mounts, any stale orchard.code-workspace is removed
  • Shell prompt inside container shows [<project-name>]
  • rlwrap --version works inside the container

🤖 Generated with Claude Code

@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.
@tomascasas tomascasas requested a review from ohpauleez May 26, 2026 21:17
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.
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