@shadr/iterm2-ts 0.1.0 → 0.1.2
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/README.md +25 -9
- package/dist/cli.cjs +1115 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +1108 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.cjs +26 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -3
- package/dist/index.js.map +1 -1
- package/package.json +10 -6
package/README.md
CHANGED
|
@@ -96,6 +96,22 @@ for await (const event of iterm.notifications("focusChanged")) {
|
|
|
96
96
|
}
|
|
97
97
|
```
|
|
98
98
|
|
|
99
|
+
### Available Events
|
|
100
|
+
|
|
101
|
+
- **keystroke** — key press/release in a session (characters, modifiers, key code)
|
|
102
|
+
- **screenUpdate** — screen contents changed in a session
|
|
103
|
+
- **prompt** — shell prompt appeared, command started, or command ended (with exit status)
|
|
104
|
+
- **customEscapeSequence** — app-defined escape sequence received (sender identity + payload)
|
|
105
|
+
- **newSession** — a new session was created
|
|
106
|
+
- **terminateSession** — a session was destroyed
|
|
107
|
+
- **layoutChanged** — window/tab/pane layout changed (splits, reorder, resize)
|
|
108
|
+
- **focusChanged** — app activation, window focus, tab selection, or session focus changed
|
|
109
|
+
- **variableChanged** — a user/session/app variable changed value
|
|
110
|
+
- **profileChanged** — a profile was modified
|
|
111
|
+
- **broadcastDomainsChanged** — broadcast input domains changed
|
|
112
|
+
- **serverOriginatedRpc** — iTerm2 invoked a registered RPC from your script
|
|
113
|
+
- ~~**locationChange**~~ — hostname/username/directory changed (deprecated)
|
|
114
|
+
|
|
99
115
|
### Cleanup
|
|
100
116
|
|
|
101
117
|
```typescript
|
|
@@ -119,20 +135,20 @@ The library authenticates with iTerm2 using a cookie-based system:
|
|
|
119
135
|
|
|
120
136
|
iTerm2 must be running with the Python API enabled.
|
|
121
137
|
|
|
122
|
-
##
|
|
123
|
-
|
|
124
|
-
See the [`examples/`](examples/) directory:
|
|
138
|
+
## CLI (`it2`)
|
|
125
139
|
|
|
126
|
-
|
|
127
|
-
- [`activate.ts`](examples/activate.ts) — focus a window, tab, or session by ID
|
|
128
|
-
- [`watch-events.ts`](examples/watch-events.ts) — subscribe to all events and log them
|
|
129
|
-
|
|
130
|
-
Run any example with:
|
|
140
|
+
The package includes an `it2` CLI:
|
|
131
141
|
|
|
132
142
|
```bash
|
|
133
|
-
npx tsx
|
|
143
|
+
npx tsx src/cli.ts list # list sessions with process trees and buffer
|
|
144
|
+
npx tsx src/cli.ts list --lines 5 --filter node # filter by process name, limit buffer lines
|
|
145
|
+
npx tsx src/cli.ts list --md # markdown output for LLM consumption
|
|
146
|
+
npx tsx src/cli.ts watch # stream all events as JSON
|
|
147
|
+
npx tsx src/cli.ts activate session <id> # focus a session, tab, or window
|
|
134
148
|
```
|
|
135
149
|
|
|
150
|
+
After `npm run build`, the CLI is also available as `node dist/cli.js` or via the `it2` bin.
|
|
151
|
+
|
|
136
152
|
## Documentation
|
|
137
153
|
|
|
138
154
|
- [Architecture](docs/architecture.md) — layer overview and design decisions
|