* feat(cli): add configurable plansDirectory for Plan Mode
Add a plansDirectory setting that allows users to define a custom
directory for approved Plan Mode files. Relative paths are resolved
against the project root and validated to prevent path traversal.
- Storage: add isPathWithinDirectory() with realpathSync-based symlink
resolution to prevent traversal bypass attacks (direct, intermediate,
and cross-drive)
- Config: cache plansDir at construction time, use atomic write
(write-temp then rename) to prevent corrupted plan files on crash
- CLI: respect bareMode by clearing plansDirectory in minimal mode
- Docs: document plansDirectory with requiresRestart and gitignore hint
- Tests: 26 new tests covering path validation, symlink attacks
(direct and intermediate), Windows cross-drive paths, mixed
separators, and configuration integration
Closes#3548
* fix(core): align symlink test with return value
* fix(core): harden plans directory handling
* fix(config): address PR #4062 review findings for plansDirectory
- Handle EXDEV during atomic plan writes (cross-device rename fallback)
- Sanitize session IDs to prevent path traversal in plan filenames
- Expand tilde (~) in configured plansDirectory paths
- Preserve plansDirectory in bare mode
- Add EACCES/EPERM handling to getPlanFileNames with user-visible warnings
- Close TOCTOU gap with post-write path containment validation
- Fix docs to clarify plansDirectory is a top-level key
- Add happy-path I/O tests for configured plansDirectory