Skip to content

Commit bee1888

Browse files
umair-ablyclaude
andcommitted
docs: stop referencing the removed ably-interactive wrapper
Sweep user-facing and architecture references now that the wrapper binary is gone and ably interactive handles Ctrl+C in-process: - env-vars: ABLY_HISTORY_FILE example uses `ably interactive`; reword the note (HistoryManager already defaults to ~/.ably/history); update coupled unit test - Troubleshooting/Debugging: accurate Ctrl+C guidance; no wrapper run-commands - Exit-Codes: reframe the exit-code consumer as a host session restart loop - Interactive-REPL: status note marking the bash-wrapper design as superseded - Project-Structure: drop the deleted bin/ably-interactive(.ps1) tree entries - manual tests: run `node bin/run.js interactive`; keep the exit-42 contract Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3c635c5 commit bee1888

9 files changed

Lines changed: 124 additions & 144 deletions

File tree

docs/Debugging.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Refer to [Testing.md](Testing.md) for how to run specific tests.
5757
```
5858
* **Terminal Diagnostics:** Enable terminal state logging for TTY/stdin/stdout issues:
5959
```bash
60-
TERMINAL_DIAGNOSTICS=1 ably-interactive
60+
TERMINAL_DIAGNOSTICS=1 ably interactive
6161
```
6262
* **Check Configuration:** Use `ably config show` to view stored credentials or `ably config path` to find the config file location.
6363
* **Override Configuration:** Use environment variables to override config for testing:

docs/Exit-Codes.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ This document describes the exit codes used by the Ably CLI, particularly in int
66

77
### 0 - Success
88
- Normal successful completion of a command
9-
- Clean exit after user types `exit` command (in non-wrapper mode)
9+
- Clean exit after the user types `exit` (when not running under a session restart loop)
1010

1111
### 42 - User Exit (Interactive Mode)
12-
- Special exit code used when user types `exit` in interactive mode with wrapper
13-
- Signals to the wrapper script (`bin/ably-interactive`) to terminate the loop
12+
- Special exit code emitted when the user types `exit` while running under a session restart loop (`ABLY_WRAPPER_MODE=1`)
13+
- Signals the restart loop (e.g. the Ably terminal server's session entrypoint) to stop, rather than treating the exit as a crash to relaunch
1414
- Defined as `Interactive.EXIT_CODE_USER_EXIT`
1515

1616
### 130 - SIGINT (Ctrl+C)
@@ -40,25 +40,24 @@ This document describes the exit codes used by the Ably CLI, particularly in int
4040
- Shows "⚠ Force quit" message
4141
- Bypasses normal cleanup
4242

43-
## Wrapper Script Behavior
43+
## Session Restart Loop Behavior
4444

45-
The `bin/ably-interactive` wrapper script uses these exit codes to determine whether to restart the interactive shell:
45+
`ably interactive` is a normal command and handles Ctrl+C in-process — the CLI no longer ships a separate `ably-interactive` wrapper binary. A host that wants the interactive shell to survive a force-quit (for example the Ably terminal server, which keeps a browser session alive) can wrap `ably interactive` in a small restart loop, set `ABLY_WRAPPER_MODE=1`, and key the loop off these exit codes:
4646

47-
- **Exit code 42**: User typed 'exit' - terminate the wrapper loop
48-
- **Exit code 130**: SIGINT - restart the shell (unless double Ctrl+C)
49-
- **Exit code 0**: Normal exit - terminate the wrapper loop
50-
- **Other codes**: Show error message and restart after delay
47+
- **Exit code 42**: User typed 'exit' - stop the loop
48+
- **Exit code 0**: Normal exit - stop the loop
49+
- **Exit code 130**: Force quit (double Ctrl+C) - relaunch the shell
50+
- **Other codes**: Show an error and relaunch after a short delay
5151

5252
## Implementation Details
5353

5454
Exit codes are handled in:
5555
- `src/commands/interactive.ts`: Sets exit code 42 for user exit
5656
- `src/utils/sigint-exit.ts`: Handles SIGINT behavior and exit code 130
57-
- `bin/ably-interactive`: Wrapper script that interprets exit codes
5857

5958
---
6059

6160
## Related
6261

63-
- [Interactive-REPL.md](Interactive-REPL.md)Architecture and wrapper script design
62+
- [Interactive-REPL.md](Interactive-REPL.md)Interactive mode architecture
6463
- [Troubleshooting.md](Troubleshooting.md#interactive-mode-issues) — Common interactive mode issues

docs/Interactive-REPL.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ If there are any existing libraries that we can depend on to enable this functio
3333

3434
## Execution Plan
3535

36+
> **Status note (superseded design).** This section documents the original
37+
> bash-wrapper design. The wrapper binary (`bin/ably-interactive`) has since been
38+
> retired: `ably interactive` now handles Ctrl+C in-process (a single Ctrl+C
39+
> interrupts the running command and returns to the prompt), and the CLI ships a
40+
> single `ably` bin. The auto-restart-on-force-quit behaviour is now optional and
41+
> owned by whichever host wants it — e.g. the Ably terminal server wraps
42+
> `ably interactive` in a small restart loop (keyed off exit codes 42/130, with
43+
> `ABLY_WRAPPER_MODE=1`). The historical design below is kept for context.
44+
3645
### Overview
3746

3847
This execution plan implements an interactive REPL mode using a bash wrapper approach with inline command execution. The design prioritizes simplicity, natural Ctrl+C handling, and seamless user experience.
@@ -414,8 +423,8 @@ This plan delivers a responsive interactive shell with natural Ctrl+C handling a
414423

415424
## Related
416425

417-
- [Exit Codes](Exit-Codes.md) — Exit codes used in interactive mode and wrapper script behavior
426+
- [Exit Codes](Exit-Codes.md) — Exit codes used in interactive mode
418427
- [Troubleshooting](Troubleshooting.md#interactive-mode-issues) — Common interactive mode issues (unexpected exits, Ctrl+C, history)
419428
- [Auto-completion](Auto-completion.md) — Shell tab completion setup for commands and flags
420429
- [Testing Guide](Testing.md) — Subprocess and TTY test layers for interactive mode
421-
- [Project Structure](Project-Structure.md) — Repository layout including `src/commands/interactive.ts` and `bin/ably-interactive`
430+
- [Project Structure](Project-Structure.md) — Repository layout including `src/commands/interactive.ts`

docs/Project-Structure.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ This document outlines the directory structure of the Ably CLI project.
88
/
99
├── assets/ # Static assets (e.g. CLI screenshot)
1010
├── bin/ # Executable scripts
11-
│ ├── ably-interactive # Bash wrapper for interactive mode (restarts on Ctrl+C)
12-
│ ├── ably-interactive.ps1 # PowerShell equivalent for Windows
1311
│ ├── dev.cmd # Development run script (Windows)
1412
│ ├── development.js # Development run script (Unix)
1513
│ ├── run.cmd # Production run script (Windows)
@@ -175,5 +173,5 @@ This document outlines the directory structure of the Ably CLI project.
175173
- [Development Stage](Environment-Variables/Development-Usage.md) Env Variables — Development, testing, debugging, and internal env variables. For user-facing variables, run `ably env`.
176174
- [Testing Guide](Testing.md) — Test layers and directory layout (`test/unit/`, `test/e2e/`, `test/tty/`, `test/integration/`)
177175
- [Debugging Guide](Debugging.md) — Debugging tips for CLI development
178-
- [Interactive REPL](Interactive-REPL.md) — Architecture of `src/commands/interactive.ts` and `bin/ably-interactive`
176+
- [Interactive REPL](Interactive-REPL.md) — Architecture of `src/commands/interactive.ts`
179177
- [Exit Codes](Exit-Codes.md) — Exit codes handled in `src/commands/interactive.ts` and `src/utils/sigint-exit.ts`

docs/Troubleshooting.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,8 @@ Property 'x' does not exist on type 'Y'
226226
**Solution**:
227227
- Check the exit code to understand what happened (see [Exit Codes documentation](Exit-Codes.md) and [Development Stage Env Variables](Environment-Variables/Development-Usage.md) for interactive mode env vars)
228228
- Common exit codes:
229-
- Exit code 0: Wrapper (`ably-interactive`) terminated normally
230-
- Exit code 42: User typed 'exit' in interactive mode (signals wrapper to terminate)
229+
- Exit code 0: Interactive shell exited normally
230+
- Exit code 42: User typed 'exit' in interactive mode (signals a session restart loop to stop)
231231
- Exit code 130: SIGINT/Ctrl+C (double Ctrl+C or force quit)
232232
- Exit code 143: SIGTERM received
233233

@@ -236,10 +236,9 @@ Property 'x' does not exist on type 'Y'
236236
**Problem**: Ctrl+C doesn't interrupt commands or behaves unexpectedly.
237237

238238
**Solution**:
239-
- Use the wrapper script `ably-interactive` for better Ctrl+C handling
240-
- Single Ctrl+C should interrupt running command and return to prompt
239+
- Single Ctrl+C interrupts the running command and returns to the prompt
240+
- At an empty prompt, single Ctrl+C prints `^C`; type `exit` (or Ctrl+D) to leave the shell
241241
- Double Ctrl+C (within 500ms) force quits with exit code 130
242-
- If running without wrapper, Ctrl+C may exit the entire shell
243242

244243
### Command History Not Persisting
245244

src/data/env-vars.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,17 +235,17 @@ const ABLY_HISTORY_FILE = new EnvVarEntry(
235235
"File path",
236236
"~/.ably/history",
237237
null,
238-
["ably-interactive"],
238+
["ably interactive"],
239239
"Override the location of the interactive mode command history file.",
240240
new Example([
241241
`export ABLY_HISTORY_FILE="/path/to/custom/history"`,
242-
`ably-interactive`,
242+
`ably interactive`,
243243
]),
244244
[
245245
new DetailSection("", [
246246
{
247247
kind: "note",
248-
text: "Auto-set by the `ably-interactive` shell wrapper; only set manually for a custom location.",
248+
text: "Defaults to `~/.ably/history`; only set this to use a custom location.",
249249
},
250250
]),
251251
],

0 commit comments

Comments
 (0)