UNPKG

@gongfu/workflow-cli

Version:

AI-powered workflow management CLI for developers

682 lines (519 loc) 23.6 kB
# Changelog All notable changes to @gongfu/workflow-cli will be documented in this file. ## [0.4.0] - 2025-07-20 ### 🎉 Phase 3: AI Capability Integration 这是统一架构升级的第三阶段,引入了完整的 AI 能力集成。 #### 🤖 新增功能 - **智能 Agent 分配器 (SmartAgentAllocator)** - 基于任务特征智能推荐最合适的 Agent - 集成 Memory 系统,基于历史表现进行推荐 - 支持主执行者、审查者、咨询顾问三种角色分配 - 提供置信度评分和推荐理由 - 内置规则引擎作为备选方案 - **AI 增强的 PRD 生成** - PRDGenerator 集成 Memory 系统 - 自动为创建的任务分配合适的 Agent - 支持 AI 模式选择:auto、manual、hybrid、memory-enhanced - 从历史经验中学习任务估时和分解模式 - **新命令: workflow ai** - `workflow ai status` - 查看 AI 功能状态和配置 - `workflow ai enable` - 启用 AI 功能和 Memory 系统 - `workflow ai disable` - 禁用 AI 功能 - `workflow ai mode <mode>` - 设置 AI 运行模式 - `workflow ai test` - 测试 AI 功能 - `workflow ai stats` - 显示 Agent 性能统计 - **AI API 端点** - `POST /api/v2/ai/recommend-agent` - 为单个任务推荐 Agent - `POST /api/v2/ai/recommend-agents` - 批量推荐 Agent - `POST /api/v2/ai/task-suggestions` - 获取任务建议 - `POST /api/v2/ai/record-performance` - 记录 Agent 表现 - `GET /api/v2/ai/agent-stats` - 获取 Agent 统计信息 - `GET /api/v2/ai/status` - 获取 AI 功能状态 #### ✨ 增强功能 - **workflow new 命令增强** - 新增 `--ai-mode` 参数选择 AI 模式 - 新增 `--enable-memory` 启用 Memory 系统 - 任务列表显示分配的 Agent - AI 模式信息提示 - **workflow agent recommend 增强** - 集成 SmartAgentAllocator 进行智能推荐 - 支持 Memory 系统的历史数据推荐 - 显示置信度和推荐理由 - 区分基于记忆和基于规则的推荐 - **ExtendedTask 增强** - 新增 `aiMode` 字段支持 AI 模式配置 - Agent 分配信息包含在任务元数据中 - 支持记录分配理由和置信度 #### 🔧 技术改进 - AI 配置管理系统 (AIConfigManager) - Memory 系统桩实现(临时方案) - Agent 分配的记录和学习机制 - 优雅降级:Memory 系统故障不影响基础功能 #### 📚 配置文件 新增 `.workflow/config/ai.json` 配置文件: ```json { "mode": "auto", "memory": { "enabled": false, "userId": "user", "projectId": "project-id" }, "agentAllocation": { "preferMemory": true, "minConfidence": 0.7, "fallbackToRules": true }, "defaults": { "enableForNewTasks": true, "enableForPRD": true, "autoAssignAgents": true } } ``` ## [0.4.0] - 2025-07-19 ### 🚀 Major Architecture Update - **统一架构设计** 🏗️ - 创建了完整的 Gongfu 统一架构设计文档 - 定义了以任务为中心的智能开发平台理念 - 设计了功能模块关系和数据流 - 使用 EARS 语法定义了所有架构改进需求 - **扩展任务模型** 📋 - 新增 `ExtendedTask` 类型,支持更丰富的任务信息 - 添加规范关联字段:specId, designId, workflowId, prdId - 添加 AI 协作字段:agentAssignments, promptTemplates, aiMode - 添加任务产出追踪:artifacts (代码、文档、测试) - 添加验收标准:acceptanceCriteria (EARS 格式) - 增强元数据:source, techStack, scope, riskLevel - **数据迁移工具** 🔄 - 新增 `workflow migrate` 命令,支持平滑升级 - 自动备份原始数据 - 智能推断扩展字段 - 支持数据验证和回滚 - **核心实现升级** 🔧 - TaskStore 支持扩展任务的存储和查询 - 新增扩展任务查询方法:按 PRD、设计文档、工作流、Agent、技术栈等 - API 端点支持扩展任务的所有新字段 - 完整的向后兼容性,现有任务无需修改 - **PRD-任务双向关联** 🔗 - PRDGenerator 自动创建关联任务(6个标准任务:需求分析、设计、开发、测试、文档、部署) - 任务自动关联 PRD ID,支持双向查询 - PRDManager 实现 PRD 生命周期管理和进度跟踪 - HookManager 集成,任务状态变更自动更新 PRD 进度 - 新增 PRD 相关 API 端点:统计信息、进度报告、进度更新 ### ✨ Features - **任务模型扩展** - 支持任务与 PRD、设计文档、工作流的关联 - 支持多 Agent 协作模式(主执行、审查、咨询) - 支持 Prompt 模板配置(执行、验证、审查) - 支持任务产出物追踪(代码、文档、测试) - 支持 EARS 格式的验收标准 - **新增 API 端点** - `GET /api/v2/tasks/:id/extended` - 获取扩展任务详情 - `GET /api/v2/tasks/by-prd/:prdId` - 按 PRD 获取任务 - `GET /api/v2/tasks/by-design/:designId` - 按设计文档获取任务 - `GET /api/v2/tasks/by-workflow/:workflowId` - 按工作流获取任务 - `GET /api/v2/tasks/by-agent/:agentName` - 按 Agent 获取任务 - `GET /api/v2/tasks/by-tech/:tech` - 按技术栈获取任务 - **架构文档体系** - `docs/UNIFIED-ARCHITECTURE.md` - 统一架构设计 - `docs/requirements/ARCH-REQUIREMENTS.md` - EARS 格式需求 - `docs/architecture/MODULE-RELATIONSHIPS.md` - 模块关系设计 ### 🔧 Improvements - 增强了任务类型系统,支持更复杂的业务场景 - 改进了数据模型,为未来的功能扩展打下基础 - 优化了模块间的数据流设计 - TaskStore 新增多个专用查询方法 - API TaskService 使用真正的 TaskStore 替代简化版本 ### 📚 Documentation - 完整的统一架构设计文档 - EARS 格式的架构改进需求规范 - 详细的功能模块关系和数据流图 - 任务模型扩展的迁移指南 ### 🔄 Migration 如果您有现有的任务数据,请运行以下命令进行迁移: ```bash # 检查是否需要迁移 workflow migrate --check # 执行迁移(会自动备份) workflow migrate # 迁移并验证 workflow migrate --validate ``` ## [0.3.17] - 2025-07-19 ### ✨ Features - **工作流可视化系统** 📊 - 新增 `WorkflowVisualizer` 类,支持多种可视化格式 - 支持 ASCII、Mermaid、Graphviz、JSON 四种输出格式 - 可视化工作流定义、任务依赖、协作关系 - 支持水平/垂直布局、颜色编码、详细信息显示 - 导出功能支持保存为文件 - **新命令: workflow visualize** 👁️ - `workflow viz workflow` - 可视化工作流定义 - `workflow viz tasks` - 可视化任务列表和状态 - `workflow viz collaboration` - 可视化协作任务 - `workflow viz dependencies` - 可视化任务依赖关系图 - **可视化功能特性** 🎨 - 智能布局:根据内容自动调整展示方式 - 状态颜色:不同状态使用不同颜色标识 - 依赖分析:展示上下游依赖关系 - 过滤功能:按状态、任务等条件过滤 - 统计信息:显示任务数量、依赖关系等统计 ### 🔧 Improvements - 增强了工作流引擎,支持可视化导出 - 优化了任务依赖关系的展示逻辑 - 改进了协作任务的流程展示 - 添加了图表导出和格式转换功能 ### 📚 Documentation - 新增 `docs/workflow-visualization.md` 详细文档 - 提供了各种格式的示例和使用场景 - 包含最佳实践和集成指南 ## [0.3.16] - 2025-07-19 ### ✨ Features - **多 Agent 协作系统** 🤝 - 新增 `AgentCollaborationManager` 管理多 Agent 协作任务 - 内置 8 个专业 Agent:前端、后端、架构师、测试、产品、审查、DevOps、文档 - 3 种预定义协作策略:全栈开发、代码审查、功能规划 - 支持顺序、并行、条件三种执行模式 - Agent 能力定义和协作关系配置 - **新命令: workflow collaborate** 👥 - `workflow collaborate start [task]` - 启动协作任务 - `workflow collaborate list` - 列出所有协作任务 - `workflow collaborate status <id>` - 查看协作状态 - `workflow collaborate strategies` - 查看可用策略 - `workflow collaborate custom` - 创建自定义协作 - **协作功能特性** 🎯 - 智能策略推荐:根据任务内容推荐最佳协作策略 - 任务依赖管理:支持 Agent 间的依赖关系 - 结果汇总报告:自动生成协作执行总结 - 事件监听机制:跟踪协作任务的生命周期 - Hook 系统集成:支持协作创建和完成钩子 ### 🔧 Improvements - 增强了 AgentManager,支持加载内置 Agent - 优化了 Agent 执行上下文,支持传递前置结果 - 改进了任务分配逻辑,支持条件执行 - 增加了协作任务的持久化存储 ### 📚 Documentation - 新增 `docs/agent-collaboration.md` 详细文档 - 提供了完整的使用示例和最佳实践 - 包含三种协作策略的应用场景 ## [0.3.15] - 2025-07-19 ### ✨ Features - **Memory 增强的 ContextBuilder** 🧠 - 集成 `@gongfu/memory` 系统,提供智能上下文构建 - 任务建议:基于历史经验推荐任务分解和实施方案 - Agent 推荐:根据任务类型和历史表现推荐最佳 Agent - 用户偏好:学习并适配用户的工作模式和编码风格 - 历史经验:从相似任务中提取有价值的经验教训 - **Memory 集成架构** 🔄 - `MemoryIntegration` 模块化设计,支持可选集成 - 工厂函数自动检测和配置 Memory 系统 - 优雅降级:Memory 系统故障不影响基础功能 - 异步保存:上下文构建不阻塞,后台保存到记忆系统 - **增强的上下文项** 📊 - 记忆搜索结果,提供相关历史经验 - 任务模式识别,包括平均完成时间和常见挑战 - Agent 性能数据,包括成功率和执行时间 - 用户工作模式,包括高效时段和偏好设置 ### 🔧 Improvements - 优化了 ContextBuilder 的扩展性,支持插件式增强 - 改进了上下文元数据,增加 `memoryEnhanced` 标记 - 增强了日志输出,显示 Memory 增强效果 ### 📚 Documentation - 新增 `MEMORY-ENHANCED-CONTEXT.md` 详细文档 - 提供了完整的使用示例和配置说明 - 包含故障排除和扩展开发指南 ## [0.3.14] - 2025-07-19 ### ✨ Features - **智能工作流触发器系统** 🎯 - 新增 `WorkflowTriggerManager` 管理工作流触发器 - 支持 6 种触发类型:文件变更、任务状态、文档审批、EARS 需求、定时、Webhook - 内置 10 个智能触发器,覆盖常见自动化场景 - 支持防抖和冷却机制,避免过度触发 - 条件判断支持:模式匹配、表达式、自定义函数 - **新命令: workflow triggers** 🔧 - `workflow triggers list` - 列出所有工作流触发器 - `workflow triggers enable <id>` - 启用触发器 - `workflow triggers disable <id>` - 禁用触发器 - `workflow triggers status [id]` - 查看触发器状态 - `workflow triggers test <id>` - 测试触发器 - **内置工作流** 📋 - 从 PRD 生成设计文档工作流 - 从设计文档创建任务工作流 - EARS 需求转换任务工作流 - 任务依赖检查工作流 - 文档同步到知识库工作流 ### 🔧 Improvements - 增强了工作流引擎,支持触发器集成 - 优化了事件系统,支持跨组件通信 - 改进了条件判断逻辑 ## [0.3.13] - 2025-07-19 ### ✨ Features - **EARS 语法支持** 📝 - 新增完整的 EARS (Easy Approach to Requirements Syntax) 解析器 - 支持所有 EARS 需求类型:Ubiquitous、Event-Driven、State-Driven、Optional、Complex、Unwanted - EARS 需求到任务的自动转换器 - EARS 需求文档生成器 - **新命令: workflow ears** 🎯 - `workflow ears parse <file>` - 解析 EARS 格式的需求文档 - `workflow ears generate` - 生成 EARS 需求文档(支持交互式) - `workflow ears convert <file>` - 将 EARS 需求转换为任务 - `workflow ears validate <file>` - 验证 EARS 需求格式 - `workflow ears examples` - 显示 EARS 语法示例 - **EARS 模板** 📋 - PRD 的 EARS 格式模板 - 基于 EARS 的设计文档模板 - EARS 需求追踪矩阵 - 自动测试用例生成 ### 🔧 Improvements - 更新了设计文档模板,集成 EARS 需求追踪 - 增强了任务生成逻辑,支持从 EARS 需求创建任务 - 优化了需求管理工作流 ## [0.3.12] - 2025-07-19 ### ✨ Features - **Hooks 系统** 🎣 - 新增类似 Git hooks 的事件驱动框架 - 支持任务、文档、工作流、文件、AI 等多种事件类型 - 内置 6 个常用 hooks(任务同步、TODO 更新、PRD 备份等) - 支持 Bash 和 JavaScript 脚本 hooks - Hook 优先级和链式调用支持 - **新命令: workflow hooks** 🔗 - `workflow hooks list` - 列出所有可用的 hooks - `workflow hooks create <type>` - 创建新的 hook 脚本 - `workflow hooks enable/disable <name>` - 启用/禁用 hook - `workflow hooks test <type>` - 测试 hook 执行 - **Hook 集成** 🔄 - TaskStore 自动触发任务相关 hooks - DesignDocManager 触发文档相关 hooks - 支持自定义 hook 脚本和内置函数 hooks - 完整的错误处理和超时机制 ### 🔧 Improvements - 修复了 workflow-manager.ts 中的 TypeScript 类型错误 - 优化了任务状态变更的 hook 触发逻辑 - 增强了错误处理和日志记录 ## [0.3.11] - 2025-07-19 ### ✨ Features - **设计文档管理系统** 🎨 - 新增 `DesignDocManager` 类,完善三文档体系 - 支持从 PRD 自动生成设计文档 - 提供完整版和简化版设计文档模板 - 设计文档包含系统架构、数据模型、接口设计等内容 - 自动从设计文档创建开发任务 - **新命令: workflow design** 📐 - `workflow design generate [prd-path]` - 从 PRD 生成设计文档 - `workflow design list` - 列出所有设计文档 - `workflow design view <id>` - 查看设计文档详情 - `workflow design approve <id>` - 审批设计文档 - **文档关联系统** 🔗 - PRD → Design → Tasks 自动流转 - 设计文档与 PRD 双向关联 - 设计文档与任务自动关联 - 支持文档状态管理(draft/review/approved/archived) ### 🔧 Improvements - 优化了文档模板系统,支持更灵活的模板定制 - 增强了任务创建流程,支持从设计文档批量创建任务 ## [0.3.9] - 2025-07-11 ### ✨ Features - **PRD 模板系统** 📝 - 恢复了 `.kongfu.backup` 中的 PRD 模板到 `.workflow/templates/prd/` - 提供完整版和简化版两种模板 - 支持自定义模板 - **Prompt 模板系统** 🤖 - 恢复了结构化的 Prompt 模板到 `.workflow/prompts/` - 包含 thinking-process、task-execution 等通用模板 - 包含后端工程师、内容编辑、需求分析师等 Agent prompts - **新命令: workflow new** 🚀 - 实现 "一句话到发布" 的愿景 - 从用户想法直接生成 PRD 和任务 - 支持模板选择(full/simple/custom) - 自动解析 PRD 并创建任务 - 使用方法:`workflow new "我想做一个用户登录功能"` - **项目文档系统** 📚 - 恢复了项目文档到 `.workflow/docs/` - 包含架构决策记录(ADR) - 包含开发计划、项目路线图等 ### 🔧 Improvements - **PRD 生成器** - 新增 `PRDGenerator` 类,支持使用 Handlebars 模板 - 智能解析用户输入,提取标题、功能、用户类型 - 自动填充模板变量 ## [0.3.8] - 2025-07-11 ### 🐛 Bug Fixes - **Remove deprecated .gongfu/task directory** - Fixed issue where `.gongfu/task` directory was being created unnecessarily - Commented out directory creation in `UnifiedTaskService` - Updated `convert` command to use `.workflow` as default path - Added automatic cleanup of deprecated `.gongfu` directory during initialization - Now using `.workflow` as the single source of truth for all task data ### 🔧 Improvements - **Directory cleanup** - Workflow initialization now automatically removes old `.gongfu` directories - Prevents confusion from having multiple task storage locations ## [0.3.7] - 2025-07-11 ### ✨ Features - **Claude Code Integration** 🤖 - Integrated @gongfu/claude-integration for complete Claude Code control - Added `workflow claude` command with subcommands: - `status` - Check Claude Code status and current task - `monitor` - Start real-time activity monitoring with SSE support - `task <task>` - Send tasks to Claude with priority support - `start` - Start Claude Code with specific task (interactive/background) - `setup-hooks` - Configure Claude hooks for better integration - `log` - Log Claude activity with custom types - Real-time activity monitoring with Web UI support - Task assignment and tracking capabilities ### 📦 Dependencies - Added @gongfu/claude-integration ^0.1.0 ## [0.3.6] - 2025-07-09 ### ✨ Features - **Task Delete Command** 🗑️ - Added `workflow task delete <taskId>` command - Supports `--force` flag to skip confirmation prompt - Shows task details before deletion for safety - Integrates with sync system for real-time updates ## [0.3.2] - 2025-07-08 ### 🐛 Bug Fixes - **Critical Spelling Error Fix** 🔧 - Fixed package name typo: `@gongfuorkflow-cli``@gongfu/workflow-cli` - Fixed 5 instances in permission configurations - Fixed orchestrate command hook configurations - This error prevented Claude Code hooks from working properly - Users need to run `workflow init --claude` again to update configurations ## [0.3.0] - 2025-01-08 ### 🎉 Major Release - Feature Complete Migration This release completes the migration of core features from @gongfu/cli and introduces project identification for better integration with web applications. ### ✨ Features - **Project Identification System** 🆔 - Every project now has a unique ID stored in `.workflow/config.json` - Added `workflow project` command for project management - All API responses include project metadata - New API endpoints for project information management - **Stats Command** 📊 - Complete project statistics and analytics - Task completion rate analysis - Time trend visualization - Export to CSV/HTML formats - Git integration for contributor stats - **Document Management** 📝 - Full document lifecycle management with `workflow doc` command - Support for multiple document types (design, api, guide, changelog) - Frontmatter metadata support - Full-text search capabilities - HTML/PDF export options - **Enhanced API Server** 🚀 - New `/api/v2/project/*` endpoints - Automatic project info injection in responses - Better error handling and validation ### 🔧 Improvements - Better error messages throughout the CLI - Improved performance for large projects - Enhanced TypeScript types - More comprehensive test coverage ### 🐛 Bug Fixes - Fixed path resolution issues in Windows - Corrected task counting in stats command - Resolved API response formatting inconsistencies ### 📦 Dependencies - Added `uuid` for project ID generation (already included) - Added `gray-matter` for document frontmatter parsing - Added `slugify` for document slug generation - Added `open` for opening files/URLs - Removed dependency on `@gongfu/core` and `@gongfu/shared` ### 📝 Documentation - Added comprehensive user migration guide - Created architecture decision records - Updated all command documentation - Added project identification implementation guide ### ⚠️ Breaking Changes - Directory structure changed from `.kongfu/` to `.workflow/` - Task storage format changed from YAML files to `tasks.json` - Some commands have been renamed for clarity ### 🔄 Migration Notes Users migrating from @gongfu/cli should: 1. Uninstall `@gongfu/cli`: `npm uninstall -g @gongfu/cli` 2. Install `@gongfu/workflow-cli`: `npm install -g @gongfu/workflow-cli` 3. Run `workflow init` in your project directory 4. See the [migration guide](../../docs/migration/user-migration-guide.md) for detailed instructions ### 🚫 Not Migrated After careful evaluation, the following features were not migrated: - **Workspace management**: Conflicts with single-project design philosophy - **Agent system**: Will be implemented as a plugin system in the future --- ## [0.2.7] - 2025-01-08 ### 🐛 Bug Fixes - Fixed incorrect package name in Claude Code hooks (`@gongfu/workflow-cli``@gongfu/workflow-cli`) - Added support for `-v` flag to display version (in addition to `--version`) ### 🔧 Improvements - Better Claude Code integration with corrected hook commands - Enhanced version display options for better CLI experience ## [0.2.6] - 2025-01-06 ### 🎉 New Features #### PRD Parser (Inspired by claude-task-master) - **Automatic Task Generation**: Parse Product Requirements Documents to automatically generate development tasks - **Smart Recognition**: Identifies task types, priorities, and complexity from natural language - **Flexible Formats**: Supports various PRD formats with intelligent parsing - **Batch Operations**: Generate dozens of tasks from a single document #### Enhanced Task Management - **Task Tagging System**: Organize tasks with flexible tags and groups - **Quick Commands**: Added `workflow next` for faster task navigation - **Smart Search**: Find tasks by content, tags, or metadata - **Improved Complexity Analysis**: Better estimation with auto-splitting for complex tasks ### 📚 Documentation - Added comprehensive **Intelligent Development Flow Guide** - Created **Automated Development Example** with real-world scenarios - Updated README with new features and examples - Added PRD writing best practices ### 🛠️ Improvements - Better error handling in task creation - Improved task formatting in terminal output - Enhanced colors utility for better visual feedback - Added formatters for consistent output display ### 🐛 Bug Fixes - Fixed task store initialization issues - Resolved color display problems in tables - Fixed PRD parser title extraction logic ## [0.2.5] - 2025-01-05 ### 🎯 Task Orchestrator - Hook-based task orchestration for Claude Code - Automatic task assignment and instruction generation - Deep integration with Claude Code via hooks - Progress tracking and completion detection - Permission management system ### 🔐 Security - Automatic Claude Code permission configuration - Permission checking and fixing commands - Enhanced security for file operations ## [0.2.4] - 2025-01-04 ### 👥 Team Collaboration - Multi-user support with real-time sync - Intelligent task assignment based on skills - Team dashboard and activity tracking - Availability status management ## [0.2.3] - 2025-01-03 ### 📋 Task Templates - 6 built-in templates for common development tasks - Task dependency visualization - Tree, graph, and mermaid diagram formats ## [0.2.2] - 2025-01-02 ### ⏱️ Task Estimation - Intelligent time prediction based on complexity - Task splitting for large tasks - 24-hour auto-dev mode for continuous development ## [0.2.1] - 2024-12-30 ### 🐛 Bug Fixes - Fixed workflow initialization issues - Improved error handling - Better Claude Code integration ## [0.2.0] - 2024-12-28 ### 🚀 Major Release - Complete rewrite with TypeScript - MCP integration - Knowledge base system - Workflow templates - Real-time monitoring ## [0.1.0] - 2024-12-20 ### 🎉 Initial Release - Basic task management - TODO file syncing - Simple workflow support - CLI interface