klio 1.2.7 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/astrology/astrologyService.js +53 -16
- package/src/cli/cli.js +4 -5
- package/src/config/configService.js +53 -2
- package/src/health/fileAnalysis.js +20 -8
package/package.json
CHANGED
|
@@ -268,6 +268,9 @@ function getAstrologicalData(planetName, customDate = null) {
|
|
|
268
268
|
|
|
269
269
|
// Verwende das angegebene Datum oder das aktuelle Datum (mit Zeitzonenberücksichtigung)
|
|
270
270
|
let calcYear, calcMonth, calcDay, calcHour, calcMinute;
|
|
271
|
+
let timezoneOffsetMinutes;
|
|
272
|
+
let timezone = null;
|
|
273
|
+
let baseDate;
|
|
271
274
|
|
|
272
275
|
if (customDate) {
|
|
273
276
|
calcYear = customDate.year;
|
|
@@ -275,6 +278,18 @@ function getAstrologicalData(planetName, customDate = null) {
|
|
|
275
278
|
calcDay = customDate.day;
|
|
276
279
|
calcHour = customDate.hour;
|
|
277
280
|
calcMinute = customDate.minute;
|
|
281
|
+
baseDate = customDate;
|
|
282
|
+
// Versuche, die Zeitzone vom customDate abzuleiten (z.B. Geburtsort)
|
|
283
|
+
if (customDate.location && customDate.location.timezone) {
|
|
284
|
+
timezone = customDate.location.timezone;
|
|
285
|
+
} else {
|
|
286
|
+
try {
|
|
287
|
+
const config = loadConfig();
|
|
288
|
+
if (config && config.currentLocation && config.currentLocation.timezone) {
|
|
289
|
+
timezone = config.currentLocation.timezone;
|
|
290
|
+
}
|
|
291
|
+
} catch (_) {}
|
|
292
|
+
}
|
|
278
293
|
} else {
|
|
279
294
|
// Verwende die aktuelle Zeit in der konfigurierten Zeitzone
|
|
280
295
|
const timeData = getCurrentTimeInTimezone();
|
|
@@ -283,9 +298,24 @@ function getAstrologicalData(planetName, customDate = null) {
|
|
|
283
298
|
calcDay = timeData.day;
|
|
284
299
|
calcHour = timeData.hour;
|
|
285
300
|
calcMinute = timeData.minute;
|
|
301
|
+
baseDate = timeData;
|
|
302
|
+
try {
|
|
303
|
+
const config = loadConfig();
|
|
304
|
+
if (config && config.currentLocation && config.currentLocation.timezone) {
|
|
305
|
+
timezone = config.currentLocation.timezone;
|
|
306
|
+
}
|
|
307
|
+
} catch (_) {}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// Bestimme Offset in Minuten (Lokalzeit - UTC)
|
|
311
|
+
if (timezone) {
|
|
312
|
+
timezoneOffsetMinutes = getTimezoneOffset({ year: calcYear, month: calcMonth, day: calcDay, hour: calcHour, minute: calcMinute }, timezone);
|
|
313
|
+
} else {
|
|
314
|
+
// Fallback: Systemoffset umkehren, damit (Lokalzeit - UTC) entsteht
|
|
315
|
+
timezoneOffsetMinutes = -new Date().getTimezoneOffset();
|
|
286
316
|
}
|
|
287
317
|
|
|
288
|
-
const julianDay =
|
|
318
|
+
const julianDay = calculateJulianDayUTC({ year: calcYear, month: calcMonth, day: calcDay, hour: calcHour, minute: calcMinute }, timezoneOffsetMinutes);
|
|
289
319
|
const flag = swisseph.SEFLG_SWIEPH | swisseph.SEFLG_SPEED;
|
|
290
320
|
const result = swisseph.swe_calc_ut(julianDay, planet, flag);
|
|
291
321
|
|
|
@@ -340,13 +370,18 @@ function getCriticalPlanets(customDate = null) {
|
|
|
340
370
|
timeData = getCurrentTimeInTimezone();
|
|
341
371
|
}
|
|
342
372
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
373
|
+
// Berücksichtige die lokale Zeitzone für die Umrechnung nach UTC
|
|
374
|
+
let timezone = null;
|
|
375
|
+
try {
|
|
376
|
+
const config = loadConfig();
|
|
377
|
+
if (customDate && customDate.location && customDate.location.timezone) {
|
|
378
|
+
timezone = customDate.location.timezone;
|
|
379
|
+
} else if (config && config.currentLocation && config.currentLocation.timezone) {
|
|
380
|
+
timezone = config.currentLocation.timezone;
|
|
381
|
+
}
|
|
382
|
+
} catch (_) {}
|
|
383
|
+
const offsetMinutes = timezone ? getTimezoneOffset(timeData, timezone) : -new Date().getTimezoneOffset();
|
|
384
|
+
const julianDay = calculateJulianDayUTC(timeData, offsetMinutes);
|
|
350
385
|
|
|
351
386
|
// Berechne Positionen aller Planeten
|
|
352
387
|
for (const [name, planetId] of Object.entries(planets)) {
|
|
@@ -613,13 +648,16 @@ function isPlanetRetrograde(planetName, dateComponents) {
|
|
|
613
648
|
if (planet === undefined) return false;
|
|
614
649
|
|
|
615
650
|
// Berechne die Position mit Geschwindigkeitsinformation
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
651
|
+
// Konvertiere Datum zu UTC basierend auf konfigurierter Zeitzone
|
|
652
|
+
let tz = null;
|
|
653
|
+
try {
|
|
654
|
+
const config = loadConfig();
|
|
655
|
+
if (config && config.currentLocation && config.currentLocation.timezone) {
|
|
656
|
+
tz = config.currentLocation.timezone;
|
|
657
|
+
}
|
|
658
|
+
} catch (_) {}
|
|
659
|
+
const off = tz ? getTimezoneOffset(dateComponents, tz) : -new Date().getTimezoneOffset();
|
|
660
|
+
const julianDay = calculateJulianDayUTC(dateComponents, off);
|
|
623
661
|
|
|
624
662
|
const flag = swisseph.SEFLG_SWIEPH | swisseph.SEFLG_SPEED;
|
|
625
663
|
const result = swisseph.swe_calc_ut(julianDay, planet, flag);
|
|
@@ -1343,7 +1381,6 @@ async function showCombinedAnalysis(planetName, transitDate = null, birthData =
|
|
|
1343
1381
|
console.log('================================================================================');
|
|
1344
1382
|
console.log(`Analyse-Datum: ${transitDate.day}.${transitDate.month}.${transitDate.year}`);
|
|
1345
1383
|
console.log(`Geburtsdatum: ${birthData.day}.${birthData.month}.${birthData.year} ${birthData.hour}:${birthData.minute.toString().padStart(2, '0')}`);
|
|
1346
|
-
console.log(`Haus-System: ${houseSystem.charAt(0).toUpperCase() + houseSystem.slice(1)} (basierend auf Geburts-ASC)`);
|
|
1347
1384
|
console.log('');
|
|
1348
1385
|
|
|
1349
1386
|
// Zeige Planetenpositionen und Häuser
|
package/src/cli/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { Command } = require('commander');
|
|
2
2
|
const { planets, signs } = require('../astrology/astrologyConstants');
|
|
3
3
|
const { showRetrogradePlanets } = require('../astrology/retrogradeService');
|
|
4
|
-
const { getCurrentTimeInTimezone, showAspectFigures, analyzeElementDistribution, getTimezoneOffset, calculateJulianDayUTC, calculateHouses, getAstrologicalData, getPlanetHouse, showPlanetAspects, calculatePlanetAspects, getAllActiveAspects, showAllActiveAspects, getBirthDataFromConfig, detectAspectFigures, calculatePersonalTransits, showPersonalTransitAspects, showCombinedAnalysis, calculatePersonalTransitAspects, determineAspectPhase, findExactAspectTime, findLastExactAspectTime } = require('../astrology/astrologyService');
|
|
4
|
+
const { getCurrentTimeInTimezone, showAspectFigures, analyzeElementDistribution, getTimezoneOffset, calculateJulianDayUTC, calculateHouses, getAstrologicalData, getPlanetHouse, showPlanetAspects, calculatePlanetAspects, getAllActiveAspects, showAllActiveAspects, getBirthDataFromConfig, detectAspectFigures, calculatePersonalTransits, showPersonalTransitAspects, showCombinedAnalysis, calculatePersonalTransitAspects, determineAspectPhase, findExactAspectTime, findLastExactAspectTime, getAspectAngle, getFutureAspects, getPastAspects } = require('../astrology/astrologyService');
|
|
5
5
|
const { performSetup, showConfigStatus, loadConfig, setAIModel, askAIModel } = require('../config/configService');
|
|
6
6
|
const { parseAppleHealthXML } = require('../health/healthService');
|
|
7
7
|
const { analyzeStepsByPlanetSign, analyzeStressByPlanetAspects, analyzePlanetAspectsForSleep } = require('../health/healthAnalysis');
|
|
@@ -410,9 +410,9 @@ program
|
|
|
410
410
|
return;
|
|
411
411
|
}
|
|
412
412
|
|
|
413
|
-
// Kombinierte Analyse anzeigen
|
|
414
|
-
|
|
415
|
-
|
|
413
|
+
// Kombinierte Analyse anzeigen NUR wenn --tr/--transit-aspekte zusammen mit --hs angegeben ist
|
|
414
|
+
// Dadurch wird sichergestellt, dass `--tr` ohne `--hs` ausschließlich persönliche Transit-Aspekte zeigt
|
|
415
|
+
if ((options.transitAspekte || options.tr) && options.hs) {
|
|
416
416
|
|
|
417
417
|
// Geburtsdaten sind erforderlich
|
|
418
418
|
const birthData = getBirthDataFromConfig();
|
|
@@ -529,7 +529,6 @@ program
|
|
|
529
529
|
console.log('================================================================================');
|
|
530
530
|
console.log(`\nAnalyse-Datum: ${transitDateDisplay.day}.${transitDateDisplay.month}.${transitDateDisplay.year}`);
|
|
531
531
|
console.log(`Geburtsdatum: ${birthData.day}.${birthData.month}.${birthData.year} ${birthData.hour}:${birthData.minute.toString().padStart(2, '0')}`);
|
|
532
|
-
console.log(`Haus-System: ${houseSystem.charAt(0).toUpperCase() + houseSystem.slice(1)} (basierend auf Geburts-ASC)`);
|
|
533
532
|
|
|
534
533
|
}
|
|
535
534
|
|
|
@@ -1,9 +1,56 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
+
const os = require('os');
|
|
3
4
|
const axios = require('axios');
|
|
4
5
|
const readline = require('readline');
|
|
5
6
|
const { parseAndFormatMarkdown } = require('../utils/markdownFormatter');
|
|
6
7
|
|
|
8
|
+
// Funktion zur Bestimmung des plattformübergreifenden Konfigurationspfads
|
|
9
|
+
function getConfigPath() {
|
|
10
|
+
let configDir;
|
|
11
|
+
|
|
12
|
+
// Bestimme das Konfigurationsverzeichnis basierend auf dem Betriebssystem
|
|
13
|
+
if (process.platform === 'win32') {
|
|
14
|
+
// Windows: Verwende %APPDATA%\astrocli
|
|
15
|
+
configDir = path.join(process.env.APPDATA || path.join(os.homedir(), 'AppData', 'Roaming'), 'astrocli');
|
|
16
|
+
} else if (process.platform === 'darwin') {
|
|
17
|
+
// macOS: Verwende ~/Library/Application Support/astrocli
|
|
18
|
+
configDir = path.join(os.homedir(), 'Library', 'Application Support', 'astrocli');
|
|
19
|
+
} else {
|
|
20
|
+
// Linux und andere Unix-Systeme: Verwende ~/.config/astrocli
|
|
21
|
+
configDir = path.join(os.homedir(), '.config', 'astrocli');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Erstelle das Verzeichnis, falls es nicht existiert
|
|
25
|
+
if (!fs.existsSync(configDir)) {
|
|
26
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return path.join(configDir, 'config.json');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Funktion zur Migration der alten Konfiguration
|
|
33
|
+
function migrateOldConfig() {
|
|
34
|
+
const oldConfigPath = path.join(__dirname, '../../astrocli-config.json');
|
|
35
|
+
const newConfigPath = getConfigPath();
|
|
36
|
+
|
|
37
|
+
// Prüfe, ob die alte Konfiguration existiert und die neue noch nicht
|
|
38
|
+
if (fs.existsSync(oldConfigPath) && !fs.existsSync(newConfigPath)) {
|
|
39
|
+
try {
|
|
40
|
+
const oldConfigData = fs.readFileSync(oldConfigPath, 'utf8');
|
|
41
|
+
fs.writeFileSync(newConfigPath, oldConfigData);
|
|
42
|
+
console.log('📁 Alte Konfiguration erfolgreich migriert!');
|
|
43
|
+
console.log(` Von: ${oldConfigPath}`);
|
|
44
|
+
console.log(` Nach: ${newConfigPath}`);
|
|
45
|
+
return true;
|
|
46
|
+
} catch (error) {
|
|
47
|
+
console.error('Fehler bei der Migration der Konfiguration:', error.message);
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
|
|
7
54
|
// Funktion für Geocoding mit OpenMeteo
|
|
8
55
|
async function geocodeLocation(locationName) {
|
|
9
56
|
try {
|
|
@@ -37,9 +84,10 @@ async function geocodeLocation(locationName) {
|
|
|
37
84
|
// Funktion zum Speichern der Konfiguration
|
|
38
85
|
function saveConfig(config) {
|
|
39
86
|
try {
|
|
40
|
-
const configPath =
|
|
87
|
+
const configPath = getConfigPath();
|
|
41
88
|
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
42
89
|
console.log('✓ Konfiguration erfolgreich gespeichert!');
|
|
90
|
+
console.log(`📁 Speicherort: ${configPath}`);
|
|
43
91
|
return true;
|
|
44
92
|
} catch (error) {
|
|
45
93
|
console.error('Fehler beim Speichern der Konfiguration:', error.message);
|
|
@@ -50,7 +98,10 @@ function saveConfig(config) {
|
|
|
50
98
|
// Funktion zum Laden der Konfiguration
|
|
51
99
|
function loadConfig() {
|
|
52
100
|
try {
|
|
53
|
-
|
|
101
|
+
// Versuche zuerst, die alte Konfiguration zu migrieren
|
|
102
|
+
migrateOldConfig();
|
|
103
|
+
|
|
104
|
+
const configPath = getConfigPath();
|
|
54
105
|
if (fs.existsSync(configPath)) {
|
|
55
106
|
const configData = fs.readFileSync(configPath, 'utf8');
|
|
56
107
|
return JSON.parse(configData);
|
|
@@ -28,10 +28,16 @@ async function analyzeHouseDistribution(planetName, folderPath, houseSystem = 'K
|
|
|
28
28
|
const planetLongitude = planetData.longitude;
|
|
29
29
|
|
|
30
30
|
// Berechne die Hausposition für dieses Datum
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
const { calculateJulianDayUTC, getTimezoneOffset, loadConfig } = require('../astrology/astrologyService');
|
|
32
|
+
let tz = null;
|
|
33
|
+
try {
|
|
34
|
+
const config = loadConfig();
|
|
35
|
+
if (config && config.currentLocation && config.currentLocation.timezone) {
|
|
36
|
+
tz = config.currentLocation.timezone;
|
|
37
|
+
}
|
|
38
|
+
} catch (_) {}
|
|
39
|
+
const off = tz ? getTimezoneOffset(dateComponents, tz) : -new Date().getTimezoneOffset();
|
|
40
|
+
const julianDay = calculateJulianDayUTC(dateComponents, off);
|
|
35
41
|
|
|
36
42
|
const houses = await calculateHouses(julianDay, houseSystem);
|
|
37
43
|
const planetHouse = getPlanetHouse(planetLongitude, houses.house);
|
|
@@ -89,10 +95,16 @@ async function filterFilesByHouse(planetName, folderPath, targetHouse, houseSyst
|
|
|
89
95
|
const planetLongitude = planetData.longitude;
|
|
90
96
|
|
|
91
97
|
// Berechne die Hausposition für dieses Datum
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
98
|
+
const { calculateJulianDayUTC, getTimezoneOffset, loadConfig } = require('../astrology/astrologyService');
|
|
99
|
+
let tz = null;
|
|
100
|
+
try {
|
|
101
|
+
const config = loadConfig();
|
|
102
|
+
if (config && config.currentLocation && config.currentLocation.timezone) {
|
|
103
|
+
tz = config.currentLocation.timezone;
|
|
104
|
+
}
|
|
105
|
+
} catch (_) {}
|
|
106
|
+
const off = tz ? getTimezoneOffset(dateComponents, tz) : -new Date().getTimezoneOffset();
|
|
107
|
+
const julianDay = calculateJulianDayUTC(dateComponents, off);
|
|
96
108
|
|
|
97
109
|
const houses = await calculateHouses(julianDay, houseSystem);
|
|
98
110
|
const planetHouse = getPlanetHouse(planetLongitude, houses.house);
|