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

@cnife/pi-inline-skill-completion

v0.1.1

Published

Inline /skill: completion anywhere in the input box, with multi-skill collapsible rendering

Readme

@cnife/pi-inline-skill-completion

在输入框任意位置补全技能(/skill:<name>),并支持一行提交多个技能,每个技能在 TUI 中渲染为独立的可折叠块。

解决的痛点

pi 原生有两个限制:

  1. 补全位置受限:只允许行首触发 / 补全,想在输入框中间补全做不到。
  2. 补全数量受限:默认只能展开一个技能,一行里写多个 /skill: 只有行首那个生效。

本扩展解决这两个问题:

  • 输入框非行首位置输入 / 时,自动弹出已安装技能的模糊匹配候选;行首 / 仍委托原生 slash 命令补全。
  • 提交时全权展开文本中所有 /skill:xxx token,每个都渲染成原生 [skill] 折叠块。

安装

pi install npm:@cnife/pi-inline-skill-completion

使用

在输入框任意位置输入 /,选择技能后插入规范形式 /skill:<name> (带尾随空格,便于连续输入多个)。可以一行写多个:

/skill:domain-modeling /skill:grilling 帮我设计用户认证的领域模型

提交后,TUI 会渲染:

  • [skill] domain-modeling 折叠块
  • [skill] grilling 折叠块
  • 正文 帮我设计用户认证的领域模型

Tab 可切换折叠块展开/收起,与原生技能调用体验一致。

展开规则

提交含 /skill:xxx token 的文本时,扩展会拦截输入并改用自定义消息渲染(绕过 pi 只展开行首单技能、只渲染单 skill 块的限制):

  • 所有 skill block 按出现顺序前置(空行连接)
  • 行首第一个 token 连同其尾随分隔符一并删除
  • 其余 token 字面保留(维持句子通顺)
  • 其余文本原样保留

例:/skill:a foo /skill:b

<skill block a>

<skill block b>
foo /skill:b

正文里保留的 /skill:b 是符合规则的预期行为(行首第一个删除,其余字面保留),非 bug。

边界情况

| 情况 | 处理 | |------|------| | 无 /skill: token | 走原生(普通 user 消息) | | 未知技能 / 读文件失败 | 该 token 原样保留,不展开 | | 全部 token 展开失败 | 退回原生 user 消息 | | 自定义消息发送失败 | 降级为原生(原文当普通 user 消息,避免输入丢失) | | 流式中提交 | 按 streamingBehaviordeliverAs(steer/followUp)而非 triggerTurn |

技术实现

绕开 pi 的 user 消息渲染路径,改用自定义消息(CustomMessage):

  1. input 事件里解析所有 /skill:xxx token,返回 action: "handled" 阻止 pi 创建普通 user 消息。
  2. 调用 pi.sendMessagecustomType: "inline-skills" 的自定义消息:content 是完整展开文本(经 convertToLlm 转成 role: user 给 LLM),details 是结构化 blocks + 正文(给 renderer)。
  3. 注册 messageRenderer,复用 pi 原生组件渲染:每个 block → SkillInvocationMessageComponent(折叠块),正文 → UserMessageComponent

行首单技能时,LLM 收到的展开文本与原生逐字等价。