merge: main
This commit is contained in:
commit
fa9eb17e84
48 changed files with 4470 additions and 3212 deletions
|
|
@ -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: |
|
||||
|
|
|
|||
13
.github/workflows/beta-release.yml
vendored
13
.github/workflows/beta-release.yml
vendored
|
|
@ -24,13 +24,22 @@ jobs:
|
|||
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
always-auth: true
|
||||
|
||||
- name: Install dependencies
|
||||
- name: Setup packages
|
||||
uses: ./.github/actions/setup-packages
|
||||
|
||||
- name: Setup core component
|
||||
uses: ./.github/actions/setup-component
|
||||
with:
|
||||
component: core
|
||||
include-root: true
|
||||
|
||||
- name: Install CLI dependencies
|
||||
working-directory: extensions/cli
|
||||
run: npm ci
|
||||
env:
|
||||
|
|
|
|||
19
.github/workflows/cli-pr-checks.yml
vendored
19
.github/workflows/cli-pr-checks.yml
vendored
|
|
@ -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'
|
||||
|
|
|
|||
2
.github/workflows/jetbrains-release.yaml
vendored
2
.github/workflows/jetbrains-release.yaml
vendored
|
|
@ -189,6 +189,8 @@ jobs:
|
|||
cd ../../gui
|
||||
npm ci
|
||||
npm run build
|
||||
env:
|
||||
NODE_OPTIONS: "--max-old-space-size=8192"
|
||||
|
||||
# Run prepackage.js script
|
||||
- name: Run prepackage script
|
||||
|
|
|
|||
13
.github/workflows/stable-release.yml
vendored
13
.github/workflows/stable-release.yml
vendored
|
|
@ -40,7 +40,7 @@ jobs:
|
|||
token: ${{ secrets.SEMANTIC_RELEASE_TOKEN }}
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
|
@ -141,6 +141,17 @@ jobs:
|
|||
# Update version to stable (remove beta suffix)
|
||||
npm version ${{ steps.find_beta.outputs.stable_version }} --no-git-tag-version
|
||||
|
||||
- name: Setup packages (for direct stable release)
|
||||
if: ${{ inputs.release_type == 'direct-stable' }}
|
||||
uses: ./.github/actions/setup-packages
|
||||
|
||||
- name: Setup core component (for direct stable release)
|
||||
if: ${{ inputs.release_type == 'direct-stable' }}
|
||||
uses: ./.github/actions/setup-component
|
||||
with:
|
||||
component: core
|
||||
include-root: true
|
||||
|
||||
- name: Prepare package for direct stable release
|
||||
if: ${{ inputs.release_type == 'direct-stable' }}
|
||||
working-directory: extensions/cli
|
||||
|
|
|
|||
|
|
@ -29,11 +29,24 @@ export function loadConfigContextProviders(
|
|||
} {
|
||||
const providers: IContextProvider[] = [];
|
||||
const errors: ConfigValidationError[] = [];
|
||||
|
||||
const defaultProviders: IContextProvider[] = [
|
||||
new FileContextProvider({}),
|
||||
new CurrentFileContextProvider({}),
|
||||
new DiffContextProvider({}),
|
||||
new TerminalContextProvider({}),
|
||||
new ProblemsContextProvider({}),
|
||||
new RulesContextProvider({}),
|
||||
];
|
||||
|
||||
// Add from config
|
||||
if (configContext) {
|
||||
for (const config of configContext) {
|
||||
const cls = contextProviderClassFromName(config.provider) as any;
|
||||
if (!cls) {
|
||||
if (
|
||||
!cls &&
|
||||
!defaultProviders.find((p) => p.description.title === config.provider)
|
||||
) {
|
||||
errors.push({
|
||||
fatal: false,
|
||||
message: `Unknown context provider ${config.provider}`,
|
||||
|
|
@ -50,15 +63,6 @@ export function loadConfigContextProviders(
|
|||
}
|
||||
|
||||
// Add from defaults if not found in config
|
||||
const defaultProviders: IContextProvider[] = [
|
||||
new FileContextProvider({}),
|
||||
new CurrentFileContextProvider({}),
|
||||
new DiffContextProvider({}),
|
||||
new TerminalContextProvider({}),
|
||||
new ProblemsContextProvider({}),
|
||||
new RulesContextProvider({}),
|
||||
];
|
||||
|
||||
for (const defaultProvider of defaultProviders) {
|
||||
if (
|
||||
!providers.find(
|
||||
|
|
|
|||
|
|
@ -37,21 +37,6 @@ class FileContextProvider extends BaseContextProvider {
|
|||
await extras.ide.getWorkspaceDirs(),
|
||||
);
|
||||
|
||||
if (isSecurityConcern(relativePathOrBasename)) {
|
||||
return [
|
||||
{
|
||||
description: last2Parts,
|
||||
content:
|
||||
"Content redacted, this file cannot be viewed for security reasons",
|
||||
name: baseName,
|
||||
uri: {
|
||||
type: "file",
|
||||
value: fileUri,
|
||||
},
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
name: baseName,
|
||||
|
|
|
|||
|
|
@ -29,14 +29,6 @@ class ProblemsContextProvider extends BaseContextProvider {
|
|||
problem.filepath,
|
||||
workspaceDirs,
|
||||
);
|
||||
if (isSecurityConcern(relativePathOrBasename)) {
|
||||
return {
|
||||
description: "Problems in current file",
|
||||
content:
|
||||
"Content was redacted because the file is detected as a potential security concern",
|
||||
name: `Warnings in ${baseName}`,
|
||||
};
|
||||
}
|
||||
const content = await ide.readFile(problem.filepath);
|
||||
const lines = content.split("\n");
|
||||
const rangeContent = lines
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import DebugLocalsProvider from "./DebugLocalsProvider";
|
|||
import DiffContextProvider from "./DiffContextProvider";
|
||||
import DiscordContextProvider from "./DiscordContextProvider";
|
||||
import DocsContextProvider from "./DocsContextProvider";
|
||||
import FileContextProvider from "./FileContextProvider";
|
||||
import FileTreeContextProvider from "./FileTreeContextProvider";
|
||||
import FolderContextProvider from "./FolderContextProvider";
|
||||
import GitCommitContextProvider from "./GitCommitContextProvider";
|
||||
|
|
@ -41,6 +42,7 @@ import WebContextProvider from "./WebContextProvider";
|
|||
* See this issue for details: https://github.com/continuedev/continue/issues/1365
|
||||
*/
|
||||
export const Providers: (typeof BaseContextProvider)[] = [
|
||||
FileContextProvider,
|
||||
DiffContextProvider,
|
||||
FileTreeContextProvider,
|
||||
GitHubIssuesContextProvider,
|
||||
|
|
|
|||
|
|
@ -67,14 +67,6 @@ export const DEFAULT_SECURITY_IGNORE_DIRS = [
|
|||
// Environment and configuration directories
|
||||
".env/",
|
||||
"env/",
|
||||
".venv/",
|
||||
"venv/",
|
||||
|
||||
// IDE directories that may contain cached credentials
|
||||
// For now excluding, reasons for this unclear
|
||||
// ".vscode/",
|
||||
// ".idea/",
|
||||
// ".vs/",
|
||||
|
||||
// Cloud provider credential directories
|
||||
".aws/",
|
||||
|
|
@ -168,6 +160,8 @@ export const ADDITIONAL_INDEXING_IGNORE_FILETYPES = [
|
|||
"*.swp",
|
||||
"*.jsonl",
|
||||
// "*.prompt", // can be incredibly confusing for the LLM to have another set of instructions injected into the prompt
|
||||
// Application specific
|
||||
".continue/",
|
||||
];
|
||||
|
||||
export const ADDITIONAL_INDEXING_IGNORE_DIRS = [
|
||||
|
|
@ -189,6 +183,13 @@ export const ADDITIONAL_INDEXING_IGNORE_DIRS = [
|
|||
".cache/",
|
||||
"gems/",
|
||||
"vendor/",
|
||||
|
||||
".venv/",
|
||||
"venv/",
|
||||
|
||||
".vscode/",
|
||||
".idea/",
|
||||
".vs/",
|
||||
];
|
||||
|
||||
// Combined patterns: security + additional
|
||||
|
|
|
|||
|
|
@ -81,18 +81,7 @@ describe("isSecurityConcern", () => {
|
|||
it("should detect environment directories as security concerns", () => {
|
||||
expect(isSecurityConcern(".env/")).toBe(true);
|
||||
expect(isSecurityConcern("env/")).toBe(true);
|
||||
expect(isSecurityConcern(".venv/")).toBe(true);
|
||||
expect(isSecurityConcern("venv/")).toBe(true);
|
||||
expect(isSecurityConcern(".env/config")).toBe(true);
|
||||
expect(isSecurityConcern("project/.venv/lib")).toBe(true);
|
||||
});
|
||||
|
||||
it("should detect IDE directories as security concerns", () => {
|
||||
// expect(isSecurityConcern(".vscode/")).toBe(true);
|
||||
// expect(isSecurityConcern(".idea/")).toBe(true);
|
||||
// expect(isSecurityConcern(".vs/")).toBe(true);
|
||||
expect(isSecurityConcern(".vscode/settings.json")).toBe(true);
|
||||
// expect(isSecurityConcern(".idea/workspace.xml")).toBe(true);
|
||||
});
|
||||
|
||||
it("should detect cloud provider directories as security concerns", () => {
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ describe("LLM", () => {
|
|||
|
||||
testLLM(
|
||||
new Anthropic({
|
||||
model: "claude-3-5-sonnet-latest",
|
||||
model: "claude-sonnet-4-0",
|
||||
apiKey: process.env.ANTHROPIC_API_KEY,
|
||||
}),
|
||||
{ skip: false, testToolCall: true },
|
||||
|
|
|
|||
336
core/package-lock.json
generated
336
core/package-lock.json
generated
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
74
extensions/cli/BUILD.md
Normal 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
91
extensions/cli/build.mjs
Normal 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);
|
||||
}
|
||||
5118
extensions/cli/package-lock.json
generated
5118
extensions/cli/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -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,11 @@
|
|||
},
|
||||
"homepage": "https://continue.dev",
|
||||
"dependencies": {
|
||||
"@continuedev/config-yaml": "^1.0.96",
|
||||
"@continuedev/openai-adapters": "^1.4.1",
|
||||
"@sentry/profiling-node": "^9.43.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@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",
|
||||
|
|
@ -52,7 +60,6 @@
|
|||
"@opentelemetry/sdk-node": "^0.203.0",
|
||||
"@opentelemetry/semantic-conventions": "^1.36.0",
|
||||
"@sentry/node": "^9.43.0",
|
||||
"@sentry/profiling-node": "^9.43.0",
|
||||
"@types/express": "^5.0.3",
|
||||
"@types/react": "^19.1.8",
|
||||
"@types/turndown": "^5.0.5",
|
||||
|
|
@ -83,12 +90,9 @@
|
|||
"swr": "^2.3.4",
|
||||
"turndown": "^7.2.0",
|
||||
"typescript": "^5.8.3",
|
||||
"uri-js": "^4.4.1",
|
||||
"uuid": "^9.0.1",
|
||||
"winston": "^3.17.0",
|
||||
"yaml": "^2.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"yaml": "^2.8.0",
|
||||
"@semantic-release/changelog": "^6.0.3",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/github": "^11.0.3",
|
||||
|
|
@ -96,7 +100,6 @@
|
|||
"@testing-library/react": "^16.3.0",
|
||||
"@types/date-fns": "^2.5.3",
|
||||
"@types/diff": "^7.0.2",
|
||||
"@types/express": "^5.0.3",
|
||||
"@types/glob": "^8.1.0",
|
||||
"@types/ignore-walk": "^4.0.3",
|
||||
"@types/ink-testing-library": "^1.0.4",
|
||||
|
|
@ -105,17 +108,18 @@
|
|||
"@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",
|
||||
"eslint-plugin-unused-imports": "^4.1.4",
|
||||
"execa": "^9.6.0",
|
||||
"express": "^5.1.0",
|
||||
"happy-dom": "^18.0.1",
|
||||
"ink-testing-library": "^4.0.0",
|
||||
"jsdom": "^26.1.0",
|
||||
|
|
|
|||
230
extensions/cli/smoke-test.mjs
Executable file
230
extensions/cli/smoke-test.mjs
Executable 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);
|
||||
}
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
import {
|
||||
isValidAnthropicApiKey,
|
||||
getApiKeyValidationError,
|
||||
isValidAnthropicApiKey,
|
||||
} from "./util/apiKeyValidation.js";
|
||||
|
||||
describe("Free Trial Transition API Key Validation", () => {
|
||||
it("should validate API keys properly for free trial transition", () => {
|
||||
// Valid API keys
|
||||
expect(isValidAnthropicApiKey("TEST-ant-1234567890")).toBe(true);
|
||||
expect(isValidAnthropicApiKey("sk-ant-1234567890")).toBe(true);
|
||||
expect(
|
||||
isValidAnthropicApiKey("TEST-ant-api03_T3BlbkFJ1234567890abcdef"),
|
||||
isValidAnthropicApiKey("sk-ant-api03_T3BlbkFJ1234567890abcdef"),
|
||||
).toBe(true);
|
||||
|
||||
// Invalid API keys
|
||||
expect(isValidAnthropicApiKey("TEST-")).toBe(false);
|
||||
expect(isValidAnthropicApiKey("TEST-ant-")).toBe(false);
|
||||
expect(isValidAnthropicApiKey("sk-ant-")).toBe(false);
|
||||
expect(isValidAnthropicApiKey("TEST-openai-1234")).toBe(false);
|
||||
expect(isValidAnthropicApiKey("")).toBe(false);
|
||||
expect(isValidAnthropicApiKey(null)).toBe(false);
|
||||
|
|
@ -25,14 +25,14 @@ describe("Free Trial Transition API Key Validation", () => {
|
|||
expect(getApiKeyValidationError(null)).toBe("API key is required");
|
||||
expect(getApiKeyValidationError(undefined)).toBe("API key is required");
|
||||
expect(getApiKeyValidationError("TEST-")).toBe(
|
||||
'API key must start with "TEST-ant-"',
|
||||
'API key must start with "sk-ant-"',
|
||||
);
|
||||
expect(getApiKeyValidationError("TEST-openai-1234")).toBe(
|
||||
'API key must start with "TEST-ant-"',
|
||||
'API key must start with "sk-ant-"',
|
||||
);
|
||||
expect(getApiKeyValidationError("TEST-ant-")).toBe("API key is too short");
|
||||
expect(getApiKeyValidationError("sk-ant-")).toBe("API key is too short");
|
||||
expect(getApiKeyValidationError("invalid")).toBe(
|
||||
'API key must start with "TEST-ant-"',
|
||||
'API key must start with "sk-ant-"',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
52
extensions/cli/src/sentry-profiling.ts
Normal file
52
extensions/cli/src/sentry-profiling.ts
Normal 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;
|
||||
}
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 });
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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}` };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import * as fs from "fs";
|
||||
|
||||
import { throwIfFileIsSecurityConcern } from "core/indexing/ignore.js";
|
||||
|
||||
import { telemetryService } from "../../telemetry/telemetryService.js";
|
||||
import {
|
||||
calculateLinesOfCodeDiff,
|
||||
|
|
@ -97,7 +95,7 @@ Each string in the diffs array can contain multiple SEARCH/REPLACE blocks, and a
|
|||
preprocess: async (args) => {
|
||||
// Get and validate args
|
||||
const { filepath, diffs } = parseSearchAndReplaceArgs(args);
|
||||
throwIfFileIsSecurityConcern(filepath);
|
||||
|
||||
// Get current file contents
|
||||
if (!fs.existsSync(filepath)) {
|
||||
throw new Error(`file ${filepath} does not exist`);
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import useSWR from "swr";
|
|||
import { listUserOrganizations } from "../auth/workos.js";
|
||||
import { env } from "../env.js";
|
||||
import {
|
||||
isValidAnthropicApiKey,
|
||||
getApiKeyValidationError,
|
||||
isValidAnthropicApiKey,
|
||||
} from "../util/apiKeyValidation.js";
|
||||
import { updateAnthropicModelInYaml } from "../util/yamlConfigUpdater.js";
|
||||
|
||||
|
|
@ -270,7 +270,7 @@ const FreeTrialTransitionUI: React.FC<FreeTrialTransitionUIProps> = ({
|
|||
<Text></Text>
|
||||
{errorMessage && <Text color="red">{errorMessage}</Text>}
|
||||
<Text color="gray">
|
||||
Type your API key and press Enter (must start with 'TEST-ant-')
|
||||
Type your API key and press Enter (must start with 'sk-ant-')
|
||||
</Text>
|
||||
</Box>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -85,7 +85,9 @@ const IntroMessage: React.FC<IntroMessageProps> = ({
|
|||
{/* Rules */}
|
||||
{allRules.length > 0 && (
|
||||
<>
|
||||
<Text color="blue">Rules:</Text>
|
||||
<Text bold color="blue">
|
||||
Rules:
|
||||
</Text>
|
||||
{allRules.map((rule, index) => (
|
||||
<Text key={index}>
|
||||
- <Text color="white">{rule}</Text>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { type AssistantConfig } from "@continuedev/sdk";
|
||||
import { throwIfFileIsSecurityConcern } from "core/indexing/ignore.js";
|
||||
import { Box, Text, useApp, useInput } from "ink";
|
||||
import React, { useCallback, useState } from "react";
|
||||
|
||||
|
|
@ -153,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);
|
||||
|
|
@ -255,7 +265,6 @@ const UserInput: React.FC<UserInputProps> = ({
|
|||
// Read the file content and notify parent component
|
||||
if (onFileAttached) {
|
||||
try {
|
||||
throwIfFileIsSecurityConcern(filePath);
|
||||
const fs = await import("fs/promises");
|
||||
const content = await fs.readFile(filePath, "utf-8");
|
||||
onFileAttached(filePath, content);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
import {
|
||||
isValidAnthropicApiKey,
|
||||
getApiKeyValidationError,
|
||||
isValidAnthropicApiKey,
|
||||
} from "./apiKeyValidation.js";
|
||||
|
||||
describe("isValidAnthropicApiKey", () => {
|
||||
it("should return true for valid API keys", () => {
|
||||
expect(isValidAnthropicApiKey("TEST-ant-1234567890")).toBe(true);
|
||||
expect(isValidAnthropicApiKey("TEST-ant-abcdefghijklmnop")).toBe(true);
|
||||
expect(isValidAnthropicApiKey("TEST-ant-test-key-with-dashes")).toBe(true);
|
||||
expect(isValidAnthropicApiKey("sk-ant-1234567890")).toBe(true);
|
||||
expect(isValidAnthropicApiKey("sk-ant-abcdefghijklmnop")).toBe(true);
|
||||
expect(isValidAnthropicApiKey("sk-ant-test-key-with-dashes")).toBe(true);
|
||||
expect(
|
||||
isValidAnthropicApiKey("TEST-ant-api03_T3BlbkFJ1234567890abcdef"),
|
||||
isValidAnthropicApiKey("sk-ant-api03_T3BlbkFJ1234567890abcdef"),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("should return false for invalid API keys", () => {
|
||||
expect(isValidAnthropicApiKey("")).toBe(false);
|
||||
expect(isValidAnthropicApiKey("TEST-ant-")).toBe(false);
|
||||
expect(isValidAnthropicApiKey("sk-ant-")).toBe(false);
|
||||
expect(isValidAnthropicApiKey("TEST-")).toBe(false);
|
||||
expect(isValidAnthropicApiKey("TEST-openai-1234567890")).toBe(false);
|
||||
expect(isValidAnthropicApiKey("invalid-key")).toBe(false);
|
||||
|
|
@ -40,14 +40,14 @@ describe("getApiKeyValidationError", () => {
|
|||
expect(getApiKeyValidationError(null)).toBe("API key is required");
|
||||
expect(getApiKeyValidationError(undefined)).toBe("API key is required");
|
||||
expect(getApiKeyValidationError("TEST-")).toBe(
|
||||
'API key must start with "TEST-ant-"',
|
||||
'API key must start with "sk-ant-"',
|
||||
);
|
||||
expect(getApiKeyValidationError("TEST-openai-1234")).toBe(
|
||||
'API key must start with "TEST-ant-"',
|
||||
'API key must start with "sk-ant-"',
|
||||
);
|
||||
expect(getApiKeyValidationError("TEST-ant-")).toBe("API key is too short");
|
||||
expect(getApiKeyValidationError("sk-ant-")).toBe("API key is too short");
|
||||
expect(getApiKeyValidationError("invalid")).toBe(
|
||||
'API key must start with "TEST-ant-"',
|
||||
'API key must start with "sk-ant-"',
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ export function isValidAnthropicApiKey(
|
|||
return false;
|
||||
}
|
||||
|
||||
// Anthropic API keys must start with "TEST-ant-" and have additional characters
|
||||
return apiKey.startsWith("TEST-ant-") && apiKey.length > "TEST-ant-".length;
|
||||
// Anthropic API keys must start with "sk-ant-" and have additional characters
|
||||
return apiKey.startsWith("sk-ant-") && apiKey.length > "sk-ant-".length;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -26,11 +26,11 @@ export function getApiKeyValidationError(
|
|||
return "API key is required";
|
||||
}
|
||||
|
||||
if (!apiKey.startsWith("TEST-ant-")) {
|
||||
return 'API key must start with "TEST-ant-"';
|
||||
if (!apiKey.startsWith("sk-ant-")) {
|
||||
return 'API key must start with "sk-ant-"';
|
||||
}
|
||||
|
||||
if (apiKey.length <= "TEST-ant-".length) {
|
||||
if (apiKey.length <= "sk-ant-".length) {
|
||||
return "API key is too short";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import { parse } from "yaml";
|
|||
import { updateAnthropicModelInYaml } from "./yamlConfigUpdater.js";
|
||||
|
||||
describe("updateAnthropicModelInYaml", () => {
|
||||
const testApiKey = "TEST-ant-test123456789";
|
||||
const testApiKey = "sk-ant-test123456789";
|
||||
|
||||
describe("empty or invalid input", () => {
|
||||
it("should create new config from empty string", () => {
|
||||
|
|
@ -13,7 +13,7 @@ describe("updateAnthropicModelInYaml", () => {
|
|||
expect(result).toContain("version: 1.0.0");
|
||||
expect(result).toContain("schema: v1");
|
||||
expect(result).toContain("uses: anthropic/claude-4-sonnet");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: TEST-ant-test123456789");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: sk-ant-test123456789");
|
||||
});
|
||||
|
||||
it("should create new config from invalid YAML", () => {
|
||||
|
|
@ -22,7 +22,7 @@ describe("updateAnthropicModelInYaml", () => {
|
|||
|
||||
expect(result).toContain("name: Local Config");
|
||||
expect(result).toContain("uses: anthropic/claude-4-sonnet");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: TEST-ant-test123456789");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: sk-ant-test123456789");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ models:
|
|||
expect(result).toContain("# List of available models");
|
||||
expect(result).toContain("uses: openai/gpt-4");
|
||||
expect(result).toContain("uses: anthropic/claude-4-sonnet");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: TEST-ant-test123456789");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: sk-ant-test123456789");
|
||||
});
|
||||
|
||||
it("should preserve comments when updating existing model", () => {
|
||||
|
|
@ -65,7 +65,7 @@ models:
|
|||
expect(result).toContain("# My Continue config");
|
||||
expect(result).toContain("# List of available models");
|
||||
expect(result).toContain("uses: anthropic/claude-4-sonnet");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: TEST-ant-test123456789");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: sk-ant-test123456789");
|
||||
expect(result).not.toContain("old-key");
|
||||
});
|
||||
});
|
||||
|
|
@ -85,7 +85,7 @@ models:
|
|||
|
||||
expect(result).toContain("uses: openai/gpt-4");
|
||||
expect(result).toContain("uses: anthropic/claude-4-sonnet");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: TEST-ant-test123456789");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: sk-ant-test123456789");
|
||||
expect(result).toContain("OPENAI_API_KEY: TEST-openai-test");
|
||||
});
|
||||
|
||||
|
|
@ -106,7 +106,7 @@ models:
|
|||
|
||||
expect(result).toContain("uses: anthropic/claude-4-sonnet");
|
||||
expect(result).toContain("uses: openai/gpt-4");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: TEST-ant-test123456789");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: sk-ant-test123456789");
|
||||
expect(result).toContain("OPENAI_API_KEY: TEST-openai-test");
|
||||
expect(result).not.toContain("old-anthropic-key");
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ schema: v1
|
|||
expect(result).toContain("name: Local Config");
|
||||
expect(result).toContain("models:");
|
||||
expect(result).toContain("uses: anthropic/claude-4-sonnet");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: TEST-ant-test123456789");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: sk-ant-test123456789");
|
||||
});
|
||||
|
||||
it("should handle config with empty models array", () => {
|
||||
|
|
@ -148,7 +148,7 @@ models: []
|
|||
|
||||
expect(result).toContain("name: Local Config");
|
||||
expect(result).toContain("uses: anthropic/claude-4-sonnet");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: TEST-ant-test123456789");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: sk-ant-test123456789");
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -190,14 +190,14 @@ models: "not an array"
|
|||
const result = updateAnthropicModelInYaml(malformedConfig, testApiKey);
|
||||
|
||||
expect(result).toContain("uses: anthropic/claude-4-sonnet");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: TEST-ant-test123456789");
|
||||
expect(result).toContain("ANTHROPIC_API_KEY: sk-ant-test123456789");
|
||||
});
|
||||
|
||||
it("should handle different API key formats", () => {
|
||||
const differentKeys = [
|
||||
"TEST-ant-1234567890",
|
||||
"TEST-ant-abcdefghijklmnop",
|
||||
"TEST-ant-test-key-with-dashes",
|
||||
"sk-ant-1234567890",
|
||||
"sk-ant-abcdefghijklmnop",
|
||||
"sk-ant-test-key-with-dashes",
|
||||
];
|
||||
|
||||
differentKeys.forEach((key) => {
|
||||
|
|
|
|||
6
extensions/cli/stubs/react-devtools-core.js
vendored
Normal file
6
extensions/cli/stubs/react-devtools-core.js
vendored
Normal 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
|
||||
},
|
||||
};
|
||||
184
extensions/cli/validate-aliases.mjs
Executable file
184
extensions/cli/validate-aliases.mjs
Executable 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();
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
pluginGroup=com.github.continuedev.continueintellijextension
|
||||
pluginVersion=1.0.38
|
||||
pluginVersion=1.0.40
|
||||
platformVersion=2024.1
|
||||
kotlin.stdlib.default.dependency=false
|
||||
org.gradle.configuration-cache=true
|
||||
|
|
|
|||
11
extensions/vscode/package-lock.json
generated
11
extensions/vscode/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "1.1.71",
|
||||
"version": "1.1.79",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "1.1.71",
|
||||
"version": "1.1.79",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@continuedev/config-types": "file:../../packages/config-types",
|
||||
|
|
@ -111,6 +111,11 @@
|
|||
"@modelcontextprotocol/sdk": "^1.12.0",
|
||||
"@mozilla/readability": "^0.5.0",
|
||||
"@octokit/rest": "^20.1.1",
|
||||
"@sentry/cli": "^2.50.2",
|
||||
"@sentry/core": "^9.43.0",
|
||||
"@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",
|
||||
|
|
@ -143,7 +148,7 @@
|
|||
"node-html-markdown": "^1.3.0",
|
||||
"ollama": "^0.4.6",
|
||||
"onnxruntime-node": "1.14.0",
|
||||
"openai": "^4.104.0",
|
||||
"openai": "^5.13.1",
|
||||
"p-limit": "^6.1.0",
|
||||
"partial-json": "^0.1.7",
|
||||
"pg": "^8.11.3",
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "continue",
|
||||
"icon": "media/icon.png",
|
||||
"author": "Continue Dev, Inc",
|
||||
"version": "1.1.79",
|
||||
"version": "1.1.83",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/continuedev/continue"
|
||||
|
|
|
|||
|
|
@ -122,6 +122,11 @@ export class NextEditWindowManager {
|
|||
private editableRegionStartLine: number = 0;
|
||||
private editableRegionEndLine: number = 0;
|
||||
|
||||
// State tracking for key reservation.
|
||||
// By default it is set to free, and is only set to reserved when the transition is done.
|
||||
private keyReservationState: "free" | "reserved" | "transitioning" = "free";
|
||||
private latestOperationId = 0;
|
||||
|
||||
// Disposables
|
||||
private disposables: vscode.Disposable[] = [];
|
||||
|
||||
|
|
@ -170,20 +175,71 @@ export class NextEditWindowManager {
|
|||
this.loggingService = NextEditLoggingService.getInstance();
|
||||
}
|
||||
|
||||
// This is an implementation of last-action-wins.
|
||||
// For each action that fires setKeyReservation, it keeps its own operationId while incrementing latestOperationId.
|
||||
// When an action completes, checking for operationId === latestOperationId will determine which one came last.
|
||||
private async setKeyReservation(reserve: boolean): Promise<void> {
|
||||
// Increment and capture this operation's ID.
|
||||
const operationId = ++this.latestOperationId;
|
||||
|
||||
// Return early when already in desired state.
|
||||
if (
|
||||
(reserve && this.keyReservationState === "reserved") ||
|
||||
(!reserve && this.keyReservationState === "free")
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await this.performKeyReservation(reserve);
|
||||
|
||||
// Only update state if we're still the latest operation.
|
||||
if (operationId === this.latestOperationId) {
|
||||
this.keyReservationState = reserve ? "reserved" : "free";
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(`Failed to set nextEditWindowActive to ${reserve}: ${err}`);
|
||||
|
||||
// Only reset to free if we're still the latest operation.
|
||||
if (operationId === this.latestOperationId) {
|
||||
this.keyReservationState = "free";
|
||||
}
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
public async resetKeyReservation(): Promise<void> {
|
||||
// Reset internal tracking.
|
||||
this.keyReservationState = "free";
|
||||
this.latestOperationId = 0;
|
||||
|
||||
// Ensure VS Code context matches.
|
||||
try {
|
||||
await this.performKeyReservation(false);
|
||||
} catch (err) {
|
||||
console.error(`Failed to reset nextEditWindowActive context: ${err}`);
|
||||
}
|
||||
}
|
||||
|
||||
private async performKeyReservation(reserve: boolean): Promise<void> {
|
||||
try {
|
||||
await vscode.commands.executeCommand(
|
||||
"setContext",
|
||||
"nextEditWindowActive",
|
||||
reserve,
|
||||
);
|
||||
} catch (err) {
|
||||
console.error(`Failed to set nextEditWindowActive to ${reserve}: ${err}`);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
public static async reserveTabAndEsc() {
|
||||
await vscode.commands.executeCommand(
|
||||
"setContext",
|
||||
"nextEditWindowActive",
|
||||
true,
|
||||
);
|
||||
await NextEditWindowManager.getInstance().setKeyReservation(true);
|
||||
}
|
||||
|
||||
public static async freeTabAndEsc() {
|
||||
await vscode.commands.executeCommand(
|
||||
"setContext",
|
||||
"nextEditWindowActive",
|
||||
false,
|
||||
);
|
||||
await NextEditWindowManager.getInstance().setKeyReservation(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -202,7 +258,8 @@ export class NextEditWindowManager {
|
|||
|
||||
// Set nextEditWindowActive to false to free esc and tab,
|
||||
// letting them return to their original behaviors.
|
||||
await NextEditWindowManager.freeTabAndEsc();
|
||||
await this.resetKeyReservation();
|
||||
// await NextEditWindowManager.freeTabAndEsc();
|
||||
|
||||
// Register HIDE_TOOLTIP_COMMAND and ACCEPT_NEXT_EDIT_COMMAND with their corresponding callbacks.
|
||||
this.registerCommandSafely(HIDE_NEXT_EDIT_SUGGESTION_COMMAND, async () => {
|
||||
|
|
@ -353,14 +410,21 @@ export class NextEditWindowManager {
|
|||
|
||||
// Create and apply decoration with the text.
|
||||
if (newEditRangeSlice !== "") {
|
||||
await this.renderWindow(
|
||||
editor,
|
||||
currCursorPos,
|
||||
oldEditRangeSlice,
|
||||
newEditRangeSlice,
|
||||
this.editableRegionStartLine,
|
||||
diffLines,
|
||||
);
|
||||
try {
|
||||
await this.renderWindow(
|
||||
editor,
|
||||
currCursorPos,
|
||||
oldEditRangeSlice,
|
||||
newEditRangeSlice,
|
||||
this.editableRegionStartLine,
|
||||
diffLines,
|
||||
);
|
||||
} catch (error) {
|
||||
console.error("Failed to render window:", error);
|
||||
// Clean up and reset state.
|
||||
await this.hideAllNextEditWindows();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const diffChars = myersCharDiff(oldEditRangeSlice, newEditRangeSlice);
|
||||
|
|
@ -368,14 +432,26 @@ export class NextEditWindowManager {
|
|||
this.renderDeletions(editor, diffChars);
|
||||
|
||||
// Reserve tab and esc to either accept or reject the displayed next edit contents.
|
||||
await NextEditWindowManager.reserveTabAndEsc();
|
||||
try {
|
||||
await NextEditWindowManager.reserveTabAndEsc();
|
||||
} catch (err) {
|
||||
console.error(
|
||||
`Error reserving Tab/Esc after showing decorations: ${err}`,
|
||||
);
|
||||
await this.hideAllNextEditWindows();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide all tooltips in all editors.
|
||||
*/
|
||||
public async hideAllNextEditWindows() {
|
||||
await NextEditWindowManager.freeTabAndEsc();
|
||||
try {
|
||||
await NextEditWindowManager.freeTabAndEsc();
|
||||
} catch (err) {
|
||||
console.error(`Error freeing Tab/Esc while hiding: ${err}`);
|
||||
}
|
||||
|
||||
if (this.currentDecoration) {
|
||||
vscode.window.visibleTextEditors.forEach((editor) => {
|
||||
|
|
@ -502,6 +578,10 @@ export class NextEditWindowManager {
|
|||
* Dispose of the NextEditWindowManager.
|
||||
*/
|
||||
public dispose() {
|
||||
void this.resetKeyReservation().catch((err) =>
|
||||
console.error(`Failed to reset keys on dispose: ${err}`),
|
||||
);
|
||||
|
||||
// Dispose current decoration.
|
||||
if (this.currentDecoration) {
|
||||
this.currentDecoration.dispose();
|
||||
|
|
|
|||
970
extensions/vscode/src/activation/NextEditWindowManager.vitest.ts
Normal file
970
extensions/vscode/src/activation/NextEditWindowManager.vitest.ts
Normal file
|
|
@ -0,0 +1,970 @@
|
|||
import {
|
||||
afterEach,
|
||||
beforeEach,
|
||||
describe,
|
||||
expect,
|
||||
it,
|
||||
MockedFunction,
|
||||
vi,
|
||||
} from "vitest";
|
||||
|
||||
// Mock all modules FIRST with inline factories (no external references)
|
||||
vi.mock("vscode", () => ({
|
||||
commands: {
|
||||
executeCommand: vi.fn(),
|
||||
registerCommand: vi.fn(),
|
||||
},
|
||||
window: {
|
||||
activeTextEditor: undefined,
|
||||
visibleTextEditors: [],
|
||||
createTextEditorDecorationType: vi.fn(),
|
||||
onDidChangeTextEditorSelection: vi.fn(() => ({ dispose: vi.fn() })),
|
||||
onDidChangeVisibleTextEditors: vi.fn(() => ({ dispose: vi.fn() })),
|
||||
onDidChangeActiveColorTheme: vi.fn(() => ({ dispose: vi.fn() })),
|
||||
showInformationMessage: vi.fn(),
|
||||
},
|
||||
workspace: {
|
||||
getConfiguration: vi.fn(() => ({
|
||||
get: vi.fn((key: string) => {
|
||||
const config: Record<string, any> = {
|
||||
fontSize: 14,
|
||||
fontFamily: "monospace",
|
||||
showInlineTip: true,
|
||||
};
|
||||
return config[key];
|
||||
}),
|
||||
})),
|
||||
onDidChangeConfiguration: vi.fn(() => ({ dispose: vi.fn() })),
|
||||
},
|
||||
Position: class {
|
||||
constructor(
|
||||
public line: number,
|
||||
public character: number,
|
||||
) {}
|
||||
},
|
||||
Range: class {
|
||||
constructor(
|
||||
public start: any,
|
||||
public end: any,
|
||||
) {}
|
||||
},
|
||||
Selection: class {
|
||||
constructor(
|
||||
public anchor: any,
|
||||
public active: any,
|
||||
) {}
|
||||
},
|
||||
Uri: {
|
||||
parse: vi.fn((str: string) => ({ toString: () => str, scheme: "file" })),
|
||||
},
|
||||
DecorationRangeBehavior: {
|
||||
ClosedClosed: 1,
|
||||
},
|
||||
MarkdownString: class {
|
||||
value: string = "";
|
||||
isTrusted: boolean = false;
|
||||
supportHtml: boolean = false;
|
||||
constructor(value: string) {
|
||||
this.value = value;
|
||||
}
|
||||
},
|
||||
ExtensionContext: class {
|
||||
subscriptions: any[] = [];
|
||||
},
|
||||
ViewColumn: {
|
||||
One: 1,
|
||||
Two: 2,
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("core/control-plane/env", () => ({
|
||||
EXTENSION_NAME: "continue",
|
||||
}));
|
||||
|
||||
vi.mock("../util/getTheme", () => ({
|
||||
getThemeString: vi.fn(() => "dark"),
|
||||
}));
|
||||
|
||||
vi.mock("core/codeRenderer/CodeRenderer", () => ({
|
||||
CodeRenderer: {
|
||||
getInstance: vi.fn(() => ({
|
||||
setTheme: vi.fn(),
|
||||
getDataUri: vi.fn().mockResolvedValue("data:image/svg+xml;base64,mock"),
|
||||
})),
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("core/nextEdit/NextEditProvider", () => ({
|
||||
NextEditProvider: {
|
||||
getInstance: vi.fn(() => ({
|
||||
deleteChain: vi.fn(),
|
||||
})),
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("core/nextEdit/NextEditLoggingService", () => ({
|
||||
NextEditLoggingService: {
|
||||
getInstance: vi.fn(() => ({
|
||||
cancelRejectionTimeout: vi.fn(),
|
||||
cancelRejectionTimeoutButKeepCompletionId: vi.fn(),
|
||||
})),
|
||||
},
|
||||
}));
|
||||
|
||||
vi.mock("core/diff/myers", () => ({
|
||||
myersCharDiff: vi.fn(() => []),
|
||||
}));
|
||||
|
||||
vi.mock("core/nextEdit/diff/diff", () => ({
|
||||
getOffsetPositionAtLastNewLine: vi.fn(() => ({ line: 0, character: 0 })),
|
||||
}));
|
||||
|
||||
// Import after mocks are set up
|
||||
import * as vscode from "vscode";
|
||||
|
||||
import {
|
||||
ACCEPT_NEXT_EDIT_SUGGESTION_COMMAND,
|
||||
HIDE_NEXT_EDIT_SUGGESTION_COMMAND,
|
||||
NextEditWindowManager,
|
||||
} from "./NextEditWindowManager";
|
||||
|
||||
const mockVscode = vi.mocked(vscode);
|
||||
|
||||
describe("NextEditWindowManager", () => {
|
||||
let manager: NextEditWindowManager;
|
||||
let mockEditor: any;
|
||||
let mockDocument: any;
|
||||
let mockContext: any;
|
||||
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
|
||||
// Clear singleton instance
|
||||
NextEditWindowManager.clearInstance();
|
||||
|
||||
// Create mock document
|
||||
mockDocument = {
|
||||
uri: { toString: () => "file:///test.ts", scheme: "file" },
|
||||
version: 1,
|
||||
lineCount: 10,
|
||||
lineAt: vi.fn((line: number) => ({
|
||||
text: `line ${line} content`,
|
||||
range: new mockVscode.Range(
|
||||
new mockVscode.Position(line, 0),
|
||||
new mockVscode.Position(line, 20),
|
||||
),
|
||||
})),
|
||||
};
|
||||
|
||||
// Create mock editor
|
||||
mockEditor = {
|
||||
document: mockDocument,
|
||||
selection: {
|
||||
active: new mockVscode.Position(0, 0),
|
||||
},
|
||||
setDecorations: vi.fn(),
|
||||
edit: vi.fn((callback: any) => {
|
||||
callback({
|
||||
replace: vi.fn(),
|
||||
delete: vi.fn(),
|
||||
});
|
||||
return Promise.resolve(true);
|
||||
}),
|
||||
};
|
||||
|
||||
// Create mock context
|
||||
mockContext = {
|
||||
subscriptions: [],
|
||||
};
|
||||
|
||||
// Setup default mock implementations
|
||||
(
|
||||
mockVscode.commands.executeCommand as MockedFunction<any>
|
||||
).mockResolvedValue(undefined);
|
||||
(mockVscode.commands.registerCommand as MockedFunction<any>)
|
||||
//@ts-ignore
|
||||
.mockImplementation((command: string, callback: any) => ({
|
||||
dispose: vi.fn(),
|
||||
}));
|
||||
(
|
||||
mockVscode.window.createTextEditorDecorationType as MockedFunction<any>
|
||||
).mockReturnValue({
|
||||
dispose: vi.fn(),
|
||||
});
|
||||
|
||||
// Get manager instance
|
||||
manager = NextEditWindowManager.getInstance();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
NextEditWindowManager.clearInstance();
|
||||
});
|
||||
|
||||
describe("Singleton Pattern", () => {
|
||||
it("should return the same instance", () => {
|
||||
const instance1 = NextEditWindowManager.getInstance();
|
||||
const instance2 = NextEditWindowManager.getInstance();
|
||||
expect(instance1).toBe(instance2);
|
||||
});
|
||||
|
||||
it("should properly clear instance", () => {
|
||||
const instance1 = NextEditWindowManager.getInstance();
|
||||
NextEditWindowManager.clearInstance();
|
||||
const instance2 = NextEditWindowManager.getInstance();
|
||||
expect(instance1).not.toBe(instance2);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Key Reservation State Management", () => {
|
||||
beforeEach(async () => {
|
||||
await manager.setupNextEditWindowManager(mockContext);
|
||||
});
|
||||
|
||||
it("should start with keys in free state", () => {
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
});
|
||||
|
||||
it("should reserve keys when showing window", async () => {
|
||||
await manager.showNextEditWindow(
|
||||
mockEditor,
|
||||
new mockVscode.Position(0, 0),
|
||||
0,
|
||||
0,
|
||||
"old",
|
||||
"new",
|
||||
[],
|
||||
);
|
||||
|
||||
expect(mockVscode.commands.executeCommand).toHaveBeenCalledWith(
|
||||
"setContext",
|
||||
"nextEditWindowActive",
|
||||
true,
|
||||
);
|
||||
expect(manager["keyReservationState"]).toBe("reserved");
|
||||
});
|
||||
|
||||
it("should free keys when hiding windows", async () => {
|
||||
// First show a window
|
||||
await manager.showNextEditWindow(
|
||||
mockEditor,
|
||||
new mockVscode.Position(0, 0),
|
||||
0,
|
||||
0,
|
||||
"old",
|
||||
"new",
|
||||
[],
|
||||
);
|
||||
|
||||
// Then hide it
|
||||
await manager.hideAllNextEditWindows();
|
||||
|
||||
expect(mockVscode.commands.executeCommand).toHaveBeenCalledWith(
|
||||
"setContext",
|
||||
"nextEditWindowActive",
|
||||
false,
|
||||
);
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
});
|
||||
|
||||
it("should handle sequential reserve/free operations", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
|
||||
await NextEditWindowManager.reserveTabAndEsc();
|
||||
expect(manager["keyReservationState"]).toBe("reserved");
|
||||
|
||||
await NextEditWindowManager.freeTabAndEsc();
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
|
||||
await NextEditWindowManager.reserveTabAndEsc();
|
||||
expect(manager["keyReservationState"]).toBe("reserved");
|
||||
|
||||
// Should have been called 3 times + 1 from beforeEach
|
||||
expect(executeCommand).toHaveBeenCalledTimes(4);
|
||||
});
|
||||
|
||||
it("should skip redundant reserve operations", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
|
||||
await NextEditWindowManager.reserveTabAndEsc();
|
||||
executeCommand.mockClear();
|
||||
|
||||
// Try to reserve again
|
||||
await NextEditWindowManager.reserveTabAndEsc();
|
||||
|
||||
// Should not have called executeCommand again
|
||||
expect(executeCommand).not.toHaveBeenCalled();
|
||||
expect(manager["keyReservationState"]).toBe("reserved");
|
||||
});
|
||||
|
||||
it("should skip redundant free operations", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
executeCommand.mockClear();
|
||||
|
||||
// Already free, try to free again
|
||||
await NextEditWindowManager.freeTabAndEsc();
|
||||
|
||||
// Should not have called executeCommand
|
||||
expect(executeCommand).not.toHaveBeenCalled();
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Race Condition Prevention", () => {
|
||||
beforeEach(async () => {
|
||||
await manager.setupNextEditWindowManager(mockContext);
|
||||
});
|
||||
|
||||
it("should handle concurrent operations with random delays and last-write-wins", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
let completedOperations: string[] = [];
|
||||
|
||||
// Reset key reservation to ensure clean state
|
||||
await manager.resetKeyReservation();
|
||||
|
||||
// Start from reserved state so first free() will proceed
|
||||
manager["keyReservationState"] = "reserved";
|
||||
executeCommand.mockClear();
|
||||
|
||||
// Make executeCommand take random time and track completions
|
||||
executeCommand.mockImplementation((cmd, key, value) => {
|
||||
const operationId = `${value ? "reserve" : "free"}-${Date.now()}-${Math.random()}`;
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
completedOperations.push(operationId);
|
||||
// Immediately update state to ensure next operation proceeds
|
||||
// This simulates fast state changes
|
||||
manager["keyReservationState"] = value ? "reserved" : "free";
|
||||
resolve(undefined);
|
||||
}, Math.random() * 50);
|
||||
});
|
||||
});
|
||||
|
||||
// Fire multiple operations concurrently
|
||||
const operations = [
|
||||
NextEditWindowManager.reserveTabAndEsc(), // operation 1: reserve (skipped - already reserved)
|
||||
NextEditWindowManager.freeTabAndEsc(), // operation 2: free (proceeds)
|
||||
NextEditWindowManager.reserveTabAndEsc(), // operation 3: reserve (proceeds after 2 completes)
|
||||
NextEditWindowManager.freeTabAndEsc(), // operation 4: free (proceeds after 3 completes)
|
||||
];
|
||||
|
||||
await Promise.all(operations);
|
||||
|
||||
// Count how many actually proceeded (those that didn't early return)
|
||||
const actualCalls = executeCommand.mock.calls.length;
|
||||
|
||||
// The state should match the last operation's intent
|
||||
// But the actual number of calls depends on timing and early returns
|
||||
expect(manager["latestOperationId"]).toBeGreaterThanOrEqual(actualCalls);
|
||||
});
|
||||
|
||||
it("should ignore stale operations", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
|
||||
await manager.resetKeyReservation();
|
||||
executeCommand.mockClear();
|
||||
|
||||
// Create deferred promises with guaranteed resolvers
|
||||
const createDeferred = () => {
|
||||
let resolve: Function;
|
||||
const promise = new Promise((res) => {
|
||||
resolve = res;
|
||||
});
|
||||
return { promise, resolve: resolve! };
|
||||
};
|
||||
|
||||
const deferred1 = createDeferred();
|
||||
const deferred2 = createDeferred();
|
||||
|
||||
// Control when each operation completes
|
||||
executeCommand
|
||||
.mockImplementationOnce(() => deferred1.promise)
|
||||
.mockImplementationOnce(() => deferred2.promise);
|
||||
|
||||
// Start operations
|
||||
const op1 = NextEditWindowManager.reserveTabAndEsc();
|
||||
const op2 = NextEditWindowManager.freeTabAndEsc();
|
||||
|
||||
// Complete op2 first (even though op1 started first)
|
||||
deferred2.resolve(undefined);
|
||||
await op2;
|
||||
|
||||
// State should be free (from op2)
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
expect(manager["latestOperationId"]).toBe(2);
|
||||
|
||||
// Now complete op1 (should be ignored as stale)
|
||||
deferred1.resolve(undefined);
|
||||
await op1;
|
||||
|
||||
// State should still be free (op1 was ignored)
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
expect(manager["latestOperationId"]).toBe(2);
|
||||
});
|
||||
|
||||
it("should handle rapid fire operations correctly (loop)", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
|
||||
await manager.resetKeyReservation();
|
||||
executeCommand.mockClear();
|
||||
|
||||
// Make operations instant
|
||||
executeCommand.mockResolvedValue(undefined);
|
||||
|
||||
// Fire many operations rapidly
|
||||
const operations = [];
|
||||
for (let i = 0; i < 20; i++) {
|
||||
operations.push(
|
||||
i % 2 === 0
|
||||
? NextEditWindowManager.reserveTabAndEsc()
|
||||
: NextEditWindowManager.freeTabAndEsc(),
|
||||
);
|
||||
}
|
||||
|
||||
await Promise.all(operations);
|
||||
|
||||
// Last operation (i=19) was free (odd number)
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
expect(manager["latestOperationId"]).toBe(20);
|
||||
});
|
||||
|
||||
it("should handle alternating reserve/free with delays", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
|
||||
await manager.resetKeyReservation();
|
||||
executeCommand.mockClear();
|
||||
|
||||
// Track actual VS Code context values set
|
||||
const contextValues: boolean[] = [];
|
||||
executeCommand.mockImplementation((cmd, key, value) => {
|
||||
if (cmd === "setContext") {
|
||||
//@ts-ignore
|
||||
contextValues.push(value);
|
||||
}
|
||||
return Promise.resolve(undefined);
|
||||
});
|
||||
|
||||
// Alternating operations
|
||||
await NextEditWindowManager.reserveTabAndEsc();
|
||||
expect(manager["keyReservationState"]).toBe("reserved");
|
||||
|
||||
await NextEditWindowManager.freeTabAndEsc();
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
|
||||
await NextEditWindowManager.reserveTabAndEsc();
|
||||
expect(manager["keyReservationState"]).toBe("reserved");
|
||||
|
||||
// Check that context was set correctly each time
|
||||
expect(contextValues).toEqual([true, false, true]);
|
||||
});
|
||||
|
||||
it("should handle rapid alternations correctly", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
|
||||
await manager.resetKeyReservation();
|
||||
executeCommand.mockClear();
|
||||
|
||||
// Track all setContext calls
|
||||
const contextCalls: boolean[] = [];
|
||||
executeCommand.mockImplementation((cmd, key, value) => {
|
||||
if (cmd === "setContext" && key === "nextEditWindowActive") {
|
||||
//@ts-ignore
|
||||
contextCalls.push(value);
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
// Simulate rapid SEQUENTIAL user interactions:
|
||||
// These need to be sequential to ensure state changes between calls
|
||||
await NextEditWindowManager.reserveTabAndEsc(); // free -> reserved
|
||||
await NextEditWindowManager.freeTabAndEsc(); // reserved -> free
|
||||
await NextEditWindowManager.reserveTabAndEsc(); // free -> reserved
|
||||
await NextEditWindowManager.freeTabAndEsc(); // reserved -> free
|
||||
|
||||
// Should end in free state (last operation)
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
|
||||
// Should have made all 4 calls since state alternates
|
||||
expect(contextCalls).toEqual([true, false, true, false]);
|
||||
});
|
||||
|
||||
it("should handle concurrent duplicate operations efficiently", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
|
||||
await manager.resetKeyReservation();
|
||||
executeCommand.mockClear();
|
||||
|
||||
// Track all setContext calls
|
||||
const contextCalls: boolean[] = [];
|
||||
executeCommand.mockImplementation((cmd, key, value) => {
|
||||
if (cmd === "setContext" && key === "nextEditWindowActive") {
|
||||
//@ts-ignore
|
||||
contextCalls.push(value);
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
// When multiple reserve operations happen concurrently (e.g., multiple completions)
|
||||
// Only the first should actually make the call
|
||||
const operations = [
|
||||
NextEditWindowManager.reserveTabAndEsc(),
|
||||
NextEditWindowManager.reserveTabAndEsc(),
|
||||
NextEditWindowManager.reserveTabAndEsc(),
|
||||
];
|
||||
|
||||
await Promise.all(operations);
|
||||
|
||||
// Should have made only the necessary calls
|
||||
// Since all start with state "free", all will proceed to call setContext
|
||||
// This is because they all check state before any completes
|
||||
expect(contextCalls.length).toBeGreaterThan(0);
|
||||
expect(manager["keyReservationState"]).toBe("reserved");
|
||||
|
||||
// All calls should be trying to reserve (true)
|
||||
expect(contextCalls.every((call) => call === true)).toBe(true);
|
||||
});
|
||||
|
||||
it("should handle truly concurrent mixed operations", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
|
||||
await manager.resetKeyReservation();
|
||||
// Start in reserved state
|
||||
await NextEditWindowManager.reserveTabAndEsc();
|
||||
executeCommand.mockClear();
|
||||
|
||||
// Track all setContext calls
|
||||
const contextCalls: boolean[] = [];
|
||||
executeCommand.mockImplementation((cmd, key, value) => {
|
||||
if (cmd === "setContext" && key === "nextEditWindowActive") {
|
||||
//@ts-ignore
|
||||
contextCalls.push(value);
|
||||
// Add small delay to simulate real async behavior
|
||||
return new Promise((resolve) => setTimeout(resolve, 5));
|
||||
}
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
// Mix of operations starting from "reserved" state
|
||||
const operations = [
|
||||
NextEditWindowManager.freeTabAndEsc(), // Will proceed (reserved -> free)
|
||||
NextEditWindowManager.freeTabAndEsc(), // Will proceed (checks while first is in flight)
|
||||
NextEditWindowManager.reserveTabAndEsc(), // Will proceed (different operation)
|
||||
];
|
||||
|
||||
await Promise.all(operations);
|
||||
|
||||
// The last operation to complete wins (but order is non-deterministic)
|
||||
// State should be either "free" or "reserved" depending on completion order
|
||||
expect(["free", "reserved"]).toContain(manager["keyReservationState"]);
|
||||
|
||||
// Should have made at least some calls
|
||||
expect(contextCalls.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("should maintain correct state with stale operations", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
|
||||
await manager.resetKeyReservation();
|
||||
executeCommand.mockClear();
|
||||
|
||||
// Create a controlled execution order
|
||||
let resolveFirst: () => void;
|
||||
let resolveSecond: () => void;
|
||||
|
||||
const firstPromise = new Promise<void>((resolve) => {
|
||||
resolveFirst = resolve;
|
||||
});
|
||||
|
||||
const secondPromise = new Promise<void>((resolve) => {
|
||||
resolveSecond = resolve;
|
||||
});
|
||||
|
||||
executeCommand
|
||||
.mockImplementationOnce(() => firstPromise)
|
||||
.mockImplementationOnce(() => secondPromise);
|
||||
|
||||
// Start operations
|
||||
const op1 = NextEditWindowManager.reserveTabAndEsc();
|
||||
const op2 = NextEditWindowManager.freeTabAndEsc();
|
||||
|
||||
// Complete second operation first (out of order)
|
||||
resolveSecond!();
|
||||
await op2;
|
||||
|
||||
// State should be free (last operation to start, even though it completed first)
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
|
||||
// Complete first operation
|
||||
resolveFirst!();
|
||||
await op1;
|
||||
|
||||
// State should still be free (op1 was stale)
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Error Recovery", () => {
|
||||
beforeEach(async () => {
|
||||
await manager.setupNextEditWindowManager(mockContext);
|
||||
});
|
||||
|
||||
it("should recover from failed key reservation", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
|
||||
// Make reservation fail
|
||||
executeCommand.mockRejectedValueOnce(new Error("VS Code busy"));
|
||||
|
||||
await expect(NextEditWindowManager.reserveTabAndEsc()).rejects.toThrow(
|
||||
"VS Code busy",
|
||||
);
|
||||
|
||||
// State should reset to free
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
|
||||
// Should be able to try again
|
||||
executeCommand.mockResolvedValueOnce(undefined);
|
||||
await NextEditWindowManager.reserveTabAndEsc();
|
||||
expect(manager["keyReservationState"]).toBe("reserved");
|
||||
});
|
||||
|
||||
it("should recover from failed key freeing", async () => {
|
||||
const executeCommand = mockVscode.commands
|
||||
.executeCommand as MockedFunction<any>;
|
||||
|
||||
// First reserve successfully
|
||||
await NextEditWindowManager.reserveTabAndEsc();
|
||||
expect(manager["keyReservationState"]).toBe("reserved");
|
||||
|
||||
// Make freeing fail
|
||||
executeCommand.mockRejectedValueOnce(new Error("VS Code busy"));
|
||||
|
||||
await expect(NextEditWindowManager.freeTabAndEsc()).rejects.toThrow(
|
||||
"VS Code busy",
|
||||
);
|
||||
|
||||
// State should still reset to free (safety mechanism)
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
});
|
||||
|
||||
it("should handle decoration creation failure", async () => {
|
||||
const createDecoration = mockVscode.window
|
||||
.createTextEditorDecorationType as MockedFunction<any>;
|
||||
createDecoration.mockImplementationOnce(() => {
|
||||
throw new Error("Failed to create decoration");
|
||||
});
|
||||
|
||||
// Should not throw, but should clean up
|
||||
await manager.showNextEditWindow(
|
||||
mockEditor,
|
||||
new mockVscode.Position(0, 0),
|
||||
0,
|
||||
0,
|
||||
"old",
|
||||
"new",
|
||||
[],
|
||||
);
|
||||
|
||||
// Keys should be freed due to error
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
expect(manager["currentDecoration"]).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Command Registration", () => {
|
||||
it("should register hide command", async () => {
|
||||
await manager.setupNextEditWindowManager(mockContext);
|
||||
|
||||
expect(mockVscode.commands.registerCommand).toHaveBeenCalledWith(
|
||||
HIDE_NEXT_EDIT_SUGGESTION_COMMAND,
|
||||
expect.any(Function),
|
||||
);
|
||||
});
|
||||
|
||||
it("should register accept command", async () => {
|
||||
await manager.setupNextEditWindowManager(mockContext);
|
||||
|
||||
expect(mockVscode.commands.registerCommand).toHaveBeenCalledWith(
|
||||
ACCEPT_NEXT_EDIT_SUGGESTION_COMMAND,
|
||||
expect.any(Function),
|
||||
);
|
||||
});
|
||||
|
||||
it("should handle command registration failure gracefully", async () => {
|
||||
const registerCommand = mockVscode.commands
|
||||
.registerCommand as MockedFunction<any>;
|
||||
registerCommand.mockImplementationOnce(() => {
|
||||
throw new Error("Command already registered");
|
||||
});
|
||||
|
||||
// Should not throw
|
||||
await expect(
|
||||
manager.setupNextEditWindowManager(mockContext),
|
||||
).resolves.not.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Window Management", () => {
|
||||
beforeEach(async () => {
|
||||
await manager.setupNextEditWindowManager(mockContext);
|
||||
});
|
||||
|
||||
it("should store tooltip text when showing window", async () => {
|
||||
await manager.showNextEditWindow(
|
||||
mockEditor,
|
||||
new mockVscode.Position(0, 0),
|
||||
0,
|
||||
2,
|
||||
"old code",
|
||||
"new code",
|
||||
[],
|
||||
);
|
||||
|
||||
expect(manager["currentTooltipText"]).toBe("new code");
|
||||
expect(manager["activeEditor"]).toBe(mockEditor);
|
||||
});
|
||||
|
||||
it("should clear tooltip text when hiding windows", async () => {
|
||||
// Show first
|
||||
await manager.showNextEditWindow(
|
||||
mockEditor,
|
||||
new mockVscode.Position(0, 0),
|
||||
0,
|
||||
2,
|
||||
"old",
|
||||
"new",
|
||||
[],
|
||||
);
|
||||
|
||||
// Then hide
|
||||
await manager.hideAllNextEditWindows();
|
||||
|
||||
expect(manager["currentTooltipText"]).toBeNull();
|
||||
expect(manager["activeEditor"]).toBeNull();
|
||||
});
|
||||
|
||||
it("should handle line deletion case", async () => {
|
||||
mockEditor.document.lineAt = vi.fn((lineNumber: number) => ({
|
||||
text: "line to delete",
|
||||
}));
|
||||
|
||||
await manager.showNextEditWindow(
|
||||
mockEditor,
|
||||
new mockVscode.Position(1, 0),
|
||||
1,
|
||||
1,
|
||||
"line to delete",
|
||||
"", // Empty means deletion
|
||||
[{ type: "old", line: "line to delete" }],
|
||||
);
|
||||
|
||||
expect(manager["isLineDelete"]).toBe(true);
|
||||
// Final cursor should be at end of previous line
|
||||
expect(manager["finalCursorPos"]?.line).toBe(0);
|
||||
});
|
||||
|
||||
it("should skip rendering for excluded URIs", async () => {
|
||||
mockEditor.document.uri = {
|
||||
toString: () => "output://test",
|
||||
scheme: "output",
|
||||
};
|
||||
|
||||
await manager.showNextEditWindow(
|
||||
mockEditor,
|
||||
new mockVscode.Position(0, 0),
|
||||
0,
|
||||
0,
|
||||
"old",
|
||||
"new",
|
||||
[],
|
||||
);
|
||||
|
||||
// Should not create decoration for excluded URI
|
||||
expect(
|
||||
mockVscode.window.createTextEditorDecorationType,
|
||||
).not.toHaveBeenCalled();
|
||||
expect(manager["currentDecoration"]).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Accept/Reject Flow", () => {
|
||||
beforeEach(async () => {
|
||||
await manager.setupNextEditWindowManager(mockContext);
|
||||
});
|
||||
|
||||
it("should apply text when accepting", async () => {
|
||||
// Show window first
|
||||
await manager.showNextEditWindow(
|
||||
mockEditor,
|
||||
new mockVscode.Position(0, 0),
|
||||
0,
|
||||
0,
|
||||
"old",
|
||||
"new text",
|
||||
[],
|
||||
);
|
||||
|
||||
// Get the accept command callback
|
||||
const registerCalls = (
|
||||
mockVscode.commands.registerCommand as MockedFunction<any>
|
||||
).mock.calls;
|
||||
const acceptCall = registerCalls.find(
|
||||
(call) => call[0] === ACCEPT_NEXT_EDIT_SUGGESTION_COMMAND,
|
||||
);
|
||||
//@ts-ignore
|
||||
const acceptCallback = acceptCall[1];
|
||||
|
||||
// Call accept
|
||||
//@ts-ignore
|
||||
await acceptCallback();
|
||||
|
||||
// Should have called edit
|
||||
expect(mockEditor.edit).toHaveBeenCalled();
|
||||
|
||||
// Should have cleared the decoration
|
||||
expect(manager["currentTooltipText"]).toBeNull();
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
});
|
||||
|
||||
it("should not accept when no active window", async () => {
|
||||
// Get the accept command callback
|
||||
const registerCalls = (
|
||||
mockVscode.commands.registerCommand as MockedFunction<any>
|
||||
).mock.calls;
|
||||
const acceptCall = registerCalls.find(
|
||||
(call) => call[0] === ACCEPT_NEXT_EDIT_SUGGESTION_COMMAND,
|
||||
);
|
||||
//@ts-ignore
|
||||
const acceptCallback = acceptCall[1];
|
||||
|
||||
// Call accept without showing window
|
||||
//@ts-ignore
|
||||
await acceptCallback();
|
||||
|
||||
// Should not have called edit
|
||||
expect(mockEditor.edit).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should hide window when rejecting", async () => {
|
||||
// Show window first
|
||||
await manager.showNextEditWindow(
|
||||
mockEditor,
|
||||
new mockVscode.Position(0, 0),
|
||||
0,
|
||||
0,
|
||||
"old",
|
||||
"new",
|
||||
[],
|
||||
);
|
||||
|
||||
// Get the hide command callback
|
||||
const registerCalls = (
|
||||
mockVscode.commands.registerCommand as MockedFunction<any>
|
||||
).mock.calls;
|
||||
const hideCall = registerCalls.find(
|
||||
(call) => call[0] === HIDE_NEXT_EDIT_SUGGESTION_COMMAND,
|
||||
);
|
||||
//@ts-ignore
|
||||
const hideCallback = hideCall[1];
|
||||
|
||||
// Call hide
|
||||
//@ts-ignore
|
||||
await hideCallback();
|
||||
|
||||
// Should have cleared everything
|
||||
expect(manager["currentTooltipText"]).toBeNull();
|
||||
expect(manager["activeEditor"]).toBeNull();
|
||||
expect(manager["keyReservationState"]).toBe("free");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Disposal", () => {
|
||||
it("should free keys on disposal", async () => {
|
||||
await manager.setupNextEditWindowManager(mockContext);
|
||||
|
||||
// Reserve keys first
|
||||
await NextEditWindowManager.reserveTabAndEsc();
|
||||
expect(manager["keyReservationState"]).toBe("reserved");
|
||||
|
||||
// Dispose
|
||||
manager.dispose();
|
||||
|
||||
// Should attempt to free keys
|
||||
expect(mockVscode.commands.executeCommand).toHaveBeenCalledWith(
|
||||
"setContext",
|
||||
"nextEditWindowActive",
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("should dispose decorations on disposal", async () => {
|
||||
await manager.setupNextEditWindowManager(mockContext);
|
||||
|
||||
const mockDecoration = { dispose: vi.fn() };
|
||||
const mockDisposable1 = { dispose: vi.fn() };
|
||||
const mockDisposable2 = { dispose: vi.fn() };
|
||||
|
||||
manager["currentDecoration"] = mockDecoration as any;
|
||||
manager["disposables"] = [mockDisposable1, mockDisposable2];
|
||||
|
||||
manager.dispose();
|
||||
|
||||
expect(mockDecoration.dispose).toHaveBeenCalled();
|
||||
expect(mockDisposable1.dispose).toHaveBeenCalled();
|
||||
expect(mockDisposable2.dispose).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Configuration Changes", () => {
|
||||
it("should update on theme change", async () => {
|
||||
await manager.setupNextEditWindowManager(mockContext);
|
||||
|
||||
// Get the configuration change listener
|
||||
const onDidChange = mockVscode.workspace
|
||||
.onDidChangeConfiguration as MockedFunction<any>;
|
||||
const changeCallback = onDidChange.mock.calls[0][0];
|
||||
|
||||
// Simulate theme change
|
||||
//@ts-ignore
|
||||
await changeCallback({
|
||||
affectsConfiguration: (key: string) => key === "workbench.colorTheme",
|
||||
});
|
||||
|
||||
// Should have updated theme
|
||||
const { getThemeString } = await import("../util/getTheme");
|
||||
expect(getThemeString).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("should update on font size change", async () => {
|
||||
await manager.setupNextEditWindowManager(mockContext);
|
||||
|
||||
const onDidChange = mockVscode.workspace
|
||||
.onDidChangeConfiguration as MockedFunction<any>;
|
||||
const changeCallback = onDidChange.mock.calls[0][0];
|
||||
|
||||
// Change font size
|
||||
(
|
||||
mockVscode.workspace.getConfiguration as MockedFunction<any>
|
||||
).mockReturnValueOnce({
|
||||
get: (key: string) => (key === "fontSize" ? 16 : "monospace"),
|
||||
});
|
||||
|
||||
//@ts-ignore
|
||||
await changeCallback({
|
||||
affectsConfiguration: (key: string) => key === "editor.fontSize",
|
||||
});
|
||||
|
||||
expect(manager["fontSize"]).toBe(16);
|
||||
});
|
||||
});
|
||||
});
|
||||
129
gui/package-lock.json
generated
129
gui/package-lock.json
generated
|
|
@ -148,7 +148,7 @@
|
|||
"http-proxy-agent": "^7.0.1",
|
||||
"https-proxy-agent": "^7.0.3",
|
||||
"iconv-lite": "^0.6.3",
|
||||
"ignore": "^5.3.1",
|
||||
"ignore": "^7.0.5",
|
||||
"is-localhost-ip": "^2.0.0",
|
||||
"jinja-js": "0.1.8",
|
||||
"js-tiktoken": "^1.0.8",
|
||||
|
|
@ -5094,6 +5094,20 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/call-bind-apply-helpers": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0",
|
||||
"function-bind": "^1.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/callsites": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
|
||||
|
|
@ -6257,6 +6271,21 @@
|
|||
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
|
||||
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w=="
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"gopd": "^1.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/eastasianwidth": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
|
||||
|
|
@ -6374,13 +6403,11 @@
|
|||
}
|
||||
},
|
||||
"node_modules/es-define-property": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz",
|
||||
"integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==",
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"get-intrinsic": "^1.2.4"
|
||||
},
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
|
|
@ -6421,10 +6448,11 @@
|
|||
}
|
||||
},
|
||||
"node_modules/es-object-atoms": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz",
|
||||
"integrity": "sha512-MZ4iQ6JwHOBQjahnjwaC1ZtIBH+2ohjamzAO3oaHcXYup7qxjF2fixyH+Q71voWHeOkI2q/TnJao/KfXYIZWbw==",
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
|
||||
"integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"es-errors": "^1.3.0"
|
||||
},
|
||||
|
|
@ -6433,14 +6461,16 @@
|
|||
}
|
||||
},
|
||||
"node_modules/es-set-tostringtag": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.0.3.tgz",
|
||||
"integrity": "sha512-3T8uNMC3OQTHkFUsFq8r/BwAXLHvU/9O9mE0fBc/MY5iq/8H7ncvO947LmYA6ldWw9Uh8Yhf25zu6n7nML5QWQ==",
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
|
||||
"integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"get-intrinsic": "^1.2.4",
|
||||
"es-errors": "^1.3.0",
|
||||
"get-intrinsic": "^1.2.6",
|
||||
"has-tostringtag": "^1.0.2",
|
||||
"hasown": "^2.0.1"
|
||||
"hasown": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
|
|
@ -7371,13 +7401,16 @@
|
|||
}
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||
"version": "4.0.4",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
|
||||
"integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"es-set-tostringtag": "^2.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
|
|
@ -7468,16 +7501,22 @@
|
|||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.2.4",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
|
||||
"integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==",
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"call-bind-apply-helpers": "^1.0.2",
|
||||
"es-define-property": "^1.0.1",
|
||||
"es-errors": "^1.3.0",
|
||||
"es-object-atoms": "^1.1.1",
|
||||
"function-bind": "^1.1.2",
|
||||
"has-proto": "^1.0.1",
|
||||
"has-symbols": "^1.0.3",
|
||||
"hasown": "^2.0.0"
|
||||
"get-proto": "^1.0.1",
|
||||
"gopd": "^1.2.0",
|
||||
"has-symbols": "^1.1.0",
|
||||
"hasown": "^2.0.2",
|
||||
"math-intrinsics": "^1.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
|
|
@ -7486,6 +7525,20 @@
|
|||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/get-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dunder-proto": "^1.0.1",
|
||||
"es-object-atoms": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/get-stream": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz",
|
||||
|
|
@ -7568,12 +7621,13 @@
|
|||
}
|
||||
},
|
||||
"node_modules/gopd": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
|
||||
"integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"get-intrinsic": "^1.1.3"
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
|
|
@ -7688,10 +7742,11 @@
|
|||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||
"integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==",
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
|
|
@ -9430,6 +9485,16 @@
|
|||
"node": ">= 20"
|
||||
}
|
||||
},
|
||||
"node_modules/math-intrinsics": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
}
|
||||
},
|
||||
"node_modules/mdast-util-definitions": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-4.0.0.tgz",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { IdeMessengerContext } from "../../../context/IdeMessenger";
|
|||
|
||||
type SectionKey = Exclude<
|
||||
keyof ConfigYaml,
|
||||
"name" | "version" | "schema" | "metadata"
|
||||
"name" | "version" | "schema" | "metadata" | "env"
|
||||
>;
|
||||
|
||||
interface EditBlockButtonProps<T extends SectionKey> {
|
||||
|
|
@ -42,10 +42,10 @@ export default function EditBlockButton<T extends SectionKey>({
|
|||
element: { sourceFile },
|
||||
});
|
||||
} else if (block && isUsesBlock(block)) {
|
||||
openUrl(`${block.uses}/new-version`);
|
||||
void openUrl(`${block.uses}/new-version`);
|
||||
} else if (selectedProfile?.fullSlug) {
|
||||
const slug = `${selectedProfile.fullSlug.ownerSlug}/${selectedProfile.fullSlug.packageSlug}`;
|
||||
openUrl(`${slug}/new-version`);
|
||||
void openUrl(`${slug}/new-version`);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export function mergePackages(
|
|||
rules: [...(current.rules ?? []), ...(incoming.rules ?? [])],
|
||||
prompts: [...(current.prompts ?? []), ...(incoming.prompts ?? [])],
|
||||
docs: [...(current.docs ?? []), ...(incoming.docs ?? [])],
|
||||
env: { ...current.env, ...incoming.env },
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -29,5 +30,6 @@ export function mergeUnrolledAssistants(
|
|||
data: [...(current.data ?? []), ...(incoming.data ?? [])],
|
||||
mcpServers: [...(current.mcpServers ?? []), ...(incoming.mcpServers ?? [])],
|
||||
prompts: [...(current.prompts ?? []), ...(incoming.prompts ?? [])],
|
||||
env: { ...current.env, ...incoming.env },
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -321,7 +321,7 @@ export async function unrollBlocks(
|
|||
|
||||
const sections: (keyof Omit<
|
||||
ConfigYaml,
|
||||
"name" | "version" | "rules" | "schema" | "metadata"
|
||||
"name" | "version" | "rules" | "schema" | "metadata" | "env"
|
||||
>)[] = ["models", "context", "data", "mcpServers", "prompts", "docs"];
|
||||
|
||||
// Process all sections in parallel
|
||||
|
|
|
|||
|
|
@ -105,11 +105,17 @@ export const commonMetadataSchema = z.object({
|
|||
iconUrl: z.string().optional(),
|
||||
});
|
||||
|
||||
const envRecord = z.record(
|
||||
z.string(),
|
||||
z.union([z.string(), z.number(), z.boolean()]),
|
||||
);
|
||||
|
||||
export const baseConfigYamlSchema = z.object({
|
||||
name: z.string(),
|
||||
version: z.string(),
|
||||
schema: z.string().optional(),
|
||||
metadata: z.record(z.string()).and(commonMetadataSchema.partial()).optional(),
|
||||
env: envRecord.optional(),
|
||||
});
|
||||
|
||||
const modelsUsesSchema = z
|
||||
|
|
@ -254,6 +260,7 @@ export const configSchema = z.object({
|
|||
proxy: z.string().optional(),
|
||||
api_base: z.string().optional(),
|
||||
api_key: z.string().optional(),
|
||||
env: envRecord.optional(),
|
||||
});
|
||||
|
||||
export type Config = z.infer<typeof configSchema>;
|
||||
|
|
|
|||
17
packages/openai-adapters/package-lock.json
generated
17
packages/openai-adapters/package-lock.json
generated
|
|
@ -32,6 +32,7 @@
|
|||
"@types/follow-redirects": "^1.14.4",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/json-schema": "^7.0.15",
|
||||
"@types/node": "^24.3.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"semantic-release": "^24.2.7",
|
||||
"ts-jest": "^29.2.3",
|
||||
|
|
@ -1369,7 +1370,7 @@
|
|||
"version": "1.0.14",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"zod": "^3.24.2"
|
||||
"zod": "^3.23.8"
|
||||
}
|
||||
},
|
||||
"node_modules/@continuedev/config-yaml": {
|
||||
|
|
@ -4021,13 +4022,13 @@
|
|||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "24.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.1.0.tgz",
|
||||
"integrity": "sha512-ut5FthK5moxFKH2T1CUOC6ctR67rQRvvHdFLCD2Ql6KXmMuCrjsSsRI9UsLCm9M18BMwClv4pn327UvB7eeO1w==",
|
||||
"version": "24.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.3.0.tgz",
|
||||
"integrity": "sha512-aPTXCrfwnDLj4VvXrm+UUCQjNEvJgNA8s5F1cvwQU+3KNltTOkBm1j30uNLyqqPNe7gE3KFzImYoZEfLhp4Yow==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"undici-types": "~7.8.0"
|
||||
"undici-types": "~7.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/normalize-package-data": {
|
||||
|
|
@ -12549,9 +12550,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "7.8.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
|
||||
"integrity": "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==",
|
||||
"version": "7.10.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.10.0.tgz",
|
||||
"integrity": "sha512-t5Fy/nfn+14LuOc2KNYg75vZqClpAiqscVvMygNnlsHBFpSXdJaYtXMcdNLpl/Qvc3P2cB3s6lOV51nqsFq4ag==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
"@types/follow-redirects": "^1.14.4",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/json-schema": "^7.0.15",
|
||||
"@types/node": "^24.3.0",
|
||||
"cross-env": "^7.0.3",
|
||||
"semantic-release": "^24.2.7",
|
||||
"ts-jest": "^29.2.3",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue