Skip to content

fix(copilot): keep Copilot modular instructions split at user-scope since supported - reverts #1619#2317

Open
kilianpaquier wants to merge 1 commit into
microsoft:mainfrom
kilianpaquier:fix/copilot-user-scope-instructions
Open

fix(copilot): keep Copilot modular instructions split at user-scope since supported - reverts #1619#2317
kilianpaquier wants to merge 1 commit into
microsoft:mainfrom
kilianpaquier:fix/copilot-user-scope-instructions

Conversation

@kilianpaquier

Copy link
Copy Markdown

Description

Reverts changes introduced in #1619 since Copilot CLI (and VSCode Chat) support user-scope ~/.copilot/instructions/**/*.instructions.md.

Fixes #650.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass
  • Added tests for new functionality (if applicable)

Spec conformance (OpenAPM v0.1)

If this PR changes behaviour that an OpenAPM v0.1 req-XXX covers,
confirm the three-step ritual (see CONTRIBUTING.md "Adding or
changing a normative requirement"):

  • Spec edit: docs/src/content/docs/specs/openapm-v0.1.md updated
    (new/changed <a id="req-XXX"></a> anchor + prose + Appendix C
    row).
  • Manifest edit: docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.yml
    updated.
  • Test edit: a @pytest.mark.req("req-XXX") test under
    tests/spec_conformance/ added or extended.
  • CONFORMANCE.{md,json} regenerated via
    uv run --extra dev python -m tests.spec_conformance.gen_statement
    and committed.
  • N/A -- this PR does not change OpenAPM-observable behaviour.

Proof of tests

Current APM installed version v0.24.1

❯ apm --version
Agent Package Manager (APM) CLI version 0.24.1 (4257698)
❯ apm install kilianpaquier/agent-rules -g --target claude,copilot
[i] Installing to user scope (~/.apm/)
[!] User-scope primitives are fully supported by claude, kiro, gemini, agent-skills, openclaw, hermes, copilot-cowork, copilot-app. Partially supported: copilot, 
cursor, opencode, antigravity, codex, windsurf.
Some primitives are not supported: cursor (instructions); opencode (hooks); antigravity (instructions, hooks); windsurf (instructions)
[*] Validating 1 package...
[+] kilianpaquier/agent-rules (already in apm.yml)
[>] Installing 1 new package...
  [+] kilianpaquier/agent-rules @d2029530 (cached)
  |-- 1 instruction(s) integrated (11 adopted) -> .claude/rules/, .copilot/
  [+] <project root> (local)
  |-- (files unchanged)
[i] Cleaned 11 stale files from kilianpaquier/agent-rules
  [!] 1 dependency unpinned: kilianpaquier/agent-rules -- add #tag or #sha to prevent drift
[*] Installed 1 APM dependency (11 stale files cleaned) in 0.7s
❯ lla ~/.copilot/instructions
ls: cannot access '/home/kilianpaquier/.copilot/instructions': No such file or directory
❯ cat ~/.copilot/copilot-instructions.md
<!-- apm-managed: copilot-instructions.md -->
<!-- apm:source:kilianpaquier/agent-rules -->

Local build of this branch:

❯ ./dist/apm-linux-x86_64/apm install kilianpaquier/agent-rules -g --target claude,copilot
[i] Installing to user scope (~/.apm/)
[!] User-scope primitives are fully supported by claude, kiro, gemini, agent-skills, openclaw, hermes, copilot-cowork, copilot-app. Partially supported: copilot, cursor, opencode, antigravity, codex, windsurf.
Some primitives are not supported: cursor (instructions); opencode (hooks); antigravity (instructions, hooks); windsurf (instructions)
[*] Validating 1 package...
[+] kilianpaquier/agent-rules (already in apm.yml)
[>] Installing 1 new package...
  [+] kilianpaquier/agent-rules @d2029530 (cached)
  |-- 11 instruction(s) integrated (11 adopted) -> .claude/rules/, .copilot/instructions/
  [+] <project root> (local)
  |-- (files unchanged)
[i] Cleaned 1 stale file from kilianpaquier/agent-rules
  [!] 1 dependency unpinned: kilianpaquier/agent-rules -- add #tag or #sha to prevent drift
[*] Installed 1 APM dependency (1 stale file cleaned) in 0.8s.
❯ lla ~/.copilot/instructions
total 60
-rw-r--r--  1 kilianpaquier kilianpaquier 1533 Jul 19 00:12 docker-compose.instructions.md
-rw-r--r--  1 kilianpaquier kilianpaquier 2123 Jul 19 00:12 typescript.instructions.md
-rw-r--r--  1 kilianpaquier kilianpaquier 1238 Jul 19 00:12 terraform.instructions.md
-rw-r--r--  1 kilianpaquier kilianpaquier  924 Jul 19 00:12 shell.instructions.md
-rw-r--r--  1 kilianpaquier kilianpaquier 1013 Jul 19 00:12 markdown.instructions.md
-rw-r--r--  1 kilianpaquier kilianpaquier  542 Jul 19 00:12 makefile.instructions.md
-rw-r--r--  1 kilianpaquier kilianpaquier 1942 Jul 19 00:12 go-test.instructions.md
-rw-r--r--  1 kilianpaquier kilianpaquier 4258 Jul 19 00:12 go.instructions.md
-rw-r--r--  1 kilianpaquier kilianpaquier 7681 Jul 19 00:12 global.instructions.md
-rw-r--r--  1 kilianpaquier kilianpaquier 2157 Jul 19 00:12 gitlab-ci.instructions.md
-rw-r--r--  1 kilianpaquier kilianpaquier 1831 Jul 19 00:12 docker.instructions.md
drwxr-xr-x  2 kilianpaquier kilianpaquier 4096 Jul 19 00:12 .
drwxr-xr-x 10 kilianpaquier kilianpaquier 4096 Jul 19 00:12 ..
❯ lla ~/.copilot/copilot-instructions.md
ls: cannot access '/home/kilianpaquier/.copilot/copilot-instructions.md': No such file or directory

…ince supported - microsoft#1619

Signed-off-by: kilianpaquier <git@kilianpaquier.dev>
Copilot AI review requested due to automatic review settings July 18, 2026 22:13
@kilianpaquier kilianpaquier changed the title fix(copilot): keep Copilot modular instructions split at user-scope since supported - #1619 fix(copilot): keep Copilot modular instructions split at user-scope since supported - reverts #1619 Jul 18, 2026
@kilianpaquier

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR reverts the Copilot user-scope instructions behavior introduced in #1619 by restoring modular instruction deployment for the Copilot target at user scope (deploying *.instructions.md files under ~/.copilot/instructions/ instead of concatenating into ~/.copilot/copilot-instructions.md).

Changes:

  • Remove the Copilot user-scope instruction concat override from the Copilot TargetProfile and revert to the standard github_instructions mapping.
  • Delete the concat integration/sync implementation from InstructionIntegrator and simplify sync cleanup back to directory-based removal.
  • Update unit/integration tests and the targets matrix docs to reflect modular user-scope Copilot instruction deployment.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/integration/test_scope_integration.py Updates expectations for Copilot user-scope instructions mapping (github_instructions).
tests/unit/integration/test_scope_install_uninstall.py Updates user-scope install assertions to expect .copilot/instructions/ files rather than a single concat file.
tests/unit/integration/test_data_driven_dispatch.py Adjusts for-scope filtering/mapping expectations for Copilot user-scope instructions.
tests/unit/install/test_install_copilot_user_instructions.py Reworks acceptance tests to validate per-file deployment under .copilot/instructions/ and frontmatter preservation.
tests/integration/test_integration_runtime_coverage.py Removes coverage tests specific to the deleted concat helpers and concat integration path.
src/apm_cli/integration/targets.py Removes Copilot user-scope primitive override; updates Copilot user-scope behavior comments.
src/apm_cli/integration/instruction_integrator.py Removes concat integration path and collapses sync cleanup logic to directory-prefix behavior.
docs/src/content/docs/reference/targets-matrix.md Updates Copilot user-scope documentation to describe modular instructions under ~/.copilot/instructions/.
Comments suppressed due to low confidence (1)

src/apm_cli/integration/instruction_integrator.py:271

  • sync_for_target() now only removes managed files under "//". If a user previously installed Copilot user-scope instructions with the old concat format, the lockfile can still contain ".copilot/copilot-instructions.md" (root file), and an uninstall with this code will never match the new prefix, leaving that legacy file behind. Consider adding a small legacy cleanup pass for that specific path when uninstalling copilot at user scope.
        return self.sync_remove_files(
            project_root,
            managed_files,
            prefix=prefix,
            legacy_glob_dir=legacy_dir,

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.

[FEATURE] Copilot CLI user-scope instructions: can apm install -g write copilot-instructions.md

2 participants