feat(slack): add /cc slash command gateway and harden command parsing#116
feat(slack): add /cc slash command gateway and harden command parsing#116lethanhson9901 wants to merge 1 commit intochenhg5:mainfrom
Conversation
|
Thanks for this PR! Overall it looks great — it's backward compatible and adds a clean way to use cc-connect commands in Slack. A few suggestions: 1. Make the gateway command configurableCurrently [[projects.platforms]]
type = "slack"
[projects.platforms.options]
gateway_command = "cc" # default: "cc", user can change to "ai", "bot", etc.This way:
2. Future enhancement: prefix-based commands for better autocompleteThe current gateway approach ( A potential future enhancement would be a prefix mode where each command is registered individually ( This is more complex (requires registering N commands, handling dynamic skills/aliases), so it can be a follow-up PR. But worth considering for better UX. Once the |
Summary
This PR improves the Slack integration in three related areas:
/ccgateway@mentioncommand parsing for non-standard whitespaceWhat Changed
Native Slack slash command gateway
Slack integration now handles Socket Mode
slash_commandsevents and routes/cc ...intothe existing cc-connect command engine.
Examples:
/cc help/cc model/cc status/cc mycustomThis keeps Slack-native command handling aligned with the existing built-in, custom command,
and skill command paths.
More robust mention command parsing
@cc_connect /modelnow parses correctly even when Slack inserts non-ASCII whitespace, suchas:
This avoids falling through to normal chat handling when the user intended to run a command.
Alias compatibility for slash-style input
Alias resolution now also works when the input is slash-prefixed, so Slack gateway input
like
/cc 帮助can still resolve to alias-backed commands.Documentation updates
docs/slack.mdnow documents:commandsOAuth scope/ccslash command in Slack/cc ...@cc_connect /model/modelWhy
Before this change:
/modelusage was confusing because Slack interprets it as a native Slackcommand
This PR makes Slack command usage more reliable and much easier to understand.
Implementation Notes
socketmode.EventTypeSlashCommandin the Slack platform/ccas a gateway command and normalizes the payload into the existing enginecommand format
/ccto avoid overreaching Slack appconfiguration assumptions
Tests
Added/updated tests for:
/ccslash command normalizationVerification run:
go test -count=1 ./platform/slack ./corego test -count=1 ./...Backward Compatibility
Existing Slack usage continues to work:
@cc_connect /model/modelThis PR only adds a native Slack command path via
/cc.