numerology/cycles-week.ts
2026-01-04 02:23:56 -07:00

556 lines
26 KiB
TypeScript
Executable file

#!/usr/bin/env bun
/**
* Numerology Weekly Cycles (Simple Version)
*
* Shows your Personal Day cycles for the week with general guidance.
* No telos file needed - works for anyone!
*
* Usage:
* bun cycles-week.ts --birthdate "5/13/1982" --name "Your Name"
* bun cycles-week.ts --birthdate "5/13/1982" --name "Your Name" --start-date "10/14/2025"
*/
import { calculateCycles } from './cycles';
import { personalDay as personalDayMeanings } from './cycle-meanings';
import { loadProfile } from './profile-manager';
// Parse command line arguments
const args = process.argv.slice(2);
let birthdate = '';
let name = '';
let profileId = '';
let startDate = '';
let simpleMode = false;
let dayOnly = false;
for (let i = 0; i < args.length; i++) {
if ((args[i] === '--profile' || args[i] === '-p') && args[i + 1]) {
profileId = args[i + 1];
i++;
} else if ((args[i] === '--birthdate' || args[i] === '-b') && args[i + 1]) {
birthdate = args[i + 1];
i++;
} else if ((args[i] === '--name' || args[i] === '-n') && args[i + 1]) {
name = args[i + 1];
i++;
} else if ((args[i] === '--start-date' || args[i] === '-s') && args[i + 1]) {
startDate = args[i + 1];
i++;
} else if (args[i] === '--simple') {
simpleMode = true;
} else if (args[i] === '--day' || args[i] === '-d') {
dayOnly = true;
} else if (args[i] === '--help' || args[i] === '-h') {
console.log(`
Numerology Weekly Cycles - Your personal energy forecast
USAGE:
bun cycles-week.ts --profile <id>
bun cycles-week.ts --birthdate "mm/dd/yyyy" --name "Your Name"
OPTIONS:
-p, --profile Use saved profile
-b, --birthdate Your birthdate (mm/dd/yyyy) [required if no profile]
-n, --name Your name (for personalization) [required if no profile]
-s, --start-date Start date (mm/dd/yyyy) [default: today]
-d, --day Show only today (single day output)
--simple Output clean structured format (no colors/emojis) for parsing
-h, --help Show this help message
EXAMPLES:
# With profile
bun cycles-week.ts --profile rob
bun cycles-week.ts --profile rob -s "10/14/2025"
# With name/birthdate
bun cycles-week.ts -b "5/13/1982" -n "John"
bun cycles-week.ts -b "5/13/1982" -n "John" -s "10/14/2025"
`);
process.exit(0);
}
}
// Load profile if specified
if (profileId) {
const profile = loadProfile(profileId);
if (!profile) {
console.error(`Error: Profile '${profileId}' not found`);
console.error('List profiles with: bun profile.ts list');
process.exit(1);
}
name = profile.name;
birthdate = profile.birthdate;
}
if (!birthdate || !name) {
console.error('Error: --birthdate and --name are required (or use --profile)');
console.error('Try: bun cycles-week.ts --help');
process.exit(1);
}
// Format date as mm/dd/yyyy
function formatDate(date: Date): string {
const month = (date.getMonth() + 1).toString().padStart(2, '0');
const day = date.getDate().toString().padStart(2, '0');
const year = date.getFullYear();
return `${month}/${day}/${year}`;
}
// Get day name (short)
function getDayName(date: Date): string {
return date.toLocaleDateString('en-US', { weekday: 'short' });
}
// Get month name (short)
function getMonthName(date: Date): string {
return date.toLocaleDateString('en-US', { month: 'short' });
}
// Get best activities for each Personal Day
function getBestActivities(personalDay: number): string[] {
const activities: Record<number, string[]> = {
1: ['Starting new projects', 'Taking initiative', 'Being independent', 'Leadership tasks'],
2: ['Collaboration', 'Detail work', 'Patience', 'Building partnerships'],
3: ['Content creation', 'Communication', 'Socializing', 'Creative projects'],
4: ['Organizing', 'Hard work', 'Building systems', 'Physical projects'],
5: ['Trying new things', 'Flexibility', 'Exploration', 'Variety'],
6: ['Client/family focus', 'Service', 'Taking responsibility', 'Home projects'],
7: ['Research', 'Deep study', 'Spiritual practice', 'Rest and reflection'],
8: ['Business planning', 'Financial matters', 'Achievement goals', 'Leadership'],
9: ['Finishing projects', 'Clearing clutter', 'Letting go', 'Completion'],
11: ['Inspiring others', 'Intuitive work', 'Spiritual teaching', 'Creative inspiration'],
22: ['Large-scale building', 'Manifesting visions', 'Legacy projects', 'Masterful work'],
33: ['Teaching', 'Healing work', 'Compassionate service', 'Mentoring']
};
return activities[personalDay] || activities[personalDay % 11] || [];
}
// Get things to avoid for each Personal Day
function getAvoidActivities(personalDay: number): string[] {
const avoid: Record<number, string[]> = {
1: ['Depending on others', 'Being passive', 'Waiting for permission'],
2: ['Rushing', 'Going solo', 'Making hasty decisions'],
3: ['Being too serious', 'Isolating', 'Suppressing creativity'],
4: ['Cutting corners', 'Being disorganized', 'Avoiding hard work'],
5: ['Long-term commitments', 'Staying stuck', 'Rigid plans'],
6: ['Neglecting responsibilities', 'Being self-centered', 'Avoiding commitments'],
7: ['Networking events', 'Major launches', 'Superficial activities'],
8: ['Being passive', 'Avoiding power', 'Small thinking'],
9: ['Starting new projects', 'Major commitments', 'Clinging to the past'],
11: ['Ignoring intuition', 'Being too practical', 'Suppressing sensitivity'],
22: ['Small thinking', 'Self-sabotage', 'Losing faith in vision'],
33: ['Martyrdom', 'Neglecting self-care', 'Trying to save everyone']
};
return avoid[personalDay] || avoid[personalDay % 11] || [];
}
// Single day output - visual format
function outputDayVisual(todayData: any, personalYear: number, personalMonth: number, yearMeanings: Record<number, string>, monthMeanings: Record<number, string>) {
const { date, cycles } = todayData;
const dayName = getDayName(date);
const dayNum = date.getDate();
const personalDay = cycles.personal.day;
// Get meaning keywords
const meaningText = personalDayMeanings[personalDay];
const meaningMatch = meaningText?.match(/^([^.]+)/);
const keywords = meaningMatch ? meaningMatch[1].replace(' day', '') : `Day ${personalDay}`;
// Get activities
const bestFor = getBestActivities(personalDay);
const avoid = getAvoidActivities(personalDay);
console.log(`\nPersonal Year ${personalYear} (${yearMeanings[personalYear]}) + Month ${personalMonth} (${monthMeanings[personalMonth]})`);
// Add theme
if (personalYear === 33) {
console.log(`→ Theme: Master teaching year - share wisdom, serve, heal with compassion`);
} else if (personalYear === 22) {
console.log(`→ Theme: Master building year - manifest large-scale visions`);
} else if (personalYear === 11) {
console.log(`→ Theme: Inspiration year - channel higher wisdom, illuminate others`);
} else if (personalYear === 1) {
console.log(`→ Theme: Fresh starts and new beginnings - plant seeds for the next 9 years`);
} else if (personalYear === 9) {
console.log(`→ Theme: Completion and release - let go of what no longer serves`);
} else {
console.log(`→ Theme: Year ${personalYear} energy expressed through Month ${personalMonth} focus`);
}
console.log('\n─────────────────────────────────────────────────────────');
console.log(`${dayName} ${getMonthName(date)} ${dayNum} - Personal Day ${personalDay} (${keywords})`);
console.log(` ✅ Best for: ${bestFor.join(', ')}`);
if (avoid.length > 0) {
console.log(` ⚠️ Avoid: ${avoid.join(', ')}`);
}
console.log('─────────────────────────────────────────────────────────\n');
}
// Single day output - simple format (for Heka integration)
function outputDaySimple(todayData: any, personalYear: number, personalMonth: number, yearMeanings: Record<number, string>, monthMeanings: Record<number, string>) {
const { date, cycles } = todayData;
const dayName = date.toLocaleDateString('en-US', { weekday: 'long' }).toUpperCase();
const dateStr = date.toLocaleDateString('en-US', { year: 'numeric', month: '2-digit', day: '2-digit' });
const personalDay = cycles.personal.day;
// Get meaning keywords
const meaningText = personalDayMeanings[personalDay];
const meaningMatch = meaningText?.match(/^([^.]+)/);
const keywords = meaningMatch ? meaningMatch[1].replace(' day', '') : `Day ${personalDay}`;
// Get activities
const bestFor = getBestActivities(personalDay);
const avoid = getAvoidActivities(personalDay);
// Year theme
let yearTheme = '';
if (personalYear === 33) {
yearTheme = 'Master teaching year - share wisdom, serve, heal with compassion';
} else if (personalYear === 22) {
yearTheme = 'Master building year - manifest large-scale visions';
} else if (personalYear === 11) {
yearTheme = 'Inspiration year - channel higher wisdom, illuminate others';
} else if (personalYear === 1) {
yearTheme = 'Fresh starts and new beginnings - plant seeds for the next 9 years';
} else if (personalYear === 9) {
yearTheme = 'Completion and release - let go of what no longer serves';
} else {
yearTheme = `Year ${personalYear} energy expressed through Month ${personalMonth} focus`;
}
console.log(`YEAR: Personal Year ${personalYear} (${yearMeanings[personalYear]})`);
console.log(`MONTH: Personal Month ${personalMonth} (${monthMeanings[personalMonth]})`);
console.log(`YEAR_THEME: ${yearTheme}`);
console.log('');
console.log(`TODAY: ${dayName} ${dateStr}`);
console.log(`Personal Day ${personalDay} (${keywords})`);
console.log(`Best for: ${bestFor.join(', ')}`);
console.log(`Avoid: ${avoid.join(', ')}`);
}
// Simple output format (no colors, emojis, or formatting)
function outputSimple(weekDays: any[], personalYear: number, personalMonth: number, yearMeanings: Record<number, string>, monthMeanings: Record<number, string>) {
const start = weekDays[0].date;
const end = weekDays[6].date;
// Format dates
const startFormatted = `${getMonthName(start)} ${start.getDate()}`;
const endFormatted = `${getMonthName(end)} ${end.getDate()}, ${end.getFullYear()}`;
console.log(`WEEK: ${startFormatted}-${endFormatted}`);
console.log(`YEAR: Personal Year ${personalYear} (${yearMeanings[personalYear]})`);
console.log(`MONTH: Personal Month ${personalMonth} (${monthMeanings[personalMonth]})`);
// Year theme
let yearTheme = '';
if (personalYear === 33) {
yearTheme = 'Master teaching year - share wisdom, serve, heal with compassion';
} else if (personalYear === 22) {
yearTheme = 'Master building year - manifest large-scale visions';
} else if (personalYear === 11) {
yearTheme = 'Inspiration year - channel higher wisdom, illuminate others';
} else if (personalYear === 1) {
yearTheme = 'Fresh starts and new beginnings - plant seeds for the next 9 years';
} else if (personalYear === 9) {
yearTheme = 'Completion and release - let go of what no longer serves';
} else {
yearTheme = `Year ${personalYear} energy expressed through Month ${personalMonth} focus`;
}
console.log(`YEAR_THEME: ${yearTheme}`);
console.log('');
console.log('DAILY_CYCLES:');
console.log('');
// Output each day
for (const { date, cycles } of weekDays) {
const dayName = date.toLocaleDateString('en-US', { weekday: 'long' }).toUpperCase();
const dateStr = date.toLocaleDateString('en-US', { year: 'numeric', month: '2-digit', day: '2-digit' });
const personalDay = cycles.personal.day;
// Get meaning keywords
const meaningText = personalDayMeanings[personalDay];
const meaningMatch = meaningText?.match(/^([^.]+)/);
const keywords = meaningMatch ? meaningMatch[1].replace(' day', '') : `Day ${personalDay}`;
// Get activities
const bestFor = getBestActivities(personalDay);
const avoid = getAvoidActivities(personalDay);
console.log(`${dayName} ${dateStr}`);
console.log(`Personal Day ${personalDay} (${keywords})`);
console.log(`Best for: ${bestFor.join(', ')}`);
console.log(`Avoid: ${avoid.join(', ')}`);
console.log('---');
}
// Weekly theme
console.log('');
console.log('WEEKLY_THEME:');
if (personalYear === 33) {
console.log('Master Teacher year - you\'re called to teach, heal, and serve at a higher level. This isn\'t about personal achievement - it\'s about uplifting others through compassionate service. Abundance follows when you lead with love.');
} else if (personalYear === 1) {
console.log('New 9-year cycle begins! Fresh starts, bold initiatives, and independent action are your themes. What you start this year echoes for 9 years.');
} else if (personalYear === 8) {
console.log('Power and achievement year. Business opportunities, financial growth, and leadership roles are highlighted. Think big - this is your harvest time.');
} else if (personalYear === 7) {
console.log('Introspection and spirituality year. Turn inward for wisdom. Rest, study, and spiritual practice are more important than external achievement now.');
} else if (personalYear === 9) {
console.log('Completion year. Finish what you started, let go of what no longer serves, and prepare for a new 9-year cycle beginning next year.');
} else {
console.log(`Year ${personalYear} energy (${yearMeanings[personalYear]}) manifesting through Month ${personalMonth}. Balance your annual theme with monthly focus for best results.`);
}
console.log('');
// Key opportunities
console.log('KEY_OPPORTUNITIES:');
const opportunityDays = weekDays.filter(d => [1, 3, 8, 11, 22, 33].includes(d.cycles.personal.day));
if (opportunityDays.length > 0) {
opportunityDays.forEach(d => {
const day = d.cycles.personal.day;
const dayName = getDayName(d.date);
const opportunities: Record<number, string> = {
1: `${dayName} (Day 1): New beginnings - launch projects, take first steps`,
3: `${dayName} (Day 3): Expression - communicate, create, socialize`,
8: `${dayName} (Day 8): Achievement - business moves, financial decisions`,
11: `${dayName} (Day 11): Inspiration - teach, inspire, channel creativity`,
22: `${dayName} (Day 22): Master building - think big, build lasting legacies`,
33: `${dayName} (Day 33): Master teaching - heal, serve, uplift humanity`
};
if (opportunities[day]) {
console.log(opportunities[day]);
}
});
} else {
console.log('This week favors steady progress over dramatic breakthroughs');
}
console.log('');
// Weekly advice
console.log('WEEKLY_ADVICE:');
if (personalYear === 9) {
console.log('Finish what you started - don\'t leave loose ends');
console.log('Let go of relationships, projects, or beliefs that no longer fit');
console.log('Reflect on lessons from the past 9 years - wisdom awaits');
console.log('Clear physical/mental clutter to prepare for Year 1 next year');
} else if (personalYear === 33) {
console.log('Teach what you know - your wisdom heals others');
console.log('Serve from overflow, not depletion (self-care first)');
console.log('Lead with compassion, not ego or profit motive');
console.log('Your impact ripples further than you realize');
} else if (personalYear === 7) {
console.log('Honor your need for solitude - it\'s not selfish, it\'s necessary');
console.log('Deep study and spiritual practice trump busy-work this year');
console.log('Listen to your intuition - it\'s especially clear now');
console.log('Rest isn\'t laziness - it\'s strategic preparation');
} else if (personalYear === 8) {
console.log('Think big - this is not the year for small goals');
console.log('Take charge of financial matters and business opportunities');
console.log('Step into leadership roles confidently');
console.log('Remember: power is responsibility, not domination');
} else {
console.log('Match your activities to each day\'s energy for maximum flow');
console.log('Rest on Day 7, launch on Day 1, express on Day 3');
console.log('Fighting your cycles creates unnecessary resistance');
console.log('Trust the rhythm - you\'re part of a greater pattern');
}
}
// Main execution
async function main() {
// Determine start date (today by default)
let start: Date;
if (startDate) {
const parts = startDate.split('/');
start = new Date(parseInt(parts[2]), parseInt(parts[0]) - 1, parseInt(parts[1]));
} else {
start = new Date();
}
// Get cycles for 7 days starting from start date
const weekDays = [];
for (let i = 0; i < 7; i++) {
const date = new Date(start);
date.setDate(start.getDate() + i);
const dateStr = formatDate(date);
const cycles = calculateCycles(birthdate, dateStr);
weekDays.push({ date, dateStr, cycles });
}
// Calculate Personal Year and Month for context
const todayCycles = calculateCycles(birthdate);
const personalYear = todayCycles.personal.year;
const personalMonth = todayCycles.personal.month;
// Get year and month meanings
const yearMeanings: Record<number, string> = {
1: 'New Beginnings', 2: 'Patience & Cooperation', 3: 'Expression & Creativity',
4: 'Hard Work & Foundation', 5: 'Change & Freedom', 6: 'Responsibility & Service',
7: 'Introspection & Spirituality', 8: 'Achievement & Power', 9: 'Completion & Release',
11: 'Inspiration & Illumination', 22: 'Master Building', 33: 'Master Teaching'
};
const monthMeanings: Record<number, string> = {
1: 'Initiation', 2: 'Patience', 3: 'Expression', 4: 'Work',
5: 'Change', 6: 'Responsibility', 7: 'Introspection', 8: 'Achievement', 9: 'Completion'
};
// Handle single-day output if --day flag is set
if (dayOnly) {
const todayData = weekDays[0]; // First day in array is "today" (or specified start date)
if (simpleMode) {
outputDaySimple(todayData, personalYear, personalMonth, yearMeanings, monthMeanings);
} else {
outputDayVisual(todayData, personalYear, personalMonth, yearMeanings, monthMeanings);
}
return;
}
// Use simple output if flag is set
if (simpleMode) {
outputSimple(weekDays, personalYear, personalMonth, yearMeanings, monthMeanings);
return;
}
// Output header
const startFormatted = `${getMonthName(start)} ${start.getDate()}`;
const endDate = new Date(start);
endDate.setDate(start.getDate() + 6);
const endFormatted = `${getMonthName(endDate)} ${endDate.getDate()}, ${endDate.getFullYear()}`;
console.log(`\n📅 YOUR WEEK: ${startFormatted}-${endFormatted}\n`);
console.log(`Personal Year ${personalYear} (${yearMeanings[personalYear]}) + Month ${personalMonth} (${monthMeanings[personalMonth]})`);
// Add contextual theme based on Year/Month combination
if (personalYear === 9 && personalMonth === 1) {
console.log(`→ Theme: Completing major cycles while initiating final projects`);
} else if (personalYear === 1) {
console.log(`→ Theme: Fresh starts and new beginnings - plant seeds for the next 9 years`);
} else if (personalYear === 33) {
console.log(`→ Theme: Master teaching year - share wisdom, serve, heal with compassion`);
} else if (personalYear === 22) {
console.log(`→ Theme: Master building year - manifest large-scale visions`);
} else if (personalYear === 11) {
console.log(`→ Theme: Inspiration year - channel higher wisdom, illuminate others`);
} else {
console.log(`→ Theme: Year ${personalYear} energy expressed through Month ${personalMonth} focus`);
}
console.log('');
// Output each day
for (const { date, cycles } of weekDays) {
const dayName = getDayName(date);
const dayNum = date.getDate();
const personalDay = cycles.personal.day;
// Get meaning keywords
const meaningText = personalDayMeanings[personalDay];
const meaningMatch = meaningText?.match(/^([^.]+)/);
const keywords = meaningMatch ? meaningMatch[1].replace(' day', '') : `Day ${personalDay}`;
// Get activities
const bestFor = getBestActivities(personalDay);
const avoid = getAvoidActivities(personalDay);
console.log(`─────────────────────────────────────────────────────────`);
console.log(`${dayName} ${getMonthName(date)} ${dayNum} - Personal Day ${personalDay} (${keywords})`);
console.log(` ✅ Best for: ${bestFor.join(', ')}`);
if (avoid.length > 0) {
console.log(` ⚠️ Avoid: ${avoid.join(', ')}`);
}
console.log('');
}
console.log(`─────────────────────────────────────────────────────────`);
// Weekly Summary
console.log(`\n📊 WEEKLY SUMMARY\n`);
console.log(`Personal Year ${personalYear} + Month ${personalMonth}`);
// Weekly Theme
console.log(`\n🎯 WEEKLY THEME:`);
if (personalYear === 9 && personalMonth === 1) {
console.log(`You're completing a 9-year cycle (endings/letting go) while Month 1 brings`);
console.log(`fresh energy. This paradox creates space for final completions while`);
console.log(`planting seeds for your next cycle starting next year.`);
} else if (personalYear === 33) {
console.log(`Master Teacher year - you're called to teach, heal, and serve at a higher`);
console.log(`level. This isn't about personal achievement - it's about uplifting others`);
console.log(`through compassionate service. Abundance follows when you lead with love.`);
} else if (personalYear === 1) {
console.log(`New 9-year cycle begins! Fresh starts, bold initiatives, and independent`);
console.log(`action are your themes. What you start this year echoes for 9 years.`);
} else if (personalYear === 8) {
console.log(`Power and achievement year. Business opportunities, financial growth, and`);
console.log(`leadership roles are highlighted. Think big - this is your harvest time.`);
} else if (personalYear === 7) {
console.log(`Introspection and spirituality year. Turn inward for wisdom. Rest, study,`);
console.log(`and spiritual practice are more important than external achievement now.`);
} else {
console.log(`Year ${personalYear} energy (${yearMeanings[personalYear]}) manifesting through Month ${personalMonth}.`);
console.log(`Balance your annual theme with monthly focus for best results.`);
}
// Key Opportunities
console.log(`\n🌟 KEY OPPORTUNITIES THIS WEEK:`);
const opportunityDays = weekDays.filter(d => [1, 3, 8, 11, 22, 33].includes(d.cycles.personal.day));
if (opportunityDays.length > 0) {
opportunityDays.forEach(d => {
const day = d.cycles.personal.day;
const opportunities: Record<number, string> = {
1: `${getDayName(d.date)} (Day 1): New beginnings - launch projects, take first steps`,
3: `${getDayName(d.date)} (Day 3): Expression - communicate, create, socialize`,
8: `${getDayName(d.date)} (Day 8): Achievement - business moves, financial decisions`,
11: `${getDayName(d.date)} (Day 11): Inspiration - teach, inspire, channel creativity`,
22: `${getDayName(d.date)} (Day 22): Master building - think big, build lasting legacies`,
33: `${getDayName(d.date)} (Day 33): Master teaching - heal, serve, uplift humanity`
};
if (opportunities[day]) {
console.log(` ${opportunities[day]}`);
}
});
} else {
console.log(` This week favors steady progress over dramatic breakthroughs.`);
console.log(` Focus on consistent alignment with each day's unique energy.`);
}
// Weekly Advice (personalized by year)
console.log(`\n💡 WEEKLY ADVICE:`);
if (personalYear === 9) {
console.log(` • Finish what you started - don't leave loose ends`);
console.log(` • Let go of relationships, projects, or beliefs that no longer fit`);
console.log(` • Reflect on lessons from the past 9 years - wisdom awaits`);
console.log(` • Clear physical/mental clutter to prepare for Year 1 next year`);
} else if (personalYear === 1) {
console.log(` • Be bold - this is your year to take initiative`);
console.log(` • Start before you feel ready - perfection kills momentum`);
console.log(` • Your independence is your greatest asset this year`);
console.log(` • Think long-term - what you plant now grows for 9 years`);
} else if (personalYear === 33) {
console.log(` • Teach what you know - your wisdom heals others`);
console.log(` • Serve from overflow, not depletion (self-care first)`);
console.log(` • Lead with compassion, not ego or profit motive`);
console.log(` • Your impact ripples further than you realize`);
} else if (personalYear === 7) {
console.log(` • Honor your need for solitude - it's not selfish, it's necessary`);
console.log(` • Deep study and spiritual practice trump busy-work this year`);
console.log(` • Listen to your intuition - it's especially clear now`);
console.log(` • Rest isn't laziness - it's strategic preparation`);
} else if (personalYear === 8) {
console.log(` • Think big - this is not the year for small goals`);
console.log(` • Take charge of financial matters and business opportunities`);
console.log(` • Step into leadership roles confidently`);
console.log(` • Remember: power is responsibility, not domination`);
} else {
console.log(` • Match your activities to each day's energy for maximum flow`);
console.log(` • Rest on Day 7, launch on Day 1, express on Day 3`);
console.log(` • Fighting your cycles creates unnecessary resistance`);
console.log(` • Trust the rhythm - you're part of a greater pattern`);
}
console.log(`\n✨ Generated with Numerology Cycles System`);
}
main().catch(console.error);