workspace-filter
v1.0.8
Published
Workspace directory filter and scanner for multi-project environments
Maintainers
Readme
Workspace Filter
智能工作区过滤器,为多 Agent 开发环境统一管理忽略规则。
🎯 功能特性
多 Agent 支持 - 自动为 40+ 个 AI 编程助手生成忽略规则
- Claude Code, Codex, OpenClaw, Cursor, Windsurf
- Cline, Continue, Roo Code, Trae, MCPJam
- 以及更多主流 AI 编程工具
统一配置 - 一次选择,同步生成所有 Agent 的忽略文件
.vscode/settings.json.cursorignore,.traeignore,.claudeignore.clineignore,.continueignore,.rooignore等
项目扫描 - 自动识别工作区中的前端和 Go 项目
预设管理 - 保存和加载工作区配置预设
交互式 UI - 提供 Web 界面进行可视化配置
🚀 使用方式
方式一:本地链接(推荐开发阶段使用)
# 1. 克隆并安装
git clone https://github.com/candy-Tong/workspace-filter.git
cd workspace-filter
pnpm install
# 2. 构建项目
pnpm run build:all
# 3. 链接到全局
pnpm link --global
# 4. 使用命令
workspace-filter switch
# 或简写
wf switch方式二:pnpx 运行(需要从 npm 发布后)
pnpx workspace-filter switchCLI 命令
# 交互式切换工作区(默认)
workspace-filter switch
# 应用预设
workspace-filter apply <preset-name>
# 列出所有预设
workspace-filter list
# 删除预设
workspace-filter delete <preset-name>
# 清除所有配置,恢复原始状态
workspace-filter clear常用参数
# 指定工作目录
workspace-filter switch --cwd /path/to/workspace
# 指定项目根目录(逗号分隔)
workspace-filter switch --roots project1,project2,project3
# 永久可见的目录
workspace-filter switch --include .vscode,.git,docs
# 跳过特定 Agent 配置
workspace-filter switch --no-cursor --no-trae
# 仅输出 JSON(不写入文件)
workspace-filter switch --format json
# 使用预设
workspace-filter switch --preset my-preset
# 非交互模式(直接应用)
workspace-filter switch --no-server --no-interactive📁 项目结构
workspace-filter/
├── src/ # 前端 React 代码
│ ├── App.tsx # 主界面组件
│ ├── main.tsx # 入口文件
│ └── index.css # 样式文件
├── server/ # 后端服务
│ ├── index.ts # CLI 入口
│ ├── server.ts # HTTP 服务器
│ └── lib/
│ ├── agents.ts # Agent 配置定义
│ ├── compute.ts # 排除逻辑计算
│ ├── scanner.ts # 项目扫描
│ ├── presets.ts # 预设管理
│ ├── config.ts # 配置管理
│ ├── ui/select.ts # 交互式选择
│ └── writers/ # 文件写入器
│ ├── vscode.ts # VSCode 设置生成
│ └── ignore/ # 各 Agent ignore 文件生成
├── tests/ # 测试文件
│ ├── compute.test.js
│ └── ignore.test.js
├── package.json
├── tsconfig.json
└── vite.config.ts🔧 支持的 Agent
完整支持列表(40+):
| Agent | 配置目录 |
| ----------- | ----------------------------- |
| Amp | .agents/skills |
| Claude Code | .claude/skills |
| Codex | .codex/skills |
| Cursor | .cursor/skills |
| Cline | .cline/skills |
| Continue | .continue/skills |
| OpenClaw | skills |
| Windsurf | .windsurf/skills |
| Trae | .trae/skills |
| Roo Code | .roo/skills |
| ... | 更多见 server/lib/agents.ts |
📝 预设示例
预设保存在工作区的 .workspace-filter/presets/ 目录下:
{
"name": "frontend-dev",
"roots": ["apps", "packages"],
"selected": ["apps/web", "packages/ui"]
}📄 License
ISC
🤝 贡献
欢迎提交 Issue 和 PR!
源码运行
从源码运行需要以下配置:
# 克隆仓库
git clone https://github.com/candy-Tong/workspace-filter.git
cd workspace-filter
# 安装依赖
pnpm install
# 运行 CLI(源码模式)
pnpm tsx server/index.ts switch
# 启动开发服务器(带 Web UI)
pnpm run dev:server
# 构建前端
pnpm run build
# 开发模式构建
pnpm run build:watch测试
pnpm testWeb UI 开发
启动开发服务器(带 Web UI):
pnpm run dev:server访问 http://127.0.0.1:3001 查看界面。
