Skip to content

Board: add toki:// OpenCode launcher via right-click Copy for LLM (Linux first, Windows next) #87

@ponbac

Description

@ponbac

Summary

Add a custom protocol launcher (toki://) so users can right-click Copy for LLM on board cards and choose Open in OpenCode.

Flow:

  1. Fetch existing format-for-llm markdown.
  2. Copy markdown to clipboard.
  3. Open toki://open?tool=opencode&mode=clipboard&v=1&workItemId=<id>.
  4. Local protocol handler launches a new terminal and opens OpenCode interactive with prefilled prompt from clipboard.

Agreed Product Decisions

  • Scheme: toki:// (not ecosearch://)
  • Payload transport: clipboard-based
  • Card UX:
    • Left click on Copy button stays unchanged (copy markdown)
    • Right click on Copy button opens shadcn/radix context menu
    • Context menu options (v1): OpenCode only
  • OpenCode run mode: interactive TUI with prefilled prompt
  • Prompt source: existing GET /work-items/format-for-llm
  • Platform scope:
    • Linux first
    • Windows support added immediately after Linux in same initiative
  • Setup UX: in-app simple guided setup with copyable commands

Scope

Frontend

  • Add shadcn/radix Context Menu integration for CopyWorkItem.
  • Right-click menu item: Open in OpenCode.
  • Launch sequence for that action:
    • fetch markdown from formatForLlm
    • copy to clipboard
    • navigate to toki://...
  • Add URL builder helper for strict protocol contract:
    • action: open
    • allowlisted params: tool=opencode, mode=clipboard, v=1, optional workItemId
  • Add error toasts for:
    • format fetch failure
    • clipboard failure
    • protocol launch fallback guidance (if setup missing)

In-app Guided Setup

Provide an in-app setup dialog with copyable command steps and validation guidance.

Linux (phase 1)

  1. Install/verify OpenCode CLI.
  2. Create local toki handler script.
  3. Create .desktop entry registering x-scheme-handler/toki.
  4. Run xdg-mime registration command.
  5. Provide test command (xdg-open 'toki://open?...').

Windows (phase 2, same issue)

  1. Add Windows setup instructions in the same in-app wizard section.
  2. Register toki:// in Windows Registry.
  3. Add local launcher script/exe entrypoint for protocol args.
  4. Launch terminal and run OpenCode interactive with clipboard prompt.
  5. Provide verification steps for protocol registration + launch.

Local Handler Behavior

  • Accept URL arg and strictly parse toki://open.
  • Validate allowlisted tool/mode/v.
  • Read clipboard text with platform-specific fallback chain.
  • Spawn a terminal emulator and run OpenCode interactive prefilled prompt.
  • Fail with clear terminal-visible errors when dependencies are missing.

Acceptance Criteria

  1. Left-click Copy behavior remains unchanged.
  2. Right-click Copy opens context menu with Open in OpenCode.
  3. Linux setup path works end-to-end and launches OpenCode with prompt content.
  4. Windows setup path works end-to-end and launches OpenCode with prompt content.
  5. Setup dialog can be re-opened and includes copyable steps for both OSes.
  6. No backend API changes required for v1/v2 of this feature.

Notes

OpenCode CLI reference: https://opencode.ai/docs/cli/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions