add tier-2 CLI shortcuts and clide tail --events
`bin/clide` gains the single-word shortcuts CLAUDE.md's tier 2 spells out: open, active, insert, replace-selection, save. Each maps the flat positional argv into the canonical editor.* IPC shape. Insert and replace-selection accept a lone `-` to read text from stdin so piping works (`pbpaste | clide replace-selection -`). `clide tail --events` is the subscribe mode. Same socket as the request side; the client just reads + filters events. --filter SUBSYSTEM or SUBSYSTEM:ID narrows the stream. Exits cleanly on SIGINT. defaultSocketPath() now respects CLIDE_SOCKET_PATH before XDG — the existing override callers always had this up their sleeve (via XDG_RUNTIME_DIR manipulation) but making it explicit unblocks parallel test runs where each test needs its own daemon socket. The new end-to-end CLI suite does exactly that: 5 tests spin up real daemon subprocesses and exercise the shortcut surface through the live IPC stack. 74 core tests pass; round-trip verified by hand (open README.md → insert → tail --events captures editor.opened / edited / selection-changed / saved). Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,19 @@
|
||||
import 'dart:io';
|
||||
|
||||
/// Resolve the daemon unix-socket path.
|
||||
///
|
||||
/// Precedence (highest first):
|
||||
/// 1. `CLIDE_SOCKET_PATH` — explicit override. Used by tests that
|
||||
/// run multiple daemons in parallel and by power users who want
|
||||
/// their own layout.
|
||||
/// 2. `$XDG_RUNTIME_DIR/clide-<user>.sock` — Linux default; the
|
||||
/// per-user tmpfs lives exactly for this kind of short-lived
|
||||
/// socket and is auto-cleaned on logout.
|
||||
/// 3. `/tmp/clide-<user>.sock` — fallback for environments without
|
||||
/// `XDG_RUNTIME_DIR`.
|
||||
String defaultSocketPath() {
|
||||
final override = Platform.environment['CLIDE_SOCKET_PATH'];
|
||||
if (override != null && override.isNotEmpty) return override;
|
||||
final xdg = Platform.environment['XDG_RUNTIME_DIR'];
|
||||
final user = Platform.environment['USER'] ?? 'anon';
|
||||
final base = (xdg != null && xdg.isNotEmpty) ? xdg : '/tmp';
|
||||
|
||||
Reference in New Issue
Block a user