From dcdae8c6364579e31ca088c275f8a20a6238b9a3 Mon Sep 17 00:00:00 2001 From: John Qiu Date: Sat, 14 Mar 2026 15:09:07 +1030 Subject: [PATCH] chore(marketplace): add publish-plugin, rewrite init.sh, cleanup obsolete plugins - Add publish-plugin: marketplace publish + Feishu bot notification - Rewrite init.sh: SSE-first, fixed prod API, remove env selection - Update CLAUDE.md, README.md, claude-config.yaml - Update skills: req-plugin, req-prd-plugin, pull-request-plugin - Delete sync-skills.sh (obsolete) - Delete deprecated plugins: skills-ops/*, skills-projects/*, old skills-dev/req duplicates - Regenerate marketplace.json (27 plugins) Co-Authored-By: Claude Opus 4.6 --- .claude-plugin/marketplace.json | 241 +- .gitignore | 3 + CLAUDE.md | 23 +- README.md | 56 +- claude-config.yaml | 3 +- generate-marketplace.py | 3 - init.sh | 121 +- .../publish-plugin/.claude-plugin/plugin.json | 8 + skills-core/publish-plugin/skills/SKILL.md | 169 ++ .../.claude-plugin/plugin.json | 8 - skills-dev/agent-swarm-plugin/skills/SKILL.md | 406 ---- .../dev-plugin/.claude-plugin/plugin.json | 8 - skills-dev/dev-plugin/skills/SKILL.md | 314 --- .../.claude-plugin/plugin.json | 8 - .../skills/SKILL.md | 104 - .../.claude-plugin/plugin.json | 8 - .../frontend-design-plugin/skills/SKILL.md | 695 ------ .../gitea-plugin/.claude-plugin/plugin.json | 8 - skills-dev/gitea-plugin/scripts/gitea-runs | 211 -- skills-dev/gitea-plugin/skills/SKILL.md | 281 --- .../pull-request-plugin/skills/SKILL.md | 47 + .../.claude-plugin/plugin.json | 8 - .../openclaw-ops-plugin/skills/SKILL.md | 797 ------- .../.claude-plugin/plugin.json | 8 - skills-ops/openclaw-plugin/skills/SKILL.md | 342 --- .../.claude-plugin/plugin.json | 8 - skills-ops/ops-servers-plugin/skills/SKILL.md | 262 --- .../.claude-plugin/plugin.json | 8 - skills-ops/ops-tools-plugin/ai-proj-deploy.md | 246 --- skills-ops/ops-tools-plugin/coolbuy-deploy.md | 100 - skills-ops/ops-tools-plugin/db-backup.md | 837 ------- skills-ops/ops-tools-plugin/deploy-check.sh | 41 - skills-ops/ops-tools-plugin/gitea-pr.sh | 97 - skills-ops/ops-tools-plugin/health-check.sh | 84 - skills-ops/ops-tools-plugin/incidents.md | 76 - skills-ops/ops-tools-plugin/jenkins-build.sh | 46 - skills-ops/ops-tools-plugin/mcp-config.md | 165 -- .../ops-tools-plugin/scripts/deploy-check.sh | 41 - .../ops-tools-plugin/scripts/gitea-pr.sh | 97 - .../ops-tools-plugin/scripts/health-check.sh | 84 - .../ops-tools-plugin/scripts/jenkins-build.sh | 46 - .../scripts/service-restart.sh | 44 - .../ops-tools-plugin/service-restart.sh | 44 - skills-ops/ops-tools-plugin/skills/SKILL.md | 1560 ------------- .../.claude-plugin/plugin.json | 8 - .../coolbuy-legacy-plugin/skills/SKILL.md | 414 ---- .../.claude-plugin/plugin.json | 8 - .../coolbuy-paas-plugin/skills/SKILL.md | 803 ------- .../.claude-plugin/plugin.json | 8 - .../coolbuy-platform-plugin/skills/SKILL.md | 338 --- .../.claude-plugin/plugin.json | 8 - .../enjoysa-deploy-plugin/skills/SKILL.md | 113 - .../enjoysa-plugin/.claude-plugin/plugin.json | 8 - .../enjoysa-plugin/skills/SKILL.md | 210 -- .../.claude-plugin/plugin.json | 8 - .../executing-plans-plugin/skills/SKILL.md | 96 - .../.claude-plugin/plugin.json | 8 - .../req-commands-plugin/skills/SKILL.md | 436 ---- .../.claude-plugin/plugin.json | 8 - skills-req/req-deploy-plugin/skill.json | 18 - skills-req/req-deploy-plugin/skills/SKILL.md | 1957 ----------------- skills-req/req-plugin/code-review-guide.md | 115 - skills-req/req-plugin/deploy-guide.md | 273 --- skills-req/req-plugin/hook-sync.md | 55 - skills-req/req-plugin/mcp-auth-config.md | 64 - skills-req/req-plugin/notification-config.md | 42 - skills-req/req-plugin/prd-review-guide.md | 126 -- skills-req/req-plugin/siyuan-integration.md | 50 - skills-req/req-plugin/skills/SKILL.md | 178 +- skills-req/req-plugin/test-guide.md | 177 -- skills-req/req-plugin/workflow-example.md | 120 - skills-req/req-prd-plugin/skills/SKILL.md | 113 +- .../.claude-plugin/plugin.json | 8 - skills-req/req-review-plugin/skills/SKILL.md | 113 - .../.claude-plugin/plugin.json | 8 - .../req-workflow-plugin/skills/SKILL.md | 198 -- .../.claude-plugin/plugin.json | 8 - skills-req/requirement-plugin/skills/SKILL.md | 30 - sync-skills.sh | 124 -- 79 files changed, 610 insertions(+), 13407 deletions(-) create mode 100644 skills-core/publish-plugin/.claude-plugin/plugin.json create mode 100644 skills-core/publish-plugin/skills/SKILL.md delete mode 100644 skills-dev/agent-swarm-plugin/.claude-plugin/plugin.json delete mode 100644 skills-dev/agent-swarm-plugin/skills/SKILL.md delete mode 100644 skills-dev/dev-plugin/.claude-plugin/plugin.json delete mode 100644 skills-dev/dev-plugin/skills/SKILL.md delete mode 100644 skills-dev/finishing-a-development-branch-plugin/.claude-plugin/plugin.json delete mode 100644 skills-dev/finishing-a-development-branch-plugin/skills/SKILL.md delete mode 100644 skills-dev/frontend-design-plugin/.claude-plugin/plugin.json delete mode 100644 skills-dev/frontend-design-plugin/skills/SKILL.md delete mode 100644 skills-dev/gitea-plugin/.claude-plugin/plugin.json delete mode 100755 skills-dev/gitea-plugin/scripts/gitea-runs delete mode 100644 skills-dev/gitea-plugin/skills/SKILL.md delete mode 100644 skills-ops/openclaw-ops-plugin/.claude-plugin/plugin.json delete mode 100644 skills-ops/openclaw-ops-plugin/skills/SKILL.md delete mode 100644 skills-ops/openclaw-plugin/.claude-plugin/plugin.json delete mode 100644 skills-ops/openclaw-plugin/skills/SKILL.md delete mode 100644 skills-ops/ops-servers-plugin/.claude-plugin/plugin.json delete mode 100644 skills-ops/ops-servers-plugin/skills/SKILL.md delete mode 100644 skills-ops/ops-tools-plugin/.claude-plugin/plugin.json delete mode 100644 skills-ops/ops-tools-plugin/ai-proj-deploy.md delete mode 100644 skills-ops/ops-tools-plugin/coolbuy-deploy.md delete mode 100644 skills-ops/ops-tools-plugin/db-backup.md delete mode 100755 skills-ops/ops-tools-plugin/deploy-check.sh delete mode 100755 skills-ops/ops-tools-plugin/gitea-pr.sh delete mode 100755 skills-ops/ops-tools-plugin/health-check.sh delete mode 100644 skills-ops/ops-tools-plugin/incidents.md delete mode 100755 skills-ops/ops-tools-plugin/jenkins-build.sh delete mode 100644 skills-ops/ops-tools-plugin/mcp-config.md delete mode 100755 skills-ops/ops-tools-plugin/scripts/deploy-check.sh delete mode 100755 skills-ops/ops-tools-plugin/scripts/gitea-pr.sh delete mode 100755 skills-ops/ops-tools-plugin/scripts/health-check.sh delete mode 100755 skills-ops/ops-tools-plugin/scripts/jenkins-build.sh delete mode 100755 skills-ops/ops-tools-plugin/scripts/service-restart.sh delete mode 100755 skills-ops/ops-tools-plugin/service-restart.sh delete mode 100644 skills-ops/ops-tools-plugin/skills/SKILL.md delete mode 100644 skills-projects/coolbuy-legacy-plugin/.claude-plugin/plugin.json delete mode 100644 skills-projects/coolbuy-legacy-plugin/skills/SKILL.md delete mode 100644 skills-projects/coolbuy-paas-plugin/.claude-plugin/plugin.json delete mode 100644 skills-projects/coolbuy-paas-plugin/skills/SKILL.md delete mode 100644 skills-projects/coolbuy-platform-plugin/.claude-plugin/plugin.json delete mode 100644 skills-projects/coolbuy-platform-plugin/skills/SKILL.md delete mode 100644 skills-projects/enjoysa-deploy-plugin/.claude-plugin/plugin.json delete mode 100644 skills-projects/enjoysa-deploy-plugin/skills/SKILL.md delete mode 100644 skills-projects/enjoysa-plugin/.claude-plugin/plugin.json delete mode 100644 skills-projects/enjoysa-plugin/skills/SKILL.md delete mode 100644 skills-req/executing-plans-plugin/.claude-plugin/plugin.json delete mode 100644 skills-req/executing-plans-plugin/skills/SKILL.md delete mode 100644 skills-req/req-commands-plugin/.claude-plugin/plugin.json delete mode 100644 skills-req/req-commands-plugin/skills/SKILL.md delete mode 100644 skills-req/req-deploy-plugin/.claude-plugin/plugin.json delete mode 100644 skills-req/req-deploy-plugin/skill.json delete mode 100644 skills-req/req-deploy-plugin/skills/SKILL.md delete mode 100644 skills-req/req-plugin/code-review-guide.md delete mode 100644 skills-req/req-plugin/deploy-guide.md delete mode 100644 skills-req/req-plugin/hook-sync.md delete mode 100644 skills-req/req-plugin/mcp-auth-config.md delete mode 100644 skills-req/req-plugin/notification-config.md delete mode 100644 skills-req/req-plugin/prd-review-guide.md delete mode 100644 skills-req/req-plugin/siyuan-integration.md delete mode 100644 skills-req/req-plugin/test-guide.md delete mode 100644 skills-req/req-plugin/workflow-example.md delete mode 100644 skills-req/req-review-plugin/.claude-plugin/plugin.json delete mode 100644 skills-req/req-review-plugin/skills/SKILL.md delete mode 100644 skills-req/req-workflow-plugin/.claude-plugin/plugin.json delete mode 100644 skills-req/req-workflow-plugin/skills/SKILL.md delete mode 100644 skills-req/requirement-plugin/.claude-plugin/plugin.json delete mode 100644 skills-req/requirement-plugin/skills/SKILL.md delete mode 100755 sync-skills.sh diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index 82a93f6..992e289 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -24,9 +24,9 @@ "strict": false }, { - "name": "agent-swarm-plugin", - "source": "./skills-dev/agent-swarm-plugin", - "description": "Multi-agent orchestration using OpenAI Swarm patterns. Coordinate specialized agents for complex development workflows with handoffs and context sharing.", + "name": "publish-plugin", + "source": "./skills-core/publish-plugin", + "description": "发布 ai-proj-helper 技能市场更新并通知飞书群。当用户提到发布、publish、更新技能市场时自动激活。", "version": "1.0.0", "category": "utility", "keywords": [ @@ -61,19 +61,6 @@ ], "strict": false }, - { - "name": "dev-plugin", - "source": "./skills-dev/dev-plugin", - "description": "Plugin for dev", - "version": "1.0.0", - "category": "development", - "keywords": [ - "development", - "coding", - "workflow" - ], - "strict": false - }, { "name": "dev-test-plugin", "source": "./skills-dev/dev-test-plugin", @@ -87,43 +74,6 @@ ], "strict": false }, - { - "name": "finishing-a-development-branch-plugin", - "source": "./skills-dev/finishing-a-development-branch-plugin", - "description": "Plugin for finishing-a-development-branch", - "version": "1.0.0", - "category": "utility", - "keywords": [ - "utility", - "tools" - ], - "strict": false - }, - { - "name": "frontend-design-plugin", - "source": "./skills-dev/frontend-design-plugin", - "description": "Plugin for frontend-design", - "version": "1.0.0", - "category": "development", - "keywords": [ - "development", - "coding", - "workflow" - ], - "strict": false - }, - { - "name": "gitea-plugin", - "source": "./skills-dev/gitea-plugin", - "description": "Gitea 代码托管与 CI/CD 管理。用于 Gitea Actions workflow 管理、Runner 管理、PR 操作、仓库配置。", - "version": "1.0.0", - "category": "utility", - "keywords": [ - "utility", - "tools" - ], - "strict": false - }, { "name": "pull-request-plugin", "source": "./skills-dev/pull-request-plugin", @@ -137,44 +87,6 @@ ], "strict": false }, - { - "name": "executing-plans-plugin", - "source": "./skills-req/executing-plans-plugin", - "description": "Plugin for executing-plans", - "version": "1.0.0", - "category": "utility", - "keywords": [ - "utility", - "tools" - ], - "strict": false - }, - { - "name": "req-commands-plugin", - "source": "./skills-req/req-commands-plugin", - "description": "需求命令详细参考。含撰写命令(new/draft/edit/check/split/history/compare)和流程命令(submit/review/phase/next/deploy/done)。", - "version": "2.0.0", - "category": "productivity", - "keywords": [ - "project-management", - "tasks", - "requirements" - ], - "strict": false - }, - { - "name": "req-deploy-plugin", - "source": "./skills-req/req-deploy-plugin", - "description": "Plugin for req-deploy", - "version": "1.0.0", - "category": "devops", - "keywords": [ - "devops", - "deployment", - "operations" - ], - "strict": false - }, { "name": "req-dev-plugin", "source": "./skills-req/req-dev-plugin", @@ -214,19 +126,6 @@ ], "strict": false }, - { - "name": "req-review-plugin", - "source": "./skills-req/req-review-plugin", - "description": "PRD 评审方法论。用于需求评审、PRD 文档审查、评审意见编写。当执行 /req review 或需要评审 PRD 文档时使用。", - "version": "1.0.0", - "category": "productivity", - "keywords": [ - "project-management", - "tasks", - "requirements" - ], - "strict": false - }, { "name": "req-test-gate-plugin", "source": "./skills-req/req-test-gate-plugin", @@ -240,83 +139,6 @@ ], "strict": false }, - { - "name": "req-workflow-plugin", - "source": "./skills-req/req-workflow-plugin", - "description": "需求完整工作流。用于从创建到归档的完整流程、Hook 自动同步、测试环境流程。当需要了解需求完整生命周期或同步策略时使用。", - "version": "1.0.0", - "category": "productivity", - "keywords": [ - "project-management", - "tasks", - "requirements" - ], - "strict": false - }, - { - "name": "requirement-plugin", - "source": "./skills-req/requirement-plugin", - "description": "[已废弃] 需求撰写功能已合并到 req-plugin。请使用 /req 命令。", - "version": "2.0.0", - "category": "productivity", - "keywords": [ - "project-management", - "tasks", - "requirements" - ], - "strict": false - }, - { - "name": "openclaw-ops-plugin", - "source": "./skills-ops/openclaw-ops-plugin", - "description": "Plugin for openclaw-ops", - "version": "1.0.0", - "category": "devops", - "keywords": [ - "devops", - "deployment", - "operations" - ], - "strict": false - }, - { - "name": "openclaw-plugin", - "source": "./skills-ops/openclaw-plugin", - "description": "OpenClaw (龙虾) - Remote AI compute orchestration system. Dispatches requirements to Claude Code instances on remote machines, monitors execution, and aggregates results.", - "version": "1.0.0", - "category": "utility", - "keywords": [ - "utility", - "tools" - ], - "strict": false - }, - { - "name": "ops-servers-plugin", - "source": "./skills-ops/ops-servers-plugin", - "description": "Plugin for ops-servers", - "version": "1.0.0", - "category": "devops", - "keywords": [ - "devops", - "deployment", - "operations" - ], - "strict": false - }, - { - "name": "ops-tools-plugin", - "source": "./skills-ops/ops-tools-plugin", - "description": "Plugin for ops-tools", - "version": "1.0.0", - "category": "devops", - "keywords": [ - "devops", - "deployment", - "operations" - ], - "strict": false - }, { "name": "data-excel-plugin", "source": "./skills-integration/data-excel-plugin", @@ -471,9 +293,9 @@ "strict": false }, { - "name": "coolbuy-legacy-plugin", - "source": "./skills-projects/coolbuy-legacy-plugin", - "description": "酷采2.0团购管理系统测试与维护。用于酷采2.0系统的功能测试、问题排查、需求验证和对比测试。", + "name": "gitea-plugin", + "source": "./skills-personal/gitea-plugin", + "description": "Gitea 代码托管与 CI/CD 管理。用于 Gitea Actions workflow 管理、Runner 管理、PR 操作、仓库配置。", "version": "1.0.0", "category": "utility", "keywords": [ @@ -483,10 +305,10 @@ "strict": false }, { - "name": "coolbuy-paas-plugin", - "source": "./skills-projects/coolbuy-paas-plugin", - "description": "酷采3.0 SaaS 租户端开发与测试。用于商品管理、订单管理等业务模块开发,以及酷采2.0系统对比测试。", - "version": "1.3.0", + "name": "openclaw-plugin", + "source": "./skills-personal/openclaw-plugin", + "description": "OpenClaw (龙虾) 远程 AI 计算调度系统 - 概念设计与运维管理", + "version": "1.0.0", "category": "utility", "keywords": [ "utility", @@ -495,21 +317,9 @@ "strict": false }, { - "name": "coolbuy-platform-plugin", - "source": "./skills-projects/coolbuy-platform-plugin", - "description": "Coolbuy SaaS 平台管理端开发与部署。用于平台端前后端开发、租户管理、部署发布、翻译检查等任务。", - "version": "1.0.9", - "category": "utility", - "keywords": [ - "utility", - "tools" - ], - "strict": false - }, - { - "name": "enjoysa-deploy-plugin", - "source": "./skills-projects/enjoysa-deploy-plugin", - "description": "EnjoySA 项目部署到新加坡服务器", + "name": "ops-tools-plugin", + "source": "./skills-personal/ops-tools-plugin", + "description": "Plugin for ops-tools", "version": "1.0.0", "category": "devops", "keywords": [ @@ -519,18 +329,6 @@ ], "strict": false }, - { - "name": "enjoysa-plugin", - "source": "./skills-projects/enjoysa-plugin", - "description": "Plugin for enjoysa", - "version": "1.0.0", - "category": "utility", - "keywords": [ - "utility", - "tools" - ], - "strict": false - }, { "name": "qiudl-personal-plugin", "source": "./skills-personal/qiudl-personal-plugin", @@ -542,6 +340,19 @@ "tools" ], "strict": false + }, + { + "name": "req-deploy-plugin", + "source": "./skills-personal/req-deploy-plugin", + "description": "Plugin for req-deploy", + "version": "1.0.0", + "category": "devops", + "keywords": [ + "devops", + "deployment", + "operations" + ], + "strict": false } ] } \ No newline at end of file diff --git a/.gitignore b/.gitignore index ed9b2e2..91acbae 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,9 @@ skills-personal/ # MCP generated config .mcp.json +# MCP bridge (cloned by init.sh for stdio mode) +mcp-task-bridge/ + # OS files .DS_Store Thumbs.db diff --git a/CLAUDE.md b/CLAUDE.md index 49b51b8..220f70e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -8,27 +8,24 @@ Claude Code 技能市场 + MCP 配置管理工具。 ./init.sh ``` -交互式配置 MCP 连接和生成 marketplace.json。支持命令行参数: +交互式配置 MCP 连接(默认 SSE 模式)。支持命令行参数: ```bash -./init.sh --mode stdio --env prod --token YOUR_TOKEN +./init.sh --mode sse --token aiproj_pk_xxx ``` ## 目录结构 ``` ai-proj-helper/ -├── skills-dev/ # 开发 (9): dev, dev-arch, dev-coding, dev-test, frontend-design, agent-swarm, pull-request, finishing-a-development-branch, gitea -├── skills-req/ # 需求 (10): req, req-commands, req-dev, req-prd, req-review, req-test-gate, req-workflow, req-deploy, requirement, executing-plans -├── skills-ops/ # 运维 (4): ops-tools, ops-servers, openclaw, openclaw-ops +├── skills-core/ # 基础设施 (1): ai-proj +├── skills-dev/ # 开发 (4): dev-arch, dev-coding, dev-test, pull-request +├── skills-req/ # 需求 (4): req, req-prd, req-dev, req-test-gate ├── skills-integration/ # 集成 (8): feishu, feishu-bitable, feishu-docx, wecom, siyuan, siyuan-to-feishu, data-excel, doubao-voice ├── skills-biz/ # 商务 (4): biz-contract, biz-ops, biz-plan, finance -├── skills-workflow/ # 工作流 (7): ai-proj, save-session, reload-session, read-session, search-sessions, session, skill-manager -├── skills-projects/ # 项目 (5): coolbuy-legacy, coolbuy-paas, coolbuy-platform, enjoysa, enjoysa-deploy ├── skills-personal/ # 个人(.gitignore 排除) ├── claude-config.yaml # 技能启用/禁用 + MCP 配置 -├── init.sh # MCP + marketplace 初始化 -├── sync-skills.sh # 从 ~/.claude/skills/ 同步技能 +├── init.sh # MCP 初始化 └── generate-marketplace.py ``` @@ -50,14 +47,6 @@ skills: 重新运行 `./init.sh` 或 `python3 generate-marketplace.py`。 -## MCP 环境 - -| 环境 | API 地址 | -|------|----------| -| dev | http://localhost:8080/api/v1 | -| staging | https://ai-staging.pipexerp.com/api/v1 | -| prod | https://ai.pipexerp.com/api/v1 | - ## 技能目录说明 - `skills-personal/` 不被 Git 跟踪,用于存放个人配置和工具 diff --git a/README.md b/README.md index 4cb67c9..fdaf3e8 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Claude Code 技能市场 + MCP 配置管理工具。整合通用技能、项目 git clone https://gitea.pipexerp.com/pipexerp/ai-proj-helper.git cd ai-proj-helper -# 2. 运行初始化(交互式配置 MCP + 生成 marketplace) +# 2. 运行初始化(交互式配置 MCP 连接) ./init.sh # 3. 添加技能市场 @@ -21,7 +21,7 @@ cd ai-proj-helper 也可以使用命令行参数跳过交互: ```bash -./init.sh --mode stdio --env prod --token YOUR_TOKEN +./init.sh --mode sse --token aiproj_pk_xxx ``` ## 目录结构 @@ -30,32 +30,29 @@ cd ai-proj-helper ai-proj-helper/ ├── .claude-plugin/marketplace.json # 自动生成 ├── claude-config.yaml # 技能启用/禁用 + MCP 配置 -├── init.sh # MCP + marketplace 初始化 -├── sync-skills.sh # 同步本地技能 +├── init.sh # MCP 初始化 ├── generate-marketplace.py # marketplace 生成器 -├── skills-dev/ # 开发 (9) -├── skills-req/ # 需求管理 (10) -├── skills-ops/ # 运维 (4) +├── skills-core/ # 基础设施 (1) +├── skills-dev/ # 开发 (4) +├── skills-req/ # 需求管理 (4) ├── skills-integration/ # 第三方集成 (8) ├── skills-biz/ # 商务 (4) -├── skills-workflow/ # 工作流 (7) -├── skills-projects/ # 项目特定 (5) └── skills-personal/ # 个人(.gitignore 排除) ``` -## 可用技能 (49) +## 可用技能 (26) -### skills-dev/ — 开发 (9) +### skills-core/ — 基础设施 (1) -dev, dev-arch, dev-coding, dev-test, frontend-design, agent-swarm, pull-request, finishing-a-development-branch, gitea +ai-proj -### skills-req/ — 需求管理 (10) +### skills-dev/ — 开发 (4) -req, req-commands, req-dev, req-prd, req-review, req-test-gate, req-workflow, req-deploy, requirement, executing-plans +dev-arch, dev-coding, dev-test, pull-request -### skills-ops/ — 运维 (4) +### skills-req/ — 需求管理 (4) -ops-tools, ops-servers, openclaw, openclaw-ops +req, req-prd, req-dev, req-test-gate ### skills-integration/ — 第三方集成 (8) @@ -65,13 +62,9 @@ feishu, feishu-bitable, feishu-docx, wecom, siyuan, siyuan-to-feishu, data-excel biz-contract, biz-ops, biz-plan, finance -### skills-workflow/ — 工作流 (7) +### skills-personal/ — 个人 (5) -ai-proj, save-session, reload-session, read-session, search-sessions, session, skill-manager - -### skills-projects/ — 项目特定 (5) - -coolbuy-legacy, coolbuy-paas, coolbuy-platform, enjoysa, enjoysa-deploy +gitea, openclaw, ops-tools, qiudl-personal, req-deploy ## 配置管理 @@ -81,8 +74,7 @@ coolbuy-legacy, coolbuy-paas, coolbuy-platform, enjoysa, enjoysa-deploy version: "1.0" mcp: - mode: stdio # stdio | sse - env: prod # dev | staging | prod + mode: sse # sse | stdio skills: disabled: [] # 禁用的技能列表 @@ -93,22 +85,6 @@ skills: 编辑 `claude-config.yaml` 添加要禁用的技能名称,然后重新运行 `./init.sh` 或 `python3 generate-marketplace.py`。 -## 同步本地技能 - -将 `~/.claude/skills/` 中的技能同步到仓库: - -```bash -./sync-skills.sh -``` - -## MCP 环境 - -| 环境 | API 地址 | 用途 | -|------|----------|------| -| dev | http://localhost:8080 | 本地开发 | -| staging | https://ai-staging.pipexerp.com | 测试环境 | -| prod | https://ai.pipexerp.com | 生产环境 | - ## 作者 **Donglin Lai (qiudl)** - qiudl@zhiyuncai.com diff --git a/claude-config.yaml b/claude-config.yaml index fe445d8..ef10fd7 100644 --- a/claude-config.yaml +++ b/claude-config.yaml @@ -1,8 +1,7 @@ version: "1.0" mcp: - mode: stdio # stdio | sse - env: prod # dev | staging | prod + mode: sse # sse | stdio # Token 不存储在此文件,由 init.sh 引导配置 skills: diff --git a/generate-marketplace.py b/generate-marketplace.py index 84e67e2..45bb2f0 100644 --- a/generate-marketplace.py +++ b/generate-marketplace.py @@ -19,11 +19,8 @@ SKILL_DIRS = [ ("core", "skills-core"), ("dev", "skills-dev"), ("req", "skills-req"), - ("ops", "skills-ops"), ("integration", "skills-integration"), ("biz", "skills-biz"), - ("workflow", "skills-workflow"), - ("projects", "skills-projects"), ("personal", "skills-personal"), ] diff --git a/init.sh b/init.sh index cda2eef..4481684 100755 --- a/init.sh +++ b/init.sh @@ -1,32 +1,31 @@ #!/bin/bash -# ai-proj-helper 初始化脚本 -# 配置 MCP 服务器 + 生成 marketplace.json +# ai-proj-helper MCP 初始化脚本 +# 为用户配置 ai-proj MCP 连接 set -e SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" MCP_CONFIG="$HOME/.claude/.mcp.json" -MCP_BRIDGE_DIR="$HOME/coding/qiudl/new-ai-proj/mcp-task-bridge" +MCP_BRIDGE_DIR="$SCRIPT_DIR/mcp-task-bridge" CONFIG_FILE="$SCRIPT_DIR/claude-config.yaml" +API_BASE="https://ai.pipexerp.com/api/v1" +SSE_URL="${API_BASE}/mcp/sse" # Default values MODE="" -ENV="" TOKEN="" # ── Parse command line arguments ────────────────────────────────────── while [[ $# -gt 0 ]]; do case $1 in --mode) MODE="$2"; shift 2 ;; - --env) ENV="$2"; shift 2 ;; --token) TOKEN="$2"; shift 2 ;; -h|--help) - echo "Usage: ./init.sh [--mode stdio|sse] [--env dev|staging|prod] [--token PAT_TOKEN]" + echo "Usage: ./init.sh [--mode sse|stdio] [--token MCP_API_KEY]" echo "" echo "Options:" - echo " --mode MCP connection mode: stdio (local) or sse (remote)" - echo " --env Environment: dev, staging, or prod" - echo " --token Personal Access Token for ai-proj API" + echo " --mode MCP connection mode: sse (remote, recommended) or stdio (local)" + echo " --token MCP API Key (aiproj_pk_xxx)" echo "" echo "Without arguments, runs in interactive mode." exit 0 @@ -50,75 +49,71 @@ read_config_value() { echo "$default" } -CONFIG_MODE=$(read_config_value "mode" "stdio") -CONFIG_ENV=$(read_config_value "env" "prod") +CONFIG_MODE=$(read_config_value "mode" "sse") # ── Interactive mode selection ──────────────────────────────────────── if [ -z "$MODE" ]; then echo "┌─────────────────────────────────────┐" - echo "│ ai-proj-helper 初始化 │" + echo "│ ai-proj MCP 初始化 │" echo "└─────────────────────────────────────┘" echo "" echo "MCP 连接模式:" - echo " 1) stdio - 本地进程 (需要 mcp-task-bridge)" - echo " 2) sse - 远程 SSE 连接" + echo " 1) sse - 远程 SSE 连接 (推荐,零依赖)" + echo " 2) stdio - 本地进程 (需要 Node.js + mcp-task-bridge)" echo "" - read -p "选择模式 [1/2] (default: $([ "$CONFIG_MODE" = "sse" ] && echo "2" || echo "1")): " mode_choice + read -p "选择模式 [1/2] (default: $([ "$CONFIG_MODE" = "stdio" ] && echo "2" || echo "1")): " mode_choice case "$mode_choice" in - 2|sse) MODE="sse" ;; - *) MODE="stdio" ;; + 2|stdio) MODE="stdio" ;; + *) MODE="sse" ;; esac fi -# ── Interactive environment selection ───────────────────────────────── -if [ -z "$ENV" ]; then - echo "" - echo "环境:" - echo " 1) dev - http://localhost:8080" - echo " 2) staging - https://ai-staging.pipexerp.com" - echo " 3) prod - https://ai.pipexerp.com" - echo "" - default_num=3 - [ "$CONFIG_ENV" = "dev" ] && default_num=1 - [ "$CONFIG_ENV" = "staging" ] && default_num=2 - read -p "选择环境 [1/2/3] (default: $default_num): " env_choice - case "$env_choice" in - 1|dev) ENV="dev" ;; - 2|staging) ENV="staging" ;; - *) ENV="prod" ;; - esac -fi - -# ── Resolve API base URL ───────────────────────────────────────────── -case "$ENV" in - dev) API_BASE="http://localhost:8080/api/v1" ;; - staging) API_BASE="https://ai-staging.pipexerp.com/api/v1" ;; - prod) API_BASE="https://ai.pipexerp.com/api/v1" ;; -esac - # ── Token input ─────────────────────────────────────────────────────── if [ -z "$TOKEN" ]; then echo "" - echo "请输入 AI-Proj Personal Access Token (PAT):" - echo " 获取方式: 登录 AI-Proj → 设置 → API Tokens → 创建" + echo "请输入 MCP API Key:" + echo " 格式: aiproj_pk_xxxxxxxx" + echo " 获取: 登录 AI-Proj → 设置 → MCP API Keys → 创建" echo "" - read -sp "Token: " TOKEN + read -sp "API Key: " TOKEN echo "" fi if [ -z "$TOKEN" ]; then - echo "❌ Token 不能为空" + echo "❌ API Key 不能为空" exit 1 fi echo "" echo "配置信息:" echo " 模式: $MODE" -echo " 环境: $ENV ($API_BASE)" +if [ "$MODE" = "sse" ]; then + echo " SSE: $SSE_URL" +else + echo " API: $API_BASE" +fi echo "" +# ── SSE mode ───────────────────────────────────────────────────────── +if [ "$MODE" = "sse" ]; then + mkdir -p "$(dirname "$MCP_CONFIG")" + cat > "$MCP_CONFIG" << EOF +{ + "mcpServers": { + "ai-proj": { + "type": "sse", + "url": "$SSE_URL", + "headers": { + "X-API-Key": "$TOKEN" + } + } + } +} +EOF + echo "✅ 已生成 $MCP_CONFIG (SSE 模式)" + # ── stdio mode: ensure mcp-task-bridge ──────────────────────────────── -if [ "$MODE" = "stdio" ]; then +elif [ "$MODE" = "stdio" ]; then if [ ! -d "$MCP_BRIDGE_DIR" ]; then echo "📦 mcp-task-bridge 未找到,正在克隆..." git clone https://gitea.pipexerp.com/pipexerp/mcp-task-bridge.git "$MCP_BRIDGE_DIR" @@ -134,7 +129,6 @@ if [ "$MODE" = "stdio" ]; then BRIDGE_ENTRY="$MCP_BRIDGE_DIR/dist/index.js" - # Generate .mcp.json for stdio mode mkdir -p "$(dirname "$MCP_CONFIG")" cat > "$MCP_CONFIG" << EOF { @@ -153,37 +147,12 @@ if [ "$MODE" = "stdio" ]; then } EOF echo "✅ 已生成 $MCP_CONFIG (stdio 模式)" - -elif [ "$MODE" = "sse" ]; then - # Generate .mcp.json for SSE mode - SSE_URL="${API_BASE%/api/v1}/mcp/sse" - mkdir -p "$(dirname "$MCP_CONFIG")" - cat > "$MCP_CONFIG" << EOF -{ - "mcpServers": { - "ai-proj": { - "type": "sse", - "url": "$SSE_URL", - "headers": { - "Authorization": "Bearer $TOKEN" - } - } - } -} -EOF - echo "✅ 已生成 $MCP_CONFIG (SSE 模式)" fi -# ── Generate marketplace.json ───────────────────────────────────────── -echo "" -echo "🔄 生成 marketplace.json..." -cd "$SCRIPT_DIR" -python3 generate-marketplace.py - echo "" echo "┌─────────────────────────────────────┐" echo "│ ✅ 初始化完成! │" echo "└─────────────────────────────────────┘" echo "" echo "下次启动 Claude Code 即可使用 MCP 工具。" -echo "如需更新技能配置,编辑 claude-config.yaml 后重新运行 ./init.sh" +echo "如需更改模式,编辑 claude-config.yaml 后重新运行 ./init.sh" diff --git a/skills-core/publish-plugin/.claude-plugin/plugin.json b/skills-core/publish-plugin/.claude-plugin/plugin.json new file mode 100644 index 0000000..add959d --- /dev/null +++ b/skills-core/publish-plugin/.claude-plugin/plugin.json @@ -0,0 +1,8 @@ +{ + "name": "publish-plugin", + "description": "发布 ai-proj-helper 技能市场更新并通知飞书群。当用户提到发布、publish、更新技能市场时自动激活。", + "version": "1.0.0", + "author": { + "name": "qiudl" + } +} diff --git a/skills-core/publish-plugin/skills/SKILL.md b/skills-core/publish-plugin/skills/SKILL.md new file mode 100644 index 0000000..1f15ce6 --- /dev/null +++ b/skills-core/publish-plugin/skills/SKILL.md @@ -0,0 +1,169 @@ +--- +name: publish +description: 发布 ai-proj-helper 技能市场更新并通知飞书群。用户说 /publish 时激活。 +user_invocable: true +--- + +# publish - 技能市场发布与通知 + +发布 ai-proj-helper 的技能变更,重新生成 marketplace.json,提交推送到 Gitea,并通过飞书 Webhook 通知团队。 + +## 命令 + +**`/publish [消息]`** — 发布当前变更并通知飞书 + +## 流程 + +``` +1. 检查工作目录状态 (git status) +2. 运行 generate-marketplace.py 重新生成 marketplace.json +3. 生成变更摘要(新增/更新/删除了哪些技能) +4. git add + commit + push +5. 发送飞书卡片通知 +``` + +## 详细步骤 + +### Step 1: 检查工作目录 + +```bash +cd +git status +``` + +确认当前在正确的仓库中。如果没有任何变更(包括 marketplace.json),提示用户无需发布。 + +### Step 2: 重新生成 marketplace.json + +```bash +cd +python3 generate-marketplace.py +``` + +输出会显示扫描到的各分类技能数量。 + +### Step 3: 生成变更摘要 + +对比 `git diff` 结果,提取变更内容: + +- **新增技能**:新出现的 `*-plugin/` 目录 +- **更新技能**:已有技能的 SKILL.md 或 plugin.json 变更 +- **删除技能**:被移除的 `*-plugin/` 目录 +- **配置变更**:claude-config.yaml、init.sh 等基础文件变更 + +摘要格式: +``` +新增: feishu-bitable-plugin, doubao-voice-plugin +更新: req-plugin (SKILL.md) +删除: old-plugin +配置: init.sh 默认改为 SSE 模式 +``` + +### Step 4: Git 提交并推送 + +```bash +cd +git add -A +git commit -m "chore(marketplace): <变更摘要>" +git push origin main +``` + +Commit message 示例: +- `chore(marketplace): add feishu-bitable-plugin, update req-plugin` +- `chore(marketplace): update init.sh to SSE default` + +### Step 5: 飞书通知 + +**Webhook 地址**:从环境变量 `FEISHU_DEPLOY_WEBHOOK` 读取,配置在 `~/.config/devops/credentials.env`。 + +如果环境变量未设置,AskUserQuestion 询问用户提供 webhook URL,并建议添加到 credentials.env。 + +**卡片格式**(必须用 legacy format,不用 schema 2.0): + +```bash +# 先 source 凭据 +source ~/.config/devops/credentials.env + +# 构建卡片 JSON(必须写文件,不能直接传中文 JSON) +cat > /tmp/publish_notify.json << 'CARD_EOF' +{ + "msg_type": "interactive", + "card": { + "header": { + "title": {"tag": "plain_text", "content": "AI 技能市场更新"}, + "template": "green" + }, + "elements": [ + { + "tag": "div", + "text": {"tag": "lark_md", "content": "CHANGE_SUMMARY_HERE"} + }, + { + "tag": "div", + "text": {"tag": "lark_md", "content": "**提交**: COMMIT_HASH_HERE"} + }, + { + "tag": "action", + "actions": [{ + "tag": "button", + "text": {"tag": "plain_text", "content": "查看仓库"}, + "type": "primary", + "url": "https://gitea.pipexerp.com/pipexerp/ai-proj-helper" + }] + } + ] + } +} +CARD_EOF + +# 替换占位符后发送 +curl -s -X POST "$FEISHU_DEPLOY_WEBHOOK" \ + -H "Content-Type: application/json" \ + -d @/tmp/publish_notify.json +``` + +**重要**: +- 必须用 legacy card format(无 schema 字段),否则返回 ErrCode 11246 +- 中文内容必须先写文件再 `curl -d @file`,直接传会出现 "blank argument" 错误 +- `template` 颜色:`green`=成功,`red`=失败,`blue`=信息 + +### 自定义消息 + +用户可以在 `/publish` 后附加自定义消息,会追加到卡片内容中: + +``` +/publish 新增飞书多维表格技能,支持批量数据导入 +``` + +卡片内容将包含: +``` +**更新说明**: 新增飞书多维表格技能,支持批量数据导入 + +**变更**: 新增 feishu-bitable-plugin +**提交**: abc1234 +``` + +## 环境配置 + +在 `~/.config/devops/credentials.env` 中添加: + +```bash +# 飞书部署通知 Webhook +FEISHU_DEPLOY_WEBHOOK="https://open.feishu.cn/open-apis/bot/v2/hook/YOUR_WEBHOOK_KEY" +``` + +## 错误处理 + +| 场景 | 处理 | +|------|------| +| 无变更可提交 | 提示用户,跳过后续步骤 | +| generate-marketplace.py 失败 | 显示错误,中止发布 | +| git push 失败 | 显示错误,建议手动解决冲突 | +| FEISHU_DEPLOY_WEBHOOK 未配置 | AskUserQuestion 询问 webhook URL | +| 飞书通知发送失败 | 显示 curl 返回值,提示但不阻断(代码已推送成功) | + +## 注意事项 + +- 此技能操作的仓库路径由 marketplace 插件根目录决定 +- 发布前确认 `generate-marketplace.py` 输出无异常 +- 飞书通知是 best-effort,失败不影响代码发布 diff --git a/skills-dev/agent-swarm-plugin/.claude-plugin/plugin.json b/skills-dev/agent-swarm-plugin/.claude-plugin/plugin.json deleted file mode 100644 index 9eff51f..0000000 --- a/skills-dev/agent-swarm-plugin/.claude-plugin/plugin.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "agent-swarm-plugin", - "description": "Multi-agent orchestration using OpenAI Swarm patterns. Coordinate specialized agents for complex development workflows with handoffs and context sharing.", - "version": "1.0.0", - "author": { - "name": "qiudl" - } -} diff --git a/skills-dev/agent-swarm-plugin/skills/SKILL.md b/skills-dev/agent-swarm-plugin/skills/SKILL.md deleted file mode 100644 index 52c8f61..0000000 --- a/skills-dev/agent-swarm-plugin/skills/SKILL.md +++ /dev/null @@ -1,406 +0,0 @@ ---- -name: agent-swarm -description: Multi-agent orchestration using OpenAI Swarm patterns. Coordinate specialized agents for complex development workflows with handoffs and context sharing. ---- - -# Agent Swarm - Multi-Agent Orchestration - -基于 OpenAI Swarm 设计模式的多智能体协作系统,用于复杂开发任务的智能分解与协调。 - -## 核心概念 - -### 1. Agent(智能体) -每个 Agent 是具有特定职责的专家: -- **Instructions**: Agent 的角色定义和行为准则 -- **Functions**: Agent 可以调用的工具函数 -- **Handoffs**: 何时移交给其他 Agent - -### 2. Handoff(任务移交) -Agent 之间的控制权转移机制: -- 当前 Agent 完成自己的职责 -- 识别需要其他专长 -- 移交给最合适的 Agent - -### 3. Context Variables(上下文变量) -跨 Agent 共享的状态: -- 项目目录 -- 技术栈信息 -- 当前进度 -- 发现的问题 - ---- - -## 预定义 Agent - -### 1. Architect Agent(架构师) -**职责**: 理解需求、技术选型、设计系统架构 - -**何时使用**: -- 用户描述新功能或系统 -- 需要技术方案设计 -- 需要架构评审 - -**工具**: -- Read codebase -- Grep patterns -- 设计文档生成 - -**Handoff to**: -- Coder Agent(开始编码) -- Reviewer Agent(评审设计) - ---- - -### 2. Coder Agent(编码者) -**职责**: 实现功能、编写代码、修复 bug - -**何时使用**: -- 架构师完成设计 -- 用户提出 bug 修复 -- 需要代码重构 - -**工具**: -- Edit files -- Write files -- Git operations - -**Handoff to**: -- Tester Agent(代码完成后) -- Architect Agent(遇到设计问题) - ---- - -### 3. Tester Agent(测试员) -**职责**: 编写测试、运行测试、验证功能 - -**何时使用**: -- 代码编写完成 -- 需要测试覆盖 -- 验证 bug 修复 - -**工具**: -- Run tests -- Write test cases -- Coverage reports - -**Handoff to**: -- Deployer Agent(测试通过) -- Coder Agent(发现问题) - ---- - -### 4. Deployer Agent(部署员) -**职责**: 构建镜像、部署服务、监控上线 - -**何时使用**: -- 测试全部通过 -- 需要发布到环境 -- 需要回滚版本 - -**工具**: -- Docker build -- SSH deployment -- Health checks - -**Handoff to**: -- Monitor Agent(部署完成) -- Coder Agent(部署失败) - ---- - -### 5. Reviewer Agent(评审员) -**职责**: 代码审查、文档审查、安全检查 - -**何时使用**: -- PR 创建后 -- 重要功能完成 -- 需要质量把关 - -**工具**: -- Diff analysis -- Security scan -- Best practices check - -**Handoff to**: -- Coder Agent(需要修改) -- Deployer Agent(审查通过) - ---- - -## 使用方法 - -### 基本调用 - -```bash -/swarm start "在 new-ai-proj 中实现任务批量删除功能" -``` - -**执行流程**: -1. **Architect** 分析需求 → 设计 API 和前端交互 -2. **Coder** 实现后端 API → 实现前端 UI -3. **Tester** 编写单元测试 → 运行测试 -4. **Reviewer** 代码审查 → 安全检查 -5. **Deployer** 部署到 staging → 验证功能 - ---- - -### 指定起始 Agent - -```bash -/swarm coder "修复 backend/handlers/task_handler.go 的空指针 bug" -``` - -直接从 Coder Agent 开始,跳过架构设计阶段。 - ---- - -### 传递上下文 - -```bash -/swarm start "优化数据库查询性能" \ - --context project=/Users/coolbuy-dev/coding/new-ai-proj \ - --context stack=Go,PostgreSQL,Redis \ - --context module=backend/services -``` - ---- - -### 查看执行轨迹 - -```bash -/swarm trace -``` - -显示 Agent 调用链: -``` -Architect → analyzed requirements (3 min) - ↓ handoff: "Design complete, ready for implementation" -Coder → implemented 5 files (12 min) - ↓ handoff: "Code complete, needs testing" -Tester → wrote 8 test cases, all passed (5 min) - ↓ handoff: "Tests passed, ready for review" -Reviewer → approved with 2 suggestions (2 min) - ↓ handoff: "Approved, ready for deployment" -Deployer → deployed to staging, health check OK (3 min) -``` - ---- - -## 配置文件 - -### swarm.yaml - -在项目根目录创建 `swarm.yaml` 自定义 Agent 行为: - -```yaml -agents: - architect: - instructions: | - 你是系统架构师,专注于 Go + Vue.js 技术栈。 - 遵循 RESTful API 设计原则。 - 考虑性能、安全性、可维护性。 - max_turns: 5 - - coder: - instructions: | - 你是 Go 后端工程师和 Vue.js 前端工程师。 - 编写清晰、简洁、高性能的代码。 - 遵循项目现有代码风格。 - tools: - - Edit - - Write - - Bash - max_turns: 10 - - tester: - instructions: | - 你是测试工程师,编写全面的测试用例。 - 确保边界条件、错误处理、并发安全。 - tools: - - Bash - - Write - test_command: "go test ./... -v" - max_turns: 5 - -context_variables: - project_root: /Users/coolbuy-dev/coding/new-ai-proj - backend_lang: Go 1.21 - frontend_framework: Vue 3 - database: PostgreSQL 15 - deployment_target: staging.ai.pipexerp.com -``` - ---- - -## 高级功能 - -### 1. 自定义 Agent - -```yaml -agents: - database-optimizer: - instructions: | - 你是数据库性能优化专家。 - 分析慢查询、优化索引、设计缓存策略。 - functions: - - explain_analyze - - create_index - - cache_design - handoff_to: - - coder # 实现优化方案 -``` - ---- - -### 2. 条件 Handoff - -```yaml -handoff_rules: - - from: tester - to: coder - condition: "test_pass_rate < 90%" - message: "测试失败率超过 10%,需要修复" - - - from: tester - to: deployer - condition: "test_pass_rate == 100%" - message: "所有测试通过,可以部署" -``` - ---- - -### 3. 并行 Agent - -对于独立任务,多个 Agent 可以并行工作: - -```bash -/swarm parallel \ - "coder: 实现后端 API" \ - "coder: 实现前端 UI" \ - "tester: 编写 API 测试" -``` - ---- - -## 与 Remote Coding 集成 - -在 OpenClaw 中调用本地 Claude Code 执行 Swarm 工作流: - -```bash -# OpenClaw 调用 Melbourne Claude Code -ssh melbourne "cd /Users/coolbuy-dev/coding/new-ai-proj && \ - /opt/homebrew/bin/claude --dangerously-skip-permissions \ - -p '/swarm start 实现任务批量删除功能'" -``` - ---- - -## 实际案例 - -### 案例 1: 新功能开发 - -**任务**: "为 AI-Proj 实现需求批量导出功能" - -**执行过程**: -1. **Architect**: - - 分析需求:导出格式(Excel/PDF)、筛选条件、数据脱敏 - - 设计 API: `POST /api/v1/requirements/export` - - 设计前端:导出按钮、进度条、下载链接 - -2. **Coder**: - - 后端实现 export service - - 前端实现导出 UI 组件 - - 集成 file download 功能 - -3. **Tester**: - - 测试大量数据导出(1000+ 需求) - - 测试并发导出 - - 测试下载失败重试 - -4. **Reviewer**: - - 检查文件大小限制 - - 检查内存泄漏风险 - - 检查数据权限控制 - -5. **Deployer**: - - 部署到 staging - - 验证导出功能 - - 监控资源使用 - ---- - -### 案例 2: Bug 修复 - -**任务**: "修复任务详情页加载缓慢问题" - -**执行过程**: -1. **Architect**: - - 分析性能瓶颈:N+1 查询问题 - - 设计优化方案:使用 JOIN 和预加载 - -2. **Coder**: - - 优化数据库查询 - - 添加 Redis 缓存 - - 更新前端数据获取逻辑 - -3. **Tester**: - - 性能测试:加载时间从 3s → 300ms - - 并发测试:100 用户同时访问 - - 缓存一致性测试 - -4. **Deployer**: - - 灰度发布到 10% 用户 - - 监控性能指标 - - 全量发布 - ---- - -## 最佳实践 - -1. **明确任务范围**: 复杂任务交给 Swarm,简单任务直接执行 -2. **合理设置 max_turns**: 避免 Agent 陷入死循环 -3. **记录 Handoff 原因**: 便于追溯和调试 -4. **定期审查轨迹**: 优化 Agent 协作流程 -5. **利用 Context Variables**: 避免重复传递信息 - ---- - -## 故障排查 - -| 问题 | 原因 | 解决方案 | -|------|------|----------| -| Agent 一直循环 | max_turns 设置过大 | 降低 max_turns,添加明确的 handoff 条件 | -| Handoff 失败 | 目标 Agent 未定义 | 检查 swarm.yaml 配置 | -| 上下文丢失 | Context Variables 未传递 | 在 handoff 时显式传递 context | -| 执行太慢 | 串行执行可并行任务 | 使用 `/swarm parallel` | - ---- - -## 与其他 Skills 集成 - -- **dev-coding**: Coder Agent 使用 dev-coding 的编码规范 -- **dev-test**: Tester Agent 使用 dev-test 的测试策略 -- **ops-tools**: Deployer Agent 使用 ops-tools 进行部署 -- **ai-proj**: 所有 Agent 使用 ai-proj MCP 进行任务同步 - ---- - -## 命令速查 - -| 命令 | 功能 | -|------|------| -| `/swarm start ` | 启动 Swarm 工作流(从 Architect 开始) | -| `/swarm ` | 从指定 Agent 开始 | -| `/swarm parallel ` | 并行执行多个任务 | -| `/swarm trace` | 查看执行轨迹 | -| `/swarm config` | 显示当前配置 | -| `/swarm agents` | 列出所有可用 Agent | -| `/swarm stop` | 终止当前 Swarm 执行 | - ---- - -## 参考资料 - -- [OpenAI Swarm 文档](https://github.com/openai/swarm) -- [Multi-Agent Systems 设计模式](https://arxiv.org/abs/2308.00352) -- [Claude Code Skills 文档](https://docs.anthropic.com/claude-code/skills) diff --git a/skills-dev/dev-plugin/.claude-plugin/plugin.json b/skills-dev/dev-plugin/.claude-plugin/plugin.json deleted file mode 100644 index 15b3183..0000000 --- a/skills-dev/dev-plugin/.claude-plugin/plugin.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "dev-plugin", - "description": "Plugin for dev", - "version": "1.0.0", - "author": { - "name": "qiudl" - } -} diff --git a/skills-dev/dev-plugin/skills/SKILL.md b/skills-dev/dev-plugin/skills/SKILL.md deleted file mode 100644 index 9552b15..0000000 --- a/skills-dev/dev-plugin/skills/SKILL.md +++ /dev/null @@ -1,314 +0,0 @@ ---- -name: dev -description: 软件开发技能组入口。整合架构设计(dev-arch)、编码实现(dev-coding)、测试(dev-test)三个子技能,提供完整的软件开发工作流。支持全栈开发:Go、Vue、React、iOS、Android、小程序等。 ---- - -# 软件开发 Skill (dev) - -## 概述 - -dev 是一个技能组入口,整合了软件开发的三个核心阶段: - -| 子技能 | 用途 | 触发词 | -|--------|------|--------| -| **dev-arch** | 架构设计、技术选型、系统设计 | 架构、设计、技术方案 | -| **dev-coding** | 编码实现、功能开发、代码审查 | 编码、开发、实现 | -| **dev-test** | 单元测试、集成测试、E2E测试 | 测试、test、覆盖率 | - ---- - -## 开发工作流 - -``` -需求分析 → 架构设计 → 编码实现 → 测试验证 → 部署上线 - ↓ ↓ ↓ - dev-arch dev-coding dev-test -``` - -### 典型流程 - -1. **架构设计** (dev-arch) - - 需求分析 - - 技术选型 - - 系统设计文档 - - 架构评审 - -2. **编码实现** (dev-coding) - - 任务分解 - - 功能开发 - - 代码审查 - - 文档记录 - -3. **测试验证** (dev-test) - - 单元测试 - - 集成测试 - - E2E 测试 - - 覆盖率分析 - ---- - -## 支持的项目类型 - -### 当前项目生态 - -| 项目 | 类型 | 技术栈 | -|------|------|--------| -| **TWMS** | 仓储物流 | Go + Vue 3 + MySQL | -| **AI-Proj** | 项目管理 | Go + React + PostgreSQL + iOS + Android | -| **DICIAI** | 进销存SaaS | Go + Vue 3 + MySQL + Android PDA | - -### 技术栈矩阵 - -| 端 | 语言/框架 | 工具 | -|-----|----------|------| -| **后端** | Go (Gin + GORM) | MySQL/PostgreSQL, Redis, Docker | -| **Web前端** | Vue 3 / React 18 | TypeScript, Vite/CRA, Ant Design | -| **iOS** | Swift + SwiftUI | Xcode, XCTest | -| **Android** | Kotlin + Compose | Gradle, Hilt, Room | -| **PDA** | Android 原生 | 扫码枪集成, 离线存储 | -| **MCP** | TypeScript | Node.js, MCP SDK | - ---- - -## ai-proj 任务管理集成 - -所有开发工作都通过 ai-proj CLI 进行任务管理: - -### 快速开始 - -```bash -# 1. 查看待办任务 -ai-proj task list --status in_progress,todo - -# 2. 启动任务 -ai-proj task start --id - -# 3. 完成任务 -ai-proj task complete --id - -# 4. 记录文档 -ai-proj task append-doc --id --content "实现说明" -``` - -### 任务分解 - -```bash -# 创建主任务 -ai-proj task create --title "功能名称" - -# 创建子任务 -ai-proj task create --title "架构设计" --parent-id -ai-proj task create --title "功能开发" --parent-id -ai-proj task create --title "测试验证" --parent-id -``` - ---- - -## 常用命令速查 - -### Go 后端 - -```bash -# 构建 -make build - -# 运行 -./_output/main --config ./configs/config.yaml - -# 测试 -make test -make cover -``` - -### Vue 前端 - -```bash -# 开发 -npm run dev - -# 构建 -npm run build:prod - -# 检查 -npm run lint:eslint -``` - -### React 前端 - -```bash -# 开发 -npm start - -# 构建 -npm run build - -# 测试 -npm test -npm run test:e2e -``` - -### iOS - -```bash -# 构建 -xcodebuild -scheme ProjectName -configuration Debug - -# 测试 -xcodebuild test -scheme ProjectName -``` - -### Android - -```bash -# 构建 -./gradlew assembleDebug -./gradlew assembleRelease - -# 测试 -./gradlew test -./gradlew connectedAndroidTest -``` - ---- - -## Git 工作流 - -### 提交规范 - -| 类型 | 说明 | -|------|------| -| feat | 新功能 | -| fix | Bug 修复 | -| docs | 文档 | -| refactor | 重构 | -| test | 测试 | -| chore | 杂项 | - -### 分支策略 - -```bash -# 功能开发 -git checkout -b feature/功能名称 - -# 提交 -git commit -m "feat: 功能描述" - -# 推送 -git push origin feature/功能名称 - -# 合并 -git checkout main -git merge feature/功能名称 -``` - -### 双电脑同步 (au-dev / cn-dev) - -```bash -# 离开时 -git add -A -git commit -m "WIP: sync from $(hostname)" -git push origin $(git branch --show-current) - -# 到达时 -git fetch origin -git pull origin $(git branch --show-current) -``` - ---- - -## Docker 部署 - -### 标准配置 - -```yaml -services: - backend: - build: ./backend - ports: - - "8080:8080" - depends_on: - - db - - redis - - frontend: - build: ./frontend - ports: - - "80:80" - - db: - image: mysql:8.0 - # 或 postgres:15 - - redis: - image: redis:alpine -``` - -### 常用端口 - -| 服务 | 端口 | -|------|------| -| Backend | 8080 / 9099 | -| Frontend | 80 / 3000 | -| MySQL | 3306 | -| PostgreSQL | 5432 | -| Redis | 6379 | - ---- - -## 子技能详情 - -### dev-arch (架构设计) - -用于系统设计阶段: -- 需求分析 -- 技术选型 -- 架构设计文档 -- API 设计 -- 数据库设计 -- 架构评审 - -### dev-coding (编码实现) - -用于开发实现阶段: -- Go 后端开发 -- Vue/React 前端开发 -- iOS/Android 移动开发 -- PDA 应用开发 -- MCP 桥接开发 -- 代码审查 - -### dev-test (测试) - -用于测试验证阶段: -- 单元测试 -- 集成测试 -- E2E 测试 -- UI 测试 -- 覆盖率分析 - ---- - -## 最佳实践 - -1. **任务驱动** - 使用 ai-proj 管理所有开发任务 -2. **设计先行** - 复杂功能先设计后编码 -3. **分层清晰** - Controller → Service → Repository -4. **小步提交** - 频繁提交,每次做一件事 -5. **测试覆盖** - 核心逻辑必须有测试 -6. **文档同步** - 代码变更同步更新文档 -7. **代码审查** - 重要变更必须审查 - ---- - -## 何时使用哪个子技能 - -| 场景 | 推荐技能 | -|------|----------| -| 新功能设计 | dev-arch | -| 技术方案评审 | dev-arch | -| 功能开发实现 | dev-coding | -| Bug 修复 | dev-coding | -| 编写测试 | dev-test | -| 测试覆盖率提升 | dev-test | -| 代码审查 | dev-coding | -| 性能优化 | dev-arch + dev-coding | diff --git a/skills-dev/finishing-a-development-branch-plugin/.claude-plugin/plugin.json b/skills-dev/finishing-a-development-branch-plugin/.claude-plugin/plugin.json deleted file mode 100644 index 1713e0d..0000000 --- a/skills-dev/finishing-a-development-branch-plugin/.claude-plugin/plugin.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "finishing-a-development-branch-plugin", - "description": "Plugin for finishing-a-development-branch", - "version": "1.0.0", - "author": { - "name": "qiudl" - } -} diff --git a/skills-dev/finishing-a-development-branch-plugin/skills/SKILL.md b/skills-dev/finishing-a-development-branch-plugin/skills/SKILL.md deleted file mode 100644 index b07c4ee..0000000 --- a/skills-dev/finishing-a-development-branch-plugin/skills/SKILL.md +++ /dev/null @@ -1,104 +0,0 @@ ---- -name: finishing-a-development-branch -description: Use when implementation is complete and all tests pass - verifies and creates PR ---- - -# Finishing a Development Branch - -## Overview - -Verify tests pass, then push and create PR. - -**Core principle:** Verify tests → Create PR → Done. - -**Announce at start:** "I'm using the finishing-a-development-branch skill to complete this work." - -## The Process - -### Step 1: Verify Tests - -**Before creating PR, verify tests pass:** - -```bash -# Run project's test suite -npm test / cargo test / pytest / go test ./... / mvn test -``` - -**If tests fail:** -``` -Tests failing ( failures). Must fix before completing: - -[Show failures] - -Cannot proceed with PR until tests pass. -``` - -Stop. Fix tests first. - -**If tests pass:** Continue to Step 2. - -### Step 2: Push and Create PR - -Use the `/pr create` command which will: -1. **Check for existing PR first** - avoids duplicates -2. If PR exists: Report existing PR URL and skip -3. If no PR: Analyze commits, generate title/description, push, create PR - -```bash -/pr create -``` - -**Duplicate prevention:** The `/pr create` command checks for existing open PRs on the current branch before creating a new one. - -Report the PR URL when complete (whether existing or newly created). - -### Step 3: Cleanup Worktree (if applicable) - -Check if working in a worktree: -```bash -git worktree list | grep $(git branch --show-current) -``` - -If yes, ask user: -``` -Worktree at . Remove it now? (y/n) -``` - -If confirmed: -```bash -git worktree remove -``` - -## Quick Reference - -``` -Tests Pass? - ↓ yes -/pr create - ↓ -PR URL returned - ↓ -Cleanup worktree (optional) - ↓ -Done -``` - -## Red Flags - -**Never:** -- Create PR with failing tests -- Skip test verification -- Force-push without explicit request - -**Always:** -- Verify tests before creating PR -- Use `/pr create` for consistent PR format -- Report the PR URL - -## Integration - -**Called by:** -- **executing-plans** (Step 6) - After all batches complete - -**Uses:** -- **/pr create** - For pushing and PR creation diff --git a/skills-dev/frontend-design-plugin/.claude-plugin/plugin.json b/skills-dev/frontend-design-plugin/.claude-plugin/plugin.json deleted file mode 100644 index 808f1e5..0000000 --- a/skills-dev/frontend-design-plugin/.claude-plugin/plugin.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "frontend-design-plugin", - "description": "Plugin for frontend-design", - "version": "1.0.0", - "author": { - "name": "qiudl" - } -} diff --git a/skills-dev/frontend-design-plugin/skills/SKILL.md b/skills-dev/frontend-design-plugin/skills/SKILL.md deleted file mode 100644 index f34ae42..0000000 --- a/skills-dev/frontend-design-plugin/skills/SKILL.md +++ /dev/null @@ -1,695 +0,0 @@ ---- -name: frontend-design -description: Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics. -arguments: [component|page|storybook] ---- - -# Frontend Design 前端设计技能 - -创建高质量、有设计感的前端界面和组件,支持 Storybook 组件开发。 - ---- - -## 命令格式 - -| 命令 | 功能 | 示例 | -|------|------|------| -| `/frontend-design component <描述>` | 创建 React/Vue 组件 | `/frontend-design component 产品卡片` | -| `/frontend-design page <描述>` | 创建完整页面 | `/frontend-design page 登录页` | -| `/frontend-design storybook <描述>` | 创建带 Storybook 的组件 | `/frontend-design storybook 按钮组件` | - ---- - -## 设计原则 - -### 1. 设计思维先行 - -在编码前,明确以下问题: - -- **目的**:这个界面解决什么问题?谁在使用? -- **调性**:选择一个明确的美学方向 -- **差异化**:什么让这个设计令人难忘? - -### 2. 美学方向选择 - -| 风格 | 特点 | 适用场景 | -|------|------|----------| -| 极简主义 | 大量留白、精炼元素 | 工具类、专业平台 | -| 现代商务 | 清晰层次、专业配色 | 企业官网、B2B | -| 活力年轻 | 鲜艳色彩、动感动画 | 消费品、社交 | -| 奢华精致 | 深色调、金属质感 | 高端品牌、金融 | -| 自然有机 | 柔和曲线、自然色系 | 健康、环保 | -| 复古怀旧 | 经典字体、做旧质感 | 文化、艺术 | -| 未来科技 | 渐变、玻璃拟态 | 科技、创新 | - -### 3. 避免的设计陷阱 - -**禁止使用**: -- 过度使用的字体:Inter、Roboto、Arial -- 陈词滥调的配色:紫色渐变白底 -- 千篇一律的布局 -- 缺乏个性的通用组件 - -**应该追求**: -- 独特的字体组合 -- 有意图的配色方案 -- 打破常规的布局 -- 有记忆点的细节 - ---- - -## Storybook 组件开发 - -### 项目结构 - -``` -src/ -├── components/ -│ ├── Button/ -│ │ ├── Button.tsx -│ │ ├── Button.stories.tsx -│ │ ├── Button.module.css -│ │ └── index.ts -│ ├── Card/ -│ │ ├── Card.tsx -│ │ ├── Card.stories.tsx -│ │ ├── Card.module.css -│ │ └── index.ts -│ └── index.ts -├── styles/ -│ ├── variables.css -│ ├── typography.css -│ └── animations.css -└── .storybook/ - ├── main.ts - └── preview.ts -``` - -### 组件模板 - -#### 1. 组件文件 (Component.tsx) - -```tsx -import React from 'react'; -import styles from './Component.module.css'; - -export interface ComponentProps { - /** 组件变体 */ - variant?: 'primary' | 'secondary' | 'outline'; - /** 尺寸 */ - size?: 'sm' | 'md' | 'lg'; - /** 是否禁用 */ - disabled?: boolean; - /** 子元素 */ - children: React.ReactNode; - /** 点击事件 */ - onClick?: () => void; -} - -export const Component: React.FC = ({ - variant = 'primary', - size = 'md', - disabled = false, - children, - onClick, -}) => { - return ( -
- {children} -
- ); -}; -``` - -#### 2. Storybook Stories (Component.stories.tsx) - -```tsx -import type { Meta, StoryObj } from '@storybook/react'; -import { Component } from './Component'; - -const meta: Meta = { - title: 'Components/Component', - component: Component, - tags: ['autodocs'], - parameters: { - layout: 'centered', - docs: { - description: { - component: '组件描述文档', - }, - }, - }, - argTypes: { - variant: { - control: 'select', - options: ['primary', 'secondary', 'outline'], - description: '组件变体样式', - }, - size: { - control: 'radio', - options: ['sm', 'md', 'lg'], - description: '组件尺寸', - }, - disabled: { - control: 'boolean', - description: '是否禁用', - }, - }, -}; - -export default meta; -type Story = StoryObj; - -/** 默认状态 */ -export const Default: Story = { - args: { - children: '默认组件', - }, -}; - -/** 主要变体 */ -export const Primary: Story = { - args: { - variant: 'primary', - children: '主要按钮', - }, -}; - -/** 次要变体 */ -export const Secondary: Story = { - args: { - variant: 'secondary', - children: '次要按钮', - }, -}; - -/** 不同尺寸 */ -export const Sizes: Story = { - render: () => ( -
- 小号 - 中号 - 大号 -
- ), -}; - -/** 禁用状态 */ -export const Disabled: Story = { - args: { - disabled: true, - children: '禁用状态', - }, -}; -``` - -#### 3. 样式文件 (Component.module.css) - -```css -.component { - /* 基础样式 */ - display: inline-flex; - align-items: center; - justify-content: center; - border-radius: var(--radius-md); - font-family: var(--font-sans); - font-weight: 500; - cursor: pointer; - transition: all 0.2s ease; -} - -/* 变体 */ -.primary { - background: var(--color-primary); - color: white; -} - -.primary:hover { - background: var(--color-primary-dark); - transform: translateY(-1px); - box-shadow: 0 4px 12px var(--color-primary-shadow); -} - -.secondary { - background: var(--color-secondary); - color: var(--color-text); -} - -.outline { - background: transparent; - border: 2px solid var(--color-border); - color: var(--color-text); -} - -/* 尺寸 */ -.sm { - padding: 0.5rem 1rem; - font-size: 0.875rem; -} - -.md { - padding: 0.75rem 1.5rem; - font-size: 1rem; -} - -.lg { - padding: 1rem 2rem; - font-size: 1.125rem; -} - -/* 状态 */ -[data-disabled="true"] { - opacity: 0.5; - cursor: not-allowed; - pointer-events: none; -} -``` - ---- - -## 设计系统变量 - -### CSS 变量模板 - -```css -:root { - /* 颜色 */ - --color-primary: #0066ff; - --color-primary-dark: #0052cc; - --color-primary-light: #4d94ff; - --color-primary-shadow: rgba(0, 102, 255, 0.25); - - --color-secondary: #f0f4f8; - --color-accent: #ff6b35; - - --color-text: #1a1a2e; - --color-text-muted: #64748b; - --color-text-inverse: #ffffff; - - --color-background: #ffffff; - --color-surface: #f8fafc; - --color-border: #e2e8f0; - - --color-success: #10b981; - --color-warning: #f59e0b; - --color-error: #ef4444; - - /* 字体 */ - --font-sans: 'Plus Jakarta Sans', system-ui, sans-serif; - --font-display: 'Clash Display', var(--font-sans); - --font-mono: 'JetBrains Mono', monospace; - - /* 字号 */ - --text-xs: 0.75rem; - --text-sm: 0.875rem; - --text-base: 1rem; - --text-lg: 1.125rem; - --text-xl: 1.25rem; - --text-2xl: 1.5rem; - --text-3xl: 2rem; - --text-4xl: 2.5rem; - - /* 间距 */ - --space-1: 0.25rem; - --space-2: 0.5rem; - --space-3: 0.75rem; - --space-4: 1rem; - --space-6: 1.5rem; - --space-8: 2rem; - --space-12: 3rem; - --space-16: 4rem; - - /* 圆角 */ - --radius-sm: 0.25rem; - --radius-md: 0.5rem; - --radius-lg: 1rem; - --radius-xl: 1.5rem; - --radius-full: 9999px; - - /* 阴影 */ - --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05); - --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1); - --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1); - --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1); - - /* 动画 */ - --duration-fast: 150ms; - --duration-normal: 300ms; - --duration-slow: 500ms; - --ease-out: cubic-bezier(0.16, 1, 0.3, 1); - --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1); -} - -/* 暗色主题 */ -[data-theme="dark"] { - --color-text: #f1f5f9; - --color-text-muted: #94a3b8; - --color-background: #0f172a; - --color-surface: #1e293b; - --color-border: #334155; -} -``` - ---- - -## 常用组件示例 - -### 1. 产品卡片 (ProductCard) - -```tsx -// ProductCard.tsx -import React from 'react'; -import styles from './ProductCard.module.css'; - -export interface ProductCardProps { - image: string; - title: string; - location: string; - rating: number; - reviewCount: number; - price: number; - originalPrice?: number; - tags?: string[]; - onAddToCart?: () => void; -} - -export const ProductCard: React.FC = ({ - image, - title, - location, - rating, - reviewCount, - price, - originalPrice, - tags = [], - onAddToCart, -}) => { - return ( -
-
- {title} - {tags.length > 0 && ( -
- {tags.map((tag) => ( - - {tag} - - ))} -
- )} -
- -
-

{title}

-

📍 {location}

- -
- ⭐ {rating.toFixed(1)} - ({reviewCount}条评价) -
- -
-
- ¥ - {price} - -
- {originalPrice && ( - ¥{originalPrice} - )} -
- - -
-
- ); -}; -``` - -```tsx -// ProductCard.stories.tsx -import type { Meta, StoryObj } from '@storybook/react'; -import { ProductCard } from './ProductCard'; - -const meta: Meta = { - title: 'Components/ProductCard', - component: ProductCard, - tags: ['autodocs'], - parameters: { - layout: 'centered', - backgrounds: { - default: 'light', - }, - }, -}; - -export default meta; -type Story = StoryObj; - -export const Default: Story = { - args: { - image: 'https://images.unsplash.com/photo-1494947665470-20322015e3a8', - title: '袋鼠岛一日游', - location: '阿德莱德出发', - rating: 4.8, - reviewCount: 126, - price: 389, - tags: ['热卖', '含午餐'], - }, -}; - -export const WithDiscount: Story = { - args: { - ...Default.args, - originalPrice: 499, - tags: ['特惠', '限时'], - }, -}; - -export const Grid: Story = { - render: () => ( -
- - - -
- ), -}; -``` - -### 2. 按钮组件 (Button) - -```tsx -// Button.tsx -import React from 'react'; -import styles from './Button.module.css'; - -export interface ButtonProps { - variant?: 'primary' | 'secondary' | 'outline' | 'ghost' | 'danger'; - size?: 'sm' | 'md' | 'lg'; - fullWidth?: boolean; - loading?: boolean; - disabled?: boolean; - leftIcon?: React.ReactNode; - rightIcon?: React.ReactNode; - children: React.ReactNode; - onClick?: () => void; -} - -export const Button: React.FC = ({ - variant = 'primary', - size = 'md', - fullWidth = false, - loading = false, - disabled = false, - leftIcon, - rightIcon, - children, - onClick, -}) => { - return ( - - ); -}; -``` - ---- - -## Storybook 配置 - -### .storybook/main.ts - -```ts -import type { StorybookConfig } from '@storybook/react-vite'; - -const config: StorybookConfig = { - stories: ['../src/**/*.stories.@(js|jsx|ts|tsx)'], - addons: [ - '@storybook/addon-links', - '@storybook/addon-essentials', - '@storybook/addon-interactions', - '@storybook/addon-a11y', - ], - framework: { - name: '@storybook/react-vite', - options: {}, - }, - docs: { - autodocs: 'tag', - }, -}; - -export default config; -``` - -### .storybook/preview.ts - -```ts -import type { Preview } from '@storybook/react'; -import '../src/styles/variables.css'; -import '../src/styles/typography.css'; - -const preview: Preview = { - parameters: { - actions: { argTypesRegex: '^on[A-Z].*' }, - controls: { - matchers: { - color: /(background|color)$/i, - date: /Date$/, - }, - }, - backgrounds: { - default: 'light', - values: [ - { name: 'light', value: '#ffffff' }, - { name: 'gray', value: '#f8fafc' }, - { name: 'dark', value: '#0f172a' }, - ], - }, - }, - globalTypes: { - theme: { - description: 'Global theme for components', - defaultValue: 'light', - toolbar: { - title: 'Theme', - icon: 'circlehollow', - items: ['light', 'dark'], - dynamicTitle: true, - }, - }, - }, -}; - -export default preview; -``` - ---- - -## 快速启动命令 - -### 创建新组件 - -```bash -# 创建组件目录 -mkdir -p src/components/ComponentName - -# 创建文件 -touch src/components/ComponentName/{ComponentName.tsx,ComponentName.stories.tsx,ComponentName.module.css,index.ts} -``` - -### 安装 Storybook - -```bash -# 初始化 Storybook -npx storybook@latest init - -# 安装额外插件 -npm install -D @storybook/addon-a11y @storybook/addon-interactions - -# 启动 Storybook -npm run storybook -``` - ---- - -## 设计检查清单 - -### 组件质量检查 - -- [ ] Props 接口定义完整,带 JSDoc 注释 -- [ ] 支持必要的变体(variant)和尺寸(size) -- [ ] 处理禁用和加载状态 -- [ ] 支持自定义 className -- [ ] 键盘可访问性 -- [ ] 屏幕阅读器友好 - -### Storybook 质量检查 - -- [ ] 所有变体都有对应 Story -- [ ] argTypes 配置完整 -- [ ] 包含组件文档描述 -- [ ] 交互状态可测试 -- [ ] 响应式展示 - -### 视觉质量检查 - -- [ ] 字体选择有特色 -- [ ] 配色方案协调 -- [ ] 动画流畅自然 -- [ ] 间距一致 -- [ ] 暗色主题支持 diff --git a/skills-dev/gitea-plugin/.claude-plugin/plugin.json b/skills-dev/gitea-plugin/.claude-plugin/plugin.json deleted file mode 100644 index 1a2bb7c..0000000 --- a/skills-dev/gitea-plugin/.claude-plugin/plugin.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "gitea-plugin", - "description": "Gitea 代码托管与 CI/CD 管理。用于 Gitea Actions workflow 管理、Runner 管理、PR 操作、仓库配置。", - "version": "1.0.0", - "author": { - "name": "qiudl" - } -} diff --git a/skills-dev/gitea-plugin/scripts/gitea-runs b/skills-dev/gitea-plugin/scripts/gitea-runs deleted file mode 100755 index a16da35..0000000 --- a/skills-dev/gitea-plugin/scripts/gitea-runs +++ /dev/null @@ -1,211 +0,0 @@ -#!/bin/bash -# gitea-runs — Gitea Actions CLI helper -# Usage: -# gitea-runs List recent runs -# gitea-runs list [limit] List recent runs (default 10) -# gitea-runs view View run details & jobs -# gitea-runs open [run_number] Open run in browser -# gitea-runs workflows List workflows -# gitea-runs dispatch [ref] Trigger a workflow dispatch -# gitea-runs help Show this help - -set -e - -# Config from tea CLI -TEA_CONFIG="${XDG_CONFIG_HOME:-$HOME/Library/Application Support}/tea/config.yml" -if [ ! -f "$TEA_CONFIG" ]; then - TEA_CONFIG="$HOME/.config/tea/config.yml" -fi - -# Parse tea config (nested under logins) -GITEA_URL=$(grep 'url:' "$TEA_CONFIG" | head -1 | awk '{print $NF}') -GITEA_TOKEN=$(grep 'token:' "$TEA_CONFIG" | head -1 | awk '{print $NF}') - -# Detect repo from git remote -REPO=$(git remote get-url origin 2>/dev/null | sed 's|.*gitea.pipexerp.com[:/]*||;s|\.git$||;s|^10022/||') -if [ -z "$REPO" ]; then - echo "Error: not in a git repo or remote not configured" - exit 1 -fi - -API="$GITEA_URL/api/v1" -AUTH="Authorization: token $GITEA_TOKEN" - -GREEN='\033[0;32m' -RED='\033[0;31m' -CYAN='\033[0;36m' -NC='\033[0m' - -cmd_dispatch() { - local workflow="${1:-}" - local ref="${2:-main}" - if [ -z "$workflow" ]; then - echo "Usage: gitea-runs dispatch [ref]" - echo "" - echo "Available workflows:" - curl -s -H "$AUTH" "$API/repos/$REPO/actions/workflows" 2>/dev/null \ - | python3 -c " -import json, sys -data = json.load(sys.stdin) -for w in data.get('workflows', []): - print(f\" {w['id']:30s} {w['name']}\") -" 2>/dev/null - return - fi - - local http_code - http_code=$(curl -s -o /dev/null -w "%{http_code}" \ - -H "$AUTH" \ - -H "Content-Type: application/json" \ - -X POST "$API/repos/$REPO/actions/workflows/$workflow/dispatches" \ - -d "{\"ref\":\"$ref\"}" 2>/dev/null) - - if [ "$http_code" = "204" ]; then - echo -e "${GREEN}✓${NC} Dispatched workflow: $workflow (ref: $ref)" - echo " View: $GITEA_URL/$REPO/actions" - else - echo -e "${RED}✗${NC} Failed to dispatch (HTTP $http_code)" - fi -} - -cmd_workflows() { - echo -e "${CYAN}Workflows for $REPO${NC}" - echo "" - curl -s -H "$AUTH" "$API/repos/$REPO/actions/workflows" 2>/dev/null \ - | python3 -c " -import json, sys -data = json.load(sys.stdin) -for w in data.get('workflows', []): - state = '✓' if w['state'] == 'active' else '✗' - print(f\" {state} {w['id']:30s} {w['name']}\") -" 2>/dev/null -} - -cmd_list() { - local limit="${1:-10}" - echo -e "${CYAN}Recent runs for $REPO${NC}" - echo "" - curl -s -H "$AUTH" "$API/repos/$REPO/actions/runs?limit=$limit" 2>/dev/null \ - | python3 -c " -import json, sys -limit = $limit -data = json.load(sys.stdin) -for r in data.get('workflow_runs', [])[:limit]: - status = r.get('status', '?') - num = r.get('run_number', 0) - title = r.get('display_title', '')[:60] - wf = r.get('path', '') - wf = wf.split('@')[0] if '@' in wf else wf - icon = {'success':'\u2713','completed':'\u2713','failure':'\u2717','cancelled':'\u2717','in_progress':'\u27f3','running':'\u27f3','queued':'\u25cc','waiting':'\u25cc'}.get(status, '?') - color = {'success':'\033[0;32m','completed':'\033[0;32m','failure':'\033[0;31m','cancelled':'\033[0;31m','in_progress':'\033[0;33m','running':'\033[0;33m'}.get(status, '\033[0;37m') - print(f\"{color}{icon}\033[0m #{num:<4} {status:<12} {wf:<20} {title}\") -" 2>/dev/null -} - -cmd_view() { - local run_number="${1:-}" - if [ -z "$run_number" ]; then - echo "Usage: gitea-runs view " - return 1 - fi - - # Find run by run_number (API uses internal id, html uses run_number) - local run_data - run_data=$(curl -s -H "$AUTH" "$API/repos/$REPO/actions/runs?limit=50" 2>/dev/null \ - | python3 -c " -import json, sys -data = json.load(sys.stdin) -for r in data.get('workflow_runs', []): - if r['run_number'] == $run_number: - print(json.dumps(r)) - break -" 2>/dev/null) - - if [ -z "$run_data" ]; then - echo -e "${RED}✗${NC} Run #$run_number not found" - return 1 - fi - - local run_id - run_id=$(echo "$run_data" | python3 -c "import json,sys; print(json.load(sys.stdin)['id'])") - - # Print run info - echo "$run_data" | python3 -c " -import json, sys -r = json.load(sys.stdin) -status = r.get('status', '?') -icon = {'success':'\u2713','failure':'\u2717','in_progress':'\u27f3','queued':'\u25cc'}.get(status, '?') -color = {'success':'\033[0;32m','failure':'\033[0;31m','in_progress':'\033[0;33m'}.get(status, '\033[0;37m') -print(f\"{color}{icon} Run #{r.get('run_number',0)} \u2014 {status}\033[0m\") -print(f\" Title: {r.get('display_title','')}\") -print(f\" Event: {r.get('event','')}\") -print(f\" Branch: {r.get('head_branch','')}\") -print(f\" Commit: {r.get('head_sha','')[:8]}\") -print(f\" Actor: {r.get('actor',{}).get('login','')}\") -wf = r.get('path', '') -wf = wf.split('@')[0] if '@' in wf else wf -print(f\" Workflow: {wf}\") -" 2>/dev/null - - # Print jobs - echo "" - echo -e "${CYAN}Jobs:${NC}" - curl -s -H "$AUTH" "$API/repos/$REPO/actions/runs/$run_id/jobs" 2>/dev/null \ - | python3 -c " -import json, sys -from datetime import datetime -data = json.load(sys.stdin) -for j in data.get('jobs', []): - status = j.get('status', '?') - icon = {'success':'\u2713','failure':'\u2717','in_progress':'\u27f3','queued':'\u25cc','waiting':'\u25cc'}.get(status, '?') - color = {'success':'\033[0;32m','failure':'\033[0;31m','in_progress':'\033[0;33m'}.get(status, '\033[0;37m') - runner = j.get('runner_name', '-') - started = j.get('started_at', '')[:19].replace('T', ' ') - completed = j.get('completed_at', '')[:19].replace('T', ' ') - duration = '' - if completed and not completed.startswith('1970'): - try: - d = datetime.fromisoformat(completed) - datetime.fromisoformat(started) - duration = f' ({int(d.total_seconds())}s)' - except: pass - print(f\" {color}{icon}\033[0m {j.get('name',''):<30} {status:<12} runner: {runner}{duration}\") -" 2>/dev/null -} - -cmd_open() { - local run_id="${1:-}" - local url="$GITEA_URL/$REPO/actions" - if [ -n "$run_id" ]; then - url="$url/runs/$run_id" - fi - echo "Opening: $url" - open "$url" 2>/dev/null || xdg-open "$url" 2>/dev/null || echo "$url" -} - -cmd_help() { - echo "gitea-runs — Gitea Actions CLI helper" - echo "" - echo "Usage:" - echo " gitea-runs List recent runs" - echo " gitea-runs list [limit] List recent runs (default 10)" - echo " gitea-runs view View run details & jobs" - echo " gitea-runs open [run_number] Open run in browser" - echo " gitea-runs workflows List workflows" - echo " gitea-runs dispatch [ref] Trigger a workflow dispatch" - echo " gitea-runs help Show this help" - echo "" - echo "Repo: $REPO" - echo "Gitea: $GITEA_URL" -} - -# Main -case "${1:-}" in - list|ls) shift; cmd_list "$@" ;; - view|v) shift; cmd_view "$@" ;; - dispatch) shift; cmd_dispatch "$@" ;; - workflows|wf) cmd_workflows ;; - open|o) shift; cmd_open "$@" ;; - help|--help|-h) cmd_help ;; - "") cmd_list ;; - *) cmd_view "$1" ;; -esac diff --git a/skills-dev/gitea-plugin/skills/SKILL.md b/skills-dev/gitea-plugin/skills/SKILL.md deleted file mode 100644 index a829627..0000000 --- a/skills-dev/gitea-plugin/skills/SKILL.md +++ /dev/null @@ -1,281 +0,0 @@ ---- -name: gitea -description: Gitea 代码托管与 CI/CD 管理。用于 Gitea Actions workflow 管理、Runner 管理、PR 操作、仓库配置。当用户提到 Gitea、Actions、Runner、CI/CD workflow、PR 检查相关任务时自动激活。 ---- - -# Gitea Skill - -Gitea 代码托管平台管理,覆盖 Actions CI/CD、Runner、PR、仓库配置。 - -## 服务器信息 - -| 服务 | 地址 | SSH | -|------|------|-----| -| Gitea Web | https://gitea.pipexerp.com | — | -| Gitea SSH | gitea.pipexerp.com:10022 | `ssh -i ~/.ssh/id_ed25519 git@gitea.pipexerp.com -p 10022` | -| Gitea 服务器 | 123.56.89.187 | `ssh -i ~/.ssh/tools.pem root@123.56.89.187` | -| Runner 服务器 | 101.200.136.200 (Jenkins 服务器) | `ssh -i ~/.ssh/tools.pem root@101.200.136.200` | - -## API 访问 - -```bash -# Gitea API Token (仓库级) -GITEA_TOKEN="483a2b65219625ee382eb6d023cda39238c32e24" - -# 通用请求格式 -curl -s "https://gitea.pipexerp.com/api/v1/repos/pipexerp//..." \ - -H "Authorization: token $GITEA_TOKEN" -``` - -### 常用 API - -| 操作 | 方法 | 端点 | -|------|------|------| -| 创建 PR | POST | `/repos/{owner}/{repo}/pulls` | -| 更新 PR | PATCH | `/repos/{owner}/{repo}/pulls/{id}` | -| 列出 Runs | GET | `/repos/{owner}/{repo}/actions/runs` | -| Run 详情 | GET | `/repos/{owner}/{repo}/actions/runs/{id}` | -| Job 详情 | GET | `/repos/{owner}/{repo}/actions/runs/{id}/jobs` | -| 手动触发 Workflow | POST | `/repos/{owner}/{repo}/actions/workflows/{file}/dispatches` body: `{"ref":"main"}` | -| 获取 Runner Token | POST | `/repos/{owner}/{repo}/actions/runners/registration-token` | -| 添加 Secret | PUT | `/repos/{owner}/{repo}/actions/secrets/{name}` body: `{"data":"value"}` | -| 删除 Run(仅已完成)| DELETE | `/repos/{owner}/{repo}/actions/runs/{id}` | - -**注意**: Gitea 1.25 **不支持**通过 API cancel 正在排队/运行的 run。 - -## 仓库 - -| 仓库 | 地址 | 主分支 | -|------|------|--------| -| coolbuy-paas | pipexerp/coolbuy-paas | main | -| dotfiles | huangjun/dotfiles | main | -| claude-marketplace | huangjun/claude-marketplace | main | - -## Actions Runners - -### 主 Runner (lint/test/e2e) -| 项目 | 值 | -|------|-----| -| 名称 | jenkins-runner | -| 配置 | `/opt/act_runner/config.yaml` | -| Capacity | 3 | -| Labels | `ubuntu-latest`, `ubuntu-22.04`, `ubuntu-20.04` | -| 进程 | `/usr/local/bin/act_runner daemon --config /opt/act_runner/config.yaml` | - -### Deploy Runner (staging 部署专用) -| 项目 | 值 | -|------|-----| -| 名称 | deploy-runner | -| 配置 | `/opt/act_runner_deploy/config.yaml` | -| Capacity | 1 | -| Labels | `deploy:host` | -| PID | `/opt/act_runner_deploy/runner.pid` | -| 日志 | `/opt/act_runner_deploy/runner.log` | -| 启动 | `cd /opt/act_runner_deploy && nohup act_runner daemon --config config.yaml > runner.log 2>&1 &` | - -### 注册新 Runner - -```bash -# 1. 获取 registration token -curl -s -X POST "https://gitea.pipexerp.com/api/v1/repos/pipexerp/coolbuy-paas/actions/runners/registration-token" \ - -H "Authorization: token $GITEA_TOKEN" - -# 2. SSH 到 runner 服务器 -ssh -i ~/.ssh/tools.pem root@101.200.136.200 - -# 3. 创建目录和配置 -mkdir -p /opt/act_runner_ -cat > /opt/act_runner_/config.yaml << 'EOF' -log: - level: info -runner: - file: .runner - capacity: 1 - timeout: 30m - labels: - - "