Files
Paymahn Moghadasian 6a972a1f05 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.
2026-06-26 11:04:05 -05:00

39 lines
1.0 KiB
Go

package cmds
import (
"github.com/paymog/slack-cli/internal/config"
"github.com/paymog/slack-cli/internal/runtime"
"github.com/paymog/slack-cli/pkg/handler"
"github.com/spf13/cobra"
)
func newUsersCommand(cfg *config.Config) *cobra.Command {
cmd := &cobra.Command{
Use: "users",
Aliases: []string{"user"},
Short: "Search workspace users",
}
cmd.AddCommand(usersSearchCommand(cfg))
return cmd
}
func usersSearchCommand(cfg *config.Config) *cobra.Command {
var limit int
cmd := &cobra.Command{
Use: "search <query>",
Short: "Search users by name, email, or display name, as CSV",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
p, logger, err := runtime.PrepareRead(cmd.Context(), cfg)
if err != nil {
return err
}
h := handler.NewConversationsHandler(p, logger)
a := map[string]any{"query": args[0], "limit": limit}
return emit(cmd, cfg, "users_search", h.UsersSearchHandler, a)
},
}
cmd.Flags().IntVar(&limit, "limit", 10, "max results (1-100)")
return cmd
}