Repository navigation
fix(mirror): include Context Guard's published hook runtime #586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kantorcodes
wants to merge
7
commits into
main
Choose a base branch
from
plugin-contrib/fix-context-guard-runtime-mirror-20261026
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8812d75
fix(mirror): include Context Guard's hook runtime files
kantorcodes 3e43399
test(mirror): cover Context Guard hook runtime selection
kantorcodes 681aee2
fix(mirror): exclude Context Guard's ignored cache and build artifacts
kantorcodes b443dce
test(mirror): preserve Context Guard hook dependencies without ignore…
kantorcodes 5cf84ca
test(mirror): cover Context Guard's published install smoke runner
kantorcodes 1384476
refactor(generator): extract output and retirement helpers
kantorcodes 199f8a0
refactor(generator): import extracted output helpers
kantorcodes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| """JSON artifact writing and explicit retired bundle cleanup helpers. | ||
|
|
||
| Kept separate from the marketplace generator to preserve the 500-line source limit. | ||
| """ | ||
|
|
||
| from pathlib import Path | ||
| import json | ||
| import shutil | ||
|
|
||
| RETIRED_BUNDLE_IDENTITIES = {("samuelbushi", "uizze"), ("waynehamadi", "datacircle-plugin")} | ||
|
|
||
| def write_json(path: Path, data: dict[str, object]) -> None: | ||
| path.parent.mkdir(parents=True, exist_ok=True) | ||
| path.write_text(json.dumps(data, indent=2, ensure_ascii=False) + "\n", encoding="utf-8") | ||
|
|
||
|
|
||
| def prune_unlisted_bundles(root: Path, plugins: list[dict[str, str]]) -> list[str]: | ||
| """Remove only explicitly reviewed retirements that are absent from README. | ||
|
|
||
| Omission from the parsed catalog never authorizes another retirement. | ||
| Keep listed repositories even if this run cannot fetch them, and preflight | ||
| the two-level tree for symlinks before deleting any approved bundle. | ||
| """ | ||
| if not plugins: | ||
| raise ValueError("Refusing bundle cleanup from an empty parsed README; explicit maintainer retirement is required") | ||
| retained = {(plugin["owner"].casefold(), plugin["repo"].casefold()) for plugin in plugins} | ||
| removed: list[str] = [] | ||
| if root.is_symlink(): | ||
| raise ValueError("Generated plugins root must not be a symlink") | ||
| if not root.exists(): | ||
| return removed | ||
| # Preflight the entire tree before retiring anything. A later invalid | ||
| # directory must not leave an earlier bundle partially retired. | ||
| retired: list[Path] = [] | ||
| for owner in sorted(root.iterdir()): | ||
| if owner.is_symlink(): | ||
| raise ValueError(f"Generated owner directory must not be a symlink: {owner}") | ||
| if not owner.is_dir(): | ||
| continue | ||
| for repo in sorted(owner.iterdir()): | ||
| if repo.is_symlink(): | ||
| raise ValueError(f"Generated repo directory must not be a symlink: {repo}") | ||
| identity = (owner.name.casefold(), repo.name.casefold()) | ||
| if repo.is_dir() and identity in RETIRED_BUNDLE_IDENTITIES and identity not in retained: | ||
| retired.append(repo) | ||
| for repo in retired: | ||
| shutil.rmtree(repo) | ||
| removed.append(f"{repo.parent.name}/{repo.name}") | ||
| return removed |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.