thoth-cli 0.2.8 → 0.2.9

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/dist/bin.js CHANGED
@@ -43,7 +43,7 @@ Examples:
43
43
  thoth synastry --date1 1991-07-08 --time1 14:06 --city1 "New York" --date2 2026-02-26 --time2 04:35 --city2 "New York"
44
44
  thoth progressions --natal-date 1991-07-08 --natal-time 14:06 --city "New York" --target-date 2026-03-01
45
45
  thoth moon
46
- thoth ephemeris --body pluto`).version("0.2.8");
46
+ thoth ephemeris --body pluto`).version("0.2.9");
47
47
  program.command("chart").description("Calculate a natal chart").requiredOption("--date <date>", "Birth date (YYYY-MM-DD)").requiredOption("--time <time>", "Birth time (HH:MM)").option("--lat <lat>", "Latitude", parseFloat).option("--lng <lng>", "Longitude", parseFloat).option("--city <city>", "City name").option("--nation <nation>", "Country code", "US").option("--name <name>", "Name", "Subject").option("--json", "Output raw JSON").option("--svg", "Output SVG chart").option("--svg-file <path>", "Save SVG to file").action(async (options) => {
48
48
  if (!options.city && (!options.lat || !options.lng)) {
49
49
  console.error(chalk.red("Error: Must provide either --city or both --lat and --lng"));
@@ -535,6 +535,6 @@ program.command("key").description("Symbol reference guide").action(() => {
535
535
  console.log("");
536
536
  });
537
537
  console.log(chalk.dim(""));
538
- console.log(chalk.yellow(" \u{1315D}") + chalk.dim(" thoth-cli v0.2.8"));
538
+ console.log(chalk.yellow(" \u{1315D}") + chalk.dim(" thoth-cli v0.2.9"));
539
539
  console.log(chalk.dim(""));
540
540
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "thoth-cli",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "𓅝 Astrological calculations from the command line. Swiss Ephemeris precision. Built for humans and agents.",
5
5
  "author": "AKLO <aklo@aklolabs.com>",
6
6
  "license": "MIT",
@@ -1,20 +1,26 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Postinstall script - downloads the correct thoth-core binary
3
+ * Postinstall script - downloads and decompresses the correct thoth-core binary
4
4
  * 𓅝
5
5
  */
6
6
 
7
7
  import { platform, arch } from 'os';
8
8
  import { join, dirname } from 'path';
9
- import { existsSync, mkdirSync, createWriteStream, chmodSync, statSync } from 'fs';
9
+ import { existsSync, mkdirSync, createWriteStream, chmodSync, statSync, unlinkSync } from 'fs';
10
+ import { createGunzip } from 'zlib';
11
+ import { pipeline } from 'stream/promises';
10
12
  import { fileURLToPath } from 'url';
11
13
  import https from 'https';
12
14
 
13
15
  const __dirname = dirname(fileURLToPath(import.meta.url));
14
16
 
15
- const VERSION = '0.2.7';
17
+ const VERSION = '0.2.9';
16
18
  const REPO = 'aklo360/thoth-cli';
17
- const BASE_URL = `https://github.com/${REPO}/releases/download/v${VERSION}`;
19
+
20
+ // Use jsDelivr CDN for faster downloads (mirrors GitHub releases)
21
+ const CDN_URL = `https://cdn.jsdelivr.net/gh/${REPO}@v${VERSION}/releases`;
22
+ // Fallback to GitHub releases directly
23
+ const GITHUB_URL = `https://github.com/${REPO}/releases/download/v${VERSION}`;
18
24
 
19
25
  function getPlatformKey() {
20
26
  const p = platform();
@@ -38,14 +44,12 @@ function getBinaryName() {
38
44
  return platform() === 'win32' ? 'thoth-core.exe' : 'thoth-core';
39
45
  }
40
46
 
41
- async function download(url, dest) {
47
+ function download(url) {
42
48
  return new Promise((resolve, reject) => {
43
- const file = createWriteStream(dest);
44
-
45
49
  https.get(url, (response) => {
46
50
  // Handle redirects
47
51
  if (response.statusCode === 302 || response.statusCode === 301) {
48
- download(response.headers.location, dest).then(resolve).catch(reject);
52
+ download(response.headers.location).then(resolve).catch(reject);
49
53
  return;
50
54
  }
51
55
 
@@ -54,15 +58,19 @@ async function download(url, dest) {
54
58
  return;
55
59
  }
56
60
 
57
- response.pipe(file);
58
- file.on('finish', () => {
59
- file.close();
60
- resolve();
61
- });
61
+ resolve(response);
62
62
  }).on('error', reject);
63
63
  });
64
64
  }
65
65
 
66
+ async function downloadAndDecompress(url, dest) {
67
+ const response = await download(url);
68
+ const gunzip = createGunzip();
69
+ const fileStream = createWriteStream(dest);
70
+
71
+ await pipeline(response, gunzip, fileStream);
72
+ }
73
+
66
74
  async function main() {
67
75
  const platformKey = getPlatformKey();
68
76
  const binaryName = getBinaryName();
@@ -72,34 +80,43 @@ async function main() {
72
80
  // Skip if binary already exists AND has content
73
81
  if (existsSync(binaryPath)) {
74
82
  const stats = statSync(binaryPath);
75
- if (stats.size > 0) {
76
- console.log(`✓ thoth-core binary already exists`);
83
+ if (stats.size > 1000) { // Real binary is ~18MB, placeholder is 0
84
+ console.log(`✓ thoth-core binary already exists (${(stats.size / 1024 / 1024).toFixed(1)}MB)`);
77
85
  return;
78
86
  }
79
- console.log(`Found empty placeholder, downloading actual binary...`);
87
+ console.log(`Found placeholder, downloading actual binary...`);
88
+ unlinkSync(binaryPath); // Remove placeholder
80
89
  }
81
90
 
82
- console.log(`Downloading thoth-core for ${platformKey}...`);
83
-
84
91
  // Create bin directory
85
92
  mkdirSync(binDir, { recursive: true });
86
93
 
87
- // Download binary
88
- const url = `${BASE_URL}/thoth-core-${platformKey}${platform() === 'win32' ? '.exe' : ''}`;
94
+ // Compressed filename
95
+ const compressedName = `thoth-core-${platformKey}${platform() === 'win32' ? '.exe' : ''}.gz`;
96
+
97
+ // Try GitHub releases (jsDelivr doesn't serve release assets directly)
98
+ const url = `${GITHUB_URL}/${compressedName}`;
99
+
100
+ console.log(`Downloading thoth-core for ${platformKey}...`);
101
+ console.log(` From: ${url}`);
102
+
103
+ const startTime = Date.now();
89
104
 
90
105
  try {
91
- await download(url, binaryPath);
106
+ await downloadAndDecompress(url, binaryPath);
92
107
 
93
108
  // Make executable on Unix
94
109
  if (platform() !== 'win32') {
95
110
  chmodSync(binaryPath, 0o755);
96
111
  }
97
112
 
98
- console.log(`✓ Downloaded thoth-core to ${binaryPath}`);
113
+ const stats = statSync(binaryPath);
114
+ const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
115
+ console.log(`✓ Downloaded and decompressed (${(stats.size / 1024 / 1024).toFixed(1)}MB) in ${elapsed}s`);
99
116
  } catch (error) {
100
117
  console.warn(`⚠ Could not download binary: ${error.message}`);
101
- console.warn(` You can run in development mode with Python installed.`);
102
- console.warn(` Install thoth-core: pip install thoth-core`);
118
+ console.warn(` You may need to install thoth-core manually.`);
119
+ console.warn(` Or install via: pip install thoth-core`);
103
120
  }
104
121
  }
105
122