semvec/pypi-packages huggingface dataset:
screen-manager 0.1.0
Screen session manager with MCP support
Requires Python: >=3.11
Keywords: debugging, ipdb, multi-agent, mcp, screen, session-management, conditional-debugging, AI-agents

<!-- ---
!-- Timestamp: 2025-08-30 09:30:31
!-- Author: ywatanabe
!-- File: /home/ywatanabe/proj/screen-manager/README.md
!-- --- -->

# Screen Session Manager

Manage screen sessions programmatically. Send commands, capture output, and automate workflows.

## Install

```bash
pip install -e .
```

## Quick Start

```python
from screen_manager import ScreenSessionManager

manager = ScreenSessionManager()

# Create session and send commands
manager.create_session("work")
manager.send_command("work", "python script.py")
output = manager.capture("work")
```

## CLI Usage

```bash
# Create and manage sessions  
python -m screen_manager create work
python -m screen_manager send work "echo hello"
python -m screen_manager capture work

# Send multiple commands
python -m screen_manager send-commands work -c "echo 1" -c "echo 2"

# Execute files
python -m screen_manager send-file work script.py

# List and attach
python -m screen_manager list --all
python -m screen_manager attach work

# Smart create/attach  
python -m screen_manager create-or-attach work

# Cleanup
python -m screen_manager cleanup work
```

## MCP Server

```bash
# Run as MCP server
python -m screen_manager serve

# Or from Python
from screen_manager.mcp_server import main
main()
```

### MCP Configuration

Add to your MCP client configuration:

```json
{
  "mcpServers": {
    "screen-manager": {
      "command": "python",
      "args": ["-m", "screen_manager.mcp_server"],
      "description": "Manage screen sessions, send commands, and capture output"
    }
  }
}
```

## API Methods

- `create_session(name)` - Create new session
- `send_command(name, cmd)` - Send single command
- `send_commands(name, cmds)` - Send command list
- `send_command_from_file(name, file)` - Execute file
- `capture(name, lines=-1)` - Get output
- `list_sessions(all_sessions=False)` - List sessions
- `attach_session(name)` - Get attach instructions
- `create_or_attach_session(name)` - Smart create/attach
- `cleanup_session(name)` - Remove session

## MCP Tools

The MCP server provides 10 tools:
- `create_session`
- `send_command` 
- `send_commands`
- `send_command_from_file`
- `capture_output`
- `list_sessions`
- `list_all_sessions`
- `attach_session`
- `create_or_attach_session`
- `cleanup_session`

### Use Case: Debugging with selective breakpoints
manager.send_commands("debug", [
    "export CIPDB_IDS=validate,transform",
    "python script_with_cipdb.py"
])

## Requirements

- Python 3.8+
- `screen` command (install with `apt install screen` or `brew install screen`)

That's it. Simple screen session management for Python.

<!-- EOF -->
llm-sql-prompt 0.10.0
Utility to generate ChatGPT prompts for SQL writing, offering table structure snapshots and sample row data from Postgres and sqlite databases.
Requires Python: ~=3.11
Keywords: chatgpt, database, llms, postgres, prompt, sql, sqlite

# ChatGPT Prompt for SQL Writing

Generate a prompt for writing SQL queries with LLMs like ChatGPT. Drop your database URL and table name into the script and it will generate a prompt for you to copy and paste into your favorite LLM.

## What this does

- Snapshot of Table Structure: Understand the columns, types, and organization of your table at a glance.
- Sample Rows: Includes INSERT statements to describe the data in your table.
- Extracts Table and Field Comments: If you have comments on your tables or columns, they will be included in the prompt.

## Usage

Install the package:

```shell
pip install llm-sql-prompt
```

Here's how to use it:

```shell
Usage: llm-sql-prompt [OPTIONS] DATABASE_URL [TABLE_NAME]

Options:
  --help  Show this message and exit.
```

Generate a prompt from a postgres database:

```shell
llm-sql-prompt postgresql://postgres:postgres@localhost:5555/database_name table_name | pbcopy
llm-sql-prompt $DATABASE_URL
```

From a local sqlite database:

```shell
llm-sql-prompt "$HOME/Library/Application Support/BeeperTexts/index.db" --all
```

### Tunneling to a remote port

If you find yourself wanting to tunnel into a remote box and work with a production database, here's some helpful commands so you don't need to remember the weird SSH tunneling syntax:

```shell
function find_random_open_port() {
  local start_port=${1:-1024}
  local max_attempts=100
  local attempt=0
  local port=$start_port

  while (( attempt < max_attempts )); do
    if ! nc -z localhost $port 2>/dev/null; then
      echo $port
      return
    fi
    port=$((port + 1))
    attempt=$((attempt + 1))
  done

  echo "No open port found after $max_attempts attempts, starting from $start_port." > /dev/stderr
  return 1
}


function ssh-tunnel() {
  if [ $# -lt 2 ]; then
    echo "Usage: ssh-tunnel remote_host remote_port [local_port]"
    echo "This function sets up SSH port forwarding."
    return 1
  fi

  local remote_host=$1
  local remote_port=$2
  local local_port=${3:-$(find-random-open-port $remote_port)}

  if [[ -z $local_port ]]; then
    echo "Failed to find an open local port."
    return 1
  fi

  echo "Forwarding local port $local_port to remote port $remote_port on $remote_host..."
  set -x
  ssh $remote_host -L ${local_port}:localhost:${remote_port}
}
```

## TODO

Super basic script, needs a lot of work

- [x] pg support
- [x] one entrypoint
- [x] use DB comments on columns + tables
- [x] multiple tables
- [ ] prompt tweaking
- [ ] understand prompt size limits and sample records until one fits