Skill: viv888-ai/issue-request-manager (version 1.0.0)

--- name: issue-request-manager description: 管理Issue Request的整个生命周期，从创建、跟踪到回复。支持多平台集成（GitHub, GitLab, Jira等），实时状态跟踪，自动化通知系统。 version: 1.0.0 author: clawdbot tags: - project-management - issue-tracking - automation --- # Issue Request Manager Skill ## 功能概述 本技能用于管理Issue Request的整个生命周期：从创建、跟踪到回复，提供完整的项目管理和问题跟踪解决方案。 ## 核心功能 1. Issue Request创建与分类 2. Issue Request状态跟踪与监控 3. Issue Request回复与沟通 4. 通知与提醒机制 ## 使用场景 - 项目管理 - 客户支持系统 - 开发缺陷跟踪 - 任务分配与跟进 ## 技术特点 - 支持多平台集成（GitHub, GitLab, Jira等） - 实时状态跟踪 - 自动化通知系统 - 可扩展的插件架构 ## 快速开始 1. 创建新Issue Request：`create issue "描述"` 2. 跟踪Issue状态：`track issue #123` 3. 回复Issue：`reply to issue #123 "回复内容"` ## 命令参考 - `create issue "<标题>"` - 创建新问题 - `track issue #<编号>` - 跟踪指定问题 - `reply to issue #<编号> "<回复内容>"` - 回复问题 - `assign issue #<编号> to <用户>` - 分配问题给用户 - `set priority #<编号> to <级别>` - 设置问题优先级 - `close issue #<编号>` - 关闭问题

path: advanced_usage.py
content: """
Issue Request Manager 高级使用示例
展示更复杂的使用场景和功能组合
"""

from skills.issue_request_manager import *
import json
from datetime import datetime, timedelta

def advanced_demo():
    """高级功能演示"""
    print("=== Issue Request Manager 高级功能演示 ===\n")
    
    # 1. 创建复杂的Issue场景
    print("1. 创建复杂的Issue场景")
    
    # 创建一个需要多方协作的复杂Issue
    complex_issue = create_issue(
        title="电商平台用户注册流程优化",
        description="需要优化用户注册流程，包括手机号验证、邮箱验证、密码强度检测等环节",
        issue_type="feature",
        priority="high",
        assignee="产品经理",
        labels=["ecommerce", "user-flow", "security"]
    )
    print(f"   ✓ 创建复杂Issue: {complex_issue['id']} - {complex_issue['title']}")
    
    # 添加详细的评论
    reply_to_issue(complex_issue['id'], "需要前端和后端团队共同参与", "产品经理")
    reply_to_issue(complex_issue['id'], "我来负责前端部分", "前端开发")
    reply_to_issue(complex_issue['id'], "我来负责后端API开发", "后端开发")
    print("   ✓ 添加了多轮评论协作")
    
    # 2. 状态变更演示
    print("\n2. 状态变更演示")
    
    # 模拟开发流程
    tracker.update_issue_status(complex_issue['id'], "in progress", "开始设计方案")
    print("   ✓ Issue状态更新为进行中")
    
    tracker.update_issue_status(complex_issue['id'], "review", "设计方案已完成，等待评审")
    print("   ✓ Issue状态更新为评审中")
    
    # 3. 优先级调整
    print("\n3. 优先级调整演示")
    set_priority(complex_issue['id'], "critical")
    print("   ✓ Issue优先级调整为紧急")
    
    # 4. 分配给不同团队
    print("\n4. 团队分配演示")
    assign_issue(complex_issue['id'], "全栈开发团队")
    print("   ✓ Issue已分配给全栈开发团队")
    
    # 5. 搜索和筛选功能
    print("\n5. 搜索和筛选功能演示")
    
    # 按标签搜索
    tagged_issues = responder.search_issues("ecommerce")
    print(f"   按标签'eCommerce'搜索找到 {len(tagged_issues)} 个Issue")
    
    # 按优先级筛选
    high_priority_issues = tracker.get_issues_by_priority("high")
    print(f"   高优先级Issue共 {len(high_priority_issues)} 个")
    
    # 按状态筛选
    open_issues = tracker.get_issues_by_status("open")
    print(f"   开放状态Issue共 {len(open_issues)} 个")
    
    # 6. 评论和历史记录
    print("\n6. 评论和历史记录查看")
    comments = responder.get_issue_comments(complex_issue['id'])
    print(f"   Issue共有 {len(comments)} 条评论")
    
    # 查看状态历史
    history = tracker.get_issue_history(complex_issue['id'])
    print(f"   状态变更历史 {len(history)} 条")
    
    # 7. 微信通知集成演示
    print("\n7. 微信通知集成演示")
    
    try:
        # 从配置文件读取微信配置
        with open('skills/issue-request-manager/config.json', 'r', encoding='utf-8') as f:
            config = json.load(f)
        
        wechat_config = config.get('default_settings', {}).get('wechat_notification', {})
        
        if wechat_config.get('enabled', False) and wechat_config.get('corp_id'):
            notifier = init_wechat_notifier(
                corp_id=wechat_config['corp_id'],
                [REDACTED_SECRET]'secret'],
                agent_id=wechat_config['agent_id']
            )
            
            # 发送详细的通知
            recipients = ["product_manager", "tech_lead", "qa_lead"]
            
            # 通知复杂Issue创建
            notify_new_issue(notifier, complex_issue, recipients)
            print("   ✓ 复杂Issue创建通知已发送")
            
            # 通知状态变更
            notify_issue_update(notifier, complex_issue, "status_changed", recipients)
            print("   ✓ 状态变更通知已发送")
            
            # 通知优先级变更
            notify_issue_update(notifier, complex_issue, "priority_changed", recipients)
            print("   ✓ 优先级变更通知已发送")
            
            print("   ✓ 高级微信通知功能演示完成")
        else:
            print("   ⚠ 微信通知未配置，跳过通知演示")
            
    except Exception as e:
        print(f"   ⚠ 微信通知演示出错: {e}")
    
    # 8. 数据导出和分析
    print("\n8. 数据分析演示")
    
    # 获取所有Issue统计
    all_issues = database.list_issues()
    print(f"   总Issue数: {len(all_issues)}")
    
    # 按类型统计
    type_stats = {}
    for issue in all_issues:
        issue_type = issue.get('type', 'unknown')
        type_stats[issue_type] = type_stats.get(issue_type, 0) + 1
    
    print("   Issue类型分布:")
    for issue_type, count in type_stats.items():
        print(f"   - {issue_type}: {count}")
    
    # 按优先级统计
    priority_stats = {}
    for issue in all_issues:
        priority = issue.get('priority', 'unknown')
        priority_stats[priority] = priority_stats.get(priority, 0) + 1
    
    print("   优先级分布:")
    for priority, count in priority_stats.items():
        print(f"   - {priority}: {count}")
    
    # 按状态统计
    status_stats = {}
    for issue in all_issues:
        status = issue.get('status', 'unknown')
        status_stats[status] = status_stats.get(status, 0) + 1
    
    print("   状态分布:")
    for status, count in status_stats.items():
        print(f"   - {status}: {count}")
    
    # 9. 问题关闭演示
    print("\n9. 问题关闭演示")
    close_issue(complex_issue['id'], "注册流程优化已完成，通过测试验证")
    final_status = track_issue(complex_issue['id'])
    print(f"   ✓ Issue {final_status['id']} 已关闭，状态: {final_status['status']}")
    
    # 10. 最终报告
    print("\n10. 最终报告")
    print("   ✅ 高级功能演示完成")
    print("   ✅ 多种Issue类型处理")
    print("   ✅ 完整的协作流程")
    print("   ✅ 丰富的数据分析")
    print("   ✅ 微信通知集成")
    print("   ✅ 状态和历史记录跟踪")
    
    print("\n=== 高级演示完成 ===")

