Add window.postMessage interface for command add/delete from Command Hub#386
Draft
Add window.postMessage interface for command add/delete from Command Hub#386
Conversation
…ions Agent-Logs-Url: https://github.com/ujiro99/selection-command/sessions/16017629-ea98-47e9-9a0b-a7c5dbd6286f Co-authored-by: ujiro99 <677231+ujiro99@users.noreply.github.com>
Agent-Logs-Url: https://github.com/ujiro99/selection-command/sessions/16017629-ea98-47e9-9a0b-a7c5dbd6286f Co-authored-by: ujiro99 <677231+ujiro99@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add interface for command download and removal
Add window.postMessage interface for command add/delete from Command Hub
Apr 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Enables Selection Command Hub (and other trusted web pages) to programmatically add or delete extension commands via
window.postMessage, with toast feedback on success/error.Changes
New IPC command
BgCommand.removeCommandenum value toipc.tsBackground handler (
background_script.ts)removeCommandhandler: filters commands by ID in a single pass, returnsfalseif ID not found, persists and returnstrueon successpostMessage listener (
DownloadButton.tsx)window.messagelistener scoped to Hub origin (new URL(HUB_URL).origin) — rejects messages from any other originAddCommand— delegates to existingBgCommand.addCommandDeleteCommand— calls newBgCommand.removeCommandwith commandidsonnertoast on success/error; added<Toaster>to component render treei18n
commandHub_add_success,commandHub_add_error,commandHub_delete_success,commandHub_delete_error) to all 14 supported localesUsage (Hub side)