Files
Algis DumbrisandClaude Opus 4.6 e3dcfece48 feat: implement channels with membership and MCP tools
Add channel management feature with public/private channels,
membership (owner/member roles), invitations, broadcast messaging,
and full MCP tool exposure.

New files:
- internal/channels/ - types, store, service, validation, errors
- internal/mcp/channel_tools.go - 8 MCP tools for channel operations
- schema/002_channels.sql - migration for channel_invites table

MCP tools: create_channel, join_channel, leave_channel, list_channels,
invite_to_channel, kick_from_channel, send_channel_message, update_channel

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 11:56:50 +02:00

31 lines
811 B
Go

package channels
import (
"fmt"
"regexp"
"strings"
)
var channelNameRegex = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9_-]*$`)
// ValidateChannelName validates a channel name.
// Names must be alphanumeric plus hyphens and underscores, max 64 characters.
// Names are normalized to lowercase.
func ValidateChannelName(name string) error {
if name == "" {
return ErrInvalidChannelName
}
if len(name) > 64 {
return fmt.Errorf("%w: name exceeds 64 characters", ErrInvalidChannelName)
}
if !channelNameRegex.MatchString(name) {
return fmt.Errorf("%w: name must be alphanumeric with hyphens and underscores", ErrInvalidChannelName)
}
return nil
}
// NormalizeChannelName returns the lowercase form of a channel name.
func NormalizeChannelName(name string) string {
return strings.ToLower(name)
}