fix(hooks): guard detached trail-refresh logging on WorktreeRoot

main

Commit

suhaanthayyil2mo ago

newRefreshTrailEnablementCmd initialized file logging unconditionally, unlike resume/rewind/reset/explain, which guard on paths.WorktreeRoot first to avoid creating .entire/logs/ in arbitrary directories. logging.Init falls back to the current directory when WorktreeRoot fails, so a detached child whose worktree was removed or relocated between spawn and exec — or a manual invocation outside a repo — would MkdirAll a stray .entire/logs/ wherever it happened to run. Wrap the logging setup in the same WorktreeRoot guard, mutation-verified by a test that runs the command in a non-worktree temp dir and asserts no .entire/logs appears.