Add a root /cfg file to the 9P namespace backed by a TOML config file on
physical storage, so clients can read and change server settings without
restarting. The first setting is org_path: the directory scanned for org
files, with a leading ~ expanded to $HOME.
New config module (config.rs):
- Resolve the config file at $XDG_CONFIG_HOME/orkmode/config.toml, else
~/.config/orkmode/config.toml.
- expand_tilde(), read_raw(), write_raw(), parse(), and load().
- Config holds an optional org_path. Unit tests cover tilde expansion
(bare ~, ~/sub, non-tilde, ~user left intact) and TOML parsing.
Mutable org directory (state.rs):
- org_dir becomes an RwLock<PathBuf> with an org_dir() getter and a
set_org_dir() that validates the directory and rescans.
- config_raw() backs the /cfg read; apply_config() validates the TOML and
the target directory, applies org_path, then persists. A rejected write
(bad TOML or missing directory) never reaches disk and never mutates
state.
Namespace (namespace.rs):
- /cfg is a read+write file: read returns the raw config, write calls
apply_config.
Startup (ork-server.rs):
- With no -d/positional directory, fall back to the config file's
org_path (tilde-expanded), else the current directory. An explicit CLI
directory still takes precedence. Help text documents the config file.
Verified over 9P with an isolated HOME: /cfg reads empty on a fresh
install; writing org_path="~/org" expands the tilde and live-switches the
served documents; absolute paths work; nonexistent directories and
invalid TOML are rejected without changing state or disk; the setting
persists; and a no-flag restart loads org_path from the config file.
Server tests: 61 passed.