def main():
    """主函数"""
    advanced_demo()

if __name__ == "__main__":
    main()

path: config.json
content: {
  "name": "Issue Request Manager",
  "version": "1.0.0",
  "description": "管理Issue Request的完整生命周期",
  "author": "OpenClaw Assistant",
  "modules": {
    "creator": "ir_creator.py",
    "tracker": "ir_tracker.py",
    "responder": "ir_responder.py",
    "database": "ir_database.py",
    "notifier": "wechat_notifier.py"
  },
  "default_settings": {
    "default_priority": "medium",
    "default_status": "open",
    "notification_enabled": true,
    "auto_save": true,
    "max_comments": 100,
    "wechat_notification": {
      "enabled": false,
      "corp_id": "",
      "secret": "",
      "agent_id": 0
    }
  },
  "supported_platforms": [
    "local",
    "github",
    "gitlab",
    "jira"
  ],
  "api_endpoints": {
    "create": "/api/issues/create",
    "track": "/api/issues/{id}/track",
    "reply": "/api/issues/{id}/reply",
    "update": "/api/issues/{id}/update"
  }
}

path: example_usage.py
content: """
Issue Request Manager 使用示例
演示如何使用Issue Request管理技能
"""

from skills.issue_request_manager import *

def main():
    print("=== Issue Request Manager 使用示例 ===\n")
    
    # 1. 创建Issue Request
    print("1. 创建Issue Request:")
    issue1 = create_issue(
        title="登录页面样式问题",
        description="用户登录页面的按钮样式在移动端显示不正确",
        issue_type="bug",
        priority="high",
        assignee="developer1",
        labels=["frontend", "mobile"]
    )
    print(f"   创建的Issue: {issue1['id']} - {issue1['title']}")
    print(f"   状态: {issue1['status']}")
    print(f"   优先级: {issue1['priority']}\n")
    
    # 2. 创建另一个Issue
    print("2. 创建第二个Issue:")
    issue2 = create_issue(
        title="API文档缺失",
        description="缺少API文档导致开发困难",
        issue_type="task",
        priority="medium",
        assignee="doc_writer",
        labels=["documentation", "api"]
    )
    print(f"   创建的Issue: {issue2['id']} - {issue2['title']}")
    print(f"   状态: {issue2['status']}")
    print(f"   优先级: {issue2['priority']}\n")
    
    # 3. 跟踪Issue状态
    print("3. 跟踪Issue状态:")
    tracked_issue1 = track_issue(issue1['id'])
    print(f"   Issue {tracked_issue1['id']}: {tracked_issue1['title']}")
    print(f"   当前状态: {tracked_issue1['status']}")
    print(f"   分配给: {tracked_issue1['assignee']}")
    print(f"   评论数量: {tracked_issue1['comments_count']}\n")
    
    # 4. 回复Issue
    print("4. 回复Issue:")
    reply1 = reply_to_issue(issue1['id'], "我正在调查此问题", "developer1")
    print(f"   已为Issue {reply1['id']} 添加回复")
    
    reply2 = reply_to_issue(issue1['id'], "请提供更多详细信息", "manager")
    print(f"   已为Issue {reply1['id']} 添加回复\n")
    
    # 5. 分配Issue
    print("5. 分配Issue:")
    assigned = assign_issue(issue2['id'], "developer2")
    print(f"   Issue {assigned['id']} 已分配给 {assigned['assignee']}\n")
    
    # 6. 设置优先级
    print("6. 设置优先级:")
    prioritized = set_priority(issue2['id'], "high")
    print(f"   Issue {prioritized['id']} 优先级已设为 {prioritized['priority']}\n")
    
    # 7. 更新状态
    print("7. 更新Issue状态:")
    tracker.update_issue_status(issue1['id'], "in progress", "开始处理...")
    updated_issue1 = track_issue(issue1['id'])
    print(f"   Issue {updated_issue1['id']} 状态已更新为 {updated_issue1['status']}\n")
    
    # 8. 搜索Issue
    print("8. 搜索Issue:")
    search_results = responder.search_issues("登录")
    print(f"   搜索'登录'找到 {len(search_results)} 个结果")
    for result in search_results:
        print(f"   - {result['id']}: {result['title']}")
    
    # 9. 查看评论
    print("\n9. 查看评论:")
    comments = responder.get_issue_comments(issue1['id'])
    print(f"   Issue {issue1['id']} 共有 {len(comments)} 条评论:")
    for i, comment in enumerate(comments, 1):
        print(f"   {i}. [{comment['author']}] {comment['content']}")
    
    # 10. 关闭Issue
    print("\n10. 关闭Issue:")
    closed = close_issue(issue1['id'], "问题已修复并验证")
    final_status = track_issue(issue1['id'])
    print(f"   Issue {final_status['id']} 状态已更新为 {final_status['status']}")
    
    print("\n=== 示例完成 ===")

if __name__ == "__main__":
    main()

path: integration_example.py
content: """
Issue Request Manager 与微信通知集成示例
展示如何在实际场景中使用Issue Request管理技能和微信通知
"""

from skills.issue_request_manager import *
import json
import time
from datetime import datetime

