Expose rule authority URL manifest and add bulk docs prefetch command#65
Open
Copilot wants to merge 3 commits into
Open
Expose rule authority URL manifest and add bulk docs prefetch command#65Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
2 tasks
Agent-Logs-Url: https://github.com/bitflight-devops/skilllint/sessions/fd38ea46-062c-499d-8243-f33cffb96666 Co-authored-by: Jamie-BitFlight <25075504+Jamie-BitFlight@users.noreply.github.com>
Agent-Logs-Url: https://github.com/bitflight-devops/skilllint/sessions/fd38ea46-062c-499d-8243-f33cffb96666 Co-authored-by: Jamie-BitFlight <25075504+Jamie-BitFlight@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add authority URL manifest for bulk vendor cache pre-fetch
Expose rule authority URL manifest and add bulk docs prefetch command
May 13, 2026
📊 Test Coverage ReportCoverage: 82.89% 📥 Coverage XML available as artifact: |
Benchmark Results✅ No regressions — threshold: 30% scan-clean
scan-violations
fix-violations
cpu
Updated 2026-05-13 00:19 UTC |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes “rule authority” documentation references by adding a registry-level iterator for authority references and a new skilllint docs fetch-authorities CLI command to prefetch/cache those docs in bulk.
Changes:
- Added
iter_authority_urls(unique=...)to enumerate rule authority references from the registry (optionally deduped). - Added
skilllint docs fetch-authoritiesto fetch/cache all registry authority references in one pass with--ttl/--force. - Added unit tests and updated README/CLAUDE docs to document the new subcommand.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents the new docs fetch-authorities subcommand and example usage. |
| packages/skilllint/rule_registry.py | Adds iter_authority_urls() iterator and exports it. |
| packages/skilllint/cli_docs.py | Implements docs fetch-authorities Typer command that calls the iterator and fetches via fetch_or_cached(). |
| packages/skilllint/tests/test_rule_registry.py | Adds tests for unique vs non-unique authority iteration behavior. |
| packages/skilllint/tests/test_cli_docs.py | Adds tests for docs fetch-authorities success path, option forwarding, and partial-failure exit code. |
| CLAUDE.md | Adds a short example of docs fetch-authorities. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+130
to
+138
| authority_urls = list(iter_authority_urls(unique=True)) | ||
| if not authority_urls: | ||
| err_console.print(":warning: [yellow]No authority URLs found in the rule registry[/yellow]") | ||
| return | ||
|
|
||
| had_failure = False | ||
| for url in authority_urls: | ||
| try: | ||
| result = fetch_or_cached(url, ttl_hours=ttl, force=force) |
Comment on lines
+163
to
+176
| def iter_authority_urls(*, unique: bool = True) -> Iterator[str]: | ||
| """Iterate authority reference URLs declared by registered rules. | ||
|
|
||
| Args: | ||
| unique: When True, yield each reference URL at most once while preserving | ||
| first-seen order (by sorted rule ID). When False, include duplicates. | ||
|
|
||
| Yields: | ||
| Authority reference URL strings from RuleEntry.authority.reference. | ||
| """ | ||
| seen: set[str] = set() | ||
| for rule in list_rules(): | ||
| reference = rule.authority.reference if rule.authority is not None else None | ||
| if not reference: |
Comment on lines
+328
to
+330
| Fetches every unique authority reference URL declared by the rule registry. Prints one | ||
| cached file path per successful fetch. Exits 1 if any URL cannot be fetched and no stale | ||
| cache is available. |
Comment on lines
+257
to
+274
| def test_fetches_all_authority_urls(self, cli_runner: CliRunner, mocker: MockerFixture) -> None: | ||
| """Fetches each authority URL and prints one path per success.""" | ||
| mock_iter = mocker.patch("skilllint.cli_docs.iter_authority_urls") | ||
| mock_iter.return_value = iter([_TEST_URL, _TEST_URL_2]) | ||
|
|
||
| mock_fetch = mocker.patch("skilllint.cli_docs.fetch_or_cached") | ||
| mock_fetch.side_effect = [ | ||
| _cache_result(CacheStatus.FRESH, path=_TEST_PATH), | ||
| _cache_result(CacheStatus.NEW, path=_TEST_PATH_2), | ||
| ] | ||
|
|
||
| result = cli_runner.invoke(plugin_validator.app, ["docs", "fetch-authorities"]) | ||
|
|
||
| assert result.exit_code == 0 | ||
| mock_iter.assert_called_once_with(unique=True) | ||
| assert mock_fetch.call_count == 2 | ||
| assert str(_TEST_PATH) in result.output | ||
| assert str(_TEST_PATH_2) in result.output |
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.
Rule authority references were scattered across series modules with no single API to enumerate them, making bulk vendor-cache warming and authority auditing cumbersome. This change adds a registry-level authority URL manifest iterator and a docs command to fetch that manifest in one pass.
Rule registry: authority URL manifest API
iter_authority_urls(*, unique: bool = True)torule_registry.RuleEntry.authority.referenceacross registered rules.unique=Falseto retain duplicates.Docs CLI: bulk prefetch from registry authorities
skilllint docs fetch-authorities.iter_authority_urls(unique=True)and fetches each through existingfetch_or_cached(...).docs fetch(--ttl,--force).Tests and docs updates
docs fetch-authoritiessuccess path, option forwarding, and partial-failure exit behaviorREADME.mdandCLAUDE.mdto includefetch-authorities.