@adiontaegerron/claude-multi-terminal 2.5.2 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/at.md +232 -0
- package/.claude/commands/clear.md +169 -0
- package/.claude/commands/close.md +105 -0
- package/.claude/commands/create.md +83 -0
- package/.claude/commands/help.md +85 -0
- package/.claude/commands/interrupt.md +211 -0
- package/.claude/commands/list.md +69 -0
- package/.claude/commands/new-terminal.md +36 -0
- package/.claude/commands/return.md +127 -0
- package/.claude/commands/send-all.md +58 -0
- package/.claude/commands/send-message.md +57 -0
- package/.claude/commands/send.md +48 -0
- package/.claude/settings.local.json +7 -44
- package/bin/auto-submit.sh +36 -0
- package/bin/close-terminal.sh +35 -0
- package/bin/create-terminal.sh +30 -0
- package/bin/demo-communication.sh +62 -0
- package/bin/demo-ipc-bridge.sh +97 -0
- package/bin/list-terminals.sh +42 -0
- package/bin/send-chat-message.sh +17 -0
- package/bin/send-command.sh +42 -0
- package/bin/send-to-terminal.sh +41 -0
- package/bin/setup-agent.sh +40 -0
- package/bin/test-chat-debug.sh +26 -0
- package/bin/test-chat-fix.sh +53 -0
- package/bin/test-chat.sh +39 -0
- package/bin/test-duplicate-fix.sh +29 -0
- package/bin/test-fixed-chat.sh +46 -0
- package/bin/test-forwarding.sh +55 -0
- package/bin/test-ipc-bridge.sh +99 -0
- package/index.html +1 -0
- package/main.js +808 -34
- package/package.json +1 -1
- package/renderer.js +462 -46
- package/style.css +150 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# Direct Terminal Messaging with @ Syntax
|
|
2
|
+
|
|
3
|
+
You are helping a user send commands directly to terminals using the @ messaging syntax.
|
|
4
|
+
|
|
5
|
+
## Current Application Context
|
|
6
|
+
|
|
7
|
+
The user has a multi-terminal application with advanced @ syntax for direct terminal communication:
|
|
8
|
+
- `@terminal command` - Send command directly to named terminal
|
|
9
|
+
- `@all command` - Send to all terminals
|
|
10
|
+
- `@term1,term2 command` - Send to multiple terminals (comma-separated)
|
|
11
|
+
- `@term1 @term2 command` - Send to multiple terminals (space-separated)
|
|
12
|
+
- `@"Terminal Name" command` - Handle terminals with spaces in names
|
|
13
|
+
|
|
14
|
+
## Your Task
|
|
15
|
+
|
|
16
|
+
Help the user communicate directly with terminals using the flexible @ messaging syntax.
|
|
17
|
+
|
|
18
|
+
### Basic Usage Patterns
|
|
19
|
+
```
|
|
20
|
+
@terminal command
|
|
21
|
+
@"Terminal Name" command
|
|
22
|
+
@all command
|
|
23
|
+
@term1,term2,term3 command
|
|
24
|
+
@term1 @term2 command
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Available Functions
|
|
28
|
+
|
|
29
|
+
Key functions used:
|
|
30
|
+
- `parseComplexCommand(message)` - Parses mixed @ and / syntax (renderer.js:346)
|
|
31
|
+
- `executeAtCommand(message)` - Handles @ terminal messaging (renderer.js:792)
|
|
32
|
+
- `findTerminal(identifier)` - Locates terminals by various methods
|
|
33
|
+
- Auto-return functionality after 150ms delay
|
|
34
|
+
|
|
35
|
+
## Syntax Variations
|
|
36
|
+
|
|
37
|
+
### Single Terminal
|
|
38
|
+
```
|
|
39
|
+
@Terminal1 ls -la
|
|
40
|
+
@"My Server" systemctl status nginx
|
|
41
|
+
@database show tables;
|
|
42
|
+
@1 pwd # By position number
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Multiple Terminals (Comma-separated)
|
|
46
|
+
```
|
|
47
|
+
@server1,server2,server3 uptime
|
|
48
|
+
@"Web Server","Database Server" df -h
|
|
49
|
+
@term1,term2 git status
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Multiple Terminals (Space-separated)
|
|
53
|
+
```
|
|
54
|
+
@server1 @server2 @server3 whoami
|
|
55
|
+
@"Production" @"Staging" docker ps
|
|
56
|
+
@frontend @backend npm test
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### All Terminals
|
|
60
|
+
```
|
|
61
|
+
@all pwd
|
|
62
|
+
@all clear
|
|
63
|
+
@all git pull
|
|
64
|
+
@all "echo 'Hello from all terminals'"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Advanced Features
|
|
68
|
+
|
|
69
|
+
### Mixed Command Parsing
|
|
70
|
+
The system supports complex commands mixing @ terminals and / commands:
|
|
71
|
+
```
|
|
72
|
+
@server1 ls /var/log @server2 ps aux /list
|
|
73
|
+
@all pwd /send database "show tables;"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Quoted Terminal Names
|
|
77
|
+
Handle terminals with spaces or special characters:
|
|
78
|
+
```
|
|
79
|
+
@"My Production Server" systemctl restart nginx
|
|
80
|
+
@"Database - Primary" mysql -u root -p
|
|
81
|
+
@"Frontend Dev Environment" npm run dev
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Terminal Identification Methods
|
|
85
|
+
1. **Exact name match** (case-insensitive)
|
|
86
|
+
2. **Partial name match**
|
|
87
|
+
3. **Position number** (1-based)
|
|
88
|
+
4. **Terminal ID** (internal identifier)
|
|
89
|
+
|
|
90
|
+
## Auto-execution Features
|
|
91
|
+
|
|
92
|
+
**Automatic return:**
|
|
93
|
+
- Commands are automatically submitted after 150ms
|
|
94
|
+
- No need for manual `/return` command
|
|
95
|
+
- Seamless command execution experience
|
|
96
|
+
|
|
97
|
+
**Plan mode integration:**
|
|
98
|
+
- Respects "Send in Plan Mode" checkbox
|
|
99
|
+
- Sends Shift+Tab twice if plan mode enabled
|
|
100
|
+
- Auto-returns after plan mode activation
|
|
101
|
+
|
|
102
|
+
**Default prompt integration:**
|
|
103
|
+
- Respects "Use Default Prompt" setting
|
|
104
|
+
- Prepends default prompt to non-slash commands
|
|
105
|
+
- Configurable prompt text
|
|
106
|
+
|
|
107
|
+
## Error Handling
|
|
108
|
+
|
|
109
|
+
**Terminal not found:**
|
|
110
|
+
- Shows specific terminals that weren't found
|
|
111
|
+
- Lists available terminals for reference
|
|
112
|
+
- Continues with found terminals if some succeed
|
|
113
|
+
- Clear error messages for troubleshooting
|
|
114
|
+
|
|
115
|
+
**Invalid syntax:**
|
|
116
|
+
- Provides usage examples
|
|
117
|
+
- Suggests correct @ syntax patterns
|
|
118
|
+
- Explains terminal identification methods
|
|
119
|
+
|
|
120
|
+
## Use Cases
|
|
121
|
+
|
|
122
|
+
### Development Workflows
|
|
123
|
+
```
|
|
124
|
+
@frontend npm run build
|
|
125
|
+
@backend npm test
|
|
126
|
+
@database npm run migrate
|
|
127
|
+
@all git status
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Server Management
|
|
131
|
+
```
|
|
132
|
+
@"Production Server" systemctl status nginx
|
|
133
|
+
@"Staging Server" docker ps
|
|
134
|
+
@all df -h
|
|
135
|
+
@monitoring top
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Multi-environment Operations
|
|
139
|
+
```
|
|
140
|
+
@prod,staging,dev docker pull latest
|
|
141
|
+
@"Web1" @"Web2" @"Web3" nginx -t
|
|
142
|
+
@all "echo $NODE_ENV"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Quick Diagnostics
|
|
146
|
+
```
|
|
147
|
+
@all uptime
|
|
148
|
+
@all "ps aux | grep node"
|
|
149
|
+
@servers1,server2 "netstat -tulpn | grep :80"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Integration with Other Features
|
|
153
|
+
|
|
154
|
+
**With slash commands:**
|
|
155
|
+
```
|
|
156
|
+
@server1 ls /send server2 pwd
|
|
157
|
+
/list @all whoami
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**With messaging panel:**
|
|
161
|
+
- @ commands appear in message history
|
|
162
|
+
- Tracked for coordination purposes
|
|
163
|
+
- Visible in inter-terminal communication log
|
|
164
|
+
|
|
165
|
+
**With quick messages:**
|
|
166
|
+
- Message panel can use @ syntax
|
|
167
|
+
- Dropdown integration for terminal selection
|
|
168
|
+
- History tracking for sent messages
|
|
169
|
+
|
|
170
|
+
## Performance Considerations
|
|
171
|
+
|
|
172
|
+
**Parallel execution:**
|
|
173
|
+
- Multiple terminals receive commands simultaneously
|
|
174
|
+
- No blocking between terminal communications
|
|
175
|
+
- Efficient for batch operations
|
|
176
|
+
|
|
177
|
+
**Auto-return timing:**
|
|
178
|
+
- 150ms delay allows command to be typed fully
|
|
179
|
+
- Automatic submission reduces manual steps
|
|
180
|
+
- Can be overridden with manual `/return` if needed
|
|
181
|
+
|
|
182
|
+
## Best Practices
|
|
183
|
+
|
|
184
|
+
### Terminal Naming
|
|
185
|
+
- Use descriptive names for easy identification
|
|
186
|
+
- Avoid special characters that complicate parsing
|
|
187
|
+
- Consider consistent naming conventions
|
|
188
|
+
- Rename terminals for better workflow organization
|
|
189
|
+
|
|
190
|
+
### Command Safety
|
|
191
|
+
```
|
|
192
|
+
# Good - Clear target and safe command
|
|
193
|
+
@database "SELECT COUNT(*) FROM users;"
|
|
194
|
+
|
|
195
|
+
# Careful - Destructive command, verify target
|
|
196
|
+
@production "rm -rf /tmp/cache"
|
|
197
|
+
|
|
198
|
+
# Best - Use /list first to verify terminals
|
|
199
|
+
/list
|
|
200
|
+
@"Verified Production" systemctl restart nginx
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### Multi-terminal Operations
|
|
204
|
+
```
|
|
205
|
+
# Coordinated deployment
|
|
206
|
+
@all git pull
|
|
207
|
+
@backend npm install
|
|
208
|
+
@frontend npm run build
|
|
209
|
+
@all pm2 restart all
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Troubleshooting
|
|
213
|
+
|
|
214
|
+
**Terminal not responding:**
|
|
215
|
+
1. Use `/list` to verify terminal exists
|
|
216
|
+
2. Check terminal name spelling
|
|
217
|
+
3. Try position number instead of name
|
|
218
|
+
4. Use `/interrupt terminal` if hung
|
|
219
|
+
|
|
220
|
+
**Commands not executing:**
|
|
221
|
+
1. Verify @ syntax is correct
|
|
222
|
+
2. Check for typos in terminal names
|
|
223
|
+
3. Ensure commands are properly quoted
|
|
224
|
+
4. Use `/return terminal` for manual execution
|
|
225
|
+
|
|
226
|
+
**Partial execution:**
|
|
227
|
+
1. Check which terminals succeeded
|
|
228
|
+
2. Retry failed terminals individually
|
|
229
|
+
3. Verify terminal states with `/list`
|
|
230
|
+
4. Clear problematic terminals with `/clear`
|
|
231
|
+
|
|
232
|
+
Focus on helping the user master the flexible @ syntax for efficient multi-terminal communication and command execution.
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# Clear Terminal Input Line
|
|
2
|
+
|
|
3
|
+
You are helping a user clear the current input line in a specific terminal (equivalent to pressing Ctrl+C).
|
|
4
|
+
|
|
5
|
+
## Current Application Context
|
|
6
|
+
|
|
7
|
+
The user has a multi-terminal application where:
|
|
8
|
+
- Terminals may have partially typed commands that need to be cleared
|
|
9
|
+
- The `/clear <terminal>` command sends Ctrl+C to clear input
|
|
10
|
+
- This interrupts current input without executing it
|
|
11
|
+
- Also used for interrupting running commands
|
|
12
|
+
|
|
13
|
+
## Your Task
|
|
14
|
+
|
|
15
|
+
Help the user clear current input or interrupt commands in a specific terminal using the `/clear` slash command.
|
|
16
|
+
|
|
17
|
+
### Usage Pattern
|
|
18
|
+
```
|
|
19
|
+
/clear <terminal>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Terminal Identification
|
|
23
|
+
Terminals can be identified by:
|
|
24
|
+
1. **Exact name**: `Terminal 1`, `MyServer`, etc.
|
|
25
|
+
2. **Position number**: `1`, `2`, `3` (1-based)
|
|
26
|
+
3. **Partial name match**: `server` matches "MyServer"
|
|
27
|
+
4. **Terminal ID**: `terminal-1`, `terminal-2`, etc.
|
|
28
|
+
|
|
29
|
+
### Examples
|
|
30
|
+
- `/clear Terminal1` - Clear input in Terminal1
|
|
31
|
+
- `/clear 1` - Clear input in first terminal
|
|
32
|
+
- `/clear "My Server"` - Clear in terminal with spaces in name
|
|
33
|
+
- `/clear server` - Clear in terminal containing "server"
|
|
34
|
+
- `/clear Database` - Clear current database command
|
|
35
|
+
|
|
36
|
+
## Available Functions
|
|
37
|
+
|
|
38
|
+
Key functions used:
|
|
39
|
+
- `executeClearCommand(args)` - Processes clear command (renderer.js:770)
|
|
40
|
+
- `findTerminal(identifier)` - Locates target terminal
|
|
41
|
+
- `ipcRenderer.invoke('terminal:write', terminalId, '\x03')` - Sends Ctrl+C
|
|
42
|
+
- Same function handles `/interrupt` command
|
|
43
|
+
|
|
44
|
+
## Technical Details
|
|
45
|
+
|
|
46
|
+
**What happens:**
|
|
47
|
+
1. **Find target terminal** - Using findTerminal() function
|
|
48
|
+
2. **Send Ctrl+C signal** - `\x03` control character
|
|
49
|
+
3. **Clear current line** - Cancels current input
|
|
50
|
+
4. **Interrupt execution** - Stops running commands
|
|
51
|
+
5. **Provide feedback** - Confirm Ctrl+C sent
|
|
52
|
+
|
|
53
|
+
**Ctrl+C character:**
|
|
54
|
+
- `\x03` is the ASCII control character for Ctrl+C
|
|
55
|
+
- Standard interrupt signal in Unix-like systems
|
|
56
|
+
- Clears current input line if no command running
|
|
57
|
+
- Interrupts/terminates running commands
|
|
58
|
+
- Returns to fresh command prompt
|
|
59
|
+
|
|
60
|
+
## Use Cases
|
|
61
|
+
|
|
62
|
+
**Input Management:**
|
|
63
|
+
- Clear partially typed commands
|
|
64
|
+
- Cancel commands before execution
|
|
65
|
+
- Start over with fresh command line
|
|
66
|
+
- Remove unwanted input
|
|
67
|
+
|
|
68
|
+
**Command Interruption:**
|
|
69
|
+
- Stop long-running commands
|
|
70
|
+
- Cancel infinite loops or hangs
|
|
71
|
+
- Interrupt interactive programs
|
|
72
|
+
- Emergency stop for runaway processes
|
|
73
|
+
|
|
74
|
+
**Workflow Control:**
|
|
75
|
+
- Reset terminal state
|
|
76
|
+
- Clear before sending new commands
|
|
77
|
+
- Ensure clean command environment
|
|
78
|
+
- Standardize terminal state
|
|
79
|
+
|
|
80
|
+
**Debug and Recovery:**
|
|
81
|
+
- Escape from problematic commands
|
|
82
|
+
- Reset terminals that seem "stuck"
|
|
83
|
+
- Clear garbled or corrupted input
|
|
84
|
+
- Recover from terminal errors
|
|
85
|
+
|
|
86
|
+
## Command Behavior
|
|
87
|
+
|
|
88
|
+
**When no command is running:**
|
|
89
|
+
- Clears current input line
|
|
90
|
+
- Returns to fresh prompt
|
|
91
|
+
- Discards any typed text
|
|
92
|
+
- Ready for new input
|
|
93
|
+
|
|
94
|
+
**When command is running:**
|
|
95
|
+
- Sends interrupt signal to process
|
|
96
|
+
- May terminate the running command
|
|
97
|
+
- Some commands may ignore Ctrl+C
|
|
98
|
+
- Returns control to shell
|
|
99
|
+
|
|
100
|
+
**Interactive programs:**
|
|
101
|
+
- May exit the program
|
|
102
|
+
- May return to program's main menu
|
|
103
|
+
- Behavior depends on the specific program
|
|
104
|
+
- Generally provides escape mechanism
|
|
105
|
+
|
|
106
|
+
## Error Handling
|
|
107
|
+
|
|
108
|
+
If terminal is not found:
|
|
109
|
+
- Shows "Terminal 'name' not found"
|
|
110
|
+
- Lists available terminals for reference
|
|
111
|
+
- Suggests correct terminal identifiers
|
|
112
|
+
- No action taken on non-existent terminals
|
|
113
|
+
|
|
114
|
+
## Alternative Command
|
|
115
|
+
|
|
116
|
+
**`/interrupt` command:**
|
|
117
|
+
- Identical functionality to `/clear`
|
|
118
|
+
- Same implementation in code
|
|
119
|
+
- Alternative name for clarity
|
|
120
|
+
- Use whichever feels more natural
|
|
121
|
+
|
|
122
|
+
## Safety Considerations
|
|
123
|
+
|
|
124
|
+
- **Data loss** - May lose unsaved work in interrupted commands
|
|
125
|
+
- **Process state** - Running commands may be terminated abruptly
|
|
126
|
+
- **File operations** - Interrupted file operations may leave partial results
|
|
127
|
+
- **Confirmation** - Consider if the interruption is really needed
|
|
128
|
+
|
|
129
|
+
## Integration Patterns
|
|
130
|
+
|
|
131
|
+
**Before sending commands:**
|
|
132
|
+
```
|
|
133
|
+
/clear Terminal1
|
|
134
|
+
@Terminal1 new-command
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Emergency stop:**
|
|
138
|
+
```
|
|
139
|
+
/clear all-terminals # If available
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**Workflow reset:**
|
|
143
|
+
```
|
|
144
|
+
/clear Database
|
|
145
|
+
/send Database "show tables;"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Related Commands
|
|
149
|
+
|
|
150
|
+
- `/interrupt <terminal>` - Identical to `/clear`
|
|
151
|
+
- `/return <terminal>` - Submit current input instead of clearing
|
|
152
|
+
- `/send <terminal> <command>` - Send new command (may want to clear first)
|
|
153
|
+
- `@terminal <command>` - Direct messaging (automatically handles input)
|
|
154
|
+
|
|
155
|
+
## Best Practices
|
|
156
|
+
|
|
157
|
+
**When to use:**
|
|
158
|
+
- Before sending important commands
|
|
159
|
+
- When terminal seems unresponsive
|
|
160
|
+
- To stop long-running operations
|
|
161
|
+
- When input line is corrupted
|
|
162
|
+
|
|
163
|
+
**When to avoid:**
|
|
164
|
+
- During critical file operations
|
|
165
|
+
- When unsure about command state
|
|
166
|
+
- If losing work would be problematic
|
|
167
|
+
- For commands that handle interrupts poorly
|
|
168
|
+
|
|
169
|
+
Focus on helping the user safely manage terminal input and interrupt problematic commands when necessary.
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Close Specific Terminal
|
|
2
|
+
|
|
3
|
+
You are helping a user close a specific terminal in their multi-terminal desktop application.
|
|
4
|
+
|
|
5
|
+
## Current Application Context
|
|
6
|
+
|
|
7
|
+
The user has a multi-terminal application where:
|
|
8
|
+
- Multiple terminals can be active simultaneously
|
|
9
|
+
- Each terminal can be closed individually
|
|
10
|
+
- Terminal processes are properly cleaned up when closed
|
|
11
|
+
- The `/close <terminal>` command removes specific terminals
|
|
12
|
+
|
|
13
|
+
## Your Task
|
|
14
|
+
|
|
15
|
+
Help the user close a specific terminal using the `/close` slash command.
|
|
16
|
+
|
|
17
|
+
### Usage Pattern
|
|
18
|
+
```
|
|
19
|
+
/close <terminal>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Terminal Identification
|
|
23
|
+
Terminals can be identified by:
|
|
24
|
+
1. **Exact name**: `Terminal 1`, `MyServer`, etc.
|
|
25
|
+
2. **Position number**: `1`, `2`, `3` (1-based)
|
|
26
|
+
3. **Partial name match**: `server` matches "MyServer"
|
|
27
|
+
4. **Terminal ID**: `terminal-1`, `terminal-2`, etc.
|
|
28
|
+
|
|
29
|
+
### Examples
|
|
30
|
+
- `/close Terminal1` - Close terminal named "Terminal1"
|
|
31
|
+
- `/close 1` - Close the first terminal (by position)
|
|
32
|
+
- `/close "My Server"` - Close terminal with spaces in name
|
|
33
|
+
- `/close server` - Close terminal containing "server" in name
|
|
34
|
+
- `/close MyDatabase` - Close specific database terminal
|
|
35
|
+
|
|
36
|
+
## Available Functions
|
|
37
|
+
|
|
38
|
+
Key functions used:
|
|
39
|
+
- `executeCloseCommand(args)` - Processes the close command (renderer.js:727)
|
|
40
|
+
- `closeTerminal(terminalId)` - Actually closes the terminal (renderer.js:311)
|
|
41
|
+
- `findTerminal(identifier)` - Locates terminal by various methods
|
|
42
|
+
- Proper cleanup of xterm.js, pty process, and DOM elements
|
|
43
|
+
|
|
44
|
+
## Terminal Cleanup Process
|
|
45
|
+
|
|
46
|
+
1. **Find target terminal** - Using findTerminal() function
|
|
47
|
+
2. **Close pty process** - `ipcRenderer.invoke('terminal:close', terminalId)`
|
|
48
|
+
3. **Dispose xterm.js** - Clean up terminal rendering
|
|
49
|
+
4. **Remove DOM elements** - Remove terminal container from UI
|
|
50
|
+
5. **Update terminal map** - Remove from internal tracking
|
|
51
|
+
6. **Notify user** - Confirm successful closure
|
|
52
|
+
|
|
53
|
+
## Safety Features
|
|
54
|
+
|
|
55
|
+
- **Terminal validation** - Ensures terminal exists before closing
|
|
56
|
+
- **Graceful cleanup** - Properly terminates all processes
|
|
57
|
+
- **Error handling** - Shows available terminals if target not found
|
|
58
|
+
- **Process termination** - Kills associated pty processes
|
|
59
|
+
- **Memory cleanup** - Removes all references and listeners
|
|
60
|
+
|
|
61
|
+
## Use Cases
|
|
62
|
+
|
|
63
|
+
**Workflow Management:**
|
|
64
|
+
- `/close Testing` - Done with testing, clean up
|
|
65
|
+
- `/close 1` - Close first terminal by position
|
|
66
|
+
- `/close "Old Project"` - Remove outdated workspace
|
|
67
|
+
|
|
68
|
+
**Resource Management:**
|
|
69
|
+
- Close unused terminals to free resources
|
|
70
|
+
- Clean up completed tasks
|
|
71
|
+
- Organize active workspace
|
|
72
|
+
- Reduce visual clutter
|
|
73
|
+
|
|
74
|
+
**Project Switching:**
|
|
75
|
+
- `/close Frontend` - Switch from frontend work
|
|
76
|
+
- `/close Database` - Done with database tasks
|
|
77
|
+
- `/close Monitoring` - No longer need monitoring
|
|
78
|
+
|
|
79
|
+
## Error Handling
|
|
80
|
+
|
|
81
|
+
If terminal is not found:
|
|
82
|
+
- Shows "Terminal 'name' not found"
|
|
83
|
+
- Lists available terminals for reference
|
|
84
|
+
- Suggests correct terminal identifiers
|
|
85
|
+
- No action taken on non-existent terminals
|
|
86
|
+
|
|
87
|
+
## Alternative Closure Methods
|
|
88
|
+
|
|
89
|
+
- **UI close button** - Click × on terminal header
|
|
90
|
+
- **Application shutdown** - Closes all terminals automatically
|
|
91
|
+
- **Process exit** - Terminal closes when shell exits
|
|
92
|
+
|
|
93
|
+
## Integration with Other Commands
|
|
94
|
+
|
|
95
|
+
Before closing:
|
|
96
|
+
- Use `/list` to see available terminals
|
|
97
|
+
- Verify terminal name/ID is correct
|
|
98
|
+
- Save any important work in the terminal
|
|
99
|
+
|
|
100
|
+
After closing:
|
|
101
|
+
- Use `/list` to confirm terminal is removed
|
|
102
|
+
- Create new terminal with `/create` if needed
|
|
103
|
+
- Reorganize remaining terminals as needed
|
|
104
|
+
|
|
105
|
+
Focus on helping the user safely and efficiently manage their terminal workspace by closing terminals they no longer need.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Create New Terminal
|
|
2
|
+
|
|
3
|
+
You are helping a user create a new terminal instance in their multi-terminal desktop application.
|
|
4
|
+
|
|
5
|
+
## Current Application Context
|
|
6
|
+
|
|
7
|
+
The user has a multi-terminal application where:
|
|
8
|
+
- New terminals can be created with optional custom names
|
|
9
|
+
- Each terminal automatically starts with Claude Code
|
|
10
|
+
- Terminals are managed by the `createTerminal()` function
|
|
11
|
+
- Users can rename terminals later by double-clicking the title
|
|
12
|
+
|
|
13
|
+
## Your Task
|
|
14
|
+
|
|
15
|
+
Help the user create a new terminal using the `/create` slash command.
|
|
16
|
+
|
|
17
|
+
### Usage Pattern
|
|
18
|
+
```
|
|
19
|
+
/create [name]
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Examples
|
|
23
|
+
- `/create` - Create terminal with auto-generated name ("Terminal N")
|
|
24
|
+
- `/create MyServer` - Create terminal named "MyServer"
|
|
25
|
+
- `/create "Development Environment"` - Create with quoted name containing spaces
|
|
26
|
+
- `/create API-Server` - Create terminal for API development
|
|
27
|
+
- `/create Database` - Create terminal for database operations
|
|
28
|
+
|
|
29
|
+
## Available Functions
|
|
30
|
+
|
|
31
|
+
Key functions used:
|
|
32
|
+
- `executeCreateCommand(args)` - Processes the create command (renderer.js:721)
|
|
33
|
+
- `createTerminal(customName)` - Actually creates the terminal (renderer.js:149)
|
|
34
|
+
- Auto-generates unique terminal ID (`terminal-N`)
|
|
35
|
+
- Sets up xterm.js interface and node-pty backend
|
|
36
|
+
|
|
37
|
+
## Terminal Creation Process
|
|
38
|
+
|
|
39
|
+
1. **Generate unique ID** - `terminal-1`, `terminal-2`, etc.
|
|
40
|
+
2. **Set display name** - Custom name or "Terminal N"
|
|
41
|
+
3. **Create UI elements** - Header, xterm container, close button
|
|
42
|
+
4. **Initialize xterm.js** - Terminal rendering with themes
|
|
43
|
+
5. **Spawn pty process** - Backend shell process
|
|
44
|
+
6. **Auto-start Claude** - Sends `claude\r` command
|
|
45
|
+
7. **Set up event handlers** - Data flow, resize, focus
|
|
46
|
+
|
|
47
|
+
## Terminal Features
|
|
48
|
+
|
|
49
|
+
Each new terminal includes:
|
|
50
|
+
- **Xterm.js interface** - Full terminal emulation
|
|
51
|
+
- **Rename capability** - Double-click title to rename
|
|
52
|
+
- **Close button** - Individual terminal management
|
|
53
|
+
- **Auto-focus** - Ready for immediate use
|
|
54
|
+
- **Claude Code integration** - Starts with Claude automatically
|
|
55
|
+
- **Resize handling** - Responsive to window changes
|
|
56
|
+
|
|
57
|
+
## Use Cases
|
|
58
|
+
|
|
59
|
+
**Development Workflows:**
|
|
60
|
+
- `/create Frontend` - For React/Vue development
|
|
61
|
+
- `/create Backend` - For Node.js/Python services
|
|
62
|
+
- `/create Database` - For database operations
|
|
63
|
+
- `/create Testing` - For running tests
|
|
64
|
+
|
|
65
|
+
**Server Management:**
|
|
66
|
+
- `/create "Production Server"` - SSH to production
|
|
67
|
+
- `/create "Staging Environment"` - Development testing
|
|
68
|
+
- `/create Monitoring` - System monitoring tools
|
|
69
|
+
|
|
70
|
+
**Project Organization:**
|
|
71
|
+
- `/create "Project A"` - Separate project workspace
|
|
72
|
+
- `/create Documentation` - For docs and notes
|
|
73
|
+
- `/create Utilities` - For ad-hoc commands
|
|
74
|
+
|
|
75
|
+
## Integration with Other Commands
|
|
76
|
+
|
|
77
|
+
After creating a terminal:
|
|
78
|
+
- Use `/list` to see the new terminal
|
|
79
|
+
- Send commands with `@TerminalName command`
|
|
80
|
+
- Manage with `/close TerminalName`
|
|
81
|
+
- Control with `/return`, `/clear`, `/interrupt`
|
|
82
|
+
|
|
83
|
+
Focus on helping the user create well-organized terminals that support their specific workflow needs.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Show Available Commands
|
|
2
|
+
|
|
3
|
+
You are helping a user understand all available commands in their multi-terminal desktop application.
|
|
4
|
+
|
|
5
|
+
## Current Application Context
|
|
6
|
+
|
|
7
|
+
The user has a multi-terminal application with:
|
|
8
|
+
- Slash commands (`/command`) for system operations
|
|
9
|
+
- @ syntax (`@terminal`) for direct terminal messaging
|
|
10
|
+
- Various terminal management and communication features
|
|
11
|
+
|
|
12
|
+
## Your Task
|
|
13
|
+
|
|
14
|
+
Help the user understand all available commands and their usage patterns using the `/help` slash command.
|
|
15
|
+
|
|
16
|
+
### Usage Pattern
|
|
17
|
+
```
|
|
18
|
+
/help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Available Commands Overview
|
|
22
|
+
|
|
23
|
+
### Slash Commands
|
|
24
|
+
- `/send <terminal> <command>` - Send command to specific terminal
|
|
25
|
+
- `/send-all <command>` - Send command to all terminals
|
|
26
|
+
- `/list` - List all terminals
|
|
27
|
+
- `/help` - Show available commands
|
|
28
|
+
- `/create [name]` - Create new terminal with optional name
|
|
29
|
+
- `/close <terminal>` - Close specific terminal
|
|
30
|
+
- `/return <terminal>` - Submit current input in specified terminal (press Enter)
|
|
31
|
+
- `/clear <terminal>` - Clear current input line in specified terminal (Ctrl+C)
|
|
32
|
+
- `/interrupt <terminal>` - Interrupt current command in specified terminal (Ctrl+C)
|
|
33
|
+
|
|
34
|
+
### @ Terminal Messaging Syntax
|
|
35
|
+
- `@terminal <command>` - Send command directly to named terminal
|
|
36
|
+
- `@"Terminal Name" <command>` - Terminal with spaces in name
|
|
37
|
+
- `@term1,term2,term3 <command>` - Multiple terminals (comma-separated)
|
|
38
|
+
- `@term1 @term2 <command>` - Multiple terminals (space-separated)
|
|
39
|
+
- `@all <command>` - Send to all terminals
|
|
40
|
+
|
|
41
|
+
## Available Functions
|
|
42
|
+
|
|
43
|
+
Key functions used:
|
|
44
|
+
- `executeHelpCommand()` - Shows command help (renderer.js:711)
|
|
45
|
+
- Displays all available commands from `availableCommands` array
|
|
46
|
+
- Includes both slash commands and @ syntax examples
|
|
47
|
+
|
|
48
|
+
## Command Categories
|
|
49
|
+
|
|
50
|
+
**Terminal Management:**
|
|
51
|
+
- `/create [name]` - Create new terminals
|
|
52
|
+
- `/close <terminal>` - Remove terminals
|
|
53
|
+
- `/list` - View active terminals
|
|
54
|
+
|
|
55
|
+
**Command Execution:**
|
|
56
|
+
- `/send <terminal> <command>` - Targeted execution
|
|
57
|
+
- `/send-all <command>` - Broadcast execution
|
|
58
|
+
- `@terminal <command>` - Direct messaging
|
|
59
|
+
|
|
60
|
+
**Terminal Control:**
|
|
61
|
+
- `/return <terminal>` - Submit current input
|
|
62
|
+
- `/clear <terminal>` - Clear input line
|
|
63
|
+
- `/interrupt <terminal>` - Send Ctrl+C
|
|
64
|
+
|
|
65
|
+
**Information:**
|
|
66
|
+
- `/help` - Command reference
|
|
67
|
+
- `/list` - Terminal overview
|
|
68
|
+
|
|
69
|
+
## Usage Tips
|
|
70
|
+
|
|
71
|
+
**Terminal Identification:**
|
|
72
|
+
- Use terminal names, position numbers, or partial matches
|
|
73
|
+
- Quote names with spaces: `@"My Server"`
|
|
74
|
+
- Case-insensitive matching supported
|
|
75
|
+
|
|
76
|
+
**Multi-terminal Operations:**
|
|
77
|
+
- Comma-separated: `@term1,term2,term3 pwd`
|
|
78
|
+
- Space-separated: `@term1 @term2 @term3 pwd`
|
|
79
|
+
- All terminals: `@all pwd` or `/send-all pwd`
|
|
80
|
+
|
|
81
|
+
**Command Combinations:**
|
|
82
|
+
- `/list` → see terminals → `/send Terminal1 ls`
|
|
83
|
+
- `/create MyServer` → `@MyServer ssh user@server`
|
|
84
|
+
|
|
85
|
+
Focus on helping the user understand the full command system and choose the right approach for their workflow.
|