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

@elinpf/dsh-ops-tool-kubectl

v0.4.1

Published

kubectl tool consumer of the ops-access seam — resolves k8s profiles into kubeconfig paths and runs kubectl via ctx.shell; list_access surfaces registered profiles without secret fields.

Readme

@elinpf/dsh-ops-tool-kubectl

ops-access 能力缝的 kubectl 消费工具 — 把 k8s profile 解析成 kubeconfig 路径并通过 ctx.shell 执行 kubectl;另有 list_access 工具列出已注册 profile(不含任何凭据字段)。

功能

注册两个面向模型的工具:

  • kubectl — 每次调用按名字解析一个 k8s access profile,把 profile 的 --kubeconfig 路径注入后经本地 shell 执行子命令。实际执行的命令带真实路径;模型可见的结果里显示 <id@tier:field> 凭据引用,秘密不会进入日志或模型上下文。
  • list_access — 把 ctx.opsAccess.listAll() 按 kind 分组,只显示信封字段(name、displayName、description、environment)加各 tier 就绪状态(ro/rw)和能力核验标注。profile 的 fields(路径、连接参数)永不进入工具输出。help: true 返回注册表管理文档。

设计要点

  • 瘦消费者,共享机制。 本包只提供四个身份要素 — 工具名、解析 kind(k8s)、profile 参数名(cluster)、buildCommand。标准结果形状({ exitCode, stdout, stderr, command, error? })、输出 schema、render 和逐次解析的执行模板(默认 30s 超时、信号死亡归一为 exitCode -1)都在 @elinpf/dsh-ops-shell-tool,保证 kubectl/ceph/ssh 三个工具行为一致。
  • 逐次解析,绝不缓存。 ops-access 缝在 execute 内通过 ctx.get('opsAccess') 获取 — 不做静态 inject、不缓存 — 注册表改完即生效,也不会在加载器里和兄弟服务死锁。
  • 无会话状态。 工具不追加会话事件、不拥有 projection,每次调用互相独立。./invariant 子路径只带一个"无运行时 invariant"的伴生插件,用于在 invariants 服务上登记包归属。
  • 一次调用一条 kubectl 子命令。 shell 组合符(;、&&、||、反引号、$()、换行)在执行前被拒并给出教学式报错——组合符之后的内容会作为不带 kubectl 前缀和凭据的新本地命令裸奔(真实会话因此反复出现 get: command not found,2026-09-10)。单个 | 管道仍然允许(本地过滤输出)。慢集群可用 timeoutSec(1–600 秒)放宽单次超时。

配置

- id: tool-ops-kubectl
  name: '@elinpf/dsh-ops-tool-kubectl'
  config:
    timeoutMs: 30000   # kubectl 单次调用的 shell 超时(毫秒);集群慢可调大

子路径导出

  • @elinpf/dsh-ops-tool-kubectl/types — 纯类型(ListedProfile、ListAccessResult),零运行时代码。
  • @elinpf/dsh-ops-tool-kubectl/invariant — invariant 伴生插件。

测试

npm run build     # tsc → lib/
npx vitest run    # 单测用 mock context 驱动真实插件:
                  # kubectl 正常路径 + 失败回退、render 纯函数性、
                  # list_access 分组与 no-fields 保证、
                  # 导出形态、HMR 卸载(disposer 清空注册表)