[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-81590":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":12,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":14,"stars7d":15,"stars30d":15,"stars90d":12,"forks30d":12,"starsTrendScore":16,"compositeScore":17,"rankGlobal":9,"rankLanguage":9,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":9,"pushedAt":9,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":12,"starSnapshotCount":12,"syncStatus":14,"lastSyncTime":26,"discoverSource":27},81590,"claude-pty-wrapper","kcosr\u002Fclaude-pty-wrapper","kcosr","claude-pty-wrapper runs interactive Claude through a PTY while exposing a print-like CLI that streams assistant text from Claude’s durable session JSONL.",null,"TypeScript",26,0,1,2,3,6,45.8,"MIT License",false,"main",true,[],"2026-06-12 04:01:34","# claude-pty-wrapper\n\n> **Warning:** Experimental wrapper. Test against your workflow before relying\n> on it for automation.\n\n`claude-pty-wrapper` runs interactive Claude through a PTY while exposing a\nprint-like CLI that streams assistant text from Claude's durable session JSONL.\n\n## Usage\n\n```bash\nclaude-pty-wrapper \"Summarize this repository\"\n```\n\nWithout wrapper output flags, `claude-pty-wrapper` runs Claude in a\nwrapper-owned PTY and relays bytes between Claude and the current terminal.\nThe terminal still renders ANSI\u002Fcontrol sequences; the wrapper does not emulate\nor parse the screen.\n\n```bash\nclaude-pty-wrapper --freshness-interval 60 \"Summarize this repository\"\n```\n\nIn passthrough mode, `--freshness-interval` enables optional idle prompts. If\nneither Claude output nor user input is observed for the interval, the wrapper\nsends the freshness message into Claude's PTY followed by Enter.\n\n```bash\nclaude-pty-wrapper -p \"Summarize this repository\"\n```\n\nText mode is the default output mode. It prints assistant text blocks from the\nsession JSONL file and ignores tool calls, tool results, sidechains, and user\nmessages.\n\n```bash\nclaude-pty-wrapper --session-jsonl \"Summarize this repository\"\n```\n\n`--session-jsonl` streams appended raw Claude JSONL records for the wrapper\nturn. This is useful for diagnostics and downstream tooling.\n\n```bash\nclaude-pty-wrapper -p --output-format stream-json \"Summarize this repository\"\n```\n\n`--output-format stream-json` emits a compatibility-oriented JSONL stream resembling\n`claude -p --verbose --output-format stream-json`. It preserves persisted\nassistant content blocks, including tool calls and reasoning-style blocks, but\ncannot synthesize runtime-only metadata that Claude does not write to the\ndurable session file. See [docs\u002Fstream-json.md](docs\u002Fstream-json.md).\n\n```bash\nclaude-pty-wrapper -p --output-format json \"Summarize this repository\"\n```\n\n`--output-format json` emits a single final result object, matching Claude's\nprint-mode JSON shape as closely as durable session files allow.\n\n```bash\nclaude-pty-wrapper --resume 18a18377-217d-4b29-9a68-c70a89b79330 -p \"Continue\"\n```\n\nResume mode tails from the existing session file size before spawning Claude,\nso output is scoped to the resumed turn.\n\n## Option Handling\n\nWrapper-owned flags:\n\n```text\n-p, --print                 Use wrapper-managed print-compatible output\n--output-format \u003Cformat>    Wrapper output: text, json, or stream-json\n--input-format \u003Cformat>     Wrapper input: text; stream-json is not supported yet\n--session-jsonl             Emit appended raw Claude session JSONL\n--cwd \u003Cdir>                 Working directory for Claude and session path lookup\n--claude-bin \u003Cpath>         Claude binary; defaults to CLAUDE_BIN or claude\n--timeout \u003Cseconds>         Wrapper turn timeout\n--raw-pty-log \u003Cfile>        Write raw PTY output for diagnostics\n--wrapper-debug             Print wrapper diagnostics to stderr\n--freshness-interval \u003Csec>  Passthrough idle interval; enables freshness prompts\n--freshness-message \u003Ctext>  Passthrough idle message; defaults to \"Please wait for further instructions.\"\n--freshness-max-iterations \u003Ccount>\n                            Stop after this many freshness prompts\n--freshness-max-duration \u003Csec>\n                            Stop freshness behavior after this session duration\n```\n\nAll other supported Claude flags keep their Claude names and are passed through\nbefore the prompt. Examples include `--model`, `--effort`, `--name`,\n`--session-id`, `--resume`, `--dangerously-skip-permissions`, `--debug`, and\n`--verbose`. Run `claude-pty-wrapper --help` for the full accepted flag list.\n\n`--include-partial-messages` is accepted as a no-op in wrapper stream-json mode\nfor compatibility with tools that pass it. In passthrough mode, runtime stream\nflags such as `--include-partial-messages` and `--include-hook-events` are\nforwarded to Claude.\n\nUse `-p\u002F--print` for wrapper-managed text, JSON, and stream JSON output. A bare\nprompt without wrapper output flags uses interactive passthrough through a\nwrapper-owned PTY relay.\n\nFreshness flags are passthrough-only. `--freshness-message`,\n`--freshness-max-iterations`, and `--freshness-max-duration` require\n`--freshness-interval`; max iterations and max duration are mutually exclusive.\nFreshness is inactive unless `--freshness-interval` is set.\n\n## Running Locally\n\nInstall dependencies, build the CLI, and link the command into your local\n`PATH`:\n\n```bash\nnpm install\nnpm run build\nnpm link\n```\n\nThen run it as:\n\n```bash\nclaude-pty-wrapper \"Summarize this repository\"\nclaude-pty-wrapper -p \"Summarize this repository\"\n```\n\nAfter code changes, rerun `npm run build`; the linked command points at this\nrepo's `dist\u002F` output.\n\n## Development\n\nRun the full local validation suite:\n\n```bash\nnpm install\nnpm run check\n```\n\n`npm run check` runs linting, typechecking, unit\u002Fintegration tests, and smoke\ntests. The smoke tests build the CLI first, then run it against a fake Claude\nexecutable that is spawned through `node-pty` and writes real session JSONL\nfiles under a temporary `HOME`.\n\nTo validate before linking, use:\n\n```bash\nnpm install\nnpm run check\nnpm link\n```\n\nLive smoke tests are opt-in because they invoke the installed Claude binary and\nmay consume Claude\u002FAPI quota:\n\n```bash\nCLAUDE_PTY_WRAPPER_LIVE_SMOKE=1 npm run test:smoke:live\n```\n","`claude-pty-wrapper` 是一个实验性的工具，它通过伪终端（PTY）运行交互式的 Claude，并提供了一个类似打印的命令行界面，能够从 Claude 的持久会话 JSONL 文件中流式传输助手文本。该项目使用 TypeScript 编写，核心功能包括支持多种输出格式（如文本、JSON 和 stream-json），以及通过设置 `--freshness-interval` 实现空闲时自动发送消息以保持会话活跃。此外，还支持基于现有会话文件恢复对话的功能。适用于需要与 Claude 进行交互但希望获得更灵活输出控制或进行诊断分析的场景。请注意，此工具仍处于实验阶段，在用于自动化之前应先在您的工作流程中测试。","2026-06-11 04:05:37","CREATED_QUERY"]