@dreamcats/opencommands
v2.0.0
Published
Simplified command loader for AI coding agents
Readme
OpenCommands Simple
一个极简的命令加载器,专为 AI 编码代理设计。
为什么重构?
原版 OpenCommands 有 3,101 行代码,过于复杂。新版本遵循 "做一件事并做好" 的原则:
- ✅ 代码量减少 86%:3,101 行 → 440 行
- ✅ 文件减少 76%:29 个 → 7 个
- ✅ 依赖减少 75%:8 个 → 2 个
- ✅ 核心功能完整保留
功能
install- 从 Git 仓库安装命令list- 列出所有可用命令search- 简单搜索命令run- 执行命令show- 显示命令内容(供 AI 使用)
安装
npm install -g @dreamcats/opencommands使用
1. 安装命令
# 从 GitHub 安装
opencommands install user/repo
# 安装到用户目录(全局)
opencommands install user/repo --global2. 列出命令
opencommands list3. 搜索命令
opencommands search build4. 执行命令
opencommands run hello-world5. 显示命令内容
opencommands show hello-world命令格式
命令使用 Markdown + YAML 格式:
---
name: hello-world
description: A simple hello world command
---
# Hello World
This command says hello.
! echo "Hello, World!"支持的语法
! command- 执行 shell 命令@filename- 引用文件内容- 普通文本 - 直接输出
目录结构
.claude/commands/
├── hello-world.md
├── build-project.md
└── deploy/
└── production.md移除了什么?
原版中过度设计的功能:
- ❌ 模糊搜索(Fuse.js)
- ❌ 复杂的配置系统
- ❌ 使用统计和热门排序
- ❌ 版本检测和交互式同步
- ❌ NPM 包支持
- ❌ 多数据源层级
- ❌ AGENTS.md 生成
- ❌ 复杂的错误处理
技术栈
- TypeScript
- Commander.js(CLI 框架)
- Chalk(颜色输出)
开发
# 安装依赖
npm install
# 编译
npm run build
# 测试
npm test
# 运行演示
node dist/demo.js许可证
Apache 2.0
