diff --git a/.wiki/API-Reference.md b/.wiki/API-Reference.md index 5436edf..b2a24e0 100644 --- a/.wiki/API-Reference.md +++ b/.wiki/API-Reference.md @@ -16,7 +16,7 @@ async function initKernels(config?: KernelConfig): Promise interface KernelConfig { planetary?: KernelSource // DE442S source. Default: auto-download leapSeconds?: KernelSource // LSK source. Default: auto-download - cacheDir?: string // Cache dir. Default: ~/.cache/moon-calc + cacheDir?: string // Cache dir. Default: ~/.cache/moon-sighting checksumOverride?: string // SHA-256 override for de442s.bsp } diff --git a/.wiki/Crescent-Visibility.md b/.wiki/Crescent-Visibility.md index f38aae0..f9537b0 100644 --- a/.wiki/Crescent-Visibility.md +++ b/.wiki/Crescent-Visibility.md @@ -2,7 +2,7 @@ The new crescent moon is visible when it has moved far enough from the Sun, climbed high enough above the horizon at sunset, and formed a wide enough arc to overcome sky brightness and atmospheric extinction. No criterion can guarantee a sighting. Real-world results depend on atmospheric clarity, observer acuity, and optical equipment. -moon-calc implements two complementary published criteria and outputs both simultaneously, so applications can explain the prediction in terms of either model. +moon-sighting implements two complementary published criteria and outputs both simultaneously, so applications can explain the prediction in terms of either model. ## The five geometric quantities @@ -61,7 +61,7 @@ Category F corresponds to ARCL below roughly 7° (the Danjon limit), where the M ### W' vs W -Yallop defines two variants of crescent width. The geocentric W uses the semi-diameter of the Moon and Sun at their geocentric distances. The topocentric W' (W-prime) applies a parallax-based correction because the Moon's apparent diameter changes by ~1% between the geocenter and a surface observer at typical latitudes. moon-calc computes W' directly from the topocentric state vector. +Yallop defines two variants of crescent width. The geocentric W uses the semi-diameter of the Moon and Sun at their geocentric distances. The topocentric W' (W-prime) applies a parallax-based correction because the Moon's apparent diameter changes by ~1% between the geocenter and a surface observer at typical latitudes. moon-sighting computes W' directly from the topocentric state vector. ### Implementation notes @@ -120,7 +120,7 @@ For a typical 90-minute lag this gives approximately 40 minutes after sunset, wh ### Optimized (optional) -moon-calc can scan the interval from sunset to moonset, computing the Odeh V parameter at each step and finding the time that maximizes it. This handles high-latitude cases where the Moon's altitude changes quickly and the heuristic can be significantly off. +moon-sighting can scan the interval from sunset to moonset, computing the Odeh V parameter at each step and finding the time that maximizes it. This handles high-latitude cases where the Moon's altitude changes quickly and the heuristic can be significantly off. ## Observation window diff --git a/.wiki/Ephemeris.md b/.wiki/Ephemeris.md index 11f0f65..c4dd739 100644 --- a/.wiki/Ephemeris.md +++ b/.wiki/Ephemeris.md @@ -37,7 +37,7 @@ SPK (Spacecraft and Planet Kernel) files use the DAF (Double Precision Array Fil ### Endianness -NAIF kernels are created on the platform that generated them (typically IEEE little-endian for modern kernels). The file record contains an endianness flag; moon-calc reads this and byte-swaps doubles as needed. +NAIF kernels are created on the platform that generated them (typically IEEE little-endian for modern kernels). The file record contains an endianness flag; moon-sighting reads this and byte-swaps doubles as needed. ### Summary record navigation @@ -68,7 +68,7 @@ Velocity is computed by differentiating the Chebyshev polynomial analytically (u ### Type 3: Chebyshev position + velocity -Type 3 stores separate Chebyshev fits for position and velocity. The structure has 6 coefficient arrays (X, Y, Z for position; X, Y, Z for velocity). Used for some satellite ephemerides; moon-calc implements it for forward compatibility. +Type 3 stores separate Chebyshev fits for position and velocity. The structure has 6 coefficient arrays (X, Y, Z for position; X, Y, Z for velocity). Used for some satellite ephemerides; moon-sighting implements it for forward compatibility. ## Chebyshev evaluation @@ -84,7 +84,7 @@ for k = n downto 0: result = (b_0 - b_2) / 2 [for standard Clenshaw] ``` -For moon-calc's implementation (where the constant term c_0 appears differently), we use the SPICE convention: +For moon-sighting's implementation (where the constant term c_0 appears differently), we use the SPICE convention: ``` result = c_0 + x·b_1 - b_2 @@ -142,7 +142,7 @@ For batch evaluation (e.g., scanning 1000 times across a year for calendar gener ## Verification -moon-calc's ephemeris evaluations can be verified against: +moon-sighting's ephemeris evaluations can be verified against: 1. **SPICE:** the reference implementation from NAIF. Using the same kernel and the same (target, center, frame, ET) arguments, SPICE should produce identical results (to floating-point precision) because both use the same binary data and the same Chebyshev algorithm. diff --git a/.wiki/Getting-Started.md b/.wiki/Getting-Started.md index bd63033..a7b2abe 100644 --- a/.wiki/Getting-Started.md +++ b/.wiki/Getting-Started.md @@ -11,17 +11,17 @@ Moon phase queries work in browsers and any runtime without a kernel or network ## Install ```bash -npm install moon-calc +npm install moon-sighting # or -pnpm add moon-calc +pnpm add moon-sighting ``` ## Download the kernel (one time) -moon-calc uses the JPL DE442S planetary ephemeris. The binary kernel file is 31 MB and is not bundled with the npm package. +moon-sighting uses the JPL DE442S planetary ephemeris. The binary kernel file is 31 MB and is not bundled with the npm package. ```bash -npx moon-calc download-kernels +npx moon-sighting download-kernels ``` This downloads two files: @@ -30,8 +30,8 @@ This downloads two files: - `naif0012.tls` (4 KB): leap-second table Default cache location: -- Linux/macOS: `~/.cache/moon-calc/` -- Windows: `%LOCALAPPDATA%\moon-calc\` +- Linux/macOS: `~/.cache/moon-sighting/` +- Windows: `%LOCALAPPDATA%\moon-sighting\` To use a custom cache directory: @@ -42,13 +42,13 @@ await initKernels({ cacheDir: '/my/data/dir' }) To verify the download afterward: ```bash -npx moon-calc verify-kernels +npx moon-sighting verify-kernels ``` ## First sighting report ```ts -import { initKernels, getMoonSightingReport } from 'moon-calc' +import { initKernels, getMoonSightingReport } from 'moon-sighting' // Load the kernel once per process await initKernels() @@ -85,7 +85,7 @@ console.log(report.moonPosition) ## Moon phase (no kernel needed) ```ts -import { getMoonPhase } from 'moon-calc' +import { getMoonPhase } from 'moon-sighting' const phase = getMoonPhase() console.log(phase.phase) // 'waxing-crescent' @@ -100,7 +100,7 @@ const past = getMoonPhase(new Date('2024-01-01')) ## Rise and set times ```ts -import { initKernels, getSunMoonEvents } from 'moon-calc' +import { initKernels, getSunMoonEvents } from 'moon-sighting' await initKernels() @@ -163,19 +163,19 @@ All features are accessible from the command line: ```bash # Download kernels -npx moon-calc download-kernels +npx moon-sighting download-kernels # Sighting report -npx moon-calc sighting 51.5 -0.1 2025-03-29 +npx moon-sighting sighting 51.5 -0.1 2025-03-29 # Moon phase -npx moon-calc phase 2025-03-01 +npx moon-sighting phase 2025-03-01 # Verify kernel integrity -npx moon-calc verify-kernels +npx moon-sighting verify-kernels # Performance benchmark -npx moon-calc benchmark +npx moon-sighting benchmark ``` --- diff --git a/.wiki/Home.md b/.wiki/Home.md index b0a9099..6e97f6f 100644 --- a/.wiki/Home.md +++ b/.wiki/Home.md @@ -1,10 +1,10 @@ -# moon-calc +# moon-sighting High-accuracy lunar crescent visibility and moon sighting calculations using JPL DE442S ephemerides. ## What this library does -moon-calc computes whether the new crescent moon will be visible at a specific location on a specific date. It produces the geometric quantities used by astronomers and Islamic lunar calendar authorities worldwide, including the Yallop q-test and Odeh visibility zones. +moon-sighting computes whether the new crescent moon will be visible at a specific location on a specific date. It produces the geometric quantities used by astronomers and Islamic lunar calendar authorities worldwide, including the Yallop q-test and Odeh visibility zones. It also computes moon phase data, rise/set times, and twilight periods for any location. @@ -33,7 +33,7 @@ It also computes moon phase data, rise/set times, and twilight periods for any l ## Quick example ```ts -import { initKernels, getMoonSightingReport } from 'moon-calc' +import { initKernels, getMoonSightingReport } from 'moon-sighting' await initKernels() diff --git a/.wiki/Observer-Model.md b/.wiki/Observer-Model.md index 2d7d081..6bdff41 100644 --- a/.wiki/Observer-Model.md +++ b/.wiki/Observer-Model.md @@ -122,7 +122,7 @@ This is why crescent sighting criteria use "airless" (refraction-free) altitudes | "Where to look" altitude output | Standard refraction | | Civil/nautical/astronomical twilight | Standard refraction | -moon-calc computes both airless and apparent altitudes for each body position and uses the appropriate one for each purpose. +moon-sighting computes both airless and apparent altitudes for each body position and uses the appropriate one for each purpose. --- diff --git a/.wiki/Reference-Frames.md b/.wiki/Reference-Frames.md index 37b7072..a89f351 100644 --- a/.wiki/Reference-Frames.md +++ b/.wiki/Reference-Frames.md @@ -67,7 +67,7 @@ The Earth's rotation pole (CIP) does not coincide exactly with the conventional Typical magnitudes: ≤ 0.3 arcseconds. At the Earth's surface, this introduces errors of < 30 meters if ignored, negligible for crescent sighting work (Moon angular diameter ~0.5°). -moon-calc defaults to xp = yp = 0. Supply current values from IERS Bulletin A for maximum accuracy. +moon-sighting defaults to xp = yp = 0. Supply current values from IERS Bulletin A for maximum accuracy. ## IAU 2000A vs 2000B @@ -79,7 +79,7 @@ moon-calc defaults to xp = yp = 0. Supply current values from IERS Bulletin A fo | Computation | ~2× slower | fast | | Suitable for | moon sighting | approximate work | -For crescent sighting at the horizon where refraction dominates, 2000B is more than sufficient. moon-calc defaults to 2000A for correctness; 2000B will be available as a compile-time option for size-sensitive builds. +For crescent sighting at the horizon where refraction dominates, 2000B is more than sufficient. moon-sighting defaults to 2000A for correctness; 2000B will be available as a compile-time option for size-sensitive builds. ## From GCRS to local alt/az diff --git a/.wiki/Time-Scales.md b/.wiki/Time-Scales.md index 6a1223e..8bef498 100644 --- a/.wiki/Time-Scales.md +++ b/.wiki/Time-Scales.md @@ -1,6 +1,6 @@ # Time Scales -Getting time right is the most error-prone part of an astronomy library. moon-calc implements a complete conversion chain from the user's familiar UTC input to the internal TDB time argument required by the JPL ephemeris. +Getting time right is the most error-prone part of an astronomy library. moon-sighting implements a complete conversion chain from the user's familiar UTC input to the internal TDB time argument required by the JPL ephemeris. ## The time scale chain @@ -33,7 +33,7 @@ UTC is the international time standard, synchronized to TAI via occasional leap TAI = UTC + ΔAT, where ΔAT is the cumulative leap second count. ΔAT grows in 1-second steps whenever the IERS determines that Earth's rotation has slowed enough. As of 2024, ΔAT = 37 seconds. -moon-calc ships the complete leap-second table (through 2017) and parses the NAIF LSK kernel (`naif0012.tls`) to stay current when the user downloads it. +moon-sighting ships the complete leap-second table (through 2017) and parses the NAIF LSK kernel (`naif0012.tls`) to stay current when the user downloads it. ## TT: Terrestrial Time @@ -54,7 +54,7 @@ TDB − TT ≈ 0.001658 s × sin(g) + 0.000014 s × sin(2g) g = 357.53° + 0.9856003° × (JD_TT − 2451545.0) (Sun's mean anomaly) ``` -For crescent sighting purposes this ~1 ms difference is negligible (Moon moves ~30 arcsec/second, so 1 ms → ~0.03 arcsec position error). moon-calc applies the correction anyway to be consistent with SPICE. +For crescent sighting purposes this ~1 ms difference is negligible (Moon moves ~30 arcsec/second, so 1 ms → ~0.03 arcsec position error). moon-sighting applies the correction anyway to be consistent with SPICE. In the SPICE system, the internal time argument is called ET (Ephemeris Time) and is expressed as seconds past J2000.0 TDB: @@ -102,7 +102,7 @@ The constant 2440587.5 is JD for 1970-01-01 00:00:00 UTC. ## Leap-second kernel -The NAIF LSK (`naif0012.tls`) is a plain-text file in NAIF text kernel format. It contains the ΔAT table and the constants needed to compute TDB from TT. moon-calc parses this file when the user downloads kernels, ensuring the library always reflects the latest leap seconds. The hardcoded table in `time/index.ts` serves as a fallback when no LSK is provided. +The NAIF LSK (`naif0012.tls`) is a plain-text file in NAIF text kernel format. It contains the ΔAT table and the constants needed to compute TDB from TT. moon-sighting parses this file when the user downloads kernels, ensuring the library always reflects the latest leap seconds. The hardcoded table in `time/index.ts` serves as a fallback when no LSK is provided. --- diff --git a/.wiki/Validation.md b/.wiki/Validation.md index 24917d5..5b1553f 100644 --- a/.wiki/Validation.md +++ b/.wiki/Validation.md @@ -1,6 +1,6 @@ # Validation -moon-calc is validated at multiple levels: kernel parsing, ephemeris evaluation, frame transforms, and full sighting reports. The goal is to make each component independently verifiable against authoritative references. +moon-sighting is validated at multiple levels: kernel parsing, ephemeris evaluation, frame transforms, and full sighting reports. The goal is to make each component independently verifiable against authoritative references. ## Validation philosophy @@ -16,9 +16,9 @@ Crescent visibility criteria depend on a chain of computations, each of which ca ### SPICE (CSPICE / SpiceyPy) -NASA NAIF's SPICE toolkit is the authoritative reference for reading JPL ephemerides. It is written in C (CSPICE) with Python bindings (SpiceyPy). Using the same kernel (`de442s.bsp`) and the same time/frame arguments, SPICE should produce positions that are bit-identical to moon-calc's output (to double-precision floating-point). +NASA NAIF's SPICE toolkit is the authoritative reference for reading JPL ephemerides. It is written in C (CSPICE) with Python bindings (SpiceyPy). Using the same kernel (`de442s.bsp`) and the same time/frame arguments, SPICE should produce positions that are bit-identical to moon-sighting's output (to double-precision floating-point). -Any deviation in the SPK Chebyshev evaluation from SPICE indicates a parsing or algorithm error in moon-calc. +Any deviation in the SPK Chebyshev evaluation from SPICE indicates a parsing or algorithm error in moon-sighting. **How to compare:** ```python @@ -32,7 +32,7 @@ state, lt = spice.spkezr('301', et, 'J2000', 'NONE', '399') print(state[:3]) # position in km ``` -The moon-calc equivalent: +The moon-sighting equivalent: ```ts const kernel = SpkKernel.fromFile('de442s.bsp') const ts = computeTimeScales(new Date('2025-03-29T20:00:00Z')) @@ -57,7 +57,7 @@ Go to https://ssd.jpl.nasa.gov/horizons/, select: - Time span: the date of interest - Output quantities: Observer az/alt, Illuminated fraction, Elongation -Compare Horizons' output with moon-calc's topocentric az/alt. Differences of < 30 arcseconds indicate the frame transforms are correct. +Compare Horizons' output with moon-sighting's topocentric az/alt. Differences of < 30 arcseconds indicate the frame transforms are correct. ## Acceptance thresholds @@ -78,7 +78,7 @@ The test harness will: 1. Load `de442s.bsp` and evaluate Moon/Sun states at 1000 randomly sampled times within 1849–2150. 2. Compare each result against SPICE output for the same kernel, time, and frames. 3. For 50 geographically diverse locations × 12 months, compute full sighting reports and compare ARCL, ARCV, DAZ, W, q, and V against reference implementations. -4. For the same 50 locations, compare Horizons tabular output with moon-calc's az/alt at the same times. +4. For the same 50 locations, compare Horizons tabular output with moon-sighting's az/alt at the same times. The suite is run in CI on major releases. Raw comparison data (SPICE reference outputs) is stored as CSV files in the test fixtures directory. diff --git a/CHANGELOG.md b/CHANGELOG.md index f268452..7157fe5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -All notable changes to moon-calc are documented here. +All notable changes to moon-sighting are documented here. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [1.0.0] - 2026-02-25 diff --git a/README.md b/README.md index f8f810c..c918baa 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ -# moon-calc +# moon-sighting -[![npm version](https://img.shields.io/npm/v/moon-calc.svg)](https://www.npmjs.com/package/moon-calc) -[![CI](https://github.com/acamarata/moon-calc/actions/workflows/ci.yml/badge.svg)](https://github.com/acamarata/moon-calc/actions/workflows/ci.yml) +[![npm version](https://img.shields.io/npm/v/moon-sighting.svg)](https://www.npmjs.com/package/moon-sighting) +[![CI](https://github.com/acamarata/moon-sighting/actions/workflows/ci.yml/badge.svg)](https://github.com/acamarata/moon-sighting/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) High-accuracy lunar crescent visibility and moon sighting library for Node.js and browsers. Uses JPL DE442S ephemerides with full IERS Earth orientation for sub-arcsecond topocentric Moon and Sun positions. @@ -11,13 +11,13 @@ Implements the Yallop (NAO TN 69) and Odeh (Experimental Astronomy 2006) crescen ## Installation ```bash -npm install moon-calc +npm install moon-sighting ``` After installing, download the JPL ephemeris kernel (31 MB, one-time setup): ```bash -npx moon-calc download-kernels +npx moon-sighting download-kernels ``` This fetches `de442s.bsp` and `naif0012.tls` from NASA's NAIF server and caches them locally. The download is verified by SHA-256 checksum. @@ -25,7 +25,7 @@ This fetches `de442s.bsp` and `naif0012.tls` from NASA's NAIF server and caches ## Quick start ```ts -import { initKernels, getMoonSightingReport, getMoonPhase } from 'moon-calc' +import { initKernels, getMoonSightingReport, getMoonPhase } from 'moon-sighting' // One-time setup: load the ephemeris kernel await initKernels() @@ -177,26 +177,26 @@ src/ cli/ Command-line interface ``` -See the [Architecture wiki page](https://github.com/acamarata/moon-calc/wiki/Architecture) for a full technical description. +See the [Architecture wiki page](https://github.com/acamarata/moon-sighting/wiki/Architecture) for a full technical description. ## CLI ```bash # Setup (one-time) -npx moon-calc download-kernels +npx moon-sighting download-kernels # Sighting report -npx moon-calc sighting 51.5 -0.1 2025-03-29 -npx moon-calc sighting 21.4 39.8 # Mecca +npx moon-sighting sighting 51.5 -0.1 2025-03-29 +npx moon-sighting sighting 21.4 39.8 # Mecca # Moon phase -npx moon-calc phase 2025-03-01 +npx moon-sighting phase 2025-03-01 # Verify downloaded kernels -npx moon-calc verify-kernels +npx moon-sighting verify-kernels # Benchmark -npx moon-calc benchmark +npx moon-sighting benchmark ``` ## Compatibility @@ -206,8 +206,8 @@ npx moon-calc benchmark | Node.js 20+ | Full (all features) | | Node.js 22, 24 | Full | | Browser | Partial (no auto-download; supply kernel buffer) | -| ESM | `import` from `moon-calc` | -| CommonJS | `require('moon-calc')` | +| ESM | `import` from `moon-sighting` | +| CommonJS | `require('moon-sighting')` | | TypeScript | Full type definitions included | ## TypeScript @@ -219,22 +219,22 @@ import type { YallopCategory, OdehZone, KernelConfig, -} from 'moon-calc' +} from 'moon-sighting' ``` ## Documentation -Full documentation is on the [GitHub Wiki](https://github.com/acamarata/moon-calc/wiki): +Full documentation is on the [GitHub Wiki](https://github.com/acamarata/moon-sighting/wiki): -- [Getting Started](https://github.com/acamarata/moon-calc/wiki/Getting-Started) -- [API Reference](https://github.com/acamarata/moon-calc/wiki/API-Reference) -- [Architecture](https://github.com/acamarata/moon-calc/wiki/Architecture) -- [Crescent Visibility Criteria](https://github.com/acamarata/moon-calc/wiki/Crescent-Visibility) -- [Ephemeris and Kernel Setup](https://github.com/acamarata/moon-calc/wiki/Ephemeris) -- [Time Scales](https://github.com/acamarata/moon-calc/wiki/Time-Scales) -- [Reference Frames](https://github.com/acamarata/moon-calc/wiki/Reference-Frames) -- [Observer Model and Refraction](https://github.com/acamarata/moon-calc/wiki/Observer-Model) -- [Validation](https://github.com/acamarata/moon-calc/wiki/Validation) +- [Getting Started](https://github.com/acamarata/moon-sighting/wiki/Getting-Started) +- [API Reference](https://github.com/acamarata/moon-sighting/wiki/API-Reference) +- [Architecture](https://github.com/acamarata/moon-sighting/wiki/Architecture) +- [Crescent Visibility Criteria](https://github.com/acamarata/moon-sighting/wiki/Crescent-Visibility) +- [Ephemeris and Kernel Setup](https://github.com/acamarata/moon-sighting/wiki/Ephemeris) +- [Time Scales](https://github.com/acamarata/moon-sighting/wiki/Time-Scales) +- [Reference Frames](https://github.com/acamarata/moon-sighting/wiki/Reference-Frames) +- [Observer Model and Refraction](https://github.com/acamarata/moon-sighting/wiki/Observer-Model) +- [Validation](https://github.com/acamarata/moon-sighting/wiki/Validation) ## Related diff --git a/package.json b/package.json index 964c0be..ad358f8 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "moon-calc", + "name": "moon-sighting", "version": "1.0.0", "description": "High-accuracy lunar crescent visibility and moon sighting calculations using JPL DE442S ephemerides. Implements Yallop and Odeh criteria for Islamic crescent sighting workflows.", "author": "Aric Camarata", @@ -15,7 +15,7 @@ } }, "bin": { - "moon-calc": "./dist/cli/index.cjs" + "moon-sighting": "./dist/cli/index.cjs" }, "sideEffects": false, "files": [ @@ -46,11 +46,11 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/acamarata/moon-calc.git" + "url": "git+https://github.com/acamarata/moon-sighting.git" }, - "homepage": "https://github.com/acamarata/moon-calc#readme", + "homepage": "https://github.com/acamarata/moon-sighting#readme", "bugs": { - "url": "https://github.com/acamarata/moon-calc/issues" + "url": "https://github.com/acamarata/moon-sighting/issues" }, "keywords": [ "moon", diff --git a/src/api/index.ts b/src/api/index.ts index dff1f72..587fb63 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -69,9 +69,9 @@ function resolveCacheDir(override?: string): string { if (override) return override const { platform, env } = process if (platform === 'win32') { - return `${env['LOCALAPPDATA'] ?? env['APPDATA'] ?? 'C:\\Users\\Public\\AppData\\Local'}\\moon-calc` + return `${env['LOCALAPPDATA'] ?? env['APPDATA'] ?? 'C:\\Users\\Public\\AppData\\Local'}\\moon-sighting` } - return `${env['HOME'] ?? '/tmp'}/.cache/moon-calc` + return `${env['HOME'] ?? '/tmp'}/.cache/moon-sighting` } // ─── Download sources ───────────────────────────────────────────────────────── diff --git a/src/cli/index.ts b/src/cli/index.ts index 605df8b..b5cefe0 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -1,12 +1,12 @@ /** - * moon-calc CLI + * moon-sighting CLI * * Commands: - * moon-calc download-kernels Download DE442S and naif0012.tls to cache - * moon-calc verify-kernels Verify cached kernels by SHA-256 checksum - * moon-calc sighting [date] Print a sighting report - * moon-calc phase [date] Print current moon phase - * moon-calc benchmark Run performance benchmark + * moon-sighting download-kernels Download DE442S and naif0012.tls to cache + * moon-sighting verify-kernels Verify cached kernels by SHA-256 checksum + * moon-sighting sighting [date] Print a sighting report + * moon-sighting phase [date] Print current moon phase + * moon-sighting benchmark Run performance benchmark */ import { @@ -44,7 +44,7 @@ async function main() { } function printHelp() { - console.log(`moon-calc — Lunar crescent visibility calculator + console.log(`moon-sighting — Lunar crescent visibility calculator Commands: download-kernels Download DE442S and naif0012.tls to cache @@ -54,10 +54,10 @@ Commands: benchmark Run performance benchmark Examples: - moon-calc download-kernels - moon-calc sighting 51.5 -0.1 2025-03-29 - moon-calc sighting 21.4 39.8 # Mecca - moon-calc phase 2025-03-01`) + moon-sighting download-kernels + moon-sighting sighting 51.5 -0.1 2025-03-29 + moon-sighting sighting 21.4 39.8 # Mecca + moon-sighting phase 2025-03-01`) } async function cmdDownloadKernels() { @@ -81,7 +81,7 @@ async function cmdSighting(cmdArgs: string[]) { const dateStr = cmdArgs[2] ?? new Date().toISOString().slice(0, 10) if (isNaN(lat) || isNaN(lon)) { - console.error('Usage: moon-calc sighting [YYYY-MM-DD]') + console.error('Usage: moon-sighting sighting [YYYY-MM-DD]') process.exit(1) } @@ -142,7 +142,7 @@ function cmdPhase(dateStr?: string) { } async function cmdBenchmark() { - console.log('moon-calc benchmark\n') + console.log('moon-sighting benchmark\n') // Benchmark 1: getMoonPhase (no kernel needed) const N_PHASE = 10000 diff --git a/src/index.ts b/src/index.ts index 30e3d82..2d3b90a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,12 @@ /** - * moon-calc — High-accuracy lunar crescent visibility and moon sighting calculations. + * moon-sighting — High-accuracy lunar crescent visibility and moon sighting calculations. * * Uses JPL DE442S ephemerides with full IERS Earth orientation for precise * topocentric Sun/Moon positions. Implements the Yallop (NAO TN 69) and * Odeh (Experimental Astronomy 2006) crescent visibility criteria. * * Quick start: - * import { getMoonSightingReport } from 'moon-calc' + * import { getMoonSightingReport } from 'moon-sighting' * * const report = await getMoonSightingReport(new Date('2025-03-01'), { * lat: 51.5, lon: -0.1, elevation: 20, name: 'London' diff --git a/src/types.ts b/src/types.ts index 5878d63..9db2f80 100644 --- a/src/types.ts +++ b/src/types.ts @@ -293,7 +293,7 @@ export type KernelSource = | { type: 'file'; path: string } | { type: 'buffer'; data: ArrayBuffer; name: string } | { type: 'url'; url: string } - | { type: 'auto' } // auto-download from NAIF, cache in ~/.cache/moon-calc + | { type: 'auto' } // auto-download from NAIF, cache in ~/.cache/moon-sighting export interface KernelConfig { /** Planetary SPK kernel — defaults to de442s.bsp via auto-download */ @@ -302,7 +302,7 @@ export interface KernelConfig { leapSeconds?: KernelSource /** * Directory for the download cache. - * Defaults to ~/.cache/moon-calc on POSIX, %LOCALAPPDATA%\moon-calc on Windows. + * Defaults to ~/.cache/moon-sighting on POSIX, %LOCALAPPDATA%\moon-sighting on Windows. */ cacheDir?: string /** diff --git a/test-cjs.cjs b/test-cjs.cjs index dc0ed1a..cce76c3 100644 --- a/test-cjs.cjs +++ b/test-cjs.cjs @@ -1,7 +1,7 @@ 'use strict' /** - * moon-calc CJS test suite + * moon-sighting CJS test suite * Runs with: node test-cjs.cjs * Verifies the CommonJS build is functional. */ diff --git a/test.mjs b/test.mjs index 1956e42..3b8b840 100644 --- a/test.mjs +++ b/test.mjs @@ -1,5 +1,5 @@ /** - * moon-calc ESM test suite + * moon-sighting ESM test suite * Runs with: node test.mjs * All tests use plain assert — no test framework. */