# =slack — structured rows + wide detail pane (via bolt-slack.sh). CLI-gated.
# NOTE: rewritten to the CLI's JSON output (live-unverified against every CLI
# version); the helper falls back to line rows if the shape is unexpected.
schema_version: 1
runtime: bridge
id: slack
chip: slack
title: Slack Workspaces
icon: hash
description: "List via the `slack` CLI. Enter to load, then filter the results."
placeholder_examples: ["Enter to load — then filter the results"]
emits: Account

detect:
  binary: slack
  auth_check:
    macos: "slack auth list"
    linux: "slack auth list"
    windows: "slack auth list"
  config_hint: ["~/.slack"]
  refresh: on_focus

args:
  - { name: filter, from: "query.word(0)", default: "" }

dispatch:
  confirm_label: "List your Slack workspaces"
  confirm_hint: "Press ↵ to load · filter the results as you type"

bridge:
  command:
    macos: "python3 {{scripts_dir}}/bolt-slack.py {{filter}}"
    linux: "python3 {{scripts_dir}}/bolt-slack.py {{filter}}"
    windows: "python {{scripts_dir}}/bolt-slack.py {{filter}}"
  parse: json
  timeout_seconds: 15

presentation:
  widget: list
  title_field: title
  subtitle_field: subtitle
  searchable: true
  right_widget:
    kind: entity_preview
    mode: selected_row
    bind:
      title: "{{row.title}}"
      subtitle: "{{row.subtitle}}"
      fields:
        - { label: Team, value: "{{row.team}}" }
        - { label: User, value: "{{row.user}}" }
      body: "{{row.body}}"
      actions: [copy]

actions:
  - { id: copy, kind: composer, target: row, label: Copy, insert: "{{title}}" }
