SCRIPTING API

JSON-RPC API

Chau7 exposes a fully working JSON-RPC 2.0 API over a Unix socket. 12 methods for history, settings, tabs, commands, and snippets. Script your terminal from any language.

The problem

  • AppleScript, UI scripting, and simulated keypresses are the wrong abstraction for terminal automation.
  • A real local API should work from any language without vendor lock-in.

What Chau7 does about it

  • Exposes a Unix-socket JSON-RPC interface at ~/Library/Application Support/Chau7/scripting.sock.
  • Supports methods for history, settings, tabs, command execution, and snippets.
  • Uses structured request routing and standard error handling instead of fragile text commands.
  • Is backed by dedicated scripting API tests.

What is JSON-RPC API in Chau7?

The JSON-RPC API is a scripting interface in the Chau7 terminal that accepts requests over a Unix domain socket at ~/Library/Application Support/Chau7/scripting.sock. Chau7 uses the JSON-RPC 2.0 protocol with standard request/response framing, error codes, and typed result objects.

All 12 methods are fully working: get_history (backed by PersistentHistoryStore with search and limit parameters), get_settings / set_setting for preferences, list_tabs / get_tab / create_tab / close_tab (delegating to TerminalControlService), run_command / get_output for command execution, and list_snippets / run_snippet (querying SnippetManager).

What protocol does Chau7's API use?

Chau7's API uses JSON-RPC 2.0 over a Unix domain socket at ~/Library/Application Support/Chau7/scripting.sock. Any language or tool that can open a Unix socket and send JSON can interact with the API.

All 12 methods are fully working: get_history for searching and retrieving command history, get_settings / set_setting for preferences, list_tabs / get_tab / create_tab / close_tab for tab management (delegating to TerminalControlService), run_command / get_output for command execution, and list_snippets / run_snippet for snippet operations (querying SnippetManager).

Chau7 as an iTerm2 Python API alternative

iTerm2 offers a Python API for terminal automation, but it requires Python and iTerm2's proprietary library. Chau7's JSON-RPC API is language-agnostic. Any language that can write JSON to a Unix socket can interact with Chau7.

Most terminal emulators provide no automation API at all, forcing developers to use AppleScript, osascript hacks, or fragile keybinding simulation. Chau7's API provides all 12 methods for history, settings, tab management, command execution, and snippet operations. The API framework and socket are stable and ready for production use.

What methods are available?

All 12 methods are fully working. The get_history method queries PersistentHistoryStore and supports search terms and result limits, returning command history with timestamps and metadata.

The get_settings and set_setting methods read and write preferences. Tab methods (list_tabs, get_tab, create_tab, close_tab) delegate to TerminalControlService for full tab lifecycle management. Command methods (run_command, get_output) execute commands and retrieve output. Snippet methods (list_snippets, run_snippet) query SnippetManager to list and execute saved snippets.

Why Chau7's JSON-RPC API matters

Most terminal emulators provide no automation API. Developers are forced to use AppleScript, osascript hacks, or fragile keybinding simulation to automate terminal workflows on macOS.

Chau7 provides a fully working JSON-RPC 2.0 API over a Unix domain socket with 12 methods covering history, settings, tab management, command execution, and snippet operations. The framework includes method routing, error handling, and typed results. For teams building custom developer tooling, the API socket and protocol are stable and production-ready.

Questions this answers

  • What is JSON-RPC API in Chau7 terminal?
  • iTerm2 Python API automate terminal alternative
  • What methods are available?
  • What protocol does the API use?
  • Will more API methods be added?

Frequently asked questions

What is JSON-RPC API in Chau7 terminal?

The JSON-RPC API is a scripting interface in the Chau7 terminal that accepts JSON-RPC 2.0 requests over a Unix domain socket at ~/Library/Application Support/Chau7/scripting.sock. All 12 methods are fully working: get_history, get_settings, set_setting, list_tabs, get_tab, create_tab, close_tab, run_command, get_output, list_snippets, and run_snippet.

iTerm2 Python API automate terminal alternative

Chau7's JSON-RPC API is a language-agnostic alternative to iTerm2's Python API. Where iTerm2 requires Python and its proprietary library, Chau7 accepts standard JSON-RPC calls over a Unix socket from any language. All 12 methods are fully working, covering history, settings, tab management, command execution, and snippet operations.

What methods are available?

All 12 methods are fully working: get_history (via PersistentHistoryStore with search and limit), get_settings and set_setting for preferences, list_tabs, get_tab, create_tab, and close_tab (delegating to TerminalControlService), run_command and get_output for command execution, and list_snippets and run_snippet (querying SnippetManager).

What protocol does the API use?

Chau7's API uses JSON-RPC 2.0 over a Unix domain socket located at ~/Library/Application Support/Chau7/scripting.sock. Any language or tool that can open a Unix socket and send JSON can interact with the API. No SDK or library is required.

Will more API methods be added?

All 12 core methods are fully working today. The API framework supports method routing, error codes, and typed results, making it straightforward to add new methods. Event subscriptions and additional methods may be added in the future.