E5D2 GitHub - felipehespanhol/codecompanion-copilot-workspace.nvim: Use GitHub Copilot workspace prompt assets (.github/agents/.github/prompts/etc) inside CodeCompanion.nvim
[go: up one dir, main page]

Skip to content

Use GitHub Copilot workspace prompt assets (.github/agents/.github/prompts/etc) inside CodeCompanion.nvim

License

Notifications You must be signed in to change notification settings

felipehespanhol/codecompanion-copilot-workspace.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

codecompanion-copilot-workspace.nvim

Use GitHub Copilot-style repository prompt assets (e.g. .github/agents, .github/prompts, .github/contexts, .github/plans) inside CodeCompanion.nvim.

This plugin automatically registers CodeCompanion slash commands that insert selected workspace files as hidden chat context (via chat:add_context(..., visible=false)), keeping your prompt clean while still giving the LLM the full content.

What it supports

  • .github/agents/*.agent.md (YAML frontmatter stripped)
  • .github/prompts/*.prompt.md (YAML frontmatter stripped)
  • .github/contexts/*.md (excludes TEMPLATE.md)
  • .github/plans/*.md

Default slash commands:

  • /agent
  • /prompt
  • /context (Telescope multi-select supported)
  • /plan

Installation (lazy.nvim)

Copy/paste:

{
  "felipehespanhol/codecompanion-copilot-workspace.nvim",
  dependencies = { "olimorris/codecompanion.nvim" },
  main = "codecompanion_copilot_workspace",
  opts = {
    -- optional; defaults shown
    codecompanion = {
      auto_register = true,
      override = false,
      source = "copilot_workspace",
    },
  },
}

Usage

Open a CodeCompanion chat buffer and type:

  • /agent → pick a file from .github/agents
  • /prompt → pick a file from .github/prompts
  • /context → pick one or more files from .github/contexts
  • /plan → pick a file from .github/plans

If you use Telescope, /context supports multi-select:

  • <Tab> toggle selection
  • <CR> confirm and add all selected

Configuration

require("codecompanion_copilot_workspace").setup({
  codecompanion = {
    auto_register = true,
    override = false,
    source = "copilot_workspace",
  },
  kinds = {
    agent = {
      subdir = { ".github", "agents" },
      suffix = ".agent.md",
      strip_frontmatter = true,
      multi = false,
      excludes = {},
      prompt_title = "Select agent",
    },
    prompt = {
      subdir = { ".github", "prompts" },
      suffix = ".prompt.md",
      strip_frontmatter = true,
      multi = false,
      excludes = {},
      prompt_title = "Select prompt",
    },
    context = {
      subdir = { ".github", "contexts" },
      suffix = ".md",
      strip_frontmatter = false,
      multi = true,
      excludes = { ["TEMPLATE.md"] = true },
      prompt_title = "Select context",
    },
    plan = {
      subdir = { ".github", "plans" },
      suffix = ".md",
      strip_frontmatter = false,
      multi = false,
      excludes = {},
      prompt_title = "Select plan",
    },
  },
})

How auto-registration works

On setup(), the plugin attempts to inject its slash commands into CodeCompanion's runtime config. If CodeCompanion isn't loaded yet, it waits for the User autocommand event CodeCompanionChatCreated and injects them then.

About

Use GitHub Copilot workspace prompt assets (.github/agents/.github/prompts/etc) inside CodeCompanion.nvim

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0