#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Windows命令执行Skill"""

import sys
import os
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(__file__))))

from skills.base_skill import BaseSkill
from network_tools import run_windows_command


class WindowsCommandSkill(BaseSkill):
    """Windows命令执行Skill"""
    
    def get_metadata(self):
        return {
            "name": "windows_command",
            "display_name": "Windows命令",
            "description": "执行Windows系统命令",
            "category": "system",
            "keywords": ["命令", "cmd", "执行", "系统", "ipconfig", "netstat"],
            "parameters": [
                {
                    "name": "command",
                    "type": "string",
                    "required": True,
                    "description": "要执行的命令"
                }
            ],
            "examples": [
                "执行ipconfig /all",
                "查看IP配置",
                "执行netstat -ano"
            ],
            "requires_admin": False,
            "requires_ui": False
        }
    
    def execute(self, command: str) -> str:
        """执行Windows命令"""
        return run_windows_command(command)
