fix(installer): git_clone_bundle + prereq check (closes #11) #13
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/installer-git-clone-prereqs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes Forgejo issue #11 (reopened after PR #12 closed it prematurely). The canonical
curl | bashinstall path now usesgit clone --depth 1against the public repo (no API tokens, no per-file fetch, no allowlist) instead of the broken API-REST listing that duplicated theMillasDev/memorysegment in every URL.This is a different release from PR #12 (
0.3.4). PR #12 fixed thejsonc_require_python3symbol-resolution symptom with an embedded fallback; it did not address the underlying fetch bug atinstall.sh:97. The newdo_test_install_curl_pipe_stdin_bundle_cloneregression test (which captures the actual clone URL via a git stub and asserts it byte-for-byte) is what would have caught the URL bug at PR #12 review time.Fix
install.sh:fetch_bundle_to_tmpdir(49 lines, API REST) DELETED.install.sh:git_clone_bundle(~33 lines,git clone --depth 1) added. Derivesclone_url="${REMOTE_RAW_BASE%/raw/branch/*}". Returns$workdir/workspace/opencode(the bundle root) so callers (copy_bundle,patch_global_opencode_jsonc,patch_global_tui_json,install_openmillas_cli) work unchanged. Repo is public — no auth, no credential helper, no token.install.sh:require_prereqsrewritten: now checksbash 4+,python3,gitup front, in that order. Each missing prereq prints a distro-specific install heredoc (apt/dnf/brew/apk/xcode-select --install) and exits 1. The previous shape silently assumedgitexisted and surfaced errors only at the fetch step.Defense-in-depth
git_clone_bundlevalidates the clone URL before calling git:https://scheme (rejectsfile://,ext::, etc.)/raw/batch/<ref>strip to have actually fired (catches a user-suppliedREMOTE_RAW_BASEthat lacks the expected suffix)This closes the same family of silent URL-construction errors as the original bug.
Tests
do_test_install_curl_pipe_stdin_bundle_clone: stubsgit(notcurl) so the test captures the actual clone URL viaprintf '%s\n' "$@"to a log file. Asserts the URL equals the expected stripped REMOTE_RAW_BASE byte-for-byte. This is the regression test that would have caught the bug at PR #12 review time.do_test_install_curl_pipe_stdin_missing_git: PATH without git → asserts the heredoc withapt install git/dnf install git/brew install git/xcode-select --install/apk add gitreaches stderr.do_test_install_curl_pipe_stdin_missing_python3: mirror of the above for python3.do_test_install_curl_pipe_stdin_prereqs: Case B stub-binary list now includesgit(so the new git prereq does not mask the python3-prereq test). Case A's obsoleteSTUB curlassertion removed (cmd_install no longer uses curl). Case B python3-missing assertion relaxed to accept either the legacy embedded-fallback message or the new require_prereqs message.Acceptance criteria
bash workspace/opencode/tests/test_install.shexits 0;ALL TESTS PASS;PASS: 31 FAIL: 0. (Modulo pre-existingdo_test_install_idempotentmtime flake.)bash workspace/opencode/deploy.sh --checkexits 0.curl -fsSL https://git.millaredos.com/MillasDev/memory/raw/branch/main/workspace/opencode/install.sh | bash -s -- install --yes --no-interactionreachesinstall_openmillas_cliwithoutfetch failed,git clone failed,orden no encontrada, orcommand not found.[openmillas][error] git is required but was not found on PATHand includes the install-heredoc instructions.[openmillas][error] python3 is required but was not found on PATHand includes the install-heredoc instructions.do_test_install_curl_pipe_stdin_bundle_cloneasserts the git stub's argv contains exactly${REMOTE_RAW_BASE%/raw/branch/*}.Spec deviation (acknowledged)
.internal/specs/fix-issue-11-git-clone-and-prereqs.md§3.2 originally specifiedgit_clone_bundlereturning$workdir, but the implementation returns$workdir/workspace/opencode. Spec §3.3 implicitly assumed the latter (source "$BUNDLE_DIR/lib/jsonc.sh"would resolve to a non-existent path under the spec's literal return value). Spec updated post-implementation to match the actual return path. No code change beyond the spec doc edit.Deferred (out of scope per spec §6)
curl | bashinstall.sh self-update.editorial/auto-deploy viacopy_bundle(git_clone_bundlecloneseditorial/butcopy_bundlecorrectly excludes it; TD-25 stays open).cmd_doctorgit-check (install.sh:485-598, openmillas:190-311).cmd_updateself-update 404 (different code path; separate bugfix).lib/jsonc.shdead-code cleanup (TD-22).Review notes
Files
workspace/opencode/install.sh—fetch_bundle_to_tmpdirdeleted;git_clone_bundleadded;require_prereqsrewritten;cmd_installlog lines updated.workspace/opencode/tests/test_install.sh— 4 tests affected (1 adjusted, 3 new).workspace/opencode/openmillas— version bump 0.3.4 → 0.3.5.AGENTS.md— version line bumped.CHANGELOG.md— new## [0.3.5] - 2026-09-06section with### Fixed+### Changed; new link-footer line.README.md— new## Prerequisitessection..gitignore— adds.codegraph_tmp_*pattern (defense-in-depth against loose tool-output artifacts).Spec
.internal/specs/fix-issue-11-git-clone-and-prereqs.md(gitignored, the implementer's contract).Closes #11