Skip to content

Commit

Permalink
Update dependencies, licenses, and replace octokit with @octokit/rest…
Browse files Browse the repository at this point in the history
… in imports
  • Loading branch information
pelikhan committed Sep 27, 2024
1 parent 41d1a1c commit 53b3b29
Show file tree
Hide file tree
Showing 9 changed files with 491 additions and 39 deletions.
403 changes: 402 additions & 1 deletion THIRD_PARTY_LICENSES.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/src/content/docs/reference/scripts/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ console.log(pkg.content.slice(0, 50) + "...")
You can use [octokit](https://www.npmjs.com/package/octokit) to access the full GitHub APIs.

```js
import { Octokit } from "octokit"
import { Octokit } from "@octokit/core"

const info = await github.info()
const client = new Octokit(info)
Expand Down
6 changes: 3 additions & 3 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1041,9 +1041,9 @@
"@types/unist" "*"

"@types/node@*", "@types/node@>=20":
version "22.7.3"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.3.tgz#7ddf1ddf13078692b4cfadb835852b2a718ee1ef"
integrity sha512-qXKfhXXqGTyBskvWEzJZPUxSslAiLaB6JGP1ic/XTH9ctGgzdgYguuLP1C601aRTSDNlLb0jbKqXjZ48GNraSA==
version "22.7.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.4.tgz#e35d6f48dca3255ce44256ddc05dee1c23353fcc"
integrity sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==
dependencies:
undici-types "~6.19.2"

Expand Down
6 changes: 4 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"@azure/identity": "^4.4.1",
"@inquirer/prompts": "^6.0.1",
"@lvce-editor/ripgrep": "^1.2.0",
"@octokit/plugin-throttling": "^9.3.1",
"@octokit/rest": "^21.0.2",
"dockerode": "^4.0.2",
"gpt-tokenizer": "^2.4.0",
"html-to-text": "^9.0.5",
Expand Down Expand Up @@ -85,8 +87,8 @@
"zx": "^8.1.8"
},
"scripts": {
"compile": "esbuild src/main.ts --metafile=./esbuild.meta.json --bundle --platform=node --target=node20 --outfile=built/genaiscript.cjs --external:tsx --external:esbuild --external:get-tsconfig --external:resolve-pkg-maps --external:dockerode --external:pdfjs-dist --external:web-tree-sitter --external:tree-sitter-wasms --external:promptfoo --external:typescript --external:@lvce-editor/ripgrep --external:gpt-3-encoder --external:mammoth --external:xlsx --external:mathjs --external:@azure/identity --external:gpt-tokenizer --external:playwright --external:@inquirer/prompts --external:jimp --external:turndown --external:vectra --external:tabletojson --external:html-to-text && node ../../scripts/patch-cli.mjs",
"compile-debug": "esbuild src/main.ts --sourcemap --metafile=./esbuild.meta.json --bundle --platform=node --target=node20 --outfile=built/genaiscript.cjs --external:tsx --external:esbuild --external:get-tsconfig --external:resolve-pkg-maps --external:dockerode --external:pdfjs-dist --external:web-tree-sitter --external:tree-sitter-wasms --external:promptfoo --external:typescript --external:@lvce-editor/ripgrep --external:gpt-3-encoder --external:mammoth --external:xlsx --external:mathjs --external:@azure/identity --external:gpt-tokenizer --external:playwright --external:@inquirer/prompts --external:jimp --external:turndown --external:vectra --external:tabletojson --external:html-to-text",
"compile": "esbuild src/main.ts --metafile=./esbuild.meta.json --bundle --platform=node --target=node20 --outfile=built/genaiscript.cjs --external:tsx --external:esbuild --external:get-tsconfig --external:resolve-pkg-maps --external:dockerode --external:pdfjs-dist --external:web-tree-sitter --external:tree-sitter-wasms --external:promptfoo --external:typescript --external:@lvce-editor/ripgrep --external:gpt-3-encoder --external:mammoth --external:xlsx --external:mathjs --external:@azure/identity --external:gpt-tokenizer --external:playwright --external:@inquirer/prompts --external:jimp --external:turndown --external:vectra --external:tabletojson --external:html-to-text --external:@octokit/rest --external:@octokit/plugin-throttling && node ../../scripts/patch-cli.mjs",
"compile-debug": "esbuild src/main.ts --sourcemap --metafile=./esbuild.meta.json --bundle --platform=node --target=node20 --outfile=built/genaiscript.cjs --external:tsx --external:esbuild --external:get-tsconfig --external:resolve-pkg-maps --external:dockerode --external:pdfjs-dist --external:web-tree-sitter --external:tree-sitter-wasms --external:promptfoo --external:typescript --external:@lvce-editor/ripgrep --external:gpt-3-encoder --external:mammoth --external:xlsx --external:mathjs --external:@azure/identity --external:gpt-tokenizer --external:playwright --external:@inquirer/prompts --external:jimp --external:turndown --external:vectra --external:tabletojson --external:html-to-text --external:@octokit/rest --external:@octokit/plugin-throttling",
"postcompile": "node built/genaiscript.cjs info help > ../../docs/src/content/docs/reference/cli/commands.md",
"vis:treemap": "npx --yes esbuild-visualizer --metadata esbuild.meta.json --filename esbuild.treemap.html",
"vis:network": "npx --yes esbuild-visualizer --metadata esbuild.meta.json --filename esbuild.network.html --template network",
Expand Down
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"devDependencies": {
"@azure/identity": "^4.4.1",
"@huggingface/jinja": "^0.3.1",
"@octokit/plugin-throttling": "^9.3.1",
"@octokit/rest": "^21.0.2",
"@tidyjs/tidy": "^2.5.2",
"@types/diff": "^5.2.2",
"@types/html-escaper": "^3.0.2",
Expand Down Expand Up @@ -57,7 +59,6 @@
"minimatch": "^10.0.1",
"minisearch": "^7.1.0",
"mustache": "^4.2.0",
"octokit": "^4.0.2",
"openai": "^4.65.0",
"p-limit": "^6.1.0",
"parse-diff": "^0.11.1",
Expand Down
38 changes: 36 additions & 2 deletions packages/core/src/github.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Octokit } from "octokit"
import type { Octokit } from "@octokit/rest"
import {
GITHUB_API_VERSION,
GITHUB_PULL_REQUEST_REVIEW_COMMENT_LINE_DISTANCE,
Expand Down Expand Up @@ -427,10 +427,44 @@ export class GitHubClient implements GitHub {
this._client = new Promise(async (resolve) => {
const conn = await this.connection()
const { token, apiUrl } = conn
const res = new Octokit({
const { Octokit } = await import("@octokit/rest")
const { throttling } = await import(
"@octokit/plugin-throttling"
)
const OctokitWithPlugins = Octokit.plugin(throttling)
const res: Octokit = new OctokitWithPlugins({
userAgent: TOOL_ID,
auth: token,
baseUrl: apiUrl,
throttle: {
onRateLimit: (
retryAfter,
options,
octokit,
retryCount
) => {
octokit.log.warn(
`Request quota exhausted for request ${options.method} ${options.url}`
)
if (retryCount < 1) {
// only retries once
octokit.log.info(
`Retrying after ${retryAfter} seconds!`
)
return true
}
return false
},
onSecondaryRateLimit: (
retryAfter,
options,
octokit
) => {
octokit.log.warn(
`SecondaryRateLimit detected for request ${options.method} ${options.url}`
)
},
},
})
resolve({ client: res, ...conn })
})
Expand Down
1 change: 0 additions & 1 deletion packages/sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"@azure/storage-blob": "^12.25.0",
"@tidyjs/tidy": "^2.5.2",
"@xenova/transformers": "^2.17.2",
"octokit": "^4.0.2",
"p-all": "^5.0.0",
"vectorstore": "^0.0.4",
"zod": "^3.23.8",
Expand Down
12 changes: 6 additions & 6 deletions slides/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1193,16 +1193,16 @@
integrity sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==

"@types/node@*", "@types/node@>=20":
version "22.7.3"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.3.tgz#7ddf1ddf13078692b4cfadb835852b2a718ee1ef"
integrity sha512-qXKfhXXqGTyBskvWEzJZPUxSslAiLaB6JGP1ic/XTH9ctGgzdgYguuLP1C601aRTSDNlLb0jbKqXjZ48GNraSA==
version "22.7.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.4.tgz#e35d6f48dca3255ce44256ddc05dee1c23353fcc"
integrity sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==
dependencies:
undici-types "~6.19.2"

"@types/node@^18.7.3":
version "18.19.53"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.53.tgz#1e2f83eeede6031f03bc4780826b8b02b42ac50d"
integrity sha512-GLxgUgHhDKO1Edw9Q0lvMbiO/IQXJwJlMaqxSGBXMpPy8uhkCs2iiPFaB2Q/gmobnFkckD3rqTBMVjXdwq+nKg==
version "18.19.54"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.54.tgz#f1048dc083f81b242640f04f18fb3e4ccf13fcdb"
integrity sha512-+BRgt0G5gYjTvdLac9sIeE0iZcJxi4Jc4PV5EUzqi+88jmQLr+fRZdv2tCTV7IHKSGxM6SaLoOXQWWUiLUItMw==
dependencies:
undici-types "~5.26.4"

Expand Down
59 changes: 37 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1191,18 +1191,23 @@
integrity sha512-EzFueuXVU3VHv5FwEXbdznn9EmyF0vA5LGDX6a8fJ9YJAlDgdYHRKJMO4Ghl2PPPJBxIPMDUJMnlUHqcvP7AnQ==

"@octokit/plugin-paginate-rest@^11.0.0":
version "11.3.3"
resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.3.3.tgz#efc97ba66aae6797e2807a082f99b9cfc0e05aba"
integrity sha512-o4WRoOJZlKqEEgj+i9CpcmnByvtzoUYC6I8PD2SA95M+BJ2x8h7oLcVOg9qcowWXBOdcTRsMZiwvM3EyLm9AfA==
version "11.3.4"
resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.3.4.tgz#68c834beb721a4b5919cb98987b40e69099b5f30"
integrity sha512-lqBHWiuI468XJ/o06Eg6hgACGXwikyHUzoYs/Y3gA1uVzPldxSeuEiCLAZRy4ovaAJozjds18ni2wgdT1oWtDQ==
dependencies:
"@octokit/types" "^13.5.0"
"@octokit/types" "^13.6.0"

"@octokit/plugin-request-log@^5.3.1":
version "5.3.1"
resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-5.3.1.tgz#ccb75d9705de769b2aa82bcd105cc96eb0c00f69"
integrity sha512-n/lNeCtq+9ofhC15xzmJCNKP2BWTv8Ih2TTy+jatNCCq/gQP/V7rK3fjIfuz0pDWDALO/o/4QY4hyOF6TQQFUw==

"@octokit/plugin-rest-endpoint-methods@^13.0.0":
version "13.2.4"
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-13.2.4.tgz#543add032d3fe3f5d2839bfd619cf66d85469f01"
integrity sha512-gusyAVgTrPiuXOdfqOySMDztQHv6928PQ3E4dqVGEtOvRXAKRbJR4b1zQyniIT9waqaWk/UDaoJ2dyPr7Bk7Iw==
version "13.2.5"
resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-13.2.5.tgz#5a928752e584458ef8f8beafd0e1c6a820ce31e4"
integrity sha512-c4pRWi7OUSFM4E6frfUs+qsAf052aOWt1x2qFQ6llQcd1J0HqQ/0Egfs2lm33IixXeXXhZ+GmC9tf92qbOs25Q==
dependencies:
"@octokit/types" "^13.5.0"
"@octokit/types" "^13.6.0"

"@octokit/plugin-retry@^7.0.0":
version "7.1.2"
Expand All @@ -1213,7 +1218,7 @@
"@octokit/types" "^13.0.0"
bottleneck "^2.15.3"

"@octokit/plugin-throttling@^9.0.0":
"@octokit/plugin-throttling@^9.0.0", "@octokit/plugin-throttling@^9.3.1":
version "9.3.1"
resolved "https://registry.yarnpkg.com/@octokit/plugin-throttling/-/plugin-throttling-9.3.1.tgz#5648165e1e70e861625f3a16af6c55cafe861061"
integrity sha512-Qd91H4liUBhwLB2h6jZ99bsxoQdhgPk6TdwnClPyTBSDAdviGPceViEgUwj+pcQDmB/rfAXAXK7MTochpHM3yQ==
Expand All @@ -1238,10 +1243,20 @@
"@octokit/types" "^13.1.0"
universal-user-agent "^7.0.2"

"@octokit/types@^13.0.0", "@octokit/types@^13.1.0", "@octokit/types@^13.4.1", "@octokit/types@^13.5.0":
version "13.5.1"
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-13.5.1.tgz#5685a91f295195ddfff39723b093b0df9609ce6e"
integrity sha512-F41lGiWBKPIWPBgjSvaDXTTQptBujnozENAK3S//nj7xsFdYdirImKlBB/hTjr+Vii68SM+8jG3UJWRa6DMuDA==
"@octokit/rest@^21.0.2":
version "21.0.2"
resolved "https://registry.yarnpkg.com/@octokit/rest/-/rest-21.0.2.tgz#9b767dbc1098daea8310fd8b76bf7a97215d5972"
integrity sha512-+CiLisCoyWmYicH25y1cDfCrv41kRSvTq6pPWtRroRJzhsCZWZyCqGyI8foJT5LmScADSwRAnr/xo+eewL04wQ==
dependencies:
"@octokit/core" "^6.1.2"
"@octokit/plugin-paginate-rest" "^11.0.0"
"@octokit/plugin-request-log" "^5.3.1"
"@octokit/plugin-rest-endpoint-methods" "^13.0.0"

"@octokit/types@^13.0.0", "@octokit/types@^13.1.0", "@octokit/types@^13.4.1", "@octokit/types@^13.6.0":
version "13.6.0"
resolved "https://registry.yarnpkg.com/@octokit/types/-/types-13.6.0.tgz#db13d345cc3fe1a0f7c07171c724d90f2b55f410"
integrity sha512-CrooV/vKCXqwLa+osmHLIMUb87brpgUqlqkPGc6iE2wCkUvTrHiXFMhAKoDDaAAYJrtKtrFTgSQTg5nObBEaew==
dependencies:
"@octokit/openapi-types" "^22.2.0"

Expand Down Expand Up @@ -1493,9 +1508,9 @@
form-data "^4.0.0"

"@types/node@*", "@types/node@>=13.7.0", "@types/node@>=20", "@types/node@^22.5.5":
version "22.7.3"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.3.tgz#7ddf1ddf13078692b4cfadb835852b2a718ee1ef"
integrity sha512-qXKfhXXqGTyBskvWEzJZPUxSslAiLaB6JGP1ic/XTH9ctGgzdgYguuLP1C601aRTSDNlLb0jbKqXjZ48GNraSA==
version "22.7.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.7.4.tgz#e35d6f48dca3255ce44256ddc05dee1c23353fcc"
integrity sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==
dependencies:
undici-types "~6.19.2"

Expand All @@ -1505,16 +1520,16 @@
integrity sha512-QpLcX9ZSsq3YYUUnD3nFDY8H7wctAhQj/TFKL8Ya8v5fMm3CFXxo8zStsLAl780ltoYoo1WvKUVGBQK+1ifr7g==

"@types/node@^18.11.18":
version "18.19.53"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.53.tgz#1e2f83eeede6031f03bc4780826b8b02b42ac50d"
integrity sha512-GLxgUgHhDKO1Edw9Q0lvMbiO/IQXJwJlMaqxSGBXMpPy8uhkCs2iiPFaB2Q/gmobnFkckD3rqTBMVjXdwq+nKg==
version "18.19.54"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.54.tgz#f1048dc083f81b242640f04f18fb3e4ccf13fcdb"
integrity sha512-+BRgt0G5gYjTvdLac9sIeE0iZcJxi4Jc4PV5EUzqi+88jmQLr+fRZdv2tCTV7IHKSGxM6SaLoOXQWWUiLUItMw==
dependencies:
undici-types "~5.26.4"

"@types/node@^20.14.12":
version "20.16.9"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.9.tgz#1217c6cc77c4f3aaf4a6c76fb56b790e81e48120"
integrity sha512-rkvIVJxsOfBejxK7I0FO5sa2WxFmJCzoDwcd88+fq/CUfynNywTo/1/T6hyFz22CyztsnLS9nVlHOnTI36RH5w==
version "20.16.10"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.16.10.tgz#0cc3fdd3daf114a4776f54ba19726a01c907ef71"
integrity sha512-vQUKgWTjEIRFCvK6CyriPH3MZYiYlNy0fKiEYHWbcoWLEgs4opurGGKlebrTLqdSMIbXImH6XExNiIyNUv3WpA==
dependencies:
undici-types "~6.19.2"

Expand Down

0 comments on commit 53b3b29

Please sign in to comment.