mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-09-30 12:39:42 +02:00
docs: add Screen Input for Ink/Claude CLI pattern
Document the critical finding that text and Enter key must be sent as separate screen -X stuff commands for Ink to process correctly. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -125,6 +125,22 @@ pty.spawn('claude', ['-p', '--dangerously-skip-permissions', '--output-format',
|
||||
pty.spawn('claude', ['--dangerously-skip-permissions'], { ... })
|
||||
```
|
||||
|
||||
### Screen Input for Ink/Claude CLI
|
||||
|
||||
Claude CLI uses Ink (React for terminals) which has specific input handling. When sending programmatic input via `screen -X stuff`:
|
||||
|
||||
**IMPORTANT**: Text and Enter key MUST be sent as separate commands:
|
||||
```bash
|
||||
# Correct - two separate commands
|
||||
screen -S claudeman-xxx -p 0 -X stuff "hello world"
|
||||
screen -S claudeman-xxx -p 0 -X stuff "$(printf '\015')"
|
||||
|
||||
# Wrong - doesn't work with Ink
|
||||
screen -S claudeman-xxx -p 0 -X stuff "$(printf 'hello world\015')"
|
||||
```
|
||||
|
||||
The `\015` (octal) is carriage return (ASCII 13), which Ink interprets as `key.return` for submission. Use `writeViaScreen()` method for programmatic input that needs Enter key.
|
||||
|
||||
### Idle Detection
|
||||
|
||||
**RespawnController**: Primary `↵ send` indicator, fallback prompt chars (`❯`, `⏵`) + 10s timeout. Working patterns: `Thinking`, `Writing`, `Running`.
|
||||
|
||||
Reference in New Issue
Block a user