Upstream bug: codegraph install --target hermes corrupts YAML indentation
- Repo: colbymchenry/codegraph
- Version: v0.9.4
- File: src/installer/targets/hermes.ts →
upsertCodeGraphToolset()
Repro
Given this Hermes config (~/.hermes/config.yaml):
platform_toolsets:
cli:
- hermes-cli
- mcp-automator
Running codegraph install --target hermes produces:
platform_toolsets:
cli:
- hermes-cli
- mcp-automator
- mcp-codegraph
The inserted - mcp-codegraph uses 4-space indent, while
the existing cli: children use 2-space indent (aligned to the
cli: key). This mixed indentation can cause downstream YAML
parsers to misinterpret the structure.
Root cause
src/installer/targets/hermes.ts, upsertCodeGraphToolset():
// Line ~280: hardcoded 4-space indent, regardless of existing cli: style
lines.splice(cli.end, 0, ' - mcp-codegraph');
The same hardcoded 4-space indent appears at lines 268 and 272
for the fresh-creation paths.
Suggested fix
Detect the indentation of existing cli: children before appending.
Pseudo-diff:
// Detect existing indent from cli: children
const cliIndent = detectChildIndent(lines, cli);
// Use matching indent
lines.splice(cli.end, 0, `${cliIndent}- mcp-codegraph`);
Where detectChildIndent() looks at the whitespace prefix of
lines between cli.start+1 and cli.end to find the dominant
indentation level used by existing - prefixed items.
Upstream bug: codegraph install --target hermes corrupts YAML indentation
upsertCodeGraphToolset()Repro
Given this Hermes config (
~/.hermes/config.yaml):Running
codegraph install --target hermesproduces:The inserted
- mcp-codegraphuses 4-space indent, whilethe existing
cli:children use 2-space indent (aligned to thecli:key). This mixed indentation can cause downstream YAMLparsers to misinterpret the structure.
Root cause
src/installer/targets/hermes.ts,upsertCodeGraphToolset():The same hardcoded 4-space indent appears at lines 268 and 272
for the fresh-creation paths.
Suggested fix
Detect the indentation of existing
cli:children before appending.Pseudo-diff:
Where
detectChildIndent()looks at the whitespace prefix oflines between
cli.start+1andcli.endto find the dominantindentation level used by existing
-prefixed items.