acp.mdx 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. ---
  2. title: ACP Support
  3. description: Use OpenCode in any ACP-compatible editor.
  4. ---
  5. OpenCode는 [Agent Client Protocol](https://agentclientprotocol.com)(ACP)을 지원하므로, ACP 호환 편집기와 IDE에서 OpenCode를 직접 사용할 수 있습니다.
  6. :::tip
  7. ACP를 지원하는 편집기와 tool 목록은 [ACP progress report](https://zed.dev/blog/acp-progress-report#available-now)에서 확인하세요.
  8. :::
  9. ACP는 코드 편집기와 AI 코딩 에이전트 간의 통신을 표준화하는 개방형 프로토콜입니다.
  10. ---
  11. ## 구성
  12. ACP로 OpenCode를 사용하려면, 편집기에서 `opencode acp` 명령을 실행하도록 config를 설정하세요.
  13. 이 명령은 OpenCode를 ACP 호환 subprocess로 시작하며, stdio 기반 JSON-RPC를 통해 편집기와 통신합니다.
  14. 아래는 ACP를 지원하는 주요 편집기 예시입니다.
  15. ---
  16. ### Zed
  17. [Zed](https://zed.dev) config(`~/.config/zed/settings.json`)에 다음을 추가하세요.
  18. ```json title="~/.config/zed/settings.json"
  19. {
  20. "agent_servers": {
  21. "OpenCode": {
  22. "command": "opencode",
  23. "args": ["acp"]
  24. }
  25. }
  26. }
  27. ```
  28. 열려면 **Command Palette**에서 `agent: new thread` action을 사용하세요.
  29. `keymap.json`을 수정해 키보드 단축키를 바인딩할 수도 있습니다.
  30. ```json title="keymap.json"
  31. [
  32. {
  33. "bindings": {
  34. "cmd-alt-o": [
  35. "agent::NewExternalAgentThread",
  36. {
  37. "agent": {
  38. "custom": {
  39. "name": "OpenCode",
  40. "command": {
  41. "command": "opencode",
  42. "args": ["acp"]
  43. }
  44. }
  45. }
  46. }
  47. ]
  48. }
  49. }
  50. ]
  51. ```
  52. ---
  53. ### JetBrains IDEs
  54. [JetBrains IDE](https://www.jetbrains.com/)에서는 [documentation](https://www.jetbrains.com/help/ai-assistant/acp.html)에 따라 `acp.json`에 다음을 추가하세요.
  55. ```json title="acp.json"
  56. {
  57. "agent_servers": {
  58. "OpenCode": {
  59. "command": "/absolute/path/bin/opencode",
  60. "args": ["acp"]
  61. }
  62. }
  63. }
  64. ```
  65. 열려면 AI Chat agent selector에서 새 `OpenCode` agent를 선택하세요.
  66. ---
  67. ### Avante.nvim
  68. [Avante.nvim](https://github.com/yetone/avante.nvim) config에 다음을 추가하세요.
  69. ```lua
  70. {
  71. acp_providers = {
  72. ["opencode"] = {
  73. command = "opencode",
  74. args = { "acp" }
  75. }
  76. }
  77. }
  78. ```
  79. 환경 변수를 전달해야 한다면 다음과 같이 설정하세요.
  80. ```lua {6-8}
  81. {
  82. acp_providers = {
  83. ["opencode"] = {
  84. command = "opencode",
  85. args = { "acp" },
  86. env = {
  87. OPENCODE_API_KEY = os.getenv("OPENCODE_API_KEY")
  88. }
  89. }
  90. }
  91. }
  92. ```
  93. ---
  94. ### CodeCompanion.nvim
  95. [CodeCompanion.nvim](https://github.com/olimorris/codecompanion.nvim)에서 OpenCode를 ACP agent로 사용하려면 Neovim config에 다음을 추가하세요.
  96. ```lua
  97. require("codecompanion").setup({
  98. interactions = {
  99. chat = {
  100. adapter = {
  101. name = "opencode",
  102. model = "claude-sonnet-4",
  103. },
  104. },
  105. },
  106. })
  107. ```
  108. 이 config는 chat에서 OpenCode를 ACP agent로 사용하도록 CodeCompanion을 설정합니다.
  109. 환경 변수(`OPENCODE_API_KEY` 등)를 전달해야 한다면 CodeCompanion.nvim documentation의 [Configuring Adapters: Environment Variables](https://codecompanion.olimorris.dev/getting-started#setting-an-api-key)를 참고하세요.
  110. ## 지원
  111. OpenCode는 ACP를 통해서도 터미널과 동일하게 동작합니다. 다음 기능을 모두 지원합니다.
  112. :::note
  113. `/undo` 및 `/redo`와 같은 일부 내장 슬래시 명령은 현재 지원되지 않습니다.
  114. :::
  115. - 내장 tool(파일 작업, terminal 명령 등)
  116. - 사용자 정의 tool과 slash command
  117. - OpenCode config에 설정한 MCP 서버
  118. - `AGENTS.md`의 프로젝트별 규칙
  119. - 사용자 정의 formatter와 linter
  120. - agent 및 권한 시스템