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

@sakamossan/get-path-js

v0.0.1

Published

CLI tool to generate path strings from template expressions

Readme

get-path.js

A CLI tool that generates path strings from template expressions.

Build path strings by evaluating JS expressions with built-in variables such as dates, environment variables, current directory info, and git metadata. Designed to let LLMs deterministically generate path strings that would otherwise require ad-hoc shell scripting.

Install

npm install -g @sakamossan/get-path-js

Usage

get (default)

Evaluate a template and output the resulting path string to stdout. The subcommand name can be omitted.

get-path.js 'data/${cwd.basename}/${YYYY}${MM}${DD}/app.log'
# => data/my-app/20260324/app.log

get-path.js '${git.branch}/${git.commit.short}'
# => feature-x/a1b2c3d

list

Evaluate the template for each day in a date range, glob-expand the results, and output existing file paths.

get-path.js list --since 2026-03-20 'logs/${cwd.basename}/${YYYY}-${MM}-${DD}/**/*.log'

| Option | Default | Description | | --- | --- | --- | | --since | today | Start date (YYYY-MM-DD) | | --until | today | End date (YYYY-MM-DD) |

When only --since is specified, the range extends to today. When both are omitted, only today is evaluated. Specifying --until alone is an error.

Use pipes for filtering.

get-path.js list --since 2026-01-01 'logs/${YYYY}${MM}${DD}/**/*.log' | grep error

write

Write stdin content to the file at the template-generated path. Parent directories are created automatically.

echo "hello" | get-path.js write '/tmp/${cwd.basename}/${YYYY}${MM}${DD}.txt'

| Option | Default | Description | | --- | --- | --- | | --append | false | Append to existing file instead of overwriting |

Template Variables

Templates use JS template literal ${...} syntax. Internally evaluated via Function constructor, so any JS expression is valid.

Date

| Variable | Description | Example | | --- | --- | --- | | YYYY | 4-digit year | 2026 | | YY | 2-digit year | 26 | | MM | 2-digit month | 03 | | DD | 2-digit day | 24 | | WW | ISO week number | 13 | | EEE | Abbreviated weekday | Tue |

cwd — Current directory

| Property | Description | | --- | --- | | cwd.fullpath | Full path from process.cwd() | | cwd.basename | Current directory name | | cwd.parentDir | Parent directory name |

env — Environment variables

process.env is available directly.

get-path.js '${env.HOME}/logs/${env.USER}/${YYYY}${MM}${DD}.log'

os — OS information

Node.js os module is available directly.

get-path.js '${os.hostname()}/${os.platform()}/${YYYY}${MM}${DD}'

git — Git metadata

| Property | Description | | --- | --- | | git.branch | Current branch name | | git.commit.short | Abbreviated commit hash | | git.commit.long | Full commit hash |

Git info is fetched only when the template contains git.. Using git variables outside a git repository results in an error.

Security

The Function constructor allows arbitrary JS code in templates. This is intentional — templates are assumed to be authored by the developer, not sourced from external input.

License

MIT