Skip to content

refactor: hoist shared install helpers into prelude (DOT-46)#73

Merged
edwinhern merged 1 commit into
mainfrom
feature/dot-46-shell-cleanup
Jul 1, 2026
Merged

refactor: hoist shared install helpers into prelude (DOT-46)#73
edwinhern merged 1 commit into
mainfrom
feature/dot-46-shell-cleanup

Conversation

@edwinhern

Copy link
Copy Markdown
Owner

Summary

Shell cleanup for the install libraries. The QA/DevOps audit's shell findings were mostly checked and rejected (see below); the one real item was duplication. Each install lib carried a private _X_have_any and _X_report_failures. Both are non-unique work, so they move into install-prelude.sh, whose docstring already declares that as its purpose. Behavior is unchanged; net -55 lines.

Changes

  • install-prelude.sh gains have_any (array holds a non-empty entry) and report_failures (warn + list, with caller-supplied tag and noun phrase to preserve per-lib wording).
  • ai-mcp, ai-plugins, ai-skills, graphify-skills drop their private copies and call the shared helpers.
  • uv-tools, vscode drop their inline failure-report blocks for report_failures.
  • ai-mcp, ai-plugins, ai-skills self-exec guards now source the prelude; their bats harnesses source it too, matching the pattern graphify/vscode already used.

Design notes

  • have_any takes the array by value (${arr[@]-}), not a local -n nameref, so it stays valid under the bash 3.2 that ships with macOS before Homebrew installs a newer bash.
  • Warning text and exit codes are byte-for-byte identical; existing failure-path assertions pass unchanged.

Audit items deliberately NOT done (verified false or low-value)

  • "install-prelude.sh missing set -euo pipefail" — it is a sourced prelude, not an entry script; each lib sets its own options. Adding it would change sourcing-shell state for no benefit.
  • "Convert inline command -v claude to require_command" — would rewrite tested, user-facing error messages for a cosmetic gain.
  • "Unsafe cd in statusline (L163, L177)" — both are already guarded (cd && git inside $(...), and cd ... || exit 0 in a subshell). Not bugs.
  • "Unused failed array in ai-plugins" — it is populated and reported. Not unused.

Verification

  • mise test — 122/122 pass.
  • mise lint — clean (treefmt + shellcheck).

Fixes DOT-46

The install libraries each carried a private copy of the same two
helpers: a check for whether a target array holds any non-empty entry,
and a warn-plus-list summary of failed items. install-prelude.sh already
states its job is to hold the shared work so each library keeps only its
unique logic, so both helpers move there.

have_any takes the array by value (${arr[@]-}) rather than a nameref so
it stays valid under the bash 3.2 that ships with macOS. report_failures
takes a tag and a noun phrase so each library keeps its own wording.

ai-mcp, ai-plugins, and ai-skills gain the prelude in their self-exec
guard, and their bats harnesses source it alongside log.sh, matching the
pattern graphify and vscode already used. Behavior is unchanged; the
warning text and exit codes are identical.

Fixes DOT-46
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@edwinhern edwinhern merged commit 0f2e789 into main Jul 1, 2026
6 checks passed
@edwinhern edwinhern deleted the feature/dot-46-shell-cleanup branch July 1, 2026 16:48
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