Commit Graph

49 Commits

Author SHA1 Message Date
JiXieShi 7b6f4f03ab fix: simplify forward form to 2 fields, fix centering
- Revert fillScreen to Left/Top (normal terminal behavior)
- Simplify startForwardForm to 2 fields: Type (Tab cycle) + Address
- Remove splitAddr/netSplit helpers
- Add huh form library dependency for future use

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 02:23:48 +08:00
JiXieShi 939c3d5a29 fix: center main view content using terminal size
Change fillScreen from lipgloss.Left to lipgloss.Center for horizontal
positioning so content is centered based on actual terminal dimensions.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 02:15:02 +08:00
JiXieShi a4996ba3e7 feat: multi-field forward form with Tab cycling
Replace single-line prompt with form-based forward input:
- Separate Type/Host/Port fields
- Tab/Shift+Tab cycles focus, Tab on Type field cycles mode values
- Address auto-split into host+port for edit
- COM port excludes port field
- Form render with focused field indicator

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 02:13:18 +08:00
JiXieShi 341476f10a feat: auto-load all .lua plugins from plugins/ directory
Replace loadDefaultDemoPlugin with loadPluginsFromDir that scans the
plugins/ directory for .lua files and loads them all. All plugins are
disabled by default; user enables them via .plugin enable or TUI panel.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 02:07:26 +08:00
JiXieShi 76cd507236 test: restore and adapt test files for new package structure
- Rewrite internal/app/app_test.go for new App API (sess injection,
  command.NewDispatcher, appconfig.Config)
- Add internal/command/command_test.go (completion + parseOnOff tests)
- Console escape_test.go restored and adapted (cfg parameter)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 00:02:17 +08:00
JiXieShi 209ecac2d5 feat: enhance plugin system with Go helpers and add Modbus plugin
- Register Go helper functions (modbus.crc16, hex.encode/decode,
  util.bytes) into Lua states for Modbus RTU support
- Add plugins/modbus.lua with .modbus read/write commands
- Fix Reload race condition (hold lock across Unload+Load)
- Make App.Close nil-safe for sess
- Restore internal/console/console_test.go

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-24 00:01:22 +08:00
JiXieShi 30d6c2bc3c feat: add TCP Server, UDP Server, and COM port forwarding modes
Extend Mode constants (3=TCPServer, 4=UDPServer, 5=COMPort) with
explicit values. Refactor Target to support multiple connection types
(listener+conns map, packetConn, serialPort). Add acceptLoop,
readLoopPacket, readLoopSerial. Mode-aware Broadcast dispatches to
all accepted conns (TCP-S), known remotes (UDP-S), or serial port.
Update flag help, command completions, and TUI panel hints.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 23:10:02 +08:00
JiXieShi d8fc9d7374 refactor: split termapp into proper internal packages
Replace monolithic internal/termapp with proper separation:
- internal/app: App struct, lifecycle, output loops
- internal/command: CommandHost interface, Dispatcher, handlers
- internal/tui: Model, hotkeys, panels, render (with panelError + border fixes)
- internal/console: RunConsole, escape parsing, entry point logic
- cmd/serialterminal: thin main() calling console.Run()

Eliminate global vars (cfg, sess, out) via dependency injection.
Break App->CommandDispatcher cycle via CommandHost interface.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 22:46:02 +08:00
JiXieShi daad844d4f fix: TUI 'g' key input, EndStr panel editing, and mode validation
- Remove 'g' and 'shift+g' from viewport handler (conflicted with
  text input; home/end keys already provide same functionality)
- Add rawValue field to modeItem to preserve EndStr control chars
  during TUI panel editing (fixes %q round-trip corruption)
