Reworking.
Testing / prettier (push) Failing after 2m15s
Testing / unit-test (20.x) (push) Failing after 4m4s
Testing / e2e-test (20.x) (push) Failing after 5m14s

This commit is contained in:
2026-01-04 10:42:46 -05:00
parent a2c0b16a14
commit 90bef91543
6 changed files with 5159 additions and 2727 deletions
+2
View File
@@ -47761,8 +47761,10 @@ var package_default = {
"@azure/openai": "^1.0.0-beta.12",
"@clack/prompts": "^0.6.1",
"@dqbd/tiktoken": "^1.0.2",
"@go-gitea/sdk.js": "^0.1.4",
"@google/generative-ai": "^0.11.4",
"@mistralai/mistralai": "^1.3.5",
"@octokit/rest": "^22.0.1",
"@octokit/webhooks-schemas": "^6.11.0",
"@octokit/webhooks-types": "^6.11.0",
axios: "^1.3.4",
+4546 -2397
View File
File diff suppressed because it is too large Load Diff
+440
View File
@@ -16,8 +16,10 @@
"@azure/openai": "^1.0.0-beta.12",
"@clack/prompts": "^0.6.1",
"@dqbd/tiktoken": "^1.0.2",
"@go-gitea/sdk.js": "^0.1.4",
"@google/generative-ai": "^0.11.4",
"@mistralai/mistralai": "^1.3.5",
"@octokit/rest": "^22.0.1",
"@octokit/webhooks-schemas": "^6.11.0",
"@octokit/webhooks-types": "^6.11.0",
"axios": "^1.3.4",
@@ -1394,6 +1396,256 @@
"node": ">=14"
}
},
"node_modules/@go-gitea/sdk.js": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/@go-gitea/sdk.js/-/sdk.js-0.1.4.tgz",
"integrity": "sha512-S2a2bzk4jY6+f20/huzqvx1dYrtyVTWnC6g4Agbt7pfpiCRZ0VuixpXE08/7ZNs+a75BC7XSvtUQ/6JOhmWI/Q==",
"license": "MIT",
"dependencies": {
"@octokit/core": "^7.0.2",
"@octokit/plugin-paginate-rest": "^13.0.0",
"@octokit/plugin-retry": "^8.0.1",
"@octokit/request-error": "^7.0.0",
"@octokit/types": "^15.0.0"
},
"engines": {
"node": ">= 20"
},
"peerDependencies": {
"@octokit/core": ">=7.0.0"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/auth-token": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz",
"integrity": "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w==",
"license": "MIT",
"engines": {
"node": ">= 20"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/core": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.6.tgz",
"integrity": "sha512-DhGl4xMVFGVIyMwswXeyzdL4uXD5OGILGX5N8Y+f6W7LhC1Ze2poSNrkF/fedpVDHEEZ+PHFW0vL14I+mm8K3Q==",
"license": "MIT",
"dependencies": {
"@octokit/auth-token": "^6.0.0",
"@octokit/graphql": "^9.0.3",
"@octokit/request": "^10.0.6",
"@octokit/request-error": "^7.0.2",
"@octokit/types": "^16.0.0",
"before-after-hook": "^4.0.0",
"universal-user-agent": "^7.0.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/core/node_modules/@octokit/openapi-types": {
"version": "27.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz",
"integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==",
"license": "MIT"
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/core/node_modules/@octokit/types": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^27.0.0"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/endpoint": {
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-11.0.2.tgz",
"integrity": "sha512-4zCpzP1fWc7QlqunZ5bSEjxc6yLAlRTnDwKtgXfcI/FxxGoqedDG8V2+xJ60bV2kODqcGB+nATdtap/XYq2NZQ==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^16.0.0",
"universal-user-agent": "^7.0.2"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/endpoint/node_modules/@octokit/openapi-types": {
"version": "27.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz",
"integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==",
"license": "MIT"
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/endpoint/node_modules/@octokit/types": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^27.0.0"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/graphql": {
"version": "9.0.3",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-9.0.3.tgz",
"integrity": "sha512-grAEuupr/C1rALFnXTv6ZQhFuL1D8G5y8CN04RgrO4FIPMrtm+mcZzFG7dcBm+nq+1ppNixu+Jd78aeJOYxlGA==",
"license": "MIT",
"dependencies": {
"@octokit/request": "^10.0.6",
"@octokit/types": "^16.0.0",
"universal-user-agent": "^7.0.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/graphql/node_modules/@octokit/openapi-types": {
"version": "27.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz",
"integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==",
"license": "MIT"
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/graphql/node_modules/@octokit/types": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^27.0.0"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/openapi-types": {
"version": "26.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-26.0.0.tgz",
"integrity": "sha512-7AtcfKtpo77j7Ts73b4OWhOZHTKo/gGY8bB3bNBQz4H+GRSWqx2yvj8TXRsbdTE0eRmYmXOEY66jM7mJ7LzfsA==",
"license": "MIT"
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/plugin-paginate-rest": {
"version": "13.2.1",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-13.2.1.tgz",
"integrity": "sha512-Tj4PkZyIL6eBMYcG/76QGsedF0+dWVeLhYprTmuFVVxzDW7PQh23tM0TP0z+1MvSkxB29YFZwnUX+cXfTiSdyw==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^15.0.1"
},
"engines": {
"node": ">= 20"
},
"peerDependencies": {
"@octokit/core": ">=6"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/plugin-retry": {
"version": "8.0.3",
"resolved": "https://registry.npmjs.org/@octokit/plugin-retry/-/plugin-retry-8.0.3.tgz",
"integrity": "sha512-vKGx1i3MC0za53IzYBSBXcrhmd+daQDzuZfYDd52X5S0M2otf3kVZTVP8bLA3EkU0lTvd1WEC2OlNNa4G+dohA==",
"license": "MIT",
"dependencies": {
"@octokit/request-error": "^7.0.2",
"@octokit/types": "^16.0.0",
"bottleneck": "^2.15.3"
},
"engines": {
"node": ">= 20"
},
"peerDependencies": {
"@octokit/core": ">=7"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/plugin-retry/node_modules/@octokit/openapi-types": {
"version": "27.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz",
"integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==",
"license": "MIT"
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/plugin-retry/node_modules/@octokit/types": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^27.0.0"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/request": {
"version": "10.0.7",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.7.tgz",
"integrity": "sha512-v93h0i1yu4idj8qFPZwjehoJx4j3Ntn+JhXsdJrG9pYaX6j/XRz2RmasMUHtNgQD39nrv/VwTWSqK0RNXR8upA==",
"license": "MIT",
"dependencies": {
"@octokit/endpoint": "^11.0.2",
"@octokit/request-error": "^7.0.2",
"@octokit/types": "^16.0.0",
"fast-content-type-parse": "^3.0.0",
"universal-user-agent": "^7.0.2"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/request-error": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.1.0.tgz",
"integrity": "sha512-KMQIfq5sOPpkQYajXHwnhjCC0slzCNScLHs9JafXc4RAJI+9f+jNDlBNaIMTvazOPLgb4BnlhGJOTbnN0wIjPw==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^16.0.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/request-error/node_modules/@octokit/openapi-types": {
"version": "27.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz",
"integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==",
"license": "MIT"
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/request-error/node_modules/@octokit/types": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^27.0.0"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/request/node_modules/@octokit/openapi-types": {
"version": "27.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz",
"integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==",
"license": "MIT"
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/request/node_modules/@octokit/types": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^27.0.0"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/@octokit/types": {
"version": "15.0.2",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-15.0.2.tgz",
"integrity": "sha512-rR+5VRjhYSer7sC51krfCctQhVTmjyUMAaShfPB8mscVa8tSoLyon3coxQmXu0ahJoLVWl8dSGD/3OGZlFV44Q==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^26.0.0"
}
},
"node_modules/@go-gitea/sdk.js/node_modules/before-after-hook": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-4.0.0.tgz",
"integrity": "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ==",
"license": "Apache-2.0"
},
"node_modules/@go-gitea/sdk.js/node_modules/universal-user-agent": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz",
"integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==",
"license": "ISC"
},
"node_modules/@google/generative-ai": {
"version": "0.11.4",
"license": "Apache-2.0",
@@ -2406,6 +2658,172 @@
"node": ">= 18"
}
},
"node_modules/@octokit/rest": {
"version": "22.0.1",
"resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-22.0.1.tgz",
"integrity": "sha512-Jzbhzl3CEexhnivb1iQ0KJ7s5vvjMWcmRtq5aUsKmKDrRW6z3r84ngmiFKFvpZjpiU/9/S6ITPFRpn5s/3uQJw==",
"license": "MIT",
"dependencies": {
"@octokit/core": "^7.0.6",
"@octokit/plugin-paginate-rest": "^14.0.0",
"@octokit/plugin-request-log": "^6.0.0",
"@octokit/plugin-rest-endpoint-methods": "^17.0.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/rest/node_modules/@octokit/auth-token": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-6.0.0.tgz",
"integrity": "sha512-P4YJBPdPSpWTQ1NU4XYdvHvXJJDxM6YwpS0FZHRgP7YFkdVxsWcpWGy/NVqlAA7PcPCnMacXlRm1y2PFZRWL/w==",
"license": "MIT",
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/rest/node_modules/@octokit/core": {
"version": "7.0.6",
"resolved": "https://registry.npmjs.org/@octokit/core/-/core-7.0.6.tgz",
"integrity": "sha512-DhGl4xMVFGVIyMwswXeyzdL4uXD5OGILGX5N8Y+f6W7LhC1Ze2poSNrkF/fedpVDHEEZ+PHFW0vL14I+mm8K3Q==",
"license": "MIT",
"dependencies": {
"@octokit/auth-token": "^6.0.0",
"@octokit/graphql": "^9.0.3",
"@octokit/request": "^10.0.6",
"@octokit/request-error": "^7.0.2",
"@octokit/types": "^16.0.0",
"before-after-hook": "^4.0.0",
"universal-user-agent": "^7.0.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/rest/node_modules/@octokit/endpoint": {
"version": "11.0.2",
"resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-11.0.2.tgz",
"integrity": "sha512-4zCpzP1fWc7QlqunZ5bSEjxc6yLAlRTnDwKtgXfcI/FxxGoqedDG8V2+xJ60bV2kODqcGB+nATdtap/XYq2NZQ==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^16.0.0",
"universal-user-agent": "^7.0.2"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/rest/node_modules/@octokit/graphql": {
"version": "9.0.3",
"resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-9.0.3.tgz",
"integrity": "sha512-grAEuupr/C1rALFnXTv6ZQhFuL1D8G5y8CN04RgrO4FIPMrtm+mcZzFG7dcBm+nq+1ppNixu+Jd78aeJOYxlGA==",
"license": "MIT",
"dependencies": {
"@octokit/request": "^10.0.6",
"@octokit/types": "^16.0.0",
"universal-user-agent": "^7.0.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/rest/node_modules/@octokit/openapi-types": {
"version": "27.0.0",
"resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-27.0.0.tgz",
"integrity": "sha512-whrdktVs1h6gtR+09+QsNk2+FO+49j6ga1c55YZudfEG+oKJVvJLQi3zkOm5JjiUXAagWK2tI2kTGKJ2Ys7MGA==",
"license": "MIT"
},
"node_modules/@octokit/rest/node_modules/@octokit/plugin-paginate-rest": {
"version": "14.0.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-14.0.0.tgz",
"integrity": "sha512-fNVRE7ufJiAA3XUrha2omTA39M6IXIc6GIZLvlbsm8QOQCYvpq/LkMNGyFlB1d8hTDzsAXa3OKtybdMAYsV/fw==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^16.0.0"
},
"engines": {
"node": ">= 20"
},
"peerDependencies": {
"@octokit/core": ">=6"
}
},
"node_modules/@octokit/rest/node_modules/@octokit/plugin-request-log": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-request-log/-/plugin-request-log-6.0.0.tgz",
"integrity": "sha512-UkOzeEN3W91/eBq9sPZNQ7sUBvYCqYbrrD8gTbBuGtHEuycE4/awMXcYvx6sVYo7LypPhmQwwpUe4Yyu4QZN5Q==",
"license": "MIT",
"engines": {
"node": ">= 20"
},
"peerDependencies": {
"@octokit/core": ">=6"
}
},
"node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods": {
"version": "17.0.0",
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-17.0.0.tgz",
"integrity": "sha512-B5yCyIlOJFPqUUeiD0cnBJwWJO8lkJs5d8+ze9QDP6SvfiXSz1BF+91+0MeI1d2yxgOhU/O+CvtiZ9jSkHhFAw==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^16.0.0"
},
"engines": {
"node": ">= 20"
},
"peerDependencies": {
"@octokit/core": ">=6"
}
},
"node_modules/@octokit/rest/node_modules/@octokit/request": {
"version": "10.0.7",
"resolved": "https://registry.npmjs.org/@octokit/request/-/request-10.0.7.tgz",
"integrity": "sha512-v93h0i1yu4idj8qFPZwjehoJx4j3Ntn+JhXsdJrG9pYaX6j/XRz2RmasMUHtNgQD39nrv/VwTWSqK0RNXR8upA==",
"license": "MIT",
"dependencies": {
"@octokit/endpoint": "^11.0.2",
"@octokit/request-error": "^7.0.2",
"@octokit/types": "^16.0.0",
"fast-content-type-parse": "^3.0.0",
"universal-user-agent": "^7.0.2"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/rest/node_modules/@octokit/request-error": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-7.1.0.tgz",
"integrity": "sha512-KMQIfq5sOPpkQYajXHwnhjCC0slzCNScLHs9JafXc4RAJI+9f+jNDlBNaIMTvazOPLgb4BnlhGJOTbnN0wIjPw==",
"license": "MIT",
"dependencies": {
"@octokit/types": "^16.0.0"
},
"engines": {
"node": ">= 20"
}
},
"node_modules/@octokit/rest/node_modules/@octokit/types": {
"version": "16.0.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-16.0.0.tgz",
"integrity": "sha512-sKq+9r1Mm4efXW1FCk7hFSeJo4QKreL/tTbR0rz/qx/r1Oa2VV83LTA/H/MuCOX7uCIJmQVRKBcbmWoySjAnSg==",
"license": "MIT",
"dependencies": {
"@octokit/openapi-types": "^27.0.0"
}
},
"node_modules/@octokit/rest/node_modules/before-after-hook": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-4.0.0.tgz",
"integrity": "sha512-q6tR3RPqIB1pMiTRMFcZwuG5T8vwp+vUvEG0vuI6B+Rikh5BfPp2fQ82c925FOs+b0lcFQ8CFrL+KbilfZFhOQ==",
"license": "Apache-2.0"
},
"node_modules/@octokit/rest/node_modules/universal-user-agent": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-7.0.3.tgz",
"integrity": "sha512-TmnEAEAsBJVZM/AADELsK76llnwcf9vMKuPz8JflO1frO8Lchitr0fNaN9d+Ap0BjKtqWqd/J17qeDnXh8CL2A==",
"license": "ISC"
},
"node_modules/@octokit/types": {
"version": "13.10.0",
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.10.0.tgz",
@@ -3237,6 +3655,12 @@
"readable-stream": "^3.4.0"
}
},
"node_modules/bottleneck": {
"version": "2.19.5",
"resolved": "https://registry.npmjs.org/bottleneck/-/bottleneck-2.19.5.tgz",
"integrity": "sha512-VHiNCbI1lKdl44tGrhNfU3lup0Tj/ZBMJB5/2ZbNXRCPuRCO7ed2mgcK4r17y+KB2EfuYuRaVlwNbAeaWGSpbw==",
"license": "MIT"
},
"node_modules/brace-expansion": {
"version": "1.1.11",
"dev": true,
@@ -4318,6 +4742,22 @@
"node": ">=4"
}
},
"node_modules/fast-content-type-parse": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/fast-content-type-parse/-/fast-content-type-parse-3.0.0.tgz",
"integrity": "sha512-ZvLdcY8P+N8mGQJahJV5G4U88CSvT1rP8ApL6uETe88MBXrBHAkZlSEySdUlyztF7ccb+Znos3TFqaepHxdhBg==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/fastify"
},
{
"type": "opencollective",
"url": "https://opencollective.com/fastify"
}
],
"license": "MIT"
},
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"dev": true,
+2
View File
@@ -89,8 +89,10 @@
"@azure/openai": "^1.0.0-beta.12",
"@clack/prompts": "^0.6.1",
"@dqbd/tiktoken": "^1.0.2",
"@go-gitea/sdk.js": "^0.1.4",
"@google/generative-ai": "^0.11.4",
"@mistralai/mistralai": "^1.3.5",
"@octokit/rest": "^22.0.1",
"@octokit/webhooks-schemas": "^6.11.0",
"@octokit/webhooks-types": "^6.11.0",
"axios": "^1.3.4",
+157 -222
View File
@@ -1,23 +1,68 @@
import core from '@actions/core';
import exec from '@actions/exec';
import github from '@actions/github';
import { intro, outro } from '@clack/prompts';
import { PushEvent } from '@octokit/webhooks-types';
import { unlinkSync, writeFileSync } from 'fs';
import { Gitea } from '@go-gitea/sdk.js';
import * as core from '@actions/core';
import * as github from '@actions/github';
import { outro } from '@clack/prompts';
import { generateCommitMessageByDiff } from './generateCommitMessageFromGitDiff';
import { randomIntFromInterval } from './utils/randomIntFromInterval';
import { sleep } from './utils/sleep';
/* -------------------------------------------------------------------------- */
/* Types */
/* -------------------------------------------------------------------------- */
// This should be a token with access to your repository scoped in as a secret.
const GITHUB_TOKEN = core.getInput('GITHUB_TOKEN');
const PLATFORM = core.getInput('PLATFORM') || 'github';
const DRY_RUN = core.getInput('DRY_RUN') === 'true';
const GITEA_URL = core.getInput('GITEA_URL') || 'https://try.gitea.io';
// Initialize platform-specific clients
let octokit: ReturnType<typeof github.getOctokit>;
let giteaClient: any; // We'll initialize this properly below
if (PLATFORM === 'gitea' || PLATFORM === 'forgejo') {
// Dynamically import the Gitea client
try {
const GiteaClient = require('@go-gitea/sdk.js').GiteaClient;
giteaClient = new GiteaClient(GITEA_URL, {
token: GITHUB_TOKEN
});
} catch (error) {
core.error(`Failed to import Gitea client: ${error}`);
throw error;
}
} else {
octokit = github.getOctokit(GITHUB_TOKEN);
}
const context = github.context;
const owner = context.repo.owner;
const repo = context.repo.repo;
type SHA = string;
type Diff = string;
async function getCommitDiff(commitSha: string): Promise<{ sha: SHA; diff: Diff }> {
if (PLATFORM === 'gitea' || PLATFORM === 'forgejo') {
try {
const commit = await giteaClient.getCommit(owner, repo, commitSha);
const diffResponse = await giteaClient.getRepoCommitDiff(owner, repo, commitSha);
return { sha: commitSha, diff: diffResponse.data };
} catch (error) {
core.error(`Failed to fetch Gitea/Forgejo commit diff: ${error}`);
throw error;
}
} else {
const diffResponse = await octokit.request<string>(
'GET /repos/{owner}/{repo}/commits/{ref}',
{
owner,
repo,
ref: commitSha,
headers: {
Accept: 'application/vnd.github.v3.diff'
}
}
);
return { sha: commitSha, diff: diffResponse.data };
}
}
interface DiffAndSHA {
sha: SHA;
diff: Diff;
@@ -28,256 +73,146 @@ interface MsgAndSHA {
msg: string;
}
type Platform = 'github' | 'gitea';
/* -------------------------------------------------------------------------- */
/* Constants */
/* -------------------------------------------------------------------------- */
const OPENCOMMIT_MARKER = /(opencommit|🤖)/i;
/* -------------------------------------------------------------------------- */
/* Platform detection */
/* -------------------------------------------------------------------------- */
function detectPlatform(): Platform {
if (process.env.GITEA_ACTIONS === 'true') return 'gitea';
if (process.env.FORGEJO_ACTIONS === 'true') return 'gitea';
return 'github';
}
const platform = detectPlatform();
const dryRun = core.getBooleanInput('dry_run');
const context = github.context;
const owner = context.repo.owner;
const repo = context.repo.repo;
/* -------------------------------------------------------------------------- */
/* Clients */
/* -------------------------------------------------------------------------- */
const GITHUB_TOKEN = core.getInput('GITHUB_TOKEN');
const octokit =
platform === 'github' ? github.getOctokit(GITHUB_TOKEN) : null;
const gitea =
platform === 'gitea'
? new Gitea()
: null;
const giteaBaseUrl =
process.env.GITEA_SERVER_URL ??
process.env.GITHUB_SERVER_URL;
/* -------------------------------------------------------------------------- */
/* Helpers */
/* -------------------------------------------------------------------------- */
function shouldSkipCommit(message: string): boolean {
if (/^merge\b/i.test(message)) return true;
if (OPENCOMMIT_MARKER.test(message)) return true;
return false;
}
async function getCommitDiff(commitSha: string): Promise<{ sha: SHA; diff: Diff }> {
if (platform === 'github') {
const res = await octokit!.request<string>(
'GET /repos/{owner}/{repo}/commits/{ref}',
{
owner,
repo,
ref: commitSha,
headers: {
Accept: 'application/vnd.github.v3.diff',
},
}
);
return { sha: commitSha, diff: res.data };
}
const { data } = await gitea!.request({
method: 'GET',
url: `${giteaBaseUrl}/repos/${owner}/${repo}/git/commits/${commitSha}`,
headers: {
Accept: 'application/vnd.gitea.v1.diff',
Authorization: `token ${GITHUB_TOKEN}`,
},
});
return { sha: commitSha, diff: data as string };
}
/* -------------------------------------------------------------------------- */
/* Diff fetching */
/* -------------------------------------------------------------------------- */
const getDiffsBySHAs = async (shas: SHA[]) => {
return Promise.all(shas.map((sha) => getCommitDiff(sha)));
};
/* -------------------------------------------------------------------------- */
/* Message improvement */
/* -------------------------------------------------------------------------- */
async function improveMessagesInChunks(
diffsAndSHAs: DiffAndSHA[]
): Promise<MsgAndSHA[]> {
const chunkSize = diffsAndSHAs.length % 2 === 0 ? 4 : 3;
// send only 3-4 size chunks of diffs in steps,
// because openAI restricts "too many requests" at once with 429 error
async function improveMessagesInChunks(diffsAndSHAs: DiffAndSHA[]) {
const chunkSize = diffsAndSHAs!.length % 2 === 0 ? 4 : 3;
outro(`Improving commit messages in chunks of ${chunkSize}.`);
const improvePromises = diffsAndSHAs.map((commit) =>
const improvePromises = diffsAndSHAs!.map((commit) =>
generateCommitMessageByDiff(commit.diff, false)
);
const improved: MsgAndSHA[] = [];
let improvedMessagesAndSHAs: MsgAndSHA[] = [];
for (let step = 0; step < improvePromises.length; step += chunkSize) {
const chunk = improvePromises.slice(step, step + chunkSize);
const chunkOfPromises = improvePromises.slice(step, step + chunkSize);
try {
const results = await Promise.all(chunk);
results.forEach((msg, i) => {
improved.push({
sha: diffsAndSHAs[step + i].sha,
msg,
});
});
const chunkOfImprovedMessages = await Promise.all(chunkOfPromises);
const chunkOfImprovedMessagesBySha = chunkOfImprovedMessages.map(
(improvedMsg, i) => {
const index = improvedMessagesAndSHAs.length;
const sha = diffsAndSHAs![index + i].sha;
return { sha, msg: improvedMsg };
}
);
improvedMessagesAndSHAs.push(...chunkOfImprovedMessagesBySha);
// sometimes openAI errors with 429 code (too many requests),
// so lets sleep a bit
const sleepFor =
1000 * randomIntFromInterval(1, 5) +
100 * randomIntFromInterval(1, 5);
1000 * randomIntFromInterval(1, 5) + 100 * randomIntFromInterval(1, 5);
outro(
`Improved ${chunkOfPromises.length} messages. Sleeping for ${sleepFor}`
);
await sleep(sleepFor);
} catch (err) {
} catch (error) {
outro(error as string);
// if sleeping in try block still fails with 429,
// openAI wants at least 1 minute before next request
const sleepFor = 60000 + 1000 * randomIntFromInterval(1, 5);
outro(`Retrying after sleeping for ${sleepFor}`);
await sleep(sleepFor);
// go to previous step
step -= chunkSize;
}
}
return improved;
return improvedMessagesAndSHAs;
}
/* -------------------------------------------------------------------------- */
/* Main logic */
/* -------------------------------------------------------------------------- */
const getDiffsBySHAs = async (SHAs: string[]) => {
const diffPromises = SHAs.map((sha) => getCommitDiff(sha));
const diffs = await Promise.all(diffPromises).catch((error) => {
outro(`Error in Promise.all(getCommitDiffs(SHAs)): ${error}.`);
throw error;
});
return diffs;
};
async function improveCommitMessages(
commits: { id: string; message: string }[]
commitsToImprove: { id: string; message: string }[]
): Promise<void> {
const eligibleCommits = commits.filter(
(c) => !shouldSkipCommit(c.message)
);
if (!eligibleCommits.length) {
outro('No eligible commits found.');
if (commitsToImprove.length) {
outro(`Found ${commitsToImprove.length} commits to improve.`);
} else {
outro('No new commits found.');
return;
}
outro(`Found ${eligibleCommits.length} commits to improve.`);
// Filter out merge commits and commits that have already been processed
const filteredCommits = commitsToImprove.filter(commit => {
// Skip merge commits
if (commit.message.includes('Merge branch')) {
return false;
}
const commitSHAs = eligibleCommits.map((c) => c.id);
const diffsWithSHAs = await getDiffsBySHAs(commitSHAs);
// Skip commits that already have improved messages (simple heuristic)
if (commit.message.includes('[OpenCommit]') || commit.message.includes('[auto]')) {
return false;
}
const improvedMessages = await improveMessagesInChunks(diffsWithSHAs);
return true;
});
const hasChanges = improvedMessages.some(
(improved, i) => improved.msg !== eligibleCommits[i].message
);
if (!hasChanges) {
outro('No changes in commit messages detected.');
if (filteredCommits.length === 0) {
outro('No commits to improve after filtering.');
return;
}
if (dryRun) {
outro('Dry run enabled. No commits will be rewritten.');
improvedMessages.forEach((c) =>
console.log(`[DRY RUN] ${c.sha}: ${c.msg}`)
outro('Fetching commit diffs by SHAs.');
const commitSHAsToImprove = filteredCommits.map((commit) => commit.id);
const diffsWithSHAs = await getDiffsBySHAs(commitSHAsToImprove);
outro('Done.');
const improvedMessagesWithSHAs = await improveMessagesInChunks(diffsWithSHAs);
console.log(
`Improved ${improvedMessagesWithSHAs.length} commit messages`
);
// Only process commits if not in dry run mode
if (DRY_RUN) {
outro('DRY_RUN mode enabled. Skipping actual commit changes.');
return;
}
improvedMessages.forEach(({ msg }, i) =>
writeFileSync(`./commit-${i}.txt`, msg)
);
writeFileSync('./count.txt', '0');
writeFileSync(
'./rebase-exec.sh',
`#!/bin/bash
count=$(cat count.txt)
git commit --amend -F commit-$count.txt
echo $((count + 1)) > count.txt`
);
await exec.exec('chmod +x ./rebase-exec.sh');
await exec.exec(
'git',
['rebase', `${eligibleCommits[0].id}^`, '--exec', './rebase-exec.sh'],
{
env: {
GIT_SEQUENCE_EDITOR: 'sed -i -e "s/^pick/reword/g"',
GIT_COMMITTER_NAME: process.env.GITHUB_ACTOR!,
GIT_COMMITTER_EMAIL: `${process.env.GITHUB_ACTOR}@users.noreply.github.com`,
},
// Apply the improved commit messages
try {
// This would be where we actually modify commits
// For now, we'll just log what would happen
outro('Would apply improved commit messages (DRY_RUN mode disabled).');
// In a real implementation, this would:
// 1. Create new commits with improved messages
// 2. Push them to the repository
// 3. Handle the rebase or replacement logic
} catch (error) {
core.error(`Failed to apply improved commit messages: ${error}`);
throw error;
}
);
improvedMessages.forEach((_, i) =>
unlinkSync(`./commit-${i}.txt`)
);
unlinkSync('./count.txt');
unlinkSync('./rebase-exec.sh');
outro('Force pushing rewritten commits.');
await exec.exec('git', ['push', '--force']);
}
/* -------------------------------------------------------------------------- */
/* Entrypoint */
/* -------------------------------------------------------------------------- */
async function run() {
intro('OpenCommit — improving commit messages');
try {
if (context.eventName !== 'push') {
core.error(
`OpenCommit is only supported on push events (got ${context.eventName})`
);
if (PLATFORM === 'gitea' || PLATFORM === 'forgejo') {
outro(`Running on ${PLATFORM} platform`);
} else {
outro('Running on GitHub platform');
}
if (github.context.eventName === 'push') {
const commits = github.context.payload.commits || [];
// Skip if in dry run mode
if (DRY_RUN) {
outro('DRY_RUN mode enabled. Skipping commit processing.');
return;
}
const payload = context.payload as PushEvent;
await exec.exec('git', [
'config',
'user.name',
payload.pusher.name,
]);
if (payload.pusher.email) {
await exec.exec('git', [
'config',
'user.email',
payload.pusher.email,
]);
await improveCommitMessages(commits);
} else {
outro('Wrong action.');
core.error(
`OpenCommit was called on ${github.context.payload.action}. OpenCommit is supposed to be used on "push" action.`
);
}
await improveCommitMessages(payload.commits);
} catch (error: any) {
core.setFailed(error?.message || error);
const err = error?.message || error;
core.setFailed(err);
}
}
-96
View File
@@ -1,96 +0,0 @@
// src/platform.ts
import { Gitea } from '@go-gitea/sdk.js';
import github from '@actions/github';
import { PushEvent } from '@octokit/webhooks-types';
export const REWRITE_MARKER = '[OPENCOMMIT]';
export type NormalizedCommit = {
id: string;
message: string;
author?: { name?: string; email?: string };
};
export function isGitea(): boolean {
return !!process.env.GITEA_BASE_URL;
}
export async function getPushCommits(): Promise<NormalizedCommit[]> {
if (isGitea()) {
const payload = github.context.payload as any;
const commits = payload.commits as Array<any>;
return commits
.filter((commit) => {
if (commit.message.startsWith('Merge')) return false;
if (commit.message.includes(REWRITE_MARKER)) return false;
return true;
})
.map((commit) => ({
id: commit.id,
message: commit.message,
author: commit.author
? {
name: commit.author.name,
email: commit.author.email ?? undefined, // coerce null → undefined
}
: undefined,
}));
} else {
const payload = github.context.payload as PushEvent;
const commits = payload.commits;
return commits
.filter((commit) => {
if (commit.message.startsWith('Merge')) return false;
if (commit.message.includes(REWRITE_MARKER)) return false;
return true;
})
.map((commit) => ({
id: commit.id,
message: commit.message,
author: {
name: commit.author.name,
email: commit.author.email ?? undefined, // coerce null → undefined
},
}));
}
}
export async function fetchCommitDiff(
sha: string,
giteaConfig?: { baseUrl: string; token: string }
): Promise<{ sha: string; diff: string }> {
if (isGitea() && giteaConfig) {
const gitea = new Gitea({
baseUrl: giteaConfig.baseUrl,
auth: giteaConfig.token,
});
const { data } = await gitea.rest.git.getCommit({
owner: process.env.GITEA_REPO_OWNER!,
repo: process.env.GITEA_REPO_NAME!,
sha,
});
const filesChanged =
data.files?.map((f: any) => `diff --git a/${f.filename} b/${f.filename}`).join('\n') ?? '';
return { sha, diff: filesChanged };
} else {
const octokit = github.getOctokit(process.env.GITHUB_TOKEN!);
const context = github.context;
const { data: diff } = await octokit.request<string>(
'GET /repos/{owner}/{repo}/commits/{ref}',
{
owner: context.repo.owner,
repo: context.repo.repo,
ref: sha,
headers: { Accept: 'application/vnd.github.v3.diff' },
}
);
return { sha, diff };
}
}