get2knowio / get2knowio/devcontainer-features

ai-clis: specifyCli's uv-managed Python is undiscoverable, so Spec Kit's agent-context hook always skips

Offen
#77 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Shell
Sterne
0
Forks
0
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

## Summary

`ai-clis` installs Specify CLI with `uv tool install` (`src/ai-clis/install.sh:148`), which places it in an isolated uv venv. Spec Kit's bundled `agent-context` extension then can't find a Python that can `import yaml`, so the hook silently no-ops in every container this feature builds.

## Root cause

Spec Kit's own docs (`.specify/extensions/agent-context/README.md`) state the assumption:

> PyYAML ships with the `specify` CLI and is normally available via the same `python3` interpreter.

That holds when `specify` is pip-installed into the system Python. It does **not** hold for `uv tool install`, which creates an isolated venv — PyYAML lands where the system `python3` can never see it.

The hook script (`.specify/extensions/agent-context/scripts/bash/update-agent-context.sh`) probes `$SPECKIT_PYTHON`, then `python3`, then `python`, requiring `import yaml` to succeed. None match, so it prints `Python 3 with PyYAML not found on PATH; skipping update` and exits 0. Because it exits 0, nothing surfaces as a failure — `CLAUDE.md` / agent context files just never get refreshed after `/speckit-specify` or `/speckit-plan`.

## Adding a Python feature dependency does not fix this

Worth stating up front, since it's the intuitive fix. A container built from `node-agentic` plus `ghcr.io/devcontainers/features/python:1` **and** `get2knowio/devcontainer-features/python-tools`:

```console
$ command -v python3
/usr/local/python/current/bin/python3
$ python3 -c "import yaml"
ModuleNotFoundError: No module named 'yaml'
```

The uv venv is isolated regardless of what else is installed. A `dependsOn`/`installsAfter` on a Python feature adds build time and changes nothing. The interpreter isn't missing — uv already provides one with PyYAML 6.0.3 in it. It's just not discoverable.

## Suggested fix

Two pieces in `src/ai-clis`:

**1. Wrapper script**, written by `install.sh` inside the `if [ "${SPECIFYCLI}" = "true" ]` block, after `uv tool install` succeeds:

```sh
# Expose the uv-managed interpreter (which has PyYAML) under a fixed path so
# Spec Kit's agent-context hook can find it. Must be an exec wrapper, NOT a
# symlink -- see below.
cat > /usr/local/bin/speckit-python <

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit src/ai-clis/install.sh:148 und dem specifyCli-Installationsblock, und prüfen Sie anschließend die devcontainer-feature.json des Features. Fügen Sie den im Issue beschriebenen festen SPECKIT_PYTHON-Umgebungspfad und Wrapper hinzu, wobei der von uv verwaltete Interpreter erhalten bleibt. Überprüfen Sie dies, indem Sie .specify/extensions/agent-context/scripts/bash/update-agent-context.sh ausführen und bestätigen, dass der Agent-Kontext aktualisiert wird, wenn specifyCli aktiviert ist, und sauber übersprungen wird, wenn es weggelassen wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python, shell
Bereich
devops, tooling
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Ruhig
Klarheit
Klar beschrieben
Anfängerfreundlichkeit
76/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.