Skip to content

fix(install): default project dir to CWD and ensure Erlang runtime so the README quick start works#34

Open
shaun0927 wants to merge 1 commit into
Q00:release/bootstrapfrom
shaun0927:fix/install-cwd-default-and-erlang-runtime
Open

fix(install): default project dir to CWD and ensure Erlang runtime so the README quick start works#34
shaun0927 wants to merge 1 commit into
Q00:release/bootstrapfrom
shaun0927:fix/install-cwd-default-and-erlang-runtime

Conversation

@shaun0927
Copy link
Copy Markdown

Summary

Following the README quick start on a clean machine —

curl -fsSL https://raw.githubusercontent.com/Q00/ourocode/release/bootstrap/install.sh | bash
ourocode

— does not work today. Two release-path bugs break it. This PR fixes both so the documented flow works on any machine.

Bug 1 — hardcoded developer project directory

lib/ourocode/cli/startup_args.ex defaulted the project directory to a build-time absolute path:

@default_project_dir "/Users/jaegyu.lee/Project/ourocode"

On any other machine, running ourocode (or ourocode --smoke-test) without --project-dir fails in resolve_project_dir/1:

ourocode startup failed: project directory does not exist: /Users/jaegyu.lee/Project/ourocode

Fix: default to the current working directory (File.cwd!()), with an OUROCODE_PROJECT_DIR environment override. This matches the README's "Then run: ourocode" contract.

Bug 2 — Erlang/OTP runtime not ensured by the installer

The bundled ourocode is an Erlang escript (#! /usr/bin/env escript) and needs escript/erl on PATH. The release tarball does not bundle the runtime, and install.sh only checks for mix/cargo on the build-from-source path — never on the bundled-release path. So on a fresh machine the installer prints ==> ready, yet every invocation dies with:

env: escript: No such file or directory

Fix: add a best-effort ensure_erlang_runtime step (consistent with the existing best-effort Ouroboros step) that installs Erlang via Homebrew (macOS) or apt/dnf (Linux), and otherwise fails fast with actionable manual instructions. OUROCODE_SKIP_ERLANG=1 bypasses it.

Docs

README.md: document the Erlang/OTP runtime requirement, the installer's handling of it, and the new CWD default / OUROCODE_PROJECT_DIR override.

Changes

File Change
lib/ourocode/cli/startup_args.ex default_project_dir/0 → CWD + OUROCODE_PROJECT_DIR override
test/ourocode/cli_test.exs update the two tests that asserted the hardcoded path
install.sh ensure_erlang_runtime (best-effort install + fail-fast guidance)
README.md Requirements section + CWD-default note

Verification

  • mix test test/ourocode/cli_test.exs46 tests, 0 failures
  • bash -n install.sh → syntax OK
  • mix format --check-formatted on the edited Elixir files → clean

Note: running the full suite under Elixir 1.19 hits an unrelated pre-existing incompatibility (@type record in lib/ourocode/plugin/config_status.ex collides with the new built-in record/0 type). That is outside this PR's scope; the targeted cli_test.exs run above covers the changed code.

Out of scope

Single self-contained binary (already tracked in the README Status section), Homebrew tap, the separate ouroboros Python installer warnings, and Windows support.

🤖 Generated with Claude Code

The release path documented in the README ("curl ... install.sh | bash"
then "ourocode") failed on any machine other than the maintainer's:

1. StartupArgs hardcoded the default project directory to a build-time
   developer path (/Users/jaegyu.lee/Project/ourocode). Running `ourocode`
   without --project-dir on any other machine errored with
   "project directory does not exist". Default to the current working
   directory instead, with an OUROCODE_PROJECT_DIR override.

2. The bundled `ourocode` is an Erlang escript and needs the Erlang/OTP
   runtime (escript/erl) on PATH, but install.sh never checked for or
   installed it. On a fresh machine the installer "succeeded" yet every
   invocation died with "env: escript: No such file or directory".
   Add a best-effort runtime ensure step (brew on macOS, apt/dnf on
   Linux) that fails fast with manual instructions when it cannot help,
   with an OUROCODE_SKIP_ERLANG=1 escape hatch.

Also document the Erlang/OTP requirement and the CWD default in the README.

Verified with `mix test test/ourocode/cli_test.exs` (46 tests, 0 failures)
and `bash -n install.sh`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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