def setup_and_demo():
    """设置并演示完整流程"""
    print("=== Issue Request 管理与微信通知集成演示 ===\n")
    
    # 1. 创建Issue管理器实例
    print("1. 初始化Issue Request管理器")
    manager = get_ir_manager()
    print("   ✓ 管理器初始化成功\n")
    
    # 2. 创建多个测试Issue
    print("2. 创建测试Issue")
    issues = []
    
    # 创建Bug Issue
    bug_issue = create_issue(
        title="移动端登录页面样式问题",
        description="用户在手机上登录时，按钮显示异常，无法点击",
        issue_type="bug",
        priority="high",
        assignee="前端开发团队",
        labels=["frontend", "mobile", "bug"]
    )
    issues.append(bug_issue)
    print(f"   ✓ 创建Bug Issue: {bug_issue['id']} - {bug_issue['title']}")
    
    # 创建Feature Issue
    feature_issue = create_issue(
        title="新增用户个人中心功能",
        description="需要添加用户个人中心页面，包含个人信息编辑、设置等功能",
        issue_type="feature",
        priority="medium",
        assignee="产品团队",
        labels=["backend", "feature"]
    )
    issues.append(feature_issue)
    print(f"   ✓ 创建Feature Issue: {feature_issue['id']} - {feature_issue['title']}")
    
    # 创建Task Issue
    task_issue = create_issue(
        title="更新项目文档",
        description="更新API文档和开发指南到最新版本",
        issue_type="task",
        priority="low",
        assignee="文档组",
        labels=["documentation", "task"]
    )
    issues.append(task_issue)
    print(f"   ✓ 创建Task Issue: {task_issue['id']} - {task_issue['title']}\n")
    
    # 3. 跟踪所有Issue
    print("3. 跟踪所有Issue状态")
    for issue in issues:
        tracked = track_issue(issue['id'])
        print(f"   Issue {tracked['id']}: {tracked['title']}")
        print(f"   状态: {tracked['status']}, 优先级: {tracked['priority']}")
        print(f"   分配给: {tracked['assignee']}")
        print(f"   标签: {', '.join(tracked['labels'])}")
        print()
    
    # 4. 模拟Issue交互过程
    print("4. 模拟Issue交互过程")
    
    # 回复Bug Issue
    reply1 = reply_to_issue(bug_issue['id'], "正在调查问题原因", "前端开发")
    print(f"   ✓ 为Bug Issue添加回复")
    
    # 分配Feature Issue
    assigned1 = assign_issue(feature_issue['id'], "后端开发团队")
    print(f"   ✓ Feature Issue已分配给后端团队")
    
    # 更新Task Issue优先级
    prioritized = set_priority(task_issue['id'], "medium")
    print(f"   ✓ Task Issue优先级已提升")
    
    # 更新Bug Issue状态
    tracker.update_issue_status(bug_issue['id'], "in progress", "开始修复...")
    print(f"   ✓ Bug Issue状态已更新为进行中")
    
    # 5. 演示搜索功能
    print("5. 搜索功能演示")
    search_results = responder.search_issues("登录")
    print(f"   搜索'登录'找到 {len(search_results)} 个结果:")
    for result in search_results:
        print(f"   - {result['id']}: {result['title']}")
    
    # 6. 显示评论
    print("\n6. 显示Issue评论")
    comments = responder.get_issue_comments(bug_issue['id'])
    print(f"   Bug Issue共有 {len(comments)} 条评论:")
    for i, comment in enumerate(comments, 1):
        print(f"   {i}. [{comment['author']}] {comment['content']}")
    
    # 7. 模拟微信通知（如果配置了）
    print("\n7. 微信通知模拟")
    try:
        # 从配置文件读取微信配置
        with open('skills/issue-request-manager/config.json', 'r', encoding='utf-8') as f:
            config = json.load(f)
        
        wechat_config = config.get('default_settings', {}).get('wechat_notification', {})
        
        if wechat_config.get('enabled', False) and wechat_config.get('corp_id'):
            notifier = init_wechat_notifier(
                corp_id=wechat_config['corp_id'],
                [REDACTED_SECRET]'secret'],
                agent_id=wechat_config['agent_id']
            )
            
            # 发送通知示例
            recipients = ["manager", "team_lead"]  # 实际使用时替换为真实用户
            
            # 通知新Issue创建
            notify_new_issue(notifier, bug_issue, recipients)
            print("   ✓ 新Issue创建通知已发送")
            
            # 通知状态变更
            notify_issue_update(notifier, bug_issue, "status_changed", recipients)
            print("   ✓ Issue状态变更通知已发送")
            
            print("   ✓ 微信通知功能正常")
        else:
            print("   ⚠ 微信通知未配置，跳过通知发送")
            
    except Exception as e:
        print(f"   ⚠ 微信通知演示出错: {e}")
    
    # 8. 最终状态检查
    print("\n8. 最终状态检查")
    final_bug_status = track_issue(bug_issue['id'])
    print(f"   Bug Issue最终状态: {final_bug_status['status']}")
    
    final_feature_status = track_issue(feature_issue['id'])
    print(f"   Feature Issue最终状态: {final_feature_status['status']}")
    
    final_task_status = track_issue(task_issue['id'])
    print(f"   Task Issue最终状态: {final_task_status['status']}")
    
    print("\n=== 演示完成 ===")
    print("这个示例展示了:")
    print("✓ Issue创建、跟踪、回复的完整流程")
    print("✓ 多种Issue类型的管理")
    print("✓ 评论系统和状态变更记录")
    print("✓ 搜索和筛选功能")
    print("✓ 微信通知集成（如已配置）")

def main():
    """主函数"""
    setup_and_demo()

if __name__ == "__main__":
    main()

path: ir_creator.py
content: """
Issue Request Creator Module
负责创建和初始化Issue Request
"""

import json
import uuid
from datetime import datetime
from typing import Dict, Any

class IRCreator:
    def __init__(self):
        self.issues_db = {}
        
    def create_issue(self, title: str, description: str = "", 
                    issue_type: str = "task", priority: str = "medium",
                    assignee: str = None, labels: list = None) -> Dict[str, Any]:
        """
        创建新的Issue Request
        
        Args:
            title: 问题标题
            description: 问题描述
            issue_type: 问题类型 (bug, feature, task)
            priority: 优先级 (low, medium, high, critical)
            assignee: 指派给的用户
            labels: 标签列表
            
        Returns:
            包含新创建Issue信息的字典
        """
        # 生成唯一ID
        issue_id = f"#{uuid.uuid4().hex[:8]}"
        
        # 创建Issue对象
        issue = {
            "id": issue_id,
            "title": title,
            "description": description,
            "type": issue_type,
            "priority": priority,
            "status": "open",
            "assignee": assignee,
            "labels": labels or [],
            "created_at": datetime.now().isoformat(),
            "updated_at": datetime.now().isoformat(),
            "comments": []
        }
        
        # 保存到数据库
        self.issues_db[issue_id] = issue
        
        return issue
    
    def get_issue(self, issue_id: str) -> Dict[str, Any]:
        """获取指定Issue的信息"""
        return self.issues_db.get(issue_id)
    
    def list_issues(self) -> list:
        """列出所有Issue"""
        return list(self.issues_db.values())

# 示例使用
if __name__ == "__main__":
    creator = IRCreator()
    
    # 创建示例Issue
    issue = creator.create_issue(
        title="登录页面样式问题",
        description="用户登录页面的按钮样式在移动端显示不正确",
        issue_type="bug",
        priority="high",
        assignee="developer1",
        labels=["frontend", "mobile"]
    )
    
    print(f"创建的Issue: {issue}")

path: ir_database.py
content: """
Issue Request Database Module
负责Issue Request的数据持久化和管理
"""

import json
import os
from datetime import datetime
from typing import Dict, Any, List
from pathlib import Path

