@vicoa/cli 0.1.3 → 0.1.4-darwin-arm64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/bin/_internal/81d243bd2c585b0f4821__mypyc.cpython-312-darwin.so +0 -0
  2. package/bin/_internal/_cffi_backend.cpython-312-darwin.so +0 -0
  3. package/bin/_internal/aiohttp/_http_parser.cpython-312-darwin.so +0 -0
  4. package/bin/_internal/aiohttp/_http_writer.cpython-312-darwin.so +0 -0
  5. package/bin/_internal/aiohttp/_websocket/mask.cpython-312-darwin.so +0 -0
  6. package/bin/_internal/aiohttp/_websocket/reader_c.cpython-312-darwin.so +0 -0
  7. package/bin/_internal/asyncpg/protocol/protocol.cpython-312-darwin.so +0 -0
  8. package/bin/_internal/attrs-26.1.0.dist-info/INSTALLER +1 -0
  9. package/bin/_internal/attrs-26.1.0.dist-info/METADATA +199 -0
  10. package/bin/_internal/attrs-26.1.0.dist-info/RECORD +55 -0
  11. package/bin/_internal/attrs-26.1.0.dist-info/WHEEL +4 -0
  12. package/bin/_internal/attrs-26.1.0.dist-info/licenses/LICENSE +21 -0
  13. package/bin/_internal/base_library.zip +0 -0
  14. package/bin/_internal/certifi/cacert.pem +4494 -0
  15. package/bin/_internal/certifi/py.typed +0 -0
  16. package/bin/_internal/charset_normalizer/cd.cpython-312-darwin.so +0 -0
  17. package/bin/_internal/charset_normalizer/md.cpython-312-darwin.so +0 -0
  18. package/bin/_internal/click-8.3.2.dist-info/INSTALLER +1 -0
  19. package/bin/_internal/click-8.3.2.dist-info/METADATA +84 -0
  20. package/bin/_internal/click-8.3.2.dist-info/RECORD +40 -0
  21. package/bin/_internal/click-8.3.2.dist-info/WHEEL +4 -0
  22. package/bin/_internal/click-8.3.2.dist-info/licenses/LICENSE.txt +28 -0
  23. package/bin/_internal/cryptography/hazmat/bindings/_rust.abi3.so +0 -0
  24. package/bin/_internal/cryptography-46.0.7.dist-info/INSTALLER +1 -0
  25. package/bin/_internal/cryptography-46.0.7.dist-info/METADATA +139 -0
  26. package/bin/_internal/cryptography-46.0.7.dist-info/RECORD +180 -0
  27. package/bin/_internal/cryptography-46.0.7.dist-info/WHEEL +4 -0
  28. package/bin/_internal/cryptography-46.0.7.dist-info/licenses/LICENSE +3 -0
  29. package/bin/_internal/cryptography-46.0.7.dist-info/licenses/LICENSE.APACHE +202 -0
  30. package/bin/_internal/cryptography-46.0.7.dist-info/licenses/LICENSE.BSD +27 -0
  31. package/bin/_internal/email_validator-2.1.0.dist-info/INSTALLER +1 -0
  32. package/bin/_internal/email_validator-2.1.0.dist-info/LICENSE +121 -0
  33. package/bin/_internal/email_validator-2.1.0.dist-info/METADATA +482 -0
  34. package/bin/_internal/email_validator-2.1.0.dist-info/RECORD +26 -0
  35. package/bin/_internal/email_validator-2.1.0.dist-info/REQUESTED +0 -0
  36. package/bin/_internal/email_validator-2.1.0.dist-info/WHEEL +5 -0
  37. package/bin/_internal/email_validator-2.1.0.dist-info/entry_points.txt +2 -0
  38. package/bin/_internal/email_validator-2.1.0.dist-info/top_level.txt +1 -0
  39. package/bin/_internal/fastmcp-2.9.2.dist-info/INSTALLER +1 -0
  40. package/bin/_internal/fastmcp-2.9.2.dist-info/METADATA +465 -0
  41. package/bin/_internal/fastmcp-2.9.2.dist-info/RECORD +150 -0
  42. package/bin/_internal/fastmcp-2.9.2.dist-info/REQUESTED +0 -0
  43. package/bin/_internal/fastmcp-2.9.2.dist-info/WHEEL +4 -0
  44. package/bin/_internal/fastmcp-2.9.2.dist-info/entry_points.txt +2 -0
  45. package/bin/_internal/fastmcp-2.9.2.dist-info/licenses/LICENSE +201 -0
  46. package/bin/_internal/frozenlist/_frozenlist.cpython-312-darwin.so +0 -0
  47. package/bin/_internal/h2-4.3.0.dist-info/INSTALLER +1 -0
  48. package/bin/_internal/h2-4.3.0.dist-info/METADATA +129 -0
  49. package/bin/_internal/h2-4.3.0.dist-info/RECORD +29 -0
  50. package/bin/_internal/h2-4.3.0.dist-info/WHEEL +5 -0
  51. package/bin/_internal/h2-4.3.0.dist-info/licenses/LICENSE +21 -0
  52. package/bin/_internal/h2-4.3.0.dist-info/top_level.txt +1 -0
  53. package/bin/_internal/httptools/parser/parser.cpython-312-darwin.so +0 -0
  54. package/bin/_internal/httptools/parser/url_parser.cpython-312-darwin.so +0 -0
  55. package/bin/_internal/integrations/cli_wrappers/IMPORTANT_USE_CASES.md +33 -0
  56. package/bin/_internal/integrations/github/claude-code-action/.prettierignore +2 -0
  57. package/bin/_internal/integrations/github/claude-code-action/.prettierrc +1 -0
  58. package/bin/_internal/integrations/github/claude-code-action/CLAUDE.md +136 -0
  59. package/bin/_internal/integrations/github/claude-code-action/CODE_OF_CONDUCT.md +128 -0
  60. package/bin/_internal/integrations/github/claude-code-action/CONTRIBUTING.md +116 -0
  61. package/bin/_internal/integrations/github/claude-code-action/LICENSE +21 -0
  62. package/bin/_internal/integrations/github/claude-code-action/README.md +53 -0
  63. package/bin/_internal/integrations/github/claude-code-action/ROADMAP.md +20 -0
  64. package/bin/_internal/integrations/github/claude-code-action/SECURITY.md +15 -0
  65. package/bin/_internal/integrations/github/claude-code-action/action.yml +294 -0
  66. package/bin/_internal/integrations/github/claude-code-action/base-action/.prettierrc +1 -0
  67. package/bin/_internal/integrations/github/claude-code-action/base-action/CLAUDE.md +60 -0
  68. package/bin/_internal/integrations/github/claude-code-action/base-action/CODE_OF_CONDUCT.md +128 -0
  69. package/bin/_internal/integrations/github/claude-code-action/base-action/CONTRIBUTING.md +136 -0
  70. package/bin/_internal/integrations/github/claude-code-action/base-action/LICENSE +21 -0
  71. package/bin/_internal/integrations/github/claude-code-action/base-action/MIRROR_DISCLAIMER.md +11 -0
  72. package/bin/_internal/integrations/github/claude-code-action/base-action/README.md +521 -0
  73. package/bin/_internal/integrations/github/claude-code-action/base-action/action.yml +149 -0
  74. package/bin/_internal/integrations/github/claude-code-action/base-action/bun.lock +54 -0
  75. package/bin/_internal/integrations/github/claude-code-action/base-action/examples/issue-triage.yml +108 -0
  76. package/bin/_internal/integrations/github/claude-code-action/base-action/package.json +23 -0
  77. package/bin/_internal/integrations/github/claude-code-action/base-action/scripts/install-hooks.sh +13 -0
  78. package/bin/_internal/integrations/github/claude-code-action/base-action/scripts/pre-push +46 -0
  79. package/bin/_internal/integrations/github/claude-code-action/base-action/src/index.ts +82 -0
  80. package/bin/_internal/integrations/github/claude-code-action/base-action/src/prepare-prompt.ts +82 -0
  81. package/bin/_internal/integrations/github/claude-code-action/base-action/src/run-claude.ts +257 -0
  82. package/bin/_internal/integrations/github/claude-code-action/base-action/src/run-vicoa.ts +301 -0
  83. package/bin/_internal/integrations/github/claude-code-action/base-action/src/setup-claude-code-settings.ts +68 -0
  84. package/bin/_internal/integrations/github/claude-code-action/base-action/src/validate-env.ts +54 -0
  85. package/bin/_internal/integrations/github/claude-code-action/base-action/test-local.sh +12 -0
  86. package/bin/_internal/integrations/github/claude-code-action/base-action/test-mcp-local.sh +18 -0
  87. package/bin/_internal/integrations/github/claude-code-action/base-action/tsconfig.json +30 -0
  88. package/bin/_internal/integrations/github/claude-code-action/bun.lock +384 -0
  89. package/bin/_internal/integrations/github/claude-code-action/docs/capabilities-and-limitations.md +33 -0
  90. package/bin/_internal/integrations/github/claude-code-action/docs/cloud-providers.md +99 -0
  91. package/bin/_internal/integrations/github/claude-code-action/docs/configuration.md +345 -0
  92. package/bin/_internal/integrations/github/claude-code-action/docs/custom-automations.md +113 -0
  93. package/bin/_internal/integrations/github/claude-code-action/docs/experimental.md +128 -0
  94. package/bin/_internal/integrations/github/claude-code-action/docs/faq.md +205 -0
  95. package/bin/_internal/integrations/github/claude-code-action/docs/migration-guide.md +261 -0
  96. package/bin/_internal/integrations/github/claude-code-action/docs/security.md +38 -0
  97. package/bin/_internal/integrations/github/claude-code-action/docs/setup.md +146 -0
  98. package/bin/_internal/integrations/github/claude-code-action/docs/usage.md +213 -0
  99. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci/auto-fix-ci.yml +97 -0
  100. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci/commands/fix-ci.md +127 -0
  101. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci-signed/auto-fix-ci-signed.yml +97 -0
  102. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci-signed/commands/fix-ci-signed.md +148 -0
  103. package/bin/_internal/integrations/github/claude-code-action/examples/issue-deduplication.yml +63 -0
  104. package/bin/_internal/integrations/github/claude-code-action/examples/issue-triage.yml +75 -0
  105. package/bin/_internal/integrations/github/claude-code-action/examples/vicoa.yml +75 -0
  106. package/bin/_internal/integrations/github/claude-code-action/package.json +31 -0
  107. package/bin/_internal/integrations/github/claude-code-action/scripts/install-hooks.sh +13 -0
  108. package/bin/_internal/integrations/github/claude-code-action/scripts/pre-commit +46 -0
  109. package/bin/_internal/integrations/github/claude-code-action/scripts/setup-network-restrictions.sh +123 -0
  110. package/bin/_internal/integrations/github/claude-code-action/src/create-prompt/index.ts +799 -0
  111. package/bin/_internal/integrations/github/claude-code-action/src/create-prompt/types.ts +102 -0
  112. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/collect-inputs.ts +58 -0
  113. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/format-turns.ts +465 -0
  114. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/prepare.ts +98 -0
  115. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/update-comment-link.ts +245 -0
  116. package/bin/_internal/integrations/github/claude-code-action/src/github/api/client.ts +23 -0
  117. package/bin/_internal/integrations/github/claude-code-action/src/github/api/config.ts +4 -0
  118. package/bin/_internal/integrations/github/claude-code-action/src/github/api/queries/github.ts +117 -0
  119. package/bin/_internal/integrations/github/claude-code-action/src/github/context.ts +277 -0
  120. package/bin/_internal/integrations/github/claude-code-action/src/github/data/fetcher.ts +233 -0
  121. package/bin/_internal/integrations/github/claude-code-action/src/github/data/formatter.ts +144 -0
  122. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/branch-cleanup.ts +132 -0
  123. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/branch.ts +163 -0
  124. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comment-logic.ts +203 -0
  125. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/common.ts +33 -0
  126. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/create-initial.ts +111 -0
  127. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/update-claude-comment.ts +70 -0
  128. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/update-with-branch.ts +57 -0
  129. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/git-config.ts +62 -0
  130. package/bin/_internal/integrations/github/claude-code-action/src/github/token.ts +108 -0
  131. package/bin/_internal/integrations/github/claude-code-action/src/github/types.ts +98 -0
  132. package/bin/_internal/integrations/github/claude-code-action/src/github/utils/image-downloader.ts +246 -0
  133. package/bin/_internal/integrations/github/claude-code-action/src/github/utils/sanitizer.ts +100 -0
  134. package/bin/_internal/integrations/github/claude-code-action/src/github/validation/actor.ts +64 -0
  135. package/bin/_internal/integrations/github/claude-code-action/src/github/validation/permissions.ts +47 -0
  136. package/bin/_internal/integrations/github/claude-code-action/src/github/validation/trigger.ts +148 -0
  137. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-actions-server.ts +279 -0
  138. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-comment-server.ts +101 -0
  139. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-file-ops-server.ts +677 -0
  140. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-inline-comment-server.ts +184 -0
  141. package/bin/_internal/integrations/github/claude-code-action/src/mcp/install-mcp-server.ts +201 -0
  142. package/bin/_internal/integrations/github/claude-code-action/src/modes/agent/index.ts +152 -0
  143. package/bin/_internal/integrations/github/claude-code-action/src/modes/agent/parse-tools.ts +22 -0
  144. package/bin/_internal/integrations/github/claude-code-action/src/modes/detector.ts +66 -0
  145. package/bin/_internal/integrations/github/claude-code-action/src/modes/registry.ts +54 -0
  146. package/bin/_internal/integrations/github/claude-code-action/src/modes/tag/index.ts +187 -0
  147. package/bin/_internal/integrations/github/claude-code-action/src/modes/types.ts +100 -0
  148. package/bin/_internal/integrations/github/claude-code-action/src/prepare/index.ts +20 -0
  149. package/bin/_internal/integrations/github/claude-code-action/src/prepare/types.ts +20 -0
  150. package/bin/_internal/integrations/github/claude-code-action/src/utils/retry.ts +40 -0
  151. package/bin/_internal/integrations/github/claude-code-action/tsconfig.json +30 -0
  152. package/bin/_internal/integrations/n8n/.prettierrc +10 -0
  153. package/bin/_internal/integrations/n8n/LICENSE +21 -0
  154. package/bin/_internal/integrations/n8n/README.md +298 -0
  155. package/bin/_internal/integrations/n8n/package-lock.json +2989 -0
  156. package/bin/_internal/integrations/n8n/package.json +68 -0
  157. package/bin/_internal/jiter/jiter.cpython-312-darwin.so +0 -0
  158. package/bin/_internal/libbz2.dylib +0 -0
  159. package/bin/_internal/libcom_err.3.0.dylib +0 -0
  160. package/bin/_internal/libcrypto.3.dylib +0 -0
  161. package/bin/_internal/libexpat.1.dylib +0 -0
  162. package/bin/_internal/libffi.8.dylib +0 -0
  163. package/bin/_internal/libgssapi_krb5.2.2.dylib +0 -0
  164. package/bin/_internal/libintl.8.dylib +0 -0
  165. package/bin/_internal/libk5crypto.3.1.dylib +0 -0
  166. package/bin/_internal/libkrb5.3.3.dylib +0 -0
  167. package/bin/_internal/libkrb5support.1.1.dylib +0 -0
  168. package/bin/_internal/liblzma.5.dylib +0 -0
  169. package/bin/_internal/libncursesw.6.dylib +0 -0
  170. package/bin/_internal/libpq.5.dylib +0 -0
  171. package/bin/_internal/libpython3.12.dylib +0 -0
  172. package/bin/_internal/libreadline.8.dylib +0 -0
  173. package/bin/_internal/libsqlite3.dylib +0 -0
  174. package/bin/_internal/libssl.3.dylib +0 -0
  175. package/bin/_internal/libtinfow.6.dylib +0 -0
  176. package/bin/_internal/libz.1.dylib +0 -0
  177. package/bin/_internal/mcp-1.9.4.dist-info/INSTALLER +1 -0
  178. package/bin/_internal/mcp-1.9.4.dist-info/METADATA +939 -0
  179. package/bin/_internal/mcp-1.9.4.dist-info/RECORD +154 -0
  180. package/bin/_internal/mcp-1.9.4.dist-info/WHEEL +4 -0
  181. package/bin/_internal/mcp-1.9.4.dist-info/entry_points.txt +2 -0
  182. package/bin/_internal/mcp-1.9.4.dist-info/licenses/LICENSE +21 -0
  183. package/bin/_internal/multidict/_multidict.cpython-312-darwin.so +0 -0
  184. package/bin/_internal/propcache/_helpers_c.cpython-312-darwin.so +0 -0
  185. package/bin/_internal/psycopg2/.dylibs/libcom_err.3.0.dylib +0 -0
  186. package/bin/_internal/psycopg2/.dylibs/libcrypto.3.dylib +0 -0
  187. package/bin/_internal/psycopg2/.dylibs/libgssapi_krb5.2.2.dylib +0 -0
  188. package/bin/_internal/psycopg2/.dylibs/libintl.8.dylib +0 -0
  189. package/bin/_internal/psycopg2/.dylibs/libk5crypto.3.1.dylib +0 -0
  190. package/bin/_internal/psycopg2/.dylibs/libkrb5.3.3.dylib +0 -0
  191. package/bin/_internal/psycopg2/.dylibs/libkrb5support.1.1.dylib +0 -0
  192. package/bin/_internal/psycopg2/.dylibs/libpq.5.dylib +0 -0
  193. package/bin/_internal/psycopg2/.dylibs/libssl.3.dylib +0 -0
  194. package/bin/_internal/psycopg2/_psycopg.cpython-312-darwin.so +0 -0
  195. package/bin/_internal/pydantic_core/_pydantic_core.cpython-312-darwin.so +0 -0
  196. package/bin/_internal/python3.12/lib-dynload/_asyncio.cpython-312-darwin.so +0 -0
  197. package/bin/_internal/python3.12/lib-dynload/_bisect.cpython-312-darwin.so +0 -0
  198. package/bin/_internal/python3.12/lib-dynload/_blake2.cpython-312-darwin.so +0 -0
  199. package/bin/_internal/python3.12/lib-dynload/_bz2.cpython-312-darwin.so +0 -0
  200. package/bin/_internal/python3.12/lib-dynload/_codecs_cn.cpython-312-darwin.so +0 -0
  201. package/bin/_internal/python3.12/lib-dynload/_codecs_hk.cpython-312-darwin.so +0 -0
  202. package/bin/_internal/python3.12/lib-dynload/_codecs_iso2022.cpython-312-darwin.so +0 -0
  203. package/bin/_internal/python3.12/lib-dynload/_codecs_jp.cpython-312-darwin.so +0 -0
  204. package/bin/_internal/python3.12/lib-dynload/_codecs_kr.cpython-312-darwin.so +0 -0
  205. package/bin/_internal/python3.12/lib-dynload/_codecs_tw.cpython-312-darwin.so +0 -0
  206. package/bin/_internal/python3.12/lib-dynload/_contextvars.cpython-312-darwin.so +0 -0
  207. package/bin/_internal/python3.12/lib-dynload/_csv.cpython-312-darwin.so +0 -0
  208. package/bin/_internal/python3.12/lib-dynload/_ctypes.cpython-312-darwin.so +0 -0
  209. package/bin/_internal/python3.12/lib-dynload/_datetime.cpython-312-darwin.so +0 -0
  210. package/bin/_internal/python3.12/lib-dynload/_decimal.cpython-312-darwin.so +0 -0
  211. package/bin/_internal/python3.12/lib-dynload/_hashlib.cpython-312-darwin.so +0 -0
  212. package/bin/_internal/python3.12/lib-dynload/_heapq.cpython-312-darwin.so +0 -0
  213. package/bin/_internal/python3.12/lib-dynload/_json.cpython-312-darwin.so +0 -0
  214. package/bin/_internal/python3.12/lib-dynload/_lzma.cpython-312-darwin.so +0 -0
  215. package/bin/_internal/python3.12/lib-dynload/_md5.cpython-312-darwin.so +0 -0
  216. package/bin/_internal/python3.12/lib-dynload/_multibytecodec.cpython-312-darwin.so +0 -0
  217. package/bin/_internal/python3.12/lib-dynload/_multiprocessing.cpython-312-darwin.so +0 -0
  218. package/bin/_internal/python3.12/lib-dynload/_opcode.cpython-312-darwin.so +0 -0
  219. package/bin/_internal/python3.12/lib-dynload/_pickle.cpython-312-darwin.so +0 -0
  220. package/bin/_internal/python3.12/lib-dynload/_posixshmem.cpython-312-darwin.so +0 -0
  221. package/bin/_internal/python3.12/lib-dynload/_posixsubprocess.cpython-312-darwin.so +0 -0
  222. package/bin/_internal/python3.12/lib-dynload/_queue.cpython-312-darwin.so +0 -0
  223. package/bin/_internal/python3.12/lib-dynload/_random.cpython-312-darwin.so +0 -0
  224. package/bin/_internal/python3.12/lib-dynload/_scproxy.cpython-312-darwin.so +0 -0
  225. package/bin/_internal/python3.12/lib-dynload/_sha1.cpython-312-darwin.so +0 -0
  226. package/bin/_internal/python3.12/lib-dynload/_sha2.cpython-312-darwin.so +0 -0
  227. package/bin/_internal/python3.12/lib-dynload/_sha3.cpython-312-darwin.so +0 -0
  228. package/bin/_internal/python3.12/lib-dynload/_socket.cpython-312-darwin.so +0 -0
  229. package/bin/_internal/python3.12/lib-dynload/_sqlite3.cpython-312-darwin.so +0 -0
  230. package/bin/_internal/python3.12/lib-dynload/_ssl.cpython-312-darwin.so +0 -0
  231. package/bin/_internal/python3.12/lib-dynload/_statistics.cpython-312-darwin.so +0 -0
  232. package/bin/_internal/python3.12/lib-dynload/_struct.cpython-312-darwin.so +0 -0
  233. package/bin/_internal/python3.12/lib-dynload/_uuid.cpython-312-darwin.so +0 -0
  234. package/bin/_internal/python3.12/lib-dynload/_zoneinfo.cpython-312-darwin.so +0 -0
  235. package/bin/_internal/python3.12/lib-dynload/array.cpython-312-darwin.so +0 -0
  236. package/bin/_internal/python3.12/lib-dynload/binascii.cpython-312-darwin.so +0 -0
  237. package/bin/_internal/python3.12/lib-dynload/fcntl.cpython-312-darwin.so +0 -0
  238. package/bin/_internal/python3.12/lib-dynload/grp.cpython-312-darwin.so +0 -0
  239. package/bin/_internal/python3.12/lib-dynload/math.cpython-312-darwin.so +0 -0
  240. package/bin/_internal/python3.12/lib-dynload/mmap.cpython-312-darwin.so +0 -0
  241. package/bin/_internal/python3.12/lib-dynload/pyexpat.cpython-312-darwin.so +0 -0
  242. package/bin/_internal/python3.12/lib-dynload/readline.cpython-312-darwin.so +0 -0
  243. package/bin/_internal/python3.12/lib-dynload/resource.cpython-312-darwin.so +0 -0
  244. package/bin/_internal/python3.12/lib-dynload/select.cpython-312-darwin.so +0 -0
  245. package/bin/_internal/python3.12/lib-dynload/syslog.cpython-312-darwin.so +0 -0
  246. package/bin/_internal/python3.12/lib-dynload/termios.cpython-312-darwin.so +0 -0
  247. package/bin/_internal/python3.12/lib-dynload/unicodedata.cpython-312-darwin.so +0 -0
  248. package/bin/_internal/python3.12/lib-dynload/zlib.cpython-312-darwin.so +0 -0
  249. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/INSTALLER +1 -0
  250. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/METADATA +133 -0
  251. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/RECORD +21 -0
  252. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/REQUESTED +0 -0
  253. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/WHEEL +5 -0
  254. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/licenses/LICENSE +73 -0
  255. package/bin/_internal/setuptools/_vendor/importlib_metadata-8.7.1.dist-info/top_level.txt +1 -0
  256. package/bin/_internal/setuptools/_vendor/jaraco/text/Lorem ipsum.txt +2 -0
  257. package/bin/_internal/sqlalchemy/cyextension/collections.cpython-312-darwin.so +0 -0
  258. package/bin/_internal/sqlalchemy/cyextension/immutabledict.cpython-312-darwin.so +0 -0
  259. package/bin/_internal/sqlalchemy/cyextension/processors.cpython-312-darwin.so +0 -0
  260. package/bin/_internal/sqlalchemy/cyextension/resultproxy.cpython-312-darwin.so +0 -0
  261. package/bin/_internal/sqlalchemy/cyextension/util.cpython-312-darwin.so +0 -0
  262. package/bin/_internal/uvloop/loop.cpython-312-darwin.so +0 -0
  263. package/bin/_internal/vicoa/_bin/README.md +28 -0
  264. package/bin/_internal/vicoa-1.3.9.dist-info/INSTALLER +1 -0
  265. package/bin/_internal/vicoa-1.3.9.dist-info/METADATA +311 -0
  266. package/bin/_internal/vicoa-1.3.9.dist-info/RECORD +11 -0
  267. package/bin/_internal/vicoa-1.3.9.dist-info/REQUESTED +0 -0
  268. package/bin/_internal/vicoa-1.3.9.dist-info/WHEEL +5 -0
  269. package/bin/_internal/vicoa-1.3.9.dist-info/direct_url.json +1 -0
  270. package/bin/_internal/vicoa-1.3.9.dist-info/entry_points.txt +2 -0
  271. package/bin/_internal/vicoa-1.3.9.dist-info/licenses/LICENSE +201 -0
  272. package/bin/_internal/vicoa-1.3.9.dist-info/top_level.txt +3 -0
  273. package/bin/_internal/watchfiles/_rust_notify.cpython-312-darwin.so +0 -0
  274. package/bin/_internal/websockets/speedups.cpython-312-darwin.so +0 -0
  275. package/bin/_internal/websockets-14.2.dist-info/INSTALLER +1 -0
  276. package/bin/_internal/websockets-14.2.dist-info/LICENSE +24 -0
  277. package/bin/_internal/websockets-14.2.dist-info/METADATA +178 -0
  278. package/bin/_internal/websockets-14.2.dist-info/RECORD +98 -0
  279. package/bin/_internal/websockets-14.2.dist-info/WHEEL +5 -0
  280. package/bin/_internal/websockets-14.2.dist-info/top_level.txt +1 -0
  281. package/bin/_internal/yaml/_yaml.cpython-312-darwin.so +0 -0
  282. package/bin/_internal/yarl/_quoting_c.cpython-312-darwin.so +0 -0
  283. package/bin/_internal/zstandard/_cffi.cpython-312-darwin.so +0 -0
  284. package/bin/_internal/zstandard/backend_c.cpython-312-darwin.so +0 -0
  285. package/bin/vicoa +0 -0
  286. package/package.json +10 -17
  287. package/README.md +0 -57
  288. package/bin/vicoa.js +0 -38
