From e296b679da2991f74d5f94bcf28dcb1b864f4cbc Mon Sep 17 00:00:00 2001 From: Chapman Pendery Date: Thu, 5 Sep 2024 11:21:07 -0700 Subject: [PATCH 1/3] feat: add tests and bump @withfig/autocomplete to 2.675.0 Signed-off-by: Chapman Pendery --- package-lock.json | 372 ++---------------- package.json | 2 +- src/runtime/suggestion.ts | 2 +- .../__snapshots__/runtime.test.ts.snap | 2 +- src/tests/runtime/runtime.test.ts | 43 +- 5 files changed, 69 insertions(+), 352 deletions(-) diff --git a/package-lock.json b/package-lock.json index d49f466..e4cdbe6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MIT", "dependencies": { "@homebridge/node-pty-prebuilt-multiarch": "^0.11.12", - "@withfig/autocomplete": "2.651.0", + "@withfig/autocomplete": "2.675.0", "@xterm/addon-unicode11": "^0.8.0", "@xterm/headless": "^5.5.0", "ajv": "^8.12.0", @@ -918,27 +918,6 @@ "node": ">=4.2.0" } }, - "node_modules/@fig/autocomplete-hooks": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@fig/autocomplete-hooks/-/autocomplete-hooks-1.0.2.tgz", - "integrity": "sha512-4T/UVZcrJjnv9zy+hF8ifIrlCd0DeZ0I+t3Zy8dvKqFXeYnMM+z/SdQYb8SvTwu5VdRcQtvYnJHINks8jySG+A==", - "dependencies": { - "@withfig/api-bindings": "^0.29.3", - "react": "^18.2.0" - } - }, - "node_modules/@fig/autocomplete-hooks/node_modules/@withfig/api-bindings": { - "version": "0.29.4", - "resolved": "https://registry.npmjs.org/@withfig/api-bindings/-/api-bindings-0.29.4.tgz", - "integrity": "sha512-+HrbQdHaXQdGTRQzlqM4GQwm7aBQ8SA6PD5tNSZh0Z71jcVhNeFc/vMBf07A9KqwkMTjojOiJYXz1YkQN/eZEA==", - "dependencies": { - "long": "^5.2.1", - "protobufjs": "^7.1.2" - }, - "engines": { - "node": ">=14" - } - }, "node_modules/@homebridge/node-pty-prebuilt-multiarch": { "version": "0.11.12", "resolved": "https://registry.npmjs.org/@homebridge/node-pty-prebuilt-multiarch/-/node-pty-prebuilt-multiarch-0.11.12.tgz", @@ -1692,60 +1671,6 @@ "node": ">=14" } }, - "node_modules/@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" - }, - "node_modules/@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "node_modules/@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "node_modules/@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" - }, - "node_modules/@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", - "dependencies": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "node_modules/@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" - }, - "node_modules/@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" - }, - "node_modules/@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" - }, - "node_modules/@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" - }, - "node_modules/@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" - }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -2118,7 +2043,8 @@ "node_modules/@types/node": { "version": "20.8.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.2.tgz", - "integrity": "sha512-Vvycsc9FQdwhxE3y3DzeIxuEJbWGDsnrxvMADzTDF/lcdR9/K+AQIeAghTQsHtotg/q0j3WEOYS/jQgSdWue3w==" + "integrity": "sha512-Vvycsc9FQdwhxE3y3DzeIxuEJbWGDsnrxvMADzTDF/lcdR9/K+AQIeAghTQsHtotg/q0j3WEOYS/jQgSdWue3w==", + "dev": true }, "node_modules/@types/prop-types": { "version": "15.7.8", @@ -2371,35 +2297,20 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@withfig/api-bindings": { - "version": "0.30.3", - "resolved": "https://registry.npmjs.org/@withfig/api-bindings/-/api-bindings-0.30.3.tgz", - "integrity": "sha512-BDtsXb888gzUq6NPPvnHW8InLRM2zqgvF1Eq7ns/tlducbygRbHvM71UPkJekDkLMTUhkFCOhrtsWIR3LuESmw==", - "dependencies": { - "long": "^5.2.3", - "protobufjs": "^7.2.4" - }, - "engines": { - "node": ">=16" - } - }, "node_modules/@withfig/autocomplete": { - "version": "2.651.0", - "resolved": "https://registry.npmjs.org/@withfig/autocomplete/-/autocomplete-2.651.0.tgz", - "integrity": "sha512-Qw9cRf1rqMyervbtU7SU2XZcIBCJW4OmSP0ykgnzw5tP0FmZZhnyZKl8guzoDVvKfdBDBYwecqnLbBIF0sEruQ==", + "version": "2.675.0", + "resolved": "https://registry.npmjs.org/@withfig/autocomplete/-/autocomplete-2.675.0.tgz", + "integrity": "sha512-G6peK+GJyr0UceMV/oo4jo4fCmbKTbIe3Bhaso3M0Holwy69iLGW+uTbGdWdg1COeQZATZIPubdIUJb1GufJrA==", "dependencies": { "@fig/autocomplete-generators": "^2.4.0", "@fig/autocomplete-helpers": "^1.0.7", - "@fig/autocomplete-hooks": "^1.0.2", - "@withfig/api-bindings": "^0.30.3", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "semver": "^7.5.4", + "semver": "^7.6.2", "strip-json-comments": "^5.0.1", - "yaml": "^2.3.2" + "yaml": "^2.4.5" }, "engines": { - "node": ">=18" + "node": ">=20", + "pnpm": ">=9" } }, "node_modules/@withfig/autocomplete-types": { @@ -6374,7 +6285,8 @@ "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true }, "node_modules/js-yaml": { "version": "3.14.1", @@ -6865,15 +6777,11 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" - }, "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" }, @@ -6881,17 +6789,6 @@ "loose-envify": "cli.js" } }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -7569,29 +7466,6 @@ "signal-exit": "^3.0.2" } }, - "node_modules/protobufjs": { - "version": "7.2.5", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz", - "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==", - "hasInstallScript": true, - "dependencies": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/node": ">=13.7.0", - "long": "^5.0.0" - }, - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -7667,29 +7541,6 @@ "node": ">=0.10.0" } }, - "node_modules/react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", - "dependencies": { - "loose-envify": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", - "dependencies": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" - }, - "peerDependencies": { - "react": "^18.2.0" - } - }, "node_modules/react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", @@ -7967,21 +7818,10 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", - "dependencies": { - "loose-envify": "^1.1.0" - } - }, "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "dependencies": { - "lru-cache": "^6.0.0" - }, + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", "bin": { "semver": "bin/semver.js" }, @@ -9040,11 +8880,6 @@ "node": ">=10" } }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, "node_modules/yaml": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz", @@ -9808,26 +9643,6 @@ } } }, - "@fig/autocomplete-hooks": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@fig/autocomplete-hooks/-/autocomplete-hooks-1.0.2.tgz", - "integrity": "sha512-4T/UVZcrJjnv9zy+hF8ifIrlCd0DeZ0I+t3Zy8dvKqFXeYnMM+z/SdQYb8SvTwu5VdRcQtvYnJHINks8jySG+A==", - "requires": { - "@withfig/api-bindings": "^0.29.3", - "react": "^18.2.0" - }, - "dependencies": { - "@withfig/api-bindings": { - "version": "0.29.4", - "resolved": "https://registry.npmjs.org/@withfig/api-bindings/-/api-bindings-0.29.4.tgz", - "integrity": "sha512-+HrbQdHaXQdGTRQzlqM4GQwm7aBQ8SA6PD5tNSZh0Z71jcVhNeFc/vMBf07A9KqwkMTjojOiJYXz1YkQN/eZEA==", - "requires": { - "long": "^5.2.1", - "protobufjs": "^7.1.2" - } - } - } - }, "@homebridge/node-pty-prebuilt-multiarch": { "version": "0.11.12", "resolved": "https://registry.npmjs.org/@homebridge/node-pty-prebuilt-multiarch/-/node-pty-prebuilt-multiarch-0.11.12.tgz", @@ -10389,60 +10204,6 @@ "dev": true, "optional": true }, - "@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" - }, - "@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" - }, - "@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", - "requires": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" - }, - "@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" - }, - "@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" - }, - "@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" - }, - "@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" - }, "@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -10707,7 +10468,8 @@ "@types/node": { "version": "20.8.2", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.2.tgz", - "integrity": "sha512-Vvycsc9FQdwhxE3y3DzeIxuEJbWGDsnrxvMADzTDF/lcdR9/K+AQIeAghTQsHtotg/q0j3WEOYS/jQgSdWue3w==" + "integrity": "sha512-Vvycsc9FQdwhxE3y3DzeIxuEJbWGDsnrxvMADzTDF/lcdR9/K+AQIeAghTQsHtotg/q0j3WEOYS/jQgSdWue3w==", + "dev": true }, "@types/prop-types": { "version": "15.7.8", @@ -10871,29 +10633,16 @@ "eslint-visitor-keys": "^3.4.1" } }, - "@withfig/api-bindings": { - "version": "0.30.3", - "resolved": "https://registry.npmjs.org/@withfig/api-bindings/-/api-bindings-0.30.3.tgz", - "integrity": "sha512-BDtsXb888gzUq6NPPvnHW8InLRM2zqgvF1Eq7ns/tlducbygRbHvM71UPkJekDkLMTUhkFCOhrtsWIR3LuESmw==", - "requires": { - "long": "^5.2.3", - "protobufjs": "^7.2.4" - } - }, "@withfig/autocomplete": { - "version": "2.651.0", - "resolved": "https://registry.npmjs.org/@withfig/autocomplete/-/autocomplete-2.651.0.tgz", - "integrity": "sha512-Qw9cRf1rqMyervbtU7SU2XZcIBCJW4OmSP0ykgnzw5tP0FmZZhnyZKl8guzoDVvKfdBDBYwecqnLbBIF0sEruQ==", + "version": "2.675.0", + "resolved": "https://registry.npmjs.org/@withfig/autocomplete/-/autocomplete-2.675.0.tgz", + "integrity": "sha512-G6peK+GJyr0UceMV/oo4jo4fCmbKTbIe3Bhaso3M0Holwy69iLGW+uTbGdWdg1COeQZATZIPubdIUJb1GufJrA==", "requires": { "@fig/autocomplete-generators": "^2.4.0", "@fig/autocomplete-helpers": "^1.0.7", - "@fig/autocomplete-hooks": "^1.0.2", - "@withfig/api-bindings": "^0.30.3", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "semver": "^7.5.4", + "semver": "^7.6.2", "strip-json-comments": "^5.0.1", - "yaml": "^2.3.2" + "yaml": "^2.4.5" } }, "@withfig/autocomplete-types": { @@ -13720,7 +13469,8 @@ "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true }, "js-yaml": { "version": "3.14.1", @@ -14061,27 +13811,15 @@ } } }, - "long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" - }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, "requires": { "js-tokens": "^3.0.0 || ^4.0.0" } }, - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "requires": { - "yallist": "^4.0.0" - } - }, "make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -14572,25 +14310,6 @@ "signal-exit": "^3.0.2" } }, - "protobufjs": { - "version": "7.2.5", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.2.5.tgz", - "integrity": "sha512-gGXRSXvxQ7UiPgfw8gevrfRWcTlSbOFg+p/N+JVJEK5VhueL2miT6qTymqAmjr1Q5WbOCyJbyrk6JfWKwlFn6A==", - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/node": ">=13.7.0", - "long": "^5.0.0" - } - }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -14635,23 +14354,6 @@ } } }, - "react": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react/-/react-18.2.0.tgz", - "integrity": "sha512-/3IjMdb2L9QbBdWiW5e3P2/npwMBaU9mHCSCUzNln0ZCYbcfTsGbTJrU/kGemdH2IWmB2ioZ+zkxtmq6g09fGQ==", - "requires": { - "loose-envify": "^1.1.0" - } - }, - "react-dom": { - "version": "18.2.0", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.2.0.tgz", - "integrity": "sha512-6IMTriUmvsjHUjNtEDudZfuDQUoWXVxKHhlEGSk81n4YFS+r/Kl99wXiwlVXtPBtJenozv2P+hxDsw9eA7Xo6g==", - "requires": { - "loose-envify": "^1.1.0", - "scheduler": "^0.23.0" - } - }, "react-is": { "version": "18.2.0", "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", @@ -14827,21 +14529,10 @@ "is-regex": "^1.1.4" } }, - "scheduler": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.0.tgz", - "integrity": "sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==", - "requires": { - "loose-envify": "^1.1.0" - } - }, "semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", - "requires": { - "lru-cache": "^6.0.0" - } + "version": "7.6.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==" }, "set-function-name": { "version": "2.0.1", @@ -15574,11 +15265,6 @@ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" - }, "yaml": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.0.tgz", diff --git a/package.json b/package.json index 53e7b5f..648bd84 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "homepage": "https://github.com/microsoft/inshellisense#readme", "dependencies": { "@homebridge/node-pty-prebuilt-multiarch": "^0.11.12", - "@withfig/autocomplete": "2.651.0", + "@withfig/autocomplete": "2.675.0", "@xterm/addon-unicode11": "^0.8.0", "@xterm/headless": "^5.5.0", "ajv": "^8.12.0", diff --git a/src/runtime/suggestion.ts b/src/runtime/suggestion.ts index 5e0f2d9..0dd94f0 100644 --- a/src/runtime/suggestion.ts +++ b/src/runtime/suggestion.ts @@ -9,7 +9,7 @@ import { runTemplates } from "./template.js"; import { Suggestion, SuggestionBlob } from "./model.js"; import log from "../utils/log.js"; -enum SuggestionIcons { +export enum SuggestionIcons { File = "📄", Folder = "📁", Subcommand = "📦", diff --git a/src/tests/runtime/__snapshots__/runtime.test.ts.snap b/src/tests/runtime/__snapshots__/runtime.test.ts.snap index 2e2eb37..d138eca 100644 --- a/src/tests/runtime/__snapshots__/runtime.test.ts.snap +++ b/src/tests/runtime/__snapshots__/runtime.test.ts.snap @@ -476,7 +476,7 @@ exports[`parseCommand loadSpec 1`] = ` "allNames": [ "add-tags-to-certificate", ], - "description": "Adds one or more tags to an ACM certificate. Tags are labels that you can use to identify and organize your AWS resources. Each tag consists of a key and an optional value. You specify the certificate on input by its Amazon Resource Name (ARN). You specify the tag by using a key-value pair. You can apply a tag to just one certificate if you want to identify a specific characteristic of that certificate, or you can apply the same tag to multiple certificates if you want to filter for a common relationship among those certificates. Similarly, you can apply the same tag to multiple resources if you want to specify a relationship among those resources. For example, you can add the same tag to an ACM certificate and an Elastic Load Balancing load balancer to indicate that they are both used by the same website. For more information, see Tagging ACM certificates. To remove one or more tags, use the RemoveTagsFromCertificate action. To view all of the tags that have been applied to the certificate, use the ListTagsForCertificate action", + "description": "Adds one or more tags to an ACM certificate. Tags are labels that you can use to identify and organize your Amazon Web Services resources. Each tag consists of a key and an optional value. You specify the certificate on input by its Amazon Resource Name (ARN). You specify the tag by using a key-value pair. You can apply a tag to just one certificate if you want to identify a specific characteristic of that certificate, or you can apply the same tag to multiple certificates if you want to filter for a common relationship among those certificates. Similarly, you can apply the same tag to multiple resources if you want to specify a relationship among those resources. For example, you can add the same tag to an ACM certificate and an Elastic Load Balancing load balancer to indicate that they are both used by the same website. For more information, see Tagging ACM certificates. To remove one or more tags, use the RemoveTagsFromCertificate action. To view all of the tags that have been applied to the certificate, use the ListTagsForCertificate action", "icon": "📦", "insertValue": undefined, "name": "add-tags-to-certificate", diff --git a/src/tests/runtime/runtime.test.ts b/src/tests/runtime/runtime.test.ts index 5acf7af..77294da 100644 --- a/src/tests/runtime/runtime.test.ts +++ b/src/tests/runtime/runtime.test.ts @@ -1,8 +1,11 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. +import fs from "node:fs"; + import { getSuggestions } from "../../runtime/runtime.js"; import { Shell } from "../../utils/shell.js"; +import { SuggestionIcons } from "../../runtime/suggestion.js"; const testData = [ { name: "partialPrefixFilter", command: "git sta" }, @@ -39,20 +42,48 @@ describe(`parseCommand`, () => { }); }); -const platformTestData = [ - { name: "macosSpawnCommand", command: "brew install mullvad-brow", platform: "darwin", maxSuggestions: 1, expectedNames: ["mullvad-browser"] }, +const commandSuggestionsData = [ + { + name: "brewInstallMullvad", + command: "brew install mullvad-brow", + platforms: ["darwin"], + maxSuggestions: 1, + expectedNames: ["mullvad-browser"], + expectedIcons: ["🍺"], + }, + { name: "gitStat", command: "git stat", maxSuggestions: 1, expectedNames: ["status"], expectedIcons: [SuggestionIcons.Subcommand] }, // subcommand generator + { name: "gitStatus", command: "git status ", expectedNames: ["demo.ts"] }, // script + post-process generator + { name: "ls", command: "ls ", maxSuggestions: 1, expectedNames: [".eslintrc.cjs"], expectedIcons: [SuggestionIcons.File] }, // file generator + { name: "cd", command: "cd ", maxSuggestions: 1, expectedNames: ["build/"], expectedIcons: [SuggestionIcons.Folder] }, // folder generator + { name: "find", command: "find -", maxSuggestions: 1, expectedIcons: [SuggestionIcons.Option] }, // filtering file generator + { name: "goTool", command: "go build -buildmode ", maxSuggestions: 1, expectedNames: ["archive"] }, // script + split-on generator + { name: "preCommitRun", command: "pre-commit run ", maxSuggestions: 1, expectedIcons: [SuggestionIcons.Option] }, // script + post-process generator w/ console logs ]; -describe(`parsePlatformCommand`, () => { - platformTestData.forEach(({ command, name, maxSuggestions, expectedNames, platform }) => { - if (platform != null && process.platform != platform) return; +describe(`getCommandSuggestions`, () => { + beforeAll(async () => await getCommandSuggestionsSetup()); + + commandSuggestionsData.forEach(({ command, name, maxSuggestions, expectedNames, expectedIcons, platforms }) => { + if (platforms != null && !platforms.includes(process.platform)) return; test(name, async () => { const suggestions = await getSuggestions(command, process.cwd(), Shell.Cmd); if (suggestions != null && suggestions.suggestions != null) { suggestions.suggestions = suggestions?.suggestions.slice(0, maxSuggestions); } const names = suggestions?.suggestions.map((s) => s.allNames).flat() ?? []; - expect(names).toEqual(expect.arrayContaining(expectedNames)); + const icons = suggestions?.suggestions.map((s) => s.icon) ?? []; + expect(names).toEqual(expect.arrayContaining(expectedNames ?? [])); + expect(icons).toEqual(expect.arrayContaining(expectedIcons ?? [])); }); }); + + afterAll(async () => await getCommandSuggestionsCleanup()); }); + +const getCommandSuggestionsSetup = async () => { + fs.closeSync(fs.openSync("demo.ts", "w")); +}; + +const getCommandSuggestionsCleanup = async () => { + fs.rmSync("demo.ts"); +}; From 0aae1d6fa6a8d7dd3851a1090cf0db406a184460 Mon Sep 17 00:00:00 2001 From: Chapman Pendery Date: Thu, 5 Sep 2024 11:23:15 -0700 Subject: [PATCH 2/3] fix: let fs generators get all suggestions Signed-off-by: Chapman Pendery --- src/tests/runtime/runtime.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/runtime/runtime.test.ts b/src/tests/runtime/runtime.test.ts index 77294da..8f0c8e0 100644 --- a/src/tests/runtime/runtime.test.ts +++ b/src/tests/runtime/runtime.test.ts @@ -53,8 +53,8 @@ const commandSuggestionsData = [ }, { name: "gitStat", command: "git stat", maxSuggestions: 1, expectedNames: ["status"], expectedIcons: [SuggestionIcons.Subcommand] }, // subcommand generator { name: "gitStatus", command: "git status ", expectedNames: ["demo.ts"] }, // script + post-process generator - { name: "ls", command: "ls ", maxSuggestions: 1, expectedNames: [".eslintrc.cjs"], expectedIcons: [SuggestionIcons.File] }, // file generator - { name: "cd", command: "cd ", maxSuggestions: 1, expectedNames: ["build/"], expectedIcons: [SuggestionIcons.Folder] }, // folder generator + { name: "ls", command: "ls ", expectedNames: [".eslintrc.cjs"], expectedIcons: [SuggestionIcons.File] }, // file generator + { name: "cd", command: "cd ", expectedNames: ["build/"], expectedIcons: [SuggestionIcons.Folder] }, // folder generator { name: "find", command: "find -", maxSuggestions: 1, expectedIcons: [SuggestionIcons.Option] }, // filtering file generator { name: "goTool", command: "go build -buildmode ", maxSuggestions: 1, expectedNames: ["archive"] }, // script + split-on generator { name: "preCommitRun", command: "pre-commit run ", maxSuggestions: 1, expectedIcons: [SuggestionIcons.Option] }, // script + post-process generator w/ console logs From fe2d6018ebca7d7b7f81d450ae59343f03cb1dfa Mon Sep 17 00:00:00 2001 From: Chapman Pendery Date: Tue, 10 Sep 2024 11:11:08 -0700 Subject: [PATCH 3/3] fix: bad test case Signed-off-by: Chapman Pendery --- src/tests/runtime/runtime.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tests/runtime/runtime.test.ts b/src/tests/runtime/runtime.test.ts index 8f0c8e0..a65e563 100644 --- a/src/tests/runtime/runtime.test.ts +++ b/src/tests/runtime/runtime.test.ts @@ -54,7 +54,7 @@ const commandSuggestionsData = [ { name: "gitStat", command: "git stat", maxSuggestions: 1, expectedNames: ["status"], expectedIcons: [SuggestionIcons.Subcommand] }, // subcommand generator { name: "gitStatus", command: "git status ", expectedNames: ["demo.ts"] }, // script + post-process generator { name: "ls", command: "ls ", expectedNames: [".eslintrc.cjs"], expectedIcons: [SuggestionIcons.File] }, // file generator - { name: "cd", command: "cd ", expectedNames: ["build/"], expectedIcons: [SuggestionIcons.Folder] }, // folder generator + { name: "cd", command: "cd ", expectedNames: ["docs/"], expectedIcons: [SuggestionIcons.Folder] }, // folder generator { name: "find", command: "find -", maxSuggestions: 1, expectedIcons: [SuggestionIcons.Option] }, // filtering file generator { name: "goTool", command: "go build -buildmode ", maxSuggestions: 1, expectedNames: ["archive"] }, // script + split-on generator { name: "preCommitRun", command: "pre-commit run ", maxSuggestions: 1, expectedIcons: [SuggestionIcons.Option] }, // script + post-process generator w/ console logs