Skip to content

Commit 929244b

Browse files
authored
fix: add memento for sat modal (#673)
1 parent 79b07de commit 929244b

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

src/snyk/common/constants/globalState.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ export const MEMENTO_LS_PROTOCOL_VERSION = 'snyk.lsProtocolVersion';
55
export const MEMENTO_ANALYTICS_PLUGIN_INSTALLED_SENT = 'snyk.pluginInstalledSent';
66
export const MEMENTO_AUTO_CONFIGURE_MCP_SERVER = 'snyk.autoConfigureSnykMcpServer';
77
export const MEMENTO_SECURE_AT_INCEPTION_EXECUTION_FREQUENCY = 'snyk.secureAtInceptionExecutionFrequency';
8+
export const MEMENTO_SECURE_AT_INCEPTION_MODAL = 'snyk.secureAtInceptionModal';

src/snyk/extension.ts

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ import { ClearCacheService } from './common/services/CacheService';
8181
import { InMemory, Persisted } from './common/constants/general';
8282
import { GitAPI, GitExtension, Repository } from './common/git';
8383
import { AnalyticsSender } from './common/analytics/AnalyticsSender';
84-
import { MEMENTO_ANALYTICS_PLUGIN_INSTALLED_SENT } from './common/constants/globalState';
84+
import {
85+
MEMENTO_ANALYTICS_PLUGIN_INSTALLED_SENT,
86+
MEMENTO_SECURE_AT_INCEPTION_MODAL,
87+
} from './common/constants/globalState';
8588
import { AnalyticsEvent } from './common/analytics/AnalyticsEvent';
8689
import { SummaryWebviewViewProvider } from './common/views/summaryWebviewProvider';
8790
import { SummaryProviderService } from './base/summary/summaryProviderService';
@@ -487,20 +490,26 @@ class SnykExtension extends SnykLib implements IExtension {
487490
void extensionContext.updateGlobalStateValue(MEMENTO_ANALYTICS_PLUGIN_INSTALLED_SENT, true);
488491
});
489492

490-
const options = ['Yes'] as const;
491-
const picked = await vscode.window.showInformationMessage(
492-
'Do you want to enable Snyk to automatically scan and secure AI generated code?',
493-
{
494-
modal: true,
495-
detail:
496-
' Consider enabling this if you’re using an AI agent in your IDE. You can customize the scan frequency on Snyk Security’s settings page.',
497-
},
498-
...options,
499-
);
500-
501-
if (picked) {
502-
await configuration.setAutoConfigureMcpServer(true);
503-
await configuration.setSecureAtInceptionExecutionFrequency('On Code Generation');
493+
const secureAtInceptionModal =
494+
extensionContext.getGlobalStateValue<boolean>(MEMENTO_SECURE_AT_INCEPTION_MODAL) ?? false;
495+
496+
if (!secureAtInceptionModal) {
497+
await extensionContext.updateGlobalStateValue(MEMENTO_SECURE_AT_INCEPTION_MODAL, true);
498+
const options = ['Yes'] as const;
499+
const picked = await vscode.window.showInformationMessage(
500+
'Do you want to enable Snyk to automatically scan and secure AI generated code?',
501+
{
502+
modal: true,
503+
detail:
504+
' Consider enabling this if you’re using an AI agent in your IDE. You can customize the scan frequency on Snyk Security’s settings page.',
505+
},
506+
...options,
507+
);
508+
509+
if (picked) {
510+
await configuration.setAutoConfigureMcpServer(true);
511+
await configuration.setSecureAtInceptionExecutionFrequency('On Code Generation');
512+
}
504513
}
505514
}
506515
}

0 commit comments

Comments
 (0)