Skip to content

feat: make registered commands shell-native - #86

Merged
M09Ic merged 5 commits into
masterfrom
feat/command-bridge
Aug 8, 2026
Merged

feat: make registered commands shell-native#86
M09Ic merged 5 commits into
masterfrom
feat/command-bridge

Conversation

@M09Ic

@M09Ic M09Ic commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make registered in-memory commands automatically available inside real shell expressions
  • keep simple commands on the existing in-process tmux CreateFunc path; allocate the shell adapter lazily only for real shell execution
  • let the platform shell own &&, ||, pipes, redirects, command substitution, and nested-shell semantics
  • keep PTY/tmux as the sole owner of sessions, output capture, timeout, kill, and background monitoring
  • preserve the original Go context for commands invoked from shell expressions
  • dispatch private PATH shims inside pkg/commands, with no host main, CLI flag, or YAML configuration
  • cancel active calls and remove per-process runtime files on close; reclaim exited-process leftovers on startup

Runtime model

simple registered command -> existing tmux CreateFunc -> CommandRegistry
shell expression           -> existing PTY/tmux -> real shell -> private PATH shim -> CommandRegistry

The local adapter only carries one command invocation's stdin/stdout/stderr, context identity, and exit status. It does not parse shell syntax or own a second session lifecycle.

Safety

  • no global PATH changes
  • no registry, shell profile, service, or firewall changes
  • adapter variables and PATH entries exist only in the child shell environment
  • Unix runtime/socket permissions are owner-only
  • Windows named pipes are restricted to the current user
  • no runtime directory is created until a real shell path is used

Validation

Windows:

  • go test ./pkg/commands ./pkg/runner ./core/config ./cmd/aiscan -count=1
  • go test -race ./pkg/commands -run 'TestShellCommand|TestCoreFactory' -count=1

WSL2 Ubuntu:

  • GOTOOLCHAIN=go1.26.1 GOPROXY=https://goproxy.cn,direct go test ./pkg/commands ./pkg/runner ./core/config ./cmd/aiscan
  • GOTOOLCHAIN=go1.26.1 GOPROXY=https://goproxy.cn,direct go test -race ./pkg/commands -run 'TestShellCommand|TestCoreFactory' -count=1

@M09Ic M09Ic changed the title feat: add optional shell command bridge feat: make registered commands shell-native Aug 7, 2026
@M09Ic
M09Ic merged commit 4f4bb2f into master Aug 8, 2026
41 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant