omp packages

pi-slash-anywhere0.1.6

Trigger slash commands, prompt templates, and skills anywhere inline in prompt messages with smart autocomplete and zero-friction expansion.

torolex Published 2 days ago MIT ~948 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

⚡ pi-slash-anywhere

在提示词的任意位置内联使用斜杠命令、提示词模板和技能。

English

GitHub Release CI Status License: MIT Pi Packages LINUX DO

本项目积极参与并认可 LINUX DO 社区。

功能特性 • 安装 • 工作原理 • 配置 • 参与贡献


在 Pi 中,斜杠命令(/help、/clear)和技能引用默认只能在行首触发。

pi-slash-anywhere 为提示词中的任意位置带来完整的内联自动补全和自动展开——无论是在句子中间引用多个技能,还是随手输入斜杠快捷方式。

Please analyze this auth module using /skill:security-audit and then review with /skill:code-review
                                       ▲                                          ▲
                                   自动补全                                     自动补全

✨ 核心特性

  • 🎯 任意位置内联触发:在任意位置输入 /,只要前面是空白字符或位于行首,即可弹出建议。
  • 🔍 统一的自动补全聚合:
    • 🛠 技能(Skills):/skill:<name>
    • ⚡ 交互式命令:/clear、/model、/help 等
    • 📝 提示词模板:动态加载项目的提示词模板。
  • 🛡 智能路径边界检测:
    • 自动避免对文件路径的误判(如 foo/bar、https://)。
    • 输入类似 /src/components/ 的目录路径时,无缝回退到原生文件补全。
  • 🚀 零摩擦的技能前置:
    • 提交时,/skill:diagnosing-bugs 这样的内联标记会被自动剥离 YAML frontmatter,并加上清晰的边界标签,前置到你的提示词上下文中。
    • 完全去重且健壮:无法解析的技能保持为纯文本,不会抛出错误,也不会阻塞执行。

📦 安装

方式一:直接从 Git 安装(推荐)

直接安装最新版本到你的全局 Pi 环境:

pi install git:github.com/toRolex/pi-slash-anywhere

随时更新到最新版本:

pi update git:github.com/toRolex/pi-slash-anywhere

方式二:从 npm / Pi Package Gallery 安装

pi install npm:pi-slash-anywhere

方式三:本地开发 / 临时会话

不持久安装,运行一次:

pi -e ./extensions/index.ts

或本地链接:

pi install .

💡 工作原理

1. 自动补全触发

只要光标前是空格加 /,补全弹出框就会出现:

输入 是否触发? 候选项
/(行首) ✅ 命令、技能、模板
check this / ✅ 命令、技能、模板
check this /skill: ✅ 严格过滤,仅显示技能
http://... 或 a/b ❌ 忽略(非空白字符边界)
/usr/local/ ❌ 转为原生文件补全

2. 提示词拦截与注入

当你提交的消息中包含内联技能标记时:

输入:

Please review this PR with /skill:code-review and /skill:diagnosing-bugs

Pi 与 Agent 实际收到:

[Included Skill: code-review]
<skill instructions and body...>

[Included Skill: diagnosing-bugs]
<skill instructions and body...>

Please review this PR with /skill:code-review and /skill:diagnosing-bugs

⚙️ 配置

你可以在 ~/.pi/agent/settings.json 或项目设置中自定义行为:

{
  "pi-slash-anywhere": {
    "enabled": true,       // 启用或禁用内联技能转换
    "fuzzy": true          // 使用模糊搜索匹配建议
  }
}

🛠 开发与测试

# 克隆仓库
git clone https://github.com/toRolex/pi-slash-anywhere.git
cd pi-slash-anywhere

# 安装依赖
npm install

# 运行单元测试和集成测试
npm test

# 类型检查
npm run typecheck

友情链接

感谢 LINUX DO 社区 朋友们的支持与反馈。


🤝 参与贡献与许可

欢迎提交贡献、issue 和功能请求!欢迎访问 issues 页面。

基于 MIT License 分发。