# =service: a "service war room". Type a service name; Bolt fans out across
# real local CLIs (gh, kubectl, curl) plus =git-log's own logic and merges
# them into one status list. Select a row: the right pane renders that item's
# rich Markdown detail (a CI matrix, pod facts, log lines, a commit).
#
# Every source is real, not fixture text: each one detects its own CLI
# (installed and authenticated) at run time and degrades to an honest
# install/auth row when it can't run, rather than ever showing fixture data
# next to real data. There is no top-level `detect:` gate on this utility
# itself, unlike single-source CLI utilities such as =gh-prs / =k8s-pods,
# because it fans out across several independently-available sources at
# once; partial availability is a normal, expected state here.
#
# Deploy/Argo has nothing real backing it today (no CLI, no MCP template) so
# it is not a source here at all, per the same honesty rule, rather than a
# fixture-backed row. Likewise PagerDuty: no wiring exists yet from this
# native sample-utility system into bolt-api's real MCP layer (investigated,
# not built here; see the accompanying report), so it is left out rather
# than shown as fixture data. BOLT_SERVICE_SLOW=1 makes the script slow so
# you can show the "Still searching... x" cancel + supersede lifecycle; that
# demo hook is unrelated to source data and is left as-is.
#
# The health-check source needs a URL that can't be auto-discovered, so it's
# a second, optional query word (the `health_url` arg below). Omit it and
# that pane says so plainly instead of guessing or requesting nothing.
schema_version: 1
runtime: bridge
id: service
chip: service
title: Service war room
icon: server
description: "Fan out CI, pods, health check, commits for a service; rich detail on the right"
placeholder_examples: ["checkout-api", "payments", "search"]
emits: Generic

bridge:
  command:
    macos: "python3 {{scripts_dir}}/bolt-service.py {{name}} {{health_url}}"
    linux: "python3 {{scripts_dir}}/bolt-service.py {{name}} {{health_url}}"
    windows: "python {{scripts_dir}}/bolt-service.py {{name}} {{health_url}}"
  parse: json
  timeout_seconds: 24

args:
  - { name: name, from: "query.word(0)", default: checkout-api }
  - { name: health_url, from: "query.word(1)", default: "" }

presentation:
  widget: list
  title_field: title
  subtitle_field: subtitle
  # Wide rich-detail pane (entity_preview) rather than the narrow card column:
  # a couple of fact rows plus the full Markdown body (CI matrix, pod facts, etc.).
  right_widget:
    kind: entity_preview
    mode: selected_row
    bind:
      title: "{{row.title}}"
      subtitle: "{{row.subtitle}}"
      fields:
        - { label: Source, value: "{{row.source}}" }
        - { label: Status, value: "{{row.status}}" }
      body: "{{row.body}}"
      actions: [open, copy]

actions:
  - { id: open, kind: url, target: row, label: Open, url_template: "{{row.url}}" }
  - { id: copy, kind: composer, target: row, label: Copy detail, insert: "{{body}}" }
