import type { IdeDefinition } from "./ide-configs.js"; /** * FLAW-15 FIX: Read version from package.json relative to the dist output, * but fall back to the SERVER_VERSION constant as the single source of truth. * This is resilient to build output structure changes. */ export declare function getInstallerVersion(): string; /** * Generate the Engram server entry tailored to a specific IDE's requirements. * Includes _engram_version so the installer can detect upgrades and legacy installs. * * FLAW-4 FIX: When the IDE definition has a workspaceVar, it is injected as * `--project-root=`. At runtime the IDE expands the variable to the actual * workspace path before spawning the server, so findProjectRoot() receives the * correct root with no heuristics needed. * * ideKey: when provided (global-only IDEs without workspaceVar), `--ide=` is * injected so the server opens a per-IDE DB shard (memory-{key}.db), eliminating * write-lock contention between different IDEs concurrently open on the same project. * * @param ide IDE definition (controls type, cmd wrapper, workspaceVar, etc.) * @param universal When true, adds --mode=universal to args. * @param ideKey When provided, adds --ide= to args. */ export declare function makeEngramEntry(ide: IdeDefinition, universal?: boolean, ideKey?: string, projectRoot?: string): Record; /** * Read and parse a JSON config file. * FLAW-8 FIX: distinguish between "file not found" and "file has invalid JSON". * Returns: * null — file does not exist (safe to create fresh) * object — parsed successfully * Throws ParseError (with .isParseError = true) when the file exists but * contains invalid JSON — callers should warn and bail rather than * silently overwriting the user's config. */ export declare class ConfigParseError extends Error { readonly filePath: string; readonly cause: unknown; constructor(filePath: string, cause: unknown); } export declare function readJson(filePath: string): Record | null; /** * Write a JSON config file, creating parent directories if needed. */ export declare function writeJson(filePath: string, data: any): void; export type InstallResult = "added" | "upgraded" | "exists" | "legacy-upgraded" | "repaired" | "adopted"; /** * Find the key under which an Engram server entry lives in an MCP server map, * whatever it is called. * * OBSERVATION #127. This predicate existed three times, hand-copied, in * index.ts at the status, list and check sites — and `addToConfig` did not use * it at all, testing only `config[key].engram`. The two disagreed, so a config * holding a differently-named entry (`engram-memory`, `memory`, anything the * user typed) reported "installed" from status and then got a SECOND entry from * install. Two entries mean two servers launched against one database, which is * the exact write-lock contention the `--ide=` shard flag exists to prevent, and * `--remove` deleted only the one called `engram` and left the other live. * * Third recurrence of the shape FR-D5 found in the installer's filename rule and * #127 found again here: a rule copied to N sites with nothing that can find * site N+1. One definition, every caller derives from it. */ export declare function findEngramEntryKey(serverMap: Record> | undefined | null): string | undefined; /** * Add or update the Engram entry in a config file. * * FR-D5 T2: THROWS ConfigParseError if the file exists but does not parse. * It never overwrites a config it could not read. The FLAW-8 behaviour this * replaces — back up best-effort, then write a file containing only the Engram * entry — is what made a single trailing comma in ~/.claude.json cost the user * 52 unrelated keys. installToPath (index.ts:897) catches per-IDE, prints the * manual entry, and continues with the other IDEs, so one unreadable config no * longer stops an install and no longer destroys anything. * * Returns: * "added" — fresh install, no prior entry * "exists" — already installed at the same version, no changes made * "upgraded" — updated from an older tracked version to the current one * "legacy-upgraded" — entry existed but had no _engram_version (pre-tracking era) */ export declare function addToConfig(configPath: string, ide: IdeDefinition, universal?: boolean, ideKey?: string, projectRoot?: string): InstallResult; /** * Remove the Engram entry from a config file. * Returns true if the entry was found and removed, false if not present. */ export declare function removeFromConfig(configPath: string, ide: IdeDefinition): boolean; //# sourceMappingURL=config-writer.d.ts.map