Skip to content

Command palette discoverability: copilot commands + Run Script Command - #9

Merged
CommunityPoke merged 1 commit into
mainfrom
devin/1789816611-palette-discoverability
Sep 19, 2026
Merged

CommunityPoke merged 1 commit into
mainfrom
devin/1789816611-palette-discoverability

Conversation

@CommunityPoke

Copy link
Copy Markdown
Contributor

Summary

Makes userscript commands discoverable in the Command Palette:

  • Static contributions for swiftCopilot.generate/explain/refactor with Swift Copilot category — they get polished palette titles and are hidden until the copilot userscript is loaded via a swiftCopilot.loaded context key (set after each loadAll). Static contributes.commands declares title/visibility only; the handler is still the script's dynamic registerCommand, so no duplicate-registration conflict (that path is covered by Fix duplicate command registration crash on .vswift load/reload #7's CommandRegistry).
  • swiftUserscripts.runCommand ("Swift Userscripts: Run Script Command...") — QuickPick listing every live dynamically-registered userscript command with its manifest title, command id, and owning script; selecting executes it via vscode.commands.executeCommand.

Supporting changes: CommandRegistry.list() returns a {id, owner} snapshot; SwiftScriptHost.contributedCommands captures the initialize manifest; new vscode-free commandPalette.ts#toPickItems builds items (tested in node).

Tests: commands.test.mjs extended to 21 checks (contributions, list() metadata, pick-item mapping, cleanup-visible-in-listings). tsc, swift test (6+5), smoke, vswift all green.

… Command

- contributes.commands: swiftCopilot.generate/explain/refactor with
  'Swift Copilot' category, gated on 'swiftCopilot.loaded' context so they
  surface in the palette only when the userscript is actually running.
  Static contribution declares title/category; dynamic registerCommand
  still binds the handler — no duplicate registration.
- swiftUserscripts.runCommand: QuickPick over CommandRegistry's live
  registrations with manifest titles + owning script name.
- CommandRegistry.list() exposes {id, owner} snapshot; SwiftScriptHost
  captures contributedCommands from the initialize manifest; pure
  toPickItems() helper builds QuickPick items.
- extension.ts sets 'swiftCopilot.loaded' after each loadAll().
- tests: +9 checks (manifest contributions, list() metadata, pick-item
  mapping, post-cleanup listings).

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@CommunityPoke
CommunityPoke merged commit d90865b into main Sep 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant