Skip to content

fix(mirror): include Context Guard's published hook runtime - #586

Open
kantorcodes wants to merge 2 commits into
mainfrom
plugin-contrib/fix-context-guard-runtime-mirror-20261026
Open

kantorcodes wants to merge 2 commits into
mainfrom
plugin-contrib/fix-context-guard-runtime-mirror-20261026

Conversation

@kantorcodes

Copy link
Copy Markdown
Member

Addresses the original Context Guard maintainer's runtime-mirror defect in issue #357. The existing generated mirror exposes the source manifest but omits upstream hooks/hooks.json, scripts/context_guard.py, scripts/manage_plugin.py and assets/state.schema.json, even though those files exist on the current public source and the manifest declares only Skills.

Adds a narrow source-specific mirror-path selection for GreenLv/codex-context-guard and a regression test requiring those runtime paths while excluding an unrelated private-path fixture. Source .codexignore was inspected; these paths are not excluded. No upstream source files are modified. No catalog approval or publication is requested or implied, and changes must pass ordinary independent review and CI before merge.

The connector's file readbacks confirm the current upstream/mirror omission. No end-to-end Codex install or local test suite was executed here because repository clone access is unavailable in this runtime. Changes were authored with AI assistance and are submitted for human review.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Include Context Guard hook runtime in generated mirrors

🐞 Bug fix 🧪 Tests 🕐 10-20 Minutes

Grey Divider

AI Description

• Select Context Guard’s hooks, scripts, and state schema so its generated mirror includes the
 published runtime.
• Add a regression test that requires those files and excludes an unrelated private-path fixture.
Diagram

graph TD
  Archive["Upstream archive"] --> Selection["Path selection"] --> Bundle[("Mirror bundle")] --> Marketplace["Marketplace source"]
  Manifest["Skills manifest"] --> Selection
  Extras["Context Guard paths"] --> Selection
  Test["Regression test"] -.-> Selection
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Allowlist individual runtime files
  • ➕ Limits mirroring to the currently identified files.
  • ➖ Could omit supporting files or future runtime additions within hooks and scripts.

Recommendation: Keep the existing source-specific selection approach: it includes runtime directories while limiting the exception to Context Guard and a specific schema file. Because directory selection can include future upstream files, review regenerated bundle contents before publication.

Files changed (2) +35 / -1

Bug fix (1) +4 / -0
generate_plugins_json.pySelect Context Guard’s undeclared runtime paths +4/-0

Select Context Guard’s undeclared runtime paths

• Adds a Context Guard-specific mirror exception for the hooks and scripts directories and assets/state.schema.json. This lets the existing generator include runtime files that its Skills-only manifest does not reference.

scripts/generate_plugins_json.py

Tests (1) +31 / -1
test_generate_plugins_json.pyCover Context Guard runtime selection +31/-1

Cover Context Guard runtime selection

• Adds a path-selection regression test requiring the hook configuration, two script entry points, state schema, manifest, and icon. It also checks that an unrelated private-path fixture is excluded.

