fix: skip unsupported Copilot CLI primitives at user scope#536
fix: skip unsupported Copilot CLI primitives at user scope#536sergio-sisternes-epam wants to merge 2 commits intomicrosoft:mainfrom
Conversation
When running apm install --global, APM incorrectly deployed instructions to ~/.copilot/instructions/. Per the official Copilot CLI config directory reference, ~/.copilot/ only supports agents/, skills/, and hooks/. - Add instructions to Copilot unsupported_user_primitives - Fix user-scope root_dir resolution for integrators - Update tests and documentation Ref: https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-config-dir-reference Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes user-scope (apm install --global) Copilot CLI behavior by aligning deployed primitives and directories with the documented Copilot CLI config layout.
Changes:
- Mark Copilot
instructionsas unsupported at user scope (alongsideprompts). - Adjust install-time user-scope target root resolution so integrators deploy into user-level target directories (e.g.
~/.copilot/). - Update docs and tests to reflect Copilot user-scope support and warning output.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
tests/unit/core/test_scope.py |
Extends scope/target metadata assertions for Copilot user-scope unsupported primitives and warning output. |
src/apm_cli/integration/targets.py |
Adds instructions to Copilot unsupported_user_primitives and updates reference comment/link. |
src/apm_cli/commands/install.py |
Overrides target root_dir at user scope to deploy into user-level dirs; fixes dependency resolution root to use apm_dir. |
docs/src/content/docs/guides/dependencies.md |
Updates the Copilot CLI user-scope support matrix to remove instructions and list it as unsupported. |
Address Copilot review feedback: make user_root_dir a first-class deploy root in validate_deploy_path, partition_managed_files, and the uninstall engine — not just in _integrate_package_primitives. - get_integration_prefixes(user_scope=True) includes user-scope prefixes - validate_deploy_path accepts user-scope paths when user_scope=True - partition_managed_files routes user-scope paths correctly - Uninstall engine uses effective_root(user_scope) for path resolution - Add 8 tests for user-scope integration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Addressed Copilot's review feedback in 7486003:
|
Apply the same fix from skill_integrator to all remaining integrators: agent, command, instruction, and prompt integrators now use target.effective_root(user_scope) instead of target.root_dir for deploy paths and auto_create guards. Also threads user_scope from install.py dispatch loop and uninstall engine to all integrator *_for_target() and sync_for_target() methods. Related: microsoft#536 (Copilot user-scope primitives) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Introduce TargetProfile.for_scope() and resolve_targets() so scope resolution happens exactly once -- no parameter threading, no caller responsibility. This supersedes PRs #536 and #537 and folds in #527. Scope resolution: - for_scope(user_scope) returns a frozen copy with root_dir resolved and unsupported primitives filtered out - resolve_targets() is the single entry point combining detection, scope resolution, and primitive filtering - Integrators read target.root_dir directly -- always correct - partition_managed_files() uses longest-prefix-match routing, fixing .config/opencode/ multi-level root paths - validate_deploy_path() derives prefixes from resolved targets - Uninstall Phase 2 re-integration uses resolved targets, eliminating wrong-path deployment bug Claude Code instructions (#527): - Deploy .instructions.md to .claude/rules/*.md with applyTo: to paths: frontmatter conversion - Legacy glob disabled for .claude/rules/ to protect user .md files - 22 new tests for conversion, integration, sync, and partition Copilot CLI user-scope fix (#536): - Add instructions to unsupported_user_primitives (per official docs) - Fix resolve_dependencies to use apm_dir at user scope Fixes #530 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Superseded by #542 which implements a cleaner architecture: |
|
Closing in favor of #542 (scope-resolved target profiles architecture). |
Introduce TargetProfile.for_scope() and resolve_targets() so scope resolution happens exactly once -- no parameter threading, no caller responsibility. This supersedes PRs #536 and #537 and folds in #527. Scope resolution: - for_scope(user_scope) returns a frozen copy with root_dir resolved and unsupported primitives filtered out - resolve_targets() is the single entry point combining detection, scope resolution, and primitive filtering - Integrators read target.root_dir directly -- always correct - partition_managed_files() uses longest-prefix-match routing, fixing .config/opencode/ multi-level root paths - validate_deploy_path() derives prefixes from resolved targets - Uninstall Phase 2 re-integration uses resolved targets, eliminating wrong-path deployment bug Claude Code instructions (#527): - Deploy .instructions.md to .claude/rules/*.md with applyTo: to paths: frontmatter conversion - Legacy glob disabled for .claude/rules/ to protect user .md files - 22 new tests for conversion, integration, sync, and partition Copilot CLI user-scope fix (#536): - Add instructions to unsupported_user_primitives (per official docs) - Fix resolve_dependencies to use apm_dir at user scope Fixes #530 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* fix: scope-resolved target profiles + Claude Code instructions Introduce TargetProfile.for_scope() and resolve_targets() so scope resolution happens exactly once -- no parameter threading, no caller responsibility. This supersedes PRs #536 and #537 and folds in #527. Scope resolution: - for_scope(user_scope) returns a frozen copy with root_dir resolved and unsupported primitives filtered out - resolve_targets() is the single entry point combining detection, scope resolution, and primitive filtering - Integrators read target.root_dir directly -- always correct - partition_managed_files() uses longest-prefix-match routing, fixing .config/opencode/ multi-level root paths - validate_deploy_path() derives prefixes from resolved targets - Uninstall Phase 2 re-integration uses resolved targets, eliminating wrong-path deployment bug Claude Code instructions (#527): - Deploy .instructions.md to .claude/rules/*.md with applyTo: to paths: frontmatter conversion - Legacy glob disabled for .claude/rules/ to protect user .md files - 22 new tests for conversion, integration, sync, and partition Copilot CLI user-scope fix (#536): - Add instructions to unsupported_user_primitives (per official docs) - Fix resolve_dependencies to use apm_dir at user scope Fixes #530 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: address PR review -- trie routing, legacy prefix cleanup, CHANGELOG refs - Replace O(M*P) sorted-prefix scan with O(depth) trie lookup in partition_managed_files (reviewer comment 1) - Use default KNOWN_TARGETS for uninstall partition so legacy deployed_files from buggy user-scope installs are still bucketed and cleaned up (reviewer comment 2) - Remove targets= from orphan validate_deploy_path so legacy .github/ paths from old user-scope installs can be cleaned up (reviewer comment 3) - Fix CHANGELOG PR references to use #542 (reviewer comment 4) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix: dynamic skill sync prefixes + uninstall Phase 2 targets Fix #538: pass resolved targets to skill_integrator.integrate_package_skill() in uninstall Phase 2 so user-scope re-integration deploys to .copilot/skills/ not .github/skills/. Add auto_create guard to copy_skill_to_target(). Fix #539: refactor sync_integration() to derive skill prefixes dynamically from targets instead of hardcoded .github/skills/, .claude/skills/, etc. User-scope paths like .copilot/skills/ and .config/opencode/skills/ are now handled correctly. Pass resolved targets from uninstall engine. 9 new tests covering resolved-target routing, auto_create guards, user-scope manifest removal, legacy cleanup, and cross-tool guards. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Description
When running
apm install --global, APM incorrectly deployedinstructionsto~/.copilot/instructions/. Per the official Copilot CLI config directory reference,~/.copilot/only supportsagents/,skills/, andhooks/.This change adds
"instructions"to the Copilot target'sunsupported_user_primitives, aligning APM with the documented Copilot CLI behavior. Also fixes user-scope root_dir resolution so integrators deploy to~/.copilot/rather than~/.github/.Type of change
Testing