@@ -0,0 +1,677 @@
1
+ #!/usr/bin/env node
2
+ // GitHub File Operations MCP Server
3
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
+ import { z } from "zod";
6
+ import { readFile, stat } from "fs/promises";
7
+ import { join } from "path";
8
+ import { constants } from "fs";
9
+ import fetch from "node-fetch";
10
+ import { GITHUB_API_URL } from "../github/api/config";
11
+ import { retryWithBackoff } from "../utils/retry";
12
+
13
+ type GitHubRef = {
14
+ object: {
15
+ sha: string;
16
+ };
17
+ };
18
+
19
+ type GitHubCommit = {
20
+ tree: {
21
+ sha: string;
22
+ };
23
+ };
24
+
25
+ type GitHubTree = {
26
+ sha: string;
27
+ };
28
+
29
+ type GitHubNewCommit = {
30
+ sha: string;
31
+ message: string;
32
+ author: {
33
+ name: string;
34
+ date: string;
35
+ };
36
+ };
37
+
38
+ // Get repository information from environment variables
39
+ const REPO_OWNER = process.env.REPO_OWNER;
40
+ const REPO_NAME = process.env.REPO_NAME;
41
+ const BRANCH_NAME = process.env.BRANCH_NAME;
42
+ const REPO_DIR = process.env.REPO_DIR || process.cwd();
43
+
44
+ if (!REPO_OWNER || !REPO_NAME || !BRANCH_NAME) {
45
+ console.error(
46
+ "Error: REPO_OWNER, REPO_NAME, and BRANCH_NAME environment variables are required",
47
+ );
48
+ process.exit(1);
49
+ }
50
+
51
+ const server = new McpServer({
52
+ name: "GitHub File Operations Server",
53
+ version: "0.0.1",
54
+ });
55
+
56
+ // Helper function to get or create branch reference
57
+ async function getOrCreateBranchRef(
58
+ owner: string,
59
+ repo: string,
60
+ branch: string,
61
+ githubToken: string,
62
+ ): Promise<string> {
63
+ // Try to get the branch reference
64
+ const refUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/refs/heads/${branch}`;
65
+ const refResponse = await fetch(refUrl, {
66
+ headers: {
67
+ Accept: "application/vnd.github+json",
68
+ Authorization: `Bearer ${githubToken}`,
69
+ "X-GitHub-Api-Version": "2022-11-28",
70
+ },
71
+ });
72
+
73
+ if (refResponse.ok) {
74
+ const refData = (await refResponse.json()) as GitHubRef;
75
+ return refData.object.sha;
76
+ }
77
+
78
+ if (refResponse.status !== 404) {
79
+ throw new Error(`Failed to get branch reference: ${refResponse.status}`);
80
+ }
81
+
82
+ const baseBranch = process.env.BASE_BRANCH!;
83
+
84
+ // Get the SHA of the base branch
85
+ const baseRefUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/refs/heads/${baseBranch}`;
86
+ const baseRefResponse = await fetch(baseRefUrl, {
87
+ headers: {
88
+ Accept: "application/vnd.github+json",
89
+ Authorization: `Bearer ${githubToken}`,
90
+ "X-GitHub-Api-Version": "2022-11-28",
91
+ },
92
+ });
93
+
94
+ let baseSha: string;
95
+
96
+ if (!baseRefResponse.ok) {
97
+ // If base branch doesn't exist, try default branch
98
+ const repoUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}`;
99
+ const repoResponse = await fetch(repoUrl, {
100
+ headers: {
101
+ Accept: "application/vnd.github+json",
102
+ Authorization: `Bearer ${githubToken}`,
103
+ "X-GitHub-Api-Version": "2022-11-28",
104
+ },
105
+ });
106
+
107
+ if (!repoResponse.ok) {
108
+ throw new Error(`Failed to get repository info: ${repoResponse.status}`);
109
+ }
110
+
111
+ const repoData = (await repoResponse.json()) as {
112
+ default_branch: string;
113
+ };
114
+ const defaultBranch = repoData.default_branch;
115
+
116
+ // Try default branch
117
+ const defaultRefUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/refs/heads/${defaultBranch}`;
118
+ const defaultRefResponse = await fetch(defaultRefUrl, {
119
+ headers: {
120
+ Accept: "application/vnd.github+json",
121
+ Authorization: `Bearer ${githubToken}`,
122
+ "X-GitHub-Api-Version": "2022-11-28",
123
+ },
124
+ });
125
+
126
+ if (!defaultRefResponse.ok) {
127
+ throw new Error(
128
+ `Failed to get default branch reference: ${defaultRefResponse.status}`,
129
+ );
130
+ }
131
+
132
+ const defaultRefData = (await defaultRefResponse.json()) as GitHubRef;
133
+ baseSha = defaultRefData.object.sha;
134
+ } else {
135
+ const baseRefData = (await baseRefResponse.json()) as GitHubRef;
136
+ baseSha = baseRefData.object.sha;
137
+ }
138
+
139
+ // Create the new branch using the same pattern as octokit
140
+ const createRefUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/refs`;
141
+ const createRefResponse = await fetch(createRefUrl, {
142
+ method: "POST",
143
+ headers: {
144
+ Accept: "application/vnd.github+json",
145
+ Authorization: `Bearer ${githubToken}`,
146
+ "X-GitHub-Api-Version": "2022-11-28",
147
+ "Content-Type": "application/json",
148
+ },
149
+ body: JSON.stringify({
150
+ ref: `refs/heads/${branch}`,
151
+ sha: baseSha,
152
+ }),
153
+ });
154
+
155
+ if (!createRefResponse.ok) {
156
+ const errorText = await createRefResponse.text();
157
+ throw new Error(
158
+ `Failed to create branch: ${createRefResponse.status} - ${errorText}`,
159
+ );
160
+ }
161
+
162
+ console.log(`Successfully created branch ${branch}`);
163
+ return baseSha;
164
+ }
165
+
166
+ // Get the appropriate Git file mode for a file
167
+ async function getFileMode(filePath: string): Promise<string> {
168
+ try {
169
+ const fileStat = await stat(filePath);
170
+ if (fileStat.isFile()) {
171
+ // Check if execute bit is set for user
172
+ if (fileStat.mode & constants.S_IXUSR) {
173
+ return "100755"; // Executable file
174
+ } else {
175
+ return "100644"; // Regular file
176
+ }
177
+ } else if (fileStat.isDirectory()) {
178
+ return "040000"; // Directory (tree)
179
+ } else if (fileStat.isSymbolicLink()) {
180
+ return "120000"; // Symbolic link
181
+ } else {
182
+ // Fallback for unknown file types
183
+ return "100644";
184
+ }
185
+ } catch (error) {
186
+ // If we can't stat the file, default to regular file
187
+ console.warn(
188
+ `Could not determine file mode for ${filePath}, using default: ${error}`,
189
+ );
190
+ return "100644";
191
+ }
192
+ }
193
+
194
+ // Commit files tool
195
+ server.tool(
196
+ "commit_files",
197
+ "Commit one or more files to a repository in a single commit (this will commit them atomically in the remote repository)",
198
+ {
199
+ files: z
200
+ .array(z.string())
201
+ .describe(
202
+ 'Array of file paths relative to repository root (e.g. ["src/main.js", "README.md"]). All files must exist locally.',
203
+ ),
204
+ message: z.string().describe("Commit message"),
205
+ },
206
+ async ({ files, message }) => {
207
+ const owner = REPO_OWNER;
208
+ const repo = REPO_NAME;
209
+ const branch = BRANCH_NAME;
210
+ try {
211
+ const githubToken = process.env.GITHUB_TOKEN;
212
+ if (!githubToken) {
213
+ throw new Error("GITHUB_TOKEN environment variable is required");
214
+ }
215
+
216
+ const processedFiles = files.map((filePath) => {
217
+ if (filePath.startsWith("/")) {
218
+ return filePath.slice(1);
219
+ }
220
+ return filePath;
221
+ });
222
+
223
+ // 1. Get the branch reference (create if doesn't exist)
224
+ const baseSha = await getOrCreateBranchRef(
225
+ owner,
226
+ repo,
227
+ branch,
228
+ githubToken,
229
+ );
230
+
231
+ // 2. Get the base commit
232
+ const commitUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/commits/${baseSha}`;
233
+ const commitResponse = await fetch(commitUrl, {
234
+ headers: {
235
+ Accept: "application/vnd.github+json",
236
+ Authorization: `Bearer ${githubToken}`,
237
+ "X-GitHub-Api-Version": "2022-11-28",
238
+ },
239
+ });
240
+
241
+ if (!commitResponse.ok) {
242
+ throw new Error(`Failed to get base commit: ${commitResponse.status}`);
243
+ }
244
+
245
+ const commitData = (await commitResponse.json()) as GitHubCommit;
246
+ const baseTreeSha = commitData.tree.sha;
247
+
248
+ // 3. Create tree entries for all files
249
+ const treeEntries = await Promise.all(
250
+ processedFiles.map(async (filePath) => {
251
+ const fullPath = filePath.startsWith("/")
252
+ ? filePath
253
+ : join(REPO_DIR, filePath);
254
+
255
+ // Get the proper file mode based on file permissions
256
+ const fileMode = await getFileMode(fullPath);
257
+
258
+ // Check if file is binary (images, etc.)
259
+ const isBinaryFile =
260
+ /\.(png|jpg|jpeg|gif|webp|ico|pdf|zip|tar|gz|exe|bin|woff|woff2|ttf|eot)$/i.test(
261
+ filePath,
262
+ );
263
+
264
+ if (isBinaryFile) {
265
+ // For binary files, create a blob first using the Blobs API
266
+ const binaryContent = await readFile(fullPath);
267
+
268
+ // Create blob using Blobs API (supports encoding parameter)
269
+ const blobUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/blobs`;
270
+ const blobResponse = await fetch(blobUrl, {
271
+ method: "POST",
272
+ headers: {
273
+ Accept: "application/vnd.github+json",
274
+ Authorization: `Bearer ${githubToken}`,
275
+ "X-GitHub-Api-Version": "2022-11-28",
276
+ "Content-Type": "application/json",
277
+ },
278
+ body: JSON.stringify({
279
+ content: binaryContent.toString("base64"),
280
+ encoding: "base64",
281
+ }),
282
+ });
283
+
284
+ if (!blobResponse.ok) {
285
+ const errorText = await blobResponse.text();
286
+ throw new Error(
287
+ `Failed to create blob for ${filePath}: ${blobResponse.status} - ${errorText}`,
288
+ );
289
+ }
290
+
291
+ const blobData = (await blobResponse.json()) as { sha: string };
292
+
293
+ // Return tree entry with blob SHA
294
+ return {
295
+ path: filePath,
296
+ mode: fileMode,
297
+ type: "blob",
298
+ sha: blobData.sha,
299
+ };
300
+ } else {
301
+ // For text files, include content directly in tree
302
+ const content = await readFile(fullPath, "utf-8");
303
+ return {
304
+ path: filePath,
305
+ mode: fileMode,
306
+ type: "blob",
307
+ content: content,
308
+ };
309
+ }
310
+ }),
311
+ );
312
+
313
+ // 4. Create a new tree
314
+ const treeUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/trees`;
315
+ const treeResponse = await fetch(treeUrl, {
316
+ method: "POST",
317
+ headers: {
318
+ Accept: "application/vnd.github+json",
319
+ Authorization: `Bearer ${githubToken}`,
320
+ "X-GitHub-Api-Version": "2022-11-28",
321
+ "Content-Type": "application/json",
322
+ },
323
+ body: JSON.stringify({
324
+ base_tree: baseTreeSha,
325
+ tree: treeEntries,
326
+ }),
327
+ });
328
+
329
+ if (!treeResponse.ok) {
330
+ const errorText = await treeResponse.text();
331
+ throw new Error(
332
+ `Failed to create tree: ${treeResponse.status} - ${errorText}`,
333
+ );
334
+ }
335
+
336
+ const treeData = (await treeResponse.json()) as GitHubTree;
337
+
338
+ // 5. Create a new commit
339
+ const newCommitUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/commits`;
340
+ const newCommitResponse = await fetch(newCommitUrl, {
341
+ method: "POST",
342
+ headers: {
343
+ Accept: "application/vnd.github+json",
344
+ Authorization: `Bearer ${githubToken}`,
345
+ "X-GitHub-Api-Version": "2022-11-28",
346
+ "Content-Type": "application/json",
347
+ },
348
+ body: JSON.stringify({
349
+ message: message,
350
+ tree: treeData.sha,
351
+ parents: [baseSha],
352
+ }),
353
+ });
354
+
355
+ if (!newCommitResponse.ok) {
356
+ const errorText = await newCommitResponse.text();
357
+ throw new Error(
358
+ `Failed to create commit: ${newCommitResponse.status} - ${errorText}`,
359
+ );
360
+ }
361
+
362
+ const newCommitData = (await newCommitResponse.json()) as GitHubNewCommit;
363
+
364
+ // 6. Update the reference to point to the new commit
365
+ const updateRefUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/refs/heads/${branch}`;
366
+
367
+ // We're seeing intermittent 403 "Resource not accessible by integration" errors
368
+ // on certain repos when updating git references. These appear to be transient
369
+ // GitHub API issues that succeed on retry.
370
+ await retryWithBackoff(
371
+ async () => {
372
+ const updateRefResponse = await fetch(updateRefUrl, {
373
+ method: "PATCH",
374
+ headers: {
375
+ Accept: "application/vnd.github+json",
376
+ Authorization: `Bearer ${githubToken}`,
377
+ "X-GitHub-Api-Version": "2022-11-28",
378
+ "Content-Type": "application/json",
379
+ },
380
+ body: JSON.stringify({
381
+ sha: newCommitData.sha,
382
+ force: false,
383
+ }),
384
+ });
385
+
386
+ if (!updateRefResponse.ok) {
387
+ const errorText = await updateRefResponse.text();
388
+
389
+ // Provide a more helpful error message for 403 permission errors
390
+ if (updateRefResponse.status === 403) {
391
+ const permissionError = new Error(
392
+ `Permission denied: Unable to push commits to branch '${branch}'. ` +
393
+ `Please rebase your branch from the main/master branch to allow Claude to commit.\n\n` +
394
+ `Original error: ${errorText}`,
395
+ );
396
+ throw permissionError;
397
+ }
398
+
399
+ // For other errors, use the original message
400
+ const error = new Error(
401
+ `Failed to update reference: ${updateRefResponse.status} - ${errorText}`,
402
+ );
403
+
404
+ // For non-403 errors, fail immediately without retry
405
+ console.error("Non-retryable error:", updateRefResponse.status);
406
+ throw error;
407
+ }
408
+ },
409
+ {
410
+ maxAttempts: 3,
411
+ initialDelayMs: 1000, // Start with 1 second delay
412
+ maxDelayMs: 5000, // Max 5 seconds delay
413
+ backoffFactor: 2, // Double the delay each time
414
+ },
415
+ );
416
+
417
+ const simplifiedResult = {
418
+ commit: {
419
+ sha: newCommitData.sha,
420
+ message: newCommitData.message,
421
+ author: newCommitData.author.name,
422
+ date: newCommitData.author.date,
423
+ },
424
+ files: processedFiles.map((path) => ({ path })),
425
+ tree: {
426
+ sha: treeData.sha,
427
+ },
428
+ };
429
+
430
+ return {
431
+ content: [
432
+ {
433
+ type: "text",
434
+ text: JSON.stringify(simplifiedResult, null, 2),
435
+ },
436
+ ],
437
+ };
438
+ } catch (error) {
439
+ const errorMessage =
440
+ error instanceof Error ? error.message : String(error);
441
+ return {
442
+ content: [
443
+ {
444
+ type: "text",
445
+ text: `Error: ${errorMessage}`,
446
+ },
447
+ ],
448
+ error: errorMessage,
449
+ isError: true,
450
+ };
451
+ }
452
+ },
453
+ );
454
+
455
+ // Delete files tool
456
+ server.tool(
457
+ "delete_files",
458
+ "Delete one or more files from a repository in a single commit",
459
+ {
460
+ paths: z
461
+ .array(z.string())
462
+ .describe(
463
+ 'Array of file paths to delete relative to repository root (e.g. ["src/old-file.js", "docs/deprecated.md"])',
464
+ ),
465
+ message: z.string().describe("Commit message"),
466
+ },
467
+ async ({ paths, message }) => {
468
+ const owner = REPO_OWNER;
469
+ const repo = REPO_NAME;
470
+ const branch = BRANCH_NAME;
471
+ try {
472
+ const githubToken = process.env.GITHUB_TOKEN;
473
+ if (!githubToken) {
474
+ throw new Error("GITHUB_TOKEN environment variable is required");
475
+ }
476
+
477
+ // Convert absolute paths to relative if they match CWD
478
+ const cwd = process.cwd();
479
+ const processedPaths = paths.map((filePath) => {
480
+ if (filePath.startsWith("/")) {
481
+ if (filePath.startsWith(cwd)) {
482
+ // Strip CWD from absolute path
483
+ return filePath.slice(cwd.length + 1);
484
+ } else {
485
+ throw new Error(
486
+ `Path '${filePath}' must be relative to repository root or within current working directory`,
487
+ );
488
+ }
489
+ }
490
+ return filePath;
491
+ });
492
+
493
+ // 1. Get the branch reference (create if doesn't exist)
494
+ const baseSha = await getOrCreateBranchRef(
495
+ owner,
496
+ repo,
497
+ branch,
498
+ githubToken,
499
+ );
500
+
501
+ // 2. Get the base commit
502
+ const commitUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/commits/${baseSha}`;
503
+ const commitResponse = await fetch(commitUrl, {
504
+ headers: {
505
+ Accept: "application/vnd.github+json",
506
+ Authorization: `Bearer ${githubToken}`,
507
+ "X-GitHub-Api-Version": "2022-11-28",
508
+ },
509
+ });
510
+
511
+ if (!commitResponse.ok) {
512
+ throw new Error(`Failed to get base commit: ${commitResponse.status}`);
513
+ }
514
+
515
+ const commitData = (await commitResponse.json()) as GitHubCommit;
516
+ const baseTreeSha = commitData.tree.sha;
517
+
518
+ // 3. Create tree entries for file deletions (setting SHA to null)
519
+ const treeEntries = processedPaths.map((path) => ({
520
+ path: path,
521
+ mode: "100644",
522
+ type: "blob" as const,
523
+ sha: null,
524
+ }));
525
+
526
+ // 4. Create a new tree with deletions
527
+ const treeUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/trees`;
528
+ const treeResponse = await fetch(treeUrl, {
529
+ method: "POST",
530
+ headers: {
531
+ Accept: "application/vnd.github+json",
532
+ Authorization: `Bearer ${githubToken}`,
533
+ "X-GitHub-Api-Version": "2022-11-28",
534
+ "Content-Type": "application/json",
535
+ },
536
+ body: JSON.stringify({
537
+ base_tree: baseTreeSha,
538
+ tree: treeEntries,
539
+ }),
540
+ });
541
+
542
+ if (!treeResponse.ok) {
543
+ const errorText = await treeResponse.text();
544
+ throw new Error(
545
+ `Failed to create tree: ${treeResponse.status} - ${errorText}`,
546
+ );
547
+ }
548
+
549
+ const treeData = (await treeResponse.json()) as GitHubTree;
550
+
551
+ // 5. Create a new commit
552
+ const newCommitUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/commits`;
553
+ const newCommitResponse = await fetch(newCommitUrl, {
554
+ method: "POST",
555
+ headers: {
556
+ Accept: "application/vnd.github+json",
557
+ Authorization: `Bearer ${githubToken}`,
558
+ "X-GitHub-Api-Version": "2022-11-28",
559
+ "Content-Type": "application/json",
560
+ },
561
+ body: JSON.stringify({
562
+ message: message,
563
+ tree: treeData.sha,
564
+ parents: [baseSha],
565
+ }),
566
+ });
567
+
568
+ if (!newCommitResponse.ok) {
569
+ const errorText = await newCommitResponse.text();
570
+ throw new Error(
571
+ `Failed to create commit: ${newCommitResponse.status} - ${errorText}`,
572
+ );
573
+ }
574
+
575
+ const newCommitData = (await newCommitResponse.json()) as GitHubNewCommit;
576
+
577
+ // 6. Update the reference to point to the new commit
578
+ const updateRefUrl = `${GITHUB_API_URL}/repos/${owner}/${repo}/git/refs/heads/${branch}`;
579
+
580
+ // We're seeing intermittent 403 "Resource not accessible by integration" errors
581
+ // on certain repos when updating git references. These appear to be transient
582
+ // GitHub API issues that succeed on retry.
583
+ await retryWithBackoff(
584
+ async () => {
585
+ const updateRefResponse = await fetch(updateRefUrl, {
586
+ method: "PATCH",
587
+ headers: {
588
+ Accept: "application/vnd.github+json",
589
+ Authorization: `Bearer ${githubToken}`,
590
+ "X-GitHub-Api-Version": "2022-11-28",
591
+ "Content-Type": "application/json",
592
+ },
593
+ body: JSON.stringify({
594
+ sha: newCommitData.sha,
595
+ force: false,
596
+ }),
597
+ });
598
+
599
+ if (!updateRefResponse.ok) {
600
+ const errorText = await updateRefResponse.text();
601
+
602
+ // Provide a more helpful error message for 403 permission errors
603
+ if (updateRefResponse.status === 403) {
604
+ console.log("Received 403 error, will retry...");
605
+ const permissionError = new Error(
606
+ `Permission denied: Unable to push commits to branch '${branch}'. ` +
607
+ `Please rebase your branch from the main/master branch to allow Claude to commit.\n\n` +
608
+ `Original error: ${errorText}`,
609
+ );
610
+ throw permissionError;
611
+ }
612
+
613
+ // For other errors, use the original message
614
+ const error = new Error(
615
+ `Failed to update reference: ${updateRefResponse.status} - ${errorText}`,
616
+ );
617
+
618
+ // For non-403 errors, fail immediately without retry
619
+ console.error("Non-retryable error:", updateRefResponse.status);
620
+ throw error;
621
+ }
622
+ },
623
+ {
624
+ maxAttempts: 3,
625
+ initialDelayMs: 1000, // Start with 1 second delay
626
+ maxDelayMs: 5000, // Max 5 seconds delay
627
+ backoffFactor: 2, // Double the delay each time
628
+ },
629
+ );
630
+
631
+ const simplifiedResult = {
632
+ commit: {
633
+ sha: newCommitData.sha,
634
+ message: newCommitData.message,
635
+ author: newCommitData.author.name,
636
+ date: newCommitData.author.date,
637
+ },
638
+ deletedFiles: processedPaths.map((path) => ({ path })),
639
+ tree: {
640
+ sha: treeData.sha,
641
+ },
642
+ };
643
+
644
+ return {
645
+ content: [
646
+ {
647
+ type: "text",
648
+ text: JSON.stringify(simplifiedResult, null, 2),
649
+ },
650
+ ],
651
+ };
652
+ } catch (error) {
653
+ const errorMessage =
654
+ error instanceof Error ? error.message : String(error);
655
+ return {
656
+ content: [
657
+ {
658
+ type: "text",
659
+ text: `Error: ${errorMessage}`,
660
+ },
661
+ ],
662
+ error: errorMessage,
663
+ isError: true,
664
+ };
665
+ }
666
+ },
667
+ );
668
+
669
+ async function runServer() {
670
+ const transport = new StdioServerTransport();
671
+ await server.connect(transport);
672
+ process.on("exit", () => {
673
+ server.close();
674
+ });
675
+ }
676
+
677
+ runServer().catch(console.error);