Skip to content

fix(slack-publish): gracefully handle missing SLACK_BOT_TOKEN with setup guidance#23

Merged
1shooperman merged 5 commits into
mainfrom
feat/slack-publish-token-guidance
May 24, 2026
Merged

fix(slack-publish): gracefully handle missing SLACK_BOT_TOKEN with setup guidance#23
1shooperman merged 5 commits into
mainfrom
feat/slack-publish-token-guidance

Conversation

@1shooperman

@1shooperman 1shooperman commented May 24, 2026

Copy link
Copy Markdown
Owner

Closes #18

Summary

  • Added early-exit token validation to the publish skill: before attempting any Slack API calls, the skill now delegates to a new agent-token-checker agent that checks for SLACK_BOT_TOKEN in the environment and .env/.env.local files, then surfaces a step-by-step setup guide if the token is absent.
  • Extracted token detection logic into a standalone script (scripts/verify_slackbot_token.py) at the plugin root and a lightweight Haiku-powered agent (agent-token-checker), separating concerns from the main publish script.
  • Expanded test coverage from 33 to 75 tests — integration tests for main(), edge cases for resolve_channel_id and load_slack_token, and a dedicated suite for the new token-checker script.

Components

Type Name Purpose
Agent slack-publish:agent-token-checker Runs scripts/verify_slackbot_token.py and reports whether SLACK_BOT_TOKEN is available; used as a pre-flight gate in the publish skill.
Skill slack-publish:publish Updated to invoke agent-token-checker as step 1 and halt with actionable setup instructions when the token is missing.

Security

  • agent-token-checker uses allowed-tools: [Bash] — scope is broader than the single script invocation it performs. Low risk given the fixed instruction, but worth noting.
  • $ARGUMENTS prompt interpolation — file path and channel are passed as discrete quoted shell words (preventing shell injection), but the prompt-level substitution is unguarded. Pre-existing condition.
  • Test fixtures use xoxb-test — non-functional synthetic token; consider xoxb-FAKE-test if secret scanners use broad xoxb- patterns.

Test plan

  • /slack-publish:publish notes.md #general with no token set → agent reports "Token missing.", skill halts with full setup guidance
  • /slack-publish:publish notes.md #general with token in .env → agent reports "Token found.", skill proceeds
  • /slack-publish:publish notes.md #general with SLACK_BOT_TOKEN in shell env → proceeds normally
  • python3 scripts/verify_slackbot_token.py with token set → exits 0; without → exits 1
  • python3 -m pytest tests/ → 75 tests pass

🤖 Generated with Claude Code

1shooperman and others added 5 commits May 24, 2026 10:23
…tup guidance

When the bot token is not configured, the publish skill now detects this
early and shows step-by-step setup instructions instead of a bare error.
Adds main() integration tests covering missing-token, missing-file, and
dry-run paths.

Closes #18

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…d, and load_slack_token edge cases

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… agent

Move verify_slackbot_token.py to plugin root scripts/, create
agent-token-checker agent, and update publish skill to invoke the
agent instead of an inline bash snippet. Adds dedicated test file
for verify_slackbot_token (10 tests).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@1shooperman 1shooperman merged commit ec6cfb9 into main May 24, 2026
3 checks passed
@1shooperman 1shooperman deleted the feat/slack-publish-token-guidance branch May 24, 2026 15:33
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.

slack-publish plugin needs better user guidance

1 participant