npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

diary-header

v0.1.8

Published

A command-line tool that generates a Markdown header for daily diary entries with location, astronomical, and weather information

Readme

diary-header

A command-line tool written in Rust that interactively generates a Markdown header for your daily diary entries. It automatically retrieves geolocation data, calculates sunrise/sunset times, and determines the sexagenary cycle (干支 - Eto) for any given date.

Features

  • Interactive Prompts: Easily select the date and location using an interactive terminal UI.
  • Location Auto-Detection: Automatically fetches your current location, latitude, longitude, and timezone based on your IP address.
  • Manual Location Selection: Optionally select from a comprehensive list of cities worldwide if you are writing a diary for somewhere else.
  • Astronomical Calculations: Calculates precise sunrise and sunset times based on the selected date and location coordinates.
  • Weather Information: Retrieves daily maximum and minimum temperatures for the selected date and location.
  • Sexagenary Cycle (干支): Automatically computes the traditional continuous calendar cycle (Eto) for the given date.
  • Six-Day Cycle (六曜): Calculates the traditional Japanese six-day cycle (Rokuyo) for fortune-telling and event planning.
  • Language Configuration: Choose between Japanese (ja) and English (en) for the output format.
  • Customizable Display Order: Configure which information to display and in what order via the config file.
  • Persistent Configuration: Prompts for an initial configuration (language) and saves it to a configuration file (~/.config/diary-header/config.toml). You can update this later using the config subcommand.

Installation

Via npm (Recommended)

The easiest way to install diary-header is via npm:

npm install -g diary-header

This will download a prebuilt binary for your platform and make the diary-header command available globally.

Via Cargo

Alternatively, if you have Rust and Cargo installed, you can install from source:

git clone https://github.com/massn/diary-header.git
cd diary-header
cargo install --path .

Or just run it directly:

cargo run

Usage

When you run diary-header (or cargo run), the tool will interactively prompt you for the necessary information:

  1. First-time Setup: If the configuration file does not exist, it will ask for your preferred output language (Japanese or English). This is saved to ~/.config/diary-header/config.toml.
  2. Date Selection: Prompts you to select a date for the diary header (defaults to today).
  3. Location Selection: Prompts you to choose "Current Location (Auto via IP)" or select a specific city from the list.

Example Output

Once the selections are made, the tool outputs a localized Markdown header depending on your configured language:

Japanese Output (ja):

## 2024-11-20 (水)
- 場所 (Current IP Address): Tokyo (Tokyo)
- 緯度経度: (35.6895, 139.6917)
- タイムゾーン: Asia/Tokyo
- 日の出: 06:21:43 JST+0900
- 日の入り: 16:32:11 JST+0900
- 天気: 晴れ
- 降水確率: 20%
- 気温: 最高 18.5°C / 最低 12.3°C
- 干支: 甲辰
- 六曜: 先勝

English Output (en):

## 2024-11-20 (Wednesday)
- Location (Current IP Address): Tokyo (Tokyo)
- Lat/Lon: (35.6895, 139.6917)
- Timezone: Asia/Tokyo
- Sunrise: 06:21:43 JST+0900
- Sunset: 16:32:11 JST+0900
- Weather: Mainly clear
- Precipitation Probability: 20%
- Temperature: Max 18.5°C / Min 12.3°C
- Sexagenary Cycle: 甲辰
- Rokuyo: 先勝

You can redirect this output directly to your diary file or copy it securely:

diary-header >> my-diary.md

Configuration

The configuration file is stored in ~/.config/diary-header/config.toml (macOS/Linux) or %APPDATA%\diary-header\config.toml (Windows).

Language Setting

You can interactively change the language setting at any time by using the config subcommand:

diary-header config
# Or with cargo:
cargo run -- config

Display Order Customization

You can customize the order of displayed information by manually editing the configuration file. By default, all items are displayed in the following order:

language = "en"
display_order = [
    "location",
    "coordinates",
    "timezone",
    "sunrise",
    "sunset",
    "weather",
    "precipitation",
    "temperature",
    "sexagenary_cycle",
    "rokuyo",
]

Available items:

  • location - Location information (city/region)
  • coordinates - Latitude and longitude
  • timezone - Timezone
  • sunrise - Sunrise time
  • sunset - Sunset time
  • weather - Weather condition
  • precipitation - Precipitation probability
  • temperature - Max/min temperature
  • sexagenary_cycle - Sexagenary cycle (干支)
  • rokuyo - Six-day cycle (六曜)

You can reorder these items or remove items you don't need. For example, to show only weather-related information:

language = "ja"
display_order = [
    "weather",
    "temperature",
    "precipitation",
]

Items not included in display_order will not be displayed in the output.

Dependencies

  • inquire: For interactive terminal prompts (date, select, text).
  • reqwest: For hitting the ip-api.com endpoint to fetch IP-based timezone and geolocation info, and the Open-Meteo API for weather data.
  • sunrise: For calculating the exact sunrise and sunset times.
  • tzf-rs: For fast offline timezone timezone lookups based on longitude and latitude.
  • chrono: For date and time manipulation.
  • cities: For the embedded list of global cities.
  • clap: For CLI argument parsing and subcommands.
  • serde / serde_json / toml: For data serialization and writing/reading the config.

License

This project is licensed under the MIT License. See the LICENSE file for details.