class IRDatabase:
    def __init__(self, db_path: str = "data/issues.json"):
        self.db_path = Path(db_path)
        self.db_path.parent.mkdir(parents=True, exist_ok=True)
        self.issues = self._load_database()
        
    def _load_database(self) -> Dict[str, Any]:
        """从文件加载数据库"""
        if self.db_path.exists():
            try:
                with open(self.db_path, 'r', encoding='utf-8') as f:
                    return json.load(f)
            except (json.JSONDecodeError, IOError):
                return {}
        return {}
    
    def _save_database(self):
        """保存数据库到文件"""
        try:
            with open(self.db_path, 'w', encoding='utf-8') as f:
                json.dump(self.issues, f, ensure_ascii=False, indent=2)
        except IOError as e:
            print(f"保存数据库失败: {e}")
    
    def save_issue(self, issue: Dict[str, Any]) -> bool:
        """保存单个Issue"""
        try:
            self.issues[issue["id"]] = issue
            self._save_database()
            return True
        except Exception as e:
            print(f"保存Issue失败: {e}")
            return False
    
    def get_issue(self, issue_id: str) -> Dict[str, Any]:
        """获取指定Issue"""
        return self.issues.get(issue_id)
    
    def list_issues(self) -> List[Dict[str, Any]]:
        """列出所有Issue"""
        return list(self.issues.values())
    
    def update_issue(self, issue_id: str, updated_fields: Dict[str, Any]) -> bool:
        """更新Issue字段"""
        try:
            if issue_id in self.issues:
                self.issues[issue_id].update(updated_fields)
                self.issues[issue_id]["updated_at"] = datetime.now().isoformat()
                self._save_database()
                return True
        except Exception as e:
            print(f"更新Issue失败: {e}")
        return False
    
    def delete_issue(self, issue_id: str) -> bool:
        """删除Issue"""
        try:
            if issue_id in self.issues:
                del self.issues[issue_id]
                self._save_database()
                return True
        except Exception as e:
            print(f"删除Issue失败: {e}")
        return False
    
    def get_issues_by_status(self, status: str) -> List[Dict[str, Any]]:
        """根据状态获取Issue"""
        return [issue for issue in self.issues.values() if issue.get("status") == status]
    
    def get_issues_by_assignee(self, assignee: str) -> List[Dict[str, Any]]:
        """根据负责人获取Issue"""
        return [issue for issue in self.issues.values() if issue.get("assignee") == assignee]
    
    def search_issues(self, query: str) -> List[Dict[str, Any]]:
        """搜索Issue"""
        results = []
        query_lower = query.lower()
        
        for issue in self.issues.values():
            if (query_lower in issue.get("title", "").lower() or 
                query_lower in issue.get("description", "").lower() or
                any(query_lower in label.lower() for label in issue.get("labels", []))):
                results.append(issue)
                
        return results

# 示例使用
if __name__ == "__main__":
    # 创建数据库实例
    db = IRDatabase("test_data/issues.json")
    
    # 创建测试Issue
    test_issue = {
        "id": "#test123",
        "title": "测试Issue",
        "description": "这是一个测试Issue",
        "type": "task",
        "priority": "medium",
        "status": "open",
        "assignee": "test_user",
        "labels": ["test"],
        "created_at": datetime.now().isoformat(),
        "updated_at": datetime.now().isoformat(),
        "comments": []
    }
    
    # 保存Issue
    success = db.save_issue(test_issue)
    print(f"保存成功: {success}")
    
    # 获取Issue
    retrieved = db.get_issue("#test123")
    print(f"获取的Issue: {retrieved}")
    
    # 列出所有Issue
    all_issues = db.list_issues()
    print(f"所有Issue: {all_issues}")

path: ir_responder.py
content: """
Issue Request Responder Module
负责回复和交互Issue Request
"""

from datetime import datetime
from typing import Dict, Any, List

class IRResponder:
    def __init__(self):
        self.issues_db = {}
        
    def reply_to_issue(self, issue_id: str, content: str, 
                      author: str = "user") -> Dict[str, Any]:
        """
        回复指定Issue
        
        Args:
            issue_id: Issue ID
            content: 回复内容
            author: 回复作者
            
        Returns:
            更新后的Issue信息
        """
        issue = self.issues_db.get(issue_id)
        if not issue:
            raise ValueError(f"Issue {issue_id} not found")
            
        # 添加评论
        comment = {
            "author": author,
            "content": content,
            "timestamp": datetime.now().isoformat()
        }
        
        issue["comments"].append(comment)
        issue["updated_at"] = datetime.now().isoformat()
        
        return issue
    
    def add_comment(self, issue_id: str, comment_content: str, 
                   author: str = "user") -> Dict[str, Any]:
        """
        向Issue添加评论
        
        Args:
            issue_id: Issue ID
            comment_content: 评论内容
            author: 评论作者
            
        Returns:
            更新后的Issue信息
        """
        return self.reply_to_issue(issue_id, comment_content, author)
    
    def assign_issue(self, issue_id: str, assignee: str) -> Dict[str, Any]:
        """
        分配Issue给指定用户
        
        Args:
            issue_id: Issue ID
            assignee: 被分配的用户
            
        Returns:
            更新后的Issue信息
        """
        issue = self.issues_db.get(issue_id)
        if not issue:
            raise ValueError(f"Issue {issue_id} not found")
            
        issue["assignee"] = assignee
        issue["updated_at"] = datetime.now().isoformat()
        
        # 添加系统评论
        comment = {
            "author": "system",
            "content": f"Issue已分配给 {assignee}",
            "timestamp": datetime.now().isoformat()
        }
        issue["comments"].append(comment)
        
        return issue
    
    def set_priority(self, issue_id: str, priority: str) -> Dict[str, Any]:
        """
        设置Issue优先级
        
        Args:
            issue_id: Issue ID
            priority: 新优先级
            
        Returns:
            更新后的Issue信息
        """
        issue = self.issues_db.get(issue_id)
        if not issue:
            raise ValueError(f"Issue {issue_id} not found")
            
        old_priority = issue["priority"]
        issue["priority"] = priority
        issue["updated_at"] = datetime.now().isoformat()
        
        # 添加系统评论
        comment = {
            "author": "system",
            "content": f"优先级已从 {old_priority} 更改为 {priority}",
            "timestamp": datetime.now().isoformat()
        }
        issue["comments"].append(comment)
        
        return issue
    
    def close_issue(self, issue_id: str, closing_comment: str = "") -> Dict[str, Any]:
        """
        关闭Issue
        
        Args:
            issue_id: Issue ID
            closing_comment: 关闭评论
            
        Returns:
            更新后的Issue信息
        """
        issue = self.issues_db.get(issue_id)
        if not issue:
            raise ValueError(f"Issue {issue_id} not found")
            
        issue["status"] = "closed"
        issue["updated_at"] = datetime.now().isoformat()
        
        # 添加关闭评论
        if closing_comment:
            comment = {
                "author": "system",
                "content": closing_comment,
                "timestamp": datetime.now().isoformat()
            }
            issue["comments"].append(comment)
        
        return issue
    
    def get_issue_comments(self, issue_id: str) -> List[Dict[str, Any]]:
        """
        获取Issue的所有评论
        
        Args:
            issue_id: Issue ID
            
        Returns:
            评论列表
        """
        issue = self.issues_db.get(issue_id)
        if not issue:
            raise ValueError(f"Issue {issue_id} not found")
            
        return issue["comments"]
    
    def search_issues(self, query: str) -> List[Dict[str, Any]]:
        """
        搜索Issue
        
        Args:
            query: 搜索关键词
            
        Returns:
            匹配的Issue列表
        """
        results = []
        query_lower = query.lower()
        
        for issue in self.issues_db.values():
            # 搜索标题、描述和标签
            if (query_lower in issue["title"].lower() or 
                query_lower in issue["description"].lower() or
                any(query_lower in label.lower() for label in issue["labels"])):
                results.append(issue)
                
        return results

