Fix async hooks for Codex - #14
Conversation
Copy shared common helpers into each plugin package so installed hooks do not depend on repo-local symlinks. Route XcodeBuildTools background hook work through a command wrapper instead of host-level async metadata, and add sync/check coverage.
- Replace legacy command prompts with SKILL.md files - Register migrated skills and bump plugin release metadata - Update docs and integrity checks for the skill-based plugin surface
- Preserve the host hook owner PID for backgrounded sandbox setup - Release self-contained common helper copies for affected plugins
| from pathlib import Path | ||
|
|
||
|
|
||
| GENERATED_MESSAGE = ( |
There was a problem hiding this comment.
These generated headers are intentional. Installed plugin packages need to be self-contained, so the copied common helpers are committed with a clear source pointer and scripts/sync-plugin-common.py --check verifies they stay in sync with root common.
|
|
||
| plugin_root="${CLAUDE_PLUGIN_ROOT:-$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)}" | ||
| target="$plugin_root/$relative_target" | ||
| hook_owner_pid="${CLAUDE_HOOK_OWNER_PID:-$PPID}" |
There was a problem hiding this comment.
This captures the hook runner parent before the helper is backgrounded. The sandbox setup uses this as the long-lived session owner; using the background child’s $PPID would point at this wrapper and make /clear inheritance lose the prior sandbox once the wrapper exits.
| { | ||
| "name": "MarvinOutputStyle", | ||
| "version": "1.3.2", | ||
| "version": "1.3.3", |
There was a problem hiding this comment.
MarvinOutputStyle, iOSSimulator, and PluginBase get patch bumps because their package contents changed from symlinked common directories to generated committed copies. SwiftScaffolding and XcodeBuildTools already had branch-local bumps, so the common-copy note is folded into those existing release entries instead of bumping them twice.
There was a problem hiding this comment.
Pull request overview
This PR updates the plugin marketplace packages to be self-contained (no repo-root symlinks), keeps XcodeBuildTools SessionStart helpers compatible with hosts that don’t support async hooks (e.g., Codex) via a background wrapper, and migrates legacy slash-command prompts into skills with corresponding metadata/version bumps.
Changes:
- Add new Swift review skills (
swift-code-analysis,swiftui-modernize) and migrate legacy command prompts to skills. - Replace
async: trueSessionStart hooks in XcodeBuildTools with arun-background.shwrapper that backgrounds helpers while preserving sandbox ownership across/clear. - Generate and commit per-plugin
common/helper copies (and addscripts/sync-plugin-common.py+ tests) so installed plugin packages don’t depend on symlinks escaping the plugin directory.
Reviewed changes
Copilot reviewed 65 out of 65 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| XcodeBuildTools/skills/swiftui-modernize/SKILL.md | Adds SwiftUI modernization skill definition. |
| XcodeBuildTools/skills/swift-code-analysis/SKILL.md | Adds Swift code analysis skill definition. |
| XcodeBuildTools/README.md | Documents new skills and updated SessionStart hook behavior; adds 0.5.10 changelog. |
| XcodeBuildTools/info.json | Registers new skills and adds 0.5.10 release notes. |
| XcodeBuildTools/hooks/write-env.sh | Updates comments to reflect background wrapper usage. |
| XcodeBuildTools/hooks/setup-sandbox.sh | Preserves sandbox ownership across /clear using a passed hook-owner PID. |
| XcodeBuildTools/hooks/run-background.sh | New wrapper to background helpers without host async support. |
| XcodeBuildTools/hooks/lib/sandbox.sh | Updates comments to reflect backgrounded setup hook. |
| XcodeBuildTools/hooks/hooks.json | Replaces async: true with run-background.sh commands. |
| XcodeBuildTools/hooks/approve-xcode-mcp.sh | Updates documentation comment for background wrapper execution. |
| XcodeBuildTools/common/version_tracker.py | Adds generated, self-contained copy of shared common helper. |
| XcodeBuildTools/common/session-start.py | Adds generated, self-contained copy of shared common helper. |
| XcodeBuildTools/common/pre-tool-use.py | Adds generated, self-contained copy of shared common helper. |
| XcodeBuildTools/common/hooks.json | Adds generated, self-contained copy of shared common helper config. |
| XcodeBuildTools/common/detect_xcode_mcp.py | Adds generated, self-contained copy of shared common helper. |
| XcodeBuildTools/commands/swiftui-modernize.md | Removes legacy slash command prompt (migrated to skill). |
| XcodeBuildTools/commands/analyze.md | Removes legacy slash command prompt (migrated to skill). |
| XcodeBuildTools/.claude-plugin/plugin.json | Bumps XcodeBuildTools to 0.5.10. |
| tests/test_repository_integrity.py | Adds checks for self-contained packages, synced common copies, and no async keys in hooks. |
| tests/test_hooks.py | Adds unit test for run-background.sh PID preservation behavior. |
| SwiftScaffolding/skills/scaffolding/SKILL.md | Adds scaffolding skill (migrated from legacy command prompt). |
| SwiftScaffolding/README.md | Updates usage docs and adds 0.4.3 changelog. |
| SwiftScaffolding/info.json | Registers scaffolding skill and adds 0.4.3 release notes. |
| SwiftScaffolding/common/version_tracker.py | Adds generated, self-contained copy of shared common helper. |
| SwiftScaffolding/common/session-start.py | Adds generated, self-contained copy of shared common helper. |
| SwiftScaffolding/common/pre-tool-use.py | Adds generated, self-contained copy of shared common helper. |
| SwiftScaffolding/common/hooks.json | Adds generated, self-contained copy of shared common helper config. |
| SwiftScaffolding/common/detect_xcode_mcp.py | Adds generated, self-contained copy of shared common helper. |
| SwiftScaffolding/commands/scaffolding.md | Removes legacy slash command prompt (migrated to skill). |
| SwiftScaffolding/.claude-plugin/plugin.json | Bumps SwiftScaffolding to 0.4.3. |
| scripts/sync-plugin-common.py | New script to generate per-plugin common/ copies from root common/. |
| README.md | Updates marketplace docs to emphasize skills/hooks and new update workflow. |
| PluginBase/info.json | Adds 0.2.12 release notes. |
| PluginBase/common/version_tracker.py | Adds generated, self-contained copy of shared common helper. |
| PluginBase/common/session-start.py | Adds generated, self-contained copy of shared common helper. |
| PluginBase/common/pre-tool-use.py | Adds generated, self-contained copy of shared common helper. |
| PluginBase/common/hooks.json | Adds generated, self-contained copy of shared common helper config. |
| PluginBase/common/detect_xcode_mcp.py | Adds generated, self-contained copy of shared common helper. |
| PluginBase/.claude-plugin/plugin.json | Bumps PluginBase to 0.2.12. |
| MarvinOutputStyle/README.md | Adds 1.3.3 changelog. |
| MarvinOutputStyle/info.json | Adds 1.3.3 release notes. |
| MarvinOutputStyle/common/version_tracker.py | Adds generated, self-contained copy of shared common helper. |
| MarvinOutputStyle/common/session-start.py | Adds generated, self-contained copy of shared common helper. |
| MarvinOutputStyle/common/pre-tool-use.py | Adds generated, self-contained copy of shared common helper. |
| MarvinOutputStyle/common/hooks.json | Adds generated, self-contained copy of shared common helper config. |
| MarvinOutputStyle/common/detect_xcode_mcp.py | Adds generated, self-contained copy of shared common helper. |
| MarvinOutputStyle/.claude-plugin/plugin.json | Bumps MarvinOutputStyle to 1.3.3. |
| iOSSimulator/README.md | Adds 0.6.5 changelog. |
| iOSSimulator/info.json | Adds 0.6.5 release notes. |
| iOSSimulator/common/version_tracker.py | Adds generated, self-contained copy of shared common helper. |
| iOSSimulator/common/session-start.py | Adds generated, self-contained copy of shared common helper. |
| iOSSimulator/common/pre-tool-use.py | Adds generated, self-contained copy of shared common helper. |
| iOSSimulator/common/hooks.json | Adds generated, self-contained copy of shared common helper config. |
| iOSSimulator/common/detect_xcode_mcp.py | Adds generated, self-contained copy of shared common helper. |
| iOSSimulator/.claude-plugin/plugin.json | Bumps iOSSimulator to 0.6.5. |
| CLAUDE.md | Updates repo architecture/docs to prefer skills over commands; adds common-sync workflow. |
| AGENTS.md | Updates guidance to be skill-focused and host-portable. |
| .claude/skills/update-plugin/SKILL.md | Adds update-plugin skill to replace legacy update command prompt. |
| .claude/commands/update-plugin.md | Removes legacy update-plugin command prompt. |
| .claude-plugin/marketplace.json | Bumps marketplace versions for affected plugins. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fall back to the wrapper parent when an inherited hook owner PID is malformed.
Summary