feat(ai): improve imagery workflows and validate asset discovery - #24
feat(ai): improve imagery workflows and validate asset discovery#24RolfMoleman wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new offline validator/test harness has a couple of correctness/maintenance issues (stored comments) that should be addressed before relying on it as a CI gate.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR updates the AI brand-imagery skill/prompt to be less interview-heavy and to produce bounded, collision-safe outputs based on actually available image tooling, and adds an offline validation gate to prevent AI asset metadata/link/discovery drift in CI.
Changes:
- Add offline AI asset validation (
tools/validate_ai_assets.py) plus regression tests and a CI workflow to enforce it. - Add a sync utility (
tools/sync_ai_assets.py) to publish canonical.github/assets into discovery locations (agents/,.agents/skills/) without overwriting unexpected local content. - Refresh the
generate-brand-imageryskill and prompt to use bounded defaults, tool availability routing, and clearer failure/stop behavior; document discovery and legacy script caveats.
File summaries
| File | Description |
|---|---|
| tools/validate_ai_assets.py | Offline validator for frontmatter constraints, local Markdown links, and discovery drift checks. |
| tools/sync_ai_assets.py | Sync tool to publish canonical AI assets into discovery paths while avoiding unsafe overwrites. |
| tools/requirements-dev.txt | Adds PyYAML dependency for offline validation. |
| tests/test_ai_assets.py | Regression tests covering sync/link relocation and validation behaviors. |
| README.md | Updates repository description and points to AI tooling documentation. |
| docs/AI_TOOLING.md | Documents AI asset discovery, validation workflow, and historical script limitations. |
| AGENTS.md | Adds repository guidance for AI asset authoring and validation expectations. |
| .gitignore | Ignores local Python tooling artifacts (pycache, venv, ruff cache). |
| .github/workflows/validate-ai-assets.yml | CI workflow to run offline validation and tests on PRs and main. |
| .github/skills/generate-brand-imagery/SKILL.md | Reworks the skill to be bounded-by-default, tool-aware, and collision-safe. |
| .github/prompts/generate-brand-imagery.prompt.md | Delegates prompt behavior to the skill as the source of truth and updates argument hints/examples. |
| .github/copilot-instructions.md | Adds top-level Copilot instructions pointing to repo guidance and AI tooling docs. |
Review details
- Files reviewed: 12/13 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
| sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "tools")) | ||
| from sync_ai_assets import sync | ||
| from validate_ai_assets import inspect_asset | ||
|
|
||
|
|
| body = re.sub( | ||
| r"^(`{3,}|~{3,}).*?^\1\s*$", | ||
| "", | ||
| content[match.end() :], | ||
| flags=re.MULTILINE | re.DOTALL, | ||
| ) |
There was a problem hiding this comment.
🟡 Changes recommended
Discovery syncing can crash on unexpected paths, and valid Markdown forms can bypass or falsely fail link validation.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
tools/validate_ai_assets.py:72
- This removes only fences that start in column 0 and close with exactly the same marker length. Markdown permits up to three leading spaces and a longer closing fence, so links inside those valid code examples remain in
bodyand can produce false broken-link failures. Use the same stateful fence handling asrender_agent().
body = re.sub(
r"^(`{3,}|~{3,}).*?^\1\s*$",
"",
content[match.end() :],
flags=re.MULTILINE | re.DOTALL,
- Files reviewed: 12/13 changed files
- Comments generated: 3
- Review effort level: Balanced
| rendered.append(line) | ||
| else: | ||
| rendered.append( | ||
| re.sub(r"(\[[^\]\n]+\]\()(<[^>\n]+>|[^\s)]+)\)", relocate, line) |
| for directory in (root / "agents", root / ".agents", root / ".agents/skills"): | ||
| if directory.is_symlink(): | ||
| return [ | ||
| f"Refusing symlinked discovery directory: {directory.relative_to(root)}" | ||
| ] |
| content[match.end() :], | ||
| flags=re.MULTILINE | re.DOTALL, | ||
| ) | ||
| for target in re.findall(r"(?<!!)\[[^\]\n]+\]\(([^\s)]+)\)", body): |
What and why
Brand imagery requests currently repeat optional questions, default to unlimited iterations, and contain conflicting credit-exhaustion rules. This change makes the skill complete the requested image set with a bounded default, available-provider routing, consistent fallback, image inspection and collision-safe filenames. The Copilot prompt delegates to the skill, and a Codex discovery link exposes the same canonical instructions.
Adds repository guidance and an offline CI gate for asset metadata, local links, discovery drift and regression tests. The documentation explains client discovery and identifies the older image scripts as historical utilities with fixed paths and overwrite assumptions.
Validation
No live image requests were made. Actual model/provider availability and credentials remain client configuration. The existing MegaLinter version update remains in #23.