consciousness/src
Kent Overstreet 7ef02c97d1 config_writer: emit pretty multi-line sections, drop json5 crate
Previously when append_kvp created a new section or added a key, it
stuffed the "\n    " separator into the new kvp's wsc.0 (the whitespace
between its own key and colon) instead of the prior kvp's wsc.3 (the
whitespace after the prior trailing comma). Result looked like:

    lsp_servers: [...],
    learn

        : {generate_alternates
            : true,},}

The writer also didn't set any interior whitespace on the new section's
JSONObjectContext, so everything crammed onto one line — `{key: val,}`
compact, not `{\n    key: val,\n}` multi-line.

Rewrote the appender as append_kvp_pretty(object, key, value,
inner_indent, outer_indent):
- separator between kvps goes in the prior kvp's wsc.3, or if we're the
  first kvp in a fresh object, in the object's own wsc.0 (after its
  opening `{`)
- new kvp's wsc.3 carries `,\n<outer_indent>` so the parent's closing
  `}` lands correctly indented
- interior indent vs outer indent are both explicit, so we don't have
  to rewrite this logic every time we add another nesting level

New tests: new_section_exact_multiline_layout asserts byte-exact
output shape; new_section_and_key_format_cleanly verifies no key wraps
to the next line. Prior tests just substring-matched and happily passed
on the broken output — that's why this shipped in the first place.

Also: dropped the json5 crate dependency. json-five's serde feature
(default) provides the same from_str / to_string API. One fewer
dependency, and the two were doing the same job.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
2026-04-16 13:08:19 -04:00
..
agent context: tighten timestamp schema; every AstNode has one 2026-04-16 12:35:16 -04:00
bin context: tighten timestamp schema; every AstNode has one 2026-04-16 12:35:16 -04:00
cli Simplify context config: personality_nodes and agent_nodes 2026-04-15 02:37:49 -04:00
hippocampus store: add weight to index, index-only key matching 2026-04-15 05:14:04 -04:00
learn rust edition 2024 2026-04-05 06:20:16 -04:00
mind config: global writable AppConfig; learn settings live there 2026-04-16 12:53:22 -04:00
subconscious config: global writable AppConfig; learn settings live there 2026-04-16 12:53:22 -04:00
thalamus hours_since_last_dream: return 0 if dream in progress 2026-04-15 21:58:03 -04:00
user config: global writable AppConfig; learn settings live there 2026-04-16 12:53:22 -04:00
config.rs config_writer: emit pretty multi-line sections, drop json5 crate 2026-04-16 13:08:19 -04:00
config_writer.rs config_writer: emit pretty multi-line sections, drop json5 crate 2026-04-16 13:08:19 -04:00
lib.rs config_writer: json5 round-trip editing via json-five 2026-04-16 11:48:47 -04:00
locks.rs locks: add process-wide lock hold time tracking 2026-04-12 20:27:42 -04:00
main.rs cli: add 'node restore' command for undeleting nodes 2026-04-15 01:40:29 -04:00
mcp_server.rs memory.rs: clean up store access and tool dispatch 2026-04-13 14:27:38 -04:00
session.rs delete claude code integration 2026-04-09 19:58:07 -04:00
util.rs delete 20 dead public functions across 12 files 2026-04-02 16:21:01 -04:00