mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-18 18:04:17 +00:00
* feat(pi): edit extensions on any Pi at or above the verified minimum Pi 1.0.1 was released and every user who updated found the Extensions tab read-only, because the gate matched an exact list of versions. The package contract has not changed between patch releases, so the gate now accepts any plain X.Y.Z at or above PiMinVersion (0.99.2), the oldest version with executed evidence. Older, prerelease or unparsable versions stay read-only. The version matrix now also records Pi 1.0.1, which passes every check. The evidence test requires PiMinVersion to be recorded and every recorded version to pass, instead of matching an exact list. The read-only reason is renamed to unsupportedVersion and the API returns minVersion, so the dashboard says which version is needed. The Pi MCP project switch keeps writing the global command or url: from 1.0.1 Pi accepts a switch-only entry, but it is skipped by older Pi and warns at every start where the global config lacks the server. Its rationale in comments and docs is updated to say so. * fix(docs): update Pi extensions design records for the minimum gate Codex review on #367: the design records still described the exact version list (PiVerifiedVersions, unverifiedVersion, "exact versions only"), so a contributor relying on them would implement or validate the old contract. implementation-report.md now states the current gate and evidence, and phase-0.md gains a dated minimum-version update that the older paragraphs point to, keeping the history intact.
65 lines
3.4 KiB
Bash
Executable File
65 lines
3.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Runs the Pi package contract against exact, pinned Pi versions and records what
|
|
# ran in scripts/pi/version-evidence.json, which must include PiMinVersion.
|
|
#
|
|
# Run inside the devcontainer only, from the repository root:
|
|
# scripts/pi/version-matrix.sh 0.99.2 1.0.0 1.0.1
|
|
#
|
|
# Each version is installed with npm into $PI_VERSIONS_DIR/<version> (default
|
|
# /tmp/pi-versions), with its own lockfile and npm cache and without install
|
|
# scripts. Nothing global is installed and no extension is ever imported: the
|
|
# contract only resolves paths, and its fixture extensions throw if loaded.
|
|
# Per version it runs the contract against dist/core and against the bundle the
|
|
# pi CLI executes, the Go test that holds Skillshare's lock against Pi's, and the
|
|
# Go test that has Pi resolve project settings this editor wrote.
|
|
set -euo pipefail
|
|
|
|
PACKAGE=@earendil-works/pi-coding-agent
|
|
VERSIONS_DIR=${PI_VERSIONS_DIR:-/tmp/pi-versions}
|
|
EVIDENCE=scripts/pi/version-evidence.json
|
|
[ $# -gt 0 ] || { echo "usage: $0 <version>..." >&2; exit 2; }
|
|
[ -f scripts/pi/phase0-contract.mjs ] || { echo "run from the repository root" >&2; exit 2; }
|
|
|
|
results=()
|
|
for version in "$@"; do
|
|
[[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "not an exact version: $version" >&2; exit 2; }
|
|
dir=$VERSIONS_DIR/$version
|
|
root=$dir/node_modules/$PACKAGE
|
|
if [ ! -f "$root/package.json" ]; then
|
|
mkdir -p "$dir"
|
|
[ -f "$dir/package.json" ] || printf '{"name":"pi-version-%s","private":true}\n' "$version" >"$dir/package.json"
|
|
npm install --prefix "$dir" --cache "$VERSIONS_DIR/.npm-cache" --ignore-scripts --no-audit --no-fund --save-exact "$PACKAGE@$version" >/dev/null
|
|
fi
|
|
installed=$(node -p "require('$root/package.json').version")
|
|
[ "$installed" = "$version" ] || { echo "$dir holds Pi $installed, not $version" >&2; exit 1; }
|
|
integrity=$(node -p "require('$dir/package-lock.json').packages['node_modules/$PACKAGE'].integrity")
|
|
|
|
checks=()
|
|
for entry in core bundle; do
|
|
out=$(PI_ENTRY=$entry PI_ROOT=$root node scripts/pi/phase0-contract.mjs 2>&1) && status=0 || status=$?
|
|
summary=$(printf '%s\n' "$out" | tail -1)
|
|
echo "pi $version contract/$entry: exit $status, $summary"
|
|
checks+=("{\"name\":\"contract/$entry\",\"exit\":$status,\"summary\":$(node -p 'JSON.stringify(process.argv[1])' "$summary")}")
|
|
done
|
|
for check in native-lock:TestPiNativeLockHoldsAgainstPi project-native:TestPiProjectOverridesResolveInPi; do
|
|
name=${check%%:*} test=${check#*:}
|
|
out=$(PI_ROOT=$root go test ./internal/plugin -run "^$test\$" -count=1 -v 2>&1) && status=0 || status=$?
|
|
# A skip (no PI_ROOT seen) is not a pass.
|
|
if ! printf '%s\n' "$out" | grep -q -- "--- PASS: $test" && [ "$status" -eq 0 ]; then status=1; fi
|
|
echo "pi $version $name: exit $status"
|
|
checks+=("{\"name\":\"$name\",\"exit\":$status}")
|
|
done
|
|
|
|
passed=true
|
|
for c in "${checks[@]}"; do [[ $c == *'"exit":0'* ]] || passed=false; done
|
|
results+=("{\"version\":\"$version\",\"integrity\":\"$integrity\",\"passed\":$passed,\"checks\":[$(IFS=,; echo "${checks[*]}")]}")
|
|
done
|
|
|
|
node -e '
|
|
const [file, node, date, ...results] = process.argv.slice(1);
|
|
const doc = { package: "@earendil-works/pi-coding-agent", node, date, versions: results.map((r) => JSON.parse(r)) };
|
|
require("fs").writeFileSync(file, JSON.stringify(doc, null, 2) + "\n");
|
|
' "$EVIDENCE" "$(node --version)" "$(date -u +%Y-%m-%d)" "${results[@]}"
|
|
echo "wrote $EVIDENCE"
|
|
for r in "${results[@]}"; do [[ $r == *'"passed":true'* ]] || exit 1; done
|