ECC/scripts/hooks
will e000bbe5e4
fix(session-end): always update session summary content (#317)
* fix(session-end): always update session summary content

Previously, session-end.js would only write content to session files
on first creation. Subsequent sessions would only update the timestamp,
causing stale content (e.g., old tasks, resolved issues) to persist
indefinitely.

This fix ensures that every session end updates the summary section
with fresh content from the current transcript, keeping cross-session
context accurate and relevant.

Fixes: #187 (partially - addresses stale content issue)

Changes:
- Remove the blank-template-only check
- Replace entire Session Summary section on every session end
- Keep timestamp update separate from content update

* fix(session-end): match both summary headers and prevent duplicate stats

Fixes two issues identified in PR #317 code review:

1. CodeRabbit: Updated regex to match both `## Session Summary` and
   `## Current State` headers, ensuring files created from blank template
   can be updated with fresh summaries.

2. Cubic: Changed regex lookahead `(?=### Stats|$)` to end-of-string `$`
   to prevent duplicate `### Stats` sections. The old pattern stopped before
   `### Stats` without consuming it, but buildSummarySection() also emits
   a `### Stats` block, causing duplication on each session update.

Changes:
- Regex now: `/## (?:Session Summary|Current State)[\s\S]*?$/`
- Matches both header variants used in blank template and populated sessions
- Matches to end-of-string to cleanly replace entire summary section

---------

Co-authored-by: will <will@192.168.5.31>
2026-03-02 22:00:33 -08:00
..
check-console-log.js Fix stdin overflow bug in hook scripts - truncate chunks to stay within MAX_STDIN limit 2026-02-18 07:40:12 +00:00
evaluate-session.js Fix stdin overflow bug in hook scripts - truncate chunks to stay within MAX_STDIN limit 2026-02-18 07:40:12 +00:00
post-edit-console-warn.js Merge branch 'affaan-m:main' into main 2026-02-18 18:33:04 +05:30
post-edit-format.js Merge pull request #252 from pythonstrup/feat/auto-detect-formatter 2026-02-24 09:24:15 -08:00
post-edit-typecheck.js Fix stdin overflow bug in hook scripts - truncate chunks to stay within MAX_STDIN limit 2026-02-18 07:40:12 +00:00
pre-compact.js fix: nullish coalescing in evaluate-session config, narrow pre-compact glob, add 11 tests 2026-02-13 02:42:01 -08:00
pre-write-doc-warn.js fix(hooks): extract doc-warning hook to external script to fix CI 2026-02-26 18:46:06 -08:00
session-end.js fix(session-end): always update session summary content (#317) 2026-03-02 22:00:33 -08:00
session-start.js fix: remove unused fs imports in 3 hook scripts 2026-02-12 15:33:51 -08:00
suggest-compact.js fix: consistent periodic interval spacing in suggest-compact, add 10 tests 2026-02-13 02:45:08 -08:00