Skip to content

Commit 8726819

Browse files
authored
Merge pull request #66 from Tarquinen/feat/disable-update-toasts
feat: add showUpdateToasts config option to disable update notifications
2 parents 326df23 + 3065f1f commit 8726819

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const plugin: Plugin = (async (ctx) => {
6565

6666
// Check for updates after a delay
6767
setTimeout(() => {
68-
checkForUpdates(ctx.client, logger).catch(() => {})
68+
checkForUpdates(ctx.client, logger, config.showUpdateToasts ?? true).catch(() => {})
6969
}, 5000)
7070

7171
// Show migration toast if there were config migrations

lib/config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export interface PluginConfig {
1313
protectedTools: string[]
1414
model?: string
1515
showModelErrorToasts?: boolean
16+
showUpdateToasts?: boolean
1617
strictModelSelection?: boolean
1718
pruning_summary: "off" | "minimal" | "detailed"
1819
nudge_freq: number
@@ -32,6 +33,7 @@ const defaultConfig: PluginConfig = {
3233
debug: false,
3334
protectedTools: ['task', 'todowrite', 'todoread', 'prune', 'batch'],
3435
showModelErrorToasts: true,
36+
showUpdateToasts: true,
3537
strictModelSelection: false,
3638
pruning_summary: 'detailed',
3739
nudge_freq: 10,
@@ -47,6 +49,7 @@ const VALID_CONFIG_KEYS = new Set([
4749
'protectedTools',
4850
'model',
4951
'showModelErrorToasts',
52+
'showUpdateToasts',
5053
'strictModelSelection',
5154
'pruning_summary',
5255
'nudge_freq',
@@ -110,6 +113,8 @@ function createDefaultConfig(): void {
110113
// "model": "anthropic/claude-haiku-4-5",
111114
// Show toast notifications when model selection fails
112115
"showModelErrorToasts": true,
116+
// Show toast notifications when a new version is available
117+
"showUpdateToasts": true,
113118
// Only run AI analysis with session model or configured model (disables fallback models)
114119
"strictModelSelection": false,
115120
// AI analysis strategies (deduplication runs automatically on every request)
@@ -199,6 +204,7 @@ export function getConfig(ctx?: PluginInput): ConfigResult {
199204
protectedTools: [...new Set([...config.protectedTools, ...(globalConfig.protectedTools ?? [])])],
200205
model: globalConfig.model ?? config.model,
201206
showModelErrorToasts: globalConfig.showModelErrorToasts ?? config.showModelErrorToasts,
207+
showUpdateToasts: globalConfig.showUpdateToasts ?? config.showUpdateToasts,
202208
strictModelSelection: globalConfig.strictModelSelection ?? config.strictModelSelection,
203209
strategies: mergeStrategies(config.strategies, globalConfig.strategies as any),
204210
pruning_summary: globalConfig.pruning_summary ?? config.pruning_summary,
@@ -230,6 +236,7 @@ export function getConfig(ctx?: PluginInput): ConfigResult {
230236
protectedTools: [...new Set([...config.protectedTools, ...(projectConfig.protectedTools ?? [])])],
231237
model: projectConfig.model ?? config.model,
232238
showModelErrorToasts: projectConfig.showModelErrorToasts ?? config.showModelErrorToasts,
239+
showUpdateToasts: projectConfig.showUpdateToasts ?? config.showUpdateToasts,
233240
strictModelSelection: projectConfig.strictModelSelection ?? config.strictModelSelection,
234241
strategies: mergeStrategies(config.strategies, projectConfig.strategies as any),
235242
pruning_summary: projectConfig.pruning_summary ?? config.pruning_summary,

lib/version-checker.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function isOutdated(local: string, remote: string): boolean {
5050
return false
5151
}
5252

53-
export async function checkForUpdates(client: any, logger?: { info: (component: string, message: string, data?: any) => void }): Promise<void> {
53+
export async function checkForUpdates(client: any, logger?: { info: (component: string, message: string, data?: any) => void }, showToast: boolean = true): Promise<void> {
5454
try {
5555
const local = getLocalVersion()
5656
const npm = await getNpmVersion()
@@ -67,6 +67,10 @@ export async function checkForUpdates(client: any, logger?: { info: (component:
6767

6868
logger?.info("version", "Update available", { local, npm })
6969

70+
if (!showToast) {
71+
return
72+
}
73+
7074
await client.tui.showToast({
7175
body: {
7276
title: "DCP: Update available",

0 commit comments

Comments
 (0)