fix(installer): embed jsonc_require_python3 fallback for curl|bash (closes #11) #12

Merged
MillasAgent merged 1 commit from fix/curl-bash-prereqs into main 2026-09-06 10:46:33 +00:00
Owner

Summary

Closes Forgejo issue #11. The canonical curl -fsSL .../install.sh | bash invocation crashed at install.sh:199 with jsonc_require_python3: orden no encontrada because jsonc_require_python3 (defined in lib/jsonc.sh:87) was never sourced in the stdin path: lib/jsonc.sh sourcing is gated on SCRIPT_DIR or BUNDLE_DIR being set (install.sh:45-49), and cmd_install's post-fetch source (line 400) runs AFTER require_prereqs is called (line 390).

Fix

Embeds a minimal fallback for jsonc_require_python3 in install.sh itself, guarded by if ! declare -F, mirroring the existing openmillas:52-58 pattern. When lib/jsonc.sh IS sourced (in-tree or post-fetch) the lib version wins via the source guard at lib/jsonc.sh:50-53; in the curl|bash path the embed resolves the symbol so require_prereqs no longer crashes.

Error message matches openmillas:52-58 verbatim ("python3 is required for JSONC operations (apt: python3, brew: python, dnf: python3).") so users get the same friendly diagnostic from either entry point.

Test

Adds do_test_install_curl_pipe_stdin_prereqs to close the gap in do_test_install_curl_pipe_stdin (which only tested --help and therefore never reached line 199). The new test exercises both paths through stdin:

  • Case Apython3 on PATH: asserts the script reaches fetch_bundle_to_tmpdir (curl stubbed) and that no orden no encontrada / command not found appears.
  • Case Bpython3 absent: asserts the embedded fallback emits the friendly error message and no orden no encontrada appears.

Test design adds date to the PATH stub for Case B (required by install.sh:71 TIMESTAMP="$(date +%Y%m%d-%H%M%S)" before require_prereqs).

Also included

  • Version bump 0.3.30.3.4 in install.sh, openmillas, AGENTS.md §1, and CHANGELOG.md. New dated section per the project's release discipline (no [Unreleased], dated [X.Y.Z] - YYYY-MM-DD at merge time).
  • AGENTS.md §5.9 (rewritten): cross-reference to .opencode/agents.md for host-specific setup notes (credential helper paths, env file locations, local tool versions, etc.). The Forgejo helper rule itself is NO LONGER in AGENTS.md (which ships to the public repo); it lives in .opencode/agents.md, which is gitignored per the new .gitignore entry. Each contributor keeps their own local copy.
  • .gitignore: adds .opencode/ so the local-only host setup directory never ships.

Deferred

TD-26 (follow-up): install.sh cmd_doctor has the same latent pattern (now at line 567), but is only reachable via bash <(cat install.sh) --doctor (not via the issue #11 trace). No-op for the normal curl|bash install because cmd_install's post-fetch source runs first. Tracked separately.

Validation

  • bash workspace/opencode/deploy.sh --check — PASS
  • bash workspace/opencode/tests/test_install.shPASS: 28 FAIL: 0 (27 pre-existing + 1 new). Note: do_test_install_idempotent has a pre-existing timing flake (mtime resolved at 1-second granularity, no sleep between installs) — not related to this fix.

Spec

Internal: .internal/specs/fix-issue-11-curl-bash-prereqs.md (gitignored).

Issue

Verbatim body of Forgejo issue #11:

Siguiendo las instrucciones del README, he ejecutado el comando para instalar.

curl -fsSL https://git.millaredos.com/MillasDev/memory/raw/branch/main/workspace/opencode/install.sh | bash

Obtengo el siguiente error:

main: línea 199: jsonc_require_python3: orden no encontrada

Reported 2026-09-06 09:11:58 by millaredos (owner).

Closes #11

## Summary Closes Forgejo issue #11. The canonical `curl -fsSL .../install.sh | bash` invocation crashed at `install.sh:199` with `jsonc_require_python3: orden no encontrada` because `jsonc_require_python3` (defined in `lib/jsonc.sh:87`) was never sourced in the stdin path: `lib/jsonc.sh` sourcing is gated on `SCRIPT_DIR` or `BUNDLE_DIR` being set (`install.sh:45-49`), and `cmd_install`'s post-fetch source (line 400) runs AFTER `require_prereqs` is called (line 390). ## Fix Embeds a minimal fallback for `jsonc_require_python3` in `install.sh` itself, guarded by `if ! declare -F`, mirroring the existing `openmillas:52-58` pattern. When `lib/jsonc.sh` IS sourced (in-tree or post-fetch) the lib version wins via the source guard at `lib/jsonc.sh:50-53`; in the curl|bash path the embed resolves the symbol so `require_prereqs` no longer crashes. Error message matches `openmillas:52-58` verbatim (`"python3 is required for JSONC operations (apt: python3, brew: python, dnf: python3)."`) so users get the same friendly diagnostic from either entry point. ## Test Adds `do_test_install_curl_pipe_stdin_prereqs` to close the gap in `do_test_install_curl_pipe_stdin` (which only tested `--help` and therefore never reached line 199). The new test exercises both paths through stdin: - **Case A** — `python3` on PATH: asserts the script reaches `fetch_bundle_to_tmpdir` (curl stubbed) and that no `orden no encontrada` / `command not found` appears. - **Case B** — `python3` absent: asserts the embedded fallback emits the friendly error message and no `orden no encontrada` appears. Test design adds `date` to the PATH stub for Case B (required by `install.sh:71` `TIMESTAMP="$(date +%Y%m%d-%H%M%S)"` before `require_prereqs`). ## Also included - **Version bump** `0.3.3` → `0.3.4` in `install.sh`, `openmillas`, `AGENTS.md §1`, and `CHANGELOG.md`. New dated section per the project's release discipline (no `[Unreleased]`, dated `[X.Y.Z] - YYYY-MM-DD` at merge time). - **`AGENTS.md §5.9` (rewritten)**: cross-reference to `.opencode/agents.md` for host-specific setup notes (credential helper paths, env file locations, local tool versions, etc.). The Forgejo helper rule itself is **NO LONGER in `AGENTS.md`** (which ships to the public repo); it lives in `.opencode/agents.md`, which is **`gitignored`** per the new `.gitignore` entry. Each contributor keeps their own local copy. - **`.gitignore`**: adds `.opencode/` so the local-only host setup directory never ships. ## Deferred **TD-26** (follow-up): `install.sh` `cmd_doctor` has the same latent pattern (now at line 567), but is only reachable via `bash <(cat install.sh) --doctor` (not via the issue #11 trace). No-op for the normal curl|bash install because `cmd_install`'s post-fetch source runs first. Tracked separately. ## Validation - `bash workspace/opencode/deploy.sh --check` — PASS - `bash workspace/opencode/tests/test_install.sh` — `PASS: 28 FAIL: 0` (27 pre-existing + 1 new). Note: `do_test_install_idempotent` has a pre-existing timing flake (mtime resolved at 1-second granularity, no sleep between installs) — not related to this fix. ## Spec Internal: `.internal/specs/fix-issue-11-curl-bash-prereqs.md` (gitignored). ## Issue Verbatim body of Forgejo issue #11: > Siguiendo las instrucciones del README, he ejecutado el comando para instalar. > > `curl -fsSL https://git.millaredos.com/MillasDev/memory/raw/branch/main/workspace/opencode/install.sh | bash` > > Obtengo el siguiente error: > > `main: línea 199: jsonc_require_python3: orden no encontrada` Reported 2026-09-06 09:11:58 by millaredos (owner). Closes #11
Closes Forgejo issue #11. The canonical 'curl -fsSL .../install.sh | bash'
invocation crashed at install.sh:199 with 'jsonc_require_python3: orden no
encontrada' because the function (defined in lib/jsonc.sh:87) was never
sourced in the stdin path: lib/jsonc.sh sourcing is gated on SCRIPT_DIR or
BUNDLE_DIR being set (install.sh:45-49), and cmd_install's post-fetch source
(line 400) runs AFTER require_prereqs is called (line 390).

Embeds a minimal fallback for jsonc_require_python3 in install.sh itself,
guarded by 'if ! declare -F', mirroring the existing openmillas:52-58
pattern. When lib/jsonc.sh IS sourced (in-tree or post-fetch) the lib
version wins via the source guard at lib/jsonc.sh:50-53; in the curl|bash
path the embed resolves the symbol so require_prereqs no longer crashes.

The error message matches openmillas:52-58 verbatim ('python3 is required
for JSONC operations (apt: python3, brew: python, dnf: python3).') so users
get the same friendly diagnostic from either entry point.

Adds do_test_install_curl_pipe_stdin_prereqs to close the gap in
do_test_install_curl_pipe_stdin (which only tested --help and therefore
never reached line 199). The new test exercises both paths through stdin:
python3 present (asserts script reaches fetch_bundle_to_tmpdir) and
python3 absent (asserts the embedded fallback emits the friendly error).

Also includes:
- AGENTS.md §5.9 (new): Forgejo helper rule documenting how to authenticate
  git and REST operations to git.millaredos.com via the MillasAgent bot
  account and the credential helper at ~/.gitconfig sourcing
  /home/borja/env/forgejo.env (cross-refs wiki L-022/L-023 corrected
  2026-09-06).
- Version bump 0.3.3 -> 0.3.4 in install.sh, openmillas, AGENTS.md §1,
  and CHANGELOG.md. New dated section per the project's release discipline
  (no [Unreleased], dated [X.Y.Z] - YYYY-MM-DD at merge time).

Deferred (TD-26 follow-up): install.sh cmd_doctor has the same latent
pattern (now at line 567), but it is only reachable via 'bash <(cat
install.sh) --doctor' (not via the issue #11 trace). No-op for the normal
curl|bash install because cmd_install's post-fetch source runs first.

Specs and reports: .internal/specs/fix-issue-11-curl-bash-prereqs.md
MillasAgent force-pushed fix/curl-bash-prereqs from 3be97a02b6 to afc152c0d7 2026-09-06 10:34:44 +00:00 Compare
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MillasDev/memory!12
No description provided.