Files
wehub-resource-sync 98e40dac97
CLI Smoke Test / smoke-test-linux (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-linux (24) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (20) (push) Has been cancelled
CLI Smoke Test / smoke-test-windows (24) (push) Has been cancelled
Expo App TypeScript typecheck / typecheck (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:40:49 +08:00

80 lines
2.5 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
echo "=== Testing --continue Flag Fix ==="
echo
# Build first
echo "1. Building project..."
npm run build > /dev/null 2>&1
echo " ✓ Build complete"
echo
# Test session finder logic directly
echo "2. Testing session finder with current directory..."
node -e "
const { resolve, join } = require('path');
const { readdirSync, statSync, readFileSync } = require('fs');
const { homedir } = require('os');
const workingDirectory = process.cwd();
const projectId = resolve(workingDirectory).replace(/[\\\\\\/\.:]/g, '-');
const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR || join(homedir(), '.claude');
const projectDir = join(claudeConfigDir, 'projects', projectId);
const uuidPattern = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\$/i;
const files = readdirSync(projectDir)
.filter(f => f.endsWith('.jsonl'))
.map(f => {
const sessionId = f.replace('.jsonl', '');
if (!uuidPattern.test(sessionId)) return null;
const sessionFile = join(projectDir, f);
const sessionData = readFileSync(sessionFile, 'utf-8').split('\\n');
// Use NEW validation logic (with multi-format support)
const hasGoodMessage = sessionData.some((v) => {
try {
const parsed = JSON.parse(v);
return (typeof parsed.uuid === 'string' && parsed.uuid.length > 0) ||
(typeof parsed.messageId === 'string' && parsed.messageId.length > 0) ||
(typeof parsed.leafUuid === 'string' && parsed.leafUuid.length > 0);
} catch (e) {
return false;
}
});
if (!hasGoodMessage) return null;
return {
name: f,
sessionId: sessionId,
mtime: statSync(sessionFile).mtime.getTime()
};
})
.filter(f => f !== null)
.sort((a, b) => b.mtime - a.mtime);
console.log('Valid sessions found:', files.length);
if (files.length > 0) {
console.log('Most recent session ID:', files[0].sessionId);
} else {
console.log('ERROR: No valid sessions found');
process.exit(1);
}
" || { echo " ✗ Session finder test failed"; exit 1; }
echo " ✓ Session finder working correctly"
echo
echo "=== All Checks Passed ✓ ==="
echo
echo "Fix verified successfully!"
echo
echo "To test --continue in real usage:"
echo " happy --continue \"test continuation\""
echo
echo "To check logs:"
echo " tail -50 ~/.happy/logs/\$(ls -t ~/.happy/logs/ | head -1) | grep -E '(session|continue|resume)'"