Skip to content

docker: repl entrypoint mode — orly-repl baked into the image (#538) - #539

Merged
ohohoreilly merged 2 commits into
masterfrom
feat/538-docker-repl-mode
Jul 7, 2026
Merged

ohohoreilly merged 2 commits into
masterfrom
feat/538-docker-repl-mode

Conversation

@ohohoreilly

Copy link
Copy Markdown
Member

Closes #538. Follow-up to #536.

What

docker run -it --rm ghcr.io/orlyatomics/orly repl

starts the usual in-container mem-sim orlyi (logs go to /var/log/orly/orlyi.log instead of the terminal) and drops straight into orly-repl pointed at it. Package dir, orlyc, and ORLY_SRC_ROOT are container-internal, so the REPL needs zero host setup — this replaces the shared-mount + docker-exec-orlyc recipe as the front-door way to try orlyscript.

  • Flags after repl pass to orly-repl (e.g. repl --shared).
  • An orly-repl shim on PATH serves docker exec -it <ctr> orly-repl ... against a container running the default entrypoint.
  • When the REPL exits, the container exits.

How

  • Build stage: node/npm; builds clients/ts then clients/repl, prunes dev deps in both (they reach the runtime image through the existing /src/orly -> /opt/orly/src copy, so pruning keeps typescript et al. out of it).
  • Runtime stage: nodejs only (no npm) to run the pre-built dist.
  • entrypoint.sh: the orlyi flag set moves into an array shared by both modes; repl mode backgrounds orlyi, waits for the WS port via /dev/tcp, and execs the REPL.

CI

The docker workflow already builds the image and gates it on every PR touching these paths; this PR adds a repl-mode step — pipe 40 + 2; through docker run -i ... repl on the freshly built image and assert 42 comes back. That one check covers runtime node, the baked REPL build, and the background-orlyi handshake. (The gated container runs its own orlyi inside, so it doesn't clash with the MCP-smoke container on the runner.)

Docs

Dockerfile header, root README (one-liner under the docker section), clients/repl README (image mode first, host-side recipe kept as the alternative for joining host-agent povs), changelog fragment.

`docker run -it --rm ghcr.io/orlyatomics/orly repl` now starts the
in-container mem-sim orlyi (logs to /var/log/orly/orlyi.log) and drops
straight into orly-repl pointed at it -- package dir, orlyc, and
ORLY_SRC_ROOT are all container-internal, so the REPL needs zero host
setup. Flags after `repl` pass to orly-repl; an orly-repl shim on PATH
serves `docker exec -it <ctr> orly-repl` against a default-entrypoint
container.

Build stage gains node/npm and builds clients/ts + clients/repl,
pruning dev deps before they ride into the runtime stage through the
existing /src/orly -> /opt/orly/src copy; the runtime stage gains
nodejs. The entrypoint's orlyi flags move into a shared array used by
both modes.

The docker workflow's PR gate grows a repl-mode step: pipe an
expression through `docker run -i ... repl` on the freshly built image
and assert the value comes back -- covering runtime node, the baked
REPL build, and the background-orlyi handshake in one check.
@ohohoreilly ohohoreilly self-assigned this Jul 7, 2026
ohohoreilly added a commit that referenced this pull request Jul 7, 2026
…#542)

With piped stdin (printf ... | orly-repl, the docker repl mode's
shape), readline's close event fires as soon as input is exhausted --
while the first entry is still compiling. quit() ran immediately,
tearing down the WebSocket and scratch dir under the entry, and
process.exit(0) then truncated the pending stderr write, so the
failure was silent: banner, one prompt, exit 0, no output. The
interactive path never hits this because stdin stays open; the smoke
held its pipe open too, which is why CI on #536 was green.

Stdin EOF now chains quit() onto the entry queue (quit after pending
entries drain -- Ctrl-D semantics unchanged), and quit sets
process.exitCode instead of calling process.exit, letting the event
loop drain and output flush once stdin, readline, and the socket are
all closed.

The smoke gains a piped-EOF regression scenario: write an expression,
close stdin immediately, require the result and exit 0. Verified
additionally inside the published docker image against the exact
failing invocation from the docker gate on #539.
@ohohoreilly
ohohoreilly merged commit 9caa8b6 into master Jul 7, 2026
10 checks passed
@ohohoreilly
ohohoreilly deleted the feat/538-docker-repl-mode branch July 7, 2026 22:23
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.

docker: repl entrypoint mode — orly-repl baked into the image

1 participant