Merge pull request #7296 from continuedev/nate/more-warnings-fixes

Nate/more-warnings-fixes
This commit is contained in:
Nate Sesti 2025-08-22 08:54:19 -07:00 • committed by GitHub
commit 7751c0763b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 2765 additions and 2992 deletions

View file

@ -93,6 +93,13 @@ runs:
path: binary/node_modules
key: ${{ runner.os }}-binary-node-modules-${{ hashFiles('binary/package-lock.json') }}
- name: Install binary dependencies
if: steps.binary-cache.outputs.cache-hit != 'true'
shell: bash
run: |
cd binary
npm ci
- name: Build the binaries
shell: bash
run: |

View file

@ -36,7 +36,7 @@ jobs:
- name: Install dependencies
run: |
cd extensions/cli
npm ci
npm ci --include=optional
- name: Run linting
run: |
@ -58,8 +58,14 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: extensions/cli/package-lock.json
- name: Cache CLI node_modules
uses: actions/cache@v4
with:
path: extensions/cli/node_modules
key: ${{ runner.os }}-node${{ matrix.node-version }}-cli-modules-${{ hashFiles('extensions/cli/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node${{ matrix.node-version }}-cli-modules-
- name: Setup packages
uses: ./.github/actions/setup-packages
@ -72,13 +78,18 @@ jobs:
- name: Install dependencies
run: |
cd extensions/cli
npm ci
npm ci --include=optional
- name: Build
run: |
cd extensions/cli
npm run build
- name: Run smoke tests
run: |
cd extensions/cli
npm run test:smoke
# e2e tests are failing on Windows specifically - likely due to stdout flush issues
- name: Run tests
if: matrix.os != 'windows-latest'

336
core/package-lock.json generated
View file

@ -25,7 +25,6 @@
"@sentry/esbuild-plugin": "^4.0.2",
"@sentry/node": "^9.43.0",
"@sentry/vite-plugin": "^4.0.2",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@xenova/transformers": "2.14.0",
"adf-to-md": "^1.1.0",
"async-mutex": "^0.5.0",
@ -105,6 +104,8 @@
"@types/tar": "^6.1.13",
"@types/uuid": "^9.0.7",
"@types/win-ca": "^3.5.4",
"@typescript-eslint/eslint-plugin": "^8.40.0",
"@typescript-eslint/parser": "^8.40.0",
"cross-env": "^7.0.3",
"esbuild": "0.17.19",
"eslint": "^8",
@ -3388,9 +3389,10 @@
}
},
"node_modules/@eslint-community/eslint-utils": {
"version": "4.4.1",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.1.tgz",
"integrity": "sha512-s3O3waFUrMV8P/XaF/+ZTp1X9XBZW1a4B97ZnjQF2KYWaFD2A8KyFBsrsfSjEmjn3RGWAIuvlneuZm3CUK3jbA==",
"version": "4.7.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.7.0.tgz",
"integrity": "sha512-dyybb3AcajC7uha6CvhdVRJqaKyn7w2YKqKyAN37NKYgZT36w+iRb0Dymmc5qEJ549c/S31cMMSFd75bteCpCw==",
"license": "MIT",
"dependencies": {
"eslint-visitor-keys": "^3.4.3"
},
@ -6984,122 +6986,150 @@
}
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.18.0.tgz",
"integrity": "sha512-94EQTWZ40mzBc42ATNIBimBEDltSJ9RQHCC8vc/PDbxi4k8dVwUAv4o98dk50M1zB+JGFxp43FP7f8+FP8R6Sw==",
"version": "8.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.40.0.tgz",
"integrity": "sha512-w/EboPlBwnmOBtRbiOvzjD+wdiZdgFeo17lkltrtn7X37vagKKWJABvyfsJXTlHe6XBzugmYgd4A4nW+k8Mixw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/regexpp": "^4.10.0",
"@typescript-eslint/scope-manager": "7.18.0",
"@typescript-eslint/type-utils": "7.18.0",
"@typescript-eslint/utils": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0",
"@typescript-eslint/scope-manager": "8.40.0",
"@typescript-eslint/type-utils": "8.40.0",
"@typescript-eslint/utils": "8.40.0",
"@typescript-eslint/visitor-keys": "8.40.0",
"graphemer": "^1.4.0",
"ignore": "^5.3.1",
"ignore": "^7.0.0",
"natural-compare": "^1.4.0",
"ts-api-utils": "^1.3.0"
"ts-api-utils": "^2.1.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"@typescript-eslint/parser": "^7.0.0",
"eslint": "^8.56.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
}
},
"node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
"integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
"license": "MIT",
"engines": {
"node": ">= 4"
"@typescript-eslint/parser": "^8.40.0",
"eslint": "^8.57.0 || ^9.0.0",
"typescript": ">=4.8.4 <6.0.0"
}
},
"node_modules/@typescript-eslint/parser": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.18.0.tgz",
"integrity": "sha512-4Z+L8I2OqhZV8qA132M4wNL30ypZGYOQVBfMgxDH/K5UX0PNqTu1c6za9ST5r9+tavvHiTWmBnKzpCJ/GlVFtg==",
"peer": true,
"version": "8.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.40.0.tgz",
"integrity": "sha512-jCNyAuXx8dr5KJMkecGmZ8KI61KBUhkCob+SD+C+I5+Y1FWI2Y3QmY4/cxMCC5WAsZqoEtEETVhUiUMIGCf6Bw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/scope-manager": "7.18.0",
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/typescript-estree": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0",
"@typescript-eslint/scope-manager": "8.40.0",
"@typescript-eslint/types": "8.40.0",
"@typescript-eslint/typescript-estree": "8.40.0",
"@typescript-eslint/visitor-keys": "8.40.0",
"debug": "^4.3.4"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.56.0"
"eslint": "^8.57.0 || ^9.0.0",
"typescript": ">=4.8.4 <6.0.0"
}
},
"node_modules/@typescript-eslint/project-service": {
"version": "8.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.40.0.tgz",
"integrity": "sha512-/A89vz7Wf5DEXsGVvcGdYKbVM9F7DyFXj52lNYUDS1L9yJfqjW/fIp5PgMuEJL/KeqVTe2QSbXAGUZljDUpArw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/tsconfig-utils": "^8.40.0",
"@typescript-eslint/types": "^8.40.0",
"debug": "^4.3.4"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"typescript": ">=4.8.4 <6.0.0"
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.18.0.tgz",
"integrity": "sha512-jjhdIE/FPF2B7Z1uzc6i3oWKbGcHb87Qw7AWj6jmEqNOfDFbJWtjt/XfwCpvNkpGWlcJaog5vTR+VV8+w9JflA==",
"version": "8.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.40.0.tgz",
"integrity": "sha512-y9ObStCcdCiZKzwqsE8CcpyuVMwRouJbbSrNuThDpv16dFAj429IkM6LNb1dZ2m7hK5fHyzNcErZf7CEeKXR4w==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0"
"@typescript-eslint/types": "8.40.0",
"@typescript-eslint/visitor-keys": "8.40.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.18.0.tgz",
"integrity": "sha512-XL0FJXuCLaDuX2sYqZUUSOJ2sG5/i1AAze+axqmLnSkNEVMVYLF+cbwlB2w8D1tinFuSikHmFta+P+HOofrLeA==",
"dependencies": {
"@typescript-eslint/typescript-estree": "7.18.0",
"@typescript-eslint/utils": "7.18.0",
"debug": "^4.3.4",
"ts-api-utils": "^1.3.0"
},
"node_modules/@typescript-eslint/tsconfig-utils": {
"version": "8.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.40.0.tgz",
"integrity": "sha512-jtMytmUaG9d/9kqSl/W3E3xaWESo4hFDxAIHGVW/WKKtQhesnRIJSAJO6XckluuJ6KDB5woD1EiqknriCtAmcw==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || >=20.0.0"
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.56.0"
"typescript": ">=4.8.4 <6.0.0"
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "8.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.40.0.tgz",
"integrity": "sha512-eE60cK4KzAc6ZrzlJnflXdrMqOBaugeukWICO2rB0KNvwdIMaEaYiywwHMzA1qFpTxrLhN9Lp4E/00EgWcD3Ow==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "8.40.0",
"@typescript-eslint/typescript-estree": "8.40.0",
"@typescript-eslint/utils": "8.40.0",
"debug": "^4.3.4",
"ts-api-utils": "^2.1.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.57.0 || ^9.0.0",
"typescript": ">=4.8.4 <6.0.0"
}
},
"node_modules/@typescript-eslint/types": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.18.0.tgz",
"integrity": "sha512-iZqi+Ds1y4EDYUtlOOC+aUmxnE9xS/yCigkjA7XpTKV6nCBd3Hp/PRGGmdwnfkV2ThMyYldP1wRpm/id99spTQ==",
"version": "8.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.40.0.tgz",
"integrity": "sha512-ETdbFlgbAmXHyFPwqUIYrfc12ArvpBhEVgGAxVYSwli26dn8Ko+lIo4Su9vI9ykTZdJn+vJprs/0eZU0YMAEQg==",
"dev": true,
"license": "MIT",
"engines": {
"node": "^18.18.0 || >=20.0.0"
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
@ -7107,36 +7137,40 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.18.0.tgz",
"integrity": "sha512-aP1v/BSPnnyhMHts8cf1qQ6Q1IFwwRvAQGRvBFkWlo3/lH29OXA3Pts+c10nxRxIBrDnoMqzhgdwVe5f2D6OzA==",
"version": "8.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.40.0.tgz",
"integrity": "sha512-k1z9+GJReVVOkc1WfVKs1vBrR5MIKKbdAjDTPvIK3L8De6KbFfPFt6BKpdkdk7rZS2GtC/m6yI5MYX+UsuvVYQ==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/visitor-keys": "7.18.0",
"@typescript-eslint/project-service": "8.40.0",
"@typescript-eslint/tsconfig-utils": "8.40.0",
"@typescript-eslint/types": "8.40.0",
"@typescript-eslint/visitor-keys": "8.40.0",
"debug": "^4.3.4",
"globby": "^11.1.0",
"fast-glob": "^3.3.2",
"is-glob": "^4.0.3",
"minimatch": "^9.0.4",
"semver": "^7.6.0",
"ts-api-utils": "^1.3.0"
"ts-api-utils": "^2.1.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
"peerDependencies": {
"typescript": ">=4.8.4 <6.0.0"
}
},
"node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
"version": "7.6.3",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz",
"integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==",
"version": "7.7.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
"integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
"dev": true,
"license": "ISC",
"bin": {
"semver": "bin/semver.js"
},
@ -7145,42 +7179,60 @@
}
},
"node_modules/@typescript-eslint/utils": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.18.0.tgz",
"integrity": "sha512-kK0/rNa2j74XuHVcoCZxdFBMF+aq/vH83CXAOHieC+2Gis4mF8jJXT5eAfyD3K0sAxtPuwxaIOIOvhwzVDt/kw==",
"version": "8.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.40.0.tgz",
"integrity": "sha512-Cgzi2MXSZyAUOY+BFwGs17s7ad/7L+gKt6Y8rAVVWS+7o6wrjeFN4nVfTpbE25MNcxyJ+iYUXflbs2xR9h4UBg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@typescript-eslint/scope-manager": "7.18.0",
"@typescript-eslint/types": "7.18.0",
"@typescript-eslint/typescript-estree": "7.18.0"
"@eslint-community/eslint-utils": "^4.7.0",
"@typescript-eslint/scope-manager": "8.40.0",
"@typescript-eslint/types": "8.40.0",
"@typescript-eslint/typescript-estree": "8.40.0"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
},
"peerDependencies": {
"eslint": "^8.56.0"
"eslint": "^8.57.0 || ^9.0.0",
"typescript": ">=4.8.4 <6.0.0"
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "7.18.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.18.0.tgz",
"integrity": "sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==",
"version": "8.40.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.40.0.tgz",
"integrity": "sha512-8CZ47QwalyRjsypfwnbI3hKy5gJDPmrkLjkgMxhi0+DZZ2QNx2naS6/hWoVYUHU7LU2zleF68V9miaVZvhFfTA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@typescript-eslint/types": "7.18.0",
"eslint-visitor-keys": "^3.4.3"
"@typescript-eslint/types": "8.40.0",
"eslint-visitor-keys": "^4.2.1"
},
"engines": {
"node": "^18.18.0 || >=20.0.0"
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/typescript-eslint"
}
},
"node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
"integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
},
"funding": {
"url": "https://opencollective.com/eslint"
}
},
"node_modules/@ungap/structured-clone": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.1.tgz",
@ -7652,14 +7704,6 @@
"resolved": "https://registry.npmjs.org/array-timsort/-/array-timsort-1.0.3.tgz",
"integrity": "sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ=="
},
"node_modules/array-union": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==",
"engines": {
"node": ">=8"
}
},
"node_modules/array.prototype.findlastindex": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz",
@ -9450,17 +9494,6 @@
"node": "^14.15.0 || ^16.10.0 || >=18.0.0"
}
},
"node_modules/dir-glob": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
"integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
"dependencies": {
"path-type": "^4.0.0"
},
"engines": {
"node": ">=8"
}
},
"node_modules/doctrine": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz",
@ -10956,15 +10989,17 @@
"integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ=="
},
"node_modules/fast-glob": {
"version": "3.3.2",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz",
"integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==",
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
"integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==",
"dev": true,
"license": "MIT",
"dependencies": {
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.2",
"merge2": "^1.3.0",
"micromatch": "^4.0.4"
"micromatch": "^4.0.8"
},
"engines": {
"node": ">=8.6.0"
@ -10974,6 +11009,8 @@
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
"integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
"dev": true,
"license": "ISC",
"dependencies": {
"is-glob": "^4.0.1"
},
@ -11687,34 +11724,6 @@
"url": "https://github.com/sponsors/ljharb"
}
},
"node_modules/globby": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
"integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
"dependencies": {
"array-union": "^2.1.0",
"dir-glob": "^3.0.1",
"fast-glob": "^3.2.9",
"ignore": "^5.2.0",
"merge2": "^1.4.1",
"slash": "^3.0.0"
},
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/globby/node_modules/ignore": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
"integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
"license": "MIT",
"engines": {
"node": ">= 4"
}
},
"node_modules/google-auth-library": {
"version": "9.15.0",
"resolved": "https://registry.npmjs.org/google-auth-library/-/google-auth-library-9.15.0.tgz",
@ -14514,6 +14523,8 @@
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
"integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">= 8"
}
@ -14616,6 +14627,7 @@
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
"integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
"dev": true,
"dependencies": {
"braces": "^3.0.3",
"picomatch": "^2.3.1"
@ -15841,14 +15853,6 @@
"node": ">=16"
}
},
"node_modules/path-type": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==",
"engines": {
"node": ">=8"
}
},
"node_modules/pathe": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
@ -17624,6 +17628,7 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==",
"dev": true,
"engines": {
"node": ">=8"
}
@ -18614,14 +18619,16 @@
}
},
"node_modules/ts-api-utils": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.4.3.tgz",
"integrity": "sha512-i3eMG77UTMD0hZhgRS562pv83RC6ukSAC2GMNWc+9dieh/+jDM5u5YG+NHX6VNDRHQcHwmsTHctP9LhbC3WxVw==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz",
"integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=16"
"node": ">=18.12"
},
"peerDependencies": {
"typescript": ">=4.2.0"
"typescript": ">=4.8.4"
}
},
"node_modules/ts-jest": {
@ -18885,6 +18892,7 @@
"version": "5.7.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz",
"integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==",
"devOptional": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"

View file

@ -36,6 +36,8 @@
"@types/tar": "^6.1.13",
"@types/uuid": "^9.0.7",
"@types/win-ca": "^3.5.4",
"@typescript-eslint/eslint-plugin": "^8.40.0",
"@typescript-eslint/parser": "^8.40.0",
"cross-env": "^7.0.3",
"esbuild": "0.17.19",
"eslint": "^8",
@ -66,7 +68,6 @@
"@sentry/esbuild-plugin": "^4.0.2",
"@sentry/node": "^9.43.0",
"@sentry/vite-plugin": "^4.0.2",
"@typescript-eslint/eslint-plugin": "^7.8.0",
"@xenova/transformers": "2.14.0",
"adf-to-md": "^1.1.0",
"async-mutex": "^0.5.0",

74
extensions/cli/BUILD.md Normal file
View file

@ -0,0 +1,74 @@
# Build Process Documentation
## Overview
The Continue CLI uses esbuild to bundle the application along with local packages (`@continuedev/config-yaml` and `@continuedev/openai-adapters`) into a single distributable file. This ensures that users who install the CLI from npm don't need to worry about local file references.
## Build Steps
1. **Install dependencies**: `npm install`
2. **Build**: `npm run build`
- This first builds the local packages
- Then bundles everything with esbuild
## How it Works
### Bundling Strategy
The `build.mjs` script uses esbuild to:
- Bundle all TypeScript/JavaScript code into a single ES module
- Include local packages (`@continuedev/config-yaml`, `@continuedev/openai-adapters`) directly in the bundle
- Keep problematic or native dependencies external (e.g., `@sentry/profiling-node`, `winston`, `express`)
- Create a wrapper script (`dist/cn.js`) with the proper shebang for CLI execution
### Key Features
- **Local Package Bundling**: Local packages are bundled directly, avoiding `file:` reference issues
- **Stub for Optional Dependencies**: `react-devtools-core` is stubbed to prevent runtime errors
- **CommonJS Compatibility**: Adds `createRequire` to support packages that use dynamic requires
- **Source Maps**: Generates source maps for debugging
- **Metadata**: Creates `dist/meta.json` with bundle analysis information
## Testing
### Smoke Tests
Run smoke tests to verify the build:
```bash
npm run test:smoke
```
The smoke tests verify:
- Bundle files exist
- CLI commands work (--version, --help)
- Bundle size is reasonable (<20MB)
- Local packages are properly bundled
- No missing runtime dependencies
## Troubleshooting
### Common Issues
1. **Module not found errors**: Check if the module needs to be added to the external list in `build.mjs`
2. **Native module issues**: Native modules should be marked as external
3. **Bundle too large**: Review bundled packages in `dist/meta.json` and consider marking large packages as external
### Analyzing the Bundle
After building, check `dist/meta.json` to see:
- What packages were bundled
- Bundle size breakdown
- Input/output file mappings
## Publishing
When publishing to npm:
1. The bundled files in `dist/` are included
2. Users install via `npm install -g @continuedev/cli`
3. The `cn` command becomes available globally
4. No local file references or missing dependencies

91
extensions/cli/build.mjs Normal file
View file

@ -0,0 +1,91 @@
#!/usr/bin/env node
import * as esbuild from "esbuild";
import { writeFileSync, chmodSync } from "fs";
import { resolve, dirname } from "path";
import { fileURLToPath } from "url";
const __dirname = dirname(fileURLToPath(import.meta.url));
// List of packages to mark as external (ONLY native modules that cannot be bundled)
// Note: Everything else will be bundled to create a self-contained CLI
// Users should not need to install any additional dependencies
const external = [
"@sentry/profiling-node", // Contains native profiler bindings (optional)
"fsevents", // macOS native file watcher (optional dependency)
];
console.log("Building CLI with esbuild...");
// Plugin to handle optional react-devtools-core
const optionalDevtoolsPlugin = {
name: "optional-devtools",
setup(build) {
build.onResolve({ filter: /^react-devtools-core$/ }, () => {
// Return path to our stub instead of marking as external
return { path: resolve(__dirname, "stubs/react-devtools-core.js") };
});
},
};
try {
const result = await esbuild.build({
entryPoints: ["src/index.ts"],
bundle: true,
platform: "node",
target: "node18",
format: "esm",
outfile: "dist/index.js",
external,
sourcemap: true,
minify: true, // Minify for smaller bundle size
metafile: true,
plugins: [optionalDevtoolsPlugin],
// Handle .js extensions in imports
resolveExtensions: [".ts", ".tsx", ".js", ".jsx", ".json"],
// Handle TypeScript paths and local packages
alias: {
"@continuedev/config-yaml": resolve(
__dirname,
"../../packages/config-yaml/dist/index.js",
),
"@continuedev/openai-adapters": resolve(
__dirname,
"../../packages/openai-adapters/dist/index.js",
),
"@continuedev/config-types": resolve(
__dirname,
"../../packages/config-types/dist/index.js",
),
"core": resolve(__dirname, "../../core"),
"@continuedev/fetch": resolve(__dirname, "../../packages/fetch/dist/index.js"),
"@continuedev/llm-info": resolve(__dirname, "../../packages/llm-info/dist/index.js"),
},
// Add banner to create require for CommonJS packages
banner: {
js: `import { createRequire } from 'module';
const require = createRequire(import.meta.url);`,
},
});
// Write metafile for analysis
writeFileSync("dist/meta.json", JSON.stringify(result.metafile, null, 2));
// Create wrapper script with shebang
writeFileSync("dist/cn.js", "#!/usr/bin/env node\nimport('./index.js');");
// Make the wrapper script executable
chmodSync("dist/cn.js", 0o755);
// Calculate bundle size
const bundleSize = result.metafile.outputs["dist/index.js"].bytes;
console.log(
`✓ Build complete! Bundle size: ${(bundleSize / 1024 / 1024).toFixed(2)} MB`,
);
} catch (error) {
console.error("Build failed:", error);
process.exit(1);
}

File diff suppressed because it is too large Load diff

View file

@ -6,14 +6,19 @@
"types": "dist/index.d.ts",
"type": "module",
"bin": {
"cn": "dist/index.js"
"cn": "dist/cn.js"
},
"scripts": {
"test": "vitest run",
"test:watch": "vitest watch",
"test:ui": "vitest --ui",
"test:e2e": "vitest run --config vitest.e2e.config.ts",
"build": "tsc -p tsconfig.build.json",
"test:smoke": "node smoke-test.mjs",
"build:tsc": "tsc -p tsconfig.build.json",
"build:local-deps": "cd ../../packages/config-types && npm run build && cd ../config-yaml && npm run build && cd ../openai-adapters && npm run build",
"build:validate": "node validate-aliases.mjs",
"build:bundle": "node build.mjs",
"build": "npm run build:local-deps && npm run build:validate && npm run build:bundle",
"start": "node dist/index.js",
"dev": "tsx src/index.ts",
"repomix:sdk": "npx repomix node_modules/@continuedev/sdk --ignore **/api,cli-repomix.xml -o sdk-repomix.xml",
@ -39,8 +44,8 @@
},
"homepage": "https://continue.dev",
"dependencies": {
"@continuedev/config-yaml": "^1.0.96",
"@continuedev/openai-adapters": "^1.4.1",
"@continuedev/config-yaml": "file:../../packages/config-yaml",
"@continuedev/openai-adapters": "file:../../packages/openai-adapters",
"@continuedev/sdk": "^0.0.13",
"@modelcontextprotocol/sdk": "^1.17.2",
"@opentelemetry/api": "^1.9.0",
@ -104,11 +109,13 @@
"@types/readline-sync": "^1.4.8",
"@types/shell-quote": "^1.7.5",
"@types/supertest": "^6.0.3",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^8.39.0",
"@typescript-eslint/parser": "^8.39.0",
"@vitest/ui": "^3.2.4",
"conventional-changelog-conventionalcommits": "^9.1.0",
"cross-env": "^7.0.3",
"esbuild": "^0.25.9",
"eslint": "^9.32.0",
"eslint-import-resolver-typescript": "^4.4.4",
"eslint-plugin-import": "^2.32.0",

230
extensions/cli/smoke-test.mjs Executable file
View file

@ -0,0 +1,230 @@
#!/usr/bin/env node
import { execSync } from "child_process";
import { existsSync, readFileSync } from "fs";
import { resolve, dirname } from "path";
import { fileURLToPath } from "url";
const __dirname = dirname(fileURLToPath(import.meta.url));
// Colors for output
const colors = {
green: "\x1b[32m",
red: "\x1b[31m",
yellow: "\x1b[33m",
reset: "\x1b[0m",
};
let testsPassed = 0;
let testsFailed = 0;
function runTest(name, testFn) {
process.stdout.write(`Testing ${name}... `);
try {
testFn();
console.log(`${colors.green}✓${colors.reset}`);
testsPassed++;
} catch (error) {
console.log(`${colors.red}✗${colors.reset}`);
console.error(` Error: ${error.message}`);
testsFailed++;
}
}
function execCommand(command, options = {}) {
return execSync(command, {
cwd: __dirname,
encoding: "utf8",
stdio: "pipe",
...options,
});
}
console.log("🧪 Running smoke tests for bundled CLI...\n");
// Test 1: Check if bundle exists
runTest("Bundle file exists", () => {
if (!existsSync(resolve(__dirname, "dist/index.js"))) {
throw new Error("dist/index.js not found");
}
if (!existsSync(resolve(__dirname, "dist/cn.js"))) {
throw new Error("dist/cn.js not found");
}
});
// Test 2: Check if wrapper script is executable
runTest("Wrapper script has shebang", () => {
const content = readFileSync(resolve(__dirname, "dist/cn.js"), "utf8");
if (!content.startsWith("#!/usr/bin/env node")) {
throw new Error("Wrapper script missing shebang");
}
});
// Cross-platform command execution helper
function getCLICommand(args = "") {
const isWindows = process.platform === "win32";
if (isWindows) {
return `node dist/cn.js ${args}`;
} else {
return `./dist/cn.js ${args}`;
}
}
// Test 3: Version command works
runTest("Version command", () => {
const output = execCommand(getCLICommand("--version"));
const packageJson = JSON.parse(
readFileSync(resolve(__dirname, "package.json"), "utf8"),
);
if (!output.includes(packageJson.version)) {
throw new Error(
`Version mismatch. Expected ${packageJson.version}, got: ${output}`,
);
}
});
// Test 4: Help command works
runTest("Help command", () => {
const output = execCommand(getCLICommand("--help"));
if (!output.includes("Continue CLI") || !output.includes("--version")) {
throw new Error("Help output missing expected content");
}
});
// Test 5: Check bundle size
runTest("Bundle size is reasonable", () => {
const isWindows = process.platform === "win32";
const command = isWindows
? `powershell -Command "(Get-Item dist/index.js).length / 1MB"`
: `ls -lh dist/index.js`;
let sizeInMB;
if (isWindows) {
try {
const output = execCommand(command);
sizeInMB = parseFloat(output.trim());
} catch {
// Fallback for Windows if PowerShell fails
const stats = readFileSync(resolve(__dirname, "dist/index.js"));
sizeInMB = stats.length / (1024 * 1024);
}
} else {
const stats = execCommand(command);
const sizeMatch = stats.match(/(\d+(?:\.\d+)?[MK])/);
if (sizeMatch) {
const size = sizeMatch[1];
const numSize = parseFloat(size);
const unit = size.slice(-1);
sizeInMB = unit === "M" ? numSize : numSize / 1024;
}
}
console.log(`(${sizeInMB.toFixed(1)}M)`);
// This is arbitrary. We might go over at some point,
// in which case you can just increase this.
if (sizeInMB > 20) {
throw new Error(`Bundle too large: ${sizeInMB.toFixed(1)}M`);
}
});
// Test 6: Check that local packages are bundled
runTest("Local packages are bundled", () => {
const bundleContent = readFileSync(
resolve(__dirname, "dist/index.js"),
"utf8",
);
// Check for code from @continuedev/config-yaml
if (
!bundleContent.includes("AssistantUnrolled") &&
!bundleContent.includes("config-yaml")
) {
throw new Error("@continuedev/config-yaml not properly bundled");
}
// Check for code from @continuedev/openai-adapters
// Since the bundle is minified, check for strings that would be present
// even after minification (e.g., error messages, property names)
if (
!bundleContent.includes("anthropic") &&
!bundleContent.includes("gemini") &&
!bundleContent.includes("openai") &&
!bundleContent.includes("azure") &&
!bundleContent.includes("bedrock")
) {
throw new Error("@continuedev/openai-adapters not properly bundled");
}
});
// Test 7: Test that the CLI can be invoked programmatically
runTest("CLI can be invoked", () => {
try {
// Test that the CLI runs without crashing when given no args
const isWindows = process.platform === "win32";
const nullDevice = isWindows ? "nul" : "/dev/null";
execCommand(`${getCLICommand("--help")} > ${nullDevice} 2>&1`);
} catch (error) {
throw new Error(`CLI invocation failed: ${error.message}`);
}
});
// Test 8: Check metadata file
runTest("Build metadata exists", () => {
if (!existsSync(resolve(__dirname, "dist/meta.json"))) {
throw new Error("dist/meta.json not found");
}
const meta = JSON.parse(
readFileSync(resolve(__dirname, "dist/meta.json"), "utf8"),
);
if (!meta.inputs || !meta.outputs) {
throw new Error("Invalid metadata structure");
}
});
// Test 9: Verify no missing external dependencies
runTest("No missing runtime dependencies", () => {
// This would fail in Test 3 if dependencies were missing, but let's be explicit
const output = execCommand(`${getCLICommand("--version")} 2>&1`, {
env: { ...process.env, NODE_ENV: "production" },
});
if (
output.includes("Cannot find module") ||
output.includes("MODULE_NOT_FOUND")
) {
throw new Error("Missing module detected in output");
}
});
// Test 10: Test npm link scenario
runTest("CLI works via npm link", () => {
try {
// Simply test that we can execute with node directly
const output = execCommand("node dist/cn.js --version 2>&1");
const packageJson = JSON.parse(
readFileSync(resolve(__dirname, "package.json"), "utf8"),
);
if (!output.includes(packageJson.version)) {
throw new Error("Version not found when running via node");
}
} catch (error) {
throw new Error(`npm link scenario failed: ${error.message}`);
}
});
// Summary
console.log("\n" + "=".repeat(50));
if (testsFailed === 0) {
console.log(
`${colors.green}✅ All ${testsPassed} tests passed!${colors.reset}`,
);
process.exit(0);
} else {
console.log(
`${colors.red}❌ ${testsFailed} test(s) failed, ${testsPassed} passed${colors.reset}`,
);
process.exit(1);
}

View file

@ -291,7 +291,7 @@ async function unrollAssistantWithConfig(
apiBase: env.apiBase,
rootPath:
packageIdentifier.uriType === "file"
? dirname(packageIdentifier.filePath)
? dirname(packageIdentifier.fileUri)
: undefined,
}),
{
@ -328,7 +328,7 @@ async function loadConfigYaml(
apiClient: DefaultApiInterface,
): Promise<AssistantUnrolled> {
return await unrollAssistantWithConfig(
{ filePath, uriType: "file" },
{ fileUri: filePath, uriType: "file" },
accessToken,
organizationId,
apiClient,

View file

@ -0,0 +1,52 @@
/**
* Optional profiling integration loader
* This module handles the optional @sentry/profiling-node dependency
* which contains native bindings and may not be available in all environments
*/
let profilingIntegration: any = null;
let profilingLoadAttempted = false;
/**
* Lazy load the profiling integration
*/
async function loadProfilingIntegration() {
if (profilingLoadAttempted) {
return profilingIntegration;
}
profilingLoadAttempted = true;
try {
// Try to load the native profiling module if available
const profilingModule = await import("@sentry/profiling-node");
profilingIntegration = profilingModule.nodeProfilingIntegration;
} catch {
// Profiling module not available - this is fine, profiling is optional
// The CLI will work without it, just without performance profiling
}
return profilingIntegration;
}
/**
* Returns the profiling integration if available, or a no-op function
* Note: This is now async to handle lazy loading
*/
export async function getProfilingIntegration() {
const integration = await loadProfilingIntegration();
if (integration) {
return integration();
}
// Return empty object as a no-op integration
return {};
}
/**
* Check if profiling is available
* Note: This is now async to handle lazy loading
*/
export async function isProfilingAvailable(): Promise<boolean> {
await loadProfilingIntegration();
return profilingIntegration !== null;
}

View file

@ -1,6 +1,9 @@
import * as Sentry from "@sentry/node";
import { nodeProfilingIntegration } from "@sentry/profiling-node";
import {
getProfilingIntegration,
isProfilingAvailable,
} from "./sentry-profiling.js";
import { logger } from "./util/logger.js";
import { getVersion } from "./version.js";
@ -45,12 +48,21 @@ class SentryService {
};
}
private initialize() {
private async initialize() {
if (this.initialized || !this.config.dsn) {
return;
}
try {
const integrations = [];
const profilingIntegration = await getProfilingIntegration();
if (
profilingIntegration &&
Object.keys(profilingIntegration).length > 0
) {
integrations.push(profilingIntegration);
}
Sentry.init({
dsn: this.config.dsn,
environment: this.config.environment,
@ -58,7 +70,7 @@ class SentryService {
sampleRate: this.config.sampleRate,
profilesSampleRate: this.config.profilesSampleRate,
tracesSampleRate: this.config.tracesSampleRate,
integrations: [nodeProfilingIntegration()],
integrations,
beforeSend(event) {
// Filter out certain error types if needed
if (event.exception?.values?.[0]?.type === "AbortError") {
@ -72,6 +84,7 @@ class SentryService {
logger.debug("Sentry initialized", {
environment: this.config.environment,
release: this.config.release,
profilingAvailable: await isProfilingAvailable(),
});
} catch (error) {
logger.error("Failed to initialize Sentry", error);

View file

@ -3,6 +3,7 @@ import { glob, GlobOptionsWithFileTypesFalse } from "glob";
import { FILE_IGNORE_PATTERNS, FILE_PATTERNS } from "../util/filePatterns.js";
import { getFileWatcher } from "../util/fileWatcher.js";
import { isGitRepo } from "../util/git.js";
import { logger } from "../util/logger.js";
import { BaseService } from "./BaseService.js";
import { serviceContainer } from "./ServiceContainer.js";
@ -88,7 +89,7 @@ export class FileIndexService extends BaseService<FileIndexServiceState> {
} catch (error) {
const errorMessage =
error instanceof Error ? error.message : String(error);
console.error("Error performing full file index:", error);
logger.error("Error performing full file index:", error);
this.setState({ isIndexing: false, error: errorMessage });
}
}
@ -103,7 +104,7 @@ export class FileIndexService extends BaseService<FileIndexServiceState> {
// and provides little value since files change less predictably
const inGitRepo = isGitRepo();
if (!inGitRepo) {
console.log("Skipping file watcher: not in a git repository");
logger.debug("Skipping file watcher: not in a git repository");
return;
}
@ -153,13 +154,9 @@ export class FileIndexService extends BaseService<FileIndexServiceState> {
}));
this.setState({ files });
console.log(
`File index updated: +${addedFiles.length} -${removedFiles.length} files`,
);
}
} catch (error) {
console.error("Error handling file system change:", error);
logger.error("Error handling file system change:", error);
const errorMessage =
error instanceof Error ? error.message : String(error);
this.setState({ error: errorMessage });

View file

@ -4,8 +4,8 @@ import { constructLlmApi, LLMConfig } from "@continuedev/openai-adapters";
import {
AuthConfig,
getAccessToken,
getOrganizationId,
getModelName,
getOrganizationId,
} from "../auth/workos.js";
import { getLlmApi } from "../config.js";
import { logger } from "../util/logger.js";

View file

@ -1,6 +1,6 @@
// Import after mocking
import { AssistantUnrolled } from "@continuedev/config-yaml";
import { afterEach, beforeEach, describe, expect, vi, test } from "vitest";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import * as workos from "./auth/workos.js";
import * as commands from "./commands/commands.js";
@ -138,18 +138,10 @@ describe("handleSlashCommands", () => {
expect(result).toBeNull();
});
test("unknown slash command should return error", async () => {
test("unknown slash command should return null", async () => {
const result = await handleSlashCommands("/unknown", mockAssistant);
expect(result).not.toBeNull();
expect(result?.output).toBe("Unknown command: unknown");
});
test("/org command should no longer exist (now merged into /config)", async () => {
const result = await handleSlashCommands("/org list", mockAssistant);
expect(result).not.toBeNull();
expect(result?.output).toBe("Unknown command: org");
expect(result).toBeNull();
});
});
});

View file

@ -163,5 +163,16 @@ export async function handleSlashCommands(
return { newInput };
}
// Check if this command would match any available commands (same logic as UI)
const allCommands = getAllSlashCommands(assistant);
const hasMatches = allCommands.some((cmd) =>
cmd.name.toLowerCase().includes(command.toLowerCase()),
);
// If no commands match, treat this as regular text instead of an unknown command
if (!hasMatches) {
return null;
}
return { output: `Unknown command: ${command}` };
}

View file

@ -152,6 +152,17 @@ const UserInput: React.FC<UserInputProps> = ({
}
}
// Check if there are any matching commands
const filteredCommands = allCommands.filter((cmd) =>
cmd.name.toLowerCase().includes(afterSlash.toLowerCase()),
);
// If no commands match, hide the dropdown to allow normal Enter behavior
if (filteredCommands.length === 0) {
setShowSlashCommands(false);
return;
}
// Show selector for partial matches
setShowSlashCommands(true);
setSlashCommandFilter(afterSlash);

View file

@ -0,0 +1,6 @@
// Stub for react-devtools-core to prevent errors when it's not installed
export default {
connectToDevTools: () => {
// No-op - devtools not available in production bundle
},
};

View file

@ -0,0 +1,184 @@
#!/usr/bin/env node
import { readFileSync, existsSync } from "fs";
import { resolve, dirname } from "path";
import { fileURLToPath } from "url";
const __dirname = dirname(fileURLToPath(import.meta.url));
// Colors for output
const colors = {
green: "\x1b[32m",
red: "\x1b[31m",
yellow: "\x1b[33m",
blue: "\x1b[34m",
reset: "\x1b[0m",
};
/**
* Parse the build.mjs file to extract defined aliases
*/
function getDefinedAliases() {
const buildPath = resolve(__dirname, "build.mjs");
const buildContent = readFileSync(buildPath, "utf8");
// Find the alias object in the build file
const aliasMatch = buildContent.match(/alias:\s*{([^}]+)}/s);
if (!aliasMatch) {
console.warn(`${colors.yellow}Warning: No aliases found in build.mjs${colors.reset}`);
return new Set();
}
// Extract package names from the alias definitions
// Split by lines and filter out comments
const aliasBlock = aliasMatch[1];
const lines = aliasBlock.split('\n');
const aliases = new Set();
for (const line of lines) {
// Skip commented lines
if (line.trim().startsWith('//')) {
continue;
}
// Look for package names in non-commented lines
// Match both @continuedev/* packages and simple package names like "core"
const packageMatch = line.match(/"(@continuedev\/[^"]+|[^"@\/]+)":/);
if (packageMatch) {
aliases.add(packageMatch[1]);
}
}
return aliases;
}
/**
* Find all local packages referenced with file: in package.json files
*/
function findLocalPackages(startPath, visited = new Set()) {
const localPackages = new Set();
function scanPackageJson(packageJsonPath, depth = 0) {
// Avoid infinite recursion
if (visited.has(packageJsonPath) || depth > 10) {
return;
}
visited.add(packageJsonPath);
if (!existsSync(packageJsonPath)) {
return;
}
try {
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
const packageDir = dirname(packageJsonPath);
// Check both dependencies and devDependencies
const allDeps = {
...packageJson.dependencies,
...packageJson.devDependencies,
};
for (const [depName, depVersion] of Object.entries(allDeps)) {
if (typeof depVersion === "string" && depVersion.startsWith("file:")) {
// This is a local package
localPackages.add(depName);
// Recursively check this package's dependencies
const depPath = resolve(packageDir, depVersion.replace("file:", ""));
const depPackageJson = resolve(depPath, "package.json");
if (existsSync(depPackageJson)) {
scanPackageJson(depPackageJson, depth + 1);
}
}
}
} catch (error) {
console.error(`${colors.red}Error reading ${packageJsonPath}: ${error.message}${colors.reset}`);
}
}
// Start from the CLI's package.json
scanPackageJson(startPath);
return localPackages;
}
/**
* Main validation function
*/
function validateAliases() {
console.log(`${colors.blue}🔍 Validating esbuild aliases...${colors.reset}\n`);
// Get defined aliases from build.mjs
const definedAliases = getDefinedAliases();
console.log(`Found ${definedAliases.size} aliases in build.mjs:`);
definedAliases.forEach(alias => {
console.log(` ✓ ${alias}`);
});
console.log();
// Find all local packages that need aliases
const cliPackageJson = resolve(__dirname, "package.json");
const localPackages = findLocalPackages(cliPackageJson);
console.log(`Found ${localPackages.size} local package dependencies:`);
localPackages.forEach(pkg => {
console.log(` • ${pkg}`);
});
console.log();
// Check for missing aliases
const missingAliases = [];
for (const pkg of localPackages) {
if (!definedAliases.has(pkg)) {
missingAliases.push(pkg);
}
}
// Check for unnecessary aliases (defined but not used)
const unnecessaryAliases = [];
for (const alias of definedAliases) {
if (!localPackages.has(alias)) {
unnecessaryAliases.push(alias);
}
}
// Report results
if (missingAliases.length > 0) {
console.log(`${colors.red}❌ Missing aliases (WILL CAUSE RUNTIME ERRORS):${colors.reset}`);
missingAliases.forEach(pkg => {
console.log(` ✗ ${pkg}`);
});
console.log();
console.log(`${colors.red}Add these to the alias section in build.mjs:${colors.reset}`);
missingAliases.forEach(pkg => {
const packageName = pkg.replace("@continuedev/", "").replace(/-/g, "_");
console.log(` "${pkg}": resolve(__dirname, "../../packages/${pkg.replace("@continuedev/", "")}/dist/index.js"),`);
});
console.log();
}
if (unnecessaryAliases.length > 0) {
console.log(`${colors.yellow}⚠️ Potentially unnecessary aliases:${colors.reset}`);
unnecessaryAliases.forEach(alias => {
console.log(` ? ${alias}`);
});
console.log();
}
// Exit with appropriate code
if (missingAliases.length > 0) {
console.log(`${colors.red}✗ Validation failed! Missing ${missingAliases.length} required alias(es).${colors.reset}`);
console.log(`${colors.red}This would cause runtime errors in the bundled CLI.${colors.reset}`);
process.exit(1);
} else if (unnecessaryAliases.length > 0) {
console.log(`${colors.yellow}✓ Validation passed with warnings.${colors.reset}`);
process.exit(0);
} else {
console.log(`${colors.green}✅ All aliases are correctly configured!${colors.reset}`);
process.exit(0);
}
}
// Run validation
validateAliases();