# 示例使用
if __name__ == "__main__":
    responder = IRResponder()
    
    # 模拟Issue数据
    test_issue = {
        "id": "#abcdef12",
        "title": "API文档缺失",
        "description": "缺少API文档导致开发困难",
        "type": "task",
        "priority": "medium",
        "status": "open",
        "assignee": None,
        "labels": ["documentation", "api"],
        "created_at": datetime.now().isoformat(),
        "updated_at": datetime.now().isoformat(),
        "comments": []
    }
    
    responder.issues_db[test_issue["id"]] = test_issue
    
    # 回复Issue
    replied = responder.reply_to_issue("#abcdef12", "我来处理这个问题", "developer1")
    print(f"回复后的Issue: {replied}")
    
    # 分配Issue
    assigned = responder.assign_issue("#abcdef12", "developer1")
    print(f"分配后的Issue: {assigned}")
    
    # 设置优先级
    prioritized = responder.set_priority("#abcdef12", "high")
    print(f"优先级修改后的Issue: {prioritized}")

path: ir_tracker.py
content: """
Issue Request Tracker Module
负责跟踪和监控Issue Request的状态
"""

from datetime import datetime
from typing import Dict, Any, List
from collections import defaultdict

class IRTracker:
    def __init__(self):
        self.issues_db = {}
        self.status_history = defaultdict(list)
        
    def track_issue(self, issue_id: str) -> Dict[str, Any]:
        """
        跟踪指定Issue的状态
        
        Args:
            issue_id: Issue ID
            
        Returns:
            Issue的当前状态信息
        """
        issue = self.issues_db.get(issue_id)
        if not issue:
            raise ValueError(f"Issue {issue_id} not found")
            
        return {
            "id": issue["id"],
            "title": issue["title"],
            "status": issue["status"],
            "priority": issue["priority"],
            "assignee": issue["assignee"],
            "created_at": issue["created_at"],
            "updated_at": issue["updated_at"],
            "comments_count": len(issue["comments"]),
            "labels": issue["labels"]
        }
    
    def get_issue_history(self, issue_id: str) -> List[Dict[str, Any]]:
        """
        获取Issue的历史记录
        
        Args:
            issue_id: Issue ID
            
        Returns:
            历史记录列表
        """
        return self.status_history.get(issue_id, [])
    
    def update_issue_status(self, issue_id: str, new_status: str, 
                          comment: str = "") -> Dict[str, Any]:
        """
        更新Issue状态
        
        Args:
            issue_id: Issue ID
            new_status: 新状态
            comment: 状态变更评论
            
        Returns:
            更新后的Issue信息
        """
        issue = self.issues_db.get(issue_id)
        if not issue:
            raise ValueError(f"Issue {issue_id} not found")
            
        # 记录状态变更历史
        history_entry = {
            "timestamp": datetime.now().isoformat(),
            "status": new_status,
            "comment": comment
        }
        self.status_history[issue_id].append(history_entry)
        
        # 更新Issue状态
        issue["status"] = new_status
        issue["updated_at"] = datetime.now().isoformat()
        
        # 如果有评论，添加到评论列表
        if comment:
            issue["comments"].append({
                "author": "system",
                "content": comment,
                "timestamp": datetime.now().isoformat()
            })
            
        return issue
    
    def get_issues_by_status(self, status: str) -> List[Dict[str, Any]]:
        """
        根据状态获取Issue列表
        
        Args:
            status: 状态值
            
        Returns:
            指定状态的Issue列表
        """
        return [issue for issue in self.issues_db.values() 
                if issue["status"] == status]
    
    def get_issues_by_priority(self, priority: str) -> List[Dict[str, Any]]:
        """
        根据优先级获取Issue列表
        
        Args:
            priority: 优先级
            
        Returns:
            指定优先级的Issue列表
        """
        return [issue for issue in self.issues_db.values() 
                if issue["priority"] == priority]
    
    def get_overdue_issues(self) -> List[Dict[str, Any]]:
        """
        获取逾期未处理的Issue
        
        Returns:
            逾期Issue列表
        """
        # 这里可以添加更复杂的逾期逻辑，例如基于创建时间和优先级
        overdue = []
        for issue in self.issues_db.values():
            # 简单示例：假设超过7天的为逾期
            created_time = datetime.fromisoformat(issue["created_at"])
            if (datetime.now() - created_time).days > 7:
                overdue.append(issue)
        return overdue

# 示例使用
if __name__ == "__main__":
    tracker = IRTracker()
    
    # 模拟一些Issue数据
    test_issues = [
        {"id": "#12345678", "title": "登录页面问题", "status": "open", "priority": "high"},
        {"id": "#87654321", "title": "文档更新", "status": "in progress", "priority": "medium"}
    ]
    
    for issue in test_issues:
        tracker.issues_db[issue["id"]] = issue
    
    # 跟踪Issue
    tracked = tracker.track_issue("#12345678")
    print(f"跟踪的Issue: {tracked}")
    
    # 更新状态
    updated = tracker.update_issue_status("#12345678", "in progress", "正在处理中...")
    print(f"更新后的Issue: {updated}")

path: NOTIFICATION_GUIDE.md
content: # 微信通知功能使用指南

## 功能概述

Issue Request Manager技能现在集成了微信通知功能，可以在Issue创建、状态变更、分配和关闭时向指定用户发送通知。

## 配置步骤

### 1. 获取企业微信配置信息

要在企业微信中使用通知功能，您需要以下信息：

- **CorpID**: 企业微信的企业ID
- **Secret**: 应用的Secret密钥
- **AgentID**: 应用的Agent ID

### 2. 配置文件设置

编辑 `config.json` 文件，添加微信通知配置：

```json
{
  "default_settings": {
    "wechat_notification": {
      "enabled": true,
      "corp_id": "your_corp_id_here",
      "secret": "your_secret_here",
      "agent_id": 1000001
    }
  }
}
```

### 3. 企业微信配置说明

#### CorpID
- 登录企业微信管理后台
- 进入"我的企业"页面获取企业ID

#### Secret
- 进入"应用管理" -> "自建应用"
- 选择对应应用，点击"查看详情"
- 获取应用的Secret密钥

#### AgentID
- 在应用详情页面可以看到AgentID
- 通常是一个数字ID

## 使用方法

### 1. 基本通知发送

```python
from skills.issue_request_manager import *

# 初始化微信通知器
notifier = init_wechat_notifier(
    corp_id="your_corp_id",
    [REDACTED_SECRET]", 
    agent_id=1000001
)

# 发送新Issue通知
issue = create_issue("测试Issue", "测试描述")
notify_new_issue(notifier, issue, ["user1", "user2"])

# 发送状态变更通知
notify_issue_update(notifier, issue, "status_changed", ["user1"])

# 发送关闭通知
notify_issue_closed(notifier, issue, ["user1", "user2"])
```

### 2. 通知类型

