From fdb2c31f84e8c738c5ffc59aa3594bc845d1db26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Sun, 8 Feb 2026 15:34:01 +0100 Subject: [PATCH] docs: add pipe-to-loki documentation to CLAUDE.md Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/CLAUDE.md b/CLAUDE.md index 3c8641c..664420a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -39,6 +39,30 @@ Do not automatically deploy changes. Deployments are usually done by updating th Do not run SSH commands directly. If a command needs to be run on a remote host, provide the command to the user and ask them to run it manually. +### Sharing Command Output via Loki + +All hosts have the `pipe-to-loki` script for sending command output or terminal sessions to Loki, allowing users to share output with Claude without copy-pasting. + +**Pipe mode** - send command output: +```bash +command | pipe-to-loki # Auto-generated ID +command | pipe-to-loki --id my-test # Custom ID +``` + +**Session mode** - record interactive terminal session: +```bash +pipe-to-loki --record # Start recording, exit to send +pipe-to-loki --record --id my-session # With custom ID +``` + +The script prints the session ID which the user can share. Query results with: +```logql +{job="pipe-to-loki"} # All entries +{job="pipe-to-loki", id="my-test"} # Specific ID +{job="pipe-to-loki", host="testvm01"} # From specific host +{job="pipe-to-loki", type="session"} # Only sessions +``` + ### Testing Feature Branches on Hosts All hosts have the `nixos-rebuild-test` helper script for testing feature branches before merging: