Refactor prompt integration and add agent integration#31
Merged
danielmeppiel merged 3 commits intomainfrom Nov 17, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR adds full .agent.md agent integration support (replacing .chatmode.md) with automatic sync to .github/agents/, and fixes a critical bug in sync_integration that would remove ALL integrated files when uninstalling a single package.
Key Changes
- Agent Integration: New
AgentIntegratorclass mirrorsPromptIntegrator, supporting both.agent.md(new) and.chatmode.md(legacy) formats with-apmsuffix naming - Critical Bug Fix: URL normalization in
sync_integrationnow correctly matches metadata URLs (https://github.com/owner/repo) with dependency short forms (owner/repo) to prevent accidental bulk deletion - Uninstall Fix: Correctly removes
apm_modules/owner/repo/instead ofapm_modules/owner/
Reviewed Changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/apm_cli/integration/agent_integrator.py |
New agent integrator with frontmatter metadata, hash-based modification detection, and sync cleanup |
src/apm_cli/integration/prompt_integrator.py |
Refactored to use YAML frontmatter instead of HTML comments, added content hash tracking |
src/apm_cli/cli.py |
Integrated agent sync in install/uninstall commands, fixed package path calculation, added agent count tracking |
src/apm_cli/primitives/discovery.py |
Added .agent.md patterns to discovery alongside .chatmode.md legacy support |
tests/unit/integration/test_agent_integrator.py |
Comprehensive test suite for agent integration (813 lines) |
tests/unit/integration/test_sync_integration_url_normalization.py |
Tests for URL normalization bug fix with multi-package scenarios |
tests/unit/integration/test_prompt_integrator.py |
Updated for frontmatter format |
docs/primitives.md |
Updated to document .agent.md as primary format with legacy .chatmode.md support |
docs/integrations.md |
Added agent integration documentation |
.gitignore |
Removed apm_modules/ entry (likely unintentional) |
- Add missing ContentHash field to metadata extraction in both integrators - Extract URL normalization logic to shared utility function - Remove unused imports (shutil, pytest, os, patch) - Add comprehensive tests for normalize_repo_url utility All 393 tests passing (377 + 16 new utility tests)
| import frontmatter | ||
|
|
||
| from .utils import normalize_repo_url | ||
| import hashlib |
There was a problem hiding this comment.
Duplicate import of hashlib module. Line 6 already imports hashlib, so line 11 is redundant and should be removed.
Suggested change
| import hashlib |
- Remove trailing slashes before processing .git suffix - Ensures consistent URL matching regardless of trailing slash - Add 2 additional tests for trailing slash edge cases - All 395 tests passing
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.
This pull request introduces full support for the new
.agent.mdformat (replacing.chatmode.md) for defining AI agent personas and workflows, along with automatic integration of these agent files into the VSCode-compatible.github/agents/directory. The documentation has been updated throughout to clarify the new agent format, legacy support, and the integration process. Additionally, several important bug fixes were made to the integration and uninstall logic to prevent accidental removal of unrelated files.Agent Format and Integration Updates:
.agent.mdfiles to.github/agents/with-apmsuffix, matching the prompt integration pattern.README.md,docs/getting-started.md,docs/integrations.md,docs/primitives.md) to reflect.agent.mdas the new standard, with clear notes about legacy.chatmode.mdsupport and migration paths. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] [18] [19]Bug Fixes:
sync_integrationURL normalization bug that caused uninstalling one package to remove prompts/agents from all packages instead of just the uninstalled one. The fix ensures both metadata and dependency lists use normalizedowner/repoformat for comparison. Comprehensive test coverage for multi-package scenarios was added.apm_modules/owner/repo/directory, not the parentapm_modules/owner/.CLI and Integration Enhancements:
AgentIntegrator, tracks agent integration counts, and updates install summary reporting. [1] [2] [3]apm.ymland to provide clearer user feedback. [1] [2]Changelog:
0.5.4summarizing these changes.