Skip to content

Add --fresh-logs flag and fresh_logs config to truncate logs on start - #47

Merged
hiyamamo merged 2 commits into
mainfrom
logs-truncate-cli
Jul 19, 2026
Merged

hiyamamo merged 2 commits into
mainfrom
logs-truncate-cli

Conversation

@hiyamamo

Copy link
Copy Markdown
Owner

Summary

  • Logs grow by appending across runs with no CLI-side cleanup (only the MCP truncate_log tool, per ログ肥大対策: truncate オプションまたはローテーション #36). ws-dev server --fresh-logs — or fresh_logs: true in the repo's config entry — now truncates every *.log in the log dir at start.
  • Ordering is deliberate: truncation happens after the prior server is stopped (nothing is writing to the logs) and before setup runs, so a fresh run's logs contain only that run.
  • In background mode the flag passes through to the detached child. The child truncating its own server.log is safe because the parent opened it with O_APPEND (writes reposition to the new EOF).
  • Non-*.log files in the log dir are untouched; a missing log dir is a no-op.
  • SKILL.md / README / CLAUDE.md updated (flag, config key, and a note that logs otherwise append forever).

Closes #36

Test plan

  • New TestTruncateLogs: empties *.log, leaves other files alone, missing dir is a no-op
  • fresh_logs parsing asserted in the existing config round-trip test
  • make check passes

🤖 Generated with Claude Code

hiyamamo and others added 2 commits July 19, 2026 19:07
Logs previously grew by appending across every run with no built-in way
to clean them from the CLI (only the MCP truncate_log tool). `ws-dev
server --fresh-logs`, or `fresh_logs: true` in the repo config, now
truncates every *.log in the log dir on start — after the prior server
is stopped (so nothing is writing) and before setup runs. The flag
passes through to the detached child in background mode, where
truncating its own O_APPEND server.log is safe.

Closes #36

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@hiyamamo
hiyamamo merged commit 29effcb into main Jul 19, 2026
3 checks passed
@hiyamamo
hiyamamo deleted the logs-truncate-cli branch July 19, 2026 10:08
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.

ログ肥大対策: truncate オプションまたはローテーション

1 participant