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

pi-env

v1.0.1

Published

Pi extension that sets process environment variables from settings.json

Readme

pi-env

Pi extension that sets process environment variables from settings.json at startup.

Declare env vars declaratively in your pi settings instead of using shell wrappers or polluting your global shell environment.

Why?

  • Scoped to pi only — variables are set inside the pi process without affecting your terminal session or other tools
  • Override existing vars — set pi-specific values that take precedence over what's already in your shell (e.g. route a provider through a different endpoint without changing your global AWS config)
  • Declarative and portable — commit project-level env config in .pi/settings.json for your team, keep personal values in global settings

Installation

pi install npm:pi-env

Or from git:

pi install https://github.com/ksjf977/pi-env

Usage

Add an "env" key to your global or project settings:

~/.pi/agent/settings.json (global) or .pi/settings.json (project):

{
  "env": {
    "AWS_ENDPOINT_URL_BEDROCK_RUNTIME": "https://my.corp.proxy/bedrock",
    "AWS_BEARER_TOKEN_BEDROCK": "$MY_CORP_TOKEN",
    "AWS_BEDROCK_FORCE_HTTP1": "1",
    "GOOGLE_CLOUD_PROJECT": "my-project",
    "GOOGLE_CLOUD_LOCATION": "us-central1"
  }
}

Environment variables are set before providers initialize, so they're available when pi makes API requests.

Variable interpolation

Reference pre-existing environment variables using pi's value resolution syntax:

| Syntax | Meaning | |--------|---------| | $ENV_VAR | Value of ENV_VAR from the shell environment | | ${ENV_VAR} | Same, braced form (useful when followed by text) | | $$ | Literal $ character | | literal | Used as-is |

{
  "env": {
    "API_URL": "https://${REGION}.api.example.com/v1",
    "AUTH_TOKEN": "$VAULT_TOKEN",
    "PRICE": "$$9.99"
  }
}

Settings hierarchy

Honors pi's settings merge behavior:

  1. Global (~/.pi/agent/settings.json) — base defaults
  2. Project (.pi/settings.json) — overrides global per-key

If both define env, the project values override global values for the same keys. Unique keys from both levels are merged.

Features

  • Scalar coercion — numbers and booleans are coerced to strings via String()
  • Stale cleanup — variables removed from settings are unset on /reload
  • /env command — print currently configured env vars in the TUI at any time
  • Styled output — shows a summary of applied variables on session start
  • Warnings — notifies in the TUI for unresolved variables, non-scalar values, or overridden existing env vars

Why not just export in .zshrc?

Shell exports apply to every process. With pi-env, you can:

  • Set AWS_ENDPOINT_URL_BEDROCK_RUNTIME for pi without affecting your AWS CLI
  • Override AWS_REGION per-project without changing your shell profile
  • Keep provider routing config versioned with the project
  • Avoid wrapper functions like pi() { VAR=x command pi "$@"; }

License

MIT