Repository navigation
Handle the submission queue and upload size limit; add tests and CI - #1
Merged
Merged
Conversation
add: - accept several URLs; validate all of them before sending any - stop on a full queue (exit 9), a 429 (exit 6) or a 401 (exit 3) and list the inputs still to send in notSubmitted; other refusals go to failed - --queue waits for a free slot (30 s polls, --queue-timeout per URL) - one progress line per URL; Ctrl-C or SIGTERM prints the partial summary and exits 130 - send a git token with repositories only upload: - refuse files over 4.4 MB before sending (Context7 answers 413 FUNCTION_PAYLOAD_TOO_LARGE above ~4.5 MB), with a split hint per file type; --skip-size-check overrides - say the library id comes from the file name Also: network failures come back as JSON instead of a traceback, every command has --help text, log keeps stdout JSON, and the skill and plugin are at version 1.2. Docs: new Upload a file page, an "Add many sources" section, new gotchas and exit codes; examples use this repo where a real source fits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- tests/test_c7.py: 46 unittest tests for c7.py with the Context7 API stubbed (no key, no network): input classification, website ids, add (single, several URLs, queue, refusals, validation, interrupts), upload (size limit, hints, 413, network errors), call() network failures, log and --help - CI on push to main and on pull requests: tests on Python 3.8 to 3.13, syntax check, skill validation against the Agent Skills specification (skills-ref 0.1.1) and a coverage report - README: CI, Python, license, last-commit, Agent Skills and Context7 badges, and how to run the tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI: - run every job on ubuntu-24.04: setup-python has no Python 3.8 or 3.9 builds for newer Ubuntu images, so ubuntu-latest would break those jobs - test Python 3.8 to 3.14 - actions/checkout and actions/setup-python v7; coverage 7.17.4, with the coverage table also written to the job summary Tests (58): - stub c7's own time module instead of patching the global time.sleep - help tests no longer depend on the terminal width; each command's own purpose and every flag's help text are checked - fail when a stubbed response is left unused - new: a real SIGTERM during a request (guarded, so a missing handler fails that test instead of killing the run), check, allow, refresh (queue full gives 9), api_key from the environment and from ~/.claude.json, multipart, network errors during add c7.py: build_parser() for testable help; close an HTTP error response when reading its body fails; say a network error during add is safe to resubmit and counts as a failure; clearer exit 9 help. context7.json: keep tests/ and .github/ out of the Context7 index. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Two limits of the Context7 API made
c7.pyawkward in real use:addgot400 user-has-active-task, whichc7.pyreported as bad input (exit 2), so agents wrote their own retry loops.413 FUNCTION_PAYLOAD_TOO_LARGE. This wasn't documented, and the error came back as a generic API failure.addnotSubmitted. Other refusals and network errors go infailed.--queuewaits for a free slot (30 s polls,--queue-timeoutper URL), so one call can submit a whole list.uploadqpdffor PDFs).--skip-size-checkoverrides that.--title.Also
--helptext.logkeeps stdout JSON.Tests, CI, badges
tests/test_c7.py: 58 offline tests with the API stubbed, so they need no key or network..github/workflows/ci.yml:ubuntu-24.04;context7.jsonkeepstests/and.github/out of the Context7 index.Testing
whoamiandcheckwork;addof already-indexed sources, one at a time and several at once, creates nothing and exits 0;🤖 Generated with Claude Code