Skip to content

feat(copilot): add rtk init --agent copilot support#728

Open
jeziellopes wants to merge 2 commits intortk-ai:developfrom
jeziellopes:feat/copilot-init-agent
Open

feat(copilot): add rtk init --agent copilot support#728
jeziellopes wants to merge 2 commits intortk-ai:developfrom
jeziellopes:feat/copilot-init-agent

Conversation

@jeziellopes
Copy link
Contributor

Summary

Closes the gap left by #605 / #704: rtk hook copilot was shipped but rtk init had no Copilot counterpart. This PR adds rtk init --agent copilot.

Changes

File Change
src/main.rs Added Copilot variant to AgentTarget enum; routed install_copilot and uninstall
src/init.rs Added run_copilot_mode(), COPILOT_INSTRUCTIONS const, uninstall support, install_copilot param
CHANGELOG.md [Unreleased] entry

Behavior

# Install (project-scoped, no --global needed)
rtk init --agent copilot
# → writes .github/copilot-instructions.md
# → reports .github/hooks/rtk-rewrite.json status

# Idempotent — re-running is safe
rtk init --agent copilot
# → skips if RTK already detected in the file

# Uninstall
rtk init --uninstall --agent copilot
# → removes .github/copilot-instructions.md
# → leaves .github/hooks/rtk-rewrite.json untouched (may be shared)

Pattern followed

Mirrors Cline/Windsurf exactly:

  • fn run_copilot_mode(verbose: u8) -> Result<()>
  • Idempotent check on the target file
  • Routed as a solo --agent target (short-circuits before the Claude/OpenCode match block)

Testing

979 passed; 0 failed; 3 ignored
cargo fmt --all --check: ok
cargo clippy --all-targets -- -D warnings: 0 warnings

Manually tested in a temp dir: install, idempotent re-run, and uninstall all work correctly.

Context

github-actions bot and others added 2 commits March 19, 2026 10:36
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Add GitHub Copilot as a target agent for rtk init:
- Add `Copilot` variant to `AgentTarget` enum
- Add `hooks/copilot-rtk-rules.md` with compact RTK instructions
- Add `run_copilot_mode()` that writes `.github/copilot-instructions.md`
  (idempotent: skips if RTK already detected in the file)
- Add `--uninstall --agent copilot` to remove the instructions file
- Route `install_copilot` through `init::run()` and `init::uninstall()`

Usage:
  rtk init --agent copilot          # install in current project
  rtk init --uninstall --agent copilot  # remove

Closes the gap from PR rtk-ai#605 / rtk-ai#704 where rtk hook copilot was added
but rtk init had no copilot counterpart.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: jeziellopes <jeziellopes@gmail.com>
@jeziellopes jeziellopes force-pushed the feat/copilot-init-agent branch from ed8bc50 to 83e2f8d Compare March 19, 2026 13:36
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