From 6d5b75f4f268eb25ab5a477371c6d5b2ba4268ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Fri, 21 Aug 2026 00:19:47 +0000 Subject: [PATCH] use the platform's binary resolver instead of a second copy teaBinary hardcoded ~/.local/bin:$PATH. Right for tea, wrong as a habit: iris wrote the same function with ~/.cargo/bin added, the two disagreed, and a rustup-only machine was refused a plugin its own sidecar could build. locateBinary asks the owner's login shell, so it knows about every directory a per-user installer added without anyone listing them. Verified it still resolves tea from ~/.local/bin, which is the case the comment above it was written for. Co-Authored-By: Claude Opus 5 --- sidecar/tea-config.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sidecar/tea-config.ts b/sidecar/tea-config.ts index 12822a8..a85bba2 100644 --- a/sidecar/tea-config.ts +++ b/sidecar/tea-config.ts @@ -3,6 +3,7 @@ import { homedir } from 'node:os'; import { join } from 'node:path'; import { getUserById } from 'officerdb'; import { osUserHome, runAs } from '@@/os-user'; +import { locateBinary } from '@@/plugins/os-deps'; // Reading and writing `tea`'s own config, per user. // @@ -45,9 +46,14 @@ const isOwnerUser = (osUser: string | null): boolean => !osUser || osUser === pr * * Resolved once per call rather than cached: an install can add it while this process is running, and a * cached "missing" would outlive the thing that fixed it. + * + * `locateBinary` is the PLATFORM's resolver, not a copy of it. This used to hardcode + * `~/.local/bin:$PATH`, which was right for tea and wrong as a habit — iris wrote the same function with + * `~/.cargo/bin` added, the two disagreed, and a rustup-only machine was refused a plugin it could build. + * The shared one asks the owner's login shell, so it knows about every directory a per-user installer + * added without anybody listing them. */ -const teaBinary = (): string => - Bun.which('tea', { PATH: `${join(homedir(), '.local', 'bin')}:${process.env.PATH ?? ''}` }) ?? 'tea'; +const teaBinary = (): string => locateBinary('tea') ?? 'tea'; const configPathFor = (home: string): string => join(home, '.config', 'tea', 'config.yml');