Metadata-Version: 2.4
Name: magic-protocol
Version: 0.1.0
Summary: Magic 系列项目的跨项目契约：类型与 Protocol
Author-email: wxd123 <wxd123@users.noreply.github.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/wxd123/magic-protocol
Project-URL: Repository, https://github.com/wxd123/magic-protocol
Project-URL: Issues, https://github.com/wxd123/magic-protocol/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# magic-protocol

Magic 系列项目的跨项目契约。

## 安装

pip install magic-protocol

## 内容

- `Command` — 命令协议
- `CommandConfig` — 命令配置
- `Result` — 通用结果

## 用法

### 实现一个 Command

class MyCommand:
    @property
    def name(self) -> str:
        return "my.command"

    def execute(self, cfg: CommandConfig) -> Result:
        return Result.success({"done": True})

不需要继承，形状匹配即可。

### 使用 Result

result = Result.success({"files": [...]})
result = Result.failure("出错了")

## 许可

MIT