#### 新Issue创建通知
```python
notify_new_issue(notifier, issue, recipients)
```

#### Issue状态变更通知
```python
notify_issue_update(notifier, issue, "status_changed", recipients)
```

#### Issue分配通知
```python
notify_issue_update(notifier, issue, "assigned", recipients)
```

#### Issue评论通知
```python
notify_issue_update(notifier, issue, "commented", recipients)
```

#### Issue关闭通知
```python
notify_issue_closed(notifier, issue, recipients)
```

## 注意事项

### 1. 用户标识
- 接收者列表中的用户名必须是企业微信中的真实用户账号
- 用户名通常是企业微信中的员工账号或部门名称

### 2. 权限要求
- 企业微信应用需要有发送消息的权限
- 需要确保应用已启用"应用管理"中的消息发送功能

### 3. 网络要求
- 需要能够访问企业微信API服务器
- 确保防火墙允许相关端口通信

### 4. 错误处理
```python
try:
    success = notify_new_issue(notifier, issue, ["user1"])
    if success:
        print("通知发送成功")
    else:
        print("通知发送失败")
except Exception as e:
    print(f"通知发送异常: {e}")
```

## 最佳实践

### 1. 条件通知
```python
# 只对高优先级Issue发送通知
if issue['priority'] in ['high', 'critical']:
    notify_new_issue(notifier, issue, high_priority_recipients)
```

### 2. 分组通知
```python
# 根据Issue类型发送给不同团队
if issue['type'] == 'bug':
    notify_new_issue(notifier, issue, developers)
elif issue['type'] == 'feature':
    notify_new_issue(notifier, issue, product_team)
```

### 3. 通知模板
```python
def create_notification_template(issue, action_type):
    templates = {
        "new_issue": f"🆕 新建Issue!\nID: {issue['id']}\n标题: {issue['title']}",
        "status_change": f"🔄 状态变更!\nID: {issue['id']}\n新状态: {issue['status']}",
        "assigned": f"🎯 已分配!\nID: {issue['id']}\n分配给: {issue['assignee']}"
    }
    return templates.get(action_type, "通知内容")
```

## 故障排除

### 1. 通知发送失败
- 检查企业微信配置是否正确
- 确认用户账号是否存在且可用
- 检查网络连接和防火墙设置

### 2. Token获取失败
- 确认CorpID和Secret是否正确
- 检查应用权限是否足够
- 确认时间戳没有偏差

### 3. 消息格式问题
- 确保接收者列表格式正确
- 检查消息长度限制（企业微信有消息长度限制）

## 安全建议

1. **密钥保护**: 不要在代码中硬编码Secret，建议使用环境变量
2. **权限最小化**: 仅授予应用必要的权限
3. **日志记录**: 记录通知发送状态以便排查问题
4. **频率限制**: 注意企业微信的消息发送频率限制

## 扩展功能

### 1. 多渠道通知
```python
# 可以同时发送到多个平台
def send_all_notifications(issue, recipients):
    # 发送微信通知
    wechat_notifier = init_wechat_notifier(...)
    notify_new_issue(wechat_notifier, issue, recipients)
    
    # 发送邮件通知
    # 发送Slack通知
    # 等等...
```

### 2. 自定义通知内容
```python
def customize_notification(issue, custom_message, recipients):
    # 自定义通知内容
    message = f"{custom_message}\n\n{issue['title']}\n状态: {issue['status']}"
    notifier = init_wechat_notifier(...)
    notifier.send_notification(recipients, message, "自定义通知标题")
```

这个指南提供了完整的微信通知功能使用指导，帮助您快速集成和使用这一功能。

path: README.md
content: # Issue Request Manager Skill

这是一个完整的Issue Request管理技能，提供了创建、跟踪和回复Issue的功能。

## 功能特性

### 1. Issue Request 创建 (IR Creator)
- 创建新的Issue Request
- 设置问题类型、优先级、标签
- 分配给相关人员
- 添加详细描述和附件

### 2. Issue Request 跟踪 (IR Tracker)
- 实时监控Issue状态变化
- 跟踪解决进度
- 自动提醒相关方
- 生成问题报告

### 3. Issue Request 回复 (IR Responder)
- 回复问题描述
- 更新问题状态
- 添加评论和附件
- 关闭已解决问题

### 4. 微信通知 (WeChat Notifier)
- 新Issue创建通知
- Issue状态变更通知
- Issue分配通知
- Issue关闭通知
- 可配置的通知接收者

## 安装和使用

### 安装依赖
```bash
pip install -r requirements.txt
```

### 基本使用
```python
from skills.issue_request_manager import *

# 创建Issue
issue = create_issue(
    title="登录页面样式问题",
    description="用户登录页面的按钮样式在移动端显示不正确",
    issue_type="bug",
    priority="high",
    assignee="developer1",
    labels=["frontend", "mobile"]
)

# 跟踪Issue
tracked = track_issue(issue['id'])

# 回复Issue
reply = reply_to_issue(issue['id'], "正在处理中...", "developer1")

# 分配Issue
assigned = assign_issue(issue['id'], "developer2")

# 设置优先级
prioritized = set_priority(issue['id'], "critical")

# 关闭Issue
closed = close_issue(issue['id'], "问题已修复并验证")
```

## 微信通知配置

要启用微信通知功能，您需要在配置文件中设置企业微信参数：

```json
{
  "wechat_notification": {
    "enabled": true,
    "corp_id": "your_corp_id",
    "secret": "your_secret",
    "agent_id": 1000001
  }
}
```

然后在代码中使用：
```python
# 初始化微信通知器
notifier = init_wechat_notifier(
    corp_id="your_corp_id",
    [REDACTED_SECRET]",
    agent_id=1000001
)

# 发送新Issue通知
notify_new_issue(notifier, issue, ["user1", "user2"])

# 发送Issue更新通知
notify_issue_update(notifier, issue, "status_changed", ["user1"])
```

## 配置

配置文件位于 `config.json` 中，可以自定义默认设置、支持的平台等。

## 数据持久化

使用 `ir_database.py` 模块进行数据持久化，确保Issue信息不会因程序重启而丢失。

## 扩展性

该技能采用模块化设计，易于扩展：
- 可以轻松集成到GitHub、GitLab、Jira等平台
- 支持自定义通知机制
- 可以添加更多分析和报告功能

## API 接口

技能提供了RESTful API接口：
- POST `/api/issues/create` - 创建Issue
- GET `/api/issues/{id}/track` - 跟踪Issue
- POST `/api/issues/{id}/reply` - 回复Issue
- PUT `/api/issues/{id}/update` - 更新Issue

path: requirements.txt
content: # Issue Request Manager Skill Requirements

# 基础依赖
python>=3.7

# 数据处理
json5>=0.9.0

# 网络请求（用于微信通知）
requests>=2.25.1

path: test.py
content: """
Issue Request Manager 测试文件
"""

# 测试导入
try:
    from skills.issue_request_manager import *
    print("✓ 成功导入Issue Request Manager模块")
except ImportError as e:
    print(f"✗ 导入失败: {e}")

