Skip to content

fix(plugin): fall back to pip/uv-installed skillopt-sleep in run-sleep.sh#107

Open
ichoosetoaccept wants to merge 1 commit into
microsoft:mainfrom
ichoosetoaccept:fix/plugin-pip-fallback
Open

fix(plugin): fall back to pip/uv-installed skillopt-sleep in run-sleep.sh#107
ichoosetoaccept wants to merge 1 commit into
microsoft:mainfrom
ichoosetoaccept:fix/plugin-pip-fallback

Conversation

@ichoosetoaccept

Copy link
Copy Markdown

Summary

The Claude Code and Codex plugin shells' runner (run-sleep.sh) only resolved the engine by searching for a skillopt_sleep/ source directory on disk. After v0.2.0 shipped the engine on PyPI (skillopt-sleep CLI), the plugins still errored for users who installed via pip/uv without cloning the repo — even though the error message said "pip install skillopt" would work.

This adds two fallbacks before the error:

  1. skillopt-sleep CLI on PATH (covers uv tool install, pipx, pip install) — checked first because uv tool install / pipx isolate the package from the system Python's import path, so the import check would fail even though the CLI is available.
  2. python -m skillopt_sleep when importable (covers pip install into the active Python)

The existing source-checkout resolution path is unchanged — repo-clone users keep working as before. The fix lands in both plugins/run-sleep.sh (shared, used by Codex) and plugins/claude-code/scripts/run-sleep.sh (bundled copy, byte-identical, used by the Claude Code marketplace install which fetches only the plugins/claude-code/ subtree).

After this fix, the install path is:

  • uv tool install skillopt (or pip install skillopt) — self-updating engine
  • /plugin marketplace add + /plugin install — self-updating plugin shell
  • No repo clone, no SKILLOPT_SLEEP_REPO, no manual git pull.

Closes #106.

Test plan

  • tests/test_run_sleep_fallback.py — 6 new tests covering source-checkout path, CLI fallback (both shared and bundled copies), arg passthrough, no-engine error message, and bundled/shared sync check
  • shellcheck passes on both modified scripts
  • Source-checkout path verified: bash plugins/run-sleep.sh --help from repo root works
  • CLI fallback verified: uv tool install skillopt, then run from /tmp with no source dir — engine runs via skillopt-sleep on PATH
  • No-engine error verified: run from temp dir with empty PATH — new error message mentions all three install options
  • Full test suite passes (8 pre-existing import errors from missing pytest/openai optional deps, unrelated to this change)

…p.sh

The Claude Code and Codex plugin shells' runner (run-sleep.sh) only
resolved the engine by searching for a skillopt_sleep/ source directory
on disk. After v0.2.0 shipped the engine on PyPI (skillopt-sleep CLI),
the plugins still errored for users who installed via pip/uv without
cloning the repo — even though the error message said "pip install
skillopt" would work.

Add two fallbacks before the error:
  1. skillopt-sleep CLI on PATH (covers uv tool install, pipx, pip install)
  2. python -m skillopt_sleep when importable (covers pip install into
     the active Python)

Fallback 1 is checked before fallback 2 because uv tool install / pipx
isolate the package from the system Python's import path, so the import
check would fail even though the CLI is available.

The existing source-checkout resolution path is unchanged — repo-clone
users keep working as before. The fix lands in both plugins/run-sleep.sh
(shared, used by Codex) and plugins/claude-code/scripts/run-sleep.sh
(bundled copy, byte-identical, used by the Claude Code marketplace
install which fetches only the plugins/claude-code/ subtree).
@ichoosetoaccept

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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.

Make the Claude Code plugin self-contained: fall back to pip/uv-installed skillopt so no repo clone is needed

1 participant