Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

fix(setup): preserve unrelated Hermes YAML line formatting

zayd / cold58e91e14bd56
diff --git a/src/application/ClientConfigurationDocument.ts b/src/application/ClientConfigurationDocument.ts
index c7f13ba66..a6a16f96c 100644
--- a/src/application/ClientConfigurationDocument.ts
+++ b/src/application/ClientConfigurationDocument.ts
@@ -1342,7 +1342,8 @@ const serializeHermesConfiguration = (
if (entry === undefined)
yamlDocument.deleteIn([serversKey, PRODUCT_IDENTITY.mcpServerKey]);
else yamlDocument.setIn([serversKey, PRODUCT_IDENTITY.mcpServerKey], entry);
- return yamlDocument.toString();
+ // Editing REA must not reflow unrelated user prompts or other YAML scalars.
+ return yamlDocument.toString({ lineWidth: 0 });
};
/** Build the stdio entry shape expected by one client's configuration dialect. */
diff --git a/tests/boundary/filesystem/hermesClientConfiguration.test.ts b/tests/boundary/filesystem/hermesClientConfiguration.test.ts
index e2f2cf74c..20db28d9a 100644
--- a/tests/boundary/filesystem/hermesClientConfiguration.test.ts
+++ b/tests/boundary/filesystem/hermesClientConfiguration.test.ts
@@ -151,6 +151,29 @@ mcp_servers:
});
});
+ it("keeps unrelated long YAML scalars on their original lines", async () => {
+ const { home, client } = await hermesClient();
+ const prompt = "Keep this sentence on one line. ".repeat(8).trim();
+ const original = `# Hermes configuration
+model:
+ personality: ${prompt}
+mcp_servers:
+ other:
+ command: other-server
+`;
+ await writeFile(client.configPath, original);
+ expect(
+ (await configureClientConfiguration(client, {}, command)).status,
+ ).toBe("configured");
+ const text = await readFile(client.configPath, "utf8");
+ expect(text).toContain(` personality: ${prompt}\n`);
+ expect(parseYaml(text)).toMatchObject({ model: { personality: prompt } });
+ expect((await systemUninstallHost(home).removeClient(client)).status).toBe(
+ "removed",
+ );
+ expect(await readFile(client.configPath, "utf8")).toBe(original);
+ });
+
it("creates config.yaml when Hermes has no configuration yet", async () => {
const { client } = await hermesClient();
expect(