From 03433481db17e7b28902deba0104aeb4a7034ffb Mon Sep 17 00:00:00 2001 From: li Date: Mon, 26 Jan 2026 14:48:27 +0800 Subject: [PATCH] feat: upgrade to OPSX architecture and improve update workflow (v1.7.52) --- CLAUDE.md | 26 +++++---------------- package.json | 2 +- src/commands/update.ts | 10 ++++++--- templates/commands/spec-impl.md | 16 ++++++------- templates/commands/spec-init.md | 35 ++++++++++++++++++++++------- templates/commands/spec-plan.md | 34 ++++++++++++++-------------- templates/commands/spec-research.md | 19 ++++++++-------- 7 files changed, 75 insertions(+), 67 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 8280ce9..26df870 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,27 +1,8 @@ - -# OpenSpec Instructions - -These instructions are for AI assistants working in this project. - -Always open `@/openspec/AGENTS.md` when the request: -- Mentions planning or proposals (words like proposal, spec, change, plan) -- Introduces new capabilities, breaking changes, architecture shifts, or big performance/security work -- Sounds ambiguous and you need the authoritative spec before coding - -Use `@/openspec/AGENTS.md` to learn: -- How to create and apply change proposals -- Spec format and conventions -- Project structure and guidelines - -Keep this managed block so 'openspec update' can refresh the instructions. - - - # skills-v2 (CCG Multi-Model Collaboration System) > [根目录](../CLAUDE.md) > **skills-v2** -**Last Updated**: 2026-01-25 (v1.7.51) +**Last Updated**: 2026-01-26 (v1.7.52) --- @@ -29,6 +10,11 @@ Keep this managed block so 'openspec update' can refresh the instructions. > 完整变更历史请查看 [CHANGELOG.md](./CHANGELOG.md) +### 2026-01-26 (v1.7.52) +- 🚀 **OpenSpec 升级**:迁移到 OPSX 架构,废弃 `/openspec:xxx`,启用 `/opsx:xxx` +- 🔄 **命令更新**:更新 `spec-*` 系列命令以支持新的 `/opsx` 命令 +- 🗑️ **清理**:移除过时的 OpenSpec 指导块和旧命令 + ### 2026-01-25 (v1.7.51) - 🌏 **修复默认语言为英文的问题**:将 CLI 所有命令描述从硬编码英文改为中文 - 🐛 **修复 `cli-setup.ts`**:所有命令注册时的描述文本改为中文 diff --git a/package.json b/package.json index 75f1e5b..52ec962 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ccg-workflow", - "version": "1.7.51", + "version": "1.7.52", "description": "Claude-Codex-Gemini 多模型协作系统 - 智能路由多模型开发工作流", "type": "module", "packageManager": "pnpm@10.17.1", diff --git a/src/commands/update.ts b/src/commands/update.ts index c055cd0..606f2c0 100644 --- a/src/commands/update.ts +++ b/src/commands/update.ts @@ -50,23 +50,27 @@ export async function update(): Promise { // hasUpdate: npm registry has newer version // needsWorkflowUpdate: local workflows are older than running version const effectiveNeedsUpdate = hasUpdate || needsWorkflowUpdate + let defaultConfirm = effectiveNeedsUpdate let message: string if (hasUpdate) { - message = `确认要更新到 v${latestVersion} 吗?(先下载最新包 → 删除旧工作流 → 安装新工作流)` + message = `发现新版本 v${latestVersion} (当前: v${currentVersion}),是否更新?` + defaultConfirm = true } else if (needsWorkflowUpdate) { message = `检测到本地工作流版本 (v${localVersion}) 低于当前版本 (v${currentVersion}),是否更新?` + defaultConfirm = true } else { - message = '当前已是最新版本。要重新安装吗?(先下载最新包 → 删除旧工作流 → 安装新工作流)' + message = `当前已是最新版本 (v${currentVersion})。是否强制重新安装/修复工作流?` + defaultConfirm = false } const { confirmUpdate } = await inquirer.prompt([{ type: 'confirm', name: 'confirmUpdate', message, - default: effectiveNeedsUpdate, // Default to true if needs update + default: defaultConfirm, }]) if (!confirmUpdate) { diff --git a/templates/commands/spec-impl.md b/templates/commands/spec-impl.md index da581f5..d8f8415 100644 --- a/templates/commands/spec-impl.md +++ b/templates/commands/spec-impl.md @@ -12,16 +12,17 @@ description: '按规范执行 + 多模型协作 + 归档' - **NEVER** apply Codex/Gemini prototypes directly—all outputs are reference only. - **MANDATORY**: Request `unified diff patch` format from external models; they have zero write permission. - Keep implementation strictly within `tasks.md` scope—no scope creep. -- Refer to `openspec/AGENTS.md` for conventions. +- Refer to `openspec/config.yaml` for conventions. **Steps** -1. **Select Proposal** +1. **Select Change** - Run `openspec list` to inspect Active Changes. - - Confirm with user which proposal ID to implement. - - Run `openspec show ` to review tasks. + - Confirm with user which change ID to implement. + - Run `openspec show ` to review tasks. -2. **Apply OpenSpec Change** - - Run `/openspec:apply ` to enter implementation mode. +2. **Apply OPSX Change** + - Use `/ccg:spec-impl` (which uses OpenSpec skills internally) to enter implementation mode. + - This skill will guide you through the tasks defined in `tasks.md`. 3. **Identify Minimal Verifiable Phase** - Review `tasks.md` and identify the **smallest verifiable phase**. @@ -104,7 +105,7 @@ description: '按规范执行 + 多模型协作 + 归档' 10. **Archive on Completion** - When ALL tasks in `tasks.md` are marked `[x]`: - - Run `/openspec:archive ` + - The agent will use OpenSpec skills to archive the change. - This merges spec deltas to `openspec/specs/` and moves change to archive. **Reference** @@ -118,6 +119,5 @@ Implementation is complete when: - [ ] All tasks in `tasks.md` marked `[x]` - [ ] All multi-model reviews passed - [ ] Side-effect review confirmed no regressions -- [ ] `openspec validate ` returns zero issues - [ ] Change archived successfully diff --git a/templates/commands/spec-init.md b/templates/commands/spec-init.md index cf34fa9..3cb64ca 100644 --- a/templates/commands/spec-init.md +++ b/templates/commands/spec-init.md @@ -1,9 +1,9 @@ --- -description: '初始化 OpenSpec 环境 + 验证多模型 MCP 工具' +description: '初始化 OpenSpec (OPSX) 环境 + 验证多模型 MCP 工具' --- **Core Philosophy** -- OpenSpec provides the specification framework; CCG adds multi-model collaboration. +- OPSX provides the specification framework; CCG adds multi-model collaboration. - This phase ensures all tools are ready before any development work begins. - Fail fast: detect missing dependencies early rather than mid-workflow. @@ -20,18 +20,24 @@ description: '初始化 OpenSpec 环境 + 验证多模型 MCP 工具' 2. **Check and Install OpenSpec** - Verify if `openspec` CLI is installed: `openspec --version` - - If not installed: + - If not installed or not found: ```bash npm install -g @fission-ai/openspec@latest ``` - - Confirm installation success. + - **Path Verification**: + - If `openspec` command is not found after installation: + 1. Find npm global bin: `npm bin -g` + 2. Add to PATH temporarily for this session: `export PATH=$PATH:$(npm bin -g)` + 3. **CRITICAL**: Instruct user to add this path to their shell profile (e.g., `~/.zshrc`, `~/.bashrc`, or Windows Environment Variables) to make it permanent. + - Confirm installation success by running `openspec --version` again. -3. **Initialize OpenSpec for Current Project** +3. **Initialize OpenSpec (OPSX) for Current Project** - Run: ```bash openspec init --tools claude ``` - Verify `openspec/` directory structure is created. + - Verify `.claude/skills/` contains `openspec-*` skills. - Report any errors with remediation steps. 4. **Validate Multi-Model MCP Tools** @@ -47,8 +53,13 @@ description: '初始化 OpenSpec 环境 + 验证多模型 MCP 工具' - For each unavailable tool, display warning with installation instructions. 5. **Validate Context Retrieval MCP** (Optional) - - Check if `mcp__ace-tool__search_context` is available. - - If not, suggest: "Run `npx ccg-workflow` and select ace-tool MCP option." + - **Check Active Tool**: Is `mcp__ace-tool__search_context` available in the current session? + - **Check Configuration**: If tool is missing, check `~/.claude.json` (or `%APPDATA%\Claude\claude.json` on Windows) for `"ace-tool"` or `"ace-tool-rs"` in `mcpServers`. + - **Diagnosis**: + - If tool available: Mark as "✓ Active". + - If config exists but tool missing: Mark as "⚠️ Configured but inactive (Try restarting Claude)". + - If neither: Mark as "○ Not installed (Optional)". + - If not installed/configured, suggest: "Run `npx ccg-workflow` and select ace-tool MCP option." 6. **Summary Report** Display status table: @@ -57,12 +68,20 @@ description: '初始化 OpenSpec 环境 + 验证多模型 MCP 工具' ───────────────────────────────── OpenSpec CLI ✓/✗ Project initialized ✓/✗ + OPSX Skills ✓/✗ codeagent-wrapper ✓/✗ Codex backend ✓/✗ Gemini backend ✓/✗ ace-tool MCP ✓/✗ (optional) ``` - If any required components missing, list actions before proceeding. + + **Next Steps (Use CCG Encapsulated Commands)** + 1. Start Research: `/ccg:spec-research "description"` + 2. Plan & Design: `/ccg:spec-plan` + 3. Implement: `/ccg:spec-impl` (Includes auto-review & archive) + + **Standalone Tools (Available Anytime)** + - Code Review: `/ccg:spec-review` (Independent dual-model review) **Reference** - OpenSpec CLI: `openspec --help` diff --git a/templates/commands/spec-plan.md b/templates/commands/spec-plan.md index 4c0c036..ef0b659 100644 --- a/templates/commands/spec-plan.md +++ b/templates/commands/spec-plan.md @@ -12,13 +12,13 @@ description: '多模型分析 → 消除歧义 → 零决策可执行计划' - Do not proceed to implementation until every ambiguity is resolved. - Multi-model collaboration is **mandatory**: use both Codex and Gemini. - If constraints cannot be fully specified, escalate to user or return to research phase. -- Refer to `openspec/AGENTS.md` for conventions; run `openspec update` if missing. +- Refer to `openspec/config.yaml` for project conventions. **Steps** -1. **Select Proposal** +1. **Select Change** - Run `openspec list` to display Active Changes. - - Confirm with user which proposal ID to refine. - - Run `openspec show ` to review current state. + - Confirm with user which change ID to refine. + - Run `openspec status --change ` to review current state. 2. **Multi-Model Implementation Analysis (PARALLEL)** - **CRITICAL**: You MUST launch BOTH Codex AND Gemini in a SINGLE message with TWO Bash tool calls. @@ -29,7 +29,7 @@ description: '多模型分析 → 消除歧义 → 零决策可执行计划' **FIRST Bash call (Codex)**: ``` Bash({ - command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF'\nAnalyze proposal from backend perspective:\n- Implementation approach\n- Technical risks\n- Alternative architectures\n- Edge cases and failure modes\nOUTPUT: JSON with analysis\nEOF", + command: "~/.claude/bin/codeagent-wrapper --backend codex - \"$PWD\" <<'EOF'\nAnalyze change from backend perspective:\n- Implementation approach\n- Technical risks\n- Alternative architectures\n- Edge cases and failure modes\nOUTPUT: JSON with analysis\nEOF", run_in_background: true, timeout: 300000, description: "Codex: backend analysis" @@ -39,7 +39,7 @@ description: '多模型分析 → 消除歧义 → 零决策可执行计划' **SECOND Bash call (Gemini) - IN THE SAME MESSAGE**: ``` Bash({ - command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF'\nAnalyze proposal from frontend/integration perspective:\n- Maintainability assessment\n- Scalability considerations\n- Integration conflicts\nOUTPUT: JSON with analysis\nEOF", + command: "~/.claude/bin/codeagent-wrapper --backend gemini - \"$PWD\" <<'EOF'\nAnalyze change from frontend/integration perspective:\n- Maintainability assessment\n- Scalability considerations\n- Integration conflicts\nOUTPUT: JSON with analysis\nEOF", run_in_background: true, timeout: 300000, description: "Gemini: frontend analysis" @@ -82,28 +82,28 @@ description: '多模型分析 → 消除歧义 → 零决策可执行计划' - **Monotonicity**: Ordering guarantees (e.g., timestamps increase) - **Bounds**: Value ranges, size limits, rate constraints -5. **Update OpenSpec Documents** - - Run `/openspec:proposal ` to update specs with: - * All resolved constraints - * PBT properties in spec format - * Zero-decision task sequence - - Run `openspec validate ` to verify format. +5. **Update OPSX Artifacts** + - The agent will use OpenSpec skills to generate/update: + * specs (Requirements + PBT) + * design (Technical decisions) + * tasks (Zero-decision implementation plan) + - Ensure all resolved constraints and PBT properties are included in the generated artifacts. 6. **Context Checkpoint** - Report current context usage. - - If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec:impl`" + - If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec-impl`" **Exit Criteria** -A proposal is ready for implementation only when: +A change is ready for implementation only when: - [ ] All multi-model analyses completed and synthesized - [ ] Zero ambiguities remain (verified by step 3 audit) - [ ] All PBT properties documented with falsification strategies -- [ ] `openspec validate ` returns zero issues +- [ ] Artifacts (specs, design, tasks) generated via OpenSpec skills - [ ] User has explicitly approved all constraint decisions **Reference** -- Inspect proposal: `openspec show --json` -- Check conflicts: `openspec list --specs` +- Inspect change: `openspec status --change --verbose` +- Check conflicts: `openspec workflow schemas` - Search patterns: `rg -n "INVARIANT:|PROPERTY:" openspec/` - Use `AskUserQuestion` for ANY ambiguity—never assume diff --git a/templates/commands/spec-research.md b/templates/commands/spec-research.md index 2af1bbe..b24f178 100644 --- a/templates/commands/spec-research.md +++ b/templates/commands/spec-research.md @@ -1,12 +1,12 @@ --- -description: '需求 → 约束集(并行探索 + OpenSpec 提案)' +description: '需求 → 约束集(并行探索 + OPSX 提案)' --- **Core Philosophy** - Research produces **constraint sets**, not information dumps. Each constraint narrows the solution space. - Constraints tell subsequent stages "don't consider this direction," enabling mechanical execution without decisions. - Output: 约束集合 + 可验证的成功判据 (constraint sets + verifiable success criteria). -- Strictly adhere to OpenSpec rules when writing spec-structured documents. +- Strictly adhere to OPSX rules when writing spec-structured documents. **Guardrails** - **STOP! BEFORE ANY OTHER ACTION**: You MUST call `mcp__ace-tool__enhance_prompt` FIRST. This is NON-NEGOTIABLE. @@ -30,9 +30,9 @@ description: '需求 → 约束集(并行探索 + OpenSpec 提案)' - Wait for enhanced prompt result. - Use enhanced prompt for ALL subsequent steps. -1. **Generate OpenSpec Proposal** - - Run: `/openspec:proposal $ARGUMENTS` - - This scaffolds `openspec/changes//` with proposal.md, tasks.md, specs/. +1. **Generate OPSX Change** + - The agent will automatically initialize a new change or continue an existing one using OpenSpec skills. + - This scaffolds `openspec/changes//` with proposal.md. 2. **Initial Codebase Assessment** - Use `mcp__ace-tool__search_context` to scan codebase. @@ -78,8 +78,8 @@ description: '需求 → 约束集(并行探索 + OpenSpec 提案)' * Suggest defaults when applicable - Capture responses as additional constraints. -7. **Finalize OpenSpec Proposal** - - Transform constraint sets into OpenSpec format: +7. **Finalize OPSX Proposal** + - Transform constraint sets into OPSX format: * **Context**: User need + discovered constraints * **Requirements**: Each constraint becomes requirement with scenario * **Success Criteria**: Derived from hints and user confirmations @@ -91,11 +91,10 @@ description: '需求 → 约束集(并行探索 + OpenSpec 提案)' 8. **Context Checkpoint** - Report current context usage. - - If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec:plan`" + - If approaching 80K tokens, suggest: "Run `/clear` and continue with `/ccg:spec-plan`" **Reference** -- Review constraints: `rg -n "Constraint:|MUST|MUST NOT" openspec/specs` +- OPSX CLI: `openspec status`, `openspec show` - Check prior research: `ls openspec/changes/*/` -- Use `openspec show ` to inspect proposal structure - Use `AskUserQuestion` for ANY ambiguity—never assume or guess