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): 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"; /** * Add or update the Engram entry in a config file. * FLAW-8 FIX: if the config file exists but has invalid JSON, back it up * before overwriting so the user doesn't lose their other tool configs. * * 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): 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