Skip to content

feat: add reliable startup toast notifications with delayed execution#20

Merged
j4rviscmd merged 1 commit intomainfrom
feat/startup-toast
Mar 19, 2026
Merged

feat: add reliable startup toast notifications with delayed execution#20
j4rviscmd merged 1 commit intomainfrom
feat/startup-toast

Conversation

@j4rviscmd
Copy link
Copy Markdown
Owner

Summary

Add reliable toast notifications on startup by using setTimeout(3000) to delay execution until OpenCode UI has fully initialized.

Changes

  • Drift warning toast (always shown): When config drift is detected and files are rewritten, display a warning toast with the message applied "<mode>" mode.\nrestart opencode to take effect.
  • No-drift info toast (controlled by showToastOnStartup): When no drift is detected, display an informational toast with current mode: <mode>
  • Removed the old TODO comment about unreliable toast display
  • Added 3 new test cases covering info toast shown/hidden and drift-only behavior
  • Updated MockModeManager with lastInfoToast tracking

Motivation

Previously, toast notifications fired during plugin initialization when the OpenCode UI was not yet ready, causing them to silently fail (caught by .catch(() => {})). The 3-second delay ensures the UI is available.

Design decisions

  • Drift warning toast is always shown regardless of showToastOnStartup — config drift is an important warning
  • Toast title uses agent-mode-switcher (kebab-case, matching package name)
  • All toast messages are lowercase

Closes #19

Use setTimeout(3000) to delay toast display until OpenCode UI has
initialized. Drift warning toast is always shown; no-drift info toast
is controlled by showToastOnStartup config flag.

Closes #19
@j4rviscmd j4rviscmd added the enhancement New feature or request label Mar 19, 2026
@j4rviscmd j4rviscmd merged commit 8c58de9 into main Mar 19, 2026
1 check passed
@j4rviscmd j4rviscmd deleted the feat/startup-toast branch March 19, 2026 10:49
@j4rviscmd j4rviscmd mentioned this pull request Mar 19, 2026
j4rviscmd added a commit that referenced this pull request Mar 19, 2026
Bump version from 0.3.2 to 0.4.0\n\nChanges:\n- feat: Add reliable startup toast notifications with delayed execution (#20)\n- chore: Add add-to-project workflow
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 起動時のtoast通知改善: モード適用通知と現在モード表示

1 participant