numerology/compatibility.ts
rpriven fd6e171586
Add comprehensive numerology calculator with 10 specialized tools
- Core calculations (Life Path, Expression, Soul Urge, Birthday)
- Advanced numbers (Maturity, Personality, Hidden Passion, Karmic Lessons)
- Timing cycles and optimal days finder
- Compatibility analysis and name optimizer
- Telos integration for personal development
- Professional PDF report generation
- Profile management system
- Security fix: Add .claude/ to .gitignore

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-01 14:00:15 -06:00

415 lines
20 KiB
TypeScript
Executable file

#!/usr/bin/env bun
/**
* Numerology Compatibility Analyzer
*
* Compare two people's numerology charts to understand relationship dynamics,
* strengths, challenges, and best collaboration strategies.
*
* Perfect for: Romantic relationships, business partnerships, parent-child dynamics,
* team collaboration, friendships, and any two-person dynamic.
*
* Usage:
* bun compatibility.ts --person1 "John Doe:5/13/1982" --person2 "Jane Smith:11/22/1990"
* bun compatibility.ts --p1 "Alice:3/14/1985" --p2 "Bob:7/7/1980" --type business
*/
import { calculateCoreNumbers, type CoreNumbers } from './core-calculator';
// Parse command line arguments
const args = process.argv.slice(2);
let person1Data = '';
let person2Data = '';
let relationshipType = 'general';
for (let i = 0; i < args.length; i++) {
if ((args[i] === '--person1' || args[i] === '--p1') && args[i + 1]) {
person1Data = args[i + 1];
i++;
} else if ((args[i] === '--person2' || args[i] === '--p2') && args[i + 1]) {
person2Data = args[i + 1];
i++;
} else if ((args[i] === '--type' || args[i] === '-t') && args[i + 1]) {
relationshipType = args[i + 1].toLowerCase();
i++;
} else if (args[i] === '--help' || args[i] === '-h') {
console.log(`
Numerology Compatibility Analyzer
Compare two people's numerology charts for relationship insights.
USAGE:
bun compatibility.ts --person1 "Name:mm/dd/yyyy" --person2 "Name:mm/dd/yyyy"
OPTIONS:
--person1, --p1 First person (format: "Name:mm/dd/yyyy")
--person2, --p2 Second person (format: "Name:mm/dd/yyyy")
--type, -t Relationship type [general, romantic, business, family, friendship]
--help, -h Show this help message
EXAMPLES:
# Romantic relationship
bun compatibility.ts --p1 "John:5/13/1982" --p2 "Jane:11/22/1990" --type romantic
# Business partnership
bun compatibility.ts --p1 "Alice:3/14/1985" --p2 "Bob:7/7/1980" --type business
# General compatibility
bun compatibility.ts --p1 "Parent:1/1/1970" --p2 "Child:5/15/2010"
RELATIONSHIP TYPES:
general - Overall compatibility analysis
romantic - Love, marriage, intimate partnership
business - Work collaboration, business partners
family - Parent-child, siblings, relatives
friendship - Platonic relationships, social bonds
`);
process.exit(0);
}
}
if (!person1Data || !person2Data) {
console.error('Error: Both --person1 and --person2 are required');
console.error('Format: "Name:mm/dd/yyyy"');
console.error('Try: bun compatibility.ts --help');
process.exit(1);
}
// Parse person data
function parsePerson(data: string): { name: string; birthdate: string } {
const parts = data.split(':');
if (parts.length !== 2) {
console.error(`Error: Invalid format "${data}". Expected "Name:mm/dd/yyyy"`);
process.exit(1);
}
return { name: parts[0].trim(), birthdate: parts[1].trim() };
}
const person1 = parsePerson(person1Data);
const person2 = parsePerson(person2Data);
// Calculate core numbers for both
const chart1 = calculateCoreNumbers(person1.name, person1.birthdate);
const chart2 = calculateCoreNumbers(person2.name, person2.birthdate);
// Compatibility scoring
interface CompatibilityScore {
lifePath: number;
expression: number;
soulUrge: number;
overall: number;
}
function calculateCompatibility(c1: CoreNumbers, c2: CoreNumbers): CompatibilityScore {
const lifePath = scoreNumberPair(c1.lifePath, c2.lifePath);
const expression = scoreNumberPair(c1.expression, c2.expression);
const soulUrge = scoreNumberPair(c1.soulUrge, c2.soulUrge);
// Overall is weighted average (Life Path most important)
const overall = Math.round((lifePath * 0.4 + expression * 0.3 + soulUrge * 0.3));
return { lifePath, expression, soulUrge, overall };
}
// Score number pair compatibility (1-10 scale)
function scoreNumberPair(n1: number, n2: number): number {
// Reduce master numbers to base for compatibility
const num1 = n1 > 9 ? (n1 === 11 ? 2 : n1 === 22 ? 4 : 6) : n1;
const num2 = n2 > 9 ? (n2 === 11 ? 2 : n2 === 22 ? 4 : 6) : n2;
// Same number = high compatibility
if (num1 === num2) return 9;
// Compatibility matrix (simplified)
const compatibilityMatrix: Record<number, Record<number, number>> = {
1: { 2: 6, 3: 8, 4: 5, 5: 7, 6: 6, 7: 7, 8: 8, 9: 7 },
2: { 1: 6, 3: 7, 4: 8, 5: 5, 6: 9, 7: 6, 8: 8, 9: 8 },
3: { 1: 8, 2: 7, 4: 6, 5: 9, 6: 8, 7: 6, 8: 7, 9: 9 },
4: { 1: 5, 2: 8, 3: 6, 5: 6, 6: 8, 7: 7, 8: 9, 9: 6 },
5: { 1: 7, 2: 5, 3: 9, 4: 6, 6: 6, 7: 8, 8: 7, 9: 7 },
6: { 1: 6, 2: 9, 3: 8, 4: 8, 5: 6, 7: 7, 8: 7, 9: 9 },
7: { 1: 7, 2: 6, 3: 6, 4: 7, 5: 8, 6: 7, 8: 6, 9: 8 },
8: { 1: 8, 2: 8, 3: 7, 4: 9, 5: 7, 6: 7, 7: 6, 9: 7 },
9: { 1: 7, 2: 8, 3: 9, 4: 6, 5: 7, 6: 9, 7: 8, 8: 7 }
};
return compatibilityMatrix[num1]?.[num2] || 5;
}
// Compatibility descriptions
function getCompatibilityLevel(score: number): { level: string; emoji: string; description: string } {
if (score >= 9) return {
level: 'Excellent',
emoji: '💚',
description: 'Natural harmony and strong connection'
};
if (score >= 7) return {
level: 'Very Good',
emoji: '💙',
description: 'Compatible with minor adjustments needed'
};
if (score >= 5) return {
level: 'Moderate',
emoji: '💛',
description: 'Workable with conscious effort'
};
if (score >= 3) return {
level: 'Challenging',
emoji: '🧡',
description: 'Requires significant work and understanding'
};
return {
level: 'Difficult',
emoji: '❤️',
description: 'Major differences need bridging'
};
}
// Life Path compatibility insights
const lifePathInsights: Record<string, { strengths: string[]; challenges: string[]; advice: string }> = {
'1-1': {
strengths: ['Both independent and driven', 'Mutual respect for ambition', 'High energy dynamic'],
challenges: ['Power struggles possible', 'Both want to lead', 'Competitive tension'],
advice: 'Take turns leading. Create separate domains where each person has authority.'
},
'1-2': {
strengths: ['1 leads, 2 supports perfectly', 'Complementary energies', '1 inspires, 2 refines'],
challenges: ['2 may feel overshadowed', '1 may seem too aggressive', 'Balance of power needed'],
advice: '1: Value 2\'s input. 2: Speak up when needed. Balance independence with togetherness.'
},
'2-2': {
strengths: ['Deep emotional connection', 'Both diplomatic and sensitive', 'Natural harmony'],
challenges: ['Both indecisive', 'May avoid necessary conflict', 'Codependence risk'],
advice: 'Practice making decisions independently. One person take charge when needed.'
},
'3-3': {
strengths: ['Creative synergy', 'Fun and social together', 'Inspiring partnership'],
challenges: ['Both scattered', 'Lack of grounding', 'Too much surface, not enough depth'],
advice: 'Build in structure. Balance fun with responsibility. Ground your creativity.'
},
'3-5': {
strengths: ['Excitement and adventure', 'Freedom-loving duo', 'Creative exploration'],
challenges: ['Both avoid routine', 'Lack of stability', 'Commitment issues'],
advice: 'Establish some routines together. Balance adventure with security.'
},
'4-4': {
strengths: ['Both reliable and stable', 'Build solid foundations together', 'Shared work ethic'],
challenges: ['Both rigid', 'Too routine', 'Lack of spontaneity'],
advice: 'Schedule fun and adventure. Allow flexibility. Don\'t let work consume everything.'
},
'4-8': {
strengths: ['Powerful building duo', 'Material success likely', 'Ambitious partnership'],
challenges: ['Both workaholic', 'Emotions neglected', 'All work, no play'],
advice: 'Prioritize emotional connection. Balance ambition with intimacy.'
},
'5-5': {
strengths: ['Freedom and change', 'Adventurous partnership', 'Never boring'],
challenges: ['No stability', 'Commitment difficult', 'Restless energy'],
advice: 'Create flexible commitments. Establish home base. Ground your freedom.'
},
'6-6': {
strengths: ['Nurturing and caring', 'Home and family focused', 'Service-oriented'],
challenges: ['Both controlling', 'Martyr complex', 'Neglect of self'],
advice: 'Practice receiving. Set boundaries. Take care of yourselves too.'
},
'6-9': {
strengths: ['Service and compassion', 'Humanitarian goals', 'Caring partnership'],
challenges: ['Both give too much', 'Boundary issues', 'Burnout risk'],
advice: 'Fill your own cup first. Say no sometimes. Balance giving with receiving.'
},
'7-7': {
strengths: ['Deep intellectual bond', 'Spiritual connection', 'Mutual understanding'],
challenges: ['Both withdraw', 'Isolation together', 'Lack of action'],
advice: 'Engage with the world. Balance introspection with activity. Share your thoughts.'
},
'8-8': {
strengths: ['Power couple', 'Material success', 'Ambitious partnership'],
challenges: ['Power struggles', 'Both controlling', 'Work over relationship'],
advice: 'Create separate domains. Balance power. Make time for intimacy.'
},
'9-9': {
strengths: ['Humanitarian vision', 'Compassionate partnership', 'Idealistic goals'],
challenges: ['Both emotionally complex', 'Drama potential', 'Impractical together'],
advice: 'Stay grounded. Balance idealism with practicality. Clear boundaries.'
},
'1-3': {
strengths: ['Action meets creativity', '1 executes 3\'s ideas', 'Dynamic energy'],
challenges: ['1 too serious for 3', '3 too scattered for 1', 'Different paces'],
advice: '1: Lighten up. 3: Follow through. Appreciate different strengths.'
},
'1-5': {
strengths: ['Freedom-loving duo', 'Adventurous partnership', 'Independent together'],
challenges: ['Both self-focused', 'Commitment issues', 'Competitive'],
advice: 'Make time for togetherness. Balance independence with intimacy.'
},
'2-6': {
strengths: ['Nurturing harmony', 'Both caring', 'Natural partnership'],
challenges: ['Both give too much', 'Codependence risk', 'Need to receive'],
advice: 'Practice receiving. Set boundaries. Take care of yourselves.'
},
'3-6': {
strengths: ['Creative family', 'Joy and nurturing', 'Social and caring'],
challenges: ['3 scattered, 6 responsible', '6 too serious for 3', 'Different priorities'],
advice: '6: Allow play. 3: Help with responsibilities. Balance fun and duty.'
},
'4-7': {
strengths: ['Practical meets spiritual', 'Deep thinking + grounded', 'Quality focus'],
challenges: ['4 too mundane for 7', '7 too abstract for 4', 'Different worlds'],
advice: '4: Honor 7\'s spirituality. 7: Appreciate 4\'s practicality. Bridge worlds.'
},
'5-7': {
strengths: ['Freedom and wisdom', 'Adventurous spirit', 'Independent thinking'],
challenges: ['5 too social for 7', '7 too withdrawn for 5', 'Different social needs'],
advice: 'Respect different needs. 5: Give space. 7: Engage sometimes.'
},
'1-9': {
strengths: ['Leadership meets compassion', 'Pioneer + humanitarian', 'Visionary partnership'],
challenges: ['1 self-focused, 9 others-focused', 'Different priorities', 'Ego vs service'],
advice: '1: Think beyond self. 9: Set boundaries. Find common mission.'
}
};
// Get insights for Life Path pair
function getLifePathInsights(lp1: number, lp2: number): { strengths: string[]; challenges: string[]; advice: string } {
const key1 = `${lp1}-${lp2}`;
const key2 = `${lp2}-${lp1}`;
return lifePathInsights[key1] || lifePathInsights[key2] || {
strengths: ['Unique combination', 'Potential for growth', 'Complementary lessons'],
challenges: ['Different paths', 'Understanding needed', 'Bridge differences'],
advice: 'Focus on what you can learn from each other. Embrace differences as growth opportunities.'
};
}
// Calculate scores
const scores = calculateCompatibility(chart1, chart2);
// Output
console.log(`\n═══════════════════════════════════════════════════════════════`);
console.log(`💑 NUMEROLOGY COMPATIBILITY ANALYSIS`);
console.log(`═══════════════════════════════════════════════════════════════\n`);
console.log(`${person1.name} & ${person2.name}`);
console.log(`Relationship Type: ${relationshipType.charAt(0).toUpperCase() + relationshipType.slice(1)}\n`);
// Overall compatibility
const overall = getCompatibilityLevel(scores.overall);
console.log(`═══════════════════════════════════════════════════════════════`);
console.log(`OVERALL COMPATIBILITY: ${overall.emoji} ${overall.level.toUpperCase()} (${scores.overall}/10)`);
console.log(`═══════════════════════════════════════════════════════════════`);
console.log(`${overall.description}\n`);
// Individual charts
console.log(`═══════════════════════════════════════════════════════════════`);
console.log(`INDIVIDUAL CHARTS`);
console.log(`═══════════════════════════════════════════════════════════════\n`);
console.log(`${person1.name}:`);
console.log(` Life Path: ${chart1.lifePath}${chart1.lifePath > 9 ? ' (Master Number)' : ''}`);
console.log(` Expression: ${chart1.expression}${chart1.expression > 9 ? ' (Master Number)' : ''}`);
console.log(` Soul Urge: ${chart1.soulUrge}${chart1.soulUrge > 9 ? ' (Master Number)' : ''}`);
console.log(` Birthday: ${chart1.birthday}\n`);
console.log(`${person2.name}:`);
console.log(` Life Path: ${chart2.lifePath}${chart2.lifePath > 9 ? ' (Master Number)' : ''}`);
console.log(` Expression: ${chart2.expression}${chart2.expression > 9 ? ' (Master Number)' : ''}`);
console.log(` Soul Urge: ${chart2.soulUrge}${chart2.soulUrge > 9 ? ' (Master Number)' : ''}`);
console.log(` Birthday: ${chart2.birthday}\n`);
// Detailed compatibility breakdown
console.log(`═══════════════════════════════════════════════════════════════`);
console.log(`DETAILED COMPATIBILITY BREAKDOWN`);
console.log(`═══════════════════════════════════════════════════════════════\n`);
const lpCompat = getCompatibilityLevel(scores.lifePath);
console.log(`💚 LIFE PATH COMPATIBILITY (${scores.lifePath}/10) - ${lpCompat.level}`);
console.log(` ${person1.name}: ${chart1.lifePath} | ${person2.name}: ${chart2.lifePath}`);
console.log(` ${lpCompat.description}\n`);
const exprCompat = getCompatibilityLevel(scores.expression);
console.log(`💙 EXPRESSION COMPATIBILITY (${scores.expression}/10) - ${exprCompat.level}`);
console.log(` ${person1.name}: ${chart1.expression} | ${person2.name}: ${chart2.expression}`);
console.log(` How you work and express yourselves together\n`);
const soulCompat = getCompatibilityLevel(scores.soulUrge);
console.log(`💜 SOUL URGE COMPATIBILITY (${scores.soulUrge}/10) - ${soulCompat.level}`);
console.log(` ${person1.name}: ${chart1.soulUrge} | ${person2.name}: ${chart2.soulUrge}`);
console.log(` Deep inner desires and motivations\n`);
// Life Path specific insights
const insights = getLifePathInsights(chart1.lifePath, chart2.lifePath);
console.log(`═══════════════════════════════════════════════════════════════`);
console.log(`RELATIONSHIP DYNAMICS (Life Path ${chart1.lifePath} & ${chart2.lifePath})`);
console.log(`═══════════════════════════════════════════════════════════════\n`);
console.log(`✅ STRENGTHS:`);
insights.strengths.forEach(s => console.log(`${s}`));
console.log('');
console.log(`⚠️ CHALLENGES:`);
insights.challenges.forEach(c => console.log(`${c}`));
console.log('');
console.log(`💡 ADVICE:`);
console.log(` ${insights.advice}\n`);
// Relationship-specific guidance
console.log(`═══════════════════════════════════════════════════════════════`);
console.log(`${relationshipType.toUpperCase()} RELATIONSHIP GUIDANCE`);
console.log(`═══════════════════════════════════════════════════════════════\n`);
if (relationshipType === 'romantic') {
console.log(`💕 ROMANTIC RELATIONSHIP:`);
console.log(` • Emotional compatibility: Focus on Soul Urge alignment`);
console.log(` • Long-term potential: Life Path compatibility is key`);
console.log(` • Daily harmony: Expression numbers show day-to-day interaction`);
console.log(` • Communication: Express your soul urges openly and honestly\n`);
} else if (relationshipType === 'business') {
console.log(`💼 BUSINESS PARTNERSHIP:`);
console.log(` • Working style: Expression numbers show collaboration style`);
console.log(` • Shared vision: Life Path shows long-term alignment`);
console.log(` • Motivation: Soul Urge reveals what drives each person`);
console.log(` • Division of labor: Play to each person's Expression strengths\n`);
} else if (relationshipType === 'family') {
console.log(`👨‍👩‍👧‍👦 FAMILY RELATIONSHIP:`);
console.log(` • Understanding: Life Path shows core life lessons`);
console.log(` • Communication: Expression numbers affect interaction style`);
console.log(` • Deep needs: Soul Urge reveals what each person truly needs`);
console.log(` • Patience: Honor different paths and timings\n`);
} else if (relationshipType === 'friendship') {
console.log(`🤝 FRIENDSHIP:`);
console.log(` • Common interests: Expression numbers show shared activities`);
console.log(` • Life philosophy: Life Path shows worldview alignment`);
console.log(` • Emotional support: Soul Urge shows how you support each other`);
console.log(` • Fun factor: Compatible Expression = enjoyable time together\n`);
} else {
console.log(`🌟 GENERAL COMPATIBILITY:`);
console.log(` • Life Path: Core life direction and purpose`);
console.log(` • Expression: How you interact and work together`);
console.log(` • Soul Urge: Deep compatibility of desires and motivations`);
console.log(` • Overall: Balance all three for full picture\n`);
}
// Key takeaways
console.log(`═══════════════════════════════════════════════════════════════`);
console.log(`KEY TAKEAWAYS`);
console.log(`═══════════════════════════════════════════════════════════════\n`);
if (scores.overall >= 8) {
console.log(`✨ This is a naturally harmonious pairing with strong potential.`);
console.log(` Focus on appreciating your compatibility while respecting differences.\n`);
} else if (scores.overall >= 6) {
console.log(`💫 Good compatibility with room for growth.`);
console.log(` Success requires communication and mutual understanding.\n`);
} else if (scores.overall >= 4) {
console.log(`⚡ Moderate compatibility - conscious effort needed.`);
console.log(` This relationship requires work but can teach valuable lessons.\n`);
} else {
console.log(`🔥 Challenging compatibility - major growth opportunity.`);
console.log(` Success requires exceptional communication, patience, and commitment.\n`);
}
console.log(`Remember: Numerology shows tendencies, not destiny.`);
console.log(`Any relationship can work with awareness, effort, and love.\n`);
console.log(`✨ Generated with Numerology Compatibility Analyzer\n`);