diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index a4bb75b..c7c90c2 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -1,6 +1,6 @@ { "name": "superpowers-zh", - "description": "AI 编程超能力中文增强版:20 个 skills,支持 OpenClaw / Claude Code / Cursor 等 14 款工具", + "description": "AI 编程超能力中文增强版:20 个 skills,支持 OpenClaw / Claude Code / Cursor 等 15 款工具", "owner": { "name": "jnMetaCode", "url": "https://github.com/jnMetaCode" @@ -8,8 +8,8 @@ "plugins": [ { "name": "superpowers-zh", - "description": "AI 编程超能力中文增强版:20 个 skills(14 翻译 + 6 中国原创),支持 OpenClaw / Claude Code / Cursor 等 14 款工具", - "version": "1.1.1", + "description": "AI 编程超能力中文增强版:20 个 skills(14 翻译 + 6 中国原创),支持 OpenClaw / Claude Code / Cursor 等 15 款工具", + "version": "1.1.6", "source": "./", "author": { "name": "jnMetaCode", diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json index deb2c30..19dee78 100644 --- a/.claude-plugin/plugin.json +++ b/.claude-plugin/plugin.json @@ -1,7 +1,7 @@ { "name": "superpowers-zh", - "description": "AI 编程超能力中文增强版:20 个 skills(14 翻译 + 6 中国原创),支持 OpenClaw / Claude Code / Cursor 等 14 款工具", - "version": "1.1.1", + "description": "AI 编程超能力中文增强版:20 个 skills(14 翻译 + 6 中国原创),支持 OpenClaw / Claude Code / Cursor 等 15 款工具", + "version": "1.1.6", "author": { "name": "jnMetaCode", "url": "https://github.com/jnMetaCode" diff --git a/.cursor-plugin/plugin.json b/.cursor-plugin/plugin.json index ef09f7e..cbcedf0 100644 --- a/.cursor-plugin/plugin.json +++ b/.cursor-plugin/plugin.json @@ -1,8 +1,8 @@ { "name": "superpowers-zh", "displayName": "Superpowers 中文版", - "description": "AI 编程超能力中文增强版:20 个 skills(14 翻译 + 6 中国原创),支持 OpenClaw / Cursor / Claude Code 等 14 款工具", - "version": "1.1.1", + "description": "AI 编程超能力中文增强版:20 个 skills(14 翻译 + 6 中国原创),支持 OpenClaw / Cursor / Claude Code 等 15 款工具", + "version": "1.1.6", "author": { "name": "jnMetaCode", "url": "https://github.com/jnMetaCode" diff --git a/.gitignore b/.gitignore index 1c25a50..31ff211 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,8 @@ node_modules/ inspo triage/ + +# 安装器生成的 skills 副本(源在 skills/ 目录) +.codex/skills/ +.gemini/skills/ +.opencode/skills/ diff --git a/.opencode/plugins/superpowers.js b/.opencode/plugins/superpowers.js index 5e7833b..52d1a37 100644 --- a/.opencode/plugins/superpowers.js +++ b/.opencode/plugins/superpowers.js @@ -1,13 +1,12 @@ /** * Superpowers plugin for OpenCode.ai * - * Injects superpowers bootstrap context via system prompt transform. + * Injects superpowers bootstrap context via user message transform. * Auto-registers skills directory via config hook (no symlinks needed). */ import path from 'path'; import fs from 'fs'; -import os from 'os'; import { fileURLToPath } from 'url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -33,24 +32,8 @@ const extractAndStripFrontmatter = (content) => { return { frontmatter, content: body }; }; -// Normalize a path: trim whitespace, expand ~, resolve to absolute -const normalizePath = (p, homeDir) => { - if (!p || typeof p !== 'string') return null; - let normalized = p.trim(); - if (!normalized) return null; - if (normalized.startsWith('~/')) { - normalized = path.join(homeDir, normalized.slice(2)); - } else if (normalized === '~') { - normalized = homeDir; - } - return path.resolve(normalized); -}; - export const SuperpowersPlugin = async ({ client, directory }) => { - const homeDir = os.homedir(); const superpowersSkillsDir = path.resolve(__dirname, '../../skills'); - const envConfigDir = normalizePath(process.env.OPENCODE_CONFIG_DIR, homeDir); - const configDir = envConfigDir || path.join(homeDir, '.config/opencode'); // Helper to generate bootstrap content const getBootstrapContent = () => { @@ -68,8 +51,6 @@ When skills reference tools you don't have, substitute OpenCode equivalents: - \`Skill\` tool → OpenCode's native \`skill\` tool - \`Read\`, \`Write\`, \`Edit\`, \`Bash\` → Your native tools -**Skills location:** -Superpowers skills are in \`${configDir}/skills/superpowers/\` Use OpenCode's native \`skill\` tool to list and load skills.`; return ` @@ -96,12 +77,19 @@ ${toolMapping} } }, - // Use system prompt transform to inject bootstrap (fixes #226 agent reset bug) - 'experimental.chat.system.transform': async (_input, output) => { + // Inject bootstrap into the first user message of each session. + // Using a user message instead of a system message avoids: + // 1. Token bloat from system messages repeated every turn (#750) + // 2. Multiple system messages breaking Qwen and other models (#894) + 'experimental.chat.messages.transform': async (_input, output) => { const bootstrap = getBootstrapContent(); - if (bootstrap) { - (output.system ||= []).push(bootstrap); - } + if (!bootstrap || !output.messages.length) return; + const firstUser = output.messages.find(m => m.info.role === 'user'); + if (!firstUser || !firstUser.parts.length) return; + // Only inject once + if (firstUser.parts.some(p => p.type === 'text' && p.text.includes('EXTREMELY_IMPORTANT'))) return; + const ref = firstUser.parts[0]; + firstUser.parts.unshift({ ...ref, type: 'text', text: bootstrap }); } }; }; diff --git a/GEMINI.md b/GEMINI.md index 0dd2f58..ab1a0dc 100644 --- a/GEMINI.md +++ b/GEMINI.md @@ -1,2 +1,43 @@ @./skills/using-superpowers/SKILL.md @./skills/using-superpowers/references/gemini-tools.md + + +# Superpowers-ZH 中文增强版 + +本项目已安装 superpowers-zh 技能框架(20 个 skills)。 + +## 核心规则 + +1. **收到任务时,先检查是否有匹配的 skill** — 哪怕只有 1% 的可能性也要检查 +2. **设计先于编码** — 收到功能需求时,先用 brainstorming skill 做需求分析 +3. **测试先于实现** — 写代码前先写测试(TDD) +4. **验证先于完成** — 声称完成前必须运行验证命令 + +## 可用 Skills + +Skills 位于 `.gemini/skills/` 目录,每个 skill 有独立的 `SKILL.md` 文件。 + +- **brainstorming**: 在任何创造性工作之前必须使用此技能——创建功能、构建组件、添加功能或修改行为。在实现之前先探索用户意图、需求和设计。 +- **chinese-code-review**: 中文代码审查规范——在保持专业严谨的同时,用符合国内团队文化的方式给出有效反馈 +- **chinese-commit-conventions**: 中文 Git 提交规范 — 适配国内团队的 commit message 规范和 changelog 自动化 +- **chinese-documentation**: 中文技术文档写作规范——排版、术语、结构一步到位,告别机翻味 +- **chinese-git-workflow**: 适配国内 Git 平台和团队习惯的工作流规范——Gitee、Coding、极狐 GitLab 全覆盖 +- **dispatching-parallel-agents**: 当面对 2 个以上可以独立进行、无共享状态或顺序依赖的任务时使用 +- **executing-plans**: 当你有一份书面实现计划需要在单独的会话中执行,并设有审查检查点时使用 +- **finishing-a-development-branch**: 当实现完成、所有测试通过、需要决定如何集成工作时使用——通过提供合并、PR 或清理等结构化选项来引导开发工作的收尾 +- **mcp-builder**: MCP 服务器构建方法论 — 系统化构建生产级 MCP 工具,让 AI 助手连接外部能力 +- **receiving-code-review**: 收到代码审查反馈后、实施建议之前使用,尤其当反馈不明确或技术上有疑问时——需要技术严谨性和验证,而非敷衍附和或盲目执行 +- **requesting-code-review**: 完成任务、实现重要功能或合并前使用,用于验证工作成果是否符合要求 +- **subagent-driven-development**: 当在当前会话中执行包含独立任务的实现计划时使用 +- **systematic-debugging**: 遇到任何 bug、测试失败或异常行为时使用,在提出修复方案之前执行 +- **test-driven-development**: 在实现任何功能或修复 bug 时使用,在编写实现代码之前 +- **using-git-worktrees**: 当需要开始与当前工作区隔离的功能开发或执行实现计划之前使用——创建具有智能目录选择和安全验证的隔离 git 工作树 +- **using-superpowers**: 在开始任何对话时使用——确立如何查找和使用技能,要求在任何响应(包括澄清性问题)之前调用 Skill 工具 +- **verification-before-completion**: 在宣称工作完成、已修复或测试通过之前使用,在提交或创建 PR 之前——必须运行验证命令并确认输出后才能声称成功;始终用证据支撑断言 +- **workflow-runner**: 在 Claude Code / OpenClaw / Cursor 中直接运行 agency-orchestrator YAML 工作流——无需 API key,使用当前会话的 LLM 作为执行引擎。当用户提供 .yaml 工作流文件或要求多角色协作完成任务时触发。 +- **writing-plans**: 当你有规格说明或需求用于多步骤任务时使用,在动手写代码之前 +- **writing-skills**: 当创建新技能、编辑现有技能或在部署前验证技能是否有效时使用 + +## 如何使用 + +当任务匹配某个 skill 时,读取对应的 `.gemini/skills//SKILL.md` 并严格遵循其流程。 diff --git a/bin/superpowers-zh.js b/bin/superpowers-zh.js index cc86c6c..b48d6b3 100755 --- a/bin/superpowers-zh.js +++ b/bin/superpowers-zh.js @@ -235,6 +235,8 @@ const TOOL_ALIASES = { 'claude': 'Claude Code', 'claude-code': 'Claude Code', 'claudecode': 'Claude Code', + 'copilot': 'Claude Code', + 'copilot-cli': 'Claude Code', 'cursor': 'Cursor', 'codex': 'Codex CLI', 'kiro': 'Kiro', diff --git a/gemini-extension.json b/gemini-extension.json index 3caad98..93439cf 100644 --- a/gemini-extension.json +++ b/gemini-extension.json @@ -1,6 +1,6 @@ { "name": "superpowers-zh", "description": "AI 编程超能力中文版 — TDD、调试、代码审查等经过实战验证的工作方法论", - "version": "1.1.1", + "version": "1.1.6", "contextFileName": "GEMINI.md" } diff --git a/hooks/session-start b/hooks/session-start index 2371935..2460429 100755 --- a/hooks/session-start +++ b/hooks/session-start @@ -35,23 +35,23 @@ warning_escaped=$(escape_for_json "$warning_message") session_context="\nYou have superpowers.\n\n**Below is the full content of your 'superpowers:using-superpowers' skill - your introduction to using skills. For all other skills, use the 'Skill' tool:**\n\n${using_superpowers_escaped}\n\n${warning_escaped}\n" # Output context injection as JSON. -# Cursor hooks expect additional_context. -# Claude Code hooks expect hookSpecificOutput.additionalContext. -# Claude Code reads BOTH fields without deduplication, so we must only -# emit the field consumed by the current platform to avoid double injection. +# Cursor hooks expect additional_context (snake_case). +# Claude Code hooks expect hookSpecificOutput.additionalContext (nested). +# Copilot CLI (v1.0.11+) and others expect additionalContext (top-level, SDK standard). +# Claude Code reads BOTH additional_context and hookSpecificOutput without +# deduplication, so we must emit only the field the current platform consumes. # -# Uses printf instead of heredoc (cat <=14.0.0" }, - "description": "AI 编程超能力中文增强版 — superpowers(99k+ ⭐)完整汉化 + 6 个中国原创 skills,支持 OpenClaw / Claude Code / Cursor / Windsurf / Kiro / Gemini CLI 等 14 款工具", + "description": "AI 编程超能力中文增强版 — superpowers(99k+ ⭐)完整汉化 + 6 个中国原创 skills,支持 Claude Code / Copilot CLI / Cursor / Windsurf / Kiro / Gemini CLI 等 15 款工具", "type": "module", "main": ".opencode/plugins/superpowers.js", "bin": { @@ -18,8 +18,9 @@ "hooks/", ".claude-plugin/", ".cursor-plugin/", - ".codex/", - ".opencode/", + ".codex/INSTALL.md", + ".opencode/INSTALL.md", + ".opencode/plugins/", "GEMINI.md", "gemini-extension.json", "docs/", diff --git a/skills/using-superpowers/SKILL.md b/skills/using-superpowers/SKILL.md index d435a81..04b960e 100644 --- a/skills/using-superpowers/SKILL.md +++ b/skills/using-superpowers/SKILL.md @@ -29,13 +29,15 @@ Superpowers 技能覆盖默认系统提示行为,但**用户指令始终具有 **在 Claude Code 中:** 使用 `Skill` 工具。当你调用一个技能时,其内容会被加载并呈现给你——直接遵循即可。绝不要用 Read 工具读取技能文件。 +**在 Copilot CLI 中:** 使用 `skill` 工具。技能从已安装的插件中自动发现。`skill` 工具的工作方式与 Claude Code 的 `Skill` 工具相同。 + **在 Gemini CLI 中:** 技能通过 `activate_skill` 工具激活。Gemini 在会话开始时加载技能元数据,并按需激活完整内容。 **在其他环境中:** 查看你的平台文档了解技能的加载方式。 ## 平台适配 -技能使用 Claude Code 的工具名称。非 CC 平台:查看 `references/codex-tools.md`(Codex)了解工具对应关系。Gemini CLI 用户通过 GEMINI.md 自动获得工具映射。 +技能使用 Claude Code 的工具名称。非 CC 平台:查看 `references/copilot-tools.md`(Copilot CLI)、`references/codex-tools.md`(Codex)了解工具对应关系。Gemini CLI 用户通过 GEMINI.md 自动获得工具映射。 # 使用技能 diff --git a/skills/using-superpowers/references/copilot-tools.md b/skills/using-superpowers/references/copilot-tools.md new file mode 100644 index 0000000..44afc70 --- /dev/null +++ b/skills/using-superpowers/references/copilot-tools.md @@ -0,0 +1,52 @@ +# Copilot CLI 工具映射 + +技能使用 Claude Code 的工具名称。当你在技能中遇到这些工具时,使用你平台的等价工具: + +| 技能中引用的工具 | Copilot CLI 等价工具 | +|-----------------|----------------------| +| `Read`(读取文件) | `view` | +| `Write`(创建文件) | `create` | +| `Edit`(编辑文件) | `edit` | +| `Bash`(运行命令) | `bash` | +| `Grep`(搜索文件内容) | `grep` | +| `Glob`(按名称搜索文件) | `glob` | +| `Skill` 工具(调用技能) | `skill` | +| `WebFetch` | `web_fetch` | +| `Task` 工具(分派子智能体) | `task`(参见[智能体类型](#智能体类型)) | +| 多个 `Task` 调用(并行) | 多个 `task` 调用 | +| Task 状态/输出 | `read_agent`、`list_agents` | +| `TodoWrite`(任务跟踪) | `sql` 配合内置 `todos` 表 | +| `WebSearch` | 无等价工具 — 使用 `web_fetch` 配合搜索引擎 URL | +| `EnterPlanMode` / `ExitPlanMode` | 无等价工具 — 留在主会话中 | + +## 智能体类型 + +Copilot CLI 的 `task` 工具接受 `agent_type` 参数: + +| Claude Code 智能体 | Copilot CLI 等价 | +|-------------------|----------------------| +| `general-purpose` | `"general-purpose"` | +| `Explore` | `"explore"` | +| 命名的插件智能体(如 `superpowers:code-reviewer`) | 从已安装的插件中自动发现 | + +## 异步 Shell 会话 + +Copilot CLI 支持持久化的异步 shell 会话,这在 Claude Code 中没有直接等价物: + +| 工具 | 用途 | +|------|---------| +| `bash` 配合 `async: true` | 在后台启动长时间运行的命令 | +| `write_bash` | 向运行中的异步会话发送输入 | +| `read_bash` | 读取异步会话的输出 | +| `stop_bash` | 终止异步会话 | +| `list_bash` | 列出所有活跃的 shell 会话 | + +## 额外的 Copilot CLI 工具 + +| 工具 | 用途 | +|------|---------| +| `store_memory` | 持久化代码库相关事实供未来会话使用 | +| `report_intent` | 更新 UI 状态行显示当前意图 | +| `sql` | 查询会话的 SQLite 数据库(待办、元数据) | +| `fetch_copilot_cli_documentation` | 查阅 Copilot CLI 文档 | +| GitHub MCP 工具(`github-mcp-server-*`) | 原生 GitHub API 访问(issue、PR、代码搜索) |