fix: initialize installer manifest helper before codex install#82
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes an installer execution-order bug where the --codex path could call add_manifest_entry before it was defined, particularly in global/plugin installs, and ensures the target directory exists before manifest operations.
Changes:
- Initialize the installer manifest (and
add_manifest_entryhelper) immediately afterTARGET_DIRis determined. - Ensure fresh installs create
$TARGET_DIRbefore touching the manifest. - Remove the now-redundant manifest/helper definition from the later file-copy branch.
| # including global/plugin installs that bypass the Claude file-copy branch. | ||
| mkdir -p "$TARGET_DIR" | ||
| MANIFEST_FILE="$TARGET_DIR/.a11y-agent-manifest" | ||
| touch "$MANIFEST_FILE" |
There was a problem hiding this comment.
Creating/touching the manifest unconditionally here changes later control flow: cleanup_old_install() (used during global plugin installs) currently runs whenever ~/.claude/.a11y-agent-manifest exists, so this new touch makes it run (and delete the manifest) even on fresh plugin installs, showing a misleading cleanup message. Consider making cleanup_old_install require a non-empty/valid manifest (e.g., -s or pattern check) or making add_manifest_entry create/touch the manifest lazily so the presence check still reflects a previous non-plugin install.
| touch "$MANIFEST_FILE" |
| add_manifest_entry() { | ||
| local entry="$1" | ||
| grep -qxF "$entry" "$MANIFEST_FILE" 2>/dev/null || echo "$entry" >> "$MANIFEST_FILE" | ||
| } |
There was a problem hiding this comment.
Now that add_manifest_entry is defined globally, any later checks that use “function exists” as a proxy for “file-copy install happened” will always pass. In particular, the install-scope recording near the end of the script will now always write to the manifest (including plugin-only installs), which seems to contradict its comment and prior behavior. Suggest switching that guard to an explicit state flag (e.g., PLUGIN_INSTALL / FILE_COPY_INSTALL) or checking for expected manifest entries instead of testing for the function.
Summary
install.sh --global --codexcould fail withadd_manifest_entry: command not foundRoot cause
The Codex install path called
add_manifest_entry, but that helper was defined later inside the Claude file-copy branch. On global/plugin installs, that branch was skipped, so the function never existed when Codex tried to use it.Moving the helper earlier exposed a second issue on fresh global installs: the target directory needed to be created before the manifest file could be touched.
Verification
I verified the relevant installer paths against this branch non-interactively:
bash install.sh --globalbash install.sh --projectbash install.sh --global --codexbash install.sh --project --codexbash install.sh --global --geminibash install.sh --project --geminibash install.sh --global --clibash install.sh --project --cliAll eight completed with exit status 0.
For the Codex paths, I also verified that the install produced:
.codex/AGENTS.md.codex/config.toml.codex/roles/with all role filesScope
Tight fix to installer execution order and target-dir initialization only. No unrelated cleanup.