Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion skills/km/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ Read `CONVENTIONS.md` in the repo root. If missing, offer to initialize (`/km in
below; `km --help` lists the commands, and all take `--root DIR`. Brains carry no km code: CI and
the pre-commit hook install the km release the brain pins, by its commit (`pasrom/km@<sha> # vX.Y.Z`,
so a moved tag cannot change what runs), and so does `km` here: in a brain that pins another version
it runs that commit through `uvx`, so results match CI (`KM_LOCAL=1` keeps the plugin's). Without uv,
it runs that commit through `uvx`, so results match CI (`KM_LOCAL=1` keeps the plugin's; `init`,
`upgrade`, `doctor`, `list` and `sync` always run the plugin's km, so `km upgrade` needs no `KM_LOCAL`). Without uv,
offline, for a pin to a movable tag, or when the workflows disagree, it runs the plugin's km and warns;
`/km upgrade` the brain then.

Expand Down
3 changes: 2 additions & 1 deletion src/km/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
When this km is another version, a brain command runs the commit CI runs instead (through uvx), so
local results match CI; `KM_LOCAL=1` keeps this km. When that is not possible (no uv, offline, a
movable tag instead of a commit, workflows that disagree) it runs this km and says so. A hook pinned
apart from CI gets a note.
apart from CI gets a note. `init`, `upgrade`, `doctor`, `list` and `sync` (NO_PIN_CHECK) always run
this km: they write the pins, check the km that runs, only read, or act on the clone.
"""
from __future__ import annotations

Expand Down
6 changes: 6 additions & 0 deletions tests/team_smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@ rm -f "$F/runner-args"; out="$(KM_PINNED_RUNNER="$F/fake-uvx" km repin --root "$
rm -f "$F/runner-args"; out="$(KM_PINNED_RUNNER="$F/fake-uvx" km repin --root "$O" --cites any.md --dir . 2>&1)"; rc=$?
{ [ "$rc" = 2 ] && echo "$out" | grep -q "needs km v1.8.0, the brain pins v0.9.0" && [ ! -e "$F/runner-args" ]; } \
&& ok "an option the pinned km lacks says to upgrade" || no "option newer than the pin ($rc: $out)"
for c in init upgrade doctor list sync; do # NO_PIN_CHECK in cli.py: they run the km that was started
rm -f "$F/runner-args"; out="$(KM_PINNED_RUNNER="$F/fake-uvx" km "$c" --root "$O" --help 2>&1)"; rc=$?
{ [ "$rc" = 0 ] && [ ! -e "$F/runner-args" ] && ! echo "$out" | grep -q "running that one"; } \
&& ok "km $c runs this km, not the older one the brain pins" \
|| no "km $c with an older pin ($rc: $(cat "$F/runner-args" 2>/dev/null) $out)"
done
repin "$V09_SHA" v0.9.0 "$S99" v99.0.0 "$O"/.github/workflows/*.yml "$O/.pre-commit-config.yaml"
rm -f "$F/runner-args"; KM_LOCAL=1 KM_PINNED_RUNNER="$F/fake-uvx" km validate --root "$O" >/dev/null 2>&1
[ ! -e "$F/runner-args" ] && ok "KM_LOCAL=1 keeps this km" || no "KM_LOCAL=1 keeps this km"
Expand Down
Loading