numerology/profile.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

222 lines
6.6 KiB
TypeScript
Executable file

#!/usr/bin/env bun
/**
* Profile Management CLI
*
* Manage numerology profiles for easy reuse across all tools.
*
* Usage:
* bun profile.ts create --name "Your Name" --birthdate "mm/dd/yyyy"
* bun profile.ts create rob --name "John Smith" --birthdate "3/15/1990"
* bun profile.ts list
* bun profile.ts show rob
* bun profile.ts delete rob
*/
import {
saveProfile,
loadProfile,
listProfiles,
deleteProfile,
generateIdentifier,
profileExists
} from './profile-manager';
// Colors for terminal output
const colors = {
reset: '\x1b[0m',
bright: '\x1b[1m',
green: '\x1b[32m',
blue: '\x1b[34m',
yellow: '\x1b[33m',
red: '\x1b[31m',
cyan: '\x1b[36m',
};
function showHelp() {
console.log(`
${colors.bright}Profile Management${colors.reset}
Manage numerology profiles for easy reuse across all tools.
${colors.bright}USAGE:${colors.reset}
bun profile.ts <command> [options]
${colors.bright}COMMANDS:${colors.reset}
${colors.cyan}create${colors.reset} [identifier] Create or update a profile
${colors.cyan}list${colors.reset} List all profiles
${colors.cyan}show${colors.reset} <identifier> Show profile details
${colors.cyan}delete${colors.reset} <identifier> Delete a profile
${colors.bright}CREATE OPTIONS:${colors.reset}
--name NAME Full name (required)
--birthdate DATE Birthdate in mm/dd/yyyy format (required)
${colors.bright}EXAMPLES:${colors.reset}
# Create profile with auto-generated identifier from first name
bun profile.ts create --name "John Smith" --birthdate "3/15/1990"
${colors.blue}→ Creates profile 'john'${colors.reset}
# Create profile with custom identifier
bun profile.ts create johns --name "John Smith" --birthdate "3/15/1990"
${colors.blue}→ Creates profile 'johns'${colors.reset}
# List all profiles
bun profile.ts list
# Show specific profile
bun profile.ts show rob
# Delete profile
bun profile.ts delete rob
${colors.bright}USING PROFILES:${colors.reset}
Once created, use profiles with any numerology tool:
bun numerology.ts --profile john
bun generate-report.ts --profile john
bun compatibility.ts --profile john --person2 "Jane:1/1/1990"
bun optimal-days.ts --profile john --day 1
`);
}
// Parse command line arguments
const args = process.argv.slice(2);
if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
showHelp();
process.exit(0);
}
const command = args[0];
// CREATE command
if (command === 'create') {
let identifier: string | null = null;
let name = '';
let birthdate = '';
// Check if first arg after 'create' is the identifier (no dashes)
if (args[1] && !args[1].startsWith('-')) {
identifier = args[1];
}
// Parse options
for (let i = identifier ? 2 : 1; i < args.length; i++) {
if ((args[i] === '--name' || args[i] === '-n') && args[i + 1]) {
name = args[i + 1];
i++;
} else if ((args[i] === '--birthdate' || args[i] === '-b') && args[i + 1]) {
birthdate = args[i + 1];
i++;
}
}
if (!name || !birthdate) {
console.error(`${colors.red}Error: Both --name and --birthdate are required${colors.reset}`);
console.error('Try: bun profile.ts create --help');
process.exit(1);
}
// Auto-generate identifier if not provided
if (!identifier) {
identifier = generateIdentifier(name);
}
const isUpdate = profileExists(identifier);
saveProfile(identifier, name, birthdate);
if (isUpdate) {
console.log(`${colors.green}${colors.reset} Profile '${colors.cyan}${identifier}${colors.reset}' updated`);
} else {
console.log(`${colors.green}${colors.reset} Profile '${colors.cyan}${identifier}${colors.reset}' created`);
}
console.log(` Name: ${name}`);
console.log(` Birthdate: ${birthdate}`);
console.log(`\nUse it with: ${colors.bright}--profile ${identifier}${colors.reset}`);
}
// LIST command
else if (command === 'list') {
const profiles = listProfiles();
if (profiles.length === 0) {
console.log(`${colors.yellow}No profiles found.${colors.reset}`);
console.log(`\nCreate one with: ${colors.bright}bun profile.ts create --name "Your Name" --birthdate "mm/dd/yyyy"${colors.reset}`);
process.exit(0);
}
console.log(`${colors.bright}\nProfiles (${profiles.length}):${colors.reset}\n`);
for (const { identifier, profile } of profiles) {
console.log(`${colors.cyan}${identifier}${colors.reset}`);
console.log(` Name: ${profile.name}`);
console.log(` Birthdate: ${profile.birthdate}`);
console.log(` Created: ${new Date(profile.created).toLocaleDateString()}`);
console.log('');
}
console.log(`Use with: ${colors.bright}--profile <identifier>${colors.reset}`);
}
// SHOW command
else if (command === 'show') {
const identifier = args[1];
if (!identifier) {
console.error(`${colors.red}Error: Profile identifier required${colors.reset}`);
console.error('Usage: bun profile.ts show <identifier>');
process.exit(1);
}
const profile = loadProfile(identifier);
if (!profile) {
console.error(`${colors.red}Error: Profile '${identifier}' not found${colors.reset}`);
console.error('List profiles with: bun profile.ts list');
process.exit(1);
}
console.log(`${colors.bright}\nProfile: ${colors.cyan}${identifier}${colors.reset}\n`);
console.log(`Name: ${profile.name}`);
console.log(`Birthdate: ${profile.birthdate}`);
console.log(`Created: ${new Date(profile.created).toLocaleString()}`);
console.log(`Updated: ${new Date(profile.updated).toLocaleString()}`);
console.log(`\nUse with: ${colors.bright}--profile ${identifier}${colors.reset}`);
}
// DELETE command
else if (command === 'delete') {
const identifier = args[1];
if (!identifier) {
console.error(`${colors.red}Error: Profile identifier required${colors.reset}`);
console.error('Usage: bun profile.ts delete <identifier>');
process.exit(1);
}
const profile = loadProfile(identifier);
if (!profile) {
console.error(`${colors.red}Error: Profile '${identifier}' not found${colors.reset}`);
console.error('List profiles with: bun profile.ts list');
process.exit(1);
}
const success = deleteProfile(identifier);
if (success) {
console.log(`${colors.green}${colors.reset} Profile '${colors.cyan}${identifier}${colors.reset}' deleted`);
console.log(` Was: ${profile.name} (${profile.birthdate})`);
} else {
console.error(`${colors.red}Error: Failed to delete profile '${identifier}'${colors.reset}`);
process.exit(1);
}
}
// Unknown command
else {
console.error(`${colors.red}Error: Unknown command '${command}'${colors.reset}`);
console.error('Try: bun profile.ts --help');
process.exit(1);
}