A plugin for central tracking of open nvim listen sockets
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Create CLI script to send stdin to registry sessions

rektide d69276b4 6b925080

+109 -2
+2 -2
.beads/issues.jsonl
··· 1 - {"id":"nvim-registry-10s","title":"Create help documentation (doc/)","description":"Create comprehensive help documentation in doc/ directory. Generate doc/registry-nvim.txt with proper Vim help format. Document all commands, configuration options, and usage examples.","status":"in_progress","priority":3,"issue_type":"task","created_at":"2026-01-08T18:25:48.694899845-05:00","created_by":"rektide","updated_at":"2026-01-08T18:37:33.483083297-05:00"} 1 + {"id":"nvim-registry-10s","title":"Create help documentation (doc/)","description":"Create comprehensive help documentation in doc/ directory. Generate doc/registry-nvim.txt with proper Vim help format. Document all commands, configuration options, and usage examples.","status":"closed","priority":3,"issue_type":"task","created_at":"2026-01-08T18:25:48.694899845-05:00","created_by":"rektide","updated_at":"2026-01-08T18:38:14.516605718-05:00","closed_at":"2026-01-08T18:38:14.516605718-05:00","close_reason":"Closed via update"} 2 2 {"id":"nvim-registry-3r0","title":"Implement init.lua - Plugin initialization","description":"Create init.lua as the main entry point. Implement setup() function for lazy.nvim configuration. Load and initialize all modules. Set up autocmds and commands.","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-08T18:25:49.453508485-05:00","created_by":"rektide","updated_at":"2026-01-08T18:36:47.806184235-05:00","closed_at":"2026-01-08T18:36:47.806184235-05:00","close_reason":"Closed via update"} 3 - {"id":"nvim-registry-59v","title":"Create CLI script to send stdin to all registry sessions","description":"Create a CLI script that reads from stdin and sends the content to all Neovim sessions listed in the listen registry. The script should:\n\n- Read content from stdin\n- Connect to each listen socket in the registry\n- Send content to set a vim register in each session\n- Accept command line flags:\n - `--register` or `-r`: Specify which vim register to write to (default: clipboard register `\"*`)\n - `--env-guard` or `-e`: Environment variable check in format NAME=VALUE. Only run if environment variable exists and matches the specified value. Example: CLIPBOARD_STATE=data\n- Handle connection errors gracefully (skip invalid sockets)\n- Report which sessions were successfully updated\n\nThis enables external tools to sync clipboard content across all Neovim instances via the registry.\n\nTechnical details:\n- Use netcat or similar to connect to Unix sockets\n- Use nvim channel API to set registers remotely\n- Handle async communication with all sockets\n- Parse CLI flags with proper validation","status":"open","priority":3,"issue_type":"feature","created_at":"2026-01-08T18:30:47.273970453-05:00","created_by":"rektide","updated_at":"2026-01-08T18:30:47.273970453-05:00","dependencies":[{"issue_id":"nvim-registry-59v","depends_on_id":"nvim-registry-iwa","type":"parent-child","created_at":"2026-01-08T18:30:50.239945982-05:00","created_by":"rektide"}]} 3 + {"id":"nvim-registry-59v","title":"Create CLI script to send stdin to all registry sessions","description":"Create a CLI script that reads from stdin and sends the content to all Neovim sessions listed in the listen registry. The script should:\n\n- Read content from stdin\n- Connect to each listen socket in the registry\n- Send content to set a vim register in each session\n- Accept command line flags:\n - `--register` or `-r`: Specify which vim register to write to (default: clipboard register `\"*`)\n - `--env-guard` or `-e`: Environment variable check in format NAME=VALUE. Only run if environment variable exists and matches the specified value. Example: CLIPBOARD_STATE=data\n- Handle connection errors gracefully (skip invalid sockets)\n- Report which sessions were successfully updated\n\nThis enables external tools to sync clipboard content across all Neovim instances via the registry.\n\nTechnical details:\n- Use netcat or similar to connect to Unix sockets\n- Use nvim channel API to set registers remotely\n- Handle async communication with all sockets\n- Parse CLI flags with proper validation","status":"in_progress","priority":3,"issue_type":"feature","created_at":"2026-01-08T18:30:47.273970453-05:00","created_by":"rektide","updated_at":"2026-01-08T18:38:16.976972735-05:00","dependencies":[{"issue_id":"nvim-registry-59v","depends_on_id":"nvim-registry-iwa","type":"parent-child","created_at":"2026-01-08T18:30:50.239945982-05:00","created_by":"rektide"}]} 4 4 {"id":"nvim-registry-5aj","title":"Implement registry.lua - Main registry module","description":"Create the main registry module that coordinates all functionality. Export public API for plugin usage. Manage the overall state and orchestrate between other modules.","status":"closed","priority":2,"issue_type":"task","created_at":"2026-01-08T18:25:45.045869094-05:00","created_by":"rektide","updated_at":"2026-01-08T18:35:35.73023499-05:00","closed_at":"2026-01-08T18:35:35.73023499-05:00","close_reason":"Closed via update"} 5 5 {"id":"nvim-registry-atn","title":"Implement cleanup.lua - Async socket validation","description":"Create cleanup.lua with async functionality using plenary.nvim. Check stats for all sockets in listen-registery using async operations. Perform batch update to remove invalid sockets after all stats are gathered. Expose :RegistryCleanup command.","status":"closed","priority":2,"issue_type":"feature","created_at":"2026-01-08T18:25:46.936796595-05:00","created_by":"rektide","updated_at":"2026-01-08T18:36:32.278258028-05:00","closed_at":"2026-01-08T18:36:32.278258028-05:00","close_reason":"Closed via update"} 6 6 {"id":"nvim-registry-cst","title":"Implement health.lua - Neovim healthcheck","description":"Create health.lua that provides healthcheck diagnostics. Check neoconf availability, plenary availability, and registry status. Report on any issues or misconfigurations.","status":"closed","priority":3,"issue_type":"task","created_at":"2026-01-08T18:25:47.889265985-05:00","created_by":"rektide","updated_at":"2026-01-08T18:37:31.359142755-05:00","closed_at":"2026-01-08T18:37:31.359142755-05:00","close_reason":"Closed via update"}
+107
scripts/registry-send
··· 1 + #!/usr/bin/env -S bash 2 + 3 + set -e 4 + 5 + REGISTER='"*' 6 + ENV_GUARD="" 7 + CONTENT="" 8 + 9 + while [[ $# -gt 0 ]]; do 10 + case $1 in 11 + -r|--register) 12 + REGISTER="$2" 13 + if [[ ! "$REGISTER" =~ ^\" ]]; then 14 + REGISTER="\"$REGISTER\"" 15 + fi 16 + shift 2 17 + ;; 18 + -e|--env-guard) 19 + ENV_GUARD="$2" 20 + shift 2 21 + ;; 22 + -h|--help) 23 + cat <<'EOF' 24 + Usage: registry-send [OPTIONS] 25 + 26 + Send stdin content to all Neovim sessions in the registry. 27 + 28 + Options: 29 + -r, --register NAME Set to specified register (default: clipboard *) 30 + -e, --env-guard VAR Only run if VAR=VALUE environment matches 31 + -h, --help Show this help message 32 + 33 + Examples: 34 + echo "hello" | registry-send 35 + echo "world" | registry-send -r a 36 + echo "test" | registry-send -e CLIPBOARD_STATE=enabled 37 + EOF 38 + exit 0 39 + ;; 40 + *) 41 + echo "Unknown option: $1" 42 + echo "Use --help for usage" 43 + exit 1 44 + ;; 45 + esac 46 + done 47 + 48 + if [[ -n "$ENV_GUARD" ]]; then 49 + IFS='=' read -r NAME VALUE <<< "$ENV_GUARD" 50 + if [[ "$NAME" == "" || "$VALUE" == "" ]]; then 51 + echo "Invalid env-guard format. Expected NAME=VALUE" >&2 52 + exit 1 53 + fi 54 + ACTUAL_VALUE="${!NAME}" 55 + if [[ "$ACTUAL_VALUE" == "" ]]; then 56 + echo "Environment variable $NAME not found" >&2 57 + exit 1 58 + fi 59 + if [[ "$ACTUAL_VALUE" != "$VALUE" ]]; then 60 + echo "Environment variable $NAME: expected '$VALUE', got '$ACTUAL_VALUE'" >&2 61 + exit 1 62 + fi 63 + fi 64 + 65 + CONTENT=$(cat) 66 + if [[ -z "$CONTENT" ]]; then 67 + echo "No content read from stdin" >&2 68 + exit 1 69 + fi 70 + 71 + CONFIG_PATH="${HOME}/.config/nvim/neoconf.json" 72 + if [[ ! -f "$CONFIG_PATH" ]]; then 73 + echo "Could not read neoconf config from $CONFIG_PATH" >&2 74 + exit 1 75 + fi 76 + 77 + REGISTRY=$(jq -r '.listen_registery[] // empty' "$CONFIG_PATH" 2>/dev/null || echo "") 78 + if [[ -z "$REGISTRY" ]]; then 79 + echo "No listen sockets found in registry" >&2 80 + exit 1 81 + fi 82 + 83 + SUCCESS=0 84 + FAILED=0 85 + 86 + while IFS= read -r SOCKET; do 87 + if [[ -z "$SOCKET" ]]; then 88 + continue 89 + fi 90 + 91 + if nvim --server "$SOCKET" --remote-send "<Esc>:call setreg($REGISTER, '$(echo "$CONTENT" | sed "s/'/'\\\\''/g")')<CR>" 2>/dev/null; then 92 + echo "✓ $SOCKET" 93 + ((SUCCESS++)) 94 + else 95 + echo "✗ $SOCKET: failed to send" 96 + ((FAILED++)) 97 + fi 98 + done <<< "$REGISTRY" 99 + 100 + echo "" 101 + echo "Sent to $SUCCESS session(s), $FAILED failed" 102 + 103 + if [[ $FAILED -gt 0 ]]; then 104 + exit 1 105 + fi 106 + 107 + exit 0