feat(cc-201): detect_executor_profile() shim — dedupe codex profile detection#123
Merged
Merged
Conversation
…etection Extract the duplicated `command -v codex` executor-profile detection into shared functions in scripts/lib/portable.sh and update all production consumers. v0.3.0 milestone M0 (reuse debt CC-201). Behavior-preserving. - portable.sh: add codex_available() + detect_executor_profile() - install-hooks.sh: PROFILE="$(detect_executor_profile)" - doctor.sh: check_codex() + hook-profile case branch use codex_available() - pr-gate.sh: source portable.sh behind a graceful guard — pr-gate.sh is copied standalone by its test harness (and copy-mode install), so the source falls back to an inline codex_available() when the sibling lib/ is absent (mirrors doctor.sh's pattern); auto-detect uses codex_available() - test-portable.sh: +4 regression cases test-portable 32/0, test-pr-gate 41/0, test-install 57/0, lint-scripts OK. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Gate NO-GO (gate-20260523-003335): doctor.sh's copy-mode else-branch defined a fallback detect_platform() but not codex_available(), so check_codex() and the hook-profile case branch would hit an undefined function when lib/portable.sh is absent (copy-mode install). - doctor.sh: define a matching codex_available() fallback in the no-portable.sh else-branch (copy-mode parity) - test-doctor.sh: +case_doctor_copy_mode_no_lib_no_codex — copy-mode + codex absent from PATH, asserts graceful behavior (no crash) test-doctor 33/0, lint-scripts OK. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
v0.3.0 milestone M0 — first ticket of the architecture restructure (epic CC-211). Extracts the duplicated
command -v codexexecutor-profile detection into shared functions; behavior-preserving reuse extraction (CC-201).scripts/lib/portable.sh— newcodex_available()+detect_executor_profile()scripts/install-hooks.sh—PROFILE="$(detect_executor_profile)"scripts/doctor.sh—check_codex()+ hook-profile case branch usecodex_available(); copy-modeelse-branch gains a matching fallbackscripts/pr-gate.sh— sourcesportable.shbehind a graceful guard (pr-gate.sh is copied standalone by its test harness / copy-mode install), with an inlinecodex_available()fallbackscripts/test-portable.sh— +4 cases;scripts/test-doctor.sh— +1 copy-mode/no-codex regression caseAudit (proactive sweep)
All production
command -v codexprofile-detection sites consolidated:pr-gate.sh,install-hooks.sh,doctor.sh×2. Deliberately left:run-all-tests.sh:127(test-runner skip check, not an install/dispatch path), comment lines, andtest-install.sh:657(fixture).Gate
Codex implemented; main-thread spot-check caught a regression (hard
sourcebroke pr-gate.sh's standalone-copy test path — fixed with the doctor.sh-style graceful guard). PR-gate standard tier round 1NO-GO(critic+qa block — doctor.sh copy-mode lacked acodex_availablefallback); fixed; targeted re-gate round 2Final: GO(critic, qa-tester, architecture-reviewer all approve).test-portable32/0,test-pr-gate41/0,test-install57/0,test-doctor33/0,lint-scriptsOK.Closes CC-201.
🤖 Generated with Claude Code