Phase 1 foundation. Adds:
- internal/config/configfile.go — strict-key YAML parser for the
global config file. Unknown top-level keys invalidate the entire
file (no partial apply); future schema versions are rejected with
an upgrade message. Platform-appropriate path (XDG_CONFIG_HOME or
~/.config on Unix, %APPDATA% on native Windows).
- internal/config/resolver.go — Resolver / ResolvedSetting /
SettingSource (Builtin, ConfigFileSrc, EnvVar, CLIFlag,
PlatformOverride). Each setting carries provenance plus an
Override chain so callers can render "env var (overrides config
file: X)" lines. session_mode applies the native-Windows
platform override at the resolver layer with the configured
value chained as Override. Exports SetConfigPathForTest and
SetIsNativeWindowsForTest so cross-package tests can isolate
themselves from host config or simulate the override.
- internal/config/config.go — legacy ResolveRoot / ResolveAgent /
ResolveSeedDir / ResolveProjectRoot / ResolveSessionMode now
delegate to LoadResolver so config-file values take effect for
entry commands. ResolveProjectRoot preserves the "" sentinel for
built-in source so SearchRoots and doctor checkProjectRoot keep
their existing fallback semantics. ResolveSessionMode preserves
the v0.5.3 unknown-value stderr warning, distinguishing env-var
and config-file sources in the message.
- Tests: 6 LoadConfigFile cases (missing, basic, partial, unknown
key, future schema, malformed YAML), 3 ConfigFilePath cases
(XDG / ~/.config / %APPDATA%), 11 resolver cases including
layering, override chains, path expansion, platform override,
and SettingSource string rendering.
- Test isolation: vulnerable tests in config_test.go and
config_roots_test.go that asserted Builtin-source defaults now
call SetConfigPathForTest to point at a nonexistent path,
insulating them from developer-host config files. Three cmd
tests that asserted persistent session_mode behavior now call
SetIsNativeWindowsForTest to disable the platform override
(Phase 1 introduces the override; the layering-only behavior
these tests cover is tested separately in resolver_test.go).
No new dependencies (gopkg.in/yaml.v3 was already in go.mod).
No version bump (lands at the end of Phase 3 per the v0.6 spec).