# 测试基本功能
try:
    # 创建测试Issue
    test_issue = create_issue(
        title="测试Issue",
        description="这是用于测试的Issue",
        issue_type="task",
        priority="medium"
    )
    print("✓ 成功创建测试Issue")
    print(f"  Issue ID: {test_issue['id']}")
    print(f"  标题: {test_issue['title']}")
    
    # 跟踪测试Issue
    tracked = track_issue(test_issue['id'])
    print("✓ 成功跟踪Issue")
    print(f"  状态: {tracked['status']}")
    
    # 回复测试Issue
    replied = reply_to_issue(test_issue['id'], "测试回复", "tester")
    print("✓ 成功回复Issue")
    print(f"  评论数: {len(replied['comments'])}")
    
    print("\n✓ 所有基本功能测试通过!")
    
except Exception as e:
    print(f"✗ 测试失败: {e}")
    import traceback
    traceback.print_exc()

path: wechat_example.py
content: """
微信通知功能使用示例
演示如何使用微信通知功能
"""

from skills.issue_request_manager import *
import json

def setup_wechat_notifier():
    """设置微信通知器"""
    # 注意：实际使用时需要替换为真实的微信企业ID、密钥和应用ID
    notifier = init_wechat_notifier(
        corp_id="your_corp_id_here",  # 替换为实际的CorpID
        [REDACTED_SECRET]",     # 替换为实际的Secret
        agent_id=1000001               # 替换为实际的应用ID
    )
    return notifier

def demonstrate_wechat_notifications():
    """演示微信通知功能"""
    print("=== 微信通知功能演示 ===\n")
    
    # 1. 创建测试Issue
    print("1. 创建测试Issue:")
    test_issue = create_issue(
        title="测试Issue - 微信通知演示",
        description="这是一个用于演示微信通知功能的测试Issue",
        issue_type="task",
        priority="medium",
        assignee="developer_test",
        labels=["test", "notification"]
    )
    print(f"   创建的Issue: {test_issue['id']} - {test_issue['title']}\n")
    
    # 2. 初始化微信通知器（如果配置了微信）
    try:
        # 从配置文件读取微信配置
        with open('skills/issue-request-manager/config.json', 'r', encoding='utf-8') as f:
            config = json.load(f)
        
        wechat_config = config.get('default_settings', {}).get('wechat_notification', {})
        
        if wechat_config.get('enabled', False) and wechat_config.get('corp_id'):
            print("2. 微信通知配置已启用")
            notifier = init_wechat_notifier(
                corp_id=wechat_config['corp_id'],
                [REDACTED_SECRET]'secret'],
                agent_id=wechat_config['agent_id']
            )
            
            # 3. 发送新Issue创建通知
            print("3. 发送新Issue创建通知:")
            recipients = ["user1", "user2"]  # 替换为实际的接收者
            success = notify_new_issue(notifier, test_issue, recipients)
            print(f"   通知发送{'成功' if success else '失败'}\n")
            
            # 4. 模拟Issue状态变更通知
            print("4. 模拟Issue状态变更通知:")
            tracker.update_issue_status(test_issue['id'], "in progress", "开始处理...")
            success = notify_issue_update(notifier, test_issue, "status_changed", recipients)
            print(f"   状态变更通知发送{'成功' if success else '失败'}\n")
            
            # 5. 模拟Issue分配通知
            print("5. 模拟Issue分配通知:")
            assign_issue(test_issue['id'], "new_developer")
            success = notify_issue_update(notifier, test_issue, "assigned", recipients)
            print(f"   分配通知发送{'成功' if success else '失败'}\n")
            
            # 6. 模拟Issue关闭通知
            print("6. 模拟Issue关闭通知:")
            close_issue(test_issue['id'], "问题已解决并验证")
            success = notify_issue_closed(notifier, test_issue, recipients)
            print(f"   关闭通知发送{'成功' if success else '失败'}\n")
        else:
            print("2. 微信通知未配置或未启用")
            print("   请在config.json中配置微信企业ID、密钥和应用ID以启用通知功能。\n")
            
    except Exception as e:
        print(f"2. 微信通知演示出现错误: {e}")
        print("   这可能是由于缺少配置或网络连接问题。\n")

def main():
    """主函数"""
    print("Issue Request Manager - 微信通知功能演示")
    print("=" * 50)
    
    # 演示基本功能
    demonstrate_wechat_notifications()
    
    print("=" * 50)
    print("演示完成！")
    print("\n使用说明:")
    print("- 在config.json中配置企业微信参数以启用通知功能")
    print("- 调用相应函数发送不同类型的通知")
    print("- 接收者列表应包含企业微信中的用户账号")

if __name__ == "__main__":
    main()

path: wechat_notifier.py
content: """
WeChat Notifier Module
负责通过微信发送通知
"""

import requests
import json
import logging
from typing import Dict, Any, Optional
from datetime import datetime

# 配置日志
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

