Files
triqura-ecd/lib/cortex/verify-parser.ts
colinislit 2170b23348 refactor: rename swift → cortex in code and documentation
Complete rename of "swift" terminology to "cortex" across the codebase:

Code Changes:
- Rename directories: lib/swift → lib/cortex, components/swift → components/cortex
- Rename API routes: /api/swift/* → /api/cortex/*
- Rename page routes: /epd/swift → /epd/cortex
- Rename store: swift-store.ts → cortex-store.ts

Type Renames:
- SwiftIntent → CortexIntent
- SwiftStore → CortexStore
- useSwiftStore → useCortexStore
- SwiftContext → CortexContext
- useSwiftVoice → useCortexVoice

Documentation Updates (docs/intent/):
- Safety Net → Nudge (Layer 3 rename)
- SafetySuggestion → NudgeSuggestion
- evaluateSafetyNet → evaluateNudge
- SWIFT_* feature flags → CORTEX_*
- All path references updated to match new structure

Files affected: 47 files, ~700 lines changed

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 09:18:06 +01:00

94 lines
2.2 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Manual verification script for date-time parser
* Run with: pnpm tsx lib/cortex/verify-parser.ts
*/
import {
parseRelativeDate,
parseTime,
isDateRange,
combineDatetime,
isNotInPast,
} from './date-time-parser';
import { format } from 'date-fns';
import { nl } from 'date-fns/locale';
console.log('🧪 Testing Date/Time Parser\n');
// Test parseRelativeDate
console.log('📅 Testing parseRelativeDate():\n');
const dateTests = [
'vandaag',
'morgen',
'overmorgen',
'maandag',
'dinsdag',
'deze week',
'volgende week',
'30 december',
'2024-12-28',
'28-12-2024',
];
dateTests.forEach((input) => {
const result = parseRelativeDate(input);
if (result === null) {
console.log(` ❌ "${input}" → null`);
} else if (isDateRange(result)) {
console.log(` ✅ "${input}" → Range: ${format(result.start, 'dd MMM', { locale: nl })} - ${format(result.end, 'dd MMM', { locale: nl })}`);
} else {
console.log(` ✅ "${input}" → ${format(result, 'EEEE dd MMMM yyyy', { locale: nl })}`);
}
});
// Test parseTime
console.log('\n⏰ Testing parseTime():\n');
const timeTests = [
'14:00',
'14',
'twee uur',
'half drie',
'kwart over twee',
'kwart voor drie',
'ochtend',
'middag',
'avond',
];
timeTests.forEach((input) => {
const result = parseTime(input);
if (result === null) {
console.log(` ❌ "${input}" → null`);
} else {
console.log(` ✅ "${input}" → ${result}`);
}
});
// Test combineDatetime
console.log('\n🔗 Testing combineDatetime():\n');
const morgen = parseRelativeDate('morgen');
if (morgen && !isDateRange(morgen)) {
const combined = combineDatetime(morgen, '14:00');
console.log(` ✅ morgen + 14:00 → ${combined}`);
}
// Test isNotInPast
console.log('\n✔ Testing isNotInPast():\n');
const today = new Date();
const tomorrow = parseRelativeDate('morgen');
const yesterday = parseRelativeDate('gisteren');
console.log(` Today: ${isNotInPast(today)} (expected: true)`);
if (tomorrow && !isDateRange(tomorrow)) {
console.log(` Tomorrow: ${isNotInPast(tomorrow)} (expected: true)`);
}
if (yesterday && !isDateRange(yesterday)) {
console.log(` Yesterday: ${isNotInPast(yesterday)} (expected: false)`);
}
console.log('\n✅ Verification complete!');