@vicoa/cli 1.3.11-linux-x64 → 1.3.11

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 (301) hide show
  1. package/README.md +82 -0
  2. package/bin/vicoa.js +38 -0
  3. package/package.json +29 -10
  4. package/bin/_internal/81d243bd2c585b0f4821__mypyc.cpython-312-x86_64-linux-gnu.so +0 -0
  5. package/bin/_internal/_cffi_backend.cpython-312-x86_64-linux-gnu.so +0 -0
  6. package/bin/_internal/aiofile-3.9.0.dist-info/INSTALLER +0 -1
  7. package/bin/_internal/aiofile-3.9.0.dist-info/LICENCE +0 -195
  8. package/bin/_internal/aiofile-3.9.0.dist-info/LICENCE.md +0 -195
  9. package/bin/_internal/aiofile-3.9.0.dist-info/METADATA +0 -492
  10. package/bin/_internal/aiofile-3.9.0.dist-info/RECORD +0 -15
  11. package/bin/_internal/aiofile-3.9.0.dist-info/WHEEL +0 -4
  12. package/bin/_internal/aiohttp/_http_parser.cpython-312-x86_64-linux-gnu.so +0 -0
  13. package/bin/_internal/aiohttp/_http_writer.cpython-312-x86_64-linux-gnu.so +0 -0
  14. package/bin/_internal/aiohttp/_websocket/mask.cpython-312-x86_64-linux-gnu.so +0 -0
  15. package/bin/_internal/aiohttp/_websocket/reader_c.cpython-312-x86_64-linux-gnu.so +0 -0
  16. package/bin/_internal/attrs-26.1.0.dist-info/INSTALLER +0 -1
  17. package/bin/_internal/attrs-26.1.0.dist-info/METADATA +0 -199
  18. package/bin/_internal/attrs-26.1.0.dist-info/RECORD +0 -55
  19. package/bin/_internal/attrs-26.1.0.dist-info/WHEEL +0 -4
  20. package/bin/_internal/attrs-26.1.0.dist-info/licenses/LICENSE +0 -21
  21. package/bin/_internal/base_library.zip +0 -0
  22. package/bin/_internal/caio/linux_aio.cpython-312-x86_64-linux-gnu.so +0 -0
  23. package/bin/_internal/caio/thread_aio.cpython-312-x86_64-linux-gnu.so +0 -0
  24. package/bin/_internal/certifi/cacert.pem +0 -4494
  25. package/bin/_internal/certifi/py.typed +0 -0
  26. package/bin/_internal/charset_normalizer/cd.cpython-312-x86_64-linux-gnu.so +0 -0
  27. package/bin/_internal/charset_normalizer/md.cpython-312-x86_64-linux-gnu.so +0 -0
  28. package/bin/_internal/click-8.3.2.dist-info/INSTALLER +0 -1
  29. package/bin/_internal/click-8.3.2.dist-info/METADATA +0 -84
  30. package/bin/_internal/click-8.3.2.dist-info/RECORD +0 -40
  31. package/bin/_internal/click-8.3.2.dist-info/WHEEL +0 -4
  32. package/bin/_internal/click-8.3.2.dist-info/licenses/LICENSE.txt +0 -28
  33. package/bin/_internal/cryptography/hazmat/bindings/_rust.abi3.so +0 -0
  34. package/bin/_internal/cryptography-46.0.7.dist-info/INSTALLER +0 -1
  35. package/bin/_internal/cryptography-46.0.7.dist-info/METADATA +0 -139
  36. package/bin/_internal/cryptography-46.0.7.dist-info/RECORD +0 -180
  37. package/bin/_internal/cryptography-46.0.7.dist-info/WHEEL +0 -5
  38. package/bin/_internal/cryptography-46.0.7.dist-info/licenses/LICENSE +0 -3
  39. package/bin/_internal/cryptography-46.0.7.dist-info/licenses/LICENSE.APACHE +0 -202
  40. package/bin/_internal/cryptography-46.0.7.dist-info/licenses/LICENSE.BSD +0 -27
  41. package/bin/_internal/email_validator-2.3.0.dist-info/INSTALLER +0 -1
  42. package/bin/_internal/email_validator-2.3.0.dist-info/METADATA +0 -466
  43. package/bin/_internal/email_validator-2.3.0.dist-info/RECORD +0 -27
  44. package/bin/_internal/email_validator-2.3.0.dist-info/WHEEL +0 -5
  45. package/bin/_internal/email_validator-2.3.0.dist-info/entry_points.txt +0 -2
  46. package/bin/_internal/email_validator-2.3.0.dist-info/licenses/LICENSE +0 -27
  47. package/bin/_internal/email_validator-2.3.0.dist-info/top_level.txt +0 -1
  48. package/bin/_internal/frozenlist/_frozenlist.cpython-312-x86_64-linux-gnu.so +0 -0
  49. package/bin/_internal/importlib_metadata-8.7.1.dist-info/INSTALLER +0 -1
  50. package/bin/_internal/importlib_metadata-8.7.1.dist-info/METADATA +0 -133
  51. package/bin/_internal/importlib_metadata-8.7.1.dist-info/RECORD +0 -33
  52. package/bin/_internal/importlib_metadata-8.7.1.dist-info/WHEEL +0 -5
  53. package/bin/_internal/importlib_metadata-8.7.1.dist-info/licenses/LICENSE +0 -73
  54. package/bin/_internal/importlib_metadata-8.7.1.dist-info/top_level.txt +0 -1
  55. package/bin/_internal/integrations/cli_wrappers/IMPORTANT_USE_CASES.md +0 -33
  56. package/bin/_internal/integrations/github/claude-code-action/CLAUDE.md +0 -136
  57. package/bin/_internal/integrations/github/claude-code-action/CODE_OF_CONDUCT.md +0 -128
  58. package/bin/_internal/integrations/github/claude-code-action/CONTRIBUTING.md +0 -116
  59. package/bin/_internal/integrations/github/claude-code-action/LICENSE +0 -21
  60. package/bin/_internal/integrations/github/claude-code-action/README.md +0 -53
  61. package/bin/_internal/integrations/github/claude-code-action/ROADMAP.md +0 -20
  62. package/bin/_internal/integrations/github/claude-code-action/SECURITY.md +0 -15
  63. package/bin/_internal/integrations/github/claude-code-action/action.yml +0 -294
  64. package/bin/_internal/integrations/github/claude-code-action/base-action/CLAUDE.md +0 -60
  65. package/bin/_internal/integrations/github/claude-code-action/base-action/CODE_OF_CONDUCT.md +0 -128
  66. package/bin/_internal/integrations/github/claude-code-action/base-action/CONTRIBUTING.md +0 -136
  67. package/bin/_internal/integrations/github/claude-code-action/base-action/LICENSE +0 -21
  68. package/bin/_internal/integrations/github/claude-code-action/base-action/MIRROR_DISCLAIMER.md +0 -11
  69. package/bin/_internal/integrations/github/claude-code-action/base-action/README.md +0 -521
  70. package/bin/_internal/integrations/github/claude-code-action/base-action/action.yml +0 -149
  71. package/bin/_internal/integrations/github/claude-code-action/base-action/bun.lock +0 -54
  72. package/bin/_internal/integrations/github/claude-code-action/base-action/examples/issue-triage.yml +0 -108
  73. package/bin/_internal/integrations/github/claude-code-action/base-action/package.json +0 -23
  74. package/bin/_internal/integrations/github/claude-code-action/base-action/scripts/install-hooks.sh +0 -13
  75. package/bin/_internal/integrations/github/claude-code-action/base-action/scripts/pre-push +0 -46
  76. package/bin/_internal/integrations/github/claude-code-action/base-action/src/index.ts +0 -82
  77. package/bin/_internal/integrations/github/claude-code-action/base-action/src/prepare-prompt.ts +0 -82
  78. package/bin/_internal/integrations/github/claude-code-action/base-action/src/run-claude.ts +0 -257
  79. package/bin/_internal/integrations/github/claude-code-action/base-action/src/run-vicoa.ts +0 -301
  80. package/bin/_internal/integrations/github/claude-code-action/base-action/src/setup-claude-code-settings.ts +0 -68
  81. package/bin/_internal/integrations/github/claude-code-action/base-action/src/validate-env.ts +0 -54
  82. package/bin/_internal/integrations/github/claude-code-action/base-action/test-local.sh +0 -12
  83. package/bin/_internal/integrations/github/claude-code-action/base-action/test-mcp-local.sh +0 -18
  84. package/bin/_internal/integrations/github/claude-code-action/base-action/tsconfig.json +0 -30
  85. package/bin/_internal/integrations/github/claude-code-action/bun.lock +0 -384
  86. package/bin/_internal/integrations/github/claude-code-action/docs/capabilities-and-limitations.md +0 -33
  87. package/bin/_internal/integrations/github/claude-code-action/docs/cloud-providers.md +0 -99
  88. package/bin/_internal/integrations/github/claude-code-action/docs/configuration.md +0 -345
  89. package/bin/_internal/integrations/github/claude-code-action/docs/custom-automations.md +0 -113
  90. package/bin/_internal/integrations/github/claude-code-action/docs/experimental.md +0 -128
  91. package/bin/_internal/integrations/github/claude-code-action/docs/faq.md +0 -205
  92. package/bin/_internal/integrations/github/claude-code-action/docs/migration-guide.md +0 -261
  93. package/bin/_internal/integrations/github/claude-code-action/docs/security.md +0 -38
  94. package/bin/_internal/integrations/github/claude-code-action/docs/setup.md +0 -146
  95. package/bin/_internal/integrations/github/claude-code-action/docs/usage.md +0 -213
  96. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci/auto-fix-ci.yml +0 -97
  97. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci/commands/fix-ci.md +0 -127
  98. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci-signed/auto-fix-ci-signed.yml +0 -97
  99. package/bin/_internal/integrations/github/claude-code-action/examples/auto-fix-ci-signed/commands/fix-ci-signed.md +0 -148
  100. package/bin/_internal/integrations/github/claude-code-action/examples/issue-deduplication.yml +0 -63
  101. package/bin/_internal/integrations/github/claude-code-action/examples/issue-triage.yml +0 -75
  102. package/bin/_internal/integrations/github/claude-code-action/examples/vicoa.yml +0 -75
  103. package/bin/_internal/integrations/github/claude-code-action/package.json +0 -31
  104. package/bin/_internal/integrations/github/claude-code-action/scripts/install-hooks.sh +0 -13
  105. package/bin/_internal/integrations/github/claude-code-action/scripts/pre-commit +0 -46
  106. package/bin/_internal/integrations/github/claude-code-action/scripts/setup-network-restrictions.sh +0 -123
  107. package/bin/_internal/integrations/github/claude-code-action/src/create-prompt/index.ts +0 -799
  108. package/bin/_internal/integrations/github/claude-code-action/src/create-prompt/types.ts +0 -102
  109. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/collect-inputs.ts +0 -58
  110. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/format-turns.ts +0 -465
  111. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/prepare.ts +0 -98
  112. package/bin/_internal/integrations/github/claude-code-action/src/entrypoints/update-comment-link.ts +0 -245
  113. package/bin/_internal/integrations/github/claude-code-action/src/github/api/client.ts +0 -23
  114. package/bin/_internal/integrations/github/claude-code-action/src/github/api/config.ts +0 -4
  115. package/bin/_internal/integrations/github/claude-code-action/src/github/api/queries/github.ts +0 -117
  116. package/bin/_internal/integrations/github/claude-code-action/src/github/context.ts +0 -277
  117. package/bin/_internal/integrations/github/claude-code-action/src/github/data/fetcher.ts +0 -233
  118. package/bin/_internal/integrations/github/claude-code-action/src/github/data/formatter.ts +0 -144
  119. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/branch-cleanup.ts +0 -132
  120. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/branch.ts +0 -163
  121. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comment-logic.ts +0 -203
  122. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/common.ts +0 -33
  123. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/create-initial.ts +0 -111
  124. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/update-claude-comment.ts +0 -70
  125. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/comments/update-with-branch.ts +0 -57
  126. package/bin/_internal/integrations/github/claude-code-action/src/github/operations/git-config.ts +0 -62
  127. package/bin/_internal/integrations/github/claude-code-action/src/github/token.ts +0 -108
  128. package/bin/_internal/integrations/github/claude-code-action/src/github/types.ts +0 -98
  129. package/bin/_internal/integrations/github/claude-code-action/src/github/utils/image-downloader.ts +0 -246
  130. package/bin/_internal/integrations/github/claude-code-action/src/github/utils/sanitizer.ts +0 -100
  131. package/bin/_internal/integrations/github/claude-code-action/src/github/validation/actor.ts +0 -64
  132. package/bin/_internal/integrations/github/claude-code-action/src/github/validation/permissions.ts +0 -47
  133. package/bin/_internal/integrations/github/claude-code-action/src/github/validation/trigger.ts +0 -148
  134. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-actions-server.ts +0 -279
  135. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-comment-server.ts +0 -101
  136. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-file-ops-server.ts +0 -677
  137. package/bin/_internal/integrations/github/claude-code-action/src/mcp/github-inline-comment-server.ts +0 -184
  138. package/bin/_internal/integrations/github/claude-code-action/src/mcp/install-mcp-server.ts +0 -201
  139. package/bin/_internal/integrations/github/claude-code-action/src/modes/agent/index.ts +0 -152
  140. package/bin/_internal/integrations/github/claude-code-action/src/modes/agent/parse-tools.ts +0 -22
  141. package/bin/_internal/integrations/github/claude-code-action/src/modes/detector.ts +0 -66
  142. package/bin/_internal/integrations/github/claude-code-action/src/modes/registry.ts +0 -54
  143. package/bin/_internal/integrations/github/claude-code-action/src/modes/tag/index.ts +0 -187
  144. package/bin/_internal/integrations/github/claude-code-action/src/modes/types.ts +0 -100
  145. package/bin/_internal/integrations/github/claude-code-action/src/prepare/index.ts +0 -20
  146. package/bin/_internal/integrations/github/claude-code-action/src/prepare/types.ts +0 -20
  147. package/bin/_internal/integrations/github/claude-code-action/src/utils/retry.ts +0 -40
  148. package/bin/_internal/integrations/github/claude-code-action/tsconfig.json +0 -30
  149. package/bin/_internal/integrations/n8n/LICENSE +0 -21
  150. package/bin/_internal/integrations/n8n/README.md +0 -298
  151. package/bin/_internal/integrations/n8n/package-lock.json +0 -2989
  152. package/bin/_internal/integrations/n8n/package.json +0 -68
  153. package/bin/_internal/integrations/n8n/src/credentials/OmnaraApi.credentials.ts +0 -52
  154. package/bin/_internal/integrations/n8n/src/nodes/Omnara/Omnara.node.json +0 -35
  155. package/bin/_internal/integrations/n8n/src/nodes/Omnara/Omnara.node.ts +0 -304
  156. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/message/index.ts +0 -37
  157. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/message/send.operation.ts +0 -151
  158. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/message/sendAndWait.operation.ts +0 -252
  159. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/session/end.operation.ts +0 -56
  160. package/bin/_internal/integrations/n8n/src/nodes/Omnara/actions/session/index.ts +0 -29
  161. package/bin/_internal/integrations/n8n/src/nodes/Omnara/vicoa.png +0 -0
  162. package/bin/_internal/integrations/n8n/src/utils/GenericFunctions.ts +0 -93
  163. package/bin/_internal/integrations/n8n/src/utils/sendAndWait/configureWaitTillDate.ts +0 -42
  164. package/bin/_internal/integrations/n8n/src/utils/sendAndWait/descriptions.ts +0 -20
  165. package/bin/_internal/integrations/n8n/src/utils/sendAndWaitWebhook.ts +0 -72
  166. package/bin/_internal/integrations/n8n/tsconfig.json +0 -20
  167. package/bin/_internal/jiter/jiter.cpython-312-x86_64-linux-gnu.so +0 -0
  168. package/bin/_internal/jsonschema/benchmarks/issue232/issue.json +0 -2653
  169. package/bin/_internal/jsonschema-4.26.0.dist-info/INSTALLER +0 -1
  170. package/bin/_internal/jsonschema-4.26.0.dist-info/METADATA +0 -170
  171. package/bin/_internal/jsonschema-4.26.0.dist-info/RECORD +0 -82
  172. package/bin/_internal/jsonschema-4.26.0.dist-info/WHEEL +0 -4
  173. package/bin/_internal/jsonschema-4.26.0.dist-info/entry_points.txt +0 -2
  174. package/bin/_internal/jsonschema-4.26.0.dist-info/licenses/COPYING +0 -19
  175. package/bin/_internal/jsonschema_specifications/schemas/draft201909/metaschema.json +0 -42
  176. package/bin/_internal/jsonschema_specifications/schemas/draft201909/vocabularies/applicator +0 -56
  177. package/bin/_internal/jsonschema_specifications/schemas/draft201909/vocabularies/content +0 -17
  178. package/bin/_internal/jsonschema_specifications/schemas/draft201909/vocabularies/core +0 -57
  179. package/bin/_internal/jsonschema_specifications/schemas/draft201909/vocabularies/format +0 -14
  180. package/bin/_internal/jsonschema_specifications/schemas/draft201909/vocabularies/meta-data +0 -37
  181. package/bin/_internal/jsonschema_specifications/schemas/draft201909/vocabularies/validation +0 -98
  182. package/bin/_internal/jsonschema_specifications/schemas/draft202012/metaschema.json +0 -58
  183. package/bin/_internal/jsonschema_specifications/schemas/draft202012/vocabularies/applicator +0 -48
  184. package/bin/_internal/jsonschema_specifications/schemas/draft202012/vocabularies/content +0 -17
  185. package/bin/_internal/jsonschema_specifications/schemas/draft202012/vocabularies/core +0 -51
  186. package/bin/_internal/jsonschema_specifications/schemas/draft202012/vocabularies/format-annotation +0 -14
  187. package/bin/_internal/jsonschema_specifications/schemas/draft202012/vocabularies/format-assertion +0 -14
  188. package/bin/_internal/jsonschema_specifications/schemas/draft202012/vocabularies/meta-data +0 -37
  189. package/bin/_internal/jsonschema_specifications/schemas/draft202012/vocabularies/unevaluated +0 -15
  190. package/bin/_internal/jsonschema_specifications/schemas/draft202012/vocabularies/validation +0 -98
  191. package/bin/_internal/jsonschema_specifications/schemas/draft3/metaschema.json +0 -172
  192. package/bin/_internal/jsonschema_specifications/schemas/draft4/metaschema.json +0 -149
  193. package/bin/_internal/jsonschema_specifications/schemas/draft6/metaschema.json +0 -153
  194. package/bin/_internal/jsonschema_specifications/schemas/draft7/metaschema.json +0 -166
  195. package/bin/_internal/libbz2.so.1.0 +0 -0
  196. package/bin/_internal/libcrypto.so.3 +0 -0
  197. package/bin/_internal/libffi.so.8 +0 -0
  198. package/bin/_internal/libgcc_s.so.1 +0 -0
  199. package/bin/_internal/liblzma.so.5 +0 -0
  200. package/bin/_internal/libpython3.12.so.1.0 +0 -0
  201. package/bin/_internal/libreadline.so.8 +0 -0
  202. package/bin/_internal/libssl.so.3 +0 -0
  203. package/bin/_internal/libstdc++.so.6 +0 -0
  204. package/bin/_internal/libtinfo.so.6 +0 -0
  205. package/bin/_internal/libuuid.so.1 +0 -0
  206. package/bin/_internal/libz.so.1 +0 -0
  207. package/bin/_internal/mcp-1.27.0.dist-info/INSTALLER +0 -1
  208. package/bin/_internal/mcp-1.27.0.dist-info/METADATA +0 -230
  209. package/bin/_internal/mcp-1.27.0.dist-info/RECORD +0 -226
  210. package/bin/_internal/mcp-1.27.0.dist-info/WHEEL +0 -4
  211. package/bin/_internal/mcp-1.27.0.dist-info/entry_points.txt +0 -2
  212. package/bin/_internal/mcp-1.27.0.dist-info/licenses/LICENSE +0 -21
  213. package/bin/_internal/multidict/_multidict.cpython-312-x86_64-linux-gnu.so +0 -0
  214. package/bin/_internal/opentelemetry_api-1.41.0.dist-info/INSTALLER +0 -1
  215. package/bin/_internal/opentelemetry_api-1.41.0.dist-info/METADATA +0 -45
  216. package/bin/_internal/opentelemetry_api-1.41.0.dist-info/RECORD +0 -81
  217. package/bin/_internal/opentelemetry_api-1.41.0.dist-info/WHEEL +0 -4
  218. package/bin/_internal/opentelemetry_api-1.41.0.dist-info/entry_points.txt +0 -15
  219. package/bin/_internal/opentelemetry_api-1.41.0.dist-info/licenses/LICENSE +0 -201
  220. package/bin/_internal/propcache/_helpers_c.cpython-312-x86_64-linux-gnu.so +0 -0
  221. package/bin/_internal/pydantic-2.13.2.dist-info/INSTALLER +0 -1
  222. package/bin/_internal/pydantic-2.13.2.dist-info/METADATA +0 -1269
  223. package/bin/_internal/pydantic-2.13.2.dist-info/RECORD +0 -217
  224. package/bin/_internal/pydantic-2.13.2.dist-info/WHEEL +0 -4
  225. package/bin/_internal/pydantic-2.13.2.dist-info/licenses/LICENSE +0 -21
  226. package/bin/_internal/pydantic_core/_pydantic_core.cpython-312-x86_64-linux-gnu.so +0 -0
  227. package/bin/_internal/python3.12/lib-dynload/_asyncio.cpython-312-x86_64-linux-gnu.so +0 -0
  228. package/bin/_internal/python3.12/lib-dynload/_bisect.cpython-312-x86_64-linux-gnu.so +0 -0
  229. package/bin/_internal/python3.12/lib-dynload/_blake2.cpython-312-x86_64-linux-gnu.so +0 -0
  230. package/bin/_internal/python3.12/lib-dynload/_bz2.cpython-312-x86_64-linux-gnu.so +0 -0
  231. package/bin/_internal/python3.12/lib-dynload/_codecs_cn.cpython-312-x86_64-linux-gnu.so +0 -0
  232. package/bin/_internal/python3.12/lib-dynload/_codecs_hk.cpython-312-x86_64-linux-gnu.so +0 -0
  233. package/bin/_internal/python3.12/lib-dynload/_codecs_iso2022.cpython-312-x86_64-linux-gnu.so +0 -0
  234. package/bin/_internal/python3.12/lib-dynload/_codecs_jp.cpython-312-x86_64-linux-gnu.so +0 -0
  235. package/bin/_internal/python3.12/lib-dynload/_codecs_kr.cpython-312-x86_64-linux-gnu.so +0 -0
  236. package/bin/_internal/python3.12/lib-dynload/_codecs_tw.cpython-312-x86_64-linux-gnu.so +0 -0
  237. package/bin/_internal/python3.12/lib-dynload/_contextvars.cpython-312-x86_64-linux-gnu.so +0 -0
  238. package/bin/_internal/python3.12/lib-dynload/_csv.cpython-312-x86_64-linux-gnu.so +0 -0
  239. package/bin/_internal/python3.12/lib-dynload/_ctypes.cpython-312-x86_64-linux-gnu.so +0 -0
  240. package/bin/_internal/python3.12/lib-dynload/_datetime.cpython-312-x86_64-linux-gnu.so +0 -0
  241. package/bin/_internal/python3.12/lib-dynload/_decimal.cpython-312-x86_64-linux-gnu.so +0 -0
  242. package/bin/_internal/python3.12/lib-dynload/_hashlib.cpython-312-x86_64-linux-gnu.so +0 -0
  243. package/bin/_internal/python3.12/lib-dynload/_heapq.cpython-312-x86_64-linux-gnu.so +0 -0
  244. package/bin/_internal/python3.12/lib-dynload/_json.cpython-312-x86_64-linux-gnu.so +0 -0
  245. package/bin/_internal/python3.12/lib-dynload/_lzma.cpython-312-x86_64-linux-gnu.so +0 -0
  246. package/bin/_internal/python3.12/lib-dynload/_md5.cpython-312-x86_64-linux-gnu.so +0 -0
  247. package/bin/_internal/python3.12/lib-dynload/_multibytecodec.cpython-312-x86_64-linux-gnu.so +0 -0
  248. package/bin/_internal/python3.12/lib-dynload/_multiprocessing.cpython-312-x86_64-linux-gnu.so +0 -0
  249. package/bin/_internal/python3.12/lib-dynload/_opcode.cpython-312-x86_64-linux-gnu.so +0 -0
  250. package/bin/_internal/python3.12/lib-dynload/_pickle.cpython-312-x86_64-linux-gnu.so +0 -0
  251. package/bin/_internal/python3.12/lib-dynload/_posixshmem.cpython-312-x86_64-linux-gnu.so +0 -0
  252. package/bin/_internal/python3.12/lib-dynload/_posixsubprocess.cpython-312-x86_64-linux-gnu.so +0 -0
  253. package/bin/_internal/python3.12/lib-dynload/_queue.cpython-312-x86_64-linux-gnu.so +0 -0
  254. package/bin/_internal/python3.12/lib-dynload/_random.cpython-312-x86_64-linux-gnu.so +0 -0
  255. package/bin/_internal/python3.12/lib-dynload/_sha1.cpython-312-x86_64-linux-gnu.so +0 -0
  256. package/bin/_internal/python3.12/lib-dynload/_sha2.cpython-312-x86_64-linux-gnu.so +0 -0
  257. package/bin/_internal/python3.12/lib-dynload/_sha3.cpython-312-x86_64-linux-gnu.so +0 -0
  258. package/bin/_internal/python3.12/lib-dynload/_socket.cpython-312-x86_64-linux-gnu.so +0 -0
  259. package/bin/_internal/python3.12/lib-dynload/_ssl.cpython-312-x86_64-linux-gnu.so +0 -0
  260. package/bin/_internal/python3.12/lib-dynload/_statistics.cpython-312-x86_64-linux-gnu.so +0 -0
  261. package/bin/_internal/python3.12/lib-dynload/_struct.cpython-312-x86_64-linux-gnu.so +0 -0
  262. package/bin/_internal/python3.12/lib-dynload/_uuid.cpython-312-x86_64-linux-gnu.so +0 -0
  263. package/bin/_internal/python3.12/lib-dynload/_zoneinfo.cpython-312-x86_64-linux-gnu.so +0 -0
  264. package/bin/_internal/python3.12/lib-dynload/array.cpython-312-x86_64-linux-gnu.so +0 -0
  265. package/bin/_internal/python3.12/lib-dynload/binascii.cpython-312-x86_64-linux-gnu.so +0 -0
  266. package/bin/_internal/python3.12/lib-dynload/fcntl.cpython-312-x86_64-linux-gnu.so +0 -0
  267. package/bin/_internal/python3.12/lib-dynload/grp.cpython-312-x86_64-linux-gnu.so +0 -0
  268. package/bin/_internal/python3.12/lib-dynload/math.cpython-312-x86_64-linux-gnu.so +0 -0
  269. package/bin/_internal/python3.12/lib-dynload/mmap.cpython-312-x86_64-linux-gnu.so +0 -0
  270. package/bin/_internal/python3.12/lib-dynload/pyexpat.cpython-312-x86_64-linux-gnu.so +0 -0
  271. package/bin/_internal/python3.12/lib-dynload/readline.cpython-312-x86_64-linux-gnu.so +0 -0
  272. package/bin/_internal/python3.12/lib-dynload/resource.cpython-312-x86_64-linux-gnu.so +0 -0
  273. package/bin/_internal/python3.12/lib-dynload/select.cpython-312-x86_64-linux-gnu.so +0 -0
  274. package/bin/_internal/python3.12/lib-dynload/syslog.cpython-312-x86_64-linux-gnu.so +0 -0
  275. package/bin/_internal/python3.12/lib-dynload/termios.cpython-312-x86_64-linux-gnu.so +0 -0
  276. package/bin/_internal/python3.12/lib-dynload/unicodedata.cpython-312-x86_64-linux-gnu.so +0 -0
  277. package/bin/_internal/python3.12/lib-dynload/zlib.cpython-312-x86_64-linux-gnu.so +0 -0
  278. package/bin/_internal/rpds/rpds.cpython-312-x86_64-linux-gnu.so +0 -0
  279. package/bin/_internal/setuptools/_vendor/jaraco/text/Lorem ipsum.txt +0 -2
  280. package/bin/_internal/vicoa/_bin/README.md +0 -28
  281. package/bin/_internal/vicoa-1.3.10.dist-info/INSTALLER +0 -1
  282. package/bin/_internal/vicoa-1.3.10.dist-info/METADATA +0 -311
  283. package/bin/_internal/vicoa-1.3.10.dist-info/RECORD +0 -11
  284. package/bin/_internal/vicoa-1.3.10.dist-info/REQUESTED +0 -0
  285. package/bin/_internal/vicoa-1.3.10.dist-info/WHEEL +0 -5
  286. package/bin/_internal/vicoa-1.3.10.dist-info/direct_url.json +0 -1
  287. package/bin/_internal/vicoa-1.3.10.dist-info/entry_points.txt +0 -2
  288. package/bin/_internal/vicoa-1.3.10.dist-info/licenses/LICENSE +0 -201
  289. package/bin/_internal/vicoa-1.3.10.dist-info/top_level.txt +0 -3
  290. package/bin/_internal/watchfiles/_rust_notify.cpython-312-x86_64-linux-gnu.so +0 -0
  291. package/bin/_internal/websockets/speedups.cpython-312-x86_64-linux-gnu.so +0 -0
  292. package/bin/_internal/websockets-16.0.dist-info/INSTALLER +0 -1
  293. package/bin/_internal/websockets-16.0.dist-info/METADATA +0 -179
  294. package/bin/_internal/websockets-16.0.dist-info/RECORD +0 -108
  295. package/bin/_internal/websockets-16.0.dist-info/WHEEL +0 -7
  296. package/bin/_internal/websockets-16.0.dist-info/entry_points.txt +0 -2
  297. package/bin/_internal/websockets-16.0.dist-info/licenses/LICENSE +0 -24
  298. package/bin/_internal/websockets-16.0.dist-info/top_level.txt +0 -1
  299. package/bin/_internal/yaml/_yaml.cpython-312-x86_64-linux-gnu.so +0 -0
  300. package/bin/_internal/yarl/_quoting_c.cpython-312-x86_64-linux-gnu.so +0 -0
  301. package/bin/vicoa +0 -0
@@ -1,677 +0,0 @@
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);