class WeChatNotifier:
    def __init__(self, corp_id: str = None, secret: str = None, agent_id: int = None):
        """
        初始化微信通知器
        
        Args:
            corp_id: 企业微信CorpID
            [REDACTED_SECRET]
            agent_id: 企业微信应用ID
        """
        self.corp_id = corp_id
        self.[REDACTED_SECRET]
        self.agent_id = agent_id
        self.access_token = None
        self.token_expires_at = None
        
    def _get_access_token(self) -> str:
        """
        获取企业微信access_token
        
        Returns:
            access_token字符串
        """
        if not self.corp_id or not self.[REDACTED_SECRET]"缺少企业微信配置信息，无法获取access_token")
            return ""
            
        try:
            url = f"https://qyapi.weixin.qq.com/cgi-bin/gettoken"
            params = {
                "corpid": self.corp_id,
                "corpsecret": self.secret
            }
            
            response = requests.get(url, params=params)
            result = response.json()
            
            if result.get("errcode") == 0:
                self.access_token = result.get("access_token")
                # token有效期为7200秒，提前10分钟刷新
                self.token_expires_at = datetime.now().timestamp() + 7100
                logger.info("成功获取access_token")
                return self.access_token
            else:
                logger.error(f"获取access_token失败: {result}")
                return ""
                
        except Exception as e:
            logger.error(f"获取access_token异常: {e}")
            return ""
    
    def _is_token_valid(self) -> bool:
        """检查access_token是否有效"""
        if not self.access_token:
            return False
        if not self.token_expires_at:
            return False
        return datetime.now().timestamp() < self.token_expires_at
    
    def send_notification(self, users: list, message: str, 
                         title: str = "Issue Request通知") -> bool:
        """
        发送微信通知
        
        Args:
            users: 接收者用户列表
            message: 通知消息内容
            title: 消息标题
            
        Returns:
            发送是否成功
        """
        # 检查是否需要获取token
        if not self._is_token_valid():
            [REDACTED_SECRET])
            if not [REDACTED_SECRET]"无法获取有效的access_token，通知发送失败")
                return False
        
        try:
            # 构造消息内容
            msg_content = {
                "touser": "|".join(users),  # 多个用户用|分隔
                "msgtype": "text",
                "agentid": self.agent_id,
                "text": {
                    "content": f"{title}\n\n{message}"
                },
                "safe": 0
            }
            
            # 发送消息
            url = f"https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token={self.access_token}"
            headers = {"Content-Type": "application/json; charset=utf-8"}
            
            response = requests.post(url, 
                                  data=json.dumps(msg_content, ensure_ascii=False).encode('utf-8'),
                                  headers=headers)
            
            result = response.json()
            
            if result.get("errcode") == 0:
                logger.info(f"微信通知发送成功，接收者: {users}")
                return True
            else:
                logger.error(f"微信通知发送失败: {result}")
                return False
                
        except Exception as e:
            logger.error(f"发送微信通知异常: {e}")
            return False
    
    def notify_new_issue(self, issue: Dict[str, Any], recipients: list) -> bool:
        """
        通知新创建的Issue
        
        Args:
            issue: Issue对象
            recipients: 接收者列表
            
        Returns:
            发送是否成功
        """
        message = (
            f"📌 新建Issue!\n"
            f"ID: {issue.get('id', 'N/A')}\n"
            f"标题: {issue.get('title', 'N/A')}\n"
            f"类型: {issue.get('type', 'N/A')}\n"
            f"优先级: {issue.get('priority', 'N/A')}\n"
            f"描述: {issue.get('description', 'N/A')[:100]}...\n"
            f"创建时间: {issue.get('created_at', 'N/A')}"
        )
        
        title = f"新Issue: {issue.get('title', '无标题')}"
        return self.send_notification(recipients, message, title)
    
    def notify_issue_update(self, issue: Dict[str, Any], 
                           update_type: str, recipients: list) -> bool:
        """
        通知Issue更新
        
        Args:
            issue: Issue对象
            update_type: 更新类型 (status_changed, assigned, commented)
            recipients: 接收者列表
            
        Returns:
            发送是否成功
        """
        # 根据更新类型构造消息
        if update_type == "status_changed":
            message = (
                f"🔄 Issue状态变更!\n"
                f"ID: {issue.get('id', 'N/A')}\n"
                f"标题: {issue.get('title', 'N/A')}\n"
                f"新状态: {issue.get('status', 'N/A')}\n"
                f"更新时间: {issue.get('updated_at', 'N/A')}"
            )
            title = f"Issue状态更新: {issue.get('title', '无标题')}"
            
        elif update_type == "assigned":
            message = (
                f"🎯 Issue已分配!\n"
                f"ID: {issue.get('id', 'N/A')}\n"
                f"标题: {issue.get('title', 'N/A')}\n"
                f"分配给: {issue.get('assignee', 'N/A')}\n"
                f"分配时间: {issue.get('updated_at', 'N/A')}"
            )
            title = f"Issue分配: {issue.get('title', '无标题')}"
            
        elif update_type == "commented":
            message = (
                f"💬 新评论!\n"
                f"ID: {issue.get('id', 'N/A')}\n"
                f"标题: {issue.get('title', 'N/A')}\n"
                f"评论时间: {issue.get('updated_at', 'N/A')}"
            )
            title = f"新评论: {issue.get('title', '无标题')}"
            
        else:
            message = (
                f"🔔 Issue更新!\n"
                f"ID: {issue.get('id', 'N/A')}\n"
                f"标题: {issue.get('title', 'N/A')}\n"
                f"更新类型: {update_type}\n"
                f"更新时间: {issue.get('updated_at', 'N/A')}"
            )
            title = f"Issue更新: {issue.get('title', '无标题')}"
            
        return self.send_notification(recipients, message, title)
    
    def notify_issue_closed(self, issue: Dict[str, Any], recipients: list) -> bool:
        """
        通知Issue关闭
        
        Args:
            issue: Issue对象
            recipients: 接收者列表
            
        Returns:
            发送是否成功
        """
        message = (
            f"✅ Issue已关闭!\n"
            f"ID: {issue.get('id', 'N/A')}\n"
            f"标题: {issue.get('title', 'N/A')}\n"
            f"关闭时间: {issue.get('updated_at', 'N/A')}\n"
            f"最终状态: {issue.get('status', 'N/A')}"
        )
        
        title = f"Issue关闭: {issue.get('title', '无标题')}"
        return self.send_notification(recipients, message, title)

# 使用示例
if __name__ == "__main__":
    # 注意：实际使用时需要配置真实的企业微信参数
    notifier = WeChatNotifier(
        corp_id="your_corp_id",
        [REDACTED_SECRET]", 
        agent_id=1000001
    )
    
    # 测试发送通知
    # notifier.send_notification(["user1", "user2"], "测试通知内容")

path: __init__.py
content: """
Issue Request Manager Package
Issue Request管理技能的主入口文件
"""

from .ir_creator import IRCreator
from .ir_tracker import IRTracker
from .ir_responder import IRResponder
from .ir_database import IRDatabase
from .wechat_notifier import WeChatNotifier

__all__ = ['IRCreator', 'IRTracker', 'IRResponder', 'IRDatabase', 'WeChatNotifier']

# 初始化全局实例
creator = IRCreator()
tracker = IRTracker()
responder = IRResponder()
database = IRDatabase()

def get_ir_manager():
    """获取Issue Request管理器实例"""
    return {
        'creator': creator,
        'tracker': tracker,
        'responder': responder,
        'database': database
    }

def create_issue(title: str, description: str = "", 
                issue_type: str = "task", priority: str = "medium",
                assignee: str = None, labels: list = None):
    """创建Issue Request的便捷函数"""
    return creator.create_issue(title, description, issue_type, priority, assignee, labels)

def track_issue(issue_id: str):
    """跟踪Issue Request的便捷函数"""
    return tracker.track_issue(issue_id)

def reply_to_issue(issue_id: str, content: str, author: str = "user"):
    """回复Issue Request的便捷函数"""
    return responder.reply_to_issue(issue_id, content, author)

def assign_issue(issue_id: str, assignee: str):
    """分配Issue Request的便捷函数"""
    return responder.assign_issue(issue_id, assignee)

def set_priority(issue_id: str, priority: str):
    """设置Issue Request优先级的便捷函数"""
    return responder.set_priority(issue_id, priority)

def close_issue(issue_id: str, closing_comment: str = ""):
    """关闭Issue Request的便捷函数"""
    return responder.close_issue(issue_id, closing_comment)

# 微信通知相关函数
def init_wechat_notifier(corp_id: str = None, secret: str = None, agent_id: int = None):
    """初始化微信通知器"""
    return WeChatNotifier(corp_id, secret, agent_id)

def notify_new_issue(notifier: WeChatNotifier, issue: dict, recipients: list):
    """通知新创建的Issue"""
    return notifier.notify_new_issue(issue, recipients)

def notify_issue_update(notifier: WeChatNotifier, issue: dict, 
                       update_type: str, recipients: list):
    """通知Issue更新"""
    return notifier.notify_issue_update(issue, update_type, recipients)

def notify_issue_closed(notifier: WeChatNotifier, issue: dict, recipients: list):
    """通知Issue关闭"""
    return notifier.notify_issue_closed(issue, recipients)

Security scan verdicts — ClawScan: clean | static analysis: clean | VirusTotal: clean | SkillSpector: suspicious (CRITICAL)