diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ef19757..3b1b1b9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1 +1 @@ -{".":"1.5.0"} +{".":"1.6.0"} diff --git a/.vscode/settings.json b/.vscode/settings.json index d504573..407754a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -58,5 +58,8 @@ "tsup", "undici", "vsix" - ] + ], + "aide.convertLanguagePairs": { + "typescript": "python" + } } diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b1c0c6..8c4fe6a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [1.6.0](https://github.com/nicepkg/aide/compare/aide-v1.5.0...aide-v1.6.0) (2024-07-02) + + +### Features + +* update docs ([88b0609](https://github.com/nicepkg/aide/commit/88b0609502b3d1e620456162dc7d05ec0a18826c)) + ## [1.5.0](https://github.com/nicepkg/aide/compare/aide-v1.4.1...aide-v1.5.0) (2024-07-02) diff --git a/package.json b/package.json index 0e9e99f..8f32807 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "dist" ], "engines": { - "vscode": "^1.90.0" + "vscode": "^1.76.0" }, "contributes": { "commands": [ @@ -216,7 +216,7 @@ "@types/global-agent": "^2.1.3", "@types/node": "^20.14.9", "@types/shell-quote": "^1.7.5", - "@types/vscode": "^1.90.0", + "@types/vscode": "1.76.0", "@typescript-eslint/eslint-plugin": "^7.15.0", "@typescript-eslint/parser": "^7.15.0", "@vscode/vsce": "^2.29.0", @@ -232,7 +232,7 @@ "eslint-plugin-import": "^2.29.1", "eslint-plugin-json": "^4.0.0", "eslint-plugin-prettier": "^5.1.3", - "eslint-plugin-simple-import-sort": "^12.1.0", + "eslint-plugin-simple-import-sort": "^12.1.1", "eslint-plugin-unused-imports": "^3.2.0", "esno": "^4.7.0", "execa": "^9.3.0", @@ -240,8 +240,8 @@ "glob": "^10.4.2", "global-agent": "^3.0.0", "husky": "^9.0.11", - "inquirer": "^9.3.2", - "knip": "^5.23.3", + "inquirer": "^9.3.4", + "knip": "^5.24.1", "lint-staged": "^15.2.7", "minimatch": "^9.0.5", "pnpm": "^9.4.0", @@ -251,7 +251,7 @@ "tsup": "^8.1.0", "typescript": "5.4.5", "undici": "^6.19.2", - "vite": "^5.3.2", + "vite": "^5.3.3", "vitest": "^1.6.0" }, "commitlint": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e010092..28158e9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,7 +22,7 @@ importers: version: 19.2.2 '@commitlint/cz-commitlint': specifier: ^19.2.0 - version: 19.2.0(@types/node@20.14.9)(commitizen@4.3.0(@types/node@20.14.9)(typescript@5.4.5))(inquirer@9.3.2)(typescript@5.4.5) + version: 19.2.0(@types/node@20.14.9)(commitizen@4.3.0(@types/node@20.14.9)(typescript@5.4.5))(inquirer@9.3.4)(typescript@5.4.5) '@ianvs/prettier-plugin-sort-imports': specifier: ^4.3.0 version: 4.3.0(@vue/compiler-sfc@3.4.31)(prettier@3.3.2) @@ -39,8 +39,8 @@ importers: specifier: ^1.7.5 version: 1.7.5 '@types/vscode': - specifier: ^1.90.0 - version: 1.90.0 + specifier: 1.76.0 + version: 1.76.0 '@typescript-eslint/eslint-plugin': specifier: ^7.15.0 version: 7.15.0(@typescript-eslint/parser@7.15.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5) @@ -87,8 +87,8 @@ importers: specifier: ^5.1.3 version: 5.1.3(@types/eslint@8.56.10)(eslint-config-prettier@9.1.0(eslint@8.57.0))(eslint@8.57.0)(prettier@3.3.2) eslint-plugin-simple-import-sort: - specifier: ^12.1.0 - version: 12.1.0(eslint@8.57.0) + specifier: ^12.1.1 + version: 12.1.1(eslint@8.57.0) eslint-plugin-unused-imports: specifier: ^3.2.0 version: 3.2.0(@typescript-eslint/eslint-plugin@7.15.0(@typescript-eslint/parser@7.15.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0) @@ -111,11 +111,11 @@ importers: specifier: ^9.0.11 version: 9.0.11 inquirer: - specifier: ^9.3.2 - version: 9.3.2 + specifier: ^9.3.4 + version: 9.3.4 knip: - specifier: ^5.23.3 - version: 5.23.3(@types/node@20.14.9)(typescript@5.4.5) + specifier: ^5.24.1 + version: 5.24.1(@types/node@20.14.9)(typescript@5.4.5) lint-staged: specifier: ^15.2.7 version: 15.2.7 @@ -136,7 +136,7 @@ importers: version: 1.8.1 tsup: specifier: ^8.1.0 - version: 8.1.0(postcss@8.4.38)(typescript@5.4.5) + version: 8.1.0(postcss@8.4.39)(typescript@5.4.5) typescript: specifier: 5.4.5 version: 5.4.5 @@ -144,8 +144,8 @@ importers: specifier: ^6.19.2 version: 6.19.2 vite: - specifier: ^5.3.2 - version: 5.3.2(@types/node@20.14.9) + specifier: ^5.3.3 + version: 5.3.3(@types/node@20.14.9) vitest: specifier: ^1.6.0 version: 1.6.0(@types/node@20.14.9) @@ -993,8 +993,8 @@ packages: '@types/shell-quote@1.7.5': resolution: {integrity: sha512-+UE8GAGRPbJVQDdxi16dgadcBfQ+KG2vgZhV1+3A1XmHbmwcdwhCUwIdy+d3pAGrbvgRoVSjeI9vOWyq376Yzw==} - '@types/vscode@1.90.0': - resolution: {integrity: sha512-oT+ZJL7qHS9Z8bs0+WKf/kQ27qWYR3trsXpq46YDjFqBsMLG4ygGGjPaJ2tyrH0wJzjOEmDyg9PDJBBhWg9pkQ==} + '@types/vscode@1.76.0': + resolution: {integrity: sha512-CQcY3+Fe5hNewHnOEAVYj4dd1do/QHliXaknAEYSXx2KEHUzFibDZSKptCon+HPgK55xx20pR+PBJjf0MomnBA==} '@typescript-eslint/eslint-plugin@7.15.0': resolution: {integrity: sha512-uiNHpyjZtFrLwLDpHnzaDlP3Tt6sGMqTCiqmxaN4n4RP0EfYZDODJyddiFDF44Hjwxr5xAcaYxVKm9QKQFJFLA==} @@ -1900,8 +1900,8 @@ packages: eslint-config-prettier: optional: true - eslint-plugin-simple-import-sort@12.1.0: - resolution: {integrity: sha512-Y2fqAfC11TcG/WP3TrI1Gi3p3nc8XJyEOJYHyEPEGI/UAgNx6akxxlX74p7SbAQdLcgASKhj8M0GKvH3vq/+ig==} + eslint-plugin-simple-import-sort@12.1.1: + resolution: {integrity: sha512-6nuzu4xwQtE3332Uz0to+TxDQYRLTKRESSc2hefVT48Zc8JthmN23Gx9lnYhu0FtkRSL1oxny3kJ2aveVhmOVA==} peerDependencies: eslint: '>=5.0.0' @@ -2346,8 +2346,8 @@ packages: resolution: {integrity: sha512-QAgPDQMEgrDssk1XiwwHoOGYF9BAbUcc1+j+FhEvaOt8/cKRqyLn0U5qA6F74fGhTMGxf92pOvPBeh29jQJDTQ==} engines: {node: '>=12.0.0'} - inquirer@9.3.2: - resolution: {integrity: sha512-+ynEbhWKhyomnaX0n2aLIMSkgSlGB5RrWbNXnEqj6mdaIydu6y40MdBjL38SAB0JcdmOaIaMua1azdjLEr3sdw==} + inquirer@9.3.4: + resolution: {integrity: sha512-Hp6meNSDzp+Oc9JNUUlYsK81dxaPrrBRa7H/s3+yebCDRJe4UNKYSkEUZoIcuKJjNipBLPKsuc7BvO6tLzo/KA==} engines: {node: '>=18'} internal-slot@1.0.7: @@ -2617,8 +2617,8 @@ packages: keyv@4.5.4: resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} - knip@5.23.3: - resolution: {integrity: sha512-i0vFlpe3D9AZmp3Hlq3ZncjJQB2x21LeVrIV+9rnBavaKpTLhV/sLmE4iqTjEWedLtpfJsax68S68aqZzcXpsQ==} + knip@5.24.1: + resolution: {integrity: sha512-YgVtCxu3lpsGHrZJUozBr7oAlQvwkxaExZr0OwaiDK92em/Gp0ZfzQC3h8ZOfFVGxgNqNX7AV61xWA/Lusg46A==} engines: {node: '>=18.6.0'} hasBin: true peerDependencies: @@ -3121,8 +3121,8 @@ packages: ts-node: optional: true - postcss@8.4.38: - resolution: {integrity: sha512-Wglpdk03BSfXkHoQa3b/oulrotAkwrlLDRSOb9D0bN86FdRyE9lppSp33aHNPgBa0JKCoB+drFLZkQoRRYae5A==} + postcss@8.4.39: + resolution: {integrity: sha512-0vzE+lAiG7hZl1/9I8yzKLx3aR9Xbof3fBHKunvMfOCYAtMhrsnccJY2iTURb9EZd5+pLuiNV9/c/GZJOHsgIw==} engines: {node: ^10 || ^12 || >=14} prebuild-install@7.1.1: @@ -3767,8 +3767,8 @@ packages: engines: {node: ^18.0.0 || >=20.0.0} hasBin: true - vite@5.3.2: - resolution: {integrity: sha512-6lA7OBHBlXUxiJxbO5aAY2fsHHzDr1q7DvXYnyZycRs2Dz+dXBWuhpWHvmljTRTpQC2uvGmUFFkSHF2vGo90MA==} + vite@5.3.3: + resolution: {integrity: sha512-NPQdeCU0Dv2z5fu+ULotpuq5yfCS1BzKUIPhNbP3YBfAMGJXbt2nS+sbTFu+qchaqWTD+H3JK++nRwr6XIcp6A==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -3948,8 +3948,8 @@ packages: resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} engines: {node: '>=12.20'} - yoctocolors-cjs@2.1.1: - resolution: {integrity: sha512-c6T13b6qYcJZvck7QbEFXrFX/Mu2KOjvAGiKHmYMUg96jxNpfP6i+psGW72BOPxOIDUJrORG+Kyu7quMX9CQBQ==} + yoctocolors-cjs@2.1.2: + resolution: {integrity: sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA==} engines: {node: '>=18'} yoctocolors@2.1.0: @@ -4321,14 +4321,14 @@ snapshots: '@commitlint/types': 19.0.3 ajv: 8.16.0 - '@commitlint/cz-commitlint@19.2.0(@types/node@20.14.9)(commitizen@4.3.0(@types/node@20.14.9)(typescript@5.4.5))(inquirer@9.3.2)(typescript@5.4.5)': + '@commitlint/cz-commitlint@19.2.0(@types/node@20.14.9)(commitizen@4.3.0(@types/node@20.14.9)(typescript@5.4.5))(inquirer@9.3.4)(typescript@5.4.5)': dependencies: '@commitlint/ensure': 19.0.3 '@commitlint/load': 19.2.0(@types/node@20.14.9)(typescript@5.4.5) '@commitlint/types': 19.0.3 chalk: 5.3.0 commitizen: 4.3.0(@types/node@20.14.9)(typescript@5.4.5) - inquirer: 9.3.2 + inquirer: 9.3.4 lodash.isplainobject: 4.0.6 word-wrap: 1.2.5 transitivePeerDependencies: @@ -4800,7 +4800,7 @@ snapshots: '@types/shell-quote@1.7.5': {} - '@types/vscode@1.90.0': {} + '@types/vscode@1.76.0': {} '@typescript-eslint/eslint-plugin@7.15.0(@typescript-eslint/parser@7.15.0(eslint@8.57.0)(typescript@5.4.5))(eslint@8.57.0)(typescript@5.4.5)': dependencies: @@ -5006,7 +5006,7 @@ snapshots: '@vue/shared': 3.4.31 estree-walker: 2.0.2 magic-string: 0.30.10 - postcss: 8.4.38 + postcss: 8.4.39 source-map-js: 1.2.0 '@vue/compiler-ssr@3.4.31': @@ -5933,7 +5933,7 @@ snapshots: '@types/eslint': 8.56.10 eslint-config-prettier: 9.1.0(eslint@8.57.0) - eslint-plugin-simple-import-sort@12.1.0(eslint@8.57.0): + eslint-plugin-simple-import-sort@12.1.1(eslint@8.57.0): dependencies: eslint: 8.57.0 @@ -6470,7 +6470,7 @@ snapshots: through: 2.3.8 wrap-ansi: 7.0.0 - inquirer@9.3.2: + inquirer@9.3.4: dependencies: '@inquirer/figures': 1.0.3 ansi-escapes: 4.3.2 @@ -6483,7 +6483,7 @@ snapshots: string-width: 4.2.3 strip-ansi: 6.0.1 wrap-ansi: 6.2.0 - yoctocolors-cjs: 2.1.1 + yoctocolors-cjs: 2.1.2 internal-slot@1.0.7: dependencies: @@ -6721,7 +6721,7 @@ snapshots: dependencies: json-buffer: 3.0.1 - knip@5.23.3(@types/node@20.14.9)(typescript@5.4.5): + knip@5.24.1(@types/node@20.14.9)(typescript@5.4.5): dependencies: '@ericcornelissen/bash-parser': 0.5.3 '@nodelib/fs.walk': 2.0.0 @@ -7195,14 +7195,14 @@ snapshots: possible-typed-array-names@1.0.0: {} - postcss-load-config@4.0.1(postcss@8.4.38): + postcss-load-config@4.0.1(postcss@8.4.39): dependencies: lilconfig: 2.1.0 yaml: 2.3.4 optionalDependencies: - postcss: 8.4.38 + postcss: 8.4.39 - postcss@8.4.38: + postcss@8.4.39: dependencies: nanoid: 3.3.7 picocolors: 1.0.1 @@ -7742,7 +7742,7 @@ snapshots: tslib@2.6.2: {} - tsup@8.1.0(postcss@8.4.38)(typescript@5.4.5): + tsup@8.1.0(postcss@8.4.39)(typescript@5.4.5): dependencies: bundle-require: 4.0.2(esbuild@0.21.5) cac: 6.7.14 @@ -7752,14 +7752,14 @@ snapshots: execa: 5.1.1 globby: 11.1.0 joycon: 3.1.1 - postcss-load-config: 4.0.1(postcss@8.4.38) + postcss-load-config: 4.0.1(postcss@8.4.39) resolve-from: 5.0.0 rollup: 4.17.2 source-map: 0.8.0-beta.0 sucrase: 3.34.0 tree-kill: 1.2.2 optionalDependencies: - postcss: 8.4.38 + postcss: 8.4.39 typescript: 5.4.5 transitivePeerDependencies: - supports-color @@ -7884,7 +7884,7 @@ snapshots: debug: 4.3.4 pathe: 1.1.2 picocolors: 1.0.1 - vite: 5.3.2(@types/node@20.14.9) + vite: 5.3.3(@types/node@20.14.9) transitivePeerDependencies: - '@types/node' - less @@ -7895,10 +7895,10 @@ snapshots: - supports-color - terser - vite@5.3.2(@types/node@20.14.9): + vite@5.3.3(@types/node@20.14.9): dependencies: esbuild: 0.21.5 - postcss: 8.4.38 + postcss: 8.4.39 rollup: 4.17.2 optionalDependencies: '@types/node': 20.14.9 @@ -7923,7 +7923,7 @@ snapshots: strip-literal: 2.1.0 tinybench: 2.5.1 tinypool: 0.8.4 - vite: 5.3.2(@types/node@20.14.9) + vite: 5.3.3(@types/node@20.14.9) vite-node: 1.6.0(@types/node@20.14.9) why-is-node-running: 2.2.2 optionalDependencies: @@ -8076,7 +8076,7 @@ snapshots: yocto-queue@1.0.0: {} - yoctocolors-cjs@2.1.1: {} + yoctocolors-cjs@2.1.2: {} yoctocolors@2.1.0: {} diff --git a/src/llm.ts b/src/llm.ts index af0e017..3054cd3 100644 --- a/src/llm.ts +++ b/src/llm.ts @@ -1,10 +1,6 @@ import { getConfigKey } from '@/config' import { createOpenAI } from '@ai-sdk/openai' import { streamText } from 'ai' -import * as vscode from 'vscode' - -import { t } from './i18n' -import { logger } from './logger' export const askOpenAIStream = async (prompt: string) => { const openaiBaseUrl = await getConfigKey('openaiBaseUrl') @@ -31,32 +27,32 @@ export const askOpenAIStream = async (prompt: string) => { * see: https://code.visualstudio.com/api/extension-guides/language-model#choosing-the-appropriate-model */ // eslint-disable-next-line unused-imports/no-unused-vars -const askVscodeLLM = async (prompt: string) => { - const activeEditor = vscode.window.activeTextEditor - if (!activeEditor) throw new Error(t('error.noActiveEditor')) - - const [model] = await vscode.lm.selectChatModels({ - vendor: 'copilot', - family: 'gpt-3.5-turbo' - }) - let chatResponse: vscode.LanguageModelChatResponse | undefined - - const messages = [vscode.LanguageModelChatMessage.User(prompt)] - - if (!model) throw new Error(t('error.vscodeLLMModelNotFound')) - - try { - chatResponse = await model.sendRequest( - messages, - {}, - new vscode.CancellationTokenSource().token - ) - } catch (err) { - logger.warn('askVscodeLLM', err) - throw err - } - - return { - textStream: chatResponse.text - } -} +// const askVscodeLLM = async (prompt: string) => { +// const activeEditor = vscode.window.activeTextEditor +// if (!activeEditor) throw new Error(t('error.noActiveEditor')) + +// const [model] = await vscode.lm.selectChatModels({ +// vendor: 'copilot', +// family: 'gpt-3.5-turbo' +// }) +// let chatResponse: vscode.LanguageModelChatResponse | undefined + +// const messages = [vscode.LanguageModelChatMessage.User(prompt)] + +// if (!model) throw new Error(t('error.vscodeLLMModelNotFound')) + +// try { +// chatResponse = await model.sendRequest( +// messages, +// {}, +// new vscode.CancellationTokenSource().token +// ) +// } catch (err) { +// logger.warn('askVscodeLLM', err) +// throw err +// } + +// return { +// textStream: chatResponse.text +// } +// }