mirror of
https://github.com/xlionjuan/searxng-mcp-go.git
synced 2026-11-17 04:17:51 +00:00
* Created `internal/searxng/answer/` subpackage with 4 new files (answer.go, typed.go, deduplicate.go, truncate.go), updated response.go/deduplicate.go/truncate.go/types.go/constants.go to use thin wrappers, removed typedanswer.go, updated AGENTS.md/CONTEXT.md, and verified via build, test, lint gates. Co-authored-by: xlionjuan <[email protected]> * Merged main, added 4 test files, all gates pass. Co-authored-by: xlionjuan <[email protected]> * Added `t.Parallel()`, fixed error msgs, wsl lint. Co-authored-by: xlionjuan <[email protected]> --------- Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com> Co-authored-by: xlionjuan <[email protected]>
15 lines
619 B
Go
15 lines
619 B
Go
package searxng
|
|
|
|
import "searxng-mcp-go/internal/searxng/answer"
|
|
|
|
// TruncateRunes returns s truncated to at most maxRunes runes. The rune-safe
|
|
// implementation lives in the answer subpackage so the answer deduplication
|
|
// logic can use it without circular imports.
|
|
//
|
|
// This function is the single source of truth for rune-safe truncation. It is
|
|
// used both by the internal deduplication prefix match (searxng package) and
|
|
// by the CLI text formatter (root package) for content-length bounding per
|
|
// MaxContentRunes.
|
|
func TruncateRunes(s string, maxRunes int) string {
|
|
return answer.TruncateRunes(s, maxRunes)
|
|
}
|