diff --git a/package.json b/package.json index 44ee472..b80fc0b 100644 --- a/package.json +++ b/package.json @@ -105,7 +105,8 @@ "install:all": "npm install && cd webview-ui && npm install", "start:webview": "cd webview-ui && npm run start", "build:webview": "cd webview-ui && npm run build", - "test:webview": "cd webview-ui && npm run test" + "test:webview": "cd webview-ui && npm run test", + "upver": "tsx scripts/update-version.ts" }, "devDependencies": { "@types/diff": "^5.2.1", diff --git a/scripts/update-version.ts b/scripts/update-version.ts new file mode 100644 index 0000000..ef6ae0f --- /dev/null +++ b/scripts/update-version.ts @@ -0,0 +1,35 @@ +import * as fs from "fs" +import * as path from "path" + +const newVersion = process.argv[2] + +if (!newVersion) { + console.error("Please provide a version number") + process.exit(1) +} + +// Update root package.json +const rootPackagePath = path.join(__dirname, "..", "package.json") +const rootPackage = JSON.parse(fs.readFileSync(rootPackagePath, "utf8")) +rootPackage.version = newVersion +fs.writeFileSync(rootPackagePath, JSON.stringify(rootPackage, null, 2)) + +// Update webview package.json +const webviewPackagePath = path.join(__dirname, "..", "webview-ui", "package.json") +const webviewPackage = JSON.parse(fs.readFileSync(webviewPackagePath, "utf8")) +webviewPackage.version = newVersion +fs.writeFileSync(webviewPackagePath, JSON.stringify(webviewPackage, null, 2)) + +// Update Announcement.tsx +const announcementPath = path.join(__dirname, "..", "webview-ui", "src", "components", "Announcement.tsx") +let announcementContent = fs.readFileSync(announcementPath, "utf8") +announcementContent = announcementContent.replace(/New in v[\d.]+<\/h3>/, `New in v${newVersion}`) +fs.writeFileSync(announcementPath, announcementContent) + +// Update SettingsView.tsx +const settingsViewPath = path.join(__dirname, "..", "webview-ui", "src", "components", "SettingsView.tsx") +let settingsViewContent = fs.readFileSync(settingsViewPath, "utf8") +settingsViewContent = settingsViewContent.replace(/>v[\d.]+<\/p>/, `>v${newVersion}

`) +fs.writeFileSync(settingsViewPath, settingsViewContent) + +console.log(`Version updated to ${newVersion}`) diff --git a/tsconfig.json b/tsconfig.json index 9f7fa90..f687413 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,7 +12,7 @@ "noImplicitReturns": true, "noUnusedLocals": false, "resolveJsonModule": true, - "rootDir": "src", + "rootDir": ".", "skipLibCheck": true, "sourceMap": true, "strict": true, @@ -20,5 +20,6 @@ "useDefineForClassFields": true, "useUnknownInCatchVariables": false }, + "include": ["src/**/*", "scripts/**/*"], "exclude": ["node_modules", ".vscode-test", "webview-ui"] -} \ No newline at end of file +} diff --git a/webview-ui/src/utilities/validate.ts b/webview-ui/src/utilities/validate.ts index 1bca661..77513c7 100644 --- a/webview-ui/src/utilities/validate.ts +++ b/webview-ui/src/utilities/validate.ts @@ -5,17 +5,17 @@ export function validateApiConfiguration(apiConfiguration?: ApiConfiguration): s switch (apiConfiguration.apiProvider) { case "anthropic": if (!apiConfiguration.apiKey) { - return "API Key cannot be empty. You must provide an API key to use Claude Dev." + return "You must provide a valid API key or choose a different provider." } break case "bedrock": if (!apiConfiguration.awsAccessKey || !apiConfiguration.awsSecretKey || !apiConfiguration.awsRegion) { - return "AWS credentials are incomplete. You must provide an AWS access key, secret key, and region." + return "You must provide a valid AWS access key, secret key, and region." } break case "openrouter": if (!apiConfiguration.openRouterApiKey) { - return "API Key cannot be empty. You must provide an API key to use Claude Dev." + return "You must provide a valid API key or choose a different provider." } break }