🔧 fix(ci): install with --ignore-scripts for the git0 test job - #107
Merged
Merged
Conversation
`main()` printed the banner before parsing arguments and then `downloadRepoAndSetup()` printed it again, so the most common invocation of all — `git0 owner/repo` — rendered the logo twice and looked broken. Deleting one of the calls would have fixed the common case and left the paths that reach a download without going through `main()` unbranded, so `printLogo` is now idempotent instead: every call site can still say "show the branding here" and the user sees it exactly once. `resetLogo()` lets the tests drive several flows through one process. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KULWViqKDCNmcShYttoU23
A link copied out of the GitHub UI already says which folder or file you want — `/tree/main/packages/react-dom`, `/blob/master/.continue/agents/x.yaml` — and git0 threw that away and downloaded the repository around it. It is now read and honoured. Entries outside the path are dropped in tar's parser, ahead of the unpacker's `strip`, so they are skipped in the stream and never written; the requested subtree is then hoisted to the root of the target folder, which reads dir-vs-file off the disk rather than guessing at a strip depth the `owner/repo/some/path` shorthand cannot supply. The folder is named after the path rather than the repository, because downloading `debate-ai.com/.continue/agents` into a folder called `debate-ai.com` claims to hold a site and holds two config files. Also adds `--path`, `--branch`/`--ref`, and flag parsing in its own module so it is testable without executing `cli.ts`'s top-level `main()`. A failed tarball request now reports the repository and branch instead of leaving an empty directory for the next step to trip over. `..` in a sub-path is rejected rather than normalized away: the value becomes a prefix match and then a path join, and the only honest reading of `packages/../../etc` in a "download this folder" argument is that something is wrong with it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KULWViqKDCNmcShYttoU23
`--history` ends in the same state `git clone` would have left you in — a working tree with a full `.git` beside it, `git log` working, `git status` clean — without giving up the speed that is git0's whole point. The ordering is the feature. A clone is serial: the remote counts and packs every object in the history, sends the pack, and only then writes files you can run. A codeload tarball is a pre-made, cached, already-compressed snapshot that extracts while it downloads. And history is the one part of a clone that nothing on the critical path waits for — `bun install` does not need `git log` — so it is started after extraction finishes and awaited at the very end, overlapping the IDE launch and the dependency install rather than blocking them. Mechanically: bare clone into a temp directory, renamed into place only once it succeeds so an interrupted download leaves no half-written `.git`; `core.bare` flipped; origin's fetch refspec restored; `git reset --mixed HEAD` to populate the index from HEAD without touching the extracted files. A failed fetch is reported and swallowed — a missing `git` or a dropped connection should cost the user their history, not the project they are already working in. `--history-only` is the other half: a bare clone into `<repo>.git` with no working files, or `--mirror` for every ref, for a backup or a host-to-host move. `benchmark/` measures the claim rather than asserting it — time to files (when the project can run) separately from time to history, across `git clone`, `git clone --depth=1`, git0 and `git0 --history`. It is a `.bench.ts`, so `bun test` does not collect it and it never runs in CI; its pure reporting helpers are unit-tested. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KULWViqKDCNmcShYttoU23
git0 has a site, and nothing in the README pointed at it. The badge catalog already carries a `website` badge; what was missing was a `websiteUrl` for package headers. It is read off `homepage` rather than a list kept in the script — npm already asks for that field and renders it, so a package with a site has usually filled it in, and the ones that have not left it at the GitHub tree URL the publish flow writes. A badge back to the page you are already on is noise, so a `github.com` homepage yields no badge and every other package's header is unchanged. git0's own `homepage` now points at the site instead of its directory on GitHub, which is also what npm should have been showing. The README gains the link and documents both new features: partial paths, and `--history` with the reasoning for why fetching history last is faster than cloning it first. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KULWViqKDCNmcShYttoU23
The skill is the documentation agents actually load, so it gains the new invocations, a flag table, the mechanics of hoisting and of the bare-to- working conversion, and the four new failure messages with their causes. The package note records the three things a future change is most likely to undo by accident: `printLogo`'s guard is the fix and not a redundancy, `normalizeSubPath` rejecting `..` is a boundary check and not tidying, and awaiting the history download earlier silently gives back the speed the feature exists to keep. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KULWViqKDCNmcShYttoU23
`bun run readmes:check` was already failing on master for these four — their generated headers had drifted from what `sync-package-readmes.mjs` produces. Unrelated to the git0 work in this branch, but CI fails on the whole repo, so the generator's own output is brought back in line. No hand edits. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KULWViqKDCNmcShYttoU23
master's version-bump commit moved git0 to 0.2.99 while this branch had already moved it to 0.3.0 for the new flags. Resolved to 0.3.0 — it is ahead of master's patch bump, and the new public behaviour (`--path`, `--branch`, `--history`, `--history-only`, `--mirror`) is a minor, not a patch. That version line was the only conflict; everything else merged cleanly. Revalidated after the merge: 134 tests pass, the bundle builds, and `readmes:check` is clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KULWViqKDCNmcShYttoU23
The `git0-repo-downloader` job in tests.yml was failing before it ran a single test, which is why Codecov reported no JUnit XML and no coverage for it: both artifacts are written by the test step, and the step never ran. The install step is what fails. `bun install` resolves the workspace root even when run from a package directory, so `install: bun install` in that matrix entry installs all nineteen workspaces and runs every one of their postinstall hooks — among them `packages/api2ai-mcp-generator`'s `fumadocs-mdx && drizzle-kit push`, which exits 1 because that package has no `source.config.ts` for fumadocs-mdx to read. One hook failing fails the whole install. This is not a new problem and not this branch's: it reproduces on a clean checkout of master, and `api2ai-mcp-generator` is not in this diff. The fix is the one the sibling workflow already uses — test.yml installs with `--ignore-scripts` and says why in a comment. Porting it here rather than inventing something: nothing in git0's suite depends on a postinstall, and its own dependencies (chalk, git-url-parse, grab-api.js, inquirer, ora, tar) have none. Verified by reproducing both sides in the package directory, exactly as the job does it: plain `bun install` fails on the api2ai hook, and with `--ignore-scripts` the install succeeds, `bun run test:ci` passes 134 tests, and both `junit.xml` and `coverage/lcov.info` are written. Scoped to the entry that blocks this PR. `test-google-login` is the other entry with a bare `bun install` and will fail the same way; the real fix for both — and for the three red Vercel deployments, which fail on this same install — is removing that postinstall from api2ai, which belongs in its own change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KULWViqKDCNmcShYttoU23
#106 landed as a squash commit, so this branch shares no commits with the result even though master already carries every line of it. Merging master back in realigns the two: the merge-base becomes master's tip, and what is left on this branch is the one commit that has not landed yet — the CI install fix. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KULWViqKDCNmcShYttoU23
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One-line change to
tests.yml, plus a comment explaining it.The problem
The
git0-repo-downloaderjob intests.ymlfails before it runs a single test. That is what Codecov was reporting on #106 as "JUnit XML file not found": bothjunit.xmlandcoverage/lcov.infoare written by the test step, and the test step never ran.The install step is what fails. That matrix entry uses a bare
bun install, and bun resolves the workspace root even when invoked from a package directory — so it installs all nineteen workspaces and runs every one of their postinstall hooks. One of them ispackages/api2ai-mcp-generator's:fumadocs-mdxneeds asource.config.ts, andapi2ai-mcp-generatorhas none — the five in this repo all belong to other workspaces. It exits 1, and one failing hook fails the whole install:This is pre-existing and not specific to any branch — it reproduces on a clean checkout of
master.The fix
The one the sibling workflow already uses.
test.ymlinstalls with--ignore-scriptsand says why:Ported here rather than inventing something new. Nothing in git0's suite depends on a postinstall, and its own dependencies — chalk, git-url-parse, grab-api.js, inquirer, ora, tar — have none.
Verification
Both sides reproduced in the package directory, exactly as the job does it:
bun installbun install --ignore-scriptsbun run test:cijunit.xmlandcoverage/lcov.infoboth writtenScope
Deliberately limited to the entry that was failing.
test-google-loginis the other entry with a barebun installand will fail the same way. The real fix for that one — and for the three red Vercel deployments, which fail on this same root install — is removing the postinstall fromapi2ai-mcp-generatorrather than working around it in each consumer. Worth doing on its own merits too:api2aipublishes to npm, so that hook currently runsdrizzle-kit push, a command that writes to a database, on every machine that installs the package. If the docs generation is wanted, it belongs in adocsscript the docs build calls. Happy to open that separately.Note on this branch's history
#106 was squash-merged while this fix was in flight, which deleted the branch; pushing recreated it with the pre-squash commits. Merging
masterback in realigns the two, so the diff here is just the one file — no already-merged work is re-proposed.🤖 Generated with Claude Code
https://claude.ai/code/session_01KULWViqKDCNmcShYttoU23
Generated by Claude Code