tests/test_generate_plugins_json.py

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📎 Requirement gaps (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Generator script exceeds 500 code lines 📘 Rule violation ⚙ Maintainability
Description
scripts/generate_plugins_json.py contains 512 non-blank lines. Because this changed source file
crosses the 500-line limit, future maintenance requires splitting the generator into smaller
modules.
Code

scripts/generate_plugins_json.py[R62-65]

+    # Context Guard declares Skills in its manifest; its lifecycle hooks,
+    # script entry points and state schema live at separate top-level paths.
+    # Mirror only these published runtime paths, not arbitrary source files.
+    "GreenLv/codex-context-guard": ("hooks", "scripts", "assets/state.schema.json"),
Evidence
The changed source file contains 512 non-blank lines, exceeding the checklist limit of 500; the PR
also adds code to this file in the cited range.

Rule 2757183: Limit source file length to 500 non-blank lines or less
scripts/generate_plugins_json.py[62-65]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`scripts/generate_plugins_json.py` contains 512 non-blank lines, exceeding the 500-line source-file limit.

## Fix Focus Areas
- scripts/generate_plugins_json.py[62-65]

## Recommended Fix
Refactor the generator into cohesive modules, such as parsing, path selection, mirroring, and marketplace generation, while preserving the existing public behavior and tests. Ensure each resulting source file contains no more than 500 non-blank lines.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

2. Ignored files in scripts could be mirrored 🐞 Bug ≡ Correctness
Description
The new EXTRA_MIRROR_PATHS entry makes add_recursive_selection copy every archive file under
hooks/ and scripts/. Nothing in collect_selected_paths or mirror_plugin_bundle reads
.codexignore. Any file the upstream .codexignore excludes (__pycache__/, *.pyc, build/,
dist/) would be published into the bundle if it exists under those directories in the archive.
Code

scripts/generate_plugins_json.py[65]

+    "GreenLv/codex-context-guard": ("hooks", "scripts", "assets/state.schema.json"),
Evidence
The PR description says the paths are not excluded by .codexignore, but the generator never
enforces that file. The mirrored .codexignore lists .venv/, __pycache__/, *.pyc, build/
and dist/. The check was done once by hand, and the test's negative case
(internal/not-for-distribution.txt) is not an ignored path.

scripts/generate_plugins_json.py[266-290]
plugins/GreenLv/codex-context-guard/.codexignore[1-10]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
Context Guard's recursive extra mirror paths (`hooks`, `scripts`) copy every file beneath them without applying the source `.codexignore`.

### Fix Focus Areas
- scripts/generate_plugins_json.py[266-326]
- tests/test_generate_plugins_json.py[15-43]

### Recommended Fix
Parse the archive's `.codexignore` and drop matching selected paths in `collect_selected_paths` (or at minimum skip `__pycache__` and `*.pyc` under extra paths). Add a test fixture containing an ignored file such as `scripts/__pycache__/x.pyc` and assert it is not selected.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Context sources
✅ Compliance rules (platform): 7 rules
Review mode: Auto: 🚀 Fast: Localized mirror-path behavior with focused regression coverage and limited blast radius.

Grey Divider

Tip of the day
💡 Did you know, you can type 'qodo, fix this' on a finding and the fix lands right on your PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment on lines +62 to +65
# Context Guard declares Skills in its manifest; its lifecycle hooks,
# script entry points and state schema live at separate top-level paths.
# Mirror only these published runtime paths, not arbitrary source files.
"GreenLv/codex-context-guard": ("hooks", "scripts", "assets/state.schema.json"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

1. Generator script exceeds 500 code lines 📘 Rule violation ⚙ Maintainability

scripts/generate_plugins_json.py contains 512 non-blank lines. Because this changed source file
crosses the 500-line limit, future maintenance requires splitting the generator into smaller
modules.
Agent Prompt
## Issue description
`scripts/generate_plugins_json.py` contains 512 non-blank lines, exceeding the 500-line source-file limit.

## Fix Focus Areas
- scripts/generate_plugins_json.py[62-65]

## Recommended Fix
Refactor the generator into cohesive modules, such as parsing, path selection, mirroring, and marketplace generation, while preserving the existing public behavior and tests. Ensure each resulting source file contains no more than 500 non-blank lines.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

# Context Guard declares Skills in its manifest; its lifecycle hooks,
# script entry points and state schema live at separate top-level paths.
# Mirror only these published runtime paths, not arbitrary source files.
"GreenLv/codex-context-guard": ("hooks", "scripts", "assets/state.schema.json"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Informational

2. Ignored files in scripts could be mirrored 🐞 Bug ≡ Correctness

The new EXTRA_MIRROR_PATHS entry makes add_recursive_selection copy every archive file under
hooks/ and scripts/. Nothing in collect_selected_paths or mirror_plugin_bundle reads
.codexignore. Any file the upstream .codexignore excludes (__pycache__/, *.pyc, build/,
dist/) would be published into the bundle if it exists under those directories in the archive.
Agent Prompt
### Issue description
Context Guard's recursive extra mirror paths (`hooks`, `scripts`) copy every file beneath them without applying the source `.codexignore`.

### Fix Focus Areas
- scripts/generate_plugins_json.py[266-326]
- tests/test_generate_plugins_json.py[15-43]

### Recommended Fix
Parse the archive's `.codexignore` and drop matching selected paths in `collect_selected_paths` (or at minimum skip `__pycache__` and `*.pyc` under extra paths). Add a test fixture containing an ignored file such as `scripts/__pycache__/x.pyc` and assert it is not selected.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant