mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
* feat(setup): give five mcp-add clients one client-table row Cline VS Code extension, Kiro, Mastra Code, Zed and Amp move from registration-only catalog entries to rows in the client table. rea mcp add projects those rows, so doctor, update and uninstall now inspect, refresh and remove what it wrote, and setup offers each client when detected. Refs #7181 * refactor(setup): keep FreeBuff's comment on its declaration The client helpers added for the folded mcp-add clients were inserted between FreeBuff's profile-directory comment and its declaration. Move them above it, and drop an import the folded locations no longer use. * test(setup): refresh an older mcp-add registration through setup Address review: seed each folded client with an older REA-owned package runner launcher, then check that doctor reports it stale, update selects it, setup plans and applies the update, and doctor then reads the current launcher. * fix(setup): register Amp in settings.jsonc when that is its settings file (#10717) Amp reads ~/.config/amp/settings.json or settings.jsonc. REA always used settings.json, creating a second file beside an existing settings.jsonc. Use settings.jsonc when it is the only file, and refuse when both exist because Amp does not document which one it reads. * feat(setup): manage Cline in VS Code Insiders, VSCodium, Cursor and Windsurf (#10729) * feat(setup): manage Cline in VS Code Insiders, VSCodium, Cursor and Windsurf The Cline extension keeps its MCP settings in the global storage of whichever editor runs it. REA resolved only VS Code's, so a Cline in another editor was never configured, inspected or cleaned. Add one client-table row per editor, resolved through the shared Code-OSS user data rule, and detected where that editor's Cline settings exist. * test(setup): cover VSCODE_PORTABLE for Cline's editor hosts Address review: VSCODE_PORTABLE moves only VS Code's own storage, so the other editors keep their settings path; and the older-release note now says which hosts mcp add could register before. * fix(setup): find a Linux Flatpak Zed's configuration (#10721) * fix(setup): find a Linux Flatpak Zed's configuration Zed's config_dir honors FLATPAK_XDG_CONFIG_HOME first, and a Flathub Zed reads ~/.var/app/dev.zed.Zed/config/zed inside its sandbox. REA always wrote ~/.config/zed, which that Zed never reads. Honor the override, use the sandbox folder when it is the only one, and refuse when both a native and a Flatpak configuration exist. * fix(setup): treat an XDG_CONFIG_HOME naming the Flatpak folder as one Zed folder * fix(setup): treat linked native and Flatpak Zed folders as one configuration * test(setup): expect doctor to report the Amp registration mcp add wrote
78 lines
3.0 KiB
TypeScript
78 lines
3.0 KiB
TypeScript
import { isAbsolute, join, posix, resolve, win32 } from "node:path";
|
|
|
|
import { windowsAppDataRoots } from "./MsixPackageStorage.js";
|
|
|
|
/**
|
|
* Configuration roots that clients derive from environment variables. Each
|
|
* function reproduces one reader's semantics for empty and relative values,
|
|
* named after the code that owns them, so a client location states which rule
|
|
* it follows instead of re-deriving it.
|
|
*/
|
|
export interface ClientRootContext {
|
|
readonly home: string;
|
|
readonly platform: NodeJS.Platform;
|
|
readonly env: Readonly<NodeJS.ProcessEnv>;
|
|
}
|
|
|
|
/**
|
|
* `XDG_CONFIG_HOME || ~/.config`: an empty value is unset and a relative value
|
|
* is kept, resolving against the reader's working directory. This is the
|
|
* xdg-basedir package (OpenCode, Kilo) and VS Code's `getDefaultUserDataPath`
|
|
* on Linux. Clients that do not document their reader also use it; it is not
|
|
* established for them.
|
|
*/
|
|
export const xdgConfigHomeOrDefault = ({
|
|
home,
|
|
env,
|
|
}: Pick<ClientRootContext, "home" | "env">): string =>
|
|
env.XDG_CONFIG_HOME || join(home, ".config");
|
|
|
|
/**
|
|
* The XDG Base Directory rule: only an absolute `XDG_CONFIG_HOME` counts;
|
|
* empty and relative values are invalid and fall back to `~/.config`. This is
|
|
* Rust `dirs::config_dir` on Linux (Zed) and etcetera's XDG strategy (Goose).
|
|
*/
|
|
export const absoluteXdgConfigHome = ({
|
|
home,
|
|
env,
|
|
}: Pick<ClientRootContext, "home" | "env">): string => {
|
|
const value = env.XDG_CONFIG_HOME;
|
|
return value !== undefined && posix.isAbsolute(value)
|
|
? value
|
|
: join(home, ".config");
|
|
};
|
|
|
|
/**
|
|
* Code-OSS's `getUserDataPath` for one product's data folder (`Code` for VS
|
|
* Code; `Cursor`, `Windsurf`, `VSCodium` or `Code - Insiders` for builds that
|
|
* share it): non-empty `VSCODE_PORTABLE` selects portable storage, then
|
|
* non-empty `VSCODE_APPDATA`, then the platform default. A relative result
|
|
* resolves against `VSCODE_CWD`. Extensions such as Cline keep their global
|
|
* storage under this directory. `VSCODE_PORTABLE` describes the portable
|
|
* build that set it, which REA attributes only to VS Code itself.
|
|
*/
|
|
export const vscodeUserDirectory = (
|
|
{ home, platform, env }: ClientRootContext,
|
|
dataFolder = "Code",
|
|
): string => {
|
|
const userData =
|
|
env.VSCODE_PORTABLE && dataFolder === "Code"
|
|
? join(env.VSCODE_PORTABLE, "user-data")
|
|
: env.VSCODE_APPDATA
|
|
? join(env.VSCODE_APPDATA, dataFolder)
|
|
: platform === "win32"
|
|
? join(windowsAppDataRoots(home, env).roaming, dataFolder)
|
|
: platform === "darwin"
|
|
? join(home, "Library", "Application Support", dataFolder)
|
|
: join(xdgConfigHomeOrDefault({ home, env }), dataFolder);
|
|
// The catalog can describe Windows clients on another host; retain its
|
|
// drive-absolute paths instead of resolving them against that host cwd.
|
|
const absoluteUserData =
|
|
platform === "win32" && win32.isAbsolute(userData) && !isAbsolute(userData)
|
|
? userData
|
|
: isAbsolute(userData)
|
|
? resolve(userData)
|
|
: resolve(env.VSCODE_CWD || process.cwd(), userData);
|
|
return join(absoluteUserData, "User");
|
|
};
|