mirror of
https://github.com/esengine/DeepSeek-Reasonix.git
synced 2026-11-07 02:36:01 -10:00
Bring in the finished Go rewrite (developed under the placeholder name "duo") as the v2 codebase. Code-only import — no upstream git history. Config- and plugin-driven coding agent: registry core, OpenAI-compatible providers, builtin tools, MCP (stdio + HTTP) plugins, permission + sandbox, custom slash commands, @-references, two-model collaboration. Renamed throughout: duo→reasonix, Duo→Reasonix, DUO→REASONIX — module path, imports, CLI name, cmd/ dirs, reasonix.toml, .reasonix/commands, and $REASONIX_* env prefixes. Kept the v2 MIT LICENSE (the Go project had none). Verified: go build ./... · go vet ./... · go test ./... all green; gofmt clean. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
46 lines
1.4 KiB
Go
46 lines
1.4 KiB
Go
package cli
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
// TestCommitReasoningWrapsToWidth guards the ghost-border fix: every line a
|
|
// reasoning commit queues for scrollback must fit the viewport width, so
|
|
// bubbletea's Println erases each line to its end and the old input-box border
|
|
// can't bleed through after a wrapped reasoning row.
|
|
func TestCommitReasoningWrapsToWidth(t *testing.T) {
|
|
const width = 40
|
|
commit := []string{}
|
|
m := &chatTUI{
|
|
width: width,
|
|
reasoning: &strings.Builder{},
|
|
pendingCommit: &commit,
|
|
}
|
|
// Header (short, indented) + a long single-line reasoning paragraph, both
|
|
// dim-wrapped exactly as the agent streams them.
|
|
m.reasoning.WriteString("\x1b[2m ▎ thinking\x1b[0m\n")
|
|
m.reasoning.WriteString("\x1b[2m" + strings.Repeat("reason ", 30) + "\x1b[0m")
|
|
|
|
m.commitReasoning()
|
|
|
|
if len(commit) == 0 {
|
|
t.Fatal("commitReasoning queued nothing")
|
|
}
|
|
for _, block := range commit {
|
|
for _, line := range strings.Split(block, "\n") {
|
|
if w := visibleWidth(line); w > width {
|
|
t.Errorf("committed line exceeds width %d: width=%d %q", width, w, line)
|
|
}
|
|
}
|
|
}
|
|
// The header keeps its leading indent (short lines pass through verbatim).
|
|
if !strings.Contains(commit[0], " ▎ thinking") {
|
|
t.Errorf("header indent not preserved: %q", commit[0])
|
|
}
|
|
// Reasoning must be cleared after committing.
|
|
if m.reasoning.Len() != 0 {
|
|
t.Error("reasoning buffer not reset")
|
|
}
|
|
}
|