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

kubectl-k

v0.1.2

Published

Fast minimal kubectl DX: stateful context/namespace, smart matching, interactive picks (CLI: k)

Readme

k

Repository: github.com/mdadul/K · npm: kubectl-k (installs the k command)

A small kubectl developer-experience layer: remembers context and namespace, resolves partial pod and deployment names, and uses fuzzy searchable pickers when something is ambiguous. It is not a replacement for kubectl.

Runtime: Bun (TypeScript, no separate build step for the CLI binary).

Requirements

  • Bun >= 1.0
  • kubectl on your PATH and a valid kubeconfig

Install

From the repo root:

bun install
bun link          # makes the `k` command available globally

From npm (still need Bun on your PATH):

npm install -g kubectl-k

Or run without linking:

bun run src/cli/index.ts -- <args>

Quick start

k use dev/backend    # context + namespace (or `k use` for an interactive context list)
k status
k pods
k pods checkout-payments   # grep-like filter (see below)
k logs api           # substring / prefix match; multiple hits → fuzzy picker
k logs               # no query → pick a pod, then stream or print logs
k exec api -- bash -lc 'pwd'
k pf api 8080:8080   # port-forward (alias: `k port-forward`)
k desc api           # describe pod (alias: `k describe`)
k restart api        # rollout restart deployment (smart match on name)
k raw get nodes      # passthrough kubectl; no injected --context / -n

State

Persistent state lives in ~/.k/state.json:

  • context — Kubernetes context name (required for cluster commands; set with k use)
  • namespace — optional; when set, k passes -n on every injected kubectl call. When omitted, kubectl uses the default namespace for that context in your kubeconfig (same as plain kubectl get pods).

Commands such as k use and k ns update this file (and align kubeconfig where appropriate). Injected calls always include --context from effective state; -n is added only when a namespace is set (file, env, or flag).

Globals and environment (per invocation)

Before the subcommand you can pass:

| Flag | Effect | |------|--------| | --context <name> | Override context for this run only | | -n / --namespace <name> | Override namespace for this run only |

Environment variables (same precedence idea, applied with flags overriding file state):

| Variable | Effect | |----------|--------| | K_CONTEXT | Default context if not set by flags or file | | K_NAMESPACE | Default namespace if not set by flags or file |

Precedence: CLI flags → env → ~/.k/state.json.

k status shows the merged “effective” values and hints when they differ from what is stored on disk.

Commands

| Command | Aliases | Summary | |---------|---------|---------| | help | -h, --help | List commands, or k help <cmd> for one command | | use | | Switch context; ctx/ns form; interactive with no arg | | ctx | | Print current context; k ctx ls lists contexts | | ns | | Print/set namespace; k ns ls lists namespaces | | status | | Context + namespace (effective vs file) | | pods | | List pods; optional filter (grep-like, see below); -w / --watch | | logs | | Pod logs; optional query; supports extra kubectl logs flags | | exec | | kubectl exec -it; default shell sh; k exec -- cmd | | restart | | kubectl rollout restart deployment/… (smart match) | | describe | desc | kubectl describe pod (smart match) | | port-forward | pf | Port-forward to a pod (smart match); ports as trailing args | | raw | | Forward arguments to kubectl unchanged | | completion | | k completion bash or k completion zsh |

Run k with no arguments for a short status blurb, or k help for the full in-terminal list.

k pods filter vs grep

Plain grep scans each line for a literal pattern (or a regex with -E). The whole pattern must match the rule you give; a typo usually matches nothing.

k pods … builds tokens by splitting your arguments on spaces and hyphens, then keeps a pod only if every token matches (AND), where a token matches if:

  1. it is a substring of the full pod name, or
  2. it is a substring of some hyphen-separated segment of the name, or
  3. some segment is within 2 character edits of the token (for tokens and segments at least 5 characters long) — so small typos in a segment still match.

Example: k pods checkout-payments is like grepping checkout and payments on the same line (tokens checkout and payments). A mistyped middle segment such as paymnts can still match a pod whose segment is payments.

If nothing matches that way, k falls back to fuzzy search on the full name, then the same segment rules again.

Smart matching

For pods (logs, exec, describe, port-forward) and deployments (restart):

  1. Case-insensitive substring match on the resource name.
  2. If several match, prefer a unique prefix match.
  3. Otherwise you get an interactive list with type-to-filter (Fuse.js) over name and status.

Omitting the query where supported opens the picker against all resources in the current namespace.

Shell completion

Bash

source <(k completion bash)

Zsh

source <(k completion zsh)

Completion currently covers the first word (subcommands and aliases). For a machine-readable list: k __complete commands.

Development

bun install
bun test
bunx tsc        # typecheck (noEmit)

License

MIT. Copyright (c) 2026 mdadul.