diff --git a/packages/amazonq/src/extensionNode.ts b/packages/amazonq/src/extensionNode.ts index cd07aeba981..d21e9535383 100644 --- a/packages/amazonq/src/extensionNode.ts +++ b/packages/amazonq/src/extensionNode.ts @@ -17,6 +17,7 @@ import { DevOptions } from 'aws-core-vscode/dev' import { Auth } from 'aws-core-vscode/auth' import api from './api' import { activate as activateCWChat } from './app/chat/activation' +import { beta } from 'aws-core-vscode/dev' export async function activate(context: vscode.ExtensionContext) { // IMPORTANT: No other code should be added to this function. Place it in one of the following 2 functions where appropriate. @@ -59,6 +60,7 @@ async function activateAmazonQNode(context: vscode.ExtensionContext) { filetypes.activate() await setupDevMode(context) + await beta.activate(context) } /** diff --git a/packages/core/src/dev/activation.ts b/packages/core/src/dev/activation.ts index 3c94e5d6d71..e676c426b12 100644 --- a/packages/core/src/dev/activation.ts +++ b/packages/core/src/dev/activation.ts @@ -4,7 +4,6 @@ */ import * as vscode from 'vscode' -import * as config from './config' import { createCommonButtons } from '../shared/ui/buttons' import { createQuickPick } from '../shared/ui/pickerPrompter' import { SkipPrompter } from '../shared/ui/common/skipPrompter' @@ -14,9 +13,6 @@ import { Commands } from '../shared/vscode/commands2' import { createInputBox } from '../shared/ui/inputPrompter' import { Wizard } from '../shared/wizards/wizard' import { deleteDevEnvCommand, installVsixCommand, openTerminalCommand } from './codecatalyst' -import { watchBetaVSIX } from './beta' -import { isCloud9 } from '../shared/extensionUtilities' -import { isReleaseVersion } from '../shared/vscode/env' import { isAnySsoConnection } from '../auth/connection' import { Auth } from '../auth/auth' import { getLogger } from '../shared/logger' @@ -194,10 +190,6 @@ export async function activate(ctx: vscode.ExtensionContext): Promise { const editor = new ObjectEditor() ctx.subscriptions.push(openStorageCommand.register(editor)) - - if (!isCloud9() && !isReleaseVersion() && config.betaUrl) { - ctx.subscriptions.push(watchBetaVSIX(config.betaUrl)) - } } async function openMenu(options: MenuOption[]): Promise { diff --git a/packages/core/src/dev/beta.ts b/packages/core/src/dev/beta.ts index 69935ace908..7718d1f49fc 100644 --- a/packages/core/src/dev/beta.ts +++ b/packages/core/src/dev/beta.ts @@ -18,6 +18,9 @@ import { isUserCancelledError, ToolkitError } from '../shared/errors' import { telemetry } from '../shared/telemetry/telemetry' import { cast } from '../shared/utilities/typeConstructors' import { CancellationError } from '../shared/utilities/timeoutUtils' +import { isAmazonQ, isCloud9, productName } from '../shared/extensionUtilities' +import * as config from './config' +import { isReleaseVersion } from '../shared/vscode/env' const localize = nls.loadMessageBundle() @@ -39,6 +42,16 @@ async function updateBetaToolkitData(vsixUrl: string, data: BetaToolkit) { }) } +/** + * Set up "beta" update monitoring. + */ +export async function activate(ctx: vscode.ExtensionContext) { + const betaUrl = isAmazonQ() ? config.betaUrl.amazonq : config.betaUrl.toolkit + if (!isCloud9() && !isReleaseVersion() && betaUrl) { + ctx.subscriptions.push(watchBetaVSIX(betaUrl)) + } +} + /** * Watch the beta VSIX daily for changes. * If this is the first time we are watching the beta version or if its been 24 hours since it was last checked then try to prompt for update @@ -75,11 +88,12 @@ async function runAutoUpdate(vsixUrl: string) { async function checkBetaUrl(vsixUrl: string): Promise { const resp = await got(vsixUrl).buffer() const latestBetaInfo = await getExtensionInfo(resp) - if (VSCODE_EXTENSION_ID.awstoolkit !== `${latestBetaInfo.publisher}.${latestBetaInfo.name}`) { + const extId = isAmazonQ() ? VSCODE_EXTENSION_ID.amazonq : VSCODE_EXTENSION_ID.awstoolkit + if (extId !== `${latestBetaInfo.publisher}.${latestBetaInfo.name}`) { throw new ToolkitError('URL does not point to an AWS Toolkit artifact', { code: 'InvalidExtensionName' }) } - const currentVersion = vscode.extensions.getExtension(VSCODE_EXTENSION_ID.awstoolkit)?.packageJSON.version + const currentVersion = vscode.extensions.getExtension(extId)?.packageJSON.version if (latestBetaInfo.version !== currentVersion) { const tmpFolder = await makeTemporaryToolkitFolder() const betaPath = vscode.Uri.joinPath(vscode.Uri.file(tmpFolder), path.basename(vsixUrl)) @@ -141,7 +155,7 @@ async function promptInstallToolkit(pluginPath: vscode.Uri, newVersion: string, const response = await vscode.window.showInformationMessage( localize( 'AWS.dev.beta.updatePrompt', - `New version of AWS Toolkit is available at the [beta URL]({0}). Install the new version "{1}" to continue using the beta.`, + `New version of ${productName()} is available at the [beta URL]({0}). Install the new version "{1}" to continue using the beta.`, vsixUrl, newVersion ), diff --git a/packages/core/src/dev/config.ts b/packages/core/src/dev/config.ts index 3397a1b944d..276732a72bf 100644 --- a/packages/core/src/dev/config.ts +++ b/packages/core/src/dev/config.ts @@ -3,10 +3,13 @@ * SPDX-License-Identifier: Apache-2.0 */ -// This file is strictly used for private development +// This file is for internal testing. // Nothing in this file should have a truthy value on mainline -export const betaUrl = '' +export const betaUrl = { + amazonq: '', + toolkit: '', +} // feature flag for SQL transformations export const isSQLTransformReady = false diff --git a/packages/core/src/dev/index.ts b/packages/core/src/dev/index.ts index e69b1908875..111920c99ee 100644 --- a/packages/core/src/dev/index.ts +++ b/packages/core/src/dev/index.ts @@ -4,3 +4,4 @@ */ export { DevOptions, updateDevMode } from './activation' +export * as beta from './beta' diff --git a/packages/core/src/extensionNode.ts b/packages/core/src/extensionNode.ts index 42aab7bcf09..b9ac4977b22 100644 --- a/packages/core/src/extensionNode.ts +++ b/packages/core/src/extensionNode.ts @@ -35,6 +35,7 @@ import { activate as activateEcs } from './awsService/ecs/activation' import { activate as activateAppRunner } from './awsService/apprunner/activation' import { activate as activateIot } from './awsService/iot/activation' import { activate as activateDev } from './dev/activation' +import * as beta from './dev/beta' import { activate as activateApplicationComposer } from './applicationcomposer/activation' import { activate as activateRedshift } from './awsService/redshift/activation' import { activate as activateIamPolicyChecks } from './awsService/accessanalyzer/activation' @@ -106,6 +107,7 @@ export async function activate(context: vscode.ExtensionContext) { try { await activateDev(context) + await beta.activate(context) } catch (error) { getLogger().debug(`Developer Tools (internal): failed to activate: ${(error as Error).message}`) }