Skip to content

feat(block-kit): preview blocks via slack blocks preview CLI - #98

Open
WilliamBergamin wants to merge 1 commit into
mainfrom
support-bkb-in-block-kit-skill
Open

feat(block-kit): preview blocks via slack blocks preview CLI#98
WilliamBergamin wants to merge 1 commit into
mainfrom
support-bkb-in-block-kit-skill

Conversation

@WilliamBergamin

@WilliamBergamin WilliamBergamin commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Teaches the block-kit skill to preview blocks with the new slack blocks preview CLI command, which opens the Block Kit Builder with the blocks pre-loaded. The skill discovers the command's usage via --help rather than hard-coding flags.

Also removes the redundant validation Escape Hatch, whose visual-debugging fallback is now covered by the richer preview step.

Important

This PR is blocked by slackapi/slack-cli#620, which ships the slack blocks preview command this skill depends on. Merge that first.

Testing

Run make lint and make test-unit (both pass). Then exercise the skill with the prompts below.

Note

In a normal session the live slack:block-kit skill loads from the installed plugin cache, not the working tree.

Prompt 1 — preview an existing set of blocks (lands directly on the new preview path):

I've got this Block Kit message — can you show me what it'll actually look like rendered?

{
  "blocks": [
    { "type": "header", "text": { "type": "plain_text", "text": "Deploy complete :rocket:" } },
    { "type": "section", "text": { "type": "mrkdwn", "text": "*prod* is now running `v2.4.1`. All health checks passed." } },
    { "type": "context", "elements": [ { "type": "mrkdwn", "text": "Triggered by <@U123> · 2m ago" } ] },
    { "type": "actions", "elements": [
      { "type": "button", "text": { "type": "plain_text", "text": "View logs" }, "style": "primary", "action_id": "view_logs_btn" },
      { "type": "button", "text": { "type": "plain_text", "text": "Rollback" }, "style": "danger", "action_id": "rollback_btn" }
    ] }
  ]
}

Prompt 2 — full end-to-end (build → validate → preview, starting from plain English with no JSON):

I want to build a Slack message for our on-call bot to post when an incident opens.

It should have:
- a header that says the incident is open
- a section summarizing severity, the affected service, and who's the incident commander
- a context line with the timestamp
- buttons to "Join war room" and "Acknowledge"

Build it, make sure it's valid, and then let me see what it'll look like rendered.

A passing run should:

  • Load the block-kit skill and prefer the Slack CLI preview path, resolving SLACK_CMD via the slack-cli skill's detection step.
  • Run SLACK_CMD blocks preview --help to discover usage instead of inventing the --blocks flag.
  • Resolve --team proactively (via auth list, picking any authenticated workspace) rather than stalling or erroring on the missing TTY.
  • Open the Block Kit Builder in the browser with the blocks pre-loaded, and mention which workspace it used.
  • For Prompt 2: build the JSON from the live docs, validate with blocks.validate until "ok": true, then preview.

Notes

  • The skill deliberately does not hard-code the blocks preview flags. Use --help instead, mirroring the existing slack:slack-cli "Command Discovery via Help" idiom, so the command can change without a skill update.
  • AI tools run the CLI non-interactively (no TTY). In that mode slack blocks preview requires a --team flag that does not appear in --help (it only surfaces as a runtime error). The skill directs the agent to resolve the team via auth list and notes any authenticated workspace works for a preview.

Requirements

Teach the block-kit skill to preview blocks with the new
`slack blocks preview` CLI command, which opens the Block Kit
Builder with the blocks pre-loaded. The skill discovers the
command's usage via --help rather than hard-coding flags, and
falls back to the manual Block Kit Builder link when the CLI
isn't installed. Also removes the redundant validation Escape
Hatch, whose visual-debugging fallback is now covered by the
richer preview step.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@changeset-bot

changeset-bot Bot commented Jul 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3072bc5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
slack Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@WilliamBergamin WilliamBergamin self-assigned this Jul 23, 2026
@WilliamBergamin WilliamBergamin added enhancement New feature or request semver:patch Changes trigger a patch version bump labels Jul 23, 2026
@WilliamBergamin
WilliamBergamin marked this pull request as ready for review July 23, 2026 14:30
@WilliamBergamin
WilliamBergamin requested a review from a team as a code owner July 23, 2026 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request semver:patch Changes trigger a patch version bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant