Skip to content

feat: custom shell prompt pattern and auto-reply (#20)#21

Open
bvisible wants to merge 1 commit intomainfrom
feat/shell-prompt-config
Open

feat: custom shell prompt pattern and auto-reply (#20)#21
bvisible wants to merge 1 commit intomainfrom
feat/shell-prompt-config

Conversation

@bvisible
Copy link
Copy Markdown
Owner

@bvisible bvisible commented Apr 7, 2026

Summary

Adds two new per-server configuration options to support non-standard shells (e.g., AIX with interactive login prompts):

  • prompt_pattern: Custom shell prompt regex pattern (default: [$#>])
  • auto_reply: Auto-respond to interactive login prompts before the shell is ready

Fixes #20

Configuration

Custom prompt pattern

TOML:

[ssh_servers.aix_server]
host = "aix.example.com"
user = "researcher"
prompt_pattern = "-->"

.env:

SSH_SERVER_AIX_PROMPT_PATTERN=-->

Auto-reply on login

TOML:

[ssh_servers.aix_server]
host = "aix.example.com"
user = "researcher"
prompt_pattern = "-->"

[[ssh_servers.aix_server.auto_reply]]
pattern = "START GLOBUS Y/N"
response = "N"
timeout = 5000

.env:

SSH_SERVER_AIX_AUTO_REPLY_COUNT=1
SSH_SERVER_AIX_AUTO_REPLY_1_PATTERN=START GLOBUS Y/N
SSH_SERVER_AIX_AUTO_REPLY_1_RESPONSE=N
SSH_SERVER_AIX_AUTO_REPLY_1_TIMEOUT=5000

Changes

  • src/session-manager.js: Configurable promptPattern on SSHSession, auto-reply loop during shell initialization
  • src/config-loader.js: Parse prompt_pattern and auto_reply from both TOML and .env formats
  • src/index.js: Pass server config options to createSession()

Test plan

  • Default behavior unchanged (no prompt_pattern → matches $, #, >)
  • Custom prompt pattern --> detected correctly
  • Auto-reply sends response when pattern matched during login
  • Timeout works when pattern is never matched
  • TOML and .env config formats both work

- Add per-server prompt_pattern config to match non-standard shell prompts (e.g., "-->")
- Add auto_reply config for interactive login prompts (e.g., "START GLOBUS Y/N" → "N")
- Session initialization loops through auto-reply rules before waiting for shell prompt
- Both .env and TOML configuration formats supported
- Default prompt pattern ($ # >) preserved for backward compatibility
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.

Shell prompt configuration

1 participant