Files
magpie/internal
yetone 4794de398e library: a skill installs from a repository too big to download whole, by fetching only its skills' folders (#1941, Goalonez)
What changed: fetch still downloads a repository as one codeload
tarball first. When its files pass the 200 MB limit (untar's errTooBig),
it now falls back to fetchSkillFiles: one request to GitHub's API for
the repository's file list (git/trees?recursive=1), then every file in
a folder with a SKILL.md, from raw.githubusercontent.com, each checked
against the git hash the list gives. The repository's folders are made
empty, so candidates, origin, a probe of a subfolder and an update check
read the result as they read a whole download. The 200 MB limit now
applies to what is actually fetched: skills that are themselves over it
still say so. A private repository's files come from the API's
git/blobs with the Settings token (it never goes to raw). A repository
found too big is remembered for the run, so the install after its probe,
and update checks, don't download 150 MB again before falling back.
gitTree's entries gained mode, sha and size (named gitEntry).

Why: vectorize-io/hindsight keeps its skills (a few hundred KB) beside
an app; its tarball is 188 MB gzipped, 253 MB unpacked, so any skill
in it failed with "the repository is too big to install skills from".

What was run:
- Real repo, sandbox HOME, no token: on the old code ProbeSkills
  ("https://github.com/vectorize-io/hindsight") fails with "too big"
  after 34s. With the fix it lists all 15 skills (skills/*, the
  integrations' skills; .claude/skills hidden as before) in 32s, and
  installing skills/hindsight-docs writes its 160 files, the same count
  GitHub's tree lists.
- New TestSkillsFromATooBigRepository and
  TestTooBigRepositoryChecksWhatArrives (httptest stand-ins for codeload,
  the API and raw, laid out as hindsight is, paths and tree entries
  from its real listing). With the fallback taken out both fail with
  "the repository is too big to install skills from (over 200 MB)".
  They check raw is never asked for a file outside a skill, codeload
  is asked once across two probes, a file that doesn't match its hash
  is refused, and skills over the limit themselves still error.
- go test -tags nogui ./internal/library (ok, 141s); -race -count=10
  -run TooBig (ok); gofmt -l clean; go vet, GOOS=linux and
  GOOS=windows go vet -tags nogui ./internal/library clean.
Not tried: a private repository over the limit against real GitHub
(covered only by reading: raw 404 -> git/blobs with the token).
2026-10-13 14:53:42 +08:00
..
…
…