{"id":49251171,"url":"https://github.com/fitchmultz/pi-copy-user-message","last_synced_at":"2026-06-07T17:01:01.722Z","repository":{"id":347806718,"uuid":"1195334183","full_name":"fitchmultz/pi-copy-user-message","owner":"fitchmultz","description":"pi extension that adds /copy-user to copy the most recent user message to your clipboard","archived":false,"fork":false,"pushed_at":"2026-06-04T19:51:42.000Z","size":181,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-04T21:37:50.694Z","etag":null,"topics":["clipboard","npm-package","pi","pi-extension","pi-package","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/pi-copy-user-message","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fitchmultz.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-29T14:45:54.000Z","updated_at":"2026-06-04T19:51:45.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/fitchmultz/pi-copy-user-message","commit_stats":null,"previous_names":["fitchmultz/pi-copy-user-message"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/fitchmultz/pi-copy-user-message","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitchmultz%2Fpi-copy-user-message","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitchmultz%2Fpi-copy-user-message/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitchmultz%2Fpi-copy-user-message/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitchmultz%2Fpi-copy-user-message/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fitchmultz","download_url":"https://codeload.github.com/fitchmultz/pi-copy-user-message/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fitchmultz%2Fpi-copy-user-message/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34029790,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-07T02:00:07.652Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clipboard","npm-package","pi","pi-extension","pi-package","typescript"],"created_at":"2026-04-25T00:05:22.108Z","updated_at":"2026-06-07T17:01:01.481Z","avatar_url":"https://github.com/fitchmultz.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pi copy-user extension\n\nA tiny [pi](https://github.com/badlogic/pi-mono) extension that adds a slash command for copying the **most recent user message** to your clipboard.\n\n## What it does\n\n- Adds `/copy-user`\n- Copies the text from the most recent user message in the current session\n- Preserves line breaks between text blocks\n- Uses the system clipboard when available and a terminal OSC 52 clipboard escape in interactive TTY sessions\n- Avoids synchronous clipboard subprocesses in the `/copy-user` command path\n- Does **not** fall back to an older message if the latest user message has no text\n\n## Install\n\nInstall it from npm with pi:\n\n```bash\npi install npm:pi-copy-user-message\n```\n\nOr install it directly from GitHub with pi:\n\n```bash\npi install https://github.com/fitchmultz/pi-copy-user-message\n```\n\nThen reload pi from inside the app with:\n\n```text\n/reload\n```\n\nIf you prefer to load it directly from a local checkout during development, you can point pi at the package entrypoint:\n\n```bash\npi -e ./extensions/copy-user-message.ts\n```\n\n## Compatibility\n\n- Tested with [pi](https://github.com/earendil-works/pi-mono) 0.76.0\n- Minimum Node.js for local repo tooling: `\u003e=22.19.0`\n- `.nvmrc` pins Node 22.19.0 for local development; CI also verifies Node 22.x, 24.x, and 26.x\n\nThis package keeps `@earendil-works/pi-coding-agent` as a development dependency for local typechecking and tests and declares pi core packages as wildcard peers per current pi package guidance; it is intended to run inside pi's bundled extension runtime.\n\n## Usage\n\nOnce loaded, run:\n\n```text\n/copy-user\n```\n\nThe command will:\n\n- copy the newest user message text to the clipboard\n- show a warning if there are no user messages\n- show a warning if the newest user message contains no text\n\n## Behavior notes\n\n- Text-only by design: image-only user messages are not copied.\n- If a user message contains multiple text blocks, they are joined with newlines.\n- OSC 52 is only emitted in interactive TTY sessions, so print/RPC output stays clean.\n- Clipboard command fallbacks run asynchronously so the slash-command path does not block the TUI event loop while utilities resolve or time out.\n- On Linux-family environments, the extension tries `termux-clipboard-set`, then `wl-copy`, then X11 tools (`xclip`, then `xsel`).\n- If no supported clipboard transport is available, the command reports an error instead of claiming success.\n- The command is intentionally strict about “most recent” so it never copies an older user message by mistake.\n\n## Development\n\nThis repo includes a small regression test in:\n\n- `tests/copy-user-message.test.ts`\n\nThe test covers:\n\n- latest text message\n- latest image-only message\n- latest whitespace-only message\n- no user message at all\n- actual `/copy-user` command success, warning, and error paths\n- OSC 52 emission\n- Linux clipboard fallback ordering\n- X11 `xsel` fallback after `xclip`\n- macOS `pbcopy` and Windows `clip` transport selection\n- failed or unsupported clipboard transport cases\n\n## Files\n\n- `extensions/copy-user-message.ts` — publishable extension implementation\n- `.pi/extensions/copy-user-message.ts` — thin project-local wrapper for auto-discovery in this repo\n- `tests/copy-user-message.test.ts` — regression test for message selection, `/copy-user` command behavior, and clipboard transport fallbacks\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffitchmultz%2Fpi-copy-user-message","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffitchmultz%2Fpi-copy-user-message","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffitchmultz%2Fpi-copy-user-message/lists"}