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

myfund-cli

v0.1.0

Published

Agent-first JSON CLI for querying myFund portfolio data.

Readme

myFund CLI

Agent-friendly JSON CLI for querying myFund portfolio data without pushing the full beta API payload into your context window.

myfund calls the myfund.pl API, normalizes the parts agents usually need, and writes compact JSON that is easy to parse from scripts, skills, and automation.

Why Prefer the CLI Over the Official API?

The official myFund API is the source of truth, but its beta response can be too broad for agent workflows. Pulling the full payload into context by default wastes tokens, makes parsing more fragile, and exposes data the current task may not need.

This CLI keeps the workflow agentic:

  • Token efficiency: focused commands return only the requested slice of portfolio data.
  • Progressive disclosure: agents can start with summary, then drill into positions, position, allocation, or history only when needed.
  • Bounded history: history returns one metric at a time and enforces range, interval, and point limits.

Requirements

Installation

Install from npm after the package is published:

npm install -g myfund-cli

Codex Skill

This repository includes a Codex skill at skills/myfund-cli for agents that should prefer the CLI over direct myFund API calls.

npx skills add https://github.com/szemroda/myfund-cli --skill myfund-cli

Quick Start

Configure an API key and a default portfolio:

myfund config set api-key <key>
myfund portfolios add "Portfolio in total" --description "Aggregated portfolio"
myfund portfolios set-default "Portfolio in total"

Query the default portfolio:

myfund capabilities
myfund summary
myfund positions --sort value --limit 10
myfund history --metric value --period 90d --interval weekly

Query a portfolio without storing it as the default:

myfund summary --portfolio "Long-term portfolio"

Configuration

Default config path:

~/.config/myfund-cli/config.json

Use a different config file for any command:

myfund --config ./myfund.config.json summary

API key resolution order:

  1. Config apiKey
  2. MYFUND_API_KEY

Portfolio resolution order for API-backed commands:

  1. --portfolio <name>
  2. Config defaultPortfolio

Useful config commands:

myfund config get
myfund config path
myfund config set api-key <key>
myfund config unset api-key
myfund config set default-portfolio <name>
myfund config unset default-portfolio

myfund config get reports whether an API key is configured, but never prints the key.

Commands

Portfolio Data

myfund capabilities
myfund summary [--portfolio <name>]
myfund performance [--portfolio <name>]
myfund positions [--portfolio <name>] [--sort value|weight|profit|return|daily-change] [--limit <n>] [--type <type>] [--source-portfolio <name>]
myfund position <query> [--portfolio <name>]
myfund allocation --by asset-type|position [--portfolio <name>]
myfund history --metric value|profit|contribution|benchmark|return [--portfolio <name>] [--period 30d|90d|1y|ytd|all] [--from YYYY-MM-DD] [--to YYYY-MM-DD] [--interval daily|weekly|monthly] [--max-points <n>]
myfund raw-response [--portfolio <name>]

Portfolio Registry

The portfolio registry is local metadata stored in the config file. It does not create, rename, or delete portfolios in myFund.

myfund portfolios list
myfund portfolios add <name> [description]
myfund portfolios add <name> --description <text>
myfund portfolios remove <name>
myfund portfolios set-default <name>

Config

myfund config get
myfund config path
myfund config set api-key <key>
myfund config unset api-key
myfund config set default-portfolio <name>
myfund config unset default-portfolio

Output Contract

Successful commands write minified JSON to stdout.

myfund capabilities returns an agent-facing JSON catalog of commands, when to use each command, important options, output shapes, and examples. Agents should call it first when the right command is unclear.

Example success shape:

{"portfolio":"Portfolio in total","value":12345.67,"periodReturns":{"1m":1.23,"ytd":4.56}}

Errors write minified JSON to stderr and return a non-zero exit code.

Example error shape:

{"error":{"code":"MISSING_PORTFOLIO","message":"Missing portfolio. Pass --portfolio or configure defaultPortfolio."}}

Common error codes include:

  • MISSING_API_KEY
  • MISSING_PORTFOLIO
  • PORTFOLIO_NOT_FOUND
  • MYFUND_API_ERROR
  • NETWORK_ERROR
  • INVALID_ARGUMENTS
  • POSITION_NOT_FOUND
  • AMBIGUOUS_POSITION
  • TOO_MANY_POINTS
  • CONFIG_ERROR

History Queries

History is the largest and riskiest part of the myFund API response for agent workflows. The history command returns only one requested metric and enforces bounded output.

Supported metrics:

  • value
  • profit
  • contribution
  • benchmark
  • return

Defaults:

  • --period 30d when no range is supplied
  • daily interval for ranges up to 90 days
  • weekly interval for --period 1y
  • monthly interval for --period all and ranges longer than 90 days
  • --max-points 366

Use either --period or --from/--to, not both.

Examples:

myfund history --metric value --period 30d
myfund history --metric return --period ytd
myfund history --metric profit --from 2026-01-01 --to 2026-06-30 --interval monthly

Use raw-response only when you explicitly need the complete myFund API payload:

myfund raw-response --portfolio "Portfolio in total"

Development

npm run typecheck
npm test
npm run build
npm audit
npm run verify

npm run verify runs typecheck, tests, build, and audit.

The package targets Node.js 20+. Dependencies intentionally avoid packages that require newer Node versions.