refactor: extend TOML parser for nested tables, inline tables, and JSON arrays

- Add support for nested table headers ([tools.shell], [tools.file_read], etc.)
- Add support for inline tables (capabilities = { General = 1.0, Coding = 0.7 })
- Add support for JSON-style arrays (shell_allowed_executables = ["bash", "sh"])
- Maintain backward compatibility with old CSV formats (deprecated, logged as warnings)
- Refactor buildConfig() to handle new value types (Map, List, Boolean, Number)
- Update docs/sample-config.toml to use clean TOML shapes
- Add comprehensive tests for inline tables, nested sections, JSON arrays, and fallback parsing
- Remove ugly workarounds: capabilities no longer a CSV string, tool flags now in proper nested sections
This commit is contained in:
2026-05-30 01:13:36 +04:00
parent 9f171d3236
commit 0834c705fd
3 changed files with 507 additions and 23 deletions
+52
View File
@@ -0,0 +1,52 @@
# CORREX Configuration Sample
# Place at ~/.config/correx/config.toml
[server]
host = "localhost"
port = 8080
[tui]
theme = "dark"
session_list_limit = 5
[cli]
default_output = "human"
[approval]
timeout_ms = 300000
[tools]
sandbox_root = "~/.config/correx/sandbox"
working_dir = "/tmp"
default_system_prompt_path = "~/.config/correx/prompts/default_system.md"
[tools.shell]
enabled = true
allowed_executables = ["bash", "sh", "python3", "node"]
[tools.file_read]
enabled = true
[tools.file_write]
enabled = true
[tools.file_edit]
enabled = true
# Provider configuration (array of tables)
[[providers]]
id = "local-llama"
type = "llamacpp"
model_id = "mistral-7b"
model_path = "~/models/mistral-7b-gguf/model.gguf"
url = "http://127.0.0.1:10000"
capabilities = { General = 1.0, Coding = 0.7, Reasoning = 0.6, Summarization = 0.8, ToolCalling = 0.5 }
# Example: second provider (if you have multiple)
# [[providers]]
# id = "alternative-llama"
# type = "llamacpp"
# model_id = "neural-chat-7b"
# model_path = "~/models/neural-chat-7b-gguf/model.gguf"
# url = "http://127.0.0.1:10001"
# capabilities = { General = 0.9, Coding = 0.8, Reasoning = 0.7, Summarization = 0.75, ToolCalling = 0.6 }