mirror of
https://github.com/Jeuners/ECC.git
synced 2026-09-09 15:02:30 +02:00
fix: 2 bugs fixed, 17 tests added for hook scripts
Bug fixes: - evaluate-session.js: whitespace-tolerant regex for counting user messages in JSONL transcripts (/"type":"user"/ → /"type"\s*:\s*"user"/) - session-end.js: guard against null elements in content arrays (c.text → (c && c.text) to prevent TypeError) New tests (17): - evaluate-session: whitespace JSON regression test - session-end: null content array elements regression test - post-edit-console-warn: 5 tests (warn, skip non-JS, clean files, missing file, stdout passthrough) - post-edit-format: 3 tests (empty stdin, non-JS skip, invalid JSON) - post-edit-typecheck: 4 tests (empty stdin, non-TS skip, missing file, no tsconfig) Total test count: 191 (up from 164)
This commit is contained in:
parent
380fd09b77
commit
90ea2f327c
3 changed files with 152 additions and 3 deletions
|
|
@ -81,8 +81,8 @@ async function main() {
|
|||
process.exit(0);
|
||||
}
|
||||
|
||||
// Count user messages in session
|
||||
const messageCount = countInFile(transcriptPath, /"type":"user"/g);
|
||||
// Count user messages in session (allow optional whitespace around colon)
|
||||
const messageCount = countInFile(transcriptPath, /"type"\s*:\s*"user"/g);
|
||||
|
||||
// Skip short sessions
|
||||
if (messageCount < minSessionLength) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ function extractSessionSummary(transcriptPath) {
|
|||
const text = typeof entry.content === 'string'
|
||||
? entry.content
|
||||
: Array.isArray(entry.content)
|
||||
? entry.content.map(c => c.text || '').join(' ')
|
||||
? entry.content.map(c => (c && c.text) || '').join(' ')
|
||||
: '';
|
||||
if (text.trim()) {
|
||||
userMessages.push(text.trim().slice(0, 200));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue