pexpect-cli_skill

This skill enables persistent pexpect sessions to automate interactive terminals such as ssh or databases via pexpect-cli.
  • JavaScript

8

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill mic92/mics-skills --skill pexpect-cli

  • SKILL.md1.5 KB

Overview

This skill provides persistent pexpect sessions to automate interactive terminal applications from the CLI. It keeps child processes alive across separate invocations so LLM agents or scripts can drive ssh, databases, debuggers, and shells incrementally. Sessions are addressable by ID or label for easy reuse and orchestration.

How this skill works

You start a named or unnamed persistent session which returns a session ID. Subsequent CLI invocations execute Python snippets inside that session context where a persistent child process and the pexpect module are available. The child process state (stdin/stdout and environment) persists across calls, allowing multi-step interactive workflows.

When to use it

  • Automating interactive logins such as ssh or telnet that require prompts and responses.
  • Driving REPLs and database shells (sqlite3, psql, mysql) across multiple commands.
  • Controlling debuggers or build tools that expect interactive input.
  • Performing long-running scripted interactions where state must persist between steps.

Best practices

  • Start sessions with descriptive names for easier management and logging.
  • Avoid embedding plaintext passwords in scripts; prefer agent-based auth or secured secret injection.
  • Use expect patterns that are specific and robust to prompt changes (include whitespace or markers).
  • Call pexpect-cli --list and --stop in cleanup routines to avoid orphaned sessions.
  • Test small interaction snippets before composing longer multi-step workflows.

Example use cases

  • Establish an ssh session, authenticate once, then run multiple remote commands across separate invocations.
  • Open a sqlite3 or psql shell and iterate queries interactively without restarting the process each time.
  • Drive an interactive installer or configuration wizard by sending expected prompts and responses in sequence.
  • Attach to a long-running build or test process to feed commands or capture intermediate output.
  • Use labeled sessions to let different agents share the same persistent terminal context safely.

FAQ

Start returns a session ID; store it in a variable and pass that ID as the first argument to subsequent pexpect-cli calls.

What objects are available inside an execution?

The pexpect module and a persistent child variable are available by default; you can spawn additional children as needed.

How do I stop a session?

Use pexpect-cli --stop <session-id> to terminate the persistent child and free resources.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational