This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/server/handlers/tree.go
Jeffrey Smith 11fd8c1e57 step 1: rename module chat-switchboard → switchboard-core
- go.mod module name
- All 714 import references across 289 Go files
- VERSION: 0.1.0
- CI DB names: switchboard_core_{ci,dev,test}
- Docker image: gobha/switchboard-core
- Test fixtures: JWT issuer, repo names
- .env.example, docker-compose container name
- Compiles clean (go build exit 0)
2026-03-25 19:48:04 -04:00

60 lines
2.0 KiB
Go

package handlers
// This file previously contained all tree traversal logic (path building,
// sibling queries, cursor management). As of v0.15.0, the core logic lives
// in the treepath package; these are package-local aliases so existing
// handler code (messages.go, completion.go) compiles with minimal churn.
//
// New code should import treepath directly.
import (
"switchboard-core/treepath"
)
// ── Type Aliases ────────────────────────────
// Existing handler code references these types by unqualified name.
type PathMessage = treepath.PathMessage
type SiblingInfo = treepath.SiblingInfo
// ── Function Wrappers ───────────────────────
func getActiveLeaf(channelID, userID string) (*string, error) {
return treepath.GetActiveLeaf(channelID, userID)
}
func getActivePath(channelID, userID string) ([]PathMessage, error) {
return treepath.GetActivePath(channelID, userID)
}
func getPathToLeaf(channelID, leafID string) ([]PathMessage, error) {
return treepath.GetPathToLeaf(channelID, leafID)
}
func getSiblingCount(channelID string, parentID *string) int {
return treepath.GetSiblingCount(channelID, parentID)
}
func getSiblings(messageID string) ([]SiblingInfo, int, error) {
return treepath.GetSiblings(messageID)
}
func findLeafFromMessage(messageID string) (string, error) {
return treepath.FindLeafFromMessage(messageID)
}
func nextSiblingIndex(channelID string, parentID *string) int {
return treepath.NextSiblingIndex(channelID, parentID)
}
func updateCursor(channelID, userID, messageID string) error {
return treepath.UpdateCursor(channelID, userID, messageID)
}
// isSummaryMessage checks if a PathMessage has summary metadata.
// This was previously defined in completion.go; moved here alongside the
// other tree helpers so all callers use the canonical treepath version.
func isSummaryMessage(m *PathMessage) bool {
return treepath.IsSummaryMessage(m)
}