Skip to content

feat(cli): load and validate .tole/config.toml via tole config check - #342

Merged
ajianaz merged 1 commit into
developfrom
feat/config-loader-check
Oct 8, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/config-loader-check

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

What

Part 1 of 3 of the project config file: tole config check loads and validates <cwd>/.tole/config.toml (or --config <path>) and prints every key that is set with its source label. The file is NOT applied to sessions; no flag, env or runtime behavior changes.

Why

Part of #208 (design settled in the 2026-10-08 grilling). Staging: (1) load + validate + check, (2) trust store + prompts, (3) precedence applied everywhere. A strict, tested loader lands first so later parts build on it.

Changes

  • tole-cli only: new toml dep (default-features off; std, parse, display, serde) and workspace serde; tole-core untouched.
  • config.rs: strict schema (deny_unknown_fields, flat snake_case keys + [mission]), 64 KiB bounded read, spanned pre-check rejecting any key containing secret/password/token/api_key at any depth (exact exemption: mission.max_tokens), errors as path:line:col: message.
  • trust.rs: TRUST_PRESETS and expand_trust moved out of main.rs unchanged, so the --trust flag and the loader share one rule.
  • tole config check [--config <path>] (ConfigAction enum for later variants); handled before any session/env state and without the update banner.
  • README "Configuration (project file)" section, CHANGELOG entry; README status and epics deliberately not marked done.

Testing

  • 13 unit tests (round trip, empty, unknown key, secrets incl. nested/odd case, wrong type with line/col, trust presets via the shared function, malformed TOML, 64 KiB cap, discovery) + 5 end-to-end tests of the built binary.
  • Mutation check: removing deny_unknown_fields fails the unknown-key test; removing the secret pre-check fails the secret test.
  • --help of all existing commands byte-identical; only config is added to the top-level list.
  • fmt, clippy -D warnings, cargo test --workspace, bare/shell-tools checks, cora review --staged (no issues), cargo audit (no new advisories).

Part of #208

🤖 Generated with Claude Code

Part 1 of 3 of #208: strict loader (deny_unknown_fields, secret-key
pre-check at any depth, 64 KiB bounded read, trust presets validated by
the shared expand_trust) and the `tole config check` subcommand. The
file is NOT applied to sessions yet. The trust preset table and
expand_trust move from main.rs to a lib module so the flag and the
loader share one source of truth (no behavior change).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 8f43a4c into develop Oct 8, 2026
17 checks passed
@ajianaz
ajianaz deleted the feat/config-loader-check branch October 9, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant