Files
Paymahn Moghadasian d781728c6c feat: slack-cli — a no-daemon CLI over the slack-mcp-server engine (#1)
* feat: add slack-cli, a no-daemon CLI over the slack-mcp-server engine

Turn the forked slack-mcp-server into a CLI so running many agents no
longer means one resident MCP process each. Every command is a
short-lived process that reads the shared on-disk cache.

- rename module to github.com/paymog/slack-cli (go install/homebrew/ldflags)
- internal/toolcall: invoke the upstream tool handlers in-process; the only
  mcp-go coupling lives here, so pkg/handler and pkg/provider are reused
  byte-for-byte (clean upstream merges, fork-and-extend)
- internal/{cli,cmds,config,credstore,runtime,output}: cobra command tree,
  keyring-backed credential profiles, provider bootstrap, result printing
- 21 tools as subcommands (channels, conversations, users, usergroups,
  saved, reactions, attachments, cache); write tools keep their env gating
- goreleaser + homebrew release workflow; ships a skills/slack-cli skill
- unit tests for config/credstore/toolcall; MCP server still builds

The MCP server (cmd/slack-mcp-server) is kept intact.

* chore(napkin): record real-workspace verification

* docs: explain how the CLI works (in-process handler invocation, shared cache)
2026-06-26 12:45:38 -05:00

37 lines
1.0 KiB
Go

package provider
import (
"errors"
"github.com/rusq/slackdump/v3/auth"
"go.uber.org/zap"
)
// ValidateTokens checks that the given Slack credentials authenticate against
// the workspace and returns its TeamID. Priority mirrors New(): xoxp > xoxb >
// xoxc/xoxd. It returns an error instead of calling logger.Fatal, so callers
// (e.g. `slack-cli auth login`) can handle failures gracefully.
//
// Lives in a separate file (additive) to keep the rest of the provider package
// identical to upstream for clean merges.
func ValidateTokens(xoxp, xoxb, xoxc, xoxd string, logger *zap.Logger) (string, error) {
var (
ap auth.ValueAuth
err error
)
switch {
case xoxp != "":
ap, err = auth.NewValueAuth(xoxp, "")
case xoxb != "":
ap, err = auth.NewValueAuth(xoxb, "")
case xoxc != "" && xoxd != "":
ap, err = auth.NewValueAuth(xoxc, xoxd)
default:
return "", errors.New("no credentials: provide xoxp, xoxb, or xoxc+xoxd")
}
if err != nil {
return "", err
}
return validateAuthAndGetTeamID(ap, logger)
}