add black-box debug harness

This commit is contained in:
2026-05-14 16:37:46 +01:00
parent 8d4df5f683
commit 56e94ae032
18 changed files with 1274 additions and 0 deletions

35
internal/harness/input.go Normal file
View File

@@ -0,0 +1,35 @@
package harness
import "fmt"
func EncodeChord(name string) ([]byte, error) {
switch name {
case "ctrl-k":
return []byte{0x0b}, nil
case "ctrl-k-kitty":
return []byte("\x1b[107;5u"), nil
case "ctrl-k-xterm":
return []byte("\x1b[27;5;107~"), nil
case "enter":
return []byte{'\r'}, nil
case "escape":
return []byte{0x1b}, nil
case "backspace":
return []byte{0x7f}, nil
case "up":
return []byte("\x1b[A"), nil
case "down":
return []byte("\x1b[B"), nil
case "left":
return []byte("\x1b[D"), nil
case "right":
return []byte("\x1b[C"), nil
case "ctrl-n":
return []byte{0x0e}, nil
case "ctrl-p":
return []byte{0x10}, nil
case "ctrl-u":
return []byte{0x15}, nil
}
return nil, fmt.Errorf("unknown chord %q", name)
}