- Add validation for empty charset names and timefmt fields

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 22:25:47 +08:00
JiXieShi 84cda89d1d docs: update README (bilingual) and CLAUDE.md for new structure
Rewrite README.md in Chinese and English with flag tables, command
reference, plugin API, and architecture diagram. Update CLAUDE.md
to reflect the new package layout and build commands.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 21:58:16 +08:00
JiXieShi 8139162174 refactor: move all app code to internal/termapp and entry to cmd/
Consolidate remaining package main files into internal/termapp for
clean separation: cmd/serialterminal/ is the sole entry point.
Update .goreleaser.yaml to build from ./cmd/serialterminal.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 21:56:45 +08:00
JiXieShi 65c1a48f10 refactor: simplify flag system and extract to internal/flag
Replace complex ptrVal/Val/Flag type machinery with direct pflag
calls. Move flag logic and interactive wizard to internal/flag
package. Eliminate ~200 lines of flag boilerplate.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 21:52:40 +08:00
JiXieShi a1524a7e17 refactor: extract internal/session and eliminate I/O globals
Move serial port, trzsz filter, and pipe lifecycle into
internal/session.SerialSession. Replace 8 global I/O vars
(serialPort, trzszFilter, stdinPipe, stdoutPipe, clientIn,
clientOut, termch, termchOnce) with single sess variable.
Delete utils.go.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 21:49:43 +08:00
JiXieShi 31dd9da490 refactor: extract internal/config and eliminate global config var
Move Config struct to internal/config with exported fields. Replace
global var config with package-level cfg pointer. Add OpenLogFile to
config package. Add type alias Config = appconfig.Config in main
package for backward compatibility.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 21:45:08 +08:00
JiXieShi 2ce672cdde refactor: extract pkg/forward and pkg/luaplugin packages
Move ForwardManager → pkg/forward/Manager and PluginManager →
pkg/luaplugin/Manager. Move FoeWardMode (now forward.Mode) with
ParseMode/Network/String into pkg/forward. Rename constants:
NOT→None, TCPC→TCP, UDPC→UDP. Update all references in main
package.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-23 19:41:45 +08:00
JiXieShi e0de872740 refactor: extract pkg/charset and internal/event packages
Extract ConvertChunk/FormatHexFrame into pkg/charset (zero external deps).
Extract UIEvent/UIEventKind/UIPanelKind types into internal/event.
Update all references across main package to use qualified imports.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 02:35:30 +08:00
JiXieShi d434d961ee refactor: rename module and create directory scaffold
Rename module from COM to github.com/jixishi/SerialTerminalForWindowsTerminal.
Create target directory tree: cmd/serialterminal/, internal/{app,command,config,
console,event,flag,session,tui}, pkg/{charset,forward,luaplugin}.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 02:26:06 +08:00
JiXieShi 2ffb86cc17 chore: remove dead code and binary files from tracking
Remove unused global var `in`, func `strout`, func `echoConsoleInput`,
func `padRight`, func `ErrorP`, and func `ErrorF`. Inline error check
in CloseSerial. Add COM.exe and coverage.out to .gitignore.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 02:25:23 +08:00
jixishi f6eff2da22 Fix img名称错误 2024-06-12 14:46:29 +08:00
jixishi 2fc4b4f41a UP 多服同步 2024-06-12 14:43:43 +08:00
jixishi c841dfeae4 UP 功能建议更新 v0.9.5 2024-06-03 20:54:23 +08:00
jixishi 88285df82b UP README.md 2024-05-30 16:43:21 +08:00
jixishi 67e2f5a1c8 UP README.md 2024-05-30 16:35:29 +08:00
jixishi 17950c05dc UP releaser v0.9.4 2024-05-30 16:23:53 +08:00
jixishi 9b374fc42d Merge branch 'dev' 2024-05-30 16:04:55 +08:00
jixishi 82ec65958e 时间戳 文件传输 支持 2024-05-30 15:56:52 +08:00
jixishi 68f285b5ed up v0.9.3 2024-04-26 22:33:08 +08:00
jixishi d2f8c8a268 增加Ctrl组合键发送指令.ctrl 如.ctrl c 2024-04-26 22:29:16 +08:00
jixishi 8d4273df77 增加交互式配置支持 2024-04-26 22:29:00 +08:00
jixishi 92c92e67e1 增加交互式配置支持 2024-04-26 22:23:32 +08:00
jixishi 604e5bb4ad 修复帧指定的错误参数指向 v0.9.2 2024-04-26 12:49:32 +08:00
jixishi e3415ae05a 去除TCP服务端连接 2024-04-26 11:55:26 +08:00
jixishi d19c09e4cd TCP|UDP 客户端数据转发支持更新 帧长设置支持 2024-04-26 11:03:44 +08:00
jixishi 5bf90d1b63 TCP|UDP 客户端数据转发支持更新 2024-04-19 22:42:28 +08:00
jixishi dffb269247 RT 2024-04-19 17:03:28 +08:00
JiXieShi d450a8a019 多平台构建 v0.9.1 2024-04-19 16:18:03 +08:00
JiXieShi 8b1e5bfb06 多平台构建 v0.9 2024-04-19 16:15:28 +08:00
JiXieShi 437f309ab9 多平台构建 2024-04-19 16:08:55 +08:00
JiXieShi 1ca7e23911 优化项目结构,添加hex与原文的对照显示 v0.8 2024-04-19 15:10:16 +08:00
JiXieShi a4004a1d05 优化项目结构 2024-04-19 15:08:00 +08:00
JiXieShi 0f2fe50b04 修复终端指令卡住的问题 2024-04-13 15:27:31 +08:00
JiXieShi 03b3cf3793 Up README.md 2024-04-13 15:07:00 +08:00
JiXieShi e22b534205 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	main.go
v0.7
2024-04-13 14:50:12 +08:00
JiXieShi 231560ae8e 增加hex收发功能 2024-04-13 14:49:25 +08:00
JiXieShi 61ad821ecc 增加hex收发功能 2024-04-13 14:44:48 +08:00
JiXieShi d6458dd31d Init 2024-04-12 22:30:55 +08:00
JiXieShi 5bd9108a96 Init 2024-04-12 22:30:09 +08:00
JiXieShi dcf66b6895 Init 2024-04-12 22:29:17 +08:00
JiXieShi 5d4558582a Init 2024-04-12 22:14:52 +08:00