Skip to content

fix: COPILOT_INSTRUCTIONS example drops kubectl get subcommand - #2642

Closed
amitmishra11 wants to merge 2 commits into
rtk-ai:developfrom
amitmishra11:fix/copilot-instructions-kubectl-get
Closed

amitmishra11 wants to merge 2 commits into
rtk-ai:developfrom
amitmishra11:fix/copilot-instructions-kubectl-get

Conversation

@amitmishra11

@amitmishra11 amitmishra11 commented Jun 26, 2026 •

Copy link
Copy Markdown

Summary

  • Fixes rtk init drops kubectl **get** in template in Copilot mode #2471: the COPILOT_INSTRUCTIONS template generated by rtk init for GitHub Copilot mapped kubectl get pods → rtk kubectl pods, silently dropping the get subcommand.
  • The actual rewrite rule (src/discover/rules.rs, rtk_cmd: "rtk kubectl") correctly preserves subcommands via strip_word_prefix — only this doc example in src/hooks/init.rs was wrong, so users following the example would run an incorrect command.

Change

  • src/hooks/init.rs: kubectl get pods rtk kubectl pods → kubectl get pods rtk kubectl get pods
  • Added test_copilot_instructions_kubectl_example_preserves_subcommand: pins the correct mapping string and asserts the buggy rtk kubectl pods string is absent from COPILOT_INSTRUCTIONS, so this can't silently regress.

Test plan

  • Added a unit test (src/hooks/init.rs) following the existing test style in this file (plain &str::contains assertions against the const, same pattern as test_init_mentions_all_top_level_commands).
  • Searched the repo for other occurrences of the same incorrect mapping — none found (other examples in the same table, e.g. docker ps, are correct).
  • Verified the existing test test_init_mentions_all_top_level_commands asserts against RTK_INSTRUCTIONS (a separate const), not COPILOT_INSTRUCTIONS, so it's unaffected by this change.
  • cargo test — could not run locally: my sandbox has a 32-bit MinGW only and no MSVC Build Tools / working 64-bit linker (tried MSVC toolchain 1.91 — link.exe not found/wrong link.exe picked up from PATH; tried GNU toolchain 1.91 — dlltool 32-bit/64-bit bfd-target mismatch). Didn't want to install VS Build Tools without checking first. Would appreciate CI confirming, or happy to address review feedback if the test needs adjusting.

The mapping example table mapped "kubectl get pods" to "rtk kubectl pods",
silently dropping the "get" subcommand. This mirrors the actual rewrite
rule in src/discover/rules.rs (rtk_cmd: "rtk kubectl"), which preserves
the subcommand correctly — only the doc example was wrong.

Fixes rtk-ai#2471
@CLAassistant

CLAassistant commented Jun 26, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

…UCTIONS

Pins the exact "kubectl get pods -> rtk kubectl get pods" mapping and
asserts the buggy "rtk kubectl pods" string is absent, so a future edit
to the example table can't silently reintroduce rtk-ai#2471.
@TaKO8Ki

TaKO8Ki commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Thank you for the contribution. Unfortunately, #2472 fixed the issue.

@TaKO8Ki TaKO8Ki closed this Jul 24, 2026
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.

rtk init drops kubectl **get** in template in Copilot mode

3 participants